From bd62a9b8cc4fb49ab6b65d2614c9ce55c8a6071d Mon Sep 17 00:00:00 2001 From: Mitra Ardron Date: Sun, 7 Jul 2019 18:20:01 +1000 Subject: [PATCH] Roll back to ipfs 0.35.0 till figure out webpack issue --- dist/dweb-transports-bundle.js | 119 +- yarn.lock | 1873 ++++++++++++++++---------------- 2 files changed, 986 insertions(+), 1006 deletions(-) diff --git a/dist/dweb-transports-bundle.js b/dist/dweb-transports-bundle.js index ecaf958..6ccef8a 100644 --- a/dist/dweb-transports-bundle.js +++ b/dist/dweb-transports-bundle.js @@ -1,11 +1,11 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function t(){return e.default}:function t(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=737)}([function(e,t,n){"use strict";(function(e){ +!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function t(){return e.default}:function t(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=639)}([function(e,t,n){"use strict";(function(e){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -var r=n(742),i=n(387),o=n(51);function s(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function v(e){return+e!=e&&(e=0),l.alloc(+e)}function w(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return X(e).length;default:if(r)return J(e).length;t=(""+t).toLowerCase(),r=!0}}function _(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return L(this,t,n);case"utf8":case"utf-8":return P(this,t,n);case"ascii":return N(this,t,n);case"latin1":case"binary":return M(this,t,n);case"base64":return O(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function k(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function S(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:E(e,t,n,r,i);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):E(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function E(e,t,n,r,i){var o=1,s=e.length,a=t.length,u;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,a/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(u=n;us&&(n=s-a),u=n;u>=0;u--){for(var f=!0,h=0;hi&&(r=i)):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s239?4:o>223?3:o>191?2:1,u,l,c,f;if(i+a<=n)switch(a){case 1:o<128&&(s=o);break;case 2:u=e[i+1],128==(192&u)&&(f=(31&o)<<6|63&u,f>127&&(s=f));break;case 3:u=e[i+1],l=e[i+2],128==(192&u)&&128==(192&l)&&(f=(15&o)<<12|(63&u)<<6|63&l,f>2047&&(f<55296||f>57343)&&(s=f));break;case 4:u=e[i+1],l=e[i+2],c=e[i+3],128==(192&u)&&128==(192&l)&&128==(192&c)&&(f=(15&o)<<18|(63&u)<<12|(63&l)<<6|63&c,f>65535&&f<1114112&&(s=f))}null===s?(s=65533,a=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),i+=a}return R(r)}t.Buffer=l,t.SlowBuffer=v,t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:s(),t.kMaxLength=a(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,n){return c(null,e,t,n)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,n){return h(null,e,t,n)},l.allocUnsafe=function(e){return p(null,e)},l.allocUnsafeSlow=function(e){return p(null,e)},l.isBuffer=function e(t){return!(null==t||!t._isBuffer)},l.compare=function e(t,n){if(!l.isBuffer(t)||!l.isBuffer(n))throw new TypeError("Arguments must be Buffers");if(t===n)return 0;for(var r=t.length,i=n.length,o=0,s=Math.min(r,i);o0&&(n=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(n+=" ... ")),""},l.prototype.compare=function e(t,n,r,i,o){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===n&&(n=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),n<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&n>=r)return 0;if(i>=o)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var s=o-i,a=r-n,u=Math.min(s,a),c=this.slice(i,o),f=t.slice(n,r),h=0;ho)&&(r=o),t.length>0&&(r<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return x(this,t,n,r);case"utf8":case"utf-8":return C(this,t,n,r);case"ascii":return A(this,t,n,r);case"latin1":case"binary":return I(this,t,n,r);case"base64":return T(this,t,n,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,t,n,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},l.prototype.toJSON=function e(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var B=4096;function R(e){var t=e.length;if(t<=B)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,n,r,i,o){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function z(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function q(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function K(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function H(e,t,n,r,o){return o||K(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),i.write(e,t,n,r,23,4),n+4}function V(e,t,n,r,o){return o||K(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),i.write(e,t,n,r,52,8),n+8}l.prototype.slice=function e(t,n){var r=this.length,i;if(t=~~t,n=void 0===n?r:~~n,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),n<0?(n+=r,n<0&&(n=0)):n>r&&(n=r),n0&&(o*=256);)i+=this[t+--n]*o;return i},l.prototype.readUInt8=function e(t,n){return n||D(t,1,this.length),this[t]},l.prototype.readUInt16LE=function e(t,n){return n||D(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUInt16BE=function e(t,n){return n||D(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUInt32LE=function e(t,n){return n||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUInt32BE=function e(t,n){return n||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function e(t,n,r){t|=0,n|=0,r||D(t,n,this.length);for(var i=this[t],o=1,s=0;++s=o&&(i-=Math.pow(2,8*n)),i},l.prototype.readIntBE=function e(t,n,r){t|=0,n|=0,r||D(t,n,this.length);for(var i=n,o=1,s=this[t+--i];i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*n)),s},l.prototype.readInt8=function e(t,n){return n||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function e(t,n){n||D(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function e(t,n){n||D(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function e(t,n){return n||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function e(t,n){return n||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function e(t,n){return n||D(t,4,this.length),i.read(this,t,!0,23,4)},l.prototype.readFloatBE=function e(t,n){return n||D(t,4,this.length),i.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function e(t,n){return n||D(t,8,this.length),i.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function e(t,n){return n||D(t,8,this.length),i.read(this,t,!1,52,8)},l.prototype.writeUIntLE=function e(t,n,r,i){if(t=+t,n|=0,r|=0,!i){var o=Math.pow(2,8*r)-1;U(this,t,n,r,o,0)}var s=1,a=0;for(this[n]=255&t;++a=0&&(a*=256);)this[n+s]=t/a&255;return n+r},l.prototype.writeUInt8=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,1,255,0),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[n]=255&t,n+1},l.prototype.writeUInt16LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[n]=255&t,this[n+1]=t>>>8):z(this,t,n,!0),n+2},l.prototype.writeUInt16BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=255&t):z(this,t,n,!1),n+2},l.prototype.writeUInt32LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[n+3]=t>>>24,this[n+2]=t>>>16,this[n+1]=t>>>8,this[n]=255&t):q(this,t,n,!0),n+4},l.prototype.writeUInt32BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=255&t):q(this,t,n,!1),n+4},l.prototype.writeIntLE=function e(t,n,r,i){if(t=+t,n|=0,!i){var o=Math.pow(2,8*r-1);U(this,t,n,r,o-1,-o)}var s=0,a=1,u=0;for(this[n]=255&t;++s>0)-u&255;return n+r},l.prototype.writeIntBE=function e(t,n,r,i){if(t=+t,n|=0,!i){var o=Math.pow(2,8*r-1);U(this,t,n,r,o-1,-o)}var s=r-1,a=1,u=0;for(this[n+s]=255&t;--s>=0&&(a*=256);)t<0&&0===u&&0!==this[n+s+1]&&(u=1),this[n+s]=(t/a>>0)-u&255;return n+r},l.prototype.writeInt8=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,1,127,-128),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[n]=255&t,n+1},l.prototype.writeInt16LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[n]=255&t,this[n+1]=t>>>8):z(this,t,n,!0),n+2},l.prototype.writeInt16BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=255&t):z(this,t,n,!1),n+2},l.prototype.writeInt32LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[n]=255&t,this[n+1]=t>>>8,this[n+2]=t>>>16,this[n+3]=t>>>24):q(this,t,n,!0),n+4},l.prototype.writeInt32BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),l.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=255&t):q(this,t,n,!1),n+4},l.prototype.writeFloatLE=function e(t,n,r){return H(this,t,n,!0,r)},l.prototype.writeFloatBE=function e(t,n,r){return H(this,t,n,!1,r)},l.prototype.writeDoubleLE=function e(t,n,r){return V(this,t,n,!0,r)},l.prototype.writeDoubleBE=function e(t,n,r){return V(this,t,n,!1,r)},l.prototype.copy=function e(t,n,r,i){if(r||(r=0),i||0===i||(i=this.length),n>=t.length&&(n=t.length),n||(n=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-n=0;--s)t[s+n]=this[s+r];else if(o<1e3||!l.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=n;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Z(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function X(e){return r.toByteArray($(e))}function ee(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function te(e){return e!=e}}).call(this,n(8))},function(e,t){"function"==typeof Object.create?e.exports=function e(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function e(t,n){if(n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}}},function(e,t){var n=e.exports={},r,i;function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}function u(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(e){i=s}}();var l=[],c=!1,f,h=-1;function p(){c&&f&&(c=!1,f.length?l=f.concat(l):h=-1,l.length&&d())}function d(){if(!c){var e=a(p);c=!0;for(var t=l.length;t;){for(f=l,l=[];++h1)for(var n=1;n=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function b(e){return+e!=e&&(e=0),u.alloc(+e)}function _(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return X(e).length;default:if(r)return Z(e).length;t=(""+t).toLowerCase(),r=!0}}function w(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return B(this,t,n);case"ascii":return N(this,t,n);case"latin1":case"binary":return D(this,t,n);case"base64":return R(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function k(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function E(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:S(e,t,n,r,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):S(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function S(e,t,n,r,i){var o=1,s=e.length,a=t.length,l;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,a/=2,n/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(l=n;ls&&(n=s-a),l=n;l>=0;l--){for(var h=!0,f=0;fi&&(r=i)):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s239?4:o>223?3:o>191?2:1,l,u,c,h;if(i+a<=n)switch(a){case 1:o<128&&(s=o);break;case 2:l=e[i+1],128==(192&l)&&(h=(31&o)<<6|63&l,h>127&&(s=h));break;case 3:l=e[i+1],u=e[i+2],128==(192&l)&&128==(192&u)&&(h=(15&o)<<12|(63&l)<<6|63&u,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:l=e[i+1],u=e[i+2],c=e[i+3],128==(192&l)&&128==(192&u)&&128==(192&c)&&(h=(15&o)<<18|(63&l)<<12|(63&u)<<6|63&c,h>65535&&h<1114112&&(s=h))}null===s?(s=65533,a=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),i+=a}return P(r)}t.Buffer=u,t.SlowBuffer=b,t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:s(),t.kMaxLength=a(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,n){return c(null,e,t,n)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,n){return f(null,e,t,n)},u.allocUnsafe=function(e){return p(null,e)},u.allocUnsafeSlow=function(e){return p(null,e)},u.isBuffer=function e(t){return!(null==t||!t._isBuffer)},u.compare=function e(t,n){if(!u.isBuffer(t)||!u.isBuffer(n))throw new TypeError("Arguments must be Buffers");if(t===n)return 0;for(var r=t.length,i=n.length,o=0,s=Math.min(r,i);o0&&(n=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(n+=" ... ")),""},u.prototype.compare=function e(t,n,r,i,o){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===n&&(n=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),n<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&n>=r)return 0;if(i>=o)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var s=o-i,a=r-n,l=Math.min(s,a),c=this.slice(i,o),h=t.slice(n,r),f=0;fo)&&(r=o),t.length>0&&(r<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return x(this,t,n,r);case"utf8":case"utf-8":return C(this,t,n,r);case"ascii":return A(this,t,n,r);case"latin1":case"binary":return T(this,t,n,r);case"base64":return I(this,t,n,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,t,n,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},u.prototype.toJSON=function e(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var O=4096;function P(e){var t=e.length;if(t<=O)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,n,r,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function q(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function z(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function K(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function H(e,t,n,r,o){return o||K(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),i.write(e,t,n,r,23,4),n+4}function V(e,t,n,r,o){return o||K(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),i.write(e,t,n,r,52,8),n+8}u.prototype.slice=function e(t,n){var r=this.length,i;if(t=~~t,n=void 0===n?r:~~n,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),n<0?(n+=r,n<0&&(n=0)):n>r&&(n=r),n0&&(o*=256);)i+=this[t+--n]*o;return i},u.prototype.readUInt8=function e(t,n){return n||L(t,1,this.length),this[t]},u.prototype.readUInt16LE=function e(t,n){return n||L(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function e(t,n){return n||L(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function e(t,n){return n||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function e(t,n){return n||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function e(t,n,r){t|=0,n|=0,r||L(t,n,this.length);for(var i=this[t],o=1,s=0;++s=o&&(i-=Math.pow(2,8*n)),i},u.prototype.readIntBE=function e(t,n,r){t|=0,n|=0,r||L(t,n,this.length);for(var i=n,o=1,s=this[t+--i];i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*n)),s},u.prototype.readInt8=function e(t,n){return n||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function e(t,n){n||L(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function e(t,n){n||L(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function e(t,n){return n||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function e(t,n){return n||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function e(t,n){return n||L(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function e(t,n){return n||L(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function e(t,n){return n||L(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function e(t,n){return n||L(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function e(t,n,r,i){if(t=+t,n|=0,r|=0,!i){var o=Math.pow(2,8*r)-1;U(this,t,n,r,o,0)}var s=1,a=0;for(this[n]=255&t;++a=0&&(a*=256);)this[n+s]=t/a&255;return n+r},u.prototype.writeUInt8=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[n]=255&t,n+1},u.prototype.writeUInt16LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[n]=255&t,this[n+1]=t>>>8):q(this,t,n,!0),n+2},u.prototype.writeUInt16BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=255&t):q(this,t,n,!1),n+2},u.prototype.writeUInt32LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[n+3]=t>>>24,this[n+2]=t>>>16,this[n+1]=t>>>8,this[n]=255&t):z(this,t,n,!0),n+4},u.prototype.writeUInt32BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=255&t):z(this,t,n,!1),n+4},u.prototype.writeIntLE=function e(t,n,r,i){if(t=+t,n|=0,!i){var o=Math.pow(2,8*r-1);U(this,t,n,r,o-1,-o)}var s=0,a=1,l=0;for(this[n]=255&t;++s>0)-l&255;return n+r},u.prototype.writeIntBE=function e(t,n,r,i){if(t=+t,n|=0,!i){var o=Math.pow(2,8*r-1);U(this,t,n,r,o-1,-o)}var s=r-1,a=1,l=0;for(this[n+s]=255&t;--s>=0&&(a*=256);)t<0&&0===l&&0!==this[n+s+1]&&(l=1),this[n+s]=(t/a>>0)-l&255;return n+r},u.prototype.writeInt8=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[n]=255&t,n+1},u.prototype.writeInt16LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[n]=255&t,this[n+1]=t>>>8):q(this,t,n,!0),n+2},u.prototype.writeInt16BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=255&t):q(this,t,n,!1),n+2},u.prototype.writeInt32LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[n]=255&t,this[n+1]=t>>>8,this[n+2]=t>>>16,this[n+3]=t>>>24):z(this,t,n,!0),n+4},u.prototype.writeInt32BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=255&t):z(this,t,n,!1),n+4},u.prototype.writeFloatLE=function e(t,n,r){return H(this,t,n,!0,r)},u.prototype.writeFloatBE=function e(t,n,r){return H(this,t,n,!1,r)},u.prototype.writeDoubleLE=function e(t,n,r){return V(this,t,n,!0,r)},u.prototype.writeDoubleBE=function e(t,n,r){return V(this,t,n,!1,r)},u.prototype.copy=function e(t,n,r,i){if(r||(r=0),i||0===i||(i=this.length),n>=t.length&&(n=t.length),n||(n=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-n=0;--s)t[s+n]=this[s+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=n;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function J(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function X(e){return r.toByteArray(W(e))}function ee(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function te(e){return e!=e}}).call(this,n(8))},function(e,t){"function"==typeof Object.create?e.exports=function e(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function e(t,n){if(n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}}},function(e,t,n){ /** PROMISIFY CALLBACK-STYLE FUNCTIONS TO ES6 PROMISES * * EXAMPLE: @@ -28,22 +28,13 @@ var r=n(742),i=n(387),o=n(51);function s(){try{var e=new Uint8Array(1);return e. * @version: 1.0.3 * @author: Manuel Di Iorio **/ -var r=function(e,t){return function(){var n=Array.prototype.slice.call(arguments),r=n.length-1,i=n&&n.length>0?n[r]:null,o="function"==typeof i?i:null;return o?e.apply(t,n):new Promise(function(r,i){n.push(function(e,t){if(e)return i(e);r(t)}),e.apply(t,n)})}};e.exports=function(e,t){t=t||{};var n=Object.prototype.toString.call(e);if("[object Object]"===n||"[object Array]"===n){var i=t.replace?e:{};for(var o in e)e.hasOwnProperty(o)&&(i[o]=r(e[o]));return i}return r(e,t.context||e)}},function(e,t,n){var r=n(0),i=r.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=s),o(i,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){(function(r){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))}),t.splice(i,0,n)}function s(...e){return"object"==typeof console&&console.log&&console.log(...e)}function a(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}}function u(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function l(){try{return localStorage}catch(e){}}t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage=l(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=n(741)(t);const{formatters:c}=e.exports;c.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,n(2))},function(e,t,n){"use strict";var r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function e(t,n,r){return Function.prototype.apply.call(t,n,r)},o;function s(e){console&&console.warn&&console.warn(e)}o=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function e(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function e(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function e(t){return t!=t};function u(){u.init.call(this)}e.exports=u,u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var l=10;function c(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function f(e,t,n,r){var i,o,a;if("function"!=typeof n)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n);if(o=e._events,void 0===o?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]),void 0===a)a=o[t]=n,++e._eventsCount;else if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),i=c(e),i>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s(u)}return e}function h(){for(var e=[],t=0;t0&&(a=n[0]),a instanceof Error)throw a;var u=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw u.context=a,u}var l=s[t];if(void 0===l)return!1;if("function"==typeof l)i(l,this,n);else for(var c=l.length,f=g(l,c),r=0;r=0;s--)if(r[s]===n||r[s].listener===n){a=r[s].listener,o=s;break}if(o<0)return this;0===o?r.shift():y(r,o),1===r.length&&(i[t]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",t,a||n)}return this},u.prototype.off=u.prototype.removeListener,u.prototype.removeAllListeners=function e(t){var n,r,i;if(r=this._events,void 0===r)return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o=Object.keys(r),s;for(i=0;i=0;i--)this.removeListener(t,n[i]);return this},u.prototype.listeners=function e(t){return d(this,t,!0)},u.prototype.rawListeners=function e(t){return d(this,t,!1)},u.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},u.prototype.listenerCount=m,u.prototype.eventNames=function e(){return this._eventsCount>0?o(this._events):[]}},function(e,t,n){(function(e){function n(e){return Array.isArray?Array.isArray(e):"[object Array]"===g(e)}function r(e){return"boolean"==typeof e}function i(e){return null===e}function o(e){return null==e}function s(e){return"number"==typeof e}function a(e){return"string"==typeof e}function u(e){return"symbol"==typeof e}function l(e){return void 0===e}function c(e){return"[object RegExp]"===g(e)}function f(e){return"object"==typeof e&&null!==e}function h(e){return"[object Date]"===g(e)}function p(e){return"[object Error]"===g(e)||e instanceof Error}function d(e){return"function"==typeof e}function m(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function g(e){return Object.prototype.toString.call(e)}t.isArray=n,t.isBoolean=r,t.isNull=i,t.isNullOrUndefined=o,t.isNumber=s,t.isString=a,t.isSymbol=u,t.isUndefined=l,t.isRegExp=c,t.isObject=f,t.isDate=h,t.isError=p,t.isFunction=d,t.isPrimitive=m,t.isBuffer=e.isBuffer}).call(this,n(0).Buffer)},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";(function(t){const r=n(35),i=n(89),o=n(295),s=n(176),a=n(803),u=n(53);class l{constructor(n,s,a){if(e.exports.isCID(n)){let e=n;return this.version=e.version,this.codec=e.codec,void(this.multihash=t.from(e.multihash))}if("string"==typeof n)if(i.isEncoded(n)){const e=i.decode(n);n=parseInt(e.slice(0,1).toString("hex"),16),s=o.getCodec(e.slice(1)),a=o.rmPrefix(e.slice(1))}else s="dag-pb",a=r.fromB58String(n),n=0;else if(t.isBuffer(n)){const e=n.slice(0,1),t=parseInt(e.toString("hex"),16);if(0===t||1===t){const e=n;n=t,s=o.getCodec(e.slice(1)),a=o.rmPrefix(e.slice(1))}else s="dag-pb",a=n,n=0}this.codec=s,this.version=n,this.multihash=a,l.validateCID(this)}get buffer(){let e=this._buffer;if(!e){if(0===this.version)e=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");e=t.concat([t.from("01","hex"),o.getCodeVarint(this.codec),this.multihash])}Object.defineProperty(this,"_buffer",{value:e})}return e}get prefix(){return t.concat([t.from(`0${this.version}`,"hex"),o.getCodeVarint(this.codec),r.prefix(this.multihash)])}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:t}=r.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==t)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new c(0,this.codec,this.multihash)}toV1(){return new c(1,this.codec,this.multihash)}toBaseEncodedString(e){switch(e=e||"base58btc",this.version){case 0:if("base58btc"!==e)throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");return r.toB58String(this.multihash);case 1:return i.encode(e,this.buffer).toString();default:throw new Error("Unsupported version")}}toString(e){return this.toBaseEncodedString(e)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(e){return this.codec===e.codec&&this.version===e.version&&this.multihash.equals(e.multihash)}static validateCID(e){let t=a.checkCIDComponents(e);if(t)throw new Error(t)}}const c=u(l,{className:"CID",symbolName:"@ipld/js-cid/CID"});c.codecs=s,e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){function n(e,n,r,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o=arguments.length,s,a;switch(o){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function t(){e.call(null,n)});case 3:return t.nextTick(function t(){e.call(null,n,r)});case 4:return t.nextTick(function t(){e.call(null,n,r,i)});default:for(s=new Array(o-1),a=0;a=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),u=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),b(n)?r.showHidden=n:n&&t._extend(r,n),E(r.showHidden)&&(r.showHidden=!1),E(r.depth)&&(r.depth=2),E(r.colors)&&(r.colors=!1),E(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),f(r,e,r.depth)}function u(e,t){var n=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.colors[n][1]+"m":e}function l(e,t){return e}function c(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function f(e,n,r){if(e.customInspect&&n&&T(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return k(i)||(i=f(e,i,r)),i}var o=h(e,n);if(o)return o;var s=Object.keys(n),a=c(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(n)),I(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return p(n);if(0===s.length){if(T(n)){var u=n.name?": "+n.name:"";return e.stylize("[Function"+u+"]","special")}if(x(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(A(n))return e.stylize(Date.prototype.toString.call(n),"date");if(I(n))return p(n)}var l="",b=!1,v=["{","}"],w;if(y(n)&&(b=!0,v=["[","]"]),T(n)){var _=n.name?": "+n.name:"";l=" [Function"+_+"]"}return x(n)&&(l=" "+RegExp.prototype.toString.call(n)),A(n)&&(l=" "+Date.prototype.toUTCString.call(n)),I(n)&&(l=" "+p(n)),0!==s.length||b&&0!=n.length?r<0?x(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),w=b?d(e,n,r,a,s):s.map(function(t){return m(e,n,r,a,t,b)}),e.seen.pop(),g(w,l,v)):v[0]+l+v[1]}function h(e,t){if(E(t))return e.stylize("undefined","undefined");if(k(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return _(t)?e.stylize(""+t,"number"):b(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,n,r,i){for(var o=[],s=0,a=t.length;s-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n"))):a=e.stylize("[Circular]","special")),E(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function g(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function y(e){return Array.isArray(e)}function b(e){return"boolean"==typeof e}function v(e){return null===e}function w(e){return null==e}function _(e){return"number"==typeof e}function k(e){return"string"==typeof e}function S(e){return"symbol"==typeof e}function E(e){return void 0===e}function x(e){return C(e)&&"[object RegExp]"===O(e)}function C(e){return"object"==typeof e&&null!==e}function A(e){return C(e)&&"[object Date]"===O(e)}function I(e){return C(e)&&("[object Error]"===O(e)||e instanceof Error)}function T(e){return"function"==typeof e}function j(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function O(e){return Object.prototype.toString.call(e)}function P(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(E(s)&&(s=e.env.NODE_DEBUG||""),n=n.toUpperCase(),!o[n])if(new RegExp("\\b"+n+"\\b","i").test(s)){var r=e.pid;o[n]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",n,r,e)}}else o[n]=function(){};return o[n]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=y,t.isBoolean=b,t.isNull=v,t.isNullOrUndefined=w,t.isNumber=_,t.isString=k,t.isSymbol=S,t.isUndefined=E,t.isRegExp=x,t.isObject=C,t.isDate=A,t.isError=I,t.isFunction=T,t.isPrimitive=j,t.isBuffer=n(806);var B=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function R(){var e=new Date,t=[P(e.getHours()),P(e.getMinutes()),P(e.getSeconds())].join(":");return[e.getDate(),B[e.getMonth()],t].join(" ")}function N(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",R(),t.format.apply(t,arguments))},t.inherits=n(807),t._extend=function(e,t){if(!t||!C(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var M="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function L(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}function F(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');function n(){for(var n=[],r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e,t,n){var r=t.length-1;if(r=0?(i>0&&(e.lastNeed=i-1),i):--r=0?(i>0&&(e.lastNeed=i-2),i):--r=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0))}function c(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}function f(e){var t=this.lastTotal-this.lastNeed,n=c(this,e,t);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function h(e,t){var n=l(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)}function p(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function d(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function m(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function g(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function y(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function b(e){return e.toString(this.encoding)}function v(e){return e&&e.length?this.write(e):""}t.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n - * Build: `lodash modern -d -o ./index.js` - * Copyright 2012-2015 The Dojo Foundation - * 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,l=4,c=8,f=16,h=32,p=64,d=128,m=256,g=30,y="...",b=150,v=16,w=200,_=1,k=2,S="Expected a function",E="__lodash_placeholder__",x="[object Arguments]",C="[object Array]",A="[object Boolean]",I="[object Date]",T="[object Error]",j="[object Function]",O="[object Map]",P="[object Number]",B="[object Object]",R="[object RegExp]",N="[object Set]",M="[object String]",L="[object WeakMap]",F="[object ArrayBuffer]",D="[object Float32Array]",U="[object Float64Array]",z="[object Int8Array]",q="[object Int16Array]",K="[object Int32Array]",H="[object Uint8Array]",V="[object Uint8ClampedArray]",W="[object Uint16Array]",$="[object Uint32Array]",G=/\b__p \+= '';/g,Y=/\b(__p \+=) '' \+/g,J=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Z=/&(?:amp|lt|gt|quot|#39|#96);/g,Q=/[&<>"'`]/g,X=RegExp(Z.source),ee=RegExp(Q.source),te=/<%-([\s\S]+?)%>/g,ne=/<%([\s\S]+?)%>/g,re=/<%=([\s\S]+?)%>/g,ie=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,oe=/^\w*$/,se=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,ae=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,ue=RegExp(ae.source),le=/[\u0300-\u036f\ufe20-\ufe23]/g,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,he=/\w*$/,pe=/^0[xX]/,de=/^\[object .+?Constructor\]$/,me=/^\d+$/,ge=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,ye=/($^)/,be=/['\n\r\u2028\u2029\\]/g,ve=(we="[A-Z\\xc0-\\xd6\\xd8-\\xde]",_e="[a-z\\xdf-\\xf6\\xf8-\\xff]+",RegExp(we+"+(?="+we+_e+")|"+we+"?"+_e+"|"+we+"+|[0-9]+","g")),we,_e,ke=["Array","ArrayBuffer","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Math","Number","Object","RegExp","Set","String","_","clearTimeout","isFinite","parseFloat","parseInt","setTimeout","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap"],Se=-1,Ee={};Ee[D]=Ee[U]=Ee[z]=Ee[q]=Ee[K]=Ee[H]=Ee[V]=Ee[W]=Ee[$]=!0,Ee[x]=Ee[C]=Ee[F]=Ee[A]=Ee[I]=Ee[T]=Ee[j]=Ee[O]=Ee[P]=Ee[B]=Ee[R]=Ee[N]=Ee[M]=Ee[L]=!1;var xe={};xe[x]=xe[C]=xe[F]=xe[A]=xe[I]=xe[D]=xe[U]=xe[z]=xe[q]=xe[K]=xe[P]=xe[B]=xe[R]=xe[M]=xe[H]=xe[V]=xe[W]=xe[$]=!0,xe[T]=xe[j]=xe[O]=xe[N]=xe[L]=!1;var Ce={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},Ae={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Ie={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Te={function:!0,object:!0},je={0:"x30",1:"x31",2:"x32",3:"x33",4:"x34",5:"x35",6:"x36",7:"x37",8:"x38",9:"x39",A:"x41",B:"x42",C:"x43",D:"x44",E:"x45",F:"x46",a:"x61",b:"x62",c:"x63",d:"x64",e:"x65",f:"x66",n:"x6e",r:"x72",t:"x74",u:"x75",v:"x76",x:"x78"},Oe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Pe=Te[typeof t]&&t&&!t.nodeType&&t,Be=Te[typeof e]&&e&&!e.nodeType&&e,Re=Pe&&Be&&"object"==typeof r&&r&&r.Object&&r,Ne=Te[typeof self]&&self&&self.Object&&self,Me=Te[typeof window]&&window&&window.Object&&window,Le=Be&&Be.exports===Pe&&Pe,Fe=Re||Me!==(this&&this.window)&&Me||Ne||this;function De(e,t){if(e!==t){var n=null===e,r=e===o,i=e==e,s=null===t,a=t===o,u=t==t;if(e>t&&!s||!i||n&&!a&&u||r&&u)return 1;if(e-1;);return n}function Ve(e,t){for(var n=e.length;n--&&t.indexOf(e.charAt(n))>-1;);return n}function We(e,t){return De(e.criteria,t.criteria)||e.index-t.index}function $e(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,s=i.length,a=n.length;++r=a)return u;var l=n[r];return u*("asc"===l||!0===l?1:-1)}}return e.index-t.index}function Ge(e){return Ce[e]}function Ye(e){return Ae[e]}function Je(e,t,n){return t?e=je[e]:n&&(e=Oe[e]),"\\"+e}function Ze(e){return"\\"+Oe[e]}function Qe(e,t,n){for(var r=e.length,i=t+(n?0:-1);n?i--:++i=9&&e<=13||32==e||160==e||5760==e||6158==e||e>=8192&&(e<=8202||8232==e||8233==e||8239==e||8287==e||12288==e||65279==e)}function tt(e,t){for(var n=-1,r=e.length,i=-1,o=[];++n>>1,Ot=9007199254740991,Pt=dt&&new dt,Bt={};function Rt(e){if(Xe(e)&&!bs(e)&&!(e instanceof Ft)){if(e instanceof Mt)return e;if(Oe.call(e,"__chain__")&&Oe.call(e,"__wrapped__"))return vi(e)}return new Mt(e)}function Nt(){}function Mt(e,t,n){this.__wrapped__=e,this.__actions__=n||[],this.__chain__=!!t}var Lt=Rt.support={};function Ft(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=At,this.__views__=[]}function Dt(){var e=new Ft(this.__wrapped__);return e.__actions__=Zt(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Zt(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Zt(this.__views__),e}function Ut(){if(this.__filtered__){var e=new Ft(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function zt(){var e=this.__wrapped__.value(),t=this.__dir__,n=bs(e),r=t<0,i=n?e.length:0,o=Yr(0,i,this.__views__),s=o.start,a=o.end,u=a-s,l=r?a:s-1,c=this.__iteratees__,f=c.length,h=0,p=kt(u,this.__takeCount__);if(!n||i=w?gr(t):null,u=t.length;a&&(o=Gt,s=!1,t=a);e:for(;++ii?0:i+n),r=r===o||r>i?i:+r||0,r<0&&(r+=i),i=n>r?0:r>>>0,n>>>=0;ns?0:s+n),r=r===o||r>s?s:+r||0,r<0&&(r+=s),s=n>r?0:r-n>>>0,n>>>=0;for(var a=t(s);++i=w,a=s?gr():null,u=[];a?(r=Gt,o=!1):(s=!1,a=t?[]:u);e:for(;++n>>1,s=e[o];(n?s<=t:s2?n[i-2]:o,a=i>2?n[2]:o,u=i>1?n[i-1]:o;for("function"==typeof s?(s=ar(s,u,5),i-=2):(s="function"==typeof u?u:o,i-=s?1:0),a&&ni(n[0],n[1],a)&&(s=i<3?o:s,i=1);++r-1?n[s]:o}return An(n,r,e)}}function Sr(e){return function(t,n,r){return t&&t.length?(n=qr(n,r,3),Ue(t,n,e)):-1}}function Er(e){return function(t,n,r){return n=qr(n,r,3),An(t,n,e,!0)}}function xr(e){return function(){for(var n,r=arguments.length,i=e?r:-1,s=0,a=t(r);e?i--:++i=w)return n.plant(t).value();for(var i=0,o=r?a[i].apply(this,e):t;++i=t||!vt(t))return"";var i=t-r;return n=null==n?" ":n+"",Ia(n,mt(i/n.length)).slice(0,i)}function Nr(e,n,r,i){var o=n&a,s=br(e);function u(){for(var n=-1,a=arguments.length,l=-1,c=i.length,f=t(c+a);++ll))return!1;for(;++u-1&&e%1==0&&e-1&&e%1==0&&e<=Ot}function si(e){return e==e&&!As(e)}function ai(e,t){var n=e[1],r=t[1],i=n|r,o=i0){if(++pi>=b)return e}else pi=0;return Yn(e,t)}),pi,di;function mi(e){for(var t=ia(e),n=t.length,r=n&&e.length,i=!!r&&oi(r)&&(bs(e)||ys(e)),o=-1,s=[];++o=120?gr(r&&u):null}var l=e[0],c=-1,f=l?l.length:0,h=i[0];e:for(;++c-1;)ht.call(t,o,1);return t}var Di=ls(function(e,t){t=In(t);var n=dn(e,t);return Wn(e,t.sort(De)),n});function Ui(e,t,n){var r=[];if(!e||!e.length)return r;var i=-1,o=[],s=e.length;for(t=qr(t,n,3);++i2?e[t-2]:o,r=t>1?e[t-1]:o;return t>2&&"function"==typeof n?t-=2:(n=t>1&&"function"==typeof r?(--t,r):o,r=o),e.length=t,Qi(e,n,r)});function io(e){var t=Rt(e);return t.__chain__=!0,t}function oo(e,t,n){return t.call(n,e),e}function so(e,t,n){return t.call(n,e)}function ao(){return io(this)}function uo(){return new Mt(this.value(),this.__chain__)}var lo=ls(function(e){return e=In(e),this.thru(function(t){return Jt(bs(t)?t:[yi(t)],e)})});function co(e){for(var t,n=this;n instanceof Nt;){var r=vi(n);t?i.__wrapped__=r:t=r;var i=r;n=n.__wrapped__}return i.__wrapped__=e,t}function fo(){var e=this.__wrapped__,t=function(e){return n&&n.__dir__<0?e:e.reverse()};if(e instanceof Ft){var n=e;return this.__actions__.length&&(n=new Ft(this)),n=n.reverse(),n.__actions__.push({func:so,args:[t],thisArg:o}),new Mt(n,this.__chain__)}return this.thru(t)}function ho(){return this.value()+""}function po(){return ir(this.__wrapped__,this.__actions__)}var mo=ls(function(e,t){return dn(e,In(t))}),go=fr(function(e,t,n){Oe.call(e,n)?++e[n]:e[n]=1});function yo(e,t,n){var r=bs(e)?en:Sn;return n&&ni(e,t,n)&&(t=o),"function"==typeof t&&n===o||(t=qr(t,n,3)),r(e,t)}function bo(e,t,n){var r=bs(e)?nn:Cn;return t=qr(t,n,3),r(e,t)}var vo=kr(_n),wo=kr(kn,!0);function _o(e,t){return vo(e,Un(t))}var ko=Cr(Qt,_n),So=Cr(Xt,kn),Eo=fr(function(e,t,n){Oe.call(e,n)?e[n].push(t):e[n]=[t]});function xo(e,t,n,r){var i=e?Wr(e):0;return oi(i)||(e=pa(e),i=e.length),n="number"!=typeof n||r&&ni(t,n,r)?0:n<0?_t(i+n,0):n||0,"string"==typeof e||!bs(e)&&Ns(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Vr(e,t,n)>-1}var Co=fr(function(e,t,n){e[n]=t}),Ao=ls(function(e,n,r){var i=-1,s="function"==typeof n,a=ri(n),u=ei(e)?t(e.length):[];return _n(e,function(e){var t=s?n:a&&null!=e?e[n]:o;u[++i]=t?t.apply(e,r):Xr(e,n,r)}),u});function Io(e,t,n){var r=bs(e)?rn:Dn;return t=qr(t,n,3),r(e,t)}var To=fr(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function jo(e,t){return Io(e,Ja(t))}var Oo=Pr(sn,_n),Po=Pr(an,kn);function Bo(e,t,n){var r=bs(e)?nn:Cn;return t=qr(t,n,3),r(e,function(e,n,r){return!t(e,n,r)})}function Ro(e,t,n){if(n?ni(e,t,n):null==t){e=gi(e);var r=e.length;return r>0?e[$n(0,r-1)]:o}var i=-1,s=Us(e),r=s.length,a=r-1;for(t=kt(t<0?0:+t||0,r);++i0&&(n=t.apply(this,arguments)),e<=1&&(t=o),n}}var Wo=ls(function(e,t,n){var r=a;if(n.length){var i=tt(n,Wo.placeholder);r|=h}return Fr(e,r,t,n,i)}),$o=ls(function(e,t){t=t.length?In(t):Xs(e);for(var n=-1,r=t.length;++nt?g(c,i):l=ft(y,e)}function b(){g(p,l)}function v(){if(r=arguments,a=qo(),u=this,c=p&&(l||!d),!1===h)var n=d&&!l;else{i||d||(f=a);var m=h-(a-f),g=m<=0||m>h;g?(i&&(i=Le(i)),f=a,s=e.apply(u,r)):i||(i=ft(b,m))}return g&&l?l=Le(l):l||t===h||(l=ft(y,t)),n&&(g=!0,s=e.apply(u,r)),!g||l||i||(r=u=o),s}return v.cancel=m,v}var Qo=ls(function(e,t){return vn(e,1,t)}),Xo=ls(function(e,t,n){return vn(e,t,n)}),es=xr(),ts=xr(!0);function ns(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new Ce(S);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s),s};return n.cache=new ns.Cache,n}var rs=ls(function(e,t){if(t=In(t),"function"!=typeof e||!en(t,qe))throw new Ce(S);var n=t.length;return ls(function(r){for(var i=kt(r.length,n);i--;)r[i]=t[i](r[i]);return e.apply(this,r)})});function is(e){if("function"!=typeof e)throw new Ce(S);return function(){return!e.apply(this,arguments)}}function os(e){return Vo(2,e)}var ss=Or(h),as=Or(p),us=ls(function(e,t){return Fr(e,m,o,o,o,In(t))});function ls(e,n){if("function"!=typeof e)throw new Ce(S);return n=_t(n===o?e.length-1:+n||0,0),function(){for(var r=arguments,i=-1,o=_t(r.length-n,0),s=t(o);++it}function gs(e,t){return e>=t}function ys(e){return Xe(e)&&ei(e)&&Oe.call(e,"callee")&&!lt.call(e,"callee")}var bs=bt||function(e){return Xe(e)&&oi(e.length)&&Be.call(e)==C};function vs(e){return!0===e||!1===e||Xe(e)&&Be.call(e)==A}function ws(e){return Xe(e)&&Be.call(e)==I}function _s(e){return!!e&&1===e.nodeType&&Xe(e)&&!Bs(e)}function ks(e){return null==e||(ei(e)&&(bs(e)||Ns(e)||ys(e)||Xe(e)&&Cs(e.splice))?!e.length:!ra(e).length)}function Ss(e,t,n,r){n="function"==typeof n?ar(n,r,3):o;var i=n?n(e,t):o;return i===o?Mn(e,t,n):!!i}function Es(e){return Xe(e)&&"string"==typeof e.message&&Be.call(e)==T}function xs(e){return"number"==typeof e&&vt(e)}function Cs(e){return As(e)&&Be.call(e)==j}function As(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Is(e,t,n,r){return n="function"==typeof n?ar(n,r,3):o,Fn(e,$r(t),n)}function Ts(e){return Ps(e)&&e!=+e}function js(e){return null!=e&&(Cs(e)?Ne.test(je.call(e)):Xe(e)&&de.test(e))}function Os(e){return null===e}function Ps(e){return"number"==typeof e||Xe(e)&&Be.call(e)==P}function Bs(e){var t,n;return!(!Xe(e)||Be.call(e)!=B||ys(e)||!(Oe.call(e,"constructor")||(t=e.constructor,"function"!=typeof t||t instanceof t)))&&(On(e,function(e,t){n=t}),n===o||Oe.call(e,n))}function Rs(e){return As(e)&&Be.call(e)==R}function Ns(e){return"string"==typeof e||Xe(e)&&Be.call(e)==M}function Ms(e){return Xe(e)&&oi(e.length)&&!!Ee[Be.call(e)]}function Ls(e){return e===o}function Fs(e,t){return e0;++i=kt(t,n)&&e<_t(t,n)}function ga(e,t,n){n&&ni(e,t,n)&&(t=n=o);var r=null==e,i=null==t;if(null==n&&(i&&"boolean"==typeof e?(n=e,e=1):"boolean"==typeof t&&(n=t,i=!0)),r&&i&&(t=1,i=!1),e=+e||0,i?(t=e,e=0):t=+t||0,n||e%1||t%1){var s=xt();return kt(e+s*(t-e+et("1e-"+((s+"").length-1))),t)}return $n(e,t)}var ya=yr(function(e,t,n){return t=t.toLowerCase(),e+(n?t.charAt(0).toUpperCase()+t.slice(1):t)});function ba(e){return e=Ke(e),e&&e.charAt(0).toUpperCase()+e.slice(1)}function va(e){return e=Ke(e),e&&e.replace(ge,Ge).replace(le,"")}function wa(e,t,n){e=Ke(e),t+="";var r=e.length;return n=n===o?r:kt(n<0?0:+n||0,r),n-=t.length,n>=0&&e.indexOf(t,n)==n}function _a(e){return e=Ke(e),e&&ee.test(e)?e.replace(Q,Ye):e}function ka(e){return e=Ke(e),e&&ue.test(e)?e.replace(ae,Je):e||"(?:)"}var Sa=yr(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()});function Ea(e,t,n){e=Ke(e),t=+t;var r=e.length;if(r>=t||!vt(t))return e;var i=(t-r)/2,o=yt(i),s=mt(i);return n=Rr("",s,n),n.slice(0,o)+e+n}var xa=jr(),Ca=jr(!0);function Aa(e,t,n){return(n?ni(e,t,n):null==t)?t=0:t&&(t=+t),e=Ba(e),Et(e,t||(pe.test(e)?16:10))}function Ia(e,t){var n="";if(e=Ke(e),t=+t,t<1||!e||!vt(t))return n;do{t%2&&(n+=e),t=yt(t/2),e+=e}while(t);return n}var Ta=yr(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),ja=yr(function(e,t,n){return e+(n?" ":"")+(t.charAt(0).toUpperCase()+t.slice(1))});function Oa(e,t,n){return e=Ke(e),n=null==n?0:kt(n<0?0:+n||0,e.length),e.lastIndexOf(t,n)==n}function Pa(e,t,n){var r=Rt.templateSettings;n&&ni(e,t,n)&&(t=n=o),e=Ke(e),t=hn(pn({},n||t),r,fn);var s=hn(pn({},t.imports),r.imports,fn),a=ra(s),u=nr(s,a),l,c,f=0,h=t.interpolate||ye,p="__p += '",d=we((t.escape||ye).source+"|"+h.source+"|"+(h===re?fe:ye).source+"|"+(t.evaluate||ye).source+"|$","g"),m="//# sourceURL="+("sourceURL"in t?t.sourceURL:"lodash.templateSources["+ ++Se+"]")+"\n";e.replace(d,function(t,n,r,i,o,s){return r||(r=i),p+=e.slice(f,s).replace(be,Ze),n&&(l=!0,p+="' +\n__e("+n+") +\n'"),o&&(c=!0,p+="';\n"+o+";\n__p += '"),r&&(p+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),f=s+t.length,t}),p+="';\n";var g=t.variable;g||(p="with (obj) {\n"+p+"\n}\n"),p=(c?p.replace(G,""):p).replace(Y,"$1").replace(J,"$1;"),p="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(l?", __e = _.escape":"")+(c?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var y=Da(function(){return i(a,m+"return "+p).apply(o,u)});if(y.source=p,Es(y))throw y;return y}function Ba(e,t,n){var r=e;return e=Ke(e),e?(n?ni(r,t,n):null==t)?e.slice(rt(e),it(e)+1):(t+="",e.slice(He(e,t),Ve(e,t)+1)):e}function Ra(e,t,n){var r=e;return e=Ke(e),e?(n?ni(r,t,n):null==t)?e.slice(rt(e)):e.slice(He(e,t+"")):e}function Na(e,t,n){var r=e;return e=Ke(e),e?(n?ni(r,t,n):null==t)?e.slice(0,it(e)+1):e.slice(0,Ve(e,t+"")+1):e}function Ma(e,t,n){n&&ni(e,t,n)&&(t=o);var r=g,i=y;if(null!=t)if(As(t)){var s="separator"in t?t.separator:s;r="length"in t?+t.length||0:r,i="omission"in t?Ke(t.omission):i}else r=+t||0;if(e=Ke(e),r>=e.length)return e;var a=r-i.length;if(a<1)return i;var u=e.slice(0,a);if(null==s)return u+i;if(Rs(s)){if(e.slice(a).search(s)){var l,c,f=e.slice(0,a);for(s.global||(s=we(s.source,(he.exec(s)||"")+"g")),s.lastIndex=0;l=s.exec(f);)c=l.index;u=u.slice(0,null==c?a:c)}}else if(e.indexOf(s,a)!=a){var h=u.lastIndexOf(s);h>-1&&(u=u.slice(0,h))}return u+i}function La(e){return e=Ke(e),e&&X.test(e)?e.replace(Z,ot):e}function Fa(e,t,n){return n&&ni(e,t,n)&&(t=o),e=Ke(e),e.match(t||ve)||[]}var Da=ls(function(e,t){try{return e.apply(o,t)}catch(e){return Es(e)?e:new r(e)}});function Ua(e,t,n){return n&&ni(e,t,n)&&(t=o),Xe(e)?Ka(e):gn(e,t)}function za(e){return function(){return e}}function qa(e){return e}function Ka(e){return Un(yn(e,!0))}function Ha(e,t){return zn(e,yn(t,!0))}var Va=ls(function(e,t){return function(n){return Xr(n,e,t)}}),Wa=ls(function(e,t){return function(n){return Xr(e,n,t)}});function $a(e,t,n){if(null==n){var r=As(t),i=r?ra(t):o,s=i&&i.length?Rn(t,i):o;(s?s.length:r)||(s=!1,n=t,t=e,e=this)}s||(s=Rn(t,ra(t)));var a=!0,u=-1,l=Cs(e),c=s.length;!1===n?a=!1:As(n)&&"chain"in n&&(a=n.chain);for(;++u0||t<0)?new Ft(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==o&&(t=+t||0,n=t<0?n.dropRight(-t):n.take(t-e)),n)},Ft.prototype.takeRightWhile=function(e,t){return this.reverse().takeWhile(e,t).reverse()},Ft.prototype.toArray=function(){return this.take(At)},Pn(Ft.prototype,function(e,t){var n=/^(?:filter|map|reject)|While$/.test(t),r=/^(?:first|last)$/.test(t),i=Rt[r?"take"+("last"==t?"Right":""):t];i&&(Rt.prototype[t]=function(){var t=r?[1]:arguments,s=this.__chain__,a=this.__wrapped__,u=!!this.__actions__.length,l=a instanceof Ft,c=t[0],f=l||bs(a);f&&n&&"function"==typeof c&&1!=c.length&&(l=f=!1);var h=function(e){return r&&s?i(e,1)[0]:i.apply(o,on([e],t))},p={func:so,args:[h],thisArg:o},d=l&&!u;if(r&&!s)return d?(a=a.clone(),a.__actions__.push(p),e.call(a)):i.call(o,this.value())[0];if(!r&&f){a=d?a:new Ft(this);var m=e.apply(a,t);return m.__actions__.push(p),new Mt(m,s)}return this.thru(h)})}),Qt(["join","pop","push","replace","shift","sort","splice","split","unshift"],function(e){var t=(/^(?:replace|split)$/.test(e)?Te:Ae)[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:join|pop|replace|shift)$/.test(e);Rt.prototype[e]=function(){var e=arguments;return r&&!this.__chain__?t.apply(this.value(),e):this[n](function(n){return t.apply(n,e)})}}),Pn(Ft.prototype,function(e,t){var n=Rt[t];if(n){var r=n.name,i=Bt[r]||(Bt[r]=[]);i.push({name:t,func:n})}}),Bt[Br(o,u).name]=[{name:"wrapper",func:o}],Ft.prototype.clone=Dt,Ft.prototype.reverse=Ut,Ft.prototype.value=zt,Rt.prototype.chain=ao,Rt.prototype.commit=uo,Rt.prototype.concat=lo,Rt.prototype.plant=co,Rt.prototype.reverse=fo,Rt.prototype.toString=ho,Rt.prototype.run=Rt.prototype.toJSON=Rt.prototype.valueOf=Rt.prototype.value=po,Rt.prototype.collect=Rt.prototype.map,Rt.prototype.head=Rt.prototype.first,Rt.prototype.select=Rt.prototype.filter,Rt.prototype.tail=Rt.prototype.rest,Rt}var at=st();Fe._=at,i=function(){return at}.call(t,n,t,e),i===o||(e.exports=i)}).call(this)}).call(this,n(75)(e),n(8))},function(e,t,n){"use strict";(function(t){var r=n(805); +var r=function(e,t){return function(){var n=Array.prototype.slice.call(arguments),r=n.length-1,i=n&&n.length>0?n[r]:null,o="function"==typeof i?i:null;return o?e.apply(t,n):new Promise(function(r,i){n.push(function(e,t){if(e)return i(e);r(t)}),e.apply(t,n)})}};e.exports=function(e,t){t=t||{};var n=Object.prototype.toString.call(e);if("[object Object]"===n||"[object Array]"===n){var i=t.replace?e:{};for(var o in e)e.hasOwnProperty(o)&&(i[o]=r(e[o]));return i}return r(e,t.context||e)}},function(e,t){var n=e.exports={},r,i;function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}function l(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(e){i=s}}();var u=[],c=!1,h,f=-1;function p(){c&&h&&(c=!1,h.length?u=h.concat(u):f=-1,u.length&&d())}function d(){if(!c){var e=a(p);c=!0;for(var t=u.length;t;){for(h=u,u=[];++f1)for(var n=1;n=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))}),t.splice(i,0,n)}function s(...e){return"object"==typeof console&&console.log&&console.log(...e)}function a(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}}function l(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function u(){try{return localStorage}catch(e){}}t.log=s,t.formatArgs=o,t.save=a,t.load=l,t.useColors=i,t.storage=u(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=n(643)(t);const{formatters:c}=e.exports;c.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,n(3))},function(e,t,n){var r=n(0),i=r.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=s),o(i,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";var r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function e(t,n,r){return Function.prototype.apply.call(t,n,r)},o;function s(e){console&&console.warn&&console.warn(e)}o=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function e(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function e(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function e(t){return t!=t};function l(){l.init.call(this)}e.exports=l,l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var u=10;function c(e){return void 0===e._maxListeners?l.defaultMaxListeners:e._maxListeners}function h(e,t,n,r){var i,o,a;if("function"!=typeof n)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n);if(o=e._events,void 0===o?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]),void 0===a)a=o[t]=n,++e._eventsCount;else if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),i=c(e),i>0&&a.length>i&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s(l)}return e}function f(){for(var e=[],t=0;t0&&(a=n[0]),a instanceof Error)throw a;var l=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw l.context=a,l}var u=s[t];if(void 0===u)return!1;if("function"==typeof u)i(u,this,n);else for(var c=u.length,h=g(u,c),r=0;r=0;s--)if(r[s]===n||r[s].listener===n){a=r[s].listener,o=s;break}if(o<0)return this;0===o?r.shift():y(r,o),1===r.length&&(i[t]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",t,a||n)}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function e(t){var n,r,i;if(r=this._events,void 0===r)return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o=Object.keys(r),s;for(i=0;i=0;i--)this.removeListener(t,n[i]);return this},l.prototype.listeners=function e(t){return d(this,t,!0)},l.prototype.rawListeners=function e(t){return d(this,t,!1)},l.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},l.prototype.listenerCount=m,l.prototype.eventNames=function e(){return this._eventsCount>0?o(this._events):[]}},function(e,t,n){(function(e){function n(e){return Array.isArray?Array.isArray(e):"[object Array]"===g(e)}function r(e){return"boolean"==typeof e}function i(e){return null===e}function o(e){return null==e}function s(e){return"number"==typeof e}function a(e){return"string"==typeof e}function l(e){return"symbol"==typeof e}function u(e){return void 0===e}function c(e){return"[object RegExp]"===g(e)}function h(e){return"object"==typeof e&&null!==e}function f(e){return"[object Date]"===g(e)}function p(e){return"[object Error]"===g(e)||e instanceof Error}function d(e){return"function"==typeof e}function m(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function g(e){return Object.prototype.toString.call(e)}t.isArray=n,t.isBoolean=r,t.isNull=i,t.isNullOrUndefined=o,t.isNumber=s,t.isString=a,t.isSymbol=l,t.isUndefined=u,t.isRegExp=c,t.isObject=h,t.isDate=f,t.isError=p,t.isFunction=d,t.isPrimitive=m,t.isBuffer=e.isBuffer}).call(this,n(0).Buffer)},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";(function(t){const r=n(27),i=n(60),o=n(115),s=n(95),a=n(707),l=n(39);class u{constructor(n,s,a){if(e.exports.isCID(n)){let e=n;return this.version=e.version,this.codec=e.codec,void(this.multihash=t.from(e.multihash))}if("string"==typeof n)if(i.isEncoded(n)){const e=i.decode(n);n=parseInt(e.slice(0,1).toString("hex"),16),s=o.getCodec(e.slice(1)),a=o.rmPrefix(e.slice(1))}else s="dag-pb",a=r.fromB58String(n),n=0;else if(t.isBuffer(n)){const e=n.slice(0,1),t=parseInt(e.toString("hex"),16);if(0===t||1===t){const e=n;n=t,s=o.getCodec(e.slice(1)),a=o.rmPrefix(e.slice(1))}else s="dag-pb",a=n,n=0}this.codec=s,this.version=n,this.multihash=a,u.validateCID(this)}get buffer(){let e=this._buffer;if(!e){if(0===this.version)e=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");e=t.concat([t.from("01","hex"),o.getCodeVarint(this.codec),this.multihash])}Object.defineProperty(this,"_buffer",{value:e})}return e}get prefix(){return t.concat([t.from(`0${this.version}`,"hex"),o.getCodeVarint(this.codec),r.prefix(this.multihash)])}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:t}=r.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==t)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new c(0,this.codec,this.multihash)}toV1(){return new c(1,this.codec,this.multihash)}toBaseEncodedString(e){switch(e=e||"base58btc",this.version){case 0:if("base58btc"!==e)throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");return r.toB58String(this.multihash);case 1:return i.encode(e,this.buffer).toString();default:throw new Error("Unsupported version")}}toString(e){return this.toBaseEncodedString(e)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(e){return this.codec===e.codec&&this.version===e.version&&this.multihash.equals(e.multihash)}static validateCID(e){let t=a.checkCIDComponents(e);if(t)throw new Error(t)}}const c=l(u,{className:"CID",symbolName:"@ipld/js-cid/CID"});c.codecs=s,e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(t=(0,l.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 n=0;function r(t){var r=(0,d.default)(e[n++]);t.push((0,f.default)(o)),r.apply(null,t)}function o(i){if(i||n===e.length)return t.apply(null,arguments);r((0,c.default)(arguments,1))}r([])};var r=n(65),i=m(r),o=n(58),s=m(o),a=n(183),l=m(a),u=n(86),c=m(u),h=n(107),f=m(h),p=n(37),d=m(p);function m(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,n){"use strict";(function(t){function n(e,n,r,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o=arguments.length,s,a;switch(o){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function t(){e.call(null,n)});case 3:return t.nextTick(function t(){e.call(null,n,r)});case 4:return t.nextTick(function t(){e.call(null,n,r,i)});default:for(s=new Array(o-1),a=0;a=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),l=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),v(n)?r.showHidden=n:n&&t._extend(r,n),S(r.showHidden)&&(r.showHidden=!1),S(r.depth)&&(r.depth=2),S(r.colors)&&(r.colors=!1),S(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=l),h(r,e,r.depth)}function l(e,t){var n=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.colors[n][1]+"m":e}function u(e,t){return e}function c(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function h(e,n,r){if(e.customInspect&&n&&I(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return k(i)||(i=h(e,i,r)),i}var o=f(e,n);if(o)return o;var s=Object.keys(n),a=c(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(n)),T(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return p(n);if(0===s.length){if(I(n)){var l=n.name?": "+n.name:"";return e.stylize("[Function"+l+"]","special")}if(x(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(A(n))return e.stylize(Date.prototype.toString.call(n),"date");if(T(n))return p(n)}var u="",v=!1,b=["{","}"],_;if(y(n)&&(v=!0,b=["[","]"]),I(n)){var w=n.name?": "+n.name:"";u=" [Function"+w+"]"}return x(n)&&(u=" "+RegExp.prototype.toString.call(n)),A(n)&&(u=" "+Date.prototype.toUTCString.call(n)),T(n)&&(u=" "+p(n)),0!==s.length||v&&0!=n.length?r<0?x(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),_=v?d(e,n,r,a,s):s.map(function(t){return m(e,n,r,a,t,v)}),e.seen.pop(),g(_,u,b)):b[0]+u+b[1]}function f(e,t){if(S(t))return e.stylize("undefined","undefined");if(k(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return w(t)?e.stylize(""+t,"number"):v(t)?e.stylize(""+t,"boolean"):b(t)?e.stylize("null","null"):void 0}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,n,r,i){for(var o=[],s=0,a=t.length;s-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n"))):a=e.stylize("[Circular]","special")),S(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function g(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function y(e){return Array.isArray(e)}function v(e){return"boolean"==typeof e}function b(e){return null===e}function _(e){return null==e}function w(e){return"number"==typeof e}function k(e){return"string"==typeof e}function E(e){return"symbol"==typeof e}function S(e){return void 0===e}function x(e){return C(e)&&"[object RegExp]"===R(e)}function C(e){return"object"==typeof e&&null!==e}function A(e){return C(e)&&"[object Date]"===R(e)}function T(e){return C(e)&&("[object Error]"===R(e)||e instanceof Error)}function I(e){return"function"==typeof e}function j(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function R(e){return Object.prototype.toString.call(e)}function B(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(S(s)&&(s=e.env.NODE_DEBUG||""),n=n.toUpperCase(),!o[n])if(new RegExp("\\b"+n+"\\b","i").test(s)){var r=e.pid;o[n]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",n,r,e)}}else o[n]=function(){};return o[n]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=y,t.isBoolean=v,t.isNull=b,t.isNullOrUndefined=_,t.isNumber=w,t.isString=k,t.isSymbol=E,t.isUndefined=S,t.isRegExp=x,t.isObject=C,t.isDate=A,t.isError=T,t.isFunction=I,t.isPrimitive=j,t.isBuffer=n(726);var O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function P(){var e=new Date,t=[B(e.getHours()),B(e.getMinutes()),B(e.getSeconds())].join(":");return[e.getDate(),O[e.getMonth()],t].join(" ")}function N(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",P(),t.format.apply(t,arguments))},t.inherits=n(727),t._extend=function(e,t){if(!t||!C(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var D="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function M(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}function F(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');function n(){for(var n=[],r=0;r"}toJSON(){return{id:this.toB58String(),privKey:h(this.marshalPrivKey()),pubKey:h(this.marshalPubKey())}}toHexString(){return i.toHexString(this.id)}toBytes(){return this.id}toB58String(){return this._idB58String}isEqual(e){if(r.isBuffer(e))return this.id.equals(e);if(e.id)return this.id.equals(e.id);throw new Error("not valid Id")}isValid(e){this.privKey&&this.privKey.public&&this.privKey.public.bytes&&r.isBuffer(this.pubKey.bytes)&&this.privKey.public.bytes.equals(this.pubKey.bytes)?e():e(new Error("Keys not match"))}}const c=l(u,{className:"PeerId",symbolName:"@libp2p/js-peer-id/PeerId"});function h(e){if(e)return e.toString("base64")}t=e.exports=c,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.generateKeyPair("RSA",e.bits,t),(e,t)=>e.public.hash((n,r)=>{t(n,r,e)})],(e,n,r)=>{if(e)return t(e);t(null,new c(n,r))})},t.createFromHexString=function(e){return new c(i.fromHexString(e))},t.createFromBytes=function(e){return new c(e)},t.createFromB58String=function(e){return new c(i.fromB58String(e))},t.createFromPubKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let n;try{let i=e;if("string"==typeof i&&(i=r.from(e,"base64")),!r.isBuffer(i))throw new Error("Supplied key is neither a base64 string nor a buffer");n=o.unmarshalPublicKey(i)}catch(e){return t(e)}n.hash((e,r)=>{if(e)return t(e);t(null,new c(r,null,n))})},t.createFromPrivKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let n=e;try{if("string"==typeof n&&(n=r.from(e,"base64")),!r.isBuffer(n))throw new Error("Supplied key is neither a base64 string nor a buffer")}catch(e){return t(e)}a([e=>o.unmarshalPrivateKey(n,e),(e,t)=>e.public.hash((n,r)=>{t(n,r,e)})],(e,n,r)=>{if(e)return t(e);t(null,new c(n,r,r.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let n,s,l,u;try{n=i.fromB58String(e.id),s=e.privKey&&r.from(e.privKey,"base64"),l=e.pubKey&&r.from(e.pubKey,"base64"),u=l&&o.unmarshalPublicKey(l)}catch(e){return t(e)}s?a([e=>o.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((n,r)=>{t(n,r,e)}),(e,t,n)=>{u?u.hash((r,i)=>{n(r,e,t,i)}):n(null,e,t)}],(e,r,i,o)=>e?t(e):u&&!r.equals(o)?t(new Error("Public and private key do not match")):n&&!r.equals(n)?t(new Error("Id and private key do not match")):void t(null,new c(n,i,u))):t(null,new c(n,null,u))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,n(0).Buffer)},function(e,t){},function(e,t,n){t=e.exports=n(335),t.Stream=t,t.Readable=t,t.Writable=n(339),t.Duplex=n(113),t.Transform=n(340),t.PassThrough=n(674),t.finished=n(245),t.pipeline=n(675)},function(e,t,n){"use strict";var r=n(5).Buffer,i=r.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&&(r.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=d,this.end=m,t=4;break;case"utf8":this.fillLast=h,t=4;break;case"base64":this.text=g,this.end=y,t=3;break;default:return this.write=v,void(this.end=b)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function l(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function u(e,t,n){var r=t.length-1;if(r=0?(i>0&&(e.lastNeed=i-1),i):--r=0?(i>0&&(e.lastNeed=i-2),i):--r=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0))}function c(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}function h(e){var t=this.lastTotal-this.lastNeed,n=c(this,e,t);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function f(e,t){var n=u(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)}function p(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function d(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function m(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function g(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function y(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function v(e){return e.toString(this.encoding)}function b(e){return e&&e.length?this.write(e):""}t.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n0&&"/"!==e.charAt(0))throw new Error(`multiaddr "${e}" must start with a "/"`);this.buffer=i.fromString(e)}else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=i.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});u.prototype.toString=function e(){return i.bufferToString(this.buffer)},u.prototype.toJSON=u.prototype.toString,u.prototype.toOptions=function e(){const t={},n=this.toString().split("/");return t.family="ip4"===n[1]?"ipv4":"ipv6",t.host=n[2],t.transport=n[3],t.port=n[4],t},u.prototype.inspect=function e(){return""},u.prototype.protos=function e(){return this.protoCodes().map(e=>Object.assign({},o(e)))},u.prototype.protoCodes=function e(){const t=[],n=this.buffer;let r=0;for(;re.name)},u.prototype.tuples=function e(){return i.bufferToTuples(this.buffer)},u.prototype.stringTuples=function e(){const t=i.bufferToTuples(this.buffer);return i.tuplesToStringTuples(t)},u.prototype.encapsulate=function e(t){return t=u(t),u(this.toString()+t.toString())},u.prototype.decapsulate=function e(t){t=t.toString();const n=this.toString(),r=n.lastIndexOf(t);if(r<0)throw new Error("Address "+this+" does not contain subaddress: "+t);return u(n.slice(0,r))},u.prototype.getPeerId=function e(){let t=null;try{t=this.stringTuples().filter(e=>{if(e[0]===o.names.ipfs.code)return!0})[0][1],a.decode(t)}catch(e){t=null}return t},u.prototype.getPath=function e(){let t=null;try{t=this.stringTuples().filter(e=>{const t=o(e[0]);if(t.path)return!0})[0][1]}catch(e){t=null}return t},u.prototype.equals=function e(t){return this.buffer.equals(t.buffer)},u.prototype.nodeAddress=function e(){const t=this.protoCodes(),n=this.protoNames(),r=this.toString().split("/").slice(1);if(r.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==t[0]&&41!==t[0]&&54!==t[0]&&55!==t[0])throw new Error(`no protocol with name: "'${n[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if("tcp"!==r[2]&&"udp"!==r[2])throw new Error(`no protocol with name: "'${n[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:41===t[0]||55===t[0]?6:4,address:r[1],port:r[3]}},u.fromNodeAddress=function e(t,n){if(!t)throw new Error("requires node address object");if(!n)throw new Error("requires transport protocol");const r="IPv6"===t.family?"ip6":"ip4";return u("/"+[r,t.address,n,t.port].join("/"))},u.prototype.isThinWaistAddress=function e(t){const n=(t||this).protos();return 2===n.length&&((4===n[0].code||41===n[0].code)&&(6===n[1].code||273===n[1].code))},u.protocols=o,u.isName=function e(t){return!!u.isMultiaddr(t)&&t.protos().some(e=>e.resolvable)},u.resolve=function e(t,n){return u.isMultiaddr(t)&&u.isName(t)?n(new Error("not implemented yet")):n(new Error("not a valid name"))},t=e.exports=u}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(536),i=n(537),o=n(22);e.exports=(e=>{const t=r();if("function"==typeof e)return e;if("object"==typeof e)return i(e);if("string"==typeof e){const n=o(e).nodeAddress();return t.host=n.address,t.port=n.port,i(t)}throw new Error("Argument must be a send function or a config object.")})},function(e,t,n){"use strict";(function(t){var r=n(725); /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */function i(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i=0;f--)if(a[f]!==l[f])return!1;for(f=a.length-1;f>=0;f--)if(c=a[f],!w(e[c],t[c],n,r))return!1;return!0}function S(e,t,n){w(e,t,!0)&&b(e,t,n,"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 x(e){var t;try{e()}catch(e){t=e}return t}function C(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=x(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&b(i,n,"Missing expected exception"+r);var o="string"==typeof r,a=!e&&s.isError(i),u=!e&&i&&!n;if((a&&o&&E(i,n)||u)&&b(i,n,"Got unwanted exception"+r),e&&i&&n&&!E(i,n)||!e&&i)throw i}function A(e,t){e||b(e,!0,t,"==",A)}h.AssertionError=function e(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=y(this),this.generatedMessage=!0);var n=t.stackStartFunction||b;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var i=r.stack,o=d(n),s=i.indexOf("\n"+o);if(s>=0){var a=i.indexOf("\n",s+1);i=i.substring(a+1)}this.stack=i}}},s.inherits(h.AssertionError,Error),h.fail=b,h.ok=v,h.equal=function e(t,n,r){t!=n&&b(t,n,r,"==",h.equal)},h.notEqual=function e(t,n,r){t==n&&b(t,n,r,"!=",h.notEqual)},h.deepEqual=function e(t,n,r){w(t,n,!1)||b(t,n,r,"deepEqual",h.deepEqual)},h.deepStrictEqual=function e(t,n,r){w(t,n,!0)||b(t,n,r,"deepStrictEqual",h.deepStrictEqual)},h.notDeepEqual=function e(t,n,r){w(t,n,!1)&&b(t,n,r,"notDeepEqual",h.notDeepEqual)},h.notDeepStrictEqual=S,h.strictEqual=function e(t,n,r){t!==n&&b(t,n,r,"===",h.strictEqual)},h.notStrictEqual=function e(t,n,r){t===n&&b(t,n,r,"!==",h.notStrictEqual)},h.throws=function(e,t,n){C(!0,e,t,n)},h.doesNotThrow=function(e,t,n){C(!1,e,t,n)},h.ifError=function(e){if(e)throw e},h.strict=r(A,h,{equal:h.strictEqual,deepEqual:h.deepStrictEqual,notEqual:h.notStrictEqual,notDeepEqual:h.notDeepStrictEqual}),h.strict.strict=h.strict;var I=Object.keys||function(e){var t=[];for(var n in e)a.call(e,n)&&t.push(n);return t}}).call(this,n(8))},function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,n){t=e.exports=n(396),t.Stream=t,t.Readable=t,t.Writable=n(400),t.Duplex=n(136),t.Transform=n(401),t.PassThrough=n(771),t.finished=n(294),t.pipeline=n(772)},function(e,t,n){"use strict";const r=n(633),i=n(634),o=n(24);e.exports=(e=>{const t=r();if("function"==typeof e)return e;if("object"==typeof e)return i(e);if("string"==typeof e){const n=o(e).nodeAddress();return t.host=n.address,t.port=n.port,i(t)}throw new Error("Argument must be a send function or a config object.")})},function(e,t,n){"use strict";function r(e,t,n){var r=e instanceof Error?e:new Error(e),i;if("object"==typeof t?n=t:null!=t&&(r.code=t),n)for(i in n)r[i]=n[i];return r}e.exports=r},function(e,t,n){"use strict";(function(r){const i=n(35),o=n(456),s=n(18),a=n(11),u=n(53);class l{constructor(e,t,n){s(r.isBuffer(e),"invalid id provided"),t&&n&&s(t.public.bytes.equals(n.bytes),"inconsistent arguments"),this._id=e,this._idB58String=i.toB58String(this.id),this._privKey=t,this._pubKey=n}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){return this._pubKey?this._pubKey:this._privKey?this._privKey.public:void 0}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return o.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.marshalPrivateKey(this.privKey)}toPrint(){let e=this.toB58String();e.startsWith("Qm")&&(e=e.slice(2));let t=6;return e.length"}toJSON(){return{id:this.toB58String(),privKey:f(this.marshalPrivKey()),pubKey:f(this.marshalPubKey())}}toHexString(){return i.toHexString(this.id)}toBytes(){return this.id}toB58String(){return this._idB58String}isEqual(e){if(r.isBuffer(e))return this.id.equals(e);if(e.id)return this.id.equals(e.id);throw new Error("not valid Id")}isValid(e){this.privKey&&this.privKey.public&&this.privKey.public.bytes&&r.isBuffer(this.pubKey.bytes)&&this.privKey.public.bytes.equals(this.pubKey.bytes)?e():e(new Error("Keys not match"))}}const c=u(l,{className:"PeerId",symbolName:"@libp2p/js-peer-id/PeerId"});function f(e){if(e)return e.toString("base64")}t=e.exports=c,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.generateKeyPair("RSA",e.bits,t),(e,t)=>e.public.hash((n,r)=>{t(n,r,e)})],(e,n,r)=>{if(e)return t(e);t(null,new c(n,r))})},t.createFromHexString=function(e){return new c(i.fromHexString(e))},t.createFromBytes=function(e){return new c(e)},t.createFromB58String=function(e){return new c(i.fromB58String(e))},t.createFromPubKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let n;try{let i=e;if("string"==typeof i&&(i=r.from(e,"base64")),!r.isBuffer(i))throw new Error("Supplied key is neither a base64 string nor a buffer");n=o.unmarshalPublicKey(i)}catch(e){return t(e)}n.hash((e,r)=>{if(e)return t(e);t(null,new c(r,null,n))})},t.createFromPrivKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let n=e;try{if("string"==typeof n&&(n=r.from(e,"base64")),!r.isBuffer(n))throw new Error("Supplied key is neither a base64 string nor a buffer")}catch(e){return t(e)}a([e=>o.unmarshalPrivateKey(n,e),(e,t)=>e.public.hash((n,r)=>{t(n,r,e)})],(e,n,r)=>{if(e)return t(e);t(null,new c(n,r,r.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let n,s,u,l;try{n=i.fromB58String(e.id),s=e.privKey&&r.from(e.privKey,"base64"),u=e.pubKey&&r.from(e.pubKey,"base64"),l=u&&o.unmarshalPublicKey(u)}catch(e){return t(e)}s?a([e=>o.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((n,r)=>{t(n,r,e)}),(e,t,n)=>{l?l.hash((r,i)=>{n(r,e,t,i)}):n(null,e,t)}],(e,r,i,o)=>e?t(e):l&&!r.equals(o)?t(new Error("Public and private key do not match")):n&&!r.equals(n)?t(new Error("Id and private key do not match")):void t(null,new c(n,i,l))):t(null,new c(n,null,l))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(937),o=n(320),s=n(39),a=n(76),u=n(53),l=u.proto(function(e){if(!(this instanceof l))return new l(e);if(null==e&&(e=""),e instanceof r)this.buffer=i.fromBuffer(e);else if("string"==typeof e||e instanceof String){if(e.length>0&&"/"!==e.charAt(0))throw new Error(`multiaddr "${e}" must start with a "/"`);this.buffer=i.fromString(e)}else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=i.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});l.prototype.toString=function e(){return i.bufferToString(this.buffer)},l.prototype.toJSON=l.prototype.toString,l.prototype.toOptions=function e(){const t={},n=this.toString().split("/");return t.family="ip4"===n[1]?"ipv4":"ipv6",t.host=n[2],t.transport=n[3],t.port=n[4],t},l.prototype.inspect=function e(){return""},l.prototype.protos=function e(){return this.protoCodes().map(e=>Object.assign({},o(e)))},l.prototype.protoCodes=function e(){const t=[],n=this.buffer;let r=0;for(;re.name)},l.prototype.tuples=function e(){return i.bufferToTuples(this.buffer)},l.prototype.stringTuples=function e(){const t=i.bufferToTuples(this.buffer);return i.tuplesToStringTuples(t)},l.prototype.encapsulate=function e(t){return t=l(t),l(this.toString()+t.toString())},l.prototype.decapsulate=function e(t){t=t.toString();const n=this.toString(),r=n.lastIndexOf(t);if(r<0)throw new Error("Address "+this+" does not contain subaddress: "+t);return l(n.slice(0,r))},l.prototype.getPeerId=function e(){let t=null;try{t=this.stringTuples().filter(e=>{if(e[0]===o.names.ipfs.code)return!0})[0][1],a.decode(t)}catch(e){t=null}return t},l.prototype.getPath=function e(){let t=null;try{t=this.stringTuples().filter(e=>{const t=o(e[0]);if(t.path)return!0})[0][1]}catch(e){t=null}return t},l.prototype.equals=function e(t){return this.buffer.equals(t.buffer)},l.prototype.nodeAddress=function e(){const t=this.protoCodes(),n=this.protoNames(),r=this.toString().split("/").slice(1);if(r.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==t[0]&&41!==t[0]&&54!==t[0]&&55!==t[0])throw new Error(`no protocol with name: "'${n[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if("tcp"!==r[2]&&"udp"!==r[2])throw new Error(`no protocol with name: "'${n[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:41===t[0]||55===t[0]?6:4,address:r[1],port:r[3]}},l.fromNodeAddress=function e(t,n){if(!t)throw new Error("requires node address object");if(!n)throw new Error("requires transport protocol");const r="IPv6"===t.family?"ip6":"ip4";return l("/"+[r,t.address,n,t.port].join("/"))},l.prototype.isThinWaistAddress=function e(t){const n=(t||this).protos();return 2===n.length&&((4===n[0].code||41===n[0].code)&&(6===n[1].code||273===n[1].code))},l.protocols=o,l.isName=function e(t){return!!l.isMultiaddr(t)&&t.protos().some(e=>e.resolvable)},l.resolve=function e(t,n){return l.isMultiaddr(t)&&l.isName(t)?n(new Error("not implemented yet")):n(new Error("not a valid name"))},t=e.exports=l}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(84),i=n(17);e.exports={checkState:function(e,t){if(!e)throw new r.InvalidState(t)},checkArgument:function(e,t,n,i){if(!e)throw new r.InvalidArgument(t,n,i)},checkArgumentType:function(e,t,o){if(o=o||"(unknown name)",i.isString(t)){if("Buffer"===t){var s=n(30);if(!s.isBuffer(e))throw new r.InvalidArgumentType(e,t,o)}else if(typeof e!==t)throw new r.InvalidArgumentType(e,t,o)}else if(!(e instanceof t))throw new r.InvalidArgumentType(e,t.name,o)}}},function(e,t,n){"use strict";var r=n(792),i=n(796),o=n(800);for(var s in t=e.exports=n(12),t.pull=t,r)t[s]=r[s];for(var s in o)t[s]=o[s];for(var s in i)t[s]=i[s]},function(e,t,n){(function(t,r){var i=n(18),o=n(57).Stream,s=n(13),a=/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;function u(e){return e.charAt(0).toUpperCase()+e.slice(1)}function l(e,t,n,r,o){throw new i.AssertionError({message:s.format("%s (%s) is required",e,t),actual:void 0===o?typeof r:o(r),expected:t,operator:n||"===",stackStartFunction:l.caller})}function c(e){return Object.prototype.toString.call(e).slice(8,-1)}function f(){}var h={bool:{check:function(e){return"boolean"==typeof e}},func:{check:function(e){return"function"==typeof e}},string:{check:function(e){return"string"==typeof e}},object:{check:function(e){return"object"==typeof e&&null!==e}},number:{check:function(e){return"number"==typeof e&&!isNaN(e)}},finite:{check:function(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}},buffer:{check:function(e){return t.isBuffer(e)},operator:"Buffer.isBuffer"},array:{check:function(e){return Array.isArray(e)},operator:"Array.isArray"},stream:{check:function(e){return e instanceof o},operator:"instanceof",actual:c},date:{check:function(e){return e instanceof Date},operator:"instanceof",actual:c},regexp:{check:function(e){return e instanceof RegExp},operator:"instanceof",actual:c},uuid:{check:function(e){return"string"==typeof e&&a.test(e)},operator:"isUUID"}};function p(e){var t=Object.keys(h),n;return n=r.env.NODE_NDEBUG?f:function(e,t){e||l(t,"true",e)},t.forEach(function(t){if(e)n[t]=f;else{var r=h[t];n[t]=function(e,n){r.check(e)||l(n,t,r.operator,e,r.actual)}}}),t.forEach(function(t){var r="optional"+u(t);if(e)n[r]=f;else{var i=h[t];n[r]=function(e,n){void 0!==e&&null!==e&&(i.check(e)||l(n,t,i.operator,e,i.actual))}}}),t.forEach(function(t){var r="arrayOf"+u(t);if(e)n[r]=f;else{var i=h[t],o="["+t+"]";n[r]=function(e,t){var n;for(Array.isArray(e)||l(t,o,i.operator,e,i.actual),n=0;n=c.OP_1&&e<=c.OP_16||e===c.OP_1NEGATE)}function d(e){return u.Buffer(e)||p(e)}function m(e){return u.Array(e)&&e.every(d)}function g(e){return 0===e.length?c.OP_0:1===e.length?e[0]>=1&&e[0]<=16?h+e[0]:129===e[0]?c.OP_1NEGATE:void 0:void 0}function y(e){if(r.isBuffer(e))return e;a(u.Array,e);const t=e.reduce(function(e,t){return r.isBuffer(t)?1===t.length&&void 0!==g(t)?e+1:e+s.encodingLength(t.length)+t.length:e+1},0),n=r.allocUnsafe(t);let i=0;if(e.forEach(function(e){if(r.isBuffer(e)){const t=g(e);if(void 0!==t)return n.writeUInt8(t,i),void(i+=1);i+=s.encode(n,e.length,i),e.copy(n,i),i+=e.length}else n.writeUInt8(e,i),i+=1}),i!==n.length)throw new Error("Could not decode chunks");return n}function b(e){if(u.Array(e))return e;a(u.Buffer,e);const t=[];let n=0;for(;nc.OP_0&&r<=c.OP_PUSHDATA4){const r=s.decode(e,n);if(null===r)return null;if(n+=r.size,n+r.number>e.length)return null;const i=e.slice(n,n+r.number);n+=r.number;const o=g(i);void 0!==o?t.push(o):t.push(i)}else t.push(r),n+=1}return t}function v(e){return r.isBuffer(e)&&(e=b(e)),e.map(function(e){if(r.isBuffer(e)){const t=g(e);if(void 0===t)return e.toString("hex");e=t}return f[e]}).join(" ")}function w(e){return a(u.String,e),y(e.split(" ").map(function(e){return void 0!==c[e]?c[e]:(a(u.Hex,e),r.from(e,"hex"))}))}function _(e){return e=b(e),a(m,e),e.map(function(e){return r.isBuffer(e)?e:e===c.OP_0?r.allocUnsafe(0):l.encode(e-h)})}function k(e){return o.isPoint(e)}function S(e){const t=-129&e;return t>0&&t<4}function E(e){return!!r.isBuffer(e)&&(!!S(e[e.length-1])&&i.check(e.slice(0,-1)))}e.exports={compile:y,decompile:b,fromASM:w,toASM:v,toStack:_,number:n(579),signature:n(1355),isCanonicalPubKey:k,isCanonicalScriptSignature:E,isPushOnly:m,isDefinedHashType:S}},function(e,t,n){"use strict";(function(t){var r=n(0),i=n(18),o=n(41),s=n(25);function a(e,t){if(e.length!==t.length)return!1;for(var n=e.length,r=0;r>24&255),r.push(n>>16&255),r.push(n>>8&255),r.push(255&n),new t(r)},integerFromBuffer:function e(t){return s.checkArgumentType(t,"Buffer","buffer"),t[0]<<24|t[1]<<16|t[2]<<8|t[3]},integerFromSingleByteBuffer:function e(t){return s.checkArgumentType(t,"Buffer","buffer"),t[0]},bufferToHex:function e(t){return s.checkArgumentType(t,"Buffer","buffer"),t.toString("hex")},reverse:function e(t){for(var n=new r.Buffer(t.length),i=0;i=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=i(e);return t&&0!==t.length?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r}),!o.kStringMaxLength)try{o.kStringMaxLength=t.binding("buffer").kStringMaxLength}catch(e){}o.constants||(o.constants={MAX_LENGTH:o.kMaxLength},o.kStringMaxLength&&(o.constants.MAX_STRING_LENGTH=o.kStringMaxLength)),e.exports=o}).call(this,n(2))},function(e,t,n){"use strict";var r=n(214),i=n(738);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=_,t.resolve=S,t.resolveObject=E,t.format=k,t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,l=["<",">",'"',"`"," ","\r","\n","\t"],c=["{","}","|","\\","^","`"].concat(l),f=["'"].concat(c),h=["%","/","?",";","#"].concat(f),p=["/","?","#"],d=255,m=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},b={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},w=n(169);function _(e,t,n){if(e&&i.isObject(e)&&e instanceof o)return e;var r=new o;return r.parse(e,t,n),r}function k(e){return i.isString(e)&&(e=_(e)),e instanceof o?e.format():o.prototype.format.call(e)}function S(e,t){return _(e,!1,!0).resolve(t)}function E(e,t){return e?_(e,!1,!0).resolveObject(t):t}o.prototype.parse=function(e,t,n){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o127?R+="x":R+=B[N];if(!R.match(m)){var L=O.slice(0,C),F=O.slice(C+1),D=B.match(g);D&&(L.push(D[1]),F.unshift(D[2])),F.length&&(d="/"+F.join(".")+d),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),j||(this.hostname=r.toASCII(this.hostname));var U=this.port?":"+this.port:"",z=this.hostname||"";this.host=z+U,this.href+=this.host,j&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==d[0]&&(d="/"+d))}if(!y[S])for(var C=0,P=f.length;C0)&&n.host.split("@");x&&(n.auth=x.shift(),n.host=n.hostname=x.shift())}return n.search=e.search,n.query=e.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!S.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var C=S.slice(-1)[0],A=(n.host||e.host||S.length>1)&&("."===C||".."===C)||""===C,I=0,T=S.length;T>=0;T--)C=S[T],"."===C?S.splice(T,1):".."===C?(S.splice(T,1),I++):I&&(S.splice(T,1),I--);if(!_&&!k)for(;I--;I)S.unshift("..");!_||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),A&&"/"!==S.join("/").substr(-1)&&S.push("");var j=""===S[0]||S[0]&&"/"===S[0].charAt(0);if(E){n.hostname=n.host=j?"":S.length?S.shift():"";var x=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");x&&(n.auth=x.shift(),n.host=n.hostname=x.shift())}return _=_||n.host&&S.length,_&&!j&&S.unshift(""),S.length?n.pathname=S.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){"use strict";const r=n(412),i=n(810),o=n(298),s=n(415);t.Key=r,t.MemoryDatastore=i,t.utils=o,t.Errors=s},function(e,t,n){(function(t,r){var i=n(19),o=n(891),s=e.exports=i.util=i.util||{};function a(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function u(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(s.isArrayBuffer(e)||s.isArrayBufferView(e))if(void 0!==r&&e instanceof r)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var n=0;n15?(i=Date.now(),u(e)):(n.push(e),1===n.length&&a.setAttribute("a",o=!o))}}s.nextTick=s.setImmediate}(),s.isNodejs=void 0!==t&&t.versions&&t.versions.node,s.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},s.isArrayBufferView=function(e){return e&&s.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},s.ByteBuffer=u,s.ByteStringBuffer=u;var l=4096;function c(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var n=s.isArrayBuffer(e),r=s.isArrayBufferView(e);if(n||r)return this.data=n?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==e&&void 0!==e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}s.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},s.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},s.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},s.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},s.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var n=this.data;t>0;)1&t&&(n+=e),t>>>=1,t>0&&(e+=e);return this.data=n,this._optimizeConstructedString(t),this},s.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},s.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(s.encodeUtf8(e))},s.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},s.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},s.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},s.ByteStringBuffer.prototype.putInt=function(e,t){a(t);var n="";do{t-=8,n+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(n)},s.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},s.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<=n&&(t-=n<<1),t},s.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},s.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},s.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},s.ByteStringBuffer.prototype.copy=function(){var e=s.createBuffer(this.data);return e.read=this.read,e},s.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},s.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},s.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},s.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var n=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),r=new Uint8Array(this.length()+t);return r.set(n),this.data=new DataView(r.buffer),this},s.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},s.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var n=0;n>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},s.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},s.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},s.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},s.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},s.DataBuffer.prototype.putInt=function(e,t){a(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},s.DataBuffer.prototype.putSignedInt=function(e,t){return a(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},s.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<=n&&(t-=n<<1),t},s.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},s.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},s.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},s.DataBuffer.prototype.copy=function(){return new s.DataBuffer(this)},s.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},s.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},s.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},s.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(n+=e),t>>>=1,t>0&&(e+=e);return n},s.xorBytes=function(e,t,n){for(var r="",i="",o="",s=0,a=0;n>0;--n,++s)i=e.charCodeAt(s)^t.charCodeAt(s),a>=10&&(r+=o,o="",a=0),o+=String.fromCharCode(i),++a;return r+=o,r},s.hexToBytes=function(e){var t="",n=0;for(!0&e.length&&(n=1,t+=String.fromCharCode(parseInt(e[0],16)));n>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";s.encode64=function(e,t){for(var n="",r="",i,o,s,a=0;a>2),n+=f.charAt((3&i)<<4|o>>4),isNaN(o)?n+="==":(n+=f.charAt((15&o)<<2|s>>6),n+=isNaN(s)?"=":f.charAt(63&s)),t&&n.length>t&&(r+=n.substr(0,t)+"\r\n",n=n.substr(t));return r+=n,r},s.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",n,r,i,o,s=0;s>4),64!==i&&(t+=String.fromCharCode((15&r)<<4|i>>2),64!==o&&(t+=String.fromCharCode((3&i)<<6|o)));return t},s.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},s.decodeUtf8=function(e){return decodeURIComponent(escape(e))},s.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:o.encode,decode:o.decode}},s.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},s.binary.raw.decode=function(e,t,n){var r=t;r||(r=new Uint8Array(e.length)),n=n||0;for(var i=n,o=0;o>2),n+=f.charAt((3&i)<<4|o>>4),isNaN(o)?n+="==":(n+=f.charAt((15&o)<<2|s>>6),n+=isNaN(s)?"=":f.charAt(63&s)),t&&n.length>t&&(r+=n.substr(0,t)+"\r\n",n=n.substr(t));return r+=n,r},s.binary.base64.decode=function(e,t,n){var r=t,i,o,s,a;r||(r=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),n=n||0;for(var u=0,l=n;u>4,64!==s&&(r[l++]=(15&o)<<4|s>>2,64!==a&&(r[l++]=(3&s)<<6|a));return t?l-n:r.subarray(0,l)},s.binary.base58.encode=function(e,t){return s.binary.baseN.encode(e,p,t)},s.binary.base58.decode=function(e,t){return s.binary.baseN.decode(e,p,t)},s.text={utf8:{},utf16:{}},s.text.utf8.encode=function(e,t,n){e=s.encodeUtf8(e);var r=t;r||(r=new Uint8Array(e.length)),n=n||0;for(var i=n,o=0;o0?(o=n[r].substring(0,i),s=n[r].substring(i+1)):(o=n[r],s=null),o in t||(t[o]=[]),o in Object.prototype||null===s||t[o].push(unescape(s))}return t},n;return void 0===e?(null===_&&(_="undefined"!=typeof window&&window.location&&window.location.search?t(window.location.search.substring(1)):{}),n=_):n=t(e),n},s.parseFragment=function(e){var t=e,n="",r=e.indexOf("?");r>0&&(t=e.substring(0,r),n=e.substring(r+1));var i=t.split("/");i.length>0&&""===i[0]&&i.shift();var o=""===n?{}:s.getQueryVariables(n);return{pathString:t,queryString:n,path:i,query:o}},s.makeRequest=function(e){var t=s.parseFragment(e),n={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,n){var r;return void 0===e?r=t.query:(r=t.query[e],r&&void 0!==n&&(r=r[n])),r},getQueryLast:function(e,t){var r,i=n.getQuery(e);return r=i?i[i.length-1]:t,r}};return n},s.makeLink=function(e,t,n){e=jQuery.isArray(e)?e.join("/"):e;var r=jQuery.param(t||{});return n=n||"",e+(r.length>0?"?"+r:"")+(n.length>0?"#"+n:"")},s.setPath=function(e,t,n){if("object"==typeof e&&null!==e)for(var r=0,i=t.length;r0&&o.push(r),s=t.lastIndex;var a=n[0][1];switch(a){case"s":case"o":i");break;case"%":o.push("%");break;default:o.push("<%"+a+"?>")}}return o.push(e.substring(s)),o.join("")},s.formatNumber=function(e,t,n,r){var i=e,o=isNaN(t=Math.abs(t))?2:t,s=void 0===n?",":n,a=void 0===r?".":r,u=i<0?"-":"",l=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",c=l.length>3?l.length%3:0;return u+(c?l.substr(0,c)+a:"")+l.substr(c).replace(/(\d{3})(?=\d)/g,"$1"+a)+(o?s+Math.abs(i-l).toFixed(o).slice(2):"")},s.formatSize=function(e){return e=e>=1073741824?s.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?s.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?s.formatNumber(e/1024,0)+" KiB":s.formatNumber(e,0)+" bytes",e},s.bytesFromIP=function(e){return-1!==e.indexOf(".")?s.bytesFromIPv4(e):-1!==e.indexOf(":")?s.bytesFromIPv6(e):null},s.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=s.createBuffer(),n=0;nn[r].end-n[r].start&&(r=n.length-1)):n.push({start:u,end:u})}t.push(o)}if(n.length>0){var l=n[r];l.end-l.start>0&&(t.splice(l.start,l.end-l.start+1,""),0===l.start&&t.unshift(""),7===l.end&&t.push(""))}return t.join(":")},s.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in s&&!e.update)return t(null,s.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return s.cores=navigator.hardwareConcurrency,t(null,s.cores);if("undefined"==typeof Worker)return s.cores=1,t(null,s.cores);if("undefined"==typeof Blob)return s.cores=2,t(null,s.cores);var n=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){for(var t=Date.now(),n=t+4;Date.now()a.st&&i.sti.st&&a.st 3 bytes.");let s=o.decode(r);if(!t.isValidCode(s))throw new Error(`multihash unknown function code: 0x${s.toString(16)}`);r=r.slice(o.decode.bytes);let a=o.decode(r);if(a<1)throw new Error(`multihash invalid length: 0x${a.toString(16)}`);if(r=r.slice(o.decode.bytes),r.length!==a)throw new Error(`multihash length inconsistent: 0x${r.toString("hex")}`);return{code:s,name:i.codes[s],length:a,digest:r}},t.encode=function n(r,i,s){if(!r||!i)throw new Error("multihash encode requires at least two args: digest, code");const a=t.coerceCode(i);if(!e.isBuffer(r))throw new Error("digest should be a Buffer");if(null==s&&(s=r.length),s&&r.length!==s)throw new Error("digest length should be equal to specified length.");return e.concat([e.from(o.encode(a)),e.from(o.encode(s)),r])},t.coerceCode=function e(n){let r=n;if("string"==typeof n){if(!i.names[n])throw new Error(`Unrecognized hash function named: ${n}`);r=i.names[n]}if("number"!=typeof r)throw new Error(`Hash function code should be a number. Got: ${r}`);if(!i.codes[r]&&!t.isAppCode(r))throw new Error(`Unrecognized function code: ${r}`);return r},t.isAppCode=function e(t){return t>0&&t<16},t.isValidCode=function e(n){return!!t.isAppCode(n)||!!i.codes[n]},t.validate=s,t.prefix=function e(t){return s(t),t.slice(0,2)}}).call(this,n(0).Buffer)},function(e){e.exports={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_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY: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}},function(e,t,n){"use strict";var r=n(222);e.exports=function e(t){return r(function(e,t){return e.push(t),e},[],t)}},function(e,t,n){"use strict";t.DAGNode=n(233),t.DAGLink=n(117),t.resolver=n(455),t.util=n(235)},function(e,t,n){e.exports={encode:n(778),decode:n(779),encodingLength:n(780)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=n(410),i=a(r),o=n(297),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,n){"use strict";var r=n(17),i=function e(t){return!!r.isString(t)&&/^[0-9a-fA-F]+$/.test(t)};e.exports={isValidJSON:function e(t){var n;if(!r.isString(t))return!1;try{n=JSON.parse(t)}catch(e){return!1}return"object"==typeof n},isHexa:i,isHexaString:i,cloneArray:function(e){return[].concat(e)},defineImmutable:function e(t,n){return Object.keys(n).forEach(function(e){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,value:n[e]})}),t},isNaturalNumber:function e(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t&&t>=0}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAsync=void 0;var r=n(216),i=o(r);function o(e){return e&&e.__esModule?e:{default:e}}var s="function"==typeof Symbol;function a(e){return s&&"AsyncFunction"===e[Symbol.toStringTag]}function u(e){return a(e)?(0,i.default)(e):e}t.default=u,t.isAsync=a},function(e,t,n){"use strict";var r=n(405);e.exports=function e(t,n){if(!t)return function(e,t){return e?r(t,e,n):t(!0)};Array.isArray(t)||(t=Object.keys(t).map(function(e){return t[e]}));var i=0;return function(e,o){if(e)return r(o,e,n);i>=t.length?o(!0):o(null,t[i++])}}},function(e,t,n){"use strict";const r=n(23),{ensureMultiaddr:i}=n(476),o=n(943),s=n(18);class a{constructor(e){s(e,"Missing peerId. Use Peer.create(cb) to create one"),this.id=e,this.multiaddrs=new o,this.protocols=new Set,this._connectedMultiaddr=void 0}connect(e){if(e=i(e),!this.multiaddrs.has(e)&&e.toString()!==`/ipfs/${this.id.toB58String()}`)throw new Error("can't be connected to missing multiaddr from set");this._connectedMultiaddr=e}disconnect(){this._connectedMultiaddr=void 0}isConnected(){return this._connectedMultiaddr}}a.create=((e,t)=>{if("function"==typeof e)return t=e,e=null,void r.create((e,n)=>{if(e)return t(e);t(null,new a(n))});"function"==typeof e.toJSON?t(null,new a(e)):r.createFromJSON(e,(e,n)=>t(e,new a(n)))}),a.isPeerInfo=(e=>Boolean("object"==typeof e&&e.id&&e.multiaddrs)),e.exports=a},function(e,t,n){var r=n(578),i=n(348),o=r.tfJSON,s=r.TfTypeError,a=r.TfPropertyTypeError,u=r.tfSubError,l=r.getValueTypeName,c={arrayOf:function e(t,n){function r(e,r){return!!i.Array(e)&&(!i.Nil(e)&&(!(void 0!==n.minLength&&e.lengthn.maxLength)&&((void 0===n.length||e.length===n.length)&&e.every(function(e,n){try{return h(t,e,r)}catch(e){throw u(e,n)}})))))}return t=f(t),n=n||{},r.toJSON=function(){var e="["+o(t)+"]";return void 0!==n.length?e+="{"+n.length+"}":void 0===n.minLength&&void 0===n.maxLength||(e+="{"+(void 0===n.minLength?0:n.minLength)+","+(void 0===n.maxLength?1/0:n.maxLength)+"}"),e},r},maybe:function e(t){function n(n,r){return i.Nil(n)||t(n,r,e)}return t=f(t),n.toJSON=function(){return"?"+o(t)},n},map:function e(t,n){function r(e,r){if(!i.Object(e))return!1;if(i.Nil(e))return!1;for(var o in e){try{n&&h(n,o,r)}catch(e){throw u(e,o,"key")}try{var s=e[o];h(t,s,r)}catch(e){throw u(e,o)}}return!0}return t=f(t),n&&(n=f(n)),r.toJSON=n?function(){return"{"+o(n)+": "+o(t)+"}"}:function(){return"{"+o(t)+"}"},r},object:function e(t){var n={};for(var r in t)n[r]=f(t[r]);function s(e,t){if(!i.Object(e))return!1;if(i.Nil(e))return!1;var r;try{for(r in n){var o=n[r],s=e[r];h(o,s,t)}}catch(e){throw u(e,r)}if(t)for(r in e)if(!n[r])throw new a(void 0,r);return!0}return s.toJSON=function(){return o(n)},s},anyOf:function e(){var t=[].slice.call(arguments).map(f);function n(e,n){return t.some(function(t){try{return h(t,e,n)}catch(e){return!1}})}return n.toJSON=function(){return t.map(o).join("|")},n},allOf:function e(){var t=[].slice.call(arguments).map(f);function n(e,n){return t.every(function(t){try{return h(t,e,n)}catch(e){return!1}})}return n.toJSON=function(){return t.map(o).join(" & ")},n},quacksLike:function e(t){function n(e){return t===l(e)}return n.toJSON=function(){return t},n},tuple:function e(){var t=[].slice.call(arguments).map(f);function n(e,n){return!i.Nil(e)&&(!i.Nil(e.length)&&((!n||e.length===t.length)&&t.every(function(t,r){try{return h(t,e[r],n)}catch(e){throw u(e,r)}})))}return n.toJSON=function(){return"("+t.map(o).join(", ")+")"},n},value:function e(t){function n(e){return e===t}return n.toJSON=function(){return t},n}};function f(e){if(i.String(e))return"?"===e[0]?c.maybe(e.slice(1)):i[e]||c.quacksLike(e);if(e&&i.Object(e)){if(i.Array(e)){if(1!==e.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return c.arrayOf(e[0])}return c.object(e)}return i.Function(e)?e:c.value(e)}function h(e,t,n,r){if(i.Function(e)){if(e(t,n))return!0;throw new s(r||e,t)}return h(f(e),t,n)}for(var p in c.oneOf=c.anyOf,i)h[p]=i[p];for(p in c)h[p]=c[p];var d=n(1353);for(p in d)h[p]=d[p];h.compile=f,h.TfTypeError=s,h.TfPropertyTypeError=a,e.exports=h},function(e,t,n){(function(t){e.exports=g;var r=n(27),i=n(55),o=n(15),s=n(207),a=n(102),u=n(379).DiffieHellman,l=n(97),c=n(47),f=n(50),h;try{h=n(712)}catch(e){}var p=l.InvalidAlgorithmError,d=l.KeyParseError,m={};function g(e){r.object(e,"options"),r.arrayOfObject(e.parts,"options.parts"),r.string(e.type,"options.type"),r.optionalString(e.comment,"options.comment");var t=i.info[e.type];if("object"!=typeof t)throw new p(e.type);for(var n={},o=0,s;o1024&&(e="sha256"),"ed25519"===this.type&&(e="sha512"),"ecdsa"===this.type&&(e=this.size<=256?"sha256":this.size<=384?"sha384":"sha512"),e},g.prototype.createVerify=function(e){if(void 0===e&&(e=this.defaultHashAlgorithm()),r.string(e,"hash algorithm"),"ed25519"===this.type&&void 0!==h)return new h.Verifier(this,e);if("curve25519"===this.type)throw new Error("Curve25519 keys are not suitable for signing or verification");var n,i,s;try{i=e.toUpperCase(),n=o.createVerify(i)}catch(e){s=e}(void 0===n||s instanceof Error&&s.message.match(/Unknown message digest/))&&(i="RSA-",i+=e.toUpperCase(),n=o.createVerify(i)),r.ok(n,"failed to create verifier");var u=n.verify.bind(n),l=this.toBuffer("pkcs8"),c=this.curve,f=this;return n.verify=function(n,r){if(a.isSignature(n,[2,0]))return n.type===f.type&&((!n.hashAlgorithm||n.hashAlgorithm===e)&&((!n.curve||"ecdsa"!==f.type||n.curve===c)&&u(l,n.toBuffer("asn1"))));if("string"==typeof n||t.isBuffer(n))return u(l,n,r);throw a.isSignature(n,[1,0])?new Error("signature was created by too old a version of sshpk and cannot be verified"):new TypeError("signature must be a string, Buffer, or Signature object")},n},g.prototype.createDiffieHellman=function(){if("rsa"===this.type)throw new Error("RSA keys do not support Diffie-Hellman");return new u(this)},g.prototype.createDH=g.prototype.createDiffieHellman,g.parse=function(e,t,n){"string"!=typeof e&&r.buffer(e,"data"),void 0===t&&(t="auto"),r.string(t,"format"),"string"==typeof n&&(n={filename:n}),r.optionalObject(n,"options"),void 0===n&&(n={}),r.optionalString(n.filename,"options.filename"),void 0===n.filename&&(n.filename="(unnamed)"),r.object(m[t],"formats[format]");try{var i=m[t].read(e,n);return i instanceof f&&(i=i.toPublic()),i.comment||(i.comment=n.filename),i}catch(e){if("KeyEncryptedError"===e.name)throw e;throw new d(n.filename,t,e)}},g.isKey=function(e,t){return c.isCompatible(e,g,t)},g.prototype._sshpkApiVersion=[1,7],g._oldVersionDetect=function(e){return r.func(e.toBuffer),r.func(e.fingerprint),e.createDH?[1,4]:e.defaultHashAlgorithm?[1,3]:e.formats.auto?[1,2]:e.formats.pkcs1?[1,1]:[1,0]}}).call(this,n(0).Buffer)},function(e,t,n){e.exports={bufferSplit:_,addRSAMissing:P,calculateDSAPublic:T,calculateED25519Public:j,calculateX25519Public:O,mpNormalize:x,mpDenormalize:C,ecNormalize:k,countZeros:w,assertCompatible:m,isCompatible:d,opensslKeyDeriv:b,opensshCipherInfo:R,publicFromPrivateECDSA:B,zeroPadToLength:A,writeBitString:E,readBitString:S,pbkdf2:v};var r=n(27),i=n(31).Buffer,o=n(50),s=n(46),a=n(15),u=n(55),l=n(103),c=n(286),f=n(208).BigInteger,h=n(209),p=3;function d(e,t,n){if(null===e||"object"!=typeof e)return!1;if(void 0===n&&(n=t.prototype._sshpkApiVersion),e instanceof t&&t.prototype._sshpkApiVersion[0]==n[0])return!0;for(var r=Object.getPrototypeOf(e),i=0;r.constructor.name!==t.name;)if(r=Object.getPrototypeOf(r),!r||++i>p)return!1;if(r.constructor.name!==t.name)return!1;var o=r._sshpkApiVersion;return void 0===o&&(o=t._oldVersionDetect(e)),!(o[0]!=n[0]||o[1]=n[1],i+" must be compatible with "+t.name+" klass version "+n[0]+"."+n[1])}}var g={"des-ede3-cbc":{key:24,iv:8},"aes-128-cbc":{key:16,iv:16},"aes-256-cbc":{key:32,iv:16}},y=8;function b(e,t,n,o){r.buffer(t,"salt"),r.buffer(n,"passphrase"),r.number(o,"iteration count");var s=g[e],u,l,c;r.object(s,"supported cipher"),t=t.slice(0,y);for(var f=i.alloc(0);f.length=t.length){var a=s+1;n.push(e.slice(i,a-o)),i=a,o=0}return i<=e.length&&n.push(e.slice(i,e.length)),n}function k(e,t){if(r.buffer(e),0===e[0]&&4===e[1])return t?e:e.slice(1);if(4===e[0]){if(!t)return e}else{for(;0===e[0];)e=e.slice(1);if(2===e[0]||3===e[0])throw new Error("Compressed elliptic curve points are not supported");if(4!==e[0])throw new Error("Not a valid elliptic curve point");if(!t)return e}var n=i.alloc(e.length+1);return n[0]=0,e.copy(n,1),n}function S(e,t){void 0===t&&(t=l.Ber.BitString);var n=e.readString(t,!0);return r.strictEqual(n[0],0,"bit strings with unused bits are not supported (0x"+n[0].toString(16)+")"),n.slice(1)}function E(e,t,n){void 0===n&&(n=l.Ber.BitString);var r=i.alloc(t.length+1);r[0]=0,t.copy(r,1),e.writeBuffer(r,n)}function x(e){for(r.buffer(e);e.length>1&&0===e[0]&&0==(128&e[1]);)e=e.slice(1);if(128==(128&e[0])){var t=i.alloc(e.length+1);t[0]=0,e.copy(t,1),e=t}return e}function C(e){for(r.buffer(e);e.length>1&&0===e[0];)e=e.slice(1);return e}function A(e,t){for(r.buffer(e),r.number(t);e.length>t;)r.equal(e[0],0),e=e.slice(1);for(;e.length{this.blockSizes.push(e)}),this.removeBlockSize=(e=>{this.blockSizes.splice(e,1)}),this.fileSize=(()=>{if(a.indexOf(this.type)>=0)return;let e=0;return this.blockSizes.forEach(t=>{e+=t}),t&&(e+=t.length),e}),this.marshal=(()=>{let e;switch(this.type){case"raw":e=o.DataType.Raw;break;case"directory":e=o.DataType.Directory;break;case"file":e=o.DataType.File;break;case"metadata":e=o.DataType.Metadata;break;case"symlink":e=o.DataType.Symlink;break;case"hamt-sharded-directory":e=o.DataType.HAMTShard;break;default:throw new Error(`Unkown type: "${this.type}"`)}let t=this.fileSize(),n=this.data;this.data&&this.data.length||(n=void 0);let r=this.blockSizes;return this.blockSizes&&this.blockSizes.length||(r=void 0),o.encode({Type:e,Data:n,filesize:t,blocksizes:r,hashType:this.hashType,fanout:this.fanout})})}u.unmarshal=(e=>{const t=o.decode(e);t.Data||(t.Data=void 0);const n=new u(s[t.Type],t.Data);return n.blockSizes=t.blocksizes,n}),t=e.exports=u},function(e,t,n){"use strict";(function(t){var r=n(597),i=n(25),o=n(17),s=function(e){for(var n=new t(e.length),r=0;re.size?n=r.trim(n,o):o0&&0==(127&e[e.length-1])&&(e.length<=1||0==(128&e[e.length-2])))throw new Error("non-minimally encoded script number");return r.fromSM(e,{endian:"little"})},r.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},r.prototype.gt=function(e){return this.cmp(e)>0},r.prototype.gte=function(e){return this.cmp(e)>=0},r.prototype.lt=function(e){return this.cmp(e)<0},r.trim=function(e,t){return e.slice(t-e.length,e.length)},r.pad=function(e,n,r){for(var i=new t(r),o=0;o!(!e||!e[r])),i}function i(e,{className:t,symbolName:n,withoutNew:r}){const i=Symbol.for(n),o={[t]:function(...t){if(r&&!(this instanceof o))return new o(...t);const n=e.call(this,...t)||this;return n&&!n[i]&&Object.defineProperty(n,i,{value:!0}),n}}[t];return o.prototype=Object.create(e.prototype),o.prototype.constructor=o,Object.defineProperty(o.prototype,Symbol.toStringTag,{get:()=>t}),o[`is${t}`]=(e=>!(!e||!e[i])),o}e.exports=r,e.exports.proto=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=n(218),i=a(r),o=n(410),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,n){var r=n(31).Buffer,i={dsa:{parts:["p","q","g","y"],sizePart:"p"},rsa:{parts:["e","n"],sizePart:"n"},ecdsa:{parts:["curve","Q"],sizePart:"Q"},ed25519:{parts:["A"],sizePart:"A"}};i.curve25519=i.ed25519;var o={dsa:{parts:["p","q","g","y","x"]},rsa:{parts:["n","e","d","iqmp","p","q"]},ecdsa:{parts:["curve","Q","d"]},ed25519:{parts:["A","k"]}};o.curve25519=o.ed25519;var s={md5:!0,sha1:!0,sha256:!0,sha384:!0,sha512:!0},a={nistp256:{size:256,pkcs8oid:"1.2.840.10045.3.1.7",p:r.from("00ffffffff 00000001 00000000 0000000000000000 ffffffff ffffffff ffffffff".replace(/ /g,""),"hex"),a:r.from("00FFFFFFFF 00000001 00000000 0000000000000000 FFFFFFFF FFFFFFFF FFFFFFFC".replace(/ /g,""),"hex"),b:r.from("5ac635d8 aa3a93e7 b3ebbd55 769886bc651d06b0 cc53b0f6 3bce3c3e 27d2604b".replace(/ /g,""),"hex"),s:r.from("00c49d3608 86e70493 6a6678e1 139d26b7819f7e90".replace(/ /g,""),"hex"),n:r.from("00ffffffff 00000000 ffffffff ffffffffbce6faad a7179e84 f3b9cac2 fc632551".replace(/ /g,""),"hex"),G:r.from("046b17d1f2 e12c4247 f8bce6e5 63a440f277037d81 2deb33a0 f4a13945 d898c2964fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e162bce3357 6b315ece cbb64068 37bf51f5".replace(/ /g,""),"hex")},nistp384:{size:384,pkcs8oid:"1.3.132.0.34",p:r.from("00ffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff fffffffeffffffff 00000000 00000000 ffffffff".replace(/ /g,""),"hex"),a:r.from("00FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFEFFFFFFFF 00000000 00000000 FFFFFFFC".replace(/ /g,""),"hex"),b:r.from("b3312fa7 e23ee7e4 988e056b e3f82d19181d9c6e fe814112 0314088f 5013875ac656398d 8a2ed19d 2a85c8ed d3ec2aef".replace(/ /g,""),"hex"),s:r.from("00a335926a a319a27a 1d00896a 6773a4827acdac73".replace(/ /g,""),"hex"),n:r.from("00ffffffff ffffffff ffffffff ffffffffffffffff ffffffff c7634d81 f4372ddf581a0db2 48b0a77a ecec196a ccc52973".replace(/ /g,""),"hex"),G:r.from("04aa87ca22 be8b0537 8eb1c71e f320ad746e1d3b62 8ba79b98 59f741e0 82542a385502f25d bf55296c 3a545e38 72760ab73617de4a 96262c6f 5d9e98bf 9292dc29f8f41dbd 289a147c e9da3113 b5f0b8c00a60b1ce 1d7e819d 7a431d7c 90ea0e5f".replace(/ /g,""),"hex")},nistp521:{size:521,pkcs8oid:"1.3.132.0.35",p:r.from("01ffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffffffff".replace(/ /g,""),"hex"),a:r.from("01FFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFC".replace(/ /g,""),"hex"),b:r.from("51953eb961 8e1c9a1f 929a21a0 b68540eea2da725b 99b315f3 b8b48991 8ef109e156193951 ec7e937b 1652c0bd 3bb1bf073573df88 3d2c34f1 ef451fd4 6b503f00".replace(/ /g,""),"hex"),s:r.from("00d09e8800 291cb853 96cc6717 393284aaa0da64ba".replace(/ /g,""),"hex"),n:r.from("01ffffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff fffffffa51868783 bf2f966b 7fcc0148 f709a5d03bb5c9b8 899c47ae bb6fb71e 91386409".replace(/ /g,""),"hex"),G:r.from("0400c6 858e06b7 0404e9cd 9e3ecb66 2395b4429c648139 053fb521 f828af60 6b4d3dbaa14b5e77 efe75928 fe1dc127 a2ffa8de3348b3c1 856a429b f97e7e31 c2e5bd660118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd998f54449 579b4468 17afbd17 273e662c97ee7299 5ef42640 c550b901 3fad0761353c7086 a272c240 88be9476 9fd16650".replace(/ /g,""),"hex")}};e.exports={info:i,privInfo:o,hashAlgs:s,curves:a}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var r=n(218),i=l(r),o=n(394),s=l(o),a=n(42),u=l(a);function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t,n){(0,i.default)(e,(0,s.default)((0,u.default)(t)),n)}e.exports=t.default},function(e,t,n){e.exports=o;var r=n(6).EventEmitter,i=n(1);function o(){r.call(this)}i(o,r),o.Readable=n(302),o.Writable=n(851),o.Duplex=n(852),o.Transform=n(853),o.PassThrough=n(854),o.Stream=o,o.prototype.pipe=function(e,t){var n=this;function i(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(n.on("end",a),n.on("close",u));var s=!1;function a(){s||(s=!0,e.end())}function u(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function l(e){if(c(),0===r.listenerCount(this,"error"))throw e}function c(){n.removeListener("data",i),e.removeListener("drain",o),n.removeListener("end",a),n.removeListener("close",u),n.removeListener("error",l),e.removeListener("error",l),n.removeListener("end",c),n.removeListener("close",c),e.removeListener("close",c)}return n.on("error",l),e.on("error",l),n.on("end",c),n.on("close",c),e.on("close",c),e.emit("pipe",n),e}},function(e,t,n){"use strict";(function(t){const r=n(35),i=n(864);function o(e,t,n,i){if("function"==typeof n&&(i=n,n=void 0),!i)throw new Error("Missing callback");o.digest(e,t,n,(e,o)=>{if(e)return i(e);i(null,r.encode(o,t,n))})}e.exports=o,o.Buffer=t,o.multihash=r,o.digest=function(e,t,n,r){if("function"==typeof n&&(r=n,n=void 0),!r)throw new Error("Missing callback");let i=r,s;n&&(i=((e,t)=>{if(e)return r(e);r(null,t.slice(0,n))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=r.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var r=n(28),i=n(255),o=n(1109),s=function(){},a=/^v?\.0/.test(t.version),u=function(e){return"function"==typeof e},l=function(e){return!!a&&(!!o&&((e instanceof(o.ReadStream||s)||e instanceof(o.WriteStream||s))&&u(e.close)))},c=function(e){return e.setHeader&&u(e.abort)},f=function(e,t,n,o){o=r(o);var a=!1;e.on("close",function(){a=!0}),i(e,{readable:t,writable:n},function(e){if(e)return o(e);a=!0,o()});var f=!1;return function(t){if(!a&&!f)return f=!0,l(e)?e.close(s):c(e)?e.abort():u(e.destroy)?e.destroy():void o(t||new Error("stream was destroyed"))}},h=function(e){e()},p=function(e,t){return e.pipe(t)},d=function(){var e=Array.prototype.slice.call(arguments),t=u(e[e.length-1]||s)&&e.pop()||s,n;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Error("pump requires two streams per minimum");var r=e.map(function(i,o){var s=o0;return f(i,s,a,function(e){n||(n=e),e&&r.forEach(h),s||(r.forEach(h),t(n))})});return e.reduce(p)};e.exports=d}).call(this,n(2))},function(e,t,n){"use strict";(function(t){var r=n(15),i=n(30),o=n(25),s=e.exports;s.sha1=function(e){return o.checkArgument(i.isBuffer(e)),r.createHash("sha1").update(e).digest()},s.sha1.blocksize=512,s.sha256=function(e){return o.checkArgument(i.isBuffer(e)),r.createHash("sha256").update(e).digest()},s.sha256.blocksize=512,s.sha256sha256=function(e){return o.checkArgument(i.isBuffer(e)),s.sha256(s.sha256(e))},s.ripemd160=function(e){return o.checkArgument(i.isBuffer(e)),r.createHash("ripemd160").update(e).digest()},s.sha256ripemd160=function(e){return o.checkArgument(i.isBuffer(e)),s.ripemd160(s.sha256(e))},s.sha512=function(e){return o.checkArgument(i.isBuffer(e)),r.createHash("sha512").update(e).digest()},s.sha512.blocksize=1024,s.hmac=function(e,n,r){o.checkArgument(i.isBuffer(n)),o.checkArgument(i.isBuffer(r)),o.checkArgument(e.blocksize);var s=e.blocksize/8;if(r.length>s)r=e(r);else if(r=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e){"string"!=typeof e&&(e+="");var t=0,n=-1,r=!0,i;for(i=e.length-1;i>=0;--i)if(47===e.charCodeAt(i)){if(!r){t=i+1;break}}else-1===n&&(r=!1,n=i+1);return-1===n?"":e.slice(t,n)}function i(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!r;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,r="/"===s.charAt(0))}return t=n(i(t.split("/"),function(e){return!!e}),!r).join("/"),(r?"/":"")+t||"."},t.normalize=function(e){var r=t.isAbsolute(e),s="/"===o(e,-1);return e=n(i(e.split("/"),function(e){return!!e}),!r).join("/"),e||r||(e="."),e&&s&&(e+="/"),(r?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(i(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,n){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var i=r(e.split("/")),o=r(n.split("/")),s=Math.min(i.length,o.length),a=s,u=0;u=1;--o)if(t=e.charCodeAt(o),47===t){if(!i){r=o;break}}else i=!1;return-1===r?n?"/":".":n&&1===r?"/":e.slice(0,r)},t.basename=function(e,t){var n=r(e);return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,n=0,r=-1,i=!0,o=0,s=e.length-1;s>=0;--s){var a=e.charCodeAt(s);if(47!==a)-1===r&&(i=!1,r=s+1),46===a?-1===t?t=s:1!==o&&(o=1):-1!==t&&(o=-1);else if(!i){n=s+1;break}}return-1===t||-1===r||0===o||1===o&&t===r-1&&t===n+1?"":e.slice(t,r)};var o="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}}).call(this,n(2))},function(e,t,n){var r;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,u=Math.ceil,l=Math.floor,c="[BigNumber Error] ",f=c+"Number primitive has more than 15 significant digits: ",h=1e14,p=14,d=9007199254740991,m=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,y=1e9;function b(e){var t,n,r,i=H.prototype={constructor:H,toString:null,valueOf:null},o=new H(1),C=20,A=4,I=-7,T=21,j=-1e7,O=1e7,P=!1,B=1,R=0,N={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},M="0123456789abcdefghijklmnopqrstuvwxyz",L,F,D,U,z,q,K;function H(e,t){var i,o,a,u,c,h,m,g,y=this;if(!(y instanceof H))return new H(e,t);if(null==t){if(e&&!0===e._isBigNumber)return y.s=e.s,void(!e.c||e.e>O?y.c=y.e=null:e.e=10;c/=10,u++);return void(u>O?y.c=y.e=null:(y.e=u,y.c=[e]))}g=String(e)}else{if(!s.test(g=String(e)))return r(y,g,h);y.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(u=g.indexOf("."))>-1&&(g=g.replace(".","")),(c=g.search(/e/i))>0?(u<0&&(u=c),u+=+g.slice(c+1),g=g.substring(0,c)):u<0&&(u=g.length)}else{if(k(t,2,M.length,"Base"),10==t)return y=new H(e),G(y,C+y.e+1,A);if(g=String(e),h="number"==typeof e){if(0*e!=0)return r(y,g,h,t);if(y.s=1/e<0?(g=g.slice(1),-1):1,H.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(f+e)}else y.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(i=M.slice(0,t),u=c=0,m=g.length;cu){u=m;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,c=-1,u=0;continue}return r(y,String(e),h,t)}h=!1,g=n(g,t,10,y.s),(u=g.indexOf("."))>-1?g=g.replace(".",""):u=g.length}for(c=0;48===g.charCodeAt(c);c++);for(m=g.length;48===g.charCodeAt(--m););if(g=g.slice(c,++m)){if(m-=c,h&&H.DEBUG&&m>15&&(e>d||e!==l(e)))throw Error(f+y.s*e);if((u=u-c-1)>O)y.c=y.e=null;else if(u=T)?E(u,s):x(u,s,"0");else if(e=G(new H(e),t,n),o=e.e,u=w(e.c),a=u.length,1==r||2==r&&(t<=o||o<=I)){for(;aa){if(--t>0)for(u+=".";t--;u+="0");}else if(t+=o-a,t>0)for(o+1==a&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function W(e,t){for(var n,r=1,i=new H(e[0]);r=10;i/=10,r++);return(n=r+n*p-1)>O?e.c=e.e=null:n=10;a/=10,i++);if(o=t-i,o<0)o+=p,s=t,c=g[f=0],d=c/y[i-s-1]%10|0;else if(f=u((o+1)/p),f>=g.length){if(!r)break e;for(;g.length<=f;g.push(0));c=d=0,i=1,o%=p,s=o-p+1}else{for(c=a=g[f],i=1;a>=10;a/=10,i++);o%=p,s=o-p+i,d=s<0?0:c/y[i-s-1]%10|0}if(r=r||t<0||null!=g[f+1]||(s<0?c:c%y[i-s-1]),r=n<4?(d||r)&&(0==n||n==(e.s<0?3:2)):d>5||5==d&&(4==n||r||6==n&&(o>0?s>0?c/y[i-s]:0:g[f-1])%10&1||n==(e.s<0?8:7)),t<1||!g[0])return g.length=0,r?(t-=e.e+1,g[0]=y[(p-t%p)%p],e.e=-t||0):g[0]=e.e=0,e;if(0==o?(g.length=f,a=1,f--):(g.length=f+1,a=y[p-o],g[f]=s>0?l(c/y[i-s]%y[s])*a:0),r)for(;;){if(0==f){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=a,a=1;s>=10;s/=10,a++);o!=a&&(e.e++,g[0]==h&&(g[0]=1));break}if(g[f]+=a,g[f]!=h)break;g[f--]=0,a=1}for(o=g.length;0===g[--o];g.pop());}e.e>O?e.c=e.e=null:e.e=T?E(t,n):x(t,n,"0"),e.s<0?"-"+t:t)}return H.clone=b,H.ROUND_UP=0,H.ROUND_DOWN=1,H.ROUND_CEIL=2,H.ROUND_FLOOR=3,H.ROUND_HALF_UP=4,H.ROUND_HALF_DOWN=5,H.ROUND_HALF_EVEN=6,H.ROUND_HALF_CEIL=7,H.ROUND_HALF_FLOOR=8,H.EUCLID=9,H.config=H.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(c+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(n=e[t],k(n,0,y,t),C=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(n=e[t],k(n,0,8,t),A=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&(n=e[t],n&&n.pop?(k(n[0],-y,0,t),k(n[1],0,y,t),I=n[0],T=n[1]):(k(n,-y,y,t),I=-(T=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if(n=e[t],n&&n.pop)k(n[0],-y,-1,t),k(n[1],1,y,t),j=n[0],O=n[1];else{if(k(n,-y,y,t),!n)throw Error(c+t+" cannot be zero: "+n);j=-(O=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if(n=e[t],n!==!!n)throw Error(c+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw P=!n,Error(c+"crypto unavailable");P=n}else P=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(n=e[t],k(n,0,9,t),B=n),e.hasOwnProperty(t="POW_PRECISION")&&(n=e[t],k(n,0,y,t),R=n),e.hasOwnProperty(t="FORMAT")){if(n=e[t],"object"!=typeof n)throw Error(c+t+" not an object: "+n);N=n}if(e.hasOwnProperty(t="ALPHABET")){if(n=e[t],"string"!=typeof n||/^.$|[+-.\s]|(.).*\1/.test(n))throw Error(c+t+" invalid: "+n);M=n}}return{DECIMAL_PLACES:C,ROUNDING_MODE:A,EXPONENTIAL_AT:[I,T],RANGE:[j,O],CRYPTO:P,MODULO_MODE:B,POW_PRECISION:R,FORMAT:N,ALPHABET:M}},H.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!H.DEBUG)return!0;var t,n,r=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-y&&i<=y&&i===l(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break e}if(t=(i+1)%p,t<1&&(t+=p),String(r[0]).length==t){for(t=0;t=h||n!==l(n))break e;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(c+"Invalid BigNumber: "+e)},H.maximum=H.max=function(){return W(arguments,i.lt)},H.minimum=H.min=function(){return W(arguments,i.gt)},H.random=(L=9007199254740992,F=Math.random()*L&2097151?function(){return l(Math.random()*L)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,i,s,a=0,f=[],h=new H(o);if(null==e?e=C:k(e,0,y),i=u(e/p),P)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));a>>11),s>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[a]=n[0],t[a+1]=n[1]):(f.push(s%1e14),a+=2);a=i/2}else{if(!crypto.randomBytes)throw P=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(i*=7);a=9e15?crypto.randomBytes(7).copy(t,a):(f.push(s%1e14),a+=7);a=i/7}if(!P)for(;a=10;s/=10,a++);an-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/n|0,o[i]%=n)}return o.reverse()}return function(r,i,o,s,a){var u,l,c,f,h,p,d,m,g=r.indexOf("."),y=C,b=A;for(g>=0&&(f=R,R=0,r=r.replace(".",""),m=new H(i),p=m.pow(r.length-g),R=f,m.c=n(x(w(p.c),p.e,"0"),10,o,e),m.e=m.c.length),d=n(r,i,o,a?(u=M,e):(u=e,M)),c=f=d.length;0==d[--f];d.pop());if(!d[0])return u.charAt(0);if(g<0?--c:(p.c=d,p.e=c,p.s=s,p=t(p,m,y,b,o),d=p.c,h=p.r,c=p.e),l=c+y+1,g=d[l],f=o/2,h=h||l<0||null!=d[l+1],h=b<4?(null!=g||h)&&(0==b||b==(p.s<0?3:2)):g>f||g==f&&(4==b||h||6==b&&1&d[l-1]||b==(p.s<0?8:7)),l<1||!d[0])r=h?x(u.charAt(1),-y,u.charAt(0)):u.charAt(0);else{if(d.length=l,h)for(--o;++d[--l]>o;)d[l]=0,l||(++c,d=[1].concat(d));for(f=d.length;!d[--f];);for(g=0,r="";g<=f;r+=u.charAt(d[g++]));r=x(r,c,u.charAt(0))}return r}}(),t=function(){function e(e,t,n){var r,i,o,s,a=0,u=e.length,l=t%g,c=t/g|0;for(e=e.slice();u--;)o=e[u]%g,s=e[u]/g|0,r=c*o+s*l,i=l*o+r%g*g+a,a=(i/n|0)+(r/g|0)+c*s,e[u]=i%n;return a&&(e=[a].concat(e)),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]1;e.splice(0,1));}return function(r,i,o,s,a){var u,c,f,d,m,g,y,b,w,_,k,S,E,x,C,A,I,T=r.s==i.s?1:-1,j=r.c,O=i.c;if(!(j&&j[0]&&O&&O[0]))return new H(r.s&&i.s&&(j?!O||j[0]!=O[0]:O)?j&&0==j[0]||!O?0*T:T/0:NaN);for(b=new H(T),w=b.c=[],c=r.e-i.e,T=o+c+1,a||(a=h,c=v(r.e/p)-v(i.e/p),T=T/p|0),f=0;O[f]==(j[f]||0);f++);if(O[f]>(j[f]||0)&&c--,T<0)w.push(1),d=!0;else{for(x=j.length,A=O.length,f=0,T+=2,m=l(a/(O[0]+1)),m>1&&(O=e(O,m,a),j=e(j,m,a),A=O.length,x=j.length),E=A,_=j.slice(0,A),k=_.length;k=a/2&&C++;do{if(m=0,u=t(O,_,A,k),u<0){if(S=_[0],A!=k&&(S=S*a+(_[1]||0)),m=l(S/C),m>1)for(m>=a&&(m=a-1),g=e(O,m,a),y=g.length,k=_.length;1==t(g,_,y,k);)m--,n(g,A=10;T/=10,f++);G(b,o+(b.e=f+c*p-1)+1,s,d)}else b.e=c,b.r=+d;return b}}(),D=/^(-?)0([xbo])(?=\w[\w.]*$)/i,U=/^([^.]+)\.$/,z=/^\.([^.]+)$/,q=/^-?(Infinity|NaN)$/,K=/^\s*\+(?=[\w.])|^\s+|\s+$/g,r=function(e,t,n,r){var i,o=n?t:t.replace(K,"");if(q.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(D,function(e,t,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?e:t}),r&&(i=r,o=o.replace(U,"$1").replace(z,"0.$1")),t!=o))return new H(o,i);if(H.DEBUG)throw Error(c+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},i.absoluteValue=i.abs=function(){var e=new H(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return _(this,new H(e,t))},i.decimalPlaces=i.dp=function(e,t){var n,r,i,o=this;if(null!=e)return k(e,0,y),null==t?t=A:k(t,0,8),G(new H(o),e+o.e+1,t);if(!(n=o.c))return null;if(r=((i=n.length-1)-v(this.e/p))*p,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},i.dividedBy=i.div=function(e,n){return t(this,new H(e,n),C,A)},i.dividedToIntegerBy=i.idiv=function(e,n){return t(this,new H(e,n),0,1)},i.exponentiatedBy=i.pow=function(e,t){var n,r,i,s,a,f,h,d,m,g=this;if(e=new H(e),e.c&&!e.isInteger())throw Error(c+"Exponent not an integer: "+Y(e));if(null!=t&&(t=new H(t)),f=e.e>14,!g.c||!g.c[0]||1==g.c[0]&&!g.e&&1==g.c.length||!e.c||!e.c[0])return m=new H(Math.pow(+Y(g),f?2-S(e):+Y(e))),t?m.mod(t):m;if(h=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new H(NaN);r=!h&&g.isInteger()&&t.isInteger(),r&&(g=g.mod(t))}else{if(e.e>9&&(g.e>0||g.e<-1||(0==g.e?g.c[0]>1||f&&g.c[1]>=24e7:g.c[0]<8e13||f&&g.c[0]<=9999975e7)))return s=g.s<0&&S(e)?-0:0,g.e>-1&&(s=1/s),new H(h?1/s:s);R&&(s=u(R/p+2))}for(f?(n=new H(.5),h&&(e.s=1),d=S(e)):(i=Math.abs(+Y(e)),d=i%2),m=new H(o);;){if(d){if(m=m.times(g),!m.c)break;s?m.c.length>s&&(m.c.length=s):r&&(m=m.mod(t))}if(i){if(i=l(i/2),0===i)break;d=i%2}else if(e=e.times(n),G(e,e.e+1,1),e.e>14)d=S(e);else{if(i=+Y(e),0===i)break;d=i%2}g=g.times(g),s?g.c&&g.c.length>s&&(g.c.length=s):r&&(g=g.mod(t))}return r?m:(h&&(m=o.div(m)),t?m.mod(t):s?G(m,R,A,a):m)},i.integerValue=function(e){var t=new H(this);return null==e?e=A:k(e,0,8),G(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return 0===_(this,new H(e,t))},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return _(this,new H(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return 1===(t=_(this,new H(e,t)))||0===t},i.isInteger=function(){return!!this.c&&v(this.e/p)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return _(this,new H(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return-1===(t=_(this,new H(e,t)))||0===t},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&0==this.c[0]},i.minus=function(e,t){var n,r,i,o,s=this,a=s.s;if(e=new H(e,t),t=e.s,!a||!t)return new H(NaN);if(a!=t)return e.s=-t,s.plus(e);var u=s.e/p,l=e.e/p,c=s.c,f=e.c;if(!u||!l){if(!c||!f)return c?(e.s=-t,e):new H(f?s:NaN);if(!c[0]||!f[0])return f[0]?(e.s=-t,e):new H(c[0]?s:3==A?-0:0)}if(u=v(u),l=v(l),c=c.slice(),a=u-l){for((o=a<0)?(a=-a,i=c):(l=u,i=f),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(r=(o=(a=c.length)<(t=f.length))?a:t,a=t=0;t0)for(;t--;c[n++]=0);for(t=h-1;r>a;){if(c[--r]=0;){for(n=0,d=S[i]%w,m=S[i]/w|0,s=u,o=i+s;o>i;)l=k[--s]%w,c=k[s]/w|0,a=m*l+c*d,l=d*l+a%w*w+y[o]+n,n=(l/b|0)+(a/w|0)+m*c,y[o--]=l%b;y[o]=n}return n?++r:y.splice(0,1),$(e,y,r)},i.negated=function(){var e=new H(this);return e.s=-e.s||null,e},i.plus=function(e,t){var n,r=this,i=r.s;if(e=new H(e,t),t=e.s,!i||!t)return new H(NaN);if(i!=t)return e.s=-t,r.minus(e);var o=r.e/p,s=e.e/p,a=r.c,u=e.c;if(!o||!s){if(!a||!u)return new H(i/0);if(!a[0]||!u[0])return u[0]?e:new H(a[0]?r:0*i)}if(o=v(o),s=v(s),a=a.slice(),i=o-s){for(i>0?(s=o,n=u):(i=-i,n=a),n.reverse();i--;n.push(0));n.reverse()}for(i=a.length,t=u.length,i-t<0&&(n=u,u=a,a=n,t=i),i=0;t;)i=(a[--t]=a[t]+u[t]+i)/h|0,a[t]=h===a[t]?0:a[t]%h;return i&&(a=[i].concat(a),++s),$(e,a,s)},i.precision=i.sd=function(e,t){var n,r,i,o=this;if(null!=e&&e!==!!e)return k(e,1,y),null==t?t=A:k(t,0,8),G(new H(o),e,t);if(!(n=o.c))return null;if(i=n.length-1,r=i*p+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&o.e+1>r&&(r=o.e+1),r},i.shiftedBy=function(e){return k(e,-d,d),this.times("1e"+e)},i.squareRoot=i.sqrt=function(){var e,n,r,i,o,s=this,a=s.c,u=s.s,l=s.e,c=C+4,f=new H("0.5");if(1!==u||!a||!a[0])return new H(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);if(u=Math.sqrt(+Y(s)),0==u||u==1/0?(n=w(a),(n.length+l)%2==0&&(n+="0"),u=Math.sqrt(+n),l=v((l+1)/2)-(l<0||l%2),u==1/0?n="1e"+l:(n=u.toExponential(),n=n.slice(0,n.indexOf("e")+1)+l),r=new H(n)):r=new H(u+""),r.c[0])for(l=r.e,u=l+c,u<3&&(u=0);;)if(o=r,r=f.times(o.plus(t(s,o,c,1))),w(o.c).slice(0,u)===(n=w(r.c)).slice(0,u)){if(r.e0&&m>0){for(o=m%a||a,f=d.substr(0,o);o0&&(f+=l+d.slice(o)),p&&(f="-"+f)}r=h?f+(n.decimalSeparator||"")+((u=+n.fractionGroupSize)?h.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):h):f}return(n.prefix||"")+r+(n.suffix||"")},i.toFraction=function(e){var n,r,i,s,a,u,l,f,h,d,g,y,b=this,v=b.c;if(null!=e&&(l=new H(e),!l.isInteger()&&(l.c||1!==l.s)||l.lt(o)))throw Error(c+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+Y(l));if(!v)return new H(b);for(n=new H(o),h=r=new H(o),i=f=new H(o),y=w(v),a=n.e=y.length-b.e-1,n.c[0]=m[(u=a%p)<0?p+u:u],e=!e||l.comparedTo(n)>0?a>0?n:h:l,u=O,O=1/0,l=new H(y),f.c[0]=0;d=t(l,n,0,1),s=r.plus(d.times(i)),1!=s.comparedTo(e);)r=i,i=s,h=f.plus(d.times(s=h)),f=s,n=l.minus(d.times(s=n)),l=s;return s=t(e.minus(r),i,0,1),f=f.plus(s.times(h)),r=r.plus(s.times(i)),f.s=h.s=b.s,a*=2,g=t(h,i,a,A).minus(b).abs().comparedTo(t(f,r,a,A).minus(b).abs())<1?[h,i]:[f,r],O=u,g},i.toNumber=function(){return+Y(this)},i.toPrecision=function(e,t){return null!=e&&k(e,1,y),V(this,e,t,2)},i.toString=function(e){var t,r=this,i=r.s,o=r.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=I||o>=T?E(w(r.c),o):x(w(r.c),o,"0"):10===e?(r=G(new H(r),C+o+1,A),t=x(w(r.c),r.e,"0")):(k(e,2,M.length,"Base"),t=n(x(w(r.c),o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},i.valueOf=i.toJSON=function(){return Y(this)},i._isBigNumber=!0,a&&(i[Symbol.toStringTag]="BigNumber",i[Symbol.for("nodejs.util.inspect.custom")]=i.valueOf),null!=e&&H.set(e),H}function v(e){var t=0|e;return e>0||e===t?t:t-1}function w(e){for(var t,n,r=1,i=e.length,o=e[0]+"";rl^n?1:-1;for(a=(u=i.length)<(l=o.length)?u:l,s=0;so[s]^n?1:-1;return u==l?0:u>l^n?1:-1}function k(e,t,n,r){if(en||e!==l(e))throw Error(c+(r||"Argument")+("number"==typeof e?en?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function S(e){var t=e.c.length-1;return v(e.e/p)==t&&e.c[t]%2!=0}function E(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function x(e,t,n){var r,i;if(t<0){for(i=n+".";++t;i+=n);e=i+e}else if(r=e.length,++t>r){for(i=n,t-=r;--t;i+=n);e+=i}else t=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function u(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function e(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function e(t,n){return t.cmp(n)>0?t:n},o.min=function e(t,n){return t.cmp(n)<0?t:n},o.prototype._init=function e(t,n,i){if("number"==typeof t)return this._initNumber(t,n,i);if("object"==typeof t)return this._initArray(t,n,i);"hex"===n&&(n=16),r(n===(0|n)&&n>=2&&n<=36),t=t.toString().replace(/\s+/g,"");var o=0;"-"===t[0]&&o++,16===n?this._parseHex(t,o):this._parseBase(t,n,o),"-"===t[0]&&(this.negative=1),this.strip(),"le"===i&&this._initArray(this.toArray(),n,i)},o.prototype._initNumber=function e(t,n,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),n,i)},o.prototype._initArray=function e(t,n,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var o=0;o=0;o-=3)a=t[o]|t[o-1]<<8|t[o-2]<<16,this.words[s]|=a<>>26-u&67108863,u+=24,u>=26&&(u-=26,s++);else if("le"===i)for(o=0,s=0;o>>26-u&67108863,u+=24,u>=26&&(u-=26,s++);return this.strip()},o.prototype._parseHex=function e(t,n){this.length=Math.ceil((t.length-n)/6),this.words=new Array(this.length);for(var r=0;r=n;r-=6)o=a(t,r,r+6),this.words[i]|=o<>>26-s&4194303,s+=24,s>=26&&(s-=26,i++);r+6!==n&&(o=a(t,n,r+6),this.words[i]|=o<>>26-s&4194303),this.strip()},o.prototype._parseBase=function e(t,n,r){this.words=[0],this.length=1;for(var i=0,o=1;o<=67108863;o*=n)i++;i--,o=o/n|0;for(var s=t.length-r,a=s%i,l=Math.min(s,s-a)+r,c=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function e(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function e(){return(this.red?""};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(e){for(var t=new Array(e.bitLength()),n=0;n>>i}return t}function p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var l=1;l>>26,f=67108863&u,h=Math.min(l,t.length-1),p=Math.max(0,l-e.length+1);p<=h;p++){var d=l-p|0;i=0|e.words[d],o=0|t.words[p],s=i*o+f,c+=s/67108864|0,f=67108863&s}n.words[l]=0|f,u=0|c}return 0!==u?n.words[l]=0|u:n.length--,n.strip()}o.prototype.toString=function e(t,n){var i;if(t=t||10,n=0|n||1,16===t||"hex"===t){i="";for(var o=0,s=0,a=0;a>>24-o&16777215,i=0!==s||a!==this.length-1?l[6-h.length]+h+i:h+i,o+=2,o>=26&&(o-=26,a--)}for(0!==s&&(i=s.toString(16)+i);i.length%n!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var p=c[t],d=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var g=m.modn(d).toString(t);m=m.idivn(d),i=m.isZero()?g+i:l[p-g.length]+g+i}for(this.isZero()&&(i="0"+i);i.length%n!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function e(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function e(){return this.toString(16)},o.prototype.toBuffer=function e(t,n){return r(void 0!==s),this.toArrayLike(s,t,n)},o.prototype.toArray=function e(t,n){return this.toArrayLike(Array,t,n)},o.prototype.toArrayLike=function e(t,n,i){var o=this.byteLength(),s=i||Math.max(1,o);r(o<=s,"byte array longer than desired length"),r(s>0,"Requested array length <= 0"),this.strip();var a="le"===n,u=new t(s),l,c,f=this.clone();if(a){for(c=0;!f.isZero();c++)l=f.andln(255),f.iushrn(8),u[c]=l;for(;c=4096&&(r+=13,n>>>=13),n>=64&&(r+=7,n>>>=7),n>=8&&(r+=4,n>>>=4),n>=2&&(r+=2,n>>>=2),r+n},o.prototype._zeroBits=function e(t){if(0===t)return 26;var n=t,r=0;return 0==(8191&n)&&(r+=13,n>>>=13),0==(127&n)&&(r+=7,n>>>=7),0==(15&n)&&(r+=4,n>>>=4),0==(3&n)&&(r+=2,n>>>=2),0==(1&n)&&r++,r},o.prototype.bitLength=function e(){var t=this.words[this.length-1],n=this._countBits(t);return 26*(this.length-1)+n},o.prototype.zeroBits=function e(){if(this.isZero())return 0;for(var t=0,n=0;nt.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function e(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function e(t){var n;n=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function e(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function e(t){var n,r;this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function e(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function e(t){r("number"==typeof t&&t>=0);var n=0|Math.ceil(t/26),i=t%26;this._expand(n),i>0&&n--;for(var o=0;o0&&(this.words[o]=~this.words[o]&67108863>>26-i),this.strip()},o.prototype.notn=function e(t){return this.clone().inotn(t)},o.prototype.setn=function e(t,n){r("number"==typeof t&&t>=0);var i=t/26|0,o=t%26;return this._expand(i+1),this.words[i]=n?this.words[i]|1<t.length?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>>26;for(;0!==o&&s>>26;if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function e(t){if(0!==t.negative){t.negative=0;var n=this.iadd(t);return t.negative=1,n._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r=this.cmp(t),i,o;if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;r>0?(i=this,o=t):(i=t,o=this);for(var s=0,a=0;a>26,this.words[a]=67108863&n;for(;0!==s&&a>26,this.words[a]=67108863&n;if(0===s&&a>>13,d=0|i[1],m=8191&d,g=d>>>13,y=0|i[2],b=8191&y,v=y>>>13,w=0|i[3],_=8191&w,k=w>>>13,S=0|i[4],E=8191&S,x=S>>>13,C=0|i[5],A=8191&C,I=C>>>13,T=0|i[6],j=8191&T,O=T>>>13,P=0|i[7],B=8191&P,R=P>>>13,N=0|i[8],M=8191&N,L=N>>>13,F=0|i[9],D=8191&F,U=F>>>13,z=0|o[0],q=8191&z,K=z>>>13,H=0|o[1],V=8191&H,W=H>>>13,$=0|o[2],G=8191&$,Y=$>>>13,J=0|o[3],Z=8191&J,Q=J>>>13,X=0|o[4],ee=8191&X,te=X>>>13,ne=0|o[5],re=8191&ne,ie=ne>>>13,oe=0|o[6],se=8191&oe,ae=oe>>>13,ue=0|o[7],le=8191&ue,ce=ue>>>13,fe=0|o[8],he=8191&fe,pe=fe>>>13,de=0|o[9],me=8191&de,ge=de>>>13;r.negative=t.negative^n.negative,r.length=19,u=Math.imul(h,q),l=Math.imul(h,K),l=l+Math.imul(p,q)|0,c=Math.imul(p,K);var ye=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(ye>>>26)|0,ye&=67108863,u=Math.imul(m,q),l=Math.imul(m,K),l=l+Math.imul(g,q)|0,c=Math.imul(g,K),u=u+Math.imul(h,V)|0,l=l+Math.imul(h,W)|0,l=l+Math.imul(p,V)|0,c=c+Math.imul(p,W)|0;var be=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(be>>>26)|0,be&=67108863,u=Math.imul(b,q),l=Math.imul(b,K),l=l+Math.imul(v,q)|0,c=Math.imul(v,K),u=u+Math.imul(m,V)|0,l=l+Math.imul(m,W)|0,l=l+Math.imul(g,V)|0,c=c+Math.imul(g,W)|0,u=u+Math.imul(h,G)|0,l=l+Math.imul(h,Y)|0,l=l+Math.imul(p,G)|0,c=c+Math.imul(p,Y)|0;var ve=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(ve>>>26)|0,ve&=67108863,u=Math.imul(_,q),l=Math.imul(_,K),l=l+Math.imul(k,q)|0,c=Math.imul(k,K),u=u+Math.imul(b,V)|0,l=l+Math.imul(b,W)|0,l=l+Math.imul(v,V)|0,c=c+Math.imul(v,W)|0,u=u+Math.imul(m,G)|0,l=l+Math.imul(m,Y)|0,l=l+Math.imul(g,G)|0,c=c+Math.imul(g,Y)|0,u=u+Math.imul(h,Z)|0,l=l+Math.imul(h,Q)|0,l=l+Math.imul(p,Z)|0,c=c+Math.imul(p,Q)|0;var we=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(we>>>26)|0,we&=67108863,u=Math.imul(E,q),l=Math.imul(E,K),l=l+Math.imul(x,q)|0,c=Math.imul(x,K),u=u+Math.imul(_,V)|0,l=l+Math.imul(_,W)|0,l=l+Math.imul(k,V)|0,c=c+Math.imul(k,W)|0,u=u+Math.imul(b,G)|0,l=l+Math.imul(b,Y)|0,l=l+Math.imul(v,G)|0,c=c+Math.imul(v,Y)|0,u=u+Math.imul(m,Z)|0,l=l+Math.imul(m,Q)|0,l=l+Math.imul(g,Z)|0,c=c+Math.imul(g,Q)|0,u=u+Math.imul(h,ee)|0,l=l+Math.imul(h,te)|0,l=l+Math.imul(p,ee)|0,c=c+Math.imul(p,te)|0;var _e=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(_e>>>26)|0,_e&=67108863,u=Math.imul(A,q),l=Math.imul(A,K),l=l+Math.imul(I,q)|0,c=Math.imul(I,K),u=u+Math.imul(E,V)|0,l=l+Math.imul(E,W)|0,l=l+Math.imul(x,V)|0,c=c+Math.imul(x,W)|0,u=u+Math.imul(_,G)|0,l=l+Math.imul(_,Y)|0,l=l+Math.imul(k,G)|0,c=c+Math.imul(k,Y)|0,u=u+Math.imul(b,Z)|0,l=l+Math.imul(b,Q)|0,l=l+Math.imul(v,Z)|0,c=c+Math.imul(v,Q)|0,u=u+Math.imul(m,ee)|0,l=l+Math.imul(m,te)|0,l=l+Math.imul(g,ee)|0,c=c+Math.imul(g,te)|0,u=u+Math.imul(h,re)|0,l=l+Math.imul(h,ie)|0,l=l+Math.imul(p,re)|0,c=c+Math.imul(p,ie)|0;var ke=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(ke>>>26)|0,ke&=67108863,u=Math.imul(j,q),l=Math.imul(j,K),l=l+Math.imul(O,q)|0,c=Math.imul(O,K),u=u+Math.imul(A,V)|0,l=l+Math.imul(A,W)|0,l=l+Math.imul(I,V)|0,c=c+Math.imul(I,W)|0,u=u+Math.imul(E,G)|0,l=l+Math.imul(E,Y)|0,l=l+Math.imul(x,G)|0,c=c+Math.imul(x,Y)|0,u=u+Math.imul(_,Z)|0,l=l+Math.imul(_,Q)|0,l=l+Math.imul(k,Z)|0,c=c+Math.imul(k,Q)|0,u=u+Math.imul(b,ee)|0,l=l+Math.imul(b,te)|0,l=l+Math.imul(v,ee)|0,c=c+Math.imul(v,te)|0,u=u+Math.imul(m,re)|0,l=l+Math.imul(m,ie)|0,l=l+Math.imul(g,re)|0,c=c+Math.imul(g,ie)|0,u=u+Math.imul(h,se)|0,l=l+Math.imul(h,ae)|0,l=l+Math.imul(p,se)|0,c=c+Math.imul(p,ae)|0;var Se=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Se>>>26)|0,Se&=67108863,u=Math.imul(B,q),l=Math.imul(B,K),l=l+Math.imul(R,q)|0,c=Math.imul(R,K),u=u+Math.imul(j,V)|0,l=l+Math.imul(j,W)|0,l=l+Math.imul(O,V)|0,c=c+Math.imul(O,W)|0,u=u+Math.imul(A,G)|0,l=l+Math.imul(A,Y)|0,l=l+Math.imul(I,G)|0,c=c+Math.imul(I,Y)|0,u=u+Math.imul(E,Z)|0,l=l+Math.imul(E,Q)|0,l=l+Math.imul(x,Z)|0,c=c+Math.imul(x,Q)|0,u=u+Math.imul(_,ee)|0,l=l+Math.imul(_,te)|0,l=l+Math.imul(k,ee)|0,c=c+Math.imul(k,te)|0,u=u+Math.imul(b,re)|0,l=l+Math.imul(b,ie)|0,l=l+Math.imul(v,re)|0,c=c+Math.imul(v,ie)|0,u=u+Math.imul(m,se)|0,l=l+Math.imul(m,ae)|0,l=l+Math.imul(g,se)|0,c=c+Math.imul(g,ae)|0,u=u+Math.imul(h,le)|0,l=l+Math.imul(h,ce)|0,l=l+Math.imul(p,le)|0,c=c+Math.imul(p,ce)|0;var Ee=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,u=Math.imul(M,q),l=Math.imul(M,K),l=l+Math.imul(L,q)|0,c=Math.imul(L,K),u=u+Math.imul(B,V)|0,l=l+Math.imul(B,W)|0,l=l+Math.imul(R,V)|0,c=c+Math.imul(R,W)|0,u=u+Math.imul(j,G)|0,l=l+Math.imul(j,Y)|0,l=l+Math.imul(O,G)|0,c=c+Math.imul(O,Y)|0,u=u+Math.imul(A,Z)|0,l=l+Math.imul(A,Q)|0,l=l+Math.imul(I,Z)|0,c=c+Math.imul(I,Q)|0,u=u+Math.imul(E,ee)|0,l=l+Math.imul(E,te)|0,l=l+Math.imul(x,ee)|0,c=c+Math.imul(x,te)|0,u=u+Math.imul(_,re)|0,l=l+Math.imul(_,ie)|0,l=l+Math.imul(k,re)|0,c=c+Math.imul(k,ie)|0,u=u+Math.imul(b,se)|0,l=l+Math.imul(b,ae)|0,l=l+Math.imul(v,se)|0,c=c+Math.imul(v,ae)|0,u=u+Math.imul(m,le)|0,l=l+Math.imul(m,ce)|0,l=l+Math.imul(g,le)|0,c=c+Math.imul(g,ce)|0,u=u+Math.imul(h,he)|0,l=l+Math.imul(h,pe)|0,l=l+Math.imul(p,he)|0,c=c+Math.imul(p,pe)|0;var xe=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(xe>>>26)|0,xe&=67108863,u=Math.imul(D,q),l=Math.imul(D,K),l=l+Math.imul(U,q)|0,c=Math.imul(U,K),u=u+Math.imul(M,V)|0,l=l+Math.imul(M,W)|0,l=l+Math.imul(L,V)|0,c=c+Math.imul(L,W)|0,u=u+Math.imul(B,G)|0,l=l+Math.imul(B,Y)|0,l=l+Math.imul(R,G)|0,c=c+Math.imul(R,Y)|0,u=u+Math.imul(j,Z)|0,l=l+Math.imul(j,Q)|0,l=l+Math.imul(O,Z)|0,c=c+Math.imul(O,Q)|0,u=u+Math.imul(A,ee)|0,l=l+Math.imul(A,te)|0,l=l+Math.imul(I,ee)|0,c=c+Math.imul(I,te)|0,u=u+Math.imul(E,re)|0,l=l+Math.imul(E,ie)|0,l=l+Math.imul(x,re)|0,c=c+Math.imul(x,ie)|0,u=u+Math.imul(_,se)|0,l=l+Math.imul(_,ae)|0,l=l+Math.imul(k,se)|0,c=c+Math.imul(k,ae)|0,u=u+Math.imul(b,le)|0,l=l+Math.imul(b,ce)|0,l=l+Math.imul(v,le)|0,c=c+Math.imul(v,ce)|0,u=u+Math.imul(m,he)|0,l=l+Math.imul(m,pe)|0,l=l+Math.imul(g,he)|0,c=c+Math.imul(g,pe)|0,u=u+Math.imul(h,me)|0,l=l+Math.imul(h,ge)|0,l=l+Math.imul(p,me)|0,c=c+Math.imul(p,ge)|0;var Ce=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,u=Math.imul(D,V),l=Math.imul(D,W),l=l+Math.imul(U,V)|0,c=Math.imul(U,W),u=u+Math.imul(M,G)|0,l=l+Math.imul(M,Y)|0,l=l+Math.imul(L,G)|0,c=c+Math.imul(L,Y)|0,u=u+Math.imul(B,Z)|0,l=l+Math.imul(B,Q)|0,l=l+Math.imul(R,Z)|0,c=c+Math.imul(R,Q)|0,u=u+Math.imul(j,ee)|0,l=l+Math.imul(j,te)|0,l=l+Math.imul(O,ee)|0,c=c+Math.imul(O,te)|0,u=u+Math.imul(A,re)|0,l=l+Math.imul(A,ie)|0,l=l+Math.imul(I,re)|0,c=c+Math.imul(I,ie)|0,u=u+Math.imul(E,se)|0,l=l+Math.imul(E,ae)|0,l=l+Math.imul(x,se)|0,c=c+Math.imul(x,ae)|0,u=u+Math.imul(_,le)|0,l=l+Math.imul(_,ce)|0,l=l+Math.imul(k,le)|0,c=c+Math.imul(k,ce)|0,u=u+Math.imul(b,he)|0,l=l+Math.imul(b,pe)|0,l=l+Math.imul(v,he)|0,c=c+Math.imul(v,pe)|0,u=u+Math.imul(m,me)|0,l=l+Math.imul(m,ge)|0,l=l+Math.imul(g,me)|0,c=c+Math.imul(g,ge)|0;var Ae=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,u=Math.imul(D,G),l=Math.imul(D,Y),l=l+Math.imul(U,G)|0,c=Math.imul(U,Y),u=u+Math.imul(M,Z)|0,l=l+Math.imul(M,Q)|0,l=l+Math.imul(L,Z)|0,c=c+Math.imul(L,Q)|0,u=u+Math.imul(B,ee)|0,l=l+Math.imul(B,te)|0,l=l+Math.imul(R,ee)|0,c=c+Math.imul(R,te)|0,u=u+Math.imul(j,re)|0,l=l+Math.imul(j,ie)|0,l=l+Math.imul(O,re)|0,c=c+Math.imul(O,ie)|0,u=u+Math.imul(A,se)|0,l=l+Math.imul(A,ae)|0,l=l+Math.imul(I,se)|0,c=c+Math.imul(I,ae)|0,u=u+Math.imul(E,le)|0,l=l+Math.imul(E,ce)|0,l=l+Math.imul(x,le)|0,c=c+Math.imul(x,ce)|0,u=u+Math.imul(_,he)|0,l=l+Math.imul(_,pe)|0,l=l+Math.imul(k,he)|0,c=c+Math.imul(k,pe)|0,u=u+Math.imul(b,me)|0,l=l+Math.imul(b,ge)|0,l=l+Math.imul(v,me)|0,c=c+Math.imul(v,ge)|0;var Ie=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,u=Math.imul(D,Z),l=Math.imul(D,Q),l=l+Math.imul(U,Z)|0,c=Math.imul(U,Q),u=u+Math.imul(M,ee)|0,l=l+Math.imul(M,te)|0,l=l+Math.imul(L,ee)|0,c=c+Math.imul(L,te)|0,u=u+Math.imul(B,re)|0,l=l+Math.imul(B,ie)|0,l=l+Math.imul(R,re)|0,c=c+Math.imul(R,ie)|0,u=u+Math.imul(j,se)|0,l=l+Math.imul(j,ae)|0,l=l+Math.imul(O,se)|0,c=c+Math.imul(O,ae)|0,u=u+Math.imul(A,le)|0,l=l+Math.imul(A,ce)|0,l=l+Math.imul(I,le)|0,c=c+Math.imul(I,ce)|0,u=u+Math.imul(E,he)|0,l=l+Math.imul(E,pe)|0,l=l+Math.imul(x,he)|0,c=c+Math.imul(x,pe)|0,u=u+Math.imul(_,me)|0,l=l+Math.imul(_,ge)|0,l=l+Math.imul(k,me)|0,c=c+Math.imul(k,ge)|0;var Te=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Te>>>26)|0,Te&=67108863,u=Math.imul(D,ee),l=Math.imul(D,te),l=l+Math.imul(U,ee)|0,c=Math.imul(U,te),u=u+Math.imul(M,re)|0,l=l+Math.imul(M,ie)|0,l=l+Math.imul(L,re)|0,c=c+Math.imul(L,ie)|0,u=u+Math.imul(B,se)|0,l=l+Math.imul(B,ae)|0,l=l+Math.imul(R,se)|0,c=c+Math.imul(R,ae)|0,u=u+Math.imul(j,le)|0,l=l+Math.imul(j,ce)|0,l=l+Math.imul(O,le)|0,c=c+Math.imul(O,ce)|0,u=u+Math.imul(A,he)|0,l=l+Math.imul(A,pe)|0,l=l+Math.imul(I,he)|0,c=c+Math.imul(I,pe)|0,u=u+Math.imul(E,me)|0,l=l+Math.imul(E,ge)|0,l=l+Math.imul(x,me)|0,c=c+Math.imul(x,ge)|0;var je=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(je>>>26)|0,je&=67108863,u=Math.imul(D,re),l=Math.imul(D,ie),l=l+Math.imul(U,re)|0,c=Math.imul(U,ie),u=u+Math.imul(M,se)|0,l=l+Math.imul(M,ae)|0,l=l+Math.imul(L,se)|0,c=c+Math.imul(L,ae)|0,u=u+Math.imul(B,le)|0,l=l+Math.imul(B,ce)|0,l=l+Math.imul(R,le)|0,c=c+Math.imul(R,ce)|0,u=u+Math.imul(j,he)|0,l=l+Math.imul(j,pe)|0,l=l+Math.imul(O,he)|0,c=c+Math.imul(O,pe)|0,u=u+Math.imul(A,me)|0,l=l+Math.imul(A,ge)|0,l=l+Math.imul(I,me)|0,c=c+Math.imul(I,ge)|0;var Oe=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,u=Math.imul(D,se),l=Math.imul(D,ae),l=l+Math.imul(U,se)|0,c=Math.imul(U,ae),u=u+Math.imul(M,le)|0,l=l+Math.imul(M,ce)|0,l=l+Math.imul(L,le)|0,c=c+Math.imul(L,ce)|0,u=u+Math.imul(B,he)|0,l=l+Math.imul(B,pe)|0,l=l+Math.imul(R,he)|0,c=c+Math.imul(R,pe)|0,u=u+Math.imul(j,me)|0,l=l+Math.imul(j,ge)|0,l=l+Math.imul(O,me)|0,c=c+Math.imul(O,ge)|0;var Pe=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,u=Math.imul(D,le),l=Math.imul(D,ce),l=l+Math.imul(U,le)|0,c=Math.imul(U,ce),u=u+Math.imul(M,he)|0,l=l+Math.imul(M,pe)|0,l=l+Math.imul(L,he)|0,c=c+Math.imul(L,pe)|0,u=u+Math.imul(B,me)|0,l=l+Math.imul(B,ge)|0,l=l+Math.imul(R,me)|0,c=c+Math.imul(R,ge)|0;var Be=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Be>>>26)|0,Be&=67108863,u=Math.imul(D,he),l=Math.imul(D,pe),l=l+Math.imul(U,he)|0,c=Math.imul(U,pe),u=u+Math.imul(M,me)|0,l=l+Math.imul(M,ge)|0,l=l+Math.imul(L,me)|0,c=c+Math.imul(L,ge)|0;var Re=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Re>>>26)|0,Re&=67108863,u=Math.imul(D,me),l=Math.imul(D,ge),l=l+Math.imul(U,me)|0,c=Math.imul(U,ge);var Ne=(a+u|0)+((8191&l)<<13)|0;return a=(c+(l>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,s[0]=ye,s[1]=be,s[2]=ve,s[3]=we,s[4]=_e,s[5]=ke,s[6]=Se,s[7]=Ee,s[8]=xe,s[9]=Ce,s[10]=Ae,s[11]=Ie,s[12]=Te,s[13]=je,s[14]=Oe,s[15]=Pe,s[16]=Be,s[17]=Re,s[18]=Ne,0!==a&&(s[19]=a,r.length++),r};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0,i+=s>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}function g(e,t,n){var r=new y;return r.mulp(e,t,n)}function y(e,t){this.x=e,this.y=t}Math.imul||(d=p),o.prototype.mulTo=function e(t,n){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?d(this,t,n):i<63?p(this,t,n):i<1024?m(this,t,n):g(this,t,n),r},y.prototype.makeRBT=function e(t){for(var n=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},y.prototype.permute=function e(t,n,r,i,o,s){for(var a=0;a>>=1)o++;return 1<>>=13,i[2*a+1]=8191&s,s>>>=13;for(a=2*n;a>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),this},o.prototype.muln=function e(t){return this.clone().imuln(t)},o.prototype.sqr=function e(){return this.mul(this)},o.prototype.isqr=function e(){return this.imul(this.clone())},o.prototype.pow=function e(t){var n=h(t);if(0===n.length)return new o(1);for(var r=this,i=0;i=0);var n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n,s;if(0!==n){var a=0;for(s=0;s>>26-n}a&&(this.words[s]=a,this.length++)}if(0!==i){for(s=this.length-1;s>=0;s--)this.words[s+i]=this.words[s];for(s=0;s=0),o=n?(n-n%26)/26:0;var s=t%26,a=Math.min((t-s)/26,this.length),u=67108863^67108863>>>s<a)for(this.length-=a,c=0;c=0&&(0!==f||c>=o);c--){var h=0|this.words[c];this.words[c]=f<<26-s|h>>>s,f=h&u}return l&&0!==f&&(l.words[l.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function e(t,n,i){return r(0===this.negative),this.iushrn(t,n,i)},o.prototype.shln=function e(t){return this.clone().ishln(t)},o.prototype.ushln=function e(t){return this.clone().iushln(t)},o.prototype.shrn=function e(t){return this.clone().ishrn(t)},o.prototype.ushrn=function e(t){return this.clone().iushrn(t)},o.prototype.testn=function e(t){r("number"==typeof t&&t>=0);var n=t%26,i=(t-n)/26,o=1<=0);var n=t%26,i=(t-n)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==n&&i++,this.length=Math.min(i,this.length),0!==n){var o=67108863^67108863>>>n<=67108864;n++)this.words[n]-=67108864,n===this.length-1?this.words[n+1]=1:this.words[n+1]++;return this.length=Math.max(this.length,n+1),this},o.prototype.isubn=function e(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var n=0;n>26)-(l/67108864|0),this.words[s+i]=67108863&a}for(;s>26,this.words[s+i]=67108863&a;if(0===u)return this.strip();for(r(-1===u),u=0,s=0;s>26,this.words[s]=67108863&a;return this.negative=1,this.strip()},o.prototype._wordDiv=function e(t,n){var r=this.length-t.length,i=this.clone(),s=t,a=0|s.words[s.length-1],u=this._countBits(a);r=26-u,0!==r&&(s=s.ushln(r),i.iushln(r),a=0|s.words[s.length-1]);var l=i.length-s.length,c;if("mod"!==n){c=new o(null),c.length=l+1,c.words=new Array(c.length);for(var f=0;f=0;p--){var d=67108864*(0|i.words[s.length+p])+(0|i.words[s.length+p-1]);for(d=Math.min(d/a|0,67108863),i._ishlnsubmul(s,d,p);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(s,1,p),i.isZero()||(i.negative^=1);c&&(c.words[p]=d)}return c&&c.strip(),i.strip(),"div"!==n&&0!==r&&i.iushrn(r),{div:c||null,mod:i}},o.prototype.divmod=function e(t,n,i){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(u=this.neg().divmod(t,n),"mod"!==n&&(s=u.div.neg()),"div"!==n&&(a=u.mod.neg(),i&&0!==a.negative&&a.iadd(t)),{div:s,mod:a}):0===this.negative&&0!==t.negative?(u=this.divmod(t.neg(),n),"mod"!==n&&(s=u.div.neg()),{div:s,mod:u.mod}):0!=(this.negative&t.negative)?(u=this.neg().divmod(t.neg(),n),"div"!==n&&(a=u.mod.neg(),i&&0!==a.negative&&a.isub(t)),{div:u.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===n?{div:this.divn(t.words[0]),mod:null}:"mod"===n?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,n);var s,a,u},o.prototype.div=function e(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function e(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function e(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function e(t){var n=this.divmod(t);if(n.mod.isZero())return n.div;var r=0!==n.div.negative?n.mod.isub(t):n.mod,i=t.ushrn(1),o=t.andln(1),s=r.cmp(i);return s<0||1===o&&0===s?n.div:0!==n.div.negative?n.div.isubn(1):n.div.iaddn(1)},o.prototype.modn=function e(t){r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return i},o.prototype.idivn=function e(t){r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this.strip()},o.prototype.divn=function e(t){return this.clone().idivn(t)},o.prototype.egcd=function e(t){r(0===t.negative),r(!t.isZero());var n=this,i=t.clone();n=0!==n.negative?n.umod(t):n.clone();for(var s=new o(1),a=new o(0),u=new o(0),l=new o(1),c=0;n.isEven()&&i.isEven();)n.iushrn(1),i.iushrn(1),++c;for(var f=i.clone(),h=n.clone();!n.isZero();){for(var p=0,d=1;0==(n.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||a.isOdd())&&(s.iadd(f),a.isub(h)),s.iushrn(1),a.iushrn(1);for(var m=0,g=1;0==(i.words[0]&g)&&m<26;++m,g<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(u.isOdd()||l.isOdd())&&(u.iadd(f),l.isub(h)),u.iushrn(1),l.iushrn(1);n.cmp(i)>=0?(n.isub(i),s.isub(u),a.isub(l)):(i.isub(n),u.isub(s),l.isub(a))}return{a:u,b:l,gcd:i.iushln(c)}},o.prototype._invmp=function e(t){r(0===t.negative),r(!t.isZero());var n=this,i=t.clone();n=0!==n.negative?n.umod(t):n.clone();for(var s=new o(1),a=new o(0),u=i.clone(),l;n.cmpn(1)>0&&i.cmpn(1)>0;){for(var c=0,f=1;0==(n.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(n.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var h=0,p=1;0==(i.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(i.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);n.cmp(i)>=0?(n.isub(i),s.isub(a)):(i.isub(n),a.isub(s))}return l=0===n.cmpn(1)?s:a,l.cmpn(0)<0&&l.iadd(t),l},o.prototype.gcd=function e(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var n=this.clone(),r=t.clone();n.negative=0,r.negative=0;for(var i=0;n.isEven()&&r.isEven();i++)n.iushrn(1),r.iushrn(1);for(;;){for(;n.isEven();)n.iushrn(1);for(;r.isEven();)r.iushrn(1);var o=n.cmp(r);if(o<0){var s=n;n=r,r=s}else if(0===o||0===r.cmpn(1))break;n.isub(r)}return r.iushln(i)},o.prototype.invm=function e(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function e(){return 0==(1&this.words[0])},o.prototype.isOdd=function e(){return 1==(1&this.words[0])},o.prototype.andln=function e(t){return this.words[0]&t},o.prototype.bincn=function e(t){r("number"==typeof t);var n=t%26,i=(t-n)/26,o=1<>>26,u&=67108863,this.words[a]=u}return 0!==s&&(this.words[a]=s,this.length++),this},o.prototype.isZero=function e(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function e(t){var n=t<0,i;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)i=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var o=0|this.words[0];i=o===t?0:ot.length)return 1;if(this.length=0;r--){var i=0|this.words[r],o=0|t.words[r];if(i!==o){io&&(n=1);break}}return n},o.prototype.gtn=function e(t){return 1===this.cmpn(t)},o.prototype.gt=function e(t){return 1===this.cmp(t)},o.prototype.gten=function e(t){return this.cmpn(t)>=0},o.prototype.gte=function e(t){return this.cmp(t)>=0},o.prototype.ltn=function e(t){return-1===this.cmpn(t)},o.prototype.lt=function e(t){return-1===this.cmp(t)},o.prototype.lten=function e(t){return this.cmpn(t)<=0},o.prototype.lte=function e(t){return this.cmp(t)<=0},o.prototype.eqn=function e(t){return 0===this.cmpn(t)},o.prototype.eq=function e(t){return 0===this.cmp(t)},o.red=function e(t){return new E(t)},o.prototype.toRed=function e(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function e(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function e(t){return this.red=t,this},o.prototype.forceRed=function e(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function e(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function e(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function e(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function e(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function e(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function e(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function e(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function e(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function e(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function e(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function e(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function e(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function e(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function x(e){E.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function e(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function e(t){var n=t,r;do{this.split(n,this.tmp),n=this.imulK(n),n=n.iadd(this.tmp),r=n.bitLength()}while(r>this.n);var i=r0?n.isub(this.p):n.strip(),n},v.prototype.split=function e(t,n){t.iushrn(this.n,0,n)},v.prototype.imulK=function e(t){return t.imul(this.k)},i(w,v),w.prototype.split=function e(t,n){for(var r=4194303,i=Math.min(t.length,9),o=0;o>>22,s=a}s>>>=22,t.words[o-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function e(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var n=0,r=0;r>>=26,t.words[r]=o,n=i}return 0!==n&&(t.words[t.length++]=n),t},o._prime=function e(t){if(b[t])return b[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new k;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return b[t]=e,e},E.prototype._verify1=function e(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function e(t,n){r(0==(t.negative|n.negative),"red works only with positives"),r(t.red&&t.red===n.red,"red works only with red numbers")},E.prototype.imod=function e(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function e(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function e(t,n){this._verify2(t,n);var r=t.add(n);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function e(t,n){this._verify2(t,n);var r=t.iadd(n);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function e(t,n){this._verify2(t,n);var r=t.sub(n);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function e(t,n){this._verify2(t,n);var r=t.isub(n);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function e(t,n){return this._verify1(t),this.imod(t.ushln(n))},E.prototype.imul=function e(t,n){return this._verify2(t,n),this.imod(t.imul(n))},E.prototype.mul=function e(t,n){return this._verify2(t,n),this.imod(t.mul(n))},E.prototype.isqr=function e(t){return this.imul(t,t.clone())},E.prototype.sqr=function e(t){return this.mul(t,t)},E.prototype.sqrt=function e(t){if(t.isZero())return t.clone();var n=this.m.andln(3);if(r(n%2==1),3===n){var i=this.m.add(new o(1)).iushrn(2);return this.pow(t,i)}for(var s=this.m.subn(1),a=0;!s.isZero()&&0===s.andln(1);)a++,s.iushrn(1);r(!s.isZero());var u=new o(1).toRed(this),l=u.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(l);)f.redIAdd(l);for(var h=this.pow(f,s),p=this.pow(t,s.addn(1).iushrn(1)),d=this.pow(t,s),m=a;0!==d.cmp(u);){for(var g=d,y=0;0!==g.cmp(u);y++)g=g.redSqr();r(y=0;s--){for(var f=n.words[s],h=c-1;h>=0;h--){var p=f>>h&1;a!==i[0]&&(a=this.sqr(a)),0!==p||0!==u?(u<<=1,u|=p,l++,(4===l||0===s&&0===h)&&(a=this.mul(a,i[u]),l=0,u=0)):l=0}c=26}return a},E.prototype.convertTo=function e(t){var n=t.umod(this.m);return n===t?n.clone():n},E.prototype.convertFrom=function e(t){var n=t.clone();return n.red=null,n},o.mont=function e(t){return new x(t)},i(x,E),x.prototype.convertTo=function e(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function e(t){var n=this.imod(t.mul(this.rinv));return n.red=null,n},x.prototype.imul=function e(t,n){if(t.isZero()||n.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(n),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},x.prototype.mul=function e(t,n){if(t.isZero()||n.isZero())return new o(0)._forceRed(this);var r=t.mul(n),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(i).iushrn(this.shift),a=s;return s.cmp(this.m)>=0?a=s.isub(this.m):s.cmpn(0)<0&&(a=s.iadd(this.m)),a._forceRed(this)},x.prototype.invm=function e(t){var n=this.imod(t._invmp(this.m).mul(this.r2));return n._forceRed(this)}}(e,this)}).call(this,n(75)(e))},function(e,t,n){"use strict";const r=n(475),i=n(945),o=n(456);t=e.exports,t.aes=i,t.hmac=r,t.keys=o,t.randomBytes=n(315),t.pbkdf2=n(957)},function(e,t,n){"use strict";(function(t){const r=n(76),i=n(35),o=n(89),s=n(9),a=/^https?:\/\/[^/]+\/(ip(f|n)s)\/((\w+).*)/,u=/^\/(ip(f|n)s)\/((\w+).*)/,l=1,c=4,f=/^https?:\/\/([^/]+)\.(ip(?:f|n)s)\.[^/]+/,h=1,p=2;function d(e){const n=v(e);try{const e=t.from(r.decode(n));return i.decode(e),!0}catch(e){return!1}}function m(e){try{return o.isEncoded(e)}catch(e){return!1}}function g(e){try{return s.isCID(new s(e))}catch(e){return!1}}function y(e,t,n=l,r=c){const i=v(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipfs"!==o[n])return!1;let s=o[r];return s&&t===f&&(s=s.toLowerCase()),g(s)}function b(e,t,n=l,r){const i=v(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipns"!==o[n])return!1;if(r&&t===f){let e=o[r];return e=e.toLowerCase(),g(e)}return!0}function v(e){return t.isBuffer(e)?r.encode(e):"string"==typeof e&&e}const w=e=>y(e,f,2,1),_=e=>b(e,f,2,1);e.exports={multihash:d,cid:g,base32cid:e=>"base32"===m(e)&&g(e),ipfsSubdomain:w,ipnsSubdomain:_,subdomain:e=>w(e)||_(e),subdomainPattern:f,ipfsUrl:e=>y(e,a),ipnsUrl:e=>b(e,a),url:e=>y(e,a)||b(e,a),urlPattern:a,ipfsPath:e=>y(e,u),ipnsPath:e=>b(e,u),path:e=>y(e,u)||b(e,u),pathPattern:u,urlOrPath:e=>y(e,a)||b(e,a)||y(e,u)||b(e,u)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";t.Connection=n(1058)},function(e,t){var n=Array.isArray;e.exports=n},function(e,t){function n(){}e.exports=n},function(e,t){e.exports=r;var n=Object.prototype.hasOwnProperty;function r(){for(var e={},t=0;t73)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-3)return!1;var t=e[3];if(5+t>=e.length)return!1;var n=e[5+t];if(t+n+7!==e.length)return!1;var r=e.slice(4);if(2!==e[2])return!1;if(0===t)return!1;if(128&r[0])return!1;if(t>1&&0===r[0]&&!(128&r[1]))return!1;var i=e.slice(6+t);return 2===e[6+t-2]&&(0!==n&&(!(128&i[0])&&!(n>1&&0===i[0]&&!(128&i[1]))))},u.prototype.hasLowS=function(){return!this.s.lt(new r(1))&&!this.s.gt(new r("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex"))},u.prototype.hasDefinedHashtype=function(){if(!a.isNaturalNumber(this.nhashtype))return!1;var e=this.nhashtype&~u.SIGHASH_ANYONECANPAY;return!(eu.SIGHASH_SINGLE)},u.prototype.toTxFormat=function(){var e=this.toDER(),n=new t(1);return n.writeUInt8(this.nhashtype,0),t.concat([e,n])},u.SIGHASH_ALL=1,u.SIGHASH_NONE=2,u.SIGHASH_SINGLE=3,u.SIGHASH_ANYONECANPAY=128,e.exports=u}).call(this,n(0).Buffer)},function(e,t,n){e.exports=n(600),e.exports.Interpreter=n(1446)},function(e,t){var n=1e3,r=60*n,i=60*r,o=24*i,s=7*o,a=365.25*o;function u(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var u=parseFloat(t[1]),l=(t[2]||"ms").toLowerCase();switch(l){case"years":case"year":case"yrs":case"yr":case"y":return u*a;case"weeks":case"week":case"w":return u*s;case"days":case"day":case"d":return u*o;case"hours":case"hour":case"hrs":case"hr":case"h":return u*i;case"minutes":case"minute":case"mins":case"min":case"m":return u*r;case"seconds":case"second":case"secs":case"sec":case"s":return u*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}}}function l(e){var t=Math.abs(e);return t>=o?Math.round(e/o)+"d":t>=i?Math.round(e/i)+"h":t>=r?Math.round(e/r)+"m":t>=n?Math.round(e/n)+"s":e+"ms"}function c(e){var t=Math.abs(e);return t>=o?f(e,t,o,"day"):t>=i?f(e,t,i,"hour"):t>=r?f(e,t,r,"minute"):t>=n?f(e,t,n,"second"):e+" ms"}function f(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}e.exports=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return u(e);if("number"===n&&isFinite(e))return t.long?c(e):l(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(175),i=a(r),o=n(395),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,i.default)(s.default),e.exports=t.default},function(e,t,n){"use strict";(function(r){const i=n(781);t=e.exports=s,t.encode=a,t.decode=u,t.isEncoded=l,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 n=f(e),i=r.from(n.code),o=n.name;return c(o,t),r.concat([i,t])}function a(e,t){const n=f(e),i=n.name;return s(i,r.from(n.encode(t)))}function u(e){r.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);e=e.substring(1,e.length),"string"==typeof e&&(e=r.from(e));const n=f(t);return r.from(n.decode(e.toString()))}function l(e){if(r.isBuffer(e)&&(e=e.toString()),"[object String]"!==Object.prototype.toString.call(e))return!1;const t=e.substring(0,1);try{const e=f(t);return e.name}catch(e){return!1}}function c(e,t){const n=f(e);n.decode(t.toString())}function f(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,n(0).Buffer)},function(e,t,n){"use strict";function r(e){return e}var i=n(178);e.exports=function e(t){if(!t)return r;t=i(t);var n=!1,o,s;return function(e){return function r(i,a){if(s)return a(s);i?(s=i,e(i,n?function(e){n?o=a:a(i)}:function(e){a(i)})):e(null,function(e,i){e?a(e):s?a(s):(n=!0,t(i,function(e,t){n=!1,s?(a(s),o&&o(s)):e?r(e,a):a(null,t)}))})}}}},function(e,t,n){"use strict";(function(r){Object.defineProperty(t,"__esModule",{value:!0});var i=n(215),o;o=i.hasNextTick?r.nextTick:i.hasSetImmediate?setImmediate:i.fallback,t.default=(0,i.wrap)(o),e.exports=t.default}).call(this,n(2))},function(e,t,n){"use strict";const r=n(24),i=T("dns4"),o=T("dns6"),s=I(T("dnsaddr"),i,o),a=I(T("ip4"),T("ip6")),u=I(A(a,T("tcp")),A(s,T("tcp"))),l=A(a,T("udp")),c=A(l,T("utp")),f=I(A(s,T("tcp")),s),h=I(A(u,T("ws")),A(f,T("ws"))),p=I(A(u,T("wss")),A(f,T("wss"))),d=I(A(u,T("http")),A(a,T("http")),A(f,T("http")),A(f)),m=I(A(u,T("https")),A(a,T("https")),A(f,T("https"))),g=I(A(h,T("p2p-webrtc-star"),T("ipfs")),A(p,T("p2p-webrtc-star"),T("ipfs"))),y=I(A(h,T("p2p-websocket-star"),T("ipfs")),A(p,T("p2p-websocket-star"),T("ipfs")),A(h,T("p2p-websocket-star")),A(p,T("p2p-websocket-star"))),b=I(A(d,T("p2p-webrtc-direct")),A(m,T("p2p-webrtc-direct"))),v=I(h,p,d,m,g,b,u,c),w=I(A(v,T("p2p-stardust"),T("ipfs")),A(v,T("p2p-stardust")));let _=I(A(v,T("ipfs")),g,T("ipfs"));const k=I(A(_,T("p2p-circuit"),_),A(_,T("p2p-circuit")),A(T("p2p-circuit"),_),A(v,T("p2p-circuit")),A(T("p2p-circuit"),v),T("p2p-circuit")),S=()=>I(A(k,S),k),E=S(),x=I(A(E,_,E),A(_,E),A(E,_),E,_);function C(e){return function t(n){if(!r.isMultiaddr(n))try{n=r(n)}catch(e){return!1}let i=e(n.protoNames());return null!==i&&0===i.length}}function A(){const e=Array.from(arguments);function t(t){return t.length{if(t="function"==typeof e?e().partialMatch(t):e.partialMatch(t),null===t)return!0}),t)}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:C(t),partialMatch:t}}function I(){const e=Array.from(arguments);function t(t){let n=null;return e.some(e=>{const r="function"==typeof e?e().partialMatch(t):e.partialMatch(t);if(r)return n=r,!0}),n}const n={toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:C(t),partialMatch:t};return n}function T(e){const t=e;function n(e){if("string"==typeof e)try{e=r(e)}catch(e){return!1}const n=e.protoNames();return 1===n.length&&n[0]===t}function i(e){return 0===e.length?null:e[0]===t?e.slice(1):null}return{toString:function(){return t},matches:n,partialMatch:i}}t.DNS=f,t.DNS4=i,t.DNS6=o,t.IP=a,t.TCP=u,t.UDP=l,t.UTP=c,t.HTTP=d,t.HTTPS=m,t.WebSockets=h,t.WebSocketsSecure=p,t.WebSocketStar=y,t.WebRTCStar=g,t.WebRTCDirect=b,t.Reliable=v,t.Stardust=w,t.Circuit=E,t.IPFS=x},function(e,t,n){"use strict";var r=n(107),i=n(1);function o(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function s(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for(e=e.replace(/[^a-z0-9]+/gi,""),e.length%2!=0&&(e="0"+e),i=0;i>6|192,n[r++]=63&s|128):o(e,i)?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),n[r++]=s>>18|240,n[r++]=s>>12&63|128,n[r++]=s>>6&63|128,n[r++]=63&s|128):(n[r++]=s>>12|224,n[r++]=s>>6&63|128,n[r++]=63&s|128)}else for(i=0;i>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24;return t>>>0}function l(e,t){for(var n="",r=0;r>>0}return s}function p(e,t){for(var n=new Array(4*e.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n}function d(e,t){return e>>>t|e<<32-t}function m(e,t){return e<>>32-t}function g(e,t){return e+t>>>0}function y(e,t,n){return e+t+n>>>0}function b(e,t,n,r){return e+t+n+r>>>0}function v(e,t,n,r,i){return e+t+n+r+i>>>0}function w(e,t,n,r){var i=e[t],o=e[t+1],s=r+o>>>0,a=(s>>0,e[t+1]=s}function _(e,t,n,r){var i=t+r>>>0,o=(i>>0}function k(e,t,n,r){var i=t+r;return i>>>0}function S(e,t,n,r,i,o,s,a){var u=0,l=t;l=l+r>>>0,u+=l>>0,u+=l>>0,u+=l>>0}function E(e,t,n,r,i,o,s,a){var u=t+r+o+a;return u>>>0}function x(e,t,n,r,i,o,s,a,u,l){var c=0,f=t;f=f+r>>>0,c+=f>>0,c+=f>>0,c+=f>>0,c+=f>>0}function C(e,t,n,r,i,o,s,a,u,l){var c=t+r+o+a+l;return c>>>0}function A(e,t,n){var r=t<<32-n|e>>>n;return r>>>0}function I(e,t,n){var r=e<<32-n|t>>>n;return r>>>0}function T(e,t,n){return e>>>n}function j(e,t,n){var r=e<<32-n|t>>>n;return r>>>0}t.inherits=i,t.toArray=s,t.toHex=a,t.htonl=u,t.toHex32=l,t.zero2=c,t.zero8=f,t.join32=h,t.split32=p,t.rotr32=d,t.rotl32=m,t.sum32=g,t.sum32_3=y,t.sum32_4=b,t.sum32_5=v,t.sum64=w,t.sum64_hi=_,t.sum64_lo=k,t.sum64_4_hi=S,t.sum64_4_lo=E,t.sum64_5_hi=x,t.sum64_5_lo=C,t.rotr64_hi=A,t.rotr64_lo=I,t.shr64_hi=T,t.shr64_lo=j},function(e,t,n){const r=n(45),i=Math.pow(2,31)-1;function o(e){return r.UInt32(e)&&e<=i}function s(e){return r.String(e)&&e.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}s.toJSON=function(){return"BIP32 derivation path"};const a=21e14;function u(e){return r.UInt53(e)&&e<=a}const l=r.quacksLike("Point"),c=r.compile({messagePrefix:r.oneOf(r.Buffer,r.String),bip32:{public:r.UInt32,private:r.UInt32},pubKeyHash:r.UInt8,scriptHash:r.UInt8,wif:r.UInt8}),f={BIP32Path:s,Buffer256bit:r.BufferN(32),ECPoint:l,Hash160bit:r.BufferN(20),Hash256bit:r.BufferN(32),Network:c,Satoshi:u,UInt31:o};for(var h in r)f[h]=r[h];e.exports=f},function(e,t,n){"use strict";var r=t;r.version=n(1434).version,r.utils=n(1435),r.rand=n(574),r.hmacDRBG=n(1436),r.curve=n(272),r.curves=n(1441),r.ec=n(1443)},function(e,t,n){"use strict";(function(t){var r=n(49),i=n(152),o=n(60),s=n(41),a=n(128),u=n(17),l=n(25);function c(e,t){if(!(this instanceof c))return new c(e,t);if(l.checkArgument(e,"First argument is required, please include public key data."),e instanceof c)return e;t=t||{};var n=this._classifyArgs(e,t);return n.point.validate(),s.defineImmutable(this,{point:n.point,compressed:n.compressed,network:n.network||a.defaultNetwork}),this}c.prototype._classifyArgs=function(e,n){var r={compressed:u.isUndefined(n.compressed)||n.compressed};if(e instanceof i)r.point=e;else if(e.x&&e.y)r=c._transformObject(e);else if("string"==typeof e)r=c._transformDER(new t(e,"hex"));else if(c._isBuffer(e))r=c._transformDER(e);else{if(!c._isPrivateKey(e))throw new TypeError("First argument is an unrecognized data format.");r=c._transformPrivateKey(e)}return r.network||(r.network=u.isUndefined(n.network)?void 0:a.get(n.network)),r},c._isPrivateKey=function(e){var t=n(273);return e instanceof t},c._isBuffer=function(e){return e instanceof t||e instanceof Uint8Array},c._transformPrivateKey=function(e){l.checkArgument(c._isPrivateKey(e),"Must be an instance of PrivateKey");var t={};return t.point=i.getG().mul(e.bn),t.compressed=e.compressed,t.network=e.network,t},c._transformDER=function(e,t){l.checkArgument(c._isBuffer(e),"Must be a hex buffer of DER encoded public key");var n={},o,s,a,f;if(t=!!u.isUndefined(t)||t,4!==e[0]&&(t||6!==e[0]&&7!==e[0]))if(3===e[0])a=e.slice(1),o=new r(a),n=c._transformX(!0,o),n.compressed=!0;else{if(2!==e[0])throw new TypeError("Invalid DER format public key");a=e.slice(1),o=new r(a),n=c._transformX(!1,o),n.compressed=!0}else{if(a=e.slice(1,33),f=e.slice(33,65),32!==a.length||32!==f.length||65!==e.length)throw new TypeError("Length of x and y must be 32 bytes");o=new r(a),s=new r(f),n.point=new i(o,s),n.compressed=!1}return n},c._transformX=function(e,t){l.checkArgument("boolean"==typeof e,"Must specify whether y is odd or not (true or false)");var n={};return n.point=i.fromX(e,t),n},c._transformObject=function(e){var t=new r(e.x,"hex"),n=new r(e.y,"hex"),o=new i(t,n);return new c(o,{compressed:e.compressed})},c.fromPrivateKey=function(e){l.checkArgument(c._isPrivateKey(e),"Must be an instance of PrivateKey");var t=c._transformPrivateKey(e);return new c(t.point,{compressed:t.compressed,network:t.network})},c.fromDER=c.fromBuffer=function(e,t){l.checkArgument(c._isBuffer(e),"Must be a hex buffer of DER encoded public key");var n=c._transformDER(e,t);return new c(n.point,{compressed:n.compressed})},c.fromPoint=function(e,t){return l.checkArgument(e instanceof i,"First argument must be an instance of Point."),new c(e,{compressed:t})},c.fromString=function(e,n){var r=new t(e,n||"hex"),i=c._transformDER(r);return new c(i.point,{compressed:i.compressed})},c.fromX=function(e,t){var n=c._transformX(e,t);return new c(n.point,{compressed:n.compressed})},c.getValidationError=function(e){var t;try{new c(e)}catch(e){t=e}return t},c.isValid=function(e){return!c.getValidationError(e)},c.prototype.toObject=c.prototype.toJSON=function e(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}},c.prototype.toBuffer=c.prototype.toDER=function(){var e=this.point.getX(),n=this.point.getY(),r=e.toBuffer({size:32}),i=n.toBuffer({size:32}),o;if(this.compressed){var s=i[i.length-1]%2;return o=new t(s?[3]:[2]),t.concat([o,r])}return o=new t([4]),t.concat([o,r,i])},c.prototype._getID=function e(){return o.sha256ripemd160(this.toBuffer())},c.prototype.toAddress=function(e){var t=n(129);return t.fromPublicKey(this,e||this.network)},c.prototype.toString=function(){return this.toDER().toString("hex")},c.prototype.inspect=function(){return""},e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){var r=n(27),i=n(13);function o(e,t){Error.captureStackTrace&&Error.captureStackTrace(this,o),this.name="FingerprintFormatError",this.fingerprint=e,this.format=t,this.message="Fingerprint format is not supported, or is invalid: ",void 0!==e&&(this.message+=" fingerprint = "+e),void 0!==t&&(this.message+=" format = "+t)}function s(e){Error.captureStackTrace&&Error.captureStackTrace(this,s),this.name="InvalidAlgorithmError",this.algorithm=e,this.message='Algorithm "'+e+'" is not supported'}function a(e,t,n){Error.captureStackTrace&&Error.captureStackTrace(this,a),this.name="KeyParseError",this.format=t,this.keyName=e,this.innerErr=n,this.message="Failed to parse "+e+" as a valid "+t+" format key: "+n.message}function u(e,t,n){Error.captureStackTrace&&Error.captureStackTrace(this,u),this.name="SignatureParseError",this.type=e,this.format=t,this.innerErr=n,this.message="Failed to parse the given data as a "+e+" signature in "+t+" format: "+n.message}function l(e,t,n){Error.captureStackTrace&&Error.captureStackTrace(this,l),this.name="CertificateParseError",this.format=t,this.certName=e,this.innerErr=n,this.message="Failed to parse "+e+" as a valid "+t+" format certificate: "+n.message}function c(e,t){Error.captureStackTrace&&Error.captureStackTrace(this,c),this.name="KeyEncryptedError",this.format=t,this.keyName=e,this.message="The "+t+" format key "+e+" is encrypted (password-protected), and no passphrase was provided in `options`"}i.inherits(o,Error),i.inherits(s,Error),i.inherits(a,Error),i.inherits(u,Error),i.inherits(l,Error),i.inherits(c,Error),e.exports={FingerprintFormatError:o,InvalidAlgorithmError:s,KeyParseError:a,SignatureParseError:u,KeyEncryptedError:c,CertificateParseError:l}},function(e,t){errors={};class n extends Error{constructor(e){super(e||"Coding Error"),this.name="CodingError"}}errors.CodingError=n;class r extends Error{constructor(e){super("To be implemented: "+e),this.name="ToBeImplementedError"}}errors.ToBeImplementedError=r;class i extends Error{constructor(e){super(e||"Transport failure"),this.name="TransportError"}}errors.TransportError=i;class o extends Error{constructor(e){super(e||"Timed out"),this.name="TimeoutError"}}errors.TimeoutError=o;class s extends Error{constructor(e){super(e||"Intentionally Unimplemented Function"),this.name="IntentionallyUnimplementedError"}}errors.IntentionallyUnimplementedError=s,t=e.exports=errors},function(e,t,n){var r=n(389),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();e.exports=o},function(e,t,n){(function(t){var r=n(57);e.exports=o,e.exports.source=function(e){return o(null,e)},e.exports.sink=function(e){return o(e,null)};var i="undefined"==typeof setImmediate?t.nextTick:setImmediate;function o(e,t){e&&"object"==typeof e&&(t=e.source,e=e.sink);var n=[],o=[],s,a,u=new r,l;u.writable=u.readable=!0,u.write=function(e){return n.length?n.shift()(null,e):o.push(e),n.length||(a=!0),!!n.length},u.end=function(){t?o.length?g():t(s=!0,n.length?n.shift():function(){}):n.length&&n.shift()(!0)},u.source=function(e,t){o.length?(t(null,o.shift()),o.length||u.emit("drain")):((s=s||e)?t(s):n.push(t),a&&(a=!1,u.emit("drain")))},e&&(l=e(u.source)),l&&!t&&(t=l);var c=[],f=[],h=!1,p=!1,d=!1;if(u.sink=function(e){t=e,i(g)},t){u.sink(t);var m=u.pipe.bind(u);u.pipe=function(e,t){var n=m(e,t);return u.paused&&u.resume(),n}}function g(){if(p=!1,t&&!d){for(;c.length&&!u.paused;)u.emit("data",c.shift());if(!u.paused){if(h)return u.emit("end");d=!0,t(null,function e(n,r){d=!1,u.paused?(!0===n?h=n:n?u.emit("error",n):c.push(r),p=!0):n&&!0!==(s=n)?u.emit("error",n):(s=s||n)?u.emit("end"):(u.emit("data",r),d=!0,t(null,e))})}}}return u.pause=function(){return u.paused=!0,u},u.resume=function(){return u.paused=!1,g(),u},u.destroy=function(){!s&&t&&t(s=!0,function(){}),s=!0,n.length&&n.shift()(!0),u.emit("close")},u}}).call(this,n(2))},function(e,t,n){"use strict";(function(t){const r=n(9);e.exports=function(e){if(t.isBuffer(e))return new r(e).toString();if(r.isCID(e))return e.toString();if("string"!=typeof e)throw new Error("unexpected cid type: "+typeof e);return new r(e.split("/")[0]),e}}).call(this,n(0).Buffer)},function(e,t,n){e.exports=p;var r=n(27),i=n(31).Buffer,o=n(55),s=n(15),a=n(97),u=n(47),l=n(103),c=n(210),f=a.InvalidAlgorithmError,h=a.SignatureParseError;function p(e){r.object(e,"options"),r.arrayOfObject(e.parts,"options.parts"),r.string(e.type,"options.type");for(var t={},n=0;n20&&0===o[0]&&(o=o.slice(1)),s=this.part.s.data,s.length>20&&0===s[0]&&(s=s.slice(1)),this.hashAlgorithm&&"sha1"!==this.hashAlgorithm||o.length+s.length!==40)throw new Error("OpenSSH only supports DSA signatures with SHA1 hash");return t.writeBuffer(i.concat([o,s])),t.toBuffer()}if("ssh"===e&&"ecdsa"===this.type){var f=new c({}),h;o=this.part.r.data,f.writeBuffer(o),f.writePart(this.part.s),t=new c({}),0===o[0]&&(o=o.slice(1));var p=8*o.length;return 256===p?h="nistp256":384===p?h="nistp384":528===p&&(h="nistp521"),t.writeString("ecdsa-sha2-"+h),t.writeBuffer(f.toBuffer()),t.toBuffer()}throw new Error("Invalid signature format");default:throw new Error("Invalid signature data")}},p.prototype.toString=function(e){return r.optionalString(e,"format"),this.toBuffer(e).toString("base64")},p.parse=function(e,t,n){"string"==typeof e&&(e=i.from(e,"base64")),r.buffer(e,"data"),r.string(n,"format"),r.string(t,"type");var o={};o.type=t.toLowerCase(),o.parts=[];try{switch(r.ok(e.length>0,"signature must not be empty"),o.type){case"rsa":case"ed25519":return d(e,t,n,o);case"dsa":case"ecdsa":return"asn1"===n?m(e,t,n,o):"dsa"===o.type?g(e,t,n,o):y(e,t,n,o);default:throw new f(t)}}catch(e){if(e instanceof f)throw e;throw new h(t,n,e)}},p.isSignature=function(e,t){return u.isCompatible(e,p,t)},p.prototype._sshpkApiVersion=[2,1],p._oldVersionDetect=function(e){return r.func(e.toBuffer),e.hasOwnProperty("hashAlgorithm")?[2,0]:[1,0]}},function(e,t,n){var r=n(1853);e.exports={Ber:r,BerReader:r.Reader,BerWriter:r.Writer}},function(e,t,n){"use strict";function r(e,t){t|=0;for(var n=Math.max(e.length-t,0),r=Array(n),i=0;i=this.buf.length},a.prototype.finished=a.prototype.eof,a.prototype.read=function(e){i.checkArgument(!r.isUndefined(e),"Must specify a length");var t=this.buf.slice(this.pos,this.pos+e);return this.pos=this.pos+e,t},a.prototype.readAll=function(){var e=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,e},a.prototype.readUInt8=function(){var e=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,e},a.prototype.readUInt16BE=function(){var e=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,e},a.prototype.readUInt16LE=function(){var e=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,e},a.prototype.readUInt32BE=function(){var e=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,e},a.prototype.readUInt32LE=function(){var e=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,e},a.prototype.readUInt64BEBN=function(){var e=this.buf.slice(this.pos,this.pos+8),t=s.fromBuffer(e);return this.pos=this.pos+8,t},a.prototype.readUInt64LEBN=function(){var e=this.buf.readUInt32LE(this.pos),t=this.buf.readUInt32LE(this.pos+4),n=4294967296*t+e,r;if(n<=9007199254740991)r=new s(n);else{var i=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);r=new s(i,10,"le")}return this.pos=this.pos+8,r},a.prototype.readVarintNum=function(){var e=this.readUInt8();switch(e){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var t=this.readUInt64LEBN(),n=t.toNumber();if(n<=Math.pow(2,53))return n;throw new Error("number too large to retain precision - use readVarintBN");default:return e}},a.prototype.readVarLengthBuffer=function(){var e=this.readVarintNum(),t=this.read(e);return i.checkState(t.length===e,"Invalid length while reading varlength buffer. Expected to read: "+e+" and read "+t.length),t},a.prototype.readVarintBuf=function(){var e=this.buf.readUInt8(this.pos);switch(e){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}},a.prototype.readVarintBN=function(){var e=this.readUInt8();switch(e){case 253:return new s(this.readUInt16LE());case 254:return new s(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new s(e)}},a.prototype.reverse=function(){for(var e=new t(this.buf.length),n=0;n=w.outputs.length)return new t(d,"hex");for(w.outputs.length=p+1,v=0;v9007199254740991?"transaction txout satoshis greater than max safe integer":this._satoshis!==this._satoshisBN.toNumber()?"transaction txout satoshis has corrupted value":this._satoshis<0&&"transaction txout negative"},p.prototype.toObject=p.prototype.toJSON=function e(){var t={satoshis:this.satoshis};return t.script=this._scriptBuffer.toString("hex"),t},p.fromObject=function(e){return new p(e)},p.prototype.setScriptFromBuffer=function(e){this._scriptBuffer=e;try{this._script=l.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(e){if(!(e instanceof f.Script.InvalidBuffer))throw e;this._script=null}},p.prototype.setScript=function(e){if(e instanceof l)this._scriptBuffer=e.toBuffer(),this._script=e,this._script._isOutput=!0;else if(r.isString(e))this._script=l.fromString(e),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else{if(!s.isBuffer(e))throw new TypeError("Invalid argument type: script");this.setScriptFromBuffer(e)}return this},p.prototype.inspect=function(){var e;return e=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),""},p.fromBufferReader=function(e){var t={};t.satoshis=e.readUInt64LEBN();var n=e.readVarintNum();return t.script=0!==n?e.read(n):new o.Buffer([]),new p(t)},p.prototype.toBufferWriter=function(e){e||(e=new u),e.writeUInt64LEBN(this._satoshisBN);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e},e.exports=p},function(e,t,n){"use strict";const r=n(59),i=n(200);function o(e,t){r(e,i(e=>t(null,e)),e=>{e&&t(e)})}e.exports=o},function(e,t,n){e.exports={read:k,write:S};var r=n(27),i=n(103),o=n(15),s=n(31).Buffer,a=n(55),u=n(47),l=n(46),c=n(50),f=n(380),h=n(211),p=n(287),d=n(114),m=n(97),g="1.2.840.113549.1.5.13",y="1.2.840.113549.1.5.12",b={"1.2.840.113549.3.7":"3des-cbc","2.16.840.1.101.3.4.1.2":"aes128-cbc","2.16.840.1.101.3.4.1.42":"aes256-cbc"},v={};Object.keys(b).forEach(function(e){v[b[e]]=e});var w={"1.2.840.113549.2.7":"sha1","1.2.840.113549.2.9":"sha256","1.2.840.113549.2.11":"sha512"},_={};function k(e,t,n){var a=e;"string"!=typeof e&&(r.buffer(e,"buf"),e=e.toString("ascii"));for(var l=e.trim().split(/[\r\n]+/g),c,v=-1,_;!c&&v0;)_=l[--k].match(/[-]+[ ]*END ([A-Z0-9][A-Za-z0-9]+ )?(PUBLIC|PRIVATE) KEY[ ]*[-]+/);r.ok(_,"invalid PEM footer"),r.equal(c[2],_[2]);var S=c[2].toLowerCase(),E;c[1]&&(r.equal(c[1],_[1],"PEM header and footer mismatch"),E=c[1].trim()),l=l.slice(v,k+1);for(var x={},C,A,I;l=l.slice(1),c=l[0].match(/^([A-Za-z0-9-]+): (.+)$/),c;)x[c[1].toLowerCase()]=c[2];if(l=l.slice(0,-1).join(""),e=s.from(l,"base64"),x["proc-type"]){var T=x["proc-type"].split(",");if("4"===T[0]&&"ENCRYPTED"===T[1]){if("string"==typeof t.passphrase&&(t.passphrase=s.from(t.passphrase,"utf-8")),!s.isBuffer(t.passphrase))throw new m.KeyEncryptedError(t.filename,"PEM");T=x["dek-info"].split(","),r.ok(2===T.length),C=T[0].toLowerCase(),I=s.from(T[1],"hex"),A=u.opensslKeyDeriv(C,I,t.passphrase,1).key}}if(E&&"encrypted"===E.toLowerCase()){var j=new i.BerReader(e),O;j.readSequence(),j.readSequence(),O=j.offset+j.length;var P=j.readOID();if(P!==g)throw new Error("Unsupported PEM/PKCS8 encryption scheme: "+P);j.readSequence(),j.readSequence();var B=j.offset+j.length,R=j.readOID();if(R!==y)throw new Error("Unsupported PBES2 KDF: "+R);j.readSequence();var N=j.readString(i.Ber.OctetString,!0),M=j.readInt(),L="sha1";if(j.offsetp.length&&(b=p.length),g+=m.write(p.slice(y,b),g),m[g++]=10,y=b}return g+=m.write("-----END "+a+"-----\n",g),m.slice(0,g)}Object.keys(w).forEach(function(e){_[w[e]]=e})},function(e,t,n){e.exports={read:h.bind(void 0,!1,void 0),readType:h.bind(void 0,!1),write:p,readPartial:h.bind(void 0,!0),readInternal:h,keyTypeToAlg:f,algToKeyType:c};var r=n(27),i=n(31).Buffer,o=n(55),s=n(47),a=n(46),u=n(50),l=n(210);function c(e){if(r.string(e),"ssh-dss"===e)return"dsa";if("ssh-rsa"===e)return"rsa";if("ssh-ed25519"===e)return"ed25519";if("ssh-curve25519"===e)return"curve25519";if(e.match(/^ecdsa-sha2-/))return"ecdsa";throw new Error("Unknown algorithm "+e)}function f(e){if(r.object(e),"dsa"===e.type)return"ssh-dss";if("rsa"===e.type)return"ssh-rsa";if("ed25519"===e.type)return"ssh-ed25519";if("curve25519"===e.type)return"ssh-curve25519";if("ecdsa"===e.type)return"ecdsa-sha2-"+e.part.curve.data.toString();throw new Error("Unknown key type "+e.type)}function h(e,t,n,f){"string"==typeof n&&(n=i.from(n)),r.buffer(n,"buf");var h={},p=h.parts=[],d=new l({buffer:n}),m=d.readString();r.ok(!d.atEnd(),"key must have at least one part"),h.type=c(m);var g=o.info[h.type].parts.length;for(t&&"private"===t&&(g=o.privInfo[h.type].parts.length);!d.atEnd()&&p.length=1,"key must have at least one part"),r.ok(e||d.atEnd(),"leftover bytes at end of key");var y=a,b=o.info[h.type];if("private"!==t&&b.parts.length===p.length||(b=o.privInfo[h.type],y=u),r.strictEqual(b.parts.length,p.length),"ecdsa"===h.type){var v=/^ecdsa-sha2-(.+)$/.exec(m);r.ok(null!==v),r.strictEqual(v[1],p[0].data.toString())}for(var w=!0,_=0;_!e.status)}static p_connectedNames(e){const t=this._connected().map(e=>e.name);if(!e)return new Promise((e,n)=>e(t));e(null,t)}static async p_connectedNamesParm(){return(await this.p_connectedNames()).map(e=>"transport="+e).join("&")}static p_statuses(e){const t=c._transports.map(e=>({name:e.name,status:e.status}));if(!e)return new Promise((e,n)=>e(t));e(null,t)}static validFor(e,t,n){return"string"==typeof e&&(e=[e]),e&&e[0]||["store","newlisturls","newdatabase","newtable","seed"].includes(t)?e&&e.length>0?[].concat(...e.map(e=>"string"==typeof e?r.parse(e):e).map(e=>this._transports.filter(r=>r.validFor(e,t,n)).map(t=>[e,t]))):this._transports.filter(e=>e.validFor(void 0,t,n)).map(e=>[void 0,e]):(console.error("Transports.validFor called with invalid arguments: urls=",e,"func=",t),[])}static async p_urlsValidFor(e,t,n){return this.validFor(e,t,n).map(e=>e[0])}static http(){return c._connected().find(e=>"HTTP"===e.name)}static wolk(){return c._connected().find(e=>"WOLK"===e.name)}static ipfs(){return c._connected().find(e=>"IPFS"===e.name)}static webtorrent(){return c._connected().find(e=>"WEBTORRENT"===e.name)}static gun(){return c._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 togglePaused(e,t){const n=this._transports.find(t=>t.name===e);n?n.togglePaused(e=>t(null,e.status)):t(void 0)}static async _p_rawstore(e,t){let n=[],r=await Promise.all(e.map(async function(e){try{s("Storing %d bytes to %s",t.length,e.name);let r=await e.p_rawstore(t);return s("Storing %d bytes to %s succeeded: %s",t.length,e.name,r),r}catch(r){return s("Storing %d bytes to %s failed: %s",t.length,e.name,r.message),void n.push(r)}}));if(r=r.filter(e=>!!e),!r.length)throw s("Storing %d bytes failed on all transports",t.length),new i.TransportError(n.map(e=>e.message).join(", "));return r}static async p_rawstore(e){let t=this.validFor(void 0,"store").map(([e,t])=>t);if(!t.length)throw s("Storing %d bytes failed: no transports available",e.length),new i.TransportError("Transports.p_rawstore: Cant find transport for store");return this._p_rawstore(t,e)}static async p_rawfetch(e,t={}){if(!e.length)throw new i.TransportError("Transports.p_rawfetch given an empty list of urls");let n=await this.p_resolveNames(e);if(!n.length)throw new i.TransportError("Transports.p_rawfetch none of the urls resolved: "+e);let r=this.validFor(n,"fetch",{noCache:t.noCache});if(!r.length)throw new i.TransportError("Transports.p_rawfetch cant find any transport for urls: "+n);let o=[],a=[];for(const[e,n]of r)try{s("Fetching %s via %s",e.href,n.name);let r=await n.p_rawfetch(e,t);return s("Fetching %s via %s succeeded %d bytes",e.href,n.name,r.length),t.relay&&a.length&&(s("Fetching attempting relay of %d bytes from %s to %o",r.length,e.href,a.map(e=>e.name)),this._p_rawstore(a,r).then(e=>s("Fetching relayed %d bytes to %o",r.length,e))),r}catch(t){a.push(n),o.push(t),s("Fetching %s via %s failed: %s",e.href,n.name,t.message)}throw s("Fetching %o failed on all transports",e),new i.TransportError(o.map(e=>e.message).join(", "))}static fetch(e,t={},n){"function"==typeof t&&(n=t,t={});const r=this.p_rawfetch(e,t);if(!n)return r;r.then(e=>{try{n(null,e)}catch(e){s("Uncaught error in fetch %O",e)}}).catch(e=>n(e))}static seed({directoryPath:e,fileRelativePath:t,ipfsHash:n,urlToFile:r,torrentRelativePath:i},o){if(!o)return new Promise((e,t)=>{try{a.call(this,(n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{a.call(this,o)}catch(e){o(e)}function a(o){let a=this.validFor(void 0,"seed").map(([e,t])=>t);if(a.length){const s={};u(a,(o,a)=>o.seed({directoryPath:e,torrentRelativePath:i,fileRelativePath:t,ipfsHash:n,urlToFile:r},(e,t)=>{s[o.name]=e?{err:e.message}:t,a(null)}),e=>o(null,s))}else s("Seeding: no transports available"),o(null)}}static async p_rawlist(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"list");if(!t.length)throw new i.TransportError('Transports.p_rawlist: Cant find transport to "list" urls:'+e.join(","));let n=[],r=await Promise.all(t.map(async function([e,t]){try{s("Listing %s via %s",e,t.name);let r=await t.p_rawlist(e);return s("Listing %s via %s retrieved %d items",e,t.name,r.length),r}catch(r){return s("Listing %s via %s failed: %s",e,t.name,r.message),n.push(r),[]}}));if(n.length>=t.length)throw s("Listing %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "));let o={};return[].concat(...r).filter(e=>!o[e.signature]&&(o[e.signature]=!0))}static async p_rawadd(e,t){e=await this.p_resolveNames(e);let n=this.validFor(e,"add");if(!n.length)throw s("Adding to %o failed: no transports available",e),new i.TransportError("Transports.p_rawstore: Cant find transport for urls:"+e.join(","));let r=[];if(await Promise.all(n.map(async function([e,n]){try{return s("Adding to %s via %s",e,n.name),await n.p_rawadd(e,t),void s("Adding to %s via %s succeeded",e,n.name)}catch(t){return s("Adding to %s via %s failed: %s",e,n.name,t.message),void r.push(t)}})),r.length>=n.length)throw s("Adding to %o failed on all transports",e),new i.TransportError(r.map(e=>e.message).join(", "))}static listmonitor(e,t,n={}){this.validFor(e,"listmonitor").map(([e,r])=>{r.listmonitor(e,t,n),s("Monitoring list %s via %s",e,r.name)})}static async p_newlisturls(e){let t=await Promise.all(this.validFor(void 0,"newlisturls").map(([t,n])=>n.p_newlisturls(e)));return[t.map(e=>e[0]),t.map(e=>e[1])]}static async p_f_createReadStream(e,{wanturl:t=!1,preferredTransports:n=[]}={}){let r=this.validFor(e,"createReadStream",{});if(!r.length)throw s("Opening stream from %o failed: no transports available",e),new i.TransportError("Transports.p_createReadStream cant find any transport for urls: "+e);let o=[];r.sort((e,t)=>(n.indexOf(e[1].name)+1||999+Math.random())-(n.indexOf(t[1].name)+1||999+Math.random()));for(const[e,n]of r)try{s("Opening stream from %s via %s",e.href,n.name);let r=await n.p_f_createReadStream(e,{wanturl:t});return s("Opening stream from %s via %s succeeded",e.href,n.name),r}catch(t){o.push(t),s("Opening stream from %s via %s failed: %s",e.href,n.name,t.message)}throw s("Opening stream from %o failed on all transports",e),new i.TransportError(o.map(e=>e.message).join(", "))}static createReadStream(e,t,n){"function"==typeof t&&(n=t,t={start:0}),DwebTransports.p_f_createReadStream(e,{preferredTransports:t.preferredTransports||[]}).then(e=>{let r=e(t);if(!n)return r;n(null,r)}).catch(e=>{e instanceof i.TransportError?console.warn("Transports.createReadStream caught",e.message):console.error("Transports.createReadStream caught",e),n?n(e):reject(e)})}static async p_get(e,t){let n=this.validFor(e,"get"),r=Array.isArray(t)?`${t.length} keys`:t;if(!n.length)throw s("Getting %s from %o failed: no transports available",r,e),new i.TransportError("Transports.p_get cant find any transport to get keys from urls: "+e);let o=[];for(const[e,i]of n)try{s("Getting %s from %s via %s",r,e.href,i.name);let n=await i.p_get(e,t);return s("Getting %s from %s via %s succeeded length=%d",r,e.href,i.name,n.length),n}catch(t){o.push(t),s("Getting %s from %s via %s failed: %s",r,e.href,i.name,t.message)}throw s("Getting %s from %o failed on all transports",r,e),new i.TransportError(o.map(e=>e.message).join(", "))}static async p_set(e,t,n){e=await this.p_resolveNames(e);let r="object"==typeof t?`${t.length} keys`:t,o=this.validFor(e,"set");if(!o.length)throw s("Setting %s on %o failed: no transports available",r,e),new i.TransportError("Transports.p_set cant find any transport for urls: "+e);let a=[],u=!1;if(await Promise.all(o.map(async function([e,i]){try{s("Setting %s on %s via %s",r,e.href,i.name),await i.p_set(e,t,n),s("Setting %s on %s via %s succeeded",r,e.href,i.name),u=!0}catch(t){s("Setting %s on %s via %s failed: %s",r,e.href,i.name,t.message),a.push(t)}})),!u)throw s("Setting %s on %o failed on all transports",r,e),new i.TransportError(a.map(e=>e.message).join(", "))}static async p_delete(e,t){e=await this.p_resolveNames(e);let n=Array.isArray(t)?`${t.length} keys`:t,r=this.validFor(e,"set");if(!r.length)throw s("Deleting %s on %o failed: no transports available",n,e),new i.TransportError("Transports.p_set cant find any transport for urls: "+e);let o=[],a=!1;if(await Promise.all(r.map(async function([e,r]){try{s("Deleting %s on %s via %s",n,e.href,r.name),await r.p_delete(e,t),s("Deleting %s on %s via %s succeeded",n,e.href,r.name),a=!0}catch(t){s("Deleting %s on %s via %s failed: %s",n,e.href,r.name,t.message),o.push(t)}})),!a)throw s("Deleting %s on %o failed on all transports",n,e),new i.TransportError(o.map(e=>e.message).join(", "))}static async p_keys(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"keys");if(!t.length)throw s("Getting all keys on %o failed: no transports available",e),new i.TransportError("Transports.p_keys cant find any transport for urls: "+e);let n=[];for(const[e,r]of t)try{s("Getting all keys on %s via %s",e.href,r.name);let t=await r.p_keys(e);return s("Getting all keys on %s via %s succeeded with %d keys",e.href,r.name,t.length),t}catch(t){n.push(t),s("Getting all keys on %s via %s failed: %s",e.href,r.name,t.message)}throw s("Getting all keys on %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "))}static async p_getall(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"getall");if(!t.length)throw s("Getting all values on %o failed: no transports available",e),new i.TransportError("Transports.p_getall cant find any transport for urls: "+e);let n=[];for(const[e,r]of t)try{s("Getting all values on %s via %s",e.href,r.name);let t=await r.p_getall(e);return s("Getting all values on %s via %s succeeded with %d values",e.href,r.name,t.length),t}catch(t){n.push(t),s("Getting all values on %s via %s failed: %s",e.href,r.name,t.message)}throw s("Getting all keys on %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "))}static async p_newdatabase(e){let t=await Promise.all(this.validFor(void 0,"newdatabase").map(([t,n])=>n.p_newdatabase(e)));return{privateurls:t.map(e=>e.privateurl),publicurls:t.map(e=>e.publicurl)}}static async p_newtable(e,t){let n=await Promise.all(this.validFor(void 0,"newtable").map(([n,r])=>r.p_newtable(e,t)));return{privateurls:n.map(e=>e.privateurl),publicurls:n.map(e=>e.publicurl)}}static async p_connection(e){e=await this.p_resolveNames(e),await Promise.all(this.validFor(e,"connection").map(([e,t])=>t.p_connection(e)))}static monitor(e,t,{current:n=!1}={}){this.validFor(e,"monitor").map(([e,r])=>{s("Monitoring table %s via %s",e,r.name),r.monitor(e,t,{current:n})})}static addtransport(e){c._transports.push(e)}static setup0(e,t,n){let r={http:{urlbase:"http://localhost:4244"}};return e.map(e=>{let n=this._transportclasses["LOCAL"===e?"HTTP":e];return n?(s("Setting up connection to %s with options %o",e,t),n.setup0("LOCAL"===e?r:t)):void s("Connection to %s unavailable",e)}).filter(e=>!!e)}static p_setup1(e,t){const n=Promise.all(this._transports.filter(e=>!this._optionspaused.includes(e.name)).map(t=>(s("Connection stage 1 to %s",t.name),t.p_setup1(e))));if(!t)return n;n.catch(e=>t(e)).then(e=>t(null,e))}static p_setup2(e,t){const n=Promise.all(this._transports.filter(e=>!this._optionspaused.includes(e.name)).map(t=>(s("Connection stage 2 to %s",t.name),t.p_setup2(e))));if(!t)return n;n.catch(e=>t(e)).then(e=>t(null,e))}static p_stop(e,t){if(!t)return new Promise((e,t)=>{try{n.call(this,(n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{n.call(this,t)}catch(e){t(e)}function n(t){l(this._connected(),(t,n)=>{s("Stopping %s",t.name),t.stop(e,n)},t)}}static async refreshstatus(e){let t=["transportstatus0","transportstatus1","transportstatus2","transportstatus3","transportstatus4"],n=e.statuselement;n&&(n.classList.remove(...t),n.classList.add(t[e.status])),c.statuscb&&c.statuscb(e)}static connect(e,t){const n=this.p_connect(e);if(!t)return n;n.catch(e=>t(e)).then(e=>t(null,e))}static async p_connect(e){try{e=e||{};let t=e.transports;this._optionspaused=(e.paused||[]).map(e=>e.toUpperCase()),t&&t.length||(t=e.defaulttransports||[]),t.length||(t=["HTTP","IPFS","WEBTORRENT","WOLK"]),t=t.map(e=>e.toUpperCase());let n=this.setup0(t,e);if(["statuscb","mirror"].forEach(t=>{e[t]&&(this[t]=e[t])}),e.statuselement){let t=e.statuselement;for(;t.lastChild;)t.removeChild(t.lastChild);t.appendChild(o.createElement("UL",{},n.map(e=>{let t=o.createElement("LI",{onclick:"this.source.togglePaused(DwebTransports.refreshstatus);",source:e,name:e.name},e.name);return e.statuselement=t,t})))}await this.p_setup1(this.refreshstatus),await this.p_setup2(this.refreshstatus),s("Connection completed to %o",this._connected().map(e=>e.name))}catch(e){throw console.error("ERROR in p_connect:",e.message),e}}static async p_urlsFrom(e){if("string"==typeof e&&(e="["===e[0]?JSON.parse(e):e.includes(",")?e.split(","):[e]),!Array.isArray(e))throw new Error(`Unparsable url: ${e}`);return e}static async p_httpfetchurl(e){return c.http()._url(e.find(e=>e.startsWith("contenthash")||e.startsWith("http")),"content/rawfetch")}static canonicalName(e,t={}){"string"!=typeof e&&(e=r.parse(e).href);const n=["dweb.me","ipfs.io"],i=["ipfs","gun","magnet","yjs","wolk","arc","contenthash","http","https"],o=["arc","http","https"],s=[/^http[s]?:[/]+([^/]+)[/](\w+)[/](.*)/i],a=[/^dweb:[/]+(\w+)[/]+(.*)/i,/^\w+:[/]+(\w+)[/](.*)/i,/^(\w+):[/]*(.*)/i,/^[/]*(\w+)[/](.*)/i,/^[/]*dweb[/]*(\w+)[/](.*)/i],u=[/^http[s]?:[/]+[^/]+[/](archive).(org)[/]*(.*)/i,/^http[s]?:[/]+[^/]+[/]arc[/](archive).(org)[/]*(.*)/i,/^http[s]?:[/]+dweb.(\w+)[.]([^/]+)[/]*(.*)/i,/^(http[s])?:[/]+([^/]+)[/]+(.*)/i];for(let t of s){let r=e.match(t);if(r&&n.includes(r[1])&&i.includes(r[2]))return{proto:r[2],internal:r[3]}}for(let t of u){let n=e.match(t);if(n)return i.includes(n[1])?{proto:n[1],internal:o.includes(n[1])?[n[2],n[3]].join("/"):n[3]}:{proto:"arc",internal:[[n[1],n[2]].join("."),n[3]].join("/")}}for(let t of a){let n=e.match(t);if(n&&i.includes(n[1]))return{proto:n[1],internal:n[2]}}}static canonicalUrl(e,t={}){let n=this.canonicalName(e,t);return n.protocol+":/"+n.internal}static _o2url(e){return["http","https"].includes(e.proto)?[e.proto,e.internal].join("://"):e.proto?[this.mirror,e.proto,e.internal].join("/"):e.internal}static gatewayUrl(e){let t=c.canonicalName(e);return t?this._o2url(t):e}static gatewayUrls(e){const t=e.map(e=>c.canonicalName(e)||{proto:void 0,internal:e}),n=t.filter(e=>["arc"].includes(e.proto));return(n.length?n:t).map(e=>this._o2url(e))}}c._transports=[],c.namingcb=void 0,c._transportclasses={},c.httptools=a,t=e.exports=c},function(e,t,n){"use strict";var r=n(10),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=f;var o=n(7);o.inherits=n(1);var s=n(431),a=n(303);o.inherits(f,s);for(var u=i(a.prototype),l=0;l`}toJSON(){return this._json||(this._json=Object.freeze({name:this.name,size:this.size,cid:this._cid.toBaseEncodedString()})),Object.assign({},this._json)}get name(){return this._name}get nameAsBuffer(){return null!==this._nameBuf?this._nameBuf:(this._nameBuf=r.from(this._name),this._nameBuf)}set name(e){throw new Error("Can't set property: 'name' is immutable")}get size(){return this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}get cid(){return this._cid}set cid(e){throw new Error("Can't set property: 'cid' is immutable")}}t=e.exports=s(a,{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"}),t.create=n(885),t.util=n(886)}).call(this,n(0).Buffer)},function(e,t,n){var r=n(19);e.exports=r.md=r.md||{},r.md.algorithms=r.md.algorithms||{}},function(e,t,n){var r=n(4).Buffer,i=n(57).Transform,o=n(16).StringDecoder,s=n(1);function a(e){i.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}s(a,i),a.prototype.update=function(e,t,n){"string"==typeof e&&(e=r.from(e,t));var i=this._update(e);return this.hashMode?this:(n&&(i=this._toString(i,n)),i)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(e,t,n){var r;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){r=e}finally{n(r)}},a.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},a.prototype._finalOrDigest=function(e){var t=this.__final()||r.alloc(0);return e&&(t=this._toString(t,e,!0)),t},a.prototype._toString=function(e,t,n){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var r=this._decoder.write(e);return n&&(r+=this._decoder.end()),r},e.exports=a},function(e,t,n){"use strict";const r=n(5),i=(e,t)=>{const n=["bitswap"];t&&n.push(t),e&&n.push(`${e.toB58String().slice(0,8)}`);const i=r(n.join(":"));return i.error=r(n.concat(["error"]).join(":")),i},o=(e,t,n)=>{let r=0;const i=n.length;for(;r{let n=0;const r=t.length,i=[];let s;for(;nt.reduce((t,n)=>{const r=e(n);return t[r]?t[r].push(n):t[r]=[n],t},{}),u=(e,t,n)=>t.filter(t=>!o(e,t,n)),l=(e,t)=>Array.prototype.slice.call(t,0).sort((t,n)=>{const r=e(t),i=e(n);return ri?1:0});e.exports={logger:i,includesWith:o,uniqWith:s,groupBy:a,pullAllWith:u,sortBy:l}},function(e,t,n){var r=n(1004),i=n(1007);function o(e,t){var n=i(e,t);return r(n)?n:void 0}e.exports=o},function(e,t,n){var r=n(490),i=n(73),o=n(256),s=n(257);function a(e){var t=0;return function(n,r,i){t++||e(n,r,i)}}function u(e){return"function"==typeof e}e.exports=function(e,t){u(e)&&(t=e,e={}),t=a(t||function e(){});var n=r(e&&e.timeout||5e3),l=i(function(e){e&&t(e)}),c=s();return{handshake:{read:n.read,abort:function(e){l.end(e),n.abort(e,function(e){}),t(e)},write:l.push,rest:function(){return l.end(),{source:n.read(),sink:c.sink}}},sink:n,source:o([l,c.source])}}},function(e,t,n){"use strict";(function(t){const r=n(12),i=n(43),o=n(81),s=n(78),a=n(77),u=n(9),l=n(1245).createResolver;function c(e){let n=e,r="/";if(t.isBuffer(e)&&(n=new u(e).toBaseEncodedString()),"string"==typeof e){0===e.indexOf("/ipfs/")&&(e=n=e.substring(6));const t=e.indexOf("/");t>0&&(n=e.substring(0,t),r=e.substring(t))}else u.isCID(n)&&(n=n.toBaseEncodedString());return n=new u(n).toBaseEncodedString(),{base:n,rest:p(r)}}const f={maxDepth:1/0,offset:void 0,length:void 0,fullPath:!1};function h(e){return e.reduce((e,t)=>(e.length&&(e+="/"),e+t),"")}e.exports=((e,t,n)=>{let p;n=Object.assign({},f,n);try{p=c(e)}catch(e){return o(e)}const d=h([p.base].concat(p.rest.slice(0,p.rest.length-1))).length,m=new u(p.base);return r(i([{multihash:m.buffer,name:p.base,path:p.base,pathRest:p.rest,depth:0}]),l(t,n),s(Boolean),a(e=>({depth:e.depth,name:e.name,path:n.fullPath?e.path:g(e),size:e.size,hash:e.multihash,content:e.content,type:e.type})));function g(e){if(!p.rest.length)return e.path;let t=e.path.substring(d);return"/"===t.charAt(0)&&(t=t.substring(1)),t||(t=p.rest[p.rest.length-1]||p.base),t}});const p=(e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean)}).call(this,n(0).Buffer)},function(e,t,n){(function(t){const r=n(63),i=n(74).ec,o=new i("secp256k1"),s=n(1351),a=t.alloc(32,0),u=t.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),l=t.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex"),c=o.curve.n,f=c.shrn(1),h=o.curve.g,p="Expected Private",d="Expected Point",m="Expected Tweak",g="Expected Hash",y="Expected Signature",b="Expected Extra Data (32 bytes)";function v(e){return t.isBuffer(e)&&32===e.length}function w(e){return!!v(e)&&e.compare(u)<0}function _(e){if(!t.isBuffer(e))return!1;if(e.length<33)return!1;const n=e[0],r=e.slice(1,33);if(0===r.compare(a))return!1;if(r.compare(l)>=0)return!1;if((2===n||3===n)&&33===e.length){try{T(e)}catch(e){return!1}return!0}const i=e.slice(33);return 0!==i.compare(a)&&(!(i.compare(l)>=0)&&(4===n&&65===e.length))}function k(e){return 4!==e[0]}function S(e){return!!_(e)&&k(e)}function E(e){return!!v(e)&&(e.compare(a)>0&&e.compare(u)<0)}function x(e){const n=e.slice(0,32),r=e.slice(32,64);return t.isBuffer(e)&&64===e.length&&n.compare(u)<0&&r.compare(u)<0}function C(e,t){return void 0===e&&void 0!==t?k(t):void 0===e||e}function A(e){return new r(e)}function I(e){return e.toArrayLike(t,"be",32)}function T(e){return o.curve.decodePoint(e)}function j(e,n){return t.from(e._encode(n))}function O(e,t,n){if(!_(e))throw new TypeError(d);if(!_(t))throw new TypeError(d);const r=T(e),i=T(t),o=r.add(i);if(o.isInfinity())return null;const s=C(n,e);return j(o,s)}function P(e,t,n){if(!_(e))throw new TypeError(d);if(!w(t))throw new TypeError(m);const r=C(n,e),i=T(e);if(0===t.compare(a))return j(i,r);const o=A(t),s=h.mul(o),u=i.add(s);return u.isInfinity()?null:j(u,r)}function B(e,t){if(!_(e))throw new TypeError(d);const n=T(e);if(n.isInfinity())throw new TypeError(d);return j(n,t)}function R(e,t){if(!E(e))throw new TypeError(p);const n=A(e),r=h.mul(n);if(r.isInfinity())return null;const i=C(t);return j(r,i)}function N(e,t,n){if(!_(e))throw new TypeError(d);if(!w(t))throw new TypeError(m);const r=C(n,e),i=T(e),o=A(t),s=i.mul(o);return s.isInfinity()?null:j(s,r)}function M(e,t){if(!E(e))throw new TypeError(p);if(!w(t))throw new TypeError(m);const n=A(e),r=A(t),i=I(n.add(r).umod(c));return E(i)?i:null}function L(e,t){if(!E(e))throw new TypeError(p);if(!w(t))throw new TypeError(m);const n=A(e),r=A(t),i=I(n.sub(r).umod(c));return E(i)?i:null}function F(e,t){return U(e,t)}function D(e,t,n){return U(e,t,n)}function U(e,n,r){if(!v(e))throw new TypeError(g);if(!E(n))throw new TypeError(p);if(void 0!==r&&!v(r))throw new TypeError(b);const i=A(n),o=A(e);let a,u;const l=function(e){const t=A(e),n=h.mul(t);return!n.isInfinity()&&(a=n.x.umod(c),0!==a.isZero()&&(u=t.invm(c).mul(o.add(i.mul(a))).umod(c),0!==u.isZero()))};s(e,n,l,E,r),u.cmp(f)>0&&(u=c.sub(u));const d=t.allocUnsafe(64);return I(a).copy(d,0),I(u).copy(d,32),d}function z(e,t,n){if(!v(e))throw new TypeError(g);if(!_(t))throw new TypeError(d);if(!x(n))throw new TypeError(y);const r=T(t),i=A(n.slice(0,32)),o=A(n.slice(32,64));if(i.gtn(0)<=0)return!1;if(o.gtn(0)<=0)return!1;const s=A(e),a=o.invm(c),u=s.mul(a).umod(c),l=i.mul(a).umod(c),f=h.mulAdd(u,r,l);if(f.isInfinity())return!1;const p=f.x,m=p.umod(c);return m.eq(i)}e.exports={isPoint:_,isPointCompressed:S,isPrivate:E,pointAdd:O,pointAddScalar:P,pointCompress:B,pointFromScalar:R,pointMultiply:N,privateAdd:M,privateSub:L,sign:F,signWithEntropy:D,verify:z}}).call(this,n(0).Buffer)},function(e,t){function n(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:function(){let e=n.call(this);return this[t]=e,e},set:function(e){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}})}function r(e){let t;return function(){return void 0!==t?t:(t=e(),t)}}e.exports={prop:n,value:r}},function(e,t,n){"use strict";t.ethAccountSnapshot=n(586),t.ethBlock=n(591),t.ethBlockList=n(1416),t.ethStateTrie=n(1417),t.ethStorageTrie=n(1420),t.ethTx=n(593),t.ethTxTrie=n(1423)},function(e,t,n){(function(e){!function(e,t){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(null!==e&&"object"==typeof e&&Array.isArray(e.words))return e;this.sign=!1,this.words=null,this.length=0,this.red=null,"le"!==t&&"be"!==t||(n=t,t=10),null!==e&&this._init(e||0,t||10,n||"be")}function o(e,t,n){for(var r=0,i=Math.min(e.length,n),o=t;o=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function s(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function e(t,r,i){if("number"==typeof t)return this._initNumber(t,r,i);if("object"==typeof t)return this._initArray(t,r,i);"hex"===r&&(r=16),n(r===(0|r)&&r>=2&&r<=36),t=t.toString().replace(/\s+/g,"");var o=0;"-"===t[0]&&o++,16===r?this._parseHex(t,o):this._parseBase(t,r,o),"-"===t[0]&&(this.sign=!0),this.strip(),"le"===i&&this._initArray(this.toArray(),r,i)},i.prototype._initNumber=function e(t,r,i){t<0&&(this.sign=!0,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),r,i)},i.prototype._initArray=function e(t,r,i){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var o=0;o=0;o-=3){var u=t[o]|t[o-1]<<8|t[o-2]<<16;this.words[a]|=u<>>26-s&67108863,s+=24,s>=26&&(s-=26,a++)}else if("le"===i)for(var o=0,a=0;o>>26-s&67108863,s+=24,s>=26&&(s-=26,a++)}return this.strip()},i.prototype._parseHex=function e(t,n){this.length=Math.ceil((t.length-n)/6),this.words=new Array(this.length);for(var r=0;r=n;r-=6){var a=o(t,r,r+6);this.words[s]|=a<>>26-i&4194303,i+=24,i>=26&&(i-=26,s++)}if(r+6!==n){var a=o(t,n,r+6);this.words[s]|=a<>>26-i&4194303}this.strip()},i.prototype._parseBase=function e(t,n,r){this.words=[0],this.length=1;for(var i=0,o=1;o<=67108863;o*=n)i++;i--,o=o/n|0;for(var a=t.length-r,u=a%i,l=Math.min(a,a-u)+r,c=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function e(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function e(){return(this.red?""};var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function e(t,r){if(t=t||10,16===t||"hex"===t){for(var i="",o=0,r=0|r||1,s=0,c=0;c>>24-o&16777215,i=0!==s||c!==this.length-1?a[6-h.length]+h+i:h+i,o+=2,o>=26&&(o-=26,c--)}for(0!==s&&(i=s.toString(16)+i);i.length%r!=0;)i="0"+i;return this.sign&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var p=u[t],d=l[t],i="",m=this.clone();for(m.sign=!1;0!==m.cmpn(0);){var g=m.modn(d).toString(t);m=m.idivn(d),i=0!==m.cmpn(0)?a[p-g.length]+g+i:g+i}return 0===this.cmpn(0)&&(i="0"+i),this.sign&&(i="-"+i),i}n(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function e(){return this.toString(16)},i.prototype.toArray=function e(t){this.strip();var n=new Array(this.byteLength());n[0]=0;var r=this.clone();if("le"!==t)for(var i=0;0!==r.cmpn(0);i++){var o=r.andln(255);r.ishrn(8),n[n.length-i-1]=o}else for(var i=0;0!==r.cmpn(0);i++){var o=r.andln(255);r.ishrn(8),n[i]=o}return n},Math.clz32?i.prototype._countBits=function e(t){return 32-Math.clz32(t)}:i.prototype._countBits=function e(t){var n=t,r=0;return n>=4096&&(r+=13,n>>>=13),n>=64&&(r+=7,n>>>=7),n>=8&&(r+=4,n>>>=4),n>=2&&(r+=2,n>>>=2),r+n},i.prototype._zeroBits=function e(t){if(0===t)return 26;var n=t,r=0;return 0==(8191&n)&&(r+=13,n>>>=13),0==(127&n)&&(r+=7,n>>>=7),0==(15&n)&&(r+=4,n>>>=4),0==(3&n)&&(r+=2,n>>>=2),0==(1&n)&&r++,r},i.prototype.bitLength=function e(){var t=0,n=this.words[this.length-1],t=this._countBits(n);return 26*(this.length-1)+t},i.prototype.zeroBits=function e(){if(0===this.cmpn(0))return 0;for(var t=0,n=0;nt.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.iand=function e(t){var n;this.sign=this.sign&&t.sign,n=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.ixor=function e(t){var n,r;this.sign=this.sign||t.sign,this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.setn=function e(t,r){n("number"==typeof t&&t>=0);for(var i=t/26|0,o=t%26;this.length<=i;)this.words[this.length++]=0;return this.words[i]=r?this.words[i]|1<t.length?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>>26}for(;0!==o&&s>>26}if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function e(t){if(t.sign){t.sign=!1;var n=this.iadd(t);return t.sign=!0,n._normSign()}if(this.sign)return this.sign=!1,this.iadd(t),this.sign=!0,this._normSign();var r=this.cmp(t),i,o;if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;r>0?(i=this,o=t):(i=t,o=this);for(var s=0,a=0;a>26,this.words[a]=67108863&n}for(;0!==s&&a>26,this.words[a]=67108863&n}if(0===s&&a>>26,s=67108863&r,a=Math.min(i,t.length-1),u=Math.max(0,i-this.length+1);u<=a;u++){var l=i-u,c=0|this.words[l],f=0|t.words[u],h=c*f,p=67108863&h;o=o+(h/67108864|0)|0,p=p+s|0,s=67108863&p,o=o+(p>>>26)|0}n.words[i]=s,r=o}return 0!==r?n.words[i]=r:n.length--,n.strip()},i.prototype._bigMulTo=function e(t,n){n.sign=t.sign!==this.sign,n.length=this.length+t.length;for(var r=0,i=0,o=0;o>>26)|0,i+=s>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()},i.prototype.mulTo=function e(t,n){var r;return r=this.length+t.length<63?this._smallMulTo(t,n):this._bigMulTo(t,n),r},i.prototype.mul=function e(t){var n=new i(null);return n.words=new Array(this.length+t.length),this.mulTo(t,n)},i.prototype.imul=function e(t){if(0===this.cmpn(0)||0===t.cmpn(0))return this.words[0]=0,this.length=1,this;var n=this.length,r=t.length;this.sign=t.sign!==this.sign,this.length=this.length+t.length,this.words[this.length-1]=0;for(var i=this.length-2;i>=0;i--){for(var o=0,s=0,a=Math.min(i,r-1),u=Math.max(0,i-n+1);u<=a;u++){var l=i-u,c=this.words[l],f=t.words[u],h=c*f,p=67108863&h;o+=h/67108864|0,p+=s,s=67108863&p,o+=p>>>26}this.words[i]=s,this.words[i+1]+=o,o=0}for(var o=0,l=1;l>>26}return this.strip()},i.prototype.imuln=function e(t){n("number"==typeof t);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),this},i.prototype.muln=function e(t){return this.clone().imuln(t)},i.prototype.sqr=function e(){return this.mul(this)},i.prototype.isqr=function e(){return this.mul(this)},i.prototype.ishln=function e(t){n("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){for(var s=0,a=0;a>>26-r}s&&(this.words[a]=s,this.length++)}if(0!==i){for(var a=this.length-1;a>=0;a--)this.words[a+i]=this.words[a];for(var a=0;a=0),o=r?(r-r%26)/26:0;var s=t%26,a=Math.min((t-s)/26,this.length),u=67108863^67108863>>>s<a){this.length-=a;for(var c=0;c=0&&(0!==f||c>=o);c--){var h=this.words[c];this.words[c]=f<<26-s|h>>>s,f=h&u}return l&&0!==f&&(l.words[l.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function e(t){return this.clone().ishln(t)},i.prototype.shrn=function e(t){return this.clone().ishrn(t)},i.prototype.testn=function e(t){n("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,o=1<=0);var r=t%26,i=(t-r)/26;if(n(!this.sign,"imaskn works only with positive numbers"),0!==r&&i++,this.length=Math.min(i,this.length),0!==r){var o=67108863^67108863>>>r<=67108864;n++)this.words[n]-=67108864,n===this.length-1?this.words[n+1]=1:this.words[n+1]++;return this.length=Math.max(this.length,n+1),this},i.prototype.isubn=function e(t){if(n("number"==typeof t),t<0)return this.iaddn(-t);if(this.sign)return this.sign=!1,this.iaddn(t),this.sign=!0,this;this.words[0]-=t;for(var r=0;r>26)-(c/67108864|0),this.words[s+i]=67108863&l}for(;s>26,this.words[s+i]=67108863&l}if(0===u)return this.strip();n(-1===u),u=0;for(var s=0;s>26,this.words[s]=67108863&l}return this.sign=!0,this.strip()},i.prototype._wordDiv=function e(t,n){var r=this.length-t.length,o=this.clone(),s=t,a=s.words[s.length-1],u=this._countBits(a);r=26-u,0!==r&&(s=s.shln(r),o.ishln(r),a=s.words[s.length-1]);var l=o.length-s.length,c;if("mod"!==n){c=new i(null),c.length=l+1,c.words=new Array(c.length);for(var f=0;f=0;p--){var d=67108864*o.words[s.length+p]+o.words[s.length+p-1];for(d=Math.min(d/a|0,67108863),o._ishlnsubmul(s,d,p);o.sign;)d--,o.sign=!1,o._ishlnsubmul(s,1,p),0!==o.cmpn(0)&&(o.sign=!o.sign);c&&(c.words[p]=d)}return c&&c.strip(),o.strip(),"div"!==n&&0!==r&&o.ishrn(r),{div:c||null,mod:o}},i.prototype.divmod=function e(t,r){if(n(0!==t.cmpn(0)),this.sign&&!t.sign){var o=this.neg().divmod(t,r),s,a;return"mod"!==r&&(s=o.div.neg()),"div"!==r&&(a=0===o.mod.cmpn(0)?o.mod:t.sub(o.mod)),{div:s,mod:a}}if(!this.sign&&t.sign){var o=this.divmod(t.neg(),r),s;return"mod"!==r&&(s=o.div.neg()),{div:s,mod:o.mod}}return this.sign&&t.sign?this.neg().divmod(t.neg(),r):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===r?{div:this.divn(t.words[0]),mod:null}:"mod"===r?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,r)},i.prototype.div=function e(t){return this.divmod(t,"div").div},i.prototype.mod=function e(t){return this.divmod(t,"mod").mod},i.prototype.divRound=function e(t){var n=this.divmod(t);if(0===n.mod.cmpn(0))return n.div;var r=n.div.sign?n.mod.isub(t):n.mod,i=t.shrn(1),o=t.andln(1),s=r.cmp(i);return s<0||1===o&&0===s?n.div:n.div.sign?n.div.isubn(1):n.div.iaddn(1)},i.prototype.modn=function e(t){n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+this.words[o])%t;return i},i.prototype.idivn=function e(t){n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=this.words[i]+67108864*r;this.words[i]=o/t|0,r=o%t}return this.strip()},i.prototype.divn=function e(t){return this.clone().idivn(t)},i.prototype.egcd=function e(t){n(!t.sign),n(0!==t.cmpn(0));var r=this,o=t.clone();r=r.sign?r.mod(t):r.clone();for(var s=new i(1),a=new i(0),u=new i(0),l=new i(1),c=0;r.isEven()&&o.isEven();)r.ishrn(1),o.ishrn(1),++c;for(var f=o.clone(),h=r.clone();0!==r.cmpn(0);){for(;r.isEven();)r.ishrn(1),s.isEven()&&a.isEven()?(s.ishrn(1),a.ishrn(1)):(s.iadd(f).ishrn(1),a.isub(h).ishrn(1));for(;o.isEven();)o.ishrn(1),u.isEven()&&l.isEven()?(u.ishrn(1),l.ishrn(1)):(u.iadd(f).ishrn(1),l.isub(h).ishrn(1));r.cmp(o)>=0?(r.isub(o),s.isub(u),a.isub(l)):(o.isub(r),u.isub(s),l.isub(a))}return{a:u,b:l,gcd:o.ishln(c)}},i.prototype._invmp=function e(t){n(!t.sign),n(0!==t.cmpn(0));var r=this,o=t.clone();r=r.sign?r.mod(t):r.clone();for(var s=new i(1),a=new i(0),u=o.clone();r.cmpn(1)>0&&o.cmpn(1)>0;){for(;r.isEven();)r.ishrn(1),s.isEven()?s.ishrn(1):s.iadd(u).ishrn(1);for(;o.isEven();)o.ishrn(1),a.isEven()?a.ishrn(1):a.iadd(u).ishrn(1);r.cmp(o)>=0?(r.isub(o),s.isub(a)):(o.isub(r),a.isub(s))}return 0===r.cmpn(1)?s:a},i.prototype.gcd=function e(t){if(0===this.cmpn(0))return t.clone();if(0===t.cmpn(0))return this.clone();var n=this.clone(),r=t.clone();n.sign=!1,r.sign=!1;for(var i=0;n.isEven()&&r.isEven();i++)n.ishrn(1),r.ishrn(1);for(;;){for(;n.isEven();)n.ishrn(1);for(;r.isEven();)r.ishrn(1);var o=n.cmp(r);if(o<0){var s=n;n=r,r=s}else if(0===o||0===r.cmpn(1))break;n.isub(r)}return r.ishln(i)},i.prototype.invm=function e(t){return this.egcd(t).a.mod(t)},i.prototype.isEven=function e(){return 0==(1&this.words[0])},i.prototype.isOdd=function e(){return 1==(1&this.words[0])},i.prototype.andln=function e(t){return this.words[0]&t},i.prototype.bincn=function e(t){n("number"==typeof t);var r=t%26,i=(t-r)/26,o=1<>>26,u&=67108863,this.words[s]=u}return 0!==a&&(this.words[s]=a,this.length++),this},i.prototype.cmpn=function e(t){var n=t<0,r;if(n&&(t=-t),this.sign&&!n)return-1;if(!this.sign&&n)return 1;if(t&=67108863,this.strip(),this.length>1)r=1;else{var i=this.words[0];r=i===t?0:it.length)return 1;if(this.length=0;r--){var i=this.words[r],o=t.words[r];if(i!==o){io&&(n=1);break}}return n},i.red=function e(t){return new g(t)},i.prototype.toRed=function e(t){return n(!this.red,"Already a number in reduction context"),n(!this.sign,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function e(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function e(t){return this.red=t,this},i.prototype.forceRed=function e(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function e(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function e(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function e(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function e(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function e(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function e(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function e(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function e(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function e(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function e(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function e(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function e(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function e(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var c={k256:null,p224:null,p192:null,p25519:null};function f(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function h(){f.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function p(){f.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function d(){f.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){f.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function g(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else this.m=e,this.prime=null}function y(e){g.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}f.prototype._tmp=function e(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},f.prototype.ireduce=function e(t){var n=t,r;do{this.split(n,this.tmp),n=this.imulK(n),n=n.iadd(this.tmp),r=n.bitLength()}while(r>this.n);var i=r0?n.isub(this.p):n.strip(),n},f.prototype.split=function e(t,n){t.ishrn(this.n,0,n)},f.prototype.imulK=function e(t){return t.imul(this.k)},r(h,f),h.prototype.split=function e(t,n){for(var r=4194303,i=Math.min(t.length,9),o=0;o>>22,s=a}t.words[o-10]=s>>>22,t.length-=9},h.prototype.imulK=function e(t){var n;t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var r=0,i=0;i>>=26,t.words[r]=o,n=i}return 0!==n&&(t.words[t.length++]=n),t},i._prime=function e(t){if(c[t])return c[t];var e;if("k256"===t)e=new h;else if("p224"===t)e=new p;else if("p192"===t)e=new d;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new m}return c[t]=e,e},g.prototype._verify1=function e(t){n(!t.sign,"red works only with positives"),n(t.red,"red works only with red numbers")},g.prototype._verify2=function e(t,r){n(!t.sign&&!r.sign,"red works only with positives"),n(t.red&&t.red===r.red,"red works only with red numbers")},g.prototype.imod=function e(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.mod(this.m)._forceRed(this)},g.prototype.neg=function e(t){var n=t.clone();return n.sign=!n.sign,n.iadd(this.m)._forceRed(this)},g.prototype.add=function e(t,n){this._verify2(t,n);var r=t.add(n);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},g.prototype.iadd=function e(t,n){this._verify2(t,n);var r=t.iadd(n);return r.cmp(this.m)>=0&&r.isub(this.m),r},g.prototype.sub=function e(t,n){this._verify2(t,n);var r=t.sub(n);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},g.prototype.isub=function e(t,n){this._verify2(t,n);var r=t.isub(n);return r.cmpn(0)<0&&r.iadd(this.m),r},g.prototype.shl=function e(t,n){return this._verify1(t),this.imod(t.shln(n))},g.prototype.imul=function e(t,n){return this._verify2(t,n),this.imod(t.imul(n))},g.prototype.mul=function e(t,n){return this._verify2(t,n),this.imod(t.mul(n))},g.prototype.isqr=function e(t){return this.imul(t,t)},g.prototype.sqr=function e(t){return this.mul(t,t)},g.prototype.sqrt=function e(t){if(0===t.cmpn(0))return t.clone();var r=this.m.andln(3);if(n(r%2==1),3===r){var o=this.m.add(new i(1)).ishrn(2),s=this.pow(t,o);return s}for(var a=this.m.subn(1),u=0;0!==a.cmpn(0)&&0===a.andln(1);)u++,a.ishrn(1);n(0!==a.cmpn(0));var l=new i(1).toRed(this),c=l.redNeg(),f=this.m.subn(1).ishrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,f).cmp(c);)h.redIAdd(c);for(var p=this.pow(h,a),s=this.pow(t,a.addn(1).ishrn(1)),d=this.pow(t,a),m=u;0!==d.cmp(l);){for(var g=d,y=0;0!==g.cmp(l);y++)g=g.redSqr();n(y=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},y.prototype.mul=function e(t,n){if(0===t.cmpn(0)||0===n.cmpn(0))return new i(0)._forceRed(this);var r=t.mul(n),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(o).ishrn(this.shift),a=s;return s.cmp(this.m)>=0?a=s.isub(this.m):s.cmpn(0)<0&&(a=s.iadd(this.m)),a._forceRed(this)},y.prototype.invm=function e(t){var n=this.imod(t._invmp(this.m).mul(this.r2));return n._forceRed(this)}}(e,this)}).call(this,n(75)(e))},function(e,t,n){"use strict";var r=n(17),i=n(30),o=n(41),s=[],a={};function u(){}function l(e,t){if(~s.indexOf(e))return e;if(!t)return a[e];r.isArray(t)||(t=[t]);var n=function(t){return s[i][t]===e};for(var i in s)if(r.any(t,n))return s[i]}function c(e){var t=new u;return o.defineImmutable(t,{name:e.name,alias:e.alias,pubkeyhash:e.pubkeyhash,privatekey:e.privatekey,scripthash:e.scripthash,xpubkey:e.xpubkey,xprivkey:e.xprivkey,zaddr:e.zaddr,zkey:e.zkey}),e.networkMagic&&o.defineImmutable(t,{networkMagic:i.integerAsBuffer(e.networkMagic)}),e.port&&o.defineImmutable(t,{port:e.port}),e.dnsSeeds&&o.defineImmutable(t,{dnsSeeds:e.dnsSeeds}),r.each(t,function(e){r.isUndefined(e)||r.isObject(e)||(a[e]=t)}),s.push(t),t}function f(e){for(var t=0;t"},e.exports=f;var h=n(86)}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var r=n(1497),i=n(1498);e.exports=function e(n,o,s){if("number"!=typeof n)throw new TypeError('"size" argument must be a number');if(n<0)throw new RangeError('"size" argument must not be negative');if(t.alloc)return t.alloc(n,o,s);var a=i(n);return 0===n?a:void 0===o?r(a,0):("string"!=typeof s&&(s=void 0),r(a,o,s))}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";function r(e){return function(){if(null===e)throw new Error("Callback was already called.");var t=e;e=null,t.apply(this,arguments)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,n){var r=n(174),i=n(750),o=n(751),s="[object Null]",a="[object Undefined]",u=r?r.toStringTag:void 0;function l(e){return null==e?void 0===e?a:s:u&&u in Object(e)?i(e):o(e)}e.exports=l},function(e,t,n){var r=n(754),i=n(761),o=n(172);function s(e){return o(e)?r(e):i(e)}e.exports=s},function(e,t,n){const r=n(32),i=n(20),o=n(98);function s(e,t){return new Promise(n=>{setTimeout(()=>{n(t)},e)})}class a{constructor(e){}static setup0(e){throw new o.IntentionallyUnimplementedError("Intentionally undefined function Transport.setup0 should have been subclassed")}p_setup1(e){return this}p_setup2(e){return this}static async p_setup(e,t){let n=await this.setup0(e).p_setup1(t);return n.p_setup2(t)}stop(e,t){this.status=a.STATUS_FAILED,e&&e(this),t(null,this)}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}connected(){return!this.status}supports(e,t,{noCache:n}={}){if("string"==typeof e&&(e=r.parse(e)),e&&!e.protocol)throw new Error("URL failed to specific a scheme (before :) "+e.href);return(!e||this.supportURLs.includes(e.protocol.slice(0,-1)))&&(!t||this.supportFunctions.includes(t))&&(!n||this.supportFeatures.includes("noCache"))}validFor(e,t,n){return this.connected()&&this.supports(e,t,n)}p_rawstore(e,t){throw new o.ToBeImplementedError("Intentionally undefined function Transport.p_rawstore should have been subclassed")}async p_rawstoreCaught(e){try{return await this.p_rawstore(e)}catch(e){}}p_store(){throw new o.ToBeImplementedError("Undefined function Transport.p_store - may define higher level semantics here (see Python)")}p_rawfetch(e,{timeoutMS:t,start:n,end:r,relay:i=!1}={}){return console.assert(!1,"Intentionally undefined function Transport.p_rawfetch should have been subclassed"),"UNIMPLEMENTED"}p_fetch(){throw new o.ToBeImplementedError("Undefined function Transport.p_fetch - may define higher level semantics here (see Python)")}p_rawadd(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_rawadd")}p_rawlist(e){throw new o.ToBeImplementedError("Undefined function Transport.p_rawlist")}p_list(){throw new Error("Undefined function Transport.p_list")}p_newlisturls(e){throw new Error("undefined function Transport.p_newlisturls")}p_rawreverse(e){throw new o.ToBeImplementedError("Undefined function Transport.p_rawreverse")}listmonitor(e,t,{current:n=!1}={}){console.log("Undefined function Transport.listmonitor")}async p_newdatabase(e){throw new o.ToBeImplementedError("Undefined function Transport.p_newdatabase")}async p_newtable(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_newtable")}async p_set(e,t,n){throw new o.ToBeImplementedError("Undefined function Transport.p_set")}async p_get(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_get")}async p_delete(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_delete")}async p_keys(e){throw new o.ToBeImplementedError("Undefined function Transport.p_keys")}async p_getall(e){throw new o.ToBeImplementedError("Undefined function Transport.p_keys")}static async p_f_createReadStream(e,{wanturl:t=!1}){}static mergeoptions(e){let t={};for(let n=0;n",r),console.assert("bar"===r.testkey2.foo&&2===r.testkey3[1]&&!r.testkey),await s(200),console.log(this.name,"p_test_kvt complete")}catch(e){throw console.log("Exception thrown in ",this.name,"p_test_kvt:",e.message),e}}}a.STATUS_CONNECTED=0,a.STATUS_FAILED=1,a.STATUS_STARTING=2,a.STATUS_LOADED=3,a.STATUS_PAUSED=4,a.STATUSTEXT=["Connected","Failed","Starting","Loaded","Paused"],t=e.exports=a},function(e,t,n){"use strict";function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var i={};function o(e,t,n){function o(e,n,r){return"string"==typeof t?t:t(e,n,r)}n||(n=Error);var s=function(e){function t(t,n,r){return e.call(this,o(t,n,r))||this}return r(t,e),t}(n);s.prototype.name=n.name,s.prototype.code=e,i[e]=s}function s(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return String(e)}),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}function a(e,t,n){return e.substr(!n||n<0?0:+n,t.length)===t}function u(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}function l(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}o("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),o("ERR_INVALID_ARG_TYPE",function(e,t,n){var r,i;if("string"==typeof t&&a(t,"not ")?(r="must not be",t=t.replace(/^not /,"")):r="must be",u(e," argument"))i="The ".concat(e," ").concat(r," ").concat(s(t,"type"));else{var o=l(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(o," ").concat(r," ").concat(s(t,"type"))}return i+=". Received type ".concat(typeof n),i},TypeError),o("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),o("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),o("ERR_STREAM_PREMATURE_CLOSE","Premature close"),o("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),o("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),o("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),o("ERR_STREAM_WRITE_AFTER_END","write after end"),o("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),o("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),o("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=i},function(e,t,n){"use strict";(function(t){var r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=l;var i=n(396),o=n(400);n(1)(l,i);for(var s=r(o.prototype),a=0;at){var r=new Error("Too few bytes to parse DER.");throw r.available=e.length(),r.remaining=t,r.requested=n,r}}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},i.create=function(e,t,n,o,s){if(r.util.isArray(o)){for(var a=[],u=0;ut){if(r.strict){var m=new Error("Too few bytes to read ASN.1 value.");throw m.available=e.length(),m.remaining=t,m.requested=h,m}h=t}var g=32==(32&l);if(g)if(p=[],void 0===h)for(;;){if(o(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}u=e.length(),p.push(a(e,t,n+1,r)),t-=u-e.length()}else for(;h>0;)u=e.length(),p.push(a(e,h,n+1,r)),t-=u-e.length(),h-=u-e.length();if(void 0===p&&c===i.Class.UNIVERSAL&&f===i.Type.BITSTRING&&(d=e.bytes(h)),void 0===p&&r.decodeBitStrings&&c===i.Class.UNIVERSAL&&f===i.Type.BITSTRING&&h>1){var y=e.read,b=t,v=0;if(f===i.Type.BITSTRING&&(o(e,t,1),v=e.getByte(),t--),0===v)try{u=e.length();var w={verbose:r.verbose,strict:!0,decodeBitStrings:!0},_=a(e,t,n+1,w),k=u-e.length();t-=k,f==i.Type.BITSTRING&&k++;var S=_.tagClass;k!==h||S!==i.Class.UNIVERSAL&&S!==i.Class.CONTEXT_SPECIFIC||(p=[_])}catch(e){}void 0===p&&(e.read=y,t=b)}if(void 0===p){if(void 0===h){if(r.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");h=t}if(f===i.Type.BMPSTRING)for(p="";h>0;h-=2)o(e,t,2),p+=String.fromCharCode(e.getInt16()),t-=2;else p=e.getBytes(h)}var E=void 0===d?null:{bitStringContents:d};return i.create(c,f,g,p,E)}i.fromDer=function(e,t){return void 0===t&&(t={strict:!0,decodeBitStrings:!0}),"boolean"==typeof t&&(t={strict:t,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"==typeof e&&(e=r.util.createBuffer(e)),a(e,e.length(),0,t)},i.toDer=function(e){var t=r.util.createBuffer(),n=e.tagClass|e.type,o=r.util.createBuffer(),s=!1;if("bitStringContents"in e&&(s=!0,e.original&&(s=i.equals(e,e.original))),s)o.putBytes(e.bitStringContents);else if(e.composed){e.constructed?n|=32:o.putByte(0);for(var a=0;a1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?o.putBytes(e.value.substr(1)):o.putBytes(e.value);if(t.putByte(n),o.length()<=127)t.putByte(127&o.length());else{var u=o.length(),l="";do{l+=String.fromCharCode(255&u),u>>>=8}while(u>0);t.putByte(128|l.length);for(var a=l.length-1;a>=0;--a)t.putByte(l.charCodeAt(a))}return t.putBuffer(o),t},i.oidToDer=function(e){var t=e.split("."),n=r.util.createBuffer(),i,o,s,a;n.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var u=2;u>>=7,i||(a|=128),o.push(a),i=!1}while(s>0);for(var l=o.length-1;l>=0;--l)n.putByte(o[l])}return n},i.derToOid=function(e){var t;"string"==typeof e&&(e=r.util.createBuffer(e));var n=e.getByte();t=Math.floor(n/40)+"."+n%40;for(var i=0;e.length()>0;)n=e.getByte(),i<<=7,128&n?i+=127&n:(t+="."+(i+n),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,n=parseInt(e.substr(0,2),10);n=n>=50?1900+n:2e3+n;var r=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),o=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),a=0;if(e.length>11){var u=e.charAt(10),l=10;"+"!==u&&"-"!==u&&(a=parseInt(e.substr(10,2),10),l+=2)}if(t.setUTCFullYear(n,r,i),t.setUTCHours(o,s,a,0),l&&(u=e.charAt(l),"+"===u||"-"===u)){var c=parseInt(e.substr(l+1,2),10),f=parseInt(e.substr(l+4,2),10),h=60*c+f;h*=6e4,"+"===u?t.setTime(+t-h):t.setTime(+t+h)}return t},i.generalizedTimeToDate=function(e){var t=new Date,n=parseInt(e.substr(0,4),10),r=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),u=0,l=0,c=!1;"Z"===e.charAt(e.length-1)&&(c=!0);var f=e.length-5,h=e.charAt(f);if("+"===h||"-"===h){var p=parseInt(e.substr(f+1,2),10),d=parseInt(e.substr(f+4,2),10);l=60*p+d,l*=6e4,"+"===h&&(l*=-1),c=!0}return"."===e.charAt(14)&&(u=1e3*parseFloat(e.substr(14),10)),c?(t.setUTCFullYear(n,r,i),t.setUTCHours(o,s,a,u),t.setTime(+t+l)):(t.setFullYear(n,r,i),t.setHours(o,s,a,u)),t},i.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",n=[];n.push((""+e.getUTCFullYear()).substr(2)),n.push(""+(e.getUTCMonth()+1)),n.push(""+e.getUTCDate()),n.push(""+e.getUTCHours()),n.push(""+e.getUTCMinutes()),n.push(""+e.getUTCSeconds());for(var r=0;r=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var n=new Error("Integer too large; max is 32-bits.");throw n.integer=e,n},i.derToInteger=function(e){"string"==typeof e&&(e=r.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},i.validate=function(e,t,n,o){var s=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)o&&(e.tagClass!==t.tagClass&&o.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&o.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(s=!0,t.value&&r.util.isArray(t.value))for(var a=0,u=0;s&&u0&&(o+="\n");for(var s="",a=0;a1?o+="0x"+r.util.bytesToHex(e.value.slice(1)):o+="(none)",e.value.length>0){var h=e.value.charCodeAt(0);1==h?o+=" (1 unused bit shown)":h>1&&(o+=" ("+h+" unused bits shown)")}}else e.type===i.Type.OCTETSTRING?(u.test(e.value)||(o+="("+e.value+") "),o+="0x"+r.util.bytesToHex(e.value)):e.type===i.Type.UTF8?o+=r.util.decodeUtf8(e.value):e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?o+=e.value:u.test(e.value)?o+="0x"+r.util.bytesToHex(e.value):0===e.value.length?o+="[null]":o+=e.value}return o}},function(e,t,n){var r=n(19);n(237),n(893),n(894),n(34),r.random&&r.random.getBytes?e.exports=r.random:function(t){var n={},i=new Array(4),o=r.util.createBuffer();function s(){var e=r.prng.create(n);return e.getBytes=function(t,n){return e.generate(t,n)},e.getBytesSync=function(t){return e.generate(t)},e}n.formatKey=function(e){var t=r.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),r.aes._expandKey(e,!1)},n.formatSeed=function(e){var t=r.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},n.cipher=function(e,t){return r.aes._updateBlock(e,t,i,!1),o.putInt32(i[0]),o.putInt32(i[1]),o.putInt32(i[2]),o.putInt32(i[3]),o.getBytes()},n.increment=function(e){return++e[3],e},n.md=r.md.sha256;var a=s(),u=null;if("undefined"!=typeof window){var l=window.crypto||window.msCrypto;l&&l.getRandomValues&&(u=function(e){return l.getRandomValues(e)})}if(r.options.usePureJavaScript||!r.util.isNodejs&&!u){if("undefined"==typeof window||window.document,a.collectInt(+new Date,32),"undefined"!=typeof navigator){var c="";for(var f in navigator)try{"string"==typeof navigator[f]&&(c+=navigator[f])}catch(e){}a.collect(c),c=null}t&&(t().mousemove(function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)}),t().keypress(function(e){a.collectInt(e.charCode,8)}))}if(r.random)for(var f in a)r.random[f]=a[f];else r.random=a;r.random.createInstance=s,e.exports=r.random}("undefined"!=typeof jQuery?jQuery:null)},function(e,t,n){"use strict";const r=t;r.bignum=n(63),r.define=n(904).define,r.base=n(180),r.constants=n(463),r.decoders=n(908),r.encoders=n(910)},function(e,t,n){"use strict";var r=n(1),i=n(318),o=n(469),s=n(470),a=n(119);function u(e){a.call(this,"digest"),this._hash=e}r(u,a),u.prototype._update=function(e){this._hash.update(e)},u.prototype._final=function(){return this._hash.digest()},e.exports=function e(t){return t=t.toLowerCase(),"md5"===t?new i:"rmd160"===t||"ripemd160"===t?new o:new u(s(t))}},function(e,t,n){var r=n(4).Buffer;function i(e,t){this._block=r.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}i.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=r.from(e,t));for(var n=this._block,i=this._blockSize,o=e.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(491),i=a(r),o=n(220),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default,1),e.exports=t.default},function(e,t,n){function r(e){if(e)return i(e)}function i(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},r.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+e],r;if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i1?{type:p[i],data:e.substring(1)}:{type:p[i]}:d}var s=new Uint8Array(e),i=s[0],a=o(e,1);return m&&"blob"===n&&(a=new m([a])),{type:p[i],data:a}},t.decodeBase64Packet=function(e,t){var n=p[e.charAt(0)];if(!u)return{type:n,data:{base64:!0,data:e.substr(1)}};var r=u.decode(e.substr(1));return"blob"===t&&m&&(r=new m([r])),{type:n,data:r}},t.encodePayload=function(e,n,r){"function"==typeof n&&(r=n,n=null);var o=i(e);if(n&&o)return m&&!f?t.encodePayloadAsBlob(e,r):t.encodePayloadAsArrayBuffer(e,r);if(!e.length)return r("0:");function s(e){return e.length+":"+e}function a(e,r){t.encodePacket(e,!!o&&n,!1,function(e){r(null,s(e))})}_(e,a,function(e,t){return r(t.join(""))})},t.decodePayload=function(e,n,r){if("string"!=typeof e)return t.decodePayloadAsBinary(e,n,r);var i;if("function"==typeof n&&(r=n,n=null),""===e)return r(d,0,1);for(var o="",s,a,u=0,l=e.length;u0;){for(var a=new Uint8Array(i),u=0===a[0],l="",c=1;255!==a[c];c++){if(l.length>310)return r(d,0,1);l+=a[c]}i=o(i,2+l.length),l=parseInt(l);var f=o(i,0,l);if(u)try{f=String.fromCharCode.apply(null,new Uint8Array(f))}catch(e){var h=new Uint8Array(f);f="";for(var c=0;co)throw new RangeError("requested too many random bytes");var n=a.allocUnsafe(e);if(e>0)if(e>i)for(var s=0;s{const n=r(e,t);return(e,t,r)=>{n(e,t,(e,t)=>{if(e)return r(e);r(null,t[0])})}})},function(e,t,n){"use strict";var r=n(10),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=f;var o=n(7);o.inherits=n(1);var s=n(657),a=n(660);o.inherits(f,s);for(var u=i(a.prototype),l=0;l=t)throw new Error("Cannot access property/index "+r+" levels up, current level is "+t);return n[t-r]}if(r>t)throw new Error("Cannot access data "+r+" levels up, current level is "+t);if(o="data"+(t-r||""),!i)return o}for(var a=o,u=i.split("/"),l=0;l=0||1/0===e||-1/0===e)}},t.text={is:function(e){return"string"==typeof e}},t.text.ify=function(e){return t.text.is(e)?e:"undefined"!=typeof JSON?JSON.stringify(e):e&&e.toString?e.toString():e},t.text.random=function(e,t){var n="";for(e=e||24,t=t||"0123456789ABCDEFGHIJKLMNOPQRSTUVWXZabcdefghijklmnopqrstuvwxyz";e>0;)n+=t.charAt(Math.floor(Math.random()*t.length)),e--;return n},t.text.match=function(e,t){var n,r;return"string"==typeof e&&("string"==typeof t&&(t={"=":t}),t=t||{},n=t["="]||t["*"]||t[">"]||t["<"],e===n||r===t["="]&&(n=t["*"]||t[">"]||t["<"],e.slice(0,(n||"").length)===n||r===t["*"]&&(r!==t[">"]&&r!==t["<"]?e>=t[">"]&&e<=t["<"]:r!==t[">"]&&e>=t[">"]||r!==t["<"]&&e<=t["<"])))},t.list={is:function(e){return e instanceof Array}},t.list.slit=Array.prototype.slice,t.list.sort=function(e){return function(t,n){return t&&n?(t=t[e],n=n[e],tn?1:0):0}},t.list.map=function(e,t,n){return a(e,t,n)},t.list.index=1,t.obj={is:function(e){return!!e&&(e instanceof Object&&e.constructor===Object||"Object"===Object.prototype.toString.call(e).match(/^\[object (\w+)\]$/)[1])}},t.obj.put=function(e,t,n){return(e||{})[t]=n,e},t.obj.has=function(e,t){return e&&Object.prototype.hasOwnProperty.call(e,t)},t.obj.del=function(e,t){if(e)return e[t]=null,delete e[t],e},t.obj.as=function(e,t,n,r){return e[t]=e[t]||(r===n?{}:n)},t.obj.ify=function(e){if(o(e))return e;try{e=JSON.parse(e)}catch(t){e={}}return e},function(){var e;function n(t,n){s(this,n)&&e!==this[n]||(this[n]=t)}t.obj.to=function(e,t){return t=t||{},a(e,n,t),t}}(),t.obj.copy=function(e){return e?JSON.parse(JSON.stringify(e)):e},function(){function e(e,t){var n=this.n;if(!n||!(t===n||o(n)&&s(n,t)))return!!t||void 0}t.obj.empty=function(t,n){return!t||!a(t,e,{n:n})}}(),function(){function e(t,n){if(2===arguments.length)return e.r=e.r||{},void(e.r[t]=n);e.r=e.r||[],e.r.push(t)}var i=Object.keys;t.obj.map=function(a,u,l){var c,f=0,h,p,d,m,g=n(u);if(e.r=null,i&&o(a)&&(d=i(a),m=!0),r(a)||d)for(h=(d||a).length;f",r.drift=0,r.is=function(e,t,n){var i=t&&e&&e[_]&&e[_][r._]||n;if(i)return b(i=i[t])?i:-1/0},r.lex=function(){return r().toString(36).replace(".","")},r.ify=function(e,t,i,o,s){if(!e||!e[_]){if(!s)return;e=n.soul.ify(e,s)}var a=h(e[_],r._);return k!==t&&t!==_&&(b(i)&&(a[t]=i),k!==o&&(e[t]=o)),e},r.to=function(e,t,i){var o=(e||{})[t];return d(o)&&(o=g(o)),r.ify(i,t,r.is(e,t),o,n.soul(e))},function(){function e(e,t){_!==t&&r.ify(this.o,t,this.s)}r.map=function(t,n,i){var o,s=d(s=t||n)?s:null;return t=w(t=t||n)?t:null,s&&!t?(n=b(n)?n:r(),s[_]=s[_]||{},m(s,e,{o:s,s:n}),s):(i=i||d(n)?n:o,n=b(n)?n:r(),function(r,s,a,u){if(!t)return e.call({o:a,s:n},r,s),r;t.call(i||this||{},r,s,a,u),p(a,s)&&o===a[s]||e.call({o:a,s:n},r,s)})}}();var f=t.obj,h=f.as,p=f.has,d=f.is,m=f.map,g=f.copy,y=t.num,b=y.is,v=t.fn,w=v.is,_=n._,k;e.exports=r})(o,"./state"),o(function(e){var t=o("./type"),n=o("./val"),r=o("./node"),i={};!function(){function e(e,n){if(!e||n!==r.soul(e)||!r.is(e,this.fn,this.as))return!0;this.cb&&(t.n=e,t.as=this.as,this.cb.call(t.as,e,n,t))}function t(e){e&&r.is(t.n,e,t.as)}i.is=function(t,n,r,i){return!(!t||!u(t)||f(t))&&!p(t,e,{cb:n,fn:r,as:i})}}(),function(){function e(e,t){var i;return(i=f(e,t))?i:(t.env=e,t.soul=s,r.ify(t.obj,o,t)&&(t.link=t.link||n.link.ify(r.soul(t.node)),t.obj!==e.shell&&(e.graph[n.link.is(t.link)]=t.node)),t)}function o(t,i,o){var s=this,u=s.env,f,h;if(r._===i&&c(t,n.link._))return o._;if(f=a(t,i,o,s,u)){if(i||(s.node=s.node||o||{},c(t,r._)&&r.soul(t)&&(s.node._=d(t._)),s.node=r.soul.ify(s.node,n.link.is(s.link)),s.link=s.link||n.link.ify(r.soul(s.node))),(h=u.map)&&(h.call(u.as||{},t,i,o,s),c(o,i))){if(t=o[i],m===t)return void l(o,i);if(!(f=a(t,i,o,s,u)))return}if(!i)return s.node;if(!0===f)return t;if(h=e(u,{obj:t,path:s.path.concat(i)}),h.node)return h.link}}function s(e){var t=this,i=n.link.is(t.link),o=t.env.graph;t.link=t.link||n.link.ify(e),t.link[n.link._]=e,t.node&&t.node[r._]&&(t.node[r._][n.link._]=e),c(o,i)&&(o[e]=o[i],l(o,i))}function a(e,r,i,o,s){var l;return!!n.is(e)||(u(e)?1:(l=s.invalid)?(e=l.call(s.as||{},e,r,i),a(e,r,i,o,s)):(s.err="Invalid value at '"+o.path.concat(r).join(".")+"'!",void(t.list.is(e)&&(s.err+=" Use `.set(item)` instead of an Array."))))}function f(e,t){for(var n=e.seen,r=n.length,i;r--;)if(i=n[r],t.obj===i.obj)return i;n.push(t)}i.ify=function(t,r,i){var o={path:[],obj:t};return r?"string"==typeof r?r={soul:r}:r instanceof Function&&(r.map=r):r={},r.soul&&(o.link=n.link.ify(r.soul)),r.shell=(i||{}).shell,r.graph=r.graph||{},r.seen=r.seen||[],r.as=r.as||i,e(r,o),r.root=o.node,r.graph}}(),i.node=function(e){var t=r.soul(e);if(t)return h({},t,e)},function(){function e(e,t){var o,s;if(r._!==t)(o=n.link.is(e))?(s=this.opt.seen[o])?this.obj[t]=s:this.obj[t]=this.opt.seen[o]=i.to(this.graph,o,this.opt):this.obj[t]=e;else{if(f(e,n.link._))return;this.obj[t]=d(e)}}i.to=function(t,n,r){if(t){var i={};return r=r||{seen:{}},p(t[n],e,{obj:i,graph:t,opt:r}),i}}}();var s=t.fn.is,a=t.obj,u=a.is,l=a.del,c=a.has,f=a.empty,h=a.put,p=a.map,d=a.copy,m;e.exports=i})(o,"./graph"),o(function(e){o("./onto"),e.exports=function e(t,n){if(this.on){if(!(t instanceof Function)){if(!t||!n)return;var r=t["#"]||t,i=(this.tag||empty)[r];if(!i)return;return i=this.on(r,n),clearTimeout(i.err),!0}var r=n&&n["#"]||Math.random().toString(36).slice(2);if(!t)return r;var o=this.on(r,t,n);return o.err=o.err||setTimeout(function(){o.next({err:"Error: No ACK received yet.",lack:!0}),o.off()},(this.opt||{}).lack||9e3),r}}})(o,"./ask"),o(function(e){var t=o("./type");function n(e){var n={s:{}};return e=e||{max:1e3,age:9e3},n.check=function(e){var t;return!!(t=n.s[e])&&(t.pass?t.pass=!1:n.track(e))},n.track=function(i,o){var s=n.s[i]||(n.s[i]={});return s.was=r(),o&&(s.pass=!0),n.to||(n.to=setTimeout(function(){var i=r();t.obj.map(n.s,function(r,o){r&&e.age>i-r.was||t.obj.del(n.s,o)}),n.to=null},e.age+9)),s},n}var r=t.time.is;e.exports=n})(o,"./dup"),o(function(e){function t(e){return e instanceof t?(this._={gun:this,$:this}).$:this instanceof t?t.create(this._={gun:this,$:this,opt:e}):new t(e)}t.is=function(e){return e instanceof t||e&&e._&&e===e._.$||!1},t.version=.9,t.chain=t.prototype,t.chain.toJSON=function(){};var n=o("./type");n.obj.to(n,t),t.HAM=o("./HAM"),t.val=o("./val"),t.node=o("./node"),t.state=o("./state"),t.graph=o("./graph"),t.on=o("./onto"),t.ask=o("./ask"),t.dup=o("./dup"),function(){function e(n){var r=this,i=r.as,o=i.at||i,s=o.$,a,u;(u=n["#"])||(u=n["#"]=l(9)),(a=o.dup).check(u)?i.out===n.out&&(n.out=k,r.to.next(n)):(a.track(u),o.ask(n["@"],n)||(n.get&&t.on.get(n,s),n.put&&t.on.put(n,s)),r.to.next(n),i.out||(n.out=e,o.on("out",n)))}t.create=function(n){n.root=n.root||n,n.graph=n.graph||{},n.on=n.on||t.on,n.ask=n.ask||t.ask,n.dup=n.dup||t.dup();var r=n.$.opt(n.opt);return n.once||(n.on("in",e,n),n.on("out",e,{at:n,out:e}),t.on("create",n),n.on("create",n)),n.once=1,r}}(),function(){function e(e,n,r,i){var o=this,s=t.state.is(r,n),a;if(!s)return o.err="Error: No state on '"+n+"' in node '"+i+"'!";var u=o.graph[i]||_,l=t.state.is(u,n,!0),c=u[n],f=t.HAM(o.machine,s,l,e,c);f.incoming?(o.put[i]=t.state.to(r,n,o.put[i]),(o.diff||(o.diff={}))[i]=t.state.to(r,n,o.diff[i]),o.souls[i]=!0):f.defer&&(o.defer=s<(o.defer||1/0)?s:o.defer)}function n(e,t){var n=this,s=n.$._,a=(s.next||_)[t];if(!a){if(!(s.opt||_).super)return void(n.souls[t]=!1);a=n.$.get(t)._}var u=n.map[t]={put:e,get:t,$:a.$},l={ctx:n,msg:u};n.async=!!s.tag.node,n.ack&&(u["@"]=n.ack),d(e,r,l),n.async&&(n.and||s.on("node",function(e){this.to.next(e),e===n.map[e.get]&&(n.souls[e.get]=!1,d(e.put,i,e),d(n.souls,function(e){if(e)return e})||n.c||(n.c=1,this.off(),d(n.map,o,n)))}),n.and=!0,s.on("node",u))}function r(e,n){var r=this.ctx,i=r.graph,o=this.msg,s=o.get,a=o.put,u=o.$._,l;i[s]=t.state.to(a,n,i[s]),r.async||(u.put=t.state.to(a,n,u.put))}function i(e,n){var r=this,i=r.put,o=r.$._;o.put=t.state.to(i,n,o.put)}function o(e,t){e.$&&(this.cat.stop=this.stop,e.$._.on("in",e),this.cat.stop=null)}t.on.put=function(r,i){var s=i._,a={$:i,graph:s.graph,put:{},map:{},souls:{},machine:t.state(),ack:r["@"],cat:s,stop:{}};if(t.graph.is(r.put,null,e,a)||(a.err="Error: Invalid graph!"),a.err)return s.on("in",{"@":r["#"],err:t.log(a.err)});d(a.put,n,a),a.async||d(a.map,o,a),k!==a.defer&&setTimeout(function(){t.on.put(r,i)},a.defer-a.machine),a.diff&&s.on("put",p(r,{put:a.diff}))},t.on.get=function(e,n){var r=n._,i=e.get,o=i[y],s=r.graph[o],a=i[b],u,l=r.next||(r.next={}),c=l[o];if(!s)return r.on("get",e);if(a){if("string"!=typeof a||!h(s,a))return r.on("get",e);s=t.state.to(s,a)}else s=t.obj.copy(s);s=t.graph.node(s),u=(c||_).ack,r.on("in",{"@":e["#"],how:"mem",put:s,$:n}),r.on("get",e)}}(),t.chain.opt=function(e){e=e||{};var n=this,i=n._,o=e.peers||e;return f(e)||(e={}),f(i.opt)||(i.opt=e),u(o)&&(o=[o]),r(o)&&(o=d(o,function(e,t,n){t={},t.id=t.url=e,n(e,t)}),f(i.opt.peers)||(i.opt.peers={}),i.opt.peers=p(o,i.opt.peers)),i.opt.peers=i.opt.peers||{},p(e,i.opt),t.on("opt",i),i.opt.uuid=i.opt.uuid||function(){return g()+l(12)},n};var r=t.list.is,a=t.text,u=a.is,l=a.random,c=t.obj,f=c.is,h=c.has,p=c.to,d=c.map,m=c.copy,g=t.state.lex,y=t.val.link._,b=".",v=t.node._,w=t.val.link.is,_={},k;i.debug=function(e,t){return i.debug.i&&e===i.debug.i&&i.debug.i++&&(i.log.apply(i,arguments)||t)},t.log=function(){return!t.log.off&&i.log.apply(i,arguments),[].slice.call(arguments).join(" ")},t.log.once=function(e,n,r){return(r=t.log.once)[e]=r[e]||0,r[e]++||t.log(n)},t.log.once("welcome","Hello wonderful person! :) Thanks for using GUN, feel free to ask for help on https://gitter.im/amark/gun and ask StackOverflow questions tagged with 'gun'!"),"undefined"!=typeof window&&((window.GUN=window.Gun=t).window=window);try{void 0!==s&&(s.exports=t)}catch(e){}e.exports=t})(o,"./root"),o(function(e){var t=o("./root");t.chain.back=function(e,i){var o;if(e=e||1,-1===e||1/0===e)return this._.root.$;if(1===e)return(this._.back||this._).$;var s=this,a=s._;if("string"==typeof e&&(e=e.split(".")),e instanceof Array){for(var u=0,l=e.length,o=a;u(e.acks||0)&&this.off(),e.ack&&e.ack(r,this)},e.opt),i=0,o=n.root.now;h.del(n.root,"now");var s=n.root.mum;n.root.mum={},e.ref._.on("out",{$:e.ref,put:e.out=e.env.graph,opt:e.opt,"#":r}),n.root.mum=s?h.to(s,n.root.mum):s,n.root.now=o},e),e.res&&e.res())}function a(e,t){if(e)return!0}function u(e,n,r,i){var o=this,s=t.is(e);!n&&i.path.length&&(o.res||v)(function(){for(var n=i.path,r=o.ref,a=o.opt,u=0,c=n.length;uc){if((l.stack||(l.stack=[])).push([s,e,i,o]),l.puto)return;return l.puto=setTimeout(function e(){var t=l.stack.splice(0,c),n=0,r;for(l.puta=!0;r=t[n++];)r[0].put(r[1],r[2],r[3]);if(delete l.puta,l.stack.length)return l.puto=setTimeout(e,0);l.stack=l.puts=l.puto=null},0),s}++l.puts}else l.puts=1;return o=o||{},o.data=e,o.via=o.$=o.via||o.$||s,"string"==typeof i?o.soul=i:o.ack=o.ack||i,a.soul&&(o.soul=a.soul),o.soul||u===s?p(o.data)?(o.soul=o.soul||(o.not=t.node.soul(o.data)||(o.via.back("opt.uuid")||t.text.random)()),o.soul?(o.$=u.get(o.soul),o.ref=o.$,n(o),s):(o.via.back("opt.uuid")(function(e,n){if(e)return t.log(e);(o.ref||o.$).put(o.data,o.soul=n,o)}),s)):((o.ack||b).call(o,o.out={err:t.log("Data saved to the root level of the graph must be a node (an object), not a",typeof o.data,'of "'+o.data+'"!')}),o.res&&o.res(),s):t.is(e)?(e.get(function(e,n,r){if(!e)return t.log("The reference you are saving is a",typeof r.put,'"'+r.put+'", not a node (object)!');s.put(t.val.link.ify(e),i,o)},!0),s):(a.has&&(h=t.val.link.is(e))&&(a.dub=h),o.ref=o.ref||u._===(h=a.back)?s:h.$,o.ref._.soul&&t.val.is(o.data)&&a.get?(o.data=d({},a.get,o.data),o.ref.put(o.data,o.soul,o),s):(o.ref.get(f,!0,{as:o}),o.out||(o.res=o.res||r,o.$._.stun=o.ref._.stun),s))};var h=t.obj,p=h.is,d=h.put,m=h.map,g,y={},b=function(){},v=function(e,t){e.call(t||y)},w=t.node._})(o,"./put"),o(function(e){var t=o("./root");o("./chain"),o("./back"),o("./put"),o("./get"),e.exports=t})(o,"./index"),o(function(e){var t=o("./index");function n(e,t){var n=this,r=e.$,i=(r||{})._||{},o=i.put||e.put,s=n.at,a;if(h!==o){if(a=e.$$){if(a=e.$$._,h===a.put)return;o=a.put}n.change&&(o=e.put),n.as?n.ok.call(n.as,e,t):n.ok.call(r,o,e.get,e,t)}}function r(e,n,i){if(e.$){var o=this.as,a=o.at,u=e.$,l=u._,f=l.put||e.put,p,d;(d=e.$$)&&(p=d=e.$$._,h!==p.put&&(f=p.put)),(d=n.wait)&&(d=d[l.id])&&clearTimeout(d),!i&&(h===f||l.soul||l.link||p&&!(0 .once, apologies unexpected."),this.once(e,n)},t.chain.once=function(e,n){var i=this,o=i._,s=o.put;if(0=(t.batch||1e3))return f();s||(s=setTimeout(f,t.wait||1))}),e.on("get",function(t){this.to.next(t);var n=t.get,r,i,o;function s(){if(n&&(r=n["#"])){var s=n["."];i=a[r]||o,i&&s&&(i=Gun.state.to(i,s)),e.on("in",{"@":t["#"],put:Gun.graph.node(i),how:"lS",lS:t.$})}}Gun.debug?setTimeout(s,1):s()});var c=function(e,t,n,r){a[r]=Gun.state.to(n,t,a[r])},f=function(n){var u;o=0,clearTimeout(s),s=!1;var l=i;i={},n&&(a=n);try{r.setItem(t.prefix,JSON.stringify(a))}catch(n){Gun.log(u=(n||"localStorage failure")+" Consider using GUN's IndexedDB plugin for RAD for more storage space, temporary example at https://github.com/amark/gun/blob/master/test/tmp/indexedDB.html ."),e.on("localStorage:error",{err:u,file:t.prefix,flush:a,retry:f})}(u||Gun.obj.empty(t.peers))&&Gun.obj.map(l,function(t,n){e.on("in",{"@":n,err:u,ok:0})})}}})}})(o,"./adapters/localStorage"),o(function(e){var t=o("../type");function n(e){var n=function(){},o=e.opt||{};o.log=o.log||i.log,o.gap=o.gap||o.wait||1,o.pack=o.pack||.3*(o.memory?1e3*o.memory*1e3:1399e6);var a=e.dup;n.hear=function(r,i){if(r){var l,c,f,h=r[0];if(o.pack<=r.length)return n.say({dam:"!",err:"Message too big!"},i);if("{"!=r[2]&&(n.hear.d+=r.length||0,++n.hear.c),"["!==h){if("{"===h||t.obj.is(r)&&(l=r)){try{l=l||JSON.parse(r)}catch(e){return o.log("DAM JSON parse error",e)}if(!l)return;if((c=l["#"])||(c=l["#"]=t.text.random(9)),a.check(c))return;if(a.track(c,!0).it=l,(f=l["##"])||s===l.put||(f=l["##"]=t.obj.hash(l.put)),f&&(h=l["@"]||l.get&&c)){if(a.check(h+f))return;a.track(h+f,!0).it=l}return(l._=function(){}).via=i,(h=l["><"])&&(l._.to=t.obj.map(h.split(","),u)),l.dam?void((h=n.hear[l.dam])&&h(l,i,e)):void e.on("in",l)}}else{try{l=JSON.parse(r)}catch(e){o.log("DAM JSON parse error",e)}if(!l)return;for(var p=0,d;d=l[p++];)n.hear(d,i)}}};var u=function(e,t,n){n(e,!0)};function l(e,t){try{var r=t.wire;t.say?t.say(e):r.send&&r.send(e),n.say.d+=e.length||0,++n.say.c}catch(n){(t.queue=t.queue||[]).push(e)}}n.hear.c=n.hear.d=0,function(){var e;function i(t){n.say(e,t)}function u(e){var t=e.batch;if(e.batch=e.tail=null,t&&t.length){try{t=1===t.length?t[0]:JSON.stringify(t)}catch(e){return o.log("DAM JSON stringify error",e)}t&&l(t,e)}}n.say=function(c,f){if(this.to&&this.to.next(c),!c)return!1;var h,p,d,m,g=c._||(c._=function(){});if((h=c["#"])||(h=c["#"]=t.text.random(9)),(p=c["##"])||s===c.put||(p=c["##"]=t.obj.hash(c.put)),!(m=g.raw)&&(m=g.raw=n.raw(c),p&&(d=c["@"])&&(a.track(d+p).it=c,d=(a.s[d]||r).it))){if(p===d["##"])return!1;d["##"]=p}if(a.track(h).it=c,f||(f=(d=a.s[c["@"]])&&(d=d.it)&&(d=d._)&&(d=d.via)),!f&&n.way)return n.way(c);if(!f||!f.id)return e=c,!!t.obj.is(f||o.peers)&&void t.obj.map(f||o.peers,i);if(!f.wire&&n.wire&&n.wire(f),f===g.via)return!1;if((d=g.to)&&(d[f.url]||d[f.pid]||d[f.id]))return!1;if(f.batch){if(f.tail=(d=f.tail||0)+m.length,f.tail<=o.pack)return void f.batch.push(m);u(f)}f.batch=[],setTimeout(function(){u(f)},o.gap),l(m,f)},n.say.c=n.say.d=0}(),function(){n.raw=function(n){if(!n)return"";var r=n._||{},i,s,a;if(a=r.raw)return a;if("string"==typeof n)return n;if(!n.dam){var u=0,l=[];t.obj.map(o.peers,function(e){if(l.push(e.url||e.pid||e.id),++u>9)return!0}),u>1&&(n["><"]=l.join())}var c=e(n);return r&&(r.raw=c),c};var e=JSON.stringify,r=":])([:"}(),n.hi=function(r){var i=r.wire||{};r.id?o.peers[r.url||r.id]=r:(i=r.id=r.id||t.text.random(9),n.say({dam:"?"},o.peers[i]=r)),r.met=r.met||+new Date,i.hied||e.on(i.hied="hi",r),i=r.queue,r.queue=[],t.obj.map(i,function(e){l(e,r)})},n.bye=function(r){t.obj.del(o.peers,r.id),e.on("bye",r);var i=+new Date;i-=r.met||i,n.bye.time=((n.bye.time||i)+i)/2},n.hear["!"]=function(e,t){o.log("Error:",e.err)},n.hear["?"]=function(e,t){e.pid?t.pid||(t.pid=e.pid):n.say({dam:"?",pid:o.pid,"@":e["#"]},t)},e.on("create",function(e){e.opt.pid=e.opt.pid||t.text.random(9),this.to.next(e),e.on("out",n.say)});var c={};return e.on("bye",function(e,t){this.to.next(e),(t=e.url)&&(c[t]=!0,setTimeout(function(){delete c[t]},o.lack||9e3))}),e.on("hi",function(r,i){this.to.next(r),(i=r.url)&&c[i]&&(delete c[i],t.obj.map(e.next,function(o,s){i={},i[s]=e.graph[s],n.say({"##":t.obj.hash(i),get:{"#":s}},r)}))}),n}!function(){t.text.hash=function(e){if("string"!=typeof e)return{err:1};var t=0;if(!e.length)return t;for(var n=0,r=e.length,i;ne&&e.length>0?[e.length+" items inc:",e[e.length-1]]:e),utils.stringfrom=function(e,t={}){try{return"Url"===e.constructor.name?e.href:"string"==typeof e?e:e.toString()}catch(t){throw new r.CodingError(`Unable to turn ${e} into a string ${t.message}`)}},utils.p_timeout=function(e,t,n){let i=null;return Promise.race([new Promise((e,o)=>{i=setTimeout(o,t,new r.TimeoutError(n||`Timed out in ${t}ms`))}),e.then(e=>(clearTimeout(i),e))])},utils.createElement=function(e,t,n){var r=document.createElement(e);for(let e in t){let n="classname"===e.toLowerCase()?"class":e;if("dangerouslySetInnerHTML"===e&&(r.innerHTML=t[e].__html,delete t.dangerouslySetInnerHTML),t.hasOwnProperty(e)){let i=t[e];if(!0===i)r.setAttribute(n,e);else if("object"!=typeof i||Array.isArray(i))!1!==i&&null!=i&&r.setAttribute(n,i.toString());else if(["style"].includes(n))for(let e in i)r[n][e]=i[e];else r[n]=i}}for(let e=2;er.appendChild(null==e.nodeType?document.createTextNode(e.toString()):e)):r.appendChild(null==t.nodeType?document.createTextNode(t.toString()):t))}return r},t=e.exports=utils},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=(0,s.default)(e);return(0,i.default)(function(e,t){n(e[0],t)},t,1)};var r=n(744),i=a(r),o=n(42),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,n){var r=n(173),i=n(290);function o(e){return null!=e&&i(e.length)&&!r(e)}e.exports=o},function(e,t,n){var r=n(132),i=n(217),o="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",u="[object Proxy]";function l(e){if(!i(e))return!1;var t=r(e);return t==s||t==a||t==o||t==u}e.exports=l},function(e,t,n){var r=n(99),i=r.Symbol;e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=n(218),i=a(r),o=n(42),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e){return function(t,n,r){return e(i.default,t,(0,s.default)(n),r)}}e.exports=t.default},function(e,t,n){"use strict";(function(e){t.protobuf=e.from("50","hex"),t.cbor=e.from("51","hex"),t.rlp=e.from("60","hex"),t.bencode=e.from("63","hex"),t.multicodec=e.from("30","hex"),t.multihash=e.from("31","hex"),t.multiaddr=e.from("32","hex"),t.multibase=e.from("33","hex"),t.identity=e.from("00","hex"),t.sha1=e.from("11","hex"),t["sha2-256"]=e.from("12","hex"),t["sha2-512"]=e.from("13","hex"),t["sha3-512"]=e.from("14","hex"),t["sha3-384"]=e.from("15","hex"),t["sha3-256"]=e.from("16","hex"),t["sha3-224"]=e.from("17","hex"),t["shake-128"]=e.from("18","hex"),t["shake-256"]=e.from("19","hex"),t["keccak-224"]=e.from("1a","hex"),t["keccak-256"]=e.from("1b","hex"),t["keccak-384"]=e.from("1c","hex"),t["keccak-512"]=e.from("1d","hex"),t["murmur3-128"]=e.from("22","hex"),t["murmur3-32"]=e.from("23","hex"),t["dbl-sha2-256"]=e.from("56","hex"),t.md4=e.from("d4","hex"),t.md5=e.from("d5","hex"),t.bmt=e.from("d6","hex"),t.x11=e.from("1100","hex"),t["blake2b-8"]=e.from("b201","hex"),t["blake2b-16"]=e.from("b202","hex"),t["blake2b-24"]=e.from("b203","hex"),t["blake2b-32"]=e.from("b204","hex"),t["blake2b-40"]=e.from("b205","hex"),t["blake2b-48"]=e.from("b206","hex"),t["blake2b-56"]=e.from("b207","hex"),t["blake2b-64"]=e.from("b208","hex"),t["blake2b-72"]=e.from("b209","hex"),t["blake2b-80"]=e.from("b20a","hex"),t["blake2b-88"]=e.from("b20b","hex"),t["blake2b-96"]=e.from("b20c","hex"),t["blake2b-104"]=e.from("b20d","hex"),t["blake2b-112"]=e.from("b20e","hex"),t["blake2b-120"]=e.from("b20f","hex"),t["blake2b-128"]=e.from("b210","hex"),t["blake2b-136"]=e.from("b211","hex"),t["blake2b-144"]=e.from("b212","hex"),t["blake2b-152"]=e.from("b213","hex"),t["blake2b-160"]=e.from("b214","hex"),t["blake2b-168"]=e.from("b215","hex"),t["blake2b-176"]=e.from("b216","hex"),t["blake2b-184"]=e.from("b217","hex"),t["blake2b-192"]=e.from("b218","hex"),t["blake2b-200"]=e.from("b219","hex"),t["blake2b-208"]=e.from("b21a","hex"),t["blake2b-216"]=e.from("b21b","hex"),t["blake2b-224"]=e.from("b21c","hex"),t["blake2b-232"]=e.from("b21d","hex"),t["blake2b-240"]=e.from("b21e","hex"),t["blake2b-248"]=e.from("b21f","hex"),t["blake2b-256"]=e.from("b220","hex"),t["blake2b-264"]=e.from("b221","hex"),t["blake2b-272"]=e.from("b222","hex"),t["blake2b-280"]=e.from("b223","hex"),t["blake2b-288"]=e.from("b224","hex"),t["blake2b-296"]=e.from("b225","hex"),t["blake2b-304"]=e.from("b226","hex"),t["blake2b-312"]=e.from("b227","hex"),t["blake2b-320"]=e.from("b228","hex"),t["blake2b-328"]=e.from("b229","hex"),t["blake2b-336"]=e.from("b22a","hex"),t["blake2b-344"]=e.from("b22b","hex"),t["blake2b-352"]=e.from("b22c","hex"),t["blake2b-360"]=e.from("b22d","hex"),t["blake2b-368"]=e.from("b22e","hex"),t["blake2b-376"]=e.from("b22f","hex"),t["blake2b-384"]=e.from("b230","hex"),t["blake2b-392"]=e.from("b231","hex"),t["blake2b-400"]=e.from("b232","hex"),t["blake2b-408"]=e.from("b233","hex"),t["blake2b-416"]=e.from("b234","hex"),t["blake2b-424"]=e.from("b235","hex"),t["blake2b-432"]=e.from("b236","hex"),t["blake2b-440"]=e.from("b237","hex"),t["blake2b-448"]=e.from("b238","hex"),t["blake2b-456"]=e.from("b239","hex"),t["blake2b-464"]=e.from("b23a","hex"),t["blake2b-472"]=e.from("b23b","hex"),t["blake2b-480"]=e.from("b23c","hex"),t["blake2b-488"]=e.from("b23d","hex"),t["blake2b-496"]=e.from("b23e","hex"),t["blake2b-504"]=e.from("b23f","hex"),t["blake2b-512"]=e.from("b240","hex"),t["blake2s-8"]=e.from("b241","hex"),t["blake2s-16"]=e.from("b242","hex"),t["blake2s-24"]=e.from("b243","hex"),t["blake2s-32"]=e.from("b244","hex"),t["blake2s-40"]=e.from("b245","hex"),t["blake2s-48"]=e.from("b246","hex"),t["blake2s-56"]=e.from("b247","hex"),t["blake2s-64"]=e.from("b248","hex"),t["blake2s-72"]=e.from("b249","hex"),t["blake2s-80"]=e.from("b24a","hex"),t["blake2s-88"]=e.from("b24b","hex"),t["blake2s-96"]=e.from("b24c","hex"),t["blake2s-104"]=e.from("b24d","hex"),t["blake2s-112"]=e.from("b24e","hex"),t["blake2s-120"]=e.from("b24f","hex"),t["blake2s-128"]=e.from("b250","hex"),t["blake2s-136"]=e.from("b251","hex"),t["blake2s-144"]=e.from("b252","hex"),t["blake2s-152"]=e.from("b253","hex"),t["blake2s-160"]=e.from("b254","hex"),t["blake2s-168"]=e.from("b255","hex"),t["blake2s-176"]=e.from("b256","hex"),t["blake2s-184"]=e.from("b257","hex"),t["blake2s-192"]=e.from("b258","hex"),t["blake2s-200"]=e.from("b259","hex"),t["blake2s-208"]=e.from("b25a","hex"),t["blake2s-216"]=e.from("b25b","hex"),t["blake2s-224"]=e.from("b25c","hex"),t["blake2s-232"]=e.from("b25d","hex"),t["blake2s-240"]=e.from("b25e","hex"),t["blake2s-248"]=e.from("b25f","hex"),t["blake2s-256"]=e.from("b260","hex"),t["skein256-8"]=e.from("b301","hex"),t["skein256-16"]=e.from("b302","hex"),t["skein256-24"]=e.from("b303","hex"),t["skein256-32"]=e.from("b304","hex"),t["skein256-40"]=e.from("b305","hex"),t["skein256-48"]=e.from("b306","hex"),t["skein256-56"]=e.from("b307","hex"),t["skein256-64"]=e.from("b308","hex"),t["skein256-72"]=e.from("b309","hex"),t["skein256-80"]=e.from("b30a","hex"),t["skein256-88"]=e.from("b30b","hex"),t["skein256-96"]=e.from("b30c","hex"),t["skein256-104"]=e.from("b30d","hex"),t["skein256-112"]=e.from("b30e","hex"),t["skein256-120"]=e.from("b30f","hex"),t["skein256-128"]=e.from("b310","hex"),t["skein256-136"]=e.from("b311","hex"),t["skein256-144"]=e.from("b312","hex"),t["skein256-152"]=e.from("b313","hex"),t["skein256-160"]=e.from("b314","hex"),t["skein256-168"]=e.from("b315","hex"),t["skein256-176"]=e.from("b316","hex"),t["skein256-184"]=e.from("b317","hex"),t["skein256-192"]=e.from("b318","hex"),t["skein256-200"]=e.from("b319","hex"),t["skein256-208"]=e.from("b31a","hex"),t["skein256-216"]=e.from("b31b","hex"),t["skein256-224"]=e.from("b31c","hex"),t["skein256-232"]=e.from("b31d","hex"),t["skein256-240"]=e.from("b31e","hex"),t["skein256-248"]=e.from("b31f","hex"),t["skein256-256"]=e.from("b320","hex"),t["skein512-8"]=e.from("b321","hex"),t["skein512-16"]=e.from("b322","hex"),t["skein512-24"]=e.from("b323","hex"),t["skein512-32"]=e.from("b324","hex"),t["skein512-40"]=e.from("b325","hex"),t["skein512-48"]=e.from("b326","hex"),t["skein512-56"]=e.from("b327","hex"),t["skein512-64"]=e.from("b328","hex"),t["skein512-72"]=e.from("b329","hex"),t["skein512-80"]=e.from("b32a","hex"),t["skein512-88"]=e.from("b32b","hex"),t["skein512-96"]=e.from("b32c","hex"),t["skein512-104"]=e.from("b32d","hex"),t["skein512-112"]=e.from("b32e","hex"),t["skein512-120"]=e.from("b32f","hex"),t["skein512-128"]=e.from("b330","hex"),t["skein512-136"]=e.from("b331","hex"),t["skein512-144"]=e.from("b332","hex"),t["skein512-152"]=e.from("b333","hex"),t["skein512-160"]=e.from("b334","hex"),t["skein512-168"]=e.from("b335","hex"),t["skein512-176"]=e.from("b336","hex"),t["skein512-184"]=e.from("b337","hex"),t["skein512-192"]=e.from("b338","hex"),t["skein512-200"]=e.from("b339","hex"),t["skein512-208"]=e.from("b33a","hex"),t["skein512-216"]=e.from("b33b","hex"),t["skein512-224"]=e.from("b33c","hex"),t["skein512-232"]=e.from("b33d","hex"),t["skein512-240"]=e.from("b33e","hex"),t["skein512-248"]=e.from("b33f","hex"),t["skein512-256"]=e.from("b340","hex"),t["skein512-264"]=e.from("b341","hex"),t["skein512-272"]=e.from("b342","hex"),t["skein512-280"]=e.from("b343","hex"),t["skein512-288"]=e.from("b344","hex"),t["skein512-296"]=e.from("b345","hex"),t["skein512-304"]=e.from("b346","hex"),t["skein512-312"]=e.from("b347","hex"),t["skein512-320"]=e.from("b348","hex"),t["skein512-328"]=e.from("b349","hex"),t["skein512-336"]=e.from("b34a","hex"),t["skein512-344"]=e.from("b34b","hex"),t["skein512-352"]=e.from("b34c","hex"),t["skein512-360"]=e.from("b34d","hex"),t["skein512-368"]=e.from("b34e","hex"),t["skein512-376"]=e.from("b34f","hex"),t["skein512-384"]=e.from("b350","hex"),t["skein512-392"]=e.from("b351","hex"),t["skein512-400"]=e.from("b352","hex"),t["skein512-408"]=e.from("b353","hex"),t["skein512-416"]=e.from("b354","hex"),t["skein512-424"]=e.from("b355","hex"),t["skein512-432"]=e.from("b356","hex"),t["skein512-440"]=e.from("b357","hex"),t["skein512-448"]=e.from("b358","hex"),t["skein512-456"]=e.from("b359","hex"),t["skein512-464"]=e.from("b35a","hex"),t["skein512-472"]=e.from("b35b","hex"),t["skein512-480"]=e.from("b35c","hex"),t["skein512-488"]=e.from("b35d","hex"),t["skein512-496"]=e.from("b35e","hex"),t["skein512-504"]=e.from("b35f","hex"),t["skein512-512"]=e.from("b360","hex"),t["skein1024-8"]=e.from("b361","hex"),t["skein1024-16"]=e.from("b362","hex"),t["skein1024-24"]=e.from("b363","hex"),t["skein1024-32"]=e.from("b364","hex"),t["skein1024-40"]=e.from("b365","hex"),t["skein1024-48"]=e.from("b366","hex"),t["skein1024-56"]=e.from("b367","hex"),t["skein1024-64"]=e.from("b368","hex"),t["skein1024-72"]=e.from("b369","hex"),t["skein1024-80"]=e.from("b36a","hex"),t["skein1024-88"]=e.from("b36b","hex"),t["skein1024-96"]=e.from("b36c","hex"),t["skein1024-104"]=e.from("b36d","hex"),t["skein1024-112"]=e.from("b36e","hex"),t["skein1024-120"]=e.from("b36f","hex"),t["skein1024-128"]=e.from("b370","hex"),t["skein1024-136"]=e.from("b371","hex"),t["skein1024-144"]=e.from("b372","hex"),t["skein1024-152"]=e.from("b373","hex"),t["skein1024-160"]=e.from("b374","hex"),t["skein1024-168"]=e.from("b375","hex"),t["skein1024-176"]=e.from("b376","hex"),t["skein1024-184"]=e.from("b377","hex"),t["skein1024-192"]=e.from("b378","hex"),t["skein1024-200"]=e.from("b379","hex"),t["skein1024-208"]=e.from("b37a","hex"),t["skein1024-216"]=e.from("b37b","hex"),t["skein1024-224"]=e.from("b37c","hex"),t["skein1024-232"]=e.from("b37d","hex"),t["skein1024-240"]=e.from("b37e","hex"),t["skein1024-248"]=e.from("b37f","hex"),t["skein1024-256"]=e.from("b380","hex"),t["skein1024-264"]=e.from("b381","hex"),t["skein1024-272"]=e.from("b382","hex"),t["skein1024-280"]=e.from("b383","hex"),t["skein1024-288"]=e.from("b384","hex"),t["skein1024-296"]=e.from("b385","hex"),t["skein1024-304"]=e.from("b386","hex"),t["skein1024-312"]=e.from("b387","hex"),t["skein1024-320"]=e.from("b388","hex"),t["skein1024-328"]=e.from("b389","hex"),t["skein1024-336"]=e.from("b38a","hex"),t["skein1024-344"]=e.from("b38b","hex"),t["skein1024-352"]=e.from("b38c","hex"),t["skein1024-360"]=e.from("b38d","hex"),t["skein1024-368"]=e.from("b38e","hex"),t["skein1024-376"]=e.from("b38f","hex"),t["skein1024-384"]=e.from("b390","hex"),t["skein1024-392"]=e.from("b391","hex"),t["skein1024-400"]=e.from("b392","hex"),t["skein1024-408"]=e.from("b393","hex"),t["skein1024-416"]=e.from("b394","hex"),t["skein1024-424"]=e.from("b395","hex"),t["skein1024-432"]=e.from("b396","hex"),t["skein1024-440"]=e.from("b397","hex"),t["skein1024-448"]=e.from("b398","hex"),t["skein1024-456"]=e.from("b399","hex"),t["skein1024-464"]=e.from("b39a","hex"),t["skein1024-472"]=e.from("b39b","hex"),t["skein1024-480"]=e.from("b39c","hex"),t["skein1024-488"]=e.from("b39d","hex"),t["skein1024-496"]=e.from("b39e","hex"),t["skein1024-504"]=e.from("b39f","hex"),t["skein1024-512"]=e.from("b3a0","hex"),t["skein1024-520"]=e.from("b3a1","hex"),t["skein1024-528"]=e.from("b3a2","hex"),t["skein1024-536"]=e.from("b3a3","hex"),t["skein1024-544"]=e.from("b3a4","hex"),t["skein1024-552"]=e.from("b3a5","hex"),t["skein1024-560"]=e.from("b3a6","hex"),t["skein1024-568"]=e.from("b3a7","hex"),t["skein1024-576"]=e.from("b3a8","hex"),t["skein1024-584"]=e.from("b3a9","hex"),t["skein1024-592"]=e.from("b3aa","hex"),t["skein1024-600"]=e.from("b3ab","hex"),t["skein1024-608"]=e.from("b3ac","hex"),t["skein1024-616"]=e.from("b3ad","hex"),t["skein1024-624"]=e.from("b3ae","hex"),t["skein1024-632"]=e.from("b3af","hex"),t["skein1024-640"]=e.from("b3b0","hex"),t["skein1024-648"]=e.from("b3b1","hex"),t["skein1024-656"]=e.from("b3b2","hex"),t["skein1024-664"]=e.from("b3b3","hex"),t["skein1024-672"]=e.from("b3b4","hex"),t["skein1024-680"]=e.from("b3b5","hex"),t["skein1024-688"]=e.from("b3b6","hex"),t["skein1024-696"]=e.from("b3b7","hex"),t["skein1024-704"]=e.from("b3b8","hex"),t["skein1024-712"]=e.from("b3b9","hex"),t["skein1024-720"]=e.from("b3ba","hex"),t["skein1024-728"]=e.from("b3bb","hex"),t["skein1024-736"]=e.from("b3bc","hex"),t["skein1024-744"]=e.from("b3bd","hex"),t["skein1024-752"]=e.from("b3be","hex"),t["skein1024-760"]=e.from("b3bf","hex"),t["skein1024-768"]=e.from("b3c0","hex"),t["skein1024-776"]=e.from("b3c1","hex"),t["skein1024-784"]=e.from("b3c2","hex"),t["skein1024-792"]=e.from("b3c3","hex"),t["skein1024-800"]=e.from("b3c4","hex"),t["skein1024-808"]=e.from("b3c5","hex"),t["skein1024-816"]=e.from("b3c6","hex"),t["skein1024-824"]=e.from("b3c7","hex"),t["skein1024-832"]=e.from("b3c8","hex"),t["skein1024-840"]=e.from("b3c9","hex"),t["skein1024-848"]=e.from("b3ca","hex"),t["skein1024-856"]=e.from("b3cb","hex"),t["skein1024-864"]=e.from("b3cc","hex"),t["skein1024-872"]=e.from("b3cd","hex"),t["skein1024-880"]=e.from("b3ce","hex"),t["skein1024-888"]=e.from("b3cf","hex"),t["skein1024-896"]=e.from("b3d0","hex"),t["skein1024-904"]=e.from("b3d1","hex"),t["skein1024-912"]=e.from("b3d2","hex"),t["skein1024-920"]=e.from("b3d3","hex"),t["skein1024-928"]=e.from("b3d4","hex"),t["skein1024-936"]=e.from("b3d5","hex"),t["skein1024-944"]=e.from("b3d6","hex"),t["skein1024-952"]=e.from("b3d7","hex"),t["skein1024-960"]=e.from("b3d8","hex"),t["skein1024-968"]=e.from("b3d9","hex"),t["skein1024-976"]=e.from("b3da","hex"),t["skein1024-984"]=e.from("b3db","hex"),t["skein1024-992"]=e.from("b3dc","hex"),t["skein1024-1000"]=e.from("b3dd","hex"),t["skein1024-1008"]=e.from("b3de","hex"),t["skein1024-1016"]=e.from("b3df","hex"),t["skein1024-1024"]=e.from("b3e0","hex"),t.ip4=e.from("04","hex"),t.tcp=e.from("06","hex"),t.dccp=e.from("21","hex"),t.ip6=e.from("29","hex"),t.ip6zone=e.from("2a","hex"),t.dns=e.from("35","hex"),t.dns4=e.from("36","hex"),t.dns6=e.from("37","hex"),t.dnsaddr=e.from("38","hex"),t.sctp=e.from("84","hex"),t.udp=e.from("0111","hex"),t["p2p-webrtc-star"]=e.from("0113","hex"),t["p2p-webrtc-direct"]=e.from("0114","hex"),t["p2p-stardust"]=e.from("0115","hex"),t["p2p-circuit"]=e.from("0122","hex"),t.udt=e.from("012d","hex"),t.utp=e.from("012e","hex"),t.unix=e.from("0190","hex"),t.p2p=e.from("01a5","hex"),t.ipfs=e.from("01a5","hex"),t.https=e.from("01bb","hex"),t.onion=e.from("01bc","hex"),t.onion3=e.from("01bd","hex"),t.garlic64=e.from("01be","hex"),t.garlic32=e.from("01bf","hex"),t.quic=e.from("01cc","hex"),t.ws=e.from("01dd","hex"),t.wss=e.from("01de","hex"),t["p2p-websocket-star"]=e.from("01df","hex"),t.http=e.from("01e0","hex"),t.raw=e.from("55","hex"),t["dag-pb"]=e.from("70","hex"),t["dag-cbor"]=e.from("71","hex"),t["libp2p-key"]=e.from("72","hex"),t["git-raw"]=e.from("78","hex"),t["torrent-info"]=e.from("7b","hex"),t["torrent-file"]=e.from("7c","hex"),t["leofcoin-block"]=e.from("81","hex"),t["leofcoin-tx"]=e.from("82","hex"),t["leofcoin-pr"]=e.from("83","hex"),t["eth-block"]=e.from("90","hex"),t["eth-block-list"]=e.from("91","hex"),t["eth-tx-trie"]=e.from("92","hex"),t["eth-tx"]=e.from("93","hex"),t["eth-tx-receipt-trie"]=e.from("94","hex"),t["eth-tx-receipt"]=e.from("95","hex"),t["eth-state-trie"]=e.from("96","hex"),t["eth-account-snapshot"]=e.from("97","hex"),t["eth-storage-trie"]=e.from("98","hex"),t["bitcoin-block"]=e.from("b0","hex"),t["bitcoin-tx"]=e.from("b1","hex"),t["zcash-block"]=e.from("c0","hex"),t["zcash-tx"]=e.from("c1","hex"),t["stellar-block"]=e.from("d0","hex"),t["stellar-tx"]=e.from("d1","hex"),t["decred-block"]=e.from("e0","hex"),t["decred-tx"]=e.from("e1","hex"),t["dash-block"]=e.from("f0","hex"),t["dash-tx"]=e.from("f1","hex"),t["swarm-manifest"]=e.from("fa","hex"),t["swarm-feed"]=e.from("fb","hex"),t["dag-json"]=e.from("0129","hex"),t.path=e.from("2f","hex"),t["ipld-ns"]=e.from("e2","hex"),t["ipfs-ns"]=e.from("e3","hex"),t["swarm-ns"]=e.from("e4","hex"),t["ed25519-pub"]=e.from("ed","hex"),t["holochain-adr-v0"]=e.from("807124","hex"),t["holochain-adr-v1"]=e.from("817124","hex"),t["holochain-key-v0"]=e.from("947124","hex"),t["holochain-key-v1"]=e.from("957124","hex"),t["holochain-sig-v0"]=e.from("a27124","hex"),t["holochain-sig-v1"]=e.from("a37124","hex")}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=function e(t,n){var r,i;function o(e){if(r=e,i)return o.abort();!function e(){for(var o=!0,s=!1;o;)if(s=!1,r(null,function(a,u){if(s=!0,a=a||i){if(o=!1,n)n(!0===a?null:a);else if(a&&!0!==a)throw a}else t&&!1===t(u)||i?(o=!1,r(i||!0,n||function(){})):o||e()}),!s)return void(o=!1)}()}return o.abort=function(e,t){if("function"==typeof e&&(t=e,e=!0),i=e||!0,r)return r(i,t||function(){})},o}},function(e,t){e.exports=function e(t){return t&&("string"==typeof t?function(e){return e[t]}:"object"==typeof t&&"function"==typeof t.exec?function(e){var n=t.exec(e);return n&&n[0]}:t)}},function(e,t,n){var r=n(19);r.pki=r.pki||{};var i=e.exports=r.pki.oids=r.oids=r.oids||{};function o(e,t){i[e]=t,i[t]=e}function s(e,t){i[e]=t}o("1.2.840.113549.1.1.1","rsaEncryption"),o("1.2.840.113549.1.1.4","md5WithRSAEncryption"),o("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),o("1.2.840.113549.1.1.7","RSAES-OAEP"),o("1.2.840.113549.1.1.8","mgf1"),o("1.2.840.113549.1.1.9","pSpecified"),o("1.2.840.113549.1.1.10","RSASSA-PSS"),o("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),o("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),o("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),o("1.2.840.10040.4.3","dsa-with-sha1"),o("1.3.14.3.2.7","desCBC"),o("1.3.14.3.2.26","sha1"),o("2.16.840.1.101.3.4.2.1","sha256"),o("2.16.840.1.101.3.4.2.2","sha384"),o("2.16.840.1.101.3.4.2.3","sha512"),o("1.2.840.113549.2.5","md5"),o("1.2.840.113549.1.7.1","data"),o("1.2.840.113549.1.7.2","signedData"),o("1.2.840.113549.1.7.3","envelopedData"),o("1.2.840.113549.1.7.4","signedAndEnvelopedData"),o("1.2.840.113549.1.7.5","digestedData"),o("1.2.840.113549.1.7.6","encryptedData"),o("1.2.840.113549.1.9.1","emailAddress"),o("1.2.840.113549.1.9.2","unstructuredName"),o("1.2.840.113549.1.9.3","contentType"),o("1.2.840.113549.1.9.4","messageDigest"),o("1.2.840.113549.1.9.5","signingTime"),o("1.2.840.113549.1.9.6","counterSignature"),o("1.2.840.113549.1.9.7","challengePassword"),o("1.2.840.113549.1.9.8","unstructuredAddress"),o("1.2.840.113549.1.9.14","extensionRequest"),o("1.2.840.113549.1.9.20","friendlyName"),o("1.2.840.113549.1.9.21","localKeyId"),o("1.2.840.113549.1.9.22.1","x509Certificate"),o("1.2.840.113549.1.12.10.1.1","keyBag"),o("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),o("1.2.840.113549.1.12.10.1.3","certBag"),o("1.2.840.113549.1.12.10.1.4","crlBag"),o("1.2.840.113549.1.12.10.1.5","secretBag"),o("1.2.840.113549.1.12.10.1.6","safeContentsBag"),o("1.2.840.113549.1.5.13","pkcs5PBES2"),o("1.2.840.113549.1.5.12","pkcs5PBKDF2"),o("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),o("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),o("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),o("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),o("1.2.840.113549.2.7","hmacWithSHA1"),o("1.2.840.113549.2.8","hmacWithSHA224"),o("1.2.840.113549.2.9","hmacWithSHA256"),o("1.2.840.113549.2.10","hmacWithSHA384"),o("1.2.840.113549.2.11","hmacWithSHA512"),o("1.2.840.113549.3.7","des-EDE3-CBC"),o("2.16.840.1.101.3.4.1.2","aes128-CBC"),o("2.16.840.1.101.3.4.1.22","aes192-CBC"),o("2.16.840.1.101.3.4.1.42","aes256-CBC"),o("2.5.4.3","commonName"),o("2.5.4.5","serialName"),o("2.5.4.6","countryName"),o("2.5.4.7","localityName"),o("2.5.4.8","stateOrProvinceName"),o("2.5.4.10","organizationName"),o("2.5.4.11","organizationalUnitName"),o("2.16.840.1.113730.1.1","nsCertType"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),o("2.5.29.14","subjectKeyIdentifier"),o("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),o("2.5.29.17","subjectAltName"),o("2.5.29.18","issuerAltName"),o("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),o("2.5.29.31","cRLDistributionPoints"),o("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),o("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),o("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),o("1.3.6.1.4.1.11129.2.4.2","timestampList"),o("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),o("1.3.6.1.5.5.7.3.1","serverAuth"),o("1.3.6.1.5.5.7.3.2","clientAuth"),o("1.3.6.1.5.5.7.3.3","codeSigning"),o("1.3.6.1.5.5.7.3.4","emailProtection"),o("1.3.6.1.5.5.7.3.8","timeStamping")},function(e,t,n){"use strict";const r=t;r.Reporter=n(905).Reporter,r.DecoderBuffer=n(462).DecoderBuffer,r.EncoderBuffer=n(462).EncoderBuffer,r.Node=n(906)},function(e,t,n){(function(t){e.exports=function e(n,r){for(var i=Math.min(n.length,r.length),o=new t(i),s=0;s{const s=new i(Date.now()+Number(r)).toString(),a=f.ValidityType.EOL;b(e,t,n,s,a,o)},y=(e,t,n,r,i)=>{const o=f.ValidityType.EOL;b(e,t,n,r,o,i)},b=(e,t,n,r,i,o)=>{x(e,t,i,r,(e,s)=>{if(e)return c.error("record signature creation failed"),o(Object.assign(new Error("record signature verification failed"),{code:p.ERR_SIGNATURE_CREATION}));const a={value:t,signature:s,validityType:i,validity:r,sequence:n};return c(`ipns entry for ${t} created`),o(null,a)})},v=(e,t,n)=>{const{value:r,validityType:i,validity:o}=t,s=A(r,i,o);e.verify(s,t.signature,(e,t)=>{if(e||!t)return c.error("record signature verification failed"),n(Object.assign(new Error("record signature verification failed"),{code:p.ERR_SIGNATURE_VERIFICATION}));if(i===f.ValidityType.EOL){let e;try{e=h(o.toString())}catch(e){return c.error("unrecognized validity format (not an rfc3339 format)"),n(Object.assign(new Error("unrecognized validity format (not an rfc3339 format)"),{code:p.ERR_UNRECOGNIZED_FORMAT}))}if(e{if(!e||!e.bytes||!t){const e="one or more of the provided parameters are not defined";return c.error(e),n(Object.assign(new Error(e),{code:p.ERR_UNDEFINED_PARAMETER}))}a.createFromPubKey(e.bytes,(r,i)=>{if(r)return c.error(r),n(Object.assign(new Error(r),{code:p.ERR_PEER_ID_FROM_PUBLIC_KEY}));let o;try{o=I(i)}catch(r){return c.error(r),n(Object.assign(new Error(r),{code:p.ERR_PUBLIC_KEY_FROM_ID}))}if(o)return n(null,null);try{t.pubKey=s.keys.marshalPublicKey(e)}catch(r){return c.error(r),n(r)}n(null,t)})},_=(e,t,n)=>{if(!t||!e){const e="one or more of the provided parameters are not defined";return c.error(e),n(Object.assign(new Error(e),{code:p.ERR_UNDEFINED_PARAMETER}))}if(t.pubKey){let e;try{e=s.keys.unmarshalPublicKey(t.pubKey)}catch(e){return c.error(e),n(e)}return n(null,e)}e.pubKey?n(null,e.pubKey):n(Object.assign(new Error("no public key is available"),{code:p.ERR_UNDEFINED_PARAMETER}))},k=e=>r(e,"RFC4648",{padding:!1}),S=e=>new o(`/ipns/${k(e)}`),E=e=>{const n=t.from("/pk/"),r=t.from("/ipns/");return{routingPubKey:new o(t.concat([n,e])),pkKey:new o(k(t.concat([n,e]))),routingKey:new o(t.concat([r,e])),ipnsKey:new o(k(t.concat([r,e])))}},x=(e,t,n,r,i)=>{const o=A(t,n,r);e.sign(o,(e,t)=>e?i(e):i(null,t))},C=e=>{if("0"===e.toString())return"EOL";{const t=`unrecognized validity type ${e.toString()}`;throw c.error(t),Object.assign(new Error(t),{code:p.ERR_UNRECOGNIZED_VALIDITY})}},A=(e,n,r)=>{const i=t.from(e),o=t.from(C(n)),s=t.from(r);return t.concat([i,s,o])},I=e=>{const t=u.decode(e.id);return t.code!==d?null:s.keys.unmarshalPublicKey(t.digest)},T=f.encode,j=f.decode,O={validate:(e,t,n)=>{const r=j(e),i=t.slice("/ipns/".length);let o;try{o=a.createFromBytes(i)}catch(e){return n(e)}_(o,r,(e,t)=>{if(e)return n(e);v(t,r,e=>{if(e)return n(e);n(null,!0)})})},select:(e,t,n)=>{const r=j(e),i=j(t),o=r.sequence>i.sequence?0:1;if("function"!=typeof n)return o;n(null,o)}};e.exports={create:g,createWithExpiration:y,validate:v,embedPublicKey:w,extractPublicKey:_,getLocalKey:S,getIdKeys:E,marshal:T,unmarshal:j,validator:O,namespace:"/ipns/",namespaceLength:"/ipns/".length}}).call(this,n(0).Buffer)},function(e,t,n){const r=n(6).EventEmitter,i=n(18),o=n(1120);function s(e,t){"object"==typeof e&&(t=e,e="START"),i.equal(typeof e,"string"),i.equal(typeof t,"object"),i.ok(t[e],"invalid starting state "+e),i.ok(o.validate(t));const n=new r;return u._graph=o.reachable(t),u._emitter=n,u._events=t,u._state=e,u.emit=u,u.on=s,u;function s(e,t){n.on(e,t)}function u(e){const t=u._events[u._state][e];if(!a(u._state,t,u._graph)){const t="invalid transition: "+u._state+" -> "+e;return n.emit("error",t)}const r=u._state+":leave",i=t+":enter";return u._state?o():s();function o(){n._events[r]?n.emit(r,s):s()}function s(){n._events[i]?n.emit(i,l):l()}function l(){u._state=t,n.emit(t),n.emit("done")}}}function a(e,t,n){if(!t)return!1;if(!e)return!0;const r=n[e];return!(!r||!r[t])&&1===r[t].length}e.exports=s},function(e,t,n){"use strict";const r=n(24),i=n(44),o=n(23),s=n(186);e.exports=function(e){function t(e){let t=null;if(r.isMultiaddr(e)){const n=r(e);t=n.getPeerId()}else i.isPeerInfo(e)&&(t=e.id.toB58String());return t}function n(t){let n;if(i.isPeerInfo(t))n=t;else if(r.isMultiaddr(t)){const r=t.getPeerId();try{n=e._peerBook.get(r)}catch(e){n=new i(o.createFromB58String(r))}n.multiaddrs.add(t)}else if(o.isPeerId(t)){const r=t.toB58String();n=e._peerBook.has(r)?e._peerBook.get(r):t}return n}function a(t){return e.muxedConns[t]||e.conns[t]}function u(e,t,n){return n=n||(()=>{}),e.write(s.CircuitRelay.encode({type:s.CircuitRelay.Type.STATUS,code:t})),n()}function l(e,t,n,i){try{e.dstPeer.addrs.forEach(e=>r(e))}catch(e){return u(t,n===s.CircuitRelay.Type.HOP?s.CircuitRelay.Status.HOP_DST_MULTIADDR_INVALID:s.CircuitRelay.Status.STOP_DST_MULTIADDR_INVALID),i(e)}try{e.srcPeer.addrs.forEach(e=>r(e))}catch(e){return u(t,n===s.CircuitRelay.Type.HOP?s.CircuitRelay.Status.HOP_SRC_MULTIADDR_INVALID:s.CircuitRelay.Status.STOP_SRC_MULTIADDR_INVALID),i(e)}return i(null)}function c(e){return"string"==typeof e?o.createFromB58String(e):o.createFromBytes(e)}return{getB58String:t,peerInfoFromMa:n,isPeerConnected:a,validateAddrs:l,writeResponse:u,peerIdFromId:c}}},function(e,t,n){"use strict";const r=n(71);e.exports=r("\nmessage CircuitRelay {\n\n enum Status {\n SUCCESS = 100;\n HOP_SRC_ADDR_TOO_LONG = 220;\n HOP_DST_ADDR_TOO_LONG = 221;\n HOP_SRC_MULTIADDR_INVALID = 250;\n HOP_DST_MULTIADDR_INVALID = 251;\n HOP_NO_CONN_TO_DST = 260;\n HOP_CANT_DIAL_DST = 261;\n HOP_CANT_OPEN_DST_STREAM = 262;\n HOP_CANT_SPEAK_RELAY = 270;\n HOP_CANT_RELAY_TO_SELF = 280;\n STOP_SRC_ADDR_TOO_LONG = 320;\n STOP_DST_ADDR_TOO_LONG = 321;\n STOP_SRC_MULTIADDR_INVALID = 350;\n STOP_DST_MULTIADDR_INVALID = 351;\n STOP_RELAY_REFUSED = 390;\n MALFORMED_MESSAGE = 400;\n }\n\n enum Type { // RPC identifier, either HOP, STOP or STATUS\n HOP = 1;\n STOP = 2;\n STATUS = 3;\n CAN_HOP = 4;\n }\n\n message Peer {\n required bytes id = 1; // peer id\n repeated bytes addrs = 2; // peer's known addresses\n }\n\n optional Type type = 1; // Type of the message\n\n optional Peer srcPeer = 2; // srcPeer and dstPeer are used when Type is HOP or STATUS\n optional Peer dstPeer = 3;\n\n optional Status code = 4; // Status code, used when Type is STATUS\n}\n")},function(e,t,n){"use strict";const r=n(3),i=n(88),o=n(65),s=n(9),a="ERR_BAD_PATH";function u(e){const t=new Error("invalid ipfs ref path");e=e.replace(/^\/ipfs\//,"");const n=e.match(/([^/]+(?:\/[^/]+)*)\/?$/);if(!n)throw t;const[r,...i]=n[1].split("/");if(o.cid(r))return{hash:r,links:i};throw t}t.OFFLINE_ERROR="This command must be run in online mode. Try running 'ipfs daemon' first.";const l=e=>{if(o.cid(e))return`/ipfs/${e}`;if(o.path(e))return e;throw Object.assign(new Error(`invalid ${e} path`),{code:a})},c=r(function(e,n,r){Array.isArray(n)||(n=[n]),i(n,(n,r)=>{if("string"!=typeof n){let e;try{e=new s(n)}catch(e){return r(e)}return r(null,e.buffer)}let i;try{i=t.parseIpfsPath(n)}catch(e){return r(e)}const o=new s(i.hash),a=i.links;if(!a.length)return r(null,o.buffer);function u(t,n,i,o){if(i)return r(i);if(!n.length)return r(null,t.buffer);const s=n[0],a=o.links.find(e=>e.name===s);if(!a)return r(new Error(`no link named "${s}" under ${t.toBaseEncodedString()}`));e.get(a.cid,u.bind(null,a.cid,n.slice(1)))}e.get(o,u.bind(null,o,a))},r)});t.normalizePath=l,t.parseIpfsPath=u,t.resolvePath=c},function(e,t){function n(e){return"function"==typeof e}function r(e){return"object"==typeof e&&i(e.source)&&o(e.sink)}function i(e){return n(e)&&2===e.length}function o(e){return n(e)&&1===e.length}t.isDuplex=r,t.isSource=i,t.isSink=o},function(e,t,n){var r=n(525);e.exports=function(e,t){return function(n){var i=[],o,s;function a(e){i.push(e)}e=e||function(e){this.queue(e)},t=t||function(){this.queue(null)};var u={emit:function(e,t){"data"==e&&a(t),"end"==e&&(o=!0,a(null)),"error"==e&&(s=t)},queue:a},l;return function(a,c){if(o=o||a,a)return n(a,function(){if(l){var e=l;l=null,e(a)}c(a)});l=c,r(function r(a){if(l)if(c=l,s)l=null,c(s);else if(i.length){var f=i.shift();l=null,c(null===f,f)}else n(o,function(i,f){if(i&&!0!==i)return s=i,a();if(o=o||i)t.call(u);else if(null!==f&&(e.call(u,f),s||o))return n(s||o,function(){l=null,c(s||o)});a(r)})})}}}},function(e,t,n){var r=t;r.utils=n(93),r.common=n(191),r.sha=n(1337),r.ripemd=n(1341),r.hmac=n(1342),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},function(e,t,n){"use strict";var r=n(93),i=n(107);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=o,o.prototype.update=function e(t,n){if(t=r.toArray(t,n),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var i=t.length%this._delta8;this.pending=t.slice(t.length-i,t.length),0===this.pending.length&&(this.pending=null),t=r.join32(t,0,t.length-i,this.endian);for(var o=0;o>>24&255,i[o++]=t>>>16&255,i[o++]=t>>>8&255,i[o++]=255&t}else for(i[o++]=255&t,i[o++]=t>>>8&255,i[o++]=t>>>16&255,i[o++]=t>>>24&255,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,s=8;st.length)throw new Error("invalid rlp: total length is larger than the data");if(s=t.slice(r,f),0===s.length)throw new Error("invalid rlp, List has a invalid length");for(;s.length;)a=l(s),u.push(a.data),s=a.remainder;return{data:u,remainder:t.slice(f)}}function c(e){return"0x"===e.slice(0,2)}function f(e){return"string"!=typeof e?e:c(e)?e.slice(2):e}function h(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");var t=e.toString(16);return t.length%2?"0"+t:t}function p(e){return e.length%2?"0"+e:e}function d(t){var n=h(t);return e.from(n,"hex")}function m(t){if(!e.isBuffer(t)){if("string"==typeof t)return c(t)?e.from(p(f(t)),"hex"):e.from(t);if("number"==typeof t)return t?d(t):e.from([]);if(null===t||void 0===t)return e.from([]);if(t instanceof Uint8Array)return e.from(t);if(r.isBN(t))return e.from(t.toArray());throw new Error("invalid type")}return t}t.encode=i,t.decode=a,t.getLength=u}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(9),i=n(35);function o(e,t,n){n=n||{};const o=n.hashAlg||"keccak-256",s=void 0===n.version?1:n.version,a=i.encode(t,o);return new r(s,e,a)}e.exports=o},function(e,t,n){"use strict";const r=n(11),i=n(588),o=n(589);function s(e,t,n){const s=o(e,t),a={multicodec:e,defaultHashAlg:"keccak-256",resolve:c,tree:u,isLink:i(c),_resolveFromEthObject:f,_treeFromEthObject:l,_mapFromEthObject:n};return{resolver:a,util:s};function u(e,t,n){"function"==typeof t&&(n=t,t=void 0),t||(t={}),r([t=>s.deserialize(e,t),(e,n)=>l(e,t,n)],n)}function l(e,t,i){r([r=>n(e,t,r),(e,t)=>t(null,e.map(e=>e.path))],i)}function c(e,t,n){r([t=>s.deserialize(e,t),(e,n)=>f(e,t,n)],n)}function f(e,t,r){if(!t||"/"===t){const t={value:e,remainderPath:""};return r(null,t)}n(e,{},(e,n)=>{if(e)return r(e);const i=t.split("/");let o=n.filter(e=>e.path===t.slice(0,e.path.length));o=o.filter(e=>e.path.split("/").every((e,t)=>e===i[t]));const s=o.sort((e,t)=>t.path.length-e.path.length),a=s[0];if(!a){let e=new Error('Path not found ("'+t+'").');return r(e)}const u=t.slice(a.path.length+1),l={value:a.value,remainderPath:u};return r(null,l)})}}e.exports=s},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(274),o=n(0),s=n(60).sha256sha256,a=function e(n){if(!(this instanceof e))return new e(n);if(t.isBuffer(n)){var r=n;this.fromBuffer(r)}else if("string"==typeof n){var i=n;this.fromString(i)}else n&&this.set(n)};a.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},a.validChecksum=function e(t,n){return r.isString(t)&&(t=new o.Buffer(i.decode(t))),r.isString(n)&&(n=new o.Buffer(i.decode(n))),n||(n=t.slice(-4),t=t.slice(0,-4)),a.checksum(t).toString("hex")===n.toString("hex")},a.decode=function(e){if("string"!=typeof e)throw new Error("Input must be a string");var n=new t(i.decode(e));if(n.length<4)throw new Error("Input string too short");var r=n.slice(0,-4),o=n.slice(-4),a=s(r),u=a.slice(0,4);if(o.toString("hex")!==u.toString("hex"))throw new Error("Checksum mismatch");return r},a.checksum=function(e){return s(e).slice(0,4)},a.encode=function(e){if(!t.isBuffer(e))throw new Error("Input must be a buffer");var n=new t(e.length+4),r=a.checksum(e);return e.copy(n),r.copy(n,e.length),i.encode(n)},a.prototype.fromBuffer=function(e){return this.buf=e,this},a.prototype.fromString=function(e){var t=a.decode(e);return this.buf=t,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(17),i=n(25),o=n(84),s=n(80),a=n(0),u=n(30),l=n(41),c=n(86),f=n(110),h=n(111),p=4294967295,d=p-2,m=p,g=p-1;function y(e){return this instanceof y?e?this._fromObject(e):void 0:new y(e)}y.MAXINT=p,y.DEFAULT_SEQNUMBER=4294967295,y.DEFAULT_LOCKTIME_SEQNUMBER=4294967294,y.DEFAULT_RBF_SEQNUMBER=4294967293,Object.defineProperty(y.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new c(this._scriptBuffer),this._script._isInput=!0),this._script)}}),y.fromObject=function(e){i.checkArgument(r.isObject(e));var t=new y;return t._fromObject(e)},y.prototype._fromObject=function(e){var t;if(t=r.isString(e.prevTxId)&&l.isHexa(e.prevTxId)?new a.Buffer(e.prevTxId,"hex"):e.prevTxId,this.output=e.output?e.output instanceof h?e.output:new h(e.output):void 0,this.prevTxId=t||e.txidbuf,this.outputIndex=r.isUndefined(e.outputIndex)?e.txoutnum:e.outputIndex,this.sequenceNumber=r.isUndefined(e.sequenceNumber)?r.isUndefined(e.seqnum)?4294967295:e.seqnum:e.sequenceNumber,r.isUndefined(e.script)&&r.isUndefined(e.scriptBuffer))throw new o.Transaction.Input.MissingScript;return this.setScript(e.scriptBuffer||e.script),this},y.prototype.toObject=y.prototype.toJSON=function e(){var t={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(t.scriptString=this.script.toString()),this.output&&(t.output=this.output.toObject()),t},y.fromBufferReader=function(e){var t=new y;return t.prevTxId=e.readReverse(32),t.outputIndex=e.readUInt32LE(),t._scriptBuffer=e.readVarLengthBuffer(),t.sequenceNumber=e.readUInt32LE(),t},y.prototype.toBufferWriter=function(e){e||(e=new s),e.writeReverse(this.prevTxId),e.writeUInt32LE(this.outputIndex);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e.writeUInt32LE(this.sequenceNumber),e},y.prototype.setScript=function(e){if(this._script=null,e instanceof c)this._script=e,this._script._isInput=!0,this._scriptBuffer=e.toBuffer();else if(l.isHexa(e))this._scriptBuffer=new a.Buffer(e,"hex");else if(r.isString(e))this._script=new c(e),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else{if(!u.isBuffer(e))throw new TypeError("Invalid argument type: script");this._scriptBuffer=new a.Buffer(e)}return this},y.prototype.getSignatures=function(){throw new o.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))},y.prototype.isFullySigned=function(){throw new o.AbstractMethodInvoked("Input#isFullySigned")},y.prototype.isFinal=function(){return 4294967295!==this.sequenceNumber},y.prototype.addSignature=function(){throw new o.AbstractMethodInvoked("Input#addSignature")},y.prototype.clearSignatures=function(){throw new o.AbstractMethodInvoked("Input#clearSignatures")},y.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,f.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script)},y.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},y.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},e.exports=y},function(e,t){"function"==typeof Object.create?e.exports=function e(t,n){t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function e(t,n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(25),o=n(198),s=n(30),a=n(41),u=n(96),l=n(84),c=n(85);function f(e){if(!(this instanceof f))return new f(e);if(e instanceof f)return e;if(r.isObject(e))return this._fromObject(e);throw new l.InvalidArgument("TransactionSignatures must be instantiated from an object")}o(f,c),f.prototype._fromObject=function(e){return this._checkObjectArgs(e),this.publicKey=new u(e.publicKey),this.prevTxId=s.isBuffer(e.prevTxId)?e.prevTxId:new t(e.prevTxId,"hex"),this.outputIndex=e.outputIndex,this.inputIndex=e.inputIndex,this.signature=e.signature instanceof c?e.signature:s.isBuffer(e.signature)?c.fromBuffer(e.signature):c.fromString(e.signature),this.sigtype=e.sigtype,this},f.prototype._checkObjectArgs=function(e){i.checkArgument(u(e.publicKey),"publicKey"),i.checkArgument(!r.isUndefined(e.inputIndex),"inputIndex"),i.checkArgument(!r.isUndefined(e.outputIndex),"outputIndex"),i.checkState(r.isNumber(e.inputIndex),"inputIndex must be a number"),i.checkState(r.isNumber(e.outputIndex),"outputIndex must be a number"),i.checkArgument(e.signature,"signature"),i.checkArgument(e.prevTxId,"prevTxId"),i.checkState(e.signature instanceof c||s.isBuffer(e.signature)||a.isHexa(e.signature),"signature must be a buffer or hexa value"),i.checkState(s.isBuffer(e.prevTxId)||a.isHexa(e.prevTxId),"prevTxId must be a buffer or hexa value"),i.checkArgument(e.sigtype,"sigtype"),i.checkState(r.isNumber(e.sigtype),"sigtype must be a number")},f.prototype.toObject=f.prototype.toJSON=function e(){return{publicKey:this.publicKey.toString(),prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,inputIndex:this.inputIndex,signature:this.signature.toString(),sigtype:this.sigtype}},f.fromObject=function(e){return i.checkArgument(e),new f(e)},e.exports=f}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var r=n(20).Writable,i=n(1),o=n(278);if("undefined"==typeof Uint8Array)var s=n(1461).Uint8Array;else var s=Uint8Array;function a(e,t){if(!(this instanceof a))return new a(e,t);"function"==typeof e&&(t=e,e={}),e||(e={});var n=e.encoding,i=!1;n?(n=String(n).toLowerCase(),"u8"!==n&&"uint8"!==n||(n="uint8array")):i=!0,r.call(this,{objectMode:!0}),this.encoding=n,this.shouldInferEncoding=i,t&&this.on("finish",function(){t(this.getBody())}),this.body=[]}e.exports=a,i(a,r),a.prototype._write=function(e,t,n){this.body.push(e),n()},a.prototype.inferEncoding=function(e){var n=void 0===e?this.body[0]:e;return t.isBuffer(n)?"buffer":"undefined"!=typeof Uint8Array&&n instanceof Uint8Array?"uint8array":Array.isArray(n)?"array":"string"==typeof n?"string":"[object Object]"===Object.prototype.toString.call(n)?"object":"buffer"},a.prototype.getBody=function(){return this.encoding||0!==this.body.length?(this.shouldInferEncoding&&(this.encoding=this.inferEncoding()),"array"===this.encoding?p(this.body):"string"===this.encoding?f(this.body):"buffer"===this.encoding?h(this.body):"uint8array"===this.encoding?d(this.body):this.body):[]};var u=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)};function l(e){return/Array\]$/.test(Object.prototype.toString.call(e))}function c(e){return"string"==typeof e||l(e)||e&&"function"==typeof e.subarray}function f(e){for(var n=[],r=!1,i=0;in=>{let f,h=!1,p=!1;n=n?Object.assign({},n,n.qs):{};const d=new u,m=new r({objectMode:!0});m._read=(e=>{}),m._write=((e,t,r)=>{const o=s(r);try{const r=a(e,n).map(e=>Object.assign({headers:l(e)},e));p=!0,i(r,(e,n)=>d.write(e,t,n),e=>{if(p=!1,e)return o(e);h&&d.end(),o()})}catch(e){o(e)}}),m.once("finish",()=>{h||(h=!0,p||d.end())});const g=n.qs||{};g["cid-version"]=c(n,"cid-version","cidVersion"),g["raw-leaves"]=c(n,"raw-leaves","rawLeaves"),g["only-hash"]=c(n,"only-hash","onlyHash"),g["wrap-with-directory"]=c(n,"wrap-with-directory","wrapWithDirectory"),g.hash=c(n,"hash","hashAlg");const y={path:t,qs:g,args:n.args,multipart:!0,multipartBoundary:d._boundary,stream:!0,recursive:!0,progress:n.progress};return d.on("error",e=>{m.emit("error",e)}),f=e(y,(e,t)=>{if(e)return m.emit("error",e);if(!t)return m.push(null);if(!o(t))return m.push(t),void m.push(null);if(t.on("error",e=>m.emit("error",e)),n.converter){t.on("data",e=>{e.Bytes&&n.progress&&n.progress(e.Bytes)});const e=n.converter,r=new e;r.once("end",()=>m.push(null)),r.on("data",e=>m.push(e)),t.pipe(r)}else t.on("data",e=>{e.Bytes&&n.progress&&n.progress(e.Bytes),m.push(e)}),t.once("end",()=>m.push(null))}),f.on("drain",()=>d.emit("drain")),d.pipe(f),m})},function(e,t){e.exports=!1},function(e,t,n){var r=n(154),i=n(32),o=e.exports;for(var s in r)r.hasOwnProperty(s)&&(o[s]=r[s]);function a(e){if("string"==typeof e&&(e=i.parse(e)),e.protocol||(e.protocol="https:"),"https:"!==e.protocol)throw new Error('Protocol "'+e.protocol+'" not supported. Expected "https:"');return e}o.request=function(e,t){return e=a(e),r.request.call(this,e,t)},o.get=function(e,t){return e=a(e),r.get.call(this,e,t)}},function(e,t,n){"use strict";var r=n(10),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=f;var o=n(7);o.inherits=n(1);var s=n(1492),a=n(1496);o.inherits(f,s);for(var u=i(a.prototype),l=0;l>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")}e.exports=l,e.exports.sync=u},function(e,t,n){e.exports=d;var r=n(27),i=n(31).Buffer,o=n(55),s=n(15),a=n(97),u=n(46),l=n(50),c=n(212),f=n(47),h=a.FingerprintFormatError,p=a.InvalidAlgorithmError;function d(e){if(r.object(e,"options"),r.string(e.type,"options.type"),r.buffer(e.hash,"options.hash"),r.string(e.algorithm,"options.algorithm"),this.algorithm=e.algorithm.toLowerCase(),!0!==o.hashAlgs[this.algorithm])throw new p(this.algorithm);this.hash=e.hash,this.type=e.type,this.hashType=e.hashType}d.prototype.toString=function(e){switch(void 0===e&&(e="md5"===this.algorithm||"spki"===this.hashType?"hex":"base64"),r.string(e),e){case"hex":return"spki"===this.hashType?this.hash.toString("hex"):y(this.hash.toString("hex"));case"base64":return"spki"===this.hashType?this.hash.toString("base64"):v(this.algorithm,this.hash.toString("base64"));default:throw new h(void 0,e)}},d.prototype.matches=function(e){r.object(e,"key or certificate"),"key"===this.type&&"ssh"!==this.hashType?(f.assertCompatible(e,u,[1,7],"key with spki"),l.isPrivateKey(e)&&f.assertCompatible(e,l,[1,6],"privatekey with spki support")):"key"===this.type?f.assertCompatible(e,u,[1,0],"key"):f.assertCompatible(e,c,[1,0],"certificate");var t=e.hash(this.algorithm,this.hashType),n=s.createHash(this.algorithm).update(t).digest("base64");return void 0===this.hash2&&(this.hash2=s.createHash(this.algorithm).update(this.hash).digest("base64")),this.hash2===n};var m=/^[A-Za-z0-9+\/=]+$/,g=/^[a-fA-F0-9]+$/;function y(e){return e.replace(/(.{2})(?=.)/g,"$1:")}function b(e){return e.replace(/=*$/,"")}function v(e,t){return e.toUpperCase()+":"+b(t)}d.parse=function(e,t){var n,s,a;r.string(e,"fingerprint"),Array.isArray(t)&&(a=t,t={}),r.optionalObject(t,"options"),void 0===t&&(t={}),void 0!==t.enAlgs&&(a=t.enAlgs),void 0!==t.algorithms&&(a=t.algorithms),r.optionalArrayOfString(a,"algorithms");var u="ssh";void 0!==t.hashType&&(u=t.hashType),r.string(u,"options.hashType");var l=e.split(":");if(2==l.length){if(n=l[0].toLowerCase(),!m.test(l[1]))throw new h(e);try{s=i.from(l[1],"base64")}catch(t){throw new h(e)}}else if(l.length>2){if(n="md5","md5"===l[0].toLowerCase()&&(l=l.slice(1)),l=l.map(function(t){for(;t.length<2;)t="0"+t;if(t.length>2)throw new h(e);return t}),l=l.join(""),!g.test(l)||l.length%2!=0)throw new h(e);try{s=i.from(l,"hex")}catch(t){throw new h(e)}}else{if(g.test(e))s=i.from(e,"hex");else{if(!m.test(e))throw new h(e);s=i.from(e,"base64")}switch(s.length){case 32:n="sha256";break;case 16:n="md5";break;case 20:n="sha1";break;case 64:n="sha512";break;default:throw new h(e)}void 0===t.hashType&&(u="spki")}if(void 0===n)throw new h(e);if(void 0===o.hashAlgs[n])throw new p(n);if(void 0!==a&&(a=a.map(function(e){return e.toLowerCase()}),-1===a.indexOf(n)))throw new p(n);return new d({algorithm:n,hash:s,type:t.type||"key",hashType:u})},d.isFingerprint=function(e,t){return f.isCompatible(e,d,t)},d.prototype._sshpkApiVersion=[1,2],d._oldVersionDetect=function(e){return r.func(e.toString),r.func(e.matches),[1,0]}},function(e,t,n){(function(){var n,r=0xdeadbeefcafe,i=!0;function o(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new o(null)}function a(e,t,n,r,i,o){for(;--o>=0;){var s=t*this[e++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i}function u(e,t,n,r,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var u=32767&this[e],l=this[e++]>>15,c=a*u+l*s;u=s*u+((32767&c)<<15)+n[r]+(1073741823&i),i=(u>>>30)+(c>>>15)+a*l+(i>>>30),n[r++]=1073741823&u}return i}function l(e,t,n,r,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var u=16383&this[e],l=this[e++]>>14,c=a*u+l*s;u=s*u+((16383&c)<<14)+n[r]+i,i=(u>>28)+(c>>14)+a*l,n[r++]=268435455&u}return i}var c="undefined"!=typeof navigator;c&&"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=u,n=30):c&&"Netscape"!=navigator.appName?(o.prototype.am=a,n=26):(o.prototype.am=l,n=28),o.prototype.DB=n,o.prototype.DM=(1<=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function v(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function w(e){var t=s();return t.fromInt(e),t}function _(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,s=0;--r>=0;){var a=8==n?255&e[r]:y(e,r);a<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==s?this[this.t++]=a:s+n>this.DB?(this[this.t-1]|=(a&(1<>this.DB-s):this[this.t-1]|=a<=this.DB&&(s-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==e;)--this.t}function S(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n=(1<0)for(a>a)>0&&(i=!0,o=g(r));s>=0;)a>(a+=this.DB-t)):(r=this[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=g(r));return i?o:"0"}function E(){var e=s();return o.ZERO.subTo(this,e),e}function x(){return this.s<0?this.negate():this}function C(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(t=n-e.t,0!=t)return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0}function A(e){var t=1,n;return 0!=(n=e>>>16)&&(e=n,t+=16),0!=(n=e>>8)&&(e=n,t+=8),0!=(n=e>>4)&&(e=n,t+=4),0!=(n=e>>2)&&(e=n,t+=2),0!=(n=e>>1)&&(e=n,t+=1),t}function I(){return this.t<=0?0:this.DB*(this.t-1)+A(this[this.t-1]^this.s&this.DM)}function T(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s}function j(e,t){for(var n=e;n=0;--a)t[a+o+1]=this[a]>>r|s,s=(this[a]&i)<=0;--a)t[a]=0;t[o]=s,t.t=this.t+o+1,t.s=this.s,t.clamp()}function P(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<>r;for(var s=n+1;s>r;r>0&&(t[this.t-n-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()}function R(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t[i]=0;for(i=0;i=0;)e[n]=0;for(n=0;n=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()}function M(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t0?(r.lShiftTo(c,a),i.lShiftTo(c,n)):(r.copyTo(a),i.copyTo(n));var f=a.t,h=a[f-1];if(0!=h){var p=h*(1<1?a[f-2]>>this.F2:0),d=this.FV/p,m=(1<=0&&(n[n.t++]=1,n.subTo(v,n)),o.ONE.dlShiftTo(f,v),v.subTo(a,a);a.t=0;){var w=n[--y]==h?this.DM:Math.floor(n[y]*d+(n[y-1]+g)*m);if((n[y]+=a.am(0,w,n,b,0,f))0&&n.rShiftTo(c,n),u<0&&o.ZERO.subTo(n,n)}}}function L(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(o.ZERO)>0&&e.subTo(t,t),t}function F(e){this.m=e}function D(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function U(e){return e}function z(e){e.divRemTo(this.m,null,e)}function q(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function K(e,t){e.squareTo(t),this.reduce(t)}function H(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function V(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function $(e){var t=s();return e.copyTo(t),this.reduce(t),t}function G(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function Y(e,t){e.squareTo(t),this.reduce(t)}function J(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function Z(){return 0==(this.t>0?1&this[0]:this.s)}function Q(e,t){if(e>4294967295||e<1)return o.ONE;var n=s(),r=s(),i=t.convert(this),a=A(e)-1;for(i.copyTo(n);--a>=0;)if(t.sqrTo(n,r),(e&1<0)t.mulTo(r,i,n);else{var u=n;n=r,r=u}return t.revert(n)}function X(e,t){var n;return n=e<256||t.isEven()?new F(t):new V(t),this.exp(e,n)}function ee(){var e=s();return this.copyTo(e),e}function te(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function re(){return 0==this.t?this.s:this[0]<<16>>16}function ie(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function oe(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function se(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),r=w(n),i=s(),o=s(),a="";for(this.divRemTo(r,i,o);i.signum()>0;)a=(n+o.intValue()).toString(e).substr(1)+a,i.divRemTo(r,i,o);return o.intValue().toString(e)+a}function ae(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),r=Math.pow(t,n),i=!1,s=0,a=0,u=0;u=n&&(this.dMultiply(r),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(a,0)),i&&o.ZERO.subTo(this,this)}function ue(e,t,n){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(o.ONE.shiftLeft(e-1),ge,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(o.ONE.shiftLeft(e-1),this);else{var r=new Array,i=7&e;r.length=1+(e>>3),t.nextBytes(r),i>0?r[0]&=(1<0)for(n>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<=0;)n<8?(r=(this[e]&(1<>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t}function ce(e){return 0==this.compareTo(e)}function fe(e){return this.compareTo(e)<0?this:e}function he(e){return this.compareTo(e)>0?this:e}function pe(e,t,n){var r,i,o=Math.min(e.t,this.t);for(r=0;r>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function Ce(){for(var e=0;e=this.t?0!=this.s:0!=(this[t]&1<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()}function Ne(e){var t=s();return this.addTo(e,t),t}function Me(e){var t=s();return this.subTo(e,t),t}function Le(e){var t=s();return this.multiplyTo(e,t),t}function Fe(){var e=s();return this.squareTo(e),e}function De(e){var t=s();return this.divRemTo(e,t,null),t}function Ue(e){var t=s();return this.divRemTo(e,null,t),t}function ze(e){var t=s(),n=s();return this.divRemTo(e,t,n),new Array(t,n)}function qe(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Ke(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function He(){}function Ve(e){return e}function We(e,t,n){e.multiplyTo(t,n)}function $e(e,t){e.squareTo(t)}function Ge(e){return this.exp(e,new He)}function Ye(e,t,n){var r=Math.min(this.t+e.t,t),i;for(n.s=0,n.t=r;r>0;)n[--r]=0;for(i=n.t-this.t;r=0;)n[r]=0;for(r=Math.max(t-this.t,0);r2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t}function Xe(e){return e}function et(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function tt(e,t){e.squareTo(t),this.reduce(t)}function nt(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function rt(e,t){var n=e.bitLength(),r,i=w(1),o;if(n<=0)return i;r=n<18?1:n<48?3:n<144?4:n<768?5:6,o=n<8?new F(t):t.isEven()?new Ze(t):new V(t);var a=new Array,u=3,l=r-1,c=(1<1){var f=s();for(o.sqrTo(a[1],f);u<=c;)a[u]=s(),o.mulTo(f,a[u-2],a[u]),u+=2}var h=e.t-1,p,d=!0,m=s(),g;for(n=A(e[h])-1;h>=0;){for(n>=l?p=e[h]>>n-l&c:(p=(e[h]&(1<0&&(p|=e[h-1]>>this.DB+n-l)),u=r;0==(1&p);)p>>=1,--u;if((n-=u)<0&&(n+=this.DB,--h),d)a[p].copyTo(i),d=!1;else{for(;u>1;)o.sqrTo(i,m),o.sqrTo(m,i),u-=2;u>0?o.sqrTo(i,m):(g=i,i=m,m=g),o.mulTo(m,a[p],i)}for(;h>=0&&0==(e[h]&1<0&&(t.rShiftTo(o,t),n.rShiftTo(o,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n}function ot(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this[r])%e;return n}function st(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return o.ZERO;for(var n=e.clone(),r=this.clone(),i=w(1),s=w(0),a=w(0),u=w(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),t?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;r.isEven();)r.rShiftTo(1,r),t?(a.isEven()&&u.isEven()||(a.addTo(this,a),u.subTo(e,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);n.compareTo(r)>=0?(n.subTo(r,n),t&&i.subTo(a,i),s.subTo(u,s)):(r.subTo(n,r),t&&a.subTo(i,a),u.subTo(s,u))}return 0!=r.compareTo(o.ONE)?o.ZERO:u.compareTo(e)>=0?u.subtract(e):u.signum()<0?(u.addTo(e,u),u.signum()<0?u.add(e):u):u}F.prototype.convert=D,F.prototype.revert=U,F.prototype.reduce=z,F.prototype.mulTo=q,F.prototype.sqrTo=K,V.prototype.convert=W,V.prototype.revert=$,V.prototype.reduce=G,V.prototype.mulTo=J,V.prototype.sqrTo=Y,o.prototype.copyTo=b,o.prototype.fromInt=v,o.prototype.fromString=_,o.prototype.clamp=k,o.prototype.dlShiftTo=T,o.prototype.drShiftTo=j,o.prototype.lShiftTo=O,o.prototype.rShiftTo=P,o.prototype.subTo=B,o.prototype.multiplyTo=R,o.prototype.squareTo=N,o.prototype.divRemTo=M,o.prototype.invDigit=H,o.prototype.isEven=Z,o.prototype.exp=Q,o.prototype.toString=S,o.prototype.negate=E,o.prototype.abs=x,o.prototype.compareTo=C,o.prototype.bitLength=I,o.prototype.mod=L,o.prototype.modPowInt=X,o.ZERO=w(0),o.ONE=w(1),He.prototype.convert=Ve,He.prototype.revert=Ve,He.prototype.mulTo=We,He.prototype.sqrTo=$e,Ze.prototype.convert=Qe,Ze.prototype.revert=Xe,Ze.prototype.reduce=et,Ze.prototype.mulTo=nt,Ze.prototype.sqrTo=tt;var at=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],ut=(1<<26)/at[at.length-1],lt,ct,ft;function ht(e){var t,n=this.abs();if(1==n.t&&n[0]<=at[at.length-1]){for(t=0;t>1,e>at.length&&(e=at.length);for(var i=s(),a=0;a>8&255,ct[ft++]^=e>>16&255,ct[ft++]^=e>>24&255,ft>=Ct&&(ft-=Ct)}function mt(){dt((new Date).getTime())}if(o.prototype.chunkSize=ie,o.prototype.toRadix=se,o.prototype.fromRadix=ae,o.prototype.fromNumber=ue,o.prototype.bitwiseTo=pe,o.prototype.changeBit=je,o.prototype.addTo=Re,o.prototype.dMultiply=qe,o.prototype.dAddOffset=Ke,o.prototype.multiplyLowerTo=Ye,o.prototype.multiplyUpperTo=Je,o.prototype.modInt=ot,o.prototype.millerRabin=pt,o.prototype.clone=ee,o.prototype.intValue=te,o.prototype.byteValue=ne,o.prototype.shortValue=re,o.prototype.signum=oe,o.prototype.toByteArray=le,o.prototype.equals=ce,o.prototype.min=fe,o.prototype.max=he,o.prototype.and=me,o.prototype.or=ye,o.prototype.xor=ve,o.prototype.andNot=_e,o.prototype.not=ke,o.prototype.shiftLeft=Se,o.prototype.shiftRight=Ee,o.prototype.getLowestSetBit=Ce,o.prototype.bitCount=Ie,o.prototype.testBit=Te,o.prototype.setBit=Oe,o.prototype.clearBit=Pe,o.prototype.flipBit=Be,o.prototype.add=Ne,o.prototype.subtract=Me,o.prototype.multiply=Le,o.prototype.divide=De,o.prototype.remainder=Ue,o.prototype.divideAndRemainder=ze,o.prototype.modPow=rt,o.prototype.modInverse=st,o.prototype.pow=Ge,o.prototype.gcd=it,o.prototype.isProbablePrime=ht,o.prototype.square=Fe,o.prototype.Barrett=Ze,null==ct){var gt;if(ct=new Array,ft=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var yt=new Uint8Array(32);for(window.crypto.getRandomValues(yt),gt=0;gt<32;++gt)ct[ft++]=yt[gt]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var bt=window.crypto.random(32);for(gt=0;gt>>8,ct[ft++]=255>ft=0,mt()}function vt(){if(null==lt){for(mt(),lt=xt(),lt.init(ct),ft=0;ft>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=255&r}function m(e,t,n,r,i){var o,s=0;for(o=0;o>>8)-1}function g(e,t,n,r){return m(e,t,n,r,16)}function y(e,t,n,r){return m(e,t,n,r,32)}function b(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,l=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,b=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,v=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,w=i,_=o,k=s,S=a,E=u,x=l,C=c,A=f,I=h,T=p,j=d,O=m,P=g,B=y,R=b,N=v,M,L=0;L<20;L+=2)M=w+P|0,E^=M<<7|M>>>25,M=E+w|0,I^=M<<9|M>>>23,M=I+E|0,P^=M<<13|M>>>19,M=P+I|0,w^=M<<18|M>>>14,M=x+_|0,T^=M<<7|M>>>25,M=T+x|0,B^=M<<9|M>>>23,M=B+T|0,_^=M<<13|M>>>19,M=_+B|0,x^=M<<18|M>>>14,M=j+C|0,R^=M<<7|M>>>25,M=R+j|0,k^=M<<9|M>>>23,M=k+R|0,C^=M<<13|M>>>19,M=C+k|0,j^=M<<18|M>>>14,M=N+O|0,S^=M<<7|M>>>25,M=S+N|0,A^=M<<9|M>>>23,M=A+S|0,O^=M<<13|M>>>19,M=O+A|0,N^=M<<18|M>>>14,M=w+S|0,_^=M<<7|M>>>25,M=_+w|0,k^=M<<9|M>>>23,M=k+_|0,S^=M<<13|M>>>19,M=S+k|0,w^=M<<18|M>>>14,M=x+E|0,C^=M<<7|M>>>25,M=C+x|0,A^=M<<9|M>>>23,M=A+C|0,E^=M<<13|M>>>19,M=E+A|0,x^=M<<18|M>>>14,M=j+T|0,O^=M<<7|M>>>25,M=O+j|0,I^=M<<9|M>>>23,M=I+O|0,T^=M<<13|M>>>19,M=T+I|0,j^=M<<18|M>>>14,M=N+R|0,P^=M<<7|M>>>25,M=P+N|0,B^=M<<9|M>>>23,M=B+P|0,R^=M<<13|M>>>19,M=R+B|0,N^=M<<18|M>>>14;w=w+i|0,_=_+o|0,k=k+s|0,S=S+a|0,E=E+u|0,x=x+l|0,C=C+c|0,A=A+f|0,I=I+h|0,T=T+p|0,j=j+d|0,O=O+m|0,P=P+g|0,B=B+y|0,R=R+b|0,N=N+v|0,e[0]=w>>>0&255,e[1]=w>>>8&255,e[2]=w>>>16&255,e[3]=w>>>24&255,e[4]=_>>>0&255,e[5]=_>>>8&255,e[6]=_>>>16&255,e[7]=_>>>24&255,e[8]=k>>>0&255,e[9]=k>>>8&255,e[10]=k>>>16&255,e[11]=k>>>24&255,e[12]=S>>>0&255,e[13]=S>>>8&255,e[14]=S>>>16&255,e[15]=S>>>24&255,e[16]=E>>>0&255,e[17]=E>>>8&255,e[18]=E>>>16&255,e[19]=E>>>24&255,e[20]=x>>>0&255,e[21]=x>>>8&255,e[22]=x>>>16&255,e[23]=x>>>24&255,e[24]=C>>>0&255,e[25]=C>>>8&255,e[26]=C>>>16&255,e[27]=C>>>24&255,e[28]=A>>>0&255,e[29]=A>>>8&255,e[30]=A>>>16&255,e[31]=A>>>24&255,e[32]=I>>>0&255,e[33]=I>>>8&255,e[34]=I>>>16&255,e[35]=I>>>24&255,e[36]=T>>>0&255,e[37]=T>>>8&255,e[38]=T>>>16&255,e[39]=T>>>24&255,e[40]=j>>>0&255,e[41]=j>>>8&255,e[42]=j>>>16&255,e[43]=j>>>24&255,e[44]=O>>>0&255,e[45]=O>>>8&255,e[46]=O>>>16&255,e[47]=O>>>24&255,e[48]=P>>>0&255,e[49]=P>>>8&255,e[50]=P>>>16&255,e[51]=P>>>24&255,e[52]=B>>>0&255,e[53]=B>>>8&255,e[54]=B>>>16&255,e[55]=B>>>24&255,e[56]=R>>>0&255,e[57]=R>>>8&255,e[58]=R>>>16&255,e[59]=R>>>24&255,e[60]=N>>>0&255,e[61]=N>>>8&255,e[62]=N>>>16&255,e[63]=N>>>24&255}function v(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,l=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,b=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,v=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,w=i,_=o,k=s,S=a,E=u,x=l,C=c,A=f,I=h,T=p,j=d,O=m,P=g,B=y,R=b,N=v,M,L=0;L<20;L+=2)M=w+P|0,E^=M<<7|M>>>25,M=E+w|0,I^=M<<9|M>>>23,M=I+E|0,P^=M<<13|M>>>19,M=P+I|0,w^=M<<18|M>>>14,M=x+_|0,T^=M<<7|M>>>25,M=T+x|0,B^=M<<9|M>>>23,M=B+T|0,_^=M<<13|M>>>19,M=_+B|0,x^=M<<18|M>>>14,M=j+C|0,R^=M<<7|M>>>25,M=R+j|0,k^=M<<9|M>>>23,M=k+R|0,C^=M<<13|M>>>19,M=C+k|0,j^=M<<18|M>>>14,M=N+O|0,S^=M<<7|M>>>25,M=S+N|0,A^=M<<9|M>>>23,M=A+S|0,O^=M<<13|M>>>19,M=O+A|0,N^=M<<18|M>>>14,M=w+S|0,_^=M<<7|M>>>25,M=_+w|0,k^=M<<9|M>>>23,M=k+_|0,S^=M<<13|M>>>19,M=S+k|0,w^=M<<18|M>>>14,M=x+E|0,C^=M<<7|M>>>25,M=C+x|0,A^=M<<9|M>>>23,M=A+C|0,E^=M<<13|M>>>19,M=E+A|0,x^=M<<18|M>>>14,M=j+T|0,O^=M<<7|M>>>25,M=O+j|0,I^=M<<9|M>>>23,M=I+O|0,T^=M<<13|M>>>19,M=T+I|0,j^=M<<18|M>>>14,M=N+R|0,P^=M<<7|M>>>25,M=P+N|0,B^=M<<9|M>>>23,M=B+P|0,R^=M<<13|M>>>19,M=R+B|0,N^=M<<18|M>>>14;e[0]=w>>>0&255,e[1]=w>>>8&255,e[2]=w>>>16&255,e[3]=w>>>24&255,e[4]=x>>>0&255,e[5]=x>>>8&255,e[6]=x>>>16&255,e[7]=x>>>24&255,e[8]=j>>>0&255,e[9]=j>>>8&255,e[10]=j>>>16&255,e[11]=j>>>24&255,e[12]=N>>>0&255,e[13]=N>>>8&255,e[14]=N>>>16&255,e[15]=N>>>24&255,e[16]=C>>>0&255,e[17]=C>>>8&255,e[18]=C>>>16&255,e[19]=C>>>24&255,e[20]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=I>>>0&255,e[25]=I>>>8&255,e[26]=I>>>16&255,e[27]=I>>>24&255,e[28]=T>>>0&255,e[29]=T>>>8&255,e[30]=T>>>16&255,e[31]=T>>>24&255}function w(e,t,n,r){b(e,t,n,r)}function _(e,t,n,r){v(e,t,n,r)}var k=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function S(e,t,n,r,i,o,s){var a=new Uint8Array(16),u=new Uint8Array(64),l,c;for(c=0;c<16;c++)a[c]=0;for(c=0;c<8;c++)a[c]=o[c];for(;i>=64;){for(w(u,a,s,k),c=0;c<64;c++)e[t+c]=n[r+c]^u[c];for(l=1,c=8;c<16;c++)l=l+(255&a[c])|0,a[c]=255&l,l>>>=8;i-=64,t+=64,r+=64}if(i>0)for(w(u,a,s,k),c=0;c=64;){for(w(s,o,i,k),u=0;u<64;u++)e[t+u]=s[u];for(a=1,u=8;u<16;u++)a=a+(255&o[u])|0,o[u]=255&a,a>>>=8;n-=64,t+=64}if(n>0)for(w(s,o,i,k),u=0;u>>13|n<<3),r=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(n>>>10|r<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(r>>>7|i<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|s<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(s>>>11|a<<5),u=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|u<<8),this.r[9]=u>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function I(e,t,n,r,i,o){var s=new A(o);return s.update(n,r,i),s.finish(e,t),0}function T(e,t,n,r,i,o){var s=new Uint8Array(16);return I(s,0,n,r,i,o),g(e,t,s,0)}function j(e,t,n,r,i){var o;if(n<32)return-1;for(C(e,0,t,0,n,r,i),I(e,16,e,32,n-32,e),o=0;o<16;o++)e[o]=0;return 0}function O(e,t,n,r,i){var o,s=new Uint8Array(32);if(n<32)return-1;if(x(s,0,32,r,i),0!==T(t,16,t,32,n-32,s))return-1;for(C(e,0,t,0,n,r,i),o=0;o<32;o++)e[o]=0;return 0}function P(e,t){var n;for(n=0;n<16;n++)e[n]=0|t[n]}function B(e){var t,n,r=1;for(t=0;t<16;t++)n=e[t]+r+65535,r=Math.floor(n/65536),e[t]=n-65536*r;e[0]+=r-1+37*(r-1)}function R(e,t,n){for(var r,i=~(n-1),o=0;o<16;o++)r=i&(e[o]^t[o]),e[o]^=r,t[o]^=r}function N(e,n){var r,i,o,s=t(),a=t();for(r=0;r<16;r++)a[r]=n[r];for(B(a),B(a),B(a),i=0;i<2;i++){for(s[0]=a[0]-65517,r=1;r<15;r++)s[r]=a[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),o=s[15]>>16&1,s[14]&=65535,R(a,s,1-o)}for(r=0;r<16;r++)e[2*r]=255&a[r],e[2*r+1]=a[r]>>8}function M(e,t){var n=new Uint8Array(32),r=new Uint8Array(32);return N(n,e),N(r,t),y(n,0,r,0)}function L(e){var t=new Uint8Array(32);return N(t,e),1&t[0]}function F(e,t){var n;for(n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function D(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]+n[r]}function U(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]-n[r]}function z(e,t,n){var r,i,o=0,s=0,a=0,u=0,l=0,c=0,f=0,h=0,p=0,d=0,m=0,g=0,y=0,b=0,v=0,w=0,_=0,k=0,S=0,E=0,x=0,C=0,A=0,I=0,T=0,j=0,O=0,P=0,B=0,R=0,N=0,M=n[0],L=n[1],F=n[2],D=n[3],U=n[4],z=n[5],q=n[6],K=n[7],H=n[8],V=n[9],W=n[10],$=n[11],G=n[12],Y=n[13],J=n[14],Z=n[15];r=t[0],o+=r*M,s+=r*L,a+=r*F,u+=r*D,l+=r*U,c+=r*z,f+=r*q,h+=r*K,p+=r*H,d+=r*V,m+=r*W,g+=r*$,y+=r*G,b+=r*Y,v+=r*J,w+=r*Z,r=t[1],s+=r*M,a+=r*L,u+=r*F,l+=r*D,c+=r*U,f+=r*z,h+=r*q,p+=r*K,d+=r*H,m+=r*V,g+=r*W,y+=r*$,b+=r*G,v+=r*Y,w+=r*J,_+=r*Z,r=t[2],a+=r*M,u+=r*L,l+=r*F,c+=r*D,f+=r*U,h+=r*z,p+=r*q,d+=r*K,m+=r*H,g+=r*V,y+=r*W,b+=r*$,v+=r*G,w+=r*Y,_+=r*J,k+=r*Z,r=t[3],u+=r*M,l+=r*L,c+=r*F,f+=r*D,h+=r*U,p+=r*z,d+=r*q,m+=r*K,g+=r*H,y+=r*V,b+=r*W,v+=r*$,w+=r*G,_+=r*Y,k+=r*J,S+=r*Z,r=t[4],l+=r*M,c+=r*L,f+=r*F,h+=r*D,p+=r*U,d+=r*z,m+=r*q,g+=r*K,y+=r*H,b+=r*V,v+=r*W,w+=r*$,_+=r*G,k+=r*Y,S+=r*J,E+=r*Z,r=t[5],c+=r*M,f+=r*L,h+=r*F,p+=r*D,d+=r*U,m+=r*z,g+=r*q,y+=r*K,b+=r*H,v+=r*V,w+=r*W,_+=r*$,k+=r*G,S+=r*Y,E+=r*J,x+=r*Z,r=t[6],f+=r*M,h+=r*L,p+=r*F,d+=r*D,m+=r*U,g+=r*z,y+=r*q,b+=r*K,v+=r*H,w+=r*V,_+=r*W,k+=r*$,S+=r*G,E+=r*Y,x+=r*J,C+=r*Z,r=t[7],h+=r*M,p+=r*L,d+=r*F,m+=r*D,g+=r*U,y+=r*z,b+=r*q,v+=r*K,w+=r*H,_+=r*V,k+=r*W,S+=r*$,E+=r*G,x+=r*Y,C+=r*J,A+=r*Z,r=t[8],p+=r*M,d+=r*L,m+=r*F,g+=r*D,y+=r*U,b+=r*z,v+=r*q,w+=r*K,_+=r*H,k+=r*V,S+=r*W,E+=r*$,x+=r*G,C+=r*Y,A+=r*J,I+=r*Z,r=t[9],d+=r*M,m+=r*L,g+=r*F,y+=r*D,b+=r*U,v+=r*z,w+=r*q,_+=r*K,k+=r*H,S+=r*V,E+=r*W,x+=r*$,C+=r*G,A+=r*Y,I+=r*J,T+=r*Z,r=t[10],m+=r*M,g+=r*L,y+=r*F,b+=r*D,v+=r*U,w+=r*z,_+=r*q,k+=r*K,S+=r*H,E+=r*V,x+=r*W,C+=r*$,A+=r*G,I+=r*Y,T+=r*J,j+=r*Z,r=t[11],g+=r*M,y+=r*L,b+=r*F,v+=r*D,w+=r*U,_+=r*z,k+=r*q,S+=r*K,E+=r*H,x+=r*V,C+=r*W,A+=r*$,I+=r*G,T+=r*Y,j+=r*J,O+=r*Z,r=t[12],y+=r*M,b+=r*L,v+=r*F,w+=r*D,_+=r*U,k+=r*z,S+=r*q,E+=r*K,x+=r*H,C+=r*V,A+=r*W,I+=r*$,T+=r*G,j+=r*Y,O+=r*J,P+=r*Z,r=t[13],b+=r*M,v+=r*L,w+=r*F,_+=r*D,k+=r*U,S+=r*z,E+=r*q,x+=r*K,C+=r*H,A+=r*V,I+=r*W,T+=r*$,j+=r*G,O+=r*Y,P+=r*J,B+=r*Z,r=t[14],v+=r*M,w+=r*L,_+=r*F,k+=r*D,S+=r*U,E+=r*z,x+=r*q,C+=r*K,A+=r*H,I+=r*V,T+=r*W,j+=r*$,O+=r*G,P+=r*Y,B+=r*J,R+=r*Z,r=t[15],w+=r*M,_+=r*L,k+=r*F,S+=r*D,E+=r*U,x+=r*z,C+=r*q,A+=r*K,I+=r*H,T+=r*V,j+=r*W,O+=r*$,P+=r*G,B+=r*Y,R+=r*J,N+=r*Z,o+=38*_,s+=38*k,a+=38*S,u+=38*E,l+=38*x,c+=38*C,f+=38*A,h+=38*I,p+=38*T,d+=38*j,m+=38*O,g+=38*P,y+=38*B,b+=38*R,v+=38*N,i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=w+i+65535,i=Math.floor(r/65536),w=r-65536*i,o+=i-1+37*(i-1),i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=w+i+65535,i=Math.floor(r/65536),w=r-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=u,e[4]=l,e[5]=c,e[6]=f,e[7]=h,e[8]=p,e[9]=d,e[10]=m,e[11]=g,e[12]=y,e[13]=b,e[14]=v,e[15]=w}function q(e,t){z(e,t,t)}function K(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=253;i>=0;i--)q(r,r),2!==i&&4!==i&&z(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function H(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=250;i>=0;i--)q(r,r),1!==i&&z(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function V(e,n,r){var i=new Uint8Array(32),o=new Float64Array(80),s,a,l=t(),c=t(),f=t(),h=t(),p=t(),d=t();for(a=0;a<31;a++)i[a]=n[a];for(i[31]=127&n[31]|64,i[0]&=248,F(o,r),a=0;a<16;a++)c[a]=o[a],h[a]=l[a]=f[a]=0;for(l[0]=h[0]=1,a=254;a>=0;--a)s=i[a>>>3]>>>(7&a)&1,R(l,c,s),R(f,h,s),D(p,l,f),U(l,l,f),D(f,c,h),U(c,c,h),q(h,p),q(d,l),z(l,f,l),z(f,c,p),D(p,l,f),U(l,l,f),q(c,l),U(f,h,d),z(l,f,u),D(l,l,h),z(f,f,l),z(l,h,d),z(h,c,o),q(c,p),R(l,c,s),R(f,h,s);for(a=0;a<16;a++)o[a+16]=l[a],o[a+32]=f[a],o[a+48]=c[a],o[a+64]=h[a];var m=o.subarray(32),g=o.subarray(16);return K(m,m),z(g,g,m),N(e,g),0}function W(e,t){return V(e,t,o)}function $(e,t){return r(t,32),W(e,t)}function G(e,t,n){var r=new Uint8Array(32);return V(r,n,t),_(e,i,r,k)}A.prototype.blocks=function(e,t,n){for(var r=this.fin?0:2048,i,o,s,a,u,l,c,f,h,p,d,m,g,y,b,v,w,_,k,S=this.h[0],E=this.h[1],x=this.h[2],C=this.h[3],A=this.h[4],I=this.h[5],T=this.h[6],j=this.h[7],O=this.h[8],P=this.h[9],B=this.r[0],R=this.r[1],N=this.r[2],M=this.r[3],L=this.r[4],F=this.r[5],D=this.r[6],U=this.r[7],z=this.r[8],q=this.r[9];n>=16;)i=255&e[t+0]|(255&e[t+1])<<8,S+=8191&i,o=255&e[t+2]|(255&e[t+3])<<8,E+=8191&(i>>>13|o<<3),s=255&e[t+4]|(255&e[t+5])<<8,x+=8191&(o>>>10|s<<6),a=255&e[t+6]|(255&e[t+7])<<8,C+=8191&(s>>>7|a<<9),u=255&e[t+8]|(255&e[t+9])<<8,A+=8191&(a>>>4|u<<12),I+=u>>>1&8191,l=255&e[t+10]|(255&e[t+11])<<8,T+=8191&(u>>>14|l<<2),c=255&e[t+12]|(255&e[t+13])<<8,j+=8191&(l>>>11|c<<5),f=255&e[t+14]|(255&e[t+15])<<8,O+=8191&(c>>>8|f<<8),P+=f>>>5|r,h=0,p=h,p+=S*B,p+=E*(5*q),p+=x*(5*z),p+=C*(5*U),p+=A*(5*D),h=p>>>13,p&=8191,p+=I*(5*F),p+=T*(5*L),p+=j*(5*M),p+=O*(5*N),p+=P*(5*R),h+=p>>>13,p&=8191,d=h,d+=S*R,d+=E*B,d+=x*(5*q),d+=C*(5*z),d+=A*(5*U),h=d>>>13,d&=8191,d+=I*(5*D),d+=T*(5*F),d+=j*(5*L),d+=O*(5*M),d+=P*(5*N),h+=d>>>13,d&=8191,m=h,m+=S*N,m+=E*R,m+=x*B,m+=C*(5*q),m+=A*(5*z),h=m>>>13,m&=8191,m+=I*(5*U),m+=T*(5*D),m+=j*(5*F),m+=O*(5*L),m+=P*(5*M),h+=m>>>13,m&=8191,g=h,g+=S*M,g+=E*N,g+=x*R,g+=C*B,g+=A*(5*q),h=g>>>13,g&=8191,g+=I*(5*z),g+=T*(5*U),g+=j*(5*D),g+=O*(5*F),g+=P*(5*L),h+=g>>>13,g&=8191,y=h,y+=S*L,y+=E*M,y+=x*N,y+=C*R,y+=A*B,h=y>>>13,y&=8191,y+=I*(5*q),y+=T*(5*z),y+=j*(5*U),y+=O*(5*D),y+=P*(5*F),h+=y>>>13,y&=8191,b=h,b+=S*F,b+=E*L,b+=x*M,b+=C*N,b+=A*R,h=b>>>13,b&=8191,b+=I*B,b+=T*(5*q),b+=j*(5*z),b+=O*(5*U),b+=P*(5*D),h+=b>>>13,b&=8191,v=h,v+=S*D,v+=E*F,v+=x*L,v+=C*M,v+=A*N,h=v>>>13,v&=8191,v+=I*R,v+=T*B,v+=j*(5*q),v+=O*(5*z),v+=P*(5*U),h+=v>>>13,v&=8191,w=h,w+=S*U,w+=E*D,w+=x*F,w+=C*L,w+=A*M,h=w>>>13,w&=8191,w+=I*N,w+=T*R,w+=j*B,w+=O*(5*q),w+=P*(5*z),h+=w>>>13,w&=8191,_=h,_+=S*z,_+=E*U,_+=x*D,_+=C*F,_+=A*L,h=_>>>13,_&=8191,_+=I*M,_+=T*N,_+=j*R,_+=O*B,_+=P*(5*q),h+=_>>>13,_&=8191,k=h,k+=S*q,k+=E*z,k+=x*U,k+=C*D,k+=A*F,h=k>>>13,k&=8191,k+=I*L,k+=T*M,k+=j*N,k+=O*R,k+=P*B,h+=k>>>13,k&=8191,h=(h<<2)+h|0,h=h+p|0,p=8191&h,h>>>=13,d+=h,S=p,E=d,x=m,C=g,A=y,I=b,T=v,j=w,O=_,P=k,t+=16,n-=16;this.h[0]=S,this.h[1]=E,this.h[2]=x,this.h[3]=C,this.h[4]=A,this.h[5]=I,this.h[6]=T,this.h[7]=j,this.h[8]=O,this.h[9]=P},A.prototype.finish=function(e,t){var n=new Uint16Array(10),r,i,o,s;if(this.leftover){for(s=this.leftover,this.buffer[s++]=1;s<16;s++)this.buffer[s]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,s=2;s<10;s++)this.h[s]+=r,r=this.h[s]>>>13,this.h[s]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,n[0]=this.h[0]+5,r=n[0]>>>13,n[0]&=8191,s=1;s<10;s++)n[s]=this.h[s]+r,r=n[s]>>>13,n[s]&=8191;for(n[9]-=8192,i=(1^r)-1,s=0;s<10;s++)n[s]&=i;for(i=~i,s=0;s<10;s++)this.h[s]=this.h[s]&i|n[s];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,s=1;s<8;s++)o=(this.h[s]+this.pad[s]|0)+(o>>>16)|0,this.h[s]=65535&o;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},A.prototype.update=function(e,t,n){var r,i;if(this.leftover){for(i=16-this.leftover,i>n&&(i=n),r=0;r=16&&(i=n-n%16,this.blocks(e,t,i),t+=i,n-=i),n){for(r=0;r=128;){for(E=0;E<16;E++)x=8*E+G,i[E]=n[x+0]<<24|n[x+1]<<16|n[x+2]<<8|n[x+3],o[E]=n[x+4]<<24|n[x+5]<<16|n[x+6]<<8|n[x+7];for(E=0;E<80;E++)if(s=P,a=B,u=R,l=N,c=M,f=L,h=F,p=D,d=U,m=z,g=q,y=K,b=H,v=V,w=W,_=$,C=D,A=$,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=(M>>>14|H<<18)^(M>>>18|H<<14)^(H>>>9|M<<23),A=(H>>>14|M<<18)^(H>>>18|M<<14)^(M>>>9|H<<23),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=M&L^~M&F,A=H&V^~H&W,I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=X[2*E],A=X[2*E+1],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=i[E%16],A=o[E%16],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,k=65535&j|O<<16,S=65535&I|T<<16,C=k,A=S,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=(P>>>28|U<<4)^(U>>>2|P<<30)^(U>>>7|P<<25),A=(U>>>28|P<<4)^(P>>>2|U<<30)^(P>>>7|U<<25),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=P&B^P&R^B&R,A=U&z^U&q^z&q,I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,p=65535&j|O<<16,_=65535&I|T<<16,C=l,A=y,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=k,A=S,I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,l=65535&j|O<<16,y=65535&I|T<<16,B=s,R=a,N=u,M=l,L=c,F=f,D=h,P=p,z=d,q=m,K=g,H=y,V=b,W=v,$=w,U=_,E%16==15)for(x=0;x<16;x++)C=i[x],A=o[x],I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=i[(x+9)%16],A=o[(x+9)%16],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,k=i[(x+1)%16],S=o[(x+1)%16],C=(k>>>1|S<<31)^(k>>>8|S<<24)^k>>>7,A=(S>>>1|k<<31)^(S>>>8|k<<24)^(S>>>7|k<<25),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,k=i[(x+14)%16],S=o[(x+14)%16],C=(k>>>19|S<<13)^(S>>>29|k<<3)^k>>>6,A=(S>>>19|k<<13)^(k>>>29|S<<3)^(S>>>6|k<<26),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,i[x]=65535&j|O<<16,o[x]=65535&I|T<<16;C=P,A=U,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[0],A=t[0],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[0]=P=65535&j|O<<16,t[0]=U=65535&I|T<<16,C=B,A=z,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[1],A=t[1],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[1]=B=65535&j|O<<16,t[1]=z=65535&I|T<<16,C=R,A=q,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[2],A=t[2],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[2]=R=65535&j|O<<16,t[2]=q=65535&I|T<<16,C=N,A=K,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[3],A=t[3],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[3]=N=65535&j|O<<16,t[3]=K=65535&I|T<<16,C=M,A=H,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[4],A=t[4],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[4]=M=65535&j|O<<16,t[4]=H=65535&I|T<<16,C=L,A=V,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[5],A=t[5],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[5]=L=65535&j|O<<16,t[5]=V=65535&I|T<<16,C=F,A=W,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[6],A=t[6],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[6]=F=65535&j|O<<16,t[6]=W=65535&I|T<<16,C=D,A=$,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[7],A=t[7],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[7]=D=65535&j|O<<16,t[7]=$=65535&I|T<<16,G+=128,r-=128}return r}function te(e,t,n){var r=new Int32Array(8),i=new Int32Array(8),o=new Uint8Array(256),s,a=n;for(r[0]=1779033703,r[1]=3144134277,r[2]=1013904242,r[3]=2773480762,r[4]=1359893119,r[5]=2600822924,r[6]=528734635,r[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,ee(r,i,t,n),n%=128,s=0;s=0;--i)r=n[i/8|0]>>(7&i)&1,re(e,t,r),ne(t,e),ne(e,e),re(e,t,r)}function se(e,n){var r=[t(),t(),t(),t()];P(r[0],f),P(r[1],h),P(r[2],a),z(r[3],f,h),oe(e,r,n)}function ae(e,n,i){var o=new Uint8Array(64),s=[t(),t(),t(),t()],a;for(i||r(n,32),te(o,n,32),o[0]&=248,o[31]&=127,o[31]|=64,se(s,o),ie(e,s),a=0;a<32;a++)n[a+32]=e[a];return 0}var ue=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function le(e,t){var n,r,i,o;for(r=63;r>=32;--r){for(n=0,i=r-32,o=r-12;i>8,t[i]-=256*n;t[i]+=n,t[r]=0}for(n=0,i=0;i<32;i++)t[i]+=n-(t[31]>>4)*ue[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*ue[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function ce(e){var t=new Float64Array(64),n;for(n=0;n<64;n++)t[n]=e[n];for(n=0;n<64;n++)e[n]=0;le(e,t)}function fe(e,n,r,i){var o=new Uint8Array(64),s=new Uint8Array(64),a=new Uint8Array(64),u,l,c=new Float64Array(64),f=[t(),t(),t(),t()];te(o,i,32),o[0]&=248,o[31]&=127,o[31]|=64;var h=r+64;for(u=0;u>7&&U(e[0],s,e[0]),z(e[3],e[0],e[1]),0)}function pe(e,n,r,i){var o,s,a=new Uint8Array(32),u=new Uint8Array(64),l=[t(),t(),t(),t()],c=[t(),t(),t(),t()];if(s=-1,r<64)return-1;if(he(c,i))return-1;for(o=0;o=0},e.sign.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(64);return ae(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(Be(e),64!==e.length)throw new Error("bad secret key size");for(var t=new Uint8Array(32),n=0;n=this._buffer.length},o.prototype.remainder=function(){return this._buffer.slice(this._offset)},o.prototype.skip=function(e){this._offset+=e},o.prototype.expand=function(){this._size*=2;var e=i.alloc(this._size);this._buffer.copy(e,0),this._buffer=e},o.prototype.readPart=function(){return{data:this.readBuffer()}},o.prototype.readBuffer=function(){var e=this._buffer.readUInt32BE(this._offset);this._offset+=4,r.ok(this._offset+e<=this._buffer.length,"length out of bounds at +0x"+this._offset.toString(16)+" (data truncated?)");var t=this._buffer.slice(this._offset,this._offset+e);return this._offset+=e,t},o.prototype.readString=function(){return this.readBuffer().toString()},o.prototype.readCString=function(){for(var e=this._offset;ethis._size;)this.expand();this._buffer.writeUInt32BE(e.length,this._offset),this._offset+=4,e.copy(this._buffer,this._offset),this._offset+=e.length},o.prototype.writeString=function(e){this.writeBuffer(i.from(e,"utf8"))},o.prototype.writeCString=function(e){for(;this._offset+1+e.length>this._size;)this.expand();this._buffer.write(e,this._offset),this._offset+=e.length,this._buffer[this._offset++]=0},o.prototype.writeInt=function(e){for(;this._offset+4>this._size;)this.expand();this._buffer.writeUInt32BE(e,this._offset),this._offset+=4},o.prototype.writeInt64=function(e){if(r.buffer(e,"value"),e.length>8){for(var t=e.slice(0,e.length-8),n=0;nthis._size;)this.expand();e.copy(this._buffer,this._offset),this._offset+=8},o.prototype.writeChar=function(e){for(;this._offset+1>this._size;)this.expand();this._buffer[this._offset++]=e},o.prototype.writePart=function(e){this.writeBuffer(e.data)},o.prototype.write=function(e){for(;this._offset+e.length>this._size;)this.expand();e.copy(this._buffer,this._offset),this._offset+=e.length}},function(e,t,n){e.exports={read:f,readPkcs8:d,write:h,writePkcs8:A,pkcs8ToBuffer:C,readECDSACurve:v,writeECDSACurve:P};var r=n(27),i=n(103),o=n(31).Buffer,s=n(55),a=n(47),u=n(46),l=n(50),c=n(113);function f(e,t){return c.read(e,t,"pkcs8")}function h(e,t){return c.write(e,t,"pkcs8")}function p(e,t){return r.strictEqual(e.peek(),i.Ber.Integer,t+" is not an Integer"),a.mpNormalize(e.readString(i.Ber.Integer,!0))}function d(e,t,n){n.peek()===i.Ber.Integer&&(r.strictEqual(t,"private","unexpected Integer at start of public key"),n.readString(i.Ber.Integer,!0)),n.readSequence();var o=n.offset+n.length,s=n.readOID();switch(s){case"1.2.840.113549.1.1.1":return n._offset=o,"public"===t?m(n):g(n);case"1.2.840.10040.4.1":return"public"===t?y(n):b(n);case"1.2.840.10045.2.1":return"public"===t?_(n):w(n);case"1.3.101.112":return"public"===t?k(n):E(n);case"1.3.101.110":return"public"===t?S(n):x(n);default:throw new Error("Unknown key type OID "+s)}}function m(e){e.readSequence(i.Ber.BitString),e.readByte(),e.readSequence();var t=p(e,"modulus"),n=p(e,"exponent"),r={type:"rsa",source:e.originalInput,parts:[{name:"e",data:n},{name:"n",data:t}]};return new u(r)}function g(e){e.readSequence(i.Ber.OctetString),e.readSequence();var t=p(e,"version");r.equal(t[0],0,"unknown RSA private key version");var n=p(e,"modulus"),o=p(e,"public exponent"),s=p(e,"private exponent"),a=p(e,"prime1"),u=p(e,"prime2"),c=p(e,"exponent1"),f=p(e,"exponent2"),h=p(e,"iqmp"),d={type:"rsa",parts:[{name:"n",data:n},{name:"e",data:o},{name:"d",data:s},{name:"iqmp",data:h},{name:"p",data:a},{name:"q",data:u},{name:"dmodp",data:c},{name:"dmodq",data:f}]};return new l(d)}function y(e){e.readSequence();var t=p(e,"p"),n=p(e,"q"),r=p(e,"g");e.readSequence(i.Ber.BitString),e.readByte();var o=p(e,"y"),s={type:"dsa",parts:[{name:"p",data:t},{name:"q",data:n},{name:"g",data:r},{name:"y",data:o}]};return new u(s)}function b(e){e.readSequence();var t=p(e,"p"),n=p(e,"q"),r=p(e,"g");e.readSequence(i.Ber.OctetString);var o=p(e,"x"),s=a.calculateDSAPublic(r,t,o),u={type:"dsa",parts:[{name:"p",data:t},{name:"q",data:n},{name:"g",data:r},{name:"y",data:s},{name:"x",data:o}]};return new l(u)}function v(e){var t,n,u,l,c;if(e.peek()===i.Ber.OID){var f=e.readOID();for(n=Object.keys(s.curves),u=0;u=this.validFrom.getTime()&&e.getTime()0&&-1===this.issuer.purposes.indexOf("ca"))&&this.isSignedByKey(e.subjectKey))},b.prototype.getExtension=function(e){r.string(e,"keyOrOid");var t=this.getExtensions().filter(function(t){return"x509"===t.format?t.oid===e:"openssh"===t.format&&t.name===e})[0];return t},b.prototype.getExtensions=function(){var e=[],t=this.signatures.x509;t&&t.extras&&t.extras.exts&&t.extras.exts.forEach(function(t){t.format="x509",e.push(t)});var n=this.signatures.openssh;return n&&n.exts&&n.exts.forEach(function(t){t.format="openssh",e.push(t)}),e},b.prototype.isSignedByKey=function(e){if(f.assertCompatible(e,h,[1,2],"issuerKey"),void 0!==this.issuerKey)return this.issuerKey.fingerprint("sha512").matches(e);var t=Object.keys(this.signatures)[0],n=m[t].verify(this,e);return n&&(this.issuerKey=e),n},b.prototype.signWith=function(e){f.assertCompatible(e,p,[1,2],"key");for(var t=Object.keys(m),n=!1,r=0;r0&&-1===c.indexOf("serverAuth")&&c.push("serverAuth"),m.length>0&&-1===c.indexOf("clientAuth")&&c.push("clientAuth"),(m.length>0||h.length>0)&&(-1===c.indexOf("keyAgreement")&&c.push("keyAgreement"),"rsa"===t.type&&-1===c.indexOf("encryption")&&c.push("encryption"))}var g=new b({subjects:o,issuer:o[0],subjectKey:t.toPublic(),issuerKey:t.toPublic(),signatures:{},serial:l,validFrom:s,validUntil:a,purposes:c});return g.signWith(t),g},b.create=function(e,t,n,o,s){var a;a=Array.isArray(e)?e:[e],r.arrayOfObject(a),a.forEach(function(e){f.assertCompatible(e,d,[1,0],"subject")}),f.assertCompatible(t,h,[1,0],"key"),p.isPrivateKey(t)&&(t=t.toPublic()),f.assertCompatible(n,d,[1,0],"issuer"),f.assertCompatible(o,p,[1,2],"issuer key"),r.optionalObject(s,"options"),void 0===s&&(s={}),r.optionalObject(s.validFrom,"options.validFrom"),r.optionalObject(s.validUntil,"options.validUntil");var u=s.validFrom,l=s.validUntil;if(void 0===u&&(u=new Date),void 0===l){r.optionalNumber(s.lifetime,"options.lifetime");var c=s.lifetime;void 0===c&&(c=31536e4),l=new Date,l.setTime(l.getTime()+1e3*c)}r.optionalBuffer(s.serial,"options.serial");var m=s.serial;void 0===m&&(m=i.from("0000000000000001","hex"));var g=s.purposes;void 0===g&&(g=[]),-1===g.indexOf("signature")&&g.push("signature"),!0===s.ca&&(-1===g.indexOf("ca")&&g.push("ca"),-1===g.indexOf("crl")&&g.push("crl"));var y=a.filter(function(e){return"host"===e.type}),v=a.filter(function(e){return"user"===e.type});y.length>0&&-1===g.indexOf("serverAuth")&&g.push("serverAuth"),v.length>0&&-1===g.indexOf("clientAuth")&&g.push("clientAuth"),(v.length>0||y.length>0)&&(-1===g.indexOf("keyAgreement")&&g.push("keyAgreement"),"rsa"===t.type&&-1===g.indexOf("encryption")&&g.push("encryption"));var w=new b({subjects:a,issuer:n,subjectKey:t,issuerKey:o.toPublic(),signatures:{},serial:m,validFrom:u,validUntil:l,purposes:g});return w.signWith(o),w},b.parse=function(e,t,n){"string"!=typeof e&&r.buffer(e,"data"),void 0===t&&(t="auto"),r.string(t,"format"),"string"==typeof n&&(n={filename:n}),r.optionalObject(n,"options"),void 0===n&&(n={}),r.optionalString(n.filename,"options.filename"),void 0===n.filename&&(n.filename="(unnamed)"),r.object(m[t],"formats[format]");try{var i=m[t].read(e,n);return i}catch(e){throw new g(n.filename,t,e)}},b.isCertificate=function(e,t){return f.isCompatible(e,b,t)},b.prototype._sshpkApiVersion=[1,1],b._oldVersionDetect=function(e){return[1,0]}},function(e,t,n){e.exports=g;var r=n(27),i=n(55),o=n(15),s=n(207),a=n(102),u=n(97),l=n(13),c=n(47),f=n(103),h=n(31).Buffer,p=/^([*]|[a-z0-9][a-z0-9\-]{0,62})(?:\.([*]|[a-z0-9][a-z0-9\-]{0,62}))*$/i,d={cn:"2.5.4.3",o:"2.5.4.10",ou:"2.5.4.11",l:"2.5.4.7",s:"2.5.4.8",c:"2.5.4.6",sn:"2.5.4.4",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",street:"2.5.4.9",x500UniqueIdentifier:"2.5.4.45",role:"2.5.4.72",telephoneNumber:"2.5.4.20",description:"2.5.4.13",dc:"0.9.2342.19200300.100.1.25",uid:"0.9.2342.19200300.100.1.1",mail:"0.9.2342.19200300.100.1.3",title:"2.5.4.12",gn:"2.5.4.42",initials:"2.5.4.43",pseudonym:"2.5.4.65",emailAddress:"1.2.840.113549.1.9.1"},m={};function g(e){var t=this;if(r.object(e,"options"),r.arrayOfObject(e.components,"options.components"),this.components=e.components,this.componentLookup={},this.components.forEach(function(e){e.name&&!e.oid&&(e.oid=d[e.name]),e.oid&&!e.name&&(e.name=m[e.oid]),void 0===t.componentLookup[e.name]&&(t.componentLookup[e.name]=[]),t.componentLookup[e.name].push(e)}),this.componentLookup.cn&&this.componentLookup.cn.length>0&&(this.cn=this.componentLookup.cn[0].value),r.optionalString(e.type,"options.type"),void 0===e.type)1===this.components.length&&this.componentLookup.cn&&1===this.componentLookup.cn.length&&this.componentLookup.cn[0].value.match(p)?(this.type="host",this.hostname=this.componentLookup.cn[0].value):this.componentLookup.dc&&this.components.length===this.componentLookup.dc.length?(this.type="host",this.hostname=this.componentLookup.dc.map(function(e){return e.value}).join(".")):this.componentLookup.uid&&this.components.length===this.componentLookup.uid.length?(this.type="user",this.uid=this.componentLookup.uid[0].value):this.componentLookup.cn&&1===this.componentLookup.cn.length&&this.componentLookup.cn[0].value.match(p)?(this.type="host",this.hostname=this.componentLookup.cn[0].value):this.componentLookup.uid&&1===this.componentLookup.uid.length?(this.type="user",this.uid=this.componentLookup.uid[0].value):this.componentLookup.mail&&1===this.componentLookup.mail.length?(this.type="email",this.email=this.componentLookup.mail[0].value):this.componentLookup.cn&&1===this.componentLookup.cn.length?(this.type="user",this.uid=this.componentLookup.cn[0].value):this.type="unknown";else if(this.type=e.type,"host"===this.type)this.hostname=e.hostname;else if("user"===this.type)this.uid=e.uid;else{if("email"!==this.type)throw new Error("Unknown type "+this.type);this.email=e.email}}Object.keys(d).forEach(function(e){m[d[e]]=e}),g.prototype.toString=function(){return this.components.map(function(e){var t=e.name.toUpperCase();t=t.replace(/=/g,"\\=");var n=e.value;return n=n.replace(/,/g,"\\,"),t+"="+n}).join(", ")},g.prototype.get=function(e,t){r.string(e,"name");var n=this.componentLookup[e];if(void 0!==n&&0!==n.length){if(!t&&n.length>1)throw new Error("Multiple values for attribute "+e);return t?n.map(function(e){return e.value}):n[0].value}},g.prototype.toArray=function(e){return this.components.map(function(e){return{name:e.name,value:e.value}})};var y=/[^a-zA-Z0-9 '(),+.\/:=?-]/,b=/[^\x00-\x7f]/;function v(e,t){if("**"===e||"**"===t)return!0;var n=e.split("."),r=t.split(".");if(n.length!==r.length)return!1;for(var i=0;i0;){var o;if(null!==(o=/^,/.exec(i)))t[++n]="",i=i.slice(o[0].length);else if(null!==(o=/^\\,/.exec(i)))t[n]+=",",i=i.slice(o[0].length);else if(null!==(o=/^\\./.exec(i)))t[n]+=o[0],i=i.slice(o[0].length);else{if(null===(o=/^[^\\,]+/.exec(i)))throw new Error("Failed to parse DN");t[n]+=o[0],i=i.slice(o[0].length)}}var s=t.map(function(e){e=e.trim();for(var t=e.indexOf("=");t>0&&"\\"===e.charAt(t-1);)t=e.indexOf("=",t+1);if(-1===t)throw new Error("Failed to parse DN");var n=e.slice(0,t).toLowerCase().replace(/\\=/g,"="),r=e.slice(t+1);return{name:n,value:r}});return new g({components:s})},g.fromArray=function(e){return r.arrayOfObject(e,"components"),e.forEach(function(e){if(r.object(e,"component"),r.string(e.name,"component.name"),!h.isBuffer(e.value)&&"string"!=typeof e.value)throw new Error("Invalid component value")}),new g({components:e})},g.parseAsn1=function(e,t){var n=[];e.readSequence(t);for(var r=e.offset+e.length;e.offset= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=f-h,E=Math.floor,x=String.fromCharCode,C;function A(e){throw new RangeError(k[e])}function I(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function T(e,t){var n=e.split("@"),r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(_,".");var i=e.split("."),o=I(i,t).join(".");return r+o}function j(e){for(var t=[],n=0,r=e.length,i,o;n=55296&&i<=56319&&n65535&&(e-=65536,t+=x(e>>>10&1023|55296),e=56320|1023&e),t+=x(e),t}).join("")}function P(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:f}function B(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function R(e,t,n){var r=0;for(e=n?E(e/m):e>>1,e+=E(e/t);e>S*p>>1;r+=f)e=E(e/S);return E(r+(S+1)*e/(e+d))}function N(e){var t=[],n=e.length,r,i=0,o=y,s=g,a,u,l,d,m,v,w,_,k;for(a=e.lastIndexOf(b),a<0&&(a=0),u=0;u=128&&A("not-basic"),t.push(e.charCodeAt(u));for(l=a>0?a+1:0;l=n&&A("invalid-input"),w=P(e.charCodeAt(l++)),(w>=f||w>E((c-i)/m))&&A("overflow"),i+=w*m,_=v<=s?h:v>=s+p?p:v-s,!(w<_);v+=f)k=f-_,m>E(c/k)&&A("overflow"),m*=k;r=t.length+1,s=R(i-d,r,0==d),E(i/r)>c-o&&A("overflow"),o+=E(i/r),i%=r,t.splice(i++,0,o)}return O(t)}function M(e){var t,n,r,i,o,s,a,u,l,d,m,v=[],w,_,k,S;for(e=j(e),w=e.length,t=y,n=0,o=g,s=0;s=t&&mE((c-n)/_)&&A("overflow"),n+=(a-t)*_,t=a,s=0;sc&&A("overflow"),m==t){for(u=n,l=f;d=l<=o?h:l>=o+p?p:l-o,!(uthis.root.open(j(e)),t=>this.config.set(B(e),t),t=>this.spec.set(R(e),t),e=>this.version.set(C,e)],t)}open(e){this.closed?(S("opening at: %s",this.path),r([e=>this.root.open(j(e)),e=>this._isInitialized(e),e=>this._openLock(this.path,e),(e,t)=>{S("aquired repo.lock"),this.lockfile=e,t()},e=>{S("creating datastore"),this.datastore=d.create("datastore",l.join(this.path,"datastore"),this.options),S("creating blocks");const t=d.create("blocks",l.join(this.path,"blocks"),this.options);v(t,this.options.storageBackendOptions.blocks,e)},(e,t)=>{this.blocks=e,t()},e=>{S("creating keystore"),this.keys=d.create("keys",l.join(this.path,"keys"),this.options),e()},e=>{this.closed=!1,S("all opened"),e()}],t=>{t&&this.lockfile?this._closeLock(n=>{n?S("error removing lock",n):this.lockfile=null,e(t)}):e(t)})):setImmediate(()=>e(new Error("repo is already open")))}_getLocker(){return"string"==typeof this.options.lock?(u(x[this.options.lock],"Unknown lock type: "+this.options.lock),x[this.options.lock]):(u(this.options.lock,"No lock provided"),this.options.lock)}_openLock(e,t){this._locker.lock(e,(e,n)=>{if(e)return t(e,null);u.strictEqual(typeof n.close,"function","Locks must have a close method"),t(null,n)})}_closeLock(e){if(this.lockfile)return this.lockfile.close(e);e()}_isInitialized(e){S("init check"),o({config:e=>this.config.exists(e),spec:e=>this.spec.exists(e),version:e=>this.version.check(C,e)},(t,n)=>{if(S("init",t,n),t&&!n.config)return e(Object.assign(new Error("repo is not initialized yet"),{code:k.ERR_REPO_NOT_INITIALIZED,path:this.path}));e(t)})}close(e){if(this.closed)return e(new Error("repo is already closed"));S("closing at: %s",this.path),i([e=>this.apiAddr.delete(O(e)),e=>{s([this.blocks,this.keys,this.datastore],(e,t)=>e.close(t),e)},e=>{S("unlocking"),this.closed=!0,this._closeLock(e)},e=>{this.lockfile=null,e()}],t=>e(t))}exists(e){this.version.exists(e)}stat(e,t){"function"==typeof e&&(t=e,e={}),e=Object.assign({},{human:!1},e),o({storageMax:e=>this.config.get("Datastore.StorageMax",(t,n)=>{e(null,new f(t?E:n))}),version:e=>this.version.get(e),blocks:e=>this.blocks.query({},(t,n)=>{n=n||[];const r=new f(n.length);let i=new f(0);n.forEach(e=>{i=i.plus(e.value.byteLength).plus(e.key._buf.byteLength)}),e(t,{count:r,size:i})}),datastore:e=>I(this.datastore,e),keys:e=>I(this.keys,e)},(n,r)=>{if(n)return t(n);let i=r.blocks.size.plus(r.datastore).plus(r.keys);e.human&&(i=i.div(1048576)),t(null,{repoPath:this.path,storageMax:r.storageMax,version:r.version,numObjects:r.blocks.count,repoSize:i})})}}function I(e,t){h(e.query({}),p((e,t)=>e.plus(t.value.byteLength).plus(t.key._buf.byteLength),new f(0),t))}function T(e,t){return n=>{t(n&&!e(n)?n:null)}}function j(e){return T(e=>"Already open"===e.message,e)}function O(e){return T(e=>e&&(e.code===k.ERR_REPO_NOT_INITIALIZED||e.message.startsWith("ENOENT")),e)}function P(e){const t=Object.assign({},w,e);return t.storageBackends=Object.assign({},w.storageBackends,t.storageBackends),t.storageBackendOptions=Object.assign({},w.storageBackendOptions,t.storageBackendOptions),t}function B(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=A,e.exports.repoVersion=C,e.exports.errors=k},function(e,t){e.exports=function(){var e,t,n,r,i=function(i,o){e?e(i,o):i?(r=i,n=o):t=o};return i.resolve=function(i){if(e)throw new Error("already resolved");if(e=i,!e)throw new Error("no read cannot resolve!"+e);t&&i(null,t),n&&i(r,n)},i.abort=function(e){i.resolve(function(t,n){n(e||!0)})},i}},function(e,t){t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n",t.homedir=function(){return"/"}},function(e,t,n){"use strict";const r=n(26);class i{constructor(e,t){this.child=e,this.transform=t}open(e){this.child.open(e)}put(e,t,n){this.child.put(this.transform.convert(e),t,n)}get(e,t){this.child.get(this.transform.convert(e),t)}has(e,t){this.child.has(this.transform.convert(e),t)}delete(e,t){this.child.delete(this.transform.convert(e),t)}batch(){const e=this.child.batch();return{put:(t,n)=>{e.put(this.transform.convert(t),n)},delete:t=>{e.delete(this.transform.convert(t))},commit:t=>{e.commit(t)}}}query(e){return r(this.child.query(e),r.map(e=>(e.key=this.transform.invert(e.key),e)))}close(e){this.child.close(e)}}e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var r=n(68),i=f(r),o=n(104),s=f(o),a=n(131),u=f(a),l=n(42),c=f(l);function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t,n){n=(0,u.default)(n||i.default);var r=(0,c.default)(t);if(!e())return n(null);var o=function(t){if(t)return n(t);if(e())return r(o);var i=(0,s.default)(arguments,1);n.apply(null,[null].concat(i))};r(o)}e.exports=t.default},function(e,t,n){"use strict";(function(t){const r=n(26),i=n(829),o=n(33).utils.asyncFilter,s=n(33).utils.asyncSort,a=n(33).Key,u=n(33).Errors,l=n(838);class c{constructor(e,t){let r;t&&t.db?(r=t.db,delete t.db):r=n(842),this.db=i(l(r(e),{valueEncoding:"binary"}),Object.assign({},t,{compression:!1}),e=>{if(e)throw e})}open(e){this.db.open(t=>{if(t)return e(u.dbOpenFailedError(t));e()})}put(e,t,n){this.db.put(e.toString(),t,e=>{if(e)return n(u.dbWriteFailedError(e));n()})}get(e,t){this.db.get(e.toString(),(e,n)=>{if(e)return t(u.notFoundError(e));t(null,n)})}has(e,t){this.db.get(e.toString(),(e,n)=>{if(e)return e.notFound?void t(null,!1):void t(e);t(null,!0)})}delete(e,t){this.db.del(e.toString(),e=>{if(e)return t(u.dbDeleteFailedError(e));t()})}close(e){this.db.close(e)}batch(){const e=[];return{put:(t,n)=>{e.push({type:"put",key:t.toString(),value:n})},delete:t=>{e.push({type:"del",key:t.toString()})},commit:t=>{this.db.batch(e,t)}}}query(e){let n=!0;null!=e.keysOnly&&(n=!e.keysOnly);const i=this.db.db.iterator({keys:!0,values:n,keyAsBuffer:!0}),u=(e,r)=>{if(e)return i.end(t=>{r(t||e)});i.next((e,o,s)=>{if(e)return r(e);if(null==e&&null==o&&null==s)return i.end(e=>{r(e||!0)});const u={key:new a(o,!1)};n&&(u.value=t.from(s)),r(null,u)})};let l=[u],c=[];if(null!=e.prefix){const t=e.prefix;c.push((e,n)=>n(null,e.key.toString().startsWith(t)))}if(null!=e.filters&&(c=c.concat(e.filters)),l=l.concat(c.map(e=>o(e))),null!=e.orders&&(l=l.concat(e.orders.map(e=>s(e)))),null!=e.offset){let t=0;l.push(r.filter(()=>t++>=e.offset))}return null!=e.limit&&l.push(r.take(e.limit)),r.apply(null,l)}}e.exports=c}).call(this,n(0).Buffer)},function(e,t){t.getCallback=function(e,t){return"function"==typeof e?e:t},t.getOptions=function(e){return"object"==typeof e&&null!==e?e:{}}},function(e,t,n){"use strict";const r=n(62);t.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7},t.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36},t.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31},t.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23},t.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")},t.SHIFT32=Math.pow(2,32),t.SHIFT16=Math.pow(2,16),t.MAX_SAFE_HIGH=2097151,t.NEG_ONE=new r(-1),t.TEN=new r(10),t.TWO=new r(2),t.PARENT={ARRAY:0,OBJECT:1,MAP:2,TAG:3,BYTE_STRING:4,UTF8_STRING:5}},function(e,t,n){"use strict";(function(r){const i=n(18),o=n(53);class s{constructor(e,t,n){0!==n&&i(n,"A DAGNode requires it's serialized size"),this._data=e||r.alloc(0),this._links=t||[],this._serializedSize=n}toJSON(){return this._json||(this._json=Object.freeze({data:this.data,links:this.links.map(e=>e.toJSON()),size:this.size})),Object.assign({},this._json)}toString(){return`DAGNode `}get data(){return this._data}set data(e){throw new Error("Can't set property: 'data' is immutable")}get links(){return this._links}set links(e){throw new Error("Can't set property: 'links' is immutable")}get size(){return void 0===this._size&&(this._size=this.links.reduce((e,t)=>e+t.size,this._serializedSize)),this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}}t=e.exports=o(s,{className:"DAGNode",symbolName:"@ipld/js-ipld-dag-pb/dagnode"}),t.create=n(234),t.clone=n(887),t.addLink=n(888),t.rmLink=n(889)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(873),{serialize:i}=n(235),o=n(236),s=o.linkSort,a=n(233),u=n(117);function l(e,n,o){if("function"==typeof e?(o=e,e=void 0):"string"==typeof e&&(e=t.from(e)),"function"==typeof n&&(o=n,n=[]),!t.isBuffer(e))return o(new Error("Passed 'data' is not a buffer or a string!"));n=n.map(e=>u.isDAGLink(e)?e:u.util.createDagLinkFromB58EncodedHash(e)),n=r(n,s),i({data:e,links:n},(t,r)=>t?o(t):o(null,new a(e,n,r.length)))}e.exports=l}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(9),o=n(71),s=o(n(884)),a=n(455),u=n(117),l=n(233),c=n(58),f=n(11),h=n(14);function p(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};const o=t.hashAlg||a.defaultHashAlg;let s=t.version;void 0===s&&(s="sha2-256"===o?0:1),f([t=>{if(r.isBuffer(e))return t(null,e);d(e,t)},(e,t)=>c(e,o,t),(e,t)=>t(null,new i(s,a.multicodec,e))],n)}function d(e,t){let n,{data:r,links:i=[]}=e;!l.isDAGNode(e)&&i&&(i=i.map(e=>u.isDAGLink(e)?e:u.util.createDagLinkFromB58EncodedHash(e)));try{n=s.PBNode.encode(g({data:r,links:i}))}catch(e){return t(e)}t(null,n)}function m(e,t){const n=s.PBNode.decode(e),i=n.Links.map(e=>new u(e.Name,e.Tsize,e.Hash)),o=null==n.Data?r.alloc(0):n.Data;h(()=>t(null,new l(o,i,e.length)))}function g(e){const t={};return e.data&&e.data.length>0?t.Data=e.data:t.Data=null,e.links&&e.links.length>0?t.Links=e.links.map(e=>({Hash:e.cid.buffer,Name:e.name,Tsize:e.size})):t.Links=null,t}t=e.exports,t.serialize=d,t.deserialize=m,t.cid=p}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(117),{cid:o}=n(235);function s(e){let t;return e.data&&e.data.length>0?(t=r.alloc(e.data.length),e.data.copy(t)):t=r.alloc(0),t}function a(e){return e.links.slice()}function u(e,t){return r.compare(e.nameAsBuffer,t.nameAsBuffer)}function l(e,t,n){"function"==typeof t&&(n=t,t={}),o(e,t,(r,o)=>{if(r)return n(r);n(null,new i(t.name||"",e.size,o))})}t=e.exports,t.cloneData=s,t.cloneLinks=a,t.linkSort=u,t.toDAGLink=l}).call(this,n(0).Buffer)},function(e,t,n){var r=n(19);function i(e,t){var n=function(){return new r.aes.Algorithm(e,t)};r.cipher.registerAlgorithm(e,n)}n(458),n(459),n(34),e.exports=r.aes=r.aes||{},r.aes.startEncrypting=function(e,t,n,r){var i=m({key:e,output:n,decrypt:!1,mode:r});return i.start(t),i},r.aes.createEncryptionCipher=function(e,t){return m({key:e,output:null,decrypt:!1,mode:t})},r.aes.startDecrypting=function(e,t,n,r){var i=m({key:e,output:n,decrypt:!0,mode:r});return i.start(t),i},r.aes.createDecryptionCipher=function(e,t){return m({key:e,output:null,decrypt:!0,mode:t})},r.aes.Algorithm=function(e,t){o||h();var n=this;n.name=e,n.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return d(n._w,e,t,!1)},decrypt:function(e,t){return d(n._w,e,t,!0)}}}),n._init=!1},r.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t=e.key,n;if("string"!=typeof t||16!==t.length&&24!==t.length&&32!==t.length){if(r.util.isArray(t)&&(16===t.length||24===t.length||32===t.length)){n=t,t=r.util.createBuffer();for(var i=0;i>>=2;for(var i=0;i>8^255&p^99,a[n]=p,u[p]=n,d=e[p],i=e[n],s=e[i],h=e[s],m=d<<24^p<<16^p<<8^p^d,g=(i^s^h)<<24^(n^h)<<16^(n^s^h)<<8^n^i^h;for(var y=0;y<4;++y)c[y][n]=m,f[y][p]=g,m=m<<24|m>>>8,g=g<<24|g>>>8;0===n?n=r=1:(n=i^e[e[e[i^h]]],r^=e[e[r]])}}function p(e,t){for(var n=e.slice(0),r,i=1,o=n.length,u=o+6+1,c=s*u,h=o;h>>16&255]<<24^a[r>>>8&255]<<16^a[255&r]<<8^a[r>>>24]^l[i]<<24,i++):o>6&&h%o==4&&(r=a[r>>>24]<<24^a[r>>>16&255]<<16^a[r>>>8&255]<<8^a[255&r]),n[h]=n[h-o]^r;if(t){var p,d=f[0],m=f[1],g=f[2],y=f[3],b=n.slice(0);c=n.length;for(var h=0,v=c-s;h>>24]]^m[a[p>>>16&255]]^g[a[p>>>8&255]]^y[a[255&p]];n=b}return n}function d(e,t,n,r){var i=e.length/4-1,o,s,l,h,p,d,m,g,y,b,v,w;r?(o=f[0],s=f[1],l=f[2],h=f[3],p=u):(o=c[0],s=c[1],l=c[2],h=c[3],p=a),d=t[0]^e[0],m=t[r?3:1]^e[1],g=t[2]^e[2],y=t[r?1:3]^e[3];for(var _=3,k=1;k>>24]^s[m>>>16&255]^l[g>>>8&255]^h[255&y]^e[++_],v=o[m>>>24]^s[g>>>16&255]^l[y>>>8&255]^h[255&d]^e[++_],w=o[g>>>24]^s[y>>>16&255]^l[d>>>8&255]^h[255&m]^e[++_],y=o[y>>>24]^s[d>>>16&255]^l[m>>>8&255]^h[255&g]^e[++_],d=b,m=v,g=w;n[0]=p[d>>>24]<<24^p[m>>>16&255]<<16^p[g>>>8&255]<<8^p[255&y]^e[++_],n[r?3:1]=p[m>>>24]<<24^p[g>>>16&255]<<16^p[y>>>8&255]<<8^p[255&d]^e[++_],n[2]=p[g>>>24]<<24^p[y>>>16&255]<<16^p[d>>>8&255]<<8^p[255&m]^e[++_],n[r?1:3]=p[y>>>24]<<24^p[d>>>16&255]<<16^p[m>>>8&255]<<8^p[255&g]^e[++_]}function m(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),n="AES-"+t,i;i=e.decrypt?r.cipher.createDecipher(n,e.key):r.cipher.createCipher(n,e.key);var o=i.start;return i.start=function(e,t){var n=null;t instanceof r.util.ByteBuffer&&(n=t,t={}),t=t||{},t.output=n,t.iv=e,o.call(i,t)},i}},function(e,t,n){"use strict";var r=n(4).Buffer,i=n(931),o;function s(){this.negative=0,this.words=null,this.length=0}s.fromNumber=function(e){var t=new s;return t.words=[67108863&e],t.length=1,t},s.fromBuffer=function(e){var t=new s;return t.words=new Array(10),t.words[0]=(3&e[28])<<24|e[29]<<16|e[30]<<8|e[31],t.words[1]=(15&e[25])<<22|e[26]<<14|e[27]<<6|e[28]>>>2,t.words[2]=(63&e[22])<<20|e[23]<<12|e[24]<<4|e[25]>>>4,t.words[3]=(255&e[19])<<18|e[20]<<10|e[21]<<2|e[22]>>>6,t.words[4]=(3&e[15])<<24|e[16]<<16|e[17]<<8|e[18],t.words[5]=(15&e[12])<<22|e[13]<<14|e[14]<<6|e[15]>>>2,t.words[6]=(63&e[9])<<20|e[10]<<12|e[11]<<4|e[12]>>>4,t.words[7]=(255&e[6])<<18|e[7]<<10|e[8]<<2|e[9]>>>6,t.words[8]=(3&e[2])<<24|e[3]<<16|e[4]<<8|e[5],t.words[9]=e[0]<<14|e[1]<<6|e[2]>>>2,t.length=10,t.strip()},s.prototype.toBuffer=function(){for(var e=this.words,t=this.length;t<10;++t)e[t]=0;return r.from([e[9]>>>14&255,e[9]>>>6&255,(63&e[9])<<2|e[8]>>>24&3,e[8]>>>16&255,e[8]>>>8&255,255&e[8],e[7]>>>18&255,e[7]>>>10&255,e[7]>>>2&255,(3&e[7])<<6|e[6]>>>20&63,e[6]>>>12&255,e[6]>>>4&255,(15&e[6])<<4|e[5]>>>22&15,e[5]>>>14&255,e[5]>>>6&255,(63&e[5])<<2|e[4]>>>24&3,e[4]>>>16&255,e[4]>>>8&255,255&e[4],e[3]>>>18&255,e[3]>>>10&255,e[3]>>>2&255,(3&e[3])<<6|e[2]>>>20&63,e[2]>>>12&255,e[2]>>>4&255,(15&e[2])<<4|e[1]>>>22&15,e[1]>>>14&255,e[1]>>>6&255,(63&e[1])<<2|e[0]>>>24&3,e[0]>>>16&255,e[0]>>>8&255,255&e[0]])},s.prototype.clone=function(){var e=new s;e.words=new Array(this.length);for(var t=0;t1&&0==(0|this.words[this.length-1]);)this.length--;return this},s.prototype.normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.ucmp=function(e){if(this.length!==e.length)return this.length>e.length?1:-1;for(var t=this.length-1;t>=0;--t)if(this.words[t]!==e.words[t])return this.words[t]>e.words[t]?1:-1;return 0},s.prototype.gtOne=function(){return this.length>1||this.words[0]>1},s.prototype.isOverflow=function(){return this.ucmp(s.n)>=0},s.prototype.isHigh=function(){return 1===this.ucmp(s.nh)},s.prototype.bitLengthGT256=function(){return this.length>10||10===this.length&&this.words[9]>4194303},s.prototype.iuaddn=function(e){this.words[0]+=e;for(var t=0;this.words[t]>67108863&&te.length?(t=this,n=e):(t=e,n=this);for(var r=0,i=0;r>>26}for(;0!==i&&r>>26;if(this.length=t.length,0!==i)this.words[this.length++]=i;else if(t!==this)for(;r0?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;i>26,this.words[i]=67108863&s}for(;0!==o&&i>26,this.words[i]=67108863&s;if(0===o&&i>>26,c=67108863&s,f=Math.max(0,a-e.length+1),h=Math.min(a,t.length-1);f<=h;f++){var p=a-f,d=e.words[p],m=t.words[f],g=d*m+c;l+=g/67108864|0,c=67108863&g}n.words[a]=c,s=l}return 0!==s&&(n.words[n.length++]=s),n.strip()},s.umulTo10x10=Math.imul?i.umulTo10x10:s.umulTo,s.umulnTo=function(e,t,n){if(0===t)return n.words=[0],n.length=1,n;for(var r=0,i=0;r0?(n.words[r]=i,n.length=e.length+1):n.length=e.length,n},s.prototype.umul=function(e){var t=new s;return t.words=new Array(this.length+e.length),10===this.length&&10===e.length?s.umulTo10x10(this,e,t):1===this.length?s.umulnTo(e,this.words[0],t):1===e.length?s.umulnTo(this,e.words[0],t):s.umulTo(this,e,t)},s.prototype.isplit=function(e){e.length=Math.min(this.length,9);for(var t=0;t>>22,n=r}return n>>>=22,this.words[t-10]=n,0===n&&this.length>10?this.length-=10:this.length-=9,this},s.prototype.fireduce=function(){return this.isOverflow()&&this.isub(s.n),this},s.prototype.ureduce=function(){var e=this.clone().isplit(s.tmp).umul(s.nc).iadd(s.tmp);return e.bitLengthGT256()&&(e=e.isplit(s.tmp).umul(s.nc).iadd(s.tmp),e.bitLengthGT256()&&(e=e.isplit(s.tmp).umul(s.nc).iadd(s.tmp))),e.fireduce()},s.prototype.ishrn=function(e){for(var t=(1<=0;--r){var o=this.words[r];this.words[r]=i<>>e,i=o&t}return this.length>1&&0===this.words[this.length-1]&&(this.length-=1),this},s.prototype.uinvm=function(){for(var e=this.clone(),t=s.n.clone(),n=s.fromNumber(1),r=s.fromNumber(0),i=s.fromNumber(0),o=s.fromNumber(1);e.isEven()&&t.isEven();){for(var a=1,u=1;0==(e.words[0]&u)&&0==(t.words[0]&u)&&a<26;++a,u<<=1);e.ishrn(a),t.ishrn(a)}for(var l=t.clone(),c=e.clone();!e.isZero();){for(var f=0,h=1;0==(e.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(e.ishrn(f);f-- >0;)(n.isOdd()||r.isOdd())&&(n.iadd(l),r.isub(c)),n.ishrn(1),r.ishrn(1);for(var p=0,d=1;0==(t.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(t.ishrn(p);p-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(l),o.isub(c)),i.ishrn(1),o.ishrn(1);e.ucmp(t)>=0?(e.isub(t),n.isub(i),r.isub(o)):(t.isub(e),i.isub(n),o.isub(r))}if(1===i.negative){i.negative=0;var m=i.ureduce();return m.negative^=1,m.normSign().iadd(s.n)}return i.ureduce()},s.prototype.imulK=function(){this.words[this.length]=0,this.words[this.length+1]=0,this.length+=2;for(var e=0,t=0;e0?this.isub(s.p):this.strip(),this},s.prototype.redNeg=function(){return this.isZero()?s.fromNumber(0):s.p.sub(this)},s.prototype.redAdd=function(e){return this.clone().redIAdd(e)},s.prototype.redIAdd=function(e){return this.iadd(e),this.ucmp(s.p)>=0&&this.isub(s.p),this},s.prototype.redIAdd7=function(){return this.iuaddn(7),this.ucmp(s.p)>=0&&this.isub(s.p),this},s.prototype.redSub=function(e){return this.clone().redISub(e)},s.prototype.redISub=function(e){return this.isub(e),0!==this.negative&&this.iadd(s.p),this},s.prototype.redMul=function(e){return this.umul(e).redIReduce()},s.prototype.redSqr=function(){return this.umul(this).redIReduce()},s.prototype.redSqrt=function(){if(this.isZero())return this.clone();for(var e=this.redSqr(),t=e.redSqr(),n=t.redSqr().redMul(t),r=n.redMul(e),i=r.redMul(this),o=i,s=0;s<54;++s)o=o.redSqr().redSqr().redSqr().redSqr().redMul(i);for(o=o.redSqr().redSqr().redSqr().redSqr().redMul(r),s=0;s<5;++s)o=o.redSqr().redSqr().redSqr().redSqr().redMul(i);return o=o.redSqr().redSqr().redSqr().redSqr().redMul(n),o=o.redSqr().redSqr().redSqr().redSqr().redSqr().redSqr().redMul(n),0===o.redSqr().ucmp(this)?o:null},s.prototype.redInvm=function(){for(var e=this.clone(),t=s.p.clone(),n=s.fromNumber(1),r=s.fromNumber(0),i;e.gtOne()&&t.gtOne();){for(var o=0,a=1;0==(e.words[0]&a)&&o<26;++o,a<<=1);if(o>0)for(e.ishrn(o);o-- >0;)n.isOdd()&&n.iadd(s.p),n.ishrn(1);for(var u=0,l=1;0==(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.ishrn(u);u-- >0;)r.isOdd()&&r.iadd(s.p),r.ishrn(1);e.ucmp(t)>=0?(e.isub(t),n.isub(r)):(t.isub(e),r.isub(n))}return i=1===e.length&&1===e.words[0]?n:r,0!==i.negative&&i.iadd(s.p),0!==i.negative?(i.negative=0,i.redIReduce().redNeg()):i.redIReduce()},s.prototype.getNAF=function(e){for(var t=[],n=1<>1,o=this.clone();!o.isZero();){for(var s=0,a=1;0==(o.words[0]&a)&&s<26;++s,a<<=1)t.push(0);if(0!==s)o.ishrn(s);else{var u=o.words[0]&r;if(u>=i)t.push(i-u),o.iuaddn(u-i).ishrn(1);else if(t.push(u),o.words[0]-=u,!o.isZero()){for(s=e-1;s>0;--s)t.push(0);o.ishrn(e)}}}return t},s.prototype.inspect=function(){if(this.isZero())return"0";for(var e=this.toBuffer().toString("hex"),t=0;"0"===e[t];++t);return e.slice(t)},s.n=s.fromBuffer(r.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","hex")),s.nh=s.n.clone().ishrn(1),s.nc=s.fromBuffer(r.from("000000000000000000000000000000014551231950B75FC4402DA1732FC9BEBF","hex")),s.p=s.fromBuffer(r.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","hex")),s.psn=s.p.sub(s.n),s.tmp=new s,s.tmp.words=new Array(10),o=s.fromNumber(1),o.words[3]=0,e.exports=s},function(e,t,n){var r=n(4).Buffer;function i(e){r.isBuffer(e)||(e=r.from(e));for(var t=e.length/4|0,n=new Array(t),i=0;i>>24]^s[c>>>16&255]^a[f>>>8&255]^u[255&h]^t[y++],d=o[c>>>24]^s[f>>>16&255]^a[h>>>8&255]^u[255&l]^t[y++],m=o[f>>>24]^s[h>>>16&255]^a[l>>>8&255]^u[255&c]^t[y++],g=o[h>>>24]^s[l>>>16&255]^a[c>>>8&255]^u[255&f]^t[y++],l=p,c=d,f=m,h=g;return p=(r[l>>>24]<<24|r[c>>>16&255]<<16|r[f>>>8&255]<<8|r[255&h])^t[y++],d=(r[c>>>24]<<24|r[f>>>16&255]<<16|r[h>>>8&255]<<8|r[255&l])^t[y++],m=(r[f>>>24]<<24|r[h>>>16&255]<<16|r[l>>>8&255]<<8|r[255&c])^t[y++],g=(r[h>>>24]<<24|r[l>>>16&255]<<16|r[c>>>8&255]<<8|r[255&f])^t[y++],p>>>=0,d>>>=0,m>>>=0,g>>>=0,[p,d,m,g]}var a=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var n=[],r=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,u=0;u<256;++u){var l=a^a<<1^a<<2^a<<3^a<<4;l=l>>>8^255&l^99,n[s]=l,r[l]=s;var c=e[s],f=e[c],h=e[f],p=257*e[l]^16843008*l;i[0][s]=p<<24|p>>>8,i[1][s]=p<<16|p>>>16,i[2][s]=p<<8|p>>>24,i[3][s]=p,p=16843009*h^65537*f^257*c^16843008*s,o[0][l]=p<<24|p>>>8,o[1][l]=p<<16|p>>>16,o[2][l]=p<<8|p>>>24,o[3][l]=p,0===s?s=a=1:(s=c^e[e[e[h^c]]],a^=e[e[a]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:o}}();function l(e){this._key=i(e),this._reset()}l.blockSize=16,l.keySize=32,l.prototype.blockSize=l.blockSize,l.prototype.keySize=l.keySize,l.prototype._reset=function(){for(var e=this._key,t=e.length,n=t+6,r=4*(n+1),i=[],o=0;o>>24,s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s],s^=a[o/t|0]<<24):t>6&&o%t==4&&(s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s]),i[o]=i[o-t]^s}for(var l=[],c=0;c>>24]]^u.INV_SUB_MIX[1][u.SBOX[h>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[h>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&h]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=l},l.prototype.encryptBlockRaw=function(e){return e=i(e),s(e,this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},l.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),n=r.allocUnsafe(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[1],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[3],12),n},l.prototype.decryptBlock=function(e){e=i(e);var t=e[1];e[1]=e[3],e[3]=t;var n=s(e,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=r.allocUnsafe(16);return o.writeUInt32BE(n[0],0),o.writeUInt32BE(n[3],4),o.writeUInt32BE(n[2],8),o.writeUInt32BE(n[1],12),o},l.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},e.exports.AES=l},function(e,t){function n(e){return e}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=n(68),i=a(r),o=n(291),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){return function(n,r,o,a){a=a||i.default;var u=!1,l;n(r,function(n,r,i){o(n,function(r,o){r?i(r):e(o)&&!l?(u=!0,l=t(!0,n),i(null,s.default)):i()})},function(e){e?a(e):a(null,u?l:t(!1))})}}e.exports=t.default},function(e,t,n){"use strict";const r=n(71),i=n(137),o=n(981),s=n(18),a=n(56),u=n(91),l=n(9),c=n(982),f=n(984),h=n(58),p=r(n(985)),d=n(986);class m{constructor(e){this.full=e,this.wantlist=new Map,this.blocks=new Map}get empty(){return 0===this.blocks.size&&0===this.wantlist.size}addEntry(e,t,n){s(e&&l.isCID(e),"must be a valid cid");const r=e.buffer.toString(),i=this.wantlist.get(r);i?(i.priority=t,i.cancel=Boolean(n)):this.wantlist.set(r,new d(e,t,n))}addBlock(e){s(i.isBlock(e),"must be a valid cid");const t=e.cid.buffer.toString();this.blocks.set(t,e)}cancel(e){s(l.isCID(e),"must be a valid cid");const t=e.buffer.toString();this.wantlist.delete(t),this.addEntry(e,0,!0)}serializeToBitswap100(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map(e=>({block:e.cid.buffer,priority:Number(e.priority),cancel:Boolean(e.cancel)}))},blocks:Array.from(this.blocks.values()).map(e=>e.data)};return this.full&&(e.wantlist.full=!0),p.Message.encode(e)}serializeToBitswap110(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map(e=>({block:e.cid.buffer,priority:Number(e.priority),cancel:Boolean(e.cancel)}))},payload:[]};return this.full&&(e.wantlist.full=!0),this.blocks.forEach(t=>{e.payload.push({prefix:t.cid.prefix,data:t.data})}),p.Message.encode(e)}equals(e){const t=(e,t)=>{if(e.equals&&"function"==typeof e.equals)return e.equals(t)};return!(this.full!==e.full||!o(this.wantlist,e.wantlist,t)||!o(this.blocks,e.blocks,t))}get[Symbol.toStringTag](){const e=Array.from(this.wantlist.keys()),t=Array.from(this.blocks.keys());return`BitswapMessage `}}m.deserialize=((e,t)=>{let n;try{n=p.Message.decode(e)}catch(e){return u(()=>t(e))}const r=n.wantlist&&n.wantlist.full||!1,o=new m(r);return n.wantlist&&n.wantlist.entries.forEach(e=>{let n;try{n=new l(e.block)}catch(e){return t(e)}o.addEntry(n,e.priority,e.cancel)}),n.blocks.length>0?a(n.blocks,(e,n)=>{h(e,"sha2-256",(r,s)=>{if(r)return n(r);let a;try{a=new l(s)}catch(r){return t(r)}o.addBlock(new i(e,a)),n()})},e=>{if(e)return t(e);t(null,o)}):n.payload.length>0?a(n.payload,(e,t)=>{if(!e.prefix||!e.data)return u(t);const n=f(e.prefix),r=n[0],s=n[1],a=n[2];h(e.data,a,(n,a)=>{if(n)return t(n);let u;try{u=new l(r,c[s.toString("16")],a)}catch(n){return t(n)}o.addBlock(new i(e.data,u)),t()})},e=>{if(e)return t(e);t(null,o)}):void t(null,o)}),m.Entry=d,e.exports=m},function(e,t,n){"use strict";const{sortBy:r}=n(120),i=n(987);class o{constructor(e){this.set=new Map,this._stats=e}get length(){return this.set.size}add(e,t){const n=e.buffer.toString(),r=this.set.get(n);r?(r.inc(),r.priority=t):(this.set.set(n,new i(e,t)),this._stats&&this._stats.push(null,"wantListSize",1))}remove(e){const t=e.buffer.toString(),n=this.set.get(t);n&&(n.dec(),n.hasRefs()||(this.set.delete(t),this._stats&&this._stats.push(null,"wantListSize",-1)))}removeForce(e){this.set.has(e)&&this.set.delete(e)}forEach(e){return this.set.forEach(e)}entries(){return this.set.entries()}sortedEntries(){return new Map(r(e=>e[1].key,Array.from(this.set.entries())))}contains(e){const t=e.buffer.toString();return this.set.get(t)}}o.Entry=i,e.exports=o},function(e,t,n){var r=n(493);function i(e,t,n){var i=null==e?void 0:r(e,t);return void 0===i?n:i}e.exports=i},function(e,t,n){var r=n(121),i=r(Object,"create");e.exports=i},function(e,t,n){var r=n(1012),i=n(1013),o=n(1014),s=n(1015),a=n(1016);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function l(){try{return window.localStorage}catch(e){}}t=e.exports=n(1062),t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:l(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(this,n(2))},function(e,t){t.encode=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t},t.decode=function(e){for(var t={},n=e.split("&"),r=0,i=n.length;r=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function l(){try{return window.localStorage}catch(e){}}t=e.exports=n(1079),t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:l(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(this,n(2))},function(e,t,n){(function(t){e.exports=f;var r=n(5)("simple-peer"),i=n(1086),o=n(1),s=n(148),a=n(1087),u=65536,l=5e3,c=5e3;function f(e){var t=this;if(!(t instanceof f))return new f(e);if(t._id=s(4).toString("hex").slice(0,7),t._debug("new peer %o",e),e=Object.assign({allowHalfOpen:!1},e),a.Duplex.call(t,e),t.channelName=e.initiator?e.channelName||s(20).toString("hex"):null,t.initiator=e.initiator||!1,t.channelConfig=e.channelConfig||f.channelConfig,t.config=Object.assign({},f.config,e.config),t.offerOptions=e.offerOptions||{},t.answerOptions=e.answerOptions||{},t.sdpTransform=e.sdpTransform||function(e){return e},t.streams=e.streams||(e.stream?[e.stream]:[]),t.trickle=void 0===e.trickle||e.trickle,t.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,t.iceCompleteTimeout=e.iceCompleteTimeout||l,t.destroyed=!1,t.connected=!1,t.remoteAddress=void 0,t.remoteFamily=void 0,t.remotePort=void 0,t.localAddress=void 0,t.localFamily=void 0,t.localPort=void 0,t._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:i(),!t._wrtc)throw"undefined"==typeof window?p("No WebRTC support: Specify `opts.wrtc` option in this environment","ERR_WEBRTC_SUPPORT"):p("No WebRTC support: Not a supported browser","ERR_WEBRTC_SUPPORT");t._pcReady=!1,t._channelReady=!1,t._iceComplete=!1,t._iceCompleteTimer=null,t._channel=null,t._pendingCandidates=[],t._isNegotiating=!t.initiator,t._batchedNegotiation=!1,t._queuedNegotiation=!1,t._sendersAwaitingStable=[],t._senderMap=new Map,t._firstStable=!0,t._closingInterval=null,t._remoteTracks=[],t._remoteStreams=[],t._chunk=null,t._cb=null,t._interval=null;try{t._pc=new t._wrtc.RTCPeerConnection(t.config)}catch(e){t.destroy(e)}t._isReactNativeWebrtc="number"==typeof t._pc._peerConnectionId,t._pc.oniceconnectionstatechange=function(){t._onIceStateChange()},t._pc.onicegatheringstatechange=function(){t._onIceStateChange()},t._pc.onsignalingstatechange=function(){t._onSignalingStateChange()},t._pc.onicecandidate=function(e){t._onIceCandidate(e)},t.initiator?t._setupData({channel:t._pc.createDataChannel(t.channelName,t.channelConfig)}):t._pc.ondatachannel=function(e){t._setupData(e)},t.streams&&t.streams.forEach(function(e){t.addStream(e)}),t._pc.ontrack=function(e){t._onTrack(e)},t.initiator&&t._needsNegotiation(),t._onFinishBound=function(){t._onFinish()},t.once("finish",t._onFinishBound)}function h(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}function p(e,t){var n=new Error(e);return n.code=t,n}o(f,a.Duplex),f.WEBRTC_SUPPORT=!!i(),f.config={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:global.stun.twilio.com:3478?transport=udp"}],sdpSemantics:"unified-plan"},f.channelConfig={},Object.defineProperty(f.prototype,"bufferSize",{get:function(){var e=this;return this._channel&&this._channel.bufferedAmount||0}}),f.prototype.address=function(){var e=this;return{port:this.localPort,family:this.localFamily,address:this.localAddress}},f.prototype.signal=function(e){var t=this;if(t.destroyed)throw p("cannot signal after peer is destroyed","ERR_SIGNALING");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}t._debug("signal()"),e.renegotiate&&t.initiator&&(t._debug("got request to renegotiate"),t._needsNegotiation()),e.transceiverRequest&&t.initiator&&(t._debug("got request for transceiver"),t.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(t._pc.localDescription&&t._pc.localDescription.type&&t._pc.remoteDescription&&t._pc.remoteDescription.type?t._addIceCandidate(e.candidate):t._pendingCandidates.push(e.candidate)),e.sdp&&t._pc.setRemoteDescription(new t._wrtc.RTCSessionDescription(e)).then(function(){t.destroyed||(t._pendingCandidates.forEach(function(e){t._addIceCandidate(e)}),t._pendingCandidates=[],"offer"===t._pc.remoteDescription.type&&t._createAnswer())}).catch(function(e){t.destroy(p(e,"ERR_SET_REMOTE_DESCRIPTION"))}),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||t.destroy(p("signal() called with invalid signal data","ERR_SIGNALING"))},f.prototype._addIceCandidate=function(e){var t=this;t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e)).catch(function(e){if("closed"!==t._pc.signalingState&&"Failed to set ICE candidate; RTCPeerConnection is closed."===e.message)return t._debug("ignoring incorrect wrtc error");t.destroy(p(e,"ERR_ADD_ICE_CANDIDATE"))})},f.prototype.send=function(e){var t=this;this._channel.send(e)},f.prototype.addTransceiver=function(e,t){var n=this;if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(e){this.destroy(e)}else this.emit("signal",{transceiverRequest:{kind:e,init:t}})},f.prototype.addStream=function(e){var t=this;t._debug("addStream()"),e.getTracks().forEach(function(n){t.addTrack(n,e)})},f.prototype.addTrack=function(e,t){var n=this;this._debug("addTrack()");var r=this._senderMap.get(e)||new Map,i=r.get(t);i?i.removed?this.destroy(p("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):this.destroy(p("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED"):(i=this._pc.addTrack(e,t),r.set(t,i),this._senderMap.set(e,r),this._needsNegotiation())},f.prototype.replaceTrack=function(e,t,n){var r=this;this._debug("replaceTrack()");var i=this._senderMap.get(e),o=i?i.get(n):null;o||this.destroy(p("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED"),t&&this._senderMap.set(t,i),null!=o.replaceTrack?o.replaceTrack(t):this.destroy(p("replaceTrack is not supported in this browser","ERR_UNSUPPORTED_REPLACETRACK"))},f.prototype.removeTrack=function(e,t){var n=this;this._debug("removeSender()");var r=this._senderMap.get(e),i=r?r.get(t):null;i||this.destroy(p("Cannot remove track that was never added.","ERR_TRACK_NOT_ADDED"));try{i.removed=!0,this._pc.removeTrack(i)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?this._sendersAwaitingStable.push(i):this.destroy(e)}this._needsNegotiation()},f.prototype.removeStream=function(e){var t=this;t._debug("removeSenders()"),e.getTracks().forEach(function(n){t.removeTrack(n,e)})},f.prototype._needsNegotiation=function(){var e=this;e._debug("_needsNegotiation"),e._batchedNegotiation||(e._batchedNegotiation=!0,setTimeout(function(){e._batchedNegotiation=!1,e._debug("starting batched negotiation"),e.negotiate()},0))},f.prototype.negotiate=function(){var e=this;e.initiator?e._isNegotiating?(e._queuedNegotiation=!0,e._debug("already negotiating, queueing")):(e._debug("start negotiation"),setTimeout(()=>{e._createOffer()},0)):e._isNegotiating||(e._debug("requesting negotiation from initiator"),e.emit("signal",{renegotiate:!0})),e._isNegotiating=!0},f.prototype.destroy=function(e){var t=this;this._destroy(e,function(){})},f.prototype._destroy=function(e,t){var n=this;if(!this.destroyed){if(this._debug("destroy (error: %s)",e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this.destroyed=!0,this.connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(e){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,e&&this.emit("error",e),this.emit("close"),t()}},f.prototype._setupData=function(e){var t=this;if(!e.channel)return t.destroy(p("Data channel event is missing `channel` property","ERR_DATA_CHANNEL"));t._channel=e.channel,t._channel.binaryType="arraybuffer","number"==typeof t._channel.bufferedAmountLowThreshold&&(t._channel.bufferedAmountLowThreshold=65536),t.channelName=t._channel.label,t._channel.onmessage=function(e){t._onChannelMessage(e)},t._channel.onbufferedamountlow=function(){t._onChannelBufferedAmountLow()},t._channel.onopen=function(){t._onChannelOpen()},t._channel.onclose=function(){t._onChannelClose()},t._channel.onerror=function(e){t.destroy(p(e,"ERR_DATA_CHANNEL"))};var n=!1;t._closingInterval=setInterval(function(){t._channel&&"closing"===t._channel.readyState?(n&&t._onChannelClose(),n=!0):n=!1},5e3)},f.prototype._read=function(){},f.prototype._write=function(e,t,n){var r=this;if(this.destroyed)return n(p("cannot write after peer is destroyed","ERR_DATA_CHANNEL"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(p(e,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=e,this._cb=n},f.prototype._onFinish=function(){var e=this;function t(){setTimeout(function(){e.destroy()},1e3)}e.destroyed||(e.connected?t():e.once("connect",t))},f.prototype._startIceCompleteTimeout=function(){var e=this;e.destroyed||e._iceCompleteTimer||(e._debug("started iceComplete timeout"),e._iceCompleteTimer=setTimeout(function(){e._iceComplete||(e._iceComplete=!0,e._debug("iceComplete timeout completed"),e.emit("iceTimeout"),e.emit("_iceComplete"))},e.iceCompleteTimeout))},f.prototype._createOffer=function(){var e=this;e.destroyed||e._pc.createOffer(e.offerOptions).then(function(t){function n(){e._debug("createOffer success"),e.destroyed||(e.trickle||e._iceComplete?i():e.once("_iceComplete",i))}function r(t){e.destroy(p(t,"ERR_SET_LOCAL_DESCRIPTION"))}function i(){if(!e.destroyed){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp})}}e.destroyed||(e.trickle||e.allowHalfTrickle||(t.sdp=h(t.sdp)),t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(n).catch(r))}).catch(function(t){e.destroy(p(t,"ERR_CREATE_OFFER"))})},f.prototype._requestMissingTransceivers=function(){var e=this;e._pc.getTransceivers&&e._pc.getTransceivers().forEach(t=>{!t.mid&&t.sender.track&&e.addTransceiver(t.sender.track.kind)})},f.prototype._createAnswer=function(){var e=this;e.destroyed||e._pc.createAnswer(e.answerOptions).then(function(t){function n(){e.destroyed||(e.trickle||e._iceComplete?i():e.once("_iceComplete",i))}function r(t){e.destroy(p(t,"ERR_SET_LOCAL_DESCRIPTION"))}function i(){if(!e.destroyed){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp}),e.initiator||e._requestMissingTransceivers()}}e.destroyed||(e.trickle||e.allowHalfTrickle||(t.sdp=h(t.sdp)),t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(n).catch(r))}).catch(function(t){e.destroy(p(t,"ERR_CREATE_ANSWER"))})},f.prototype._onIceStateChange=function(){var e=this;if(!this.destroyed){var t=this._pc.iceConnectionState,n=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",t,n),this.emit("iceStateChange",t,n),"connected"!==t&&"completed"!==t||(this._pcReady=!0,this._maybeReady()),"failed"===t&&this.destroy(p("Ice connection failed.","ERR_ICE_CONNECTION_FAILURE")),"closed"===t&&this.destroy(p("Ice connection closed.","ERR_ICE_CONNECTION_CLOSED"))}},f.prototype.getStats=function(e){var t=this;function n(e){return"[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach(function(t){Object.assign(e,t)}),e}0===t._pc.getStats.length?t._pc.getStats().then(function(t){var r=[];t.forEach(function(e){r.push(n(e))}),e(null,r)},function(t){e(t)}):t._isReactNativeWebrtc?t._pc.getStats(null,function(t){var r=[];t.forEach(function(e){r.push(n(e))}),e(null,r)},function(t){e(t)}):t._pc.getStats.length>0?t._pc.getStats(function(r){if(!t.destroyed){var i=[];r.result().forEach(function(e){var t={};e.names().forEach(function(n){t[n]=e.stat(n)}),t.id=e.id,t.type=e.type,t.timestamp=e.timestamp,i.push(n(t))}),e(null,i)}},function(t){e(t)}):e(null,[])},f.prototype._maybeReady=function(){var e=this;function t(){e.destroyed||e.getStats(function(n,r){if(!e.destroyed){n&&(r=[]);var i={},o={},s={},a=!1;if(r.forEach(function(e){"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(i[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(o[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(s[e.id]=e)}),r.forEach(function(e){"transport"===e.type&&e.selectedCandidatePairId&&l(s[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&l(e)}),a||Object.keys(s).length&&!Object.keys(o).length){if(e._connecting=!1,e.connected=!0,e._chunk){try{e.send(e._chunk)}catch(n){return e.destroy(p(n,"ERR_DATA_CHANNEL"))}e._chunk=null,e._debug('sent chunk from "write before connect"');var u=e._cb;e._cb=null,u(null)}"number"!=typeof e._channel.bufferedAmountLowThreshold&&(e._interval=setInterval(function(){e._onInterval()},150),e._interval.unref&&e._interval.unref()),e._debug("connect"),e.emit("connect")}else setTimeout(t,100)}function l(t){a=!0;var n=o[t.localCandidateId];n&&(n.ip||n.address)?(e.localAddress=n.ip||n.address,e.localPort=Number(n.port)):n&&n.ipAddress?(e.localAddress=n.ipAddress,e.localPort=Number(n.portNumber)):"string"==typeof t.googLocalAddress&&(n=t.googLocalAddress.split(":"),e.localAddress=n[0],e.localPort=Number(n[1])),e.localAddress&&(e.localFamily=e.localAddress.includes(":")?"IPv6":"IPv4");var r=i[t.remoteCandidateId];r&&(r.ip||r.address)?(e.remoteAddress=r.ip||r.address,e.remotePort=Number(r.port)):r&&r.ipAddress?(e.remoteAddress=r.ipAddress,e.remotePort=Number(r.portNumber)):"string"==typeof t.googRemoteAddress&&(r=t.googRemoteAddress.split(":"),e.remoteAddress=r[0],e.remotePort=Number(r[1])),e.remoteAddress&&(e.remoteFamily=e.remoteAddress.includes(":")?"IPv6":"IPv4"),e._debug("connect local: %s:%s remote: %s:%s",e.localAddress,e.localPort,e.remoteAddress,e.remotePort)}})}e._debug("maybeReady pc %s channel %s",e._pcReady,e._channelReady),!e.connected&&!e._connecting&&e._pcReady&&e._channelReady&&(e._connecting=!0,t())},f.prototype._onInterval=function(){var e=this;!this._cb||!this._channel||this._channel.bufferedAmount>65536||this._onChannelBufferedAmountLow()},f.prototype._onSignalingStateChange=function(){var e=this;e.destroyed||("stable"!==e._pc.signalingState||e._firstStable||(e._isNegotiating=!1,e._debug("flushing sender queue",e._sendersAwaitingStable),e._sendersAwaitingStable.forEach(function(t){e._pc.removeTrack(t),e._queuedNegotiation=!0}),e._sendersAwaitingStable=[],e._queuedNegotiation&&(e._debug("flushing negotiation queue"),e._queuedNegotiation=!1,e._needsNegotiation()),e._debug("negotiate"),e.emit("negotiate")),e._firstStable=!1,e._debug("signalingStateChange %s",e._pc.signalingState),e.emit("signalingStateChange",e._pc.signalingState))},f.prototype._onIceCandidate=function(e){var t=this;this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())},f.prototype._onChannelMessage=function(e){var n=this;if(!this.destroyed){var r=e.data;r instanceof ArrayBuffer&&(r=t.from(r)),this.push(r)}},f.prototype._onChannelBufferedAmountLow=function(){var e=this;if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);var t=this._cb;this._cb=null,t(null)}},f.prototype._onChannelOpen=function(){var e=this;this.connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())},f.prototype._onChannelClose=function(){var e=this;this.destroyed||(this._debug("on channel close"),this.destroy())},f.prototype._onTrack=function(e){var t=this;t.destroyed||e.streams.forEach(function(n){t._debug("on track"),t.emit("track",e.track,n),t._remoteTracks.push({track:e.track,stream:n}),t._remoteStreams.some(function(e){return e.id===n.id})||(t._remoteStreams.push(n),setTimeout(function(){t.emit("stream",n)},0))})},f.prototype._debug=function(){var e=this,t=[].slice.call(arguments);t[0]="["+this._id+"] "+t[0],r.apply(null,t)}}).call(this,n(0).Buffer)},function(e,t,n){var r=n(28),i=function(){},o=function(e){return e.setHeader&&"function"==typeof e.abort},s=function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length},a=function(e,t,n){if("function"==typeof t)return a(e,null,t);t||(t={}),n=r(n||i);var u=e._writableState,l=e._readableState,c=t.readable||!1!==t.readable&&e.readable,f=t.writable||!1!==t.writable&&e.writable,h=function(){e.writable||p()},p=function(){f=!1,c||n.call(e)},d=function(){c=!1,f||n.call(e)},m=function(t){n.call(e,t?new Error("exited with error code: "+t):null)},g=function(t){n.call(e,t)},y=function(){return(!c||l&&l.ended)&&(!f||u&&u.ended)?void 0:n.call(e,new Error("premature close"))},b=function(){e.req.on("finish",p)};return o(e)?(e.on("complete",p),e.on("abort",y),e.req?b():e.on("request",b)):f&&!u&&(e.on("end",h),e.on("close",h)),s(e)&&e.on("exit",m),e.on("end",d),e.on("finish",p),!1!==t.error&&e.on("error",g),e.on("close",y),function(){e.removeListener("complete",p),e.removeListener("abort",y),e.removeListener("request",b),e.req&&e.req.removeListener("finish",p),e.removeListener("end",h),e.removeListener("close",h),e.removeListener("finish",p),e.removeListener("exit",m),e.removeListener("end",d),e.removeListener("error",g),e.removeListener("close",y)}};e.exports=a},function(e,t){var n=function(){};function r(e,t,n){var r=e.length;if(!r)return n(t);function i(){--r||n(t)}e.forEach(function(e){e?e(t,i):i()}),r||i()}e.exports=function(e){return function(t,n){!function i(){t?r(e,t,n):e.length?e[0]?e[0](null,function(t,o){t?(e.shift(),!0===t?i():r(e,t,n)):n(null,o)}):(e.shift(),i()):n(!0)}()}}},function(e,t,n){"use strict";e.exports=function(){var e,t;function n(n){if("function"!=typeof n)throw new Error("read must be function");if(e)throw new Error("already piped");if(e=n,t){var r=t;t=null,e.apply(null,r)}}function r(n,r){e?e(n,r):t=[n,r]}return{source:r,sink:n}}},function(e,t,n){"use strict";t.Listener=t.listener=n(1129),t.Dialer=t.dialer=n(1132),t.matchSemver=n(1133),t.matchExact=n(532)},function(e,t,n){"use strict";(function(r){const i=n(12),o=n(43),s=n(37),a=n(72),u=n(5);function l(){return(~~(1e9*Math.random())).toString(36)}function c(e,t){i(o(r.isBuffer(e)?[e]:[r.from(e)]),a.encode(),s((e,n)=>{if(e)return t(e);t(null,n[0])}))}function f(e){const t=l();function n(e){return n=>{Array.isArray(n)&&(n=n.join(" ")),e("(%s) %s",t,n)}}const r=n(u("mss:"+e));return r.error=n(u("mss:"+e+":error")),r}t=e.exports,t.writeEncoded=((e,t,n)=>{c(t,(t,r)=>{if(t)return n(t);e.write(r)})}),t.log={},t.log.dialer=(()=>f("dialer\t")),t.log.listener=(()=>f("listener\t"))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";t.importer=t.Importer=n(550),t.exporter=t.Exporter=n(123)},function(e,t,n){var r=n(1216);function i(e,t){return(e=e||[]).push(t),e}e.exports=function(e,t,n,o){var s,a,u;function l(i){var c=null,f=!1,h=0;if(u=i,s)return i(!!s.abort||s,function(e){o(e),a&&a()});var p=!1,d=r(function(){p||s||(p=!0,i(null,function(e,r){p=!1,function(e,r){s||(s=e,s?f||o(!0===s?null:s):(c=t(c,r),h=c&&c.length||0,null!=c&&m(),h{let l=a.cidVersion||i,c=a.hashAlg||o,f=a.codec||s;if(t.isBuffer(e)&&(l=1,f="raw"),"sha2-256"!==c&&(l=1),a.onlyHash)return r(e,{version:l,hashAlg:c},(t,n)=>{u(t,{cid:n,node:e})});n.put(e,{version:l,hashAlg:c,format:f},(t,n)=>{u(t,{cid:n,node:e})})};e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(1231),i=n(229),o=n(11),s=n(38),a=n(48),u=s.DAGLink,l=s.DAGNode,c=n(58),f=n(341),h=n(262),p=n(1232),d=n(12),m=n(406),g=n(90),y=n(1235),b=function(e){return new Promise((n,r)=>{c(e,"murmur3-128",(e,i)=>{if(e)r(e);else{const e=i.slice(2,10),r=e.length,o=t.alloc(r);for(let t=0;t{e(t.key,t.value,n)}),m(t))}flush(e,t,n,r){k(this._options,this._bucket,e,t,n,(e,t)=>{if(e)return r(e);this.multihash=t.cid.buffer,this.size=t.node.size,r(null,t)})}}function _(e,t){return new w(e,t)}function k(e,n,s,c,f,p){const d=n._children;let m=0;const g=[];function b(t,n,i){const o=r(n.toString(16).toUpperCase(),2,"0");if(y.isBucket(t))k(e,t,s,c,null,(e,{cid:t,node:n})=>{e?i(e):(g.push(new u(o,n.size,t)),i())});else{const e=t.value,n=o+t.key;g.push(new u(n,e.size,e.multihash)),i()}}function v(r,i){const u=t.from(d.bitField().reverse()),p=new a("hamt-sharded-directory",u);p.fanout=n.tableSize(),p.hashType=e.hashFn.code,o([e=>l.create(p.marshal(),r,e),(t,n)=>h(t,c,e,n),({cid:e,node:t},n)=>{const r={path:s,size:t.size,multihash:e.buffer};f&&f.push(r),n(null,{cid:e,node:t})}],i)}i(()=>m{const t=d.get(m);t?b(t,m,t=>{m++,e(t)}):(m++,e())},e=>{e?p(e):v(g,p)})}e.exports=_,e.exports.hashFn=b}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(e){const r=n(9);function i(e){const t={},n=e.split("-");switch(n.length){case 1:t.avgChunkSize=262144;break;case 2:t.avgChunkSize=o(n[1],"avg");break;case 4:t.minChunkSize=o(n[1],"min"),t.avgChunkSize=o(n[2],"avg"),t.maxChunkSize=o(n[3],"max");break;default:throw new Error('Incorrect chunker format (expected "rabin" "rabin-[avg]" or "rabin-[min]-[avg]-[max]"')}return t}function o(e,t){let n=parseInt(e);if(isNaN(n))throw new Error(`Chunker parameter ${t} must be an integer`);return n}t.normalizePath=(t=>e.isBuffer(t)?new r(t).toString():r.isCID(t)?t.toString():(0===t.indexOf("/ipfs/")&&(t=t.substring("/ipfs/".length)),"/"===t.charAt(t.length-1)&&(t=t.substring(0,t.length-1)),t)),t.parseChunkerString=(e=>{if(e){if(e.startsWith("size-")){const t=e.split("-")[1],n=parseInt(t);if(isNaN(n))throw new Error("Chunker parameter size must be an integer");return{chunker:"fixed",chunkerOptions:{maxChunkSize:n}}}if(e.startsWith("rabin"))return{chunker:"rabin",chunkerOptions:i(e)};throw new Error(`Unrecognized chunker option: ${e}`)}return{chunker:"fixed"}})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(33).Key,i={file:0,directory:1,"hamt-sharded-directory":1};e.exports={FILE_SEPARATOR:"/",MFS_ROOT_KEY:new r("/local/filesroot"),MAX_CHUNK_SIZE:262144,MAX_LINKS:174,FILE_TYPES:i}},function(e,t,n){"use strict";var r=n(1269),i="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-",o,s,a;function u(){a=!1}function l(e){if(e){if(e!==o){if(e.length!==i.length)throw new Error("Custom alphabet for shortid must be "+i.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter(function(e,t,n){return t!==n.lastIndexOf(e)});if(t.length)throw new Error("Custom alphabet for shortid must be "+i.length+" unique characters. These characters were not unique: "+t.join(", "));o=e,u()}}else o!==i&&(o=i,u())}function c(e){return l(e),o}function f(e){r.seed(e),s!==e&&(u(),s=e)}function h(){o||l(i);for(var e=o.split(""),t=[],n=r.nextValue(),s;e.length>0;)n=r.nextValue(),s=Math.floor(n*e.length),t.push(e.splice(s,1)[0]);return t.join("")}function p(){return a||(a=h(),a)}function d(e){var t=p();return t[e]}function m(){return o||i}e.exports={get:m,characters:c,seed:f,lookup:d,shuffled:p}},function(e,t,n){"use strict";const r=n(48).unmarshal,{formatCid:i,toMfsPath:o,loadNode:s}=n(82),a=n(11),u=n(12),l=n(37),c=n(90),f=n(123),h=n(9),p=n(5)("ipfs:mfs:stat"),d={hash:!1,size:!1,withLocal:!1,cidBase:"base58btc"};e.exports=(e=>(function t(n,m,g){"function"==typeof m&&(g=m,m={}),m=Object.assign({},d,m),p(`Fetching stats for ${n}`),a([t=>o(e,n,t),({mfsPath:t,depth:o},a)=>{u(f(t,e.ipld,{maxDepth:o}),c((t,n)=>m.hash?n(null,{hash:i(new h(t.hash),m.cidBase)}):m.size?n(null,{size:t.size}):void s(e,{cid:t.hash},(e,t)=>{if(e)return n(e);const{node:o,cid:s}=t,a=r(o.data);let u=o.links.length;"file"===a.type&&(u=a.blockSizes.length),n(null,{hash:i(s,m.cidBase),size:a.fileSize()||0,cumulativeSize:o.size,blocks:u,type:a.type,local:void 0,sizeLocal:void 0,withLocality:!1})})),l((e,t)=>e?a(e):t.length?(p(`Stats for ${n}`,t[0]),a(null,t[0])):a(new Error(`${n} does not exist`))))}],g)}))},function(e,t,n){"use strict";var r=t;r.base=n(1332),r.short=n(1333),r.mont=n(1334),r.edwards=n(1335)},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=n(1388),o=n(1394),s=n(18),a=n(193),u=n(63),l=n(143),c=n(4).Buffer;Object.assign(t,n(1396)),t.MAX_INTEGER=new u("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new u("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.SHA3_NULL_S=t.KECCAK256_NULL_S,t.KECCAK256_NULL=c.from(t.KECCAK256_NULL_S,"hex"),t.SHA3_NULL=t.KECCAK256_NULL,t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.SHA3_RLP_ARRAY_S=t.KECCAK256_RLP_ARRAY_S,t.KECCAK256_RLP_ARRAY=c.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.SHA3_RLP_ARRAY=t.KECCAK256_RLP_ARRAY,t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.SHA3_RLP_S=t.KECCAK256_RLP_S,t.KECCAK256_RLP=c.from(t.KECCAK256_RLP_S,"hex"),t.SHA3_RLP=t.KECCAK256_RLP,t.BN=u,t.rlp=a,t.secp256k1=o,t.zeros=function(e){return c.allocUnsafe(e).fill(0)},t.zeroAddress=function(){var e=20,n=t.zeros(20);return t.bufferToHex(n)},t.setLengthLeft=t.setLength=function(e,n,r){var i=t.zeros(n);return e=t.toBuffer(e),r?e.length0&&"0"===n.toString();)e=e.slice(1),n=e[0];return e},t.toBuffer=function(e){if(!c.isBuffer(e))if(Array.isArray(e))e=c.from(e);else if("string"==typeof e)e=t.isHexString(e)?c.from(t.padToEven(t.stripHexPrefix(e)),"hex"):c.from(e);else if("number"==typeof e)e=t.intToBuffer(e);else if(null===e||void 0===e)e=c.allocUnsafe(0);else if(u.isBN(e))e=e.toArrayLike(c);else{if(!e.toArray)throw new Error("invalid type");e=c.from(e.toArray())}return e},t.bufferToInt=function(e){return new u(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return e=t.toBuffer(e),"0x"+e.toString("hex")},t.fromSigned=function(e){return new u(e).fromTwos(256)},t.toUnsigned=function(e){return c.from(e.toTwos(256).toArray())},t.keccak=function(e,n){return e=t.toBuffer(e),n||(n=256),i("keccak"+n).update(e).digest()},t.keccak256=function(e){return t.keccak(e)},t.sha3=t.keccak,t.sha256=function(e){return e=t.toBuffer(e),l("sha256").update(e).digest()},t.ripemd160=function(e,n){e=t.toBuffer(e);var r=l("rmd160").update(e).digest();return!0===n?t.setLength(r,32):r},t.rlphash=function(e){return t.keccak(a.encode(e))},t.isValidPrivate=function(e){return o.privateKeyVerify(e)},t.isValidPublic=function(e,t){return 64===e.length?o.publicKeyVerify(c.concat([c.from([4]),e])):!!t&&o.publicKeyVerify(e)},t.pubToAddress=t.publicToAddress=function(e,n){return e=t.toBuffer(e),n&&64!==e.length&&(e=o.publicKeyConvert(e,!1).slice(1)),s(64===e.length),t.keccak(e).slice(-20)};var f=t.privateToPublic=function(e){return e=t.toBuffer(e),o.publicKeyCreate(e,!1).slice(1)};t.importPublic=function(e){return e=t.toBuffer(e),64!==e.length&&(e=o.publicKeyConvert(e,!1).slice(1)),e},t.ecsign=function(e,t){var n=o.sign(e,t),r={};return r.r=n.signature.slice(0,32),r.s=n.signature.slice(32,64),r.v=n.recovery+27,r},t.hashPersonalMessage=function(e){var n=t.toBuffer("Ethereum Signed Message:\n"+e.length.toString());return t.keccak(c.concat([n,e]))},t.ecrecover=function(e,n,r,i){var s=c.concat([t.setLength(r,32),t.setLength(i,32)],64),a=n-27;if(0!==a&&1!==a)throw new Error("Invalid signature v value");var u=o.recover(e,s,a);return o.publicKeyConvert(u,!1).slice(1)},t.toRpcSig=function(e,n,r){if(27!==e&&28!==e)throw new Error("Invalid recovery id");return t.bufferToHex(c.concat([t.setLengthLeft(n,32),t.setLengthLeft(r,32),t.toBuffer(e-27)]))},t.fromRpcSig=function(e){if(e=t.toBuffer(e),65!==e.length)throw new Error("Invalid signature length");var n=e[64];return n<27&&(n+=27),{v:n,r:e.slice(0,32),s:e.slice(32,64)}},t.privateToAddress=function(e){return t.publicToAddress(f(e))},t.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/.test(e)},t.isZeroAddress=function(e){var n=t.zeroAddress();return n===t.addHexPrefix(e)},t.toChecksumAddress=function(e){e=t.stripHexPrefix(e).toLowerCase();for(var n=t.keccak(e).toString("hex"),r="0x",i=0;i=8?r+=e[i].toUpperCase():r+=e[i];return r},t.isValidChecksumAddress=function(e){return t.isValidAddress(e)&&t.toChecksumAddress(e)===e},t.generateAddress=function(e,n){return e=t.toBuffer(e),n=new u(n),n=n.isZero()?null:c.from(n.toArray()),t.rlphash([e,n]).slice(-20)},t.isPrecompiled=function(e){var n=t.unpad(e);return 1===n.length&&n[0]>=1&&n[0]<=8},t.addHexPrefix=function(e){return"string"!=typeof e?e:t.isHexPrefixed(e)?e:"0x"+e},t.isValidSignature=function(e,t,n,r){var i=new u("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),o=new u("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);return 32===t.length&&32===n.length&&((27===e||28===e)&&(t=new u(t),n=new u(n),!(t.isZero()||t.gt(o)||n.isZero()||n.gt(o))&&(!1!==r||1!==new u(n).cmp(i))))},t.baToJSON=function(e){if(c.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var n=[],r=0;r=i.length,"The field "+n.name+" must not have more "+n.length+" bytes")):n.allowZero&&0===i.length||!n.length||s(n.length===i.length,"The field "+n.name+" must have byte length of "+n.length),e.raw[r]=i}e._fields.push(n.name),Object.defineProperty(e,n.name,{enumerable:!0,configurable:!0,get:i,set:o}),n.default&&(e[n.name]=n.default),n.alias&&Object.defineProperty(e,n.alias,{enumerable:!1,configurable:!0,set:o,get:i})}),i)if("string"==typeof i&&(i=c.from(t.stripHexPrefix(i),"hex")),c.isBuffer(i)&&(i=a.decode(i)),Array.isArray(i)){if(i.length>e._fields.length)throw new Error("wrong number of fields in data");i.forEach(function(n,r){e[e._fields[r]]=t.toBuffer(n)})}else{if("object"!==(void 0===i?"undefined":r(i)))throw new Error("invalid data");var o=Object.keys(i);n.forEach(function(t){-1!==o.indexOf(t.name)&&(e[t.name]=i[t.name]),-1!==o.indexOf(t.alias)&&(e[t.alias]=i[t.alias])})}}},function(e,t,n){"use strict";const r=n(271).SmartBuffer,i=n(403),o=n(1426),s=n(35),a=n(9);t=e.exports,t.SHA1_LENGTH=i.defaultLengths[i.names.sha1],t.find=((e,t)=>{for(let n=0;n{let t=e.match(/^(([^<]+)\s)?\s?<([^>]+)>\s?(\d+\s[+\-\d]+)?$/);return null===t?null:{name:t[2],email:t[3],date:t[4]}}),t.serializePersonLine=(e=>{let t=[];return e.name&&t.push(e.name),t.push("<"+e.email+">"),e.date&&t.push(e.date),t.join(" ")}),t.shaToCid=(e=>{let n=new r;return n.writeUInt8(1),n.writeBuffer(o["git-raw"]),n.writeUInt8(i.names.sha1),n.writeUInt8(t.SHA1_LENGTH),n.writeBuffer(e),n.toBuffer()}),t.cidToSha=(e=>{let t=s.decode(new a(e).multihash);return"sha1"!==t.name?null:t.digest})},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const r=n(1425),i=4096,o="utf8";class s{constructor(t){if(this.length=0,this._encoding=o,this._writeOffset=0,this._readOffset=0,s.isSmartBufferOptions(t))if(t.encoding&&(r.checkEncoding(t.encoding),this._encoding=t.encoding),t.size){if(!(r.isFiniteInteger(t.size)&&t.size>0))throw new Error(r.ERRORS.INVALID_SMARTBUFFER_SIZE);this._buff=e.allocUnsafe(t.size)}else if(t.buff){if(!(t.buff instanceof e))throw new Error(r.ERRORS.INVALID_SMARTBUFFER_BUFFER);this._buff=t.buff,this.length=t.buff.length}else this._buff=e.allocUnsafe(i);else{if(void 0!==t)throw new Error(r.ERRORS.INVALID_SMARTBUFFER_OBJECT);this._buff=e.allocUnsafe(i)}}static fromSize(e,t){return new this({size:e,encoding:t})}static fromBuffer(e,t){return new this({buff:e,encoding:t})}static fromOptions(e){return new this(e)}static isSmartBufferOptions(e){const t=e;return t&&(void 0!==t.encoding||void 0!==t.size||void 0!==t.buff)}readInt8(t){return this._readNumberValue(e.prototype.readInt8,1,t)}readInt16BE(t){return this._readNumberValue(e.prototype.readInt16BE,2,t)}readInt16LE(t){return this._readNumberValue(e.prototype.readInt16LE,2,t)}readInt32BE(t){return this._readNumberValue(e.prototype.readInt32BE,4,t)}readInt32LE(t){return this._readNumberValue(e.prototype.readInt32LE,4,t)}writeInt8(t,n){return this._writeNumberValue(e.prototype.writeInt8,1,t,n),this}insertInt8(t,n){return this._insertNumberValue(e.prototype.writeInt8,1,t,n)}writeInt16BE(t,n){return this._writeNumberValue(e.prototype.writeInt16BE,2,t,n)}insertInt16BE(t,n){return this._insertNumberValue(e.prototype.writeInt16BE,2,t,n)}writeInt16LE(t,n){return this._writeNumberValue(e.prototype.writeInt16LE,2,t,n)}insertInt16LE(t,n){return this._insertNumberValue(e.prototype.writeInt16LE,2,t,n)}writeInt32BE(t,n){return this._writeNumberValue(e.prototype.writeInt32BE,4,t,n)}insertInt32BE(t,n){return this._insertNumberValue(e.prototype.writeInt32BE,4,t,n)}writeInt32LE(t,n){return this._writeNumberValue(e.prototype.writeInt32LE,4,t,n)}insertInt32LE(t,n){return this._insertNumberValue(e.prototype.writeInt32LE,4,t,n)}readUInt8(t){return this._readNumberValue(e.prototype.readUInt8,1,t)}readUInt16BE(t){return this._readNumberValue(e.prototype.readUInt16BE,2,t)}readUInt16LE(t){return this._readNumberValue(e.prototype.readUInt16LE,2,t)}readUInt32BE(t){return this._readNumberValue(e.prototype.readUInt32BE,4,t)}readUInt32LE(t){return this._readNumberValue(e.prototype.readUInt32LE,4,t)}writeUInt8(t,n){return this._writeNumberValue(e.prototype.writeUInt8,1,t,n)}insertUInt8(t,n){return this._insertNumberValue(e.prototype.writeUInt8,1,t,n)}writeUInt16BE(t,n){return this._writeNumberValue(e.prototype.writeUInt16BE,2,t,n)}insertUInt16BE(t,n){return this._insertNumberValue(e.prototype.writeUInt16BE,2,t,n)}writeUInt16LE(t,n){return this._writeNumberValue(e.prototype.writeUInt16LE,2,t,n)}insertUInt16LE(t,n){return this._insertNumberValue(e.prototype.writeUInt16LE,2,t,n)}writeUInt32BE(t,n){return this._writeNumberValue(e.prototype.writeUInt32BE,4,t,n)}insertUInt32BE(t,n){return this._insertNumberValue(e.prototype.writeUInt32BE,4,t,n)}writeUInt32LE(t,n){return this._writeNumberValue(e.prototype.writeUInt32LE,4,t,n)}insertUInt32LE(t,n){return this._insertNumberValue(e.prototype.writeUInt32LE,4,t,n)}readFloatBE(t){return this._readNumberValue(e.prototype.readFloatBE,4,t)}readFloatLE(t){return this._readNumberValue(e.prototype.readFloatLE,4,t)}writeFloatBE(t,n){return this._writeNumberValue(e.prototype.writeFloatBE,4,t,n)}insertFloatBE(t,n){return this._insertNumberValue(e.prototype.writeFloatBE,4,t,n)}writeFloatLE(t,n){return this._writeNumberValue(e.prototype.writeFloatLE,4,t,n)}insertFloatLE(t,n){return this._insertNumberValue(e.prototype.writeFloatLE,4,t,n)}readDoubleBE(t){return this._readNumberValue(e.prototype.readDoubleBE,8,t)}readDoubleLE(t){return this._readNumberValue(e.prototype.readDoubleLE,8,t)}writeDoubleBE(t,n){return this._writeNumberValue(e.prototype.writeDoubleBE,8,t,n)}insertDoubleBE(t,n){return this._insertNumberValue(e.prototype.writeDoubleBE,8,t,n)}writeDoubleLE(t,n){return this._writeNumberValue(e.prototype.writeDoubleLE,8,t,n)}insertDoubleLE(t,n){return this._insertNumberValue(e.prototype.writeDoubleLE,8,t,n)}readString(e,t){let n;"number"==typeof e?(r.checkLengthValue(e),n=Math.min(e,this.length-this._readOffset)):(t=e,n=this.length-this._readOffset),void 0!==t&&r.checkEncoding(t);const i=this._buff.slice(this._readOffset,this._readOffset+n).toString(t||this._encoding);return this._readOffset+=n,i}insertString(e,t,n){return r.checkOffsetValue(t),this._handleString(e,!0,t,n)}writeString(e,t,n){return this._handleString(e,!1,t,n)}readStringNT(e){void 0!==e&&r.checkEncoding(e);let t=this.length;for(let e=this._readOffset;ethis.length)throw new Error(r.ERRORS.INVALID_READ_BEYOND_BOUNDS)}ensureInsertable(e,t){r.checkOffsetValue(t),this._ensureCapacity(this.length+e),tthis.length?this.length=t+e:this.length+=e}_ensureWriteable(e,t){const n="number"==typeof t?t:this._writeOffset;this._ensureCapacity(n+e),n+e>this.length&&(this.length=n+e)}_ensureCapacity(t){const n=this._buff.length;if(t>n){let r=this._buff,i=3*n/2+1;i"},e.exports=p}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(599),o=n(0),s="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),a=function e(n){if(!(this instanceof e))return new e(n);if(t.isBuffer(n)){var r=n;this.fromBuffer(r)}else if("string"==typeof n){var i=n;this.fromString(i)}else n&&this.set(n)};a.validCharacters=function e(t){return o.Buffer.isBuffer(t)&&(t=t.toString()),r.all(r.map(t,function(e){return r.contains(s,e)}))},a.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},a.encode=function(e){if(!o.Buffer.isBuffer(e))throw new Error("Input should be a buffer");return i.encode(e)},a.decode=function(e){if("string"!=typeof e)throw new Error("Input should be a string");return new t(i.decode(e))},a.prototype.fromBuffer=function(e){return this.buf=e,this},a.prototype.fromString=function(e){var t=a.decode(e);return this.buf=t,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){e.exports=n(359),e.exports.Input=n(360),e.exports.Output=n(111),e.exports.UnspentOutput=n(601),e.exports.Signature=n(199),e.exports.Sighash=n(110)},function(e,t,n){"use strict";(function(t,r){function i(){}i.getRandomBuffer=function(e){return t.browser?i.getRandomBufferBrowser(e):i.getRandomBufferNode(e)},i.getRandomBufferNode=function(e){var t=n(15);return t.randomBytes(e)},i.getRandomBufferBrowser=function(e){if(!window.crypto&&!window.msCrypto)throw new Error("window.crypto not available");if(window.crypto&&window.crypto.getRandomValues)var t=window.crypto;else{if(!window.msCrypto||!window.msCrypto.getRandomValues)throw new Error("window.crypto.getRandomValues not available");var t=window.msCrypto}var n=new Uint8Array(e);t.getRandomValues(n);var i=new r(n);return i},i.getPseudoRandomBuffer=function(e){for(var t=4294967296,n=new r(e),i,o=0;o<=e;o++){var s=Math.floor(o/4),a=o-4*s;0===a?(i=Math.random()*t,n[o]=255&i):n[o]=255&(i>>>=8)}return n},e.exports=i}).call(this,n(2),n(0).Buffer)},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(49),o=n(30),s=n(109),a=n(80),u=n(60),l=n(41),c=n(25),f=537133055,h=function e(t){if(!(this instanceof e))return new e(t);var n=e._from(t);return this.version=n.version,this.prevHash=n.prevHash,this.merkleRoot=n.merkleRoot,this.reserved=n.reserved,this.time=n.time,this.timestamp=n.time,this.bits=n.bits,this.nonce=n.nonce,this.solution=n.solution,n.hash&&c.checkState(this.hash===n.hash,"Argument object hash property does not match block hash."),this};h._from=function e(t){var n={};if(o.isBuffer(t))n=h._fromBufferReader(s(t));else{if(!r.isObject(t))throw new TypeError("Unrecognized argument for BlockHeader");n=h._fromObject(t)}return n},h._fromObject=function e(n){c.checkArgument(n,"data is required");var i=n.prevHash,s=n.merkleRoot,a=n.reserved,u=n.nonce,l=n.solution;r.isString(n.prevHash)&&(i=o.reverse(new t(n.prevHash,"hex"))),r.isString(n.merkleRoot)&&(s=o.reverse(new t(n.merkleRoot,"hex"))),r.isString(n.reserved)&&(a=o.reverse(new t(n.reserved,"hex"))),r.isString(n.nonce)&&(u=o.reverse(new t(n.nonce,"hex"))),r.isString(n.solution)&&(l=new t(n.solution,"hex"));var f={hash:n.hash,version:n.version,prevHash:i,merkleRoot:s,reserved:a,time:n.time,timestamp:n.time,bits:n.bits,nonce:u,solution:l};return f},h.fromObject=function e(t){var n=h._fromObject(t);return new h(n)},h.fromRawBlock=function e(n){o.isBuffer(n)||(n=new t(n,"binary"));var r=s(n);r.pos=h.Constants.START_OF_HEADER;var i=h._fromBufferReader(r);return new h(i)},h.fromBuffer=function e(t){var n=h._fromBufferReader(s(t));return new h(n)},h.fromString=function e(n){var r=new t(n,"hex");return h.fromBuffer(r)},h._fromBufferReader=function e(t){var n={};n.version=t.readUInt32LE(),n.prevHash=t.read(32),n.merkleRoot=t.read(32),n.reserved=t.read(32),n.time=t.readUInt32LE(),n.bits=t.readUInt32LE(),n.nonce=t.read(32);var r=t.readVarintNum();return n.solution=t.read(r),n},h.fromBufferReader=function e(t){var n=h._fromBufferReader(t);return new h(n)},h.prototype.toObject=h.prototype.toJSON=function e(){return{hash:this.hash,version:this.version,prevHash:o.reverse(this.prevHash).toString("hex"),merkleRoot:o.reverse(this.merkleRoot).toString("hex"),reserved:o.reverse(this.reserved).toString("hex"),time:this.time,bits:this.bits,nonce:o.reverse(this.nonce).toString("hex"),solution:this.solution.toString("hex")}},h.prototype.toBuffer=function e(){return this.toBufferWriter().concat()},h.prototype.toString=function e(){return this.toBuffer().toString("hex")},h.prototype.toBufferWriter=function e(t){return t||(t=new a),t.writeUInt32LE(this.version),t.write(this.prevHash),t.write(this.merkleRoot),t.write(this.reserved),t.writeUInt32LE(this.time),t.writeUInt32LE(this.bits),t.write(this.nonce),t.writeVarintNum(this.solution.length),t.write(this.solution),t},h.prototype.getTargetDifficulty=function e(t){t=t||this.bits;for(var n=new i(16777215&t),r=8*((t>>>24)-3);r-- >0;)n=n.mul(new i(2));return n},h.prototype.getDifficulty=function e(){var t=this.getTargetDifficulty(537133055).mul(new i(Math.pow(10,8))),n=this.getTargetDifficulty(),r=t.div(n).toString(10),o=r.length-8;return r=r.slice(0,o)+"."+r.slice(o),parseFloat(r)},h.prototype._getHash=function e(){var t=this.toBuffer();return u.sha256sha256(t)};var p={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=s(this._getHash()).readReverse().toString("hex")),this._id},set:r.noop};Object.defineProperty(h.prototype,"id",p),Object.defineProperty(h.prototype,"hash",p),h.prototype.validTimestamp=function e(){var t=Math.round((new Date).getTime()/1e3);return!(this.time>t+h.Constants.MAX_TIME_OFFSET)},h.prototype.validProofOfWork=function e(){var t=new i(this.id,"hex"),n=this.getTargetDifficulty();return!(t.cmp(n)>0)},h.prototype.inspect=function e(){return""},h.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new i("10000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=h}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var n=Object.prototype.toString,r="function"==typeof t.alloc&&"function"==typeof t.allocUnsafe&&"function"==typeof t.from;function i(e){return"ArrayBuffer"===n.call(e).slice(8,-1)}function o(e,n,i){n>>>=0;var o=e.byteLength-n;if(o<0)throw new RangeError("'offset' is out of bounds");if(void 0===i)i=o;else if(i>>>=0,i>o)throw new RangeError("'length' is out of bounds");return r?t.from(e.slice(n,n+i)):new t(new Uint8Array(e.slice(n,n+i)))}function s(e,n){if("string"==typeof n&&""!==n||(n="utf8"),!t.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');return r?t.from(e,n):new t(e,n)}function a(e,n,a){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return i(e)?o(e,n,a):"string"==typeof e?s(e,n):r?t.from(e):new t(e)}e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){t=e.exports=n(628),t.Stream=t,t.Readable=t,t.Writable=n(631),t.Duplex=n(157),t.Transform=n(632),t.PassThrough=n(1502)},function(e,t,n){var r=e.exports;r.encode=n(1726),r.decode=n(1727),r.byteLength=r.encodingLength=function(e){return r.encode(e).length}},function(e,t,n){"use strict";function r(e,t){for(var n=1,r=e.length,i=e[0],o=e[0],s=1;s>3;return e%8!=0&&t++,t}r.prototype.get=function(e){var t=e>>3;return t>e%8)},r.prototype.set=function(e,t){var n=e>>3;t||1===arguments.length?(this.buffer.length>e%8):n>e%8))},r.prototype._grow=function(e){if(this.buffer.length4294967295&&(o=1),t.writeUInt32BE(o,n),t.write(e.type,n+4,4,"ascii");var a=n+8;if(1===o&&(r.encode(e.length,t,a),a+=8),s.fullBoxes[i]&&(t.writeUInt32BE(e.flags||0,a),t.writeUInt8(e.version||0,a),a+=4),l[i]){var c=l[i];c.forEach(function(n){if(5===n.length){var r=e[n]||[];n=n.substr(0,4),r.forEach(function(e){u._encode(e,t,a),a+=u.encode.bytes})}else e[n]&&(u._encode(e[n],t,a),a+=u.encode.bytes)}),e.otherBoxes&&e.otherBoxes.forEach(function(e){u._encode(e,t,a),a+=u.encode.bytes})}else if(s[i]){var f=s[i].encode;f(e,t,a),a+=f.bytes}else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+i+"') or `buffer` must be set");var h=e.buffer;h.copy(t,a),a+=e.buffer.length}return u.encode.bytes=a-n,t},u.readHeaders=function(e,t,n){if(t=t||0,n=n||e.length,n-t<8)return 8;var i=e.readUInt32BE(t),o=e.toString("ascii",t+4,t+8),a=t+8,u,l;if(1===i){if(n-t<16)return 16;i=r.decode(e,a),a+=8}return s.fullBoxes[o]&&(u=e.readUInt8(a),l=16777215&e.readUInt32BE(a),a+=4),{length:i,headersLen:a-t,contentLen:i-(a-t),type:o,version:u,flags:l}},u.decode=function(e,t,n){t=t||0,n=n||e.length;var r=u.readHeaders(e,t,n);if(!r||r.length>n-t)throw new Error("Data too short");return u.decodeWithoutHeaders(r,e,t+r.headersLen,t+r.length)},u.decodeWithoutHeaders=function(e,t,n,r){n=n||0,r=r||t.length;var i=e.type,a={};if(l[i]){a.otherBoxes=[];for(var c=l[i],f=n;r-f>=8;){var h=u.decode(t,f,r);if(f+=h.length,c.indexOf(h.type)>=0)a[h.type]=h;else if(c.indexOf(h.type+"s")>=0){var p=h.type+"s",d=a[p]=a[p]||[];d.push(h)}else a.otherBoxes.push(h)}}else if(s[i]){var m=s[i].decode;a=m(t,n,r)}else a.buffer=o(t.slice(n,r));return a.length=e.length,a.contentLen=e.contentLen,a.type=e.type,a.version=e.version,a.flags=e.flags,a},u.encodingLength=function(e){var t=e.type,n=8;if(s.fullBoxes[t]&&(n+=4),l[t]){var r=l[t];r.forEach(function(t){if(5===t.length){var r=e[t]||[];t=t.substr(0,4),r.forEach(function(e){e.type=t,n+=u.encodingLength(e)})}else if(e[t]){var i=e[t];i.type=t,n+=u.encodingLength(i)}}),e.otherBoxes&&e.otherBoxes.forEach(function(e){n+=u.encodingLength(e)})}else if(s[t])n+=s[t].encodingLength(e);else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+t+"') or `buffer` must be set");n+=e.buffer.length}return n>4294967295&&(n+=8),e.length=n,n}},function(e,t,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)i(n,r)&&(e[r]=n[r])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var o={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var o=0;o0;--s){o=o.twice();var a=n.testBit(s),u=t.testBit(s);a!=u&&(o=o.add(a?this:i))}return o}function S(e,t,n){var r;r=e.bitLength()>n.bitLength()?e.bitLength()-1:n.bitLength()-1;for(var i=this.curve.getInfinity(),o=this.add(t);r>=0;)i=i.twice(),e.testBit(r)?i=n.testBit(r)?i.add(o):i.add(this):n.testBit(r)&&(i=i.add(t)),--r;return i}function E(e,t,n){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(n),this.infinity=new d(this,null,null),this.reducer=new i(this.q)}function x(){return this.q}function C(){return this.a}function A(){return this.b}function I(e){return e==this||this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)}function T(){return this.infinity}function j(e){return new o(this.q,e)}function O(e){this.reducer.reduce(e)}function P(e){switch(parseInt(e.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var t=(e.length-2)/2,n=e.substr(2,t),i=e.substr(t+2,t);return new d(this,this.fromBigInteger(new r(n,16)),this.fromBigInteger(new r(i,16)));default:return null}}function B(e){if(e.isInfinity())return"00";var t=e.getX().toBigInteger().toString(16),n=e.getY().toBigInteger().toString(16),r=this.getQ().toString(16).length;for(r%2!=0&&r++;t.length128){var t=this.q.shiftRight(e-64);-1==t.intValue()&&(this.r=r.ONE.shiftLeft(e).subtract(this.q))}return this.r},o.prototype.modMult=function(e,t){return this.modReduce(e.multiply(t))},o.prototype.modReduce=function(e){if(null!=this.getR()){for(var t=q.bitLength();e.bitLength()>t+1;){var n=e.shiftRight(t),i=e.subtract(n.shiftLeft(t));this.getR().equals(r.ONE)||(n=n.multiply(this.getR())),e=n.add(i)}for(;e.compareTo(q)>=0;)e=e.subtract(q)}else e=e.mod(q);return e},o.prototype.sqrt=function(){if(!this.q.testBit(0))throw"unsupported";if(this.q.testBit(1)){var e=new o(this.q,this.x.modPow(this.q.shiftRight(2).add(r.ONE),this.q));return e.square().equals(this)?e:null}var t=this.q.subtract(r.ONE),n=t.shiftRight(1);if(!this.x.modPow(n,this.q).equals(r.ONE))return null;var i=t.shiftRight(2),s=i.shiftLeft(1).add(r.ONE),a=this.x,u=modDouble(modDouble(a)),l,c;do{var f;do{f=new r(this.q.bitLength(),new SecureRandom)}while(f.compareTo(this.q)>=0||!f.multiply(f).subtract(u).modPow(n,this.q).equals(t));var h=this.lucasSequence(f,a,s);if(l=h[0],c=h[1],this.modMult(c,c).equals(u))return c.testBit(0)&&(c=c.add(q)),c=c.shiftRight(1),new o(q,c)}while(l.equals(r.ONE)||l.equals(t));return null},o.prototype.lucasSequence=function(e,t,n){for(var i=n.bitLength(),o=n.getLowestSetBit(),s=r.ONE,a=r.TWO,u=e,l=r.ONE,c=r.ONE,f=i-1;f>=o+1;--f)l=this.modMult(l,c),n.testBit(f)?(c=this.modMult(l,t),s=this.modMult(s,u),a=this.modReduce(u.multiply(a).subtract(e.multiply(l))),u=this.modReduce(u.multiply(u).subtract(c.shiftLeft(1)))):(c=l,s=this.modReduce(s.multiply(a).subtract(l)),u=this.modReduce(u.multiply(a).subtract(e.multiply(l))),a=this.modReduce(a.multiply(a).subtract(l.shiftLeft(1))));l=this.modMult(l,c),c=this.modMult(l,t),s=this.modReduce(s.multiply(a).subtract(l)),a=this.modReduce(u.multiply(a).subtract(e.multiply(l))),l=this.modMult(l,c);for(var f=1;f<=o;++f)s=this.modMult(s,a),a=this.modReduce(a.multiply(a).subtract(l.shiftLeft(1))),l=this.modMult(l,l);return[s,a]};var t={ECCurveFp:E,ECPointFp:d,ECFieldElementFp:o};e.exports=t},function(e,t,n){e.exports={read:g,readSSHPrivate:b,write:v};var r=n(27),i=n(103),o=n(31).Buffer,s=n(55),a=n(47),u=n(15),l=n(46),c=n(50),f=n(113),h=n(114),p=n(210),d=n(97),m;function g(e,t){return f.read(e,t)}var y="openssh-key-v1";function b(e,t,i){t=new p({buffer:t});var s=t.readCString();r.strictEqual(s,y,"bad magic string");var l=t.readString(),c=t.readString(),f=t.readBuffer(),g=t.readInt();if(1!==g)throw new Error("OpenSSH-format key file contains multiple keys: this is unsupported.");var b=t.readBuffer();if("public"===e)return r.ok(t.atEnd(),"excess bytes left after key"),h.read(b);var v=t.readBuffer();r.ok(t.atEnd(),"excess bytes left after key");var w=new p({buffer:f});switch(c){case"none":if("none"!==l)throw new Error('OpenSSH-format key uses KDF "none" but specifies a cipher other than "none"');break;case"bcrypt":var _=w.readBuffer(),k=w.readInt(),S=a.opensshCipherInfo(l);if(void 0===m&&(m=n(714)),"string"==typeof i.passphrase&&(i.passphrase=o.from(i.passphrase,"utf-8")),!o.isBuffer(i.passphrase))throw new d.KeyEncryptedError(i.filename,"OpenSSH");var E=new Uint8Array(i.passphrase),x=new Uint8Array(_),C=new Uint8Array(S.keySize+S.blockSize),A=m.pbkdf(E,E.length,x,x.length,C,C.length,k);if(0!==A)throw new Error("bcrypt_pbkdf function returned failure, parameters invalid");C=o.from(C);var I=C.slice(0,S.keySize),T=C.slice(S.keySize,S.keySize+S.blockSize),j=u.createDecipheriv(S.opensslName,I,T);j.setAutoPadding(!1);var O,P=[];for(j.once("error",function(e){if(-1!==e.toString().indexOf("bad decrypt"))throw new Error("Incorrect passphrase supplied, could not decrypt key");throw e}),j.write(v),j.end();null!==(O=j.read());)P.push(O);v=o.concat(P);break;default:throw new Error('OpenSSH-format key uses unknown KDF "'+c+'"')}t=new p({buffer:v});var B=t.readInt(),R=t.readInt();if(B!==R)throw new Error("Incorrect passphrase supplied, could not decrypt key");var N={},M=h.readInternal(N,"private",t.remainder());t.skip(N.consumed);var L=t.readString();return M.comment=L,M}function v(e,t){var i;i=c.isPrivateKey(e)?e.toPublic():e;var s="none",l="none",f=o.alloc(0),h={blockSize:8},d,g;if(void 0!==t&&(d=t.passphrase,"string"==typeof d&&(d=o.from(d,"utf-8")),void 0!==d&&(r.buffer(d,"options.passphrase"),r.optionalString(t.cipher,"options.cipher"),s=t.cipher,void 0===s&&(s="aes128-ctr"),h=a.opensshCipherInfo(s),l="bcrypt")),c.isPrivateKey(e)){g=new p({});var b=u.randomBytes(4).readUInt32BE(0);g.writeInt(b),g.writeInt(b),g.write(e.toBuffer("rfc4253")),g.writeString(e.comment||"");for(var v=1;g._offset%h.blockSize!=0;)g.writeChar(v++);g=g.toBuffer()}switch(l){case"none":break;case"bcrypt":var w=u.randomBytes(16),_=16,k=new p({});k.writeBuffer(w),k.writeInt(16),f=k.toBuffer(),void 0===m&&(m=n(714));var S=new Uint8Array(d),E=new Uint8Array(w),x=new Uint8Array(h.keySize+h.blockSize),C=m.pbkdf(S,S.length,E,E.length,x,x.length,16);if(0!==C)throw new Error("bcrypt_pbkdf function returned failure, parameters invalid");x=o.from(x);var A=x.slice(0,h.keySize),I=x.slice(h.keySize,h.keySize+h.blockSize),T=u.createCipheriv(h.opensslName,A,I);T.setAutoPadding(!1);var j,O=[];for(T.once("error",function(e){throw e}),T.write(g),T.end();null!==(j=T.read());)O.push(j);g=o.concat(O);break;default:throw new Error("Unsupported kdf "+l)}var P=new p({}),B;P.writeCString(y),P.writeString(s),P.writeString(l),P.writeBuffer(f),P.writeInt(1),P.writeBuffer(i.toBuffer("rfc4253")),g&&P.writeBuffer(g),P=P.toBuffer(),B=c.isPrivateKey(e)?"OPENSSH PRIVATE KEY":"OPENSSH PUBLIC KEY";var R=P.toString("base64"),N=R.length+R.length/70+18+16+2*B.length+10;P=o.alloc(N);var M=0;M+=P.write("-----BEGIN "+B+"-----\n",M);for(var L=0;LR.length&&(F=R.length),M+=P.write(R.slice(L,F),M),P[M++]=10,L=F}return M+=P.write("-----END "+B+"-----\n",M),P.slice(0,M)}},function(e,t,n){e.exports={DataError:n(1966),InvalidAccessError:n(1967),KeyFormatNotSupportedError:n(1968),CurrentlyNotSupportedError:n(1969),NotSupportedError:n(386),OperationError:n(1970),QuotaExceededError:n(1971),TypeMismatchError:n(1972)}},function(e,t,n){(function(r){const i=n(743),o=n(98),s=n(5)("dweb-transports:httptools"),a=n(171);let u;function l({concurrency:e}){u=a((e,t)=>{e.loopguard===("undefined"!=typeof window&&window.loopguard)?fetch(e.req).then(n=>{s("Fetch of %s succeeded",e.what),u.concurrency=Math.min(u.concurrency+1,u.running()+6),t(null),e.cb(null,n)}).catch(n=>{u.concurrency=Math.max(u.concurrency-1,6,u.running()-1),t(n),--e.count>0?(s("Retrying fetch of %s in %s ms: %s",e.what,e.ms,n.message),u.push(e)):(s("Requeued fetch of %s failed: %s",e.what,n.message),e.cb(n))}):s("Dropping fetch of %s as window changed from %s to %s",e.what,e.loopguard,window.loopguard)},e)}function c(e,t,n,r){return new Promise((i,o)=>{n=n||1,u.push({req:e,count:n,ms:t,what:r,loopguard:"undefined"!=typeof window&&window.loopguard,cb:(e,t)=>{e?o(e):i(t)}})})}async function f(e,t,n,r){let i,o="undefined"!=typeof window&&window.loopguard;for(n=n||1;n--&&o===("undefined"!=typeof window&&window.loopguard);)try{return await fetch(e)}catch(e){i=e,s("Delaying %s by %d ms because %s",r,t,e.message),await new Promise(e=>{setTimeout(()=>{e()},t)}),t=Math.floor(t*(1+Math.random()))}throw console.warn("loopfetch of",r,"failed"),o!==("undefined"!=typeof window&&window.loopguard)?(s("Looping exited because of page change %s",r),new Error("Looping exited because of page change "+r)):i}"undefined"==typeof fetch&&(fetch=i,Headers=fetch.Headers,Request=fetch.Request),httptools={},l({concurrency:6}),httptools.p_httpfetch=async function(e,t,{wantstream:n=!1,retries:i}={}){try{s("p_httpfetch: %s %o",e,t.headers.range||"");let a=new Request(e,t),u=await c(a,500,i,"fetching "+e);if(u.ok){let e=u.headers.get("Content-Type");return n?u.body:void 0!==e&&e.startsWith("application/json")?u.json():void 0!==e&&e.startsWith("text")?u.text():new r(await u.arrayBuffer())}throw new o.TransportError(`Transport Error ${e} ${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={},n){"function"==typeof t&&(n=t,t={});let r=new Headers;(t.start||t.end)&&r.append("range",`bytes=${t.start||0}-${t.end<1/0?t.end:""}`);const i=void 0===t.retries?12:t.retries;let o={method:"GET",headers:r,mode:"cors",cache:t.noCache?"no-cache":"default",redirect:"follow",keepalive:!0};const a=httptools.p_httpfetch(e,o,{retries:i,wantstream:t.wantstream});if(!n)return a;a.then(e=>{try{n(null,e)}catch(e){s("Uncaught error %O",e)}}).catch(e=>n(e))},httptools.p_POST=function(e,t={},n){"function"==typeof t&&(n=t,t={});const r=void 0===t.retries?0:t.retries;let i={method:"POST",headers:{},body:t.data,mode:"cors",cache:"default",redirect:"follow",keepalive:!1};t.contenttype&&(i.headers["Content-Type"]=t.contenttype);const o=httptools.p_httpfetch(e,i,{retries:r});if(!n)return o;o.then(e=>n(null,e)).catch(e=>n(e))},t=e.exports=httptools}).call(this,n(0).Buffer)},function(e,t){var n=9007199254740991;function r(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}e.exports=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={},e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var r=n(68),i=p(r),o=n(219),s=p(o),a=n(752),u=p(a),l=n(131),c=p(l),f=n(291),h=p(f);function p(e){return e&&e.__esModule?e:{default:e}}function d(e){return function(t,n,r){if(r=(0,s.default)(r||i.default),e<=0||!t)return r(null);var o=(0,u.default)(t),a=!1,l=0,f=!1;function p(e,t){if(l-=1,e)a=!0,r(e);else{if(t===h.default||a&&l<=0)return a=!0,r(null);f||d()}}function d(){for(f=!0;l{let n;if(r.isBuffer(e))n=a.varintBufferEncode(e);else{if(!o[e])throw new Error("multicodec not recognized");n=o[e]}return r.concat([n,t])}),t.rmPrefix=(e=>(i.decode(e),e.slice(i.decode.bytes))),t.getCodec=(e=>{const t=a.varintBufferDecode(e),n=s[t.toString("hex")];if(void 0===n)throw new Error("Code `0x"+t.toString("hex")+"` not found");return n}),t.getName=(e=>s[e.toString(16)]),t.getNumber=(e=>{const t=o[e];if(void 0===t)throw new Error("Codec `"+e+"` not found");return a.varintBufferDecode(t)[0]}),t.getCode=(e=>i.decode(e)),t.getCodeVarint=(e=>{const t=o[e];if(void 0===t)throw new Error("Codec `"+e+"` not found");return t}),t.getVarint=(e=>i.encode(e));const u=n(789);Object.assign(t,u),t.print=n(790)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=function e(t,n){n=n||{};var r=n.last||!1,i=!1;if("number"==typeof t){r=!0;var o=t;t=function(){return--o}}return function(e){function n(t){e(!0,function(e){r=!1,t(e||!0)})}return function(o,s){i&&!o?r?n(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,r?s(null,o):n(s))})}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(390),i=a(r),o=n(220),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default,1),e.exports=t.default},function(e,t,n){"use strict";const r=n(26),i=n(226),o=n(61),s=n(227),a=n(139);t.asyncFilter=function(e){let t=!1,n,r;return function(i){return function o(s,a){if(r)return a(r);s?(r=s,i(s,t?()=>{t?n=a:a(s)}:a)):i(null,(i,s)=>{i?a(i):r?a(r):(t=!0,e(s,(e,i)=>{t=!1,r?(a(r),n(r)):e?o(e,a):i?a(null,s):o(null,a)}))})}}},t.asyncSort=function(e){const t=i(),n=r.collect((n,i)=>{if(n)return t.abort(n);e(i,(e,n)=>{if(e)return t.abort(e);t.resolve(r.values(i))})});return function(e){return n(e),t}},t.replaceStartWith=function(e,t){const n=new RegExp("^"+t);return e.replace(n,"")},t.tmpdir=(()=>o.join(s.tmpdir(),a()))},function(e,t){function n(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n-1?setImmediate:i.nextTick,u;w.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(52)},f=n(432),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(433),y;function b(){}function v(e,t){u=u||n(116),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function w(e){if(u=u||n(116),!(y.call(w,this)||this instanceof u))return new w(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function _(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},w.prototype._writev=null,w.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=g.destroy,w.prototype._undestroy=g.undestroy,w.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";t.util=n(440),t.resolver=n(453)},function(e,t,n){"use strict";(function(e){const r=n(62),i=n(232),o=i.SHIFT32,s=i.SHIFT16,a=2097151;function u(e){return e<16?"0"+e.toString(16):e.toString(16)}t.parseHalf=function e(t){var n,r,i;return i=128&t[0]?-1:1,n=(124&t[0])>>2,r=(3&t[0])<<8|t[1],n?31===n?i*(r?NaN:Infinity):i*Math.pow(2,n-25)*(1024+r):5.960464477539063e-8*i*r},t.arrayBufferToBignumber=function(e){const t=e.byteLength;let n="";for(let r=0;r{const t=new Map,n=Object.keys(e),r=n.length;for(let i=0;ie*s+t),t.buildInt64=((e,n,i,s)=>{const a=t.buildInt32(e,n),u=t.buildInt32(i,s);return a>2097151?new r(a).times(o).plus(u):a*o+u}),t.writeHalf=function t(n,r){const i=e.allocUnsafe(4);i.writeFloatBE(r,0);const o=i.readUInt32BE(0);if(0!=(8191&o))return!1;var s=o>>16&32768;const a=o>>23&255,u=8388607&o;if(a>=113&&a<=142)s+=(a-112<<10)+(u>>13);else{if(!(a>=103&&a<113))return!1;if(u&(1<<126-a)-1)return!1;s+=u+8388608>>126-a}return n.writeUInt16BE(s,0),!0},t.keySorter=function(e,t){var n=e[0].byteLength,r=t[0].byteLength;return n>r?1:r>n?-1:e[0].compare(t[0])},t.isNegativeZero=(e=>0===e&&1/e<0),t.nextPowerOf2=(e=>{let t=0;if(e&&!(e&e-1))return e;for(;0!==e;)e>>=1,t+=1;return 1<=0||!o.gcd(t.n).equals(i.ONE));e=e.multiply(o.modPow(t.e,t.n)).mod(t.n);for(var s=e.mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(a)<0;)s=s.add(t.p);var u=s.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return u=u.multiply(o.modInverse(t.n)).mod(t.n),u};function d(e,t,n){var i=r.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=o-11,s}i.putByte(0),i.putByte(n);var a=o-3-e.length,u;if(0===n||1===n){u=0===n?0:255;for(var l=0;l0;){for(var c=0,f=r.random.getBytes(a),l=0;l1;){if(255!==s.getByte()){--s.read;break}++l}else if(2===u)for(l=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++l}var f=s.getByte();if(0!==f||l!==o-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function g(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};var o={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function a(){u(e.pBits,function(t,r){return t?n(t):(e.p=r,null!==e.q?l(t,e.q):void u(e.qBits,l))})}function u(e,t){r.prime.generateProbablePrime(e,o,t)}function l(t,r){if(t)return n(t);if(e.q=r,e.p.compareTo(e.q)<0){var o=e.p;e.p=e.q,e.q=o}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void a();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void u(e.qBits,l);if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE))return e.p=e.q=null,void a();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void u(e.qBits,l);var c=e.e.modInverse(e.phi);e.keys={privateKey:s.rsa.setPrivateKey(e.n,e.e,c,e.p,e.q,c.mod(e.p1),c.mod(e.q1),e.q.modInverse(e.p)),publicKey:s.rsa.setPublicKey(e.n,e.e)},n(null,e.keys)}"prng"in t&&(o.prng=t.prng),a()}function y(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var n=r.util.hexToBytes(t);return n.length>1&&(0===n.charCodeAt(0)&&0==(128&n.charCodeAt(1))||255===n.charCodeAt(0)&&128==(128&n.charCodeAt(1)))?n.substr(1):n}function b(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function v(e){return"undefined"!=typeof window&&"object"==typeof window.crypto&&"object"==typeof window.crypto.subtle&&"function"==typeof window.crypto.subtle[e]}function w(e){return"undefined"!=typeof window&&"object"==typeof window.msCrypto&&"object"==typeof window.msCrypto.subtle&&"function"==typeof window.msCrypto.subtle[e]}function _(e){for(var t=r.util.hexToBytes(e.toString(16)),n=new Uint8Array(t.length),i=0;i0;)f.putByte(0),--h;return f.putBytes(r.util.hexToBytes(c)),f.getBytes()},s.rsa.decrypt=function(e,t,n,o){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=s,a}var u=new i(r.util.createBuffer(e).toHex(),16);if(u.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var l=p(u,t,n),c=l.toString(16),f=r.util.createBuffer(),h=s-Math.ceil(c.length/2);h>0;)f.putByte(0),--h;return f.putBytes(r.util.hexToBytes(c)),!1!==o?m(f.getBytes(),t,n):f.getBytes()},s.rsa.createKeyPairGenerationState=function(e,t,n){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048,n=n||{};var o=n.prng||r.random,s={nextBytes:function(e){for(var t=o.getBytesSync(e.length),n=0;n>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},u.e.fromInt(u.eInt),u},s.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var n=new i(null);n.fromInt(30);for(var r=0,o=function(e,t){return e|t},u=+new Date,l,c=0;null===e.keys&&(t<=0||cf?e.pqState=0:e.num.isProbablePrime(b(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(a[r++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var p=e.e.modInverse(e.phi);e.keys={privateKey:s.rsa.setPrivateKey(e.n,e.e,p,e.p,e.q,p.mod(e.p1),p.mod(e.q1),e.q.modInverse(e.p)),publicKey:s.rsa.setPublicKey(e.n,e.e)}}l=+new Date,c+=l-u,u=l}return null!==e.keys},s.rsa.generateKeyPair=function(e,t,n,i){if(1===arguments.length?"object"==typeof e?(n=e,e=void 0):"function"==typeof e&&(i=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(i=t,t=void 0):"number"!=typeof t&&(n=t,t=void 0):(n=e,i=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof n&&(i=n,n=void 0):(i=n,n=t,t=void 0)),n=n||{},void 0===e&&(e=n.bits||2048),void 0===t&&(t=n.e||65537),!r.options.usePureJavaScript&&i&&e>=256&&e<=16384&&(65537===t||3===t)){if(v("generateKey")&&v("exportKey"))return window.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:_(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return window.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){i(e)}).then(function(e){if(e){var t=s.privateKeyFromAsn1(o.fromDer(r.util.createBuffer(e)));i(null,{privateKey:t,publicKey:s.setRsaPublicKey(t.n,t.e)})}});if(w("generateKey")&&w("exportKey")){var a=window.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:_(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return a.oncomplete=function(e){var t=e.target.result,n=window.msCrypto.subtle.exportKey("pkcs8",t.privateKey);n.oncomplete=function(e){var t=e.target.result,n=s.privateKeyFromAsn1(o.fromDer(r.util.createBuffer(t)));i(null,{privateKey:n,publicKey:s.setRsaPublicKey(n.n,n.e)})},n.onerror=function(e){i(e)}},void(a.onerror=function(e){i(e)})}}var u=s.rsa.createKeyPairGenerationState(e,t,n);if(!i)return s.rsa.stepKeyPairGenerationState(u,0),u.keys;g(u,n,i)},s.setRsaPublicKey=s.rsa.setPublicKey=function(e,t){var n={n:e,e:t,encrypt:function(e,t,i){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,n){return d(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return r.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var o=t.encode(e,n,!0);return s.rsa.encrypt(o,n,!0)},verify:function(e,t,r){"string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===r?r={verify:function(e,t){t=m(t,n,!0);var r=o.fromDer(t);return e===r.value[1].value}}:"NONE"!==r&&"NULL"!==r&&null!==r||(r={verify:function(e,t){return t=m(t,n,!0),e===t}});var i=s.rsa.decrypt(t,n,!0,!1);return r.verify(e,i,n.n.bitLength())}};return n},s.setRsaPrivateKey=s.rsa.setPrivateKey=function(e,t,n,i,o,a,u,l){var c={n:e,e:t,d:n,p:i,q:o,dP:a,dQ:u,qInv:l,decrypt:function(e,t,n){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=s.rsa.decrypt(e,c,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:m};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return r.pkcs1.decode_rsa_oaep(t,e,n)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,c,!1)},sign:function(e,t){var n=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:h},n=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},n=1);var r=t.encode(e,c.n.bitLength());return s.rsa.encrypt(r,c,n)}};return c},s.wrapRsaPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(e).getBytes())])},s.privateKeyFromAsn1=function(e){var t={},n=[],a,c,f,h,p,d,m,g;if(o.validate(e,u,t,n)&&(e=o.fromDer(r.util.createBuffer(t.privateKey))),t={},n=[],!o.validate(e,l,t,n)){var y=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw y.errors=n,y}return a=r.util.createBuffer(t.privateKeyModulus).toHex(),c=r.util.createBuffer(t.privateKeyPublicExponent).toHex(),f=r.util.createBuffer(t.privateKeyPrivateExponent).toHex(),h=r.util.createBuffer(t.privateKeyPrime1).toHex(),p=r.util.createBuffer(t.privateKeyPrime2).toHex(),d=r.util.createBuffer(t.privateKeyExponent1).toHex(),m=r.util.createBuffer(t.privateKeyExponent2).toHex(),g=r.util.createBuffer(t.privateKeyCoefficient).toHex(),s.setRsaPrivateKey(new i(a,16),new i(c,16),new i(f,16),new i(h,16),new i(p,16),new i(d,16),new i(m,16),new i(g,16))},s.privateKeyToAsn1=s.privateKeyToRSAPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.qInv))])},s.publicKeyFromAsn1=function(e){var t={},n=[];if(o.validate(e,f,t,n)){var a=o.derToOid(t.publicKeyOid);if(a!==s.oids.rsaEncryption){var u=new Error("Cannot read public key. Unknown OID.");throw u.oid=a,u}e=t.rsaPublicKey}if(n=[],!o.validate(e,c,t,n)){var u=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw u.errors=n,u}var l=r.util.createBuffer(t.publicKeyModulus).toHex(),h=r.util.createBuffer(t.publicKeyExponent).toHex();return s.setRsaPublicKey(new i(l,16),new i(h,16))},s.publicKeyToAsn1=s.publicKeyToSubjectPublicKeyInfo=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,[s.publicKeyToRSAPublicKey(e)])])},s.publicKeyToRSAPublicKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.e))])}},function(e,t,n){var r=n(19);if(n(237),n(140),n(311),n(118),n(179),n(461),n(312),n(141),n(898),n(309),n(34),void 0===i)var i=r.jsbn.BigInteger;var o=r.asn1,s=r.pki=r.pki||{};e.exports=s.pbe=r.pbe=r.pbe||{};var a=s.oids,u={name:"EncryptedPrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},l={name:"PBES2Algorithms",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},c={name:"pkcs-12PbeParams",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"iterations"}]};function f(e,t){return e.start().update(t).digest().getBytes()}function h(e){var t;if(e){if(t=s.oids[o.derToOid(e)],!t){var n=new Error("Unsupported PRF OID.");throw n.oid=e,n.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],n}}else t="hmacWithSHA1";return p(t)}function p(e){var t=r.md;switch(e){case"hmacWithSHA224":t=r.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var n=new Error("Unsupported PRF algorithm.");throw n.algorithm=e,n.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],n}if(!(t&&e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function d(e,t,n,i){var a=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==i&&a.value.push(o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,r.util.hexToBytes(n.toString(16))),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids[i]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")])),a}s.encryptPrivateKeyInfo=function(e,t,n){n=n||{},n.saltSize=n.saltSize||8,n.count=n.count||2048,n.algorithm=n.algorithm||"aes128",n.prfAlgorithm=n.prfAlgorithm||"sha1";var i=r.random.getBytesSync(n.saltSize),u=n.count,l=o.integerToDer(u),c,f,h;if(0===n.algorithm.indexOf("aes")||"des"===n.algorithm){var m,g,y;switch(n.algorithm){case"aes128":c=16,m=16,g=a["aes128-CBC"],y=r.aes.createEncryptionCipher;break;case"aes192":c=24,m=16,g=a["aes192-CBC"],y=r.aes.createEncryptionCipher;break;case"aes256":c=32,m=16,g=a["aes256-CBC"],y=r.aes.createEncryptionCipher;break;case"des":c=8,m=8,g=a.desCBC,y=r.des.createEncryptionCipher;break;default:var b=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw b.algorithm=n.algorithm,b}var v="hmacWith"+n.prfAlgorithm.toUpperCase(),w=p(v),_=r.pkcs5.pbkdf2(t,i,u,c,w),k=r.random.getBytesSync(m),S=y(_);S.start(k),S.update(o.toDer(e)),S.finish(),h=S.output.getBytes();var E=d(i,l,c,v);f=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBES2).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBKDF2).getBytes()),E]),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(g).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,k)])])])}else{if("3des"!==n.algorithm){var b=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw b.algorithm=n.algorithm,b}c=24;var x=new r.util.ByteBuffer(i),_=s.pbe.generatePkcs12Key(t,x,1,u,c),k=s.pbe.generatePkcs12Key(t,x,2,u,c),S=r.des.createEncryptionCipher(_);S.start(k),S.update(o.toDer(e)),S.finish(),h=S.output.getBytes(),f=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,i),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,l.getBytes())])])}var C=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[f,o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,h)]);return C},s.decryptPrivateKeyInfo=function(e,t){var n=null,i={},a=[];if(!o.validate(e,u,i,a)){var l=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw l.errors=a,l}var c=o.derToOid(i.encryptionOid),f=s.pbe.getCipher(c,i.encryptionParams,t),h=r.util.createBuffer(i.encryptedData);return f.update(h),f.finish()&&(n=o.fromDer(f.output)),n},s.encryptedPrivateKeyToPem=function(e,t){var n={type:"ENCRYPTED PRIVATE KEY",body:o.toDer(e).getBytes()};return r.pem.encode(n,{maxline:t})},s.encryptedPrivateKeyFromPem=function(e){var t=r.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var n=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw n.headerType=t.type,n}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return o.fromDer(t.body)},s.encryptRsaPrivateKey=function(e,t,n){if(n=n||{},!n.legacy){var i=s.wrapRsaPrivateKey(s.privateKeyToAsn1(e));return i=s.encryptPrivateKeyInfo(i,t,n),s.encryptedPrivateKeyToPem(i)}var a,u,l,c;switch(n.algorithm){case"aes128":a="AES-128-CBC",l=16,u=r.random.getBytesSync(16),c=r.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",l=24,u=r.random.getBytesSync(16),c=r.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",l=32,u=r.random.getBytesSync(16),c=r.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",l=24,u=r.random.getBytesSync(8),c=r.des.createEncryptionCipher;break;case"des":a="DES-CBC",l=8,u=r.random.getBytesSync(8),c=r.des.createEncryptionCipher;break;default:var f=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+n.algorithm+'".');throw f.algorithm=n.algorithm,f}var h=r.pbe.opensslDeriveBytes(t,u.substr(0,8),l),p=c(h);p.start(u),p.update(o.toDer(s.privateKeyToAsn1(e))),p.finish();var d={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:r.util.bytesToHex(u).toUpperCase()},body:p.output.getBytes()};return r.pem.encode(d)},s.decryptRsaPrivateKey=function(e,t){var n=null,i=r.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type){var a=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw a.headerType=a,a}if(i.procType&&"ENCRYPTED"===i.procType.type){var u,l;switch(i.dekInfo.algorithm){case"DES-CBC":u=8,l=r.des.createDecryptionCipher;break;case"DES-EDE3-CBC":u=24,l=r.des.createDecryptionCipher;break;case"AES-128-CBC":u=16,l=r.aes.createDecryptionCipher;break;case"AES-192-CBC":u=24,l=r.aes.createDecryptionCipher;break;case"AES-256-CBC":u=32,l=r.aes.createDecryptionCipher;break;case"RC2-40-CBC":u=5,l=function(e){return r.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":u=8,l=function(e){return r.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":u=16,l=function(e){return r.rc2.createDecryptionCipher(e,128)};break;default:var a=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".');throw a.algorithm=i.dekInfo.algorithm,a}var c=r.util.hexToBytes(i.dekInfo.parameters),f=r.pbe.opensslDeriveBytes(t,c.substr(0,8),u),h=l(f);if(h.start(c),h.update(r.util.createBuffer(i.body)),!h.finish())return n;n=h.output.getBytes()}else n=i.body;return n="ENCRYPTED PRIVATE KEY"===i.type?s.decryptPrivateKeyInfo(o.fromDer(n),t):o.fromDer(n),null!==n&&(n=s.privateKeyFromAsn1(n)),n},s.pbe.generatePkcs12Key=function(e,t,n,i,o,s){var a,u;if(void 0===s||null===s){if(!("sha1"in r.md))throw new Error('"sha1" hash algorithm unavailable.');s=r.md.sha1.create()}var l=s.digestLength,c=s.blockLength,f=new r.util.ByteBuffer,h=new r.util.ByteBuffer;if(null!==e&&void 0!==e){for(u=0;u=0;u--)T>>=8,T+=x.at(u)+I.at(u),I.setAt(u,255&T);A.putBuffer(I)}w=A,f.putBuffer(S)}return f.truncate(f.length()-o),f},s.pbe.getCipher=function(e,t,n){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,n);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,n);default:var r=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw r.oid=e,r.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],r}},s.pbe.getCipherForPBES2=function(e,t,n){var i={},a=[];if(!o.validate(t,l,i,a)){var u=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=a,u}if(e=o.derToOid(i.kdfOid),e!==s.oids.pkcs5PBKDF2){var u=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw u.oid=e,u.supportedOids=["pkcs5PBKDF2"],u}if(e=o.derToOid(i.encOid),e!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC){var u=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw u.oid=e,u.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],u}var c=i.kdfSalt,f=r.util.createBuffer(i.kdfIterationCount),p,d;switch(f=f.getInt(f.length()<<3),s.oids[e]){case"aes128-CBC":p=16,d=r.aes.createDecryptionCipher;break;case"aes192-CBC":p=24,d=r.aes.createDecryptionCipher;break;case"aes256-CBC":p=32,d=r.aes.createDecryptionCipher;break;case"des-EDE3-CBC":p=24,d=r.des.createDecryptionCipher;break;case"desCBC":p=8,d=r.des.createDecryptionCipher}var m=h(i.prfOid),g=r.pkcs5.pbkdf2(n,c,f,p,m),y=i.encIv,b=d(g);return b.start(y),b},s.pbe.getCipherForPKCS12PBE=function(e,t,n){var i={},a=[];if(!o.validate(t,c,i,a)){var u=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=a,u}var l=r.util.createBuffer(i.salt),f=r.util.createBuffer(i.iterations),p,d,m;switch(f=f.getInt(f.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:p=24,d=8,m=r.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:p=5,d=8,m=function(e,t){var n=r.rc2.createDecryptionCipher(e,40);return n.start(t,null),n};break;default:var u=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw u.oid=e,u}var g=h(i.prfOid),y=s.pbe.generatePkcs12Key(n,l,1,f,p,g);g.start();var b=s.pbe.generatePkcs12Key(n,l,2,f,d,g);return m(y,b)},s.pbe.opensslDeriveBytes=function(e,t,n,i){if(void 0===i||null===i){if(!("md5"in r.md))throw new Error('"md5" hash algorithm unavailable.');i=r.md.md5.create()}null===t&&(t="");for(var o=[f(i,e+t)],s=16,a=1;s8?3:1,g=[],y=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,v,w=0;w>>4^k),k^=v,_^=v<<4,v=65535&(k>>>-16^_),_^=v,k^=v<<-16,v=858993459&(_>>>2^k),k^=v,_^=v<<2,v=65535&(k>>>-16^_),_^=v,k^=v<<-16,v=1431655765&(_>>>1^k),k^=v,_^=v<<1,v=16711935&(k>>>8^_),_^=v,k^=v<<8,v=1431655765&(_>>>1^k),k^=v,_^=v<<1,v=_<<8|k>>>20&240,_=k<<24|k<<8&16711680|k>>>8&65280|k>>>24&240,k=v;for(var S=0;S>>26,k=k<<2|k>>>26):(_=_<<1|_>>>27,k=k<<1|k>>>27),_&=-15,k&=-15;var E=t[_>>>28]|n[_>>>24&15]|r[_>>>20&15]|i[_>>>16&15]|o[_>>>12&15]|s[_>>>8&15]|a[_>>>4&15],x=u[k>>>28]|l[k>>>24&15]|c[k>>>20&15]|f[k>>>16&15]|h[k>>>12&15]|p[k>>>8&15]|d[k>>>4&15];v=65535&(x>>>16^E),g[b++]=E^v,g[b++]=x^v<<16}}return g}function d(e,t,n,r){var i=32===e.length?3:9,p,d;p=3===i?r?[30,-2,-2]:[0,32,2]:r?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var m=t[0],g=t[1];d=252645135&(m>>>4^g),g^=d,m^=d<<4,d=65535&(m>>>16^g),g^=d,m^=d<<16,d=858993459&(g>>>2^m),m^=d,g^=d<<2,d=16711935&(g>>>8^m),m^=d,g^=d<<8,d=1431655765&(m>>>1^g),g^=d,m^=d<<1,m=m<<1|m>>>31,g=g<<1|g>>>31;for(var y=0;y>>4|g<<28)^e[w+1];d=m,m=g,g=d^(s[_>>>24&63]|u[_>>>16&63]|c[_>>>8&63]|h[63&_]|o[k>>>24&63]|a[k>>>16&63]|l[k>>>8&63]|f[63&k])}d=m,m=g,g=d}m=m>>>1|m<<31,g=g>>>1|g<<31,d=1431655765&(m>>>1^g),g^=d,m^=d<<1,d=16711935&(g>>>8^m),m^=d,g^=d<<8,d=858993459&(g>>>2^m),m^=d,g^=d<<2,d=65535&(m>>>16^g),g^=d,m^=d<<16,d=252645135&(m>>>4^g),g^=d,m^=d<<4,n[0]=m,n[1]=g}function m(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),n="DES-"+t,i;i=e.decrypt?r.cipher.createDecipher(n,e.key):r.cipher.createCipher(n,e.key);var o=i.start;return i.start=function(e,t){var n=null;t instanceof r.util.ByteBuffer&&(n=t,t={}),t=t||{},t.output=n,t.iv=e,o.call(i,t)},i}},function(e,t,n){var r=n(19);n(34);var i=e.exports=r.pem=r.pem||{};function o(e){for(var t=e.name+": ",n=[],r=function(e,t){return" "+t},i=0;i65&&-1!==s){var a=t[s];","===a?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+a+t.substr(s+1),o=i-s-1,s=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(s=i);return t}function s(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var n="-----BEGIN "+e.type+"-----\r\n",i;if(e.procType&&(i={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},n+=o(i)),e.contentDomain&&(i={name:"Content-Domain",values:[e.contentDomain]},n+=o(i)),e.dekInfo&&(i={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&i.values.push(e.dekInfo.parameters),n+=o(i)),e.headers)for(var s=0;s{n(null,e)},e=>{n(e)})}},function(e,t,n){"use strict";e.exports=self.crypto||self.msCrypto},function(e,t,n){"use strict";const r=n(901);e.exports=function(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return r(e)}},function(e,t,n){var r=n(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 n=e[5+t];return 0!==n&&(6+t+n===e.length&&(!(128&e[4])&&(!(t>1&&0===e[4]&&!(128&e[5]))&&(!(128&e[t+6])&&!(n>1&&0===e[t+6]&&!(128&e[t+7]))))))}function o(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(48!==e[0])throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(2!==e[2])throw new Error("Expected DER integer");var t=e[3];if(0===t)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");var n=e[5+t];if(0===n)throw new Error("S length is zero");if(6+t+n!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw new Error("R value excessively padded");if(128&e[t+6])throw new Error("S value is negative");if(n>1&&0===e[t+6]&&!(128&e[t+7]))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}}function s(e,t){var n=e.length,i=t.length;if(0===n)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(n>33)throw new Error("R length is too long");if(i>33)throw new Error("S length is too long");if(128&e[0])throw new Error("R value is negative");if(128&t[0])throw new Error("S value is negative");if(n>1&&0===e[0]&&!(128&e[1]))throw new Error("R value excessively padded");if(i>1&&0===t[0]&&!(128&t[1]))throw new Error("S value excessively padded");var o=r.allocUnsafe(6+n+i);return o[0]=48,o[1]=o.length-2,o[2]=2,o[3]=e.length,e.copy(o,4),o[4+n]=2,o[5+n]=t.length,t.copy(o,6+n),o}e.exports={check:i,decode:o,encode:s}},function(e){e.exports={COMPRESSED_TYPE_INVALID:"compressed should be a boolean",EC_PRIVATE_KEY_TYPE_INVALID:"private key should be a Buffer",EC_PRIVATE_KEY_LENGTH_INVALID:"private key length is invalid",EC_PRIVATE_KEY_RANGE_INVALID:"private key range is invalid",EC_PRIVATE_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting private key is invalid",EC_PRIVATE_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PRIVATE_KEY_EXPORT_DER_FAIL:"couldn't export to DER format",EC_PRIVATE_KEY_IMPORT_DER_FAIL:"couldn't import from DER format",EC_PUBLIC_KEYS_TYPE_INVALID:"public keys should be an Array",EC_PUBLIC_KEYS_LENGTH_INVALID:"public keys Array should have at least 1 element",EC_PUBLIC_KEY_TYPE_INVALID:"public key should be a Buffer",EC_PUBLIC_KEY_LENGTH_INVALID:"public key length is invalid",EC_PUBLIC_KEY_PARSE_FAIL:"the public key could not be parsed or is invalid",EC_PUBLIC_KEY_CREATE_FAIL:"private was invalid, try again",EC_PUBLIC_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting public key is invalid",EC_PUBLIC_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PUBLIC_KEY_COMBINE_FAIL:"the sum of the public keys is not valid",ECDH_FAIL:"scalar was invalid (zero or overflow)",ECDSA_SIGNATURE_TYPE_INVALID:"signature should be a Buffer",ECDSA_SIGNATURE_LENGTH_INVALID:"signature length is invalid",ECDSA_SIGNATURE_PARSE_FAIL:"couldn't parse signature",ECDSA_SIGNATURE_PARSE_DER_FAIL:"couldn't parse DER signature",ECDSA_SIGNATURE_SERIALIZE_DER_FAIL:"couldn't serialize signature to DER format",ECDSA_SIGN_FAIL:"nonce generation function failed or private key is invalid",ECDSA_RECOVER_FAIL:"couldn't recover public key from signature",MSG32_TYPE_INVALID:"message should be a Buffer",MSG32_LENGTH_INVALID:"message length is invalid",OPTIONS_TYPE_INVALID:"options should be an Object",OPTIONS_DATA_TYPE_INVALID:"options.data should be a Buffer",OPTIONS_DATA_LENGTH_INVALID:"options.data length is invalid",OPTIONS_NONCEFN_TYPE_INVALID:"options.noncefn should be a Function",RECOVERY_ID_TYPE_INVALID:"recovery should be a Number",RECOVERY_ID_VALUE_INVALID:"recovery should have value between -1 and 4",TWEAK_TYPE_INVALID:"tweak should be a Buffer",TWEAK_LENGTH_INVALID:"tweak length is invalid"}},function(e,t,n){"use strict";var r=n(1),i=n(468),o=n(4).Buffer,s=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(e,t){return e<>>32-t}function l(e,t,n,r,i,o,s){return u(e+(t&n|~t&r)+i+o|0,s)+t|0}function c(e,t,n,r,i,o,s){return u(e+(t&r|n&~r)+i+o|0,s)+t|0}function f(e,t,n,r,i,o,s){return u(e+(t^n^r)+i+o|0,s)+t|0}function h(e,t,n,r,i,o,s){return u(e+(n^(t|~r))+i+o|0,s)+t|0}r(a,i),a.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var n=this._a,r=this._b,i=this._c,o=this._d;n=l(n,r,i,o,e[0],3614090360,7),o=l(o,n,r,i,e[1],3905402710,12),i=l(i,o,n,r,e[2],606105819,17),r=l(r,i,o,n,e[3],3250441966,22),n=l(n,r,i,o,e[4],4118548399,7),o=l(o,n,r,i,e[5],1200080426,12),i=l(i,o,n,r,e[6],2821735955,17),r=l(r,i,o,n,e[7],4249261313,22),n=l(n,r,i,o,e[8],1770035416,7),o=l(o,n,r,i,e[9],2336552879,12),i=l(i,o,n,r,e[10],4294925233,17),r=l(r,i,o,n,e[11],2304563134,22),n=l(n,r,i,o,e[12],1804603682,7),o=l(o,n,r,i,e[13],4254626195,12),i=l(i,o,n,r,e[14],2792965006,17),r=l(r,i,o,n,e[15],1236535329,22),n=c(n,r,i,o,e[1],4129170786,5),o=c(o,n,r,i,e[6],3225465664,9),i=c(i,o,n,r,e[11],643717713,14),r=c(r,i,o,n,e[0],3921069994,20),n=c(n,r,i,o,e[5],3593408605,5),o=c(o,n,r,i,e[10],38016083,9),i=c(i,o,n,r,e[15],3634488961,14),r=c(r,i,o,n,e[4],3889429448,20),n=c(n,r,i,o,e[9],568446438,5),o=c(o,n,r,i,e[14],3275163606,9),i=c(i,o,n,r,e[3],4107603335,14),r=c(r,i,o,n,e[8],1163531501,20),n=c(n,r,i,o,e[13],2850285829,5),o=c(o,n,r,i,e[2],4243563512,9),i=c(i,o,n,r,e[7],1735328473,14),r=c(r,i,o,n,e[12],2368359562,20),n=f(n,r,i,o,e[5],4294588738,4),o=f(o,n,r,i,e[8],2272392833,11),i=f(i,o,n,r,e[11],1839030562,16),r=f(r,i,o,n,e[14],4259657740,23),n=f(n,r,i,o,e[1],2763975236,4),o=f(o,n,r,i,e[4],1272893353,11),i=f(i,o,n,r,e[7],4139469664,16),r=f(r,i,o,n,e[10],3200236656,23),n=f(n,r,i,o,e[13],681279174,4),o=f(o,n,r,i,e[0],3936430074,11),i=f(i,o,n,r,e[3],3572445317,16),r=f(r,i,o,n,e[6],76029189,23),n=f(n,r,i,o,e[9],3654602809,4),o=f(o,n,r,i,e[12],3873151461,11),i=f(i,o,n,r,e[15],530742520,16),r=f(r,i,o,n,e[2],3299628645,23),n=h(n,r,i,o,e[0],4096336452,6),o=h(o,n,r,i,e[7],1126891415,10),i=h(i,o,n,r,e[14],2878612391,15),r=h(r,i,o,n,e[5],4237533241,21),n=h(n,r,i,o,e[12],1700485571,6),o=h(o,n,r,i,e[3],2399980690,10),i=h(i,o,n,r,e[10],4293915773,15),r=h(r,i,o,n,e[1],2240044497,21),n=h(n,r,i,o,e[8],1873313359,6),o=h(o,n,r,i,e[15],4264355552,10),i=h(i,o,n,r,e[6],2734768916,15),r=h(r,i,o,n,e[13],1309151649,21),n=h(n,r,i,o,e[4],4149444226,6),o=h(o,n,r,i,e[11],3174756917,10),i=h(i,o,n,r,e[2],718787259,15),r=h(r,i,o,n,e[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+o|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=o.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=a},function(e,t,n){"use strict";var r=n(1),i=n(928),o=n(119),s=n(4).Buffer,a=n(929),u=n(469),l=n(470),c=s.alloc(128);function f(e,t){o.call(this,"digest"),"string"==typeof t&&(t=s.from(t));var n="sha512"===e||"sha384"===e?128:64;if(this._alg=e,this._key=t,t.length>n){var r="rmd160"===e?new u:l(e);t=r.update(t).digest()}else t.length{const t=o.apply(null,e);r.codes[t.code]=t,r.names[t.name]=t}),r.object=o,e.exports=r},function(e,t,n){"use strict";const r=1e3;e.exports={maxProvidersPerRequest:3,providerRequestTimeout:1e4,hasBlockTimeout:15e3,provideTimeout:15e3,kMaxPriority:Math.pow(2,31)-1,rebroadcastDelay:1e4,maxListeners:1e3}},function(e,t,n){var r=n(67),i=n(323),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!i(e))||(s.test(e)||!o.test(e)||null!=t&&e in Object(t))}e.exports=a},function(e,t,n){var r=n(132),i=n(105),o="[object Symbol]";function s(e){return"symbol"==typeof e||i(e)&&r(e)==o}e.exports=s},function(e,t,n){var r=n(1001),i=n(1017),o=n(1019),s=n(1020),a=n(1021);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{let r,i;if(e<0)r=n,i=t;else{if(!(e>0))return t[0];r=t,i=n}for(let e of r)for(let t of i)if(e===t)return e;throw new Error("No algorithms in common!")}),t.makeMacAndCipher=((e,t)=>{l([t=>c(e.hashT,e.keys.macKey,t),t=>f(e.cipherT,e.keys.iv,e.keys.cipherKey,t)],(n,r)=>{if(n)return t(n);e.mac=r[0],e.cipher=r[1],t()})}),t.selectBest=((n,r,i)=>{t.digest(e.concat([r.pubKeyBytes,n.nonce]),(o,s)=>{if(o)return i(o);t.digest(e.concat([n.pubKeyBytes,r.nonce]),(o,a)=>{if(o)return i(o);const u=e.compare(s,a);if(0===u)return i(new Error("you are trying to talk to yourself"));i(null,{curveT:t.theBest(u,n.exchanges,r.exchanges),cipherT:t.theBest(u,n.ciphers,r.ciphers),hashT:t.theBest(u,n.hashes,r.hashes),order:u})})})}),t.digest=((e,t)=>{r.digest(e,"sha2-256",e.length,t)}),t.write=function e(t,n,r){r=r||(()=>{}),o(s([n]),i.encode({fixed:!0,bytes:4}),a((e,n)=>{if(e)return r(e);t.shake.write(n[0]),r()}))},t.read=function e(t,n){i.decodeFromReader(t,{fixed:!0,bytes:4},n)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(e){const r=n(71),i=n(23),o=n(64),s=n(54),a=n(11),u=n(5),l=u("libp2p:secio");l.error=u("libp2p:secio:error");const c=r(n(1113)),f=n(330),h=16;t.createProposal=(e=>(e.proposal.out={rand:o.randomBytes(16),pubkey:e.key.local.public.bytes,exchanges:f.exchanges.join(","),ciphers:f.ciphers.join(","),hashes:f.hashes.join(",")},e.proposalEncoded.out=c.Propose.encode(e.proposal.out),e.proposalEncoded.out)),t.createExchange=((t,n)=>{o.keys.generateEphemeralKeyPair(t.protocols.local.curveT,(r,i)=>{if(r)return n(r);t.ephemeralKey.local=i.key,t.shared.generate=i.genSharedKey;const o=e.concat([t.proposalEncoded.out,t.proposalEncoded.in,t.ephemeralKey.local]);t.key.local.sign(o,(e,r)=>{if(e)return n(e);t.exchange.out={epubkey:t.ephemeralKey.local,signature:r},n(null,c.Exchange.encode(t.exchange.out))})})}),t.identify=((e,t,n)=>{l("1.1 identify"),e.proposalEncoded.in=t,e.proposal.in=c.Propose.decode(t);const r=e.proposal.in.pubkey;e.key.remote=o.keys.unmarshalPublicKey(r),i.createFromPubKey(r.toString("base64"),(t,r)=>{if(t)return n(t);if(e.id.remote){if(e.id.remote.toB58String()!==r.toB58String())return n(new Error("dialed to the wrong peer, Ids do not match"))}else e.id.remote=r;l("1.1 identify - %s - identified remote peer as %s",e.id.local.toB58String(),e.id.remote.toB58String()),n()})}),t.selectProtocols=((e,t)=>{l("1.2 selection");const n={pubKeyBytes:e.key.local.public.bytes,exchanges:f.exchanges,hashes:f.hashes,ciphers:f.ciphers,nonce:e.proposal.out.rand},r={pubKeyBytes:e.proposal.in.pubkey,exchanges:e.proposal.in.exchanges.split(","),hashes:e.proposal.in.hashes.split(","),ciphers:e.proposal.in.ciphers.split(","),nonce:e.proposal.in.rand};f.selectBest(n,r,(n,r)=>{if(n)return t(n);e.protocols.remote={order:r.order,curveT:r.curveT,cipherT:r.cipherT,hashT:r.hashT},e.protocols.local={order:r.order,curveT:r.curveT,cipherT:r.cipherT,hashT:r.hashT},t()})}),t.verify=((t,n,r)=>{l("2.1. verify"),t.exchange.in=c.Exchange.decode(n),t.ephemeralKey.remote=t.exchange.in.epubkey;const i=e.concat([t.proposalEncoded.in,t.proposalEncoded.out,t.ephemeralKey.remote]);t.key.remote.verify(i,t.exchange.in.signature,(e,t)=>e?r(e):t?(l("2.1. verify - signature verified"),void r()):r(new Error("Bad signature")))}),t.generateKeys=((e,t)=>{l("2.2. keys"),a([t=>e.shared.generate(e.exchange.in.epubkey,t),(t,n)=>{e.shared.secret=t,o.keys.keyStretcher(e.protocols.local.cipherT,e.protocols.local.hashT,e.shared.secret,n)},(t,n)=>{if(e.protocols.local.order>0)e.protocols.local.keys=t.k1,e.protocols.remote.keys=t.k2;else{if(!(e.protocols.local.order<0))return n(new Error("you are trying to talk to yourself"));e.protocols.local.keys=t.k2,e.protocols.remote.keys=t.k1}l("2.3. mac + cipher"),s([t=>f.makeMacAndCipher(e.protocols.local,t),t=>f.makeMacAndCipher(e.protocols.remote,t)],n)}],t)}),t.verifyNonce=((e,t)=>{const n=e.proposal.out.rand;if(!n.equals(t))throw new Error(`Failed to read our encrypted nonce: ${n.toString("hex")} != ${t.toString("hex")}`)})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var r=n(68),i=f(r),o=n(145),s=f(o),a=n(42),u=f(a),l=n(104),c=f(l);function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t){var n=null,r;t=t||i.default,(0,s.default)(e,function(e,t){(0,u.default)(e)(function(e,i){r=arguments.length>2?(0,c.default)(arguments,1):i,n=e,t(!e)})},function(){t(n,r)})}e.exports=t.default},function(e,t,n){"use strict";const r=n(71),i="\nmessage Identify {\n // protocolVersion determines compatibility between peers\n optional string protocolVersion = 5; // e.g. ipfs/1.0.0\n\n // agentVersion is like a UserAgent string in browsers, or client version in bittorrent\n // includes the client name and client.\n optional string agentVersion = 6; // e.g. go-ipfs/0.1.0\n\n // publicKey is this node's public key (which also gives its node.ID)\n // - may not need to be sent, as secure channel implies it has been sent.\n // - then again, if we change / disable secure channel, may still want it.\n optional bytes publicKey = 1;\n\n // listenAddrs are the multiaddrs the sender node listens for open connections on\n repeated bytes listenAddrs = 2;\n\n // oservedAddr is the multiaddr of the remote endpoint that the sender node perceives\n // this is useful information to convey to the other side, as it helps the remote endpoint\n // determine whether its connection to the local peer goes through NAT.\n optional bytes observedAddr = 4;\n\n repeated string protocols = 3;\n}\n";e.exports=r(i).Identify},function(e,t,n){"use strict";const r=n(43),i=n(37),o=n(106),s=n(12),a=n(72),u=n(122),l=n(5),c=l("libp2p:circuit:stream-handler");c.err=l("libp2p:circuit:error:stream-handler");class f{constructor(e,t,n,r){this.conn=e,this.stream=null,this.shake=null,this.timeout=t||6e4,this.maxLength=r||4096,"function"==typeof t&&(this.timeout=n||6e4),this.stream=u({timeout:this.timeout},t),this.shake=this.stream.handshake,s(this.stream,e,this.stream)}isValid(){return this.conn&&this.shake&&this.stream}read(e){if(!this.isValid())return e(new Error("handler is not in a valid state"));a.decodeFromReader(this.shake,{maxLength:this.maxLength},(t,n)=>t?(c.err(t),e(t)):e(null,n))}write(e,t){if(t=t||(()=>{}),!this.isValid())return t(new Error("handler is not in a valid state"));s(r([e]),a.encode(),i((e,n)=>{if(e)return c.err(e),this.shake.abort(e),t(e);n.forEach(e=>this.shake.write(e)),t()}))}getRawConn(){return this.conn}rest(){const e=this.shake.rest();return this.conn=null,this.stream=null,this.shake=null,e}close(){this.isValid()&&s(o(),this.rest())}}e.exports=f},function(e,t,n){"use strict";e.exports={relay:"/libp2p/circuit/relay/0.1.0"}},function(e,t,n){"use strict";const r=n(66).Connection,i=n(12);e.exports=((e,t,n,o)=>{const s=new Promise((e,t)=>{n.getPeerInfo((t,r)=>{if(!t&&r)return void e(r);const i=n.setPeerInfo;n.setPeerInfo=(t=>{i.call(n,t),e(t)})})}),a={source:i(n,o.incoming(e,t,s)),sink:i(o.outgoing(e,t,s),n)};return new r(a,n)})},function(e,t,n){"use strict";e.exports={PROTOCOL:"/ipfs/ping/1.0.0",PING_LENGTH:32}},function(e,t,n){var r=n(132),i=n(67),o=n(105),s="[object String]";function a(e){return"string"==typeof e||!i(e)&&o(e)&&r(e)==s}e.exports=a},function(e,t,n){var r=n(1221);e.exports=function(e,t,n){n=void 0===n||n;var i=!1,o;return function(s){var a=0,u=0,l=0,c=[],f=!1,h=!1,p,d;function m(){if(p){var e=p;if(d)return p=null,e(d);if(Object.hasOwnProperty.call(c,u)){p=null;var n=c[u];delete c[u],u++,e(null,n),t&&g()}else u>=l&&h&&(p=null,e(h))}}var g=r(function(){if(f=!0,h)return m();i||t&&a-t>=u||(i=!0,s(o,function(t,r){if(i=!1,t)l=a,h=t,m();else{var o=a++;e(r,function(e,t){n?c[o]=t:c.push(t),e&&(d=e),m()}),h||g()}}))});return function(e,t){e?s(h=o=e,function(e){if(t)return t(e)}):(p=t,f||g(),m())}}}},function(e,t,n){"use strict";const r=n(189),i=100;e.exports=function e(t){const n=t||100;var i=[];return r(function e(t){for(i=i.concat(t);i.length>=n;){const e=n,t=i.slice(0,e);i=i.slice(e),this.queue(t)}},function e(t){i.length&&(this.queue(i),i=[]),this.queue(null)})}},function(e,t,n){"use strict";e.exports=class e{constructor(e,t){this._options=t||{},Object.assign(this,e)}}},function(e,t,n){"use strict";const r=n(1236),i=n(1237),o={bits:8};class s{constructor(e,t,n){if(this._options=Object.assign({},o,e),this._popCount=0,this._parent=t,this._posAtParent=n,!this._options.hashFn)throw new Error("please define an options.hashFn");this._options.hash||(this._options.hash=i(this._options.hashFn)),this._children=new r}static isBucket(e){return e instanceof s}async put(e,t){const n=await this._findNewBucketAndPos(e);await n.bucket._putAt(n,e,t)}async get(e){const t=await this._findChild(e);if(t)return t.value}async del(e){const t=await this._findPlace(e),n=t.bucket._at(t.pos);n&&n.key===e&&t.bucket._delAt(t.pos)}leafCount(){return this._children.compactArray().reduce((e,t)=>t instanceof s?e+t.leafCount():e+1,0)}childrenCount(){return this._children.length}onlyChild(){return this._children.get(0)}*eachLeafSeries(){const e=this._children.compactArray();for(const t of e)if(t instanceof s)for(const e of t.eachLeafSeries())yield e;else yield t}serialize(e,t){return t(this._children.reduce((n,r,i)=>(r&&(r instanceof s?n.push(r.serialize(e,t)):n.push(e(r,i))),n),[]))}async asyncTransform(e,t){return c(this,e,t)}toJSON(){return this.serialize(u,l)}prettyPrint(){return JSON.stringify(this.toJSON(),null," ")}tableSize(){return Math.pow(2,this._options.bits)}async _findChild(e){const t=await this._findPlace(e),n=t.bucket._at(t.pos);if(n&&n.key===e)return n}async _findPlace(e){const t=this._options.hash(e),n=await t.take(this._options.bits),r=this._children.get(n);return r instanceof s?r._findPlace(t):{bucket:this,pos:n,hash:t}}async _findNewBucketAndPos(e){const t=await this._findPlace(e),n=t.bucket._at(t.pos);if(n&&n.key!==e){const e=new s(this._options,t.bucket,t.pos);t.bucket._putObjectAt(t.pos,e);const r=await e._findPlace(n.hash);return r.bucket._putAt(r,n.key,n.value),e._findNewBucketAndPos(t.hash)}return t}_putAt(e,t,n){this._putObjectAt(e.pos,{key:t,value:n,hash:e.hash})}_putObjectAt(e,t){this._children.get(e)||this._popCount++,this._children.set(e,t)}_delAt(e){this._children.get(e)&&this._popCount--,this._children.unset(e),this._level()}_level(){if(this._parent&&this._popCount<=1)if(1===this._popCount){const e=this._children.find(a);if(!(e instanceof s)){const t=e.hash;t.untake(this._options.bits);const n={pos:this._posAtParent,hash:t};this._parent._putAt(n,e.key,e.value)}}else this._parent._delAt(this._posAtParent)}_at(e){return this._children.get(e)}}function a(e){return Boolean(e)}function u(e,t){return e.key}function l(e){return e}async function c(e,t,n){const r=[];for(const i of e._children.compactArray()){if(i instanceof s)await c(i,t,n);else{const n=await t(i);r.push({bitField:e._children.bitField(),children:n})}return n(r)}}e.exports=s},function(e,t,n){"use strict";const r=(e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean);e.exports=r},function(e,t,n){"use strict";const r=n(11),i=n(48),o=n(123),{loadNode:s,formatCid:a,toMfsPath:u,FILE_SEPARATOR:l,FILE_TYPES:c}=n(82),f=n(12),h=n(37),p=n(90),d=n(78),m=n(138),g=n(81),y=n(70),b={long:!1,cidBase:"base58btc"};e.exports=(e=>(function t(n,v={}){"object"==typeof n&&(v=n,n=l),void 0===n&&(n=l),v=Object.assign({},b,v),v.long=v.l||v.long;const w=y.source();return r([t=>u(e,n,t),({mfsPath:t,depth:r},i)=>{f(o(t,e.ipld,{maxDepth:r}),h((s,a)=>{if(s)return i(s);if(a.length>1)return i(new Error(`Path ${n} had ${a.length} roots`));const u=a[0];if(!u)return i(new Error(`${n} does not exist`));if("dir"!==u.type)return i(null,m(u));let l=!0;return i(null,f(o(t,e.ipld,{maxDepth:r+1}),d(()=>!l||(l=!1,!1))))}))},(t,n)=>{n(null,f(t,p((t,n)=>{if(!v.long)return n(null,{name:t.name,type:0,size:0,hash:""});s(e,{cid:t.hash},(e,r)=>{if(e)return n(e);const o=i.unmarshal(r.node.data);n(null,{name:t.name,type:c[o.type],hash:a(t.hash,v.cidBase),size:o.fileSize()||0})})})))}],(e,t)=>{if(e)return w.resolve(g(e));w.resolve(t)}),w}))},function(e,t,n){"use strict";const r=n(11),i=n(88),o=n(5)("ipfs:mfs:mkdir"),s=n(123),a=n(12),u=n(78),l=n(77),c=n(37),f=n(9),{createNode:h,toMfsPath:p,toPathComponents:d,updateMfsRoot:m,updateTree:g,FILE_SEPARATOR:y}=n(82),b={parents:!1,hashAlg:"sha2-256",cidVersion:0,shardSplitThreshold:1e3,format:"dag-pb",flush:!0};e.exports=(e=>(function t(n,v,w){if("function"==typeof v&&(w=v,v={}),v=Object.assign({},b,v),v.parents=v.p||v.parents,v.cidVersion=v.cidVersion||0,!n)return w(new Error("no path given to Mkdir"));if(n=n.trim(),n===y)return w(v.parents?null:new Error(`cannot create directory '${y}': Already exists`));o(`Creating ${n}`);const _=d(n);r([t=>p(e,n,t),({mfsDirectory:t,mfsPath:n,root:r},i)=>{const o=d(n).slice(1);let h=0,p="";a(s(n,e.ipld,{fullPath:!0}),u(e=>e.name===o[h]&&(h++,!0)),l(e=>{const t=`${p}${p?"/":""}${o[e.depth]}`;if("dir"!==e.type)throw new Error(`cannot access ${t}: Not a directory`);return p=t,{cid:new f(e.hash),name:e.name}}),c(i))},(t,n)=>{if(_.unshift("/"),t.length===_.length)return n(new Error("file already exists"));i(_.map((e,t)=>({part:e,index:t})),({part:n,index:i},o)=>t[i]?o(null,{name:n,...t[i]}):i===_.length-1||v.parents?void r([t=>h(e,"directory",v,t),({cid:e,node:t},r)=>{r(null,{cid:e,size:t.size,name:n})}],o):o(new Error("file does not exist")),n)},(t,n)=>g(e,t,v,n),({cid:t},n)=>m(e,t,n)],e=>{e&&e.message.includes("file already exists")&&v.parents&&(e=null),w(e)})}))},function(e,t,n){"use strict";const r=n(123),i=n(12),o=n(138),s=n(90),a=n(224),u=n(78),l=n(70),c=n(37),{toMfsPath:f}=n(82),h=n(5)("ipfs:mfs:read-pull-stream"),p={offset:0,length:void 0};e.exports=(e=>(function t(n,d={}){d=Object.assign({},p,d),d.length=d.length||d.count,h(`Reading ${n}`);const m=l.source();return i(o(n),s((t,n)=>f(e,t,n)),s(({mfsPath:t,root:n},o)=>(h(`Exporting ${t}`),i(r(t,e.ipld,{offset:d.offset,length:d.length}),c(o)))),a(),u(),c((e,t)=>{if(e)return m.abort(e);if(!t||!t.length)return m.abort(new Error(`${n} does not exist`));const r=t[0];return"file"!==r.type?m.abort(new Error(`${n} was not a file`)):r.content?(h(`Got ${n} content`),void m.resolve(t[0].content)):m.abort(new Error(`Could not load content stream from ${n}`))})),m}))},function(e,t,n){"use strict";const r=n(572),i=(e,t,n)=>{"function"==typeof t&&(n=t,t=void 0),r.deserialize(e,(e,r)=>{if(e)return n(e);if(!t)return n(null,{value:r,remainderPath:""});const i=t.split("/"),o=s(r,i[0]);if(null===o)return n(new Error("No such path"),null);let a=i.slice(1).join("/");return void 0!==o["/"]?n(null,{value:o,remainderPath:a}):a.length>0?n(new Error("No such path"),null):n(null,{value:o,remainderPath:""})})},o=(e,t,n)=>{"function"==typeof t&&(n=t,t=void 0),t=t||{},r.deserialize(e,(e,r)=>{if(e)return n(e);const i=["version","timestamp","difficulty","nonce","parent","tx"];if(!0===t.values){const e={};for(let t of i)e[t]=s(r,t);return n(null,e)}return n(null,i)})},s=(e,t)=>{switch(t){case"version":return e.version;case"timestamp":return e.timestamp;case"difficulty":return e.bits;case"nonce":return e.nonce;case"parent":return{"/":r.hashToCid(e.prevHash)};case"tx":return{"/":r.hashToCid(e.merkleRoot)};default:return null}};e.exports={multicodec:"bitcoin-block",defaultHashAlg:"dbl-sha2-256",resolve:i,tree:o}},function(e,t){var n={Array:function(e){return null!==e&&void 0!==e&&e.constructor===Array},Boolean:function(e){return"boolean"==typeof e},Function:function(e){return"function"==typeof e},Nil:function(e){return void 0===e||null===e},Number:function(e){return"number"==typeof e},Object:function(e){return"object"==typeof e},String:function(e){return"string"==typeof e},"":function(){return!0}};for(var r in n.Null=n.Nil,n)n[r].toJSON=function(e){return e}.bind(null,r);e.exports=n},function(e,t,n){const r=n(4).Buffer,i=n(108),o=n(29),s=n(1358),a=n(36),u=n(45),l=n(94),c=n(580);function f(e){const t=e.length;return c.encodingLength(t)+t}function h(e){const t=e.length;return c.encodingLength(t)+e.reduce(function(e,t){return e+f(t)},0)}function p(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}p.DEFAULT_SEQUENCE=4294967295,p.SIGHASH_ALL=1,p.SIGHASH_NONE=2,p.SIGHASH_SINGLE=3,p.SIGHASH_ANYONECANPAY=128,p.ADVANCED_TRANSACTION_MARKER=0,p.ADVANCED_TRANSACTION_FLAG=1;const d=r.allocUnsafe(0),m=[],g=r.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),y=r.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),b=r.from("ffffffffffffffff","hex"),v={script:d,valueBuffer:b};p.fromBuffer=function(e,t){let n=0;function r(t){return n+=t,e.slice(n-t,n)}function i(){const t=e.readUInt32LE(n);return n+=4,t}function o(){const t=e.readInt32LE(n);return n+=4,t}function a(){const t=s.readUInt64LE(e,n);return n+=8,t}function u(){const t=c.decode(e,n);return n+=c.decode.bytes,t}function l(){return r(u())}function f(){const e=u(),t=[];for(var n=0;n=this.ins.length)return y;const s=o.compile(o.decompile(t).filter(function(e){return e!==a.OP_CODESEPARATOR})),c=this.clone();if((31&n)===p.SIGHASH_NONE)c.outs=[],c.ins.forEach(function(t,n){n!==e&&(t.sequence=0)});else if((31&n)===p.SIGHASH_SINGLE){if(e>=this.outs.length)return y;c.outs.length=e+1;for(var f=0;f>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function u(e){for(var t=1,n=0;n126)throw new Error("Invalid prefix ("+e+")");t=a(t)^r>>5}for(t=a(t),n=0;nn)throw new TypeError("Exceeds length limit");e=e.toLowerCase();for(var i=u(e),o=e+"1",s=0;s>5!=0)throw new Error("Non 5-bit word");i=a(i)^l,o+=r.charAt(l)}for(s=0;s<6;++s)i=a(i);for(i^=1,s=0;s<6;++s){var c=i>>5*(5-s)&31;o+=r.charAt(c)}return o}function c(e,t){if(t=t||90,e.length<8)throw new TypeError(e+" too short");if(e.length>t)throw new TypeError("Exceeds length limit");var n=e.toLowerCase(),r=e.toUpperCase();if(e!==n&&e!==r)throw new Error("Mixed-case string "+e);e=n;var o=e.lastIndexOf("1");if(-1===o)throw new Error("No separator character for "+e);if(0===o)throw new Error("Missing prefix for "+e);var s=e.slice(0,o),l=e.slice(o+1);if(l.length<6)throw new Error("Data too short");for(var c=u(s),f=[],h=0;h=l.length||f.push(d)}if(1!==c)throw new Error("Invalid checksum for "+e);return{prefix:s,words:f}}function f(e,t,n,r){for(var i=0,o=0,s=(1<=n;)o-=n,a.push(i>>o&s);if(r)o>0&&a.push(i<=t)throw new Error("Excess padding");if(i<{const t=s.decode(e),n=new a(t);return n}),c;function f(e,o,s){h(e,o,(e,a)=>{if(e)return s(e);if(!n)return s(null,a);let u=a.slice();const l=a.filter(e=>t.isBuffer(e.value));r(l,(e,t)=>i([t=>n.util.deserialize(e.value,t),(e,t)=>n.resolver._mapFromEthObject(e,o,t)],(n,r)=>{if(n)return t(n);r.forEach(t=>{u.push({path:e.path+"/"+t.path,value:t.value})}),t()}),e=>{if(e)return s(e);s(null,u)})})}function h(t,n,i){let o=[];"leaf"===t.type&&o.push({path:m(t.getKey()),value:t.getValue()}),r(t.getChildren(),(t,r)=>{const i=m(t[0]),s=t[1];if(a.isRawNode(s)){const e=new a(s);o.push({path:i,value:e}),h(e,n,(e,t)=>{if(e)return r(e);t.forEach(e=>{e.path=i+"/"+e.path}),o=o.concat(t),r()})}else{let t={"/":u(e,s).toBaseEncodedString()};o.push({path:i,value:t}),r()}},e=>{if(e)return i(e);i(null,o)})}}function m(e){return e.map(e=>e.toString(16)).join("/")}e.exports=d}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(596),i=(e,t,n)=>{"function"==typeof t&&(n=t,t=void 0),r.deserialize(e,(e,r)=>{if(e)return n(e);if(!t)return n(null,{value:r,remainderPath:""});const i=t.split("/"),o=s(r,i[0]);if(null===o)return n(new Error("No such path"),null);let a=i.slice(1).join("/");return void 0!==o["/"]?n(null,{value:o,remainderPath:a}):a.length>0?n(new Error("No such path"),null):n(null,{value:o,remainderPath:""})})},o=(e,t,n)=>{"function"==typeof t&&(n=t,t=void 0),t=t||{},r.deserialize(e,(e,r)=>{if(e)return n(e);const i=["version","timestamp","difficulty","nonce","solution","reserved","parent","tx"];if(!0===t.values){const e={};for(let t of i)e[t]=s(r,t);return n(null,e)}return n(null,i)})},s=(e,t)=>{switch(t){case"version":return e.version;case"timestamp":return e.time;case"difficulty":return e.bits;case"nonce":return e.nonce;case"solution":return e.solution;case"reserved":return e.reserved;case"parent":return{"/":r.hashToCid(e.prevHash)};case"tx":return{"/":r.hashToCid(e.merkleRoot)};default:return null}};e.exports={multicodec:"zcash-block",defaultHashAlg:"dbl-sha2-256",resolve:i,tree:o}},function(e,t){"function"==typeof Object.create?e.exports=function e(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function e(t,n){if(n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}}},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(25),o=n(30),s=n(41);function a(e){if(!(this instanceof a))return new a(e);var t;if(r.isNumber(e))t=e;else{if(!r.isString(e))throw new TypeError('Unrecognized num type: "'+typeof e+'" for Opcode');t=a.map[e]}return s.defineImmutable(this,{num:t}),this}for(var u in a.fromBuffer=function(e){return i.checkArgument(o.isBuffer(e)),new a(Number("0x"+e.toString("hex")))},a.fromNumber=function(e){return i.checkArgument(r.isNumber(e)),new a(e)},a.fromString=function(e){i.checkArgument(r.isString(e));var t=a.map[e];if(void 0===t)throw new TypeError("Invalid opcodestr");return new a(t)},a.prototype.toHex=function(){return this.num.toString(16)},a.prototype.toBuffer=function(){return new t(this.toHex(),"hex")},a.prototype.toNumber=function(){return this.num},a.prototype.toString=function(){var e=a.reverseMap[this.num];if(void 0===e)throw new Error("Opcode does not have a string representation");return e},a.smallInt=function(e){return i.checkArgument(r.isNumber(e),"Invalid Argument: n should be number"),i.checkArgument(e>=0&&e<=16,"Invalid Argument: n must be between 0 and 16"),0===e?a("OP_0"):new a(a.map.OP_1+e-1)},a.map={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP1:176,OP_NOP2:177,OP_NOP3:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255},a.reverseMap=[],a.map)a.reverseMap[a.map[u]]=u;r.extend(a,a.map),a.isSmallIntOp=function(e){return e instanceof a&&(e=e.toNumber()),e===a.map.OP_0||e>=a.map.OP_1&&e<=a.map.OP_16},a.prototype.inspect=function(){return""},e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(25),o=n(0),s=t.compare||n(1447),a=n(84),u=n(30),l=n(41),c=n(109),f=n(80),h=n(60),p=n(85),d=n(110),m=n(129),g=n(601),y=n(360),b=y.PublicKeyHash,v=y.PublicKey,w=y.MultiSigScriptHash,_=y.MultiSig,k=n(111),S=n(86),E=n(273),x=n(49),C=n(1452);function A(e){if(!(this instanceof A))return new A(e);if(this.inputs=[],this.outputs=[],this.joinSplits=[],this._inputAmount=void 0,this._outputAmount=void 0,e){if(e instanceof A)return A.shallowCopy(e);if(l.isHexa(e))this.fromString(e);else if(u.isBuffer(e))this.fromBuffer(e);else{if(!r.isObject(e))throw new a.InvalidArgument("Must provide an object or string to deserialize a transaction");this.fromObject(e)}}else this._newTransaction()}var I=1,T=0,j=1e6;A.DUST_AMOUNT=546,A.FEE_SECURITY_MARGIN=15,A.MAX_MONEY=21e14,A.NLOCKTIME_BLOCKHEIGHT_LIMIT=5e8,A.NLOCKTIME_MAX_VALUE=4294967295,A.FEE_PER_KB=1e4,A.CHANGE_OUTPUT_MAX_SIZE=62,A.MAXIMUM_EXTRA_SIZE=26,A.shallowCopy=function(e){var t=new A(e.toBuffer());return t};var O={configurable:!1,enumerable:!0,get:function(){return new c(this._getHash()).readReverse().toString("hex")}};Object.defineProperty(A.prototype,"hash",O),Object.defineProperty(A.prototype,"id",O);var P={configurable:!1,enumerable:!0,get:function(){return this._getInputAmount()}};Object.defineProperty(A.prototype,"inputAmount",P),P.get=function(){return this._getOutputAmount()},Object.defineProperty(A.prototype,"outputAmount",P),A.prototype._getHash=function(){return h.sha256sha256(this.toBuffer())},A.prototype.serialize=function(e){return!0===e||e&&e.disableAll?this.uncheckedSerialize():this.checkedSerialize(e)},A.prototype.uncheckedSerialize=A.prototype.toString=function(){return this.toBuffer().toString("hex")},A.prototype.checkedSerialize=function(e){var t=this.getSerializationError(e);if(t)throw t.message+=" Use Transaction#uncheckedSerialize if you want to skip security checks. See http://bitcore.io/guide/transaction.html#Serialization for more info.",t;return this.uncheckedSerialize()},A.prototype.invalidSatoshis=function(){for(var e=!1,t=0;tn)return this._missingChange()?new a.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new a.Transaction.FeeError.TooLarge("expected less than "+n+" but got "+t)}if(!e.disableSmallFees){var i=Math.ceil(this._estimateFee()/A.FEE_SECURITY_MARGIN);if(t"},A.prototype.toBuffer=function(){var e=new f;return this.toBufferWriter(e).toBuffer()},A.prototype.toBufferWriter=function(e){return e.writeUInt32LE(this.version),e.writeVarintNum(this.inputs.length),r.each(this.inputs,function(t){t.toBufferWriter(e)}),e.writeVarintNum(this.outputs.length),r.each(this.outputs,function(t){t.toBufferWriter(e)}),e.writeUInt32LE(this.nLockTime),this.version>=2&&(e.writeVarintNum(this.joinSplits.length),r.each(this.joinSplits,function(t){t.toBufferWriter(e)}),this.joinSplits.length>0&&(e.write(this.joinSplitPubKey),e.write(this.joinSplitSig))),e},A.prototype.fromBuffer=function(e){var t=new c(e);return this.fromBufferReader(t)},A.prototype.fromBufferReader=function(e){var t,n,r,o;for(i.checkArgument(!e.finished(),"No transaction data received"),this.version=e.readUInt32LE(),n=e.readVarintNum(),t=0;t=2){for(o=e.readVarintNum(),t=0;t0&&(this.joinSplitPubKey=e.read(32),this.joinSplitSig=e.read(64))}return this},A.prototype.toObject=A.prototype.toJSON=function e(){var t=[];this.inputs.forEach(function(e){t.push(e.toObject())});var n=[];this.outputs.forEach(function(e){n.push(e.toObject())});var i={hash:this.hash,version:this.version,inputs:t,outputs:n,nLockTime:this.nLockTime};if(this.version>=2){var o=[];this.joinSplits.forEach(function(e){o.push(e.toObject())}),i.joinSplits=o,this.joinSplits.length>0&&(i.joinSplitPubKey=u.reverse(this.joinSplitPubKey).toString("hex"),i.joinSplitSig=this.joinSplitSig.toString("hex"))}return this._changeScript&&(i.changeScript=this._changeScript.toString()),r.isUndefined(this._changeIndex)||(i.changeIndex=this._changeIndex),r.isUndefined(this._fee)||(i.fee=this._fee),i},A.prototype.fromObject=function e(n){i.checkArgument(r.isObject(n)||n instanceof A);var o=this,s;return s=n instanceof A?s.toObject():n,r.each(s.inputs,function(e){if(e.output&&e.output.script){var t=new S(e.output.script),n;if(t.isPublicKeyHashOut())n=new y.PublicKeyHash(e);else if(t.isScriptHashOut()&&e.publicKeys&&e.threshold)n=new y.MultiSigScriptHash(e,e.publicKeys,e.threshold,e.signatures);else{if(!t.isPublicKeyOut())throw new a.Transaction.Input.UnsupportedScript(e.output.script);n=new y.PublicKey(e)}o.addInput(n)}else o.uncheckedAddInput(new y(e))}),r.each(s.outputs,function(e){o.addOutput(new k(e))}),s.changeIndex&&(this._changeIndex=s.changeIndex),s.changeScript&&(this._changeScript=new S(s.changeScript)),s.fee&&(this._fee=s.fee),this.nLockTime=s.nLockTime,this.version=s.version,this.version>=2&&(r.each(s.joinSplits,function(e){o.joinSplits.push(new C(e))}),o.joinSplits.length>0&&(o.joinSplitPubKey=u.reverse(new t(s.joinSplitPubKey,"hex")),o.joinSplitSig=new t(s.joinSplitSig,"hex"))),this._checkConsistency(n),this},A.prototype._checkConsistency=function(e){r.isUndefined(this._changeIndex)||(i.checkState(this._changeScript),i.checkState(this.outputs[this._changeIndex]),i.checkState(this.outputs[this._changeIndex].script.toString()===this._changeScript.toString())),e&&e.hash&&i.checkState(e.hash===this.hash,"Hash in object does not match transaction hash")},A.prototype.lockUntilDate=function(e){if(i.checkArgument(e),r.isNumber(e)&&e=A.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new a.Transaction.BlockHeightTooHigh;if(e<0)throw new a.Transaction.NLockTimeOutOfRange;for(var t=0;t0?(this._changeIndex=this.outputs.length,this._addOutput(new k({script:this._changeScript,satoshis:n}))):this._changeIndex=void 0}},A.prototype.getFee=function(){return this.isCoinbase()?0:r.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee},A.prototype._estimateFee=function(){var e=this._estimateSize(),t=this._getUnspentValue();return A._estimateFee(e,t,this._feePerKb)},A.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()},A.prototype._clearSignatures=function(){r.each(this.inputs,function(e){e.clearSignatures()})},A._estimateFee=function(e,t,n){var r=Math.ceil(e/1e3)*(n||A.FEE_PER_KB);return t>r&&(e+=A.CHANGE_OUTPUT_MAX_SIZE),Math.ceil(e/1e3)*(n||A.FEE_PER_KB)},A.prototype._estimateSize=function(){var e=A.MAXIMUM_EXTRA_SIZE;return r.each(this.inputs,function(t){e+=t._estimateSize()}),r.each(this.outputs,function(t){e+=t.script.toBuffer().length+9}),e},A.prototype._removeOutput=function(e){var t=this.outputs[e];this.outputs=r.without(this.outputs,t),this._outputAmount=void 0},A.prototype.removeOutput=function(e){this._removeOutput(e),this._updateChangeOutput()},A.prototype.sort=function(){return this.sortInputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(e,t){return s(e.prevTxId,t.prevTxId)||e.outputIndex-t.outputIndex}),t}),this.sortOutputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(e,t){return e.satoshis-t.satoshis||s(e.script.toBuffer(),t.script.toBuffer())}),t}),this},A.prototype.shuffleOutputs=function(){return this.sortOutputs(r.shuffle)},A.prototype.sortOutputs=function(e){var t=e(this.outputs);return this._newOutputOrder(t)},A.prototype.sortInputs=function(e){return this.inputs=e(this.inputs),this._clearSignatures(),this},A.prototype._newOutputOrder=function(e){var t=this.outputs.length!==e.length||0!==r.difference(this.outputs,e).length;if(t)throw new a.Transaction.InvalidSorting;if(!r.isUndefined(this._changeIndex)){var n=this.outputs[this._changeIndex];this._changeIndex=r.findIndex(e,n)}return this.outputs=e,this},A.prototype.removeInput=function(e,t){var n;if(n=!t&&r.isNumber(e)?e:r.findIndex(this.inputs,function(n){return n.prevTxId.toString("hex")===e&&n.outputIndex===t}),n<0||n>=this.inputs.length)throw new a.Transaction.InvalidIndex(n,this.inputs.length);var i=this.inputs[n];this.inputs=r.without(this.inputs,i),this._inputAmount=void 0,this._updateChangeOutput()},A.prototype.sign=function(e,t){i.checkState(this.hasAllUtxoInfo());var n=this;return r.isArray(e)?(r.each(e,function(e){n.sign(e,t)}),this):(r.each(this.getSignatures(e,t),function(e){n.applySignature(e)}),this)},A.prototype.getSignatures=function(e,t){e=new E(e),t=t||p.SIGHASH_ALL;var n=this,i=[],o=h.sha256ripemd160(e.publicKey.toBuffer());return r.each(this.inputs,function s(a,u){r.each(a.getSignatures(n,e,u,t,o),function(e){i.push(e)})}),i},A.prototype.applySignature=function(e){return this.inputs[e.inputIndex].addSignature(this,e),this},A.prototype.isFullySigned=function(){return r.each(this.inputs,function(e){if(e.isFullySigned===y.prototype.isFullySigned)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction")}),r.all(r.map(this.inputs,function(e){return e.isFullySigned()}))},A.prototype.isValidSignature=function(e){var t=this;if(this.inputs[e.inputIndex].isValidSignature===y.prototype.isValidSignature)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction");return this.inputs[e.inputIndex].isValidSignature(this,e)},A.prototype.verifySignature=function(e,t,n,r){return d.verify(this,e,t,n,r)},A.prototype.verify=function(){if(0===this.inputs.length)return"transaction txins empty";if(0===this.outputs.length)return"transaction txouts empty";for(var e=new x(0),t=0;t1e6)return"transaction over the maximum block size";var i={};for(t=0;t100)return"coinbase transaction script size invalid"}else for(t=0;t=y.MAXINT-1&&(t.sequenceNumber=y.DEFAULT_RBF_SEQNUMBER)}return this},e.exports=A}).call(this,n(0).Buffer)},function(e,t,n){e.exports=n(197),e.exports.PublicKey=n(1448),e.exports.PublicKeyHash=n(1449),e.exports.MultiSig=n(1450),e.exports.MultiSigScriptHash=n(1451)},function(e,t,n){"use strict";var r=n(17),i=n(84),o=n(25),s={BTC:[1e8,8],mBTC:[1e5,5],uBTC:[100,2],bits:[100,2],satoshis:[1,0]};function a(e,t){if(!(this instanceof a))return new a(e,t);if(r.isNumber(t)){if(t<=0)throw new i.Unit.InvalidRate(t);e/=t,t=a.BTC}this._value=this._from(e,t);var n=this,o=function(e){Object.defineProperty(n,e,{get:function(){return n.to(e)},enumerable:!0})};Object.keys(s).forEach(o)}Object.keys(s).forEach(function(e){a[e]=e}),a.fromObject=function e(t){return o.checkArgument(r.isObject(t),"Argument is expected to be an object"),new a(t.amount,t.code)},a.fromBTC=function(e){return new a(e,a.BTC)},a.fromMillis=a.fromMilis=function(e){return new a(e,a.mBTC)},a.fromMicros=a.fromBits=function(e){return new a(e,a.bits)},a.fromSatoshis=function(e){return new a(e,a.satoshis)},a.fromFiat=function(e,t){return new a(e,t)},a.prototype._from=function(e,t){if(!s[t])throw new i.Unit.UnknownCode(t);return parseInt((e*s[t][0]).toFixed())},a.prototype.to=function(e){if(r.isNumber(e)){if(e<=0)throw new i.Unit.InvalidRate(e);return parseFloat((this.BTC*e).toFixed(2))}if(!s[e])throw new i.Unit.UnknownCode(e);var t=this._value/s[e][0];return parseFloat(t.toFixed(s[e][1]))},a.prototype.toBTC=function(){return this.to(a.BTC)},a.prototype.toMillis=a.prototype.toMilis=function(){return this.to(a.mBTC)},a.prototype.toMicros=a.prototype.toBits=function(){return this.to(a.bits)},a.prototype.toSatoshis=function(){return this.to(a.satoshis)},a.prototype.atRate=function(e){return this.to(e)},a.prototype.toString=function(){return this.satoshis+" satoshis"},a.prototype.toObject=a.prototype.toJSON=function e(){return{amount:this.BTC,code:a.BTC}},a.prototype.inspect=function(){return""},e.exports=a},function(e,t,n){"use strict";e.exports={_cache:{},_count:0,_eraseIndex:0,_usedList:{},_usedIndex:{},_CACHE_SIZE:5e3,get:function(e,t,n){n=!!n;var r=e+"/"+t+"/"+n;if(this._cache[r])return this._cacheHit(r),this._cache[r]},set:function(e,t,n,r){n=!!n;var i=e+"/"+t+"/"+n;this._cache[i]=r,this._cacheHit(i)},_cacheHit:function(e){this._usedIndex[e]&&delete this._usedList[this._usedIndex[e]],this._usedList[this._count]=e,this._usedIndex[e]=this._count,this._count++,this._cacheRemove()},_cacheRemove:function(){for(;this._eraseIndex{const n=o(e,t);return(e,t,o)=>{const s=r(o),a=n(t),u=i(e=>s(null,e));a.once("error",s),a.pipe(u),a.write(e),a.end()}})},function(e,t,n){"use strict";const r=n(59),i=n(1488),o=n(20).Readable;class s extends o{constructor(e){const t=Object.assign(e||{},{objectMode:!0});super(t)}_read(){}}const a=(e,t)=>{let n=new s,o=i.extract();o.on("entry",(e,t,r)=>{t.on("end",r),"directory"!==e.type?n.push({path:e.name,content:t}):(n.push({path:e.name}),t.resume())}).on("finish",()=>n.push(null)),r(e,o),t(null,n)};e.exports=a},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i=Array.isArray,o=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),s=function e(t){for(;t.length>1;){var n=t.pop(),r=n.obj[n.prop];if(i(r)){for(var o=[],s=0;s=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122?s+=i.charAt(a):u<128?s+=o[u]:u<2048?s+=o[192|u>>6]+o[128|63&u]:u<55296||u>=57344?s+=o[224|u>>12]+o[128|u>>6&63]+o[128|63&u]:(a+=1,u=65536+((1023&u)<<10|1023&i.charCodeAt(a)),s+=o[240|u>>18]+o[128|u>>12&63]+o[128|u>>6&63]+o[128|63&u])}return s},h=function e(t){for(var n=[{obj:{o:t},prop:"o"}],r=[],i=0;i1;class m{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");const t=this[i]=e.max||1/0,n=e.length||d;if(this[s]="function"!=typeof n?d:n,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[u]=e.maxAge||0,this[l]=e.dispose,this[c]=e.noDisposeOnSet||!1,this[p]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||1/0,b(this)}get max(){return this[i]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[u]=e,b(this)}get maxAge(){return this[u]}set lengthCalculator(e){"function"!=typeof e&&(e=d),e!==this[s]&&(this[s]=e,this[o]=0,this[f].forEach(e=>{e.length=this[s](e.value,e.key),this[o]+=e.length})),b(this)}get lengthCalculator(){return this[s]}get length(){return this[o]}get itemCount(){return this[f].length}rforEach(e,t){t=t||this;for(let n=this[f].tail;null!==n;){const r=n.prev;_(this,e,n,t),n=r}}forEach(e,t){t=t||this;for(let n=this[f].head;null!==n;){const r=n.next;_(this,e,n,t),n=r}}keys(){return this[f].toArray().map(e=>e.key)}values(){return this[f].toArray().map(e=>e.value)}reset(){this[l]&&this[f]&&this[f].length&&this[f].forEach(e=>this[l](e.key,e.value)),this[h]=new Map,this[f]=new r,this[o]=0}dump(){return this[f].map(e=>!y(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[f]}set(e,t,n){if(n=n||this[u],n&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const r=n?Date.now():0,a=this[s](t,e);if(this[h].has(e)){if(a>this[i])return v(this,this[h].get(e)),!1;const s=this[h].get(e),u=s.value;return this[l]&&(this[c]||this[l](e,u.value)),u.now=r,u.maxAge=n,u.value=t,this[o]+=a-u.length,u.length=a,this.get(e),b(this),!0}const p=new w(e,t,a,r,n);return p.length>this[i]?(this[l]&&this[l](e,t),!1):(this[o]+=p.length,this[f].unshift(p),this[h].set(e,this[f].head),b(this),!0)}has(e){if(!this[h].has(e))return!1;const t=this[h].get(e).value;return!y(this,t)}get(e){return g(this,e,!0)}peek(e){return g(this,e,!1)}pop(){const e=this[f].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[h].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{const e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[h].forEach((e,t)=>g(this,t,!1))}}const g=(e,t,n)=>{const r=e[h].get(t);if(r){const t=r.value;if(y(e,t)){if(v(e,r),!e[a])return}else n&&(e[p]&&(r.value.now=Date.now()),e[f].unshiftNode(r));return t.value}},y=(e,t)=>{if(!t||!t.maxAge&&!e[u])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[u]&&n>e[u]},b=e=>{if(e[o]>e[i])for(let t=e[f].tail;e[o]>e[i]&&null!==t;){const n=t.prev;v(e,t),t=n}},v=(e,t)=>{if(t){const n=t.value;e[l]&&e[l](n.key,n.value),e[o]-=n.length,e[h].delete(n.key),e[f].removeNode(t)}};class w{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}}const _=(e,t,n,r)=>{let i=n.value;y(e,i)&&(v(e,n),e[a]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};e.exports=m},function(e,t,n){"use strict";const r=n(112);function i(e,t,n){"function"==typeof e.pipe?r(e,(e,r)=>{if(e)return n(e);t(r,n)}):t(e,n)}e.exports=i},function(e,t,n){"use strict";const r=n(20).Transform,i=n(1569);class o extends r{constructor(e){const t=Object.assign(e||{},{objectMode:!0});super(t)}_transform(e,t,n){try{const t=i(e);if(this.push(t),!t.success)throw new Error(t.text)}catch(e){return n(e)}n()}}e.exports=o},function(e,t,n){"use strict";const r=n(62);e.exports=(e=>({totalIn:new r(e.TotalIn),totalOut:new r(e.TotalOut),rateIn:new r(e.RateIn),rateOut:new r(e.RateOut)}))},function(e,t,n){(function(t){e.exports=f;const r=n(655),i=n(1754),o=n(154),s=n(203),a=n(28),u=n(169),l=n(32),c=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;function f(e,n){if(e=Object.assign({maxRedirects:10},"string"==typeof e?{url:e}:e),n=a(n),e.url){const{hostname:t,port:n,protocol:r,auth:i,path:o}=l.parse(e.url);delete e.url,t||n||r||i?Object.assign(e,{hostname:t,port:n,protocol:r,auth:i,path:o}):e.path=o}const r={"accept-encoding":"gzip, deflate"};let h;e.headers&&Object.keys(e.headers).forEach(t=>r[t.toLowerCase()]=e.headers[t]),e.headers=r,e.body?h=e.json&&!c(e.body)?JSON.stringify(e.body):e.body:e.form&&(h="string"==typeof e.form?e.form:u.stringify(e.form),e.headers["content-type"]="application/x-www-form-urlencoded"),h&&(e.method||(e.method="POST"),c(h)||(e.headers["content-length"]=t.byteLength(h)),e.json&&!e.form&&(e.headers["content-type"]="application/json")),delete e.body,delete e.form,e.json&&(e.headers.accept="application/json"),e.method&&(e.method=e.method.toUpperCase());const p="https:"===e.protocol?s:o,d=p.request(e,t=>{if(t.statusCode>=300&&t.statusCode<400&&t.headers.location)return e.url=t.headers.location,delete e.headers.host,t.resume(),"POST"===e.method&&[301,302].includes(t.statusCode)&&(e.method="GET",delete e.headers["content-length"],delete e.headers["content-type"]),0==e.maxRedirects--?n(new Error("too many redirects")):f(e,n);const r="function"==typeof i&&"HEAD"!==e.method;n(null,r?i(t):t)});return d.on("timeout",()=>{d.abort(),n(new Error("Request timed out"))}),d.on("error",n),c(h)?h.on("error",n).pipe(d):d.end(h),d}f.concat=((e,t)=>f(e,(n,i)=>{if(n)return t(n);r(i,(n,r)=>{if(n)return t(n);if(e.json)try{r=JSON.parse(r.toString())}catch(n){return t(n,i,r)}t(null,i,r)})})),["get","post","put","patch","head","delete"].forEach(e=>{f[e]=((t,n)=>("string"==typeof t&&(t={url:t}),f(Object.assign({method:e.toUpperCase()},t),n)))})}).call(this,n(0).Buffer)},function(e,t){var n=1,r=65535,i=4,o,s=function(){n=n+1&65535};e.exports=function(e){o||(o=setInterval(s,250),o.unref&&o.unref());var t=4*(e||5),r=[0],i=1,a=n-1&65535;return function(e){var o=n-a&65535;for(o>t&&(o=t),a=n;o--;)i===t&&(i=0),r[i]=r[0===i?t-1:i-1],i++;e&&(r[i-1]+=e);var s=r[i-1],u=r.length=4"},homepage:"https://webtorrent.io",keywords:["bittorrent","bittorrent client","download","mad science","p2p","peer-to-peer","peers","streaming","swarm","torrent","web torrent","webrtc","webrtc data","webtorrent"],license:"MIT",main:"index.js",repository:{type:"git",url:"git://github.com/webtorrent/webtorrent.git"},scripts:{build:"browserify -s WebTorrent -e ./ | minify > webtorrent.min.js","build-debug":"browserify -s WebTorrent -e ./ > webtorrent.debug.js",size:"npm run build && cat webtorrent.min.js | gzip | wc -c",test:"standard && npm run test-node && npm run test-browser","test-browser":"airtap -- test/*.js test/browser/*.js","test-browser-local":"airtap --local -- test/*.js test/browser/*.js","test-node":"tape test/*.js test/node/*.js","update-authors":"./scripts/update-authors.sh"}}},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function e(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===i.call(t)},u=function e(t){if(!t||"[object Object]"!==i.call(t))return!1;var n=r.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&r.call(t.constructor.prototype,"isPrototypeOf"),s;if(t.constructor&&!n&&!o)return!1;for(s in t);return void 0===s||r.call(t,s)},l=function e(t,n){o&&"__proto__"===n.name?o(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},c=function e(t,n){if("__proto__"===n){if(!r.call(t,n))return;if(s)return s(t,n).value}return t[n]};e.exports=function e(){var t,n,r,i,o,s,f=arguments[0],h=1,p=arguments.length,d=!1;for("boolean"==typeof f&&(d=f,f=arguments[1]||{},h=2),(null==f||"object"!=typeof f&&"function"!=typeof f)&&(f={});h32;)t=t.slice(1);var n=this._priv;r.strictEqual(t.length,32),r.strictEqual(n.length,32);var i=u.box.before(new Uint8Array(t),new Uint8Array(n));return o.from(i)}throw new Error("Invalid algorithm: "+this._algo)},m.prototype.generateKey=function(){var e=[],t,n;if("dsa"===this._algo)return this._dh.generateKeys(),e.push({name:"p",data:this._p.data}),e.push({name:"q",data:this._key.part.q.data}),e.push({name:"g",data:this._g.data}),e.push({name:"y",data:this._dh.getPublicKey()}),e.push({name:"x",data:this._dh.getPrivateKey()}),this._key=new c({type:"dsa",parts:e}),this._isPriv=!0,this._key;if("ecdsa"===this._algo){if(f)return this._dh.generateKeys(),e.push({name:"curve",data:o.from(this._curve)}),e.push({name:"Q",data:this._dh.getPublicKey()}),e.push({name:"d",data:this._dh.getPrivateKey()}),this._key=new c({type:"ecdsa",curve:this._curve,parts:e}),this._isPriv=!0,this._key;var s=this._ecParams.getN(),a=new d(i.randomBytes(s.bitLength())),l=s.subtract(d.ONE);return t=a.mod(l).add(d.ONE),n=this._ecParams.getG().multiply(t),t=o.from(t.toByteArray()),n=o.from(this._ecParams.getCurve().encodePointHex(n),"hex"),this._priv=new b(this._ecParams,t),e.push({name:"curve",data:o.from(this._curve)}),e.push({name:"Q",data:n}),e.push({name:"d",data:t}),this._key=new c({type:"ecdsa",curve:this._curve,parts:e}),this._isPriv=!0,this._key}if("curve25519"===this._algo){var h=u.box.keyPair();return t=o.from(h.secretKey),n=o.from(h.publicKey),t=o.concat([t,n]),r.strictEqual(t.length,64),r.strictEqual(n.length,32),e.push({name:"A",data:n}),e.push({name:"k",data:t}),this._key=new c({type:"curve25519",parts:e}),this._isPriv=!0,this._key}throw new Error("Invalid algorithm: "+this._algo)},m.prototype.generateKeys=m.prototype.generateKey,g.prototype.getCurve=function(){return this.curve},g.prototype.getG=function(){return this.g},g.prototype.getN=function(){return this.n},g.prototype.getH=function(){return this.h},b.prototype.deriveSharedSecret=function(e){r.ok(e instanceof y);var t=e._pub.multiply(this._priv);return o.from(t.getX().toBigInteger().toByteArray())}},function(e,t,n){e.exports={read:p,readPkcs1:g,write:d,writePkcs1:E};var r=n(27),i=n(103),o=n(31).Buffer,s=n(55),a=n(47),u=n(46),l=n(50),c=n(113),f=n(211),h=f.readECDSACurve;function p(e,t){return c.read(e,t,"pkcs1")}function d(e,t){return c.write(e,t,"pkcs1")}function m(e,t){return r.strictEqual(e.peek(),i.Ber.Integer,t+" is not an Integer"),a.mpNormalize(e.readString(i.Ber.Integer,!0))}function g(e,t,n){switch(e){case"RSA":if("public"===t)return y(n);if("private"===t)return b(n);throw new Error("Unknown key type: "+t);case"DSA":if("public"===t)return _(n);if("private"===t)return v(n);throw new Error("Unknown key type: "+t);case"EC":case"ECDSA":if("private"===t)return S(n);if("public"===t)return k(n);throw new Error("Unknown key type: "+t);case"EDDSA":case"EdDSA":if("private"===t)return w(n);throw new Error(t+" keys not supported with EdDSA");default:throw new Error("Unknown key algo: "+e)}}function y(e){var t=m(e,"modulus"),n=m(e,"exponent"),r={type:"rsa",parts:[{name:"e",data:n},{name:"n",data:t}]};return new u(r)}function b(e){var t=m(e,"version");r.strictEqual(t[0],0);var n=m(e,"modulus"),i=m(e,"public exponent"),o=m(e,"private exponent"),s=m(e,"prime1"),a=m(e,"prime2"),u=m(e,"exponent1"),c=m(e,"exponent2"),f=m(e,"iqmp"),h={type:"rsa",parts:[{name:"n",data:n},{name:"e",data:i},{name:"d",data:o},{name:"iqmp",data:f},{name:"p",data:s},{name:"q",data:a},{name:"dmodp",data:u},{name:"dmodq",data:c}]};return new l(h)}function v(e){var t=m(e,"version");r.strictEqual(t.readUInt8(0),0);var n=m(e,"p"),i=m(e,"q"),o=m(e,"g"),s=m(e,"y"),a=m(e,"x"),u={type:"dsa",parts:[{name:"p",data:n},{name:"q",data:i},{name:"g",data:o},{name:"y",data:s},{name:"x",data:a}]};return new l(u)}function w(e){var t=m(e,"version");r.strictEqual(t.readUInt8(0),1);var n=e.readString(i.Ber.OctetString,!0);e.readSequence(160);var o=e.readOID();r.strictEqual(o,"1.3.101.112","the ed25519 curve identifier"),e.readSequence(161);var s=a.readBitString(e),u={type:"ed25519",parts:[{name:"A",data:a.zeroPadToLength(s,32)},{name:"k",data:n}]};return new l(u)}function _(e){var t=m(e,"y"),n=m(e,"p"),r=m(e,"q"),i=m(e,"g"),o={type:"dsa",parts:[{name:"y",data:t},{name:"p",data:n},{name:"q",data:r},{name:"g",data:i}]};return new u(o)}function k(e){e.readSequence();var t=e.readOID();r.strictEqual(t,"1.2.840.10045.2.1","must be ecPublicKey");for(var n=e.readOID(),l,c=Object.keys(s.curves),f=0;f>1,c=-7,f=n?i-1:0,h=n?-1:1,p=e[t+f];for(f+=h,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+e[t+f],f+=h,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+e[t+f],f+=h,c-=8);if(0===o)o=1-l;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=l}return(p?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,u,l=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+f>=1?h/u:h*Math.pow(2,1-f),t*u>=2&&(s++,u/=2),s+f>=c?(a=0,s=c):s+f>=1?(a=(t*u-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;e[n+p]=255&s,p+=d,s/=256,l-=8);e[n+p-d]|=128*m}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(){var t=(0,i.default)(arguments),n=t.pop();e.call(this,t,n)}};var r=n(104),i=o(r);function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(8))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=n(292),i=a(r),o=n(42),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t,n,r){(0,i.default)(t)(e,(0,s.default)(n),r)}e.exports=t.default},function(e,t,n){(function(e){var r=n(99),i=n(757),o=t&&!t.nodeType&&t,s=o&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===o,u=a?r.Buffer:void 0,l=u?u.isBuffer:void 0,c=l||i;e.exports=c}).call(this,n(75)(e))},function(e,t){var n=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function i(e,t){var i=typeof e;return t=null==t?n:t,!!t&&("number"==i||"symbol"!=i&&r.test(e))&&e>-1&&e%1==0&&e0)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=c(t)),r)o.endEmitted?e.emit("error",new k):P(e,o,t,!0);else if(o.ended)e.emit("error",new w);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?P(e,o,t,!1):U(e,o)):P(e,o,t,!1)}else r||(o.reading=!1,U(e,o));return!o.ended&&(o.length=R?e=R:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function M(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=N(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function L(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?F(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,D(e)))}}function F(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(D,e))}function D(e){var t=e._readableState;p("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||e.emit("readable"),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,$(e)}function U(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(z,e,t))}function z(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function H(e){p("readable nexttick read 0"),e.read(0)}function V(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(W,e,t))}function W(e,t){p("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),$(e),t.flowing&&!t.reading&&e.read(0)}function $(e){var t=e._readableState;for(p("flow",t.flowing);t.flowing&&null!==e.read(););}function G(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function Y(e){var t=e._readableState;p("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(J,t,e))}function J(e,t){p("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function Z(e,t){for(var n=0,r=e.length;n=t.highWaterMark:t.length>0)||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Y(this):F(this),null;if(e=M(e,t),0===e&&t.ended)return 0===t.length&&Y(this),null;var r=t.needReadable,i;return p("need readable",r),(0===t.length||t.length-e0?G(e,t):null,null===i?(t.needReadable=!0,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Y(this)),null!==i&&this.emit("data",i),i},j.prototype._read=function(e){this.emit("error",new _("_read()"))},j.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,p("pipe count=%d opts=%j",i.pipesCount,t);var o=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=o?l:b;function u(e,t){p("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,h())}function l(){p("onend"),e.end()}i.endEmitted?r.nextTick(a):n.once("end",a),e.on("unpipe",u);var c=q(n);e.on("drain",c);var f=!1;function h(){p("cleanup"),e.removeListener("close",g),e.removeListener("finish",y),e.removeListener("drain",c),e.removeListener("error",m),e.removeListener("unpipe",u),n.removeListener("end",l),n.removeListener("end",b),n.removeListener("data",d),f=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||c()}function d(t){p("ondata");var r=e.write(t);p("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==Z(i.pipes,e))&&!f&&(p("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function m(t){p("onerror",t),b(),e.removeListener("error",m),0===s(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",y),b()}function y(){p("onfinish"),e.removeListener("close",g),b()}function b(){p("unpipe"),n.unpipe(e)}return n.on("data",d),I(e,"error",m),e.once("close",g),e.once("finish",y),e.emit("pipe",n),i.flowing||(p("pipe resume"),n.resume()),e},j.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,p("on readable",i.length,i.reading),i.length?F(this):i.reading||r.nextTick(H,this))),n},j.prototype.addListener=j.prototype.on,j.prototype.removeListener=function(e,t){var n=a.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(K,this),n},j.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(K,this),t},j.prototype.resume=function(){var e=this._readableState;return e.flowing||(p("resume"),e.flowing=!e.readableListening,V(this,e)),e.paused=!1,this},j.prototype.pause=function(){return p("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(p("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},j.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",function(){if(p("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){if(p("wrapped data"),n.decoder&&(i=n.decoder.write(i)),(!n.objectMode||null!==i&&void 0!==i)&&(n.objectMode||i&&i.length)){var o=t.push(i);o||(r=!0,e.pause())}}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function t(n){return function t(){return e[n].apply(e,arguments)}}(i));for(var o=0;o-1))throw new E(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(I.prototype,"writableBuffer",{enumerable:!1,get:function e(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(I.prototype,"writableHighWaterMark",{enumerable:!1,get:function e(){return this._writableState.highWaterMark}}),I.prototype._write=function(e,t,n){n(new b("_write()"))},I.prototype._writev=null,I.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||H(this,r,n),this},Object.defineProperty(I.prototype,"writableLength",{enumerable:!1,get:function e(){return this._writableState.length}}),Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function e(){return void 0!==this._writableState&&this._writableState.destroyed},set:function e(t){this._writableState&&(this._writableState.destroyed=t)}}),I.prototype.destroy=p.destroy,I.prototype._undestroy=p.undestroy,I.prototype._destroy=function(e,t){t(e)}}).call(this,n(8),n(2))},function(e,t,n){"use strict";e.exports=c;var r=n(135).codes,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,s=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,u=n(136);function l(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.lengththis._repo.blocks.get(e,t),t):t(new Error("first arg must be an array of cids"))}delete(e,t){this._repo.blocks.delete(e,t)}}e.exports=i},function(e,t,n){"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,n){"use strict";(function(t){const r=n(39);function i(e){return parseInt(e.toString("hex"),16)}function o(e){let n=e.toString(16);return n.length%2==1&&(n="0"+n),t.from(n,"hex")}function s(e){return t.from(r.encode(i(e)))}function a(e){return o(r.decode(e))}e.exports={numberToBuffer:o,bufferToNumber:i,varintBufferEncode:s,varintBufferDecode:a}}).call(this,n(0).Buffer)},function(e,t){e.exports=function e(t,n,r){t(n),r&&r(!0===n?null:n)}},function(e,t,n){"use strict";var r=n(177);e.exports=function e(t){return r(null,t)}},function(e,t,n){var r=n(178);function i(e){return e}e.exports=function e(t){return"object"==typeof t&&"function"==typeof t.test?function(e){return t.test(e)}:r(t)||i}},function(e,t,n){"use strict";function r(e){return e}var i=n(178),o=n(78);e.exports=function e(t,n){t=i(t)||r;var s={};return o(function(e){var r=t(e);return s[r]?!!n:(s[r]=!0,!n)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;var r=n(804),i=o(r);function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t,n){(0,i.default)(e,function(){return!t.apply(this,arguments)},n)}e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var r=n(68),i=f(r),o=n(172),s=f(o),a=n(104),u=f(a),l=n(42),c=f(l);function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t,n){n=n||i.default;var r=(0,s.default)(t)?[]:{};e(t,function(e,t,n){(0,c.default)(e)(function(e,i){arguments.length>2&&(i=(0,u.default)(arguments,1)),r[t]=i,n(e)})},function(e){n(e,r)})}e.exports=t.default},function(e,t,n){var r,i;r=this,e.exports=function(e,t,n,r,i){for(t=t.split?t.split("."):t,r=0;r1&&this._buf[this._buf.length-1]===a;)this._buf=this._buf.slice(0,-1)}less(e){const t=this.list(),n=e.list();for(let e=0;ei)return!1}return t.length>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);function i(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}e.exports=i},function(e,t,n){"use strict";const r=n(22);e.exports.dbOpenFailedError=(e=>(e=e||new Error("Cannot open database"),r(e,"ERR_DB_OPEN_FAILED"))),e.exports.dbDeleteFailedError=(e=>(e=e||new Error("Delete failed"),r(e,"ERR_DB_DELETE_FAILED"))),e.exports.dbWriteFailedError=(e=>(e=e||new Error("Write failed"),r(e,"ERR_DB_WRITE_FAILED"))),e.exports.notFoundError=(e=>(e=e||new Error("Not Found"),r(e,"ERR_NOT_FOUND")))},function(e,t,n){"use strict";var r=Object.prototype.toString;e.exports=function(e){var t;return"[object Object]"===r.call(e)&&(t=Object.getPrototypeOf(e),null===t||t===Object.getPrototypeOf({}))}},function(e,t,n){"use strict";const r=n(228),i=n(817),o=n(819),s=n(821),a=n(822),u=n(418);t.KeytransformDatastore=r,t.ShardingDatastore=i,t.MountDatastore=o,t.TieredDatastore=s,t.NamespaceDatastore=a,t.shard=u},function(e,t,n){"use strict";const r=n(33).Key,i=n(818),o=t.PREFIX="/repo/flatfs/shard/",s=t.SHARDING_FN="SHARDING";t.README_FN="_README";class a{constructor(e){this.param=e}fun(e){throw new Error("implement me")}toString(){return`${o}v1/${this.name}/${this.param}`}}class u extends a{constructor(e){super(e),this._padding="".padStart(e,"_"),this.name="prefix"}fun(e){return(e+this._padding).slice(0,this.param)}}class l extends a{constructor(e){super(e),this._padding="".padStart(e,"_"),this.name="suffix"}fun(e){const t=this._padding+e;return t.slice(t.length-this.param)}}class c extends a{constructor(e){super(e),this._padding="".padStart(e+1,"_"),this.name="next-to-last"}fun(e){const t=this._padding+e,n=t.length-this.param-1;return t.slice(n,n+this.param)}}function f(e){if(e=e.trim(),0===e.length)throw new Error("empty shard string");if(!e.startsWith(o))throw new Error(`invalid or no path prefix: ${e}`);const t=e.slice(o.length).split("/"),n=t[0];if("v1"!==n)throw new Error(`expect 'v1' version, got '${n}'`);const r=t[1];if(!t[2])throw new Error("missing param");const i=parseInt(t[2],10);switch(r){case"prefix":return new u(i);case"suffix":return new l(i);case"next-to-last":return new c(i);default:throw new Error(`unkown sharding function: ${r}`)}}t.readShardFun=((e,t,n)=>{const i=new r(e).child(new r(s)),o="function"==typeof t.getRaw?t.getRaw.bind(t):t.get.bind(t);o(i,(e,t)=>{if(e)return n(e);let r;try{r=f((t||"").toString().trim())}catch(e){return n(e)}n(null,r)})}),t.readme=i,t.parseShardFun=f,t.Prefix=u,t.Suffix=l,t.NextToLast=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(824),i=a(r),o=n(175),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default),e.exports=t.default},function(e,t){function n(e){return function(t){return null==t?void 0:t[e]}}e.exports=n},function(e,t,n){t.AbstractLevelDOWN=n(831),t.AbstractIterator=n(422),t.AbstractChainedBatch=n(423)},function(e,t,n){(function(t){function n(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._ended=!1,this._nexting=!1}n.prototype.next=function(e){var n=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return n._ended?(t.nextTick(e,new Error("cannot call next() after end()")),n):n._nexting?(t.nextTick(e,new Error("cannot call next() before previous next() has completed")),n):(n._nexting=!0,n._next(function(){n._nexting=!1,e.apply(null,arguments)}),n)},n.prototype._next=function(e){t.nextTick(e)},n.prototype.seek=function(e){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");e=this.db._serializeKey(e),this._seek(e)},n.prototype._seek=function(e){},n.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return t.nextTick(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},n.prototype._end=function(e){t.nextTick(e)},e.exports=n}).call(this,n(2))},function(e,t){function n(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._operations=[],this._written=!1}n.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},n.prototype.put=function(e,t){this._checkWritten();var n=this.db._checkKey(e)||this.db._checkValue(t);if(n)throw n;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t),this},n.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},n.prototype.del=function(e){this._checkWritten();var t=this.db._checkKey(e);if(t)throw t;return e=this.db._serializeKey(e),this._del(e),this},n.prototype._del=function(e){this._operations.push({type:"del",key:e})},n.prototype.clear=function(){return this._checkWritten(),this._clear(),this},n.prototype._clear=function(){this._operations=[]},n.prototype.write=function(e,t){if(this._checkWritten(),"function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("write() requires a callback argument");"object"==typeof e&&null!==e||(e={}),this._written=!0,this._write(e,t)},n.prototype._write=function(e,t){this.db._batch(this._operations,e,t)},e.exports=n},function(e,t){function n(){var e,t=new Promise(function(t,n){e=function e(r,i){r?n(r):t(i)}});return e.promise=t,e}e.exports=n},function(e,t,n){(function(t){function n(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._ended=!1,this._nexting=!1}n.prototype.next=function(e){var n=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return n._ended?(t.nextTick(e,new Error("cannot call next() after end()")),n):n._nexting?(t.nextTick(e,new Error("cannot call next() before previous next() has completed")),n):(n._nexting=!0,n._next(function(){n._nexting=!1,e.apply(null,arguments)}),n)},n.prototype._next=function(e){t.nextTick(e)},n.prototype.seek=function(e){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");e=this.db._serializeKey(e),this._seek(e)},n.prototype._seek=function(e){},n.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return t.nextTick(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},n.prototype._end=function(e){t.nextTick(e)},e.exports=n}).call(this,n(2))},function(e,t){function n(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._operations=[],this._written=!1}n.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},n.prototype.put=function(e,t){this._checkWritten();var n=this.db._checkKey(e)||this.db._checkValue(t);if(n)throw n;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t),this},n.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},n.prototype.del=function(e){this._checkWritten();var t=this.db._checkKey(e);if(t)throw t;return e=this.db._serializeKey(e),this._del(e),this},n.prototype._del=function(e){this._operations.push({type:"del",key:e})},n.prototype.clear=function(){return this._checkWritten(),this._clear(),this},n.prototype._clear=function(){this._operations=[]},n.prototype.write=function(e,t){if(this._checkWritten(),"function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("write() requires a callback argument");"object"==typeof e&&null!==e||(e={}),this._written=!0,this._write(e,t)},n.prototype._write=function(e,t){this.db._batch(this._operations,e,t)},e.exports=n},function(e,t,n){t.AbstractLevelDOWN=n(428),t.AbstractIterator=n(429),t.AbstractChainedBatch=n(430),t.isLevelDOWN=n(843)},function(e,t,n){(function(t,r){var i=n(69),o=n(429),s=n(430);function a(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"}a.prototype.open=function(e,n){var r=this,i=this.status;if("function"==typeof e&&(n=e),"function"!=typeof n)throw new Error("open() requires a callback argument");"object"!=typeof e&&(e={}),e.createIfMissing=0!=e.createIfMissing,e.errorIfExists=!!e.errorIfExists,"function"==typeof this._open?(this.status="opening",this._open(e,function(e){if(e)return r.status=i,n(e);r.status="open",n()})):(this.status="open",t.nextTick(n))},a.prototype.close=function(e){var n=this,r=this.status;if("function"!=typeof e)throw new Error("close() requires a callback argument");"function"==typeof this._close?(this.status="closing",this._close(function(t){if(t)return n.status=r,e(t);n.status="closed",e()})):(this.status="closed",t.nextTick(e))},a.prototype.get=function(e,n,r){var i;if("function"==typeof n&&(r=n),"function"!=typeof r)throw new Error("get() requires a callback argument");return(i=this._checkKey(e,"key",this._isBuffer))?r(i):(this._isBuffer(e)||(e=String(e)),"object"!=typeof n&&(n={}),n.asBuffer=0!=n.asBuffer,"function"==typeof this._get?this._get(e,n,r):void t.nextTick(function(){r(new Error("NotFound"))}))},a.prototype.put=function(e,n,r,i){var o;if("function"==typeof r&&(i=r),"function"!=typeof i)throw new Error("put() requires a callback argument");return(o=this._checkKey(e,"key",this._isBuffer))?i(o):(this._isBuffer(e)||(e=String(e)),null==n||this._isBuffer(n)||t.browser||(n=String(n)),"object"!=typeof r&&(r={}),"function"==typeof this._put?this._put(e,n,r,i):void t.nextTick(i))},a.prototype.del=function(e,n,r){var i;if("function"==typeof n&&(r=n),"function"!=typeof r)throw new Error("del() requires a callback argument");return(i=this._checkKey(e,"key",this._isBuffer))?r(i):(this._isBuffer(e)||(e=String(e)),"object"!=typeof n&&(n={}),"function"==typeof this._del?this._del(e,n,r):void t.nextTick(r))},a.prototype.batch=function(e,n,r){if(!arguments.length)return this._chainedBatch();if("function"==typeof n&&(r=n),"function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return r(new Error("batch(array) requires an array argument"));n&&"object"==typeof n||(n={});for(var i=0,o=e.length,s,a;i0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:w;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),w(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),w()}function v(){g("onfinish"),e.removeListener("close",b),w()}function w(){g("unpipe"),n.unpipe(e)}return n.on("data",m),_(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o{const n=e+"/"+s;o("locking %s",n),a[n]=!0;const r={close(e){a[n]&&delete a[n],i(e)}};i(()=>{t(null,r)})}),t.locked=((e,t)=>{const n=e+"/"+s;o("checking lock: %s");const r=a[n];i(()=>{t(null,r)})})},function(e,t){e.exports=function(e){var t,n=!1;function r(r){if(!r)throw new Error("must be passed a readable");t=r,n&&e(t)}return r.resolve=r.ready=r.start=function(i){return n=!0,e=i||e,t&&e(t),r},r}},function(e,t,n){var r=n(226),i=n(436);e.exports=function(){var e=r(),t=i();return{source:e,sink:t,resolve:function(n){e.resolve(n.source),t.resolve(n.sink)}}}},function(e,t){var n=t.once=function(e){return function(t,n){if(t)return n(t);if(null!=e){var r=e;e=null,n(null,r)}else n(!0)}},r=t.depthFirst=function(e,t){var r=[],i;return r.unshift(n(e)),function e(n,o){return r.length?i?o(i):void r[0](n,function(n,s){if(n){if(!0!==n){for(i=n,r.shift();r.length;)r.shift()(n,function(){});return o(n)}return r.shift(),e(null,o)}r.unshift(t(s)),o(n,s)}):o(!0)}},i=t.widthFirst=function(e,t){var r=[];return r.push(n(e)),function e(n,i){if(!r.length)return i(!0);r[0](n,function(n,o){if(n)return r.shift(),e(null,i);r.push(t(o)),i(n,o)})}},o=t.leafFirst=function(e,t){var r=[],i=[];return r.push(n(e)),function e(n,o){r[0](n,function(n,s){if(n)return r.shift(),i.length?o(null,i.shift()):o(!0);r.unshift(t(s)),i.unshift(s),e(null,o)})}}},function(e,t,n){"use strict";const r=n(416),i=Object.prototype.hasOwnProperty,o=Object.propertyIsEnumerable,s=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}),a=this,u={concatArrays:!1},l=e=>{const t=[];for(const n in e)i.call(e,n)&&t.push(n);if(Object.getOwnPropertySymbols){const n=Object.getOwnPropertySymbols(e);for(let r=0;r{s(t,n,c(e[n]))}),t}function h(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return l(e).forEach(n=>{s(t,n,c(e[n]))}),t}const p=(e,t,n,r)=>(n.forEach(n=>{n in e&&e[n]!==Object.getPrototypeOf(e)?s(e,n,m(e[n],t[n],r)):s(e,n,c(t[n]))}),e),d=(e,t,n)=>{let r=e.slice(0,0),o=0;return[e,t].forEach(t=>{const a=[];for(let n=0;n-1===a.indexOf(e)),n)}),r};function m(e,t,n){return n.concatArrays&&Array.isArray(e)&&Array.isArray(t)?d(e,t,n):r(t)&&r(e)?p(e,t,l(t),n):c(t)}e.exports=function(){const e=m(c(u),this!==a&&this||{},u);let t={foobar:{}};for(let n=0;n(e=e.slice(1),new s(e))}});function h(e){let t;try{t=a(e)}catch(e){t=!1}if(t)throw new Error("The object passed has circular references");function n(e){if(!e||r.isBuffer(e)||"string"==typeof e)return e;if(Array.isArray(e))return e.map(n);if(s.isCID(e))return c(e);const t=Object.keys(e);if(1===t.length&&"/"===t[0])return c(e["/"]);if(t.length>0){const r={};return t.forEach(t=>{"object"==typeof e[t]?r[t]=n(e[t]):r[t]=e[t]}),r}return e}return n(e)}t=e.exports,t.serialize=((e,t)=>{let n;try{const r=h(e);n=i.encode(r)}catch(e){return setImmediate(()=>t(e))}setImmediate(()=>t(null,n))}),t.deserialize=((e,t)=>{let n;try{n=f.decodeFirst(e)}catch(e){return setImmediate(()=>t(e))}setImmediate(()=>t(null,n))}),t.cid=((e,n,r)=>{"function"==typeof n&&(r=n,n={}),n=n||{};const i=n.hashAlg||u.defaultHashAlg,a=n.hashLen,l=void 0===n.version?1:n.version;t.serialize(e,(e,t)=>{if(e)return r(e);o(t,i,a,(e,t)=>{if(e)return r(e);r(null,new s(l,u.multicodec,t))})})})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t,r){const i=n(387),o=n(62),s=n(861),a=n(305),u=n(232),l=n(442),c=n(443),{URL:f}=n(306);class h{constructor(e){e=e||{},!e.size||e.size<65536?e.size=65536:e.size=a.nextPowerOf2(e.size),this._heap=new ArrayBuffer(e.size),this._heap8=new Uint8Array(this._heap),this._buffer=t.from(this._heap),this._reset(),this._knownTags=Object.assign({0:e=>new Date(e),1:e=>new Date(1e3*e),2:e=>a.arrayBufferToBignumber(e),3:e=>u.NEG_ONE.minus(a.arrayBufferToBignumber(e)),4:e=>u.TEN.pow(e[0]).times(e[1]),5:e=>u.TWO.pow(e[0]).times(e[1]),32:e=>new f(e),35:e=>new RegExp(e)},e.tags),this.parser=s(r,{log:console.log.bind(console),pushInt:this.pushInt.bind(this),pushInt32:this.pushInt32.bind(this),pushInt32Neg:this.pushInt32Neg.bind(this),pushInt64:this.pushInt64.bind(this),pushInt64Neg:this.pushInt64Neg.bind(this),pushFloat:this.pushFloat.bind(this),pushFloatSingle:this.pushFloatSingle.bind(this),pushFloatDouble:this.pushFloatDouble.bind(this),pushTrue:this.pushTrue.bind(this),pushFalse:this.pushFalse.bind(this),pushUndefined:this.pushUndefined.bind(this),pushNull:this.pushNull.bind(this),pushInfinity:this.pushInfinity.bind(this),pushInfinityNeg:this.pushInfinityNeg.bind(this),pushNaN:this.pushNaN.bind(this),pushNaNNeg:this.pushNaNNeg.bind(this),pushArrayStart:this.pushArrayStart.bind(this),pushArrayStartFixed:this.pushArrayStartFixed.bind(this),pushArrayStartFixed32:this.pushArrayStartFixed32.bind(this),pushArrayStartFixed64:this.pushArrayStartFixed64.bind(this),pushObjectStart:this.pushObjectStart.bind(this),pushObjectStartFixed:this.pushObjectStartFixed.bind(this),pushObjectStartFixed32:this.pushObjectStartFixed32.bind(this),pushObjectStartFixed64:this.pushObjectStartFixed64.bind(this),pushByteString:this.pushByteString.bind(this),pushByteStringStart:this.pushByteStringStart.bind(this),pushUtf8String:this.pushUtf8String.bind(this),pushUtf8StringStart:this.pushUtf8StringStart.bind(this),pushSimpleUnassigned:this.pushSimpleUnassigned.bind(this),pushTagUnassigned:this.pushTagUnassigned.bind(this),pushTagStart:this.pushTagStart.bind(this),pushTagStart4:this.pushTagStart4.bind(this),pushTagStart8:this.pushTagStart8.bind(this),pushBreak:this.pushBreak.bind(this)},this._heap)}get _depth(){return this._parents.length}get _currentParent(){return this._parents[this._depth-1]}get _ref(){return this._currentParent.ref}_closeParent(){var e=this._parents.pop();if(e.length>0)throw new Error(`Missing ${e.length} elements`);switch(e.type){case u.PARENT.TAG:this._push(this.createTag(e.ref[0],e.ref[1]));break;case u.PARENT.BYTE_STRING:this._push(this.createByteString(e.ref,e.length));break;case u.PARENT.UTF8_STRING:this._push(this.createUtf8String(e.ref,e.length));break;case u.PARENT.MAP:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createMap(e.ref,e.length));break;case u.PARENT.OBJECT:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createObject(e.ref,e.length));break;case u.PARENT.ARRAY:this._push(this.createArray(e.ref,e.length))}this._currentParent&&this._currentParent.type===u.PARENT.TAG&&this._dec()}_dec(){const e=this._currentParent;e.length<0||(e.length--,0===e.length&&this._closeParent())}_push(e,t){const n=this._currentParent;switch(n.values++,n.type){case u.PARENT.ARRAY:case u.PARENT.BYTE_STRING:case u.PARENT.UTF8_STRING:n.length>-1?this._ref[this._ref.length-n.length]=e:this._ref.push(e),this._dec();break;case u.PARENT.OBJECT:null!=n.tmpKey?(this._ref[n.tmpKey]=e,n.tmpKey=null,this._dec()):(n.tmpKey=e,"string"!=typeof n.tmpKey&&(n.type=u.PARENT.MAP,n.ref=a.buildMap(n.ref)));break;case u.PARENT.MAP:null!=n.tmpKey?(this._ref.set(n.tmpKey,e),n.tmpKey=null,this._dec()):n.tmpKey=e;break;case u.PARENT.TAG:this._ref.push(e),t||this._dec();break;default:throw new Error("Unknown parent type")}}_createParent(e,t,n){this._parents[this._depth]={type:t,length:n,ref:e,values:0,tmpKey:null}}_reset(){this._res=[],this._parents=[{type:u.PARENT.ARRAY,length:-1,ref:this._res,values:0,tmpKey:null}]}createTag(e,t){const n=this._knownTags[e];return n?n(t):new c(e,t)}createMap(e,t){return e}createObject(e,t){return e}createArray(e,t){return e}createByteString(e,n){return t.concat(e)}createByteStringFromHeap(e,n){return e===n?t.alloc(0):t.from(this._heap.slice(e,n))}createInt(e){return e}createInt32(e,t){return a.buildInt32(e,t)}createInt64(e,t,n,r){return a.buildInt64(e,t,n,r)}createFloat(e){return e}createFloatSingle(e,t,n,r){return i.read([e,t,n,r],0,!1,23,4)}createFloatDouble(e,t,n,r,o,s,a,u){return i.read([e,t,n,r,o,s,a,u],0,!1,52,8)}createInt32Neg(e,t){return-1-a.buildInt32(e,t)}createInt64Neg(e,t,n,r){const i=a.buildInt32(e,t),s=a.buildInt32(n,r);return i>u.MAX_SAFE_HIGH?u.NEG_ONE.minus(new o(i).times(u.SHIFT32).plus(s)):-1-(i*u.SHIFT32+s)}createTrue(){return!0}createFalse(){return!1}createNull(){return null}createUndefined(){}createInfinity(){return 1/0}createInfinityNeg(){return-1/0}createNaN(){return NaN}createNaNNeg(){return NaN}createUtf8String(e,t){return e.join("")}createUtf8StringFromHeap(e,t){return e===t?"":this._buffer.toString("utf8",e,t)}createSimpleUnassigned(e){return new l(e)}pushInt(e){this._push(this.createInt(e))}pushInt32(e,t){this._push(this.createInt32(e,t))}pushInt64(e,t,n,r){this._push(this.createInt64(e,t,n,r))}pushFloat(e){this._push(this.createFloat(e))}pushFloatSingle(e,t,n,r){this._push(this.createFloatSingle(e,t,n,r))}pushFloatDouble(e,t,n,r,i,o,s,a){this._push(this.createFloatDouble(e,t,n,r,i,o,s,a))}pushInt32Neg(e,t){this._push(this.createInt32Neg(e,t))}pushInt64Neg(e,t,n,r){this._push(this.createInt64Neg(e,t,n,r))}pushTrue(){this._push(this.createTrue())}pushFalse(){this._push(this.createFalse())}pushNull(){this._push(this.createNull())}pushUndefined(){this._push(this.createUndefined())}pushInfinity(){this._push(this.createInfinity())}pushInfinityNeg(){this._push(this.createInfinityNeg())}pushNaN(){this._push(this.createNaN())}pushNaNNeg(){this._push(this.createNaNNeg())}pushArrayStart(){this._createParent([],u.PARENT.ARRAY,-1)}pushArrayStartFixed(e){this._createArrayStartFixed(e)}pushArrayStartFixed32(e,t){const n=a.buildInt32(e,t);this._createArrayStartFixed(n)}pushArrayStartFixed64(e,t,n,r){const i=a.buildInt64(e,t,n,r);this._createArrayStartFixed(i)}pushObjectStart(){this._createObjectStartFixed(-1)}pushObjectStartFixed(e){this._createObjectStartFixed(e)}pushObjectStartFixed32(e,t){const n=a.buildInt32(e,t);this._createObjectStartFixed(n)}pushObjectStartFixed64(e,t,n,r){const i=a.buildInt64(e,t,n,r);this._createObjectStartFixed(i)}pushByteStringStart(){this._parents[this._depth]={type:u.PARENT.BYTE_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushByteString(e,t){this._push(this.createByteStringFromHeap(e,t))}pushUtf8StringStart(){this._parents[this._depth]={type:u.PARENT.UTF8_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushUtf8String(e,t){this._push(this.createUtf8StringFromHeap(e,t))}pushSimpleUnassigned(e){this._push(this.createSimpleUnassigned(e))}pushTagStart(e){this._parents[this._depth]={type:u.PARENT.TAG,length:1,ref:[e]}}pushTagStart4(e,t){this.pushTagStart(a.buildInt32(e,t))}pushTagStart8(e,t,n,r){this.pushTagStart(a.buildInt64(e,t,n,r))}pushTagUnassigned(e){this._push(this.createTag(e))}pushBreak(){if(this._currentParent.length>-1)throw new Error("Unexpected break");this._closeParent()}_createObjectStartFixed(e){0!==e?this._createParent({},u.PARENT.OBJECT,e):this._push(this.createObject({}))}_createArrayStartFixed(e){0!==e?this._createParent(new Array(e),u.PARENT.ARRAY,e):this._push(this.createArray([]))}_decode(e){if(0===e.byteLength)throw new Error("Input too short");this._reset(),this._heap8.set(e);const t=this.parser.parse(e.byteLength);if(this._depth>1){for(;0===this._currentParent.length;)this._closeParent();if(this._depth>1)throw new Error("Undeterminated nesting")}if(t>0)throw new Error("Failed to parse");if(0===this._res.length)throw new Error("No valid result")}decodeFirst(e){return this._decode(e),this._res[0]}decodeAll(e){return this._decode(e),this._res}static decode(e,n){"string"==typeof e&&(e=t.from(e,n||"hex"));const r=new h({size:e.length});return r.decodeFirst(e)}static decodeAll(e,n){"string"==typeof e&&(e=t.from(e,n||"hex"));const r=new h({size:e.length});return r.decodeAll(e)}}h.decodeFirst=h.decode,e.exports=h}).call(this,n(0).Buffer,n(8))},function(e,t,n){"use strict";const r=n(232),i=r.MT,o=r.SIMPLE,s=r.SYMS;class a{constructor(e){if("number"!=typeof e)throw new Error("Invalid Simple type: "+typeof e);if(e<0||e>255||(0|e)!==e)throw new Error("value must be a small positive integer: "+e);this.value=e}toString(){return"simple("+this.value+")"}inspect(){return"simple("+this.value+")"}encodeCBOR(e){return e._pushInt(this.value,i.SIMPLE_FLOAT)}static isSimple(e){return e instanceof a}static decode(e,t){switch(null==t&&(t=!0),e){case o.FALSE:return!1;case o.TRUE:return!0;case o.NULL:return t?null:s.NULL;case o.UNDEFINED:return t?void 0:s.UNDEFINED;case-1:if(!t)throw new Error("Invalid BREAK");return s.BREAK;default:return new a(e)}}}e.exports=a},function(e,t,n){"use strict";class r{constructor(e,t,n){if(this.tag=e,this.value=t,this.err=n,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(e){return e._pushTag(this.tag),e.pushAny(this.value)}convert(e){var t,n;if(n=null!=e?e[this.tag]:void 0,"function"!=typeof n&&(n=r["_tag"+this.tag],"function"!=typeof n))return this;try{return n.call(r,this.value)}catch(e){return t=e,this.err=t,this}}}e.exports=r},function(e,t,n){"use strict";const r=self.location?self.location.protocol+"//"+self.location.host:"",i=self.URL;class o{constructor(e,t=r){this.super=new i(e,t),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set origin(e){this.super.origin=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set searchParams(e){this.super.searchParams=e}set username(e){this.super.username=e}createObjectURL(e){return this.super.createObjectURL(e)}revokeObjectURL(e){this.super.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}}function s(e){if("string"==typeof e){const t=new i(e);return t.toString()}if(!(e instanceof i)){const t=e.username&&e.password?`${e.username}:${e.password}@`:"",n=e.auth?e.auth+"@":"",r=e.port?":"+e.port:"",i=e.protocol?e.protocol+"//":"",o=e.host||"",s=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),u=e.hash||"",l=e.pathname||"",c=e.path||l+a;return`${i}${t||n}${o||s+r}${c}${u}`}}e.exports={URLWithLegacySupport:o,URLSearchParams:self.URLSearchParams,defaultBase:r,format:s}},function(e,t,n){(function(r,i){var o; + */function i(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i=0;h--)if(a[h]!==u[h])return!1;for(h=a.length-1;h>=0;h--)if(c=a[h],!_(e[c],t[c],n,r))return!1;return!0}function E(e,t,n){_(e,t,!0)&&v(e,t,n,"notDeepStrictEqual",E)}function S(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function x(e){var t;try{e()}catch(e){t=e}return t}function C(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=x(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&v(i,n,"Missing expected exception"+r);var o="string"==typeof r,a=!e&&s.isError(i),l=!e&&i&&!n;if((a&&o&&S(i,n)||l)&&v(i,n,"Got unwanted exception"+r),e&&i&&n&&!S(i,n)||!e&&i)throw i}function A(e,t){e||v(e,!0,t,"==",A)}f.AssertionError=function e(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=y(this),this.generatedMessage=!0);var n=t.stackStartFunction||v;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var i=r.stack,o=d(n),s=i.indexOf("\n"+o);if(s>=0){var a=i.indexOf("\n",s+1);i=i.substring(a+1)}this.stack=i}}},s.inherits(f.AssertionError,Error),f.fail=v,f.ok=b,f.equal=function e(t,n,r){t!=n&&v(t,n,r,"==",f.equal)},f.notEqual=function e(t,n,r){t==n&&v(t,n,r,"!=",f.notEqual)},f.deepEqual=function e(t,n,r){_(t,n,!1)||v(t,n,r,"deepEqual",f.deepEqual)},f.deepStrictEqual=function e(t,n,r){_(t,n,!0)||v(t,n,r,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function e(t,n,r){_(t,n,!1)&&v(t,n,r,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=E,f.strictEqual=function e(t,n,r){t!==n&&v(t,n,r,"===",f.strictEqual)},f.notStrictEqual=function e(t,n,r){t===n&&v(t,n,r,"!==",f.notStrictEqual)},f.throws=function(e,t,n){C(!0,e,t,n)},f.doesNotThrow=function(e,t,n){C(!1,e,t,n)},f.ifError=function(e){if(e)throw e},f.strict=r(A,f,{equal:f.strictEqual,deepEqual:f.deepStrictEqual,notEqual:f.notStrictEqual,notDeepEqual:f.notDeepStrictEqual}),f.strict.strict=f.strict;var T=Object.keys||function(e){var t=[];for(var n in e)a.call(e,n)&&t.push(n);return t}}).call(this,n(8))},function(e,t,n){(function(t,r){var i=n(24),o=n(62).Stream,s=n(14),a=/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;function l(e){return e.charAt(0).toUpperCase()+e.slice(1)}function u(e,t,n,r,o){throw new i.AssertionError({message:s.format("%s (%s) is required",e,t),actual:void 0===o?typeof r:o(r),expected:t,operator:n||"===",stackStartFunction:u.caller})}function c(e){return Object.prototype.toString.call(e).slice(8,-1)}function h(){}var f={bool:{check:function(e){return"boolean"==typeof e}},func:{check:function(e){return"function"==typeof e}},string:{check:function(e){return"string"==typeof e}},object:{check:function(e){return"object"==typeof e&&null!==e}},number:{check:function(e){return"number"==typeof e&&!isNaN(e)}},finite:{check:function(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}},buffer:{check:function(e){return t.isBuffer(e)},operator:"Buffer.isBuffer"},array:{check:function(e){return Array.isArray(e)},operator:"Array.isArray"},stream:{check:function(e){return e instanceof o},operator:"instanceof",actual:c},date:{check:function(e){return e instanceof Date},operator:"instanceof",actual:c},regexp:{check:function(e){return e instanceof RegExp},operator:"instanceof",actual:c},uuid:{check:function(e){return"string"==typeof e&&a.test(e)},operator:"isUUID"}};function p(e){var t=Object.keys(f),n;return n=r.env.NODE_NDEBUG?h:function(e,t){e||u(t,"true",e)},t.forEach(function(t){if(e)n[t]=h;else{var r=f[t];n[t]=function(e,n){r.check(e)||u(n,t,r.operator,e,r.actual)}}}),t.forEach(function(t){var r="optional"+l(t);if(e)n[r]=h;else{var i=f[t];n[r]=function(e,n){void 0!==e&&null!==e&&(i.check(e)||u(n,t,i.operator,e,i.actual))}}}),t.forEach(function(t){var r="arrayOf"+l(t);if(e)n[r]=h;else{var i=f[t],o="["+t+"]";n[r]=function(e,t){var n;for(Array.isArray(e)||u(t,o,i.operator,e,i.actual),n=0;n 3 bytes.");let s=o.decode(r);if(!t.isValidCode(s))throw new Error(`multihash unknown function code: 0x${s.toString(16)}`);r=r.slice(o.decode.bytes);let a=o.decode(r);if(a<1)throw new Error(`multihash invalid length: 0x${a.toString(16)}`);if(r=r.slice(o.decode.bytes),r.length!==a)throw new Error(`multihash length inconsistent: 0x${r.toString("hex")}`);return{code:s,name:i.codes[s],length:a,digest:r}},t.encode=function n(r,i,s){if(!r||!i)throw new Error("multihash encode requires at least two args: digest, code");const a=t.coerceCode(i);if(!e.isBuffer(r))throw new Error("digest should be a Buffer");if(null==s&&(s=r.length),s&&r.length!==s)throw new Error("digest length should be equal to specified length.");return e.concat([e.from(o.encode(a)),e.from(o.encode(s)),r])},t.coerceCode=function e(n){let r=n;if("string"==typeof n){if(!i.names[n])throw new Error(`Unrecognized hash function named: ${n}`);r=i.names[n]}if("number"!=typeof r)throw new Error(`Hash function code should be a number. Got: ${r}`);if(!i.codes[r]&&!t.isAppCode(r))throw new Error(`Unrecognized function code: ${r}`);return r},t.isAppCode=function e(t){return t>0&&t<16},t.isValidCode=function e(n){return!!t.isAppCode(n)||!!i.codes[n]},t.validate=s,t.prefix=function e(t){return s(t),t.slice(0,2)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(403),i=n(832),o=n(262),s=n(406);t.Key=r,t.MemoryDatastore=i,t.utils=o,t.Errors=s},function(e,t,n){"use strict";(function(t){var r=n(0),i=r.Buffer,o={},s;for(s in r)r.hasOwnProperty(s)&&"SlowBuffer"!==s&&"Buffer"!==s&&(o[s]=r[s]);var a=o.Buffer={};for(s in i)i.hasOwnProperty(s)&&"allocUnsafe"!==s&&"allocUnsafeSlow"!==s&&(a[s]=i[s]);if(o.Buffer.prototype=i.prototype,a.from&&a.from!==Uint8Array.from||(a.from=function(e,t,n){if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return i(e,t,n)}),a.alloc||(a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=i(e);return t&&0!==t.length?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r}),!o.kStringMaxLength)try{o.kStringMaxLength=t.binding("buffer").kStringMaxLength}catch(e){}o.constants||(o.constants={MAX_LENGTH:o.kMaxLength},o.kStringMaxLength&&(o.constants.MAX_STRING_LENGTH=o.kStringMaxLength)),e.exports=o}).call(this,n(3))},function(e,t,n){(function(t,r){var i=n(21),o=n(745),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 l(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(s.isArrayBuffer(e)||s.isArrayBufferView(e))if(void 0!==r&&e instanceof r)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var n=0;n15?(i=Date.now(),l(e)):(n.push(e),1===n.length&&a.setAttribute("a",o=!o))}}s.nextTick=s.setImmediate}(),s.isNodejs=void 0!==t&&t.versions&&t.versions.node,s.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},s.isArrayBufferView=function(e){return e&&s.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},s.ByteBuffer=l,s.ByteStringBuffer=l;var u=4096;function c(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var n=s.isArrayBuffer(e),r=s.isArrayBufferView(e);if(n||r)return this.data=n?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==e&&void 0!==e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}s.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},s.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},s.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},s.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},s.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var n=this.data;t>0;)1&t&&(n+=e),t>>>=1,t>0&&(e+=e);return this.data=n,this._optimizeConstructedString(t),this},s.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},s.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(s.encodeUtf8(e))},s.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},s.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},s.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},s.ByteStringBuffer.prototype.putInt=function(e,t){a(t);var n="";do{t-=8,n+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(n)},s.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},s.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<=n&&(t-=n<<1),t},s.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},s.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},s.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},s.ByteStringBuffer.prototype.copy=function(){var e=s.createBuffer(this.data);return e.read=this.read,e},s.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},s.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},s.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},s.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var n=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),r=new Uint8Array(this.length()+t);return r.set(n),this.data=new DataView(r.buffer),this},s.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},s.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var n=0;n>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},s.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},s.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},s.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},s.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},s.DataBuffer.prototype.putInt=function(e,t){a(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},s.DataBuffer.prototype.putSignedInt=function(e,t){return a(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},s.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<=n&&(t-=n<<1),t},s.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},s.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},s.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},s.DataBuffer.prototype.copy=function(){return new s.DataBuffer(this)},s.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},s.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},s.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},s.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(n+=e),t>>>=1,t>0&&(e+=e);return n},s.xorBytes=function(e,t,n){for(var r="",i="",o="",s=0,a=0;n>0;--n,++s)i=e.charCodeAt(s)^t.charCodeAt(s),a>=10&&(r+=o,o="",a=0),o+=String.fromCharCode(i),++a;return r+=o,r},s.hexToBytes=function(e){var t="",n=0;for(!0&e.length&&(n=1,t+=String.fromCharCode(parseInt(e[0],16)));n>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";s.encode64=function(e,t){for(var n="",r="",i,o,s,a=0;a>2),n+=h.charAt((3&i)<<4|o>>4),isNaN(o)?n+="==":(n+=h.charAt((15&o)<<2|s>>6),n+=isNaN(s)?"=":h.charAt(63&s)),t&&n.length>t&&(r+=n.substr(0,t)+"\r\n",n=n.substr(t));return r+=n,r},s.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",n,r,i,o,s=0;s>4),64!==i&&(t+=String.fromCharCode((15&r)<<4|i>>2),64!==o&&(t+=String.fromCharCode((3&i)<<6|o)));return t},s.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},s.decodeUtf8=function(e){return decodeURIComponent(escape(e))},s.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:o.encode,decode:o.decode}},s.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},s.binary.raw.decode=function(e,t,n){var r=t;r||(r=new Uint8Array(e.length)),n=n||0;for(var i=n,o=0;o>2),n+=h.charAt((3&i)<<4|o>>4),isNaN(o)?n+="==":(n+=h.charAt((15&o)<<2|s>>6),n+=isNaN(s)?"=":h.charAt(63&s)),t&&n.length>t&&(r+=n.substr(0,t)+"\r\n",n=n.substr(t));return r+=n,r},s.binary.base64.decode=function(e,t,n){var r=t,i,o,s,a;r||(r=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),n=n||0;for(var l=0,u=n;l>4,64!==s&&(r[u++]=(15&o)<<4|s>>2,64!==a&&(r[u++]=(3&s)<<6|a));return t?u-n:r.subarray(0,u)},s.binary.base58.encode=function(e,t){return s.binary.baseN.encode(e,p,t)},s.binary.base58.decode=function(e,t){return s.binary.baseN.decode(e,p,t)},s.text={utf8:{},utf16:{}},s.text.utf8.encode=function(e,t,n){e=s.encodeUtf8(e);var r=t;r||(r=new Uint8Array(e.length)),n=n||0;for(var i=n,o=0;o0?(o=n[r].substring(0,i),s=n[r].substring(i+1)):(o=n[r],s=null),o in t||(t[o]=[]),o in Object.prototype||null===s||t[o].push(unescape(s))}return t},n;return void 0===e?(null===w&&(w="undefined"!=typeof window&&window.location&&window.location.search?t(window.location.search.substring(1)):{}),n=w):n=t(e),n},s.parseFragment=function(e){var t=e,n="",r=e.indexOf("?");r>0&&(t=e.substring(0,r),n=e.substring(r+1));var i=t.split("/");i.length>0&&""===i[0]&&i.shift();var o=""===n?{}:s.getQueryVariables(n);return{pathString:t,queryString:n,path:i,query:o}},s.makeRequest=function(e){var t=s.parseFragment(e),n={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,n){var r;return void 0===e?r=t.query:(r=t.query[e],r&&void 0!==n&&(r=r[n])),r},getQueryLast:function(e,t){var r,i=n.getQuery(e);return r=i?i[i.length-1]:t,r}};return n},s.makeLink=function(e,t,n){e=jQuery.isArray(e)?e.join("/"):e;var r=jQuery.param(t||{});return n=n||"",e+(r.length>0?"?"+r:"")+(n.length>0?"#"+n:"")},s.setPath=function(e,t,n){if("object"==typeof e&&null!==e)for(var r=0,i=t.length;r0&&o.push(r),s=t.lastIndex;var a=n[0][1];switch(a){case"s":case"o":i");break;case"%":o.push("%");break;default:o.push("<%"+a+"?>")}}return o.push(e.substring(s)),o.join("")},s.formatNumber=function(e,t,n,r){var i=e,o=isNaN(t=Math.abs(t))?2:t,s=void 0===n?",":n,a=void 0===r?".":r,l=i<0?"-":"",u=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",c=u.length>3?u.length%3:0;return l+(c?u.substr(0,c)+a:"")+u.substr(c).replace(/(\d{3})(?=\d)/g,"$1"+a)+(o?s+Math.abs(i-u).toFixed(o).slice(2):"")},s.formatSize=function(e){return e=e>=1073741824?s.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?s.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?s.formatNumber(e/1024,0)+" KiB":s.formatNumber(e,0)+" bytes",e},s.bytesFromIP=function(e){return-1!==e.indexOf(".")?s.bytesFromIPv4(e):-1!==e.indexOf(":")?s.bytesFromIPv6(e):null},s.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=s.createBuffer(),n=0;nn[r].end-n[r].start&&(r=n.length-1)):n.push({start:l,end:l})}t.push(o)}if(n.length>0){var u=n[r];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},s.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in s&&!e.update)return t(null,s.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return s.cores=navigator.hardwareConcurrency,t(null,s.cores);if("undefined"==typeof Worker)return s.cores=1,t(null,s.cores);if("undefined"==typeof Blob)return s.cores=2,t(null,s.cores);var n=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){for(var t=Date.now(),n=t+4;Date.now()a.st&&i.sti.st&&a.st{if("function"==typeof e)return t=e,e=null,void r.create((e,n)=>{if(e)return t(e);t(null,new a(n))});"function"==typeof e.toJSON?t(null,new a(e)):r.createFromJSON(e,(e,n)=>t(e,new a(n)))}),a.isPeerInfo=(e=>Boolean("object"==typeof e&&e.id&&e.multiaddrs)),e.exports=a},function(e,t,n){"use strict";var r=n(179),i=n(640);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=S,t.format=k,t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["<",">",'"',"`"," ","\r","\n","\t"],c=["{","}","|","\\","^","`"].concat(u),h=["'"].concat(c),f=["%","/","?",";","#"].concat(h),p=["/","?","#"],d=255,m=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=n(145);function w(e,t,n){if(e&&i.isObject(e)&&e instanceof o)return e;var r=new o;return r.parse(e,t,n),r}function k(e){return i.isString(e)&&(e=w(e)),e instanceof o?e.format():o.prototype.format.call(e)}function E(e,t){return w(e,!1,!0).resolve(t)}function S(e,t){return e?w(e,!1,!0).resolveObject(t):t}o.prototype.parse=function(e,t,n){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o127?P+="x":P+=O[N];if(!P.match(m)){var M=R.slice(0,C),F=R.slice(C+1),L=O.match(g);L&&(M.push(L[1]),F.unshift(L[2])),F.length&&(d="/"+F.join(".")+d),this.hostname=M.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),j||(this.hostname=r.toASCII(this.hostname));var U=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+U,this.href+=this.host,j&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==d[0]&&(d="/"+d))}if(!y[E])for(var C=0,B=h.length;C0)&&n.host.split("@");x&&(n.auth=x.shift(),n.host=n.hostname=x.shift())}return n.search=e.search,n.query=e.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!E.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var C=E.slice(-1)[0],A=(n.host||e.host||E.length>1)&&("."===C||".."===C)||""===C,T=0,I=E.length;I>=0;I--)C=E[I],"."===C?E.splice(I,1):".."===C?(E.splice(I,1),T++):T&&(E.splice(I,1),T--);if(!w&&!k)for(;T--;T)E.unshift("..");!w||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),A&&"/"!==E.join("/").substr(-1)&&E.push("");var j=""===E[0]||E[0]&&"/"===E[0].charAt(0);if(S){n.hostname=n.host=j?"":E.length?E.shift():"";var x=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");x&&(n.auth=x.shift(),n.host=n.hostname=x.shift())}return w=w||n.host&&E.length,w&&!j&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){"use strict";var r=n(185);e.exports=function e(t){return r(function(e,t){return e.push(t),e},[],t)}},function(e,t,n){"use strict";t.DAGNode=n(192),t.DAGLink=n(96),t.resolver=n(366),t.util=n(194)},function(e,t,n){e.exports={encode:n(683),decode:n(684),encodingLength:n(685)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var r=n(241),i=a(r),o=n(402),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function l(e,t){(0,s.default)(i.default,e,t)}e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAsync=void 0;var r=n(652),i=o(r);function o(e){return e&&e.__esModule?e:{default:e}}var s="function"==typeof Symbol;function a(e){return s&&"AsyncFunction"===e[Symbol.toStringTag]}function l(e){return a(e)?(0,i.default)(e):e}t.default=l,t.isAsync=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var r=n(241),i=u(r),o=n(333),s=u(o),a=n(37),l=u(a);function u(e){return e&&e.__esModule?e:{default:e}}function c(e,t,n){(0,i.default)(e,(0,s.default)((0,l.default)(t)),n)}e.exports=t.default},function(e,t,n){"use strict";function r(e,{className:t,symbolName:n}){const r=Symbol.for(n),i={[t]:class extends e{constructor(...e){super(...e),Object.defineProperty(this,r,{value:!0})}get[Symbol.toStringTag](){return t}}}[t];return i[`is${t}`]=(e=>!(!e||!e[r])),i}function i(e,{className:t,symbolName:n,withoutNew:r}){const i=Symbol.for(n),o={[t]:function(...t){if(r&&!(this instanceof o))return new o(...t);const n=e.call(this,...t)||this;return n&&!n[i]&&Object.defineProperty(n,i,{value:!0}),n}}[t];return o.prototype=Object.create(e.prototype),o.prototype.constructor=o,Object.defineProperty(o.prototype,Symbol.toStringTag,{get:()=>t}),o[`is${t}`]=(e=>!(!e||!e[i])),o}e.exports=r,e.exports.proto=i},function(e,t,n){"use strict";var r=n(343);e.exports=function e(t,n){if(!t)return function(e,t){return e?r(t,e,n):t(!0)};Array.isArray(t)||(t=Object.keys(t).map(function(e){return t[e]}));var i=0;return function(e,o){if(e)return r(o,e,n);i>=t.length?o(!0):o(null,t[i++])}}},function(e,t,n){(function(t){e.exports=g;var r=n(25),i=n(48),o=n(16),s=n(172),a=n(83),l=n(317).DiffieHellman,u=n(76),c=n(42),h=n(46),f;try{f=n(614)}catch(e){}var p=u.InvalidAlgorithmError,d=u.KeyParseError,m={};function g(e){r.object(e,"options"),r.arrayOfObject(e.parts,"options.parts"),r.string(e.type,"options.type"),r.optionalString(e.comment,"options.comment");var t=i.info[e.type];if("object"!=typeof t)throw new p(e.type);for(var n={},o=0,s;o1024&&(e="sha256"),"ed25519"===this.type&&(e="sha512"),"ecdsa"===this.type&&(e=this.size<=256?"sha256":this.size<=384?"sha384":"sha512"),e},g.prototype.createVerify=function(e){if(void 0===e&&(e=this.defaultHashAlgorithm()),r.string(e,"hash algorithm"),"ed25519"===this.type&&void 0!==f)return new f.Verifier(this,e);if("curve25519"===this.type)throw new Error("Curve25519 keys are not suitable for signing or verification");var n,i,s;try{i=e.toUpperCase(),n=o.createVerify(i)}catch(e){s=e}(void 0===n||s instanceof Error&&s.message.match(/Unknown message digest/))&&(i="RSA-",i+=e.toUpperCase(),n=o.createVerify(i)),r.ok(n,"failed to create verifier");var l=n.verify.bind(n),u=this.toBuffer("pkcs8"),c=this.curve,h=this;return n.verify=function(n,r){if(a.isSignature(n,[2,0]))return n.type===h.type&&((!n.hashAlgorithm||n.hashAlgorithm===e)&&((!n.curve||"ecdsa"!==h.type||n.curve===c)&&l(u,n.toBuffer("asn1"))));if("string"==typeof n||t.isBuffer(n))return l(u,n,r);throw a.isSignature(n,[1,0])?new Error("signature was created by too old a version of sshpk and cannot be verified"):new TypeError("signature must be a string, Buffer, or Signature object")},n},g.prototype.createDiffieHellman=function(){if("rsa"===this.type)throw new Error("RSA keys do not support Diffie-Hellman");return new l(this)},g.prototype.createDH=g.prototype.createDiffieHellman,g.parse=function(e,t,n){"string"!=typeof e&&r.buffer(e,"data"),void 0===t&&(t="auto"),r.string(t,"format"),"string"==typeof n&&(n={filename:n}),r.optionalObject(n,"options"),void 0===n&&(n={}),r.optionalString(n.filename,"options.filename"),void 0===n.filename&&(n.filename="(unnamed)"),r.object(m[t],"formats[format]");try{var i=m[t].read(e,n);return i instanceof h&&(i=i.toPublic()),i.comment||(i.comment=n.filename),i}catch(e){if("KeyEncryptedError"===e.name)throw e;throw new d(n.filename,t,e)}},g.isKey=function(e,t){return c.isCompatible(e,g,t)},g.prototype._sshpkApiVersion=[1,7],g._oldVersionDetect=function(e){return r.func(e.toBuffer),r.func(e.fingerprint),e.createDH?[1,4]:e.defaultHashAlgorithm?[1,3]:e.formats.auto?[1,2]:e.formats.pkcs1?[1,1]:[1,0]}}).call(this,n(0).Buffer)},function(e,t,n){e.exports={bufferSplit:w,addRSAMissing:B,calculateDSAPublic:I,calculateED25519Public:j,calculateX25519Public:R,mpNormalize:x,mpDenormalize:C,ecNormalize:k,countZeros:_,assertCompatible:m,isCompatible:d,opensslKeyDeriv:v,opensshCipherInfo:P,publicFromPrivateECDSA:O,zeroPadToLength:A,writeBitString:S,readBitString:E,pbkdf2:b};var r=n(25),i=n(29).Buffer,o=n(46),s=n(41),a=n(16),l=n(48),u=n(84),c=n(237),h=n(173).BigInteger,f=n(174),p=3;function d(e,t,n){if(null===e||"object"!=typeof e)return!1;if(void 0===n&&(n=t.prototype._sshpkApiVersion),e instanceof t&&t.prototype._sshpkApiVersion[0]==n[0])return!0;for(var r=Object.getPrototypeOf(e),i=0;r.constructor.name!==t.name;)if(r=Object.getPrototypeOf(r),!r||++i>p)return!1;if(r.constructor.name!==t.name)return!1;var o=r._sshpkApiVersion;return void 0===o&&(o=t._oldVersionDetect(e)),!(o[0]!=n[0]||o[1]=n[1],i+" must be compatible with "+t.name+" klass version "+n[0]+"."+n[1])}}var g={"des-ede3-cbc":{key:24,iv:8},"aes-128-cbc":{key:16,iv:16},"aes-256-cbc":{key:32,iv:16}},y=8;function v(e,t,n,o){r.buffer(t,"salt"),r.buffer(n,"passphrase"),r.number(o,"iteration count");var s=g[e],l,u,c;r.object(s,"supported cipher"),t=t.slice(0,y);for(var h=i.alloc(0);h.length=t.length){var a=s+1;n.push(e.slice(i,a-o)),i=a,o=0}return i<=e.length&&n.push(e.slice(i,e.length)),n}function k(e,t){if(r.buffer(e),0===e[0]&&4===e[1])return t?e:e.slice(1);if(4===e[0]){if(!t)return e}else{for(;0===e[0];)e=e.slice(1);if(2===e[0]||3===e[0])throw new Error("Compressed elliptic curve points are not supported");if(4!==e[0])throw new Error("Not a valid elliptic curve point");if(!t)return e}var n=i.alloc(e.length+1);return n[0]=0,e.copy(n,1),n}function E(e,t){void 0===t&&(t=u.Ber.BitString);var n=e.readString(t,!0);return r.strictEqual(n[0],0,"bit strings with unused bits are not supported (0x"+n[0].toString(16)+")"),n.slice(1)}function S(e,t,n){void 0===n&&(n=u.Ber.BitString);var r=i.alloc(t.length+1);r[0]=0,t.copy(r,1),e.writeBuffer(r,n)}function x(e){for(r.buffer(e);e.length>1&&0===e[0]&&0==(128&e[1]);)e=e.slice(1);if(128==(128&e[0])){var t=i.alloc(e.length+1);t[0]=0,e.copy(t,1),e=t}return e}function C(e){for(r.buffer(e);e.length>1&&0===e[0];)e=e.slice(1);return e}function A(e,t){for(r.buffer(e),r.number(t);e.length>t;)r.equal(e[0],0),e=e.slice(1);for(;e.length{i.digest(e,"sha2-256",t)}),t.convertPeerId=((e,t)=>{i.digest(e.id,"sha2-256",t)}),t.bufferToKey=(e=>new s("/"+t.encodeBase32(e),!1)),t.keyForPublicKey=(t=>e.concat([e.from("/pk/"),t.id])),t.isPublicKeyKey=(e=>"/pk/"===e.slice(0,4).toString()),t.fromPublicKeyKey=(e=>new f(e.slice(4))),t.now=(()=>Date.now()),t.encodeBase32=(e=>{const t=new a.Encoder;return t.write(e).finalize()}),t.decodeBase32=(t=>{const n=new a.Decoder;return e.from(n.write(t).finalize())}),t.sortClosestPeers=((e,n,r)=>{u(e,(e,r)=>{t.convertPeerId(e,(t,i)=>{if(t)return r(t);r(null,{peer:e,distance:l(i,n)})})},(e,n)=>{if(e)return r(e);r(null,n.sort(t.xorCompare).map(e=>e.peer))})}),t.xorCompare=((e,t)=>l.compare(e.distance,t.distance)),t.pathSize=((e,t)=>Math.ceil(e/t)),t.createPutRecord=((e,t,n)=>{const r=new Date,i=new c(e,t,r);h(()=>{n(null,i.serialize())})}),t.logger=((e,t)=>{const n=["libp2p","dht"];t&&n.push(t),e&&n.push(`${e.toB58String().slice(0,8)}`),r.formatters.b=(e=>o.toB58String(e));const i=r(n.join(":"));return i.error=r(n.concat(["error"]).join(":")),i})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(57),i=r(n(1120)),o=i.Data,s=["raw","directory","file","metadata","symlink","hamt-sharded-directory"],a=["directory","hamt-sharded-directory"];function l(e,t){if(!(this instanceof l))return new l(e,t);if(-1===s.indexOf(e))throw new Error("Type: "+e+" is not valid");this.type=e,this.data=t,this.blockSizes=[],this.addBlockSize=(e=>{this.blockSizes.push(e)}),this.removeBlockSize=(e=>{this.blockSizes.splice(e,1)}),this.fileSize=(()=>{if(a.indexOf(this.type)>=0)return;let e=0;return this.blockSizes.forEach(t=>{e+=t}),t&&(e+=t.length),e}),this.marshal=(()=>{let e;switch(this.type){case"raw":e=o.DataType.Raw;break;case"directory":e=o.DataType.Directory;break;case"file":e=o.DataType.File;break;case"metadata":e=o.DataType.Metadata;break;case"symlink":e=o.DataType.Symlink;break;case"hamt-sharded-directory":e=o.DataType.HAMTShard;break;default:throw new Error(`Unkown type: "${this.type}"`)}let t=this.fileSize(),n=this.data;this.data&&this.data.length||(n=void 0);let r=this.blockSizes;return this.blockSizes&&this.blockSizes.length||(r=void 0),o.encode({Type:e,Data:n,filesize:t,blocksizes:r,hashType:this.hashType,fanout:this.fanout})})}l.unmarshal=(e=>{const t=o.decode(e);t.Data||(t.Data=void 0);const n=new l(s[t.Type],t.Data);return n.blockSizes=t.blocksizes,n}),t=e.exports=l},function(e,t,n){e.exports=k;var r=n(25),i=n(29).Buffer,o=n(48),s=n(16),a=n(172),l=n(83),u=n(76),c=n(14),h=n(42),f=n(317),p=f.generateECDSA,d=f.generateED25519,m=n(614),g=n(174),y=n(41),v=u.InvalidAlgorithmError,b=u.KeyParseError,_=u.KeyEncryptedError,w={};function k(e){r.object(e,"options"),y.call(this,e),this._pubCache=void 0}w.auto=n(615),w.pem=n(92),w.pkcs1=n(318),w.pkcs8=n(176),w.rfc4253=n(93),w["ssh-private"]=n(238),w.openssh=w["ssh-private"],w.ssh=w["ssh-private"],w.dnssec=n(319),c.inherits(k,y),k.formats=w,k.prototype.toBuffer=function(e,t){return void 0===e&&(e="pkcs1"),r.string(e,"format"),r.object(w[e],"formats[format]"),r.optionalObject(t,"options"),w[e].write(this,t)},k.prototype.hash=function(e,t){return this.toPublic().hash(e,t)},k.prototype.fingerprint=function(e,t){return this.toPublic().fingerprint(e,t)},k.prototype.toPublic=function(){if(this._pubCache)return this._pubCache;for(var e=o.info[this.type],t=[],n=0;n0;return h(i,s,a,function(e){n||(n=e),e&&r.forEach(f),s||(r.forEach(f),t(n))})});return e.reduce(p)};e.exports=d}).call(this,n(3))},function(e,t,n){(function(e){function n(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e){"string"!=typeof e&&(e+="");var t=0,n=-1,r=!0,i;for(i=e.length-1;i>=0;--i)if(47===e.charCodeAt(i)){if(!r){t=i+1;break}}else-1===n&&(r=!1,n=i+1);return-1===n?"":e.slice(t,n)}function i(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!r;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,r="/"===s.charAt(0))}return t=n(i(t.split("/"),function(e){return!!e}),!r).join("/"),(r?"/":"")+t||"."},t.normalize=function(e){var r=t.isAbsolute(e),s="/"===o(e,-1);return e=n(i(e.split("/"),function(e){return!!e}),!r).join("/"),e||r||(e="."),e&&s&&(e+="/"),(r?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(i(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,n){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var i=r(e.split("/")),o=r(n.split("/")),s=Math.min(i.length,o.length),a=s,l=0;l=1;--o)if(t=e.charCodeAt(o),47===t){if(!i){r=o;break}}else i=!1;return-1===r?n?"/":".":n&&1===r?"/":e.slice(0,r)},t.basename=function(e,t){var n=r(e);return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,n=0,r=-1,i=!0,o=0,s=e.length-1;s>=0;--s){var a=e.charCodeAt(s);if(47!==a)-1===r&&(i=!1,r=s+1),46===a?-1===t?t=s:1!==o&&(o=1):-1!==t&&(o=-1);else if(!i){n=s+1;break}}return-1===t||-1===r||0===o||1===o&&t===r-1&&t===n+1?"":e.slice(t,r)};var o="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}}).call(this,n(3))},function(e,t,n){var r;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,l=Math.ceil,u=Math.floor,c="[BigNumber Error] ",h=c+"Number primitive has more than 15 significant digits: ",f=1e14,p=14,d=9007199254740991,m=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,y=1e9;function v(e){var t,n,r,i=H.prototype={constructor:H,toString:null,valueOf:null},o=new H(1),C=20,A=4,T=-7,I=21,j=-1e7,R=1e7,B=!1,O=1,P=0,N={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},D="0123456789abcdefghijklmnopqrstuvwxyz",M,F,L,U,q,z,K;function H(e,t){var i,o,a,l,c,f,m,g,y=this;if(!(y instanceof H))return new H(e,t);if(null==t){if(e&&!0===e._isBigNumber)return y.s=e.s,void(!e.c||e.e>R?y.c=y.e=null:e.e=10;c/=10,l++);return void(l>R?y.c=y.e=null:(y.e=l,y.c=[e]))}g=String(e)}else{if(!s.test(g=String(e)))return r(y,g,f);y.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(l=g.indexOf("."))>-1&&(g=g.replace(".","")),(c=g.search(/e/i))>0?(l<0&&(l=c),l+=+g.slice(c+1),g=g.substring(0,c)):l<0&&(l=g.length)}else{if(k(t,2,D.length,"Base"),10==t)return y=new H(e),G(y,C+y.e+1,A);if(g=String(e),f="number"==typeof e){if(0*e!=0)return r(y,g,f,t);if(y.s=1/e<0?(g=g.slice(1),-1):1,H.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(h+e)}else y.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(i=D.slice(0,t),l=c=0,m=g.length;cl){l=m;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,c=-1,l=0;continue}return r(y,String(e),f,t)}f=!1,g=n(g,t,10,y.s),(l=g.indexOf("."))>-1?g=g.replace(".",""):l=g.length}for(c=0;48===g.charCodeAt(c);c++);for(m=g.length;48===g.charCodeAt(--m););if(g=g.slice(c,++m)){if(m-=c,f&&H.DEBUG&&m>15&&(e>d||e!==u(e)))throw Error(h+y.s*e);if((l=l-c-1)>R)y.c=y.e=null;else if(l=I)?S(l,s):x(l,s,"0");else if(e=G(new H(e),t,n),o=e.e,l=_(e.c),a=l.length,1==r||2==r&&(t<=o||o<=T)){for(;aa){if(--t>0)for(l+=".";t--;l+="0");}else if(t+=o-a,t>0)for(o+1==a&&(l+=".");t--;l+="0");return e.s<0&&i?"-"+l:l}function $(e,t){for(var n,r=1,i=new H(e[0]);r=10;i/=10,r++);return(n=r+n*p-1)>R?e.c=e.e=null:n=10;a/=10,i++);if(o=t-i,o<0)o+=p,s=t,c=g[h=0],d=c/y[i-s-1]%10|0;else if(h=l((o+1)/p),h>=g.length){if(!r)break e;for(;g.length<=h;g.push(0));c=d=0,i=1,o%=p,s=o-p+1}else{for(c=a=g[h],i=1;a>=10;a/=10,i++);o%=p,s=o-p+i,d=s<0?0:c/y[i-s-1]%10|0}if(r=r||t<0||null!=g[h+1]||(s<0?c:c%y[i-s-1]),r=n<4?(d||r)&&(0==n||n==(e.s<0?3:2)):d>5||5==d&&(4==n||r||6==n&&(o>0?s>0?c/y[i-s]:0:g[h-1])%10&1||n==(e.s<0?8:7)),t<1||!g[0])return g.length=0,r?(t-=e.e+1,g[0]=y[(p-t%p)%p],e.e=-t||0):g[0]=e.e=0,e;if(0==o?(g.length=h,a=1,h--):(g.length=h+1,a=y[p-o],g[h]=s>0?u(c/y[i-s]%y[s])*a:0),r)for(;;){if(0==h){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=a,a=1;s>=10;s/=10,a++);o!=a&&(e.e++,g[0]==f&&(g[0]=1));break}if(g[h]+=a,g[h]!=f)break;g[h--]=0,a=1}for(o=g.length;0===g[--o];g.pop());}e.e>R?e.c=e.e=null:e.e=I?S(t,n):x(t,n,"0"),e.s<0?"-"+t:t)}return H.clone=v,H.ROUND_UP=0,H.ROUND_DOWN=1,H.ROUND_CEIL=2,H.ROUND_FLOOR=3,H.ROUND_HALF_UP=4,H.ROUND_HALF_DOWN=5,H.ROUND_HALF_EVEN=6,H.ROUND_HALF_CEIL=7,H.ROUND_HALF_FLOOR=8,H.EUCLID=9,H.config=H.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(c+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(n=e[t],k(n,0,y,t),C=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(n=e[t],k(n,0,8,t),A=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&(n=e[t],n&&n.pop?(k(n[0],-y,0,t),k(n[1],0,y,t),T=n[0],I=n[1]):(k(n,-y,y,t),T=-(I=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if(n=e[t],n&&n.pop)k(n[0],-y,-1,t),k(n[1],1,y,t),j=n[0],R=n[1];else{if(k(n,-y,y,t),!n)throw Error(c+t+" cannot be zero: "+n);j=-(R=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if(n=e[t],n!==!!n)throw Error(c+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw B=!n,Error(c+"crypto unavailable");B=n}else B=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(n=e[t],k(n,0,9,t),O=n),e.hasOwnProperty(t="POW_PRECISION")&&(n=e[t],k(n,0,y,t),P=n),e.hasOwnProperty(t="FORMAT")){if(n=e[t],"object"!=typeof n)throw Error(c+t+" not an object: "+n);N=n}if(e.hasOwnProperty(t="ALPHABET")){if(n=e[t],"string"!=typeof n||/^.$|[+-.\s]|(.).*\1/.test(n))throw Error(c+t+" invalid: "+n);D=n}}return{DECIMAL_PLACES:C,ROUNDING_MODE:A,EXPONENTIAL_AT:[T,I],RANGE:[j,R],CRYPTO:B,MODULO_MODE:O,POW_PRECISION:P,FORMAT:N,ALPHABET:D}},H.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!H.DEBUG)return!0;var t,n,r=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-y&&i<=y&&i===u(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break e}if(t=(i+1)%p,t<1&&(t+=p),String(r[0]).length==t){for(t=0;t=f||n!==u(n))break e;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(c+"Invalid BigNumber: "+e)},H.maximum=H.max=function(){return $(arguments,i.lt)},H.minimum=H.min=function(){return $(arguments,i.gt)},H.random=(M=9007199254740992,F=Math.random()*M&2097151?function(){return u(Math.random()*M)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,i,s,a=0,h=[],f=new H(o);if(null==e?e=C:k(e,0,y),i=l(e/p),B)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));a>>11),s>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[a]=n[0],t[a+1]=n[1]):(h.push(s%1e14),a+=2);a=i/2}else{if(!crypto.randomBytes)throw B=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(i*=7);a=9e15?crypto.randomBytes(7).copy(t,a):(h.push(s%1e14),a+=7);a=i/7}if(!B)for(;a=10;s/=10,a++);an-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/n|0,o[i]%=n)}return o.reverse()}return function(r,i,o,s,a){var l,u,c,h,f,p,d,m,g=r.indexOf("."),y=C,v=A;for(g>=0&&(h=P,P=0,r=r.replace(".",""),m=new H(i),p=m.pow(r.length-g),P=h,m.c=n(x(_(p.c),p.e,"0"),10,o,e),m.e=m.c.length),d=n(r,i,o,a?(l=D,e):(l=e,D)),c=h=d.length;0==d[--h];d.pop());if(!d[0])return l.charAt(0);if(g<0?--c:(p.c=d,p.e=c,p.s=s,p=t(p,m,y,v,o),d=p.c,f=p.r,c=p.e),u=c+y+1,g=d[u],h=o/2,f=f||u<0||null!=d[u+1],f=v<4?(null!=g||f)&&(0==v||v==(p.s<0?3:2)):g>h||g==h&&(4==v||f||6==v&&1&d[u-1]||v==(p.s<0?8:7)),u<1||!d[0])r=f?x(l.charAt(1),-y,l.charAt(0)):l.charAt(0);else{if(d.length=u,f)for(--o;++d[--u]>o;)d[u]=0,u||(++c,d=[1].concat(d));for(h=d.length;!d[--h];);for(g=0,r="";g<=h;r+=l.charAt(d[g++]));r=x(r,c,l.charAt(0))}return r}}(),t=function(){function e(e,t,n){var r,i,o,s,a=0,l=e.length,u=t%g,c=t/g|0;for(e=e.slice();l--;)o=e[l]%g,s=e[l]/g|0,r=c*o+s*u,i=u*o+r%g*g+a,a=(i/n|0)+(r/g|0)+c*s,e[l]=i%n;return a&&(e=[a].concat(e)),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]1;e.splice(0,1));}return function(r,i,o,s,a){var l,c,h,d,m,g,y,v,_,w,k,E,S,x,C,A,T,I=r.s==i.s?1:-1,j=r.c,R=i.c;if(!(j&&j[0]&&R&&R[0]))return new H(r.s&&i.s&&(j?!R||j[0]!=R[0]:R)?j&&0==j[0]||!R?0*I:I/0:NaN);for(v=new H(I),_=v.c=[],c=r.e-i.e,I=o+c+1,a||(a=f,c=b(r.e/p)-b(i.e/p),I=I/p|0),h=0;R[h]==(j[h]||0);h++);if(R[h]>(j[h]||0)&&c--,I<0)_.push(1),d=!0;else{for(x=j.length,A=R.length,h=0,I+=2,m=u(a/(R[0]+1)),m>1&&(R=e(R,m,a),j=e(j,m,a),A=R.length,x=j.length),S=A,w=j.slice(0,A),k=w.length;k=a/2&&C++;do{if(m=0,l=t(R,w,A,k),l<0){if(E=w[0],A!=k&&(E=E*a+(w[1]||0)),m=u(E/C),m>1)for(m>=a&&(m=a-1),g=e(R,m,a),y=g.length,k=w.length;1==t(g,w,y,k);)m--,n(g,A=10;I/=10,h++);G(v,o+(v.e=h+c*p-1)+1,s,d)}else v.e=c,v.r=+d;return v}}(),L=/^(-?)0([xbo])(?=\w[\w.]*$)/i,U=/^([^.]+)\.$/,q=/^\.([^.]+)$/,z=/^-?(Infinity|NaN)$/,K=/^\s*\+(?=[\w.])|^\s+|\s+$/g,r=function(e,t,n,r){var i,o=n?t:t.replace(K,"");if(z.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(L,function(e,t,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?e:t}),r&&(i=r,o=o.replace(U,"$1").replace(q,"0.$1")),t!=o))return new H(o,i);if(H.DEBUG)throw Error(c+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},i.absoluteValue=i.abs=function(){var e=new H(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return w(this,new H(e,t))},i.decimalPlaces=i.dp=function(e,t){var n,r,i,o=this;if(null!=e)return k(e,0,y),null==t?t=A:k(t,0,8),G(new H(o),e+o.e+1,t);if(!(n=o.c))return null;if(r=((i=n.length-1)-b(this.e/p))*p,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},i.dividedBy=i.div=function(e,n){return t(this,new H(e,n),C,A)},i.dividedToIntegerBy=i.idiv=function(e,n){return t(this,new H(e,n),0,1)},i.exponentiatedBy=i.pow=function(e,t){var n,r,i,s,a,h,f,d,m,g=this;if(e=new H(e),e.c&&!e.isInteger())throw Error(c+"Exponent not an integer: "+Y(e));if(null!=t&&(t=new H(t)),h=e.e>14,!g.c||!g.c[0]||1==g.c[0]&&!g.e&&1==g.c.length||!e.c||!e.c[0])return m=new H(Math.pow(+Y(g),h?2-E(e):+Y(e))),t?m.mod(t):m;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new H(NaN);r=!f&&g.isInteger()&&t.isInteger(),r&&(g=g.mod(t))}else{if(e.e>9&&(g.e>0||g.e<-1||(0==g.e?g.c[0]>1||h&&g.c[1]>=24e7:g.c[0]<8e13||h&&g.c[0]<=9999975e7)))return s=g.s<0&&E(e)?-0:0,g.e>-1&&(s=1/s),new H(f?1/s:s);P&&(s=l(P/p+2))}for(h?(n=new H(.5),f&&(e.s=1),d=E(e)):(i=Math.abs(+Y(e)),d=i%2),m=new H(o);;){if(d){if(m=m.times(g),!m.c)break;s?m.c.length>s&&(m.c.length=s):r&&(m=m.mod(t))}if(i){if(i=u(i/2),0===i)break;d=i%2}else if(e=e.times(n),G(e,e.e+1,1),e.e>14)d=E(e);else{if(i=+Y(e),0===i)break;d=i%2}g=g.times(g),s?g.c&&g.c.length>s&&(g.c.length=s):r&&(g=g.mod(t))}return r?m:(f&&(m=o.div(m)),t?m.mod(t):s?G(m,P,A,a):m)},i.integerValue=function(e){var t=new H(this);return null==e?e=A:k(e,0,8),G(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return 0===w(this,new H(e,t))},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return w(this,new H(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return 1===(t=w(this,new H(e,t)))||0===t},i.isInteger=function(){return!!this.c&&b(this.e/p)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return w(this,new H(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return-1===(t=w(this,new H(e,t)))||0===t},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&0==this.c[0]},i.minus=function(e,t){var n,r,i,o,s=this,a=s.s;if(e=new H(e,t),t=e.s,!a||!t)return new H(NaN);if(a!=t)return e.s=-t,s.plus(e);var l=s.e/p,u=e.e/p,c=s.c,h=e.c;if(!l||!u){if(!c||!h)return c?(e.s=-t,e):new H(h?s:NaN);if(!c[0]||!h[0])return h[0]?(e.s=-t,e):new H(c[0]?s:3==A?-0:0)}if(l=b(l),u=b(u),c=c.slice(),a=l-u){for((o=a<0)?(a=-a,i=c):(u=l,i=h),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(r=(o=(a=c.length)<(t=h.length))?a:t,a=t=0;t0)for(;t--;c[n++]=0);for(t=f-1;r>a;){if(c[--r]=0;){for(n=0,d=E[i]%_,m=E[i]/_|0,s=l,o=i+s;o>i;)u=k[--s]%_,c=k[s]/_|0,a=m*u+c*d,u=d*u+a%_*_+y[o]+n,n=(u/v|0)+(a/_|0)+m*c,y[o--]=u%v;y[o]=n}return n?++r:y.splice(0,1),W(e,y,r)},i.negated=function(){var e=new H(this);return e.s=-e.s||null,e},i.plus=function(e,t){var n,r=this,i=r.s;if(e=new H(e,t),t=e.s,!i||!t)return new H(NaN);if(i!=t)return e.s=-t,r.minus(e);var o=r.e/p,s=e.e/p,a=r.c,l=e.c;if(!o||!s){if(!a||!l)return new H(i/0);if(!a[0]||!l[0])return l[0]?e:new H(a[0]?r:0*i)}if(o=b(o),s=b(s),a=a.slice(),i=o-s){for(i>0?(s=o,n=l):(i=-i,n=a),n.reverse();i--;n.push(0));n.reverse()}for(i=a.length,t=l.length,i-t<0&&(n=l,l=a,a=n,t=i),i=0;t;)i=(a[--t]=a[t]+l[t]+i)/f|0,a[t]=f===a[t]?0:a[t]%f;return i&&(a=[i].concat(a),++s),W(e,a,s)},i.precision=i.sd=function(e,t){var n,r,i,o=this;if(null!=e&&e!==!!e)return k(e,1,y),null==t?t=A:k(t,0,8),G(new H(o),e,t);if(!(n=o.c))return null;if(i=n.length-1,r=i*p+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&o.e+1>r&&(r=o.e+1),r},i.shiftedBy=function(e){return k(e,-d,d),this.times("1e"+e)},i.squareRoot=i.sqrt=function(){var e,n,r,i,o,s=this,a=s.c,l=s.s,u=s.e,c=C+4,h=new H("0.5");if(1!==l||!a||!a[0])return new H(!l||l<0&&(!a||a[0])?NaN:a?s:1/0);if(l=Math.sqrt(+Y(s)),0==l||l==1/0?(n=_(a),(n.length+u)%2==0&&(n+="0"),l=Math.sqrt(+n),u=b((u+1)/2)-(u<0||u%2),l==1/0?n="1e"+u:(n=l.toExponential(),n=n.slice(0,n.indexOf("e")+1)+u),r=new H(n)):r=new H(l+""),r.c[0])for(u=r.e,l=u+c,l<3&&(l=0);;)if(o=r,r=h.times(o.plus(t(s,o,c,1))),_(o.c).slice(0,l)===(n=_(r.c)).slice(0,l)){if(r.e0&&m>0){for(o=m%a||a,h=d.substr(0,o);o0&&(h+=u+d.slice(o)),p&&(h="-"+h)}r=f?h+(n.decimalSeparator||"")+((l=+n.fractionGroupSize)?f.replace(new RegExp("\\d{"+l+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):f):h}return(n.prefix||"")+r+(n.suffix||"")},i.toFraction=function(e){var n,r,i,s,a,l,u,h,f,d,g,y,v=this,b=v.c;if(null!=e&&(u=new H(e),!u.isInteger()&&(u.c||1!==u.s)||u.lt(o)))throw Error(c+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+Y(u));if(!b)return new H(v);for(n=new H(o),f=r=new H(o),i=h=new H(o),y=_(b),a=n.e=y.length-v.e-1,n.c[0]=m[(l=a%p)<0?p+l:l],e=!e||u.comparedTo(n)>0?a>0?n:f:u,l=R,R=1/0,u=new H(y),h.c[0]=0;d=t(u,n,0,1),s=r.plus(d.times(i)),1!=s.comparedTo(e);)r=i,i=s,f=h.plus(d.times(s=f)),h=s,n=u.minus(d.times(s=n)),u=s;return s=t(e.minus(r),i,0,1),h=h.plus(s.times(f)),r=r.plus(s.times(i)),h.s=f.s=v.s,a*=2,g=t(f,i,a,A).minus(v).abs().comparedTo(t(h,r,a,A).minus(v).abs())<1?[f,i]:[h,r],R=l,g},i.toNumber=function(){return+Y(this)},i.toPrecision=function(e,t){return null!=e&&k(e,1,y),V(this,e,t,2)},i.toString=function(e){var t,r=this,i=r.s,o=r.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=T||o>=I?S(_(r.c),o):x(_(r.c),o,"0"):10===e?(r=G(new H(r),C+o+1,A),t=x(_(r.c),r.e,"0")):(k(e,2,D.length,"Base"),t=n(x(_(r.c),o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},i.valueOf=i.toJSON=function(){return Y(this)},i._isBigNumber=!0,a&&(i[Symbol.toStringTag]="BigNumber",i[Symbol.for("nodejs.util.inspect.custom")]=i.valueOf),null!=e&&H.set(e),H}function b(e){var t=0|e;return e>0||e===t?t:t-1}function _(e){for(var t,n,r=1,i=e.length,o=e[0]+"";ru^n?1:-1;for(a=(l=i.length)<(u=o.length)?l:u,s=0;so[s]^n?1:-1;return l==u?0:l>u^n?1:-1}function k(e,t,n,r){if(en||e!==u(e))throw Error(c+(r||"Argument")+("number"==typeof e?en?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function E(e){var t=e.c.length-1;return b(e.e/p)==t&&e.c[t]%2!=0}function S(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function x(e,t,n){var r,i;if(t<0){for(i=n+".";++t;i+=n);e=i+e}else if(r=e.length,++t>r){for(i=n,t-=r;--t;i+=n);e+=i}else t{if(e)return i(e);i(null,r.encode(o,t,n))})}e.exports=o,o.Buffer=t,o.multihash=r,o.digest=function(e,t,n,r){if("function"==typeof n&&(r=n,n=void 0),!r)throw new Error("Missing callback");let i=r,s;n&&(i=((e,t)=>{if(e)return r(e);r(null,t.slice(0,n))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=r.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){var r=n(729),i=n(733),o=function(e){if(!e)return null;var t={};return Object.keys(e).forEach(function(n){t[n]=e[n].value}),t};e.exports=function(e,n){if(n||(n={}),!e)throw new Error("Pass in a .proto string or a protobuf-schema parsed object");var s="object"!=typeof e||t.isBuffer(e)?r.parse(e):e,a=function(){var e=this;i(s,n.encodings||{}).forEach(function(t){e[t.name]=o(t.values)||t})};return a.prototype.toString=function(){return r.stringify(s)},a.prototype.toJSON=function(){return s},new a}}).call(this,n(0).Buffer)},function(e,t){function n(){}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(110),i=a(r),o=n(334),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,i.default)(s.default),e.exports=t.default},function(e,t,n){"use strict";(function(r){const i=n(686);t=e.exports=s,t.encode=a,t.decode=l,t.isEncoded=u,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 n=h(e),i=r.from(n.code),o=n.name;return c(o,t),r.concat([i,t])}function a(e,t){const n=h(e),i=n.name;return s(i,r.from(n.encode(t)))}function l(e){r.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);e=e.substring(1,e.length),"string"==typeof e&&(e=r.from(e));const n=h(t);return r.from(n.decode(e.toString()))}function u(e){if(r.isBuffer(e)&&(e=e.toString()),"[object String]"!==Object.prototype.toString.call(e))return!1;const t=e.substring(0,1);try{const e=h(t);return e.name}catch(e){return!1}}function c(e,t){const n=h(e);n.decode(t.toString())}function h(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,n(0).Buffer)},function(e,t,n){t.source=n(188),t.through=n(709),t.sink=n(348),t.duplex=n(349)},function(e,t,n){e.exports=o;var r=n(6).EventEmitter,i=n(1);function o(){r.call(this)}i(o,r),o.Readable=n(258),o.Writable=n(786),o.Duplex=n(787),o.Transform=n(788),o.PassThrough=n(789),o.Stream=o,o.prototype.pipe=function(e,t){var n=this;function i(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(n.on("end",a),n.on("close",l));var s=!1;function a(){s||(s=!0,e.end())}function l(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){if(c(),0===r.listenerCount(this,"error"))throw e}function c(){n.removeListener("data",i),e.removeListener("drain",o),n.removeListener("end",a),n.removeListener("close",l),n.removeListener("error",u),e.removeListener("error",u),n.removeListener("end",c),n.removeListener("close",c),e.removeListener("close",c)}return n.on("error",u),e.on("error",u),n.on("end",c),n.on("close",c),e.on("close",c),e.emit("pipe",n),e}},function(e,t){function n(e,t){"function"==typeof e&&(t=e,e=!1);var n=[],r,i,o;function s(e,t){e&&(r=e,i&&c(r)),i=t,u()}function a(e){o=o||e||!0,u()}function l(e){o||(i?c(r,e):n.push(e))}return e?{push:l,end:a,source:s,buffer:n}:(s.push=l,s.end=a,s.buffer=n,s);function u(){i&&(r?c(r):!n.length&&o?c(o):n.length&&c(null,n.shift()))}function c(e,n){var r=i;if(e&&t){var o=t;t=null,o(!0===e?null:e)}i=null,r(e,n)}}e.exports=n},function(e,t,n){"use strict";t.Connection=n(939)},function(e,t){var n=Array.isArray;e.exports=n},function(e,t,n){"use strict";function r(e){return e}var i=n(151);e.exports=function e(t){return t?(t=i(t),function(e){return function(n,r){e(n,function(n,i){try{i=n?null:t(i)}catch(t){return e(t,function(){return r(t)})}r(n,i)})}}):r}},function(e,t,n){"use strict";var r=n(345);e.exports=function e(t){return t=r(t),function(e){return function n(r,i){for(var o,s=!0;s;)s=!1,o=!0,e(r,function(e,r){if(!e&&!t(r))return o?s=!0:n(e,i);i(e,r)}),o=!1}}}},function(e,t){e.exports=r;var n=Object.prototype.hasOwnProperty;function r(){for(var e={},t=0;tT(A(k,E),k),S=E(),x=T(A(S,w,S),A(w,S),A(S,w),S,w);function C(e){return function t(n){if(!r.isMultiaddr(n))try{n=r(n)}catch(e){return!1}let i=e(n.protoNames());return null!==i&&0===i.length}}function A(){const e=Array.from(arguments);function t(t){return t.length{if(t="function"==typeof e?e().partialMatch(t):e.partialMatch(t),null===t)return!0}),t)}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:C(t),partialMatch:t}}function T(){const e=Array.from(arguments);function t(t){let n=null;return e.some(e=>{const r="function"==typeof e?e().partialMatch(t):e.partialMatch(t);if(r)return n=r,!0}),n}const n={toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:C(t),partialMatch:t};return n}function I(e){const t=e;function n(e){if("string"==typeof e)try{e=r(e)}catch(e){return!1}const n=e.protoNames();return 1===n.length&&n[0]===t}function i(e){return 0===e.length?null:e[0]===t?e.slice(1):null}return{toString:function(){return t},matches:n,partialMatch:i}}t.DNS=h,t.DNS4=i,t.DNS6=o,t.IP=a,t.TCP=l,t.UDP=u,t.UTP=c,t.HTTP=d,t.HTTPS=m,t.WebSockets=f,t.WebSocketsSecure=p,t.WebSocketStar=y,t.WebRTCStar=g,t.WebRTCDirect=v,t.Reliable=b,t.Stardust=_,t.Circuit=S,t.IPFS=x},function(e,t,n){"use strict";const r=n(227);e.exports={addLink:n(490),countStreamBytes:n(1197),createLock:n(1198),createNode:n(1214),formatCid:n(1215),limitStreamBytes:n(1216),loadNode:n(1217),removeLink:n(1218),toMfsPath:n(495),toPathComponents:n(295),toPullSource:n(1219),toSourcesAndDestination:n(1228),toSources:n(504),toTrail:n(1229),updateMfsRoot:n(1230),updateTree:n(1231),withMfsRoot:n(496),zeros:n(1234),FILE_SEPARATOR:r.FILE_SEPARATOR,MAX_CHUNK_SIZE:r.MAX_CHUNK_SIZE,MAX_LINKS:r.MAX_LINKS,FILE_TYPES:r.FILE_TYPES}},function(e,t,n){"use strict";function r(e){return e}var i=n(151);e.exports=function e(t){if(!t)return r;t=i(t);var n=!1,o,s;return function(e){return function r(i,a){if(s)return a(s);i?(s=i,e(i,n?function(e){n?o=a:a(i)}:function(e){a(i)})):e(null,function(e,i){e?a(e):s?a(s):(n=!0,t(i,function(e,t){n=!1,s?(a(s),o&&o(s)):e?r(e,a):a(null,t)}))})}}}},function(e,t,n){"use strict";(function(t){const r=n(70),i=n(27),o=n(60),s=n(9),a=/^https?:\/\/[^/]+\/(ip(f|n)s)\/((\w+).*)/,l=/^\/(ip(f|n)s)\/((\w+).*)/,u=1,c=4,h=/^https?:\/\/([^/]+)\.(ip(?:f|n)s)\.[^/]+/,f=1,p=2;function d(e){const n=b(e);try{const e=t.from(r.decode(n));return i.decode(e),!0}catch(e){return!1}}function m(e){try{return o.isEncoded(e)}catch(e){return!1}}function g(e){try{return s.isCID(new s(e))}catch(e){return!1}}function y(e,t,n=u,r=c){const i=b(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipfs"!==o[n])return!1;let s=o[r];return s&&t===h&&(s=s.toLowerCase()),g(s)}function v(e,t,n=u,r){const i=b(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipns"!==o[n])return!1;if(r&&t===h){let e=o[r];return e=e.toLowerCase(),g(e)}return!0}function b(e){return t.isBuffer(e)?r.encode(e):"string"==typeof e&&e}const _=e=>y(e,h,2,1),w=e=>v(e,h,2,1);e.exports={multihash:d,cid:g,base32cid:e=>"base32"===m(e)&&g(e),ipfsSubdomain:_,ipnsSubdomain:w,subdomain:e=>_(e)||w(e),subdomainPattern:h,ipfsUrl:e=>y(e,a),ipnsUrl:e=>v(e,a),url:e=>y(e,a)||v(e,a),urlPattern:a,ipfsPath:e=>y(e,l),ipnsPath:e=>v(e,l),path:e=>y(e,l)||v(e,l),pathPattern:l,urlOrPath:e=>y(e,a)||v(e,a)||y(e,l)||v(e,l)}}).call(this,n(0).Buffer)},function(e,t,n){var r=n(25),i=n(14);function o(e,t){Error.captureStackTrace&&Error.captureStackTrace(this,o),this.name="FingerprintFormatError",this.fingerprint=e,this.format=t,this.message="Fingerprint format is not supported, or is invalid: ",void 0!==e&&(this.message+=" fingerprint = "+e),void 0!==t&&(this.message+=" format = "+t)}function s(e){Error.captureStackTrace&&Error.captureStackTrace(this,s),this.name="InvalidAlgorithmError",this.algorithm=e,this.message='Algorithm "'+e+'" is not supported'}function a(e,t,n){Error.captureStackTrace&&Error.captureStackTrace(this,a),this.name="KeyParseError",this.format=t,this.keyName=e,this.innerErr=n,this.message="Failed to parse "+e+" as a valid "+t+" format key: "+n.message}function l(e,t,n){Error.captureStackTrace&&Error.captureStackTrace(this,l),this.name="SignatureParseError",this.type=e,this.format=t,this.innerErr=n,this.message="Failed to parse the given data as a "+e+" signature in "+t+" format: "+n.message}function u(e,t,n){Error.captureStackTrace&&Error.captureStackTrace(this,u),this.name="CertificateParseError",this.format=t,this.certName=e,this.innerErr=n,this.message="Failed to parse "+e+" as a valid "+t+" format certificate: "+n.message}function c(e,t){Error.captureStackTrace&&Error.captureStackTrace(this,c),this.name="KeyEncryptedError",this.format=t,this.keyName=e,this.message="The "+t+" format key "+e+" is encrypted (password-protected), and no passphrase was provided in `options`"}i.inherits(o,Error),i.inherits(s,Error),i.inherits(a,Error),i.inherits(l,Error),i.inherits(u,Error),i.inherits(c,Error),e.exports={FingerprintFormatError:o,InvalidAlgorithmError:s,KeyParseError:a,SignatureParseError:l,KeyEncryptedError:c,CertificateParseError:u}},function(e,t){errors={};class n extends Error{constructor(e){super(e||"Coding Error"),this.name="CodingError"}}errors.CodingError=n;class r extends Error{constructor(e){super("To be implemented: "+e),this.name="ToBeImplementedError"}}errors.ToBeImplementedError=r;class i extends Error{constructor(e){super(e||"Transport failure"),this.name="TransportError"}}errors.TransportError=i;class o extends Error{constructor(e){super(e||"Timed out"),this.name="TimeoutError"}}errors.TimeoutError=o;class s extends Error{constructor(e){super(e||"Intentionally Unimplemented Function"),this.name="IntentionallyUnimplementedError"}}errors.IntentionallyUnimplementedError=s,t=e.exports=errors},function(e,t){var n=1e3,r=60*n,i=60*r,o=24*i,s=7*o,a=365.25*o;function l(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\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 l=parseFloat(t[1]),u=(t[2]||"ms").toLowerCase();switch(u){case"years":case"year":case"yrs":case"yr":case"y":return l*a;case"weeks":case"week":case"w":return l*s;case"days":case"day":case"d":return l*o;case"hours":case"hour":case"hrs":case"hr":case"h":return l*i;case"minutes":case"minute":case"mins":case"min":case"m":return l*r;case"seconds":case"second":case"secs":case"sec":case"s":return l*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}}}function u(e){var t=Math.abs(e);return t>=o?Math.round(e/o)+"d":t>=i?Math.round(e/i)+"h":t>=r?Math.round(e/r)+"m":t>=n?Math.round(e/n)+"s":e+"ms"}function c(e){var t=Math.abs(e);return t>=o?h(e,t,o,"day"):t>=i?h(e,t,i,"hour"):t>=r?h(e,t,r,"minute"):t>=n?h(e,t,n,"second"):e+" ms"}function h(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}e.exports=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return l(e);if("number"===n&&isFinite(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,n){var r=n(327),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();e.exports=o},function(e,t,n){(function(t){var r=n(62);e.exports=o,e.exports.source=function(e){return o(null,e)},e.exports.sink=function(e){return o(e,null)};var i="undefined"==typeof setImmediate?t.nextTick:setImmediate;function o(e,t){e&&"object"==typeof e&&(t=e.source,e=e.sink);var n=[],o=[],s,a,l=new r,u;l.writable=l.readable=!0,l.write=function(e){return n.length?n.shift()(null,e):o.push(e),n.length||(a=!0),!!n.length},l.end=function(){t?o.length?g():t(s=!0,n.length?n.shift():function(){}):n.length&&n.shift()(!0)},l.source=function(e,t){o.length?(t(null,o.shift()),o.length||l.emit("drain")):((s=s||e)?t(s):n.push(t),a&&(a=!1,l.emit("drain")))},e&&(u=e(l.source)),u&&!t&&(t=u);var c=[],h=[],f=!1,p=!1,d=!1;if(l.sink=function(e){t=e,i(g)},t){l.sink(t);var m=l.pipe.bind(l);l.pipe=function(e,t){var n=m(e,t);return l.paused&&l.resume(),n}}function g(){if(p=!1,t&&!d){for(;c.length&&!l.paused;)l.emit("data",c.shift());if(!l.paused){if(f)return l.emit("end");d=!0,t(null,function e(n,r){d=!1,l.paused?(!0===n?f=n:n?l.emit("error",n):c.push(r),p=!0):n&&!0!==(s=n)?l.emit("error",n):(s=s||n)?l.emit("end"):(l.emit("data",r),d=!0,t(null,e))})}}}return l.pause=function(){return l.paused=!0,l},l.resume=function(){return l.paused=!1,g(),l},l.destroy=function(){!s&&t&&t(s=!0,function(){}),s=!0,n.length&&n.shift()(!0),l.emit("close")},l}}).call(this,n(3))},function(e,t,n){"use strict";(function(t){const r=n(12),i=n(40),o=n(71),s=n(67),a=n(66),l=n(9),u=n(1181).createResolver;function c(e){let n=e,r="/";if(t.isBuffer(e)&&(n=new l(e).toBaseEncodedString()),"string"==typeof e){0===e.indexOf("/ipfs/")&&(e=n=e.substring(6));const t=e.indexOf("/");t>0&&(n=e.substring(0,t),r=e.substring(t))}else l.isCID(n)&&(n=n.toBaseEncodedString());return n=new l(n).toBaseEncodedString(),{base:n,rest:p(r)}}const h={maxDepth:1/0,offset:void 0,length:void 0,fullPath:!1};function f(e){return e.reduce((e,t)=>(e.length&&(e+="/"),e+t),"")}e.exports=((e,t,n)=>{let p;n=Object.assign({},h,n);try{p=c(e)}catch(e){return o(e)}const d=f([p.base].concat(p.rest.slice(0,p.rest.length-1))).length,m=new l(p.base);return r(i([{cid:m,name:p.base,path:p.base,pathRest:p.rest,depth:0}]),u(t,n),s(Boolean),a(e=>({depth:e.depth,name:e.name,path:n.fullPath?e.path:g(e),size:e.size,cid:e.cid,content:e.content,type:e.type})));function g(e){if(!p.rest.length)return e.path;let t=e.path.substring(d);return"/"===t.charAt(0)&&(t=t.substring(1)),t||(t=p.rest[p.rest.length-1]||p.base),t}});const p=(e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(9);e.exports=function(e){if(t.isBuffer(e))return new r(e).toString();if(r.isCID(e))return e.toString();if("string"!=typeof e)throw new Error("unexpected cid type: "+typeof e);return new r(e.split("/")[0]),e}}).call(this,n(0).Buffer)},function(e,t,n){e.exports=p;var r=n(25),i=n(29).Buffer,o=n(48),s=n(16),a=n(76),l=n(42),u=n(84),c=n(175),h=a.InvalidAlgorithmError,f=a.SignatureParseError;function p(e){r.object(e,"options"),r.arrayOfObject(e.parts,"options.parts"),r.string(e.type,"options.type");for(var t={},n=0;n20&&0===o[0]&&(o=o.slice(1)),s=this.part.s.data,s.length>20&&0===s[0]&&(s=s.slice(1)),this.hashAlgorithm&&"sha1"!==this.hashAlgorithm||o.length+s.length!==40)throw new Error("OpenSSH only supports DSA signatures with SHA1 hash");return t.writeBuffer(i.concat([o,s])),t.toBuffer()}if("ssh"===e&&"ecdsa"===this.type){var h=new c({}),f;o=this.part.r.data,h.writeBuffer(o),h.writePart(this.part.s),t=new c({}),0===o[0]&&(o=o.slice(1));var p=8*o.length;return 256===p?f="nistp256":384===p?f="nistp384":528===p&&(f="nistp521"),t.writeString("ecdsa-sha2-"+f),t.writeBuffer(h.toBuffer()),t.toBuffer()}throw new Error("Invalid signature format");default:throw new Error("Invalid signature data")}},p.prototype.toString=function(e){return r.optionalString(e,"format"),this.toBuffer(e).toString("base64")},p.parse=function(e,t,n){"string"==typeof e&&(e=i.from(e,"base64")),r.buffer(e,"data"),r.string(n,"format"),r.string(t,"type");var o={};o.type=t.toLowerCase(),o.parts=[];try{switch(r.ok(e.length>0,"signature must not be empty"),o.type){case"rsa":case"ed25519":return d(e,t,n,o);case"dsa":case"ecdsa":return"asn1"===n?m(e,t,n,o):"dsa"===o.type?g(e,t,n,o):y(e,t,n,o);default:throw new h(t)}}catch(e){if(e instanceof h)throw e;throw new f(t,n,e)}},p.isSignature=function(e,t){return l.isCompatible(e,p,t)},p.prototype._sshpkApiVersion=[2,1],p._oldVersionDetect=function(e){return r.func(e.toBuffer),e.hasOwnProperty("hashAlgorithm")?[2,0]:[1,0]}},function(e,t,n){var r=n(1652);e.exports={Ber:r,BerReader:r.Reader,BerWriter:r.Writer}},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,n){"use strict";function r(e,t){t|=0;for(var n=Math.max(e.length-t,0),r=Array(n),i=0;iObject.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}),a=this,l={concatArrays:!1},u=e=>{const t=[];for(const n in e)i.call(e,n)&&t.push(n);if(Object.getOwnPropertySymbols){const n=Object.getOwnPropertySymbols(e);for(let r=0;r{s(t,n,c(e[n]))}),t}function f(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return u(e).forEach(n=>{s(t,n,c(e[n]))}),t}const p=(e,t,n,r)=>(n.forEach(n=>{n in e&&e[n]!==Object.getPrototypeOf(e)?s(e,n,m(e[n],t[n],r)):s(e,n,c(t[n]))}),e),d=(e,t,n)=>{let r=e.slice(0,0),o=0;return[e,t].forEach(t=>{const a=[];for(let n=0;n-1===a.indexOf(e)),n)}),r};function m(e,t,n){return n.concatArrays&&Array.isArray(e)&&Array.isArray(t)?d(e,t,n):r(t)&&r(e)?p(e,t,u(t),n):c(t)}e.exports=function(){const e=m(c(l),this!==a&&this||{},l);let t={foobar:{}};for(let n=0;ne.buffer)};return e.isConnected()?t.connection=c.CONNECTED:t.connection=c.NOT_CONNECTED,t}function p(e){const t=new i(new o(e.id));return e.addrs.forEach(e=>t.multiaddrs.add(e)),t}h.TYPES=u,h.CONNECTION_TYPES=c,e.exports=h}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(53),i=n(166);function o(e,t){r(e,i(e=>t(null,e)),e=>{e&&t(e)})}e.exports=o},function(e,t,n){e.exports={read:k,write:E};var r=n(25),i=n(84),o=n(16),s=n(29).Buffer,a=n(48),l=n(42),u=n(41),c=n(46),h=n(318),f=n(176),p=n(238),d=n(93),m=n(76),g="1.2.840.113549.1.5.13",y="1.2.840.113549.1.5.12",v={"1.2.840.113549.3.7":"3des-cbc","2.16.840.1.101.3.4.1.2":"aes128-cbc","2.16.840.1.101.3.4.1.42":"aes256-cbc"},b={};Object.keys(v).forEach(function(e){b[v[e]]=e});var _={"1.2.840.113549.2.7":"sha1","1.2.840.113549.2.9":"sha256","1.2.840.113549.2.11":"sha512"},w={};function k(e,t,n){var a=e;"string"!=typeof e&&(r.buffer(e,"buf"),e=e.toString("ascii"));for(var u=e.trim().split(/[\r\n]+/g),c,b=-1,w;!c&&b0;)w=u[--k].match(/[-]+[ ]*END ([A-Z0-9][A-Za-z0-9]+ )?(PUBLIC|PRIVATE) KEY[ ]*[-]+/);r.ok(w,"invalid PEM footer"),r.equal(c[2],w[2]);var E=c[2].toLowerCase(),S;c[1]&&(r.equal(c[1],w[1],"PEM header and footer mismatch"),S=c[1].trim()),u=u.slice(b,k+1);for(var x={},C,A,T;u=u.slice(1),c=u[0].match(/^([A-Za-z0-9-]+): (.+)$/),c;)x[c[1].toLowerCase()]=c[2];if(u=u.slice(0,-1).join(""),e=s.from(u,"base64"),x["proc-type"]){var I=x["proc-type"].split(",");if("4"===I[0]&&"ENCRYPTED"===I[1]){if("string"==typeof t.passphrase&&(t.passphrase=s.from(t.passphrase,"utf-8")),!s.isBuffer(t.passphrase))throw new m.KeyEncryptedError(t.filename,"PEM");I=x["dek-info"].split(","),r.ok(2===I.length),C=I[0].toLowerCase(),T=s.from(I[1],"hex"),A=l.opensslKeyDeriv(C,T,t.passphrase,1).key}}if(S&&"encrypted"===S.toLowerCase()){var j=new i.BerReader(e),R;j.readSequence(),j.readSequence(),R=j.offset+j.length;var B=j.readOID();if(B!==g)throw new Error("Unsupported PEM/PKCS8 encryption scheme: "+B);j.readSequence(),j.readSequence();var O=j.offset+j.length,P=j.readOID();if(P!==y)throw new Error("Unsupported PBES2 KDF: "+P);j.readSequence();var N=j.readString(i.Ber.OctetString,!0),D=j.readInt(),M="sha1";if(j.offsetp.length&&(v=p.length),g+=m.write(p.slice(y,v),g),m[g++]=10,y=v}return g+=m.write("-----END "+a+"-----\n",g),m.slice(0,g)}Object.keys(_).forEach(function(e){w[_[e]]=e})},function(e,t,n){e.exports={read:f.bind(void 0,!1,void 0),readType:f.bind(void 0,!1),write:p,readPartial:f.bind(void 0,!0),readInternal:f,keyTypeToAlg:h,algToKeyType:c};var r=n(25),i=n(29).Buffer,o=n(48),s=n(42),a=n(41),l=n(46),u=n(175);function c(e){if(r.string(e),"ssh-dss"===e)return"dsa";if("ssh-rsa"===e)return"rsa";if("ssh-ed25519"===e)return"ed25519";if("ssh-curve25519"===e)return"curve25519";if(e.match(/^ecdsa-sha2-/))return"ecdsa";throw new Error("Unknown algorithm "+e)}function h(e){if(r.object(e),"dsa"===e.type)return"ssh-dss";if("rsa"===e.type)return"ssh-rsa";if("ed25519"===e.type)return"ssh-ed25519";if("curve25519"===e.type)return"ssh-curve25519";if("ecdsa"===e.type)return"ecdsa-sha2-"+e.part.curve.data.toString();throw new Error("Unknown key type "+e.type)}function f(e,t,n,h){"string"==typeof n&&(n=i.from(n)),r.buffer(n,"buf");var f={},p=f.parts=[],d=new u({buffer:n}),m=d.readString();r.ok(!d.atEnd(),"key must have at least one part"),f.type=c(m);var g=o.info[f.type].parts.length;for(t&&"private"===t&&(g=o.privInfo[f.type].parts.length);!d.atEnd()&&p.length=1,"key must have at least one part"),r.ok(e||d.atEnd(),"leftover bytes at end of key");var y=a,v=o.info[f.type];if("private"!==t&&v.parts.length===p.length||(v=o.privInfo[f.type],y=l),r.strictEqual(v.parts.length,p.length),"ecdsa"===f.type){var b=/^ecdsa-sha2-(.+)$/.exec(m);r.ok(null!==b),r.strictEqual(b[1],p[0].data.toString())}for(var _=!0,w=0;w!e.status)}static p_connectedNames(e){const t=this._connected().map(e=>e.name);if(!e)return new Promise((e,n)=>e(t));e(null,t)}static async p_connectedNamesParm(){return(await this.p_connectedNames()).map(e=>"transport="+e).join("&")}static p_statuses(e){const t=c._transports.map(e=>({name:e.name,status:e.status}));if(!e)return new Promise((e,n)=>e(t));e(null,t)}static validFor(e,t,n){return"string"==typeof e&&(e=[e]),e&&e[0]||["store","newlisturls","newdatabase","newtable","seed"].includes(t)?e&&e.length>0?[].concat(...e.map(e=>"string"==typeof e?r.parse(e):e).map(e=>this._transports.filter(r=>r.validFor(e,t,n)).map(t=>[e,t]))):this._transports.filter(e=>e.validFor(void 0,t,n)).map(e=>[void 0,e]):(console.error("Transports.validFor called with invalid arguments: urls=",e,"func=",t),[])}static async p_urlsValidFor(e,t,n){return this.validFor(e,t,n).map(e=>e[0])}static http(){return c._connected().find(e=>"HTTP"===e.name)}static wolk(){return c._connected().find(e=>"WOLK"===e.name)}static ipfs(){return c._connected().find(e=>"IPFS"===e.name)}static webtorrent(){return c._connected().find(e=>"WEBTORRENT"===e.name)}static gun(){return c._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 togglePaused(e,t){const n=this._transports.find(t=>t.name===e);n?n.togglePaused(e=>t(null,e.status)):t(void 0)}static async _p_rawstore(e,t){let n=[],r=await Promise.all(e.map(async function(e){try{s("Storing %d bytes to %s",t.length,e.name);let r=await e.p_rawstore(t);return s("Storing %d bytes to %s succeeded: %s",t.length,e.name,r),r}catch(r){return s("Storing %d bytes to %s failed: %s",t.length,e.name,r.message),void n.push(r)}}));if(r=r.filter(e=>!!e),!r.length)throw s("Storing %d bytes failed on all transports",t.length),new i.TransportError(n.map(e=>e.message).join(", "));return r}static async p_rawstore(e){let t=this.validFor(void 0,"store").map(([e,t])=>t);if(!t.length)throw s("Storing %d bytes failed: no transports available",e.length),new i.TransportError("Transports.p_rawstore: Cant find transport for store");return this._p_rawstore(t,e)}static async p_rawfetch(e,t={}){if(!e.length)throw new i.TransportError("Transports.p_rawfetch given an empty list of urls");let n=await this.p_resolveNames(e);if(!n.length)throw new i.TransportError("Transports.p_rawfetch none of the urls resolved: "+e);let r=this.validFor(n,"fetch",{noCache:t.noCache});if(!r.length)throw new i.TransportError("Transports.p_rawfetch cant find any transport for urls: "+n);let o=[],a=[];for(const[e,n]of r)try{s("Fetching %s via %s",e.href,n.name);let r=await n.p_rawfetch(e,t);return s("Fetching %s via %s succeeded %d bytes",e.href,n.name,r.length),t.relay&&a.length&&(s("Fetching attempting relay of %d bytes from %s to %o",r.length,e.href,a.map(e=>e.name)),this._p_rawstore(a,r).then(e=>s("Fetching relayed %d bytes to %o",r.length,e))),r}catch(t){a.push(n),o.push(t),s("Fetching %s via %s failed: %s",e.href,n.name,t.message)}throw s("Fetching %o failed on all transports",e),new i.TransportError(o.map(e=>e.message).join(", "))}static fetch(e,t={},n){"function"==typeof t&&(n=t,t={});const r=this.p_rawfetch(e,t);if(!n)return r;r.then(e=>{try{n(null,e)}catch(e){s("Uncaught error in fetch %O",e)}}).catch(e=>n(e))}static seed({directoryPath:e,fileRelativePath:t,ipfsHash:n,urlToFile:r,torrentRelativePath:i},o){if(!o)return new Promise((e,t)=>{try{a.call(this,(n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{a.call(this,o)}catch(e){o(e)}function a(o){let a=this.validFor(void 0,"seed").map(([e,t])=>t);if(a.length){const s={};l(a,(o,a)=>o.seed({directoryPath:e,torrentRelativePath:i,fileRelativePath:t,ipfsHash:n,urlToFile:r},(e,t)=>{s[o.name]=e?{err:e.message}:t,a(null)}),e=>o(null,s))}else s("Seeding: no transports available"),o(null)}}static async p_rawlist(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"list");if(!t.length)throw new i.TransportError('Transports.p_rawlist: Cant find transport to "list" urls:'+e.join(","));let n=[],r=await Promise.all(t.map(async function([e,t]){try{s("Listing %s via %s",e,t.name);let r=await t.p_rawlist(e);return s("Listing %s via %s retrieved %d items",e,t.name,r.length),r}catch(r){return s("Listing %s via %s failed: %s",e,t.name,r.message),n.push(r),[]}}));if(n.length>=t.length)throw s("Listing %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "));let o={};return[].concat(...r).filter(e=>!o[e.signature]&&(o[e.signature]=!0))}static async p_rawadd(e,t){e=await this.p_resolveNames(e);let n=this.validFor(e,"add");if(!n.length)throw s("Adding to %o failed: no transports available",e),new i.TransportError("Transports.p_rawstore: Cant find transport for urls:"+e.join(","));let r=[];if(await Promise.all(n.map(async function([e,n]){try{return s("Adding to %s via %s",e,n.name),await n.p_rawadd(e,t),void s("Adding to %s via %s succeeded",e,n.name)}catch(t){return s("Adding to %s via %s failed: %s",e,n.name,t.message),void r.push(t)}})),r.length>=n.length)throw s("Adding to %o failed on all transports",e),new i.TransportError(r.map(e=>e.message).join(", "))}static listmonitor(e,t,n={}){this.validFor(e,"listmonitor").map(([e,r])=>{r.listmonitor(e,t,n),s("Monitoring list %s via %s",e,r.name)})}static async p_newlisturls(e){let t=await Promise.all(this.validFor(void 0,"newlisturls").map(([t,n])=>n.p_newlisturls(e)));return[t.map(e=>e[0]),t.map(e=>e[1])]}static async p_f_createReadStream(e,{wanturl:t=!1,preferredTransports:n=[]}={}){let r=this.validFor(e,"createReadStream",{});if(!r.length)throw s("Opening stream from %o failed: no transports available",e),new i.TransportError("Transports.p_createReadStream cant find any transport for urls: "+e);let o=[];r.sort((e,t)=>(n.indexOf(e[1].name)+1||999+Math.random())-(n.indexOf(t[1].name)+1||999+Math.random()));for(const[e,n]of r)try{s("Opening stream from %s via %s",e.href,n.name);let r=await n.p_f_createReadStream(e,{wanturl:t});return s("Opening stream from %s via %s succeeded",e.href,n.name),r}catch(t){o.push(t),s("Opening stream from %s via %s failed: %s",e.href,n.name,t.message)}throw s("Opening stream from %o failed on all transports",e),new i.TransportError(o.map(e=>e.message).join(", "))}static createReadStream(e,t,n){"function"==typeof t&&(n=t,t={start:0}),DwebTransports.p_f_createReadStream(e,{preferredTransports:t.preferredTransports||[]}).then(e=>{let r=e(t);if(!n)return r;n(null,r)}).catch(e=>{e instanceof i.TransportError?console.warn("Transports.createReadStream caught",e.message):console.error("Transports.createReadStream caught",e),n?n(e):reject(e)})}static async p_get(e,t){let n=this.validFor(e,"get"),r=Array.isArray(t)?`${t.length} keys`:t;if(!n.length)throw s("Getting %s from %o failed: no transports available",r,e),new i.TransportError("Transports.p_get cant find any transport to get keys from urls: "+e);let o=[];for(const[e,i]of n)try{s("Getting %s from %s via %s",r,e.href,i.name);let n=await i.p_get(e,t);return s("Getting %s from %s via %s succeeded length=%d",r,e.href,i.name,n.length),n}catch(t){o.push(t),s("Getting %s from %s via %s failed: %s",r,e.href,i.name,t.message)}throw s("Getting %s from %o failed on all transports",r,e),new i.TransportError(o.map(e=>e.message).join(", "))}static async p_set(e,t,n){e=await this.p_resolveNames(e);let r="object"==typeof t?`${t.length} keys`:t,o=this.validFor(e,"set");if(!o.length)throw s("Setting %s on %o failed: no transports available",r,e),new i.TransportError("Transports.p_set cant find any transport for urls: "+e);let a=[],l=!1;if(await Promise.all(o.map(async function([e,i]){try{s("Setting %s on %s via %s",r,e.href,i.name),await i.p_set(e,t,n),s("Setting %s on %s via %s succeeded",r,e.href,i.name),l=!0}catch(t){s("Setting %s on %s via %s failed: %s",r,e.href,i.name,t.message),a.push(t)}})),!l)throw s("Setting %s on %o failed on all transports",r,e),new i.TransportError(a.map(e=>e.message).join(", "))}static async p_delete(e,t){e=await this.p_resolveNames(e);let n=Array.isArray(t)?`${t.length} keys`:t,r=this.validFor(e,"set");if(!r.length)throw s("Deleting %s on %o failed: no transports available",n,e),new i.TransportError("Transports.p_set cant find any transport for urls: "+e);let o=[],a=!1;if(await Promise.all(r.map(async function([e,r]){try{s("Deleting %s on %s via %s",n,e.href,r.name),await r.p_delete(e,t),s("Deleting %s on %s via %s succeeded",n,e.href,r.name),a=!0}catch(t){s("Deleting %s on %s via %s failed: %s",n,e.href,r.name,t.message),o.push(t)}})),!a)throw s("Deleting %s on %o failed on all transports",n,e),new i.TransportError(o.map(e=>e.message).join(", "))}static async p_keys(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"keys");if(!t.length)throw s("Getting all keys on %o failed: no transports available",e),new i.TransportError("Transports.p_keys cant find any transport for urls: "+e);let n=[];for(const[e,r]of t)try{s("Getting all keys on %s via %s",e.href,r.name);let t=await r.p_keys(e);return s("Getting all keys on %s via %s succeeded with %d keys",e.href,r.name,t.length),t}catch(t){n.push(t),s("Getting all keys on %s via %s failed: %s",e.href,r.name,t.message)}throw s("Getting all keys on %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "))}static async p_getall(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"getall");if(!t.length)throw s("Getting all values on %o failed: no transports available",e),new i.TransportError("Transports.p_getall cant find any transport for urls: "+e);let n=[];for(const[e,r]of t)try{s("Getting all values on %s via %s",e.href,r.name);let t=await r.p_getall(e);return s("Getting all values on %s via %s succeeded with %d values",e.href,r.name,t.length),t}catch(t){n.push(t),s("Getting all values on %s via %s failed: %s",e.href,r.name,t.message)}throw s("Getting all keys on %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "))}static async p_newdatabase(e){let t=await Promise.all(this.validFor(void 0,"newdatabase").map(([t,n])=>n.p_newdatabase(e)));return{privateurls:t.map(e=>e.privateurl),publicurls:t.map(e=>e.publicurl)}}static async p_newtable(e,t){let n=await Promise.all(this.validFor(void 0,"newtable").map(([n,r])=>r.p_newtable(e,t)));return{privateurls:n.map(e=>e.privateurl),publicurls:n.map(e=>e.publicurl)}}static async p_connection(e){e=await this.p_resolveNames(e),await Promise.all(this.validFor(e,"connection").map(([e,t])=>t.p_connection(e)))}static monitor(e,t,{current:n=!1}={}){this.validFor(e,"monitor").map(([e,r])=>{s("Monitoring table %s via %s",e,r.name),r.monitor(e,t,{current:n})})}static addtransport(e){c._transports.push(e)}static setup0(e,t,n){let r={http:{urlbase:"http://localhost:4244"}};return e.map(e=>{let n=this._transportclasses["LOCAL"===e?"HTTP":e];return n?(s("Setting up connection to %s with options %o",e,t),n.setup0("LOCAL"===e?r:t)):void s("Connection to %s unavailable",e)}).filter(e=>!!e)}static p_setup1(e,t){const n=Promise.all(this._transports.filter(e=>!this._optionspaused.includes(e.name)).map(t=>(s("Connection stage 1 to %s",t.name),t.p_setup1(e))));if(!t)return n;n.catch(e=>t(e)).then(e=>t(null,e))}static p_setup2(e,t){const n=Promise.all(this._transports.filter(e=>!this._optionspaused.includes(e.name)).map(t=>(s("Connection stage 2 to %s",t.name),t.p_setup2(e))));if(!t)return n;n.catch(e=>t(e)).then(e=>t(null,e))}static p_stop(e,t){if(!t)return new Promise((e,t)=>{try{n.call(this,(n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{n.call(this,t)}catch(e){t(e)}function n(t){u(this._connected(),(t,n)=>{s("Stopping %s",t.name),t.stop(e,n)},t)}}static async refreshstatus(e){let t=["transportstatus0","transportstatus1","transportstatus2","transportstatus3","transportstatus4"],n=e.statuselement;n&&(n.classList.remove(...t),n.classList.add(t[e.status])),c.statuscb&&c.statuscb(e)}static connect(e,t){const n=this.p_connect(e);if(!t)return n;n.catch(e=>t(e)).then(e=>t(null,e))}static async p_connect(e){try{e=e||{};let t=e.transports;this._optionspaused=(e.paused||[]).map(e=>e.toUpperCase()),t&&t.length||(t=e.defaulttransports||[]),t.length||(t=["HTTP","IPFS","WEBTORRENT","WOLK"]),t=t.map(e=>e.toUpperCase());let n=this.setup0(t,e);if(["statuscb","mirror"].forEach(t=>{e[t]&&(this[t]=e[t])}),e.statuselement){let t=e.statuselement;for(;t.lastChild;)t.removeChild(t.lastChild);t.appendChild(o.createElement("UL",{},n.map(e=>{let t=o.createElement("LI",{onclick:"this.source.togglePaused(DwebTransports.refreshstatus);",source:e,name:e.name},e.name);return e.statuselement=t,t})))}await this.p_setup1(this.refreshstatus),await this.p_setup2(this.refreshstatus),s("Connection completed to %o",this._connected().map(e=>e.name))}catch(e){throw console.error("ERROR in p_connect:",e.message),e}}static async p_urlsFrom(e){if("string"==typeof e&&(e="["===e[0]?JSON.parse(e):e.includes(",")?e.split(","):[e]),!Array.isArray(e))throw new Error(`Unparsable url: ${e}`);return e}static async p_httpfetchurl(e){return c.http()._url(e.find(e=>e.startsWith("contenthash")||e.startsWith("http")),"content/rawfetch")}static canonicalName(e,t={}){"string"!=typeof e&&(e=r.parse(e).href);const n=["dweb.me","ipfs.io"],i=["ipfs","gun","magnet","yjs","wolk","arc","contenthash","http","https"],o=["arc","http","https"],s=[/^http[s]?:[/]+([^/]+)[/](\w+)[/](.*)/i],a=[/^dweb:[/]+(\w+)[/]+(.*)/i,/^\w+:[/]+(\w+)[/](.*)/i,/^(\w+):[/]*(.*)/i,/^[/]*(\w+)[/](.*)/i,/^[/]*dweb[/]*(\w+)[/](.*)/i],l=[/^http[s]?:[/]+[^/]+[/](archive).(org)[/]*(.*)/i,/^http[s]?:[/]+[^/]+[/]arc[/](archive).(org)[/]*(.*)/i,/^http[s]?:[/]+dweb.(\w+)[.]([^/]+)[/]*(.*)/i,/^(http[s])?:[/]+([^/]+)[/]+(.*)/i];for(let t of s){let r=e.match(t);if(r&&n.includes(r[1])&&i.includes(r[2]))return{proto:r[2],internal:r[3]}}for(let t of l){let n=e.match(t);if(n)return i.includes(n[1])?{proto:n[1],internal:o.includes(n[1])?[n[2],n[3]].join("/"):n[3]}:{proto:"arc",internal:[[n[1],n[2]].join("."),n[3]].join("/")}}for(let t of a){let n=e.match(t);if(n&&i.includes(n[1]))return{proto:n[1],internal:n[2]}}}static canonicalUrl(e,t={}){let n=this.canonicalName(e,t);return n.protocol+":/"+n.internal}static _o2url(e){return["http","https"].includes(e.proto)?[e.proto,e.internal].join("://"):e.proto?[this.mirror,e.proto,e.internal].join("/"):e.internal}static gatewayUrl(e){let t=c.canonicalName(e);return t?this._o2url(t):e}static gatewayUrls(e){const t=e.map(e=>c.canonicalName(e)||{proto:void 0,internal:e}),n=t.filter(e=>["arc"].includes(e.proto));return(n.length?n:t).map(e=>this._o2url(e))}}c._transports=[],c.namingcb=void 0,c._transportclasses={},c.httptools=a,t=e.exports=c},function(e,t,n){"use strict";(function(e){t.protobuf=e.from("50","hex"),t.cbor=e.from("51","hex"),t.rlp=e.from("60","hex"),t.bencode=e.from("63","hex"),t.multicodec=e.from("30","hex"),t.multihash=e.from("31","hex"),t.multiaddr=e.from("32","hex"),t.multibase=e.from("33","hex"),t.identity=e.from("00","hex"),t.sha1=e.from("11","hex"),t["sha2-256"]=e.from("12","hex"),t["sha2-512"]=e.from("13","hex"),t["sha3-512"]=e.from("14","hex"),t["sha3-384"]=e.from("15","hex"),t["sha3-256"]=e.from("16","hex"),t["sha3-224"]=e.from("17","hex"),t["shake-128"]=e.from("18","hex"),t["shake-256"]=e.from("19","hex"),t["keccak-224"]=e.from("1a","hex"),t["keccak-256"]=e.from("1b","hex"),t["keccak-384"]=e.from("1c","hex"),t["keccak-512"]=e.from("1d","hex"),t["murmur3-128"]=e.from("22","hex"),t["murmur3-32"]=e.from("23","hex"),t["dbl-sha2-256"]=e.from("56","hex"),t.md4=e.from("d4","hex"),t.md5=e.from("d5","hex"),t.bmt=e.from("d6","hex"),t.x11=e.from("1100","hex"),t["blake2b-8"]=e.from("b201","hex"),t["blake2b-16"]=e.from("b202","hex"),t["blake2b-24"]=e.from("b203","hex"),t["blake2b-32"]=e.from("b204","hex"),t["blake2b-40"]=e.from("b205","hex"),t["blake2b-48"]=e.from("b206","hex"),t["blake2b-56"]=e.from("b207","hex"),t["blake2b-64"]=e.from("b208","hex"),t["blake2b-72"]=e.from("b209","hex"),t["blake2b-80"]=e.from("b20a","hex"),t["blake2b-88"]=e.from("b20b","hex"),t["blake2b-96"]=e.from("b20c","hex"),t["blake2b-104"]=e.from("b20d","hex"),t["blake2b-112"]=e.from("b20e","hex"),t["blake2b-120"]=e.from("b20f","hex"),t["blake2b-128"]=e.from("b210","hex"),t["blake2b-136"]=e.from("b211","hex"),t["blake2b-144"]=e.from("b212","hex"),t["blake2b-152"]=e.from("b213","hex"),t["blake2b-160"]=e.from("b214","hex"),t["blake2b-168"]=e.from("b215","hex"),t["blake2b-176"]=e.from("b216","hex"),t["blake2b-184"]=e.from("b217","hex"),t["blake2b-192"]=e.from("b218","hex"),t["blake2b-200"]=e.from("b219","hex"),t["blake2b-208"]=e.from("b21a","hex"),t["blake2b-216"]=e.from("b21b","hex"),t["blake2b-224"]=e.from("b21c","hex"),t["blake2b-232"]=e.from("b21d","hex"),t["blake2b-240"]=e.from("b21e","hex"),t["blake2b-248"]=e.from("b21f","hex"),t["blake2b-256"]=e.from("b220","hex"),t["blake2b-264"]=e.from("b221","hex"),t["blake2b-272"]=e.from("b222","hex"),t["blake2b-280"]=e.from("b223","hex"),t["blake2b-288"]=e.from("b224","hex"),t["blake2b-296"]=e.from("b225","hex"),t["blake2b-304"]=e.from("b226","hex"),t["blake2b-312"]=e.from("b227","hex"),t["blake2b-320"]=e.from("b228","hex"),t["blake2b-328"]=e.from("b229","hex"),t["blake2b-336"]=e.from("b22a","hex"),t["blake2b-344"]=e.from("b22b","hex"),t["blake2b-352"]=e.from("b22c","hex"),t["blake2b-360"]=e.from("b22d","hex"),t["blake2b-368"]=e.from("b22e","hex"),t["blake2b-376"]=e.from("b22f","hex"),t["blake2b-384"]=e.from("b230","hex"),t["blake2b-392"]=e.from("b231","hex"),t["blake2b-400"]=e.from("b232","hex"),t["blake2b-408"]=e.from("b233","hex"),t["blake2b-416"]=e.from("b234","hex"),t["blake2b-424"]=e.from("b235","hex"),t["blake2b-432"]=e.from("b236","hex"),t["blake2b-440"]=e.from("b237","hex"),t["blake2b-448"]=e.from("b238","hex"),t["blake2b-456"]=e.from("b239","hex"),t["blake2b-464"]=e.from("b23a","hex"),t["blake2b-472"]=e.from("b23b","hex"),t["blake2b-480"]=e.from("b23c","hex"),t["blake2b-488"]=e.from("b23d","hex"),t["blake2b-496"]=e.from("b23e","hex"),t["blake2b-504"]=e.from("b23f","hex"),t["blake2b-512"]=e.from("b240","hex"),t["blake2s-8"]=e.from("b241","hex"),t["blake2s-16"]=e.from("b242","hex"),t["blake2s-24"]=e.from("b243","hex"),t["blake2s-32"]=e.from("b244","hex"),t["blake2s-40"]=e.from("b245","hex"),t["blake2s-48"]=e.from("b246","hex"),t["blake2s-56"]=e.from("b247","hex"),t["blake2s-64"]=e.from("b248","hex"),t["blake2s-72"]=e.from("b249","hex"),t["blake2s-80"]=e.from("b24a","hex"),t["blake2s-88"]=e.from("b24b","hex"),t["blake2s-96"]=e.from("b24c","hex"),t["blake2s-104"]=e.from("b24d","hex"),t["blake2s-112"]=e.from("b24e","hex"),t["blake2s-120"]=e.from("b24f","hex"),t["blake2s-128"]=e.from("b250","hex"),t["blake2s-136"]=e.from("b251","hex"),t["blake2s-144"]=e.from("b252","hex"),t["blake2s-152"]=e.from("b253","hex"),t["blake2s-160"]=e.from("b254","hex"),t["blake2s-168"]=e.from("b255","hex"),t["blake2s-176"]=e.from("b256","hex"),t["blake2s-184"]=e.from("b257","hex"),t["blake2s-192"]=e.from("b258","hex"),t["blake2s-200"]=e.from("b259","hex"),t["blake2s-208"]=e.from("b25a","hex"),t["blake2s-216"]=e.from("b25b","hex"),t["blake2s-224"]=e.from("b25c","hex"),t["blake2s-232"]=e.from("b25d","hex"),t["blake2s-240"]=e.from("b25e","hex"),t["blake2s-248"]=e.from("b25f","hex"),t["blake2s-256"]=e.from("b260","hex"),t["skein256-8"]=e.from("b301","hex"),t["skein256-16"]=e.from("b302","hex"),t["skein256-24"]=e.from("b303","hex"),t["skein256-32"]=e.from("b304","hex"),t["skein256-40"]=e.from("b305","hex"),t["skein256-48"]=e.from("b306","hex"),t["skein256-56"]=e.from("b307","hex"),t["skein256-64"]=e.from("b308","hex"),t["skein256-72"]=e.from("b309","hex"),t["skein256-80"]=e.from("b30a","hex"),t["skein256-88"]=e.from("b30b","hex"),t["skein256-96"]=e.from("b30c","hex"),t["skein256-104"]=e.from("b30d","hex"),t["skein256-112"]=e.from("b30e","hex"),t["skein256-120"]=e.from("b30f","hex"),t["skein256-128"]=e.from("b310","hex"),t["skein256-136"]=e.from("b311","hex"),t["skein256-144"]=e.from("b312","hex"),t["skein256-152"]=e.from("b313","hex"),t["skein256-160"]=e.from("b314","hex"),t["skein256-168"]=e.from("b315","hex"),t["skein256-176"]=e.from("b316","hex"),t["skein256-184"]=e.from("b317","hex"),t["skein256-192"]=e.from("b318","hex"),t["skein256-200"]=e.from("b319","hex"),t["skein256-208"]=e.from("b31a","hex"),t["skein256-216"]=e.from("b31b","hex"),t["skein256-224"]=e.from("b31c","hex"),t["skein256-232"]=e.from("b31d","hex"),t["skein256-240"]=e.from("b31e","hex"),t["skein256-248"]=e.from("b31f","hex"),t["skein256-256"]=e.from("b320","hex"),t["skein512-8"]=e.from("b321","hex"),t["skein512-16"]=e.from("b322","hex"),t["skein512-24"]=e.from("b323","hex"),t["skein512-32"]=e.from("b324","hex"),t["skein512-40"]=e.from("b325","hex"),t["skein512-48"]=e.from("b326","hex"),t["skein512-56"]=e.from("b327","hex"),t["skein512-64"]=e.from("b328","hex"),t["skein512-72"]=e.from("b329","hex"),t["skein512-80"]=e.from("b32a","hex"),t["skein512-88"]=e.from("b32b","hex"),t["skein512-96"]=e.from("b32c","hex"),t["skein512-104"]=e.from("b32d","hex"),t["skein512-112"]=e.from("b32e","hex"),t["skein512-120"]=e.from("b32f","hex"),t["skein512-128"]=e.from("b330","hex"),t["skein512-136"]=e.from("b331","hex"),t["skein512-144"]=e.from("b332","hex"),t["skein512-152"]=e.from("b333","hex"),t["skein512-160"]=e.from("b334","hex"),t["skein512-168"]=e.from("b335","hex"),t["skein512-176"]=e.from("b336","hex"),t["skein512-184"]=e.from("b337","hex"),t["skein512-192"]=e.from("b338","hex"),t["skein512-200"]=e.from("b339","hex"),t["skein512-208"]=e.from("b33a","hex"),t["skein512-216"]=e.from("b33b","hex"),t["skein512-224"]=e.from("b33c","hex"),t["skein512-232"]=e.from("b33d","hex"),t["skein512-240"]=e.from("b33e","hex"),t["skein512-248"]=e.from("b33f","hex"),t["skein512-256"]=e.from("b340","hex"),t["skein512-264"]=e.from("b341","hex"),t["skein512-272"]=e.from("b342","hex"),t["skein512-280"]=e.from("b343","hex"),t["skein512-288"]=e.from("b344","hex"),t["skein512-296"]=e.from("b345","hex"),t["skein512-304"]=e.from("b346","hex"),t["skein512-312"]=e.from("b347","hex"),t["skein512-320"]=e.from("b348","hex"),t["skein512-328"]=e.from("b349","hex"),t["skein512-336"]=e.from("b34a","hex"),t["skein512-344"]=e.from("b34b","hex"),t["skein512-352"]=e.from("b34c","hex"),t["skein512-360"]=e.from("b34d","hex"),t["skein512-368"]=e.from("b34e","hex"),t["skein512-376"]=e.from("b34f","hex"),t["skein512-384"]=e.from("b350","hex"),t["skein512-392"]=e.from("b351","hex"),t["skein512-400"]=e.from("b352","hex"),t["skein512-408"]=e.from("b353","hex"),t["skein512-416"]=e.from("b354","hex"),t["skein512-424"]=e.from("b355","hex"),t["skein512-432"]=e.from("b356","hex"),t["skein512-440"]=e.from("b357","hex"),t["skein512-448"]=e.from("b358","hex"),t["skein512-456"]=e.from("b359","hex"),t["skein512-464"]=e.from("b35a","hex"),t["skein512-472"]=e.from("b35b","hex"),t["skein512-480"]=e.from("b35c","hex"),t["skein512-488"]=e.from("b35d","hex"),t["skein512-496"]=e.from("b35e","hex"),t["skein512-504"]=e.from("b35f","hex"),t["skein512-512"]=e.from("b360","hex"),t["skein1024-8"]=e.from("b361","hex"),t["skein1024-16"]=e.from("b362","hex"),t["skein1024-24"]=e.from("b363","hex"),t["skein1024-32"]=e.from("b364","hex"),t["skein1024-40"]=e.from("b365","hex"),t["skein1024-48"]=e.from("b366","hex"),t["skein1024-56"]=e.from("b367","hex"),t["skein1024-64"]=e.from("b368","hex"),t["skein1024-72"]=e.from("b369","hex"),t["skein1024-80"]=e.from("b36a","hex"),t["skein1024-88"]=e.from("b36b","hex"),t["skein1024-96"]=e.from("b36c","hex"),t["skein1024-104"]=e.from("b36d","hex"),t["skein1024-112"]=e.from("b36e","hex"),t["skein1024-120"]=e.from("b36f","hex"),t["skein1024-128"]=e.from("b370","hex"),t["skein1024-136"]=e.from("b371","hex"),t["skein1024-144"]=e.from("b372","hex"),t["skein1024-152"]=e.from("b373","hex"),t["skein1024-160"]=e.from("b374","hex"),t["skein1024-168"]=e.from("b375","hex"),t["skein1024-176"]=e.from("b376","hex"),t["skein1024-184"]=e.from("b377","hex"),t["skein1024-192"]=e.from("b378","hex"),t["skein1024-200"]=e.from("b379","hex"),t["skein1024-208"]=e.from("b37a","hex"),t["skein1024-216"]=e.from("b37b","hex"),t["skein1024-224"]=e.from("b37c","hex"),t["skein1024-232"]=e.from("b37d","hex"),t["skein1024-240"]=e.from("b37e","hex"),t["skein1024-248"]=e.from("b37f","hex"),t["skein1024-256"]=e.from("b380","hex"),t["skein1024-264"]=e.from("b381","hex"),t["skein1024-272"]=e.from("b382","hex"),t["skein1024-280"]=e.from("b383","hex"),t["skein1024-288"]=e.from("b384","hex"),t["skein1024-296"]=e.from("b385","hex"),t["skein1024-304"]=e.from("b386","hex"),t["skein1024-312"]=e.from("b387","hex"),t["skein1024-320"]=e.from("b388","hex"),t["skein1024-328"]=e.from("b389","hex"),t["skein1024-336"]=e.from("b38a","hex"),t["skein1024-344"]=e.from("b38b","hex"),t["skein1024-352"]=e.from("b38c","hex"),t["skein1024-360"]=e.from("b38d","hex"),t["skein1024-368"]=e.from("b38e","hex"),t["skein1024-376"]=e.from("b38f","hex"),t["skein1024-384"]=e.from("b390","hex"),t["skein1024-392"]=e.from("b391","hex"),t["skein1024-400"]=e.from("b392","hex"),t["skein1024-408"]=e.from("b393","hex"),t["skein1024-416"]=e.from("b394","hex"),t["skein1024-424"]=e.from("b395","hex"),t["skein1024-432"]=e.from("b396","hex"),t["skein1024-440"]=e.from("b397","hex"),t["skein1024-448"]=e.from("b398","hex"),t["skein1024-456"]=e.from("b399","hex"),t["skein1024-464"]=e.from("b39a","hex"),t["skein1024-472"]=e.from("b39b","hex"),t["skein1024-480"]=e.from("b39c","hex"),t["skein1024-488"]=e.from("b39d","hex"),t["skein1024-496"]=e.from("b39e","hex"),t["skein1024-504"]=e.from("b39f","hex"),t["skein1024-512"]=e.from("b3a0","hex"),t["skein1024-520"]=e.from("b3a1","hex"),t["skein1024-528"]=e.from("b3a2","hex"),t["skein1024-536"]=e.from("b3a3","hex"),t["skein1024-544"]=e.from("b3a4","hex"),t["skein1024-552"]=e.from("b3a5","hex"),t["skein1024-560"]=e.from("b3a6","hex"),t["skein1024-568"]=e.from("b3a7","hex"),t["skein1024-576"]=e.from("b3a8","hex"),t["skein1024-584"]=e.from("b3a9","hex"),t["skein1024-592"]=e.from("b3aa","hex"),t["skein1024-600"]=e.from("b3ab","hex"),t["skein1024-608"]=e.from("b3ac","hex"),t["skein1024-616"]=e.from("b3ad","hex"),t["skein1024-624"]=e.from("b3ae","hex"),t["skein1024-632"]=e.from("b3af","hex"),t["skein1024-640"]=e.from("b3b0","hex"),t["skein1024-648"]=e.from("b3b1","hex"),t["skein1024-656"]=e.from("b3b2","hex"),t["skein1024-664"]=e.from("b3b3","hex"),t["skein1024-672"]=e.from("b3b4","hex"),t["skein1024-680"]=e.from("b3b5","hex"),t["skein1024-688"]=e.from("b3b6","hex"),t["skein1024-696"]=e.from("b3b7","hex"),t["skein1024-704"]=e.from("b3b8","hex"),t["skein1024-712"]=e.from("b3b9","hex"),t["skein1024-720"]=e.from("b3ba","hex"),t["skein1024-728"]=e.from("b3bb","hex"),t["skein1024-736"]=e.from("b3bc","hex"),t["skein1024-744"]=e.from("b3bd","hex"),t["skein1024-752"]=e.from("b3be","hex"),t["skein1024-760"]=e.from("b3bf","hex"),t["skein1024-768"]=e.from("b3c0","hex"),t["skein1024-776"]=e.from("b3c1","hex"),t["skein1024-784"]=e.from("b3c2","hex"),t["skein1024-792"]=e.from("b3c3","hex"),t["skein1024-800"]=e.from("b3c4","hex"),t["skein1024-808"]=e.from("b3c5","hex"),t["skein1024-816"]=e.from("b3c6","hex"),t["skein1024-824"]=e.from("b3c7","hex"),t["skein1024-832"]=e.from("b3c8","hex"),t["skein1024-840"]=e.from("b3c9","hex"),t["skein1024-848"]=e.from("b3ca","hex"),t["skein1024-856"]=e.from("b3cb","hex"),t["skein1024-864"]=e.from("b3cc","hex"),t["skein1024-872"]=e.from("b3cd","hex"),t["skein1024-880"]=e.from("b3ce","hex"),t["skein1024-888"]=e.from("b3cf","hex"),t["skein1024-896"]=e.from("b3d0","hex"),t["skein1024-904"]=e.from("b3d1","hex"),t["skein1024-912"]=e.from("b3d2","hex"),t["skein1024-920"]=e.from("b3d3","hex"),t["skein1024-928"]=e.from("b3d4","hex"),t["skein1024-936"]=e.from("b3d5","hex"),t["skein1024-944"]=e.from("b3d6","hex"),t["skein1024-952"]=e.from("b3d7","hex"),t["skein1024-960"]=e.from("b3d8","hex"),t["skein1024-968"]=e.from("b3d9","hex"),t["skein1024-976"]=e.from("b3da","hex"),t["skein1024-984"]=e.from("b3db","hex"),t["skein1024-992"]=e.from("b3dc","hex"),t["skein1024-1000"]=e.from("b3dd","hex"),t["skein1024-1008"]=e.from("b3de","hex"),t["skein1024-1016"]=e.from("b3df","hex"),t["skein1024-1024"]=e.from("b3e0","hex"),t.ip4=e.from("04","hex"),t.tcp=e.from("06","hex"),t.dccp=e.from("21","hex"),t.ip6=e.from("29","hex"),t.ip6zone=e.from("2a","hex"),t.dns=e.from("35","hex"),t.dns4=e.from("36","hex"),t.dns6=e.from("37","hex"),t.dnsaddr=e.from("38","hex"),t.sctp=e.from("84","hex"),t.udp=e.from("0111","hex"),t["p2p-webrtc-star"]=e.from("0113","hex"),t["p2p-webrtc-direct"]=e.from("0114","hex"),t["p2p-stardust"]=e.from("0115","hex"),t["p2p-circuit"]=e.from("0122","hex"),t.udt=e.from("012d","hex"),t.utp=e.from("012e","hex"),t.unix=e.from("0190","hex"),t.p2p=e.from("01a5","hex"),t.ipfs=e.from("01a5","hex"),t.https=e.from("01bb","hex"),t.onion=e.from("01bc","hex"),t.onion3=e.from("01bd","hex"),t.garlic64=e.from("01be","hex"),t.garlic32=e.from("01bf","hex"),t.quic=e.from("01cc","hex"),t.ws=e.from("01dd","hex"),t.wss=e.from("01de","hex"),t["p2p-websocket-star"]=e.from("01df","hex"),t.http=e.from("01e0","hex"),t.raw=e.from("55","hex"),t["dag-pb"]=e.from("70","hex"),t["dag-cbor"]=e.from("71","hex"),t["libp2p-key"]=e.from("72","hex"),t["git-raw"]=e.from("78","hex"),t["torrent-info"]=e.from("7b","hex"),t["torrent-file"]=e.from("7c","hex"),t["leofcoin-block"]=e.from("81","hex"),t["leofcoin-tx"]=e.from("82","hex"),t["leofcoin-pr"]=e.from("83","hex"),t["eth-block"]=e.from("90","hex"),t["eth-block-list"]=e.from("91","hex"),t["eth-tx-trie"]=e.from("92","hex"),t["eth-tx"]=e.from("93","hex"),t["eth-tx-receipt-trie"]=e.from("94","hex"),t["eth-tx-receipt"]=e.from("95","hex"),t["eth-state-trie"]=e.from("96","hex"),t["eth-account-snapshot"]=e.from("97","hex"),t["eth-storage-trie"]=e.from("98","hex"),t["bitcoin-block"]=e.from("b0","hex"),t["bitcoin-tx"]=e.from("b1","hex"),t["zcash-block"]=e.from("c0","hex"),t["zcash-tx"]=e.from("c1","hex"),t["stellar-block"]=e.from("d0","hex"),t["stellar-tx"]=e.from("d1","hex"),t["decred-block"]=e.from("e0","hex"),t["decred-tx"]=e.from("e1","hex"),t["dash-block"]=e.from("f0","hex"),t["dash-tx"]=e.from("f1","hex"),t["swarm-manifest"]=e.from("fa","hex"),t["swarm-feed"]=e.from("fb","hex"),t["dag-json"]=e.from("0129","hex"),t.path=e.from("2f","hex"),t["ipld-ns"]=e.from("e2","hex"),t["ipfs-ns"]=e.from("e3","hex"),t["swarm-ns"]=e.from("e4","hex"),t["ed25519-pub"]=e.from("ed","hex"),t["holochain-adr-v0"]=e.from("807124","hex"),t["holochain-adr-v1"]=e.from("817124","hex"),t["holochain-key-v0"]=e.from("947124","hex"),t["holochain-key-v1"]=e.from("957124","hex"),t["holochain-sig-v0"]=e.from("a27124","hex"),t["holochain-sig-v1"]=e.from("a37124","hex")}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(9),o=n(24),s=n(39);class a{constructor(e,t,n){o(n,"A link requires a cid to point to"),this._name=e||"",this._nameBuf=null,this._size=t,this._cid=new i(n)}toString(){return`DAGLink <${this._cid.toBaseEncodedString()} - name: "${this.name}", size: ${this.size}>`}toJSON(){return this._json||(this._json=Object.freeze({name:this.name,size:this.size,cid:this._cid.toBaseEncodedString()})),Object.assign({},this._json)}get name(){return this._name}get nameAsBuffer(){return null!==this._nameBuf?this._nameBuf:(this._nameBuf=r.from(this._name),this._nameBuf)}set name(e){throw new Error("Can't set property: 'name' is immutable")}get size(){return this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}get cid(){return this._cid}set cid(e){throw new Error("Can't set property: 'cid' is immutable")}}t=e.exports=s(a,{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"}),t.create=n(740),t.util=n(741)}).call(this,n(0).Buffer)},function(e,t,n){var r=n(21);e.exports=r.md=r.md||{},r.md.algorithms=r.md.algorithms||{}},function(e,t,n){"use strict";var r=n(11),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=h;var o=n(7);o.inherits=n(1);var s=n(381),a=n(259);o.inherits(h,s);for(var l=i(a.prototype),u=0;u{const n=["bitswap"];t&&n.push(t),e&&n.push(`${e.toB58String().slice(0,8)}`);const i=r(n.join(":"));return i.error=r(n.concat(["error"]).join(":")),i},o=(e,t,n)=>{let r=0;const i=n.length;for(;r{let n=0;const r=t.length,i=[];let s;for(;nt.reduce((t,n)=>{const r=e(n);return t[r]?t[r].push(n):t[r]=[n],t},{}),l=(e,t,n)=>t.filter(t=>!o(e,t,n)),u=(e,t)=>Array.prototype.slice.call(t,0).sort((t,n)=>{const r=e(t),i=e(n);return ri?1:0});e.exports={logger:i,includesWith:o,uniqWith:s,groupBy:a,pullAllWith:l,sortBy:u}},function(e,t,n){"use strict";(function(t,r){var i=65536,o=4294967295;function s(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}var a=n(5).Buffer,l=t.crypto||t.msCrypto;function u(e,t){if(e>o)throw new RangeError("requested too many random bytes");var n=a.allocUnsafe(e);if(e>0)if(e>i)for(var s=0;s{setTimeout(()=>{n(t)},e)})}class a{constructor(e){}static setup0(e){throw new o.IntentionallyUnimplementedError("Intentionally undefined function Transport.setup0 should have been subclassed")}p_setup1(e){return this}p_setup2(e){return this}static async p_setup(e,t){let n=await this.setup0(e).p_setup1(t);return n.p_setup2(t)}stop(e,t){this.status=a.STATUS_FAILED,e&&e(this),t(null,this)}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}connected(){return!this.status}supports(e,t,{noCache:n}={}){if("string"==typeof e&&(e=r.parse(e)),e&&!e.protocol)throw new Error("URL failed to specific a scheme (before :) "+e.href);return(!e||this.supportURLs.includes(e.protocol.slice(0,-1)))&&(!t||this.supportFunctions.includes(t))&&(!n||this.supportFeatures.includes("noCache"))}validFor(e,t,n){return this.connected()&&this.supports(e,t,n)}p_rawstore(e,t){throw new o.ToBeImplementedError("Intentionally undefined function Transport.p_rawstore should have been subclassed")}async p_rawstoreCaught(e){try{return await this.p_rawstore(e)}catch(e){}}p_store(){throw new o.ToBeImplementedError("Undefined function Transport.p_store - may define higher level semantics here (see Python)")}p_rawfetch(e,{timeoutMS:t,start:n,end:r,relay:i=!1}={}){return console.assert(!1,"Intentionally undefined function Transport.p_rawfetch should have been subclassed"),"UNIMPLEMENTED"}p_fetch(){throw new o.ToBeImplementedError("Undefined function Transport.p_fetch - may define higher level semantics here (see Python)")}p_rawadd(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_rawadd")}p_rawlist(e){throw new o.ToBeImplementedError("Undefined function Transport.p_rawlist")}p_list(){throw new Error("Undefined function Transport.p_list")}p_newlisturls(e){throw new Error("undefined function Transport.p_newlisturls")}p_rawreverse(e){throw new o.ToBeImplementedError("Undefined function Transport.p_rawreverse")}listmonitor(e,t,{current:n=!1}={}){console.log("Undefined function Transport.listmonitor")}async p_newdatabase(e){throw new o.ToBeImplementedError("Undefined function Transport.p_newdatabase")}async p_newtable(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_newtable")}async p_set(e,t,n){throw new o.ToBeImplementedError("Undefined function Transport.p_set")}async p_get(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_get")}async p_delete(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_delete")}async p_keys(e){throw new o.ToBeImplementedError("Undefined function Transport.p_keys")}async p_getall(e){throw new o.ToBeImplementedError("Undefined function Transport.p_keys")}static async p_f_createReadStream(e,{wanturl:t=!1}){}static mergeoptions(e){let t={};for(let n=0;n",r),console.assert("bar"===r.testkey2.foo&&2===r.testkey3[1]&&!r.testkey),await s(200),console.log(this.name,"p_test_kvt complete")}catch(e){throw console.log("Exception thrown in ",this.name,"p_test_kvt:",e.message),e}}}a.STATUS_CONNECTED=0,a.STATUS_FAILED=1,a.STATUS_STARTING=2,a.STATUS_LOADED=3,a.STATUS_PAUSED=4,a.STATUSTEXT=["Connected","Failed","Starting","Loaded","Paused"],t=e.exports=a},function(e,t,n){"use strict";function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var i={};function o(e,t,n){function o(e,n,r){return"string"==typeof t?t:t(e,n,r)}n||(n=Error);var s=function(e){function t(t,n,r){return e.call(this,o(t,n,r))||this}return r(t,e),t}(n);s.prototype.name=n.name,s.prototype.code=e,i[e]=s}function s(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return String(e)}),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}function a(e,t,n){return e.substr(!n||n<0?0:+n,t.length)===t}function l(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}function u(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}o("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),o("ERR_INVALID_ARG_TYPE",function(e,t,n){var r,i;if("string"==typeof t&&a(t,"not ")?(r="must not be",t=t.replace(/^not /,"")):r="must be",l(e," argument"))i="The ".concat(e," ").concat(r," ").concat(s(t,"type"));else{var o=u(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(o," ").concat(r," ").concat(s(t,"type"))}return i+=". Received type ".concat(typeof n),i},TypeError),o("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),o("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),o("ERR_STREAM_PREMATURE_CLOSE","Premature close"),o("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),o("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),o("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),o("ERR_STREAM_WRITE_AFTER_END","write after end"),o("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),o("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),o("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=i},function(e,t,n){"use strict";(function(t){var r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=u;var i=n(335),o=n(339);n(1)(u,i);for(var s=r(o.prototype),a=0;a{let n;if(r.isBuffer(e))n=a.varintBufferEncode(e);else{if(!o[e])throw new Error("multicodec not recognized");n=o[e]}return r.concat([n,t])}),t.rmPrefix=(e=>(i.decode(e),e.slice(i.decode.bytes))),t.getCodec=(e=>{const t=a.varintBufferDecode(e),n=s[t.toString("hex")];if(void 0===n)throw new Error("Code `0x"+t.toString("hex")+"` not found");return n}),t.getName=(e=>s[e.toString(16)]),t.getNumber=(e=>{const t=o[e];if(void 0===t)throw new Error("Codec `"+e+"` not found");return a.varintBufferDecode(t)[0]}),t.getCode=(e=>i.decode(e)),t.getCodeVarint=(e=>{const t=o[e];if(void 0===t)throw new Error("Codec `"+e+"` not found");return t}),t.getVarint=(e=>i.encode(e));const l=n(693);Object.assign(t,l),t.print=n(694)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(343);e.exports=function e(t,n){return function(e,i){if(e)return r(i,e,n);if(null!=t){var o=t;t=null,i(null,o)}else i(!0)}}},function(e,t,n){var r=n(21);n(30),n(152);var i=e.exports=r.asn1=r.asn1||{};function o(e,t,n){if(n>t){var r=new Error("Too few bytes to parse DER.");throw r.available=e.length(),r.remaining=t,r.requested=n,r}}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},i.create=function(e,t,n,o,s){if(r.util.isArray(o)){for(var a=[],l=0;lt){if(r.strict){var m=new Error("Too few bytes to read ASN.1 value.");throw m.available=e.length(),m.remaining=t,m.requested=f,m}f=t}var g=32==(32&u);if(g)if(p=[],void 0===f)for(;;){if(o(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}l=e.length(),p.push(a(e,t,n+1,r)),t-=l-e.length()}else for(;f>0;)l=e.length(),p.push(a(e,f,n+1,r)),t-=l-e.length(),f-=l-e.length();if(void 0===p&&c===i.Class.UNIVERSAL&&h===i.Type.BITSTRING&&(d=e.bytes(f)),void 0===p&&r.decodeBitStrings&&c===i.Class.UNIVERSAL&&h===i.Type.BITSTRING&&f>1){var y=e.read,v=t,b=0;if(h===i.Type.BITSTRING&&(o(e,t,1),b=e.getByte(),t--),0===b)try{l=e.length();var _={verbose:r.verbose,strict:!0,decodeBitStrings:!0},w=a(e,t,n+1,_),k=l-e.length();t-=k,h==i.Type.BITSTRING&&k++;var E=w.tagClass;k!==f||E!==i.Class.UNIVERSAL&&E!==i.Class.CONTEXT_SPECIFIC||(p=[w])}catch(e){}void 0===p&&(e.read=y,t=v)}if(void 0===p){if(void 0===f){if(r.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");f=t}if(h===i.Type.BMPSTRING)for(p="";f>0;f-=2)o(e,t,2),p+=String.fromCharCode(e.getInt16()),t-=2;else p=e.getBytes(f)}var S=void 0===d?null:{bitStringContents:d};return i.create(c,h,g,p,S)}i.fromDer=function(e,t){return void 0===t&&(t={strict:!0,decodeBitStrings:!0}),"boolean"==typeof t&&(t={strict:t,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"==typeof e&&(e=r.util.createBuffer(e)),a(e,e.length(),0,t)},i.toDer=function(e){var t=r.util.createBuffer(),n=e.tagClass|e.type,o=r.util.createBuffer(),s=!1;if("bitStringContents"in e&&(s=!0,e.original&&(s=i.equals(e,e.original))),s)o.putBytes(e.bitStringContents);else if(e.composed){e.constructed?n|=32:o.putByte(0);for(var a=0;a1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?o.putBytes(e.value.substr(1)):o.putBytes(e.value);if(t.putByte(n),o.length()<=127)t.putByte(127&o.length());else{var l=o.length(),u="";do{u+=String.fromCharCode(255&l),l>>>=8}while(l>0);t.putByte(128|u.length);for(var a=u.length-1;a>=0;--a)t.putByte(u.charCodeAt(a))}return t.putBuffer(o),t},i.oidToDer=function(e){var t=e.split("."),n=r.util.createBuffer(),i,o,s,a;n.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var l=2;l>>=7,i||(a|=128),o.push(a),i=!1}while(s>0);for(var u=o.length-1;u>=0;--u)n.putByte(o[u])}return n},i.derToOid=function(e){var t;"string"==typeof e&&(e=r.util.createBuffer(e));var n=e.getByte();t=Math.floor(n/40)+"."+n%40;for(var i=0;e.length()>0;)n=e.getByte(),i<<=7,128&n?i+=127&n:(t+="."+(i+n),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,n=parseInt(e.substr(0,2),10);n=n>=50?1900+n:2e3+n;var r=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),o=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),a=0;if(e.length>11){var l=e.charAt(10),u=10;"+"!==l&&"-"!==l&&(a=parseInt(e.substr(10,2),10),u+=2)}if(t.setUTCFullYear(n,r,i),t.setUTCHours(o,s,a,0),u&&(l=e.charAt(u),"+"===l||"-"===l)){var c=parseInt(e.substr(u+1,2),10),h=parseInt(e.substr(u+4,2),10),f=60*c+h;f*=6e4,"+"===l?t.setTime(+t-f):t.setTime(+t+f)}return t},i.generalizedTimeToDate=function(e){var t=new Date,n=parseInt(e.substr(0,4),10),r=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),l=0,u=0,c=!1;"Z"===e.charAt(e.length-1)&&(c=!0);var h=e.length-5,f=e.charAt(h);if("+"===f||"-"===f){var p=parseInt(e.substr(h+1,2),10),d=parseInt(e.substr(h+4,2),10);u=60*p+d,u*=6e4,"+"===f&&(u*=-1),c=!0}return"."===e.charAt(14)&&(l=1e3*parseFloat(e.substr(14),10)),c?(t.setUTCFullYear(n,r,i),t.setUTCHours(o,s,a,l),t.setTime(+t+u)):(t.setFullYear(n,r,i),t.setHours(o,s,a,l)),t},i.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",n=[];n.push((""+e.getUTCFullYear()).substr(2)),n.push(""+(e.getUTCMonth()+1)),n.push(""+e.getUTCDate()),n.push(""+e.getUTCHours()),n.push(""+e.getUTCMinutes()),n.push(""+e.getUTCSeconds());for(var r=0;r=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var n=new Error("Integer too large; max is 32-bits.");throw n.integer=e,n},i.derToInteger=function(e){"string"==typeof e&&(e=r.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},i.validate=function(e,t,n,o){var s=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)o&&(e.tagClass!==t.tagClass&&o.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&o.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(s=!0,t.value&&r.util.isArray(t.value))for(var a=0,l=0;s&&l0&&(o+="\n");for(var s="",a=0;a1?o+="0x"+r.util.bytesToHex(e.value.slice(1)):o+="(none)",e.value.length>0){var f=e.value.charCodeAt(0);1==f?o+=" (1 unused bit shown)":f>1&&(o+=" ("+f+" unused bits shown)")}}else e.type===i.Type.OCTETSTRING?(l.test(e.value)||(o+="("+e.value+") "),o+="0x"+r.util.bytesToHex(e.value)):e.type===i.Type.UTF8?o+=r.util.decodeUtf8(e.value):e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?o+=e.value:l.test(e.value)?o+="0x"+r.util.bytesToHex(e.value):0===e.value.length?o+="[null]":o+=e.value}return o}},function(e,t,n){var r=n(21);n(196),n(747),n(748),n(30),r.random&&r.random.getBytes?e.exports=r.random:function(t){var n={},i=new Array(4),o=r.util.createBuffer();function s(){var e=r.prng.create(n);return e.getBytes=function(t,n){return e.generate(t,n)},e.getBytesSync=function(t){return e.generate(t)},e}n.formatKey=function(e){var t=r.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),r.aes._expandKey(e,!1)},n.formatSeed=function(e){var t=r.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},n.cipher=function(e,t){return r.aes._updateBlock(e,t,i,!1),o.putInt32(i[0]),o.putInt32(i[1]),o.putInt32(i[2]),o.putInt32(i[3]),o.getBytes()},n.increment=function(e){return++e[3],e},n.md=r.md.sha256;var a=s(),l=null;if("undefined"!=typeof window){var u=window.crypto||window.msCrypto;u&&u.getRandomValues&&(l=function(e){return u.getRandomValues(e)})}if(r.options.usePureJavaScript||!r.util.isNodejs&&!l){if("undefined"==typeof window||window.document,a.collectInt(+new Date,32),"undefined"!=typeof navigator){var c="";for(var h in navigator)try{"string"==typeof navigator[h]&&(c+=navigator[h])}catch(e){}a.collect(c),c=null}t&&(t().mousemove(function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)}),t().keypress(function(e){a.collectInt(e.charCode,8)}))}if(r.random)for(var h in a)r.random[h]=a[h];else r.random=a;r.random.createInstance=s,e.exports=r.random}("undefined"!=typeof jQuery?jQuery:null)},function(e,t,n){"use strict";const r=t;r.bignum=n(757),r.define=n(759).define,r.base=n(153),r.constants=n(375),r.decoders=n(764),r.encoders=n(766)},function(e,t,n){var r=n(5).Buffer;function i(e,t){this._block=r.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}i.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=r.from(e,t));for(var n=this._block,i=this._blockSize,o=e.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i},function(e,t,n){var r=n(404),i=n(405);function o(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null),e=e||{};var s=e.random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(430),i=a(r),o=n(109),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default,1),e.exports=t.default},function(e,t,n){"use strict";e.exports={Record:n(916),validator:n(919),selection:n(927)}},function(e,t,n){function r(e){if(e)return i(e)}function i(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},r.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+e],r;if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i1?{type:p[i],data:e.substring(1)}:{type:p[i]}:d}var s=new Uint8Array(e),i=s[0],a=o(e,1);return m&&"blob"===n&&(a=new m([a])),{type:p[i],data:a}},t.decodeBase64Packet=function(e,t){var n=p[e.charAt(0)];if(!l)return{type:n,data:{base64:!0,data:e.substr(1)}};var r=l.decode(e.substr(1));return"blob"===t&&m&&(r=new m([r])),{type:n,data:r}},t.encodePayload=function(e,n,r){"function"==typeof n&&(r=n,n=null);var o=i(e);if(n&&o)return m&&!h?t.encodePayloadAsBlob(e,r):t.encodePayloadAsArrayBuffer(e,r);if(!e.length)return r("0:");function s(e){return e.length+":"+e}function a(e,r){t.encodePacket(e,!!o&&n,!1,function(e){r(null,s(e))})}w(e,a,function(e,t){return r(t.join(""))})},t.decodePayload=function(e,n,r){if("string"!=typeof e)return t.decodePayloadAsBinary(e,n,r);var i;if("function"==typeof n&&(r=n,n=null),""===e)return r(d,0,1);for(var o="",s,a,l=0,u=e.length;l0;){for(var a=new Uint8Array(i),l=0===a[0],u="",c=1;255!==a[c];c++){if(u.length>310)return r(d,0,1);u+=a[c]}i=o(i,2+u.length),u=parseInt(u);var h=o(i,0,u);if(l)try{h=String.fromCharCode.apply(null,new Uint8Array(h))}catch(e){var f=new Uint8Array(h);h="";for(var c=0;c{const n=r(e,t);return(e,t,r)=>{n(e,t,(e,t)=>{if(e)return r(e);r(null,t[0])})}})},function(e,t,n){"use strict";var r=n(11),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=h;var o=n(7);o.inherits=n(1);var s=n(554),a=n(557);o.inherits(h,s);for(var l=i(a.prototype),u=0;u=t)throw new Error("Cannot access property/index "+r+" levels up, current level is "+t);return n[t-r]}if(r>t)throw new Error("Cannot access data "+r+" levels up, current level is "+t);if(o="data"+(t-r||""),!i)return o}for(var a=o,l=i.split("/"),u=0;u=0||1/0===e||-1/0===e)}},t.text={is:function(e){return"string"==typeof e}},t.text.ify=function(e){return t.text.is(e)?e:"undefined"!=typeof JSON?JSON.stringify(e):e&&e.toString?e.toString():e},t.text.random=function(e,t){var n="";for(e=e||24,t=t||"0123456789ABCDEFGHIJKLMNOPQRSTUVWXZabcdefghijklmnopqrstuvwxyz";e>0;)n+=t.charAt(Math.floor(Math.random()*t.length)),e--;return n},t.text.match=function(e,t){var n,r;return"string"==typeof e&&("string"==typeof t&&(t={"=":t}),t=t||{},n=t["="]||t["*"]||t[">"]||t["<"],e===n||r===t["="]&&(n=t["*"]||t[">"]||t["<"],e.slice(0,(n||"").length)===n||r===t["*"]&&(r!==t[">"]&&r!==t["<"]?e>=t[">"]&&e<=t["<"]:r!==t[">"]&&e>=t[">"]||r!==t["<"]&&e<=t["<"])))},t.list={is:function(e){return e instanceof Array}},t.list.slit=Array.prototype.slice,t.list.sort=function(e){return function(t,n){return t&&n?(t=t[e],n=n[e],tn?1:0):0}},t.list.map=function(e,t,n){return a(e,t,n)},t.list.index=1,t.obj={is:function(e){return!!e&&(e instanceof Object&&e.constructor===Object||"Object"===Object.prototype.toString.call(e).match(/^\[object (\w+)\]$/)[1])}},t.obj.put=function(e,t,n){return(e||{})[t]=n,e},t.obj.has=function(e,t){return e&&Object.prototype.hasOwnProperty.call(e,t)},t.obj.del=function(e,t){if(e)return e[t]=null,delete e[t],e},t.obj.as=function(e,t,n,r){return e[t]=e[t]||(r===n?{}:n)},t.obj.ify=function(e){if(o(e))return e;try{e=JSON.parse(e)}catch(t){e={}}return e},function(){var e;function n(t,n){s(this,n)&&e!==this[n]||(this[n]=t)}t.obj.to=function(e,t){return t=t||{},a(e,n,t),t}}(),t.obj.copy=function(e){return e?JSON.parse(JSON.stringify(e)):e},function(){function e(e,t){var n=this.n;if(!n||!(t===n||o(n)&&s(n,t)))return!!t||void 0}t.obj.empty=function(t,n){return!t||!a(t,e,{n:n})}}(),function(){function e(t,n){if(2===arguments.length)return e.r=e.r||{},void(e.r[t]=n);e.r=e.r||[],e.r.push(t)}var i=Object.keys;t.obj.map=function(a,l,u){var c,h=0,f,p,d,m,g=n(l);if(e.r=null,i&&o(a)&&(d=i(a),m=!0),r(a)||d)for(f=(d||a).length;h",r.drift=0,r.is=function(e,t,n){var i=t&&e&&e[w]&&e[w][r._]||n;if(i)return v(i=i[t])?i:-1/0},r.lex=function(){return r().toString(36).replace(".","")},r.ify=function(e,t,i,o,s){if(!e||!e[w]){if(!s)return;e=n.soul.ify(e,s)}var a=f(e[w],r._);return k!==t&&t!==w&&(v(i)&&(a[t]=i),k!==o&&(e[t]=o)),e},r.to=function(e,t,i){var o=(e||{})[t];return d(o)&&(o=g(o)),r.ify(i,t,r.is(e,t),o,n.soul(e))},function(){function e(e,t){w!==t&&r.ify(this.o,t,this.s)}r.map=function(t,n,i){var o,s=d(s=t||n)?s:null;return t=_(t=t||n)?t:null,s&&!t?(n=v(n)?n:r(),s[w]=s[w]||{},m(s,e,{o:s,s:n}),s):(i=i||d(n)?n:o,n=v(n)?n:r(),function(r,s,a,l){if(!t)return e.call({o:a,s:n},r,s),r;t.call(i||this||{},r,s,a,l),p(a,s)&&o===a[s]||e.call({o:a,s:n},r,s)})}}();var h=t.obj,f=h.as,p=h.has,d=h.is,m=h.map,g=h.copy,y=t.num,v=y.is,b=t.fn,_=b.is,w=n._,k;e.exports=r})(o,"./state"),o(function(e){var t=o("./type"),n=o("./val"),r=o("./node"),i={};!function(){function e(e,n){if(!e||n!==r.soul(e)||!r.is(e,this.fn,this.as))return!0;this.cb&&(t.n=e,t.as=this.as,this.cb.call(t.as,e,n,t))}function t(e){e&&r.is(t.n,e,t.as)}i.is=function(t,n,r,i){return!(!t||!l(t)||h(t))&&!p(t,e,{cb:n,fn:r,as:i})}}(),function(){function e(e,t){var i;return(i=h(e,t))?i:(t.env=e,t.soul=s,r.ify(t.obj,o,t)&&(t.link=t.link||n.link.ify(r.soul(t.node)),t.obj!==e.shell&&(e.graph[n.link.is(t.link)]=t.node)),t)}function o(t,i,o){var s=this,l=s.env,h,f;if(r._===i&&c(t,n.link._))return o._;if(h=a(t,i,o,s,l)){if(i||(s.node=s.node||o||{},c(t,r._)&&r.soul(t)&&(s.node._=d(t._)),s.node=r.soul.ify(s.node,n.link.is(s.link)),s.link=s.link||n.link.ify(r.soul(s.node))),(f=l.map)&&(f.call(l.as||{},t,i,o,s),c(o,i))){if(t=o[i],m===t)return void u(o,i);if(!(h=a(t,i,o,s,l)))return}if(!i)return s.node;if(!0===h)return t;if(f=e(l,{obj:t,path:s.path.concat(i)}),f.node)return f.link}}function s(e){var t=this,i=n.link.is(t.link),o=t.env.graph;t.link=t.link||n.link.ify(e),t.link[n.link._]=e,t.node&&t.node[r._]&&(t.node[r._][n.link._]=e),c(o,i)&&(o[e]=o[i],u(o,i))}function a(e,r,i,o,s){var u;return!!n.is(e)||(l(e)?1:(u=s.invalid)?(e=u.call(s.as||{},e,r,i),a(e,r,i,o,s)):(s.err="Invalid value at '"+o.path.concat(r).join(".")+"'!",void(t.list.is(e)&&(s.err+=" Use `.set(item)` instead of an Array."))))}function h(e,t){for(var n=e.seen,r=n.length,i;r--;)if(i=n[r],t.obj===i.obj)return i;n.push(t)}i.ify=function(t,r,i){var o={path:[],obj:t};return r?"string"==typeof r?r={soul:r}:r instanceof Function&&(r.map=r):r={},r.soul&&(o.link=n.link.ify(r.soul)),r.shell=(i||{}).shell,r.graph=r.graph||{},r.seen=r.seen||[],r.as=r.as||i,e(r,o),r.root=o.node,r.graph}}(),i.node=function(e){var t=r.soul(e);if(t)return f({},t,e)},function(){function e(e,t){var o,s;if(r._!==t)(o=n.link.is(e))?(s=this.opt.seen[o])?this.obj[t]=s:this.obj[t]=this.opt.seen[o]=i.to(this.graph,o,this.opt):this.obj[t]=e;else{if(h(e,n.link._))return;this.obj[t]=d(e)}}i.to=function(t,n,r){if(t){var i={};return r=r||{seen:{}},p(t[n],e,{obj:i,graph:t,opt:r}),i}}}();var s=t.fn.is,a=t.obj,l=a.is,u=a.del,c=a.has,h=a.empty,f=a.put,p=a.map,d=a.copy,m;e.exports=i})(o,"./graph"),o(function(e){o("./onto"),e.exports=function e(t,n){if(this.on){if(!(t instanceof Function)){if(!t||!n)return;var r=t["#"]||t,i=(this.tag||empty)[r];if(!i)return;return i=this.on(r,n),clearTimeout(i.err),!0}var r=n&&n["#"]||Math.random().toString(36).slice(2);if(!t)return r;var o=this.on(r,t,n);return o.err=o.err||setTimeout(function(){o.next({err:"Error: No ACK received yet.",lack:!0}),o.off()},(this.opt||{}).lack||9e3),r}}})(o,"./ask"),o(function(e){var t=o("./type");function n(e){var n={s:{}};return e=e||{max:1e3,age:9e3},n.check=function(e){var t;return!!(t=n.s[e])&&(t.pass?t.pass=!1:n.track(e))},n.track=function(i,o){var s=n.s[i]||(n.s[i]={});return s.was=r(),o&&(s.pass=!0),n.to||(n.to=setTimeout(function(){var i=r();t.obj.map(n.s,function(r,o){r&&e.age>i-r.was||t.obj.del(n.s,o)}),n.to=null},e.age+9)),s},n}var r=t.time.is;e.exports=n})(o,"./dup"),o(function(e){function t(e){return e instanceof t?(this._={gun:this,$:this}).$:this instanceof t?t.create(this._={gun:this,$:this,opt:e}):new t(e)}t.is=function(e){return e instanceof t||e&&e._&&e===e._.$||!1},t.version=.9,t.chain=t.prototype,t.chain.toJSON=function(){};var n=o("./type");n.obj.to(n,t),t.HAM=o("./HAM"),t.val=o("./val"),t.node=o("./node"),t.state=o("./state"),t.graph=o("./graph"),t.on=o("./onto"),t.ask=o("./ask"),t.dup=o("./dup"),function(){function e(n){var r=this,i=r.as,o=i.at||i,s=o.$,a,l;(l=n["#"])||(l=n["#"]=u(9)),(a=o.dup).check(l)?i.out===n.out&&(n.out=k,r.to.next(n)):(a.track(l),o.ask(n["@"],n)||(n.get&&t.on.get(n,s),n.put&&t.on.put(n,s)),r.to.next(n),i.out||(n.out=e,o.on("out",n)))}t.create=function(n){n.root=n.root||n,n.graph=n.graph||{},n.on=n.on||t.on,n.ask=n.ask||t.ask,n.dup=n.dup||t.dup();var r=n.$.opt(n.opt);return n.once||(n.on("in",e,n),n.on("out",e,{at:n,out:e}),t.on("create",n),n.on("create",n)),n.once=1,r}}(),function(){function e(e,n,r,i){var o=this,s=t.state.is(r,n),a;if(!s)return o.err="Error: No state on '"+n+"' in node '"+i+"'!";var l=o.graph[i]||w,u=t.state.is(l,n,!0),c=l[n],h=t.HAM(o.machine,s,u,e,c);h.incoming?(o.put[i]=t.state.to(r,n,o.put[i]),(o.diff||(o.diff={}))[i]=t.state.to(r,n,o.diff[i]),o.souls[i]=!0):h.defer&&(o.defer=s<(o.defer||1/0)?s:o.defer)}function n(e,t){var n=this,s=n.$._,a=(s.next||w)[t];if(!a){if(!(s.opt||w).super)return void(n.souls[t]=!1);a=n.$.get(t)._}var l=n.map[t]={put:e,get:t,$:a.$},u={ctx:n,msg:l};n.async=!!s.tag.node,n.ack&&(l["@"]=n.ack),d(e,r,u),n.async&&(n.and||s.on("node",function(e){this.to.next(e),e===n.map[e.get]&&(n.souls[e.get]=!1,d(e.put,i,e),d(n.souls,function(e){if(e)return e})||n.c||(n.c=1,this.off(),d(n.map,o,n)))}),n.and=!0,s.on("node",l))}function r(e,n){var r=this.ctx,i=r.graph,o=this.msg,s=o.get,a=o.put,l=o.$._,u;i[s]=t.state.to(a,n,i[s]),r.async||(l.put=t.state.to(a,n,l.put))}function i(e,n){var r=this,i=r.put,o=r.$._;o.put=t.state.to(i,n,o.put)}function o(e,t){e.$&&(this.cat.stop=this.stop,e.$._.on("in",e),this.cat.stop=null)}t.on.put=function(r,i){var s=i._,a={$:i,graph:s.graph,put:{},map:{},souls:{},machine:t.state(),ack:r["@"],cat:s,stop:{}};if(t.graph.is(r.put,null,e,a)||(a.err="Error: Invalid graph!"),a.err)return s.on("in",{"@":r["#"],err:t.log(a.err)});d(a.put,n,a),a.async||d(a.map,o,a),k!==a.defer&&setTimeout(function(){t.on.put(r,i)},a.defer-a.machine),a.diff&&s.on("put",p(r,{put:a.diff}))},t.on.get=function(e,n){var r=n._,i=e.get,o=i[y],s=r.graph[o],a=i[v],l,u=r.next||(r.next={}),c=u[o];if(!s)return r.on("get",e);if(a){if("string"!=typeof a||!f(s,a))return r.on("get",e);s=t.state.to(s,a)}else s=t.obj.copy(s);s=t.graph.node(s),l=(c||w).ack,r.on("in",{"@":e["#"],how:"mem",put:s,$:n}),r.on("get",e)}}(),t.chain.opt=function(e){e=e||{};var n=this,i=n._,o=e.peers||e;return h(e)||(e={}),h(i.opt)||(i.opt=e),l(o)&&(o=[o]),r(o)&&(o=d(o,function(e,t,n){t={},t.id=t.url=e,n(e,t)}),h(i.opt.peers)||(i.opt.peers={}),i.opt.peers=p(o,i.opt.peers)),i.opt.peers=i.opt.peers||{},p(e,i.opt),t.on("opt",i),i.opt.uuid=i.opt.uuid||function(){return g()+u(12)},n};var r=t.list.is,a=t.text,l=a.is,u=a.random,c=t.obj,h=c.is,f=c.has,p=c.to,d=c.map,m=c.copy,g=t.state.lex,y=t.val.link._,v=".",b=t.node._,_=t.val.link.is,w={},k;i.debug=function(e,t){return i.debug.i&&e===i.debug.i&&i.debug.i++&&(i.log.apply(i,arguments)||t)},t.log=function(){return!t.log.off&&i.log.apply(i,arguments),[].slice.call(arguments).join(" ")},t.log.once=function(e,n,r){return(r=t.log.once)[e]=r[e]||0,r[e]++||t.log(n)},t.log.once("welcome","Hello wonderful person! :) Thanks for using GUN, feel free to ask for help on https://gitter.im/amark/gun and ask StackOverflow questions tagged with 'gun'!"),"undefined"!=typeof window&&((window.GUN=window.Gun=t).window=window);try{void 0!==s&&(s.exports=t)}catch(e){}e.exports=t})(o,"./root"),o(function(e){var t=o("./root");t.chain.back=function(e,i){var o;if(e=e||1,-1===e||1/0===e)return this._.root.$;if(1===e)return(this._.back||this._).$;var s=this,a=s._;if("string"==typeof e&&(e=e.split(".")),e instanceof Array){for(var l=0,u=e.length,o=a;l(e.acks||0)&&this.off(),e.ack&&e.ack(r,this)},e.opt),i=0,o=n.root.now;f.del(n.root,"now");var s=n.root.mum;n.root.mum={},e.ref._.on("out",{$:e.ref,put:e.out=e.env.graph,opt:e.opt,"#":r}),n.root.mum=s?f.to(s,n.root.mum):s,n.root.now=o},e),e.res&&e.res())}function a(e,t){if(e)return!0}function l(e,n,r,i){var o=this,s=t.is(e);!n&&i.path.length&&(o.res||b)(function(){for(var n=i.path,r=o.ref,a=o.opt,l=0,c=n.length;lc){if((u.stack||(u.stack=[])).push([s,e,i,o]),u.puto)return;return u.puto=setTimeout(function e(){var t=u.stack.splice(0,c),n=0,r;for(u.puta=!0;r=t[n++];)r[0].put(r[1],r[2],r[3]);if(delete u.puta,u.stack.length)return u.puto=setTimeout(e,0);u.stack=u.puts=u.puto=null},0),s}++u.puts}else u.puts=1;return o=o||{},o.data=e,o.via=o.$=o.via||o.$||s,"string"==typeof i?o.soul=i:o.ack=o.ack||i,a.soul&&(o.soul=a.soul),o.soul||l===s?p(o.data)?(o.soul=o.soul||(o.not=t.node.soul(o.data)||(o.via.back("opt.uuid")||t.text.random)()),o.soul?(o.$=l.get(o.soul),o.ref=o.$,n(o),s):(o.via.back("opt.uuid")(function(e,n){if(e)return t.log(e);(o.ref||o.$).put(o.data,o.soul=n,o)}),s)):((o.ack||v).call(o,o.out={err:t.log("Data saved to the root level of the graph must be a node (an object), not a",typeof o.data,'of "'+o.data+'"!')}),o.res&&o.res(),s):t.is(e)?(e.get(function(e,n,r){if(!e)return t.log("The reference you are saving is a",typeof r.put,'"'+r.put+'", not a node (object)!');s.put(t.val.link.ify(e),i,o)},!0),s):(a.has&&(f=t.val.link.is(e))&&(a.dub=f),o.ref=o.ref||l._===(f=a.back)?s:f.$,o.ref._.soul&&t.val.is(o.data)&&a.get?(o.data=d({},a.get,o.data),o.ref.put(o.data,o.soul,o),s):(o.ref.get(h,!0,{as:o}),o.out||(o.res=o.res||r,o.$._.stun=o.ref._.stun),s))};var f=t.obj,p=f.is,d=f.put,m=f.map,g,y={},v=function(){},b=function(e,t){e.call(t||y)},_=t.node._})(o,"./put"),o(function(e){var t=o("./root");o("./chain"),o("./back"),o("./put"),o("./get"),e.exports=t})(o,"./index"),o(function(e){var t=o("./index");function n(e,t){var n=this,r=e.$,i=(r||{})._||{},o=i.put||e.put,s=n.at,a;if(f!==o){if(a=e.$$){if(a=e.$$._,f===a.put)return;o=a.put}n.change&&(o=e.put),n.as?n.ok.call(n.as,e,t):n.ok.call(r,o,e.get,e,t)}}function r(e,n,i){if(e.$){var o=this.as,a=o.at,l=e.$,u=l._,h=u.put||e.put,p,d;(d=e.$$)&&(p=d=e.$$._,f!==p.put&&(h=p.put)),(d=n.wait)&&(d=d[u.id])&&clearTimeout(d),!i&&(f===h||u.soul||u.link||p&&!(0 .once, apologies unexpected."),this.once(e,n)},t.chain.once=function(e,n){var i=this,o=i._,s=o.put;if(0=(t.batch||1e3))return h();s||(s=setTimeout(h,t.wait||1))}),e.on("get",function(t){this.to.next(t);var n=t.get,r,i,o;function s(){if(n&&(r=n["#"])){var s=n["."];i=a[r]||o,i&&s&&(i=Gun.state.to(i,s)),e.on("in",{"@":t["#"],put:Gun.graph.node(i),how:"lS",lS:t.$})}}Gun.debug?setTimeout(s,1):s()});var c=function(e,t,n,r){a[r]=Gun.state.to(n,t,a[r])},h=function(n){var l;o=0,clearTimeout(s),s=!1;var u=i;i={},n&&(a=n);try{r.setItem(t.prefix,JSON.stringify(a))}catch(n){Gun.log(l=(n||"localStorage failure")+" Consider using GUN's IndexedDB plugin for RAD for more storage space, https://gun.eco/docs/RAD#install"),e.on("localStorage:error",{err:l,file:t.prefix,flush:a,retry:h})}(l||Gun.obj.empty(t.peers))&&Gun.obj.map(u,function(t,n){e.on("in",{"@":n,err:l,ok:0})})}}})}})(o,"./adapters/localStorage"),o(function(e){var t=o("../type");function n(e){var n=function(){},o=e.opt||{};o.log=o.log||i.log,o.gap=o.gap||o.wait||1,o.pack=o.pack||.3*(o.memory?1e3*o.memory*1e3:1399e6);var a=e.dup;n.hear=function(r,i){if(r){var u,c,h,f=r[0];if(o.pack<=r.length)return n.say({dam:"!",err:"Message too big!"},i);if("{"!=r[2]&&(n.hear.d+=r.length||0,++n.hear.c),"["!==f){if("{"===f||t.obj.is(r)&&(u=r)){try{u=u||JSON.parse(r)}catch(e){return o.log("DAM JSON parse error",e)}if(!u)return;if((c=u["#"])||(c=u["#"]=t.text.random(9)),a.check(c))return;if(a.track(c,!0).it=u,(h=u["##"])||s===u.put||(h=u["##"]=t.obj.hash(u.put)),h&&(f=u["@"]||u.get&&c)){if(a.check(f+h))return;a.track(f+h,!0).it=u}return(u._=function(){}).via=i,(f=u["><"])&&(u._.to=t.obj.map(f.split(","),l)),u.dam?void((f=n.hear[u.dam])&&f(u,i,e)):void e.on("in",u)}}else{try{u=JSON.parse(r)}catch(e){o.log("DAM JSON parse error",e)}if(!u)return;for(var p=0,d;d=u[p++];)n.hear(d,i)}}};var l=function(e,t,n){n(e,!0)};function u(e,t){try{var r=t.wire;t.say?t.say(e):r.send&&r.send(e),n.say.d+=e.length||0,++n.say.c}catch(n){(t.queue=t.queue||[]).push(e)}}n.hear.c=n.hear.d=0,function(){var e;function i(t){n.say(e,t)}function l(e){var t=e.batch;if(e.batch=e.tail=null,t&&t.length){try{t=1===t.length?t[0]:JSON.stringify(t)}catch(e){return o.log("DAM JSON stringify error",e)}t&&u(t,e)}}n.say=function(c,h){if(this.to&&this.to.next(c),!c)return!1;var f,p,d,m,g=c._||(c._=function(){});if((f=c["#"])||(f=c["#"]=t.text.random(9)),(p=c["##"])||s===c.put||(p=c["##"]=t.obj.hash(c.put)),!(m=g.raw)&&(m=g.raw=n.raw(c),p&&(d=c["@"])&&(a.track(d+p).it=c,d=(a.s[d]||r).it))){if(p===d["##"])return!1;d["##"]=p}if(a.track(f).it=c,h||(h=(d=a.s[c["@"]])&&(d=d.it)&&(d=d._)&&(d=d.via)),!h&&n.way)return n.way(c);if(!h||!h.id)return e=c,!!t.obj.is(h||o.peers)&&void t.obj.map(h||o.peers,i);if(!h.wire&&n.wire&&n.wire(h),f!==h.last){if(h.last=f,h===g.via)return!1;if((d=g.to)&&(d[h.url]||d[h.pid]||d[h.id]))return!1;if(h.batch){if(h.tail=(d=h.tail||0)+m.length,h.tail<=o.pack)return void h.batch.push(m);l(h)}h.batch=[],setTimeout(function(){l(h)},o.gap),u(m,h)}},n.say.c=n.say.d=0}(),function(){n.raw=function(n){if(!n)return"";var r=n._||{},i,s,a;if(a=r.raw)return a;if("string"==typeof n)return n;if(!n.dam){var l=0,u=[];t.obj.map(o.peers,function(e){if(u.push(e.url||e.pid||e.id),++l>9)return!0}),l>1&&(n["><"]=u.join())}var c=e(n);return r&&(r.raw=c),c};var e=JSON.stringify,r=":])([:"}(),n.hi=function(r){var i=r.wire||{};r.id?o.peers[r.url||r.id]=r:(i=r.id=r.id||t.text.random(9),n.say({dam:"?"},o.peers[i]=r)),r.met=r.met||+new Date,i.hied||e.on(i.hied="hi",r),i=r.queue,r.queue=[],t.obj.map(i,function(e){u(e,r)})},n.bye=function(r){t.obj.del(o.peers,r.id),e.on("bye",r);var i=+new Date;i-=r.met||i,n.bye.time=((n.bye.time||i)+i)/2},n.hear["!"]=function(e,t){o.log("Error:",e.err)},n.hear["?"]=function(e,t){e.pid?t.pid||(t.pid=e.pid):n.say({dam:"?",pid:o.pid,"@":e["#"]},t)},e.on("create",function(e){e.opt.pid=e.opt.pid||t.text.random(9),this.to.next(e),e.on("out",n.say)});var c={};return e.on("bye",function(e,t){this.to.next(e),(t=e.url)&&(c[t]=!0,setTimeout(function(){delete c[t]},o.lack||9e3))}),e.on("hi",function(r,i){this.to.next(r),(i=r.url)&&c[i]&&(delete c[i],t.obj.map(e.next,function(o,s){i={},i[s]=e.graph[s],n.say({"##":t.obj.hash(i),get:{"#":s}},r)}))}),n}!function(){t.text.hash=function(e){if("string"!=typeof e)return{err:1};var t=0;if(!e.length)return t;for(var n=0,r=e.length,i;ne&&e.length>0?[e.length+" items inc:",e[e.length-1]]:e),utils.stringfrom=function(e,t={}){try{return"Url"===e.constructor.name?e.href:"string"==typeof e?e:e.toString()}catch(t){throw new r.CodingError(`Unable to turn ${e} into a string ${t.message}`)}},utils.p_timeout=function(e,t,n){let i=null;return Promise.race([new Promise((e,o)=>{i=setTimeout(o,t,new r.TimeoutError(n||`Timed out in ${t}ms`))}),e.then(e=>(clearTimeout(i),e))])},utils.createElement=function(e,t,n){var r=document.createElement(e);for(let e in t){let n="classname"===e.toLowerCase()?"class":e;if("dangerouslySetInnerHTML"===e&&(r.innerHTML=t[e].__html,delete t.dangerouslySetInnerHTML),t.hasOwnProperty(e)){let i=t[e];if(!0===i)r.setAttribute(n,e);else if("object"!=typeof i||Array.isArray(i))!1!==i&&null!=i&&r.setAttribute(n,i.toString());else if(["style"].includes(n))for(let e in i)r[n][e]=i[e];else r[n]=i}}for(let e=2;er.appendChild(null==e.nodeType?document.createTextNode(e.toString()):e)):r.appendChild(null==t.nodeType?document.createTextNode(t.toString()):t))}return r},t=e.exports=utils},function(e,t,n){var r=n(148),i=n(242);function o(e){return null!=e&&i(e.length)&&!r(e)}e.exports=o},function(e,t,n){var r=n(108),i=n(181),o="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",l="[object Proxy]";function u(e){if(!i(e))return!1;var t=r(e);return t==s||t==a||t==o||t==l}e.exports=u},function(e,t,n){var r=n(657),i=n(664),o=n(147);function s(e){return o(e)?r(e):i(e)}e.exports=s},function(e,t,n){"use strict";e.exports=function e(t,n){var r,i;function o(e){if(r=e,i)return o.abort();!function e(){for(var o=!0,s=!1;o;)if(s=!1,r(null,function(a,l){if(s=!0,a=a||i){if(o=!1,n)n(!0===a?null:a);else if(a&&!0!==a)throw a}else t&&!1===t(l)||i?(o=!1,r(i||!0,n||function(){})):o||e()}),!s)return void(o=!1)}()}return o.abort=function(e,t){if("function"==typeof e&&(t=e,e=!0),i=e||!0,r)return r(i,t||function(){})},o}},function(e,t){e.exports=function e(t){return t&&("string"==typeof t?function(e){return e[t]}:"object"==typeof t&&"function"==typeof t.exec?function(e){var n=t.exec(e);return n&&n[0]}:t)}},function(e,t,n){var r=n(21);r.pki=r.pki||{};var i=e.exports=r.pki.oids=r.oids=r.oids||{};function o(e,t){i[e]=t,i[t]=e}function s(e,t){i[e]=t}o("1.2.840.113549.1.1.1","rsaEncryption"),o("1.2.840.113549.1.1.4","md5WithRSAEncryption"),o("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),o("1.2.840.113549.1.1.7","RSAES-OAEP"),o("1.2.840.113549.1.1.8","mgf1"),o("1.2.840.113549.1.1.9","pSpecified"),o("1.2.840.113549.1.1.10","RSASSA-PSS"),o("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),o("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),o("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),o("1.2.840.10040.4.3","dsa-with-sha1"),o("1.3.14.3.2.7","desCBC"),o("1.3.14.3.2.26","sha1"),o("2.16.840.1.101.3.4.2.1","sha256"),o("2.16.840.1.101.3.4.2.2","sha384"),o("2.16.840.1.101.3.4.2.3","sha512"),o("1.2.840.113549.2.5","md5"),o("1.2.840.113549.1.7.1","data"),o("1.2.840.113549.1.7.2","signedData"),o("1.2.840.113549.1.7.3","envelopedData"),o("1.2.840.113549.1.7.4","signedAndEnvelopedData"),o("1.2.840.113549.1.7.5","digestedData"),o("1.2.840.113549.1.7.6","encryptedData"),o("1.2.840.113549.1.9.1","emailAddress"),o("1.2.840.113549.1.9.2","unstructuredName"),o("1.2.840.113549.1.9.3","contentType"),o("1.2.840.113549.1.9.4","messageDigest"),o("1.2.840.113549.1.9.5","signingTime"),o("1.2.840.113549.1.9.6","counterSignature"),o("1.2.840.113549.1.9.7","challengePassword"),o("1.2.840.113549.1.9.8","unstructuredAddress"),o("1.2.840.113549.1.9.14","extensionRequest"),o("1.2.840.113549.1.9.20","friendlyName"),o("1.2.840.113549.1.9.21","localKeyId"),o("1.2.840.113549.1.9.22.1","x509Certificate"),o("1.2.840.113549.1.12.10.1.1","keyBag"),o("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),o("1.2.840.113549.1.12.10.1.3","certBag"),o("1.2.840.113549.1.12.10.1.4","crlBag"),o("1.2.840.113549.1.12.10.1.5","secretBag"),o("1.2.840.113549.1.12.10.1.6","safeContentsBag"),o("1.2.840.113549.1.5.13","pkcs5PBES2"),o("1.2.840.113549.1.5.12","pkcs5PBKDF2"),o("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),o("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),o("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),o("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),o("1.2.840.113549.2.7","hmacWithSHA1"),o("1.2.840.113549.2.8","hmacWithSHA224"),o("1.2.840.113549.2.9","hmacWithSHA256"),o("1.2.840.113549.2.10","hmacWithSHA384"),o("1.2.840.113549.2.11","hmacWithSHA512"),o("1.2.840.113549.3.7","des-EDE3-CBC"),o("2.16.840.1.101.3.4.1.2","aes128-CBC"),o("2.16.840.1.101.3.4.1.22","aes192-CBC"),o("2.16.840.1.101.3.4.1.42","aes256-CBC"),o("2.5.4.3","commonName"),o("2.5.4.5","serialName"),o("2.5.4.6","countryName"),o("2.5.4.7","localityName"),o("2.5.4.8","stateOrProvinceName"),o("2.5.4.10","organizationName"),o("2.5.4.11","organizationalUnitName"),o("2.16.840.1.113730.1.1","nsCertType"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),o("2.5.29.14","subjectKeyIdentifier"),o("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),o("2.5.29.17","subjectAltName"),o("2.5.29.18","issuerAltName"),o("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),o("2.5.29.31","cRLDistributionPoints"),o("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),o("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),o("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),o("1.3.6.1.4.1.11129.2.4.2","timestampList"),o("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),o("1.3.6.1.5.5.7.3.1","serverAuth"),o("1.3.6.1.5.5.7.3.2","clientAuth"),o("1.3.6.1.5.5.7.3.3","codeSigning"),o("1.3.6.1.5.5.7.3.4","emailProtection"),o("1.3.6.1.5.5.7.3.8","timeStamping")},function(e,t,n){"use strict";const r=t;r.Reporter=n(760).Reporter,r.DecoderBuffer=n(374).DecoderBuffer,r.EncoderBuffer=n(374).EncoderBuffer,r.Node=n(761)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var r=n(58),i=h(r),o=n(86),s=h(o),a=n(107),l=h(a),u=n(37),c=h(u);function h(e){return e&&e.__esModule?e:{default:e}}function f(e,t,n){n=(0,l.default)(n||i.default);var r=(0,c.default)(t);if(!e())return n(null);var o=function(t){if(t)return n(t);if(e())return r(o);var i=(0,s.default)(arguments,1);n.apply(null,[null].concat(i))};r(o)}e.exports=t.default},function(e,t,n){(function(t){e.exports=function e(n,r){for(var i=Math.min(n.length,r.length),o=new t(i),s=0;s{const s=new i(Date.now()+Number(r)).toString(),a=h.ValidityType.EOL;v(e,t,n,s,a,o)},y=(e,t,n,r,i)=>{const o=h.ValidityType.EOL;v(e,t,n,r,o,i)},v=(e,t,n,r,i,o)=>{x(e,t,i,r,(e,s)=>{if(e)return c.error("record signature creation failed"),o(Object.assign(new Error("record signature verification failed"),{code:p.ERR_SIGNATURE_CREATION}));const a={value:t,signature:s,validityType:i,validity:r,sequence:n};return c(`ipns entry for ${t} created`),o(null,a)})},b=(e,t,n)=>{const{value:r,validityType:i,validity:o}=t,s=A(r,i,o);e.verify(s,t.signature,(e,t)=>{if(e||!t)return c.error("record signature verification failed"),n(Object.assign(new Error("record signature verification failed"),{code:p.ERR_SIGNATURE_VERIFICATION}));if(i===h.ValidityType.EOL){let e;try{e=f(o.toString())}catch(e){return c.error("unrecognized validity format (not an rfc3339 format)"),n(Object.assign(new Error("unrecognized validity format (not an rfc3339 format)"),{code:p.ERR_UNRECOGNIZED_FORMAT}))}if(e{if(!e||!e.bytes||!t){const e="one or more of the provided parameters are not defined";return c.error(e),n(Object.assign(new Error(e),{code:p.ERR_UNDEFINED_PARAMETER}))}a.createFromPubKey(e.bytes,(r,i)=>{if(r)return c.error(r),n(Object.assign(new Error(r),{code:p.ERR_PEER_ID_FROM_PUBLIC_KEY}));let o;try{o=T(i)}catch(r){return c.error(r),n(Object.assign(new Error(r),{code:p.ERR_PUBLIC_KEY_FROM_ID}))}if(o)return n(null,null);try{t.pubKey=s.keys.marshalPublicKey(e)}catch(r){return c.error(r),n(r)}n(null,t)})},w=(e,t,n)=>{if(!t||!e){const e="one or more of the provided parameters are not defined";return c.error(e),n(Object.assign(new Error(e),{code:p.ERR_UNDEFINED_PARAMETER}))}if(t.pubKey){let e;try{e=s.keys.unmarshalPublicKey(t.pubKey)}catch(e){return c.error(e),n(e)}return n(null,e)}e.pubKey?n(null,e.pubKey):n(Object.assign(new Error("no public key is available"),{code:p.ERR_UNDEFINED_PARAMETER}))},k=e=>r(e,"RFC4648",{padding:!1}),E=e=>new o(`/ipns/${k(e)}`),S=e=>{const n=t.from("/pk/"),r=t.from("/ipns/");return{routingPubKey:new o(t.concat([n,e])),pkKey:new o(k(t.concat([n,e]))),routingKey:new o(t.concat([r,e])),ipnsKey:new o(k(t.concat([r,e])))}},x=(e,t,n,r,i)=>{const o=A(t,n,r);e.sign(o,(e,t)=>e?i(e):i(null,t))},C=e=>{if("0"===e.toString())return"EOL";{const t=`unrecognized validity type ${e.toString()}`;throw c.error(t),Object.assign(new Error(t),{code:p.ERR_UNRECOGNIZED_VALIDITY})}},A=(e,n,r)=>{const i=t.from(e),o=t.from(C(n)),s=t.from(r);return t.concat([i,s,o])},T=e=>{const t=l.decode(e.id);return t.code!==d?null:s.keys.unmarshalPublicKey(t.digest)},I=h.encode,j=h.decode,R={validate:(e,t,n)=>{const r=j(e),i=t.slice("/ipns/".length);let o;try{o=a.createFromBytes(i)}catch(e){return n(e)}w(o,r,(e,t)=>{if(e)return n(e);b(t,r,e=>{if(e)return n(e);n(null,!0)})})},select:(e,t,n)=>{const r=j(e),i=j(t),o=r.sequence>i.sequence?0:1;if("function"!=typeof n)return o;n(null,o)}};e.exports={create:g,createWithExpiration:y,validate:b,embedPublicKey:_,extractPublicKey:w,getLocalKey:E,getIdKeys:S,marshal:I,unmarshal:j,validator:R,namespace:"/ipns/",namespaceLength:"/ipns/".length}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var r=n(326),i=a(r),o=n(37),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function l(e,t,n){var r=(0,s.default)(e);return(0,i.default)(function(i,o){var s=!1,a;function l(){var t=e.name||"anonymous",r=new Error('Callback function "'+t+'" timed out.');r.code="ETIMEDOUT",n&&(r.info=n),s=!0,o(r)}i.push(function(){s||(o.apply(null,arguments),clearTimeout(a))}),a=setTimeout(l,t),r.apply(null,i)})}e.exports=t.default},function(e,t,n){const r=n(6).EventEmitter,i=n(24),o=n(1033);function s(e,t){"object"==typeof e&&(t=e,e="START"),i.equal(typeof e,"string"),i.equal(typeof t,"object"),i.ok(t[e],"invalid starting state "+e),i.ok(o.validate(t));const n=new r;return l._graph=o.reachable(t),l._emitter=n,l._events=t,l._state=e,l.emit=l,l.on=s,l;function s(e,t){n.on(e,t)}function l(e){const t=l._events[l._state][e];if(!a(l._state,t,l._graph)){const t="invalid transition: "+l._state+" -> "+e;return n.emit("error",t)}const r=l._state+":leave",i=t+":enter";return l._state?o():s();function o(){n._events[r]?n.emit(r,s):s()}function s(){n._events[i]?n.emit(i,u):u()}function u(){l._state=t,n.emit(t),n.emit("done")}}}function a(e,t,n){if(!t)return!1;if(!e)return!0;const r=n[e];return!(!r||!r[t])&&1===r[t].length}e.exports=s},function(e,t,n){"use strict";const r=n(22),i=n(31),o=n(15),s=n(162);e.exports=function(e){function t(e){let t=null;if(r.isMultiaddr(e)){const n=r(e);t=n.getPeerId()}else i.isPeerInfo(e)&&(t=e.id.toB58String());return t}function n(t){let n;if(i.isPeerInfo(t))n=t;else if(r.isMultiaddr(t)){const r=t.getPeerId();try{n=e._peerBook.get(r)}catch(e){n=new i(o.createFromB58String(r))}n.multiaddrs.add(t)}else if(o.isPeerId(t)){const r=t.toB58String();n=e._peerBook.has(r)?e._peerBook.get(r):t}return n}function a(t){return e.muxedConns[t]||e.conns[t]}function l(e,t,n){return n=n||(()=>{}),e.write(s.CircuitRelay.encode({type:s.CircuitRelay.Type.STATUS,code:t})),n()}function u(e,t,n,i){try{e.dstPeer.addrs.forEach(e=>r(e))}catch(e){return l(t,n===s.CircuitRelay.Type.HOP?s.CircuitRelay.Status.HOP_DST_MULTIADDR_INVALID:s.CircuitRelay.Status.STOP_DST_MULTIADDR_INVALID),i(e)}try{e.srcPeer.addrs.forEach(e=>r(e))}catch(e){return l(t,n===s.CircuitRelay.Type.HOP?s.CircuitRelay.Status.HOP_SRC_MULTIADDR_INVALID:s.CircuitRelay.Status.STOP_SRC_MULTIADDR_INVALID),i(e)}return i(null)}function c(e){return"string"==typeof e?o.createFromB58String(e):o.createFromBytes(e)}return{getB58String:t,peerInfoFromMa:n,isPeerConnected:a,validateAddrs:u,writeResponse:l,peerIdFromId:c}}},function(e,t,n){"use strict";const r=n(57);e.exports=r("\nmessage CircuitRelay {\n\n enum Status {\n SUCCESS = 100;\n HOP_SRC_ADDR_TOO_LONG = 220;\n HOP_DST_ADDR_TOO_LONG = 221;\n HOP_SRC_MULTIADDR_INVALID = 250;\n HOP_DST_MULTIADDR_INVALID = 251;\n HOP_NO_CONN_TO_DST = 260;\n HOP_CANT_DIAL_DST = 261;\n HOP_CANT_OPEN_DST_STREAM = 262;\n HOP_CANT_SPEAK_RELAY = 270;\n HOP_CANT_RELAY_TO_SELF = 280;\n STOP_SRC_ADDR_TOO_LONG = 320;\n STOP_DST_ADDR_TOO_LONG = 321;\n STOP_SRC_MULTIADDR_INVALID = 350;\n STOP_DST_MULTIADDR_INVALID = 351;\n STOP_RELAY_REFUSED = 390;\n MALFORMED_MESSAGE = 400;\n }\n\n enum Type { // RPC identifier, either HOP, STOP or STATUS\n HOP = 1;\n STOP = 2;\n STATUS = 3;\n CAN_HOP = 4;\n }\n\n message Peer {\n required bytes id = 1; // peer id\n repeated bytes addrs = 2; // peer's known addresses\n }\n\n optional Type type = 1; // Type of the message\n\n optional Peer srcPeer = 2; // srcPeer and dstPeer are used when Type is HOP or STATUS\n optional Peer dstPeer = 3;\n\n optional Status code = 4; // Status code, used when Type is STATUS\n}\n")},function(e,t,n){"use strict";const r=n(2),i=n(59),o=n(200),s=n(9),a="ERR_BAD_PATH";function l(e){const t=new Error("invalid ipfs ref path");e=e.replace(/^\/ipfs\//,"");const n=e.match(/([^/]+(?:\/[^/]+)*)\/?$/);if(!n)throw t;const[r,...i]=n[1].split("/");if(o.cid(r))return{hash:r,links:i};throw t}t.OFFLINE_ERROR="This command must be run in online mode. Try running 'ipfs daemon' first.";const u=e=>{if(o.cid(e))return`/ipfs/${e}`;if(o.path(e))return e;throw Object.assign(new Error(`invalid ${e} path`),{code:a})},c=r(function(e,n,r){Array.isArray(n)||(n=[n]),i(n,(n,r)=>{if("string"!=typeof n){let e;try{e=new s(n)}catch(e){return r(e)}return r(null,e.buffer)}let i;try{i=t.parseIpfsPath(n)}catch(e){return r(e)}const o=new s(i.hash),a=i.links;if(!a.length)return r(null,o.buffer);function l(t,n,i,o){if(i)return r(i);if(!n.length)return r(null,t.buffer);const s=n[0],a=o.links.find(e=>e.name===s);if(!a)return r(new Error(`no link named "${s}" under ${t.toBaseEncodedString()}`));e.get(a.cid,l.bind(null,a.cid,n.slice(1)))}e.get(o,l.bind(null,o,a))},r)});t.normalizePath=u,t.parseIpfsPath=l,t.resolvePath=c},function(e,t){function n(e){return"function"==typeof e}function r(e){return"object"==typeof e&&i(e.source)&&o(e.sink)}function i(e){return n(e)&&2===e.length}function o(e){return n(e)&&1===e.length}t.isDuplex=r,t.isSource=i,t.isSink=o},function(e,t,n){var r=n(461);e.exports=function(e,t){return function(n){var i=[],o,s;function a(e){i.push(e)}e=e||function(e){this.queue(e)},t=t||function(){this.queue(null)};var l={emit:function(e,t){"data"==e&&a(t),"end"==e&&(o=!0,a(null)),"error"==e&&(s=t)},queue:a},u;return function(a,c){if(o=o||a,a)return n(a,function(){if(u){var e=u;u=null,e(a)}c(a)});u=c,r(function r(a){if(u)if(c=u,s)u=null,c(s);else if(i.length){var h=i.shift();u=null,c(null===h,h)}else n(o,function(i,h){if(i&&!0!==i)return s=i,a();if(o=o||i)t.call(l);else if(null!==h&&(e.call(l,h),s||o))return n(s||o,function(){u=null,c(s||o)});a(r)})})}}}},function(e,t,n){(function(t){var r=n(17).Writable,i=n(1),o=Uint8Array;function s(e,t){if(!(this instanceof s))return new s(e,t);"function"==typeof e&&(t=e,e={}),e||(e={});var n=e.encoding,i=!1;n?(n=String(n).toLowerCase(),"u8"!==n&&"uint8"!==n||(n="uint8array")):i=!0,r.call(this,{objectMode:!0}),this.encoding=n,this.shouldInferEncoding=i,t&&this.on("finish",function(){t(this.getBody())}),this.body=[]}function a(e){return/Array\]$/.test(Object.prototype.toString.call(e))}function l(e){return"string"==typeof e||a(e)||e&&"function"==typeof e.subarray}function u(e){for(var n=[],r=0;rn=>{let h,f=!1,p=!1;n=n?Object.assign({},n,n.qs):{};const d=new l,m=new r({objectMode:!0});m._read=(e=>{}),m._write=((e,t,r)=>{const o=s(r);try{const r=a(e,n).map(e=>Object.assign({headers:u(e)},e));p=!0,i(r,(e,n)=>d.write(e,t,n),e=>{if(p=!1,e)return o(e);f&&d.end(),o()})}catch(e){o(e)}}),m.once("finish",()=>{f||(f=!0,p||d.end())});const g=n.qs||{};g["cid-version"]=c(n,"cid-version","cidVersion"),g["raw-leaves"]=c(n,"raw-leaves","rawLeaves"),g["only-hash"]=c(n,"only-hash","onlyHash"),g["wrap-with-directory"]=c(n,"wrap-with-directory","wrapWithDirectory"),g.hash=c(n,"hash","hashAlg");const y={path:t,qs:g,args:n.args,multipart:!0,multipartBoundary:d._boundary,stream:!0,recursive:!0,progress:n.progress};return d.on("error",e=>{m.emit("error",e)}),h=e(y,(e,t)=>{if(e)return m.emit("error",e);if(!t)return m.push(null);if(!o(t))return m.push(t),void m.push(null);if(t.on("error",e=>m.emit("error",e)),n.converter){t.on("data",e=>{e.Bytes&&n.progress&&n.progress(e.Bytes)});const e=n.converter,r=new e;r.once("end",()=>m.push(null)),r.on("data",e=>m.push(e)),t.pipe(r)}else t.on("data",e=>{e.Bytes&&n.progress&&n.progress(e.Bytes),m.push(e)}),t.once("end",()=>m.push(null))}),h.on("drain",()=>d.emit("drain")),d.pipe(h),m})},function(e,t){e.exports=!1},function(e,t,n){var r=n(131),i=n(32),o=e.exports;for(var s in r)r.hasOwnProperty(s)&&(o[s]=r[s]);function a(e){if("string"==typeof e&&(e=i.parse(e)),e.protocol||(e.protocol="https:"),"https:"!==e.protocol)throw new Error('Protocol "'+e.protocol+'" not supported. Expected "https:"');return e}o.request=function(e,t){return e=a(e),r.request.call(this,e,t)},o.get=function(e,t){return e=a(e),r.get.call(this,e,t)}},function(e,t,n){(function(t){function n(e,n){var r,i,o,s=!0;function a(e){function i(){n&&n(e,r),n=null}s?t.nextTick(i):i()}function l(e,t,n){r[e]=n,(0==--i||t)&&a(t)}Array.isArray(e)?(r=[],i=e.length):(o=Object.keys(e),r={},i=o.length),i?o?o.forEach(function(t){e[t](function(e,n){l(t,e,n)})}):e.forEach(function(e,t){e(function(e,n){l(t,e,n)})}):a(null),s=!1}e.exports=n}).call(this,n(3))},function(e,t,n){var r=n(1544),i=new r,o="undefined"!=typeof window?window:self,s=o.crypto||o.msCrypto||{},a=s.subtle||s.webkitSubtle;function l(e){return i.digest(e)}try{a.digest({name:"sha-1"},new Uint8Array).catch(function(){a=!1})}catch(e){a=!1}function u(e,t){a?("string"==typeof e&&(e=c(e)),a.digest({name:"sha-1"},e).then(function e(n){t(h(new Uint8Array(n)))},function n(r){t(l(e))})):setTimeout(t,0,l(e))}function c(e){for(var t=e.length,n=new Uint8Array(t),r=0;r>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")}e.exports=u,e.exports.sync=l},function(e,t,n){e.exports=d;var r=n(25),i=n(29).Buffer,o=n(48),s=n(16),a=n(76),l=n(41),u=n(46),c=n(177),h=n(42),f=a.FingerprintFormatError,p=a.InvalidAlgorithmError;function d(e){if(r.object(e,"options"),r.string(e.type,"options.type"),r.buffer(e.hash,"options.hash"),r.string(e.algorithm,"options.algorithm"),this.algorithm=e.algorithm.toLowerCase(),!0!==o.hashAlgs[this.algorithm])throw new p(this.algorithm);this.hash=e.hash,this.type=e.type,this.hashType=e.hashType}d.prototype.toString=function(e){switch(void 0===e&&(e="md5"===this.algorithm||"spki"===this.hashType?"hex":"base64"),r.string(e),e){case"hex":return"spki"===this.hashType?this.hash.toString("hex"):y(this.hash.toString("hex"));case"base64":return"spki"===this.hashType?this.hash.toString("base64"):b(this.algorithm,this.hash.toString("base64"));default:throw new f(void 0,e)}},d.prototype.matches=function(e){r.object(e,"key or certificate"),"key"===this.type&&"ssh"!==this.hashType?(h.assertCompatible(e,l,[1,7],"key with spki"),u.isPrivateKey(e)&&h.assertCompatible(e,u,[1,6],"privatekey with spki support")):"key"===this.type?h.assertCompatible(e,l,[1,0],"key"):h.assertCompatible(e,c,[1,0],"certificate");var t=e.hash(this.algorithm,this.hashType),n=s.createHash(this.algorithm).update(t).digest("base64");return void 0===this.hash2&&(this.hash2=s.createHash(this.algorithm).update(this.hash).digest("base64")),this.hash2===n};var m=/^[A-Za-z0-9+\/=]+$/,g=/^[a-fA-F0-9]+$/;function y(e){return e.replace(/(.{2})(?=.)/g,"$1:")}function v(e){return e.replace(/=*$/,"")}function b(e,t){return e.toUpperCase()+":"+v(t)}d.parse=function(e,t){var n,s,a;r.string(e,"fingerprint"),Array.isArray(t)&&(a=t,t={}),r.optionalObject(t,"options"),void 0===t&&(t={}),void 0!==t.enAlgs&&(a=t.enAlgs),void 0!==t.algorithms&&(a=t.algorithms),r.optionalArrayOfString(a,"algorithms");var l="ssh";void 0!==t.hashType&&(l=t.hashType),r.string(l,"options.hashType");var u=e.split(":");if(2==u.length){if(n=u[0].toLowerCase(),!m.test(u[1]))throw new f(e);try{s=i.from(u[1],"base64")}catch(t){throw new f(e)}}else if(u.length>2){if(n="md5","md5"===u[0].toLowerCase()&&(u=u.slice(1)),u=u.map(function(t){for(;t.length<2;)t="0"+t;if(t.length>2)throw new f(e);return t}),u=u.join(""),!g.test(u)||u.length%2!=0)throw new f(e);try{s=i.from(u,"hex")}catch(t){throw new f(e)}}else{if(g.test(e))s=i.from(e,"hex");else{if(!m.test(e))throw new f(e);s=i.from(e,"base64")}switch(s.length){case 32:n="sha256";break;case 16:n="md5";break;case 20:n="sha1";break;case 64:n="sha512";break;default:throw new f(e)}void 0===t.hashType&&(l="spki")}if(void 0===n)throw new f(e);if(void 0===o.hashAlgs[n])throw new p(n);if(void 0!==a&&(a=a.map(function(e){return e.toLowerCase()}),-1===a.indexOf(n)))throw new p(n);return new d({algorithm:n,hash:s,type:t.type||"key",hashType:l})},d.isFingerprint=function(e,t){return h.isCompatible(e,d,t)},d.prototype._sshpkApiVersion=[1,2],d._oldVersionDetect=function(e){return r.func(e.toString),r.func(e.matches),[1,0]}},function(e,t,n){(function(){var n,r=0xdeadbeefcafe,i=!0;function o(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new o(null)}function a(e,t,n,r,i,o){for(;--o>=0;){var s=t*this[e++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i}function l(e,t,n,r,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var l=32767&this[e],u=this[e++]>>15,c=a*l+u*s;l=s*l+((32767&c)<<15)+n[r]+(1073741823&i),i=(l>>>30)+(c>>>15)+a*u+(i>>>30),n[r++]=1073741823&l}return i}function u(e,t,n,r,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var l=16383&this[e],u=this[e++]>>14,c=a*l+u*s;l=s*l+((16383&c)<<14)+n[r]+i,i=(l>>28)+(c>>14)+a*u,n[r++]=268435455&l}return i}var c="undefined"!=typeof navigator;c&&"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=l,n=30):c&&"Netscape"!=navigator.appName?(o.prototype.am=a,n=26):(o.prototype.am=u,n=28),o.prototype.DB=n,o.prototype.DM=(1<=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function b(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function _(e){var t=s();return t.fromInt(e),t}function w(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,s=0;--r>=0;){var a=8==n?255&e[r]:y(e,r);a<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==s?this[this.t++]=a:s+n>this.DB?(this[this.t-1]|=(a&(1<>this.DB-s):this[this.t-1]|=a<=this.DB&&(s-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==e;)--this.t}function E(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n=(1<0)for(a>a)>0&&(i=!0,o=g(r));s>=0;)a>(a+=this.DB-t)):(r=this[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=g(r));return i?o:"0"}function S(){var e=s();return o.ZERO.subTo(this,e),e}function x(){return this.s<0?this.negate():this}function C(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(t=n-e.t,0!=t)return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0}function A(e){var t=1,n;return 0!=(n=e>>>16)&&(e=n,t+=16),0!=(n=e>>8)&&(e=n,t+=8),0!=(n=e>>4)&&(e=n,t+=4),0!=(n=e>>2)&&(e=n,t+=2),0!=(n=e>>1)&&(e=n,t+=1),t}function T(){return this.t<=0?0:this.DB*(this.t-1)+A(this[this.t-1]^this.s&this.DM)}function I(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s}function j(e,t){for(var n=e;n=0;--a)t[a+o+1]=this[a]>>r|s,s=(this[a]&i)<=0;--a)t[a]=0;t[o]=s,t.t=this.t+o+1,t.s=this.s,t.clamp()}function B(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<>r;for(var s=n+1;s>r;r>0&&(t[this.t-n-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()}function P(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t[i]=0;for(i=0;i=0;)e[n]=0;for(n=0;n=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()}function D(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t0?(r.lShiftTo(c,a),i.lShiftTo(c,n)):(r.copyTo(a),i.copyTo(n));var h=a.t,f=a[h-1];if(0!=f){var p=f*(1<1?a[h-2]>>this.F2:0),d=this.FV/p,m=(1<=0&&(n[n.t++]=1,n.subTo(b,n)),o.ONE.dlShiftTo(h,b),b.subTo(a,a);a.t=0;){var _=n[--y]==f?this.DM:Math.floor(n[y]*d+(n[y-1]+g)*m);if((n[y]+=a.am(0,_,n,v,0,h))<_)for(a.dlShiftTo(v,b),n.subTo(b,n);n[y]<--_;)n.subTo(b,n)}null!=t&&(n.drShiftTo(h,t),l!=u&&o.ZERO.subTo(t,t)),n.t=h,n.clamp(),c>0&&n.rShiftTo(c,n),l<0&&o.ZERO.subTo(n,n)}}}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 F(e){this.m=e}function L(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function U(e){return e}function q(e){e.divRemTo(this.m,null,e)}function z(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function K(e,t){e.squareTo(t),this.reduce(t)}function H(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function V(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function W(e){var t=s();return e.copyTo(t),this.reduce(t),t}function G(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function Y(e,t){e.squareTo(t),this.reduce(t)}function Z(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function J(){return 0==(this.t>0?1&this[0]:this.s)}function Q(e,t){if(e>4294967295||e<1)return o.ONE;var n=s(),r=s(),i=t.convert(this),a=A(e)-1;for(i.copyTo(n);--a>=0;)if(t.sqrTo(n,r),(e&1<0)t.mulTo(r,i,n);else{var l=n;n=r,r=l}return t.revert(n)}function X(e,t){var n;return n=e<256||t.isEven()?new F(t):new V(t),this.exp(e,n)}function ee(){var e=s();return this.copyTo(e),e}function te(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function re(){return 0==this.t?this.s:this[0]<<16>>16}function ie(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function oe(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function se(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),r=_(n),i=s(),o=s(),a="";for(this.divRemTo(r,i,o);i.signum()>0;)a=(n+o.intValue()).toString(e).substr(1)+a,i.divRemTo(r,i,o);return o.intValue().toString(e)+a}function ae(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),r=Math.pow(t,n),i=!1,s=0,a=0,l=0;l=n&&(this.dMultiply(r),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(a,0)),i&&o.ZERO.subTo(this,this)}function le(e,t,n){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(o.ONE.shiftLeft(e-1),ge,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(o.ONE.shiftLeft(e-1),this);else{var r=new Array,i=7&e;r.length=1+(e>>3),t.nextBytes(r),i>0?r[0]&=(1<0)for(n>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<=0;)n<8?(r=(this[e]&(1<>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t}function ce(e){return 0==this.compareTo(e)}function he(e){return this.compareTo(e)<0?this:e}function fe(e){return this.compareTo(e)>0?this:e}function pe(e,t,n){var r,i,o=Math.min(e.t,this.t);for(r=0;r>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function Ce(){for(var e=0;e=this.t?0!=this.s:0!=(this[t]&1<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()}function Ne(e){var t=s();return this.addTo(e,t),t}function De(e){var t=s();return this.subTo(e,t),t}function Me(e){var t=s();return this.multiplyTo(e,t),t}function Fe(){var e=s();return this.squareTo(e),e}function Le(e){var t=s();return this.divRemTo(e,t,null),t}function Ue(e){var t=s();return this.divRemTo(e,null,t),t}function qe(e){var t=s(),n=s();return this.divRemTo(e,t,n),new Array(t,n)}function ze(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Ke(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function He(){}function Ve(e){return e}function $e(e,t,n){e.multiplyTo(t,n)}function We(e,t){e.squareTo(t)}function Ge(e){return this.exp(e,new He)}function Ye(e,t,n){var r=Math.min(this.t+e.t,t),i;for(n.s=0,n.t=r;r>0;)n[--r]=0;for(i=n.t-this.t;r=0;)n[r]=0;for(r=Math.max(t-this.t,0);r2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t}function Xe(e){return e}function et(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function tt(e,t){e.squareTo(t),this.reduce(t)}function nt(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function rt(e,t){var n=e.bitLength(),r,i=_(1),o;if(n<=0)return i;r=n<18?1:n<48?3:n<144?4:n<768?5:6,o=n<8?new F(t):t.isEven()?new Je(t):new V(t);var a=new Array,l=3,u=r-1,c=(1<1){var h=s();for(o.sqrTo(a[1],h);l<=c;)a[l]=s(),o.mulTo(h,a[l-2],a[l]),l+=2}var f=e.t-1,p,d=!0,m=s(),g;for(n=A(e[f])-1;f>=0;){for(n>=u?p=e[f]>>n-u&c:(p=(e[f]&(1<0&&(p|=e[f-1]>>this.DB+n-u)),l=r;0==(1&p);)p>>=1,--l;if((n-=l)<0&&(n+=this.DB,--f),d)a[p].copyTo(i),d=!1;else{for(;l>1;)o.sqrTo(i,m),o.sqrTo(m,i),l-=2;l>0?o.sqrTo(i,m):(g=i,i=m,m=g),o.mulTo(m,a[p],i)}for(;f>=0&&0==(e[f]&1<0&&(t.rShiftTo(o,t),n.rShiftTo(o,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n}function ot(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this[r])%e;return n}function st(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return o.ZERO;for(var n=e.clone(),r=this.clone(),i=_(1),s=_(0),a=_(0),l=_(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),t?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;r.isEven();)r.rShiftTo(1,r),t?(a.isEven()&&l.isEven()||(a.addTo(this,a),l.subTo(e,l)),a.rShiftTo(1,a)):l.isEven()||l.subTo(e,l),l.rShiftTo(1,l);n.compareTo(r)>=0?(n.subTo(r,n),t&&i.subTo(a,i),s.subTo(l,s)):(r.subTo(n,r),t&&a.subTo(i,a),l.subTo(s,l))}return 0!=r.compareTo(o.ONE)?o.ZERO:l.compareTo(e)>=0?l.subtract(e):l.signum()<0?(l.addTo(e,l),l.signum()<0?l.add(e):l):l}F.prototype.convert=L,F.prototype.revert=U,F.prototype.reduce=q,F.prototype.mulTo=z,F.prototype.sqrTo=K,V.prototype.convert=$,V.prototype.revert=W,V.prototype.reduce=G,V.prototype.mulTo=Z,V.prototype.sqrTo=Y,o.prototype.copyTo=v,o.prototype.fromInt=b,o.prototype.fromString=w,o.prototype.clamp=k,o.prototype.dlShiftTo=I,o.prototype.drShiftTo=j,o.prototype.lShiftTo=R,o.prototype.rShiftTo=B,o.prototype.subTo=O,o.prototype.multiplyTo=P,o.prototype.squareTo=N,o.prototype.divRemTo=D,o.prototype.invDigit=H,o.prototype.isEven=J,o.prototype.exp=Q,o.prototype.toString=E,o.prototype.negate=S,o.prototype.abs=x,o.prototype.compareTo=C,o.prototype.bitLength=T,o.prototype.mod=M,o.prototype.modPowInt=X,o.ZERO=_(0),o.ONE=_(1),He.prototype.convert=Ve,He.prototype.revert=Ve,He.prototype.mulTo=$e,He.prototype.sqrTo=We,Je.prototype.convert=Qe,Je.prototype.revert=Xe,Je.prototype.reduce=et,Je.prototype.mulTo=nt,Je.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],lt=(1<<26)/at[at.length-1],ut,ct,ht;function ft(e){var t,n=this.abs();if(1==n.t&&n[0]<=at[at.length-1]){for(t=0;t>1,e>at.length&&(e=at.length);for(var i=s(),a=0;a>8&255,ct[ht++]^=e>>16&255,ct[ht++]^=e>>24&255,ht>=Ct&&(ht-=Ct)}function mt(){dt((new Date).getTime())}if(o.prototype.chunkSize=ie,o.prototype.toRadix=se,o.prototype.fromRadix=ae,o.prototype.fromNumber=le,o.prototype.bitwiseTo=pe,o.prototype.changeBit=je,o.prototype.addTo=Pe,o.prototype.dMultiply=ze,o.prototype.dAddOffset=Ke,o.prototype.multiplyLowerTo=Ye,o.prototype.multiplyUpperTo=Ze,o.prototype.modInt=ot,o.prototype.millerRabin=pt,o.prototype.clone=ee,o.prototype.intValue=te,o.prototype.byteValue=ne,o.prototype.shortValue=re,o.prototype.signum=oe,o.prototype.toByteArray=ue,o.prototype.equals=ce,o.prototype.min=he,o.prototype.max=fe,o.prototype.and=me,o.prototype.or=ye,o.prototype.xor=be,o.prototype.andNot=we,o.prototype.not=ke,o.prototype.shiftLeft=Ee,o.prototype.shiftRight=Se,o.prototype.getLowestSetBit=Ce,o.prototype.bitCount=Te,o.prototype.testBit=Ie,o.prototype.setBit=Re,o.prototype.clearBit=Be,o.prototype.flipBit=Oe,o.prototype.add=Ne,o.prototype.subtract=De,o.prototype.multiply=Me,o.prototype.divide=Le,o.prototype.remainder=Ue,o.prototype.divideAndRemainder=qe,o.prototype.modPow=rt,o.prototype.modInverse=st,o.prototype.pow=Ge,o.prototype.gcd=it,o.prototype.isProbablePrime=ft,o.prototype.square=Fe,o.prototype.Barrett=Je,null==ct){var gt;if(ct=new Array,ht=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var yt=new Uint8Array(32);for(window.crypto.getRandomValues(yt),gt=0;gt<32;++gt)ct[ht++]=yt[gt]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var vt=window.crypto.random(32);for(gt=0;gt>>8,ct[ht++]=255>ht=0,mt()}function bt(){if(null==ut){for(mt(),ut=xt(),ut.init(ct),ht=0;ht>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=255&r}function m(e,t,n,r,i){var o,s=0;for(o=0;o>>8)-1}function g(e,t,n,r){return m(e,t,n,r,16)}function y(e,t,n,r){return m(e,t,n,r,32)}function v(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,l=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,h=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,f=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,v=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,b=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,_=i,w=o,k=s,E=a,S=l,x=u,C=c,A=h,T=f,I=p,j=d,R=m,B=g,O=y,P=v,N=b,D,M=0;M<20;M+=2)D=_+B|0,S^=D<<7|D>>>25,D=S+_|0,T^=D<<9|D>>>23,D=T+S|0,B^=D<<13|D>>>19,D=B+T|0,_^=D<<18|D>>>14,D=x+w|0,I^=D<<7|D>>>25,D=I+x|0,O^=D<<9|D>>>23,D=O+I|0,w^=D<<13|D>>>19,D=w+O|0,x^=D<<18|D>>>14,D=j+C|0,P^=D<<7|D>>>25,D=P+j|0,k^=D<<9|D>>>23,D=k+P|0,C^=D<<13|D>>>19,D=C+k|0,j^=D<<18|D>>>14,D=N+R|0,E^=D<<7|D>>>25,D=E+N|0,A^=D<<9|D>>>23,D=A+E|0,R^=D<<13|D>>>19,D=R+A|0,N^=D<<18|D>>>14,D=_+E|0,w^=D<<7|D>>>25,D=w+_|0,k^=D<<9|D>>>23,D=k+w|0,E^=D<<13|D>>>19,D=E+k|0,_^=D<<18|D>>>14,D=x+S|0,C^=D<<7|D>>>25,D=C+x|0,A^=D<<9|D>>>23,D=A+C|0,S^=D<<13|D>>>19,D=S+A|0,x^=D<<18|D>>>14,D=j+I|0,R^=D<<7|D>>>25,D=R+j|0,T^=D<<9|D>>>23,D=T+R|0,I^=D<<13|D>>>19,D=I+T|0,j^=D<<18|D>>>14,D=N+P|0,B^=D<<7|D>>>25,D=B+N|0,O^=D<<9|D>>>23,D=O+B|0,P^=D<<13|D>>>19,D=P+O|0,N^=D<<18|D>>>14;_=_+i|0,w=w+o|0,k=k+s|0,E=E+a|0,S=S+l|0,x=x+u|0,C=C+c|0,A=A+h|0,T=T+f|0,I=I+p|0,j=j+d|0,R=R+m|0,B=B+g|0,O=O+y|0,P=P+v|0,N=N+b|0,e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=w>>>0&255,e[5]=w>>>8&255,e[6]=w>>>16&255,e[7]=w>>>24&255,e[8]=k>>>0&255,e[9]=k>>>8&255,e[10]=k>>>16&255,e[11]=k>>>24&255,e[12]=E>>>0&255,e[13]=E>>>8&255,e[14]=E>>>16&255,e[15]=E>>>24&255,e[16]=S>>>0&255,e[17]=S>>>8&255,e[18]=S>>>16&255,e[19]=S>>>24&255,e[20]=x>>>0&255,e[21]=x>>>8&255,e[22]=x>>>16&255,e[23]=x>>>24&255,e[24]=C>>>0&255,e[25]=C>>>8&255,e[26]=C>>>16&255,e[27]=C>>>24&255,e[28]=A>>>0&255,e[29]=A>>>8&255,e[30]=A>>>16&255,e[31]=A>>>24&255,e[32]=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]=j>>>0&255,e[41]=j>>>8&255,e[42]=j>>>16&255,e[43]=j>>>24&255,e[44]=R>>>0&255,e[45]=R>>>8&255,e[46]=R>>>16&255,e[47]=R>>>24&255,e[48]=B>>>0&255,e[49]=B>>>8&255,e[50]=B>>>16&255,e[51]=B>>>24&255,e[52]=O>>>0&255,e[53]=O>>>8&255,e[54]=O>>>16&255,e[55]=O>>>24&255,e[56]=P>>>0&255,e[57]=P>>>8&255,e[58]=P>>>16&255,e[59]=P>>>24&255,e[60]=N>>>0&255,e[61]=N>>>8&255,e[62]=N>>>16&255,e[63]=N>>>24&255}function b(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,l=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,h=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,f=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,v=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,b=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,_=i,w=o,k=s,E=a,S=l,x=u,C=c,A=h,T=f,I=p,j=d,R=m,B=g,O=y,P=v,N=b,D,M=0;M<20;M+=2)D=_+B|0,S^=D<<7|D>>>25,D=S+_|0,T^=D<<9|D>>>23,D=T+S|0,B^=D<<13|D>>>19,D=B+T|0,_^=D<<18|D>>>14,D=x+w|0,I^=D<<7|D>>>25,D=I+x|0,O^=D<<9|D>>>23,D=O+I|0,w^=D<<13|D>>>19,D=w+O|0,x^=D<<18|D>>>14,D=j+C|0,P^=D<<7|D>>>25,D=P+j|0,k^=D<<9|D>>>23,D=k+P|0,C^=D<<13|D>>>19,D=C+k|0,j^=D<<18|D>>>14,D=N+R|0,E^=D<<7|D>>>25,D=E+N|0,A^=D<<9|D>>>23,D=A+E|0,R^=D<<13|D>>>19,D=R+A|0,N^=D<<18|D>>>14,D=_+E|0,w^=D<<7|D>>>25,D=w+_|0,k^=D<<9|D>>>23,D=k+w|0,E^=D<<13|D>>>19,D=E+k|0,_^=D<<18|D>>>14,D=x+S|0,C^=D<<7|D>>>25,D=C+x|0,A^=D<<9|D>>>23,D=A+C|0,S^=D<<13|D>>>19,D=S+A|0,x^=D<<18|D>>>14,D=j+I|0,R^=D<<7|D>>>25,D=R+j|0,T^=D<<9|D>>>23,D=T+R|0,I^=D<<13|D>>>19,D=I+T|0,j^=D<<18|D>>>14,D=N+P|0,B^=D<<7|D>>>25,D=B+N|0,O^=D<<9|D>>>23,D=O+B|0,P^=D<<13|D>>>19,D=P+O|0,N^=D<<18|D>>>14;e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=x>>>0&255,e[5]=x>>>8&255,e[6]=x>>>16&255,e[7]=x>>>24&255,e[8]=j>>>0&255,e[9]=j>>>8&255,e[10]=j>>>16&255,e[11]=j>>>24&255,e[12]=N>>>0&255,e[13]=N>>>8&255,e[14]=N>>>16&255,e[15]=N>>>24&255,e[16]=C>>>0&255,e[17]=C>>>8&255,e[18]=C>>>16&255,e[19]=C>>>24&255,e[20]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=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,n,r){v(e,t,n,r)}function w(e,t,n,r){b(e,t,n,r)}var k=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function E(e,t,n,r,i,o,s){var a=new Uint8Array(16),l=new Uint8Array(64),u,c;for(c=0;c<16;c++)a[c]=0;for(c=0;c<8;c++)a[c]=o[c];for(;i>=64;){for(_(l,a,s,k),c=0;c<64;c++)e[t+c]=n[r+c]^l[c];for(u=1,c=8;c<16;c++)u=u+(255&a[c])|0,a[c]=255&u,u>>>=8;i-=64,t+=64,r+=64}if(i>0)for(_(l,a,s,k),c=0;c=64;){for(_(s,o,i,k),l=0;l<64;l++)e[t+l]=s[l];for(a=1,l=8;l<16;l++)a=a+(255&o[l])|0,o[l]=255&a,a>>>=8;n-=64,t+=64}if(n>0)for(_(s,o,i,k),l=0;l>>13|n<<3),r=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(n>>>10|r<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(r>>>7|i<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|s<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(s>>>11|a<<5),l=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|l<<8),this.r[9]=l>>>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,n,r,i,o){var s=new A(o);return s.update(n,r,i),s.finish(e,t),0}function I(e,t,n,r,i,o){var s=new Uint8Array(16);return T(s,0,n,r,i,o),g(e,t,s,0)}function j(e,t,n,r,i){var o;if(n<32)return-1;for(C(e,0,t,0,n,r,i),T(e,16,e,32,n-32,e),o=0;o<16;o++)e[o]=0;return 0}function R(e,t,n,r,i){var o,s=new Uint8Array(32);if(n<32)return-1;if(x(s,0,32,r,i),0!==I(t,16,t,32,n-32,s))return-1;for(C(e,0,t,0,n,r,i),o=0;o<32;o++)e[o]=0;return 0}function B(e,t){var n;for(n=0;n<16;n++)e[n]=0|t[n]}function O(e){var t,n,r=1;for(t=0;t<16;t++)n=e[t]+r+65535,r=Math.floor(n/65536),e[t]=n-65536*r;e[0]+=r-1+37*(r-1)}function P(e,t,n){for(var r,i=~(n-1),o=0;o<16;o++)r=i&(e[o]^t[o]),e[o]^=r,t[o]^=r}function N(e,n){var r,i,o,s=t(),a=t();for(r=0;r<16;r++)a[r]=n[r];for(O(a),O(a),O(a),i=0;i<2;i++){for(s[0]=a[0]-65517,r=1;r<15;r++)s[r]=a[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),o=s[15]>>16&1,s[14]&=65535,P(a,s,1-o)}for(r=0;r<16;r++)e[2*r]=255&a[r],e[2*r+1]=a[r]>>8}function D(e,t){var n=new Uint8Array(32),r=new Uint8Array(32);return N(n,e),N(r,t),y(n,0,r,0)}function M(e){var t=new Uint8Array(32);return N(t,e),1&t[0]}function F(e,t){var n;for(n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function L(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]+n[r]}function U(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]-n[r]}function q(e,t,n){var r,i,o=0,s=0,a=0,l=0,u=0,c=0,h=0,f=0,p=0,d=0,m=0,g=0,y=0,v=0,b=0,_=0,w=0,k=0,E=0,S=0,x=0,C=0,A=0,T=0,I=0,j=0,R=0,B=0,O=0,P=0,N=0,D=n[0],M=n[1],F=n[2],L=n[3],U=n[4],q=n[5],z=n[6],K=n[7],H=n[8],V=n[9],$=n[10],W=n[11],G=n[12],Y=n[13],Z=n[14],J=n[15];r=t[0],o+=r*D,s+=r*M,a+=r*F,l+=r*L,u+=r*U,c+=r*q,h+=r*z,f+=r*K,p+=r*H,d+=r*V,m+=r*$,g+=r*W,y+=r*G,v+=r*Y,b+=r*Z,_+=r*J,r=t[1],s+=r*D,a+=r*M,l+=r*F,u+=r*L,c+=r*U,h+=r*q,f+=r*z,p+=r*K,d+=r*H,m+=r*V,g+=r*$,y+=r*W,v+=r*G,b+=r*Y,_+=r*Z,w+=r*J,r=t[2],a+=r*D,l+=r*M,u+=r*F,c+=r*L,h+=r*U,f+=r*q,p+=r*z,d+=r*K,m+=r*H,g+=r*V,y+=r*$,v+=r*W,b+=r*G,_+=r*Y,w+=r*Z,k+=r*J,r=t[3],l+=r*D,u+=r*M,c+=r*F,h+=r*L,f+=r*U,p+=r*q,d+=r*z,m+=r*K,g+=r*H,y+=r*V,v+=r*$,b+=r*W,_+=r*G,w+=r*Y,k+=r*Z,E+=r*J,r=t[4],u+=r*D,c+=r*M,h+=r*F,f+=r*L,p+=r*U,d+=r*q,m+=r*z,g+=r*K,y+=r*H,v+=r*V,b+=r*$,_+=r*W,w+=r*G,k+=r*Y,E+=r*Z,S+=r*J,r=t[5],c+=r*D,h+=r*M,f+=r*F,p+=r*L,d+=r*U,m+=r*q,g+=r*z,y+=r*K,v+=r*H,b+=r*V,_+=r*$,w+=r*W,k+=r*G,E+=r*Y,S+=r*Z,x+=r*J,r=t[6],h+=r*D,f+=r*M,p+=r*F,d+=r*L,m+=r*U,g+=r*q,y+=r*z,v+=r*K,b+=r*H,_+=r*V,w+=r*$,k+=r*W,E+=r*G,S+=r*Y,x+=r*Z,C+=r*J,r=t[7],f+=r*D,p+=r*M,d+=r*F,m+=r*L,g+=r*U,y+=r*q,v+=r*z,b+=r*K,_+=r*H,w+=r*V,k+=r*$,E+=r*W,S+=r*G,x+=r*Y,C+=r*Z,A+=r*J,r=t[8],p+=r*D,d+=r*M,m+=r*F,g+=r*L,y+=r*U,v+=r*q,b+=r*z,_+=r*K,w+=r*H,k+=r*V,E+=r*$,S+=r*W,x+=r*G,C+=r*Y,A+=r*Z,T+=r*J,r=t[9],d+=r*D,m+=r*M,g+=r*F,y+=r*L,v+=r*U,b+=r*q,_+=r*z,w+=r*K,k+=r*H,E+=r*V,S+=r*$,x+=r*W,C+=r*G,A+=r*Y,T+=r*Z,I+=r*J,r=t[10],m+=r*D,g+=r*M,y+=r*F,v+=r*L,b+=r*U,_+=r*q,w+=r*z,k+=r*K,E+=r*H,S+=r*V,x+=r*$,C+=r*W,A+=r*G,T+=r*Y,I+=r*Z,j+=r*J,r=t[11],g+=r*D,y+=r*M,v+=r*F,b+=r*L,_+=r*U,w+=r*q,k+=r*z,E+=r*K,S+=r*H,x+=r*V,C+=r*$,A+=r*W,T+=r*G,I+=r*Y,j+=r*Z,R+=r*J,r=t[12],y+=r*D,v+=r*M,b+=r*F,_+=r*L,w+=r*U,k+=r*q,E+=r*z,S+=r*K,x+=r*H,C+=r*V,A+=r*$,T+=r*W,I+=r*G,j+=r*Y,R+=r*Z,B+=r*J,r=t[13],v+=r*D,b+=r*M,_+=r*F,w+=r*L,k+=r*U,E+=r*q,S+=r*z,x+=r*K,C+=r*H,A+=r*V,T+=r*$,I+=r*W,j+=r*G,R+=r*Y,B+=r*Z,O+=r*J,r=t[14],b+=r*D,_+=r*M,w+=r*F,k+=r*L,E+=r*U,S+=r*q,x+=r*z,C+=r*K,A+=r*H,T+=r*V,I+=r*$,j+=r*W,R+=r*G,B+=r*Y,O+=r*Z,P+=r*J,r=t[15],_+=r*D,w+=r*M,k+=r*F,E+=r*L,S+=r*U,x+=r*q,C+=r*z,A+=r*K,T+=r*H,I+=r*V,j+=r*$,R+=r*W,B+=r*G,O+=r*Y,P+=r*Z,N+=r*J,o+=38*w,s+=38*k,a+=38*E,l+=38*S,u+=38*x,c+=38*C,h+=38*A,f+=38*T,p+=38*I,d+=38*j,m+=38*R,g+=38*B,y+=38*O,v+=38*P,b+=38*N,i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,o+=i-1+37*(i-1),i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=l,e[4]=u,e[5]=c,e[6]=h,e[7]=f,e[8]=p,e[9]=d,e[10]=m,e[11]=g,e[12]=y,e[13]=v,e[14]=b,e[15]=_}function z(e,t){q(e,t,t)}function K(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=253;i>=0;i--)z(r,r),2!==i&&4!==i&&q(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function H(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=250;i>=0;i--)z(r,r),1!==i&&q(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function V(e,n,r){var i=new Uint8Array(32),o=new Float64Array(80),s,a,u=t(),c=t(),h=t(),f=t(),p=t(),d=t();for(a=0;a<31;a++)i[a]=n[a];for(i[31]=127&n[31]|64,i[0]&=248,F(o,r),a=0;a<16;a++)c[a]=o[a],f[a]=u[a]=h[a]=0;for(u[0]=f[0]=1,a=254;a>=0;--a)s=i[a>>>3]>>>(7&a)&1,P(u,c,s),P(h,f,s),L(p,u,h),U(u,u,h),L(h,c,f),U(c,c,f),z(f,p),z(d,u),q(u,h,u),q(h,c,p),L(p,u,h),U(u,u,h),z(c,u),U(h,f,d),q(u,h,l),L(u,u,f),q(h,h,u),q(u,f,d),q(f,c,o),z(c,p),P(u,c,s),P(h,f,s);for(a=0;a<16;a++)o[a+16]=u[a],o[a+32]=h[a],o[a+48]=c[a],o[a+64]=f[a];var m=o.subarray(32),g=o.subarray(16);return K(m,m),q(g,g,m),N(e,g),0}function $(e,t){return V(e,t,o)}function W(e,t){return r(t,32),$(e,t)}function G(e,t,n){var r=new Uint8Array(32);return V(r,n,t),w(e,i,r,k)}A.prototype.blocks=function(e,t,n){for(var r=this.fin?0:2048,i,o,s,a,l,u,c,h,f,p,d,m,g,y,v,b,_,w,k,E=this.h[0],S=this.h[1],x=this.h[2],C=this.h[3],A=this.h[4],T=this.h[5],I=this.h[6],j=this.h[7],R=this.h[8],B=this.h[9],O=this.r[0],P=this.r[1],N=this.r[2],D=this.r[3],M=this.r[4],F=this.r[5],L=this.r[6],U=this.r[7],q=this.r[8],z=this.r[9];n>=16;)i=255&e[t+0]|(255&e[t+1])<<8,E+=8191&i,o=255&e[t+2]|(255&e[t+3])<<8,S+=8191&(i>>>13|o<<3),s=255&e[t+4]|(255&e[t+5])<<8,x+=8191&(o>>>10|s<<6),a=255&e[t+6]|(255&e[t+7])<<8,C+=8191&(s>>>7|a<<9),l=255&e[t+8]|(255&e[t+9])<<8,A+=8191&(a>>>4|l<<12),T+=l>>>1&8191,u=255&e[t+10]|(255&e[t+11])<<8,I+=8191&(l>>>14|u<<2),c=255&e[t+12]|(255&e[t+13])<<8,j+=8191&(u>>>11|c<<5),h=255&e[t+14]|(255&e[t+15])<<8,R+=8191&(c>>>8|h<<8),B+=h>>>5|r,f=0,p=f,p+=E*O,p+=S*(5*z),p+=x*(5*q),p+=C*(5*U),p+=A*(5*L),f=p>>>13,p&=8191,p+=T*(5*F),p+=I*(5*M),p+=j*(5*D),p+=R*(5*N),p+=B*(5*P),f+=p>>>13,p&=8191,d=f,d+=E*P,d+=S*O,d+=x*(5*z),d+=C*(5*q),d+=A*(5*U),f=d>>>13,d&=8191,d+=T*(5*L),d+=I*(5*F),d+=j*(5*M),d+=R*(5*D),d+=B*(5*N),f+=d>>>13,d&=8191,m=f,m+=E*N,m+=S*P,m+=x*O,m+=C*(5*z),m+=A*(5*q),f=m>>>13,m&=8191,m+=T*(5*U),m+=I*(5*L),m+=j*(5*F),m+=R*(5*M),m+=B*(5*D),f+=m>>>13,m&=8191,g=f,g+=E*D,g+=S*N,g+=x*P,g+=C*O,g+=A*(5*z),f=g>>>13,g&=8191,g+=T*(5*q),g+=I*(5*U),g+=j*(5*L),g+=R*(5*F),g+=B*(5*M),f+=g>>>13,g&=8191,y=f,y+=E*M,y+=S*D,y+=x*N,y+=C*P,y+=A*O,f=y>>>13,y&=8191,y+=T*(5*z),y+=I*(5*q),y+=j*(5*U),y+=R*(5*L),y+=B*(5*F),f+=y>>>13,y&=8191,v=f,v+=E*F,v+=S*M,v+=x*D,v+=C*N,v+=A*P,f=v>>>13,v&=8191,v+=T*O,v+=I*(5*z),v+=j*(5*q),v+=R*(5*U),v+=B*(5*L),f+=v>>>13,v&=8191,b=f,b+=E*L,b+=S*F,b+=x*M,b+=C*D,b+=A*N,f=b>>>13,b&=8191,b+=T*P,b+=I*O,b+=j*(5*z),b+=R*(5*q),b+=B*(5*U),f+=b>>>13,b&=8191,_=f,_+=E*U,_+=S*L,_+=x*F,_+=C*M,_+=A*D,f=_>>>13,_&=8191,_+=T*N,_+=I*P,_+=j*O,_+=R*(5*z),_+=B*(5*q),f+=_>>>13,_&=8191,w=f,w+=E*q,w+=S*U,w+=x*L,w+=C*F,w+=A*M,f=w>>>13,w&=8191,w+=T*D,w+=I*N,w+=j*P,w+=R*O,w+=B*(5*z),f+=w>>>13,w&=8191,k=f,k+=E*z,k+=S*q,k+=x*U,k+=C*L,k+=A*F,f=k>>>13,k&=8191,k+=T*M,k+=I*D,k+=j*N,k+=R*P,k+=B*O,f+=k>>>13,k&=8191,f=(f<<2)+f|0,f=f+p|0,p=8191&f,f>>>=13,d+=f,E=p,S=d,x=m,C=g,A=y,T=v,I=b,j=_,R=w,B=k,t+=16,n-=16;this.h[0]=E,this.h[1]=S,this.h[2]=x,this.h[3]=C,this.h[4]=A,this.h[5]=T,this.h[6]=I,this.h[7]=j,this.h[8]=R,this.h[9]=B},A.prototype.finish=function(e,t){var n=new Uint16Array(10),r,i,o,s;if(this.leftover){for(s=this.leftover,this.buffer[s++]=1;s<16;s++)this.buffer[s]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,s=2;s<10;s++)this.h[s]+=r,r=this.h[s]>>>13,this.h[s]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,n[0]=this.h[0]+5,r=n[0]>>>13,n[0]&=8191,s=1;s<10;s++)n[s]=this.h[s]+r,r=n[s]>>>13,n[s]&=8191;for(n[9]-=8192,i=(1^r)-1,s=0;s<10;s++)n[s]&=i;for(i=~i,s=0;s<10;s++)this.h[s]=this.h[s]&i|n[s];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,s=1;s<8;s++)o=(this.h[s]+this.pad[s]|0)+(o>>>16)|0,this.h[s]=65535&o;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},A.prototype.update=function(e,t,n){var r,i;if(this.leftover){for(i=16-this.leftover,i>n&&(i=n),r=0;r=16&&(i=n-n%16,this.blocks(e,t,i),t+=i,n-=i),n){for(r=0;r=128;){for(S=0;S<16;S++)x=8*S+G,i[S]=n[x+0]<<24|n[x+1]<<16|n[x+2]<<8|n[x+3],o[S]=n[x+4]<<24|n[x+5]<<16|n[x+6]<<8|n[x+7];for(S=0;S<80;S++)if(s=B,a=O,l=P,u=N,c=D,h=M,f=F,p=L,d=U,m=q,g=z,y=K,v=H,b=V,_=$,w=W,C=L,A=W,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=(D>>>14|H<<18)^(D>>>18|H<<14)^(H>>>9|D<<23),A=(H>>>14|D<<18)^(H>>>18|D<<14)^(D>>>9|H<<23),T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,C=D&M^~D&F,A=H&V^~H&$,T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,C=X[2*S],A=X[2*S+1],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,C=i[S%16],A=o[S%16],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,k=65535&j|R<<16,E=65535&T|I<<16,C=k,A=E,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=(B>>>28|U<<4)^(U>>>2|B<<30)^(U>>>7|B<<25),A=(U>>>28|B<<4)^(B>>>2|U<<30)^(B>>>7|U<<25),T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,C=B&O^B&P^O&P,A=U&q^U&z^q&z,T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,p=65535&j|R<<16,w=65535&T|I<<16,C=u,A=y,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=k,A=E,T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,u=65535&j|R<<16,y=65535&T|I<<16,O=s,P=a,N=l,D=u,M=c,F=h,L=f,B=p,q=d,z=m,K=g,H=y,V=v,$=b,W=_,U=w,S%16==15)for(x=0;x<16;x++)C=i[x],A=o[x],T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=i[(x+9)%16],A=o[(x+9)%16],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,k=i[(x+1)%16],E=o[(x+1)%16],C=(k>>>1|E<<31)^(k>>>8|E<<24)^k>>>7,A=(E>>>1|k<<31)^(E>>>8|k<<24)^(E>>>7|k<<25),T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,k=i[(x+14)%16],E=o[(x+14)%16],C=(k>>>19|E<<13)^(E>>>29|k<<3)^k>>>6,A=(E>>>19|k<<13)^(k>>>29|E<<3)^(E>>>6|k<<26),T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,i[x]=65535&j|R<<16,o[x]=65535&T|I<<16;C=B,A=U,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[0],A=t[0],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[0]=B=65535&j|R<<16,t[0]=U=65535&T|I<<16,C=O,A=q,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[1],A=t[1],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[1]=O=65535&j|R<<16,t[1]=q=65535&T|I<<16,C=P,A=z,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[2],A=t[2],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[2]=P=65535&j|R<<16,t[2]=z=65535&T|I<<16,C=N,A=K,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[3],A=t[3],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[3]=N=65535&j|R<<16,t[3]=K=65535&T|I<<16,C=D,A=H,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[4],A=t[4],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[4]=D=65535&j|R<<16,t[4]=H=65535&T|I<<16,C=M,A=V,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[5],A=t[5],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[5]=M=65535&j|R<<16,t[5]=V=65535&T|I<<16,C=F,A=$,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[6],A=t[6],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[6]=F=65535&j|R<<16,t[6]=$=65535&T|I<<16,C=L,A=W,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[7],A=t[7],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[7]=L=65535&j|R<<16,t[7]=W=65535&T|I<<16,G+=128,r-=128}return r}function te(e,t,n){var r=new Int32Array(8),i=new Int32Array(8),o=new Uint8Array(256),s,a=n;for(r[0]=1779033703,r[1]=3144134277,r[2]=1013904242,r[3]=2773480762,r[4]=1359893119,r[5]=2600822924,r[6]=528734635,r[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,ee(r,i,t,n),n%=128,s=0;s=0;--i)r=n[i/8|0]>>(7&i)&1,re(e,t,r),ne(t,e),ne(e,e),re(e,t,r)}function se(e,n){var r=[t(),t(),t(),t()];B(r[0],h),B(r[1],f),B(r[2],a),q(r[3],h,f),oe(e,r,n)}function ae(e,n,i){var o=new Uint8Array(64),s=[t(),t(),t(),t()],a;for(i||r(n,32),te(o,n,32),o[0]&=248,o[31]&=127,o[31]|=64,se(s,o),ie(e,s),a=0;a<32;a++)n[a+32]=e[a];return 0}var le=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 ue(e,t){var n,r,i,o;for(r=63;r>=32;--r){for(n=0,i=r-32,o=r-12;i>8,t[i]-=256*n;t[i]+=n,t[r]=0}for(n=0,i=0;i<32;i++)t[i]+=n-(t[31]>>4)*le[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*le[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function ce(e){var t=new Float64Array(64),n;for(n=0;n<64;n++)t[n]=e[n];for(n=0;n<64;n++)e[n]=0;ue(e,t)}function he(e,n,r,i){var o=new Uint8Array(64),s=new Uint8Array(64),a=new Uint8Array(64),l,u,c=new Float64Array(64),h=[t(),t(),t(),t()];te(o,i,32),o[0]&=248,o[31]&=127,o[31]|=64;var f=r+64;for(l=0;l>7&&U(e[0],s,e[0]),q(e[3],e[0],e[1]),0)}function pe(e,n,r,i){var o,s,a=new Uint8Array(32),l=new Uint8Array(64),u=[t(),t(),t(),t()],c=[t(),t(),t(),t()];if(s=-1,r<64)return-1;if(fe(c,i))return-1;for(o=0;o=0},e.sign.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(64);return ae(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(Oe(e),64!==e.length)throw new Error("bad secret key size");for(var t=new Uint8Array(32),n=0;n=this._buffer.length},o.prototype.remainder=function(){return this._buffer.slice(this._offset)},o.prototype.skip=function(e){this._offset+=e},o.prototype.expand=function(){this._size*=2;var e=i.alloc(this._size);this._buffer.copy(e,0),this._buffer=e},o.prototype.readPart=function(){return{data:this.readBuffer()}},o.prototype.readBuffer=function(){var e=this._buffer.readUInt32BE(this._offset);this._offset+=4,r.ok(this._offset+e<=this._buffer.length,"length out of bounds at +0x"+this._offset.toString(16)+" (data truncated?)");var t=this._buffer.slice(this._offset,this._offset+e);return this._offset+=e,t},o.prototype.readString=function(){return this.readBuffer().toString()},o.prototype.readCString=function(){for(var e=this._offset;ethis._size;)this.expand();this._buffer.writeUInt32BE(e.length,this._offset),this._offset+=4,e.copy(this._buffer,this._offset),this._offset+=e.length},o.prototype.writeString=function(e){this.writeBuffer(i.from(e,"utf8"))},o.prototype.writeCString=function(e){for(;this._offset+1+e.length>this._size;)this.expand();this._buffer.write(e,this._offset),this._offset+=e.length,this._buffer[this._offset++]=0},o.prototype.writeInt=function(e){for(;this._offset+4>this._size;)this.expand();this._buffer.writeUInt32BE(e,this._offset),this._offset+=4},o.prototype.writeInt64=function(e){if(r.buffer(e,"value"),e.length>8){for(var t=e.slice(0,e.length-8),n=0;nthis._size;)this.expand();e.copy(this._buffer,this._offset),this._offset+=8},o.prototype.writeChar=function(e){for(;this._offset+1>this._size;)this.expand();this._buffer[this._offset++]=e},o.prototype.writePart=function(e){this.writeBuffer(e.data)},o.prototype.write=function(e){for(;this._offset+e.length>this._size;)this.expand();e.copy(this._buffer,this._offset),this._offset+=e.length}},function(e,t,n){e.exports={read:h,readPkcs8:d,write:f,writePkcs8:A,pkcs8ToBuffer:C,readECDSACurve:b,writeECDSACurve:B};var r=n(25),i=n(84),o=n(29).Buffer,s=n(48),a=n(42),l=n(41),u=n(46),c=n(92);function h(e,t){return c.read(e,t,"pkcs8")}function f(e,t){return c.write(e,t,"pkcs8")}function p(e,t){return r.strictEqual(e.peek(),i.Ber.Integer,t+" is not an Integer"),a.mpNormalize(e.readString(i.Ber.Integer,!0))}function d(e,t,n){n.peek()===i.Ber.Integer&&(r.strictEqual(t,"private","unexpected Integer at start of public key"),n.readString(i.Ber.Integer,!0)),n.readSequence();var o=n.offset+n.length,s=n.readOID();switch(s){case"1.2.840.113549.1.1.1":return n._offset=o,"public"===t?m(n):g(n);case"1.2.840.10040.4.1":return"public"===t?y(n):v(n);case"1.2.840.10045.2.1":return"public"===t?w(n):_(n);case"1.3.101.112":return"public"===t?k(n):S(n);case"1.3.101.110":return"public"===t?E(n):x(n);default:throw new Error("Unknown key type OID "+s)}}function m(e){e.readSequence(i.Ber.BitString),e.readByte(),e.readSequence();var t=p(e,"modulus"),n=p(e,"exponent"),r={type:"rsa",source:e.originalInput,parts:[{name:"e",data:n},{name:"n",data:t}]};return new l(r)}function g(e){e.readSequence(i.Ber.OctetString),e.readSequence();var t=p(e,"version");r.equal(t[0],0,"unknown RSA private key version");var n=p(e,"modulus"),o=p(e,"public exponent"),s=p(e,"private exponent"),a=p(e,"prime1"),l=p(e,"prime2"),c=p(e,"exponent1"),h=p(e,"exponent2"),f=p(e,"iqmp"),d={type:"rsa",parts:[{name:"n",data:n},{name:"e",data:o},{name:"d",data:s},{name:"iqmp",data:f},{name:"p",data:a},{name:"q",data:l},{name:"dmodp",data:c},{name:"dmodq",data:h}]};return new u(d)}function y(e){e.readSequence();var t=p(e,"p"),n=p(e,"q"),r=p(e,"g");e.readSequence(i.Ber.BitString),e.readByte();var o=p(e,"y"),s={type:"dsa",parts:[{name:"p",data:t},{name:"q",data:n},{name:"g",data:r},{name:"y",data:o}]};return new l(s)}function v(e){e.readSequence();var t=p(e,"p"),n=p(e,"q"),r=p(e,"g");e.readSequence(i.Ber.OctetString);var o=p(e,"x"),s=a.calculateDSAPublic(r,t,o),l={type:"dsa",parts:[{name:"p",data:t},{name:"q",data:n},{name:"g",data:r},{name:"y",data:s},{name:"x",data:o}]};return new u(l)}function b(e){var t,n,l,u,c;if(e.peek()===i.Ber.OID){var h=e.readOID();for(n=Object.keys(s.curves),l=0;l=this.validFrom.getTime()&&e.getTime()0&&-1===this.issuer.purposes.indexOf("ca"))&&this.isSignedByKey(e.subjectKey))},v.prototype.getExtension=function(e){r.string(e,"keyOrOid");var t=this.getExtensions().filter(function(t){return"x509"===t.format?t.oid===e:"openssh"===t.format&&t.name===e})[0];return t},v.prototype.getExtensions=function(){var e=[],t=this.signatures.x509;t&&t.extras&&t.extras.exts&&t.extras.exts.forEach(function(t){t.format="x509",e.push(t)});var n=this.signatures.openssh;return n&&n.exts&&n.exts.forEach(function(t){t.format="openssh",e.push(t)}),e},v.prototype.isSignedByKey=function(e){if(h.assertCompatible(e,f,[1,2],"issuerKey"),void 0!==this.issuerKey)return this.issuerKey.fingerprint("sha512").matches(e);var t=Object.keys(this.signatures)[0],n=m[t].verify(this,e);return n&&(this.issuerKey=e),n},v.prototype.signWith=function(e){h.assertCompatible(e,p,[1,2],"key");for(var t=Object.keys(m),n=!1,r=0;r0&&-1===c.indexOf("serverAuth")&&c.push("serverAuth"),m.length>0&&-1===c.indexOf("clientAuth")&&c.push("clientAuth"),(m.length>0||f.length>0)&&(-1===c.indexOf("keyAgreement")&&c.push("keyAgreement"),"rsa"===t.type&&-1===c.indexOf("encryption")&&c.push("encryption"))}var g=new v({subjects:o,issuer:o[0],subjectKey:t.toPublic(),issuerKey:t.toPublic(),signatures:{},serial:u,validFrom:s,validUntil:a,purposes:c});return g.signWith(t),g},v.create=function(e,t,n,o,s){var a;a=Array.isArray(e)?e:[e],r.arrayOfObject(a),a.forEach(function(e){h.assertCompatible(e,d,[1,0],"subject")}),h.assertCompatible(t,f,[1,0],"key"),p.isPrivateKey(t)&&(t=t.toPublic()),h.assertCompatible(n,d,[1,0],"issuer"),h.assertCompatible(o,p,[1,2],"issuer key"),r.optionalObject(s,"options"),void 0===s&&(s={}),r.optionalObject(s.validFrom,"options.validFrom"),r.optionalObject(s.validUntil,"options.validUntil");var l=s.validFrom,u=s.validUntil;if(void 0===l&&(l=new Date),void 0===u){r.optionalNumber(s.lifetime,"options.lifetime");var c=s.lifetime;void 0===c&&(c=31536e4),u=new Date,u.setTime(u.getTime()+1e3*c)}r.optionalBuffer(s.serial,"options.serial");var m=s.serial;void 0===m&&(m=i.from("0000000000000001","hex"));var g=s.purposes;void 0===g&&(g=[]),-1===g.indexOf("signature")&&g.push("signature"),!0===s.ca&&(-1===g.indexOf("ca")&&g.push("ca"),-1===g.indexOf("crl")&&g.push("crl"));var y=a.filter(function(e){return"host"===e.type}),b=a.filter(function(e){return"user"===e.type});y.length>0&&-1===g.indexOf("serverAuth")&&g.push("serverAuth"),b.length>0&&-1===g.indexOf("clientAuth")&&g.push("clientAuth"),(b.length>0||y.length>0)&&(-1===g.indexOf("keyAgreement")&&g.push("keyAgreement"),"rsa"===t.type&&-1===g.indexOf("encryption")&&g.push("encryption"));var _=new v({subjects:a,issuer:n,subjectKey:t,issuerKey:o.toPublic(),signatures:{},serial:m,validFrom:l,validUntil:u,purposes:g});return _.signWith(o),_},v.parse=function(e,t,n){"string"!=typeof e&&r.buffer(e,"data"),void 0===t&&(t="auto"),r.string(t,"format"),"string"==typeof n&&(n={filename:n}),r.optionalObject(n,"options"),void 0===n&&(n={}),r.optionalString(n.filename,"options.filename"),void 0===n.filename&&(n.filename="(unnamed)"),r.object(m[t],"formats[format]");try{var i=m[t].read(e,n);return i}catch(e){throw new g(n.filename,t,e)}},v.isCertificate=function(e,t){return h.isCompatible(e,v,t)},v.prototype._sshpkApiVersion=[1,1],v._oldVersionDetect=function(e){return[1,0]}},function(e,t,n){e.exports=g;var r=n(25),i=n(48),o=n(16),s=n(172),a=n(83),l=n(76),u=n(14),c=n(42),h=n(84),f=n(29).Buffer,p=/^([*]|[a-z0-9][a-z0-9\-]{0,62})(?:\.([*]|[a-z0-9][a-z0-9\-]{0,62}))*$/i,d={cn:"2.5.4.3",o:"2.5.4.10",ou:"2.5.4.11",l:"2.5.4.7",s:"2.5.4.8",c:"2.5.4.6",sn:"2.5.4.4",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",street:"2.5.4.9",x500UniqueIdentifier:"2.5.4.45",role:"2.5.4.72",telephoneNumber:"2.5.4.20",description:"2.5.4.13",dc:"0.9.2342.19200300.100.1.25",uid:"0.9.2342.19200300.100.1.1",mail:"0.9.2342.19200300.100.1.3",title:"2.5.4.12",gn:"2.5.4.42",initials:"2.5.4.43",pseudonym:"2.5.4.65",emailAddress:"1.2.840.113549.1.9.1"},m={};function g(e){var t=this;if(r.object(e,"options"),r.arrayOfObject(e.components,"options.components"),this.components=e.components,this.componentLookup={},this.components.forEach(function(e){e.name&&!e.oid&&(e.oid=d[e.name]),e.oid&&!e.name&&(e.name=m[e.oid]),void 0===t.componentLookup[e.name]&&(t.componentLookup[e.name]=[]),t.componentLookup[e.name].push(e)}),this.componentLookup.cn&&this.componentLookup.cn.length>0&&(this.cn=this.componentLookup.cn[0].value),r.optionalString(e.type,"options.type"),void 0===e.type)1===this.components.length&&this.componentLookup.cn&&1===this.componentLookup.cn.length&&this.componentLookup.cn[0].value.match(p)?(this.type="host",this.hostname=this.componentLookup.cn[0].value):this.componentLookup.dc&&this.components.length===this.componentLookup.dc.length?(this.type="host",this.hostname=this.componentLookup.dc.map(function(e){return e.value}).join(".")):this.componentLookup.uid&&this.components.length===this.componentLookup.uid.length?(this.type="user",this.uid=this.componentLookup.uid[0].value):this.componentLookup.cn&&1===this.componentLookup.cn.length&&this.componentLookup.cn[0].value.match(p)?(this.type="host",this.hostname=this.componentLookup.cn[0].value):this.componentLookup.uid&&1===this.componentLookup.uid.length?(this.type="user",this.uid=this.componentLookup.uid[0].value):this.componentLookup.mail&&1===this.componentLookup.mail.length?(this.type="email",this.email=this.componentLookup.mail[0].value):this.componentLookup.cn&&1===this.componentLookup.cn.length?(this.type="user",this.uid=this.componentLookup.cn[0].value):this.type="unknown";else if(this.type=e.type,"host"===this.type)this.hostname=e.hostname;else if("user"===this.type)this.uid=e.uid;else{if("email"!==this.type)throw new Error("Unknown type "+this.type);this.email=e.email}}Object.keys(d).forEach(function(e){m[d[e]]=e}),g.prototype.toString=function(){return this.components.map(function(e){var t=e.name.toUpperCase();t=t.replace(/=/g,"\\=");var n=e.value;return n=n.replace(/,/g,"\\,"),t+"="+n}).join(", ")},g.prototype.get=function(e,t){r.string(e,"name");var n=this.componentLookup[e];if(void 0!==n&&0!==n.length){if(!t&&n.length>1)throw new Error("Multiple values for attribute "+e);return t?n.map(function(e){return e.value}):n[0].value}},g.prototype.toArray=function(e){return this.components.map(function(e){return{name:e.name,value:e.value}})};var y=/[^a-zA-Z0-9 '(),+.\/:=?-]/,v=/[^\x00-\x7f]/;function b(e,t){if("**"===e||"**"===t)return!0;var n=e.split("."),r=t.split(".");if(n.length!==r.length)return!1;for(var i=0;i0;){var o;if(null!==(o=/^,/.exec(i)))t[++n]="",i=i.slice(o[0].length);else if(null!==(o=/^\\,/.exec(i)))t[n]+=",",i=i.slice(o[0].length);else if(null!==(o=/^\\./.exec(i)))t[n]+=o[0],i=i.slice(o[0].length);else{if(null===(o=/^[^\\,]+/.exec(i)))throw new Error("Failed to parse DN");t[n]+=o[0],i=i.slice(o[0].length)}}var s=t.map(function(e){e=e.trim();for(var t=e.indexOf("=");t>0&&"\\"===e.charAt(t-1);)t=e.indexOf("=",t+1);if(-1===t)throw new Error("Failed to parse DN");var n=e.slice(0,t).toLowerCase().replace(/\\=/g,"="),r=e.slice(t+1);return{name:n,value:r}});return new g({components:s})},g.fromArray=function(e){return r.arrayOfObject(e,"components"),e.forEach(function(e){if(r.object(e,"component"),r.string(e.name,"component.name"),!f.isBuffer(e.value)&&"string"!=typeof e.value)throw new Error("Invalid component value")}),new g({components:e})},g.parseAsn1=function(e,t){var n=[];e.readSequence(t);for(var r=e.offset+e.length;e.offset= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=h-f,S=Math.floor,x=String.fromCharCode,C;function A(e){throw new RangeError(k[e])}function T(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function I(e,t){var n=e.split("@"),r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(w,".");var i=e.split("."),o=T(i,t).join(".");return r+o}function j(e){for(var t=[],n=0,r=e.length,i,o;n=55296&&i<=56319&&n65535&&(e-=65536,t+=x(e>>>10&1023|55296),e=56320|1023&e),t+=x(e),t}).join("")}function B(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:h}function O(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function P(e,t,n){var r=0;for(e=n?S(e/m):e>>1,e+=S(e/t);e>E*p>>1;r+=h)e=S(e/E);return S(r+(E+1)*e/(e+d))}function N(e){var t=[],n=e.length,r,i=0,o=y,s=g,a,l,u,d,m,b,_,w,k;for(a=e.lastIndexOf(v),a<0&&(a=0),l=0;l=128&&A("not-basic"),t.push(e.charCodeAt(l));for(u=a>0?a+1:0;u=n&&A("invalid-input"),_=B(e.charCodeAt(u++)),(_>=h||_>S((c-i)/m))&&A("overflow"),i+=_*m,w=b<=s?f:b>=s+p?p:b-s,!(_S(c/k)&&A("overflow"),m*=k;r=t.length+1,s=P(i-d,r,0==d),S(i/r)>c-o&&A("overflow"),o+=S(i/r),i%=r,t.splice(i++,0,o)}return R(t)}function D(e){var t,n,r,i,o,s,a,l,u,d,m,b=[],_,w,k,E;for(e=j(e),_=e.length,t=y,n=0,o=g,s=0;s<_;++s)m=e[s],m<128&&b.push(x(m));for(r=i=b.length,i&&b.push(v);r<_;){for(a=c,s=0;s<_;++s)m=e[s],m>=t&&mS((c-n)/w)&&A("overflow"),n+=(a-t)*w,t=a,s=0;s<_;++s)if(m=e[s],mc&&A("overflow"),m==t){for(l=n,u=h;d=u<=o?f:u>=o+p?p:u-o,!(le.toJSON()),size:this.size})),Object.assign({},this._json)}toString(){return`DAGNode `}get data(){return this._data}set data(e){throw new Error("Can't set property: 'data' is immutable")}get links(){return this._links}set links(e){throw new Error("Can't set property: 'links' is immutable")}get size(){return void 0===this._size&&(this._size=this.links.reduce((e,t)=>e+t.size,this._serializedSize)),this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}}t=e.exports=o(s,{className:"DAGNode",symbolName:"@ipld/js-ipld-dag-pb/dagnode"}),t.create=n(193),t.clone=n(742),t.addLink=n(743),t.rmLink=n(744)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(728),{serialize:i}=n(194),o=n(195),s=o.linkSort,a=n(192),l=n(96);function u(e,n,o){if("function"==typeof e?(o=e,e=void 0):"string"==typeof e&&(e=t.from(e)),"function"==typeof n&&(o=n,n=[]),!t.isBuffer(e))return o(new Error("Passed 'data' is not a buffer or a string!"));n=n.map(e=>l.isDAGLink(e)?e:l.util.createDagLinkFromB58EncodedHash(e)),n=r(n,s),i({data:e,links:n},(t,r)=>t?o(t):o(null,new a(e,n,r.length)))}e.exports=u}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(9),o=n(57),s=o(n(739)),a=n(366),l=n(96),u=n(192),c=n(56),h=n(10),f=n(20);function p(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};const o=t.hashAlg||a.defaultHashAlg;let s=t.version;void 0===s&&(s="sha2-256"===o?0:1),h([t=>{if(r.isBuffer(e))return t(null,e);d(e,t)},(e,t)=>c(e,o,t),(e,t)=>t(null,new i(s,a.multicodec,e))],n)}function d(e,t){let n,{data:r,links:i=[]}=e;!u.isDAGNode(e)&&i&&(i=i.map(e=>l.isDAGLink(e)?e:l.util.createDagLinkFromB58EncodedHash(e)));try{n=s.PBNode.encode(g({data:r,links:i}))}catch(e){return t(e)}t(null,n)}function m(e,t){const n=s.PBNode.decode(e),i=n.Links.map(e=>new l(e.Name,e.Tsize,e.Hash)),o=null==n.Data?r.alloc(0):n.Data;f(()=>t(null,new u(o,i,e.length)))}function g(e){const t={};return e.data&&e.data.length>0?t.Data=e.data:t.Data=null,e.links&&e.links.length>0?t.Links=e.links.map(e=>({Hash:e.cid.buffer,Name:e.name,Tsize:e.size})):t.Links=null,t}t=e.exports,t.serialize=d,t.deserialize=m,t.cid=p}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(96),{cid:o}=n(194);function s(e){let t;return e.data&&e.data.length>0?(t=r.alloc(e.data.length),e.data.copy(t)):t=r.alloc(0),t}function a(e){return e.links.slice()}function l(e,t){return r.compare(e.nameAsBuffer,t.nameAsBuffer)}function u(e,t,n){"function"==typeof t&&(n=t,t={}),o(e,t,(r,o)=>{if(r)return n(r);n(null,new i(t.name||"",e.size,o))})}t=e.exports,t.cloneData=s,t.cloneLinks=a,t.linkSort=l,t.toDAGLink=u}).call(this,n(0).Buffer)},function(e,t,n){var r=n(21);function i(e,t){var n=function(){return new r.aes.Algorithm(e,t)};r.cipher.registerAlgorithm(e,n)}n(370),n(371),n(30),e.exports=r.aes=r.aes||{},r.aes.startEncrypting=function(e,t,n,r){var i=m({key:e,output:n,decrypt:!1,mode:r});return i.start(t),i},r.aes.createEncryptionCipher=function(e,t){return m({key:e,output:null,decrypt:!1,mode:t})},r.aes.startDecrypting=function(e,t,n,r){var i=m({key:e,output:n,decrypt:!0,mode:r});return i.start(t),i},r.aes.createDecryptionCipher=function(e,t){return m({key:e,output:null,decrypt:!0,mode:t})},r.aes.Algorithm=function(e,t){o||f();var n=this;n.name=e,n.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return d(n._w,e,t,!1)},decrypt:function(e,t){return d(n._w,e,t,!0)}}}),n._init=!1},r.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t=e.key,n;if("string"!=typeof t||16!==t.length&&24!==t.length&&32!==t.length){if(r.util.isArray(t)&&(16===t.length||24===t.length||32===t.length)){n=t,t=r.util.createBuffer();for(var i=0;i>>=2;for(var i=0;i>8^255&p^99,a[n]=p,l[p]=n,d=e[p],i=e[n],s=e[i],f=e[s],m=d<<24^p<<16^p<<8^p^d,g=(i^s^f)<<24^(n^f)<<16^(n^s^f)<<8^n^i^f;for(var y=0;y<4;++y)c[y][n]=m,h[y][p]=g,m=m<<24|m>>>8,g=g<<24|g>>>8;0===n?n=r=1:(n=i^e[e[e[i^f]]],r^=e[e[r]])}}function p(e,t){for(var n=e.slice(0),r,i=1,o=n.length,l=o+6+1,c=s*l,f=o;f>>16&255]<<24^a[r>>>8&255]<<16^a[255&r]<<8^a[r>>>24]^u[i]<<24,i++):o>6&&f%o==4&&(r=a[r>>>24]<<24^a[r>>>16&255]<<16^a[r>>>8&255]<<8^a[255&r]),n[f]=n[f-o]^r;if(t){var p,d=h[0],m=h[1],g=h[2],y=h[3],v=n.slice(0);c=n.length;for(var f=0,b=c-s;f>>24]]^m[a[p>>>16&255]]^g[a[p>>>8&255]]^y[a[255&p]];n=v}return n}function d(e,t,n,r){var i=e.length/4-1,o,s,u,f,p,d,m,g,y,v,b,_;r?(o=h[0],s=h[1],u=h[2],f=h[3],p=l):(o=c[0],s=c[1],u=c[2],f=c[3],p=a),d=t[0]^e[0],m=t[r?3:1]^e[1],g=t[2]^e[2],y=t[r?1:3]^e[3];for(var w=3,k=1;k>>24]^s[m>>>16&255]^u[g>>>8&255]^f[255&y]^e[++w],b=o[m>>>24]^s[g>>>16&255]^u[y>>>8&255]^f[255&d]^e[++w],_=o[g>>>24]^s[y>>>16&255]^u[d>>>8&255]^f[255&m]^e[++w],y=o[y>>>24]^s[d>>>16&255]^u[m>>>8&255]^f[255&g]^e[++w],d=v,m=b,g=_;n[0]=p[d>>>24]<<24^p[m>>>16&255]<<16^p[g>>>8&255]<<8^p[255&y]^e[++w],n[r?3:1]=p[m>>>24]<<24^p[g>>>16&255]<<16^p[y>>>8&255]<<8^p[255&d]^e[++w],n[2]=p[g>>>24]<<24^p[y>>>16&255]<<16^p[d>>>8&255]<<8^p[255&m]^e[++w],n[r?1:3]=p[y>>>24]<<24^p[d>>>16&255]<<16^p[m>>>8&255]<<8^p[255&g]^e[++w]}function m(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),n="AES-"+t,i;i=e.decrypt?r.cipher.createDecipher(n,e.key):r.cipher.createCipher(n,e.key);var o=i.start;return i.start=function(e,t){var n=null;t instanceof r.util.ByteBuffer&&(n=t,t={}),t=t||{},t.output=n,t.iv=e,o.call(i,t)},i}},function(e,t,n){"use strict";var r=n(5).Buffer,i=n(799),o;function s(){this.negative=0,this.words=null,this.length=0}s.fromNumber=function(e){var t=new s;return t.words=[67108863&e],t.length=1,t},s.fromBuffer=function(e){var t=new s;return t.words=new Array(10),t.words[0]=(3&e[28])<<24|e[29]<<16|e[30]<<8|e[31],t.words[1]=(15&e[25])<<22|e[26]<<14|e[27]<<6|e[28]>>>2,t.words[2]=(63&e[22])<<20|e[23]<<12|e[24]<<4|e[25]>>>4,t.words[3]=(255&e[19])<<18|e[20]<<10|e[21]<<2|e[22]>>>6,t.words[4]=(3&e[15])<<24|e[16]<<16|e[17]<<8|e[18],t.words[5]=(15&e[12])<<22|e[13]<<14|e[14]<<6|e[15]>>>2,t.words[6]=(63&e[9])<<20|e[10]<<12|e[11]<<4|e[12]>>>4,t.words[7]=(255&e[6])<<18|e[7]<<10|e[8]<<2|e[9]>>>6,t.words[8]=(3&e[2])<<24|e[3]<<16|e[4]<<8|e[5],t.words[9]=e[0]<<14|e[1]<<6|e[2]>>>2,t.length=10,t.strip()},s.prototype.toBuffer=function(){for(var e=this.words,t=this.length;t<10;++t)e[t]=0;return r.from([e[9]>>>14&255,e[9]>>>6&255,(63&e[9])<<2|e[8]>>>24&3,e[8]>>>16&255,e[8]>>>8&255,255&e[8],e[7]>>>18&255,e[7]>>>10&255,e[7]>>>2&255,(3&e[7])<<6|e[6]>>>20&63,e[6]>>>12&255,e[6]>>>4&255,(15&e[6])<<4|e[5]>>>22&15,e[5]>>>14&255,e[5]>>>6&255,(63&e[5])<<2|e[4]>>>24&3,e[4]>>>16&255,e[4]>>>8&255,255&e[4],e[3]>>>18&255,e[3]>>>10&255,e[3]>>>2&255,(3&e[3])<<6|e[2]>>>20&63,e[2]>>>12&255,e[2]>>>4&255,(15&e[2])<<4|e[1]>>>22&15,e[1]>>>14&255,e[1]>>>6&255,(63&e[1])<<2|e[0]>>>24&3,e[0]>>>16&255,e[0]>>>8&255,255&e[0]])},s.prototype.clone=function(){var e=new s;e.words=new Array(this.length);for(var t=0;t1&&0==(0|this.words[this.length-1]);)this.length--;return this},s.prototype.normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.ucmp=function(e){if(this.length!==e.length)return this.length>e.length?1:-1;for(var t=this.length-1;t>=0;--t)if(this.words[t]!==e.words[t])return this.words[t]>e.words[t]?1:-1;return 0},s.prototype.gtOne=function(){return this.length>1||this.words[0]>1},s.prototype.isOverflow=function(){return this.ucmp(s.n)>=0},s.prototype.isHigh=function(){return 1===this.ucmp(s.nh)},s.prototype.bitLengthGT256=function(){return this.length>10||10===this.length&&this.words[9]>4194303},s.prototype.iuaddn=function(e){this.words[0]+=e;for(var t=0;this.words[t]>67108863&&te.length?(t=this,n=e):(t=e,n=this);for(var r=0,i=0;r>>26}for(;0!==i&&r>>26;if(this.length=t.length,0!==i)this.words[this.length++]=i;else if(t!==this)for(;r0?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;i>26,this.words[i]=67108863&s}for(;0!==o&&i>26,this.words[i]=67108863&s;if(0===o&&i>>26,c=67108863&s,h=Math.max(0,a-e.length+1),f=Math.min(a,t.length-1);h<=f;h++){var p=a-h,d=e.words[p],m=t.words[h],g=d*m+c;u+=g/67108864|0,c=67108863&g}n.words[a]=c,s=u}return 0!==s&&(n.words[n.length++]=s),n.strip()},s.umulTo10x10=Math.imul?i.umulTo10x10:s.umulTo,s.umulnTo=function(e,t,n){if(0===t)return n.words=[0],n.length=1,n;for(var r=0,i=0;r0?(n.words[r]=i,n.length=e.length+1):n.length=e.length,n},s.prototype.umul=function(e){var t=new s;return t.words=new Array(this.length+e.length),10===this.length&&10===e.length?s.umulTo10x10(this,e,t):1===this.length?s.umulnTo(e,this.words[0],t):1===e.length?s.umulnTo(this,e.words[0],t):s.umulTo(this,e,t)},s.prototype.isplit=function(e){e.length=Math.min(this.length,9);for(var t=0;t>>22,n=r}return n>>>=22,this.words[t-10]=n,0===n&&this.length>10?this.length-=10:this.length-=9,this},s.prototype.fireduce=function(){return this.isOverflow()&&this.isub(s.n),this},s.prototype.ureduce=function(){var e=this.clone().isplit(s.tmp).umul(s.nc).iadd(s.tmp);return e.bitLengthGT256()&&(e=e.isplit(s.tmp).umul(s.nc).iadd(s.tmp),e.bitLengthGT256()&&(e=e.isplit(s.tmp).umul(s.nc).iadd(s.tmp))),e.fireduce()},s.prototype.ishrn=function(e){for(var t=(1<=0;--r){var o=this.words[r];this.words[r]=i<>>e,i=o&t}return this.length>1&&0===this.words[this.length-1]&&(this.length-=1),this},s.prototype.uinvm=function(){for(var e=this.clone(),t=s.n.clone(),n=s.fromNumber(1),r=s.fromNumber(0),i=s.fromNumber(0),o=s.fromNumber(1);e.isEven()&&t.isEven();){for(var a=1,l=1;0==(e.words[0]&l)&&0==(t.words[0]&l)&&a<26;++a,l<<=1);e.ishrn(a),t.ishrn(a)}for(var u=t.clone(),c=e.clone();!e.isZero();){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.ishrn(h);h-- >0;)(n.isOdd()||r.isOdd())&&(n.iadd(u),r.isub(c)),n.ishrn(1),r.ishrn(1);for(var p=0,d=1;0==(t.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(t.ishrn(p);p-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(u),o.isub(c)),i.ishrn(1),o.ishrn(1);e.ucmp(t)>=0?(e.isub(t),n.isub(i),r.isub(o)):(t.isub(e),i.isub(n),o.isub(r))}if(1===i.negative){i.negative=0;var m=i.ureduce();return m.negative^=1,m.normSign().iadd(s.n)}return i.ureduce()},s.prototype.imulK=function(){this.words[this.length]=0,this.words[this.length+1]=0,this.length+=2;for(var e=0,t=0;e0?this.isub(s.p):this.strip(),this},s.prototype.redNeg=function(){return this.isZero()?s.fromNumber(0):s.p.sub(this)},s.prototype.redAdd=function(e){return this.clone().redIAdd(e)},s.prototype.redIAdd=function(e){return this.iadd(e),this.ucmp(s.p)>=0&&this.isub(s.p),this},s.prototype.redIAdd7=function(){return this.iuaddn(7),this.ucmp(s.p)>=0&&this.isub(s.p),this},s.prototype.redSub=function(e){return this.clone().redISub(e)},s.prototype.redISub=function(e){return this.isub(e),0!==this.negative&&this.iadd(s.p),this},s.prototype.redMul=function(e){return this.umul(e).redIReduce()},s.prototype.redSqr=function(){return this.umul(this).redIReduce()},s.prototype.redSqrt=function(){if(this.isZero())return this.clone();for(var e=this.redSqr(),t=e.redSqr(),n=t.redSqr().redMul(t),r=n.redMul(e),i=r.redMul(this),o=i,s=0;s<54;++s)o=o.redSqr().redSqr().redSqr().redSqr().redMul(i);for(o=o.redSqr().redSqr().redSqr().redSqr().redMul(r),s=0;s<5;++s)o=o.redSqr().redSqr().redSqr().redSqr().redMul(i);return o=o.redSqr().redSqr().redSqr().redSqr().redMul(n),o=o.redSqr().redSqr().redSqr().redSqr().redSqr().redSqr().redMul(n),0===o.redSqr().ucmp(this)?o:null},s.prototype.redInvm=function(){for(var e=this.clone(),t=s.p.clone(),n=s.fromNumber(1),r=s.fromNumber(0),i;e.gtOne()&&t.gtOne();){for(var o=0,a=1;0==(e.words[0]&a)&&o<26;++o,a<<=1);if(o>0)for(e.ishrn(o);o-- >0;)n.isOdd()&&n.iadd(s.p),n.ishrn(1);for(var l=0,u=1;0==(t.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(t.ishrn(l);l-- >0;)r.isOdd()&&r.iadd(s.p),r.ishrn(1);e.ucmp(t)>=0?(e.isub(t),n.isub(r)):(t.isub(e),r.isub(n))}return i=1===e.length&&1===e.words[0]?n:r,0!==i.negative&&i.iadd(s.p),0!==i.negative?(i.negative=0,i.redIReduce().redNeg()):i.redIReduce()},s.prototype.getNAF=function(e){for(var t=[],n=1<>1,o=this.clone();!o.isZero();){for(var s=0,a=1;0==(o.words[0]&a)&&s<26;++s,a<<=1)t.push(0);if(0!==s)o.ishrn(s);else{var l=o.words[0]&r;if(l>=i)t.push(i-l),o.iuaddn(l-i).ishrn(1);else if(t.push(l),o.words[0]-=l,!o.isZero()){for(s=e-1;s>0;--s)t.push(0);o.ishrn(e)}}}return t},s.prototype.inspect=function(){if(this.isZero())return"0";for(var e=this.toBuffer().toString("hex"),t=0;"0"===e[t];++t);return e.slice(t)},s.n=s.fromBuffer(r.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","hex")),s.nh=s.n.clone().ishrn(1),s.nc=s.fromBuffer(r.from("000000000000000000000000000000014551231950B75FC4402DA1732FC9BEBF","hex")),s.p=s.fromBuffer(r.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","hex")),s.psn=s.p.sub(s.n),s.tmp=new s,s.tmp.words=new Array(10),o=s.fromNumber(1),o.words[3]=0,e.exports=s},function(e,t){t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n",t.homedir=function(){return"/"}},function(e,t,n){var r=n(5).Buffer;function i(e){r.isBuffer(e)||(e=r.from(e));for(var t=e.length/4|0,n=new Array(t),i=0;i>>24]^s[c>>>16&255]^a[h>>>8&255]^l[255&f]^t[y++],d=o[c>>>24]^s[h>>>16&255]^a[f>>>8&255]^l[255&u]^t[y++],m=o[h>>>24]^s[f>>>16&255]^a[u>>>8&255]^l[255&c]^t[y++],g=o[f>>>24]^s[u>>>16&255]^a[c>>>8&255]^l[255&h]^t[y++],u=p,c=d,h=m,f=g;return p=(r[u>>>24]<<24|r[c>>>16&255]<<16|r[h>>>8&255]<<8|r[255&f])^t[y++],d=(r[c>>>24]<<24|r[h>>>16&255]<<16|r[f>>>8&255]<<8|r[255&u])^t[y++],m=(r[h>>>24]<<24|r[f>>>16&255]<<16|r[u>>>8&255]<<8|r[255&c])^t[y++],g=(r[f>>>24]<<24|r[u>>>16&255]<<16|r[c>>>8&255]<<8|r[255&h])^t[y++],p>>>=0,d>>>=0,m>>>=0,g>>>=0,[p,d,m,g]}var a=[0,1,2,4,8,16,32,64,128,27,54],l=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var n=[],r=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,l=0;l<256;++l){var u=a^a<<1^a<<2^a<<3^a<<4;u=u>>>8^255&u^99,n[s]=u,r[u]=s;var c=e[s],h=e[c],f=e[h],p=257*e[u]^16843008*u;i[0][s]=p<<24|p>>>8,i[1][s]=p<<16|p>>>16,i[2][s]=p<<8|p>>>24,i[3][s]=p,p=16843009*f^65537*h^257*c^16843008*s,o[0][u]=p<<24|p>>>8,o[1][u]=p<<16|p>>>16,o[2][u]=p<<8|p>>>24,o[3][u]=p,0===s?s=a=1:(s=c^e[e[e[f^c]]],a^=e[e[a]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:o}}();function u(e){this._key=i(e),this._reset()}u.blockSize=16,u.keySize=32,u.prototype.blockSize=u.blockSize,u.prototype.keySize=u.keySize,u.prototype._reset=function(){for(var e=this._key,t=e.length,n=t+6,r=4*(n+1),i=[],o=0;o>>24,s=l.SBOX[s>>>24]<<24|l.SBOX[s>>>16&255]<<16|l.SBOX[s>>>8&255]<<8|l.SBOX[255&s],s^=a[o/t|0]<<24):t>6&&o%t==4&&(s=l.SBOX[s>>>24]<<24|l.SBOX[s>>>16&255]<<16|l.SBOX[s>>>8&255]<<8|l.SBOX[255&s]),i[o]=i[o-t]^s}for(var u=[],c=0;c>>24]]^l.INV_SUB_MIX[1][l.SBOX[f>>>16&255]]^l.INV_SUB_MIX[2][l.SBOX[f>>>8&255]]^l.INV_SUB_MIX[3][l.SBOX[255&f]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=u},u.prototype.encryptBlockRaw=function(e){return e=i(e),s(e,this._keySchedule,l.SUB_MIX,l.SBOX,this._nRounds)},u.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),n=r.allocUnsafe(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[1],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[3],12),n},u.prototype.decryptBlock=function(e){e=i(e);var t=e[1];e[1]=e[3],e[3]=t;var n=s(e,this._invKeySchedule,l.INV_SUB_MIX,l.INV_SBOX,this._nRounds),o=r.allocUnsafe(16);return o.writeUInt32BE(n[0],0),o.writeUInt32BE(n[3],4),o.writeUInt32BE(n[2],8),o.writeUInt32BE(n[1],12),o},u.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},e.exports.AES=u},function(e,t,n){"use strict";(function(t){const r=n(70),i=n(27),o=n(60),s=n(22),a=n(72),l=n(826),u=/^https?:\/\/[^/]+\/(ip(f|n)s)\/((\w+).*)/,c=/^\/(ip(f|n)s)\/((\w+).*)/,h=1,f=4,p=/^https?:\/\/([^/]+)\.(ip(?:f|n)s)\.[^/]+/,d=1,m=2;function g(e){const n=S(e);try{const e=t.from(r.decode(n));return i.decode(e),!0}catch(e){return!1}}function y(e){try{return o.isEncoded(e)}catch(e){return!1}}function v(e){try{return new l(e),!0}catch(e){return!1}}function b(e){if(!e)return!1;if(s.isMultiaddr(e))return!0;try{return new s(e),!0}catch(e){return!1}}function _(e){return b(e)&&a.IPFS.matches(e)}function w(e,t,n=h,r=f){const i=S(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipfs"!==o[n])return!1;let s=o[r];return s&&t===p&&(s=s.toLowerCase()),v(s)}function k(e,t,n=h,r){const i=S(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipns"!==o[n])return!1;if(r&&t===p){let e=o[r];return e=e.toLowerCase(),v(e)}return!0}function E(e){return"string"==typeof e}function S(e){return t.isBuffer(e)?r.encode(e):!!E(e)&&e}const x=e=>w(e,p,2,1),C=e=>k(e,p,2,1);e.exports={multihash:g,multiaddr:b,peerMultiaddr:_,cid:v,base32cid:e=>"base32"===y(e)&&v(e),ipfsSubdomain:x,ipnsSubdomain:C,subdomain:e=>x(e)||C(e),subdomainPattern:p,ipfsUrl:e=>w(e,u),ipnsUrl:e=>k(e,u),url:e=>w(e,u)||k(e,u),urlPattern:u,ipfsPath:e=>w(e,c),ipnsPath:e=>k(e,c),path:e=>w(e,c)||k(e,c),pathPattern:c,urlOrPath:e=>w(e,u)||k(e,u)||w(e,c)||k(e,c),cidPath:e=>E(e)&&!v(e)&&w(`/ipfs/${e}`,c)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(328),i=a(r),o=n(109),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default,1),e.exports=t.default},function(e,t,n){var r,i;r=this,e.exports=function(e,t,n,r,i){for(t=t.split?t.split("."):t,r=0;r{e.put(this.transform.convert(t),n)},delete:t=>{e.delete(this.transform.convert(t))},commit:t=>{e.commit(t)}}}query(e){return r(this.child.query(e),r.map(e=>(e.key=this.transform.invert(e.key),e)))}close(e){this.child.close(e)}}e.exports=i},function(e,t,n){"use strict";(function(t){const r=n(19),i=n(849),o=n(28).utils.asyncFilter,s=n(28).utils.asyncSort,a=n(28).Key,l=n(28).Errors,u=n(858);class c{constructor(e,t){let r;t&&t.db?(r=t.db,delete t.db):r=n(862),this.db=i(u(r(e),{valueEncoding:"binary"}),Object.assign({},t,{compression:!1}),e=>{if(e)throw e})}open(e){this.db.open(t=>{if(t)return e(l.dbOpenFailedError(t));e()})}put(e,t,n){this.db.put(e.toString(),t,e=>{if(e)return n(l.dbWriteFailedError(e));n()})}get(e,t){this.db.get(e.toString(),(e,n)=>{if(e)return t(l.notFoundError(e));t(null,n)})}has(e,t){this.db.get(e.toString(),(e,n)=>{if(e)return e.notFound?void t(null,!1):void t(e);t(null,!0)})}delete(e,t){this.db.del(e.toString(),e=>{if(e)return t(l.dbDeleteFailedError(e));t()})}close(e){this.db.close(e)}batch(){const e=[];return{put:(t,n)=>{e.push({type:"put",key:t.toString(),value:n})},delete:t=>{e.push({type:"del",key:t.toString()})},commit:t=>{this.db.batch(e,t)}}}query(e){let n=!0;null!=e.keysOnly&&(n=!e.keysOnly);const i=this.db.db.iterator({keys:!0,values:n,keyAsBuffer:!0}),l=(e,r)=>{if(e)return i.end(t=>{r(t||e)});i.next((e,o,s)=>{if(e)return r(e);if(null==e&&null==o&&null==s)return i.end(e=>{r(e||!0)});const l={key:new a(o,!1)};n&&(l.value=t.from(s)),r(null,l)})};let u=[l],c=[];if(null!=e.prefix){const t=e.prefix;c.push((e,n)=>n(null,e.key.toString().startsWith(t)))}if(null!=e.filters&&(c=c.concat(e.filters)),u=u.concat(c.map(e=>o(e))),null!=e.orders&&(u=u.concat(e.orders.map(e=>s(e)))),null!=e.offset){let t=0;u.push(r.filter(()=>t++>=e.offset))}return null!=e.limit&&u.push(r.take(e.limit)),r.apply(null,u)}}e.exports=c}).call(this,n(0).Buffer)},function(e,t){t.getCallback=function(e,t){return"function"==typeof e?e:t},t.getOptions=function(e){return"object"==typeof e&&null!==e?e:{}}},function(e,t,n){"use strict";const r=n(57),i=n(114),o=n(889),s=n(24),a=n(38),l=n(47),u=n(9),c=n(342),h=n(890),f=n(56),p=r(n(891)),d=n(892);class m{constructor(e){this.full=e,this.wantlist=new Map,this.blocks=new Map}get empty(){return 0===this.blocks.size&&0===this.wantlist.size}addEntry(e,t,n){s(e&&u.isCID(e),"must be a valid cid");const r=e.buffer.toString(),i=this.wantlist.get(r);i?(i.priority=t,i.cancel=Boolean(n)):this.wantlist.set(r,new d(e,t,n))}addBlock(e){s(i.isBlock(e),"must be a valid cid");const t=e.cid.buffer.toString();this.blocks.set(t,e)}cancel(e){s(u.isCID(e),"must be a valid cid");const t=e.buffer.toString();this.wantlist.delete(t),this.addEntry(e,0,!0)}serializeToBitswap100(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map(e=>({block:e.cid.buffer,priority:Number(e.priority),cancel:Boolean(e.cancel)}))},blocks:Array.from(this.blocks.values()).map(e=>e.data)};return this.full&&(e.wantlist.full=!0),p.Message.encode(e)}serializeToBitswap110(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map(e=>({block:e.cid.buffer,priority:Number(e.priority),cancel:Boolean(e.cancel)}))},payload:[]};return this.full&&(e.wantlist.full=!0),this.blocks.forEach(t=>{e.payload.push({prefix:t.cid.prefix,data:t.data})}),p.Message.encode(e)}equals(e){const t=(e,t)=>{if(e.equals&&"function"==typeof e.equals)return e.equals(t)};return!(this.full!==e.full||!o(this.wantlist,e.wantlist,t)||!o(this.blocks,e.blocks,t))}get[Symbol.toStringTag](){const e=Array.from(this.wantlist.keys()),t=Array.from(this.blocks.keys());return`BitswapMessage `}}m.deserialize=((e,t)=>{let n;try{n=p.Message.decode(e)}catch(e){return l(()=>t(e))}const r=n.wantlist&&n.wantlist.full||!1,o=new m(r);return n.wantlist&&n.wantlist.entries.forEach(e=>{let n;try{n=new u(e.block)}catch(e){return t(e)}o.addEntry(n,e.priority,e.cancel)}),n.blocks.length>0?a(n.blocks,(e,n)=>{f(e,"sha2-256",(r,s)=>{if(r)return n(r);let a;try{a=new u(s)}catch(r){return t(r)}o.addBlock(new i(e,a)),n()})},e=>{if(e)return t(e);t(null,o)}):n.payload.length>0?a(n.payload,(e,t)=>{if(!e.prefix||!e.data)return l(t);const n=h(e.prefix),r=n[0],s=n[1],a=n[2];f(e.data,a,(n,a)=>{if(n)return t(n);let l;try{l=new u(r,c[s.toString("16")],a)}catch(n){return t(n)}o.addBlock(new i(e.data,l)),t()})},e=>{if(e)return t(e);t(null,o)}):void t(null,o)}),m.Entry=d,e.exports=m},function(e,t,n){"use strict";const{sortBy:r}=n(100),i=n(893);class o{constructor(e){this.set=new Map,this._stats=e}get length(){return this.set.size}add(e,t){const n=e.buffer.toString(),r=this.set.get(n);r?(r.inc(),r.priority=t):(this.set.set(n,new i(e,t)),this._stats&&this._stats.push(null,"wantListSize",1))}remove(e){const t=e.buffer.toString(),n=this.set.get(t);n&&(n.dec(),n.hasRefs()||(this.set.delete(t),this._stats&&this._stats.push(null,"wantListSize",-1)))}removeForce(e){this.set.has(e)&&this.set.delete(e)}forEach(e){return this.set.forEach(e)}entries(){return this.set.entries()}sortedEntries(){return new Map(r(e=>e[1].key,Array.from(this.set.entries())))}contains(e){const t=e.buffer.toString();return this.set.get(t)}}o.Entry=i,e.exports=o},function(e,t,n){(function(r){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function l(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function u(){try{return window.localStorage}catch(e){}}t=e.exports=n(943),t.log=s,t.formatArgs=o,t.save=a,t.load=l,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:u(),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(l())}).call(this,n(3))},function(e,t){t.encode=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t},t.decode=function(e){for(var t={},n=e.split("&"),r=0,i=n.length;r=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function l(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function u(){try{return window.localStorage}catch(e){}}t=e.exports=n(960),t.log=s,t.formatArgs=o,t.save=a,t.load=l,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:u(),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(l())}).call(this,n(3))},function(e,t,n){var r=n(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,n){if("function"==typeof t)return a(e,null,t);t||(t={}),n=r(n||i);var l=e._writableState,u=e._readableState,c=t.readable||!1!==t.readable&&e.readable,h=t.writable||!1!==t.writable&&e.writable,f=function(){e.writable||p()},p=function(){h=!1,c||n.call(e)},d=function(){c=!1,h||n.call(e)},m=function(t){n.call(e,t?new Error("exited with error code: "+t):null)},g=function(t){n.call(e,t)},y=function(){return(!c||u&&u.ended)&&(!h||l&&l.ended)?void 0:n.call(e,new Error("premature close"))},v=function(){e.req.on("finish",p)};return o(e)?(e.on("complete",p),e.on("abort",y),e.req?v():e.on("request",v)):h&&!l&&(e.on("end",f),e.on("close",f)),s(e)&&e.on("exit",m),e.on("end",d),e.on("finish",p),!1!==t.error&&e.on("error",g),e.on("close",y),function(){e.removeListener("complete",p),e.removeListener("abort",y),e.removeListener("request",v),e.req&&e.req.removeListener("finish",p),e.removeListener("end",f),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("exit",m),e.removeListener("end",d),e.removeListener("error",g),e.removeListener("close",y)}};e.exports=a},function(e,t){var n=function(){};function r(e,t,n){var r=e.length;if(!r)return n(t);function i(){--r||n(t)}e.forEach(function(e){e?e(t,i):i()}),r||i()}e.exports=function(e){return function(t,n){!function i(){t?r(e,t,n):e.length?e[0]?e[0](null,function(t,o){t?(e.shift(),!0===t?i():r(e,t,n)):n(null,o)}):(e.shift(),i()):n(!0)}()}}},function(e,t,n){"use strict";e.exports=function(){var e,t;function n(n){if("function"!=typeof n)throw new Error("read must be function");if(e)throw new Error("already piped");if(e=n,t){var r=t;t=null,e.apply(null,r)}}function r(n,r){e?e(n,r):t=[n,r]}return{source:r,sink:n}}},function(e,t,n){"use strict";t.Listener=t.listener=n(1046),t.Dialer=t.dialer=n(1050),t.matchSemver=n(1051),t.matchExact=n(469)},function(e,t,n){"use strict";(function(r){const i=n(12),o=n(40),s=n(33),a=n(52),l=n(4);function u(){return(~~(1e9*Math.random())).toString(36)}function c(e,t){i(o(r.isBuffer(e)?[e]:[r.from(e)]),a.encode(),s((e,n)=>{if(e)return t(e);t(null,n[0])}))}function h(e){const t=u();function n(e){return n=>{Array.isArray(n)&&(n=n.join(" ")),e("(%s) %s",t,n)}}const r=n(l("mss:"+e));return r.error=n(l("mss:"+e+":error")),r}t=e.exports,t.writeEncoded=((e,t,n)=>{c(t,(t,r)=>{if(t)return n(t);e.write(r)})}),t.log={},t.log.dialer=(()=>h("dialer\t")),t.log.listener=(()=>h("listener\t"))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(13);e.exports={CONNECTION_FAILED:e=>r(e,"CONNECTION_FAILED"),DIAL_ABORTED:()=>r("Dial was aborted","DIAL_ABORTED"),ERR_BLACKLISTED:()=>r("Dial is currently blacklisted for this peer","ERR_BLACKLISTED"),DIAL_SELF:()=>r("A node cannot dial itself","DIAL_SELF"),INVALID_STATE_TRANSITION:e=>r(e,"INVALID_STATE_TRANSITION"),NO_TRANSPORTS_REGISTERED:()=>r("No transports registered, dial not possible","NO_TRANSPORTS_REGISTERED"),PROTECTOR_REQUIRED:()=>r("No protector provided with private network enforced","PROTECTOR_REQUIRED"),UNEXPECTED_END:()=>r("Unexpected end of input from reader.","UNEXPECTED_END"),maybeUnexpectedEnd:t=>!0===t?e.exports.UNEXPECTED_END():t}},function(e,t,n){var r=n(103),i=r(Object,"create");e.exports=i},function(e,t,n){var r=n(1085),i=n(1086),o=n(1087),s=n(1088),a=n(1089);function l(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{let u=a.cidVersion||i,c=a.hashAlg||o,h=a.codec||s;if(t.isBuffer(e)&&(u=1,h="raw"),"sha2-256"!==c&&(u=1),a.onlyHash)return r(e,{version:u,hashAlg:c},(t,n)=>{l(t,{cid:n,node:e})});n.put(e,{version:u,hashAlg:c,format:h},(t,n)=>{l(t,{cid:n,node:e})})};e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(1164),i=n(154),o=n(10),s=n(34),a=n(45),l=s.DAGLink,u=s.DAGNode,c=n(56),h=n(293),f=n(224),p=n(1165),d=n(12),m=n(344),g=n(74),y=n(1168),v=function(e){return new Promise((n,r)=>{c(e,"murmur3-128",(e,i)=>{if(e)r(e);else{const e=i.slice(2,10),r=e.length,o=t.alloc(r);for(let t=0;t{e(t.key,t.value,n)}),m(t))}flush(e,t,n,r){k(this._options,this._bucket,e,t,n,(e,t)=>{if(e)return r(e);this.multihash=t.cid.buffer,this.size=t.node.size,r(null,t)})}}function w(e,t){return new _(e,t)}function k(e,n,s,c,h,p){const d=n._children;let m=0;const g=[];function v(t,n,i){const o=r(n.toString(16).toUpperCase(),2,"0");if(y.isBucket(t))k(e,t,s,c,null,(e,{cid:t,node:n})=>{e?i(e):(g.push(new l(o,n.size,t)),i())});else{const e=t.value,n=o+t.key;g.push(new l(n,e.size,e.multihash)),i()}}function b(r,i){const l=t.from(d.bitField().reverse()),p=new a("hamt-sharded-directory",l);p.fanout=n.tableSize(),p.hashType=e.hashFn.code,o([e=>u.create(p.marshal(),r,e),(t,n)=>f(t,c,e,n),({cid:e,node:t},n)=>{const r={path:s,size:t.size,multihash:e.buffer};h&&h.push(r),n(null,{cid:e,node:t})}],i)}i(()=>m{const t=d.get(m);t?v(t,m,t=>{m++,e(t)}):(m++,e())},e=>{e?p(e):b(g,p)})}e.exports=w,e.exports.hashFn=v}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(e){const r=n(9);function i(e){const t={},n=e.split("-");switch(n.length){case 1:t.avgChunkSize=262144;break;case 2:t.avgChunkSize=o(n[1],"avg");break;case 4:t.minChunkSize=o(n[1],"min"),t.avgChunkSize=o(n[2],"avg"),t.maxChunkSize=o(n[3],"max");break;default:throw new Error('Incorrect chunker format (expected "rabin" "rabin-[avg]" or "rabin-[min]-[avg]-[max]"')}return t}function o(e,t){let n=parseInt(e);if(isNaN(n))throw new Error(`Chunker parameter ${t} must be an integer`);return n}t.normalizePath=(t=>e.isBuffer(t)?new r(t).toString():r.isCID(t)?t.toString():(0===t.indexOf("/ipfs/")&&(t=t.substring("/ipfs/".length)),"/"===t.charAt(t.length-1)&&(t=t.substring(0,t.length-1)),t)),t.parseChunkerString=(e=>{if(e){if(e.startsWith("size-")){const t=e.split("-")[1],n=parseInt(t);if(isNaN(n))throw new Error("Chunker parameter size must be an integer");return{chunker:"fixed",chunkerOptions:{maxChunkSize:n}}}if(e.startsWith("rabin"))return{chunker:"rabin",chunkerOptions:i(e)};throw new Error(`Unrecognized chunker option: ${e}`)}return{chunker:"fixed"}})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(28).Key,i={file:0,directory:1,"hamt-sharded-directory":1};e.exports={FILE_SEPARATOR:"/",MFS_ROOT_KEY:new r("/local/filesroot"),MAX_CHUNK_SIZE:262144,MAX_LINKS:174,FILE_TYPES:i}},function(e,t,n){"use strict";var r=n(1202),i="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-",o,s,a;function l(){a=!1}function u(e){if(e){if(e!==o){if(e.length!==i.length)throw new Error("Custom alphabet for shortid must be "+i.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter(function(e,t,n){return t!==n.lastIndexOf(e)});if(t.length)throw new Error("Custom alphabet for shortid must be "+i.length+" unique characters. These characters were not unique: "+t.join(", "));o=e,l()}}else o!==i&&(o=i,l())}function c(e){return u(e),o}function h(e){r.seed(e),s!==e&&(l(),s=e)}function f(){o||u(i);for(var e=o.split(""),t=[],n=r.nextValue(),s;e.length>0;)n=r.nextValue(),s=Math.floor(n*e.length),t.push(e.splice(s,1)[0]);return t.join("")}function p(){return a||(a=f(),a)}function d(e){var t=p();return t[e]}function m(){return o||i}e.exports={get:m,characters:c,seed:h,lookup:d,shuffled:p}},function(e,t,n){"use strict";(function(t){const r=n(45).unmarshal,{formatCid:i,toMfsPath:o,loadNode:s}=n(73),a=n(10),l=n(12),u=n(33),c=n(74),h=n(81),f=n(4)("ipfs:mfs:stat"),p={hash:!1,size:!1,withLocal:!1,cidBase:"base58btc"};e.exports=(e=>(function n(d,m,g){"function"==typeof m&&(g=m,m={}),m=Object.assign({},p,m),f(`Fetching stats for ${d}`),a([t=>o(e,d,t),({mfsPath:n,depth:o},a)=>{l(h(n,e.ipld,{maxDepth:o}),c((n,o)=>m.hash?o(null,{hash:i(n.cid,m.cidBase)}):m.size?o(null,{size:n.size}):void s(e,{cid:n.cid},(e,n)=>{if(e)return o(e);const{node:s,cid:a}=n;if(t.isBuffer(s))return o(null,{hash:i(a,m.cidBase),size:s.length,cumulativeSize:s.length,blocks:0,type:"file",local:void 0,sizeLocal:void 0,withLocality:!1});const l=r(s.data);let u=s.links.length;"file"===l.type&&(u=l.blockSizes.length),o(null,{hash:i(a,m.cidBase),size:l.fileSize()||0,cumulativeSize:s.size,blocks:u,type:l.type,local:void 0,sizeLocal:void 0,withLocality:!1})})),u((e,t)=>e?a(e):t.length?(f(`Stats for ${d}`,t[0]),a(null,t[0])):a(new Error(`${d} does not exist`))))}],g)}))}).call(this,n(0).Buffer)},function(e,t,n){t=e.exports=n(529),t.Stream=t,t.Readable=t,t.Writable=n(532),t.Duplex=n(104),t.Transform=n(535),t.PassThrough=n(1299)},function(e,t,n){var r=e.exports;r.encode=n(1520),r.decode=n(1521),r.byteLength=r.encodingLength=function(e){return r.encode(e).length}},function(e,t,n){"use strict";function r(e,t){for(var n=1,r=e.length,i=e[0],o=e[0],s=1;s>3;return e%8!=0&&t++,t}r.prototype.get=function(e){var t=e>>3;return t>e%8)},r.prototype.set=function(e,t){var n=e>>3;t||1===arguments.length?(this.buffer.length>e%8):n>e%8))},r.prototype._grow=function(e){if(this.buffer.length4294967295&&(o=1),t.writeUInt32BE(o,n),t.write(e.type,n+4,4,"ascii");var a=n+8;if(1===o&&(r.encode(e.length,t,a),a+=8),s.fullBoxes[i]&&(t.writeUInt32BE(e.flags||0,a),t.writeUInt8(e.version||0,a),a+=4),u[i]){var c=u[i];c.forEach(function(n){if(5===n.length){var r=e[n]||[];n=n.substr(0,4),r.forEach(function(e){l._encode(e,t,a),a+=l.encode.bytes})}else e[n]&&(l._encode(e[n],t,a),a+=l.encode.bytes)}),e.otherBoxes&&e.otherBoxes.forEach(function(e){l._encode(e,t,a),a+=l.encode.bytes})}else if(s[i]){var h=s[i].encode;h(e,t,a),a+=h.bytes}else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+i+"') or `buffer` must be set");var f=e.buffer;f.copy(t,a),a+=e.buffer.length}return l.encode.bytes=a-n,t},l.readHeaders=function(e,t,n){if(t=t||0,n=n||e.length,n-t<8)return 8;var i=e.readUInt32BE(t),o=e.toString("ascii",t+4,t+8),a=t+8,l,u;if(1===i){if(n-t<16)return 16;i=r.decode(e,a),a+=8}return s.fullBoxes[o]&&(l=e.readUInt8(a),u=16777215&e.readUInt32BE(a),a+=4),{length:i,headersLen:a-t,contentLen:i-(a-t),type:o,version:l,flags:u}},l.decode=function(e,t,n){t=t||0,n=n||e.length;var r=l.readHeaders(e,t,n);if(!r||r.length>n-t)throw new Error("Data too short");return l.decodeWithoutHeaders(r,e,t+r.headersLen,t+r.length)},l.decodeWithoutHeaders=function(e,t,n,r){n=n||0,r=r||t.length;var i=e.type,a={};if(u[i]){a.otherBoxes=[];for(var c=u[i],h=n;r-h>=8;){var f=l.decode(t,h,r);if(h+=f.length,c.indexOf(f.type)>=0)a[f.type]=f;else if(c.indexOf(f.type+"s")>=0){var p=f.type+"s",d=a[p]=a[p]||[];d.push(f)}else a.otherBoxes.push(f)}}else if(s[i]){var m=s[i].decode;a=m(t,n,r)}else a.buffer=o(t.slice(n,r));return a.length=e.length,a.contentLen=e.contentLen,a.type=e.type,a.version=e.version,a.flags=e.flags,a},l.encodingLength=function(e){var t=e.type,n=8;if(s.fullBoxes[t]&&(n+=4),u[t]){var r=u[t];r.forEach(function(t){if(5===t.length){var r=e[t]||[];t=t.substr(0,4),r.forEach(function(e){e.type=t,n+=l.encodingLength(e)})}else if(e[t]){var i=e[t];i.type=t,n+=l.encodingLength(i)}}),e.otherBoxes&&e.otherBoxes.forEach(function(e){n+=l.encodingLength(e)})}else if(s[t])n+=s[t].encodingLength(e);else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+t+"') or `buffer` must be set");n+=e.buffer.length}return n>4294967295&&(n+=8),e.length=n,n}},function(e,t,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)i(n,r)&&(e[r]=n[r])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var o={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var o=0;o0;--s){o=o.twice();var a=n.testBit(s),l=t.testBit(s);a!=l&&(o=o.add(a?this:i))}return o}function E(e,t,n){var r;r=e.bitLength()>n.bitLength()?e.bitLength()-1:n.bitLength()-1;for(var i=this.curve.getInfinity(),o=this.add(t);r>=0;)i=i.twice(),e.testBit(r)?i=n.testBit(r)?i.add(o):i.add(this):n.testBit(r)&&(i=i.add(t)),--r;return i}function S(e,t,n){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(n),this.infinity=new d(this,null,null),this.reducer=new i(this.q)}function x(){return this.q}function C(){return this.a}function A(){return this.b}function T(e){return e==this||this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)}function I(){return this.infinity}function j(e){return new o(this.q,e)}function R(e){this.reducer.reduce(e)}function B(e){switch(parseInt(e.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var t=(e.length-2)/2,n=e.substr(2,t),i=e.substr(t+2,t);return new d(this,this.fromBigInteger(new r(n,16)),this.fromBigInteger(new r(i,16)));default:return null}}function O(e){if(e.isInfinity())return"00";var t=e.getX().toBigInteger().toString(16),n=e.getY().toBigInteger().toString(16),r=this.getQ().toString(16).length;for(r%2!=0&&r++;t.length128){var t=this.q.shiftRight(e-64);-1==t.intValue()&&(this.r=r.ONE.shiftLeft(e).subtract(this.q))}return this.r},o.prototype.modMult=function(e,t){return this.modReduce(e.multiply(t))},o.prototype.modReduce=function(e){if(null!=this.getR()){for(var t=q.bitLength();e.bitLength()>t+1;){var n=e.shiftRight(t),i=e.subtract(n.shiftLeft(t));this.getR().equals(r.ONE)||(n=n.multiply(this.getR())),e=n.add(i)}for(;e.compareTo(q)>=0;)e=e.subtract(q)}else e=e.mod(q);return e},o.prototype.sqrt=function(){if(!this.q.testBit(0))throw"unsupported";if(this.q.testBit(1)){var e=new o(this.q,this.x.modPow(this.q.shiftRight(2).add(r.ONE),this.q));return e.square().equals(this)?e:null}var t=this.q.subtract(r.ONE),n=t.shiftRight(1);if(!this.x.modPow(n,this.q).equals(r.ONE))return null;var i=t.shiftRight(2),s=i.shiftLeft(1).add(r.ONE),a=this.x,l=modDouble(modDouble(a)),u,c;do{var h;do{h=new r(this.q.bitLength(),new SecureRandom)}while(h.compareTo(this.q)>=0||!h.multiply(h).subtract(l).modPow(n,this.q).equals(t));var f=this.lucasSequence(h,a,s);if(u=f[0],c=f[1],this.modMult(c,c).equals(l))return c.testBit(0)&&(c=c.add(q)),c=c.shiftRight(1),new o(q,c)}while(u.equals(r.ONE)||u.equals(t));return null},o.prototype.lucasSequence=function(e,t,n){for(var i=n.bitLength(),o=n.getLowestSetBit(),s=r.ONE,a=r.TWO,l=e,u=r.ONE,c=r.ONE,h=i-1;h>=o+1;--h)u=this.modMult(u,c),n.testBit(h)?(c=this.modMult(u,t),s=this.modMult(s,l),a=this.modReduce(l.multiply(a).subtract(e.multiply(u))),l=this.modReduce(l.multiply(l).subtract(c.shiftLeft(1)))):(c=u,s=this.modReduce(s.multiply(a).subtract(u)),l=this.modReduce(l.multiply(a).subtract(e.multiply(u))),a=this.modReduce(a.multiply(a).subtract(u.shiftLeft(1))));u=this.modMult(u,c),c=this.modMult(u,t),s=this.modReduce(s.multiply(a).subtract(u)),a=this.modReduce(l.multiply(a).subtract(e.multiply(u))),u=this.modMult(u,c);for(var h=1;h<=o;++h)s=this.modMult(s,a),a=this.modReduce(a.multiply(a).subtract(u.shiftLeft(1))),u=this.modMult(u,u);return[s,a]};var t={ECCurveFp:S,ECPointFp:d,ECFieldElementFp:o};e.exports=t},function(e,t,n){e.exports={read:g,readSSHPrivate:v,write:b};var r=n(25),i=n(84),o=n(29).Buffer,s=n(48),a=n(42),l=n(16),u=n(41),c=n(46),h=n(92),f=n(93),p=n(175),d=n(76),m;function g(e,t){return h.read(e,t)}var y="openssh-key-v1";function v(e,t,i){t=new p({buffer:t});var s=t.readCString();r.strictEqual(s,y,"bad magic string");var u=t.readString(),c=t.readString(),h=t.readBuffer(),g=t.readInt();if(1!==g)throw new Error("OpenSSH-format key file contains multiple keys: this is unsupported.");var v=t.readBuffer();if("public"===e)return r.ok(t.atEnd(),"excess bytes left after key"),f.read(v);var b=t.readBuffer();r.ok(t.atEnd(),"excess bytes left after key");var _=new p({buffer:h});switch(c){case"none":if("none"!==u)throw new Error('OpenSSH-format key uses KDF "none" but specifies a cipher other than "none"');break;case"bcrypt":var w=_.readBuffer(),k=_.readInt(),E=a.opensshCipherInfo(u);if(void 0===m&&(m=n(616)),"string"==typeof i.passphrase&&(i.passphrase=o.from(i.passphrase,"utf-8")),!o.isBuffer(i.passphrase))throw new d.KeyEncryptedError(i.filename,"OpenSSH");var S=new Uint8Array(i.passphrase),x=new Uint8Array(w),C=new Uint8Array(E.keySize+E.blockSize),A=m.pbkdf(S,S.length,x,x.length,C,C.length,k);if(0!==A)throw new Error("bcrypt_pbkdf function returned failure, parameters invalid");C=o.from(C);var T=C.slice(0,E.keySize),I=C.slice(E.keySize,E.keySize+E.blockSize),j=l.createDecipheriv(E.opensslName,T,I);j.setAutoPadding(!1);var R,B=[];for(j.once("error",function(e){if(-1!==e.toString().indexOf("bad decrypt"))throw new Error("Incorrect passphrase supplied, could not decrypt key");throw e}),j.write(b),j.end();null!==(R=j.read());)B.push(R);b=o.concat(B);break;default:throw new Error('OpenSSH-format key uses unknown KDF "'+c+'"')}t=new p({buffer:b});var O=t.readInt(),P=t.readInt();if(O!==P)throw new Error("Incorrect passphrase supplied, could not decrypt key");var N={},D=f.readInternal(N,"private",t.remainder());t.skip(N.consumed);var M=t.readString();return D.comment=M,D}function b(e,t){var i;i=c.isPrivateKey(e)?e.toPublic():e;var s="none",u="none",h=o.alloc(0),f={blockSize:8},d,g;if(void 0!==t&&(d=t.passphrase,"string"==typeof d&&(d=o.from(d,"utf-8")),void 0!==d&&(r.buffer(d,"options.passphrase"),r.optionalString(t.cipher,"options.cipher"),s=t.cipher,void 0===s&&(s="aes128-ctr"),f=a.opensshCipherInfo(s),u="bcrypt")),c.isPrivateKey(e)){g=new p({});var v=l.randomBytes(4).readUInt32BE(0);g.writeInt(v),g.writeInt(v),g.write(e.toBuffer("rfc4253")),g.writeString(e.comment||"");for(var b=1;g._offset%f.blockSize!=0;)g.writeChar(b++);g=g.toBuffer()}switch(u){case"none":break;case"bcrypt":var _=l.randomBytes(16),w=16,k=new p({});k.writeBuffer(_),k.writeInt(16),h=k.toBuffer(),void 0===m&&(m=n(616));var E=new Uint8Array(d),S=new Uint8Array(_),x=new Uint8Array(f.keySize+f.blockSize),C=m.pbkdf(E,E.length,S,S.length,x,x.length,16);if(0!==C)throw new Error("bcrypt_pbkdf function returned failure, parameters invalid");x=o.from(x);var A=x.slice(0,f.keySize),T=x.slice(f.keySize,f.keySize+f.blockSize),I=l.createCipheriv(f.opensslName,A,T);I.setAutoPadding(!1);var j,R=[];for(I.once("error",function(e){throw e}),I.write(g),I.end();null!==(j=I.read());)R.push(j);g=o.concat(R);break;default:throw new Error("Unsupported kdf "+u)}var B=new p({}),O;B.writeCString(y),B.writeString(s),B.writeString(u),B.writeBuffer(h),B.writeInt(1),B.writeBuffer(i.toBuffer("rfc4253")),g&&B.writeBuffer(g),B=B.toBuffer(),O=c.isPrivateKey(e)?"OPENSSH PRIVATE KEY":"OPENSSH PUBLIC KEY";var P=B.toString("base64"),N=P.length+P.length/70+18+16+2*O.length+10;B=o.alloc(N);var D=0;D+=B.write("-----BEGIN "+O+"-----\n",D);for(var M=0;MP.length&&(F=P.length),D+=B.write(P.slice(M,F),D),B[D++]=10,M=F}return D+=B.write("-----END "+O+"-----\n",D),B.slice(0,D)}},function(e,t,n){e.exports={DataError:n(1765),InvalidAccessError:n(1766),KeyFormatNotSupportedError:n(1767),CurrentlyNotSupportedError:n(1768),NotSupportedError:n(324),OperationError:n(1769),QuotaExceededError:n(1770),TypeMismatchError:n(1771)}},function(e,t,n){(function(r){const i=n(645),o=n(77),s=n(4)("dweb-transports:httptools"),a=n(106);let l;function u({concurrency:e}){l=a((e,t)=>{e.loopguard===("undefined"!=typeof window&&window.loopguard)?fetch(e.req).then(n=>{s("Fetch of %s succeeded",e.what),l.concurrency=Math.min(l.concurrency+1,l.running()+6),t(null),e.cb(null,n)}).catch(n=>{l.concurrency=Math.max(l.concurrency-1,6,l.running()-1),t(n),--e.count>0?(s("Retrying fetch of %s in %s ms: %s",e.what,e.ms,n.message),l.push(e)):(s("Requeued fetch of %s failed: %s",e.what,n.message),e.cb(n))}):s("Dropping fetch of %s as window changed from %s to %s",e.what,e.loopguard,window.loopguard)},e)}function c(e,t,n,r){return new Promise((i,o)=>{n=n||1,l.push({req:e,count:n,ms:t,what:r,loopguard:"undefined"!=typeof window&&window.loopguard,cb:(e,t)=>{e?o(e):i(t)}})})}async function h(e,t,n,r){let i,o="undefined"!=typeof window&&window.loopguard;for(n=n||1;n--&&o===("undefined"!=typeof window&&window.loopguard);)try{return await fetch(e)}catch(e){i=e,s("Delaying %s by %d ms because %s",r,t,e.message),await new Promise(e=>{setTimeout(()=>{e()},t)}),t=Math.floor(t*(1+Math.random()))}throw console.warn("loopfetch of",r,"failed"),o!==("undefined"!=typeof window&&window.loopguard)?(s("Looping exited because of page change %s",r),new Error("Looping exited because of page change "+r)):i}"undefined"==typeof fetch&&(fetch=i,Headers=fetch.Headers,Request=fetch.Request),httptools={},u({concurrency:6}),httptools.p_httpfetch=async function(e,t,{wantstream:n=!1,retries:i}={}){try{s("p_httpfetch: %s %o",e,t.headers.range||"");let a=new Request(e,t),l=await c(a,500,i,"fetching "+e);if(l.ok){let e=l.headers.get("Content-Type");return n?l.body:void 0!==e&&e.startsWith("application/json")?l.json():void 0!==e&&e.startsWith("text")?l.text():new r(await l.arrayBuffer())}throw new o.TransportError(`Transport Error ${e} ${l.status}: ${l.statusText}`)}catch(t){throw s("p_httpfetch failed: %s",t.message),t instanceof o.TransportError?t:new o.TransportError(`Transport error thrown by ${e}: ${t.message}`)}},httptools.p_GET=function(e,t={},n){"function"==typeof t&&(n=t,t={});let r=new Headers;(t.start||t.end)&&r.append("range",`bytes=${t.start||0}-${t.end<1/0?t.end:""}`);const i=void 0===t.retries?12:t.retries;let o={method:"GET",headers:r,mode:"cors",cache:t.noCache?"no-cache":"default",redirect:"follow",keepalive:!0};const a=httptools.p_httpfetch(e,o,{retries:i,wantstream:t.wantstream});if(!n)return a;a.then(e=>{try{n(null,e)}catch(e){s("Uncaught error %O",e)}}).catch(e=>n(e))},httptools.p_POST=function(e,t={},n){"function"==typeof t&&(n=t,t={});const r=void 0===t.retries?0:t.retries;let i={method:"POST",headers:{},body:t.data,mode:"cors",cache:"default",redirect:"follow",keepalive:!1};t.contenttype&&(i.headers["Content-Type"]=t.contenttype);const o=httptools.p_httpfetch(e,i,{retries:r});if(!n)return o;o.then(e=>n(null,e)).catch(e=>n(e))},t=e.exports=httptools}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){var r=(0,i.default)(e)?_:w;r(e,(0,v.default)(t),n)};var r=n(147),i=b(r),o=n(243),s=b(o),a=n(328),l=b(a),u=n(109),c=b(u),h=n(58),f=b(h),p=n(183),d=b(p),m=n(107),g=b(m),y=n(37),v=b(y);function b(e){return e&&e.__esModule?e:{default:e}}function _(e,t,n){n=(0,d.default)(n||f.default);var r=0,i=0,o=e.length;function a(e,t){e?n(e):++i!==o&&t!==s.default||n(null)}for(0===o&&n(null);r-1&&e%1==0&&e<=n}e.exports=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={},e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var r=n(58),i=p(r),o=n(183),s=p(o),a=n(655),l=p(a),u=n(107),c=p(u),h=n(243),f=p(h);function p(e){return e&&e.__esModule?e:{default:e}}function d(e){return function(t,n,r){if(r=(0,s.default)(r||i.default),e<=0||!t)return r(null);var o=(0,l.default)(t),a=!1,u=0,h=!1;function p(e,t){if(u-=1,e)a=!0,r(e);else{if(t===f.default||a&&u<=0)return a=!0,r(null);h||d()}}function d(){for(h=!0;u>2,r=(3&t[0])<<8|t[1],n?31===n?i*(r?NaN:Infinity):i*Math.pow(2,n-25)*(1024+r):5.960464477539063e-8*i*r},t.arrayBufferToBignumber=function(e){const t=e.byteLength;let n="";for(let r=0;r{const t=new Map,n=Object.keys(e),r=n.length;for(let i=0;ie*s+t),t.buildInt64=((e,n,i,s)=>{const a=t.buildInt32(e,n),l=t.buildInt32(i,s);return a>2097151?new r(a).times(o).plus(l):a*o+l}),t.writeHalf=function t(n,r){const i=e.allocUnsafe(4);i.writeFloatBE(r,0);const o=i.readUInt32BE(0);if(0!=(8191&o))return!1;var s=o>>16&32768;const a=o>>23&255,l=8388607&o;if(a>=113&&a<=142)s+=(a-112<<10)+(l>>13);else{if(!(a>=103&&a<113))return!1;if(l&(1<<126-a)-1)return!1;s+=l+8388608>>126-a}return n.writeUInt16BE(s,0),!0},t.keySorter=function(e,t){var n=e[0].byteLength,r=t[0].byteLength;return n>r?1:r>n?-1:e[0].compare(t[0])},t.isNegativeZero=(e=>0===e&&1/e<0),t.nextPowerOf2=(e=>{let t=0;if(e&&!(e&e-1))return e;for(;0!==e;)e>>=1,t+=1;return 1<=0||!o.gcd(t.n).equals(i.ONE));e=e.multiply(o.modPow(t.e,t.n)).mod(t.n);for(var s=e.mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(a)<0;)s=s.add(t.p);var l=s.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return l=l.multiply(o.modInverse(t.n)).mod(t.n),l};function d(e,t,n){var i=r.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=o-11,s}i.putByte(0),i.putByte(n);var a=o-3-e.length,l;if(0===n||1===n){l=0===n?0:255;for(var u=0;u0;){for(var c=0,h=r.random.getBytes(a),u=0;u1;){if(255!==s.getByte()){--s.read;break}++u}else if(2===l)for(u=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++u}var h=s.getByte();if(0!==h||u!==o-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function g(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};var o={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function a(){l(e.pBits,function(t,r){return t?n(t):(e.p=r,null!==e.q?u(t,e.q):void l(e.qBits,u))})}function l(e,t){r.prime.generateProbablePrime(e,o,t)}function u(t,r){if(t)return n(t);if(e.q=r,e.p.compareTo(e.q)<0){var o=e.p;e.p=e.q,e.q=o}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void a();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void l(e.qBits,u);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 l(e.qBits,u);var c=e.e.modInverse(e.phi);e.keys={privateKey:s.rsa.setPrivateKey(e.n,e.e,c,e.p,e.q,c.mod(e.p1),c.mod(e.q1),e.q.modInverse(e.p)),publicKey:s.rsa.setPublicKey(e.n,e.e)},n(null,e.keys)}"prng"in t&&(o.prng=t.prng),a()}function y(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var n=r.util.hexToBytes(t);return n.length>1&&(0===n.charCodeAt(0)&&0==(128&n.charCodeAt(1))||255===n.charCodeAt(0)&&128==(128&n.charCodeAt(1)))?n.substr(1):n}function v(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 b(e){return"undefined"!=typeof window&&"object"==typeof window.crypto&&"object"==typeof window.crypto.subtle&&"function"==typeof window.crypto.subtle[e]}function _(e){return"undefined"!=typeof window&&"object"==typeof window.msCrypto&&"object"==typeof window.msCrypto.subtle&&"function"==typeof window.msCrypto.subtle[e]}function w(e){for(var t=r.util.hexToBytes(e.toString(16)),n=new Uint8Array(t.length),i=0;i0;)h.putByte(0),--f;return h.putBytes(r.util.hexToBytes(c)),h.getBytes()},s.rsa.decrypt=function(e,t,n,o){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=s,a}var l=new i(r.util.createBuffer(e).toHex(),16);if(l.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=p(l,t,n),c=u.toString(16),h=r.util.createBuffer(),f=s-Math.ceil(c.length/2);f>0;)h.putByte(0),--f;return h.putBytes(r.util.hexToBytes(c)),!1!==o?m(h.getBytes(),t,n):h.getBytes()},s.rsa.createKeyPairGenerationState=function(e,t,n){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048,n=n||{};var o=n.prng||r.random,s={nextBytes:function(e){for(var t=o.getBytesSync(e.length),n=0;n>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},l.e.fromInt(l.eInt),l},s.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var n=new i(null);n.fromInt(30);for(var r=0,o=function(e,t){return e|t},l=+new Date,u,c=0;null===e.keys&&(t<=0||ch?e.pqState=0:e.num.isProbablePrime(v(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(a[r++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var p=e.e.modInverse(e.phi);e.keys={privateKey:s.rsa.setPrivateKey(e.n,e.e,p,e.p,e.q,p.mod(e.p1),p.mod(e.q1),e.q.modInverse(e.p)),publicKey:s.rsa.setPublicKey(e.n,e.e)}}u=+new Date,c+=u-l,l=u}return null!==e.keys},s.rsa.generateKeyPair=function(e,t,n,i){if(1===arguments.length?"object"==typeof e?(n=e,e=void 0):"function"==typeof e&&(i=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(i=t,t=void 0):"number"!=typeof t&&(n=t,t=void 0):(n=e,i=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof n&&(i=n,n=void 0):(i=n,n=t,t=void 0)),n=n||{},void 0===e&&(e=n.bits||2048),void 0===t&&(t=n.e||65537),!r.options.usePureJavaScript&&i&&e>=256&&e<=16384&&(65537===t||3===t)){if(b("generateKey")&&b("exportKey"))return window.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:w(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return window.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){i(e)}).then(function(e){if(e){var t=s.privateKeyFromAsn1(o.fromDer(r.util.createBuffer(e)));i(null,{privateKey:t,publicKey:s.setRsaPublicKey(t.n,t.e)})}});if(_("generateKey")&&_("exportKey")){var a=window.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:w(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return a.oncomplete=function(e){var t=e.target.result,n=window.msCrypto.subtle.exportKey("pkcs8",t.privateKey);n.oncomplete=function(e){var t=e.target.result,n=s.privateKeyFromAsn1(o.fromDer(r.util.createBuffer(t)));i(null,{privateKey:n,publicKey:s.setRsaPublicKey(n.n,n.e)})},n.onerror=function(e){i(e)}},void(a.onerror=function(e){i(e)})}}var l=s.rsa.createKeyPairGenerationState(e,t,n);if(!i)return s.rsa.stepKeyPairGenerationState(l,0),l.keys;g(l,n,i)},s.setRsaPublicKey=s.rsa.setPublicKey=function(e,t){var n={n:e,e:t,encrypt:function(e,t,i){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,n){return d(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return r.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var o=t.encode(e,n,!0);return s.rsa.encrypt(o,n,!0)},verify:function(e,t,r){"string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===r?r={verify:function(e,t){t=m(t,n,!0);var r=o.fromDer(t);return e===r.value[1].value}}:"NONE"!==r&&"NULL"!==r&&null!==r||(r={verify:function(e,t){return t=m(t,n,!0),e===t}});var i=s.rsa.decrypt(t,n,!0,!1);return r.verify(e,i,n.n.bitLength())}};return n},s.setRsaPrivateKey=s.rsa.setPrivateKey=function(e,t,n,i,o,a,l,u){var c={n:e,e:t,d:n,p:i,q:o,dP:a,dQ:l,qInv:u,decrypt:function(e,t,n){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=s.rsa.decrypt(e,c,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:m};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return r.pkcs1.decode_rsa_oaep(t,e,n)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,c,!1)},sign:function(e,t){var n=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:f},n=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},n=1);var r=t.encode(e,c.n.bitLength());return s.rsa.encrypt(r,c,n)}};return c},s.wrapRsaPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(e).getBytes())])},s.privateKeyFromAsn1=function(e){var t={},n=[],a,c,h,f,p,d,m,g;if(o.validate(e,l,t,n)&&(e=o.fromDer(r.util.createBuffer(t.privateKey))),t={},n=[],!o.validate(e,u,t,n)){var y=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw y.errors=n,y}return a=r.util.createBuffer(t.privateKeyModulus).toHex(),c=r.util.createBuffer(t.privateKeyPublicExponent).toHex(),h=r.util.createBuffer(t.privateKeyPrivateExponent).toHex(),f=r.util.createBuffer(t.privateKeyPrime1).toHex(),p=r.util.createBuffer(t.privateKeyPrime2).toHex(),d=r.util.createBuffer(t.privateKeyExponent1).toHex(),m=r.util.createBuffer(t.privateKeyExponent2).toHex(),g=r.util.createBuffer(t.privateKeyCoefficient).toHex(),s.setRsaPrivateKey(new i(a,16),new i(c,16),new i(h,16),new i(f,16),new i(p,16),new i(d,16),new i(m,16),new i(g,16))},s.privateKeyToAsn1=s.privateKeyToRSAPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.qInv))])},s.publicKeyFromAsn1=function(e){var t={},n=[];if(o.validate(e,h,t,n)){var a=o.derToOid(t.publicKeyOid);if(a!==s.oids.rsaEncryption){var l=new Error("Cannot read public key. Unknown OID.");throw l.oid=a,l}e=t.rsaPublicKey}if(n=[],!o.validate(e,c,t,n)){var l=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw l.errors=n,l}var u=r.util.createBuffer(t.publicKeyModulus).toHex(),f=r.util.createBuffer(t.publicKeyExponent).toHex();return s.setRsaPublicKey(new i(u,16),new i(f,16))},s.publicKeyToAsn1=s.publicKeyToSubjectPublicKeyInfo=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,[s.publicKeyToRSAPublicKey(e)])])},s.publicKeyToRSAPublicKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.e))])}},function(e,t,n){var r=n(21);if(n(196),n(117),n(252),n(97),n(152),n(373),n(253),n(118),n(752),n(250),n(30),void 0===i)var i=r.jsbn.BigInteger;var o=r.asn1,s=r.pki=r.pki||{};e.exports=s.pbe=r.pbe=r.pbe||{};var a=s.oids,l={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"}]},u={name:"PBES2Algorithms",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},c={name:"pkcs-12PbeParams",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"iterations"}]};function h(e,t){return e.start().update(t).digest().getBytes()}function f(e){var t;if(e){if(t=s.oids[o.derToOid(e)],!t){var n=new Error("Unsupported PRF OID.");throw n.oid=e,n.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],n}}else t="hmacWithSHA1";return p(t)}function p(e){var t=r.md;switch(e){case"hmacWithSHA224":t=r.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var n=new Error("Unsupported PRF algorithm.");throw n.algorithm=e,n.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],n}if(!(t&&e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function d(e,t,n,i){var a=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==i&&a.value.push(o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,r.util.hexToBytes(n.toString(16))),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids[i]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")])),a}s.encryptPrivateKeyInfo=function(e,t,n){n=n||{},n.saltSize=n.saltSize||8,n.count=n.count||2048,n.algorithm=n.algorithm||"aes128",n.prfAlgorithm=n.prfAlgorithm||"sha1";var i=r.random.getBytesSync(n.saltSize),l=n.count,u=o.integerToDer(l),c,h,f;if(0===n.algorithm.indexOf("aes")||"des"===n.algorithm){var m,g,y;switch(n.algorithm){case"aes128":c=16,m=16,g=a["aes128-CBC"],y=r.aes.createEncryptionCipher;break;case"aes192":c=24,m=16,g=a["aes192-CBC"],y=r.aes.createEncryptionCipher;break;case"aes256":c=32,m=16,g=a["aes256-CBC"],y=r.aes.createEncryptionCipher;break;case"des":c=8,m=8,g=a.desCBC,y=r.des.createEncryptionCipher;break;default:var v=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw v.algorithm=n.algorithm,v}var b="hmacWith"+n.prfAlgorithm.toUpperCase(),_=p(b),w=r.pkcs5.pbkdf2(t,i,l,c,_),k=r.random.getBytesSync(m),E=y(w);E.start(k),E.update(o.toDer(e)),E.finish(),f=E.output.getBytes();var S=d(i,u,c,b);h=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBES2).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBKDF2).getBytes()),S]),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(g).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,k)])])])}else{if("3des"!==n.algorithm){var v=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw v.algorithm=n.algorithm,v}c=24;var x=new r.util.ByteBuffer(i),w=s.pbe.generatePkcs12Key(t,x,1,l,c),k=s.pbe.generatePkcs12Key(t,x,2,l,c),E=r.des.createEncryptionCipher(w);E.start(k),E.update(o.toDer(e)),E.finish(),f=E.output.getBytes(),h=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,i),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,u.getBytes())])])}var C=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[h,o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,f)]);return C},s.decryptPrivateKeyInfo=function(e,t){var n=null,i={},a=[];if(!o.validate(e,l,i,a)){var u=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=a,u}var c=o.derToOid(i.encryptionOid),h=s.pbe.getCipher(c,i.encryptionParams,t),f=r.util.createBuffer(i.encryptedData);return h.update(f),h.finish()&&(n=o.fromDer(h.output)),n},s.encryptedPrivateKeyToPem=function(e,t){var n={type:"ENCRYPTED PRIVATE KEY",body:o.toDer(e).getBytes()};return r.pem.encode(n,{maxline:t})},s.encryptedPrivateKeyFromPem=function(e){var t=r.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var n=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw n.headerType=t.type,n}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return o.fromDer(t.body)},s.encryptRsaPrivateKey=function(e,t,n){if(n=n||{},!n.legacy){var i=s.wrapRsaPrivateKey(s.privateKeyToAsn1(e));return i=s.encryptPrivateKeyInfo(i,t,n),s.encryptedPrivateKeyToPem(i)}var a,l,u,c;switch(n.algorithm){case"aes128":a="AES-128-CBC",u=16,l=r.random.getBytesSync(16),c=r.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",u=24,l=r.random.getBytesSync(16),c=r.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",u=32,l=r.random.getBytesSync(16),c=r.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",u=24,l=r.random.getBytesSync(8),c=r.des.createEncryptionCipher;break;case"des":a="DES-CBC",u=8,l=r.random.getBytesSync(8),c=r.des.createEncryptionCipher;break;default:var h=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+n.algorithm+'".');throw h.algorithm=n.algorithm,h}var f=r.pbe.opensslDeriveBytes(t,l.substr(0,8),u),p=c(f);p.start(l),p.update(o.toDer(s.privateKeyToAsn1(e))),p.finish();var d={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:r.util.bytesToHex(l).toUpperCase()},body:p.output.getBytes()};return r.pem.encode(d)},s.decryptRsaPrivateKey=function(e,t){var n=null,i=r.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type){var a=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw a.headerType=a,a}if(i.procType&&"ENCRYPTED"===i.procType.type){var l,u;switch(i.dekInfo.algorithm){case"DES-CBC":l=8,u=r.des.createDecryptionCipher;break;case"DES-EDE3-CBC":l=24,u=r.des.createDecryptionCipher;break;case"AES-128-CBC":l=16,u=r.aes.createDecryptionCipher;break;case"AES-192-CBC":l=24,u=r.aes.createDecryptionCipher;break;case"AES-256-CBC":l=32,u=r.aes.createDecryptionCipher;break;case"RC2-40-CBC":l=5,u=function(e){return r.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":l=8,u=function(e){return r.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":l=16,u=function(e){return r.rc2.createDecryptionCipher(e,128)};break;default:var a=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".');throw a.algorithm=i.dekInfo.algorithm,a}var c=r.util.hexToBytes(i.dekInfo.parameters),h=r.pbe.opensslDeriveBytes(t,c.substr(0,8),l),f=u(h);if(f.start(c),f.update(r.util.createBuffer(i.body)),!f.finish())return n;n=f.output.getBytes()}else n=i.body;return n="ENCRYPTED PRIVATE KEY"===i.type?s.decryptPrivateKeyInfo(o.fromDer(n),t):o.fromDer(n),null!==n&&(n=s.privateKeyFromAsn1(n)),n},s.pbe.generatePkcs12Key=function(e,t,n,i,o,s){var a,l;if(void 0===s||null===s){if(!("sha1"in r.md))throw new Error('"sha1" hash algorithm unavailable.');s=r.md.sha1.create()}var u=s.digestLength,c=s.blockLength,h=new r.util.ByteBuffer,f=new r.util.ByteBuffer;if(null!==e&&void 0!==e){for(l=0;l=0;l--)I>>=8,I+=x.at(l)+T.at(l),T.setAt(l,255&I);A.putBuffer(T)}_=A,h.putBuffer(E)}return h.truncate(h.length()-o),h},s.pbe.getCipher=function(e,t,n){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,n);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,n);default:var r=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw r.oid=e,r.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],r}},s.pbe.getCipherForPBES2=function(e,t,n){var i={},a=[];if(!o.validate(t,u,i,a)){var l=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw l.errors=a,l}if(e=o.derToOid(i.kdfOid),e!==s.oids.pkcs5PBKDF2){var l=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw l.oid=e,l.supportedOids=["pkcs5PBKDF2"],l}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 l=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw l.oid=e,l.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],l}var c=i.kdfSalt,h=r.util.createBuffer(i.kdfIterationCount),p,d;switch(h=h.getInt(h.length()<<3),s.oids[e]){case"aes128-CBC":p=16,d=r.aes.createDecryptionCipher;break;case"aes192-CBC":p=24,d=r.aes.createDecryptionCipher;break;case"aes256-CBC":p=32,d=r.aes.createDecryptionCipher;break;case"des-EDE3-CBC":p=24,d=r.des.createDecryptionCipher;break;case"desCBC":p=8,d=r.des.createDecryptionCipher}var m=f(i.prfOid),g=r.pkcs5.pbkdf2(n,c,h,p,m),y=i.encIv,v=d(g);return v.start(y),v},s.pbe.getCipherForPKCS12PBE=function(e,t,n){var i={},a=[];if(!o.validate(t,c,i,a)){var l=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw l.errors=a,l}var u=r.util.createBuffer(i.salt),h=r.util.createBuffer(i.iterations),p,d,m;switch(h=h.getInt(h.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:p=24,d=8,m=r.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:p=5,d=8,m=function(e,t){var n=r.rc2.createDecryptionCipher(e,40);return n.start(t,null),n};break;default:var l=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw l.oid=e,l}var g=f(i.prfOid),y=s.pbe.generatePkcs12Key(n,u,1,h,p,g);g.start();var v=s.pbe.generatePkcs12Key(n,u,2,h,d,g);return m(y,v)},s.pbe.opensslDeriveBytes=function(e,t,n,i){if(void 0===i||null===i){if(!("md5"in r.md))throw new Error('"md5" hash algorithm unavailable.');i=r.md.md5.create()}null===t&&(t="");for(var o=[h(i,e+t)],s=16,a=1;s8?3:1,g=[],y=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],v=0,b,_=0;_>>4^k),k^=b,w^=b<<4,b=65535&(k>>>-16^w),w^=b,k^=b<<-16,b=858993459&(w>>>2^k),k^=b,w^=b<<2,b=65535&(k>>>-16^w),w^=b,k^=b<<-16,b=1431655765&(w>>>1^k),k^=b,w^=b<<1,b=16711935&(k>>>8^w),w^=b,k^=b<<8,b=1431655765&(w>>>1^k),k^=b,w^=b<<1,b=w<<8|k>>>20&240,w=k<<24|k<<8&16711680|k>>>8&65280|k>>>24&240,k=b;for(var E=0;E>>26,k=k<<2|k>>>26):(w=w<<1|w>>>27,k=k<<1|k>>>27),w&=-15,k&=-15;var S=t[w>>>28]|n[w>>>24&15]|r[w>>>20&15]|i[w>>>16&15]|o[w>>>12&15]|s[w>>>8&15]|a[w>>>4&15],x=l[k>>>28]|u[k>>>24&15]|c[k>>>20&15]|h[k>>>16&15]|f[k>>>12&15]|p[k>>>8&15]|d[k>>>4&15];b=65535&(x>>>16^S),g[v++]=S^b,g[v++]=x^b<<16}}return g}function d(e,t,n,r){var i=32===e.length?3:9,p,d;p=3===i?r?[30,-2,-2]:[0,32,2]:r?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var m=t[0],g=t[1];d=252645135&(m>>>4^g),g^=d,m^=d<<4,d=65535&(m>>>16^g),g^=d,m^=d<<16,d=858993459&(g>>>2^m),m^=d,g^=d<<2,d=16711935&(g>>>8^m),m^=d,g^=d<<8,d=1431655765&(m>>>1^g),g^=d,m^=d<<1,m=m<<1|m>>>31,g=g<<1|g>>>31;for(var y=0;y>>4|g<<28)^e[_+1];d=m,m=g,g=d^(s[w>>>24&63]|l[w>>>16&63]|c[w>>>8&63]|f[63&w]|o[k>>>24&63]|a[k>>>16&63]|u[k>>>8&63]|h[63&k])}d=m,m=g,g=d}m=m>>>1|m<<31,g=g>>>1|g<<31,d=1431655765&(m>>>1^g),g^=d,m^=d<<1,d=16711935&(g>>>8^m),m^=d,g^=d<<8,d=858993459&(g>>>2^m),m^=d,g^=d<<2,d=65535&(m>>>16^g),g^=d,m^=d<<16,d=252645135&(m>>>4^g),g^=d,m^=d<<4,n[0]=m,n[1]=g}function m(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),n="DES-"+t,i;i=e.decrypt?r.cipher.createDecipher(n,e.key):r.cipher.createCipher(n,e.key);var o=i.start;return i.start=function(e,t){var n=null;t instanceof r.util.ByteBuffer&&(n=t,t={}),t=t||{},t.output=n,t.iv=e,o.call(i,t)},i}},function(e,t,n){var r=n(21);n(30);var i=e.exports=r.pem=r.pem||{};function o(e){for(var t=e.name+": ",n=[],r=function(e,t){return" "+t},i=0;i65&&-1!==s){var a=t[s];","===a?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+a+t.substr(s+1),o=i-s-1,s=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(s=i);return t}function s(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var n="-----BEGIN "+e.type+"-----\r\n",i;if(e.procType&&(i={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},n+=o(i)),e.contentDomain&&(i={name:"Content-Domain",values:[e.contentDomain]},n+=o(i)),e.dekInfo&&(i={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&i.values.push(e.dekInfo.parameters),n+=o(i)),e.headers)for(var s=0;s{n(null,e)},e=>{n(e)})}},function(e,t,n){"use strict";e.exports=self.crypto||self.msCrypto},function(e,t,n){"use strict";const r=n(755);e.exports=function(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return r(e)}},function(e,t,n){"use strict";var r=n(1),i=n(380),o=n(5).Buffer,s=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function l(e,t){return e<>>32-t}function u(e,t,n,r,i,o,s){return l(e+(t&n|~t&r)+i+o|0,s)+t|0}function c(e,t,n,r,i,o,s){return l(e+(t&r|n&~r)+i+o|0,s)+t|0}function h(e,t,n,r,i,o,s){return l(e+(t^n^r)+i+o|0,s)+t|0}function f(e,t,n,r,i,o,s){return l(e+(n^(t|~r))+i+o|0,s)+t|0}r(a,i),a.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var n=this._a,r=this._b,i=this._c,o=this._d;n=u(n,r,i,o,e[0],3614090360,7),o=u(o,n,r,i,e[1],3905402710,12),i=u(i,o,n,r,e[2],606105819,17),r=u(r,i,o,n,e[3],3250441966,22),n=u(n,r,i,o,e[4],4118548399,7),o=u(o,n,r,i,e[5],1200080426,12),i=u(i,o,n,r,e[6],2821735955,17),r=u(r,i,o,n,e[7],4249261313,22),n=u(n,r,i,o,e[8],1770035416,7),o=u(o,n,r,i,e[9],2336552879,12),i=u(i,o,n,r,e[10],4294925233,17),r=u(r,i,o,n,e[11],2304563134,22),n=u(n,r,i,o,e[12],1804603682,7),o=u(o,n,r,i,e[13],4254626195,12),i=u(i,o,n,r,e[14],2792965006,17),r=u(r,i,o,n,e[15],1236535329,22),n=c(n,r,i,o,e[1],4129170786,5),o=c(o,n,r,i,e[6],3225465664,9),i=c(i,o,n,r,e[11],643717713,14),r=c(r,i,o,n,e[0],3921069994,20),n=c(n,r,i,o,e[5],3593408605,5),o=c(o,n,r,i,e[10],38016083,9),i=c(i,o,n,r,e[15],3634488961,14),r=c(r,i,o,n,e[4],3889429448,20),n=c(n,r,i,o,e[9],568446438,5),o=c(o,n,r,i,e[14],3275163606,9),i=c(i,o,n,r,e[3],4107603335,14),r=c(r,i,o,n,e[8],1163531501,20),n=c(n,r,i,o,e[13],2850285829,5),o=c(o,n,r,i,e[2],4243563512,9),i=c(i,o,n,r,e[7],1735328473,14),r=c(r,i,o,n,e[12],2368359562,20),n=h(n,r,i,o,e[5],4294588738,4),o=h(o,n,r,i,e[8],2272392833,11),i=h(i,o,n,r,e[11],1839030562,16),r=h(r,i,o,n,e[14],4259657740,23),n=h(n,r,i,o,e[1],2763975236,4),o=h(o,n,r,i,e[4],1272893353,11),i=h(i,o,n,r,e[7],4139469664,16),r=h(r,i,o,n,e[10],3200236656,23),n=h(n,r,i,o,e[13],681279174,4),o=h(o,n,r,i,e[0],3936430074,11),i=h(i,o,n,r,e[3],3572445317,16),r=h(r,i,o,n,e[6],76029189,23),n=h(n,r,i,o,e[9],3654602809,4),o=h(o,n,r,i,e[12],3873151461,11),i=h(i,o,n,r,e[15],530742520,16),r=h(r,i,o,n,e[2],3299628645,23),n=f(n,r,i,o,e[0],4096336452,6),o=f(o,n,r,i,e[7],1126891415,10),i=f(i,o,n,r,e[14],2878612391,15),r=f(r,i,o,n,e[5],4237533241,21),n=f(n,r,i,o,e[12],1700485571,6),o=f(o,n,r,i,e[3],2399980690,10),i=f(i,o,n,r,e[10],4293915773,15),r=f(r,i,o,n,e[1],2240044497,21),n=f(n,r,i,o,e[8],1873313359,6),o=f(o,n,r,i,e[15],4264355552,10),i=f(i,o,n,r,e[6],2734768916,15),r=f(r,i,o,n,e[13],1309151649,21),n=f(n,r,i,o,e[4],4149444226,6),o=f(o,n,r,i,e[11],3174756917,10),i=f(i,o,n,r,e[2],718787259,15),r=f(r,i,o,n,e[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+o|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=o.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=a},function(e,t,n){t=e.exports=n(381),t.Stream=t,t.Readable=t,t.Writable=n(259),t.Duplex=n(98),t.Transform=n(384),t.PassThrough=n(785)},function(e,t,n){"use strict";(function(t,r){var i=n(11);function o(e,t,n){this.chunk=e,this.encoding=t,this.callback=n,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,l;_.WritableState=b;var u=n(7);u.inherits=n(1);var c={deprecate:n(50)},h=n(382),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(383),y;function v(){}function b(e,t){l=l||n(98),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var u=!1===e.decodeStrings;this.decodeStrings=!u,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(l=l||n(98),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(3),n(8))},function(e,t,n){"use strict";function r(e){if("number"==typeof e){if(r.codes[e])return r.codes[e];throw new Error("no protocol with code: "+e)}if("string"==typeof e||e instanceof String){if(r.names[e])return r.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}const i=-1;function o(e,t,n,r,i){return{code:e,size:t,name:n,resolvable:Boolean(r),path:Boolean(i)}}r.lengthPrefixedVarSize=i,r.V=i,r.table=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,i,"ip6zone"],[53,i,"dns","resolvable"],[54,i,"dns4","resolvable"],[55,i,"dns6","resolvable"],[56,i,"dnsaddr","resolvable"],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,i,"unix",!1,"path"],[421,i,"p2p"],[421,i,"ipfs"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,i,"garlic64"],[460,0,"quic"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"]],r.names={},r.codes={},r.table.map(e=>{const t=o.apply(null,e);r.codes[t.code]=t,r.names[t.name]=t}),r.object=o,e.exports=r},function(e,t,n){"use strict";const r=n(10),i=n(43),o=n(36),s=n(38),a=n(202),l=n(24),u=n(54),c=n(4),h=n(55),f=n(12),p=n(185),d=n(830),m=n(831),g=n(833),y=n(835),v=n(837),b=n(838),_=n(848),w=n(867),k=n(868),E=c("repo"),S=Number.MAX_SAFE_INTEGER,x={memory:n(424),fs:n(424)},C=n(869).repoVersion;class A{constructor(e,t){l.strictEqual(typeof e,"string","missing repoPath"),this.options=B(t),this.closed=!0,this.path=e,this._locker=this._getLocker(),this.root=d.create("root",this.path,this.options),this.version=m(this.root),this.config=g(this.root),this.spec=y(this.root),this.apiAddr=v(this.root)}init(e,t){E("initializing at: %s",this.path),i([e=>this.root.open(j(e)),t=>this.config.set(O(e),t),t=>this.spec.set(P(e),t),e=>this.version.set(C,e)],t)}open(e){this.closed?(E("opening at: %s",this.path),r([e=>this.root.open(j(e)),e=>this._isInitialized(e),e=>this._openLock(this.path,e),(e,t)=>{E("aquired repo.lock"),this.lockfile=e,t()},e=>{E("creating datastore"),this.datastore=d.create("datastore",u.join(this.path,"datastore"),this.options),E("creating blocks");const t=d.create("blocks",u.join(this.path,"blocks"),this.options);b(t,this.options.storageBackendOptions.blocks,e)},(e,t)=>{this.blocks=e,t()},e=>{E("creating keystore"),this.keys=d.create("keys",u.join(this.path,"keys"),this.options),e()},e=>{this.closed=!1,E("all opened"),e()}],t=>{t&&this.lockfile?this._closeLock(n=>{n?E("error removing lock",n):this.lockfile=null,e(t)}):e(t)})):setImmediate(()=>e(new Error("repo is already open")))}_getLocker(){return"string"==typeof this.options.lock?(l(x[this.options.lock],"Unknown lock type: "+this.options.lock),x[this.options.lock]):(l(this.options.lock,"No lock provided"),this.options.lock)}_openLock(e,t){this._locker.lock(e,(e,n)=>{if(e)return t(e,null);l.strictEqual(typeof n.close,"function","Locks must have a close method"),t(null,n)})}_closeLock(e){if(this.lockfile)return this.lockfile.close(e);e()}_isInitialized(e){E("init check"),o({config:e=>this.config.exists(e),spec:e=>this.spec.exists(e),version:e=>this.version.check(C,e)},(t,n)=>{if(E("init",t,n),t&&!n.config)return e(Object.assign(new Error("repo is not initialized yet"),{code:k.ERR_REPO_NOT_INITIALIZED,path:this.path}));e(t)})}close(e){if(this.closed)return e(new Error("repo is already closed"));E("closing at: %s",this.path),i([e=>this.apiAddr.delete(R(e)),e=>{s([this.blocks,this.keys,this.datastore],(e,t)=>e.close(t),e)},e=>{E("unlocking"),this.closed=!0,this._closeLock(e)},e=>{this.lockfile=null,e()}],t=>e(t))}exists(e){this.version.exists(e)}stat(e,t){"function"==typeof e&&(t=e,e={}),e=Object.assign({},{human:!1},e),o({storageMax:e=>this.config.get("Datastore.StorageMax",(t,n)=>{e(null,new h(t?S:n))}),version:e=>this.version.get(e),blocks:e=>this.blocks.query({},(t,n)=>{n=n||[];const r=new h(n.length);let i=new h(0);n.forEach(e=>{i=i.plus(e.value.byteLength).plus(e.key._buf.byteLength)}),e(t,{count:r,size:i})}),datastore:e=>T(this.datastore,e),keys:e=>T(this.keys,e)},(n,r)=>{if(n)return t(n);let i=r.blocks.size.plus(r.datastore).plus(r.keys);e.human&&(i=i.div(1048576)),t(null,{repoPath:this.path,storageMax:r.storageMax,version:r.version,numObjects:r.blocks.count,repoSize:i})})}}function T(e,t){f(e.query({}),p((e,t)=>e.plus(t.value.byteLength).plus(t.key._buf.byteLength),new h(0),t))}function I(e,t){return n=>{t(n&&!e(n)?n:null)}}function j(e){return I(e=>"Already open"===e.message,e)}function R(e){return I(e=>e&&(e.code===k.ERR_REPO_NOT_INITIALIZED||e.message.startsWith("ENOENT")),e)}function B(e){const t=Object.assign({},_,e);return t.storageBackends=Object.assign({},_.storageBackends,t.storageBackends),t.storageBackendOptions=Object.assign({},_.storageBackendOptions,t.storageBackendOptions),t}function O(e){return e.datastore=Object.assign({},w,a(e,"datastore",{})),e}function P(e){const t=Object.assign({},w.Spec,a(e,"datastore.Spec",{}));return{type:t.type,mounts:t.mounts.map(e=>({mountpoint:e.mountpoint,type:e.child.type,path:e.child.path,shardFunc:e.child.shardFunc}))}}e.exports=A,e.exports.repoVersion=C,e.exports.errors=k},function(e,t,n){"use strict";const r=n(19),i=n(188),o=n(54),s=n(198),a=n(121);t.asyncFilter=function(e){let t=!1,n,r;return function(i){return function o(s,a){if(r)return a(r);s?(r=s,i(s,t?()=>{t?n=a:a(s)}:a)):i(null,(i,s)=>{i?a(i):r?a(r):(t=!0,e(s,(e,i)=>{t=!1,r?(a(r),n(r)):e?o(e,a):i?a(null,s):o(null,a)}))})}}},t.asyncSort=function(e){const t=i(),n=r.collect((n,i)=>{if(n)return t.abort(n);e(i,(e,n)=>{if(e)return t.abort(e);t.resolve(r.values(i))})});return function(e){return n(e),t}},t.replaceStartWith=function(e,t){const n=new RegExp("^"+t);return e.replace(n,"")},t.tmpdir=(()=>o.join(s.tmpdir(),a()))},function(e,t,n){var r=n(855).create,i=r("LevelUPError"),o=r("NotFoundError",i);o.prototype.notFound=!0,o.prototype.status=404,e.exports={LevelUPError:i,InitializationError:r("InitializationError",i),OpenError:r("OpenError",i),ReadError:r("ReadError",i),WriteError:r("WriteError",i),NotFoundError:o,EncodingError:r("EncodingError",i)}},function(e,t,n){t.AbstractLevelDOWN=n(859),t.AbstractIterator=n(418),t.AbstractChainedBatch=n(419)},function(e,t,n){"use strict";const r=1e3;e.exports={maxProvidersPerRequest:3,providerRequestTimeout:1e4,hasBlockTimeout:15e3,provideTimeout:15e3,kMaxPriority:Math.pow(2,31)-1,rebroadcastDelay:1e4,maxListeners:1e3}},function(e,t,n){var r=n(945)("socket.io-parser"),i=n(124),o=n(948),s=n(444),a=n(445);function l(){}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=l,t.Decoder=p;var u=t.ERROR+'"encode error"';function c(e){var n=""+e.type;if(t.BINARY_EVENT!==e.type&&t.BINARY_ACK!==e.type||(n+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(n+=e.nsp+","),null!=e.id&&(n+=e.id),null!=e.data){var i=h(e.data);if(!1===i)return u;n+=i}return r("encoded %j as %s",e,n),n}function h(e){try{return JSON.stringify(e)}catch(e){return!1}}function f(e,t){function n(e){var n=o.deconstructPacket(e),r=c(n.packet),i=n.buffers;i.unshift(r),t(i)}o.removeBlobs(e,n)}function p(){this.reconstructor=null}function d(e){var n=0,i={type:Number(e.charAt(0))};if(null==t.types[i.type])return y("unknown packet type "+i.type);if(t.BINARY_EVENT===i.type||t.BINARY_ACK===i.type){for(var o="";"-"!==e.charAt(++n)&&(o+=e.charAt(n),n!=e.length););if(o!=Number(o)||"-"!==e.charAt(n))throw new Error("Illegal attachments");i.attachments=Number(o)}if("/"===e.charAt(n+1))for(i.nsp="";++n;){var a=e.charAt(n);if(","===a)break;if(i.nsp+=a,n===e.length)break}else i.nsp="/";var l=e.charAt(n+1);if(""!==l&&Number(l)==l){for(i.id="";++n;){var a=e.charAt(n);if(null==a||Number(a)!=a){--n;break}if(i.id+=e.charAt(n),n===e.length)break}i.id=Number(i.id)}if(e.charAt(++n)){var u=m(e.substr(n)),c=!1!==u&&(i.type===t.ERROR||s(u));if(!c)return y("invalid payload");i.data=u}return r("decoded %s as %j",e,i),i}function m(e){try{return JSON.parse(e)}catch(e){return!1}}function g(e){this.reconPack=e,this.buffers=[]}function y(e){return{type:t.ERROR,data:"parser error: "+e}}l.prototype.encode=function(e,n){if(r("encoding packet %j",e),t.BINARY_EVENT===e.type||t.BINARY_ACK===e.type)f(e,n);else{var i=c(e);n([i])}},i(p.prototype),p.prototype.add=function(e){var n;if("string"==typeof e)n=d(e),t.BINARY_EVENT===n.type||t.BINARY_ACK===n.type?(this.reconstructor=new g(n),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",n)):this.emit("decoded",n);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");n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,this.emit("decoded",n))}},p.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,n){var r=n(951);e.exports=function(e){var t=e.xdomain,n=e.xscheme,i=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||r))return new XMLHttpRequest}catch(e){}try{if("undefined"!=typeof XDomainRequest&&!n&&i)return new XDomainRequest}catch(e){}if(!t)try{return new(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}},function(e,t,n){var r=n(125),i=n(124);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 n=new Error(e);return n.type="TransportError",n.description=t,this.emit("error",n),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=r.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,n){"use strict";(function(e){const r=n(56),i=n(52),o=n(12),s=n(40),a=n(33),l=n(51),u=n(36);function c(e,t,n){l.hmac.create(e,t,n)}function h(e,t,n,r){if("AES-128"===e||"AES-256"===e)return l.aes.create(n,t,r);r(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,n)=>{let r,i;if(e<0)r=n,i=t;else{if(!(e>0))return t[0];r=t,i=n}for(let e of r)for(let t of i)if(e===t)return e;throw new Error("No algorithms in common!")}),t.makeMacAndCipher=((e,t)=>{u([t=>c(e.hashT,e.keys.macKey,t),t=>h(e.cipherT,e.keys.iv,e.keys.cipherKey,t)],(n,r)=>{if(n)return t(n);e.mac=r[0],e.cipher=r[1],t()})}),t.selectBest=((n,r,i)=>{t.digest(e.concat([r.pubKeyBytes,n.nonce]),(o,s)=>{if(o)return i(o);t.digest(e.concat([n.pubKeyBytes,r.nonce]),(o,a)=>{if(o)return i(o);const l=e.compare(s,a);if(0===l)return i(new Error("you are trying to talk to yourself"));i(null,{curveT:t.theBest(l,n.exchanges,r.exchanges),cipherT:t.theBest(l,n.ciphers,r.ciphers),hashT:t.theBest(l,n.hashes,r.hashes),order:l})})})}),t.digest=((e,t)=>{r.digest(e,"sha2-256",e.length,t)}),t.write=function e(t,n,r){r=r||(()=>{}),o(s([n]),i.encode({fixed:!0,bytes:4}),a((e,n)=>{if(e)return r(e);t.shake.write(n[0]),r()}))},t.read=function e(t,n){i.decodeFromReader(t,{fixed:!0,bytes:4},n)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(e){const r=n(57),i=n(15),o=n(51),s=n(36),a=n(10),l=n(4),u=l("libp2p:secio");u.error=l("libp2p:secio:error");const c=r(n(994)),h=n(269),f=16;t.createProposal=(e=>(e.proposal.out={rand:o.randomBytes(16),pubkey:e.key.local.public.bytes,exchanges:h.exchanges.join(","),ciphers:h.ciphers.join(","),hashes:h.hashes.join(",")},e.proposalEncoded.out=c.Propose.encode(e.proposal.out),e.proposalEncoded.out)),t.createExchange=((t,n)=>{o.keys.generateEphemeralKeyPair(t.protocols.local.curveT,(r,i)=>{if(r)return n(r);t.ephemeralKey.local=i.key,t.shared.generate=i.genSharedKey;const o=e.concat([t.proposalEncoded.out,t.proposalEncoded.in,t.ephemeralKey.local]);t.key.local.sign(o,(e,r)=>{if(e)return n(e);t.exchange.out={epubkey:t.ephemeralKey.local,signature:r},n(null,c.Exchange.encode(t.exchange.out))})})}),t.identify=((e,t,n)=>{u("1.1 identify"),e.proposalEncoded.in=t,e.proposal.in=c.Propose.decode(t);const r=e.proposal.in.pubkey;e.key.remote=o.keys.unmarshalPublicKey(r),i.createFromPubKey(r.toString("base64"),(t,r)=>{if(t)return n(t);if(e.id.remote){if(e.id.remote.toB58String()!==r.toB58String())return n(new Error("dialed to the wrong peer, Ids do not match"))}else e.id.remote=r;u("1.1 identify - %s - identified remote peer as %s",e.id.local.toB58String(),e.id.remote.toB58String()),n()})}),t.selectProtocols=((e,t)=>{u("1.2 selection");const n={pubKeyBytes:e.key.local.public.bytes,exchanges:h.exchanges,hashes:h.hashes,ciphers:h.ciphers,nonce:e.proposal.out.rand},r={pubKeyBytes:e.proposal.in.pubkey,exchanges:e.proposal.in.exchanges.split(","),hashes:e.proposal.in.hashes.split(","),ciphers:e.proposal.in.ciphers.split(","),nonce:e.proposal.in.rand};h.selectBest(n,r,(n,r)=>{if(n)return t(n);e.protocols.remote={order:r.order,curveT:r.curveT,cipherT:r.cipherT,hashT:r.hashT},e.protocols.local={order:r.order,curveT:r.curveT,cipherT:r.cipherT,hashT:r.hashT},t()})}),t.verify=((t,n,r)=>{u("2.1. verify"),t.exchange.in=c.Exchange.decode(n),t.ephemeralKey.remote=t.exchange.in.epubkey;const i=e.concat([t.proposalEncoded.in,t.proposalEncoded.out,t.ephemeralKey.remote]);t.key.remote.verify(i,t.exchange.in.signature,(e,t)=>e?r(e):t?(u("2.1. verify - signature verified"),void r()):r(new Error("Bad signature")))}),t.generateKeys=((e,t)=>{u("2.2. keys"),a([t=>e.shared.generate(e.exchange.in.epubkey,t),(t,n)=>{e.shared.secret=t,o.keys.keyStretcher(e.protocols.local.cipherT,e.protocols.local.hashT,e.shared.secret,n)},(t,n)=>{if(e.protocols.local.order>0)e.protocols.local.keys=t.k1,e.protocols.remote.keys=t.k2;else{if(!(e.protocols.local.order<0))return n(new Error("you are trying to talk to yourself"));e.protocols.local.keys=t.k2,e.protocols.remote.keys=t.k1}u("2.3. mac + cipher"),s([t=>h.makeMacAndCipher(e.protocols.local,t),t=>h.makeMacAndCipher(e.protocols.remote,t)],n)}],t)}),t.verifyNonce=((e,t)=>{const n=e.proposal.out.rand;if(!n.equals(t))throw new Error(`Failed to read our encrypted nonce: ${n.toString("hex")} != ${t.toString("hex")}`)})}).call(this,n(0).Buffer)},function(e,t,n){(function(t){function n(e,n){if(e.length!==n.length)throw new Error("Inputs should have the same length");for(var r=t.allocUnsafe(e.length),i=0;it?(c.err(t),e(t)):e(null,n))}write(e,t){if(t=t||(()=>{}),!this.isValid())return t(new Error("handler is not in a valid state"));s(r([e]),a.encode(),i((e,n)=>{if(e)return c.err(e),this.shake.abort(e),t(e);n.forEach(e=>this.shake.write(e)),t()}))}getRawConn(){return this.conn}rest(){const e=this.shake.rest();return this.conn=null,this.stream=null,this.shake=null,e}close(){this.isValid()&&s(o(),this.rest())}}e.exports=h},function(e,t,n){"use strict";e.exports={relay:"/libp2p/circuit/relay/0.1.0"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var r=n(58),i=h(r),o=n(122),s=h(o),a=n(37),l=h(a),u=n(86),c=h(u);function h(e){return e&&e.__esModule?e:{default:e}}function f(e,t){var n=null,r;t=t||i.default,(0,s.default)(e,function(e,t){(0,l.default)(e)(function(e,i){r=arguments.length>2?(0,c.default)(arguments,1):i,n=e,t(!e)})},function(){t(n,r)})}e.exports=t.default},function(e,t,n){"use strict";e.exports={BLACK_LIST_TTL:3e5,BLACK_LIST_ATTEMPTS:5,DIAL_TIMEOUT:3e4,MAX_COLD_CALLS:50,MAX_PARALLEL_DIALS:100,QUARTER_HOUR:9e5,PRIORITY_HIGH:10,PRIORITY_LOW:20}},function(e,t,n){"use strict";const r=n(280);e.exports.msHandle=((e,t)=>new Promise((n,r)=>{e.handle(t,e=>{if(e)return r(e);n()})})),e.exports.msSelect=((e,t)=>new Promise((n,r)=>{e.select(t,(e,t)=>{if(e)return r(e);n(t)})})),e.exports.identifyDialer=((e,t)=>new Promise((n,i)=>{r.dialer(e,t,(e,t,r)=>{if(e)return i(e);n({peerInfo:t,observedAddrs:r})})})),e.exports.uniqueBy=((e,t)=>[...new Map(e.map(e=>[t(e),e])).values()])},function(e,t,n){"use strict";t=e.exports,t.multicodec="/ipfs/id/1.0.0",t.listener=n(1043),t.dialer=n(1044),t.message=n(281)},function(e,t,n){"use strict";const r=n(57),i="\nmessage Identify {\n // protocolVersion determines compatibility between peers\n optional string protocolVersion = 5; // e.g. ipfs/1.0.0\n\n // agentVersion is like a UserAgent string in browsers, or client version in bittorrent\n // includes the client name and client.\n optional string agentVersion = 6; // e.g. go-ipfs/0.1.0\n\n // publicKey is this node's public key (which also gives its node.ID)\n // - may not need to be sent, as secure channel implies it has been sent.\n // - then again, if we change / disable secure channel, may still want it.\n optional bytes publicKey = 1;\n\n // listenAddrs are the multiaddrs the sender node listens for open connections on\n repeated bytes listenAddrs = 2;\n\n // oservedAddr is the multiaddr of the remote endpoint that the sender node perceives\n // this is useful information to convey to the other side, as it helps the remote endpoint\n // determine whether its connection to the local peer goes through NAT.\n optional bytes observedAddr = 4;\n\n repeated string protocols = 3;\n}\n";e.exports=r(i).Identify},function(e,t,n){"use strict";const r=n(64).Connection,i=n(12);e.exports=((e,t,n,o)=>{const s=new Promise((e,t)=>{n.getPeerInfo((t,r)=>{if(!t&&r)return void e(r);const i=n.setPeerInfo;n.setPeerInfo=(t=>{i.call(n,t),e(t)})})}),a={source:i(n,o.incoming(e,t,s)),sink:i(o.outgoing(e,t,s),n)};return new r(a,n)})},function(e,t,n){"use strict";e.exports={PROTOCOL:"/ipfs/ping/1.0.0",PING_LENGTH:32}},function(e,t,n){var r=n(65),i=n(285),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!i(e))||(s.test(e)||!o.test(e)||null!=t&&e in Object(t))}e.exports=a},function(e,t,n){var r=n(108),i=n(87),o="[object Symbol]";function s(e){return"symbol"==typeof e||i(e)&&r(e)==o}e.exports=s},function(e,t,n){var r=n(1074),i=n(1090),o=n(1092),s=n(1093),a=n(1094);function l(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=u&&f&&(p=null,e(f))}}var g=r(function(){if(h=!0,f)return m();i||t&&a-t>=l||(i=!0,s(o,function(t,r){if(i=!1,t)u=a,f=t,m();else{var o=a++;e(r,function(e,t){n?c[o]=t:c.push(t),e&&(d=e),m()}),f||g()}}))});return function(e,t){e?s(f=o=e,function(e){if(t)return t(e)}):(p=t,h||g(),m())}}}},function(e,t,n){"use strict";const r=n(165),i=100;e.exports=function e(t){const n=t||100;var i=[];return r(function e(t){for(i=i.concat(t);i.length>=n;){const e=n,t=i.slice(0,e);i=i.slice(e),this.queue(t)}},function e(t){i.length&&(this.queue(i),i=[]),this.queue(null)})}},function(e,t,n){"use strict";e.exports=class e{constructor(e,t){this._options=t||{},Object.assign(this,e)}}},function(e,t,n){"use strict";const r=n(1169),i=n(1170),o={bits:8};class s{constructor(e,t,n){if(this._options=Object.assign({},o,e),this._popCount=0,this._parent=t,this._posAtParent=n,!this._options.hashFn)throw new Error("please define an options.hashFn");this._options.hash||(this._options.hash=i(this._options.hashFn)),this._children=new r}static isBucket(e){return e instanceof s}async put(e,t){const n=await this._findNewBucketAndPos(e);await n.bucket._putAt(n,e,t)}async get(e){const t=await this._findChild(e);if(t)return t.value}async del(e){const t=await this._findPlace(e),n=t.bucket._at(t.pos);n&&n.key===e&&t.bucket._delAt(t.pos)}leafCount(){return this._children.compactArray().reduce((e,t)=>t instanceof s?e+t.leafCount():e+1,0)}childrenCount(){return this._children.length}onlyChild(){return this._children.get(0)}*eachLeafSeries(){const e=this._children.compactArray();for(const t of e)if(t instanceof s)for(const e of t.eachLeafSeries())yield e;else yield t}serialize(e,t){return t(this._children.reduce((n,r,i)=>(r&&(r instanceof s?n.push(r.serialize(e,t)):n.push(e(r,i))),n),[]))}async asyncTransform(e,t){return c(this,e,t)}toJSON(){return this.serialize(l,u)}prettyPrint(){return JSON.stringify(this.toJSON(),null," ")}tableSize(){return Math.pow(2,this._options.bits)}async _findChild(e){const t=await this._findPlace(e),n=t.bucket._at(t.pos);if(n&&n.key===e)return n}async _findPlace(e){const t=this._options.hash(e),n=await t.take(this._options.bits),r=this._children.get(n);return r instanceof s?r._findPlace(t):{bucket:this,pos:n,hash:t}}async _findNewBucketAndPos(e){const t=await this._findPlace(e),n=t.bucket._at(t.pos);if(n&&n.key!==e){const e=new s(this._options,t.bucket,t.pos);t.bucket._putObjectAt(t.pos,e);const r=await e._findPlace(n.hash);return r.bucket._putAt(r,n.key,n.value),e._findNewBucketAndPos(t.hash)}return t}_putAt(e,t,n){this._putObjectAt(e.pos,{key:t,value:n,hash:e.hash})}_putObjectAt(e,t){this._children.get(e)||this._popCount++,this._children.set(e,t)}_delAt(e){this._children.get(e)&&this._popCount--,this._children.unset(e),this._level()}_level(){if(this._parent&&this._popCount<=1)if(1===this._popCount){const e=this._children.find(a);if(!(e instanceof s)){const t=e.hash;t.untake(this._options.bits);const n={pos:this._posAtParent,hash:t};this._parent._putAt(n,e.key,e.value)}}else this._parent._delAt(this._posAtParent)}_at(e){return this._children.get(e)}}function a(e){return Boolean(e)}function l(e,t){return e.key}function u(e){return e}async function c(e,t,n){const r=[];for(const i of e._children.compactArray()){if(i instanceof s)await c(i,t,n);else{const n=await t(i);r.push({bitField:e._children.bitField(),children:n})}return n(r)}}e.exports=s},function(e,t,n){"use strict";const r=(e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean);e.exports=r},function(e,t,n){"use strict";(function(t){const r=n(10),i=n(45),o=n(81),{loadNode:s,formatCid:a,toMfsPath:l,FILE_SEPARATOR:u,FILE_TYPES:c}=n(73),h=n(12),f=n(33),p=n(74),d=n(67),m=n(116),g=n(71),y=n(61),v={long:!1,cidBase:"base58btc"};e.exports=(e=>(function n(b,_={}){"object"==typeof b&&(_=b,b=u),void 0===b&&(b=u),_=Object.assign({},v,_),_.long=_.l||_.long;const w=y.source();return r([t=>l(e,b,t),({mfsPath:t,depth:n},r)=>{h(o(t,e.ipld,{maxDepth:n}),f((i,s)=>{if(i)return r(i);if(s.length>1)return r(new Error(`Path ${b} had ${s.length} roots`));const a=s[0];if(!a)return r(new Error(`${b} does not exist`));if("dir"!==a.type)return r(null,m(a));let l=!0;return r(null,h(o(t,e.ipld,{maxDepth:n+1}),d(()=>!l||(l=!1,!1))))}))},(n,r)=>{r(null,h(n,p((n,r)=>{if(!_.long)return r(null,{name:n.name,type:0,size:0,hash:""});s(e,{cid:n.cid},(e,o)=>{if(e)return r(e);if(t.isBuffer(o.node))return r(null,{name:n.name,type:0,hash:a(n.cid,_.cidBase),size:o.node.length});const s=i.unmarshal(o.node.data);r(null,{name:n.name,type:c[s.type],hash:a(n.cid,_.cidBase),size:s.fileSize()||0})})})))}],(e,t)=>{if(e)return w.resolve(g(e));w.resolve(t)}),w}))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(10),i=n(59),o=n(4)("ipfs:mfs:mkdir"),s=n(81),a=n(12),l=n(67),u=n(66),c=n(33),{createNode:h,toMfsPath:f,toPathComponents:p,updateMfsRoot:d,updateTree:m,FILE_SEPARATOR:g}=n(73),y={parents:!1,hashAlg:"sha2-256",cidVersion:0,shardSplitThreshold:1e3,format:"dag-pb",flush:!0};e.exports=(e=>(function t(n,v,b){if("function"==typeof v&&(b=v,v={}),v=Object.assign({},y,v),v.parents=v.p||v.parents,v.cidVersion=v.cidVersion||0,!n)return b(new Error("no path given to Mkdir"));if(n=n.trim(),n===g)return b(v.parents?null:new Error(`cannot create directory '${g}': Already exists`));o(`Creating ${n}`);const _=p(n);r([t=>f(e,n,t),({mfsDirectory:t,mfsPath:n,root:r},i)=>{const o=p(n).slice(1);let h=0,f="";a(s(n,e.ipld,{fullPath:!0}),l(e=>e.name===o[h]&&(h++,!0)),u(e=>{const t=`${f}${f?"/":""}${o[e.depth]}`;if("dir"!==e.type)throw new Error(`cannot access ${t}: Not a directory`);return f=t,{cid:e.cid,name:e.name}}),c(i))},(t,n)=>{if(_.unshift("/"),t.length===_.length)return n(new Error("file already exists"));i(_.map((e,t)=>({part:e,index:t})),({part:n,index:i},o)=>t[i]?o(null,{name:n,...t[i]}):i===_.length-1||v.parents?void r([t=>h(e,"directory",v,t),({cid:e,node:t},r)=>{r(null,{cid:e,size:t.size,name:n})}],o):o(new Error("file does not exist")),n)},(t,n)=>m(e,t,v,n),({cid:t},n)=>d(e,t,n)],e=>{e&&e.message.includes("file already exists")&&v.parents&&(e=null),b(e)})}))},function(e,t,n){"use strict";const r=n(81),i=n(12),o=n(116),s=n(74),a=n(187),l=n(67),u=n(61),c=n(33),{toMfsPath:h}=n(73),f=n(4)("ipfs:mfs:read-pull-stream"),p={offset:0,length:void 0};e.exports=(e=>(function t(n,d={}){d=Object.assign({},p,d),d.length=d.length||d.count,f(`Reading ${n}`);const m=u.source();return i(o(n),s((t,n)=>h(e,t,n)),s(({mfsPath:t,root:n},o)=>(f(`Exporting ${t}`),i(r(t,e.ipld,{offset:d.offset,length:d.length}),c(o)))),a(),l(),c((e,t)=>{if(e)return m.abort(e);if(!t||!t.length)return m.abort(new Error(`${n} does not exist`));const r=t[0];return"file"!==r.type?m.abort(new Error(`${n} was not a file`)):r.content?(f(`Got ${n} content`),void m.resolve(t[0].content)):m.abort(new Error(`Could not load content stream from ${n}`))})),m}))},function(e,t,n){"use strict";const r=n(26),i=n(166),o=n(167);e.exports=((e,t)=>{const n=o(e,t);return(e,t,o)=>{const s=r(o),a=n(t),l=i(e=>s(null,e));a.once("error",s),a.pipe(l),a.write(e),a.end()}})},function(e,t,n){"use strict";const r=n(53),i=n(1290),o=n(17).Readable;class s extends o{constructor(e){const t=Object.assign(e||{},{objectMode:!0});super(t)}_read(){}}const a=(e,t)=>{let n=new s,o=i.extract();o.on("entry",(e,t,r)=>{t.on("end",r),"directory"!==e.type?n.push({path:e.name,content:t}):(n.push({path:e.name}),t.resume())}).on("finish",()=>n.push(null)),r(e,o),t(null,n)};e.exports=a},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i=Array.isArray,o=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),s=function e(t){for(;t.length>1;){var n=t.pop(),r=n.obj[n.prop];if(i(r)){for(var o=[],s=0;s=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122?s+=i.charAt(a):l<128?s+=o[l]:l<2048?s+=o[192|l>>6]+o[128|63&l]:l<55296||l>=57344?s+=o[224|l>>12]+o[128|l>>6&63]+o[128|63&l]:(a+=1,l=65536+((1023&l)<<10|1023&i.charCodeAt(a)),s+=o[240|l>>18]+o[128|l>>12&63]+o[128|l>>6&63]+o[128|63&l])}return s},f=function e(t){for(var n=[{obj:{o:t},prop:"o"}],r=[],i=0;i1;class m{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");const t=this[i]=e.max||1/0,n=e.length||d;if(this[s]="function"!=typeof n?d:n,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[l]=e.maxAge||0,this[u]=e.dispose,this[c]=e.noDisposeOnSet||!1,this[p]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||1/0,v(this)}get max(){return this[i]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[l]=e,v(this)}get maxAge(){return this[l]}set lengthCalculator(e){"function"!=typeof e&&(e=d),e!==this[s]&&(this[s]=e,this[o]=0,this[h].forEach(e=>{e.length=this[s](e.value,e.key),this[o]+=e.length})),v(this)}get lengthCalculator(){return this[s]}get length(){return this[o]}get itemCount(){return this[h].length}rforEach(e,t){t=t||this;for(let n=this[h].tail;null!==n;){const r=n.prev;w(this,e,n,t),n=r}}forEach(e,t){t=t||this;for(let n=this[h].head;null!==n;){const r=n.next;w(this,e,n,t),n=r}}keys(){return this[h].toArray().map(e=>e.key)}values(){return this[h].toArray().map(e=>e.value)}reset(){this[u]&&this[h]&&this[h].length&&this[h].forEach(e=>this[u](e.key,e.value)),this[f]=new Map,this[h]=new r,this[o]=0}dump(){return this[h].map(e=>!y(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[h]}set(e,t,n){if(n=n||this[l],n&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const r=n?Date.now():0,a=this[s](t,e);if(this[f].has(e)){if(a>this[i])return b(this,this[f].get(e)),!1;const s=this[f].get(e),l=s.value;return this[u]&&(this[c]||this[u](e,l.value)),l.now=r,l.maxAge=n,l.value=t,this[o]+=a-l.length,l.length=a,this.get(e),v(this),!0}const p=new _(e,t,a,r,n);return p.length>this[i]?(this[u]&&this[u](e,t),!1):(this[o]+=p.length,this[h].unshift(p),this[f].set(e,this[h].head),v(this),!0)}has(e){if(!this[f].has(e))return!1;const t=this[f].get(e).value;return!y(this,t)}get(e){return g(this,e,!0)}peek(e){return g(this,e,!1)}pop(){const e=this[h].tail;return e?(b(this,e),e.value):null}del(e){b(this,this[f].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{const e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[f].forEach((e,t)=>g(this,t,!1))}}const g=(e,t,n)=>{const r=e[f].get(t);if(r){const t=r.value;if(y(e,t)){if(b(e,r),!e[a])return}else n&&(e[p]&&(r.value.now=Date.now()),e[h].unshiftNode(r));return t.value}},y=(e,t)=>{if(!t||!t.maxAge&&!e[l])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[l]&&n>e[l]},v=e=>{if(e[o]>e[i])for(let t=e[h].tail;e[o]>e[i]&&null!==t;){const n=t.prev;b(e,t),t=n}},b=(e,t)=>{if(t){const n=t.value;e[u]&&e[u](n.key,n.value),e[o]-=n.length,e[f].delete(n.key),e[h].removeNode(t)}};class _{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}}const w=(e,t,n,r)=>{let i=n.value;y(e,i)&&(b(e,n),e[a]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};e.exports=m},function(e,t,n){"use strict";const r=n(91);function i(e,t,n){"function"==typeof e.pipe?r(e,(e,r)=>{if(e)return n(e);t(r,n)}):t(e,n)}e.exports=i},function(e,t,n){"use strict";const r=n(17).Transform,i=n(1362);class o extends r{constructor(e){const t=Object.assign(e||{},{objectMode:!0});super(t)}_transform(e,t,n){try{const t=i(e);if(this.push(t),!t.success)throw new Error(t.text)}catch(e){return n(e)}n()}}e.exports=o},function(e,t,n){"use strict";const r=n(55);e.exports=(e=>({totalIn:new r(e.TotalIn),totalOut:new r(e.TotalOut),rateIn:new r(e.RateIn),rateOut:new r(e.RateOut)}))},function(e,t,n){(function(t){e.exports=h;const r=n(552),i=n(1548),o=n(131),s=n(169),a=n(26),l=n(145),u=n(32),c=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;function h(e,n){if(e=Object.assign({maxRedirects:10},"string"==typeof e?{url:e}:e),n=a(n),e.url){const{hostname:t,port:n,protocol:r,auth:i,path:o}=u.parse(e.url);delete e.url,t||n||r||i?Object.assign(e,{hostname:t,port:n,protocol:r,auth:i,path:o}):e.path=o}const r={"accept-encoding":"gzip, deflate"};let f;e.headers&&Object.keys(e.headers).forEach(t=>r[t.toLowerCase()]=e.headers[t]),e.headers=r,e.body?f=e.json&&!c(e.body)?JSON.stringify(e.body):e.body:e.form&&(f="string"==typeof e.form?e.form:l.stringify(e.form),e.headers["content-type"]="application/x-www-form-urlencoded"),f&&(e.method||(e.method="POST"),c(f)||(e.headers["content-length"]=t.byteLength(f)),e.json&&!e.form&&(e.headers["content-type"]="application/json")),delete e.body,delete e.form,e.json&&(e.headers.accept="application/json"),e.method&&(e.method=e.method.toUpperCase());const p="https:"===e.protocol?s:o,d=p.request(e,t=>{if(t.statusCode>=300&&t.statusCode<400&&t.headers.location)return e.url=t.headers.location,delete e.headers.host,t.resume(),"POST"===e.method&&[301,302].includes(t.statusCode)&&(e.method="GET",delete e.headers["content-length"],delete e.headers["content-type"]),0==e.maxRedirects--?n(new Error("too many redirects")):h(e,n);const r="function"==typeof i&&"HEAD"!==e.method;n(null,r?i(t):t)});return d.on("timeout",()=>{d.abort(),n(new Error("Request timed out"))}),d.on("error",n),c(f)?f.on("error",n).pipe(d):d.end(f),d}h.concat=((e,t)=>h(e,(n,i)=>{if(n)return t(n);r(i,(n,r)=>{if(n)return t(n);if(e.json)try{r=JSON.parse(r.toString())}catch(n){return t(n,i,r)}t(null,i,r)})})),["get","post","put","patch","head","delete"].forEach(e=>{h[e]=((t,n)=>("string"==typeof t&&(t={url:t}),h(Object.assign({method:e.toUpperCase()},t),n)))})}).call(this,n(0).Buffer)},function(e,t,n){(function(t){e.exports=h;var r=n(4)("simple-peer"),i=n(455),o=n(1),s=n(101),a=n(1552),l=65536,u=5e3,c=5e3;function h(e){var t=this;if(!(t instanceof h))return new h(e);if(t._id=s(4).toString("hex").slice(0,7),t._debug("new peer %o",e),e=Object.assign({allowHalfOpen:!1},e),a.Duplex.call(t,e),t.channelName=e.initiator?e.channelName||s(20).toString("hex"):null,t.initiator=e.initiator||!1,t.channelConfig=e.channelConfig||h.channelConfig,t.config=Object.assign({},h.config,e.config),t.offerOptions=e.offerOptions||{},t.answerOptions=e.answerOptions||{},t.sdpTransform=e.sdpTransform||function(e){return e},t.streams=e.streams||(e.stream?[e.stream]:[]),t.trickle=void 0===e.trickle||e.trickle,t.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,t.iceCompleteTimeout=e.iceCompleteTimeout||u,t.destroyed=!1,t.connected=!1,t.remoteAddress=void 0,t.remoteFamily=void 0,t.remotePort=void 0,t.localAddress=void 0,t.localFamily=void 0,t.localPort=void 0,t._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:i(),!t._wrtc)throw"undefined"==typeof window?p("No WebRTC support: Specify `opts.wrtc` option in this environment","ERR_WEBRTC_SUPPORT"):p("No WebRTC support: Not a supported browser","ERR_WEBRTC_SUPPORT");t._pcReady=!1,t._channelReady=!1,t._iceComplete=!1,t._iceCompleteTimer=null,t._channel=null,t._pendingCandidates=[],t._isNegotiating=!t.initiator,t._batchedNegotiation=!1,t._queuedNegotiation=!1,t._sendersAwaitingStable=[],t._senderMap=new Map,t._firstStable=!0,t._closingInterval=null,t._remoteTracks=[],t._remoteStreams=[],t._chunk=null,t._cb=null,t._interval=null;try{t._pc=new t._wrtc.RTCPeerConnection(t.config)}catch(e){t.destroy(e)}t._isReactNativeWebrtc="number"==typeof t._pc._peerConnectionId,t._pc.oniceconnectionstatechange=function(){t._onIceStateChange()},t._pc.onicegatheringstatechange=function(){t._onIceStateChange()},t._pc.onsignalingstatechange=function(){t._onSignalingStateChange()},t._pc.onicecandidate=function(e){t._onIceCandidate(e)},t.initiator?t._setupData({channel:t._pc.createDataChannel(t.channelName,t.channelConfig)}):t._pc.ondatachannel=function(e){t._setupData(e)},t.streams&&t.streams.forEach(function(e){t.addStream(e)}),t._pc.ontrack=function(e){t._onTrack(e)},t.initiator&&t._needsNegotiation(),t._onFinishBound=function(){t._onFinish()},t.once("finish",t._onFinishBound)}function f(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}function p(e,t){var n=new Error(e);return n.code=t,n}o(h,a.Duplex),h.WEBRTC_SUPPORT=!!i(),h.config={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:global.stun.twilio.com:3478?transport=udp"}],sdpSemantics:"unified-plan"},h.channelConfig={},Object.defineProperty(h.prototype,"bufferSize",{get:function(){var e=this;return this._channel&&this._channel.bufferedAmount||0}}),h.prototype.address=function(){var e=this;return{port:this.localPort,family:this.localFamily,address:this.localAddress}},h.prototype.signal=function(e){var t=this;if(t.destroyed)throw p("cannot signal after peer is destroyed","ERR_SIGNALING");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}t._debug("signal()"),e.renegotiate&&t.initiator&&(t._debug("got request to renegotiate"),t._needsNegotiation()),e.transceiverRequest&&t.initiator&&(t._debug("got request for transceiver"),t.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(t._pc.localDescription&&t._pc.localDescription.type&&t._pc.remoteDescription&&t._pc.remoteDescription.type?t._addIceCandidate(e.candidate):t._pendingCandidates.push(e.candidate)),e.sdp&&t._pc.setRemoteDescription(new t._wrtc.RTCSessionDescription(e)).then(function(){t.destroyed||(t._pendingCandidates.forEach(function(e){t._addIceCandidate(e)}),t._pendingCandidates=[],"offer"===t._pc.remoteDescription.type&&t._createAnswer())}).catch(function(e){t.destroy(p(e,"ERR_SET_REMOTE_DESCRIPTION"))}),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||t.destroy(p("signal() called with invalid signal data","ERR_SIGNALING"))},h.prototype._addIceCandidate=function(e){var t=this;t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e)).catch(function(e){if("closed"!==t._pc.signalingState&&"Failed to set ICE candidate; RTCPeerConnection is closed."===e.message)return t._debug("ignoring incorrect wrtc error");t.destroy(p(e,"ERR_ADD_ICE_CANDIDATE"))})},h.prototype.send=function(e){var t=this;this._channel.send(e)},h.prototype.addTransceiver=function(e,t){var n=this;if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(e){this.destroy(e)}else this.emit("signal",{transceiverRequest:{kind:e,init:t}})},h.prototype.addStream=function(e){var t=this;t._debug("addStream()"),e.getTracks().forEach(function(n){t.addTrack(n,e)})},h.prototype.addTrack=function(e,t){var n=this;this._debug("addTrack()");var r=this._senderMap.get(e)||new Map,i=r.get(t);i?i.removed?this.destroy(p("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):this.destroy(p("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED"):(i=this._pc.addTrack(e,t),r.set(t,i),this._senderMap.set(e,r),this._needsNegotiation())},h.prototype.replaceTrack=function(e,t,n){var r=this;this._debug("replaceTrack()");var i=this._senderMap.get(e),o=i?i.get(n):null;o||this.destroy(p("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED"),t&&this._senderMap.set(t,i),null!=o.replaceTrack?o.replaceTrack(t):this.destroy(p("replaceTrack is not supported in this browser","ERR_UNSUPPORTED_REPLACETRACK"))},h.prototype.removeTrack=function(e,t){var n=this;this._debug("removeSender()");var r=this._senderMap.get(e),i=r?r.get(t):null;i||this.destroy(p("Cannot remove track that was never added.","ERR_TRACK_NOT_ADDED"));try{i.removed=!0,this._pc.removeTrack(i)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?this._sendersAwaitingStable.push(i):this.destroy(e)}this._needsNegotiation()},h.prototype.removeStream=function(e){var t=this;t._debug("removeSenders()"),e.getTracks().forEach(function(n){t.removeTrack(n,e)})},h.prototype._needsNegotiation=function(){var e=this;e._debug("_needsNegotiation"),e._batchedNegotiation||(e._batchedNegotiation=!0,setTimeout(function(){e._batchedNegotiation=!1,e._debug("starting batched negotiation"),e.negotiate()},0))},h.prototype.negotiate=function(){var e=this;e.initiator?e._isNegotiating?(e._queuedNegotiation=!0,e._debug("already negotiating, queueing")):(e._debug("start negotiation"),setTimeout(()=>{e._createOffer()},0)):e._isNegotiating||(e._debug("requesting negotiation from initiator"),e.emit("signal",{renegotiate:!0})),e._isNegotiating=!0},h.prototype.destroy=function(e){var t=this;this._destroy(e,function(){})},h.prototype._destroy=function(e,t){var n=this;if(!this.destroyed){if(this._debug("destroy (error: %s)",e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this.destroyed=!0,this.connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(e){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,e&&this.emit("error",e),this.emit("close"),t()}},h.prototype._setupData=function(e){var t=this;if(!e.channel)return t.destroy(p("Data channel event is missing `channel` property","ERR_DATA_CHANNEL"));t._channel=e.channel,t._channel.binaryType="arraybuffer","number"==typeof t._channel.bufferedAmountLowThreshold&&(t._channel.bufferedAmountLowThreshold=65536),t.channelName=t._channel.label,t._channel.onmessage=function(e){t._onChannelMessage(e)},t._channel.onbufferedamountlow=function(){t._onChannelBufferedAmountLow()},t._channel.onopen=function(){t._onChannelOpen()},t._channel.onclose=function(){t._onChannelClose()},t._channel.onerror=function(e){t.destroy(p(e,"ERR_DATA_CHANNEL"))};var n=!1;t._closingInterval=setInterval(function(){t._channel&&"closing"===t._channel.readyState?(n&&t._onChannelClose(),n=!0):n=!1},5e3)},h.prototype._read=function(){},h.prototype._write=function(e,t,n){var r=this;if(this.destroyed)return n(p("cannot write after peer is destroyed","ERR_DATA_CHANNEL"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(p(e,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=e,this._cb=n},h.prototype._onFinish=function(){var e=this;function t(){setTimeout(function(){e.destroy()},1e3)}e.destroyed||(e.connected?t():e.once("connect",t))},h.prototype._startIceCompleteTimeout=function(){var e=this;e.destroyed||e._iceCompleteTimer||(e._debug("started iceComplete timeout"),e._iceCompleteTimer=setTimeout(function(){e._iceComplete||(e._iceComplete=!0,e._debug("iceComplete timeout completed"),e.emit("iceTimeout"),e.emit("_iceComplete"))},e.iceCompleteTimeout))},h.prototype._createOffer=function(){var e=this;e.destroyed||e._pc.createOffer(e.offerOptions).then(function(t){function n(){e._debug("createOffer success"),e.destroyed||(e.trickle||e._iceComplete?i():e.once("_iceComplete",i))}function r(t){e.destroy(p(t,"ERR_SET_LOCAL_DESCRIPTION"))}function i(){if(!e.destroyed){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp})}}e.destroyed||(e.trickle||e.allowHalfTrickle||(t.sdp=f(t.sdp)),t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(n).catch(r))}).catch(function(t){e.destroy(p(t,"ERR_CREATE_OFFER"))})},h.prototype._requestMissingTransceivers=function(){var e=this;e._pc.getTransceivers&&e._pc.getTransceivers().forEach(t=>{!t.mid&&t.sender.track&&e.addTransceiver(t.sender.track.kind)})},h.prototype._createAnswer=function(){var e=this;e.destroyed||e._pc.createAnswer(e.answerOptions).then(function(t){function n(){e.destroyed||(e.trickle||e._iceComplete?i():e.once("_iceComplete",i))}function r(t){e.destroy(p(t,"ERR_SET_LOCAL_DESCRIPTION"))}function i(){if(!e.destroyed){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp}),e.initiator||e._requestMissingTransceivers()}}e.destroyed||(e.trickle||e.allowHalfTrickle||(t.sdp=f(t.sdp)),t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(n).catch(r))}).catch(function(t){e.destroy(p(t,"ERR_CREATE_ANSWER"))})},h.prototype._onIceStateChange=function(){var e=this;if(!this.destroyed){var t=this._pc.iceConnectionState,n=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",t,n),this.emit("iceStateChange",t,n),"connected"!==t&&"completed"!==t||(this._pcReady=!0,this._maybeReady()),"failed"===t&&this.destroy(p("Ice connection failed.","ERR_ICE_CONNECTION_FAILURE")),"closed"===t&&this.destroy(p("Ice connection closed.","ERR_ICE_CONNECTION_CLOSED"))}},h.prototype.getStats=function(e){var t=this;function n(e){return"[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach(function(t){Object.assign(e,t)}),e}0===t._pc.getStats.length?t._pc.getStats().then(function(t){var r=[];t.forEach(function(e){r.push(n(e))}),e(null,r)},function(t){e(t)}):t._isReactNativeWebrtc?t._pc.getStats(null,function(t){var r=[];t.forEach(function(e){r.push(n(e))}),e(null,r)},function(t){e(t)}):t._pc.getStats.length>0?t._pc.getStats(function(r){if(!t.destroyed){var i=[];r.result().forEach(function(e){var t={};e.names().forEach(function(n){t[n]=e.stat(n)}),t.id=e.id,t.type=e.type,t.timestamp=e.timestamp,i.push(n(t))}),e(null,i)}},function(t){e(t)}):e(null,[])},h.prototype._maybeReady=function(){var e=this;function t(){e.destroyed||e.getStats(function(n,r){if(!e.destroyed){n&&(r=[]);var i={},o={},s={},a=!1;if(r.forEach(function(e){"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(i[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(o[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(s[e.id]=e)}),r.forEach(function(e){"transport"===e.type&&e.selectedCandidatePairId&&u(s[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&u(e)}),a||Object.keys(s).length&&!Object.keys(o).length){if(e._connecting=!1,e.connected=!0,e._chunk){try{e.send(e._chunk)}catch(n){return e.destroy(p(n,"ERR_DATA_CHANNEL"))}e._chunk=null,e._debug('sent chunk from "write before connect"');var l=e._cb;e._cb=null,l(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 u(t){a=!0;var n=o[t.localCandidateId];n&&(n.ip||n.address)?(e.localAddress=n.ip||n.address,e.localPort=Number(n.port)):n&&n.ipAddress?(e.localAddress=n.ipAddress,e.localPort=Number(n.portNumber)):"string"==typeof t.googLocalAddress&&(n=t.googLocalAddress.split(":"),e.localAddress=n[0],e.localPort=Number(n[1])),e.localAddress&&(e.localFamily=e.localAddress.includes(":")?"IPv6":"IPv4");var r=i[t.remoteCandidateId];r&&(r.ip||r.address)?(e.remoteAddress=r.ip||r.address,e.remotePort=Number(r.port)):r&&r.ipAddress?(e.remoteAddress=r.ipAddress,e.remotePort=Number(r.portNumber)):"string"==typeof t.googRemoteAddress&&(r=t.googRemoteAddress.split(":"),e.remoteAddress=r[0],e.remotePort=Number(r[1])),e.remoteAddress&&(e.remoteFamily=e.remoteAddress.includes(":")?"IPv6":"IPv4"),e._debug("connect local: %s:%s remote: %s:%s",e.localAddress,e.localPort,e.remoteAddress,e.remotePort)}})}e._debug("maybeReady pc %s channel %s",e._pcReady,e._channelReady),!e.connected&&!e._connecting&&e._pcReady&&e._channelReady&&(e._connecting=!0,t())},h.prototype._onInterval=function(){var e=this;!this._cb||!this._channel||this._channel.bufferedAmount>65536||this._onChannelBufferedAmountLow()},h.prototype._onSignalingStateChange=function(){var e=this;e.destroyed||("stable"!==e._pc.signalingState||e._firstStable||(e._isNegotiating=!1,e._debug("flushing sender queue",e._sendersAwaitingStable),e._sendersAwaitingStable.forEach(function(t){e._pc.removeTrack(t),e._queuedNegotiation=!0}),e._sendersAwaitingStable=[],e._queuedNegotiation&&(e._debug("flushing negotiation queue"),e._queuedNegotiation=!1,e._needsNegotiation()),e._debug("negotiate"),e.emit("negotiate")),e._firstStable=!1,e._debug("signalingStateChange %s",e._pc.signalingState),e.emit("signalingStateChange",e._pc.signalingState))},h.prototype._onIceCandidate=function(e){var t=this;this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())},h.prototype._onChannelMessage=function(e){var n=this;if(!this.destroyed){var r=e.data;r instanceof ArrayBuffer&&(r=t.from(r)),this.push(r)}},h.prototype._onChannelBufferedAmountLow=function(){var e=this;if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);var t=this._cb;this._cb=null,t(null)}},h.prototype._onChannelOpen=function(){var e=this;this.connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())},h.prototype._onChannelClose=function(){var e=this;this.destroyed||(this._debug("on channel close"),this.destroy())},h.prototype._onTrack=function(e){var t=this;t.destroyed||e.streams.forEach(function(n){t._debug("on track"),t.emit("track",e.track,n),t._remoteTracks.push({track:e.track,stream:n}),t._remoteStreams.some(function(e){return e.id===n.id})||(t._remoteStreams.push(n),setTimeout(function(){t.emit("stream",n)},0))})},h.prototype._debug=function(){var e=this,t=[].slice.call(arguments);t[0]="["+this._id+"] "+t[0],r.apply(null,t)}}).call(this,n(0).Buffer)},function(e,t){var n=1,r=65535,i=4,o,s=function(){n=n+1&65535};e.exports=function(e){o||(o=setInterval(s,250),o.unref&&o.unref());var t=4*(e||5),r=[0],i=1,a=n-1&65535;return function(e){var o=n-a&65535;for(o>t&&(o=t),a=n;o--;)i===t&&(i=0),r[i]=r[0===i?t-1:i-1],i++;e&&(r[i-1]+=e);var s=r[i-1],l=r.length>>=0;var o=e.byteLength-n;if(o<0)throw new RangeError("'offset' is out of bounds");if(void 0===i)i=o;else if(i>>>=0,i>o)throw new RangeError("'length' is out of bounds");return r?t.from(e.slice(n,n+i)):new t(new Uint8Array(e.slice(n,n+i)))}function s(e,n){if("string"==typeof n&&""!==n||(n="utf8"),!t.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');return r?t.from(e,n):new t(e,n)}function a(e,n,a){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return i(e)?o(e,n,a):"string"==typeof e?s(e,n):r?t.from(e):new t(e)}e.exports=a}).call(this,n(0).Buffer)},function(e){e.exports={name:"webtorrent",description:"Streaming torrent client",version:"0.103.1",author:{name:"WebTorrent, LLC",email:"feross@webtorrent.io",url:"https://webtorrent.io"},browser:{"./lib/server.js":!1,"./lib/tcp-pool.js":!1,"bittorrent-dht/client":!1,"fs-chunk-store":"memory-chunk-store","load-ip-set":!1,net:!1,os:!1,ut_pex:!1},browserify:{transform:["package-json-versionify"]},bugs:{url:"https://github.com/webtorrent/webtorrent/issues"},dependencies:{"addr-to-ip-port":"^1.4.2",bitfield:"^2.0.0","bittorrent-dht":"^9.0.0","bittorrent-protocol":"^3.0.0","chunk-store-stream":"^3.0.1","create-torrent":"^3.33.0",debug:"^4.1.0","end-of-stream":"^1.1.0","fs-chunk-store":"^1.6.2","immediate-chunk-store":"^2.0.0","load-ip-set":"^2.1.0","memory-chunk-store":"^1.2.0",mime:"^2.4.0",multistream:"^2.0.5","package-json-versionify":"^1.0.2","parse-numeric-range":"^0.0.2","parse-torrent":"^6.1.2",pump:"^3.0.0","random-iterate":"^1.0.1",randombytes:"^2.0.3","range-parser":"^1.2.0","readable-stream":"^3.0.6","render-media":"^3.0.0","run-parallel":"^1.1.6","run-parallel-limit":"^1.0.3","safe-buffer":"^5.0.1","simple-concat":"^1.0.0","simple-get":"^3.0.1","simple-peer":"^9.0.0","simple-sha1":"^2.0.8",speedometer:"^1.0.0","stream-to-blob":"^1.0.0","stream-to-blob-url":"^2.1.0","stream-with-known-length-to-buffer":"^1.0.0","torrent-discovery":"^9.1.1","torrent-piece":"^2.0.0",uniq:"^1.0.1","unordered-array-remove":"^1.0.2",ut_metadata:"^3.3.0",ut_pex:"^1.1.1"},devDependencies:{airtap:"2.0.2","babel-minify":"^0.5.0","bittorrent-tracker":"^9.4.0",brfs:"^2.0.0",browserify:"^16.2.3","cross-spawn":"^6.0.3",electron:"^4.0.0",finalhandler:"^1.0.0","network-address":"^1.1.0","run-series":"^1.1.4","serve-static":"^1.11.1",standard:"*",tape:"^4.6.0","webtorrent-fixtures":"^1.5.0"},engines:{node:">=4"},homepage:"https://webtorrent.io",keywords:["bittorrent","bittorrent client","download","mad science","p2p","peer-to-peer","peers","streaming","swarm","torrent","web torrent","webrtc","webrtc data","webtorrent"],license:"MIT",main:"index.js",repository:{type:"git",url:"git://github.com/webtorrent/webtorrent.git"},scripts:{build:"browserify -s WebTorrent -e ./ | minify > webtorrent.min.js","build-debug":"browserify -s WebTorrent -e ./ > webtorrent.debug.js",size:"npm run build && cat webtorrent.min.js | gzip | wc -c",test:"standard && npm run test-node && npm run test-browser","test-browser":"airtap -- test/*.js test/browser/*.js","test-browser-local":"airtap --local -- test/*.js test/browser/*.js","test-node":"tape test/*.js test/node/*.js","update-authors":"./scripts/update-authors.sh"}}},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function e(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===i.call(t)},l=function e(t){if(!t||"[object Object]"!==i.call(t))return!1;var n=r.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&r.call(t.constructor.prototype,"isPrototypeOf"),s;if(t.constructor&&!n&&!o)return!1;for(s in t);return void 0===s||r.call(t,s)},u=function e(t,n){o&&"__proto__"===n.name?o(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},c=function e(t,n){if("__proto__"===n){if(!r.call(t,n))return;if(s)return s(t,n).value}return t[n]};e.exports=function e(){var t,n,r,i,o,s,h=arguments[0],f=1,p=arguments.length,d=!1;for("boolean"==typeof h&&(d=h,h=arguments[1]||{},f=2),(null==h||"object"!=typeof h&&"function"!=typeof h)&&(h={});f32;)t=t.slice(1);var n=this._priv;r.strictEqual(t.length,32),r.strictEqual(n.length,32);var i=l.box.before(new Uint8Array(t),new Uint8Array(n));return o.from(i)}throw new Error("Invalid algorithm: "+this._algo)},m.prototype.generateKey=function(){var e=[],t,n;if("dsa"===this._algo)return this._dh.generateKeys(),e.push({name:"p",data:this._p.data}),e.push({name:"q",data:this._key.part.q.data}),e.push({name:"g",data:this._g.data}),e.push({name:"y",data:this._dh.getPublicKey()}),e.push({name:"x",data:this._dh.getPrivateKey()}),this._key=new c({type:"dsa",parts:e}),this._isPriv=!0,this._key;if("ecdsa"===this._algo){if(h)return this._dh.generateKeys(),e.push({name:"curve",data:o.from(this._curve)}),e.push({name:"Q",data:this._dh.getPublicKey()}),e.push({name:"d",data:this._dh.getPrivateKey()}),this._key=new c({type:"ecdsa",curve:this._curve,parts:e}),this._isPriv=!0,this._key;var s=this._ecParams.getN(),a=new d(i.randomBytes(s.bitLength())),u=s.subtract(d.ONE);return t=a.mod(u).add(d.ONE),n=this._ecParams.getG().multiply(t),t=o.from(t.toByteArray()),n=o.from(this._ecParams.getCurve().encodePointHex(n),"hex"),this._priv=new v(this._ecParams,t),e.push({name:"curve",data:o.from(this._curve)}),e.push({name:"Q",data:n}),e.push({name:"d",data:t}),this._key=new c({type:"ecdsa",curve:this._curve,parts:e}),this._isPriv=!0,this._key}if("curve25519"===this._algo){var f=l.box.keyPair();return t=o.from(f.secretKey),n=o.from(f.publicKey),t=o.concat([t,n]),r.strictEqual(t.length,64),r.strictEqual(n.length,32),e.push({name:"A",data:n}),e.push({name:"k",data:t}),this._key=new c({type:"curve25519",parts:e}),this._isPriv=!0,this._key}throw new Error("Invalid algorithm: "+this._algo)},m.prototype.generateKeys=m.prototype.generateKey,g.prototype.getCurve=function(){return this.curve},g.prototype.getG=function(){return this.g},g.prototype.getN=function(){return this.n},g.prototype.getH=function(){return this.h},v.prototype.deriveSharedSecret=function(e){r.ok(e instanceof y);var t=e._pub.multiply(this._priv);return o.from(t.getX().toBigInteger().toByteArray())}},function(e,t,n){e.exports={read:p,readPkcs1:g,write:d,writePkcs1:S};var r=n(25),i=n(84),o=n(29).Buffer,s=n(48),a=n(42),l=n(41),u=n(46),c=n(92),h=n(176),f=h.readECDSACurve;function p(e,t){return c.read(e,t,"pkcs1")}function d(e,t){return c.write(e,t,"pkcs1")}function m(e,t){return r.strictEqual(e.peek(),i.Ber.Integer,t+" is not an Integer"),a.mpNormalize(e.readString(i.Ber.Integer,!0))}function g(e,t,n){switch(e){case"RSA":if("public"===t)return y(n);if("private"===t)return v(n);throw new Error("Unknown key type: "+t);case"DSA":if("public"===t)return w(n);if("private"===t)return b(n);throw new Error("Unknown key type: "+t);case"EC":case"ECDSA":if("private"===t)return E(n);if("public"===t)return k(n);throw new Error("Unknown key type: "+t);case"EDDSA":case"EdDSA":if("private"===t)return _(n);throw new Error(t+" keys not supported with EdDSA");default:throw new Error("Unknown key algo: "+e)}}function y(e){var t=m(e,"modulus"),n=m(e,"exponent"),r={type:"rsa",parts:[{name:"e",data:n},{name:"n",data:t}]};return new l(r)}function v(e){var t=m(e,"version");r.strictEqual(t[0],0);var n=m(e,"modulus"),i=m(e,"public exponent"),o=m(e,"private exponent"),s=m(e,"prime1"),a=m(e,"prime2"),l=m(e,"exponent1"),c=m(e,"exponent2"),h=m(e,"iqmp"),f={type:"rsa",parts:[{name:"n",data:n},{name:"e",data:i},{name:"d",data:o},{name:"iqmp",data:h},{name:"p",data:s},{name:"q",data:a},{name:"dmodp",data:l},{name:"dmodq",data:c}]};return new u(f)}function b(e){var t=m(e,"version");r.strictEqual(t.readUInt8(0),0);var n=m(e,"p"),i=m(e,"q"),o=m(e,"g"),s=m(e,"y"),a=m(e,"x"),l={type:"dsa",parts:[{name:"p",data:n},{name:"q",data:i},{name:"g",data:o},{name:"y",data:s},{name:"x",data:a}]};return new u(l)}function _(e){var t=m(e,"version");r.strictEqual(t.readUInt8(0),1);var n=e.readString(i.Ber.OctetString,!0);e.readSequence(160);var o=e.readOID();r.strictEqual(o,"1.3.101.112","the ed25519 curve identifier"),e.readSequence(161);var s=a.readBitString(e),l={type:"ed25519",parts:[{name:"A",data:a.zeroPadToLength(s,32)},{name:"k",data:n}]};return new u(l)}function w(e){var t=m(e,"y"),n=m(e,"p"),r=m(e,"q"),i=m(e,"g"),o={type:"dsa",parts:[{name:"y",data:t},{name:"p",data:n},{name:"q",data:r},{name:"g",data:i}]};return new l(o)}function k(e){e.readSequence();var t=e.readOID();r.strictEqual(t,"1.2.840.10045.2.1","must be ecPublicKey");for(var n=e.readOID(),u,c=Object.keys(s.curves),h=0;h>1,c=-7,h=n?i-1:0,f=n?-1:1,p=e[t+h];for(h+=f,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+e[t+h],h+=f,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+e[t+h],h+=f,c-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=u}return(p?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,l,u=8*o-i-1,c=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),t+=s+h>=1?f/l:f*Math.pow(2,1-h),t*l>=2&&(s++,l/=2),s+h>=c?(a=0,s=c):s+h>=1?(a=(t*l-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;e[n+p]=255&s,p+=d,s/=256,u-=8);e[n+p-d]|=128*m}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(){var t=(0,i.default)(arguments),n=t.pop();e.call(this,t,n)}};var r=n(86),i=o(r);function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(8))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var r=n(244),i=a(r),o=n(37),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function l(e,t,n,r){(0,i.default)(t)(e,(0,s.default)(n),r)}e.exports=t.default},function(e,t,n){var r=n(659),i=n(87),o=Object.prototype,s=o.hasOwnProperty,a=o.propertyIsEnumerable,l=r(function(){return arguments}())?r:function(e){return i(e)&&s.call(e,"callee")&&!a.call(e,"callee")};e.exports=l},function(e,t,n){(function(e){var r=n(79),i=n(660),o=t&&!t.nodeType&&t,s=o&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===o,l=a?r.Buffer:void 0,u=l?l.isBuffer:void 0,c=u||i;e.exports=c}).call(this,n(85)(e))},function(e,t){var n=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function i(e,t){var i=typeof e;return t=null==t?n:t,!!t&&("number"==i||"symbol"!=i&&r.test(e))&&e>-1&&e%1==0&&e0)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===l.prototype||(t=c(t)),r)o.endEmitted?e.emit("error",new k):B(e,o,t,!0);else if(o.ended)e.emit("error",new _);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?B(e,o,t,!1):U(e,o)):B(e,o,t,!1)}else r||(o.reading=!1,U(e,o));return!o.ended&&(o.length=P?e=P:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function D(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=N(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function M(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?F(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,L(e)))}}function F(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(L,e))}function L(e){var t=e._readableState;p("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||e.emit("readable"),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,W(e)}function U(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(q,e,t))}function q(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function H(e){p("readable nexttick read 0"),e.read(0)}function V(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick($,e,t))}function $(e,t){p("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(p("flow",t.flowing);t.flowing&&null!==e.read(););}function G(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function Y(e){var t=e._readableState;p("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(Z,t,e))}function Z(e,t){p("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function J(e,t){for(var n=0,r=e.length;n=t.highWaterMark:t.length>0)||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Y(this):F(this),null;if(e=D(e,t),0===e&&t.ended)return 0===t.length&&Y(this),null;var r=t.needReadable,i;return p("need readable",r),(0===t.length||t.length-e0?G(e,t):null,null===i?(t.needReadable=!0,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Y(this)),null!==i&&this.emit("data",i),i},j.prototype._read=function(e){this.emit("error",new w("_read()"))},j.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,p("pipe count=%d opts=%j",i.pipesCount,t);var o=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=o?u:v;function l(e,t){p("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,f())}function u(){p("onend"),e.end()}i.endEmitted?r.nextTick(a):n.once("end",a),e.on("unpipe",l);var c=z(n);e.on("drain",c);var h=!1;function f(){p("cleanup"),e.removeListener("close",g),e.removeListener("finish",y),e.removeListener("drain",c),e.removeListener("error",m),e.removeListener("unpipe",l),n.removeListener("end",u),n.removeListener("end",v),n.removeListener("data",d),h=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||c()}function d(t){p("ondata");var r=e.write(t);p("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==J(i.pipes,e))&&!h&&(p("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function m(t){p("onerror",t),v(),e.removeListener("error",m),0===s(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",y),v()}function y(){p("onfinish"),e.removeListener("close",g),v()}function v(){p("unpipe"),n.unpipe(e)}return n.on("data",d),T(e,"error",m),e.once("close",g),e.once("finish",y),e.emit("pipe",n),i.flowing||(p("pipe resume"),n.resume()),e},j.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,p("on readable",i.length,i.reading),i.length?F(this):i.reading||r.nextTick(H,this))),n},j.prototype.addListener=j.prototype.on,j.prototype.removeListener=function(e,t){var n=a.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(K,this),n},j.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(K,this),t},j.prototype.resume=function(){var e=this._readableState;return e.flowing||(p("resume"),e.flowing=!e.readableListening,V(this,e)),e.paused=!1,this},j.prototype.pause=function(){return p("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(p("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},j.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",function(){if(p("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){if(p("wrapped data"),n.decoder&&(i=n.decoder.write(i)),(!n.objectMode||null!==i&&void 0!==i)&&(n.objectMode||i&&i.length)){var o=t.push(i);o||(r=!0,e.pause())}}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function t(n){return function t(){return e[n].apply(e,arguments)}}(i));for(var o=0;o-1))throw new S(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,n){n(new v("_write()"))},T.prototype._writev=null,T.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||H(this,r,n),this},Object.defineProperty(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=p.destroy,T.prototype._undestroy=p.undestroy,T.prototype._destroy=function(e,t){t(e)}}).call(this,n(8),n(3))},function(e,t,n){"use strict";e.exports=c;var r=n(112).codes,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,s=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,l=n(113);function u(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length(e=e.slice(1),new s(e))}});function f(e){let t;try{t=a(e)}catch(e){t=!1}if(t)throw new Error("The object passed has circular references");function n(e){if(!e||r.isBuffer(e)||"string"==typeof e)return e;if(Array.isArray(e))return e.map(n);if(s.isCID(e))return c(e);const t=Object.keys(e);if(1===t.length&&"/"===t[0])return c(e["/"]);if(t.length>0){const r={};return t.forEach(t=>{"object"==typeof e[t]?r[t]=n(e[t]):r[t]=e[t]}),r}return e}return n(e)}t=e.exports,t.serialize=((e,t)=>{let n;try{const r=f(e);n=i.encode(r)}catch(e){return setImmediate(()=>t(e))}setImmediate(()=>t(null,n))}),t.deserialize=((e,t)=>{let n;try{n=h.decodeFirst(e)}catch(e){return setImmediate(()=>t(e))}setImmediate(()=>t(null,n))}),t.cid=((e,n,r)=>{"function"==typeof n&&(r=n,n={}),n=n||{};const i=n.hashAlg||l.defaultHashAlg,a=n.hashLen,u=void 0===n.version?1:n.version;t.serialize(e,(e,t)=>{if(e)return r(e);o(t,i,a,(e,t)=>{if(e)return r(e);r(null,new s(u,l.multicodec,t))})})})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t,r){const i=n(325),o=n(55),s=n(712),a=n(247),l=n(190),u=n(354),c=n(355),{URL:h}=n(191);class f{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=>l.NEG_ONE.minus(a.arrayBufferToBignumber(e)),4:e=>l.TEN.pow(e[0]).times(e[1]),5:e=>l.TWO.pow(e[0]).times(e[1]),32:e=>new h(e),35:e=>new RegExp(e)},e.tags),this.parser=s(r,{log:console.log.bind(console),pushInt:this.pushInt.bind(this),pushInt32:this.pushInt32.bind(this),pushInt32Neg:this.pushInt32Neg.bind(this),pushInt64:this.pushInt64.bind(this),pushInt64Neg:this.pushInt64Neg.bind(this),pushFloat:this.pushFloat.bind(this),pushFloatSingle:this.pushFloatSingle.bind(this),pushFloatDouble:this.pushFloatDouble.bind(this),pushTrue:this.pushTrue.bind(this),pushFalse:this.pushFalse.bind(this),pushUndefined:this.pushUndefined.bind(this),pushNull:this.pushNull.bind(this),pushInfinity:this.pushInfinity.bind(this),pushInfinityNeg:this.pushInfinityNeg.bind(this),pushNaN:this.pushNaN.bind(this),pushNaNNeg:this.pushNaNNeg.bind(this),pushArrayStart:this.pushArrayStart.bind(this),pushArrayStartFixed:this.pushArrayStartFixed.bind(this),pushArrayStartFixed32:this.pushArrayStartFixed32.bind(this),pushArrayStartFixed64:this.pushArrayStartFixed64.bind(this),pushObjectStart:this.pushObjectStart.bind(this),pushObjectStartFixed:this.pushObjectStartFixed.bind(this),pushObjectStartFixed32:this.pushObjectStartFixed32.bind(this),pushObjectStartFixed64:this.pushObjectStartFixed64.bind(this),pushByteString:this.pushByteString.bind(this),pushByteStringStart:this.pushByteStringStart.bind(this),pushUtf8String:this.pushUtf8String.bind(this),pushUtf8StringStart:this.pushUtf8StringStart.bind(this),pushSimpleUnassigned:this.pushSimpleUnassigned.bind(this),pushTagUnassigned:this.pushTagUnassigned.bind(this),pushTagStart:this.pushTagStart.bind(this),pushTagStart4:this.pushTagStart4.bind(this),pushTagStart8:this.pushTagStart8.bind(this),pushBreak:this.pushBreak.bind(this)},this._heap)}get _depth(){return this._parents.length}get _currentParent(){return this._parents[this._depth-1]}get _ref(){return this._currentParent.ref}_closeParent(){var e=this._parents.pop();if(e.length>0)throw new Error(`Missing ${e.length} elements`);switch(e.type){case l.PARENT.TAG:this._push(this.createTag(e.ref[0],e.ref[1]));break;case l.PARENT.BYTE_STRING:this._push(this.createByteString(e.ref,e.length));break;case l.PARENT.UTF8_STRING:this._push(this.createUtf8String(e.ref,e.length));break;case l.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 l.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 l.PARENT.ARRAY:this._push(this.createArray(e.ref,e.length))}this._currentParent&&this._currentParent.type===l.PARENT.TAG&&this._dec()}_dec(){const e=this._currentParent;e.length<0||(e.length--,0===e.length&&this._closeParent())}_push(e,t){const n=this._currentParent;switch(n.values++,n.type){case l.PARENT.ARRAY:case l.PARENT.BYTE_STRING:case l.PARENT.UTF8_STRING:n.length>-1?this._ref[this._ref.length-n.length]=e:this._ref.push(e),this._dec();break;case l.PARENT.OBJECT:null!=n.tmpKey?(this._ref[n.tmpKey]=e,n.tmpKey=null,this._dec()):(n.tmpKey=e,"string"!=typeof n.tmpKey&&(n.type=l.PARENT.MAP,n.ref=a.buildMap(n.ref)));break;case l.PARENT.MAP:null!=n.tmpKey?(this._ref.set(n.tmpKey,e),n.tmpKey=null,this._dec()):n.tmpKey=e;break;case l.PARENT.TAG:this._ref.push(e),t||this._dec();break;default:throw new Error("Unknown parent type")}}_createParent(e,t,n){this._parents[this._depth]={type:t,length:n,ref:e,values:0,tmpKey:null}}_reset(){this._res=[],this._parents=[{type:l.PARENT.ARRAY,length:-1,ref:this._res,values:0,tmpKey:null}]}createTag(e,t){const n=this._knownTags[e];return n?n(t):new c(e,t)}createMap(e,t){return e}createObject(e,t){return e}createArray(e,t){return e}createByteString(e,n){return t.concat(e)}createByteStringFromHeap(e,n){return e===n?t.alloc(0):t.from(this._heap.slice(e,n))}createInt(e){return e}createInt32(e,t){return a.buildInt32(e,t)}createInt64(e,t,n,r){return a.buildInt64(e,t,n,r)}createFloat(e){return e}createFloatSingle(e,t,n,r){return i.read([e,t,n,r],0,!1,23,4)}createFloatDouble(e,t,n,r,o,s,a,l){return i.read([e,t,n,r,o,s,a,l],0,!1,52,8)}createInt32Neg(e,t){return-1-a.buildInt32(e,t)}createInt64Neg(e,t,n,r){const i=a.buildInt32(e,t),s=a.buildInt32(n,r);return i>l.MAX_SAFE_HIGH?l.NEG_ONE.minus(new o(i).times(l.SHIFT32).plus(s)):-1-(i*l.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 u(e)}pushInt(e){this._push(this.createInt(e))}pushInt32(e,t){this._push(this.createInt32(e,t))}pushInt64(e,t,n,r){this._push(this.createInt64(e,t,n,r))}pushFloat(e){this._push(this.createFloat(e))}pushFloatSingle(e,t,n,r){this._push(this.createFloatSingle(e,t,n,r))}pushFloatDouble(e,t,n,r,i,o,s,a){this._push(this.createFloatDouble(e,t,n,r,i,o,s,a))}pushInt32Neg(e,t){this._push(this.createInt32Neg(e,t))}pushInt64Neg(e,t,n,r){this._push(this.createInt64Neg(e,t,n,r))}pushTrue(){this._push(this.createTrue())}pushFalse(){this._push(this.createFalse())}pushNull(){this._push(this.createNull())}pushUndefined(){this._push(this.createUndefined())}pushInfinity(){this._push(this.createInfinity())}pushInfinityNeg(){this._push(this.createInfinityNeg())}pushNaN(){this._push(this.createNaN())}pushNaNNeg(){this._push(this.createNaNNeg())}pushArrayStart(){this._createParent([],l.PARENT.ARRAY,-1)}pushArrayStartFixed(e){this._createArrayStartFixed(e)}pushArrayStartFixed32(e,t){const n=a.buildInt32(e,t);this._createArrayStartFixed(n)}pushArrayStartFixed64(e,t,n,r){const i=a.buildInt64(e,t,n,r);this._createArrayStartFixed(i)}pushObjectStart(){this._createObjectStartFixed(-1)}pushObjectStartFixed(e){this._createObjectStartFixed(e)}pushObjectStartFixed32(e,t){const n=a.buildInt32(e,t);this._createObjectStartFixed(n)}pushObjectStartFixed64(e,t,n,r){const i=a.buildInt64(e,t,n,r);this._createObjectStartFixed(i)}pushByteStringStart(){this._parents[this._depth]={type:l.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:l.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:l.PARENT.TAG,length:1,ref:[e]}}pushTagStart4(e,t){this.pushTagStart(a.buildInt32(e,t))}pushTagStart8(e,t,n,r){this.pushTagStart(a.buildInt64(e,t,n,r))}pushTagUnassigned(e){this._push(this.createTag(e))}pushBreak(){if(this._currentParent.length>-1)throw new Error("Unexpected break");this._closeParent()}_createObjectStartFixed(e){0!==e?this._createParent({},l.PARENT.OBJECT,e):this._push(this.createObject({}))}_createArrayStartFixed(e){0!==e?this._createParent(new Array(e),l.PARENT.ARRAY,e):this._push(this.createArray([]))}_decode(e){if(0===e.byteLength)throw new Error("Input too short");this._reset(),this._heap8.set(e);const t=this.parser.parse(e.byteLength);if(this._depth>1){for(;0===this._currentParent.length;)this._closeParent();if(this._depth>1)throw new Error("Undeterminated nesting")}if(t>0)throw new Error("Failed to parse");if(0===this._res.length)throw new Error("No valid result")}decodeFirst(e){return this._decode(e),this._res[0]}decodeAll(e){return this._decode(e),this._res}static decode(e,n){"string"==typeof e&&(e=t.from(e,n||"hex"));const r=new f({size:e.length});return r.decodeFirst(e)}static decodeAll(e,n){"string"==typeof e&&(e=t.from(e,n||"hex"));const r=new f({size:e.length});return r.decodeAll(e)}}f.decodeFirst=f.decode,e.exports=f}).call(this,n(0).Buffer,n(8))},function(e,t,n){"use strict";const r=n(190),i=r.MT,o=r.SIMPLE,s=r.SYMS;class a{constructor(e){if("number"!=typeof e)throw new Error("Invalid Simple type: "+typeof e);if(e<0||e>255||(0|e)!==e)throw new Error("value must be a small positive integer: "+e);this.value=e}toString(){return"simple("+this.value+")"}inspect(){return"simple("+this.value+")"}encodeCBOR(e){return e._pushInt(this.value,i.SIMPLE_FLOAT)}static isSimple(e){return e instanceof a}static decode(e,t){switch(null==t&&(t=!0),e){case o.FALSE:return!1;case o.TRUE:return!0;case o.NULL:return t?null:s.NULL;case o.UNDEFINED:return t?void 0:s.UNDEFINED;case-1:if(!t)throw new Error("Invalid BREAK");return s.BREAK;default:return new a(e)}}}e.exports=a},function(e,t,n){"use strict";class r{constructor(e,t,n){if(this.tag=e,this.value=t,this.err=n,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(e){return e._pushTag(this.tag),e.pushAny(this.value)}convert(e){var t,n;if(n=null!=e?e[this.tag]:void 0,"function"!=typeof n&&(n=r["_tag"+this.tag],"function"!=typeof n))return this;try{return n.call(r,this.value)}catch(e){return t=e,this.err=t,this}}}e.exports=r},function(e,t,n){"use strict";const r=self.location?self.location.protocol+"//"+self.location.host:"",i=self.URL;class o{constructor(e,t=r){this.super=new i(e,t),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set origin(e){this.super.origin=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set searchParams(e){this.super.searchParams=e}set username(e){this.super.username=e}createObjectURL(e){return this.super.createObjectURL(e)}revokeObjectURL(e){this.super.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}}function s(e){if("string"==typeof e){const t=new i(e);return t.toString()}if(!(e instanceof i)){const t=e.username&&e.password?`${e.username}:${e.password}@`:"",n=e.auth?e.auth+"@":"",r=e.port?":"+e.port:"",i=e.protocol?e.protocol+"//":"",o=e.host||"",s=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),l=e.hash||"",u=e.pathname||"",c=e.path||u+a;return`${i}${t||n}${o||s+r}${c}${l}`}}e.exports={URLWithLegacySupport:o,URLSearchParams:self.URLSearchParams,defaultBase:r,format:s}},function(e,t,n){(function(r,i){var o; /** * [js-sha3]{@link https://github.com/emn178/js-sha3} * @@ -60,21 +51,7 @@ var r=function(e,t){return function(){var n=Array.prototype.slice.call(arguments * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT */ -!function(){"use strict";var s="input is invalid type",a="finalize already called",u="object"==typeof window,l=u?window:{};l.JS_SHA3_NO_WINDOW&&(u=!1);var c=!u&&"object"==typeof self,f=!l.JS_SHA3_NO_NODE_JS&&"object"==typeof r&&r.versions&&r.versions.node;f?l=i:c&&(l=self);var h=!l.JS_SHA3_NO_COMMON_JS&&"object"==typeof e&&e.exports,p=n(446),d=!l.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,m="0123456789abcdef".split(""),g=[31,7936,2031616,520093696],y=[4,1024,262144,67108864],b=[1,256,65536,16777216],v=[6,1536,393216,100663296],w=[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],k=[224,256,384,512],S=[128,256],E=["hex","buffer","arrayBuffer","array","digest"],x={128:168,256:136};!l.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!d||!l.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var C=function(e,t,n){return function(r){return new H(e,t,e).update(r)[n]()}},A=function(e,t,n){return function(r,i){return new H(e,t,i).update(r)[n]()}},I=function(e,t,n){return function(t,r,i,o){return M["cshake"+e].update(t,r,i,o)[n]()}},T=function(e,t,n){return function(t,r,i,o){return M["kmac"+e].update(t,r,i,o)[n]()}},j=function(e,t,n,r){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function V(e,t,n){H.call(this,e,t,n)}H.prototype.update=function(e){if(this.finalized)throw new Error(a);var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(s);if(null===e)throw new Error(s);if(d&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||d&&ArrayBuffer.isView(e)))throw new Error(s);t=!0}for(var r=this.blocks,i=this.byteCount,o=e.length,u=this.blockCount,l=0,c=this.s,f,h;l>2]|=e[l]<>2]|=h<>2]|=(192|h>>6)<>2]|=(128|63&h)<=57344?(r[f>>2]|=(224|h>>12)<>2]|=(128|h>>6&63)<>2]|=(128|63&h)<>2]|=(240|h>>18)<>2]|=(128|h>>12&63)<>2]|=(128|h>>6&63)<>2]|=(128|63&h)<=i){for(this.start=f-i,this.block=r[u],f=0;f>=8,n=255&e;n>0;)i.unshift(n),e>>=8,n=255&e,++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},H.prototype.encodeString=function(e){var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(s);if(null===e)throw new Error(s);if(d&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||d&&ArrayBuffer.isView(e)))throw new Error(s);t=!0}var r=0,i=e.length;if(t)r=i;else for(var o=0;o=57344?r+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++o)),r+=4)}return r+=this.encode(8*r),this.update(e),r},H.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t>4&15]+m[15&a]+m[a>>12&15]+m[a>>8&15]+m[a>>20&15]+m[a>>16&15]+m[a>>28&15]+m[a>>24&15];o%e==0&&(W(t),i=0)}return r&&(a=t[i],s+=m[a>>4&15]+m[15&a],r>1&&(s+=m[a>>12&15]+m[a>>8&15]),r>2&&(s+=m[a>>20&15]+m[a>>16&15])),s},H.prototype.arrayBuffer=function(){this.finalize();var e=this.blockCount,t=this.s,n=this.outputBlocks,r=this.extraBytes,i=0,o=0,s=this.outputBits>>3,a;a=r?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(a);o>8&255,s[a+2]=u>>16&255,s[a+3]=u>>24&255;o%e==0&&W(t)}return r&&(a=o<<2,u=t[i],s[a]=255&u,r>1&&(s[a+1]=u>>8&255),r>2&&(s[a+2]=u>>16&255)),s},V.prototype=new H,V.prototype.finalize=function(){return this.encode(this.outputBits,!0),H.prototype.finalize.call(this)};var W=function(e){var t,n,r,i,o,s,a,u,l,c,f,h,p,d,m,g,y,b,v,w,k,S,E,x,C,A,I,T,j,O,P,B,R,N,M,L,F,D,U,z,q,K,H,V,W,$,G,Y,J,Z,Q,X,ee,te,ne,re,ie,oe,se,ae,ue,le,ce;for(r=0;r<48;r+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],l=e[5]^e[15]^e[25]^e[35]^e[45],c=e[6]^e[16]^e[26]^e[36]^e[46],f=e[7]^e[17]^e[27]^e[37]^e[47],h=e[8]^e[18]^e[28]^e[38]^e[48],p=e[9]^e[19]^e[29]^e[39]^e[49],t=h^(s<<1|a>>>31),n=p^(a<<1|s>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=i^(u<<1|l>>>31),n=o^(l<<1|u>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=s^(c<<1|f>>>31),n=a^(f<<1|c>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=u^(h<<1|p>>>31),n=l^(p<<1|h>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=c^(i<<1|o>>>31),n=f^(o<<1|i>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,d=e[0],m=e[1],$=e[11]<<4|e[10]>>>28,G=e[10]<<4|e[11]>>>28,T=e[20]<<3|e[21]>>>29,j=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ue=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,H=e[41]<<18|e[40]>>>14,N=e[2]<<1|e[3]>>>31,M=e[3]<<1|e[2]>>>31,g=e[13]<<12|e[12]>>>20,y=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,O=e[33]<<13|e[32]>>>19,P=e[32]<<13|e[33]>>>19,le=e[42]<<2|e[43]>>>30,ce=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,L=e[14]<<6|e[15]>>>26,F=e[15]<<6|e[14]>>>26,b=e[25]<<11|e[24]>>>21,v=e[24]<<11|e[25]>>>21,Z=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,B=e[45]<<29|e[44]>>>3,R=e[44]<<29|e[45]>>>3,x=e[6]<<28|e[7]>>>4,C=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,D=e[26]<<25|e[27]>>>7,U=e[27]<<25|e[26]>>>7,w=e[36]<<21|e[37]>>>11,k=e[37]<<21|e[36]>>>11,X=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,V=e[8]<<27|e[9]>>>5,W=e[9]<<27|e[8]>>>5,A=e[18]<<20|e[19]>>>12,I=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,z=e[38]<<8|e[39]>>>24,q=e[39]<<8|e[38]>>>24,S=e[48]<<14|e[49]>>>18,E=e[49]<<14|e[48]>>>18,e[0]=d^~g&b,e[1]=m^~y&v,e[10]=x^~A&T,e[11]=C^~I&j,e[20]=N^~L&D,e[21]=M^~F&U,e[30]=V^~$&Y,e[31]=W^~G&J,e[40]=te^~re&oe,e[41]=ne^~ie&se,e[2]=g^~b&w,e[3]=y^~v&k,e[12]=A^~T&O,e[13]=I^~j&P,e[22]=L^~D&z,e[23]=F^~U&q,e[32]=$^~Y&Z,e[33]=G^~J&Q,e[42]=re^~oe&ae,e[43]=ie^~se&ue,e[4]=b^~w&S,e[5]=v^~k&E,e[14]=T^~O&B,e[15]=j^~P&R,e[24]=D^~z&K,e[25]=U^~q&H,e[34]=Y^~Z&X,e[35]=J^~Q&ee,e[44]=oe^~ae&le,e[45]=se^~ue&ce,e[6]=w^~S&d,e[7]=k^~E&m,e[16]=O^~B&x,e[17]=P^~R&C,e[26]=z^~K&N,e[27]=q^~H&M,e[36]=Z^~X&V,e[37]=Q^~ee&W,e[46]=ae^~le&te,e[47]=ue^~ce&ne,e[8]=S^~d&g,e[9]=E^~m&y,e[18]=B^~x&A,e[19]=R^~C&I,e[28]=K^~N&L,e[29]=H^~M&F,e[38]=X^~V&$,e[39]=ee^~W&G,e[48]=le^~te&re,e[49]=ce^~ne&ie,e[0]^=_[r],e[1]^=_[r+1]};if(h)e.exports=M;else{for(F=0;F(function(n,r){let i;try{i=t(n)}catch(t){return void e.nextTick(r,t)}e.nextTick(r,null,i)})),t.toBuf=((e,t)=>r=>{let i=e(r,t);return n.from(i,"hex")}),t.fromString=((e,t)=>r=>{const i=n.isBuffer(r)?r.toString():r;return e(i,t)}),t.fromNumberTo32BitBuf=((e,t)=>r=>{let i=e(r,t);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return n.from(o)})}).call(this,n(2),n(0).Buffer)},function(e,t,n){(function(t){var r=n(867),i=n(450),o;function s(e,t){return"function"!=typeof t?e:e.then(function(e){o(function(){t(null,e)})},function(e){o(function(){t(e)})})}function a(e){return s(this,e)}function u(e){if(e&&i(e)){e.nodeify=a;var t=e.then;return e.then=function(){return u(t.apply(this,arguments))},e}"function"==typeof e?e.prototype.nodeify=a:r.prototype.nodeify=a}function l(e){if(!(this instanceof l))return new l(e);r.call(this,e),u(this)}o="function"==typeof setImmediate?setImmediate:"object"==typeof t&&t&&t.nextTick?t.nextTick:function(e){setTimeout(e,0)},e.exports=s,s.extend=u,s.Promise=l,l.prototype=Object.create(r.prototype),l.prototype.constructor=l}).call(this,n(2))},function(e,t){function n(e){return e&&"function"==typeof e.then}e.exports=n},function(e,t,n){var r=n(869),i=n(870);e.exports={blake2b:r.blake2b,blake2bHex:r.blake2bHex,blake2bInit:r.blake2bInit,blake2bUpdate:r.blake2bUpdate,blake2bFinal:r.blake2bFinal,blake2s:i.blake2s,blake2sHex:i.blake2sHex,blake2sInit:i.blake2sInit,blake2sUpdate:i.blake2sUpdate,blake2sFinal:i.blake2sFinal}},function(e,t,n){(function(t){var n="Input must be an string, Buffer or Uint8Array";function r(e){var r;if(e instanceof Uint8Array)r=e;else if(e instanceof t)r=new Uint8Array(e);else{if("string"!=typeof e)throw new Error(n);r=new Uint8Array(t.from(e,"utf8"))}return r}function i(e){return Array.prototype.map.call(e,function(e){return(e<16?"0":"")+e.toString(16)}).join("")}function o(e){return(4294967296+e).toString(16).substring(1)}function s(e,t,n){for(var r="\n"+e+" = ",i=0;i{"function"==typeof t&&(n=t,t=void 0),i.deserialize(e,(e,i)=>{if(e)return n(e);if(!t||"/"===t)return n(null,{value:i,remainderPath:""});const s=t.split("/"),a=o(i).get(s);if(void 0!==a)return n(null,{value:a,remainderPath:""});let u;const l=s.length;for(let e=0;e{"function"==typeof t&&(n=t,t=void 0),t=t||{},i.deserialize(e,(e,t)=>{if(e)return n(e);const r=a(t),i=r.map(e=>e.path);n(null,i)})}),t.isLink=((e,n,r)=>{t.resolve(e,n,(e,t)=>e?r(e):t.remainderPath.length>0?r(new Error("path out of scope")):void(s.isCID(t.value)?r(null,t.value):r(null,!1)))})}).call(this,n(0).Buffer)},function(e,t){var n=e.exports=function(e){return new r(e)};function r(e){this.value=e}function i(e,t,n){var r=[],i=[],a=!0;return function e(u){var l=n?o(u):u,c={},f=!0,h={node:l,node_:u,path:[].concat(r),parent:i[i.length-1],parents:i,key:r.slice(-1)[0],isRoot:0===r.length,level:r.length,circular:null,update:function(e,t){h.isRoot||(h.parent.node[h.key]=e),h.node=e,t&&(f=!1)},delete:function(e){delete h.parent.node[h.key],e&&(f=!1)},remove:function(e){d(h.parent.node)?h.parent.node.splice(h.key,1):delete h.parent.node[h.key],e&&(f=!1)},keys:null,before:function(e){c.before=e},after:function(e){c.after=e},pre:function(e){c.pre=e},post:function(e){c.post=e},stop:function(){a=!1},block:function(){f=!1}};if(!a)return h;function p(){if("object"==typeof h.node&&null!==h.node){h.keys&&h.node_===h.node||(h.keys=s(h.node)),h.isLeaf=0==h.keys.length;for(var e=0;e{r([t=>o.deserialize(e,t),(e,r)=>{if(!t)return n(null,{value:e,remainderPath:""});const i=t.split("/");if("Links"===i[0]){let t="";if(!i[1])return r(null,{value:e.links.map(e=>e.toJSON()),remainderPath:""});const n={};e.links.forEach((e,t)=>{const r=e.toJSON();n[t]=n[r.name]={cid:r.cid,name:r.name,size:r.size}});let o=n[i[1]];"Hash"===i[2]?o={"/":o.cid}:"Tsize"===i[2]?o=o.size:"Name"===i[2]&&(o=o.name),t=i.slice(3).join("/"),r(null,{value:o,remainderPath:t})}else if("Data"===i[0])r(null,{value:e.data,remainderPath:""});else{const t={};e.links.forEach((e,n)=>{const r=e.toJSON();t[r.name]={cid:r.cid,name:r.name,size:r.size}});const n=t[i[0]];if(n)return r(null,{value:{"/":n.cid},remainderPath:i.slice(1).join("/")});r(new Error("path not available"))}}],n)}),t.tree=((e,t,n)=>{"function"==typeof t&&(n=t,t={}),t=t||{},o.deserialize(e,(e,t)=>{if(e)return n(e);const r=[];r.push("Links"),t.links.forEach((e,t)=>{r.push(`Links/${t}/Name`),r.push(`Links/${t}/Tsize`),r.push(`Links/${t}/Hash`)}),r.push("Data"),n(null,r)})}),t.isLink=((e,n,r)=>{t.resolve(e,n,(e,t)=>{if(e)return r(e);if(t.remainderPath.length>0)return r(new Error("path out of scope"));if("object"==typeof t.value&&t.value["/"]){let n;try{n=i.isCID(new i(t.value["/"]))}catch(e){n=!1}if(n)return r(null,t.value)}r(null,!1)})})},function(e,t,n){"use strict";(function(r){const i=n(71),o=i(n(308));n(140),n(309),n(310);const s=n(19);t=e.exports;const a={rsa:n(899),ed25519:n(913),secp256k1:n(917)(o,n(315))};function u(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=n(933),t.generateEphemeralKeyPair=n(935),t.generateKeyPair=((e,t,n)=>{let r=a[e.toLowerCase()];if(!r)return n(new Error("invalid or unsupported key type"));r.generateKeyPair(t,n)}),t.generateKeyPairFromSeed=((e,t,n,r)=>{let i=a[e.toLowerCase()];return i?"ed25519"!==e.toLowerCase()?r(new Error("Seed key derivation is unimplemented for RSA or secp256k1")):void i.generateKeyPairFromSeed(t,n,r):r(new Error("invalid or unsupported key type"))}),t.unmarshalPublicKey=(e=>{const t=o.PublicKey.decode(e),n=t.Data;switch(t.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPublicKey(n);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PublicKey(n);case o.KeyType.Secp256k1:if(a.secp256k1)return a.secp256k1.unmarshalSecp256k1PublicKey(n);throw new Error("secp256k1 support requires libp2p-crypto-secp256k1 package");default:throw new Error("invalid or unsupported key type")}}),t.marshalPublicKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let n;try{n=o.PrivateKey.decode(e)}catch(e){return t(e)}const r=n.Data;switch(n.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPrivateKey(r,t);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PrivateKey(r,t);case o.KeyType.Secp256k1:return a.secp256k1?a.secp256k1.unmarshalSecp256k1PrivateKey(r,t):t(new Error("secp256k1 support requires libp2p-crypto-secp256k1 package"));default:t(new Error("invalid or unsupported key type"))}}),t.marshalPrivateKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,n)=>{try{const i=s.pki.decryptRsaPrivateKey(e,t);if(null===i)throw new Error("Cannot read the key, most likely the password is wrong or not a RSA key");let o=s.asn1.toDer(s.pki.privateKeyToAsn1(i));return o=r.from(o.getBytes(),"binary"),a.rsa.unmarshalRsaPrivateKey(o,n)}catch(e){n(e)}})}).call(this,n(0).Buffer)},function(e,t,n){var r=n(19),i;e.exports=r.jsbn=r.jsbn||{};var o=0xdeadbeefcafe,s=!0;function a(e,t,n){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function u(){return new a(null)}function l(e,t,n,r,i,o){for(;--o>=0;){var s=t*this.data[e++]+n.data[r]+i;i=Math.floor(s/67108864),n.data[r++]=67108863&s}return i}function c(e,t,n,r,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var u=32767&this.data[e],l=this.data[e++]>>15,c=a*u+l*s;u=s*u+((32767&c)<<15)+n.data[r]+(1073741823&i),i=(u>>>30)+(c>>>15)+a*l+(i>>>30),n.data[r++]=1073741823&u}return i}function f(e,t,n,r,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var u=16383&this.data[e],l=this.data[e++]>>14,c=a*u+l*s;u=s*u+((16383&c)<<14)+n.data[r]+i,i=(u>>28)+(c>>14)+a*l,n.data[r++]=268435455&u}return i}r.jsbn.BigInteger=a,"undefined"==typeof navigator?(a.prototype.am=f,i=28):"Microsoft Internet Explorer"==navigator.appName?(a.prototype.am=c,i=30):"Netscape"!=navigator.appName?(a.prototype.am=l,i=26):(a.prototype.am=f,i=28),a.prototype.DB=i,a.prototype.DM=(1<=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function w(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 _(e){var t=u();return t.fromInt(e),t}function k(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,o=0;--r>=0;){var s=8==n?255&e[r]:b(e,r);s<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==o?this.data[this.t++]=s:o+n>this.DB?(this.data[this.t-1]|=(s&(1<>this.DB-o):this.data[this.t-1]|=s<=this.DB&&(o-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function E(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n=(1<0)for(a>a)>0&&(i=!0,o=y(r));s>=0;)a>(a+=this.DB-t)):(r=this.data[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=y(r));return i?o:"0"}function x(){var e=u();return a.ZERO.subTo(this,e),e}function C(){return this.s<0?this.negate():this}function A(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(t=n-e.t,0!=t)return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this.data[n]-e.data[n]))return t;return 0}function I(e){var t=1,n;return 0!=(n=e>>>16)&&(e=n,t+=16),0!=(n=e>>8)&&(e=n,t+=8),0!=(n=e>>4)&&(e=n,t+=4),0!=(n=e>>2)&&(e=n,t+=2),0!=(n=e>>1)&&(e=n,t+=1),t}function T(){return this.t<=0?0:this.DB*(this.t-1)+I(this.data[this.t-1]^this.s&this.DM)}function j(e,t){var n;for(n=this.t-1;n>=0;--n)t.data[n+e]=this.data[n];for(n=e-1;n>=0;--n)t.data[n]=0;t.t=this.t+e,t.s=this.s}function O(e,t){for(var n=e;n=0;--a)t.data[a+o+1]=this.data[a]>>r|s,s=(this.data[a]&i)<=0;--a)t.data[a]=0;t.data[o]=s,t.t=this.t+o+1,t.s=this.s,t.clamp()}function B(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<>r;for(var s=n+1;s>r;r>0&&(t.data[this.t-n-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t.data[n++]=this.DV+r:r>0&&(t.data[n++]=r),t.t=n,t.clamp()}function N(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[n]=0;for(n=0;n=t.DV&&(e.data[n+t.t]-=t.DV,e.data[n+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(n,t.data[n],e,2*n,0,1)),e.s=0,e.clamp()}function L(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t0?(r.lShiftTo(c,o),i.lShiftTo(c,n)):(r.copyTo(o),i.copyTo(n));var f=o.t,h=o.data[f-1];if(0!=h){var p=h*(1<1?o.data[f-2]>>this.F2:0),d=this.FV/p,m=(1<=0&&(n.data[n.t++]=1,n.subTo(v,n)),a.ONE.dlShiftTo(f,v),v.subTo(o,o);o.t=0;){var w=n.data[--y]==h?this.DM:Math.floor(n.data[y]*d+(n.data[y-1]+g)*m);if((n.data[y]+=o.am(0,w,n,b,0,f))0&&n.rShiftTo(c,n),s<0&&a.ZERO.subTo(n,n)}}}function F(e){var t=u();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(a.ZERO)>0&&e.subTo(t,t),t}function D(e){this.m=e}function U(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function z(e){return e}function q(e){e.divRemTo(this.m,null,e)}function K(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function H(e,t){e.squareTo(t),this.reduce(t)}function V(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function W(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function G(e){var t=u();return e.copyTo(t),this.reduce(t),t}function Y(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e.data[n]+=this.m.am(0,r,e,t,0,this.m.t);e.data[n]>=e.DV;)e.data[n]-=e.DV,e.data[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function J(e,t){e.squareTo(t),this.reduce(t)}function Z(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function Q(){return 0==(this.t>0?1&this.data[0]:this.s)}function X(e,t){if(e>4294967295||e<1)return a.ONE;var n=u(),r=u(),i=t.convert(this),o=I(e)-1;for(i.copyTo(n);--o>=0;)if(t.sqrTo(n,r),(e&1<0)t.mulTo(r,i,n);else{var s=n;n=r,r=s}return t.revert(n)}function ee(e,t){var n;return n=e<256||t.isEven()?new D(t):new W(t),this.exp(e,n)}function te(){var e=u();return this.copyTo(e),e}function ne(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<>24}function ie(){return 0==this.t?this.s:this.data[0]<<16>>16}function oe(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function se(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1}function ae(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),r=_(n),i=u(),o=u(),s="";for(this.divRemTo(r,i,o);i.signum()>0;)s=(n+o.intValue()).toString(e).substr(1)+s,i.divRemTo(r,i,o);return o.intValue().toString(e)+s}function ue(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),r=Math.pow(t,n),i=!1,o=0,s=0,u=0;u=n&&(this.dMultiply(r),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(s,0)),i&&a.ZERO.subTo(this,this)}function le(e,t,n){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(a.ONE.shiftLeft(e-1),ye,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(a.ONE.shiftLeft(e-1),this);else{var r=new Array,i=7&e;r.length=1+(e>>3),t.nextBytes(r),i>0?r[0]&=(1<0)for(n>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<=0;)n<8?(r=(this.data[e]&(1<>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t}function fe(e){return 0==this.compareTo(e)}function he(e){return this.compareTo(e)<0?this:e}function pe(e){return this.compareTo(e)>0?this:e}function de(e,t,n){var r,i,o=Math.min(e.t,this.t);for(r=0;r>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function Ae(){for(var e=0;e=this.t?0!=this.s:0!=(this.data[t]&1<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t.data[n++]=r:r<-1&&(t.data[n++]=this.DV+r),t.t=n,t.clamp()}function Me(e){var t=u();return this.addTo(e,t),t}function Le(e){var t=u();return this.subTo(e,t),t}function Fe(e){var t=u();return this.multiplyTo(e,t),t}function De(e){var t=u();return this.divRemTo(e,t,null),t}function Ue(e){var t=u();return this.divRemTo(e,null,t),t}function ze(e){var t=u(),n=u();return this.divRemTo(e,t,n),new Array(t,n)}function qe(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Ke(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function He(){}function Ve(e){return e}function We(e,t,n){e.multiplyTo(t,n)}function $e(e,t){e.squareTo(t)}function Ge(e){return this.exp(e,new He)}function Ye(e,t,n){var r=Math.min(this.t+e.t,t),i;for(n.s=0,n.t=r;r>0;)n.data[--r]=0;for(i=n.t-this.t;r=0;)n.data[r]=0;for(r=Math.max(t-this.t,0);r2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=u();return e.copyTo(t),this.reduce(t),t}function Xe(e){return e}function et(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function tt(e,t){e.squareTo(t),this.reduce(t)}function nt(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function rt(e,t){var n=e.bitLength(),r,i=_(1),o;if(n<=0)return i;r=n<18?1:n<48?3:n<144?4:n<768?5:6,o=n<8?new D(t):t.isEven()?new Ze(t):new W(t);var s=new Array,a=3,l=r-1,c=(1<1){var f=u();for(o.sqrTo(s[1],f);a<=c;)s[a]=u(),o.mulTo(f,s[a-2],s[a]),a+=2}var h=e.t-1,p,d=!0,m=u(),g;for(n=I(e.data[h])-1;h>=0;){for(n>=l?p=e.data[h]>>n-l&c:(p=(e.data[h]&(1<0&&(p|=e.data[h-1]>>this.DB+n-l)),a=r;0==(1&p);)p>>=1,--a;if((n-=a)<0&&(n+=this.DB,--h),d)s[p].copyTo(i),d=!1;else{for(;a>1;)o.sqrTo(i,m),o.sqrTo(m,i),a-=2;a>0?o.sqrTo(i,m):(g=i,i=m,m=g),o.mulTo(m,s[p],i)}for(;h>=0&&0==(e.data[h]&1<0&&(t.rShiftTo(o,t),n.rShiftTo(o,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n}function ot(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this.data[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this.data[r])%e;return n}function st(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return a.ZERO;for(var n=e.clone(),r=this.clone(),i=_(1),o=_(0),s=_(0),u=_(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),t?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;r.isEven();)r.rShiftTo(1,r),t?(s.isEven()&&u.isEven()||(s.addTo(this,s),u.subTo(e,u)),s.rShiftTo(1,s)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);n.compareTo(r)>=0?(n.subTo(r,n),t&&i.subTo(s,i),o.subTo(u,o)):(r.subTo(n,r),t&&s.subTo(i,s),u.subTo(o,u))}return 0!=r.compareTo(a.ONE)?a.ZERO:u.compareTo(e)>=0?u.subtract(e):u.signum()<0?(u.addTo(e,u),u.signum()<0?u.add(e):u):u}D.prototype.convert=U,D.prototype.revert=z,D.prototype.reduce=q,D.prototype.mulTo=K,D.prototype.sqrTo=H,W.prototype.convert=$,W.prototype.revert=G,W.prototype.reduce=Y,W.prototype.mulTo=Z,W.prototype.sqrTo=J,a.prototype.copyTo=v,a.prototype.fromInt=w,a.prototype.fromString=k,a.prototype.clamp=S,a.prototype.dlShiftTo=j,a.prototype.drShiftTo=O,a.prototype.lShiftTo=P,a.prototype.rShiftTo=B,a.prototype.subTo=R,a.prototype.multiplyTo=N,a.prototype.squareTo=M,a.prototype.divRemTo=L,a.prototype.invDigit=V,a.prototype.isEven=Q,a.prototype.exp=X,a.prototype.toString=E,a.prototype.negate=x,a.prototype.abs=C,a.prototype.compareTo=A,a.prototype.bitLength=T,a.prototype.mod=F,a.prototype.modPowInt=ee,a.ZERO=_(0),a.ONE=_(1),He.prototype.convert=Ve,He.prototype.revert=Ve,He.prototype.mulTo=We,He.prototype.sqrTo=$e,Ze.prototype.convert=Qe,Ze.prototype.revert=Xe,Ze.prototype.reduce=et,Ze.prototype.mulTo=nt,Ze.prototype.sqrTo=tt;var at=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],ut=(1<<26)/at[at.length-1];function lt(e){var t,n=this.abs();if(1==n.t&&n.data[0]<=at[at.length-1]){for(t=0;t=0);var u=o.modPow(r,this);if(0!=u.compareTo(a.ONE)&&0!=u.compareTo(t)){for(var l=1;l++4){var t=e;e=r.util.createBuffer();for(var n=0;n0))return!0;for(var r=0;r0))return!0;for(var r=0;r0)return!1;var n=e.length(),r=e.at(n-1);return!(r>this.blockSize<<2)&&(e.truncate(r),!0)},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,n){if(e.length()0))return!0;for(var r=0;r0))return!0;for(var r=0;r0)return!1;var n=e.length(),r=e.at(n-1);return!(r>this.blockSize<<2)&&(e.truncate(r),!0)},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0)e.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0)e.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,n){var r=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0)e.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}s(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=r.util.createBuffer(e.iv),n;if(this._cipherLength=0,n="additionalData"in e?r.util.createBuffer(e.additionalData):r.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=r.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=t.length();if(12===i)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*i)))}this._inBlock=this._j0.slice(0),s(this._inBlock),this._partialBytes=0,n=r.util.createBuffer(n),this._aDataLength=a(8*n.length());var o=n.length()%this.blockSize;for(o&&n.fillWithByte(0,this.blockSize-o),this._s=[0,0,0,0];n.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[n.getInt32(),n.getInt32(),n.getInt32(),n.getInt32()])},i.gcm.prototype.encrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,n){var r=e.length();if(r0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),s(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--r)t[r]=e[r]>>>1|(1&e[r-1])<<31;t[0]=e[0]>>>1,n&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],n=0;n<32;++n){var r=n/8|0,i=e[r]>>>4*(7-n%8)&15,o=this._m[n][i];t[0]^=o[0],t[1]^=o[1],t[2]^=o[2],t[3]^=o[3]}return t},i.gcm.prototype.ghash=function(e,t,n){return t[0]^=n[0],t[1]^=n[1],t[2]^=n[2],t[3]^=n[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var n=8/t,r=4*n,i=16*n,o=new Array(i),s=0;s>>1,i=new Array(n);i[r]=e.slice(0);for(var o=r>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o4||!a||"sha1"===a))return"string"!=typeof a&&(a="sha1"),e=new t(e,"binary"),n=new t(n,"binary"),u?4===o.pbkdf2Sync.length?o.pbkdf2(e,n,i,s,function(e,t){if(e)return u(e);u(null,t.toString("binary"))}):o.pbkdf2(e,n,i,s,a,function(e,t){if(e)return u(e);u(null,t.toString("binary"))}):4===o.pbkdf2Sync.length?o.pbkdf2Sync(e,n,i,s).toString("binary"):o.pbkdf2Sync(e,n,i,s,a).toString("binary");if(void 0!==a&&null!==a||(a="sha1"),"string"==typeof a){if(!(a in r.md.algorithms))throw new Error("Unknown hash algorithm: "+a);a=r.md[a].create()}var l=a.digestLength;if(s>4294967295*l){var c=new Error("Derived key is too long.");if(u)return u(c);throw c}var f=Math.ceil(s/l),h=s-(f-1)*l,p=r.hmac.create();p.start(a,e);var d="",m,g,y;if(!u){for(var b=1;b<=f;++b){p.start(null,null),p.update(n),p.update(r.util.int32ToBytes(b)),m=y=p.digest().getBytes();for(var v=2;v<=i;++v)p.start(null,null),p.update(y),g=p.digest().getBytes(),m=r.util.xorBytes(m,g,l),y=g;d+=bf)return u(null,d);p.start(null,null),p.update(n),p.update(r.util.int32ToBytes(b)),m=y=p.digest().getBytes(),v=2,_()}function _(){if(v<=i)return p.start(null,null),p.update(y),g=p.digest().getBytes(),m=r.util.xorBytes(m,g,l),y=g,++v,r.util.setImmediate(_);d+=b>6],i=0==(32&n);if(31==(31&n)){let r=n;for(n=0;128==(128&r);){if(r=e.readUInt8(t),e.isError(r))return r;n<<=7,n|=127&r}}else n&=31;const o=a.tag[n];return{cls:r,primitive:i,tag:n,tagStr:o}}function f(e,t,n){let r=e.readUInt8(n);if(e.isError(r))return r;if(!t&&128===r)return null;if(0==(128&r))return r;const i=127&r;if(i>4)return e.error("length octect is too long");r=0;for(let t=0;t=31?r.error("Multi-octet tag encoding unsupported"):(t||(i|=32),i|=a.tagClassByName[n||"universal"]<<6,i)}e.exports=u,u.prototype.encode=function e(t,n){return this.tree._encode(t,n).join()},r(l,s.Node),l.prototype._encodeComposite=function e(t,n,r,o){const s=f(t,n,r,this.reporter);if(o.length<128){const e=new i(2);return e[0]=s,e[1]=o.length,this._createEncoderBuffer([e,o])}let a=1;for(let e=o.length;e>=256;e>>=8)a++;const u=new i(2+a);u[0]=s,u[1]=128|a;for(let e=1+a,t=o.length;t>0;e--,t>>=8)u[e]=255&t;return this._createEncoderBuffer([u,o])},l.prototype._encodeStr=function e(t,n){if("bitstr"===n)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===n){const e=new i(2*t.length);for(let n=0;n=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}let o=0;for(let e=0;e=128;n>>=7)o++}const s=new i(o);let a=s.length-1;for(let e=t.length-1;e>=0;e--){let n=t[e];for(s[a--]=127&n;(n>>=7)>0;)s[a--]=128|127&n}return this._createEncoderBuffer(s)},l.prototype._encodeTime=function e(t,n){let r;const i=new Date(t);return"gentime"===n?r=[c(i.getUTCFullYear()),c(i.getUTCMonth()+1),c(i.getUTCDate()),c(i.getUTCHours()),c(i.getUTCMinutes()),c(i.getUTCSeconds()),"Z"].join(""):"utctime"===n?r=[c(i.getUTCFullYear()%100),c(i.getUTCMonth()+1),c(i.getUTCDate()),c(i.getUTCHours()),c(i.getUTCMinutes()),c(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+n+" time is not supported yet"),this._encodeStr(r,"octstr")},l.prototype._encodeNull=function e(){return this._createEncoderBuffer("")},l.prototype._encodeInt=function e(t,n){if("string"==typeof t){if(!n)return this.reporter.error("String int or enum given, but no values map");if(!n.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=n[t]}if("number"!=typeof t&&!i.isBuffer(t)){const e=t.toArray();!t.sign&&128&e[0]&&e.unshift(0),t=new i(e)}if(i.isBuffer(t)){let e=t.length;0===t.length&&e++;const n=new i(e);return t.copy(n),0===t.length&&(n[0]=0),this._createEncoderBuffer(n)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);let r=1;for(let e=t;e>=256;e>>=8)r++;const o=new Array(r);for(let e=o.length-1;e>=0;e--)o[e]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new i(o))},l.prototype._encodeBool=function e(t){return this._createEncoderBuffer(t?255:0)},l.prototype._use=function e(t,n){return"function"==typeof t&&(t=t(n)),t._getEncoder("der").tree},l.prototype._skipDefault=function e(t,n,r){const i=this._baseState;let o;if(null===i.default)return!1;const s=t.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,n,r).join()),s.length!==i.defaultBuffer.length)return!1;for(o=0;o=this._blockSize;){for(var o=this._blockOffset;o0;++a)this._length[a]+=u,u=this._length[a]/4294967296|0,u>0&&(this._length[a]-=4294967296*u);return this},a.prototype._update=function(){throw new Error("_update is not implemented")},a.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return t},a.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=a},function(e,t,n){"use strict";var r=n(0).Buffer,i=n(1),o=n(468),s=new Array(16),a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],u=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],l=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],c=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],f=[0,1518500249,1859775393,2400959708,2840853838],h=[1352829926,1548603684,1836072691,2053994217,0];function p(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function d(e,t){return e<>>32-t}function m(e,t,n,r,i,o,s,a){return d(e+(t^n^r)+o+s|0,a)+i|0}function g(e,t,n,r,i,o,s,a){return d(e+(t&n|~t&r)+o+s|0,a)+i|0}function y(e,t,n,r,i,o,s,a){return d(e+((t|~n)^r)+o+s|0,a)+i|0}function b(e,t,n,r,i,o,s,a){return d(e+(t&r|n&~r)+o+s|0,a)+i|0}function v(e,t,n,r,i,o,s,a){return d(e+(t^(n|~r))+o+s|0,a)+i|0}i(p,o),p.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,p=0|this._e,w=0|this._a,_=0|this._b,k=0|this._c,S=0|this._d,E=0|this._e,x=0;x<80;x+=1){var C,A;x<16?(C=m(n,r,i,o,p,e[a[x]],f[0],l[x]),A=v(w,_,k,S,E,e[u[x]],h[0],c[x])):x<32?(C=g(n,r,i,o,p,e[a[x]],f[1],l[x]),A=b(w,_,k,S,E,e[u[x]],h[1],c[x])):x<48?(C=y(n,r,i,o,p,e[a[x]],f[2],l[x]),A=y(w,_,k,S,E,e[u[x]],h[2],c[x])):x<64?(C=b(n,r,i,o,p,e[a[x]],f[3],l[x]),A=g(w,_,k,S,E,e[u[x]],h[3],c[x])):(C=v(n,r,i,o,p,e[a[x]],f[4],l[x]),A=m(w,_,k,S,E,e[u[x]],h[4],c[x])),n=p,p=o,o=d(i,10),i=r,r=C,w=E,E=S,S=d(k,10),k=_,_=A}var I=this._b+i+S|0;this._b=this._c+o+E|0,this._c=this._d+p+w|0,this._d=this._e+n+_|0,this._e=this._a+r+k|0,this._a=I},p.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=r.alloc?r.alloc(20):new r(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=p},function(e,t,n){var t=e.exports=function e(n){n=n.toLowerCase();var r=t[n];if(!r)throw new Error(n+" is not supported (we accept pull requests)");return new r};t.sha=n(923),t.sha1=n(924),t.sha224=n(925),t.sha256=n(471),t.sha384=n(926),t.sha512=n(472)},function(e,t,n){var r=n(1),i=n(144),o=n(4).Buffer,s=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],a=new Array(64);function u(){this.init(),this._w=a,i.call(this,64,56)}function l(e,t,n){return n^e&(t^n)}function c(e,t,n){return e&t|n&(e|t)}function f(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function h(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function p(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function d(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}r(u,i),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,u=0|this._f,m=0|this._g,g=0|this._h,y=0;y<16;++y)t[y]=e.readInt32BE(4*y);for(;y<64;++y)t[y]=d(t[y-2])+t[y-7]+p(t[y-15])+t[y-16]|0;for(var b=0;b<64;++b){var v=g+h(a)+l(a,u,m)+s[b]+t[b]|0,w=f(n)+c(n,r,i)|0;g=m,m=u,u=a,a=o+v|0,o=i,i=r,r=n,n=v+w|0}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0,this._f=u+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0},u.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=u},function(e,t,n){var r=n(1),i=n(144),o=n(4).Buffer,s=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function u(){this.init(),this._w=a,i.call(this,128,112)}function l(e,t,n){return n^e&(t^n)}function c(e,t,n){return e&t|n&(e|t)}function f(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function h(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function p(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function d(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function m(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function g(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function y(e,t){return e>>>0>>0?1:0}r(u,i),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(e){for(var t=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,u=0|this._fh,b=0|this._gh,v=0|this._hh,w=0|this._al,_=0|this._bl,k=0|this._cl,S=0|this._dl,E=0|this._el,x=0|this._fl,C=0|this._gl,A=0|this._hl,I=0;I<32;I+=2)t[I]=e.readInt32BE(4*I),t[I+1]=e.readInt32BE(4*I+4);for(;I<160;I+=2){var T=t[I-30],j=t[I-30+1],O=p(T,j),P=d(j,T);T=t[I-4],j=t[I-4+1];var B=m(T,j),R=g(j,T),N=t[I-14],M=t[I-14+1],L=t[I-32],F=t[I-32+1],D=P+M|0,U=O+N+y(D,P)|0;D=D+R|0,U=U+B+y(D,R)|0,D=D+F|0,U=U+L+y(D,F)|0,t[I]=U,t[I+1]=D}for(var z=0;z<160;z+=2){U=t[z],D=t[z+1];var q=c(n,r,i),K=c(w,_,k),H=f(n,w),V=f(w,n),W=h(a,E),$=h(E,a),G=s[z],Y=s[z+1],J=l(a,u,b),Z=l(E,x,C),Q=A+$|0,X=v+W+y(Q,A)|0;Q=Q+Z|0,X=X+J+y(Q,Z)|0,Q=Q+Y|0,X=X+G+y(Q,Y)|0,Q=Q+D|0,X=X+U+y(Q,D)|0;var ee=V+K|0,te=H+q+y(ee,V)|0;v=b,A=C,b=u,C=x,u=a,x=E,E=S+Q|0,a=o+X+y(E,S)|0,o=i,S=k,i=r,k=_,r=n,_=w,w=Q+ee|0,n=X+te+y(w,Q)|0}this._al=this._al+w|0,this._bl=this._bl+_|0,this._cl=this._cl+k|0,this._dl=this._dl+S|0,this._el=this._el+E|0,this._fl=this._fl+x|0,this._gl=this._gl+C|0,this._hl=this._hl+A|0,this._ah=this._ah+n+y(this._al,w)|0,this._bh=this._bh+r+y(this._bl,_)|0,this._ch=this._ch+i+y(this._cl,k)|0,this._dh=this._dh+o+y(this._dl,S)|0,this._eh=this._eh+a+y(this._el,E)|0,this._fh=this._fh+u+y(this._fl,x)|0,this._gh=this._gh+b+y(this._gl,C)|0,this._hh=this._hh+v+y(this._hl,A)|0},u.prototype._hash=function(){var e=o.allocUnsafe(64);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},e.exports=u},function(e,t,n){"use strict";var r=n(4).Buffer,i=n(238),o=n(474);function s(e,t){null===e&&null===t?(this.x=this.y=null,this.inf=!0):(this.x=e,this.y=t,this.inf=!1)}s.fromPublicKey=function(e){var t=e[0],n,r;return 33!==e.length||2!==t&&3!==t?65!==e.length||4!==t&&6!==t&&7!==t?null:(n=i.fromBuffer(e.slice(1,33)),r=i.fromBuffer(e.slice(33,65)),n.ucmp(i.p)>=0||r.ucmp(i.p)>=0?null:6!==t&&7!==t||r.isOdd()===(7===t)?0!==n.redSqr().redMul(n).redIAdd7().ucmp(r.redSqr())?null:new s(n,r):null):(n=i.fromBuffer(e.slice(1,33)),n.ucmp(i.p)>=0?null:(r=n.redSqr().redMul(n).redIAdd7().redSqrt(),null===r?null:(3===t!==r.isOdd()&&(r=r.redNeg()),new s(n,r))))},s.prototype.toPublicKey=function(e){var t=this.x,n=this.y,i;return e?(i=r.alloc(33),i[0]=n.isOdd()?3:2,t.toBuffer().copy(i,1)):(i=r.alloc(65),i[0]=4,t.toBuffer().copy(i,1),n.toBuffer().copy(i,33)),i},s.fromECJPoint=function(e){if(e.inf)return new s(null,null);var t=e.z.redInvm(),n=t.redSqr(),r=e.x.redMul(n),i=e.y.redMul(n).redMul(t);return new s(r,i)},s.prototype.toECJPoint=function(){return this.inf?new o(null,null,null):new o(this.x,this.y,o.one)},s.prototype.neg=function(){return this.inf?this:new s(this.x,this.y.redNeg())},s.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(0===this.x.ucmp(e.x))return 0===this.y.ucmp(e.y)?this.dbl():new s(null,null);var t=this.y.redSub(e.y);t.isZero()||(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return new s(n,r)},s.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.isZero())return new s(null,null);var t=this.x.redSqr(),n=t.redAdd(t).redIAdd(t).redMul(e.redInvm()),r=n.redSqr().redISub(this.x.redAdd(this.x)),i=n.redMul(this.x.redSub(r)).redISub(this.y);return new s(r,i)},s.prototype.mul=function(e){for(var t=this._getNAFPoints(4),n=t.points,r=e.getNAF(t.wnd),i=new o(null,null,null),a=r.length-1;a>=0;a--){for(var u=0;a>=0&&0===r[a];a--,++u);if(a>=0&&(u+=1),i=i.dblp(u),a<0)break;var l=r[a];i=l>0?i.mixedAdd(n[l-1>>1]):i.mixedAdd(n[-l-1>>1].neg())}return s.fromECJPoint(i)},s.prototype._getNAFPoints1=function(){return{wnd:1,points:[this]}},s.prototype._getNAFPoints=function(e){var t=new Array((1<{r(i.subtle.sign({name:"HMAC"},t,n).then(t=>e.from(t)),o)};t.create=function(e,t,n){const u=s[e];r(i.subtle.importKey("raw",t,{name:"HMAC",hash:{name:u}},!1,["sign"]).then(t=>({digest(e,n){a(t,e,n)},length:o[e]})),n)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(24);function i(e){return r.isMultiaddr(e)?e:r(e)}e.exports={ensureMultiaddr:i}},function(e,t,n){var r={ECB:n(949),CBC:n(950),CFB:n(951),CFB8:n(952),CFB1:n(953),OFB:n(954),CTR:n(478),GCM:n(478)},i=n(480);for(var o in i)i[o].module=r[i[o].mode];e.exports=i},function(e,t,n){var r=n(181),i=n(4).Buffer,o=n(479);function s(e){var t=e._cipher.encryptBlockRaw(e._prev);return o(e._prev),t}var a=16;t.encrypt=function(e,t){var n=Math.ceil(t.length/16),o=e._cache.length;e._cache=i.concat([e._cache,i.allocUnsafe(16*n)]);for(var a=0;a0||o>0;){var c=new i;c.update(l),c.update(e),t&&c.update(t),l=c.digest();var f=0;if(s>0){var h=a.length-s;f=Math.min(s,l.length),l.copy(a,h,0,f),s-=f}if(f0){var p=u.length-o,d=Math.min(o,l.length-f);l.copy(u,p,f,f+d),o-=d}}return l.fill(0),{key:a,iv:u}}e.exports=o},function(e,t,n){"use strict";(function(t){const r=n(76),i=n(23),o=n(44);function s(e){let n;if("string"==typeof e)n=e;else if(t.isBuffer(e))n=r.encode(e).toString();else if(i.isPeerId(e))n=e.toB58String();else{if(!o.isPeerInfo(e))throw new Error("not valid PeerId or PeerInfo, or B58Str");n=e.id.toB58String()}return n}class a{constructor(){this._peers={}}has(e){const t=s(e);return Boolean(this._peers[t])}put(e,t){const n=this._peers[e.id.toB58String()];if(!n||t)return this._peers[e.id.toB58String()]=e,e;e.multiaddrs.forEach(e=>n.multiaddrs.add(e));const r=e.isConnected();return r&&n.connect(r),e.protocols.forEach(e=>n.protocols.add(e)),!n.id.privKey&&e.id.privKey&&(n.id.privKey=e.id.privKey),!n.id.pubKey&&e.id.pubKey&&(n.id.pubKey=e.id.pubKey),n}get(e){const t=s(e),n=this._peers[t];if(n)return n;throw new Error("PeerInfo not found")}getAll(){return this._peers}getAllArray(){return Object.keys(this._peers).map(e=>this._peers[e])}getMultiaddrs(e){const t=this.get(e);return t.multiaddrs.toArray()}remove(e){const t=s(e);this._peers[t]&&delete this._peers[t]}}e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){!function t(n,r){e.exports=r()}(this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function t(){return e.default}:function t(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=32)}([function(e,t,n){"use strict";(function(e,r){var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(17),s=n(15),a=n(37),u=n(16),l=n(18),c={};t.clone=function(n,r){if("object"!==(void 0===n?"undefined":i(n))||null===n)return n;r=r||new Map;var o=r.get(n);if(o)return o;var s=void 0,a=!1;if(Array.isArray(n))s=[],a=!0;else if(e.isBuffer(n))s=e.from(n);else if(n instanceof Date)s=new Date(n.getTime());else if(n instanceof RegExp)s=new RegExp(n);else{var u=Object.getPrototypeOf(n);u&&u.isImmutable?s=n:(s=Object.create(u),a=!0)}if(r.set(n,s),a)for(var l=Object.getOwnPropertyNames(n),c=0;c1||!r.part&&!f[C])return!1;return(!r.only||!c)&&x},t.flatten=function(e,n){for(var r=n||[],i=0;i1?n-1:0),i=1;i\?@\[\]\^`\{\|\}~\"\\]*$/.test(e),"Bad attribute value ("+e+")"),e.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')},t.escapeHtml=function(e){return l.escapeHtml(e)},t.escapeJavaScript=function(e){return l.escapeJavaScript(e)},t.escapeJson=function(e){return l.escapeJson(e)},t.once=function(e){if(e._hoekOnce)return e;var t=!1,n=function n(){if(!t){t=!0;for(var r=arguments.length,i=Array(r),o=0;o1;)d=h.shift(),m[d]||(m[d]={}),m=m[d];d=h.shift(),m[d]=t.reach(e,p,r)}return u},t.uniqueFilename=function(e,t){t=t?"."!==t[0]?"."+t:t:"",e=a.resolve(e);var n=[Date.now(),r.pid,s.randomBytes(8).toString("hex")].join("-")+t;return a.join(e,n)},t.stringify=function(){try{for(var e=arguments.length,t=Array(e),n=0;n4&&void 0!==arguments[4]?arguments[4]:this._flags;return l.create(t,n,r,i,o)},e.prototype.createOverrideError=function e(t,n,r,i,o,s){return l.create(t,n,r,i,this._flags,o,s)},e.prototype.checkOptions=function e(t){var r=n(21),i=r.options.validate(t);if(i.error)throw new Error(i.error.details[0].message)},e.prototype.clone=function e(){var t=Object.create(Object.getPrototypeOf(this));t.isJoi=!0,t._currentJoi=this._currentJoi,t._type=this._type,t._settings=this._settings,t._baseType=this._baseType,t._valids=this._valids.slice(),t._invalids=this._invalids.slice(),t._tests=this._tests.slice(),t._refs=this._refs.slice(),t._flags=s.clone(this._flags),t._description=this._description,t._unit=this._unit,t._notes=this._notes.slice(),t._tags=this._tags.slice(),t._examples=this._examples.slice(),t._meta=this._meta.slice(),t._inner={};for(var n=Object.keys(this._inner),r=0;r=0?d[m[b]]={key:b,schema:d[m[b]].schema.concat(p[y].schema)}:d.push(p[y])}}else n._inner[f]=n._inner[f].concat(p);else n._inner[f]=p.slice()}}return n},e.prototype._test=function e(t,n,r,i){var o=this.clone();return o._tests.push({func:r,name:t,arg:n,options:i}),o},e.prototype.options=function e(t){s.assert(!t.context,"Cannot override context"),this.checkOptions(t);var n=this.clone();return n._settings=a.concat(n._settings,t),n},e.prototype.strict=function e(t){var n=this.clone(),r=void 0!==t&&!t;return n._settings=a.concat(n._settings,{convert:r}),n},e.prototype.raw=function e(t){var n=void 0===t||t;if(this._flags.raw===n)return this;var r=this.clone();return r._flags.raw=n,r},e.prototype.error=function e(t){s.assert(t&&(t instanceof Error||"function"==typeof t),"Must provide a valid Error object or a function");var n=this.clone();return n._flags.error=t,n},e.prototype.allow=function e(){for(var t=arguments.length,n=Array(t),r=0;r0,"description must be provided when default value is a function"));var r=this.clone();return r._flags.default=t,u.push(r._refs,t),r},e.prototype.empty=function e(t){var n=this.clone();return void 0===t?delete n._flags.empty:n._flags.empty=f.schema(this._currentJoi,t),n},e.prototype.when=function e(t,i){s.assert(i&&"object"===(void 0===i?"undefined":r(i)),"Invalid options"),s.assert(void 0!==i.then||void 0!==i.otherwise,'options must have at least one of "then" or "otherwise"');var o=i.hasOwnProperty("then")?this.concat(f.schema(this._currentJoi,i.then)):void 0,a=i.hasOwnProperty("otherwise")?this.concat(f.schema(this._currentJoi,i.otherwise)):void 0;c=c||n(10);var u={then:o,otherwise:a};Object.prototype.hasOwnProperty.call(i,"is")&&(u.is=i.is);var l=c.when(t,u);return l._flags.presence="ignore",l._baseType=this,l},e.prototype.description=function e(t){s.assert(t&&"string"==typeof t,"Description must be a non-empty string");var n=this.clone();return n._description=t,n},e.prototype.notes=function e(t){s.assert(t&&("string"==typeof t||Array.isArray(t)),"Notes must be a non-empty string or array");var n=this.clone();return n._notes=n._notes.concat(t),n},e.prototype.tags=function e(t){s.assert(t&&("string"==typeof t||Array.isArray(t)),"Tags must be a non-empty string or array");var n=this.clone();return n._tags=n._tags.concat(t),n},e.prototype.meta=function e(t){s.assert(void 0!==t,"Meta cannot be undefined");var n=this.clone();return n._meta=n._meta.concat(t),n},e.prototype.example=function e(){s.assert(1===arguments.length,"Missing example");var t=arguments.length<=0?void 0:arguments[0],n=this.clone();return n._examples.push(t),n},e.prototype.unit=function e(t){s.assert(t&&"string"==typeof t,"Unit name must be a non-empty string");var n=this.clone();return n._unit=t,n},e.prototype._prepareEmptyValue=function e(t){return"string"==typeof t&&this._flags.trim?t.trim():t},e.prototype._validate=function e(t,n,r,i){var o=this,c=t;n=n||{key:"",path:[],parent:null,reference:i},this._settings&&(r=a.concat(r,this._settings));var f=[],p=function e(){var i=void 0;if(void 0!==t)i=o._flags.raw?c:t;else if(r.noDefaults)i=t;else if(u.isRef(o._flags.default))i=o._flags.default(n.parent,r);else if("function"!=typeof o._flags.default||o._flags.func&&!o._flags.default.description)i=s.clone(o._flags.default);else{var a=void 0;null!==n.parent&&o._flags.default.length>0&&(a=[s.clone(n.parent),r]);var l=h._try(o._flags.default,a);i=l.value,l.error&&f.push(o.createError("any.default",{error:l.error},n,r))}if(f.length&&"function"==typeof o._flags.error){var p=o._flags.error.call(o,f);f="string"==typeof p?[o.createOverrideError("override",{reason:f},n,r,p)]:[].concat(p).map(function(e){return e instanceof Error?e:o.createOverrideError(e.type||"override",e.context,n,r,e.message,e.template)})}return{value:o._flags.strip?void 0:i,finalValue:i,errors:f.length?f:null}};if(this._coerce){var d=this._coerce.call(this,t,n,r);if(d.errors)return t=d.value,f=f.concat(d.errors),p();t=d.value}this._flags.empty&&!this._flags.empty._validate(this._prepareEmptyValue(t),null,h.defaults).errors&&(t=void 0);var m=this._flags.presence||r.presence;if("optional"===m){if(void 0===t){var g=this._flags.hasOwnProperty("default")&&void 0===this._flags.default;if(!g||"object"!==this._type)return p();t={}}}else{if("required"===m&&void 0===t)return f.push(this.createError("any.required",null,n,r)),p();if("forbidden"===m)return void 0===t?p():(f.push(this.createError("any.unknown",null,n,r)),p())}if(this._valids.has(t,n,r,this._flags.insensitive))return p();if(this._invalids.has(t,n,r,this._flags.insensitive)&&(f.push(this.createError(""===t?"any.empty":"any.invalid",{value:t,invalids:this._invalids.values({stripUndefined:!0})},n,r)),r.abortEarly||void 0===t))return p();if(this._base){var y=this._base.call(this,t,n,r);if(y.errors)return t=y.value,f=f.concat(y.errors),p();if(y.value!==t){if(t=y.value,this._valids.has(t,n,r,this._flags.insensitive))return p();if(this._invalids.has(t,n,r,this._flags.insensitive)&&(f.push(this.createError(""===t?"any.empty":"any.invalid",{value:t,invalids:this._invalids.values({stripUndefined:!0})},n,r)),r.abortEarly))return p()}}if(this._flags.allowOnly&&(f.push(this.createError("any.allowOnly",{value:t,valids:this._valids.values({stripUndefined:!0})},n,r)),r.abortEarly))return p();for(var b=0;b - * @license MIT - */ -var r=n(33),i=n(34),o=n(35);function s(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function v(e){return+e!=e&&(e=0),l.alloc(+e)}function w(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return X(e).length;default:if(r)return J(e).length;t=(""+t).toLowerCase(),r=!0}}function _(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return L(this,t,n);case"utf8":case"utf-8":return P(this,t,n);case"ascii":return N(this,t,n);case"latin1":case"binary":return M(this,t,n);case"base64":return O(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function k(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function S(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:E(e,t,n,r,i);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):E(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function E(e,t,n,r,i){var o=1,s=e.length,a=t.length,u;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,a/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(u=n;us&&(n=s-a),u=n;u>=0;u--){for(var f=!0,h=0;hi&&(r=i)):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s239?4:o>223?3:o>191?2:1,u,l,c,f;if(i+a<=n)switch(a){case 1:o<128&&(s=o);break;case 2:u=e[i+1],128==(192&u)&&(f=(31&o)<<6|63&u,f>127&&(s=f));break;case 3:u=e[i+1],l=e[i+2],128==(192&u)&&128==(192&l)&&(f=(15&o)<<12|(63&u)<<6|63&l,f>2047&&(f<55296||f>57343)&&(s=f));break;case 4:u=e[i+1],l=e[i+2],c=e[i+3],128==(192&u)&&128==(192&l)&&128==(192&c)&&(f=(15&o)<<18|(63&u)<<12|(63&l)<<6|63&c,f>65535&&f<1114112&&(s=f))}null===s?(s=65533,a=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),i+=a}return R(r)}t.Buffer=l,t.SlowBuffer=v,t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:s(),t.kMaxLength=a(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,n){return c(null,e,t,n)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,n){return h(null,e,t,n)},l.allocUnsafe=function(e){return p(null,e)},l.allocUnsafeSlow=function(e){return p(null,e)},l.isBuffer=function e(t){return!(null==t||!t._isBuffer)},l.compare=function e(t,n){if(!l.isBuffer(t)||!l.isBuffer(n))throw new TypeError("Arguments must be Buffers");if(t===n)return 0;for(var r=t.length,i=n.length,o=0,s=Math.min(r,i);o0&&(n=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(n+=" ... ")),""},l.prototype.compare=function e(t,n,r,i,o){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===n&&(n=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),n<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&n>=r)return 0;if(i>=o)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var s=o-i,a=r-n,u=Math.min(s,a),c=this.slice(i,o),f=t.slice(n,r),h=0;ho)&&(r=o),t.length>0&&(r<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return x(this,t,n,r);case"utf8":case"utf-8":return C(this,t,n,r);case"ascii":return A(this,t,n,r);case"latin1":case"binary":return I(this,t,n,r);case"base64":return T(this,t,n,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,t,n,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},l.prototype.toJSON=function e(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var B=4096;function R(e){var t=e.length;if(t<=B)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,n,r,i,o){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function z(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function q(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function K(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function H(e,t,n,r,o){return o||K(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),i.write(e,t,n,r,23,4),n+4}function V(e,t,n,r,o){return o||K(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),i.write(e,t,n,r,52,8),n+8}l.prototype.slice=function e(t,n){var r=this.length,i;if(t=~~t,n=void 0===n?r:~~n,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),n<0?(n+=r,n<0&&(n=0)):n>r&&(n=r),n0&&(o*=256);)i+=this[t+--n]*o;return i},l.prototype.readUInt8=function e(t,n){return n||D(t,1,this.length),this[t]},l.prototype.readUInt16LE=function e(t,n){return n||D(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUInt16BE=function e(t,n){return n||D(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUInt32LE=function e(t,n){return n||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUInt32BE=function e(t,n){return n||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function e(t,n,r){t|=0,n|=0,r||D(t,n,this.length);for(var i=this[t],o=1,s=0;++s=o&&(i-=Math.pow(2,8*n)),i},l.prototype.readIntBE=function e(t,n,r){t|=0,n|=0,r||D(t,n,this.length);for(var i=n,o=1,s=this[t+--i];i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*n)),s},l.prototype.readInt8=function e(t,n){return n||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function e(t,n){n||D(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function e(t,n){n||D(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function e(t,n){return n||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function e(t,n){return n||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function e(t,n){return n||D(t,4,this.length),i.read(this,t,!0,23,4)},l.prototype.readFloatBE=function e(t,n){return n||D(t,4,this.length),i.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function e(t,n){return n||D(t,8,this.length),i.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function e(t,n){return n||D(t,8,this.length),i.read(this,t,!1,52,8)},l.prototype.writeUIntLE=function e(t,n,r,i){if(t=+t,n|=0,r|=0,!i){var o=Math.pow(2,8*r)-1;U(this,t,n,r,o,0)}var s=1,a=0;for(this[n]=255&t;++a=0&&(a*=256);)this[n+s]=t/a&255;return n+r},l.prototype.writeUInt8=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,1,255,0),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[n]=255&t,n+1},l.prototype.writeUInt16LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[n]=255&t,this[n+1]=t>>>8):z(this,t,n,!0),n+2},l.prototype.writeUInt16BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=255&t):z(this,t,n,!1),n+2},l.prototype.writeUInt32LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[n+3]=t>>>24,this[n+2]=t>>>16,this[n+1]=t>>>8,this[n]=255&t):q(this,t,n,!0),n+4},l.prototype.writeUInt32BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=255&t):q(this,t,n,!1),n+4},l.prototype.writeIntLE=function e(t,n,r,i){if(t=+t,n|=0,!i){var o=Math.pow(2,8*r-1);U(this,t,n,r,o-1,-o)}var s=0,a=1,u=0;for(this[n]=255&t;++s>0)-u&255;return n+r},l.prototype.writeIntBE=function e(t,n,r,i){if(t=+t,n|=0,!i){var o=Math.pow(2,8*r-1);U(this,t,n,r,o-1,-o)}var s=r-1,a=1,u=0;for(this[n+s]=255&t;--s>=0&&(a*=256);)t<0&&0===u&&0!==this[n+s+1]&&(u=1),this[n+s]=(t/a>>0)-u&255;return n+r},l.prototype.writeInt8=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,1,127,-128),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[n]=255&t,n+1},l.prototype.writeInt16LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[n]=255&t,this[n+1]=t>>>8):z(this,t,n,!0),n+2},l.prototype.writeInt16BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=255&t):z(this,t,n,!1),n+2},l.prototype.writeInt32LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[n]=255&t,this[n+1]=t>>>8,this[n+2]=t>>>16,this[n+3]=t>>>24):q(this,t,n,!0),n+4},l.prototype.writeInt32BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),l.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=255&t):q(this,t,n,!1),n+4},l.prototype.writeFloatLE=function e(t,n,r){return H(this,t,n,!0,r)},l.prototype.writeFloatBE=function e(t,n,r){return H(this,t,n,!1,r)},l.prototype.writeDoubleLE=function e(t,n,r){return V(this,t,n,!0,r)},l.prototype.writeDoubleBE=function e(t,n,r){return V(this,t,n,!1,r)},l.prototype.copy=function e(t,n,r,i){if(r||(r=0),i||0===i||(i=this.length),n>=t.length&&(n=t.length),n||(n=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-n=0;--s)t[s+n]=this[s+r];else if(o<1e3||!l.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=n;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Z(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function X(e){return r.toByteArray($(e))}function ee(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function te(e){return e!=e}}).call(t,n(5))},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=n(0),o=n(1);t.schema=function(e,t){return void 0!==t&&null!==t&&"object"===(void 0===t?"undefined":r(t))?t.isJoi?t:Array.isArray(t)?e.alternatives().try(t):t instanceof RegExp?e.string().regex(t):t instanceof Date?e.date().valid(t):e.object().keys(t):"string"==typeof t?e.string().valid(t):"number"==typeof t?e.number().valid(t):"boolean"==typeof t?e.boolean().valid(t):o.isRef(t)?e.valid(t):(i.assert(null===t,"Invalid schema content:",t),e.valid(null))},t.ref=function(e){return o.isRef(e)?e:o.create(e)}},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=n(0),s=n(20),a={annotations:Symbol("joi-annotations"),stringify:function(e,n){var i=void 0===e?"undefined":r(e);if(null===e)return"null";if("string"===i)return e;if(e instanceof t.Err||"function"===i||"symbol"===i)return e.toString();if("object"===i){if(Array.isArray(e)){for(var o="",s=0;s2&&"!"===n[0]&&"!"===n[1];if(c&&(n=n.slice(2)),!l&&!c){var f=o.reach(r,"key");n="string"==typeof f?f+n:o.reach(s.errors,"key")+n}return n.replace(/\{\{(\!?)([^}]+)\}\}/g,function(e,n,r){var s=o.reach(t.context,r),u=a.stringify(s,i);return n&&t.options.escapeHtml?o.escapeHtml(u):u})},e}(),t.create=function(e,n,r,i,o,s,a){return new t.Err(e,n,r,i,o,s,a)},t.process=function(e,t){if(!e||!e.length)return null;var n="",r=[],i=function e(t,i){for(var o=0;o0){var s=t.indexOf(this);~s?(t.length=s+1,e.length=s+1,e[s]=i):(t.push(this),e.push(i)),~t.indexOf(o)&&(o=n.call(this,i,o))}else t.push(o);if(o){var u=o[a.annotations];if(u){if(Array.isArray(o)){for(var l=[],c=0;c=0;--u)for(var l=u+1,c=this.details[u],f=c.path,h=s,p=0;;++p){var d=f[p];if(h.isImmutable&&(h=h.clone()),!(p+11)for(var n=1;n0,"You need to provide at least one extension"),this.assert(d,t.extensionsSchema);var b=Object.create(this.any());r(b,this);for(var v=function n(i){var l=d[i];"function"==typeof l&&(l=l(b)),e.assert(l,t.extensionSchema);var v=(l.base||e.any()).clone(),w=v.constructor,_=function(e){function t(){s(this,t);var n=a(this,e.call(this));return l.base&&r(n,v),n._type=l.name,l.language&&(n._settings=g.concat(n._settings,{language:o({},l.name,l.language)})),n}return u(t,e),t}(w);if(l.coerce&&(_.prototype._coerce=function(e,t,n){if(w.prototype._coerce){var r=w.prototype._coerce.call(this,e,t,n);if(r.errors)return r;e=r.value}var i=l.coerce.call(this,e,t,n);return i instanceof p.Err?{value:e,errors:i}:{value:i}}),l.pre&&(_.prototype._base=function(e,t,n){if(w.prototype._base){var r=w.prototype._base.call(this,e,t,n);if(r.errors)return r;e=r.value}var i=l.pre.call(this,e,t,n);return i instanceof p.Err?{value:e,errors:i}:{value:i}}),l.rules)for(var k=function t(n){var r=l.rules[n],i=r.params?r.params instanceof f?r.params._inner.children.map(function(e){return e.key}):Object.keys(r.params):[],o=r.params?h.schema(e,r.params):null;_.prototype[r.name]=function(){for(var e=arguments.length,t=Array(e),n=0;ni.length)throw new Error("Unexpected number of arguments");for(var s=!1,a={},u=0;u0&&void 0!==arguments[0]?arguments[0]:"javascript",n=["javascript","unix"];if(l.assert(n.includes(t),'"type" must be one of "'+n.join('", "')+'"'),this._flags.timestamp===t)return this;var r=this.clone();return r._flags.timestamp=t,r._flags.multiplier="unix"===t?1e3:1,r},t.prototype._isIsoDate=function e(t){return c.isoDate.test(t)},t}(a),c.compare=function(e,t){return function(n){var r="now"===n,i=u.isRef(n);return r||i||(n=c.Date.toDate(n)),l.assert(n,"Invalid date format"),this._test(e,n,function(o,s,a){var u=void 0;if(r)u=Date.now();else if(i){if(u=c.Date.toDate(n(s.reference||s.parent,a)),!u)return this.createError("date.ref",{ref:n.key},s,a);u=u.getTime()}else u=n.getTime();return t(o.getTime(),u)?o:this.createError("date."+e,{limit:new Date(u)},s,a)})}},c.Date.prototype.min=c.compare("min",function(e,t){return e>=t}),c.Date.prototype.max=c.compare("max",function(e,t){return e<=t}),c.Date.prototype.greater=c.compare("greater",function(e,t){return e>t}),c.Date.prototype.less=c.compare("less",function(e,t){return e=0,"limit must be a positive integer"),this._test("length",t,function(e,n,r){return Object.keys(e).length===t?e:this.createError("object.length",{limit:t},n,r)})},t.prototype.min=function e(t){return u.assert(Number.isSafeInteger(t)&&t>=0,"limit must be a positive integer"),this._test("min",t,function(e,n,r){return Object.keys(e).length>=t?e:this.createError("object.min",{limit:t},n,r)})},t.prototype.max=function e(t){return u.assert(Number.isSafeInteger(t)&&t>=0,"limit must be a positive integer"),this._test("max",t,function(e,n,r){return Object.keys(e).length<=t?e:this.createError("object.max",{limit:t},n,r)})},t.prototype.pattern=function e(t,n){var r=t instanceof RegExp;u.assert(r||t instanceof c,"pattern must be a regex or schema"),u.assert(void 0!==n,"Invalid rule"),r&&(t=new RegExp(t.source,t.ignoreCase?"i":void 0));try{n=h.schema(this._currentJoi,n)}catch(e){throw e.hasOwnProperty("path")&&(e.message=e.message+"("+e.path+")"),e}var i=this.clone();return r?i._inner.patterns.push({regex:t,rule:n}):i._inner.patterns.push({schema:t,rule:n}),i},t.prototype.schema=function e(){return this._test("schema",null,function(e,t,n){return e instanceof c?e:this.createError("object.schema",null,t,n)})},t.prototype.with=function e(t,n){return u.assert(2===arguments.length,"Invalid number of arguments, expected 2."),this._dependency("with",t,n)},t.prototype.without=function e(t,n){return u.assert(2===arguments.length,"Invalid number of arguments, expected 2."),this._dependency("without",t,n)},t.prototype.xor=function e(){for(var t=arguments.length,n=Array(t),r=0;r0,"expected at least one children");var o=p.groupChildren(t),s=void 0;if(""in o?(s=this[n].apply(this,r),delete o[""]):s=this.clone(),s._inner.children){i=i?i+".":"";for(var a=0;a0&&(n.renames=u.clone(this._inner.renames)),n},t.prototype.assert=function e(t,n,r){t=h.ref(t),u.assert(t.isContext||t.depth>1,"Cannot use assertions for root level references - use direct key rules instead"),r=r||"pass the assertion test";try{n=h.schema(this._currentJoi,n)}catch(e){throw e.hasOwnProperty("path")&&(e.message=e.message+"("+e.path+")"),e}var i=t.path[t.path.length-1],o=t.path.join(".");return this._test("assert",{schema:n,ref:t},function(e,s,a){var l=n._validate(t(e),null,a,e);if(!l.errors)return e;var c=u.merge({},s);return c.key=i,c.path=t.path,this.createError("object.assert",{ref:o,message:r},c,a)})},t.prototype.type=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.name;u.assert("function"==typeof t,"type must be a constructor function");var r={name:n,ctor:t};return this._test("type",r,function(e,n,i){return e instanceof t?e:this.createError("object.type",{type:r.name},n,i)})},t}(c),p.safeParse=function(e){try{return JSON.parse(e)}catch(e){}return e},p.renameDefaults={alias:!1,multiple:!1,override:!1},p.groupChildren=function(e){e.sort();for(var t={},n=0;n=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),u=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),b(n)?r.showHidden=n:n&&t._extend(r,n),E(r.showHidden)&&(r.showHidden=!1),E(r.depth)&&(r.depth=2),E(r.colors)&&(r.colors=!1),E(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),f(r,e,r.depth)}function u(e,t){var n=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.colors[n][1]+"m":e}function l(e,t){return e}function c(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function f(e,n,r){if(e.customInspect&&n&&T(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return k(i)||(i=f(e,i,r)),i}var o=h(e,n);if(o)return o;var s=Object.keys(n),a=c(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(n)),I(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return p(n);if(0===s.length){if(T(n)){var u=n.name?": "+n.name:"";return e.stylize("[Function"+u+"]","special")}if(x(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(A(n))return e.stylize(Date.prototype.toString.call(n),"date");if(I(n))return p(n)}var l="",b=!1,v=["{","}"],w;if(y(n)&&(b=!0,v=["[","]"]),T(n)){var _=n.name?": "+n.name:"";l=" [Function"+_+"]"}return x(n)&&(l=" "+RegExp.prototype.toString.call(n)),A(n)&&(l=" "+Date.prototype.toUTCString.call(n)),I(n)&&(l=" "+p(n)),0!==s.length||b&&0!=n.length?r<0?x(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),w=b?d(e,n,r,a,s):s.map(function(t){return m(e,n,r,a,t,b)}),e.seen.pop(),g(w,l,v)):v[0]+l+v[1]}function h(e,t){if(E(t))return e.stylize("undefined","undefined");if(k(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return _(t)?e.stylize(""+t,"number"):b(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,n,r,i){for(var o=[],s=0,a=t.length;s-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n"))):a=e.stylize("[Circular]","special")),E(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function g(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function y(e){return Array.isArray(e)}function b(e){return"boolean"==typeof e}function v(e){return null===e}function w(e){return null==e}function _(e){return"number"==typeof e}function k(e){return"string"==typeof e}function S(e){return"symbol"==typeof e}function E(e){return void 0===e}function x(e){return C(e)&&"[object RegExp]"===O(e)}function C(e){return"object"==typeof e&&null!==e}function A(e){return C(e)&&"[object Date]"===O(e)}function I(e){return C(e)&&("[object Error]"===O(e)||e instanceof Error)}function T(e){return"function"==typeof e}function j(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function O(e){return Object.prototype.toString.call(e)}function P(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(E(s)&&(s=r.env.NODE_DEBUG||""),e=e.toUpperCase(),!o[e])if(new RegExp("\\b"+e+"\\b","i").test(s)){var n=r.pid;o[e]=function(){var r=t.format.apply(t,arguments);console.error("%s %d: %s",e,n,r)}}else o[e]=function(){};return o[e]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=y,t.isBoolean=b,t.isNull=v,t.isNullOrUndefined=w,t.isNumber=_,t.isString=k,t.isSymbol=S,t.isUndefined=E,t.isRegExp=x,t.isObject=C,t.isDate=A,t.isError=I,t.isFunction=T,t.isPrimitive=j,t.isBuffer=n(40);var B=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function R(){var e=new Date,t=[P(e.getHours()),P(e.getMinutes()),P(e.getSeconds())].join(":");return[e.getDate(),B[e.getMonth()],t].join(" ")}function N(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",R(),t.format.apply(t,arguments))},t.inherits=n(39),t._extend=function(e,t){if(!t||!C(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(t,n(5),n(7))},function(e,t,n){"use strict";(function(t){ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -function r(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i=0;f--)if(u[f]!==l[f])return!1;for(f=u.length-1;f>=0;f--)if(c=u[f],!v(e[c],t[c],n,r))return!1;return!0}function k(e,t,n){v(e,t,!0)&&y(e,t,n,"notDeepStrictEqual",k)}function S(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function E(e){var t;try{e()}catch(e){t=e}return t}function x(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=E(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&y(i,n,"Missing expected exception"+r);var s="string"==typeof r,a=!e&&o.isError(i),u=!e&&i&&!n;if((a&&s&&S(i,n)||u)&&y(i,n,"Got unwanted exception"+r),e&&i&&n&&!S(i,n)||!e&&i)throw i}f.AssertionError=function e(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=g(this),this.generatedMessage=!0);var n=t.stackStartFunction||y;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var i=r.stack,o=p(n),s=i.indexOf("\n"+o);if(s>=0){var a=i.indexOf("\n",s+1);i=i.substring(a+1)}this.stack=i}}},o.inherits(f.AssertionError,Error),f.fail=y,f.ok=b,f.equal=function e(t,n,r){t!=n&&y(t,n,r,"==",f.equal)},f.notEqual=function e(t,n,r){t==n&&y(t,n,r,"!=",f.notEqual)},f.deepEqual=function e(t,n,r){v(t,n,!1)||y(t,n,r,"deepEqual",f.deepEqual)},f.deepStrictEqual=function e(t,n,r){v(t,n,!0)||y(t,n,r,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function e(t,n,r){v(t,n,!1)&&y(t,n,r,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=k,f.strictEqual=function e(t,n,r){t!==n&&y(t,n,r,"===",f.strictEqual)},f.notStrictEqual=function e(t,n,r){t===n&&y(t,n,r,"!==",f.notStrictEqual)},f.throws=function(e,t,n){x(!0,e,t,n)},f.doesNotThrow=function(e,t,n){x(!1,e,t,n)},f.ifError=function(e){if(e)throw e};var C=Object.keys||function(e){var t=[];for(var n in e)s.call(e,n)&&t.push(n);return t}}).call(t,n(5))},function(e,t,n){"use strict";(function(e){var n={};t.escapeJavaScript=function(e){if(!e)return"";for(var t="",r=0;r&\u2028\u2029]/g,function(e){return o=e.charCodeAt(0),60===o?"\\u003c":62===o?"\\u003e":38===o?"\\u0026":8232===o?"\\u2028":"\\u2029"})},n.escapeJavaScriptChar=function(t){if(t>=256)return"\\u"+n.padLeft(""+t,4);var r=e.from(String.fromCharCode(t),"ascii").toString("hex");return"\\x"+n.padLeft(r,2)},n.escapeHtmlChar=function(t){var r=n.namedHtml[t];if(void 0!==r)return r;if(t>=256)return"&#"+t+";";var i=e.from(String.fromCharCode(t),"ascii").toString("hex");return"&#x"+n.padLeft(i,2)+";"},n.padLeft=function(e,t){for(;e.length=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&(e[t]=null);return e}()}).call(t,n(3).Buffer)},function(e,t,n){"use strict";(function(e){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=n(38),o={hasOwn:Object.prototype.hasOwnProperty,indexOf:Array.prototype.indexOf,defaultThreshold:16,maxIPv6Groups:8,categories:{valid:1,dnsWarn:7,rfc5321:15,cfws:31,deprecated:63,rfc5322:127,error:255},diagnoses:{valid:0,rfc5321TLD:9,rfc5321TLDNumeric:10,rfc5321QuotedString:11,rfc5321AddressLiteral:12,cfwsComment:17,cfwsFWS:18,undesiredNonAscii:25,deprecatedLocalPart:33,deprecatedFWS:34,deprecatedQTEXT:35,deprecatedQP:36,deprecatedComment:37,deprecatedCTEXT:38,deprecatedIPv6:39,deprecatedCFWSNearAt:49,rfc5322Domain:65,rfc5322TooLong:66,rfc5322LocalTooLong:67,rfc5322DomainTooLong:68,rfc5322LabelTooLong:69,rfc5322DomainLiteral:70,rfc5322DomainLiteralOBSDText:71,rfc5322IPv6GroupCount:72,rfc5322IPv62x2xColon:73,rfc5322IPv6BadCharacter:74,rfc5322IPv6MaxGroups:75,rfc5322IPv6ColonStart:76,rfc5322IPv6ColonEnd:77,errExpectingDTEXT:129,errNoLocalPart:130,errNoDomain:131,errConsecutiveDots:132,errATEXTAfterCFWS:133,errATEXTAfterQS:134,errATEXTAfterDomainLiteral:135,errExpectingQPair:136,errExpectingATEXT:137,errExpectingQTEXT:138,errExpectingCTEXT:139,errBackslashEnd:140,errDotStart:141,errDotEnd:142,errDomainHyphenStart:143,errDomainHyphenEnd:144,errUnclosedQuotedString:145,errUnclosedComment:146,errUnclosedDomainLiteral:147,errFWSCRLFx2:148,errFWSCRLFEnd:149,errCRNoLF:150,errUnknownTLD:160,errDomainTooShort:161},components:{localpart:0,domain:1,literal:2,contextComment:3,contextFWS:4,contextQuotedString:5,contextQuotedPair:6}};o.specials=function(){var e='()<>[]:;@\\,."',t=new Array(256);t.fill(!1);for(var n=0;n=0?o.nulNormalize(e):e.normalize("NFC")},o.checkIpV6=function(e){return e.every(function(e){return o.regex.ipV6.test(e)})},o.validDomain=function(e,t){return t.tldBlacklist?Array.isArray(t.tldBlacklist)?-1===o.indexOf.call(t.tldBlacklist,e):!o.hasOwn.call(t.tldBlacklist,e):Array.isArray(t.tldWhitelist)?-1!==o.indexOf.call(t.tldWhitelist,e):o.hasOwn.call(t.tldWhitelist,e)},t.validate=o.validate=function(t,n,s){n=n||{},t=o.normalize(t),"function"==typeof n&&(s=n,n={}),"function"!=typeof s&&(s=null);var a=void 0,u=void 0;if("number"==typeof n.errorLevel?(a=!0,u=n.errorLevel):(a=!!n.errorLevel,u=o.diagnoses.valid),n.tldWhitelist)if("string"==typeof n.tldWhitelist)n.tldWhitelist=[n.tldWhitelist];else if("object"!==r(n.tldWhitelist))throw new TypeError("expected array or object tldWhitelist");if(n.tldBlacklist)if("string"==typeof n.tldBlacklist)n.tldBlacklist=[n.tldBlacklist];else if("object"!==r(n.tldBlacklist))throw new TypeError("expected array or object tldBlacklist");if(n.minDomainAtoms&&(n.minDomainAtoms!==(0|+n.minDomainAtoms)||n.minDomainAtoms<0))throw new TypeError("expected positive integer minDomainAtoms");var l=o.diagnoses.valid,c=function e(t){t>l&&(l=t)},f=void 0===n.allowUnicode||!!n.allowUnicode;!f&&/[^\x00-\x7f]/.test(t)&&c(o.diagnoses.undesiredNonAscii);for(var h={now:o.components.localpart,prev:o.components.localpart,stack:[o.components.localpart]},p="",d={local:"",domain:""},m={locals:[""],domains:[""]},g=0,y=0,b=0,v=void 0,w=!1,_=!1,k=t.length,S=void 0,E=0;E64?c(o.diagnoses.rfc5322LocalTooLong):h.prev!==o.components.contextComment&&h.prev!==o.components.contextFWS||c(o.diagnoses.deprecatedCFWSNearAt),h.now=o.components.domain,h.stack[0]=o.components.domain,g=0,y=0,_=!1;break;default:if(_)switch(h.prev){case o.components.contextComment:case o.components.contextFWS:c(o.diagnoses.errATEXTAfterCFWS);break;case o.components.contextQuotedString:c(o.diagnoses.errATEXTAfterQS);break;default:throw new Error("more atext found where none is allowed, but unrecognized prev context: "+h.prev)}else h.prev=h.now,v=S.codePointAt(0),(o.specials(v)||o.c0Controls(v)||o.c1Controls(v))&&c(o.diagnoses.errExpectingATEXT),d.local+=S,m.locals[g]+=S,y+=e.byteLength(S,"utf8")}break;case o.components.domain:switch(S){case"(":0===y?c(0===g?o.diagnoses.deprecatedCFWSNearAt:o.diagnoses.deprecatedComment):(_=!0,c(o.diagnoses.cfwsComment)),h.stack.push(h.now),h.now=o.components.contextComment;break;case".":var x=i.encode(m.domains[g]).length;0===y?c(0===g?o.diagnoses.errDotStart:o.diagnoses.errConsecutiveDots):w?c(o.diagnoses.errDomainHyphenEnd):x>63&&c(o.diagnoses.rfc5322LabelTooLong),_=!1,y=0,++g,m.domains[g]="",d.domain+=S;break;case"[":0===d.domain.length?(_=!0,y+=e.byteLength(S,"utf8"),h.stack.push(h.now),h.now=o.components.literal,d.domain+=S,m.domains[g]+=S,d.literal=""):c(o.diagnoses.errExpectingATEXT);break;case"\r":if(k===++E||"\n"!==t[E]){c(o.diagnoses.errCRNoLF);break}case" ":case"\t":0===y?c(0===g?o.diagnoses.deprecatedCFWSNearAt:o.diagnoses.deprecatedFWS):(c(o.diagnoses.cfwsFWS),_=!0),h.stack.push(h.now),h.now=o.components.contextFWS,p=S;break;default:if(_)switch(h.prev){case o.components.contextComment:case o.components.contextFWS:c(o.diagnoses.errATEXTAfterCFWS);break;case o.components.literal:c(o.diagnoses.errATEXTAfterDomainLiteral);break;default:throw new Error("more atext found where none is allowed, but unrecognized prev context: "+h.prev)}v=S.codePointAt(0),w=!1,o.specials(v)||o.c0Controls(v)||o.c1Controls(v)?c(o.diagnoses.errExpectingATEXT):"-"===S?(0===y&&c(o.diagnoses.errDomainHyphenStart),w=!0):(v<48||v>122&&v<192||v>57&&v<65||v>90&&v<97)&&c(o.diagnoses.rfc5322Domain),d.domain+=S,m.domains[g]+=S,y+=e.byteLength(S,"utf8")}break;case o.components.literal:switch(S){case"]":if(lj?c(o.diagnoses.rfc5322IPv6MaxGroups):O.length===j&&c(o.diagnoses.deprecatedIPv6)):O.length!==j&&c(o.diagnoses.rfc5322IPv6GroupCount),":"===T[0]&&":"!==T[1]?c(o.diagnoses.rfc5322IPv6ColonStart):":"===T[T.length-1]&&":"!==T[T.length-2]?c(o.diagnoses.rfc5322IPv6ColonEnd):o.checkIpV6(O)?c(o.diagnoses.rfc5321AddressLiteral):c(o.diagnoses.rfc5322IPv6BadCharacter)}}else c(o.diagnoses.rfc5322DomainLiteral);d.domain+=S,m.domains[g]+=S,y+=e.byteLength(S,"utf8"),h.prev=h.now,h.now=h.stack.pop();break;case"\\":c(o.diagnoses.rfc5322DomainLiteralOBSDText),h.stack.push(h.now),h.now=o.components.contextQuotedPair;break;case"\r":if(k===++E||"\n"!==t[E]){c(o.diagnoses.errCRNoLF);break}case" ":case"\t":c(o.diagnoses.cfwsFWS),h.stack.push(h.now),h.now=o.components.contextFWS,p=S;break;default:if(v=S.codePointAt(0),127!==v&&o.c1Controls(v)||0===v||"["===S){c(o.diagnoses.errExpectingDTEXT);break}(o.c0Controls(v)||127===v)&&c(o.diagnoses.rfc5322DomainLiteralOBSDText),d.literal+=S,d.domain+=S,m.domains[g]+=S,y+=e.byteLength(S,"utf8")}break;case o.components.contextQuotedString:switch(S){case"\\":h.stack.push(h.now),h.now=o.components.contextQuotedPair;break;case"\r":if(k===++E||"\n"!==t[E]){c(o.diagnoses.errCRNoLF);break}case"\t":d.local+=" ",m.locals[g]+=" ",y+=e.byteLength(S,"utf8"),c(o.diagnoses.cfwsFWS),h.stack.push(h.now),h.now=o.components.contextFWS,p=S;break;case'"':d.local+=S,m.locals[g]+=S,y+=e.byteLength(S,"utf8"),h.prev=h.now,h.now=h.stack.pop();break;default:v=S.codePointAt(0),127!==v&&o.c1Controls(v)||0===v||10===v?c(o.diagnoses.errExpectingQTEXT):(o.c0Controls(v)||127===v)&&c(o.diagnoses.deprecatedQTEXT),d.local+=S,m.locals[g]+=S,y+=e.byteLength(S,"utf8")}break;case o.components.contextQuotedPair:v=S.codePointAt(0),127!==v&&o.c1Controls(v)?c(o.diagnoses.errExpectingQPair):(v<31&&9!==v||127===v)&&c(o.diagnoses.deprecatedQP),h.prev=h.now,h.now=h.stack.pop();var P="\\"+S;switch(h.now){case o.components.contextComment:break;case o.components.contextQuotedString:d.local+=P,m.locals[g]+=P,y+=2;break;case o.components.literal:d.domain+=P,m.domains[g]+=P,y+=2;break;default:throw new Error("quoted pair logic invoked in an invalid context: "+h.now)}break;case o.components.contextComment:switch(S){case"(":h.stack.push(h.now),h.now=o.components.contextComment;break;case")":h.prev=h.now,h.now=h.stack.pop();break;case"\\":h.stack.push(h.now),h.now=o.components.contextQuotedPair;break;case"\r":if(k===++E||"\n"!==t[E]){c(o.diagnoses.errCRNoLF);break}case" ":case"\t":c(o.diagnoses.cfwsFWS),h.stack.push(h.now),h.now=o.components.contextFWS,p=S;break;default:if(v=S.codePointAt(0),0===v||10===v||127!==v&&o.c1Controls(v)){c(o.diagnoses.errExpectingCTEXT);break}(o.c0Controls(v)||127===v)&&c(o.diagnoses.deprecatedCTEXT)}break;case o.components.contextFWS:if("\r"===p){if("\r"===S){c(o.diagnoses.errFWSCRLFx2);break}++b>1?c(o.diagnoses.deprecatedFWS):b=1}switch(S){case"\r":k!==++E&&"\n"===t[E]||c(o.diagnoses.errCRNoLF);break;case" ":case"\t":break;default:"\r"===p&&c(o.diagnoses.errFWSCRLFEnd),b=0,h.prev=h.now,h.now=h.stack.pop(),--E}p=S;break;default:throw new Error("unknown context: "+h.now)}if(l>o.categories.rfc5322)break}if(l255)c(o.diagnoses.rfc5322DomainTooLong);else if(e.byteLength(d.local,"utf8")+B+1>254)c(o.diagnoses.rfc5322TooLong);else if(y>63)c(o.diagnoses.rfc5322LabelTooLong);else if(n.minDomainAtoms&&m.domains.length0){var w=u.shift();if(b=w._validate(p,y,i),b.errors){if(o.push(this.createError("array.ordered",{pos:f,reason:b.errors,value:p},{key:r.key,path:y.path},i)),i.abortEarly)return o}else if(w._flags.strip)h.fastSplice(t,f),--f,--c;else{if(!this._flags.sparse&&void 0===b.value){if(o.push(this.createError("array.sparse",null,{key:r.key,path:y.path,pos:f},i)),i.abortEarly)return o;continue}t[f]=b.value}continue}if(!this._inner.items.length){if(o.push(this.createError("array.orderedLength",{pos:f,limit:this._inner.ordereds.length},{key:r.key,path:y.path},i)),i.abortEarly)return o;continue}}for(var _=[],k=a.length,S=0;S=0||n,"limit must be a positive integer or reference"),this._test("min",t,function(e,r,i){var o=void 0;if(n){if(o=t(r.reference||r.parent,i),!(Number.isSafeInteger(o)&&o>=0))return this.createError("array.ref",{ref:t.key},r,i)}else o=t;return e.length>=o?e:this.createError("array.min",{limit:t,value:e},r,i)})},t.prototype.max=function e(t){var n=c.isRef(t);return f.assert(Number.isSafeInteger(t)&&t>=0||n,"limit must be a positive integer or reference"),this._test("max",t,function(e,r,i){var o=void 0;if(n){if(o=t(r.reference||r.parent,i),!(Number.isSafeInteger(o)&&o>=0))return this.createError("array.ref",{ref:t.key},r,i)}else o=t;return e.length<=o?e:this.createError("array.max",{limit:t,value:e},r,i)})},t.prototype.length=function e(t){var n=c.isRef(t);return f.assert(Number.isSafeInteger(t)&&t>=0||n,"limit must be a positive integer or reference"),this._test("length",t,function(e,r,i){var o=void 0;if(n){if(o=t(r.reference||r.parent,i),!(Number.isSafeInteger(o)&&o>=0))return this.createError("array.ref",{ref:t.key},r,i)}else o=t;return e.length===o?e:this.createError("array.length",{limit:t,value:e},r,i)})},t.prototype.unique=function e(t){f.assert(void 0===t||"function"==typeof t||"string"==typeof t,"comparator must be a function or a string");var n={};return"string"==typeof t?n.path=t:"function"==typeof t&&(n.comparator=t),this._test("unique",n,function(e,t,i){for(var o={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),object:new Map,function:new Map,custom:new Map},s=n.comparator||f.deepEqual,a=0;a=0,"limit must be a positive integer"),this._test("min",t,function(e,n,r){return e.length>=t?e:this.createError("binary.min",{limit:t,value:e},n,r)})},n.prototype.max=function e(t){return u.assert(Number.isSafeInteger(t)&&t>=0,"limit must be a positive integer"),this._test("max",t,function(e,n,r){return e.length<=t?e:this.createError("binary.max",{limit:t,value:e},n,r)})},n.prototype.length=function e(t){return u.assert(Number.isSafeInteger(t)&&t>=0,"limit must be a positive integer"),this._test("length",t,function(e,n,r){return e.length===t?e:this.createError("binary.length",{limit:t,value:e},n,r)})},n}(a),e.exports=new l.Binary}).call(t,n(3).Buffer)},function(e,t,n){"use strict";function r(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r=0,"n must be a positive integer"),this._test("arity",t,function(e,n,r){return e.length===t?e:this.createError("function.arity",{n:t},n,r)})},t.prototype.minArity=function e(t){return a.assert(Number.isSafeInteger(t)&&t>0,"n must be a strict positive integer"),this._test("minArity",t,function(e,n,r){return e.length>=t?e:this.createError("function.minArity",{n:t},n,r)})},t.prototype.maxArity=function e(t){return a.assert(Number.isSafeInteger(t)&&t>=0,"n must be a positive integer"),this._test("maxArity",t,function(e,n,r){return e.length<=t?e:this.createError("function.maxArity",{n:t},n,r)})},t.prototype.ref=function e(){return this._test("ref",null,function(e,t,n){return l.isRef(e)?e:this.createError("function.ref",null,t,n)})},t.prototype.class=function e(){return this._test("class",null,function(e,t,n){return/^\s*class\s/.test(e.toString())?e:this.createError("function.class",null,t,n)})},t}(u.constructor),e.exports=new c.Func},function(e,t,n){"use strict";function r(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r0,"multiple must be greater than 0")),this._test("multiple",t,function(e,r,i){var o=n?t(r.reference||r.parent,i):t;return!n||"number"==typeof o&&isFinite(o)?e%o==0?e:this.createError("number.multiple",{multiple:t,value:e},r,i):this.createError("number.ref",{ref:t.key},r,i)})},t.prototype.integer=function e(){return this._test("integer",void 0,function(e,t,n){return Number.isSafeInteger(e)?e:this.createError("number.integer",{value:e},t,n)})},t.prototype.negative=function e(){return this._test("negative",void 0,function(e,t,n){return e<0?e:this.createError("number.negative",{value:e},t,n)})},t.prototype.positive=function e(){return this._test("positive",void 0,function(e,t,n){return e>0?e:this.createError("number.positive",{value:e},t,n)})},t.prototype.precision=function e(t){l.assert(Number.isSafeInteger(t),"limit must be an integer"),l.assert(!("precision"in this._flags),"precision already set");var n=this._test("precision",t,function(e,n,r){var i=e.toString().match(c.precisionRx),o=Math.max((i[1]?i[1].length:0)-(i[2]?parseInt(i[2],10):0),0);return o<=t?e:this.createError("number.precision",{limit:t,value:e},n,r)});return n._flags.precision=t,n},t.prototype.port=function e(){return this._test("port",void 0,function(e,t,n){return!Number.isSafeInteger(e)||e<0||e>65535?this.createError("number.port",{value:e},t,n):e})},t}(a),c.compare=function(e,t){return function(n){var r=u.isRef(n),i="number"==typeof n&&!isNaN(n);return l.assert(i||r,"limit must be a number or reference"),this._test(e,n,function(i,o,s){var a=void 0;if(r){if(a=n(o.reference||o.parent,s),"number"!=typeof a||isNaN(a))return this.createError("number.ref",{ref:n.key},o,s)}else a=n;return t(i,a)?i:this.createError("number."+e,{limit:a,value:i},o,s)})}},c.Number.prototype.min=c.compare("min",function(e,t){return e>=t}),c.Number.prototype.max=c.compare("max",function(e,t){return e<=t}),c.Number.prototype.greater=c.compare("greater",function(e,t){return e>t}),c.Number.prototype.less=c.compare("less",function(e,t){return e9),o^=3}var a=i%10==0&&i>0;return a?e:this.createError("string.creditCard",{value:e},t,n)})},t.prototype.regex=function e(t,n){l.assert(t instanceof RegExp,"pattern must be a RegExp");var i={pattern:new RegExp(t.source,t.ignoreCase?"i":void 0)};"string"==typeof n?i.name=n:"object"===(void 0===n?"undefined":r(n))&&(i.invert=!!n.invert,n.name&&(i.name=n.name));var o=["string.regex",i.invert?".invert":"",i.name?".name":".base"].join("");return this._test("regex",i,function(e,t,n){var r=i.pattern.test(e);return r^i.invert?e:this.createError(o,{name:i.name,pattern:i.pattern,value:e},t,n)})},t.prototype.alphanum=function e(){return this._test("alphanum",void 0,function(e,t,n){return/^[a-zA-Z0-9]+$/.test(e)?e:this.createError("string.alphanum",{value:e},t,n)})},t.prototype.token=function e(){return this._test("token",void 0,function(e,t,n){return/^\w+$/.test(e)?e:this.createError("string.token",{value:e},t,n)})},t.prototype.email=function e(t){return t&&(l.assert("object"===(void 0===t?"undefined":r(t)),"email options must be an object"),l.assert(void 0===t.checkDNS,"checkDNS option is not supported"),l.assert(void 0===t.tldWhitelist||"object"===r(t.tldWhitelist),"tldWhitelist must be an array or object"),l.assert(void 0===t.minDomainAtoms||Number.isSafeInteger(t.minDomainAtoms)&&t.minDomainAtoms>0,"minDomainAtoms must be a positive integer"),l.assert(void 0===t.errorLevel||"boolean"==typeof t.errorLevel||Number.isSafeInteger(t.errorLevel)&&t.errorLevel>=0,"errorLevel must be a non-negative integer or boolean")),this._test("email",t,function(e,r,i){c=c||n(19);try{var o=c.validate(e,t);if(!0===o||0===o)return e}catch(e){}return this.createError("string.email",{value:e},r,i)})},t.prototype.ip=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=g.ipRegex;l.assert("object"===(void 0===t?"undefined":r(t)),"options must be an object"),t.cidr?(l.assert("string"==typeof t.cidr,"cidr must be a string"),t.cidr=t.cidr.toLowerCase(),l.assert(l.contain(g.cidrPresences,t.cidr),"cidr must be one of "+g.cidrPresences.join(", ")),t.version||"optional"===t.cidr||(n=m.createIpRegex(["ipv4","ipv6","ipvfuture"],t.cidr))):t.cidr="optional";var i=void 0;if(t.version){Array.isArray(t.version)||(t.version=[t.version]),l.assert(t.version.length>=1,"version must have at least 1 version specified"),i=[];for(var o=0;o=1,"scheme must have at least 1 scheme specified");for(var a=0;a=1,"version must have at least 1 valid version specified");for(var r=new Set,i=0;i0&&void 0!==arguments[0]?arguments[0]:{};l.assert("object"===(void 0===t?"undefined":r(t)),"hex options must be an object"),l.assert(void 0===t.byteAligned||"boolean"==typeof t.byteAligned,"byteAligned must be boolean");var n=!0===t.byteAligned,i=/^[a-f0-9]+$/i,o=this._test("hex",i,function(e,t,r){return i.test(e)?n&&e.length%2!=0?this.createError("string.hexAlign",{value:e},t,r):e:this.createError("string.hex",{value:e},t,r)});return n&&(o._flags.byteAligned=!0),o},t.prototype.base64=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};l.assert("object"===(void 0===t?"undefined":r(t)),"base64 options must be an object"),l.assert(void 0===t.paddingRequired||"boolean"==typeof t.paddingRequired,"paddingRequired must be boolean");var n=!1===t.paddingRequired?t.paddingRequired:t.paddingRequired||!0,i=n?/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/:/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/;return this._test("base64",i,function(e,t,n){return i.test(e)?e:this.createError("string.base64",{value:e},t,n)})},t.prototype.hostname=function e(){var t=/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/;return this._test("hostname",void 0,function(e,n,r){return e.length<=255&&t.test(e)||u.isIPv6(e)?e:this.createError("string.hostname",{value:e},n,r)})},t.prototype.normalize=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"NFC";l.assert(l.contain(g.normalizationForms,t),"normalization form must be one of "+g.normalizationForms.join(", "));var n=this._test("normalize",t,function(e,n,r){return r.convert||e===e.normalize(t)?e:this.createError("string.normalize",{value:e,form:t},n,r)});return n._flags.normalize=t,n},t.prototype.lowercase=function e(){var t=this._test("lowercase",void 0,function(e,t,n){return n.convert||e===e.toLocaleLowerCase()?e:this.createError("string.lowercase",{value:e},t,n)});return t._flags.case="lower",t},t.prototype.uppercase=function e(){var t=this._test("uppercase",void 0,function(e,t,n){return n.convert||e===e.toLocaleUpperCase()?e:this.createError("string.uppercase",{value:e},t,n)});return t._flags.case="upper",t},t.prototype.trim=function e(){var t=this._test("trim",void 0,function(e,t,n){return n.convert||e===e.trim()?e:this.createError("string.trim",{value:e},t,n)});return t._flags.trim=!0,t},t.prototype.replace=function e(t,n){"string"==typeof t&&(t=new RegExp(l.escapeRegex(t),"g")),l.assert(t instanceof RegExp,"pattern must be a RegExp"),l.assert("string"==typeof n,"replacement must be a String");var r=this.clone();return r._inner.replacements||(r._inner.replacements=[]),r._inner.replacements.push({pattern:t,replacement:n}),r},t.prototype.truncate=function e(t){var n=void 0===t||!!t;if(this._flags.truncate===n)return this;var r=this.clone();return r._flags.truncate=n,r},t}(f),g.compare=function(e,n){return function(r,i){var o=h.isRef(r);return l.assert(Number.isSafeInteger(r)&&r>=0||o,"limit must be a positive integer or reference"),l.assert(!i||t.isEncoding(i),"Invalid encoding:",i),this._test(e,r,function(t,s,a){var u=void 0;if(o){if(u=r(s.reference||s.parent,a),!Number.isSafeInteger(u))return this.createError("string.ref",{ref:r.key},s,a)}else u=r;return n(t,u,i)?t:this.createError("string."+e,{limit:u,value:t,encoding:i},s,a)})}},g.String.prototype.min=g.compare("min",function(e,n,r){var i=r?t.byteLength(e,r):e.length;return i>=n}),g.String.prototype.max=g.compare("max",function(e,n,r){var i=r?t.byteLength(e,r):e.length;return i<=n}),g.String.prototype.length=g.compare("length",function(e,n,r){var i=r?t.byteLength(e,r):e.length;return i===n}),g.String.prototype.uuid=g.String.prototype.guid,e.exports=new g.String}).call(t,n(3).Buffer)},function(e,t,n){"use strict";var r=n(14),i={Ip:{cidrs:{ipv4:{required:"\\/(?:"+r.ipv4Cidr+")",optional:"(?:\\/(?:"+r.ipv4Cidr+"))?",forbidden:""},ipv6:{required:"\\/"+r.ipv6Cidr,optional:"(?:\\/"+r.ipv6Cidr+")?",forbidden:""},ipvfuture:{required:"\\/"+r.ipv6Cidr,optional:"(?:\\/"+r.ipv6Cidr+")?",forbidden:""}},versions:{ipv4:r.IPv4address,ipv6:r.IPv6address,ipvfuture:r.IPvFuture}}};i.Ip.createIpRegex=function(e,t){for(var n=void 0,r=0;r0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function c(e){return 3*e.length/4-l(e)}function f(e){var t,n,r,s,a,u=e.length;s=l(e),a=new o(3*u/4-s),n=s>0?u-4:u;var c=0;for(t=0;t>16&255,a[c++]=r>>8&255,a[c++]=255&r;return 2===s?(r=i[e.charCodeAt(t)]<<2|i[e.charCodeAt(t+1)]>>4,a[c++]=255&r):1===s&&(r=i[e.charCodeAt(t)]<<10|i[e.charCodeAt(t+1)]<<4|i[e.charCodeAt(t+2)]>>2,a[c++]=r>>8&255,a[c++]=255&r),a}function h(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function p(e,t,n){for(var r,i=[],o=t;ol?l:u+16383));return 1===i?(t=e[n-1],o+=r[t>>2],o+=r[t<<4&63],o+="=="):2===i&&(t=(e[n-2]<<8)+e[n-1],o+=r[t>>10],o+=r[t>>4&63],o+=r[t<<2&63],o+="="),s.push(o),s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<>1,c=-7,f=n?i-1:0,h=n?-1:1,p=e[t+f];for(f+=h,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+e[t+f],f+=h,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+e[t+f],f+=h,c-=8);if(0===o)o=1-l;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=l}return(p?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,u,l=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+f>=1?h/u:h*Math.pow(2,1-f),t*u>=2&&(s++,u/=2),s+f>=c?(a=0,s=c):s+f>=1?(a=(t*u-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;e[n+p]=255&s,p+=d,s/=256,l-=8);e[n+p-d]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){e.exports={_args:[["joi@13.4.0","/Users/jeff/projects/joi-browser"]],_development:!0,_from:"joi@13.4.0",_id:"joi@13.4.0",_inBundle:!1,_integrity:"sha512-JuK4GjEu6j7zr9FuVe2MAseZ6si/8/HaY0qMAejfDFHp7jcH4OKE937mIHM5VT4xDS0q7lpQbszbxKV9rm0yUg==",_location:"/joi",_phantomChildren:{},_requested:{type:"version",registry:!0,raw:"joi@13.4.0",name:"joi",escapedName:"joi",rawSpec:"13.4.0",saveSpec:null,fetchSpec:"13.4.0"},_requiredBy:["#DEV:/"],_resolved:"https://registry.npmjs.org/joi/-/joi-13.4.0.tgz",_spec:"13.4.0",_where:"/Users/jeff/projects/joi-browser",bugs:{url:"https://github.com/hapijs/joi/issues"},dependencies:{hoek:"5.x.x",isemail:"3.x.x",topo:"3.x.x"},description:"Object schema validation",devDependencies:{code:"5.x.x",hapitoc:"1.x.x",lab:"15.x.x"},engines:{node:">=8.9.0"},homepage:"https://github.com/hapijs/joi",keywords:["hapi","schema","validation"],license:"BSD-3-Clause",main:"lib/index.js",name:"joi",repository:{type:"git",url:"git://github.com/hapijs/joi.git"},scripts:{test:"lab -t 100 -a code -L","test-cov-html":"lab -r html -o coverage.html -a code","test-debug":"lab -a code",toc:"hapitoc",version:"npm run toc && git add API.md README.md"},version:"13.4.0"}},function(e,t,n){(function(e){function n(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(e){return r.exec(e).slice(1)};function o(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!r;i--){var s=i>=0?arguments[i]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,r="/"===s.charAt(0))}return t=n(o(t.split("/"),function(e){return!!e}),!r).join("/"),(r?"/":"")+t||"."},t.normalize=function(e){var r=t.isAbsolute(e),i="/"===s(e,-1);return e=n(o(e.split("/"),function(e){return!!e}),!r).join("/"),e||r||(e="."),e&&i&&(e+="/"),(r?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(o(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,n){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var i=r(e.split("/")),o=r(n.split("/")),s=Math.min(i.length,o.length),a=s,u=0;u= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=f-h,E=Math.floor,x=String.fromCharCode,C;function A(e){throw new RangeError(k[e])}function I(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function T(e,t){var n=e.split("@"),r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(_,".");var i=e.split("."),o=I(i,t).join(".");return r+o}function j(e){for(var t=[],n=0,r=e.length,i,o;n=55296&&i<=56319&&n65535&&(e-=65536,t+=x(e>>>10&1023|55296),e=56320|1023&e),t+=x(e),t}).join("")}function P(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:f}function B(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function R(e,t,n){var r=0;for(e=n?E(e/m):e>>1,e+=E(e/t);e>S*p>>1;r+=f)e=E(e/S);return E(r+(S+1)*e/(e+d))}function N(e){var t=[],n=e.length,r,i=0,o=y,s=g,a,u,l,d,m,v,w,_,k;for(a=e.lastIndexOf(b),a<0&&(a=0),u=0;u=128&&A("not-basic"),t.push(e.charCodeAt(u));for(l=a>0?a+1:0;l=n&&A("invalid-input"),w=P(e.charCodeAt(l++)),(w>=f||w>E((c-i)/m))&&A("overflow"),i+=w*m,_=v<=s?h:v>=s+p?p:v-s,!(w<_);v+=f)k=f-_,m>E(c/k)&&A("overflow"),m*=k;r=t.length+1,s=R(i-d,r,0==d),E(i/r)>c-o&&A("overflow"),o+=E(i/r),i%=r,t.splice(i++,0,o)}return O(t)}function M(e){var t,n,r,i,o,s,a,u,l,d,m,v=[],w,_,k,S;for(e=j(e),w=e.length,t=y,n=0,o=g,s=0;s=t&&mE((c-n)/_)&&A("overflow"),n+=(a-t)*_,t=a,s=0;sc&&A("overflow"),m==t){for(u=n,l=f;d=l<=o?h:l>=o+p?p:l-o,!(u2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(m.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(f.validity.notBefore=m[0],f.validity.notAfter=m[1],f.tbsCertificate=n.tbsCertificate,t){if(f.md=null,f.signatureOid in s){var c=s[f.signatureOid];switch(c){case"sha1WithRSAEncryption":f.md=r.md.sha1.create();break;case"md5WithRSAEncryption":f.md=r.md.md5.create();break;case"sha256WithRSAEncryption":f.md=r.md.sha256.create();break;case"sha384WithRSAEncryption":f.md=r.md.sha384.create();break;case"sha512WithRSAEncryption":f.md=r.md.sha512.create();break;case"RSASSA-PSS":f.md=r.md.sha256.create()}}if(null===f.md){var u=new Error("Could not compute certificate digest. Unknown signature OID.");throw u.signatureOid=f.signatureOid,u}var g=i.toDer(f.tbsCertificate);f.md.update(g.getBytes())}var b=r.md.sha1.create();f.issuer.getField=function(e){return p(f.issuer,e)},f.issuer.addField=function(e){y([e]),f.issuer.attributes.push(e)},f.issuer.attributes=o.RDNAttributesAsArray(n.certIssuer,b),n.certIssuerUniqueId&&(f.issuer.uniqueId=n.certIssuerUniqueId),f.issuer.hash=b.digest().toHex();var v=r.md.sha1.create();return f.subject.getField=function(e){return p(f.subject,e)},f.subject.addField=function(e){y([e]),f.subject.attributes.push(e)},f.subject.attributes=o.RDNAttributesAsArray(n.certSubject,v),n.certSubjectUniqueId&&(f.subject.uniqueId=n.certSubjectUniqueId),f.subject.hash=v.digest().toHex(),n.certExtensions?f.extensions=o.certificateExtensionsFromAsn1(n.certExtensions):f.extensions=[],f.publicKey=o.publicKeyFromAsn1(n.subjectPublicKeyInfo),f},o.certificateExtensionsFromAsn1=function(e){for(var t=[],n=0;n1&&(o=n.value.charCodeAt(1),a=n.value.length>2?n.value.charCodeAt(2):0),t.digitalSignature=128==(128&o),t.nonRepudiation=64==(64&o),t.keyEncipherment=32==(32&o),t.dataEncipherment=16==(16&o),t.keyAgreement=8==(8&o),t.keyCertSign=4==(4&o),t.cRLSign=2==(2&o),t.encipherOnly=1==(1&o),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var n=i.fromDer(t.value);n.value.length>0&&n.value[0].type===i.Type.BOOLEAN?t.cA=0!==n.value[0].value.charCodeAt(0):t.cA=!1;var u=null;n.value.length>0&&n.value[0].type===i.Type.INTEGER?u=n.value[0].value:n.value.length>1&&(u=n.value[1].value),null!==u&&(t.pathLenConstraint=i.derToInteger(u))}else if("extKeyUsage"===t.name)for(var n=i.fromDer(t.value),l=0;l1&&(o=n.value.charCodeAt(1)),t.client=128==(128&o),t.server=64==(64&o),t.email=32==(32&o),t.objsign=16==(16&o),t.reserved=8==(8&o),t.sslCA=4==(4&o),t.emailCA=2==(2&o),t.objCA=1==(1&o)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var f;t.altNames=[];for(var n=i.fromDer(t.value),h=0;h0&&t.value.push(o.certificateExtensionsToAsn1(e.extensions)),t},o.getCertificationRequestInfo=function(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),m(e.subject),o.publicKeyToAsn1(e.publicKey),w(e)]);return t},o.distinguishedNameToAsn1=function(e){return m(e)},o.certificateToAsn1=function(e){var t=e.tbsCertificate||o.getTBSCertificate(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),v(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},o.certificateExtensionsToAsn1=function(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,3,!0,[]),n=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(n);for(var r=0;rc.validity.notAfter)&&(u={message:"Certificate is not valid yet or has expired.",error:o.certificateError.certificate_expired,notBefore:c.validity.notBefore,notAfter:c.validity.notAfter,now:s}),null===u){if(f=t[0]||e.getIssuer(c),null===f&&c.isIssuer(c)&&(h=!0,f=c),f){var p=f;r.util.isArray(p)||(p=[p]);for(var d=!1;!d&&p.length>0;){f=p.shift();try{d=f.verify(c)}catch(e){}}d||(u={message:"Certificate signature is invalid.",error:o.certificateError.bad_certificate})}null!==u||f&&!h||e.hasCertificate(c)||(u={message:"Certificate is not trusted.",error:o.certificateError.unknown_ca})}if(null===u&&f&&!c.isIssuer(f)&&(u={message:"Certificate issuer is invalid.",error:o.certificateError.bad_certificate}),null===u)for(var m={keyUsage:!0,basicConstraints:!0},g=0;null===u&&gb.pathLenConstraint&&(u={message:"Certificate basicConstraints pathLenConstraint violated.",error:o.certificateError.bad_certificate})}}var _=null===u||u.error,k=n?n(_,l,i):_;if(!0!==k)throw!0===_&&(u={message:"The application rejected the certificate.",error:o.certificateError.bad_certificate}),(k||0===k)&&("object"!=typeof k||r.util.isArray(k)?"string"==typeof k&&(u.error=k):(k.message&&(u.message=k.message),k.error&&(u.error=k.error))),u;u=null,a=!1,++l}while(t.length>0);return!0}},function(e,t){function n(e,t,n){var r;return function(){if(!t)return e.apply(this,arguments);var i=this,o=arguments,s=n&&!r;return clearTimeout(r),r=setTimeout(function(){if(r=null,!s)return e.apply(i,o)},t),s?e.apply(this,arguments):void 0}}e.exports=n},function(e,t,n){"use strict";var r=n(992);function i(e){return Number.isFinite(e)}function o(e){return"function"==typeof e}function s(e,t){return t?function(n,r){var i=setTimeout(function(){e(new Error("pull-reader: read exceeded timeout"),r)},t);e(n,function(e,t){clearTimeout(i),r(e,t)})}:e}e.exports=function(e){var t=[],n,a,u=!1,l=r(),c,f,h;function p(){for(;t.length;)if(null==t[0].length&&l.has(1))t.shift().cb(null,l.get());else if(l.has(t[0].length)){var e=t.shift();e.cb(null,l.get(e.length))}else if(1==c&&t[0].length&&l.length 0 to the moving average constructor");let n,i=0,o=0,s=0,a,u={};function l(e,n){return 1-r(-(e-n)/t)}return u.push=function e(t,r){if(a){const e=l(t,a),u=r-n,c=e*u;n=e*r+(1-e)*n,i=(1-e)*(i+u*c),o=Math.sqrt(i),s=n+e*u}else n=r;a=t},u.movingAverage=function e(){return n},u.variance=function e(){return i},u.deviation=function e(){return o},u.forecast=function e(){return s},u}},function(e,t,n){var r=n(494),i=n(249);function o(e,t){t=r(t,e);for(var n=0,o=t.length;null!=e&&nr(e.bytes,t),r=>this.publisher.publishWithEOL(e,t,n,r)],(e,r)=>{if(e)return u.error(e),o(e);u(`IPNS value ${t} was published correctly`);const i=r[0].toB58String(),s=parseFloat(n),a=s{if(t)return u.error(t),n(t);u(`IPNS record from ${e} was resolved correctly`),n(null,{path:r})})}initializeKeyspace(e,t,n){this.publisher.publish(e,t,n)}}t=e.exports=d,t.path=h},function(e,t,n){"use strict";const r=n(65),i=n(5),o=i("jsipfs:ipns:path");o.error=i("jsipfs:ipns:path:error");const s=(e,t,n)=>{if(r.ipnsPath(t))return o(`resolve ipns path ${t}`),e._ipns.resolve(t,n);e.dag.get(t.substring("/ipfs/".length),(e,t)=>e?n(e):n(null,t))};e.exports={resolvePath:s}},function(e,t,n){"use strict";(function(r){const i=n(183),{fromB58String:o,toB58String:s}=n(35),a=n(1032),u=n(53),l=n(22),c=n(5),f=c("jsipfs:ipns:pubsub");f.error=c("jsipfs:ipns:pubsub:error");class h{constructor(e,t,n){this._pubsub=e,this._subscriptions={},this._handleSubscriptionKey=this._handleSubscriptionKey.bind(this),this._pubsubDs=new a(e,t,n,i.validator,this._handleSubscriptionKey)}put(e,t,n){this._pubsubDs.put(e,t,n)}get(e,t){this._pubsubDs.get(e,(n,r)=>{const o=e.slice(0,i.namespaceLength);if(o.toString()===i.namespace){const t=e.toString(),n=s(e.slice(i.namespaceLength));this._subscriptions[t]=n,f(`subscribed pubsub ${t}: ${n}`)}if(n)return t(n);t(null,r)})}_handleSubscriptionKey(e,t){const n=this._subscriptions[e];if(!n){const n=`key ${e} does not correspond to a subscription`;return f.error(n),t(l(new Error(n),"ERR_INVALID_KEY"))}let r;try{r=i.getIdKeys(o(n))}catch(e){return f.error(e),t(e)}t(null,r.routingKey.toBuffer())}getSubscriptions(e){const t=Object.values(this._subscriptions).filter(Boolean);return e(null,t.map(e=>`${i.namespace}${e}`))}cancel(e,t){if("string"!=typeof e){const e="received subscription name is not valid";return f.error(e),t(l(new Error(e),"ERR_INVALID_SUBSCRIPTION_NAME"))}e.startsWith(i.namespace)&&(e=e.substring(i.namespaceLength));const n=Object.keys(this._subscriptions).find(t=>this._subscriptions[t]===e);if(!n)return t(null,{canceled:!1});try{const e=r.from(n);this._pubsubDs.unsubscribe(e)}catch(e){return t(e)}this._subscriptions[n]=void 0,f(`unsubscribed pubsub ${n}: ${e}`),t(null,{canceled:!0})}}t=e.exports=u(h,{className:"IpnsPubsubDatastore",symbolName:"@js-ipfs/ipns/IpnsPubsubDatastore"})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const{Key:i}=n(33),{Record:o}=n(1034),{encodeBase32:s}=n(503),a=n(22),u=n(5),l=u("jsipfs:ipns:offline-datastore");l.error=u("jsipfs:ipns:offline-datastore:error");class c{constructor(e){this._repo=e}put(e,t,n){if(!r.isBuffer(e)){const e="Offline datastore key must be a buffer";return l.error(e),n(a(new Error(e),"ERR_INVALID_KEY"))}if(!r.isBuffer(t)){const e="Offline datastore value must be a buffer";return l.error(e),n(a(new Error(e),"ERR_INVALID_VALUE"))}let i;try{i=this._routingKey(e)}catch(e){const t="Not possible to generate the routing key";return l.error(t),n(a(new Error(t),"ERR_GENERATING_ROUTING_KEY"))}const s=new o(e,t);this._repo.datastore.put(i,s.serialize(),n)}get(e,t){if(!r.isBuffer(e)){const e="Offline datastore key must be a buffer";return l.error(e),t(a(new Error(e),"ERR_INVALID_KEY"))}let n;try{n=this._routingKey(e)}catch(e){const n="Not possible to generate the routing key";return l.error(n),t(a(new Error(n),"ERR_GENERATING_ROUTING_KEY"))}this._repo.datastore.get(n,(e,n)=>{if(e)return t(e);let r;try{r=o.deserialize(n)}catch(e){return l.error(e),t(e)}t(null,r.value)})}_routingKey(e){return new i("/"+s(e),!1)}}t=e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){var r=n(1039);e.exports=function(e,t,n){for(var i=-1,o=[],s=n?t.length:0;(i=r(e,t))>-1;)o.push(e.slice(0,i+s)),e=e.slice(i+t.length,e.length);return o.push(e),o}},function(e,t,n){"use strict";(function(e,n){t.toCallback=(t=>(function(n,r){let i;try{i=t(n)}catch(t){return void e.nextTick(r,t)}e.nextTick(r,null,i)})),t.toBuf=((e,t)=>r=>{let i=e(r,t);return n.from(i,"hex")}),t.fromString=((e,t)=>r=>{const i=n.isBuffer(r)?r.toString():r;return e(i,t)}),t.fromNumberTo32BitBuf=((e,t)=>r=>{let i=e(r,t);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return n.from(o)})}).call(this,n(2),n(0).Buffer)},function(e,t,n){"use strict";const r=n(89),i=n(183);e.exports={encodeBase32:e=>{const t=r.encode("base32",e).slice(1);return t.toString().toUpperCase()},validator:{func:(e,t,n)=>i.validator.validate(t,e,n)},selector:(e,t)=>i.validator.select(t[0],t[1])}},function(e,t,n){"use strict";const r=n(244),i=n(182),o=n(503);function s({datastore:e,peerInfo:t,peerBook:s,options:a,config:u}){const l={datastore:e,peerInfo:t,peerBook:s,config:{peerDiscovery:{mdns:{enabled:r(a,"config.Discovery.MDNS.Enabled",r(u,"Discovery.MDNS.Enabled",!0))},webRTCStar:{enabled:r(a,"config.Discovery.webRTCStar.Enabled",r(u,"Discovery.webRTCStar.Enabled",!0))},bootstrap:{list:r(a,"config.Bootstrap",r(u,"Bootstrap",[]))}},relay:{enabled:r(a,"relay.enabled",r(u,"relay.enabled",!1)),hop:{enabled:r(a,"relay.hop.enabled",r(u,"relay.hop.enabled",!1)),active:r(a,"relay.hop.active",r(u,"relay.hop.active",!1))}},dht:{validators:{ipns:o.validator},selectors:{ipns:o.selector}},EXPERIMENTAL:{dht:r(a,"EXPERIMENTAL.dht",!1),pubsub:r(a,"EXPERIMENTAL.pubsub",!1)}},connectionManager:r(a,"connectionManager",r(u,"connectionManager",{}))},c=i(r(a,"libp2p",{}),l),f=n(1049);return new f(c)}e.exports=function e(t,n){const r=t._options||{};n=n||{};const i="function"==typeof r.libp2p?r.libp2p:s,{datastore:o}=t._repo,a=t._peerInfo,u=t._peerInfoBook,e=i({options:r,config:n,datastore:o,peerInfo:a,peerBook:u});let l=[];const c=t=>{u.put(t),e.dial(t,()=>{})};return e.on("start",()=>{a.multiaddrs.forEach(e=>{t._print("Swarm listening on",e.toString())}),l.forEach(c),l=[]}),e.on("peer:discovery",e=>{t.isOnline()?c(e):l.push(e)}),e.on("peer:connect",e=>u.put(e)),e}},function(e,t,n){"use strict";const r=n(1050),i=n(92),o=n(53),s=n(66).Connection,a=n(506),u=n(5),l=u("libp2p:websockets:dialer"),c=n(1059);class f{dial(e,t,n){"function"==typeof t&&(n=t,t={}),n=n||function(){};const i=a(e);l("dialing %s",i);const o=r(i,{binary:!0,onConnect:e=>{n(e)}}),u=new s(o);return u.getObservedAddrs=(t=>t(null,[e])),u.close=(e=>o.close(e)),u}createListener(e,t){return"function"==typeof e&&(t=e,e={}),c(e,t)}filter(e){return Array.isArray(e)||(e=[e]),e.filter(e=>!e.protoNames().includes("p2p-circuit")&&(e.protoNames().includes("ipfs")&&(e=e.decapsulate("ipfs")),i.WebSockets.matches(e)||i.WebSocketsSecure.matches(e)))}}e.exports=o(f,{className:"WebSockets",symbolName:"@libp2p/js-libp2p-websockets/websockets"})},function(e,t,n){const r=n(24),i=(e,t)=>t,o={ip4:i,ip6:(e,t,n,r)=>1===r.length&&"ip6"===r[0].protocol?t:`[${t}]`,tcp:(e,t,n,r)=>r.some(e=>["http","https","ws","wss"].includes(e.protocol))?`${e}:${t}`:`tcp://${e}:${t}`,udp:(e,t)=>`udp://${e}:${t}`,dnsaddr:i,dns4:i,dns6:i,ipfs:(e,t)=>`${e}/ipfs/${t}`,p2p:(e,t)=>`${e}/p2p/${t}`,http:e=>`http://${e}`,https:e=>`https://${e}`,ws:e=>`ws://${e}`,wss:e=>`wss://${e}`,"p2p-websocket-star":e=>`${e}/p2p-websocket-star`,"p2p-webrtc-star":e=>`${e}/p2p-webrtc-star`,"p2p-webrtc-direct":e=>`${e}/p2p-webrtc-direct`};e.exports=(e=>r(e).stringTuples().map(e=>({protocol:r.protocols.codes[e[0]].name,content:e[1]})).reduce((e,t,n,r)=>{const i=o[t.protocol];if(!i)throw new Error(`Unsupported protocol ${t.protocol}`);return i(e,t.content,n,r)},""))},function(e,t,n){var r=n(1061),i=n(327),o=n(511),s=n(250)("socket.io-client");e.exports=t=u;var a=t.managers={};function u(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var n=r(e),i=n.source,u=n.id,l=n.path,c=a[u]&&l in a[u].nsps,f=t.forceNew||t["force new connection"]||!1===t.multiplex||c,h;return f?(s("ignoring socket cache for %s",i),h=o(i,t)):(a[u]||(s("new io instance for %s",i),a[u]=o(i,t)),h=a[u]),n.query&&!t.query&&(t.query=n.query),h.socket(n.path,t)}t.protocol=i.protocol,t.connect=u,t.Manager=n(511),t.Socket=n(517)},function(e,t){var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function e(t){var i=t,o=t.indexOf("["),s=t.indexOf("]");-1!=o&&-1!=s&&(t=t.substring(0,o)+t.substring(o,s).replace(/:/g,";")+t.substring(s,t.length));for(var a=n.exec(t||""),u={},l=14;l--;)u[r[l]]=a[l]||"";return-1!=o&&-1!=s&&(u.source=i,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){(function(t){e.exports=o;var n="function"==typeof t&&"function"==typeof t.isBuffer,r="function"==typeof ArrayBuffer,i=function(e){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer};function o(e){return n&&t.isBuffer(e)||r&&(e instanceof ArrayBuffer||i(e))}}).call(this,n(0).Buffer)},function(e,t,n){var r=n(1068),i=n(517),o=n(146),s=n(327),a=n(518),u=n(519),l=n(250)("socket.io-client:manager"),c=n(516),f=n(1085),h=Object.prototype.hasOwnProperty;function p(e,t){if(!(this instanceof p))return new p(e,t);e&&"object"==typeof e&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new f({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=t.parser||s;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}e.exports=p,p.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)h.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},p.prototype.updateSocketIds=function(){for(var e in this.nsps)h.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},p.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},o(p.prototype),p.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},p.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},p.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},p.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},p.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},p.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},p.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},p.prototype.open=p.prototype.connect=function(e,t){if(l("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;l("opening %s",this.uri),this.engine=r(this.uri,this.opts);var n=this.engine,i=this;this.readyState="opening",this.skipReconnect=!1;var o=a(n,"open",function(){i.onopen(),e&&e()}),s=a(n,"error",function(t){if(l("connect_error"),i.cleanup(),i.readyState="closed",i.emitAll("connect_error",t),e){var n=new Error("Connection error");n.data=t,e(n)}else i.maybeReconnectOnOpen()});if(!1!==this._timeout){var u=this._timeout;l("connect attempt will timeout after %d",u);var c=setTimeout(function(){l("connect attempt timed out after %d",u),o.destroy(),n.close(),n.emit("error","timeout"),i.emitAll("connect_timeout",u)},u);this.subs.push({destroy:function(){clearTimeout(c)}})}return this.subs.push(o),this.subs.push(s),this},p.prototype.onopen=function(){l("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(a(e,"data",u(this,"ondata"))),this.subs.push(a(e,"ping",u(this,"onping"))),this.subs.push(a(e,"pong",u(this,"onpong"))),this.subs.push(a(e,"error",u(this,"onerror"))),this.subs.push(a(e,"close",u(this,"onclose"))),this.subs.push(a(this.decoder,"decoded",u(this,"ondecoded")))},p.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},p.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},p.prototype.ondata=function(e){this.decoder.add(e)},p.prototype.ondecoded=function(e){this.emit("packet",e)},p.prototype.onerror=function(e){l("error",e),this.emitAll("error",e)},p.prototype.socket=function(e,t){var n=this.nsps[e];if(!n){n=new i(this,e,t),this.nsps[e]=n;var r=this;n.on("connecting",o),n.on("connect",function(){n.id=r.generateId(e)}),this.autoConnect&&o()}function o(){~c(r.connecting,n)||r.connecting.push(n)}return n},p.prototype.destroy=function(e){var t=c(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},p.prototype.packet=function(e){l("writing packet %j",e);var t=this;e.query&&0===e.type&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,function(n){for(var r=0;r0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},p.prototype.cleanup=function(){l("cleanup");for(var e=this.subs.length,t=0;t=this._reconnectionAttempts)l("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();l("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var n=setTimeout(function(){e.skipReconnect||(l("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open(function(t){t?(l("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):(l("reconnect success"),e.onreconnect())}))},t);this.subs.push({destroy:function(){clearTimeout(n)}})}},p.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},function(e,t,n){var r=n(328),i=n(1071),o=n(1081),s=n(1082);function a(e){var t,n=!1,s=!1,a=!1!==e.jsonp;if("undefined"!=typeof location){var u="https:"===location.protocol,l=location.port;l||(l=u?443:80),n=e.hostname!==location.hostname||l!==e.port,s=e.secure!==u}if(e.xdomain=n,e.xscheme=s,t=new r(e),"open"in t&&!e.forceJSONP)return new i(e);if(!a)throw new Error("JSONP disabled");return new o(e)}t.polling=a,t.websocket=s},function(e,t,n){var r=n(329),i=n(251),o=n(147),s=n(252),a=n(515),u=n(253)("engine.io-client:polling");e.exports=h;var l=(c=n(328),f=new c({xdomain:!1}),null!=f.responseType),c,f;function h(e){var t=e&&e.forceBase64;l&&!t||(this.supportsBinary=!1),r.call(this,e)}s(h,r),h.prototype.name="polling",h.prototype.doOpen=function(){this.poll()},h.prototype.pause=function(e){var t=this;function n(){u("paused"),t.readyState="paused",e()}if(this.readyState="pausing",this.polling||!this.writable){var r=0;this.polling&&(u("we are currently polling - waiting to pause"),r++,this.once("pollComplete",function(){u("pre-pause polling complete"),--r||n()})),this.writable||(u("we are currently writing - waiting to pause"),r++,this.once("drain",function(){u("pre-pause writing complete"),--r||n()}))}else n()},h.prototype.poll=function(){u("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},h.prototype.onData=function(e){var t=this;u("polling got data %s",e);var n=function(e,n,r){if("opening"===t.readyState&&t.onOpen(),"close"===e.type)return t.onClose(),!1;t.onPacket(e)};o.decodePayload(e,this.socket.binaryType,n),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():u('ignoring poll - transport state "%s"',this.readyState))},h.prototype.doClose=function(){var e=this;function t(){u("writing close packet"),e.write([{type:"close"}])}"open"===this.readyState?(u("transport open - closing"),t()):(u("transport not open - deferring close"),this.once("open",t))},h.prototype.write=function(e){var t=this;this.writable=!1;var n=function(){t.writable=!0,t.emit("drain")};o.encodePayload(e,this.supportsBinary,function(e){t.doWrite(e,n)})},h.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",n="";!1!==this.timestampRequests&&(e[this.timestampParam]=a()),this.supportsBinary||e.sid||(e.b64=1),e=i.encode(e),this.port&&("https"===t&&443!==Number(this.port)||"http"===t&&80!==Number(this.port))&&(n=":"+this.port),e.length&&(e="?"+e);var r=-1!==this.hostname.indexOf(":");return t+"://"+(r?"["+this.hostname+"]":this.hostname)+n+this.path+e}},function(e,t,n){(function(t){var r=n(1073),i=Object.prototype.toString,o="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===i.call(Blob),s="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===i.call(File);function a(e){if(!e||"object"!=typeof e)return!1;if(r(e)){for(var n=0,i=e.length;n0);return t}function c(e){var t=0;for(a=0;a0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:w;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),w(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),w()}function v(){g("onfinish"),e.removeListener("close",b),w()}function w(){g("unpipe"),n.unpipe(e)}return n.on("data",m),_(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;w.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(52)},f=n(521),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(522),y;function b(){}function v(e,t){u=u||n(149),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function w(e){if(u=u||n(149),!(y.call(w,this)||this instanceof u))return new w(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function _(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},w.prototype._writev=null,w.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=g.destroy,w.prototype._undestroy=g.undestroy,w.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(149),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length"string"==typeof e,object:e=>"object"==typeof e,multiaddr:e=>{if(l.string(e))try{return i(e),!0}catch(e){return!1}},function:e=>"function"==typeof e};function c(e,t){if(!Array.isArray(t))throw new Error("Data is not an array");e.forEach((e,n)=>{if(!l[e])throw console.error("Type %s does not exist",e),new Error("Type "+e+" does not exist");if(!l[e](t[n]))throw new Error("Data at index "+n+" is invalid for type "+e)})}function f(e){e||(e=(()=>{}));const t=this;t.requests={},t.addRequest=((e,n,r)=>{t.requests[e]={def:n,handle:r}}),t.handleSocket=(n=>{n.r={},Object.keys(t.requests).forEach(r=>{const i=t.requests[r];n.on(r,function(){const t=[...arguments];try{c(i.def,t),t.unshift(n),i.handle.apply(null,t)}catch(i){e(i),e("peer %s has sent invalid data for request %s",n.id||"",r,t)}})})})}function h(e,t,n){o.createFromPubKey(r.from(e,"hex"),(i,o)=>i?n(new Error("Crypto error")):o.toB58String()!==t?n(new Error("Id is not matching")):n(null,s.keys.unmarshalPublicKey(r.from(e,"hex"))))}t=e.exports,t.cleanUrlSIO=u,t.validate=c,t.Protocol=f,t.getIdAndValidate=h,t.validateMa=(e=>a.WebSocketStar.matches(i(e)))}).call(this,n(0).Buffer)},function(e,t,n){var r=n(1100),i=n(139),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,t,n){"use strict";e.exports="/mplex/6.7.0"},function(e,t,n){"use strict";t=e.exports,t.multicodec="/ipfs/id/1.0.0",t.listener=n(1127),t.dialer=n(1128),t.message=n(333)},function(e,t,n){"use strict";(function(t){const r=n(122),i=n(72),o=n(259),s=o.writeEncoded;function a(e,n,o){const a=r({timeout:6e4},n),u=a.handshake;return o("writing multicodec: "+e),s(u,t.from(e+"\n"),n),i.decodeFromReader(u,(t,r)=>{if(t)return n(t);const i=r.toString().slice(0,-1);if(i!==e)return n(new Error(`"${e}" not supported`),u.rest());o("received ack: "+i),n(null,u.rest())}),a}e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(241),i=l(r),o=n(175),s=l(o),a=n(240),u=l(a);function l(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)((0,i.default)(Boolean,u.default)),e.exports=t.default},function(e,t,n){"use strict";function r(e,t,n){const r=e===t;n(null,r)}e.exports=r},function(e,t,n){"use strict";t=e.exports,t.PROTOCOL_ID="/multistream/1.0.0"},function(e,t,n){"use strict";const r=n(184),i=n(535),o=n(258),s=n(53),a=n(536),u=n(336),{CONNECTION_FAILED:l,DIAL_SELF:c,INVALID_STATE_TRANSITION:f,NO_TRANSPORTS_REGISTERED:h,maybeUnexpectedEnd:p}=n(537);class d extends a{constructor({_switch:e,peerInfo:t,muxer:n,conn:i,type:o="out"}){super({_switch:e,name:`${o}:${e._peerInfo.id.toB58String().slice(0,8)}`}),this.theirPeerInfo=t,this.theirB58Id=this.theirPeerInfo.id.toB58String(),this.conn=i,this.muxer=n;let s="DISCONNECTED";this.muxer&&(s="MUXED"),this._state=r(s,{DISCONNECTED:{dial:"DIALING",disconnect:"DISCONNECTED",done:"DISCONNECTED"},DIALING:{abort:"ABORTED",done:"DIALED",error:"ERRORED",disconnect:"DISCONNECTING"},DIALED:{encrypt:"ENCRYPTING",privatize:"PRIVATIZING"},PRIVATIZING:{done:"PRIVATIZED",abort:"ABORTED",disconnect:"DISCONNECTING"},PRIVATIZED:{encrypt:"ENCRYPTING"},ENCRYPTING:{done:"ENCRYPTED",error:"ERRORED",disconnect:"DISCONNECTING"},ENCRYPTED:{upgrade:"UPGRADING",disconnect:"DISCONNECTING"},UPGRADING:{stop:"CONNECTED",done:"MUXED",error:"ERRORED"},MUXED:{disconnect:"DISCONNECTING"},CONNECTED:{disconnect:"DISCONNECTING"},DISCONNECTING:{done:"DISCONNECTED",disconnect:"DISCONNECTING"},ABORTED:{},ERRORED:{disconnect:"DISCONNECTING"}}),this._state.on("DISCONNECTED",()=>this._onDisconnected()),this._state.on("DIALING",()=>this._onDialing()),this._state.on("DIALED",()=>this._onDialed()),this._state.on("PRIVATIZING",()=>this._onPrivatizing()),this._state.on("PRIVATIZED",()=>this._onPrivatized()),this._state.on("ENCRYPTING",()=>this._onEncrypting()),this._state.on("ENCRYPTED",()=>{this.log("successfully encrypted connection to %s",this.theirB58Id),this.emit("encrypted",this.conn)}),this._state.on("UPGRADING",()=>this._onUpgrading()),this._state.on("MUXED",()=>{this.log("successfully muxed connection to %s",this.theirB58Id),delete this.switch.conns[this.theirB58Id],this.emit("muxed",this.muxer)}),this._state.on("CONNECTED",()=>{this.log("unmuxed connection opened to %s",this.theirB58Id),this.emit("unmuxed",this.conn)}),this._state.on("DISCONNECTING",()=>this._onDisconnecting()),this._state.on("ABORTED",()=>this._onAborted()),this._state.on("ERRORED",()=>this._onErrored()),this._state.on("error",e=>this._onStateError(e))}dial(){return this.theirB58Id===this.ourPeerInfo.id.toB58String()?this.emit("error",c()):"DIALING"===this.getState()?this.log("attempted to dial while already dialing, ignoring"):void this._state("dial")}shake(e,t){return e?this.muxer&&this.muxer.newStream?this.muxer.newStream((n,r)=>{if(n)return t(n,null);this.log("created new stream to %s",this.theirB58Id),this._protocolHandshake(e,r,t)}):void this._protocolHandshake(e,this.conn,t):t(null,null)}upgrade(){this._state("upgrade")}_onDialing(){if(this.log("dialing %s",this.theirB58Id),!this.switch.hasTransports())return this.close(h());const e=this.switch.availableTransports(this.theirPeerInfo),t=Boolean(this.switch.transports[i.tag]);t&&!e.includes(i.tag)&&e.push(i.tag);const n=r=>{let o=r;if(!o)return t?this.close(l(`No available transports to dial peer ${this.theirB58Id}!`)):this.close(l(`Circuit not enabled and all transports failed to dial peer ${this.theirB58Id}!`));o===i.tag&&this.theirPeerInfo.multiaddrs.add(`/p2p-circuit/p2p/${this.theirB58Id}`),this.log("dialing transport %s",o),this.switch.transport.dial(o,this.theirPeerInfo,(t,r)=>{if(t)return this.emit("error:connection_attempt_failed",t),this.log(t),n(e.shift());this.conn=u(o,null,r,this.switch.observer),this._state("done")})};n(e.shift())}_onDialed(){this.log("successfully dialed %s",this.theirB58Id),this.emit("connected",this.conn)}_onDisconnecting(){this.log("disconnecting from %s",this.theirB58Id),this.theirPeerInfo&&this.theirPeerInfo.disconnect(),this.switch.connection.remove(this),delete this.switch.conns[this.theirB58Id],this.muxer&&(this.muxer.end(),delete this.muxer,this.switch.emit("peer-mux-closed",this.theirPeerInfo)),this.conn?this.conn.source(!0,()=>{this._state("done"),delete this.conn}):this._state("done")}_onEncrypting(){const e=new o.Dialer;e.handle(this.conn,t=>{if(t)return this.close(p(t));this.log("selecting crypto %s to %s",this.switch.crypto.tag,this.theirB58Id),e.select(this.switch.crypto.tag,(e,t)=>{if(e)return this.close(p(e));const n=u(null,this.switch.crypto.tag,t,this.switch.observer);this.conn=this.switch.crypto.encrypt(this.ourPeerInfo.id,n,this.theirPeerInfo.id,e=>{if(e)return this.close(e);this.conn.setPeerInfo(this.theirPeerInfo),this._state("done")})})})}_onUpgrading(){const e=Object.keys(this.switch.muxers);if(this.log("upgrading connection to %s",this.theirB58Id),0===e.length)return this._state("stop");const t=new o.Dialer;t.handle(this.conn,n=>{if(n)return this._didUpgrade(n);const r=n=>{this.log("selecting %s",n),t.select(n,(t,i)=>{if(t)return 0===e.length?this._didUpgrade(t):r(e.shift());const o=u(null,n,i,this.switch.observer);this.muxer=this.switch.muxers[n].dialer(o),this.switch.connection.add(this),this.muxer.once("close",()=>{this.close()}),this.muxer.on("stream",e=>{this.log("new stream created via muxer to %s",this.theirB58Id),e.setPeerInfo(this.theirPeerInfo),this.switch.protocolMuxer(null)(e)}),this.switch.emit("peer-mux-established",this.theirPeerInfo),this._didUpgrade(null)})};r(e.shift())})}_didUpgrade(e){if(e)return this.log("Error upgrading connection:",e),this.switch.conns[this.theirB58Id]=this,this.emit("error:upgrade_failed",e),this._state("stop");this._state("done")}_protocolHandshake(e,t,n){const r=new o.Dialer;r.handle(t,t=>{if(t)return n(t,null);r.select(e,(t,r)=>{if(t)return this.log("could not perform protocol handshake:",t),n(t,null);const i=u(null,e,r,this.switch.observer);this.log("successfully performed handshake of %s to %s",e,this.theirB58Id),this.emit("connection",i),n(null,i)})})}_onStateError(e){this.emit("error",f(e)),this.log(e)}}e.exports=s(d,{className:"ConnectionFSM",symbolName:"libp2p-switch/ConnectionFSM"})},function(e,t,n){"use strict";e.exports=n(1135)},function(e,t,n){"use strict";const r=n(6).EventEmitter,i=n(5),o=n(53);class s extends r{constructor({_switch:e,name:t}){super(),this.switch=e,this.ourPeerInfo=this.switch._peerInfo,this.log=i(`libp2p:conn:${t}`),this.log.error=i(`libp2p:conn:${t}:error`)}close(e){"DISCONNECTING"!==this._state._state&&(this.log("closing connection to %s",this.theirB58Id),e&&this._events.error&&this.emit("error",e),this._state("disconnect"))}emit(e,...t){"error"!==e||this._events.error?super.emit(e,...t):this.log.error(...t)}getState(){return this._state._state}encrypt(){this._state("encrypt")}protect(){this._state("privatize")}upgrade(){this._state("upgrade")}_onDisconnected(){this.log("disconnected from %s",this.theirB58Id),this.emit("close"),this.removeAllListeners()}_onPrivatized(){this.log("successfully privatized incoming connection"),this.emit("private",this.conn)}_onPrivatizing(){if(!this.switch.protector)return this._state("done");this.conn=this.switch.protector.protect(this.conn,e=>{if(e)return this.close(e);this.log("successfully privatized conn to %s",this.theirB58Id),this.conn.setPeerInfo(this.theirPeerInfo),this._state("done")})}}e.exports=o(s,{className:"BaseConnection",symbolName:"libp2p-switch/BaseConnection"})},function(e,t,n){"use strict";const r=n(22);e.exports.PROTECTOR_REQUIRED="No protector provided with private network enforced",e.exports.CONNECTION_FAILED=(e=>r(e,"CONNECTION_FAILED")),e.exports.DIAL_SELF=(()=>r(new Error("A node cannot dial itself"),"DIAL_SELF")),e.exports.NO_TRANSPORTS_REGISTERED=(()=>r(new Error("No transports registered, dial not possible"),"NO_TRANSPORTS_REGISTERED")),e.exports.UNEXPECTED_END=(()=>r(new Error("Unexpected end of input from reader."),"UNEXPECTED_END")),e.exports.INVALID_STATE_TRANSITION=(e=>r(e,"INVALID_STATE_TRANSITION")),e.exports.maybeUnexpectedEnd=(t=>!0===t?e.exports.UNEXPECTED_END():t)},function(e,t,n){"use strict";const r=n(14);e.exports={tag:"/plaintext/1.0.0",encrypt:(e,t,n,i)=>("function"==typeof n&&(i=n,n=void 0),r(()=>i()),t)}},function(e,t,n){"use strict";const r=n(23),i=n(44),o=n(24);function s(e,t){let n;if(i.isPeerInfo(e))return e;if(o.isMultiaddr(e)){const o=e.getPeerId();try{n=t.get(o)}catch(e){n=new i(r.createFromB58String(o))}return n.multiaddrs.add(e),n}if(r.isPeerId(e)){const n=e.toB58String();try{return t.get(n)}catch(e){throw new Error("Couldnt get PeerInfo")}}throw new Error("peer type not recognized")}e.exports=s},function(e,t,n){(function(r){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function l(){try{return window.localStorage}catch(e){}}t=e.exports=n(1160),t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:l(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(this,n(2))},function(e,t,n){"use strict";const r=n(1170);function i(e){if(!(this instanceof i))return new i(e);e=e||{};const t=e.validity||30,n=new Map,s=r(()=>{n.forEach((e,r)=>{const i=e.validity||t,s=o(e.timestamp);s>i&&n.delete(r)})},200);this.put=((e,t,r)=>{this.has(e)||n.set(e,{value:t,timestamp:new Date,validity:r}),s()}),this.get=(e=>{if(n.has(e))return n.get(e).value;throw new Error("key does not exist")}),this.has=(e=>n.has(e))}function o(e){const t=new Date,n=t.getTime()-e.getTime();return Math.floor(n/1e3)}t=e.exports=i},function(e,t,n){"use strict";const r=n(6),i=n(12),o=n(106),s=n(56),a=n(541),u=n(5),l=n(22),c=n(1171),f=n(543),h=n(1174),p=n(91);class d extends r{constructor(e,t,n){super(),this.log=u(e),this.log.err=u(`${e}:error`),this.multicodec=t,this.libp2p=n,this.started=!1,this.topics=new Map,this.seenCache=new a,this.peers=new Map,this._dials=new Set,this._onConnection=this._onConnection.bind(this),this._dialPeer=this._dialPeer.bind(this)}_addPeer(e){const t=e.info.id.toB58String();let n=this.peers.get(t);return n||(this.log("new peer",t),this.peers.set(t,e),n=e,e.once("close",()=>this._removePeer(e))),++n._references,n}_removePeer(e){const t=e.info.id.toB58String();return this.log("remove",t,e._references),0==--e._references&&(this.log("delete peer",t),this.peers.delete(t)),e}_dialPeer(e,t){t=t||function e(){};const n=e.id.toB58String(),r=this.peers.get(n);return r&&r.isConnected?p(()=>t()):this._dials.has(n)?(this.log("already dialing %s, ignoring dial attempt",n),p(()=>t())):(this._dials.add(n),this.log("dialing %s",n),void this.libp2p.dialProtocol(e,this.multicodec,(r,i)=>{this.log("dial to %s complete",n);const o=!this._dials.has(n);return this._dials.delete(n),r?(this.log.err(r),t()):o?(this.log("pubsub was stopped, not processing dial to %s",n),t()):void this._onDial(e,i,t)}))}_onDial(e,t,n){const r=e.id.toB58String();this.log("connected",r);const i=this._addPeer(new c(e));i.attachConnection(t),p(()=>n())}_onConnection(e,t){t.getPeerInfo((e,n)=>{if(e)return this.log.err("Failed to identify incomming conn",e),i(o(),t);const r=n.id.toB58String(),s=this._addPeer(new c(n));this._processConnection(r,t,s)})}_processConnection(e,t,n){throw l("_processConnection must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}_onConnectionEnd(e,t,n){n&&"socket hang up"!==n.message&&this.log.err(n),this.log("connection ended",e,n?n.message:""),this._removePeer(t)}publish(e,t){throw l("publish must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}subscribe(e){throw l("subscribe must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}unsubscribe(e){throw l("unsubscribe must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}start(e){if(this.started)return p(()=>e(new Error("already started")));this.log("starting"),this.libp2p.handle(this.multicodec,this._onConnection),this.libp2p.on("peer:connect",this._dialPeer);const t=Object.values(this.libp2p.peerBook.getAll());s(t,(e,t)=>this._dialPeer(e,t),t=>{p(()=>{this.log("started"),this.started=!0,e(t)})})}stop(e){if(!this.started)return p(()=>e(new Error("not started yet")));this.libp2p.unhandle(this.multicodec),this.libp2p.removeListener("peer:connect",this._dialPeer),this._dials=new Set,this.log("stopping"),s(this.peers.values(),(e,t)=>e.close(t),t=>{if(t)return e(t);this.log("stopped"),this.peers=new Map,this.started=!1,e()})}}e.exports=d,e.exports.message=f,e.exports.utils=h},function(e,t,n){"use strict";const r=n(71),i=r(n(1172)),o=r(n(1173));t=e.exports,t.rpc=i,t.td=o},function(e){e.exports={name:"ipfs",version:"0.34.4",description:"JavaScript implementation of the IPFS specification",leadMaintainer:"Alan Shaw ",bin:{jsipfs:"src/cli/bin.js"},main:"src/core/index.js",browser:{"./src/core/components/init-assets.js":!1,"./src/core/runtime/add-from-fs-nodejs.js":"./src/core/runtime/add-from-fs-browser.js","./src/core/runtime/config-nodejs.js":"./src/core/runtime/config-browser.js","./src/core/runtime/dns-nodejs.js":"./src/core/runtime/dns-browser.js","./src/core/runtime/fetch-nodejs.js":"./src/core/runtime/fetch-browser.js","./src/core/runtime/libp2p-nodejs.js":"./src/core/runtime/libp2p-browser.js","./src/core/runtime/preload-nodejs.js":"./src/core/runtime/preload-browser.js","./src/core/runtime/repo-nodejs.js":"./src/core/runtime/repo-browser.js","./test/utils/create-repo-nodejs.js":"./test/utils/create-repo-browser.js",stream:"readable-stream",joi:"joi-browser"},engines:{node:">=10.0.0",npm:">=6.0.0"},scripts:{lint:"aegir lint",build:"aegir build",test:"aegir test -t node -t browser -t webworker --no-cors --timeout=10000","test:node":"aegir test -t node --timeout=10000","test:browser":"aegir test -t browser --no-cors --timeout=10000","test:webworker":"aegir test -t webworker --no-cors --timeout=10000","test:node:core":"aegir test -t node -f test/core/**/*.js --timeout=10000","test:node:http":"aegir test -t node -f test/http-api/index.js --timeout=10000","test:node:gateway":"aegir test -t node -f test/gateway/index.js --timeout=10000","test:node:cli":"aegir test -t node -f test/cli/index.js --timeout=10000","test:node:interface":"aegir test -t node -f test/core/interface.spec.js --timeout=10000","test:bootstrapers":"IPFS_TEST=bootstrapers aegir test -t browser -f test/bootstrapers.js --timeout=10000",benchmark:'echo "Error: no benchmarks yet" && exit 1',"benchmark:node":'echo "Error: no benchmarks yet" && exit 1',"benchmark:node:core":'echo "Error: no benchmarks yet" && exit 1',"benchmark:node:http":'echo "Error: no benchmarks yet" && exit 1',"benchmark:browser":'echo "Error: no benchmarks yet" && exit 1',release:"aegir release -t node -t browser","release-minor":"aegir release --type minor -t node -t browser","release-major":"aegir release --type major -t node -t browser",coverage:"aegir coverage","coverage-publish":"aegir-coverage publish","dep-check":"npx dependency-check package.json './test/**/*.js' './src/**/*.js'"},repository:{type:"git",url:"git+https://github.com/ipfs/js-ipfs.git"},keywords:["IPFS"],license:"MIT",bugs:{url:"https://github.com/ipfs/js-ipfs/issues"},homepage:"https://github.com/ipfs/js-ipfs#readme",devDependencies:{aegir:"^18.0.3",chai:"^4.2.0",delay:"^4.1.0","detect-node":"^2.0.4","dir-compare":"^1.4.0","dirty-chai":"^2.0.1",execa:"^1.0.0","form-data":"^2.3.3",hat:"0.0.3","interface-ipfs-core":"~0.96.0","ipfsd-ctl":"~0.40.1",ncp:"^2.0.0",qs:"^6.5.2",rimraf:"^2.6.2",sinon:"^7.1.1","stream-to-promise":"^2.2.0"},dependencies:{"@nodeutils/defaults-deep":"^1.1.0",async:"^2.6.1","bignumber.js":"^8.0.2","binary-querystring":"~0.1.2",bl:"^2.1.2",boom:"^7.2.0",bs58:"^4.0.1",byteman:"^1.3.5","cid-tool":"~0.2.0",cids:"~0.5.5","class-is":"^1.1.0","datastore-core":"~0.6.0","datastore-pubsub":"~0.1.1",debug:"^4.1.0","err-code":"^1.1.2","file-type":"^10.2.0",fnv1a:"^1.0.1","fsm-event":"^2.1.0","get-folder-size":"^2.0.0",glob:"^7.1.3",hapi:"^16.6.2","hapi-set-header":"^1.0.2",hoek:"^6.1.2","human-to-milliseconds":"^1.0.0","interface-datastore":"~0.6.0","ipfs-bitswap":"~0.22.0","ipfs-block":"~0.8.0","ipfs-block-service":"~0.15.1","ipfs-http-client":"^29.0.0","ipfs-http-response":"~0.2.1","ipfs-mfs":"~0.8.0","ipfs-multipart":"~0.1.0","ipfs-repo":"~0.26.1","ipfs-unixfs":"~0.1.16","ipfs-unixfs-engine":"~0.35.3",ipld:"~0.20.1","ipld-bitcoin":"~0.1.8","ipld-dag-pb":"~0.15.0","ipld-ethereum":"^2.0.1","ipld-git":"~0.2.2","ipld-zcash":"~0.1.6",ipns:"~0.5.0","is-ipfs":"~0.4.8","is-pull-stream":"~0.0.0","is-stream":"^1.1.0",joi:"^14.3.0","joi-browser":"^13.4.0","joi-multiaddr":"^4.0.0",libp2p:"~0.24.1","libp2p-bootstrap":"~0.9.3","libp2p-crypto":"~0.16.0","libp2p-kad-dht":"~0.14.4","libp2p-keychain":"~0.3.3","libp2p-mdns":"~0.12.0","libp2p-mplex":"~0.8.4","libp2p-record":"~0.6.1","libp2p-secio":"~0.11.0","libp2p-tcp":"~0.13.0","libp2p-webrtc-star":"~0.15.5","libp2p-websocket-star-multi":"~0.4.0","libp2p-websockets":"~0.12.0",lodash:"^4.17.11",mafmt:"^6.0.2","mime-types":"^2.1.21",mkdirp:"~0.5.1",multiaddr:"^6.0.0","multiaddr-to-uri":"^4.0.0",multibase:"~0.6.0",multihashes:"~0.4.14","multihashing-async":"~0.5.1","node-fetch":"^2.3.0",once:"^1.4.0","peer-book":"~0.9.0","peer-id":"~0.12.0","peer-info":"~0.15.0",progress:"^2.0.1","promisify-es6":"^1.0.3",protons:"^1.0.1","pull-abortable":"^4.1.1","pull-cat":"^1.1.11","pull-defer":"~0.2.3","pull-file":"^1.1.0","pull-ndjson":"~0.1.1","pull-pushable":"^2.2.0","pull-sort":"^1.0.1","pull-stream":"^3.6.9","pull-stream-to-stream":"^1.3.4",pump:"^3.0.0","read-pkg-up":"^4.0.0","readable-stream":"^3.1.1",receptacle:"^1.3.2","stream-to-pull-stream":"^1.7.2","tar-stream":"^1.6.2",temp:"~0.9.0","update-notifier":"^2.5.0",varint:"^5.0.0",yargs:"^12.0.5","yargs-promise":"^1.1.0"},optionalDependencies:{"prom-client":"^11.1.3","prometheus-gc-stats":"~0.6.0"},contributors:["0xflotus <0xflotus@gmail.com>","A_A <21040751+Otto-AA@users.noreply.github.com>","Alan Shaw ","Alan Shaw ","Alex North ","Alex Potsides ","Andrew de Andrade ","André Cruz ","Arkadiy Kukarkin ","Arpit Agarwal <93arpit@gmail.com>","Arpit Agarwal ","Bernard Mordan ","Brian Vander Schaaf ","Bruno Zell ","CHEVALAY JOSSELIN ","Caio Gondim ","Chance Hudson ","Christian Couder ","Dafeng ","Dan Ordille ","Daniel J. O'Quinn ","Daniela Borges Matos de Carvalho ","David Dias ","David Gilbertson ","David da Silva ","Diogo Silva ","Dmitriy Ryajov ","Dzmitry Das ","Enrico Marino ","Faheel Ahmad ","Felix Yan ","Francisco Baio Dias ","Francisco Baio Dias ","Friedel Ziegelmayer ","Gar ","Georgios Rassias ","Gorka Ludlow ","Greenkeeper ","Haad ","Haoliang Yu ","Harsh Vakharia ","Henrique Dias ","Henry Rodrick ","Heo Sangmin ","Hugo Dias ","Hugo Dias ","Jacob Heun ","Jacob Heun ","Jade Meskill ","Johannes Wikner ","Jon Schlinkert ","Jonathan ","João Antunes ","João Santos ","Kevin Wang ","Lars Gierth ","Lukas Drgon ","Maciej Krüger ","Marcin Rataj ","Marius Darila ","Mat Kelly ","Michelle Lee ","Mikeal Rogers ","Mithgol ","Molly ","My9Bot <34904312+My9Bot@users.noreply.github.com>","Nuno Nogueira ","Oli Evans ","Oskar Nyberg ","Pascal Precht ","Pau Ramon Revilla ","Paulo Rodrigues ","Pedro Teixeira ","Portia Burton ","Raoul Millais ","RasmusErik Voel Jensen ","Richard Littauer ","Richard Schneider ","Rob Brackett ","Rod Keys ","Sangwon Hong ","Sid Harder ","SidHarder ","Stephen Whitmore ","Stephen Whitmore ","Terence Pae ","Uroš Jurglič ","Vasco Santos ","Vasco Santos ","Volker Mische ","Xiao Liang ","Yahya ","Yole ","bitspill ","datafatmunger ","haad ","jbenet ","jonahweissman <19804455+jonahweissman@users.noreply.github.com>","kevingzhang ","kumavis ","nginnever ","npmcdn-to-unpkg-bot ","robbsolter <35879806+robbsolter@users.noreply.github.com>","seungwon-kang ","tcme ","victorbjelkholm ","Łukasz Magiera ","Максим Ильин "]}},function(e,t,n){"use strict";const r=n(3),i=n(225).repoVersion;e.exports=function e(t){return{init:(e,t,n)=>{},version:r(e=>{t._repo._isInitialized(n=>{if(n){const t=[/Key not found in database \[\/version\]/,/ENOENT/,/repo is not initialized yet/].some(e=>e.test(n.message));return t?e(null,i):e(n)}t._repo.version.get(e)})}),gc:r((e,t)=>{"function"==typeof e&&(t=e,e={}),t(new Error("Not implemented"))}),stat:r((e,n)=>{"function"==typeof e&&(n=e,e={}),t._repo.stat(e,(e,t)=>{if(e)return n(e);n(null,{numObjects:t.numObjects,repoSize:t.repoSize,repoPath:t.repoPath,version:t.version.toString(),storageMax:t.storageMax})})}),path:()=>t._repo.path}}},function(e,t,n){"use strict";e.exports=(()=>({Addresses:{Swarm:[],API:"",Gateway:""},Discovery:{MDNS:{Enabled:!1,Interval:10},webRTCStar:{Enabled:!0}},Bootstrap:["/dns4/ams-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd","/dns4/lon-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3","/dns4/sfo-3.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM","/dns4/sgp-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu","/dns4/nyc-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm","/dns4/nyc-2.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64","/dns4/node0.preload.ipfs.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic","/dns4/node1.preload.ipfs.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6"]}))},function(e,t){function n(e,t){for(var n=-1,r=t.length,i=e.length;++n{"function"==typeof r&&(l=r,r={}),r=r||{};const c=e=>t.isBuffer(e)||s.readable(e)||a(e),f=e=>"object"==typeof e&&(e.content?c(e.content):Boolean(e.path)&&u(e.path)),h=e=>c(e)||f(e),p=h(n)||Array.isArray(n)&&n.every(h);if(!p)return l(new Error("invalid input: expected buffer, readable stream, pull stream, object or array of objects"));i(i.values([n]),e.addPullStream(r),o((e,t)=>e.patht.path?-1:0),i.collect(l))});return function(){const e=Array.from(arguments);return 1===e.length&&a(e[0])&&e.push({}),n.apply(null,e)}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=n(1215)},function(e,t){e.exports=function(e){var t,n,r;function i(e){return n=e,function(e,i){r?t=[e,i]:n(e,i)}}return i.pause=function(){r||(r=!0,e&&e(r))},i.resume=function(){if(r&&(r=!1,e&&e(r),t)){var i=t;t=null,n(i[0],i[1])}},i}},function(e,t,n){"use strict";(function(t){e.exports=function e(n,r,i,o){const s=n.length,a=r+s;return i>=a||o=r&&o=r&&i{if(t=Object.assign({},p,t),!t.parentCid)return n(new Error("No parent CID passed to addLink"));if(!o.isCID(t.parentCid))return n(new Error("Invalid CID passed to addLink"));if(!t.parent)return l("Loading parent node",t.parentCid.toBaseEncodedString()),s([n=>e.ipld.get(t.parentCid,n),(e,t)=>t(null,e.value),(n,r)=>d(e,{...t,parent:n},r)],n);if(!t.cid)return n(new Error("No child cid passed to addLink"));if(!t.name)return n(new Error("No child name passed to addLink"));if(o.isCID(t.cid)||(t.cid=new o(t.cid)),!t.size&&0!==t.size)return n(new Error("No child size passed to addLink"));const r=c.unmarshal(t.parent.data);return"hamt-sharded-directory"===r.type?(l("Adding link to sharded directory"),y(e,t,n)):t.parent.links.length>=t.shardSplitThreshold?(l("Converting directory to sharded directory"),m(e,t,n)):(l(`Adding ${t.name} to regular directory`),void g(e,t,n))},m=(e,t,n)=>{v(e,t.parent.links.map(e=>({name:e.name,size:e.size,multihash:e.cid.buffer})).concat({name:t.name,size:t.size,multihash:t.cid.buffer}),{},(e,t)=>{e||l("Converted directory to sharded directory",t.cid.toBaseEncodedString()),n(e,t)})},g=(e,t,n)=>{s([e=>r.rmLink(t.parent,t.name,e),(e,n)=>r.addLink(e,new i(t.name,t.size,t.cid),n),(n,r)=>{e.ipld.put(n,{version:t.cidVersion,format:t.codec,hashAlg:t.hashAlg,hashOnly:!t.flush},(e,t)=>r(e,{node:n,cid:t}))}],n)},y=(e,t,n)=>s([n=>f(e,t.name,t.parent,n),({rootBucket:n,path:r},i)=>{b(e,r,{name:t.name,cid:t.cid,size:t.size},t,(e,t={})=>i(e,{rootBucket:n,...t}))},({rootBucket:n,node:r},i)=>h(e,r.links,n,t,i)],n),b=(e,t,n,r,i)=>{const{bucket:o,prefix:a,node:u}=t.pop(),c=u.links.find(e=>e.name.substring(0,2)===a&&e.name!==`${a}${n.name}`);return s([i=>c&&c.name.length>2?(l(`Converting existing file ${c.name} into sub-shard for ${n.name}`),s([t=>v(e,[{name:c.name.substring(2),size:c.size,multihash:c.cid.buffer},{name:n.name,size:n.size,multihash:n.cid.buffer}],{},t),({node:{links:[t]}},n)=>e.ipld.get(t.cid,(e,r)=>{n(e,{cid:t.cid,node:r&&r.value})}),(t,n)=>w(e,o,u,c.name,t.node,t.cid,a,r,n)],i)):c&&2===c.name.length?(l(`Descending into sub-shard ${c.name} for ${n.name}`),s([i=>b(e,t,n,r,i),(t,n)=>w(e,o,u,c.name,t.node,t.cid,a,r,n)],i)):(l("Adding or replacing file",a+n.name),void w(e,o,u,a+n.name,n,n.cid,a+n.name,r,i))],i)},v=(e,t,n,r)=>{const i=new a({root:!0,dir:!0,parent:null,parentKey:null,path:"",dirty:!0,flat:!1,...n}),o=t.map(e=>t=>{i.put(e.name,{size:e.size,multihash:e.multihash},t)});return u(o,t=>{if(t)return r(t);i.flush("",e.ipld,null,r)})},w=(e,t,n,o,a,u,l,c,f)=>{s([e=>r.rmLink(n,o,e),(e,t)=>r.addLink(e,new i(l,a.size,u),t),(n,r)=>h(e,n.links,t,c,r)],f)};e.exports=d},function(e,t,n){"use strict";(function(t){const{DAGNode:r}=n(38),i=n(11),o=n(229),s=n(342),a=n(263),u=n(5)("ipfs:mfs:core:utils:hamt-utils"),l=n(48),c=(e,n,o,s,u)=>{i([e=>{const i=t.from(o._children.bitField().reverse()),s=new l("hamt-sharded-directory",i);s.fanout=o.tableSize(),s.hashType=a.hashFn.code,r.create(s.marshal(),n,e)},(t,n)=>{e.ipld.put(t,{version:s.cidVersion,format:s.codec,hashAlg:s.hashAlg,hashOnly:!s.flush},(e,r)=>n(e,{node:t,cid:r}))}],u)},f=(e,t,n,r,i)=>{const o=new s({hashFn:a.hashFn,hash:n?n._options.hash:void 0},n,r);n&&n._putObjectAt(r,o),h(e,o,t,i)},h=(e,t,n,r)=>{Promise.all(e.map(e=>{if(2===e.name.length){const n=parseInt(e.name,16);return t._putObjectAt(n,new s({hashFn:a.hashFn},t,n)),Promise.resolve()}return(n||t).put(e.name.substring(2),!0)})).catch(e=>{r(e),r=null}).then(()=>r&&r(null,t))},p=e=>e.toString("16").toUpperCase().padStart(2,"0").substring(0,2),d=(e,t,n,r)=>{f(n.links,null,null,null,async(i,s)=>{if(i)return r(i);const a=await s._findNewBucketAndPos(t);let l=[{bucket:a.bucket,prefix:p(a.pos)}],c=a.bucket;for(;c!==s;)l.push({bucket:c,prefix:p(c._posAtParent)}),c=c._parent;l[l.length-1].node=n;let d=l.length;o(()=>d>0,n=>{d--;const r=l[d],i=r.node.links.filter(e=>e.name.substring(0,2)===r.prefix).pop();return i?i.name===`${r.prefix}${t}`?(u(`Link ${r.prefix}${t} will be replaced`),n(null,l)):(u(`Found subshard ${r.prefix}`),void e.ipld.get(i.cid,(e,i)=>{if(e)return n(e);if(!l[d-1]){u(`Loaded new subshard ${r.prefix}`);const e=i.value;return f(e.links,s,r.bucket,parseInt(r.prefix,16),async(r,i)=>{if(r)return n(r);const o=await s._findNewBucketAndPos(t);d++,l.unshift({bucket:o.bucket,prefix:p(o.pos),node:e}),n()})}const o=l[d-1];h(i.value.links,o.bucket,s,e=>{o.node=i.value,n(e)})})):(u(`Link ${r.prefix}${t} will be added`),n(null,l))},async(e,n)=>{await s.put(t,!0),r(e,{rootBucket:s,path:n})})})};e.exports={generatePath:d,updateHamtDirectory:c,recreateHamtLevel:f,addLinksToHamtBucket:h,toPrefix:p}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=n(1268)},function(e,t){e.exports={WORKER_REQUEST_READ_LOCK:"lock:worker:request-read",WORKER_RELEASE_READ_LOCK:"lock:worker:release-read",MASTER_GRANT_READ_LOCK:"lock:master:grant-read",WORKER_REQUEST_WRITE_LOCK:"lock:worker:request-write",WORKER_RELEASE_WRITE_LOCK:"lock:worker:release-write",MASTER_GRANT_WRITE_LOCK:"lock:master:grant-write"}},function(e,t){const n={},r=e=>{e.addEventListener("message",t=>{r.dispatchEvent("message",e,t)}),e.port&&e.port.addEventListener("message",t=>{r.dispatchEvent("message",e,t)})};r.addEventListener=((e,t)=>{n[e]||(n[e]=[]),n[e].push(t)}),r.removeEventListener=((e,t)=>{n[e]&&(n[e]=n[e].filter(e=>e===t))}),r.dispatchEvent=function(){const e=Array.prototype.slice.call(arguments),t=e.shift();n[t]&&n[t].forEach(t=>t.apply(null,e))},e.exports=r},function(e,t,n){"use strict";const{FILE_SEPARATOR:r}=n(265),i=n(559),o=n(11),s=n(54),a=n(343),u="ipfs",l=(e,t,n)=>{let u=Array.isArray(t);const l=Array.isArray(t)?t:[t];o([t=>{s({paths:e=>{let t;try{t=l.map(e=>{if(e=(e||"").trim(),e=e.replace(/(\/\/+)/g,"/"),!e)throw new Error("paths must not be empty");if(e.substring(0,1)!==r)throw new Error(`paths must start with a leading ${r}`);return e.substring(e.length-r.length)===r&&(e=e.substring(0,e.length-r.length)),a(e)})}catch(t){return e(t)}e(null,t)},root:t=>i(e,t)},t)},({paths:e,root:t},n)=>{n(null,e.map(e=>{if("ipfs"===e[0]){let n;return n=2===e.length?`${r}${e.join(r)}`:`${r}${e.slice(0,e.length-1).join(r)}`,{type:"ipfs",depth:e.length-2,mfsPath:`${r}${e.join(r)}`,mfsDirectory:n,root:t,parts:e,path:`${r}${e.join(r)}`,name:e[e.length-1]}}const n=`/ipfs/${t.toBaseEncodedString()}/${e.join(r)}`,i=`/ipfs/${t.toBaseEncodedString()}/${e.slice(0,e.length-1).join(r)}`;return{type:"mfs",depth:e.length,mfsDirectory:i,mfsPath:n,root:t,parts:e,path:`${r}${e.join(r)}`,name:e[e.length-1]}}))},(e,t)=>{if(u)return t(null,e);t(null,e[0])}],n)};e.exports=l},function(e,t,n){"use strict";const r=n(9),i=n(48),{DAGNode:o}=n(38),s=n(5)("ipfs:mfs:utils:with-mfs-root"),a=n(11),{MFS_ROOT_KEY:u}=n(265),l=(e,t)=>{a([t=>e.repo.datastore.open(e=>t(e)),t=>{e.repo.datastore.get(u,(n,l)=>{if(n&&(n.notFound||"ERR_NOT_FOUND"===n.code))return s("Creating new MFS root"),a([e=>o.create(new i("directory").marshal(),e),(t,n)=>e.ipld.put(t,{version:0,hashAlg:"sha2-256",format:"dag-pb"},n),(t,n)=>e.repo.datastore.put(u,t.buffer,e=>n(e,t))],t);t(n,l?new r(l):null)})},(e,t)=>{s(`Fetched MFS root ${e.toBaseEncodedString()}`),t(null,e)}],t)};e.exports=l},function(e,t,n){"use strict";(function(t,r){var i=n(10);e.exports=S;var o=n(51),s;S.ReadableState=k;var a=n(6).EventEmitter,u=function(e,t){return e.listeners(t).length},l=n(561),c=n(4).Buffer,f=t.Uint8Array||function(){};function h(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof f}var d=n(7);d.inherits=n(1);var m=n(1290),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1291),b=n(562),v;d.inherits(S,l);var w=["error","close","destroy","pause","resume"];function _(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function k(e,t){s=s||n(151),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=n(16).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function S(e){if(s=s||n(151),!(this instanceof S))return new S(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),l.call(this)}function E(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,O(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:w;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),w(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),w()}function v(){g("onfinish"),e.removeListener("close",b),w()}function w(){g("unpipe"),n.unpipe(e)}return n.on("data",m),_(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;w.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(52)},f=n(561),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(562),y;function b(){}function v(e,t){u=u||n(151),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function w(e){if(u=u||n(151),!(y.call(w,this)||this instanceof u))return new w(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function _(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},w.prototype._writev=null,w.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=g.destroy,w.prototype._undestroy=g.undestroy,w.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(151),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length"object"==typeof e).pop()||{});Array.isArray(t[0])&&(t=t[0]);const s=t.filter(e=>"string"==typeof e).map(e=>e.trim());r(e,s,(e,t)=>{i(e,{sources:t,options:o})})}e.exports=i},function(e,t,n){"use strict";const r=n(11),i=n(54),{addLink:o,updateTree:s,updateMfsRoot:a,toTrail:u,toSourcesAndDestination:l,toMfsPath:c}=n(82),f=n(267),h=n(345),p=n(5)("ipfs:mfs:cp"),d={parents:!1,flush:!0,format:"dag-pb",hashAlg:"sha2-256",shardSplitThreshold:1e3};e.exports=(e=>(function t(){const n=Array.from(arguments),i=n.pop();r([t=>l(e,n,d,t),({sources:e,destination:t,options:n},r)=>e.length?t?(n.parents=n.p||n.parents,void r(null,{sources:e,destination:t,options:n})):r(new Error("Please supply a destination")):r(new Error("Please supply at least one source")),({sources:t,destination:n,options:r},i)=>u(e,n.mfsPath,r,(o,s)=>{if(o)return i(o);if(s.length===n.parts.length)return p("Destination does not exist"),1===t.length?(p("Only one source, copying to a file"),m(e,t.pop(),n,s,r,i)):(p("Multiple sources, copying to a directory"),g(e,t,n,s,r,i));const a=s[s.length-1];if("dir"===a.type)return p("Destination is a directory"),g(e,t,n,s,r,i);i(new Error("directory already has entry by that name"))})],i)}));const m=(e,t,n,i,u,l)=>{r([n=>y(e,t,u,n),(t,s)=>{const a=i[i.length-1],u=t[t.length-1];r([t=>e.ipld.get(a.cid,t),(t,r)=>o(e,{parent:t.value,parentCid:a.cid,size:u.size,cid:u.cid,name:n.parts[n.parts.length-1]},r),({node:e,cid:t},n)=>{a.node=e,a.cid=t,a.size=e.size,n(null,i)}],s)},(t,n)=>s(e,t,u,n),({cid:t},n)=>a(e,t,n)],e=>l(e))},g=(e,t,n,l,d,m)=>{r([t=>{if(l.length!==n.parts.length+1)return p("Making destination directory",n.path),r([t=>h(e)(n.path,d,t),t=>c(e,n.path,t),(t,r)=>{n=t,u(e,n.mfsPath,d,r)}],(e,n)=>{if(e)return t(e);l=n,t()});t()},n=>i(t.map(t=>n=>y(e,t,d,n)),n),(u,c)=>{r([r=>{i(t.map(t=>r=>{f(e)(`${n.path}/${t.name}`,d,e=>{if(e)return e.message.includes("does not exist")?r():r(e);r(new Error("directory already has entry by that name"))})}),e=>r(e))},n=>{const i=l[l.length-1];r([t=>e.ipld.get(i.cid,t),(e,t)=>t(null,{cid:i.cid,node:e.value})].concat(u.map((n,r)=>(i,s)=>{const a=n[n.length-1];p(`Adding ${t[r].name} to ${i.cid.toBaseEncodedString()}`),o(e,{parent:i.node,parentCid:i.cid,size:a.size,cid:a.cid,name:t[r].name},(e,t)=>{if(e)return s(e);p(`New directory hash ${t.cid.toBaseEncodedString()}`),s(e,t)})})),n)},({node:e,cid:t},n)=>{const r=l[l.length-1];r.node=e,r.cid=t,r.size=e.size,n(null,l)},(t,n)=>s(e,t,d,n),({cid:t},n)=>a(e,t,n)],c)}],e=>m(e))},y=(e,t,n,r)=>{u(e,t.mfsPath,n,(e,n)=>e?r(e):"ipfs"===t.type?r(null,n):n.length!==t.parts.length+1?r(new Error(`${t.path} does not exist`)):void r(null,n))}},function(e,t,n){"use strict";const r=n(11),i=n(40),{updateTree:o,updateMfsRoot:s,toSources:a,removeLink:u,toMfsPath:l,toTrail:c,FILE_SEPARATOR:f}=n(82),h={recursive:!1,cidVersion:0,hashAlg:"sha2-256",format:"dag-pb"};e.exports=(e=>(function t(){const n=Array.from(arguments),o=n.pop();r([t=>a(e,n,h,t),({sources:t,options:n},r)=>{if(!t.length)return r(new Error("Please supply at least one path to remove"));i(t.map(t=>r=>p(e,t.path,n,r)),e=>r(e))}],o)}));const p=(e,t,n,i)=>{if(t===f)return i(new Error("Cannot delete root"));r([n=>l(e,t,n),({mfsPath:t,parts:r},i)=>c(e,t,n,(e,n)=>i(e,{mfsPath:t,parts:r,trail:n})),({trail:i},o)=>{const s=i.pop(),a=i[i.length-1];return a?"dir"!==s.type||n.recursive?void r([t=>u(e,{parentCid:a.cid,name:s.name},t),({cid:e},t)=>{a.cid=e,t(null,i)}],o):o(new Error(`${t} is a directory, use -r to remove directories`)):o(new Error(`${t} does not exist`))},(t,r)=>o(e,t,n,r),({cid:t},n)=>s(e,t,n)],i)}},function(e,t,n){"use strict";const r=n(187).OFFLINE_ERROR,i=n(3),o=n(14),s=n(62),a=n(9),u=n(23),l=n(22);function c(e,t){return Array.from(e).map(e=>({"/":e[1].cid.toBaseEncodedString()}))}e.exports=function e(t){return{wantlist:i((e,n)=>{if("function"==typeof e&&(n=e,e=null),!t.isOnline())return o(()=>n(new Error(r)));let i;if(e){try{e=u.createFromB58String(e)}catch(t){e=null}if(!e)return o(()=>n(new Error("Invalid peerId")));i=t._bitswap.wantlistForPeer(e)}else i=t._bitswap.getWantlist();o(()=>n(null,{Keys:c(i)}))}),stat:i(e=>{if(!t.isOnline())return o(()=>e(new Error(r)));const n=t._bitswap.stat().snapshot;o(()=>{e(null,{provideBufLen:parseInt(n.providesBufferLength.toString()),blocksReceived:new s(n.blocksReceived),wantlist:c(t._bitswap.getWantlist()),peers:t._bitswap.peers().map(e=>e.toB58String()),dupBlksReceived:new s(n.dupBlksReceived),dupDataReceived:new s(n.dupDataReceived),dataReceived:new s(n.dataReceived),blocksSent:new s(n.blocksSent),dataSent:new s(n.dataSent)})})}),unwant:i((e,n)=>{if(!t.isOnline())return o(()=>n(new Error(r)));Array.isArray(e)||(e=[e]);try{e=e.map(e=>a.isCID(e)?e:new a(e))}catch(e){return o(()=>n(l(e,"ERR_INVALID_CID")))}o(()=>n(null,t._bitswap.unwant(e)))})}}},function(e,t,n){"use strict";const r=n(3),i=/^((\d+(\.\d+)*)(ns|ms|us|µs|m|s|h))+$/,o=/((\d+(\.\d+)*)(ns|ms|us|µs|m|s|h))/g,s=/(ns|ms|us|µs|m|s|h)/g,a={ns:1e-6,us:.001,"µs":.001,ms:1,s:1e3,m:6e4,h:36e5};function u(e){let t=e.match(s)[0];return e=e.substring(0,e.length-t.length),parseFloat(e)*a[t]}e.exports=r(function(e,t){return"string"!=typeof e?t(new Error("the first argument must be a string")):i.test(e)?void t(null,e.match(o).reduce((e,t)=>e+u(t),0)):t(new Error("invalid time"))})},function(e,t,n){"use strict";const r=n(1328).Block,i=n(9),o=n(35),s=n(58),a=n(11),u=80,l=(e,t)=>{let n=null,r;try{r=e.toBuffer(!0)}catch(e){n=e}finally{t(n,r)}},c=(e,t)=>{if(80!==e.length){const e=new Error("Bitcoin block header needs to be 80 bytes");return t(e)}const n=r.fromBuffer(e);t(null,n)},f=(e,t,r)=>{"function"==typeof t&&(r=t,t={}),t=t||{};const o=t.hashAlg||n(347).defaultHashAlg,u=void 0===t.version?1:t.version;a([t=>{try{s(e.toBuffer(!0),o,t)}catch(e){t(e)}},(e,t)=>t(null,new i(u,"bitcoin-block",e))],r)},h=e=>{const t=n(347).defaultHashAlg,r=o.encode(e,t),s=1,a=new i(1,"bitcoin-block",r);return a};e.exports={hashToCid:h,BITCOIN_BLOCK_HEADER_SIZE:80,cid:f,deserialize:c,serialize:l}},function(e,t,n){"use strict";var r=t;function i(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e){for(var r=0;r>8,s=255&i;o?n.push(o,s):n.push(s)}return n}function o(e){return 1===e.length?"0"+e:e}function s(e){for(var t="",n=0;n>>3}function h(e){return i(e,17)^i(e,19)^e>>>10}t.ft_1=o,t.ch32=s,t.maj32=a,t.p32=u,t.s0_256=l,t.s1_256=c,t.g0_256=f,t.g1_256=h},function(e,t,n){"use strict";var r=n(93),i=n(191),o=n(575),s=n(107),a=r.sum32,u=r.sum32_4,l=r.sum32_5,c=o.ch32,f=o.maj32,h=o.s0_256,p=o.s1_256,d=o.g0_256,m=o.g1_256,g=i.BlockHash,y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function b(){if(!(this instanceof b))return new b;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}r.inherits(b,g),e.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function e(t,n){for(var r=this.W,i=0;i<16;i++)r[i]=t[n+i];for(;it)throw new TypeError("Script number overflow");if(n&&0==(127&e[r-1])&&(r<=1||0==(128&e[r-2])))throw new Error("Non-minimally encoded script number");if(5===r){const t=e.readUInt32LE(0),n=e.readUInt8(4);return 128&n?-(4294967296*(-129&n)+t):4294967296*n+t}let i=0;for(var o=0;o2147483647?5:e>8388607?4:e>32767?3:e>127?2:e>0?1:0}function s(e){let t=Math.abs(e);const n=o(t),i=r.allocUnsafe(n),s=e<0;for(var a=0;a>=8;return 128&i[n-1]?i.writeUInt8(s?128:0,n-1):s&&(i[n-1]|=128),i}e.exports={decode:i,encode:s}},function(e,t,n){"use strict";var r=n(4).Buffer,i=9007199254740991;function o(e){if(e<0||e>i||e%1!=0)throw new RangeError("value out of range")}function s(e,t,n){if(o(e),t||(t=r.allocUnsafe(u(e))),!r.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");return n||(n=0),e<253?(t.writeUInt8(e,n),s.bytes=1):e<=65535?(t.writeUInt8(253,n),t.writeUInt16LE(e,n+1),s.bytes=3):e<=4294967295?(t.writeUInt8(254,n),t.writeUInt32LE(e,n+1),s.bytes=5):(t.writeUInt8(255,n),t.writeUInt32LE(e>>>0,n+1),t.writeUInt32LE(e/4294967296|0,n+5),s.bytes=9),t}function a(e,t){if(!r.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");t||(t=0);var n=e.readUInt8(t);if(n<253)return a.bytes=1,n;if(253===n)return a.bytes=3,e.readUInt16LE(t+1);if(254===n)return a.bytes=5,e.readUInt32LE(t+1);a.bytes=9;var i=e.readUInt32LE(t+1),s=e.readUInt32LE(t+5),u=4294967296*s+i;return o(u),u}function u(e){return o(e),e<253?1:e<=65535?3:e<=4294967295?5:9}e.exports={encode:s,decode:a,encodingLength:u}},function(e,t,n){const r=n(124),i=n(148),o=n(45),s=n(94),a=n(582),u=n(83),l=o.maybe(o.compile({compressed:s.maybe(s.Boolean),network:s.maybe(s.Network)}));function c(e,t,n){n=n||{},this.compressed=void 0===n.compressed||n.compressed,this.network=n.network||u.bitcoin,this.__d=e||null,this.__Q=null,t&&(this.__Q=r.pointCompress(t,this.compressed))}function f(e,t){if(o(s.Buffer256bit,e),!r.isPrivate(e))throw new TypeError("Private key not in range [1, n)");return o(l,t),new c(e,null,t)}function h(e,t){return o(r.isPoint,e),o(l,t),new c(null,e,t)}function p(e,t){const n=a.decode(e),r=n.version;if(s.Array(t)){if(t=t.filter(function(e){return r===e.wif}).pop(),!t)throw new Error("Unknown network version")}else if(t=t||u.bitcoin,r!==t.wif)throw new Error("Invalid network version");return f(n.privateKey,{compressed:n.compressed,network:t})}function d(e){o(l,e),e=e||{};const t=e.rng||i;let n;do{n=t(32),o(s.Buffer256bit,n)}while(!r.isPrivate(n));return f(n,e)}Object.defineProperty(c.prototype,"privateKey",{enumerable:!1,get:function(){return this.__d}}),Object.defineProperty(c.prototype,"publicKey",{get:function(){return this.__Q||(this.__Q=r.pointFromScalar(this.__d,this.compressed)),this.__Q}}),c.prototype.toWIF=function(){if(!this.__d)throw new Error("Missing private key");return a.encode(this.network.wif,this.__d,this.compressed)},c.prototype.sign=function(e){if(!this.__d)throw new Error("Missing private key");return r.sign(e,this.__d)},c.prototype.verify=function(e,t){return r.verify(e,this.publicKey,t)},e.exports={makeRandom:d,fromPrivateKey:f,fromPublicKey:h,fromWIF:p}},function(e,t,n){(function(t){var r=n(192);function i(e,t){if(void 0!==t&&e[0]!==t)throw new Error("Invalid network version");if(33===e.length)return{version:e[0],privateKey:e.slice(1,33),compressed:!1};if(34!==e.length)throw new Error("Invalid WIF length");if(1!==e[33])throw new Error("Invalid compression flag");return{version:e[0],privateKey:e.slice(1,33),compressed:!0}}function o(e,n,r){var i=new t(r?34:33);return i.writeUInt8(e,0),n.copy(i,1),r&&(i[33]=1),i}function s(e,t){return i(r.decode(e),t)}function a(e,t,n){return"number"==typeof e?r.encode(o(e,t,n)):r.encode(o(e.version,e.privateKey,e.compressed))}e.exports={decode:s,decodeRaw:i,encode:a,encodeRaw:o}}).call(this,n(0).Buffer)},function(e,t,n){const r=n(4).Buffer,i=n(350),o=n(192),s=n(29),a=n(83),u=n(45),l=n(94),c=n(351);function f(e){const t=o.decode(e);if(t.length<21)throw new TypeError(e+" is too short");if(t.length>21)throw new TypeError(e+" is too long");const n=t.readUInt8(0),r=t.slice(1);return{version:n,hash:r}}function h(e){const t=i.decode(e),n=i.fromWords(t.words.slice(1));return{version:t.words[0],prefix:t.prefix,data:r.from(n)}}function p(e,t){u(l.tuple(l.Hash160bit,l.UInt8),arguments);const n=r.allocUnsafe(21);return n.writeUInt8(t,0),e.copy(n,1),o.encode(n)}function d(e,t,n){const r=i.toWords(e);return r.unshift(t),i.encode(n,r)}function m(e,t){t=t||a.bitcoin;try{return c.p2pkh({output:e,network:t}).address}catch(e){}try{return c.p2sh({output:e,network:t}).address}catch(e){}try{return c.p2wpkh({output:e,network:t}).address}catch(e){}try{return c.p2wsh({output:e,network:t}).address}catch(e){}throw new Error(s.toASM(e)+" has no matching Address")}function g(e,t){let n;t=t||a.bitcoin;try{n=f(e)}catch(e){}if(n){if(n.version===t.pubKeyHash)return c.p2pkh({hash:n.hash}).output;if(n.version===t.scriptHash)return c.p2sh({hash:n.hash}).output}else{try{n=h(e)}catch(e){}if(n){if(n.prefix!==t.bech32)throw new Error(e+" has an invalid prefix");if(0===n.version){if(20===n.data.length)return c.p2wpkh({hash:n.data}).output;if(32===n.data.length)return c.p2wsh({hash:n.data}).output}}}throw new Error(e+" has no matching Script")}e.exports={fromBase58Check:f,fromBech32:h,fromOutputScript:m,toBase58Check:p,toBech32:d,toOutputScript:g}},function(e,t,n){const r=n(29),i=n(36);function o(e){const t=r.compile(e);return 22===t.length&&t[0]===i.OP_0&&20===t[1]}o.toJSON=function(){return"Witness pubKeyHash output"},e.exports={check:o}},function(e,t,n){const r=n(29),i=n(36);function o(e){const t=r.compile(e);return 34===t.length&&t[0]===i.OP_0&&32===t[1]}o.toJSON=function(){return"Witness scriptHash output"},e.exports={check:o}},function(e,t,n){"use strict";(function(t){const r=n(1387),i=n(194),o=n(195),s=n(1398);function a(e,n,r){const o=[];o.push({path:"storage",value:{"/":i("eth-storage-trie",e.stateRoot).toBaseEncodedString()}}),s.equals(e.codeHash)?o.push({path:"code",value:t.from("")}):o.push({path:"code",value:{"/":i("raw",e.codeHash).toBaseEncodedString()}}),o.push({path:"stateRoot",value:e.stateRoot}),o.push({path:"codeHash",value:e.codeHash}),o.push({path:"nonce",value:e.nonce}),o.push({path:"balance",value:e.balance}),o.push({path:"isEmpty",value:e.isEmpty()}),o.push({path:"isContract",value:e.isContract()}),r(null,o)}e.exports=o("eth-account-snapshot",r,a)}).call(this,n(0).Buffer)},function(e,t){e.exports=function e(t){if("string"!=typeof t)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof t+", while checking isHexPrefixed.");return"0x"===t.slice(0,2)}},function(e,t){function n(e){return function t(n,r,i){e(n,r,(e,t)=>e?i(e):t.remainderPath.length>0?i(new Error("path out of scope")):void("object"==typeof t.value&&t.value["/"]?i(null,t.value):i(null,!1)))}}e.exports=n},function(e,t,n){const r=n(590),i=n(216);function o(e,t){return{deserialize:i(e=>new t(e)),serialize:i(e=>e.serialize()),cid:i((t,n)=>r(e,t,n))}}e.exports=o},function(e,t,n){"use strict";const r=n(194);function i(e,t,n){const i=t.hash(),o=r(e,i,n);return o}e.exports=i},function(e,t,n){"use strict";const r=n(592),i=n(194),o=n(195);function s(e,t,n){const r=[];r.push({path:"parent",value:{"/":i("eth-block",e.parentHash).toBaseEncodedString()}}),r.push({path:"ommers",value:{"/":i("eth-block-list",e.uncleHash).toBaseEncodedString()}}),r.push({path:"transactions",value:{"/":i("eth-tx-trie",e.transactionsTrie).toBaseEncodedString()}}),r.push({path:"transactionReceipts",value:{"/":i("eth-tx-receipt-trie",e.receiptTrie).toBaseEncodedString()}}),r.push({path:"state",value:{"/":i("eth-state-trie",e.stateRoot).toBaseEncodedString()}}),r.push({path:"parentHash",value:e.parentHash}),r.push({path:"ommerHash",value:e.uncleHash}),r.push({path:"transactionTrieRoot",value:e.transactionsTrie}),r.push({path:"transactionReceiptTrieRoot",value:e.receiptTrie}),r.push({path:"stateRoot",value:e.stateRoot}),r.push({path:"authorAddress",value:e.coinbase}),r.push({path:"bloom",value:e.bloom}),r.push({path:"difficulty",value:e.difficulty}),r.push({path:"number",value:e.number}),r.push({path:"gasLimit",value:e.gasLimit}),r.push({path:"gasUsed",value:e.gasUsed}),r.push({path:"timestamp",value:e.timestamp}),r.push({path:"extraData",value:e.extraData}),r.push({path:"mixHash",value:e.mixHash}),r.push({path:"nonce",value:e.nonce}),n(null,r)}e.exports=o("eth-block",r,s)},function(e,t,n){(function(t){const r=n(1399).default,i=n(269),o=i.BN;var s=e.exports=function(e,n){if(n=n||{},n.common){if(n.chain)throw new Error("Instantiation with both opts.common and opts.chain parameter not allowed!");this._common=n.common}else{let e=n.chain?n.chain:"mainnet",t=n.hardfork?n.hardfork:null;this._common=new r(e,t)}var o=[{name:"parentHash",length:32,default:i.zeros(32)},{name:"uncleHash",default:i.SHA3_RLP_ARRAY},{name:"coinbase",length:20,default:i.zeros(20)},{name:"stateRoot",length:32,default:i.zeros(32)},{name:"transactionsTrie",length:32,default:i.SHA3_RLP},{name:"receiptTrie",length:32,default:i.SHA3_RLP},{name:"bloom",default:i.zeros(256)},{name:"difficulty",default:t.from([])},{name:"number",default:i.intToBuffer(115e4)},{name:"gasLimit",default:t.from("ffffffffffffff","hex")},{name:"gasUsed",empty:!0,default:t.from([])},{name:"timestamp",default:t.from([])},{name:"extraData",allowZero:!0,empty:!0,default:t.from([])},{name:"mixHash",default:i.zeros(32)},{name:"nonce",default:i.zeros(8)}];i.defineProperties(this,o,e)};s.prototype.canonicalDifficulty=function(e){const t=this._common.hardfork()||this._common.activeHardfork(i.bufferToInt(this.number)),n=new o(this.timestamp),r=new o(e.header.timestamp),s=new o(e.header.difficulty),a=new o(this._common.param("pow","minimumDifficulty",t));var u=s.div(new o(this._common.param("pow","difficultyBoundDivisor",t))),l=new o(this.number),c,f,h;if(this._common.hardforkGteHardfork(t,"byzantium")){var p=e.header.uncleHash.equals(i.SHA3_RLP_ARRAY)?1:2;c=n.sub(r).idivn(9).ineg().iaddn(p),f=new o(-99),1===f.cmp(c)&&(c=f),h=s.add(u.mul(c))}this._common.hardforkGteHardfork(t,"constantinople")?(l.isubn(5e6),l.ltn(0)&&(l=new o(0))):this._common.hardforkGteHardfork(t,"byzantium")?(l.isubn(3e6),l.ltn(0)&&(l=new o(0))):this._common.hardforkGteHardfork(t,"homestead")?(c=n.sub(r).idivn(10).ineg().iaddn(1),f=new o(-99),1===f.cmp(c)&&(c=f),h=s.add(u.mul(c))):h=1===r.addn(this._common.param("pow","durationLimit",t)).cmp(n)?u.add(s):s.sub(u);var d=l.idivn(1e5).isubn(2);return d.isNeg()||h.iadd(new o(2).pow(d)),-1===h.cmp(a)&&(h=a),h},s.prototype.validateDifficulty=function(e){const t=this.canonicalDifficulty(e);return 0===t.cmp(new o(this.difficulty))},s.prototype.validateGasLimit=function(e){const t=new o(e.header.gasLimit),n=new o(this.gasLimit),r=this._common.hardfork()?this._common.hardfork():this._common.activeHardfork(this.number),i=t.div(new o(this._common.param("gasConfig","gasLimitBoundDivisor",r))),s=t.add(i),a=t.sub(i);return n.lt(s)&&n.gt(a)&&n.gte(this._common.param("gasConfig","minGasLimit",r))},s.prototype.validate=function(e,t,n){var r=this;if(2===arguments.length&&(n=t,t=!1),this.isGenesis())return n();e.getBlock(r.parentHash,function(e,s){if(e)return n("could not find parent block");r.parentBlock=s;var a=new o(r.number);if(0!==a.cmp(new o(s.header.number).iaddn(1)))return n("invalid number");if(t){var u=t.sub(new o(s.header.number));if(-1!==u.cmpn(8)||1!==u.cmpn(1))return n("uncle block has a parent that is too old or to young")}if(!r.validateDifficulty(s))return n("invalid Difficulty");if(!r.validateGasLimit(s))return n("invalid gas limit");if(i.bufferToInt(s.header.number)+1!==i.bufferToInt(r.number))return n("invalid heigth");if(i.bufferToInt(r.timestamp)<=i.bufferToInt(s.header.timestamp))return n("invalid timestamp");const l=r._common.hardfork()?r._common.hardfork():r._common.activeHardfork(t);if(r.extraData.length>r._common.param("vm","maxExtraDataSize",l))return n("invalid amount of extra data");n()})},s.prototype.hash=function(){return i.rlphash(this.raw)},s.prototype.isGenesis=function(){return""===this.number.toString("hex")},s.prototype.setGenesisParams=function(){this.timestamp=this._common.genesis().timestamp,this.gasLimit=this._common.genesis().gasLimit,this.difficulty=this._common.genesis().difficulty,this.extraData=this._common.genesis().extraData,this.nonce=this._common.genesis().nonce,this.stateRoot=this._common.genesis().stateRoot,this.number=t.from([])}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(1421),i=n(195);function o(e,t,n){const r=[];r.push({path:"nonce",value:e.nonce}),r.push({path:"gasPrice",value:e.gasPrice}),r.push({path:"gasLimit",value:e.gasLimit}),r.push({path:"toAddress",value:e.to}),r.push({path:"value",value:e.value}),r.push({path:"data",value:e.data}),r.push({path:"v",value:e.v}),r.push({path:"r",value:e.r}),r.push({path:"s",value:e.s}),r.push({path:"fromAddress",value:e.from}),r.push({path:"signature",value:[e.v,e.r,e.s]}),r.push({path:"isContractPublish",value:e.toCreationAddress()}),n(null,r)}e.exports=i("eth-tx",r,o)},function(e,t,n){"use strict";(function(r){const i=n(14),o=n(11),s=n(58),a=n(9),u=n(595),l=n(270),c=n(1427),f=n(1428),h=n(1429);t=e.exports,t.serialize=((e,t)=>{if(null!==e)if(r.isBuffer(e))"blob"===e.slice(0,4).toString()?i(()=>t(null,e)):i(()=>t(new Error("unexpected dagNode passed to serialize"),null));else switch(e.gitType){case"commit":c.serialize(e,t);break;case"tag":f.serialize(e,t);break;default:h.serialize(e,t)}else i(()=>t(new Error("dagNode passed to serialize was null"),null))}),t.deserialize=((e,t)=>{let n=l.find(e,0),r=e.slice(0,n).toString(),o=r.match(/([^ ]+) (\d+)/);if(o)switch(o[1]){case"blob":t(null,e);break;case"commit":c.deserialize(e.slice(n+1),t);break;case"tag":f.deserialize(e.slice(n+1),t);break;case"tree":h.deserialize(e.slice(n+1),t);break;default:i(()=>t(new Error("unknown object type "+o[1]),null))}else i(()=>t(new Error("invalid object header"),null))}),t.cid=((e,n,r)=>{"function"==typeof n&&(r=n,n={}),n=n||{};const i=n.hashAlg||u.defaultHashAlg,l=void 0===n.version?1:n.version;o([n=>t.serialize(e,n),(e,t)=>s(e,i,t),(e,t)=>t(null,new a(l,u.multicodec,e))],r)})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(594),o=n(454);t=e.exports,t.multicodec="git-raw",t.defaultHashAlg="sha1";const s=["original","name","email","date"];t.resolve=((e,t,n)=>{"function"==typeof t&&(n=t,t=void 0),i.deserialize(e,(e,i)=>{if(e)return n(e);if(!t||"/"===t)return n(null,{value:i,remainderPath:""});if(r.isBuffer(i))return n(null,{value:i,remainderPath:t});const s=t.split("/"),a=o(i).get(s);if(a)return n(null,{value:a,remainderPath:""});let u,l=s.length;for(let e=0;e{"function"==typeof t&&(n=t,t=void 0),t=t||{},i.deserialize(e,(e,t)=>{if(e)return n(e);if(r.isBuffer(t))return n(null,[]);let i=[];switch(t.gitType){case"commit":i=["message","tree"],i=i.concat(s.map(e=>"author/"+e)),i=i.concat(s.map(e=>"committer/"+e)),i=i.concat(t.parents.map((e,t)=>"parents/"+t)),t.encoding&&i.push("encoding");break;case"tag":i=["object","type","tag","message"],t.tagger&&(i=i.concat(s.map(e=>"tagger/"+e)));break;default:Object.keys(t).forEach(e=>{i.push(e),i.push(e+"/hash"),i.push(e+"/mode")})}n(null,i)})}),t.isLink=((e,n,r)=>{t.resolve(e,n,(e,t)=>e?r(e):t.remainderPath.length>0?r(new Error("path out of scope")):void("object"==typeof t.value&&t.value["/"]?r(null,t.value):r(null,!1)))})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(1431).BlockHeader,i=n(9),o=n(35),s=n(58),a=n(11),u=1487,l=(e,t)=>{let n=null,r;try{r=e.toBuffer()}catch(e){n=e}finally{t(n,r)}},c=(e,t)=>{if(1487!==e.length){const e=new Error("Zcash block header needs to be 1487 bytes");return t(e)}const n=r.fromBuffer(e);t(null,n)},f=(e,t,r)=>{"function"==typeof t&&(r=t,t={}),t=t||{};const o=t.hashAlg||n(356).defaultHashAlg,u=void 0===t.version?1:t.version;a([t=>{try{s(e.toBuffer(),o,t)}catch(e){t(e)}},(e,t)=>t(null,new i(u,"zcash-block",e))],r)},h=e=>{const t=n(356).defaultHashAlg,r=o.encode(e,t),s=1,a=new i(1,"zcash-block",r);return a};e.exports={hashToCid:h,ZCASH_BLOCK_HEADER_SIZE:1487,cid:f,deserialize:c,serialize:l}},function(e,t,n){(function(e){!function(e,t){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(null!==e&&"object"==typeof e&&Array.isArray(e.words))return e;this.sign=!1,this.words=null,this.length=0,this.red=null,"le"!==t&&"be"!==t||(n=t,t=10),null!==e&&this._init(e||0,t||10,n||"be")}function o(e,t,n){for(var r=0,i=Math.min(e.length,n),o=t;o=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function s(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function e(t,r,i){if("number"==typeof t)return t<0&&(this.sign=!0,t=-t),void(t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3));if("object"==typeof t)return this._initArray(t,r,i);"hex"===r&&(r=16),n(r===(0|r)&&r>=2&&r<=36),t=t.toString().replace(/\s+/g,"");var o=0;"-"===t[0]&&o++,16===r?this._parseHex(t,o):this._parseBase(t,r,o),"-"===t[0]&&(this.sign=!0),this.strip()},i.prototype._initArray=function e(t,r,i){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var o=0;o=0;o-=3){var u=t[o]|t[o-1]<<8|t[o-2]<<16;this.words[a]|=u<>>26-s&67108863,s+=24,s>=26&&(s-=26,a++)}else if("le"===i)for(var o=0,a=0;o>>26-s&67108863,s+=24,s>=26&&(s-=26,a++)}return this.strip()},i.prototype._parseHex=function e(t,n){this.length=Math.ceil((t.length-n)/6),this.words=new Array(this.length);for(var r=0;r=n;r-=6){var a=o(t,r,r+6);this.words[s]|=a<>>26-i&4194303,i+=24,i>=26&&(i-=26,s++)}if(r+6!==n){var a=o(t,n,r+6);this.words[s]|=a<>>26-i&4194303}this.strip()},i.prototype._parseBase=function e(t,n,r){this.words=[0],this.length=1;for(var i=0,o=1;o<=67108863;o*=n)i++;i--,o=o/n|0;for(var a=t.length-r,u=a%i,l=Math.min(a,a-u)+r,c=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function e(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function e(){return(this.red?""};var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function e(t,r){if(t=t||10,16===t||"hex"===t){for(var i="",o=0,r=0|r||1,s=0,c=0;c>>24-o&16777215,i=0!==s||c!==this.length-1?a[6-h.length]+h+i:h+i,o+=2,o>=26&&(o-=26,c--)}for(0!==s&&(i=s.toString(16)+i);i.length%r!=0;)i="0"+i;return this.sign&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var p=u[t],d=l[t],i="",m=this.clone();for(m.sign=!1;0!==m.cmpn(0);){var g=m.modn(d).toString(t);m=m.idivn(d),i=0!==m.cmpn(0)?a[p-g.length]+g+i:g+i}return 0===this.cmpn(0)&&(i="0"+i),this.sign&&(i="-"+i),i}n(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function e(){return this.toString(16)},i.prototype.toArray=function e(){this.strip();var t=new Array(this.byteLength());t[0]=0;for(var n=this.clone(),r=0;0!==n.cmpn(0);r++){var i=n.andln(255);n.ishrn(8),t[t.length-r-1]=i}return t},Math.clz32?i.prototype._countBits=function e(t){return 32-Math.clz32(t)}:i.prototype._countBits=function e(t){var n=t,r=0;return n>=4096&&(r+=13,n>>>=13),n>=64&&(r+=7,n>>>=7),n>=8&&(r+=4,n>>>=4),n>=2&&(r+=2,n>>>=2),r+n},i.prototype._zeroBits=function e(t){if(0===t)return 26;var n=t,r=0;return 0==(8191&n)&&(r+=13,n>>>=13),0==(127&n)&&(r+=7,n>>>=7),0==(15&n)&&(r+=4,n>>>=4),0==(3&n)&&(r+=2,n>>>=2),0==(1&n)&&r++,r},i.prototype.bitLength=function e(){var t=0,n=this.words[this.length-1],t=this._countBits(n);return 26*(this.length-1)+t},i.prototype.zeroBits=function e(){if(0===this.cmpn(0))return 0;for(var t=0,n=0;nt.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.iand=function e(t){var n;this.sign=this.sign&&t.sign,n=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.ixor=function e(t){var n,r;this.sign=this.sign||t.sign,this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.setn=function e(t,r){n("number"==typeof t&&t>=0);for(var i=t/26|0,o=t%26;this.length<=i;)this.words[this.length++]=0;return this.words[i]=r?this.words[i]|1<t.length?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>>26}for(;0!==o&&s>>26}if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function e(t){if(t.sign){t.sign=!1;var n=this.iadd(t);return t.sign=!0,n._normSign()}if(this.sign)return this.sign=!1,this.iadd(t),this.sign=!0,this._normSign();var r=this.cmp(t),i,o;if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;r>0?(i=this,o=t):(i=t,o=this);for(var s=0,a=0;a>26,this.words[a]=67108863&n}for(;0!==s&&a>26,this.words[a]=67108863&n}if(0===s&&a>>26,s=67108863&r,a=Math.min(i,t.length-1),u=Math.max(0,i-this.length+1);u<=a;u++){var l=i-u,c=0|this.words[l],f=0|t.words[u],h=c*f,p=67108863&h;o=o+(h/67108864|0)|0,p=p+s|0,s=67108863&p,o=o+(p>>>26)|0}n.words[i]=s,r=o}return 0!==r?n.words[i]=r:n.length--,n.strip()},i.prototype._bigMulTo=function e(t,n){n.sign=t.sign!==this.sign,n.length=this.length+t.length;for(var r=0,i=0,o=0;o>>26)|0,i+=s>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()},i.prototype.mulTo=function e(t,n){var r;return r=this.length+t.length<63?this._smallMulTo(t,n):this._bigMulTo(t,n),r},i.prototype.mul=function e(t){var n=new i(null);return n.words=new Array(this.length+t.length),this.mulTo(t,n)},i.prototype.imul=function e(t){if(0===this.cmpn(0)||0===t.cmpn(0))return this.words[0]=0,this.length=1,this;var n=this.length,r=t.length;this.sign=t.sign!==this.sign,this.length=this.length+t.length,this.words[this.length-1]=0;for(var i=this.length-2;i>=0;i--){for(var o=0,s=0,a=Math.min(i,r-1),u=Math.max(0,i-n+1);u<=a;u++){var l=i-u,c=this.words[l],f=t.words[u],h=c*f,p=67108863&h;o+=h/67108864|0,p+=s,s=67108863&p,o+=p>>>26}this.words[i]=s,this.words[i+1]+=o,o=0}for(var o=0,l=1;l>>26}return this.strip()},i.prototype.imuln=function e(t){n("number"==typeof t);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),this},i.prototype.sqr=function e(){return this.mul(this)},i.prototype.isqr=function e(){return this.mul(this)},i.prototype.ishln=function e(t){n("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){for(var s=0,a=0;a>>26-r}s&&(this.words[a]=s,this.length++)}if(0!==i){for(var a=this.length-1;a>=0;a--)this.words[a+i]=this.words[a];for(var a=0;a=0),o=r?(r-r%26)/26:0;var s=t%26,a=Math.min((t-s)/26,this.length),u=67108863^67108863>>>s<a){this.length-=a;for(var c=0;c=0&&(0!==f||c>=o);c--){var h=this.words[c];this.words[c]=f<<26-s|h>>>s,f=h&u}return l&&0!==f&&(l.words[l.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function e(t){return this.clone().ishln(t)},i.prototype.shrn=function e(t){return this.clone().ishrn(t)},i.prototype.testn=function e(t){n("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,o=1<=0);var r=t%26,i=(t-r)/26;if(n(!this.sign,"imaskn works only with positive numbers"),0!==r&&i++,this.length=Math.min(i,this.length),0!==r){var o=67108863^67108863>>>r<=67108864;n++)this.words[n]-=67108864,n===this.length-1?this.words[n+1]=1:this.words[n+1]++;return this.length=Math.max(this.length,n+1),this},i.prototype.isubn=function e(t){if(n("number"==typeof t),t<0)return this.iaddn(-t);if(this.sign)return this.sign=!1,this.iaddn(t),this.sign=!0,this;this.words[0]-=t;for(var r=0;r>26)-(c/67108864|0),this.words[s+i]=67108863&l}for(;s>26,this.words[s+i]=67108863&l}if(0===u)return this.strip();n(-1===u),u=0;for(var s=0;s>26,this.words[s]=67108863&l}return this.sign=!0,this.strip()},i.prototype._wordDiv=function e(t,n){var r=this.length-t.length,o=this.clone(),s=t,a=s.words[s.length-1],u=this._countBits(a);r=26-u,0!==r&&(s=s.shln(r),o.ishln(r),a=s.words[s.length-1]);var l=o.length-s.length,c;if("mod"!==n){c=new i(null),c.length=l+1,c.words=new Array(c.length);for(var f=0;f=0;p--){var d=67108864*o.words[s.length+p]+o.words[s.length+p-1];for(d=Math.min(d/a|0,67108863),o._ishlnsubmul(s,d,p);o.sign;)d--,o.sign=!1,o._ishlnsubmul(s,1,p),0!==o.cmpn(0)&&(o.sign=!o.sign);c&&(c.words[p]=d)}return c&&c.strip(),o.strip(),"div"!==n&&0!==r&&o.ishrn(r),{div:c||null,mod:o}},i.prototype.divmod=function e(t,r){if(n(0!==t.cmpn(0)),this.sign&&!t.sign){var o=this.neg().divmod(t,r),s,a;return"mod"!==r&&(s=o.div.neg()),"div"!==r&&(a=0===o.mod.cmpn(0)?o.mod:t.sub(o.mod)),{div:s,mod:a}}if(!this.sign&&t.sign){var o=this.divmod(t.neg(),r),s;return"mod"!==r&&(s=o.div.neg()),{div:s,mod:o.mod}}return this.sign&&t.sign?this.neg().divmod(t.neg(),r):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===r?{div:this.divn(t.words[0]),mod:null}:"mod"===r?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,r)},i.prototype.div=function e(t){return this.divmod(t,"div").div},i.prototype.mod=function e(t){return this.divmod(t,"mod").mod},i.prototype.divRound=function e(t){var n=this.divmod(t);if(0===n.mod.cmpn(0))return n.div;var r=n.div.sign?n.mod.isub(t):n.mod,i=t.shrn(1),o=t.andln(1),s=r.cmp(i);return s<0||1===o&&0===s?n.div:n.div.sign?n.div.isubn(1):n.div.iaddn(1)},i.prototype.modn=function e(t){n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+this.words[o])%t;return i},i.prototype.idivn=function e(t){n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=this.words[i]+67108864*r;this.words[i]=o/t|0,r=o%t}return this.strip()},i.prototype.divn=function e(t){return this.clone().idivn(t)},i.prototype.egcd=function e(t){n(!t.sign),n(0!==t.cmpn(0));var r=this,o=t.clone();r=r.sign?r.mod(t):r.clone();for(var s=new i(1),a=new i(0),u=new i(0),l=new i(1),c=0;r.isEven()&&o.isEven();)r.ishrn(1),o.ishrn(1),++c;for(var f=o.clone(),h=r.clone();0!==r.cmpn(0);){for(;r.isEven();)r.ishrn(1),s.isEven()&&a.isEven()?(s.ishrn(1),a.ishrn(1)):(s.iadd(f).ishrn(1),a.isub(h).ishrn(1));for(;o.isEven();)o.ishrn(1),u.isEven()&&l.isEven()?(u.ishrn(1),l.ishrn(1)):(u.iadd(f).ishrn(1),l.isub(h).ishrn(1));r.cmp(o)>=0?(r.isub(o),s.isub(u),a.isub(l)):(o.isub(r),u.isub(s),l.isub(a))}return{a:u,b:l,gcd:o.ishln(c)}},i.prototype._invmp=function e(t){n(!t.sign),n(0!==t.cmpn(0));var r=this,o=t.clone();r=r.sign?r.mod(t):r.clone();for(var s=new i(1),a=new i(0),u=o.clone();r.cmpn(1)>0&&o.cmpn(1)>0;){for(;r.isEven();)r.ishrn(1),s.isEven()?s.ishrn(1):s.iadd(u).ishrn(1);for(;o.isEven();)o.ishrn(1),a.isEven()?a.ishrn(1):a.iadd(u).ishrn(1);r.cmp(o)>=0?(r.isub(o),s.isub(a)):(o.isub(r),a.isub(s))}return 0===r.cmpn(1)?s:a},i.prototype.gcd=function e(t){if(0===this.cmpn(0))return t.clone();if(0===t.cmpn(0))return this.clone();var n=this.clone(),r=t.clone();n.sign=!1,r.sign=!1;for(var i=0;n.isEven()&&r.isEven();i++)n.ishrn(1),r.ishrn(1);for(;;){for(;n.isEven();)n.ishrn(1);for(;r.isEven();)r.ishrn(1);var o=n.cmp(r);if(o<0){var s=n;n=r,r=s}else if(0===o||0===r.cmpn(1))break;n.isub(r)}return r.ishln(i)},i.prototype.invm=function e(t){return this.egcd(t).a.mod(t)},i.prototype.isEven=function e(){return 0==(1&this.words[0])},i.prototype.isOdd=function e(){return 1==(1&this.words[0])},i.prototype.andln=function e(t){return this.words[0]&t},i.prototype.bincn=function e(t){n("number"==typeof t);var r=t%26,i=(t-r)/26,o=1<>>26,u&=67108863,this.words[s]=u}return 0!==a&&(this.words[s]=a,this.length++),this},i.prototype.cmpn=function e(t){var n=t<0,r;if(n&&(t=-t),this.sign&&!n)return-1;if(!this.sign&&n)return 1;if(t&=67108863,this.strip(),this.length>1)r=1;else{var i=this.words[0];r=i===t?0:it.length)return 1;if(this.length=0;r--){var i=this.words[r],o=t.words[r];if(i!==o){io&&(n=1);break}}return n},i.red=function e(t){return new g(t)},i.prototype.toRed=function e(t){return n(!this.red,"Already a number in reduction context"),n(!this.sign,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function e(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function e(t){return this.red=t,this},i.prototype.forceRed=function e(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function e(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function e(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function e(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function e(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function e(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function e(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function e(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function e(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function e(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function e(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function e(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function e(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function e(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var c={k256:null,p224:null,p192:null,p25519:null};function f(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function h(){f.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function p(){f.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function d(){f.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){f.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function g(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else this.m=e,this.prime=null}function y(e){g.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}f.prototype._tmp=function e(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},f.prototype.ireduce=function e(t){var n=t,r;do{this.split(n,this.tmp),n=this.imulK(n),n=n.iadd(this.tmp),r=n.bitLength()}while(r>this.n);var i=r0?n.isub(this.p):n.strip(),n},f.prototype.split=function e(t,n){t.ishrn(this.n,0,n)},f.prototype.imulK=function e(t){return t.imul(this.k)},r(h,f),h.prototype.split=function e(t,n){for(var r=4194303,i=Math.min(t.length,9),o=0;o>>22,s=a}t.words[o-10]=s>>>22,t.length-=9},h.prototype.imulK=function e(t){var n;t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var r=0,i=0;i>>=26,t.words[r]=o,n=i}return 0!==n&&(t.words[t.length++]=n),t},i._prime=function e(t){if(c[t])return c[t];var e;if("k256"===t)e=new h;else if("p224"===t)e=new p;else if("p192"===t)e=new d;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new m}return c[t]=e,e},g.prototype._verify1=function e(t){n(!t.sign,"red works only with positives"),n(t.red,"red works only with red numbers")},g.prototype._verify2=function e(t,r){n(!t.sign&&!r.sign,"red works only with positives"),n(t.red&&t.red===r.red,"red works only with red numbers")},g.prototype.imod=function e(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.mod(this.m)._forceRed(this)},g.prototype.neg=function e(t){var n=t.clone();return n.sign=!n.sign,n.iadd(this.m)._forceRed(this)},g.prototype.add=function e(t,n){this._verify2(t,n);var r=t.add(n);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},g.prototype.iadd=function e(t,n){this._verify2(t,n);var r=t.iadd(n);return r.cmp(this.m)>=0&&r.isub(this.m),r},g.prototype.sub=function e(t,n){this._verify2(t,n);var r=t.sub(n);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},g.prototype.isub=function e(t,n){this._verify2(t,n);var r=t.isub(n);return r.cmpn(0)<0&&r.iadd(this.m),r},g.prototype.shl=function e(t,n){return this._verify1(t),this.imod(t.shln(n))},g.prototype.imul=function e(t,n){return this._verify2(t,n),this.imod(t.imul(n))},g.prototype.mul=function e(t,n){return this._verify2(t,n),this.imod(t.mul(n))},g.prototype.isqr=function e(t){return this.imul(t,t)},g.prototype.sqr=function e(t){return this.mul(t,t)},g.prototype.sqrt=function e(t){if(0===t.cmpn(0))return t.clone();var r=this.m.andln(3);if(n(r%2==1),3===r){var o=this.m.add(new i(1)).ishrn(2),s=this.pow(t,o);return s}for(var a=this.m.subn(1),u=0;0!==a.cmpn(0)&&0===a.andln(1);)u++,a.ishrn(1);n(0!==a.cmpn(0));var l=new i(1).toRed(this),c=l.redNeg(),f=this.m.subn(1).ishrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,f).cmp(c);)h.redIAdd(c);for(var p=this.pow(h,a),s=this.pow(t,a.addn(1).ishrn(1)),d=this.pow(t,a),m=u;0!==d.cmp(l);){for(var g=d,y=0;0!==g.cmp(l);y++)g=g.redSqr();n(y=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},y.prototype.mul=function e(t,n){if(0===t.cmpn(0)||0===n.cmpn(0))return new i(0)._forceRed(this);var r=t.mul(n),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(o).ishrn(this.shift),a=s;return s.cmp(this.m)>=0?a=s.isub(this.m):s.cmpn(0)<0&&(a=s.iadd(this.m)),a._forceRed(this)},y.prototype.invm=function e(t){var n=this.imod(t._invmp(this.m).mul(this.r2));return n._forceRed(this)}}(e,this)}).call(this,n(75)(e))},function(e,t,n){"use strict";(function(t){var r=n(49),i=n(152),o=n(85),s=n(96),a=n(276),u=n(60),l=n(30),c=n(17),f=n(25),h=function e(t){if(!(this instanceof e))return new e(t);t&&this.set(t)};h.prototype.set=function(e){return this.hashbuf=e.hashbuf||this.hashbuf,this.endian=e.endian||this.endian,this.privkey=e.privkey||this.privkey,this.pubkey=e.pubkey||(this.privkey?this.privkey.publicKey:this.pubkey),this.sig=e.sig||this.sig,this.k=e.k||this.k,this.verified=e.verified||this.verified,this},h.prototype.privkey2pubkey=function(){this.pubkey=this.privkey.toPublicKey()},h.prototype.calci=function(){for(var e=0;e<4;e++){var t;this.sig.i=e;try{t=this.toPublicKey()}catch(e){console.error(e);continue}if(t.point.eq(this.pubkey.point))return this.sig.compressed=this.pubkey.compressed,this}throw this.sig.i=void 0,new Error("Unable to find valid recovery factor")},h.fromString=function(e){var t=JSON.parse(e);return new h(t)},h.prototype.randomK=function(){var e=i.getN(),t;do{t=r.fromBuffer(a.getRandomBuffer(32))}while(!t.lt(e)||!t.gt(r.Zero));return this.k=t,this},h.prototype.deterministicK=function(e){c.isUndefined(e)&&(e=0);var n=new t(32);n.fill(1);var o=new t(32);o.fill(0);var s=this.privkey.bn.toBuffer({size:32}),a="little"===this.endian?l.reverse(this.hashbuf):this.hashbuf;o=u.sha256hmac(t.concat([n,new t([0]),s,a]),o),n=u.sha256hmac(n,o),o=u.sha256hmac(t.concat([n,new t([1]),s,a]),o),n=u.sha256hmac(n,o),n=u.sha256hmac(n,o);for(var f=r.fromBuffer(n),h=i.getN(),p=0;p>1,l=i.getN(),c=i.getG(),h=u?n.add(l):n,p=i.fromX(a,h),d=p.mul(l);if(!d.isInfinity())throw new Error("nR is not a valid curve point");var m=t.neg().mod(l),g=n.invm(l),y=p.mul(o).add(c.mul(m)).mul(g),b=s.fromPoint(y,this.sig.compressed);return b},h.prototype.sigError=function(){if(!l.isBuffer(this.hashbuf)||32!==this.hashbuf.length)return"hashbuf must be a 32 byte buffer";var e=this.sig.r,t=this.sig.s;if(!(e.gt(r.Zero)&&e.lt(i.getN())&&t.gt(r.Zero)&&t.lt(i.getN())))return"r and s not in range";var n=r.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),o=i.getN(),s=t.invm(o),a=s.mul(n).mod(o),u=s.mul(e).mod(o),c=i.getG().mulAdd(a,this.pubkey.point,u);return c.isInfinity()?"p is infinity":0!==c.getX().mod(o).cmp(e)&&"Invalid signature"},h.toLowS=function(e){return e.gt(r.fromBuffer(new t("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(e=i.getN().sub(e)),e},h.prototype._findSignature=function(e,t){var n=i.getN(),o=i.getG(),s=0,a,u,l,c;do{(!this.k||s>0)&&this.deterministicK(s),s++,a=this.k,u=o.mul(a),l=u.x.mod(n),c=a.invm(n).mul(t.add(e.mul(l))).mod(n)}while(l.cmp(r.Zero)<=0||c.cmp(r.Zero)<=0);return c=h.toLowS(c),{s:c,r:l}},h.prototype.sign=function(){var e=this.hashbuf,t=this.privkey,n=t.bn;f.checkState(e&&t&&n,new Error("invalid parameters")),f.checkState(l.isBuffer(e)&&32===e.length,new Error("hashbuf must be a 32 byte buffer"));var i=r.fromBuffer(e,this.endian?{endian:this.endian}:void 0),s=this._findSignature(n,i);return s.compressed=this.pubkey.compressed,this.sig=new o(s),this},h.prototype.signRandomK=function(){return this.randomK(),this.sign()},h.prototype.toString=function(){var e={};return this.hashbuf&&(e.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(e.privkey=this.privkey.toString()),this.pubkey&&(e.pubkey=this.pubkey.toString()),this.sig&&(e.sig=this.sig.toString()),this.k&&(e.k=this.k.toString()),JSON.stringify(e)},h.prototype.verify=function(){return this.sigError()?this.verified=!1:this.verified=!0,this},h.sign=function(e,t,n){return h().set({hashbuf:e,endian:n,privkey:t}).sign().sig},h.verify=function(e,t,n,r){return h().set({hashbuf:e,endian:r,sig:t,pubkey:n}).verify().verified},e.exports=h}).call(this,n(0).Buffer)},function(e,t){for(var n="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",r={},i=0;i>8,i[n]&=255;for(;a;)i.push(255&a),a>>=8}for(t=0;"1"===e[t]&&t0&&r0&&u0&&(i=r?i+" "+e.buf.toString("hex"):i+" "+e.len+" 0x"+e.buf.toString("hex"));else if(void 0!==a.reverseMap[n])i=i+" "+a(n).toString();else{var o=n.toString(16);o.length%2!=0&&(o="0"+o),i=r?i+" "+o:i+" 0x"+o}return i},y.prototype.toASM=function(){for(var e="",t=0;t"},y.prototype.isPublicKeyHashOut=function(){return!(5!==this.chunks.length||this.chunks[0].opcodenum!==a.OP_DUP||this.chunks[1].opcodenum!==a.OP_HASH160||!this.chunks[2].buf||20!==this.chunks[2].buf.length||this.chunks[3].opcodenum!==a.OP_EQUALVERIFY||this.chunks[4].opcodenum!==a.OP_CHECKSIG)},y.prototype.isPublicKeyHashIn=function(){if(2===this.chunks.length){var e=this.chunks[0].buf,t=this.chunks[1].buf;if(e&&e.length&&48===e[0]&&t&&t.length){var n=t[0];if((4===n||6===n||7===n)&&65===t.length)return!0;if((3===n||2===n)&&33===t.length)return!0}}return!1},y.prototype.getPublicKey=function(){return f.checkState(this.isPublicKeyOut(),"Can't retreive PublicKey from a non-PK output"),this.chunks[0].buf},y.prototype.getPublicKeyHash=function(){return f.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf},y.prototype.isPublicKeyOut=function(){if(2===this.chunks.length&&this.chunks[0].buf&&this.chunks[0].buf.length&&this.chunks[1].opcodenum===a.OP_CHECKSIG){var e=this.chunks[0].buf,t=e[0],n=!1;if((4!==t&&6!==t&&7!==t||65!==e.length)&&(3!==t&&2!==t||33!==e.length)||(n=!0),n)return u.isValid(e)}return!1},y.prototype.isPublicKeyIn=function(){if(1===this.chunks.length){var e=this.chunks[0].buf;if(e&&e.length&&48===e[0])return!0}return!1},y.prototype.isScriptHashOut=function(){var e=this.toBuffer();return 23===e.length&&e[0]===a.OP_HASH160&&20===e[1]&&e[e.length-1]===a.OP_EQUAL},y.prototype.isScriptHashIn=function(){if(this.chunks.length<=1)return!1;var e=this.chunks[this.chunks.length-1],t=e.buf,n;if(!t)return!1;try{n=y.fromBuffer(t)}catch(e){if(e instanceof p.Script.InvalidBuffer)return!1;throw e}var r=n.classify();return r!==y.types.UNKNOWN},y.prototype.isMultisigOut=function(){return this.chunks.length>3&&a.isSmallIntOp(this.chunks[0].opcodenum)&&this.chunks.slice(1,this.chunks.length-2).every(function(e){return e.buf&&m.isBuffer(e.buf)})&&a.isSmallIntOp(this.chunks[this.chunks.length-2].opcodenum)&&this.chunks[this.chunks.length-1].opcodenum===a.OP_CHECKMULTISIG},y.prototype.isMultisigIn=function(){return this.chunks.length>=2&&0===this.chunks[0].opcodenum&&this.chunks.slice(1,this.chunks.length).every(function(e){return e.buf&&m.isBuffer(e.buf)&&l.isTxDER(e.buf)})},y.prototype.isDataOut=function(){return this.chunks.length>=1&&this.chunks[0].opcodenum===a.OP_RETURN&&(1===this.chunks.length||2===this.chunks.length&&this.chunks[1].buf&&this.chunks[1].buf.length<=y.OP_RETURN_STANDARD_SIZE&&this.chunks[1].length===this.chunks.len)},y.prototype.getData=function(){if(this.isDataOut()||this.isScriptHashOut())return h.isUndefined(this.chunks[1])?new t(0):new t(this.chunks[1].buf);if(this.isPublicKeyHashOut())return new t(this.chunks[2].buf);throw new Error("Unrecognized script type to get data from")},y.prototype.isPushOnly=function(){return h.every(this.chunks,function(e){return e.opcodenum<=a.OP_16})},y.types={},y.types.UNKNOWN="Unknown",y.types.PUBKEY_OUT="Pay to public key",y.types.PUBKEY_IN="Spend from public key",y.types.PUBKEYHASH_OUT="Pay to public key hash",y.types.PUBKEYHASH_IN="Spend from public key hash",y.types.SCRIPTHASH_OUT="Pay to script hash",y.types.SCRIPTHASH_IN="Spend from script hash",y.types.MULTISIG_OUT="Pay to multisig",y.types.MULTISIG_IN="Spend from multisig",y.types.DATA_OUT="Data push",y.OP_RETURN_STANDARD_SIZE=80,y.prototype.classify=function(){if(this._isInput)return this.classifyInput();if(this._isOutput)return this.classifyOutput();var e=this.classifyOutput();return e!=y.types.UNKNOWN?e:this.classifyInput()},y.outputIdentifiers={},y.outputIdentifiers.PUBKEY_OUT=y.prototype.isPublicKeyOut,y.outputIdentifiers.PUBKEYHASH_OUT=y.prototype.isPublicKeyHashOut,y.outputIdentifiers.MULTISIG_OUT=y.prototype.isMultisigOut,y.outputIdentifiers.SCRIPTHASH_OUT=y.prototype.isScriptHashOut,y.outputIdentifiers.DATA_OUT=y.prototype.isDataOut,y.prototype.classifyOutput=function(){for(var e in y.outputIdentifiers)if(y.outputIdentifiers[e].bind(this)())return y.types[e];return y.types.UNKNOWN},y.inputIdentifiers={},y.inputIdentifiers.PUBKEY_IN=y.prototype.isPublicKeyIn,y.inputIdentifiers.PUBKEYHASH_IN=y.prototype.isPublicKeyHashIn,y.inputIdentifiers.MULTISIG_IN=y.prototype.isMultisigIn,y.inputIdentifiers.SCRIPTHASH_IN=y.prototype.isScriptHashIn,y.prototype.classifyInput=function(){for(var e in y.inputIdentifiers)if(y.inputIdentifiers[e].bind(this)())return y.types[e];return y.types.UNKNOWN},y.prototype.isStandard=function(){return this.classify()!==y.types.UNKNOWN},y.prototype.prepend=function(e){return this._addByType(e,!0),this},y.prototype.equals=function(e){if(f.checkState(e instanceof y,"Must provide another script"),this.chunks.length!==e.chunks.length)return!1;var t;for(t=0;t=0&&r=1&&n[0]<=16?r===a.OP_1+(n[0]-1):1===n.length&&129===n[0]?r===a.OP_1NEGATE:n.length<=75?r===n.length:n.length<=255?r===a.OP_PUSHDATA1:!(n.length<=65535)||r===a.OP_PUSHDATA2)},y.prototype._decodeOP_N=function(e){if(e===a.OP_0)return 0;if(e>=a.OP_1&&e<=a.OP_16)return e-(a.OP_1-1);throw new Error("Invalid opcode: "+JSON.stringify(e))},y.prototype.getSignatureOperationsCount=function(e){e=!!h.isUndefined(e)||e;var t=this,n=0,r=a.OP_INVALIDOPCODE;return h.each(t.chunks,function i(o){var s=o.opcodenum;s==a.OP_CHECKSIG||s==a.OP_CHECKSIGVERIFY?n++:s!=a.OP_CHECKMULTISIG&&s!=a.OP_CHECKMULTISIGVERIFY||(e&&r>=a.OP_1&&r<=a.OP_16?n+=t._decodeOP_N(r):n+=20),r=s}),n},e.exports=y}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(17),i=n(25),o=n(41),s=n(86),a=n(129),u=n(361);function l(e){if(!(this instanceof l))return new l(e);i.checkArgument(r.isObject(e),"Must provide an object from where to extract data");var t=e.address?new a(e.address):void 0,n=e.txid?e.txid:e.txId;if(!n||!o.isHexaString(n)||n.length>64)throw new Error("Invalid TXID in object",e);var c=r.isUndefined(e.vout)?e.outputIndex:e.vout;if(!r.isNumber(c))throw new Error("Invalid outputIndex, received "+c);i.checkArgument(!r.isUndefined(e.scriptPubKey)||!r.isUndefined(e.script),"Must provide the scriptPubKey for that output!");var f=new s(e.scriptPubKey||e.script);i.checkArgument(!r.isUndefined(e.amount)||!r.isUndefined(e.satoshis),"Must provide an amount for the output");var h=r.isUndefined(e.amount)?e.satoshis:new u.fromBTC(e.amount).toSatoshis();i.checkArgument(r.isNumber(h),"Amount must be a number"),o.defineImmutable(this,{address:t,txId:n,outputIndex:c,script:f,satoshis:h})}l.prototype.inspect=function(){return""},l.prototype.toString=function(){return this.txId+":"+this.outputIndex},l.fromObject=function(e){return new l(e)},l.prototype.toObject=l.prototype.toJSON=function e(){return{address:this.address?this.address.toString():void 0,txid:this.txId,vout:this.outputIndex,scriptPubKey:this.script.toBuffer().toString("hex"),amount:u.fromSatoshis(this.satoshis).toBTC()}},e.exports=l},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(277),o=n(30),s=n(109),a=n(80),u=n(60),l=n(41),c=n(275),f=n(25);function h(e){if(!(this instanceof h))return new h(e);var t={};if(o.isBuffer(e))t=h._fromBufferReader(s(e));else{if(!r.isObject(e))throw new TypeError("Unrecognized argument for MerkleBlock");var n;n=e.header instanceof i?e.header:i.fromObject(e.header),t={header:n,numTransactions:e.numTransactions,hashes:e.hashes,flags:e.flags}}return r.extend(this,t),this._flagBitsUsed=0,this._hashesUsed=0,this}h.fromBuffer=function e(t){return h.fromBufferReader(s(t))},h.fromBufferReader=function e(t){return new h(h._fromBufferReader(t))},h.prototype.toBuffer=function e(){return this.toBufferWriter().concat()},h.prototype.toBufferWriter=function e(n){n||(n=new a),n.write(this.header.toBuffer()),n.writeUInt32LE(this.numTransactions),n.writeVarintNum(this.hashes.length);for(var r=0;rthis.numTransactions)return!1;if(8*this.flags.length8*this.flags.length)return null;var o=this.flags[i.flagBitsUsed>>3]>>>(7&i.flagBitsUsed++)&1;if(0!==n&&o){var s=this._traverseMerkleTree(n-1,2*r,i),a=s;return 2*r+1=this.hashes.length)return null;var l=this.hashes[i.hashesUsed++];return 0===n&&o&&i.txs.push(l),new t(l,"hex")},h.prototype._calcTreeWidth=function e(t){return this.numTransactions+(1<>t},h.prototype._calcTreeHeight=function e(){for(var t=0;this._calcTreeWidth(t)>1;)t++;return t},h.prototype.hasTransaction=function e(n){f.checkArgument(!r.isUndefined(n),"tx cannot be undefined"),f.checkArgument(n instanceof c||"string"==typeof n,'Invalid tx given, tx must be a "string" or "Transaction"');var i=n;n instanceof c&&(i=o.reverse(new t(n.id,"hex")).toString("hex"));var s=[],a=this._calcTreeHeight();return this._traverseMerkleTree(a,0,{txs:s}),-1!==s.indexOf(i)},h._fromBufferReader=function e(t){f.checkState(!t.finished(),"No merkleblock data received");var n={};n.header=i.fromBufferReader(t),n.numTransactions=t.readUInt32LE();var r=t.readVarintNum();n.hashes=[];for(var o=0;o=0&&e=S.Hardened||t,e64)throw new y.InvalidEntropyArgument.TooMuchEntropy(e);var r=c.sha512hmac(e,new i.Buffer("Bitcoin seed"));return new S({network:f.get(n)||f.defaultNetwork,depth:0,parentFingerPrint:0,childIndex:0,privateKey:r.slice(0,32),chainCode:r.slice(32,64)})},S.prototype._calcHDPublicKey=function(){if(!this._hdPublicKey){var e=n(604);this._hdPublicKey=new e(this)}},S.prototype._buildFromBuffers=function(e){S._validateBufferArguments(e),v.defineImmutable(this,{_buffers:e});var n=[e.version,e.depth,e.parentFingerPrint,e.childIndex,e.chainCode,b.emptyBuffer(1),e.privateKey],r=i.Buffer.concat(n);if(e.checksum&&e.checksum.length){if(e.checksum.toString()!==l.checksum(r).toString())throw new g.InvalidB58Checksum(r)}else e.checksum=l.checksum(r);var o=f.get(b.integerFromBuffer(e.version)),s;s=l.encode(i.Buffer.concat(n)),e.xprivkey=new t(s);var u=new d(a.fromBuffer(e.privateKey),o),h=u.toPublicKey(),p=S.ParentFingerPrintSize,m=c.sha256ripemd160(h.toBuffer()).slice(0,p);return v.defineImmutable(this,{xprivkey:s,network:o,depth:b.integerFromSingleByteBuffer(e.depth),privateKey:u,publicKey:h,fingerPrint:m}),this._hdPublicKey=null,Object.defineProperty(this,"hdPublicKey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey}}),Object.defineProperty(this,"xpubkey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey.xpubkey}}),this},S._validateBufferArguments=function(e){var t=function(t,n){var i=e[t];r(b.isBuffer(i),t+" argument is not a buffer"),r(i.length===n,t+" has not the expected size: found "+i.length+", expected "+n)};t("version",S.VersionSize),t("depth",S.DepthSize),t("parentFingerPrint",S.ParentFingerPrintSize),t("childIndex",S.ChildIndexSize),t("chainCode",S.ChainCodeSize),t("privateKey",S.PrivateKeySize),e.checksum&&e.checksum.length&&t("checksum",S.CheckSumSize)},S.prototype.toString=function(){return this.xprivkey},S.prototype.inspect=function(){return""},S.prototype.toObject=S.prototype.toJSON=function e(){return{network:f.get(b.integerFromBuffer(this._buffers.version),"xprivkey").name,depth:b.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:b.integerFromBuffer(this.fingerPrint),parentFingerPrint:b.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:b.integerFromBuffer(this._buffers.childIndex),chainCode:b.bufferToHex(this._buffers.chainCode),privateKey:this.privateKey.toBuffer().toString("hex"),checksum:b.integerFromBuffer(this._buffers.checksum),xprivkey:this.xprivkey}},S.fromBuffer=function(e){return new S(e.toString())},S.prototype.toBuffer=function(){return b.copy(this._buffers.xprivkey)},S.DefaultDepth=0,S.DefaultFingerprint=0,S.DefaultChildIndex=0,S.Hardened=2147483648,S.MaxIndex=2*S.Hardened,S.RootElementAlias=["m","M","m'","M'"],S.VersionSize=4,S.DepthSize=1,S.ParentFingerPrintSize=4,S.ChildIndexSize=4,S.ChainCodeSize=32,S.PrivateKeySize=32,S.CheckSumSize=4,S.DataLength=78,S.SerializedByteSize=82,S.VersionStart=0,S.VersionEnd=S.VersionStart+S.VersionSize,S.DepthStart=S.VersionEnd,S.DepthEnd=S.DepthStart+S.DepthSize,S.ParentFingerPrintStart=S.DepthEnd,S.ParentFingerPrintEnd=S.ParentFingerPrintStart+S.ParentFingerPrintSize,S.ChildIndexStart=S.ParentFingerPrintEnd,S.ChildIndexEnd=S.ChildIndexStart+S.ChildIndexSize,S.ChainCodeStart=S.ChildIndexEnd,S.ChainCodeEnd=S.ChainCodeStart+S.ChainCodeSize,S.PrivateKeyStart=S.ChainCodeEnd+1,S.PrivateKeyEnd=S.PrivateKeyStart+S.PrivateKeySize,S.ChecksumStart=S.PrivateKeyEnd,S.ChecksumEnd=S.ChecksumStart+S.CheckSumSize,r(S.ChecksumEnd===S.SerializedByteSize),e.exports=S}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(25),o=n(49),s=n(274),a=n(196),u=n(60),l=n(603),c=n(362),f=n(128),h=n(152),p=n(96),d=n(84),m=d,g=d.HDPublicKey,y=n(18),b=n(41),v=n(30);function w(e){if(e instanceof w)return e;if(!(this instanceof w))return new w(e);if(e){if(r.isString(e)||v.isBuffer(e)){var t=w.getSerializedError(e);if(t){if(v.isBuffer(e)&&!w.getSerializedError(e.toString()))return this._buildFromSerialized(e.toString());if(t instanceof g.ArgumentIsPrivateExtended)return new l(e).hdPublicKey;throw t}return this._buildFromSerialized(e)}if(r.isObject(e))return e instanceof l?this._buildFromPrivate(e):this._buildFromObject(e);throw new g.UnrecognizedArgument(e)}throw new g.MustSupplyArgument}w.isValidPath=function(e){if(r.isString(e)){var t=l._getDerivationIndexes(e);return null!==t&&r.all(t,w.isValidPath)}return!!r.isNumber(e)&&(e>=0&&e=w.Hardened||t)throw new g.InvalidIndexCantDeriveHardened;if(e<0)throw new g.InvalidPath(e);var n=c.get(this.xpubkey,e,!1);if(n)return n;var r=v.integerAsBuffer(e),i=v.concat([this.publicKey.toBuffer(),r]),s=u.sha512hmac(i,this._buffers.chainCode),a=o.fromBuffer(s.slice(0,32),{size:32}),l=s.slice(32,64),f=p.fromPoint(h.getG().mul(a).add(this.publicKey.point)),d=new w({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:e,chainCode:l,publicKey:f});return c.set(this.xpubkey,e,!1,d),d},w.prototype._deriveFromString=function(e){if(r.contains(e,"'"))throw new g.InvalidIndexCantDeriveHardened;if(!w.isValidPath(e))throw new g.InvalidPath(e);var t=l._getDerivationIndexes(e),n=t.reduce(function(e,t){return e._deriveWithNumber(t)},this);return n},w.isValidSerialized=function(e,t){return r.isNull(w.getSerializedError(e,t))},w.getSerializedError=function(e,t){if(!r.isString(e)&&!v.isBuffer(e))return new g.UnrecognizedArgument("expected buffer or string");if(!s.validCharacters(e))return new m.InvalidB58Char("(unknown)",e);try{e=a.decode(e)}catch(t){return new m.InvalidB58Checksum(e)}if(e.length!==w.DataSize)return new g.InvalidLength(e);if(!r.isUndefined(t)){var n=w._validateNetwork(e,t);if(n)return n}var i=v.integerFromBuffer(e.slice(0,4));return i===f.livenet.xprivkey||i===f.testnet.xprivkey?new g.ArgumentIsPrivateExtended:null},w._validateNetwork=function(e,t){var n=f.get(t);if(!n)return new m.InvalidNetworkArgument(t);var r=e.slice(w.VersionStart,w.VersionEnd);return v.integerFromBuffer(r)!==n.xpubkey?new m.InvalidNetwork(r):null},w.prototype._buildFromPrivate=function(e){var t=r.clone(e._buffers),n=h.getG().mul(o.fromBuffer(t.privateKey));return t.publicKey=h.pointToCompressed(n),t.version=v.integerAsBuffer(f.get(v.integerFromBuffer(t.version)).xpubkey),t.privateKey=void 0,t.checksum=void 0,t.xprivkey=void 0,this._buildFromBuffers(t)},w.prototype._buildFromObject=function(e){var t={version:e.network?v.integerAsBuffer(f.get(e.network).xpubkey):e.version,depth:r.isNumber(e.depth)?v.integerAsSingleByteBuffer(e.depth):e.depth,parentFingerPrint:r.isNumber(e.parentFingerPrint)?v.integerAsBuffer(e.parentFingerPrint):e.parentFingerPrint,childIndex:r.isNumber(e.childIndex)?v.integerAsBuffer(e.childIndex):e.childIndex,chainCode:r.isString(e.chainCode)?v.hexToBuffer(e.chainCode):e.chainCode,publicKey:r.isString(e.publicKey)?v.hexToBuffer(e.publicKey):v.isBuffer(e.publicKey)?e.publicKey:e.publicKey.toBuffer(),checksum:r.isNumber(e.checksum)?v.integerAsBuffer(e.checksum):e.checksum};return this._buildFromBuffers(t)},w.prototype._buildFromSerialized=function(e){var t=a.decode(e),n={version:t.slice(w.VersionStart,w.VersionEnd),depth:t.slice(w.DepthStart,w.DepthEnd),parentFingerPrint:t.slice(w.ParentFingerPrintStart,w.ParentFingerPrintEnd),childIndex:t.slice(w.ChildIndexStart,w.ChildIndexEnd),chainCode:t.slice(w.ChainCodeStart,w.ChainCodeEnd),publicKey:t.slice(w.PublicKeyStart,w.PublicKeyEnd),checksum:t.slice(w.ChecksumStart,w.ChecksumEnd),xpubkey:e};return this._buildFromBuffers(n)},w.prototype._buildFromBuffers=function(e){w._validateBufferArguments(e),b.defineImmutable(this,{_buffers:e});var n=[e.version,e.depth,e.parentFingerPrint,e.childIndex,e.chainCode,e.publicKey],r=v.concat(n),i=a.checksum(r);if(e.checksum&&e.checksum.length){if(e.checksum.toString("hex")!==i.toString("hex"))throw new m.InvalidB58Checksum(r,i)}else e.checksum=i;var o=f.get(v.integerFromBuffer(e.version)),s;s=a.encode(v.concat(n)),e.xpubkey=new t(s);var l=new p(e.publicKey,{network:o}),c=w.ParentFingerPrintSize,h=u.sha256ripemd160(l.toBuffer()).slice(0,c);return b.defineImmutable(this,{xpubkey:s,network:o,depth:v.integerFromSingleByteBuffer(e.depth),publicKey:l,fingerPrint:h}),this},w._validateBufferArguments=function(e){var t=function(t,n){var r=e[t];y(v.isBuffer(r),t+" argument is not a buffer, it's "+typeof r),y(r.length===n,t+" has not the expected size: found "+r.length+", expected "+n)};t("version",w.VersionSize),t("depth",w.DepthSize),t("parentFingerPrint",w.ParentFingerPrintSize),t("childIndex",w.ChildIndexSize),t("chainCode",w.ChainCodeSize),t("publicKey",w.PublicKeySize),e.checksum&&e.checksum.length&&t("checksum",w.CheckSumSize)},w.fromString=function(e){return i.checkArgument(r.isString(e),"No valid string was provided"),new w(e)},w.fromObject=function(e){return i.checkArgument(r.isObject(e),"No valid argument was provided"),new w(e)},w.prototype.toString=function(){return this.xpubkey},w.prototype.inspect=function(){return""},w.prototype.toObject=w.prototype.toJSON=function e(){return{network:f.get(v.integerFromBuffer(this._buffers.version)).name,depth:v.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:v.integerFromBuffer(this.fingerPrint),parentFingerPrint:v.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:v.integerFromBuffer(this._buffers.childIndex),chainCode:v.bufferToHex(this._buffers.chainCode),publicKey:this.publicKey.toString(),checksum:v.integerFromBuffer(this._buffers.checksum),xpubkey:this.xpubkey}},w.fromBuffer=function(e){return new w(e)},w.prototype.toBuffer=function(){return v.copy(this._buffers.xpubkey)},w.Hardened=2147483648,w.RootElementAlias=["m","M"],w.VersionSize=4,w.DepthSize=1,w.ParentFingerPrintSize=4,w.ChildIndexSize=4,w.ChainCodeSize=32,w.PublicKeySize=33,w.CheckSumSize=4,w.DataSize=78,w.SerializedByteSize=82,w.VersionStart=0,w.VersionEnd=w.VersionStart+w.VersionSize,w.DepthStart=w.VersionEnd,w.DepthEnd=w.DepthStart+w.DepthSize,w.ParentFingerPrintStart=w.DepthEnd,w.ParentFingerPrintEnd=w.ParentFingerPrintStart+w.ParentFingerPrintSize,w.ChildIndexStart=w.ParentFingerPrintEnd,w.ChildIndexEnd=w.ChildIndexStart+w.ChildIndexSize,w.ChainCodeStart=w.ChildIndexEnd,w.ChainCodeEnd=w.ChainCodeStart+w.ChainCodeSize,w.PublicKeyStart=w.ChainCodeEnd,w.PublicKeyEnd=w.PublicKeyStart+w.PublicKeySize,w.ChecksumStart=w.PublicKeyEnd,w.ChecksumEnd=w.ChecksumStart+w.CheckSumSize,y(w.PublicKeyEnd===w.DataSize),y(w.ChecksumEnd===w.SerializedByteSize),e.exports=w}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(3),i=n(200),o=n(28),s=n(150),a=n(338),u=n(188).isSource,l=n(153),c=n(201);e.exports=(e=>{const n=c(e,"add"),f=r((e,r,c)=>{"function"==typeof r&&(c=r,r=null);const f=o(c);r||(r={}),r.converter=l;const h=e=>t.isBuffer(e)||s.readable(e)||u(e),p=e=>"object"==typeof e&&(e.content?h(e.content):Boolean(e.path)&&a(e.path)),d=e=>h(e)||p(e),m=d(e)||Array.isArray(e)&&e.every(d);if(!m)return f(new Error("invalid input: expected buffer, readable stream, pull stream, object or array of objects"));const g=[].concat(e),y=n({qs:r}),b=i(e=>f(null,e));y.once("error",f),y.pipe(b),g.forEach(e=>y.write(e)),y.end()});return function(){const e=Array.from(arguments);return 1===e.length&&u(e[0])&&e.push({}),f.apply(null,e)}})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(1471),i=n(203);e.exports=(e=>0===e.indexOf("https")?i.request:r.request)},function(e,t,n){(function(e){var n;function r(){if(void 0!==n)return n;if(e.XMLHttpRequest){n=new e.XMLHttpRequest;try{n.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){n=null}}else n=null;return n}function i(e){var t=r();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}function o(e){return"function"==typeof e}t.fetch=o(e.fetch)&&o(e.ReadableStream),t.writableStream=o(e.WritableStream),t.abortController=o(e.AbortController),t.arraybuffer=t.fetch||i("arraybuffer"),t.msstream=!t.fetch&&i("ms-stream"),t.mozchunkedarraybuffer=!t.fetch&&i("moz-chunked-arraybuffer"),t.overrideMimeType=t.fetch||!!r()&&o(r().overrideMimeType),n=null}).call(this,n(8))},function(e,t,n){(function(e,r,i){var o=n(607),s=n(1),a=n(20),u=t.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},l=t.IncomingMessage=function(t,n,s,u){var l=this;if(a.Readable.call(l),l._mode=s,l.headers={},l.rawHeaders=[],l.trailers={},l.rawTrailers=[],l.on("end",function(){e.nextTick(function(){l.emit("close")})}),"fetch"===s){if(l._fetchResponse=n,l.url=n.url,l.statusCode=n.status,l.statusMessage=n.statusText,n.headers.forEach(function(e,t){l.headers[t.toLowerCase()]=e,l.rawHeaders.push(t,e)}),o.writableStream){var c=new WritableStream({write:function(e){return new Promise(function(t,n){l._destroyed?n():l.push(r.from(e))?t():l._resumeFetch=t})},close:function(){i.clearTimeout(u),l._destroyed||l.push(null)},abort:function(e){l._destroyed||l.emit("error",e)}});try{return void n.body.pipeTo(c).catch(function(e){i.clearTimeout(u),l._destroyed||l.emit("error",e)})}catch(e){}}var f=n.body.getReader();function h(){f.read().then(function(e){if(!l._destroyed){if(e.done)return i.clearTimeout(u),void l.push(null);l.push(r.from(e.value)),h()}}).catch(function(e){i.clearTimeout(u),l._destroyed||l.emit("error",e)})}h()}else{l._xhr=t,l._pos=0,l.url=t.responseURL,l.statusCode=t.status,l.statusMessage=t.statusText;var p=t.getAllResponseHeaders().split(/\r?\n/);if(p.forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var n=t[1].toLowerCase();"set-cookie"===n?(void 0===l.headers[n]&&(l.headers[n]=[]),l.headers[n].push(t[2])):void 0!==l.headers[n]?l.headers[n]+=", "+t[2]:l.headers[n]=t[2],l.rawHeaders.push(t[1],t[2])}}),l._charset="x-user-defined",!o.overrideMimeType){var d=l.rawHeaders["mime-type"];if(d){var m=d.match(/;\s*charset=([^;])(;|$)/);m&&(l._charset=m[1].toLowerCase())}l._charset||(l._charset="utf-8")}}};s(l,a.Readable),l.prototype._read=function(){var e=this,t=this._resumeFetch;t&&(this._resumeFetch=null,t())},l.prototype._onXHRProgress=function(){var e=this,t=e._xhr,n=null;switch(e._mode){case"text":if(n=t.responseText,n.length>e._pos){var o=n.substr(e._pos);if("x-user-defined"===e._charset){for(var s=r.alloc(o.length),a=0;ae._pos&&(e.push(r.from(new Uint8Array(l.result.slice(e._pos)))),e._pos=l.result.byteLength)},l.onload=function(){e.push(null)},l.readAsArrayBuffer(n)}e._xhr.readyState===u.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(this,n(2),n(0).Buffer,n(8))},function(e,t){e.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},function(e,t,n){(function(e){t.fetch=a(e.fetch)&&a(e.ReadableStream),t.writableStream=a(e.WritableStream),t.abortController=a(e.AbortController),t.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),t.blobConstructor=!0}catch(e){}var n;function r(){if(void 0!==n)return n;if(e.XMLHttpRequest){n=new e.XMLHttpRequest;try{n.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){n=null}}else n=null;return n}function i(e){var t=r();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}var o=void 0!==e.ArrayBuffer,s=o&&a(e.ArrayBuffer.prototype.slice);function a(e){return"function"==typeof e}t.arraybuffer=t.fetch||o&&i("arraybuffer"),t.msstream=!t.fetch&&s&&i("ms-stream"),t.mozchunkedarraybuffer=!t.fetch&&o&&i("moz-chunked-arraybuffer"),t.overrideMimeType=t.fetch||!!r()&&a(r().overrideMimeType),t.vbArray=a(e.VBArray),n=null}).call(this,n(8))},function(e,t,n){(function(e,r,i){var o=n(610),s=n(1),a=n(612),u=t.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},l=t.IncomingMessage=function(t,n,s,u){var l=this;if(a.Readable.call(l),l._mode=s,l.headers={},l.rawHeaders=[],l.trailers={},l.rawTrailers=[],l.on("end",function(){e.nextTick(function(){l.emit("close")})}),"fetch"===s){if(l._fetchResponse=n,l.url=n.url,l.statusCode=n.status,l.statusMessage=n.statusText,n.headers.forEach(function(e,t){l.headers[t.toLowerCase()]=e,l.rawHeaders.push(t,e)}),o.writableStream){var c=new WritableStream({write:function(e){return new Promise(function(t,n){l._destroyed?n():l.push(new r(e))?t():l._resumeFetch=t})},close:function(){i.clearTimeout(u),l._destroyed||l.push(null)},abort:function(e){l._destroyed||l.emit("error",e)}});try{return void n.body.pipeTo(c).catch(function(e){i.clearTimeout(u),l._destroyed||l.emit("error",e)})}catch(e){}}var f=n.body.getReader();function h(){f.read().then(function(e){if(!l._destroyed){if(e.done)return i.clearTimeout(u),void l.push(null);l.push(new r(e.value)),h()}}).catch(function(e){i.clearTimeout(u),l._destroyed||l.emit("error",e)})}h()}else{l._xhr=t,l._pos=0,l.url=t.responseURL,l.statusCode=t.status,l.statusMessage=t.statusText;var p=t.getAllResponseHeaders().split(/\r?\n/);if(p.forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var n=t[1].toLowerCase();"set-cookie"===n?(void 0===l.headers[n]&&(l.headers[n]=[]),l.headers[n].push(t[2])):void 0!==l.headers[n]?l.headers[n]+=", "+t[2]:l.headers[n]=t[2],l.rawHeaders.push(t[1],t[2])}}),l._charset="x-user-defined",!o.overrideMimeType){var d=l.rawHeaders["mime-type"];if(d){var m=d.match(/;\s*charset=([^;])(;|$)/);m&&(l._charset=m[1].toLowerCase())}l._charset||(l._charset="utf-8")}}};s(l,a.Readable),l.prototype._read=function(){var e=this,t=this._resumeFetch;t&&(this._resumeFetch=null,t())},l.prototype._onXHRProgress=function(){var e=this,t=e._xhr,n=null;switch(e._mode){case"text:vbarray":if(t.readyState!==u.DONE)break;try{n=new i.VBArray(t.responseBody).toArray()}catch(e){}if(null!==n){e.push(new r(n));break}case"text":try{n=t.responseText}catch(t){e._mode="text:vbarray";break}if(n.length>e._pos){var o=n.substr(e._pos);if("x-user-defined"===e._charset){for(var s=new r(o.length),a=0;ae._pos&&(e.push(new r(new Uint8Array(l.result.slice(e._pos)))),e._pos=l.result.byteLength)},l.onload=function(){e.push(null)},l.readAsArrayBuffer(n)}e._xhr.readyState===u.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(this,n(2),n(0).Buffer,n(8))},function(e,t,n){t=e.exports=n(613),t.Stream=t,t.Readable=t,t.Writable=n(616),t.Duplex=n(155),t.Transform=n(617),t.PassThrough=n(1477)},function(e,t,n){"use strict";(function(t,r){var i=n(10);e.exports=S;var o=n(51),s;S.ReadableState=k;var a=n(6).EventEmitter,u=function(e,t){return e.listeners(t).length},l=n(614),c=n(4).Buffer,f=t.Uint8Array||function(){};function h(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof f}var d=n(7);d.inherits=n(1);var m=n(1474),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1475),b=n(615),v;d.inherits(S,l);var w=["error","close","destroy","pause","resume"];function _(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function k(e,t){s=s||n(155),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=n(16).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function S(e){if(s=s||n(155),!(this instanceof S))return new S(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),l.call(this)}function E(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,O(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:w;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),w(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),w()}function v(){g("onfinish"),e.removeListener("close",b),w()}function w(){g("unpipe"),n.unpipe(e)}return n.on("data",m),_(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;w.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(52)},f=n(614),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(615),y;function b(){}function v(e,t){u=u||n(155),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function w(e){if(u=u||n(155),!(y.call(w,this)||this instanceof u))return new w(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function _(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},w.prototype._writev=null,w.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=g.destroy,w.prototype._undestroy=g.undestroy,w.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(155),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:w;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),w(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),w()}function v(){g("onfinish"),e.removeListener("close",b),w()}function w(){g("unpipe"),n.unpipe(e)}return n.on("data",m),_(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;w.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(52)},f=n(620),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(621),y;function b(){}function v(e,t){u=u||n(156),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function w(e){if(u=u||n(156),!(y.call(w,this)||this instanceof u))return new w(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function _(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},w.prototype._writev=null,w.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=g.destroy,w.prototype._undestroy=g.undestroy,w.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(156),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length=t?t:e>=0?e:(e+=t,e>=0?e:0))},f=function(e){switch(e){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null},h=function(e){switch(e){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0},p=function(e,t,n,r){for(;nt?s.slice(0,t)+" ":o.slice(0,t-e.length)+e+" "};function g(e){var t;if(128===e[0])t=!0;else{if(255!==e[0])return null;t=!1}for(var n=!1,r=[],i=e.length-1;i>0;i--){var o=e[i];t?r.push(o):n&&0===o?r.push(0):n?(n=!1,r.push(256-o)):r.push(255-o)}var s=0,a=r.length;for(i=0;i=Math.pow(10,r)&&r++,n+r+t};t.decodeLongPath=function(e,t){return b(e,0,e.length,t)},t.encodePax=function(e){var t="";e.name&&(t+=v(" path="+e.name+"\n")),e.linkname&&(t+=v(" linkpath="+e.linkname+"\n"));var n=e.pax;if(n)for(var i in n)t+=v(" "+i+"="+n[i]+"\n");return r(t)},t.decodePax=function(e){for(var t={};e.length;){for(var n=0;n100;){var s=r.indexOf("/");if(-1===s)return null;o+=o?"/"+r.slice(0,s):r.slice(0,s),r=r.slice(s+1)}return e.byteLength(r)>100||e.byteLength(o)>155?null:t.linkname&&e.byteLength(t.linkname)>100?null:(n.write(r),n.write(m(t.mode&l,6),100),n.write(m(t.uid,6),108),n.write(m(t.gid,6),116),n.write(m(t.size,11),124),n.write(m(t.mtime.getTime()/1e3|0,11),136),n[156]=a+h(t.type),t.linkname&&n.write(t.linkname,157),n.write(u,257),t.uname&&n.write(t.uname,265),t.gname&&n.write(t.gname,297),n.write(m(t.devmajor||0,6),329),n.write(m(t.devminor||0,6),337),o&&n.write(o,345),n.write(m(d(n),6),148),n)},t.decode=function(e,t){var n=0===e[156]?0:e[156]-a,r=b(e,0,100,t),i=y(e,100,8),o=y(e,108,8),s=y(e,116,8),u=y(e,124,12),l=y(e,136,12),c=f(n),h=0===e[157]?null:b(e,157,100,t),p=b(e,265,32),m=b(e,297,32),g=y(e,329,8),v=y(e,337,8);e[345]&&(r=b(e,345,155,t)+"/"+r),0===n&&r&&"/"===r[r.length-1]&&(n=5);var w=d(e);if(256===w)return null;if(w!==y(e,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");return{name:r,mode:i,uid:o,gid:s,size:u,mtime:new Date(1e3*l),type:c,linkname:h,uname:p,gname:m,devmajor:g,devminor:v}}}).call(this,n(0).Buffer)},function(e,t,n){(function(t){e.exports=i;var n=t.from&&t.from!==Uint8Array.from?t.from:r;function r(e,n){return new t(e,n)}function i(e,r){if(t.isBuffer(e))return e;if("string"==typeof e)return n(e,r);if(Array.isArray(e))return n(e);throw new Error("Input should be a buffer or a string")}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t,r){var i=n(10);e.exports=S;var o=n(51),s;S.ReadableState=k;var a=n(6).EventEmitter,u=function(e,t){return e.listeners(t).length},l=n(629),c=n(4).Buffer,f=t.Uint8Array||function(){};function h(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof f}var d=n(7);d.inherits=n(1);var m=n(1499),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1500),b=n(630),v;d.inherits(S,l);var w=["error","close","destroy","pause","resume"];function _(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function k(e,t){s=s||n(157),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=n(16).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function S(e){if(s=s||n(157),!(this instanceof S))return new S(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),l.call(this)}function E(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,O(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:w;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),w(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),w()}function v(){g("onfinish"),e.removeListener("close",b),w()}function w(){g("unpipe"),n.unpipe(e)}return n.on("data",m),_(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;w.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(52)},f=n(629),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(630),y;function b(){}function v(e,t){u=u||n(157),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function w(e){if(u=u||n(157),!(y.call(w,this)||this instanceof u))return new w(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function _(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},w.prototype._writev=null,w.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=g.destroy,w.prototype._undestroy=g.undestroy,w.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(157),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length({"api-path":"/api/v0/","user-agent":`/node-${r.name}/${r.version}/`,host:"localhost",port:"5001",protocol:"http"}))},function(e,t,n){"use strict";(function(r){const i=n(1511),o=n(365).encode,s=n(202),a=n(366),u=n(59),l=n(28),c=n(112),f=n(1520),h=n(606),p=n(5)("ipfs-http-client:request");function d(e,t){const n=new Error(`Server responded with ${e.statusCode}`);f(e,(e,r)=>{if(e)return t(e);r&&(n.code=r.Code,n.message=r.Message||r.toString(),n.type=r.Type),t(n)})}function m(e,t){return n=>{const r=Boolean(n.headers["x-stream-output"]),i=Boolean(n.headers["x-chunked-output"]),o=n.headers["content-type"]&&0===n.headers["content-type"].indexOf("application/json");if(n.req?p(n.req.method,`${n.req.getHeaders().host}${n.req.path}`,n.statusCode,n.statusMessage):p(n.url,n.statusCode,n.statusMessage),n.statusCode>=400||!n.statusCode)return d(n,t);if(r&&!e)return t(null,n);if(i&&o){const e=a.parse();return u(n,e),n.on("end",()=>{let t=n.trailers["x-stream-error"];if(t){try{t=JSON.parse(t)}catch(e){t={Message:t}}e.emit("error",new Error(t.Message))}}),t(null,e)}return o?f(n,t):c(n,t)}}function g(e,t,n){n=l(n),t.qs=t.qs||{},Array.isArray(t.path)&&(t.path=t.path.join("/")),t.args&&!Array.isArray(t.args)&&(t.args=[t.args]),t.args&&(t.qs.arg=t.args),t.progress&&(t.qs.progress=!0),t.qs.r&&(t.qs.recursive=t.qs.r,delete t.qs.r),t.qs["stream-channels"]=!0,t.stream&&(t.buffer=!1),delete t.qs.followSymlinks;const a="POST",u=Object.assign({},e.headers);if(s&&(u["User-Agent"]=e["user-agent"]),t.multipart){if(!t.multipartBoundary)return n(new Error("No multipartBoundary"));u["Content-Type"]=`multipart/form-data; boundary=${t.multipartBoundary}`}const c=i.stringify(t.qs,{arrayFormat:"repeat",encoder:e=>{if(r.isBuffer(e)){let t="";for(const n of e)if(n>=65&&n<=90||n>=97&&n<=122||n>=48&&n<=57||45===n||46===n||95===n||126===n)t+=String.fromCharCode(n);else{const e=n.toString(16),r=1===e.length?`0${e}`:e;t+=`%${r}`}return t}return o(e)}}),f={hostname:e.host,path:`${e["api-path"]}${t.path}?${c}`,port:e.port,method:"POST",headers:u,protocol:`${e.protocol}:`},p=h(e.protocol)(f,m(t.buffer,n));return p.on("error",e=>{n(e)}),t.stream||p.end(),p}t=e.exports=(e=>{const t=(t,n)=>"object"!=typeof t?n(new Error("no options were passed")):g(e,t,n);return t.andTransform=((e,n,r)=>t(e,(e,t)=>{if(e)return r(e);n(t,r)})),t})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=String.prototype.replace,i=/%20/g;e.exports={default:"RFC3986",formatters:{RFC1738:function(e){return r.call(e,i,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},function(e,t,n){(function(t){var r=n(1514).Transform,i=n(13).inherits,o=n(69);function s(e){r.call(this,e),this._destroyed=!1}function a(e,t,n){n(null,e)}function u(e){return function(t,n,r){return"function"==typeof t&&(r=n,n=t,t={}),"function"!=typeof n&&(n=a),"function"!=typeof r&&(r=null),e(t,n,r)}}i(s,r),s.prototype.destroy=function(e){if(!this._destroyed){this._destroyed=!0;var n=this;t.nextTick(function(){e&&n.emit("error",e),n.emit("close")})}},e.exports=u(function(e,t,n){var r=new s(e);return r._transform=t,n&&(r._flush=n),r}),e.exports.ctor=u(function(e,t,n){function r(t){if(!(this instanceof r))return new r(t);this.options=o(e,t),s.call(this,this.options)}return i(r,s),r.prototype._transform=t,n&&(r.prototype._flush=n),r}),e.exports.obj=u(function(e,t,n){var r=new s(o({objectMode:!0,highWaterMark:16},e));return r._transform=t,n&&(r._flush=n),r})}).call(this,n(2))},function(e,t,n){"use strict";(function(t,r){var i=n(10);e.exports=S;var o=n(51),s;S.ReadableState=k;var a=n(6).EventEmitter,u=function(e,t){return e.listeners(t).length},l=n(638),c=n(4).Buffer,f=t.Uint8Array||function(){};function h(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof f}var d=n(7);d.inherits=n(1);var m=n(1515),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1516),b=n(639),v;d.inherits(S,l);var w=["error","close","destroy","pause","resume"];function _(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function k(e,t){s=s||n(158),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=n(16).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function S(e){if(s=s||n(158),!(this instanceof S))return new S(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),l.call(this)}function E(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,O(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:w;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),w(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),w()}function v(){g("onfinish"),e.removeListener("close",b),w()}function w(){g("unpipe"),n.unpipe(e)}return n.on("data",m),_(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;w.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(52)},f=n(638),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(639),y;function b(){}function v(e,t){u=u||n(158),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function w(e){if(u=u||n(158),!(y.call(w,this)||this instanceof u))return new w(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function _(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},w.prototype._writev=null,w.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=g.destroy,w.prototype._undestroy=g.undestroy,w.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(158),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?r.splice(s,1/0,i):r.push(i),~n.indexOf(o)&&(o=t.call(this,i,o))}else n.push(o);return null==e?o:e.call(this,i,o)}}t=e.exports=n,t.getSerialize=r},function(e,t,n){"use strict";const r=n(21);e.exports=(e=>{const t=r(e);return{get:n(1523)(t),stat:n(1524)(t),put:n(1525)(t)}})},function(e,t,n){"use strict";e.exports=(e=>{const t=e.pop();let n={},r=[];return Array.isArray(e[e.length-1])||"object"!=typeof e[e.length-1]||(n=e.pop()),r=1===e.length&&Array.isArray(e[0])?e[0]:e,{callback:t,sources:r,opts:n}})},function(e,t,n){var r=n(246),i=n(1636),o=n(1637),s=n(1638),a=n(1639),u=n(1640);function l(e){var t=this.__data__=new r(e);this.size=t.size}l.prototype.clear=i,l.prototype.delete=o,l.prototype.get=s,l.prototype.has=a,l.prototype.set=u,e.exports=l},function(e,t,n){var r=n(1641),i=n(105);function o(e,t,n,s,a){return e===t||(null==e||null==t||!i(e)&&!i(t)?e!=e&&t!=t:r(e,t,n,s,o,a))}e.exports=o},function(e,t,n){var r=n(1642),i=n(1645),o=n(1646),s=1,a=2;function u(e,t,n,u,l,c){var f=n&s,h=e.length,p=t.length;if(h!=p&&!(f&&p>h))return!1;var d=c.get(e);if(d&&c.get(t))return d==t;var m=-1,g=!0,y=n&a?new r:void 0;for(c.set(e,t),c.set(t,e);++m({name:e.Name,type:e.Type,size:e.Size,hash:e.Hash});e.exports=(e=>(t,n)=>{n=n||{};const l=new r({objectMode:!0,transform(e,t,n){n(null,u(e))}}),c=new i({objectMode:!0});return e({path:"files/ls",args:t,qs:Object.assign({},n,{stream:!0})},(e,t)=>{if(e)return c.destroy(e);if(a(t)){const e=s.parse();o(t,e,l,c)}else{const e=t.Entries||[];e.forEach(e=>{c.write(u(e))}),c.end()}}),c})},function(e,t,n){(function(e,n){var r=200,i="__lodash_hash_undefined__",o=9007199254740991,s="[object Arguments]",a="[object Array]",u="[object Boolean]",l="[object Date]",c="[object Error]",f="[object Function]",h="[object GeneratorFunction]",p="[object Map]",d="[object Number]",m="[object Object]",g="[object Promise]",y="[object RegExp]",b="[object Set]",v="[object String]",w="[object Symbol]",_="[object WeakMap]",k="[object ArrayBuffer]",S="[object DataView]",E="[object Float32Array]",x="[object Float64Array]",C="[object Int8Array]",A="[object Int16Array]",I="[object Int32Array]",T="[object Uint8Array]",j="[object Uint8ClampedArray]",O="[object Uint16Array]",P="[object Uint32Array]",B=/[\\^$.*+?()[\]{}|]/g,R=/\w*$/,N=/^\[object .+?Constructor\]$/,M=/^(?:0|[1-9]\d*)$/,L={};L[s]=L[a]=L[k]=L[S]=L[u]=L[l]=L[E]=L[x]=L[C]=L[A]=L[I]=L[p]=L[d]=L[m]=L[y]=L[b]=L[v]=L[w]=L[T]=L[j]=L[O]=L[P]=!0,L[c]=L[f]=L[_]=!1;var F="object"==typeof e&&e&&e.Object===Object&&e,D="object"==typeof self&&self&&self.Object===Object&&self,U=F||D||Function("return this")(),z=t&&!t.nodeType&&t,q=z&&"object"==typeof n&&n&&!n.nodeType&&n,K=q&&q.exports===z;function H(e,t){return e.set(t[0],t[1]),e}function V(e,t){return e.add(t),e}function W(e,t){for(var n=-1,r=e?e.length:0;++n-1}function Ve(e,t){var n=this.__data__,r=st(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}function We(e){var t=-1,n=e?e.length:0;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=o}function $t(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Gt(e){return!!e&&"object"==typeof e}function Yt(e){return qt(e)?it(e):pt(e)}function Jt(){return[]}function Zt(){return!1}n.exports=Ft}).call(this,n(8),n(75)(e))},function(e,t,n){"use strict";e.exports="ipfs-pubsub-room/v2"},function(e,t,n){"use strict";(function(t){e.exports=(e=>{let n=e;return t.isBuffer(n)||(n=t.from(n)),n})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=(e=>e._libp2pNode||e.libp2p)},function(e,t,n){(function(t){e.exports=function(e,n){var r=[];e.on("data",function(e){r.push(e)}),e.once("end",function(){n&&n(null,t.concat(r)),n=null}),e.once("error",function(e){n&&n(e),n=null})}}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var r=n(1),i=n(1728).Transform,o=n(1733);function s(e,t){if(!(this instanceof s))return new s(e,t);i.call(this),t||(t={}),"object"==typeof e&&(t=e,e=t.size),this.size=e||512,t.nopad?this._zeroPadding=!1:this._zeroPadding=o(t.zeroPadding,!0),this._buffered=[],this._bufferedBytes=0}e.exports=s,r(s,i),s.prototype._transform=function(e,n,r){for(this._bufferedBytes+=e.length,this._buffered.push(e);this._bufferedBytes>=this.size;){var i=t.concat(this._buffered);this._bufferedBytes-=this.size,this.push(i.slice(0,this.size)),this._buffered=[i.slice(this.size,i.length)]}r()},s.prototype._flush=function(){if(this._bufferedBytes&&this._zeroPadding){var e=new t(this.size-this._bufferedBytes);e.fill(0),this._buffered.push(e),this.push(t.concat(this._buffered)),this._buffered=null}else this._bufferedBytes&&(this.push(t.concat(this._buffered)),this._buffered=null);this.push(null)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t,r){var i=n(10);e.exports=S;var o=n(51),s;S.ReadableState=k;var a=n(6).EventEmitter,u=function(e,t){return e.listeners(t).length},l=n(658),c=n(4).Buffer,f=t.Uint8Array||function(){};function h(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof f}var d=n(7);d.inherits=n(1);var m=n(1729),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1730),b=n(659),v;d.inherits(S,l);var w=["error","close","destroy","pause","resume"];function _(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function k(e,t){s=s||n(160),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=n(16).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function S(e){if(s=s||n(160),!(this instanceof S))return new S(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),l.call(this)}function E(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,O(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:w;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),w(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),w()}function v(){g("onfinish"),e.removeListener("close",b),w()}function w(){g("unpipe"),n.unpipe(e)}return n.on("data",m),_(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;w.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(52)},f=n(658),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(659),y;function b(){}function v(e,t){u=u||n(160),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function w(e){if(u=u||n(160),!(y.call(w,this)||this instanceof u))return new w(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function _(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},w.prototype._writev=null,w.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=g.destroy,w.prototype._undestroy=g.undestroy,w.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(160),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:w;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),w(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),w()}function v(){g("onfinish"),e.removeListener("close",b),w()}function w(){g("unpipe"),n.unpipe(e)}return n.on("data",m),_(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;w.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(52)},f=n(663),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(664),y;function b(){}function v(e,t){u=u||n(161),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function w(e){if(u=u||n(161),!(y.call(w,this)||this instanceof u))return new w(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function _(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},w.prototype._writev=null,w.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=g.destroy,w.prototype._undestroy=g.undestroy,w.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(161),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:w;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),w(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),w()}function v(){g("onfinish"),e.removeListener("close",b),w()}function w(){g("unpipe"),n.unpipe(e)}return n.on("data",m),_(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;w.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(52)},f=n(669),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(670),y;function b(){}function v(e,t){u=u||n(162),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function w(e){if(u=u||n(162),!(y.call(w,this)||this instanceof u))return new w(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function _(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},w.prototype._writev=null,w.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=g.destroy,w.prototype._undestroy=g.undestroy,w.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(162),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{t(null,n)}):g(e)?o(e,(e,n)=>{if(e)return t(new Error(`Error converting Blob: ${e.message}`));i(n)}):"function"==typeof a&&/^https?:/.test(e)?a.concat({url:e,timeout:3e4,headers:{"user-agent":"WebTorrent (https://webtorrent.io)"}},(e,n,r)=>{if(e)return t(new Error(`Error downloading torrent: ${e.message}`));i(r)}):"function"==typeof s.readFile&&"string"==typeof e?s.readFile(e,(e,n)=>{if(e)return t(new Error("Invalid torrent identifier"));i(n)}):r.nextTick(()=>{t(new Error("Invalid torrent identifier"))})}function d(e){t.isBuffer(e)&&(e=i.decode(e)),v(e.info,"info"),v(e.info["name.utf-8"]||e.info.name,"info.name"),v(e.info["piece length"],"info['piece length']"),v(e.info.pieces,"info.pieces"),e.info.files?e.info.files.forEach(e=>{v("number"==typeof e.length,"info.files[0].length"),v(e["path.utf-8"]||e.path,"info.files[0].path")}):v("number"==typeof e.info.length,"info.length");const n={info:e.info,infoBuffer:i.encode(e.info),name:(e.info["name.utf-8"]||e.info.name).toString(),announce:[]};n.infoHash=c.sync(n.infoBuffer),n.infoHashBuffer=t.from(n.infoHash,"hex"),void 0!==e.info.private&&(n.private=!!e.info.private),e["creation date"]&&(n.created=new Date(1e3*e["creation date"])),e["created by"]&&(n.createdBy=e["created by"].toString()),t.isBuffer(e.comment)&&(n.comment=e.comment.toString()),Array.isArray(e["announce-list"])&&e["announce-list"].length>0?e["announce-list"].forEach(e=>{e.forEach(e=>{n.announce.push(e.toString())})}):e.announce&&n.announce.push(e.announce.toString()),t.isBuffer(e["url-list"])&&(e["url-list"]=e["url-list"].length>0?[e["url-list"]]:[]),n.urlList=(e["url-list"]||[]).map(e=>e.toString()),f(n.announce),f(n.urlList);const r=e.info.files||[e.info];n.files=r.map((e,t)=>{const i=[].concat(n.name,e["path.utf-8"]||e.path||[]).map(e=>e.toString());return{path:l.join.apply(null,[l.sep].concat(i)).slice(1),name:i[i.length-1],length:e.length,offset:r.slice(0,t).reduce(y,0)}}),n.length=r.reduce(y,0);const o=n.files[n.files.length-1];return n.pieceLength=e.info["piece length"],n.lastPieceLength=(o.offset+o.length)%n.pieceLength||n.pieceLength,n.pieces=b(e.info.pieces),n}function m(e){const n={info:e.info};return n["announce-list"]=(e.announce||[]).map(e=>(n.announce||(n.announce=e),e=t.from(e,"utf8"),[e])),n["url-list"]=e.urlList||[],void 0!==e.private&&(n.private=Number(e.private)),e.created&&(n["creation date"]=e.created.getTime()/1e3|0),e.createdBy&&(n["created by"]=e.createdBy),e.comment&&(n.comment=e.comment),i.encode(n)}function g(e){return"undefined"!=typeof Blob&&e instanceof Blob}function y(e,t){return e+t.length}function b(e){const t=[];for(let n=0;n0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:w;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),w(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),w()}function v(){g("onfinish"),e.removeListener("close",b),w()}function w(){g("unpipe"),n.unpipe(e)}return n.on("data",m),_(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;w.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(52)},f=n(675),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(676),y;function b(){}function v(e,t){u=u||n(163),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function w(e){if(u=u||n(163),!(y.call(w,this)||this instanceof u))return new w(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function _(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},w.prototype._writev=null,w.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=g.destroy,w.prototype._undestroy=g.undestroy,w.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(163),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:w;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),w(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),w()}function v(){g("onfinish"),e.removeListener("close",b),w()}function w(){g("unpipe"),n.unpipe(e)}return n.on("data",m),_(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;w.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(52)},f=n(681),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(682),y;function b(){}function v(e,t){u=u||n(164),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function w(e){if(u=u||n(164),!(y.call(w,this)||this instanceof u))return new w(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function _(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},w.prototype._writev=null,w.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=g.destroy,w.prototype._undestroy=g.undestroy,w.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(164),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.lengththis._bufferDuration)&&this._cb){var t=this._cb;this._cb=null,t()}};var c=0;function f(e,t){var n=document.createElement("a");n.href=window.URL.createObjectURL(new window.Blob(e)),n.download=t,n.click()}l.prototype._getBufferDuration=function(){for(var e=this,t=this._sourceBuffer.buffered,n=this._elem.currentTime,r=-1,i=0;in)break;(r>=0||n<=s)&&(r=s)}var a=r-n;return a<0&&(a=0),a}},function(e,t,n){var r=n(687);e.exports=function e(t,n,i){if("function"==typeof n)return e(t,null,n);r(t,n,function(e,t){if(e)return i(e);var n=URL.createObjectURL(t);i(null,n)})}},function(e,t,n){var r=n(28);e.exports=function e(t,n,i){if("function"==typeof n)return e(t,null,n);i=r(i);var o=[];t.on("data",function(e){o.push(e)}).on("end",function(){var e=n?new Blob(o,{type:n}):new Blob(o);i(null,e)}).on("error",i)}},function(e,t,n){t=e.exports=n(689),t.Stream=t,t.Readable=t,t.Writable=n(692),t.Duplex=n(165),t.Transform=n(693),t.PassThrough=n(1812)},function(e,t,n){"use strict";(function(t,r){var i=n(10);e.exports=S;var o=n(51),s;S.ReadableState=k;var a=n(6).EventEmitter,u=function(e,t){return e.listeners(t).length},l=n(690),c=n(4).Buffer,f=t.Uint8Array||function(){};function h(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof f}var d=n(7);d.inherits=n(1);var m=n(1809),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1810),b=n(691),v;d.inherits(S,l);var w=["error","close","destroy","pause","resume"];function _(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function k(e,t){s=s||n(165),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=n(16).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function S(e){if(s=s||n(165),!(this instanceof S))return new S(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),l.call(this)}function E(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,O(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:w;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),w(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),w()}function v(){g("onfinish"),e.removeListener("close",b),w()}function w(){g("unpipe"),n.unpipe(e)}return n.on("data",m),_(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;w.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(52)},f=n(690),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(691),y;function b(){}function v(e,t){u=u||n(165),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function w(e){if(u=u||n(165),!(y.call(w,this)||this instanceof u))return new w(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function _(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},w.prototype._writev=null,w.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=g.destroy,w.prototype._undestroy=g.undestroy,w.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(165),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length=e.length||t<0)){var n=e.pop();if(t{this.keepAlive()},h))}setTimeout(e,t){this._debug("setTimeout ms=%d unref=%s",e,t),this._clearTimeout(),this._timeoutMs=e,this._timeoutUnref=!!t,this._updateTimeout()}destroy(){this.destroyed||(this.destroyed=!0,this._debug("destroy"),this.emit("close"),this.end())}end(...e){this._debug("end"),this._onUninterested(),this._onChoke(),super.end(...e)}use(e){const t=e.prototype.name;if(!t)throw new Error('Extension class requires a "name" property on the prototype');this._debug("use extension.name=%s",t);const n=this._nextExt,r=new e(this);function i(){}"function"!=typeof r.onHandshake&&(r.onHandshake=i),"function"!=typeof r.onExtendedHandshake&&(r.onExtendedHandshake=i),"function"!=typeof r.onMessage&&(r.onMessage=i),this.extendedMapping[n]=t,this._ext[t]=r,this[t]=r,this._nextExt+=1}keepAlive(){this._debug("keep-alive"),this._push(d)}handshake(e,n,r){let i,o;if("string"==typeof e?(e=e.toLowerCase(),i=t.from(e,"hex")):(i=e,e=i.toString("hex")),"string"==typeof n?o=t.from(n,"hex"):(o=n,n=o.toString("hex")),20!==i.length||20!==o.length)throw new Error("infoHash and peerId MUST have length 20");this._debug("handshake i=%s p=%s exts=%o",e,n,r);const s=t.from(v);s[5]|=16,r&&r.dht&&(s[7]|=1),this._push(t.concat([p,s,i,o])),this._handshakeSent=!0,this.peerExtensions.extended&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()}_sendExtendedHandshake(){const e=a(this.extendedHandshake);e.m={};for(const t in this.extendedMapping){const n=this.extendedMapping[t];e.m[n]=Number(t)}this.extended(0,i.encode(e)),this._extendedHandshakeSent=!0}choke(){if(!this.amChoking){for(this.amChoking=!0,this._debug("choke");this.peerRequests.length;)this.peerRequests.pop();this._push(m)}}unchoke(){this.amChoking&&(this.amChoking=!1,this._debug("unchoke"),this._push(g))}interested(){this.amInterested||(this.amInterested=!0,this._debug("interested"),this._push(y))}uninterested(){this.amInterested&&(this.amInterested=!1,this._debug("uninterested"),this._push(b))}have(e){this._debug("have %d",e),this._message(4,[e],null)}bitfield(e){this._debug("bitfield"),t.isBuffer(e)||(e=e.buffer),this._message(5,[],e)}request(e,t,n,r){return r||(r=(()=>{})),this._finished?r(new Error("wire is closed")):this.peerChoking?r(new Error("peer is choking")):(this._debug("request index=%d offset=%d length=%d",e,t,n),this.requests.push(new _(e,t,n,r)),this._updateTimeout(),void this._message(6,[e,t,n],null))}piece(e,t,n){this._debug("piece index=%d offset=%d",e,t),this.uploaded+=n.length,this.uploadSpeed(n.length),this.emit("upload",n.length),this._message(7,[e,t],n)}cancel(e,t,n){this._debug("cancel index=%d offset=%d length=%d",e,t,n),this._callback(this._pull(this.requests,e,t,n),new Error("request was cancelled"),null),this._message(8,[e,t,n],null)}port(e){this._debug("port %d",e);const n=t.from(w);n.writeUInt16BE(e,5),this._push(n)}extended(e,n){if(this._debug("extended ext=%s",e),"string"==typeof e&&this.peerExtendedMapping[e]&&(e=this.peerExtendedMapping[e]),"number"!=typeof e)throw new Error(`Unrecognized extension: ${e}`);{const r=t.from([e]),o=t.isBuffer(n)?n:i.encode(n);this._message(20,[],t.concat([r,o]))}}_read(){}_message(e,n,r){const i=r?r.length:0,o=t.allocUnsafe(5+4*n.length);o.writeUInt32BE(o.length+i-4,0),o[4]=e;for(let e=0;e{if(i===this._pull(this.peerRequests,e,t,n))return r?this._debug("error satisfying request index=%d offset=%d length=%d (%s)",e,t,n,r.message):void this.piece(e,t,o)};var i=new _(e,t,n,r);this.peerRequests.push(i),this.emit("request",e,t,n,r)}_onPiece(e,t,n){this._debug("got piece index=%d offset=%d",e,t),this._callback(this._pull(this.requests,e,t,n.length),null,n),this.downloaded+=n.length,this.downloadSpeed(n.length),this.emit("download",n.length),this.emit("piece",e,t,n)}_onCancel(e,t,n){this._debug("got cancel index=%d offset=%d length=%d",e,t,n),this._pull(this.peerRequests,e,t,n),this.emit("cancel",e,t,n)}_onPort(e){this._debug("got port %d",e),this.emit("port",e)}_onExtended(e,t){if(0===e){let e,n;try{e=i.decode(t)}catch(e){this._debug("ignoring invalid extended handshake: %s",e.message||e)}if(!e)return;if(this.peerExtendedHandshake=e,"object"==typeof e.m)for(n in e.m)this.peerExtendedMapping[n]=Number(e.m[n].toString());for(n in this._ext)this.peerExtendedMapping[n]&&this._ext[n].onExtendedHandshake(this.peerExtendedHandshake);this._debug("got extended handshake"),this.emit("extended","handshake",this.peerExtendedHandshake)}else this.extendedMapping[e]&&(e=this.extendedMapping[e],this._ext[e]&&this._ext[e].onMessage(t)),this._debug("got extended message ext=%s",e),this.emit("extended",e,t)}_onTimeout(){this._debug("request timed out"),this._callback(this.requests.shift(),new Error("request has timed out"),null),this.emit("timeout")}_write(e,n,r){for(this._bufferSize+=e.length,this._buffer.push(e);this._bufferSize>=this._parserSize;){const e=1===this._buffer.length?this._buffer[0]:t.concat(this._buffer);this._bufferSize-=this._parserSize,this._buffer=this._bufferSize?[e.slice(this._parserSize)]:[],this._parser(e.slice(0,this._parserSize))}r(null)}_callback(e,t,n){e&&(this._clearTimeout(),this.peerChoking||this._finished||this._updateTimeout(),e.callback(t,n))}_clearTimeout(){this._timeout&&(clearTimeout(this._timeout),this._timeout=null)}_updateTimeout(){this._timeoutMs&&this.requests.length&&!this._timeout&&(this._timeout=setTimeout(()=>this._onTimeout(),this._timeoutMs),this._timeoutUnref&&this._timeout.unref&&this._timeout.unref())}_parse(e,t){this._parserSize=e,this._parser=t}_onMessageLength(e){const t=e.readUInt32BE(0);t>0?this._parse(t,this._onMessage):(this._onKeepAlive(),this._parse(4,this._onMessageLength))}_onMessage(e){switch(this._parse(4,this._onMessageLength),e[0]){case 0:return this._onChoke();case 1:return this._onUnchoke();case 2:return this._onInterested();case 3:return this._onUninterested();case 4:return this._onHave(e.readUInt32BE(1));case 5:return this._onBitField(e.slice(1));case 6:return this._onRequest(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 7:return this._onPiece(e.readUInt32BE(1),e.readUInt32BE(5),e.slice(9));case 8:return this._onCancel(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 9:return this._onPort(e.readUInt16BE(1));case 20:return this._onExtended(e.readUInt8(1),e.slice(2));default:return this._debug("got unknown message"),this.emit("unknownmessage",e)}}_parseHandshake(){this._parse(1,e=>{const t=e.readUInt8(0);this._parse(t+48,e=>{const n=e.slice(0,t);if("BitTorrent protocol"!==n.toString())return this._debug("Error: wire not speaking BitTorrent protocol (%s)",n.toString()),void this.end();e=e.slice(t),this._onHandshake(e.slice(8,28),e.slice(28,48),{dht:!!(1&e[7]),extended:!!(16&e[5])}),this._parse(4,this._onMessageLength)})})}_onFinish(){for(this._finished=!0,this.push(null);this.read(););for(clearInterval(this._keepAliveInterval),this._parse(Number.MAX_VALUE,()=>{});this.peerRequests.length;)this.peerRequests.pop();for(;this.requests.length;)this._callback(this.requests.pop(),new Error("wire was closed"),null)}_debug(...e){e[0]=`[${this._debugId}] ${e[0]}`,s(...e)}_pull(e,t,n,i){for(let o=0;o0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:w;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),w(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),w()}function v(){g("onfinish"),e.removeListener("close",b),w()}function w(){g("unpipe"),n.unpipe(e)}return n.on("data",m),_(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;w.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(52)},f=n(698),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(699),y;function b(){}function v(e,t){u=u||n(166),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function w(e){if(u=u||n(166),!(y.call(w,this)||this instanceof u))return new w(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function _(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},w.prototype._writev=null,w.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=g.destroy,w.prototype._undestroy=g.undestroy,w.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(166),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function V(e,t,n){H.call(this,e,t,n)}H.prototype.update=function(e){if(this.finalized)throw new Error(a);var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(s);if(null===e)throw new Error(s);if(d&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||d&&ArrayBuffer.isView(e)))throw new Error(s);t=!0}for(var r=this.blocks,i=this.byteCount,o=e.length,l=this.blockCount,u=0,c=this.s,h,f;u>2]|=e[u]<<_[3&h++];else for(h=this.start;u>2]|=f<<_[3&h++]:f<2048?(r[h>>2]|=(192|f>>6)<<_[3&h++],r[h>>2]|=(128|63&f)<<_[3&h++]):f<55296||f>=57344?(r[h>>2]|=(224|f>>12)<<_[3&h++],r[h>>2]|=(128|f>>6&63)<<_[3&h++],r[h>>2]|=(128|63&f)<<_[3&h++]):(f=65536+((1023&f)<<10|1023&e.charCodeAt(++u)),r[h>>2]|=(240|f>>18)<<_[3&h++],r[h>>2]|=(128|f>>12&63)<<_[3&h++],r[h>>2]|=(128|f>>6&63)<<_[3&h++],r[h>>2]|=(128|63&f)<<_[3&h++]);if(this.lastByteIndex=h,h>=i){for(this.start=h-i,this.block=r[l],h=0;h>=8,n=255&e;n>0;)i.unshift(n),e>>=8,n=255&e,++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},H.prototype.encodeString=function(e){var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(s);if(null===e)throw new Error(s);if(d&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||d&&ArrayBuffer.isView(e)))throw new Error(s);t=!0}var r=0,i=e.length;if(t)r=i;else for(var o=0;o=57344?r+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++o)),r+=4)}return r+=this.encode(8*r),this.update(e),r},H.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t>4&15]+m[15&a]+m[a>>12&15]+m[a>>8&15]+m[a>>20&15]+m[a>>16&15]+m[a>>28&15]+m[a>>24&15];o%e==0&&($(t),i=0)}return r&&(a=t[i],s+=m[a>>4&15]+m[15&a],r>1&&(s+=m[a>>12&15]+m[a>>8&15]),r>2&&(s+=m[a>>20&15]+m[a>>16&15])),s},H.prototype.arrayBuffer=function(){this.finalize();var e=this.blockCount,t=this.s,n=this.outputBlocks,r=this.extraBytes,i=0,o=0,s=this.outputBits>>3,a;a=r?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var l=new Uint32Array(a);o>8&255,s[a+2]=l>>16&255,s[a+3]=l>>24&255;o%e==0&&$(t)}return r&&(a=o<<2,l=t[i],s[a]=255&l,r>1&&(s[a+1]=l>>8&255),r>2&&(s[a+2]=l>>16&255)),s},V.prototype=new H,V.prototype.finalize=function(){return this.encode(this.outputBits,!0),H.prototype.finalize.call(this)};var $=function(e){var t,n,r,i,o,s,a,l,u,c,h,f,p,d,m,g,y,v,b,_,k,E,S,x,C,A,T,I,j,R,B,O,P,N,D,M,F,L,U,q,z,K,H,V,$,W,G,Y,Z,J,Q,X,ee,te,ne,re,ie,oe,se,ae,le,ue,ce;for(r=0;r<48;r+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],l=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],h=e[7]^e[17]^e[27]^e[37]^e[47],f=e[8]^e[18]^e[28]^e[38]^e[48],p=e[9]^e[19]^e[29]^e[39]^e[49],t=f^(s<<1|a>>>31),n=p^(a<<1|s>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=i^(l<<1|u>>>31),n=o^(u<<1|l>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=s^(c<<1|h>>>31),n=a^(h<<1|c>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=l^(f<<1|p>>>31),n=u^(p<<1|f>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=c^(i<<1|o>>>31),n=h^(o<<1|i>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,d=e[0],m=e[1],W=e[11]<<4|e[10]>>>28,G=e[10]<<4|e[11]>>>28,I=e[20]<<3|e[21]>>>29,j=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,le=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,H=e[41]<<18|e[40]>>>14,N=e[2]<<1|e[3]>>>31,D=e[3]<<1|e[2]>>>31,g=e[13]<<12|e[12]>>>20,y=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,Z=e[23]<<10|e[22]>>>22,R=e[33]<<13|e[32]>>>19,B=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,ce=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,M=e[14]<<6|e[15]>>>26,F=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,b=e[24]<<11|e[25]>>>21,J=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,O=e[45]<<29|e[44]>>>3,P=e[44]<<29|e[45]>>>3,x=e[6]<<28|e[7]>>>4,C=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,L=e[26]<<25|e[27]>>>7,U=e[27]<<25|e[26]>>>7,_=e[36]<<21|e[37]>>>11,k=e[37]<<21|e[36]>>>11,X=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,V=e[8]<<27|e[9]>>>5,$=e[9]<<27|e[8]>>>5,A=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,q=e[38]<<8|e[39]>>>24,z=e[39]<<8|e[38]>>>24,E=e[48]<<14|e[49]>>>18,S=e[49]<<14|e[48]>>>18,e[0]=d^~g&v,e[1]=m^~y&b,e[10]=x^~A&I,e[11]=C^~T&j,e[20]=N^~M&L,e[21]=D^~F&U,e[30]=V^~W&Y,e[31]=$^~G&Z,e[40]=te^~re&oe,e[41]=ne^~ie&se,e[2]=g^~v&_,e[3]=y^~b&k,e[12]=A^~I&R,e[13]=T^~j&B,e[22]=M^~L&q,e[23]=F^~U&z,e[32]=W^~Y&J,e[33]=G^~Z&Q,e[42]=re^~oe&ae,e[43]=ie^~se&le,e[4]=v^~_&E,e[5]=b^~k&S,e[14]=I^~R&O,e[15]=j^~B&P,e[24]=L^~q&K,e[25]=U^~z&H,e[34]=Y^~J&X,e[35]=Z^~Q&ee,e[44]=oe^~ae&ue,e[45]=se^~le&ce,e[6]=_^~E&d,e[7]=k^~S&m,e[16]=R^~O&x,e[17]=B^~P&C,e[26]=q^~K&N,e[27]=z^~H&D,e[36]=J^~X&V,e[37]=Q^~ee&$,e[46]=ae^~ue&te,e[47]=le^~ce&ne,e[8]=E^~d&g,e[9]=S^~m&y,e[18]=O^~x&A,e[19]=P^~C&T,e[28]=K^~N&M,e[29]=H^~D&F,e[38]=X^~V&W,e[39]=ee^~$&G,e[48]=ue^~te&re,e[49]=ce^~ne&ie,e[0]^=w[r],e[1]^=w[r+1]};if(f)e.exports=D;else{for(F=0;F(function(n,r){let i;try{i=t(n)}catch(t){return void e.nextTick(r,t)}e.nextTick(r,null,i)})),t.toBuf=((e,t)=>r=>{let i=e(r,t);return n.from(i,"hex")}),t.fromString=((e,t)=>r=>{const i=n.isBuffer(r)?r.toString():r;return e(i,t)}),t.fromNumberTo32BitBuf=((e,t)=>r=>{let i=e(r,t);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return n.from(o)})}).call(this,n(3),n(0).Buffer)},function(e,t,n){(function(t){var r=n(718),i=n(362),o;function s(e,t){return"function"!=typeof t?e:e.then(function(e){o(function(){t(null,e)})},function(e){o(function(){t(e)})})}function a(e){return s(this,e)}function l(e){if(e&&i(e)){e.nodeify=a;var t=e.then;return e.then=function(){return l(t.apply(this,arguments))},e}"function"==typeof e?e.prototype.nodeify=a:r.prototype.nodeify=a}function u(e){if(!(this instanceof u))return new u(e);r.call(this,e),l(this)}o="function"==typeof setImmediate?setImmediate:"object"==typeof t&&t&&t.nextTick?t.nextTick:function(e){setTimeout(e,0)},e.exports=s,s.extend=l,s.Promise=u,u.prototype=Object.create(r.prototype),u.prototype.constructor=u}).call(this,n(3))},function(e,t){function n(e){return e&&"function"==typeof e.then}e.exports=n},function(e,t,n){var r=n(720),i=n(721);e.exports={blake2b:r.blake2b,blake2bHex:r.blake2bHex,blake2bInit:r.blake2bInit,blake2bUpdate:r.blake2bUpdate,blake2bFinal:r.blake2bFinal,blake2s:i.blake2s,blake2sHex:i.blake2sHex,blake2sInit:i.blake2sInit,blake2sUpdate:i.blake2sUpdate,blake2sFinal:i.blake2sFinal}},function(e,t,n){(function(t){var n="Input must be an string, Buffer or Uint8Array";function r(e){var r;if(e instanceof Uint8Array)r=e;else if(e instanceof t)r=new Uint8Array(e);else{if("string"!=typeof e)throw new Error(n);r=new Uint8Array(t.from(e,"utf8"))}return r}function i(e){return Array.prototype.map.call(e,function(e){return(e<16?"0":"")+e.toString(16)}).join("")}function o(e){return(4294967296+e).toString(16).substring(1)}function s(e,t,n){for(var r="\n"+e+" = ",i=0;i{"function"==typeof t&&(n=t,t=void 0),i.deserialize(e,(e,i)=>{if(e)return n(e);if(!t||"/"===t)return n(null,{value:i,remainderPath:""});const s=t.split("/"),a=o(i).get(s);if(void 0!==a)return n(null,{value:a,remainderPath:""});let l;const u=s.length;for(let e=0;e{"function"==typeof t&&(n=t,t=void 0),t=t||{},i.deserialize(e,(e,t)=>{if(e)return n(e);const r=a(t),i=r.map(e=>e.path);n(null,i)})}),t.isLink=((e,n,r)=>{t.resolve(e,n,(e,t)=>e?r(e):t.remainderPath.length>0?r(new Error("path out of scope")):void(s.isCID(t.value)?r(null,t.value):r(null,!1)))})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(10),i=n(9),o=n(194);t=e.exports,t.multicodec="dag-pb",t.defaultHashAlg="sha2-256",t.resolve=((e,t,n)=>{r([t=>o.deserialize(e,t),(e,r)=>{if(!t)return n(null,{value:e,remainderPath:""});const i=t.split("/");if("Links"===i[0]){let t="";if(!i[1])return r(null,{value:e.links.map(e=>e.toJSON()),remainderPath:""});const n={};e.links.forEach((e,t)=>{const r=e.toJSON();n[t]=n[r.name]={cid:r.cid,name:r.name,size:r.size}});let o=n[i[1]];"Hash"===i[2]?o={"/":o.cid}:"Tsize"===i[2]?o=o.size:"Name"===i[2]&&(o=o.name),t=i.slice(3).join("/"),r(null,{value:o,remainderPath:t})}else if("Data"===i[0])r(null,{value:e.data,remainderPath:""});else{const t={};e.links.forEach((e,n)=>{const r=e.toJSON();t[r.name]={cid:r.cid,name:r.name,size:r.size}});const n=t[i[0]];if(n)return r(null,{value:{"/":n.cid},remainderPath:i.slice(1).join("/")});r(new Error("path not available"))}}],n)}),t.tree=((e,t,n)=>{"function"==typeof t&&(n=t,t={}),t=t||{},o.deserialize(e,(e,t)=>{if(e)return n(e);const r=[];r.push("Links"),t.links.forEach((e,t)=>{r.push(`Links/${t}/Name`),r.push(`Links/${t}/Tsize`),r.push(`Links/${t}/Hash`)}),r.push("Data"),n(null,r)})}),t.isLink=((e,n,r)=>{t.resolve(e,n,(e,t)=>{if(e)return r(e);if(t.remainderPath.length>0)return r(new Error("path out of scope"));if("object"==typeof t.value&&t.value["/"]){let n;try{n=i.isCID(new i(t.value["/"]))}catch(e){n=!1}if(n)return r(null,t.value)}r(null,!1)})})},function(e,t,n){"use strict";const r=n(9),i=n(56);e.exports={resolver:{multicodec:"raw",defaultHashAlg:"sha2-256",resolve:(e,t,n)=>{n(null,{value:e,remainderPath:""})},tree:(e,t,n)=>{"function"==typeof t&&(n=t),n(null,[])}},util:{deserialize:(e,t)=>{t(null,e)},serialize:(e,t)=>{t(null,e)},cid:(e,t,n)=>{"function"==typeof t&&(n=t,t={}),t=t||{};const o=t.hashAlg||"sha2-256",s=void 0===t.version?1:t.version;i(e,o,(e,t)=>{if(e)return n(e);n(null,new r(s,"raw",t))})}}}},function(e,t,n){"use strict";(function(r){const i=n(57),o=i(n(249));n(117),n(250),n(251);const s=n(21);t=e.exports;const a={rsa:n(753),ed25519:n(769),secp256k1:n(773)(o,n(256))};function l(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=n(801),t.generateEphemeralKeyPair=n(803),t.generateKeyPair=((e,t,n)=>{let r=a[e.toLowerCase()];if(!r)return n(new Error("invalid or unsupported key type"));r.generateKeyPair(t,n)}),t.generateKeyPairFromSeed=((e,t,n,r)=>{let i=a[e.toLowerCase()];return i?"ed25519"!==e.toLowerCase()?r(new Error("Seed key derivation is unimplemented for RSA or secp256k1")):void i.generateKeyPairFromSeed(t,n,r):r(new Error("invalid or unsupported key type"))}),t.unmarshalPublicKey=(e=>{const t=o.PublicKey.decode(e),n=t.Data;switch(t.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPublicKey(n);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PublicKey(n);case o.KeyType.Secp256k1:if(a.secp256k1)return a.secp256k1.unmarshalSecp256k1PublicKey(n);throw new Error("secp256k1 support requires libp2p-crypto-secp256k1 package");default:throw new Error("invalid or unsupported key type")}}),t.marshalPublicKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!l(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let n;try{n=o.PrivateKey.decode(e)}catch(e){return t(e)}const r=n.Data;switch(n.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPrivateKey(r,t);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PrivateKey(r,t);case o.KeyType.Secp256k1:return a.secp256k1?a.secp256k1.unmarshalSecp256k1PrivateKey(r,t):t(new Error("secp256k1 support requires libp2p-crypto-secp256k1 package"));default:t(new Error("invalid or unsupported key type"))}}),t.marshalPrivateKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!l(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,n)=>{try{const i=s.pki.decryptRsaPrivateKey(e,t);if(null===i)throw new Error("Cannot read the key, most likely the password is wrong or not a RSA key");let o=s.asn1.toDer(s.pki.privateKeyToAsn1(i));return o=r.from(o.getBytes(),"binary"),a.rsa.unmarshalRsaPrivateKey(o,n)}catch(e){n(e)}})}).call(this,n(0).Buffer)},function(e,t,n){var r=n(21),i;e.exports=r.jsbn=r.jsbn||{};var o=0xdeadbeefcafe,s=!0;function a(e,t,n){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function l(){return new a(null)}function u(e,t,n,r,i,o){for(;--o>=0;){var s=t*this.data[e++]+n.data[r]+i;i=Math.floor(s/67108864),n.data[r++]=67108863&s}return i}function c(e,t,n,r,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var l=32767&this.data[e],u=this.data[e++]>>15,c=a*l+u*s;l=s*l+((32767&c)<<15)+n.data[r]+(1073741823&i),i=(l>>>30)+(c>>>15)+a*u+(i>>>30),n.data[r++]=1073741823&l}return i}function h(e,t,n,r,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var l=16383&this.data[e],u=this.data[e++]>>14,c=a*l+u*s;l=s*l+((16383&c)<<14)+n.data[r]+i,i=(l>>28)+(c>>14)+a*u,n.data[r++]=268435455&l}return i}r.jsbn.BigInteger=a,"undefined"==typeof navigator?(a.prototype.am=h,i=28):"Microsoft Internet Explorer"==navigator.appName?(a.prototype.am=c,i=30):"Netscape"!=navigator.appName?(a.prototype.am=u,i=26):(a.prototype.am=h,i=28),a.prototype.DB=i,a.prototype.DM=(1<=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function _(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function w(e){var t=l();return t.fromInt(e),t}function k(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,o=0;--r>=0;){var s=8==n?255&e[r]:v(e,r);s<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==o?this.data[this.t++]=s:o+n>this.DB?(this.data[this.t-1]|=(s&(1<>this.DB-o):this.data[this.t-1]|=s<=this.DB&&(o-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function S(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n=(1<0)for(a>a)>0&&(i=!0,o=y(r));s>=0;)a>(a+=this.DB-t)):(r=this.data[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=y(r));return i?o:"0"}function x(){var e=l();return a.ZERO.subTo(this,e),e}function C(){return this.s<0?this.negate():this}function A(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(t=n-e.t,0!=t)return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this.data[n]-e.data[n]))return t;return 0}function T(e){var t=1,n;return 0!=(n=e>>>16)&&(e=n,t+=16),0!=(n=e>>8)&&(e=n,t+=8),0!=(n=e>>4)&&(e=n,t+=4),0!=(n=e>>2)&&(e=n,t+=2),0!=(n=e>>1)&&(e=n,t+=1),t}function I(){return this.t<=0?0:this.DB*(this.t-1)+T(this.data[this.t-1]^this.s&this.DM)}function j(e,t){var n;for(n=this.t-1;n>=0;--n)t.data[n+e]=this.data[n];for(n=e-1;n>=0;--n)t.data[n]=0;t.t=this.t+e,t.s=this.s}function R(e,t){for(var n=e;n=0;--a)t.data[a+o+1]=this.data[a]>>r|s,s=(this.data[a]&i)<=0;--a)t.data[a]=0;t.data[o]=s,t.t=this.t+o+1,t.s=this.s,t.clamp()}function O(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<>r;for(var s=n+1;s>r;r>0&&(t.data[this.t-n-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t.data[n++]=this.DV+r:r>0&&(t.data[n++]=r),t.t=n,t.clamp()}function N(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[n]=0;for(n=0;n=t.DV&&(e.data[n+t.t]-=t.DV,e.data[n+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(n,t.data[n],e,2*n,0,1)),e.s=0,e.clamp()}function M(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t0?(r.lShiftTo(c,o),i.lShiftTo(c,n)):(r.copyTo(o),i.copyTo(n));var h=o.t,f=o.data[h-1];if(0!=f){var p=f*(1<1?o.data[h-2]>>this.F2:0),d=this.FV/p,m=(1<=0&&(n.data[n.t++]=1,n.subTo(b,n)),a.ONE.dlShiftTo(h,b),b.subTo(o,o);o.t=0;){var _=n.data[--y]==f?this.DM:Math.floor(n.data[y]*d+(n.data[y-1]+g)*m);if((n.data[y]+=o.am(0,_,n,v,0,h))<_)for(o.dlShiftTo(v,b),n.subTo(b,n);n.data[y]<--_;)n.subTo(b,n)}null!=t&&(n.drShiftTo(h,t),s!=u&&a.ZERO.subTo(t,t)),n.t=h,n.clamp(),c>0&&n.rShiftTo(c,n),s<0&&a.ZERO.subTo(n,n)}}}function F(e){var t=l();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(a.ZERO)>0&&e.subTo(t,t),t}function L(e){this.m=e}function U(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function q(e){return e}function z(e){e.divRemTo(this.m,null,e)}function K(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function H(e,t){e.squareTo(t),this.reduce(t)}function V(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function $(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function G(e){var t=l();return e.copyTo(t),this.reduce(t),t}function Y(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e.data[n]+=this.m.am(0,r,e,t,0,this.m.t);e.data[n]>=e.DV;)e.data[n]-=e.DV,e.data[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function Z(e,t){e.squareTo(t),this.reduce(t)}function J(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function Q(){return 0==(this.t>0?1&this.data[0]:this.s)}function X(e,t){if(e>4294967295||e<1)return a.ONE;var n=l(),r=l(),i=t.convert(this),o=T(e)-1;for(i.copyTo(n);--o>=0;)if(t.sqrTo(n,r),(e&1<0)t.mulTo(r,i,n);else{var s=n;n=r,r=s}return t.revert(n)}function ee(e,t){var n;return n=e<256||t.isEven()?new L(t):new $(t),this.exp(e,n)}function te(){var e=l();return this.copyTo(e),e}function ne(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<>24}function ie(){return 0==this.t?this.s:this.data[0]<<16>>16}function oe(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function se(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1}function ae(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),r=w(n),i=l(),o=l(),s="";for(this.divRemTo(r,i,o);i.signum()>0;)s=(n+o.intValue()).toString(e).substr(1)+s,i.divRemTo(r,i,o);return o.intValue().toString(e)+s}function le(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),r=Math.pow(t,n),i=!1,o=0,s=0,l=0;l=n&&(this.dMultiply(r),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(s,0)),i&&a.ZERO.subTo(this,this)}function ue(e,t,n){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(a.ONE.shiftLeft(e-1),ye,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(a.ONE.shiftLeft(e-1),this);else{var r=new Array,i=7&e;r.length=1+(e>>3),t.nextBytes(r),i>0?r[0]&=(1<0)for(n>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<=0;)n<8?(r=(this.data[e]&(1<>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t}function he(e){return 0==this.compareTo(e)}function fe(e){return this.compareTo(e)<0?this:e}function pe(e){return this.compareTo(e)>0?this:e}function de(e,t,n){var r,i,o=Math.min(e.t,this.t);for(r=0;r>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function Ae(){for(var e=0;e=this.t?0!=this.s:0!=(this.data[t]&1<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t.data[n++]=r:r<-1&&(t.data[n++]=this.DV+r),t.t=n,t.clamp()}function De(e){var t=l();return this.addTo(e,t),t}function Me(e){var t=l();return this.subTo(e,t),t}function Fe(e){var t=l();return this.multiplyTo(e,t),t}function Le(e){var t=l();return this.divRemTo(e,t,null),t}function Ue(e){var t=l();return this.divRemTo(e,null,t),t}function qe(e){var t=l(),n=l();return this.divRemTo(e,t,n),new Array(t,n)}function ze(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Ke(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function He(){}function Ve(e){return e}function $e(e,t,n){e.multiplyTo(t,n)}function We(e,t){e.squareTo(t)}function Ge(e){return this.exp(e,new He)}function Ye(e,t,n){var r=Math.min(this.t+e.t,t),i;for(n.s=0,n.t=r;r>0;)n.data[--r]=0;for(i=n.t-this.t;r=0;)n.data[r]=0;for(r=Math.max(t-this.t,0);r2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=l();return e.copyTo(t),this.reduce(t),t}function Xe(e){return e}function et(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function tt(e,t){e.squareTo(t),this.reduce(t)}function nt(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function rt(e,t){var n=e.bitLength(),r,i=w(1),o;if(n<=0)return i;r=n<18?1:n<48?3:n<144?4:n<768?5:6,o=n<8?new L(t):t.isEven()?new Je(t):new $(t);var s=new Array,a=3,u=r-1,c=(1<1){var h=l();for(o.sqrTo(s[1],h);a<=c;)s[a]=l(),o.mulTo(h,s[a-2],s[a]),a+=2}var f=e.t-1,p,d=!0,m=l(),g;for(n=T(e.data[f])-1;f>=0;){for(n>=u?p=e.data[f]>>n-u&c:(p=(e.data[f]&(1<0&&(p|=e.data[f-1]>>this.DB+n-u)),a=r;0==(1&p);)p>>=1,--a;if((n-=a)<0&&(n+=this.DB,--f),d)s[p].copyTo(i),d=!1;else{for(;a>1;)o.sqrTo(i,m),o.sqrTo(m,i),a-=2;a>0?o.sqrTo(i,m):(g=i,i=m,m=g),o.mulTo(m,s[p],i)}for(;f>=0&&0==(e.data[f]&1<0&&(t.rShiftTo(o,t),n.rShiftTo(o,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n}function ot(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this.data[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this.data[r])%e;return n}function st(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return a.ZERO;for(var n=e.clone(),r=this.clone(),i=w(1),o=w(0),s=w(0),l=w(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),t?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;r.isEven();)r.rShiftTo(1,r),t?(s.isEven()&&l.isEven()||(s.addTo(this,s),l.subTo(e,l)),s.rShiftTo(1,s)):l.isEven()||l.subTo(e,l),l.rShiftTo(1,l);n.compareTo(r)>=0?(n.subTo(r,n),t&&i.subTo(s,i),o.subTo(l,o)):(r.subTo(n,r),t&&s.subTo(i,s),l.subTo(o,l))}return 0!=r.compareTo(a.ONE)?a.ZERO:l.compareTo(e)>=0?l.subtract(e):l.signum()<0?(l.addTo(e,l),l.signum()<0?l.add(e):l):l}L.prototype.convert=U,L.prototype.revert=q,L.prototype.reduce=z,L.prototype.mulTo=K,L.prototype.sqrTo=H,$.prototype.convert=W,$.prototype.revert=G,$.prototype.reduce=Y,$.prototype.mulTo=J,$.prototype.sqrTo=Z,a.prototype.copyTo=b,a.prototype.fromInt=_,a.prototype.fromString=k,a.prototype.clamp=E,a.prototype.dlShiftTo=j,a.prototype.drShiftTo=R,a.prototype.lShiftTo=B,a.prototype.rShiftTo=O,a.prototype.subTo=P,a.prototype.multiplyTo=N,a.prototype.squareTo=D,a.prototype.divRemTo=M,a.prototype.invDigit=V,a.prototype.isEven=Q,a.prototype.exp=X,a.prototype.toString=S,a.prototype.negate=x,a.prototype.abs=C,a.prototype.compareTo=A,a.prototype.bitLength=I,a.prototype.mod=F,a.prototype.modPowInt=ee,a.ZERO=w(0),a.ONE=w(1),He.prototype.convert=Ve,He.prototype.revert=Ve,He.prototype.mulTo=$e,He.prototype.sqrTo=We,Je.prototype.convert=Qe,Je.prototype.revert=Xe,Je.prototype.reduce=et,Je.prototype.mulTo=nt,Je.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],lt=(1<<26)/at[at.length-1];function ut(e){var t,n=this.abs();if(1==n.t&&n.data[0]<=at[at.length-1]){for(t=0;t=0);var l=o.modPow(r,this);if(0!=l.compareTo(a.ONE)&&0!=l.compareTo(t)){for(var u=1;u++4){var t=e;e=r.util.createBuffer();for(var n=0;n0))return!0;for(var r=0;r0))return!0;for(var r=0;r0)return!1;var n=e.length(),r=e.at(n-1);return!(r>this.blockSize<<2)&&(e.truncate(r),!0)},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,n){if(e.length()0))return!0;for(var r=0;r0))return!0;for(var r=0;r0)return!1;var n=e.length(),r=e.at(n-1);return!(r>this.blockSize<<2)&&(e.truncate(r),!0)},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0)e.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0)e.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,n){var r=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0)e.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}s(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=r.util.createBuffer(e.iv),n;if(this._cipherLength=0,n="additionalData"in e?r.util.createBuffer(e.additionalData):r.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=r.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=t.length();if(12===i)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*i)))}this._inBlock=this._j0.slice(0),s(this._inBlock),this._partialBytes=0,n=r.util.createBuffer(n),this._aDataLength=a(8*n.length());var o=n.length()%this.blockSize;for(o&&n.fillWithByte(0,this.blockSize-o),this._s=[0,0,0,0];n.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[n.getInt32(),n.getInt32(),n.getInt32(),n.getInt32()])},i.gcm.prototype.encrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,n){var r=e.length();if(r0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),s(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--r)t[r]=e[r]>>>1|(1&e[r-1])<<31;t[0]=e[0]>>>1,n&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],n=0;n<32;++n){var r=n/8|0,i=e[r]>>>4*(7-n%8)&15,o=this._m[n][i];t[0]^=o[0],t[1]^=o[1],t[2]^=o[2],t[3]^=o[3]}return t},i.gcm.prototype.ghash=function(e,t,n){return t[0]^=n[0],t[1]^=n[1],t[2]^=n[2],t[3]^=n[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var n=8/t,r=4*n,i=16*n,o=new Array(i),s=0;s>>1,i=new Array(n);i[r]=e.slice(0);for(var o=r>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o4||!a||"sha1"===a))return"string"!=typeof a&&(a="sha1"),e=new t(e,"binary"),n=new t(n,"binary"),l?4===o.pbkdf2Sync.length?o.pbkdf2(e,n,i,s,function(e,t){if(e)return l(e);l(null,t.toString("binary"))}):o.pbkdf2(e,n,i,s,a,function(e,t){if(e)return l(e);l(null,t.toString("binary"))}):4===o.pbkdf2Sync.length?o.pbkdf2Sync(e,n,i,s).toString("binary"):o.pbkdf2Sync(e,n,i,s,a).toString("binary");if(void 0!==a&&null!==a||(a="sha1"),"string"==typeof a){if(!(a in r.md.algorithms))throw new Error("Unknown hash algorithm: "+a);a=r.md[a].create()}var u=a.digestLength;if(s>4294967295*u){var c=new Error("Derived key is too long.");if(l)return l(c);throw c}var h=Math.ceil(s/u),f=s-(h-1)*u,p=r.hmac.create();p.start(a,e);var d="",m,g,y;if(!l){for(var v=1;v<=h;++v){p.start(null,null),p.update(n),p.update(r.util.int32ToBytes(v)),m=y=p.digest().getBytes();for(var b=2;b<=i;++b)p.start(null,null),p.update(y),g=p.digest().getBytes(),m=r.util.xorBytes(m,g,u),y=g;d+=vh)return l(null,d);p.start(null,null),p.update(n),p.update(r.util.int32ToBytes(v)),m=y=p.digest().getBytes(),b=2,w()}function w(){if(b<=i)return p.start(null,null),p.update(y),g=p.digest().getBytes(),m=r.util.xorBytes(m,g,u),y=g,++b,r.util.setImmediate(w);d+=v>6],i=0==(32&n);if(31==(31&n)){let r=n;for(n=0;128==(128&r);){if(r=e.readUInt8(t),e.isError(r))return r;n<<=7,n|=127&r}}else n&=31;const o=a.tag[n];return{cls:r,primitive:i,tag:n,tagStr:o}}function h(e,t,n){let r=e.readUInt8(n);if(e.isError(r))return r;if(!t&&128===r)return null;if(0==(128&r))return r;const i=127&r;if(i>4)return e.error("length octect is too long");r=0;for(let t=0;t=31?r.error("Multi-octet tag encoding unsupported"):(t||(i|=32),i|=a.tagClassByName[n||"universal"]<<6,i)}e.exports=l,l.prototype.encode=function e(t,n){return this.tree._encode(t,n).join()},r(u,s.Node),u.prototype._encodeComposite=function e(t,n,r,o){const s=h(t,n,r,this.reporter);if(o.length<128){const e=new i(2);return e[0]=s,e[1]=o.length,this._createEncoderBuffer([e,o])}let a=1;for(let e=o.length;e>=256;e>>=8)a++;const l=new i(2+a);l[0]=s,l[1]=128|a;for(let e=1+a,t=o.length;t>0;e--,t>>=8)l[e]=255&t;return this._createEncoderBuffer([l,o])},u.prototype._encodeStr=function e(t,n){if("bitstr"===n)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===n){const e=new i(2*t.length);for(let n=0;n=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}let o=0;for(let e=0;e=128;n>>=7)o++}const s=new i(o);let a=s.length-1;for(let e=t.length-1;e>=0;e--){let n=t[e];for(s[a--]=127&n;(n>>=7)>0;)s[a--]=128|127&n}return this._createEncoderBuffer(s)},u.prototype._encodeTime=function e(t,n){let r;const i=new Date(t);return"gentime"===n?r=[c(i.getUTCFullYear()),c(i.getUTCMonth()+1),c(i.getUTCDate()),c(i.getUTCHours()),c(i.getUTCMinutes()),c(i.getUTCSeconds()),"Z"].join(""):"utctime"===n?r=[c(i.getUTCFullYear()%100),c(i.getUTCMonth()+1),c(i.getUTCDate()),c(i.getUTCHours()),c(i.getUTCMinutes()),c(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+n+" time is not supported yet"),this._encodeStr(r,"octstr")},u.prototype._encodeNull=function e(){return this._createEncoderBuffer("")},u.prototype._encodeInt=function e(t,n){if("string"==typeof t){if(!n)return this.reporter.error("String int or enum given, but no values map");if(!n.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=n[t]}if("number"!=typeof t&&!i.isBuffer(t)){const e=t.toArray();!t.sign&&128&e[0]&&e.unshift(0),t=new i(e)}if(i.isBuffer(t)){let e=t.length;0===t.length&&e++;const n=new i(e);return t.copy(n),0===t.length&&(n[0]=0),this._createEncoderBuffer(n)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);let r=1;for(let e=t;e>=256;e>>=8)r++;const o=new Array(r);for(let e=o.length-1;e>=0;e--)o[e]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new i(o))},u.prototype._encodeBool=function e(t){return this._createEncoderBuffer(t?255:0)},u.prototype._use=function e(t,n){return"function"==typeof t&&(t=t(n)),t._getEncoder("der").tree},u.prototype._skipDefault=function e(t,n,r){const i=this._baseState;let o;if(null===i.default)return!1;const s=t.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,n,r).join()),s.length!==i.defaultBuffer.length)return!1;for(o=0;o=this._blockSize;){for(var o=this._blockOffset;o0;++a)this._length[a]+=l,l=this._length[a]/4294967296|0,l>0&&(this._length[a]-=4294967296*l);return this},a.prototype._update=function(){throw new Error("_update is not implemented")},a.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return t},a.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=a},function(e,t,n){"use strict";(function(t,r){var i=n(11);e.exports=E;var o=n(49),s;E.ReadableState=k;var a=n(6).EventEmitter,l=function(e,t){return e.listeners(t).length},u=n(382),c=n(5).Buffer,h=t.Uint8Array||function(){};function f(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof h}var d=n(7);d.inherits=n(1);var m=n(782),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(783),v=n(383),b;d.inherits(E,u);var _=["error","close","destroy","pause","resume"];function w(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function k(e,t){s=s||n(98),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(b||(b=n(18).StringDecoder),this.decoder=new b(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||n(98),!(this instanceof E))return new E(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function S(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,R(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o>>32-t}function m(e,t,n,r,i,o,s,a){return d(e+(t^n^r)+o+s|0,a)+i|0}function g(e,t,n,r,i,o,s,a){return d(e+(t&n|~t&r)+o+s|0,a)+i|0}function y(e,t,n,r,i,o,s,a){return d(e+((t|~n)^r)+o+s|0,a)+i|0}function v(e,t,n,r,i,o,s,a){return d(e+(t&r|n&~r)+o+s|0,a)+i|0}function b(e,t,n,r,i,o,s,a){return d(e+(t^(n|~r))+o+s|0,a)+i|0}i(p,o),p.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,p=0|this._e,_=0|this._a,w=0|this._b,k=0|this._c,E=0|this._d,S=0|this._e,x=0;x<80;x+=1){var C,A;x<16?(C=m(n,r,i,o,p,e[a[x]],h[0],u[x]),A=b(_,w,k,E,S,e[l[x]],f[0],c[x])):x<32?(C=g(n,r,i,o,p,e[a[x]],h[1],u[x]),A=v(_,w,k,E,S,e[l[x]],f[1],c[x])):x<48?(C=y(n,r,i,o,p,e[a[x]],h[2],u[x]),A=y(_,w,k,E,S,e[l[x]],f[2],c[x])):x<64?(C=v(n,r,i,o,p,e[a[x]],h[3],u[x]),A=g(_,w,k,E,S,e[l[x]],f[3],c[x])):(C=b(n,r,i,o,p,e[a[x]],h[4],u[x]),A=m(_,w,k,E,S,e[l[x]],f[4],c[x])),n=p,p=o,o=d(i,10),i=r,r=C,_=S,S=E,E=d(k,10),k=w,w=A}var T=this._b+i+E|0;this._b=this._c+o+S|0,this._c=this._d+p+_|0,this._d=this._e+n+w|0,this._e=this._a+r+k|0,this._a=T},p.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=r.alloc?r.alloc(20):new r(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=p},function(e,t,n){var t=e.exports=function e(n){n=n.toLowerCase();var r=t[n];if(!r)throw new Error(n+" is not supported (we accept pull requests)");return new r};t.sha=n(790),t.sha1=n(791),t.sha224=n(792),t.sha256=n(387),t.sha384=n(793),t.sha512=n(388)},function(e,t,n){var r=n(1),i=n(120),o=n(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 l(){this.init(),this._w=a,i.call(this,64,56)}function u(e,t,n){return n^e&(t^n)}function c(e,t,n){return e&t|n&(e|t)}function h(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function f(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function p(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function d(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}r(l,i),l.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},l.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,l=0|this._f,m=0|this._g,g=0|this._h,y=0;y<16;++y)t[y]=e.readInt32BE(4*y);for(;y<64;++y)t[y]=d(t[y-2])+t[y-7]+p(t[y-15])+t[y-16]|0;for(var v=0;v<64;++v){var b=g+f(a)+u(a,l,m)+s[v]+t[v]|0,_=h(n)+c(n,r,i)|0;g=m,m=l,l=a,a=o+b|0,o=i,i=r,r=n,n=b+_|0}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0,this._f=l+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0},l.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=l},function(e,t,n){var r=n(1),i=n(120),o=n(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 l(){this.init(),this._w=a,i.call(this,128,112)}function u(e,t,n){return n^e&(t^n)}function c(e,t,n){return e&t|n&(e|t)}function h(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function f(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function p(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function d(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function m(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function g(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function y(e,t){return e>>>0>>0?1:0}r(l,i),l.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},l.prototype._update=function(e){for(var t=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,l=0|this._fh,v=0|this._gh,b=0|this._hh,_=0|this._al,w=0|this._bl,k=0|this._cl,E=0|this._dl,S=0|this._el,x=0|this._fl,C=0|this._gl,A=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],j=t[T-30+1],R=p(I,j),B=d(j,I);I=t[T-4],j=t[T-4+1];var O=m(I,j),P=g(j,I),N=t[T-14],D=t[T-14+1],M=t[T-32],F=t[T-32+1],L=B+D|0,U=R+N+y(L,B)|0;L=L+P|0,U=U+O+y(L,P)|0,L=L+F|0,U=U+M+y(L,F)|0,t[T]=U,t[T+1]=L}for(var q=0;q<160;q+=2){U=t[q],L=t[q+1];var z=c(n,r,i),K=c(_,w,k),H=h(n,_),V=h(_,n),$=f(a,S),W=f(S,a),G=s[q],Y=s[q+1],Z=u(a,l,v),J=u(S,x,C),Q=A+W|0,X=b+$+y(Q,A)|0;Q=Q+J|0,X=X+Z+y(Q,J)|0,Q=Q+Y|0,X=X+G+y(Q,Y)|0,Q=Q+L|0,X=X+U+y(Q,L)|0;var ee=V+K|0,te=H+z+y(ee,V)|0;b=v,A=C,v=l,C=x,l=a,x=S,S=E+Q|0,a=o+X+y(S,E)|0,o=i,E=k,i=r,k=w,r=n,w=_,_=Q+ee|0,n=X+te+y(_,Q)|0}this._al=this._al+_|0,this._bl=this._bl+w|0,this._cl=this._cl+k|0,this._dl=this._dl+E|0,this._el=this._el+S|0,this._fl=this._fl+x|0,this._gl=this._gl+C|0,this._hl=this._hl+A|0,this._ah=this._ah+n+y(this._al,_)|0,this._bh=this._bh+r+y(this._bl,w)|0,this._ch=this._ch+i+y(this._cl,k)|0,this._dh=this._dh+o+y(this._dl,E)|0,this._eh=this._eh+a+y(this._el,S)|0,this._fh=this._fh+l+y(this._fl,x)|0,this._gh=this._gh+v+y(this._gl,C)|0,this._hh=this._hh+b+y(this._hl,A)|0},l.prototype._hash=function(){var e=o.allocUnsafe(64);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},e.exports=l},function(e,t,n){"use strict";var r=n(5).Buffer,i=n(197),o=n(390);function s(e,t){null===e&&null===t?(this.x=this.y=null,this.inf=!0):(this.x=e,this.y=t,this.inf=!1)}s.fromPublicKey=function(e){var t=e[0],n,r;return 33!==e.length||2!==t&&3!==t?65!==e.length||4!==t&&6!==t&&7!==t?null:(n=i.fromBuffer(e.slice(1,33)),r=i.fromBuffer(e.slice(33,65)),n.ucmp(i.p)>=0||r.ucmp(i.p)>=0?null:6!==t&&7!==t||r.isOdd()===(7===t)?0!==n.redSqr().redMul(n).redIAdd7().ucmp(r.redSqr())?null:new s(n,r):null):(n=i.fromBuffer(e.slice(1,33)),n.ucmp(i.p)>=0?null:(r=n.redSqr().redMul(n).redIAdd7().redSqrt(),null===r?null:(3===t!==r.isOdd()&&(r=r.redNeg()),new s(n,r))))},s.prototype.toPublicKey=function(e){var t=this.x,n=this.y,i;return e?(i=r.alloc(33),i[0]=n.isOdd()?3:2,t.toBuffer().copy(i,1)):(i=r.alloc(65),i[0]=4,t.toBuffer().copy(i,1),n.toBuffer().copy(i,33)),i},s.fromECJPoint=function(e){if(e.inf)return new s(null,null);var t=e.z.redInvm(),n=t.redSqr(),r=e.x.redMul(n),i=e.y.redMul(n).redMul(t);return new s(r,i)},s.prototype.toECJPoint=function(){return this.inf?new o(null,null,null):new o(this.x,this.y,o.one)},s.prototype.neg=function(){return this.inf?this:new s(this.x,this.y.redNeg())},s.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(0===this.x.ucmp(e.x))return 0===this.y.ucmp(e.y)?this.dbl():new s(null,null);var t=this.y.redSub(e.y);t.isZero()||(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return new s(n,r)},s.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.isZero())return new s(null,null);var t=this.x.redSqr(),n=t.redAdd(t).redIAdd(t).redMul(e.redInvm()),r=n.redSqr().redISub(this.x.redAdd(this.x)),i=n.redMul(this.x.redSub(r)).redISub(this.y);return new s(r,i)},s.prototype.mul=function(e){for(var t=this._getNAFPoints(4),n=t.points,r=e.getNAF(t.wnd),i=new o(null,null,null),a=r.length-1;a>=0;a--){for(var l=0;a>=0&&0===r[a];a--,++l);if(a>=0&&(l+=1),i=i.dblp(l),a<0)break;var u=r[a];i=u>0?i.mixedAdd(n[u-1>>1]):i.mixedAdd(n[-u-1>>1].neg())}return s.fromECJPoint(i)},s.prototype._getNAFPoints1=function(){return{wnd:1,points:[this]}},s.prototype._getNAFPoints=function(e){var t=new Array((1<{r(i.subtle.sign({name:"HMAC"},t,n).then(t=>e.from(t)),o)};t.create=function(e,t,n){const l=s[e];r(i.subtle.importKey("raw",t,{name:"HMAC",hash:{name:l}},!1,["sign"]).then(t=>({digest(e,n){a(t,e,n)},length:o[e]})),n)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(22);function i(e){return r.isMultiaddr(e)?e:r(e)}e.exports={ensureMultiaddr:i}},function(e,t,n){var r={ECB:n(817),CBC:n(818),CFB:n(819),CFB8:n(820),CFB1:n(821),OFB:n(822),CTR:n(394),GCM:n(394)},i=n(396);for(var o in i)i[o].module=r[i[o].mode];e.exports=i},function(e,t,n){var r=n(155),i=n(5).Buffer,o=n(395);function s(e){var t=e._cipher.encryptBlockRaw(e._prev);return o(e._prev),t}var a=16;t.encrypt=function(e,t){var n=Math.ceil(t.length/16),o=e._cache.length;e._cache=i.concat([e._cache,i.allocUnsafe(16*n)]);for(var a=0;a0||o>0;){var c=new i;c.update(u),c.update(e),t&&c.update(t),u=c.digest();var h=0;if(s>0){var f=a.length-s;h=Math.min(s,u.length),u.copy(a,f,0,h),s-=h}if(h0){var p=l.length-o,d=Math.min(o,u.length-h);u.copy(l,p,h,h+d),o-=d}}return u.fill(0),{key:a,iv:l}}e.exports=o},function(e,t,n){"use strict";(function(t){const r=n(70),i=n(15),o=n(31);function s(e){let n;if("string"==typeof e)n=e;else if(t.isBuffer(e))n=r.encode(e).toString();else if(i.isPeerId(e))n=e.toB58String();else{if(!o.isPeerInfo(e))throw new Error("not valid PeerId or PeerInfo, or B58Str");n=e.id.toB58String()}return n}class a{constructor(){this._peers={}}has(e){const t=s(e);return Boolean(this._peers[t])}put(e,t){const n=this._peers[e.id.toB58String()];if(!n||t)return this._peers[e.id.toB58String()]=e,e;e.multiaddrs.forEach(e=>n.multiaddrs.add(e));const r=e.isConnected();return r&&n.connect(r),e.protocols.forEach(e=>n.protocols.add(e)),!n.id.privKey&&e.id.privKey&&(n.id.privKey=e.id.privKey),!n.id.pubKey&&e.id.pubKey&&(n.id.pubKey=e.id.pubKey),n}get(e){const t=s(e),n=this._peers[t];if(n)return n;throw new Error("PeerInfo not found")}getAll(){return this._peers}getAllArray(){return Object.keys(this._peers).map(e=>this._peers[e])}getMultiaddrs(e){const t=this.get(e);return t.multiaddrs.toArray()}remove(e){const t=s(e);this._peers[t]&&delete this._peers[t]}}e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";n.r(t),n.d(t,"struct",function(){return K}),n.d(t,"superstruct",function(){return z}),n.d(t,"isStruct",function(){return y}),n.d(t,"StructError",function(){return r});class r extends TypeError{static format(e){const{type:t,path:n,value:r}=e,i=`Expected a value of type \`${t}\`${n.length?` for \`${n.join(".")}\``:""} but received \`${JSON.stringify(r)}\`.`;return i}constructor(e){const t=r.format(e);super(t);const{data:n,path:i,value:o,reason:s,type:a,errors:l=[]}=e;this.data=n,this.path=i,this.value=o,this.reason=s,this.type=a,this.errors=l,l.length||l.push(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack}}var i=Object.prototype.toString,o=function e(t){if(void 0===t)return"undefined";if(null===t)return"null";var n=typeof t;if("boolean"===n)return"boolean";if("string"===n)return"string";if("number"===n)return"number";if("symbol"===n)return"symbol";if("function"===n)return h(t)?"generatorfunction":"function";if(a(t))return"array";if(d(t))return"buffer";if(p(t))return"arguments";if(u(t))return"date";if(l(t))return"error";if(c(t))return"regexp";switch(s(t)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(f(t))return"generator";switch(n=i.call(t),n){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return n.slice(8,-1).toLowerCase().replace(/\s/g,"")};function s(e){return e.constructor?e.constructor.name:null}function a(e){return Array.isArray?Array.isArray(e):e instanceof Array}function l(e){return e instanceof Error||"string"==typeof e.message&&e.constructor&&"number"==typeof e.constructor.stackTraceLimit}function u(e){return e instanceof Date||"function"==typeof e.toDateString&&"function"==typeof e.getDate&&"function"==typeof e.setDate}function c(e){return e instanceof RegExp||"string"==typeof e.flags&&"boolean"==typeof e.ignoreCase&&"boolean"==typeof e.multiline&&"boolean"==typeof e.global}function h(e,t){return"GeneratorFunction"===s(e)}function f(e){return"function"==typeof e.throw&&"function"==typeof e.return&&"function"==typeof e.next}function p(e){try{if("number"==typeof e.length&&"function"==typeof e.callee)return!0}catch(e){if(-1!==e.message.indexOf("callee"))return!0}return!1}function d(e){return!(!e.constructor||"function"!=typeof e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const m="@@__STRUCT__@@",g="@@__KIND__@@";function y(e){return!(!e||!e[m])}function v(e,t){return"function"==typeof e?e(t):e}var b=Object.assign||function(e){for(var t=1;t1?D(e,t,n):j(e,t,n);case"function":return x(e,t,n);case"object":return B(e,t,n);case"string":{let r=!0,i;if(e.endsWith("?")&&(r=!1,e=e.slice(0,-1)),e.includes("|")){const r=e.split(/\s*\|\s*/g);i=M(r,t,n)}else if(e.includes("&")){const r=e.split(/\s*&\s*/g);i=F(r,t,n)}else i=N(e,t,n);return r||(i=O(i,void 0,n)),i}}throw new Error(`Invalid schema: ${e}`)}function k(e,t,n){if("array"!==o(e)||2!==e.length)throw new Error(`Invalid schema: ${e}`);const r=N("object",void 0,n),i=w(e[0],void 0,n),s=w(e[1],void 0,n),a="dict",l=`dict<${i.type},${s.type}>`,u=e=>{const n=v(t);e=n?b({},n,e):e;const[o]=r.validate(e);if(o)return o.type=l,[o];const a={},u=[];for(let t in e){const n=e[t],[r,o]=i.validate(t);if(r){const n=r.errors||[r];n.forEach(n=>{n.path=[t].concat(n.path),n.data=e,u.push(n)});continue}t=o;const[l,c]=s.validate(n);if(l){const n=l.errors||[l];n.forEach(n=>{n.path=[t].concat(n.path),n.data=e,u.push(n)})}else a[t]=c}if(u.length){const e=u[0];return e.errors=u,[e]}return[void 0,a]};return new _(a,l,u)}function E(e,t,n){if("array"!==o(e))throw new Error(`Invalid schema: ${e}`);const r="enum",i=e.map(e=>{try{return JSON.stringify(e)}catch(t){return String(e)}}).join(" | "),s=(n=v(t))=>e.includes(n)?[void 0,n]:[{data:n,path:[],value:n,type:i}];return new _(r,i,s)}function S(e,t,n){const r=E(e,void 0,n),i=j([r],t,n);return i}function x(e,t,n){if("function"!==o(e))throw new Error(`Invalid schema: ${e}`);const r="function",i="",s=(n=v(t),r)=>{const s=e(n,r);let a={path:[],reason:null},l;switch(o(s)){case"boolean":l=s;break;case"string":l=!1,a.reason=s;break;case"object":l=!1,a=b({},a,s);break;default:throw new Error(`Invalid result: ${s}`)}return l?[void 0,n]:[b({type:i,value:n,data:n},a)]};return new _(r,i,s)}function C(e,t,n){const r="instance",i=`instance<${e.name}>`,o=(n=v(t))=>n instanceof e?[void 0,n]:[{data:n,path:[],value:n,type:i}];return new _(r,i,o)}function A(e,t,n){if("object"!==o(e))throw new Error(`Invalid schema: ${e}`);const r=[],i={};for(const t in e){r.push(t);const o=e[t],s=w(o,void 0,n);i[t]=s}const s="interface",a=`{${r.join()}}`,l=e=>{const n=v(t);e=n?b({},n,e):e;const r=[],o=e;for(const n in i){let s=e[n];const a=i[n];if(void 0===s){const r=t&&t[n];s=v(r,e)}const[l,u]=a.validate(s,e);if(l){const t=l.errors||[l];t.forEach(t=>{t.path=[n].concat(t.path),t.data=e,r.push(t)})}else(n in e||void 0!==u)&&(o[n]=u)}if(r.length){const e=r[0];return e.errors=r,[e]}return[void 0,o]};return new _(s,a,l)}function T(e,t,n){if("function"!==o(e))throw new Error(`Invalid schema: ${e}`);let r,i;const s="lazy",a="lazy...",l=t=>(i=e(),r.name=i.kind,r.type=i.type,r.validate=i.validate,r.validate(t));return r=new _(s,a,l),r}function I(e,t,n){if("function"!==o(e))throw new Error(`Invalid schema: ${e}`);const r="dynamic",i="dynamic...",s=(n=v(t),r)=>{const i=e(n,r);if("function"!==o(i))throw new Error(`Invalid schema: ${i}`);const[s,a]=i.validate(n);return s?[s]:[void 0,a]};return new _(r,i,s)}function j(e,t,n){if("array"!==o(e)||1!==e.length)throw new Error(`Invalid schema: ${e}`);const r=N("array",void 0,n),i=w(e[0],void 0,n),s="list",a=`[${i.type}]`,l=(e=v(t))=>{const[n,o]=r.validate(e);if(n)return n.type=a,[n];e=o;const s=[],l=[];for(let t=0;t{n.path=[t].concat(n.path),n.data=e,s.push(n)})}else l[t]=o}if(s.length){const e=s[0];return e.errors=s,[e]}return[void 0,l]};return new _(s,a,l)}function R(e,t,n){const r="literal",i=`literal: ${JSON.stringify(e)}`,o=(n=v(t))=>n===e?[void 0,n]:[{data:n,path:[],value:n,type:i}];return new _(r,i,o)}function B(e,t,n){if("object"!==o(e))throw new Error(`Invalid schema: ${e}`);const r=N("object",void 0,n),i=[],s={};for(const t in e){i.push(t);const r=e[t],o=w(r,void 0,n);s[t]=o}const a="object",l=`{${i.join()}}`,u=(e=v(t))=>{const[n]=r.validate(e);if(n)return n.type=l,[n];const i=[],o={},a=Object.keys(e),u=Object.keys(s),c=new Set(a.concat(u));if(c.forEach(n=>{let r=e[n];const a=s[n];if(void 0===r){const i=t&&t[n];r=v(i,e)}if(!a){const t={data:e,path:[n],value:r};return void i.push(t)}const[l,u]=a.validate(r,e);if(l){const t=l.errors||[l];t.forEach(t=>{t.path=[n].concat(t.path),t.data=e,i.push(t)})}else(n in e||void 0!==u)&&(o[n]=u)}),i.length){const e=i[0];return e.errors=i,[e]}return[void 0,o]};return new _(a,l,u)}function O(e,t,n){return M([e,"undefined"],t,n)}function P(e,t,n){if("object"!==o(e))throw new Error(`Invalid schema: ${e}`);const r=N("object",void 0,n),i=[],s={};for(const t in e){i.push(t);const r=e[t],o=w(r,void 0,n);s[t]=o}const a="partial",l=`{${i.join()},...}`,u=(e=v(t))=>{const[n]=r.validate(e);if(n)return n.type=l,[n];const i=[],o={};for(const n in s){let r=e[n];const a=s[n];if(void 0===r){const i=t&&t[n];r=v(i,e)}const[l,u]=a.validate(r,e);if(l){const t=l.errors||[l];t.forEach(t=>{t.path=[n].concat(t.path),t.data=e,i.push(t)})}else(n in e||void 0!==u)&&(o[n]=u)}if(i.length){const e=i[0];return e.errors=i,[e]}return[void 0,o]};return new _(a,l,u)}function N(e,t,n){if("string"!==o(e))throw new Error(`Invalid schema: ${e}`);const{types:r}=n,i=r[e];if("function"!==o(i))throw new Error(`Invalid type: ${e}`);const s=x(i,t,n),a="scalar",l=e,u=e=>{const[t,n]=s.validate(e);return t?(t.type=l,[t]):[void 0,n]};return new _(a,l,u)}function D(e,t,n){if("array"!==o(e))throw new Error(`Invalid schema: ${e}`);const r=e.map(e=>w(e,void 0,n)),i=N("array",void 0,n),s="tuple",a=`[${r.map(e=>e.type).join()}]`,l=(e=v(t))=>{const[n]=i.validate(e);if(n)return n.type=a,[n];const o=[],s=[],l=Math.max(e.length,r.length);for(let t=0;t{n.path=[t].concat(n.path),n.data=e,s.push(n)})}else o[t]=l}if(s.length){const e=s[0];return e.errors=s,[e]}return[void 0,o]};return new _(s,a,l)}function M(e,t,n){if("array"!==o(e))throw new Error(`Invalid schema: ${e}`);const r=e.map(e=>w(e,void 0,n)),i="union",s=r.map(e=>e.type).join(" | "),a=(e=v(t))=>{const n=[];for(const t of r){const[r,i]=t.validate(e);if(!r)return[void 0,i];n.push(r)}return n[0].type=s,n};return new _(i,s,a)}function F(e,t,n){if("array"!==o(e))throw new Error(`Invalid schema: ${e}`);const r=e.map(e=>w(e,void 0,n)),i="intersection",s=r.map(e=>e.type).join(" & "),a=(e=v(t))=>{let n=e;for(const e of r){const[t,r]=e.validate(n);if(t)return t.type=s,[t];n=r}return[void 0,n]};return new _(i,s,a)}const L={any:w,dict:k,enum:E,enums:S,function:x,instance:C,interface:A,lazy:T,list:j,literal:R,object:B,optional:O,partial:P,scalar:N,tuple:D,union:M,intersection:F,dynamic:I},U=["arguments","array","boolean","buffer","error","float32array","float64array","function","generatorfunction","int16array","int32array","int8array","map","null","number","object","promise","regexp","set","string","symbol","uint16array","uint32array","uint8array","uint8clampedarray","undefined","weakmap","weakset"],q={any:e=>void 0!==e};function z(e={}){const t=b({},q,e.types||{});function n(e,n,i={}){y(e)&&(e=e.schema);const o=L.any(e,n,b({},i,{types:t}));function s(e){if(this instanceof s)throw new Error("Invalid `new` keyword!");return s.assert(e)}return Object.defineProperty(s,m,{value:!0}),Object.defineProperty(s,g,{value:o}),s.kind=o.name,s.type=o.type,s.schema=e,s.defaults=n,s.options=i,s.assert=(e=>{const[t,n]=o.validate(e);if(t)throw new r(t);return n}),s.test=(e=>{const[t]=o.validate(e);return!t}),s.validate=(e=>{const[t,n]=o.validate(e);return t?[new r(t)]:[void 0,n]}),s}return Object.keys(L).forEach(e=>{const r=L[e];n[e]=((e,i,o)=>{const s=r(e,i,b({},o,{types:t})),a=n(s,i,o);return a})}),n}U.forEach(e=>{q[e]=(t=>o(t)===e)}),q.date=(e=>"date"===o(e)&&!isNaN(e));const K=z()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var r=n(58),i=h(r),o=n(147),s=h(o),a=n(86),l=h(a),u=n(37),c=h(u);function h(e){return e&&e.__esModule?e:{default:e}}function f(e,t,n){n=n||i.default;var r=(0,s.default)(t)?[]:{};e(t,function(e,t,n){(0,c.default)(e)(function(e,i){arguments.length>2&&(i=(0,l.default)(arguments,1)),r[t]=i,n(e)})},function(e){n(e,r)})}e.exports=t.default},function(e,t,n){"use strict";(function(t){const r=n(121),i=n(39),o="/",s=t.from(o),a=s[0];class l{constructor(e,n){if("string"==typeof e?this._buf=t.from(e):t.isBuffer(e)&&(this._buf=e),null==n&&(n=!0),n&&this.clean(),0===this._buf.length||this._buf[0]!==a)throw new Error(`Invalid key: ${this.toString()}`)}toString(e){return this._buf.toString(e||"utf8")}toBuffer(){return this._buf}get[Symbol.toStringTag](){return`[Key ${this.toString()}]`}static withNamespaces(e){return new h(e.join(o))}static random(){return new h(r().replace(/-/g,""))}clean(){for(this._buf&&0!==this._buf.length||(this._buf=t.from(o)),this._buf[0]!==a&&(this._buf=t.concat([s,this._buf]));this._buf.length>1&&this._buf[this._buf.length-1]===a;)this._buf=this._buf.slice(0,-1)}less(e){const t=this.list(),n=e.list();for(let e=0;ei)return!1}return t.length>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);function i(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}e.exports=i},function(e,t,n){"use strict";const r=n(13);e.exports.dbOpenFailedError=(e=>(e=e||new Error("Cannot open database"),r(e,"ERR_DB_OPEN_FAILED"))),e.exports.dbDeleteFailedError=(e=>(e=e||new Error("Delete failed"),r(e,"ERR_DB_DELETE_FAILED"))),e.exports.dbWriteFailedError=(e=>(e=e||new Error("Write failed"),r(e,"ERR_DB_WRITE_FAILED"))),e.exports.notFoundError=(e=>(e=e||new Error("Not Found"),r(e,"ERR_NOT_FOUND")))},function(e,t,n){"use strict";const r=n(203),i=n(839),o=n(841),s=n(843),a=n(844),l=n(408);t.KeytransformDatastore=r,t.ShardingDatastore=i,t.MountDatastore=o,t.TieredDatastore=s,t.NamespaceDatastore=a,t.shard=l},function(e,t,n){"use strict";const r=n(28).Key,i=n(840),o=t.PREFIX="/repo/flatfs/shard/",s=t.SHARDING_FN="SHARDING";t.README_FN="_README";class a{constructor(e){this.param=e}fun(e){throw new Error("implement me")}toString(){return`${o}v1/${this.name}/${this.param}`}}class l extends a{constructor(e){super(e),this._padding="".padStart(e,"_"),this.name="prefix"}fun(e){return(e+this._padding).slice(0,this.param)}}class u extends a{constructor(e){super(e),this._padding="".padStart(e,"_"),this.name="suffix"}fun(e){const t=this._padding+e;return t.slice(t.length-this.param)}}class c extends a{constructor(e){super(e),this._padding="".padStart(e+1,"_"),this.name="next-to-last"}fun(e){const t=this._padding+e,n=t.length-this.param-1;return t.slice(n,n+this.param)}}function h(e){if(e=e.trim(),0===e.length)throw new Error("empty shard string");if(!e.startsWith(o))throw new Error(`invalid or no path prefix: ${e}`);const t=e.slice(o.length).split("/"),n=t[0];if("v1"!==n)throw new Error(`expect 'v1' version, got '${n}'`);const r=t[1];if(!t[2])throw new Error("missing param");const i=parseInt(t[2],10);switch(r){case"prefix":return new l(i);case"suffix":return new u(i);case"next-to-last":return new c(i);default:throw new Error(`unkown sharding function: ${r}`)}}t.readShardFun=((e,t,n)=>{const i=new r(e).child(new r(s)),o="function"==typeof t.getRaw?t.getRaw.bind(t):t.get.bind(t);o(i,(e,t)=>{if(e)return n(e);let r;try{r=h((t||"").toString().trim())}catch(e){return n(e)}n(null,r)})}),t.readme=i,t.parseShardFun=h,t.Prefix=l,t.Suffix=u,t.NextToLast=c},function(e,t,n){"use strict";var r=function(e,t){return t||(t={}),e.split("").forEach(function(e,n){e in t||(t[e]=n)}),t},i={alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",charmap:{0:14,1:8}};i.charmap=r(i.alphabet,i.charmap);var o={alphabet:"0123456789ABCDEFGHJKMNPQRSTVWXYZ",charmap:{O:0,I:1,L:1}};o.charmap=r(o.alphabet,o.charmap);var s={alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",charmap:{}};function a(e){if(this.buf=[],this.shift=8,this.carry=0,e){switch(e.type){case"rfc4648":this.charmap=t.rfc4648.charmap;break;case"crockford":this.charmap=t.crockford.charmap;break;case"base32hex":this.charmap=t.base32hex.charmap;break;default:throw new Error("invalid type")}e.charmap&&(this.charmap=e.charmap)}}function l(e){if(this.buf="",this.shift=3,this.carry=0,e){switch(e.type){case"rfc4648":this.alphabet=t.rfc4648.alphabet;break;case"crockford":this.alphabet=t.crockford.alphabet;break;case"base32hex":this.alphabet=t.base32hex.alphabet;break;default:throw new Error("invalid type")}e.alphabet?this.alphabet=e.alphabet:e.lc&&(this.alphabet=this.alphabet.toLowerCase())}}s.charmap=r(s.alphabet,s.charmap),a.prototype.charmap=i.charmap,a.prototype.write=function(e){var t=this.charmap,n=this.buf,r=this.shift,i=this.carry;return e.toUpperCase().split("").forEach(function(e){if("="!=e){var o=255&t[e];r-=5,r>0?i|=o<>-r),r+=8,i=o<>t,this.buf+=this.alphabet[31&r],t>5&&(t-=5,r=i>>t,this.buf+=this.alphabet[31&r]),t=5-t,n=i<{const n=e+"/"+s;o("locking %s",n),a[n]=!0;const r={close(e){a[n]&&delete a[n],i(e)}};i(()=>{t(null,r)})}),t.locked=((e,t)=>{const n=e+"/"+s;o("checking lock: %s");const r=a[n];i(()=>{t(null,r)})})},function(e,t,n){"use strict";e.exports=n(872)},function(e,t,n){"use strict";function r(e,t){return t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,n){var r=n(21);n(196),n(117),n(252),n(97),n(881),n(152),n(253),n(883),n(250),n(30);var i=r.asn1,o=e.exports=r.pki=r.pki||{},s=o.oids,a={};a.CN=s.commonName,a.commonName="CN",a.C=s.countryName,a.countryName="C",a.L=s.localityName,a.localityName="L",a.ST=s.stateOrProvinceName,a.stateOrProvinceName="ST",a.O=s.organizationName,a.organizationName="O",a.OU=s.organizationalUnitName,a.organizationalUnitName="OU",a.E=s.emailAddress,a.emailAddress="E";var l=r.pki.rsa.publicKeyValidator,u={name:"Certificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},l,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},c={name:"rsapss",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},h={name:"CertificationRequestInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},l,{name:"CertificationRequestInfo.attributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0}]}]}]},f={name:"CertificationRequest",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[h,{name:"CertificationRequest.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function p(e,t){"string"==typeof t&&(t={shortName:t});for(var n=null,r,i=0;null===n&&i2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(m.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(h.validity.notBefore=m[0],h.validity.notAfter=m[1],h.tbsCertificate=n.tbsCertificate,t){if(h.md=null,h.signatureOid in s){var c=s[h.signatureOid];switch(c){case"sha1WithRSAEncryption":h.md=r.md.sha1.create();break;case"md5WithRSAEncryption":h.md=r.md.md5.create();break;case"sha256WithRSAEncryption":h.md=r.md.sha256.create();break;case"sha384WithRSAEncryption":h.md=r.md.sha384.create();break;case"sha512WithRSAEncryption":h.md=r.md.sha512.create();break;case"RSASSA-PSS":h.md=r.md.sha256.create()}}if(null===h.md){var l=new Error("Could not compute certificate digest. Unknown signature OID.");throw l.signatureOid=h.signatureOid,l}var g=i.toDer(h.tbsCertificate);h.md.update(g.getBytes())}var v=r.md.sha1.create();h.issuer.getField=function(e){return p(h.issuer,e)},h.issuer.addField=function(e){y([e]),h.issuer.attributes.push(e)},h.issuer.attributes=o.RDNAttributesAsArray(n.certIssuer,v),n.certIssuerUniqueId&&(h.issuer.uniqueId=n.certIssuerUniqueId),h.issuer.hash=v.digest().toHex();var b=r.md.sha1.create();return h.subject.getField=function(e){return p(h.subject,e)},h.subject.addField=function(e){y([e]),h.subject.attributes.push(e)},h.subject.attributes=o.RDNAttributesAsArray(n.certSubject,b),n.certSubjectUniqueId&&(h.subject.uniqueId=n.certSubjectUniqueId),h.subject.hash=b.digest().toHex(),n.certExtensions?h.extensions=o.certificateExtensionsFromAsn1(n.certExtensions):h.extensions=[],h.publicKey=o.publicKeyFromAsn1(n.subjectPublicKeyInfo),h},o.certificateExtensionsFromAsn1=function(e){for(var t=[],n=0;n1&&(o=n.value.charCodeAt(1),a=n.value.length>2?n.value.charCodeAt(2):0),t.digitalSignature=128==(128&o),t.nonRepudiation=64==(64&o),t.keyEncipherment=32==(32&o),t.dataEncipherment=16==(16&o),t.keyAgreement=8==(8&o),t.keyCertSign=4==(4&o),t.cRLSign=2==(2&o),t.encipherOnly=1==(1&o),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var n=i.fromDer(t.value);n.value.length>0&&n.value[0].type===i.Type.BOOLEAN?t.cA=0!==n.value[0].value.charCodeAt(0):t.cA=!1;var l=null;n.value.length>0&&n.value[0].type===i.Type.INTEGER?l=n.value[0].value:n.value.length>1&&(l=n.value[1].value),null!==l&&(t.pathLenConstraint=i.derToInteger(l))}else if("extKeyUsage"===t.name)for(var n=i.fromDer(t.value),u=0;u1&&(o=n.value.charCodeAt(1)),t.client=128==(128&o),t.server=64==(64&o),t.email=32==(32&o),t.objsign=16==(16&o),t.reserved=8==(8&o),t.sslCA=4==(4&o),t.emailCA=2==(2&o),t.objCA=1==(1&o)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var h;t.altNames=[];for(var n=i.fromDer(t.value),f=0;f0&&t.value.push(o.certificateExtensionsToAsn1(e.extensions)),t},o.getCertificationRequestInfo=function(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),m(e.subject),o.publicKeyToAsn1(e.publicKey),_(e)]);return t},o.distinguishedNameToAsn1=function(e){return m(e)},o.certificateToAsn1=function(e){var t=e.tbsCertificate||o.getTBSCertificate(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),b(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},o.certificateExtensionsToAsn1=function(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,3,!0,[]),n=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(n);for(var r=0;rc.validity.notAfter)&&(l={message:"Certificate is not valid yet or has expired.",error:o.certificateError.certificate_expired,notBefore:c.validity.notBefore,notAfter:c.validity.notAfter,now:s}),null===l){if(h=t[0]||e.getIssuer(c),null===h&&c.isIssuer(c)&&(f=!0,h=c),h){var p=h;r.util.isArray(p)||(p=[p]);for(var d=!1;!d&&p.length>0;){h=p.shift();try{d=h.verify(c)}catch(e){}}d||(l={message:"Certificate signature is invalid.",error:o.certificateError.bad_certificate})}null!==l||h&&!f||e.hasCertificate(c)||(l={message:"Certificate is not trusted.",error:o.certificateError.unknown_ca})}if(null===l&&h&&!c.isIssuer(h)&&(l={message:"Certificate issuer is invalid.",error:o.certificateError.bad_certificate}),null===l)for(var m={keyUsage:!0,basicConstraints:!0},g=0;null===l&&gv.pathLenConstraint&&(l={message:"Certificate basicConstraints pathLenConstraint violated.",error:o.certificateError.bad_certificate})}}var w=null===l||l.error,k=n?n(w,u,i):w;if(!0!==k)throw!0===w&&(l={message:"The application rejected the certificate.",error:o.certificateError.bad_certificate}),(k||0===k)&&("object"!=typeof k||r.util.isArray(k)?"string"==typeof k&&(l.error=k):(k.message&&(l.message=k.message),k.error&&(l.error=k.error))),l;l=null,a=!1,++u}while(t.length>0);return!0}},function(e,t){function n(e,t,n){var r;return function(){if(!t)return e.apply(this,arguments);var i=this,o=arguments,s=n&&!r;return clearTimeout(r),r=setTimeout(function(){if(r=null,!s)return e.apply(i,o)},t),s?e.apply(this,arguments):void 0}}e.exports=n},function(e,t,n){"use strict";var r=n(898);function i(e){return Number.isFinite(e)}function o(e){return"function"==typeof e}function s(e,t){return t?function(n,r){var i=setTimeout(function(){e(new Error("pull-reader: read exceeded timeout"),r)},t);e(n,function(e,t){clearTimeout(i),r(e,t)})}:e}e.exports=function(e){var t=[],n,a,l=!1,u=r(),c,h,f;function p(){for(;t.length;)if(null==t[0].length&&u.has(1))t.shift().cb(null,u.get());else if(u.has(t[0].length)){var e=t.shift();e.cb(null,u.get(e.length))}else if(1==c&&t[0].length&&u.length 0 to the moving average constructor");let n,i=0,o=0,s=0,a,l={};function u(e,n){return 1-r(-(e-n)/t)}return l.push=function e(t,r){if(a){const e=u(t,a),l=r-n,c=e*l;n=e*r+(1-e)*n,i=(1-e)*(i+l*c),o=Math.sqrt(i),s=n+e*l}else n=r;a=t},l.movingAverage=function e(){return n},l.variance=function e(){return i},l.deviation=function e(){return o},l.forecast=function e(){return s},l}},function(e,t,n){"use strict";const{createFromPrivKey:r}=n(15),i=n(43),o=n(904),s=n(13),a=n(4),l=a("ipfs:ipns");l.error=a("ipfs:ipns:error");const u=n(905),c=n(911),h=n(912),f=n(433),p=6e4;class d{constructor(e,t,n,r,i){this.publisher=new u(e,t),this.republisher=new c(this.publisher,t,n,r,i),this.resolver=new h(e),this.cache=new o({max:1e3}),this.routing=e}publish(e,t,n,o){i([t=>r(e.bytes,t),r=>this.publisher.publishWithEOL(e,t,n,r)],(e,r)=>{if(e)return l.error(e),o(e);l(`IPNS value ${t} was published correctly`);const i=r[0].toB58String(),s=parseFloat(n),a=s{if(t)return l.error(t),n(t);l(`IPNS record from ${e} was resolved correctly`),n(null,{path:r})})}initializeKeyspace(e,t,n){this.publisher.publish(e,t,n)}}t=e.exports=d,t.path=f},function(e,t,n){"use strict";const r=n(200),i=n(4),o=i("ipfs:ipns:path");o.error=i("ipfs:ipns:path:error");const s=(e,t,n)=>{if(r.ipnsPath(t))return o(`resolve ipns path ${t}`),e._ipns.resolve(t,n);e.dag.get(t.substring("/ipfs/".length),(e,t)=>e?n(e):n(null,t))};e.exports={resolvePath:s}},function(e,t,n){"use strict";(function(r){const i=n(158),{fromB58String:o,toB58String:s}=n(27),a=n(914),l=n(39),u=n(13),c=n(4),h=c("ipfs:ipns:pubsub");h.error=c("ipfs:ipns:pubsub:error");class f{constructor(e,t,n){this._pubsub=e,this._subscriptions={},this._handleSubscriptionKey=this._handleSubscriptionKey.bind(this),this._pubsubDs=new a(e,t,n,i.validator,this._handleSubscriptionKey)}put(e,t,n){this._pubsubDs.put(e,t,n)}get(e,t){this._pubsubDs.get(e,(n,r)=>{const o=e.slice(0,i.namespaceLength);if(o.toString()===i.namespace){const t=e.toString(),n=s(e.slice(i.namespaceLength));this._subscriptions[t]=n,h(`subscribed pubsub ${t}: ${n}`)}if(n)return t(n);t(null,r)})}_handleSubscriptionKey(e,t){const n=this._subscriptions[e];if(!n){const n=`key ${e} does not correspond to a subscription`;return h.error(n),t(u(new Error(n),"ERR_INVALID_KEY"))}let r;try{r=i.getIdKeys(o(n))}catch(e){return h.error(e),t(e)}t(null,r.routingKey.toBuffer())}getSubscriptions(e){const t=Object.values(this._subscriptions).filter(Boolean);return e(null,t.map(e=>`${i.namespace}${e}`))}cancel(e,t){if("string"!=typeof e){const e="received subscription name is not valid";return h.error(e),t(u(new Error(e),"ERR_INVALID_SUBSCRIPTION_NAME"))}e.startsWith(i.namespace)&&(e=e.substring(i.namespaceLength));const n=Object.keys(this._subscriptions).find(t=>this._subscriptions[t]===e);if(!n)return t(null,{canceled:!1});try{const e=r.from(n);this._pubsubDs.unsubscribe(e)}catch(e){return t(e)}this._subscriptions[n]=void 0,h(`unsubscribed pubsub ${n}: ${e}`),t(null,{canceled:!0})}}t=e.exports=l(f,{className:"IpnsPubsubDatastore",symbolName:"@js-ipfs/ipns/IpnsPubsubDatastore"})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const{Key:i}=n(28),{Record:o}=n(123),{encodeBase32:s}=n(438),a=n(13),l=n(4),u=l("ipfs:ipns:offline-datastore");u.error=l("ipfs:ipns:offline-datastore:error");class c{constructor(e){this._repo=e}put(e,t,n){if(!r.isBuffer(e)){const e="Offline datastore key must be a buffer";return u.error(e),n(a(new Error(e),"ERR_INVALID_KEY"))}if(!r.isBuffer(t)){const e="Offline datastore value must be a buffer";return u.error(e),n(a(new Error(e),"ERR_INVALID_VALUE"))}let i;try{i=this._routingKey(e)}catch(e){const t="Not possible to generate the routing key";return u.error(t),n(a(new Error(t),"ERR_GENERATING_ROUTING_KEY"))}const s=new o(e,t);this._repo.datastore.put(i,s.serialize(),n)}get(e,t){if(!r.isBuffer(e)){const e="Offline datastore key must be a buffer";return u.error(e),t(a(new Error(e),"ERR_INVALID_KEY"))}let n;try{n=this._routingKey(e)}catch(e){const n="Not possible to generate the routing key";return u.error(n),t(a(new Error(n),"ERR_GENERATING_ROUTING_KEY"))}this._repo.datastore.get(n,(e,n)=>{if(e)return t(e);let r;try{r=o.deserialize(n)}catch(e){return u.error(e),t(e)}t(null,r.value)})}_routingKey(e){return new i("/"+s(e),!1)}}t=e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){var r=n(920);e.exports=function(e,t,n){for(var i=-1,o=[],s=n?t.length:0;(i=r(e,t))>-1;)o.push(e.slice(0,i+s)),e=e.slice(i+t.length,e.length);return o.push(e),o}},function(e,t,n){"use strict";(function(e,n){t.toCallback=(t=>(function(n,r){let i;try{i=t(n)}catch(t){return void e.nextTick(r,t)}e.nextTick(r,null,i)})),t.toBuf=((e,t)=>r=>{let i=e(r,t);return n.from(i,"hex")}),t.fromString=((e,t)=>r=>{const i=n.isBuffer(r)?r.toString():r;return e(i,t)}),t.fromNumberTo32BitBuf=((e,t)=>r=>{let i=e(r,t);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return n.from(o)})}).call(this,n(3),n(0).Buffer)},function(e,t,n){"use strict";const r=n(60),i=n(158);e.exports={encodeBase32:e=>{const t=r.encode("base32",e).slice(1);return t.toString().toUpperCase()},validator:{func:(e,t,n)=>i.validator.validate(t,e,n)},selector:(e,t)=>i.validator.select(t[0],t[1])}},function(e,t,n){"use strict";const r=n(202),i=n(89),o=n(438);function s({datastore:e,peerInfo:t,peerBook:s,options:a,config:l}){const u={datastore:e,peerInfo:t,peerBook:s,config:{peerDiscovery:{mdns:{enabled:r(a,"config.Discovery.MDNS.Enabled",r(l,"Discovery.MDNS.Enabled",!0))},webRTCStar:{enabled:r(a,"config.Discovery.webRTCStar.Enabled",r(l,"Discovery.webRTCStar.Enabled",!0))},bootstrap:{list:r(a,"config.Bootstrap",r(l,"Bootstrap",[]))}},relay:{enabled:r(a,"relay.enabled",r(l,"relay.enabled",!0)),hop:{enabled:r(a,"relay.hop.enabled",r(l,"relay.hop.enabled",!1)),active:r(a,"relay.hop.active",r(l,"relay.hop.active",!1))}},dht:{kBucketSize:r(a,"dht.kBucketSize",20),enabled:!1,randomWalk:{enabled:!1},validators:{ipns:o.validator},selectors:{ipns:o.selector}},EXPERIMENTAL:{pubsub:r(a,"EXPERIMENTAL.pubsub",!1)}},connectionManager:r(a,"connectionManager",{maxPeers:r(l,"Swarm.ConnMgr.HighWater"),minPeers:r(l,"Swarm.ConnMgr.LowWater")})},c=i(u,r(a,"libp2p",{})),h=n(930);return new h(c)}e.exports=function e(t,n){const r=t._options||{};n=n||{};const i="function"==typeof r.libp2p?r.libp2p:s,{datastore:o}=t._repo,a=t._peerInfo,l=t._peerInfoBook,e=i({options:r,config:n,datastore:o,peerInfo:a,peerBook:l});return e.on("stop",()=>{a.multiaddrs.clear()}),e.on("start",()=>{a.multiaddrs.forEach(e=>{t._print("Swarm listening on",e.toString())})}),e.on("peer:connect",e=>l.put(e)),e}},function(e,t,n){"use strict";const r=n(931),i=n(72),o=n(39),s=n(64).Connection,a=n(441),l=n(4),u=l("libp2p:websockets:dialer"),c=n(940);class h{dial(e,t,n){"function"==typeof t&&(n=t,t={}),n=n||function(){};const i=a(e);u("dialing %s",i);const o=r(i,{binary:!0,onConnect:e=>{n(e)}}),l=new s(o);return l.getObservedAddrs=(t=>t(null,[e])),l.close=(e=>o.close(e)),l}createListener(e,t){return"function"==typeof e&&(t=e,e={}),c(e,t)}filter(e){return Array.isArray(e)||(e=[e]),e.filter(e=>!e.protoNames().includes("p2p-circuit")&&(e.protoNames().includes("ipfs")&&(e=e.decapsulate("ipfs")),i.WebSockets.matches(e)||i.WebSocketsSecure.matches(e)))}}e.exports=o(h,{className:"WebSockets",symbolName:"@libp2p/js-libp2p-websockets/websockets"})},function(e,t,n){const r=n(22),i=(e,t)=>t,o={ip4:i,ip6:(e,t,n,r)=>1===r.length&&"ip6"===r[0].protocol?t:`[${t}]`,tcp:(e,t,n,r)=>r.some(e=>["http","https","ws","wss"].includes(e.protocol))?`${e}:${t}`:`tcp://${e}:${t}`,udp:(e,t)=>`udp://${e}:${t}`,dnsaddr:i,dns4:i,dns6:i,ipfs:(e,t)=>`${e}/ipfs/${t}`,p2p:(e,t)=>`${e}/p2p/${t}`,http:e=>`http://${e}`,https:e=>`https://${e}`,ws:e=>`ws://${e}`,wss:e=>`wss://${e}`,"p2p-websocket-star":e=>`${e}/p2p-websocket-star`,"p2p-webrtc-star":e=>`${e}/p2p-webrtc-star`,"p2p-webrtc-direct":e=>`${e}/p2p-webrtc-direct`};e.exports=(e=>r(e).stringTuples().map(e=>({protocol:r.protocols.codes[e[0]].name,content:e[1]})).reduce((e,t,n,r)=>{const i=o[t.protocol];if(!i)throw new Error(`Unsupported protocol ${t.protocol}`);return i(e,t.content,n,r)},""))},function(e,t,n){var r=n(942),i=n(266),o=n(446),s=n(208)("socket.io-client");e.exports=t=l;var a=t.managers={};function l(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var n=r(e),i=n.source,l=n.id,u=n.path,c=a[l]&&u in a[l].nsps,h=t.forceNew||t["force new connection"]||!1===t.multiplex||c,f;return h?(s("ignoring socket cache for %s",i),f=o(i,t)):(a[l]||(s("new io instance for %s",i),a[l]=o(i,t)),f=a[l]),n.query&&!t.query&&(t.query=n.query),f.socket(n.path,t)}t.protocol=i.protocol,t.connect=l,t.Manager=n(446),t.Socket=n(452)},function(e,t){var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function e(t){var i=t,o=t.indexOf("["),s=t.indexOf("]");-1!=o&&-1!=s&&(t=t.substring(0,o)+t.substring(o,s).replace(/:/g,";")+t.substring(s,t.length));for(var a=n.exec(t||""),l={},u=14;u--;)l[r[u]]=a[u]||"";return-1!=o&&-1!=s&&(l.source=i,l.host=l.host.substring(1,l.host.length-1).replace(/;/g,":"),l.authority=l.authority.replace("[","").replace("]","").replace(/;/g,":"),l.ipv6uri=!0),l}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){(function(t){e.exports=o;var n="function"==typeof t&&"function"==typeof t.isBuffer,r="function"==typeof ArrayBuffer,i=function(e){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer};function o(e){return n&&t.isBuffer(e)||r&&(e instanceof ArrayBuffer||i(e))}}).call(this,n(0).Buffer)},function(e,t,n){var r=n(949),i=n(452),o=n(124),s=n(266),a=n(453),l=n(454),u=n(208)("socket.io-client:manager"),c=n(451),h=n(966),f=Object.prototype.hasOwnProperty;function p(e,t){if(!(this instanceof p))return new p(e,t);e&&"object"==typeof e&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new h({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=t.parser||s;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}e.exports=p,p.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)f.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},p.prototype.updateSocketIds=function(){for(var e in this.nsps)f.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},p.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},o(p.prototype),p.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},p.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},p.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},p.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},p.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},p.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},p.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},p.prototype.open=p.prototype.connect=function(e,t){if(u("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;u("opening %s",this.uri),this.engine=r(this.uri,this.opts);var n=this.engine,i=this;this.readyState="opening",this.skipReconnect=!1;var o=a(n,"open",function(){i.onopen(),e&&e()}),s=a(n,"error",function(t){if(u("connect_error"),i.cleanup(),i.readyState="closed",i.emitAll("connect_error",t),e){var n=new Error("Connection error");n.data=t,e(n)}else i.maybeReconnectOnOpen()});if(!1!==this._timeout){var l=this._timeout;u("connect attempt will timeout after %d",l);var c=setTimeout(function(){u("connect attempt timed out after %d",l),o.destroy(),n.close(),n.emit("error","timeout"),i.emitAll("connect_timeout",l)},l);this.subs.push({destroy:function(){clearTimeout(c)}})}return this.subs.push(o),this.subs.push(s),this},p.prototype.onopen=function(){u("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(a(e,"data",l(this,"ondata"))),this.subs.push(a(e,"ping",l(this,"onping"))),this.subs.push(a(e,"pong",l(this,"onpong"))),this.subs.push(a(e,"error",l(this,"onerror"))),this.subs.push(a(e,"close",l(this,"onclose"))),this.subs.push(a(this.decoder,"decoded",l(this,"ondecoded")))},p.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},p.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},p.prototype.ondata=function(e){this.decoder.add(e)},p.prototype.ondecoded=function(e){this.emit("packet",e)},p.prototype.onerror=function(e){u("error",e),this.emitAll("error",e)},p.prototype.socket=function(e,t){var n=this.nsps[e];if(!n){n=new i(this,e,t),this.nsps[e]=n;var r=this;n.on("connecting",o),n.on("connect",function(){n.id=r.generateId(e)}),this.autoConnect&&o()}function o(){~c(r.connecting,n)||r.connecting.push(n)}return n},p.prototype.destroy=function(e){var t=c(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},p.prototype.packet=function(e){u("writing packet %j",e);var t=this;e.query&&0===e.type&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,function(n){for(var r=0;r0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},p.prototype.cleanup=function(){u("cleanup");for(var e=this.subs.length,t=0;t=this._reconnectionAttempts)u("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();u("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var n=setTimeout(function(){e.skipReconnect||(u("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open(function(t){t?(u("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):(u("reconnect success"),e.onreconnect())}))},t);this.subs.push({destroy:function(){clearTimeout(n)}})}},p.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},function(e,t,n){var r=n(267),i=n(952),o=n(962),s=n(963);function a(e){var t,n=!1,s=!1,a=!1!==e.jsonp;if("undefined"!=typeof location){var l="https:"===location.protocol,u=location.port;u||(u=l?443:80),n=e.hostname!==location.hostname||u!==e.port,s=e.secure!==l}if(e.xdomain=n,e.xscheme=s,t=new r(e),"open"in t&&!e.forceJSONP)return new i(e);if(!a)throw new Error("JSONP disabled");return new o(e)}t.polling=a,t.websocket=s},function(e,t,n){var r=n(268),i=n(209),o=n(125),s=n(210),a=n(450),l=n(211)("engine.io-client:polling");e.exports=f;var u=(c=n(267),h=new c({xdomain:!1}),null!=h.responseType),c,h;function f(e){var t=e&&e.forceBase64;u&&!t||(this.supportsBinary=!1),r.call(this,e)}s(f,r),f.prototype.name="polling",f.prototype.doOpen=function(){this.poll()},f.prototype.pause=function(e){var t=this;function n(){l("paused"),t.readyState="paused",e()}if(this.readyState="pausing",this.polling||!this.writable){var r=0;this.polling&&(l("we are currently polling - waiting to pause"),r++,this.once("pollComplete",function(){l("pre-pause polling complete"),--r||n()})),this.writable||(l("we are currently writing - waiting to pause"),r++,this.once("drain",function(){l("pre-pause writing complete"),--r||n()}))}else n()},f.prototype.poll=function(){l("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},f.prototype.onData=function(e){var t=this;l("polling got data %s",e);var n=function(e,n,r){if("opening"===t.readyState&&t.onOpen(),"close"===e.type)return t.onClose(),!1;t.onPacket(e)};o.decodePayload(e,this.socket.binaryType,n),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():l('ignoring poll - transport state "%s"',this.readyState))},f.prototype.doClose=function(){var e=this;function t(){l("writing close packet"),e.write([{type:"close"}])}"open"===this.readyState?(l("transport open - closing"),t()):(l("transport not open - deferring close"),this.once("open",t))},f.prototype.write=function(e){var t=this;this.writable=!1;var n=function(){t.writable=!0,t.emit("drain")};o.encodePayload(e,this.supportsBinary,function(e){t.doWrite(e,n)})},f.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",n="";!1!==this.timestampRequests&&(e[this.timestampParam]=a()),this.supportsBinary||e.sid||(e.b64=1),e=i.encode(e),this.port&&("https"===t&&443!==Number(this.port)||"http"===t&&80!==Number(this.port))&&(n=":"+this.port),e.length&&(e="?"+e);var r=-1!==this.hostname.indexOf(":");return t+"://"+(r?"["+this.hostname+"]":this.hostname)+n+this.path+e}},function(e,t,n){(function(t){var r=n(954),i=Object.prototype.toString,o="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===i.call(Blob),s="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===i.call(File);function a(e){if(!e||"object"!=typeof e)return!1;if(r(e)){for(var n=0,i=e.length;n0);return t}function c(e){var t=0;for(a=0;a0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(7);u.inherits=n(1);var c={deprecate:n(50)},h=n(457),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(458),y;function v(){}function b(e,t){l=l||n(126),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var u=!1===e.decodeStrings;this.decodeStrings=!u,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(l=l||n(126),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(3),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(126),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length"string"==typeof e,object:e=>"object"==typeof e,multiaddr:e=>{if(u.string(e))try{return i(e),!0}catch(e){return!1}},function:e=>"function"==typeof e};function c(e,t){if(!Array.isArray(t))throw new Error("Data is not an array");e.forEach((e,n)=>{if(!u[e])throw console.error("Type %s does not exist",e),new Error("Type "+e+" does not exist");if(!u[e](t[n]))throw new Error("Data at index "+n+" is invalid for type "+e)})}function h(e){e||(e=(()=>{}));const t=this;t.requests={},t.addRequest=((e,n,r)=>{t.requests[e]={def:n,handle:r}}),t.handleSocket=(n=>{n.r={},Object.keys(t.requests).forEach(r=>{const i=t.requests[r];n.on(r,function(){const t=[...arguments];try{c(i.def,t),t.unshift(n),i.handle.apply(null,t)}catch(i){e(i),e("peer %s has sent invalid data for request %s",n.id||"",r,t)}})})})}function f(e,t,n){o.createFromPubKey(r.from(e,"hex"),(i,o)=>i?n(new Error("Crypto error")):o.toB58String()!==t?n(new Error("Id is not matching")):n(null,s.keys.unmarshalPublicKey(r.from(e,"hex"))))}t=e.exports,t.cleanUrlSIO=l,t.validate=c,t.Protocol=h,t.getIdAndValidate=f,t.validateMa=(e=>a.WebSocketStar.matches(i(e)))}).call(this,n(0).Buffer)},function(e,t,n){var r=n(981),i=n(121),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,t,n){"use strict";e.exports="/mplex/6.7.0"},function(e,t,n){"use strict";const r=n(27),i=n(44),o=n(1004);class s{constructor(e,t,n){this.dht=e,this.key=t,this.makePath=n,this._log=i.logger(this.dht.peerInfo.id,"query:"+r.toB58String(t)),this.running=!1,this._onStart=this._onStart.bind(this),this._onComplete=this._onComplete.bind(this)}run(e,t){return this.dht._queryManager.running?0===e.length?(this._log.error("Running query with no peers"),t(null,{finalSet:new Set,paths:[]})):(this._run=new o(this),this._log(`query running with K=${this.dht.kBucketSize}, A=${this.dht.concurrency}, D=${Math.min(this.dht.disjointPaths,e.length)}`),this._run.once("start",this._onStart),this._run.once("complete",this._onComplete),void this._run.execute(e,t)):(this._log.error("Attempt to run query after shutdown"),t(null,{finalSet:new Set,paths:[]}))}_onStart(){this.running=!0,this._startTime=Date.now(),this._log("query:start"),this.dht._queryManager.queryStarted(this)}_onComplete(){this.stop()}stop(){this._log(`query:done in ${Date.now()-this._startTime}ms`),this._run&&this._log(`${this._run.errors.length} of ${this._run.peersSeen.size} peers errored (${this._run.errors.length/this._run.peersSeen.size*100}% fail rate)`),this.running&&(this._run.removeListener("start",this._onStart),this._run.removeListener("complete",this._onComplete),this.running=!1,this._run&&this._run.stop(),this.dht._queryManager.queryCompleted(this))}}e.exports=s},function(e,t){e.exports=function(e){if(!e)throw Error("hashlru must have a max value, of type number, greater than 0");var t=0,n=Object.create(null),r=Object.create(null);function i(i,o){n[i]=o,t++,t>=e&&(t=0,r=n,n=Object.create(null))}return{has:function(e){return void 0!==n[e]||void 0!==r[e]},remove:function(e){void 0!==n[e]&&(n[e]=void 0),void 0!==r[e]&&(r[e]=void 0)},get:function(e){var t=n[e];return void 0!==t?t:void 0!==(t=r[e])?(i(e,t),t):void 0},set:function(e,t){void 0!==n[e]?n[e]=t:i(e,t)},clear:function(){n=Object.create(null),r=Object.create(null)}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(273),i=a(r),o=n(334),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,i.default)(s.default),e.exports=t.default},function(e,t,n){"use strict";(function(t){const r=n(102),i=n(52),o=n(216),s=o.writeEncoded;function a(e,n,o){const a=r({timeout:6e4},n),l=a.handshake;return o("writing multicodec: "+e),s(l,t.from(e+"\n"),n),i.decodeFromReader(l,(t,r)=>{if(t)return n(t);const i=r.toString().slice(0,-1);if(i!==e)return n(new Error(`"${e}" not supported`),l.rest());o("received ack: "+i),n(null,l.rest())}),a}e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";function r(e,t,n){const r=e===t;n(null,r)}e.exports=r},function(e,t,n){"use strict";t=e.exports,t.PROTOCOL_ID="/multistream/1.0.0"},function(e,t,n){"use strict";const r=n(160),i=n(274),o=n(215),s=n(39),a=n(472),l=n(36),u=n(47),c=n(280),h=n(13),{msHandle:f,msSelect:p,identifyDialer:d}=n(279),m=n(282),{CONNECTION_FAILED:g,DIAL_SELF:y,INVALID_STATE_TRANSITION:v,NO_TRANSPORTS_REGISTERED:b,maybeUnexpectedEnd:_}=n(217);class w extends a{constructor({_switch:e,peerInfo:t,muxer:n,conn:i,type:o="out"}){super({_switch:e,name:`${o}:${e._peerInfo.id.toB58String().slice(0,8)}`}),this.theirPeerInfo=t,this.theirB58Id=this.theirPeerInfo.id.toB58String(),this.conn=i,this.muxer=n;let s="DISCONNECTED";this.muxer&&(s="MUXED"),this._state=r(s,{DISCONNECTED:{dial:"DIALING",disconnect:"DISCONNECTED",done:"DISCONNECTED"},DIALING:{abort:"ABORTED",done:"DIALED",error:"ERRORED",disconnect:"DISCONNECTING"},DIALED:{encrypt:"ENCRYPTING",privatize:"PRIVATIZING"},PRIVATIZING:{done:"PRIVATIZED",abort:"ABORTED",disconnect:"DISCONNECTING"},PRIVATIZED:{encrypt:"ENCRYPTING"},ENCRYPTING:{done:"ENCRYPTED",error:"ERRORED",disconnect:"DISCONNECTING"},ENCRYPTED:{upgrade:"UPGRADING",disconnect:"DISCONNECTING"},UPGRADING:{stop:"CONNECTED",done:"MUXED",error:"ERRORED",disconnect:"DISCONNECTING"},MUXED:{disconnect:"DISCONNECTING"},CONNECTED:{disconnect:"DISCONNECTING"},DISCONNECTING:{done:"DISCONNECTED",disconnect:"DISCONNECTING"},ABORTED:{},ERRORED:{disconnect:"DISCONNECTING"}}),this._state.on("DISCONNECTED",()=>this._onDisconnected()),this._state.on("DIALING",()=>this._onDialing()),this._state.on("DIALED",()=>this._onDialed()),this._state.on("PRIVATIZING",()=>this._onPrivatizing()),this._state.on("PRIVATIZED",()=>this._onPrivatized()),this._state.on("ENCRYPTING",()=>this._onEncrypting()),this._state.on("ENCRYPTED",()=>{this.log("successfully encrypted connection to %s",this.theirB58Id),this.emit("encrypted",this.conn)}),this._state.on("UPGRADING",()=>this._onUpgrading()),this._state.on("MUXED",()=>{this.log("successfully muxed connection to %s",this.theirB58Id),delete this.switch.conns[this.theirB58Id],this.emit("muxed",this.muxer)}),this._state.on("CONNECTED",()=>{this.log("unmuxed connection opened to %s",this.theirB58Id),this.emit("unmuxed",this.conn)}),this._state.on("DISCONNECTING",()=>this._onDisconnecting()),this._state.on("ABORTED",()=>this._onAborted()),this._state.on("ERRORED",()=>this._onErrored()),this._state.on("error",e=>this._onStateError(e))}dial(){return this.theirB58Id===this.ourPeerInfo.id.toB58String()?this.emit("error",y()):"DIALING"===this.getState()?this.log("attempted to dial while already dialing, ignoring"):void this._state("dial")}shake(e,t){return e?this.muxer&&this.muxer.newStream?this.muxer.newStream((n,r)=>{if(n)return t(n,null);this.log("created new stream to %s",this.theirB58Id),this._protocolHandshake(e,r,t)}):void this._protocolHandshake(e,this.conn,t):t(null,null)}upgrade(){this._state("upgrade")}_onDialing(){if(this.log("dialing %s",this.theirB58Id),!this.switch.hasTransports())return this.close(b());const e=this.switch.availableTransports(this.theirPeerInfo),t=Boolean(this.switch.transports[i.tag]);t&&!e.includes(i.tag)&&e.push(i.tag);const n=r=>{let o=r;if(!o)return t?this.close(g(`No available transports to dial peer ${this.theirB58Id}!`)):this.close(g(`Circuit not enabled and all transports failed to dial peer ${this.theirB58Id}!`));o===i.tag&&this.theirPeerInfo.multiaddrs.add(`/p2p-circuit/p2p/${this.theirB58Id}`),this.log("dialing transport %s",o),this.switch.transport.dial(o,this.theirPeerInfo,(t,r)=>{if(t)return this.emit("error:connection_attempt_failed",t),this.log(t),n(e.shift());this.conn=m(o,null,r,this.switch.observer),this._state("done")})};n(e.shift())}_onDialed(){this.log("successfully dialed %s",this.theirB58Id),this.emit("connected",this.conn)}_onDisconnecting(){this.log("disconnecting from %s",this.theirB58Id,Boolean(this.muxer)),delete this.switch.conns[this.theirB58Id];let e=[];if(this.muxer&&e.push(e=>{this.muxer.end(()=>{delete this.muxer,e()})}),this.conn){try{this.conn.source.abort()}catch(e){}delete this.conn}l(e,()=>{this._state("done")})}_onEncrypting(){const e=new o.Dialer;e.handle(this.conn,t=>{if(t)return this.close(_(t));this.log("selecting crypto %s to %s",this.switch.crypto.tag,this.theirB58Id),e.select(this.switch.crypto.tag,(e,t)=>{if(e)return this.close(_(e));const n=m(null,this.switch.crypto.tag,t,this.switch.observer),r=this.switch.crypto.encrypt(this.ourPeerInfo.id,n,this.theirPeerInfo.id,e=>{if(e)return this.close(e);this.conn=r,this.conn.setPeerInfo(this.theirPeerInfo),this._state("done")})})})}_onUpgrading(){const e=Object.keys(this.switch.muxers);if(this.log("upgrading connection to %s",this.theirB58Id),0===e.length)return this._state("stop");const t=new o.Dialer;t.handle(this.conn,n=>{if(n)return this._didUpgrade(n);const r=n=>{this.log("selecting %s",n),t.select(n,(t,i)=>{if(t)return 0===e.length?this._didUpgrade(t):r(e.shift());const o=m(null,n,i,this.switch.observer);this.muxer=this.switch.muxers[n].dialer(o),this.muxer.once("close",()=>{this.close()}),this.muxer.on("stream",e=>{this.log("new stream created via muxer to %s",this.theirB58Id),e.setPeerInfo(this.theirPeerInfo),this.switch.protocolMuxer(null)(e)}),this._didUpgrade(null),this.switch.identify&&this._identify((e,t)=>{if(e)return this.close(e);this.theirPeerInfo=this.switch._peerBook.put(t.peerInfo)})})};r(e.shift())})}_identify(e){if(!this.muxer)return u(e,h("The connection was already closed","ERR_CONNECTION_CLOSED"));this.muxer.newStream(async(t,n)=>{if(t)return e(t);const r=new o.Dialer;let i;try{await f(r,n);const o=await p(r,c.multicodec);i=await d(o,this.theirPeerInfo)}catch(t){return e(t)}e(null,i)})}_didUpgrade(e){if(e)return this.log("Error upgrading connection:",e),this.switch.conns[this.theirB58Id]=this,this.emit("error:upgrade_failed",e),this._state("stop");this._state("done")}_protocolHandshake(e,t,n){const r=new o.Dialer;r.handle(t,t=>{if(t)return n(t,null);r.select(e,(t,r)=>{if(t)return this.log("could not perform protocol handshake:",t),n(t,null);const i=m(null,e,r,this.switch.observer);this.log("successfully performed handshake of %s to %s",e,this.theirB58Id),this.emit("connection",i),n(null,i)})})}_onStateError(e){this.emit("error",v(e)),this.log(e)}}e.exports=s(w,{className:"ConnectionFSM",symbolName:"libp2p-switch/ConnectionFSM"})},function(e,t,n){"use strict";const r=n(6).EventEmitter,i=n(4),o=n(39);class s extends r{constructor({_switch:e,name:t}){super(),this.switch=e,this.ourPeerInfo=this.switch._peerInfo,this.log=i(`libp2p:conn:${t}`),this.log.error=i(`libp2p:conn:${t}:error`)}close(e){"DISCONNECTING"!==this._state._state&&(this.log("closing connection to %s",this.theirB58Id),e&&this._events.error&&this.emit("error",e),this._state("disconnect"))}emit(e,...t){"error"!==e||this._events.error?super.emit(e,...t):this.log.error(...t)}getState(){return this._state._state}encrypt(){this._state("encrypt")}protect(){this._state("privatize")}upgrade(){this._state("upgrade")}_onDisconnected(){this.switch.connection.remove(this),this.log("disconnected from %s",this.theirB58Id),this.emit("close"),this.removeAllListeners()}_onPrivatized(){this.emit("private",this.conn)}_onPrivatizing(){if(!this.switch.protector)return this._state("done");this.conn=this.switch.protector.protect(this.conn,e=>{if(e)return this.close(e);this.log("successfully privatized conn to %s",this.theirB58Id),this.conn.setPeerInfo(this.theirPeerInfo),this._state("done")})}}e.exports=o(s,{className:"BaseConnection",symbolName:"libp2p-switch/BaseConnection"})},function(e,t,n){"use strict";const r=n(20);e.exports={tag:"/plaintext/1.0.0",encrypt:(e,t,n,i)=>("function"==typeof n&&(i=n,n=void 0),r(()=>i()),t)}},function(e,t,n){"use strict";const r=n(15),i=n(31),o=n(22);function s(e,t){let n;if(i.isPeerInfo(e))return t.put(e);if(o.isMultiaddr(e)){const o=e.getPeerId();try{n=t.get(o)}catch(e){n=new i(r.createFromB58String(o))}return n.multiaddrs.add(e),n}if(r.isPeerId(e)){const n=e.toB58String();try{return t.get(n)}catch(e){throw new Error(`Couldnt get PeerInfo for ${n}`)}}throw new Error("peer type not recognized")}e.exports=s},function(e,t,n){"use strict";var r=n(1056);function i(e,t,n){var i=this;function o(){i._rescheduled>0?(i._scheduled=i._rescheduled-(r()-i._started),i._timer=setTimeout(o,i._scheduled),i._rescheduled=0):e.apply(null,i._args)}this._started=r(),this._rescheduled=0,this._scheduled=t,this._args=n,this._timer=setTimeout(o,t)}function o(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("timeout needed");var e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function l(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function u(){try{return window.localStorage}catch(e){}}t=e.exports=n(1097),t.log=s,t.formatArgs=o,t.save=a,t.load=l,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:u(),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(l())}).call(this,n(3))},function(e,t,n){"use strict";const r=n(6),i=n(12),o=n(88),s=n(38),a=n(1105),l=n(4),u=n(13),c=n(1107),h=n(290),{signMessage:f}=n(1110),p=n(1111),d=n(47);class m extends r{constructor(e,t,n,r){super(),r={signMessages:!0,...r},this.log=l(e),this.log.err=l(`${e}:error`),this.multicodec=t,this.libp2p=n,this.started=!1,r.signMessages&&(this.peerId=this.libp2p.peerInfo.id),this.topics=new Map,this.seenCache=new a,this.peers=new Map,this._dials=new Set,this._onConnection=this._onConnection.bind(this),this._dialPeer=this._dialPeer.bind(this)}_addPeer(e){const t=e.info.id.toB58String();let n=this.peers.get(t);return n||(this.log("new peer",t),this.peers.set(t,e),n=e,e.once("close",()=>this._removePeer(e))),++n._references,n}_removePeer(e){const t=e.info.id.toB58String();return this.log("remove",t,e._references),0==--e._references&&(this.log("delete peer",t),this.peers.delete(t)),e}_dialPeer(e,t){t=t||function e(){};const n=e.id.toB58String(),r=this.peers.get(n);return r&&r.isConnected?d(()=>t()):this._dials.has(n)?(this.log("already dialing %s, ignoring dial attempt",n),d(()=>t())):(this._dials.add(n),this.log("dialing %s",n),void this.libp2p.dialProtocol(e,this.multicodec,(r,i)=>{this.log("dial to %s complete",n);const o=!this._dials.has(n);return this._dials.delete(n),r?(this.log.err(r),t()):o?(this.log("pubsub was stopped, not processing dial to %s",n),t()):void this._onDial(e,i,t)}))}_onDial(e,t,n){const r=e.id.toB58String();this.log("connected",r);const i=this._addPeer(new c(e));i.attachConnection(t),d(()=>n())}_onConnection(e,t){t.getPeerInfo((e,n)=>{if(e)return this.log.err("Failed to identify incomming conn",e),i(o(),t);const r=n.id.toB58String(),s=this._addPeer(new c(n));this._processConnection(r,t,s)})}_processConnection(e,t,n){throw u("_processConnection must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}_onConnectionEnd(e,t,n){n&&"socket hang up"!==n.message&&this.log.err(n),this.log("connection ended",e,n?n.message:""),this._removePeer(t)}_buildMessage(e,t){const n=p.normalizeOutRpcMessage(e);this.peerId?f(this.peerId,n,t):d(t,null,n)}publish(e,t,n){throw u("publish must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}subscribe(e){throw u("subscribe must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}unsubscribe(e){throw u("unsubscribe must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}start(e){if(this.started)return d(()=>e(new Error("already started")));this.log("starting"),this.libp2p.handle(this.multicodec,this._onConnection),this.libp2p.on("peer:connect",this._dialPeer);const t=Object.values(this.libp2p.peerBook.getAll());s(t,(e,t)=>this._dialPeer(e,t),t=>{d(()=>{this.log("started"),this.started=!0,e(t)})})}stop(e){if(!this.started)return d(()=>e(new Error("not started yet")));this.libp2p.unhandle(this.multicodec),this.libp2p.removeListener("peer:connect",this._dialPeer),this._dials=new Set,this.log("stopping"),s(this.peers.values(),(e,t)=>e.close(t),t=>{if(t)return e(t);this.log("stopped"),this.peers=new Map,this.started=!1,e()})}}e.exports=m,e.exports.message=h,e.exports.utils=p},function(e){e.exports={name:"ipfs",version:"0.35.0",description:"JavaScript implementation of the IPFS specification",leadMaintainer:"Alan Shaw ",bin:{jsipfs:"src/cli/bin.js"},main:"src/core/index.js",browser:{"./src/core/components/init-assets.js":!1,"./src/core/runtime/add-from-fs-nodejs.js":"./src/core/runtime/add-from-fs-browser.js","./src/core/runtime/config-nodejs.js":"./src/core/runtime/config-browser.js","./src/core/runtime/dns-nodejs.js":"./src/core/runtime/dns-browser.js","./src/core/runtime/fetch-nodejs.js":"./src/core/runtime/fetch-browser.js","./src/core/runtime/libp2p-nodejs.js":"./src/core/runtime/libp2p-browser.js","./src/core/runtime/preload-nodejs.js":"./src/core/runtime/preload-browser.js","./src/core/runtime/repo-nodejs.js":"./src/core/runtime/repo-browser.js","./src/core/runtime/ipld-nodejs.js":"./src/core/runtime/ipld-browser.js","./test/utils/create-repo-nodejs.js":"./test/utils/create-repo-browser.js",stream:"readable-stream",joi:"joi-browser"},"browser-all-ipld-formats":{"./src/core/runtime/ipld-browser.js":"./src/core/runtime/ipld-browser-all.js"},engines:{node:">=10.0.0",npm:">=6.0.0"},scripts:{lint:"aegir lint",build:"aegir build",test:"aegir test -t node -t browser -t webworker --no-cors --timeout=10000","test:node":"aegir test -t node --timeout=10000","test:browser":"aegir test -t browser --no-cors --timeout=10000","test:webworker":"aegir test -t webworker --no-cors --timeout=10000","test:node:core":"aegir test -t node -f test/core/**/*.js --timeout=10000","test:node:http":"aegir test -t node -f test/http-api/index.js --timeout=10000","test:node:gateway":"aegir test -t node -f test/gateway/index.js --timeout=10000","test:node:cli":"aegir test -t node -f test/cli/index.js --timeout=10000","test:node:interface":"aegir test -t node -f test/core/interface.spec.js --timeout=10000","test:bootstrapers":"IPFS_TEST=bootstrapers aegir test -t browser -f test/bootstrapers.js --timeout=10000",benchmark:'echo "Error: no benchmarks yet" && exit 1',"benchmark:node":'echo "Error: no benchmarks yet" && exit 1',"benchmark:node:core":'echo "Error: no benchmarks yet" && exit 1',"benchmark:node:http":'echo "Error: no benchmarks yet" && exit 1',"benchmark:browser":'echo "Error: no benchmarks yet" && exit 1',release:"aegir release -t node -t browser","release-minor":"aegir release --type minor -t node -t browser","release-major":"aegir release --type major -t node -t browser"},repository:{type:"git",url:"git+https://github.com/ipfs/js-ipfs.git"},keywords:["IPFS"],license:"MIT",bugs:{url:"https://github.com/ipfs/js-ipfs/issues"},homepage:"https://github.com/ipfs/js-ipfs#readme",devDependencies:{aegir:"^18.1.0",chai:"^4.2.0",delay:"^4.1.0","detect-node":"^2.0.4","dir-compare":"^1.4.0","dirty-chai":"^2.0.1",execa:"^1.0.0","form-data":"^2.3.3",hat:"0.0.3","interface-ipfs-core":"~0.99.1","ipfsd-ctl":"~0.42.0","libp2p-websocket-star":"~0.10.2",ncp:"^2.0.0",qs:"^6.5.2",rimraf:"^2.6.2",sinon:"^7.3.1","stream-to-promise":"^2.2.0"},dependencies:{async:"^2.6.1","bignumber.js":"^8.0.2","binary-querystring":"~0.1.2",bl:"^3.0.0",boom:"^7.2.0",bs58:"^4.0.1",byteman:"^1.3.5","cid-tool":"~0.2.0",cids:"~0.5.8","class-is":"^1.1.0","datastore-core":"~0.6.0","datastore-pubsub":"~0.1.1",debug:"^4.1.0",dlv:"^1.1.2","err-code":"^1.1.2","file-type":"^10.2.0",fnv1a:"^1.0.1","fsm-event":"^2.1.0","get-folder-size":"^2.0.0",glob:"^7.1.3",hapi:"^18.0.0","hapi-pino":"^5.2.0","human-to-milliseconds":"^1.0.0","interface-datastore":"~0.6.0","ipfs-bitswap":"~0.23.0","ipfs-block":"~0.8.0","ipfs-block-service":"~0.15.1","ipfs-http-client":"^30.1.1","ipfs-http-response":"~0.2.1","ipfs-mfs":"~0.10.2","ipfs-multipart":"~0.1.0","ipfs-repo":"~0.26.1","ipfs-unixfs":"~0.1.16","ipfs-unixfs-exporter":"~0.36.1","ipfs-unixfs-importer":"~0.38.5",ipld:"~0.21.1","ipld-bitcoin":"~0.1.8","ipld-dag-cbor":"~0.13.1","ipld-dag-pb":"~0.15.3","ipld-ethereum":"^2.0.1","ipld-git":"~0.3.0","ipld-raw":"^2.0.1","ipld-zcash":"~0.1.6",ipns:"~0.5.0","is-ipfs":"~0.6.0","is-pull-stream":"~0.0.0","is-stream":"^1.1.0","iso-url":"~0.4.6",joi:"^14.3.0","just-flatten-it":"^2.1.0","just-safe-set":"^2.1.0",libp2p:"~0.25.0","libp2p-bootstrap":"~0.9.3","libp2p-crypto":"~0.16.0","libp2p-kad-dht":"~0.14.12","libp2p-keychain":"~0.4.1","libp2p-mdns":"~0.12.0","libp2p-mplex":"~0.8.4","libp2p-record":"~0.6.1","libp2p-secio":"~0.11.0","libp2p-tcp":"~0.13.0","libp2p-webrtc-star":"~0.15.5","libp2p-websocket-star-multi":"~0.4.0","libp2p-websockets":"~0.12.2",lodash:"^4.17.11",mafmt:"^6.0.2","merge-options":"^1.0.1","mime-types":"^2.1.21",mkdirp:"~0.5.1",multiaddr:"^6.0.0","multiaddr-to-uri":"^4.0.1",multibase:"~0.6.0",multicodec:"~0.5.0",multihashes:"~0.4.14","multihashing-async":"~0.5.1","node-fetch":"^2.3.0","peer-book":"~0.9.0","peer-id":"~0.12.0","peer-info":"~0.15.0",progress:"^2.0.1","promisify-es6":"^1.0.3",protons:"^1.0.1","pull-abortable":"^4.1.1","pull-cat":"^1.1.11","pull-defer":"~0.2.3","pull-file":"^1.1.0","pull-ndjson":"~0.1.1","pull-pushable":"^2.2.0","pull-sort":"^1.0.1","pull-stream":"^3.6.9","pull-stream-to-stream":"^1.3.4","readable-stream":"^3.1.1",receptacle:"^1.3.2","stream-to-pull-stream":"^1.7.3",superstruct:"~0.6.0","tar-stream":"^2.0.0",temp:"~0.9.0","update-notifier":"^2.5.0","uri-to-multiaddr":"^3.0.1",varint:"^5.0.0",yargs:"^13.2.2","yargs-promise":"^1.1.0"},optionalDependencies:{"prom-client":"^11.1.3","prometheus-gc-stats":"~0.6.0"},contributors:["0xflotus <0xflotus@gmail.com>","A_A <21040751+Otto-AA@users.noreply.github.com>","Alan Shaw ","Alan Shaw ","Alex North ","Alex Potsides ","Andrew Nesbitt ","Andrew de Andrade ","André Cruz ","Arkadiy Kukarkin ","Arpit Agarwal <93arpit@gmail.com>","Arpit Agarwal ","Bernard Mordan ","Brian Vander Schaaf ","Bruno Zell ","CHEVALAY JOSSELIN ","Caio Gondim ","Chance Hudson ","Christian Couder ","Dafeng ","Dan Ordille ","Daniel J. O'Quinn ","Daniela Borges Matos de Carvalho ","David Dias ","David Gilbertson ","David da Silva ","Diogo Silva ","Dmitriy Ryajov ","Dzmitry Das ","Enrico Marino ","Faheel Ahmad ","Felix Yan ","Francisco Baio Dias ","Francisco Baio Dias ","Friedel Ziegelmayer ","Gar ","Georgios Rassias ","Gorka Ludlow ","Grant Herman ","Greenkeeper ","Haad ","Haoliang Yu ","Harsh Vakharia ","Henrique Dias ","Henry Rodrick ","Heo Sangmin ","Hugo Dias ","Hugo Dias ","Irakli Gozalishvili ","Jacob Heun ","Jacob Heun ","Jade Meskill ","Johannes Wikner ","Jon Schlinkert ","Jonathan ","João Antunes ","João Santos ","Kevin Wang ","Lars Gierth ","Lukas Drgon ","Maciej Krüger ","Marcin Rataj ","Marius Darila ","Mat Kelly ","Michelle Lee ","Mikeal Rogers ","Mithgol ","Molly ","Mounish Sai ","My9Bot <34904312+My9Bot@users.noreply.github.com>","Nitin Patel <31539366+niinpatel@users.noreply.github.com>","Nuno Nogueira ","Oli Evans ","Oskar Nyberg ","Pascal Precht ","Pau Ramon Revilla ","Paulo Rodrigues ","Pedro Teixeira ","Portia Burton ","Raoul Millais ","RasmusErik Voel Jensen ","Richard Littauer ","Richard Schneider ","Rob Brackett ","Rod Keys ","Sangwon Hong ","Sid Harder ","SidHarder ","Stephen Whitmore ","Stephen Whitmore ","Steven Allen ","Terence Pae ","Uroš Jurglič ","Vasco Santos ","Vasco Santos ","Volker Mische ","Xiao Liang ","Yahya ","Yole ","bitspill ","datafatmunger ","dirkmc ","haad ","jbenet ","jonahweissman <19804455+jonahweissman@users.noreply.github.com>","kevingzhang ","kumavis ","nginnever ","npmcdn-to-unpkg-bot ","robbsolter <35879806+robbsolter@users.noreply.github.com>","seungwon-kang ","tcme ","victorbjelkholm ","Łukasz Magiera ","Максим Ильин "]}},function(e,t,n){"use strict";const r=n(2),i=n(261).repoVersion;e.exports=function e(t){return{init:(e,t,n)=>{},version:r(e=>{t._repo._isInitialized(n=>{if(n){const t=[/Key not found in database \[\/version\]/,/ENOENT/,/repo is not initialized yet/].some(e=>e.test(n.message));return t?e(null,i):e(n)}t._repo.version.get(e)})}),gc:r((e,t)=>{"function"==typeof e&&(t=e,e={}),t(new Error("Not implemented"))}),stat:r((e,n)=>{"function"==typeof e&&(n=e,e={}),t._repo.stat(e,(e,t)=>{if(e)return n(e);n(null,{numObjects:t.numObjects,repoSize:t.repoSize,repoPath:t.repoPath,version:t.version.toString(),storageMax:t.storageMax})})}),path:()=>t._repo.path}}},function(e,t,n){"use strict";e.exports=(()=>({Addresses:{Swarm:[],API:"",Gateway:""},Discovery:{MDNS:{Enabled:!1,Interval:10},webRTCStar:{Enabled:!0}},Bootstrap:["/dns4/ams-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd","/dns4/lon-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3","/dns4/sfo-3.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM","/dns4/sgp-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu","/dns4/nyc-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm","/dns4/nyc-2.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64","/dns4/node0.preload.ipfs.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic","/dns4/node1.preload.ipfs.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6"],Swarm:{ConnMgr:{LowWater:200,HighWater:500}}}))},function(e,t,n){"use strict";(function(t){const r=n(2),i=n(19),o=n(1141),s=n(128),a=n(164).isSource;e.exports=function(e){const n=r((n,r,l)=>{"function"==typeof r&&(l=r,r={}),r=r||{};const u=e=>t.isBuffer(e)||s.readable(e)||a(e),c=e=>"object"==typeof e&&(e.content?u(e.content):Boolean(e.path)&&"string"==typeof e.path),h=e=>u(e)||c(e),f=h(n)||Array.isArray(n)&&n.every(h);if(!f)return l(new Error("invalid input: expected buffer, readable stream, pull stream, object or array of objects"));i(i.values([n]),e.addPullStream(r),o((e,t)=>e.patht.path?-1:0),i.collect(l))});return function(){const e=Array.from(arguments);return 1===e.length&&a(e[0])&&e.push({}),n.apply(null,e)}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=n(1148)},function(e,t){e.exports=function(e){var t,n,r;function i(e){return n=e,function(e,i){r?t=[e,i]:n(e,i)}}return i.pause=function(){r||(r=!0,e&&e(r))},i.resume=function(){if(r&&(r=!1,e&&e(r),t)){var i=t;t=null,n(i[0],i[1])}},i}},function(e,t,n){"use strict";(function(t){e.exports=function e(n,r,i,o){const s=n.length,a=r+s;return i>=a||o=r&&o=r&&i{if(t=Object.assign({},g,t),!t.parentCid)return n(new Error("No parent CID passed to addLink"));if(!o.isCID(t.parentCid))return n(new Error("Invalid CID passed to addLink"));if(!t.parent)return l("Loading parent node",t.parentCid.toBaseEncodedString()),s([n=>e.ipld.get(t.parentCid,n),(e,t)=>t(null,e.value),(n,r)=>y(e,{...t,parent:n},r)],n);if(!t.cid)return n(new Error("No child cid passed to addLink"));if(!t.name)return n(new Error("No child name passed to addLink"));if(o.isCID(t.cid)||(t.cid=new o(t.cid)),!t.size&&0!==t.size)return n(new Error("No child size passed to addLink"));const r=u.unmarshal(t.parent.data);return"hamt-sharded-directory"===r.type?(l("Adding link to sharded directory"),_(e,t,n)):t.parent.links.length>=t.shardSplitThreshold?(l("Converting directory to sharded directory"),v(e,t,n)):(l(`Adding ${t.name} to regular directory`),void b(e,t,n))},v=(e,t,n)=>{p(e,t.parent.links.map(e=>({name:e.name,size:e.size,multihash:e.cid.buffer})).concat({name:t.name,size:t.size,multihash:t.cid.buffer}),{},(e,t)=>{e||l("Converted directory to sharded directory",t.cid.toBaseEncodedString()),n(e,t)})},b=(e,t,n)=>{s([e=>r.rmLink(t.parent,t.name,e),(e,n)=>r.addLink(e,new i(t.name,t.size,t.cid),n),(n,r)=>{e.ipld.put(n,{version:t.cidVersion,format:t.codec,hashAlg:t.hashAlg,hashOnly:!t.flush},(e,t)=>r(e,{node:n,cid:t}))}],n)},_=(e,t,n)=>w(e,t,(i,o)=>{if(i)return n(i);const{shard:a,path:l}=o;a.flush("",e.ipld,null,async(i,o)=>{if(i)return n(i);const a=t.parent.links.find(e=>e.name.substring(0,2)===l[0].prefix),u=o.node.links.find(e=>e.name.substring(0,2)===l[0].prefix);s([e=>{if(!a)return e(null,t.parent);r.rmLink(t.parent,a.name,e)},(e,t)=>r.addLink(e,u,t),(n,r)=>h(e,n.links,l[0].bucket,t,r)],n)})}),w=(e,t,n)=>{const r={name:t.name,cid:t.cid,size:t.size};f(t.parent.links,null,null,null,async(i,o)=>{if(i)return n(i);const s=new c({root:!0,dir:!0,parent:null,parentKey:null,path:"",dirty:!0,flat:!1});s._bucket=o;const u=await o._findNewBucketAndPos(r.name),h=k(u);h[0].node=t.parent;let p=0;a(()=>p{let n=h[p];p++;let i=n.node,a=i.links.find(e=>e.name.substring(0,2)===n.prefix);return a?a.name===`${n.prefix}${r.name}`?(l(`Link ${n.prefix}${r.name} will be replaced`),p=h.length,t(null,s)):a.name.length>2?(l(`Link ${a.name} will be replaced with a subshard`),p=h.length,t(null,s)):(l(`Found subshard ${n.prefix}`),void e.ipld.get(a.cid,(e,i)=>{if(e)return t(e);if(!h[p]){l(`Loaded new subshard ${n.prefix}`);const e=i.value;return f(e.links,o,n.bucket,parseInt(n.prefix,16),async n=>{if(n)return t(n);const i=await o._findNewBucketAndPos(r.name);return h.push({bucket:i.bucket,prefix:d(i.pos),node:e}),t(null,s)})}const a=h[p];m(i.value.links,a.bucket,o,e=>{a.node=i.value,t(e,s)})})):(l(`Link ${n.prefix}${r.name} will be added`),p=h.length,t(null,s))},(e,t)=>{if(e)return n(e);t.put(r.name,{size:r.size,multihash:r.cid.buffer},e=>{n(e,{shard:t,path:h})})})})},k=e=>{let t=e.bucket,n=e.pos,r=[{bucket:t,prefix:d(n)}];for(t=e.bucket._parent,n=e.bucket._posAtParent;t;)r.push({bucket:t,prefix:d(n)}),n=t._posAtParent,t=t._parent;return r.reverse(),r};e.exports=y},function(e,t,n){"use strict";(function(t){const{DAGNode:r}=n(34),i=n(10),o=n(154),s=n(43),a=n(294),l=n(225),u=n(4)("ipfs:mfs:core:utils:hamt-utils"),c=n(45),h=(e,n,o,s,a)=>{i([e=>{const i=t.from(o._children.bitField().reverse()),s=new c("hamt-sharded-directory",i);s.fanout=o.tableSize(),s.hashType=l.hashFn.code,r.create(s.marshal(),n,e)},(t,n)=>{e.ipld.put(t,{version:s.cidVersion,format:s.codec,hashAlg:s.hashAlg,hashOnly:!s.flush},(e,r)=>n(e,{node:t,cid:r}))}],a)},f=(e,t,n,r,i)=>{const o=new a({hashFn:l.hashFn,hash:n?n._options.hash:void 0},n,r);n&&n._putObjectAt(r,o),p(e,o,t,i)},p=(e,t,n,r)=>{Promise.all(e.map(e=>{if(2===e.name.length){const n=parseInt(e.name,16);return t._putObjectAt(n,new a({hashFn:l.hashFn},t,n)),Promise.resolve()}return(n||t).put(e.name.substring(2),{size:e.size,multihash:e.cid})})).then(()=>r(null,t),r)},d=e=>e.toString("16").toUpperCase().padStart(2,"0").substring(0,2),m=(e,t,n,r)=>{f(n.links,null,null,null,async(i,s)=>{if(i)return r(i);const a=await s._findNewBucketAndPos(t);let l=[{bucket:a.bucket,prefix:d(a.pos)}],c=a.bucket;for(;c!==s;)l.push({bucket:c,prefix:d(c._posAtParent)}),c=c._parent;l[l.length-1].node=n;let h=l.length;o(()=>h>0,n=>{h--;const r=l[h],i=r.node.links.filter(e=>e.name.substring(0,2)===r.prefix).pop();return i?i.name===`${r.prefix}${t}`?(u(`Link ${r.prefix}${t} will be replaced`),n(null,l)):(u(`Found subshard ${r.prefix}`),void e.ipld.get(i.cid,(e,i)=>{if(e)return n(e);if(!l[h-1]){u(`Loaded new subshard ${r.prefix}`);const e=i.value;return f(e.links,s,r.bucket,parseInt(r.prefix,16),async(r,i)=>{if(r)return n(r);const o=await s._findNewBucketAndPos(t);h++,l.unshift({bucket:o.bucket,prefix:d(o.pos),node:e}),n()})}const o=l[h-1];p(i.value.links,o.bucket,s,e=>{o.node=i.value,n(e)})})):(u(`Link ${r.prefix}${t} will be added`),n(null,l))},async(e,n)=>{await s.put(t,!0),r(e,{rootBucket:s,path:n})})})},g=(e,t,n,r)=>{const i=new l({root:!0,dir:!0,parent:null,parentKey:null,path:"",dirty:!0,flat:!1,...n}),o=t.map(e=>t=>{i.put(e.name,{size:e.size,multihash:e.multihash},t)});return s(o,t=>{if(t)return r(t);i.flush("",e.ipld,null,r)})};e.exports={generatePath:m,updateHamtDirectory:h,recreateHamtLevel:f,addLinksToHamtBucket:p,toPrefix:d,createShard:g}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=n(1201)},function(e,t){e.exports={WORKER_REQUEST_READ_LOCK:"lock:worker:request-read",WORKER_RELEASE_READ_LOCK:"lock:worker:release-read",MASTER_GRANT_READ_LOCK:"lock:master:grant-read",WORKER_REQUEST_WRITE_LOCK:"lock:worker:request-write",WORKER_RELEASE_WRITE_LOCK:"lock:worker:release-write",MASTER_GRANT_WRITE_LOCK:"lock:master:grant-write"}},function(e,t){const n={},r=e=>{e.addEventListener("message",t=>{r.dispatchEvent("message",e,t)}),e.port&&e.port.addEventListener("message",t=>{r.dispatchEvent("message",e,t)})};r.addEventListener=((e,t)=>{n[e]||(n[e]=[]),n[e].push(t)}),r.removeEventListener=((e,t)=>{n[e]&&(n[e]=n[e].filter(e=>e===t))}),r.dispatchEvent=function(){const e=Array.prototype.slice.call(arguments),t=e.shift();n[t]&&n[t].forEach(t=>t.apply(null,e))},e.exports=r},function(e,t,n){"use strict";const{FILE_SEPARATOR:r}=n(227),i=n(496),o=n(10),s=n(36),a=n(295),l="ipfs",u=(e,t,n)=>{let l=Array.isArray(t);const u=Array.isArray(t)?t:[t];o([t=>{s({paths:e=>{let t;try{t=u.map(e=>{if(e=(e||"").trim(),e=e.replace(/(\/\/+)/g,"/"),!e)throw new Error("paths must not be empty");if(e.substring(0,1)!==r)throw new Error(`paths must start with a leading ${r}`);return e.substring(e.length-r.length)===r&&(e=e.substring(0,e.length-r.length)),a(e)})}catch(t){return e(t)}e(null,t)},root:t=>i(e,t)},t)},({paths:e,root:t},n)=>{n(null,e.map(e=>{if("ipfs"===e[0]){let n;return n=2===e.length?`${r}${e.join(r)}`:`${r}${e.slice(0,e.length-1).join(r)}`,{type:"ipfs",depth:e.length-2,mfsPath:`${r}${e.join(r)}`,mfsDirectory:n,root:t,parts:e,path:`${r}${e.join(r)}`,name:e[e.length-1]}}const n=`/ipfs/${t.toBaseEncodedString()}/${e.join(r)}`,i=`/ipfs/${t.toBaseEncodedString()}/${e.slice(0,e.length-1).join(r)}`;return{type:"mfs",depth:e.length,mfsDirectory:i,mfsPath:n,root:t,parts:e,path:`${r}${e.join(r)}`,name:e[e.length-1]}}))},(e,t)=>{if(l)return t(null,e);t(null,e[0])}],n)};e.exports=u},function(e,t,n){"use strict";const r=n(9),i=n(45),{DAGNode:o}=n(34),s=n(4)("ipfs:mfs:utils:with-mfs-root"),a=n(10),{MFS_ROOT_KEY:l}=n(227),u=(e,t)=>{a([t=>e.repo.datastore.open(e=>t(e)),t=>{e.repo.datastore.get(l,(n,u)=>{if(n&&(n.notFound||"ERR_NOT_FOUND"===n.code))return s("Creating new MFS root"),a([e=>o.create(new i("directory").marshal(),e),(t,n)=>e.ipld.put(t,{version:0,hashAlg:"sha2-256",format:"dag-pb"},n),(t,n)=>e.repo.datastore.put(l,t.buffer,e=>n(e,t))],t);t(n,u?new r(u):null)})},(e,t)=>{s(`Fetched MFS root ${e.toBaseEncodedString()}`),t(null,e)}],t)};e.exports=u},function(e,t,n){"use strict";(function(t,r){var i=n(11);e.exports=E;var o=n(49),s;E.ReadableState=k;var a=n(6).EventEmitter,l=function(e,t){return e.listeners(t).length},u=n(498),c=n(5).Buffer,h=t.Uint8Array||function(){};function f(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof h}var d=n(7);d.inherits=n(1);var m=n(1223),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1224),v=n(499),b;d.inherits(E,u);var _=["error","close","destroy","pause","resume"];function w(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function k(e,t){s=s||n(129),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(b||(b=n(18).StringDecoder),this.decoder=new b(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||n(129),!(this instanceof E))return new E(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function S(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,R(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(7);u.inherits=n(1);var c={deprecate:n(50)},h=n(498),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(499),y;function v(){}function b(e,t){l=l||n(129),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var u=!1===e.decodeStrings;this.decodeStrings=!u,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(l=l||n(129),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(3),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(129),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length"object"==typeof e).pop()||{});Array.isArray(t[0])&&(t=t[0]);const s=t.filter(e=>"string"==typeof e).map(e=>e.trim());r(e,s,(e,t)=>{i(e,{sources:t,options:o})})}e.exports=i},function(e,t,n){"use strict";const r=n(10),i=n(36),{addLink:o,updateTree:s,updateMfsRoot:a,toTrail:l,toSourcesAndDestination:u,toMfsPath:c}=n(73),h=n(229),f=n(297),p=n(4)("ipfs:mfs:cp"),d={parents:!1,flush:!0,format:"dag-pb",hashAlg:"sha2-256",shardSplitThreshold:1e3};e.exports=(e=>(function t(){const n=Array.from(arguments),i=n.pop();r([t=>u(e,n,d,t),({sources:e,destination:t,options:n},r)=>e.length?t?(n.parents=n.p||n.parents,void r(null,{sources:e,destination:t,options:n})):r(new Error("Please supply a destination")):r(new Error("Please supply at least one source")),({sources:t,destination:n,options:r},i)=>l(e,n.mfsPath,r,(o,s)=>{if(o)return i(o);if(s.length===n.parts.length)return p("Destination does not exist"),1===t.length?(p("Only one source, copying to a file"),m(e,t.pop(),n,s,r,i)):(p("Multiple sources, copying to a directory"),g(e,t,n,s,r,i));const a=s[s.length-1];if("dir"===a.type)return p("Destination is a directory"),g(e,t,n,s,r,i);i(new Error("directory already has entry by that name"))})],i)}));const m=(e,t,n,i,l,u)=>{r([n=>y(e,t,l,n),(t,s)=>{const a=i[i.length-1],l=t[t.length-1];r([t=>e.ipld.get(a.cid,t),(t,r)=>o(e,{parent:t.value,parentCid:a.cid,size:l.size,cid:l.cid,name:n.parts[n.parts.length-1]},r),({node:e,cid:t},n)=>{a.node=e,a.cid=t,a.size=e.size,n(null,i)}],s)},(t,n)=>s(e,t,l,n),({cid:t},n)=>a(e,t,n)],e=>u(e))},g=(e,t,n,u,d,m)=>{r([t=>{if(u.length!==n.parts.length+1)return p("Making destination directory",n.path),r([t=>f(e)(n.path,d,t),t=>c(e,n.path,t),(t,r)=>{n=t,l(e,n.mfsPath,d,r)}],(e,n)=>{if(e)return t(e);u=n,t()});t()},n=>i(t.map(t=>n=>y(e,t,d,n)),n),(l,c)=>{r([r=>{i(t.map(t=>r=>{h(e)(`${n.path}/${t.name}`,d,e=>{if(e)return e.message.includes("does not exist")?r():r(e);r(new Error("directory already has entry by that name"))})}),e=>r(e))},n=>{const i=u[u.length-1];r([t=>e.ipld.get(i.cid,t),(e,t)=>t(null,{cid:i.cid,node:e.value})].concat(l.map((n,r)=>(i,s)=>{const a=n[n.length-1];p(`Adding ${t[r].name} to ${i.cid.toBaseEncodedString()}`),o(e,{parent:i.node,parentCid:i.cid,size:a.size,cid:a.cid,name:t[r].name},(e,t)=>{if(e)return s(e);p(`New directory hash ${t.cid.toBaseEncodedString()}`),s(e,t)})})),n)},({node:e,cid:t},n)=>{const r=u[u.length-1];r.node=e,r.cid=t,r.size=e.size,n(null,u)},(t,n)=>s(e,t,d,n),({cid:t},n)=>a(e,t,n)],c)}],e=>m(e))},y=(e,t,n,r)=>{l(e,t.mfsPath,n,(e,n)=>e?r(e):"ipfs"===t.type?r(null,n):n.length!==t.parts.length+1?r(new Error(`${t.path} does not exist`)):void r(null,n))}},function(e,t,n){"use strict";const r=n(10),i=n(43),{updateTree:o,updateMfsRoot:s,toSources:a,removeLink:l,toMfsPath:u,toTrail:c,FILE_SEPARATOR:h}=n(73),f={recursive:!1,cidVersion:0,hashAlg:"sha2-256",format:"dag-pb"};e.exports=(e=>(function t(){const n=Array.from(arguments),o=n.pop();r([t=>a(e,n,f,t),({sources:t,options:n},r)=>{if(!t.length)return r(new Error("Please supply at least one path to remove"));i(t.map(t=>r=>p(e,t.path,n,r)),e=>r(e))}],o)}));const p=(e,t,n,i)=>{if(t===h)return i(new Error("Cannot delete root"));r([n=>u(e,t,n),({mfsPath:t,parts:r},i)=>c(e,t,n,(e,n)=>i(e,{mfsPath:t,parts:r,trail:n})),({trail:i},o)=>{const s=i.pop(),a=i[i.length-1];return a?"dir"!==s.type||n.recursive?void r([t=>l(e,{parentCid:a.cid,name:s.name},t),({cid:e},t)=>{a.cid=e,t(null,i)}],o):o(new Error(`${t} is a directory, use -r to remove directories`)):o(new Error(`${t} does not exist`))},(t,r)=>o(e,t,n,r),({cid:t},n)=>s(e,t,n)],i)}},function(e,t,n){"use strict";const r=n(163).OFFLINE_ERROR,i=n(2),o=n(20),s=n(55),a=n(9),l=n(15),u=n(13);function c(e,t){return Array.from(e).map(e=>({"/":e[1].cid.toBaseEncodedString()}))}e.exports=function e(t){return{wantlist:i((e,n)=>{if("function"==typeof e&&(n=e,e=null),!t.isOnline())return o(()=>n(new Error(r)));let i;if(e){try{e=l.createFromB58String(e)}catch(t){e=null}if(!e)return o(()=>n(new Error("Invalid peerId")));i=t._bitswap.wantlistForPeer(e)}else i=t._bitswap.getWantlist();o(()=>n(null,{Keys:c(i)}))}),stat:i(e=>{if(!t.isOnline())return o(()=>e(new Error(r)));const n=t._bitswap.stat().snapshot;o(()=>{e(null,{provideBufLen:parseInt(n.providesBufferLength.toString()),blocksReceived:new s(n.blocksReceived),wantlist:c(t._bitswap.getWantlist()),peers:t._bitswap.peers().map(e=>e.toB58String()),dupBlksReceived:new s(n.dupBlksReceived),dupDataReceived:new s(n.dupDataReceived),dataReceived:new s(n.dataReceived),blocksSent:new s(n.blocksSent),dataSent:new s(n.dataSent)})})}),unwant:i((e,n)=>{if(!t.isOnline())return o(()=>n(new Error(r)));Array.isArray(e)||(e=[e]);try{e=e.map(e=>a.isCID(e)?e:new a(e))}catch(e){return o(()=>n(u(e,"ERR_INVALID_CID")))}o(()=>n(null,t._bitswap.unwant(e)))})}}},function(e,t,n){"use strict";const r=n(2),i=/^((\d+(\.\d+)*)(ns|ms|us|µs|m|s|h))+$/,o=/((\d+(\.\d+)*)(ns|ms|us|µs|m|s|h))/g,s=/(ns|ms|us|µs|m|s|h)/g,a={ns:1e-6,us:.001,"µs":.001,ms:1,s:1e3,m:6e4,h:36e5};function l(e){let t=e.match(s)[0];return e=e.substring(0,e.length-t.length),parseFloat(e)*a[t]}e.exports=r(function(e,t){return"string"!=typeof e?t(new Error("the first argument must be a string")):i.test(e)?void t(null,e.match(o).reduce((e,t)=>e+l(t),0)):t(new Error("invalid time"))})},function(e,t,n){"use strict";(function(t){const r=n(2),i=n(166),o=n(26),s=n(128),a=n(510),l=n(164).isSource,u=n(130),c=n(167);e.exports=(e=>{const n=c(e,"add"),h=r((e,r,c)=>{"function"==typeof r&&(c=r,r=null);const h=o(c);r||(r={}),r.converter=u;const f=e=>t.isBuffer(e)||s.readable(e)||l(e),p=e=>"object"==typeof e&&(e.content?f(e.content):Boolean(e.path)&&a(e.path)),d=e=>f(e)||p(e),m=d(e)||Array.isArray(e)&&e.every(d);if(!m)return h(new Error("invalid input: expected buffer, readable stream, pull stream, object or array of objects"));const g=[].concat(e),y=n({qs:r}),v=i(e=>h(null,e));y.once("error",h),y.pipe(v),g.forEach(e=>y.write(e)),y.end()});return function(){const e=Array.from(arguments);return 1===e.length&&l(e[0])&&e.push({}),h.apply(null,e)}})}).call(this,n(0).Buffer)},function(e,t,n){var r=n(108),i=n(65),o=n(87),s="[object String]";function a(e){return"string"==typeof e||!i(e)&&o(e)&&r(e)==s}e.exports=a},function(e,t,n){"use strict";const r=n(1273),i=n(169);e.exports=(e=>0===e.indexOf("https")?i.request:r.request)},function(e,t,n){(function(e){var n;function r(){if(void 0!==n)return n;if(e.XMLHttpRequest){n=new e.XMLHttpRequest;try{n.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){n=null}}else n=null;return n}function i(e){var t=r();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}function o(e){return"function"==typeof e}t.fetch=o(e.fetch)&&o(e.ReadableStream),t.writableStream=o(e.WritableStream),t.abortController=o(e.AbortController),t.arraybuffer=t.fetch||i("arraybuffer"),t.msstream=!t.fetch&&i("ms-stream"),t.mozchunkedarraybuffer=!t.fetch&&i("moz-chunked-arraybuffer"),t.overrideMimeType=t.fetch||!!r()&&o(r().overrideMimeType),n=null}).call(this,n(8))},function(e,t,n){(function(e,r,i){var o=n(512),s=n(1),a=n(17),l=t.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},u=t.IncomingMessage=function(t,n,s,l){var u=this;if(a.Readable.call(u),u._mode=s,u.headers={},u.rawHeaders=[],u.trailers={},u.rawTrailers=[],u.on("end",function(){e.nextTick(function(){u.emit("close")})}),"fetch"===s){if(u._fetchResponse=n,u.url=n.url,u.statusCode=n.status,u.statusMessage=n.statusText,n.headers.forEach(function(e,t){u.headers[t.toLowerCase()]=e,u.rawHeaders.push(t,e)}),o.writableStream){var c=new WritableStream({write:function(e){return new Promise(function(t,n){u._destroyed?n():u.push(r.from(e))?t():u._resumeFetch=t})},close:function(){i.clearTimeout(l),u._destroyed||u.push(null)},abort:function(e){u._destroyed||u.emit("error",e)}});try{return void n.body.pipeTo(c).catch(function(e){i.clearTimeout(l),u._destroyed||u.emit("error",e)})}catch(e){}}var h=n.body.getReader();function f(){h.read().then(function(e){if(!u._destroyed){if(e.done)return i.clearTimeout(l),void u.push(null);u.push(r.from(e.value)),f()}}).catch(function(e){i.clearTimeout(l),u._destroyed||u.emit("error",e)})}f()}else{u._xhr=t,u._pos=0,u.url=t.responseURL,u.statusCode=t.status,u.statusMessage=t.statusText;var p=t.getAllResponseHeaders().split(/\r?\n/);if(p.forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var n=t[1].toLowerCase();"set-cookie"===n?(void 0===u.headers[n]&&(u.headers[n]=[]),u.headers[n].push(t[2])):void 0!==u.headers[n]?u.headers[n]+=", "+t[2]:u.headers[n]=t[2],u.rawHeaders.push(t[1],t[2])}}),u._charset="x-user-defined",!o.overrideMimeType){var d=u.rawHeaders["mime-type"];if(d){var m=d.match(/;\s*charset=([^;])(;|$)/);m&&(u._charset=m[1].toLowerCase())}u._charset||(u._charset="utf-8")}}};s(u,a.Readable),u.prototype._read=function(){var e=this,t=this._resumeFetch;t&&(this._resumeFetch=null,t())},u.prototype._onXHRProgress=function(){var e=this,t=e._xhr,n=null;switch(e._mode){case"text":if(n=t.responseText,n.length>e._pos){var o=n.substr(e._pos);if("x-user-defined"===e._charset){for(var s=r.alloc(o.length),a=0;ae._pos&&(e.push(r.from(new Uint8Array(u.result.slice(e._pos)))),e._pos=u.result.byteLength)},u.onload=function(){e.push(null)},u.readAsArrayBuffer(n)}e._xhr.readyState===l.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(this,n(3),n(0).Buffer,n(8))},function(e,t){e.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},function(e,t,n){(function(e){t.fetch=a(e.fetch)&&a(e.ReadableStream),t.writableStream=a(e.WritableStream),t.abortController=a(e.AbortController),t.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),t.blobConstructor=!0}catch(e){}var n;function r(){if(void 0!==n)return n;if(e.XMLHttpRequest){n=new e.XMLHttpRequest;try{n.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){n=null}}else n=null;return n}function i(e){var t=r();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}var o=void 0!==e.ArrayBuffer,s=o&&a(e.ArrayBuffer.prototype.slice);function a(e){return"function"==typeof e}t.arraybuffer=t.fetch||o&&i("arraybuffer"),t.msstream=!t.fetch&&s&&i("ms-stream"),t.mozchunkedarraybuffer=!t.fetch&&o&&i("moz-chunked-arraybuffer"),t.overrideMimeType=t.fetch||!!r()&&a(r().overrideMimeType),t.vbArray=a(e.VBArray),n=null}).call(this,n(8))},function(e,t,n){(function(e,r,i){var o=n(515),s=n(1),a=n(517),l=t.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},u=t.IncomingMessage=function(t,n,s,l){var u=this;if(a.Readable.call(u),u._mode=s,u.headers={},u.rawHeaders=[],u.trailers={},u.rawTrailers=[],u.on("end",function(){e.nextTick(function(){u.emit("close")})}),"fetch"===s){if(u._fetchResponse=n,u.url=n.url,u.statusCode=n.status,u.statusMessage=n.statusText,n.headers.forEach(function(e,t){u.headers[t.toLowerCase()]=e,u.rawHeaders.push(t,e)}),o.writableStream){var c=new WritableStream({write:function(e){return new Promise(function(t,n){u._destroyed?n():u.push(new r(e))?t():u._resumeFetch=t})},close:function(){i.clearTimeout(l),u._destroyed||u.push(null)},abort:function(e){u._destroyed||u.emit("error",e)}});try{return void n.body.pipeTo(c).catch(function(e){i.clearTimeout(l),u._destroyed||u.emit("error",e)})}catch(e){}}var h=n.body.getReader();function f(){h.read().then(function(e){if(!u._destroyed){if(e.done)return i.clearTimeout(l),void u.push(null);u.push(new r(e.value)),f()}}).catch(function(e){i.clearTimeout(l),u._destroyed||u.emit("error",e)})}f()}else{u._xhr=t,u._pos=0,u.url=t.responseURL,u.statusCode=t.status,u.statusMessage=t.statusText;var p=t.getAllResponseHeaders().split(/\r?\n/);if(p.forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var n=t[1].toLowerCase();"set-cookie"===n?(void 0===u.headers[n]&&(u.headers[n]=[]),u.headers[n].push(t[2])):void 0!==u.headers[n]?u.headers[n]+=", "+t[2]:u.headers[n]=t[2],u.rawHeaders.push(t[1],t[2])}}),u._charset="x-user-defined",!o.overrideMimeType){var d=u.rawHeaders["mime-type"];if(d){var m=d.match(/;\s*charset=([^;])(;|$)/);m&&(u._charset=m[1].toLowerCase())}u._charset||(u._charset="utf-8")}}};s(u,a.Readable),u.prototype._read=function(){var e=this,t=this._resumeFetch;t&&(this._resumeFetch=null,t())},u.prototype._onXHRProgress=function(){var e=this,t=e._xhr,n=null;switch(e._mode){case"text:vbarray":if(t.readyState!==l.DONE)break;try{n=new i.VBArray(t.responseBody).toArray()}catch(e){}if(null!==n){e.push(new r(n));break}case"text":try{n=t.responseText}catch(t){e._mode="text:vbarray";break}if(n.length>e._pos){var o=n.substr(e._pos);if("x-user-defined"===e._charset){for(var s=new r(o.length),a=0;ae._pos&&(e.push(new r(new Uint8Array(u.result.slice(e._pos)))),e._pos=u.result.byteLength)},u.onload=function(){e.push(null)},u.readAsArrayBuffer(n)}e._xhr.readyState===l.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(this,n(3),n(0).Buffer,n(8))},function(e,t,n){t=e.exports=n(518),t.Stream=t,t.Readable=t,t.Writable=n(521),t.Duplex=n(132),t.Transform=n(522),t.PassThrough=n(1279)},function(e,t,n){"use strict";(function(t,r){var i=n(11);e.exports=E;var o=n(49),s;E.ReadableState=k;var a=n(6).EventEmitter,l=function(e,t){return e.listeners(t).length},u=n(519),c=n(5).Buffer,h=t.Uint8Array||function(){};function f(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof h}var d=n(7);d.inherits=n(1);var m=n(1276),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1277),v=n(520),b;d.inherits(E,u);var _=["error","close","destroy","pause","resume"];function w(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function k(e,t){s=s||n(132),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(b||(b=n(18).StringDecoder),this.decoder=new b(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||n(132),!(this instanceof E))return new E(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function S(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,R(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(7);u.inherits=n(1);var c={deprecate:n(50)},h=n(519),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(520),y;function v(){}function b(e,t){l=l||n(132),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var u=!1===e.decodeStrings;this.decodeStrings=!u,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(l=l||n(132),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(3),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(132),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(7);u.inherits=n(1);var c={deprecate:n(50)},h=n(525),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(526),y;function v(){}function b(e,t){l=l||n(133),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var u=!1===e.decodeStrings;this.decodeStrings=!u,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(l=l||n(133),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(3),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(133),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(7);u.inherits=n(1);var c={deprecate:n(50)},h=n(530),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(531),y;function v(){}function b(e,t){l=l||n(104),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var u=!1===e.decodeStrings;this.decodeStrings=!u,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(l=l||n(104),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(3),n(8))},function(e,t,n){(function(e){var r=n(534),i=n(105),o="0000000000000000000",s="7777777777777777777",a="0".charCodeAt(0),l="ustar\x0000",u=parseInt("7777",8),c=function(e,t,n){return"number"!=typeof e?n:(e=~~e,e>=t?t:e>=0?e:(e+=t,e>=0?e:0))},h=function(e){switch(e){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null},f=function(e){switch(e){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0},p=function(e,t,n,r){for(;nt?s.slice(0,t)+" ":o.slice(0,t-e.length)+e+" "};function g(e){var t;if(128===e[0])t=!0;else{if(255!==e[0])return null;t=!1}for(var n=!1,r=[],i=e.length-1;i>0;i--){var o=e[i];t?r.push(o):n&&0===o?r.push(0):n?(n=!1,r.push(256-o)):r.push(255-o)}var s=0,a=r.length;for(i=0;i=Math.pow(10,r)&&r++,n+r+t};t.decodeLongPath=function(e,t){return v(e,0,e.length,t)},t.encodePax=function(e){var t="";e.name&&(t+=b(" path="+e.name+"\n")),e.linkname&&(t+=b(" linkpath="+e.linkname+"\n"));var n=e.pax;if(n)for(var i in n)t+=b(" "+i+"="+n[i]+"\n");return r(t)},t.decodePax=function(e){for(var t={};e.length;){for(var n=0;n100;){var s=r.indexOf("/");if(-1===s)return null;o+=o?"/"+r.slice(0,s):r.slice(0,s),r=r.slice(s+1)}return e.byteLength(r)>100||e.byteLength(o)>155?null:t.linkname&&e.byteLength(t.linkname)>100?null:(n.write(r),n.write(m(t.mode&u,6),100),n.write(m(t.uid,6),108),n.write(m(t.gid,6),116),n.write(m(t.size,11),124),n.write(m(t.mtime.getTime()/1e3|0,11),136),n[156]=a+f(t.type),t.linkname&&n.write(t.linkname,157),n.write(l,257),t.uname&&n.write(t.uname,265),t.gname&&n.write(t.gname,297),n.write(m(t.devmajor||0,6),329),n.write(m(t.devminor||0,6),337),o&&n.write(o,345),n.write(m(d(n),6),148),n)},t.decode=function(e,t){var n=0===e[156]?0:e[156]-a,r=v(e,0,100,t),i=y(e,100,8),o=y(e,108,8),s=y(e,116,8),l=y(e,124,12),u=y(e,136,12),c=h(n),f=0===e[157]?null:v(e,157,100,t),p=v(e,265,32),m=v(e,297,32),g=y(e,329,8),b=y(e,337,8);e[345]&&(r=v(e,345,155,t)+"/"+r),0===n&&r&&"/"===r[r.length-1]&&(n=5);var _=d(e);if(256===_)return null;if(_!==y(e,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");return{name:r,mode:i,uid:o,gid:s,size:l,mtime:new Date(1e3*u),type:c,linkname:f,uname:p,gname:m,devmajor:g,devminor:b}}}).call(this,n(0).Buffer)},function(e,t,n){(function(t){e.exports=i;var n=t.from&&t.from!==Uint8Array.from?t.from:r;function r(e,n){return new t(e,n)}function i(e,r){if(t.isBuffer(e))return e;if("string"==typeof e)return n(e,r);if(Array.isArray(e))return n(e);throw new Error("Input should be a buffer or a string")}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=s;var r=n(104),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length({"api-path":"/api/v0/","user-agent":`/node-${r.name}/${r.version}/`,host:"localhost",port:"5001",protocol:"http"}))},function(e,t,n){"use strict";(function(r){const i=n(1308),o=n(301).encode,s=n(168),a=n(302),l=n(53),u=n(26),c=n(91),h=n(1313),f=n(511),p=n(4)("ipfs-http-client:request");function d(e,t){const n=new Error(`Server responded with ${e.statusCode}`);h(e,(e,r)=>{if(e)return t(e);r&&(n.code=r.Code,n.message=r.Message||r.toString(),n.type=r.Type),t(n)})}function m(e,t){return n=>{const r=Boolean(n.headers["x-stream-output"]),i=Boolean(n.headers["x-chunked-output"]),o=n.headers["content-type"]&&0===n.headers["content-type"].indexOf("application/json");if(n.req?p(n.req.method,`${n.req.getHeaders().host}${n.req.path}`,n.statusCode,n.statusMessage):p(n.url,n.statusCode,n.statusMessage),n.statusCode>=400||!n.statusCode)return d(n,t);if(r&&!e)return t(null,n);if(i&&o){const e=a.parse();return l(n,e),n.on("end",()=>{let t=n.trailers["x-stream-error"];if(t){try{t=JSON.parse(t)}catch(e){t={Message:t}}e.emit("error",new Error(t.Message))}}),t(null,e)}return o?h(n,t):c(n,t)}}function g(e,t,n){n=u(n),t.qs=t.qs||{},Array.isArray(t.path)&&(t.path=t.path.join("/")),t.args&&!Array.isArray(t.args)&&(t.args=[t.args]),t.args&&(t.qs.arg=t.args),t.progress&&(t.qs.progress=!0),t.qs.r&&(t.qs.recursive=t.qs.r,delete t.qs.r),t.qs["stream-channels"]=!0,t.stream&&(t.buffer=!1),delete t.qs.followSymlinks;const a="POST",l=Object.assign({},e.headers);if(s&&(l["User-Agent"]=e["user-agent"]),t.multipart){if(!t.multipartBoundary)return n(new Error("No multipartBoundary"));l["Content-Type"]=`multipart/form-data; boundary=${t.multipartBoundary}`}const c=i.stringify(t.qs,{arrayFormat:"repeat",encoder:e=>{if(r.isBuffer(e)){let t="";for(const n of e)if(n>=65&&n<=90||n>=97&&n<=122||n>=48&&n<=57||45===n||46===n||95===n||126===n)t+=String.fromCharCode(n);else{const e=n.toString(16),r=1===e.length?`0${e}`:e;t+=`%${r}`}return t}return o(e)}}),h={hostname:e.host,path:`${e["api-path"]}${t.path}?${c}`,port:e.port,method:"POST",headers:l,protocol:`${e.protocol}:`},p=f(e.protocol)(h,m(t.buffer,n));return p.on("error",e=>{n(e)}),t.stream||p.end(),p}t=e.exports=(e=>{const t=(t,n)=>"object"!=typeof t?n(new Error("no options were passed")):g(e,t,n);return t.andTransform=((e,n,r)=>t(e,(e,t)=>{if(e)return r(e);n(t,r)})),t})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=String.prototype.replace,i=/%20/g;e.exports={default:"RFC3986",formatters:{RFC1738:function(e){return r.call(e,i,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},function(e,t){function n(e,t,n,i){return JSON.stringify(e,r(t,i),n)}function r(e,t){var n=[],r=[];return null==t&&(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+r.slice(0,n.indexOf(t)).join(".")+"]"}),function(i,o){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?r.splice(s,1/0,i):r.push(i),~n.indexOf(o)&&(o=t.call(this,i,o))}else n.push(o);return null==e?o:e.call(this,i,o)}}t=e.exports=n,t.getSerialize=r},function(e,t,n){"use strict";const r=n(23);e.exports=(e=>{const t=r(e);return{get:n(1316)(t),stat:n(1317)(t),put:n(1318)(t)}})},function(e,t,n){"use strict";e.exports=(e=>{const t=e.pop();let n={},r=[];return Array.isArray(e[e.length-1])||"object"!=typeof e[e.length-1]||(n=e.pop()),r=1===e.length&&Array.isArray(e[0])?e[0]:e,{callback:t,sources:r,opts:n}})},function(e,t,n){var r=n(219),i=n(1429),o=n(1430),s=n(1431),a=n(1432),l=n(1433);function u(e){var t=this.__data__=new r(e);this.size=t.size}u.prototype.clear=i,u.prototype.delete=o,u.prototype.get=s,u.prototype.has=a,u.prototype.set=l,e.exports=u},function(e,t,n){var r=n(1434),i=n(87);function o(e,t,n,s,a){return e===t||(null==e||null==t||!i(e)&&!i(t)?e!=e&&t!=t:r(e,t,n,s,o,a))}e.exports=o},function(e,t,n){var r=n(1435),i=n(1438),o=n(1439),s=1,a=2;function l(e,t,n,l,u,c){var h=n&s,f=e.length,p=t.length;if(f!=p&&!(h&&p>f))return!1;var d=c.get(e);if(d&&c.get(t))return d==t;var m=-1,g=!0,y=n&a?new r:void 0;for(c.set(e,t),c.set(t,e);++m({name:e.Name,type:e.Type,size:e.Size,hash:e.Hash});e.exports=(e=>(t,n)=>{n=n||{};const u=new r({objectMode:!0,transform(e,t,n){n(null,l(e))}}),c=new i({objectMode:!0});return e({path:"files/ls",args:t,qs:Object.assign({},n,{stream:!0})},(e,t)=>{if(e)return c.destroy(e);if(a(t)){const e=s.parse();o(t,e,u,c)}else{const e=t.Entries||[];e.forEach(e=>{c.write(l(e))}),c.end()}}),c})},function(e,t,n){(function(e,n){var r=200,i="__lodash_hash_undefined__",o=9007199254740991,s="[object Arguments]",a="[object Array]",l="[object Boolean]",u="[object Date]",c="[object Error]",h="[object Function]",f="[object GeneratorFunction]",p="[object Map]",d="[object Number]",m="[object Object]",g="[object Promise]",y="[object RegExp]",v="[object Set]",b="[object String]",_="[object Symbol]",w="[object WeakMap]",k="[object ArrayBuffer]",E="[object DataView]",S="[object Float32Array]",x="[object Float64Array]",C="[object Int8Array]",A="[object Int16Array]",T="[object Int32Array]",I="[object Uint8Array]",j="[object Uint8ClampedArray]",R="[object Uint16Array]",B="[object Uint32Array]",O=/[\\^$.*+?()[\]{}|]/g,P=/\w*$/,N=/^\[object .+?Constructor\]$/,D=/^(?:0|[1-9]\d*)$/,M={};M[s]=M[a]=M[k]=M[E]=M[l]=M[u]=M[S]=M[x]=M[C]=M[A]=M[T]=M[p]=M[d]=M[m]=M[y]=M[v]=M[b]=M[_]=M[I]=M[j]=M[R]=M[B]=!0,M[c]=M[h]=M[w]=!1;var F="object"==typeof e&&e&&e.Object===Object&&e,L="object"==typeof self&&self&&self.Object===Object&&self,U=F||L||Function("return this")(),q=t&&!t.nodeType&&t,z=q&&"object"==typeof n&&n&&!n.nodeType&&n,K=z&&z.exports===q;function H(e,t){return e.set(t[0],t[1]),e}function V(e,t){return e.add(t),e}function $(e,t){for(var n=-1,r=e?e.length:0;++n-1}function Ve(e,t){var n=this.__data__,r=st(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}function $e(e){var t=-1,n=e?e.length:0;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=o}function Wt(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Gt(e){return!!e&&"object"==typeof e}function Yt(e){return zt(e)?it(e):pt(e)}function Zt(){return[]}function Jt(){return!1}n.exports=Ft}).call(this,n(8),n(85)(e))},function(e,t,n){"use strict";e.exports="ipfs-pubsub-room/v2"},function(e,t,n){"use strict";(function(t){e.exports=(e=>{let n=e;return t.isBuffer(n)||(n=t.from(n)),n})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=(e=>e._libp2pNode||e.libp2p)},function(e,t,n){(function(t){e.exports=function(e,n){var r=[];e.on("data",function(e){r.push(e)}),e.once("end",function(){n&&n(null,t.concat(r)),n=null}),e.once("error",function(e){n&&n(e),n=null})}}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var r=n(1),i=n(1522).Transform,o=n(1527);function s(e,t){if(!(this instanceof s))return new s(e,t);i.call(this),t||(t={}),"object"==typeof e&&(t=e,e=t.size),this.size=e||512,t.nopad?this._zeroPadding=!1:this._zeroPadding=o(t.zeroPadding,!0),this._buffered=[],this._bufferedBytes=0}e.exports=s,r(s,i),s.prototype._transform=function(e,n,r){for(this._bufferedBytes+=e.length,this._buffered.push(e);this._bufferedBytes>=this.size;){var i=t.concat(this._buffered);this._bufferedBytes-=this.size,this.push(i.slice(0,this.size)),this._buffered=[i.slice(this.size,i.length)]}r()},s.prototype._flush=function(){if(this._bufferedBytes&&this._zeroPadding){var e=new t(this.size-this._bufferedBytes);e.fill(0),this._buffered.push(e),this.push(t.concat(this._buffered)),this._buffered=null}else this._bufferedBytes&&(this.push(t.concat(this._buffered)),this._buffered=null);this.push(null)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t,r){var i=n(11);e.exports=E;var o=n(49),s;E.ReadableState=k;var a=n(6).EventEmitter,l=function(e,t){return e.listeners(t).length},u=n(555),c=n(5).Buffer,h=t.Uint8Array||function(){};function f(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof h}var d=n(7);d.inherits=n(1);var m=n(1523),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1524),v=n(556),b;d.inherits(E,u);var _=["error","close","destroy","pause","resume"];function w(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function k(e,t){s=s||n(135),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(b||(b=n(18).StringDecoder),this.decoder=new b(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||n(135),!(this instanceof E))return new E(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function S(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,R(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(7);u.inherits=n(1);var c={deprecate:n(50)},h=n(555),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(556),y;function v(){}function b(e,t){l=l||n(135),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var u=!1===e.decodeStrings;this.decodeStrings=!u,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(l=l||n(135),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(3),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(135),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(7);u.inherits=n(1);var c={deprecate:n(50)},h=n(560),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(561),y;function v(){}function b(e,t){l=l||n(136),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var u=!1===e.decodeStrings;this.decodeStrings=!u,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(l=l||n(136),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(3),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(136),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(7);u.inherits=n(1);var c={deprecate:n(50)},h=n(566),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(567),y;function v(){}function b(e,t){l=l||n(137),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var u=!1===e.decodeStrings;this.decodeStrings=!u,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(l=l||n(137),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(3),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(137),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{t(null,n)}):g(e)?o(e,(e,n)=>{if(e)return t(new Error(`Error converting Blob: ${e.message}`));i(n)}):"function"==typeof a&&/^https?:/.test(e)?a.concat({url:e,timeout:3e4,headers:{"user-agent":"WebTorrent (https://webtorrent.io)"}},(e,n,r)=>{if(e)return t(new Error(`Error downloading torrent: ${e.message}`));i(r)}):"function"==typeof s.readFile&&"string"==typeof e?s.readFile(e,(e,n)=>{if(e)return t(new Error("Invalid torrent identifier"));i(n)}):r.nextTick(()=>{t(new Error("Invalid torrent identifier"))})}function d(e){t.isBuffer(e)&&(e=i.decode(e)),b(e.info,"info"),b(e.info["name.utf-8"]||e.info.name,"info.name"),b(e.info["piece length"],"info['piece length']"),b(e.info.pieces,"info.pieces"),e.info.files?e.info.files.forEach(e=>{b("number"==typeof e.length,"info.files[0].length"),b(e["path.utf-8"]||e.path,"info.files[0].path")}):b("number"==typeof e.info.length,"info.length");const n={info:e.info,infoBuffer:i.encode(e.info),name:(e.info["name.utf-8"]||e.info.name).toString(),announce:[]};n.infoHash=c.sync(n.infoBuffer),n.infoHashBuffer=t.from(n.infoHash,"hex"),void 0!==e.info.private&&(n.private=!!e.info.private),e["creation date"]&&(n.created=new Date(1e3*e["creation date"])),e["created by"]&&(n.createdBy=e["created by"].toString()),t.isBuffer(e.comment)&&(n.comment=e.comment.toString()),Array.isArray(e["announce-list"])&&e["announce-list"].length>0?e["announce-list"].forEach(e=>{e.forEach(e=>{n.announce.push(e.toString())})}):e.announce&&n.announce.push(e.announce.toString()),t.isBuffer(e["url-list"])&&(e["url-list"]=e["url-list"].length>0?[e["url-list"]]:[]),n.urlList=(e["url-list"]||[]).map(e=>e.toString()),h(n.announce),h(n.urlList);const r=e.info.files||[e.info];n.files=r.map((e,t)=>{const i=[].concat(n.name,e["path.utf-8"]||e.path||[]).map(e=>e.toString());return{path:u.join.apply(null,[u.sep].concat(i)).slice(1),name:i[i.length-1],length:e.length,offset:r.slice(0,t).reduce(y,0)}}),n.length=r.reduce(y,0);const o=n.files[n.files.length-1];return n.pieceLength=e.info["piece length"],n.lastPieceLength=(o.offset+o.length)%n.pieceLength||n.pieceLength,n.pieces=v(e.info.pieces),n}function m(e){const n={info:e.info};return n["announce-list"]=(e.announce||[]).map(e=>(n.announce||(n.announce=e),e=t.from(e,"utf8"),[e])),n["url-list"]=e.urlList||[],void 0!==e.private&&(n.private=Number(e.private)),e.created&&(n["creation date"]=e.created.getTime()/1e3|0),e.createdBy&&(n["created by"]=e.createdBy),e.comment&&(n.comment=e.comment),i.encode(n)}function g(e){return"undefined"!=typeof Blob&&e instanceof Blob}function y(e,t){return e+t.length}function v(e){const t=[];for(let n=0;n0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(7);u.inherits=n(1);var c={deprecate:n(50)},h=n(572),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(573),y;function v(){}function b(e,t){l=l||n(138),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var u=!1===e.decodeStrings;this.decodeStrings=!u,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(l=l||n(138),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(3),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(138),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(7);u.inherits=n(1);var c={deprecate:n(50)},h=n(577),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(578),y;function v(){}function b(e,t){l=l||n(139),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var u=!1===e.decodeStrings;this.decodeStrings=!u,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(l=l||n(139),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(3),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(139),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(7);u.inherits=n(1);var c={deprecate:n(50)},h=n(583),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(584),y;function v(){}function b(e,t){l=l||n(140),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var u=!1===e.decodeStrings;this.decodeStrings=!u,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(l=l||n(140),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(3),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(140),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.lengththis._bufferDuration)&&this._cb){var t=this._cb;this._cb=null,t()}};var c=0;function h(e,t){var n=document.createElement("a");n.href=window.URL.createObjectURL(new window.Blob(e)),n.download=t,n.click()}u.prototype._getBufferDuration=function(){for(var e=this,t=this._sourceBuffer.buffered,n=this._elem.currentTime,r=-1,i=0;in)break;(r>=0||n<=s)&&(r=s)}var a=r-n;return a<0&&(a=0),a}},function(e,t,n){var r=n(589);e.exports=function e(t,n,i){if("function"==typeof n)return e(t,null,n);r(t,n,function(e,t){if(e)return i(e);var n=URL.createObjectURL(t);i(null,n)})}},function(e,t,n){var r=n(26);e.exports=function e(t,n,i){if("function"==typeof n)return e(t,null,n);i=r(i);var o=[];t.on("data",function(e){o.push(e)}).on("end",function(){var e=n?new Blob(o,{type:n}):new Blob(o);i(null,e)}).on("error",i)}},function(e,t,n){t=e.exports=n(591),t.Stream=t,t.Readable=t,t.Writable=n(594),t.Duplex=n(141),t.Transform=n(595),t.PassThrough=n(1611)},function(e,t,n){"use strict";(function(t,r){var i=n(11);e.exports=E;var o=n(49),s;E.ReadableState=k;var a=n(6).EventEmitter,l=function(e,t){return e.listeners(t).length},u=n(592),c=n(5).Buffer,h=t.Uint8Array||function(){};function f(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof h}var d=n(7);d.inherits=n(1);var m=n(1608),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1609),v=n(593),b;d.inherits(E,u);var _=["error","close","destroy","pause","resume"];function w(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function k(e,t){s=s||n(141),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(b||(b=n(18).StringDecoder),this.decoder=new b(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||n(141),!(this instanceof E))return new E(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function S(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,R(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(7);u.inherits=n(1);var c={deprecate:n(50)},h=n(592),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(593),y;function v(){}function b(e,t){l=l||n(141),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var u=!1===e.decodeStrings;this.decodeStrings=!u,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(l=l||n(141),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(3),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(141),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length=e.length||t<0)){var n=e.pop();if(t{this.keepAlive()},f))}setTimeout(e,t){this._debug("setTimeout ms=%d unref=%s",e,t),this._clearTimeout(),this._timeoutMs=e,this._timeoutUnref=!!t,this._updateTimeout()}destroy(){this.destroyed||(this.destroyed=!0,this._debug("destroy"),this.emit("close"),this.end())}end(...e){this._debug("end"),this._onUninterested(),this._onChoke(),super.end(...e)}use(e){const t=e.prototype.name;if(!t)throw new Error('Extension class requires a "name" property on the prototype');this._debug("use extension.name=%s",t);const n=this._nextExt,r=new e(this);function i(){}"function"!=typeof r.onHandshake&&(r.onHandshake=i),"function"!=typeof r.onExtendedHandshake&&(r.onExtendedHandshake=i),"function"!=typeof r.onMessage&&(r.onMessage=i),this.extendedMapping[n]=t,this._ext[t]=r,this[t]=r,this._nextExt+=1}keepAlive(){this._debug("keep-alive"),this._push(d)}handshake(e,n,r){let i,o;if("string"==typeof e?(e=e.toLowerCase(),i=t.from(e,"hex")):(i=e,e=i.toString("hex")),"string"==typeof n?o=t.from(n,"hex"):(o=n,n=o.toString("hex")),20!==i.length||20!==o.length)throw new Error("infoHash and peerId MUST have length 20");this._debug("handshake i=%s p=%s exts=%o",e,n,r);const s=t.from(b);s[5]|=16,r&&r.dht&&(s[7]|=1),this._push(t.concat([p,s,i,o])),this._handshakeSent=!0,this.peerExtensions.extended&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()}_sendExtendedHandshake(){const e=a(this.extendedHandshake);e.m={};for(const t in this.extendedMapping){const n=this.extendedMapping[t];e.m[n]=Number(t)}this.extended(0,i.encode(e)),this._extendedHandshakeSent=!0}choke(){if(!this.amChoking){for(this.amChoking=!0,this._debug("choke");this.peerRequests.length;)this.peerRequests.pop();this._push(m)}}unchoke(){this.amChoking&&(this.amChoking=!1,this._debug("unchoke"),this._push(g))}interested(){this.amInterested||(this.amInterested=!0,this._debug("interested"),this._push(y))}uninterested(){this.amInterested&&(this.amInterested=!1,this._debug("uninterested"),this._push(v))}have(e){this._debug("have %d",e),this._message(4,[e],null)}bitfield(e){this._debug("bitfield"),t.isBuffer(e)||(e=e.buffer),this._message(5,[],e)}request(e,t,n,r){return r||(r=(()=>{})),this._finished?r(new Error("wire is closed")):this.peerChoking?r(new Error("peer is choking")):(this._debug("request index=%d offset=%d length=%d",e,t,n),this.requests.push(new w(e,t,n,r)),this._updateTimeout(),void this._message(6,[e,t,n],null))}piece(e,t,n){this._debug("piece index=%d offset=%d",e,t),this.uploaded+=n.length,this.uploadSpeed(n.length),this.emit("upload",n.length),this._message(7,[e,t],n)}cancel(e,t,n){this._debug("cancel index=%d offset=%d length=%d",e,t,n),this._callback(this._pull(this.requests,e,t,n),new Error("request was cancelled"),null),this._message(8,[e,t,n],null)}port(e){this._debug("port %d",e);const n=t.from(_);n.writeUInt16BE(e,5),this._push(n)}extended(e,n){if(this._debug("extended ext=%s",e),"string"==typeof e&&this.peerExtendedMapping[e]&&(e=this.peerExtendedMapping[e]),"number"!=typeof e)throw new Error(`Unrecognized extension: ${e}`);{const r=t.from([e]),o=t.isBuffer(n)?n:i.encode(n);this._message(20,[],t.concat([r,o]))}}_read(){}_message(e,n,r){const i=r?r.length:0,o=t.allocUnsafe(5+4*n.length);o.writeUInt32BE(o.length+i-4,0),o[4]=e;for(let e=0;e{if(i===this._pull(this.peerRequests,e,t,n))return r?this._debug("error satisfying request index=%d offset=%d length=%d (%s)",e,t,n,r.message):void this.piece(e,t,o)};var i=new w(e,t,n,r);this.peerRequests.push(i),this.emit("request",e,t,n,r)}_onPiece(e,t,n){this._debug("got piece index=%d offset=%d",e,t),this._callback(this._pull(this.requests,e,t,n.length),null,n),this.downloaded+=n.length,this.downloadSpeed(n.length),this.emit("download",n.length),this.emit("piece",e,t,n)}_onCancel(e,t,n){this._debug("got cancel index=%d offset=%d length=%d",e,t,n),this._pull(this.peerRequests,e,t,n),this.emit("cancel",e,t,n)}_onPort(e){this._debug("got port %d",e),this.emit("port",e)}_onExtended(e,t){if(0===e){let e,n;try{e=i.decode(t)}catch(e){this._debug("ignoring invalid extended handshake: %s",e.message||e)}if(!e)return;if(this.peerExtendedHandshake=e,"object"==typeof e.m)for(n in e.m)this.peerExtendedMapping[n]=Number(e.m[n].toString());for(n in this._ext)this.peerExtendedMapping[n]&&this._ext[n].onExtendedHandshake(this.peerExtendedHandshake);this._debug("got extended handshake"),this.emit("extended","handshake",this.peerExtendedHandshake)}else this.extendedMapping[e]&&(e=this.extendedMapping[e],this._ext[e]&&this._ext[e].onMessage(t)),this._debug("got extended message ext=%s",e),this.emit("extended",e,t)}_onTimeout(){this._debug("request timed out"),this._callback(this.requests.shift(),new Error("request has timed out"),null),this.emit("timeout")}_write(e,n,r){for(this._bufferSize+=e.length,this._buffer.push(e);this._bufferSize>=this._parserSize;){const e=1===this._buffer.length?this._buffer[0]:t.concat(this._buffer);this._bufferSize-=this._parserSize,this._buffer=this._bufferSize?[e.slice(this._parserSize)]:[],this._parser(e.slice(0,this._parserSize))}r(null)}_callback(e,t,n){e&&(this._clearTimeout(),this.peerChoking||this._finished||this._updateTimeout(),e.callback(t,n))}_clearTimeout(){this._timeout&&(clearTimeout(this._timeout),this._timeout=null)}_updateTimeout(){this._timeoutMs&&this.requests.length&&!this._timeout&&(this._timeout=setTimeout(()=>this._onTimeout(),this._timeoutMs),this._timeoutUnref&&this._timeout.unref&&this._timeout.unref())}_parse(e,t){this._parserSize=e,this._parser=t}_onMessageLength(e){const t=e.readUInt32BE(0);t>0?this._parse(t,this._onMessage):(this._onKeepAlive(),this._parse(4,this._onMessageLength))}_onMessage(e){switch(this._parse(4,this._onMessageLength),e[0]){case 0:return this._onChoke();case 1:return this._onUnchoke();case 2:return this._onInterested();case 3:return this._onUninterested();case 4:return this._onHave(e.readUInt32BE(1));case 5:return this._onBitField(e.slice(1));case 6:return this._onRequest(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 7:return this._onPiece(e.readUInt32BE(1),e.readUInt32BE(5),e.slice(9));case 8:return this._onCancel(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 9:return this._onPort(e.readUInt16BE(1));case 20:return this._onExtended(e.readUInt8(1),e.slice(2));default:return this._debug("got unknown message"),this.emit("unknownmessage",e)}}_parseHandshake(){this._parse(1,e=>{const t=e.readUInt8(0);this._parse(t+48,e=>{const n=e.slice(0,t);if("BitTorrent protocol"!==n.toString())return this._debug("Error: wire not speaking BitTorrent protocol (%s)",n.toString()),void this.end();e=e.slice(t),this._onHandshake(e.slice(8,28),e.slice(28,48),{dht:!!(1&e[7]),extended:!!(16&e[5])}),this._parse(4,this._onMessageLength)})})}_onFinish(){for(this._finished=!0,this.push(null);this.read(););for(clearInterval(this._keepAliveInterval),this._parse(Number.MAX_VALUE,()=>{});this.peerRequests.length;)this.peerRequests.pop();for(;this.requests.length;)this._callback(this.requests.pop(),new Error("wire was closed"),null)}_debug(...e){e[0]=`[${this._debugId}] ${e[0]}`,s(...e)}_pull(e,t,n,i){for(let o=0;o0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(7);u.inherits=n(1);var c={deprecate:n(50)},h=n(600),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(601),y;function v(){}function b(e,t){l=l||n(142),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var u=!1===e.decodeStrings;this.decodeStrings=!u,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(l=l||n(142),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(3),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(142),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length255)return"DOMAIN_TOO_LONG";for(var n=t.split("."),i,o=0;o63)return"LABEL_TOO_LONG";if("-"===i.charAt(0))return"LABEL_STARTS_WITH_DASH";if("-"===i.charAt(i.length-1))return"LABEL_ENDS_WITH_DASH";if(!/^[a-z0-9\-]+$/.test(i))return"LABEL_INVALID_CHARS"}},t.parse=function(e){if("string"!=typeof e)throw new TypeError("Domain name must be a string.");var n=e.slice(0).toLowerCase();"."===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1));var o=i.validate(n);if(o)return{input:e,error:{message:t.errorCodes[o],code:o}};var s={input:e,tld:null,sld:null,domain:null,subdomain:null,listed:!1},a=n.split(".");if("local"===a[a.length-1])return s;var u=function(){return/xn--/.test(n)?(s.domain&&(s.domain=r.toASCII(s.domain)),s.subdomain&&(s.subdomain=r.toASCII(s.subdomain)),s):s},l=i.findRule(n);if(!l)return a.length<2?s:(s.tld=a.pop(),s.sld=a.pop(),s.domain=[s.sld,s.tld].join("."),a.length&&(s.subdomain=a.pop()),u());s.listed=!0;var c=l.suffix.split("."),f=a.slice(0,a.length-c.length);return l.exception&&f.push(c.shift()),s.tld=c.join("."),f.length?(l.wildcard&&(c.unshift(f.pop()),s.tld=c.join(".")),f.length?(s.sld=f.pop(),s.domain=[s.sld,s.tld].join("."),f.length&&(s.subdomain=f.join(".")),u()):u()):u()},t.get=function(e){return e&&t.parse(e).domain||null},t.isValid=function(e){var n=t.parse(e);return Boolean(n.domain&&n.listed)}},function(e,t,n){"use strict"; + */var r=n(608);function i(e){return r.get(e)}t.getPublicSuffix=i},function(e,t,n){"use strict";var r=n(179),i={};i.rules=n(1633).map(function(e){return{rule:e,suffix:e.replace(/^(\*\.|\!)/,""),punySuffix:-1,wildcard:"*"===e.charAt(0),exception:"!"===e.charAt(0)}}),i.endsWith=function(e,t){return-1!==e.indexOf(t,e.length-t.length)},i.findRule=function(e){var t=r.toASCII(e);return i.rules.reduce(function(e,n){return-1===n.punySuffix&&(n.punySuffix=r.toASCII(n.suffix)),i.endsWith(t,"."+n.punySuffix)||t===n.punySuffix?n:e},null)},t.errorCodes={DOMAIN_TOO_SHORT:"Domain name too short.",DOMAIN_TOO_LONG:"Domain name too long. It should be no more than 255 chars.",LABEL_STARTS_WITH_DASH:"Domain name label can not start with a dash.",LABEL_ENDS_WITH_DASH:"Domain name label can not end with a dash.",LABEL_TOO_LONG:"Domain name label should be at most 63 chars long.",LABEL_TOO_SHORT:"Domain name label should be at least 1 character long.",LABEL_INVALID_CHARS:"Domain name label can only contain alphanumeric characters or dashes."},i.validate=function(e){var t=r.toASCII(e);if(t.length<1)return"DOMAIN_TOO_SHORT";if(t.length>255)return"DOMAIN_TOO_LONG";for(var n=t.split("."),i,o=0;o63)return"LABEL_TOO_LONG";if("-"===i.charAt(0))return"LABEL_STARTS_WITH_DASH";if("-"===i.charAt(i.length-1))return"LABEL_ENDS_WITH_DASH";if(!/^[a-z0-9\-]+$/.test(i))return"LABEL_INVALID_CHARS"}},t.parse=function(e){if("string"!=typeof e)throw new TypeError("Domain name must be a string.");var n=e.slice(0).toLowerCase();"."===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1));var o=i.validate(n);if(o)return{input:e,error:{message:t.errorCodes[o],code:o}};var s={input:e,tld:null,sld:null,domain:null,subdomain:null,listed:!1},a=n.split(".");if("local"===a[a.length-1])return s;var l=function(){return/xn--/.test(n)?(s.domain&&(s.domain=r.toASCII(s.domain)),s.subdomain&&(s.subdomain=r.toASCII(s.subdomain)),s):s},u=i.findRule(n);if(!u)return a.length<2?s:(s.tld=a.pop(),s.sld=a.pop(),s.domain=[s.sld,s.tld].join("."),a.length&&(s.subdomain=a.pop()),l());s.listed=!0;var c=u.suffix.split("."),h=a.slice(0,a.length-c.length);return u.exception&&h.push(c.shift()),s.tld=c.join("."),h.length?(u.wildcard&&(c.unshift(h.pop()),s.tld=c.join(".")),h.length?(s.sld=h.pop(),s.domain=[s.sld,s.tld].join("."),h.length&&(s.subdomain=h.join(".")),l()):l()):l()},t.get=function(e){return e&&t.parse(e).domain||null},t.isValid=function(e){var n=t.parse(e);return Boolean(n.domain&&n.listed)}},function(e,t,n){"use strict"; /*! * Copyright (c) 2015, Salesforce.com, Inc. * All rights reserved. @@ -164,7 +141,7 @@ function r(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - */var r=n(705);function i(e){var t=r.getPublicSuffix(e);if(!t)return null;if(t==e)return[e];for(var n=e.slice(0,-(t.length+1)),i=n.split(".").reverse(),o=t,s=[o];i.length;)o=i.shift()+"."+o,s.push(o);return s}t.permuteDomain=i},function(e,t,n){"use strict"; + */var r=n(607);function i(e){var t=r.getPublicSuffix(e);if(!t)return null;if(t==e)return[e];for(var n=e.slice(0,-(t.length+1)),i=n.split(".").reverse(),o=t,s=[o];i.length;)o=i.shift()+"."+o,s.push(o);return s}t.permuteDomain=i},function(e,t,n){"use strict"; /*! * Copyright (c) 2015, Salesforce.com, Inc. * All rights reserved. @@ -194,7 +171,7 @@ function r(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - */function r(e,t){if(t===e)return!0;var n=e.indexOf(t);if(0===n){if("/"===t.substr(-1))return!0;if("/"===e.substr(t.length,1))return!0}return!1}t.pathMatch=r},function(e,t,n){"use strict";function r(e,t,n,r){for(var i=65535&e|0,o=e>>>16&65535|0,s=0;0!==n;){s=n>2e3?2e3:n,n-=s;do{i=i+t[r++]|0,o=o+i|0}while(--s);i%=65521,o%=65521}return i|o<<16|0}e.exports=r},function(e,t,n){"use strict";function r(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}var i=r();function o(e,t,n,r){var o=i,s=r+n;e^=-1;for(var a=r;a>>8^o[255&(e^t[a])];return-1^e}e.exports=o},function(e,t,n){e.exports={Verifier:l,Signer:c};var r=n(209),i=n(57),o=n(13),s=n(27),a=n(31).Buffer,u=n(102);function l(e,t){if("sha512"!==t.toLowerCase())throw new Error("ED25519 only supports the use of SHA-512 hashes");this.key=e,this.chunks=[],i.Writable.call(this,{})}function c(e,t){if("sha512"!==t.toLowerCase())throw new Error("ED25519 only supports the use of SHA-512 hashes");this.key=e,this.chunks=[],i.Writable.call(this,{})}o.inherits(l,i.Writable),l.prototype._write=function(e,t,n){this.chunks.push(e),n()},l.prototype.update=function(e){"string"==typeof e&&(e=a.from(e,"binary")),this.chunks.push(e)},l.prototype.verify=function(e,t){var n;if(u.isSignature(e,[2,0])){if("ed25519"!==e.type)return!1;n=e.toBuffer("raw")}else if("string"==typeof e)n=a.from(e,"base64");else if(u.isSignature(e,[1,0]))throw new Error("signature was created by too old a version of sshpk and cannot be verified");return s.buffer(n),r.sign.detached.verify(new Uint8Array(a.concat(this.chunks)),new Uint8Array(n),new Uint8Array(this.key.part.A.data))},o.inherits(c,i.Writable),c.prototype._write=function(e,t,n){this.chunks.push(e),n()},c.prototype.update=function(e){"string"==typeof e&&(e=a.from(e,"binary")),this.chunks.push(e)},c.prototype.sign=function(){var e=r.sign.detached(new Uint8Array(a.concat(this.chunks)),new Uint8Array(a.concat([this.key.part.k.data,this.key.part.A.data]))),t=a.from(e),n=u.parse(t,"ed25519","raw");return n.hashAlgorithm="sha512",n}},function(e,t,n){e.exports={read:d,write:v};var r=n(27),i=n(31).Buffer,o=n(47),s=n(46),a=n(50),u=n(113),l=n(715),c=n(114),f=n(381),h=n(716),p="Private-key-format: v1";function d(e,t){if("string"==typeof e){if(e.trim().match(/^[-]+[ ]*BEGIN/))return u.read(e,t);if(e.match(/^\s*ssh-[a-z]/))return l.read(e,t);if(e.match(/^\s*ecdsa-/))return l.read(e,t);if(e.match(/^putty-user-key-file-2:/i))return h.read(e,t);if(b(e))return f.read(e,t);e=i.from(e,"binary")}else{if(r.buffer(e),y(e))return u.read(e,t);if(g(e))return l.read(e,t);if(m(e))return h.read(e,t);if(b(e))return f.read(e,t)}if(e.readUInt32BE(0)e.length||"BEGIN"!==e.slice(t,t+5).toString("ascii"))}function b(e){if(e.length<=p.length)return!1;var t=e.slice(0,p.length);if(t.toString("ascii")===p)return!0;"string"!=typeof e&&(e=e.toString("ascii"));for(var n=e.split("\n"),r=0;n[r].match(/^\;/);)r++;return!!n[r].toString("ascii").match(/\. IN KEY /)||!!n[r].toString("ascii").match(/\. IN DNSKEY /)}function v(e,t){throw new Error('"auto" format cannot be used for writing')}},function(e,t,n){"use strict";var r=n(209).lowlevel.crypto_hash,i=0,o=function(){this.S=[new Uint32Array([3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946]),new Uint32Array([1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055]),new Uint32Array([3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504]),new Uint32Array([976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462])],this.P=new Uint32Array([608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731])};function s(e,t,n){return(e[0][t[n+3]]+e[1][t[n+2]]^e[2][t[n+1]])+e[3][t[n]]}function a(e,t){var n,r=0;for(n=0;n<4;n++,i++)i>=t&&(i=0),r=r<<8|e[i];return r}o.prototype.encipher=function(e,t){void 0===t&&(t=new Uint8Array(e.buffer),0!==e.byteOffset&&(t=t.subarray(e.byteOffset))),e[0]^=this.P[0];for(var n=1;n<16;n+=2)e[1]^=s(this.S,t,0)^this.P[n],e[0]^=s(this.S,t,4)^this.P[n+1];var r=e[0];e[0]=e[1]^this.P[17],e[1]=r},o.prototype.decipher=function(e){var t=new Uint8Array(e.buffer);0!==e.byteOffset&&(t=t.subarray(e.byteOffset)),e[0]^=this.P[17];for(var n=16;n>0;n-=2)e[1]^=s(this.S,t,0)^this.P[n],e[0]^=s(this.S,t,4)^this.P[n-1];var r=e[0];e[0]=e[1]^this.P[0],e[1]=r},o.prototype.expand0state=function(e,t){var n=new Uint32Array(2),r,o,s=new Uint8Array(n.buffer);for(r=0,i=0;r<18;r++)this.P[r]^=a(e,t);for(i=0,r=0;r<18;r+=2)this.encipher(n,s),this.P[r]=n[0],this.P[r+1]=n[1];for(r=0;r<4;r++)for(o=0;o<256;o+=2)this.encipher(n,s),this.S[r][o]=n[0],this.S[r][o+1]=n[1]},o.prototype.expandstate=function(e,t,n,r){var o=new Uint32Array(2),s,u;for(s=0,i=0;s<18;s++)this.P[s]^=a(n,r);for(s=0,i=0;s<18;s+=2)o[0]^=a(e,t),o[1]^=a(e,t),this.encipher(o),this.P[s]=o[0],this.P[s+1]=o[1];for(s=0;s<4;s++)for(u=0;u<256;u+=2)o[0]^=a(e,t),o[1]^=a(e,t),this.encipher(o),this.S[s][u]=o[0],this.S[s][u+1]=o[1];i=0},o.prototype.enc=function(e,t){for(var n=0;n>>24,n[4*s+2]=i[s]>>>16,n[4*s+1]=i[s]>>>8,n[4*s+0]=i[s]}function f(e,t,n,i,o,s,a){var u=new Uint8Array(64),f=new Uint8Array(64),h=new Uint8Array(l),p=new Uint8Array(l),d=new Uint8Array(i+4),m,g,y,b,v,w,_=s;if(a<1)return-1;if(0===t||0===i||0===s||s>h.byteLength*h.byteLength||i>1<<20)return-1;for(b=Math.floor((s+h.byteLength-1)/h.byteLength),y=Math.floor((s+b-1)/b),m=0;m0;w++){for(d[i+0]=w>>>24,d[i+1]=w>>>16,d[i+2]=w>>>8,d[i+3]=w,r(f,d,i+4),c(u,f,p),m=h.byteLength;m--;)h[m]=p[m];for(m=1;m=_));m++)o[v]=h[m];s-=m}return 0}e.exports={BLOCKS:u,HASHSIZE:l,hash:c,pbkdf:f}},function(e,t,n){e.exports={read:h,write:p};var r=n(27),i=n(31).Buffer,o=n(114),s=n(47),a=n(46),u=n(50),l=n(287),c=/^([a-z0-9-]+)[ \t]+([a-zA-Z0-9+\/]+[=]*)([ \t]+([^ \t][^\n]*[\n]*)?)?$/,f=/^([a-z0-9-]+)[ \t\n]+([a-zA-Z0-9+\/][a-zA-Z0-9+\/ \t\n=]*)([^a-zA-Z0-9+\/ \t\n=].*)?$/;function h(e,t){"string"!=typeof e&&(r.buffer(e,"buf"),e=e.toString("ascii"));var n=e.trim().replace(/[\\\r]/g,""),s=n.match(c);s||(s=n.match(f)),r.ok(s,"key must match regex");var a=o.algToKeyType(s[1]),u=i.from(s[2],"base64"),l,h={};if(s[4])try{l=o.read(u)}catch(e){s=n.match(f),r.ok(s,"key must match regex"),u=i.from(s[2],"base64"),l=o.readInternal(h,"public",u)}else l=o.readInternal(h,"public",u);if(r.strictEqual(a,l.type),s[4]&&s[4].length>0)l.comment=s[4];else if(h.consumed){var p=s[2]+(s[3]?s[3]:""),d=4*Math.ceil(h.consumed/3);p=p.slice(0,d-2).replace(/[^a-zA-Z0-9+\/=]/g,"")+p.slice(d-2);var m=h.consumed%3;for(m>0&&"="!==p.slice(d-1,d)&&d--;"="===p.slice(d,d+1);)d++;var g=p.slice(d);g=g.replace(/[\r\n]/g," ").replace(/^\s+/,""),g.match(/^[a-zA-Z0-9]/)&&(l.comment=g)}return l}function p(e,t){if(r.object(e),!a.isKey(e))throw new Error("Must be a public key");var n=[],s=o.keyTypeToAlg(e);n.push(s);var u=o.write(e);return n.push(u.toString("base64")),e.comment&&n.push(e.comment),i.from(n.join(" "))}},function(e,t,n){e.exports={read:u,write:c};var r=n(27),i=n(31).Buffer,o=n(114),s=n(46),a=n(97);function u(e,t){for(var n=e.toString("ascii").split(/[\r\n]+/),s=!1,a,u=0;un.length)throw new Error("Invalid public-lines count");var p=i.from(n.slice(u,u+h).join(""),"base64"),d=o.algToKeyType(c),m=o.read(p);if(m.type!==d)throw new Error("Outer key algorithm mismatch");return m.comment=f,m}function l(e){var t=e.indexOf(":");if(-1===t)return null;var n=e.slice(0,t);for(++t;" "===e[t];)++t;var r=e.slice(t);return[n,r]}function c(e,t){if(r.object(e),!s.isKey(e))throw new Error("Must be a public key");var n=o.keyTypeToAlg(e),a=o.write(e),u=e.comment||"",l=a.toString("base64"),c=f(l,64);return c.unshift("Public-Lines: "+c.length),c.unshift("Comment: "+u),c.unshift("Encryption: none"),c.unshift("PuTTY-User-Key-File-2: "+n),i.from(c.join("\n")+"\n")}function f(e,t){for(var n=[],r=0;r1)throw new Error("DER sequence does not contain whole byte stream");var s=n.offset;n.readSequence();var a=n.offset+n.length,u=a;if(n.peek()===y(0)){n.readSequence(y(0));var l=n.readInt();r.ok(l<=3,"only x.509 versions up to v3 supported")}var c={signatures:{}},g=c.signatures.x509={};g.extras={},c.serial=m(n,"serial"),n.readSequence();var b=n.offset+n.length,w=n.readOID(),_=v[w];if(void 0===_)throw new Error("unknown signature algorithm "+w);if(n._offset=b,c.issuer=f.parseAsn1(n),n.readSequence(),c.validFrom=k(n),c.validUntil=k(n),c.subjects=[f.parseAsn1(n)],n.readSequence(),b=n.offset+n.length,c.subjectKey=d.readPkcs8(void 0,"public",n),n._offset=b,n.peek()===y(1)&&(n.readSequence(y(1)),g.extras.issuerUniqueID=e.slice(n.offset,n.offset+n.length),n._offset+=n.length),n.peek()===y(2)&&(n.readSequence(y(2)),g.extras.subjectUniqueID=e.slice(n.offset,n.offset+n.length),n._offset+=n.length),n.peek()===y(3)){n.readSequence(y(3));var S=n.offset+n.length;for(n.readSequence();n.offset=2050||t.getUTCFullYear()<1950?e.writeString(N(t),i.Ber.GeneralizedTime):e.writeString(R(t),i.Ber.UTCTime)}var E={OtherName:y(0),RFC822Name:b(1),DNSName:b(2),X400Address:y(3),DirectoryName:y(4),EDIPartyName:y(5),URI:b(6),IPAddress:b(7),OID:b(8)},x={serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",joyentDocker:"1.3.6.1.4.1.38678.1.4.1",joyentCmon:"1.3.6.1.4.1.38678.1.4.2"},C={};Object.keys(x).forEach(function(e){C[x[e]]=e});var A=["signature","identity","keyEncryption","encryption","keyAgreement","ca","crl"];function I(e,t,n){n.readSequence();var r=n.offset+n.length,o=n.readOID(),s,a=e.signatures.x509,u;switch(a.extras.exts||(a.extras.exts=[]),n.peek()===i.Ber.Boolean&&(u=n.readBoolean()),o){case w.basicConstraints:n.readSequence(i.Ber.OctetString),n.readSequence();var l=n.offset+n.length,c=!1;n.peek()===i.Ber.Boolean&&(c=n.readBoolean()),void 0===e.purposes&&(e.purposes=[]),!0===c&&e.purposes.push("ca");var h={oid:o,critical:u};n.offset=60?o-1:o,n.setUTCFullYear(s,parseInt(t[2],10)-1,parseInt(t[3],10)),n.setUTCHours(parseInt(t[4],10),parseInt(t[5],10)),t[6]&&t[6].length>0&&n.setUTCSeconds(parseInt(t[6],10)),n}var O=/^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})?Z$/;function P(e){var t=e.match(O);r.ok(t);var n=new Date;return n.setUTCFullYear(parseInt(t[1],10),parseInt(t[2],10)-1,parseInt(t[3],10)),n.setUTCHours(parseInt(t[4],10),parseInt(t[5],10)),t[6]&&t[6].length>0&&n.setUTCSeconds(parseInt(t[6],10)),n}function B(e,t){void 0===t&&(t=2);for(var n=""+e;n.length0||"host"===o.type||void 0!==e.purposes&&e.purposes.length>0||n.extras&&n.extras.exts){t.startSequence(y(3)),t.startSequence();var u=[];void 0!==e.purposes&&e.purposes.length>0&&(u.push({oid:w.basicConstraints,critical:!0}),u.push({oid:w.keyUsage,critical:!0}),u.push({oid:w.extKeyUsage,critical:!0})),u.push({oid:w.altName}),n.extras&&n.extras.exts&&(u=n.extras.exts);for(var l=0;l=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122?r+=n.charAt(o):s<128?r+=i[s]:s<2048?r+=i[192|s>>6]+i[128|63&s]:s<55296||s>=57344?r+=i[224|s>>12]+i[128|s>>6&63]+i[128|63&s]:(o+=1,s=65536+((1023&s)<<10|1023&n.charCodeAt(o)),r+=i[240|s>>18]+i[128|s>>12&63]+i[128|s>>6&63]+i[128|63&s])}return r},f=function e(t){for(var n=[{obj:{o:t},prop:"o"}],r=[],i=0;i",w=m?">":"<",f=void 0;if(b){var _=t.util.getData(y.$data,s,t.dataPathArr),k="exclusive"+o,S="exclType"+o,E="exclIsNumber"+o,x="op"+o,C="' + "+x+" + '";i+=" var schemaExcl"+o+" = "+_+"; ",_="schemaExcl"+o,i+=" var "+k+"; var "+S+" = typeof "+_+"; if ("+S+" != 'boolean' && "+S+" != 'undefined' && "+S+" != 'number') { ";var f=g,A=A||[];A.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(f||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(l)+" , params: {} ",!1!==t.opts.messages&&(i+=" , message: '"+g+" should be boolean' "),t.opts.verbose&&(i+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+h+" "),i+=" } "):i+=" {} ";var I=i;i=A.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+I+"]); ":i+=" validate.errors = ["+I+"]; return false; ":i+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" "+S+" == 'number' ? ( ("+k+" = "+d+" === undefined || "+_+" "+v+"= "+d+") ? "+h+" "+w+"= "+_+" : "+h+" "+w+" "+d+" ) : ( ("+k+" = "+_+" === true) ? "+h+" "+w+"= "+d+" : "+h+" "+w+" "+d+" ) || "+h+" !== "+h+") { var op"+o+" = "+k+" ? '"+v+"' : '"+v+"='; ",void 0===a&&(f=g,l=t.errSchemaPath+"/"+g,d=_,p=b)}else{var E="number"==typeof y,C=v;if(E&&p){var x="'"+C+"'";i+=" if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" ( "+d+" === undefined || "+y+" "+v+"= "+d+" ? "+h+" "+w+"= "+y+" : "+h+" "+w+" "+d+" ) || "+h+" !== "+h+") { "}else{E&&void 0===a?(k=!0,f=g,l=t.errSchemaPath+"/"+g,d=y,w+="="):(E&&(d=Math[m?"min":"max"](y,a)),y===(!E||d)?(k=!0,f=g,l=t.errSchemaPath+"/"+g,w+="="):(k=!1,C+="="));var x="'"+C+"'";i+=" if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" "+h+" "+w+" "+d+" || "+h+" !== "+h+") { "}}f=f||n;var A=A||[];A.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(f||"_limit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(l)+" , params: { comparison: "+x+", limit: "+d+", exclusive: "+k+" } ",!1!==t.opts.messages&&(i+=" , message: 'should be "+C+" ",i+=p?"' + "+d:d+"'"),t.opts.verbose&&(i+=" , schema: ",i+=p?"validate.schema"+u:""+a,i+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+h+" "),i+=" } "):i+=" {} ";var I=i;return i=A.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+I+"]); ":i+=" validate.errors = ["+I+"]; return false; ":i+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",c&&(i+=" else { "),i}},function(e,t,n){"use strict";e.exports=function e(t,n,r){var i=" ",o=t.level,s=t.dataLevel,a=t.schema[n],u=t.schemaPath+t.util.getProperty(n),l=t.errSchemaPath+"/"+n,c=!t.opts.allErrors,f,h="data"+(s||""),p=t.opts.$data&&a&&a.$data,d;p?(i+=" var schema"+o+" = "+t.util.getData(a.$data,s,t.dataPathArr)+"; ",d="schema"+o):d=a;var m="maxItems"==n?">":"<";i+="if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" "+h+".length "+m+" "+d+") { ";var f=n,g=g||[];g.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(f||"_limitItems")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(l)+" , params: { limit: "+d+" } ",!1!==t.opts.messages&&(i+=" , message: 'should NOT have ",i+="maxItems"==n?"more":"fewer",i+=" than ",i+=p?"' + "+d+" + '":""+a,i+=" items' "),t.opts.verbose&&(i+=" , schema: ",i+=p?"validate.schema"+u:""+a,i+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+h+" "),i+=" } "):i+=" {} ";var y=i;return i=g.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}},function(e,t,n){"use strict";e.exports=function e(t,n,r){var i=" ",o=t.level,s=t.dataLevel,a=t.schema[n],u=t.schemaPath+t.util.getProperty(n),l=t.errSchemaPath+"/"+n,c=!t.opts.allErrors,f,h="data"+(s||""),p=t.opts.$data&&a&&a.$data,d;p?(i+=" var schema"+o+" = "+t.util.getData(a.$data,s,t.dataPathArr)+"; ",d="schema"+o):d=a;var m="maxLength"==n?">":"<";i+="if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),!1===t.opts.unicode?i+=" "+h+".length ":i+=" ucs2length("+h+") ",i+=" "+m+" "+d+") { ";var f=n,g=g||[];g.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(f||"_limitLength")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(l)+" , params: { limit: "+d+" } ",!1!==t.opts.messages&&(i+=" , message: 'should NOT be ",i+="maxLength"==n?"longer":"shorter",i+=" than ",i+=p?"' + "+d+" + '":""+a,i+=" characters' "),t.opts.verbose&&(i+=" , schema: ",i+=p?"validate.schema"+u:""+a,i+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+h+" "),i+=" } "):i+=" {} ";var y=i;return i=g.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}},function(e,t,n){"use strict";e.exports=function e(t,n,r){var i=" ",o=t.level,s=t.dataLevel,a=t.schema[n],u=t.schemaPath+t.util.getProperty(n),l=t.errSchemaPath+"/"+n,c=!t.opts.allErrors,f,h="data"+(s||""),p=t.opts.$data&&a&&a.$data,d;p?(i+=" var schema"+o+" = "+t.util.getData(a.$data,s,t.dataPathArr)+"; ",d="schema"+o):d=a;var m="maxProperties"==n?">":"<";i+="if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" Object.keys("+h+").length "+m+" "+d+") { ";var f=n,g=g||[];g.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(f||"_limitProperties")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(l)+" , params: { limit: "+d+" } ",!1!==t.opts.messages&&(i+=" , message: 'should NOT have ",i+="maxProperties"==n?"more":"fewer",i+=" than ",i+=p?"' + "+d+" + '":""+a,i+=" properties' "),t.opts.verbose&&(i+=" , schema: ",i+=p?"validate.schema"+u:""+a,i+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+h+" "),i+=" } "):i+=" {} ";var y=i;return i=g.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}},function(e){e.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}},function(e,t,n){"use strict";function r(e,t,n){this.name="RequestError",this.message=String(e),this.cause=e,this.error=e,this.options=t,this.response=n,Error.captureStackTrace&&Error.captureStackTrace(this)}function i(e,t,n,r){this.name="StatusCodeError",this.statusCode=e,this.message=e+" - "+(JSON&&JSON.stringify?JSON.stringify(t):t),this.error=t,this.options=n,this.response=r,Error.captureStackTrace&&Error.captureStackTrace(this)}function o(e,t,n){this.name="TransformError",this.message=String(e),this.cause=e,this.error=e,this.options=t,this.response=n,Error.captureStackTrace&&Error.captureStackTrace(this)}r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,o.prototype=Object.create(Error.prototype),o.prototype.constructor=o,e.exports={RequestError:r,StatusCodeError:i,TransformError:o}},function(e,t,n){"use strict"; + */function r(e,t){if(t===e)return!0;var n=e.indexOf(t);if(0===n){if("/"===t.substr(-1))return!0;if("/"===e.substr(t.length,1))return!0}return!1}t.pathMatch=r},function(e,t,n){"use strict";function r(e,t,n,r){for(var i=65535&e|0,o=e>>>16&65535|0,s=0;0!==n;){s=n>2e3?2e3:n,n-=s;do{i=i+t[r++]|0,o=o+i|0}while(--s);i%=65521,o%=65521}return i|o<<16|0}e.exports=r},function(e,t,n){"use strict";function r(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}var i=r();function o(e,t,n,r){var o=i,s=r+n;e^=-1;for(var a=r;a>>8^o[255&(e^t[a])];return-1^e}e.exports=o},function(e,t,n){e.exports={Verifier:u,Signer:c};var r=n(174),i=n(62),o=n(14),s=n(25),a=n(29).Buffer,l=n(83);function u(e,t){if("sha512"!==t.toLowerCase())throw new Error("ED25519 only supports the use of SHA-512 hashes");this.key=e,this.chunks=[],i.Writable.call(this,{})}function c(e,t){if("sha512"!==t.toLowerCase())throw new Error("ED25519 only supports the use of SHA-512 hashes");this.key=e,this.chunks=[],i.Writable.call(this,{})}o.inherits(u,i.Writable),u.prototype._write=function(e,t,n){this.chunks.push(e),n()},u.prototype.update=function(e){"string"==typeof e&&(e=a.from(e,"binary")),this.chunks.push(e)},u.prototype.verify=function(e,t){var n;if(l.isSignature(e,[2,0])){if("ed25519"!==e.type)return!1;n=e.toBuffer("raw")}else if("string"==typeof e)n=a.from(e,"base64");else if(l.isSignature(e,[1,0]))throw new Error("signature was created by too old a version of sshpk and cannot be verified");return s.buffer(n),r.sign.detached.verify(new Uint8Array(a.concat(this.chunks)),new Uint8Array(n),new Uint8Array(this.key.part.A.data))},o.inherits(c,i.Writable),c.prototype._write=function(e,t,n){this.chunks.push(e),n()},c.prototype.update=function(e){"string"==typeof e&&(e=a.from(e,"binary")),this.chunks.push(e)},c.prototype.sign=function(){var e=r.sign.detached(new Uint8Array(a.concat(this.chunks)),new Uint8Array(a.concat([this.key.part.k.data,this.key.part.A.data]))),t=a.from(e),n=l.parse(t,"ed25519","raw");return n.hashAlgorithm="sha512",n}},function(e,t,n){e.exports={read:d,write:b};var r=n(25),i=n(29).Buffer,o=n(42),s=n(41),a=n(46),l=n(92),u=n(617),c=n(93),h=n(319),f=n(618),p="Private-key-format: v1";function d(e,t){if("string"==typeof e){if(e.trim().match(/^[-]+[ ]*BEGIN/))return l.read(e,t);if(e.match(/^\s*ssh-[a-z]/))return u.read(e,t);if(e.match(/^\s*ecdsa-/))return u.read(e,t);if(e.match(/^putty-user-key-file-2:/i))return f.read(e,t);if(v(e))return h.read(e,t);e=i.from(e,"binary")}else{if(r.buffer(e),y(e))return l.read(e,t);if(g(e))return u.read(e,t);if(m(e))return f.read(e,t);if(v(e))return h.read(e,t)}if(e.readUInt32BE(0)e.length||"BEGIN"!==e.slice(t,t+5).toString("ascii"))}function v(e){if(e.length<=p.length)return!1;var t=e.slice(0,p.length);if(t.toString("ascii")===p)return!0;"string"!=typeof e&&(e=e.toString("ascii"));for(var n=e.split("\n"),r=0;n[r].match(/^\;/);)r++;return!!n[r].toString("ascii").match(/\. IN KEY /)||!!n[r].toString("ascii").match(/\. IN DNSKEY /)}function b(e,t){throw new Error('"auto" format cannot be used for writing')}},function(e,t,n){"use strict";var r=n(174).lowlevel.crypto_hash,i=0,o=function(){this.S=[new Uint32Array([3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946]),new Uint32Array([1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055]),new Uint32Array([3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504]),new Uint32Array([976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462])],this.P=new Uint32Array([608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731])};function s(e,t,n){return(e[0][t[n+3]]+e[1][t[n+2]]^e[2][t[n+1]])+e[3][t[n]]}function a(e,t){var n,r=0;for(n=0;n<4;n++,i++)i>=t&&(i=0),r=r<<8|e[i];return r}o.prototype.encipher=function(e,t){void 0===t&&(t=new Uint8Array(e.buffer),0!==e.byteOffset&&(t=t.subarray(e.byteOffset))),e[0]^=this.P[0];for(var n=1;n<16;n+=2)e[1]^=s(this.S,t,0)^this.P[n],e[0]^=s(this.S,t,4)^this.P[n+1];var r=e[0];e[0]=e[1]^this.P[17],e[1]=r},o.prototype.decipher=function(e){var t=new Uint8Array(e.buffer);0!==e.byteOffset&&(t=t.subarray(e.byteOffset)),e[0]^=this.P[17];for(var n=16;n>0;n-=2)e[1]^=s(this.S,t,0)^this.P[n],e[0]^=s(this.S,t,4)^this.P[n-1];var r=e[0];e[0]=e[1]^this.P[0],e[1]=r},o.prototype.expand0state=function(e,t){var n=new Uint32Array(2),r,o,s=new Uint8Array(n.buffer);for(r=0,i=0;r<18;r++)this.P[r]^=a(e,t);for(i=0,r=0;r<18;r+=2)this.encipher(n,s),this.P[r]=n[0],this.P[r+1]=n[1];for(r=0;r<4;r++)for(o=0;o<256;o+=2)this.encipher(n,s),this.S[r][o]=n[0],this.S[r][o+1]=n[1]},o.prototype.expandstate=function(e,t,n,r){var o=new Uint32Array(2),s,l;for(s=0,i=0;s<18;s++)this.P[s]^=a(n,r);for(s=0,i=0;s<18;s+=2)o[0]^=a(e,t),o[1]^=a(e,t),this.encipher(o),this.P[s]=o[0],this.P[s+1]=o[1];for(s=0;s<4;s++)for(l=0;l<256;l+=2)o[0]^=a(e,t),o[1]^=a(e,t),this.encipher(o),this.S[s][l]=o[0],this.S[s][l+1]=o[1];i=0},o.prototype.enc=function(e,t){for(var n=0;n>>24,n[4*s+2]=i[s]>>>16,n[4*s+1]=i[s]>>>8,n[4*s+0]=i[s]}function h(e,t,n,i,o,s,a){var l=new Uint8Array(64),h=new Uint8Array(64),f=new Uint8Array(u),p=new Uint8Array(u),d=new Uint8Array(i+4),m,g,y,v,b,_,w=s;if(a<1)return-1;if(0===t||0===i||0===s||s>f.byteLength*f.byteLength||i>1<<20)return-1;for(v=Math.floor((s+f.byteLength-1)/f.byteLength),y=Math.floor((s+v-1)/v),m=0;m0;_++){for(d[i+0]=_>>>24,d[i+1]=_>>>16,d[i+2]=_>>>8,d[i+3]=_,r(h,d,i+4),c(l,h,p),m=f.byteLength;m--;)f[m]=p[m];for(m=1;m=w));m++)o[b]=f[m];s-=m}return 0}e.exports={BLOCKS:l,HASHSIZE:u,hash:c,pbkdf:h}},function(e,t,n){e.exports={read:f,write:p};var r=n(25),i=n(29).Buffer,o=n(93),s=n(42),a=n(41),l=n(46),u=n(238),c=/^([a-z0-9-]+)[ \t]+([a-zA-Z0-9+\/]+[=]*)([ \t]+([^ \t][^\n]*[\n]*)?)?$/,h=/^([a-z0-9-]+)[ \t\n]+([a-zA-Z0-9+\/][a-zA-Z0-9+\/ \t\n=]*)([^a-zA-Z0-9+\/ \t\n=].*)?$/;function f(e,t){"string"!=typeof e&&(r.buffer(e,"buf"),e=e.toString("ascii"));var n=e.trim().replace(/[\\\r]/g,""),s=n.match(c);s||(s=n.match(h)),r.ok(s,"key must match regex");var a=o.algToKeyType(s[1]),l=i.from(s[2],"base64"),u,f={};if(s[4])try{u=o.read(l)}catch(e){s=n.match(h),r.ok(s,"key must match regex"),l=i.from(s[2],"base64"),u=o.readInternal(f,"public",l)}else u=o.readInternal(f,"public",l);if(r.strictEqual(a,u.type),s[4]&&s[4].length>0)u.comment=s[4];else if(f.consumed){var p=s[2]+(s[3]?s[3]:""),d=4*Math.ceil(f.consumed/3);p=p.slice(0,d-2).replace(/[^a-zA-Z0-9+\/=]/g,"")+p.slice(d-2);var m=f.consumed%3;for(m>0&&"="!==p.slice(d-1,d)&&d--;"="===p.slice(d,d+1);)d++;var g=p.slice(d);g=g.replace(/[\r\n]/g," ").replace(/^\s+/,""),g.match(/^[a-zA-Z0-9]/)&&(u.comment=g)}return u}function p(e,t){if(r.object(e),!a.isKey(e))throw new Error("Must be a public key");var n=[],s=o.keyTypeToAlg(e);n.push(s);var l=o.write(e);return n.push(l.toString("base64")),e.comment&&n.push(e.comment),i.from(n.join(" "))}},function(e,t,n){e.exports={read:l,write:c};var r=n(25),i=n(29).Buffer,o=n(93),s=n(41),a=n(76);function l(e,t){for(var n=e.toString("ascii").split(/[\r\n]+/),s=!1,a,l=0;ln.length)throw new Error("Invalid public-lines count");var p=i.from(n.slice(l,l+f).join(""),"base64"),d=o.algToKeyType(c),m=o.read(p);if(m.type!==d)throw new Error("Outer key algorithm mismatch");return m.comment=h,m}function u(e){var t=e.indexOf(":");if(-1===t)return null;var n=e.slice(0,t);for(++t;" "===e[t];)++t;var r=e.slice(t);return[n,r]}function c(e,t){if(r.object(e),!s.isKey(e))throw new Error("Must be a public key");var n=o.keyTypeToAlg(e),a=o.write(e),l=e.comment||"",u=a.toString("base64"),c=h(u,64);return c.unshift("Public-Lines: "+c.length),c.unshift("Comment: "+l),c.unshift("Encryption: none"),c.unshift("PuTTY-User-Key-File-2: "+n),i.from(c.join("\n")+"\n")}function h(e,t){for(var n=[],r=0;r1)throw new Error("DER sequence does not contain whole byte stream");var s=n.offset;n.readSequence();var a=n.offset+n.length,l=a;if(n.peek()===y(0)){n.readSequence(y(0));var u=n.readInt();r.ok(u<=3,"only x.509 versions up to v3 supported")}var c={signatures:{}},g=c.signatures.x509={};g.extras={},c.serial=m(n,"serial"),n.readSequence();var v=n.offset+n.length,_=n.readOID(),w=b[_];if(void 0===w)throw new Error("unknown signature algorithm "+_);if(n._offset=v,c.issuer=h.parseAsn1(n),n.readSequence(),c.validFrom=k(n),c.validUntil=k(n),c.subjects=[h.parseAsn1(n)],n.readSequence(),v=n.offset+n.length,c.subjectKey=d.readPkcs8(void 0,"public",n),n._offset=v,n.peek()===y(1)&&(n.readSequence(y(1)),g.extras.issuerUniqueID=e.slice(n.offset,n.offset+n.length),n._offset+=n.length),n.peek()===y(2)&&(n.readSequence(y(2)),g.extras.subjectUniqueID=e.slice(n.offset,n.offset+n.length),n._offset+=n.length),n.peek()===y(3)){n.readSequence(y(3));var E=n.offset+n.length;for(n.readSequence();n.offset=2050||t.getUTCFullYear()<1950?e.writeString(N(t),i.Ber.GeneralizedTime):e.writeString(P(t),i.Ber.UTCTime)}var S={OtherName:y(0),RFC822Name:v(1),DNSName:v(2),X400Address:y(3),DirectoryName:y(4),EDIPartyName:y(5),URI:v(6),IPAddress:v(7),OID:v(8)},x={serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",joyentDocker:"1.3.6.1.4.1.38678.1.4.1",joyentCmon:"1.3.6.1.4.1.38678.1.4.2"},C={};Object.keys(x).forEach(function(e){C[x[e]]=e});var A=["signature","identity","keyEncryption","encryption","keyAgreement","ca","crl"];function T(e,t,n){n.readSequence();var r=n.offset+n.length,o=n.readOID(),s,a=e.signatures.x509,l;switch(a.extras.exts||(a.extras.exts=[]),n.peek()===i.Ber.Boolean&&(l=n.readBoolean()),o){case _.basicConstraints:n.readSequence(i.Ber.OctetString),n.readSequence();var u=n.offset+n.length,c=!1;n.peek()===i.Ber.Boolean&&(c=n.readBoolean()),void 0===e.purposes&&(e.purposes=[]),!0===c&&e.purposes.push("ca");var f={oid:o,critical:l};n.offset=60?o-1:o,n.setUTCFullYear(s,parseInt(t[2],10)-1,parseInt(t[3],10)),n.setUTCHours(parseInt(t[4],10),parseInt(t[5],10)),t[6]&&t[6].length>0&&n.setUTCSeconds(parseInt(t[6],10)),n}var R=/^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})?Z$/;function B(e){var t=e.match(R);r.ok(t);var n=new Date;return n.setUTCFullYear(parseInt(t[1],10),parseInt(t[2],10)-1,parseInt(t[3],10)),n.setUTCHours(parseInt(t[4],10),parseInt(t[5],10)),t[6]&&t[6].length>0&&n.setUTCSeconds(parseInt(t[6],10)),n}function O(e,t){void 0===t&&(t=2);for(var n=""+e;n.length0||"host"===o.type||void 0!==e.purposes&&e.purposes.length>0||n.extras&&n.extras.exts){t.startSequence(y(3)),t.startSequence();var l=[];void 0!==e.purposes&&e.purposes.length>0&&(l.push({oid:_.basicConstraints,critical:!0}),l.push({oid:_.keyUsage,critical:!0}),l.push({oid:_.extKeyUsage,critical:!0})),l.push({oid:_.altName}),n.extras&&n.extras.exts&&(l=n.extras.exts);for(var u=0;u=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122?r+=n.charAt(o):s<128?r+=i[s]:s<2048?r+=i[192|s>>6]+i[128|63&s]:s<55296||s>=57344?r+=i[224|s>>12]+i[128|s>>6&63]+i[128|63&s]:(o+=1,s=65536+((1023&s)<<10|1023&n.charCodeAt(o)),r+=i[240|s>>18]+i[128|s>>12&63]+i[128|s>>6&63]+i[128|63&s])}return r},h=function e(t){for(var n=[{obj:{o:t},prop:"o"}],r=[],i=0;i",_=m?">":"<",h=void 0;if(v){var w=t.util.getData(y.$data,s,t.dataPathArr),k="exclusive"+o,E="exclType"+o,S="exclIsNumber"+o,x="op"+o,C="' + "+x+" + '";i+=" var schemaExcl"+o+" = "+w+"; ",w="schemaExcl"+o,i+=" var "+k+"; var "+E+" = typeof "+w+"; if ("+E+" != 'boolean' && "+E+" != 'undefined' && "+E+" != 'number') { ";var h=g,A=A||[];A.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(h||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: {} ",!1!==t.opts.messages&&(i+=" , message: '"+g+" should be boolean' "),t.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var T=i;i=A.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+T+"]); ":i+=" validate.errors = ["+T+"]; return false; ":i+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" "+E+" == 'number' ? ( ("+k+" = "+d+" === undefined || "+w+" "+b+"= "+d+") ? "+f+" "+_+"= "+w+" : "+f+" "+_+" "+d+" ) : ( ("+k+" = "+w+" === true) ? "+f+" "+_+"= "+d+" : "+f+" "+_+" "+d+" ) || "+f+" !== "+f+") { var op"+o+" = "+k+" ? '"+b+"' : '"+b+"='; ",void 0===a&&(h=g,u=t.errSchemaPath+"/"+g,d=w,p=v)}else{var S="number"==typeof y,C=b;if(S&&p){var x="'"+C+"'";i+=" if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" ( "+d+" === undefined || "+y+" "+b+"= "+d+" ? "+f+" "+_+"= "+y+" : "+f+" "+_+" "+d+" ) || "+f+" !== "+f+") { "}else{S&&void 0===a?(k=!0,h=g,u=t.errSchemaPath+"/"+g,d=y,_+="="):(S&&(d=Math[m?"min":"max"](y,a)),y===(!S||d)?(k=!0,h=g,u=t.errSchemaPath+"/"+g,_+="="):(k=!1,C+="="));var x="'"+C+"'";i+=" if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" "+f+" "+_+" "+d+" || "+f+" !== "+f+") { "}}h=h||n;var A=A||[];A.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(h||"_limit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { comparison: "+x+", limit: "+d+", exclusive: "+k+" } ",!1!==t.opts.messages&&(i+=" , message: 'should be "+C+" ",i+=p?"' + "+d:d+"'"),t.opts.verbose&&(i+=" , schema: ",i+=p?"validate.schema"+l:""+a,i+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var T=i;return i=A.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+T+"]); ":i+=" validate.errors = ["+T+"]; return false; ":i+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",c&&(i+=" else { "),i}},function(e,t,n){"use strict";e.exports=function e(t,n,r){var i=" ",o=t.level,s=t.dataLevel,a=t.schema[n],l=t.schemaPath+t.util.getProperty(n),u=t.errSchemaPath+"/"+n,c=!t.opts.allErrors,h,f="data"+(s||""),p=t.opts.$data&&a&&a.$data,d;p?(i+=" var schema"+o+" = "+t.util.getData(a.$data,s,t.dataPathArr)+"; ",d="schema"+o):d=a;var m="maxItems"==n?">":"<";i+="if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" "+f+".length "+m+" "+d+") { ";var h=n,g=g||[];g.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(h||"_limitItems")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { limit: "+d+" } ",!1!==t.opts.messages&&(i+=" , message: 'should NOT have ",i+="maxItems"==n?"more":"fewer",i+=" than ",i+=p?"' + "+d+" + '":""+a,i+=" items' "),t.opts.verbose&&(i+=" , schema: ",i+=p?"validate.schema"+l:""+a,i+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var y=i;return i=g.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}},function(e,t,n){"use strict";e.exports=function e(t,n,r){var i=" ",o=t.level,s=t.dataLevel,a=t.schema[n],l=t.schemaPath+t.util.getProperty(n),u=t.errSchemaPath+"/"+n,c=!t.opts.allErrors,h,f="data"+(s||""),p=t.opts.$data&&a&&a.$data,d;p?(i+=" var schema"+o+" = "+t.util.getData(a.$data,s,t.dataPathArr)+"; ",d="schema"+o):d=a;var m="maxLength"==n?">":"<";i+="if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),!1===t.opts.unicode?i+=" "+f+".length ":i+=" ucs2length("+f+") ",i+=" "+m+" "+d+") { ";var h=n,g=g||[];g.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(h||"_limitLength")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { limit: "+d+" } ",!1!==t.opts.messages&&(i+=" , message: 'should NOT be ",i+="maxLength"==n?"longer":"shorter",i+=" than ",i+=p?"' + "+d+" + '":""+a,i+=" characters' "),t.opts.verbose&&(i+=" , schema: ",i+=p?"validate.schema"+l:""+a,i+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var y=i;return i=g.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}},function(e,t,n){"use strict";e.exports=function e(t,n,r){var i=" ",o=t.level,s=t.dataLevel,a=t.schema[n],l=t.schemaPath+t.util.getProperty(n),u=t.errSchemaPath+"/"+n,c=!t.opts.allErrors,h,f="data"+(s||""),p=t.opts.$data&&a&&a.$data,d;p?(i+=" var schema"+o+" = "+t.util.getData(a.$data,s,t.dataPathArr)+"; ",d="schema"+o):d=a;var m="maxProperties"==n?">":"<";i+="if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" Object.keys("+f+").length "+m+" "+d+") { ";var h=n,g=g||[];g.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(h||"_limitProperties")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { limit: "+d+" } ",!1!==t.opts.messages&&(i+=" , message: 'should NOT have ",i+="maxProperties"==n?"more":"fewer",i+=" than ",i+=p?"' + "+d+" + '":""+a,i+=" properties' "),t.opts.verbose&&(i+=" , schema: ",i+=p?"validate.schema"+l:""+a,i+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var y=i;return i=g.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}},function(e){e.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}},function(e,t,n){"use strict";function r(e,t,n){this.name="RequestError",this.message=String(e),this.cause=e,this.error=e,this.options=t,this.response=n,Error.captureStackTrace&&Error.captureStackTrace(this)}function i(e,t,n,r){this.name="StatusCodeError",this.statusCode=e,this.message=e+" - "+(JSON&&JSON.stringify?JSON.stringify(t):t),this.error=t,this.options=n,this.response=r,Error.captureStackTrace&&Error.captureStackTrace(this)}function o(e,t,n){this.name="TransformError",this.message=String(e),this.cause=e,this.error=e,this.options=t,this.response=n,Error.captureStackTrace&&Error.captureStackTrace(this)}r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,o.prototype=Object.create(Error.prototype),o.prototype.constructor=o,e.exports={RequestError:r,StatusCodeError:i,TransformError:o}},function(e,t,n){"use strict"; /*! * Copyright (c) 2018, Salesforce.com, Inc. * All rights reserved. @@ -224,7 +201,7 @@ function r(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - */var r=n(706);function i(e){return r.get(e)}t.getPublicSuffix=i},function(e,t,n){"use strict"; + */var r=n(608);function i(e){return r.get(e)}t.getPublicSuffix=i},function(e,t,n){"use strict"; /*! * Copyright (c) 2015, Salesforce.com, Inc. * All rights reserved. @@ -284,7 +261,7 @@ function r(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - */var r=n(731);function i(e){var t=r.getPublicSuffix(e);if(!t)return null;if(t==e)return[e];for(var n=e.slice(0,-(t.length+1)),i=n.split(".").reverse(),o=t,s=[o];i.length;)o=i.shift()+"."+o,s.push(o);return s}t.permuteDomain=i},function(e,t,n){"use strict"; + */var r=n(633);function i(e){var t=r.getPublicSuffix(e);if(!t)return null;if(t==e)return[e];for(var n=e.slice(0,-(t.length+1)),i=n.split(".").reverse(),o=t,s=[o];i.length;)o=i.shift()+"."+o,s.push(o);return s}t.permuteDomain=i},function(e,t,n){"use strict"; /*! * Copyright (c) 2015, Salesforce.com, Inc. * All rights reserved. @@ -314,47 +291,39 @@ function r(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - */function r(e,t){if(t===e)return!0;var n=e.indexOf(t);if(0===n){if("/"===t.substr(-1))return!0;if("/"===e.substr(t.length,1))return!0}return!1}t.pathMatch=r},function(e,t,n){!function(){function t(){var e=function(t,n,r){if(t=""+t,r||s===n||(e.last=t=e.batch)return l.thrash();l.batch.to||(l.batch.to=setTimeout(l.thrash,e.until||1))},c,f,h,p,d;l.batch=s(),l.batch.acks=[],l.batch.ed=0,l.thrash=function(){var t=l.thrash;if(t.ing)return t.more=!0;t.more=!1,t.ing=!0;var n=t.at=l.batch,r=0;clearTimeout(l.batch.to),l.batch=null,l.batch=s(),l.batch.acks=[],l.batch.ed=0,l.save(n,function(i,o){++r>1?e.log("RAD ERR: Radisk has callbacked multiple times, please report this as a BUG at github.com/amark/gun/issues ! "+r):(i&&e.log("err",i),a(n.acks,function(e){e(i,o)}),t.at=null,t.ing=!1,t.more&&t())})},l.save=function(t,n){var r=function e(){};r.find=function(e,t){if(!(tr.start)return r.mix(r.file||e.code.from,r.start,r.end=t),!0;r.file=t},r.mix=function(e,i,o){r.start=r.end=r.file=y,l.parse(e,function(a,u){if(a)return n(a);u=u||s(),s.map(t,function(e,t){if(!(ti))return(r.next||r.reverse)&&(s.file=e),(i=c[s.file])?(i.push({key:t,ack:n,file:s.file,opt:r}),!0):(c[s.file]=[{key:t,ack:n,file:s.file,opt:r}],s.file?(l.parse(s.file,s.it),!0):(s.it(null,y,{}),!0));s.file=e},s.it=function(t,n,r){(s.err=t)&&e.log("err",t),s.info=r,n&&(g=s.disk=n),n=c[s.file],delete c[s.file],a(n,s.ack)},s.ack=function(e){if(e.ack){var t=e.key,n=e.opt,r=s.info,i=s.disk||m,o=l.range(i(t),n),a=i.last;if(n.parsed=(n.parsed||0)+(r.parsed||0),n.chunks=(n.chunks||0)+1,n.some||(n.some=y!==o),y!==o)e.ack(s.err,o,n);else if(!e.file)return void(!n.some&&e.ack(s.err,y,n));if(!n.span){if(/*!last || */a===t)return void(!n.some&&e.ack(s.err,y,n));if(a&&a>t&&0!=a.indexOf(t))return void(!n.some&&e.ack(s.err,y,n))}n.some&&n.parsed>=n.limit||(n.next=e.file,l.read(t,e.ack,n))}},r.reverse&&(s.lex.reverse=!0),l.list(s.lex)},function(){var n={},i=String.fromCharCode(31);l.parse=function(o,u,l){var c;if(c=n[o])return c.push(u);c=n[o]=[u];var f=function e(){},h={};if(f.disk=s(),f.read=function(t,r){var i,s,s;if(delete n[o],(f.err=t)||(f.not=!r))return a(c,f.ack);if("string"!=typeof r){try{e.pack<=r.length?f.err="Chunk too big!":r=r.toString()}catch(e){f.err=e}if(f.err)return a(c,f.ack)}if(h.parsed=r.length,e.jsonify){try{var u=JSON.parse(r);return f.disk.$=u,void a(c,f.ack)}catch(e){i=e}if("{"===r[0])return f.err=i||"JSON error!",a(c,f.ack)}var i=f.split(r),l=[],p,d,m;if(!i||0!==i[1])return f.err="File '"+o+"' does not have root radix! ",a(c,f.ack);for(;i;)d=m=y,p=i[1],i=f.split(i[2])||"","#"==i[0]&&(d=i[1],l=l.slice(0,p),p<=l.length&&l.push(d)),i=f.split(i[2])||"","\n"!=i[0]&&("="!=i[0]&&":"!=i[0]||(m=i[1]),y!==d&&y!==m&&f.disk(l.join(""),m),i=f.split(i[2]));a(c,f.ack)},f.split=function(e){if(e){var n=[],r={},o=-1,s="",a,u;if(o=e.indexOf(i),e[o])return s=e.slice(0,o),n[0]=s,n[1]=a=t.decode(e.slice(o),r),n[2]=e.slice(o+r.i),n}},f.ack=function(e){if(e)return f.err||f.not?e(f.err,y,h):void e(y,f.disk,h)},l)return f.read(null,l);e.store.get(r(o),f.read)}}(),p=String.fromCharCode(28),d=r(p),l.list=function(e){if(f){var t={reverse:e.reverse?1:0};s.map(f,function(t,n){return e(n)},t)||e()}else{if(h)return h.push(e);h=[e],l.parse(p,l.list.init)}},l.list.add=function(e,t){var n=f(e);if(n||e===d)return t(y,1);f(e,!0),t.listed=(t.listed||0)+1,l.write(p,f,function(e,n){if(e)return t(e);t.listed=(t.listed||0)-1,0===t.listed&&t(y,1)},!0)},l.list.init=function(t,n){if(t)return e.log("list",t),void setTimeout(function(){l.parse(p,l.list.init)},1e3);n?l.list.drain(n):e.store.list?e.store.list(function(e){if(f=f||s(),!e)return l.list.drain(f);l.list.add(e,m)}):l.list.drain(s())},l.list.drain=function(e,t){l.list.dir=f=e,t=h,h=null,o.list.map(t,function(e){l.list(e)})};var m=function(){},g,y;return t.has[e.file]=l,l}var r,i;if(r=String.fromCharCode(31),t.encode=function(e,t,n){n=n||r;var i=n,s;if("string"==typeof e){for(var a=e.indexOf(n);-1!=a;)i+=n,a=e.indexOf(n,a+1);return i+'"'+e+n}return e&&e["#"]&&(s=o.val.link.is(e))?i+"#"+s+i:o.num.is(e)?i+"+"+(e||0)+i:null===e?i+" "+i:!0===e?i+"+"+i:!1===e?i+"-"+i:void 0},t.decode=function(e,t,n){n=n||r;var i="",s=-1,a=0,u,l;if(n===e[0]){for(;n===e[++s];)++a;for(l=e[u=a]||!0;--a>=0;)s=e.indexOf(n,s+1);return-1==s&&(s=e.length),i=e.slice(u+1,s),t&&(t.i=s+1),'"'===l?i:"#"===l?o.val.link.ify(i):"+"===l?0===i.length||parseFloat(i):" "===l?null:"-"!==l&&void 0}},"undefined"!=typeof window){var o=window.Gun,s=window.Radix;window.Radisk=t}else{var o=n(168),s=n(735);try{e.exports=t}catch(e){}}t.Radix=s}()},function(e,t,n){const r=n(115);n(765),n(773),n(1688),n(1723),n(1831),n(1984),"undefined"!=typeof window&&(window.DwebTransports=r),t=e.exports=r},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var l=e.length;u>0&&l>u&&(l=u);for(var c=0;c=0?(p=f.substr(0,h),d=f.substr(h+1)):(p=f,d=""),m=decodeURIComponent(p),g=decodeURIComponent(d),r(s,m)?i(s[m])?s[m].push(g):s[m]=[s[m],g]:s[m]=g}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),function(s){var a=encodeURIComponent(r(s))+n;return i(e[s])?o(e[s],function(e){return a+encodeURIComponent(r(e))}).join(t):a+encodeURIComponent(r(e[s]))}).join(t):a?encodeURIComponent(r(a))+n+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r{if("%%"===n)return n;a++;const o=r.formatters[i];if("function"==typeof o){const r=e[a];n=o.call(t,r),e.splice(a,1),a--}return n}),r.formatArgs.call(t,e);const u=t.log||r.log;u.apply(t,e)}return s.namespace=e,s.enabled=r.enabled(e),s.useColors=r.useColors(),s.color=t(e),s.destroy=i,s.extend=o,"function"==typeof r.init&&r.init(s),r.instances.push(s),s}function i(){const e=r.instances.indexOf(this);return-1!==e&&(r.instances.splice(e,1),!0)}function o(e,t){const n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function s(e){let t;r.save(e),r.names=[],r.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(t=0;t"-"+e)].join(",");return r.enable(""),e}function u(e){if("*"===e[e.length-1])return!0;let t,n;for(t=0,n=r.skips.length;t{r[t]=e[t]}),r.instances=[],r.names=[],r.skips=[],r.formatters={},r.selectColor=t,r.enable(r.load()),r}e.exports=r},function(e,t,n){"use strict";t.byteLength=c,t.toByteArray=h,t.fromByteArray=m;for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");-1===n&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=l(e),n=t[0],r=t[1];return 3*(n+r)/4-r}function f(e,t,n){return 3*(t+n)/4-n}function h(e){for(var t,n=l(e),r=n[0],s=n[1],a=new o(f(e,r,s)),u=0,c=s>0?r-4:r,h=0;h>16&255,a[u++]=t>>8&255,a[u++]=255&t;return 2===s&&(t=i[e.charCodeAt(h)]<<2|i[e.charCodeAt(h+1)]>>4,a[u++]=255&t),1===s&&(t=i[e.charCodeAt(h)]<<10|i[e.charCodeAt(h+1)]<<4|i[e.charCodeAt(h+2)]>>2,a[u++]=t>>8&255,a[u++]=255&t),a}function p(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function d(e,t,n){for(var r,i=[],o=t;ou?u:a+16383));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=b;var r=n(745),i=y(r),o=n(67),s=y(o),a=n(68),u=y(a),l=n(131),c=y(l),f=n(215),h=y(f),p=n(749),d=y(p),m=n(42),g=y(m);function y(e){return e&&e.__esModule?e:{default:e}}function b(e,t,n){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var r=(0,g.default)(e),o=0,a=[],l=!1;function f(e,t,n){if(null!=n&&"function"!=typeof n)throw new Error("task callback must be a function");if(y.started=!0,(0,s.default)(e)||(e=[e]),0===e.length&&y.idle())return(0,h.default)(function(){y.drain()});for(var r=0,i=e.length;r0&&a.splice(u,1),s.callback.apply(s,arguments),null!=t&&y.error(t,s.data)}o<=y.concurrency-y.buffer&&y.unsaturated(),y.idle()&&y.drain(),y.process()}}var m=!1,y={_tasks:new d.default,concurrency:t,payload:n,saturated:u.default,unsaturated:u.default,buffer:t/4,empty:u.default,drain:u.default,error:u.default,started:!1,paused:!1,push:function(e,t){f(e,!1,t)},kill:function(){y.drain=u.default,y._tasks.empty()},unshift:function(e,t){f(e,!0,t)},remove:function(e){y._tasks.remove(e)},process:function(){if(!m){for(m=!0;!y.paused&&o{this.status=r.STATUS_STARTING,e&&e(this),this.updateStatus((n,r)=>{e&&e(this),this.startHeartbeat(this.options.heartbeat),t(this)})})}async p_status(e){if(!e)return new Promise((e,t)=>{try{this.updateStatus((n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{this.updateStatus(e)}catch(t){e(t)}}updateStatus(e){this.updateInfo((t,n)=>{t?(u("Error status call to info failed %s",t.message),this.status=r.STATUS_FAILED,e(null,this.status)):(this.info=n,this.status=r.STATUS_CONNECTED,e(null,this.status))})}startHeartbeat({delay:e,statusCB:t}){e&&(u("HTTP Starting Heartbeat"),this.HTTPheartbeatTimer=setInterval(()=>{this.updateStatus((e,n)=>{t&&t(this)},(e,t)=>{})},e))}stopHeartbeat(){this.HTTPheartbeatTimer&&(u("HTTP stopping heartbeat"),clearInterval(this.HTTPheartbeatTimer))}stop(e,t){this.stopHeartbeat(),this.status=r.STATUS_FAILED,e&&e(this),t(null,this)}_cmdurl(e){return`${this.urlbase}/${e}`}_url(e,t,n){if(!e)throw new errors.CodingError(`${t}: requires url`);return"string"!=typeof e&&(e=e.href),e=e.replace("contenthash:/contenthash",this._cmdurl(t)),e=e.replace("getall/table",t),e+=n?"?"+n:"",e}validFor(e,t,n){return(this.connected()||e.protocol.startsWith("http")&&!e.href.startsWith(this.urlbase))&&this.supports(e,t,n)}async p_rawfetch(e,t={}){if(("string"==typeof e?e:e.href).includes("/getall/table"))throw new Error("Probably dont want to be calling p_rawfetch on a KeyValueTable, especially since dont know if its keyvaluetable or subclass");return await o.p_GET(this._url(e,servercommands.rawfetch),t)}p_rawlist(e){if(!e)throw new errors.CodingError("TransportHTTP.p_rawlist: requires url");return o.p_GET(this._url(e,servercommands.rawlist))}rawreverse(){throw new errors.ToBeImplementedError("Undefined function TransportHTTP.rawreverse")}async p_rawstore(e){console.assert(e,"TransportHttp.p_rawstore: requires data");const t=await o.p_POST(this._cmdurl(servercommands.rawstore),{data:e,contenttype:"application/octet-stream"});let n=s.parse(t),r=n.pathname.split("/");return`contenthash:/contenthash/${r.slice(-1)}`}p_rawadd(e,t){if(!e||!t)throw new errors.CodingError("TransportHTTP.p_rawadd: invalid parms",e,t);const n=l(t.preflight(Object.assign({},t)))+"\n";return o.p_POST(this._url(e,servercommands.rawadd),{data:n,contenttype:"application/json"})}p_newlisturls(e){let t=e._publicurls.map(e=>s.parse(e)).find(e=>"https:"===e.protocol&&["gateway.dweb.me","dweb.me"].includes(e.host)&&(e.pathname.includes("/content/rawfetch")||e.pathname.includes("/contenthash/"))||"contenthash:"===e.protocol&&"contenthash"===e.pathname.split("/")[1]);return t||(t=`contenthash:/contenthash/${e.keypair.verifyexportmultihashsha256_58()}`),[t,t]}async p_f_createReadStream(e,{wanturl:t=!1}={}){try{let n=this;return t?e:function(t){return n.createReadStream(e,t)}}catch(e){throw e}}createReadStream(e,t){let n;return u("createreadstream %s %o",s.parse(e).href,t),n=new a.PassThrough,o.p_GET(this._url(e,servercommands.rawfetch),Object.assign({wantstream:!0},t)).then(e=>e.pipe(n)).catch(e=>{console.warn(this.name,"createReadStream caught error",e.message),"function"==typeof n.destroy?n.destroy(e):n.emit("error",e)}),n}async p_createReadStream(e,t){u("createreadstream %s %o",s.parse(e).href,t);try{return await o.p_GET(this._url(e,servercommands.rawfetch),Object.assign({wantstream:!0},t))}catch(e){throw console.warn(this.name,"caught error",e),e}}async p_newdatabase(e){e.hasOwnProperty("keypair")&&(e=e.keypair.signingexport());let t=`${this.urlbase}/getall/table/${encodeURIComponent(e)}`;return{publicurl:t,privateurl:t}}async p_newtable(e,t){if(!e)throw new errors.CodingError("p_newtable currently requires a pubkey");let n=await this.p_newdatabase(e);return{privateurl:`${n.privateurl}/${t}`,publicurl:`${n.publicurl}/${t}`}}async p_set(e,t,n){if(!e||!t)throw new errors.CodingError("TransportHTTP.p_set: invalid parms",e,keyvalyes);if("string"==typeof t){let r=l([{key:t,value:n}]);await o.p_POST(this._url(e,servercommands.set),{data:r,contenttype:"application/json"})}else{let n=l(Object.keys(t).map(e=>({key:e,value:t[e]})));await o.p_POST(this._url(e,servercommands.set),{data:n,contenttype:"application/json"})}}_keyparm(e){return`key=${encodeURIComponent(e)}`}async p_get(e,t){if(!e&&t)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");let n=Array.isArray(t)?t.map(e=>this._keyparm(e)).join("&"):this._keyparm(t);const r=await o.p_GET(this._url(e,servercommands.get,n));return Array.isArray(t)?r:r[t]}async p_delete(e,t){if(!e&&t)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");let n=t.map(e=>this._keyparm(e)).join("&");await o.p_GET(this._url(e,servercommands.delete,n))}async p_keys(e){if(!e&&keys)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");return await o.p_GET(this._url(e,servercommands.keys))}async p_getall(e){if(!e&&keys)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");return await o.p_GET(this._url(e,servercommands.getall))}async p_info(){return new Promise((e,t)=>{try{this.updateInfo((n,r)=>{n?t(n):e(r)})}catch(e){t(e)}})}updateInfo(e){o.p_GET(`${this.urlbase}/info`,{retries:1},e)}static async p_test(e={}){console.log("TransportHTTP.test");try{let t=await this.p_setup(e);console.log("HTTP connected");let n=await t.p_info();console.log("TransportHTTP info=",n),n=await t.p_status(),console.assert(n===r.STATUS_CONNECTED),await t.p_test_kvt("NACL%20VERIFY")}catch(e){throw console.log("Exception thrown in TransportHTTP.test:",e.message),e}}static async test(){return this}}i._transportclasses.HTTP=c,t=e.exports=c},function(e,t){},function(e,t,n){"use strict";function r(e){for(var t=1;t0?this.tail.next=n:this.head=n,this.tail=n,++this.length},t.unshift=function e(t){var n={data:t,next:this.head};0===this.length&&(this.tail=n),this.head=n,++this.length},t.shift=function e(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.clear=function e(){this.head=this.tail=null,this.length=0},t.join=function e(t){if(0===this.length)return"";for(var n=this.head,r=""+n.data;n=n.next;)r+=t+n.data;return r},t.concat=function e(t){if(0===this.length)return s.alloc(0);for(var n=s.allocUnsafe(t>>>0),r=this.head,i=0;r;)c(r.data,n,i),i+=r.data.length,r=r.next;return n},t.consume=function e(t,n){var r;return to.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),t-=s,0===t){s===o.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(s));break}++r}return this.length-=r,i},t._getBuffer=function e(t){var n=s.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(n),t-=r.data.length;r=r.next;){var o=r.data,a=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,a),t-=a,0===t){a===o.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=o.slice(a));break}++i}return this.length-=i,n},t[l]=function(e,t){return u(this,r({},t,{depth:0,customInspect:!1}))},e}()},function(e,t){},function(e,t,n){"use strict";(function(t){var n=new Set;function r(e){if(!n.has(e)){var r=e+" is an experimental feature. This feature could change at any time";n.add(e),t.emitWarning(r,"ExperimentalWarning")}}function i(){}e.exports.emitExperimentalWarning=t.emitWarning?r:i}).call(this,n(2))},function(e,t,n){"use strict";(function(t){var r;function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var o=n(294),s=Symbol("lastResolve"),a=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),c=Symbol("lastPromise"),f=Symbol("handlePromise"),h=Symbol("stream");function p(e,t){return{value:e,done:t}}function d(e){var t=e[s];if(null!==t){var n=e[h].read();null!==n&&(e[c]=null,e[s]=null,e[a]=null,t(p(n,!1)))}}function m(e){t.nextTick(d,e)}function g(e,t){return function(n,r){e.then(function(){t[l]?n(p(void 0,!0)):t[f](n,r)},r)}}var y=Object.getPrototypeOf(function(){}),b=Object.setPrototypeOf((r={get stream(){return this[h]},next:function e(){var n=this,r=this[u];if(null!==r)return Promise.reject(r);if(this[l])return Promise.resolve(p(void 0,!0));if(this[h].destroyed)return new Promise(function(e,r){t.nextTick(function(){n[u]?r(n[u]):e(p(void 0,!0))})});var i=this[c],o;if(i)o=new Promise(g(i,this));else{var s=this[h].read();if(null!==s)return Promise.resolve(p(s,!1));o=new Promise(this[f])}return this[c]=o,o}},i(r,Symbol.asyncIterator,function(){return this}),i(r,"return",function e(){var t=this;return new Promise(function(e,n){t[h].destroy(null,function(t){t?n(t):e(p(void 0,!0))})})}),r),y),v=function e(t){var n,r=Object.create(b,(n={},i(n,h,{value:t,writable:!0}),i(n,s,{value:null,writable:!0}),i(n,a,{value:null,writable:!0}),i(n,u,{value:null,writable:!0}),i(n,l,{value:t._readableState.endEmitted,writable:!0}),i(n,f,{value:function e(t,n){var i=r[h].read();i?(r[c]=null,r[s]=null,r[a]=null,t(p(i,!1))):(r[s]=t,r[a]=n)},writable:!0}),n));return r[c]=null,o(t,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[a];return null!==t&&(r[c]=null,r[s]=null,r[a]=null,t(e)),void(r[u]=e)}var n=r[s];null!==n&&(r[c]=null,r[s]=null,r[a]=null,n(p(void 0,!0))),r[l]=!0}),t.on("readable",m.bind(null,r)),r};e.exports=v}).call(this,n(2))},function(e,t,n){"use strict";e.exports=i;var r=n(401);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}n(1)(i,r),i.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){"use strict";var r;function i(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var o=n(135).codes,s=o.ERR_MISSING_ARGS,a=o.ERR_STREAM_DESTROYED;function u(e){if(e)throw e}function l(e){return e.setHeader&&"function"==typeof e.abort}function c(e,t,o,s){s=i(s);var u=!1;e.on("close",function(){u=!0}),void 0===r&&(r=n(294)),r(e,{readable:t,writable:o},function(e){if(e)return s(e);u=!0,s()});var c=!1;return function(t){if(!u&&!c)return c=!0,l(e)?e.abort():"function"==typeof e.destroy?e.destroy():void s(t||new a("pipe"))}}function f(e){e()}function h(e,t){return e.pipe(t)}function p(e){return e.length?"function"!=typeof e[e.length-1]?u:e.pop():u}function d(){for(var e=arguments.length,t=new Array(e),n=0;n0;return c(e,s,a,function(e){i||(i=e),e&&o.forEach(f),s||(o.forEach(f),r(i))})});return t.reduce(h)}e.exports=d},function(e,t,n){(function(r,i){const o=n(289),s=n(5)("dweb-transports:ipfs"),a=n(774),u=n(1459),l=n(9),c=n(48),f=n(32),h=n(20),p=n(98),d=n(134),m=n(115),g=n(170),y={repo:"/tmp/dweb_ipfsv3107",config:{Bootstrap:["/dns4/dweb.me/tcp/4245/wss/ipfs/QmQz3p44VVQDeAieaW28DMjcTVzLbpxqaQB9bkXnyd7HY5"]},EXPERIMENTAL:{pubsub:!0},preload:{enabled:!1}};class b extends d{constructor(e){super(e),["urlUrlstore","httpIPFSgateway"].forEach(t=>{this[t]=e[t],delete e[t]}),this.ipfs=void 0,this.options=e,this.name="IPFS",this.supportURLs=["ipfs"],this.supportFunctions=["fetch","store","seed","createReadStream"],this.supportFeatures=["noCache"],this.status=d.STATUS_LOADED}_ipfsversion(e,t,n){e.version((r,i)=>{r?(s("IPFS via %s present but unresponsive: %o",t,i),this.ipfstype="FAILED",n(r)):(s("IPFS available via %s: %o",t,i),this.ipfstype=t,n(null,e))})}IPFSAutoConnect(e){if(r.ipfs)this._ipfsversion(r.ipfs,"global.ipfs",e);else if("undefined"!=typeof window&&window.ipfs)this._ipfsversion(window.ipfs,"window.ipfs",e);else{var t=u("localhost","5001",{protocol:"http"});t.version((n,r)=>{n?(s("IPFS via API failed %s, trying running own IPFS client",n.message),t=new a(this.options),t.on("ready",()=>{this._ipfsversion(t,"client",e)}),t.on("error",t=>{s("IPFS via client error %s",t.message),e(t)})):this._ipfsversion(t,"API",e)})}}static setup0(e){const t=d.mergeoptions(y,e.ipfs);s("setup options=%o",t);const n=new b(t);return m.addtransport(n),n}p_setup1(e,t){if(!t)return new Promise((e,t)=>{try{n.call(this,(n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{n.call(this,t)}catch(e){t(e)}function n(t){this.status=d.STATUS_STARTING,e&&e(this),this.IPFSAutoConnect((n,r)=>{n?(s("Failed to connect %s",n.message),this.status=d.STATUS_FAILED):(this.ipfs=r,this.status=d.STATUS_CONNECTED),e&&e(this),t(null,this)})}}p_setup2(e){return this.status===d.STATUS_FAILED&&s("Stage 1 failed, skipping"),this}stop(e,t){"client"===this.ipfstype?this.ipfs.stop((n,r)=>{this.status=d.STATUS_FAILED,e&&e(this),t(n,r)}):(this.status=d.STATUS_FAILED,e&&e(this),t(miull,this))}async p_status(){return this.status=await this.ipfs.isOnline()?d.STATUS_CONNECTED:d.STATUS_FAILED,super.p_status()}static urlFrom(e){if(e instanceof l)return"ipfs:/ipfs/"+e.toBaseEncodedString();if("object"==typeof e&&e.hash)return"ipfs:/ipfs/"+e.hash;if("string"==typeof e)return"ipfs:/ipfs/"+e;throw new p.CodingError("TransportIPFS.urlFrom: Cant convert to url from",e)}static cidFrom(e){if(e instanceof l)return e;if("string"==typeof e&&(e=f.parse(e)),e&&e.pathname){const t=e.pathname.split("/");if(!["ipfs:","dweb:"].includes(e.protocol)||"ipfs"!==t[1]||t.length<3)throw new p.TransportError("TransportIPFS.cidFrom bad format for url should be dweb: or ipfs:/ipfs/...: "+e.href);if(t.length>3)throw new p.TransportError("TransportIPFS.cidFrom not supporting paths in url yet, should be dweb: or ipfs:/ipfs/...: "+e.href);return new l(t[2])}throw new p.CodingError("TransportIPFS.cidFrom: Cant convert url",e)}static _stringFrom(e){return e instanceof l?"/ipfs/"+e.toBaseEncodedString():"object"==typeof e&&e.path?e.path:void 0}static ipfsFrom(e){if(e=this._stringFrom(e),e.indexOf("/ipfs/")>-1)return e.slice(e.indexOf("/ipfs/"));throw new p.CodingError(`TransportIPFS.ipfsFrom: Cant convert url ${e} into a path starting /ipfs/`)}ipfsGatewayFrom(e){if(e=this._stringFrom(e),e.indexOf("/ipfs/")>-1)return this.httpIPFSgateway+e.slice(e.indexOf("/ipfs/"));throw new p.CodingError(`TransportIPFS.ipfsGatewayFrom: Cant convert url ${e} into a path starting /ipfs/`)}static multihashFrom(e){if(e instanceof l)return e.toBaseEncodedString();if("object"==typeof e&&e.path&&(e=e.path),"string"==typeof e){const t=e.indexOf("/ipfs/");if(t>-1)return e.slice(t+6)}throw new p.CodingError(`Cant turn ${e} into a multihash`)}async p_rawfetch(e,{timeoutMS:t=6e4,relay:n=!1}={}){if(!e)throw new p.CodingError("TransportIPFS.p_rawfetch: requires url");const r=b.cidFrom(e),i=b.ipfsFrom(e);try{const n=await g.p_timeout(this.ipfs.dag.get(r),t,"Timed out IPFS fetch of "+b._stringFrom(r));if(n.remainderPath.length)throw new p.TransportError("Not yet supporting paths in p_rawfetch");let a;return"DAGNode"===n.value.constructor.name?a=await this.ipfs.cat(i):(s("Found a raw IPFS block (unusual) - not a DAGNode - handling as such"),a=n.value),a}catch(n){if(s("Caught error '%s' fetching via IPFS",n.message),!this.httpIPFSgateway)throw n;try{s("Trying IPFS HTTP gateway");let n=this.ipfsGatewayFrom(e);return await g.p_timeout(o.p_GET(n),t,"Timed out IPFS fetch of "+n)}catch(e){throw e}}}async p_rawstore(e){console.assert(e,"TransportIPFS.p_rawstore: requires data");const t=e instanceof i?e:new i(e),n=(await this.ipfs.add(t,{"cid-version":1,hashAlg:"sha2-256"}))[0];return b.urlFrom(n)}seed({directoryPath:e,fileRelativePath:t,ipfsHash:n,urlToFile:r},i){if(this.urlUrlstore&&r){const e=`${this.urlUrlstore}?arg=${encodeURIComponent(r)}`;o.p_GET(e,{retries:0},(e,t)=>{e?(s("IPFS.seed for %s failed in http: %s",r,e.message),i(e)):(s("Added %s to IPFS key=",r,t.Key),n&&n!==t.Key&&s("ipfs hash doesnt match expected metadata has %s daemon returned %s",n,t.Key),i(null,t))})}else s("IPFS.seed support requires urlUrlstore and urlToFile"),i(new Error("IPFS.seed support requires urlUrlstore and urlToFile"))}async p_f_createReadStream(e,{wanturl:t=!1}={}){let n;try{let r=e.pathname.split("/ipfs/")[1];if(r.includes("/"))throw new CodingError("Should not be seeing URLS with a path here:"+e);let i=this;return t?e:function e(t){s("reading from stream %o %o",r,t||"");const o=t?t.start:0,a=t&&t.end?o+t.end+1:void 0;return n&&n.destroy&&n.destroy(),n=i.ipfs.catReadableStream(r,{offset:o,length:a&&a-o}),n.on("error",e=>console.error(e)),n}}catch(e){throw n&&n.destroy&&n.destroy(),e}}static async p_test(e){console.log("TransportIPFS.test");try{const t=await this.p_setup(e);console.log(t.name,"setup");const n=await t.p_status();let r;console.assert(n===d.STATUS_CONNECTED);const i="The quick brown fox",o="ipfs:/ipfs/zdpuAscRnisRkYnEyJAp1LydQ3po25rCEDPPEDMymYRfN1yPK",s="1114",a=await t.p_rawstore(i);console.log("rawstore returned",a);const u=b.cidFrom(a);console.assert(a===o,"url should match url from rawstore");const l=a.split("/")[2],c=b.urlFrom(u);console.assert(a===c,"Should round trip"),r=a;const f=await t.p_rawfetch(r);return console.assert(f.toString()===i,"Should fetch block stored above"),t}catch(e){throw console.log("Exception thrown in TransportIPFS.test:",e.message),e}}}m._transportclasses.IPFS=b,t=e.exports=b}).call(this,n(8),n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(402),o=n(775),s=n(23),a=n(44),u=n(64),l=n(65),c=n(24),f=n(35),h=n(484),p=n(89),d=n(9),m=n(5),g=n(182),y=n(6),b=n(959),v=n(961),w=n(962),_=n(1321),k=n(1322),S=n(1326),E={get"bitcoin-block"(){return n(1327)},get"eth-account-snapshot"(){return n(126).ethAccountSnapshot},get"eth-block"(){return n(126).ethBlock},get"eth-block-list"(){return n(126).ethBlockList},get"eth-state-trie"(){return n(126).ethStateTrie},get"eth-storage-trie"(){return n(126).ethStorageTrie},get"eth-tx"(){return n(126).ethTx},get"eth-tx-trie"(){return n(126).ethTxTrie},get"git-raw"(){return n(1424)},get"zcash-block"(){return n(1430)}};class x extends y{constructor(e){super();const t={init:!0,start:!0,EXPERIMENTAL:{},preload:{enabled:!0,addresses:["/dnsaddr/node0.preload.ipfs.io/https","/dnsaddr/node1.preload.ipfs.io/https"]}};e=b.validate(e||{}),this._options=g(e,t),!1===e.init&&(this._options.init=!1),!1!==e.start&&(this._options.start=!0),"string"==typeof e.repo||void 0===e.repo?this._repo=_(e.repo):this._repo=e.repo,this.log=m("jsipfs"),this.log.err=m("jsipfs:err"),this.types={Buffer:r,PeerId:s,PeerInfo:a,multiaddr:c,multibase:p,multihash:f,CID:d},this._peerInfoBook=new h,this._peerInfo=void 0,this._bitswap=void 0,this._blockService=new i(this._repo),this._ipld=new o({blockService:this._blockService,loadFormat:(e,t)=>{if(this.log("Loading IPLD format",e),E[e])return t(null,E[e]);t(new Error(`Missing IPLD format "${e}"`))}}),this._preload=k(this),this._mfsPreload=S(this),this._ipns=void 0,this._print=this._options.silent?this.log:console.log,this.init=w.init(this),this.preStart=w.preStart(this),this.start=w.start(this),this.stop=w.stop(this),this.shutdown=this.stop,this.isOnline=w.isOnline(this),Object.assign(this,w.filesRegular(this)),this.version=w.version(this),this.id=w.id(this),this.repo=w.repo(this),this.bootstrap=w.bootstrap(this),this.config=w.config(this),this.block=w.block(this),this.object=w.object(this),this.dag=w.dag(this),this.files=w.filesMFS(this),this.libp2p=null,this.swarm=w.swarm(this),this.name=w.name(this),this.bitswap=w.bitswap(this),this.pin=w.pin(this),this.ping=w.ping(this),this.pingPullStream=w.pingPullStream(this),this.pingReadableStream=w.pingReadableStream(this),this.pubsub=w.pubsub(this),this.dht=w.dht(this),this.dns=w.dns(this),this.key=w.key(this),this.stats=w.stats(this),this.resolve=w.resolve(this),this._options.EXPERIMENTAL.pubsub&&this.log("EXPERIMENTAL pubsub is enabled"),this._options.EXPERIMENTAL.ipnsPubsub&&(this._options.EXPERIMENTAL.pubsub||(this.log("EXPERIMENTAL pubsub is enabled to use IPNS pubsub"),this._options.EXPERIMENTAL.pubsub=!0),this.log("EXPERIMENTAL IPNS pubsub is enabled")),this._options.EXPERIMENTAL.sharding&&this.log("EXPERIMENTAL sharding is enabled"),this._options.EXPERIMENTAL.dht&&this.log("EXPERIMENTAL Kademlia DHT is enabled"),this.state=n(1458)(this),this.util={crypto:u,isIPFS:l},v(this)}}t=e.exports=x,t.createNode=(e=>new x(e))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(137),i=n(26),o=n(9),s=n(409),a=n(225),u=n(402),l=n(61).join,c=n(61).sep,f=n(70).source,h=n(438),p=n(88),d=n(40),m=n(11),g=n(33).MemoryDatastore,y=n(439),b=n(304),v=n(38),w=n(890);function _(){}class k{constructor(e){const t=y(k.defaultOptions,e);if(!t.blockService)throw new Error("Missing blockservice");this.bs=t.blockService,this.resolvers={},this.support={},this.support.add=((e,t,n)=>{if(this.resolvers[e])throw new Error('Resolver already exists for codec "'+e+'"');this.resolvers[e]={resolver:t,util:n}}),this.support.load=t.loadFormat||((e,t)=>{t(new Error(`No resolver found for codec "${e}"`))}),this.support.rm=(e=>{this.resolvers[e]&&delete this.resolvers[e]});for(const e of t.formats){const{resolver:t,util:n}=e,r=t.multicodec;this.support.add(r,t,n)}}get(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n={}),"string"==typeof t&&(t=l("/",t).substr(1).split(c).join("/")),""===t||!t)return this._get(e,(t,n)=>{if(t)return r(t);r(null,{value:n,remainderPath:"",cid:e})});let i;s(n=>{this._getFormat(e.codec,(r,o)=>{if(r)return n(r);this.bs.get(e,(e,r)=>{if(e)return n(e);o.resolver.resolve(r.data,t,(e,r)=>{if(e)return n(e);i=r.value,t=r.remainderPath,n()})})})},()=>{const r=!t||""===t||"/"===t,o=i&&!k._maybeCID(i);return r&&o||n.localResolve?(e=k._maybeCID(i)||e,!0):(i=k._maybeCID(i),i&&(e=i),!1)},(n,o)=>n?r(n):r(null,{value:i,remainderPath:t,cid:e}))}getStream(e,t,n){const r=f();return this.get(e,t,n,(e,t)=>{if(e)return r.resolve(i.error(e));r.resolve(i.values([t]))}),r}getMany(e,t){if(!Array.isArray(e))return t(new Error("Argument must be an array of CIDs"));this.bs.getMany(e,(e,n)=>{if(e)return t(e);p(n,(e,t)=>{this._getFormat(e.cid.codec,(n,r)=>{if(n)return t(n);r.util.deserialize(e.data,t)})},t)})}put(e,t,n){return"function"==typeof t?(n=t,setImmediate(()=>n(new Error("IPLDResolver.put requires options")))):(n=n||_,t.cid&&o.isCID(t.cid)?t.onlyHash?setImmediate(()=>n(null,t.cid)):this._put(t.cid,e,n):void this._getFormat(t.format,(r,i)=>{if(r)return n(r);i.util.cid(e,t,(r,i)=>r?n(r):t.onlyHash?n(null,i):void this._put(i,e,n))}))}treeStream(e,t,n){let r;return"object"==typeof t&&(n=t,t=void 0),n=n||{},n.recursive||(r=f(),m([t=>this._getFormat(e.codec,t),(t,n)=>this.bs.get(e,(e,r)=>{if(e)return n(e);n(null,t,r)}),(e,t,n)=>e.resolver.tree(t.data,n)],(e,t)=>{if(e)return r.abort(e),r;r.resolve(i.values(t))})),n.recursive&&(r=i(h.widthFirst({basePath:null,cid:e},e=>{if("string"==typeof e)return i.empty();const t=f(),n=e.cid;return m([e=>this._getFormat(n.codec,e),(e,t)=>this.bs.get(n,(n,r)=>{if(n)return t(n);t(null,e,r)}),(e,t,n)=>e.resolver.tree(t.data,(r,i)=>{if(r)return n(r);p(i,(n,r)=>{e.resolver.isLink(t.data,n,(e,t)=>{if(e)return r(e);r(null,{path:n,link:t})})},n)})],(n,r)=>{if(n)return t.abort(n),t;t.resolve(i.values(r.map(t=>{const n=e.basePath?e.basePath+"/"+t.path:t.path;return t.link?{basePath:n,cid:k._maybeCID(t.link)}:n})))}),t}),i.map(e=>"string"==typeof e?e:e.basePath),i.filter(Boolean))),t?i(r,i.map(e=>{if(0===e.indexOf(t))return e=e.slice(t.length+1),e}),i.filter(Boolean)):r}remove(e,t){this.bs.delete(e,t)}_get(e,t){m([t=>this._getFormat(e.codec,t),(t,n)=>this.bs.get(e,(e,r)=>{if(e)return n(e);n(null,t,r)}),(e,t,n)=>{e.util.deserialize(t.data,(e,t)=>{if(e)return n(e);n(null,t)})}],t)}_getFormat(e,t){if(this.resolvers[e])return t(null,this.resolvers[e]);this.support.load(e,(n,r)=>{if(n)return t(n);this.resolvers[e]=r,t(null,r)})}_put(e,t,n){n=n||_,m([t=>this._getFormat(e.codec,t),(e,n)=>e.util.serialize(t,n),(t,n)=>this.bs.put(new r(t,e),n)],t=>{if(t)return n(t);n(null,e)})}static _maybeCID(e){return o.isCID(e)?e:e&&void 0!==e["/"]?new o(e["/"]):null}}k.defaultOptions={formats:[b,v,w]},k.inMemory=function(e){const t=new a("in-memory",{storageBackends:{root:g,blocks:g,datastore:g},lock:"memory"}),n=new u(t);d([e=>t.init({},e),e=>t.open(e)],t=>{if(t)return e(t);e(null,new k({blockService:n}))})},e.exports=k},function(e,t,n){"use strict";(function(t){const r=n(35),i=n(89),o=n(295),s=n(176),a=n(791),u=n(53);class l{constructor(e,n,s,a){if(c.isCID(e)){const n=e;return this.version=n.version,this.codec=n.codec,this.multihash=t.from(n.multihash),void(this.multibaseName=n.multibaseName||(0===n.version?"base58btc":"base32"))}if("string"==typeof e){const t=i.isEncoded(e);if(t){const n=i.decode(e);this.version=parseInt(n.slice(0,1).toString("hex"),16),this.codec=o.getCodec(n.slice(1)),this.multihash=o.rmPrefix(n.slice(1)),this.multibaseName=t}else this.version=0,this.codec="dag-pb",this.multihash=r.fromB58String(e),this.multibaseName="base58btc";return l.validateCID(this),void Object.defineProperty(this,"string",{value:e})}if(t.isBuffer(e)){const t=e.slice(0,1),n=parseInt(t.toString("hex"),16);if(1===n){const t=e;this.version=n,this.codec=o.getCodec(t.slice(1)),this.multihash=o.rmPrefix(t.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=e,this.multibaseName="base58btc";l.validateCID(this)}else this.version=e,this.codec=n,this.multihash=s,this.multibaseName=a||(0===e?"base58btc":"base32"),l.validateCID(this)}get buffer(){let e=this._buffer;if(!e){if(0===this.version)e=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");e=t.concat([t.from("01","hex"),o.getCodeVarint(this.codec),this.multihash])}Object.defineProperty(this,"_buffer",{value:e})}return e}get prefix(){return t.concat([t.from(`0${this.version}`,"hex"),o.getCodeVarint(this.codec),r.prefix(this.multihash)])}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:t}=r.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==t)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new c(0,this.codec,this.multihash)}toV1(){return new c(1,this.codec,this.multihash)}toBaseEncodedString(e=this.multibaseName){if(this.string&&e===this.multibaseName)return this.string;let t=null;if(0===this.version){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()");t=r.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");t=i.encode(e,this.buffer).toString()}return e===this.multibaseName&&Object.defineProperty(this,"string",{value:t}),t}toString(e){return this.toBaseEncodedString(e)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(e){return this.codec===e.codec&&this.version===e.version&&this.multihash.equals(e.multihash)}static validateCID(e){let t=a.checkCIDComponents(e);if(t)throw new Error(t)}}const c=u(l,{className:"CID",symbolName:"@ipld/js-cid/CID"});c.codecs=s,e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){const r=n(4).Buffer;e.exports=function e(t){if(t.length>=255)throw new TypeError("Alphabet too long");const n=new Uint8Array(256);n.fill(255);for(let e=0;e>>0,f=new Uint8Array(c);for(;u!==l;){let t=e[u],n=0;for(let e=c-1;(0!==t||n>>0,f[e]=t%i>>>0,t=t/i>>>0;if(0!==t)throw new Error("Non-zero carry");s=n,u++}let h=c-s;for(;h!==c&&0===f[h];)h++;let p=o.repeat(n);for(;h>>0,c=new Uint8Array(l);for(;e[t];){let r=n[e.charCodeAt(t)];if(255===r)return;let o=0;for(let e=l-1;(0!==r||o>>0,c[e]=r%256>>>0,r=r/256>>>0;if(0!==r)throw new Error("Non-zero carry");u=o,t++}if(" "===e[t])return;let f=l-u;for(;f!==l&&0===c[f];)f++;const h=r.allocUnsafe(a+(l-f));h.fill(0,0,a);let p=a;for(;f!==l;)h[p++]=c[f++];return h}function c(e){const t=l(e);if(t)return t;throw new Error("Non-base"+i+" character")}return{encode:u,decodeUnsafe:l,decode:c}}},function(e,t){e.exports=s;var n=128,r=127,i=-128,o=Math.pow(2,31);function s(e,t,r){t=t||[],r=r||0;for(var a=r;e>=o;)t[r++]=255&e|n,e/=128;for(;e&i;)t[r++]=255&e|n,e>>>=7;return t[r]=0|e,s.bytes=r-a+1,t}},function(e,t){e.exports=i;var n=128,r=127;function i(e,t){var o=0,t=t||0,s=0,a=t,u,l=e.length;do{if(a>=l)throw i.bytes=0,new RangeError("Could not decode varint");u=e[a++],o+=s<28?(u&r)<=n);return i.bytes=a-t,o}},function(e,t){var n=Math.pow(2,7),r=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),s=Math.pow(2,35),a=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),c=Math.pow(2,63);e.exports=function(e){return e(e[t[0]]=new r(t[0],t[1],t[2],t[3]),e),{}),c=u.reduce((e,t)=>(e[t[1]]=l[t[0]],e),{});e.exports={names:l,codes:c}},function(e,t,n){"use strict";class r{constructor(e,t,n,r){this.name=e,this.code=t,this.alphabet=r,n&&r&&(this.engine=n(r))}encode(e){return this.engine.encode(e)}decode(e){return this.engine.decode(e)}isImplemented(){return this.engine}}e.exports=r},function(e,t,n){var r=n(4).Buffer;e.exports=function e(t){for(var n={},i=t.length,o=t.charAt(0),s=0;s0;)n.push(a%i),a=a/i|0}for(var u="",l=0;0===e[l]&&l=0;--c)u+=t[n[c]];return u}function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return r.allocUnsafe(0);for(var t=[0],s=0;s>=8;for(;l>0;)t.push(255&l),l>>=8}for(var c=0;e[c]===o&&c"string"==typeof e?t.from(e).toString("hex"):e.toString("hex"),decode(e){for(let t of e)if(n.indexOf(t)<0)throw new Error("invalid base16 character");return t.from(e,"hex")}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){function n(e,t){e=e.replace(new RegExp("=","g"),"");let n=e.length,r=0,i=0,o=0,s=new Uint8Array(5*n/8|0);for(let a=0;a=8&&(s[o++]=i>>>r-8&255,r-=8);return s.buffer}function r(e,t){let n=e.byteLength,r=new Uint8Array(e),i=t.indexOf("=")===t.length-1;i&&(t=t.substring(0,t.length-2));let o=0,s=0,a="";for(let e=0;e=5;)a+=t[s>>>o-5&31],o-=5;if(o>0&&(a+=t[s<<5-o&31]),i)for(;a.length%8!=0;)a+="=";return a}e.exports=function e(i){return{encode:e=>r("string"==typeof e?t.from(e):e,i),decode(e){for(let t of e)if(i.indexOf(t)<0)throw new Error("invalid base32 character");return n(e,i)}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){e.exports=function e(n){const r=n.indexOf("=")>-1,i=n.indexOf("-")>-1&&n.indexOf("_")>-1;return{encode(e){let n="";n="string"==typeof e?t.from(e).toString("base64"):e.toString("base64"),i&&(n=n.replace(/\+/g,"-").replace(/\//g,"_"));const o=n.indexOf("=");return o>0&&!r&&(n=n.substring(0,o)),n},decode(e){for(let t of e)if(n.indexOf(t)<0)throw new Error("invalid base64 character");return t.from(e,"base64")}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(176),i=n(404).varintBufferEncode,o={};e.exports=o;for(let e in r){let t=r[e];o[e]=i(t)}},function(e,t,n){"use strict";const r=n(176),i={};e.exports=i;for(let e in r){let t=r[e];i[t.toString("hex")]=e}},function(e,t,n){"use strict";e.exports=Object.freeze({PROTOBUF:80,CBOR:81,RLP:96,BENCODE:99,MULTICODEC:48,MULTIHASH:49,MULTIADDR:50,MULTIBASE:51,IDENTITY:0,SHA1:17,SHA2_256:18,SHA2_512:19,SHA3_512:20,SHA3_384:21,SHA3_256:22,SHA3_224:23,SHAKE_128:24,SHAKE_256:25,KECCAK_224:26,KECCAK_256:27,KECCAK_384:28,KECCAK_512:29,MURMUR3_128:34,MURMUR3_32:35,DBL_SHA2_256:86,MD4:212,MD5:213,BMT:214,X11:4352,BLAKE2B_8:45569,BLAKE2B_16:45570,BLAKE2B_24:45571,BLAKE2B_32:45572,BLAKE2B_40:45573,BLAKE2B_48:45574,BLAKE2B_56:45575,BLAKE2B_64:45576,BLAKE2B_72:45577,BLAKE2B_80:45578,BLAKE2B_88:45579,BLAKE2B_96:45580,BLAKE2B_104:45581,BLAKE2B_112:45582,BLAKE2B_120:45583,BLAKE2B_128:45584,BLAKE2B_136:45585,BLAKE2B_144:45586,BLAKE2B_152:45587,BLAKE2B_160:45588,BLAKE2B_168:45589,BLAKE2B_176:45590,BLAKE2B_184:45591,BLAKE2B_192:45592,BLAKE2B_200:45593,BLAKE2B_208:45594,BLAKE2B_216:45595,BLAKE2B_224:45596,BLAKE2B_232:45597,BLAKE2B_240:45598,BLAKE2B_248:45599,BLAKE2B_256:45600,BLAKE2B_264:45601,BLAKE2B_272:45602,BLAKE2B_280:45603,BLAKE2B_288:45604,BLAKE2B_296:45605,BLAKE2B_304:45606,BLAKE2B_312:45607,BLAKE2B_320:45608,BLAKE2B_328:45609,BLAKE2B_336:45610,BLAKE2B_344:45611,BLAKE2B_352:45612,BLAKE2B_360:45613,BLAKE2B_368:45614,BLAKE2B_376:45615,BLAKE2B_384:45616,BLAKE2B_392:45617,BLAKE2B_400:45618,BLAKE2B_408:45619,BLAKE2B_416:45620,BLAKE2B_424:45621,BLAKE2B_432:45622,BLAKE2B_440:45623,BLAKE2B_448:45624,BLAKE2B_456:45625,BLAKE2B_464:45626,BLAKE2B_472:45627,BLAKE2B_480:45628,BLAKE2B_488:45629,BLAKE2B_496:45630,BLAKE2B_504:45631,BLAKE2B_512:45632,BLAKE2S_8:45633,BLAKE2S_16:45634,BLAKE2S_24:45635,BLAKE2S_32:45636,BLAKE2S_40:45637,BLAKE2S_48:45638,BLAKE2S_56:45639,BLAKE2S_64:45640,BLAKE2S_72:45641,BLAKE2S_80:45642,BLAKE2S_88:45643,BLAKE2S_96:45644,BLAKE2S_104:45645,BLAKE2S_112:45646,BLAKE2S_120:45647,BLAKE2S_128:45648,BLAKE2S_136:45649,BLAKE2S_144:45650,BLAKE2S_152:45651,BLAKE2S_160:45652,BLAKE2S_168:45653,BLAKE2S_176:45654,BLAKE2S_184:45655,BLAKE2S_192:45656,BLAKE2S_200:45657,BLAKE2S_208:45658,BLAKE2S_216:45659,BLAKE2S_224:45660,BLAKE2S_232:45661,BLAKE2S_240:45662,BLAKE2S_248:45663,BLAKE2S_256:45664,SKEIN256_8:45825,SKEIN256_16:45826,SKEIN256_24:45827,SKEIN256_32:45828,SKEIN256_40:45829,SKEIN256_48:45830,SKEIN256_56:45831,SKEIN256_64:45832,SKEIN256_72:45833,SKEIN256_80:45834,SKEIN256_88:45835,SKEIN256_96:45836,SKEIN256_104:45837,SKEIN256_112:45838,SKEIN256_120:45839,SKEIN256_128:45840,SKEIN256_136:45841,SKEIN256_144:45842,SKEIN256_152:45843,SKEIN256_160:45844,SKEIN256_168:45845,SKEIN256_176:45846,SKEIN256_184:45847,SKEIN256_192:45848,SKEIN256_200:45849,SKEIN256_208:45850,SKEIN256_216:45851,SKEIN256_224:45852,SKEIN256_232:45853,SKEIN256_240:45854,SKEIN256_248:45855,SKEIN256_256:45856,SKEIN512_8:45857,SKEIN512_16:45858,SKEIN512_24:45859,SKEIN512_32:45860,SKEIN512_40:45861,SKEIN512_48:45862,SKEIN512_56:45863,SKEIN512_64:45864,SKEIN512_72:45865,SKEIN512_80:45866,SKEIN512_88:45867,SKEIN512_96:45868,SKEIN512_104:45869,SKEIN512_112:45870,SKEIN512_120:45871,SKEIN512_128:45872,SKEIN512_136:45873,SKEIN512_144:45874,SKEIN512_152:45875,SKEIN512_160:45876,SKEIN512_168:45877,SKEIN512_176:45878,SKEIN512_184:45879,SKEIN512_192:45880,SKEIN512_200:45881,SKEIN512_208:45882,SKEIN512_216:45883,SKEIN512_224:45884,SKEIN512_232:45885,SKEIN512_240:45886,SKEIN512_248:45887,SKEIN512_256:45888,SKEIN512_264:45889,SKEIN512_272:45890,SKEIN512_280:45891,SKEIN512_288:45892,SKEIN512_296:45893,SKEIN512_304:45894,SKEIN512_312:45895,SKEIN512_320:45896,SKEIN512_328:45897,SKEIN512_336:45898,SKEIN512_344:45899,SKEIN512_352:45900,SKEIN512_360:45901,SKEIN512_368:45902,SKEIN512_376:45903,SKEIN512_384:45904,SKEIN512_392:45905,SKEIN512_400:45906,SKEIN512_408:45907,SKEIN512_416:45908,SKEIN512_424:45909,SKEIN512_432:45910,SKEIN512_440:45911,SKEIN512_448:45912,SKEIN512_456:45913,SKEIN512_464:45914,SKEIN512_472:45915,SKEIN512_480:45916,SKEIN512_488:45917,SKEIN512_496:45918,SKEIN512_504:45919,SKEIN512_512:45920,SKEIN1024_8:45921,SKEIN1024_16:45922,SKEIN1024_24:45923,SKEIN1024_32:45924,SKEIN1024_40:45925,SKEIN1024_48:45926,SKEIN1024_56:45927,SKEIN1024_64:45928,SKEIN1024_72:45929,SKEIN1024_80:45930,SKEIN1024_88:45931,SKEIN1024_96:45932,SKEIN1024_104:45933,SKEIN1024_112:45934,SKEIN1024_120:45935,SKEIN1024_128:45936,SKEIN1024_136:45937,SKEIN1024_144:45938,SKEIN1024_152:45939,SKEIN1024_160:45940,SKEIN1024_168:45941,SKEIN1024_176:45942,SKEIN1024_184:45943,SKEIN1024_192:45944,SKEIN1024_200:45945,SKEIN1024_208:45946,SKEIN1024_216:45947,SKEIN1024_224:45948,SKEIN1024_232:45949,SKEIN1024_240:45950,SKEIN1024_248:45951,SKEIN1024_256:45952,SKEIN1024_264:45953,SKEIN1024_272:45954,SKEIN1024_280:45955,SKEIN1024_288:45956,SKEIN1024_296:45957,SKEIN1024_304:45958,SKEIN1024_312:45959,SKEIN1024_320:45960,SKEIN1024_328:45961,SKEIN1024_336:45962,SKEIN1024_344:45963,SKEIN1024_352:45964,SKEIN1024_360:45965,SKEIN1024_368:45966,SKEIN1024_376:45967,SKEIN1024_384:45968,SKEIN1024_392:45969,SKEIN1024_400:45970,SKEIN1024_408:45971,SKEIN1024_416:45972,SKEIN1024_424:45973,SKEIN1024_432:45974,SKEIN1024_440:45975,SKEIN1024_448:45976,SKEIN1024_456:45977,SKEIN1024_464:45978,SKEIN1024_472:45979,SKEIN1024_480:45980,SKEIN1024_488:45981,SKEIN1024_496:45982,SKEIN1024_504:45983,SKEIN1024_512:45984,SKEIN1024_520:45985,SKEIN1024_528:45986,SKEIN1024_536:45987,SKEIN1024_544:45988,SKEIN1024_552:45989,SKEIN1024_560:45990,SKEIN1024_568:45991,SKEIN1024_576:45992,SKEIN1024_584:45993,SKEIN1024_592:45994,SKEIN1024_600:45995,SKEIN1024_608:45996,SKEIN1024_616:45997,SKEIN1024_624:45998,SKEIN1024_632:45999,SKEIN1024_640:46e3,SKEIN1024_648:46001,SKEIN1024_656:46002,SKEIN1024_664:46003,SKEIN1024_672:46004,SKEIN1024_680:46005,SKEIN1024_688:46006,SKEIN1024_696:46007,SKEIN1024_704:46008,SKEIN1024_712:46009,SKEIN1024_720:46010,SKEIN1024_728:46011,SKEIN1024_736:46012,SKEIN1024_744:46013,SKEIN1024_752:46014,SKEIN1024_760:46015,SKEIN1024_768:46016,SKEIN1024_776:46017,SKEIN1024_784:46018,SKEIN1024_792:46019,SKEIN1024_800:46020,SKEIN1024_808:46021,SKEIN1024_816:46022,SKEIN1024_824:46023,SKEIN1024_832:46024,SKEIN1024_840:46025,SKEIN1024_848:46026,SKEIN1024_856:46027,SKEIN1024_864:46028,SKEIN1024_872:46029,SKEIN1024_880:46030,SKEIN1024_888:46031,SKEIN1024_896:46032,SKEIN1024_904:46033,SKEIN1024_912:46034,SKEIN1024_920:46035,SKEIN1024_928:46036,SKEIN1024_936:46037,SKEIN1024_944:46038,SKEIN1024_952:46039,SKEIN1024_960:46040,SKEIN1024_968:46041,SKEIN1024_976:46042,SKEIN1024_984:46043,SKEIN1024_992:46044,SKEIN1024_1000:46045,SKEIN1024_1008:46046,SKEIN1024_1016:46047,SKEIN1024_1024:46048,IP4:4,TCP:6,DCCP:33,IP6:41,IP6ZONE:42,DNS:53,DNS4:54,DNS6:55,DNSADDR:56,SCTP:132,UDP:273,P2P_WEBRTC_STAR:275,P2P_WEBRTC_DIRECT:276,P2P_STARDUST:277,P2P_CIRCUIT:290,UDT:301,UTP:302,UNIX:400,P2P:421,IPFS:421,HTTPS:443,ONION:444,ONION3:445,GARLIC64:446,GARLIC32:447,QUIC:460,WS:477,WSS:478,P2P_WEBSOCKET_STAR:479,HTTP:480,RAW:85,DAG_PB:112,DAG_CBOR:113,LIBP2P_KEY:114,GIT_RAW:120,TORRENT_INFO:123,TORRENT_FILE:124,LEOFCOIN_BLOCK:129,LEOFCOIN_TX:130,LEOFCOIN_PR:131,ETH_BLOCK:144,ETH_BLOCK_LIST:145,ETH_TX_TRIE:146,ETH_TX:147,ETH_TX_RECEIPT_TRIE:148,ETH_TX_RECEIPT:149,ETH_STATE_TRIE:150,ETH_ACCOUNT_SNAPSHOT:151,ETH_STORAGE_TRIE:152,BITCOIN_BLOCK:176,BITCOIN_TX:177,ZCASH_BLOCK:192,ZCASH_TX:193,STELLAR_BLOCK:208,STELLAR_TX:209,DECRED_BLOCK:224,DECRED_TX:225,DASH_BLOCK:240,DASH_TX:241,SWARM_MANIFEST:250,SWARM_FEED:251,DAG_JSON:297,PATH:47,IPLD_NS:226,IPFS_NS:227,SWARM_NS:228,ED25519_PUB:237,HOLOCHAIN_ADR_V0:8417572,HOLOCHAIN_ADR_V1:8483108,HOLOCHAIN_KEY_V0:9728292,HOLOCHAIN_KEY_V1:9793828,HOLOCHAIN_SIG_V0:10645796,HOLOCHAIN_SIG_V1:10711332})},function(e,t,n){"use strict";e.exports=Object.freeze({80:"protobuf",81:"cbor",96:"rlp",99:"bencode",48:"multicodec",49:"multihash",50:"multiaddr",51:"multibase",0:"identity",17:"sha1",18:"sha2-256",19:"sha2-512",20:"sha3-512",21:"sha3-384",22:"sha3-256",23:"sha3-224",24:"shake-128",25:"shake-256",26:"keccak-224",27:"keccak-256",28:"keccak-384",29:"keccak-512",34:"murmur3-128",35:"murmur3-32",86:"dbl-sha2-256",212:"md4",213:"md5",214:"bmt",4352:"x11",45569:"blake2b-8",45570:"blake2b-16",45571:"blake2b-24",45572:"blake2b-32",45573:"blake2b-40",45574:"blake2b-48",45575:"blake2b-56",45576:"blake2b-64",45577:"blake2b-72",45578:"blake2b-80",45579:"blake2b-88",45580:"blake2b-96",45581:"blake2b-104",45582:"blake2b-112",45583:"blake2b-120",45584:"blake2b-128",45585:"blake2b-136",45586:"blake2b-144",45587:"blake2b-152",45588:"blake2b-160",45589:"blake2b-168",45590:"blake2b-176",45591:"blake2b-184",45592:"blake2b-192",45593:"blake2b-200",45594:"blake2b-208",45595:"blake2b-216",45596:"blake2b-224",45597:"blake2b-232",45598:"blake2b-240",45599:"blake2b-248",45600:"blake2b-256",45601:"blake2b-264",45602:"blake2b-272",45603:"blake2b-280",45604:"blake2b-288",45605:"blake2b-296",45606:"blake2b-304",45607:"blake2b-312",45608:"blake2b-320",45609:"blake2b-328",45610:"blake2b-336",45611:"blake2b-344",45612:"blake2b-352",45613:"blake2b-360",45614:"blake2b-368",45615:"blake2b-376",45616:"blake2b-384",45617:"blake2b-392",45618:"blake2b-400",45619:"blake2b-408",45620:"blake2b-416",45621:"blake2b-424",45622:"blake2b-432",45623:"blake2b-440",45624:"blake2b-448",45625:"blake2b-456",45626:"blake2b-464",45627:"blake2b-472",45628:"blake2b-480",45629:"blake2b-488",45630:"blake2b-496",45631:"blake2b-504",45632:"blake2b-512",45633:"blake2s-8",45634:"blake2s-16",45635:"blake2s-24",45636:"blake2s-32",45637:"blake2s-40",45638:"blake2s-48",45639:"blake2s-56",45640:"blake2s-64",45641:"blake2s-72",45642:"blake2s-80",45643:"blake2s-88",45644:"blake2s-96",45645:"blake2s-104",45646:"blake2s-112",45647:"blake2s-120",45648:"blake2s-128",45649:"blake2s-136",45650:"blake2s-144",45651:"blake2s-152",45652:"blake2s-160",45653:"blake2s-168",45654:"blake2s-176",45655:"blake2s-184",45656:"blake2s-192",45657:"blake2s-200",45658:"blake2s-208",45659:"blake2s-216",45660:"blake2s-224",45661:"blake2s-232",45662:"blake2s-240",45663:"blake2s-248",45664:"blake2s-256",45825:"skein256-8",45826:"skein256-16",45827:"skein256-24",45828:"skein256-32",45829:"skein256-40",45830:"skein256-48",45831:"skein256-56",45832:"skein256-64",45833:"skein256-72",45834:"skein256-80",45835:"skein256-88",45836:"skein256-96",45837:"skein256-104",45838:"skein256-112",45839:"skein256-120",45840:"skein256-128",45841:"skein256-136",45842:"skein256-144",45843:"skein256-152",45844:"skein256-160",45845:"skein256-168",45846:"skein256-176",45847:"skein256-184",45848:"skein256-192",45849:"skein256-200",45850:"skein256-208",45851:"skein256-216",45852:"skein256-224",45853:"skein256-232",45854:"skein256-240",45855:"skein256-248",45856:"skein256-256",45857:"skein512-8",45858:"skein512-16",45859:"skein512-24",45860:"skein512-32",45861:"skein512-40",45862:"skein512-48",45863:"skein512-56",45864:"skein512-64",45865:"skein512-72",45866:"skein512-80",45867:"skein512-88",45868:"skein512-96",45869:"skein512-104",45870:"skein512-112",45871:"skein512-120",45872:"skein512-128",45873:"skein512-136",45874:"skein512-144",45875:"skein512-152",45876:"skein512-160",45877:"skein512-168",45878:"skein512-176",45879:"skein512-184",45880:"skein512-192",45881:"skein512-200",45882:"skein512-208",45883:"skein512-216",45884:"skein512-224",45885:"skein512-232",45886:"skein512-240",45887:"skein512-248",45888:"skein512-256",45889:"skein512-264",45890:"skein512-272",45891:"skein512-280",45892:"skein512-288",45893:"skein512-296",45894:"skein512-304",45895:"skein512-312",45896:"skein512-320",45897:"skein512-328",45898:"skein512-336",45899:"skein512-344",45900:"skein512-352",45901:"skein512-360",45902:"skein512-368",45903:"skein512-376",45904:"skein512-384",45905:"skein512-392",45906:"skein512-400",45907:"skein512-408",45908:"skein512-416",45909:"skein512-424",45910:"skein512-432",45911:"skein512-440",45912:"skein512-448",45913:"skein512-456",45914:"skein512-464",45915:"skein512-472",45916:"skein512-480",45917:"skein512-488",45918:"skein512-496",45919:"skein512-504",45920:"skein512-512",45921:"skein1024-8",45922:"skein1024-16",45923:"skein1024-24",45924:"skein1024-32",45925:"skein1024-40",45926:"skein1024-48",45927:"skein1024-56",45928:"skein1024-64",45929:"skein1024-72",45930:"skein1024-80",45931:"skein1024-88",45932:"skein1024-96",45933:"skein1024-104",45934:"skein1024-112",45935:"skein1024-120",45936:"skein1024-128",45937:"skein1024-136",45938:"skein1024-144",45939:"skein1024-152",45940:"skein1024-160",45941:"skein1024-168",45942:"skein1024-176",45943:"skein1024-184",45944:"skein1024-192",45945:"skein1024-200",45946:"skein1024-208",45947:"skein1024-216",45948:"skein1024-224",45949:"skein1024-232",45950:"skein1024-240",45951:"skein1024-248",45952:"skein1024-256",45953:"skein1024-264",45954:"skein1024-272",45955:"skein1024-280",45956:"skein1024-288",45957:"skein1024-296",45958:"skein1024-304",45959:"skein1024-312",45960:"skein1024-320",45961:"skein1024-328",45962:"skein1024-336",45963:"skein1024-344",45964:"skein1024-352",45965:"skein1024-360",45966:"skein1024-368",45967:"skein1024-376",45968:"skein1024-384",45969:"skein1024-392",45970:"skein1024-400",45971:"skein1024-408",45972:"skein1024-416",45973:"skein1024-424",45974:"skein1024-432",45975:"skein1024-440",45976:"skein1024-448",45977:"skein1024-456",45978:"skein1024-464",45979:"skein1024-472",45980:"skein1024-480",45981:"skein1024-488",45982:"skein1024-496",45983:"skein1024-504",45984:"skein1024-512",45985:"skein1024-520",45986:"skein1024-528",45987:"skein1024-536",45988:"skein1024-544",45989:"skein1024-552",45990:"skein1024-560",45991:"skein1024-568",45992:"skein1024-576",45993:"skein1024-584",45994:"skein1024-592",45995:"skein1024-600",45996:"skein1024-608",45997:"skein1024-616",45998:"skein1024-624",45999:"skein1024-632",46000:"skein1024-640",46001:"skein1024-648",46002:"skein1024-656",46003:"skein1024-664",46004:"skein1024-672",46005:"skein1024-680",46006:"skein1024-688",46007:"skein1024-696",46008:"skein1024-704",46009:"skein1024-712",46010:"skein1024-720",46011:"skein1024-728",46012:"skein1024-736",46013:"skein1024-744",46014:"skein1024-752",46015:"skein1024-760",46016:"skein1024-768",46017:"skein1024-776",46018:"skein1024-784",46019:"skein1024-792",46020:"skein1024-800",46021:"skein1024-808",46022:"skein1024-816",46023:"skein1024-824",46024:"skein1024-832",46025:"skein1024-840",46026:"skein1024-848",46027:"skein1024-856",46028:"skein1024-864",46029:"skein1024-872",46030:"skein1024-880",46031:"skein1024-888",46032:"skein1024-896",46033:"skein1024-904",46034:"skein1024-912",46035:"skein1024-920",46036:"skein1024-928",46037:"skein1024-936",46038:"skein1024-944",46039:"skein1024-952",46040:"skein1024-960",46041:"skein1024-968",46042:"skein1024-976",46043:"skein1024-984",46044:"skein1024-992",46045:"skein1024-1000",46046:"skein1024-1008",46047:"skein1024-1016",46048:"skein1024-1024",4:"ip4",6:"tcp",33:"dccp",41:"ip6",42:"ip6zone",53:"dns",54:"dns4",55:"dns6",56:"dnsaddr",132:"sctp",273:"udp",275:"p2p-webrtc-star",276:"p2p-webrtc-direct",277:"p2p-stardust",290:"p2p-circuit",301:"udt",302:"utp",400:"unix",421:"p2p",443:"https",444:"onion",445:"onion3",446:"garlic64",447:"garlic32",460:"quic",477:"ws",478:"wss",479:"p2p-websocket-star",480:"http",85:"raw",112:"dag-pb",113:"dag-cbor",114:"libp2p-key",120:"git-raw",123:"torrent-info",124:"torrent-file",129:"leofcoin-block",130:"leofcoin-tx",131:"leofcoin-pr",144:"eth-block",145:"eth-block-list",146:"eth-tx-trie",147:"eth-tx",148:"eth-tx-receipt-trie",149:"eth-tx-receipt",150:"eth-state-trie",151:"eth-account-snapshot",152:"eth-storage-trie",176:"bitcoin-block",177:"bitcoin-tx",192:"zcash-block",193:"zcash-tx",208:"stellar-block",209:"stellar-tx",224:"decred-block",225:"decred-tx",240:"dash-block",241:"dash-tx",250:"swarm-manifest",251:"swarm-feed",297:"dag-json",47:"path",226:"ipld-ns",227:"ipfs-ns",228:"swarm-ns",237:"ed25519-pub",8417572:"holochain-adr-v0",8483108:"holochain-adr-v1",9728292:"holochain-key-v0",9793828:"holochain-key-v1",10645796:"holochain-sig-v0",10711332:"holochain-sig-v1"})},function(e,t,n){"use strict";(function(t){const r=n(35);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(0===e.version){if("dag-pb"!==e.codec)return"codec must be 'dag-pb' for CIDv0";if("base58btc"!==e.multibaseName)return"multibaseName must be 'base58btc' for CIDv0"}if(!t.isBuffer(e.multihash))return"multihash must be a Buffer";try{r.validate(e.multihash)}catch(e){let t=e.message;return t||(t="Multihash validation failed"),t}}};e.exports=i}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports={keys:n(793),once:n(138),values:n(43),count:n(794),infinite:n(795),empty:n(106),error:n(81)}},function(e,t,n){"use strict";var r=n(43);e.exports=function(e){return r(Object.keys(e))}},function(e,t,n){"use strict";e.exports=function e(t){var n=0;return t=t||1/0,function(e,r){return e?r&&r(e):n>t?r(!0):void r(null,n++)}}},function(e,t,n){"use strict";e.exports=function e(t){return t=t||Math.random,function(e,n){return e?n&&n(e):n(null,t())}}},function(e,t,n){"use strict";e.exports={drain:n(177),onEnd:n(406),log:n(797),find:n(798),reduce:n(222),collect:n(37),concat:n(799)}},function(e,t,n){"use strict";var r=n(177);e.exports=function e(t){return r(function(e){console.log(e)},t)}},function(e,t,n){"use strict";function r(e){return e}var i=n(178),o=n(177);e.exports=function e(t,n){var s=!1;return n?t=i(t)||r:(n=t,t=r),o(function(e){if(t(e))return s=!0,n(null,e),!1},function(e){s||n(!0===e?null:e,null)})}},function(e,t,n){"use strict";var r=n(222);e.exports=function e(t){return r(function(e,t){return e+t},"",t)}},function(e,t,n){"use strict";e.exports={map:n(77),asyncMap:n(90),filter:n(78),filterNot:n(801),through:n(223),take:n(296),unique:n(408),nonUnique:n(802),flatten:n(224)}},function(e,t,n){"use strict";var r=n(407),i=n(78);e.exports=function e(t){return t=r(t),i(function(e){return!t(e)})}},function(e,t,n){"use strict";var r=n(408);e.exports=function e(t){return r(t,!0)}},function(e,t,n){"use strict";(function(t){const r=n(35);var i={checkCIDComponents:function(e){if(null==e)return"null values are not valid CIDs";if(0!==e.version&&1!==e.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof e.codec)return"codec must be string";if(!t.isBuffer(e.multihash))return"multihash must be a Buffer";try{r.validate(e.multihash)}catch(e){let t=e.message;return t||(t="Multihash validation failed"),t}}};e.exports=i}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var r=n(68),i=f(r),o=n(104),s=f(o),a=n(131),u=f(a),l=n(42),c=f(l);function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t,n){n=(0,u.default)(n||i.default);var r=(0,c.default)(e),o=function(e){if(e)return n(e);var i=(0,s.default)(arguments,1);if(t.apply(this,i))return r(o);n.apply(null,[null].concat(i))};r(o)}e.exports=t.default},function(e,t,n){"use strict"; + */function r(e,t){if(t===e)return!0;var n=e.indexOf(t);if(0===n){if("/"===t.substr(-1))return!0;if("/"===e.substr(t.length,1))return!0}return!1}t.pathMatch=r},function(e,t,n){!function(){function t(){var e=function(t,n,r){if(t=""+t,r||s===n||(e.last=t=e.batch)return u.thrash();u.batch.to||(u.batch.to=setTimeout(u.thrash,e.until||1))},c,h,f,p,d;u.batch=s(),u.batch.acks=[],u.batch.ed=0,u.thrash=function(){var t=u.thrash;if(t.ing)return t.more=!0;t.more=!1,t.ing=!0;var n=t.at=u.batch,r=0;clearTimeout(u.batch.to),u.batch=null,u.batch=s(),u.batch.acks=[],u.batch.ed=0,u.save(n,function(i,o){++r>1?e.log("RAD ERR: Radisk has callbacked multiple times, please report this as a BUG at github.com/amark/gun/issues ! "+r):(i&&e.log("err",i),a(n.acks,function(e){e(i,o)}),t.at=null,t.ing=!1,t.more&&t())})},u.save=function(t,n){var r=function e(){};r.find=function(e,t){if(!(tr.start)return r.mix(r.file||e.code.from,r.start,r.end=t),!0;r.file=t},r.mix=function(e,i,o){r.start=r.end=r.file=y,u.parse(e,function(a,l){if(a)return n(a);l=l||s(),s.map(t,function(e,t){if(!(ti))return(r.next||r.reverse)&&(s.file=e),(i=c[s.file])?(i.push({key:t,ack:n,file:s.file,opt:r}),!0):(c[s.file]=[{key:t,ack:n,file:s.file,opt:r}],s.file?(u.parse(s.file,s.it),!0):(s.it(null,y,{}),!0));s.file=e},s.it=function(t,n,r){(s.err=t)&&e.log("err",t),s.info=r,n&&(g=s.disk=n),n=c[s.file],delete c[s.file],a(n,s.ack)},s.ack=function(e){if(e.ack){var t=e.key,n=e.opt,r=s.info,i=s.disk||m,o=u.range(i(t),n),a=i.last;if(n.parsed=(n.parsed||0)+(r.parsed||0),n.chunks=(n.chunks||0)+1,n.some||(n.some=y!==o),y!==o)e.ack(s.err,o,n);else if(!e.file)return void(!n.some&&e.ack(s.err,y,n));if(!n.span){if(/*!last || */a===t)return void(!n.some&&e.ack(s.err,y,n));if(a&&a>t&&0!=a.indexOf(t))return void(!n.some&&e.ack(s.err,y,n))}n.some&&n.parsed>=n.limit||(n.next=e.file,u.read(t,e.ack,n))}},r.reverse&&(s.lex.reverse=!0),u.list(s.lex)},function(){var n={},i=String.fromCharCode(31);u.parse=function(o,l,u){var c;if(c=n[o])return c.push(l);c=n[o]=[l];var h=function e(){},f={};if(h.disk=s(),h.read=function(t,r){var i,s,s;if(delete n[o],(h.err=t)||(h.not=!r))return a(c,h.ack);if("string"!=typeof r){try{e.pack<=r.length?h.err="Chunk too big!":r=r.toString()}catch(e){h.err=e}if(h.err)return a(c,h.ack)}if(f.parsed=r.length,e.jsonify){try{var l=JSON.parse(r);return h.disk.$=l,void a(c,h.ack)}catch(e){i=e}if("{"===r[0])return h.err=i||"JSON error!",a(c,h.ack)}var i=h.split(r),u=[],p,d,m;if(!i||0!==i[1])return h.err="File '"+o+"' does not have root radix! ",a(c,h.ack);for(;i;)d=m=y,p=i[1],i=h.split(i[2])||"","#"==i[0]&&(d=i[1],u=u.slice(0,p),p<=u.length&&u.push(d)),i=h.split(i[2])||"","\n"!=i[0]&&("="!=i[0]&&":"!=i[0]||(m=i[1]),y!==d&&y!==m&&h.disk(u.join(""),m),i=h.split(i[2]));a(c,h.ack)},h.split=function(e){if(e){var n=[],r={},o=-1,s="",a,l;if(o=e.indexOf(i),e[o])return s=e.slice(0,o),n[0]=s,n[1]=a=t.decode(e.slice(o),r),n[2]=e.slice(o+r.i),n}},h.ack=function(e){if(e)return h.err||h.not?e(h.err,y,f):void e(y,h.disk,f)},u)return h.read(null,u);e.store.get(r(o),h.read)}}(),p=String.fromCharCode(28),d=r(p),u.list=function(e){if(h){var t={reverse:e.reverse?1:0};s.map(h,function(t,n){return e(n)},t)||e()}else{if(f)return f.push(e);f=[e],u.parse(p,u.list.init)}},u.list.add=function(e,t){var n=h(e);if(n||e===d)return t(y,1);h(e,!0),t.listed=(t.listed||0)+1,u.write(p,h,function(e,n){if(e)return t(e);t.listed=(t.listed||0)-1,0===t.listed&&t(y,1)},!0)},u.list.init=function(t,n){if(t)return e.log("list",t),void setTimeout(function(){u.parse(p,u.list.init)},1e3);n?u.list.drain(n):e.store.list?e.store.list(function(e){if(h=h||s(),!e)return u.list.drain(h);u.list.add(e,m)}):u.list.drain(s())},u.list.drain=function(e,t){u.list.dir=h=e,t=f,f=null,o.list.map(t,function(e){u.list(e)})};var m=function(){},g,y;return t.has[e.file]=u,u}var r,i;if(r=String.fromCharCode(31),t.encode=function(e,t,n){n=n||r;var i=n,s;if("string"==typeof e){for(var a=e.indexOf(n);-1!=a;)i+=n,a=e.indexOf(n,a+1);return i+'"'+e+n}return e&&e["#"]&&(s=o.val.link.is(e))?i+"#"+s+i:o.num.is(e)?i+"+"+(e||0)+i:null===e?i+" "+i:!0===e?i+"+"+i:!1===e?i+"-"+i:void 0},t.decode=function(e,t,n){n=n||r;var i="",s=-1,a=0,l,u;if(n===e[0]){for(;n===e[++s];)++a;for(u=e[l=a]||!0;--a>=0;)s=e.indexOf(n,s+1);return-1==s&&(s=e.length),i=e.slice(l+1,s),t&&(t.i=s+1),'"'===u?i:"#"===u?o.val.link.ify(i):"+"===u?0===i.length||parseFloat(i):" "===u?null:"-"!==u&&void 0}},"undefined"!=typeof window){var o=window.Gun,s=window.Radix;window.Radisk=t}else{var o=n(144),s=n(637);try{e.exports=t}catch(e){}}t.Radix=s}()},function(e,t,n){const r=n(94);n(668),n(676),n(1482),n(1517),n(1630),n(1783),"undefined"!=typeof window&&(window.DwebTransports=r),t=e.exports=r},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var l=1e3;o&&"number"==typeof o.maxKeys&&(l=o.maxKeys);var u=e.length;l>0&&u>l&&(u=l);for(var c=0;c=0?(p=h.substr(0,f),d=h.substr(f+1)):(p=h,d=""),m=decodeURIComponent(p),g=decodeURIComponent(d),r(s,m)?i(s[m])?s[m].push(g):s[m]=[s[m],g]:s[m]=g}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),function(s){var a=encodeURIComponent(r(s))+n;return i(e[s])?o(e[s],function(e){return a+encodeURIComponent(r(e))}).join(t):a+encodeURIComponent(r(e[s]))}).join(t):a?encodeURIComponent(r(a))+n+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r{if("%%"===n)return n;a++;const o=r.formatters[i];if("function"==typeof o){const r=e[a];n=o.call(t,r),e.splice(a,1),a--}return n}),r.formatArgs.call(t,e);const l=t.log||r.log;l.apply(t,e)}return s.namespace=e,s.enabled=r.enabled(e),s.useColors=r.useColors(),s.color=t(e),s.destroy=i,s.extend=o,"function"==typeof r.init&&r.init(s),r.instances.push(s),s}function i(){const e=r.instances.indexOf(this);return-1!==e&&(r.instances.splice(e,1),!0)}function o(e,t){const n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function s(e){let t;r.save(e),r.names=[],r.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(t=0;t"-"+e)].join(",");return r.enable(""),e}function l(e){if("*"===e[e.length-1])return!0;let t,n;for(t=0,n=r.skips.length;t{r[t]=e[t]}),r.instances=[],r.names=[],r.skips=[],r.formatters={},r.selectColor=t,r.enable(r.load()),r}e.exports=r},function(e,t,n){"use strict";t.byteLength=c,t.toByteArray=f,t.fromByteArray=m;for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");-1===n&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r}function h(e,t,n){return 3*(t+n)/4-n}function f(e){for(var t,n=u(e),r=n[0],s=n[1],a=new o(h(e,r,s)),l=0,c=s>0?r-4:r,f=0;f>16&255,a[l++]=t>>8&255,a[l++]=255&t;return 2===s&&(t=i[e.charCodeAt(f)]<<2|i[e.charCodeAt(f+1)]>>4,a[l++]=255&t),1===s&&(t=i[e.charCodeAt(f)]<<10|i[e.charCodeAt(f+1)]<<4|i[e.charCodeAt(f+2)]>>2,a[l++]=t>>8&255,a[l++]=255&t),a}function p(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function d(e,t,n){for(var r,i=[],o=t;ol?l:a+16383));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=v;var r=n(647),i=y(r),o=n(65),s=y(o),a=n(58),l=y(a),u=n(107),c=y(u),h=n(180),f=y(h),p=n(651),d=y(p),m=n(37),g=y(m);function y(e){return e&&e.__esModule?e:{default:e}}function v(e,t,n){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var r=(0,g.default)(e),o=0,a=[],u=!1;function h(e,t,n){if(null!=n&&"function"!=typeof n)throw new Error("task callback must be a function");if(y.started=!0,(0,s.default)(e)||(e=[e]),0===e.length&&y.idle())return(0,f.default)(function(){y.drain()});for(var r=0,i=e.length;r0&&a.splice(l,1),s.callback.apply(s,arguments),null!=t&&y.error(t,s.data)}o<=y.concurrency-y.buffer&&y.unsaturated(),y.idle()&&y.drain(),y.process()}}var m=!1,y={_tasks:new d.default,concurrency:t,payload:n,saturated:l.default,unsaturated:l.default,buffer:t/4,empty:l.default,drain:l.default,error:l.default,started:!1,paused:!1,push:function(e,t){h(e,!1,t)},kill:function(){y.drain=l.default,y._tasks.empty()},unshift:function(e,t){h(e,!0,t)},remove:function(e){y._tasks.remove(e)},process:function(){if(!m){for(m=!0;!y.paused&&o{this.status=r.STATUS_STARTING,e&&e(this),this.updateStatus((n,r)=>{e&&e(this),this.startHeartbeat(this.options.heartbeat),t(this)})})}async p_status(e){if(!e)return new Promise((e,t)=>{try{this.updateStatus((n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{this.updateStatus(e)}catch(t){e(t)}}updateStatus(e){this.updateInfo((t,n)=>{t?(l("Error status call to info failed %s",t.message),this.status=r.STATUS_FAILED,e(null,this.status)):(this.info=n,this.status=r.STATUS_CONNECTED,e(null,this.status))})}startHeartbeat({delay:e,statusCB:t}){e&&(l("HTTP Starting Heartbeat"),this.HTTPheartbeatTimer=setInterval(()=>{this.updateStatus((e,n)=>{t&&t(this)},(e,t)=>{})},e))}stopHeartbeat(){this.HTTPheartbeatTimer&&(l("HTTP stopping heartbeat"),clearInterval(this.HTTPheartbeatTimer))}stop(e,t){this.stopHeartbeat(),this.status=r.STATUS_FAILED,e&&e(this),t(null,this)}_cmdurl(e){return`${this.urlbase}/${e}`}_url(e,t,n){if(!e)throw new errors.CodingError(`${t}: requires url`);return"string"!=typeof e&&(e=e.href),e=e.replace("contenthash:/contenthash",this._cmdurl(t)),e=e.replace("getall/table",t),e+=n?"?"+n:"",e}validFor(e,t,n){return(this.connected()||e.protocol.startsWith("http")&&!e.href.startsWith(this.urlbase))&&this.supports(e,t,n)}async p_rawfetch(e,t={}){if(("string"==typeof e?e:e.href).includes("/getall/table"))throw new Error("Probably dont want to be calling p_rawfetch on a KeyValueTable, especially since dont know if its keyvaluetable or subclass");return await o.p_GET(this._url(e,servercommands.rawfetch),t)}p_rawlist(e){if(!e)throw new errors.CodingError("TransportHTTP.p_rawlist: requires url");return o.p_GET(this._url(e,servercommands.rawlist))}rawreverse(){throw new errors.ToBeImplementedError("Undefined function TransportHTTP.rawreverse")}async p_rawstore(e){console.assert(e,"TransportHttp.p_rawstore: requires data");const t=await o.p_POST(this._cmdurl(servercommands.rawstore),{data:e,contenttype:"application/octet-stream"});let n=s.parse(t),r=n.pathname.split("/");return`contenthash:/contenthash/${r.slice(-1)}`}p_rawadd(e,t){if(!e||!t)throw new errors.CodingError("TransportHTTP.p_rawadd: invalid parms",e,t);const n=u(t.preflight(Object.assign({},t)))+"\n";return o.p_POST(this._url(e,servercommands.rawadd),{data:n,contenttype:"application/json"})}p_newlisturls(e){let t=e._publicurls.map(e=>s.parse(e)).find(e=>"https:"===e.protocol&&["gateway.dweb.me","dweb.me"].includes(e.host)&&(e.pathname.includes("/content/rawfetch")||e.pathname.includes("/contenthash/"))||"contenthash:"===e.protocol&&"contenthash"===e.pathname.split("/")[1]);return t||(t=`contenthash:/contenthash/${e.keypair.verifyexportmultihashsha256_58()}`),[t,t]}async p_f_createReadStream(e,{wanturl:t=!1}={}){try{let n=this;return t?e:function(t){return n.createReadStream(e,t)}}catch(e){throw e}}createReadStream(e,t){let n;return l("createreadstream %s %o",s.parse(e).href,t),n=new a.PassThrough,o.p_GET(this._url(e,servercommands.rawfetch),Object.assign({wantstream:!0},t)).then(e=>e.pipe(n)).catch(e=>{console.warn(this.name,"createReadStream caught error",e.message),"function"==typeof n.destroy?n.destroy(e):n.emit("error",e)}),n}async p_createReadStream(e,t){l("createreadstream %s %o",s.parse(e).href,t);try{return await o.p_GET(this._url(e,servercommands.rawfetch),Object.assign({wantstream:!0},t))}catch(e){throw console.warn(this.name,"caught error",e),e}}async p_newdatabase(e){e.hasOwnProperty("keypair")&&(e=e.keypair.signingexport());let t=`${this.urlbase}/getall/table/${encodeURIComponent(e)}`;return{publicurl:t,privateurl:t}}async p_newtable(e,t){if(!e)throw new errors.CodingError("p_newtable currently requires a pubkey");let n=await this.p_newdatabase(e);return{privateurl:`${n.privateurl}/${t}`,publicurl:`${n.publicurl}/${t}`}}async p_set(e,t,n){if(!e||!t)throw new errors.CodingError("TransportHTTP.p_set: invalid parms",e,keyvalyes);if("string"==typeof t){let r=u([{key:t,value:n}]);await o.p_POST(this._url(e,servercommands.set),{data:r,contenttype:"application/json"})}else{let n=u(Object.keys(t).map(e=>({key:e,value:t[e]})));await o.p_POST(this._url(e,servercommands.set),{data:n,contenttype:"application/json"})}}_keyparm(e){return`key=${encodeURIComponent(e)}`}async p_get(e,t){if(!e&&t)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");let n=Array.isArray(t)?t.map(e=>this._keyparm(e)).join("&"):this._keyparm(t);const r=await o.p_GET(this._url(e,servercommands.get,n));return Array.isArray(t)?r:r[t]}async p_delete(e,t){if(!e&&t)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");let n=t.map(e=>this._keyparm(e)).join("&");await o.p_GET(this._url(e,servercommands.delete,n))}async p_keys(e){if(!e&&keys)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");return await o.p_GET(this._url(e,servercommands.keys))}async p_getall(e){if(!e&&keys)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");return await o.p_GET(this._url(e,servercommands.getall))}async p_info(){return new Promise((e,t)=>{try{this.updateInfo((n,r)=>{n?t(n):e(r)})}catch(e){t(e)}})}updateInfo(e){o.p_GET(`${this.urlbase}/info`,{retries:1},e)}static async p_test(e={}){console.log("TransportHTTP.test");try{let t=await this.p_setup(e);console.log("HTTP connected");let n=await t.p_info();console.log("TransportHTTP info=",n),n=await t.p_status(),console.assert(n===r.STATUS_CONNECTED),await t.p_test_kvt("NACL%20VERIFY")}catch(e){throw console.log("Exception thrown in TransportHTTP.test:",e.message),e}}static async test(){return this}}i._transportclasses.HTTP=c,t=e.exports=c},function(e,t){},function(e,t,n){"use strict";function r(e){for(var t=1;t0?this.tail.next=n:this.head=n,this.tail=n,++this.length},t.unshift=function e(t){var n={data:t,next:this.head};0===this.length&&(this.tail=n),this.head=n,++this.length},t.shift=function e(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.clear=function e(){this.head=this.tail=null,this.length=0},t.join=function e(t){if(0===this.length)return"";for(var n=this.head,r=""+n.data;n=n.next;)r+=t+n.data;return r},t.concat=function e(t){if(0===this.length)return s.alloc(0);for(var n=s.allocUnsafe(t>>>0),r=this.head,i=0;r;)c(r.data,n,i),i+=r.data.length,r=r.next;return n},t.consume=function e(t,n){var r;return to.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),t-=s,0===t){s===o.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(s));break}++r}return this.length-=r,i},t._getBuffer=function e(t){var n=s.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(n),t-=r.data.length;r=r.next;){var o=r.data,a=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,a),t-=a,0===t){a===o.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=o.slice(a));break}++i}return this.length-=i,n},t[u]=function(e,t){return l(this,r({},t,{depth:0,customInspect:!1}))},e}()},function(e,t){},function(e,t,n){"use strict";(function(t){var n=new Set;function r(e){if(!n.has(e)){var r=e+" is an experimental feature. This feature could change at any time";n.add(e),t.emitWarning(r,"ExperimentalWarning")}}function i(){}e.exports.emitExperimentalWarning=t.emitWarning?r:i}).call(this,n(3))},function(e,t,n){"use strict";(function(t){var r;function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var o=n(245),s=Symbol("lastResolve"),a=Symbol("lastReject"),l=Symbol("error"),u=Symbol("ended"),c=Symbol("lastPromise"),h=Symbol("handlePromise"),f=Symbol("stream");function p(e,t){return{value:e,done:t}}function d(e){var t=e[s];if(null!==t){var n=e[f].read();null!==n&&(e[c]=null,e[s]=null,e[a]=null,t(p(n,!1)))}}function m(e){t.nextTick(d,e)}function g(e,t){return function(n,r){e.then(function(){t[u]?n(p(void 0,!0)):t[h](n,r)},r)}}var y=Object.getPrototypeOf(function(){}),v=Object.setPrototypeOf((r={get stream(){return this[f]},next:function e(){var n=this,r=this[l];if(null!==r)return Promise.reject(r);if(this[u])return Promise.resolve(p(void 0,!0));if(this[f].destroyed)return new Promise(function(e,r){t.nextTick(function(){n[l]?r(n[l]):e(p(void 0,!0))})});var i=this[c],o;if(i)o=new Promise(g(i,this));else{var s=this[f].read();if(null!==s)return Promise.resolve(p(s,!1));o=new Promise(this[h])}return this[c]=o,o}},i(r,Symbol.asyncIterator,function(){return this}),i(r,"return",function e(){var t=this;return new Promise(function(e,n){t[f].destroy(null,function(t){t?n(t):e(p(void 0,!0))})})}),r),y),b=function e(t){var n,r=Object.create(v,(n={},i(n,f,{value:t,writable:!0}),i(n,s,{value:null,writable:!0}),i(n,a,{value:null,writable:!0}),i(n,l,{value:null,writable:!0}),i(n,u,{value:t._readableState.endEmitted,writable:!0}),i(n,h,{value:function e(t,n){var i=r[f].read();i?(r[c]=null,r[s]=null,r[a]=null,t(p(i,!1))):(r[s]=t,r[a]=n)},writable:!0}),n));return r[c]=null,o(t,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[a];return null!==t&&(r[c]=null,r[s]=null,r[a]=null,t(e)),void(r[l]=e)}var n=r[s];null!==n&&(r[c]=null,r[s]=null,r[a]=null,n(p(void 0,!0))),r[u]=!0}),t.on("readable",m.bind(null,r)),r};e.exports=b}).call(this,n(3))},function(e,t,n){"use strict";e.exports=i;var r=n(340);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}n(1)(i,r),i.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){"use strict";var r;function i(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var o=n(112).codes,s=o.ERR_MISSING_ARGS,a=o.ERR_STREAM_DESTROYED;function l(e){if(e)throw e}function u(e){return e.setHeader&&"function"==typeof e.abort}function c(e,t,o,s){s=i(s);var l=!1;e.on("close",function(){l=!0}),void 0===r&&(r=n(245)),r(e,{readable:t,writable:o},function(e){if(e)return s(e);l=!0,s()});var c=!1;return function(t){if(!l&&!c)return c=!0,u(e)?e.abort():"function"==typeof e.destroy?e.destroy():void s(t||new a("pipe"))}}function h(e){e()}function f(e,t){return e.pipe(t)}function p(e){return e.length?"function"!=typeof e[e.length-1]?l:e.pop():l}function d(){for(var e=arguments.length,t=new Array(e),n=0;n0;return c(e,s,a,function(e){i||(i=e),e&&o.forEach(h),s||(o.forEach(h),r(i))})});return t.reduce(f)}e.exports=d},function(e,t,n){(function(r,i){const o=n(240),s=n(4)("dweb-transports:ipfs"),a=n(677),l=n(1262),u=n(9),c=n(45),h=n(32),f=n(17),p=n(77),d=n(111),m=n(94),g=n(146),y={repo:"/tmp/dweb_ipfsv3107",config:{Bootstrap:["/dns4/dweb.me/tcp/4245/wss/ipfs/QmQz3p44VVQDeAieaW28DMjcTVzLbpxqaQB9bkXnyd7HY5"]},EXPERIMENTAL:{pubsub:!0},preload:{enabled:!1}};class v extends d{constructor(e){super(e),["urlUrlstore","httpIPFSgateway"].forEach(t=>{this[t]=e[t],delete e[t]}),this.ipfs=void 0,this.options=e,this.name="IPFS",this.supportURLs=["ipfs"],this.supportFunctions=["fetch","store","seed","createReadStream"],this.supportFeatures=["noCache"],this.status=d.STATUS_LOADED}_ipfsversion(e,t,n){e.version((r,i)=>{r?(s("IPFS via %s present but unresponsive: %o",t,i),this.ipfstype="FAILED",n(r)):(s("IPFS available via %s: %o",t,i),this.ipfstype=t,n(null,e))})}IPFSAutoConnect(e){if(r.ipfs)this._ipfsversion(r.ipfs,"global.ipfs",e);else if("undefined"!=typeof window&&window.ipfs)this._ipfsversion(window.ipfs,"window.ipfs",e);else{var t=l("localhost","5001",{protocol:"http"});t.version((n,r)=>{n?(s("IPFS via API failed %s, trying running own IPFS client",n.message),t=new a(this.options),t.on("ready",()=>{this._ipfsversion(t,"client",e)}),t.on("error",t=>{s("IPFS via client error %s",t.message),e(t)})):this._ipfsversion(t,"API",e)})}}static setup0(e){const t=d.mergeoptions(y,e.ipfs);s("setup options=%o",t);const n=new v(t);return m.addtransport(n),n}p_setup1(e,t){if(!t)return new Promise((e,t)=>{try{n.call(this,(n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{n.call(this,t)}catch(e){t(e)}function n(t){this.status=d.STATUS_STARTING,e&&e(this),this.IPFSAutoConnect((n,r)=>{n?(s("Failed to connect %s",n.message),this.status=d.STATUS_FAILED):(this.ipfs=r,this.status=d.STATUS_CONNECTED),e&&e(this),t(null,this)})}}p_setup2(e){return this.status===d.STATUS_FAILED&&s("Stage 1 failed, skipping"),this}stop(e,t){"client"===this.ipfstype?this.ipfs.stop((n,r)=>{this.status=d.STATUS_FAILED,e&&e(this),t(n,r)}):(this.status=d.STATUS_FAILED,e&&e(this),t(miull,this))}async p_status(){return this.status=await this.ipfs.isOnline()?d.STATUS_CONNECTED:d.STATUS_FAILED,super.p_status()}static urlFrom(e){if(e instanceof u)return"ipfs:/ipfs/"+e.toBaseEncodedString();if("object"==typeof e&&e.hash)return"ipfs:/ipfs/"+e.hash;if("string"==typeof e)return"ipfs:/ipfs/"+e;throw new p.CodingError("TransportIPFS.urlFrom: Cant convert to url from",e)}static cidFrom(e){if(e instanceof u)return e;if("string"==typeof e&&(e=h.parse(e)),e&&e.pathname){const t=e.pathname.split("/");if(!["ipfs:","dweb:"].includes(e.protocol)||"ipfs"!==t[1]||t.length<3)throw new p.TransportError("TransportIPFS.cidFrom bad format for url should be dweb: or ipfs:/ipfs/...: "+e.href);if(t.length>3)throw new p.TransportError("TransportIPFS.cidFrom not supporting paths in url yet, should be dweb: or ipfs:/ipfs/...: "+e.href);return new u(t[2])}throw new p.CodingError("TransportIPFS.cidFrom: Cant convert url",e)}static _stringFrom(e){return e instanceof u?"/ipfs/"+e.toBaseEncodedString():"object"==typeof e&&e.path?e.path:void 0}static ipfsFrom(e){if(e=this._stringFrom(e),e.indexOf("/ipfs/")>-1)return e.slice(e.indexOf("/ipfs/"));throw new p.CodingError(`TransportIPFS.ipfsFrom: Cant convert url ${e} into a path starting /ipfs/`)}ipfsGatewayFrom(e){if(e=this._stringFrom(e),e.indexOf("/ipfs/")>-1)return this.httpIPFSgateway+e.slice(e.indexOf("/ipfs/"));throw new p.CodingError(`TransportIPFS.ipfsGatewayFrom: Cant convert url ${e} into a path starting /ipfs/`)}static multihashFrom(e){if(e instanceof u)return e.toBaseEncodedString();if("object"==typeof e&&e.path&&(e=e.path),"string"==typeof e){const t=e.indexOf("/ipfs/");if(t>-1)return e.slice(t+6)}throw new p.CodingError(`Cant turn ${e} into a multihash`)}async p_rawfetch(e,{timeoutMS:t=6e4,relay:n=!1}={}){if(!e)throw new p.CodingError("TransportIPFS.p_rawfetch: requires url");const r=v.cidFrom(e),i=v.ipfsFrom(e);try{const n=await g.p_timeout(this.ipfs.dag.get(r),t,"Timed out IPFS fetch of "+v._stringFrom(r));if(n.remainderPath.length)throw new p.TransportError("Not yet supporting paths in p_rawfetch");let a;return"DAGNode"===n.value.constructor.name?a=await this.ipfs.cat(i):(s("Found a raw IPFS block (unusual) - not a DAGNode - handling as such"),a=n.value),a}catch(n){if(s("Caught error '%s' fetching via IPFS",n.message),!this.httpIPFSgateway)throw n;try{s("Trying IPFS HTTP gateway");let n=this.ipfsGatewayFrom(e);return await g.p_timeout(o.p_GET(n),t,"Timed out IPFS fetch of "+n)}catch(e){throw e}}}async p_rawstore(e){console.assert(e,"TransportIPFS.p_rawstore: requires data");const t=e instanceof i?e:new i(e),n=(await this.ipfs.add(t,{"cid-version":1,hashAlg:"sha2-256"}))[0];return v.urlFrom(n)}seed({directoryPath:e,fileRelativePath:t,ipfsHash:n,urlToFile:r},i){if(this.urlUrlstore&&r){const e=`${this.urlUrlstore}?arg=${encodeURIComponent(r)}`;o.p_GET(e,{retries:0},(e,t)=>{e?(s("IPFS.seed for %s failed in http: %s",r,e.message),i(e)):(s("Added %s to IPFS key=",r,t.Key),n&&n!==t.Key&&s("ipfs hash doesnt match expected metadata has %s daemon returned %s",n,t.Key),i(null,t))})}else s("IPFS.seed support requires urlUrlstore and urlToFile"),i(new Error("IPFS.seed support requires urlUrlstore and urlToFile"))}async p_f_createReadStream(e,{wanturl:t=!1}={}){let n;try{let r=e.pathname.split("/ipfs/")[1];if(r.includes("/"))throw new CodingError("Should not be seeing URLS with a path here:"+e);let i=this;return t?e:function e(t){s("reading from stream %o %o",r,t||"");const o=t?t.start:0,a=t&&t.end?o+t.end+1:void 0;return n&&n.destroy&&n.destroy(),n=i.ipfs.catReadableStream(r,{offset:o,length:a&&a-o}),n.on("error",e=>console.error(e)),n}}catch(e){throw n&&n.destroy&&n.destroy(),e}}static async p_test(e){console.log("TransportIPFS.test");try{const t=await this.p_setup(e);console.log(t.name,"setup");const n=await t.p_status();let r;console.assert(n===d.STATUS_CONNECTED);const i="The quick brown fox",o="ipfs:/ipfs/zdpuAscRnisRkYnEyJAp1LydQ3po25rCEDPPEDMymYRfN1yPK",s="1114",a=await t.p_rawstore(i);console.log("rawstore returned",a);const l=v.cidFrom(a);console.assert(a===o,"url should match url from rawstore");const u=a.split("/")[2],c=v.urlFrom(l);console.assert(a===c,"Should round trip"),r=a;const h=await t.p_rawfetch(r);return console.assert(h.toString()===i,"Should fetch block stored above"),t}catch(e){throw console.log("Exception thrown in TransportIPFS.test:",e.message),e}}}m._transportclasses.IPFS=v,t=e.exports=v}).call(this,n(8),n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(678),i=n(679),o=n(15),s=n(31),a=n(51),l=n(200),u=n(22),c=n(27),h=n(400),f=n(60),p=n(115),d=n(56),m=n(9),g=n(4),y=n(89),v=n(6),b=n(828),_=n(829),w=n(870),k=n(1254),E=n(1255),S=n(1259),x=n(1260);class C extends v{constructor(e){super();const t={init:!0,start:!0,EXPERIMENTAL:{},preload:{enabled:!0,addresses:["/dnsaddr/node0.preload.ipfs.io/https","/dnsaddr/node1.preload.ipfs.io/https"]}};e=b.validate(e||{}),this._options=y(t,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=k(e.repo):this._repo=e.repo,this.log=g("ipfs"),this.log.err=g("ipfs:err"),this._peerInfoBook=new h,this._peerInfo=void 0,this._bitswap=void 0,this._blockService=new r(this._repo),this._ipld=new i(x(this._blockService,this._options.ipld,this.log)),this._preload=E(this),this._mfsPreload=S(this),this._ipns=void 0,this._print=this._options.silent?this.log:console.log,this.init=w.init(this),this.preStart=w.preStart(this),this.start=w.start(this),this.stop=w.stop(this),this.shutdown=this.stop,this.isOnline=w.isOnline(this),Object.assign(this,w.filesRegular(this)),this.version=w.version(this),this.id=w.id(this),this.repo=w.repo(this),this.bootstrap=w.bootstrap(this),this.config=w.config(this),this.block=w.block(this),this.object=w.object(this),this.dag=w.dag(this),this.files=w.filesMFS(this),this.libp2p=null,this.swarm=w.swarm(this),this.name=w.name(this),this.bitswap=w.bitswap(this),this.pin=w.pin(this),this.ping=w.ping(this),this.pingPullStream=w.pingPullStream(this),this.pingReadableStream=w.pingReadableStream(this),this.pubsub=w.pubsub(this),this.dht=w.dht(this),this.dns=w.dns(this),this.key=w.key(this),this.stats=w.stats(this),this.resolve=w.resolve(this),this._options.EXPERIMENTAL.pubsub&&this.log("EXPERIMENTAL pubsub is enabled"),this._options.EXPERIMENTAL.ipnsPubsub&&(this._options.EXPERIMENTAL.pubsub||(this.log("EXPERIMENTAL pubsub is enabled to use IPNS pubsub"),this._options.EXPERIMENTAL.pubsub=!0),this.log("EXPERIMENTAL IPNS pubsub is enabled")),this._options.EXPERIMENTAL.sharding&&this.log("EXPERIMENTAL sharding is enabled"),this.state=n(1261)(this),_(this)}}e.exports=C;const A=t;Object.assign(e.exports,{crypto:a,isIPFS:l,Buffer:A,CID:m,multiaddr:u,multibase:f,multihash:c,multihashing:d,multicodec:p,PeerId:o,PeerInfo:s}),e.exports.createNode=(e=>new C(e))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(59);class i{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){this.hasExchange()?this._bitswap.put(e,t):this._repo.blocks.put(e,t)}putMany(e,t){this.hasExchange()?this._bitswap.putMany(e,t):this._repo.blocks.putMany(e,t)}get(e,t){this.hasExchange()?this._bitswap.get(e,t):this._repo.blocks.get(e,t)}getMany(e,t){Array.isArray(e)?this.hasExchange()?this._bitswap.getMany(e,t):r(e,(e,t)=>this._repo.blocks.get(e,t),t):t(new Error("first arg must be an array of cids"))}delete(e,t){this._repo.blocks.delete(e,t)}}e.exports=i},function(e,t,n){"use strict";const r=n(114),i=n(19),o=n(9),s=n(347),a=n(54).join,l=n(54).sep,u=n(61).source,c=n(350),h=n(59),f=n(10),p=n(89),d=n(189),m=n(34),g=n(367);function y(){}class v{constructor(e){const t=p(v.defaultOptions,e);if(!t.blockService)throw new Error("Missing blockservice");this.bs=t.blockService,this.resolvers={},this.support={},this.support.add=((e,t,n)=>{if(this.resolvers[e])throw new Error('Resolver already exists for codec "'+e+'"');this.resolvers[e]={resolver:t,util:n}}),this.support.load=t.loadFormat||((e,t)=>{t(new Error(`No resolver found for codec "${e}"`))}),this.support.rm=(e=>{this.resolvers[e]&&delete this.resolvers[e]});for(const e of t.formats){const{resolver:t,util:n}=e,r=t.multicodec;this.support.add(r,t,n)}}get(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n={}),"string"==typeof t&&(t=a("/",t).substr(1).split(l).join("/")),""===t||!t)return this._get(e,(t,n)=>{if(t)return r(t);r(null,{value:n,remainderPath:"",cid:e})});let i;s(n=>{this._getFormat(e.codec,(r,o)=>{if(r)return n(r);this.bs.get(e,(e,r)=>{if(e)return n(e);o.resolver.resolve(r.data,t,(e,r)=>{if(e)return n(e);i=r.value,t=r.remainderPath,n()})})})},()=>{const r=!t||""===t||"/"===t,o=i&&!v._maybeCID(i);return r&&o||n.localResolve?(e=v._maybeCID(i)||e,!0):(i=v._maybeCID(i),i&&(e=i),!1)},(n,o)=>n?r(n):r(null,{value:i,remainderPath:t,cid:e}))}getStream(e,t,n){const r=u();return this.get(e,t,n,(e,t)=>{if(e)return r.resolve(i.error(e));r.resolve(i.values([t]))}),r}getMany(e,t){if(!Array.isArray(e))return t(new Error("Argument must be an array of CIDs"));this.bs.getMany(e,(e,n)=>{if(e)return t(e);h(n,(e,t)=>{this._getFormat(e.cid.codec,(n,r)=>{if(n)return t(n);r.util.deserialize(e.data,t)})},t)})}put(e,t,n){return"function"==typeof t?(n=t,setImmediate(()=>n(new Error("IPLDResolver.put requires options")))):(n=n||y,t.cid&&o.isCID(t.cid)?t.onlyHash?setImmediate(()=>n(null,t.cid)):this._put(t.cid,e,n):void this._getFormat(t.format,(r,i)=>{if(r)return n(r);i.util.cid(e,t,(r,i)=>r?n(r):t.onlyHash?n(null,i):void this._put(i,e,n))}))}treeStream(e,t,n){let r;return"object"==typeof t&&(n=t,t=void 0),n=n||{},n.recursive||(r=u(),f([t=>this._getFormat(e.codec,t),(t,n)=>this.bs.get(e,(e,r)=>{if(e)return n(e);n(null,t,r)}),(e,t,n)=>e.resolver.tree(t.data,n)],(e,t)=>{if(e)return r.abort(e),r;r.resolve(i.values(t))})),n.recursive&&(r=i(c.widthFirst({basePath:null,cid:e},e=>{if("string"==typeof e)return i.empty();const t=u(),n=e.cid;return f([e=>this._getFormat(n.codec,e),(e,t)=>this.bs.get(n,(n,r)=>{if(n)return t(n);t(null,e,r)}),(e,t,n)=>e.resolver.tree(t.data,(r,i)=>{if(r)return n(r);h(i,(n,r)=>{e.resolver.isLink(t.data,n,(e,t)=>{if(e)return r(e);r(null,{path:n,link:t})})},n)})],(n,r)=>{if(n)return t.abort(n),t;t.resolve(i.values(r.map(t=>{const n=e.basePath?e.basePath+"/"+t.path:t.path;return t.link?{basePath:n,cid:v._maybeCID(t.link)}:n})))}),t}),i.map(e=>"string"==typeof e?e:e.basePath),i.filter(Boolean))),t?i(r,i.map(e=>{if(0===e.indexOf(t))return e=e.slice(t.length+1),e}),i.filter(Boolean)):r}remove(e,t){this.bs.delete(e,t)}_get(e,t){f([t=>this._getFormat(e.codec,t),(t,n)=>this.bs.get(e,(e,r)=>{if(e)return n(e);n(null,t,r)}),(e,t,n)=>{e.util.deserialize(t.data,(e,t)=>{if(e)return n(e);n(null,t)})}],t)}_getFormat(e,t){if(this.resolvers[e])return t(null,this.resolvers[e]);this.support.load(e,(n,r)=>{if(n)return t(n);this.resolvers[e]=r,t(null,r)})}_put(e,t,n){n=n||y,f([t=>this._getFormat(e.codec,t),(e,n)=>e.util.serialize(t,n),(t,n)=>this.bs.put(new r(t,e),n)],t=>{if(t)return n(t);n(null,e)})}static _maybeCID(e){return o.isCID(e)?e:e&&void 0!==e["/"]?new o(e["/"]):null}}v.defaultOptions={formats:[d,m,g]},e.exports=v},function(e,t,n){"use strict";(function(t){const r=n(27),i=n(60),o=n(115),s=n(95),a=n(695),l=n(39);class u{constructor(e,n,s,a){if(c.isCID(e)){const n=e;return this.version=n.version,this.codec=n.codec,this.multihash=t.from(n.multihash),void(this.multibaseName=n.multibaseName||(0===n.version?"base58btc":"base32"))}if("string"==typeof e){const t=i.isEncoded(e);if(t){const n=i.decode(e);this.version=parseInt(n.slice(0,1).toString("hex"),16),this.codec=o.getCodec(n.slice(1)),this.multihash=o.rmPrefix(n.slice(1)),this.multibaseName=t}else this.version=0,this.codec="dag-pb",this.multihash=r.fromB58String(e),this.multibaseName="base58btc";return u.validateCID(this),void Object.defineProperty(this,"string",{value:e})}if(t.isBuffer(e)){const t=e.slice(0,1),n=parseInt(t.toString("hex"),16);if(1===n){const t=e;this.version=n,this.codec=o.getCodec(t.slice(1)),this.multihash=o.rmPrefix(t.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=e,this.multibaseName="base58btc";u.validateCID(this)}else this.version=e,this.codec=n,this.multihash=s,this.multibaseName=a||(0===e?"base58btc":"base32"),u.validateCID(this)}get buffer(){let e=this._buffer;if(!e){if(0===this.version)e=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");e=t.concat([t.from("01","hex"),o.getCodeVarint(this.codec),this.multihash])}Object.defineProperty(this,"_buffer",{value:e})}return e}get prefix(){return t.concat([t.from(`0${this.version}`,"hex"),o.getCodeVarint(this.codec),r.prefix(this.multihash)])}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:t}=r.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==t)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new c(0,this.codec,this.multihash)}toV1(){return new c(1,this.codec,this.multihash)}toBaseEncodedString(e=this.multibaseName){if(this.string&&e===this.multibaseName)return this.string;let t=null;if(0===this.version){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()");t=r.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");t=i.encode(e,this.buffer).toString()}return e===this.multibaseName&&Object.defineProperty(this,"string",{value:t}),t}toString(e){return this.toBaseEncodedString(e)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(e){return this.codec===e.codec&&this.version===e.version&&this.multihash.equals(e.multihash)}static validateCID(e){let t=a.checkCIDComponents(e);if(t)throw new Error(t)}}const c=l(u,{className:"CID",symbolName:"@ipld/js-cid/CID"});c.codecs=s,e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){const r=n(5).Buffer;e.exports=function e(t){if(t.length>=255)throw new TypeError("Alphabet too long");const n=new Uint8Array(256);n.fill(255);for(let e=0;e>>0,h=new Uint8Array(c);for(;l!==u;){let t=e[l],n=0;for(let e=c-1;(0!==t||n>>0,h[e]=t%i>>>0,t=t/i>>>0;if(0!==t)throw new Error("Non-zero carry");s=n,l++}let f=c-s;for(;f!==c&&0===h[f];)f++;let p=o.repeat(n);for(;f>>0,c=new Uint8Array(u);for(;e[t];){let r=n[e.charCodeAt(t)];if(255===r)return;let o=0;for(let e=u-1;(0!==r||o>>0,c[e]=r%256>>>0,r=r/256>>>0;if(0!==r)throw new Error("Non-zero carry");l=o,t++}if(" "===e[t])return;let h=u-l;for(;h!==u&&0===c[h];)h++;const f=r.allocUnsafe(a+(u-h));f.fill(0,0,a);let p=a;for(;h!==u;)f[p++]=c[h++];return f}function c(e){const t=u(e);if(t)return t;throw new Error("Non-base"+i+" character")}return{encode:l,decodeUnsafe:u,decode:c}}},function(e,t,n){"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){e.exports=s;var n=128,r=127,i=-128,o=Math.pow(2,31);function s(e,t,r){t=t||[],r=r||0;for(var a=r;e>=o;)t[r++]=255&e|n,e/=128;for(;e&i;)t[r++]=255&e|n,e>>>=7;return t[r]=0|e,s.bytes=r-a+1,t}},function(e,t){e.exports=i;var n=128,r=127;function i(e,t){var o=0,t=t||0,s=0,a=t,l,u=e.length;do{if(a>=u)throw i.bytes=0,new RangeError("Could not decode varint");l=e[a++],o+=s<28?(l&r)<=n);return i.bytes=a-t,o}},function(e,t){var n=Math.pow(2,7),r=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),s=Math.pow(2,35),a=Math.pow(2,42),l=Math.pow(2,49),u=Math.pow(2,56),c=Math.pow(2,63);e.exports=function(e){return e(e[t[0]]=new r(t[0],t[1],t[2],t[3]),e),{}),c=l.reduce((e,t)=>(e[t[1]]=u[t[0]],e),{});e.exports={names:u,codes:c}},function(e,t,n){"use strict";class r{constructor(e,t,n,r){this.name=e,this.code=t,this.alphabet=r,n&&r&&(this.engine=n(r))}encode(e){return this.engine.encode(e)}decode(e){return this.engine.decode(e)}isImplemented(){return this.engine}}e.exports=r},function(e,t,n){var r=n(5).Buffer;e.exports=function e(t){for(var n={},i=t.length,o=t.charAt(0),s=0;s0;)n.push(a%i),a=a/i|0}for(var l="",u=0;0===e[u]&&u=0;--c)l+=t[n[c]];return l}function u(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return r.allocUnsafe(0);for(var t=[0],s=0;s>=8;for(;u>0;)t.push(255&u),u>>=8}for(var c=0;e[c]===o&&c"string"==typeof e?t.from(e).toString("hex"):e.toString("hex"),decode(e){for(let t of e)if(n.indexOf(t)<0)throw new Error("invalid base16 character");return t.from(e,"hex")}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){function n(e,t){e=e.replace(new RegExp("=","g"),"");let n=e.length,r=0,i=0,o=0,s=new Uint8Array(5*n/8|0);for(let a=0;a=8&&(s[o++]=i>>>r-8&255,r-=8);return s.buffer}function r(e,t){let n=e.byteLength,r=new Uint8Array(e),i=t.indexOf("=")===t.length-1;i&&(t=t.substring(0,t.length-2));let o=0,s=0,a="";for(let e=0;e=5;)a+=t[s>>>o-5&31],o-=5;if(o>0&&(a+=t[s<<5-o&31]),i)for(;a.length%8!=0;)a+="=";return a}e.exports=function e(i){return{encode:e=>r("string"==typeof e?t.from(e):e,i),decode(e){for(let t of e)if(i.indexOf(t)<0)throw new Error("invalid base32 character");return n(e,i)}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){e.exports=function e(n){const r=n.indexOf("=")>-1,i=n.indexOf("-")>-1&&n.indexOf("_")>-1;return{encode(e){let n="";n="string"==typeof e?t.from(e).toString("base64"):e.toString("base64"),i&&(n=n.replace(/\+/g,"-").replace(/\//g,"_"));const o=n.indexOf("=");return o>0&&!r&&(n=n.substring(0,o)),n},decode(e){for(let t of e)if(n.indexOf(t)<0)throw new Error("invalid base64 character");return t.from(e,"base64")}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(95),i=n(341).varintBufferEncode,o={};e.exports=o;for(let e in r){let t=r[e];o[e]=i(t)}},function(e,t,n){"use strict";e.exports=Object.freeze({PROTOBUF:80,CBOR:81,RLP:96,BENCODE:99,MULTICODEC:48,MULTIHASH:49,MULTIADDR:50,MULTIBASE:51,IDENTITY:0,SHA1:17,SHA2_256:18,SHA2_512:19,SHA3_512:20,SHA3_384:21,SHA3_256:22,SHA3_224:23,SHAKE_128:24,SHAKE_256:25,KECCAK_224:26,KECCAK_256:27,KECCAK_384:28,KECCAK_512:29,MURMUR3_128:34,MURMUR3_32:35,DBL_SHA2_256:86,MD4:212,MD5:213,BMT:214,X11:4352,BLAKE2B_8:45569,BLAKE2B_16:45570,BLAKE2B_24:45571,BLAKE2B_32:45572,BLAKE2B_40:45573,BLAKE2B_48:45574,BLAKE2B_56:45575,BLAKE2B_64:45576,BLAKE2B_72:45577,BLAKE2B_80:45578,BLAKE2B_88:45579,BLAKE2B_96:45580,BLAKE2B_104:45581,BLAKE2B_112:45582,BLAKE2B_120:45583,BLAKE2B_128:45584,BLAKE2B_136:45585,BLAKE2B_144:45586,BLAKE2B_152:45587,BLAKE2B_160:45588,BLAKE2B_168:45589,BLAKE2B_176:45590,BLAKE2B_184:45591,BLAKE2B_192:45592,BLAKE2B_200:45593,BLAKE2B_208:45594,BLAKE2B_216:45595,BLAKE2B_224:45596,BLAKE2B_232:45597,BLAKE2B_240:45598,BLAKE2B_248:45599,BLAKE2B_256:45600,BLAKE2B_264:45601,BLAKE2B_272:45602,BLAKE2B_280:45603,BLAKE2B_288:45604,BLAKE2B_296:45605,BLAKE2B_304:45606,BLAKE2B_312:45607,BLAKE2B_320:45608,BLAKE2B_328:45609,BLAKE2B_336:45610,BLAKE2B_344:45611,BLAKE2B_352:45612,BLAKE2B_360:45613,BLAKE2B_368:45614,BLAKE2B_376:45615,BLAKE2B_384:45616,BLAKE2B_392:45617,BLAKE2B_400:45618,BLAKE2B_408:45619,BLAKE2B_416:45620,BLAKE2B_424:45621,BLAKE2B_432:45622,BLAKE2B_440:45623,BLAKE2B_448:45624,BLAKE2B_456:45625,BLAKE2B_464:45626,BLAKE2B_472:45627,BLAKE2B_480:45628,BLAKE2B_488:45629,BLAKE2B_496:45630,BLAKE2B_504:45631,BLAKE2B_512:45632,BLAKE2S_8:45633,BLAKE2S_16:45634,BLAKE2S_24:45635,BLAKE2S_32:45636,BLAKE2S_40:45637,BLAKE2S_48:45638,BLAKE2S_56:45639,BLAKE2S_64:45640,BLAKE2S_72:45641,BLAKE2S_80:45642,BLAKE2S_88:45643,BLAKE2S_96:45644,BLAKE2S_104:45645,BLAKE2S_112:45646,BLAKE2S_120:45647,BLAKE2S_128:45648,BLAKE2S_136:45649,BLAKE2S_144:45650,BLAKE2S_152:45651,BLAKE2S_160:45652,BLAKE2S_168:45653,BLAKE2S_176:45654,BLAKE2S_184:45655,BLAKE2S_192:45656,BLAKE2S_200:45657,BLAKE2S_208:45658,BLAKE2S_216:45659,BLAKE2S_224:45660,BLAKE2S_232:45661,BLAKE2S_240:45662,BLAKE2S_248:45663,BLAKE2S_256:45664,SKEIN256_8:45825,SKEIN256_16:45826,SKEIN256_24:45827,SKEIN256_32:45828,SKEIN256_40:45829,SKEIN256_48:45830,SKEIN256_56:45831,SKEIN256_64:45832,SKEIN256_72:45833,SKEIN256_80:45834,SKEIN256_88:45835,SKEIN256_96:45836,SKEIN256_104:45837,SKEIN256_112:45838,SKEIN256_120:45839,SKEIN256_128:45840,SKEIN256_136:45841,SKEIN256_144:45842,SKEIN256_152:45843,SKEIN256_160:45844,SKEIN256_168:45845,SKEIN256_176:45846,SKEIN256_184:45847,SKEIN256_192:45848,SKEIN256_200:45849,SKEIN256_208:45850,SKEIN256_216:45851,SKEIN256_224:45852,SKEIN256_232:45853,SKEIN256_240:45854,SKEIN256_248:45855,SKEIN256_256:45856,SKEIN512_8:45857,SKEIN512_16:45858,SKEIN512_24:45859,SKEIN512_32:45860,SKEIN512_40:45861,SKEIN512_48:45862,SKEIN512_56:45863,SKEIN512_64:45864,SKEIN512_72:45865,SKEIN512_80:45866,SKEIN512_88:45867,SKEIN512_96:45868,SKEIN512_104:45869,SKEIN512_112:45870,SKEIN512_120:45871,SKEIN512_128:45872,SKEIN512_136:45873,SKEIN512_144:45874,SKEIN512_152:45875,SKEIN512_160:45876,SKEIN512_168:45877,SKEIN512_176:45878,SKEIN512_184:45879,SKEIN512_192:45880,SKEIN512_200:45881,SKEIN512_208:45882,SKEIN512_216:45883,SKEIN512_224:45884,SKEIN512_232:45885,SKEIN512_240:45886,SKEIN512_248:45887,SKEIN512_256:45888,SKEIN512_264:45889,SKEIN512_272:45890,SKEIN512_280:45891,SKEIN512_288:45892,SKEIN512_296:45893,SKEIN512_304:45894,SKEIN512_312:45895,SKEIN512_320:45896,SKEIN512_328:45897,SKEIN512_336:45898,SKEIN512_344:45899,SKEIN512_352:45900,SKEIN512_360:45901,SKEIN512_368:45902,SKEIN512_376:45903,SKEIN512_384:45904,SKEIN512_392:45905,SKEIN512_400:45906,SKEIN512_408:45907,SKEIN512_416:45908,SKEIN512_424:45909,SKEIN512_432:45910,SKEIN512_440:45911,SKEIN512_448:45912,SKEIN512_456:45913,SKEIN512_464:45914,SKEIN512_472:45915,SKEIN512_480:45916,SKEIN512_488:45917,SKEIN512_496:45918,SKEIN512_504:45919,SKEIN512_512:45920,SKEIN1024_8:45921,SKEIN1024_16:45922,SKEIN1024_24:45923,SKEIN1024_32:45924,SKEIN1024_40:45925,SKEIN1024_48:45926,SKEIN1024_56:45927,SKEIN1024_64:45928,SKEIN1024_72:45929,SKEIN1024_80:45930,SKEIN1024_88:45931,SKEIN1024_96:45932,SKEIN1024_104:45933,SKEIN1024_112:45934,SKEIN1024_120:45935,SKEIN1024_128:45936,SKEIN1024_136:45937,SKEIN1024_144:45938,SKEIN1024_152:45939,SKEIN1024_160:45940,SKEIN1024_168:45941,SKEIN1024_176:45942,SKEIN1024_184:45943,SKEIN1024_192:45944,SKEIN1024_200:45945,SKEIN1024_208:45946,SKEIN1024_216:45947,SKEIN1024_224:45948,SKEIN1024_232:45949,SKEIN1024_240:45950,SKEIN1024_248:45951,SKEIN1024_256:45952,SKEIN1024_264:45953,SKEIN1024_272:45954,SKEIN1024_280:45955,SKEIN1024_288:45956,SKEIN1024_296:45957,SKEIN1024_304:45958,SKEIN1024_312:45959,SKEIN1024_320:45960,SKEIN1024_328:45961,SKEIN1024_336:45962,SKEIN1024_344:45963,SKEIN1024_352:45964,SKEIN1024_360:45965,SKEIN1024_368:45966,SKEIN1024_376:45967,SKEIN1024_384:45968,SKEIN1024_392:45969,SKEIN1024_400:45970,SKEIN1024_408:45971,SKEIN1024_416:45972,SKEIN1024_424:45973,SKEIN1024_432:45974,SKEIN1024_440:45975,SKEIN1024_448:45976,SKEIN1024_456:45977,SKEIN1024_464:45978,SKEIN1024_472:45979,SKEIN1024_480:45980,SKEIN1024_488:45981,SKEIN1024_496:45982,SKEIN1024_504:45983,SKEIN1024_512:45984,SKEIN1024_520:45985,SKEIN1024_528:45986,SKEIN1024_536:45987,SKEIN1024_544:45988,SKEIN1024_552:45989,SKEIN1024_560:45990,SKEIN1024_568:45991,SKEIN1024_576:45992,SKEIN1024_584:45993,SKEIN1024_592:45994,SKEIN1024_600:45995,SKEIN1024_608:45996,SKEIN1024_616:45997,SKEIN1024_624:45998,SKEIN1024_632:45999,SKEIN1024_640:46e3,SKEIN1024_648:46001,SKEIN1024_656:46002,SKEIN1024_664:46003,SKEIN1024_672:46004,SKEIN1024_680:46005,SKEIN1024_688:46006,SKEIN1024_696:46007,SKEIN1024_704:46008,SKEIN1024_712:46009,SKEIN1024_720:46010,SKEIN1024_728:46011,SKEIN1024_736:46012,SKEIN1024_744:46013,SKEIN1024_752:46014,SKEIN1024_760:46015,SKEIN1024_768:46016,SKEIN1024_776:46017,SKEIN1024_784:46018,SKEIN1024_792:46019,SKEIN1024_800:46020,SKEIN1024_808:46021,SKEIN1024_816:46022,SKEIN1024_824:46023,SKEIN1024_832:46024,SKEIN1024_840:46025,SKEIN1024_848:46026,SKEIN1024_856:46027,SKEIN1024_864:46028,SKEIN1024_872:46029,SKEIN1024_880:46030,SKEIN1024_888:46031,SKEIN1024_896:46032,SKEIN1024_904:46033,SKEIN1024_912:46034,SKEIN1024_920:46035,SKEIN1024_928:46036,SKEIN1024_936:46037,SKEIN1024_944:46038,SKEIN1024_952:46039,SKEIN1024_960:46040,SKEIN1024_968:46041,SKEIN1024_976:46042,SKEIN1024_984:46043,SKEIN1024_992:46044,SKEIN1024_1000:46045,SKEIN1024_1008:46046,SKEIN1024_1016:46047,SKEIN1024_1024:46048,IP4:4,TCP:6,DCCP:33,IP6:41,IP6ZONE:42,DNS:53,DNS4:54,DNS6:55,DNSADDR:56,SCTP:132,UDP:273,P2P_WEBRTC_STAR:275,P2P_WEBRTC_DIRECT:276,P2P_STARDUST:277,P2P_CIRCUIT:290,UDT:301,UTP:302,UNIX:400,P2P:421,IPFS:421,HTTPS:443,ONION:444,ONION3:445,GARLIC64:446,GARLIC32:447,QUIC:460,WS:477,WSS:478,P2P_WEBSOCKET_STAR:479,HTTP:480,RAW:85,DAG_PB:112,DAG_CBOR:113,LIBP2P_KEY:114,GIT_RAW:120,TORRENT_INFO:123,TORRENT_FILE:124,LEOFCOIN_BLOCK:129,LEOFCOIN_TX:130,LEOFCOIN_PR:131,ETH_BLOCK:144,ETH_BLOCK_LIST:145,ETH_TX_TRIE:146,ETH_TX:147,ETH_TX_RECEIPT_TRIE:148,ETH_TX_RECEIPT:149,ETH_STATE_TRIE:150,ETH_ACCOUNT_SNAPSHOT:151,ETH_STORAGE_TRIE:152,BITCOIN_BLOCK:176,BITCOIN_TX:177,ZCASH_BLOCK:192,ZCASH_TX:193,STELLAR_BLOCK:208,STELLAR_TX:209,DECRED_BLOCK:224,DECRED_TX:225,DASH_BLOCK:240,DASH_TX:241,SWARM_MANIFEST:250,SWARM_FEED:251,DAG_JSON:297,PATH:47,IPLD_NS:226,IPFS_NS:227,SWARM_NS:228,ED25519_PUB:237,HOLOCHAIN_ADR_V0:8417572,HOLOCHAIN_ADR_V1:8483108,HOLOCHAIN_KEY_V0:9728292,HOLOCHAIN_KEY_V1:9793828,HOLOCHAIN_SIG_V0:10645796,HOLOCHAIN_SIG_V1:10711332})},function(e,t,n){"use strict";e.exports=Object.freeze({80:"protobuf",81:"cbor",96:"rlp",99:"bencode",48:"multicodec",49:"multihash",50:"multiaddr",51:"multibase",0:"identity",17:"sha1",18:"sha2-256",19:"sha2-512",20:"sha3-512",21:"sha3-384",22:"sha3-256",23:"sha3-224",24:"shake-128",25:"shake-256",26:"keccak-224",27:"keccak-256",28:"keccak-384",29:"keccak-512",34:"murmur3-128",35:"murmur3-32",86:"dbl-sha2-256",212:"md4",213:"md5",214:"bmt",4352:"x11",45569:"blake2b-8",45570:"blake2b-16",45571:"blake2b-24",45572:"blake2b-32",45573:"blake2b-40",45574:"blake2b-48",45575:"blake2b-56",45576:"blake2b-64",45577:"blake2b-72",45578:"blake2b-80",45579:"blake2b-88",45580:"blake2b-96",45581:"blake2b-104",45582:"blake2b-112",45583:"blake2b-120",45584:"blake2b-128",45585:"blake2b-136",45586:"blake2b-144",45587:"blake2b-152",45588:"blake2b-160",45589:"blake2b-168",45590:"blake2b-176",45591:"blake2b-184",45592:"blake2b-192",45593:"blake2b-200",45594:"blake2b-208",45595:"blake2b-216",45596:"blake2b-224",45597:"blake2b-232",45598:"blake2b-240",45599:"blake2b-248",45600:"blake2b-256",45601:"blake2b-264",45602:"blake2b-272",45603:"blake2b-280",45604:"blake2b-288",45605:"blake2b-296",45606:"blake2b-304",45607:"blake2b-312",45608:"blake2b-320",45609:"blake2b-328",45610:"blake2b-336",45611:"blake2b-344",45612:"blake2b-352",45613:"blake2b-360",45614:"blake2b-368",45615:"blake2b-376",45616:"blake2b-384",45617:"blake2b-392",45618:"blake2b-400",45619:"blake2b-408",45620:"blake2b-416",45621:"blake2b-424",45622:"blake2b-432",45623:"blake2b-440",45624:"blake2b-448",45625:"blake2b-456",45626:"blake2b-464",45627:"blake2b-472",45628:"blake2b-480",45629:"blake2b-488",45630:"blake2b-496",45631:"blake2b-504",45632:"blake2b-512",45633:"blake2s-8",45634:"blake2s-16",45635:"blake2s-24",45636:"blake2s-32",45637:"blake2s-40",45638:"blake2s-48",45639:"blake2s-56",45640:"blake2s-64",45641:"blake2s-72",45642:"blake2s-80",45643:"blake2s-88",45644:"blake2s-96",45645:"blake2s-104",45646:"blake2s-112",45647:"blake2s-120",45648:"blake2s-128",45649:"blake2s-136",45650:"blake2s-144",45651:"blake2s-152",45652:"blake2s-160",45653:"blake2s-168",45654:"blake2s-176",45655:"blake2s-184",45656:"blake2s-192",45657:"blake2s-200",45658:"blake2s-208",45659:"blake2s-216",45660:"blake2s-224",45661:"blake2s-232",45662:"blake2s-240",45663:"blake2s-248",45664:"blake2s-256",45825:"skein256-8",45826:"skein256-16",45827:"skein256-24",45828:"skein256-32",45829:"skein256-40",45830:"skein256-48",45831:"skein256-56",45832:"skein256-64",45833:"skein256-72",45834:"skein256-80",45835:"skein256-88",45836:"skein256-96",45837:"skein256-104",45838:"skein256-112",45839:"skein256-120",45840:"skein256-128",45841:"skein256-136",45842:"skein256-144",45843:"skein256-152",45844:"skein256-160",45845:"skein256-168",45846:"skein256-176",45847:"skein256-184",45848:"skein256-192",45849:"skein256-200",45850:"skein256-208",45851:"skein256-216",45852:"skein256-224",45853:"skein256-232",45854:"skein256-240",45855:"skein256-248",45856:"skein256-256",45857:"skein512-8",45858:"skein512-16",45859:"skein512-24",45860:"skein512-32",45861:"skein512-40",45862:"skein512-48",45863:"skein512-56",45864:"skein512-64",45865:"skein512-72",45866:"skein512-80",45867:"skein512-88",45868:"skein512-96",45869:"skein512-104",45870:"skein512-112",45871:"skein512-120",45872:"skein512-128",45873:"skein512-136",45874:"skein512-144",45875:"skein512-152",45876:"skein512-160",45877:"skein512-168",45878:"skein512-176",45879:"skein512-184",45880:"skein512-192",45881:"skein512-200",45882:"skein512-208",45883:"skein512-216",45884:"skein512-224",45885:"skein512-232",45886:"skein512-240",45887:"skein512-248",45888:"skein512-256",45889:"skein512-264",45890:"skein512-272",45891:"skein512-280",45892:"skein512-288",45893:"skein512-296",45894:"skein512-304",45895:"skein512-312",45896:"skein512-320",45897:"skein512-328",45898:"skein512-336",45899:"skein512-344",45900:"skein512-352",45901:"skein512-360",45902:"skein512-368",45903:"skein512-376",45904:"skein512-384",45905:"skein512-392",45906:"skein512-400",45907:"skein512-408",45908:"skein512-416",45909:"skein512-424",45910:"skein512-432",45911:"skein512-440",45912:"skein512-448",45913:"skein512-456",45914:"skein512-464",45915:"skein512-472",45916:"skein512-480",45917:"skein512-488",45918:"skein512-496",45919:"skein512-504",45920:"skein512-512",45921:"skein1024-8",45922:"skein1024-16",45923:"skein1024-24",45924:"skein1024-32",45925:"skein1024-40",45926:"skein1024-48",45927:"skein1024-56",45928:"skein1024-64",45929:"skein1024-72",45930:"skein1024-80",45931:"skein1024-88",45932:"skein1024-96",45933:"skein1024-104",45934:"skein1024-112",45935:"skein1024-120",45936:"skein1024-128",45937:"skein1024-136",45938:"skein1024-144",45939:"skein1024-152",45940:"skein1024-160",45941:"skein1024-168",45942:"skein1024-176",45943:"skein1024-184",45944:"skein1024-192",45945:"skein1024-200",45946:"skein1024-208",45947:"skein1024-216",45948:"skein1024-224",45949:"skein1024-232",45950:"skein1024-240",45951:"skein1024-248",45952:"skein1024-256",45953:"skein1024-264",45954:"skein1024-272",45955:"skein1024-280",45956:"skein1024-288",45957:"skein1024-296",45958:"skein1024-304",45959:"skein1024-312",45960:"skein1024-320",45961:"skein1024-328",45962:"skein1024-336",45963:"skein1024-344",45964:"skein1024-352",45965:"skein1024-360",45966:"skein1024-368",45967:"skein1024-376",45968:"skein1024-384",45969:"skein1024-392",45970:"skein1024-400",45971:"skein1024-408",45972:"skein1024-416",45973:"skein1024-424",45974:"skein1024-432",45975:"skein1024-440",45976:"skein1024-448",45977:"skein1024-456",45978:"skein1024-464",45979:"skein1024-472",45980:"skein1024-480",45981:"skein1024-488",45982:"skein1024-496",45983:"skein1024-504",45984:"skein1024-512",45985:"skein1024-520",45986:"skein1024-528",45987:"skein1024-536",45988:"skein1024-544",45989:"skein1024-552",45990:"skein1024-560",45991:"skein1024-568",45992:"skein1024-576",45993:"skein1024-584",45994:"skein1024-592",45995:"skein1024-600",45996:"skein1024-608",45997:"skein1024-616",45998:"skein1024-624",45999:"skein1024-632",46000:"skein1024-640",46001:"skein1024-648",46002:"skein1024-656",46003:"skein1024-664",46004:"skein1024-672",46005:"skein1024-680",46006:"skein1024-688",46007:"skein1024-696",46008:"skein1024-704",46009:"skein1024-712",46010:"skein1024-720",46011:"skein1024-728",46012:"skein1024-736",46013:"skein1024-744",46014:"skein1024-752",46015:"skein1024-760",46016:"skein1024-768",46017:"skein1024-776",46018:"skein1024-784",46019:"skein1024-792",46020:"skein1024-800",46021:"skein1024-808",46022:"skein1024-816",46023:"skein1024-824",46024:"skein1024-832",46025:"skein1024-840",46026:"skein1024-848",46027:"skein1024-856",46028:"skein1024-864",46029:"skein1024-872",46030:"skein1024-880",46031:"skein1024-888",46032:"skein1024-896",46033:"skein1024-904",46034:"skein1024-912",46035:"skein1024-920",46036:"skein1024-928",46037:"skein1024-936",46038:"skein1024-944",46039:"skein1024-952",46040:"skein1024-960",46041:"skein1024-968",46042:"skein1024-976",46043:"skein1024-984",46044:"skein1024-992",46045:"skein1024-1000",46046:"skein1024-1008",46047:"skein1024-1016",46048:"skein1024-1024",4:"ip4",6:"tcp",33:"dccp",41:"ip6",42:"ip6zone",53:"dns",54:"dns4",55:"dns6",56:"dnsaddr",132:"sctp",273:"udp",275:"p2p-webrtc-star",276:"p2p-webrtc-direct",277:"p2p-stardust",290:"p2p-circuit",301:"udt",302:"utp",400:"unix",421:"p2p",443:"https",444:"onion",445:"onion3",446:"garlic64",447:"garlic32",460:"quic",477:"ws",478:"wss",479:"p2p-websocket-star",480:"http",85:"raw",112:"dag-pb",113:"dag-cbor",114:"libp2p-key",120:"git-raw",123:"torrent-info",124:"torrent-file",129:"leofcoin-block",130:"leofcoin-tx",131:"leofcoin-pr",144:"eth-block",145:"eth-block-list",146:"eth-tx-trie",147:"eth-tx",148:"eth-tx-receipt-trie",149:"eth-tx-receipt",150:"eth-state-trie",151:"eth-account-snapshot",152:"eth-storage-trie",176:"bitcoin-block",177:"bitcoin-tx",192:"zcash-block",193:"zcash-tx",208:"stellar-block",209:"stellar-tx",224:"decred-block",225:"decred-tx",240:"dash-block",241:"dash-tx",250:"swarm-manifest",251:"swarm-feed",297:"dag-json",47:"path",226:"ipld-ns",227:"ipfs-ns",228:"swarm-ns",237:"ed25519-pub",8417572:"holochain-adr-v0",8483108:"holochain-adr-v1",9728292:"holochain-key-v0",9793828:"holochain-key-v1",10645796:"holochain-sig-v0",10711332:"holochain-sig-v1"})},function(e,t,n){"use strict";(function(t){const r=n(27);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(0===e.version){if("dag-pb"!==e.codec)return"codec must be 'dag-pb' for CIDv0";if("base58btc"!==e.multibaseName)return"multibaseName must be 'base58btc' for CIDv0"}if(!t.isBuffer(e.multihash))return"multihash must be a Buffer";try{r.validate(e.multihash)}catch(e){let t=e.message;return t||(t="Multihash validation failed"),t}}};e.exports=i}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports={keys:n(697),once:n(116),values:n(40),count:n(698),infinite:n(699),empty:n(88),error:n(71)}},function(e,t,n){"use strict";var r=n(40);e.exports=function(e){return r(Object.keys(e))}},function(e,t,n){"use strict";e.exports=function e(t){var n=0;return t=t||1/0,function(e,r){return e?r&&r(e):n>t?r(!0):void r(null,n++)}}},function(e,t,n){"use strict";e.exports=function e(t){return t=t||Math.random,function(e,n){return e?n&&n(e):n(null,t())}}},function(e,t,n){"use strict";e.exports={drain:n(150),onEnd:n(344),log:n(701),find:n(702),reduce:n(185),collect:n(33),concat:n(703)}},function(e,t,n){"use strict";var r=n(150);e.exports=function e(t){return r(function(e){console.log(e)},t)}},function(e,t,n){"use strict";function r(e){return e}var i=n(151),o=n(150);e.exports=function e(t,n){var s=!1;return n?t=i(t)||r:(n=t,t=r),o(function(e){if(t(e))return s=!0,n(null,e),!1},function(e){s||n(!0===e?null:e,null)})}},function(e,t,n){"use strict";var r=n(185);e.exports=function e(t){return r(function(e,t){return e+t},"",t)}},function(e,t,n){"use strict";e.exports={map:n(66),asyncMap:n(74),filter:n(67),filterNot:n(705),through:n(186),take:n(246),unique:n(346),nonUnique:n(706),flatten:n(187)}},function(e,t,n){"use strict";var r=n(345),i=n(67);e.exports=function e(t){return t=r(t),i(function(e){return!t(e)})}},function(e,t,n){"use strict";var r=n(346);e.exports=function e(t){return r(t,!0)}},function(e,t,n){"use strict";(function(t){const r=n(27);var i={checkCIDComponents:function(e){if(null==e)return"null values are not valid CIDs";if(0!==e.version&&1!==e.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof e.codec)return"codec must be string";if(!t.isBuffer(e.multihash))return"multihash must be a Buffer";try{r.validate(e.multihash)}catch(e){let t=e.message;return t||(t="Multihash validation failed"),t}}};e.exports=i}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var r=n(58),i=h(r),o=n(86),s=h(o),a=n(107),l=h(a),u=n(37),c=h(u);function h(e){return e&&e.__esModule?e:{default:e}}function f(e,t,n){n=(0,l.default)(n||i.default);var r=(0,c.default)(e),o=function(e){if(e)return n(e);var i=(0,s.default)(arguments,1);if(t.apply(this,i))return r(o);n.apply(null,[null].concat(i))};r(o)}e.exports=t.default},function(e,t){e.exports=function(){var e,t,n,r,i;function o(o){return i?i(o):(e=o,function(e,i){t?t(e,i):(r=e,n=i)})}return o.resolve=function(o){if(i)throw new Error("already resolved");if(i=o,!i)throw new Error("resolve *must* be passed a transform stream");e&&(t=i(e),n&&t(r,n))},o}},function(e,t,n){"use strict";t.Diagnose=n(711),t.Decoder=n(353),t.Encoder=n(714),t.Simple=n(354),t.Tagged=n(355),t.decodeAll=t.Decoder.decodeAll,t.decodeFirst=t.Decoder.decodeFirst,t.diagnose=t.Diagnose.diagnose,t.encode=t.Encoder.encode,t.decode=t.Decoder.decode,t.leveldb={decode:t.Decoder.decodeAll,encode:t.Encoder.encode,buffer:!0,name:"cbor"}},function(e,t,n){"use strict";(function(t){const r=n(353),i=n(247);class o extends r{createTag(e,t){return`${e}(${t})`}createInt(e){return super.createInt(e).toString()}createInt32(e,t){return super.createInt32(e,t).toString()}createInt64(e,t,n,r){return super.createInt64(e,t,n,r).toString()}createInt32Neg(e,t){return super.createInt32Neg(e,t).toString()}createInt64Neg(e,t,n,r){return super.createInt64Neg(e,t,n,r).toString()}createTrue(){return"true"}createFalse(){return"false"}createFloat(e){const t=super.createFloat(e);return i.isNegativeZero(e)?"-0_1":`${t}_1`}createFloatSingle(e,t,n,r){const i=super.createFloatSingle(e,t,n,r);return`${i}_2`}createFloatDouble(e,t,n,r,i,o,s,a){const l=super.createFloatDouble(e,t,n,r,i,o,s,a);return`${l}_3`}createByteString(e,t){const n=e.join(", ");return-1===t?`(_ ${n})`:`h'${n}`}createByteStringFromHeap(e,n){const r=t.from(super.createByteStringFromHeap(e,n)).toString("hex");return`h'${r}'`}createInfinity(){return"Infinity_1"}createInfinityNeg(){return"-Infinity_1"}createNaN(){return"NaN_1"}createNaNNeg(){return"-NaN_1"}createNull(){return"null"}createUndefined(){return"undefined"}createSimpleUnassigned(e){return`simple(${e})`}createArray(e,t){const n=super.createArray(e,t);return-1===t?`[_ ${n.join(", ")}]`:`[${n.join(", ")}]`}createMap(e,t){const n=super.createMap(e),r=Array.from(n.keys()).reduce(s(n),"");return-1===t?`{_ ${r}}`:`{${r}}`}createObject(e,t){const n=super.createObject(e),r=Object.keys(n).reduce(s(n),"");return-1===t?`{_ ${r}}`:`{${r}}`}createUtf8String(e,t){const n=e.join(", ");return-1===t?`(_ ${n})`:`"${n}"`}createUtf8StringFromHeap(e,n){const r=t.from(super.createUtf8StringFromHeap(e,n)).toString("utf8");return`"${r}"`}static diagnose(e,n){"string"==typeof e&&(e=t.from(e,n||"hex"));const r=new o;return r.decodeFirst(e)}}function s(e){return(t,n)=>t?`${t}, ${n}: ${e[n]}`:`${n}: ${e[n]}`}e.exports=o}).call(this,n(0).Buffer)},function(e,t){e.exports=function e(t,n,r){"use asm";var i=new t.Uint8Array(r);var o=n.pushInt;var s=n.pushInt32;var a=n.pushInt32Neg;var l=n.pushInt64;var u=n.pushInt64Neg;var c=n.pushFloat;var h=n.pushFloatSingle;var f=n.pushFloatDouble;var p=n.pushTrue;var d=n.pushFalse;var m=n.pushUndefined;var g=n.pushNull;var y=n.pushInfinity;var v=n.pushInfinityNeg;var b=n.pushNaN;var _=n.pushNaNNeg;var w=n.pushArrayStart;var k=n.pushArrayStartFixed;var E=n.pushArrayStartFixed32;var S=n.pushArrayStartFixed64;var x=n.pushObjectStart;var C=n.pushObjectStartFixed;var A=n.pushObjectStartFixed32;var T=n.pushObjectStartFixed64;var I=n.pushByteString;var j=n.pushByteStringStart;var R=n.pushUtf8String;var B=n.pushUtf8StringStart;var O=n.pushSimpleUnassigned;var P=n.pushTagStart;var N=n.pushTagStart4;var D=n.pushTagStart8;var M=n.pushTagUnassigned;var F=n.pushBreak;var L=t.Math.pow;var U=0;var q=0;var z=0;function K(e){e=e|0;U=0;q=e;while((U|0)<(q|0)){z=Je[i[U]&255](i[U]|0)|0;if((z|0)>0){break}}return z|0}function H(e){e=e|0;if(((U|0)+(e|0)|0)<(q|0)){return 0}return 1}function V(e){e=e|0;return i[e|0]<<8|i[e+1|0]|0}function $(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);U=U+1|0;return 0}function G(e){e=e|0;if(H(1)|0){return 1}o(i[U+1|0]|0);U=U+2|0;return 0}function Y(e){e=e|0;if(H(2)|0){return 1}o(V(U+1|0)|0);U=U+3|0;return 0}function Z(e){e=e|0;if(H(4)|0){return 1}s(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function J(e){e=e|0;if(H(8)|0){return 1}l(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function Q(e){e=e|0;o(-1-(e-32|0)|0);U=U+1|0;return 0}function X(e){e=e|0;if(H(1)|0){return 1}o(-1-(i[U+1|0]|0)|0);U=U+2|0;return 0}function ee(e){e=e|0;var t=0;if(H(2)|0){return 1}t=V(U+1|0)|0;o(-1-(t|0)|0);U=U+3|0;return 0}function te(e){e=e|0;if(H(4)|0){return 1}a(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function ne(e){e=e|0;if(H(8)|0){return 1}u(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function re(e){e=e|0;var t=0;var n=0;var r=0;r=e-64|0;if(H(r|0)|0){return 1}t=U+1|0;n=(U+1|0)+(r|0)|0;I(t|0,n|0);U=n|0;return 0}function ie(e){e=e|0;var t=0;var n=0;var r=0;if(H(1)|0){return 1}r=i[U+1|0]|0;t=U+2|0;n=(U+2|0)+(r|0)|0;if(H(r+1|0)|0){return 1}I(t|0,n|0);U=n|0;return 0}function oe(e){e=e|0;var t=0;var n=0;var r=0;if(H(2)|0){return 1}r=V(U+1|0)|0;t=U+3|0;n=(U+3|0)+(r|0)|0;if(H(r+2|0)|0){return 1}I(t|0,n|0);U=n|0;return 0}function se(e){e=e|0;var t=0;var n=0;var r=0;if(H(4)|0){return 1}r=$(U+1|0)|0;t=U+5|0;n=(U+5|0)+(r|0)|0;if(H(r+4|0)|0){return 1}I(t|0,n|0);U=n|0;return 0}function ae(e){e=e|0;return 1}function le(e){e=e|0;j();U=U+1|0;return 0}function ue(e){e=e|0;var t=0;var n=0;var r=0;r=e-96|0;if(H(r|0)|0){return 1}t=U+1|0;n=(U+1|0)+(r|0)|0;R(t|0,n|0);U=n|0;return 0}function ce(e){e=e|0;var t=0;var n=0;var r=0;if(H(1)|0){return 1}r=i[U+1|0]|0;t=U+2|0;n=(U+2|0)+(r|0)|0;if(H(r+1|0)|0){return 1}R(t|0,n|0);U=n|0;return 0}function he(e){e=e|0;var t=0;var n=0;var r=0;if(H(2)|0){return 1}r=V(U+1|0)|0;t=U+3|0;n=(U+3|0)+(r|0)|0;if(H(r+2|0)|0){return 1}R(t|0,n|0);U=n|0;return 0}function fe(e){e=e|0;var t=0;var n=0;var r=0;if(H(4)|0){return 1}r=$(U+1|0)|0;t=U+5|0;n=(U+5|0)+(r|0)|0;if(H(r+4|0)|0){return 1}R(t|0,n|0);U=n|0;return 0}function pe(e){e=e|0;return 1}function de(e){e=e|0;B();U=U+1|0;return 0}function me(e){e=e|0;k(e-128|0);U=U+1|0;return 0}function ge(e){e=e|0;if(H(1)|0){return 1}k(i[U+1|0]|0);U=U+2|0;return 0}function ye(e){e=e|0;if(H(2)|0){return 1}k(V(U+1|0)|0);U=U+3|0;return 0}function ve(e){e=e|0;if(H(4)|0){return 1}E(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function be(e){e=e|0;if(H(8)|0){return 1}S(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function _e(e){e=e|0;w();U=U+1|0;return 0}function we(e){e=e|0;var t=0;t=e-160|0;if(H(t|0)|0){return 1}C(t|0);U=U+1|0;return 0}function ke(e){e=e|0;if(H(1)|0){return 1}C(i[U+1|0]|0);U=U+2|0;return 0}function Ee(e){e=e|0;if(H(2)|0){return 1}C(V(U+1|0)|0);U=U+3|0;return 0}function Se(e){e=e|0;if(H(4)|0){return 1}A(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function xe(e){e=e|0;if(H(8)|0){return 1}T(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function Ce(e){e=e|0;x();U=U+1|0;return 0}function Ae(e){e=e|0;P(e-192|0|0);U=U+1|0;return 0}function Te(e){e=e|0;P(e|0);U=U+1|0;return 0}function Ie(e){e=e|0;P(e|0);U=U+1|0;return 0}function je(e){e=e|0;P(e|0);U=U+1|0;return 0}function Re(e){e=e|0;P(e|0);U=U+1|0;return 0}function Be(e){e=e|0;P(e-192|0|0);U=U+1|0;return 0}function Oe(e){e=e|0;P(e|0);U=U+1|0;return 0}function Pe(e){e=e|0;P(e|0);U=U+1|0;return 0}function Ne(e){e=e|0;P(e|0);U=U+1|0;return 0}function De(e){e=e|0;if(H(1)|0){return 1}P(i[U+1|0]|0);U=U+2|0;return 0}function Me(e){e=e|0;if(H(2)|0){return 1}P(V(U+1|0)|0);U=U+3|0;return 0}function Fe(e){e=e|0;if(H(4)|0){return 1}N(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function Le(e){e=e|0;if(H(8)|0){return 1}D(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function Ue(e){e=e|0;O((e|0)-224|0);U=U+1|0;return 0}function qe(e){e=e|0;d();U=U+1|0;return 0}function ze(e){e=e|0;p();U=U+1|0;return 0}function Ke(e){e=e|0;g();U=U+1|0;return 0}function He(e){e=e|0;m();U=U+1|0;return 0}function Ve(e){e=e|0;if(H(1)|0){return 1}O(i[U+1|0]|0);U=U+2|0;return 0}function $e(e){e=e|0;var t=0;var n=0;var r=1.0;var o=0.0;var s=0.0;var a=0.0;if(H(2)|0){return 1}t=i[U+1|0]|0;n=i[U+2|0]|0;if((t|0)&0x80){r=-1.0}o=+(((t|0)&0x7C)>>2);s=+(((t|0)&0x03)<<8|n);if(+o==0.0){c(+(+r*+5.9604644775390625e-8*+s))}else if(+o==31.0){if(+r==1.0){if(+s>0.0){b()}else{y()}}else{if(+s>0.0){_()}else{v()}}}else{c(+(+r*L(+2,+(+o-25.0))*+(1024.0+s)))}U=U+3|0;return 0}function We(e){e=e|0;if(H(4)|0){return 1}h(i[U+1|0]|0,i[U+2|0]|0,i[U+3|0]|0,i[U+4|0]|0);U=U+5|0;return 0}function Ge(e){e=e|0;if(H(8)|0){return 1}f(i[U+1|0]|0,i[U+2|0]|0,i[U+3|0]|0,i[U+4|0]|0,i[U+5|0]|0,i[U+6|0]|0,i[U+7|0]|0,i[U+8|0]|0);U=U+9|0;return 0}function Ye(e){e=e|0;return 1}function Ze(e){e=e|0;F();U=U+1|0;return 0}var Je=[W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,G,Y,Z,J,Ye,Ye,Ye,Ye,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,X,ee,te,ne,Ye,Ye,Ye,Ye,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,ie,oe,se,ae,Ye,Ye,Ye,le,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ce,he,fe,pe,Ye,Ye,Ye,de,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,ge,ye,ve,be,Ye,Ye,Ye,_e,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,ke,Ee,Se,xe,Ye,Ye,Ye,Ce,Ae,Ae,Ae,Ae,Ae,Ae,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,De,Me,Fe,Le,Ye,Ye,Ye,Ye,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,qe,ze,Ke,He,Ve,$e,We,Ge,Ye,Ye,Ye,Ze];return{parse:K}}},function(e,t,n){"use strict";const{URLWithLegacySupport:r,format:i}=n(356);e.exports=((e,t={},n={},o)=>{let s=t.protocol?t.protocol.replace(":",""):"http",a;s=(n[s]||o||s)+":";try{a=new r(e)}catch(e){a={}}const l=Object.assign({},t,{protocol:s||a.protocol,host:t.host||a.host});return new r(e,i(l)).toString()})},function(e,t,n){"use strict";(function(t){const{URL:r}=n(191),i=n(55),o=n(247),s=n(190),a=s.MT,l=s.NUMBYTES,u=s.SHIFT32,c=s.SYMS,h=s.TAG,f=s.MT.SIMPLE_FLOAT<<5|s.NUMBYTES.TWO,p=s.MT.SIMPLE_FLOAT<<5|s.NUMBYTES.FOUR,d=s.MT.SIMPLE_FLOAT<<5|s.NUMBYTES.EIGHT,m=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.TRUE,g=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.FALSE,y=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.UNDEFINED,v=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.NULL,b=new i("0x20000000000000"),_=t.from("f97e00","hex"),w=t.from("f9fc00","hex"),k=t.from("f97c00","hex");function E(e){return{}.toString.call(e).slice(8,-1)}class S{constructor(e){e=e||{},this.streaming="function"==typeof e.stream,this.onData=e.stream,this.semanticTypes=[[r,this._pushUrl],[i,this._pushBigNumber]];const t=e.genTypes||[],n=t.length;for(let e=0;e[t,e[t]]))}_pushRawMap(e,t){t=t.map(function(e){return e[0]=S.encode(e[0]),e}).sort(o.keySorter);for(var n=0;n{s.sha2256(e,(e,r)=>{e&&n(e),s.sha2256(t.from(r),n)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(l(r.sha3_512)),sha3384:a(l(r.sha3_384)),sha3256:a(l(r.sha3_256)),sha3224:a(l(r.sha3_224)),shake128:a(l(r.shake_128,128)),shake256:a(l(r.shake_256,256)),keccak224:a(l(r.keccak_224)),keccak256:a(l(r.keccak_256)),keccak384:a(l(r.keccak_384)),keccak512:a(l(r.keccak_512)),murmur3128:a(l(u(i.x64.hash128))),murmur332:a(c(u(i.x86.hash32))),addBlake:n(719),dblSha2256:h}}).call(this,n(0).Buffer)},function(e,t,n){!function(n,r){"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 l(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function u(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function c(e,t){return t%=64,32===t?[e[1],e[0]]:t<32?[e[0]<>>32-t,e[1]<>>32-t]:(t-=32,[e[1]<>>32-t,e[0]<>>32-t])}function h(e,t){return t%=64,0===t?e:t<32?[e[0]<>>32-t,e[1]<>>1]),e=u(e,[4283543511,3981806797]),e=f(e,[0,e[0]>>>1]),e=u(e,[3301882366,444984403]),e=f(e,[0,e[0]>>>1]),e}i.x86.hash32=function(e,t){e=e||"",t=t||0;for(var n=e.length%4,r=e.length-n,i=t,l=0,u=3432918353,c=461845907,h=0;h>>0},i.x86.hash128=function(e,t){e=e||"",t=t||0;for(var n=e.length%16,r=e.length-n,i=t,l=t,u=t,c=t,h=0,f=0,p=0,d=0,m=597399067,g=2869860233,y=951274213,v=2716044179,b=0;b>>0).toString(16)).slice(-8)+("00000000"+(l>>>0).toString(16)).slice(-8)+("00000000"+(u>>>0).toString(16)).slice(-8)+("00000000"+(c>>>0).toString(16)).slice(-8)},i.x64.hash128=function(e,t){e=e||"",t=t||0;for(var n=e.length%16,r=e.length-n,i=[0,t],o=[0,t],s=[0,0],a=[0,0],d=[2277735313,289559509],m=[1291169091,658871167],g=0;g>>0).toString(16)).slice(-8)+("00000000"+(i[1]>>>0).toString(16)).slice(-8)+("00000000"+(o[0]>>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)},e.exports&&(t=e.exports=i),t.murmurHash3=i}(this)},function(e,t,n){"use strict";(function(t){const r=n(361),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");return(n,o)=>{const s=i.digest({name:e},n);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));r(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function l(e,t){s("SHA-256")(e,t)}function u(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:l,sha2512:u}}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var r=n(362),i;i="function"==typeof setImediate?setImediate:"object"==typeof t&&t&&t.nextTick?t.nextTick:function(e){setTimeout(e,0)};var o=[];function s(e){if(!(this instanceof s))return"function"==typeof e?new s(e):a();var t=!1,n=!1,l,u=[],c=!1;function h(e){u.length?(c=!0,u.shift()(e||!1)):c=!1}function f(e,r){return new s(function(o){function s(t){var s=n?e:r;if("function"==typeof s){function a(){var e;try{e=s(l)}catch(e){return o.reject(e),h()}o.fulfill(e),h(!0)}t?a():i(a)}else n?(o.fulfill(l),h(t)):(o.reject(l),h(t))}u.push(s),t&&!c&&h()})}this.then=f,function(){function i(e){t||(r(e)?e.then(i,s):(t=n=!0,l=e,h()))}function s(e){t||(t=!0,n=!1,l=e,h())}for(var a={fulfill:i,reject:s},u=0;ui(r=>{const i=n.init(e,null);return n.update(i,r),t.from(n.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=u(t+1,a);for(let t=0;t<32;t++)e[s+t]=u(t+1,l)})}).call(this,n(0).Buffer)},function(e,t,n){var r=n(364);function i(e,t,n){var r=e[t]+e[n],i=e[t+1]+e[n+1];r>=4294967296&&i++,e[t]=r,e[t+1]=i}function o(e,t,n,r){var i=e[t]+n;n<0&&(i+=4294967296);var o=e[t+1]+r;i>=4294967296&&o++,e[t]=i,e[t+1]=o}function s(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function a(e,t,n,r,s,a){var l=f[s],u=f[s+1],c=f[a],p=f[a+1];i(h,e,t),o(h,e,l,u);var d=h[r]^h[e],m=h[r+1]^h[e+1];h[r]=m,h[r+1]=d,i(h,n,r),d=h[t]^h[n],m=h[t+1]^h[n+1],h[t]=d>>>24^m<<8,h[t+1]=m>>>24^d<<8,i(h,e,t),o(h,e,c,p),d=h[r]^h[e],m=h[r+1]^h[e+1],h[r]=d>>>16^m<<16,h[r+1]=m>>>16^d<<16,i(h,n,r),d=h[t]^h[n],m=h[t+1]^h[n+1],h[t]=m>>>31^d<<1,h[t+1]=d>>>31^m<<1}var l=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),u=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],c=new Uint8Array(u.map(function(e){return 2*e})),h=new Uint32Array(32),f=new Uint32Array(32);function p(e,t){var n=0;for(n=0;n<16;n++)h[n]=e.h[n],h[n+16]=l[n];for(h[24]=h[24]^e.t,h[25]=h[25]^e.t/4294967296,t&&(h[28]=~h[28],h[29]=~h[29]),n=0;n<32;n++)f[n]=s(e.b,4*n);for(n=0;n<12;n++)a(0,8,16,24,c[16*n+0],c[16*n+1]),a(2,10,18,26,c[16*n+2],c[16*n+3]),a(4,12,20,28,c[16*n+4],c[16*n+5]),a(6,14,22,30,c[16*n+6],c[16*n+7]),a(0,10,20,30,c[16*n+8],c[16*n+9]),a(2,12,22,24,c[16*n+10],c[16*n+11]),a(4,14,16,26,c[16*n+12],c[16*n+13]),a(6,8,18,28,c[16*n+14],c[16*n+15]);for(n=0;n<16;n++)e.h[n]=e.h[n]^h[n]^h[n+16]}function d(e,t){if(0===e||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");for(var n={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e},r=0;r<16;r++)n.h[r]=l[r];var i=t?t.length:0;return n.h[0]^=16842752^i<<8^e,t&&(m(n,t),n.c=128),n}function m(e,t){for(var n=0;n>2]>>8*(3&n);return t}function y(e,t,n){n=n||64,e=r.normalizeInput(e);var i=d(n,t);return m(i,e),g(i)}function v(e,t,n){var i=y(e,t,n);return r.toHex(i)}e.exports={blake2b:y,blake2bHex:v,blake2bInit:d,blake2bUpdate:m,blake2bFinal:g}},function(e,t,n){var r=n(364);function i(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function o(e,t,n,r,i,o){u[e]=u[e]+u[t]+i,u[r]=s(u[r]^u[e],16),u[n]=u[n]+u[r],u[t]=s(u[t]^u[n],12),u[e]=u[e]+u[t]+o,u[r]=s(u[r]^u[e],8),u[n]=u[n]+u[r],u[t]=s(u[t]^u[n],7)}function s(e,t){return e>>>t^e<<32-t}var a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),l=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]),u=new Uint32Array(16),c=new Uint32Array(16);function h(e,t){var n=0;for(n=0;n<8;n++)u[n]=e.h[n],u[n+8]=a[n];for(u[12]^=e.t,u[13]^=e.t/4294967296,t&&(u[14]=~u[14]),n=0;n<16;n++)c[n]=i(e.b,4*n);for(n=0;n<10;n++)o(0,4,8,12,c[l[16*n+0]],c[l[16*n+1]]),o(1,5,9,13,c[l[16*n+2]],c[l[16*n+3]]),o(2,6,10,14,c[l[16*n+4]],c[l[16*n+5]]),o(3,7,11,15,c[l[16*n+6]],c[l[16*n+7]]),o(0,5,10,15,c[l[16*n+8]],c[l[16*n+9]]),o(1,6,11,12,c[l[16*n+10]],c[l[16*n+11]]),o(2,7,8,13,c[l[16*n+12]],c[l[16*n+13]]),o(3,4,9,14,c[l[16*n+14]],c[l[16*n+15]]);for(n=0;n<8;n++)e.h[n]^=u[n]^u[n+8]}function f(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");var n=t?t.length:0;if(t&&!(n>0&&n<=32))throw new Error("Incorrect key length, should be in [1, 32]");var r={h:new Uint32Array(a),b:new Uint32Array(64),c:0,t:0,outlen:e};return r.h[0]^=16842752^n<<8^e,n>0&&(p(r,t),r.c=64),r}function p(e,t){for(var n=0;n>2]>>8*(3&n)&255;return t}function m(e,t,n){n=n||32,e=r.normalizeInput(e);var i=f(n,t);return p(i,e),d(i)}function g(e,t,n){var i=m(e,t,n);return r.toHex(i)}e.exports={blake2s:m,blake2sHex:g,blake2sInit:f,blake2sUpdate:p,blake2sFinal:d}},function(e,t,n){var r=n(723);function i(e){if(!(e instanceof Object))throw new TypeError('"obj" must be an object (or inherit from it)');return o(e)}function o(e,t){for(var n in t=new r(e,t),e){var i=e[n];if(i instanceof Object&&(t.contains(i)||o(i,t)))return!0}return!1}e.exports=i},function(e,t){function n(e,t){this.value=e,this.next=t}e.exports=n,n.prototype.contains=function(e){for(var t=this;t;){if(t.value===e)return!0;t=t.next}return!1}},function(e,t){var n=e.exports=function(e){return new r(e)};function r(e){this.value=e}function i(e,t,n){var r=[],i=[],a=!0;return function e(l){var u=n?o(l):l,c={},h=!0,f={node:u,node_:l,path:[].concat(r),parent:i[i.length-1],parents:i,key:r.slice(-1)[0],isRoot:0===r.length,level:r.length,circular:null,update:function(e,t){f.isRoot||(f.parent.node[f.key]=e),f.node=e,t&&(h=!1)},delete:function(e){delete f.parent.node[f.key],e&&(h=!1)},remove:function(e){d(f.parent.node)?f.parent.node.splice(f.key,1):delete f.parent.node[f.key],e&&(h=!1)},keys:null,before:function(e){c.before=e},after:function(e){c.after=e},pre:function(e){c.pre=e},post:function(e){c.post=e},stop:function(){a=!1},block:function(){h=!1}};if(!a)return f;function p(){if("object"==typeof f.node&&null!==f.node){f.keys&&f.node_===f.node||(f.keys=s(f.node)),f.isLeaf=0==f.keys.length;for(var e=0;e({exists(t){e.has(s,t)},get(t){e.get(s,(e,n)=>{if(e)return t(e);t(null,parseInt(n.toString().trim(),10))})},set(n,r){e.put(s,t.from(String(n)),r)},check(e,t){this.get((n,r)=>{if(n)return t(n);o("comparing version: %s and %s",r,e);const i=6===r&&7===e||6===e&&7===r;if(r!==e&&!i)return t(new Error(`ipfs repo needs migration: expected version v${e}, found version v${r}`));t()})}}))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(26),i=n(14),o=n(298).asyncFilter,s=n(298).asyncSort,a=n(412),u=n(415);class l{constructor(){this.data={}}open(e){i(e)}put(e,t,n){this.data[e.toString()]=t,i(n)}get(e,t){this.has(e,(n,r)=>n?t(n):r?void t(null,this.data[e.toString()]):t(u.notFoundError()))}has(e,t){i(()=>{t(null,void 0!==this.data[e.toString()])})}delete(e,t){delete this.data[e.toString()],i(()=>{t()})}batch(){let e=[],t=[];return{put(t,n){e.push([t,n])},delete(e){t.push(e)},commit:n=>{e.forEach(e=>{this.data[e[0].toString()]=e[1]}),e=[],t.forEach(e=>{delete this.data[e.toString()]}),t=[],i(n)}}}query(e){let t=[r.keys(this.data),r.map(e=>({key:new a(e),value:this.data[e]}))],n=[];if(null!=e.prefix){const t=e.prefix;n.push((e,n)=>n(null,e.key.toString().startsWith(t)))}if(null!=e.filters&&(n=n.concat(e.filters)),t=t.concat(n.map(e=>o(e))),null!=e.orders&&(t=t.concat(e.orders.map(e=>s(e)))),null!=e.offset){let n=0;t.push(r.filter(()=>n++>=e.offset))}return null!=e.limit&&t.push(r.take(e.limit)),!0===e.keysOnly&&t.push(r.map(e=>({key:e.key}))),r.apply(null,t)}close(e){i(e)}}e.exports=l},function(e,t,n){"use strict";const r=n(33).Key,i=n(171),o=n(11),s=n(411),a=n(812),u=n(0).Buffer,l=new r("config");e.exports=(e=>{const t=i(r,1),n={get(t,n){"function"==typeof t&&(n=t,t=void 0),t||(t=void 0),e.get(l,(e,r)=>{if(e)return n(e);let i;try{i=JSON.parse(r.toString())}catch(e){return n(e)}if(void 0===t)return n(null,i);if("string"!=typeof t)return n(new Error("Key "+t+" must be a string."));const o=s(i,t,null);if(null===o)return n(new Error("Key "+t+" does not exist in config."));n(null,o)})},set(e,n,r){if("function"==typeof n)r=n,n=e,e=void 0;else if(!e||"string"!=typeof e)return r(new Error("Invalid key type"));if(void 0===n||u.isBuffer(n))return r(new Error("Invalid value type"));t.push({key:e,value:n},r)},exists(t){e.has(l,t)}};return n;function r(e,t){const r=e.key,i=e.value;r?o([e=>n.get(e),(e,t)=>{a(e,r,i),t(null,e)},c],t):c(i,t)}function c(t,n){const r=u.from(JSON.stringify(t,null,2));e.put(l,r,n)}})},function(e,t){function n(e,t,n){"string"==typeof t&&(t=t.split(".")),"symbol"==typeof t&&(t=[t]);var r=t.pop(),i;if(!r)return!1;for(;i=t.shift();)if(void 0===e[i]&&(e[i]={}),e=e[i],!e||"object"!=typeof e)return!1;return e[r]=n,!0}e.exports=n},function(e,t,n){"use strict";(function(t){const r=n(33).Key,i=n(814),o=new r("datastore_spec");e.exports=(e=>({exists(t){e.has(o,t)},get(t){e.get(o,(e,n)=>{if(e)return t(e);t(null,JSON.parse(n.toString()))})},set(n,r){e.put(o,t.from(JSON.stringify(i(n,{deep:!0}))),r)}}))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(416);e.exports=((e,t)=>{if(!r(e))throw new TypeError("Expected a plain object");if(t=t||{},"function"==typeof t)throw new TypeError("Specify the compare function as an option instead");const n=t.deep,i=[],o=[],s=e=>{const a=i.indexOf(e);if(-1!==a)return o[a];const u={},l=Object.keys(e).sort(t.compare);i.push(e),o.push(u);for(let t=0;t({get(t){e.get(i,(e,n)=>t(e,n&&n.toString()))},set(n,r){e.put(i,t.from(n.toString()),r)},delete(t){e.delete(i,t)}}))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(417),i=r.ShardingDatastore,o=n(33).Key,s=n(823),a=n(137),u=n(14),l=n(419),c=n(826),f=n(12),h=n(37),p=e=>{const t=new s.Encoder;return new o("/"+t.write(e).finalize(),!1)},d=e=>p(e.buffer);function m(e,t,n){if(t.sharding){const t=new r.shard.NextToLast(2);i.createOrOpen(e,t,n)}else u(()=>n(null,e))}function g(e){return{query(t,n){f(e.query(t),h(n))},get(t,n){if(!c.isCID(t))return u(()=>{n(new Error("Not a valid cid"))});const r=d(t);e.get(r,(i,o)=>{if(i){if("ERR_NOT_FOUND"===i.code){const o=y(t);if(!o)return n(i);const s=d(o);return e.get(s,(i,o)=>{if(i)return n(i);e.put(r,o,e=>{if(e)return n(e);n(null,new a(o,t))})})}return n(i)}n(null,new a(o,t))})},put(t,n){if(!a.isBlock(t))return u(()=>{n(new Error("invalid block"))});const r=d(t.cid);e.has(r,(i,o)=>i?n(i):o?n():void e.put(r,t.data,n))},putMany(t,n){const r=t.map(e=>({key:d(e.cid),block:e})),i=e.batch();l(r,(t,n)=>e.has(t.key,n),(e,t)=>{if(e)return n(e);t.forEach(e=>{i.put(e.key,e.block.data)}),i.commit(n)})},has(t,n){if(!c.isCID(t))return u(()=>{n(new Error("Not a valid cid"))});e.has(d(t),(r,i)=>{if(r)return n(r);if(i)return n(null,!0);const o=y(t);if(!o)return n(null,!1);e.has(d(o),n)})},delete(t,n){if(!c.isCID(t))return u(()=>{n(new Error("Not a valid cid"))});e.delete(d(t),n)},close(t){e.close(t)}}}function y(e){try{return 0===e.version?e.toV1():e.toV0()}catch(e){return null}}e.exports=((e,t,n)=>{m(e,t,(e,t)=>{if(e)return n(e);n(null,g(t))})})},function(e,t,n){"use strict";(function(t){const r=n(11),i=n(54),o=n(33).Key,s=n(418),a=n(228),u=new o(s.SHARDING_FN),l=new o(s.README_FN);class c{constructor(e,t){this.child=new a(e,{convert:this._convertKey.bind(this),invert:this._invertKey.bind(this)}),this.shard=t}open(e){this.child.open(e)}_convertKey(e){const t=e.toString();if(t===u.toString()||t===l.toString())return e;const n=new o(this.shard.fun(t));return n.child(e)}_invertKey(e){const t=e.toString();return t===u.toString()||t===l.toString()?e:o.withNamespaces(e.list().slice(1))}static createOrOpen(e,t,n){c.create(e,t,t=>{if(t&&"datastore exists"!==t.message)return n(t);c.open(e,n)})}static open(e,t){r([t=>s.readShardFun("/",e,t),(t,n)=>{n(null,new c(e,t))}],t)}static create(e,n,r){e.has(u,(o,a)=>{if(o)return r(o);if(!a){const o="function"==typeof e.putRaw?e.putRaw.bind(e):e.put.bind(e);return i([e=>o(u,t.from(n.toString()+"\n"),e),e=>o(l,t.from(s.readme),e)],e=>r(e))}s.readShardFun("/",e,(e,t)=>{if(e)return r(e);const i=(t||"").toString(),o=n.toString();if(i!==o)return r(new Error(`specified fun ${o} does not match repo shard fun ${i}`));r(new Error("datastore exists"))})})}put(e,t,n){this.child.put(e,t,n)}get(e,t){this.child.get(e,t)}has(e,t){this.child.has(e,t)}delete(e,t){this.child.delete(e,t)}batch(){return this.child.batch()}query(e){const t={keysOnly:e.keysOnly,offset:e.offset,limit:e.limit,filters:[(e,t)=>t(null,e.key.toString()!==u.toString()),(e,t)=>t(null,e.key.toString()!==l.toString())]};if(null!=e.prefix&&t.filters.push((t,n)=>{n(null,this._invertKey(t.key).toString().startsWith(e.prefix))}),null!=e.filters){const n=e.filters.map(e=>(t,n)=>{e(Object.assign({},t,{key:this._invertKey(t.key)}),n)});t.filters=t.filters.concat(n)}return null!=e.orders&&(t.orders=e.orders.map(e=>(t,n)=>{t.forEach(e=>{e.key=this._invertKey(e.key)}),e(t,(e,t)=>{if(e)return n(e);t.forEach(e=>{e.key=this._convertKey(e.key)}),n(null,t)})})),this.child.query(t)}close(e){this.child.close(e)}}e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports="This is a repository of IPLD objects. Each IPLD object is in a single file,\nnamed .data. Where is the\n\"base32\" encoding of the CID (as specified in\nhttps://github.com/multiformats/multibase) without the 'B' prefix.\nAll the object files are placed in a tree of directories, based on a\nfunction of the CID. This is a form of sharding similar to\nthe objects directory in git repositories. Previously, we used\nprefixes, we now use the next-to-last two charters.\n func NextToLast(base32cid string) {\n nextToLastLen := 2\n offset := len(base32cid) - nextToLastLen - 1\n return str[offset : offset+nextToLastLen]\n }\nFor example, an object with a base58 CIDv1 of\n zb2rhYSxw4ZjuzgCnWSt19Q94ERaeFhu9uSqRgjSdx9bsgM6f\nhas a base32 CIDv1 of\n BAFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA\nand will be placed at\n SC/AFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA.data\nwith 'SC' being the last-to-next two characters and the 'B' at the\nbeginning of the CIDv1 string is the multibase prefix that is not\nstored in the filename.\n"},function(e,t,n){"use strict";const r=n(56),i=n(820),o=n(26),s=n(33).Key,a=n(33).Errors,u=n(33).utils,l=u.asyncFilter,c=u.asyncSort,f=u.replaceStartWith,h=n(228);class p{constructor(e){this.mounts=e.slice()}open(e){r(this.mounts,(e,t)=>{e.datastore.open(t)},e)}_lookup(e){for(let t of this.mounts)if(t.prefix.toString()===e.toString()||t.prefix.isAncestorOf(e)){const n=f(e.toString(),t.prefix.toString());return{datastore:t.datastore,mountpoint:t.prefix,rest:new s(n)}}}put(e,t,n){const r=this._lookup(e);if(null==r)return n(a.dbWriteFailedError(new Error("No datastore mounted for this key")));r.datastore.put(r.rest,t,n)}get(e,t){const n=this._lookup(e);if(null==n)return t(a.notFoundError(new Error("No datastore mounted for this key")));n.datastore.get(n.rest,t)}has(e,t){const n=this._lookup(e);null!=n?n.datastore.has(n.rest,t):t(null,!1)}delete(e,t){const n=this._lookup(e);if(null==n)return t(a.dbDeleteFailedError(new Error("No datastore mounted for this key")));n.datastore.delete(n.rest,t)}close(e){r(this.mounts,(e,t)=>{e.datastore.close(t)},e)}batch(){const e={},t=t=>{const n=this._lookup(t);if(null==n)throw new Error("No datastore mounted for this key");const r=n.mountpoint.toString();return null==e[r]&&(e[r]=n.datastore.batch()),{batch:e[r],rest:n.rest}};return{put:(e,n)=>{const r=t(e);r.batch.put(r.rest,n)},delete:e=>{const n=t(e);n.batch.delete(n.rest)},commit:t=>{r(Object.keys(e),(t,n)=>{e[t].commit(n)},t)}}}query(e){const t=this.mounts.map(t=>{const n=new h(t.datastore,{convert:e=>{throw new Error("should never be called")},invert:e=>t.prefix.child(e)});let r;return null!=e.prefix&&(r=f(e.prefix,t.prefix.toString())),n.query({prefix:r,filters:e.filters,keysOnly:e.keysOnly})});let n=[i(t)];if(null!=e.filters&&(n=n.concat(e.filters.map(e=>l(e)))),null!=e.orders&&(n=n.concat(e.orders.map(e=>c(e)))),null!=e.offset){let t=0;n.push(o.filter(()=>t++>=e.offset))}return null!=e.limit&&n.push(o.take(e.limit)),o.apply(null,n)}}e.exports=p},function(e,t){e.exports=function(e){var t=!!e,n=(e||[]).map(s),r=0,i,o;function s(e){return{ready:!1,reading:!1,ended:!1,read:e,data:null}}function a(){if(o){u();var e=n.length,s=o;if(0===e&&(i||t))return o=null,void s(i||!0);for(var a=0;an.length)throw new Error("this should never happen");if(!(t.reading||t.ended||t.ready)){t.reading=!0;var r=!0;t.read(i,function e(n,o){t.data=o,t.ready=!0,t.reading=!1,!0===n||i?t.ended=!0:n&&(i=t.ended=n),i&&!n&&t.read(i,e),r||a()}),r=!1}}(n[e]);a()}function c(e,t){i=i||e,o=t,l()}return c.add=function(e){if(!e)return t=!0,l();n.push(s(e)),l()},c.cap=function(e){c.add(null)},c}},function(e,t,n){"use strict";const r=n(56),i=n(229),o=n(33).Errors;class s{constructor(e){this.stores=e.slice()}open(e){r(this.stores,(e,t)=>{e.open(t)},t=>{if(t)return e(o.dbOpenFailedError());e()})}put(e,t,n){r(this.stores,(n,r)=>{n.put(e,t,r)},e=>{if(e)return n(o.dbWriteFailedError());n()})}get(e,t){const n=this.stores.length;let r=!1,s=0;i(()=>!r&&s{const n=this.stores[s++];n.get(e,(e,n)=>{if(null==e)return r=!0,t(null,n);t()})},(e,n)=>{if(e||!n)return t(o.notFoundError());t(null,n)})}has(e,t){const n=this.stores.length;let r=!1,o=0;i(()=>!r&&o{const n=this.stores[o++];n.has(e,(e,n)=>{if(null==e)return r=!0,t(null,n);t()})},t)}delete(e,t){r(this.stores,(t,n)=>{t.delete(e,n)},e=>{if(e)return t(o.dbDeleteFailedError());t()})}close(e){r(this.stores,(e,t)=>{e.close(t)},e)}batch(){const e=this.stores.map(e=>e.batch());return{put:(t,n)=>{e.forEach(e=>e.put(t,n))},delete:t=>{e.forEach(e=>e.delete(t))},commit:t=>{r(e,(e,t)=>{e.commit(t)},t)}}}query(e){return this.stores[this.stores.length-1].query(e)}}e.exports=s},function(e,t,n){"use strict";const r=n(33).Key,i=n(228);class o extends i{constructor(e,t){super(e,{convert:e=>t.child(e),invert(e){if("/"===t.toString())return e;if(!t.isAncestorOf(e))throw new Error(`Expected prefix: (${t.toString()}) in key: ${e.toString()}`);return new r(e.toString().slice(t.toString().length),!1)}}),this.prefix=t}query(e){return e.prefix&&"/"!==this.prefix.toString()?super.query(Object.assign({},e,{prefix:this.prefix.child(new r(e.prefix)).toString()})):super.query(e)}}e.exports=o},function(e,t,n){"use strict";var r=function(e,t){return t||(t={}),e.split("").forEach(function(e,n){e in t||(t[e]=n)}),t},i={alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",charmap:{0:14,1:8}};i.charmap=r(i.alphabet,i.charmap);var o={alphabet:"0123456789ABCDEFGHJKMNPQRSTVWXYZ",charmap:{O:0,I:1,L:1}};o.charmap=r(o.alphabet,o.charmap);var s={alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",charmap:{}};function a(e){if(this.buf=[],this.shift=8,this.carry=0,e){switch(e.type){case"rfc4648":this.charmap=t.rfc4648.charmap;break;case"crockford":this.charmap=t.crockford.charmap;break;case"base32hex":this.charmap=t.base32hex.charmap;break;default:throw new Error("invalid type")}e.charmap&&(this.charmap=e.charmap)}}function u(e){if(this.buf="",this.shift=3,this.carry=0,e){switch(e.type){case"rfc4648":this.alphabet=t.rfc4648.alphabet;break;case"crockford":this.alphabet=t.crockford.alphabet;break;case"base32hex":this.alphabet=t.base32hex.alphabet;break;default:throw new Error("invalid type")}e.alphabet?this.alphabet=e.alphabet:e.lc&&(this.alphabet=this.alphabet.toLowerCase())}}s.charmap=r(s.alphabet,s.charmap),a.prototype.charmap=i.charmap,a.prototype.write=function(e){var t=this.charmap,n=this.buf,r=this.shift,i=this.carry;return e.toUpperCase().split("").forEach(function(e){if("="!=e){var o=255&t[e];r-=5,r>0?i|=o<>-r),r+=8,i=o<>t,this.buf+=this.alphabet[31&r],t>5&&(t-=5,r=i>>t,this.buf+=this.alphabet[31&r]),t=5-t,n=i<i&&(l=i),u>i&&(u=i),c=a,h=l;;)if(c"!==e[0])throw new Error("Unexpected token in map type: "+e[0]);e.shift(),t.name=e.shift();break;case"repeated":case"required":case"optional":var n=e.shift();t.required="required"===n,t.repeated="repeated"===n,t.type=e.shift(),t.name=e.shift();break;case"[":t.options=s(e);break;case";":if(null===t.name)throw new Error("Missing field name");if(null===t.type)throw new Error("Missing type in message field: "+t.name);if(-1===t.tag)throw new Error("Missing tag number in message field: "+t.name);return e.shift(),t;default:throw new Error("Unexpected token in message field: "+e[0])}throw new Error("No ; found for message field")},l=function(e){for(var t={enums:[],messages:[],fields:[],extends:[],extensions:null};e.length;)switch(e[0]){case"map":case"repeated":case"optional":case"required":t.fields.push(a(e));break;case"enum":t.enums.push(m(e));break;case"message":t.messages.push(h(e));break;case"extensions":t.extensions=c(e);break;case"oneof":e.shift();var n=e.shift();if("{"!==e[0])throw new Error("Unexpected token in oneof: "+e[0]);for(e.shift();"}"!==e[0];){e.unshift("optional");var r=a(e);r.oneof=n,t.fields.push(r)}e.shift();break;case"extend":t.extends.push(u(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},u=function(e){var t={name:e[1],message:h(e)};return t},c=function(e){e.shift();var t=Number(e.shift());if(isNaN(t))throw new Error("Invalid from in extensions definition");if("to"!==e.shift())throw new Error("Expected keyword 'to' in extensions definition");var n=e.shift();if("max"===n&&(n=536870911),n=Number(n),isNaN(n))throw new Error("Invalid to in extensions definition");if(";"!==e.shift())throw new Error("Missing ; in extensions definition");return{from:t,to:n}},h=function(e){e.shift();var t=1,n=[],r={name:e.shift(),enums:[],extends:[],messages:[],fields:[]};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("{"===e[0]?t++:"}"===e[0]&&t--,!t)return e.shift(),n=l(n),r.enums=n.enums,r.messages=n.messages,r.fields=n.fields,r.extends=n.extends,r.extensions=n.extensions,r;n.push(e.shift())}if(t)throw new Error("No closing tag for message")},f=function(e){e.shift();var t=e.shift();if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},p=function(e){if(e.shift(),"="!==e[0])throw new Error("Expected = but found "+e[0]);e.shift();var t=e.shift();switch(t){case'"proto2"':t=2;break;case'"proto3"':t=3;break;default:throw new Error("Expected protobuf syntax version but found "+t)}if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},d=function(e){if(e.length<4)throw new Error("Invalid enum value: "+e.slice(0,3).join(" "));if("="!==e[1])throw new Error("Expected = but found "+e[1]);if(";"!==e[3]&&"["!==e[3])throw new Error("Expected ; or [ but found "+e[1]);var t=e.shift();e.shift();var n={value:null,options:{}};return n.value=Number(e.shift()),"["===e[0]&&(n.options=s(e)),e.shift(),{name:t,val:n}},m=function(e){e.shift();var t={},n={name:e.shift(),values:{},options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),n;if("option"!==e[0]){var r=d(e);n.values[r.name]=r.val}else t=g(e),n.options[t.name]=t.value}throw new Error("No closing tag for enum")},g=function(e){for(var t=null,n=null,r=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")};e.length;){if(";"===e[0])return e.shift(),{name:t,value:n};switch(e[0]){case"option":e.shift();var i="("===e[0];if(i&&e.shift(),t=e.shift(),i){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}"."===e[0][0]&&(t+=e.shift());break;case"=":if(e.shift(),null===t)throw new Error("Expected key for option with value: "+e[0]);if(n=r(e.shift()),"optimize_for"===t&&!/^(SPEED|CODE_SIZE|LITE_RUNTIME)$/.test(n))throw new Error("Unexpected value for option optimize_for: "+n);"{"===n&&(n=y(e));break;default:throw new Error("Unexpected token in option: "+e[0])}}},y=function(e){for(var t=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")},n={};e.length;){if("}"===e[0])return e.shift(),n;var r="("===e[0];r&&e.shift();var i=e.shift();if(r){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}var o=null;switch(e[0]){case":":if(void 0!==n[i])throw new Error("Duplicate option map key "+i);e.shift(),o=t(e.shift()),"{"===o&&(o=y(e)),n[i]=o,";"===e[0]&&e.shift();break;case"{":if(e.shift(),o=y(e),void 0===n[i]&&(n[i]=[]),!Array.isArray(n[i]))throw new Error("Duplicate option map key "+i);n[i].push(o);break;default:throw new Error("Unexpected token in option map: "+e[0])}}throw new Error("No closing tag for option map")},v=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},b=function(e){e.shift();var t={name:e.shift(),methods:[],options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;switch(e[0]){case"option":var n=g(e);if(void 0!==t.options[n.name])throw new Error("Duplicate option "+n.name);t.options[n.name]=n.value;break;case"rpc":t.methods.push(_(e));break;default:throw new Error("Unexpected token in service: "+e[0])}}throw new Error("No closing tag for service")},_=function(e){e.shift();var t={name:e.shift(),input_type:null,output_type:null,client_streaming:!1,server_streaming:!1,options:{}};if("("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.client_streaming=!0),t.input_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),"returns"!==e[0])throw new Error("Expected returns but found "+e[0]);if(e.shift(),"("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.server_streaming=!0),t.output_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),";"===e[0])return e.shift(),t;if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;if("option"!==e[0])throw new Error("Unexpected token in rpc options: "+e[0]);var n=g(e);if(void 0!==t.options[n.name])throw new Error("Duplicate option "+n.name);t.options[n.name]=n.value}throw new Error("No closing tag for rpc")},w=function(e){for(var t=r(e.toString()),n=0;nt.extensions.to)throw new Error(t.name+" does not declare "+e.tag+" as an extension number");t.fields.push(e)})})}),s.messages.forEach(function(e){e.fields.forEach(function(t){var n,r,i,a;function l(e){return e.name===t.type}function u(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(l))return}else{if(n=t.type.split("."),n.length>2)throw new Error("what is this?");if(r=n[0],i=n[1],s.messages.some(function(e){if(e.name===r)return a=e,e}),a&&a.enums&&a.enums.some(u))return}throw new Error("Fields of type "+t.type+' cannot be declared [packed=true]. Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire types) can be declared "packed". See https://developers.google.com/protocol-buffers/docs/encoding#optional')}})}),s};e.exports=w},function(e,t){e.exports=function(e){var t=function(e){var t=e.indexOf("//");return t>-1?e.slice(0,t):e},n=function(){var e=!1;return function(t){return"/*"===t?(e=!0,!1):"*/"===t?(e=!1,!1):!e}},r=function(e){return e.trim()};return e.replace(/([;,{}()=:[\]<>]|\/\*|\*\/)/g," $1 ").split(/\n/).map(r).filter(Boolean).map(t).map(r).filter(Boolean).join("\n").split(/\s+|\n+/gm).filter(n())}},function(e,t){var n=function(e,t){var n=e.repeated?"repeated":e.required?"required":"optional";"map"===e.type&&(n="map<"+e.map.from+","+e.map.to+">"),e.oneof&&(n="");var r=Object.keys(e.options||{}).map(function(t){return t+" = "+e.options[t]}).join(",");return r&&(r=" ["+r+"]"),t.push((n?n+" ":"")+("map"===e.map?"":e.type+" ")+e.name+" = "+e.tag+r+";"),t},r=function(e,t){t.push("message "+e.name+" {"),e.enums||(e.enums=[]),e.enums.forEach(function(e){t.push(i(e,[]))}),e.messages||(e.messages=[]),e.messages.forEach(function(e){t.push(r(e,[]))});var o={};return e.fields||(e.fields=[]),e.fields.forEach(function(e){e.oneof?(o[e.oneof]||(o[e.oneof]=[]),o[e.oneof].push(n(e,[]))):t.push(n(e,[]))}),Object.keys(o).forEach(function(e){o[e].unshift("oneof "+e+" {"),o[e].push("}"),t.push(o[e])}),t.push("}",""),t},i=function(e,t){t.push("enum "+e.name+" {"),e.options||(e.options={});var n=s(e.options,[]);return n.length>1&&t.push(n.slice(0,-1)),Object.keys(e.values).map(function(n){var r=o(e.values[n]);t.push([n+" = "+r+";"])}),t.push("}",""),t},o=function(e,t){var n=Object.keys(e.options||{}).map(function(t){return t+" = "+e.options[t]}).join(",");n&&(n=" ["+n+"]");var r=e.value+n;return r},s=function(e,t){var n=Object.keys(e);return n.forEach(function(n){var r=e[n];~n.indexOf(".")&&(n="("+n+")");var i=typeof r;"object"===i?(r=a(r,[]),r.length&&t.push("option "+n+" = {",r,"};")):("string"===i&&"optimize_for"!==n&&(r='"'+r+'"'),t.push("option "+n+" = "+r+";"))}),n.length>0&&t.push(""),t},a=function(e,t){var n=Object.keys(e);return n.forEach(function(n){var r=e[n],i=typeof r;"object"===i?Array.isArray(r)?r.forEach(function(e){e=a(e,[]),e.length&&t.push(n+" {",e,"}")}):(r=a(r,[]),r.length&&t.push(n+" {",r,"}")):("string"===i&&(r='"'+r+'"'),t.push(n+": "+r))}),t},l=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(u(e,[]))}),t.push("}",""),t},u=function(e,t){var n="rpc "+e.name+"(";e.client_streaming&&(n+="stream "),n+=e.input_type+") returns (",e.server_streaming&&(n+="stream "),n+=e.output_type+")",e.options||(e.options={});var r=s(e.options,[]);return r.length>1?t.push(n+" {",r.slice(0,-1),"}"):t.push(n+";"),t},c=function(e){return function(t){return Array.isArray(t)?t.map(c(e+" ")).join("\n"):e+t}};e.exports=function(e){var t=[];return t.push('syntax = "proto'+e.syntax+'";',""),e.package&&t.push("package "+e.package+";",""),e.options||(e.options={}),s(e.options,t),e.enums||(e.enums=[]),e.enums.forEach(function(e){i(e,t)}),e.messages||(e.messages=[]),e.messages.forEach(function(e){r(e,t)}),e.services&&e.services.forEach(function(e){l(e,t)}),t.map(c("")).join("\n")}},function(e,t,n){"use strict";var r=n(734),i=n(736),o=n(737),s=n(738),a=n(35),l=function(e){if(!e)return null;var t={};return Object.keys(e).forEach(function(n){t[n]=e[n].value}),t};e.exports=function(e,t){var n={},u={},c={},h=function(e,t){e.enums&&e.enums.forEach(function(e){e.id=t+(t?".":"")+e.name,u[e.id]=e,h(e,e.id)}),e.messages&&e.messages.forEach(function(r){r.id=t+(t?".":"")+r.name,n[r.id]=r,r.fields.forEach(function(r){if(r.map){var i="Map_"+r.map.from+"_"+r.map.to,o={name:i,enums:[],messages:[],fields:[{name:"key",type:r.map.from,tag:1,repeated:!1,required:!0},{name:"value",type:r.map.to,tag:2,repeated:!1,required:!1}],extensions:null,id:t+(t?".":"")+i};n[o.id]||(n[o.id]=o,e.messages.push(o)),r.type=i,r.repeated=!0}}),h(r,r.id)})};h(e,"");var f=function(e){var t=Object.keys(e.values||[]).map(function(t){return parseInt(e.values[t].value,10)}),n=function e(n,r,i){if(!t.length||-1===t.indexOf(n))throw new Error("Invalid enum value: "+n);return a.encode(n,r,i),e.bytes=a.encode.bytes,r},i=function e(n,r){var i=a.decode(n,r);if(!t.length||-1===t.indexOf(i))throw new Error("Invalid enum value: "+i);return e.bytes=a.decode.bytes,i};return r.make(0,n,i,a.encodingLength)},p=function(e,t){e.messages.forEach(function(n){t[n.name]=d(n.name,e.id)}),e.enums.forEach(function(e){t[e.name]=l(e.values)}),t.type=2,t.message=!0,t.name=e.name;var n={};e.fields.forEach(function(e){e.oneof&&(n[e.oneof]||(n[e.oneof]=[]),n[e.oneof].push(e.name))});var r=e.fields.map(function(t){return d(t.type,e.id)}),a=s(e,r,n),u=o(e,d,r,n,a),c=i(e,d,r);return u.bytes=c.bytes=0,t.buffer=!0,t.encode=u,t.decode=c,t.encodingLength=a,t},d=function(e,i,o){if(t&&t[e])return t[e];if(r[e])return r[e];var s=(i?i+"."+e:e).split(".").map(function(t,n,r){return r.slice(0,n).concat(e).join(".")}).reverse().reduce(function(e,t){return e||n[t]||u[t]},null);if(!1===o)return s;if(!s)throw new Error("Could not resolve "+e);if(s.values)return f(s);var a=c[s.id]||p(s,c[s.id]={});return a};return(e.enums||[]).concat((e.messages||[]).map(function(e){return d(e.id)}))}},function(e,t,n){"use strict";var r=n(35),i=n(735),o=n(5).Buffer,s=function(e,t,n,r){return t.bytes=n.bytes=0,{type:e,encode:t,decode:n,encodingLength:r}},a,l,u,c,h;t.make=s,t.bytes=(l=function(e){return o.isBuffer(e)?e.length:o.byteLength(e)},u=function(e){var t=l(e);return r.encodingLength(t)+t},c=function(e,t,n){var i=n,s=l(e);return r.encode(s,t,n),n+=r.encode.bytes,o.isBuffer(e)?e.copy(t,n):t.write(e,n,s),n+=s,c.bytes=n-i,t},h=function(e,t){var n=t,i=r.decode(e,t);t+=r.decode.bytes;var o=e.slice(t,t+i);return t+=o.length,h.bytes=t-n,o},s(2,c,h,u)),t.string=function(){var e=function(e){var t=o.byteLength(e);return r.encodingLength(t)+t},t=function(e,n,i){var s=i,a=o.byteLength(e);return r.encode(a,n,i,"utf-8"),i+=r.encode.bytes,n.write(e,i,a),i+=a,t.bytes=i-s,n},n=function(e,t){var i=t,o=r.decode(e,t);t+=r.decode.bytes;var s=e.toString("utf-8",t,t+o);return t+=o,n.bytes=t-i,s};return s(2,t,n,e)}(),t.bool=function(){var e=function(e){return 1},t=function(e,n,r){return n[r]=e?1:0,t.bytes=1,n},n=function(e,t){var r=e[t]>0;return n.bytes=1,r};return s(0,t,n,e)}(),t.int32=function(){var e=function(t,n){var i=r.decode(t,n);return e.bytes=r.decode.bytes,i>2147483647?i-4294967296:i},t=function(e,n,i){return r.encode(e<0?e+4294967296:e,n,i),t.bytes=r.encode.bytes,n},n=function(e){return r.encodingLength(e<0?e+4294967296:e)};return s(0,r.encode,e,n)}(),t.int64=function(){var e=function(t,n){var i=r.decode(t,n);if(i>=Math.pow(2,63)){for(var s=9;255===t[n+s-1];)s--;s=s||9;var a=o.allocUnsafe(s);t.copy(a,0,n,n+s),a[s-1]=127&a[s-1],i=-1*r.decode(a,0),e.bytes=10}else e.bytes=r.decode.bytes;return i},t=function(e,n,i){if(e<0){var o=i+9;for(r.encode(-1*e,n,i),i+=r.encode.bytes-1,n[i]=128|n[i];i=0?2*t:-2*t-1;var o=r.encode(t,n,i);return e.bytes=r.encode.bytes,o},t.decode=function e(t,n){var i=r.decode(t,n);return e.bytes=r.decode.bytes,1&i?(i+1)/-2:i/2},t.encodingLength=function(e){return r.encodingLength(e>=0?2*e:-2*e-1)}},function(e,t,n){"use strict";var r=n(35),i=n(248).defined;function o(e,t,n){for(var o=[],l={},u=[],c=[],h=0;h-1&&delete n[l[c]];if(e.message){var h=r.decode(i,o);o+=r.decode.bytes;var f=e.decode(i,o,o+h);t.map?(n[a]=n[a]||{},n[a][f.key]=f.value):t.repeated?(n[a]=n[a]||[],n[a].push(f)):n[a]=f}else t.repeated?(n[a]=n[a]||[],n[a].push(e.decode(i,o))):n[a]=e.decode(i,o);return o+=e.decode.bytes,o}return function t(h,f,p){if(null==f&&(f=0),null==p&&(p=h.length),!(p<=h.length&&f<=h.length))throw new Error("Decoded message is not valid");for(var d=f,g={},y;;){if(p<=f){var v="",b=0,_,w;for(b=0;b-1){k=!0;break}k||(_?y.repeated?g[v]=[]:(w=w&&_[w]?_[w].value:_[Object.keys(_)[0]].value,g[v]=parseInt(w||0,10)):g[v]=a(y,w))}return t.bytes=f-d,g}var x=r.decode(h,f);f+=r.decode.bytes;var C=x>>3,A=l[C];if(null!=A){var T=n[A];if(y=e.fields[A],y.packed){var I=r.decode(h,f);for(f+=r.decode.bytes,I+=f;f-1){if(v)throw new Error("only one of the properties defined in oneof "+b+" can be set");v=!0}}for(y=0;y{if(e)return n(e);r.push(t),u(s,r,n)})}e.exports=h},function(e,t,n){"use strict";(function(t){const r=n(195),i=r.cloneLinks,o=r.cloneData,s=n(193),a=n(9);function l(e,n,r){const l=o(e);let u=i(e);if("string"==typeof n)u=u.filter(e=>e.name!==n);else{if(!t.isBuffer(n)&&!a.isCID(n))return r(new Error("second arg needs to be a name or CID"),null);u=u.filter(e=>!e.cid.equals(n))}s(l,u,r)}e.exports=l}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var n={};e.exports=n;var r={};function i(e,t){var n=0,r=t.length,i=t.charAt(0),o=[0];for(n=0;n0;)o.push(a%r),a=a/r|0}var l="";for(n=0;0===e.at(n)&&n=0;--n)l+=t[o[n]];return l}n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var r="";if(e instanceof Uint8Array){var o=0,s=t.length,a=t.charAt(0),l=[0];for(o=0;o0;)l.push(c%s),c=c/s|0}for(o=0;0===e[o]&&o=0;--o)r+=t[l[o]]}else r=i(e,t);if(n){var h=new RegExp(".{1,"+n+"}","g");r=r.match(h).join("\r\n")}return r},n.decode=function(e,n){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof n)throw new TypeError('"alphabet" must be a string.');var i=r[n];if(!i){i=r[n]=[];for(var o=0;o>=8;for(;h>0;)l.push(255&h),h>>=8}for(var f=0;e[f]===a&&f>24&255,s>>16&255,s>>8&255,255&s);n.start(),n.update(e+a),i+=n.digest().getBytes()}return i.substring(0,t)}i.encode_rsa_oaep=function(e,t,n){var i,s,a,l;"string"==typeof n?(i=n,s=arguments[3]||void 0,a=arguments[4]||void 0):n&&(i=n.label||void 0,s=n.seed||void 0,a=n.md||void 0,n.mgf1&&n.mgf1.md&&(l=n.mgf1.md)),a?a.start():a=r.md.sha1.create(),l||(l=a);var u=Math.ceil(e.n.bitLength()/8),c=u-2*a.digestLength-2;if(t.length>c){var h=new Error("RSAES-OAEP input message length is too long.");throw h.length=t.length,h.maxLength=c,h}i||(i=""),a.update(i,"raw");for(var f=a.digest(),p="",d=c-t.length,m=0;m>>0,a>>>0];for(var l=i.fullMessageLength.length-1;l>=0;--l)i.fullMessageLength[l]+=a[1],a[1]=a[0]+(i.fullMessageLength[l]/4294967296>>>0),i.fullMessageLength[l]=i.fullMessageLength[l]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(o),u(e,n,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=r.util.createBuffer();s.putBytes(t.bytes());var a=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,l=a&i.blockLength-1,c,h;s.putBytes(o.substr(0,i.blockLength-l));for(var f=8*i.fullMessageLength[0],p=0;p>>0,f+=h,s.putInt32(f>>>0),f=c>>>0;s.putInt32(f);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};u(d,n,s);var m=r.util.createBuffer();return m.putInt32(d.h0),m.putInt32(d.h1),m.putInt32(d.h2),m.putInt32(d.h3),m.putInt32(d.h4),m.putInt32(d.h5),m.putInt32(d.h6),m.putInt32(d.h7),m},i};var o=null,s=!1,a=null;function l(){o=String.fromCharCode(128),o+=r.util.fillString(String.fromCharCode(0),64),a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=!0}function u(e,t,n){for(var r,i,o,s,l,u,c,h,f,p,d,m,g,y,v,b=n.length();b>=64;){for(c=0;c<16;++c)t[c]=n.getInt32();for(;c<64;++c)r=t[c-2],r=(r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10,i=t[c-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[c]=r+t[c-7]+i+t[c-16]|0;for(h=e.h0,f=e.h1,p=e.h2,d=e.h3,m=e.h4,g=e.h5,y=e.h6,v=e.h7,c=0;c<64;++c)s=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7),l=y^m&(g^y),o=(h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),u=h&f|p&(h^f),r=v+s+l+a[c]+t[c],i=o+u,v=y,y=g,g=m,m=d+r>>>0,d=p,p=f,f=h,h=r+i>>>0;e.h0=e.h0+h|0,e.h1=e.h1+f|0,e.h2=e.h2+p|0,e.h3=e.h3+d|0,e.h4=e.h4+m|0,e.h5=e.h5+g|0,e.h6=e.h6+y|0,e.h7=e.h7+v|0,b-=64}}},function(e,t,n){(function(t){var r=n(21);n(30);var i=null;!r.util.isNodejs||r.options.usePureJavaScript||t.versions["node-webkit"]||(i=n(372));var o=e.exports=r.prng=r.prng||{};o.create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},n=e.md,o=new Array(32),s=0;s<32;++s)o[s]=n.create();function a(e){if(t.pools[0].messageLength>=32)return u(),e();var n=32-t.pools[0].messageLength<<5;t.seedFile(n,function(n,r){if(n)return e(n);t.collect(r),u(),e()})}function l(){if(t.pools[0].messageLength>=32)return u();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),u()}function u(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var n=1,r=0;r<32;++r)t.reseeds%n==0&&(e.update(t.pools[r].digest().getBytes()),t.pools[r].start()),n<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function c(e){var t=null;if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;n&&n.getRandomValues&&(t=function(e){return n.getRandomValues(e)})}var i=r.util.createBuffer();if(t)for(;i.length()>16),u+=(32767&l)<<16,u+=l>>15,u=(2147483647&u)+(u>>31),h=4294967295&u;for(var a=0;a<3;++a)c=h>>>(a<<3),c^=Math.floor(256*Math.random()),i.putByte(String.fromCharCode(255&c))}return i.getBytes(e)}return t.pools=o,t.pool=0,t.generate=function(e,n){if(!n)return t.generateSync(e);var i=t.plugin.cipher,o=t.plugin.increment,s=t.plugin.formatKey,l=t.plugin.formatSeed,u=r.util.createBuffer();function c(h){if(h)return n(h);if(u.length()>=e)return n(null,u.getBytes(e));if(t.generated>1048575&&(t.key=null),null===t.key)return r.util.nextTick(function(){a(c)});var f=i(t.key,t.seed);t.generated+=f.length,u.putBytes(f),t.key=s(i(t.key,o(t.seed))),t.seed=l(i(t.key,t.seed)),r.util.setImmediate(c)}t.key=null,c()},t.generateSync=function(e){var n=t.plugin.cipher,i=t.plugin.increment,o=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var a=r.util.createBuffer();a.length()1048575&&(t.key=null),null===t.key&&l();var u=n(t.key,t.seed);t.generated+=u.length,a.putBytes(u),t.key=o(n(t.key,i(t.seed))),t.seed=s(n(t.key,t.seed))}return a.getBytes(e)},i?(t.seedFile=function(e,t){i.randomBytes(e,function(e,n){if(e)return t(e);t(null,n.toString())})},t.seedFileSync=function(e){return i.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,c(e))}catch(e){t(e)}},t.seedFileSync=c),t.collect=function(e){for(var n=e.length,r=0;r>i&255);t.collect(r)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){function n(e){var r=e.data;r.forge&&r.forge.prng&&(self.removeEventListener("message",n),t(r.forge.prng.err,r.forge.prng.bytes))}self.addEventListener("message",n),self.postMessage({forge:{prng:{needed:e}}})};else{var n=function(n){var r=n.data;r.forge&&r.forge.prng&&t.seedFile(r.forge.prng.needed,function(t,n){e.postMessage({forge:{prng:{err:t,bytes:n}}})})};e.addEventListener("message",n)}},t}}).call(this,n(3))},function(e,t,n){var r=n(21);n(97),n(30);var i=e.exports=r.sha1=r.sha1||{};r.md.sha1=r.md.algorithms.sha1=i,i.create=function(){s||a();var e=null,t=r.util.createBuffer(),n=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var n=i.messageLengthSize/4,o=0;o>>0,a>>>0];for(var u=i.fullMessageLength.length-1;u>=0;--u)i.fullMessageLength[u]+=a[1],a[1]=a[0]+(i.fullMessageLength[u]/4294967296>>>0),i.fullMessageLength[u]=i.fullMessageLength[u]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(o),l(e,n,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=r.util.createBuffer();s.putBytes(t.bytes());var a=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,u=a&i.blockLength-1,c,h;s.putBytes(o.substr(0,i.blockLength-u));for(var f=8*i.fullMessageLength[0],p=0;p>>0,f+=h,s.putInt32(f>>>0),f=c>>>0;s.putInt32(f);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};l(d,n,s);var m=r.util.createBuffer();return m.putInt32(d.h0),m.putInt32(d.h1),m.putInt32(d.h2),m.putInt32(d.h3),m.putInt32(d.h4),m},i};var o=null,s=!1;function a(){o=String.fromCharCode(128),o+=r.util.fillString(String.fromCharCode(0),64),s=!0}function l(e,t,n){for(var r,i,o,s,a,l,u,c,h=n.length();h>=64;){for(i=e.h0,o=e.h1,s=e.h2,a=e.h3,l=e.h4,c=0;c<16;++c)r=n.getInt32(),t[c]=r,u=a^o&(s^a),r=(i<<5|i>>>27)+u+l+1518500249+r,l=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<20;++c)r=t[c-3]^t[c-8]^t[c-14]^t[c-16],r=r<<1|r>>>31,t[c]=r,u=a^o&(s^a),r=(i<<5|i>>>27)+u+l+1518500249+r,l=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<32;++c)r=t[c-3]^t[c-8]^t[c-14]^t[c-16],r=r<<1|r>>>31,t[c]=r,u=o^s^a,r=(i<<5|i>>>27)+u+l+1859775393+r,l=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<40;++c)r=t[c-6]^t[c-16]^t[c-28]^t[c-32],r=r<<2|r>>>30,t[c]=r,u=o^s^a,r=(i<<5|i>>>27)+u+l+1859775393+r,l=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<60;++c)r=t[c-6]^t[c-16]^t[c-28]^t[c-32],r=r<<2|r>>>30,t[c]=r,u=o&s|a&(o^s),r=(i<<5|i>>>27)+u+l+2400959708+r,l=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<80;++c)r=t[c-6]^t[c-16]^t[c-28]^t[c-32],r=r<<2|r>>>30,t[c]=r,u=o^s^a,r=(i<<5|i>>>27)+u+l+3395469782+r,l=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+s|0,e.h3=e.h3+a|0,e.h4=e.h4+l|0,h-=64}}},function(e,t,n){var r=n(21);n(30),n(369),n(118),function(){if(r.prime)e.exports=r.prime;else{var t=e.exports=r.prime=r.prime||{},n=r.jsbn.BigInteger,i=[6,4,2,4,2,4,6,2],o=new n(null);o.fromInt(30);var s=function(e,t){return e|t};t.generateProbablePrime=function(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};var i=t.algorithm||"PRIMEINC";"string"==typeof i&&(i={name:i}),i.options=i.options||{};var o=t.prng||r.random,s={nextBytes:function(e){for(var t=o.getBytesSync(e.length),n=0;nt&&(e=h(t,n)),e.isProbablePrime(s))return l(null,e);e.dAddOffset(i[o++%8],0)}while(a<0||+new Date-ce&&(s=h(e,t));var d=s.toString(16);i.target.postMessage({hex:d,workLoad:u}),s.dAddOffset(c,0)}}}p()}function h(e,t){var r=new n(e,t),i=e-1;return r.testBit(i)||r.bitwiseTo(n.ONE.shiftLeft(i),s,r),r.dAddOffset(31-r.mod(o).byteValue(),0),r}function f(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}}()},function(e,t,n){var r=n(21);n(97),n(30);var i=e.exports=r.hmac=r.hmac||{};i.create=function(){var e=null,t=null,n=null,i=null,o={start:function(o,s){if(null!==o)if("string"==typeof o){if(o=o.toLowerCase(),!(o in r.md.algorithms))throw new Error('Unknown hash algorithm "'+o+'"');t=r.md.algorithms[o].create()}else t=o;if(null===s)s=e;else{if("string"==typeof s)s=r.util.createBuffer(s);else if(r.util.isArray(s)){var a=s;s=r.util.createBuffer();for(var l=0;lt.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),n=r.util.createBuffer(),i=r.util.createBuffer(),u=s.length();for(var l=0;l>16-t},a=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=r.rc2=r.rc2||{},r.rc2.expandKey=function(e,t){"string"==typeof e&&(e=r.util.createBuffer(e)),t=t||128;var n=e,o=e.length(),s=t,a=Math.ceil(s/8),l=255>>(7&s),u;for(u=o;u<128;u++)n.putByte(i[n.at(u-1)+n.at(u-o)&255]);for(n.setAt(128-a,i[n.at(128-a)&l]),u=127-a;u>=0;u--)n.setAt(u,i[n.at(u+1)^n.at(u+a)]);return n};var l=function(e,t,n){var i=!1,l=null,u=null,c=null,h,f,p,d,m=[];for(e=r.rc2.expandKey(e,t),p=0;p<64;p++)m.push(e.getInt16Le());n?(h=function(e){for(p=0;p<4;p++)e[p]+=m[d]+(e[(p+3)%4]&e[(p+2)%4])+(~e[(p+3)%4]&e[(p+1)%4]),e[p]=s(e[p],o[p]),d++},f=function(e){for(p=0;p<4;p++)e[p]+=m[63&e[(p+3)%4]]}):(h=function(e){for(p=3;p>=0;p--)e[p]=a(e[p],o[p]),e[p]-=m[d]+(e[(p+3)%4]&e[(p+2)%4])+(~e[(p+3)%4]&e[(p+1)%4]),d--},f=function(e){for(p=3;p>=0;p--)e[p]-=m[63&e[(p+3)%4]]});var g=function(e){var t=[];for(p=0;p<4;p++){var r=l.getInt16Le();null!==c&&(n?r^=c.getInt16Le():c.putInt16Le(r)),t.push(65535&r)}d=n?0:63;for(var i=0;i=8;)g([[5,h],[1,f],[6,h],[1,f],[5,h]])},finish:function(e){var t=!0;if(n)if(e)t=e(8,l,!n);else{var r=8===l.length()?8:8-l.length();l.fillWithByte(r,r)}if(t&&(i=!0,y.update()),!n&&(t=0===l.length(),t))if(e)t=e(8,u,!n);else{var o=u.length(),s=u.at(o-1);s>o?t=!1:u.truncate(s)}return t}},y};r.rc2.startEncrypting=function(e,t,n){var i=r.rc2.createEncryptionCipher(e,128);return i.start(t,n),i},r.rc2.createEncryptionCipher=function(e,t){return l(e,t,!0)},r.rc2.startDecrypting=function(e,t,n){var i=r.rc2.createDecryptionCipher(e,128);return i.start(t,n),i},r.rc2.createDecryptionCipher=function(e,t){return l(e,t,!1)}},function(e,t,n){"use strict";const r=n(56),i=n(57),o=n(70),s=n(47),a=n(754),l=i(n(249));n(768),n(251);const u=n(21);class c{constructor(e){this._key=e}verify(e,t,n){g(n),a.hashAndVerify(this._key,t,e,n)}marshal(){return a.utils.jwkToPkix(this._key)}get bytes(){return l.PublicKey.encode({Type:l.KeyType.RSA,Data:this.marshal()})}encrypt(e){return this._key.encrypt(e,"RSAES-PKCS1-V1_5")}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),r(this.bytes,"sha2-256",e)}}class h{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return a.getRandomValues(16)}sign(e,t){g(t),a.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new c(this._publicKey)}decrypt(e,t){a.decrypt(this._key,e,t)}marshal(){return a.utils.jwkToPkcs1(this._key)}get bytes(){return l.PrivateKey.encode({Type:l.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),r(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,n)=>{if(t)return e(t);e(null,o.encode(n))})}export(e,t,n){"function"==typeof t&&(n=t,t=e,e="pkcs-8"),g(n),s(()=>{let r=null,i=null;try{const n=new u.util.ByteBuffer(this.marshal()),o=u.asn1.fromDer(n),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 r=new Error(`Unknown export format '${e}'`)}catch(e){r=e}n(r,i)})}}function f(e,t){const n=a.utils.pkcs1ToJwk(e);a.unmarshalPrivateKey(n,(e,n)=>{if(e)return t(e);t(null,new h(n.privateKey,n.publicKey))})}function p(e){const t=a.utils.pkixToJwk(e);return new c(t)}function d(e,t){a.unmarshalPrivateKey(e,(e,n)=>{if(e)return t(e);t(null,new h(n.privateKey,n.publicKey))})}function m(e,t){a.generateKey(e,(e,n)=>{if(e)return t(e);t(null,new h(n.privateKey,n.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:c,RsaPrivateKey:h,unmarshalRsaPublicKey:p,unmarshalRsaPrivateKey:f,generateKeyPair:m,fromJwk:d}},function(e,t,n){"use strict";(function(e){const r=n(254),i=n(255),o=n(256);function s(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function a(e){return i.subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}t.utils=n(756),t.generateKey=function(e,t){r(i.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(s).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.unmarshalPrivateKey=function(e,t){const n=i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]);r(Promise.all([n,a(e)]).then(e=>s({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=o,t.hashAndSign=function(t,n,o){r(i.subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]).then(e=>i.subtle.sign({name:"RSASSA-PKCS1-v1_5"},e,Uint8Array.from(n))).then(t=>e.from(t)),o)},t.hashAndVerify=function(e,t,n,o){r(i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]).then(e=>i.subtle.verify({name:"RSASSA-PKCS1-v1_5"},e,t,n)),o)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t,n){const r=t.crypto||t.msCrypto,i=65536;function o(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}function s(e){const t=new Uint8Array(e);let o=0;if(e>0)if(e>i)for(;ot?r.getRandomValues(t.subarray(o,t-o)):(r.getRandomValues(t.subarray(o,o+i)),o+=i);else r.getRandomValues(t);return n.from(t)}r&&r.getRandomValues?e.exports=s:e.exports=o}).call(this,n(8),n(0).Buffer)},function(e,t,n){"use strict";const r=n(119),i=n(378),o=i.toBase64,s=i.toBn,a=r.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}),l=r.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid({"1.2.840.113549.1.1.1":"rsa"}),this.key("none").optional().null_(),this.key("curve").optional().objid(),this.key("params").optional().seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()))}),u=r.define("RSAPublicKey",function(){this.seq().obj(this.key("algorithm").use(l),this.key("subjectPublicKey").bitstr())}),c=r.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.pkcs1ToJwk=function(e){const t=a.decode(e,"der");return{kty:"RSA",n:o(t.modulus),e:o(t.publicExponent),d:o(t.privateExponent),p:o(t.prime1),q:o(t.prime2),dp:o(t.exponent1),dq:o(t.exponent2),qi:o(t.coefficient),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){return a.encode({version:0,modulus:s(e.n),publicExponent:s(e.e),privateExponent:s(e.d),prime1:s(e.p),prime2:s(e.q),exponent1:s(e.dp),exponent2:s(e.dq),coefficient:s(e.qi)},"der")},t.pkixToJwk=function(e){const t=u.decode(e,"der"),n=c.decode(t.subjectPublicKey.data,"der");return{kty:"RSA",n:o(n.modulus),e:o(n.publicExponent),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){return u.encode({algorithm:{algorithm:"rsa",none:null},subjectPublicKey:{data:c.encode({modulus:s(e.n),publicExponent:s(e.e)},"der")}},"der")}},function(e,t,n){(function(e){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var s;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{s=n(758).Buffer}catch(e){}function a(e,t,n){for(var r=0,i=Math.min(e.length,n),o=t;o=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function l(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function e(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function e(t,n){return t.cmp(n)>0?t:n},o.min=function e(t,n){return t.cmp(n)<0?t:n},o.prototype._init=function e(t,n,i){if("number"==typeof t)return this._initNumber(t,n,i);if("object"==typeof t)return this._initArray(t,n,i);"hex"===n&&(n=16),r(n===(0|n)&&n>=2&&n<=36),t=t.toString().replace(/\s+/g,"");var o=0;"-"===t[0]&&o++,16===n?this._parseHex(t,o):this._parseBase(t,n,o),"-"===t[0]&&(this.negative=1),this.strip(),"le"===i&&this._initArray(this.toArray(),n,i)},o.prototype._initNumber=function e(t,n,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),n,i)},o.prototype._initArray=function e(t,n,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var o=0;o=0;o-=3)a=t[o]|t[o-1]<<8|t[o-2]<<16,this.words[s]|=a<>>26-l&67108863,l+=24,l>=26&&(l-=26,s++);else if("le"===i)for(o=0,s=0;o>>26-l&67108863,l+=24,l>=26&&(l-=26,s++);return this.strip()},o.prototype._parseHex=function e(t,n){this.length=Math.ceil((t.length-n)/6),this.words=new Array(this.length);for(var r=0;r=n;r-=6)o=a(t,r,r+6),this.words[i]|=o<>>26-s&4194303,s+=24,s>=26&&(s-=26,i++);r+6!==n&&(o=a(t,n,r+6),this.words[i]|=o<>>26-s&4194303),this.strip()},o.prototype._parseBase=function e(t,n,r){this.words=[0],this.length=1;for(var i=0,o=1;o<=67108863;o*=n)i++;i--,o=o/n|0;for(var s=t.length-r,a=s%i,u=Math.min(s,s-a)+r,c=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function e(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function e(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e){for(var t=new Array(e.bitLength()),n=0;n>>i}return t}function p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,l=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,h=67108863&l,f=Math.min(u,t.length-1),p=Math.max(0,u-e.length+1);p<=f;p++){var d=u-p|0;i=0|e.words[d],o=0|t.words[p],s=i*o+h,c+=s/67108864|0,h=67108863&s}n.words[u]=0|h,l=0|c}return 0!==l?n.words[u]=0|l:n.length--,n.strip()}o.prototype.toString=function e(t,n){var i;if(t=t||10,n=0|n||1,16===t||"hex"===t){i="";for(var o=0,s=0,a=0;a>>24-o&16777215,i=0!==s||a!==this.length-1?u[6-f.length]+f+i:f+i,o+=2,o>=26&&(o-=26,a--)}for(0!==s&&(i=s.toString(16)+i);i.length%n!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var p=c[t],d=h[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var g=m.modn(d).toString(t);m=m.idivn(d),i=m.isZero()?g+i:u[p-g.length]+g+i}for(this.isZero()&&(i="0"+i);i.length%n!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function e(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function e(){return this.toString(16)},o.prototype.toBuffer=function e(t,n){return r(void 0!==s),this.toArrayLike(s,t,n)},o.prototype.toArray=function e(t,n){return this.toArrayLike(Array,t,n)},o.prototype.toArrayLike=function e(t,n,i){var o=this.byteLength(),s=i||Math.max(1,o);r(o<=s,"byte array longer than desired length"),r(s>0,"Requested array length <= 0"),this.strip();var a="le"===n,l=new t(s),u,c,h=this.clone();if(a){for(c=0;!h.isZero();c++)u=h.andln(255),h.iushrn(8),l[c]=u;for(;c=4096&&(r+=13,n>>>=13),n>=64&&(r+=7,n>>>=7),n>=8&&(r+=4,n>>>=4),n>=2&&(r+=2,n>>>=2),r+n},o.prototype._zeroBits=function e(t){if(0===t)return 26;var n=t,r=0;return 0==(8191&n)&&(r+=13,n>>>=13),0==(127&n)&&(r+=7,n>>>=7),0==(15&n)&&(r+=4,n>>>=4),0==(3&n)&&(r+=2,n>>>=2),0==(1&n)&&r++,r},o.prototype.bitLength=function e(){var t=this.words[this.length-1],n=this._countBits(t);return 26*(this.length-1)+n},o.prototype.zeroBits=function e(){if(this.isZero())return 0;for(var t=0,n=0;nt.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function e(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function e(t){var n;n=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function e(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function e(t){var n,r;this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function e(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function e(t){r("number"==typeof t&&t>=0);var n=0|Math.ceil(t/26),i=t%26;this._expand(n),i>0&&n--;for(var o=0;o0&&(this.words[o]=~this.words[o]&67108863>>26-i),this.strip()},o.prototype.notn=function e(t){return this.clone().inotn(t)},o.prototype.setn=function e(t,n){r("number"==typeof t&&t>=0);var i=t/26|0,o=t%26;return this._expand(i+1),this.words[i]=n?this.words[i]|1<t.length?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>>26;for(;0!==o&&s>>26;if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function e(t){if(0!==t.negative){t.negative=0;var n=this.iadd(t);return t.negative=1,n._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r=this.cmp(t),i,o;if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;r>0?(i=this,o=t):(i=t,o=this);for(var s=0,a=0;a>26,this.words[a]=67108863&n;for(;0!==s&&a>26,this.words[a]=67108863&n;if(0===s&&a>>13,d=0|i[1],m=8191&d,g=d>>>13,y=0|i[2],v=8191&y,b=y>>>13,_=0|i[3],w=8191&_,k=_>>>13,E=0|i[4],S=8191&E,x=E>>>13,C=0|i[5],A=8191&C,T=C>>>13,I=0|i[6],j=8191&I,R=I>>>13,B=0|i[7],O=8191&B,P=B>>>13,N=0|i[8],D=8191&N,M=N>>>13,F=0|i[9],L=8191&F,U=F>>>13,q=0|o[0],z=8191&q,K=q>>>13,H=0|o[1],V=8191&H,$=H>>>13,W=0|o[2],G=8191&W,Y=W>>>13,Z=0|o[3],J=8191&Z,Q=Z>>>13,X=0|o[4],ee=8191&X,te=X>>>13,ne=0|o[5],re=8191&ne,ie=ne>>>13,oe=0|o[6],se=8191&oe,ae=oe>>>13,le=0|o[7],ue=8191&le,ce=le>>>13,he=0|o[8],fe=8191&he,pe=he>>>13,de=0|o[9],me=8191&de,ge=de>>>13;r.negative=t.negative^n.negative,r.length=19,l=Math.imul(f,z),u=Math.imul(f,K),u=u+Math.imul(p,z)|0,c=Math.imul(p,K);var ye=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,l=Math.imul(m,z),u=Math.imul(m,K),u=u+Math.imul(g,z)|0,c=Math.imul(g,K),l=l+Math.imul(f,V)|0,u=u+Math.imul(f,$)|0,u=u+Math.imul(p,V)|0,c=c+Math.imul(p,$)|0;var ve=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,l=Math.imul(v,z),u=Math.imul(v,K),u=u+Math.imul(b,z)|0,c=Math.imul(b,K),l=l+Math.imul(m,V)|0,u=u+Math.imul(m,$)|0,u=u+Math.imul(g,V)|0,c=c+Math.imul(g,$)|0,l=l+Math.imul(f,G)|0,u=u+Math.imul(f,Y)|0,u=u+Math.imul(p,G)|0,c=c+Math.imul(p,Y)|0;var be=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(be>>>26)|0,be&=67108863,l=Math.imul(w,z),u=Math.imul(w,K),u=u+Math.imul(k,z)|0,c=Math.imul(k,K),l=l+Math.imul(v,V)|0,u=u+Math.imul(v,$)|0,u=u+Math.imul(b,V)|0,c=c+Math.imul(b,$)|0,l=l+Math.imul(m,G)|0,u=u+Math.imul(m,Y)|0,u=u+Math.imul(g,G)|0,c=c+Math.imul(g,Y)|0,l=l+Math.imul(f,J)|0,u=u+Math.imul(f,Q)|0,u=u+Math.imul(p,J)|0,c=c+Math.imul(p,Q)|0;var _e=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(_e>>>26)|0,_e&=67108863,l=Math.imul(S,z),u=Math.imul(S,K),u=u+Math.imul(x,z)|0,c=Math.imul(x,K),l=l+Math.imul(w,V)|0,u=u+Math.imul(w,$)|0,u=u+Math.imul(k,V)|0,c=c+Math.imul(k,$)|0,l=l+Math.imul(v,G)|0,u=u+Math.imul(v,Y)|0,u=u+Math.imul(b,G)|0,c=c+Math.imul(b,Y)|0,l=l+Math.imul(m,J)|0,u=u+Math.imul(m,Q)|0,u=u+Math.imul(g,J)|0,c=c+Math.imul(g,Q)|0,l=l+Math.imul(f,ee)|0,u=u+Math.imul(f,te)|0,u=u+Math.imul(p,ee)|0,c=c+Math.imul(p,te)|0;var we=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(we>>>26)|0,we&=67108863,l=Math.imul(A,z),u=Math.imul(A,K),u=u+Math.imul(T,z)|0,c=Math.imul(T,K),l=l+Math.imul(S,V)|0,u=u+Math.imul(S,$)|0,u=u+Math.imul(x,V)|0,c=c+Math.imul(x,$)|0,l=l+Math.imul(w,G)|0,u=u+Math.imul(w,Y)|0,u=u+Math.imul(k,G)|0,c=c+Math.imul(k,Y)|0,l=l+Math.imul(v,J)|0,u=u+Math.imul(v,Q)|0,u=u+Math.imul(b,J)|0,c=c+Math.imul(b,Q)|0,l=l+Math.imul(m,ee)|0,u=u+Math.imul(m,te)|0,u=u+Math.imul(g,ee)|0,c=c+Math.imul(g,te)|0,l=l+Math.imul(f,re)|0,u=u+Math.imul(f,ie)|0,u=u+Math.imul(p,re)|0,c=c+Math.imul(p,ie)|0;var ke=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(ke>>>26)|0,ke&=67108863,l=Math.imul(j,z),u=Math.imul(j,K),u=u+Math.imul(R,z)|0,c=Math.imul(R,K),l=l+Math.imul(A,V)|0,u=u+Math.imul(A,$)|0,u=u+Math.imul(T,V)|0,c=c+Math.imul(T,$)|0,l=l+Math.imul(S,G)|0,u=u+Math.imul(S,Y)|0,u=u+Math.imul(x,G)|0,c=c+Math.imul(x,Y)|0,l=l+Math.imul(w,J)|0,u=u+Math.imul(w,Q)|0,u=u+Math.imul(k,J)|0,c=c+Math.imul(k,Q)|0,l=l+Math.imul(v,ee)|0,u=u+Math.imul(v,te)|0,u=u+Math.imul(b,ee)|0,c=c+Math.imul(b,te)|0,l=l+Math.imul(m,re)|0,u=u+Math.imul(m,ie)|0,u=u+Math.imul(g,re)|0,c=c+Math.imul(g,ie)|0,l=l+Math.imul(f,se)|0,u=u+Math.imul(f,ae)|0,u=u+Math.imul(p,se)|0,c=c+Math.imul(p,ae)|0;var Ee=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,l=Math.imul(O,z),u=Math.imul(O,K),u=u+Math.imul(P,z)|0,c=Math.imul(P,K),l=l+Math.imul(j,V)|0,u=u+Math.imul(j,$)|0,u=u+Math.imul(R,V)|0,c=c+Math.imul(R,$)|0,l=l+Math.imul(A,G)|0,u=u+Math.imul(A,Y)|0,u=u+Math.imul(T,G)|0,c=c+Math.imul(T,Y)|0,l=l+Math.imul(S,J)|0,u=u+Math.imul(S,Q)|0,u=u+Math.imul(x,J)|0,c=c+Math.imul(x,Q)|0,l=l+Math.imul(w,ee)|0,u=u+Math.imul(w,te)|0,u=u+Math.imul(k,ee)|0,c=c+Math.imul(k,te)|0,l=l+Math.imul(v,re)|0,u=u+Math.imul(v,ie)|0,u=u+Math.imul(b,re)|0,c=c+Math.imul(b,ie)|0,l=l+Math.imul(m,se)|0,u=u+Math.imul(m,ae)|0,u=u+Math.imul(g,se)|0,c=c+Math.imul(g,ae)|0,l=l+Math.imul(f,ue)|0,u=u+Math.imul(f,ce)|0,u=u+Math.imul(p,ue)|0,c=c+Math.imul(p,ce)|0;var Se=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Se>>>26)|0,Se&=67108863,l=Math.imul(D,z),u=Math.imul(D,K),u=u+Math.imul(M,z)|0,c=Math.imul(M,K),l=l+Math.imul(O,V)|0,u=u+Math.imul(O,$)|0,u=u+Math.imul(P,V)|0,c=c+Math.imul(P,$)|0,l=l+Math.imul(j,G)|0,u=u+Math.imul(j,Y)|0,u=u+Math.imul(R,G)|0,c=c+Math.imul(R,Y)|0,l=l+Math.imul(A,J)|0,u=u+Math.imul(A,Q)|0,u=u+Math.imul(T,J)|0,c=c+Math.imul(T,Q)|0,l=l+Math.imul(S,ee)|0,u=u+Math.imul(S,te)|0,u=u+Math.imul(x,ee)|0,c=c+Math.imul(x,te)|0,l=l+Math.imul(w,re)|0,u=u+Math.imul(w,ie)|0,u=u+Math.imul(k,re)|0,c=c+Math.imul(k,ie)|0,l=l+Math.imul(v,se)|0,u=u+Math.imul(v,ae)|0,u=u+Math.imul(b,se)|0,c=c+Math.imul(b,ae)|0,l=l+Math.imul(m,ue)|0,u=u+Math.imul(m,ce)|0,u=u+Math.imul(g,ue)|0,c=c+Math.imul(g,ce)|0,l=l+Math.imul(f,fe)|0,u=u+Math.imul(f,pe)|0,u=u+Math.imul(p,fe)|0,c=c+Math.imul(p,pe)|0;var xe=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(xe>>>26)|0,xe&=67108863,l=Math.imul(L,z),u=Math.imul(L,K),u=u+Math.imul(U,z)|0,c=Math.imul(U,K),l=l+Math.imul(D,V)|0,u=u+Math.imul(D,$)|0,u=u+Math.imul(M,V)|0,c=c+Math.imul(M,$)|0,l=l+Math.imul(O,G)|0,u=u+Math.imul(O,Y)|0,u=u+Math.imul(P,G)|0,c=c+Math.imul(P,Y)|0,l=l+Math.imul(j,J)|0,u=u+Math.imul(j,Q)|0,u=u+Math.imul(R,J)|0,c=c+Math.imul(R,Q)|0,l=l+Math.imul(A,ee)|0,u=u+Math.imul(A,te)|0,u=u+Math.imul(T,ee)|0,c=c+Math.imul(T,te)|0,l=l+Math.imul(S,re)|0,u=u+Math.imul(S,ie)|0,u=u+Math.imul(x,re)|0,c=c+Math.imul(x,ie)|0,l=l+Math.imul(w,se)|0,u=u+Math.imul(w,ae)|0,u=u+Math.imul(k,se)|0,c=c+Math.imul(k,ae)|0,l=l+Math.imul(v,ue)|0,u=u+Math.imul(v,ce)|0,u=u+Math.imul(b,ue)|0,c=c+Math.imul(b,ce)|0,l=l+Math.imul(m,fe)|0,u=u+Math.imul(m,pe)|0,u=u+Math.imul(g,fe)|0,c=c+Math.imul(g,pe)|0,l=l+Math.imul(f,me)|0,u=u+Math.imul(f,ge)|0,u=u+Math.imul(p,me)|0,c=c+Math.imul(p,ge)|0;var Ce=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,l=Math.imul(L,V),u=Math.imul(L,$),u=u+Math.imul(U,V)|0,c=Math.imul(U,$),l=l+Math.imul(D,G)|0,u=u+Math.imul(D,Y)|0,u=u+Math.imul(M,G)|0,c=c+Math.imul(M,Y)|0,l=l+Math.imul(O,J)|0,u=u+Math.imul(O,Q)|0,u=u+Math.imul(P,J)|0,c=c+Math.imul(P,Q)|0,l=l+Math.imul(j,ee)|0,u=u+Math.imul(j,te)|0,u=u+Math.imul(R,ee)|0,c=c+Math.imul(R,te)|0,l=l+Math.imul(A,re)|0,u=u+Math.imul(A,ie)|0,u=u+Math.imul(T,re)|0,c=c+Math.imul(T,ie)|0,l=l+Math.imul(S,se)|0,u=u+Math.imul(S,ae)|0,u=u+Math.imul(x,se)|0,c=c+Math.imul(x,ae)|0,l=l+Math.imul(w,ue)|0,u=u+Math.imul(w,ce)|0,u=u+Math.imul(k,ue)|0,c=c+Math.imul(k,ce)|0,l=l+Math.imul(v,fe)|0,u=u+Math.imul(v,pe)|0,u=u+Math.imul(b,fe)|0,c=c+Math.imul(b,pe)|0,l=l+Math.imul(m,me)|0,u=u+Math.imul(m,ge)|0,u=u+Math.imul(g,me)|0,c=c+Math.imul(g,ge)|0;var Ae=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,l=Math.imul(L,G),u=Math.imul(L,Y),u=u+Math.imul(U,G)|0,c=Math.imul(U,Y),l=l+Math.imul(D,J)|0,u=u+Math.imul(D,Q)|0,u=u+Math.imul(M,J)|0,c=c+Math.imul(M,Q)|0,l=l+Math.imul(O,ee)|0,u=u+Math.imul(O,te)|0,u=u+Math.imul(P,ee)|0,c=c+Math.imul(P,te)|0,l=l+Math.imul(j,re)|0,u=u+Math.imul(j,ie)|0,u=u+Math.imul(R,re)|0,c=c+Math.imul(R,ie)|0,l=l+Math.imul(A,se)|0,u=u+Math.imul(A,ae)|0,u=u+Math.imul(T,se)|0,c=c+Math.imul(T,ae)|0,l=l+Math.imul(S,ue)|0,u=u+Math.imul(S,ce)|0,u=u+Math.imul(x,ue)|0,c=c+Math.imul(x,ce)|0,l=l+Math.imul(w,fe)|0,u=u+Math.imul(w,pe)|0,u=u+Math.imul(k,fe)|0,c=c+Math.imul(k,pe)|0,l=l+Math.imul(v,me)|0,u=u+Math.imul(v,ge)|0,u=u+Math.imul(b,me)|0,c=c+Math.imul(b,ge)|0;var Te=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Te>>>26)|0,Te&=67108863,l=Math.imul(L,J),u=Math.imul(L,Q),u=u+Math.imul(U,J)|0,c=Math.imul(U,Q),l=l+Math.imul(D,ee)|0,u=u+Math.imul(D,te)|0,u=u+Math.imul(M,ee)|0,c=c+Math.imul(M,te)|0,l=l+Math.imul(O,re)|0,u=u+Math.imul(O,ie)|0,u=u+Math.imul(P,re)|0,c=c+Math.imul(P,ie)|0,l=l+Math.imul(j,se)|0,u=u+Math.imul(j,ae)|0,u=u+Math.imul(R,se)|0,c=c+Math.imul(R,ae)|0,l=l+Math.imul(A,ue)|0,u=u+Math.imul(A,ce)|0,u=u+Math.imul(T,ue)|0,c=c+Math.imul(T,ce)|0,l=l+Math.imul(S,fe)|0,u=u+Math.imul(S,pe)|0,u=u+Math.imul(x,fe)|0,c=c+Math.imul(x,pe)|0,l=l+Math.imul(w,me)|0,u=u+Math.imul(w,ge)|0,u=u+Math.imul(k,me)|0,c=c+Math.imul(k,ge)|0;var Ie=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,l=Math.imul(L,ee),u=Math.imul(L,te),u=u+Math.imul(U,ee)|0,c=Math.imul(U,te),l=l+Math.imul(D,re)|0,u=u+Math.imul(D,ie)|0,u=u+Math.imul(M,re)|0,c=c+Math.imul(M,ie)|0,l=l+Math.imul(O,se)|0,u=u+Math.imul(O,ae)|0,u=u+Math.imul(P,se)|0,c=c+Math.imul(P,ae)|0,l=l+Math.imul(j,ue)|0,u=u+Math.imul(j,ce)|0,u=u+Math.imul(R,ue)|0,c=c+Math.imul(R,ce)|0,l=l+Math.imul(A,fe)|0,u=u+Math.imul(A,pe)|0,u=u+Math.imul(T,fe)|0,c=c+Math.imul(T,pe)|0,l=l+Math.imul(S,me)|0,u=u+Math.imul(S,ge)|0,u=u+Math.imul(x,me)|0,c=c+Math.imul(x,ge)|0;var je=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(je>>>26)|0,je&=67108863,l=Math.imul(L,re),u=Math.imul(L,ie),u=u+Math.imul(U,re)|0,c=Math.imul(U,ie),l=l+Math.imul(D,se)|0,u=u+Math.imul(D,ae)|0,u=u+Math.imul(M,se)|0,c=c+Math.imul(M,ae)|0,l=l+Math.imul(O,ue)|0,u=u+Math.imul(O,ce)|0,u=u+Math.imul(P,ue)|0,c=c+Math.imul(P,ce)|0,l=l+Math.imul(j,fe)|0,u=u+Math.imul(j,pe)|0,u=u+Math.imul(R,fe)|0,c=c+Math.imul(R,pe)|0,l=l+Math.imul(A,me)|0,u=u+Math.imul(A,ge)|0,u=u+Math.imul(T,me)|0,c=c+Math.imul(T,ge)|0;var Re=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Re>>>26)|0,Re&=67108863,l=Math.imul(L,se),u=Math.imul(L,ae),u=u+Math.imul(U,se)|0,c=Math.imul(U,ae),l=l+Math.imul(D,ue)|0,u=u+Math.imul(D,ce)|0,u=u+Math.imul(M,ue)|0,c=c+Math.imul(M,ce)|0,l=l+Math.imul(O,fe)|0,u=u+Math.imul(O,pe)|0,u=u+Math.imul(P,fe)|0,c=c+Math.imul(P,pe)|0,l=l+Math.imul(j,me)|0,u=u+Math.imul(j,ge)|0,u=u+Math.imul(R,me)|0,c=c+Math.imul(R,ge)|0;var Be=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Be>>>26)|0,Be&=67108863,l=Math.imul(L,ue),u=Math.imul(L,ce),u=u+Math.imul(U,ue)|0,c=Math.imul(U,ce),l=l+Math.imul(D,fe)|0,u=u+Math.imul(D,pe)|0,u=u+Math.imul(M,fe)|0,c=c+Math.imul(M,pe)|0,l=l+Math.imul(O,me)|0,u=u+Math.imul(O,ge)|0,u=u+Math.imul(P,me)|0,c=c+Math.imul(P,ge)|0;var Oe=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,l=Math.imul(L,fe),u=Math.imul(L,pe),u=u+Math.imul(U,fe)|0,c=Math.imul(U,pe),l=l+Math.imul(D,me)|0,u=u+Math.imul(D,ge)|0,u=u+Math.imul(M,me)|0,c=c+Math.imul(M,ge)|0;var Pe=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,l=Math.imul(L,me),u=Math.imul(L,ge),u=u+Math.imul(U,me)|0,c=Math.imul(U,ge);var Ne=(a+l|0)+((8191&u)<<13)|0;return a=(c+(u>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,s[0]=ye,s[1]=ve,s[2]=be,s[3]=_e,s[4]=we,s[5]=ke,s[6]=Ee,s[7]=Se,s[8]=xe,s[9]=Ce,s[10]=Ae,s[11]=Te,s[12]=Ie,s[13]=je,s[14]=Re,s[15]=Be,s[16]=Oe,s[17]=Pe,s[18]=Ne,0!==a&&(s[19]=a,r.length++),r};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0,i+=s>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}function g(e,t,n){var r=new y;return r.mulp(e,t,n)}function y(e,t){this.x=e,this.y=t}Math.imul||(d=p),o.prototype.mulTo=function e(t,n){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?d(this,t,n):i<63?p(this,t,n):i<1024?m(this,t,n):g(this,t,n),r},y.prototype.makeRBT=function e(t){for(var n=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},y.prototype.permute=function e(t,n,r,i,o,s){for(var a=0;a>>=1)o++;return 1<>>=13,i[2*a+1]=8191&s,s>>>=13;for(a=2*n;a>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),this},o.prototype.muln=function e(t){return this.clone().imuln(t)},o.prototype.sqr=function e(){return this.mul(this)},o.prototype.isqr=function e(){return this.imul(this.clone())},o.prototype.pow=function e(t){var n=f(t);if(0===n.length)return new o(1);for(var r=this,i=0;i=0);var n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n,s;if(0!==n){var a=0;for(s=0;s>>26-n}a&&(this.words[s]=a,this.length++)}if(0!==i){for(s=this.length-1;s>=0;s--)this.words[s+i]=this.words[s];for(s=0;s=0),o=n?(n-n%26)/26:0;var s=t%26,a=Math.min((t-s)/26,this.length),l=67108863^67108863>>>s<a)for(this.length-=a,c=0;c=0&&(0!==h||c>=o);c--){var f=0|this.words[c];this.words[c]=h<<26-s|f>>>s,h=f&l}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function e(t,n,i){return r(0===this.negative),this.iushrn(t,n,i)},o.prototype.shln=function e(t){return this.clone().ishln(t)},o.prototype.ushln=function e(t){return this.clone().iushln(t)},o.prototype.shrn=function e(t){return this.clone().ishrn(t)},o.prototype.ushrn=function e(t){return this.clone().iushrn(t)},o.prototype.testn=function e(t){r("number"==typeof t&&t>=0);var n=t%26,i=(t-n)/26,o=1<=0);var n=t%26,i=(t-n)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==n&&i++,this.length=Math.min(i,this.length),0!==n){var o=67108863^67108863>>>n<=67108864;n++)this.words[n]-=67108864,n===this.length-1?this.words[n+1]=1:this.words[n+1]++;return this.length=Math.max(this.length,n+1),this},o.prototype.isubn=function e(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var n=0;n>26)-(u/67108864|0),this.words[s+i]=67108863&a}for(;s>26,this.words[s+i]=67108863&a;if(0===l)return this.strip();for(r(-1===l),l=0,s=0;s>26,this.words[s]=67108863&a;return this.negative=1,this.strip()},o.prototype._wordDiv=function e(t,n){var r=this.length-t.length,i=this.clone(),s=t,a=0|s.words[s.length-1],l=this._countBits(a);r=26-l,0!==r&&(s=s.ushln(r),i.iushln(r),a=0|s.words[s.length-1]);var u=i.length-s.length,c;if("mod"!==n){c=new o(null),c.length=u+1,c.words=new Array(c.length);for(var h=0;h=0;p--){var d=67108864*(0|i.words[s.length+p])+(0|i.words[s.length+p-1]);for(d=Math.min(d/a|0,67108863),i._ishlnsubmul(s,d,p);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(s,1,p),i.isZero()||(i.negative^=1);c&&(c.words[p]=d)}return c&&c.strip(),i.strip(),"div"!==n&&0!==r&&i.iushrn(r),{div:c||null,mod:i}},o.prototype.divmod=function e(t,n,i){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(l=this.neg().divmod(t,n),"mod"!==n&&(s=l.div.neg()),"div"!==n&&(a=l.mod.neg(),i&&0!==a.negative&&a.iadd(t)),{div:s,mod:a}):0===this.negative&&0!==t.negative?(l=this.divmod(t.neg(),n),"mod"!==n&&(s=l.div.neg()),{div:s,mod:l.mod}):0!=(this.negative&t.negative)?(l=this.neg().divmod(t.neg(),n),"div"!==n&&(a=l.mod.neg(),i&&0!==a.negative&&a.isub(t)),{div:l.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===n?{div:this.divn(t.words[0]),mod:null}:"mod"===n?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,n);var s,a,l},o.prototype.div=function e(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function e(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function e(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function e(t){var n=this.divmod(t);if(n.mod.isZero())return n.div;var r=0!==n.div.negative?n.mod.isub(t):n.mod,i=t.ushrn(1),o=t.andln(1),s=r.cmp(i);return s<0||1===o&&0===s?n.div:0!==n.div.negative?n.div.isubn(1):n.div.iaddn(1)},o.prototype.modn=function e(t){r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return i},o.prototype.idivn=function e(t){r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this.strip()},o.prototype.divn=function e(t){return this.clone().idivn(t)},o.prototype.egcd=function e(t){r(0===t.negative),r(!t.isZero());var n=this,i=t.clone();n=0!==n.negative?n.umod(t):n.clone();for(var s=new o(1),a=new o(0),l=new o(0),u=new o(1),c=0;n.isEven()&&i.isEven();)n.iushrn(1),i.iushrn(1),++c;for(var h=i.clone(),f=n.clone();!n.isZero();){for(var p=0,d=1;0==(n.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||a.isOdd())&&(s.iadd(h),a.isub(f)),s.iushrn(1),a.iushrn(1);for(var m=0,g=1;0==(i.words[0]&g)&&m<26;++m,g<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(l.isOdd()||u.isOdd())&&(l.iadd(h),u.isub(f)),l.iushrn(1),u.iushrn(1);n.cmp(i)>=0?(n.isub(i),s.isub(l),a.isub(u)):(i.isub(n),l.isub(s),u.isub(a))}return{a:l,b:u,gcd:i.iushln(c)}},o.prototype._invmp=function e(t){r(0===t.negative),r(!t.isZero());var n=this,i=t.clone();n=0!==n.negative?n.umod(t):n.clone();for(var s=new o(1),a=new o(0),l=i.clone(),u;n.cmpn(1)>0&&i.cmpn(1)>0;){for(var c=0,h=1;0==(n.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(n.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);for(var f=0,p=1;0==(i.words[0]&p)&&f<26;++f,p<<=1);if(f>0)for(i.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);n.cmp(i)>=0?(n.isub(i),s.isub(a)):(i.isub(n),a.isub(s))}return u=0===n.cmpn(1)?s:a,u.cmpn(0)<0&&u.iadd(t),u},o.prototype.gcd=function e(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var n=this.clone(),r=t.clone();n.negative=0,r.negative=0;for(var i=0;n.isEven()&&r.isEven();i++)n.iushrn(1),r.iushrn(1);for(;;){for(;n.isEven();)n.iushrn(1);for(;r.isEven();)r.iushrn(1);var o=n.cmp(r);if(o<0){var s=n;n=r,r=s}else if(0===o||0===r.cmpn(1))break;n.isub(r)}return r.iushln(i)},o.prototype.invm=function e(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function e(){return 0==(1&this.words[0])},o.prototype.isOdd=function e(){return 1==(1&this.words[0])},o.prototype.andln=function e(t){return this.words[0]&t},o.prototype.bincn=function e(t){r("number"==typeof t);var n=t%26,i=(t-n)/26,o=1<>>26,l&=67108863,this.words[a]=l}return 0!==s&&(this.words[a]=s,this.length++),this},o.prototype.isZero=function e(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function e(t){var n=t<0,i;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)i=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var o=0|this.words[0];i=o===t?0:ot.length)return 1;if(this.length=0;r--){var i=0|this.words[r],o=0|t.words[r];if(i!==o){io&&(n=1);break}}return n},o.prototype.gtn=function e(t){return 1===this.cmpn(t)},o.prototype.gt=function e(t){return 1===this.cmp(t)},o.prototype.gten=function e(t){return this.cmpn(t)>=0},o.prototype.gte=function e(t){return this.cmp(t)>=0},o.prototype.ltn=function e(t){return-1===this.cmpn(t)},o.prototype.lt=function e(t){return-1===this.cmp(t)},o.prototype.lten=function e(t){return this.cmpn(t)<=0},o.prototype.lte=function e(t){return this.cmp(t)<=0},o.prototype.eqn=function e(t){return 0===this.cmpn(t)},o.prototype.eq=function e(t){return 0===this.cmp(t)},o.red=function e(t){return new S(t)},o.prototype.toRed=function e(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function e(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function e(t){return this.red=t,this},o.prototype.forceRed=function e(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function e(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function e(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function e(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function e(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function e(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function e(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function e(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function e(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function e(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function e(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function e(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function e(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function e(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function b(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 _(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function x(e){S.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)}b.prototype._tmp=function e(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function e(t){var n=t,r;do{this.split(n,this.tmp),n=this.imulK(n),n=n.iadd(this.tmp),r=n.bitLength()}while(r>this.n);var i=r0?n.isub(this.p):n.strip(),n},b.prototype.split=function e(t,n){t.iushrn(this.n,0,n)},b.prototype.imulK=function e(t){return t.imul(this.k)},i(_,b),_.prototype.split=function e(t,n){for(var r=4194303,i=Math.min(t.length,9),o=0;o>>22,s=a}s>>>=22,t.words[o-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},_.prototype.imulK=function e(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var n=0,r=0;r>>=26,t.words[r]=o,n=i}return 0!==n&&(t.words[t.length++]=n),t},o._prime=function e(t){if(v[t])return v[t];var e;if("k256"===t)e=new _;else if("p224"===t)e=new w;else if("p192"===t)e=new k;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},S.prototype._verify1=function e(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},S.prototype._verify2=function e(t,n){r(0==(t.negative|n.negative),"red works only with positives"),r(t.red&&t.red===n.red,"red works only with red numbers")},S.prototype.imod=function e(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function e(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function e(t,n){this._verify2(t,n);var r=t.add(n);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function e(t,n){this._verify2(t,n);var r=t.iadd(n);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function e(t,n){this._verify2(t,n);var r=t.sub(n);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function e(t,n){this._verify2(t,n);var r=t.isub(n);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function e(t,n){return this._verify1(t),this.imod(t.ushln(n))},S.prototype.imul=function e(t,n){return this._verify2(t,n),this.imod(t.imul(n))},S.prototype.mul=function e(t,n){return this._verify2(t,n),this.imod(t.mul(n))},S.prototype.isqr=function e(t){return this.imul(t,t.clone())},S.prototype.sqr=function e(t){return this.mul(t,t)},S.prototype.sqrt=function e(t){if(t.isZero())return t.clone();var n=this.m.andln(3);if(r(n%2==1),3===n){var i=this.m.add(new o(1)).iushrn(2);return this.pow(t,i)}for(var s=this.m.subn(1),a=0;!s.isZero()&&0===s.andln(1);)a++,s.iushrn(1);r(!s.isZero());var l=new o(1).toRed(this),u=l.redNeg(),c=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var f=this.pow(h,s),p=this.pow(t,s.addn(1).iushrn(1)),d=this.pow(t,s),m=a;0!==d.cmp(l);){for(var g=d,y=0;0!==g.cmp(l);y++)g=g.redSqr();r(y=0;s--){for(var h=n.words[s],f=c-1;f>=0;f--){var p=h>>f&1;a!==i[0]&&(a=this.sqr(a)),0!==p||0!==l?(l<<=1,l|=p,u++,(4===u||0===s&&0===f)&&(a=this.mul(a,i[l]),u=0,l=0)):u=0}c=26}return a},S.prototype.convertTo=function e(t){var n=t.umod(this.m);return n===t?n.clone():n},S.prototype.convertFrom=function e(t){var n=t.clone();return n.red=null,n},o.mont=function e(t){return new x(t)},i(x,S),x.prototype.convertTo=function e(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function e(t){var n=this.imod(t.mul(this.rinv));return n.red=null,n},x.prototype.imul=function e(t,n){if(t.isZero()||n.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(n),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},x.prototype.mul=function e(t,n){if(t.isZero()||n.isZero())return new o(0)._forceRed(this);var r=t.mul(n),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(i).iushrn(this.shift),a=s;return s.cmp(this.m)>=0?a=s.isub(this.m):s.cmpn(0)<0&&(a=s.iadd(this.m)),a._forceRed(this)},x.prototype.invm=function e(t){var n=this.imod(t._invmp(this.m).mul(this.r2));return n._forceRed(this)}}(e,this)}).call(this,n(85)(e))},function(e,t){},function(e,t,n){"use strict";const r=n(119),i=n(1),o=t;function s(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}o.define=function e(t,n){return new s(t,n)},s.prototype._createNamed=function e(t){const n=this.name;function r(e){this._initNamed(e,n)}return i(r,t),r.prototype._initNamed=function e(n,r){t.call(this,n,r)},new r(this)},s.prototype._getDecoder=function e(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(r.decoders[t])),this.decoders[t]},s.prototype.decode=function e(t,n,r){return this._getDecoder(n).decode(t,r)},s.prototype._getEncoder=function e(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(r.encoders[t])),this.encoders[t]},s.prototype.encode=function e(t,n,r){return this._getEncoder(n).encode(t,r)}},function(e,t,n){"use strict";const r=n(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 n=this._reporterState;n.obj=t.obj,n.path=n.path.slice(0,t.pathLen)},i.prototype.enterKey=function e(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function e(t){const n=this._reporterState;n.path=n.path.slice(0,t-1)},i.prototype.leaveKey=function e(t,n,r){const i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[n]=r)},i.prototype.path=function e(){return this._reporterState.path.join("/")},i.prototype.enterObject=function e(){const t=this._reporterState,n=t.obj;return t.obj={},n},i.prototype.leaveObject=function e(t){const n=this._reporterState,r=n.obj;return n.obj=t,r},i.prototype.error=function e(t){let n;const r=this._reporterState,i=t instanceof o;if(n=i?t:new o(r.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),t.message||t,t.stack),!r.options.partial)throw n;return i||r.errors.push(n),n},i.prototype.wrapResult=function e(t){const n=this._reporterState;return n.options.partial?{result:this.isError(t)?null:t,errors:n.errors}:t},r(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,n){"use strict";const r=n(153).Reporter,i=n(153).EncoderBuffer,o=n(153).DecoderBuffer,s=n(762),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"],l=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(a),u=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function c(e,t,n){const r={};this._baseState=r,r.name=n,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=c;const h=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];c.prototype.clone=function e(){const t=this._baseState,n={};h.forEach(function(e){n[e]=t[e]});const r=new this.constructor(n.parent);return r._baseState=n,r},c.prototype._wrap=function e(){const t=this._baseState;l.forEach(function(e){this[e]=function n(){const r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}},this)},c.prototype._init=function e(t){const n=this._baseState;s(null===n.parent),t.call(this),n.children=n.children.filter(function(e){return e._baseState.parent===this},this),s.equal(n.children.length,1,"Root node can have only one child")},c.prototype._useArgs=function e(t){const n=this._baseState,r=t.filter(function(e){return e instanceof this.constructor},this);t=t.filter(function(e){return!(e instanceof this.constructor)},this),0!==r.length&&(s(null===n.children),n.children=r,r.forEach(function(e){e._baseState.parent=this},this)),0!==t.length&&(s(null===n.args),n.args=t,n.reverseArgs=t.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach(function(n){n==(0|n)&&(n|=0);const r=e[n];t[r]=n}),t}))},u.forEach(function(e){c.prototype[e]=function t(){const n=this._baseState;throw new Error(e+" not implemented for encoding: "+n.enc)}}),a.forEach(function(e){c.prototype[e]=function t(){const n=this._baseState,r=Array.prototype.slice.call(arguments);return s(null===n.tag),n.tag=e,this._useArgs(r),this}}),c.prototype.use=function e(t){s(t);const n=this._baseState;return s(null===n.use),n.use=t,this},c.prototype.optional=function e(){const t=this._baseState;return t.optional=!0,this},c.prototype.def=function e(t){const n=this._baseState;return s(null===n.default),n.default=t,n.optional=!0,this},c.prototype.explicit=function e(t){const n=this._baseState;return s(null===n.explicit&&null===n.implicit),n.explicit=t,this},c.prototype.implicit=function e(t){const n=this._baseState;return s(null===n.explicit&&null===n.implicit),n.implicit=t,this},c.prototype.obj=function e(){const t=this._baseState,n=Array.prototype.slice.call(arguments);return t.obj=!0,0!==n.length&&this._useArgs(n),this},c.prototype.key=function e(t){const n=this._baseState;return s(null===n.key),n.key=t,this},c.prototype.any=function e(){const t=this._baseState;return t.any=!0,this},c.prototype.choice=function e(t){const n=this._baseState;return s(null===n.choice),n.choice=t,this._useArgs(Object.keys(t).map(function(e){return t[e]})),this},c.prototype.contains=function e(t){const n=this._baseState;return s(null===n.use),n.contains=t,this},c.prototype._decode=function e(t,n){const r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,n));let i=r.default,s=!0,a=null,l;if(null!==r.key&&(a=t.enterKey(r.key)),r.optional){let e=null;if(null!==r.explicit?e=r.explicit:null!==r.implicit?e=r.implicit:null!==r.tag&&(e=r.tag),null!==e||r.any){if(s=this._peekTag(t,e,r.any),t.isError(s))return s}else{const e=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,n):this._decodeChoice(t,n),s=!0}catch(e){s=!1}t.restore(e)}}if(r.obj&&s&&(l=t.enterObject()),s){if(null!==r.explicit){const e=this._decodeTag(t,r.explicit);if(t.isError(e))return e;t=e}const e=t.offset;if(null===r.use&&null===r.choice){let e;r.any&&(e=t.save());const n=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(n))return n;r.any?i=t.raw(e):t=n}if(n&&n.track&&null!==r.tag&&n.track(t.path(),e,t.length,"tagged"),n&&n.track&&null!==r.tag&&n.track(t.path(),t.offset,t.length,"content"),r.any||(i=null===r.choice?this._decodeGeneric(r.tag,t,n):this._decodeChoice(t,n)),t.isError(i))return i;if(r.any||null!==r.choice||null===r.children||r.children.forEach(function e(r){r._decode(t,n)}),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const e=new o(i);i=this._getUse(r.contains,t._reporterState.obj)._decode(e,n)}}return r.obj&&s&&(i=t.leaveObject(l)),null===r.key||null===i&&!0!==s?null!==a&&t.exitKey(a):t.leaveKey(a,r.key,i),i},c.prototype._decodeGeneric=function e(t,n,r){const i=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(n,t,i.args[0],r):/str$/.test(t)?this._decodeStr(n,t,r):"objid"===t&&i.args?this._decodeObjid(n,i.args[0],i.args[1],r):"objid"===t?this._decodeObjid(n,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(n,t,r):"null_"===t?this._decodeNull(n,r):"bool"===t?this._decodeBool(n,r):"objDesc"===t?this._decodeStr(n,t,r):"int"===t||"enum"===t?this._decodeInt(n,i.args&&i.args[0],r):null!==i.use?this._getUse(i.use,n._reporterState.obj)._decode(n,r):n.error("unknown tag: "+t)},c.prototype._getUse=function e(t,n){const r=this._baseState;return r.useDecoder=this._use(t,n),s(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},c.prototype._decodeChoice=function e(t,n){const r=this._baseState;let i=null,o=!1;return Object.keys(r.choice).some(function(e){const s=t.save(),a=r.choice[e];try{const r=a._decode(t,n);if(t.isError(r))return!1;i={type:e,value:r},o=!0}catch(e){return t.restore(s),!1}return!0},this),o?i:t.error("Choice not matched")},c.prototype._createEncoderBuffer=function e(t){return new i(t,this.reporter)},c.prototype._encode=function e(t,n,r){const i=this._baseState;if(null!==i.default&&i.default===t)return;const o=this._encodeValue(t,n,r);return void 0===o||this._skipDefault(o,n,r)?void 0:o},c.prototype._encodeValue=function e(t,n,i){const o=this._baseState;if(null===o.parent)return o.children[0]._encode(t,n||new r);let s=null;if(this.reporter=n,o.optional&&void 0===t){if(null===o.default)return;t=o.default}let a=null,l=!1;if(o.any)s=this._createEncoderBuffer(t);else if(o.choice)s=this._encodeChoice(t,n);else if(o.contains)a=this._getUse(o.contains,i)._encode(t,n),l=!0;else if(o.children)a=o.children.map(function(e){if("null_"===e._baseState.tag)return e._encode(null,n,t);if(null===e._baseState.key)return n.error("Child should have a key");const r=n.enterKey(e._baseState.key);if("object"!=typeof t)return n.error("Child expected, but input is not object");const i=e._encode(t[e._baseState.key],n,t);return n.leaveKey(r),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 n.error("Too many args for : "+o.tag);if(!Array.isArray(t))return n.error("seqof/setof, but data is not Array");const e=this.clone();e._baseState.implicit=null,a=this._createEncoderBuffer(t.map(function(e){const r=this._baseState;return this._getUse(r.args[0],t)._encode(e,n)},e))}else null!==o.use?s=this._getUse(o.use,i)._encode(t,n):(a=this._encodePrimitive(o.tag,t),l=!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&&n.error("Tag could be omitted only for .use()"):null===o.use&&(s=this._encodeComposite(e,l,t,a))}return null!==o.explicit&&(s=this._encodeComposite(o.explicit,!1,"context",s)),s},c.prototype._encodeChoice=function e(t,n){const r=this._baseState,i=r.choice[t.type];return i||s(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(t.value,n)},c.prototype._encodePrimitive=function e(t,n){const r=this._baseState;if(/str$/.test(t))return this._encodeStr(n,t);if("objid"===t&&r.args)return this._encodeObjid(n,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(n,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(n,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(n,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(n);if("objDesc"===t)return this._encodeStr(n,t);throw new Error("Unsupported tag: "+t)},c.prototype._isNumstr=function e(t){return/^[0-9 ]*$/.test(t)},c.prototype._isPrintstr=function e(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=n,n.equal=function e(t,n,r){if(t!=n)throw new Error(r||"Assertion failed: "+t+" != "+n)}},function(e,t,n){"use strict";const r=n(375);t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=r._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=r._reverse(t.tag)},function(e,t,n){"use strict";const r=t;r.der=n(376),r.pem=n(765)},function(e,t,n){"use strict";const r=n(1),i=n(0).Buffer,o=n(376);function s(e){o.call(this,e),this.enc="pem"}r(s,o),e.exports=s,s.prototype.decode=function e(t,n){const r=t.toString().split(/[\r\n]+/g),s=n.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/;let l=-1,u=-1;for(let e=0;e>>0,s>>>0];for(var a=p.fullMessageLength.length-1;a>=0;--a)p.fullMessageLength[a]+=s[1],s[1]=s[0]+(p.fullMessageLength[a]/4294967296>>>0),p.fullMessageLength[a]=p.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return i.putBytes(e),h(n,o,i),(i.read>2048||0===i.length())&&i.compact(),p},p.digest=function(){var t=r.util.createBuffer();t.putBytes(i.bytes());var a=p.fullMessageLength[p.fullMessageLength.length-1]+p.messageLengthSize,l=a&p.blockLength-1,u,c;t.putBytes(s.substr(0,p.blockLength-l));for(var f=8*p.fullMessageLength[0],d=0;d>>0,f+=c,t.putInt32(f>>>0),f=u>>>0;t.putInt32(f);for(var m=new Array(n.length),d=0;d=128;){for(B=0;B<16;++B)t[B][0]=n.getInt32()>>>0,t[B][1]=n.getInt32()>>>0;for(;B<80;++B)N=t[B-2],O=N[0],P=N[1],r=((O>>>19|P<<13)^(P>>>29|O<<3)^O>>>6)>>>0,i=((O<<13|P>>>19)^(P<<3|O>>>29)^(O<<26|P>>>6))>>>0,M=t[B-15],O=M[0],P=M[1],o=((O>>>1|P<<31)^(O>>>8|P<<24)^O>>>7)>>>0,s=((O<<31|P>>>1)^(O<<24|P>>>8)^(O<<25|P>>>7))>>>0,D=t[B-7],F=t[B-16],P=i+D[1]+s+F[1],t[B][0]=r+D[0]+o+F[0]+(P/4294967296>>>0)>>>0,t[B][1]=P>>>0;for(g=e[0][0],y=e[0][1],v=e[1][0],b=e[1][1],_=e[2][0],w=e[2][1],k=e[3][0],E=e[3][1],S=e[4][0],x=e[4][1],C=e[5][0],A=e[5][1],T=e[6][0],I=e[6][1],j=e[7][0],R=e[7][1],B=0;B<80;++B)c=((S>>>14|x<<18)^(S>>>18|x<<14)^(x>>>9|S<<23))>>>0,h=((S<<18|x>>>14)^(S<<14|x>>>18)^(x<<23|S>>>9))>>>0,f=(T^S&(C^T))>>>0,p=(I^x&(A^I))>>>0,a=((g>>>28|y<<4)^(y>>>2|g<<30)^(y>>>7|g<<25))>>>0,u=((g<<4|y>>>28)^(y<<30|g>>>2)^(y<<25|g>>>7))>>>0,d=(g&v|_&(g^v))>>>0,m=(y&b|w&(y^b))>>>0,P=R+h+p+l[B][1]+t[B][1],r=j+c+f+l[B][0]+t[B][0]+(P/4294967296>>>0)>>>0,i=P>>>0,P=u+m,o=a+d+(P/4294967296>>>0)>>>0,s=P>>>0,j=T,R=I,T=C,I=A,C=S,A=x,P=E+i,S=k+r+(P/4294967296>>>0)>>>0,x=P>>>0,k=_,E=w,_=v,w=b,v=g,b=y,P=i+s,g=r+o+(P/4294967296>>>0)>>>0,y=P>>>0;P=e[0][1]+y,e[0][0]=e[0][0]+g+(P/4294967296>>>0)>>>0,e[0][1]=P>>>0,P=e[1][1]+b,e[1][0]=e[1][0]+v+(P/4294967296>>>0)>>>0,e[1][1]=P>>>0,P=e[2][1]+w,e[2][0]=e[2][0]+_+(P/4294967296>>>0)>>>0,e[2][1]=P>>>0,P=e[3][1]+E,e[3][0]=e[3][0]+k+(P/4294967296>>>0)>>>0,e[3][1]=P>>>0,P=e[4][1]+x,e[4][0]=e[4][0]+S+(P/4294967296>>>0)>>>0,e[4][1]=P>>>0,P=e[5][1]+A,e[5][0]=e[5][0]+C+(P/4294967296>>>0)>>>0,e[5][1]=P>>>0,P=e[6][1]+I,e[6][0]=e[6][0]+T+(P/4294967296>>>0)>>>0,e[6][1]=P>>>0,P=e[7][1]+R,e[7][0]=e[7][0]+j+(P/4294967296>>>0)>>>0,e[7][1]=P>>>0,L-=128}}},function(e,t,n){"use strict";(function(t){const r=n(56),i=n(57),o=n(70),s=n(770),a=i(n(249));class l{constructor(e){this._key=m(e,s.publicKeyLength)}verify(e,t,n){d(n),s.hashAndVerify(this._key,t,e,n)}marshal(){return t.from(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),r(this.bytes,"sha2-256",e)}}class u{constructor(e,t){this._key=m(e,s.privateKeyLength),this._publicKey=m(t,s.publicKeyLength)}sign(e,t){d(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new l(this._publicKey)}marshal(){return t.concat([t.from(this._key),t.from(this._publicKey)])}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),r(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,n)=>{if(t)return e(t);e(null,o.encode(n))})}}function c(e,t){try{e=m(e,s.privateKeyLength+s.publicKeyLength)}catch(e){return t(e)}const n=e.slice(0,s.privateKeyLength),r=e.slice(s.privateKeyLength,e.length);t(null,new u(n,r))}function h(e){return e=m(e,s.publicKeyLength),new l(e)}function f(e,t){void 0===t&&"function"==typeof e&&(t=e),s.generateKey((e,n)=>{if(e)return t(e);let r;try{r=new u(n.secretKey,n.publicKey)}catch(e){return void t(e)}t(null,r)})}function p(e,t,n){void 0===n&&"function"==typeof t&&(n=t),s.generateKeyFromSeed(e,(e,t)=>{if(e)return n(e);let r;try{r=new u(t.secretKey,t.publicKey)}catch(e){return void n(e)}n(null,r)})}function d(e){if("function"!=typeof e)throw new Error("callback is required")}function m(e,n){if(t.isBuffer(e)&&(e=new Uint8Array(e)),!(e instanceof Uint8Array)||e.length!==n)throw new Error("Key must be a Uint8Array or Buffer of length "+n);return e}e.exports={Ed25519PublicKey:l,Ed25519PrivateKey:u,unmarshalEd25519PrivateKey:c,unmarshalEd25519PublicKey:h,generateKeyPair:f,generateKeyPairFromSeed:p}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(e){const r=n(771),i=n(47);t.publicKeyLength=r.sign.publicKeyLength,t.privateKeyLength=r.sign.secretKeyLength,t.generateKey=function(e){i(()=>{let t;try{t=r.sign.keyPair()}catch(t){return e(t)}e(null,t)})},t.generateKeyFromSeed=function(e,t){i(()=>{let n;try{n=r.sign.keyPair.fromSeed(e)}catch(e){return t(e)}t(null,n)})},t.hashAndSign=function(t,n,o){i(()=>{o(null,e.from(r.sign.detached(n,t)))})},t.hashAndVerify=function(e,t,n,o){i(()=>{let i;try{i=r.sign.detached.verify(n,t,e)}catch(e){return o(e)}o(null,i)})}}).call(this,n(0).Buffer)},function(e,t,n){!function(e){"use strict";var t=function(e){var t,n=new Float64Array(16);if(e)for(t=0;t>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=255&r}function m(e,t,n,r,i){var o,s=0;for(o=0;o>>8)-1}function g(e,t,n,r){return m(e,t,n,r,16)}function y(e,t,n,r){return m(e,t,n,r,32)}function v(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,l=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,h=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,f=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,v=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,b=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,_=i,w=o,k=s,E=a,S=l,x=u,C=c,A=h,T=f,I=p,j=d,R=m,B=g,O=y,P=v,N=b,D,M=0;M<20;M+=2)D=_+B|0,S^=D<<7|D>>>25,D=S+_|0,T^=D<<9|D>>>23,D=T+S|0,B^=D<<13|D>>>19,D=B+T|0,_^=D<<18|D>>>14,D=x+w|0,I^=D<<7|D>>>25,D=I+x|0,O^=D<<9|D>>>23,D=O+I|0,w^=D<<13|D>>>19,D=w+O|0,x^=D<<18|D>>>14,D=j+C|0,P^=D<<7|D>>>25,D=P+j|0,k^=D<<9|D>>>23,D=k+P|0,C^=D<<13|D>>>19,D=C+k|0,j^=D<<18|D>>>14,D=N+R|0,E^=D<<7|D>>>25,D=E+N|0,A^=D<<9|D>>>23,D=A+E|0,R^=D<<13|D>>>19,D=R+A|0,N^=D<<18|D>>>14,D=_+E|0,w^=D<<7|D>>>25,D=w+_|0,k^=D<<9|D>>>23,D=k+w|0,E^=D<<13|D>>>19,D=E+k|0,_^=D<<18|D>>>14,D=x+S|0,C^=D<<7|D>>>25,D=C+x|0,A^=D<<9|D>>>23,D=A+C|0,S^=D<<13|D>>>19,D=S+A|0,x^=D<<18|D>>>14,D=j+I|0,R^=D<<7|D>>>25,D=R+j|0,T^=D<<9|D>>>23,D=T+R|0,I^=D<<13|D>>>19,D=I+T|0,j^=D<<18|D>>>14,D=N+P|0,B^=D<<7|D>>>25,D=B+N|0,O^=D<<9|D>>>23,D=O+B|0,P^=D<<13|D>>>19,D=P+O|0,N^=D<<18|D>>>14;_=_+i|0,w=w+o|0,k=k+s|0,E=E+a|0,S=S+l|0,x=x+u|0,C=C+c|0,A=A+h|0,T=T+f|0,I=I+p|0,j=j+d|0,R=R+m|0,B=B+g|0,O=O+y|0,P=P+v|0,N=N+b|0,e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=w>>>0&255,e[5]=w>>>8&255,e[6]=w>>>16&255,e[7]=w>>>24&255,e[8]=k>>>0&255,e[9]=k>>>8&255,e[10]=k>>>16&255,e[11]=k>>>24&255,e[12]=E>>>0&255,e[13]=E>>>8&255,e[14]=E>>>16&255,e[15]=E>>>24&255,e[16]=S>>>0&255,e[17]=S>>>8&255,e[18]=S>>>16&255,e[19]=S>>>24&255,e[20]=x>>>0&255,e[21]=x>>>8&255,e[22]=x>>>16&255,e[23]=x>>>24&255,e[24]=C>>>0&255,e[25]=C>>>8&255,e[26]=C>>>16&255,e[27]=C>>>24&255,e[28]=A>>>0&255,e[29]=A>>>8&255,e[30]=A>>>16&255,e[31]=A>>>24&255,e[32]=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]=j>>>0&255,e[41]=j>>>8&255,e[42]=j>>>16&255,e[43]=j>>>24&255,e[44]=R>>>0&255,e[45]=R>>>8&255,e[46]=R>>>16&255,e[47]=R>>>24&255,e[48]=B>>>0&255,e[49]=B>>>8&255,e[50]=B>>>16&255,e[51]=B>>>24&255,e[52]=O>>>0&255,e[53]=O>>>8&255,e[54]=O>>>16&255,e[55]=O>>>24&255,e[56]=P>>>0&255,e[57]=P>>>8&255,e[58]=P>>>16&255,e[59]=P>>>24&255,e[60]=N>>>0&255,e[61]=N>>>8&255,e[62]=N>>>16&255,e[63]=N>>>24&255}function b(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,l=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,h=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,f=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,v=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,b=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,_=i,w=o,k=s,E=a,S=l,x=u,C=c,A=h,T=f,I=p,j=d,R=m,B=g,O=y,P=v,N=b,D,M=0;M<20;M+=2)D=_+B|0,S^=D<<7|D>>>25,D=S+_|0,T^=D<<9|D>>>23,D=T+S|0,B^=D<<13|D>>>19,D=B+T|0,_^=D<<18|D>>>14,D=x+w|0,I^=D<<7|D>>>25,D=I+x|0,O^=D<<9|D>>>23,D=O+I|0,w^=D<<13|D>>>19,D=w+O|0,x^=D<<18|D>>>14,D=j+C|0,P^=D<<7|D>>>25,D=P+j|0,k^=D<<9|D>>>23,D=k+P|0,C^=D<<13|D>>>19,D=C+k|0,j^=D<<18|D>>>14,D=N+R|0,E^=D<<7|D>>>25,D=E+N|0,A^=D<<9|D>>>23,D=A+E|0,R^=D<<13|D>>>19,D=R+A|0,N^=D<<18|D>>>14,D=_+E|0,w^=D<<7|D>>>25,D=w+_|0,k^=D<<9|D>>>23,D=k+w|0,E^=D<<13|D>>>19,D=E+k|0,_^=D<<18|D>>>14,D=x+S|0,C^=D<<7|D>>>25,D=C+x|0,A^=D<<9|D>>>23,D=A+C|0,S^=D<<13|D>>>19,D=S+A|0,x^=D<<18|D>>>14,D=j+I|0,R^=D<<7|D>>>25,D=R+j|0,T^=D<<9|D>>>23,D=T+R|0,I^=D<<13|D>>>19,D=I+T|0,j^=D<<18|D>>>14,D=N+P|0,B^=D<<7|D>>>25,D=B+N|0,O^=D<<9|D>>>23,D=O+B|0,P^=D<<13|D>>>19,D=P+O|0,N^=D<<18|D>>>14;e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=x>>>0&255,e[5]=x>>>8&255,e[6]=x>>>16&255,e[7]=x>>>24&255,e[8]=j>>>0&255,e[9]=j>>>8&255,e[10]=j>>>16&255,e[11]=j>>>24&255,e[12]=N>>>0&255,e[13]=N>>>8&255,e[14]=N>>>16&255,e[15]=N>>>24&255,e[16]=C>>>0&255,e[17]=C>>>8&255,e[18]=C>>>16&255,e[19]=C>>>24&255,e[20]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=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,n,r){v(e,t,n,r)}function w(e,t,n,r){b(e,t,n,r)}var k=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function E(e,t,n,r,i,o,s){var a=new Uint8Array(16),l=new Uint8Array(64),u,c;for(c=0;c<16;c++)a[c]=0;for(c=0;c<8;c++)a[c]=o[c];for(;i>=64;){for(_(l,a,s,k),c=0;c<64;c++)e[t+c]=n[r+c]^l[c];for(u=1,c=8;c<16;c++)u=u+(255&a[c])|0,a[c]=255&u,u>>>=8;i-=64,t+=64,r+=64}if(i>0)for(_(l,a,s,k),c=0;c=64;){for(_(s,o,i,k),l=0;l<64;l++)e[t+l]=s[l];for(a=1,l=8;l<16;l++)a=a+(255&o[l])|0,o[l]=255&a,a>>>=8;n-=64,t+=64}if(n>0)for(_(s,o,i,k),l=0;l>>13|n<<3),r=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(n>>>10|r<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(r>>>7|i<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|s<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(s>>>11|a<<5),l=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|l<<8),this.r[9]=l>>>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,n,r,i,o){var s=new A(o);return s.update(n,r,i),s.finish(e,t),0}function I(e,t,n,r,i,o){var s=new Uint8Array(16);return T(s,0,n,r,i,o),g(e,t,s,0)}function j(e,t,n,r,i){var o;if(n<32)return-1;for(C(e,0,t,0,n,r,i),T(e,16,e,32,n-32,e),o=0;o<16;o++)e[o]=0;return 0}function R(e,t,n,r,i){var o,s=new Uint8Array(32);if(n<32)return-1;if(x(s,0,32,r,i),0!==I(t,16,t,32,n-32,s))return-1;for(C(e,0,t,0,n,r,i),o=0;o<32;o++)e[o]=0;return 0}function B(e,t){var n;for(n=0;n<16;n++)e[n]=0|t[n]}function O(e){var t,n,r=1;for(t=0;t<16;t++)n=e[t]+r+65535,r=Math.floor(n/65536),e[t]=n-65536*r;e[0]+=r-1+37*(r-1)}function P(e,t,n){for(var r,i=~(n-1),o=0;o<16;o++)r=i&(e[o]^t[o]),e[o]^=r,t[o]^=r}function N(e,n){var r,i,o,s=t(),a=t();for(r=0;r<16;r++)a[r]=n[r];for(O(a),O(a),O(a),i=0;i<2;i++){for(s[0]=a[0]-65517,r=1;r<15;r++)s[r]=a[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),o=s[15]>>16&1,s[14]&=65535,P(a,s,1-o)}for(r=0;r<16;r++)e[2*r]=255&a[r],e[2*r+1]=a[r]>>8}function D(e,t){var n=new Uint8Array(32),r=new Uint8Array(32);return N(n,e),N(r,t),y(n,0,r,0)}function M(e){var t=new Uint8Array(32);return N(t,e),1&t[0]}function F(e,t){var n;for(n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function L(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]+n[r]}function U(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]-n[r]}function q(e,t,n){var r,i,o=0,s=0,a=0,l=0,u=0,c=0,h=0,f=0,p=0,d=0,m=0,g=0,y=0,v=0,b=0,_=0,w=0,k=0,E=0,S=0,x=0,C=0,A=0,T=0,I=0,j=0,R=0,B=0,O=0,P=0,N=0,D=n[0],M=n[1],F=n[2],L=n[3],U=n[4],q=n[5],z=n[6],K=n[7],H=n[8],V=n[9],$=n[10],W=n[11],G=n[12],Y=n[13],Z=n[14],J=n[15];r=t[0],o+=r*D,s+=r*M,a+=r*F,l+=r*L,u+=r*U,c+=r*q,h+=r*z,f+=r*K,p+=r*H,d+=r*V,m+=r*$,g+=r*W,y+=r*G,v+=r*Y,b+=r*Z,_+=r*J,r=t[1],s+=r*D,a+=r*M,l+=r*F,u+=r*L,c+=r*U,h+=r*q,f+=r*z,p+=r*K,d+=r*H,m+=r*V,g+=r*$,y+=r*W,v+=r*G,b+=r*Y,_+=r*Z,w+=r*J,r=t[2],a+=r*D,l+=r*M,u+=r*F,c+=r*L,h+=r*U,f+=r*q,p+=r*z,d+=r*K,m+=r*H,g+=r*V,y+=r*$,v+=r*W,b+=r*G,_+=r*Y,w+=r*Z,k+=r*J,r=t[3],l+=r*D,u+=r*M,c+=r*F,h+=r*L,f+=r*U,p+=r*q,d+=r*z,m+=r*K,g+=r*H,y+=r*V,v+=r*$,b+=r*W,_+=r*G,w+=r*Y,k+=r*Z,E+=r*J,r=t[4],u+=r*D,c+=r*M,h+=r*F,f+=r*L,p+=r*U,d+=r*q,m+=r*z,g+=r*K,y+=r*H,v+=r*V,b+=r*$,_+=r*W,w+=r*G,k+=r*Y,E+=r*Z,S+=r*J,r=t[5],c+=r*D,h+=r*M,f+=r*F,p+=r*L,d+=r*U,m+=r*q,g+=r*z,y+=r*K,v+=r*H,b+=r*V,_+=r*$,w+=r*W,k+=r*G,E+=r*Y,S+=r*Z,x+=r*J,r=t[6],h+=r*D,f+=r*M,p+=r*F,d+=r*L,m+=r*U,g+=r*q,y+=r*z,v+=r*K,b+=r*H,_+=r*V,w+=r*$,k+=r*W,E+=r*G,S+=r*Y,x+=r*Z,C+=r*J,r=t[7],f+=r*D,p+=r*M,d+=r*F,m+=r*L,g+=r*U,y+=r*q,v+=r*z,b+=r*K,_+=r*H,w+=r*V,k+=r*$,E+=r*W,S+=r*G,x+=r*Y,C+=r*Z,A+=r*J,r=t[8],p+=r*D,d+=r*M,m+=r*F,g+=r*L,y+=r*U,v+=r*q,b+=r*z,_+=r*K,w+=r*H,k+=r*V,E+=r*$,S+=r*W,x+=r*G,C+=r*Y,A+=r*Z,T+=r*J,r=t[9],d+=r*D,m+=r*M,g+=r*F,y+=r*L,v+=r*U,b+=r*q,_+=r*z,w+=r*K,k+=r*H,E+=r*V,S+=r*$,x+=r*W,C+=r*G,A+=r*Y,T+=r*Z,I+=r*J,r=t[10],m+=r*D,g+=r*M,y+=r*F,v+=r*L,b+=r*U,_+=r*q,w+=r*z,k+=r*K,E+=r*H,S+=r*V,x+=r*$,C+=r*W,A+=r*G,T+=r*Y,I+=r*Z,j+=r*J,r=t[11],g+=r*D,y+=r*M,v+=r*F,b+=r*L,_+=r*U,w+=r*q,k+=r*z,E+=r*K,S+=r*H,x+=r*V,C+=r*$,A+=r*W,T+=r*G,I+=r*Y,j+=r*Z,R+=r*J,r=t[12],y+=r*D,v+=r*M,b+=r*F,_+=r*L,w+=r*U,k+=r*q,E+=r*z,S+=r*K,x+=r*H,C+=r*V,A+=r*$,T+=r*W,I+=r*G,j+=r*Y,R+=r*Z,B+=r*J,r=t[13],v+=r*D,b+=r*M,_+=r*F,w+=r*L,k+=r*U,E+=r*q,S+=r*z,x+=r*K,C+=r*H,A+=r*V,T+=r*$,I+=r*W,j+=r*G,R+=r*Y,B+=r*Z,O+=r*J,r=t[14],b+=r*D,_+=r*M,w+=r*F,k+=r*L,E+=r*U,S+=r*q,x+=r*z,C+=r*K,A+=r*H,T+=r*V,I+=r*$,j+=r*W,R+=r*G,B+=r*Y,O+=r*Z,P+=r*J,r=t[15],_+=r*D,w+=r*M,k+=r*F,E+=r*L,S+=r*U,x+=r*q,C+=r*z,A+=r*K,T+=r*H,I+=r*V,j+=r*$,R+=r*W,B+=r*G,O+=r*Y,P+=r*Z,N+=r*J,o+=38*w,s+=38*k,a+=38*E,l+=38*S,u+=38*x,c+=38*C,h+=38*A,f+=38*T,p+=38*I,d+=38*j,m+=38*R,g+=38*B,y+=38*O,v+=38*P,b+=38*N,i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,o+=i-1+37*(i-1),i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=l,e[4]=u,e[5]=c,e[6]=h,e[7]=f,e[8]=p,e[9]=d,e[10]=m,e[11]=g,e[12]=y,e[13]=v,e[14]=b,e[15]=_}function z(e,t){q(e,t,t)}function K(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=253;i>=0;i--)z(r,r),2!==i&&4!==i&&q(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function H(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=250;i>=0;i--)z(r,r),1!==i&&q(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function V(e,n,r){var i=new Uint8Array(32),o=new Float64Array(80),s,a,u=t(),c=t(),h=t(),f=t(),p=t(),d=t();for(a=0;a<31;a++)i[a]=n[a];for(i[31]=127&n[31]|64,i[0]&=248,F(o,r),a=0;a<16;a++)c[a]=o[a],f[a]=u[a]=h[a]=0;for(u[0]=f[0]=1,a=254;a>=0;--a)s=i[a>>>3]>>>(7&a)&1,P(u,c,s),P(h,f,s),L(p,u,h),U(u,u,h),L(h,c,f),U(c,c,f),z(f,p),z(d,u),q(u,h,u),q(h,c,p),L(p,u,h),U(u,u,h),z(c,u),U(h,f,d),q(u,h,l),L(u,u,f),q(h,h,u),q(u,f,d),q(f,c,o),z(c,p),P(u,c,s),P(h,f,s);for(a=0;a<16;a++)o[a+16]=u[a],o[a+32]=h[a],o[a+48]=c[a],o[a+64]=f[a];var m=o.subarray(32),g=o.subarray(16);return K(m,m),q(g,g,m),N(e,g),0}function $(e,t){return V(e,t,o)}function W(e,t){return r(t,32),$(e,t)}function G(e,t,n){var r=new Uint8Array(32);return V(r,n,t),w(e,i,r,k)}A.prototype.blocks=function(e,t,n){for(var r=this.fin?0:2048,i,o,s,a,l,u,c,h,f,p,d,m,g,y,v,b,_,w,k,E=this.h[0],S=this.h[1],x=this.h[2],C=this.h[3],A=this.h[4],T=this.h[5],I=this.h[6],j=this.h[7],R=this.h[8],B=this.h[9],O=this.r[0],P=this.r[1],N=this.r[2],D=this.r[3],M=this.r[4],F=this.r[5],L=this.r[6],U=this.r[7],q=this.r[8],z=this.r[9];n>=16;)i=255&e[t+0]|(255&e[t+1])<<8,E+=8191&i,o=255&e[t+2]|(255&e[t+3])<<8,S+=8191&(i>>>13|o<<3),s=255&e[t+4]|(255&e[t+5])<<8,x+=8191&(o>>>10|s<<6),a=255&e[t+6]|(255&e[t+7])<<8,C+=8191&(s>>>7|a<<9),l=255&e[t+8]|(255&e[t+9])<<8,A+=8191&(a>>>4|l<<12),T+=l>>>1&8191,u=255&e[t+10]|(255&e[t+11])<<8,I+=8191&(l>>>14|u<<2),c=255&e[t+12]|(255&e[t+13])<<8,j+=8191&(u>>>11|c<<5),h=255&e[t+14]|(255&e[t+15])<<8,R+=8191&(c>>>8|h<<8),B+=h>>>5|r,f=0,p=f,p+=E*O,p+=S*(5*z),p+=x*(5*q),p+=C*(5*U),p+=A*(5*L),f=p>>>13,p&=8191,p+=T*(5*F),p+=I*(5*M),p+=j*(5*D),p+=R*(5*N),p+=B*(5*P),f+=p>>>13,p&=8191,d=f,d+=E*P,d+=S*O,d+=x*(5*z),d+=C*(5*q),d+=A*(5*U),f=d>>>13,d&=8191,d+=T*(5*L),d+=I*(5*F),d+=j*(5*M),d+=R*(5*D),d+=B*(5*N),f+=d>>>13,d&=8191,m=f,m+=E*N,m+=S*P,m+=x*O,m+=C*(5*z),m+=A*(5*q),f=m>>>13,m&=8191,m+=T*(5*U),m+=I*(5*L),m+=j*(5*F),m+=R*(5*M),m+=B*(5*D),f+=m>>>13,m&=8191,g=f,g+=E*D,g+=S*N,g+=x*P,g+=C*O,g+=A*(5*z),f=g>>>13,g&=8191,g+=T*(5*q),g+=I*(5*U),g+=j*(5*L),g+=R*(5*F),g+=B*(5*M),f+=g>>>13,g&=8191,y=f,y+=E*M,y+=S*D,y+=x*N,y+=C*P,y+=A*O,f=y>>>13,y&=8191,y+=T*(5*z),y+=I*(5*q),y+=j*(5*U),y+=R*(5*L),y+=B*(5*F),f+=y>>>13,y&=8191,v=f,v+=E*F,v+=S*M,v+=x*D,v+=C*N,v+=A*P,f=v>>>13,v&=8191,v+=T*O,v+=I*(5*z),v+=j*(5*q),v+=R*(5*U),v+=B*(5*L),f+=v>>>13,v&=8191,b=f,b+=E*L,b+=S*F,b+=x*M,b+=C*D,b+=A*N,f=b>>>13,b&=8191,b+=T*P,b+=I*O,b+=j*(5*z),b+=R*(5*q),b+=B*(5*U),f+=b>>>13,b&=8191,_=f,_+=E*U,_+=S*L,_+=x*F,_+=C*M,_+=A*D,f=_>>>13,_&=8191,_+=T*N,_+=I*P,_+=j*O,_+=R*(5*z),_+=B*(5*q),f+=_>>>13,_&=8191,w=f,w+=E*q,w+=S*U,w+=x*L,w+=C*F,w+=A*M,f=w>>>13,w&=8191,w+=T*D,w+=I*N,w+=j*P,w+=R*O,w+=B*(5*z),f+=w>>>13,w&=8191,k=f,k+=E*z,k+=S*q,k+=x*U,k+=C*L,k+=A*F,f=k>>>13,k&=8191,k+=T*M,k+=I*D,k+=j*N,k+=R*P,k+=B*O,f+=k>>>13,k&=8191,f=(f<<2)+f|0,f=f+p|0,p=8191&f,f>>>=13,d+=f,E=p,S=d,x=m,C=g,A=y,T=v,I=b,j=_,R=w,B=k,t+=16,n-=16;this.h[0]=E,this.h[1]=S,this.h[2]=x,this.h[3]=C,this.h[4]=A,this.h[5]=T,this.h[6]=I,this.h[7]=j,this.h[8]=R,this.h[9]=B},A.prototype.finish=function(e,t){var n=new Uint16Array(10),r,i,o,s;if(this.leftover){for(s=this.leftover,this.buffer[s++]=1;s<16;s++)this.buffer[s]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,s=2;s<10;s++)this.h[s]+=r,r=this.h[s]>>>13,this.h[s]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,n[0]=this.h[0]+5,r=n[0]>>>13,n[0]&=8191,s=1;s<10;s++)n[s]=this.h[s]+r,r=n[s]>>>13,n[s]&=8191;for(n[9]-=8192,i=(1^r)-1,s=0;s<10;s++)n[s]&=i;for(i=~i,s=0;s<10;s++)this.h[s]=this.h[s]&i|n[s];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,s=1;s<8;s++)o=(this.h[s]+this.pad[s]|0)+(o>>>16)|0,this.h[s]=65535&o;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},A.prototype.update=function(e,t,n){var r,i;if(this.leftover){for(i=16-this.leftover,i>n&&(i=n),r=0;r=16&&(i=n-n%16,this.blocks(e,t,i),t+=i,n-=i),n){for(r=0;r=128;){for(S=0;S<16;S++)x=8*S+G,i[S]=n[x+0]<<24|n[x+1]<<16|n[x+2]<<8|n[x+3],o[S]=n[x+4]<<24|n[x+5]<<16|n[x+6]<<8|n[x+7];for(S=0;S<80;S++)if(s=B,a=O,l=P,u=N,c=D,h=M,f=F,p=L,d=U,m=q,g=z,y=K,v=H,b=V,_=$,w=W,C=L,A=W,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=(D>>>14|H<<18)^(D>>>18|H<<14)^(H>>>9|D<<23),A=(H>>>14|D<<18)^(H>>>18|D<<14)^(D>>>9|H<<23),T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,C=D&M^~D&F,A=H&V^~H&$,T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,C=X[2*S],A=X[2*S+1],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,C=i[S%16],A=o[S%16],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,k=65535&j|R<<16,E=65535&T|I<<16,C=k,A=E,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=(B>>>28|U<<4)^(U>>>2|B<<30)^(U>>>7|B<<25),A=(U>>>28|B<<4)^(B>>>2|U<<30)^(B>>>7|U<<25),T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,C=B&O^B&P^O&P,A=U&q^U&z^q&z,T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,p=65535&j|R<<16,w=65535&T|I<<16,C=u,A=y,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=k,A=E,T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,u=65535&j|R<<16,y=65535&T|I<<16,O=s,P=a,N=l,D=u,M=c,F=h,L=f,B=p,q=d,z=m,K=g,H=y,V=v,$=b,W=_,U=w,S%16==15)for(x=0;x<16;x++)C=i[x],A=o[x],T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=i[(x+9)%16],A=o[(x+9)%16],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,k=i[(x+1)%16],E=o[(x+1)%16],C=(k>>>1|E<<31)^(k>>>8|E<<24)^k>>>7,A=(E>>>1|k<<31)^(E>>>8|k<<24)^(E>>>7|k<<25),T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,k=i[(x+14)%16],E=o[(x+14)%16],C=(k>>>19|E<<13)^(E>>>29|k<<3)^k>>>6,A=(E>>>19|k<<13)^(k>>>29|E<<3)^(E>>>6|k<<26),T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,i[x]=65535&j|R<<16,o[x]=65535&T|I<<16;C=B,A=U,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[0],A=t[0],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[0]=B=65535&j|R<<16,t[0]=U=65535&T|I<<16,C=O,A=q,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[1],A=t[1],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[1]=O=65535&j|R<<16,t[1]=q=65535&T|I<<16,C=P,A=z,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[2],A=t[2],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[2]=P=65535&j|R<<16,t[2]=z=65535&T|I<<16,C=N,A=K,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[3],A=t[3],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[3]=N=65535&j|R<<16,t[3]=K=65535&T|I<<16,C=D,A=H,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[4],A=t[4],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[4]=D=65535&j|R<<16,t[4]=H=65535&T|I<<16,C=M,A=V,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[5],A=t[5],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[5]=M=65535&j|R<<16,t[5]=V=65535&T|I<<16,C=F,A=$,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[6],A=t[6],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[6]=F=65535&j|R<<16,t[6]=$=65535&T|I<<16,C=L,A=W,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[7],A=t[7],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[7]=L=65535&j|R<<16,t[7]=W=65535&T|I<<16,G+=128,r-=128}return r}function te(e,t,n){var r=new Int32Array(8),i=new Int32Array(8),o=new Uint8Array(256),s,a=n;for(r[0]=1779033703,r[1]=3144134277,r[2]=1013904242,r[3]=2773480762,r[4]=1359893119,r[5]=2600822924,r[6]=528734635,r[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,ee(r,i,t,n),n%=128,s=0;s=0;--i)r=n[i/8|0]>>(7&i)&1,re(e,t,r),ne(t,e),ne(e,e),re(e,t,r)}function se(e,n){var r=[t(),t(),t(),t()];B(r[0],h),B(r[1],f),B(r[2],a),q(r[3],h,f),oe(e,r,n)}function ae(e,n,i){var o=new Uint8Array(64),s=[t(),t(),t(),t()],a;for(i||r(n,32),te(o,n,32),o[0]&=248,o[31]&=127,o[31]|=64,se(s,o),ie(e,s),a=0;a<32;a++)n[a+32]=e[a];return 0}var le=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 ue(e,t){var n,r,i,o;for(r=63;r>=32;--r){for(n=0,i=r-32,o=r-12;i>8,t[i]-=256*n;t[i]+=n,t[r]=0}for(n=0,i=0;i<32;i++)t[i]+=n-(t[31]>>4)*le[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*le[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function ce(e){var t=new Float64Array(64),n;for(n=0;n<64;n++)t[n]=e[n];for(n=0;n<64;n++)e[n]=0;ue(e,t)}function he(e,n,r,i){var o=new Uint8Array(64),s=new Uint8Array(64),a=new Uint8Array(64),l,u,c=new Float64Array(64),h=[t(),t(),t(),t()];te(o,i,32),o[0]&=248,o[31]&=127,o[31]|=64;var f=r+64;for(l=0;l>7&&U(e[0],s,e[0]),q(e[3],e[0],e[1]),0)}function pe(e,n,r,i){var o,s,a=new Uint8Array(32),l=new Uint8Array(64),u=[t(),t(),t(),t()],c=[t(),t(),t(),t()];if(s=-1,r<64)return-1;if(fe(c,i))return-1;for(o=0;o=0},e.sign.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(64);return ae(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(Oe(e),64!==e.length)throw new Error("bad secret key size");for(var t=new Uint8Array(32),n=0;n{o=o||n(774)(t);class s{constructor(e){o.validatePublicKey(e),this._key=e}verify(e,t,n){h(n),o.hashAndVerify(this._key,t,e,n)}marshal(){return o.compressPublicKey(this._key)}get bytes(){return e.PublicKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){h(e),i(this.bytes,"sha2-256",e)}}class a{constructor(e,t){this._key=e,this._publicKey=t||o.computePublicKey(e),o.validatePrivateKey(this._key),o.validatePublicKey(this._publicKey)}sign(e,t){h(t),o.hashAndSign(this._key,e,t)}get public(){return new s(this._publicKey)}marshal(){return this._key}get bytes(){return e.PrivateKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){h(e),i(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,n)=>{if(t)return e(t);e(null,r.encode(n))})}}function l(e,t){t(null,new a(e),null)}function u(e){return new s(e)}function c(e,t){void 0===t&&"function"==typeof e&&(t=e),h(t),o.generateKey((e,n)=>{if(e)return t(e);let r;try{r=new a(n)}catch(e){return t(e)}t(null,r)})}function h(e){if("function"!=typeof e)throw new Error("callback is required")}return{Secp256k1PublicKey:s,Secp256k1PrivateKey:a,unmarshalSecp256k1PrivateKey:l,unmarshalSecp256k1PublicKey:u,generateKeyPair:c}})},function(e,t,n){"use strict";const r=n(775),i=n(56),o=n(20),s="sha2-256";e.exports=(e=>{const t=32;function n(t){const n=(e,n)=>o(()=>t(e,n));let i;do{i=e(32)}while(!r.privateKeyVerify(i));n(null,i)}function a(e,t,n){const a=(e,t)=>o(()=>n(e,t));i.digest(t,s,(t,n)=>{if(t)return a(t);try{const i=r.sign(n,e),o=r.signatureExport(i.signature);return a(null,o)}catch(t){a(t)}})}function l(e,t,n,a){const l=(e,t)=>o(()=>a(e,t));i.digest(n,s,(n,i)=>{if(n)return l(n);try{t=r.signatureImport(t);const o=r.verify(i,t,e);return l(null,o)}catch(n){l(n)}})}function u(e){if(!r.publicKeyVerify(e))throw new Error("Invalid public key");return r.publicKeyConvert(e,!0)}function c(e){return r.publicKeyConvert(e,!1)}function h(e){if(!r.privateKeyVerify(e))throw new Error("Invalid private key")}function f(e){if(!r.publicKeyVerify(e))throw new Error("Invalid public key")}function p(e){return h(e),r.publicKeyCreate(e)}return{generateKey:n,privateKeyLength:32,hashAndSign:a,hashAndVerify:l,compressPublicKey:u,decompressPublicKey:c,validatePrivateKey:h,validatePublicKey:f,computePublicKey:p}})},function(e,t,n){"use strict";e.exports=n(776)(n(780))},function(e,t,n){"use strict";var r=n(777),i=n(778),o=n(379);function s(e,t){return void 0===e?t:(r.isBoolean(e,o.COMPRESSED_TYPE_INVALID),e)}e.exports=function(e){return{privateKeyVerify:function(t){return r.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),32===t.length&&e.privateKeyVerify(t)},privateKeyExport:function(t,n){r.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),n=s(n,!0);var a=e.privateKeyExport(t,n);return i.privateKeyExport(t,a,n)},privateKeyImport:function(t){if(r.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 r.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),e.privateKeyNegate(t)},privateKeyModInverse:function(t){return r.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),e.privateKeyModInverse(t)},privateKeyTweakAdd:function(t,n){return r.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),r.isBuffer(n,o.TWEAK_TYPE_INVALID),r.isBufferLength(n,32,o.TWEAK_LENGTH_INVALID),e.privateKeyTweakAdd(t,n)},privateKeyTweakMul:function(t,n){return r.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),r.isBuffer(n,o.TWEAK_TYPE_INVALID),r.isBufferLength(n,32,o.TWEAK_LENGTH_INVALID),e.privateKeyTweakMul(t,n)},publicKeyCreate:function(t,n){return r.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),n=s(n,!0),e.publicKeyCreate(t,n)},publicKeyConvert:function(t,n){return r.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),r.isBufferLength2(t,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),n=s(n,!0),e.publicKeyConvert(t,n)},publicKeyVerify:function(t){return r.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),e.publicKeyVerify(t)},publicKeyTweakAdd:function(t,n,i){return r.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),r.isBufferLength2(t,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),r.isBuffer(n,o.TWEAK_TYPE_INVALID),r.isBufferLength(n,32,o.TWEAK_LENGTH_INVALID),i=s(i,!0),e.publicKeyTweakAdd(t,n,i)},publicKeyTweakMul:function(t,n,i){return r.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),r.isBufferLength2(t,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),r.isBuffer(n,o.TWEAK_TYPE_INVALID),r.isBufferLength(n,32,o.TWEAK_LENGTH_INVALID),i=s(i,!0),e.publicKeyTweakMul(t,n,i)},publicKeyCombine:function(t,n){r.isArray(t,o.EC_PUBLIC_KEYS_TYPE_INVALID),r.isLengthGTZero(t,o.EC_PUBLIC_KEYS_LENGTH_INVALID);for(var i=0;i=n)throw RangeError(r)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(5).Buffer,i=n(779),o=r.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),s=r.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);t.privateKeyExport=function(e,t,n){var i=r.from(n?o:s);return e.copy(i,n?8:9),t.copy(i,n?181:214),i},t.privateKeyImport=function(e){var t=e.length,n=0;if(!(t2||t1?e[n+r-2]<<8:0);if(n+=r,!(t32||t1&&0===t[o]&&!(128&t[o+1]);--n,++o);for(var s=r.concat([r.from([0]),e.s]),a=33,l=0;a>1&&0===s[l]&&!(128&s[l+1]);--a,++l);return i.encode(t.slice(o),s.slice(l))},t.signatureImport=function(e){var t=r.alloc(32,0),n=r.alloc(32,0);try{var o=i.decode(e);if(33===o.r.length&&0===o.r[0]&&(o.r=o.r.slice(1)),o.r.length>32)throw new Error("R length is too long");if(33===o.s.length&&0===o.s[0]&&(o.s=o.s.slice(1)),o.s.length>32)throw new Error("S length is too long")}catch(e){return}return o.r.copy(t,32-o.r.length),o.s.copy(n,32-o.s.length),{r:t,s:n}},t.signatureImportLax=function(e){var t=r.alloc(32,0),n=r.alloc(32,0),i=e.length,o=0;if(48===e[o++]){var s=e[o++];if(!(128&s&&(o+=s-128,o>i))&&2===e[o++]){var a=e[o++];if(128&a){if(s=a-128,o+s>i)return;for(;s>0&&0===e[o];o+=1,s-=1);for(a=0;s>0;o+=1,s-=1)a=(a<<8)+e[o]}if(!(a>i-o)){var l=o;if(o+=a,2===e[o++]){var u=e[o++];if(128&u){if(s=u-128,o+s>i)return;for(;s>0&&0===e[o];o+=1,s-=1);for(u=0;s>0;o+=1,s-=1)u=(u<<8)+e[o]}if(!(u>i-o)){var c=o;for(o+=u;a>0&&0===e[l];a-=1,l+=1);if(!(a>32)){var h=e.slice(l,l+a);for(h.copy(t,32-h.length);u>0&&0===e[c];u-=1,c+=1);if(!(u>32)){var f=e.slice(c,c+u);return f.copy(n,32-f.length),{r:t,s:n}}}}}}}}}},function(e,t,n){var r=n(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 n=e[5+t];return 0!==n&&(6+t+n===e.length&&(!(128&e[4])&&(!(t>1&&0===e[4]&&!(128&e[5]))&&(!(128&e[t+6])&&!(n>1&&0===e[t+6]&&!(128&e[t+7]))))))}function o(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(48!==e[0])throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(2!==e[2])throw new Error("Expected DER integer");var t=e[3];if(0===t)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");var n=e[5+t];if(0===n)throw new Error("S length is zero");if(6+t+n!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw new Error("R value excessively padded");if(128&e[t+6])throw new Error("S value is negative");if(n>1&&0===e[t+6]&&!(128&e[t+7]))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}}function s(e,t){var n=e.length,i=t.length;if(0===n)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(n>33)throw new Error("R length is too long");if(i>33)throw new Error("S length is too long");if(128&e[0])throw new Error("R value is negative");if(128&t[0])throw new Error("S value is negative");if(n>1&&0===e[0]&&!(128&e[1]))throw new Error("R value excessively padded");if(i>1&&0===t[0]&&!(128&t[1]))throw new Error("S value excessively padded");var o=r.allocUnsafe(6+n+i);return o[0]=48,o[1]=o.length-2,o[2]=2,o[3]=e.length,e.copy(o,4),o[4+n]=2,o[5+n]=t.length,t.copy(o,6+n),o}e.exports={check:i,decode:o,encode:s}},function(e,t,n){"use strict";var r=n(5).Buffer,i=n(781),o=n(794),s=n(379),a=n(197),l=n(389),u=n(800);t.privateKeyVerify=function(e){var t=a.fromBuffer(e);return!(t.isOverflow()||t.isZero())},t.privateKeyExport=function(e,t){var n=a.fromBuffer(e);if(n.isOverflow()||n.isZero())throw new Error(s.EC_PRIVATE_KEY_EXPORT_DER_FAIL);return u.mul(n).toPublicKey(t)},t.privateKeyNegate=function(e){var t=a.fromBuffer(e);return t.isZero()?r.alloc(32):(t.ucmp(a.n)>0&&t.isub(a.n),a.n.sub(t).toBuffer())},t.privateKeyModInverse=function(e){var t=a.fromBuffer(e);if(t.isOverflow()||t.isZero())throw new Error(s.EC_PRIVATE_KEY_RANGE_INVALID);return t.uinvm().toBuffer()},t.privateKeyTweakAdd=function(e,t){var n=a.fromBuffer(t);if(n.isOverflow())throw new Error(s.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);if(n.iadd(a.fromBuffer(e)),n.isOverflow()&&n.isub(a.n),n.isZero())throw new Error(s.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);return n.toBuffer()},t.privateKeyTweakMul=function(e,t){var n=a.fromBuffer(t);if(n.isOverflow()||n.isZero())throw new Error(s.EC_PRIVATE_KEY_TWEAK_MUL_FAIL);var r=a.fromBuffer(e);return n.umul(r).ureduce().toBuffer()},t.publicKeyCreate=function(e,t){var n=a.fromBuffer(e);if(n.isOverflow()||n.isZero())throw new Error(s.EC_PUBLIC_KEY_CREATE_FAIL);return u.mul(n).toPublicKey(t)},t.publicKeyConvert=function(e,t){var n=l.fromPublicKey(e);if(null===n)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);return n.toPublicKey(t)},t.publicKeyVerify=function(e){return null!==l.fromPublicKey(e)},t.publicKeyTweakAdd=function(e,t,n){var r=l.fromPublicKey(e);if(null===r)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);if(t=a.fromBuffer(t),t.isOverflow())throw new Error(s.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);var i=u.mul(t).add(r);if(i.inf)throw new Error(s.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);return i.toPublicKey(n)},t.publicKeyTweakMul=function(e,t,n){var r=l.fromPublicKey(e);if(null===r)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);if(t=a.fromBuffer(t),t.isOverflow()||t.isZero())throw new Error(s.EC_PUBLIC_KEY_TWEAK_MUL_FAIL);return r.mul(t).toPublicKey(n)},t.publicKeyCombine=function(e,t){for(var n=new Array(e.length),r=0;r=0)&&0===r.iadd(a.psn).redMul(d).ucmp(p.x)},t.recover=function(e,t,n,i){var o=a.fromBuffer(t.slice(0,32)),c=a.fromBuffer(t.slice(32,64));if(o.isOverflow()||c.isOverflow())throw new Error(s.ECDSA_SIGNATURE_PARSE_FAIL);do{if(o.isZero()||c.isZero())break;var h=o;if(n>>1){if(h.ucmp(a.psn)>=0)break;h=o.add(a.n)}var f=r.concat([r.from([2+(1&n)]),h.toBuffer()]),p=l.fromPublicKey(f);if(null===p)break;var d=o.uinvm(),m=a.n.sub(a.fromBuffer(e)).umul(d).ureduce(),g=c.umul(d).ureduce(),y=l.fromECJPoint(u.mulAdd(m,p,g));return y.toPublicKey(i)}while(0);throw new Error(s.ECDSA_RECOVER_FAIL)},t.ecdh=function(e,n){var r=t.ecdhUnsafe(e,n,!0);return i("sha256").update(r).digest()},t.ecdhUnsafe=function(e,t,n){var r=l.fromPublicKey(e);if(null===r)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);var i=a.fromBuffer(t);if(i.isOverflow()||i.isZero())throw new Error(s.ECDH_FAIL);return r.mul(i).toPublicKey(n)}},function(e,t,n){"use strict";var r=n(1),i=n(257),o=n(385),s=n(386),a=n(99);function l(e){a.call(this,"digest"),this._hash=e}r(l,a),l.prototype._update=function(e){this._hash.update(e)},l.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 l(s(t))}},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=n(5).Buffer,o=n(784);function s(e,t,n){e.copy(t,n)}e.exports=function(){function e(){r(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function e(t){var n={data:t,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length},e.prototype.unshift=function e(t){var n={data:t,next:this.head};0===this.length&&(this.tail=n),this.head=n,++this.length},e.prototype.shift=function e(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},e.prototype.clear=function e(){this.head=this.tail=null,this.length=0},e.prototype.join=function e(t){if(0===this.length)return"";for(var n=this.head,r=""+n.data;n=n.next;)r+=t+n.data;return r},e.prototype.concat=function e(t){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var n=i.allocUnsafe(t>>>0),r=this.head,o=0;r;)s(r.data,n,o),o+=r.data.length,r=r.next;return n},e}(),o&&o.inspect&&o.inspect.custom&&(e.exports.prototype[o.inspect.custom]=function(){var e=o.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,n){"use strict";e.exports=o;var r=n(384),i=n(7);function o(e){if(!(this instanceof o))return new o(e);r.call(this,e)}i.inherits=n(1),i.inherits(o,r),o.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){e.exports=n(259)},function(e,t,n){e.exports=n(98)},function(e,t,n){e.exports=n(258).Transform},function(e,t,n){e.exports=n(258).PassThrough},function(e,t,n){var r=n(1),i=n(120),o=n(5).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function l(){this.init(),this._w=a,i.call(this,64,56)}function u(e){return e<<5|e>>>27}function c(e){return e<<30|e>>>2}function h(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}r(l,i),l.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},l.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,l=0;l<16;++l)t[l]=e.readInt32BE(4*l);for(;l<80;++l)t[l]=t[l-3]^t[l-8]^t[l-14]^t[l-16];for(var f=0;f<80;++f){var p=~~(f/20),d=u(n)+h(p,r,i,o)+a+t[f]+s[p]|0;a=o,o=i,i=c(r),r=n,n=d}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},l.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=l},function(e,t,n){var r=n(1),i=n(120),o=n(5).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function l(){this.init(),this._w=a,i.call(this,64,56)}function u(e){return e<<1|e>>>31}function c(e){return e<<5|e>>>27}function h(e){return e<<30|e>>>2}function f(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}r(l,i),l.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},l.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,l=0;l<16;++l)t[l]=e.readInt32BE(4*l);for(;l<80;++l)t[l]=u(t[l-3]^t[l-8]^t[l-14]^t[l-16]);for(var p=0;p<80;++p){var d=~~(p/20),m=c(n)+f(d,r,i,o)+a+t[p]+s[d]|0;a=o,o=i,i=h(r),r=n,n=m}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},l.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=l},function(e,t,n){var r=n(1),i=n(387),o=n(120),s=n(5).Buffer,a=new Array(64);function l(){this.init(),this._w=a,o.call(this,64,56)}r(l,i),l.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},l.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=l},function(e,t,n){var r=n(1),i=n(388),o=n(120),s=n(5).Buffer,a=new Array(160);function l(){this.init(),this._w=a,o.call(this,128,112)}r(l,i),l.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},l.prototype._hash=function(){var e=s.allocUnsafe(48);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},e.exports=l},function(e,t,n){"use strict";(function(t){var r=n(795),i=n(798),o=new t(0),s=new t([0]),a=new t([1]);function l(e,t,n,r){var o=i[e];if(void 0===o)throw new Error("hash "+e+" is not supported");this._algo=e,this._securityStrength=o.securityStrength/8,this._outlen=o.outlen/8,this._reseedInterval=281474976710656,this._init(t,n,r)}l.prototype._update=function(e){var t=r(this._algo,this._K).update(this._V).update(s);e&&t.update(e),this._K=t.digest(),this._V=r(this._algo,this._K).update(this._V).digest(),e&&(this._K=r(this._algo,this._K).update(this._V).update(a).update(e).digest(),this._V=r(this._algo,this._K).update(this._V).digest())},l.prototype._init=function(e,n,r){if(e.lengththis._reseedInterval)throw new Error("Reseed is required");n&&0===n.length&&(n=void 0),n&&this._update(n);for(var i=new t(0);i.lengthn){var r="rmd160"===e?new l:u(e);t=r.update(t).digest()}else t.lengtha?t=e(t):t.length>>13,p=0|r[1],d=8191&p,m=p>>>13,g=0|r[2],y=8191&g,v=g>>>13,b=0|r[3],_=8191&b,w=b>>>13,k=0|r[4],E=8191&k,S=k>>>13,x=0|r[5],C=8191&x,A=x>>>13,T=0|r[6],I=8191&T,j=T>>>13,R=0|r[7],B=8191&R,O=R>>>13,P=0|r[8],N=8191&P,D=P>>>13,M=0|r[9],F=8191&M,L=M>>>13,U=0|i[0],q=8191&U,z=U>>>13,K=0|i[1],H=8191&K,V=K>>>13,$=0|i[2],W=8191&$,G=$>>>13,Y=0|i[3],Z=8191&Y,J=Y>>>13,Q=0|i[4],X=8191&Q,ee=Q>>>13,te=0|i[5],ne=8191&te,re=te>>>13,ie=0|i[6],oe=8191&ie,se=ie>>>13,ae=0|i[7],le=8191&ae,ue=ae>>>13,ce=0|i[8],he=8191&ce,fe=ce>>>13,pe=0|i[9],de=8191&pe,me=pe>>>13;n.length=19,a=Math.imul(h,q),l=Math.imul(h,z),l+=Math.imul(f,q),u=Math.imul(f,z);var ge=s+a+((8191&l)<<13);s=u+(l>>>13)+(ge>>>26),ge&=67108863,a=Math.imul(d,q),l=Math.imul(d,z),l+=Math.imul(m,q),u=Math.imul(m,z),a+=Math.imul(h,H),l+=Math.imul(h,V),l+=Math.imul(f,H),u+=Math.imul(f,V);var ye=s+a+((8191&l)<<13);s=u+(l>>>13)+(ye>>>26),ye&=67108863,a=Math.imul(y,q),l=Math.imul(y,z),l+=Math.imul(v,q),u=Math.imul(v,z),a+=Math.imul(d,H),l+=Math.imul(d,V),l+=Math.imul(m,H),u+=Math.imul(m,V),a+=Math.imul(h,W),l+=Math.imul(h,G),l+=Math.imul(f,W),u+=Math.imul(f,G);var ve=s+a+((8191&l)<<13);s=u+(l>>>13)+(ve>>>26),ve&=67108863,a=Math.imul(_,q),l=Math.imul(_,z),l+=Math.imul(w,q),u=Math.imul(w,z),a+=Math.imul(y,H),l+=Math.imul(y,V),l+=Math.imul(v,H),u+=Math.imul(v,V),a+=Math.imul(d,W),l+=Math.imul(d,G),l+=Math.imul(m,W),u+=Math.imul(m,G),a+=Math.imul(h,Z),l+=Math.imul(h,J),l+=Math.imul(f,Z),u+=Math.imul(f,J);var be=s+a+((8191&l)<<13);s=u+(l>>>13)+(be>>>26),be&=67108863,a=Math.imul(E,q),l=Math.imul(E,z),l+=Math.imul(S,q),u=Math.imul(S,z),a+=Math.imul(_,H),l+=Math.imul(_,V),l+=Math.imul(w,H),u+=Math.imul(w,V),a+=Math.imul(y,W),l+=Math.imul(y,G),l+=Math.imul(v,W),u+=Math.imul(v,G),a+=Math.imul(d,Z),l+=Math.imul(d,J),l+=Math.imul(m,Z),u+=Math.imul(m,J),a+=Math.imul(h,X),l+=Math.imul(h,ee),l+=Math.imul(f,X),u+=Math.imul(f,ee);var _e=s+a+((8191&l)<<13);s=u+(l>>>13)+(_e>>>26),_e&=67108863,a=Math.imul(C,q),l=Math.imul(C,z),l+=Math.imul(A,q),u=Math.imul(A,z),a+=Math.imul(E,H),l+=Math.imul(E,V),l+=Math.imul(S,H),u+=Math.imul(S,V),a+=Math.imul(_,W),l+=Math.imul(_,G),l+=Math.imul(w,W),u+=Math.imul(w,G),a+=Math.imul(y,Z),l+=Math.imul(y,J),l+=Math.imul(v,Z),u+=Math.imul(v,J),a+=Math.imul(d,X),l+=Math.imul(d,ee),l+=Math.imul(m,X),u+=Math.imul(m,ee),a+=Math.imul(h,ne),l+=Math.imul(h,re),l+=Math.imul(f,ne),u+=Math.imul(f,re);var we=s+a+((8191&l)<<13);s=u+(l>>>13)+(we>>>26),we&=67108863,a=Math.imul(I,q),l=Math.imul(I,z),l+=Math.imul(j,q),u=Math.imul(j,z),a+=Math.imul(C,H),l+=Math.imul(C,V),l+=Math.imul(A,H),u+=Math.imul(A,V),a+=Math.imul(E,W),l+=Math.imul(E,G),l+=Math.imul(S,W),u+=Math.imul(S,G),a+=Math.imul(_,Z),l+=Math.imul(_,J),l+=Math.imul(w,Z),u+=Math.imul(w,J),a+=Math.imul(y,X),l+=Math.imul(y,ee),l+=Math.imul(v,X),u+=Math.imul(v,ee),a+=Math.imul(d,ne),l+=Math.imul(d,re),l+=Math.imul(m,ne),u+=Math.imul(m,re),a+=Math.imul(h,oe),l+=Math.imul(h,se),l+=Math.imul(f,oe),u+=Math.imul(f,se);var ke=s+a+((8191&l)<<13);s=u+(l>>>13)+(ke>>>26),ke&=67108863,a=Math.imul(B,q),l=Math.imul(B,z),l+=Math.imul(O,q),u=Math.imul(O,z),a+=Math.imul(I,H),l+=Math.imul(I,V),l+=Math.imul(j,H),u+=Math.imul(j,V),a+=Math.imul(C,W),l+=Math.imul(C,G),l+=Math.imul(A,W),u+=Math.imul(A,G),a+=Math.imul(E,Z),l+=Math.imul(E,J),l+=Math.imul(S,Z),u+=Math.imul(S,J),a+=Math.imul(_,X),l+=Math.imul(_,ee),l+=Math.imul(w,X),u+=Math.imul(w,ee),a+=Math.imul(y,ne),l+=Math.imul(y,re),l+=Math.imul(v,ne),u+=Math.imul(v,re),a+=Math.imul(d,oe),l+=Math.imul(d,se),l+=Math.imul(m,oe),u+=Math.imul(m,se),a+=Math.imul(h,le),l+=Math.imul(h,ue),l+=Math.imul(f,le),u+=Math.imul(f,ue);var Ee=s+a+((8191&l)<<13);s=u+(l>>>13)+(Ee>>>26),Ee&=67108863,a=Math.imul(N,q),l=Math.imul(N,z),l+=Math.imul(D,q),u=Math.imul(D,z),a+=Math.imul(B,H),l+=Math.imul(B,V),l+=Math.imul(O,H),u+=Math.imul(O,V),a+=Math.imul(I,W),l+=Math.imul(I,G),l+=Math.imul(j,W),u+=Math.imul(j,G),a+=Math.imul(C,Z),l+=Math.imul(C,J),l+=Math.imul(A,Z),u+=Math.imul(A,J),a+=Math.imul(E,X),l+=Math.imul(E,ee),l+=Math.imul(S,X),u+=Math.imul(S,ee),a+=Math.imul(_,ne),l+=Math.imul(_,re),l+=Math.imul(w,ne),u+=Math.imul(w,re),a+=Math.imul(y,oe),l+=Math.imul(y,se),l+=Math.imul(v,oe),u+=Math.imul(v,se),a+=Math.imul(d,le),l+=Math.imul(d,ue),l+=Math.imul(m,le),u+=Math.imul(m,ue),a+=Math.imul(h,he),l+=Math.imul(h,fe),l+=Math.imul(f,he),u+=Math.imul(f,fe);var Se=s+a+((8191&l)<<13);s=u+(l>>>13)+(Se>>>26),Se&=67108863,a=Math.imul(F,q),l=Math.imul(F,z),l+=Math.imul(L,q),u=Math.imul(L,z),a+=Math.imul(N,H),l+=Math.imul(N,V),l+=Math.imul(D,H),u+=Math.imul(D,V),a+=Math.imul(B,W),l+=Math.imul(B,G),l+=Math.imul(O,W),u+=Math.imul(O,G),a+=Math.imul(I,Z),l+=Math.imul(I,J),l+=Math.imul(j,Z),u+=Math.imul(j,J),a+=Math.imul(C,X),l+=Math.imul(C,ee),l+=Math.imul(A,X),u+=Math.imul(A,ee),a+=Math.imul(E,ne),l+=Math.imul(E,re),l+=Math.imul(S,ne),u+=Math.imul(S,re),a+=Math.imul(_,oe),l+=Math.imul(_,se),l+=Math.imul(w,oe),u+=Math.imul(w,se),a+=Math.imul(y,le),l+=Math.imul(y,ue),l+=Math.imul(v,le),u+=Math.imul(v,ue),a+=Math.imul(d,he),l+=Math.imul(d,fe),l+=Math.imul(m,he),u+=Math.imul(m,fe),a+=Math.imul(h,de),l+=Math.imul(h,me),l+=Math.imul(f,de),u+=Math.imul(f,me);var xe=s+a+((8191&l)<<13);s=u+(l>>>13)+(xe>>>26),xe&=67108863,a=Math.imul(F,H),l=Math.imul(F,V),l+=Math.imul(L,H),u=Math.imul(L,V),a+=Math.imul(N,W),l+=Math.imul(N,G),l+=Math.imul(D,W),u+=Math.imul(D,G),a+=Math.imul(B,Z),l+=Math.imul(B,J),l+=Math.imul(O,Z),u+=Math.imul(O,J),a+=Math.imul(I,X),l+=Math.imul(I,ee),l+=Math.imul(j,X),u+=Math.imul(j,ee),a+=Math.imul(C,ne),l+=Math.imul(C,re),l+=Math.imul(A,ne),u+=Math.imul(A,re),a+=Math.imul(E,oe),l+=Math.imul(E,se),l+=Math.imul(S,oe),u+=Math.imul(S,se),a+=Math.imul(_,le),l+=Math.imul(_,ue),l+=Math.imul(w,le),u+=Math.imul(w,ue),a+=Math.imul(y,he),l+=Math.imul(y,fe),l+=Math.imul(v,he),u+=Math.imul(v,fe),a+=Math.imul(d,de),l+=Math.imul(d,me),l+=Math.imul(m,de),u+=Math.imul(m,me);var Ce=s+a+((8191&l)<<13);s=u+(l>>>13)+(Ce>>>26),Ce&=67108863,a=Math.imul(F,W),l=Math.imul(F,G),l+=Math.imul(L,W),u=Math.imul(L,G),a+=Math.imul(N,Z),l+=Math.imul(N,J),l+=Math.imul(D,Z),u+=Math.imul(D,J),a+=Math.imul(B,X),l+=Math.imul(B,ee),l+=Math.imul(O,X),u+=Math.imul(O,ee),a+=Math.imul(I,ne),l+=Math.imul(I,re),l+=Math.imul(j,ne),u+=Math.imul(j,re),a+=Math.imul(C,oe),l+=Math.imul(C,se),l+=Math.imul(A,oe),u+=Math.imul(A,se),a+=Math.imul(E,le),l+=Math.imul(E,ue),l+=Math.imul(S,le),u+=Math.imul(S,ue),a+=Math.imul(_,he),l+=Math.imul(_,fe),l+=Math.imul(w,he),u+=Math.imul(w,fe),a+=Math.imul(y,de),l+=Math.imul(y,me),l+=Math.imul(v,de),u+=Math.imul(v,me);var Ae=s+a+((8191&l)<<13);s=u+(l>>>13)+(Ae>>>26),Ae&=67108863,a=Math.imul(F,Z),l=Math.imul(F,J),l+=Math.imul(L,Z),u=Math.imul(L,J),a+=Math.imul(N,X),l+=Math.imul(N,ee),l+=Math.imul(D,X),u+=Math.imul(D,ee),a+=Math.imul(B,ne),l+=Math.imul(B,re),l+=Math.imul(O,ne),u+=Math.imul(O,re),a+=Math.imul(I,oe),l+=Math.imul(I,se),l+=Math.imul(j,oe),u+=Math.imul(j,se),a+=Math.imul(C,le),l+=Math.imul(C,ue),l+=Math.imul(A,le),u+=Math.imul(A,ue),a+=Math.imul(E,he),l+=Math.imul(E,fe),l+=Math.imul(S,he),u+=Math.imul(S,fe),a+=Math.imul(_,de),l+=Math.imul(_,me),l+=Math.imul(w,de),u+=Math.imul(w,me);var Te=s+a+((8191&l)<<13);s=u+(l>>>13)+(Te>>>26),Te&=67108863,a=Math.imul(F,X),l=Math.imul(F,ee),l+=Math.imul(L,X),u=Math.imul(L,ee),a+=Math.imul(N,ne),l+=Math.imul(N,re),l+=Math.imul(D,ne),u+=Math.imul(D,re),a+=Math.imul(B,oe),l+=Math.imul(B,se),l+=Math.imul(O,oe),u+=Math.imul(O,se),a+=Math.imul(I,le),l+=Math.imul(I,ue),l+=Math.imul(j,le),u+=Math.imul(j,ue),a+=Math.imul(C,he),l+=Math.imul(C,fe),l+=Math.imul(A,he),u+=Math.imul(A,fe),a+=Math.imul(E,de),l+=Math.imul(E,me),l+=Math.imul(S,de),u+=Math.imul(S,me);var Ie=s+a+((8191&l)<<13);s=u+(l>>>13)+(Ie>>>26),Ie&=67108863,a=Math.imul(F,ne),l=Math.imul(F,re),l+=Math.imul(L,ne),u=Math.imul(L,re),a+=Math.imul(N,oe),l+=Math.imul(N,se),l+=Math.imul(D,oe),u+=Math.imul(D,se),a+=Math.imul(B,le),l+=Math.imul(B,ue),l+=Math.imul(O,le),u+=Math.imul(O,ue),a+=Math.imul(I,he),l+=Math.imul(I,fe),l+=Math.imul(j,he),u+=Math.imul(j,fe),a+=Math.imul(C,de),l+=Math.imul(C,me),l+=Math.imul(A,de),u+=Math.imul(A,me);var je=s+a+((8191&l)<<13);s=u+(l>>>13)+(je>>>26),je&=67108863,a=Math.imul(F,oe),l=Math.imul(F,se),l+=Math.imul(L,oe),u=Math.imul(L,se),a+=Math.imul(N,le),l+=Math.imul(N,ue),l+=Math.imul(D,le),u+=Math.imul(D,ue),a+=Math.imul(B,he),l+=Math.imul(B,fe),l+=Math.imul(O,he),u+=Math.imul(O,fe),a+=Math.imul(I,de),l+=Math.imul(I,me),l+=Math.imul(j,de),u+=Math.imul(j,me);var Re=s+a+((8191&l)<<13);s=u+(l>>>13)+(Re>>>26),Re&=67108863,a=Math.imul(F,le),l=Math.imul(F,ue),l+=Math.imul(L,le),u=Math.imul(L,ue),a+=Math.imul(N,he),l+=Math.imul(N,fe),l+=Math.imul(D,he),u+=Math.imul(D,fe),a+=Math.imul(B,de),l+=Math.imul(B,me),l+=Math.imul(O,de),u+=Math.imul(O,me);var Be=s+a+((8191&l)<<13);s=u+(l>>>13)+(Be>>>26),Be&=67108863,a=Math.imul(F,he),l=Math.imul(F,fe),l+=Math.imul(L,he),u=Math.imul(L,fe),a+=Math.imul(N,de),l+=Math.imul(N,me),l+=Math.imul(D,de),u+=Math.imul(D,me);var Oe=s+a+((8191&l)<<13);s=u+(l>>>13)+(Oe>>>26),Oe&=67108863,a=Math.imul(F,de),l=Math.imul(F,me),l+=Math.imul(L,de),u=Math.imul(L,me);var Pe=s+a+((8191&l)<<13);return s=u+(l>>>13)+(Pe>>>26),Pe&=67108863,o[0]=ge,o[1]=ye,o[2]=ve,o[3]=be,o[4]=_e,o[5]=we,o[6]=ke,o[7]=Ee,o[8]=Se,o[9]=xe,o[10]=Ce,o[11]=Ae,o[12]=Te,o[13]=Ie,o[14]=je,o[15]=Re,o[16]=Be,o[17]=Oe,o[18]=Pe,0!==s&&(o[19]=s,n.length++),n}},function(e,t,n){"use strict";var r=n(5).Buffer,i=n(197),o=n(389),s=n(390);function a(){this.x=i.fromBuffer(r.from("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","hex")),this.y=i.fromBuffer(r.from("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8","hex")),this.inf=!1,this._precompute()}a.prototype._precompute=function(){for(var e=new o(this.x,this.y),t=4,n=new Array(1+Math.ceil(64.25)),r=n[0]=e,i=1;i=u;h--)c=(c<<1)+i[h];l.push(c)}for(var f=new s(null,null,null),p=new s(null,null,null),d=a;d>0;d--){for(var m=0;m=0;c--){for(var h=0;c>=0&&(u[0]=0|a[0][c],u[1]=0|a[1][c],0===u[0]&&0===u[1]);++h,--c);if(c>=0&&(h+=1),l=l.dblp(h),c<0)break;for(var f=0;f<2;f++){var p=u[f],d;0!==p&&(p>0?d=o[f][p>>1]:p<0&&(d=o[f][-p>>1].neg()),l=void 0===d.z?l.mixedAdd(d):l.add(d))}}return l},e.exports=new a},function(e,t,n){"use strict";(function(t){const r=n(154),i=n(391),o={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=((e,n,s,a)=>{const l=o[e];if(!l)return a(new Error("unkown cipherType passed"));if(!n)return a(new Error("unkown hashType passed"));const u=l.keySize,c=l.ivSize,h=20,f=t.from("key expansion"),p=2*(c+u+20);i.create(n,s,(e,n)=>{if(e)return a(e);n.digest(f,(e,i)=>{if(e)return a(e);let o=[],s=0;function l(e){n.digest(t.concat([i,f]),(t,r)=>{if(t)return e(t);let a=r.length;s+a>p&&(a=p-s),o.push(r),s+=a,n.digest(i,(t,n)=>{if(t)return e(t);i=n,e()})})}function h(e){if(e)return a(e);const n=p/2,r=t.concat(o),i=r.slice(0,n),s=r.slice(n,p),l=e=>({iv:e.slice(0,c),cipherKey:e.slice(c,c+u),macKey:e.slice(c+u)});a(null,{k1:l(i),k2:l(s)})}r(()=>s{r.generateEphmeralKeyPair(e,t)})},function(e,t,n){"use strict";(function(e){const r=n(255),i=n(254),o=n(119).bignum,s=n(378),a=s.toBase64,l=s.toBn,u={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=function(t,n){i(r.subtle.generateKey({name:"ECDH",namedCurve:t},!0,["deriveBits"]).then(n=>{const o=(o,s,a)=>{let l;"function"==typeof s&&(a=s,s=void 0),l=s?r.subtle.importKey("jwk",p(t,s),{name:"ECDH",namedCurve:t},!1,["deriveBits"]):Promise.resolve(n.privateKey);const c=Promise.all([r.subtle.importKey("jwk",f(t,o),{name:"ECDH",namedCurve:t},!1,[]),l]);i(c.then(e=>r.subtle.deriveBits({name:"ECDH",namedCurve:t,public:e[0]},e[1],u[t])).then(t=>e.from(t)),a)};return r.subtle.exportKey("jwk",n.publicKey).then(e=>({key:h(e),genSharedKey:o}))}),n)};const c={"P-256":32,"P-384":48,"P-521":66};function h(t){const n=c[t.crv];return e.concat([e.from([4]),l(t.x).toArrayLike(e,"be",n),l(t.y).toArrayLike(e,"be",n)],1+2*n)}function f(t,n){const r=c[t];if(!n.slice(0,1).equals(e.from([4])))throw new Error("Invalid key format");const i=new o(n.slice(1,r+1)),s=new o(n.slice(1+r));return{kty:"EC",crv:t,x:a(i,r),y:a(s,r),ext:!0}}function p(e,t){const n=f(e,t.public);return n.d=a(new o(t.private)),n}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(806),i=n(260),o=n(35);function s(e){const t=[],n=e.split("/").slice(1);if(1===n.length&&""===n[0])return[];for(let r=0;r=n.length)throw _("invalid address: "+e);if(s.path){t.push([o,b(n.slice(r).join("/"))]);break}t.push([o,n[r]])}else t.push([o])}return t}function a(e){const t=[];return e.map(e=>{const n=w(e);t.push(n.name),e.length>1&&t.push(e[1])}),b(t.join("/"))}function l(e){return e.map(e=>{Array.isArray(e)||(e=[e]);const t=w(e);return e.length>1?[t.code,r.toBuffer(t.code,e[1])]:[t.code]})}function u(e){return e.map(e=>{const t=w(e);return e.length>1?[t.code,r.toString(t.code,e[1])]:[t.code]})}function c(e){return g(t.concat(e.map(e=>{const n=w(e);let r=t.from(o.encode(n.code));return e.length>1&&(r=t.concat([r,e[1]])),r})))}function h(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;{const e=o.decode(t);return e+o.decode.bytes}}function f(e){const t=[];let n=0;for(;ne.length)throw _("Invalid address buffer: "+e.toString("hex"));t.push([r,u])}return t}function p(e){const t=f(e),n=u(t);return a(n)}function d(e){e=b(e);const t=s(e),n=l(t);return c(n)}function m(e){return d(e)}function g(e){const n=y(e);if(n)throw n;return t.from(e)}function y(e){try{f(e)}catch(e){return e}}function v(e){return void 0===y(e)}function b(e){return"/"+e.trim().split("/").filter(e=>e).join("/")}function _(e){return new Error("Error parsing address: "+e)}function w(e){const t=i(e[0]);return t}e.exports={stringToStringTuples:s,stringTuplesToString:a,tuplesToStringTuples:u,stringTuplesToTuples:l,bufferToTuples:f,tuplesToBuffer:c,bufferToString:p,stringToBuffer:d,fromString:m,fromBuffer:g,validateBuffer:y,isValidBuffer:v,cleanPath:b,ParseError:_,protoFromTuple:w,sizeForAddr:h}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(807),i=n(808),o=n(260),s=n(70),a=n(810),l=n(35);function u(e,n){return n instanceof t?u.toString(e,n):u.toBuffer(e,n)}function c(e){if(!i(e))throw new Error("invalid ip address");return r.toBuffer(e)}function h(e){const t=r.toString(e);if(!i(t))throw new Error("invalid ip address");return t}function f(e){const n=t.alloc(2);return n.writeUInt16BE(e,0),n}function p(e){return e.readUInt16BE(0)}function d(e){const n=t.from(e),r=t.from(l.encode(n.length));return t.concat([r,n])}function m(e){const t=l.decode(e);if(e=e.slice(l.decode.bytes),e.length!==t)throw new Error("inconsistent lengths");return e.toString()}function g(e){const n=t.from(s.decode(e)),r=t.from(l.encode(n.length));return t.concat([r,n])}function y(e){const t=l.decode(e),n=e.slice(l.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return s.encode(n)}function v(e){const n=e.split(":");if(2!==n.length)throw new Error("failed to parse onion addr: "+n+" does not contain a port number");if(16!==n[0].length)throw new Error("failed to parse onion addr: "+n[0]+" not a Tor onion address.");const r=t.from(a.decode.asBytes(n[0].toUpperCase())),i=parseInt(n[1],10);if(i<1||i>65536)throw new Error("Port number is not in range(1, 65536)");const o=f(i);return t.concat([r,o])}function b(e){const n=e.split(":");if(2!==n.length)throw new Error("failed to parse onion addr: "+n+" does not contain a port number");if(56!==n[0].length)throw new Error("failed to parse onion addr: "+n[0]+" not a Tor onion3 address.");const r=t.from(a.decode.asBytes(n[0].toUpperCase())),i=parseInt(n[1],10);if(i<1||i>65536)throw new Error("Port number is not in range(1, 65536)");const o=f(i);return t.concat([r,o])}function _(e){const t=e.slice(0,e.length-2),n=e.slice(e.length-2),r=a.encode(t).toString("ascii").toLowerCase(),i=p(n);return r+":"+i}e.exports=u,u.toString=function e(t,n){switch(t=o(t),t.code){case 4:case 41:return h(n);case 6:case 273:case 33:case 132:return p(n);case 53:case 54:case 55:case 56:case 400:return m(n);case 421:return y(n);case 444:case 445:return _(n);default:return n.toString("hex")}},u.toBuffer=function e(n,r){switch(n=o(n),n.code){case 4:case 41:return c(r);case 6:case 273:case 33:case 132:return f(parseInt(r,10));case 53:case 54:case 55:case 56:case 400:return d(r);case 421:return g(r);case 444:return v(r);case 445:return b(r);default:return t.from(r,"hex")}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=t,i=n(0).Buffer,o=n(198);r.toBuffer=function(e,t,n){var r;if(n=~~n,this.isV4Format(e))r=t||new i(n+4),e.split(/\./g).map(function(e){r[n++]=255&parseInt(e,10)});else if(this.isV6Format(e)){var o=e.split(":",8),s;for(s=0;s0;s--)u.push("0");o.splice.apply(o,u)}for(r=t||new i(n+16),s=0;s>8&255,r[n++]=255&c}}if(!r)throw Error("Invalid ip address: "+e);return r},r.toString=function(e,t,n){t=~~t,n=n||e.length-t;var r=[];if(4===n){for(var i=0;i32?"ipv6":l(t);var n=4;"ipv6"===t&&(n=16);for(var o=new i(n),s=0,a=o.length;s>u)}return r.toString(o)},r.mask=function(e,t){e=r.toBuffer(e),t=r.toBuffer(t);var n=new i(Math.max(e.length,t.length)),o=0;if(e.length===t.length)for(o=0;oe.length&&(i=t,o=e);for(var s=i.length-o.length,n=s;n>>0},r.fromLong=function(e){return(e>>>24)+"."+(e>>16&255)+"."+(e>>8&255)+"."+(255&e)}},function(e,t,n){"use strict";const r=n(809),i=e.exports=(e=>r({exact:!0}).test(e));i.v4=(e=>r.v4({exact:!0}).test(e)),i.v6=(e=>r.v6({exact:!0}).test(e))},function(e,t,n){"use strict";const r="(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(?:\\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3}",i="[0-9a-fA-F]{1,4}",o=`\n(\n(?:${i}:){7}(?:${i}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${i}:){6}(?:${r}|:${i}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${i}:){5}(?::${r}|(:${i}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${i}:){4}(?:(:${i}){0,1}:${r}|(:${i}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${i}:){3}(?:(:${i}){0,2}:${r}|(:${i}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${i}:){2}(?:(:${i}){0,3}:${r}|(:${i}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${i}:){1}(?:(:${i}){0,4}:${r}|(:${i}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::((?::${i}){0,5}:${r}|(?::${i}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),s=e.exports=(e=>e&&e.exact?new RegExp(`(?:^${r}$)|(?:^${o}$)`):new RegExp(`(?:${r})|(?:${o})`,"g"));s.v4=(e=>e&&e.exact?new RegExp(`^${r}$`):new RegExp(r,"g")),s.v6=(e=>e&&e.exact?new RegExp(`^${o}$`):new RegExp(o,"g"))},function(e,t,n){(function(t,r){var i; +/* + * [hi-base32]{@link https://github.com/emn178/hi-base32} + * + * @version 0.5.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2018 + * @license MIT + */ +/* + * [hi-base32]{@link https://github.com/emn178/hi-base32} + * + * @version 0.5.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2018 + * @license MIT + */ +!function(){"use strict";var o="object"==typeof window?window:{},s=!o.HI_BASE32_NO_NODE_JS&&"object"==typeof t&&t.versions&&t.versions.node;s&&(o=r);var a=!o.HI_BASE32_NO_COMMON_JS&&"object"==typeof e&&e.exports,l=n(358),u="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),c={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},h=[0,0,0,0,0,0,0,0],f=function(e,t){t.length>10&&(t="..."+t.substr(-10));var n=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+e+" bytes: "+t+" <-");throw n.position=e,n},p=function(e){for(var t="",n=e.length,r=0,i=0,o,s;r191&&o<=223?(s=31&o,i=1):o<=239?(s=15&o,i=2):o<=247?(s=7&o,i=3):f(r,t);for(var a=0;a191)&&f(r,t),s<<=6,s+=63&o;s>=55296&&s<=57343&&f(r,t),s>1114111&&f(r,t),s<=65535?t+=String.fromCharCode(s):(s-=65536,t+=String.fromCharCode(55296+(s>>10)),t+=String.fromCharCode(56320+(1023&s)))}return t},d=function(e){if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");e=e.replace(/=/g,"");for(var t,n,r,i,o,s,a,l,u=[],h=0,f=e.length,p=0,d=f>>3<<3;p>>2),u[h++]=255&(n<<6|r<<1|i>>>4),u[h++]=255&(i<<4|o>>>1),u[h++]=255&(o<<7|s<<2|a>>>3),u[h++]=255&(a<<5|l);var m=f-d;return 2===m?(t=c[e.charAt(p++)],n=c[e.charAt(p++)],u[h++]=255&(t<<3|n>>>2)):4===m?(t=c[e.charAt(p++)],n=c[e.charAt(p++)],r=c[e.charAt(p++)],i=c[e.charAt(p++)],u[h++]=255&(t<<3|n>>>2),u[h++]=255&(n<<6|r<<1|i>>>4)):5===m?(t=c[e.charAt(p++)],n=c[e.charAt(p++)],r=c[e.charAt(p++)],i=c[e.charAt(p++)],o=c[e.charAt(p++)],u[h++]=255&(t<<3|n>>>2),u[h++]=255&(n<<6|r<<1|i>>>4),u[h++]=255&(i<<4|o>>>1)):7===m&&(t=c[e.charAt(p++)],n=c[e.charAt(p++)],r=c[e.charAt(p++)],i=c[e.charAt(p++)],o=c[e.charAt(p++)],s=c[e.charAt(p++)],a=c[e.charAt(p++)],u[h++]=255&(t<<3|n>>>2),u[h++]=255&(n<<6|r<<1|i>>>4),u[h++]=255&(i<<4|o>>>1),u[h++]=255&(o<<7|s<<2|a>>>3)),u},m=function(e){for(var t,n,r,i,o,s="",a=e.length,l=0,c=5*parseInt(a/5);l>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[31&(i<<3|o>>>5)]+u[31&o];var h=a-c;return 1===h?(t=e.charCodeAt(l),s+=u[t>>>3]+u[t<<2&31]+"======"):2===h?(t=e.charCodeAt(l++),n=e.charCodeAt(l),s+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[n<<4&31]+"===="):3===h?(t=e.charCodeAt(l++),n=e.charCodeAt(l++),r=e.charCodeAt(l),s+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[r<<1&31]+"==="):4===h&&(t=e.charCodeAt(l++),n=e.charCodeAt(l++),r=e.charCodeAt(l++),i=e.charCodeAt(l),s+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[i<<3&31]+"="),s},g=function(e){var t,n,r,i,o,s,a=!1,l="",c=0,f,p=0,d=0,m=e.length;do{for(h[0]=h[5],h[1]=h[6],h[2]=h[7],f=p;c>6,h[f++]=128|63&s):s<55296||s>=57344?(h[f++]=224|s>>12,h[f++]=128|s>>6&63,h[f++]=128|63&s):(s=65536+((1023&s)<<10|1023&e.charCodeAt(++c)),h[f++]=240|s>>18,h[f++]=128|s>>12&63,h[f++]=128|s>>6&63,h[f++]=128|63&s);d+=f-p,p=f-5,c===m&&++c,c>m&&f<6&&(a=!0),t=h[0],f>4?(n=h[1],r=h[2],i=h[3],o=h[4],l+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[31&(i<<3|o>>>5)]+u[31&o]):1===f?l+=u[t>>>3]+u[t<<2&31]+"======":2===f?(n=h[1],l+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[n<<4&31]+"===="):3===f?(n=h[1],r=h[2],l+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[r<<1&31]+"==="):(n=h[1],r=h[2],i=h[3],l+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[i<<3&31]+"=")}while(!a);return l},y=function(e){for(var t,n,r,i,o,s="",a=e.length,l=0,c=5*parseInt(a/5);l>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[31&(i<<3|o>>>5)]+u[31&o];var h=a-c;return 1===h?(t=e[l],s+=u[t>>>3]+u[t<<2&31]+"======"):2===h?(t=e[l++],n=e[l],s+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[n<<4&31]+"===="):3===h?(t=e[l++],n=e[l++],r=e[l],s+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[r<<1&31]+"==="):4===h&&(t=e[l++],n=e[l++],r=e[l++],i=e[l],s+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[i<<3&31]+"="),s},v=function(e,t){var n="string"!=typeof e;return n&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),n?y(e):t?m(e):g(e)},b=function(e,t){if(!t)return p(d(e));if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");var n,r,i,o,s,a,l,u,h="",f=e.indexOf("=");-1===f&&(f=e.length);for(var m=0,g=f>>3<<3;m>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))+String.fromCharCode(255&(s<<7|a<<2|l>>>3))+String.fromCharCode(255&(l<<5|u));var y=f-g;return 2===y?(n=c[e.charAt(m++)],r=c[e.charAt(m++)],h+=String.fromCharCode(255&(n<<3|r>>>2))):4===y?(n=c[e.charAt(m++)],r=c[e.charAt(m++)],i=c[e.charAt(m++)],o=c[e.charAt(m++)],h+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))):5===y?(n=c[e.charAt(m++)],r=c[e.charAt(m++)],i=c[e.charAt(m++)],o=c[e.charAt(m++)],s=c[e.charAt(m++)],h+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))):7===y&&(n=c[e.charAt(m++)],r=c[e.charAt(m++)],i=c[e.charAt(m++)],o=c[e.charAt(m++)],s=c[e.charAt(m++)],a=c[e.charAt(m++)],l=c[e.charAt(m++)],h+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))+String.fromCharCode(255&(s<<7|a<<2|l>>>3))),h},_={encode:v,decode:b};b.asBytes=d,a?e.exports=_:(o.base32=_,l&&(i=function(){return _}.call(_,n,_,e),void 0===i||(e.exports=i)))}()}).call(this,n(3),n(8))},function(e,t,n){"use strict";const{ensureMultiaddr:r}=n(392),i=n(812);class o{constructor(e){this._multiaddrs=e||[],this._observedMultiaddrs=[]}add(e){e=r(e),this.has(e)||this._multiaddrs.push(e)}addSafe(e){e=r(e);const t=this._observedMultiaddrs.some((t,n)=>{if(t.equals(e))return this.add(e),this._observedMultiaddrs.splice(n,1),!0});t||this._observedMultiaddrs.push(e)}toArray(){return this._multiaddrs.slice()}get size(){return this._multiaddrs.length}forEach(e){return this._multiaddrs.forEach(e)}filterBy(e){return"object"!=typeof e||"function"!=typeof e.matches||"function"!=typeof e.partialMatch||"function"!=typeof e.toString?[]:this._multiaddrs.filter(t=>e.matches(t))}has(e){return e=r(e),this._multiaddrs.some(t=>t.equals(e))}delete(e){e=r(e),this._multiaddrs.some((t,n)=>{if(t.equals(e))return this._multiaddrs.splice(n,1),!0})}replace(e,t){Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]),e.forEach(e=>this.delete(e)),t.forEach(e=>this.add(e))}clear(){this._multiaddrs=[]}distinct(){return i(this._multiaddrs,e=>[e.toOptions().port,e.toOptions().transport].join())}}e.exports=o},function(e,t,n){"use strict";function r(e,t){var n=[],r={};if("function"!=typeof t){var i=t;t=function e(t){return t[i]}}return e.forEach(function e(i){var o=t(i);r[o]||(r[o]=!0,n.push(i))}),n}e.exports=r},function(e,t,n){"use strict";const r=n(814),i={16:"aes-128-ctr",32:"aes-256-ctr"};t.create=function(e,t,n){const o=i[e.length];if(!o)return n(new Error("Invalid key length"));const s=r.createCipheriv(o,e,t),a=r.createDecipheriv(o,e,t),l={encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}};n(null,l)}},function(e,t,n){"use strict";const r=n(815);e.exports={createCipheriv:r.createCipheriv,createDecipheriv:r.createDecipheriv}},function(e,t,n){var r=n(816),i=n(824),o=n(396);function s(){return Object.keys(o)}t.createCipher=t.Cipher=r.createCipher,t.createCipheriv=t.Cipheriv=r.createCipheriv,t.createDecipher=t.Decipher=i.createDecipher,t.createDecipheriv=t.Decipheriv=i.createDecipheriv,t.listCiphers=t.getCiphers=s},function(e,t,n){var r=n(393),i=n(397),o=n(5).Buffer,s=n(398),a=n(99),l=n(199),u=n(399),c=n(1);function h(e,t,n){a.call(this),this._cache=new p,this._cipher=new l.AES(t),this._prev=o.from(n),this._mode=e,this._autopadding=!0}c(h,a),h.prototype._update=function(e){var t,n;this._cache.add(e);for(var r=[];t=this._cache.get();)n=this._mode.encrypt(this,t),r.push(n);return o.concat(r)};var f=o.alloc(16,16);function p(){this.cache=o.allocUnsafe(0)}function d(e,t,n){var a=r[e.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=o.from(t)),t.length!==a.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof n&&(n=o.from(n)),"GCM"!==a.mode&&n.length!==a.iv)throw new TypeError("invalid iv length "+n.length);return"stream"===a.type?new s(a.module,t,n):"auth"===a.type?new i(a.module,t,n):new h(a.module,t,n)}function m(e,t){var n=r[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var i=u(t,!1,n.key,n.iv);return d(e,i.key,i.iv)}h.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(f))throw this._cipher.scrub(),new Error("data not multiple of block length")},h.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},p.prototype.add=function(e){this.cache=o.concat([this.cache,e])},p.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},p.prototype.flush=function(){for(var e=16-this.cache.length,t=o.allocUnsafe(e),n=-1;++n>i%8,e._prev=o(e._prev,n?l:u);return a}function o(e,t){var n=e.length,i=-1,o=r.allocUnsafe(e.length);for(e=r.concat([e,r.from([t])]);++i>7;return o}t.encrypt=function(e,t,n){for(var o=t.length,s=r.allocUnsafe(o),a=-1;++a>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function a(e){this.h=e,this.state=r.alloc(16,0),this.cache=r.allocUnsafe(0)}a.prototype.ghash=function(e){for(var t=-1;++t0;n--)e[n]=e[n]>>>1|(1&e[n-1])<<31;e[0]=e[0]>>>1,i&&(e[0]=e[0]^225<<24)}this.state=s(t)},a.prototype.update=function(e){var t;for(this.cache=r.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},a.prototype.final=function(e,t){return this.cache.length&&this.ghash(r.concat([this.cache,i],16)),this.ghash(s([0,e,0,t])),this.state},e.exports=a},function(e,t,n){var r=n(397),i=n(5).Buffer,o=n(393),s=n(398),a=n(99),l=n(199),u=n(399),c=n(1);function h(e,t,n){a.call(this),this._cache=new f,this._last=void 0,this._cipher=new l.AES(t),this._prev=i.from(n),this._mode=e,this._autopadding=!0}function f(){this.cache=i.allocUnsafe(0)}function p(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");for(var n=-1;++n16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},f.prototype.flush=function(){if(this.cache.length)return this.cache},t.createDecipher=m,t.createDecipheriv=d},function(e,t,n){"use strict";const r=n(373),i=n(30),o={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function s(e,t,n,s,a){const l=o[a];if(!l)throw new Error(`Hash '${a}' is unknown or not supported`);const u=r(e,t,n,s,l);return i.encode64(u)}e.exports=s},function(e,t,n){"use strict";(function(t){const r=n(27),i=n(60),o=n(115),s=n(95),a=n(827),l=n(39);class u{constructor(e,n,s,a){if(c.isCID(e)){const n=e;return this.version=n.version,this.codec=n.codec,this.multihash=t.from(n.multihash),void(this.multibaseName=n.multibaseName||(0===n.version?"base58btc":"base32"))}if("string"==typeof e){const t=i.isEncoded(e);if(t){const n=i.decode(e);this.version=parseInt(n.slice(0,1).toString("hex"),16),this.codec=o.getCodec(n.slice(1)),this.multihash=o.rmPrefix(n.slice(1)),this.multibaseName=t}else this.version=0,this.codec="dag-pb",this.multihash=r.fromB58String(e),this.multibaseName="base58btc";return u.validateCID(this),void Object.defineProperty(this,"string",{value:e})}if(t.isBuffer(e)){const t=e.slice(0,1),n=parseInt(t.toString("hex"),16);if(1===n){const t=e;this.version=n,this.codec=o.getCodec(t.slice(1)),this.multihash=o.rmPrefix(t.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=e,this.multibaseName="base58btc";u.validateCID(this)}else this.version=e,this.codec=n,this.multihash=s,this.multibaseName=a||(0===e?"base58btc":"base32"),u.validateCID(this)}get buffer(){let e=this._buffer;if(!e){if(0===this.version)e=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");e=t.concat([t.from("01","hex"),o.getCodeVarint(this.codec),this.multihash])}Object.defineProperty(this,"_buffer",{value:e})}return e}get prefix(){return t.concat([t.from(`0${this.version}`,"hex"),o.getCodeVarint(this.codec),r.prefix(this.multihash)])}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:t}=r.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==t)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new c(0,this.codec,this.multihash)}toV1(){return new c(1,this.codec,this.multihash)}toBaseEncodedString(e=this.multibaseName){if(this.string&&e===this.multibaseName)return this.string;let t=null;if(0===this.version){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()");t=r.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");t=i.encode(e,this.buffer).toString()}return e===this.multibaseName&&Object.defineProperty(this,"string",{value:t}),t}toString(e){return this.toBaseEncodedString(e)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(e){return this.codec===e.codec&&this.version===e.version&&this.multihash.equals(e.multihash)}static validateCID(e){let t=a.checkCIDComponents(e);if(t)throw new Error(t)}}const c=l(u,{className:"CID",symbolName:"@ipld/js-cid/CID"});c.codecs=s,e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(27);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(0===e.version){if("dag-pb"!==e.codec)return"codec must be 'dag-pb' for CIDv0";if("base58btc"!==e.multibaseName)return"multibaseName must be 'base58btc' for CIDv0"}if(!t.isBuffer(e.multihash))return"multihash must be a Buffer";try{r.validate(e.multihash)}catch(e){let t=e.message;return t||(t="Multihash validation failed"),t}}};e.exports=i}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(22),i=n(72),{struct:o,superstruct:s}=n(401),{optional:a,union:l}=o,u=s({types:{multiaddr:e=>{if(null===e)return`multiaddr invalid, value must be a string, Buffer, or another Multiaddr got ${e}`;try{r(e)}catch(e){return`multiaddr invalid, ${e.message}`}return!0},"multiaddr-ipfs":e=>!!i.IPFS.matches(e)||"multiaddr IPFS invalid"}}),c=u({repo:a(u("object|string")),repoOwner:"boolean?",preload:u({enabled:"boolean?",addresses:a(u(["multiaddr"])),interval:"number?"},{enabled:!0,interval:3e4}),init:a(l(["boolean",u({bits:"number?",emptyRepo:"boolean?",privateKey:a(u("object|string")),pass:"string?"})])),start:"boolean?",offline:"boolean?",pass:"string?",silent:"boolean?",relay:"object?",EXPERIMENTAL:a(u({pubsub:"boolean?",ipnsPubsub:"boolean?",sharding:"boolean?",dht:"boolean?"})),connectionManager:"object?",config:a(u({API:"object?",Addresses:a(u({Swarm:a(u(["multiaddr"])),API:"multiaddr?",Gateway:"multiaddr"})),Discovery:a(u({MDNS:a(u({Enabled:"boolean?",Interval:"number?"})),webRTCStar:a(u({Enabled:"boolean?"}))})),Bootstrap:a(u(["multiaddr-ipfs"]))})),libp2p:a(l(["function","object"]))},{repoOwner:!0}),h=e=>{const[t,n]=c.validate(e);if(t)throw t;return n};e.exports={validate:h}},function(e,t,n){"use strict";const r=n(10),i=n(261).errors;function o(e){return!!e&&(e.code===i.ERR_REPO_NOT_INITIALIZED||!!(e.message.match(/not found/)||e.message.match(/ENOENT/)||e.message.match(/No value/)))}e.exports=(e=>{e.log("booting");const t=e._options,n=t.init,i=t.start;r([t=>{if(!e._repo.closed)return t(null,!0);e._repo.open((e,n)=>o(e)?t(null,!1):e?t(e):void t(null,!0))},(r,i)=>{if(r)return e.init({repo:e._repo},e=>{if(e)return i(Object.assign(e,{emitted:!0}));i()});if(n){const n=Object.assign({bits:2048,pass:e._options.pass},"object"==typeof t.init?t.init:{});return e.init(n,e=>{if(e)return i(Object.assign(e,{emitted:!0}));i()})}i()},t=>{if(!i)return t();e.start(e=>{if(e)return t(Object.assign(e,{emitted:!0}));t()})}],t=>{t?t.emitted||e.emit("error",t):(e.log("booted"),e.emit("ready"))})})},function(e,t,n){"use strict";t.create=function e(t,n,r){const i=r.storageBackends[t],o=Object.assign({},r.storageBackendOptions[t]||{});return new i(n,o)}},function(e,t,n){"use strict";(function(t){const r=n(28).Key,i=n(4),o=i("repo:version"),s=new r("version");e.exports=(e=>({exists(t){e.has(s,t)},get(t){e.get(s,(e,n)=>{if(e)return t(e);t(null,parseInt(n.toString().trim(),10))})},set(n,r){e.put(s,t.from(String(n)),r)},check(e,t){this.get((n,r)=>{if(n)return t(n);o("comparing version: %s and %s",r,e);const i=6===r&&7===e||6===e&&7===r;if(r!==e&&!i)return t(new Error(`ipfs repo needs migration: expected version v${e}, found version v${r}`));t()})}}))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(19),i=n(20),o=n(262).asyncFilter,s=n(262).asyncSort,a=n(403),l=n(406);class u{constructor(){this.data={}}open(e){i(e)}put(e,t,n){this.data[e.toString()]=t,i(n)}get(e,t){this.has(e,(n,r)=>n?t(n):r?void t(null,this.data[e.toString()]):t(l.notFoundError()))}has(e,t){i(()=>{t(null,void 0!==this.data[e.toString()])})}delete(e,t){delete this.data[e.toString()],i(()=>{t()})}batch(){let e=[],t=[];return{put(t,n){e.push([t,n])},delete(e){t.push(e)},commit:n=>{e.forEach(e=>{this.data[e[0].toString()]=e[1]}),e=[],t.forEach(e=>{delete this.data[e.toString()]}),t=[],i(n)}}}query(e){let t=[r.keys(this.data),r.map(e=>({key:new a(e),value:this.data[e]}))],n=[];if(null!=e.prefix){const t=e.prefix;n.push((e,n)=>n(null,e.key.toString().startsWith(t)))}if(null!=e.filters&&(n=n.concat(e.filters)),t=t.concat(n.map(e=>o(e))),null!=e.orders&&(t=t.concat(e.orders.map(e=>s(e)))),null!=e.offset){let n=0;t.push(r.filter(()=>n++>=e.offset))}return null!=e.limit&&t.push(r.take(e.limit)),!0===e.keysOnly&&t.push(r.map(e=>({key:e.key}))),r.apply(null,t)}close(e){i(e)}}e.exports=u},function(e,t,n){"use strict";const r=n(28).Key,i=n(106),o=n(10),s=n(202),a=n(834),l=n(0).Buffer,u=new r("config");e.exports=(e=>{const t=i(r,1),n={get(t,n){"function"==typeof t&&(n=t,t=void 0),t||(t=void 0),e.get(u,(e,r)=>{if(e)return n(e);let i;try{i=JSON.parse(r.toString())}catch(e){return n(e)}if(void 0===t)return n(null,i);if("string"!=typeof t)return n(new Error("Key "+t+" must be a string."));const o=s(i,t,null);if(null===o)return n(new Error("Key "+t+" does not exist in config."));n(null,o)})},set(e,n,r){if("function"==typeof n)r=n,n=e,e=void 0;else if(!e||"string"!=typeof e)return r(new Error("Invalid key type"));if(void 0===n||l.isBuffer(n))return r(new Error("Invalid value type"));t.push({key:e,value:n},r)},exists(t){e.has(u,t)}};return n;function r(e,t){const r=e.key,i=e.value;r?o([e=>n.get(e),(e,t)=>{a(e,r,i),t(null,e)},c],t):c(i,t)}function c(t,n){const r=l.from(JSON.stringify(t,null,2));e.put(u,r,n)}})},function(e,t){function n(e,t,n){"string"==typeof t&&(t=t.split(".")),"symbol"==typeof t&&(t=[t]);var r=t.pop(),i;if(!r)return!1;for(;i=t.shift();)if(void 0===e[i]&&(e[i]={}),e=e[i],!e||"object"!=typeof e)return!1;return e[r]=n,!0}e.exports=n},function(e,t,n){"use strict";(function(t){const r=n(28).Key,i=n(836),o=new r("datastore_spec");e.exports=(e=>({exists(t){e.has(o,t)},get(t){e.get(o,(e,n)=>{if(e)return t(e);t(null,JSON.parse(n.toString()))})},set(n,r){e.put(o,t.from(JSON.stringify(i(n,{deep:!0}))),r)}}))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(351);e.exports=((e,t)=>{if(!r(e))throw new TypeError("Expected a plain object");if(t=t||{},"function"==typeof t)throw new TypeError("Specify the compare function as an option instead");const n=t.deep,i=[],o=[],s=e=>{const a=i.indexOf(e);if(-1!==a)return o[a];const l={},u=Object.keys(e).sort(t.compare);i.push(e),o.push(l);for(let t=0;t({get(t){e.get(i,(e,n)=>t(e,n&&n.toString()))},set(n,r){e.put(i,t.from(n.toString()),r)},delete(t){e.delete(i,t)}}))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(407),i=r.ShardingDatastore,o=n(28).Key,s=n(409),a=n(114),l=n(20),u=n(410),c=n(846),h=n(12),f=n(33),p=e=>{const t=new s.Encoder;return new o("/"+t.write(e).finalize(),!1)},d=e=>p(e.buffer);function m(e,t,n){if(t.sharding){const t=new r.shard.NextToLast(2);i.createOrOpen(e,t,n)}else l(()=>n(null,e))}function g(e){return{query(t,n){h(e.query(t),f(n))},get(t,n){if(!c.isCID(t))return l(()=>{n(new Error("Not a valid cid"))});const r=d(t);e.get(r,(i,o)=>{if(i){if("ERR_NOT_FOUND"===i.code){const o=y(t);if(!o)return n(i);const s=d(o);return e.get(s,(i,o)=>{if(i)return n(i);e.put(r,o,e=>{if(e)return n(e);n(null,new a(o,t))})})}return n(i)}n(null,new a(o,t))})},put(t,n){if(!a.isBlock(t))return l(()=>{n(new Error("invalid block"))});const r=d(t.cid);e.has(r,(i,o)=>i?n(i):o?n():void e.put(r,t.data,n))},putMany(t,n){const r=t.map(e=>({key:d(e.cid),block:e})),i=e.batch();u(r,(t,n)=>e.has(t.key,n),(e,t)=>{if(e)return n(e);t.forEach(e=>{i.put(e.key,e.block.data)}),i.commit(n)})},has(t,n){if(!c.isCID(t))return l(()=>{n(new Error("Not a valid cid"))});e.has(d(t),(r,i)=>{if(r)return n(r);if(i)return n(null,!0);const o=y(t);if(!o)return n(null,!1);e.has(d(o),n)})},delete(t,n){if(!c.isCID(t))return l(()=>{n(new Error("Not a valid cid"))});e.delete(d(t),n)},close(t){e.close(t)}}}function y(e){try{return 0===e.version?e.toV1():e.toV0()}catch(e){return null}}e.exports=((e,t,n)=>{m(e,t,(e,t)=>{if(e)return n(e);n(null,g(t))})})},function(e,t,n){"use strict";(function(t){const r=n(10),i=n(36),o=n(28).Key,s=n(408),a=n(203),l=new o(s.SHARDING_FN),u=new o(s.README_FN);class c{constructor(e,t){this.child=new a(e,{convert:this._convertKey.bind(this),invert:this._invertKey.bind(this)}),this.shard=t}open(e){this.child.open(e)}_convertKey(e){const t=e.toString();if(t===l.toString()||t===u.toString())return e;const n=new o(this.shard.fun(t));return n.child(e)}_invertKey(e){const t=e.toString();return t===l.toString()||t===u.toString()?e:o.withNamespaces(e.list().slice(1))}static createOrOpen(e,t,n){c.create(e,t,t=>{if(t&&"datastore exists"!==t.message)return n(t);c.open(e,n)})}static open(e,t){r([t=>s.readShardFun("/",e,t),(t,n)=>{n(null,new c(e,t))}],t)}static create(e,n,r){e.has(l,(o,a)=>{if(o)return r(o);if(!a){const o="function"==typeof e.putRaw?e.putRaw.bind(e):e.put.bind(e);return i([e=>o(l,t.from(n.toString()+"\n"),e),e=>o(u,t.from(s.readme),e)],e=>r(e))}s.readShardFun("/",e,(e,t)=>{if(e)return r(e);const i=(t||"").toString(),o=n.toString();if(i!==o)return r(new Error(`specified fun ${o} does not match repo shard fun ${i}`));r(new Error("datastore exists"))})})}put(e,t,n){this.child.put(e,t,n)}get(e,t){this.child.get(e,t)}has(e,t){this.child.has(e,t)}delete(e,t){this.child.delete(e,t)}batch(){return this.child.batch()}query(e){const t={keysOnly:e.keysOnly,offset:e.offset,limit:e.limit,filters:[(e,t)=>t(null,e.key.toString()!==l.toString()),(e,t)=>t(null,e.key.toString()!==u.toString())]};if(null!=e.prefix&&t.filters.push((t,n)=>{n(null,this._invertKey(t.key).toString().startsWith(e.prefix))}),null!=e.filters){const n=e.filters.map(e=>(t,n)=>{e(Object.assign({},t,{key:this._invertKey(t.key)}),n)});t.filters=t.filters.concat(n)}return null!=e.orders&&(t.orders=e.orders.map(e=>(t,n)=>{t.forEach(e=>{e.key=this._invertKey(e.key)}),e(t,(e,t)=>{if(e)return n(e);t.forEach(e=>{e.key=this._convertKey(e.key)}),n(null,t)})})),this.child.query(t)}close(e){this.child.close(e)}}e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports="This is a repository of IPLD objects. Each IPLD object is in a single file,\nnamed .data. Where is the\n\"base32\" encoding of the CID (as specified in\nhttps://github.com/multiformats/multibase) without the 'B' prefix.\nAll the object files are placed in a tree of directories, based on a\nfunction of the CID. This is a form of sharding similar to\nthe objects directory in git repositories. Previously, we used\nprefixes, we now use the next-to-last two charters.\n func NextToLast(base32cid string) {\n nextToLastLen := 2\n offset := len(base32cid) - nextToLastLen - 1\n return str[offset : offset+nextToLastLen]\n }\nFor example, an object with a base58 CIDv1 of\n zb2rhYSxw4ZjuzgCnWSt19Q94ERaeFhu9uSqRgjSdx9bsgM6f\nhas a base32 CIDv1 of\n BAFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA\nand will be placed at\n SC/AFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA.data\nwith 'SC' being the last-to-next two characters and the 'B' at the\nbeginning of the CIDv1 string is the multibase prefix that is not\nstored in the filename.\n"},function(e,t,n){"use strict";const r=n(38),i=n(842),o=n(19),s=n(28).Key,a=n(28).Errors,l=n(28).utils,u=l.asyncFilter,c=l.asyncSort,h=l.replaceStartWith,f=n(203);class p{constructor(e){this.mounts=e.slice()}open(e){r(this.mounts,(e,t)=>{e.datastore.open(t)},e)}_lookup(e){for(let t of this.mounts)if(t.prefix.toString()===e.toString()||t.prefix.isAncestorOf(e)){const n=h(e.toString(),t.prefix.toString());return{datastore:t.datastore,mountpoint:t.prefix,rest:new s(n)}}}put(e,t,n){const r=this._lookup(e);if(null==r)return n(a.dbWriteFailedError(new Error("No datastore mounted for this key")));r.datastore.put(r.rest,t,n)}get(e,t){const n=this._lookup(e);if(null==n)return t(a.notFoundError(new Error("No datastore mounted for this key")));n.datastore.get(n.rest,t)}has(e,t){const n=this._lookup(e);null!=n?n.datastore.has(n.rest,t):t(null,!1)}delete(e,t){const n=this._lookup(e);if(null==n)return t(a.dbDeleteFailedError(new Error("No datastore mounted for this key")));n.datastore.delete(n.rest,t)}close(e){r(this.mounts,(e,t)=>{e.datastore.close(t)},e)}batch(){const e={},t=t=>{const n=this._lookup(t);if(null==n)throw new Error("No datastore mounted for this key");const r=n.mountpoint.toString();return null==e[r]&&(e[r]=n.datastore.batch()),{batch:e[r],rest:n.rest}};return{put:(e,n)=>{const r=t(e);r.batch.put(r.rest,n)},delete:e=>{const n=t(e);n.batch.delete(n.rest)},commit:t=>{r(Object.keys(e),(t,n)=>{e[t].commit(n)},t)}}}query(e){const t=this.mounts.map(t=>{const n=new f(t.datastore,{convert:e=>{throw new Error("should never be called")},invert:e=>t.prefix.child(e)});let r;return null!=e.prefix&&(r=h(e.prefix,t.prefix.toString())),n.query({prefix:r,filters:e.filters,keysOnly:e.keysOnly})});let n=[i(t)];if(null!=e.filters&&(n=n.concat(e.filters.map(e=>u(e)))),null!=e.orders&&(n=n.concat(e.orders.map(e=>c(e)))),null!=e.offset){let t=0;n.push(o.filter(()=>t++>=e.offset))}return null!=e.limit&&n.push(o.take(e.limit)),o.apply(null,n)}}e.exports=p},function(e,t){e.exports=function(e){var t=!!e,n=(e||[]).map(s),r=0,i,o;function s(e){return{ready:!1,reading:!1,ended:!1,read:e,data:null}}function a(){if(o){l();var e=n.length,s=o;if(0===e&&(i||t))return o=null,void s(i||!0);for(var a=0;an.length)throw new Error("this should never happen");if(!(t.reading||t.ended||t.ready)){t.reading=!0;var r=!0;t.read(i,function e(n,o){t.data=o,t.ready=!0,t.reading=!1,!0===n||i?t.ended=!0:n&&(i=t.ended=n),i&&!n&&t.read(i,e),r||a()}),r=!1}}(n[e]);a()}function c(e,t){i=i||e,o=t,u()}return c.add=function(e){if(!e)return t=!0,u();n.push(s(e)),u()},c.cap=function(e){c.add(null)},c}},function(e,t,n){"use strict";const r=n(38),i=n(154),o=n(28).Errors;class s{constructor(e){this.stores=e.slice()}open(e){r(this.stores,(e,t)=>{e.open(t)},t=>{if(t)return e(o.dbOpenFailedError());e()})}put(e,t,n){r(this.stores,(n,r)=>{n.put(e,t,r)},e=>{if(e)return n(o.dbWriteFailedError());n()})}get(e,t){const n=this.stores.length;let r=!1,s=0;i(()=>!r&&s{const n=this.stores[s++];n.get(e,(e,n)=>{if(null==e)return r=!0,t(null,n);t()})},(e,n)=>{if(e||!n)return t(o.notFoundError());t(null,n)})}has(e,t){const n=this.stores.length;let r=!1,o=0;i(()=>!r&&o{const n=this.stores[o++];n.has(e,(e,n)=>{if(null==e)return r=!0,t(null,n);t()})},t)}delete(e,t){r(this.stores,(t,n)=>{t.delete(e,n)},e=>{if(e)return t(o.dbDeleteFailedError());t()})}close(e){r(this.stores,(e,t)=>{e.close(t)},e)}batch(){const e=this.stores.map(e=>e.batch());return{put:(t,n)=>{e.forEach(e=>e.put(t,n))},delete:t=>{e.forEach(e=>e.delete(t))},commit:t=>{r(e,(e,t)=>{e.commit(t)},t)}}}query(e){return this.stores[this.stores.length-1].query(e)}}e.exports=s},function(e,t,n){"use strict";const r=n(28).Key,i=n(203);class o extends i{constructor(e,t){super(e,{convert:e=>t.child(e),invert(e){if("/"===t.toString())return e;if(!t.isAncestorOf(e))throw new Error(`Expected prefix: (${t.toString()}) in key: ${e.toString()}`);return new r(e.toString().slice(t.toString().length),!1)}}),this.prefix=t}query(e){return e.prefix&&"/"!==this.prefix.toString()?super.query(Object.assign({},e,{prefix:this.prefix.child(new r(e.prefix)).toString()})):super.query(e)}}e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;var r=n(411),i=o(r);function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t,n,r){(0,i.default)(e,t,function(e,t){n(e,function(e,n){t(e,!n)})},r)}e.exports=t.default},function(e,t,n){"use strict";(function(t){const r=n(27),i=n(60),o=n(115),s=n(95),a=n(847),l=n(39);class u{constructor(e,n,s,a){if(c.isCID(e)){const n=e;return this.version=n.version,this.codec=n.codec,this.multihash=t.from(n.multihash),void(this.multibaseName=n.multibaseName||(0===n.version?"base58btc":"base32"))}if("string"==typeof e){const t=i.isEncoded(e);if(t){const n=i.decode(e);this.version=parseInt(n.slice(0,1).toString("hex"),16),this.codec=o.getCodec(n.slice(1)),this.multihash=o.rmPrefix(n.slice(1)),this.multibaseName=t}else this.version=0,this.codec="dag-pb",this.multihash=r.fromB58String(e),this.multibaseName="base58btc";return u.validateCID(this),void Object.defineProperty(this,"string",{value:e})}if(t.isBuffer(e)){const t=e.slice(0,1),n=parseInt(t.toString("hex"),16);if(1===n){const t=e;this.version=n,this.codec=o.getCodec(t.slice(1)),this.multihash=o.rmPrefix(t.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=e,this.multibaseName="base58btc";u.validateCID(this)}else this.version=e,this.codec=n,this.multihash=s,this.multibaseName=a||(0===e?"base58btc":"base32"),u.validateCID(this)}get buffer(){let e=this._buffer;if(!e){if(0===this.version)e=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");e=t.concat([t.from("01","hex"),o.getCodeVarint(this.codec),this.multihash])}Object.defineProperty(this,"_buffer",{value:e})}return e}get prefix(){return t.concat([t.from(`0${this.version}`,"hex"),o.getCodeVarint(this.codec),r.prefix(this.multihash)])}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:t}=r.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==t)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new c(0,this.codec,this.multihash)}toV1(){return new c(1,this.codec,this.multihash)}toBaseEncodedString(e=this.multibaseName){if(this.string&&e===this.multibaseName)return this.string;let t=null;if(0===this.version){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()");t=r.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");t=i.encode(e,this.buffer).toString()}return e===this.multibaseName&&Object.defineProperty(this,"string",{value:t}),t}toString(e){return this.toBaseEncodedString(e)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(e){return this.codec===e.codec&&this.version===e.version&&this.multihash.equals(e.multihash)}static validateCID(e){let t=a.checkCIDComponents(e);if(t)throw new Error(t)}}const c=l(u,{className:"CID",symbolName:"@ipld/js-cid/CID"});c.codecs=s,e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(27);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(0===e.version){if("dag-pb"!==e.codec)return"codec must be 'dag-pb' for CIDv0";if("base58btc"!==e.multibaseName)return"multibaseName must be 'base58btc' for CIDv0"}if(!t.isBuffer(e.multihash))return"multihash must be a Buffer";try{r.validate(e.multihash)}catch(e){let t=e.message;return t||(t="Multihash validation failed"),t}}};e.exports=i}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports={lock:"memory",storageBackends:{root:n(204),blocks:n(204),keys:n(204),datastore:n(204)},storageBackendOptions:{root:{extension:""},blocks:{sharding:!1},keys:{sharding:!1}}}},function(e,t,n){(function(t){var r=n(6).EventEmitter,i=n(14).inherits,o=n(68),s=n(850),a=n(853),l=n(854),u=n(263),c=n(24),h=n(417),f=n(205).getCallback,p=n(205).getOptions,d=u.WriteError,m=u.ReadError,g=u.NotFoundError,y=u.OpenError,v=u.InitializationError;function b(e,n,i){if(!(this instanceof b))return new b(e,n,i);var o;if(r.call(this),this.setMaxListeners(1/0),"function"==typeof n&&(i=n,n={}),n=n||{},!e||"object"!=typeof e){if(o=new v("First argument must be an abstract-leveldown compliant store"),"function"==typeof i)return t.nextTick(i,o);throw o}c.strictEqual(typeof e.status,"string",".status required, old abstract-leveldown"),this.options=p(n),this._db=e,this.db=new s(e),this.open(i)}function _(e,n){if(!e._isOpening()&&!e.isOpen())return t.nextTick(n,new m("Database is not open")),!0}b.prototype.emit=r.prototype.emit,b.prototype.once=r.prototype.once,i(b,r),b.prototype.open=function(e){var n=this,r;return e||(e=h(),r=e.promise),this.isOpen()?(t.nextTick(e,null,n),r):this._isOpening()?(this.once("open",function(){e(null,n)}),r):(this.emit("opening"),this.db.open(this.options,function(t){if(t)return e(new y(t));n.db=n._db,e(null,n),n.emit("open"),n.emit("ready")}),r)},b.prototype.close=function(e){var n=this,r;return e||(e=h(),r=e.promise),this.isOpen()?(this.db.close(function(){n.emit("closed"),e.apply(null,arguments)}),this.emit("closing"),this.db=new s(this._db)):this.isClosed()?t.nextTick(e):"closing"===this.db.status?this.once("closed",e):this._isOpening()&&this.once("open",function(){n.close(e)}),r},b.prototype.isOpen=function(){return"open"===this.db.status},b.prototype._isOpening=function(){return"opening"===this.db.status},b.prototype.isClosed=function(){return/^clos|new/.test(this.db.status)},b.prototype.get=function(e,t,n){if(null===e||void 0===e)throw new m("get() requires a key argument");var r;return n=f(t,n),n||(n=h(),r=n.promise),_(this,n)?r:(t=p(t),this.db.get(e,t,function(t,r){if(t)return t=/notfound/i.test(t)||t.notFound?new g("Key not found in database ["+e+"]",t):new m(t),n(t);n(null,r)}),r)},b.prototype.put=function(e,t,n,r){if(null===e||void 0===e)throw new d("put() requires a key argument");var i=this,o;return r=f(n,r),r||(r=h(),o=r.promise),_(this,r)?o:(n=p(n),this.db.put(e,t,n,function(n){if(n)return r(new d(n));i.emit("put",e,t),r()}),o)},b.prototype.del=function(e,t,n){if(null===e||void 0===e)throw new d("del() requires a key argument");var r=this,i;return n=f(t,n),n||(n=h(),i=n.promise),_(this,n)?i:(t=p(t),this.db.del(e,t,function(t){if(t)return n(new d(t));r.emit("del",e),n()}),i)},b.prototype.batch=function(e,t,n){if(!arguments.length)return new l(this);if(!Array.isArray(e))throw new d("batch() requires an array argument");var r=this,i;return n=f(t,n),n||(n=h(),i=n.promise),_(this,n)?i:(t=p(t),this.db.batch(e,t,function(t){if(t)return n(new d(t));r.emit("batch",e),n()}),i)},b.prototype.iterator=function(e){return this.db.iterator(e)},b.prototype.readStream=b.prototype.createReadStream=function(e){return e=o({keys:!0,values:!0},e),"number"!=typeof e.limit&&(e.limit=-1),new a(this.db.iterator(e),e)},b.prototype.keyStream=b.prototype.createKeyStream=function(e){return this.createReadStream(o(e,{keys:!0,values:!1}))},b.prototype.valueStream=b.prototype.createValueStream=function(e){return this.createReadStream(o(e,{keys:!1,values:!0}))},b.prototype.toString=function(){return"LevelUP"},b.errors=u,e.exports=b.default=b}).call(this,n(3))},function(e,t,n){var r=n(414).AbstractLevelDOWN,i=n(1),o=n(852),s="put get del batch".split(" ");function a(e){r.call(this,""),this._db=e,this._operations=[],this._iterators=[],u(this)}function l(e){s.concat("iterator").forEach(function(t){e["_"+t]=function(){return this._db[t].apply(this._db,arguments)}}),e._db.approximateSize&&(e.approximateSize=function(){return this._db.approximateSize.apply(this._db,arguments)})}function u(e){s.forEach(function(t){e["_"+t]=function(){this._operations.push({method:t,args:arguments})}}),"function"==typeof e._db.approximateSize&&(e.approximateSize=function(){this._operations.push({method:"approximateSize",args:arguments})}),e._iterator=function(e){var t=new o(e);return this._iterators.push(t),t}}i(a,r),a.prototype._open=function(e,t){var n=this;this._db.open(e,function(e){if(e)return t(e);n._operations.forEach(function(e){n._db[e.method].apply(n._db,e.args)}),n._operations=[],n._iterators.forEach(function(e){e.setDb(n._db)}),n._iterators=[],l(n),t()})},a.prototype._close=function(e){var t=this;this._db.close(function(n){if(n)return e(n);u(t),e()})},a.prototype._serializeKey=function(e){return e},a.prototype._serializeValue=function(e){return e},e.exports=a,e.exports.DeferredIterator=o},function(e,t,n){(function(t,r){var i=n(68),o=n(415),s=n(416),a=Object.prototype.hasOwnProperty,l="start end gt gte lt lte".split(" ");function u(){this.status="new"}function c(e,t){var n={};for(var r in t)if(a.call(t,r)){var i=t[r];h(r)&&(i=e._serializeKey(i)),n[r]=i}return n}function h(e){return-1!==l.indexOf(e)}u.prototype.open=function(e,t){var n=this,r=this.status;if("function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("open() requires a callback argument");"object"==typeof e&&null!==e||(e={}),e.createIfMissing=!1!==e.createIfMissing,e.errorIfExists=!!e.errorIfExists,this.status="opening",this._open(e,function(e){if(e)return n.status=r,t(e);n.status="open",t()})},u.prototype._open=function(e,n){t.nextTick(n)},u.prototype.close=function(e){var t=this,n=this.status;if("function"!=typeof e)throw new Error("close() requires a callback argument");this.status="closing",this._close(function(r){if(r)return t.status=n,e(r);t.status="closed",e()})},u.prototype._close=function(e){t.nextTick(e)},u.prototype.get=function(e,n,r){if("function"==typeof n&&(r=n),"function"!=typeof r)throw new Error("get() requires a callback argument");var i=this._checkKey(e);if(i)return t.nextTick(r,i);e=this._serializeKey(e),"object"==typeof n&&null!==n||(n={}),n.asBuffer=!1!==n.asBuffer,this._get(e,n,r)},u.prototype._get=function(e,n,r){t.nextTick(function(){r(new Error("NotFound"))})},u.prototype.put=function(e,n,r,i){if("function"==typeof r&&(i=r),"function"!=typeof i)throw new Error("put() requires a callback argument");var o=this._checkKey(e)||this._checkValue(n);if(o)return t.nextTick(i,o);e=this._serializeKey(e),n=this._serializeValue(n),"object"==typeof r&&null!==r||(r={}),this._put(e,n,r,i)},u.prototype._put=function(e,n,r,i){t.nextTick(i)},u.prototype.del=function(e,n,r){if("function"==typeof n&&(r=n),"function"!=typeof r)throw new Error("del() requires a callback argument");var i=this._checkKey(e);if(i)return t.nextTick(r,i);e=this._serializeKey(e),"object"==typeof n&&null!==n||(n={}),this._del(e,n,r)},u.prototype._del=function(e,n,r){t.nextTick(r)},u.prototype.batch=function(e,n,r){if(!arguments.length)return this._chainedBatch();if("function"==typeof n&&(r=n),"function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return t.nextTick(r,new Error("batch(array) requires an array argument"));if(0===e.length)return t.nextTick(r);"object"==typeof n&&null!==n||(n={});for(var o=new Array(e.length),s=0;s * https://github.com/rvagg/prr * License: MIT */ -var r,i,o;r="prr",i=this,o=function(){var e="function"==typeof Object.defineProperty?function(e,t,n){return Object.defineProperty(e,t,n),e}:function(e,t,n){return e[t]=n.value,e},t=function(e,t){var n="object"==typeof t,r=!n&&"string"==typeof t,i=function(e){return n?!!t[e]:!!r&&t.indexOf(e[0])>-1};return{enumerable:i("enumerable"),configurable:i("configurable"),writable:i("writable"),value:e}},n=function(n,r,i,o){var s;if(o=t(i,o),"object"==typeof r){for(s in r)Object.hasOwnProperty.call(r,s)&&(o.value=r[s],e(n,s,o));return n}return e(n,r,o)};return n},e.exports?e.exports=o():i.prr=o()},function(e,t,n){"use strict";var r=n(301).AbstractLevelDOWN,i=n(301).AbstractChainedBatch,o=n(301).AbstractIterator,s=n(1),a=n(840),u=n(300).EncodingError;function l(e,t){if(!(this instanceof l))return new l(e,t);r.call(this,""),t=t||{},void 0===t.keyEncoding&&(t.keyEncoding="utf8"),void 0===t.valueEncoding&&(t.valueEncoding="utf8"),this.db=e,this.codec=new a(t)}function c(e,t){o.call(this,e),this.codec=e.codec,this.keys=t.keys,this.values=t.values,this.opts=this.codec.encodeLtgt(t),this.it=e.db.iterator(this.opts)}function f(e,t){i.call(this,e),this.codec=e.codec,this.batch=e.db.batch()}e.exports=l.default=l,s(l,r),l.prototype._serializeKey=l.prototype._serializeValue=function(e){return e},l.prototype._open=function(e,t){this.db.open(e,t)},l.prototype._close=function(e){this.db.close(e)},l.prototype._put=function(e,t,n,r){e=this.codec.encodeKey(e,n),t=this.codec.encodeValue(t,n),this.db.put(e,t,n,r)},l.prototype._get=function(e,t,n){var r=this;e=this.codec.encodeKey(e,t),t.asBuffer=this.codec.valueAsBuffer(t),this.db.get(e,t,function(e,i){if(e)return n(e);try{i=r.codec.decodeValue(i,t)}catch(e){return n(new u(e))}n(null,i)})},l.prototype._del=function(e,t,n){e=this.codec.encodeKey(e,t),this.db.del(e,t,n)},l.prototype._chainedBatch=function(){return new f(this)},l.prototype._batch=function(e,t,n){e=this.codec.encodeBatch(e,t),this.db.batch(e,t,n)},l.prototype._iterator=function(e){return e.keyAsBuffer=this.codec.keyAsBuffer(e),e.valueAsBuffer=this.codec.valueAsBuffer(e),new c(this,e)},l.prototype.approximateSize=function(e,t,n,r){return e=this.codec.encodeKey(e,n),t=this.codec.encodeKey(t,n),this.db.approximateSize(e,t,n,r)},s(c,o),c.prototype._next=function(e){var t=this;this.it.next(function(n,r,i){if(n)return e(n);try{r=t.keys&&void 0!==r?t.codec.decodeKey(r,t.opts):void 0,i=t.values&&void 0!==i?t.codec.decodeValue(i,t.opts):void 0}catch(n){return e(new u(n))}e(null,r,i)})},c.prototype._seek=function(e){e=this.codec.encodeKey(e,this.opts),this.it.seek(e)},c.prototype._end=function(e){this.it.end(e)},s(f,i),f.prototype._put=function(e,t){e=this.codec.encodeKey(e),t=this.codec.encodeValue(t),this.batch.put(e,t)},f.prototype._del=function(e){e=this.codec.encodeKey(e),this.batch.del(e)},f.prototype._clear=function(){this.batch.clear()},f.prototype._write=function(e,t){this.batch.write(e,t)}},function(e,t,n){(function(t,r){var i=n(69),o=n(425),s=n(426),a=Object.prototype.hasOwnProperty,u="start end gt gte lt lte".split(" ");function l(){this.status="new"}function c(e,t){var n={};for(var r in t)if(a.call(t,r)){var i=t[r];f(r)&&(i=e._serializeKey(i)),n[r]=i}return n}function f(e){return-1!==u.indexOf(e)}l.prototype.open=function(e,t){var n=this,r=this.status;if("function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("open() requires a callback argument");"object"==typeof e&&null!==e||(e={}),e.createIfMissing=!1!==e.createIfMissing,e.errorIfExists=!!e.errorIfExists,this.status="opening",this._open(e,function(e){if(e)return n.status=r,t(e);n.status="open",t()})},l.prototype._open=function(e,n){t.nextTick(n)},l.prototype.close=function(e){var t=this,n=this.status;if("function"!=typeof e)throw new Error("close() requires a callback argument");this.status="closing",this._close(function(r){if(r)return t.status=n,e(r);t.status="closed",e()})},l.prototype._close=function(e){t.nextTick(e)},l.prototype.get=function(e,n,r){if("function"==typeof n&&(r=n),"function"!=typeof r)throw new Error("get() requires a callback argument");var i=this._checkKey(e);if(i)return t.nextTick(r,i);e=this._serializeKey(e),"object"==typeof n&&null!==n||(n={}),n.asBuffer=!1!==n.asBuffer,this._get(e,n,r)},l.prototype._get=function(e,n,r){t.nextTick(function(){r(new Error("NotFound"))})},l.prototype.put=function(e,n,r,i){if("function"==typeof r&&(i=r),"function"!=typeof i)throw new Error("put() requires a callback argument");var o=this._checkKey(e)||this._checkValue(n);if(o)return t.nextTick(i,o);e=this._serializeKey(e),n=this._serializeValue(n),"object"==typeof r&&null!==r||(r={}),this._put(e,n,r,i)},l.prototype._put=function(e,n,r,i){t.nextTick(i)},l.prototype.del=function(e,n,r){if("function"==typeof n&&(r=n),"function"!=typeof r)throw new Error("del() requires a callback argument");var i=this._checkKey(e);if(i)return t.nextTick(r,i);e=this._serializeKey(e),"object"==typeof n&&null!==n||(n={}),this._del(e,n,r)},l.prototype._del=function(e,n,r){t.nextTick(r)},l.prototype.batch=function(e,n,r){if(!arguments.length)return this._chainedBatch();if("function"==typeof n&&(r=n),"function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return t.nextTick(r,new Error("batch(array) requires an array argument"));if(0===e.length)return t.nextTick(r);"object"==typeof n&&null!==n||(n={});for(var o=new Array(e.length),s=0;s-1?t.encodeKey(e[r],e):e[r]}),n},i.prototype.createStreamDecoder=function(e){var t=this;return e.keys&&e.values?function(n,r){return{key:t.decodeKey(n,e),value:t.decodeValue(r,e)}}:e.keys?function(n){return t.decodeKey(n,e)}:e.values?function(n,r){return t.decodeValue(r,e)}:function(){}},i.prototype.keyAsBuffer=function(e){return this._keyEncoding(e).buffer},i.prototype.valueAsBuffer=function(e){return this._valueEncoding(e).buffer}},function(e,t,n){(function(e){t.utf8=t["utf-8"]={encode:function(e){return i(e)?e:String(e)},decode:r,buffer:!1,type:"utf8"},t.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},t.binary={encode:function(t){return i(t)?t:e.from(t)},decode:r,buffer:!0,type:"binary"},t.none={encode:r,decode:r,buffer:!1,type:"id"},t.id=t.none;var n=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];function r(e){return e}function i(t){return void 0===t||null===t||e.isBuffer(t)}n.forEach(function(n){t[n]={encode:function(t){return i(t)?t:e.from(t,n)},decode:function(e){return e.toString(n)},buffer:!0,type:n}})}).call(this,n(0).Buffer)},function(e,t,n){(function(t,r){e.exports=u;var i=n(427).AbstractLevelDOWN,o=n(13),s=n(844),a=n(69);function u(e){if(!(this instanceof u))return new u(e);i.call(this,e)}o.inherits(u,i),u.prototype._open=function(e,t){var n=this;if(this._idbOpts=a({storeName:this.location,keyEncoding:"none",valueEncoding:"none"},e),this._idbOpts.idb)o(this._idbOpts.idb);else{var r=indexedDB.open(this.location);r.onerror=i,r.onsuccess=function(){o(r.result)}}function i(e){t(e.target.error)}function o(r){n._db=r;var i=n._db.objectStoreNames.contains(n._idbOpts.storeName);if(e.errorIfExists&&i)return n._db.close(),void t(new Error("store already exists"));if(!e.createIfMissing&&!i)return n._db.close(),void t(new Error("store does not exist"));if(e.createIfMissing&&!i){n._db.close();var o=indexedDB.open(n.location,n._db.version+1);return o.onerror=function(e){t(e.target.error)},o.onupgradeneeded=function(){var e=o.result;e.createObjectStore(n._idbOpts.storeName,n._idbOpts)},void(o.onsuccess=function(){n._db=o.result,t(null,n)})}t(null,n)}},u.prototype._get=function(e,n,r){n=a(this._idbOpts,n);var i=e;"binary"!==n.keyEncoding||Array.isArray(e)||(e=Array.prototype.slice.call(e));var o=this._db.transaction(this._idbOpts.storeName),s=o.objectStore(this._idbOpts.storeName).openCursor(IDBKeyRange.only(e));o.onabort=function(){r(o.error)},s.onsuccess=function(){var e=s.result;if(e){var o=e.value;if(o instanceof Uint8Array&&(o=new t(o)),"binary"!==n.valueEncoding||t.isBuffer(o)||(o=new t(o)),n.asBuffer&&!t.isBuffer(o))if(null==o)o=new t(0);else if("string"==typeof o)o=new t(o);else if("boolean"==typeof o)o=new t(String(o));else if("number"==typeof o)o=new t(String(o));else if(Array.isArray(o))o=new t(String(o));else{if(!(o instanceof Uint8Array))return void r(new TypeError("can't coerce `"+o.constructor.name+"` into a Buffer"));o=new t(o)}r(null,o,i)}else r(new Error("NotFound"))}},u.prototype._del=function(e,t,n){t=a(this._idbOpts,t),"binary"!==t.keyEncoding||Array.isArray(e)||(e=Array.prototype.slice.call(e));var r="readwrite";!0===t.sync&&(r="readwriteflush");var i=this._db.transaction(this._idbOpts.storeName,r),o=i.objectStore(this._idbOpts.storeName).delete(e);i.onabort=function(){n(i.error)},i.oncomplete=function(){n()}},u.prototype._put=function(e,t,n,r){n=a(this._idbOpts,n),"binary"!==n.keyEncoding||Array.isArray(e)||(e=Array.prototype.slice.call(e));var i="readwrite";!0===n.sync&&(i="readwriteflush");var o=this._db.transaction(this._idbOpts.storeName,i),s=o.objectStore(this._idbOpts.storeName).put(t,e);o.onabort=function(){r(o.error)},o.oncomplete=function(){r()}},u.prototype._iterator=function(e){return new s(this,e)},u.prototype._batch=function(e,t,n){if(0===e.length)return r.nextTick(n);var i="readwrite";!0===t.sync&&(i="readwriteflush");var o=this._db.transaction(this._idbOpts.storeName,i),s=o.objectStore(this._idbOpts.storeName);o.onabort=function(){n(o.error)},o.oncomplete=function(){n()},e.forEach(function(e){var n=a(t,e);"binary"!==n.keyEncoding||Array.isArray(e.key)||(e.key=Array.prototype.slice.call(e.key)),"del"===e.type?s.delete(e.key):s.put(e.value,e.key)})},u.prototype._close=function(e){this._db.close(),r.nextTick(e)},u.prototype._approximateSize=function(e,t,n){var i=new Error("Not implemented");if(!n)throw i;r.nextTick(function(){n(i)})},u.destroy=function(e,t){var n;if(null!=e&&"object"==typeof e)n=a({location:e.location,storeName:e.location},e._idbOpts);else{if("string"!=typeof e)throw new TypeError("location must be a string or an object");n={location:e,storeName:e}}if("string"!=typeof n.location)throw new TypeError("location must be a string");if("string"!=typeof n.storeName)throw new TypeError("db.storeName must be a string");var r=indexedDB.open(n.location);r.onerror=function(e){t(e.target.error)},r.onsuccess=function(){var e=r.result;function i(e){var n=indexedDB.deleteDatabase(e);n.onerror=function(e){t(e.target.error)},n.onsuccess=function(){t()}}if(e.close(),0!==e.objectStoreNames.length)if(e.objectStoreNames.contains(n.storeName)){var o=indexedDB.open(n.location,e.version+1);o.onerror=function(e){t(e.target.error)},o.onupgradeneeded=function(){e=o.result,e.deleteObjectStore(n.storeName)},o.onsuccess=function(){e=o.result,e.close(),0===e.objectStoreNames.length?i(n.location):t()}}else t();else i(n.location)}}}).call(this,n(0).Buffer,n(2))},function(e,t,n){var r=n(428);function i(e){return!(!e||"object"!=typeof e)&&Object.keys(r.prototype).filter(function(e){return"_"!=e[0]&&"approximateSize"!=e}).every(function(t){return"function"==typeof e[t]})}e.exports=i},function(e,t,n){(function(t,r){var i=n(13),o=n(427).AbstractIterator,s=n(845),a=n(846),u=n(57),l=n(69),c=u.Writable;function f(e,t){if(this._db=e._db,this._idbOpts=e._idbOpts,o.call(this,e),this._options=l({snapshot:!0},this._idbOpts,t),this._limit=this._options.limit,null!=this._limit&&-1!==this._limit||(this._limit=1/0),"number"!=typeof this._limit)throw new TypeError("options.limit must be a number");0!==this._limit&&(this._count=0,this._startCursor(this._options))}e.exports=f,i.inherits(f,o),f.prototype._startCursor=function(e){e=l(this._options,e);var t=this,n=null,r=s.lowerBound(e),i=s.upperBound(e),o=s.lowerBoundExclusive(e),u=s.upperBoundExclusive(e),f=e.reverse?"prev":"next";if(r&&("binary"!==e.keyEncoding||Array.isArray(r)||(r=Array.prototype.slice.call(r))),i&&("binary"!==e.keyEncoding||Array.isArray(i)||(i=Array.prototype.slice.call(i))),r&&i)try{n=IDBKeyRange.bound(r,i,o,u)}catch(e){return void(this._keyRangeError=!0)}else r?n=IDBKeyRange.lowerBound(r,o):i&&(n=IDBKeyRange.upperBound(i,u));this._reader=a(this._db,this._idbOpts.storeName,l(e,{range:n,direction:f})),this._reader.on("error",function(e){var n=t._callback;t._callback=!1,n?n(e):t._readNext=function(t){t(e)}}),this._reader.pipe(new c({objectMode:!0,write:function(e,n,r){if(t._count++>=t._limit)return t._reader.pause(),t._reader.unpipe(this),r(),void this.end();var i=t._callback;t._callback=!1,i?t._processItem(e,function(e,t,n){r(e),i(e,t,n)}):t._readNext=function(n){t._processItem(e,function(e,t,i){r(e),n(e,t,i)})}}})).on("finish",function(){var e=t._callback;t._callback=!1,e?e():t._readNext=function(e){e()}})},f.prototype._processItem=function(e,n){if("function"!=typeof n)throw new TypeError("cb must be a function");var r=e.key,i=e.value;if(i instanceof Uint8Array&&(i=new t(i)),"binary"===this._options.keyEncoding&&Array.isArray(r)&&(r=new t(r)),"binary"!==this._options.valueEncoding||t.isBuffer(i)||(i=new t(i)),this._options.keyAsBuffer&&!t.isBuffer(r))if(null==r)r=new t(0);else if("string"==typeof r)r=new t(r);else if("boolean"==typeof r)r=new t(String(r));else if("number"==typeof r)r=new t(String(r));else if(Array.isArray(r))r=new t(String(r));else{if(!(r instanceof Uint8Array))throw new TypeError("can't coerce `"+r.constructor.name+"` into a Buffer");r=new t(r)}if(this._options.valueAsBuffer&&!t.isBuffer(i))if(null==i)i=new t(0);else if("string"==typeof i)i=new t(i);else if("boolean"==typeof i)i=new t(String(i));else if("number"==typeof i)i=new t(String(i));else if(Array.isArray(i))i=new t(String(i));else{if(!(i instanceof Uint8Array))throw new TypeError("can't coerce `"+i.constructor.name+"` into a Buffer");i=new t(i)}n(null,r,i)},f.prototype._next=function(e){if(this._callback)throw new Error("callback already exists");if(this._keyRangeError||0===this._limit)e();else{var t=this._readNext;this._readNext=!1,t?r.nextTick(function(){t(e)}):this._callback=e}}}).call(this,n(0).Buffer,n(2))},function(e,t,n){(function(e){function n(e){return void 0!==e&&""!==e}function r(e,t){return Object.hasOwnProperty.call(e,t)}function i(e,t){return Object.hasOwnProperty.call(e,t)&&t}t.compare=function(t,n){if(e.isBuffer(t)){for(var r=Math.min(t.length,n.length),i=0;in?1:0};var o=t.lowerBoundKey=function(e){return i(e,"gt")||i(e,"gte")||i(e,"min")||(e.reverse?i(e,"end"):i(e,"start"))||void 0},s=t.lowerBound=function(e,t){var n=o(e);return n?e[n]:t},a=t.lowerBoundInclusive=function(e){return!r(e,"gt")},u=t.upperBoundInclusive=function(e){return!r(e,"lt")},l=t.lowerBoundExclusive=function(e){return!a(e)},c=t.upperBoundExclusive=function(e){return!u(e)},f=t.upperBoundKey=function(e){return i(e,"lt")||i(e,"lte")||i(e,"max")||(e.reverse?i(e,"start"):i(e,"end"))||void 0},h=t.upperBound=function(e,t){var n=f(e);return n?e[n]:t};function p(e){return e}t.start=function(e,t){return e.reverse?h(e,t):s(e,t)},t.end=function(e,t){return e.reverse?s(e,t):h(e,t)},t.startInclusive=function(e){return e.reverse?u(e):a(e)},t.endInclusive=function(e){return e.reverse?a(e):u(e)},t.toLtgt=function(e,n,i,o,s){n=n||{},i=i||p;var a=arguments.length>3,u=t.lowerBoundKey(e),l=t.upperBoundKey(e);return u?"gt"===u?n.gt=i(e.gt,!1):n.gte=i(e[u],!1):a&&(n.gte=i(o,!1)),l?"lt"===l?n.lt=i(e.lt,!0):n.lte=i(e[l],!0):a&&(n.lte=i(s,!0)),null!=e.reverse&&(n.reverse=!!e.reverse),r(n,"max")&&delete n.max,r(n,"min")&&delete n.min,r(n,"start")&&delete n.start,r(n,"end")&&delete n.end,n},t.contains=function(e,r,i){i=i||t.compare;var o=s(e);if(n(o)){var a=i(r,o);if(a<0||0===a&&l(e))return!1}var u=h(e);if(n(u)){var a=i(r,u);if(a>0||0===a&&c(e))return!1}return!0},t.filter=function(e,n){return function(r){return t.contains(e,r,n)}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(57),i=n(69);function o(e,t,n){if("object"!=typeof e)throw new TypeError("db must be an object");if("string"!=typeof t)throw new TypeError("storeName must be a string");if(null==n&&(n={}),"object"!=typeof n)throw new TypeError("opts must be an object");var o=new r.Transform(i(n,{objectMode:!0,transform:function(e,t,n){n(null,e)}}));n=i({snapshot:!1},n);var s=null;function a(){var r,i,u,l,c=n.direction||"next",f=n.range||{},h;r=f.lower,i=f.upper,u=!!f.lowerOpen,l=!!f.upperOpen,s&&("next"===c?(u=!0,r=s):(l=!0,i=s)),r&&i?h=IDBKeyRange.bound(r,i,u,l):r?h=IDBKeyRange.lowerBound(r,u):i&&(h=IDBKeyRange.upperBound(i,l));var p=e.transaction(t,"readonly"),d=p.objectStore(t);o._cursorsOpened++;var m=d.openCursor(h,n.direction);function g(e){try{e.continue()}catch(e){"TransactionInactiveError"!==e.name||n.snapshot?o.emit("error",e):a()}}m.onsuccess=function(){var e=m.result;if(e){s=e.key;var t=o.write({key:e.key,value:e.value});n.snapshot||t?g(e):o.once("drain",function(){g(e)})}else o.end()},p.onabort=function(){o.emit("error",p.error)},p.onerror=function(){o.emit("error",p.error)}}return o._cursorsOpened=0,a(),o}e.exports=o},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=n(4).Buffer,o=n(849);function s(e,t,n){e.copy(t,n)}e.exports=function(){function e(){r(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function e(t){var n={data:t,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length},e.prototype.unshift=function e(t){var n={data:t,next:this.head};0===this.length&&(this.tail=n),this.head=n,++this.length},e.prototype.shift=function e(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},e.prototype.clear=function e(){this.head=this.tail=null,this.length=0},e.prototype.join=function e(t){if(0===this.length)return"";for(var n=this.head,r=""+n.data;n=n.next;)r+=t+n.data;return r},e.prototype.concat=function e(t){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var n=i.allocUnsafe(t>>>0),r=this.head,o=0;r;)s(r.data,n,o),o+=r.data.length,r=r.next;return n},e}(),o&&o.inspect&&o.inspect.custom&&(e.exports.prototype[o.inspect.custom]=function(){var e=o.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,n){"use strict";e.exports=o;var r=n(434),i=n(7);function o(e){if(!(this instanceof o))return new o(e);r.call(this,e)}i.inherits=n(1),i.inherits(o,r),o.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){e.exports=n(303)},function(e,t,n){e.exports=n(116)},function(e,t,n){e.exports=n(302).Transform},function(e,t,n){e.exports=n(302).PassThrough},function(e,t,n){"use strict";e.exports={Spec:{type:"mount",mounts:[{mountpoint:"/blocks",type:"measure",prefix:"flatfs.datastore",child:{type:"flatfs",path:"blocks",sync:!0,shardFunc:"/repo/flatfs/shard/v1/next-to-last/2"}},{mountpoint:"/",type:"measure",prefix:"leveldb.datastore",child:{type:"levelds",path:"datastore",compression:"none"}}]}}},function(e,t,n){"use strict";t.ERR_REPO_NOT_INITIALIZED="ERR_REPO_NOT_INITIALIZED"},function(e,t,n){"use strict";e.exports={repoVersion:7}},function(e,t){e.exports=function(){var e,t,n,r,i;function o(o){return i?i(o):(e=o,function(e,i){t?t(e,i):(r=e,n=i)})}return o.resolve=function(o){if(i)throw new Error("already resolved");if(i=o,!i)throw new Error("resolve *must* be passed a transform stream");e&&(t=i(e),n&&t(r,n))},o}},function(e,t,n){"use strict";t.Diagnose=n(860),t.Decoder=n(441),t.Encoder=n(863),t.Simple=n(442),t.Tagged=n(443),t.decodeAll=t.Decoder.decodeAll,t.decodeFirst=t.Decoder.decodeFirst,t.diagnose=t.Diagnose.diagnose,t.encode=t.Encoder.encode,t.decode=t.Decoder.decode,t.leveldb={decode:t.Decoder.decodeAll,encode:t.Encoder.encode,buffer:!0,name:"cbor"}},function(e,t,n){"use strict";(function(t){const r=n(441),i=n(305);class o extends r{createTag(e,t){return`${e}(${t})`}createInt(e){return super.createInt(e).toString()}createInt32(e,t){return super.createInt32(e,t).toString()}createInt64(e,t,n,r){return super.createInt64(e,t,n,r).toString()}createInt32Neg(e,t){return super.createInt32Neg(e,t).toString()}createInt64Neg(e,t,n,r){return super.createInt64Neg(e,t,n,r).toString()}createTrue(){return"true"}createFalse(){return"false"}createFloat(e){const t=super.createFloat(e);return i.isNegativeZero(e)?"-0_1":`${t}_1`}createFloatSingle(e,t,n,r){const i=super.createFloatSingle(e,t,n,r);return`${i}_2`}createFloatDouble(e,t,n,r,i,o,s,a){const u=super.createFloatDouble(e,t,n,r,i,o,s,a);return`${u}_3`}createByteString(e,t){const n=e.join(", ");return-1===t?`(_ ${n})`:`h'${n}`}createByteStringFromHeap(e,n){const r=t.from(super.createByteStringFromHeap(e,n)).toString("hex");return`h'${r}'`}createInfinity(){return"Infinity_1"}createInfinityNeg(){return"-Infinity_1"}createNaN(){return"NaN_1"}createNaNNeg(){return"-NaN_1"}createNull(){return"null"}createUndefined(){return"undefined"}createSimpleUnassigned(e){return`simple(${e})`}createArray(e,t){const n=super.createArray(e,t);return-1===t?`[_ ${n.join(", ")}]`:`[${n.join(", ")}]`}createMap(e,t){const n=super.createMap(e),r=Array.from(n.keys()).reduce(s(n),"");return-1===t?`{_ ${r}}`:`{${r}}`}createObject(e,t){const n=super.createObject(e),r=Object.keys(n).reduce(s(n),"");return-1===t?`{_ ${r}}`:`{${r}}`}createUtf8String(e,t){const n=e.join(", ");return-1===t?`(_ ${n})`:`"${n}"`}createUtf8StringFromHeap(e,n){const r=t.from(super.createUtf8StringFromHeap(e,n)).toString("utf8");return`"${r}"`}static diagnose(e,n){"string"==typeof e&&(e=t.from(e,n||"hex"));const r=new o;return r.decodeFirst(e)}}function s(e){return(t,n)=>t?`${t}, ${n}: ${e[n]}`:`${n}: ${e[n]}`}e.exports=o}).call(this,n(0).Buffer)},function(e,t){e.exports=function e(t,n,r){"use asm";var i=new t.Uint8Array(r);var o=n.pushInt;var s=n.pushInt32;var a=n.pushInt32Neg;var u=n.pushInt64;var l=n.pushInt64Neg;var c=n.pushFloat;var f=n.pushFloatSingle;var h=n.pushFloatDouble;var p=n.pushTrue;var d=n.pushFalse;var m=n.pushUndefined;var g=n.pushNull;var y=n.pushInfinity;var b=n.pushInfinityNeg;var v=n.pushNaN;var w=n.pushNaNNeg;var _=n.pushArrayStart;var k=n.pushArrayStartFixed;var S=n.pushArrayStartFixed32;var E=n.pushArrayStartFixed64;var x=n.pushObjectStart;var C=n.pushObjectStartFixed;var A=n.pushObjectStartFixed32;var I=n.pushObjectStartFixed64;var T=n.pushByteString;var j=n.pushByteStringStart;var O=n.pushUtf8String;var P=n.pushUtf8StringStart;var B=n.pushSimpleUnassigned;var R=n.pushTagStart;var N=n.pushTagStart4;var M=n.pushTagStart8;var L=n.pushTagUnassigned;var F=n.pushBreak;var D=t.Math.pow;var U=0;var z=0;var q=0;function K(e){e=e|0;U=0;z=e;while((U|0)<(z|0)){q=Ze[i[U]&255](i[U]|0)|0;if((q|0)>0){break}}return q|0}function H(e){e=e|0;if(((U|0)+(e|0)|0)<(z|0)){return 0}return 1}function V(e){e=e|0;return i[e|0]<<8|i[e+1|0]|0}function W(e){e=e|0;return i[e|0]<<24|i[e+1|0]<<16|i[e+2|0]<<8|i[e+3|0]|0}function $(e){e=e|0;o(e|0);U=U+1|0;return 0}function G(e){e=e|0;if(H(1)|0){return 1}o(i[U+1|0]|0);U=U+2|0;return 0}function Y(e){e=e|0;if(H(2)|0){return 1}o(V(U+1|0)|0);U=U+3|0;return 0}function J(e){e=e|0;if(H(4)|0){return 1}s(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function Z(e){e=e|0;if(H(8)|0){return 1}u(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function Q(e){e=e|0;o(-1-(e-32|0)|0);U=U+1|0;return 0}function X(e){e=e|0;if(H(1)|0){return 1}o(-1-(i[U+1|0]|0)|0);U=U+2|0;return 0}function ee(e){e=e|0;var t=0;if(H(2)|0){return 1}t=V(U+1|0)|0;o(-1-(t|0)|0);U=U+3|0;return 0}function te(e){e=e|0;if(H(4)|0){return 1}a(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function ne(e){e=e|0;if(H(8)|0){return 1}l(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function re(e){e=e|0;var t=0;var n=0;var r=0;r=e-64|0;if(H(r|0)|0){return 1}t=U+1|0;n=(U+1|0)+(r|0)|0;T(t|0,n|0);U=n|0;return 0}function ie(e){e=e|0;var t=0;var n=0;var r=0;if(H(1)|0){return 1}r=i[U+1|0]|0;t=U+2|0;n=(U+2|0)+(r|0)|0;if(H(r+1|0)|0){return 1}T(t|0,n|0);U=n|0;return 0}function oe(e){e=e|0;var t=0;var n=0;var r=0;if(H(2)|0){return 1}r=V(U+1|0)|0;t=U+3|0;n=(U+3|0)+(r|0)|0;if(H(r+2|0)|0){return 1}T(t|0,n|0);U=n|0;return 0}function se(e){e=e|0;var t=0;var n=0;var r=0;if(H(4)|0){return 1}r=W(U+1|0)|0;t=U+5|0;n=(U+5|0)+(r|0)|0;if(H(r+4|0)|0){return 1}T(t|0,n|0);U=n|0;return 0}function ae(e){e=e|0;return 1}function ue(e){e=e|0;j();U=U+1|0;return 0}function le(e){e=e|0;var t=0;var n=0;var r=0;r=e-96|0;if(H(r|0)|0){return 1}t=U+1|0;n=(U+1|0)+(r|0)|0;O(t|0,n|0);U=n|0;return 0}function ce(e){e=e|0;var t=0;var n=0;var r=0;if(H(1)|0){return 1}r=i[U+1|0]|0;t=U+2|0;n=(U+2|0)+(r|0)|0;if(H(r+1|0)|0){return 1}O(t|0,n|0);U=n|0;return 0}function fe(e){e=e|0;var t=0;var n=0;var r=0;if(H(2)|0){return 1}r=V(U+1|0)|0;t=U+3|0;n=(U+3|0)+(r|0)|0;if(H(r+2|0)|0){return 1}O(t|0,n|0);U=n|0;return 0}function he(e){e=e|0;var t=0;var n=0;var r=0;if(H(4)|0){return 1}r=W(U+1|0)|0;t=U+5|0;n=(U+5|0)+(r|0)|0;if(H(r+4|0)|0){return 1}O(t|0,n|0);U=n|0;return 0}function pe(e){e=e|0;return 1}function de(e){e=e|0;P();U=U+1|0;return 0}function me(e){e=e|0;k(e-128|0);U=U+1|0;return 0}function ge(e){e=e|0;if(H(1)|0){return 1}k(i[U+1|0]|0);U=U+2|0;return 0}function ye(e){e=e|0;if(H(2)|0){return 1}k(V(U+1|0)|0);U=U+3|0;return 0}function be(e){e=e|0;if(H(4)|0){return 1}S(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function ve(e){e=e|0;if(H(8)|0){return 1}E(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function we(e){e=e|0;_();U=U+1|0;return 0}function _e(e){e=e|0;var t=0;t=e-160|0;if(H(t|0)|0){return 1}C(t|0);U=U+1|0;return 0}function ke(e){e=e|0;if(H(1)|0){return 1}C(i[U+1|0]|0);U=U+2|0;return 0}function Se(e){e=e|0;if(H(2)|0){return 1}C(V(U+1|0)|0);U=U+3|0;return 0}function Ee(e){e=e|0;if(H(4)|0){return 1}A(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function xe(e){e=e|0;if(H(8)|0){return 1}I(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function Ce(e){e=e|0;x();U=U+1|0;return 0}function Ae(e){e=e|0;R(e-192|0|0);U=U+1|0;return 0}function Ie(e){e=e|0;R(e|0);U=U+1|0;return 0}function Te(e){e=e|0;R(e|0);U=U+1|0;return 0}function je(e){e=e|0;R(e|0);U=U+1|0;return 0}function Oe(e){e=e|0;R(e|0);U=U+1|0;return 0}function Pe(e){e=e|0;R(e-192|0|0);U=U+1|0;return 0}function Be(e){e=e|0;R(e|0);U=U+1|0;return 0}function Re(e){e=e|0;R(e|0);U=U+1|0;return 0}function Ne(e){e=e|0;R(e|0);U=U+1|0;return 0}function Me(e){e=e|0;if(H(1)|0){return 1}R(i[U+1|0]|0);U=U+2|0;return 0}function Le(e){e=e|0;if(H(2)|0){return 1}R(V(U+1|0)|0);U=U+3|0;return 0}function Fe(e){e=e|0;if(H(4)|0){return 1}N(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function De(e){e=e|0;if(H(8)|0){return 1}M(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function Ue(e){e=e|0;B((e|0)-224|0);U=U+1|0;return 0}function ze(e){e=e|0;d();U=U+1|0;return 0}function qe(e){e=e|0;p();U=U+1|0;return 0}function Ke(e){e=e|0;g();U=U+1|0;return 0}function He(e){e=e|0;m();U=U+1|0;return 0}function Ve(e){e=e|0;if(H(1)|0){return 1}B(i[U+1|0]|0);U=U+2|0;return 0}function We(e){e=e|0;var t=0;var n=0;var r=1.0;var o=0.0;var s=0.0;var a=0.0;if(H(2)|0){return 1}t=i[U+1|0]|0;n=i[U+2|0]|0;if((t|0)&0x80){r=-1.0}o=+(((t|0)&0x7C)>>2);s=+(((t|0)&0x03)<<8|n);if(+o==0.0){c(+(+r*+5.9604644775390625e-8*+s))}else if(+o==31.0){if(+r==1.0){if(+s>0.0){v()}else{y()}}else{if(+s>0.0){w()}else{b()}}}else{c(+(+r*D(+2,+(+o-25.0))*+(1024.0+s)))}U=U+3|0;return 0}function $e(e){e=e|0;if(H(4)|0){return 1}f(i[U+1|0]|0,i[U+2|0]|0,i[U+3|0]|0,i[U+4|0]|0);U=U+5|0;return 0}function Ge(e){e=e|0;if(H(8)|0){return 1}h(i[U+1|0]|0,i[U+2|0]|0,i[U+3|0]|0,i[U+4|0]|0,i[U+5|0]|0,i[U+6|0]|0,i[U+7|0]|0,i[U+8|0]|0);U=U+9|0;return 0}function Ye(e){e=e|0;return 1}function Je(e){e=e|0;F();U=U+1|0;return 0}var Ze=[$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,G,Y,J,Z,Ye,Ye,Ye,Ye,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,X,ee,te,ne,Ye,Ye,Ye,Ye,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,ie,oe,se,ae,Ye,Ye,Ye,ue,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,ce,fe,he,pe,Ye,Ye,Ye,de,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,ge,ye,be,ve,Ye,Ye,Ye,we,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,ke,Se,Ee,xe,Ye,Ye,Ye,Ce,Ae,Ae,Ae,Ae,Ae,Ae,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Me,Le,Fe,De,Ye,Ye,Ye,Ye,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,ze,qe,Ke,He,Ve,We,$e,Ge,Ye,Ye,Ye,Je];return{parse:K}}},function(e,t,n){"use strict";const{URLWithLegacySupport:r,format:i}=n(444);e.exports=((e,t={},n={},o)=>{let s=t.protocol?t.protocol.replace(":",""):"http",a;s=(n[s]||o||s)+":";try{a=new r(e)}catch(e){a={}}const u=Object.assign({},t,{protocol:s||a.protocol,host:t.host||a.host});return new r(e,i(u)).toString()})},function(e,t,n){"use strict";(function(t){const{URL:r}=n(306),i=n(62),o=n(305),s=n(232),a=s.MT,u=s.NUMBYTES,l=s.SHIFT32,c=s.SYMS,f=s.TAG,h=s.MT.SIMPLE_FLOAT<<5|s.NUMBYTES.TWO,p=s.MT.SIMPLE_FLOAT<<5|s.NUMBYTES.FOUR,d=s.MT.SIMPLE_FLOAT<<5|s.NUMBYTES.EIGHT,m=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.TRUE,g=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.FALSE,y=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.UNDEFINED,b=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.NULL,v=new i("0x20000000000000"),w=t.from("f97e00","hex"),_=t.from("f9fc00","hex"),k=t.from("f97c00","hex");function S(e){return{}.toString.call(e).slice(8,-1)}class E{constructor(e){e=e||{},this.streaming="function"==typeof e.stream,this.onData=e.stream,this.semanticTypes=[[r,this._pushUrl],[i,this._pushBigNumber]];const t=e.genTypes||[],n=t.length;for(let e=0;e[t,e[t]]))}_pushRawMap(e,t){t=t.map(function(e){return e[0]=E.encode(e[0]),e}).sort(o.keySorter);for(var n=0;n{s.sha2256(e,(e,r)=>{e&&n(e),s.sha2256(t.from(r),n)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(u(r.sha3_512)),sha3384:a(u(r.sha3_384)),sha3256:a(u(r.sha3_256)),sha3224:a(u(r.sha3_224)),shake128:a(u(r.shake_128,128)),shake256:a(u(r.shake_256,256)),keccak224:a(u(r.keccak_224)),keccak256:a(u(r.keccak_256)),keccak384:a(u(r.keccak_384)),keccak512:a(u(r.keccak_512)),murmur3128:a(u(l(i.x64.hash128))),murmur332:a(c(l(i.x86.hash32))),addBlake:n(868),dblSha2256:f}}).call(this,n(0).Buffer)},function(e,t,n){!function(n,r){"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 n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function l(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function c(e,t){return t%=64,32===t?[e[1],e[0]]:t<32?[e[0]<>>32-t,e[1]<>>32-t]:(t-=32,[e[1]<>>32-t,e[0]<>>32-t])}function f(e,t){return t%=64,0===t?e:t<32?[e[0]<>>32-t,e[1]<>>1]),e=l(e,[4283543511,3981806797]),e=h(e,[0,e[0]>>>1]),e=l(e,[3301882366,444984403]),e=h(e,[0,e[0]>>>1]),e}i.x86.hash32=function(e,t){e=e||"",t=t||0;for(var n=e.length%4,r=e.length-n,i=t,u=0,l=3432918353,c=461845907,f=0;f>>0},i.x86.hash128=function(e,t){e=e||"",t=t||0;for(var n=e.length%16,r=e.length-n,i=t,u=t,l=t,c=t,f=0,h=0,p=0,d=0,m=597399067,g=2869860233,y=951274213,b=2716044179,v=0;v>>0).toString(16)).slice(-8)+("00000000"+(u>>>0).toString(16)).slice(-8)+("00000000"+(l>>>0).toString(16)).slice(-8)+("00000000"+(c>>>0).toString(16)).slice(-8)},i.x64.hash128=function(e,t){e=e||"",t=t||0;for(var n=e.length%16,r=e.length-n,i=[0,t],o=[0,t],s=[0,0],a=[0,0],d=[2277735313,289559509],m=[1291169091,658871167],g=0;g>>0).toString(16)).slice(-8)+("00000000"+(i[1]>>>0).toString(16)).slice(-8)+("00000000"+(o[0]>>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)},e.exports&&(t=e.exports=i),t.murmurHash3=i}(this)},function(e,t,n){"use strict";(function(t){const r=n(449),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");return(n,o)=>{const s=i.digest({name:e},n);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));r(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function u(e,t){s("SHA-256")(e,t)}function l(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:u,sha2512:l}}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var r=n(450),i;i="function"==typeof setImediate?setImediate:"object"==typeof t&&t&&t.nextTick?t.nextTick:function(e){setTimeout(e,0)};var o=[];function s(e){if(!(this instanceof s))return"function"==typeof e?new s(e):a();var t=!1,n=!1,u,l=[],c=!1;function f(e){l.length?(c=!0,l.shift()(e||!1)):c=!1}function h(e,r){return new s(function(o){function s(t){var s=n?e:r;if("function"==typeof s){function a(){var e;try{e=s(u)}catch(e){return o.reject(e),f()}o.fulfill(e),f(!0)}t?a():i(a)}else n?(o.fulfill(u),f(t)):(o.reject(u),f(t))}l.push(s),t&&!c&&f()})}this.then=h,function(){function i(e){t||(r(e)?e.then(i,s):(t=n=!0,u=e,f()))}function s(e){t||(t=!0,n=!1,u=e,f())}for(var a={fulfill:i,reject:s},l=0;li(r=>{const i=n.init(e,null);return n.update(i,r),t.from(n.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=l(t+1,a);for(let t=0;t<32;t++)e[s+t]=l(t+1,u)})}).call(this,n(0).Buffer)},function(e,t,n){var r=n(452);function i(e,t,n){var r=e[t]+e[n],i=e[t+1]+e[n+1];r>=4294967296&&i++,e[t]=r,e[t+1]=i}function o(e,t,n,r){var i=e[t]+n;n<0&&(i+=4294967296);var o=e[t+1]+r;i>=4294967296&&o++,e[t]=i,e[t+1]=o}function s(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function a(e,t,n,r,s,a){var u=h[s],l=h[s+1],c=h[a],p=h[a+1];i(f,e,t),o(f,e,u,l);var d=f[r]^f[e],m=f[r+1]^f[e+1];f[r]=m,f[r+1]=d,i(f,n,r),d=f[t]^f[n],m=f[t+1]^f[n+1],f[t]=d>>>24^m<<8,f[t+1]=m>>>24^d<<8,i(f,e,t),o(f,e,c,p),d=f[r]^f[e],m=f[r+1]^f[e+1],f[r]=d>>>16^m<<16,f[r+1]=m>>>16^d<<16,i(f,n,r),d=f[t]^f[n],m=f[t+1]^f[n+1],f[t]=m>>>31^d<<1,f[t+1]=d>>>31^m<<1}var u=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),l=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],c=new Uint8Array(l.map(function(e){return 2*e})),f=new Uint32Array(32),h=new Uint32Array(32);function p(e,t){var n=0;for(n=0;n<16;n++)f[n]=e.h[n],f[n+16]=u[n];for(f[24]=f[24]^e.t,f[25]=f[25]^e.t/4294967296,t&&(f[28]=~f[28],f[29]=~f[29]),n=0;n<32;n++)h[n]=s(e.b,4*n);for(n=0;n<12;n++)a(0,8,16,24,c[16*n+0],c[16*n+1]),a(2,10,18,26,c[16*n+2],c[16*n+3]),a(4,12,20,28,c[16*n+4],c[16*n+5]),a(6,14,22,30,c[16*n+6],c[16*n+7]),a(0,10,20,30,c[16*n+8],c[16*n+9]),a(2,12,22,24,c[16*n+10],c[16*n+11]),a(4,14,16,26,c[16*n+12],c[16*n+13]),a(6,8,18,28,c[16*n+14],c[16*n+15]);for(n=0;n<16;n++)e.h[n]=e.h[n]^f[n]^f[n+16]}function d(e,t){if(0===e||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");for(var n={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e},r=0;r<16;r++)n.h[r]=u[r];var i=t?t.length:0;return n.h[0]^=16842752^i<<8^e,t&&(m(n,t),n.c=128),n}function m(e,t){for(var n=0;n>2]>>8*(3&n);return t}function y(e,t,n){n=n||64,e=r.normalizeInput(e);var i=d(n,t);return m(i,e),g(i)}function b(e,t,n){var i=y(e,t,n);return r.toHex(i)}e.exports={blake2b:y,blake2bHex:b,blake2bInit:d,blake2bUpdate:m,blake2bFinal:g}},function(e,t,n){var r=n(452);function i(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function o(e,t,n,r,i,o){l[e]=l[e]+l[t]+i,l[r]=s(l[r]^l[e],16),l[n]=l[n]+l[r],l[t]=s(l[t]^l[n],12),l[e]=l[e]+l[t]+o,l[r]=s(l[r]^l[e],8),l[n]=l[n]+l[r],l[t]=s(l[t]^l[n],7)}function s(e,t){return e>>>t^e<<32-t}var a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),l=new Uint32Array(16),c=new Uint32Array(16);function f(e,t){var n=0;for(n=0;n<8;n++)l[n]=e.h[n],l[n+8]=a[n];for(l[12]^=e.t,l[13]^=e.t/4294967296,t&&(l[14]=~l[14]),n=0;n<16;n++)c[n]=i(e.b,4*n);for(n=0;n<10;n++)o(0,4,8,12,c[u[16*n+0]],c[u[16*n+1]]),o(1,5,9,13,c[u[16*n+2]],c[u[16*n+3]]),o(2,6,10,14,c[u[16*n+4]],c[u[16*n+5]]),o(3,7,11,15,c[u[16*n+6]],c[u[16*n+7]]),o(0,5,10,15,c[u[16*n+8]],c[u[16*n+9]]),o(1,6,11,12,c[u[16*n+10]],c[u[16*n+11]]),o(2,7,8,13,c[u[16*n+12]],c[u[16*n+13]]),o(3,4,9,14,c[u[16*n+14]],c[u[16*n+15]]);for(n=0;n<8;n++)e.h[n]^=l[n]^l[n+8]}function h(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");var n=t?t.length:0;if(t&&!(n>0&&n<=32))throw new Error("Incorrect key length, should be in [1, 32]");var r={h:new Uint32Array(a),b:new Uint32Array(64),c:0,t:0,outlen:e};return r.h[0]^=16842752^n<<8^e,n>0&&(p(r,t),r.c=64),r}function p(e,t){for(var n=0;n>2]>>8*(3&n)&255;return t}function m(e,t,n){n=n||32,e=r.normalizeInput(e);var i=h(n,t);return p(i,e),d(i)}function g(e,t,n){var i=m(e,t,n);return r.toHex(i)}e.exports={blake2s:m,blake2sHex:g,blake2sInit:h,blake2sUpdate:p,blake2sFinal:d}},function(e,t,n){var r=n(872);function i(e){if(!(e instanceof Object))throw new TypeError('"obj" must be an object (or inherit from it)');return o(e)}function o(e,t){for(var n in t=new r(e,t),e){var i=e[n];if(i instanceof Object&&(t.contains(i)||o(i,t)))return!0}return!1}e.exports=i},function(e,t){function n(e,t){this.value=e,this.next=t}e.exports=n,n.prototype.contains=function(e){for(var t=this;t;){if(t.value===e)return!0;t=t.next}return!1}},function(e,t,n){ -//! stable.js 0.1.8, https://github.com/Two-Screen/stable -//! © 2018 Angry Bytes and contributors. MIT licensed. -var r,i;r=this,i=function(){"use strict";var e=function(e,n){return t(e.slice(),n)};function t(e,t){"function"!=typeof t&&(t=function(e,t){return String(e).localeCompare(t)});var r=e.length;if(r<=1)return e;for(var i=new Array(r),o=1;oi&&(u=i),l>i&&(l=i),c=a,f=u;;)if(c"!==e[0])throw new Error("Unexpected token in map type: "+e[0]);e.shift(),t.name=e.shift();break;case"repeated":case"required":case"optional":var n=e.shift();t.required="required"===n,t.repeated="repeated"===n,t.type=e.shift(),t.name=e.shift();break;case"[":t.options=s(e);break;case";":if(null===t.name)throw new Error("Missing field name");if(null===t.type)throw new Error("Missing type in message field: "+t.name);if(-1===t.tag)throw new Error("Missing tag number in message field: "+t.name);return e.shift(),t;default:throw new Error("Unexpected token in message field: "+e[0])}throw new Error("No ; found for message field")},u=function(e){for(var t={enums:[],messages:[],fields:[],extends:[],extensions:null};e.length;)switch(e[0]){case"map":case"repeated":case"optional":case"required":t.fields.push(a(e));break;case"enum":t.enums.push(m(e));break;case"message":t.messages.push(f(e));break;case"extensions":t.extensions=c(e);break;case"oneof":e.shift();var n=e.shift();if("{"!==e[0])throw new Error("Unexpected token in oneof: "+e[0]);for(e.shift();"}"!==e[0];){e.unshift("optional");var r=a(e);r.oneof=n,t.fields.push(r)}e.shift();break;case"extend":t.extends.push(l(e));break;case";":e.shift();break;case"reserved":case"option":for(e.shift();";"!==e[0];)e.shift();break;default:e.unshift("optional"),t.fields.push(a(e))}return t},l=function(e){var t={name:e[1],message:f(e)};return t},c=function(e){e.shift();var t=Number(e.shift());if(isNaN(t))throw new Error("Invalid from in extensions definition");if("to"!==e.shift())throw new Error("Expected keyword 'to' in extensions definition");var n=e.shift();if("max"===n&&(n=536870911),n=Number(n),isNaN(n))throw new Error("Invalid to in extensions definition");if(";"!==e.shift())throw new Error("Missing ; in extensions definition");return{from:t,to:n}},f=function(e){e.shift();var t=1,n=[],r={name:e.shift(),enums:[],extends:[],messages:[],fields:[]};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("{"===e[0]?t++:"}"===e[0]&&t--,!t)return e.shift(),n=u(n),r.enums=n.enums,r.messages=n.messages,r.fields=n.fields,r.extends=n.extends,r.extensions=n.extensions,r;n.push(e.shift())}if(t)throw new Error("No closing tag for message")},h=function(e){e.shift();var t=e.shift();if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},p=function(e){if(e.shift(),"="!==e[0])throw new Error("Expected = but found "+e[0]);e.shift();var t=e.shift();switch(t){case'"proto2"':t=2;break;case'"proto3"':t=3;break;default:throw new Error("Expected protobuf syntax version but found "+t)}if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},d=function(e){if(e.length<4)throw new Error("Invalid enum value: "+e.slice(0,3).join(" "));if("="!==e[1])throw new Error("Expected = but found "+e[1]);if(";"!==e[3]&&"["!==e[3])throw new Error("Expected ; or [ but found "+e[1]);var t=e.shift();e.shift();var n={value:null,options:{}};return n.value=Number(e.shift()),"["===e[0]&&(n.options=s(e)),e.shift(),{name:t,val:n}},m=function(e){e.shift();var t={},n={name:e.shift(),values:{},options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),n;if("option"!==e[0]){var r=d(e);n.values[r.name]=r.val}else t=g(e),n.options[t.name]=t.value}throw new Error("No closing tag for enum")},g=function(e){for(var t=null,n=null,r=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")};e.length;){if(";"===e[0])return e.shift(),{name:t,value:n};switch(e[0]){case"option":e.shift();var i="("===e[0];if(i&&e.shift(),t=e.shift(),i){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}"."===e[0][0]&&(t+=e.shift());break;case"=":if(e.shift(),null===t)throw new Error("Expected key for option with value: "+e[0]);if(n=r(e.shift()),"optimize_for"===t&&!/^(SPEED|CODE_SIZE|LITE_RUNTIME)$/.test(n))throw new Error("Unexpected value for option optimize_for: "+n);"{"===n&&(n=y(e));break;default:throw new Error("Unexpected token in option: "+e[0])}}},y=function(e){for(var t=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")},n={};e.length;){if("}"===e[0])return e.shift(),n;var r="("===e[0];r&&e.shift();var i=e.shift();if(r){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}var o=null;switch(e[0]){case":":if(void 0!==n[i])throw new Error("Duplicate option map key "+i);e.shift(),o=t(e.shift()),"{"===o&&(o=y(e)),n[i]=o,";"===e[0]&&e.shift();break;case"{":if(e.shift(),o=y(e),void 0===n[i]&&(n[i]=[]),!Array.isArray(n[i]))throw new Error("Duplicate option map key "+i);n[i].push(o);break;default:throw new Error("Unexpected token in option map: "+e[0])}}throw new Error("No closing tag for option map")},b=function(e){e.shift();var t=e.shift().replace(/^"+|"+$/gm,"");if(";"!==e[0])throw new Error("Unexpected token: "+e[0]+'. Expected ";"');return e.shift(),t},v=function(e){e.shift();var t={name:e.shift(),methods:[],options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;switch(e[0]){case"option":var n=g(e);if(void 0!==t.options[n.name])throw new Error("Duplicate option "+n.name);t.options[n.name]=n.value;break;case"rpc":t.methods.push(w(e));break;default:throw new Error("Unexpected token in service: "+e[0])}}throw new Error("No closing tag for service")},w=function(e){e.shift();var t={name:e.shift(),input_type:null,output_type:null,client_streaming:!1,server_streaming:!1,options:{}};if("("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.client_streaming=!0),t.input_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),"returns"!==e[0])throw new Error("Expected returns but found "+e[0]);if(e.shift(),"("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.server_streaming=!0),t.output_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),";"===e[0])return e.shift(),t;if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;if("option"!==e[0])throw new Error("Unexpected token in rpc options: "+e[0]);var n=g(e);if(void 0!==t.options[n.name])throw new Error("Duplicate option "+n.name);t.options[n.name]=n.value}throw new Error("No closing tag for rpc")},_=function(e){for(var t=r(e.toString()),n=0;nt.extensions.to)throw new Error(t.name+" does not declare "+e.tag+" as an extension number");t.fields.push(e)})})}),s.messages.forEach(function(e){e.fields.forEach(function(t){var n,r,i,a;function u(e){return e.name===t.type}function l(e){return e.name===i}if(t.options&&"true"===t.options.packed&&-1===o.indexOf(t.type)){if(-1===t.type.indexOf(".")){if(e.enums&&e.enums.some(u))return}else{if(n=t.type.split("."),n.length>2)throw new Error("what is this?");if(r=n[0],i=n[1],s.messages.some(function(e){if(e.name===r)return a=e,e}),a&&a.enums&&a.enums.some(l))return}throw new Error("Fields of type "+t.type+' cannot be declared [packed=true]. Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire types) can be declared "packed". See https://developers.google.com/protocol-buffers/docs/encoding#optional')}})}),s};e.exports=_},function(e,t){e.exports=function(e){var t=function(e){var t=e.indexOf("//");return t>-1?e.slice(0,t):e},n=function(){var e=!1;return function(t){return"/*"===t?(e=!0,!1):"*/"===t?(e=!1,!1):!e}},r=function(e){return e.trim()};return e.replace(/([;,{}()=:[\]<>]|\/\*|\*\/)/g," $1 ").split(/\n/).map(r).filter(Boolean).map(t).map(r).filter(Boolean).join("\n").split(/\s+|\n+/gm).filter(n())}},function(e,t){var n=function(e,t){var n=e.repeated?"repeated":e.required?"required":"optional";"map"===e.type&&(n="map<"+e.map.from+","+e.map.to+">"),e.oneof&&(n="");var r=Object.keys(e.options||{}).map(function(t){return t+" = "+e.options[t]}).join(",");return r&&(r=" ["+r+"]"),t.push((n?n+" ":"")+("map"===e.map?"":e.type+" ")+e.name+" = "+e.tag+r+";"),t},r=function(e,t){t.push("message "+e.name+" {"),e.enums||(e.enums=[]),e.enums.forEach(function(e){t.push(i(e,[]))}),e.messages||(e.messages=[]),e.messages.forEach(function(e){t.push(r(e,[]))});var o={};return e.fields||(e.fields=[]),e.fields.forEach(function(e){e.oneof?(o[e.oneof]||(o[e.oneof]=[]),o[e.oneof].push(n(e,[]))):t.push(n(e,[]))}),Object.keys(o).forEach(function(e){o[e].unshift("oneof "+e+" {"),o[e].push("}"),t.push(o[e])}),t.push("}",""),t},i=function(e,t){t.push("enum "+e.name+" {"),e.options||(e.options={});var n=s(e.options,[]);return n.length>1&&t.push(n.slice(0,-1)),Object.keys(e.values).map(function(n){var r=o(e.values[n]);t.push([n+" = "+r+";"])}),t.push("}",""),t},o=function(e,t){var n=Object.keys(e.options||{}).map(function(t){return t+" = "+e.options[t]}).join(",");n&&(n=" ["+n+"]");var r=e.value+n;return r},s=function(e,t){var n=Object.keys(e);return n.forEach(function(n){var r=e[n];~n.indexOf(".")&&(n="("+n+")");var i=typeof r;"object"===i?(r=a(r,[]),r.length&&t.push("option "+n+" = {",r,"};")):("string"===i&&"optimize_for"!==n&&(r='"'+r+'"'),t.push("option "+n+" = "+r+";"))}),n.length>0&&t.push(""),t},a=function(e,t){var n=Object.keys(e);return n.forEach(function(n){var r=e[n],i=typeof r;"object"===i?Array.isArray(r)?r.forEach(function(e){e=a(e,[]),e.length&&t.push(n+" {",e,"}")}):(r=a(r,[]),r.length&&t.push(n+" {",r,"}")):("string"===i&&(r='"'+r+'"'),t.push(n+": "+r))}),t},u=function(e,t){return t.push("service "+e.name+" {"),e.options||(e.options={}),s(e.options,t),e.methods||(e.methods=[]),e.methods.forEach(function(e){t.push(l(e,[]))}),t.push("}",""),t},l=function(e,t){var n="rpc "+e.name+"(";e.client_streaming&&(n+="stream "),n+=e.input_type+") returns (",e.server_streaming&&(n+="stream "),n+=e.output_type+")",e.options||(e.options={});var r=s(e.options,[]);return r.length>1?t.push(n+" {",r.slice(0,-1),"}"):t.push(n+";"),t},c=function(e){return function(t){return Array.isArray(t)?t.map(c(e+" ")).join("\n"):e+t}};e.exports=function(e){var t=[];return t.push('syntax = "proto'+e.syntax+'";',""),e.package&&t.push("package "+e.package+";",""),e.options||(e.options={}),s(e.options,t),e.enums||(e.enums=[]),e.enums.forEach(function(e){i(e,t)}),e.messages||(e.messages=[]),e.messages.forEach(function(e){r(e,t)}),e.services&&e.services.forEach(function(e){u(e,t)}),t.map(c("")).join("\n")}},function(e,t,n){"use strict";var r=n(879),i=n(881),o=n(882),s=n(883),a=n(39),u=function(e){if(!e)return null;var t={};return Object.keys(e).forEach(function(n){t[n]=e[n].value}),t};e.exports=function(e,t){var n={},l={},c={},f=function(e,t){e.enums&&e.enums.forEach(function(e){e.id=t+(t?".":"")+e.name,l[e.id]=e,f(e,e.id)}),e.messages&&e.messages.forEach(function(r){r.id=t+(t?".":"")+r.name,n[r.id]=r,r.fields.forEach(function(r){if(r.map){var i="Map_"+r.map.from+"_"+r.map.to,o={name:i,enums:[],messages:[],fields:[{name:"key",type:r.map.from,tag:1,repeated:!1,required:!0},{name:"value",type:r.map.to,tag:2,repeated:!1,required:!1}],extensions:null,id:t+(t?".":"")+i};n[o.id]||(n[o.id]=o,e.messages.push(o)),r.type=i,r.repeated=!0}}),f(r,r.id)})};f(e,"");var h=function(e){var t=Object.keys(e.values||[]).map(function(t){return parseInt(e.values[t].value,10)}),n=function e(n,r,i){if(!t.length||-1===t.indexOf(n))throw new Error("Invalid enum value: "+n);return a.encode(n,r,i),e.bytes=a.encode.bytes,r},i=function e(n,r){var i=a.decode(n,r);if(!t.length||-1===t.indexOf(i))throw new Error("Invalid enum value: "+i);return e.bytes=a.decode.bytes,i};return r.make(0,n,i,a.encodingLength)},p=function(e,t){e.messages.forEach(function(n){t[n.name]=d(n.name,e.id)}),e.enums.forEach(function(e){t[e.name]=u(e.values)}),t.type=2,t.message=!0,t.name=e.name;var n={};e.fields.forEach(function(e){e.oneof&&(n[e.oneof]||(n[e.oneof]=[]),n[e.oneof].push(e.name))});var r=e.fields.map(function(t){return d(t.type,e.id)}),a=s(e,r,n),l=o(e,d,r,n,a),c=i(e,d,r);return l.bytes=c.bytes=0,t.buffer=!0,t.encode=l,t.decode=c,t.encodingLength=a,t},d=function(e,i,o){if(t&&t[e])return t[e];if(r[e])return r[e];var s=(i?i+"."+e:e).split(".").map(function(t,n,r){return r.slice(0,n).concat(e).join(".")}).reverse().reduce(function(e,t){return e||n[t]||l[t]},null);if(!1===o)return s;if(!s)throw new Error("Could not resolve "+e);if(s.values)return h(s);var a=c[s.id]||p(s,c[s.id]={});return a};return(e.enums||[]).concat((e.messages||[]).map(function(e){return d(e.id)}))}},function(e,t,n){"use strict";var r=n(39),i=n(880),o=n(4).Buffer,s=function(e,t,n,r){return t.bytes=n.bytes=0,{type:e,encode:t,decode:n,encodingLength:r}},a,u,l,c,f;t.make=s,t.bytes=(u=function(e){return o.isBuffer(e)?e.length:o.byteLength(e)},l=function(e){var t=u(e);return r.encodingLength(t)+t},c=function(e,t,n){var i=n,s=u(e);return r.encode(s,t,n),n+=r.encode.bytes,o.isBuffer(e)?e.copy(t,n):t.write(e,n,s),n+=s,c.bytes=n-i,t},f=function(e,t){var n=t,i=r.decode(e,t);t+=r.decode.bytes;var o=e.slice(t,t+i);return t+=o.length,f.bytes=t-n,o},s(2,c,f,l)),t.string=function(){var e=function(e){var t=o.byteLength(e);return r.encodingLength(t)+t},t=function(e,n,i){var s=i,a=o.byteLength(e);return r.encode(a,n,i,"utf-8"),i+=r.encode.bytes,n.write(e,i,a),i+=a,t.bytes=i-s,n},n=function(e,t){var i=t,o=r.decode(e,t);t+=r.decode.bytes;var s=e.toString("utf-8",t,t+o);return t+=o,n.bytes=t-i,s};return s(2,t,n,e)}(),t.bool=function(){var e=function(e){return 1},t=function(e,n,r){return n[r]=e?1:0,t.bytes=1,n},n=function(e,t){var r=e[t]>0;return n.bytes=1,r};return s(0,t,n,e)}(),t.int32=function(){var e=function(t,n){var i=r.decode(t,n);return e.bytes=r.decode.bytes,i>2147483647?i-4294967296:i},t=function(e,n,i){return r.encode(e<0?e+4294967296:e,n,i),t.bytes=r.encode.bytes,n},n=function(e){return r.encodingLength(e<0?e+4294967296:e)};return s(0,r.encode,e,n)}(),t.int64=function(){var e=function(t,n){var i=r.decode(t,n);if(i>=Math.pow(2,63)){for(var s=9;255===t[n+s-1];)s--;s=s||9;var a=o.allocUnsafe(s);t.copy(a,0,n,n+s),a[s-1]=127&a[s-1],i=-1*r.decode(a,0),e.bytes=10}else e.bytes=r.decode.bytes;return i},t=function(e,n,i){if(e<0){var o=i+9;for(r.encode(-1*e,n,i),i+=r.encode.bytes-1,n[i]=128|n[i];i=0?2*t:-2*t-1;var o=r.encode(t,n,i);return e.bytes=r.encode.bytes,o},t.decode=function e(t,n){var i=r.decode(t,n);return e.bytes=r.decode.bytes,1&i?(i+1)/-2:i/2},t.encodingLength=function(e){return r.encodingLength(e>=0?2*e:-2*e-1)}},function(e,t,n){"use strict";var r=n(39),i=n(307).defined;function o(e,t,n){for(var o=[],u={},l=[],c=[],f=0;f-1&&delete n[u[c]];if(e.message){var f=r.decode(i,o);o+=r.decode.bytes;var h=e.decode(i,o,o+f);t.map?(n[a]=n[a]||{},n[a][h.key]=h.value):t.repeated?(n[a]=n[a]||[],n[a].push(h)):n[a]=h}else t.repeated?(n[a]=n[a]||[],n[a].push(e.decode(i,o))):n[a]=e.decode(i,o);return o+=e.decode.bytes,o}return function t(f,h,p){if(null==h&&(h=0),null==p&&(p=f.length),!(p<=f.length&&h<=f.length))throw new Error("Decoded message is not valid");for(var d=h,g={},y;;){if(p<=h){var b="",v=0,w,_;for(v=0;v-1){k=!0;break}k||(w?y.repeated?g[b]=[]:(_=_&&w[_]?w[_].value:w[Object.keys(w)[0]].value,g[b]=parseInt(_||0,10)):g[b]=a(y,_))}return t.bytes=h-d,g}var x=r.decode(f,h);h+=r.decode.bytes;var C=x>>3,A=u[C];if(null!=A){var I=n[A];if(y=e.fields[A],y.packed){var T=r.decode(f,h);for(h+=r.decode.bytes,T+=h;h-1){if(b)throw new Error("only one of the properties defined in oneof "+v+" can be set");b=!0}}for(y=0;y{if(e)return n(e);r.push(t),l(s,r,n)})}e.exports=f},function(e,t,n){"use strict";(function(t){const r=n(236),i=r.cloneLinks,o=r.cloneData,s=n(234),a=n(9);function u(e,n,r){const u=o(e);let l=i(e);if("string"==typeof n)l=l.filter(e=>e.name!==n);else{if(!t.isBuffer(n)&&!a.isCID(n))return r(new Error("second arg needs to be a name or CID"),null);l=l.filter(e=>!e.cid.equals(n))}s(u,l,r)}e.exports=u}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(9),i=n(58);e.exports={resolver:{multicodec:"raw",defaultHashAlg:"sha2-256",resolve:(e,t,n)=>{n(null,{value:e,remainderPath:""})},tree:(e,t,n)=>{"function"==typeof t&&(n=t),n(null,[])}},util:{deserialize:(e,t)=>{t(null,e)},serialize:(e,t)=>{t(null,e)},cid:(e,t,n)=>{"function"==typeof t&&(n=t,t={}),t=t||{};const o=t.hashAlg||"sha2-256",s=void 0===t.version?1:t.version;i(e,o,(e,t)=>{if(e)return n(e);n(null,new r(s,"raw",t))})}}}},function(e,t,n){(function(t){var n={};e.exports=n;var r={};function i(e,t){var n=0,r=t.length,i=t.charAt(0),o=[0];for(n=0;n0;)o.push(a%r),a=a/r|0}var u="";for(n=0;0===e.at(n)&&n=0;--n)u+=t[o[n]];return u}n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var r="";if(e instanceof Uint8Array){var o=0,s=t.length,a=t.charAt(0),u=[0];for(o=0;o0;)u.push(c%s),c=c/s|0}for(o=0;0===e[o]&&o=0;--o)r+=t[u[o]]}else r=i(e,t);if(n){var f=new RegExp(".{1,"+n+"}","g");r=r.match(f).join("\r\n")}return r},n.decode=function(e,n){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof n)throw new TypeError('"alphabet" must be a string.');var i=r[n];if(!i){i=r[n]=[];for(var o=0;o>=8;for(;f>0;)u.push(255&f),f>>=8}for(var h=0;e[h]===a&&h>24&255,s>>16&255,s>>8&255,255&s);n.start(),n.update(e+a),i+=n.digest().getBytes()}return i.substring(0,t)}i.encode_rsa_oaep=function(e,t,n){var i,s,a,u;"string"==typeof n?(i=n,s=arguments[3]||void 0,a=arguments[4]||void 0):n&&(i=n.label||void 0,s=n.seed||void 0,a=n.md||void 0,n.mgf1&&n.mgf1.md&&(u=n.mgf1.md)),a?a.start():a=r.md.sha1.create(),u||(u=a);var l=Math.ceil(e.n.bitLength()/8),c=l-2*a.digestLength-2;if(t.length>c){var f=new Error("RSAES-OAEP input message length is too long.");throw f.length=t.length,f.maxLength=c,f}i||(i=""),a.update(i,"raw");for(var h=a.digest(),p="",d=c-t.length,m=0;m>>0,a>>>0];for(var u=i.fullMessageLength.length-1;u>=0;--u)i.fullMessageLength[u]+=a[1],a[1]=a[0]+(i.fullMessageLength[u]/4294967296>>>0),i.fullMessageLength[u]=i.fullMessageLength[u]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(o),l(e,n,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=r.util.createBuffer();s.putBytes(t.bytes());var a=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,u=a&i.blockLength-1,c,f;s.putBytes(o.substr(0,i.blockLength-u));for(var h=8*i.fullMessageLength[0],p=0;p>>0,h+=f,s.putInt32(h>>>0),h=c>>>0;s.putInt32(h);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};l(d,n,s);var m=r.util.createBuffer();return m.putInt32(d.h0),m.putInt32(d.h1),m.putInt32(d.h2),m.putInt32(d.h3),m.putInt32(d.h4),m.putInt32(d.h5),m.putInt32(d.h6),m.putInt32(d.h7),m},i};var o=null,s=!1,a=null;function u(){o=String.fromCharCode(128),o+=r.util.fillString(String.fromCharCode(0),64),a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=!0}function l(e,t,n){for(var r,i,o,s,u,l,c,f,h,p,d,m,g,y,b,v=n.length();v>=64;){for(c=0;c<16;++c)t[c]=n.getInt32();for(;c<64;++c)r=t[c-2],r=(r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10,i=t[c-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[c]=r+t[c-7]+i+t[c-16]|0;for(f=e.h0,h=e.h1,p=e.h2,d=e.h3,m=e.h4,g=e.h5,y=e.h6,b=e.h7,c=0;c<64;++c)s=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7),u=y^m&(g^y),o=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),l=f&h|p&(f^h),r=b+s+u+a[c]+t[c],i=o+l,b=y,y=g,g=m,m=d+r>>>0,d=p,p=h,h=f,f=r+i>>>0;e.h0=e.h0+f|0,e.h1=e.h1+h|0,e.h2=e.h2+p|0,e.h3=e.h3+d|0,e.h4=e.h4+m|0,e.h5=e.h5+g|0,e.h6=e.h6+y|0,e.h7=e.h7+b|0,v-=64}}},function(e,t,n){(function(t){var r=n(19);n(34);var i=null;!r.util.isNodejs||r.options.usePureJavaScript||t.versions["node-webkit"]||(i=n(460));var o=e.exports=r.prng=r.prng||{};o.create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},n=e.md,o=new Array(32),s=0;s<32;++s)o[s]=n.create();function a(e){if(t.pools[0].messageLength>=32)return l(),e();var n=32-t.pools[0].messageLength<<5;t.seedFile(n,function(n,r){if(n)return e(n);t.collect(r),l(),e()})}function u(){if(t.pools[0].messageLength>=32)return l();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),l()}function l(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var n=1,r=0;r<32;++r)t.reseeds%n==0&&(e.update(t.pools[r].digest().getBytes()),t.pools[r].start()),n<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function c(e){var t=null;if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;n&&n.getRandomValues&&(t=function(e){return n.getRandomValues(e)})}var i=r.util.createBuffer();if(t)for(;i.length()>16),l+=(32767&u)<<16,l+=u>>15,l=(2147483647&l)+(l>>31),f=4294967295&l;for(var a=0;a<3;++a)c=f>>>(a<<3),c^=Math.floor(256*Math.random()),i.putByte(String.fromCharCode(255&c))}return i.getBytes(e)}return t.pools=o,t.pool=0,t.generate=function(e,n){if(!n)return t.generateSync(e);var i=t.plugin.cipher,o=t.plugin.increment,s=t.plugin.formatKey,u=t.plugin.formatSeed,l=r.util.createBuffer();function c(f){if(f)return n(f);if(l.length()>=e)return n(null,l.getBytes(e));if(t.generated>1048575&&(t.key=null),null===t.key)return r.util.nextTick(function(){a(c)});var h=i(t.key,t.seed);t.generated+=h.length,l.putBytes(h),t.key=s(i(t.key,o(t.seed))),t.seed=u(i(t.key,t.seed)),r.util.setImmediate(c)}t.key=null,c()},t.generateSync=function(e){var n=t.plugin.cipher,i=t.plugin.increment,o=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var a=r.util.createBuffer();a.length()1048575&&(t.key=null),null===t.key&&u();var l=n(t.key,t.seed);t.generated+=l.length,a.putBytes(l),t.key=o(n(t.key,i(t.seed))),t.seed=s(n(t.key,t.seed))}return a.getBytes(e)},i?(t.seedFile=function(e,t){i.randomBytes(e,function(e,n){if(e)return t(e);t(null,n.toString())})},t.seedFileSync=function(e){return i.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,c(e))}catch(e){t(e)}},t.seedFileSync=c),t.collect=function(e){for(var n=e.length,r=0;r>i&255);t.collect(r)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){function n(e){var r=e.data;r.forge&&r.forge.prng&&(self.removeEventListener("message",n),t(r.forge.prng.err,r.forge.prng.bytes))}self.addEventListener("message",n),self.postMessage({forge:{prng:{needed:e}}})};else{var n=function(n){var r=n.data;r.forge&&r.forge.prng&&t.seedFile(r.forge.prng.needed,function(t,n){e.postMessage({forge:{prng:{err:t,bytes:n}}})})};e.addEventListener("message",n)}},t}}).call(this,n(2))},function(e,t,n){var r=n(19);n(118),n(34);var i=e.exports=r.sha1=r.sha1||{};r.md.sha1=r.md.algorithms.sha1=i,i.create=function(){s||a();var e=null,t=r.util.createBuffer(),n=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var n=i.messageLengthSize/4,o=0;o>>0,a>>>0];for(var l=i.fullMessageLength.length-1;l>=0;--l)i.fullMessageLength[l]+=a[1],a[1]=a[0]+(i.fullMessageLength[l]/4294967296>>>0),i.fullMessageLength[l]=i.fullMessageLength[l]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(o),u(e,n,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=r.util.createBuffer();s.putBytes(t.bytes());var a=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,l=a&i.blockLength-1,c,f;s.putBytes(o.substr(0,i.blockLength-l));for(var h=8*i.fullMessageLength[0],p=0;p>>0,h+=f,s.putInt32(h>>>0),h=c>>>0;s.putInt32(h);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};u(d,n,s);var m=r.util.createBuffer();return m.putInt32(d.h0),m.putInt32(d.h1),m.putInt32(d.h2),m.putInt32(d.h3),m.putInt32(d.h4),m},i};var o=null,s=!1;function a(){o=String.fromCharCode(128),o+=r.util.fillString(String.fromCharCode(0),64),s=!0}function u(e,t,n){for(var r,i,o,s,a,u,l,c,f=n.length();f>=64;){for(i=e.h0,o=e.h1,s=e.h2,a=e.h3,u=e.h4,c=0;c<16;++c)r=n.getInt32(),t[c]=r,l=a^o&(s^a),r=(i<<5|i>>>27)+l+u+1518500249+r,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<20;++c)r=t[c-3]^t[c-8]^t[c-14]^t[c-16],r=r<<1|r>>>31,t[c]=r,l=a^o&(s^a),r=(i<<5|i>>>27)+l+u+1518500249+r,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<32;++c)r=t[c-3]^t[c-8]^t[c-14]^t[c-16],r=r<<1|r>>>31,t[c]=r,l=o^s^a,r=(i<<5|i>>>27)+l+u+1859775393+r,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<40;++c)r=t[c-6]^t[c-16]^t[c-28]^t[c-32],r=r<<2|r>>>30,t[c]=r,l=o^s^a,r=(i<<5|i>>>27)+l+u+1859775393+r,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<60;++c)r=t[c-6]^t[c-16]^t[c-28]^t[c-32],r=r<<2|r>>>30,t[c]=r,l=o&s|a&(o^s),r=(i<<5|i>>>27)+l+u+2400959708+r,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<80;++c)r=t[c-6]^t[c-16]^t[c-28]^t[c-32],r=r<<2|r>>>30,t[c]=r,l=o^s^a,r=(i<<5|i>>>27)+l+u+3395469782+r,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+s|0,e.h3=e.h3+a|0,e.h4=e.h4+u|0,f-=64}}},function(e,t,n){var r=n(19);n(34),n(457),n(141),function(){if(r.prime)e.exports=r.prime;else{var t=e.exports=r.prime=r.prime||{},n=r.jsbn.BigInteger,i=[6,4,2,4,2,4,6,2],o=new n(null);o.fromInt(30);var s=function(e,t){return e|t};t.generateProbablePrime=function(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};var i=t.algorithm||"PRIMEINC";"string"==typeof i&&(i={name:i}),i.options=i.options||{};var o=t.prng||r.random,s={nextBytes:function(e){for(var t=o.getBytesSync(e.length),n=0;nt&&(e=f(t,n)),e.isProbablePrime(s))return u(null,e);e.dAddOffset(i[o++%8],0)}while(a<0||+new Date-ce&&(s=f(e,t));var d=s.toString(16);i.target.postMessage({hex:d,workLoad:l}),s.dAddOffset(c,0)}}}p()}function f(e,t){var r=new n(e,t),i=e-1;return r.testBit(i)||r.bitwiseTo(n.ONE.shiftLeft(i),s,r),r.dAddOffset(31-r.mod(o).byteValue(),0),r}function h(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}}()},function(e,t,n){var r=n(19);n(118),n(34);var i=e.exports=r.hmac=r.hmac||{};i.create=function(){var e=null,t=null,n=null,i=null,o={start:function(o,s){if(null!==o)if("string"==typeof o){if(o=o.toLowerCase(),!(o in r.md.algorithms))throw new Error('Unknown hash algorithm "'+o+'"');t=r.md.algorithms[o].create()}else t=o;if(null===s)s=e;else{if("string"==typeof s)s=r.util.createBuffer(s);else if(r.util.isArray(s)){var a=s;s=r.util.createBuffer();for(var u=0;ut.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),n=r.util.createBuffer(),i=r.util.createBuffer(),l=s.length();for(var u=0;u>16-t},a=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=r.rc2=r.rc2||{},r.rc2.expandKey=function(e,t){"string"==typeof e&&(e=r.util.createBuffer(e)),t=t||128;var n=e,o=e.length(),s=t,a=Math.ceil(s/8),u=255>>(7&s),l;for(l=o;l<128;l++)n.putByte(i[n.at(l-1)+n.at(l-o)&255]);for(n.setAt(128-a,i[n.at(128-a)&u]),l=127-a;l>=0;l--)n.setAt(l,i[n.at(l+1)^n.at(l+a)]);return n};var u=function(e,t,n){var i=!1,u=null,l=null,c=null,f,h,p,d,m=[];for(e=r.rc2.expandKey(e,t),p=0;p<64;p++)m.push(e.getInt16Le());n?(f=function(e){for(p=0;p<4;p++)e[p]+=m[d]+(e[(p+3)%4]&e[(p+2)%4])+(~e[(p+3)%4]&e[(p+1)%4]),e[p]=s(e[p],o[p]),d++},h=function(e){for(p=0;p<4;p++)e[p]+=m[63&e[(p+3)%4]]}):(f=function(e){for(p=3;p>=0;p--)e[p]=a(e[p],o[p]),e[p]-=m[d]+(e[(p+3)%4]&e[(p+2)%4])+(~e[(p+3)%4]&e[(p+1)%4]),d--},h=function(e){for(p=3;p>=0;p--)e[p]-=m[63&e[(p+3)%4]]});var g=function(e){var t=[];for(p=0;p<4;p++){var r=u.getInt16Le();null!==c&&(n?r^=c.getInt16Le():c.putInt16Le(r)),t.push(65535&r)}d=n?0:63;for(var i=0;i=8;)g([[5,f],[1,h],[6,f],[1,h],[5,f]])},finish:function(e){var t=!0;if(n)if(e)t=e(8,u,!n);else{var r=8===u.length()?8:8-u.length();u.fillWithByte(r,r)}if(t&&(i=!0,y.update()),!n&&(t=0===u.length(),t))if(e)t=e(8,l,!n);else{var o=l.length(),s=l.at(o-1);s>o?t=!1:l.truncate(s)}return t}},y};r.rc2.startEncrypting=function(e,t,n){var i=r.rc2.createEncryptionCipher(e,128);return i.start(t,n),i},r.rc2.createEncryptionCipher=function(e,t){return u(e,t,!0)},r.rc2.startDecrypting=function(e,t,n){var i=r.rc2.createDecryptionCipher(e,128);return i.start(t,n),i},r.rc2.createDecryptionCipher=function(e,t){return u(e,t,!1)}},function(e,t,n){"use strict";const r=n(58),i=n(71),o=n(76),s=n(91),a=n(900),u=i(n(308));n(912),n(310);const l=n(19);class c{constructor(e){this._key=e}verify(e,t,n){g(n),a.hashAndVerify(this._key,t,e,n)}marshal(){return a.utils.jwkToPkix(this._key)}get bytes(){return u.PublicKey.encode({Type:u.KeyType.RSA,Data:this.marshal()})}encrypt(e){return this._key.encrypt(e,"RSAES-PKCS1-V1_5")}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),r(this.bytes,"sha2-256",e)}}class f{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return a.getRandomValues(16)}sign(e,t){g(t),a.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new c(this._publicKey)}decrypt(e,t){a.decrypt(this._key,e,t)}marshal(){return a.utils.jwkToPkcs1(this._key)}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),r(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,n)=>{if(t)return e(t);e(null,o.encode(n))})}export(e,t,n){"function"==typeof t&&(n=t,t=e,e="pkcs-8"),g(n),s(()=>{let r=null,i=null;try{const n=new l.util.ByteBuffer(this.marshal()),o=l.asn1.fromDer(n),s=l.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=l.pki.encryptRsaPrivateKey(s,t,e)}else r=new Error(`Unknown export format '${e}'`)}catch(e){r=e}n(r,i)})}}function h(e,t){const n=a.utils.pkcs1ToJwk(e);a.unmarshalPrivateKey(n,(e,n)=>{if(e)return t(e);t(null,new f(n.privateKey,n.publicKey))})}function p(e){const t=a.utils.pkixToJwk(e);return new c(t)}function d(e,t){a.unmarshalPrivateKey(e,(e,n)=>{if(e)return t(e);t(null,new f(n.privateKey,n.publicKey))})}function m(e,t){a.generateKey(e,(e,n)=>{if(e)return t(e);t(null,new f(n.privateKey,n.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:c,RsaPrivateKey:f,unmarshalRsaPublicKey:p,unmarshalRsaPrivateKey:h,generateKeyPair:m,fromJwk:d}},function(e,t,n){"use strict";(function(e){const r=n(313),i=n(314),o=n(315);function s(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function a(e){return i.subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}t.utils=n(902),t.generateKey=function(e,t){r(i.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(s).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.unmarshalPrivateKey=function(e,t){const n=i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]);r(Promise.all([n,a(e)]).then(e=>s({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=o,t.hashAndSign=function(t,n,o){r(i.subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]).then(e=>i.subtle.sign({name:"RSASSA-PKCS1-v1_5"},e,Uint8Array.from(n))).then(t=>e.from(t)),o)},t.hashAndVerify=function(e,t,n,o){r(i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]).then(e=>i.subtle.verify({name:"RSASSA-PKCS1-v1_5"},e,t,n)),o)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t,n){const r=t.crypto||t.msCrypto,i=65536;function o(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}function s(e){const t=new Uint8Array(e);let o=0;if(e>0)if(e>i)for(;ot?r.getRandomValues(t.subarray(o,t-o)):(r.getRandomValues(t.subarray(o,o+i)),o+=i);else r.getRandomValues(t);return n.from(t)}r&&r.getRandomValues?e.exports=s:e.exports=o}).call(this,n(8),n(0).Buffer)},function(e,t,n){"use strict";const r=n(142),i=n(466),o=i.toBase64,s=i.toBn,a=r.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}),u=r.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid({"1.2.840.113549.1.1.1":"rsa"}),this.key("none").optional().null_(),this.key("curve").optional().objid(),this.key("params").optional().seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()))}),l=r.define("RSAPublicKey",function(){this.seq().obj(this.key("algorithm").use(u),this.key("subjectPublicKey").bitstr())}),c=r.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.pkcs1ToJwk=function(e){const t=a.decode(e,"der");return{kty:"RSA",n:o(t.modulus),e:o(t.publicExponent),d:o(t.privateExponent),p:o(t.prime1),q:o(t.prime2),dp:o(t.exponent1),dq:o(t.exponent2),qi:o(t.coefficient),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){return a.encode({version:0,modulus:s(e.n),publicExponent:s(e.e),privateExponent:s(e.d),prime1:s(e.p),prime2:s(e.q),exponent1:s(e.dp),exponent2:s(e.dq),coefficient:s(e.qi)},"der")},t.pkixToJwk=function(e){const t=l.decode(e,"der"),n=c.decode(t.subjectPublicKey.data,"der");return{kty:"RSA",n:o(n.modulus),e:o(n.publicExponent),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){return l.encode({algorithm:{algorithm:"rsa",none:null},subjectPublicKey:{data:c.encode({modulus:s(e.n),publicExponent:s(e.e)},"der")}},"der")}},function(e,t){},function(e,t,n){"use strict";const r=n(142),i=n(1),o=t;function s(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}o.define=function e(t,n){return new s(t,n)},s.prototype._createNamed=function e(t){const n=this.name;function r(e){this._initNamed(e,n)}return i(r,t),r.prototype._initNamed=function e(n,r){t.call(this,n,r)},new r(this)},s.prototype._getDecoder=function e(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(r.decoders[t])),this.decoders[t]},s.prototype.decode=function e(t,n,r){return this._getDecoder(n).decode(t,r)},s.prototype._getEncoder=function e(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(r.encoders[t])),this.encoders[t]},s.prototype.encode=function e(t,n,r){return this._getEncoder(n).encode(t,r)}},function(e,t,n){"use strict";const r=n(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 n=this._reporterState;n.obj=t.obj,n.path=n.path.slice(0,t.pathLen)},i.prototype.enterKey=function e(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function e(t){const n=this._reporterState;n.path=n.path.slice(0,t-1)},i.prototype.leaveKey=function e(t,n,r){const i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[n]=r)},i.prototype.path=function e(){return this._reporterState.path.join("/")},i.prototype.enterObject=function e(){const t=this._reporterState,n=t.obj;return t.obj={},n},i.prototype.leaveObject=function e(t){const n=this._reporterState,r=n.obj;return n.obj=t,r},i.prototype.error=function e(t){let n;const r=this._reporterState,i=t instanceof o;if(n=i?t:new o(r.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),t.message||t,t.stack),!r.options.partial)throw n;return i||r.errors.push(n),n},i.prototype.wrapResult=function e(t){const n=this._reporterState;return n.options.partial?{result:this.isError(t)?null:t,errors:n.errors}:t},r(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,n){"use strict";const r=n(180).Reporter,i=n(180).EncoderBuffer,o=n(180).DecoderBuffer,s=n(107),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),l=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function c(e,t,n){const r={};this._baseState=r,r.name=n,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=c;const f=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];c.prototype.clone=function e(){const t=this._baseState,n={};f.forEach(function(e){n[e]=t[e]});const r=new this.constructor(n.parent);return r._baseState=n,r},c.prototype._wrap=function e(){const t=this._baseState;u.forEach(function(e){this[e]=function n(){const r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}},this)},c.prototype._init=function e(t){const n=this._baseState;s(null===n.parent),t.call(this),n.children=n.children.filter(function(e){return e._baseState.parent===this},this),s.equal(n.children.length,1,"Root node can have only one child")},c.prototype._useArgs=function e(t){const n=this._baseState,r=t.filter(function(e){return e instanceof this.constructor},this);t=t.filter(function(e){return!(e instanceof this.constructor)},this),0!==r.length&&(s(null===n.children),n.children=r,r.forEach(function(e){e._baseState.parent=this},this)),0!==t.length&&(s(null===n.args),n.args=t,n.reverseArgs=t.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach(function(n){n==(0|n)&&(n|=0);const r=e[n];t[r]=n}),t}))},l.forEach(function(e){c.prototype[e]=function t(){const n=this._baseState;throw new Error(e+" not implemented for encoding: "+n.enc)}}),a.forEach(function(e){c.prototype[e]=function t(){const n=this._baseState,r=Array.prototype.slice.call(arguments);return s(null===n.tag),n.tag=e,this._useArgs(r),this}}),c.prototype.use=function e(t){s(t);const n=this._baseState;return s(null===n.use),n.use=t,this},c.prototype.optional=function e(){const t=this._baseState;return t.optional=!0,this},c.prototype.def=function e(t){const n=this._baseState;return s(null===n.default),n.default=t,n.optional=!0,this},c.prototype.explicit=function e(t){const n=this._baseState;return s(null===n.explicit&&null===n.implicit),n.explicit=t,this},c.prototype.implicit=function e(t){const n=this._baseState;return s(null===n.explicit&&null===n.implicit),n.implicit=t,this},c.prototype.obj=function e(){const t=this._baseState,n=Array.prototype.slice.call(arguments);return t.obj=!0,0!==n.length&&this._useArgs(n),this},c.prototype.key=function e(t){const n=this._baseState;return s(null===n.key),n.key=t,this},c.prototype.any=function e(){const t=this._baseState;return t.any=!0,this},c.prototype.choice=function e(t){const n=this._baseState;return s(null===n.choice),n.choice=t,this._useArgs(Object.keys(t).map(function(e){return t[e]})),this},c.prototype.contains=function e(t){const n=this._baseState;return s(null===n.use),n.contains=t,this},c.prototype._decode=function e(t,n){const r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,n));let i=r.default,s=!0,a=null,u;if(null!==r.key&&(a=t.enterKey(r.key)),r.optional){let e=null;if(null!==r.explicit?e=r.explicit:null!==r.implicit?e=r.implicit:null!==r.tag&&(e=r.tag),null!==e||r.any){if(s=this._peekTag(t,e,r.any),t.isError(s))return s}else{const e=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,n):this._decodeChoice(t,n),s=!0}catch(e){s=!1}t.restore(e)}}if(r.obj&&s&&(u=t.enterObject()),s){if(null!==r.explicit){const e=this._decodeTag(t,r.explicit);if(t.isError(e))return e;t=e}const e=t.offset;if(null===r.use&&null===r.choice){let e;r.any&&(e=t.save());const n=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(n))return n;r.any?i=t.raw(e):t=n}if(n&&n.track&&null!==r.tag&&n.track(t.path(),e,t.length,"tagged"),n&&n.track&&null!==r.tag&&n.track(t.path(),t.offset,t.length,"content"),r.any||(i=null===r.choice?this._decodeGeneric(r.tag,t,n):this._decodeChoice(t,n)),t.isError(i))return i;if(r.any||null!==r.choice||null===r.children||r.children.forEach(function e(r){r._decode(t,n)}),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const e=new o(i);i=this._getUse(r.contains,t._reporterState.obj)._decode(e,n)}}return r.obj&&s&&(i=t.leaveObject(u)),null===r.key||null===i&&!0!==s?null!==a&&t.exitKey(a):t.leaveKey(a,r.key,i),i},c.prototype._decodeGeneric=function e(t,n,r){const i=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(n,t,i.args[0],r):/str$/.test(t)?this._decodeStr(n,t,r):"objid"===t&&i.args?this._decodeObjid(n,i.args[0],i.args[1],r):"objid"===t?this._decodeObjid(n,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(n,t,r):"null_"===t?this._decodeNull(n,r):"bool"===t?this._decodeBool(n,r):"objDesc"===t?this._decodeStr(n,t,r):"int"===t||"enum"===t?this._decodeInt(n,i.args&&i.args[0],r):null!==i.use?this._getUse(i.use,n._reporterState.obj)._decode(n,r):n.error("unknown tag: "+t)},c.prototype._getUse=function e(t,n){const r=this._baseState;return r.useDecoder=this._use(t,n),s(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},c.prototype._decodeChoice=function e(t,n){const r=this._baseState;let i=null,o=!1;return Object.keys(r.choice).some(function(e){const s=t.save(),a=r.choice[e];try{const r=a._decode(t,n);if(t.isError(r))return!1;i={type:e,value:r},o=!0}catch(e){return t.restore(s),!1}return!0},this),o?i:t.error("Choice not matched")},c.prototype._createEncoderBuffer=function e(t){return new i(t,this.reporter)},c.prototype._encode=function e(t,n,r){const i=this._baseState;if(null!==i.default&&i.default===t)return;const o=this._encodeValue(t,n,r);return void 0===o||this._skipDefault(o,n,r)?void 0:o},c.prototype._encodeValue=function e(t,n,i){const o=this._baseState;if(null===o.parent)return o.children[0]._encode(t,n||new r);let s=null;if(this.reporter=n,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,n);else if(o.contains)a=this._getUse(o.contains,i)._encode(t,n),u=!0;else if(o.children)a=o.children.map(function(e){if("null_"===e._baseState.tag)return e._encode(null,n,t);if(null===e._baseState.key)return n.error("Child should have a key");const r=n.enterKey(e._baseState.key);if("object"!=typeof t)return n.error("Child expected, but input is not object");const i=e._encode(t[e._baseState.key],n,t);return n.leaveKey(r),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 n.error("Too many args for : "+o.tag);if(!Array.isArray(t))return n.error("seqof/setof, but data is not Array");const e=this.clone();e._baseState.implicit=null,a=this._createEncoderBuffer(t.map(function(e){const r=this._baseState;return this._getUse(r.args[0],t)._encode(e,n)},e))}else null!==o.use?s=this._getUse(o.use,i)._encode(t,n):(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&&n.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},c.prototype._encodeChoice=function e(t,n){const r=this._baseState,i=r.choice[t.type];return i||s(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(t.value,n)},c.prototype._encodePrimitive=function e(t,n){const r=this._baseState;if(/str$/.test(t))return this._encodeStr(n,t);if("objid"===t&&r.args)return this._encodeObjid(n,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(n,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(n,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(n,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(n);if("objDesc"===t)return this._encodeStr(n,t);throw new Error("Unsupported tag: "+t)},c.prototype._isNumstr=function e(t){return/^[0-9 ]*$/.test(t)},c.prototype._isPrintstr=function e(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},function(e,t,n){"use strict";const r=n(463);t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=r._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=r._reverse(t.tag)},function(e,t,n){"use strict";const r=t;r.der=n(464),r.pem=n(909)},function(e,t,n){"use strict";const r=n(1),i=n(0).Buffer,o=n(464);function s(e){o.call(this,e),this.enc="pem"}r(s,o),e.exports=s,s.prototype.decode=function e(t,n){const r=t.toString().split(/[\r\n]+/g),s=n.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/;let u=-1,l=-1;for(let e=0;e>>0,s>>>0];for(var a=p.fullMessageLength.length-1;a>=0;--a)p.fullMessageLength[a]+=s[1],s[1]=s[0]+(p.fullMessageLength[a]/4294967296>>>0),p.fullMessageLength[a]=p.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return i.putBytes(e),f(n,o,i),(i.read>2048||0===i.length())&&i.compact(),p},p.digest=function(){var t=r.util.createBuffer();t.putBytes(i.bytes());var a=p.fullMessageLength[p.fullMessageLength.length-1]+p.messageLengthSize,u=a&p.blockLength-1,l,c;t.putBytes(s.substr(0,p.blockLength-u));for(var h=8*p.fullMessageLength[0],d=0;d>>0,h+=c,t.putInt32(h>>>0),h=l>>>0;t.putInt32(h);for(var m=new Array(n.length),d=0;d=128;){for(P=0;P<16;++P)t[P][0]=n.getInt32()>>>0,t[P][1]=n.getInt32()>>>0;for(;P<80;++P)N=t[P-2],B=N[0],R=N[1],r=((B>>>19|R<<13)^(R>>>29|B<<3)^B>>>6)>>>0,i=((B<<13|R>>>19)^(R<<3|B>>>29)^(B<<26|R>>>6))>>>0,L=t[P-15],B=L[0],R=L[1],o=((B>>>1|R<<31)^(B>>>8|R<<24)^B>>>7)>>>0,s=((B<<31|R>>>1)^(B<<24|R>>>8)^(B<<25|R>>>7))>>>0,M=t[P-7],F=t[P-16],R=i+M[1]+s+F[1],t[P][0]=r+M[0]+o+F[0]+(R/4294967296>>>0)>>>0,t[P][1]=R>>>0;for(g=e[0][0],y=e[0][1],b=e[1][0],v=e[1][1],w=e[2][0],_=e[2][1],k=e[3][0],S=e[3][1],E=e[4][0],x=e[4][1],C=e[5][0],A=e[5][1],I=e[6][0],T=e[6][1],j=e[7][0],O=e[7][1],P=0;P<80;++P)c=((E>>>14|x<<18)^(E>>>18|x<<14)^(x>>>9|E<<23))>>>0,f=((E<<18|x>>>14)^(E<<14|x>>>18)^(x<<23|E>>>9))>>>0,h=(I^E&(C^I))>>>0,p=(T^x&(A^T))>>>0,a=((g>>>28|y<<4)^(y>>>2|g<<30)^(y>>>7|g<<25))>>>0,l=((g<<4|y>>>28)^(y<<30|g>>>2)^(y<<25|g>>>7))>>>0,d=(g&b|w&(g^b))>>>0,m=(y&v|_&(y^v))>>>0,R=O+f+p+u[P][1]+t[P][1],r=j+c+h+u[P][0]+t[P][0]+(R/4294967296>>>0)>>>0,i=R>>>0,R=l+m,o=a+d+(R/4294967296>>>0)>>>0,s=R>>>0,j=I,O=T,I=C,T=A,C=E,A=x,R=S+i,E=k+r+(R/4294967296>>>0)>>>0,x=R>>>0,k=w,S=_,w=b,_=v,b=g,v=y,R=i+s,g=r+o+(R/4294967296>>>0)>>>0,y=R>>>0;R=e[0][1]+y,e[0][0]=e[0][0]+g+(R/4294967296>>>0)>>>0,e[0][1]=R>>>0,R=e[1][1]+v,e[1][0]=e[1][0]+b+(R/4294967296>>>0)>>>0,e[1][1]=R>>>0,R=e[2][1]+_,e[2][0]=e[2][0]+w+(R/4294967296>>>0)>>>0,e[2][1]=R>>>0,R=e[3][1]+S,e[3][0]=e[3][0]+k+(R/4294967296>>>0)>>>0,e[3][1]=R>>>0,R=e[4][1]+x,e[4][0]=e[4][0]+E+(R/4294967296>>>0)>>>0,e[4][1]=R>>>0,R=e[5][1]+A,e[5][0]=e[5][0]+C+(R/4294967296>>>0)>>>0,e[5][1]=R>>>0,R=e[6][1]+T,e[6][0]=e[6][0]+I+(R/4294967296>>>0)>>>0,e[6][1]=R>>>0,R=e[7][1]+O,e[7][0]=e[7][0]+j+(R/4294967296>>>0)>>>0,e[7][1]=R>>>0,D-=128}}},function(e,t,n){"use strict";(function(t){const r=n(58),i=n(71),o=n(76),s=n(914),a=i(n(308));class u{constructor(e){this._key=m(e,s.publicKeyLength)}verify(e,t,n){d(n),s.hashAndVerify(this._key,t,e,n)}marshal(){return t.from(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),r(this.bytes,"sha2-256",e)}}class l{constructor(e,t){this._key=m(e,s.privateKeyLength),this._publicKey=m(t,s.publicKeyLength)}sign(e,t){d(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new u(this._publicKey)}marshal(){return t.concat([t.from(this._key),t.from(this._publicKey)])}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),r(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,n)=>{if(t)return e(t);e(null,o.encode(n))})}}function c(e,t){try{e=m(e,s.privateKeyLength+s.publicKeyLength)}catch(e){return t(e)}const n=e.slice(0,s.privateKeyLength),r=e.slice(s.privateKeyLength,e.length);t(null,new l(n,r))}function f(e){return e=m(e,s.publicKeyLength),new u(e)}function h(e,t){void 0===t&&"function"==typeof e&&(t=e),s.generateKey((e,n)=>{if(e)return t(e);let r;try{r=new l(n.secretKey,n.publicKey)}catch(e){return void t(e)}t(null,r)})}function p(e,t,n){void 0===n&&"function"==typeof t&&(n=t),s.generateKeyFromSeed(e,(e,t)=>{if(e)return n(e);let r;try{r=new l(t.secretKey,t.publicKey)}catch(e){return void n(e)}n(null,r)})}function d(e){if("function"!=typeof e)throw new Error("callback is required")}function m(e,n){if(t.isBuffer(e)&&(e=new Uint8Array(e)),!(e instanceof Uint8Array)||e.length!==n)throw new Error("Key must be a Uint8Array or Buffer of length "+n);return e}e.exports={Ed25519PublicKey:u,Ed25519PrivateKey:l,unmarshalEd25519PrivateKey:c,unmarshalEd25519PublicKey:f,generateKeyPair:h,generateKeyPairFromSeed:p}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(e){const r=n(915),i=n(91);t.publicKeyLength=r.sign.publicKeyLength,t.privateKeyLength=r.sign.secretKeyLength,t.generateKey=function(e){i(()=>{let t;try{t=r.sign.keyPair()}catch(t){return e(t)}e(null,t)})},t.generateKeyFromSeed=function(e,t){i(()=>{let n;try{n=r.sign.keyPair.fromSeed(e)}catch(e){return t(e)}t(null,n)})},t.hashAndSign=function(t,n,o){i(()=>{o(null,e.from(r.sign.detached(n,t)))})},t.hashAndVerify=function(e,t,n,o){i(()=>{let i;try{i=r.sign.detached.verify(n,t,e)}catch(e){return o(e)}o(null,i)})}}).call(this,n(0).Buffer)},function(e,t,n){!function(e){"use strict";var t=function(e){var t,n=new Float64Array(16);if(e)for(t=0;t>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=255&r}function m(e,t,n,r,i){var o,s=0;for(o=0;o>>8)-1}function g(e,t,n,r){return m(e,t,n,r,16)}function y(e,t,n,r){return m(e,t,n,r,32)}function b(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,l=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,b=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,v=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,w=i,_=o,k=s,S=a,E=u,x=l,C=c,A=f,I=h,T=p,j=d,O=m,P=g,B=y,R=b,N=v,M,L=0;L<20;L+=2)M=w+P|0,E^=M<<7|M>>>25,M=E+w|0,I^=M<<9|M>>>23,M=I+E|0,P^=M<<13|M>>>19,M=P+I|0,w^=M<<18|M>>>14,M=x+_|0,T^=M<<7|M>>>25,M=T+x|0,B^=M<<9|M>>>23,M=B+T|0,_^=M<<13|M>>>19,M=_+B|0,x^=M<<18|M>>>14,M=j+C|0,R^=M<<7|M>>>25,M=R+j|0,k^=M<<9|M>>>23,M=k+R|0,C^=M<<13|M>>>19,M=C+k|0,j^=M<<18|M>>>14,M=N+O|0,S^=M<<7|M>>>25,M=S+N|0,A^=M<<9|M>>>23,M=A+S|0,O^=M<<13|M>>>19,M=O+A|0,N^=M<<18|M>>>14,M=w+S|0,_^=M<<7|M>>>25,M=_+w|0,k^=M<<9|M>>>23,M=k+_|0,S^=M<<13|M>>>19,M=S+k|0,w^=M<<18|M>>>14,M=x+E|0,C^=M<<7|M>>>25,M=C+x|0,A^=M<<9|M>>>23,M=A+C|0,E^=M<<13|M>>>19,M=E+A|0,x^=M<<18|M>>>14,M=j+T|0,O^=M<<7|M>>>25,M=O+j|0,I^=M<<9|M>>>23,M=I+O|0,T^=M<<13|M>>>19,M=T+I|0,j^=M<<18|M>>>14,M=N+R|0,P^=M<<7|M>>>25,M=P+N|0,B^=M<<9|M>>>23,M=B+P|0,R^=M<<13|M>>>19,M=R+B|0,N^=M<<18|M>>>14;w=w+i|0,_=_+o|0,k=k+s|0,S=S+a|0,E=E+u|0,x=x+l|0,C=C+c|0,A=A+f|0,I=I+h|0,T=T+p|0,j=j+d|0,O=O+m|0,P=P+g|0,B=B+y|0,R=R+b|0,N=N+v|0,e[0]=w>>>0&255,e[1]=w>>>8&255,e[2]=w>>>16&255,e[3]=w>>>24&255,e[4]=_>>>0&255,e[5]=_>>>8&255,e[6]=_>>>16&255,e[7]=_>>>24&255,e[8]=k>>>0&255,e[9]=k>>>8&255,e[10]=k>>>16&255,e[11]=k>>>24&255,e[12]=S>>>0&255,e[13]=S>>>8&255,e[14]=S>>>16&255,e[15]=S>>>24&255,e[16]=E>>>0&255,e[17]=E>>>8&255,e[18]=E>>>16&255,e[19]=E>>>24&255,e[20]=x>>>0&255,e[21]=x>>>8&255,e[22]=x>>>16&255,e[23]=x>>>24&255,e[24]=C>>>0&255,e[25]=C>>>8&255,e[26]=C>>>16&255,e[27]=C>>>24&255,e[28]=A>>>0&255,e[29]=A>>>8&255,e[30]=A>>>16&255,e[31]=A>>>24&255,e[32]=I>>>0&255,e[33]=I>>>8&255,e[34]=I>>>16&255,e[35]=I>>>24&255,e[36]=T>>>0&255,e[37]=T>>>8&255,e[38]=T>>>16&255,e[39]=T>>>24&255,e[40]=j>>>0&255,e[41]=j>>>8&255,e[42]=j>>>16&255,e[43]=j>>>24&255,e[44]=O>>>0&255,e[45]=O>>>8&255,e[46]=O>>>16&255,e[47]=O>>>24&255,e[48]=P>>>0&255,e[49]=P>>>8&255,e[50]=P>>>16&255,e[51]=P>>>24&255,e[52]=B>>>0&255,e[53]=B>>>8&255,e[54]=B>>>16&255,e[55]=B>>>24&255,e[56]=R>>>0&255,e[57]=R>>>8&255,e[58]=R>>>16&255,e[59]=R>>>24&255,e[60]=N>>>0&255,e[61]=N>>>8&255,e[62]=N>>>16&255,e[63]=N>>>24&255}function v(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,l=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,b=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,v=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,w=i,_=o,k=s,S=a,E=u,x=l,C=c,A=f,I=h,T=p,j=d,O=m,P=g,B=y,R=b,N=v,M,L=0;L<20;L+=2)M=w+P|0,E^=M<<7|M>>>25,M=E+w|0,I^=M<<9|M>>>23,M=I+E|0,P^=M<<13|M>>>19,M=P+I|0,w^=M<<18|M>>>14,M=x+_|0,T^=M<<7|M>>>25,M=T+x|0,B^=M<<9|M>>>23,M=B+T|0,_^=M<<13|M>>>19,M=_+B|0,x^=M<<18|M>>>14,M=j+C|0,R^=M<<7|M>>>25,M=R+j|0,k^=M<<9|M>>>23,M=k+R|0,C^=M<<13|M>>>19,M=C+k|0,j^=M<<18|M>>>14,M=N+O|0,S^=M<<7|M>>>25,M=S+N|0,A^=M<<9|M>>>23,M=A+S|0,O^=M<<13|M>>>19,M=O+A|0,N^=M<<18|M>>>14,M=w+S|0,_^=M<<7|M>>>25,M=_+w|0,k^=M<<9|M>>>23,M=k+_|0,S^=M<<13|M>>>19,M=S+k|0,w^=M<<18|M>>>14,M=x+E|0,C^=M<<7|M>>>25,M=C+x|0,A^=M<<9|M>>>23,M=A+C|0,E^=M<<13|M>>>19,M=E+A|0,x^=M<<18|M>>>14,M=j+T|0,O^=M<<7|M>>>25,M=O+j|0,I^=M<<9|M>>>23,M=I+O|0,T^=M<<13|M>>>19,M=T+I|0,j^=M<<18|M>>>14,M=N+R|0,P^=M<<7|M>>>25,M=P+N|0,B^=M<<9|M>>>23,M=B+P|0,R^=M<<13|M>>>19,M=R+B|0,N^=M<<18|M>>>14;e[0]=w>>>0&255,e[1]=w>>>8&255,e[2]=w>>>16&255,e[3]=w>>>24&255,e[4]=x>>>0&255,e[5]=x>>>8&255,e[6]=x>>>16&255,e[7]=x>>>24&255,e[8]=j>>>0&255,e[9]=j>>>8&255,e[10]=j>>>16&255,e[11]=j>>>24&255,e[12]=N>>>0&255,e[13]=N>>>8&255,e[14]=N>>>16&255,e[15]=N>>>24&255,e[16]=C>>>0&255,e[17]=C>>>8&255,e[18]=C>>>16&255,e[19]=C>>>24&255,e[20]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=I>>>0&255,e[25]=I>>>8&255,e[26]=I>>>16&255,e[27]=I>>>24&255,e[28]=T>>>0&255,e[29]=T>>>8&255,e[30]=T>>>16&255,e[31]=T>>>24&255}function w(e,t,n,r){b(e,t,n,r)}function _(e,t,n,r){v(e,t,n,r)}var k=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function S(e,t,n,r,i,o,s){var a=new Uint8Array(16),u=new Uint8Array(64),l,c;for(c=0;c<16;c++)a[c]=0;for(c=0;c<8;c++)a[c]=o[c];for(;i>=64;){for(w(u,a,s,k),c=0;c<64;c++)e[t+c]=n[r+c]^u[c];for(l=1,c=8;c<16;c++)l=l+(255&a[c])|0,a[c]=255&l,l>>>=8;i-=64,t+=64,r+=64}if(i>0)for(w(u,a,s,k),c=0;c=64;){for(w(s,o,i,k),u=0;u<64;u++)e[t+u]=s[u];for(a=1,u=8;u<16;u++)a=a+(255&o[u])|0,o[u]=255&a,a>>>=8;n-=64,t+=64}if(n>0)for(w(s,o,i,k),u=0;u>>13|n<<3),r=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(n>>>10|r<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(r>>>7|i<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|s<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(s>>>11|a<<5),u=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|u<<8),this.r[9]=u>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function I(e,t,n,r,i,o){var s=new A(o);return s.update(n,r,i),s.finish(e,t),0}function T(e,t,n,r,i,o){var s=new Uint8Array(16);return I(s,0,n,r,i,o),g(e,t,s,0)}function j(e,t,n,r,i){var o;if(n<32)return-1;for(C(e,0,t,0,n,r,i),I(e,16,e,32,n-32,e),o=0;o<16;o++)e[o]=0;return 0}function O(e,t,n,r,i){var o,s=new Uint8Array(32);if(n<32)return-1;if(x(s,0,32,r,i),0!==T(t,16,t,32,n-32,s))return-1;for(C(e,0,t,0,n,r,i),o=0;o<32;o++)e[o]=0;return 0}function P(e,t){var n;for(n=0;n<16;n++)e[n]=0|t[n]}function B(e){var t,n,r=1;for(t=0;t<16;t++)n=e[t]+r+65535,r=Math.floor(n/65536),e[t]=n-65536*r;e[0]+=r-1+37*(r-1)}function R(e,t,n){for(var r,i=~(n-1),o=0;o<16;o++)r=i&(e[o]^t[o]),e[o]^=r,t[o]^=r}function N(e,n){var r,i,o,s=t(),a=t();for(r=0;r<16;r++)a[r]=n[r];for(B(a),B(a),B(a),i=0;i<2;i++){for(s[0]=a[0]-65517,r=1;r<15;r++)s[r]=a[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),o=s[15]>>16&1,s[14]&=65535,R(a,s,1-o)}for(r=0;r<16;r++)e[2*r]=255&a[r],e[2*r+1]=a[r]>>8}function M(e,t){var n=new Uint8Array(32),r=new Uint8Array(32);return N(n,e),N(r,t),y(n,0,r,0)}function L(e){var t=new Uint8Array(32);return N(t,e),1&t[0]}function F(e,t){var n;for(n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function D(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]+n[r]}function U(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]-n[r]}function z(e,t,n){var r,i,o=0,s=0,a=0,u=0,l=0,c=0,f=0,h=0,p=0,d=0,m=0,g=0,y=0,b=0,v=0,w=0,_=0,k=0,S=0,E=0,x=0,C=0,A=0,I=0,T=0,j=0,O=0,P=0,B=0,R=0,N=0,M=n[0],L=n[1],F=n[2],D=n[3],U=n[4],z=n[5],q=n[6],K=n[7],H=n[8],V=n[9],W=n[10],$=n[11],G=n[12],Y=n[13],J=n[14],Z=n[15];r=t[0],o+=r*M,s+=r*L,a+=r*F,u+=r*D,l+=r*U,c+=r*z,f+=r*q,h+=r*K,p+=r*H,d+=r*V,m+=r*W,g+=r*$,y+=r*G,b+=r*Y,v+=r*J,w+=r*Z,r=t[1],s+=r*M,a+=r*L,u+=r*F,l+=r*D,c+=r*U,f+=r*z,h+=r*q,p+=r*K,d+=r*H,m+=r*V,g+=r*W,y+=r*$,b+=r*G,v+=r*Y,w+=r*J,_+=r*Z,r=t[2],a+=r*M,u+=r*L,l+=r*F,c+=r*D,f+=r*U,h+=r*z,p+=r*q,d+=r*K,m+=r*H,g+=r*V,y+=r*W,b+=r*$,v+=r*G,w+=r*Y,_+=r*J,k+=r*Z,r=t[3],u+=r*M,l+=r*L,c+=r*F,f+=r*D,h+=r*U,p+=r*z,d+=r*q,m+=r*K,g+=r*H,y+=r*V,b+=r*W,v+=r*$,w+=r*G,_+=r*Y,k+=r*J,S+=r*Z,r=t[4],l+=r*M,c+=r*L,f+=r*F,h+=r*D,p+=r*U,d+=r*z,m+=r*q,g+=r*K,y+=r*H,b+=r*V,v+=r*W,w+=r*$,_+=r*G,k+=r*Y,S+=r*J,E+=r*Z,r=t[5],c+=r*M,f+=r*L,h+=r*F,p+=r*D,d+=r*U,m+=r*z,g+=r*q,y+=r*K,b+=r*H,v+=r*V,w+=r*W,_+=r*$,k+=r*G,S+=r*Y,E+=r*J,x+=r*Z,r=t[6],f+=r*M,h+=r*L,p+=r*F,d+=r*D,m+=r*U,g+=r*z,y+=r*q,b+=r*K,v+=r*H,w+=r*V,_+=r*W,k+=r*$,S+=r*G,E+=r*Y,x+=r*J,C+=r*Z,r=t[7],h+=r*M,p+=r*L,d+=r*F,m+=r*D,g+=r*U,y+=r*z,b+=r*q,v+=r*K,w+=r*H,_+=r*V,k+=r*W,S+=r*$,E+=r*G,x+=r*Y,C+=r*J,A+=r*Z,r=t[8],p+=r*M,d+=r*L,m+=r*F,g+=r*D,y+=r*U,b+=r*z,v+=r*q,w+=r*K,_+=r*H,k+=r*V,S+=r*W,E+=r*$,x+=r*G,C+=r*Y,A+=r*J,I+=r*Z,r=t[9],d+=r*M,m+=r*L,g+=r*F,y+=r*D,b+=r*U,v+=r*z,w+=r*q,_+=r*K,k+=r*H,S+=r*V,E+=r*W,x+=r*$,C+=r*G,A+=r*Y,I+=r*J,T+=r*Z,r=t[10],m+=r*M,g+=r*L,y+=r*F,b+=r*D,v+=r*U,w+=r*z,_+=r*q,k+=r*K,S+=r*H,E+=r*V,x+=r*W,C+=r*$,A+=r*G,I+=r*Y,T+=r*J,j+=r*Z,r=t[11],g+=r*M,y+=r*L,b+=r*F,v+=r*D,w+=r*U,_+=r*z,k+=r*q,S+=r*K,E+=r*H,x+=r*V,C+=r*W,A+=r*$,I+=r*G,T+=r*Y,j+=r*J,O+=r*Z,r=t[12],y+=r*M,b+=r*L,v+=r*F,w+=r*D,_+=r*U,k+=r*z,S+=r*q,E+=r*K,x+=r*H,C+=r*V,A+=r*W,I+=r*$,T+=r*G,j+=r*Y,O+=r*J,P+=r*Z,r=t[13],b+=r*M,v+=r*L,w+=r*F,_+=r*D,k+=r*U,S+=r*z,E+=r*q,x+=r*K,C+=r*H,A+=r*V,I+=r*W,T+=r*$,j+=r*G,O+=r*Y,P+=r*J,B+=r*Z,r=t[14],v+=r*M,w+=r*L,_+=r*F,k+=r*D,S+=r*U,E+=r*z,x+=r*q,C+=r*K,A+=r*H,I+=r*V,T+=r*W,j+=r*$,O+=r*G,P+=r*Y,B+=r*J,R+=r*Z,r=t[15],w+=r*M,_+=r*L,k+=r*F,S+=r*D,E+=r*U,x+=r*z,C+=r*q,A+=r*K,I+=r*H,T+=r*V,j+=r*W,O+=r*$,P+=r*G,B+=r*Y,R+=r*J,N+=r*Z,o+=38*_,s+=38*k,a+=38*S,u+=38*E,l+=38*x,c+=38*C,f+=38*A,h+=38*I,p+=38*T,d+=38*j,m+=38*O,g+=38*P,y+=38*B,b+=38*R,v+=38*N,i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=w+i+65535,i=Math.floor(r/65536),w=r-65536*i,o+=i-1+37*(i-1),i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=w+i+65535,i=Math.floor(r/65536),w=r-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=u,e[4]=l,e[5]=c,e[6]=f,e[7]=h,e[8]=p,e[9]=d,e[10]=m,e[11]=g,e[12]=y,e[13]=b,e[14]=v,e[15]=w}function q(e,t){z(e,t,t)}function K(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=253;i>=0;i--)q(r,r),2!==i&&4!==i&&z(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function H(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=250;i>=0;i--)q(r,r),1!==i&&z(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function V(e,n,r){var i=new Uint8Array(32),o=new Float64Array(80),s,a,l=t(),c=t(),f=t(),h=t(),p=t(),d=t();for(a=0;a<31;a++)i[a]=n[a];for(i[31]=127&n[31]|64,i[0]&=248,F(o,r),a=0;a<16;a++)c[a]=o[a],h[a]=l[a]=f[a]=0;for(l[0]=h[0]=1,a=254;a>=0;--a)s=i[a>>>3]>>>(7&a)&1,R(l,c,s),R(f,h,s),D(p,l,f),U(l,l,f),D(f,c,h),U(c,c,h),q(h,p),q(d,l),z(l,f,l),z(f,c,p),D(p,l,f),U(l,l,f),q(c,l),U(f,h,d),z(l,f,u),D(l,l,h),z(f,f,l),z(l,h,d),z(h,c,o),q(c,p),R(l,c,s),R(f,h,s);for(a=0;a<16;a++)o[a+16]=l[a],o[a+32]=f[a],o[a+48]=c[a],o[a+64]=h[a];var m=o.subarray(32),g=o.subarray(16);return K(m,m),z(g,g,m),N(e,g),0}function W(e,t){return V(e,t,o)}function $(e,t){return r(t,32),W(e,t)}function G(e,t,n){var r=new Uint8Array(32);return V(r,n,t),_(e,i,r,k)}A.prototype.blocks=function(e,t,n){for(var r=this.fin?0:2048,i,o,s,a,u,l,c,f,h,p,d,m,g,y,b,v,w,_,k,S=this.h[0],E=this.h[1],x=this.h[2],C=this.h[3],A=this.h[4],I=this.h[5],T=this.h[6],j=this.h[7],O=this.h[8],P=this.h[9],B=this.r[0],R=this.r[1],N=this.r[2],M=this.r[3],L=this.r[4],F=this.r[5],D=this.r[6],U=this.r[7],z=this.r[8],q=this.r[9];n>=16;)i=255&e[t+0]|(255&e[t+1])<<8,S+=8191&i,o=255&e[t+2]|(255&e[t+3])<<8,E+=8191&(i>>>13|o<<3),s=255&e[t+4]|(255&e[t+5])<<8,x+=8191&(o>>>10|s<<6),a=255&e[t+6]|(255&e[t+7])<<8,C+=8191&(s>>>7|a<<9),u=255&e[t+8]|(255&e[t+9])<<8,A+=8191&(a>>>4|u<<12),I+=u>>>1&8191,l=255&e[t+10]|(255&e[t+11])<<8,T+=8191&(u>>>14|l<<2),c=255&e[t+12]|(255&e[t+13])<<8,j+=8191&(l>>>11|c<<5),f=255&e[t+14]|(255&e[t+15])<<8,O+=8191&(c>>>8|f<<8),P+=f>>>5|r,h=0,p=h,p+=S*B,p+=E*(5*q),p+=x*(5*z),p+=C*(5*U),p+=A*(5*D),h=p>>>13,p&=8191,p+=I*(5*F),p+=T*(5*L),p+=j*(5*M),p+=O*(5*N),p+=P*(5*R),h+=p>>>13,p&=8191,d=h,d+=S*R,d+=E*B,d+=x*(5*q),d+=C*(5*z),d+=A*(5*U),h=d>>>13,d&=8191,d+=I*(5*D),d+=T*(5*F),d+=j*(5*L),d+=O*(5*M),d+=P*(5*N),h+=d>>>13,d&=8191,m=h,m+=S*N,m+=E*R,m+=x*B,m+=C*(5*q),m+=A*(5*z),h=m>>>13,m&=8191,m+=I*(5*U),m+=T*(5*D),m+=j*(5*F),m+=O*(5*L),m+=P*(5*M),h+=m>>>13,m&=8191,g=h,g+=S*M,g+=E*N,g+=x*R,g+=C*B,g+=A*(5*q),h=g>>>13,g&=8191,g+=I*(5*z),g+=T*(5*U),g+=j*(5*D),g+=O*(5*F),g+=P*(5*L),h+=g>>>13,g&=8191,y=h,y+=S*L,y+=E*M,y+=x*N,y+=C*R,y+=A*B,h=y>>>13,y&=8191,y+=I*(5*q),y+=T*(5*z),y+=j*(5*U),y+=O*(5*D),y+=P*(5*F),h+=y>>>13,y&=8191,b=h,b+=S*F,b+=E*L,b+=x*M,b+=C*N,b+=A*R,h=b>>>13,b&=8191,b+=I*B,b+=T*(5*q),b+=j*(5*z),b+=O*(5*U),b+=P*(5*D),h+=b>>>13,b&=8191,v=h,v+=S*D,v+=E*F,v+=x*L,v+=C*M,v+=A*N,h=v>>>13,v&=8191,v+=I*R,v+=T*B,v+=j*(5*q),v+=O*(5*z),v+=P*(5*U),h+=v>>>13,v&=8191,w=h,w+=S*U,w+=E*D,w+=x*F,w+=C*L,w+=A*M,h=w>>>13,w&=8191,w+=I*N,w+=T*R,w+=j*B,w+=O*(5*q),w+=P*(5*z),h+=w>>>13,w&=8191,_=h,_+=S*z,_+=E*U,_+=x*D,_+=C*F,_+=A*L,h=_>>>13,_&=8191,_+=I*M,_+=T*N,_+=j*R,_+=O*B,_+=P*(5*q),h+=_>>>13,_&=8191,k=h,k+=S*q,k+=E*z,k+=x*U,k+=C*D,k+=A*F,h=k>>>13,k&=8191,k+=I*L,k+=T*M,k+=j*N,k+=O*R,k+=P*B,h+=k>>>13,k&=8191,h=(h<<2)+h|0,h=h+p|0,p=8191&h,h>>>=13,d+=h,S=p,E=d,x=m,C=g,A=y,I=b,T=v,j=w,O=_,P=k,t+=16,n-=16;this.h[0]=S,this.h[1]=E,this.h[2]=x,this.h[3]=C,this.h[4]=A,this.h[5]=I,this.h[6]=T,this.h[7]=j,this.h[8]=O,this.h[9]=P},A.prototype.finish=function(e,t){var n=new Uint16Array(10),r,i,o,s;if(this.leftover){for(s=this.leftover,this.buffer[s++]=1;s<16;s++)this.buffer[s]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,s=2;s<10;s++)this.h[s]+=r,r=this.h[s]>>>13,this.h[s]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,n[0]=this.h[0]+5,r=n[0]>>>13,n[0]&=8191,s=1;s<10;s++)n[s]=this.h[s]+r,r=n[s]>>>13,n[s]&=8191;for(n[9]-=8192,i=(1^r)-1,s=0;s<10;s++)n[s]&=i;for(i=~i,s=0;s<10;s++)this.h[s]=this.h[s]&i|n[s];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,s=1;s<8;s++)o=(this.h[s]+this.pad[s]|0)+(o>>>16)|0,this.h[s]=65535&o;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},A.prototype.update=function(e,t,n){var r,i;if(this.leftover){for(i=16-this.leftover,i>n&&(i=n),r=0;r=16&&(i=n-n%16,this.blocks(e,t,i),t+=i,n-=i),n){for(r=0;r=128;){for(E=0;E<16;E++)x=8*E+G,i[E]=n[x+0]<<24|n[x+1]<<16|n[x+2]<<8|n[x+3],o[E]=n[x+4]<<24|n[x+5]<<16|n[x+6]<<8|n[x+7];for(E=0;E<80;E++)if(s=P,a=B,u=R,l=N,c=M,f=L,h=F,p=D,d=U,m=z,g=q,y=K,b=H,v=V,w=W,_=$,C=D,A=$,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=(M>>>14|H<<18)^(M>>>18|H<<14)^(H>>>9|M<<23),A=(H>>>14|M<<18)^(H>>>18|M<<14)^(M>>>9|H<<23),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=M&L^~M&F,A=H&V^~H&W,I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=X[2*E],A=X[2*E+1],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=i[E%16],A=o[E%16],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,k=65535&j|O<<16,S=65535&I|T<<16,C=k,A=S,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=(P>>>28|U<<4)^(U>>>2|P<<30)^(U>>>7|P<<25),A=(U>>>28|P<<4)^(P>>>2|U<<30)^(P>>>7|U<<25),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=P&B^P&R^B&R,A=U&z^U&q^z&q,I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,p=65535&j|O<<16,_=65535&I|T<<16,C=l,A=y,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=k,A=S,I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,l=65535&j|O<<16,y=65535&I|T<<16,B=s,R=a,N=u,M=l,L=c,F=f,D=h,P=p,z=d,q=m,K=g,H=y,V=b,W=v,$=w,U=_,E%16==15)for(x=0;x<16;x++)C=i[x],A=o[x],I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=i[(x+9)%16],A=o[(x+9)%16],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,k=i[(x+1)%16],S=o[(x+1)%16],C=(k>>>1|S<<31)^(k>>>8|S<<24)^k>>>7,A=(S>>>1|k<<31)^(S>>>8|k<<24)^(S>>>7|k<<25),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,k=i[(x+14)%16],S=o[(x+14)%16],C=(k>>>19|S<<13)^(S>>>29|k<<3)^k>>>6,A=(S>>>19|k<<13)^(k>>>29|S<<3)^(S>>>6|k<<26),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,i[x]=65535&j|O<<16,o[x]=65535&I|T<<16;C=P,A=U,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[0],A=t[0],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[0]=P=65535&j|O<<16,t[0]=U=65535&I|T<<16,C=B,A=z,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[1],A=t[1],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[1]=B=65535&j|O<<16,t[1]=z=65535&I|T<<16,C=R,A=q,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[2],A=t[2],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[2]=R=65535&j|O<<16,t[2]=q=65535&I|T<<16,C=N,A=K,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[3],A=t[3],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[3]=N=65535&j|O<<16,t[3]=K=65535&I|T<<16,C=M,A=H,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[4],A=t[4],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[4]=M=65535&j|O<<16,t[4]=H=65535&I|T<<16,C=L,A=V,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[5],A=t[5],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[5]=L=65535&j|O<<16,t[5]=V=65535&I|T<<16,C=F,A=W,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[6],A=t[6],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[6]=F=65535&j|O<<16,t[6]=W=65535&I|T<<16,C=D,A=$,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[7],A=t[7],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[7]=D=65535&j|O<<16,t[7]=$=65535&I|T<<16,G+=128,r-=128}return r}function te(e,t,n){var r=new Int32Array(8),i=new Int32Array(8),o=new Uint8Array(256),s,a=n;for(r[0]=1779033703,r[1]=3144134277,r[2]=1013904242,r[3]=2773480762,r[4]=1359893119,r[5]=2600822924,r[6]=528734635,r[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,ee(r,i,t,n),n%=128,s=0;s=0;--i)r=n[i/8|0]>>(7&i)&1,re(e,t,r),ne(t,e),ne(e,e),re(e,t,r)}function se(e,n){var r=[t(),t(),t(),t()];P(r[0],f),P(r[1],h),P(r[2],a),z(r[3],f,h),oe(e,r,n)}function ae(e,n,i){var o=new Uint8Array(64),s=[t(),t(),t(),t()],a;for(i||r(n,32),te(o,n,32),o[0]&=248,o[31]&=127,o[31]|=64,se(s,o),ie(e,s),a=0;a<32;a++)n[a+32]=e[a];return 0}var ue=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function le(e,t){var n,r,i,o;for(r=63;r>=32;--r){for(n=0,i=r-32,o=r-12;i>8,t[i]-=256*n;t[i]+=n,t[r]=0}for(n=0,i=0;i<32;i++)t[i]+=n-(t[31]>>4)*ue[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*ue[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function ce(e){var t=new Float64Array(64),n;for(n=0;n<64;n++)t[n]=e[n];for(n=0;n<64;n++)e[n]=0;le(e,t)}function fe(e,n,r,i){var o=new Uint8Array(64),s=new Uint8Array(64),a=new Uint8Array(64),u,l,c=new Float64Array(64),f=[t(),t(),t(),t()];te(o,i,32),o[0]&=248,o[31]&=127,o[31]|=64;var h=r+64;for(u=0;u>7&&U(e[0],s,e[0]),z(e[3],e[0],e[1]),0)}function pe(e,n,r,i){var o,s,a=new Uint8Array(32),u=new Uint8Array(64),l=[t(),t(),t(),t()],c=[t(),t(),t(),t()];if(s=-1,r<64)return-1;if(he(c,i))return-1;for(o=0;o=0},e.sign.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(64);return ae(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(Be(e),64!==e.length)throw new Error("bad secret key size");for(var t=new Uint8Array(32),n=0;n{o=o||n(918)(t);class s{constructor(e){o.validatePublicKey(e),this._key=e}verify(e,t,n){f(n),o.hashAndVerify(this._key,t,e,n)}marshal(){return o.compressPublicKey(this._key)}get bytes(){return e.PublicKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){f(e),i(this.bytes,"sha2-256",e)}}class a{constructor(e,t){this._key=e,this._publicKey=t||o.computePublicKey(e),o.validatePrivateKey(this._key),o.validatePublicKey(this._publicKey)}sign(e,t){f(t),o.hashAndSign(this._key,e,t)}get public(){return new s(this._publicKey)}marshal(){return this._key}get bytes(){return e.PrivateKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){f(e),i(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,n)=>{if(t)return e(t);e(null,r.encode(n))})}}function u(e,t){t(null,new a(e),null)}function l(e){return new s(e)}function c(e,t){void 0===t&&"function"==typeof e&&(t=e),f(t),o.generateKey((e,n)=>{if(e)return t(e);let r;try{r=new a(n)}catch(e){return t(e)}t(null,r)})}function f(e){if("function"!=typeof e)throw new Error("callback is required")}return{Secp256k1PublicKey:s,Secp256k1PrivateKey:a,unmarshalSecp256k1PrivateKey:u,unmarshalSecp256k1PublicKey:l,generateKeyPair:c}})},function(e,t,n){"use strict";const r=n(919),i=n(58),o=n(14),s="sha2-256";e.exports=(e=>{const t=32;function n(t){const n=(e,n)=>o(()=>t(e,n));let i;do{i=e(32)}while(!r.privateKeyVerify(i));n(null,i)}function a(e,t,n){const a=(e,t)=>o(()=>n(e,t));i.digest(t,s,(t,n)=>{if(t)return a(t);try{const i=r.sign(n,e),o=r.signatureExport(i.signature);return a(null,o)}catch(t){a(t)}})}function u(e,t,n,a){const u=(e,t)=>o(()=>a(e,t));i.digest(n,s,(n,i)=>{if(n)return u(n);try{t=r.signatureImport(t);const o=r.verify(i,t,e);return u(null,o)}catch(n){u(n)}})}function l(e){if(!r.publicKeyVerify(e))throw new Error("Invalid public key");return r.publicKeyConvert(e,!0)}function c(e){return r.publicKeyConvert(e,!1)}function f(e){if(!r.privateKeyVerify(e))throw new Error("Invalid private key")}function h(e){if(!r.publicKeyVerify(e))throw new Error("Invalid public key")}function p(e){return f(e),r.publicKeyCreate(e)}return{generateKey:n,privateKeyLength:32,hashAndSign:a,hashAndVerify:u,compressPublicKey:l,decompressPublicKey:c,validatePrivateKey:f,validatePublicKey:h,computePublicKey:p}})},function(e,t,n){"use strict";e.exports=n(467)(n(922))},function(e,t,n){"use strict";(function(e){var n=Object.prototype.toString;t.isArray=function(e,t){if(!Array.isArray(e))throw TypeError(t)},t.isBoolean=function(e,t){if("[object Boolean]"!==n.call(e))throw TypeError(t)},t.isBuffer=function(t,n){if(!e.isBuffer(t))throw TypeError(n)},t.isFunction=function(e,t){if("[object Function]"!==n.call(e))throw TypeError(t)},t.isNumber=function(e,t){if("[object Number]"!==n.call(e))throw TypeError(t)},t.isObject=function(e,t){if("[object Object]"!==n.call(e))throw TypeError(t)},t.isBufferLength=function(e,t,n){if(e.length!==t)throw RangeError(n)},t.isBufferLength2=function(e,t,n,r){if(e.length!==t&&e.length!==n)throw RangeError(r)},t.isLengthGTZero=function(e,t){if(0===e.length)throw RangeError(t)},t.isNumberInInterval=function(e,t,n,r){if(e<=t||e>=n)throw RangeError(r)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(4).Buffer,i=n(316),o=r.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),s=r.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);t.privateKeyExport=function(e,t,n){var i=r.from(n?o:s);return e.copy(i,n?8:9),t.copy(i,n?181:214),i},t.privateKeyImport=function(e){var t=e.length,n=0;if(!(t2||t1?e[n+r-2]<<8:0);if(n+=r,!(t32||t1&&0===t[o]&&!(128&t[o+1]);--n,++o);for(var s=r.concat([r.from([0]),e.s]),a=33,u=0;a>1&&0===s[u]&&!(128&s[u+1]);--a,++u);return i.encode(t.slice(o),s.slice(u))},t.signatureImport=function(e){var t=r.alloc(32,0),n=r.alloc(32,0);try{var o=i.decode(e);if(33===o.r.length&&0===o.r[0]&&(o.r=o.r.slice(1)),o.r.length>32)throw new Error("R length is too long");if(33===o.s.length&&0===o.s[0]&&(o.s=o.s.slice(1)),o.s.length>32)throw new Error("S length is too long")}catch(e){return}return o.r.copy(t,32-o.r.length),o.s.copy(n,32-o.s.length),{r:t,s:n}},t.signatureImportLax=function(e){var t=r.alloc(32,0),n=r.alloc(32,0),i=e.length,o=0;if(48===e[o++]){var s=e[o++];if(!(128&s&&(o+=s-128,o>i))&&2===e[o++]){var a=e[o++];if(128&a){if(s=a-128,o+s>i)return;for(;s>0&&0===e[o];o+=1,s-=1);for(a=0;s>0;o+=1,s-=1)a=(a<<8)+e[o]}if(!(a>i-o)){var u=o;if(o+=a,2===e[o++]){var l=e[o++];if(128&l){if(s=l-128,o+s>i)return;for(;s>0&&0===e[o];o+=1,s-=1);for(l=0;s>0;o+=1,s-=1)l=(l<<8)+e[o]}if(!(l>i-o)){var c=o;for(o+=l;a>0&&0===e[u];a-=1,u+=1);if(!(a>32)){var f=e.slice(u,u+a);for(f.copy(t,32-f.length);l>0&&0===e[c];l-=1,c+=1);if(!(l>32)){var h=e.slice(c,c+l);return h.copy(n,32-h.length),{r:t,s:n}}}}}}}}}},function(e,t,n){"use strict";var r=n(4).Buffer,i=n(143),o=n(927),s=n(317),a=n(238),u=n(473),l=n(932);t.privateKeyVerify=function(e){var t=a.fromBuffer(e);return!(t.isOverflow()||t.isZero())},t.privateKeyExport=function(e,t){var n=a.fromBuffer(e);if(n.isOverflow()||n.isZero())throw new Error(s.EC_PRIVATE_KEY_EXPORT_DER_FAIL);return l.mul(n).toPublicKey(t)},t.privateKeyNegate=function(e){var t=a.fromBuffer(e);return t.isZero()?r.alloc(32):(t.ucmp(a.n)>0&&t.isub(a.n),a.n.sub(t).toBuffer())},t.privateKeyModInverse=function(e){var t=a.fromBuffer(e);if(t.isOverflow()||t.isZero())throw new Error(s.EC_PRIVATE_KEY_RANGE_INVALID);return t.uinvm().toBuffer()},t.privateKeyTweakAdd=function(e,t){var n=a.fromBuffer(t);if(n.isOverflow())throw new Error(s.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);if(n.iadd(a.fromBuffer(e)),n.isOverflow()&&n.isub(a.n),n.isZero())throw new Error(s.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);return n.toBuffer()},t.privateKeyTweakMul=function(e,t){var n=a.fromBuffer(t);if(n.isOverflow()||n.isZero())throw new Error(s.EC_PRIVATE_KEY_TWEAK_MUL_FAIL);var r=a.fromBuffer(e);return n.umul(r).ureduce().toBuffer()},t.publicKeyCreate=function(e,t){var n=a.fromBuffer(e);if(n.isOverflow()||n.isZero())throw new Error(s.EC_PUBLIC_KEY_CREATE_FAIL);return l.mul(n).toPublicKey(t)},t.publicKeyConvert=function(e,t){var n=u.fromPublicKey(e);if(null===n)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);return n.toPublicKey(t)},t.publicKeyVerify=function(e){return null!==u.fromPublicKey(e)},t.publicKeyTweakAdd=function(e,t,n){var r=u.fromPublicKey(e);if(null===r)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);if(t=a.fromBuffer(t),t.isOverflow())throw new Error(s.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);var i=l.mul(t).add(r);if(i.inf)throw new Error(s.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);return i.toPublicKey(n)},t.publicKeyTweakMul=function(e,t,n){var r=u.fromPublicKey(e);if(null===r)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);if(t=a.fromBuffer(t),t.isOverflow()||t.isZero())throw new Error(s.EC_PUBLIC_KEY_TWEAK_MUL_FAIL);return r.mul(t).toPublicKey(n)},t.publicKeyCombine=function(e,t){for(var n=new Array(e.length),r=0;r=0)&&0===r.iadd(a.psn).redMul(d).ucmp(p.x)},t.recover=function(e,t,n,i){var o=a.fromBuffer(t.slice(0,32)),c=a.fromBuffer(t.slice(32,64));if(o.isOverflow()||c.isOverflow())throw new Error(s.ECDSA_SIGNATURE_PARSE_FAIL);do{if(o.isZero()||c.isZero())break;var f=o;if(n>>1){if(f.ucmp(a.psn)>=0)break;f=o.add(a.n)}var h=r.concat([r.from([2+(1&n)]),f.toBuffer()]),p=u.fromPublicKey(h);if(null===p)break;var d=o.uinvm(),m=a.n.sub(a.fromBuffer(e)).umul(d).ureduce(),g=c.umul(d).ureduce(),y=u.fromECJPoint(l.mulAdd(m,p,g));return y.toPublicKey(i)}while(0);throw new Error(s.ECDSA_RECOVER_FAIL)},t.ecdh=function(e,n){var r=t.ecdhUnsafe(e,n,!0);return i("sha256").update(r).digest()},t.ecdhUnsafe=function(e,t,n){var r=u.fromPublicKey(e);if(null===r)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);var i=a.fromBuffer(t);if(i.isOverflow()||i.isZero())throw new Error(s.ECDH_FAIL);return r.mul(i).toPublicKey(n)}},function(e,t,n){var r=n(1),i=n(144),o=n(4).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function l(e){return e<<5|e>>>27}function c(e){return e<<30|e>>>2}function f(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}r(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,u=0;u<16;++u)t[u]=e.readInt32BE(4*u);for(;u<80;++u)t[u]=t[u-3]^t[u-8]^t[u-14]^t[u-16];for(var h=0;h<80;++h){var p=~~(h/20),d=l(n)+f(p,r,i,o)+a+t[h]+s[p]|0;a=o,o=i,i=c(r),r=n,n=d}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},function(e,t,n){var r=n(1),i=n(144),o=n(4).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function l(e){return e<<1|e>>>31}function c(e){return e<<5|e>>>27}function f(e){return e<<30|e>>>2}function h(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}r(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,u=0;u<16;++u)t[u]=e.readInt32BE(4*u);for(;u<80;++u)t[u]=l(t[u-3]^t[u-8]^t[u-14]^t[u-16]);for(var p=0;p<80;++p){var d=~~(p/20),m=c(n)+h(d,r,i,o)+a+t[p]+s[d]|0;a=o,o=i,i=f(r),r=n,n=m}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},function(e,t,n){var r=n(1),i=n(471),o=n(144),s=n(4).Buffer,a=new Array(64);function u(){this.init(),this._w=a,o.call(this,64,56)}r(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var e=s.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=u},function(e,t,n){var r=n(1),i=n(472),o=n(144),s=n(4).Buffer,a=new Array(160);function u(){this.init(),this._w=a,o.call(this,128,112)}r(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var e=s.allocUnsafe(48);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},e.exports=u},function(e,t,n){"use strict";(function(t){var r=n(319),i=n(930),o=new t(0),s=new t([0]),a=new t([1]);function u(e,t,n,r){var o=i[e];if(void 0===o)throw new Error("hash "+e+" is not supported");this._algo=e,this._securityStrength=o.securityStrength/8,this._outlen=o.outlen/8,this._reseedInterval=281474976710656,this._init(t,n,r)}u.prototype._update=function(e){var t=r(this._algo,this._K).update(this._V).update(s);e&&t.update(e),this._K=t.digest(),this._V=r(this._algo,this._K).update(this._V).digest(),e&&(this._K=r(this._algo,this._K).update(this._V).update(a).update(e).digest(),this._V=r(this._algo,this._K).update(this._V).digest())},u.prototype._init=function(e,n,r){if(e.lengththis._reseedInterval)throw new Error("Reseed is required");n&&0===n.length&&(n=void 0),n&&this._update(n);for(var i=new t(0);i.lengtha?t=e(t):t.length>>13,p=0|r[1],d=8191&p,m=p>>>13,g=0|r[2],y=8191&g,b=g>>>13,v=0|r[3],w=8191&v,_=v>>>13,k=0|r[4],S=8191&k,E=k>>>13,x=0|r[5],C=8191&x,A=x>>>13,I=0|r[6],T=8191&I,j=I>>>13,O=0|r[7],P=8191&O,B=O>>>13,R=0|r[8],N=8191&R,M=R>>>13,L=0|r[9],F=8191&L,D=L>>>13,U=0|i[0],z=8191&U,q=U>>>13,K=0|i[1],H=8191&K,V=K>>>13,W=0|i[2],$=8191&W,G=W>>>13,Y=0|i[3],J=8191&Y,Z=Y>>>13,Q=0|i[4],X=8191&Q,ee=Q>>>13,te=0|i[5],ne=8191&te,re=te>>>13,ie=0|i[6],oe=8191&ie,se=ie>>>13,ae=0|i[7],ue=8191&ae,le=ae>>>13,ce=0|i[8],fe=8191&ce,he=ce>>>13,pe=0|i[9],de=8191&pe,me=pe>>>13;n.length=19,a=Math.imul(f,z),u=Math.imul(f,q),u+=Math.imul(h,z),l=Math.imul(h,q);var ge=s+a+((8191&u)<<13);s=l+(u>>>13)+(ge>>>26),ge&=67108863,a=Math.imul(d,z),u=Math.imul(d,q),u+=Math.imul(m,z),l=Math.imul(m,q),a+=Math.imul(f,H),u+=Math.imul(f,V),u+=Math.imul(h,H),l+=Math.imul(h,V);var ye=s+a+((8191&u)<<13);s=l+(u>>>13)+(ye>>>26),ye&=67108863,a=Math.imul(y,z),u=Math.imul(y,q),u+=Math.imul(b,z),l=Math.imul(b,q),a+=Math.imul(d,H),u+=Math.imul(d,V),u+=Math.imul(m,H),l+=Math.imul(m,V),a+=Math.imul(f,$),u+=Math.imul(f,G),u+=Math.imul(h,$),l+=Math.imul(h,G);var be=s+a+((8191&u)<<13);s=l+(u>>>13)+(be>>>26),be&=67108863,a=Math.imul(w,z),u=Math.imul(w,q),u+=Math.imul(_,z),l=Math.imul(_,q),a+=Math.imul(y,H),u+=Math.imul(y,V),u+=Math.imul(b,H),l+=Math.imul(b,V),a+=Math.imul(d,$),u+=Math.imul(d,G),u+=Math.imul(m,$),l+=Math.imul(m,G),a+=Math.imul(f,J),u+=Math.imul(f,Z),u+=Math.imul(h,J),l+=Math.imul(h,Z);var ve=s+a+((8191&u)<<13);s=l+(u>>>13)+(ve>>>26),ve&=67108863,a=Math.imul(S,z),u=Math.imul(S,q),u+=Math.imul(E,z),l=Math.imul(E,q),a+=Math.imul(w,H),u+=Math.imul(w,V),u+=Math.imul(_,H),l+=Math.imul(_,V),a+=Math.imul(y,$),u+=Math.imul(y,G),u+=Math.imul(b,$),l+=Math.imul(b,G),a+=Math.imul(d,J),u+=Math.imul(d,Z),u+=Math.imul(m,J),l+=Math.imul(m,Z),a+=Math.imul(f,X),u+=Math.imul(f,ee),u+=Math.imul(h,X),l+=Math.imul(h,ee);var we=s+a+((8191&u)<<13);s=l+(u>>>13)+(we>>>26),we&=67108863,a=Math.imul(C,z),u=Math.imul(C,q),u+=Math.imul(A,z),l=Math.imul(A,q),a+=Math.imul(S,H),u+=Math.imul(S,V),u+=Math.imul(E,H),l+=Math.imul(E,V),a+=Math.imul(w,$),u+=Math.imul(w,G),u+=Math.imul(_,$),l+=Math.imul(_,G),a+=Math.imul(y,J),u+=Math.imul(y,Z),u+=Math.imul(b,J),l+=Math.imul(b,Z),a+=Math.imul(d,X),u+=Math.imul(d,ee),u+=Math.imul(m,X),l+=Math.imul(m,ee),a+=Math.imul(f,ne),u+=Math.imul(f,re),u+=Math.imul(h,ne),l+=Math.imul(h,re);var _e=s+a+((8191&u)<<13);s=l+(u>>>13)+(_e>>>26),_e&=67108863,a=Math.imul(T,z),u=Math.imul(T,q),u+=Math.imul(j,z),l=Math.imul(j,q),a+=Math.imul(C,H),u+=Math.imul(C,V),u+=Math.imul(A,H),l+=Math.imul(A,V),a+=Math.imul(S,$),u+=Math.imul(S,G),u+=Math.imul(E,$),l+=Math.imul(E,G),a+=Math.imul(w,J),u+=Math.imul(w,Z),u+=Math.imul(_,J),l+=Math.imul(_,Z),a+=Math.imul(y,X),u+=Math.imul(y,ee),u+=Math.imul(b,X),l+=Math.imul(b,ee),a+=Math.imul(d,ne),u+=Math.imul(d,re),u+=Math.imul(m,ne),l+=Math.imul(m,re),a+=Math.imul(f,oe),u+=Math.imul(f,se),u+=Math.imul(h,oe),l+=Math.imul(h,se);var ke=s+a+((8191&u)<<13);s=l+(u>>>13)+(ke>>>26),ke&=67108863,a=Math.imul(P,z),u=Math.imul(P,q),u+=Math.imul(B,z),l=Math.imul(B,q),a+=Math.imul(T,H),u+=Math.imul(T,V),u+=Math.imul(j,H),l+=Math.imul(j,V),a+=Math.imul(C,$),u+=Math.imul(C,G),u+=Math.imul(A,$),l+=Math.imul(A,G),a+=Math.imul(S,J),u+=Math.imul(S,Z),u+=Math.imul(E,J),l+=Math.imul(E,Z),a+=Math.imul(w,X),u+=Math.imul(w,ee),u+=Math.imul(_,X),l+=Math.imul(_,ee),a+=Math.imul(y,ne),u+=Math.imul(y,re),u+=Math.imul(b,ne),l+=Math.imul(b,re),a+=Math.imul(d,oe),u+=Math.imul(d,se),u+=Math.imul(m,oe),l+=Math.imul(m,se),a+=Math.imul(f,ue),u+=Math.imul(f,le),u+=Math.imul(h,ue),l+=Math.imul(h,le);var Se=s+a+((8191&u)<<13);s=l+(u>>>13)+(Se>>>26),Se&=67108863,a=Math.imul(N,z),u=Math.imul(N,q),u+=Math.imul(M,z),l=Math.imul(M,q),a+=Math.imul(P,H),u+=Math.imul(P,V),u+=Math.imul(B,H),l+=Math.imul(B,V),a+=Math.imul(T,$),u+=Math.imul(T,G),u+=Math.imul(j,$),l+=Math.imul(j,G),a+=Math.imul(C,J),u+=Math.imul(C,Z),u+=Math.imul(A,J),l+=Math.imul(A,Z),a+=Math.imul(S,X),u+=Math.imul(S,ee),u+=Math.imul(E,X),l+=Math.imul(E,ee),a+=Math.imul(w,ne),u+=Math.imul(w,re),u+=Math.imul(_,ne),l+=Math.imul(_,re),a+=Math.imul(y,oe),u+=Math.imul(y,se),u+=Math.imul(b,oe),l+=Math.imul(b,se),a+=Math.imul(d,ue),u+=Math.imul(d,le),u+=Math.imul(m,ue),l+=Math.imul(m,le),a+=Math.imul(f,fe),u+=Math.imul(f,he),u+=Math.imul(h,fe),l+=Math.imul(h,he);var Ee=s+a+((8191&u)<<13);s=l+(u>>>13)+(Ee>>>26),Ee&=67108863,a=Math.imul(F,z),u=Math.imul(F,q),u+=Math.imul(D,z),l=Math.imul(D,q),a+=Math.imul(N,H),u+=Math.imul(N,V),u+=Math.imul(M,H),l+=Math.imul(M,V),a+=Math.imul(P,$),u+=Math.imul(P,G),u+=Math.imul(B,$),l+=Math.imul(B,G),a+=Math.imul(T,J),u+=Math.imul(T,Z),u+=Math.imul(j,J),l+=Math.imul(j,Z),a+=Math.imul(C,X),u+=Math.imul(C,ee),u+=Math.imul(A,X),l+=Math.imul(A,ee),a+=Math.imul(S,ne),u+=Math.imul(S,re),u+=Math.imul(E,ne),l+=Math.imul(E,re),a+=Math.imul(w,oe),u+=Math.imul(w,se),u+=Math.imul(_,oe),l+=Math.imul(_,se),a+=Math.imul(y,ue),u+=Math.imul(y,le),u+=Math.imul(b,ue),l+=Math.imul(b,le),a+=Math.imul(d,fe),u+=Math.imul(d,he),u+=Math.imul(m,fe),l+=Math.imul(m,he),a+=Math.imul(f,de),u+=Math.imul(f,me),u+=Math.imul(h,de),l+=Math.imul(h,me);var xe=s+a+((8191&u)<<13);s=l+(u>>>13)+(xe>>>26),xe&=67108863,a=Math.imul(F,H),u=Math.imul(F,V),u+=Math.imul(D,H),l=Math.imul(D,V),a+=Math.imul(N,$),u+=Math.imul(N,G),u+=Math.imul(M,$),l+=Math.imul(M,G),a+=Math.imul(P,J),u+=Math.imul(P,Z),u+=Math.imul(B,J),l+=Math.imul(B,Z),a+=Math.imul(T,X),u+=Math.imul(T,ee),u+=Math.imul(j,X),l+=Math.imul(j,ee),a+=Math.imul(C,ne),u+=Math.imul(C,re),u+=Math.imul(A,ne),l+=Math.imul(A,re),a+=Math.imul(S,oe),u+=Math.imul(S,se),u+=Math.imul(E,oe),l+=Math.imul(E,se),a+=Math.imul(w,ue),u+=Math.imul(w,le),u+=Math.imul(_,ue),l+=Math.imul(_,le),a+=Math.imul(y,fe),u+=Math.imul(y,he),u+=Math.imul(b,fe),l+=Math.imul(b,he),a+=Math.imul(d,de),u+=Math.imul(d,me),u+=Math.imul(m,de),l+=Math.imul(m,me);var Ce=s+a+((8191&u)<<13);s=l+(u>>>13)+(Ce>>>26),Ce&=67108863,a=Math.imul(F,$),u=Math.imul(F,G),u+=Math.imul(D,$),l=Math.imul(D,G),a+=Math.imul(N,J),u+=Math.imul(N,Z),u+=Math.imul(M,J),l+=Math.imul(M,Z),a+=Math.imul(P,X),u+=Math.imul(P,ee),u+=Math.imul(B,X),l+=Math.imul(B,ee),a+=Math.imul(T,ne),u+=Math.imul(T,re),u+=Math.imul(j,ne),l+=Math.imul(j,re),a+=Math.imul(C,oe),u+=Math.imul(C,se),u+=Math.imul(A,oe),l+=Math.imul(A,se),a+=Math.imul(S,ue),u+=Math.imul(S,le),u+=Math.imul(E,ue),l+=Math.imul(E,le),a+=Math.imul(w,fe),u+=Math.imul(w,he),u+=Math.imul(_,fe),l+=Math.imul(_,he),a+=Math.imul(y,de),u+=Math.imul(y,me),u+=Math.imul(b,de),l+=Math.imul(b,me);var Ae=s+a+((8191&u)<<13);s=l+(u>>>13)+(Ae>>>26),Ae&=67108863,a=Math.imul(F,J),u=Math.imul(F,Z),u+=Math.imul(D,J),l=Math.imul(D,Z),a+=Math.imul(N,X),u+=Math.imul(N,ee),u+=Math.imul(M,X),l+=Math.imul(M,ee),a+=Math.imul(P,ne),u+=Math.imul(P,re),u+=Math.imul(B,ne),l+=Math.imul(B,re),a+=Math.imul(T,oe),u+=Math.imul(T,se),u+=Math.imul(j,oe),l+=Math.imul(j,se),a+=Math.imul(C,ue),u+=Math.imul(C,le),u+=Math.imul(A,ue),l+=Math.imul(A,le),a+=Math.imul(S,fe),u+=Math.imul(S,he),u+=Math.imul(E,fe),l+=Math.imul(E,he),a+=Math.imul(w,de),u+=Math.imul(w,me),u+=Math.imul(_,de),l+=Math.imul(_,me);var Ie=s+a+((8191&u)<<13);s=l+(u>>>13)+(Ie>>>26),Ie&=67108863,a=Math.imul(F,X),u=Math.imul(F,ee),u+=Math.imul(D,X),l=Math.imul(D,ee),a+=Math.imul(N,ne),u+=Math.imul(N,re),u+=Math.imul(M,ne),l+=Math.imul(M,re),a+=Math.imul(P,oe),u+=Math.imul(P,se),u+=Math.imul(B,oe),l+=Math.imul(B,se),a+=Math.imul(T,ue),u+=Math.imul(T,le),u+=Math.imul(j,ue),l+=Math.imul(j,le),a+=Math.imul(C,fe),u+=Math.imul(C,he),u+=Math.imul(A,fe),l+=Math.imul(A,he),a+=Math.imul(S,de),u+=Math.imul(S,me),u+=Math.imul(E,de),l+=Math.imul(E,me);var Te=s+a+((8191&u)<<13);s=l+(u>>>13)+(Te>>>26),Te&=67108863,a=Math.imul(F,ne),u=Math.imul(F,re),u+=Math.imul(D,ne),l=Math.imul(D,re),a+=Math.imul(N,oe),u+=Math.imul(N,se),u+=Math.imul(M,oe),l+=Math.imul(M,se),a+=Math.imul(P,ue),u+=Math.imul(P,le),u+=Math.imul(B,ue),l+=Math.imul(B,le),a+=Math.imul(T,fe),u+=Math.imul(T,he),u+=Math.imul(j,fe),l+=Math.imul(j,he),a+=Math.imul(C,de),u+=Math.imul(C,me),u+=Math.imul(A,de),l+=Math.imul(A,me);var je=s+a+((8191&u)<<13);s=l+(u>>>13)+(je>>>26),je&=67108863,a=Math.imul(F,oe),u=Math.imul(F,se),u+=Math.imul(D,oe),l=Math.imul(D,se),a+=Math.imul(N,ue),u+=Math.imul(N,le),u+=Math.imul(M,ue),l+=Math.imul(M,le),a+=Math.imul(P,fe),u+=Math.imul(P,he),u+=Math.imul(B,fe),l+=Math.imul(B,he),a+=Math.imul(T,de),u+=Math.imul(T,me),u+=Math.imul(j,de),l+=Math.imul(j,me);var Oe=s+a+((8191&u)<<13);s=l+(u>>>13)+(Oe>>>26),Oe&=67108863,a=Math.imul(F,ue),u=Math.imul(F,le),u+=Math.imul(D,ue),l=Math.imul(D,le),a+=Math.imul(N,fe),u+=Math.imul(N,he),u+=Math.imul(M,fe),l+=Math.imul(M,he),a+=Math.imul(P,de),u+=Math.imul(P,me),u+=Math.imul(B,de),l+=Math.imul(B,me);var Pe=s+a+((8191&u)<<13);s=l+(u>>>13)+(Pe>>>26),Pe&=67108863,a=Math.imul(F,fe),u=Math.imul(F,he),u+=Math.imul(D,fe),l=Math.imul(D,he),a+=Math.imul(N,de),u+=Math.imul(N,me),u+=Math.imul(M,de),l+=Math.imul(M,me);var Be=s+a+((8191&u)<<13);s=l+(u>>>13)+(Be>>>26),Be&=67108863,a=Math.imul(F,de),u=Math.imul(F,me),u+=Math.imul(D,de),l=Math.imul(D,me);var Re=s+a+((8191&u)<<13);return s=l+(u>>>13)+(Re>>>26),Re&=67108863,o[0]=ge,o[1]=ye,o[2]=be,o[3]=ve,o[4]=we,o[5]=_e,o[6]=ke,o[7]=Se,o[8]=Ee,o[9]=xe,o[10]=Ce,o[11]=Ae,o[12]=Ie,o[13]=Te,o[14]=je,o[15]=Oe,o[16]=Pe,o[17]=Be,o[18]=Re,0!==s&&(o[19]=s,n.length++),n}},function(e,t,n){"use strict";var r=n(4).Buffer,i=n(238),o=n(473),s=n(474);function a(){this.x=i.fromBuffer(r.from("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","hex")),this.y=i.fromBuffer(r.from("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8","hex")),this.inf=!1,this._precompute()}a.prototype._precompute=function(){for(var e=new o(this.x,this.y),t=4,n=new Array(1+Math.ceil(64.25)),r=n[0]=e,i=1;i=l;f--)c=(c<<1)+i[f];u.push(c)}for(var h=new s(null,null,null),p=new s(null,null,null),d=a;d>0;d--){for(var m=0;m=0;c--){for(var f=0;c>=0&&(l[0]=0|a[0][c],l[1]=0|a[1][c],0===l[0]&&0===l[1]);++f,--c);if(c>=0&&(f+=1),u=u.dblp(f),c<0)break;for(var h=0;h<2;h++){var p=l[h],d;0!==p&&(p>0?d=o[h][p>>1]:p<0&&(d=o[h][-p>>1].neg()),u=void 0===d.z?u.mixedAdd(d):u.add(d))}}return u},e.exports=new a},function(e,t,n){"use strict";(function(t){const r=n(229),i=n(475),o={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=((e,n,s,a)=>{const u=o[e];if(!u)return a(new Error("unkown cipherType passed"));if(!n)return a(new Error("unkown hashType passed"));const l=u.keySize,c=u.ivSize,f=20,h=t.from("key expansion"),p=2*(c+l+20);i.create(n,s,(e,n)=>{if(e)return a(e);n.digest(h,(e,i)=>{if(e)return a(e);let o=[],s=0;function u(e){n.digest(t.concat([i,h]),(t,r)=>{if(t)return e(t);let a=r.length;s+a>p&&(a=p-s),o.push(r),s+=a,n.digest(i,(t,n)=>{if(t)return e(t);i=n,e()})})}function f(e){if(e)return a(e);const n=p/2,r=t.concat(o),i=r.slice(0,n),s=r.slice(n,p),u=e=>({iv:e.slice(0,c),cipherKey:e.slice(c,c+l),macKey:e.slice(c+l)});a(null,{k1:u(i),k2:u(s)})}r(()=>s{r.generateEphmeralKeyPair(e,t)})},function(e,t,n){"use strict";(function(e){const r=n(314),i=n(313),o=n(142).bignum,s=n(466),a=s.toBase64,u=s.toBn,l={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=function(t,n){i(r.subtle.generateKey({name:"ECDH",namedCurve:t},!0,["deriveBits"]).then(n=>{const o=(o,s,a)=>{let u;"function"==typeof s&&(a=s,s=void 0),u=s?r.subtle.importKey("jwk",p(t,s),{name:"ECDH",namedCurve:t},!1,["deriveBits"]):Promise.resolve(n.privateKey);const c=Promise.all([r.subtle.importKey("jwk",h(t,o),{name:"ECDH",namedCurve:t},!1,[]),u]);i(c.then(e=>r.subtle.deriveBits({name:"ECDH",namedCurve:t,public:e[0]},e[1],l[t])).then(t=>e.from(t)),a)};return r.subtle.exportKey("jwk",n.publicKey).then(e=>({key:f(e),genSharedKey:o}))}),n)};const c={"P-256":32,"P-384":48,"P-521":66};function f(t){const n=c[t.crv];return e.concat([e.from([4]),u(t.x).toArrayLike(e,"be",n),u(t.y).toArrayLike(e,"be",n)],1+2*n)}function h(t,n){const r=c[t];if(!n.slice(0,1).equals(e.from([4])))throw new Error("Invalid key format");const i=new o(n.slice(1,r+1)),s=new o(n.slice(1+r));return{kty:"EC",crv:t,x:a(i,r),y:a(s,r),ext:!0}}function p(e,t){const n=h(e,t.public);return n.d=a(new o(t.private)),n}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(938),i=n(320),o=n(39);function s(e){const t=[],n=e.split("/").slice(1);if(1===n.length&&""===n[0])return[];for(let r=0;r=n.length)throw w("invalid address: "+e);if(s.path){t.push([o,v(n.slice(r).join("/"))]);break}t.push([o,n[r]])}else t.push([o])}return t}function a(e){const t=[];return e.map(e=>{const n=_(e);t.push(n.name),e.length>1&&t.push(e[1])}),v(t.join("/"))}function u(e){return e.map(e=>{Array.isArray(e)||(e=[e]);const t=_(e);return e.length>1?[t.code,r.toBuffer(t.code,e[1])]:[t.code]})}function l(e){return e.map(e=>{const t=_(e);return e.length>1?[t.code,r.toString(t.code,e[1])]:[t.code]})}function c(e){return g(t.concat(e.map(e=>{const n=_(e);let r=t.from(o.encode(n.code));return e.length>1&&(r=t.concat([r,e[1]])),r})))}function f(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;{const e=o.decode(t);return e+o.decode.bytes}}function h(e){const t=[];let n=0;for(;ne.length)throw w("Invalid address buffer: "+e.toString("hex"));t.push([r,l])}return t}function p(e){const t=h(e),n=l(t);return a(n)}function d(e){e=v(e);const t=s(e),n=u(t);return c(n)}function m(e){return d(e)}function g(e){const n=y(e);if(n)throw n;return t.from(e)}function y(e){try{h(e)}catch(e){return e}}function b(e){return void 0===y(e)}function v(e){return"/"+e.trim().split("/").filter(e=>e).join("/")}function w(e){return new Error("Error parsing address: "+e)}function _(e){const t=i(e[0]);return t}e.exports={stringToStringTuples:s,stringTuplesToString:a,tuplesToStringTuples:l,stringTuplesToTuples:u,bufferToTuples:h,tuplesToBuffer:c,bufferToString:p,stringToBuffer:d,fromString:m,fromBuffer:g,validateBuffer:y,isValidBuffer:b,cleanPath:v,ParseError:w,protoFromTuple:_,sizeForAddr:f}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(939),i=n(940),o=n(320),s=n(76),a=n(942),u=n(39);function l(e,n){return n instanceof t?l.toString(e,n):l.toBuffer(e,n)}function c(e){if(!i(e))throw new Error("invalid ip address");return r.toBuffer(e)}function f(e){const t=r.toString(e);if(!i(t))throw new Error("invalid ip address");return t}function h(e){const n=t.alloc(2);return n.writeUInt16BE(e,0),n}function p(e){return e.readUInt16BE(0)}function d(e){const n=t.from(e),r=t.from(u.encode(n.length));return t.concat([r,n])}function m(e){const t=u.decode(e);if(e=e.slice(u.decode.bytes),e.length!==t)throw new Error("inconsistent lengths");return e.toString()}function g(e){const n=t.from(s.decode(e)),r=t.from(u.encode(n.length));return t.concat([r,n])}function y(e){const t=u.decode(e),n=e.slice(u.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return s.encode(n)}function b(e){const n=e.split(":");if(2!==n.length)throw new Error("failed to parse onion addr: "+n+" does not contain a port number");if(16!==n[0].length)throw new Error("failed to parse onion addr: "+n[0]+" not a Tor onion address.");const r=t.from(a.decode.asBytes(n[0].toUpperCase())),i=parseInt(n[1],10);if(i<1||i>65536)throw new Error("Port number is not in range(1, 65536)");const o=h(i);return t.concat([r,o])}function v(e){const n=e.split(":");if(2!==n.length)throw new Error("failed to parse onion addr: "+n+" does not contain a port number");if(56!==n[0].length)throw new Error("failed to parse onion addr: "+n[0]+" not a Tor onion3 address.");const r=t.from(a.decode.asBytes(n[0].toUpperCase())),i=parseInt(n[1],10);if(i<1||i>65536)throw new Error("Port number is not in range(1, 65536)");const o=h(i);return t.concat([r,o])}function w(e){const t=e.slice(0,e.length-2),n=e.slice(e.length-2),r=a.encode(t).toString("ascii").toLowerCase(),i=p(n);return r+":"+i}e.exports=l,l.toString=function e(t,n){switch(t=o(t),t.code){case 4:case 41:return f(n);case 6:case 273:case 33:case 132:return p(n);case 53:case 54:case 55:case 56:case 400:return m(n);case 421:return y(n);case 444:case 445:return w(n);default:return n.toString("hex")}},l.toBuffer=function e(n,r){switch(n=o(n),n.code){case 4:case 41:return c(r);case 6:case 273:case 33:case 132:return h(parseInt(r,10));case 53:case 54:case 55:case 56:case 400:return d(r);case 421:return g(r);case 444:return b(r);case 445:return v(r);default:return t.from(r,"hex")}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=t,i=n(0).Buffer,o=n(227);r.toBuffer=function(e,t,n){var r;if(n=~~n,this.isV4Format(e))r=t||new i(n+4),e.split(/\./g).map(function(e){r[n++]=255&parseInt(e,10)});else if(this.isV6Format(e)){var o=e.split(":",8),s;for(s=0;s0;s--)l.push("0");o.splice.apply(o,l)}for(r=t||new i(n+16),s=0;s>8&255,r[n++]=255&c}}if(!r)throw Error("Invalid ip address: "+e);return r},r.toString=function(e,t,n){t=~~t,n=n||e.length-t;var r=[];if(4===n){for(var i=0;i32?"ipv6":u(t);var n=4;"ipv6"===t&&(n=16);for(var o=new i(n),s=0,a=o.length;s>l)}return r.toString(o)},r.mask=function(e,t){e=r.toBuffer(e),t=r.toBuffer(t);var n=new i(Math.max(e.length,t.length)),o=0;if(e.length===t.length)for(o=0;oe.length&&(i=t,o=e);for(var s=i.length-o.length,n=s;n>>0},r.fromLong=function(e){return(e>>>24)+"."+(e>>16&255)+"."+(e>>8&255)+"."+(255&e)}},function(e,t,n){"use strict";const r=n(941),i=e.exports=(e=>r({exact:!0}).test(e));i.v4=(e=>r.v4({exact:!0}).test(e)),i.v6=(e=>r.v6({exact:!0}).test(e))},function(e,t,n){"use strict";const r="(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(?:\\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3}",i="[0-9a-fA-F]{1,4}",o=`\n(\n(?:${i}:){7}(?:${i}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${i}:){6}(?:${r}|:${i}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${i}:){5}(?::${r}|(:${i}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${i}:){4}(?:(:${i}){0,1}:${r}|(:${i}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${i}:){3}(?:(:${i}){0,2}:${r}|(:${i}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${i}:){2}(?:(:${i}){0,3}:${r}|(:${i}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${i}:){1}(?:(:${i}){0,4}:${r}|(:${i}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::((?::${i}){0,5}:${r}|(?::${i}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),s=e.exports=(e=>e&&e.exact?new RegExp(`(?:^${r}$)|(?:^${o}$)`):new RegExp(`(?:${r})|(?:${o})`,"g"));s.v4=(e=>e&&e.exact?new RegExp(`^${r}$`):new RegExp(r,"g")),s.v6=(e=>e&&e.exact?new RegExp(`^${o}$`):new RegExp(o,"g"))},function(e,t,n){(function(t,r){var i; -/* - * [hi-base32]{@link https://github.com/emn178/hi-base32} - * - * @version 0.5.0 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2015-2018 - * @license MIT - */ -/* - * [hi-base32]{@link https://github.com/emn178/hi-base32} - * - * @version 0.5.0 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2015-2018 - * @license MIT - */ -!function(){"use strict";var o="object"==typeof window?window:{},s=!o.HI_BASE32_NO_NODE_JS&&"object"==typeof t&&t.versions&&t.versions.node;s&&(o=r);var a=!o.HI_BASE32_NO_COMMON_JS&&"object"==typeof e&&e.exports,u=n(446),l="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),c={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},f=[0,0,0,0,0,0,0,0],h=function(e,t){t.length>10&&(t="..."+t.substr(-10));var n=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+e+" bytes: "+t+" <-");throw n.position=e,n},p=function(e){for(var t="",n=e.length,r=0,i=0,o,s;r191&&o<=223?(s=31&o,i=1):o<=239?(s=15&o,i=2):o<=247?(s=7&o,i=3):h(r,t);for(var a=0;a191)&&h(r,t),s<<=6,s+=63&o;s>=55296&&s<=57343&&h(r,t),s>1114111&&h(r,t),s<=65535?t+=String.fromCharCode(s):(s-=65536,t+=String.fromCharCode(55296+(s>>10)),t+=String.fromCharCode(56320+(1023&s)))}return t},d=function(e){if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");e=e.replace(/=/g,"");for(var t,n,r,i,o,s,a,u,l=[],f=0,h=e.length,p=0,d=h>>3<<3;p>>2),l[f++]=255&(n<<6|r<<1|i>>>4),l[f++]=255&(i<<4|o>>>1),l[f++]=255&(o<<7|s<<2|a>>>3),l[f++]=255&(a<<5|u);var m=h-d;return 2===m?(t=c[e.charAt(p++)],n=c[e.charAt(p++)],l[f++]=255&(t<<3|n>>>2)):4===m?(t=c[e.charAt(p++)],n=c[e.charAt(p++)],r=c[e.charAt(p++)],i=c[e.charAt(p++)],l[f++]=255&(t<<3|n>>>2),l[f++]=255&(n<<6|r<<1|i>>>4)):5===m?(t=c[e.charAt(p++)],n=c[e.charAt(p++)],r=c[e.charAt(p++)],i=c[e.charAt(p++)],o=c[e.charAt(p++)],l[f++]=255&(t<<3|n>>>2),l[f++]=255&(n<<6|r<<1|i>>>4),l[f++]=255&(i<<4|o>>>1)):7===m&&(t=c[e.charAt(p++)],n=c[e.charAt(p++)],r=c[e.charAt(p++)],i=c[e.charAt(p++)],o=c[e.charAt(p++)],s=c[e.charAt(p++)],a=c[e.charAt(p++)],l[f++]=255&(t<<3|n>>>2),l[f++]=255&(n<<6|r<<1|i>>>4),l[f++]=255&(i<<4|o>>>1),l[f++]=255&(o<<7|s<<2|a>>>3)),l},m=function(e){for(var t,n,r,i,o,s="",a=e.length,u=0,c=5*parseInt(a/5);u>>3]+l[31&(t<<2|n>>>6)]+l[n>>>1&31]+l[31&(n<<4|r>>>4)]+l[31&(r<<1|i>>>7)]+l[i>>>2&31]+l[31&(i<<3|o>>>5)]+l[31&o];var f=a-c;return 1===f?(t=e.charCodeAt(u),s+=l[t>>>3]+l[t<<2&31]+"======"):2===f?(t=e.charCodeAt(u++),n=e.charCodeAt(u),s+=l[t>>>3]+l[31&(t<<2|n>>>6)]+l[n>>>1&31]+l[n<<4&31]+"===="):3===f?(t=e.charCodeAt(u++),n=e.charCodeAt(u++),r=e.charCodeAt(u),s+=l[t>>>3]+l[31&(t<<2|n>>>6)]+l[n>>>1&31]+l[31&(n<<4|r>>>4)]+l[r<<1&31]+"==="):4===f&&(t=e.charCodeAt(u++),n=e.charCodeAt(u++),r=e.charCodeAt(u++),i=e.charCodeAt(u),s+=l[t>>>3]+l[31&(t<<2|n>>>6)]+l[n>>>1&31]+l[31&(n<<4|r>>>4)]+l[31&(r<<1|i>>>7)]+l[i>>>2&31]+l[i<<3&31]+"="),s},g=function(e){var t,n,r,i,o,s,a=!1,u="",c=0,h,p=0,d=0,m=e.length;do{for(f[0]=f[5],f[1]=f[6],f[2]=f[7],h=p;c>6,f[h++]=128|63&s):s<55296||s>=57344?(f[h++]=224|s>>12,f[h++]=128|s>>6&63,f[h++]=128|63&s):(s=65536+((1023&s)<<10|1023&e.charCodeAt(++c)),f[h++]=240|s>>18,f[h++]=128|s>>12&63,f[h++]=128|s>>6&63,f[h++]=128|63&s);d+=h-p,p=h-5,c===m&&++c,c>m&&h<6&&(a=!0),t=f[0],h>4?(n=f[1],r=f[2],i=f[3],o=f[4],u+=l[t>>>3]+l[31&(t<<2|n>>>6)]+l[n>>>1&31]+l[31&(n<<4|r>>>4)]+l[31&(r<<1|i>>>7)]+l[i>>>2&31]+l[31&(i<<3|o>>>5)]+l[31&o]):1===h?u+=l[t>>>3]+l[t<<2&31]+"======":2===h?(n=f[1],u+=l[t>>>3]+l[31&(t<<2|n>>>6)]+l[n>>>1&31]+l[n<<4&31]+"===="):3===h?(n=f[1],r=f[2],u+=l[t>>>3]+l[31&(t<<2|n>>>6)]+l[n>>>1&31]+l[31&(n<<4|r>>>4)]+l[r<<1&31]+"==="):(n=f[1],r=f[2],i=f[3],u+=l[t>>>3]+l[31&(t<<2|n>>>6)]+l[n>>>1&31]+l[31&(n<<4|r>>>4)]+l[31&(r<<1|i>>>7)]+l[i>>>2&31]+l[i<<3&31]+"=")}while(!a);return u},y=function(e){for(var t,n,r,i,o,s="",a=e.length,u=0,c=5*parseInt(a/5);u>>3]+l[31&(t<<2|n>>>6)]+l[n>>>1&31]+l[31&(n<<4|r>>>4)]+l[31&(r<<1|i>>>7)]+l[i>>>2&31]+l[31&(i<<3|o>>>5)]+l[31&o];var f=a-c;return 1===f?(t=e[u],s+=l[t>>>3]+l[t<<2&31]+"======"):2===f?(t=e[u++],n=e[u],s+=l[t>>>3]+l[31&(t<<2|n>>>6)]+l[n>>>1&31]+l[n<<4&31]+"===="):3===f?(t=e[u++],n=e[u++],r=e[u],s+=l[t>>>3]+l[31&(t<<2|n>>>6)]+l[n>>>1&31]+l[31&(n<<4|r>>>4)]+l[r<<1&31]+"==="):4===f&&(t=e[u++],n=e[u++],r=e[u++],i=e[u],s+=l[t>>>3]+l[31&(t<<2|n>>>6)]+l[n>>>1&31]+l[31&(n<<4|r>>>4)]+l[31&(r<<1|i>>>7)]+l[i>>>2&31]+l[i<<3&31]+"="),s},b=function(e,t){var n="string"!=typeof e;return n&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),n?y(e):t?m(e):g(e)},v=function(e,t){if(!t)return p(d(e));if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");var n,r,i,o,s,a,u,l,f="",h=e.indexOf("=");-1===h&&(h=e.length);for(var m=0,g=h>>3<<3;m>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))+String.fromCharCode(255&(s<<7|a<<2|u>>>3))+String.fromCharCode(255&(u<<5|l));var y=h-g;return 2===y?(n=c[e.charAt(m++)],r=c[e.charAt(m++)],f+=String.fromCharCode(255&(n<<3|r>>>2))):4===y?(n=c[e.charAt(m++)],r=c[e.charAt(m++)],i=c[e.charAt(m++)],o=c[e.charAt(m++)],f+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))):5===y?(n=c[e.charAt(m++)],r=c[e.charAt(m++)],i=c[e.charAt(m++)],o=c[e.charAt(m++)],s=c[e.charAt(m++)],f+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))):7===y&&(n=c[e.charAt(m++)],r=c[e.charAt(m++)],i=c[e.charAt(m++)],o=c[e.charAt(m++)],s=c[e.charAt(m++)],a=c[e.charAt(m++)],u=c[e.charAt(m++)],f+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))+String.fromCharCode(255&(s<<7|a<<2|u>>>3))),f},w={encode:b,decode:v};v.asBytes=d,a?e.exports=w:(o.base32=w,u&&(i=function(){return w}.call(w,n,w,e),void 0===i||(e.exports=i)))}()}).call(this,n(2),n(8))},function(e,t,n){"use strict";const{ensureMultiaddr:r}=n(476),i=n(944);class o{constructor(e){this._multiaddrs=e||[],this._observedMultiaddrs=[]}add(e){e=r(e),this.has(e)||this._multiaddrs.push(e)}addSafe(e){e=r(e);const t=this._observedMultiaddrs.some((t,n)=>{if(t.equals(e))return this.add(e),this._observedMultiaddrs.splice(n,1),!0});t||this._observedMultiaddrs.push(e)}toArray(){return this._multiaddrs.slice()}get size(){return this._multiaddrs.length}forEach(e){return this._multiaddrs.forEach(e)}filterBy(e){return"object"!=typeof e||"function"!=typeof e.matches||"function"!=typeof e.partialMatch||"function"!=typeof e.toString?[]:this._multiaddrs.filter(t=>e.matches(t))}has(e){return e=r(e),this._multiaddrs.some(t=>t.equals(e))}delete(e){e=r(e),this._multiaddrs.some((t,n)=>{if(t.equals(e))return this._multiaddrs.splice(n,1),!0})}replace(e,t){Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]),e.forEach(e=>this.delete(e)),t.forEach(e=>this.add(e))}clear(){this._multiaddrs=[]}distinct(){return i(this._multiaddrs,e=>[e.toOptions().port,e.toOptions().transport].join())}}e.exports=o},function(e,t,n){"use strict";function r(e,t){var n=[],r={};if("function"!=typeof t){var i=t;t=function e(t){return t[i]}}return e.forEach(function e(i){var o=t(i);r[o]||(r[o]=!0,n.push(i))}),n}e.exports=r},function(e,t,n){"use strict";const r=n(946),i={16:"aes-128-ctr",32:"aes-256-ctr"};t.create=function(e,t,n){const o=i[e.length];if(!o)return n(new Error("Invalid key length"));const s=r.createCipheriv(o,e,t),a=r.createDecipheriv(o,e,t),u={encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}};n(null,u)}},function(e,t,n){"use strict";const r=n(947);e.exports={createCipheriv:r.createCipheriv,createDecipheriv:r.createDecipheriv}},function(e,t,n){var r=n(948),i=n(956),o=n(480);function s(){return Object.keys(o)}t.createCipher=t.Cipher=r.createCipher,t.createCipheriv=t.Cipheriv=r.createCipheriv,t.createDecipher=t.Decipher=i.createDecipher,t.createDecipheriv=t.Decipheriv=i.createDecipheriv,t.listCiphers=t.getCiphers=s},function(e,t,n){var r=n(477),i=n(481),o=n(4).Buffer,s=n(482),a=n(119),u=n(239),l=n(483),c=n(1);function f(e,t,n){a.call(this),this._cache=new p,this._cipher=new u.AES(t),this._prev=o.from(n),this._mode=e,this._autopadding=!0}c(f,a),f.prototype._update=function(e){var t,n;this._cache.add(e);for(var r=[];t=this._cache.get();)n=this._mode.encrypt(this,t),r.push(n);return o.concat(r)};var h=o.alloc(16,16);function p(){this.cache=o.allocUnsafe(0)}function d(e,t,n){var a=r[e.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=o.from(t)),t.length!==a.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof n&&(n=o.from(n)),"GCM"!==a.mode&&n.length!==a.iv)throw new TypeError("invalid iv length "+n.length);return"stream"===a.type?new s(a.module,t,n):"auth"===a.type?new i(a.module,t,n):new f(a.module,t,n)}function m(e,t){var n=r[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var i=l(t,!1,n.key,n.iv);return d(e,i.key,i.iv)}f.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(h))throw this._cipher.scrub(),new Error("data not multiple of block length")},f.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},p.prototype.add=function(e){this.cache=o.concat([this.cache,e])},p.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},p.prototype.flush=function(){for(var e=16-this.cache.length,t=o.allocUnsafe(e),n=-1;++n>i%8,e._prev=o(e._prev,n?u:l);return a}function o(e,t){var n=e.length,i=-1,o=r.allocUnsafe(e.length);for(e=r.concat([e,r.from([t])]);++i>7;return o}t.encrypt=function(e,t,n){for(var o=t.length,s=r.allocUnsafe(o),a=-1;++a>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function a(e){this.h=e,this.state=r.alloc(16,0),this.cache=r.allocUnsafe(0)}a.prototype.ghash=function(e){for(var t=-1;++t0;n--)e[n]=e[n]>>>1|(1&e[n-1])<<31;e[0]=e[0]>>>1,i&&(e[0]=e[0]^225<<24)}this.state=s(t)},a.prototype.update=function(e){var t;for(this.cache=r.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},a.prototype.final=function(e,t){return this.cache.length&&this.ghash(r.concat([this.cache,i],16)),this.ghash(s([0,e,0,t])),this.state},e.exports=a},function(e,t,n){var r=n(481),i=n(4).Buffer,o=n(477),s=n(482),a=n(119),u=n(239),l=n(483),c=n(1);function f(e,t,n){a.call(this),this._cache=new h,this._last=void 0,this._cipher=new u.AES(t),this._prev=i.from(n),this._mode=e,this._autopadding=!0}function h(){this.cache=i.allocUnsafe(0)}function p(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");for(var n=-1;++n16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},h.prototype.flush=function(){if(this.cache.length)return this.cache},t.createDecipher=m,t.createDecipheriv=d},function(e,t,n){"use strict";const r=n(461),i=n(34),o={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function s(e,t,n,s,a){const u=o[a];if(!u)throw new Error(`Hash '${a}' is unknown or not supported`);const l=r(e,t,n,s,u);return i.encode64(l)}e.exports=s},function(e,t,n){(function(e,r){var i; -/** - * @license - * Lodash - * Copyright JS Foundation and other contributors - * 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.",l="Expected a function",c="__lodash_hash_undefined__",f=500,h="__lodash_placeholder__",p=1,d=2,m=4,g=1,y=2,b=1,v=2,w=4,_=8,k=16,S=32,E=64,x=128,C=256,A=512,I=30,T="...",j=800,O=16,P=1,B=2,R=3,N=1/0,M=9007199254740991,L=1.7976931348623157e308,F=NaN,D=4294967295,U=D-1,z=D>>>1,q=[["ary",x],["bind",b],["bindKey",v],["curry",_],["curryRight",k],["flip",A],["partial",S],["partialRight",E],["rearg",C]],K="[object Arguments]",H="[object Array]",V="[object AsyncFunction]",W="[object Boolean]",$="[object Date]",G="[object DOMException]",Y="[object Error]",J="[object Function]",Z="[object GeneratorFunction]",Q="[object Map]",X="[object Number]",ee="[object Null]",te="[object Object]",ne="[object Promise]",re="[object Proxy]",ie="[object RegExp]",oe="[object Set]",se="[object String]",ae="[object Symbol]",ue="[object Undefined]",le="[object WeakMap]",ce="[object WeakSet]",fe="[object ArrayBuffer]",he="[object DataView]",pe="[object Float32Array]",de="[object Float64Array]",me="[object Int8Array]",ge="[object Int16Array]",ye="[object Int32Array]",be="[object Uint8Array]",ve="[object Uint8ClampedArray]",we="[object Uint16Array]",_e="[object Uint32Array]",ke=/\b__p \+= '';/g,Se=/\b(__p \+=) '' \+/g,Ee=/(__e\(.*?\)|\b__t\)) \+\n'';/g,xe=/&(?:amp|lt|gt|quot|#39);/g,Ce=/[&<>"']/g,Ae=RegExp(xe.source),Ie=RegExp(Ce.source),Te=/<%-([\s\S]+?)%>/g,je=/<%([\s\S]+?)%>/g,Oe=/<%=([\s\S]+?)%>/g,Pe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Be=/^\w*$/,Re=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ne=/[\\^$.*+?()[\]{}|]/g,Me=RegExp(Ne.source),Le=/^\s+|\s+$/g,Fe=/^\s+/,De=/\s+$/,Ue=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ze=/\{\n\/\* \[wrapped with (.+)\] \*/,qe=/,? & /,Ke=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,He=/\\(\\)?/g,Ve=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,We=/\w*$/,$e=/^[-+]0x[0-9a-f]+$/i,Ge=/^0b[01]+$/i,Ye=/^\[object .+?Constructor\]$/,Je=/^0o[0-7]+$/i,Ze=/^(?:0|[1-9]\d*)$/,Qe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Xe=/($^)/,et=/['\n\r\u2028\u2029\\]/g,tt="\\ud800-\\udfff",nt="\\u0300-\\u036f",rt="\\ufe20-\\ufe2f",it="\\u20d0-\\u20ff",ot="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",st="\\u2700-\\u27bf",at="a-z\\xdf-\\xf6\\xf8-\\xff",ut="\\xac\\xb1\\xd7\\xf7",lt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ct="\\u2000-\\u206f",ft=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ht="A-Z\\xc0-\\xd6\\xd8-\\xde",pt="\\ufe0e\\ufe0f",dt=ut+lt+"\\u2000-\\u206f"+ft,mt="['’]",gt="[\\ud800-\\udfff]",yt="["+dt+"]",bt="["+ot+"]",vt="\\d+",wt="[\\u2700-\\u27bf]",_t="["+at+"]",kt="[^"+tt+dt+vt+st+at+ht+"]",St="\\ud83c[\\udffb-\\udfff]",Et="(?:"+bt+"|"+St+")",xt="[^\\ud800-\\udfff]",Ct="(?:\\ud83c[\\udde6-\\uddff]){2}",At="[\\ud800-\\udbff][\\udc00-\\udfff]",It="["+ht+"]",Tt="\\u200d",jt="(?:"+_t+"|"+kt+")",Ot="(?:"+It+"|"+kt+")",Pt="(?:['’](?:d|ll|m|re|s|t|ve))?",Bt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Rt=Et+"?",Nt="[\\ufe0e\\ufe0f]?",Mt="(?:\\u200d(?:"+[xt,Ct,At].join("|")+")"+Nt+Rt+")*",Lt="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ft="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Dt=Nt+Rt+Mt,Ut="(?:"+[wt,Ct,At].join("|")+")"+Dt,zt="(?:"+[xt+bt+"?",bt,Ct,At,gt].join("|")+")",qt=RegExp("['’]","g"),Kt=RegExp(bt,"g"),Ht=RegExp(St+"(?="+St+")|"+zt+Dt,"g"),Vt=RegExp([It+"?"+_t+"+"+Pt+"(?="+[yt,It,"$"].join("|")+")",Ot+"+"+Bt+"(?="+[yt,It+jt,"$"].join("|")+")",It+"?"+jt+"+"+Pt,It+"+"+Bt,Ft,Lt,vt,Ut].join("|"),"g"),Wt=RegExp("["+Tt+tt+ot+pt+"]"),$t=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Gt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Yt=-1,Jt={};Jt[pe]=Jt[de]=Jt[me]=Jt[ge]=Jt[ye]=Jt[be]=Jt[ve]=Jt[we]=Jt[_e]=!0,Jt[K]=Jt[H]=Jt[fe]=Jt[W]=Jt[he]=Jt[$]=Jt[Y]=Jt[J]=Jt[Q]=Jt[X]=Jt[te]=Jt[ie]=Jt[oe]=Jt[se]=Jt[le]=!1;var Zt={};Zt[K]=Zt[H]=Zt[fe]=Zt[he]=Zt[W]=Zt[$]=Zt[pe]=Zt[de]=Zt[me]=Zt[ge]=Zt[ye]=Zt[Q]=Zt[X]=Zt[te]=Zt[ie]=Zt[oe]=Zt[se]=Zt[ae]=Zt[be]=Zt[ve]=Zt[we]=Zt[_e]=!0,Zt[Y]=Zt[J]=Zt[le]=!1;var Qt={"À":"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"},Xt={"&":"&","<":"<",">":">",'"':""","'":"'"},en={"&":"&","<":"<",">":">",""":'"',"'":"'"},tn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},nn=parseFloat,rn=parseInt,on="object"==typeof e&&e&&e.Object===Object&&e,sn="object"==typeof self&&self&&self.Object===Object&&self,an=on||sn||Function("return this")(),un=t&&!t.nodeType&&t,ln=un&&"object"==typeof r&&r&&!r.nodeType&&r,cn=ln&&ln.exports===un,fn=cn&&on.process,hn=function(){try{var e=ln&&ln.require&&ln.require("util").types;return e||fn&&fn.binding&&fn.binding("util")}catch(e){}}(),pn=hn&&hn.isArrayBuffer,dn=hn&&hn.isDate,mn=hn&&hn.isMap,gn=hn&&hn.isRegExp,yn=hn&&hn.isSet,bn=hn&&hn.isTypedArray;function vn(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function wn(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Cn(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qn(e,t){for(var n=e.length;n--&&Ln(t,e[n],0)>-1;);return n}function Xn(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var er=qn(Qt),tr=qn(Xt);function nr(e){return"\\"+tn[e]}function rr(e,t){return null==e?o:e[t]}function ir(e){return Wt.test(e)}function or(e){return $t.test(e)}function sr(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function ar(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function ur(e,t){return function(n){return e(t(n))}}function lr(e,t){for(var n=-1,r=e.length,i=0,o=[];++n-1}function Ur(e,t){var n=this.__data__,r=ui(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function zr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function mi(e,t,n,r,i,s){var a,u=t&p,l=t&d,c=t&m;if(n&&(a=i?n(e,r,i,s):n(e)),a!==o)return a;if(!kc(e))return e;var f=sc(e);if(f){if(a=Xs(e),!u)return ns(e,a)}else{var h=Ys(e),g=h==J||h==Z;if(fc(e))return Wo(e,u);if(h==te||h==K||g&&!i){if(a=l||g?{}:ea(e),!u)return l?os(e,fi(a,e)):is(e,ci(a,e))}else{if(!Zt[h])return i?e:{};a=ta(e,h,u)}}s||(s=new Jr);var y=s.get(e);if(y)return y;if(s.set(e,a),Nc(e))return e.forEach(function(r){a.add(mi(r,t,n,r,e,s))}),a;if(Ec(e))return e.forEach(function(r,i){a.set(i,mi(r,t,n,i,e,s))}),a;var b=c?l?Fs:Ls:l?kf:_f,v=f?o:b(e);return _n(v||e,function(r,i){v&&(i=r,r=e[i]),ai(a,i,mi(r,t,n,i,e,s))}),a}function gi(e){var t=_f(e);return function(n){return yi(n,e,t)}}function yi(e,t,n){var r=n.length;if(null==e)return!r;for(e=tt(e);r--;){var i=n[r],s=t[i],a=e[i];if(a===o&&!(i in e)||!s(a))return!1}return!0}function bi(e,t,n){if("function"!=typeof e)throw new it(l);return Sa(function(){e.apply(o,n)},t)}function vi(e,t,n,r){var i=-1,o=xn,s=!0,u=e.length,l=[],c=t.length;if(!u)return l;n&&(t=An(t,Gn(n))),r?(o=Cn,s=!1):t.length>=a&&(o=Jn,s=!1,t=new $r(t));e:for(;++ii?0:i+n),r=r===o||r>i?i:Wc(r),r<0&&(r+=i),r=n>r?0:$c(r);n0&&n(a)?t>1?Ci(a,t-1,n,r,i):In(i,a):r||(i[i.length]=a)}return i}var Ai=ls(),Ii=ls(!0);function Ti(e,t){return e&&Ai(e,t,_f)}function ji(e,t){return e&&Ii(e,t,_f)}function Oi(e,t){return En(t,function(t){return vc(e[t])})}function Pi(e,t){t=qo(t,e);for(var n=0,r=t.length;null!=e&&nt}function Mi(e,t){return null!=e&&ct.call(e,t)}function Li(e,t){return null!=e&&t in tt(e)}function Fi(e,t,n){return e>=zt(t,n)&&e=120&&h.length>=120)?new $r(u&&h):o}h=e[0];var p=-1,d=l[0];e:for(;++p-1;)a!==e&&xt.call(a,u,1),xt.call(e,u,1);return e}function mo(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;ia(i)?xt.call(e,i,1):Ro(e,i)}}return e}function go(e,t){return e+Rt(Wt()*(t-e+1))}function yo(e,t,r,i){for(var o=-1,s=Ut(Bt((t-e)/(r||1)),0),a=n(s);s--;)a[i?s:++o]=e,e+=r;return a}function bo(e,t){var n="";if(!e||t<1||t>M)return n;do{t%2&&(n+=e),t=Rt(t/2),t&&(e+=e)}while(t);return n}function vo(e,t){return Ea(ba(e,t,Th),e+"")}function wo(e){return ri(Uf(e))}function _o(e,t){var n=Uf(e);return Aa(n,di(t,0,n.length))}function ko(e,t,n,r){if(!kc(e))return e;t=qo(t,e);for(var i=-1,s=t.length,a=s-1,u=e;null!=u&&++io?0:o+t),r=r>o?o:r,r<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var s=n(o);++i>>1,s=e[o];null!==s&&!Lc(s)&&(n?s<=t:s=a){var c=t?null:As(e);if(c)return cr(c);s=!1,i=Jn,l=new $r}else l=t?[]:u;e:for(;++r=r?e:Co(e,t,n)}var Vo=jt||function(e){return an.clearTimeout(e)};function Wo(e,t){if(t)return e.slice();var n=e.length,r=_t?_t(n):new e.constructor(n);return e.copy(r),r}function $o(e){var t=new e.constructor(e.byteLength);return new wt(t).set(new wt(e)),t}function Go(e,t){var n=t?$o(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Yo(e){var t=new e.constructor(e.source,We.exec(e));return t.lastIndex=e.lastIndex,t}function Jo(e){return yr?tt(yr.call(e)):{}}function Zo(e,t){var n=t?$o(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Qo(e,t){if(e!==t){var n=e!==o,r=null===e,i=e==e,s=Lc(e),a=t!==o,u=null===t,l=t==t,c=Lc(t);if(!u&&!c&&!s&&e>t||s&&a&&l&&!u&&!c||r&&a&&l||!n&&l||!i)return 1;if(!r&&!s&&!c&&e=a)return u;var l=n[r];return u*("desc"==l?-1:1)}}return e.index-t.index}function es(e,t,r,i){for(var o=-1,s=e.length,a=r.length,u=-1,l=t.length,c=Ut(s-a,0),f=n(l+c),h=!i;++u1?n[i-1]:o,a=i>2?n[2]:o;for(s=e.length>3&&"function"==typeof s?(i--,s):o,a&&oa(n[0],n[1],a)&&(s=i<3?o:s,i=1),t=tt(t);++r-1?i[s?t[a]:a]:o}}function gs(e){return Ms(function(t){var n=t.length,r=n,i=Er.prototype.thru;for(e&&t.reverse();r--;){var s=t[r];if("function"!=typeof s)throw new it(l);if(i&&!a&&"wrapper"==Us(s))var a=new Er([],!0)}for(r=a?r:n;++r1&&b.reverse(),h&&cu))return!1;var c=s.get(e);if(c&&s.get(t))return c==t;var f=-1,h=!0,p=n&y?new $r:o;for(s.set(e,t),s.set(t,e);++f1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(Ue,"{\n/* [wrapped with "+t+"] */\n")}function ra(e){return sc(e)||oc(e)||!!(Ct&&e&&e[Ct])}function ia(e,t){var n=typeof e;return t=null==t?M:t,!!t&&("number"==n||"symbol"!=n&&Ze.test(e))&&e>-1&&e%1==0&&e0){if(++t>=j)return arguments[0]}else t=0;return e.apply(o,arguments)}}function Aa(e,t){var n=-1,r=e.length,i=r-1;for(t=t===o?r:t;++n1?e[t-1]:o;return n="function"==typeof n?(e.pop(),n):o,Ru(e,n)});function Ku(e){var t=wr(e);return t.__chain__=!0,t}function Hu(e,t){return t(e),e}function Vu(e,t){return t(e)}var Wu=Ms(function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,i=function(t){return pi(t,e)};return!(t>1||this.__actions__.length)&&r instanceof xr&&ia(n)?(r=r.slice(n,+n+(t?1:0)),r.__actions__.push({func:Vu,args:[i],thisArg:o}),new Er(r,this.__chain__).thru(function(e){return t&&!e.length&&e.push(o),e})):this.thru(i)});function $u(){return Ku(this)}function Gu(){return new Er(this.value(),this.__chain__)}function Yu(){this.__values__===o&&(this.__values__=Hc(this.value()));var e=this.__index__>=this.__values__.length,t=e?o:this.__values__[this.__index__++];return{done:e,value:t}}function Ju(){return this}function Zu(e){for(var t,n=this;n instanceof Sr;){var r=Pa(n);r.__index__=0,r.__values__=o,t?i.__wrapped__=r:t=r;var i=r;n=n.__wrapped__}return i.__wrapped__=e,t}function Qu(){var e=this.__wrapped__;if(e instanceof xr){var t=e;return this.__actions__.length&&(t=new xr(this)),t=t.reverse(),t.__actions__.push({func:Vu,args:[hu],thisArg:o}),new Er(t,this.__chain__)}return this.thru(hu)}function Xu(){return Lo(this.__wrapped__,this.__actions__)}var el=ss(function(e,t,n){ct.call(e,n)?++e[n]:hi(e,n,1)});function tl(e,t,n){var r=sc(e)?Sn:ki;return n&&oa(e,t,n)&&(t=o),r(e,qs(t,3))}function nl(e,t){var n=sc(e)?En:xi;return n(e,qs(t,3))}var rl=ms(Ha),il=ms(Va);function ol(e,t){return Ci(dl(e,t),1)}function sl(e,t){return Ci(dl(e,t),N)}function al(e,t,n){return n=n===o?1:Wc(n),Ci(dl(e,t),n)}function ul(e,t){var n=sc(e)?_n:wi;return n(e,qs(t,3))}function ll(e,t){var n=sc(e)?kn:_i;return n(e,qs(t,3))}var cl=ss(function(e,t,n){ct.call(e,n)?e[n].push(t):hi(e,n,[t])});function fl(e,t,n,r){e=uc(e)?e:Uf(e),n=n&&!r?Wc(n):0;var i=e.length;return n<0&&(n=Ut(i+n,0)),Mc(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Ln(e,t,n)>-1}var hl=vo(function(e,t,r){var i=-1,o="function"==typeof t,s=uc(e)?n(e.length):[];return wi(e,function(e){s[++i]=o?vn(t,e,r):zi(e,t,r)}),s}),pl=ss(function(e,t,n){hi(e,n,t)});function dl(e,t){var n=sc(e)?An:ro;return n(e,qs(t,3))}function ml(e,t,n,r){return null==e?[]:(sc(t)||(t=null==t?[]:[t]),n=r?o:n,sc(n)||(n=null==n?[]:[n]),lo(e,t,n))}var gl=ss(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function yl(e,t,n){var r=sc(e)?Tn:Kn,i=arguments.length<3;return r(e,qs(t,4),n,i,wi)}function bl(e,t,n){var r=sc(e)?jn:Kn,i=arguments.length<3;return r(e,qs(t,4),n,i,_i)}function vl(e,t){var n=sc(e)?En:xi;return n(e,Dl(qs(t,3)))}function wl(e){var t=sc(e)?ri:wo;return t(e)}function _l(e,t,n){t=(n?oa(e,t,n):t===o)?1:Wc(t);var r=sc(e)?ii:_o;return r(e,t)}function kl(e){var t=sc(e)?oi:xo;return t(e)}function Sl(e){if(null==e)return 0;if(uc(e))return Mc(e)?dr(e):e.length;var t=Ys(e);return t==Q||t==oe?e.size:eo(e).length}function El(e,t,n){var r=sc(e)?On:Ao;return n&&oa(e,t,n)&&(t=o),r(e,qs(t,3))}var xl=vo(function(e,t){if(null==e)return[];var n=t.length;return n>1&&oa(e,t[0],t[1])?t=[]:n>2&&oa(t[0],t[1],t[2])&&(t=[t[0]]),lo(e,Ci(t,1),[])}),Cl=Ot||function(){return an.Date.now()};function Al(e,t){if("function"!=typeof t)throw new it(l);return e=Wc(e),function(){if(--e<1)return t.apply(this,arguments)}}function Il(e,t,n){return t=n?o:t,t=e&&null==t?e.length:t,Ts(e,x,o,o,o,o,t)}function Tl(e,t){var n;if("function"!=typeof t)throw new it(l);return e=Wc(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=o),n}}var jl=vo(function(e,t,n){var r=b;if(n.length){var i=lr(n,zs(jl));r|=S}return Ts(e,r,t,n,i)}),Ol=vo(function(e,t,n){var r=b|v;if(n.length){var i=lr(n,zs(Ol));r|=S}return Ts(t,r,e,n,i)});function Pl(e,t,n){t=n?o:t;var r=Ts(e,_,o,o,o,o,o,t);return r.placeholder=Pl.placeholder,r}function Bl(e,t,n){t=n?o:t;var r=Ts(e,k,o,o,o,o,o,t);return r.placeholder=Bl.placeholder,r}function Rl(e,t,n){var r,i,s,a,u,c,f=0,h=!1,p=!1,d=!0;if("function"!=typeof e)throw new it(l);function m(t){var n=r,s=i;return r=i=o,f=t,a=e.apply(s,n),a}function g(e){return f=e,u=Sa(v,t),h?m(e):a}function y(e){var n=e-c,r=e-f,i=t-n;return p?zt(i,s-r):i}function b(e){var n=e-c,r=e-f;return c===o||n>=t||n<0||p&&r>=s}function v(){var e=Cl();if(b(e))return w(e);u=Sa(v,y(e))}function w(e){return u=o,d&&r?m(e):(r=i=o,a)}function _(){u!==o&&Vo(u),f=0,r=c=i=u=o}function k(){return u===o?a:w(Cl())}function S(){var e=Cl(),n=b(e);if(r=arguments,i=this,c=e,n){if(u===o)return g(c);if(p)return u=Sa(v,t),m(c)}return u===o&&(u=Sa(v,t)),a}return t=Gc(t)||0,kc(n)&&(h=!!n.leading,p="maxWait"in n,s=p?Ut(Gc(n.maxWait)||0,t):s,d="trailing"in n?!!n.trailing:d),S.cancel=_,S.flush=k,S}var Nl=vo(function(e,t){return bi(e,1,t)}),Ml=vo(function(e,t,n){return bi(e,Gc(t)||0,n)});function Ll(e){return Ts(e,A)}function Fl(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new it(l);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Fl.Cache||zr),n}function Dl(e){if("function"!=typeof e)throw new it(l);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function Ul(e){return Tl(2,e)}Fl.Cache=zr;var zl=Ko(function(e,t){t=1==t.length&&sc(t[0])?An(t[0],Gn(qs())):An(Ci(t,1),Gn(qs()));var n=t.length;return vo(function(r){for(var i=-1,o=zt(r.length,n);++i=t}),oc=qi(function(){return arguments}())?qi:function(e){return Sc(e)&&ct.call(e,"callee")&&!Et.call(e,"callee")},sc=n.isArray,ac=pn?Gn(pn):Ki;function uc(e){return null!=e&&_c(e.length)&&!vc(e)}function lc(e){return Sc(e)&&uc(e)}function cc(e){return!0===e||!1===e||Sc(e)&&Ri(e)==W}var fc=Mt||$h,hc=dn?Gn(dn):Hi;function pc(e){return Sc(e)&&1===e.nodeType&&!Pc(e)}function dc(e){if(null==e)return!0;if(uc(e)&&(sc(e)||"string"==typeof e||"function"==typeof e.splice||fc(e)||Fc(e)||oc(e)))return!e.length;var t=Ys(e);if(t==Q||t==oe)return!e.size;if(fa(e))return!eo(e).length;for(var n in e)if(ct.call(e,n))return!1;return!0}function mc(e,t){return Vi(e,t)}function gc(e,t,n){n="function"==typeof n?n:o;var r=n?n(e,t):o;return r===o?Vi(e,t,o,n):!!r}function yc(e){if(!Sc(e))return!1;var t=Ri(e);return t==Y||t==G||"string"==typeof e.message&&"string"==typeof e.name&&!Pc(e)}function bc(e){return"number"==typeof e&&Lt(e)}function vc(e){if(!kc(e))return!1;var t=Ri(e);return t==J||t==Z||t==V||t==re}function wc(e){return"number"==typeof e&&e==Wc(e)}function _c(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=M}function kc(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Sc(e){return null!=e&&"object"==typeof e}var Ec=mn?Gn(mn):$i;function xc(e,t){return e===t||Gi(e,t,Hs(t))}function Cc(e,t,n){return n="function"==typeof n?n:o,Gi(e,t,Hs(t),n)}function Ac(e){return Oc(e)&&e!=+e}function Ic(e){if(ca(e))throw new i(u);return Yi(e)}function Tc(e){return null===e}function jc(e){return null==e}function Oc(e){return"number"==typeof e||Sc(e)&&Ri(e)==X}function Pc(e){if(!Sc(e)||Ri(e)!=te)return!1;var t=kt(e);if(null===t)return!0;var n=ct.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&<.call(n)==mt}var Bc=gn?Gn(gn):Ji;function Rc(e){return wc(e)&&e>=-M&&e<=M}var Nc=yn?Gn(yn):Zi;function Mc(e){return"string"==typeof e||!sc(e)&&Sc(e)&&Ri(e)==se}function Lc(e){return"symbol"==typeof e||Sc(e)&&Ri(e)==ae}var Fc=bn?Gn(bn):Qi;function Dc(e){return e===o}function Uc(e){return Sc(e)&&Ys(e)==le}function zc(e){return Sc(e)&&Ri(e)==ce}var qc=Es(no),Kc=Es(function(e,t){return e<=t});function Hc(e){if(!e)return[];if(uc(e))return Mc(e)?mr(e):ns(e);if(At&&e[At])return sr(e[At]());var t=Ys(e),n=t==Q?ar:t==oe?cr:Uf;return n(e)}function Vc(e){if(!e)return 0===e?e:0;if(e=Gc(e),e===N||e===-N){var t=e<0?-1:1;return t*L}return e==e?e:0}function Wc(e){var t=Vc(e),n=t%1;return t==t?n?t-n:t:0}function $c(e){return e?di(Wc(e),0,D):0}function Gc(e){if("number"==typeof e)return e;if(Lc(e))return F;if(kc(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=kc(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Le,"");var n=Ge.test(e);return n||Je.test(e)?rn(e.slice(2),n?2:8):$e.test(e)?F:+e}function Yc(e){return rs(e,kf(e))}function Jc(e){return e?di(Wc(e),-M,M):0===e?e:0}function Zc(e){return null==e?"":Po(e)}var Qc=as(function(e,t){if(fa(t)||uc(t))rs(t,_f(t),e);else for(var n in t)ct.call(t,n)&&ai(e,n,t[n])}),Xc=as(function(e,t){rs(t,kf(t),e)}),ef=as(function(e,t,n,r){rs(t,kf(t),e,r)}),tf=as(function(e,t,n,r){rs(t,_f(t),e,r)}),nf=Ms(pi);function rf(e,t){var n=kr(e);return null==t?n:ci(n,t)}var of=vo(function(e,t){e=tt(e);var n=-1,r=t.length,i=r>2?t[2]:o;for(i&&oa(t[0],t[1],i)&&(r=1);++n1),t}),rs(e,Fs(e),n),r&&(n=mi(n,p|d|m,Ps));for(var i=t.length;i--;)Ro(n,t[i]);return n});function If(e,t){return jf(e,Dl(qs(t)))}var Tf=Ms(function(e,t){return null==e?{}:co(e,t)});function jf(e,t){if(null==e)return{};var n=An(Fs(e),function(e){return[e]});return t=qs(t),fo(e,n,function(e,n){return t(e,n[0])})}function Of(e,t,n){t=qo(t,e);var r=-1,i=t.length;for(i||(i=1,e=o);++rt){var r=e;e=t,t=r}if(n||e%1||t%1){var i=Wt();return zt(e+i*(t-e+nn("1e-"+((i+"").length-1))),t)}return go(e,t)}var Vf=hs(function(e,t,n){return t=t.toLowerCase(),e+(n?Wf(t):t)});function Wf(e){return vh(Zc(e).toLowerCase())}function $f(e){return e=Zc(e),e&&e.replace(Qe,er).replace(Kt,"")}function Gf(e,t,n){e=Zc(e),t=Po(t);var r=e.length;n=n===o?r:di(Wc(n),0,r);var i=n;return n-=t.length,n>=0&&e.slice(n,i)==t}function Yf(e){return e=Zc(e),e&&Ie.test(e)?e.replace(Ce,tr):e}function Jf(e){return e=Zc(e),e&&Me.test(e)?e.replace(Ne,"\\$&"):e}var Zf=hs(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Qf=hs(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Xf=fs("toLowerCase");function eh(e,t,n){e=Zc(e),t=Wc(t);var r=t?dr(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return _s(Rt(i),n)+e+_s(Bt(i),n)}function th(e,t,n){e=Zc(e),t=Wc(t);var r=t?dr(e):0;return t&&r>>0,n?(e=Zc(e),e&&("string"==typeof t||null!=t&&!Bc(t))&&(t=Po(t),!t&&ir(e))?Ho(mr(e),0,n):e.split(t,n)):[]}var uh=hs(function(e,t,n){return e+(n?" ":"")+vh(t)});function lh(e,t,n){return e=Zc(e),n=null==n?0:di(Wc(n),0,e.length),t=Po(t),e.slice(n,n+t.length)==t}function ch(e,t,n){var r=wr.templateSettings;n&&oa(e,t,n)&&(t=o),e=Zc(e),t=ef({},t,r,js);var i=ef({},t.imports,r.imports,js),s=_f(i),a=Yn(i,s),u,l,c=0,f=t.interpolate||Xe,h="__p += '",p=nt((t.escape||Xe).source+"|"+f.source+"|"+(f===Oe?Ve:Xe).source+"|"+(t.evaluate||Xe).source+"|$","g"),d="//# sourceURL="+("sourceURL"in t?t.sourceURL:"lodash.templateSources["+ ++Yt+"]")+"\n";e.replace(p,function(t,n,r,i,o,s){return r||(r=i),h+=e.slice(c,s).replace(et,nr),n&&(u=!0,h+="' +\n__e("+n+") +\n'"),o&&(l=!0,h+="';\n"+o+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),c=s+t.length,t}),h+="';\n";var m=t.variable;m||(h="with (obj) {\n"+h+"\n}\n"),h=(l?h.replace(ke,""):h).replace(Se,"$1").replace(Ee,"$1;"),h="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(u?", __e = _.escape":"")+(l?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var g=_h(function(){return R(s,d+"return "+h).apply(o,a)});if(g.source=h,yc(g))throw g;return g}function fh(e){return Zc(e).toLowerCase()}function hh(e){return Zc(e).toUpperCase()}function ph(e,t,n){if(e=Zc(e),e&&(n||t===o))return e.replace(Le,"");if(!e||!(t=Po(t)))return e;var r=mr(e),i=mr(t),s=Zn(r,i),a=Qn(r,i)+1;return Ho(r,s,a).join("")}function dh(e,t,n){if(e=Zc(e),e&&(n||t===o))return e.replace(De,"");if(!e||!(t=Po(t)))return e;var r=mr(e),i=Qn(r,mr(t))+1;return Ho(r,0,i).join("")}function mh(e,t,n){if(e=Zc(e),e&&(n||t===o))return e.replace(Fe,"");if(!e||!(t=Po(t)))return e;var r=mr(e),i=Zn(r,mr(t));return Ho(r,i).join("")}function gh(e,t){var n=I,r=T;if(kc(t)){var i="separator"in t?t.separator:i;n="length"in t?Wc(t.length):n,r="omission"in t?Po(t.omission):r}e=Zc(e);var s=e.length;if(ir(e)){var a=mr(e);s=a.length}if(n>=s)return e;var u=n-dr(r);if(u<1)return r;var l=a?Ho(a,0,u).join(""):e.slice(0,u);if(i===o)return l+r;if(a&&(u+=l.length-u),Bc(i)){if(e.slice(u).search(i)){var c,f=l;for(i.global||(i=nt(i.source,Zc(We.exec(i))+"g")),i.lastIndex=0;c=i.exec(f);)var h=c.index;l=l.slice(0,h===o?u:h)}}else if(e.indexOf(Po(i),u)!=u){var p=l.lastIndexOf(i);p>-1&&(l=l.slice(0,p))}return l+r}function yh(e){return e=Zc(e),e&&Ae.test(e)?e.replace(xe,gr):e}var bh=hs(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),vh=fs("toUpperCase");function wh(e,t,n){return e=Zc(e),t=n?o:t,t===o?or(e)?vr(e):Rn(e):e.match(t)||[]}var _h=vo(function(e,t){try{return vn(e,o,t)}catch(e){return yc(e)?e:new i(e)}}),kh=Ms(function(e,t){return _n(t,function(t){t=Ta(t),hi(e,t,jl(e[t],e))}),e});function Sh(e){var t=null==e?0:e.length,n=qs();return e=t?An(e,function(e){if("function"!=typeof e[1])throw new it(l);return[n(e[0]),e[1]]}):[],vo(function(n){for(var r=-1;++rM)return[];var n=D,r=zt(e,D);t=qs(t),e-=D;for(var i=Wn(r,t);++n0||t<0)?new xr(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==o&&(t=Wc(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},xr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},xr.prototype.toArray=function(){return this.take(D)},Ti(xr.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),i=wr[r?"take"+("last"==t?"Right":""):t],s=r||/^find/.test(t);i&&(wr.prototype[t]=function(){var t=this.__wrapped__,a=r?[1]:arguments,u=t instanceof xr,l=a[0],c=u||sc(t),f=function(e){var t=i.apply(wr,In([e],a));return r&&h?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(u=c=!1);var h=this.__chain__,p=!!this.__actions__.length,d=s&&!h,m=u&&!p;if(!s&&c){t=m?t:new xr(this);var g=e.apply(t,a);return g.__actions__.push({func:Vu,args:[f],thisArg:o}),new Er(g,h)}return d&&m?e.apply(this,a):(g=this.thru(f),d?r?g.value()[0]:g.value():g)})}),_n(["pop","push","shift","sort","splice","unshift"],function(e){var t=ot[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);wr.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(sc(i)?i:[],e)}return this[n](function(n){return t.apply(sc(n)?n:[],e)})}}),Ti(xr.prototype,function(e,t){var n=wr[t];if(n){var r=n.name+"",i=ln[r]||(ln[r]=[]);i.push({name:t,func:n})}}),ln[ys(o,v).name]=[{name:"wrapper",func:o}],xr.prototype.clone=Cr,xr.prototype.reverse=Ar,xr.prototype.value=Ir,wr.prototype.at=Wu,wr.prototype.chain=$u,wr.prototype.commit=Gu,wr.prototype.next=Yu,wr.prototype.plant=Zu,wr.prototype.reverse=Qu,wr.prototype.toJSON=wr.prototype.valueOf=wr.prototype.value=Xu,wr.prototype.first=wr.prototype.head,At&&(wr.prototype[At]=Ju),wr},_r=wr();an._=_r,i=function(){return _r}.call(t,n,t,r),i===o||(r.exports=i)}).call(this)}).call(this,n(8),n(75)(e))},function(e,t,n){"use strict";const r=n(485).extend(n(960)),i=r.object().keys({repo:r.alternatives().try(r.object(),r.string()).allow(null),repoOwner:r.boolean().default(!0),preload:r.object().keys({enabled:r.boolean().default(!0),addresses:r.array().items(r.multiaddr().options({convert:!1})),interval:r.number().integer().default(3e4)}).allow(null),init:r.alternatives().try(r.boolean(),r.object().keys({bits:r.number().integer()})).allow(null),start:r.boolean(),local:r.boolean(),pass:r.string().allow(""),relay:r.object().keys({enabled:r.boolean(),hop:r.object().keys({enabled:r.boolean(),active:r.boolean()}).allow(null)}).allow(null),EXPERIMENTAL:r.object().keys({pubsub:r.boolean(),ipnsPubsub:r.boolean(),sharding:r.boolean(),dht:r.boolean()}).allow(null),connectionManager:r.object().allow(null),config:r.object().keys({Addresses:r.object().keys({Swarm:r.array().items(r.multiaddr().options({convert:!1})),API:r.multiaddr().options({convert:!1}),Gateway:r.multiaddr().options({convert:!1})}).allow(null),Discovery:r.object().keys({MDNS:r.object().keys({Enabled:r.boolean(),Interval:r.number().integer()}).allow(null),webRTCStar:r.object().keys({Enabled:r.boolean()}).allow(null)}).allow(null),Bootstrap:r.array().items(r.multiaddr().IPFS().options({convert:!1}))}).allow(null),libp2p:r.alternatives().try(r.func(),r.object().keys({modules:r.object().allow(null)})).allow(null)}).options({allowUnknown:!0});e.exports.validate=(e=>r.attempt(e,i))},function(e,t,n){const r=n(24),i=n(92);e.exports={name:"multiaddr",language:{invalid:"{{message}}",fmt:"must be in {{fmt}} format"},pre(e,t,n){if(null==e)return this.createError("multiaddr.invalid",{v:e,message:"addr must be a string, Buffer, or another Multiaddr"},t,n);let i;try{i=r(e)}catch(r){return this.createError("multiaddr.invalid",{v:e,message:r.message},t,n)}return n.convert?i:e},rules:Object.keys(i).map(e=>({name:e,validate(t,n,r,o){return i[e].matches(n)?n:this.createError("multiaddr.fmt",{v:n,fmt:e},r,o)}}))}},function(e,t,n){"use strict";const r=n(11),i=n(225).errors;function o(e){return!!e&&(e.code===i.ERR_REPO_NOT_INITIALIZED||!!(e.message.match(/not found/)||e.message.match(/ENOENT/)||e.message.match(/No value/)))}e.exports=(e=>{e.log("booting");const t=e._options,n=t.init,i=t.start;r([t=>{if(!e._repo.closed)return t(null,!0);e._repo.open((e,n)=>o(e)?t(null,!1):e?t(e):void t(null,!0))},(r,i)=>{if(r)return e.init({repo:e._repo},e=>{if(e)return i(Object.assign(e,{emitted:!0}));i()});if(n){const n=Object.assign({bits:2048,pass:e._options.pass},"object"==typeof t.init?t.init:{});return e.init(n,e=>{if(e)return i(Object.assign(e,{emitted:!0}));i()})}i()},t=>{if(!i)return t();e.start(e=>{if(e)return t(Object.assign(e,{emitted:!0}));t()})}],t=>{t?t.emitted||e.emit("error",t):(e.log("booted"),e.emit("ready"))})})},function(e,t,n){"use strict";t.preStart=n(963),t.start=n(978),t.stop=n(1179),t.isOnline=n(1180),t.version=n(1181),t.id=n(1182),t.repo=n(545),t.init=n(1183),t.bootstrap=n(1186),t.config=n(1187),t.block=n(1188),t.object=n(1189),t.dag=n(1190),t.libp2p=n(504),t.swarm=n(1194),t.ping=n(1197),t.pingPullStream=n(1198),t.pingReadableStream=n(1199),t.pin=n(1200),t.filesRegular=n(1207),t.filesMFS=n(1261),t.bitswap=n(570),t.pubsub=n(1309),t.dht=n(1310),t.dns=n(1313),t.key=n(1315),t.stats=n(1316),t.resolve=n(1317),t.name=n(1319)},function(e,t,n){"use strict";const r=n(23),i=n(44),o=n(24),s=n(11),a=n(486),u=n(182),l=n(977);e.exports=function e(t){return e=>{t.log("pre-start");const n=t._options.pass;s([e=>t._repo.config.get(e),(e,n)=>{if(!t._options.config)return n(null,e);e=u(t._options.config,e),t.config.replace(e,t=>{if(t)return n(t);n(null,e)})},(e,n)=>{if(e.Keychain)return n(null,e);e.Keychain=a.generateOptions(),t.config.set("Keychain",e.Keychain,r=>{t.log("using default keychain options"),n(r,e)})},(e,r)=>{if(t._keychain);else if(n){const r=Object.assign({passPhrase:n},e.Keychain);t._keychain=new a(t._repo.keys,r),t.log("keychain constructed")}else t._keychain=new l,t.log("no keychain, use --pass");r(null,e)},(e,t)=>{const n=e.Identity.PrivKey;r.createFromPrivKey(n,(n,r)=>{t(n,e,r)})},(e,r,i)=>{if(!n)return i(null,e,r);t._keychain.findKeyByName("self",n=>{if(n)return t.log('Creating "self" key'),t._keychain.importPeer("self",r,t=>i(t,e,r));i(null,e,r)})},(e,n,r)=>{t.log("peer created"),t._peerInfo=new i(n),e.Addresses&&e.Addresses.Swarm&&e.Addresses.Swarm.forEach(e=>{let n=o(e);n.getPeerId()&&(n=n.encapsulate("/ipfs/"+t._peerInfo.id.toB58String())),t._peerInfo.multiaddrs.add(n)}),r()},e=>t.pin._load(e)],e)}}},function(e,t,n){"use strict";const r=n(965),i=n(439),o=n(64),s=n(33),a=n(37),u=n(12),l=n(969),c="/pkcs8/",f="/info/",h={minKeyLength:14,minSaltLength:16,minIterationCount:1e3},p={dek:{keyLength:64,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function d(e){return!!e&&("string"==typeof e&&e===r(e.trim()))}function m(e,t){const n=200,r=1e3,i=800*Math.random()+200;"string"==typeof t&&(t=new Error(t)),setTimeout(e,i,t,null)}function g(e){return new s.Key(c+e)}function y(e){return new s.Key(f+e)}class b{constructor(e,t){if(!e)throw new Error("store is required");this.store=e;const n=i(p,t);if(!n.passPhrase||n.passPhrase.length<20)throw new Error("passPhrase must be least 20 characters");if(n.dek.keyLengthr})}get cms(){return new l(this)}static generateOptions(){const e=Object.assign({},p),t=3*Math.ceil(h.minSaltLength/3);return e.dek.salt=o.randomBytes(t).toString("base64"),e}static get options(){return p}createKey(e,t,n,r){const i=this;if(!d(e)||"self"===e)return m(r,`Invalid key name '${e}'`);if("string"!=typeof t)return m(r,`Invalid key type '${t}'`);if(!Number.isSafeInteger(n))return m(r,`Invalid key size '${n}'`);const s=g(e);i.store.has(s,(a,u)=>{if(a)return m(r,a);if(u)return m(r,`Key '${e}' already exists`);switch(t.toLowerCase()){case"rsa":if(n<2048)return m(r,`Invalid RSA key size ${n}`)}o.keys.generateKeyPair(t,n,(t,n)=>{if(t)return m(r,t);n.id((t,o)=>{if(t)return m(r,t);n.export(this._(),(t,n)=>{if(t)return m(r,t);const a={name:e,id:o},u=i.store.batch();u.put(s,n),u.put(y(e),JSON.stringify(a)),u.commit(e=>{if(e)return m(r,e);r(null,a)})})})})})}listKeys(e){const t=this,n={prefix:f};u(this.store.query(n),a((t,n)=>{if(t)return m(e,t);const r=n.map(e=>JSON.parse(e.value));e(null,r)}))}findKeyById(e,t){this.listKeys((n,r)=>{if(n)return m(t,n);const i=r.find(t=>t.id===e);t(null,i)})}findKeyByName(e,t){if(!d(e))return m(t,`Invalid key name '${e}'`);const n=y(e);this.store.get(n,(n,r)=>{if(n)return m(t,`Key '${e}' does not exist. ${n.message}`);t(null,JSON.parse(r.toString()))})}removeKey(e,t){const n=this;if(!d(e)||"self"===e)return m(t,`Invalid key name '${e}'`);const r=g(e);n.findKeyByName(e,(i,o)=>{if(i)return m(t,i);const s=n.store.batch();s.delete(r),s.delete(y(e)),s.commit(e=>{if(e)return m(t,e);t(null,o)})})}renameKey(e,t,n){const r=this;if(!d(e)||"self"===e)return m(n,`Invalid old key name '${e}'`);if(!d(t)||"self"===t)return m(n,`Invalid new key name '${t}'`);const i=g(e),o=g(t),s=y(e),a=y(t);this.store.get(i,(u,l)=>{if(u)return m(n,`Key '${e}' does not exist. ${u.message}`);const c=l.toString();r.store.has(o,(e,u)=>e?m(n,e):u?m(n,`Key '${t}' already exists`):void r.store.get(s,(e,u)=>{if(e)return m(n,e);const l=JSON.parse(u.toString());l.name=t;const f=r.store.batch();f.put(o,c),f.put(a,JSON.stringify(l)),f.delete(i),f.delete(s),f.commit(e=>{if(e)return m(n,e);n(null,l)})}))})}exportKey(e,t,n){if(!d(e))return m(n,`Invalid key name '${e}'`);if(!t)return m(n,"Password is required");const r=g(e);this.store.get(r,(r,i)=>{if(r)return m(n,`Key '${e}' does not exist. ${r.message}`);const s=i.toString();o.keys.import(s,this._(),(e,r)=>{if(e)return m(n,e);r.export(t,n)})})}importKey(e,t,n,r){const i=this;if(!d(e)||"self"===e)return m(r,`Invalid key name '${e}'`);if(!t)return m(r,"PEM encoded key is required");const s=g(e);i.store.has(s,(a,u)=>a?m(r,a):u?m(r,`Key '${e}' already exists`):void o.keys.import(t,n,(t,n)=>{if(t)return m(r,"Cannot read the key, most likely the password is wrong");n.id((t,o)=>{if(t)return m(r,t);n.export(this._(),(t,n)=>{if(t)return m(r,t);const a={name:e,id:o},u=i.store.batch();u.put(s,n),u.put(y(e),JSON.stringify(a)),u.commit(e=>{if(e)return m(r,e);r(null,a)})})})}))}importPeer(e,t,n){const r=this;if(!d(e))return m(n,`Invalid key name '${e}'`);if(!t||!t.privKey)return m(n,"Peer.privKey is required");const i=t.privKey,o=g(e);r.store.has(o,(t,s)=>t?m(n,t):s?m(n,`Key '${e}' already exists`):void i.id((t,s)=>{if(t)return m(n,t);i.export(this._(),(t,i)=>{if(t)return m(n,t);const a={name:e,id:s},u=r.store.batch();u.put(o,i),u.put(y(e),JSON.stringify(a)),u.commit(e=>{if(e)return m(n,e);n(null,a)})})}))}_getPrivateKey(e,t){if(!d(e))return m(t,`Invalid key name '${e}'`);this.store.get(g(e),(n,r)=>{if(n)return m(t,`Key '${e}' does not exist. ${n.message}`);t(null,r.toString())})}}e.exports=b},function(e,t,n){"use strict";var r=n(966),i=/[\/\?<>\\:\*\|":]/g,o=/[\x00-\x1f\x80-\x9f]/g,s=/^\.+$/,a=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,u=/[\. ]+$/;function l(e,t){var n=e.replace(i,t).replace(o,t).replace(s,t).replace(a,t).replace(u,t);return r(n,255)}e.exports=function(e,t){var n=t&&t.replacement||"",r=l(e,n);return""===n?r:l(r,"")}},function(e,t,n){"use strict";var r=n(967),i=n(968);e.exports=r.bind(null,i)},function(e,t,n){"use strict";function r(e){return e>=55296&&e<=56319}function i(e){return e>=56320&&e<=57343}e.exports=function e(t,n,o){if("string"!=typeof n)throw new Error("Input must be string");for(var s=n.length,a=0,u,l,c=0;co)return n.slice(0,c-l.length+1)}return n}},function(e,t,n){"use strict";function r(e){return e>=55296&&e<=56319}function i(e){return e>=56320&&e<=57343}e.exports=function e(t){if("string"!=typeof t)throw new Error("Input must be string");for(var n=t.length,o=0,s=null,a=null,u=0;u=128&&s<=2047?o+=2:s>=2048&&s<=65535&&(o+=3),a=s;return o}},function(e,t,n){"use strict";(function(t){const r=n(14),i=n(40),o=n(970),s=n(11);n(971),n(310);const a=n(19),u=n(976);class l{constructor(e){if(!e)throw new Error("keychain is required");this.keychain=e}encrypt(e,n,o){const s=this,l=(e,t)=>r(()=>o(e,t));if(!t.isBuffer(n))return l(new Error("Plain data must be a Buffer"));i([t=>s.keychain.findKeyByName(e,t),t=>s.keychain._getPrivateKey(e,t)],(e,r)=>{if(e)return l(e);let i=r[0],c=r[1];try{const r=a.pki.decryptRsaPrivateKey(c,s.keychain._());u.certificateForKey(i,r,(e,r)=>{if(e)return o(e);const i=a.pkcs7.createEnvelopedData();i.addRecipient(r),i.content=a.util.createBuffer(n),i.encrypt();const s=a.asn1.toDer(i.toAsn1()).getBytes();l(null,t.from(s,"binary"))})}catch(e){l(e)}})}decrypt(e,n){const i=(e,t)=>r(()=>n(e,t));if(!t.isBuffer(e))return i(new Error("CMS data is required"));const u=this;let l;try{const t=a.util.createBuffer(e.toString("binary")),n=a.asn1.fromDer(t);l=a.pkcs7.messageFromAsn1(n)}catch(e){return i(new Error("Invalid CMS: "+e.message))}const c=l.recipients.filter(e=>e.issuer.find(e=>"O"===e.shortName&&"ipfs"===e.value)).filter(e=>e.issuer.find(e=>"CN"===e.shortName)).map(e=>({recipient:e,keyId:e.issuer.find(e=>"CN"===e.shortName).value}));o(c,(e,t)=>u.keychain.findKeyById(e.keyId,(e,n)=>t(null,!e&&n)),(e,n)=>{if(e)return i(e);if(!n){const t=c.map(e=>e.keyId);return e=new Error("Decryption needs one of the key(s): "+t.join(", ")),e.missingKeys=t,i(e)}s([e=>u.keychain.findKeyById(n.keyId,e),(e,t)=>u.keychain._getPrivateKey(e.name,t)],(e,r)=>{if(e)return i(e);const o=a.pki.decryptRsaPrivateKey(r,u.keychain._());l.decrypt(n.recipient,o),i(null,t.from(l.content.getBytes(),"binary"))})})}}e.exports=l}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(240),i=f(r),o=n(241),s=f(o),a=n(175),u=f(a),l=n(487),c=f(l);function f(e){return e&&e.__esModule?e:{default:e}}t.default=(0,u.default)((0,s.default)(i.default,c.default)),e.exports=t.default},function(e,t,n){var r=n(19);n(237),n(140),n(311),n(179),n(312),n(972),n(141),n(34),n(488);var i=r.asn1,o=e.exports=r.pkcs7=r.pkcs7||{};function s(e){var t={},n=[];if(!i.validate(e,o.asn1.recipientInfoValidator,t,n)){var s=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw s.errors=n,s}return{version:t.version.charCodeAt(0),issuer:r.pki.RDNAttributesAsArray(t.issuer),serialNumber:r.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:i.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function a(e){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[r.pki.distinguishedNameToAsn1({attributes:e.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,r.util.hexToBytes(e.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.encryptedContent.algorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function u(e){for(var t=[],n=0;n0){for(var n=i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[]),o=0;o=n&&s0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,t)),o.length>0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,o)),s.value[0].value.push(i.create(i.Class.UNIVERSAL,i.Type.SET,!0,e.signerInfos)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),s])},addSigner:function(t){var n=t.issuer,i=t.serialNumber;if(t.certificate){var o=t.certificate;"string"==typeof o&&(o=r.pki.certificateFromPem(o)),n=o.issuer.attributes,i=o.serialNumber}var s=t.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof s&&(s=r.pki.privateKeyFromPem(s));var a=t.digestAlgorithm||r.pki.oids.sha1;switch(a){case r.pki.oids.sha1:case r.pki.oids.sha256:case r.pki.oids.sha384:case r.pki.oids.sha512:case r.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+a)}var u=t.authenticatedAttributes||[];if(u.length>0){for(var l=!1,c=!1,f=0;f>8*f-c&255;return w=String.fromCharCode(w.charCodeAt(0)&~_)+w.substr(1),w+m+String.fromCharCode(188)},verify:function(e,o,a){var u,l=a-1,c=Math.ceil(l/8);if(o=o.substr(-c),c>8*c-l&255;if(0!=(h.charCodeAt(0)&d))throw new Error("Bits beyond keysize not zero as expected.");var m=n.generate(p,f),g="";for(u=0;u{const r=i.setRsaPublicKey(t.n,t.e),o=i.createCertificate();o.publicKey=r,o.serialNumber="01",o.validity.notBefore=new Date,o.validity.notAfter=new Date,o.validity.notAfter.setFullYear(o.validity.notBefore.getFullYear()+10);const s=[{name:"organizationName",value:"ipfs"},{shortName:"OU",value:"keystore"},{name:"commonName",value:e.id}];return o.setSubject(s),o.setIssuer(s),o.setExtensions([{name:"basicConstraints",cA:!0},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0,codeSigning:!0,emailProtection:!0,timeStamping:!0},{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0,sslCA:!0,emailCA:!0,objCA:!0}]),o.sign(t),n(null,o)})},function(e,t,n){"use strict";function r(){throw new Error("Key management requires '--pass ...' option")}class i{static get options(){r()}static generateOptions(){r()}createKey(){r()}listKeys(){r()}findKeyById(){r()}findKeyByName(){r()}renameKey(){r()}removeKey(){r()}exportKey(){r()}importKey(){r()}importPeer(){r()}get cms(){r()}}e.exports=i},function(e,t,n){"use strict";const r=n(40),i=n(979),o=n(244),s=n(14),a=n(3),{TieredDatastore:u}=n(417),l=n(497),c=n(499),f=n(500),h=n(504);e.exports=(e=>a(t=>{const n=n=>{if(n)return s(()=>e.emit("error",n)),t(n);e.state.started(),s(()=>e.emit("start")),t()};if("stopped"!==e.state.state())return n(new Error(`Not able to start from state: ${e.state.state()}`));e.log("starting"),e.state.start(),r([t=>{e._repo.closed?e._repo.open(t):t()},t=>{e._repo.config.get((n,r)=>{if(n)return t(n);const i=h(e,r);i.start(n=>{if(n)return t(n);e.libp2p=i,t()})})},t=>{const n=[];let r;if(o(e._options,"EXPERIMENTAL.ipnsPubsub",!1)){const t=e.libp2p.pubsub,i=e._repo.datastore,o=e._peerInfo.id;r=new c(t,i,o),n.push(r)}if(o(e._options,"EXPERIMENTAL.dht",!1)&&!e._options.local)n.push(e.libp2p.dht);else{const t=new f(e._repo);n.push(t)}const s=new u(n);e._ipns=new l(s,e._repo.datastore,e._peerInfo,e._keychain,e._options),e._bitswap=new i(e.libp2p,e._repo.blocks,{statsEnabled:!0}),e._bitswap.start(),e._blockService.setExchange(e._bitswap),e._preload.start(),e._ipns.republisher.start(),e._mfsPreload.start(t)}],n)}))},function(e,t,n){"use strict";const r=n(11),i=n(419),o=n(56),s=n(40),a=n(88),u=n(91),l=n(980),c=n(989),f=n(993),h=n(995),p=n(120).logger,d=n(996),m={statsEnabled:!1,statsComputeThrottleTimeout:1e3,statsComputeThrottleMaxQueueSize:1e3},g=["blocksReceived","dataReceived","dupBlksReceived","dupDataReceived","blocksSent","dataSent","providesBufferLength","wantListLength","peerCount"];class y{constructor(e,t,n){this._libp2p=e,this._log=p(this.peerInfo.id),this._options=Object.assign({},m,n),this._stats=new d(g,{enabled:this._options.statsEnabled,computeThrottleTimeout:this._options.statsComputeThrottleTimeout,computeThrottleMaxQueueSize:this._options.statsComputeThrottleMaxQueueSize}),this.network=new c(e,this,{},this._stats),this.blockstore=t,this.engine=new f(this.peerInfo.id,t,this.network,this._stats),this.wm=new l(this.peerInfo.id,this.network,this._stats),this.notifications=new h(this.peerInfo.id)}get peerInfo(){return this._libp2p.peerInfo}_receiveMessage(e,t,n){this.engine.messageReceived(e,t,r=>{if(r&&this._log("failed to receive message",t),0===t.blocks.size)return n();const i=Array.from(t.blocks.values()),s=i.filter(e=>this.wm.wantlist.contains(e.cid)).map(e=>e.cid);this.wm.cancelWants(s),o(i,(t,n)=>this._handleReceivedBlock(e,t,n),n)})}_handleReceivedBlock(e,t,n){this._log("received block"),r([e=>this.blockstore.has(t.cid,e),(n,r)=>{if(this._updateReceiveCounters(e.toB58String(),t,n),n)return u(r);this._putBlock(t,r)}],n)}_updateReceiveCounters(e,t,n){this._stats.push(e,"blocksReceived",1),this._stats.push(e,"dataReceived",t.data.length),n&&(this._stats.push(e,"dupBlksReceived",1),this._stats.push(e,"dupDataReceived",t.data.length))}_receiveError(e){this._log.error("ReceiveError: %s",e.message)}_onPeerConnected(e){this.wm.connected(e)}_onPeerDisconnected(e){this.wm.disconnected(e),this.engine.peerDisconnected(e),this._stats.disconnected(e)}_putBlock(e,t){this.blockstore.put(e,n=>{if(n)return t(n);this.notifications.hasBlock(e),this.network.provide(e.cid,e=>{e&&this._log.error("Failed to provide: %s",e.message)}),this.engine.receivedBlocks([e.cid]),t()})}enableStats(){this._stats.enable()}disableStats(){this._stats.disable()}wantlistForPeer(e){return this.engine.wantlistForPeer(e)}ledgerForPeer(e){return this.engine.ledgerForPeer(e)}get(e,t){this.getMany([e],(e,n)=>{if(e)return t(e);n&&n.length>0?t(null,n[0]):t()})}getMany(e,t){let n=e.length;const i=[];let o=!1;const s=(e,t)=>{i.push(e),this.notifications.wantBlock(e,n=>{this.wm.cancelWants([e]),t(null,n)},()=>{this.wm.cancelWants([e]),t(null,void 0)}),n||this.wm.wantBlocks(i)};a(e,(t,a)=>{r([e=>this.blockstore.has(t,e),(r,a)=>{if(n--,r)return n||this.wm.wantBlocks(i),this.blockstore.get(t,a);o||(o=!0,this.network.findAndConnect(e[0],e=>{e&&this._log.error(e)})),s(t,a)}],a)},t)}unwant(e){Array.isArray(e)||(e=[e]),this.wm.unwantBlocks(e),e.forEach(e=>this.notifications.unwantBlock(e))}cancelWants(e){Array.isArray(e)||(e=[e]),this.wm.cancelWants(e)}put(e,t){this._log("putting block"),r([t=>this.blockstore.has(e.cid,t),(t,n)=>{if(t)return u(n);this._putBlock(e,n)}],t)}putMany(e,t){r([t=>i(e,(e,t)=>{this.blockstore.has(e.cid,t)},t),(e,t)=>this.blockstore.putMany(e,n=>{if(n)return t(n);e.forEach(e=>{this.notifications.hasBlock(e),this.engine.receivedBlocks([e.cid]),this.network.provide(e.cid,e=>{e&&this._log.error("Failed to provide: %s",e.message)})}),t()})],t)}getWantlist(){return this.wm.wantlist.entries()}peers(){return this.engine.peers()}stat(){return this._stats}start(e){s([e=>this.wm.start(e),e=>this.network.start(e),e=>this.engine.start(e)],e)}stop(e){this._stats.stop(),s([e=>this.wm.stop(e),e=>this.network.stop(e),e=>this.engine.stop(e)],e)}}e.exports=y},function(e,t,n){"use strict";const r=n(91),i=n(242),o=n(243),s=n(321),a=n(988),u=n(120).logger;e.exports=class e{constructor(e,t,n){this.peers=new Map,this.wantlist=new o(n),this.network=t,this._stats=n,this._peerId=e,this._log=u(e,"want")}_addEntries(e,t,n){const r=e.map((e,n)=>new i.Entry(e,s.kMaxPriority-n,t));r.forEach(e=>{e.cancel?n?this.wantlist.removeForce(e.cid):this.wantlist.remove(e.cid):(this._log("adding to wl"),this.wantlist.add(e.cid,e.priority))});for(let e of this.peers.values())e.addEntries(r)}_startPeerHandler(e){let t=this.peers.get(e.toB58String());if(t)return void t.refcnt++;t=new a(this._peerId,e,this.network);const n=new i(!0);for(let e of this.wantlist.entries())n.addEntry(e[1].cid,e[1].priority);return t.addMessage(n),this.peers.set(e.toB58String(),t),t}_stopPeerHandler(e){const t=this.peers.get(e.toB58String());t&&(t.refcnt--,t.refcnt>0||this.peers.delete(e.toB58String()))}wantBlocks(e){this._addEntries(e,!1)}unwantBlocks(e){this._log("unwant blocks: %s",e.length),this._addEntries(e,!0,!0)}cancelWants(e){this._log("cancel wants: %s",e.length),this._addEntries(e,!0)}connectedPeers(){return Array.from(this.peers.keys())}connected(e){this._startPeerHandler(e)}disconnected(e){this._stopPeerHandler(e)}start(e){this.timer=setInterval(()=>{this._log("resend full-wantlist");const e=new i(!0);this.wantlist.forEach(t=>{e.addEntry(t.cid,t.priority)}),this.peers.forEach(t=>t.addMessage(e))},6e4),r(()=>e())}stop(e){this.peers.forEach(e=>this.disconnected(e.peerId)),clearInterval(this.timer),r(()=>e())}}},function(e,t,n){(function(e,n){var r=200,i="__lodash_hash_undefined__",o=1,s=2,a=9007199254740991,u="[object Arguments]",l="[object Array]",c="[object Boolean]",f="[object Date]",h="[object Error]",p="[object Function]",d="[object GeneratorFunction]",m="[object Map]",g="[object Number]",y="[object Object]",b="[object Promise]",v="[object RegExp]",w="[object Set]",_="[object String]",k="[object Symbol]",S="[object WeakMap]",E="[object ArrayBuffer]",x="[object DataView]",C="[object Float32Array]",A="[object Float64Array]",I="[object Int8Array]",T="[object Int16Array]",j="[object Int32Array]",O="[object Uint8Array]",P="[object Uint8ClampedArray]",B="[object Uint16Array]",R="[object Uint32Array]",N=/[\\^$.*+?()[\]{}|]/g,M=/^\[object .+?Constructor\]$/,L=/^(?:0|[1-9]\d*)$/,F={};F[C]=F[A]=F[I]=F[T]=F[j]=F[O]=F[P]=F[B]=F[R]=!0,F[u]=F[l]=F[E]=F[c]=F[x]=F[f]=F[h]=F[p]=F[m]=F[g]=F[y]=F[v]=F[w]=F[_]=F[S]=!1;var D="object"==typeof e&&e&&e.Object===Object&&e,U="object"==typeof self&&self&&self.Object===Object&&self,z=D||U||Function("return this")(),q=t&&!t.nodeType&&t,K=q&&"object"==typeof n&&n&&!n.nodeType&&n,H=K&&K.exports===q,V=H&&D.process,W=function(){try{return V&&V.binding("util")}catch(e){}}(),$=W&&W.isTypedArray;function G(e,t){for(var n=-1,r=e?e.length:0;++n-1}function ze(e,t){var n=this.__data__,r=it(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}function qe(e){var t=-1,n=e?e.length:0;for(this.clear();++tl))return!1;var f=a.get(e);if(f&&a.get(t))return f==t;var h=-1,p=!0,d=i&o?new Ge:void 0;for(a.set(e,t),a.set(t,e);++h-1&&e%1==0&&e-1&&e%1==0&&e<=a}function jt(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ot(e){return!!e&&"object"==typeof e}var Pt=$?J($):lt;function Bt(e){return xt(e)?rt(e):ct(e)}n.exports=At}).call(this,n(8),n(75)(e))},function(e,t,n){"use strict";const r=n(983),i={};e.exports=i;for(let e in r){let t=r[e];i[t.toString("hex")]=e}},function(e,t,n){"use strict";(function(n){t=e.exports,t.raw=n.from("55","hex"),t.base1=n.from("01","hex"),t.base2=n.from("00","hex"),t.base8=n.from("07","hex"),t.base10=n.from("09","hex"),t.cbor=n.from("51","hex"),t.protobuf=n.from("50","hex"),t.rlp=n.from("60","hex"),t.bencode=n.from("63","hex"),t.multicodec=n.from("30","hex"),t.multihash=n.from("31","hex"),t.multiaddr=n.from("32","hex"),t.multibase=n.from("33","hex"),t.md4=n.from("d4","hex"),t.md5=n.from("d5","hex"),t.sha1=n.from("11","hex"),t["sha2-256"]=n.from("12","hex"),t["sha2-512"]=n.from("13","hex"),t["dbl-sha2-256"]=n.from("56","hex"),t["sha3-224"]=n.from("17","hex"),t["sha3-256"]=n.from("16","hex"),t["sha3-384"]=n.from("15","hex"),t["sha3-512"]=n.from("14","hex"),t["shake-128"]=n.from("18","hex"),t["shake-256"]=n.from("19","hex"),t["keccak-224"]=n.from("1a","hex"),t["keccak-256"]=n.from("1b","hex"),t["keccak-384"]=n.from("1c","hex"),t["keccak-512"]=n.from("1d","hex"),t.murmur3=n.from("22","hex"),t["blake2b-8"]=n.from("b201","hex"),t["blake2b-16"]=n.from("b202","hex"),t["blake2b-24"]=n.from("b203","hex"),t["blake2b-32"]=n.from("b204","hex"),t["blake2b-40"]=n.from("b205","hex"),t["blake2b-48"]=n.from("b206","hex"),t["blake2b-56"]=n.from("b207","hex"),t["blake2b-64"]=n.from("b208","hex"),t["blake2b-72"]=n.from("b209","hex"),t["blake2b-80"]=n.from("b20a","hex"),t["blake2b-88"]=n.from("b20b","hex"),t["blake2b-96"]=n.from("b20c","hex"),t["blake2b-104"]=n.from("b20d","hex"),t["blake2b-112"]=n.from("b20e","hex"),t["blake2b-120"]=n.from("b20f","hex"),t["blake2b-128"]=n.from("b210","hex"),t["blake2b-136"]=n.from("b211","hex"),t["blake2b-144"]=n.from("b212","hex"),t["blake2b-152"]=n.from("b213","hex"),t["blake2b-160"]=n.from("b214","hex"),t["blake2b-168"]=n.from("b215","hex"),t["blake2b-176"]=n.from("b216","hex"),t["blake2b-184"]=n.from("b217","hex"),t["blake2b-192"]=n.from("b218","hex"),t["blake2b-200"]=n.from("b219","hex"),t["blake2b-208"]=n.from("b21a","hex"),t["blake2b-216"]=n.from("b21b","hex"),t["blake2b-224"]=n.from("b21c","hex"),t["blake2b-232"]=n.from("b21d","hex"),t["blake2b-240"]=n.from("b21e","hex"),t["blake2b-248"]=n.from("b21f","hex"),t["blake2b-256"]=n.from("b220","hex"),t["blake2b-264"]=n.from("b221","hex"),t["blake2b-272"]=n.from("b222","hex"),t["blake2b-280"]=n.from("b223","hex"),t["blake2b-288"]=n.from("b224","hex"),t["blake2b-296"]=n.from("b225","hex"),t["blake2b-304"]=n.from("b226","hex"),t["blake2b-312"]=n.from("b227","hex"),t["blake2b-320"]=n.from("b228","hex"),t["blake2b-328"]=n.from("b229","hex"),t["blake2b-336"]=n.from("b22a","hex"),t["blake2b-344"]=n.from("b22b","hex"),t["blake2b-352"]=n.from("b22c","hex"),t["blake2b-360"]=n.from("b22d","hex"),t["blake2b-368"]=n.from("b22e","hex"),t["blake2b-376"]=n.from("b22f","hex"),t["blake2b-384"]=n.from("b230","hex"),t["blake2b-392"]=n.from("b231","hex"),t["blake2b-400"]=n.from("b232","hex"),t["blake2b-408"]=n.from("b233","hex"),t["blake2b-416"]=n.from("b234","hex"),t["blake2b-424"]=n.from("b235","hex"),t["blake2b-432"]=n.from("b236","hex"),t["blake2b-440"]=n.from("b237","hex"),t["blake2b-448"]=n.from("b238","hex"),t["blake2b-456"]=n.from("b239","hex"),t["blake2b-464"]=n.from("b23a","hex"),t["blake2b-472"]=n.from("b23b","hex"),t["blake2b-480"]=n.from("b23c","hex"),t["blake2b-488"]=n.from("b23d","hex"),t["blake2b-496"]=n.from("b23e","hex"),t["blake2b-504"]=n.from("b23f","hex"),t["blake2b-512"]=n.from("b240","hex"),t["blake2s-8"]=n.from("b241","hex"),t["blake2s-16"]=n.from("b242","hex"),t["blake2s-24"]=n.from("b243","hex"),t["blake2s-32"]=n.from("b244","hex"),t["blake2s-40"]=n.from("b245","hex"),t["blake2s-48"]=n.from("b246","hex"),t["blake2s-56"]=n.from("b247","hex"),t["blake2s-64"]=n.from("b248","hex"),t["blake2s-72"]=n.from("b249","hex"),t["blake2s-80"]=n.from("b24a","hex"),t["blake2s-88"]=n.from("b24b","hex"),t["blake2s-96"]=n.from("b24c","hex"),t["blake2s-104"]=n.from("b24d","hex"),t["blake2s-112"]=n.from("b24e","hex"),t["blake2s-120"]=n.from("b24f","hex"),t["blake2s-128"]=n.from("b250","hex"),t["blake2s-136"]=n.from("b251","hex"),t["blake2s-144"]=n.from("b252","hex"),t["blake2s-152"]=n.from("b253","hex"),t["blake2s-160"]=n.from("b254","hex"),t["blake2s-168"]=n.from("b255","hex"),t["blake2s-176"]=n.from("b256","hex"),t["blake2s-184"]=n.from("b257","hex"),t["blake2s-192"]=n.from("b258","hex"),t["blake2s-200"]=n.from("b259","hex"),t["blake2s-208"]=n.from("b25a","hex"),t["blake2s-216"]=n.from("b25b","hex"),t["blake2s-224"]=n.from("b25c","hex"),t["blake2s-232"]=n.from("b25d","hex"),t["blake2s-240"]=n.from("b25e","hex"),t["blake2s-248"]=n.from("b25f","hex"),t["blake2s-256"]=n.from("b260","hex"),t["skein256-8"]=n.from("b301","hex"),t["skein256-16"]=n.from("b302","hex"),t["skein256-24"]=n.from("b303","hex"),t["skein256-32"]=n.from("b304","hex"),t["skein256-40"]=n.from("b305","hex"),t["skein256-48"]=n.from("b306","hex"),t["skein256-56"]=n.from("b307","hex"),t["skein256-64"]=n.from("b308","hex"),t["skein256-72"]=n.from("b309","hex"),t["skein256-80"]=n.from("b30a","hex"),t["skein256-88"]=n.from("b30b","hex"),t["skein256-96"]=n.from("b30c","hex"),t["skein256-104"]=n.from("b30d","hex"),t["skein256-112"]=n.from("b30e","hex"),t["skein256-120"]=n.from("b30f","hex"),t["skein256-128"]=n.from("b310","hex"),t["skein256-136"]=n.from("b311","hex"),t["skein256-144"]=n.from("b312","hex"),t["skein256-152"]=n.from("b313","hex"),t["skein256-160"]=n.from("b314","hex"),t["skein256-168"]=n.from("b315","hex"),t["skein256-176"]=n.from("b316","hex"),t["skein256-184"]=n.from("b317","hex"),t["skein256-192"]=n.from("b318","hex"),t["skein256-200"]=n.from("b319","hex"),t["skein256-208"]=n.from("b31a","hex"),t["skein256-216"]=n.from("b31b","hex"),t["skein256-224"]=n.from("b31c","hex"),t["skein256-232"]=n.from("b31d","hex"),t["skein256-240"]=n.from("b31e","hex"),t["skein256-248"]=n.from("b31f","hex"),t["skein256-256"]=n.from("b320","hex"),t["skein512-8"]=n.from("b321","hex"),t["skein512-16"]=n.from("b322","hex"),t["skein512-24"]=n.from("b323","hex"),t["skein512-32"]=n.from("b324","hex"),t["skein512-40"]=n.from("b325","hex"),t["skein512-48"]=n.from("b326","hex"),t["skein512-56"]=n.from("b327","hex"),t["skein512-64"]=n.from("b328","hex"),t["skein512-72"]=n.from("b329","hex"),t["skein512-80"]=n.from("b32a","hex"),t["skein512-88"]=n.from("b32b","hex"),t["skein512-96"]=n.from("b32c","hex"),t["skein512-104"]=n.from("b32d","hex"),t["skein512-112"]=n.from("b32e","hex"),t["skein512-120"]=n.from("b32f","hex"),t["skein512-128"]=n.from("b330","hex"),t["skein512-136"]=n.from("b331","hex"),t["skein512-144"]=n.from("b332","hex"),t["skein512-152"]=n.from("b333","hex"),t["skein512-160"]=n.from("b334","hex"),t["skein512-168"]=n.from("b335","hex"),t["skein512-176"]=n.from("b336","hex"),t["skein512-184"]=n.from("b337","hex"),t["skein512-192"]=n.from("b338","hex"),t["skein512-200"]=n.from("b339","hex"),t["skein512-208"]=n.from("b33a","hex"),t["skein512-216"]=n.from("b33b","hex"),t["skein512-224"]=n.from("b33c","hex"),t["skein512-232"]=n.from("b33d","hex"),t["skein512-240"]=n.from("b33e","hex"),t["skein512-248"]=n.from("b33f","hex"),t["skein512-256"]=n.from("b340","hex"),t["skein512-264"]=n.from("b341","hex"),t["skein512-272"]=n.from("b342","hex"),t["skein512-280"]=n.from("b343","hex"),t["skein512-288"]=n.from("b344","hex"),t["skein512-296"]=n.from("b345","hex"),t["skein512-304"]=n.from("b346","hex"),t["skein512-312"]=n.from("b347","hex"),t["skein512-320"]=n.from("b348","hex"),t["skein512-328"]=n.from("b349","hex"),t["skein512-336"]=n.from("b34a","hex"),t["skein512-344"]=n.from("b34b","hex"),t["skein512-352"]=n.from("b34c","hex"),t["skein512-360"]=n.from("b34d","hex"),t["skein512-368"]=n.from("b34e","hex"),t["skein512-376"]=n.from("b34f","hex"),t["skein512-384"]=n.from("b350","hex"),t["skein512-392"]=n.from("b351","hex"),t["skein512-400"]=n.from("b352","hex"),t["skein512-408"]=n.from("b353","hex"),t["skein512-416"]=n.from("b354","hex"),t["skein512-424"]=n.from("b355","hex"),t["skein512-432"]=n.from("b356","hex"),t["skein512-440"]=n.from("b357","hex"),t["skein512-448"]=n.from("b358","hex"),t["skein512-456"]=n.from("b359","hex"),t["skein512-464"]=n.from("b35a","hex"),t["skein512-472"]=n.from("b35b","hex"),t["skein512-480"]=n.from("b35c","hex"),t["skein512-488"]=n.from("b35d","hex"),t["skein512-496"]=n.from("b35e","hex"),t["skein512-504"]=n.from("b35f","hex"),t["skein512-512"]=n.from("b360","hex"),t["skein1024-8"]=n.from("b361","hex"),t["skein1024-16"]=n.from("b362","hex"),t["skein1024-24"]=n.from("b363","hex"),t["skein1024-32"]=n.from("b364","hex"),t["skein1024-40"]=n.from("b365","hex"),t["skein1024-48"]=n.from("b366","hex"),t["skein1024-56"]=n.from("b367","hex"),t["skein1024-64"]=n.from("b368","hex"),t["skein1024-72"]=n.from("b369","hex"),t["skein1024-80"]=n.from("b36a","hex"),t["skein1024-88"]=n.from("b36b","hex"),t["skein1024-96"]=n.from("b36c","hex"),t["skein1024-104"]=n.from("b36d","hex"),t["skein1024-112"]=n.from("b36e","hex"),t["skein1024-120"]=n.from("b36f","hex"),t["skein1024-128"]=n.from("b370","hex"),t["skein1024-136"]=n.from("b371","hex"),t["skein1024-144"]=n.from("b372","hex"),t["skein1024-152"]=n.from("b373","hex"),t["skein1024-160"]=n.from("b374","hex"),t["skein1024-168"]=n.from("b375","hex"),t["skein1024-176"]=n.from("b376","hex"),t["skein1024-184"]=n.from("b377","hex"),t["skein1024-192"]=n.from("b378","hex"),t["skein1024-200"]=n.from("b379","hex"),t["skein1024-208"]=n.from("b37a","hex"),t["skein1024-216"]=n.from("b37b","hex"),t["skein1024-224"]=n.from("b37c","hex"),t["skein1024-232"]=n.from("b37d","hex"),t["skein1024-240"]=n.from("b37e","hex"),t["skein1024-248"]=n.from("b37f","hex"),t["skein1024-256"]=n.from("b380","hex"),t["skein1024-264"]=n.from("b381","hex"),t["skein1024-272"]=n.from("b382","hex"),t["skein1024-280"]=n.from("b383","hex"),t["skein1024-288"]=n.from("b384","hex"),t["skein1024-296"]=n.from("b385","hex"),t["skein1024-304"]=n.from("b386","hex"),t["skein1024-312"]=n.from("b387","hex"),t["skein1024-320"]=n.from("b388","hex"),t["skein1024-328"]=n.from("b389","hex"),t["skein1024-336"]=n.from("b38a","hex"),t["skein1024-344"]=n.from("b38b","hex"),t["skein1024-352"]=n.from("b38c","hex"),t["skein1024-360"]=n.from("b38d","hex"),t["skein1024-368"]=n.from("b38e","hex"),t["skein1024-376"]=n.from("b38f","hex"),t["skein1024-384"]=n.from("b390","hex"),t["skein1024-392"]=n.from("b391","hex"),t["skein1024-400"]=n.from("b392","hex"),t["skein1024-408"]=n.from("b393","hex"),t["skein1024-416"]=n.from("b394","hex"),t["skein1024-424"]=n.from("b395","hex"),t["skein1024-432"]=n.from("b396","hex"),t["skein1024-440"]=n.from("b397","hex"),t["skein1024-448"]=n.from("b398","hex"),t["skein1024-456"]=n.from("b399","hex"),t["skein1024-464"]=n.from("b39a","hex"),t["skein1024-472"]=n.from("b39b","hex"),t["skein1024-480"]=n.from("b39c","hex"),t["skein1024-488"]=n.from("b39d","hex"),t["skein1024-496"]=n.from("b39e","hex"),t["skein1024-504"]=n.from("b39f","hex"),t["skein1024-512"]=n.from("b3a0","hex"),t["skein1024-520"]=n.from("b3a1","hex"),t["skein1024-528"]=n.from("b3a2","hex"),t["skein1024-536"]=n.from("b3a3","hex"),t["skein1024-544"]=n.from("b3a4","hex"),t["skein1024-552"]=n.from("b3a5","hex"),t["skein1024-560"]=n.from("b3a6","hex"),t["skein1024-568"]=n.from("b3a7","hex"),t["skein1024-576"]=n.from("b3a8","hex"),t["skein1024-584"]=n.from("b3a9","hex"),t["skein1024-592"]=n.from("b3aa","hex"),t["skein1024-600"]=n.from("b3ab","hex"),t["skein1024-608"]=n.from("b3ac","hex"),t["skein1024-616"]=n.from("b3ad","hex"),t["skein1024-624"]=n.from("b3ae","hex"),t["skein1024-632"]=n.from("b3af","hex"),t["skein1024-640"]=n.from("b3b0","hex"),t["skein1024-648"]=n.from("b3b1","hex"),t["skein1024-656"]=n.from("b3b2","hex"),t["skein1024-664"]=n.from("b3b3","hex"),t["skein1024-672"]=n.from("b3b4","hex"),t["skein1024-680"]=n.from("b3b5","hex"),t["skein1024-688"]=n.from("b3b6","hex"),t["skein1024-696"]=n.from("b3b7","hex"),t["skein1024-704"]=n.from("b3b8","hex"),t["skein1024-712"]=n.from("b3b9","hex"),t["skein1024-720"]=n.from("b3ba","hex"),t["skein1024-728"]=n.from("b3bb","hex"),t["skein1024-736"]=n.from("b3bc","hex"),t["skein1024-744"]=n.from("b3bd","hex"),t["skein1024-752"]=n.from("b3be","hex"),t["skein1024-760"]=n.from("b3bf","hex"),t["skein1024-768"]=n.from("b3c0","hex"),t["skein1024-776"]=n.from("b3c1","hex"),t["skein1024-784"]=n.from("b3c2","hex"),t["skein1024-792"]=n.from("b3c3","hex"),t["skein1024-800"]=n.from("b3c4","hex"),t["skein1024-808"]=n.from("b3c5","hex"),t["skein1024-816"]=n.from("b3c6","hex"),t["skein1024-824"]=n.from("b3c7","hex"),t["skein1024-832"]=n.from("b3c8","hex"),t["skein1024-840"]=n.from("b3c9","hex"),t["skein1024-848"]=n.from("b3ca","hex"),t["skein1024-856"]=n.from("b3cb","hex"),t["skein1024-864"]=n.from("b3cc","hex"),t["skein1024-872"]=n.from("b3cd","hex"),t["skein1024-880"]=n.from("b3ce","hex"),t["skein1024-888"]=n.from("b3cf","hex"),t["skein1024-896"]=n.from("b3d0","hex"),t["skein1024-904"]=n.from("b3d1","hex"),t["skein1024-912"]=n.from("b3d2","hex"),t["skein1024-920"]=n.from("b3d3","hex"),t["skein1024-928"]=n.from("b3d4","hex"),t["skein1024-936"]=n.from("b3d5","hex"),t["skein1024-944"]=n.from("b3d6","hex"),t["skein1024-952"]=n.from("b3d7","hex"),t["skein1024-960"]=n.from("b3d8","hex"),t["skein1024-968"]=n.from("b3d9","hex"),t["skein1024-976"]=n.from("b3da","hex"),t["skein1024-984"]=n.from("b3db","hex"),t["skein1024-992"]=n.from("b3dc","hex"),t["skein1024-1000"]=n.from("b3dd","hex"),t["skein1024-1008"]=n.from("b3de","hex"),t["skein1024-1016"]=n.from("b3df","hex"),t["skein1024-1024"]=n.from("b3e0","hex"),t.ip4=n.from("04","hex"),t.ip6=n.from("29","hex"),t.tcp=n.from("06","hex"),t.udp=n.from("0111","hex"),t.dccp=n.from("21","hex"),t.sctp=n.from("84","hex"),t.udt=n.from("012d","hex"),t.utp=n.from("012e","hex"),t.ipfs=n.from("01a5","hex"),t.http=n.from("01e0","hex"),t.https=n.from("01bb","hex"),t.quic=n.from("01cc","hex"),t.ws=n.from("01dd","hex"),t.onion=n.from("01bc","hex"),t["p2p-circuit"]=n.from("0122","hex"),t["git-raw"]=n.from("78","hex"),t["dag-pb"]=n.from("70","hex"),t["dag-cbor"]=n.from("71","hex"),t["git-raw"]=n.from("78","hex"),t["eth-block"]=n.from("90","hex"),t["eth-block-list"]=n.from("91","hex"),t["eth-tx-trie"]=n.from("92","hex"),t["eth-tx"]=n.from("93","hex"),t["eth-tx-receipt-trie"]=n.from("94","hex"),t["eth-tx-receipt"]=n.from("95","hex"),t["eth-state-trie"]=n.from("96","hex"),t["eth-account-snapshot"]=n.from("97","hex"),t["eth-storage-trie"]=n.from("98","hex"),t["bitcoin-block"]=n.from("b0","hex"),t["bitcoin-tx"]=n.from("b1","hex"),t["zcash-block"]=n.from("c0","hex"),t["zcash-tx"]=n.from("c1","hex"),t["stellar-block"]=n.from("d0","hex"),t["stellar-tx"]=n.from("d1","hex"),t["torrent-info"]=n.from("7b","hex"),t["torrent-file"]=n.from("7c","hex"),t["ed25519-pub"]=n.from("ed","hex")}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(39);e.exports=(e=>{if(!t.isBuffer(e))throw new Error("arg needs to be a buffer");let n=[];for(;e.length>0;){const t=r.decode(e);n.push(t),e=e.slice(r.decode.bytes)}return n})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports="\n message Message {\n message Wantlist {\n message Entry {\n // changed from string to bytes, it makes a difference in JavaScript\n optional bytes block = 1; // the block cid (cidV0 in bitswap 1.0.0, cidV1 in bitswap 1.1.0)\n optional int32 priority = 2; // the priority (normalized). default to 1\n optional bool cancel = 3; // whether this revokes an entry\n }\n\n repeated Entry entries = 1; // a list of wantlist entries\n optional bool full = 2; // whether this is the full wantlist. default to false\n }\n\n message Block {\n optional bytes prefix = 1; // CID prefix (cid version, multicodec and multihash prefix (type + length)\n optional bytes data = 2;\n }\n\n optional Wantlist wantlist = 1;\n repeated bytes blocks = 2; // used to send Blocks in bitswap 1.0.0\n repeated Block payload = 3; // used to send Blocks in bitswap 1.1.0\n }\n"},function(e,t,n){"use strict";const r=n(243).Entry,i=n(9),o=n(18);e.exports=class e{constructor(e,t,n){o(i.isCID(e),"needs valid cid"),this.entry=new r(e,t),this.cancel=Boolean(n)}get cid(){return this.entry.cid}set cid(e){this.entry.cid=e}get priority(){return this.entry.priority}set priority(e){this.entry.priority=e}get[Symbol.toStringTag](){const e=this.cid.toBaseEncodedString();return`BitswapMessageEntry ${e} `}equals(e){return this.cancel===e.cancel&&this.entry.equals(e.entry)}}},function(e,t,n){"use strict";const r=n(18),i=n(9);class o{constructor(e,t){r(i.isCID(e),"must be valid CID"),this._refCounter=1,this.cid=e,this.priority=t||1}inc(){this._refCounter+=1}dec(){this._refCounter=Math.max(0,this._refCounter-1)}hasRefs(){return this._refCounter>0}get[Symbol.toStringTag](){const e=this.cid.toBaseEncodedString();return`WantlistEntry `}equals(e){return this._refCounter===e._refCounter&&this.cid.equals(e.cid)&&this.priority===e.priority}}e.exports=o},function(e,t,n){"use strict";const r=n(489),i=n(242),o=n(120).logger;e.exports=class e{constructor(e,t,n){this.peerId=t,this.network=n,this.refcnt=1,this._entries=[],this._log=o(e,"msgqueue",t.toB58String().slice(0,8)),this.sendEntries=r(this._sendEntries.bind(this),200)}addMessage(e){e.empty||this.send(e)}addEntries(e){this._entries=this._entries.concat(e),this.sendEntries()}_sendEntries(){if(!this._entries.length)return;const e=new i(!1);this._entries.forEach(t=>{t.cancel?e.cancel(t.cid):e.addEntry(t.cid,t.priority)}),this._entries=[],this.addMessage(e)}send(e){this.network.connectTo(this.peerId,t=>{t?this._log.error("cant connect to peer %s: %s",this.peerId.toB58String(),t.message):(this._log("sending message"),this.network.sendMessage(this.peerId,e,e=>{e&&this._log.error("send error: %s",e.message)}))})}}},function(e,t,n){"use strict";const r=n(72),i=n(26),o=n(11),s=n(56),a=n(91),u=n(242),l=n(321),c=n(120).logger,f="/ipfs/bitswap/1.0.0",h="/ipfs/bitswap/1.1.0";class p{constructor(e,t,n,r){this._log=c(e.peerInfo.id,"network"),n=n||{},this.libp2p=e,this.bitswap=t,this.b100Only=n.b100Only||!1,this._stats=r,this._running=!1}start(e){this._running=!0,this._onPeerConnect=this._onPeerConnect.bind(this),this._onPeerDisconnect=this._onPeerDisconnect.bind(this),this._onConnection=this._onConnection.bind(this),this.libp2p.handle(f,this._onConnection),this.b100Only||this.libp2p.handle(h,this._onConnection),this.libp2p.on("peer:connect",this._onPeerConnect),this.libp2p.on("peer:disconnect",this._onPeerDisconnect),this.libp2p.peerBook.getAllArray().filter(e=>e.isConnected()).forEach(e=>this._onPeerConnect(e)),a(()=>e())}stop(e){this._running=!1,this.libp2p.unhandle(f),this.b100Only||this.libp2p.unhandle(h),this.libp2p.removeListener("peer:connect",this._onPeerConnect),this.libp2p.removeListener("peer:disconnect",this._onPeerDisconnect),a(()=>e())}_onConnection(e,t){this._running&&(this._log("incomming new bitswap connection: %s",e),i(t,r.decode(),i.asyncMap((e,t)=>u.deserialize(e,t)),i.asyncMap((e,n)=>{t.getPeerInfo((t,r)=>{if(t)return n(t);this.bitswap._receiveMessage(r.id,e,n)})}),i.onEnd(e=>{this._log("ending connection"),e&&this.bitswap._receiveError(e)})))}_onPeerConnect(e){this._running&&this.bitswap._onPeerConnected(e.id)}_onPeerDisconnect(e){this._running&&this.bitswap._onPeerDisconnected(e.id)}findProviders(e,t,n){this.libp2p.contentRouting.findProviders(e,{maxTimeout:l.providerRequestTimeout,maxNumProviders:t},n)}findAndConnect(e,t){o([t=>this.findProviders(e,l.maxProvidersPerRequest,t),(e,t)=>{this._log("connecting to providers",e.map(e=>e.id.toB58String())),s(e,(e,t)=>this.connectTo(e,t))}],t)}provide(e,t){this.libp2p.contentRouting.provide(e,t)}sendMessage(e,t,n){if(!this._running)return n(new Error("network isn't running"));const r=e.toB58String()?e.toB58String():e.id.toB58String();this._log("sendMessage to %s",r,t),this._dialPeer(e,(r,i,o)=>{if(r)return n(r);let s;switch(o){case f:s=t.serializeToBitswap100();break;case h:s=t.serializeToBitswap110();break;default:return n(new Error("Unkown protocol: "+o))}d(i,s,e=>{e&&this._log.error(e)}),n(),this._updateSentStats(e,t.blocks)})}connectTo(e,t){if(!this._running)return t(new Error("network isn't running"));this.libp2p.dial(e,t)}_dialPeer(e,t){this.libp2p.dialProtocol(e,h,(n,r)=>{n?this.libp2p.dialProtocol(e,f,(e,n)=>{if(e)return t(e);t(null,n,f)}):t(null,r,h)})}_updateSentStats(e,t){const n=e.toB58String();this._stats&&(t.forEach(e=>this._stats.push(n,"dataSent",e.data.length)),this._stats.push(n,"blocksSent",t.size))}}function d(e,t,n){i(i.values([t]),r.encode(),e,i.onEnd(n))}e.exports=p},function(e,t,n){"use strict";const r=n(4).Buffer;e.exports=o;const i=10240;function o(e){e=Object.assign({fixed:!1},e||{});const t=n(39);let i=e.fixed?null:s(),o=0,a=!1;return n=>(u,l)=>{if(u&&(a=u),a)return l(a);n(null,(n,u)=>{if(n&&(a=n),a)return l(a);if(!a&&!r.isBuffer(u))return a=new Error("data must be a buffer"),l(a);const c=a?0:u.length;let f;if(e.fixed?(f=r.alloc(4),f.writeInt32BE(c,0)):(t.encode(c,i,o),o+=t.encode.bytes,f=i.slice(o-t.encode.bytes,o),i.length-o<100&&(i=s(),o=0)),a)return l(null,f);l(null,r.concat([f,u],(e.fixed?4:t.encode.bytes)+c))})}}function s(){return r.alloc(i)}},function(e,t,n){"use strict";const r=n(39),i=n(490),o=n(4).Buffer,s=n(73);t.decode=c,t.decodeFromReader=f;const a=128,u=e=>!(128&e),l=4194304;function c(e){let t=new i,n=s(e=>{t.abort(e)});return r=>{function i(){let r=!0,o=!1;const s=(e,t)=>{o=!0,e?(n.end(e),r=!1):(n.push(t),r||i())};for(;r;)o=!1,h(t,e,s),o||(r=!1)}return t(r),i(),n}}function f(e,t,n){"function"==typeof t&&(n=t,t={}),h(e,t,function e(t,r){if(t)return n(!0===t?new Error("Unexpected end of input from reader."):t);n(null,r)})}function h(e,t,n){t=Object.assign({fixed:!1,maxLength:l},t||{}),t.fixed?p(e,t.maxLength,n):d(e,t.maxLength,n)}function p(e,t,n){e.read(4,(r,i)=>{if(r)return n(r);const o=i.readInt32BE(0);if(o>t)return n(new Error("size longer than max permitted length of "+t+"!"));m(e,o,n)})}function d(e,t,n){let i=[];function s(){e.read(1,(a,l)=>{if(a)return n(a);if(i.push(l),l&&!u(l[0]))return void s();const c=r.decode(o.concat(i));if(c>t)return n(new Error("size longer than max permitted length of "+t+"!"));m(e,c,(e,t)=>e?n(e):(i=[],t.length{if(e)return n(e);n(null,t)})}},function(e,t,n){(function(t){e.exports=function(){var e=[],n=0;function r(){return e.reduce(function(e,t){return e+t.length},0)}return{length:n,data:this,add:function(r){if(!t.isBuffer(r))throw new Error("data must be a buffer, was: "+JSON.stringify(r));return this.length=n+=r.length,e.push(r),this},has:function(e){return null==e?n>0:n>=e},get:function(r){var i;if(null==r||r===n){n=0;var o=e;return e=[],1==o.length?o[0]:t.concat(o)}if(e.length>1&&r<=(i=e[0].length)){var s=e[0].slice(0,r);return r===i?e.shift():e[0]=e[0].slice(r,i),n-=r,s}if(re+t.data.byteLength,0);if(r{if(u--,a.push(t),o+=t.data.byteLength,o>=g||0===u){o=0;const t=a.slice();a=[],this._sendSafeBlocks(e,t,e=>{e&&this._log("sendblock error: %s",e.message),n()})}else s(n)},n)}_sendSafeBlocks(e,t,n){const r=new l(!1);t.forEach(e=>r.addBlock(e)),this.network.sendMessage(e,r,n)}_processTasks(){if(!this._running||!this._tasks.length)return;const e=this._tasks;this._tasks=[];const t=e.map(e=>e.entry),n=t.map(e=>e.cid),i=m((e,t)=>e.equals(t),n),s=p(e=>e.target.toB58String(),e);o([e=>a(i,(e,t)=>{this.blockstore.get(e,t)},e),(e,t)=>r(Object.values(s),(t,r)=>{const i=t[0].target,o=n.map(t=>e.find(e=>e.cid.equals(t)));this._sendBlocks(i,o,e=>{e?this._log.error("should never happen: ",e):o.forEach(e=>this.messageSent(i,e)),r()})},t)],e=>{this._tasks=[],e&&this._log.error(e)})}wantlistForPeer(e){const t=e.toB58String();return this.ledgerMap.has(t)?this.ledgerMap.get(t).wantlist.sortedEntries():new Map}ledgerForPeer(e){const t=e.toB58String(),n=this.ledgerMap.get(t);return n?{peer:n.partner.toPrint(),value:n.debtRatio(),sent:n.accounting.bytesSent,recv:n.accounting.bytesRecv,exchanged:n.exchangeCount}:null}peers(){return Array.from(this.ledgerMap.values()).map(e=>e.partner)}receivedBlocks(e){e.length&&(this.ledgerMap.forEach(t=>{e.map(e=>t.wantlistContains(e)).filter(Boolean).forEach(e=>{this._tasks.push({entry:e,target:t.partner})})}),this._outbox())}messageReceived(e,t,n){const r=this._findOrCreate(e);if(t.empty)return s(n);if(t.full&&(r.wantlist=new c),this._processBlocks(t.blocks,r),0===t.wantlist.size)return s(n);let i=[],o=[];t.wantlist.forEach(e=>{e.cancel?(r.cancelWant(e.cid),i.push(e)):(r.wants(e.cid,e.priority),o.push(e))}),this._cancelWants(r,e,i),this._addWants(r,e,o,n)}_cancelWants(e,t,n){const r=t.toB58String();this._tasks=d((e,t)=>{const n=e.target.toB58String()===r,i=e.entry.cid.equals(t.cid);return n&&i},this._tasks,n)}_addWants(e,t,n,i){r(n,(e,n)=>{this.blockstore.has(e.cid,(r,i)=>{r?this._log.error("failed existence check"):i&&this._tasks.push({entry:e.entry,target:t}),n()})},()=>{this._outbox(),i()})}_processBlocks(e,t,n){const r=[];e.forEach((e,n)=>{this._log("got block (%s bytes)",e.data.length),t.receivedBytes(e.data.length),r.push(e.cid)}),this.receivedBlocks(r)}messageSent(e,t){const n=this._findOrCreate(e);n.sentBytes(t?t.data.length:0),t&&t.cid&&n.wantlist.remove(t.cid)}numBytesSentTo(e){return this._findOrCreate(e).accounting.bytesSent}numBytesReceivedFrom(e){return this._findOrCreate(e).accounting.bytesRecv}peerDisconnected(e){}_findOrCreate(e){const t=e.toB58String();if(this.ledgerMap.has(t))return this.ledgerMap.get(t);const n=new f(e);return this.ledgerMap.set(t,n),this._stats&&this._stats.push(t,"peerCount",1),n}start(e){this._running=!0,s(()=>e())}stop(e){this._running=!1,s(()=>e())}}e.exports=y},function(e,t,n){"use strict";const r=n(243);class i{constructor(e){this.partner=e,this.wantlist=new r,this.exchangeCount=0,this.sentToPeer=new Map,this.accounting={bytesSent:0,bytesRecv:0}}sentBytes(e){this.exchangeCount++,this.lastExchange=(new Date).getTime(),this.accounting.bytesSent+=e}receivedBytes(e){this.exchangeCount++,this.lastExchange=(new Date).getTime(),this.accounting.bytesRecv+=e}wants(e,t){this.wantlist.add(e,t)}cancelWant(e){this.wantlist.remove(e)}wantlistContains(e){return this.wantlist.contains(e)}debtRatio(){return this.accounting.bytesSent/(this.accounting.bytesRecv+1)}}e.exports=i},function(e,t,n){"use strict";const r=n(6).EventEmitter,i=n(321),o=n(120).logger,s=e=>`unwant:${e}`,a=e=>`block:${e}`;class u extends r{constructor(e){super(),this.setMaxListeners(i.maxListeners),this._log=o(e,"notif"),this._unwantListeners={},this._blockListeners={}}hasBlock(e){const t=`block:${e.cid.buffer.toString()}`;this._log(t),this.emit(t,e)}wantBlock(e,t,n){const r=e.buffer.toString();this._log(`wantBlock:${r}`),this._unwantListeners[r]=(()=>{this._log(`manual unwant: ${r}`),this._cleanup(r),n()}),this._blockListeners[r]=(e=>{this._cleanup(r),t(e)}),this.once(s(r),this._unwantListeners[r]),this.once(a(r),this._blockListeners[r])}unwantBlock(e){const t=`unwant:${e.buffer.toString()}`;this._log(t),this.emit(t)}_cleanup(e){this._unwantListeners[e]&&(this.removeListener(s(e),this._unwantListeners[e]),delete this._unwantListeners[e]),this._blockListeners[e]&&(this.removeListener(a(e),this._blockListeners[e]),delete this._blockListeners[e])}}e.exports=u},function(e,t,n){"use strict";const r=n(6),i=n(997),o={movingAverageIntervals:[6e4,3e5,9e5]};class s extends r{constructor(e,t){super();const n=Object.assign({},o,t);if("number"!=typeof n.computeThrottleTimeout)throw new Error("need computeThrottleTimeout");if("number"!=typeof n.computeThrottleMaxQueueSize)throw new Error("need computeThrottleMaxQueueSize");this._initialCounters=e,this._options=n,this._enabled=this._options.enabled,this._global=new i(e,n),this._global.on("update",e=>this.emit("update",e)),this._peers=new Map}enable(){this._enabled=!0,this._options.enabled=!0,this._global.enable()}disable(){this._enabled=!1,this._options.enabled=!1,this._global.disable()}stop(){this._enabled=!1,this._global.stop();for(let e of this._peers)e[1].stop()}get snapshot(){return this._global.snapshot}get movingAverages(){return this._global.movingAverages}forPeer(e){return e.toB58String&&(e=e.toB58String()),this._peers.get(e)}push(e,t,n){if(this._enabled&&(this._global.push(t,n),e)){let r=this._peers.get(e);r||(r=new i(this._initialCounters,this._options),this._peers.set(e,r)),r.push(t,n)}}disconnected(e){const t=e.toB58String(),n=this._peers.get(t);n&&(n.stop(),this._peers.delete(t))}}e.exports=s},function(e,t,n){"use strict";const r=n(6),i=n(62),o=n(492);class s extends r{constructor(e,t){super(),this._options=t,this._queue=[],this._stats={},this._frequencyLastTime=Date.now(),this._frequencyAccumulators={},this._movingAverages={},this._update=this._update.bind(this),e.forEach(e=>{this._stats[e]=i(0),this._movingAverages[e]={},this._options.movingAverageIntervals.forEach(t=>{const n=this._movingAverages[e][t]=o(t);n.push(this._frequencyLastTime,0)})}),this._enabled=this._options.enabled}enable(){this._enabled=!0}disable(){this._disabled=!0}stop(){this._timeout&&clearTimeout(this._timeout)}get snapshot(){return Object.assign({},this._stats)}get movingAverages(){return Object.assign({},this._movingAverages)}push(e,t){this._enabled&&(this._queue.push([e,t,Date.now()]),this._resetComputeTimeout())}_resetComputeTimeout(){this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout(this._update,this._nextTimeout())}_nextTimeout(){const e=this._queue.length/this._options.computeThrottleMaxQueueSize;return Math.max(this._options.computeThrottleTimeout*(1-e),0)}_update(){if(this._timeout=null,this._queue.length){let e;for(;this._queue.length;){const t=e=this._queue.shift();this._applyOp(t)}this._updateFrequency(e[2]),this.emit("update",this._stats)}}_updateFrequency(e){const t=e-this._frequencyLastTime;Object.keys(this._stats).forEach(n=>{this._updateFrequencyFor(n,t,e)}),this._frequencyLastTime=e}_updateFrequencyFor(e,t,n){const r=this._frequencyAccumulators[e]||0;this._frequencyAccumulators[e]=0;const i=r/t*1e3;let s=this._movingAverages[e];s||(s=this._movingAverages[e]={}),this._options.movingAverageIntervals.forEach(e=>{let t=s[e];t||(t=s[e]=o(e)),t.push(n,i)})}_applyOp(e){const t=e[0],n=e[1];if("number"!=typeof n)throw new Error("invalid increment number:",n);let r;r=this._stats.hasOwnProperty(t)?this._stats[t]:this._stats[t]=i(0),this._stats[t]=r.plus(n),this._frequencyAccumulators[t]||(this._frequencyAccumulators[t]=0),this._frequencyAccumulators[t]+=n}}e.exports=s},function(e,t,n){var r=n(999),i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,o=/\\(\\)?/g,s=r(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(i,function(e,n,r,i){t.push(r?i.replace(o,"$1"):n||e)}),t});e.exports=s},function(e,t,n){var r=n(1e3),i=500;function o(e){var t=r(e,function(e){return n.size===i&&n.clear(),e}),n=t.cache;return t}e.exports=o},function(e,t,n){var r=n(324),i="Expected a function";function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(i);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(o.Cache||r),n}o.Cache=r,e.exports=o},function(e,t,n){var r=n(1002),i=n(246),o=n(325);function s(){this.size=0,this.__data__={hash:new r,map:new(o||i),string:new r}}e.exports=s},function(e,t,n){var r=n(1003),i=n(1008),o=n(1009),s=n(1010),a=n(1011);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1}e.exports=i},function(e,t,n){var r=n(247);function i(e,t){var n=this.__data__,i=r(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}e.exports=i},function(e,t,n){var r=n(248);function i(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}e.exports=i},function(e,t){function n(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}e.exports=n},function(e,t,n){var r=n(248);function i(e){return r(this,e).get(e)}e.exports=i},function(e,t,n){var r=n(248);function i(e){return r(this,e).has(e)}e.exports=i},function(e,t,n){var r=n(248);function i(e,t){var n=r(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}e.exports=i},function(e,t,n){var r=n(174),i=n(299),o=n(67),s=n(323),a=1/0,u=r?r.prototype:void 0,l=u?u.toString:void 0;function c(e){if("string"==typeof e)return e;if(o(e))return i(e,c)+"";if(s(e))return l?l.call(e):"";var t=e+"";return"0"==t&&1/e==-a?"-0":t}e.exports=c},function(e,t,n){"use strict";e.exports=a;var r=n(87),i=a.prototype,o=new Date%1e9;function s(){return(1e9*Math.random()>>>0)+o++}function a(e){e=e||{},this.id=e.id||s(),this.max=e.max||1/0,this.items=e.items||[],this._lookup={},this.size=this.items.length,this.lastModified=new Date(e.lastModified||new Date);for(var t,n,r=this.items.length;r--;)t=this.items[r],n=new Date(t.expires)-new Date,this._lookup[t.key]=t,n>0?this.expire(t.key,n):n<=0&&this.delete(t.key)}i.has=function(e){return e in this._lookup},i.get=function(e){if(!this.has(e))return null;var t=this._lookup[e];return t.refresh&&this.expire(e,t.refresh),this.items.splice(this.items.indexOf(t),1),this.items.push(t),t.value},i.meta=function(e){if(!this.has(e))return null;var t=this._lookup[e];return"meta"in t?t.meta:null},i.set=function(e,t,n){var r=this._lookup[e],i=this._lookup[e]={key:e,value:t};return this.lastModified=new Date,r?(clearTimeout(r.timeout),this.items.splice(this.items.indexOf(r),1,i)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(i),this.size++),n&&("ttl"in n&&this.expire(e,n.ttl),"meta"in n&&(i.meta=n.meta),n.refresh&&(i.refresh=n.ttl)),this},i.delete=function(e){var t=this._lookup[e];return!!t&&(this.lastModified=new Date,this.items.splice(this.items.indexOf(t),1),clearTimeout(t.timeout),delete this._lookup[e],this.size--,this)},i.expire=function(e,t){var n=t||0,i=this._lookup[e];if(!i)return this;if("string"==typeof n&&(n=r(t)),"number"!=typeof n)throw new TypeError("Expiration time must be a string or number.");return clearTimeout(i.timeout),i.timeout=setTimeout(this.delete.bind(this,i.key),n),i.expires=Number(new Date)+n,this},i.clear=function(){for(var e=this.items.length;e--;)this.delete(this.items[e].key);return this},i.toJSON=function(){for(var e=new Array(this.items.length),t,n=e.length;n--;)t=this.items[n],e[n]={key:t.key,meta:t.meta,value:t.value,expires:t.expires,refresh:t.refresh};return{id:this.id,max:isFinite(this.max)?this.max:void 0,lastModified:this.lastModified,items:e}}},function(e,t,n){"use strict";const r=n(23),{Key:i}=n(33),o=n(40),s=n(22),a=n(5),u=a("jsipfs:ipns:publisher");u.error=a("jsipfs:ipns:publisher:error");const l=n(183),c=36e5;class f{constructor(e,t){this._routing=e,this._datastore=t}publishWithEOL(e,t,n,i){if(!e||!e.bytes){const e="one or more of the provided parameters are not defined";return u.error(e),i(s(new Error(e),"ERR_UNDEFINED_PARAMETER"))}r.createFromPrivKey(e.bytes,(r,o)=>{if(r)return i(r);this._updateOrCreateRecord(e,t,n,o,(e,t)=>{if(e)return i(e);this._putRecordToRouting(t,o,i)})})}publish(e,t,n){this.publishWithEOL(e,t,c,n)}_putRecordToRouting(e,t,n){if(!r.isPeerId(t)){const e="peerId received is not valid";return u.error(e),n(s(new Error(e),"ERR_INVALID_PEER_ID"))}const i=t._pubKey;l.embedPublicKey(i,e,(r,s)=>{if(r)return n(r);let a;try{a=l.getIdKeys(t.toBytes())}catch(r){return u.error(r),n(r)}o([n=>this._publishEntry(a.routingKey,s||e,t,n),e=>this._publishPublicKey(a.routingPubKey,i,t,e)],t=>{if(t)return u.error(t),n(t);n(null,s||e)})})}_publishEntry(e,t,n,r){if(!i.isKey(e)){const e="datastore key does not have a valid format";return u.error(e),r(s(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}let o;try{o=l.marshal(t)}catch(e){return u.error(e),r(e)}this._routing.put(e.toBuffer(),o,(t,n)=>{if(t){const t=`ipns record for ${e.toString()} could not be stored in the routing`;return u.error(t),r(s(new Error(t),"ERR_PUTTING_TO_ROUTING"))}u(`ipns record for ${e.toString()} was stored in the routing`),r(null,n)})}_publishPublicKey(e,t,n,r){if(!i.isKey(e)){const e="datastore key does not have a valid format";return u.error(e),r(s(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}if(!t||!t.bytes){const e="one or more of the provided parameters are not defined";return u.error(e),r(s(new Error(e),"ERR_UNDEFINED_PARAMETER"))}this._routing.put(e.toBuffer(),t.bytes,(t,n)=>{if(t){const t=`public key for ${e.toString()} could not be stored in the routing`;return u.error(t),r(s(new Error(t),"ERR_PUTTING_TO_ROUTING"))}u(`public key for ${e.toString()} was stored in the routing`),r(null,n)})}_getPublished(e,t,n){if(!r.isPeerId(e)){const e="peerId received is not valid";return u.error(e),n(s(new Error(e),"ERR_INVALID_PEER_ID"))}t=t||{};const i=!1!==t.checkRouting;this._datastore.get(l.getLocalKey(e.id),(t,r)=>{if(t){if("ERR_NOT_FOUND"!==t.code){const t=`unexpected error getting the ipns record ${e.id} from datastore`;return u.error(t),n(s(new Error(t),"ERR_UNEXPECTED_DATASTORE_RESPONSE"))}if(!i)return n(s(t));let r;try{r=l.getIdKeys(e.toBytes())}catch(t){return u.error(t),n(t)}this._routing.get(r.routingKey.toBuffer(),(e,t)=>{if(e)return n(e);this._unmarshalData(t,n)})}else this._unmarshalData(r,n)})}_unmarshalData(e,t){let n;try{n=l.unmarshal(e)}catch(e){return u.error(e),t(s(e,"ERR_INVALID_RECORD_DATA"))}t(null,n)}_updateOrCreateRecord(e,t,n,i,o){if(!r.isPeerId(i)){const e="peerId received is not valid";return u.error(e),o(s(new Error(e),"ERR_INVALID_PEER_ID"))}const a={checkRouting:!0};this._getPublished(i,a,(r,a)=>{if(r&&"ERR_NOT_FOUND"!==r.code){const e=`unexpected error when determining the last published IPNS record for ${i.id}`;return u.error(e),o(s(new Error(e),"ERR_DETERMINING_PUBLISHED_RECORD"))}let c=0;a&&void 0!==a.sequence&&(c=a.value.toString()!==t?a.sequence+1:a.sequence),l.create(e,t,c,n,(e,n)=>{if(e){const e=`ipns record for ${t} could not be created`;return u.error(e),o(s(new Error(e),"ERR_CREATING_IPNS_RECORD"))}const r=l.marshal(n);this._datastore.put(l.getLocalKey(i.id),r,(e,r)=>{if(e){const e=`ipns record for ${t} could not be stored in the datastore`;return u.error(e),o(s(new Error(e),"ERR_STORING_IN_DATASTORE"))}u(`ipns record for ${t} was stored in the datastore`),o(null,n)})})})}}t=e.exports=f},function(e,t){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",r="0123456789ABCDEFGHIJKLMNOPQRSTUV",i="0123456789ABCDEFGHJKMNPQRSTVWXYZ";e.exports=function e(t,o,s){var a,u;switch(s=s||{},o){case"RFC3548":case"RFC4648":a=n,u=!0;break;case"RFC4648-HEX":a=r,u=!0;break;case"Crockford":a=i,u=!1;break;default:throw new Error("Unknown base32 variant: "+o)}for(var l=void 0!==s.padding?s.padding:u,c=t.byteLength,f=new Uint8Array(t),h=0,p=0,d="",m=0;m=5;)d+=a[p>>>h-5&31],h-=5;if(h>0&&(d+=a[p<<5-h&31]),l)for(;d.length%8!=0;)d+="=";return d}},function(e,t,n){ +var r,i,o;r="prr",i=this,o=function(){var e="function"==typeof Object.defineProperty?function(e,t,n){return Object.defineProperty(e,t,n),e}:function(e,t,n){return e[t]=n.value,e},t=function(e,t){var n="object"==typeof t,r=!n&&"string"==typeof t,i=function(e){return n?!!t[e]:!!r&&t.indexOf(e[0])>-1};return{enumerable:i("enumerable"),configurable:i("configurable"),writable:i("writable"),value:e}},n=function(n,r,i,o){var s;if(o=t(i,o),"object"==typeof r){for(s in r)Object.hasOwnProperty.call(r,s)&&(o.value=r[s],e(n,s,o));return n}return e(n,r,o)};return n},e.exports?e.exports=o():i.prr=o()},function(e,t,n){"use strict";var r=n(264).AbstractLevelDOWN,i=n(264).AbstractChainedBatch,o=n(264).AbstractIterator,s=n(1),a=n(860),l=n(263).EncodingError;function u(e,t){if(!(this instanceof u))return new u(e,t);r.call(this,""),t=t||{},void 0===t.keyEncoding&&(t.keyEncoding="utf8"),void 0===t.valueEncoding&&(t.valueEncoding="utf8"),this.db=e,this.codec=new a(t)}function c(e,t){o.call(this,e),this.codec=e.codec,this.keys=t.keys,this.values=t.values,this.opts=this.codec.encodeLtgt(t),this.it=e.db.iterator(this.opts)}function h(e,t){i.call(this,e),this.codec=e.codec,this.batch=e.db.batch()}e.exports=u.default=u,s(u,r),u.prototype._serializeKey=u.prototype._serializeValue=function(e){return e},u.prototype._open=function(e,t){this.db.open(e,t)},u.prototype._close=function(e){this.db.close(e)},u.prototype._put=function(e,t,n,r){e=this.codec.encodeKey(e,n),t=this.codec.encodeValue(t,n),this.db.put(e,t,n,r)},u.prototype._get=function(e,t,n){var r=this;e=this.codec.encodeKey(e,t),t.asBuffer=this.codec.valueAsBuffer(t),this.db.get(e,t,function(e,i){if(e)return n(e);try{i=r.codec.decodeValue(i,t)}catch(e){return n(new l(e))}n(null,i)})},u.prototype._del=function(e,t,n){e=this.codec.encodeKey(e,t),this.db.del(e,t,n)},u.prototype._chainedBatch=function(){return new h(this)},u.prototype._batch=function(e,t,n){e=this.codec.encodeBatch(e,t),this.db.batch(e,t,n)},u.prototype._iterator=function(e){return e.keyAsBuffer=this.codec.keyAsBuffer(e),e.valueAsBuffer=this.codec.valueAsBuffer(e),new c(this,e)},u.prototype.approximateSize=function(e,t,n,r){return e=this.codec.encodeKey(e,n),t=this.codec.encodeKey(t,n),this.db.approximateSize(e,t,n,r)},s(c,o),c.prototype._next=function(e){var t=this;this.it.next(function(n,r,i){if(n)return e(n);try{r=t.keys&&void 0!==r?t.codec.decodeKey(r,t.opts):void 0,i=t.values&&void 0!==i?t.codec.decodeValue(i,t.opts):void 0}catch(n){return e(new l(n))}e(null,r,i)})},c.prototype._seek=function(e){e=this.codec.encodeKey(e,this.opts),this.it.seek(e)},c.prototype._end=function(e){this.it.end(e)},s(h,i),h.prototype._put=function(e,t){e=this.codec.encodeKey(e),t=this.codec.encodeValue(t),this.batch.put(e,t)},h.prototype._del=function(e){e=this.codec.encodeKey(e),this.batch.del(e)},h.prototype._clear=function(){this.batch.clear()},h.prototype._write=function(e,t){this.batch.write(e,t)}},function(e,t,n){(function(t,r){var i=n(68),o=n(418),s=n(419),a=Object.prototype.hasOwnProperty,l="start end gt gte lt lte".split(" ");function u(){this.status="new"}function c(e,t){var n={};for(var r in t)if(a.call(t,r)){var i=t[r];h(r)&&(i=e._serializeKey(i)),n[r]=i}return n}function h(e){return-1!==l.indexOf(e)}u.prototype.open=function(e,t){var n=this,r=this.status;if("function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("open() requires a callback argument");"object"==typeof e&&null!==e||(e={}),e.createIfMissing=!1!==e.createIfMissing,e.errorIfExists=!!e.errorIfExists,this.status="opening",this._open(e,function(e){if(e)return n.status=r,t(e);n.status="open",t()})},u.prototype._open=function(e,n){t.nextTick(n)},u.prototype.close=function(e){var t=this,n=this.status;if("function"!=typeof e)throw new Error("close() requires a callback argument");this.status="closing",this._close(function(r){if(r)return t.status=n,e(r);t.status="closed",e()})},u.prototype._close=function(e){t.nextTick(e)},u.prototype.get=function(e,n,r){if("function"==typeof n&&(r=n),"function"!=typeof r)throw new Error("get() requires a callback argument");var i=this._checkKey(e);if(i)return t.nextTick(r,i);e=this._serializeKey(e),"object"==typeof n&&null!==n||(n={}),n.asBuffer=!1!==n.asBuffer,this._get(e,n,r)},u.prototype._get=function(e,n,r){t.nextTick(function(){r(new Error("NotFound"))})},u.prototype.put=function(e,n,r,i){if("function"==typeof r&&(i=r),"function"!=typeof i)throw new Error("put() requires a callback argument");var o=this._checkKey(e)||this._checkValue(n);if(o)return t.nextTick(i,o);e=this._serializeKey(e),n=this._serializeValue(n),"object"==typeof r&&null!==r||(r={}),this._put(e,n,r,i)},u.prototype._put=function(e,n,r,i){t.nextTick(i)},u.prototype.del=function(e,n,r){if("function"==typeof n&&(r=n),"function"!=typeof r)throw new Error("del() requires a callback argument");var i=this._checkKey(e);if(i)return t.nextTick(r,i);e=this._serializeKey(e),"object"==typeof n&&null!==n||(n={}),this._del(e,n,r)},u.prototype._del=function(e,n,r){t.nextTick(r)},u.prototype.batch=function(e,n,r){if(!arguments.length)return this._chainedBatch();if("function"==typeof n&&(r=n),"function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return t.nextTick(r,new Error("batch(array) requires an array argument"));if(0===e.length)return t.nextTick(r);"object"==typeof n&&null!==n||(n={});for(var o=new Array(e.length),s=0;s-1?t.encodeKey(e[r],e):e[r]}),n},i.prototype.createStreamDecoder=function(e){var t=this;return e.keys&&e.values?function(n,r){return{key:t.decodeKey(n,e),value:t.decodeValue(r,e)}}:e.keys?function(n){return t.decodeKey(n,e)}:e.values?function(n,r){return t.decodeValue(r,e)}:function(){}},i.prototype.keyAsBuffer=function(e){return this._keyEncoding(e).buffer},i.prototype.valueAsBuffer=function(e){return this._valueEncoding(e).buffer}},function(e,t,n){(function(e){t.utf8=t["utf-8"]={encode:function(e){return i(e)?e:String(e)},decode:r,buffer:!1,type:"utf8"},t.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},t.binary={encode:function(t){return i(t)?t:e.from(t)},decode:r,buffer:!0,type:"binary"},t.none={encode:r,decode:r,buffer:!1,type:"id"},t.id=t.none;var n=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];function r(e){return e}function i(t){return void 0===t||null===t||e.isBuffer(t)}n.forEach(function(n){t[n]={encode:function(t){return i(t)?t:e.from(t,n)},decode:function(e){return e.toString(n)},buffer:!0,type:n}})}).call(this,n(0).Buffer)},function(e,t,n){(function(t,r){e.exports=l;var i=n(420).AbstractLevelDOWN,o=n(14),s=n(864),a=n(68);function l(e){if(!(this instanceof l))return new l(e);i.call(this,e)}o.inherits(l,i),l.prototype._open=function(e,t){var n=this;if(this._idbOpts=a({storeName:this.location,keyEncoding:"none",valueEncoding:"none"},e),this._idbOpts.idb)o(this._idbOpts.idb);else{var r=indexedDB.open(this.location);r.onerror=i,r.onsuccess=function(){o(r.result)}}function i(e){t(e.target.error)}function o(r){n._db=r;var i=n._db.objectStoreNames.contains(n._idbOpts.storeName);if(e.errorIfExists&&i)return n._db.close(),void t(new Error("store already exists"));if(!e.createIfMissing&&!i)return n._db.close(),void t(new Error("store does not exist"));if(e.createIfMissing&&!i){n._db.close();var o=indexedDB.open(n.location,n._db.version+1);return o.onerror=function(e){t(e.target.error)},o.onupgradeneeded=function(){var e=o.result;e.createObjectStore(n._idbOpts.storeName,n._idbOpts)},void(o.onsuccess=function(){n._db=o.result,t(null,n)})}t(null,n)}},l.prototype._get=function(e,n,r){n=a(this._idbOpts,n);var i=e;"binary"!==n.keyEncoding||Array.isArray(e)||(e=Array.prototype.slice.call(e));var o=this._db.transaction(this._idbOpts.storeName),s=o.objectStore(this._idbOpts.storeName).openCursor(IDBKeyRange.only(e));o.onabort=function(){r(o.error)},s.onsuccess=function(){var e=s.result;if(e){var o=e.value;if(o instanceof Uint8Array&&(o=new t(o)),"binary"!==n.valueEncoding||t.isBuffer(o)||(o=new t(o)),n.asBuffer&&!t.isBuffer(o))if(null==o)o=new t(0);else if("string"==typeof o)o=new t(o);else if("boolean"==typeof o)o=new t(String(o));else if("number"==typeof o)o=new t(String(o));else if(Array.isArray(o))o=new t(String(o));else{if(!(o instanceof Uint8Array))return void r(new TypeError("can't coerce `"+o.constructor.name+"` into a Buffer"));o=new t(o)}r(null,o,i)}else r(new Error("NotFound"))}},l.prototype._del=function(e,t,n){t=a(this._idbOpts,t),"binary"!==t.keyEncoding||Array.isArray(e)||(e=Array.prototype.slice.call(e));var r="readwrite";!0===t.sync&&(r="readwriteflush");var i=this._db.transaction(this._idbOpts.storeName,r),o=i.objectStore(this._idbOpts.storeName).delete(e);i.onabort=function(){n(i.error)},i.oncomplete=function(){n()}},l.prototype._put=function(e,t,n,r){n=a(this._idbOpts,n),"binary"!==n.keyEncoding||Array.isArray(e)||(e=Array.prototype.slice.call(e));var i="readwrite";!0===n.sync&&(i="readwriteflush");var o=this._db.transaction(this._idbOpts.storeName,i),s=o.objectStore(this._idbOpts.storeName).put(t,e);o.onabort=function(){r(o.error)},o.oncomplete=function(){r()}},l.prototype._iterator=function(e){return new s(this,e)},l.prototype._batch=function(e,t,n){if(0===e.length)return r.nextTick(n);var i="readwrite";!0===t.sync&&(i="readwriteflush");var o=this._db.transaction(this._idbOpts.storeName,i),s=o.objectStore(this._idbOpts.storeName);o.onabort=function(){n(o.error)},o.oncomplete=function(){n()},e.forEach(function(e){var n=a(t,e);"binary"!==n.keyEncoding||Array.isArray(e.key)||(e.key=Array.prototype.slice.call(e.key)),"del"===e.type?s.delete(e.key):s.put(e.value,e.key)})},l.prototype._close=function(e){this._db.close(),r.nextTick(e)},l.prototype._approximateSize=function(e,t,n){var i=new Error("Not implemented");if(!n)throw i;r.nextTick(function(){n(i)})},l.destroy=function(e,t){var n;if(null!=e&&"object"==typeof e)n=a({location:e.location,storeName:e.location},e._idbOpts);else{if("string"!=typeof e)throw new TypeError("location must be a string or an object");n={location:e,storeName:e}}if("string"!=typeof n.location)throw new TypeError("location must be a string");if("string"!=typeof n.storeName)throw new TypeError("db.storeName must be a string");var r=indexedDB.open(n.location);r.onerror=function(e){t(e.target.error)},r.onsuccess=function(){var e=r.result;function i(e){var n=indexedDB.deleteDatabase(e);n.onerror=function(e){t(e.target.error)},n.onsuccess=function(){t()}}if(e.close(),0!==e.objectStoreNames.length)if(e.objectStoreNames.contains(n.storeName)){var o=indexedDB.open(n.location,e.version+1);o.onerror=function(e){t(e.target.error)},o.onupgradeneeded=function(){e=o.result,e.deleteObjectStore(n.storeName)},o.onsuccess=function(){e=o.result,e.close(),0===e.objectStoreNames.length?i(n.location):t()}}else t();else i(n.location)}}}).call(this,n(0).Buffer,n(3))},function(e,t,n){var r=n(421);function i(e){return!(!e||"object"!=typeof e)&&Object.keys(r.prototype).filter(function(e){return"_"!=e[0]&&"approximateSize"!=e}).every(function(t){return"function"==typeof e[t]})}e.exports=i},function(e,t,n){(function(t,r){var i=n(14),o=n(420).AbstractIterator,s=n(865),a=n(866),l=n(62),u=n(68),c=l.Writable;function h(e,t){if(this._db=e._db,this._idbOpts=e._idbOpts,o.call(this,e),this._options=u({snapshot:!0},this._idbOpts,t),this._limit=this._options.limit,null!=this._limit&&-1!==this._limit||(this._limit=1/0),"number"!=typeof this._limit)throw new TypeError("options.limit must be a number");0!==this._limit&&(this._count=0,this._startCursor(this._options))}e.exports=h,i.inherits(h,o),h.prototype._startCursor=function(e){e=u(this._options,e);var t=this,n=null,r=s.lowerBound(e),i=s.upperBound(e),o=s.lowerBoundExclusive(e),l=s.upperBoundExclusive(e),h=e.reverse?"prev":"next";if(r&&("binary"!==e.keyEncoding||Array.isArray(r)||(r=Array.prototype.slice.call(r))),i&&("binary"!==e.keyEncoding||Array.isArray(i)||(i=Array.prototype.slice.call(i))),r&&i)try{n=IDBKeyRange.bound(r,i,o,l)}catch(e){return void(this._keyRangeError=!0)}else r?n=IDBKeyRange.lowerBound(r,o):i&&(n=IDBKeyRange.upperBound(i,l));this._reader=a(this._db,this._idbOpts.storeName,u(e,{range:n,direction:h})),this._reader.on("error",function(e){var n=t._callback;t._callback=!1,n?n(e):t._readNext=function(t){t(e)}}),this._reader.pipe(new c({objectMode:!0,write:function(e,n,r){if(t._count++>=t._limit)return t._reader.pause(),t._reader.unpipe(this),r(),void this.end();var i=t._callback;t._callback=!1,i?t._processItem(e,function(e,t,n){r(e),i(e,t,n)}):t._readNext=function(n){t._processItem(e,function(e,t,i){r(e),n(e,t,i)})}}})).on("finish",function(){var e=t._callback;t._callback=!1,e?e():t._readNext=function(e){e()}})},h.prototype._processItem=function(e,n){if("function"!=typeof n)throw new TypeError("cb must be a function");var r=e.key,i=e.value;if(i instanceof Uint8Array&&(i=new t(i)),"binary"===this._options.keyEncoding&&Array.isArray(r)&&(r=new t(r)),"binary"!==this._options.valueEncoding||t.isBuffer(i)||(i=new t(i)),this._options.keyAsBuffer&&!t.isBuffer(r))if(null==r)r=new t(0);else if("string"==typeof r)r=new t(r);else if("boolean"==typeof r)r=new t(String(r));else if("number"==typeof r)r=new t(String(r));else if(Array.isArray(r))r=new t(String(r));else{if(!(r instanceof Uint8Array))throw new TypeError("can't coerce `"+r.constructor.name+"` into a Buffer");r=new t(r)}if(this._options.valueAsBuffer&&!t.isBuffer(i))if(null==i)i=new t(0);else if("string"==typeof i)i=new t(i);else if("boolean"==typeof i)i=new t(String(i));else if("number"==typeof i)i=new t(String(i));else if(Array.isArray(i))i=new t(String(i));else{if(!(i instanceof Uint8Array))throw new TypeError("can't coerce `"+i.constructor.name+"` into a Buffer");i=new t(i)}n(null,r,i)},h.prototype._next=function(e){if(this._callback)throw new Error("callback already exists");if(this._keyRangeError||0===this._limit)e();else{var t=this._readNext;this._readNext=!1,t?r.nextTick(function(){t(e)}):this._callback=e}}}).call(this,n(0).Buffer,n(3))},function(e,t,n){(function(e){function n(e){return void 0!==e&&""!==e}function r(e,t){return Object.hasOwnProperty.call(e,t)}function i(e,t){return Object.hasOwnProperty.call(e,t)&&t}t.compare=function(t,n){if(e.isBuffer(t)){for(var r=Math.min(t.length,n.length),i=0;in?1:0};var o=t.lowerBoundKey=function(e){return i(e,"gt")||i(e,"gte")||i(e,"min")||(e.reverse?i(e,"end"):i(e,"start"))||void 0},s=t.lowerBound=function(e,t){var n=o(e);return n?e[n]:t},a=t.lowerBoundInclusive=function(e){return!r(e,"gt")},l=t.upperBoundInclusive=function(e){return!r(e,"lt")},u=t.lowerBoundExclusive=function(e){return!a(e)},c=t.upperBoundExclusive=function(e){return!l(e)},h=t.upperBoundKey=function(e){return i(e,"lt")||i(e,"lte")||i(e,"max")||(e.reverse?i(e,"start"):i(e,"end"))||void 0},f=t.upperBound=function(e,t){var n=h(e);return n?e[n]:t};function p(e){return e}t.start=function(e,t){return e.reverse?f(e,t):s(e,t)},t.end=function(e,t){return e.reverse?s(e,t):f(e,t)},t.startInclusive=function(e){return e.reverse?l(e):a(e)},t.endInclusive=function(e){return e.reverse?a(e):l(e)},t.toLtgt=function(e,n,i,o,s){n=n||{},i=i||p;var a=arguments.length>3,l=t.lowerBoundKey(e),u=t.upperBoundKey(e);return l?"gt"===l?n.gt=i(e.gt,!1):n.gte=i(e[l],!1):a&&(n.gte=i(o,!1)),u?"lt"===u?n.lt=i(e.lt,!0):n.lte=i(e[u],!0):a&&(n.lte=i(s,!0)),null!=e.reverse&&(n.reverse=!!e.reverse),r(n,"max")&&delete n.max,r(n,"min")&&delete n.min,r(n,"start")&&delete n.start,r(n,"end")&&delete n.end,n},t.contains=function(e,r,i){i=i||t.compare;var o=s(e);if(n(o)){var a=i(r,o);if(a<0||0===a&&u(e))return!1}var l=f(e);if(n(l)){var a=i(r,l);if(a>0||0===a&&c(e))return!1}return!0},t.filter=function(e,n){return function(r){return t.contains(e,r,n)}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(62),i=n(68);function o(e,t,n){if("object"!=typeof e)throw new TypeError("db must be an object");if("string"!=typeof t)throw new TypeError("storeName must be a string");if(null==n&&(n={}),"object"!=typeof n)throw new TypeError("opts must be an object");var o=new r.Transform(i(n,{objectMode:!0,transform:function(e,t,n){n(null,e)}}));n=i({snapshot:!1},n);var s=null;function a(){var r,i,l,u,c=n.direction||"next",h=n.range||{},f;r=h.lower,i=h.upper,l=!!h.lowerOpen,u=!!h.upperOpen,s&&("next"===c?(l=!0,r=s):(u=!0,i=s)),r&&i?f=IDBKeyRange.bound(r,i,l,u):r?f=IDBKeyRange.lowerBound(r,l):i&&(f=IDBKeyRange.upperBound(i,u));var p=e.transaction(t,"readonly"),d=p.objectStore(t);o._cursorsOpened++;var m=d.openCursor(f,n.direction);function g(e){try{e.continue()}catch(e){"TransactionInactiveError"!==e.name||n.snapshot?o.emit("error",e):a()}}m.onsuccess=function(){var e=m.result;if(e){s=e.key;var t=o.write({key:e.key,value:e.value});n.snapshot||t?g(e):o.once("drain",function(){g(e)})}else o.end()},p.onabort=function(){o.emit("error",p.error)},p.onerror=function(){o.emit("error",p.error)}}return o._cursorsOpened=0,a(),o}e.exports=o},function(e,t,n){"use strict";e.exports={Spec:{type:"mount",mounts:[{mountpoint:"/blocks",type:"measure",prefix:"flatfs.datastore",child:{type:"flatfs",path:"blocks",sync:!0,shardFunc:"/repo/flatfs/shard/v1/next-to-last/2"}},{mountpoint:"/",type:"measure",prefix:"leveldb.datastore",child:{type:"levelds",path:"datastore",compression:"none"}}]}}},function(e,t,n){"use strict";t.ERR_REPO_NOT_INITIALIZED="ERR_REPO_NOT_INITIALIZED"},function(e,t,n){"use strict";e.exports={repoVersion:7}},function(e,t,n){"use strict";t.preStart=n(871),t.start=n(886),t.stop=n(1115),t.isOnline=n(1116),t.version=n(1117),t.id=n(1118),t.repo=n(484),t.init=n(1119),t.bootstrap=n(1122),t.config=n(1123),t.block=n(1124),t.object=n(1125),t.dag=n(1126),t.libp2p=n(439),t.swarm=n(1128),t.ping=n(1129),t.pingPullStream=n(1130),t.pingReadableStream=n(1131),t.pin=n(1132),t.filesRegular=n(1140),t.filesMFS=n(1194),t.bitswap=n(507),t.pubsub=n(1242),t.dht=n(1243),t.dns=n(1246),t.key=n(1248),t.stats=n(1249),t.resolve=n(1250),t.name=n(1252)},function(e,t,n){"use strict";const r=n(15),i=n(31),o=n(22),s=n(10),a=n(425),l=n(89),u=n(885);e.exports=function e(t){return e=>{t.log("pre-start");const n=t._options.pass;s([e=>t._repo.config.get(e),(e,n)=>{if(!t._options.config)return n(null,e);e=l(e,t._options.config),t.config.replace(e,t=>{if(t)return n(t);n(null,e)})},(e,n)=>{if(e.Keychain)return n(null,e);e.Keychain=a.generateOptions(),t.config.set("Keychain",e.Keychain,r=>{t.log("using default keychain options"),n(r,e)})},(e,r)=>{if(t._keychain);else if(n){const r=Object.assign({passPhrase:n},e.Keychain);t._keychain=new a(t._repo.keys,r),t.log("keychain constructed")}else t._keychain=new u,t.log("no keychain, use --pass");r(null,e)},(e,t)=>{const n=e.Identity.PrivKey;r.createFromPrivKey(n,(n,r)=>{t(n,e,r)})},(e,r,i)=>{if(!n)return i(null,e,r);t._keychain.findKeyByName("self",n=>{if(n)return t.log('Creating "self" key'),t._keychain.importPeer("self",r,t=>i(t,e,r));i(null,e,r)})},(e,n,r)=>{t.log("peer created"),t._peerInfo=new i(n),e.Addresses&&e.Addresses.Swarm&&e.Addresses.Swarm.forEach(e=>{let n=o(e);n.getPeerId()&&(n=n.encapsulate("/ipfs/"+t._peerInfo.id.toB58String())),t._peerInfo.multiaddrs.add(n)}),r()},e=>t.pin._load(e)],e)}}},function(e,t,n){"use strict";const r=n(873),i=n(89),o=n(51),s=n(28),a=n(33),l=n(12),u=n(877),c=n(13),h="/pkcs8/",f="/info/",p={minKeyLength:14,minSaltLength:16,minIterationCount:1e3},d={dek:{keyLength:64,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function m(e){return!!e&&("string"==typeof e&&e===r(e.trim()))}function g(e,t){const n=200,r=1e3,i=800*Math.random()+200;setTimeout(e,i,t,null)}function y(e){return new s.Key(h+e)}function v(e){return new s.Key(f+e)}class b{constructor(e,t){if(!e)throw new Error("store is required");this.store=e;const n=i(d,t);if(!n.passPhrase||n.passPhrase.length<20)throw new Error("passPhrase must be least 20 characters");if(n.dek.keyLengthr})}get cms(){return new u(this)}static generateOptions(){const e=Object.assign({},d),t=3*Math.ceil(p.minSaltLength/3);return e.dek.salt=o.randomBytes(t).toString("base64"),e}static get options(){return d}createKey(e,t,n,r){const i=this;if(!m(e)||"self"===e)return g(r,c(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if("string"!=typeof t)return g(r,c(new Error(`Invalid key type '${t}'`),"ERR_INVALID_KEY_TYPE"));if(!Number.isSafeInteger(n))return g(r,c(new Error(`Invalid key size '${n}'`),"ERR_INVALID_KEY_SIZE"));const s=y(e);i.store.has(s,(a,l)=>{if(a)return g(r,a);if(l)return g(r,c(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS"));switch(t.toLowerCase()){case"rsa":if(n<2048)return g(r,c(new Error(`Invalid RSA key size ${n}`),"ERR_INVALID_KEY_SIZE"))}o.keys.generateKeyPair(t,n,(t,n)=>{if(t)return g(r,t);n.id((t,o)=>{if(t)return g(r,t);n.export(this._(),(t,n)=>{if(t)return g(r,t);const a={name:e,id:o},l=i.store.batch();l.put(s,n),l.put(v(e),JSON.stringify(a)),l.commit(e=>{if(e)return g(r,e);r(null,a)})})})})})}listKeys(e){const t=this,n={prefix:f};l(this.store.query(n),a((t,n)=>{if(t)return g(e,t);const r=n.map(e=>JSON.parse(e.value));e(null,r)}))}findKeyById(e,t){this.listKeys((n,r)=>{if(n)return g(t,n);const i=r.find(t=>t.id===e);t(null,i)})}findKeyByName(e,t){if(!m(e))return g(t,c(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));const n=v(e);this.store.get(n,(n,r)=>{if(n)return g(t,c(new Error(`Key '${e}' does not exist. ${n.message}`),"ERR_KEY_NOT_FOUND"));t(null,JSON.parse(r.toString()))})}removeKey(e,t){const n=this;if(!m(e)||"self"===e)return g(t,c(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));const r=y(e);n.findKeyByName(e,(i,o)=>{if(i)return g(t,i);const s=n.store.batch();s.delete(r),s.delete(v(e)),s.commit(e=>{if(e)return g(t,e);t(null,o)})})}renameKey(e,t,n){const r=this;if(!m(e)||"self"===e)return g(n,c(new Error(`Invalid old key name '${e}'`),"ERR_OLD_KEY_NAME_INVALID"));if(!m(t)||"self"===t)return g(n,c(new Error(`Invalid new key name '${t}'`),"ERR_NEW_KEY_NAME_INVALID"));const i=y(e),o=y(t),s=v(e),a=v(t);this.store.get(i,(l,u)=>{if(l)return g(n,c(new Error(`Key '${e}' does not exist. ${l.message}`),"ERR_KEY_NOT_FOUND"));const h=u.toString();r.store.has(o,(e,l)=>e?g(n,e):l?g(n,c(new Error(`Key '${t}' already exists`),"ERR_KEY_ALREADY_EXISTS")):void r.store.get(s,(e,l)=>{if(e)return g(n,e);const u=JSON.parse(l.toString());u.name=t;const c=r.store.batch();c.put(o,h),c.put(a,JSON.stringify(u)),c.delete(i),c.delete(s),c.commit(e=>{if(e)return g(n,e);n(null,u)})}))})}exportKey(e,t,n){if(!m(e))return g(n,c(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!t)return g(n,c(new Error("Password is required"),"ERR_PASSWORD_REQUIRED"));const r=y(e);this.store.get(r,(r,i)=>{if(r)return g(n,c(new Error(`Key '${e}' does not exist. ${r.message}`),"ERR_KEY_NOT_FOUND"));const s=i.toString();o.keys.import(s,this._(),(e,r)=>{if(e)return g(n,e);r.export(t,n)})})}importKey(e,t,n,r){const i=this;if(!m(e)||"self"===e)return g(r,c(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!t)return g(r,"PEM encoded key is required");const s=y(e);i.store.has(s,(a,l)=>a?g(r,a):l?g(r,c(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS")):void o.keys.import(t,n,(t,n)=>{if(t)return g(r,c(new Error("Cannot read the key, most likely the password is wrong"),"ERR_CANNOT_READ_KEY"));n.id((t,o)=>{if(t)return g(r,t);n.export(this._(),(t,n)=>{if(t)return g(r,t);const a={name:e,id:o},l=i.store.batch();l.put(s,n),l.put(v(e),JSON.stringify(a)),l.commit(e=>{if(e)return g(r,e);r(null,a)})})})}))}importPeer(e,t,n){const r=this;if(!m(e))return g(n,c(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!t||!t.privKey)return g(n,c(new Error("Peer.privKey is required"),"ERR_MISSING_PRIVATE_KEY"));const i=t.privKey,o=y(e);r.store.has(o,(t,s)=>t?g(n,t):s?g(n,c(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS")):void i.id((t,s)=>{if(t)return g(n,t);i.export(this._(),(t,i)=>{if(t)return g(n,t);const a={name:e,id:s},l=r.store.batch();l.put(o,i),l.put(v(e),JSON.stringify(a)),l.commit(e=>{if(e)return g(n,e);n(null,a)})})}))}_getPrivateKey(e,t){if(!m(e))return g(t,c(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));this.store.get(y(e),(n,r)=>{if(n)return g(t,c(new Error(`Key '${e}' does not exist. ${n.message}`),"ERR_KEY_NOT_FOUND"));t(null,r.toString())})}}e.exports=b},function(e,t,n){"use strict";var r=n(874),i=/[\/\?<>\\:\*\|":]/g,o=/[\x00-\x1f\x80-\x9f]/g,s=/^\.+$/,a=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,l=/[\. ]+$/;function u(e,t){var n=e.replace(i,t).replace(o,t).replace(s,t).replace(a,t).replace(l,t);return r(n,255)}e.exports=function(e,t){var n=t&&t.replacement||"",r=u(e,n);return""===n?r:u(r,"")}},function(e,t,n){"use strict";var r=n(875),i=n(876);e.exports=r.bind(null,i)},function(e,t,n){"use strict";function r(e){return e>=55296&&e<=56319}function i(e){return e>=56320&&e<=57343}e.exports=function e(t,n,o){if("string"!=typeof n)throw new Error("Input must be string");for(var s=n.length,a=0,l,u,c=0;co)return n.slice(0,c-u.length+1)}return n}},function(e,t,n){"use strict";function r(e){return e>=55296&&e<=56319}function i(e){return e>=56320&&e<=57343}e.exports=function e(t){if("string"!=typeof t)throw new Error("Input must be string");for(var n=t.length,o=0,s=null,a=null,l=0;l=128&&s<=2047?o+=2:s>=2048&&s<=65535&&(o+=3),a=s;return o}},function(e,t,n){"use strict";(function(t){const r=n(20),i=n(43),o=n(878),s=n(10);n(879),n(251);const a=n(21),l=n(884),u=n(13);class c{constructor(e){if(!e)throw u(new Error("keychain is required"),"ERR_KEYCHAIN_REQUIRED");this.keychain=e}encrypt(e,n,o){const s=this,c=(e,t)=>r(()=>o(e,t));if(!t.isBuffer(n))return c(u(new Error("Plain data must be a Buffer"),"ERR_INVALID_PARAMS"));i([t=>s.keychain.findKeyByName(e,t),t=>s.keychain._getPrivateKey(e,t)],(e,r)=>{if(e)return c(e);let i=r[0],u=r[1];try{const r=a.pki.decryptRsaPrivateKey(u,s.keychain._());l.certificateForKey(i,r,(e,r)=>{if(e)return o(e);const i=a.pkcs7.createEnvelopedData();i.addRecipient(r),i.content=a.util.createBuffer(n),i.encrypt();const s=a.asn1.toDer(i.toAsn1()).getBytes();c(null,t.from(s,"binary"))})}catch(e){c(e)}})}decrypt(e,n){const i=(e,t)=>r(()=>n(e,t));if(!t.isBuffer(e))return i(u(new Error("CMS data is required"),"ERR_INVALID_PARAMS"));const l=this;let c;try{const t=a.util.createBuffer(e.toString("binary")),n=a.asn1.fromDer(t);c=a.pkcs7.messageFromAsn1(n)}catch(e){return i(u(new Error("Invalid CMS: "+e.message),"ERR_INVALID_CMS"))}const h=c.recipients.filter(e=>e.issuer.find(e=>"O"===e.shortName&&"ipfs"===e.value)).filter(e=>e.issuer.find(e=>"CN"===e.shortName)).map(e=>({recipient:e,keyId:e.issuer.find(e=>"CN"===e.shortName).value}));o(h,(e,t)=>l.keychain.findKeyById(e.keyId,(e,n)=>t(null,!e&&n)),(e,n)=>{if(e)return i(e);if(!n){const t=h.map(e=>e.keyId);return e=u(new Error("Decryption needs one of the key(s): "+t.join(", ")),"ERR_MISSING_KEYS",{missingKeys:t}),i(e)}s([e=>l.keychain.findKeyById(n.keyId,e),(e,t)=>l.keychain._getPrivateKey(e.name,t)],(e,r)=>{if(e)return i(e);const o=a.pki.decryptRsaPrivateKey(r,l.keychain._());c.decrypt(n.recipient,o),i(null,t.from(c.content.getBytes(),"binary"))})})}}e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(156),i=h(r),o=n(157),s=h(o),a=n(110),l=h(a),u=n(426),c=h(u);function h(e){return e&&e.__esModule?e:{default:e}}t.default=(0,l.default)((0,s.default)(i.default,c.default)),e.exports=t.default},function(e,t,n){var r=n(21);n(196),n(117),n(252),n(152),n(253),n(880),n(118),n(30),n(427);var i=r.asn1,o=e.exports=r.pkcs7=r.pkcs7||{};function s(e){var t={},n=[];if(!i.validate(e,o.asn1.recipientInfoValidator,t,n)){var s=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw s.errors=n,s}return{version:t.version.charCodeAt(0),issuer:r.pki.RDNAttributesAsArray(t.issuer),serialNumber:r.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:i.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function a(e){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[r.pki.distinguishedNameToAsn1({attributes:e.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,r.util.hexToBytes(e.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.encryptedContent.algorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function l(e){for(var t=[],n=0;n0){for(var n=i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[]),o=0;o=n&&s0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,t)),o.length>0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,o)),s.value[0].value.push(i.create(i.Class.UNIVERSAL,i.Type.SET,!0,e.signerInfos)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),s])},addSigner:function(t){var n=t.issuer,i=t.serialNumber;if(t.certificate){var o=t.certificate;"string"==typeof o&&(o=r.pki.certificateFromPem(o)),n=o.issuer.attributes,i=o.serialNumber}var s=t.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof s&&(s=r.pki.privateKeyFromPem(s));var a=t.digestAlgorithm||r.pki.oids.sha1;switch(a){case r.pki.oids.sha1:case r.pki.oids.sha256:case r.pki.oids.sha384:case r.pki.oids.sha512:case r.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+a)}var l=t.authenticatedAttributes||[];if(l.length>0){for(var u=!1,c=!1,h=0;h>8*h-c&255;return _=String.fromCharCode(_.charCodeAt(0)&~w)+_.substr(1),_+m+String.fromCharCode(188)},verify:function(e,o,a){var l,u=a-1,c=Math.ceil(u/8);if(o=o.substr(-c),c>8*c-u&255;if(0!=(f.charCodeAt(0)&d))throw new Error("Bits beyond keysize not zero as expected.");var m=n.generate(p,h),g="";for(l=0;l{const r=i.setRsaPublicKey(t.n,t.e),o=i.createCertificate();o.publicKey=r,o.serialNumber="01",o.validity.notBefore=new Date,o.validity.notAfter=new Date,o.validity.notAfter.setFullYear(o.validity.notBefore.getFullYear()+10);const s=[{name:"organizationName",value:"ipfs"},{shortName:"OU",value:"keystore"},{name:"commonName",value:e.id}];return o.setSubject(s),o.setIssuer(s),o.setExtensions([{name:"basicConstraints",cA:!0},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0,codeSigning:!0,emailProtection:!0,timeStamping:!0},{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0,sslCA:!0,emailCA:!0,objCA:!0}]),o.sign(t),n(null,o)})},function(e,t,n){"use strict";function r(){throw new Error("Key management requires '--pass ...' option")}class i{static get options(){r()}static generateOptions(){r()}createKey(){r()}listKeys(){r()}findKeyById(){r()}findKeyByName(){r()}renameKey(){r()}removeKey(){r()}exportKey(){r()}importKey(){r()}importPeer(){r()}get cms(){r()}}e.exports=i},function(e,t,n){"use strict";const r=n(43),i=n(887),o=n(20),s=n(2),a=n(432),l=n(913),u=n(439);e.exports=(e=>s(t=>{const n=n=>{if(n)return o(()=>e.emit("error",n)),t(n);e.state.started(),o(()=>e.emit("start")),t()};if("stopped"!==e.state.state())return n(new Error(`Not able to start from state: ${e.state.state()}`));e.log("starting"),e.state.start(),r([t=>{e._repo.closed?e._repo.open(t):t()},t=>{e._repo.config.get((n,r)=>{if(n)return t(n);const i=u(e,r);i.start(n=>{if(n)return t(n);e.libp2p=i,t()})})},t=>{const n=l(e);e._ipns=new a(n,e._repo.datastore,e._peerInfo,e._keychain,e._options),e._bitswap=new i(e.libp2p,e._repo.blocks,{statsEnabled:!0}),e._bitswap.start(),e._blockService.setExchange(e._bitswap),e._preload.start(),e._ipns.republisher.start(),e._mfsPreload.start(t)}],n)}))},function(e,t,n){"use strict";const r=n(10),i=n(410),o=n(38),s=n(43),a=n(59),l=n(47),u=n(888),c=n(895),h=n(899),f=n(901),p=n(100).logger,d=n(902),m={statsEnabled:!1,statsComputeThrottleTimeout:1e3,statsComputeThrottleMaxQueueSize:1e3},g=["blocksReceived","dataReceived","dupBlksReceived","dupDataReceived","blocksSent","dataSent","providesBufferLength","wantListLength","peerCount"];class y{constructor(e,t,n){this._libp2p=e,this._log=p(this.peerInfo.id),this._options=Object.assign({},m,n),this._stats=new d(g,{enabled:this._options.statsEnabled,computeThrottleTimeout:this._options.statsComputeThrottleTimeout,computeThrottleMaxQueueSize:this._options.statsComputeThrottleMaxQueueSize}),this.network=new c(e,this,{},this._stats),this.blockstore=t,this.engine=new h(this.peerInfo.id,t,this.network,this._stats),this.wm=new u(this.peerInfo.id,this.network,this._stats),this.notifications=new f(this.peerInfo.id)}get peerInfo(){return this._libp2p.peerInfo}_receiveMessage(e,t,n){this.engine.messageReceived(e,t,r=>{if(r&&this._log("failed to receive message",t),0===t.blocks.size)return n();const i=Array.from(t.blocks.values()),s=i.filter(e=>this.wm.wantlist.contains(e.cid)).map(e=>e.cid);this.wm.cancelWants(s),o(i,(t,n)=>this._handleReceivedBlock(e,t,n),n)})}_handleReceivedBlock(e,t,n){this._log("received block"),r([e=>this.blockstore.has(t.cid,e),(n,r)=>{if(this._updateReceiveCounters(e.toB58String(),t,n),n)return l(r);this._putBlock(t,r)}],n)}_updateReceiveCounters(e,t,n){this._stats.push(e,"blocksReceived",1),this._stats.push(e,"dataReceived",t.data.length),n&&(this._stats.push(e,"dupBlksReceived",1),this._stats.push(e,"dupDataReceived",t.data.length))}_receiveError(e){this._log.error("ReceiveError: %s",e.message)}_onPeerConnected(e){this.wm.connected(e)}_onPeerDisconnected(e){this.wm.disconnected(e),this.engine.peerDisconnected(e),this._stats.disconnected(e)}_putBlock(e,t){this.blockstore.put(e,n=>{if(n)return t(n);this.notifications.hasBlock(e),this.network.provide(e.cid,e=>{e&&this._log.error("Failed to provide: %s",e.message)}),this.engine.receivedBlocks([e.cid]),t()})}enableStats(){this._stats.enable()}disableStats(){this._stats.disable()}wantlistForPeer(e){return this.engine.wantlistForPeer(e)}ledgerForPeer(e){return this.engine.ledgerForPeer(e)}get(e,t){this.getMany([e],(e,n)=>{if(e)return t(e);n&&n.length>0?t(null,n[0]):t()})}getMany(e,t){let n=e.length;const i=[];let o=!1;const s=(e,t)=>{i.push(e),this.notifications.wantBlock(e,n=>{this.wm.cancelWants([e]),t(null,n)},()=>{this.wm.cancelWants([e]),t(null,void 0)}),n||this.wm.wantBlocks(i)};a(e,(t,a)=>{r([e=>this.blockstore.has(t,e),(r,a)=>{if(n--,r)return n||this.wm.wantBlocks(i),this.blockstore.get(t,a);o||(o=!0,this.network.findAndConnect(e[0],e=>{e&&this._log.error(e)})),s(t,a)}],a)},t)}unwant(e){Array.isArray(e)||(e=[e]),this.wm.unwantBlocks(e),e.forEach(e=>this.notifications.unwantBlock(e))}cancelWants(e){Array.isArray(e)||(e=[e]),this.wm.cancelWants(e)}put(e,t){this._log("putting block"),r([t=>this.blockstore.has(e.cid,t),(t,n)=>{if(t)return l(n);this._putBlock(e,n)}],t)}putMany(e,t){r([t=>i(e,(e,t)=>{this.blockstore.has(e.cid,t)},t),(e,t)=>this.blockstore.putMany(e,n=>{if(n)return t(n);e.forEach(e=>{this.notifications.hasBlock(e),this.engine.receivedBlocks([e.cid]),this.network.provide(e.cid,e=>{e&&this._log.error("Failed to provide: %s",e.message)})}),t()})],t)}getWantlist(){return this.wm.wantlist.entries()}peers(){return this.engine.peers()}stat(){return this._stats}start(e){s([e=>this.wm.start(e),e=>this.network.start(e),e=>this.engine.start(e)],e)}stop(e){this._stats.stop(),s([e=>this.wm.stop(e),e=>this.network.stop(e),e=>this.engine.stop(e)],e)}}e.exports=y},function(e,t,n){"use strict";const r=n(47),i=n(206),o=n(207),s=n(265),a=n(894),l=n(100).logger;e.exports=class e{constructor(e,t,n){this.peers=new Map,this.wantlist=new o(n),this.network=t,this._stats=n,this._peerId=e,this._log=l(e,"want")}_addEntries(e,t,n){const r=e.map((e,n)=>new i.Entry(e,s.kMaxPriority-n,t));r.forEach(e=>{e.cancel?n?this.wantlist.removeForce(e.cid):this.wantlist.remove(e.cid):(this._log("adding to wl"),this.wantlist.add(e.cid,e.priority))});for(let e of this.peers.values())e.addEntries(r)}_startPeerHandler(e){let t=this.peers.get(e.toB58String());if(t)return void t.refcnt++;t=new a(this._peerId,e,this.network);const n=new i(!0);for(let e of this.wantlist.entries())n.addEntry(e[1].cid,e[1].priority);return t.addMessage(n),this.peers.set(e.toB58String(),t),t}_stopPeerHandler(e){const t=this.peers.get(e.toB58String());t&&(t.refcnt--,t.refcnt>0||this.peers.delete(e.toB58String()))}wantBlocks(e){this._addEntries(e,!1)}unwantBlocks(e){this._log("unwant blocks: %s",e.length),this._addEntries(e,!0,!0)}cancelWants(e){this._log("cancel wants: %s",e.length),this._addEntries(e,!0)}connectedPeers(){return Array.from(this.peers.keys())}connected(e){this._startPeerHandler(e)}disconnected(e){this._stopPeerHandler(e)}start(e){this.timer=setInterval(()=>{this._log("resend full-wantlist");const e=new i(!0);this.wantlist.forEach(t=>{e.addEntry(t.cid,t.priority)}),this.peers.forEach(t=>t.addMessage(e))},6e4),r(()=>e())}stop(e){this.peers.forEach(e=>this.disconnected(e.peerId)),clearInterval(this.timer),r(()=>e())}}},function(e,t,n){(function(e,n){var r=200,i="__lodash_hash_undefined__",o=1,s=2,a=9007199254740991,l="[object Arguments]",u="[object Array]",c="[object Boolean]",h="[object Date]",f="[object Error]",p="[object Function]",d="[object GeneratorFunction]",m="[object Map]",g="[object Number]",y="[object Object]",v="[object Promise]",b="[object RegExp]",_="[object Set]",w="[object String]",k="[object Symbol]",E="[object WeakMap]",S="[object ArrayBuffer]",x="[object DataView]",C="[object Float32Array]",A="[object Float64Array]",T="[object Int8Array]",I="[object Int16Array]",j="[object Int32Array]",R="[object Uint8Array]",B="[object Uint8ClampedArray]",O="[object Uint16Array]",P="[object Uint32Array]",N=/[\\^$.*+?()[\]{}|]/g,D=/^\[object .+?Constructor\]$/,M=/^(?:0|[1-9]\d*)$/,F={};F[C]=F[A]=F[T]=F[I]=F[j]=F[R]=F[B]=F[O]=F[P]=!0,F[l]=F[u]=F[S]=F[c]=F[x]=F[h]=F[f]=F[p]=F[m]=F[g]=F[y]=F[b]=F[_]=F[w]=F[E]=!1;var L="object"==typeof e&&e&&e.Object===Object&&e,U="object"==typeof self&&self&&self.Object===Object&&self,q=L||U||Function("return this")(),z=t&&!t.nodeType&&t,K=z&&"object"==typeof n&&n&&!n.nodeType&&n,H=K&&K.exports===z,V=H&&L.process,$=function(){try{return V&&V.binding("util")}catch(e){}}(),W=$&&$.isTypedArray;function G(e,t){for(var n=-1,r=e?e.length:0;++n-1}function qe(e,t){var n=this.__data__,r=it(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}function ze(e){var t=-1,n=e?e.length:0;for(this.clear();++tu))return!1;var h=a.get(e);if(h&&a.get(t))return h==t;var f=-1,p=!0,d=i&o?new Ge:void 0;for(a.set(e,t),a.set(t,e);++f-1&&e%1==0&&e-1&&e%1==0&&e<=a}function jt(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Rt(e){return!!e&&"object"==typeof e}var Bt=W?Z(W):ut;function Ot(e){return xt(e)?rt(e):ct(e)}n.exports=At}).call(this,n(8),n(85)(e))},function(e,t,n){"use strict";(function(t){const r=n(35);e.exports=(e=>{if(!t.isBuffer(e))throw new Error("arg needs to be a buffer");let n=[];for(;e.length>0;){const t=r.decode(e);n.push(t),e=e.slice(r.decode.bytes)}return n})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports="\n message Message {\n message Wantlist {\n message Entry {\n // changed from string to bytes, it makes a difference in JavaScript\n optional bytes block = 1; // the block cid (cidV0 in bitswap 1.0.0, cidV1 in bitswap 1.1.0)\n optional int32 priority = 2; // the priority (normalized). default to 1\n optional bool cancel = 3; // whether this revokes an entry\n }\n\n repeated Entry entries = 1; // a list of wantlist entries\n optional bool full = 2; // whether this is the full wantlist. default to false\n }\n\n message Block {\n optional bytes prefix = 1; // CID prefix (cid version, multicodec and multihash prefix (type + length)\n optional bytes data = 2;\n }\n\n optional Wantlist wantlist = 1;\n repeated bytes blocks = 2; // used to send Blocks in bitswap 1.0.0\n repeated Block payload = 3; // used to send Blocks in bitswap 1.1.0\n }\n"},function(e,t,n){"use strict";const r=n(207).Entry,i=n(9),o=n(24);e.exports=class e{constructor(e,t,n){o(i.isCID(e),"needs valid cid"),this.entry=new r(e,t),this.cancel=Boolean(n)}get cid(){return this.entry.cid}set cid(e){this.entry.cid=e}get priority(){return this.entry.priority}set priority(e){this.entry.priority=e}get[Symbol.toStringTag](){const e=this.cid.toBaseEncodedString();return`BitswapMessageEntry ${e} `}equals(e){return this.cancel===e.cancel&&this.entry.equals(e.entry)}}},function(e,t,n){"use strict";const r=n(24),i=n(9);class o{constructor(e,t){r(i.isCID(e),"must be valid CID"),this._refCounter=1,this.cid=e,this.priority=t||1}inc(){this._refCounter+=1}dec(){this._refCounter=Math.max(0,this._refCounter-1)}hasRefs(){return this._refCounter>0}get[Symbol.toStringTag](){const e=this.cid.toBaseEncodedString();return`WantlistEntry `}equals(e){return this._refCounter===e._refCounter&&this.cid.equals(e.cid)&&this.priority===e.priority}}e.exports=o},function(e,t,n){"use strict";const r=n(428),i=n(206),o=n(100).logger;e.exports=class e{constructor(e,t,n){this.peerId=t,this.network=n,this.refcnt=1,this._entries=[],this._log=o(e,"msgqueue",t.toB58String().slice(0,8)),this.sendEntries=r(this._sendEntries.bind(this),200)}addMessage(e){e.empty||this.send(e)}addEntries(e){this._entries=this._entries.concat(e),this.sendEntries()}_sendEntries(){if(!this._entries.length)return;const e=new i(!1);this._entries.forEach(t=>{t.cancel?e.cancel(t.cid):e.addEntry(t.cid,t.priority)}),this._entries=[],this.addMessage(e)}send(e){this.network.connectTo(this.peerId,t=>{t?this._log.error("cant connect to peer %s: %s",this.peerId.toB58String(),t.message):(this._log("sending message"),this.network.sendMessage(this.peerId,e,e=>{e&&this._log.error("send error: %s",e.message)}))})}}},function(e,t,n){"use strict";const r=n(52),i=n(19),o=n(10),s=n(38),a=n(47),l=n(206),u=n(265),c=n(100).logger,h="/ipfs/bitswap/1.0.0",f="/ipfs/bitswap/1.1.0";class p{constructor(e,t,n,r){this._log=c(e.peerInfo.id,"network"),n=n||{},this.libp2p=e,this.bitswap=t,this.b100Only=n.b100Only||!1,this._stats=r,this._running=!1}start(e){this._running=!0,this._onPeerConnect=this._onPeerConnect.bind(this),this._onPeerDisconnect=this._onPeerDisconnect.bind(this),this._onConnection=this._onConnection.bind(this),this.libp2p.handle(h,this._onConnection),this.b100Only||this.libp2p.handle(f,this._onConnection),this.libp2p.on("peer:connect",this._onPeerConnect),this.libp2p.on("peer:disconnect",this._onPeerDisconnect),this.libp2p.peerBook.getAllArray().filter(e=>e.isConnected()).forEach(e=>this._onPeerConnect(e)),a(()=>e())}stop(e){this._running=!1,this.libp2p.unhandle(h),this.b100Only||this.libp2p.unhandle(f),this.libp2p.removeListener("peer:connect",this._onPeerConnect),this.libp2p.removeListener("peer:disconnect",this._onPeerDisconnect),a(()=>e())}_onConnection(e,t){this._running&&(this._log("incomming new bitswap connection: %s",e),i(t,r.decode(),i.asyncMap((e,t)=>l.deserialize(e,t)),i.asyncMap((e,n)=>{t.getPeerInfo((t,r)=>{if(t)return n(t);this.bitswap._receiveMessage(r.id,e,n)})}),i.onEnd(e=>{this._log("ending connection"),e&&this.bitswap._receiveError(e)})))}_onPeerConnect(e){this._running&&this.bitswap._onPeerConnected(e.id)}_onPeerDisconnect(e){this._running&&this.bitswap._onPeerDisconnected(e.id)}findProviders(e,t,n){this.libp2p.contentRouting.findProviders(e,{maxTimeout:u.providerRequestTimeout,maxNumProviders:t},n)}findAndConnect(e,t){o([t=>this.findProviders(e,u.maxProvidersPerRequest,t),(e,t)=>{this._log("connecting to providers",e.map(e=>e.id.toB58String())),s(e,(e,t)=>this.connectTo(e,t))}],t)}provide(e,t){this.libp2p.contentRouting.provide(e,t)}sendMessage(e,t,n){if(!this._running)return n(new Error("network isn't running"));const r=e.toB58String()?e.toB58String():e.id.toB58String();this._log("sendMessage to %s",r,t),this._dialPeer(e,(r,i,o)=>{if(r)return n(r);let s;switch(o){case h:s=t.serializeToBitswap100();break;case f:s=t.serializeToBitswap110();break;default:return n(new Error("Unkown protocol: "+o))}d(i,s,e=>{e&&this._log.error(e)}),n(),this._updateSentStats(e,t.blocks)})}connectTo(e,t){if(!this._running)return t(new Error("network isn't running"));this.libp2p.dial(e,t)}_dialPeer(e,t){this.libp2p.dialProtocol(e,f,(n,r)=>{n?this.libp2p.dialProtocol(e,h,(e,n)=>{if(e)return t(e);t(null,n,h)}):t(null,r,f)})}_updateSentStats(e,t){const n=e.toB58String();this._stats&&(t.forEach(e=>this._stats.push(n,"dataSent",e.data.length)),this._stats.push(n,"blocksSent",t.size))}}function d(e,t,n){i(i.values([t]),r.encode(),e,i.onEnd(n))}e.exports=p},function(e,t,n){"use strict";const r=n(5).Buffer;e.exports=o;const i=10240;function o(e){e=Object.assign({fixed:!1},e||{});const t=n(35);let i=e.fixed?null:s(),o=0,a=!1;return n=>(l,u)=>{if(l&&(a=l),a)return u(a);n(null,(n,l)=>{if(n&&(a=n),a)return u(a);if(!a&&!r.isBuffer(l))return a=new Error("data must be a buffer"),u(a);const c=a?0:l.length;let h;if(e.fixed?(h=r.alloc(4),h.writeInt32BE(c,0)):(t.encode(c,i,o),o+=t.encode.bytes,h=i.slice(o-t.encode.bytes,o),i.length-o<100&&(i=s(),o=0)),a)return u(null,h);u(null,r.concat([h,l],(e.fixed?4:t.encode.bytes)+c))})}}function s(){return r.alloc(i)}},function(e,t,n){"use strict";const r=n(35),i=n(429),o=n(5).Buffer,s=n(63);t.decode=c,t.decodeFromReader=h;const a=128,l=e=>!(128&e),u=4194304;function c(e){let t=new i,n=s(e=>{t.abort(e)});return r=>{function i(){let r=!0,o=!1;const s=(e,t)=>{o=!0,e?(n.end(e),r=!1):(n.push(t),r||i())};for(;r;)o=!1,f(t,e,s),o||(r=!1)}return t(r),i(),n}}function h(e,t,n){"function"==typeof t&&(n=t,t={}),f(e,t,function e(t,r){if(t)return n(!0===t?new Error("Unexpected end of input from reader."):t);n(null,r)})}function f(e,t,n){t=Object.assign({fixed:!1,maxLength:u},t||{}),t.fixed?p(e,t.maxLength,n):d(e,t.maxLength,n)}function p(e,t,n){e.read(4,(r,i)=>{if(r)return n(r);const o=i.readInt32BE(0);if(o>t)return n(new Error("size longer than max permitted length of "+t+"!"));m(e,o,n)})}function d(e,t,n){let i=[];function s(){e.read(1,(a,u)=>{if(a)return n(a);if(i.push(u),u&&!l(u[0]))return void s();const c=r.decode(o.concat(i));if(c>t)return n(new Error("size longer than max permitted length of "+t+"!"));m(e,c,(e,t)=>e?n(e):(i=[],t.length{if(e)return n(e);n(null,t)})}},function(e,t,n){(function(t){e.exports=function(){var e=[],n=0;function r(){return e.reduce(function(e,t){return e+t.length},0)}return{length:n,data:this,add:function(r){if(!t.isBuffer(r))throw new Error("data must be a buffer, was: "+JSON.stringify(r));return this.length=n+=r.length,e.push(r),this},has:function(e){return null==e?n>0:n>=e},get:function(r){var i;if(null==r||r===n){n=0;var o=e;return e=[],1==o.length?o[0]:t.concat(o)}if(e.length>1&&r<=(i=e[0].length)){var s=e[0].slice(0,r);return r===i?e.shift():e[0]=e[0].slice(r,i),n-=r,s}if(re+t.data.byteLength,0);if(r{if(l--,a.push(t),o+=t.data.byteLength,o>=g||0===l){o=0;const t=a.slice();a=[],this._sendSafeBlocks(e,t,e=>{e&&this._log("sendblock error: %s",e.message),n()})}else s(n)},n)}_sendSafeBlocks(e,t,n){const r=new u(!1);t.forEach(e=>r.addBlock(e)),this.network.sendMessage(e,r,n)}_processTasks(){if(!this._running||!this._tasks.length)return;const e=this._tasks;this._tasks=[];const t=e.map(e=>e.entry),n=t.map(e=>e.cid),i=m((e,t)=>e.equals(t),n),s=p(e=>e.target.toB58String(),e);o([e=>a(i,(e,t)=>{this.blockstore.get(e,t)},e),(e,t)=>r(Object.values(s),(t,r)=>{const i=t[0].target,o=n.map(t=>e.find(e=>e.cid.equals(t)));this._sendBlocks(i,o,e=>{e?this._log.error("should never happen: ",e):o.forEach(e=>this.messageSent(i,e)),r()})},t)],e=>{this._tasks=[],e&&this._log.error(e)})}wantlistForPeer(e){const t=e.toB58String();return this.ledgerMap.has(t)?this.ledgerMap.get(t).wantlist.sortedEntries():new Map}ledgerForPeer(e){const t=e.toB58String(),n=this.ledgerMap.get(t);return n?{peer:n.partner.toPrint(),value:n.debtRatio(),sent:n.accounting.bytesSent,recv:n.accounting.bytesRecv,exchanged:n.exchangeCount}:null}peers(){return Array.from(this.ledgerMap.values()).map(e=>e.partner)}receivedBlocks(e){e.length&&(this.ledgerMap.forEach(t=>{e.map(e=>t.wantlistContains(e)).filter(Boolean).forEach(e=>{this._tasks.push({entry:e,target:t.partner})})}),this._outbox())}messageReceived(e,t,n){const r=this._findOrCreate(e);if(t.empty)return s(n);if(t.full&&(r.wantlist=new c),this._processBlocks(t.blocks,r),0===t.wantlist.size)return s(n);let i=[],o=[];t.wantlist.forEach(e=>{e.cancel?(r.cancelWant(e.cid),i.push(e)):(r.wants(e.cid,e.priority),o.push(e))}),this._cancelWants(r,e,i),this._addWants(r,e,o,n)}_cancelWants(e,t,n){const r=t.toB58String();this._tasks=d((e,t)=>{const n=e.target.toB58String()===r,i=e.entry.cid.equals(t.cid);return n&&i},this._tasks,n)}_addWants(e,t,n,i){r(n,(e,n)=>{this.blockstore.has(e.cid,(r,i)=>{r?this._log.error("failed existence check"):i&&this._tasks.push({entry:e.entry,target:t}),n()})},()=>{this._outbox(),i()})}_processBlocks(e,t,n){const r=[];e.forEach((e,n)=>{this._log("got block (%s bytes)",e.data.length),t.receivedBytes(e.data.length),r.push(e.cid)}),this.receivedBlocks(r)}messageSent(e,t){const n=this._findOrCreate(e);n.sentBytes(t?t.data.length:0),t&&t.cid&&n.wantlist.remove(t.cid)}numBytesSentTo(e){return this._findOrCreate(e).accounting.bytesSent}numBytesReceivedFrom(e){return this._findOrCreate(e).accounting.bytesRecv}peerDisconnected(e){}_findOrCreate(e){const t=e.toB58String();if(this.ledgerMap.has(t))return this.ledgerMap.get(t);const n=new h(e);return this.ledgerMap.set(t,n),this._stats&&this._stats.push(t,"peerCount",1),n}start(e){this._running=!0,s(()=>e())}stop(e){this._running=!1,s(()=>e())}}e.exports=y},function(e,t,n){"use strict";const r=n(207);class i{constructor(e){this.partner=e,this.wantlist=new r,this.exchangeCount=0,this.sentToPeer=new Map,this.accounting={bytesSent:0,bytesRecv:0}}sentBytes(e){this.exchangeCount++,this.lastExchange=(new Date).getTime(),this.accounting.bytesSent+=e}receivedBytes(e){this.exchangeCount++,this.lastExchange=(new Date).getTime(),this.accounting.bytesRecv+=e}wants(e,t){this.wantlist.add(e,t)}cancelWant(e){this.wantlist.remove(e)}wantlistContains(e){return this.wantlist.contains(e)}debtRatio(){return this.accounting.bytesSent/(this.accounting.bytesRecv+1)}}e.exports=i},function(e,t,n){"use strict";const r=n(6).EventEmitter,i=n(265),o=n(100).logger,s=e=>`unwant:${e}`,a=e=>`block:${e}`;class l extends r{constructor(e){super(),this.setMaxListeners(i.maxListeners),this._log=o(e,"notif"),this._unwantListeners={},this._blockListeners={}}hasBlock(e){const t=`block:${e.cid.buffer.toString()}`;this._log(t),this.emit(t,e)}wantBlock(e,t,n){const r=e.buffer.toString();this._log(`wantBlock:${r}`),this._unwantListeners[r]=(()=>{this._log(`manual unwant: ${r}`),this._cleanup(r),n()}),this._blockListeners[r]=(e=>{this._cleanup(r),t(e)}),this.once(s(r),this._unwantListeners[r]),this.once(a(r),this._blockListeners[r])}unwantBlock(e){const t=`unwant:${e.buffer.toString()}`;this._log(t),this.emit(t)}_cleanup(e){this._unwantListeners[e]&&(this.removeListener(s(e),this._unwantListeners[e]),delete this._unwantListeners[e]),this._blockListeners[e]&&(this.removeListener(a(e),this._blockListeners[e]),delete this._blockListeners[e])}}e.exports=l},function(e,t,n){"use strict";const r=n(6),i=n(903),o={movingAverageIntervals:[6e4,3e5,9e5]};class s extends r{constructor(e,t){super();const n=Object.assign({},o,t);if("number"!=typeof n.computeThrottleTimeout)throw new Error("need computeThrottleTimeout");if("number"!=typeof n.computeThrottleMaxQueueSize)throw new Error("need computeThrottleMaxQueueSize");this._initialCounters=e,this._options=n,this._enabled=this._options.enabled,this._global=new i(e,n),this._global.on("update",e=>this.emit("update",e)),this._peers=new Map}enable(){this._enabled=!0,this._options.enabled=!0,this._global.enable()}disable(){this._enabled=!1,this._options.enabled=!1,this._global.disable()}stop(){this._enabled=!1,this._global.stop();for(let e of this._peers)e[1].stop()}get snapshot(){return this._global.snapshot}get movingAverages(){return this._global.movingAverages}forPeer(e){return e.toB58String&&(e=e.toB58String()),this._peers.get(e)}push(e,t,n){if(this._enabled&&(this._global.push(t,n),e)){let r=this._peers.get(e);r||(r=new i(this._initialCounters,this._options),this._peers.set(e,r)),r.push(t,n)}}disconnected(e){const t=e.toB58String(),n=this._peers.get(t);n&&(n.stop(),this._peers.delete(t))}}e.exports=s},function(e,t,n){"use strict";const r=n(6),i=n(55),o=n(431);class s extends r{constructor(e,t){super(),this._options=t,this._queue=[],this._stats={},this._frequencyLastTime=Date.now(),this._frequencyAccumulators={},this._movingAverages={},this._update=this._update.bind(this),e.forEach(e=>{this._stats[e]=i(0),this._movingAverages[e]={},this._options.movingAverageIntervals.forEach(t=>{const n=this._movingAverages[e][t]=o(t);n.push(this._frequencyLastTime,0)})}),this._enabled=this._options.enabled}enable(){this._enabled=!0}disable(){this._disabled=!0}stop(){this._timeout&&clearTimeout(this._timeout)}get snapshot(){return Object.assign({},this._stats)}get movingAverages(){return Object.assign({},this._movingAverages)}push(e,t){this._enabled&&(this._queue.push([e,t,Date.now()]),this._resetComputeTimeout())}_resetComputeTimeout(){this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout(this._update,this._nextTimeout())}_nextTimeout(){const e=this._queue.length/this._options.computeThrottleMaxQueueSize;return Math.max(this._options.computeThrottleTimeout*(1-e),0)}_update(){if(this._timeout=null,this._queue.length){let e;for(;this._queue.length;){const t=e=this._queue.shift();this._applyOp(t)}this._updateFrequency(e[2]),this.emit("update",this._stats)}}_updateFrequency(e){const t=e-this._frequencyLastTime;Object.keys(this._stats).forEach(n=>{this._updateFrequencyFor(n,t,e)}),this._frequencyLastTime=e}_updateFrequencyFor(e,t,n){const r=this._frequencyAccumulators[e]||0;this._frequencyAccumulators[e]=0;const i=r/t*1e3;let s=this._movingAverages[e];s||(s=this._movingAverages[e]={}),this._options.movingAverageIntervals.forEach(e=>{let t=s[e];t||(t=s[e]=o(e)),t.push(n,i)})}_applyOp(e){const t=e[0],n=e[1];if("number"!=typeof n)throw new Error("invalid increment number:",n);let r;r=this._stats.hasOwnProperty(t)?this._stats[t]:this._stats[t]=i(0),this._stats[t]=r.plus(n),this._frequencyAccumulators[t]||(this._frequencyAccumulators[t]=0),this._frequencyAccumulators[t]+=n}}e.exports=s},function(e,t,n){"use strict";e.exports=a;var r=n(78),i=a.prototype,o=new Date%1e9;function s(){return(1e9*Math.random()>>>0)+o++}function a(e){e=e||{},this.id=e.id||s(),this.max=e.max||1/0,this.items=e.items||[],this._lookup={},this.size=this.items.length,this.lastModified=new Date(e.lastModified||new Date);for(var t,n,r=this.items.length;r--;)t=this.items[r],n=new Date(t.expires)-new Date,this._lookup[t.key]=t,n>0?this.expire(t.key,n):n<=0&&this.delete(t.key)}i.has=function(e){return e in this._lookup},i.get=function(e){if(!this.has(e))return null;var t=this._lookup[e];return t.refresh&&this.expire(e,t.refresh),this.items.splice(this.items.indexOf(t),1),this.items.push(t),t.value},i.meta=function(e){if(!this.has(e))return null;var t=this._lookup[e];return"meta"in t?t.meta:null},i.set=function(e,t,n){var r=this._lookup[e],i=this._lookup[e]={key:e,value:t};return this.lastModified=new Date,r?(clearTimeout(r.timeout),this.items.splice(this.items.indexOf(r),1,i)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(i),this.size++),n&&("ttl"in n&&this.expire(e,n.ttl),"meta"in n&&(i.meta=n.meta),n.refresh&&(i.refresh=n.ttl)),this},i.delete=function(e){var t=this._lookup[e];return!!t&&(this.lastModified=new Date,this.items.splice(this.items.indexOf(t),1),clearTimeout(t.timeout),delete this._lookup[e],this.size--,this)},i.expire=function(e,t){var n=t||0,i=this._lookup[e];if(!i)return this;if("string"==typeof n&&(n=r(t)),"number"!=typeof n)throw new TypeError("Expiration time must be a string or number.");return clearTimeout(i.timeout),i.timeout=setTimeout(this.delete.bind(this,i.key),n),i.expires=Number(new Date)+n,this},i.clear=function(){for(var e=this.items.length;e--;)this.delete(this.items[e].key);return this},i.toJSON=function(){for(var e=new Array(this.items.length),t,n=e.length;n--;)t=this.items[n],e[n]={key:t.key,meta:t.meta,value:t.value,expires:t.expires,refresh:t.refresh};return{id:this.id,max:isFinite(this.max)?this.max:void 0,lastModified:this.lastModified,items:e}}},function(e,t,n){"use strict";const r=n(15),{Key:i}=n(28),o=n(43),s=n(13),a=n(4),l=a("ipfs:ipns:publisher");l.error=a("ipfs:ipns:publisher:error");const u=n(158),c=36e5;class h{constructor(e,t){this._routing=e,this._datastore=t}publishWithEOL(e,t,n,i){if(!e||!e.bytes){const e="one or more of the provided parameters are not defined";return l.error(e),i(s(new Error(e),"ERR_UNDEFINED_PARAMETER"))}r.createFromPrivKey(e.bytes,(r,o)=>{if(r)return i(r);this._updateOrCreateRecord(e,t,n,o,(e,t)=>{if(e)return i(e);this._putRecordToRouting(t,o,i)})})}publish(e,t,n){this.publishWithEOL(e,t,c,n)}_putRecordToRouting(e,t,n){if(!r.isPeerId(t)){const e="peerId received is not valid";return l.error(e),n(s(new Error(e),"ERR_INVALID_PEER_ID"))}const i=t._pubKey;u.embedPublicKey(i,e,(r,s)=>{if(r)return n(r);let a;try{a=u.getIdKeys(t.toBytes())}catch(r){return l.error(r),n(r)}o([n=>this._publishEntry(a.routingKey,s||e,t,n),e=>this._publishPublicKey(a.routingPubKey,i,t,e)],t=>{if(t)return l.error(t),n(t);n(null,s||e)})})}_publishEntry(e,t,n,r){if(!i.isKey(e)){const e="datastore key does not have a valid format";return l.error(e),r(s(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}let o;try{o=u.marshal(t)}catch(e){return l.error(e),r(e)}this._routing.put(e.toBuffer(),o,(t,n)=>{if(t){const t=`ipns record for ${e.toString()} could not be stored in the routing`;return l.error(t),r(s(new Error(t),"ERR_PUTTING_TO_ROUTING"))}l(`ipns record for ${e.toString()} was stored in the routing`),r(null,n)})}_publishPublicKey(e,t,n,r){if(!i.isKey(e)){const e="datastore key does not have a valid format";return l.error(e),r(s(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}if(!t||!t.bytes){const e="one or more of the provided parameters are not defined";return l.error(e),r(s(new Error(e),"ERR_UNDEFINED_PARAMETER"))}this._routing.put(e.toBuffer(),t.bytes,(t,n)=>{if(t){const t=`public key for ${e.toString()} could not be stored in the routing`;return l.error(t),r(s(new Error(t),"ERR_PUTTING_TO_ROUTING"))}l(`public key for ${e.toString()} was stored in the routing`),r(null,n)})}_getPublished(e,t,n){if(!r.isPeerId(e)){const e="peerId received is not valid";return l.error(e),n(s(new Error(e),"ERR_INVALID_PEER_ID"))}t=t||{};const i=!1!==t.checkRouting;this._datastore.get(u.getLocalKey(e.id),(t,r)=>{if(t){if("ERR_NOT_FOUND"!==t.code){const t=`unexpected error getting the ipns record ${e.id} from datastore`;return l.error(t),n(s(new Error(t),"ERR_UNEXPECTED_DATASTORE_RESPONSE"))}if(!i)return n(s(t));let r;try{r=u.getIdKeys(e.toBytes())}catch(t){return l.error(t),n(t)}this._routing.get(r.routingKey.toBuffer(),(e,t)=>{if(e)return n(e);this._unmarshalData(t,n)})}else this._unmarshalData(r,n)})}_unmarshalData(e,t){let n;try{n=u.unmarshal(e)}catch(e){return l.error(e),t(s(e,"ERR_INVALID_RECORD_DATA"))}t(null,n)}_updateOrCreateRecord(e,t,n,i,o){if(!r.isPeerId(i)){const e="peerId received is not valid";return l.error(e),o(s(new Error(e),"ERR_INVALID_PEER_ID"))}const a={checkRouting:!0};this._getPublished(i,a,(r,a)=>{if(r&&"ERR_NOT_FOUND"!==r.code){const e=`unexpected error when determining the last published IPNS record for ${i.id}`;return l.error(e),o(s(new Error(e),"ERR_DETERMINING_PUBLISHED_RECORD"))}let c=0;a&&void 0!==a.sequence&&(c=a.value.toString()!==t?a.sequence+1:a.sequence),u.create(e,t,c,n,(e,n)=>{if(e){const e=`ipns record for ${t} could not be created`;return l.error(e),o(s(new Error(e),"ERR_CREATING_IPNS_RECORD"))}const r=u.marshal(n);this._datastore.put(u.getLocalKey(i.id),r,(e,r)=>{if(e){const e=`ipns record for ${t} could not be stored in the datastore`;return l.error(e),o(s(new Error(e),"ERR_STORING_IN_DATASTORE"))}l(`ipns record for ${t} was stored in the datastore`),o(null,n)})})})}}t=e.exports=h},function(e,t){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",r="0123456789ABCDEFGHIJKLMNOPQRSTUV",i="0123456789ABCDEFGHJKMNPQRSTVWXYZ";e.exports=function e(t,o,s){var a,l;switch(s=s||{},o){case"RFC3548":case"RFC4648":a=n,l=!0;break;case"RFC4648-HEX":a=r,l=!0;break;case"Crockford":a=i,l=!1;break;default:throw new Error("Unknown base32 variant: "+o)}for(var u=void 0!==s.padding?s.padding:l,c=t.byteLength,h=new Uint8Array(t),f=0,p=0,d="",m=0;m=5;)d+=a[p>>>f-5&31],f-=5;if(f>0&&(d+=a[p<<5-f&31]),u)for(;d.length%8!=0;)d+="=";return d}},function(e,t,n){ /** * Timestamp for 64-bit time_t, nanosecond precision and strftime * @@ -362,9 +331,9 @@ var r,i;r=this,i=function(){"use strict";var e=function(e,n){return t(e.slice(), * @license MIT * @see https://github.com/kawanet/timestamp-nano */ -var r=function(){e.exports=b;var t=86400,n=3200,r=146097*n/400,i=t*r,o=1e3*i,s=1e11*t,a=16777216,u=4294967296,l=1e6,c=1e9,f="000000000",h=Math.trunc||N,p=b.prototype;b.fromDate=C,b.fromInt64BE=B(0,1,2,3,0,4),b.fromInt64LE=B(3,2,1,0,4,0),b.fromString=x,b.fromTimeT=A,p.year=0,p.time=0,p.nano=0,p.addNano=S,p.getNano=E,p.getTimeT=T,p.getYear=v,p.toDate=_,p.toJSON=j,p.toString=O,p.writeInt64BE=P(0,1,2,3,0,4),p.writeInt64LE=P(3,2,1,0,4,0);var d="%Y-%m-%dT%H:%M:%S.%NZ",m=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],g=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],y={"%":"%",F:"%Y-%m-%d",n:"\n",R:"%H:%M",T:"%H:%M:%S",t:"\t",X:"%T",Z:"GMT",z:"+0000"};return b;function b(e,t,n){var r=this;if(!(r instanceof b))return new b(e,t,n);r.time=+e||0,r.nano=+t||0,r.year=+n||0,w(r)}function v(){var e=this.toDate().getUTCFullYear();return e+this.year}function w(e){var t=e.year,r=e.time,i=e.nano,a,u;if(i<0||l<=i){var c=Math.floor(i/l);i-=c*l,r+=c,a=1}var f=t%n;if(r<-s||s1?r[1]--:r[1]=0,n.time=t=Date.UTC.apply(Date,r)-(t||0),isNaN(t))throw new TypeError("Invalid Date");return w(n)}function C(e){return new b(+e)}function A(e){return I(e,0)}function I(e,t){t|=0,t*=u,e=+e||0;var r=h(t/i)+h(e/i),o=t%i+e%i,s=h(o/i);return s&&(r+=s,o-=s*i),new b(1e3*o,0,r*n)}function T(){var e=w(this),i=Math.floor(e.time/1e3),o=e.year;return o&&(i+=o*r*t/n),i}function j(){return this.toString().replace(/0{1,6}Z$/,"Z")}function O(e){var t=this,n=t.toDate(),r={H:l,L:h,M:c,N:p,S:f,Y:o,a:b,b:v,d:a,e:u,m:s};return i(e||d);function i(e){return e.replace(/%./g,function(e){var t=e[1],n=y[t],o=r[t];return n?i(n):o?o():e})}function o(){var e=t.getYear();return e>999999?"+"+e:e>9999?"+"+F(e,6):e>=0?F(e,4):e>=-999999?"-"+F(-e,6):e}function s(){return L(n.getUTCMonth()+1)}function a(){return L(n.getUTCDate())}function u(){return M(n.getUTCDate())}function l(){return L(n.getUTCHours())}function c(){return L(n.getUTCMinutes())}function f(){return L(n.getUTCSeconds())}function h(){return F(n.getUTCMilliseconds(),3)}function p(){return F(t.getNano(),9)}function b(){return g[n.getUTCDay()]}function v(){return m[n.getUTCMonth()]}}function P(e,i,o,s,a,l){return c;function c(e,i){var o=w(this);e||(e=new Array(8)),R(e,i|=0);var s=Math.floor(o.time/1e3),c=o.year*(r*t/n),p=h(c/u)+h(s/u),d=c%u+s%u,m=Math.floor(d/u);return m&&(p+=m,d-=m*u),f(e,i+a,p),f(e,i+l,d),e}function f(t,n,r){t[n+e]=r>>24&255,t[n+i]=r>>16&255,t[n+o]=r>>8&255,t[n+s]=255&r}}function B(e,t,n,r,i,o){return s;function s(e,t){R(e,t|=0);var n=u(e,t+i),r=u(e,t+o);return I(r,n)}function u(i,o){return i[o+e]*a+(i[o+t]<<16|i[o+n]<<8|i[o+r])}}function R(e,t){var n=e&&e.length;if(null==n)throw new TypeError("Invalid Buffer");if(n9?"":" ")+(0|e)}function L(e){return(e>9?"":"0")+(0|e)}function F(e,t){return(f+(0|e)).substr(-t)}}()},function(e,t,n){"use strict";const r=n(71),i='\nmessage IpnsEntry {\n enum ValidityType {\n\t\tEOL = 0; // setting an EOL says "this record is valid until..."\n\t}\n\n required bytes value = 1;\n\trequired bytes signature = 2;\n\n\toptional ValidityType validityType = 3;\n\toptional bytes validity = 4;\n\n\toptional uint64 sequence = 5;\n\n\toptional uint64 ttl = 6;\n\n\t// in order for nodes to properly validate a record upon receipt, they need the public\n\t// key associated with it. For old RSA keys, its easiest if we just send this as part of\n\t// the record itself. For newer ed25519 keys, the public key can be embedded in the\n\t// peerID, making this field unnecessary.\n\toptional bytes pubKey = 7;\n}\n';e.exports=r(i).IpnsEntry},function(e,t,n){"use strict";e.exports.toRFC3339=(e=>{const t=e.getUTCFullYear(),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCDate()).padStart(2,"0"),i=String(e.getUTCHours()).padStart(2,"0"),o=String(e.getUTCMinutes()).padStart(2,"0"),s=String(e.getUTCSeconds()).padStart(2,"0"),a=e.getUTCMilliseconds(),u=1e3*a*1e3;return`${t}-${n}-${r}T${i}:${o}:${s}.${u}Z`}),e.exports.parseRFC3339=(e=>{const t=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),n=String(e).trim().match(t);if(!n)throw new Error("Invalid format");const r=parseInt(n[1],10),i=parseInt(n[2],10)-1,o=parseInt(n[3],10),s=parseInt(n[4],10),a=parseInt(n[5],10),u=parseInt(n[6],10),l=parseInt(n[7].slice(0,-6),10);return new Date(Date.UTC(r,i,o,s,a,u,l))})},function(e,t,n){"use strict";t.ERR_IPNS_EXPIRED_RECORD="ERR_IPNS_EXPIRED_RECORD",t.ERR_UNRECOGNIZED_VALIDITY="ERR_UNRECOGNIZED_VALIDITY",t.ERR_SIGNATURE_CREATION="ERR_SIGNATURE_CREATION",t.ERR_SIGNATURE_VERIFICATION="ERR_SIGNATURE_VERIFICATION",t.ERR_UNRECOGNIZED_FORMAT="ERR_UNRECOGNIZED_FORMAT",t.ERR_PEER_ID_FROM_PUBLIC_KEY="ERR_PEER_ID_FROM_PUBLIC_KEY",t.ERR_PUBLIC_KEY_FROM_ID="ERR_PUBLIC_KEY_FROM_ID",t.ERR_UNDEFINED_PARAMETER="ERR_UNDEFINED_PARAMETER"},function(e,t,n){"use strict";(function(r){const i=n(183),o=n(64),s=n(23),a=n(22),u=n(5),l=n(56),c=n(11),f=u("jsipfs:ipns:republisher");f.error=u("jsipfs:ipns:republisher:error");const h=6e4,p=60*h,d=4*p,m=24*p;class g{constructor(e,t,n,r,i){this._publisher=e,this._datastore=t,this._peerInfo=n,this._keychain=r,this._options=i,this._republishHandle=null}start(){if(this._republishHandle){const e="already running";throw f.error(e),a(new Error(e),"ERR_REPUBLISH_ALREADY_RUNNING")}const e={_onCancel:null,_timeoutId:null,runPeriodically:(t,n)=>{e._timeoutId=setTimeout(()=>{e._timeoutId=null,t(r=>{if(e._onCancel)return e._onCancel();e.runPeriodically(t,r||n)})},n)},cancel:t=>{if(e._timeoutId)return clearTimeout(e._timeoutId),t();e._onCancel=t}},{privKey:t}=this._peerInfo.id,{pass:n}=this._options;e.runPeriodically(e=>{this._republishEntries(t,n,()=>e(d))},h),this._republishHandle=e}stop(e){const t=this._republishHandle;if(!t){const t="not running";return f.error(t),e(a(new Error(t),"ERR_REPUBLISH_NOT_RUNNING"))}this._republishHandle=null,t.cancel(e)}_republishEntries(e,t,n){this._republishEntry(e,e=>{if(e){const e="cannot republish entry for the node's private key";f.error(e)}else t?this._keychain.listKeys((e,r)=>{e?f.error(e):l(r,(e,n)=>{c([n=>this._keychain.exportKey(e.name,t,n),(e,n)=>o.keys.import(e,t,n)],(e,t)=>{e?f.error(e):this._republishEntry(t,n)})},e=>{e&&f.error(e),n(null)})}):n(null)})}_republishEntry(e,t){if(!e||!e.bytes){const e="one or more of the provided parameters are not defined";return f.error(e),t(a(new Error(e),"ERR_UNDEFINED_PARAMETER"))}c([t=>s.createFromPrivKey(e.bytes,t),(e,t)=>this._getPreviousValue(e,t)],(n,r)=>{if(n)return t("ERR_NO_ENTRY_FOUND"===n.code?null:n);this._publisher.publishWithEOL(e,r,m,t)})}_getPreviousValue(e,t){if(!s.isPeerId(e)){const e="peerId received is not valid";return f.error(e),t(a(new Error(e),"ERR_INVALID_PEER_ID"))}this._datastore.get(i.getLocalKey(e.id),(n,o)=>{if(n&&n.notFound){const n=`no previous entry for record with id: ${e.id}`;return f.error(n),t(a(new Error(n),"ERR_NO_ENTRY_FOUND"))}if(n)return t(n);if(!r.isBuffer(o)){const e="found ipns record that we couldn't process";return f.error(e),t(a(new Error(e),"ERR_INVALID_IPNS_RECORD"))}let s;try{s=i.unmarshal(o)}catch(n){const e="found ipns record that we couldn't convert to a value";return f.error(e),t(a(new Error(e),"ERR_INVALID_IPNS_RECORD"))}t(null,s.value)})}}t=e.exports=g}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(183),i=n(64),o=n(23),s=n(22),a=n(5),u=a("jsipfs:ipns:resolver");u.error=a("jsipfs:ipns:resolver:error");const l=32;class c{constructor(e){this._routing=e}resolve(e,t,n){if("function"==typeof t&&(n=t,t={}),"string"!=typeof e){const e="one or more of the provided parameters are not valid";return u.error(e),n(s(new Error(e),"ERR_INVALID_PARAMETER"))}t=t||{};const r=t.recursive&&"true"===t.recursive.toString(),i=e.split("/");if(3!==i.length||""!==i[0]){const t=`invalid name syntax for ${e}`;return u.error(t),n(s(new Error(t),"ERR_INVALID_NAME_SYNTAX"))}const o=i[2];let a;r&&(a=l),this.resolver(o,a,(t,r)=>{if(t)return n(t);u(`${e} was locally resolved correctly`),n(null,r)})}resolver(e,t,n){if(0===t){const e=`could not resolve name (recursion limit of ${l} exceeded)`;return u.error(e),n(s(new Error(e),"ERR_RESOLVE_RECURSION_LIMIT"))}this._resolveName(e,(e,r)=>{if(e)return n(e);const i=r.split("/");if("ipfs"===i[1]||!t)return n(null,r);this.resolver(i[2],t-1,n)})}_resolveName(e,t){let n;try{n=o.createFromB58String(e)}catch(e){return t(e)}const{routingKey:a,routingPubKey:l}=r.getIdKeys(n.toBytes());this._routing.get(a.toBuffer(),(o,c)=>{if(o){if("ERR_NOT_FOUND"!==o.code){const e=`unexpected error getting the ipns record ${n.id}`;return u.error(e),t(s(new Error(e),"ERR_UNEXPECTED_ERROR_GETTING_RECORD"))}const r=`record requested was not found for ${e} (${a}) in the network`;return u.error(r),t(s(new Error(r),"ERR_NO_RECORD_FOUND"))}let f;try{f=r.unmarshal(c)}catch(o){const e="found ipns record that we couldn't convert to a value";return u.error(e),t(s(new Error(e),"ERR_INVALID_RECORD_RECEIVED"))}if(f.pubKey)return this._validateRecord(n,f,t);this._routing.get(a.toBuffer(),(r,o)=>{if(r){if("ERR_NOT_FOUND"!==r.code){const e=`unexpected error getting the public key for the ipns record ${n.id}`;return u.error(e),t(s(new Error(e),"ERR_UNEXPECTED_ERROR_GETTING_PUB_KEY"))}const i=`public key requested was not found for ${e} (${l}) in the network`;return u.error(i),t(s(new Error(i),"ERR_NO_RECORD_FOUND"))}try{n.pubKey=i.keys.unmarshalPublicKey(o)}catch(r){const e="found public key record that we couldn't convert to a value";return u.error(e),t(s(new Error(e),"ERR_INVALID_PUB_KEY_RECEIVED"))}this._validateRecord(n,f,t)})})}_validateRecord(e,t,n){r.extractPublicKey(e,t,(e,i)=>{if(e)return n(e);r.validate(i,t,e=>{if(e)return n(e);n(null,t.value.toString())})})}}t=e.exports=c},function(e,t,n){"use strict";(function(r){const{Key:i}=n(33),{encodeBase32:o,keyToTopic:s,topicToKey:a}=n(1033),u=n(22),l=n(18),c=n(5),f=c("datastore-pubsub:publisher");f.error=c("datastore-pubsub:publisher:error");class h{constructor(e,t,n,r,i){l.strictEqual(typeof r,"object","missing validator"),l.strictEqual(typeof r.validate,"function","missing validate function"),l.strictEqual(typeof r.select,"function","missing select function"),i&&l.strictEqual(typeof i,"function","invalid subscriptionKeyFn received"),this._pubsub=e,this._datastore=t,this._peerId=n,this._validator=r,this._handleSubscriptionKeyFn=i,this._onMessage=this._onMessage.bind(this)}put(e,t,n){if(!r.isBuffer(e)){const e="datastore key does not have a valid format";return f.error(e),n(u(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}if(!r.isBuffer(t)){const e="received value is not a buffer";return f.error(e),n(u(new Error(e),"ERR_INVALID_VALUE_RECEIVED"))}const i=s(e);f(`publish value for topic ${i}`),this._pubsub.publish(i,t,n)}get(e,t){if(!r.isBuffer(e)){const e="datastore key does not have a valid format";return f.error(e),t(u(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}const n=s(e);this._pubsub.ls((r,i)=>r?t(r):i&&Array.isArray(i)&&i.indexOf(n)>-1?this._getLocal(e,t):void this._pubsub.subscribe(n,this._onMessage,r=>{if(r){const e=`cannot subscribe topic ${n}`;return f.error(e),t(u(new Error(e),"ERR_SUBSCRIBING_TOPIC"))}f(`subscribed values for key ${n}`),this._getLocal(e,t)}))}unsubscribe(e){const t=s(e);this._pubsub.unsubscribe(t,this._onMessage)}_getLocal(e,t){const n=new i("/"+o(e),!1);this._datastore.get(n,(e,i)=>{if(e){if("ERR_NOT_FOUND"!==e.code){const e=`unexpected error getting the ipns record for ${n.toString()}`;return f.error(e),t(u(new Error(e),"ERR_UNEXPECTED_ERROR_GETTING_RECORD"))}const r=`local record requested was not found for ${n.toString()}`;return f.error(r),t(u(new Error(r),"ERR_NOT_FOUND"))}if(!r.isBuffer(i)){const e="found record that we couldn't convert to a value";return f.error(e),t(u(new Error(e),"ERR_INVALID_RECORD_RECEIVED"))}t(null,i)})}_onMessage(e){const{data:t,from:n,topicIDs:r}=e;let i;try{i=a(r[0])}catch(e){return void f.error(e)}f(`message received for ${i} topic`),n!==this._peerId.toB58String()?this._handleSubscriptionKeyFn?this._handleSubscriptionKeyFn(i,(e,n)=>{e?f.error("message discarded by the subscriptionKeyFn"):this._storeIfSubscriptionIsBetter(n,t)}):this._storeIfSubscriptionIsBetter(i,t):f("message discarded as it is from the same peer")}_storeIfSubscriptionIsBetter(e,t){this._isBetter(e,t,(n,i)=>{!n&&i&&this._storeRecord(r.from(e),t)})}_validateRecord(e,t,n){this._validator.validate(e,t,n)}_selectRecord(e,t,n){this._validator.select(e,t,(e,t)=>{if(e)return f.error(e),n(e);n(null,0===t)})}_isBetter(e,t,n){this._validateRecord(t,e,(r,o)=>{if(r||!o){const e="record received through pubsub is not valid";return f.error(e),n(u(new Error(e),"ERR_NOT_VALID_RECORD"))}const s=new i(e);this._getLocal(s.toBuffer(),(e,r)=>e?n(null,!0):r.equals(t)?n(null,!1):void this._selectRecord(t,r,n))})}_storeRecord(e,t){const n=new i("/"+o(e),!1);this._datastore.put(n,t,t=>{t?f.error(`record for ${e.toString()} could not be stored in the routing`):f(`record for ${e.toString()} was stored in the datastore`)})}open(e){const t="open function was not implemented yet";return f.error(t),e(u(new Error(t),"ERR_NOT_IMPLEMENTED_YET"))}has(e,t){const n="has function was not implemented yet";return f.error(n),t(u(new Error(n),"ERR_NOT_IMPLEMENTED_YET"))}delete(e,t){const n="delete function was not implemented yet";return f.error(n),t(u(new Error(n),"ERR_NOT_IMPLEMENTED_YET"))}close(e){const t="close function was not implemented yet";return f.error(t),e(u(new Error(t),"ERR_NOT_IMPLEMENTED_YET"))}batch(){const e="batch function was not implemented yet";throw f.error(e),u(new Error(e),"ERR_NOT_IMPLEMENTED_YET")}query(){const e="query function was not implemented yet";throw f.error(e),u(new Error(e),"ERR_NOT_IMPLEMENTED_YET")}}t=e.exports=h}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(89),i=n(22),o="/record/",s="u";e.exports.encodeBase32=(e=>r.encode("base32",e).slice(1)),e.exports.keyToTopic=(e=>{const t=r.encode("base64url",e).slice(1).toString();return`/record/${t}`}),e.exports.topicToKey=(e=>{if(e.substring(0,o.length)!==o)throw i(new Error("topic received is not from a record"),"ERR_TOPIC_IS_NOT_FROM_RECORD_NAMESPACE");const t=`u${e.substring(o.length)}`;return r.decode(t).toString()})},function(e,t,n){"use strict";e.exports={Record:n(1035),validator:n(1038),selection:n(1046)}},function(e,t,n){"use strict";(function(t){const r=n(71),i=n(18),o=r(n(1036)).Record,s=n(1037);class a{constructor(e,n,r){e&&i(t.isBuffer(e),"key must be a Buffer"),n&&i(t.isBuffer(n),"value must be a buffer"),this.key=e,this.value=n,this.timeReceived=r}serialize(){return o.encode(this.prepareSerialize())}prepareSerialize(){return{key:this.key,value:this.value,timeReceived:this.timeReceived&&s.toRFC3339(this.timeReceived)}}static deserialize(e){const t=o.decode(e);return a.fromDeserialized(t)}static fromDeserialized(e){let t;e.timeReceived&&(t=s.parseRFC3339(e.timeReceived));const n=new a(e.key,e.value,t);return n}}e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports="// Record represents a dht record that contains a value\n// for a key value pair\nmessage Record {\n // The key that references this record\n bytes key = 1;\n\n // The actual value this record is storing\n bytes value = 2;\n\n // Note: These fields were removed from the Record message\n // hash of the authors public key\n // optional bytes author = 3;\n // A PKI signature for the key+value+author\n // optional bytes signature = 4;\n\n // Time the record was received, set by receiver\n optional string timeReceived = 5;\n}"},function(e,t,n){"use strict";e.exports.toRFC3339=(e=>{const t=e.getUTCFullYear(),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCDate()).padStart(2,"0"),i=String(e.getUTCHours()).padStart(2,"0"),o=String(e.getUTCMinutes()).padStart(2,"0"),s=String(e.getUTCSeconds()).padStart(2,"0"),a=e.getUTCMilliseconds(),u=1e3*a*1e3;return`${t}-${n}-${r}T${i}:${o}:${s}.${u}Z`}),e.exports.parseRFC3339=(e=>{const t=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),n=String(e).trim().match(t);if(!n)throw new Error("Invalid format");const r=parseInt(n[1],10),i=parseInt(n[2],10)-1,o=parseInt(n[3],10),s=parseInt(n[4],10),a=parseInt(n[5],10),u=parseInt(n[6],10),l=parseInt(n[7].slice(0,-6),10);return new Date(Date.UTC(r,i,o,s,a,u,l))})},function(e,t,n){"use strict";(function(t){const r=n(501),i=n(22),o=(e,n,o)=>{const s=n.key,a=r(s,t.from("/"));if(a.length<3)return o();const u=e[a[1].toString()];if(!u){const e="Invalid record keytype";return o(i(new Error(e),"ERR_INVALID_RECORD_KEY_TYPE"))}u.func(s,n.value,o)};e.exports={verifyRecord:o,validators:n(1040)}}).call(this,n(0).Buffer)},function(e,t){e.exports=function e(t,n,r){r=r||0;for(var i=0,o=-1,s=r;s-1&&t.length-o{const s=e=>r(()=>o(e));if(!t.isBuffer(e))return s(new Error('"key" must be a Buffer'));if(e.length<3)return s(new Error("invalid public key record"));const a=e.slice(0,4).toString();if("/pk/"!==a)return s(new Error("key was not prefixed with /pk/"));const u=e.slice(4);i(n,"sha2-256",(e,t)=>e?s(e):u.equals(t)?void s():s(new Error("public key does not match passed in key")))};e.exports={func:o,sign:!1}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(35),i=n(1043);function o(e,t,n,i){if("function"==typeof n&&(i=n,n=void 0),!i)throw new Error("Missing callback");o.digest(e,t,n,(e,o)=>{if(e)return i(e);i(null,r.encode(o,t,n))})}e.exports=o,o.Buffer=t,o.multihash=r,o.digest=function(e,t,n,r){if("function"==typeof n&&(r=n,n=void 0),!r)throw new Error("Missing callback");let i=r,s;n&&(i=((e,t)=>{if(e)return r(e);r(null,t.slice(0,n))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=r.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions),o.validate=((e,n,i)=>{let s=r.decode(n).name;o(e,s,(e,r)=>{if(e)return i(e);i(e,0===t.compare(n,r))})})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(445),i=n(447),o=n(502),s=n(1044),a=o.toCallback,u=o.toBuf,l=o.fromString,c=o.fromNumberTo32BitBuf,f=(e,n)=>{s.sha2256(e,(e,r)=>{e&&n(e),s.sha2256(t.from(r),n)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(u(r.sha3_512)),sha3384:a(u(r.sha3_384)),sha3256:a(u(r.sha3_256)),sha3224:a(u(r.sha3_224)),shake128:a(u(r.shake_128,128)),shake256:a(u(r.shake_256,256)),keccak224:a(u(r.keccak_224)),keccak256:a(u(r.keccak_256)),keccak384:a(u(r.keccak_384)),keccak512:a(u(r.keccak_512)),murmur3128:a(u(l(i.x64.hash128))),murmur332:a(c(l(i.x86.hash32))),addBlake:n(1045),dblSha2256:f}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(449),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");return(n,o)=>{const s=i.digest({name:e},n);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));r(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function u(e,t){s("SHA-256")(e,t)}function l(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:u,sha2512:l}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(451),i=n(502).toCallback,o=45569,s=45633,a={init:r.blake2bInit,update:r.blake2bUpdate,digest:r.blake2bFinal},u={init:r.blake2sInit,update:r.blake2sUpdate,digest:r.blake2sFinal},l=(e,n)=>i(r=>{const i=n.init(e,null);return n.update(i,r),t.from(n.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=l(t+1,a);for(let t=0;t<32;t++)e[s+t]=l(t+1,u)})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(501),i=n(22),o=(e,n,o)=>{if(0===o.length){const e="No records given";throw i(new Error(e),"ERR_NO_RECORDS_RECEIVED")}const s=r(n,t.from("/"));if(s.length<3){const e="Record key does not have a selector function";throw i(new Error(e),"ERR_NO_SELECTOR_FUNCTION_FOR_RECORD_KEY")}const a=e[s[1].toString()];if(!a){const e=`Unrecognized key prefix: ${s[1]}`;throw i(new Error(e),"ERR_UNRECOGNIZED_KEY_PREFIX")}return a(n,o)};e.exports={bestRecord:o,selectors:n(1047)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports={pk:n(1048)}},function(e,t,n){"use strict";const r=(e,t)=>0;e.exports=r},function(e,t,n){"use strict";const r=n(505),i=n(1060),o=n(1095),s=n(1104),a=n(1110),u=n(1118),l=n(1119),c=n(182),f=n(24);class h extends l{constructor(e){const t=new i({id:e.peerInfo.id}),n=e.peerInfo.multiaddrs.toArray().map(String).filter(e=>e.includes("p2p-websocket-star"));e.peerInfo.multiaddrs.replace(n.map(f),"/p2p-websocket-star");const l=new o({servers:n,id:e.peerInfo.id,ignore_no_online:!n.length||e.wsStarIgnoreErrors}),h={modules:{transport:[r,t,l],streamMuxer:[s],connEncryption:[a],peerDiscovery:[t.discovery,l.discovery,u]},config:{peerDiscovery:{bootstrap:{enabled:!0},webRTCStar:{enabled:!0},websocketStar:{enabled:!0}},EXPERIMENTAL:{dht:!1,pubsub:!1}}};super(c(e,h))}}e.exports=h},function(e,t,n){"use strict";var r=n(1051),i=n(1053),o=n(1057);function s(e){return"function"==typeof e}e.exports=function(e,t){s(t)&&(t={onConnect:t});var n="undefined"==typeof window?{}:window.location,a=o(e,n),u=new r(a),l=i(u,t);return l.remoteAddress=a,l.close=function(e){s(e)&&u.addEventListener("close",e),u.close()},u.addEventListener("open",function(e){t&&s(t.onConnect)&&t.onConnect(null,l)}),l},e.exports.connect=e.exports},function(e,t,n){e.exports="undefined"==typeof WebSocket?n(1052):WebSocket},function(e,t){},function(e,t,n){var r=n(1054),i=n(1055);function o(e,t){var n=e.upgradeReq||{};return t&&t.binaryType?e.binaryType=t.binaryType:t&&t.binary&&(e.binaryType="arraybuffer"),{source:r(e,t&&t.onConnect),sink:i(e,t),headers:n.headers,url:n.url,upgrade:n.upgrade,method:n.method}}e.exports=o},function(e,t,n){var r=n(4).Buffer;function i(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}e.exports=function(e,t){var n=[],o,s,a=!1;function u(t,r){if(o=null,s)return r(s);t?(o=r,e.close()):n.length>0?r(null,n.shift()):o=r}return e.addEventListener("message",function(e){var t=e.data;if(i(t)&&(t=r.from(t)),o)return o(null,t);n.push(t)}),e.addEventListener("close",function(e){s||o&&o(s=!0)}),e.addEventListener("error",function(e){s||(s=e,a||(a=!0,t&&t(e)),o&&o(s))}),e.addEventListener("open",function(e){a||s||(a=!0)}),u}},function(e,t,n){(function(t){var r=n(1056),i="undefined"!=typeof setImmediate?setImmediate:t.nextTick;e.exports=function(e,t){return function(n){t=t||{};var o=!1!==t.closeOnEnd,s="function"==typeof t?t:t.onClose;function a(t,u){t?o&&e.readyState<=1&&(s&&e.addEventListener("close",function(e){if(e.wasClean||1006===e.code)s();else{var t=new Error("ws error");t.event=e,s(t)}}),e.close()):r(e,function(t){if(t)return n(t,function(){});e.send(u),i(function(){n(null,a)})})}n(null,a)}}}).call(this,n(2))},function(e,t){e.exports=function(e,t){var n=e&&(e.removeEventListener||e.removeListener);function r(){"function"==typeof n&&(n.call(e,"open",i),n.call(e,"error",o))}function i(e){r(),t()}function o(e){r(),t(e)}return e.readyState>=2?t(!0):1===e.readyState?t():(e.addEventListener("open",i),void e.addEventListener("error",o))}},function(e,t,n){var{relative:r}=n(306),i={http:"ws",https:"wss"},o="ws";e.exports=function(e,t){return r(e,t,i,o)}},function(e,t,n){"use strict";const r=n(437);e.exports=class e{constructor(e,t){this.peerInfo=null,this.conn=r(),e?this.setInnerConn(e,t):t&&(this.info=t)}get source(){return this.conn.source}get sink(){return this.conn.sink}getPeerInfo(e){return this.info&&this.info.getPeerInfo?this.info.getPeerInfo(e):this.peerInfo?void e(null,this.peerInfo):e(new Error("Peer Info not set yet"))}setPeerInfo(e){if(this.info&&this.info.setPeerInfo)return this.info.setPeerInfo(e);this.peerInfo=e}getObservedAddrs(e){if(this.info&&this.info.getObservedAddrs)return this.info.getObservedAddrs(e);e(null,[])}setInnerConn(e,t){this.conn.resolve(e),this.info=t||e}}},function(e,t,n){"use strict";e.exports=function(){throw new Error("WebSocket Servers can not be created in the browser!")}},function(e,t,n){"use strict";const r=n(5),i=r("libp2p:webrtc-star"),o=n(24),s=n(92),a=n(53),u=n(507),l=n(6).EventEmitter,c=n(254),f=n(23),h=n(44),p=n(66).Connection,d=n(79),m=n(28),g=n(14),y=n(1093),b=n(1094),v=b.cleanUrlSIO,w=b.cleanMultiaddr,_=m(()=>{}),k={transports:["websocket"],"force new connection":!0};class S{constructor(e){e=e||{},this.maSelf=void 0,this.sioOptions={transports:["websocket"],"force new connection":!0},e.wrtc&&(this.wrtc=e.wrtc),this.discovery=new l,this.discovery.tag="webRTCStar",this.discovery.start=(e=>{g(e)}),this.discovery.stop=(e=>{g(e)}),this.listenersRefs={},this._peerDiscovered=this._peerDiscovered.bind(this)}dial(e,t,n){"function"==typeof t&&(n=t,t={}),n=n?m(n):_;const r=(~~(1e9*Math.random())).toString(36)+Date.now(),o=this.listenersRefs[Object.keys(this.listenersRefs)[0]].io,s={initiator:!0,trickle:!1};let a;this.wrtc&&(s.wrtc=this.wrtc);try{a=new c(s)}catch(e){return i("Could not create connection:",e),n(e)}const u=new p(d.duplex(a));let l=!1;return a.on("signal",t=>{o.emit("ss-handshake",{intentId:r,srcMultiaddr:this.maSelf.toString(),dstMultiaddr:e.toString(),signal:t})}),a.once("timeout",()=>n(new Error("timeout"))),a.once("error",e=>{l||n(e)}),o.on("ws-handshake",t=>{if(t.intentId===r&&t.err)return n(new Error(t.err));t.intentId===r&&t.answer&&(a.once("connect",()=>{l=!0,u.destroy=a.destroy.bind(a),a.once("close",()=>u.destroy()),u.getObservedAddrs=(t=>t(null,[e])),n(null,u)}),a.signal(t.signal))}),u}createListener(e,t){"function"==typeof e&&(t=e,e={});const n=new l;return n.listen=((e,r)=>{if(r=r?m(r):_,!y.support&&!this.wrtc)return g(()=>r(new Error("no WebRTC support")));this.maSelf=e;const o=v(e);i("Dialing to Signalling Server on: "+o),n.io=u.connect(o,k),n.io.once("connect_error",r),n.io.once("error",e=>{n.emit("error",e),n.emit("close")}),n.io.on("ws-handshake",a),n.io.on("ws-peer",this._peerDiscovered),n.io.on("connect",()=>{n.io.emit("ss-join",e.toString())}),n.io.once("connect",()=>{n.emit("listening"),r()});const s=this;function a(e){if(e.answer||e.err)return;const o={trickle:!1};let a;s.wrtc&&(o.wrtc=s.wrtc);try{a=new c(o)}catch(e){return i("Could not create incoming connection:",e),r(e)}const u=new p(d.duplex(a));a.once("connect",()=>{u.getObservedAddrs=(t=>t(null,[e.srcMultiaddr])),n.emit("connection",u),t(u)}),a.once("signal",t=>{e.signal=t,e.answer=!0,n.io.emit("ss-handshake",e)}),a.signal(e.signal)}}),n.close=(e=>{e=e?m(e):_,n.io.emit("ss-leave"),g(()=>{n.emit("close"),e()})}),n.getAddrs=(e=>{g(()=>e(null,[this.maSelf]))}),this.listenersRefs[o.toString()]=n,n}filter(e){return Array.isArray(e)||(e=[e]),e.filter(e=>!(e.protoNames().indexOf("p2p-circuit")>-1)&&s.WebRTCStar.matches(e))}_peerDiscovered(e){i("Peer Discovered:",e),e=w(e);const t=e.split("/ipfs/"),n=t[t.length-1],r=f.createFromB58String(n),s=new h(r);s.multiaddrs.add(o(e)),this.discovery.emit("peer",s)}}e.exports=a(S,{className:"WebRTCStar",symbolName:"@libp2p/js-libp2p-webrtc-star/webrtcstar"})},function(e,t,n){var r=n(508),i=n(250)("socket.io-client:url");function o(e,t){var n=e;t=t||"undefined"!=typeof location&&location,null==e&&(e=t.protocol+"//"+t.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(i("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),i("parse %s",e),n=r(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";var o=-1!==n.host.indexOf(":"),s=o?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+s+":"+n.port,n.href=n.protocol+"://"+s+(t&&t.port===n.port?"":":"+n.port),n}e.exports=o},function(e,t,n){function r(e){var n=0,r;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}function i(e){var n;function i(){if(i.enabled){var e=i,r=+new Date,o=r-(n||r);e.diff=o,e.prev=n,e.curr=r,n=r;for(var s=new Array(arguments.length),a=0;a100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var a=parseFloat(t[1]),u=(t[2]||"ms").toLowerCase();switch(u){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function u(e){return e>=o?Math.round(e/o)+"d":e>=i?Math.round(e/i)+"h":e>=r?Math.round(e/r)+"m":e>=n?Math.round(e/n)+"s":e+"ms"}function l(e){return c(e,o,"day")||c(e,i,"hour")||c(e,r,"minute")||c(e,n,"second")||e+" ms"}function c(e,t,n){if(!(e0)return a(e);if("number"===n&&!1===isNaN(e))return t.long?l(e):u(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){(function(r){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function l(){try{return window.localStorage}catch(e){}}t=e.exports=n(1065),t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:l(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(this,n(2))},function(e,t,n){function r(e){var n=0,r;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}function i(e){var n;function i(){if(i.enabled){var e=i,r=+new Date,o=r-(n||r);e.diff=o,e.prev=n,e.curr=r,n=r;for(var s=new Array(arguments.length),a=0;a100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var a=parseFloat(t[1]),u=(t[2]||"ms").toLowerCase();switch(u){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function u(e){return e>=o?Math.round(e/o)+"d":e>=i?Math.round(e/i)+"h":e>=r?Math.round(e/r)+"m":e>=n?Math.round(e/n)+"s":e+"ms"}function l(e){return c(e,o,"day")||c(e,i,"hour")||c(e,r,"minute")||c(e,n,"second")||e+" ms"}function c(e,t,n){if(!(e0)return a(e);if("number"===n&&!1===isNaN(e))return t.long?l(e):u(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){var r=n(509),i=n(510),o=Object.prototype.toString,s="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===o.call(Blob),a="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===o.call(File);function u(e,t){if(!e)return e;if(i(e)){var n={_placeholder:!0,num:t.length};return t.push(e),n}if(r(e)){for(var o=new Array(e.length),s=0;s0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}function f(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}e.exports=c,c.priorWebsocketSuccess=!1,i(c.prototype),c.protocol=a.protocol,c.Socket=c,c.Transport=n(329),c.transports=n(512),c.parser=n(147),c.prototype.createTransport=function(e){o('creating transport "%s"',e);var t=f(this.query);t.EIO=a.protocol,t.transport=e;var n=this.transportOptions[e]||{};this.id&&(t.sid=this.id);var i=new r[e]({query:t,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0,isReactNative:this.isReactNative});return i},c.prototype.open=function(){var e;if(this.rememberUpgrade&&c.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout(function(){t.emit("error","No transports available")},0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},c.prototype.setTransport=function(e){o("setting transport %s",e.name);var t=this;this.transport&&(o("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.onDrain()}).on("packet",function(e){t.onPacket(e)}).on("error",function(e){t.onError(e)}).on("close",function(){t.onClose("transport close")})},c.prototype.probe=function(e){o('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),n=!1,r=this;function i(){if(r.onlyBinaryUpgrades){var i=!this.supportsBinary&&r.transport.supportsBinary;n=n||i}n||(o('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",function(i){if(!n)if("pong"===i.type&&"probe"===i.data){if(o('probe transport "%s" pong',e),r.upgrading=!0,r.emit("upgrading",t),!t)return;c.priorWebsocketSuccess="websocket"===t.name,o('pausing current transport "%s"',r.transport.name),r.transport.pause(function(){n||"closed"!==r.readyState&&(o("changing transport and sending upgrade packet"),h(),r.setTransport(t),t.send([{type:"upgrade"}]),r.emit("upgrade",t),t=null,r.upgrading=!1,r.flush())})}else{o('probe transport "%s" failed',e);var s=new Error("probe error");s.transport=t.name,r.emit("upgradeError",s)}}))}function s(){n||(n=!0,h(),t.close(),t=null)}function a(n){var i=new Error("probe error: "+n);i.transport=t.name,s(),o('probe transport "%s" failed because of error: %s',e,n),r.emit("upgradeError",i)}function u(){a("transport closed")}function l(){a("socket closed")}function f(e){t&&e.name!==t.name&&(o('"%s" works - aborting "%s"',e.name,t.name),s())}function h(){t.removeListener("open",i),t.removeListener("error",a),t.removeListener("close",u),r.removeListener("close",l),r.removeListener("upgrading",f)}c.priorWebsocketSuccess=!1,t.once("open",i),t.once("error",a),t.once("close",u),this.once("close",l),this.once("upgrading",f),t.open()},c.prototype.onOpen=function(){if(o("socket open"),this.readyState="open",c.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){o("starting upgrade probes");for(var e=0,t=this.upgrades.length;er&&(n=r),t>=r||t>=n||0===r)return new ArrayBuffer(0);for(var i=new Uint8Array(e),o=new Uint8Array(n-t),s=t,a=0;s1?r[1]--:r[1]=0,n.time=t=Date.UTC.apply(Date,r)-(t||0),isNaN(t))throw new TypeError("Invalid Date");return _(n)}function C(e){return new v(+e)}function A(e){return T(e,0)}function T(e,t){t|=0,t*=l,e=+e||0;var r=f(t/i)+f(e/i),o=t%i+e%i,s=f(o/i);return s&&(r+=s,o-=s*i),new v(1e3*o,0,r*n)}function I(){var e=_(this),i=Math.floor(e.time/1e3),o=e.year;return o&&(i+=o*r*t/n),i}function j(){return this.toString().replace(/0{1,6}Z$/,"Z")}function R(e){var t=this,n=t.toDate(),r={H:u,L:f,M:c,N:p,S:h,Y:o,a:v,b:b,d:a,e:l,m:s};return i(e||d);function i(e){return e.replace(/%./g,function(e){var t=e[1],n=y[t],o=r[t];return n?i(n):o?o():e})}function o(){var e=t.getYear();return e>999999?"+"+e:e>9999?"+"+F(e,6):e>=0?F(e,4):e>=-999999?"-"+F(-e,6):e}function s(){return M(n.getUTCMonth()+1)}function a(){return M(n.getUTCDate())}function l(){return D(n.getUTCDate())}function u(){return M(n.getUTCHours())}function c(){return M(n.getUTCMinutes())}function h(){return M(n.getUTCSeconds())}function f(){return F(n.getUTCMilliseconds(),3)}function p(){return F(t.getNano(),9)}function v(){return g[n.getUTCDay()]}function b(){return m[n.getUTCMonth()]}}function B(e,i,o,s,a,u){return c;function c(e,i){var o=_(this);e||(e=new Array(8)),P(e,i|=0);var s=Math.floor(o.time/1e3),c=o.year*(r*t/n),p=f(c/l)+f(s/l),d=c%l+s%l,m=Math.floor(d/l);return m&&(p+=m,d-=m*l),h(e,i+a,p),h(e,i+u,d),e}function h(t,n,r){t[n+e]=r>>24&255,t[n+i]=r>>16&255,t[n+o]=r>>8&255,t[n+s]=255&r}}function O(e,t,n,r,i,o){return s;function s(e,t){P(e,t|=0);var n=l(e,t+i),r=l(e,t+o);return T(r,n)}function l(i,o){return i[o+e]*a+(i[o+t]<<16|i[o+n]<<8|i[o+r])}}function P(e,t){var n=e&&e.length;if(null==n)throw new TypeError("Invalid Buffer");if(n9?"":" ")+(0|e)}function M(e){return(e>9?"":"0")+(0|e)}function F(e,t){return(h+(0|e)).substr(-t)}}()},function(e,t,n){"use strict";const r=n(57),i='\nmessage IpnsEntry {\n enum ValidityType {\n\t\tEOL = 0; // setting an EOL says "this record is valid until..."\n\t}\n\n required bytes value = 1;\n\trequired bytes signature = 2;\n\n\toptional ValidityType validityType = 3;\n\toptional bytes validity = 4;\n\n\toptional uint64 sequence = 5;\n\n\toptional uint64 ttl = 6;\n\n\t// in order for nodes to properly validate a record upon receipt, they need the public\n\t// key associated with it. For old RSA keys, its easiest if we just send this as part of\n\t// the record itself. For newer ed25519 keys, the public key can be embedded in the\n\t// peerID, making this field unnecessary.\n\toptional bytes pubKey = 7;\n}\n';e.exports=r(i).IpnsEntry},function(e,t,n){"use strict";e.exports.toRFC3339=(e=>{const t=e.getUTCFullYear(),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCDate()).padStart(2,"0"),i=String(e.getUTCHours()).padStart(2,"0"),o=String(e.getUTCMinutes()).padStart(2,"0"),s=String(e.getUTCSeconds()).padStart(2,"0"),a=e.getUTCMilliseconds(),l=1e3*a*1e3;return`${t}-${n}-${r}T${i}:${o}:${s}.${l}Z`}),e.exports.parseRFC3339=(e=>{const t=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),n=String(e).trim().match(t);if(!n)throw new Error("Invalid format");const r=parseInt(n[1],10),i=parseInt(n[2],10)-1,o=parseInt(n[3],10),s=parseInt(n[4],10),a=parseInt(n[5],10),l=parseInt(n[6],10),u=parseInt(n[7].slice(0,-6),10);return new Date(Date.UTC(r,i,o,s,a,l,u))})},function(e,t,n){"use strict";t.ERR_IPNS_EXPIRED_RECORD="ERR_IPNS_EXPIRED_RECORD",t.ERR_UNRECOGNIZED_VALIDITY="ERR_UNRECOGNIZED_VALIDITY",t.ERR_SIGNATURE_CREATION="ERR_SIGNATURE_CREATION",t.ERR_SIGNATURE_VERIFICATION="ERR_SIGNATURE_VERIFICATION",t.ERR_UNRECOGNIZED_FORMAT="ERR_UNRECOGNIZED_FORMAT",t.ERR_PEER_ID_FROM_PUBLIC_KEY="ERR_PEER_ID_FROM_PUBLIC_KEY",t.ERR_PUBLIC_KEY_FROM_ID="ERR_PUBLIC_KEY_FROM_ID",t.ERR_UNDEFINED_PARAMETER="ERR_UNDEFINED_PARAMETER"},function(e,t,n){"use strict";(function(r){const i=n(158),o=n(51),s=n(15),a=n(13),l=n(4),u=n(38),c=n(10),h=l("ipfs:ipns:republisher");h.error=l("ipfs:ipns:republisher:error");const f=6e4,p=60*f,d=4*p,m=24*p;class g{constructor(e,t,n,r,i){this._publisher=e,this._datastore=t,this._peerInfo=n,this._keychain=r,this._options=i,this._republishHandle=null}start(){if(this._republishHandle){const e="already running";throw h.error(e),a(new Error(e),"ERR_REPUBLISH_ALREADY_RUNNING")}const e={_onCancel:null,_timeoutId:null,runPeriodically:(t,n)=>{e._timeoutId=setTimeout(()=>{e._timeoutId=null,t(r=>{if(e._onCancel)return e._onCancel();e.runPeriodically(t,r||n)})},n)},cancel:t=>{if(e._timeoutId)return clearTimeout(e._timeoutId),t();e._onCancel=t}},{privKey:t}=this._peerInfo.id,{pass:n}=this._options;e.runPeriodically(e=>{this._republishEntries(t,n,()=>e(d))},f),this._republishHandle=e}stop(e){const t=this._republishHandle;if(!t){const t="not running";return h.error(t),e(a(new Error(t),"ERR_REPUBLISH_NOT_RUNNING"))}this._republishHandle=null,t.cancel(e)}_republishEntries(e,t,n){this._republishEntry(e,e=>{if(e){const e="cannot republish entry for the node's private key";h.error(e)}else t?this._keychain.listKeys((e,r)=>{e?h.error(e):u(r,(e,n)=>{c([n=>this._keychain.exportKey(e.name,t,n),(e,n)=>o.keys.import(e,t,n)],(e,t)=>{e?h.error(e):this._republishEntry(t,n)})},e=>{e&&h.error(e),n(null)})}):n(null)})}_republishEntry(e,t){if(!e||!e.bytes){const e="one or more of the provided parameters are not defined";return h.error(e),t(a(new Error(e),"ERR_UNDEFINED_PARAMETER"))}c([t=>s.createFromPrivKey(e.bytes,t),(e,t)=>this._getPreviousValue(e,t)],(n,r)=>{if(n)return t("ERR_NO_ENTRY_FOUND"===n.code?null:n);this._publisher.publishWithEOL(e,r,m,t)})}_getPreviousValue(e,t){if(!s.isPeerId(e)){const e="peerId received is not valid";return h.error(e),t(a(new Error(e),"ERR_INVALID_PEER_ID"))}this._datastore.get(i.getLocalKey(e.id),(n,o)=>{if(n&&n.notFound){const n=`no previous entry for record with id: ${e.id}`;return h.error(n),t(a(new Error(n),"ERR_NO_ENTRY_FOUND"))}if(n)return t(n);if(!r.isBuffer(o)){const e="found ipns record that we couldn't process";return h.error(e),t(a(new Error(e),"ERR_INVALID_IPNS_RECORD"))}let s;try{s=i.unmarshal(o)}catch(n){const e="found ipns record that we couldn't convert to a value";return h.error(e),t(a(new Error(e),"ERR_INVALID_IPNS_RECORD"))}t(null,s.value)})}}t=e.exports=g}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(158),i=n(51),o=n(15),s=n(13),a=n(4),l=a("ipfs:ipns:resolver");l.error=a("ipfs:ipns:resolver:error");const u=32;class c{constructor(e){this._routing=e}resolve(e,t,n){if("function"==typeof t&&(n=t,t={}),"string"!=typeof e){const e="one or more of the provided parameters are not valid";return l.error(e),n(s(new Error(e),"ERR_INVALID_PARAMETER"))}t=t||{};const r=t.recursive&&"true"===t.recursive.toString(),i=e.split("/");if(3!==i.length||""!==i[0]){const t=`invalid name syntax for ${e}`;return l.error(t),n(s(new Error(t),"ERR_INVALID_NAME_SYNTAX"))}const o=i[2];let a;r&&(a=u),this.resolver(o,a,(t,r)=>{if(t)return n(t);l(`${e} was locally resolved correctly`),n(null,r)})}resolver(e,t,n){if(0===t){const e=`could not resolve name (recursion limit of ${u} exceeded)`;return l.error(e),n(s(new Error(e),"ERR_RESOLVE_RECURSION_LIMIT"))}this._resolveName(e,(e,r)=>{if(e)return n(e);const i=r.split("/");if("ipfs"===i[1]||!t)return n(null,r);this.resolver(i[2],t-1,n)})}_resolveName(e,t){let n;try{n=o.createFromB58String(e)}catch(e){return t(e)}const{routingKey:a,routingPubKey:u}=r.getIdKeys(n.toBytes());this._routing.get(a.toBuffer(),(o,c)=>{if(o){if("ERR_NOT_FOUND"!==o.code){const e=`unexpected error getting the ipns record ${n.id}`;return l.error(e),t(s(new Error(e),"ERR_UNEXPECTED_ERROR_GETTING_RECORD"))}const r=`record requested was not found for ${e} (${a}) in the network`;return l.error(r),t(s(new Error(r),"ERR_NO_RECORD_FOUND"))}let h;try{h=r.unmarshal(c)}catch(o){const e="found ipns record that we couldn't convert to a value";return l.error(e),t(s(new Error(e),"ERR_INVALID_RECORD_RECEIVED"))}if(h.pubKey)return this._validateRecord(n,h,t);this._routing.get(a.toBuffer(),(r,o)=>{if(r){if("ERR_NOT_FOUND"!==r.code){const e=`unexpected error getting the public key for the ipns record ${n.id}`;return l.error(e),t(s(new Error(e),"ERR_UNEXPECTED_ERROR_GETTING_PUB_KEY"))}const i=`public key requested was not found for ${e} (${u}) in the network`;return l.error(i),t(s(new Error(i),"ERR_NO_RECORD_FOUND"))}try{n.pubKey=i.keys.unmarshalPublicKey(o)}catch(r){const e="found public key record that we couldn't convert to a value";return l.error(e),t(s(new Error(e),"ERR_INVALID_PUB_KEY_RECEIVED"))}this._validateRecord(n,h,t)})})}_validateRecord(e,t,n){r.extractPublicKey(e,t,(e,i)=>{if(e)return n(e);r.validate(i,t,e=>{if(e)return n(e);n(null,t.value.toString())})})}}t=e.exports=c},function(e,t,n){"use strict";const{TieredDatastore:r}=n(407),i=n(202),o=n(434),s=n(435);e.exports=(e=>{const t=[];let n;if(i(e._options,"EXPERIMENTAL.ipnsPubsub",!1)){const r=e.libp2p.pubsub,i=e._repo.datastore,s=e._peerInfo.id;n=new o(r,i,s),t.push(n)}if(i(e._options,"offline")||!i(e._options,"libp2p.dht.enabled",!1)){const n=new s(e._repo);t.push(n)}else t.push(e.libp2p.dht);return new r(t)})},function(e,t,n){"use strict";(function(r){const{Key:i}=n(28),{encodeBase32:o,keyToTopic:s,topicToKey:a}=n(915),l=n(13),u=n(24),c=n(4),h=c("datastore-pubsub:publisher");h.error=c("datastore-pubsub:publisher:error");class f{constructor(e,t,n,r,i){u.strictEqual(typeof r,"object","missing validator"),u.strictEqual(typeof r.validate,"function","missing validate function"),u.strictEqual(typeof r.select,"function","missing select function"),i&&u.strictEqual(typeof i,"function","invalid subscriptionKeyFn received"),this._pubsub=e,this._datastore=t,this._peerId=n,this._validator=r,this._handleSubscriptionKeyFn=i,this._onMessage=this._onMessage.bind(this)}put(e,t,n){if(!r.isBuffer(e)){const e="datastore key does not have a valid format";return h.error(e),n(l(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}if(!r.isBuffer(t)){const e="received value is not a buffer";return h.error(e),n(l(new Error(e),"ERR_INVALID_VALUE_RECEIVED"))}const i=s(e);h(`publish value for topic ${i}`),this._pubsub.publish(i,t,n)}get(e,t){if(!r.isBuffer(e)){const e="datastore key does not have a valid format";return h.error(e),t(l(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}const n=s(e);this._pubsub.ls((r,i)=>r?t(r):i&&Array.isArray(i)&&i.indexOf(n)>-1?this._getLocal(e,t):void this._pubsub.subscribe(n,this._onMessage,r=>{if(r){const e=`cannot subscribe topic ${n}`;return h.error(e),t(l(new Error(e),"ERR_SUBSCRIBING_TOPIC"))}h(`subscribed values for key ${n}`),this._getLocal(e,t)}))}unsubscribe(e){const t=s(e);this._pubsub.unsubscribe(t,this._onMessage)}_getLocal(e,t){const n=new i("/"+o(e),!1);this._datastore.get(n,(e,i)=>{if(e){if("ERR_NOT_FOUND"!==e.code){const e=`unexpected error getting the ipns record for ${n.toString()}`;return h.error(e),t(l(new Error(e),"ERR_UNEXPECTED_ERROR_GETTING_RECORD"))}const r=`local record requested was not found for ${n.toString()}`;return h.error(r),t(l(new Error(r),"ERR_NOT_FOUND"))}if(!r.isBuffer(i)){const e="found record that we couldn't convert to a value";return h.error(e),t(l(new Error(e),"ERR_INVALID_RECORD_RECEIVED"))}t(null,i)})}_onMessage(e){const{data:t,from:n,topicIDs:r}=e;let i;try{i=a(r[0])}catch(e){return void h.error(e)}h(`message received for ${i} topic`),n!==this._peerId.toB58String()?this._handleSubscriptionKeyFn?this._handleSubscriptionKeyFn(i,(e,n)=>{e?h.error("message discarded by the subscriptionKeyFn"):this._storeIfSubscriptionIsBetter(n,t)}):this._storeIfSubscriptionIsBetter(i,t):h("message discarded as it is from the same peer")}_storeIfSubscriptionIsBetter(e,t){this._isBetter(e,t,(n,i)=>{!n&&i&&this._storeRecord(r.from(e),t)})}_validateRecord(e,t,n){this._validator.validate(e,t,n)}_selectRecord(e,t,n){this._validator.select(e,t,(e,t)=>{if(e)return h.error(e),n(e);n(null,0===t)})}_isBetter(e,t,n){this._validateRecord(t,e,(r,o)=>{if(r||!o){const e="record received through pubsub is not valid";return h.error(e),n(l(new Error(e),"ERR_NOT_VALID_RECORD"))}const s=new i(e);this._getLocal(s.toBuffer(),(e,r)=>e?n(null,!0):r.equals(t)?n(null,!1):void this._selectRecord(t,r,n))})}_storeRecord(e,t){const n=new i("/"+o(e),!1);this._datastore.put(n,t,t=>{t?h.error(`record for ${e.toString()} could not be stored in the routing`):h(`record for ${e.toString()} was stored in the datastore`)})}open(e){const t="open function was not implemented yet";return h.error(t),e(l(new Error(t),"ERR_NOT_IMPLEMENTED_YET"))}has(e,t){const n="has function was not implemented yet";return h.error(n),t(l(new Error(n),"ERR_NOT_IMPLEMENTED_YET"))}delete(e,t){const n="delete function was not implemented yet";return h.error(n),t(l(new Error(n),"ERR_NOT_IMPLEMENTED_YET"))}close(e){const t="close function was not implemented yet";return h.error(t),e(l(new Error(t),"ERR_NOT_IMPLEMENTED_YET"))}batch(){const e="batch function was not implemented yet";throw h.error(e),l(new Error(e),"ERR_NOT_IMPLEMENTED_YET")}query(){const e="query function was not implemented yet";throw h.error(e),l(new Error(e),"ERR_NOT_IMPLEMENTED_YET")}}t=e.exports=f}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(60),i=n(13),o="/record/",s="u";e.exports.encodeBase32=(e=>r.encode("base32",e).slice(1)),e.exports.keyToTopic=(e=>{const t=r.encode("base64url",e).slice(1).toString();return`/record/${t}`}),e.exports.topicToKey=(e=>{if(e.substring(0,o.length)!==o)throw i(new Error("topic received is not from a record"),"ERR_TOPIC_IS_NOT_FROM_RECORD_NAMESPACE");const t=`u${e.substring(o.length)}`;return r.decode(t).toString()})},function(e,t,n){"use strict";(function(t){const r=n(57),i=n(24),o=r(n(917)).Record,s=n(918);class a{constructor(e,n,r){e&&i(t.isBuffer(e),"key must be a Buffer"),n&&i(t.isBuffer(n),"value must be a buffer"),this.key=e,this.value=n,this.timeReceived=r}serialize(){return o.encode(this.prepareSerialize())}prepareSerialize(){return{key:this.key,value:this.value,timeReceived:this.timeReceived&&s.toRFC3339(this.timeReceived)}}static deserialize(e){const t=o.decode(e);return a.fromDeserialized(t)}static fromDeserialized(e){let t;e.timeReceived&&(t=s.parseRFC3339(e.timeReceived));const n=new a(e.key,e.value,t);return n}}e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports="// Record represents a dht record that contains a value\n// for a key value pair\nmessage Record {\n // The key that references this record\n bytes key = 1;\n\n // The actual value this record is storing\n bytes value = 2;\n\n // Note: These fields were removed from the Record message\n // hash of the authors public key\n // optional bytes author = 3;\n // A PKI signature for the key+value+author\n // optional bytes signature = 4;\n\n // Time the record was received, set by receiver\n optional string timeReceived = 5;\n}"},function(e,t,n){"use strict";e.exports.toRFC3339=(e=>{const t=e.getUTCFullYear(),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCDate()).padStart(2,"0"),i=String(e.getUTCHours()).padStart(2,"0"),o=String(e.getUTCMinutes()).padStart(2,"0"),s=String(e.getUTCSeconds()).padStart(2,"0"),a=e.getUTCMilliseconds(),l=1e3*a*1e3;return`${t}-${n}-${r}T${i}:${o}:${s}.${l}Z`}),e.exports.parseRFC3339=(e=>{const t=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),n=String(e).trim().match(t);if(!n)throw new Error("Invalid format");const r=parseInt(n[1],10),i=parseInt(n[2],10)-1,o=parseInt(n[3],10),s=parseInt(n[4],10),a=parseInt(n[5],10),l=parseInt(n[6],10),u=parseInt(n[7].slice(0,-6),10);return new Date(Date.UTC(r,i,o,s,a,l,u))})},function(e,t,n){"use strict";(function(t){const r=n(436),i=n(13),o=(e,n,o)=>{const s=n.key,a=r(s,t.from("/"));if(a.length<3)return o();const l=e[a[1].toString()];if(!l){const e="Invalid record keytype";return o(i(new Error(e),"ERR_INVALID_RECORD_KEY_TYPE"))}l.func(s,n.value,o)};e.exports={verifyRecord:o,validators:n(921)}}).call(this,n(0).Buffer)},function(e,t){e.exports=function e(t,n,r){r=r||0;for(var i=0,o=-1,s=r;s-1&&t.length-o{const s=e=>r(()=>o(e));if(!t.isBuffer(e))return s(new Error('"key" must be a Buffer'));if(e.length<3)return s(new Error("invalid public key record"));const a=e.slice(0,4).toString();if("/pk/"!==a)return s(new Error("key was not prefixed with /pk/"));const l=e.slice(4);i(n,"sha2-256",(e,t)=>e?s(e):l.equals(t)?void s():s(new Error("public key does not match passed in key")))};e.exports={func:o,sign:!1}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(27),i=n(924);function o(e,t,n,i){if("function"==typeof n&&(i=n,n=void 0),!i)throw new Error("Missing callback");o.digest(e,t,n,(e,o)=>{if(e)return i(e);i(null,r.encode(o,t,n))})}e.exports=o,o.Buffer=t,o.multihash=r,o.digest=function(e,t,n,r){if("function"==typeof n&&(r=n,n=void 0),!r)throw new Error("Missing callback");let i=r,s;n&&(i=((e,t)=>{if(e)return r(e);r(null,t.slice(0,n))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=r.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions),o.validate=((e,n,i)=>{let s=r.decode(n).name;o(e,s,(e,r)=>{if(e)return i(e);i(e,0===t.compare(n,r))})})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(357),i=n(359),o=n(437),s=n(925),a=o.toCallback,l=o.toBuf,u=o.fromString,c=o.fromNumberTo32BitBuf,h=(e,n)=>{s.sha2256(e,(e,r)=>{e&&n(e),s.sha2256(t.from(r),n)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(l(r.sha3_512)),sha3384:a(l(r.sha3_384)),sha3256:a(l(r.sha3_256)),sha3224:a(l(r.sha3_224)),shake128:a(l(r.shake_128,128)),shake256:a(l(r.shake_256,256)),keccak224:a(l(r.keccak_224)),keccak256:a(l(r.keccak_256)),keccak384:a(l(r.keccak_384)),keccak512:a(l(r.keccak_512)),murmur3128:a(l(u(i.x64.hash128))),murmur332:a(c(u(i.x86.hash32))),addBlake:n(926),dblSha2256:h}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(361),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");return(n,o)=>{const s=i.digest({name:e},n);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));r(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function l(e,t){s("SHA-256")(e,t)}function u(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:l,sha2512:u}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(363),i=n(437).toCallback,o=45569,s=45633,a={init:r.blake2bInit,update:r.blake2bUpdate,digest:r.blake2bFinal},l={init:r.blake2sInit,update:r.blake2sUpdate,digest:r.blake2sFinal},u=(e,n)=>i(r=>{const i=n.init(e,null);return n.update(i,r),t.from(n.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=u(t+1,a);for(let t=0;t<32;t++)e[s+t]=u(t+1,l)})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(436),i=n(13),o=(e,n,o)=>{if(0===o.length){const e="No records given";throw i(new Error(e),"ERR_NO_RECORDS_RECEIVED")}const s=r(n,t.from("/"));if(s.length<3){const e="Record key does not have a selector function";throw i(new Error(e),"ERR_NO_SELECTOR_FUNCTION_FOR_RECORD_KEY")}const a=e[s[1].toString()];if(!a){const e=`Unrecognized key prefix: ${s[1]}`;throw i(new Error(e),"ERR_UNRECOGNIZED_KEY_PREFIX")}return a(n,o)};e.exports={bestRecord:o,selectors:n(928)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports={pk:n(929)}},function(e,t,n){"use strict";const r=(e,t)=>0;e.exports=r},function(e,t,n){"use strict";const r=n(440),i=n(941),o=n(976),s=n(985),a=n(991),l=n(999),u=n(1e3),c=n(1032),h=n(89),f=n(22);class p extends c{constructor(e){const t=new i({id:e.peerInfo.id}),n=e.peerInfo.multiaddrs.toArray().map(String).filter(e=>e.includes("p2p-websocket-star"));e.peerInfo.multiaddrs.replace(n.map(f),"/p2p-websocket-star");const c=new o({servers:n,id:e.peerInfo.id,ignore_no_online:!n.length||e.wsStarIgnoreErrors}),p={switch:{blacklistTTL:12e4,blackListAttempts:5,maxParallelDials:100,maxColdCalls:25,dialTimeout:2e4},modules:{transport:[r,t,c],streamMuxer:[s],connEncryption:[a],peerDiscovery:[t.discovery,c.discovery,l],dht:u},config:{peerDiscovery:{autoDial:!0,bootstrap:{enabled:!0},webRTCStar:{enabled:!0},websocketStar:{enabled:!0}},dht:{enabled:!1},EXPERIMENTAL:{pubsub:!1}}};super(h(p,e))}}e.exports=p},function(e,t,n){"use strict";var r=n(932),i=n(934),o=n(938);function s(e){return"function"==typeof e}e.exports=function(e,t){s(t)&&(t={onConnect:t});var n="undefined"==typeof window?{}:window.location,a=o(e,n),l=new r(a),u=i(l,t);return u.remoteAddress=a,u.close=function(e){s(e)&&l.addEventListener("close",e),l.close()},l.addEventListener("open",function(e){t&&s(t.onConnect)&&t.onConnect(null,u)}),u},e.exports.connect=e.exports},function(e,t,n){e.exports="undefined"==typeof WebSocket?n(933):WebSocket},function(e,t){},function(e,t,n){var r=n(935),i=n(936);function o(e,t){var n=e.upgradeReq||{};return t&&t.binaryType?e.binaryType=t.binaryType:t&&t.binary&&(e.binaryType="arraybuffer"),{source:r(e,t&&t.onConnect),sink:i(e,t),headers:n.headers,url:n.url,upgrade:n.upgrade,method:n.method}}e.exports=o},function(e,t,n){var r=n(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 n=[],o,s,a=!1;function l(t,r){if(o=null,s)return r(s);t?(o=r,e.close()):n.length>0?r(null,n.shift()):o=r}return e.addEventListener("message",function(e){var t=e.data;if(i(t)&&(t=r.from(t)),o)return o(null,t);n.push(t)}),e.addEventListener("close",function(e){s||o&&o(s=!0)}),e.addEventListener("error",function(e){s||(s=e,a||(a=!0,t&&t(e)),o&&o(s))}),e.addEventListener("open",function(e){a||s||(a=!0)}),l}},function(e,t,n){(function(t){var r=n(937),i="undefined"!=typeof setImmediate?setImmediate:t.nextTick;e.exports=function(e,t){return function(n){t=t||{};var o=!1!==t.closeOnEnd,s="function"==typeof t?t:t.onClose;function a(t,l){t?o&&e.readyState<=1&&(s&&e.addEventListener("close",function(e){if(e.wasClean||1006===e.code)s();else{var t=new Error("ws error");t.event=e,s(t)}}),e.close()):r(e,function(t){if(t)return n(t,function(){});e.send(l),i(function(){n(null,a)})})}n(null,a)}}}).call(this,n(3))},function(e,t){e.exports=function(e,t){var n=e&&(e.removeEventListener||e.removeListener);function r(){"function"==typeof n&&(n.call(e,"open",i),n.call(e,"error",o))}function i(e){r(),t()}function o(e){r(),t(e)}return e.readyState>=2?t(!0):1===e.readyState?t():(e.addEventListener("open",i),void e.addEventListener("error",o))}},function(e,t,n){var{relative:r}=n(191),i={http:"ws",https:"wss"},o="ws";e.exports=function(e,t){return r(e,t,i,o)}},function(e,t,n){"use strict";const r=n(349);e.exports=class e{constructor(e,t){this.peerInfo=null,this.conn=r(),e?this.setInnerConn(e,t):t&&(this.info=t)}get source(){return this.conn.source}get sink(){return this.conn.sink}getPeerInfo(e){return this.info&&this.info.getPeerInfo?this.info.getPeerInfo(e):this.peerInfo?void e(null,this.peerInfo):e(new Error("Peer Info not set yet"))}setPeerInfo(e){if(this.info&&this.info.setPeerInfo)return this.info.setPeerInfo(e);this.peerInfo=e}getObservedAddrs(e){if(this.info&&this.info.getObservedAddrs)return this.info.getObservedAddrs(e);e(null,[])}setInnerConn(e,t){this.conn.resolve(e),this.info=t||e}}},function(e,t,n){"use strict";e.exports=function(){throw new Error("WebSocket Servers can not be created in the browser!")}},function(e,t,n){"use strict";const r=n(4),i=r("libp2p:webrtc-star"),o=n(22),s=n(72),a=n(39),l=n(442),u=n(6).EventEmitter,c=n(967),h=n(15),f=n(31),p=n(64).Connection,d=n(69),m=n(26),g=n(20),y=n(974),v=n(975),b=v.cleanUrlSIO,_=v.cleanMultiaddr,w=m(()=>{}),k={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 u,this.discovery.tag="webRTCStar",this.discovery.start=(e=>{g(e)}),this.discovery.stop=(e=>{g(e)}),this.listenersRefs={},this._peerDiscovered=this._peerDiscovered.bind(this)}dial(e,t,n){"function"==typeof t&&(n=t,t={}),n=n?m(n):w;const r=(~~(1e9*Math.random())).toString(36)+Date.now(),o=this.listenersRefs[Object.keys(this.listenersRefs)[0]].io,s={initiator:!0,trickle:!1};let a;this.wrtc&&(s.wrtc=this.wrtc);try{a=new c(s)}catch(e){return i("Could not create connection:",e),n(e)}const l=new p(d.duplex(a));let u=!1;return a.on("signal",t=>{o.emit("ss-handshake",{intentId:r,srcMultiaddr:this.maSelf.toString(),dstMultiaddr:e.toString(),signal:t})}),a.once("timeout",()=>n(new Error("timeout"))),a.once("error",e=>{u||n(e)}),o.on("ws-handshake",t=>{if(t.intentId===r&&t.err)return n(new Error(t.err));t.intentId===r&&t.answer&&(a.once("connect",()=>{u=!0,l.destroy=a.destroy.bind(a),a.once("close",()=>l.destroy()),l.getObservedAddrs=(t=>t(null,[e])),n(null,l)}),a.signal(t.signal))}),l}createListener(e,t){"function"==typeof e&&(t=e,e={});const n=new u;return n.listen=((e,r)=>{if(r=r?m(r):w,!y.support&&!this.wrtc)return g(()=>r(new Error("no WebRTC support")));this.maSelf=e;const o=b(e);i("Dialing to Signalling Server on: "+o),n.io=l.connect(o,k),n.io.once("connect_error",r),n.io.once("error",e=>{n.emit("error",e),n.emit("close")}),n.io.on("ws-handshake",a),n.io.on("ws-peer",this._peerDiscovered),n.io.on("connect",()=>{n.io.emit("ss-join",e.toString())}),n.io.once("connect",()=>{n.emit("listening"),r()});const s=this;function a(e){if(e.answer||e.err)return;const o={trickle:!1};let a;s.wrtc&&(o.wrtc=s.wrtc);try{a=new c(o)}catch(e){return i("Could not create incoming connection:",e),r(e)}const l=new p(d.duplex(a));a.once("connect",()=>{l.getObservedAddrs=(t=>t(null,[e.srcMultiaddr])),n.emit("connection",l),t(l)}),a.once("signal",t=>{e.signal=t,e.answer=!0,n.io.emit("ss-handshake",e)}),a.signal(e.signal)}}),n.close=(e=>{e=e?m(e):w,n.io.emit("ss-leave"),g(()=>{n.emit("close"),e()})}),n.getAddrs=(e=>{g(()=>e(null,[this.maSelf]))}),this.listenersRefs[o.toString()]=n,n}filter(e){return Array.isArray(e)||(e=[e]),e.filter(e=>!(e.protoNames().indexOf("p2p-circuit")>-1)&&s.WebRTCStar.matches(e))}_peerDiscovered(e){i("Peer Discovered:",e),e=_(e);const t=e.split("/ipfs/"),n=t[t.length-1],r=h.createFromB58String(n),s=new f(r);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,n){var r=n(443),i=n(208)("socket.io-client:url");function o(e,t){var n=e;t=t||"undefined"!=typeof location&&location,null==e&&(e=t.protocol+"//"+t.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(i("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),i("parse %s",e),n=r(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";var o=-1!==n.host.indexOf(":"),s=o?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+s+":"+n.port,n.href=n.protocol+"://"+s+(t&&t.port===n.port?"":":"+n.port),n}e.exports=o},function(e,t,n){function r(e){var n=0,r;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}function i(e){var n;function i(){if(i.enabled){var e=i,r=+new Date,o=r-(n||r);e.diff=o,e.prev=n,e.curr=r,n=r;for(var s=new Array(arguments.length),a=0;a100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var a=parseFloat(t[1]),l=(t[2]||"ms").toLowerCase();switch(l){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function l(e){return e>=o?Math.round(e/o)+"d":e>=i?Math.round(e/i)+"h":e>=r?Math.round(e/r)+"m":e>=n?Math.round(e/n)+"s":e+"ms"}function u(e){return c(e,o,"day")||c(e,i,"hour")||c(e,r,"minute")||c(e,n,"second")||e+" ms"}function c(e,t,n){if(!(e0)return a(e);if("number"===n&&!1===isNaN(e))return t.long?u(e):l(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){(function(r){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function l(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function u(){try{return window.localStorage}catch(e){}}t=e.exports=n(946),t.log=s,t.formatArgs=o,t.save=a,t.load=l,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:u(),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(l())}).call(this,n(3))},function(e,t,n){function r(e){var n=0,r;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}function i(e){var n;function i(){if(i.enabled){var e=i,r=+new Date,o=r-(n||r);e.diff=o,e.prev=n,e.curr=r,n=r;for(var s=new Array(arguments.length),a=0;a100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var a=parseFloat(t[1]),l=(t[2]||"ms").toLowerCase();switch(l){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function l(e){return e>=o?Math.round(e/o)+"d":e>=i?Math.round(e/i)+"h":e>=r?Math.round(e/r)+"m":e>=n?Math.round(e/n)+"s":e+"ms"}function u(e){return c(e,o,"day")||c(e,i,"hour")||c(e,r,"minute")||c(e,n,"second")||e+" ms"}function c(e,t,n){if(!(e0)return a(e);if("number"===n&&!1===isNaN(e))return t.long?u(e):l(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){var r=n(444),i=n(445),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 l(e,t){if(!e)return e;if(i(e)){var n={_placeholder:!0,num:t.length};return t.push(e),n}if(r(e)){for(var o=new Array(e.length),s=0;s0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}function h(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}e.exports=c,c.priorWebsocketSuccess=!1,i(c.prototype),c.protocol=a.protocol,c.Socket=c,c.Transport=n(268),c.transports=n(447),c.parser=n(125),c.prototype.createTransport=function(e){o('creating transport "%s"',e);var t=h(this.query);t.EIO=a.protocol,t.transport=e;var n=this.transportOptions[e]||{};this.id&&(t.sid=this.id);var i=new r[e]({query:t,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0,isReactNative:this.isReactNative});return i},c.prototype.open=function(){var e;if(this.rememberUpgrade&&c.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout(function(){t.emit("error","No transports available")},0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},c.prototype.setTransport=function(e){o("setting transport %s",e.name);var t=this;this.transport&&(o("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.onDrain()}).on("packet",function(e){t.onPacket(e)}).on("error",function(e){t.onError(e)}).on("close",function(){t.onClose("transport close")})},c.prototype.probe=function(e){o('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),n=!1,r=this;function i(){if(r.onlyBinaryUpgrades){var i=!this.supportsBinary&&r.transport.supportsBinary;n=n||i}n||(o('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",function(i){if(!n)if("pong"===i.type&&"probe"===i.data){if(o('probe transport "%s" pong',e),r.upgrading=!0,r.emit("upgrading",t),!t)return;c.priorWebsocketSuccess="websocket"===t.name,o('pausing current transport "%s"',r.transport.name),r.transport.pause(function(){n||"closed"!==r.readyState&&(o("changing transport and sending upgrade packet"),f(),r.setTransport(t),t.send([{type:"upgrade"}]),r.emit("upgrade",t),t=null,r.upgrading=!1,r.flush())})}else{o('probe transport "%s" failed',e);var s=new Error("probe error");s.transport=t.name,r.emit("upgradeError",s)}}))}function s(){n||(n=!0,f(),t.close(),t=null)}function a(n){var i=new Error("probe error: "+n);i.transport=t.name,s(),o('probe transport "%s" failed because of error: %s',e,n),r.emit("upgradeError",i)}function l(){a("transport closed")}function u(){a("socket closed")}function h(e){t&&e.name!==t.name&&(o('"%s" works - aborting "%s"',e.name,t.name),s())}function f(){t.removeListener("open",i),t.removeListener("error",a),t.removeListener("close",l),r.removeListener("close",u),r.removeListener("upgrading",h)}c.priorWebsocketSuccess=!1,t.once("open",i),t.once("error",a),t.once("close",l),this.once("close",u),this.once("upgrading",h),t.open()},c.prototype.onOpen=function(){if(o("socket open"),this.readyState="open",c.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){o("starting upgrade probes");for(var e=0,t=this.upgrades.length;er&&(n=r),t>=r||t>=n||0===r)return new ArrayBuffer(0);for(var i=new Uint8Array(e),o=new Uint8Array(n-t),s=t,a=0;s=55296&&i<=56319&&n65535&&(i-=65536,o+=n(i>>>10&1023|55296),i=56320|1023&i),o+=n(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 l(e,t){return n(e>>t&63|128)}function c(e,t){if(0==(4294967168&e))return n(e);var r="";return 0==(4294965248&e)?r=n(e>>6&31|192):0==(4294901760&e)?(u(e,t)||(e=65533),r=n(e>>12&15|224),r+=l(e,6)):0==(4292870144&e)&&(r=n(e>>18&7|240),r+=l(e,12),r+=l(e,6)),r+=n(63&e|128),r}function f(e,t){t=t||{};for(var n=!1!==t.strict,r=s(e),i=r.length,o=-1,a,u="";++o=i)throw Error("Invalid byte index");var e=255&r[o];if(o++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function p(e){var t,n,s,a,l;if(o>i)throw Error("Invalid byte index");if(o==i)return!1;if(t=255&r[o],o++,0==(128&t))return t;if(192==(224&t)){if(n=h(),l=(31&t)<<6|n,l>=128)return l;throw Error("Invalid continuation byte")}if(224==(240&t)){if(n=h(),s=h(),l=(15&t)<<12|n<<6|s,l>=2048)return u(l,e)?l:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(n=h(),s=h(),a=h(),l=(7&t)<<18|n<<12|s<<6|a,l>=65536&&l<=1114111))return l;throw Error("Invalid UTF-8 detected")}function d(e,t){t=t||{};var n=!1!==t.strict;r=s(e),i=r.length,o=0;for(var u=[],l;!1!==(l=p(n));)u.push(l);return a(u)}e.exports={version:"2.1.2",encode:f,decode:d}},function(e,t){!function(){"use strict";for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(256),r=0;r>2],o+=e[(3&n[r])<<4|n[r+1]>>4],o+=e[(15&n[r+1])<<2|n[r+2]>>6],o+=e[63&n[r+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,r=e.length,i,o=0,s,a,u,l;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);var c=new ArrayBuffer(t),f=new Uint8Array(c);for(i=0;i>4,f[o++]=(15&a)<<4|u>>2,f[o++]=(3&u)<<6|63&l;return c}}()},function(e,t){var n=void 0!==n?n:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,r=function(){try{var e=new Blob(["hi"]);return 2===e.size}catch(e){return!1}}(),i=r&&function(){try{var e=new Blob([new Uint8Array([1,2])]);return 2===e.size}catch(e){return!1}}(),o=n&&n.prototype.append&&n.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 n=new Uint8Array(e.byteLength);n.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=n.buffer}return t}return e})}function a(e,t){t=t||{};var r=new n;return s(e).forEach(function(e){r.append(e)}),t.type?r.getBlob(t.type):r.getBlob()}function u(e,t){return new Blob(s(e),t||{})}"undefined"!=typeof Blob&&(a.prototype=Blob.prototype,u.prototype=Blob.prototype),e.exports=r?i?Blob:u:o?a:void 0},function(e,t,n){function r(e){var n=0,r;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}function i(e){var n;function i(){if(i.enabled){var e=i,r=+new Date,o=r-(n||r);e.diff=o,e.prev=n,e.curr=r,n=r;for(var s=new Array(arguments.length),a=0;a100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var a=parseFloat(t[1]),u=(t[2]||"ms").toLowerCase();switch(u){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function u(e){return e>=o?Math.round(e/o)+"d":e>=i?Math.round(e/i)+"h":e>=r?Math.round(e/r)+"m":e>=n?Math.round(e/n)+"s":e+"ms"}function l(e){return c(e,o,"day")||c(e,i,"hour")||c(e,r,"minute")||c(e,n,"second")||e+" ms"}function c(e,t,n){if(!(e0)return a(e);if("number"===n&&!1===isNaN(e))return t.long?l(e):u(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){(function(t){var r=n(513),i=n(252);e.exports=c;var o=/\n/g,s=/\\n/g,a;function u(){}function l(){return"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:{}}function c(e){if(r.call(this,e),this.query=this.query||{},!a){var t=l();a=t.___eio=t.___eio||[]}this.index=a.length;var n=this;a.push(function(e){n.onData(e)}),this.query.j=this.index,"function"==typeof addEventListener&&addEventListener("beforeunload",function(){n.script&&(n.script.onerror=u)},!1)}i(c,r),c.prototype.supportsBinary=!1,c.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),r.prototype.doClose.call(this)},c.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 n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(t,n):(document.head||document.body).appendChild(t),this.script=t;var r="undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent);r&&setTimeout(function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)},100)},c.prototype.doWrite=function(e,t){var n=this;if(!this.form){var r=document.createElement("form"),i=document.createElement("textarea"),a=this.iframeId="eio_iframe_"+this.index,u;r.className="socketio",r.style.position="absolute",r.style.top="-1000px",r.style.left="-1000px",r.target=a,r.method="POST",r.setAttribute("accept-charset","utf-8"),i.name="d",r.appendChild(i),document.body.appendChild(r),this.form=r,this.area=i}function l(){c(),t()}function c(){if(n.iframe)try{n.form.removeChild(n.iframe)}catch(e){n.onError("jsonp polling iframe removal error",e)}try{var e='