UNPKG

1.79 MBJavaScriptView Raw
1/*! For license information please see index.min.js.LICENSE.txt */
2!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Ipfs=t():e.Ipfs=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=358)}([function(e,t,r){"use strict";(function(e){var n=r(371),i=r(198),s=r(372);function o(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(o()<t)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=c.prototype:(null===e&&(e=new c(t)),e.length=t),e}function c(e,t,r){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return h(this,e)}return u(this,e,t,r)}function u(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);c.TYPED_ARRAY_SUPPORT?(e=t).__proto__=c.prototype:e=l(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!c.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(t,r),i=(e=a(e,n)).write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(c.isBuffer(t)){var r=0|d(t.length);return 0===(e=a(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?a(e,0):l(e,t);if("Buffer"===t.type&&s(t.data))return l(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function f(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function h(e,t){if(f(t),e=a(e,t<0?0:0|d(t)),!c.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function l(e,t){var r=t.length<0?0:0|d(t.length);e=a(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function d(e){if(e>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function p(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(e).length;default:if(n)return z(e).length;t=(""+t).toLowerCase(),n=!0}}function b(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,r);case"utf8":case"utf-8":return I(this,t,r);case"ascii":return T(this,t,r);case"latin1":case"binary":return R(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,i){var s,o=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var f=-1;for(s=r;s<a;s++)if(u(e,s)===u(t,-1===f?0:s-f)){if(-1===f&&(f=s),s-f+1===c)return f*o}else-1!==f&&(s-=s-f),f=-1}else for(r+c>a&&(r=a-c),s=r;s>=0;s--){for(var h=!0,l=0;l<c;l++)if(u(e,s+l)!==u(t,l)){h=!1;break}if(h)return s}return-1}function v(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var o=0;o<n;++o){var a=parseInt(t.substr(2*o,2),16);if(isNaN(a))return o;e[r+o]=a}return o}function w(e,t,r,n){return q(z(t,e.length-r),e,r,n)}function _(e,t,r,n){return q(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function E(e,t,r,n){return _(e,t,r,n)}function k(e,t,r,n){return q(F(t),e,r,n)}function S(e,t,r,n){return q(function(e,t){for(var r,n,i,s=[],o=0;o<e.length&&!((t-=2)<0);++o)r=e.charCodeAt(o),n=r>>8,i=r%256,s.push(i),s.push(n);return s}(t,e.length-r),e,r,n)}function A(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function I(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var s,o,a,c,u=e[i],f=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h<=r)switch(h){case 1:u<128&&(f=u);break;case 2:128==(192&(s=e[i+1]))&&(c=(31&u)<<6|63&s)>127&&(f=c);break;case 3:s=e[i+1],o=e[i+2],128==(192&s)&&128==(192&o)&&(c=(15&u)<<12|(63&s)<<6|63&o)>2047&&(c<55296||c>57343)&&(f=c);break;case 4:s=e[i+1],o=e[i+2],a=e[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(c=(15&u)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&c<1114112&&(f=c)}null===f?(f=65533,h=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=h}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return r}(n)}t.Buffer=c,t.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){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(t){return!1}}(),t.kMaxLength=o(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,r){return u(null,e,t,r)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,r){return function(e,t,r,n){return f(t),t<=0?a(e,t):void 0!==r?"string"==typeof n?a(e,t).fill(r,n):a(e,t).fill(r):a(e,t)}(null,e,t,r)},c.allocUnsafe=function(e){return h(null,e)},c.allocUnsafeSlow=function(e){return h(null,e)},c.isBuffer=function(e){return!(null==e||!e._isBuffer)},c.compare=function(e,t){if(!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!s(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=c.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(!c.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},c.byteLength=p,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)y(this,t,t+1);return this},c.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},c.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},c.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?I(this,0,e):b.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},c.prototype.compare=function(e,t,r,n,i){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var s=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),a=Math.min(s,o),u=this.slice(n,i),f=e.slice(t,r),h=0;h<a;++h)if(u[h]!==f[h]){s=u[h],o=f[h];break}return s<o?-1:o<s?1:0},c.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},c.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},c.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":return _(this,e,t,r);case"latin1":case"binary":return E(this,e,t,r);case"base64":return k(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function R(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function x(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",s=t;s<r;++s)i+=U(e[s]);return i}function C(e,t,r){for(var n=e.slice(t,r),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);return i}function B(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,s){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function N(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(e.length-r,2);i<s;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function P(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(e.length-r,4);i<s;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function O(e,t,r,n,i,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,n,s){return s||O(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function L(e,t,r,n,s){return s||O(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),c.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=c.prototype;else{var i=t-e;r=new c(i,void 0);for(var s=0;s<i;++s)r[s]=this[s+e]}return r},c.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||B(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n},c.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||B(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},c.prototype.readUInt8=function(e,t){return t||B(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||B(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||B(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||B(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||B(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||B(e,t,this.length);for(var n=t,i=1,s=this[e+--n];n>0&&(i*=256);)s+=this[e+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},c.prototype.readInt8=function(e,t){return t||B(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||B(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){t||B(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||B(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||B(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||B(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||B(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||M(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,s=0;for(this[t]=255&e;++s<r&&(i*=256);)this[t+s]=e/i&255;return t+r},c.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||M(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},c.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||M(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||M(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||M(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||M(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):P(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||M(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):P(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s<r&&(o*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var s=r-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||M(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||M(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||M(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||M(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):P(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):P(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return L(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return L(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,s=n-r;if(this===e&&r<t&&t<n)for(i=s-1;i>=0;--i)e[i+t]=this[i+r];else if(s<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i<s;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+s),t);return s},c.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!c.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var s;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s<r;++s)this[s]=e;else{var o=c.isBuffer(e)?e:z(new c(e,n).toString()),a=o.length;for(s=0;s<r-t;++s)this[s+t]=o[s%a]}return this};var j=/[^+\/0-9A-Za-z-_]/g;function U(e){return e<16?"0"+e.toString(16):e.toString(16)}function z(e,t){var r;t=t||1/0;for(var n=e.length,i=null,s=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function F(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(j,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,r(10))},function(e,t,r){"use strict";function n(e,t){for(const r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}e.exports=function(e,t,r){if(!e||"string"==typeof e)throw new TypeError("Please pass an Error to err-code");r||(r={}),"object"==typeof t&&(r=t,t=void 0),null!=t&&(r.code=t);try{return n(e,r)}catch(i){r.message=e.message,r.stack=e.stack;const t=function(){};return t.prototype=Object.create(Object.getPrototypeOf(e)),n(new t,r)}}},function(e,t,r){"use strict";(function(n){t.log=function(...e){return"object"==typeof console&&console.log&&console.log(...e)},t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))}),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(r){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(r){}!e&&void 0!==n&&"env"in n&&(e={NODE_ENV:"production"}.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"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+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=r(361)(t);const{formatters:i}=e.exports;i.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this,r(8))},function(e,t,r){"use strict";const n=r(49),i=r(4),{Buffer:s}=r(0),o=r(233),a=r(70),c=r(136).default,u=r(7).Key,{TimeoutError:f}=r(75),h=r(98);t.OFFLINE_ERROR="This command must be run in online mode. Try running 'ipfs daemon' first.",t.MFS_FILE_TYPES={file:0,directory:1,"hamt-sharded-directory":1},t.MFS_ROOT_KEY=new u("/local/filesroot"),t.MFS_MAX_CHUNK_SIZE=262144,t.MFS_MAX_LINKS=174;t.normalizePath=e=>{if(n.cid(e))return"/ipfs/".concat(new i(e));if(n.path(e))return e;throw Object.assign(new Error("invalid path: ".concat(e)),{code:"ERR_BAD_PATH"})},t.normalizeCidPath=e=>s.isBuffer(e)?new i(e).toString():i.isCID(e)?e.toString():(0===e.indexOf("/ipfs/")&&(e=e.substring("/ipfs/".length)),"/"===e.charAt(e.length-1)&&(e=e.substring(0,e.length-1)),e),t.resolvePath=async function(e,t,r){r=r||{},Array.isArray(t)||(t=[t]);const s=[];for(const o of t){if(n.cid(o)){s.push(new i(o));continue}const{cid:t,path:a}=h(o);if(!a){s.push(t);continue}const c=await e.resolve(t,{...r,path:a});i.isCID(c.cid)&&s.push(c.cid)}return s},t.mapFile=(e,t)=>{t=t||{};const r={cid:e.cid,path:e.path,name:e.name,depth:e.path.split("/").length,size:0,type:"file"};return e.unixfs&&(r.type="directory"===e.unixfs.type?"dir":"file","file"===e.unixfs.type&&(r.size=e.unixfs.fileSize(),t.includeContent&&(r.content=e.content())),r.mode=e.unixfs.mode,r.mtime=e.unixfs.mtime),r},t.withTimeoutOption=function(e,t){return(...r)=>{const n=r[null==t?r.length-1:t];if(!n||!n.timeout)return e(...r);const i="string"==typeof n.timeout?c(n.timeout):n.timeout,s=new o(i);n.signal=a([n.signal,s.signal]);const u=e(...r),h=new Promise((e,t)=>{s.signal.addEventListener("abort",()=>{t(new f)})}),l=Date.now(),d=()=>{if(s.signal.aborted)throw new f;if(Date.now()-l>i)throw s.abort(),new f};return u[Symbol.asyncIterator]?async function*(){const e=u[Symbol.asyncIterator]();try{for(;;){const{value:t,done:r}=await Promise.race([e.next(),h]);if(r)break;d(),yield t}}catch(t){throw d(),t}finally{s.clear(),e.return&&e.return()}}():(async()=>{try{const e=await Promise.race([u,h]);return d(),e}catch(e){throw d(),e}finally{s.clear()}})()}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(17),s=r(27),o=r(11),a=r(71),c=r(384),u=r(21);class f{constructor(e,t,r,a){if(h.isCID(e)){const t=e;return this.version=t.version,this.codec=t.codec,this.multihash=n.from(t.multihash),void(this.multibaseName=t.multibaseName||(0===t.version?"base58btc":"base32"))}if("string"==typeof e){const t=s.isEncoded(e);if(t){const r=s.decode(e);this.version=parseInt(r.slice(0,1).toString("hex"),16),this.codec=o.getCodec(r.slice(1)),this.multihash=o.rmPrefix(r.slice(1)),this.multibaseName=t}else this.version=0,this.codec="dag-pb",this.multihash=i.fromB58String(e),this.multibaseName="base58btc";return f.validateCID(this),void Object.defineProperty(this,"string",{value:e})}if(n.isBuffer(e)){const t=e.slice(0,1),r=parseInt(t.toString("hex"),16);if(1===r){const t=e;this.version=r,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";f.validateCID(this)}else this.version=e,this.codec=t,this.multihash=r,this.multibaseName=a||(0===e?"base58btc":"base32"),f.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=n.concat([n.from("01","hex"),o.getCodeVarint(this.codec),this.multihash])}Object.defineProperty(this,"_buffer",{value:e})}return e}get prefix(){return n.concat([n.from("0".concat(this.version),"hex"),o.getCodeVarint(this.codec),i.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}=i.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 h(0,this.codec,this.multihash)}toV1(){return new h(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=i.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");t=s.encode(e,this.buffer).toString()}return e===this.multibaseName&&Object.defineProperty(this,"string",{value:t}),t}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}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){const t=c.checkCIDComponents(e);if(t)throw new Error(t)}}const h=u(f,{className:"CID",symbolName:"@ipld/js-cid/CID"});h.codecs=a,e.exports=h},function(e,t,r){"use strict";e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(17),s=r(4),o=r(201),a=r(21),{PeerIdProto:c}=r(446);const u=a(class{constructor(e,t,r){if(!n.isBuffer(e))throw new Error("invalid id provided");if(t&&r&&!t.public.bytes.equals(r.bytes))throw new Error("inconsistent arguments");this._id=e,this._idB58String=i.toB58String(this.id),this._privKey=t,this._pubKey=r}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){if(this._pubKey)return this._pubKey;if(this._privKey)return this._privKey.public;try{const e=i.decode(this.id);"identity"===e.name&&(this._pubKey=o.unmarshalPublicKey(e.digest))}catch(e){}return this._pubKey}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return o.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.marshalPrivateKey(this.privKey)}marshal(e){return c.encode({id:this.toBytes(),pubKey:this.marshalPubKey(),privKey:e?null:this.marshalPrivKey()})}toPrint(){let e=this.toB58String();e.startsWith("Qm")&&(e=e.slice(2));let t=6;return e.length<t&&(t=e.length),"<peer.ID "+e.substr(0,t)+">"}toJSON(){return{id:this.toB58String(),privKey:l(this.marshalPrivKey()),pubKey:l(this.marshalPubKey())}}toHexString(){return i.toHexString(this.id)}toBytes(){return this.id}toB58String(){return this._idB58String}toString(){if(!this._idCIDString){const e=new s(1,"libp2p-key",this.id,"base32");this._idCIDString=e.toBaseEncodedString("base32")}return this._idCIDString}equals(e){if(n.isBuffer(e))return this.id.equals(e);if(e.id)return this.id.equals(e.id);throw new Error("not valid Id")}isEqual(e){return this.equals(e)}isValid(){return Boolean(this.privKey&&this.privKey.public&&this.privKey.public.bytes&&n.isBuffer(this.pubKey.bytes)&&this.privKey.public.bytes.equals(this.pubKey.bytes))}},{className:"PeerId",symbolName:"@libp2p/js-peer-id/PeerId"});t=e.exports=u;const f=e=>e.bytes.length<=42?i.encode(e.bytes,"identity"):e.hash(),h=async(e,t)=>{const r=await f(t);return new u(r,e,t)};t.create=async e=>{(e=e||{}).bits=e.bits||2048,e.keyType=e.keyType||"RSA";const t=await o.generateKeyPair(e.keyType,e.bits);return h(t,t.public)},t.createFromHexString=e=>new u(i.fromHexString(e)),t.createFromBytes=e=>new u(e),t.createFromB58String=e=>t.createFromCID(e);function l(e){if(e)return e.toString("base64")}t.createFromCID=e=>{if(!(e=>"libp2p-key"===e.codec||"dag-pb"===e.codec)(e=s.isCID(e)?e:new s(e)))throw new Error("Supplied PeerID CID has invalid multicodec: "+e.codec);return new u(e.multihash)},t.createFromPubKey=async e=>{let t=e;if("string"==typeof t&&(t=n.from(e,"base64")),!n.isBuffer(t))throw new Error("Supplied key is neither a base64 string nor a buffer");const r=await o.unmarshalPublicKey(t);return h(null,r)},t.createFromPrivKey=async e=>{let t=e;if("string"==typeof t&&(t=n.from(e,"base64")),!n.isBuffer(t))throw new Error("Supplied key is neither a base64 string nor a buffer");const r=await o.unmarshalPrivateKey(t);return h(r,r.public)},t.createFromJSON=async e=>{const t=i.fromB58String(e.id),r=e.privKey&&n.from(e.privKey,"base64"),s=e.pubKey&&n.from(e.pubKey,"base64"),a=s&&await o.unmarshalPublicKey(s);if(!r)return new u(t,null,a);const c=await o.unmarshalPrivateKey(r),h=await f(c.public);let l;if(a&&(l=await f(a)),a&&!h.equals(l))throw new Error("Public and private key do not match");if(t&&!h.equals(t))throw new Error("Id and private key do not match");return new u(t,c,a)},t.createFromProtobuf=async e=>{"string"==typeof e&&(e=n.from(e,"hex"));let t,r,{id:i,privKey:s,pubKey:a}=c.decode(e);if(s=!!s&&await o.unmarshalPrivateKey(s),a=!!a&&await o.unmarshalPublicKey(a),s&&(r=await f(s.public)),a&&(t=await f(a)),s){if(a&&!r.equals(t))throw new Error("Public and private key do not match");return new u(r,s,s.public)}if(a)return new u(t,null,a);if(i)return new u(i);throw new Error("Protobuf did not contain any usable key material")},t.isPeerId=e=>Boolean("object"==typeof e&&e._id&&e._idB58String)},function(e,t,r){"use strict";const n=r(234),i=r(520),s=r(237),o=r(239),a=r(236);t.Key=n,t.MemoryDatastore=i,t.utils=s,t.Errors=o,t.Adapter=a},function(e,t,r){"use strict";var n,i,s=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(e){i=a}}();var u,f=[],h=!1,l=-1;function d(){h&&u&&(h=!1,u.length?f=u.concat(f):l=-1,f.length&&p())}function p(){if(!h){var e=c(d);h=!0;for(var t=f.length;t;){for(u=f,f=[];++l<t;)u&&u[l].run();l=-1,t=f.length}u=null,h=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function b(e,t){this.fun=e,this.array=t}function y(){}s.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];f.push(new b(e,t)),1!==f.length||h||c(p)},b.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=y,s.addListener=y,s.once=y,s.off=y,s.removeListener=y,s.removeAllListeners=y,s.emit=y,s.prependListener=y,s.prependOnceListener=y,s.listeners=function(e){return[]},s.binding=function(e){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},function(e,t,r){"use strict";(function(t,n,i,s){var o=r(5),a=r(396),c=e.exports=o.util=o.util||{};function u(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function f(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(c.isArrayBuffer(e)||c.isArrayBufferView(e))if(void 0!==s&&e instanceof s)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(n){for(var r=0;r<t.length;++r)this.putByte(t[r])}}else(e instanceof f||"object"==typeof e&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if(void 0!==t&&t.nextTick&&!t.browser)return c.nextTick=t.nextTick,void(c.setImmediate="function"==typeof n?n:c.nextTick);if("function"==typeof n)return c.setImmediate=function(){return n.apply(void 0,arguments)},void(c.nextTick=function(e){return n(e)});if(c.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var e="forge.setImmediate",r=[];c.setImmediate=function(t){r.push(t),1===r.length&&window.postMessage(e,"*")},window.addEventListener("message",(function(t){if(t.source===window&&t.data===e){t.stopPropagation();var n=r.slice();r.length=0,n.forEach((function(e){e()}))}}),!0)}if("undefined"!=typeof MutationObserver){var i=Date.now(),s=!0,o=document.createElement("div");r=[];new MutationObserver((function(){var e=r.slice();r.length=0,e.forEach((function(e){e()}))})).observe(o,{attributes:!0});var a=c.setImmediate;c.setImmediate=function(e){Date.now()-i>15?(i=Date.now(),a(e)):(r.push(e),1===r.length&&o.setAttribute("a",s=!s))}}c.nextTick=c.setImmediate}(),c.isNodejs=void 0!==t&&t.versions&&t.versions.node,c.globalScope=c.isNodejs?i:"undefined"==typeof self?window:self,c.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},c.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},c.isArrayBufferView=function(e){return e&&c.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},c.ByteBuffer=f,c.ByteStringBuffer=f;c.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},c.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},c.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},c.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},c.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},c.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},c.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(c.encodeUtf8(e))},c.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},c.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},c.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))},c.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},c.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},c.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))},c.ByteStringBuffer.prototype.putInt=function(e,t){u(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},c.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},c.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},c.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},c.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},c.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},c.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},c.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},c.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},c.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},c.ByteStringBuffer.prototype.getInt=function(e){u(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},c.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},c.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},c.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},c.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},c.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},c.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},c.ByteStringBuffer.prototype.copy=function(){var e=c.createBuffer(this.data);return e.read=this.read,e},c.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},c.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},c.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},c.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},c.ByteStringBuffer.prototype.toString=function(){return c.decodeUtf8(this.bytes())},c.DataBuffer=function(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=c.isArrayBuffer(e),n=c.isArrayBufferView(e);if(r||n)return this.data=r?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)},c.DataBuffer.prototype.length=function(){return this.write-this.read},c.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},c.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},c.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},c.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},c.DataBuffer.prototype.putBytes=function(e,t){if(c.isArrayBufferView(e)){var r=(n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-n.byteOffset;return this.accommodate(r),new Uint8Array(this.data.buffer,this.write).set(n),this.write+=r,this}if(c.isArrayBuffer(e)){var n=new Uint8Array(e);return this.accommodate(n.byteLength),new Uint8Array(this.data.buffer).set(n,this.write),this.write+=n.byteLength,this}if(e instanceof c.DataBuffer||"object"==typeof e&&"number"==typeof e.read&&"number"==typeof e.write&&c.isArrayBufferView(e.data)){n=new Uint8Array(e.data.byteLength,e.read,e.length());return this.accommodate(n.byteLength),new Uint8Array(e.data.byteLength,this.write).set(n),this.write+=n.byteLength,this}if(e instanceof c.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"==typeof e){var i;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),i=new Uint8Array(this.data.buffer,this.write),this.write+=c.binary.hex.decode(e,i,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),i=new Uint8Array(this.data.buffer,this.write),this.write+=c.binary.base64.decode(e,i,this.write),this;if("utf8"===t&&(e=c.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),i=new Uint8Array(this.data.buffer,this.write),this.write+=c.binary.raw.decode(i),this;if("utf16"===t)return this.accommodate(2*e.length),i=new Uint16Array(this.data.buffer,this.write),this.write+=c.text.utf16.encode(i),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},c.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},c.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},c.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},c.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},c.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},c.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},c.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},c.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},c.DataBuffer.prototype.putInt=function(e,t){u(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},c.DataBuffer.prototype.putSignedInt=function(e,t){return u(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},c.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},c.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},c.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},c.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},c.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},c.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},c.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},c.DataBuffer.prototype.getInt=function(e){u(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},c.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},c.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},c.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},c.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},c.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},c.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},c.DataBuffer.prototype.copy=function(){return new c.DataBuffer(this)},c.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},c.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},c.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},c.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},c.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return c.binary.raw.encode(t);if("hex"===e)return c.binary.hex.encode(t);if("base64"===e)return c.binary.base64.encode(t);if("utf8"===e)return c.text.utf8.decode(t);if("utf16"===e)return c.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},c.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=c.encodeUtf8(e)),new c.ByteBuffer(e)},c.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},c.xorBytes=function(e,t,r){for(var n="",i="",s="",o=0,a=0;r>0;--r,++o)i=e.charCodeAt(o)^t.charCodeAt(o),a>=10&&(n+=s,s="",a=0),s+=String.fromCharCode(i),++a;return n+=s},c.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},c.bytesToHex=function(e){return c.createBuffer(e).toHex()},c.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],d="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";c.encode64=function(e,t){for(var r,n,i,s="",o="",a=0;a<e.length;)r=e.charCodeAt(a++),n=e.charCodeAt(a++),i=e.charCodeAt(a++),s+=h.charAt(r>>2),s+=h.charAt((3&r)<<4|n>>4),isNaN(n)?s+="==":(s+=h.charAt((15&n)<<2|i>>6),s+=isNaN(i)?"=":h.charAt(63&i)),t&&s.length>t&&(o+=s.substr(0,t)+"\r\n",s=s.substr(t));return o+=s},c.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,s="",o=0;o<e.length;)t=l[e.charCodeAt(o++)-43],r=l[e.charCodeAt(o++)-43],n=l[e.charCodeAt(o++)-43],i=l[e.charCodeAt(o++)-43],s+=String.fromCharCode(t<<2|r>>4),64!==n&&(s+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(s+=String.fromCharCode((3&n)<<6|i)));return s},c.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},c.decodeUtf8=function(e){return decodeURIComponent(escape(e))},c.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:a.encode,decode:a.decode}},c.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},c.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,s=0;s<e.length;++s)n[i++]=e.charCodeAt(s);return t?i-r:n},c.binary.hex.encode=c.bytesToHex,c.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2)));var i=0,s=r=r||0;for(1&e.length&&(i=1,n[s++]=parseInt(e[0],16));i<e.length;i+=2)n[s++]=parseInt(e.substr(i,2),16);return t?s-r:n},c.binary.base64.encode=function(e,t){for(var r,n,i,s="",o="",a=0;a<e.byteLength;)r=e[a++],n=e[a++],i=e[a++],s+=h.charAt(r>>2),s+=h.charAt((3&r)<<4|n>>4),isNaN(n)?s+="==":(s+=h.charAt((15&n)<<2|i>>6),s+=isNaN(i)?"=":h.charAt(63&i)),t&&s.length>t&&(o+=s.substr(0,t)+"\r\n",s=s.substr(t));return o+=s},c.binary.base64.decode=function(e,t,r){var n,i,s,o,a=t;a||(a=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c=0,u=r=r||0;c<e.length;)n=l[e.charCodeAt(c++)-43],i=l[e.charCodeAt(c++)-43],s=l[e.charCodeAt(c++)-43],o=l[e.charCodeAt(c++)-43],a[u++]=n<<2|i>>4,64!==s&&(a[u++]=(15&i)<<4|s>>2,64!==o&&(a[u++]=(3&s)<<6|o));return t?u-r:a.subarray(0,u)},c.binary.base58.encode=function(e,t){return c.binary.baseN.encode(e,d,t)},c.binary.base58.decode=function(e,t){return c.binary.baseN.decode(e,d,t)},c.text={utf8:{},utf16:{}},c.text.utf8.encode=function(e,t,r){e=c.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,s=0;s<e.length;++s)n[i++]=e.charCodeAt(s);return t?i-r:n},c.text.utf8.decode=function(e){return c.decodeUtf8(String.fromCharCode.apply(null,e))},c.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(2*e.length));for(var i=new Uint16Array(n.buffer),s=r=r||0,o=r,a=0;a<e.length;++a)i[o++]=e.charCodeAt(a),s+=2;return t?s-r:n},c.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},c.deflate=function(e,t,r){if(t=c.decode64(e.deflate(c.encode64(t)).rval),r){var n=2;32&t.charCodeAt(1)&&(n=6),t=t.substring(n,t.length-4)}return t},c.inflate=function(e,t,r){var n=e.inflate(c.encode64(t)).rval;return null===n?null:c.decode64(n)};var p=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var n;if(null===r?n=e.removeItem(t):(r=c.encode64(JSON.stringify(r)),n=e.setItem(t,r)),void 0!==n&&!0!==n.rval){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}},b=function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(null===r.rval){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(c.decode64(r))),r},y=function(e,t,r,n){var i=b(e,t);null===i&&(i={}),i[r]=n,p(e,t,i)},m=function(e,t,r){var n=b(e,t);return null!==n&&(n=r in n?n[r]:null),n},g=function(e,t,r){var n=b(e,t);if(null!==n&&r in n){delete n[r];var i=!0;for(var s in n){i=!1;break}i&&(n=null),p(e,t,n)}},v=function(e,t){p(e,t,null)},w=function(e,t,r){var n,i=null;void 0===r&&(r=["web","flash"]);var s=!1,o=null;for(var a in r){n=r[a];try{if("flash"===n||"both"===n){if(null===t[0])throw new Error("Flash local storage not available.");i=e.apply(this,t),s="flash"===n}"web"!==n&&"both"!==n||(t[0]=localStorage,i=e.apply(this,t),s=!0)}catch(c){o=c}if(s)break}if(!s)throw o;return i};c.setItem=function(e,t,r,n,i){w(y,arguments,i)},c.getItem=function(e,t,r,n){return w(m,arguments,n)},c.removeItem=function(e,t,r,n){w(g,arguments,n)},c.clearItems=function(e,t,r){w(v,arguments,r)},c.parseUrl=function(e){var t=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;t.lastIndex=0;var r=t.exec(e),n=null===r?null:{full:e,scheme:r[1],host:r[2],port:r[3],path:r[4]};return n&&(n.fullHost=n.host,n.port?(80!==n.port&&"http"===n.scheme||443!==n.port&&"https"===n.scheme)&&(n.fullHost+=":"+n.port):"http"===n.scheme?n.port=80:"https"===n.scheme&&(n.port=443),n.full=n.scheme+"://"+n.fullHost),n};var _=null;c.getQueryVariables=function(e){var t,r=function(e){for(var t={},r=e.split("&"),n=0;n<r.length;n++){var i,s,o=r[n].indexOf("=");o>0?(i=r[n].substring(0,o),s=r[n].substring(o+1)):(i=r[n],s=null),i in t||(t[i]=[]),i in Object.prototype||null===s||t[i].push(unescape(s))}return t};return void 0===e?(null===_&&(_="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=_):t=r(e),t},c.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var i=t.split("/");return i.length>0&&""===i[0]&&i.shift(),{pathString:t,queryString:r,path:i,query:""===r?{}:c.getQueryVariables(r)}},c.makeRequest=function(e){var t=c.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var n;return void 0===e?n=t.query:(n=t.query[e])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(e,t){var n=r.getQuery(e);return n?n[n.length-1]:t}};return r},c.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},c.setPath=function(e,t,r){if("object"==typeof e&&null!==e)for(var n=0,i=t.length;n<i;){var s=t[n++];if(n==i)e[s]=r;else{var o=s in e;(!o||o&&"object"!=typeof e[s]||o&&null===e[s])&&(e[s]={}),e=e[s]}}},c.getPath=function(e,t,r){for(var n=0,i=t.length,s=!0;s&&n<i&&"object"==typeof e&&null!==e;){var o=t[n++];(s=o in e)&&(e=e[o])}return s?e:r},c.deletePath=function(e,t){if("object"==typeof e&&null!==e)for(var r=0,n=t.length;r<n;){var i=t[r++];if(r==n)delete e[i];else{if(!(i in e)||"object"!=typeof e[i]||null===e[i])break;e=e[i]}}},c.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},c.format=function(e){for(var t,r,n=/%./g,i=0,s=[],o=0;t=n.exec(e);){(r=e.substring(o,n.lastIndex-2)).length>0&&s.push(r),o=n.lastIndex;var a=t[0][1];switch(a){case"s":case"o":i<arguments.length?s.push(arguments[1+i++]):s.push("<?>");break;case"%":s.push("%");break;default:s.push("<%"+a+"?>")}}return s.push(e.substring(o)),s.join("")},c.formatNumber=function(e,t,r,n){var i=e,s=isNaN(t=Math.abs(t))?2:t,o=void 0===r?",":r,a=void 0===n?".":n,c=i<0?"-":"",u=parseInt(i=Math.abs(+i||0).toFixed(s),10)+"",f=u.length>3?u.length%3:0;return c+(f?u.substr(0,f)+a:"")+u.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+a)+(s?o+Math.abs(i-u).toFixed(s).slice(2):"")},c.formatSize=function(e){return e=e>=1073741824?c.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?c.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?c.formatNumber(e/1024,0)+" KiB":c.formatNumber(e,0)+" bytes"},c.bytesFromIP=function(e){return-1!==e.indexOf(".")?c.bytesFromIPv4(e):-1!==e.indexOf(":")?c.bytesFromIPv6(e):null},c.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=c.createBuffer(),r=0;r<e.length;++r){var n=parseInt(e[r],10);if(isNaN(n))return null;t.putByte(n)}return t.getBytes()},c.bytesFromIPv6=function(e){for(var t=0,r=2*(8-(e=e.split(":").filter((function(e){return 0===e.length&&++t,!0}))).length+t),n=c.createBuffer(),i=0;i<8;++i)if(e[i]&&0!==e[i].length){var s=c.hexToBytes(e[i]);s.length<2&&n.putByte(0),n.putBytes(s)}else n.fillWithByte(0,r),r=0;return n.getBytes()},c.bytesToIP=function(e){return 4===e.length?c.bytesToIPv4(e):16===e.length?c.bytesToIPv6(e):null},c.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},c.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],r=[],n=0,i=0;i<e.length;i+=2){for(var s=c.bytesToHex(e[i]+e[i+1]);"0"===s[0]&&"0"!==s;)s=s.substr(1);if("0"===s){var o=r[r.length-1],a=t.length;o&&a===o.end+1?(o.end=a,o.end-o.start>r[n].end-r[n].start&&(n=r.length-1)):r.push({start:a,end:a})}t.push(s)}if(r.length>0){var u=r[n];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(":")},c.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in c&&!e.update)return t(null,c.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return c.cores=navigator.hardwareConcurrency,t(null,c.cores);if("undefined"==typeof Worker)return c.cores=1,t(null,c.cores);if("undefined"==typeof Blob)return c.cores=2,t(null,c.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),r=t+4;Date.now()<r;);self.postMessage({st:t,et:r})}))}.toString(),")()"],{type:"application/javascript"}));!function e(n,i,s){if(0===i){var o=Math.floor(n.reduce((function(e,t){return e+t}),0)/n.length);return c.cores=Math.max(1,o),URL.revokeObjectURL(r),t(null,c.cores)}!function(e,t){for(var n=[],i=[],s=0;s<e;++s){var o=new Worker(r);o.addEventListener("message",(function(r){if(i.push(r.data),i.length===e){for(var s=0;s<e;++s)n[s].terminate();t(null,i)}})),n.push(o)}for(s=0;s<e;++s)n[s].postMessage(s)}(s,(function(t,r){n.push(function(e,t){for(var r=[],n=0;n<e;++n)for(var i=t[n],s=r[n]=[],o=0;o<e;++o)if(n!==o){var a=t[o];(i.st>a.st&&i.st<a.et||a.st>i.st&&a.st<i.et)&&s.push(o)}return r.reduce((function(e,t){return Math.max(e,t.length)}),0)}(s,r)),e(n,i-1,s)}))}([],5,16)}}).call(this,r(8),r(89).setImmediate,r(10),r(0).Buffer)},function(e,t,r){"use strict";var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(i){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(14),s=r(380),o=r(381),a=r(200);(t=e.exports).addPrefix=(e,t)=>{let r;if(n.isBuffer(e))r=a.varintBufferEncode(e);else{if(!o[e])throw new Error("multicodec not recognized");r=o[e]}return n.concat([r,t])},t.rmPrefix=e=>(i.decode(e),e.slice(i.decode.bytes)),t.getCodec=e=>{const t=i.decode(e),r=s.get(t);if(void 0===r)throw new Error("Code ".concat(t," not found"));return r},t.getName=e=>s.get(e),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 c=r(382);Object.assign(t,c),t.print=r(383)},function(e,t,r){"use strict";t.DAGNode=r(485),t.DAGLink=r(230),t.resolver=r(495),t.util=r(231),t.codec=t.util.codec,t.defaultHashAlg=t.util.defaultHashAlg},function(e,t,r){"use strict";var n,i="object"==typeof Reflect?Reflect:null,s=i&&"function"==typeof i.apply?i.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(r,n){function i(){void 0!==s&&e.removeListener("error",s),r([].slice.call(arguments))}var s;"error"!==t&&(s=function(r){e.removeListener(t,i),n(r)},e.once("error",s)),e.once(t,i)}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var c=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function f(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function h(e,t,r,n){var i,s,o,a;if(u(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(i=f(e))>0&&o.length>i&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,a=c,console&&console.warn&&console.warn(a)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=l.bind(n);return i.listener=r,n.wrapFn=i,i}function p(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):y(i,i.length)}function b(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function y(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");c=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return f(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)s(c,this,t);else{var u=c.length,f=y(c,u);for(r=0;r<u;++r)s(f[r],this,t)}return!0},a.prototype.addListener=function(e,t){return h(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return h(this,e,t,!0)},a.prototype.once=function(e,t){return u(t),this.on(e,d(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return u(t),this.prependListener(e,d(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,n,i,s,o;if(u(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,i=s;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,o||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,s=Object.keys(r);for(n=0;n<s.length;++n)"removeListener"!==(i=s[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):b.call(e,t)},a.prototype.listenerCount=b,a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(e,t,r){"use strict";e.exports={encode:r(376),decode:r(377),encodingLength:r(378)}},function(e,t,r){"use strict";const n=r(458),{Buffer:i}=r(0),s=r(127),o=r(14),a=r(221),c=r(4),u=r(21),f=Symbol.for("nodejs.util.inspect.custom"),h=u.proto((function(e){if(!(this instanceof h))return new h(e);if(null==e&&(e=""),e instanceof i)this.buffer=n.fromBuffer(e);else if("string"==typeof e||e instanceof String){if(e.length>0&&"/"!==e.charAt(0))throw new Error('multiaddr "'.concat(e,'" must start with a "/"'));this.buffer=n.fromString(e)}else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=n.fromBuffer(e.buffer)}}),{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});h.prototype.toString=function(){return n.bufferToString(this.buffer)},h.prototype.toJSON=h.prototype.toString,h.prototype.toOptions=function(){const e={},t=this.toString().split("/");return e.family="ip4"===t[1]?"ipv4":"ipv6",e.host=t[2],e.transport=t[3],e.port=parseInt(t[4]),e},h.prototype[f]=function(){return"<Multiaddr "+this.buffer.toString("hex")+" - "+n.bufferToString(this.buffer)+">"},h.prototype.inspect=function(){return"<Multiaddr "+this.buffer.toString("hex")+" - "+n.bufferToString(this.buffer)+">"},h.prototype.protos=function(){return this.protoCodes().map(e=>Object.assign({},s(e)))},h.prototype.protoCodes=function(){const e=[],t=this.buffer;let r=0;for(;r<t.length;){const i=o.decode(t,r),a=o.decode.bytes,c=s(i);r+=n.sizeForAddr(c,t.slice(r+a))+a,e.push(i)}return e},h.prototype.protoNames=function(){return this.protos().map(e=>e.name)},h.prototype.tuples=function(){return n.bufferToTuples(this.buffer)},h.prototype.stringTuples=function(){const e=n.bufferToTuples(this.buffer);return n.tuplesToStringTuples(e)},h.prototype.encapsulate=function(e){return e=h(e),h(this.toString()+e.toString())},h.prototype.decapsulate=function(e){e=e.toString();const t=this.toString(),r=t.lastIndexOf(e);if(r<0)throw new Error("Address "+this+" does not contain subaddress: "+e);return h(t.slice(0,r))},h.prototype.decapsulateCode=function(e){const t=this.tuples();for(let r=t.length-1;r>=0;r--)if(t[r][0]===e)return h(n.tuplesToBuffer(t.slice(0,r)));return this},h.prototype.getPeerId=function(){let e=null;try{e=this.stringTuples().filter(e=>{if(e[0]===s.names.ipfs.code)return!0}).pop()[1],e=a.encode("base58btc",new c(e).multihash).toString().slice(1)}catch(t){e=null}return e},h.prototype.getPath=function(){let e=null;try{e=this.stringTuples().filter(e=>{if(s(e[0]).path)return!0})[0][1]}catch(t){e=null}return e},h.prototype.equals=function(e){return this.buffer.equals(e.buffer)},h.prototype.nodeAddress=function(){const e=this.protoCodes(),t=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!==e[0]&&41!==e[0]&&54!==e[0]&&55!==e[0])throw new Error("no protocol with name: \"'".concat(t[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: \"'".concat(t[1],'\'". Must have a valid transport protocol: "{tcp, udp}".'));return{family:41===e[0]||55===e[0]?6:4,address:r[1],port:parseInt(r[3])}},h.fromNodeAddress=function(e,t){if(!e)throw new Error("requires node address object");if(!t)throw new Error("requires transport protocol");let r;switch(e.family){case"IPv4":r="ip4";break;case"IPv6":r="ip6";break;default:throw Error("Invalid addr family. Got '".concat(e.family,"' instead of 'IPv4' or 'IPv6'"))}return h("/"+[r,e.address,t,e.port].join("/"))},h.prototype.isThinWaistAddress=function(e){const t=(e||this).protos();return 2===t.length&&((4===t[0].code||41===t[0].code)&&(6===t[1].code||273===t[1].code))},h.protocols=s,h.isName=function(e){return!!h.isMultiaddr(e)&&e.protos().some(e=>e.resolvable)},h.resolve=function(e){return h.isMultiaddr(e)&&h.isName(e)?Promise.reject(new Error("not implemented yet")):Promise.reject(Error("not a valid name"))},e.exports=h},function(e,t,r){"use strict";var n=r(385);const{Buffer:i}=r(0);var s=r(389);e.exports=function(e,t){if(t||(t={}),!e)throw new Error("Pass in a .proto string or a protobuf-schema parsed object");var r="object"!=typeof e||i.isBuffer(e)?n.parse(e):e,o=function(){var e=this;s(r,t.encodings||{}).forEach((function(t){e[t.name]=function(e){if(!e)return null;var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].value})),t}(t.values)||t}))};return o.prototype.toString=function(){return n.stringify(r)},o.prototype.toJSON=function(){return r},new o}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(27),s=r(14),{names:o}=r(379),a={};for(const u in o)a[o[u]]=u;function c(e){t.decode(e)}t.names=o,t.codes=Object.freeze(a),t.toHexString=function(e){if(!n.isBuffer(e))throw new Error("must be passed a buffer");return e.toString("hex")},t.fromHexString=function(e){return n.from(e,"hex")},t.toB58String=function(e){if(!n.isBuffer(e))throw new Error("must be passed a buffer");return i.encode("base58btc",e).toString().slice(1)},t.fromB58String=function(e){let t=e;return n.isBuffer(e)&&(t=e.toString()),i.decode("z"+t)},t.decode=function(e){if(!n.isBuffer(e))throw new Error("multihash must be a Buffer");if(e.length<2)throw new Error("multihash too short. must be > 2 bytes.");const r=s.decode(e);if(!t.isValidCode(r))throw new Error("multihash unknown function code: 0x".concat(r.toString(16)));e=e.slice(s.decode.bytes);const i=s.decode(e);if(i<0)throw new Error("multihash invalid length: ".concat(i));if((e=e.slice(s.decode.bytes)).length!==i)throw new Error("multihash length inconsistent: 0x".concat(e.toString("hex")));return{code:r,name:a[r],length:i,digest:e}},t.encode=function(e,r,i){if(!e||void 0===r)throw new Error("multihash encode requires at least two args: digest, code");const o=t.coerceCode(r);if(!n.isBuffer(e))throw new Error("digest should be a Buffer");if(null==i&&(i=e.length),i&&e.length!==i)throw new Error("digest length should be equal to specified length.");return n.concat([n.from(s.encode(o)),n.from(s.encode(i)),e])},t.coerceCode=function(e){let r=e;if("string"==typeof e){if(void 0===o[e])throw new Error("Unrecognized hash function named: ".concat(e));r=o[e]}if("number"!=typeof r)throw new Error("Hash function code should be a number. Got: ".concat(r));if(void 0===a[r]&&!t.isAppCode(r))throw new Error("Unrecognized function code: ".concat(r));return r},t.isAppCode=function(e){return e>0&&e<16},t.isValidCode=function(e){return!!t.isAppCode(e)||!!a[e]},t.validate=c,t.prefix=function(e){return c(e),e.slice(0,2)}},function(e,t,r){"use strict";const n=r(2),i=r(193),s=i.multihash,{Key:o}=r(7),a=r(958),c=r(194),u=r(106),{Record:f}=r(68),h=r(6),l=r(1),{Buffer:d}=r(0);t.convertBuffer=e=>i.digest(e,"sha2-256"),t.convertPeerId=e=>i.digest(e.id,"sha2-256"),t.bufferToKey=e=>new o("/"+t.encodeBase32(e),!1),t.keyForPublicKey=e=>d.concat([d.from("/pk/"),e.id]),t.isPublicKeyKey=e=>"/pk/"===e.slice(0,4).toString(),t.fromPublicKeyKey=e=>new h(e.slice(4)),t.now=()=>Date.now(),t.encodeBase32=e=>(new a.Encoder).write(e).finalize(),t.decodeBase32=e=>{const t=new a.Decoder;return d.from(t.write(e).finalize())},t.sortClosestPeers=async(e,r)=>(await u(e,async e=>{const n=await t.convertPeerId(e);return{peer:e,distance:c(n,r)}})).sort(t.xorCompare).map(e=>e.peer),t.xorCompare=(e,t)=>c.compare(e.distance,t.distance),t.pathSize=(e,t)=>Math.ceil(e/t),t.createPutRecord=(e,t)=>{const r=new Date;return new f(e,t,r).serialize()},t.logger=(e,t)=>{const r=["libp2p","dht"];t&&r.push(t),e&&r.push("".concat(e.toB58String().slice(0,8))),n.formatters.b=e=>s.toB58String(e);const i=n(r.join(":"));return i.error=n(r.concat(["error"]).join(":")),i},t.TimeoutError=class extends Error{get code(){return"ETIMEDOUT"}},t.withTimeout=(e,t)=>async(...r)=>Promise.race([e(...r),new Promise((e,r)=>{setTimeout(()=>{r(l(new Error("Async function did not complete before timeout"),"ETIMEDOUT"))},t)})]),t.mapParallel=async function(e,t){const r=[];for await(const n of e)r.push(t(n));return Promise.all(r)}},function(e,t,r){"use strict";const n=(...e)=>{let t;for(;e.length;)t=e.shift()(t);return t},i=e=>e&&("function"==typeof e[Symbol.asyncIterator]||"function"==typeof e[Symbol.iterator]||"function"==typeof e.next),s=e=>e&&"function"==typeof e.sink&&i(e.source),o=e=>t=>(e.sink(t),e.source),a=(...e)=>{if(s(e[0])){const t=e[0];e[0]=()=>t.source}else if(i(e[0])){const t=e[0];e[0]=()=>t}if(e.length>1&&s(e[e.length-1])&&(e[e.length-1]=e[e.length-1].sink),e.length>2)for(let t=1;t<e.length-1;t++)s(e[t])&&(e[t]=o(e[t]));return n(...e)};e.exports=a,e.exports.pipe=a,e.exports.rawPipe=n,e.exports.isIterable=i,e.exports.isDuplex=s},function(e,t,r){"use strict";t.messages={NOT_STARTED_YET:"The libp2p node is not started yet",DHT_DISABLED:"DHT is not available"},t.codes={DHT_DISABLED:"ERR_DHT_DISABLED",PUBSUB_NOT_STARTED:"ERR_PUBSUB_NOT_STARTED",DHT_NOT_STARTED:"ERR_DHT_NOT_STARTED",ERR_CONNECTION_ENDED:"ERR_CONNECTION_ENDED",ERR_CONNECTION_FAILED:"ERR_CONNECTION_FAILED",ERR_NODE_NOT_STARTED:"ERR_NODE_NOT_STARTED",ERR_ALREADY_ABORTED:"ERR_ALREADY_ABORTED",ERR_NO_VALID_ADDRESSES:"ERR_NO_VALID_ADDRESSES",ERR_DISCOVERED_SELF:"ERR_DISCOVERED_SELF",ERR_DUPLICATE_TRANSPORT:"ERR_DUPLICATE_TRANSPORT",ERR_ENCRYPTION_FAILED:"ERR_ENCRYPTION_FAILED",ERR_HOP_REQUEST_FAILED:"ERR_HOP_REQUEST_FAILED",ERR_INVALID_KEY:"ERR_INVALID_KEY",ERR_INVALID_MESSAGE:"ERR_INVALID_MESSAGE",ERR_INVALID_PARAMETERS:"ERR_INVALID_PARAMETERS",ERR_INVALID_PEER:"ERR_INVALID_PEER",ERR_MUXER_UNAVAILABLE:"ERR_MUXER_UNAVAILABLE",ERR_TIMEOUT:"ERR_TIMEOUT",ERR_TRANSPORT_UNAVAILABLE:"ERR_TRANSPORT_UNAVAILABLE",ERR_TRANSPORT_DIAL_FAILED:"ERR_TRANSPORT_DIAL_FAILED",ERR_UNSUPPORTED_PROTOCOL:"ERR_UNSUPPORTED_PROTOCOL",ERR_INVALID_MULTIADDR:"ERR_INVALID_MULTIADDR"}},function(e,t,r){"use strict";e.exports=function(e,{className:t,symbolName:r}){const n=Symbol.for(r),i={[t]:class extends e{constructor(...e){super(...e),Object.defineProperty(this,n,{value:!0})}get[Symbol.toStringTag](){return t}}}[t];return i["is".concat(t)]=e=>!(!e||!e[n]),i},e.exports.proto=function(e,{className:t,symbolName:r,withoutNew:n}){const i=Symbol.for(r),s={[t]:function(...t){if(n&&!(this instanceof s))return new s(...t);const r=e.call(this,...t)||this;return r&&!r[i]&&Object.defineProperty(r,i,{value:!0}),r}}[t];return s.prototype=Object.create(e.prototype),s.prototype.constructor=s,Object.defineProperty(s.prototype,Symbol.toStringTag,{get:()=>t}),s["is".concat(t)]=e=>!(!e||!e[i]),s}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(1),s=r(17),o=r(468);async function a(e,t,r){const n=await a.digest(e,t,r);return s.encode(n,t,r)}a.Buffer=n,a.multihash=s,a.digest=async(e,t,r)=>{const n=a.createHash(t),i=await n(e);return r?i.slice(0,r):i},a.createHash=function(e){if(!e)throw i(new Error("hash algorithm must be specified"),"ERR_HASH_ALGORITHM_NOT_SPECIFIED");if(e=s.coerceCode(e),!a.functions[e])throw i(new Error("multihash function '".concat(e,"' not yet supported")),"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return a.functions[e]},a.functions={0:o.identity,17:o.sha1,18:o.sha2256,19:o.sha2512,20:o.sha3512,21:o.sha3384,22:o.sha3256,23:o.sha3224,24:o.shake128,25:o.shake256,26:o.keccak224,27:o.keccak256,28:o.keccak384,29:o.keccak512,34:o.murmur3128,35:o.murmur332,86:o.dblSha2256},o.addBlake(a.functions),a.validate=async(e,t)=>{const r=await a(e,s.decode(t).name);return 0===n.compare(t,r)},e.exports=a},function(e,t,r){"use strict";const n=r(16)(r(480)).Data,i=r(1),s=["raw","directory","file","metadata","symlink","hamt-sharded-directory"],o=["directory","hamt-sharded-directory"],a=parseInt("0644",8),c=parseInt("0755",8);function u(e){if(null!=e){if(Object.prototype.hasOwnProperty.call(e,"secs")&&(e={secs:e.secs,nsecs:e.nsecs}),Object.prototype.hasOwnProperty.call(e,"Seconds")&&(e={secs:e.Seconds,nsecs:e.FractionalNanoseconds}),Array.isArray(e)&&(e={secs:e[0],nsecs:e[1]}),e instanceof Date){const t=e.getTime(),r=Math.floor(t/1e3);e={secs:r,nsecs:1e3*(t-1e3*r)}}if(Object.prototype.hasOwnProperty.call(e,"secs")){if(e.nsecs<0||e.nsecs>999999999)throw i(new Error("mtime-nsecs must be within the range [0,999999999]"),"ERR_INVALID_MTIME_NSECS");return e}}}function f(e){if(null!=e)return("string"==typeof e||e instanceof String)&&(e=parseInt(e,8)),4095&e}class h{static unmarshal(e){const t=n.decode(e),r=new h({type:s[t.Type],data:t.hasData()?t.Data:void 0,blockSizes:t.blocksizes,mode:t.hasMode()?t.mode:void 0,mtime:t.hasMtime()?t.mtime:void 0});return r._originalMode=t.hasMode()?t.mode:void 0,r}constructor(...e){const{type:t,data:r,blockSizes:n,hashType:o,fanout:h,mtime:l,mode:d}=function(e){return 0===e.length?{type:"file"}:2===e.length?{type:e[0],data:e[1]}:"string"==typeof e[0]||e[0]instanceof String?{type:e[0]}:e[0]}(e);if(!s.includes(t))throw i(new Error("Type: "+t+" is not valid"),"ERR_INVALID_TYPE");this.type=t,this.data=r,this.hashType=o,this.fanout=h,this.blockSizes=n||[];const p=f(d);void 0!==p&&(this.mode=p),void 0===this.mode&&"file"===t&&(this.mode=a),void 0===this.mode&&this.isDirectory()&&(this.mode=c);const b=u(l);b&&(this.mtime=b)}isDirectory(){return o.includes(this.type)}addBlockSize(e){this.blockSizes.push(e)}removeBlockSize(e){this.blockSizes.splice(e,1)}fileSize(){if(this.isDirectory())return;let e=0;return this.blockSizes.forEach(t=>{e+=t}),this.data&&(e+=this.data.length),e}marshal(){let e;switch(this.type){case"raw":e=n.DataType.Raw;break;case"directory":e=n.DataType.Directory;break;case"file":e=n.DataType.File;break;case"metadata":e=n.DataType.Metadata;break;case"symlink":e=n.DataType.Symlink;break;case"hamt-sharded-directory":e=n.DataType.HAMTShard;break;default:throw i(new Error("Type: "+e+" is not valid"),"ERR_INVALID_TYPE")}let t=this.data;this.data&&this.data.length||(t=void 0);let r,s,o=this.blockSizes;if(this.blockSizes&&this.blockSizes.length||(o=void 0),null!=this.mode&&(r=4294963200&this._originalMode|f(this.mode),r===a&&"file"===this.type&&(r=void 0),r===c&&this.isDirectory()&&(r=void 0)),null!=this.mtime){const e=u(this.mtime);e&&(s={Seconds:e.secs,FractionalNanoseconds:e.nsecs},0===s.FractionalNanoseconds&&delete s.FractionalNanoseconds)}return n.encode({Type:e,Data:t,filesize:this.fileSize(),blocksizes:o,hashType:this.hashType,fanout:this.fanout,mode:r,mtime:s})}}e.exports=h},function(e,t,r){"use strict";"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){"use strict";t.encode=r(744),t.decode=r(745),t.varintEncode=r(305),t.varintDecode=r(306),t.int32BEEncode=r(746),t.int32BEDecode=r(747)},function(e,t,r){"use strict";const n=r(363),{hasOwnProperty:i}=Object.prototype,{propertyIsEnumerable:s}=Object,o=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),a={concatArrays:!1,ignoreUndefined:!1},c=e=>{const t=[];for(const r in e)i.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){const r=Object.getOwnPropertySymbols(e);for(const n of r)s.call(e,n)&&t.push(n)}return t};function u(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return c(e).forEach(r=>{o(t,r,u(e[r]))}),t}(e):n(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return c(e).forEach(r=>{o(t,r,u(e[r]))}),t}(e):e}const f=(e,t,r,n)=>(r.forEach(r=>{void 0===t[r]&&n.ignoreUndefined||(r in e&&e[r]!==Object.getPrototypeOf(e)?o(e,r,h(e[r],t[r],n)):o(e,r,u(t[r])))}),e);function h(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?((e,t,r)=>{let n=e.slice(0,0),s=0;return[e,t].forEach(t=>{const a=[];for(let r=0;r<t.length;r++)i.call(t,r)&&(a.push(String(r)),o(n,s++,t===e?t[r]:u(t[r])));n=f(n,t,c(t).filter(e=>!a.includes(e)),r)}),n})(e,t,r):n(t)&&n(e)?f(e,t,c(t),r):u(t)}e.exports=function(...e){const t=h(u(a),void 0!==this&&this||{},a);let r={_:{}};for(const i of e)if(void 0!==i){if(!n(i))throw new TypeError("`"+i+"` is not an Option Object");r=h(r,{_:i},t)}return r._}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(373);function s(e){if(i.names[e])return i.names[e];if(i.codes[e])return i.codes[e];throw new Error("Unsupported encoding: ".concat(e))}(t=e.exports=function(e,t){if(!t)throw new Error("requires an encoded buffer");const r=s(e);return function(e,t){s(e).decode(t.toString())}(r.name,t),n.concat([r.codeBuf,t])}).encode=function(e,t){const r=s(e);return n.concat([r.codeBuf,n.from(r.encode(t))])},t.decode=function(e){n.isBuffer(e)&&(e=e.toString());const t=e[0];["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(t)&&(e=e.toLowerCase());const r=s(e[0]);return n.from(r.decode(e.substring(1)))},t.isEncoded=function(e){if(n.isBuffer(e)&&(e=e.toString()),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return s(e[0]).name}catch(t){return!1}},t.encoding=s,t.encodingFromData=function(e){return n.isBuffer(e)&&(e=e.toString()),s(e[0])},t.names=Object.freeze(i.names),t.codes=Object.freeze(i.codes)},function(e,t,r){"use strict";const n=r(219),i=r(447),s=r(201);t.aes=i,t.hmac=n,t.keys=s,t.randomBytes=r(122),t.pbkdf2=r(450)},function(e,t,r){"use strict";var n=t,i=r(33),s=r(48),o=r(213);n.assert=s,n.toArray=o.toArray,n.zero2=o.zero2,n.toHex=o.toHex,n.encode=o.encode,n.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<<t+1,s=e.clone(),o=0;o<n.length;o++){var a,c=s.andln(i-1);s.isOdd()?(a=c>(i>>1)-1?(i>>1)-c:c,s.isubn(a)):a=0,n[o]=a,s.iushrn(1)}return n},n.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n=0,i=0;e.cmpn(-n)>0||t.cmpn(-i)>0;){var s,o,a,c=e.andln(3)+n&3,u=t.andln(3)+i&3;if(3===c&&(c=-1),3===u&&(u=-1),0==(1&c))s=0;else s=3!==(a=e.andln(7)+n&7)&&5!==a||2!==u?c:-c;if(r[0].push(s),0==(1&u))o=0;else o=3!==(a=t.andln(7)+i&7)&&5!==a||2!==c?u:-u;r[1].push(o),2*n===s+1&&(n=1-n),2*i===o+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r},n.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new i(e,"hex","le")}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=Symbol.for("BufferList");function s(e){if(!(this instanceof s))return new s(e);s._init.call(this,e)}s._init=function(e){Object.defineProperty(this,i,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},s.prototype._new=function(e){return new s(e)},s.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let r=0;r<this._bufs.length;r++){const n=t+this._bufs[r].length;if(e<n||r===this._bufs.length-1)return[r,e-t];t=n}},s.prototype._reverseOffset=function(e){const t=e[0];let r=e[1];for(let n=0;n<t;n++)r+=this._bufs[n].length;return r},s.prototype.get=function(e){if(e>this.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},s.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},s.prototype.copy=function(e,t,r,i){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof i||i>this.length)&&(i=this.length),r>=this.length)return e||n.alloc(0);if(i<=0)return e||n.alloc(0);const s=!!e,o=this._offset(r),a=i-r;let c=a,u=s&&t||0,f=o[1];if(0===r&&i===this.length){if(!s)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(let t=0;t<this._bufs.length;t++)this._bufs[t].copy(e,u),u+=this._bufs[t].length;return e}if(c<=this._bufs[o[0]].length-f)return s?this._bufs[o[0]].copy(e,t,f,f+c):this._bufs[o[0]].slice(f,f+c);s||(e=n.allocUnsafe(a));for(let n=o[0];n<this._bufs.length;n++){const t=this._bufs[n].length-f;if(!(c>t)){this._bufs[n].copy(e,u,f,f+c);break}this._bufs[n].copy(e,u,f),u+=t,c-=t,f&&(f=0)}return e},s.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const r=this._offset(e),n=this._offset(t),i=this._bufs.slice(r[0],n[0]+1);return 0===n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!==r[1]&&(i[0]=i[0].slice(r[1])),this._new(i)},s.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},s.prototype.consume=function(e){for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){const e=this._new();for(let t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},s.prototype.append=function(e){if(null==e)return this;if(e.buffer)this._appendBuffer(n.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.append(e[t]);else if(this._isBufferList(e))for(let t=0;t<e._bufs.length;t++)this.append(e._bufs[t]);else"number"==typeof e&&(e=e.toString()),this._appendBuffer(n.from(e));return this},s.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},s.prototype.indexOf=function(e,t,r){if(void 0===r&&"string"==typeof t&&(r=t,t=void 0),"function"==typeof e||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof e?e=n.from([e]):"string"==typeof e?e=n.from(e,r):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=n.from(e.buffer,e.byteOffset,e.byteLength):n.isBuffer(e)||(e=n.from(e)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;const i=this._offset(t);let s=i[0],o=i[1];for(;s<this._bufs.length;s++){const t=this._bufs[s];for(;o<t.length;){if(t.length-o>=e.length){const r=t.indexOf(e,o);if(-1!==r)return this._reverseOffset([s,r]);o=t.length-e.length+1}else{const t=this._reverseOffset([s,o]);if(this._match(t,e))return t;o++}}o=0}return-1},s.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let r=0;r<t.length;r++)if(this.get(e+r)!==t[r])return!1;return!0},function(){const e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const t in e)!function(t){s.prototype[t]=null===e[t]?function(e,r){return this.slice(e,e+r)[t](0,r)}:function(r){return this.slice(r,r+e[t])[t](0)}}(t)}(),s.prototype._isBufferList=function(e){return e instanceof s||s.isBufferList(e)},s.isBufferList=function(e){return null!=e&&e[i]},e.exports=s},function(e,t,r){"use strict";var n=r(48),i=r(24);function s(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function o(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function a(e){return 1===e.length?"0"+e:e}function c(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i<e.length;i+=2)r.push(parseInt(e[i]+e[i+1],16))}else for(var n=0,i=0;i<e.length;i++){var o=e.charCodeAt(i);o<128?r[n++]=o:o<2048?(r[n++]=o>>6|192,r[n++]=63&o|128):s(e,i)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++i)),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=63&o|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=63&o|128)}else for(i=0;i<e.length;i++)r[i]=0|e[i];return r},t.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=a(e[r].toString(16));return t},t.htonl=o,t.toHex32=function(e,t){for(var r="",n=0;n<e.length;n++){var i=e[n];"little"===t&&(i=o(i)),r+=c(i.toString(16))}return r},t.zero2=a,t.zero8=c,t.join32=function(e,t,r,i){var s=r-t;n(s%4==0);for(var o=new Array(s/4),a=0,c=t;a<o.length;a++,c+=4){var u;u="big"===i?e[c]<<24|e[c+1]<<16|e[c+2]<<8|e[c+3]:e[c+3]<<24|e[c+2]<<16|e[c+1]<<8|e[c],o[a]=u>>>0}return o},t.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n<e.length;n++,i+=4){var s=e[n];"big"===t?(r[i]=s>>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=255&s):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=255&s)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},t.sum64=function(e,t,r,n){var i=e[t],s=n+e[t+1]>>>0,o=(s<n?1:0)+r+i;e[t]=o>>>0,e[t+1]=s},t.sum64_hi=function(e,t,r,n){return(t+n>>>0<t?1:0)+e+r>>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,i,s,o,a){var c=0,u=t;return c+=(u=u+n>>>0)<t?1:0,c+=(u=u+s>>>0)<s?1:0,e+r+i+o+(c+=(u=u+a>>>0)<a?1:0)>>>0},t.sum64_4_lo=function(e,t,r,n,i,s,o,a){return t+n+s+a>>>0},t.sum64_5_hi=function(e,t,r,n,i,s,o,a,c,u){var f=0,h=t;return f+=(h=h+n>>>0)<t?1:0,f+=(h=h+s>>>0)<s?1:0,f+=(h=h+a>>>0)<a?1:0,e+r+i+o+c+(f+=(h=h+u>>>0)<u?1:0)>>>0},t.sum64_5_lo=function(e,t,r,n,i,s,o,a,c,u){return t+n+s+a+u>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(1),s=r(4),o=r(549),a=r(50),c=e=>{if(n.isBuffer(e))return{cid:new s(e),toResolve:[]};if(s.isCID(e))return{cid:e,toResolve:[]};if("string"==typeof e){0===e.indexOf("/ipfs/")&&(e=e.substring(6));const t=((e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean))(e);return{cid:new s(t[0]),toResolve:t.slice(1)}}throw i(new Error("Unknown path type ".concat(e)),"ERR_BAD_PATH")},u=async function*(e,t,r){let{cid:n,toResolve:s}=c(e),a=n.toBaseEncodedString(),u=a;const f=s.length;for(;;){const c=await o(n,a,u,s,f,t,r);if(!c.entry&&!c.next)throw i(new Error("Could not resolve ".concat(e)),"ERR_NOT_FOUND");if(c.entry&&(yield c.entry),!c.next)return;s=c.next.toResolve,n=c.next.cid,a=c.next.name,u=c.next.path}},f=(e,t,r)=>a(u(e,t,r));e.exports=f,e.exports.path=u,e.exports.recursive=async function*(e,t,r){const n=await f(e,t,r);if(yield n,n.unixfs&&n.unixfs.type.includes("dir"))for await(const i of async function*e(t,r){for await(const n of t.content(r))if(yield n,n.unixfs.type.includes("dir"))for await(const t of e(n,r))yield t}(n,r))yield i}},function(e,t,r){"use strict";(function(e){!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function s(e,t,r){if(s.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof e?e.exports=s:(void 0).BN=s,s.BN=s,s.wordSize=26;try{o=r(422).Buffer}catch(S){}function a(e,t,r){for(var n=0,i=Math.min(e.length,r),s=t;s<i;s++){var o=e.charCodeAt(s)-48;n<<=4,n|=o>=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function c(e,t,r,n){for(var i=0,s=Math.min(e.length,r),o=t;o<s;o++){var a=e.charCodeAt(o)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}return i}s.isBN=function(e){return e instanceof s||null!==e&&"object"==typeof e&&e.constructor.wordSize===s.wordSize&&Array.isArray(e.words)},s.max=function(e,t){return e.cmp(t)>0?e:t},s.min=function(e,t){return e.cmp(t)<0?e:t},s.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),t,r)},s.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},s.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var s,o,a=0;if("be"===r)for(i=e.length-1,s=0;i>=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===r)for(i=0,s=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this.strip()},s.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var n,i,s=0;for(r=e.length-6,n=0;r>=t;r-=6)i=a(e,r,r+6),this.words[n]|=i<<s&67108863,this.words[n+1]|=i>>>26-s&4194303,(s+=24)>=26&&(s-=26,n++);r+6!==t&&(i=a(e,t,r+6),this.words[n]|=i<<s&67108863,this.words[n+1]|=i>>>26-s&4194303),this.strip()},s.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var s=e.length-r,o=s%n,a=Math.min(s,s-o)+r,u=0,f=r;f<a;f+=n)u=c(e,f,f+n,t),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==o){var h=1;for(u=c(e,f,e.length,t),f=0;f<o;f++)h*=t;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}},s.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},s.prototype.clone=function(){var e=new s(null);return this.copy(e),e},s.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},s.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};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"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function l(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],s=0|t.words[0],o=i*s,a=67108863&o,c=o/67108864|0;r.words[0]=a;for(var u=1;u<n;u++){for(var f=c>>>26,h=67108863&c,l=Math.min(u,t.length-1),d=Math.max(0,u-e.length+1);d<=l;d++){var p=u-d|0;f+=(o=(i=0|e.words[p])*(s=0|t.words[d])+h)/67108864|0,h=67108863&o}r.words[u]=0|h,c=0|f}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}s.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,s=0,o=0;o<this.length;o++){var a=this.words[o],c=(16777215&(a<<i|s)).toString(16);r=0!==(s=a>>>24-i&16777215)||o!==this.length-1?u[6-c.length]+c+r:c+r,(i+=2)>=26&&(i-=26,o--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=f[e],d=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var b=p.modn(d).toString(e);r=(p=p.idivn(d)).isZero()?b+r:u[l-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(e,t){return n(void 0!==o),this.toArrayLike(o,e,t)},s.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},s.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),s=r||Math.max(1,i);n(i<=s,"byte array longer than desired length"),n(s>0,"Requested array length <= 0"),this.strip();var o,a,c="le"===t,u=new e(s),f=this.clone();if(c){for(a=0;!f.isZero();a++)o=f.andln(255),f.iushrn(8),u[a]=o;for(;a<s;a++)u[a]=0}else{for(a=0;a<s-i;a++)u[a]=0;for(a=0;!f.isZero();a++)o=f.andln(255),f.iushrn(8),u[s-a-1]=o}return u},Math.clz32?s.prototype._countBits=function(e){return 32-Math.clz32(e)}:s.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},s.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},s.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},s.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return 0!==this.negative},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},s.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},s.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},s.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},s.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},s.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},s.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},s.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},s.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this.strip()},s.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},s.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},s.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},s.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},s.prototype.notn=function(e){return this.clone().inotn(e)},s.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},s.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var i=0,s=0;s<n.length;s++)t=(0|r.words[s])+(0|n.words[s])+i,this.words[s]=67108863&t,i=t>>>26;for(;0!==i&&s<r.length;s++)t=(0|r.words[s])+i,this.words[s]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},s.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},s.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var s=0,o=0;o<n.length;o++)s=(t=(0|r.words[o])-(0|n.words[o])+s)>>26,this.words[o]=67108863&t;for(;0!==s&&o<r.length;o++)s=(t=(0|r.words[o])+s)>>26,this.words[o]=67108863&t;if(0===s&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},s.prototype.sub=function(e){return this.clone().isub(e)};var d=function(e,t,r){var n,i,s,o=e.words,a=t.words,c=r.words,u=0,f=0|o[0],h=8191&f,l=f>>>13,d=0|o[1],p=8191&d,b=d>>>13,y=0|o[2],m=8191&y,g=y>>>13,v=0|o[3],w=8191&v,_=v>>>13,E=0|o[4],k=8191&E,S=E>>>13,A=0|o[5],I=8191&A,T=A>>>13,R=0|o[6],x=8191&R,C=R>>>13,B=0|o[7],M=8191&B,N=B>>>13,P=0|o[8],O=8191&P,D=P>>>13,L=0|o[9],j=8191&L,U=L>>>13,z=0|a[0],F=8191&z,q=z>>>13,K=0|a[1],V=8191&K,H=K>>>13,G=0|a[2],W=8191&G,Y=G>>>13,J=0|a[3],X=8191&J,Z=J>>>13,Q=0|a[4],$=8191&Q,ee=Q>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],se=8191&ie,oe=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,fe=0|a[8],he=8191&fe,le=fe>>>13,de=0|a[9],pe=8191&de,be=de>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(u+(n=Math.imul(h,F))|0)+((8191&(i=(i=Math.imul(h,q))+Math.imul(l,F)|0))<<13)|0;u=((s=Math.imul(l,q))+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(p,F),i=(i=Math.imul(p,q))+Math.imul(b,F)|0,s=Math.imul(b,q);var me=(u+(n=n+Math.imul(h,V)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(l,V)|0))<<13)|0;u=((s=s+Math.imul(l,H)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(m,F),i=(i=Math.imul(m,q))+Math.imul(g,F)|0,s=Math.imul(g,q),n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,H)|0;var ge=(u+(n=n+Math.imul(h,W)|0)|0)+((8191&(i=(i=i+Math.imul(h,Y)|0)+Math.imul(l,W)|0))<<13)|0;u=((s=s+Math.imul(l,Y)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(w,F),i=(i=Math.imul(w,q))+Math.imul(_,F)|0,s=Math.imul(_,q),n=n+Math.imul(m,V)|0,i=(i=i+Math.imul(m,H)|0)+Math.imul(g,V)|0,s=s+Math.imul(g,H)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(b,W)|0,s=s+Math.imul(b,Y)|0;var ve=(u+(n=n+Math.imul(h,X)|0)|0)+((8191&(i=(i=i+Math.imul(h,Z)|0)+Math.imul(l,X)|0))<<13)|0;u=((s=s+Math.imul(l,Z)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(k,F),i=(i=Math.imul(k,q))+Math.imul(S,F)|0,s=Math.imul(S,q),n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(_,V)|0,s=s+Math.imul(_,H)|0,n=n+Math.imul(m,W)|0,i=(i=i+Math.imul(m,Y)|0)+Math.imul(g,W)|0,s=s+Math.imul(g,Y)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(b,X)|0,s=s+Math.imul(b,Z)|0;var we=(u+(n=n+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(l,$)|0))<<13)|0;u=((s=s+Math.imul(l,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(I,F),i=(i=Math.imul(I,q))+Math.imul(T,F)|0,s=Math.imul(T,q),n=n+Math.imul(k,V)|0,i=(i=i+Math.imul(k,H)|0)+Math.imul(S,V)|0,s=s+Math.imul(S,H)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(_,W)|0,s=s+Math.imul(_,Y)|0,n=n+Math.imul(m,X)|0,i=(i=i+Math.imul(m,Z)|0)+Math.imul(g,X)|0,s=s+Math.imul(g,Z)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,ee)|0;var _e=(u+(n=n+Math.imul(h,re)|0)|0)+((8191&(i=(i=i+Math.imul(h,ne)|0)+Math.imul(l,re)|0))<<13)|0;u=((s=s+Math.imul(l,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(x,F),i=(i=Math.imul(x,q))+Math.imul(C,F)|0,s=Math.imul(C,q),n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(T,V)|0,s=s+Math.imul(T,H)|0,n=n+Math.imul(k,W)|0,i=(i=i+Math.imul(k,Y)|0)+Math.imul(S,W)|0,s=s+Math.imul(S,Y)|0,n=n+Math.imul(w,X)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(_,X)|0,s=s+Math.imul(_,Z)|0,n=n+Math.imul(m,$)|0,i=(i=i+Math.imul(m,ee)|0)+Math.imul(g,$)|0,s=s+Math.imul(g,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(b,re)|0,s=s+Math.imul(b,ne)|0;var Ee=(u+(n=n+Math.imul(h,se)|0)|0)+((8191&(i=(i=i+Math.imul(h,oe)|0)+Math.imul(l,se)|0))<<13)|0;u=((s=s+Math.imul(l,oe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(M,F),i=(i=Math.imul(M,q))+Math.imul(N,F)|0,s=Math.imul(N,q),n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(C,V)|0,s=s+Math.imul(C,H)|0,n=n+Math.imul(I,W)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(T,W)|0,s=s+Math.imul(T,Y)|0,n=n+Math.imul(k,X)|0,i=(i=i+Math.imul(k,Z)|0)+Math.imul(S,X)|0,s=s+Math.imul(S,Z)|0,n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,ee)|0,n=n+Math.imul(m,re)|0,i=(i=i+Math.imul(m,ne)|0)+Math.imul(g,re)|0,s=s+Math.imul(g,ne)|0,n=n+Math.imul(p,se)|0,i=(i=i+Math.imul(p,oe)|0)+Math.imul(b,se)|0,s=s+Math.imul(b,oe)|0;var ke=(u+(n=n+Math.imul(h,ce)|0)|0)+((8191&(i=(i=i+Math.imul(h,ue)|0)+Math.imul(l,ce)|0))<<13)|0;u=((s=s+Math.imul(l,ue)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(O,F),i=(i=Math.imul(O,q))+Math.imul(D,F)|0,s=Math.imul(D,q),n=n+Math.imul(M,V)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,H)|0,n=n+Math.imul(x,W)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(C,W)|0,s=s+Math.imul(C,Y)|0,n=n+Math.imul(I,X)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(T,X)|0,s=s+Math.imul(T,Z)|0,n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,ee)|0)+Math.imul(S,$)|0,s=s+Math.imul(S,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,s=s+Math.imul(_,ne)|0,n=n+Math.imul(m,se)|0,i=(i=i+Math.imul(m,oe)|0)+Math.imul(g,se)|0,s=s+Math.imul(g,oe)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(b,ce)|0,s=s+Math.imul(b,ue)|0;var Se=(u+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,le)|0)+Math.imul(l,he)|0))<<13)|0;u=((s=s+Math.imul(l,le)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(j,F),i=(i=Math.imul(j,q))+Math.imul(U,F)|0,s=Math.imul(U,q),n=n+Math.imul(O,V)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(D,V)|0,s=s+Math.imul(D,H)|0,n=n+Math.imul(M,W)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(N,W)|0,s=s+Math.imul(N,Y)|0,n=n+Math.imul(x,X)|0,i=(i=i+Math.imul(x,Z)|0)+Math.imul(C,X)|0,s=s+Math.imul(C,Z)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(T,$)|0,s=s+Math.imul(T,ee)|0,n=n+Math.imul(k,re)|0,i=(i=i+Math.imul(k,ne)|0)+Math.imul(S,re)|0,s=s+Math.imul(S,ne)|0,n=n+Math.imul(w,se)|0,i=(i=i+Math.imul(w,oe)|0)+Math.imul(_,se)|0,s=s+Math.imul(_,oe)|0,n=n+Math.imul(m,ce)|0,i=(i=i+Math.imul(m,ue)|0)+Math.imul(g,ce)|0,s=s+Math.imul(g,ue)|0,n=n+Math.imul(p,he)|0,i=(i=i+Math.imul(p,le)|0)+Math.imul(b,he)|0,s=s+Math.imul(b,le)|0;var Ae=(u+(n=n+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,be)|0)+Math.imul(l,pe)|0))<<13)|0;u=((s=s+Math.imul(l,be)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(j,V),i=(i=Math.imul(j,H))+Math.imul(U,V)|0,s=Math.imul(U,H),n=n+Math.imul(O,W)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(D,W)|0,s=s+Math.imul(D,Y)|0,n=n+Math.imul(M,X)|0,i=(i=i+Math.imul(M,Z)|0)+Math.imul(N,X)|0,s=s+Math.imul(N,Z)|0,n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(C,$)|0,s=s+Math.imul(C,ee)|0,n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(T,re)|0,s=s+Math.imul(T,ne)|0,n=n+Math.imul(k,se)|0,i=(i=i+Math.imul(k,oe)|0)+Math.imul(S,se)|0,s=s+Math.imul(S,oe)|0,n=n+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(_,ce)|0,s=s+Math.imul(_,ue)|0,n=n+Math.imul(m,he)|0,i=(i=i+Math.imul(m,le)|0)+Math.imul(g,he)|0,s=s+Math.imul(g,le)|0;var Ie=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,be)|0)+Math.imul(b,pe)|0))<<13)|0;u=((s=s+Math.imul(b,be)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(j,W),i=(i=Math.imul(j,Y))+Math.imul(U,W)|0,s=Math.imul(U,Y),n=n+Math.imul(O,X)|0,i=(i=i+Math.imul(O,Z)|0)+Math.imul(D,X)|0,s=s+Math.imul(D,Z)|0,n=n+Math.imul(M,$)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(C,re)|0,s=s+Math.imul(C,ne)|0,n=n+Math.imul(I,se)|0,i=(i=i+Math.imul(I,oe)|0)+Math.imul(T,se)|0,s=s+Math.imul(T,oe)|0,n=n+Math.imul(k,ce)|0,i=(i=i+Math.imul(k,ue)|0)+Math.imul(S,ce)|0,s=s+Math.imul(S,ue)|0,n=n+Math.imul(w,he)|0,i=(i=i+Math.imul(w,le)|0)+Math.imul(_,he)|0,s=s+Math.imul(_,le)|0;var Te=(u+(n=n+Math.imul(m,pe)|0)|0)+((8191&(i=(i=i+Math.imul(m,be)|0)+Math.imul(g,pe)|0))<<13)|0;u=((s=s+Math.imul(g,be)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(j,X),i=(i=Math.imul(j,Z))+Math.imul(U,X)|0,s=Math.imul(U,Z),n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(D,$)|0,s=s+Math.imul(D,ee)|0,n=n+Math.imul(M,re)|0,i=(i=i+Math.imul(M,ne)|0)+Math.imul(N,re)|0,s=s+Math.imul(N,ne)|0,n=n+Math.imul(x,se)|0,i=(i=i+Math.imul(x,oe)|0)+Math.imul(C,se)|0,s=s+Math.imul(C,oe)|0,n=n+Math.imul(I,ce)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(T,ce)|0,s=s+Math.imul(T,ue)|0,n=n+Math.imul(k,he)|0,i=(i=i+Math.imul(k,le)|0)+Math.imul(S,he)|0,s=s+Math.imul(S,le)|0;var Re=(u+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,be)|0)+Math.imul(_,pe)|0))<<13)|0;u=((s=s+Math.imul(_,be)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(j,$),i=(i=Math.imul(j,ee))+Math.imul(U,$)|0,s=Math.imul(U,ee),n=n+Math.imul(O,re)|0,i=(i=i+Math.imul(O,ne)|0)+Math.imul(D,re)|0,s=s+Math.imul(D,ne)|0,n=n+Math.imul(M,se)|0,i=(i=i+Math.imul(M,oe)|0)+Math.imul(N,se)|0,s=s+Math.imul(N,oe)|0,n=n+Math.imul(x,ce)|0,i=(i=i+Math.imul(x,ue)|0)+Math.imul(C,ce)|0,s=s+Math.imul(C,ue)|0,n=n+Math.imul(I,he)|0,i=(i=i+Math.imul(I,le)|0)+Math.imul(T,he)|0,s=s+Math.imul(T,le)|0;var xe=(u+(n=n+Math.imul(k,pe)|0)|0)+((8191&(i=(i=i+Math.imul(k,be)|0)+Math.imul(S,pe)|0))<<13)|0;u=((s=s+Math.imul(S,be)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(j,re),i=(i=Math.imul(j,ne))+Math.imul(U,re)|0,s=Math.imul(U,ne),n=n+Math.imul(O,se)|0,i=(i=i+Math.imul(O,oe)|0)+Math.imul(D,se)|0,s=s+Math.imul(D,oe)|0,n=n+Math.imul(M,ce)|0,i=(i=i+Math.imul(M,ue)|0)+Math.imul(N,ce)|0,s=s+Math.imul(N,ue)|0,n=n+Math.imul(x,he)|0,i=(i=i+Math.imul(x,le)|0)+Math.imul(C,he)|0,s=s+Math.imul(C,le)|0;var Ce=(u+(n=n+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,be)|0)+Math.imul(T,pe)|0))<<13)|0;u=((s=s+Math.imul(T,be)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(j,se),i=(i=Math.imul(j,oe))+Math.imul(U,se)|0,s=Math.imul(U,oe),n=n+Math.imul(O,ce)|0,i=(i=i+Math.imul(O,ue)|0)+Math.imul(D,ce)|0,s=s+Math.imul(D,ue)|0,n=n+Math.imul(M,he)|0,i=(i=i+Math.imul(M,le)|0)+Math.imul(N,he)|0,s=s+Math.imul(N,le)|0;var Be=(u+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,be)|0)+Math.imul(C,pe)|0))<<13)|0;u=((s=s+Math.imul(C,be)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(j,ce),i=(i=Math.imul(j,ue))+Math.imul(U,ce)|0,s=Math.imul(U,ue),n=n+Math.imul(O,he)|0,i=(i=i+Math.imul(O,le)|0)+Math.imul(D,he)|0,s=s+Math.imul(D,le)|0;var Me=(u+(n=n+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,be)|0)+Math.imul(N,pe)|0))<<13)|0;u=((s=s+Math.imul(N,be)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(j,he),i=(i=Math.imul(j,le))+Math.imul(U,he)|0,s=Math.imul(U,le);var Ne=(u+(n=n+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,be)|0)+Math.imul(D,pe)|0))<<13)|0;u=((s=s+Math.imul(D,be)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Pe=(u+(n=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,be))+Math.imul(U,pe)|0))<<13)|0;return u=((s=Math.imul(U,be))+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,c[0]=ye,c[1]=me,c[2]=ge,c[3]=ve,c[4]=we,c[5]=_e,c[6]=Ee,c[7]=ke,c[8]=Se,c[9]=Ae,c[10]=Ie,c[11]=Te,c[12]=Re,c[13]=xe,c[14]=Ce,c[15]=Be,c[16]=Me,c[17]=Ne,c[18]=Pe,0!==u&&(c[19]=u,r.length++),r};function p(e,t,r){return(new b).mulp(e,t,r)}function b(e,t){this.x=e,this.y=t}Math.imul||(d=l),s.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?d(this,e,t):r<63?l(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,s=0;s<r.length-1;s++){var o=i;i=0;for(var a=67108863&n,c=Math.min(s,t.length-1),u=Math.max(0,s-e.length+1);u<=c;u++){var f=s-u,h=(0|e.words[f])*(0|t.words[u]),l=67108863&h;a=67108863&(l=l+a|0),i+=(o=(o=o+(h/67108864|0)|0)+(l>>>26)|0)>>>26,o&=67108863}r.words[s]=a,n=o,o=i}return 0!==n?r.words[s]=n:r.length--,r.strip()}(this,e,t):p(this,e,t)},b.prototype.makeRBT=function(e){for(var t=new Array(e),r=s.prototype._countBits(e)-1,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},b.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,i=0;i<t;i++)n|=(1&e)<<t-i-1,e>>=1;return n},b.prototype.permute=function(e,t,r,n,i,s){for(var o=0;o<s;o++)n[o]=t[e[o]],i[o]=r[e[o]]},b.prototype.transform=function(e,t,r,n,i,s){this.permute(s,e,t,r,n,i);for(var o=1;o<i;o<<=1)for(var a=o<<1,c=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),f=0;f<i;f+=a)for(var h=c,l=u,d=0;d<o;d++){var p=r[f+d],b=n[f+d],y=r[f+d+o],m=n[f+d+o],g=h*y-l*m;m=h*m+l*y,y=g,r[f+d]=p+y,n[f+d]=b+m,r[f+d+o]=p-y,n[f+d+o]=b-m,d!==a&&(g=c*h-u*l,l=c*l+u*h,h=g)}},b.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},b.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=e[n];e[n]=e[r-n-1],e[r-n-1]=i,i=t[n],t[n]=-t[r-n-1],t[r-n-1]=-i}},b.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var i=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=67108863&i,r=i<67108864?0:i/67108864|0}return e},b.prototype.convert13b=function(e,t,r,i){for(var s=0,o=0;o<t;o++)s+=0|e[o],r[2*o]=8191&s,s>>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*t;o<i;++o)r[o]=0;n(0===s),n(0==(-8192&s))},b.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},b.prototype.mulp=function(e,t,r){var n=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(n),s=this.stub(n),o=new Array(n),a=new Array(n),c=new Array(n),u=new Array(n),f=new Array(n),h=new Array(n),l=r.words;l.length=n,this.convert13b(e.words,e.length,o,n),this.convert13b(t.words,t.length,u,n),this.transform(o,s,a,c,n,i),this.transform(u,s,f,h,n,i);for(var d=0;d<n;d++){var p=a[d]*f[d]-c[d]*h[d];c[d]=a[d]*h[d]+c[d]*f[d],a[d]=p}return this.conjugate(a,c,n),this.transform(a,c,l,s,n,i),this.conjugate(l,s,n),this.normalize13b(l,n),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},s.prototype.mul=function(e){var t=new s(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},s.prototype.mulf=function(e){var t=new s(null);return t.words=new Array(this.length+e.length),p(this,e,t)},s.prototype.imul=function(e){return this.clone().mulTo(e,this)},s.prototype.imuln=function(e){n("number"==typeof e),n(e<67108864);for(var t=0,r=0;r<this.length;r++){var i=(0|this.words[r])*e,s=(67108863&i)+(67108863&t);t>>=26,t+=i/67108864|0,t+=s>>>26,this.words[r]=67108863&s}return 0!==t&&(this.words[r]=t,this.length++),this},s.prototype.muln=function(e){return this.clone().imuln(e)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,i=r%26;t[r]=(e.words[n]&1<<i)>>>i}return t}(e);if(0===t.length)return new s(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var i=r.sqr();n<t.length;n++,i=i.sqr())0!==t[n]&&(r=r.mul(i));return r},s.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t<this.length;t++){var a=this.words[t]&s,c=(0|this.words[t])-a<<r;this.words[t]=c|o,o=a>>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},s.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},s.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var s=e%26,o=Math.min((e-s)/26,this.length),a=67108863^67108863>>>s<<s,c=r;if(i-=o,i=Math.max(0,i),c){for(var u=0;u<o;u++)c.words[u]=this.words[u];c.length=o}if(0===o);else if(this.length>o)for(this.length-=o,u=0;u<this.length;u++)this.words[u]=this.words[u+o];else this.words[0]=0,this.length=1;var f=0;for(u=this.length-1;u>=0&&(0!==f||u>=i);u--){var h=0|this.words[u];this.words[u]=f<<26-s|h>>>s,f=h&a}return c&&0!==f&&(c.words[c.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},s.prototype.shln=function(e){return this.clone().ishln(e)},s.prototype.ushln=function(e){return this.clone().iushln(e)},s.prototype.shrn=function(e){return this.clone().ishrn(e)},s.prototype.ushrn=function(e){return this.clone().iushrn(e)},s.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r)&&!!(this.words[r]&i)},s.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},s.prototype.maskn=function(e){return this.clone().imaskn(e)},s.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},s.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},s.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},s.prototype.addn=function(e){return this.clone().iaddn(e)},s.prototype.subn=function(e){return this.clone().isubn(e)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(e,t,r){var i,s,o=e.length+r;this._expand(o);var a=0;for(i=0;i<e.length;i++){s=(0|this.words[i+r])+a;var c=(0|e.words[i])*t;a=((s-=67108863&c)>>26)-(c/67108864|0),this.words[i+r]=67108863&s}for(;i<this.length-r;i++)a=(s=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&s;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(s=-(0|this.words[i])+a)>>26,this.words[i]=67108863&s;return this.negative=1,this.strip()},s.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var a,c=n.length-i.length;if("mod"!==t){(a=new s(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var f=n.clone()._ishlnsubmul(i,1,c);0===f.negative&&(n=f,a&&(a.words[c]=1));for(var h=c-1;h>=0;h--){var l=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(l=Math.min(l/o|0,67108863),n._ishlnsubmul(i,l,h);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);a&&(a.words[h]=l)}return a&&a.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},s.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:i,mod:o}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:a.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new s(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new s(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new s(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,o,a},s.prototype.div=function(e){return this.divmod(e,"div",!1).div},s.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},s.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},s.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),s=r.cmp(n);return s<0||1===i&&0===s?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},s.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},s.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},s.prototype.divn=function(e){return this.clone().idivn(e)},s.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new s(1),o=new s(0),a=new s(0),c=new s(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),h=t.clone();!t.isZero();){for(var l=0,d=1;0==(t.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(t.iushrn(l);l-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(f),o.isub(h)),i.iushrn(1),o.iushrn(1);for(var p=0,b=1;0==(r.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(f),c.isub(h)),a.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(a),o.isub(c)):(r.isub(t),a.isub(i),c.isub(o))}return{a:a,b:c,gcd:r.iushln(u)}},s.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,o=new s(1),a=new s(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;0==(t.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(t.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);for(var h=0,l=1;0==(r.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(r.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(a)):(r.isub(t),a.isub(o))}return(i=0===t.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(e),i},s.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var s=t;t=r,r=s}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},s.prototype.invm=function(e){return this.egcd(e).a.umod(e)},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.andln=function(e){return this.words[0]&e},s.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var s=i,o=r;0!==s&&o<this.length;o++){var a=0|this.words[o];s=(a+=s)>>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},s.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},s.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>i&&(t=1);break}}return t},s.prototype.gtn=function(e){return 1===this.cmpn(e)},s.prototype.gt=function(e){return 1===this.cmp(e)},s.prototype.gten=function(e){return this.cmpn(e)>=0},s.prototype.gte=function(e){return this.cmp(e)>=0},s.prototype.ltn=function(e){return-1===this.cmpn(e)},s.prototype.lt=function(e){return-1===this.cmp(e)},s.prototype.lten=function(e){return this.cmpn(e)<=0},s.prototype.lte=function(e){return this.cmp(e)<=0},s.prototype.eqn=function(e){return 0===this.cmpn(e)},s.prototype.eq=function(e){return 0===this.cmp(e)},s.red=function(e){return new E(e)},s.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(e){return this.red=e,this},s.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},s.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},s.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},s.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},s.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},s.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},s.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},s.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function m(e,t){this.name=e,this.p=new s(t,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(e){if("string"==typeof e){var t=s._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function k(e){E.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(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)}m.prototype._tmp=function(){var e=new s(null);return e.words=new Array(Math.ceil(this.n/13)),e},m.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(e,t){e.iushrn(this.n,0,t)},m.prototype.imulK=function(e){return e.imul(this.k)},i(g,m),g.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n<r;n++)t.words[n]=e.words[n];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=4194303&i,n=10;n<e.length;n++){var s=0|e.words[n];e.words[n-10]=(4194303&s)<<4|i>>>22,i=s}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},g.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(v,m),i(w,m),i(_,m),_.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},s._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new g;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return y[e]=t,t},E.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},E.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},E.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},E.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},E.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},E.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},E.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},E.prototype.isqr=function(e){return this.imul(e,e.clone())},E.prototype.sqr=function(e){return this.mul(e,e)},E.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new s(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var a=new s(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new s(2*f*f).toRed(this);0!==this.pow(f,u).cmp(c);)f.redIAdd(c);for(var h=this.pow(f,i),l=this.pow(e,i.addn(1).iushrn(1)),d=this.pow(e,i),p=o;0!==d.cmp(a);){for(var b=d,y=0;0!==b.cmp(a);y++)b=b.redSqr();n(y<p);var m=this.pow(h,new s(1).iushln(p-y-1));l=l.redMul(m),h=m.redSqr(),d=d.redMul(h),p=y}return l},E.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},E.prototype.pow=function(e,t){if(t.isZero())return new s(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new s(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var i=r[0],o=0,a=0,c=t.bitLength()%26;for(0===c&&(c=26),n=t.length-1;n>=0;n--){for(var u=t.words[n],f=c-1;f>=0;f--){var h=u>>f&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==o?(o<<=1,o|=h,(4===++a||0===n&&0===f)&&(i=this.mul(i,r[o]),a=0,o=0)):a=0}c=26}return i},E.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},E.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},s.mont=function(e){return new k(e)},i(k,E),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new s(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e)}).call(this,r(95)(e))},function(e,t,r){"use strict";(function(n,i){var s;!function(){var o="input is invalid type",a="object"==typeof window,c=a?window:{};c.JS_SHA3_NO_WINDOW&&(a=!1);var u=!a&&"object"==typeof self;!c.JS_SHA3_NO_NODE_JS&&"object"==typeof n&&n.versions&&n.versions.node?c=i:u&&(c=self);var f=!c.JS_SHA3_NO_COMMON_JS&&"object"==typeof e&&e.exports,h=r(469),l=!c.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,d="0123456789abcdef".split(""),p=[4,1024,262144,67108864],b=[0,8,16,24],y=[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],m=[224,256,384,512],g=[128,256],v=["hex","buffer","arrayBuffer","array","digest"],w={128:168,256:136};!c.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!l||!c.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var _=function(e,t,r){return function(n){return new D(e,t,e).update(n)[r]()}},E=function(e,t,r){return function(n,i){return new D(e,t,i).update(n)[r]()}},k=function(e,t,r){return function(t,n,i,s){return R["cshake"+e].update(t,n,i,s)[r]()}},S=function(e,t,r){return function(t,n,i,s){return R["kmac"+e].update(t,n,i,s)[r]()}},A=function(e,t,r,n){for(var i=0;i<v.length;++i){var s=v[i];e[s]=t(r,n,s)}return e},I=function(e,t){var r=_(e,t,"hex");return r.create=function(){return new D(e,t,e)},r.update=function(e){return r.create().update(e)},A(r,_,e,t)},T=[{name:"keccak",padding:[1,256,65536,16777216],bits:m,createMethod:I},{name:"sha3",padding:[6,1536,393216,100663296],bits:m,createMethod:I},{name:"shake",padding:[31,7936,2031616,520093696],bits:g,createMethod:function(e,t){var r=E(e,t,"hex");return r.create=function(r){return new D(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},A(r,E,e,t)}},{name:"cshake",padding:p,bits:g,createMethod:function(e,t){var r=w[e],n=k(e,0,"hex");return n.create=function(n,i,s){return i||s?new D(e,t,n).bytepad([i,s],r):R["shake"+e].create(n)},n.update=function(e,t,r,i){return n.create(t,r,i).update(e)},A(n,k,e,t)}},{name:"kmac",padding:p,bits:g,createMethod:function(e,t){var r=w[e],n=S(e,0,"hex");return n.create=function(n,i,s){return new L(e,t,i).bytepad(["KMAC",s],r).bytepad([n],r)},n.update=function(e,t,r,i){return n.create(e,r,i).update(t)},A(n,S,e,t)}}],R={},x=[],C=0;C<T.length;++C)for(var B=T[C],M=B.bits,N=0;N<M.length;++N){var P=B.name+"_"+M[N];if(x.push(P),R[P]=B.createMethod(M[N],B.padding),"sha3"!==B.name){var O=B.name+M[N];x.push(O),R[O]=R[P]}}function D(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function L(e,t,r){D.call(this,e,t,r)}D.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(o);if(null===e)throw new Error(o);if(l&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||l&&ArrayBuffer.isView(e)))throw new Error(o);t=!0}for(var n,i,s=this.blocks,a=this.byteCount,c=e.length,u=this.blockCount,f=0,h=this.s;f<c;){if(this.reset)for(this.reset=!1,s[0]=this.block,n=1;n<u+1;++n)s[n]=0;if(t)for(n=this.start;f<c&&n<a;++f)s[n>>2]|=e[f]<<b[3&n++];else for(n=this.start;f<c&&n<a;++f)(i=e.charCodeAt(f))<128?s[n>>2]|=i<<b[3&n++]:i<2048?(s[n>>2]|=(192|i>>6)<<b[3&n++],s[n>>2]|=(128|63&i)<<b[3&n++]):i<55296||i>=57344?(s[n>>2]|=(224|i>>12)<<b[3&n++],s[n>>2]|=(128|i>>6&63)<<b[3&n++],s[n>>2]|=(128|63&i)<<b[3&n++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++f)),s[n>>2]|=(240|i>>18)<<b[3&n++],s[n>>2]|=(128|i>>12&63)<<b[3&n++],s[n>>2]|=(128|i>>6&63)<<b[3&n++],s[n>>2]|=(128|63&i)<<b[3&n++]);if(this.lastByteIndex=n,n>=a){for(this.start=n-a,this.block=s[u],n=0;n<u;++n)h[n]^=s[n];j(h),this.reset=!0}else this.start=n}return this},D.prototype.encode=function(e,t){var r=255&e,n=1,i=[r];for(r=255&(e>>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},D.prototype.encodeString=function(e){var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(o);if(null===e)throw new Error(o);if(l&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||l&&ArrayBuffer.isView(e)))throw new Error(o);t=!0}var n=0,i=e.length;if(t)n=i;else for(var s=0;s<e.length;++s){var a=e.charCodeAt(s);a<128?n+=1:a<2048?n+=2:a<55296||a>=57344?n+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++s)),n+=4)}return n+=this.encode(8*n),this.update(e),n},D.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n<e.length;++n)r+=this.encodeString(e[n]);var i=t-r%t,s=[];return s.length=i,this.update(s),this},D.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];j(n)}},D.prototype.toString=D.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,s=0,o=0,a="";o<n;){for(s=0;s<t&&o<n;++s,++o)e=r[s],a+=d[e>>4&15]+d[15&e]+d[e>>12&15]+d[e>>8&15]+d[e>>20&15]+d[e>>16&15]+d[e>>28&15]+d[e>>24&15];o%t==0&&(j(r),s=0)}return i&&(e=r[s],a+=d[e>>4&15]+d[15&e],i>1&&(a+=d[e>>12&15]+d[e>>8&15]),i>2&&(a+=d[e>>20&15]+d[e>>16&15])),a},D.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,s=0,o=0,a=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var c=new Uint32Array(e);o<n;){for(s=0;s<t&&o<n;++s,++o)c[o]=r[s];o%t==0&&j(r)}return i&&(c[s]=r[s],e=e.slice(0,a)),e},D.prototype.buffer=D.prototype.arrayBuffer,D.prototype.digest=D.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,i=this.outputBlocks,s=this.extraBytes,o=0,a=0,c=[];a<i;){for(o=0;o<r&&a<i;++o,++a)e=a<<2,t=n[o],c[e]=255&t,c[e+1]=t>>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;a%r==0&&j(n)}return s&&(e=a<<2,t=n[o],c[e]=255&t,s>1&&(c[e+1]=t>>8&255),s>2&&(c[e+2]=t>>16&255)),c},L.prototype=new D,L.prototype.finalize=function(){return this.encode(this.outputBits,!0),D.prototype.finalize.call(this)};var j=function(e){var t,r,n,i,s,o,a,c,u,f,h,l,d,p,b,m,g,v,w,_,E,k,S,A,I,T,R,x,C,B,M,N,P,O,D,L,j,U,z,F,q,K,V,H,G,W,Y,J,X,Z,Q,$,ee,te,re,ne,ie,se,oe,ae,ce,ue,fe;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],s=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(l=e[8]^e[18]^e[28]^e[38]^e[48])^(o<<1|a>>>31),r=(d=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|o>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(c<<1|u>>>31),r=s^(u<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=o^(f<<1|h>>>31),r=a^(h<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(l<<1|d>>>31),r=u^(d<<1|l>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(i<<1|s>>>31),r=h^(s<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,p=e[0],b=e[1],W=e[11]<<4|e[10]>>>28,Y=e[10]<<4|e[11]>>>28,x=e[20]<<3|e[21]>>>29,C=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,V=e[41]<<18|e[40]>>>14,O=e[2]<<1|e[3]>>>31,D=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,J=e[22]<<10|e[23]>>>22,X=e[23]<<10|e[22]>>>22,B=e[33]<<13|e[32]>>>19,M=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,fe=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,L=e[14]<<6|e[15]>>>26,j=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,Z=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,N=e[45]<<29|e[44]>>>3,P=e[44]<<29|e[45]>>>3,A=e[6]<<28|e[7]>>>4,I=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,U=e[26]<<25|e[27]>>>7,z=e[27]<<25|e[26]>>>7,_=e[36]<<21|e[37]>>>11,E=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,H=e[8]<<27|e[9]>>>5,G=e[9]<<27|e[8]>>>5,T=e[18]<<20|e[19]>>>12,R=e[19]<<20|e[18]>>>12,se=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,F=e[38]<<8|e[39]>>>24,q=e[39]<<8|e[38]>>>24,k=e[48]<<14|e[49]>>>18,S=e[49]<<14|e[48]>>>18,e[0]=p^~m&v,e[1]=b^~g&w,e[10]=A^~T&x,e[11]=I^~R&C,e[20]=O^~L&U,e[21]=D^~j&z,e[30]=H^~W&J,e[31]=G^~Y&X,e[40]=te^~ne&se,e[41]=re^~ie&oe,e[2]=m^~v&_,e[3]=g^~w&E,e[12]=T^~x&B,e[13]=R^~C&M,e[22]=L^~U&F,e[23]=j^~z&q,e[32]=W^~J&Z,e[33]=Y^~X&Q,e[42]=ne^~se&ae,e[43]=ie^~oe&ce,e[4]=v^~_&k,e[5]=w^~E&S,e[14]=x^~B&N,e[15]=C^~M&P,e[24]=U^~F&K,e[25]=z^~q&V,e[34]=J^~Z&$,e[35]=X^~Q&ee,e[44]=se^~ae&ue,e[45]=oe^~ce&fe,e[6]=_^~k&p,e[7]=E^~S&b,e[16]=B^~N&A,e[17]=M^~P&I,e[26]=F^~K&O,e[27]=q^~V&D,e[36]=Z^~$&H,e[37]=Q^~ee&G,e[46]=ae^~ue&te,e[47]=ce^~fe&re,e[8]=k^~p&m,e[9]=S^~b&g,e[18]=N^~A&T,e[19]=P^~I&R,e[28]=K^~O&L,e[29]=V^~D&j,e[38]=$^~H&W,e[39]=ee^~G&Y,e[48]=ue^~te&ne,e[49]=fe^~re&ie,e[0]^=y[n],e[1]^=y[n+1]};if(f)e.exports=R;else{for(C=0;C<x.length;++C)c[x[C]]=R[x[C]];h&&(void 0===(s=function(){return R}.call(t,r,t,e))||(e.exports=s))}}()}).call(this,r(8),r(10))},function(e,t,r){"use strict";e.exports=r(470)},function(e,t,r){"use strict";var n=r(474),i=r(475);e.exports={blake2b:n.blake2b,blake2bHex:n.blake2bHex,blake2bInit:n.blake2bInit,blake2bUpdate:n.blake2bUpdate,blake2bFinal:n.blake2bFinal,blake2s:i.blake2s,blake2sHex:i.blake2sHex,blake2sInit:i.blake2sInit,blake2sUpdate:i.blake2sUpdate,blake2sFinal:i.blake2sFinal}},function(e,t,r){"use strict";var n;!function(i){var s,o=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,u="[BigNumber Error] ",f=u+"Number primitive has more than 15 significant digits: ",h=1e14,l=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e9;function p(e){var t=0|e;return e>0||e===t?t:t-1}function b(e){for(var t,r,n=1,i=e.length,s=e[0]+"";n<i;){for(r=14-(t=e[n++]+"").length;r--;t="0"+t);s+=t}for(i=s.length;48===s.charCodeAt(--i););return s.slice(0,i+1||1)}function y(e,t){var r,n,i=e.c,s=t.c,o=e.s,a=t.s,c=e.e,u=t.e;if(!o||!a)return null;if(r=i&&!i[0],n=s&&!s[0],r||n)return r?n?0:-a:o;if(o!=a)return o;if(r=o<0,n=c==u,!i||!s)return n?0:!i^r?1:-1;if(!n)return c>u^r?1:-1;for(a=(c=i.length)<(u=s.length)?c:u,o=0;o<a;o++)if(i[o]!=s[o])return i[o]>s[o]^r?1:-1;return c==u?0:c>u^r?1:-1}function m(e,t,r,n){if(e<t||e>r||e!==c(e))throw Error(u+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function g(e){var t=e.c.length-1;return p(e.e/14)==t&&e.c[t]%2!=0}function v(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function w(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}(s=function e(t){var r,n,i,s,_,E,k,S,A,I=U.prototype={constructor:U,toString:null,valueOf:null},T=new U(1),R=20,x=4,C=-7,B=21,M=-1e7,N=1e7,P=!1,O=1,D=0,L={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},j="0123456789abcdefghijklmnopqrstuvwxyz";function U(e,t){var r,s,a,u,h,l,d,p,b=this;if(!(b instanceof U))return new U(e,t);if(null==t){if(e&&!0===e._isBigNumber)return b.s=e.s,void(!e.c||e.e>N?b.c=b.e=null:e.e<M?b.c=[b.e=0]:(b.e=e.e,b.c=e.c.slice()));if((l="number"==typeof e)&&0*e==0){if(b.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,h=e;h>=10;h/=10,u++);return void(u>N?b.c=b.e=null:(b.e=u,b.c=[e]))}p=String(e)}else{if(!o.test(p=String(e)))return i(b,p,l);b.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(u=p.indexOf("."))>-1&&(p=p.replace(".","")),(h=p.search(/e/i))>0?(u<0&&(u=h),u+=+p.slice(h+1),p=p.substring(0,h)):u<0&&(u=p.length)}else{if(m(t,2,j.length,"Base"),10==t)return K(b=new U(e),R+b.e+1,x);if(p=String(e),l="number"==typeof e){if(0*e!=0)return i(b,p,l,t);if(b.s=1/e<0?(p=p.slice(1),-1):1,U.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(f+e)}else b.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(r=j.slice(0,t),u=h=0,d=p.length;h<d;h++)if(r.indexOf(s=p.charAt(h))<0){if("."==s){if(h>u){u=d;continue}}else if(!a&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){a=!0,h=-1,u=0;continue}return i(b,String(e),l,t)}l=!1,(u=(p=n(p,t,10,b.s)).indexOf("."))>-1?p=p.replace(".",""):u=p.length}for(h=0;48===p.charCodeAt(h);h++);for(d=p.length;48===p.charCodeAt(--d););if(p=p.slice(h,++d)){if(d-=h,l&&U.DEBUG&&d>15&&(e>9007199254740991||e!==c(e)))throw Error(f+b.s*e);if((u=u-h-1)>N)b.c=b.e=null;else if(u<M)b.c=[b.e=0];else{if(b.e=u,b.c=[],h=(u+1)%14,u<0&&(h+=14),h<d){for(h&&b.c.push(+p.slice(0,h)),d-=14;h<d;)b.c.push(+p.slice(h,h+=14));h=14-(p=p.slice(h)).length}else h-=d;for(;h--;p+="0");b.c.push(+p)}}else b.c=[b.e=0]}function z(e,t,r,n){var i,s,o,a,c;if(null==r?r=x:m(r,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==t)c=b(e.c),c=1==n||2==n&&(o<=C||o>=B)?v(c,o):w(c,o,"0");else if(s=(e=K(new U(e),t,r)).e,a=(c=b(e.c)).length,1==n||2==n&&(t<=s||s<=C)){for(;a<t;c+="0",a++);c=v(c,s)}else if(t-=o,c=w(c,s,"0"),s+1>a){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=s-a)>0)for(s+1==a&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function F(e,t){for(var r,n=1,i=new U(e[0]);n<e.length;n++){if(!(r=new U(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function q(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+14*r-1)>N?e.c=e.e=null:r<M?e.c=[e.e=0]:(e.e=r,e.c=t),e}function K(e,t,r,n){var i,s,o,u,f,d,p,b=e.c,y=l;if(b){e:{for(i=1,u=b[0];u>=10;u/=10,i++);if((s=t-i)<0)s+=14,o=t,p=(f=b[d=0])/y[i-o-1]%10|0;else if((d=a((s+1)/14))>=b.length){if(!n)break e;for(;b.length<=d;b.push(0));f=p=0,i=1,o=(s%=14)-14+1}else{for(f=u=b[d],i=1;u>=10;u/=10,i++);p=(o=(s%=14)-14+i)<0?0:f/y[i-o-1]%10|0}if(n=n||t<0||null!=b[d+1]||(o<0?f:f%y[i-o-1]),n=r<4?(p||n)&&(0==r||r==(e.s<0?3:2)):p>5||5==p&&(4==r||n||6==r&&(s>0?o>0?f/y[i-o]:0:b[d-1])%10&1||r==(e.s<0?8:7)),t<1||!b[0])return b.length=0,n?(t-=e.e+1,b[0]=y[(14-t%14)%14],e.e=-t||0):b[0]=e.e=0,e;if(0==s?(b.length=d,u=1,d--):(b.length=d+1,u=y[14-s],b[d]=o>0?c(f/y[i-o]%y[o])*u:0),n)for(;;){if(0==d){for(s=1,o=b[0];o>=10;o/=10,s++);for(o=b[0]+=u,u=1;o>=10;o/=10,u++);s!=u&&(e.e++,b[0]==h&&(b[0]=1));break}if(b[d]+=u,b[d]!=h)break;b[d--]=0,u=1}for(s=b.length;0===b[--s];b.pop());}e.e>N?e.c=e.e=null:e.e<M&&(e.c=[e.e=0])}return e}function V(e){var t,r=e.e;return null===r?e.toString():(t=b(e.c),t=r<=C||r>=B?v(t,r):w(t,r,"0"),e.s<0?"-"+t:t)}return U.clone=e,U.ROUND_UP=0,U.ROUND_DOWN=1,U.ROUND_CEIL=2,U.ROUND_FLOOR=3,U.ROUND_HALF_UP=4,U.ROUND_HALF_DOWN=5,U.ROUND_HALF_EVEN=6,U.ROUND_HALF_CEIL=7,U.ROUND_HALF_FLOOR=8,U.EUCLID=9,U.config=U.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(u+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(m(r=e[t],0,d,t),R=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(m(r=e[t],0,8,t),x=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(m(r[0],-d,0,t),m(r[1],0,d,t),C=r[0],B=r[1]):(m(r,-d,d,t),C=-(B=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)m(r[0],-d,-1,t),m(r[1],1,d,t),M=r[0],N=r[1];else{if(m(r,-d,d,t),!r)throw Error(u+t+" cannot be zero: "+r);M=-(N=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(u+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw P=!r,Error(u+"crypto unavailable");P=r}else P=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(m(r=e[t],0,9,t),O=r),e.hasOwnProperty(t="POW_PRECISION")&&(m(r=e[t],0,d,t),D=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(u+t+" not an object: "+r);L=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(u+t+" invalid: "+r);j=r}}return{DECIMAL_PLACES:R,ROUNDING_MODE:x,EXPONENTIAL_AT:[C,B],RANGE:[M,N],CRYPTO:P,MODULO_MODE:O,POW_PRECISION:D,FORMAT:L,ALPHABET:j}},U.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!U.DEBUG)return!0;var t,r,n=e.c,i=e.e,s=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===s||-1===s)&&i>=-d&&i<=d&&i===c(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%14)<1&&(t+=14),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=h||r!==c(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===s||1===s||-1===s))return!0;throw Error(u+"Invalid BigNumber: "+e)},U.maximum=U.max=function(){return F(arguments,I.lt)},U.minimum=U.min=function(){return F(arguments,I.gt)},U.random=(s=9007199254740992*Math.random()&2097151?function(){return c(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,f=0,h=[],p=new U(T);if(null==e?e=R:m(e,0,d),i=a(e/14),P)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));f<i;)(o=131072*t[f]+(t[f+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[f]=r[0],t[f+1]=r[1]):(h.push(o%1e14),f+=2);f=i/2}else{if(!crypto.randomBytes)throw P=!1,Error(u+"crypto unavailable");for(t=crypto.randomBytes(i*=7);f<i;)(o=281474976710656*(31&t[f])+1099511627776*t[f+1]+4294967296*t[f+2]+16777216*t[f+3]+(t[f+4]<<16)+(t[f+5]<<8)+t[f+6])>=9e15?crypto.randomBytes(7).copy(t,f):(h.push(o%1e14),f+=7);f=i/7}if(!P)for(;f<i;)(o=s())<9e15&&(h[f++]=o%1e14);for(e%=14,(i=h[--f])&&e&&(o=l[14-e],h[f]=c(i/o)*o);0===h[f];h.pop(),f--);if(f<0)h=[n=0];else{for(n=-1;0===h[0];h.splice(0,1),n-=14);for(f=1,o=h[0];o>=10;o/=10,f++);f<14&&(n-=14-f)}return p.e=n,p.c=h,p}),U.sum=function(){for(var e=1,t=arguments,r=new U(t[0]);e<t.length;)r=r.plus(t[e++]);return r},n=function(){function e(e,t,r,n){for(var i,s,o=[0],a=0,c=e.length;a<c;){for(s=o.length;s--;o[s]*=t);for(o[0]+=n.indexOf(e.charAt(a++)),i=0;i<o.length;i++)o[i]>r-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/r|0,o[i]%=r)}return o.reverse()}return function(t,n,i,s,o){var a,c,u,f,h,l,d,p,y=t.indexOf("."),m=R,g=x;for(y>=0&&(f=D,D=0,t=t.replace(".",""),l=(p=new U(n)).pow(t.length-y),D=f,p.c=e(w(b(l.c),l.e,"0"),10,i,"0123456789"),p.e=p.c.length),u=f=(d=e(t,n,i,o?(a=j,"0123456789"):(a="0123456789",j))).length;0==d[--f];d.pop());if(!d[0])return a.charAt(0);if(y<0?--u:(l.c=d,l.e=u,l.s=s,d=(l=r(l,p,m,g,i)).c,h=l.r,u=l.e),y=d[c=u+m+1],f=i/2,h=h||c<0||null!=d[c+1],h=g<4?(null!=y||h)&&(0==g||g==(l.s<0?3:2)):y>f||y==f&&(4==g||h||6==g&&1&d[c-1]||g==(l.s<0?8:7)),c<1||!d[0])t=h?w(a.charAt(1),-m,a.charAt(0)):a.charAt(0);else{if(d.length=c,h)for(--i;++d[--c]>i;)d[c]=0,c||(++u,d=[1].concat(d));for(f=d.length;!d[--f];);for(y=0,t="";y<=f;t+=a.charAt(d[y++]));t=w(t,u,a.charAt(0))}return t}}(),r=function(){function e(e,t,r){var n,i,s,o,a=0,c=e.length,u=t%1e7,f=t/1e7|0;for(e=e.slice();c--;)a=((i=u*(s=e[c]%1e7)+(n=f*s+(o=e[c]/1e7|0)*u)%1e7*1e7+a)/r|0)+(n/1e7|0)+f*o,e[c]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,s;if(r!=n)s=r>n?1:-1;else for(i=s=0;i<r;i++)if(e[i]!=t[i]){s=e[i]>t[i]?1:-1;break}return s}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,s,o,a){var u,f,l,d,b,y,m,g,v,w,_,E,k,S,A,I,T,R=n.s==i.s?1:-1,x=n.c,C=i.c;if(!(x&&x[0]&&C&&C[0]))return new U(n.s&&i.s&&(x?!C||x[0]!=C[0]:C)?x&&0==x[0]||!C?0*R:R/0:NaN);for(v=(g=new U(R)).c=[],R=s+(f=n.e-i.e)+1,a||(a=h,f=p(n.e/14)-p(i.e/14),R=R/14|0),l=0;C[l]==(x[l]||0);l++);if(C[l]>(x[l]||0)&&f--,R<0)v.push(1),d=!0;else{for(S=x.length,I=C.length,l=0,R+=2,(b=c(a/(C[0]+1)))>1&&(C=e(C,b,a),x=e(x,b,a),I=C.length,S=x.length),k=I,_=(w=x.slice(0,I)).length;_<I;w[_++]=0);T=C.slice(),T=[0].concat(T),A=C[0],C[1]>=a/2&&A++;do{if(b=0,(u=t(C,w,I,_))<0){if(E=w[0],I!=_&&(E=E*a+(w[1]||0)),(b=c(E/A))>1)for(b>=a&&(b=a-1),m=(y=e(C,b,a)).length,_=w.length;1==t(y,w,m,_);)b--,r(y,I<m?T:C,m,a),m=y.length,u=1;else 0==b&&(u=b=1),m=(y=C.slice()).length;if(m<_&&(y=[0].concat(y)),r(w,y,_,a),_=w.length,-1==u)for(;t(C,w,I,_)<1;)b++,r(w,I<_?T:C,_,a),_=w.length}else 0===u&&(b++,w=[0]);v[l++]=b,w[0]?w[_++]=x[k]||0:(w=[x[k]],_=1)}while((k++<S||null!=w[0])&&R--);d=null!=w[0],v[0]||v.splice(0,1)}if(a==h){for(l=1,R=v[0];R>=10;R/=10,l++);K(g,s+(g.e=l+14*f-1)+1,o,d)}else g.e=f,g.r=+d;return g}}(),_=/^(-?)0([xbo])(?=\w[\w.]*$)/i,E=/^([^.]+)\.$/,k=/^\.([^.]+)$/,S=/^-?(Infinity|NaN)$/,A=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,r,n){var i,s=r?t:t.replace(A,"");if(S.test(s))e.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(_,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,s=s.replace(E,"$1").replace(k,"0.$1")),t!=s))return new U(s,i);if(U.DEBUG)throw Error(u+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},I.absoluteValue=I.abs=function(){var e=new U(this);return e.s<0&&(e.s=1),e},I.comparedTo=function(e,t){return y(this,new U(e,t))},I.decimalPlaces=I.dp=function(e,t){var r,n,i,s=this;if(null!=e)return m(e,0,d),null==t?t=x:m(t,0,8),K(new U(s),e+s.e+1,t);if(!(r=s.c))return null;if(n=14*((i=r.length-1)-p(this.e/14)),i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},I.dividedBy=I.div=function(e,t){return r(this,new U(e,t),R,x)},I.dividedToIntegerBy=I.idiv=function(e,t){return r(this,new U(e,t),0,1)},I.exponentiatedBy=I.pow=function(e,t){var r,n,i,s,o,f,h,l,d=this;if((e=new U(e)).c&&!e.isInteger())throw Error(u+"Exponent not an integer: "+V(e));if(null!=t&&(t=new U(t)),o=e.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!e.c||!e.c[0])return l=new U(Math.pow(+V(d),o?2-g(e):+V(e))),t?l.mod(t):l;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new U(NaN);(n=!f&&d.isInteger()&&t.isInteger())&&(d=d.mod(t))}else{if(e.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||o&&d.c[1]>=24e7:d.c[0]<8e13||o&&d.c[0]<=9999975e7)))return s=d.s<0&&g(e)?-0:0,d.e>-1&&(s=1/s),new U(f?1/s:s);D&&(s=a(D/14+2))}for(o?(r=new U(.5),f&&(e.s=1),h=g(e)):h=(i=Math.abs(+V(e)))%2,l=new U(T);;){if(h){if(!(l=l.times(d)).c)break;s?l.c.length>s&&(l.c.length=s):n&&(l=l.mod(t))}if(i){if(0===(i=c(i/2)))break;h=i%2}else if(K(e=e.times(r),e.e+1,1),e.e>14)h=g(e);else{if(0===(i=+V(e)))break;h=i%2}d=d.times(d),s?d.c&&d.c.length>s&&(d.c.length=s):n&&(d=d.mod(t))}return n?l:(f&&(l=T.div(l)),t?l.mod(t):s?K(l,D,x,void 0):l)},I.integerValue=function(e){var t=new U(this);return null==e?e=x:m(e,0,8),K(t,t.e+1,e)},I.isEqualTo=I.eq=function(e,t){return 0===y(this,new U(e,t))},I.isFinite=function(){return!!this.c},I.isGreaterThan=I.gt=function(e,t){return y(this,new U(e,t))>0},I.isGreaterThanOrEqualTo=I.gte=function(e,t){return 1===(t=y(this,new U(e,t)))||0===t},I.isInteger=function(){return!!this.c&&p(this.e/14)>this.c.length-2},I.isLessThan=I.lt=function(e,t){return y(this,new U(e,t))<0},I.isLessThanOrEqualTo=I.lte=function(e,t){return-1===(t=y(this,new U(e,t)))||0===t},I.isNaN=function(){return!this.s},I.isNegative=function(){return this.s<0},I.isPositive=function(){return this.s>0},I.isZero=function(){return!!this.c&&0==this.c[0]},I.minus=function(e,t){var r,n,i,s,o=this,a=o.s;if(t=(e=new U(e,t)).s,!a||!t)return new U(NaN);if(a!=t)return e.s=-t,o.plus(e);var c=o.e/14,u=e.e/14,f=o.c,l=e.c;if(!c||!u){if(!f||!l)return f?(e.s=-t,e):new U(l?o:NaN);if(!f[0]||!l[0])return l[0]?(e.s=-t,e):new U(f[0]?o:3==x?-0:0)}if(c=p(c),u=p(u),f=f.slice(),a=c-u){for((s=a<0)?(a=-a,i=f):(u=c,i=l),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(s=(a=f.length)<(t=l.length))?a:t,a=t=0;t<n;t++)if(f[t]!=l[t]){s=f[t]<l[t];break}if(s&&(i=f,f=l,l=i,e.s=-e.s),(t=(n=l.length)-(r=f.length))>0)for(;t--;f[r++]=0);for(t=h-1;n>a;){if(f[--n]<l[n]){for(r=n;r&&!f[--r];f[r]=t);--f[r],f[n]+=h}f[n]-=l[n]}for(;0==f[0];f.splice(0,1),--u);return f[0]?q(e,f,u):(e.s=3==x?-1:1,e.c=[e.e=0],e)},I.modulo=I.mod=function(e,t){var n,i,s=this;return e=new U(e,t),!s.c||!e.s||e.c&&!e.c[0]?new U(NaN):!e.c||s.c&&!s.c[0]?new U(s):(9==O?(i=e.s,e.s=1,n=r(s,e,0,3),e.s=i,n.s*=i):n=r(s,e,0,O),(e=s.minus(n.times(e))).c[0]||1!=O||(e.s=s.s),e)},I.multipliedBy=I.times=function(e,t){var r,n,i,s,o,a,c,u,f,l,d,b,y,m,g=this,v=g.c,w=(e=new U(e,t)).c;if(!(v&&w&&v[0]&&w[0]))return!g.s||!e.s||v&&!v[0]&&!w||w&&!w[0]&&!v?e.c=e.e=e.s=null:(e.s*=g.s,v&&w?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=p(g.e/14)+p(e.e/14),e.s*=g.s,(c=v.length)<(l=w.length)&&(y=v,v=w,w=y,i=c,c=l,l=i),i=c+l,y=[];i--;y.push(0));for(m=h,1e7,i=l;--i>=0;){for(r=0,d=w[i]%1e7,b=w[i]/1e7|0,s=i+(o=c);s>i;)r=((u=d*(u=v[--o]%1e7)+(a=b*u+(f=v[o]/1e7|0)*d)%1e7*1e7+y[s]+r)/m|0)+(a/1e7|0)+b*f,y[s--]=u%m;y[s]=r}return r?++n:y.splice(0,1),q(e,y,n)},I.negated=function(){var e=new U(this);return e.s=-e.s||null,e},I.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new U(e,t)).s,!i||!t)return new U(NaN);if(i!=t)return e.s=-t,n.minus(e);var s=n.e/14,o=e.e/14,a=n.c,c=e.c;if(!s||!o){if(!a||!c)return new U(i/0);if(!a[0]||!c[0])return c[0]?e:new U(a[0]?n:0*i)}if(s=p(s),o=p(o),a=a.slice(),i=s-o){for(i>0?(o=s,r=c):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(t=c.length)<0&&(r=c,c=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+c[t]+i)/h|0,a[t]=h===a[t]?0:a[t]%h;return i&&(a=[i].concat(a),++o),q(e,a,o)},I.precision=I.sd=function(e,t){var r,n,i,s=this;if(null!=e&&e!==!!e)return m(e,1,d),null==t?t=x:m(t,0,8),K(new U(s),e,t);if(!(r=s.c))return null;if(n=14*(i=r.length-1)+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&s.e+1>n&&(n=s.e+1),n},I.shiftedBy=function(e){return m(e,-9007199254740991,9007199254740991),this.times("1e"+e)},I.squareRoot=I.sqrt=function(){var e,t,n,i,s,o=this,a=o.c,c=o.s,u=o.e,f=R+4,h=new U("0.5");if(1!==c||!a||!a[0])return new U(!c||c<0&&(!a||a[0])?NaN:a?o:1/0);if(0==(c=Math.sqrt(+V(o)))||c==1/0?(((t=b(a)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=p((u+1)/2)-(u<0||u%2),n=new U(t=c==1/0?"1e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):n=new U(c+""),n.c[0])for((c=(u=n.e)+f)<3&&(c=0);;)if(s=n,n=h.times(s.plus(r(o,s,f,1))),b(s.c).slice(0,c)===(t=b(n.c)).slice(0,c)){if(n.e<u&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(K(n,n.e+R+2,1),e=!n.times(n).eq(o));break}if(!i&&(K(s,s.e+R+2,0),s.times(s).eq(o))){n=s;break}f+=4,c+=4,i=1}return K(n,n.e+R+1,x,e)},I.toExponential=function(e,t){return null!=e&&(m(e,0,d),e++),z(this,e,t,1)},I.toFixed=function(e,t){return null!=e&&(m(e,0,d),e=e+this.e+1),z(this,e,t)},I.toFormat=function(e,t,r){var n,i=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=L;else if("object"!=typeof r)throw Error(u+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var s,o=n.split("."),a=+r.groupSize,c=+r.secondaryGroupSize,f=r.groupSeparator||"",h=o[0],l=o[1],d=i.s<0,p=d?h.slice(1):h,b=p.length;if(c&&(s=a,a=c,c=s,b-=s),a>0&&b>0){for(s=b%a||a,h=p.substr(0,s);s<b;s+=a)h+=f+p.substr(s,a);c>0&&(h+=f+p.slice(s)),d&&(h="-"+h)}n=l?h+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?l.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):l):h}return(r.prefix||"")+n+(r.suffix||"")},I.toFraction=function(e){var t,n,i,s,o,a,c,f,h,d,p,y,m=this,g=m.c;if(null!=e&&(!(c=new U(e)).isInteger()&&(c.c||1!==c.s)||c.lt(T)))throw Error(u+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+V(c));if(!g)return new U(m);for(t=new U(T),h=n=new U(T),i=f=new U(T),y=b(g),o=t.e=y.length-m.e-1,t.c[0]=l[(a=o%14)<0?14+a:a],e=!e||c.comparedTo(t)>0?o>0?t:h:c,a=N,N=1/0,c=new U(y),f.c[0]=0;d=r(c,t,0,1),1!=(s=n.plus(d.times(i))).comparedTo(e);)n=i,i=s,h=f.plus(d.times(s=h)),f=s,t=c.minus(d.times(s=t)),c=s;return s=r(e.minus(n),i,0,1),f=f.plus(s.times(h)),n=n.plus(s.times(i)),f.s=h.s=m.s,p=r(h,i,o*=2,x).minus(m).abs().comparedTo(r(f,n,o,x).minus(m).abs())<1?[h,i]:[f,n],N=a,p},I.toNumber=function(){return+V(this)},I.toPrecision=function(e,t){return null!=e&&m(e,1,d),z(this,e,t,2)},I.toString=function(e){var t,r=this,i=r.s,s=r.e;return null===s?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=s<=C||s>=B?v(b(r.c),s):w(b(r.c),s,"0"):10===e?t=w(b((r=K(new U(r),R+s+1,x)).c),r.e,"0"):(m(e,2,j.length,"Base"),t=n(w(b(r.c),s,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},I.valueOf=I.toJSON=function(){return V(this)},I._isBigNumber=!0,null!=t&&U.set(t),U}()).default=s.BigNumber=s,void 0===(n=function(){return s}.call(t,r,t,e))||(e.exports=n)}()},function(e,t,r){"use strict";const n=r(259),i=r(147),s=r(32),o=r(1),a=r(4);e.exports=async(e,t,r)=>{const c=Array.isArray(t);let u=Array.isArray(t)?t:[t];const f=await n(e,r);return u=u.map(e=>{if(a.isCID(e)&&(e="/ipfs/".concat(e)),(e=(e=(e||"").trim()).replace(/(\/\/+)/g,"/")).endsWith("/")&&e.length>1&&(e=e.substring(0,e.length-1)),!e)throw o(new Error("paths must not be empty"),"ERR_NO_PATH");if("/"!==e.substring(0,1))throw o(new Error("paths must start with a leading slash"),"ERR_INVALID_PATH");"/"===e.substring(e.length-1)&&(e=e.substring(0,e.length-1));const t=i(e);if("ipfs"===t[0]){let e;return e=2===t.length?"/".concat(t.join("/")):"/".concat(t.slice(0,t.length-1).join("/")),{type:"ipfs",depth:t.length-2,mfsPath:"/".concat(t.join("/")),mfsDirectory:e,parts:t,path:"/".concat(t.join("/")),name:t[t.length-1]}}const r="/".concat("ipfs","/").concat(f).concat(t.length?"/"+t.join("/"):""),n="/".concat("ipfs","/").concat(f,"/").concat(t.slice(0,t.length-1).join("/"));return{type:"mfs",depth:t.length,mfsDirectory:n,mfsPath:r,parts:t,path:"/".concat(t.join("/")),name:t[t.length-1]}}),await Promise.all(u.map(async t=>{const r="mfs"===t.type?t.mfsPath:t.path;try{const n=await s(r,e.ipld);t.cid=n.cid,t.mfsPath="/ipfs/".concat(n.path),t.unixfs=n.unixfs,t.content=n.content}catch(n){if("ERR_NOT_FOUND"!==n.code)throw n}t.exists=Boolean(t.cid)})),c?u:u[0]}},function(e,t,r){"use strict";e.exports=function e(t,r){if(!t){const t=new Error(r||"Assertion failed");throw Error.captureStackTrace&&Error.captureStackTrace(t,e),t}}},function(e,t,r){"use strict";const n=r(6),i=r(15),s=r(16),{Record:o}=r(68),{Buffer:a}=r(0),c=s(r(962)),u=c.Message.MessageType,f=c.Message.ConnectionType;class h{constructor(e,t,r){if(t&&!a.isBuffer(t))throw new Error("Key must be a buffer");this.type=e,this.key=t,this._clusterLevelRaw=r,this.closerPeers=[],this.providerPeers=[],this.record=null}get clusterLevel(){const e=this._clusterLevelRaw-1;return e<0?0:e}set clusterLevel(e){this._clusterLevelRaw=e}serialize(){const e={key:this.key,type:this.type,clusterLevelRaw:this._clusterLevelRaw,closerPeers:this.closerPeers.map(l),providerPeers:this.providerPeers.map(l)};return this.record&&(a.isBuffer(this.record)?e.record=this.record:e.record=this.record.serialize()),c.Message.encode(e)}static deserialize(e){const t=c.Message.decode(e),r=new h(t.type,t.key,t.clusterLevelRaw);return r.closerPeers=t.closerPeers.map(d),r.providerPeers=t.providerPeers.map(d),t.record&&(r.record=o.deserialize(t.record)),r}}function l(e){return{id:e.id.id,addrs:(e.multiaddrs||[]).map(e=>e.buffer),connection:f.CONNECTED}}function d(e){return{id:new n(e.id),multiaddrs:e.addrs.map(e=>i(e))}}h.TYPES=u,h.CONNECTION_TYPES=f,e.exports=h},function(e,t,r){"use strict";const{AbortController:n,AbortSignal:i}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;e.exports=n,e.exports.AbortSignal=i,e.exports.default=n},function(e,t,r){"use strict";var n=r(199).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var i=0;i<e.length;i++){var s=e.charAt(i),o=s.charCodeAt(0);if(255!==t[o])throw new TypeError(s+" is ambiguous");t[o]=i}var a=e.length,c=e.charAt(0),u=Math.log(a)/Math.log(256),f=Math.log(256)/Math.log(a);function h(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return n.alloc(0);var r=0;if(" "!==e[r]){for(var i=0,s=0;e[r]===c;)i++,r++;for(var o=(e.length-r)*u+1>>>0,f=new Uint8Array(o);e[r];){var h=t[e.charCodeAt(r)];if(255===h)return;for(var l=0,d=o-1;(0!==h||l<s)&&-1!==d;d--,l++)h+=a*f[d]>>>0,f[d]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");s=l,r++}if(" "!==e[r]){for(var p=o-s;p!==o&&0===f[p];)p++;var b=n.allocUnsafe(i+(o-p));b.fill(0,0,i);for(var y=i;p!==o;)b[y++]=f[p++];return b}}}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=n.from(t)),!n.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,i=0,s=0,o=t.length;s!==o&&0===t[s];)s++,r++;for(var u=(o-s)*f+1>>>0,h=new Uint8Array(u);s!==o;){for(var l=t[s],d=0,p=u-1;(0!==l||d<i)&&-1!==p;p--,d++)l+=256*h[p]>>>0,h[p]=l%a>>>0,l=l/a>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,s++}for(var b=u-i;b!==u&&0===h[b];)b++;for(var y=c.repeat(r);b<u;++b)y+=e.charAt(h[b]);return y},decodeUnsafe:h,decode:function(e){var t=h(e);if(t)return t;throw new Error("Non-base"+a+" character")}}}},function(e,t,r){"use strict";var n=r(5);r(9),r(72);var i=e.exports=n.asn1=n.asn1||{};function s(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},i.create=function(e,t,r,s,o){if(n.util.isArray(s)){for(var a=[],c=0;c<s.length;++c)void 0!==s[c]&&a.push(s[c]);s=a}var u={tagClass:e,type:t,constructed:r,composed:r||n.util.isArray(s),value:s};return o&&"bitStringContents"in o&&(u.bitStringContents=o.bitStringContents,u.original=i.copy(u)),u},i.copy=function(e,t){var r;if(n.util.isArray(e)){r=[];for(var s=0;s<e.length;++s)r.push(i.copy(e[s],t));return r}return"string"==typeof e?e:(r={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:i.copy(e.value,t)},t&&!t.excludeBitStringContents&&(r.bitStringContents=e.bitStringContents),r)},i.equals=function(e,t,r){if(n.util.isArray(e)){if(!n.util.isArray(t))return!1;if(e.length!==t.length)return!1;for(var s=0;s<e.length;++s)if(!i.equals(e[s],t[s]))return!1;return!0}if(typeof e!=typeof t)return!1;if("string"==typeof e)return e===t;var o=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&i.equals(e.value,t.value);return r&&r.includeBitStringContents&&(o=o&&e.bitStringContents===t.bitStringContents),o},i.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};i.fromDer=function(e,t){return void 0===t&&(t={strict:!0,decodeBitStrings:!0}),"boolean"==typeof t&&(t={strict:t,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"==typeof e&&(e=n.util.createBuffer(e)),function e(t,r,n,o){var a;s(t,r,2);var c=t.getByte();r--;var u=192&c,f=31&c;a=t.length();var h,l,d=function(e,t){var r=e.getByte();if(t--,128!==r){var n;if(128&r){var i=127&r;s(e,t,i),n=e.getInt(i<<3)}else n=r;if(n<0)throw new Error("Negative length: "+n);return n}}(t,r);if(r-=a-t.length(),void 0!==d&&d>r){if(o.strict){var p=new Error("Too few bytes to read ASN.1 value.");throw p.available=t.length(),p.remaining=r,p.requested=d,p}d=r}var b=32==(32&c);if(b)if(h=[],void 0===d)for(;;){if(s(t,r,2),t.bytes(2)===String.fromCharCode(0,0)){t.getBytes(2),r-=2;break}a=t.length(),h.push(e(t,r,n+1,o)),r-=a-t.length()}else for(;d>0;)a=t.length(),h.push(e(t,d,n+1,o)),r-=a-t.length(),d-=a-t.length();void 0===h&&u===i.Class.UNIVERSAL&&f===i.Type.BITSTRING&&(l=t.bytes(d));if(void 0===h&&o.decodeBitStrings&&u===i.Class.UNIVERSAL&&f===i.Type.BITSTRING&&d>1){var y=t.read,m=r,g=0;if(f===i.Type.BITSTRING&&(s(t,r,1),g=t.getByte(),r--),0===g)try{a=t.length();var v={verbose:o.verbose,strict:!0,decodeBitStrings:!0},w=e(t,r,n+1,v),_=a-t.length();r-=_,f==i.Type.BITSTRING&&_++;var E=w.tagClass;_!==d||E!==i.Class.UNIVERSAL&&E!==i.Class.CONTEXT_SPECIFIC||(h=[w])}catch(S){}void 0===h&&(t.read=y,r=m)}if(void 0===h){if(void 0===d){if(o.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");d=r}if(f===i.Type.BMPSTRING)for(h="";d>0;d-=2)s(t,r,2),h+=String.fromCharCode(t.getInt16()),r-=2;else h=t.getBytes(d)}var k=void 0===l?null:{bitStringContents:l};return i.create(u,f,b,h,k)}(e,e.length(),0,t)},i.toDer=function(e){var t=n.util.createBuffer(),r=e.tagClass|e.type,s=n.util.createBuffer(),o=!1;if("bitStringContents"in e&&(o=!0,e.original&&(o=i.equals(e,e.original))),o)s.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:s.putByte(0);for(var a=0;a<e.value.length;++a)void 0!==e.value[a]&&s.putBuffer(i.toDer(e.value[a]))}else if(e.type===i.Type.BMPSTRING)for(a=0;a<e.value.length;++a)s.putInt16(e.value.charCodeAt(a));else e.type===i.Type.INTEGER&&e.value.length>1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?s.putBytes(e.value.substr(1)):s.putBytes(e.value);if(t.putByte(r),s.length()<=127)t.putByte(127&s.length());else{var c=s.length(),u="";do{u+=String.fromCharCode(255&c),c>>>=8}while(c>0);t.putByte(128|u.length);for(a=u.length-1;a>=0;--a)t.putByte(u.charCodeAt(a))}return t.putBuffer(s),t},i.oidToDer=function(e){var t,r,i,s,o=e.split("."),a=n.util.createBuffer();a.putByte(40*parseInt(o[0],10)+parseInt(o[1],10));for(var c=2;c<o.length;++c){t=!0,r=[],i=parseInt(o[c],10);do{s=127&i,i>>>=7,t||(s|=128),r.push(s),t=!1}while(i>0);for(var u=r.length-1;u>=0;--u)a.putByte(r[u])}return a},i.derToOid=function(e){var t;"string"==typeof e&&(e=n.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var i=0;e.length()>0;)i<<=7,128&(r=e.getByte())?i+=127&r:(t+="."+(i+r),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),s=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),a=0;if(e.length>11){var c=e.charAt(10),u=10;"+"!==c&&"-"!==c&&(a=parseInt(e.substr(10,2),10),u+=2)}if(t.setUTCFullYear(r,n,i),t.setUTCHours(s,o,a,0),u&&("+"===(c=e.charAt(u))||"-"===c)){var f=60*parseInt(e.substr(u+1,2),10)+parseInt(e.substr(u+4,2),10);f*=6e4,"+"===c?t.setTime(+t-f):t.setTime(+t+f)}return t},i.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),o=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),c=0,u=0,f=!1;"Z"===e.charAt(e.length-1)&&(f=!0);var h=e.length-5,l=e.charAt(h);"+"!==l&&"-"!==l||(u=60*parseInt(e.substr(h+1,2),10)+parseInt(e.substr(h+4,2),10),u*=6e4,"+"===l&&(u*=-1),f=!0);return"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),f?(t.setUTCFullYear(r,n,i),t.setUTCHours(s,o,a,c),t.setTime(+t+u)):(t.setFullYear(r,n,i),t.setHours(s,o,a,c)),t},i.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},i.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},i.integerToDer=function(e){var t=n.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},i.derToInteger=function(e){"string"==typeof e&&(e=n.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},i.validate=function(e,t,r,s){var o=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)s&&(e.tagClass!==t.tagClass&&s.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&s.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(o=!0,t.value&&n.util.isArray(t.value))for(var a=0,c=0;o&&c<t.value.length;++c)o=t.value[c].optional||!1,e.value[a]&&((o=i.validate(e.value[a],t.value[c],r,s))?++a:t.value[c].optional&&(o=!0)),!o&&s&&s.push("["+t.name+'] Tag class "'+t.tagClass+'", type "'+t.type+'" expected value length "'+t.value.length+'", got "'+e.value.length+'"');if(o&&r)if(t.capture&&(r[t.capture]=e.value),t.captureAsn1&&(r[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(r[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e)if(e.bitStringContents.length<2)r[t.captureBitStringValue]="";else{if(0!==e.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");r[t.captureBitStringValue]=e.bitStringContents.slice(1)}}else s&&s.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');return o};var o=/[^\\u0000-\\u00ff]/;i.prettyPrint=function(e,t,r){var s="";r=r||2,(t=t||0)>0&&(s+="\n");for(var a="",c=0;c<t*r;++c)a+=" ";switch(s+=a+"Tag: ",e.tagClass){case i.Class.UNIVERSAL:s+="Universal:";break;case i.Class.APPLICATION:s+="Application:";break;case i.Class.CONTEXT_SPECIFIC:s+="Context-Specific:";break;case i.Class.PRIVATE:s+="Private:"}if(e.tagClass===i.Class.UNIVERSAL)switch(s+=e.type,e.type){case i.Type.NONE:s+=" (None)";break;case i.Type.BOOLEAN:s+=" (Boolean)";break;case i.Type.INTEGER:s+=" (Integer)";break;case i.Type.BITSTRING:s+=" (Bit string)";break;case i.Type.OCTETSTRING:s+=" (Octet string)";break;case i.Type.NULL:s+=" (Null)";break;case i.Type.OID:s+=" (Object Identifier)";break;case i.Type.ODESC:s+=" (Object Descriptor)";break;case i.Type.EXTERNAL:s+=" (External or Instance of)";break;case i.Type.REAL:s+=" (Real)";break;case i.Type.ENUMERATED:s+=" (Enumerated)";break;case i.Type.EMBEDDED:s+=" (Embedded PDV)";break;case i.Type.UTF8:s+=" (UTF8)";break;case i.Type.ROID:s+=" (Relative Object Identifier)";break;case i.Type.SEQUENCE:s+=" (Sequence)";break;case i.Type.SET:s+=" (Set)";break;case i.Type.PRINTABLESTRING:s+=" (Printable String)";break;case i.Type.IA5String:s+=" (IA5String (ASCII))";break;case i.Type.UTCTIME:s+=" (UTC time)";break;case i.Type.GENERALIZEDTIME:s+=" (Generalized time)";break;case i.Type.BMPSTRING:s+=" (BMP String)"}else s+=e.type;if(s+="\n",s+=a+"Constructed: "+e.constructed+"\n",e.composed){var u=0,f="";for(c=0;c<e.value.length;++c)void 0!==e.value[c]&&(u+=1,f+=i.prettyPrint(e.value[c],t+1,r),c+1<e.value.length&&(f+=","));s+=a+"Sub values: "+u+f}else{if(s+=a+"Value: ",e.type===i.Type.OID){var h=i.derToOid(e.value);s+=h,n.pki&&n.pki.oids&&h in n.pki.oids&&(s+=" ("+n.pki.oids[h]+") ")}if(e.type===i.Type.INTEGER)try{s+=i.derToInteger(e.value)}catch(d){s+="0x"+n.util.bytesToHex(e.value)}else if(e.type===i.Type.BITSTRING){if(e.value.length>1?s+="0x"+n.util.bytesToHex(e.value.slice(1)):s+="(none)",e.value.length>0){var l=e.value.charCodeAt(0);1==l?s+=" (1 unused bit shown)":l>1&&(s+=" ("+l+" unused bits shown)")}}else e.type===i.Type.OCTETSTRING?(o.test(e.value)||(s+="("+e.value+") "),s+="0x"+n.util.bytesToHex(e.value)):e.type===i.Type.UTF8?s+=n.util.decodeUtf8(e.value):e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?s+=e.value:o.test(e.value)?s+="0x"+n.util.bytesToHex(e.value):0===e.value.length?s+="[null]":s+=e.value}return s}},function(e,t,r){"use strict";const n=r(1);e.exports=(e={},t)=>{Array.isArray(e)&&(e=e.filter(e=>"object"==typeof e).pop()||{});const r={};for(const n in t)null!==e[n]&&void 0!==e[n]?r[n]=e[n]:r[n]=t[n];if(void 0!==e.count&&(r.length=e.count),void 0!==e.p&&(r.parents=e.p),void 0!==e.l&&(r.long=e.l),r.length||0===r.length||(r.length=1/0),r.offset<0)throw n(new Error("cannot have negative write offset"),"ERR_INVALID_PARAMS");if(r.length<0)throw n(new Error("cannot have negative byte count"),"ERR_INVALID_PARAMS");return r}},function(e,t,r){"use strict";const n=r(2),i=(e,t,r)=>{let n=0;const i=r.length;for(;n<i;){if(e(t,r[n]))return!0;n+=1}return!1};e.exports={logger:(e,t)=>{const r=["bitswap"];t&&r.push(t),e&&r.push("".concat(e.toB58String().slice(0,8)));const i=n(r.join(":"));return i.error=n(r.concat(["error"]).join(":")),i},includesWith:i,uniqWith:(e,t)=>{let r=0;const n=t.length,s=[];let o;for(;r<n;)o=t[r],i(e,o,s)||(s[s.length]=o),r+=1;return s},groupBy:(e,t)=>t.reduce((t,r)=>{const n=e(r);return t[n]?t[n].push(r):t[n]=[r],t},{}),pullAllWith:(e,t,r)=>t.filter(t=>!i(e,t,r)),sortBy:(e,t)=>Array.prototype.slice.call(t,0).sort((t,r)=>{const n=e(t),i=e(r);return n<i?-1:n>i?1:0}),isMapEqual:(e,t)=>{if(e.size!==t.size)return!1;for(const[r,n]of e){if(!t.has(r))return!1;const e=t.get(r);if("function"==typeof n.equals&&!n.equals(e))return!1;if(n._data&&!n._data.equals(e._data))return!1}return!0}}},function(e,t,r){"use strict";var n=r(5);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){"use strict";var n=r(5);r(73),r(398),r(399),r(9),n.random&&n.random.getBytes?e.exports=n.random:function(t){var r={},i=new Array(4),s=n.util.createBuffer();function o(){var e=n.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),n.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return n.aes._updateBlock(e,t,i,!1),s.putInt32(i[0]),s.putInt32(i[1]),s.putInt32(i[2]),s.putInt32(i[3]),s.getBytes()},r.increment=function(e){return++e[3],e},r.md=n.md.sha256;var a=o(),c=null,u=n.util.globalScope,f=u.crypto||u.msCrypto;if(f&&f.getRandomValues&&(c=function(e){return f.getRandomValues(e)}),n.options.usePureJavaScript||!n.util.isNodejs&&!c){if("undefined"==typeof window||window.document,a.collectInt(+new Date,32),"undefined"!=typeof navigator){var h="";for(var l in navigator)try{"string"==typeof navigator[l]&&(h+=navigator[l])}catch(d){}a.collect(h),h=null}t&&(t().mousemove((function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)})),t().keypress((function(e){a.collectInt(e.charCode,8)})))}if(n.random)for(var l in a)n.random[l]=a[l];else n.random=a;n.random.createInstance=o,e.exports=n.random}("undefined"!=typeof jQuery?jQuery:null)},function(e,t,r){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=n,n.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(451),s=r(220),o=r(15),a=r(58),c=r(4),{URL:u}=r(88),f=/^https?:\/\/[^/]+\/(ip[fn]s)\/([^/?#]+)/,h=/^\/(ip[fn]s)\/([^/?#]+)/,l=/^https?:\/\/([^/]+)\.(ip[fn]s)\.[^/?]+/,d=/^(([a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])\.)+([a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])$/;function p(e){try{return new c(e),!0}catch(t){return!1}}function b(e){if(!e)return!1;if(o.isMultiaddr(e))return!0;try{return new o(e),!0}catch(t){return!1}}function y(e,t,r=1,n=2){const i=v(e);if(!i)return!1;const s=i.match(t);if(!s)return!1;if("ipfs"!==s[r])return!1;let o=s[n];return o&&t===l&&(o=o.toLowerCase()),p(o)}function m(e,t,r=1,n){const i=v(e);if(!i)return!1;const s=i.match(t);if(!s)return!1;if("ipns"!==s[r])return!1;let o=s[n];if(o&&t===l){if(o=o.toLowerCase(),p(o))return!0;try{const{hostname:e}=new u("http://".concat(o));return d.test(e)}catch(a){return!1}}return!0}function g(e){return"string"==typeof e}function v(e){return n.isBuffer(e)?s.encode("base58btc",e).toString().slice(1):!!g(e)&&e}const w=e=>y(e,l,2,1),_=e=>m(e,l,2,1),E=e=>w(e)||_(e),k=e=>y(e,f)||w(e),S=e=>m(e,f)||_(e),A=e=>k(e)||S(e)||E(e),I=e=>y(e,h)||m(e,h);e.exports={multihash:function(e){const t=v(e);try{return i.decode(s.decode("z"+t)),!0}catch(r){return!1}},multiaddr:b,peerMultiaddr:function(e){return b(e)&&a.IPFS.matches(e)},cid:p,base32cid:e=>"base32"===function(e){try{return s.isEncoded(e)}catch(t){return!1}}(e)&&p(e),ipfsSubdomain:w,ipnsSubdomain:_,subdomain:E,subdomainGatewayPattern:l,ipfsUrl:k,ipnsUrl:S,url:A,pathGatewayPattern:f,ipfsPath:e=>y(e,h),ipnsPath:e=>m(e,h),path:I,pathPattern:h,urlOrPath:e=>A(e)||I(e),cidPath:e=>g(e)&&!p(e)&&y("/ipfs/".concat(e),h)}},function(e,t,r){"use strict";e.exports=async e=>{let t;for await(const r of e)t=r;return t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(525),i=r(526),s=r(527),o=()=>{},a=new i.TimeoutError;t.default=class extends n{constructor(e){var t,r,n,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=o,this._resolveIdle=o,!("number"==typeof(e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:s.default},e)).intervalCap&&e.intervalCap>=1))throw new TypeError("Expected `intervalCap` to be a number from 1 and up, got `".concat(null!==(r=null===(t=e.intervalCap)||void 0===t?void 0:t.toString())&&void 0!==r?r:"","` (").concat(typeof e.intervalCap,")"));if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError("Expected `interval` to be a finite number >= 0, got `".concat(null!==(i=null===(n=e.interval)||void 0===n?void 0:n.toString())&&void 0!==i?i:"","` (").concat(typeof e.interval,")"));this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||0===e.interval,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=!0===e.throwOnTimeout,this._isPaused=!1===e.autoStart}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=o,0===this._pendingCount&&(this._resolveIdle(),this._resolveIdle=o,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){const e=Date.now();if(void 0===this._intervalId){const t=this._intervalEnd-e;if(!(t<0))return void 0===this._timeoutId&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval()},t)),!0;this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0}return!1}_tryToStartAnother(){if(0===this._queue.size)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){const e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother)return this.emit("active"),this._queue.dequeue()(),e&&this._initializeIntervalIfNeeded(),!0}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||void 0!==this._intervalId||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){0===this._intervalCount&&0===this._pendingCount&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError("Expected `concurrency` to be a number from 1 and up, got `".concat(e,"` (").concat(typeof e,")"));this._concurrency=e,this._processQueue()}async add(e,t={}){return new Promise((r,n)=>{this._queue.enqueue(async()=>{this._pendingCount++,this._intervalCount++;try{const s=void 0===this._timeout&&void 0===t.timeout?e():i.default(Promise.resolve(e()),void 0===t.timeout?this._timeout:t.timeout,()=>{(void 0===t.throwOnTimeout?this._throwOnTimeout:t.throwOnTimeout)&&n(a)});r(await s)}catch(s){n(s)}this._next()},t),this._tryToStartAnother(),this.emit("add")})}async addAll(e,t){return Promise.all(e.map(async e=>this.add(e,t)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(0!==this._queue.size)return new Promise(e=>{const t=this._resolveEmpty;this._resolveEmpty=()=>{t(),e()}})}async onIdle(){if(0!==this._pendingCount||0!==this._queue.size)return new Promise(e=>{const t=this._resolveIdle;this._resolveIdle=()=>{t(),e()}})}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}}},function(e,t,r){"use strict";const n=r(173),i=r(785),s=(e,t,r)=>o(e,Array.isArray(t)?t:[{signal:t,options:r}]),o=(e,t)=>(e=n(e),t=t.map(({signal:e,options:t})=>({signal:e,options:t||{}})),async function*(){let r;const n=()=>{r&&r()};for(const{signal:e}of t)e.addEventListener("abort",n);for(;;){let o;try{for(const{signal:e,options:r}of t)if(e.aborted){const{abortMessage:e,abortCode:t}=r;throw new i(e,t)}const n=new Promise((e,n)=>{r=()=>{const{options:e}=t.find(({signal:e})=>e.aborted),{abortMessage:r,abortCode:s}=e;n(new i(r,s))}});o=await Promise.race([n,e.next()]),r=null}catch(s){for(const{signal:e}of t)e.removeEventListener("abort",n);const r=t.find(({signal:e})=>e.aborted),i="aborted"===s.type&&r;if(i&&r.options.onAbort&&await r.options.onAbort(e),"function"==typeof e.return&&await e.return(),i&&r.options.returnOnAbort)return;throw s}if(o.done)break;yield o.value}for(const{signal:e}of t)e.removeEventListener("abort",n)}()),a=(e,t,r)=>c(e,Array.isArray(t)?t:[{signal:t,options:r}]),c=(e,t)=>r=>e(o(r,t)),u=(e,t)=>({sink:c(e.sink,t),source:o(e.source,t)});e.exports=s,e.exports.AbortError=i,e.exports.source=s,e.exports.sink=a,e.exports.transform=a,e.exports.duplex=(e,t,r)=>u(e,Array.isArray(t)?t:[{signal:t,options:r}])},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateKeypair=function(){const e=i.default.privateKeyGenerate();return{publicKey:i.default.publicKeyCreate(e),privateKey:e}},t.getPayload=async function(e,t,r){const n=await l(e,d(t)),i=r||o.Buffer.alloc(0);return await h(e.marshalPubKey(),n,i)},t.createHandshakePayload=h,t.signPayload=l,t.getPeerIdFromPayload=async function(e){return await a.default.createFromPubKey(o.Buffer.from(e.identityKey))},t.decodePayload=async function(e){return f.toObject(f.decode(o.Buffer.from(e)))},t.getHandshakePayload=d,t.verifySignedPayload=async function(e,t,r){const n=o.Buffer.from(t.identityKey);if(!await async function(e,t){return(await a.default.createFromPubKey(t)).id.equals(e)}(r.id,n))throw new Error("Peer ID doesn't match libp2p public key.");const i=d(e),s=c.keys.unmarshalPublicKey(n);if(!t.identitySig||!s.verify(i,o.Buffer.from(t.identitySig)))throw new Error("Static key doesn't match to peer that signed payload!");return a.default.createFromPubKey(n)},t.getHkdf=function(e,t){const r=o.Buffer.alloc(0),i=n.default.extract(s.default,t,e),a=n.default.expand(s.default,i,r,96),c=a.slice(0,32),u=a.slice(32,64),f=a.slice(64,96);return[c,u,f]},t.isValidPublicKey=function(e){return i.default.publicKeyVerify(e.slice(0,32))};var n=u(r(910)),i=u(r(188)),s=u(r(350)),o=r(0),a=u(r(6)),c=r(28);function u(e){return e&&e.__esModule?e:{default:e}}const f=r(912).pb.NoiseHandshakePayload;async function h(e,t,r){const n=f.create({identityKey:e,identitySig:t,data:r||null});return o.Buffer.from(f.encode(n).finish())}async function l(e,t){return e.privKey.sign(t)}function d(e){return o.Buffer.concat([o.Buffer.from("noise-libp2p-static-key:"),e])}},function(e,t,r){"use strict";(function(e){var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function s(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&i(this,r)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}n.asPromise=r(915),n.base64=r(916),n.EventEmitter=r(917),n.float=r(918),n.inquire=r(919),n.utf8=r(920),n.pool=r(921),n.LongBits=r(922),n.global="undefined"!=typeof window&&window||void 0!==e&&e||"undefined"!=typeof self&&self||void 0,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isNode=Boolean(n.global.process&&n.global.process.versions&&n.global.process.versions.node),n.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"==typeof e||e instanceof String},n.isObject=function(e){return e&&"object"==typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"==typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=s,n.ProtocolError=s("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}}).call(this,r(10))},function(e,t,r){"use strict";const n=t.second=1e3,i=t.minute=60*n,s=t.hour=60*i;t.MAX_RECORD_AGE=36*s,t.PROTOCOL_DHT="/ipfs/kad/1.0.0",t.PROVIDERS_KEY_PREFIX="/providers/",t.PROVIDERS_LRU_CACHE_SIZE=256,t.PROVIDERS_VALIDITY=24*s,t.PROVIDERS_CLEANUP_INTERVAL=s,t.READ_MESSAGE_TIMEOUT=10*n,t.GET_MANY_RECORD_COUNT=16,t.K=20,t.ALPHA=3,t.defaultRandomWalk={enabled:!0,queriesPerPeriod:1,interval:5*i,timeout:10*n,delay:10*n}},function(e,t,r){"use strict";const n=r(4),i=r(1),{Buffer:s}=r(0),{withTimeoutOption:o}=r(3);e.exports=({ipld:e,preload:t})=>o((async function(r,o){let a,c;o=o||{};try{a=function(e,t){if("string"==typeof e)return"base58"!==t&&t?s.from(e,t):e;if(s.isBuffer(e))return e;if(n.isCID(e))return e.buffer;throw new Error("unsupported multihash")}(r,o.enc)}catch(u){throw i(u,"ERR_INVALID_MULTIHASH")}try{c=new n(a)}catch(u){throw i(u,"ERR_INVALID_CID")}return 1===o.cidVersion&&(c=c.toV1()),!1!==o.preload&&t(c),e.get(c,{signal:o.signal})}))},function(e,t,r){"use strict";"object"!=typeof globalThis&&(Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__),e.exports=globalThis},function(e,t,r){"use strict";const n=r(15),i=R("dns4"),s=R("dns6"),o=T(R("dns"),R("dnsaddr"),i,s),a=T(R("ip4"),R("ip6")),c=T(I(a,R("tcp")),I(o,R("tcp"))),u=I(a,R("udp")),f=I(u,R("utp")),h=T(I(c,R("ws")),I(o,R("ws"))),l=T(I(c,R("wss")),I(o,R("wss"))),d=T(I(c,R("http")),I(a,R("http")),I(o,R("http"))),p=T(I(c,R("https")),I(a,R("https")),I(o,R("https"))),b=T(I(h,R("p2p-webrtc-star"),R("p2p")),I(l,R("p2p-webrtc-star"),R("p2p")),I(h,R("p2p-webrtc-star")),I(l,R("p2p-webrtc-star"))),y=T(I(h,R("p2p-websocket-star"),R("p2p")),I(l,R("p2p-websocket-star"),R("p2p")),I(h,R("p2p-websocket-star")),I(l,R("p2p-websocket-star"))),m=T(I(d,R("p2p-webrtc-direct")),I(p,R("p2p-webrtc-direct"))),g=T(h,l,d,p,b,m,c,f),v=T(I(g,R("p2p-stardust"),R("p2p")),I(g,R("p2p-stardust"))),w=T(I(g,R("p2p")),b,R("p2p")),_=T(I(w,R("p2p-circuit"),w),I(w,R("p2p-circuit")),I(R("p2p-circuit"),w),I(g,R("p2p-circuit")),I(R("p2p-circuit"),g),R("p2p-circuit")),E=()=>T(I(_,E),_),k=E(),S=T(I(k,w,k),I(w,k),I(k,w),k,w);function A(e){return function(t){if(!n.isMultiaddr(t))try{t=n(t)}catch(i){return!1}const r=e(t.protoNames());return null!==r&&0===r.length}}function I(){const e=Array.from(arguments);function t(t){return t.length<e.length?null:(e.some(e=>{if(null===(t="function"==typeof e?e().partialMatch(t):e.partialMatch(t)))return!0}),t)}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:A(t),partialMatch:t}}function T(){const e=Array.from(arguments);function t(t){let r=null;return e.some(e=>{const n="function"==typeof e?e().partialMatch(t):e.partialMatch(t);if(n)return r=n,!0}),r}const r={toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:A(t),partialMatch:t};return r}function R(e){const t=e;return{toString:function(){return t},matches:function(e){if("string"==typeof e)try{e=n(e)}catch(i){return!1}const r=e.protoNames();return 1===r.length&&r[0]===t},partialMatch:function(e){return 0===e.length?null:e[0]===t?e.slice(1):null}}}t.DNS=o,t.DNS4=i,t.DNS6=s,t.IP=a,t.TCP=c,t.UDP=u,t.UTP=f,t.HTTP=d,t.HTTPS=p,t.WebSockets=h,t.WebSocketsSecure=l,t.WebSocketStar=y,t.WebRTCStar=b,t.WebRTCDirect=m,t.Reliable=g,t.Stardust=v,t.Circuit=k,t.P2P=S,t.IPFS=S},function(e,t,r){"use strict";const n=r(130),i=r(4);e.exports=async(e,t,r)=>{r.codec||(r.codec="dag-pb"),r.cidVersion||(r.cidVersion=0),r.hashAlg||(r.hashAlg="sha2-256"),"sha2-256"!==r.hashAlg&&(r.cidVersion=1);const s=await n(e,r.hashAlg),o=new i(r.cidVersion,r.codec,s);return r.onlyHash||await t.put(e,{...r,cid:o}),o}},function(e,t,r){"use strict";const n=r(4),i=r(21),{Buffer:s}=r(0);e.exports=i(class{constructor(e,t,r){if(!r)throw new Error("A link requires a cid to point to");this._name=e||"",this._nameBuf=null,this._size=t,this._cid=new n(r)}toString(){return"DAGLink <".concat(this._cid.toBaseEncodedString(),' - name: "').concat(this.Name,'", size: ').concat(this.Tsize,">")}toJSON(){return this._json||(this._json=Object.freeze({name:this.Name,size:this.Tsize,cid:this.Hash.toBaseEncodedString()})),Object.assign({},this._json)}get Name(){return this._name}get nameAsBuffer(){return null!==this._nameBuf||(this._nameBuf=s.from(this._name)),this._nameBuf}set Name(e){throw new Error("Can't set property: 'name' is immutable")}get Tsize(){return this._size}set Tsize(e){throw new Error("Can't set property: 'size' is immutable")}get Hash(){return this._cid}set Hash(e){throw new Error("Can't set property: 'cid' is immutable")}},{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"})},function(e,t,r){"use strict";const{DAGLink:n,DAGNode:i}=r(12),s=r(4),o=r(2)("ipfs:mfs:core:utils:add-link"),a=r(23),c=r(133),{updateHamtDirectory:u,recreateHamtLevel:f,createShard:h,toPrefix:l,addLinksToHamtBucket:d}=r(260),p=r(1),b=r(11),y=r(22).multihash,m=r(50),g=async(e,t)=>{const r=await h(e,t.parent.Links.map(e=>({name:e.Name,size:e.Tsize,cid:e.Hash})).concat({name:t.name,size:t.size,cid:t.cid}),t);return o("Converted directory to sharded directory ".concat(r.cid)),r},v=async(e,t)=>{t.parent.rmLink(t.name),t.parent.addLink(new n(t.name,t.size,t.cid));const r=a.unmarshal(t.parent.Data);r.mtime&&(r.mtime=new Date,t.parent=new i(r.marshal(),t.parent.Links));const s=y.names[t.hashAlg],o=await e.ipld.put(t.parent,b.DAG_PB,{cidVersion:t.cidVersion,hashAlg:s,onlyHash:!t.flush});return{node:t.parent,cid:o,size:t.parent.size}},w=async(e,t)=>{const{shard:r,path:n}=await _(e,t),i=await m(r.flush("",e.block)),s=await e.ipld.get(i.cid),o=t.parent.Links.find(e=>e.Name.substring(0,2)===n[0].prefix),a=s.Links.find(e=>e.Name.substring(0,2)===n[0].prefix);return o&&t.parent.rmLink(o.Name),t.parent.addLink(a),u(e,t.parent.Links,n[0].bucket,t)},_=async(e,t)=>{const r={name:t.name,cid:t.cid,size:t.size},n=await f(t.parent.Links),i=a.unmarshal(t.parent.Data),s=new c({root:!0,dir:!0,parent:null,parentKey:null,path:"",dirty:!0,flat:!1,mode:i.mode},t);s._bucket=n,i.mtime&&(s.mtime=new Date);const u=await n._findNewBucketAndPos(r.name),h=E(u);h[0].node=t.parent;let p=0;for(;p<h.length;){const t=h[p];p++;const i=t.node.Links.find(e=>e.Name.substring(0,2)===t.prefix);if(!i){o("Link ".concat(t.prefix).concat(r.name," will be added")),p=h.length;break}if(i.Name==="".concat(t.prefix).concat(r.name)){o("Link ".concat(t.prefix).concat(r.name," will be replaced")),p=h.length;break}if(i.Name.length>2){o("Link ".concat(i.Name," ").concat(i.Hash," will be replaced with a subshard")),p=h.length;break}o("Found subshard ".concat(t.prefix));const s=await e.ipld.get(i.Hash);if(!h[p]){o("Loaded new subshard ".concat(t.prefix)),await f(s.Links,n,t.bucket,parseInt(t.prefix,16));const e=await n._findNewBucketAndPos(r.name);h.push({bucket:e.bucket,prefix:l(e.pos),node:s});break}const a=h[p];await d(s.Links,a.bucket,n),a.node=s}return await s._bucket.put(r.name,{size:r.size,cid:r.cid}),{shard:s,path:h}},E=e=>{let t=e.bucket,r=e.pos;const n=[{bucket:t,prefix:l(r)}];for(t=e.bucket._parent,r=e.bucket._posAtParent;t;)n.push({bucket:t,prefix:l(r)}),r=t._posAtParent,t=t._parent;return n.reverse(),n};e.exports=async(e,t)=>{if(!t.parentCid&&!t.parent)throw p(new Error("No parent node or CID passed to addLink"),"EINVALIDPARENT");if(t.parentCid&&!s.isCID(t.parentCid))throw p(new Error("Invalid CID passed to addLink"),"EINVALIDPARENTCID");if(t.parent||(o("Loading parent node ".concat(t.parentCid)),t.parent=await e.ipld.get(t.parentCid)),!t.cid)throw p(new Error("No child cid passed to addLink"),"EINVALIDCHILDCID");if(!t.name)throw p(new Error("No child name passed to addLink"),"EINVALIDCHILDNAME");if(s.isCID(t.cid)||(t.cid=new s(t.cid)),!t.size&&0!==t.size)throw p(new Error("No child size passed to addLink"),"EINVALIDCHILDSIZE");const r=a.unmarshal(t.parent.Data);return"hamt-sharded-directory"===r.type?(o("Adding link to sharded directory"),w(e,t)):t.parent.Links.length>=t.shardSplitThreshold?(o("Converting directory to sharded directory"),g(e,{...t,mtime:r.mtime,mode:r.mode})):(o("Adding ".concat(t.name," (").concat(t.cid,") to regular directory")),v(e,t))}},function(e,t,r){"use strict";const n=r(2)("ipfs:mfs:utils:update-tree"),i=r(61),s={shardSplitThreshold:1e3};e.exports=async(e,t,r)=>{r=Object.assign({},s,r),n("Trail",t),t=t.slice().reverse();let o,a=0;for await(const n of e.ipld.getMany(t.map(e=>e.cid))){const s=t[a].cid,c=t[a].name;if(a++,!o){o={cid:s,name:c,size:n.size};continue}const u=await i(e,{parent:n,name:o.name,cid:o.cid,size:o.size,flush:r.flush,shardSplitThreshold:r.shardSplitThreshold,hashAlg:r.hashAlg,cidVersion:r.cidVersion});o={cid:u.cid,name:c,size:u.size}}return n("Final CID ".concat(o.cid)),o.cid}},function(e,t,r){"use strict";const n=r(2)("ipfs:mfs:utils:update-mfs-root"),{MFS_ROOT_KEY:i}=r(3),s=r(1);e.exports=async(e,t,r)=>{if(r&&r.signal&&r.signal.aborted)throw s(new Error("Request aborted"),"ERR_ABORTED",{name:"Aborted"});return n("New MFS root will be ".concat(t)),await e.repo.datastore.put(i,t.buffer),t}},function(e,t,r){"use strict";e.exports=function(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var i in r)n.call(r,i)&&(e[i]=r[i])}return e};var n=Object.prototype.hasOwnProperty},function(e,t,r){"use strict";var n={};function i(e,t,r){r||(r=Error);var i=function(e){var r,n;function i(r,n,i){return e.call(this,function(e,r,n){return"string"==typeof t?t:t(e,r,n)}(r,n,i))||this}return n=e,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=e,n[e]=i}function s(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}i("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(e,t,r){var n,i,o,a;if("string"==typeof t&&(i="not ",t.substr(!o||o<0?0:+o,i.length)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))a="The ".concat(e," ").concat(n," ").concat(s(t,"type"));else{var c=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";a='The "'.concat(e,'" ').concat(c," ").concat(n," ").concat(s(t,"type"))}return a+=". Received type ".concat(typeof r)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=n},function(e,t,r){"use strict";(function(t){var n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=u;var i=r(269),s=r(273);r(24)(u,i);for(var o=n(s.prototype),a=0;a<o.length;a++){var c=o[a];u.prototype[c]||(u.prototype[c]=s.prototype[c])}function u(e){if(!(this instanceof u))return new u(e);i.call(this,e),s.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",f)))}function f(){this._writableState.ended||t.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(u.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(u.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})}).call(this,r(8))},function(e,t,r){"use strict";const n=r(4),i=r(21),{Buffer:s}=r(0);e.exports=i(class{constructor(e,t,r){if(!r)throw new Error("A link requires a cid to point to");Object.defineProperties(this,{Name:{value:e||"",writable:!1,enumerable:!0},Tsize:{value:t,writable:!1,enumerable:!0},Hash:{value:new n(r),writable:!1,enumerable:!0},_nameBuf:{value:null,writable:!0,enumerable:!1}})}toString(){return"DAGLink <".concat(this.Hash.toBaseEncodedString(),' - name: "').concat(this.Name,'", size: ').concat(this.Tsize,">")}toJSON(){return this._json||(this._json=Object.freeze({name:this.Name,size:this.Tsize,cid:this.Hash.toBaseEncodedString()})),Object.assign({},this._json)}get nameAsBuffer(){return null!==this._nameBuf||(this._nameBuf=s.from(this.Name)),this._nameBuf}},{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"})},function(e,t,r){"use strict";e.exports={Record:r(711),validator:r(714),selection:r(727)}},function(e,t,r){"use strict";var n,i=r(877),s=r(335),o=r(879),a=r(880),c=r(881);"undefined"!=typeof ArrayBuffer&&(n=r(882));var u="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),f="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),h=u||f;t.protocol=3;var l=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},d=i(l),p={type:"error",data:"parser error"},b=r(883);function y(e,t,r){for(var n=new Array(e.length),i=a(e.length,r),s=function(e,r,i){t(r,(function(t,r){n[e]=r,i(t,n)}))},o=0;o<e.length;o++)s(o,e[o],i)}t.encodePacket=function(e,r,n,i){"function"==typeof r&&(i=r,r=!1),"function"==typeof n&&(i=n,n=null);var s=void 0===e.data?void 0:e.data.buffer||e.data;if("undefined"!=typeof ArrayBuffer&&s instanceof ArrayBuffer)return function(e,r,n){if(!r)return t.encodeBase64Packet(e,n);var i=e.data,s=new Uint8Array(i),o=new Uint8Array(1+i.byteLength);o[0]=l[e.type];for(var a=0;a<s.length;a++)o[a+1]=s[a];return n(o.buffer)}(e,r,i);if(void 0!==b&&s instanceof b)return function(e,r,n){if(!r)return t.encodeBase64Packet(e,n);if(h)return function(e,r,n){if(!r)return t.encodeBase64Packet(e,n);var i=new FileReader;return i.onload=function(){t.encodePacket({type:e.type,data:i.result},r,!0,n)},i.readAsArrayBuffer(e.data)}(e,r,n);var i=new Uint8Array(1);i[0]=l[e.type];var s=new b([i.buffer,e.data]);return n(s)}(e,r,i);if(s&&s.base64)return function(e,r){var n="b"+t.packets[e.type]+e.data.data;return r(n)}(e,i);var o=l[e.type];return void 0!==e.data&&(o+=n?c.encode(String(e.data),{strict:!1}):String(e.data)),i(""+o)},t.encodeBase64Packet=function(e,r){var n,i="b"+t.packets[e.type];if(void 0!==b&&e.data instanceof b){var s=new FileReader;return s.onload=function(){var e=s.result.split(",")[1];r(i+e)},s.readAsDataURL(e.data)}try{n=String.fromCharCode.apply(null,new Uint8Array(e.data))}catch(u){for(var o=new Uint8Array(e.data),a=new Array(o.length),c=0;c<o.length;c++)a[c]=o[c];n=String.fromCharCode.apply(null,a)}return i+=btoa(n),r(i)},t.decodePacket=function(e,r,n){if(void 0===e)return p;if("string"==typeof e){if("b"===e.charAt(0))return t.decodeBase64Packet(e.substr(1),r);if(n&&!1===(e=function(e){try{e=c.decode(e,{strict:!1})}catch(t){return!1}return e}(e)))return p;var i=e.charAt(0);return Number(i)==i&&d[i]?e.length>1?{type:d[i],data:e.substring(1)}:{type:d[i]}:p}i=new Uint8Array(e)[0];var s=o(e,1);return b&&"blob"===r&&(s=new b([s])),{type:d[i],data:s}},t.decodeBase64Packet=function(e,t){var r=d[e.charAt(0)];if(!n)return{type:r,data:{base64:!0,data:e.substr(1)}};var i=n.decode(e.substr(1));return"blob"===t&&b&&(i=new b([i])),{type:r,data:i}},t.encodePayload=function(e,r,n){"function"==typeof r&&(n=r,r=null);var i=s(e);if(r&&i)return b&&!h?t.encodePayloadAsBlob(e,n):t.encodePayloadAsArrayBuffer(e,n);if(!e.length)return n("0:");y(e,(function(e,n){t.encodePacket(e,!!i&&r,!1,(function(e){n(null,function(e){return e.length+":"+e}(e))}))}),(function(e,t){return n(t.join(""))}))},t.decodePayload=function(e,r,n){if("string"!=typeof e)return t.decodePayloadAsBinary(e,r,n);var i;if("function"==typeof r&&(n=r,r=null),""===e)return n(p,0,1);for(var s,o,a="",c=0,u=e.length;c<u;c++){var f=e.charAt(c);if(":"===f){if(""===a||a!=(s=Number(a)))return n(p,0,1);if(a!=(o=e.substr(c+1,s)).length)return n(p,0,1);if(o.length){if(i=t.decodePacket(o,r,!1),p.type===i.type&&p.data===i.data)return n(p,0,1);if(!1===n(i,c+s,u))return}c+=s,a=""}else a+=f}return""!==a?n(p,0,1):void 0},t.encodePayloadAsArrayBuffer=function(e,r){if(!e.length)return r(new ArrayBuffer(0));y(e,(function(e,r){t.encodePacket(e,!0,!0,(function(e){return r(null,e)}))}),(function(e,t){var n=t.reduce((function(e,t){var r;return e+(r="string"==typeof t?t.length:t.byteLength).toString().length+r+2}),0),i=new Uint8Array(n),s=0;return t.forEach((function(e){var t="string"==typeof e,r=e;if(t){for(var n=new Uint8Array(e.length),o=0;o<e.length;o++)n[o]=e.charCodeAt(o);r=n.buffer}i[s++]=t?0:1;var a=r.byteLength.toString();for(o=0;o<a.length;o++)i[s++]=parseInt(a[o]);i[s++]=255;for(n=new Uint8Array(r),o=0;o<n.length;o++)i[s++]=n[o]})),r(i.buffer)}))},t.encodePayloadAsBlob=function(e,r){y(e,(function(e,r){t.encodePacket(e,!0,!0,(function(e){var t=new Uint8Array(1);if(t[0]=1,"string"==typeof e){for(var n=new Uint8Array(e.length),i=0;i<e.length;i++)n[i]=e.charCodeAt(i);e=n.buffer,t[0]=0}var s=(e instanceof ArrayBuffer?e.byteLength:e.size).toString(),o=new Uint8Array(s.length+1);for(i=0;i<s.length;i++)o[i]=parseInt(s[i]);if(o[s.length]=255,b){var a=new b([t.buffer,o.buffer,e]);r(null,a)}}))}),(function(e,t){return r(new b(t))}))},t.decodePayloadAsBinary=function(e,r,n){"function"==typeof r&&(n=r,r=null);for(var i=e,s=[];i.byteLength>0;){for(var a=new Uint8Array(i),c=0===a[0],u="",f=1;255!==a[f];f++){if(u.length>310)return n(p,0,1);u+=a[f]}i=o(i,2+u.length),u=parseInt(u);var h=o(i,0,u);if(c)try{h=String.fromCharCode.apply(null,new Uint8Array(h))}catch(b){var l=new Uint8Array(h);h="";for(f=0;f<l.length;f++)h+=String.fromCharCode(l[f])}s.push(h),i=o(i,u)}var d=s.length;s.forEach((function(e,i){n(t.decodePacket(e,r,!0),i,d)}))}},function(e,t,r){"use strict";const n=r(41);function i(e){const t=new n;function r(){t.abort();for(const t of e)t&&t.removeEventListener&&t.removeEventListener("abort",r)}for(const n of e)if(n&&n.addEventListener){if(n.aborted){r();break}n.addEventListener("abort",r)}return t.signal}e.exports=i,e.exports.anySignal=i},function(e){e.exports=JSON.parse('{"identity":0,"ip4":4,"tcp":6,"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,"blake3":30,"dccp":33,"murmur3-128":34,"murmur3-32":35,"ip6":41,"ip6zone":42,"path":47,"multicodec":48,"multihash":49,"multiaddr":50,"multibase":51,"dns":53,"dns4":54,"dns6":55,"dnsaddr":56,"protobuf":80,"cbor":81,"raw":85,"dbl-sha2-256":86,"rlp":96,"bencode":99,"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,"sctp":132,"dag-jose":133,"dag-cose":134,"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,"bitcoin-witness-commitment":178,"zcash-block":192,"zcash-tx":193,"stellar-block":208,"stellar-tx":209,"md4":212,"md5":213,"bmt":214,"decred-block":224,"decred-tx":225,"ipld-ns":226,"ipfs-ns":227,"swarm-ns":228,"ipns-ns":229,"zeronet":230,"secp256k1-pub":231,"bls12_381-g1-pub":234,"bls12_381-g2-pub":235,"x25519-pub":236,"ed25519-pub":237,"dash-block":240,"dash-tx":241,"swarm-manifest":250,"swarm-feed":251,"udp":273,"p2p-webrtc-star":275,"p2p-webrtc-direct":276,"p2p-stardust":277,"p2p-circuit":290,"dag-json":297,"udt":301,"utp":302,"unix":400,"p2p":421,"ipfs":421,"https":443,"onion":444,"onion3":445,"garlic64":446,"garlic32":447,"tls":448,"quic":460,"ws":477,"wss":478,"p2p-websocket-star":479,"http":480,"json":512,"messagepack":513,"libp2p-peer-record":769,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,"x11":4352,"sm3-256":21325,"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":46000,"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,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082,"zeroxcert-imprint-256":52753,"fil-commitment-unsealed":61697,"fil-commitment-sealed":61698,"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,r){"use strict";var n=r(5);n.pki=n.pki||{};var i=e.exports=n.pki.oids=n.oids=n.oids||{};function s(e,t){i[e]=t,i[t]=e}function o(e,t){i[e]=t}s("1.2.840.113549.1.1.1","rsaEncryption"),s("1.2.840.113549.1.1.4","md5WithRSAEncryption"),s("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),s("1.2.840.113549.1.1.7","RSAES-OAEP"),s("1.2.840.113549.1.1.8","mgf1"),s("1.2.840.113549.1.1.9","pSpecified"),s("1.2.840.113549.1.1.10","RSASSA-PSS"),s("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),s("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),s("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),s("1.3.101.112","EdDSA25519"),s("1.2.840.10040.4.3","dsa-with-sha1"),s("1.3.14.3.2.7","desCBC"),s("1.3.14.3.2.26","sha1"),s("2.16.840.1.101.3.4.2.1","sha256"),s("2.16.840.1.101.3.4.2.2","sha384"),s("2.16.840.1.101.3.4.2.3","sha512"),s("1.2.840.113549.2.5","md5"),s("1.2.840.113549.1.7.1","data"),s("1.2.840.113549.1.7.2","signedData"),s("1.2.840.113549.1.7.3","envelopedData"),s("1.2.840.113549.1.7.4","signedAndEnvelopedData"),s("1.2.840.113549.1.7.5","digestedData"),s("1.2.840.113549.1.7.6","encryptedData"),s("1.2.840.113549.1.9.1","emailAddress"),s("1.2.840.113549.1.9.2","unstructuredName"),s("1.2.840.113549.1.9.3","contentType"),s("1.2.840.113549.1.9.4","messageDigest"),s("1.2.840.113549.1.9.5","signingTime"),s("1.2.840.113549.1.9.6","counterSignature"),s("1.2.840.113549.1.9.7","challengePassword"),s("1.2.840.113549.1.9.8","unstructuredAddress"),s("1.2.840.113549.1.9.14","extensionRequest"),s("1.2.840.113549.1.9.20","friendlyName"),s("1.2.840.113549.1.9.21","localKeyId"),s("1.2.840.113549.1.9.22.1","x509Certificate"),s("1.2.840.113549.1.12.10.1.1","keyBag"),s("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),s("1.2.840.113549.1.12.10.1.3","certBag"),s("1.2.840.113549.1.12.10.1.4","crlBag"),s("1.2.840.113549.1.12.10.1.5","secretBag"),s("1.2.840.113549.1.12.10.1.6","safeContentsBag"),s("1.2.840.113549.1.5.13","pkcs5PBES2"),s("1.2.840.113549.1.5.12","pkcs5PBKDF2"),s("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),s("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),s("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),s("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),s("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),s("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),s("1.2.840.113549.2.7","hmacWithSHA1"),s("1.2.840.113549.2.8","hmacWithSHA224"),s("1.2.840.113549.2.9","hmacWithSHA256"),s("1.2.840.113549.2.10","hmacWithSHA384"),s("1.2.840.113549.2.11","hmacWithSHA512"),s("1.2.840.113549.3.7","des-EDE3-CBC"),s("2.16.840.1.101.3.4.1.2","aes128-CBC"),s("2.16.840.1.101.3.4.1.22","aes192-CBC"),s("2.16.840.1.101.3.4.1.42","aes256-CBC"),s("2.5.4.3","commonName"),s("2.5.4.5","serialName"),s("2.5.4.6","countryName"),s("2.5.4.7","localityName"),s("2.5.4.8","stateOrProvinceName"),s("2.5.4.9","streetAddress"),s("2.5.4.10","organizationName"),s("2.5.4.11","organizationalUnitName"),s("2.5.4.13","description"),s("2.5.4.15","businessCategory"),s("2.5.4.17","postalCode"),s("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),s("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),s("2.16.840.1.113730.1.1","nsCertType"),s("2.16.840.1.113730.1.13","nsComment"),o("2.5.29.1","authorityKeyIdentifier"),o("2.5.29.2","keyAttributes"),o("2.5.29.3","certificatePolicies"),o("2.5.29.4","keyUsageRestriction"),o("2.5.29.5","policyMapping"),o("2.5.29.6","subtreesConstraint"),o("2.5.29.7","subjectAltName"),o("2.5.29.8","issuerAltName"),o("2.5.29.9","subjectDirectoryAttributes"),o("2.5.29.10","basicConstraints"),o("2.5.29.11","nameConstraints"),o("2.5.29.12","policyConstraints"),o("2.5.29.13","basicConstraints"),s("2.5.29.14","subjectKeyIdentifier"),s("2.5.29.15","keyUsage"),o("2.5.29.16","privateKeyUsagePeriod"),s("2.5.29.17","subjectAltName"),s("2.5.29.18","issuerAltName"),s("2.5.29.19","basicConstraints"),o("2.5.29.20","cRLNumber"),o("2.5.29.21","cRLReason"),o("2.5.29.22","expirationDate"),o("2.5.29.23","instructionCode"),o("2.5.29.24","invalidityDate"),o("2.5.29.25","cRLDistributionPoints"),o("2.5.29.26","issuingDistributionPoint"),o("2.5.29.27","deltaCRLIndicator"),o("2.5.29.28","issuingDistributionPoint"),o("2.5.29.29","certificateIssuer"),o("2.5.29.30","nameConstraints"),s("2.5.29.31","cRLDistributionPoints"),s("2.5.29.32","certificatePolicies"),o("2.5.29.33","policyMappings"),o("2.5.29.34","policyConstraints"),s("2.5.29.35","authorityKeyIdentifier"),o("2.5.29.36","policyConstraints"),s("2.5.29.37","extKeyUsage"),o("2.5.29.46","freshestCRL"),o("2.5.29.54","inhibitAnyPolicy"),s("1.3.6.1.4.1.11129.2.4.2","timestampList"),s("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),s("1.3.6.1.5.5.7.3.1","serverAuth"),s("1.3.6.1.5.5.7.3.2","clientAuth"),s("1.3.6.1.5.5.7.3.3","codeSigning"),s("1.3.6.1.5.5.7.3.4","emailProtection"),s("1.3.6.1.5.5.7.3.8","timeStamping")},function(e,t,r){"use strict";var n=r(5);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.aes.Algorithm(e,t)}))}r(203),r(204),r(9),e.exports=n.aes=n.aes||{},n.aes.startEncrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},n.aes.createEncryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!1,mode:t})},n.aes.startDecrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},n.aes.createDecryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!0,mode:t})},n.aes.Algorithm=function(e,t){f||h();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return d(r._w,e,t,!1)},decrypt:function(e,t){return d(r._w,e,t,!0)}}}),r._init=!1},n.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(n.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=n.util.createBuffer();for(var i=0;i<t.length;++i)r.putByte(t[i])}}else r=n.util.createBuffer(r);if(!n.util.isArray(r)){t=r,r=[];var s=t.length();if(16===s||24===s||32===s){s>>>=2;for(i=0;i<s;++i)r.push(t.getInt32())}}if(!n.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var o=this.mode.name,a=-1!==["CFB","OFB","CTR","GCM"].indexOf(o);this._w=l(r,e.decrypt&&!a),this._init=!0}},n.aes._expandKey=function(e,t){return f||h(),l(e,t)},n.aes._updateBlock=d,i("AES-ECB",n.cipher.modes.ecb),i("AES-CBC",n.cipher.modes.cbc),i("AES-CFB",n.cipher.modes.cfb),i("AES-OFB",n.cipher.modes.ofb),i("AES-CTR",n.cipher.modes.ctr),i("AES-GCM",n.cipher.modes.gcm);var s,o,a,c,u,f=!1;function h(){f=!0,a=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;s=new Array(256),o=new Array(256),c=new Array(4),u=new Array(4);for(t=0;t<4;++t)c[t]=new Array(256),u[t]=new Array(256);var r,n,i,h,l,d,p,b=0,y=0;for(t=0;t<256;++t){h=(h=y^y<<1^y<<2^y<<3^y<<4)>>8^255&h^99,s[b]=h,o[h]=b,d=(l=e[h])<<24^h<<16^h<<8^h^l,p=((r=e[b])^(n=e[r])^(i=e[n]))<<24^(b^i)<<16^(b^n^i)<<8^b^r^i;for(var m=0;m<4;++m)c[m][b]=d,u[m][h]=p,d=d<<24|d>>>8,p=p<<24|p>>>8;0===b?b=y=1:(b=r^e[e[e[r^i]]],y^=e[e[y]])}}function l(e,t){for(var r,n=e.slice(0),i=1,o=n.length,c=4*(o+6+1),f=o;f<c;++f)r=n[f-1],f%o==0?(r=s[r>>>16&255]<<24^s[r>>>8&255]<<16^s[255&r]<<8^s[r>>>24]^a[i]<<24,i++):o>6&&f%o==4&&(r=s[r>>>24]<<24^s[r>>>16&255]<<16^s[r>>>8&255]<<8^s[255&r]),n[f]=n[f-o]^r;if(t){for(var h,l=u[0],d=u[1],p=u[2],b=u[3],y=n.slice(0),m=(f=0,(c=n.length)-4);f<c;f+=4,m-=4)if(0===f||f===c-4)y[f]=n[m],y[f+1]=n[m+3],y[f+2]=n[m+2],y[f+3]=n[m+1];else for(var g=0;g<4;++g)h=n[m+g],y[f+(3&-g)]=l[s[h>>>24]]^d[s[h>>>16&255]]^p[s[h>>>8&255]]^b[s[255&h]];n=y}return n}function d(e,t,r,n){var i,a,f,h,l,d,p,b,y,m,g,v,w=e.length/4-1;n?(i=u[0],a=u[1],f=u[2],h=u[3],l=o):(i=c[0],a=c[1],f=c[2],h=c[3],l=s),d=t[0]^e[0],p=t[n?3:1]^e[1],b=t[2]^e[2],y=t[n?1:3]^e[3];for(var _=3,E=1;E<w;++E)m=i[d>>>24]^a[p>>>16&255]^f[b>>>8&255]^h[255&y]^e[++_],g=i[p>>>24]^a[b>>>16&255]^f[y>>>8&255]^h[255&d]^e[++_],v=i[b>>>24]^a[y>>>16&255]^f[d>>>8&255]^h[255&p]^e[++_],y=i[y>>>24]^a[d>>>16&255]^f[p>>>8&255]^h[255&b]^e[++_],d=m,p=g,b=v;r[0]=l[d>>>24]<<24^l[p>>>16&255]<<16^l[b>>>8&255]<<8^l[255&y]^e[++_],r[n?3:1]=l[p>>>24]<<24^l[b>>>16&255]<<16^l[y>>>8&255]<<8^l[255&d]^e[++_],r[2]=l[b>>>24]<<24^l[y>>>16&255]<<16^l[d>>>8&255]<<8^l[255&p]^e[++_],r[n?1:3]=l[y>>>24]<<24^l[d>>>16&255]<<16^l[p>>>8&255]<<8^l[255&b]^e[++_]}function p(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var s=null;r instanceof n.util.ByteBuffer&&(s=r,r={}),(r=r||{}).output=s,r.iv=e,i.call(t,r)},t}},function(e,t,r){"use strict";var n=r(31),i=r(48);function s(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=s,s.prototype.update=function(e,t){if(e=n.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-r,this.endian);for(var i=0;i<e.length;i+=this._delta32)this._update(e,i,i+this._delta32)}return this},s.prototype.digest=function(e){return this.update(this._pad()),i(null===this.pending),this._digest(e)},s.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(e<<=3,"big"===this.endian){for(var s=8;s<this.padLength;s++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=e>>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,s=8;s<this.padLength;s++)n[i++]=0;return n}},function(e,t,r){"use strict";class n extends Error{constructor(e="not initialized"){super(e),this.name="NotInitializedError",this.code=n.code}}n.code="ERR_NOT_INITIALIZED",t.NotInitializedError=n;class i extends Error{constructor(e="cannot initialize an initializing node"){super(e),this.name="AlreadyInitializingError",this.code=s.code}}i.code="ERR_ALREADY_INITIALIZING",t.AlreadyInitializingError=i;class s extends Error{constructor(e="cannot re-initialize an initialized node"){super(e),this.name="AlreadyInitializedError",this.code=s.code}}s.code="ERR_ALREADY_INITIALIZED",t.AlreadyInitializedError=s;class o extends Error{constructor(e="not started"){super(e),this.name="NotStartedError",this.code=o.code}}o.code="ERR_NOT_STARTED",t.NotStartedError=o;class a extends Error{constructor(e="not enabled"){super(e),this.name="NotEnabledError",this.code=a.code}}a.code="ERR_NOT_ENABLED",t.NotEnabledError=a;class c extends Error{constructor(e="request timed out"){super(e),this.name="TimeoutError",this.code=c.code}}c.code="ERR_TIMEOUT",t.TimeoutError=c},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(4),s=r(21);e.exports=s(class{constructor(e,t){if(!e||!ArrayBuffer.isView(e))throw new Error("first argument must be a buffer or typed array");if(n.isBuffer(e)||(e=n.from(e.buffer,e.byteOffset,e.byteLength)),!t||!i.isCID(t))throw new Error("second argument must be a CID");this._data=e,this._cid=t}get data(){return this._data}set data(e){throw new Error("Tried to change an immutable block")}get cid(){return this._cid}set cid(e){throw new Error("Tried to change an immutable block")}},{className:"Block",symbolName:"@ipld/js-ipld-block/block"})},function(e,t,r){"use strict";const n=r(32),i=r(2)("ipfs:mfs:utils:to-trail");e.exports=async(e,t)=>{i("Creating trail for path ".concat(t));const r=[];for await(const i of n.path(t,e.ipld))r.push({name:i.name,cid:i.cid,size:i.node.size,type:i.unixfs?i.unixfs.type:void 0});return r}},function(e,t,r){"use strict";(function(t){const{Key:n,Errors:i,Adapter:s,utils:{filter:o,map:a,take:c,sortAll:u}}=r(7);e.exports=class extends s{constructor(e,t){let n;super(),t&&t.db?(n=t.db,delete t.db):n=r(609),this.db=this._initDb(n,e,t)}_initDb(e,t,r){return e(t,{...r,valueEncoding:"binary",compression:!1})}async open(){try{await this.db.open()}catch(e){throw i.dbOpenFailedError(e)}}async put(e,t){try{await this.db.put(e.toString(),t)}catch(r){throw i.dbWriteFailedError(r)}}async get(e){let t;try{t=await this.db.get(e.toString())}catch(r){if(r.notFound)throw i.notFoundError(r);throw i.dbWriteFailedError(r)}return t}async has(e){try{await this.db.get(e.toString())}catch(t){if(t.notFound)return!1;throw t}return!0}async delete(e){try{await this.db.del(e.toString())}catch(t){throw i.dbDeleteFailedError(t)}}close(){return this.db.close()}batch(){const e=[];return{put:(t,r)=>{e.push({type:"put",key:t.toString(),value:r})},delete:t=>{e.push({type:"del",key:t.toString()})},commit:()=>this.db.batch(e)}}query(e){let r=!0;null!=e.keysOnly&&(r=!e.keysOnly);const i={keys:!0,values:r,keyAsBuffer:!0};if(null!=e.prefix){const t=e.prefix.toString();i.gte=t,i.lt=t+"ÿ"}let s=(f=this.db.iterator(i),{next:()=>new Promise((e,t)=>{f.next((r,n,i)=>r?t(r):null==n?f.end(r=>{if(r)return t(r);e({done:!0})}):void e({done:!1,value:{key:n,value:i}}))}),return:()=>new Promise((e,t)=>{f.end(r=>{if(r)return t(r);e({done:!0})})}),[Symbol.asyncIterator](){return this}});var f;if(s=a(s,({key:e,value:i})=>{const s={key:new n(e,!1)};return r&&(s.value=t.from(i)),s}),Array.isArray(e.filters)&&(s=e.filters.reduce((e,t)=>o(e,t),s)),Array.isArray(e.orders)&&(s=e.orders.reduce((e,t)=>u(e,t),s)),null!=e.offset){let t=0;s=o(s,()=>t++>=e.offset)}return null!=e.limit&&(s=c(s,e.limit)),s}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(285);e.exports=e=>{let t;"function"==typeof(e=e||{})?(t=e,e={}):t=e.onEnd;let r,i,s,o=new n;const a=e=>i?i(e):(o.push(e),r),c=e=>s?r:a({done:!1,value:e}),u=e=>s?r:(s=!0,e?(e=>(o=new n,i?i({error:e}):(o.push({error:e}),r)))(e):a({done:!0}));if(r={[Symbol.asyncIterator](){return this},next:()=>{if(!o.isEmpty()){if(e.writev){let e;const t=[];for(;!o.isEmpty();){if(e=o.shift(),e.error)throw e.error;t.push(e.value)}return{done:e.done,value:t}}const t=o.shift();if(t.error)throw t.error;return t}return s?{done:!0}:new Promise((t,n)=>{i=s=>(i=null,s.error?n(s.error):e.writev&&!s.done?t({done:s.done,value:[s.value]}):t(s),r)})},return:()=>(o=new n,u(),{done:!0}),throw:e=>(u(e),{done:!0}),push:c,end:u},!t)return r;const f=r;return r={[Symbol.asyncIterator](){return this},next:()=>f.next(),throw:e=>(f.throw(e),t&&(t(e),t=null),{done:!0}),return:()=>(f.return(),t&&(t(),t=null),{done:!0}),push:c,end:e=>(f.end(e),t&&(t(e),t=null),r)},r}},function(e,t,r){"use strict";const n=r(699),{Key:i}=r(7),s=r(28),o=r(6),a=r(700),c=r(1),{Buffer:u}=r(0),f=r(299),h=r(2),l=h("jsipns");l.error=h("jsipns:error");const d=r(706),{parseRFC3339:p}=r(707),b=r(708),y=a.names.id,m=async(e,t,r,n,i)=>{const s={value:t,signature:await _(e,t,i,n),validityType:i,validity:n,sequence:r};return l("ipns entry for ".concat(t," created")),s},g=async(e,t)=>{const{value:r,validityType:n,validity:i}=t,s=E(r,n,i);let o;try{o=await e.verify(s,t.signature)}catch(a){o=!1}if(!o)throw l.error("record signature verification failed"),c(new Error("record signature verification failed"),b.ERR_SIGNATURE_VERIFICATION);if(n===d.ValidityType.EOL){let e;try{e=p(i.toString())}catch(u){throw l.error("unrecognized validity format (not an rfc3339 format)"),c(new Error("unrecognized validity format (not an rfc3339 format)"),b.ERR_UNRECOGNIZED_FORMAT)}if(e<Date.now())throw l.error("record has expired"),c(new Error("record has expired"),b.ERR_IPNS_EXPIRED_RECORD)}else if(n)throw l.error("unrecognized validity type"),c(new Error("unrecognized validity type"),b.ERR_UNRECOGNIZED_VALIDITY);l("ipns entry for ".concat(r," is valid"))},v=(e,t)=>{if(!t||!e){const e=new Error("one or more of the provided parameters are not defined");throw l.error(e),c(e,b.ERR_UNDEFINED_PARAMETER)}if(t.pubKey){let e;try{e=s.keys.unmarshalPublicKey(t.pubKey)}catch(r){throw l.error(r),r}return e}if(e.pubKey)return e.pubKey;throw Object.assign(new Error("no public key is available"),{code:b.ERR_UNDEFINED_PARAMETER})},w=e=>f.encode("base32",e).toString().slice(1).toUpperCase(),_=(e,t,r,n)=>{try{const i=E(t,r,n);return e.sign(i)}catch(i){throw l.error("record signature creation failed"),c(new Error("record signature creation failed: "+i.message),b.ERR_SIGNATURE_CREATION)}},E=(e,t,r)=>{const n=u.from(e),i=u.from((e=>{if("0"===e.toString())return"EOL";const t=new Error("unrecognized validity type ".concat(e.toString()));throw l.error(t),c(t,b.ERR_UNRECOGNIZED_VALIDITY)})(t)),s=u.from(r);return u.concat([n,s,i])},k=e=>{const t=a.decode(e.id);return t.code!==y?null:s.keys.unmarshalPublicKey(t.digest)},S=d.encode,A=d.decode,I={validate:async(e,t)=>{const r=A(e),n=t.slice("/ipns/".length),i=o.createFromBytes(n),s=v(i,r);return await g(s,r),!0},select:(e,t)=>{const r=A(e),n=A(t);return r.sequence>n.sequence?0:1}};e.exports={create:(e,t,r,i)=>{const s=new n(Date.now()+Number(i)).toString(),o=d.ValidityType.EOL;return m(e,t,r,s,o)},createWithExpiration:(e,t,r,n)=>{const i=d.ValidityType.EOL;return m(e,t,r,n,i)},validate:g,embedPublicKey:async(e,t)=>{if(!e||!e.bytes||!t){const e=new Error("one or more of the provided parameters are not defined");throw l.error(e),c(e,b.ERR_UNDEFINED_PARAMETER)}let r,n;try{r=await o.createFromPubKey(e.bytes)}catch(i){throw c(i,b.ERR_PEER_ID_FROM_PUBLIC_KEY)}try{n=k(r)}catch(i){throw l.error(i),c(i,b.ERR_PUBLIC_KEY_FROM_ID)}if(n)return null;try{t.pubKey=s.keys.marshalPublicKey(e)}catch(i){throw l.error(i),i}return t},extractPublicKey:v,getLocalKey:e=>new i("/ipns/".concat(w(e))),getIdKeys:e=>{const t=u.from("/pk/"),r=u.from("/ipns/");return{routingPubKey:new i(u.concat([t,e]),!1),pkKey:new i(w(u.concat([t,e]))),routingKey:new i(u.concat([r,e]),!1),ipnsKey:new i(w(u.concat([r,e])))}},marshal:S,unmarshal:A,validator:I,namespace:"/ipns/",namespaceLength:"/ipns/".length}},function(e,t,r){"use strict";const n=r(16);e.exports=n("\nmessage CircuitRelay {\n\n enum Status {\n SUCCESS = 100;\n HOP_SRC_ADDR_TOO_LONG = 220;\n HOP_DST_ADDR_TOO_LONG = 221;\n HOP_SRC_MULTIADDR_INVALID = 250;\n HOP_DST_MULTIADDR_INVALID = 251;\n HOP_NO_CONN_TO_DST = 260;\n HOP_CANT_DIAL_DST = 261;\n HOP_CANT_OPEN_DST_STREAM = 262;\n HOP_CANT_SPEAK_RELAY = 270;\n HOP_CANT_RELAY_TO_SELF = 280;\n STOP_SRC_ADDR_TOO_LONG = 320;\n STOP_DST_ADDR_TOO_LONG = 321;\n STOP_SRC_MULTIADDR_INVALID = 350;\n STOP_DST_MULTIADDR_INVALID = 351;\n STOP_RELAY_REFUSED = 390;\n MALFORMED_MESSAGE = 400;\n }\n\n enum Type { // RPC identifier, either HOP, STOP or STATUS\n HOP = 1;\n STOP = 2;\n STATUS = 3;\n CAN_HOP = 4;\n }\n\n message Peer {\n required bytes id = 1; // peer id\n repeated bytes addrs = 2; // peer's known addresses\n }\n\n optional Type type = 1; // Type of the message\n\n optional Peer srcPeer = 2; // srcPeer and dstPeer are used when Type is HOP or STATUS\n optional Peer dstPeer = 3;\n\n optional Status code = 4; // Status code, used when Type is STATUS\n}\n")},function(e,t,r){"use strict";const n=r(313),i=r(79),s=r(83);e.exports=e=>{const t=i(),r=n(e.source),o=s(),a=e.sink(async function*(){yield*t;const e=await o.promise;yield*e}());return{reader:r,writer:t,stream:{sink:e=>(o.resolve(e),a),source:r},rest:()=>t.end(),write:t.push,read:async()=>(await r.next()).value}}},function(e,t,r){"use strict";e.exports=()=>{const e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e}},function(e,t,r){"use strict";var n;!function(){var i={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function s(e){return a(u(e),arguments)}function o(e,t){return s.apply(null,[e].concat(t||[]))}function a(e,t){var r,n,o,a,c,u,f,h,l,d=1,p=e.length,b="";for(n=0;n<p;n++)if("string"==typeof e[n])b+=e[n];else if("object"==typeof e[n]){if((a=e[n]).keys)for(r=t[d],o=0;o<a.keys.length;o++){if(null==r)throw new Error(s('[sprintf] Cannot access property "%s" of undefined value "%s"',a.keys[o],a.keys[o-1]));r=r[a.keys[o]]}else r=a.param_no?t[a.param_no]:t[d++];if(i.not_type.test(a.type)&&i.not_primitive.test(a.type)&&r instanceof Function&&(r=r()),i.numeric_arg.test(a.type)&&"number"!=typeof r&&isNaN(r))throw new TypeError(s("[sprintf] expecting number but found %T",r));switch(i.number.test(a.type)&&(h=r>=0),a.type){case"b":r=parseInt(r,10).toString(2);break;case"c":r=String.fromCharCode(parseInt(r,10));break;case"d":case"i":r=parseInt(r,10);break;case"j":r=JSON.stringify(r,null,a.width?parseInt(a.width):0);break;case"e":r=a.precision?parseFloat(r).toExponential(a.precision):parseFloat(r).toExponential();break;case"f":r=a.precision?parseFloat(r).toFixed(a.precision):parseFloat(r);break;case"g":r=a.precision?String(Number(r.toPrecision(a.precision))):parseFloat(r);break;case"o":r=(parseInt(r,10)>>>0).toString(8);break;case"s":r=String(r),r=a.precision?r.substring(0,a.precision):r;break;case"t":r=String(!!r),r=a.precision?r.substring(0,a.precision):r;break;case"T":r=Object.prototype.toString.call(r).slice(8,-1).toLowerCase(),r=a.precision?r.substring(0,a.precision):r;break;case"u":r=parseInt(r,10)>>>0;break;case"v":r=r.valueOf(),r=a.precision?r.substring(0,a.precision):r;break;case"x":r=(parseInt(r,10)>>>0).toString(16);break;case"X":r=(parseInt(r,10)>>>0).toString(16).toUpperCase()}i.json.test(a.type)?b+=r:(!i.number.test(a.type)||h&&!a.sign?l="":(l=h?"+":"-",r=r.toString().replace(i.sign,"")),u=a.pad_char?"0"===a.pad_char?"0":a.pad_char.charAt(1):" ",f=a.width-(l+r).length,c=a.width&&f>0?u.repeat(f):"",b+=a.align?l+r+c:"0"===u?l+c+r:c+l+r)}return b}var c=Object.create(null);function u(e){if(c[e])return c[e];for(var t,r=e,n=[],s=0;r;){if(null!==(t=i.text.exec(r)))n.push(t[0]);else if(null!==(t=i.modulo.exec(r)))n.push("%");else{if(null===(t=i.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(t[2]){s|=1;var o=[],a=t[2],u=[];if(null===(u=i.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o.push(u[1]);""!==(a=a.substring(u[0].length));)if(null!==(u=i.key_access.exec(a)))o.push(u[1]);else{if(null===(u=i.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");o.push(u[1])}t[2]=o}else s|=2;if(3===s)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push({placeholder:t[0],param_no:t[1],keys:t[2],sign:t[3],pad_char:t[4],align:t[5],width:t[6],precision:t[7],type:t[8]})}r=r.substring(t[0].length)}return c[e]=n}t.sprintf=s,t.vsprintf=o,"undefined"!=typeof window&&(window.sprintf=s,window.vsprintf=o,void 0===(n=function(){return{sprintf:s,vsprintf:o}}.call(t,r,t,e))||(e.exports=n))}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logLocalStaticKeys=function(e){a("LOCAL_STATIC_PUBLIC_KEY ".concat(e.publicKey.toString("hex"))),a("LOCAL_STATIC_PRIVATE_KEY ".concat(e.privateKey.toString("hex")))},t.logLocalEphemeralKeys=function(e){e?(a("LOCAL_PUBLIC_EPHEMERAL_KEY ".concat(e.publicKey.toString("hex"))),a("LOCAL_PRIVATE_EPHEMERAL_KEY ".concat(e.privateKey.toString("hex")))):a("Missing local ephemeral keys.")},t.logRemoteStaticKey=function(e){a("REMOTE_STATIC_PUBLIC_KEY ".concat(e.toString("hex")))},t.logRemoteEphemeralKey=function(e){a("REMOTE_EPHEMERAL_PUBLIC_KEY ".concat(e.toString("hex")))},t.logCipherState=function(e){e.cs1&&e.cs2?(a("CIPHER_STATE_1 ".concat(e.cs1.n," ").concat(e.cs1.k.toString("hex"))),a("CIPHER_STATE_2 ".concat(e.cs2.n," ").concat(e.cs2.k.toString("hex")))):a("Missing cipher state.")},t.logger=void 0;var n,i=(n=r(2))&&n.__esModule?n:{default:n},s=r(190);const o=(0,i.default)("libp2p:noise");let a;t.logger=o,a=s.DUMP_SESSION_KEYS?o:()=>{}},function(e,t,r){"use strict";const n=r(12),i=n.DAGNode,s=n.DAGLink,o=r(22).multihash,a=r(11),{withTimeoutOption:c}=r(3),{Buffer:u}=r(0);function f(e,t){switch(t){case"json":return function(e){let t,r;try{const n=JSON.parse(e.toString());r=(n.Links||[]).map(e=>new s(e.Name||e.name,e.Size||e.size,o.fromB58String(e.Hash||e.hash||e.multihash))),t=u.from(n.Data)}catch(n){throw new Error("failed to parse JSON: "+n)}return new i(t,r)}(e);case"protobuf":return function(e){return n.util.deserialize(e)}(e);default:throw new Error("unkown encoding: ".concat(t))}}e.exports=({ipld:e,gcLock:t,preload:r})=>c((async function(n,s){const o=(s=s||{}).enc;let c;if(u.isBuffer(n))c=o?await f(n,o):new i(n);else if(i.isDAGNode(n))c=n;else{if("object"!=typeof n)throw new Error("obj not recognized");c=new i(n.Data,n.Links)}const h=await t.readLock();try{const t=await e.put(c,a.DAG_PB,{cidVersion:0,hashAlg:a.SHA2_256});return!1!==s.preload&&r(t),t}finally{h()}}))},function(e,t,r){"use strict";const n=r(76),i=r(4),{getName:s}=r(11),o=r(1041),a=r(22),{isMapEqual:c}=r(45),{Message:u}=r(1043),f=r(1044);class h{constructor(e){this.full=e,this.wantlist=new Map,this.blocks=new Map,this.blockPresences=new Map,this.pendingBytes=0}get empty(){return 0===this.blocks.size&&0===this.wantlist.size&&0===this.blockPresences.size}addEntry(e,t,r,n,i){null==r&&(r=h.WantType.Block);const s=e.toString("base58btc"),o=this.wantlist.get(s);o?(o.wantType===r&&(o.priority=t),n&&(o.cancel=Boolean(n)),i&&(o.sendDontHave=Boolean(i)),r===h.WantType.Block&&o.wantType===h.WantType.Have&&(o.wantType=r)):this.wantlist.set(s,new f(e,t,r,n,i))}addBlock(e){const t=e.cid.toString("base58btc");this.blocks.set(t,e)}addHave(e){const t=e.toString("base58btc");this.blockPresences.has(t)||this.blockPresences.set(t,h.BlockPresenceType.Have)}addDontHave(e){const t=e.toString("base58btc");this.blockPresences.has(t)||this.blockPresences.set(t,h.BlockPresenceType.DontHave)}cancel(e){const t=e.toString("base58btc");this.wantlist.delete(t),this.addEntry(e,0,h.WantType.Block,!0,!1)}setPendingBytes(e){this.pendingBytes=e}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),u.encode(e)}serializeToBitswap110(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map(e=>({block:e.cid.buffer,priority:Number(e.priority),wantType:e.wantType,cancel:Boolean(e.cancel),sendDontHave:Boolean(e.sendDontHave)}))},blockPresences:[],payload:[]};this.full&&(e.wantlist.full=!0),this.blocks.forEach(t=>{e.payload.push({prefix:t.cid.prefix,data:t.data})});for(const[t,r]of this.blockPresences)e.blockPresences.push({cid:new i(t).buffer,type:r});return this.pendingBytes>0&&(e.pendingBytes=this.pendingBytes),u.encode(e)}equals(e){return!!(this.full===e.full&&this.pendingBytes===e.pendingBytes&&c(this.wantlist,e.wantlist)&&c(this.blocks,e.blocks)&&c(this.blockPresences,e.blockPresences))}get[Symbol.toStringTag](){const e=Array.from(this.wantlist.keys()),t=Array.from(this.blocks.keys());return"BitswapMessage <full: ".concat(this.full,", list: ").concat(e,", blocks: ").concat(t,">")}}h.deserialize=async e=>{const t=u.decode(e),r=t.wantlist&&t.wantlist.full||!1,c=new h(r);return t.wantlist&&t.wantlist.entries.forEach(e=>{const t=new i(e.block);c.addEntry(t,e.priority,e.wantType,e.cancel,e.sendDontHave)}),t.blockPresences&&t.blockPresences.forEach(e=>{const t=new i(e.cid);e.type===h.BlockPresenceType.Have?c.addHave(t):c.addDontHave(t)}),t.blocks.length>0?(await Promise.all(t.blocks.map(async e=>{const t=await a(e,"sha2-256"),r=new i(t);c.addBlock(new n(e,r))})),c):t.payload.length>0?(await Promise.all(t.payload.map(async e=>{if(!e.prefix||!e.data)return;const t=o(e.prefix),r=t[0],u=t[1],f=t[2],h=await a(e.data,f),l=new i(r,s(u),h);c.addBlock(new n(e.data,l))})),c.setPendingBytes(t.pendingBytes),c):c},h.blockPresenceSize=e=>e.buffer.length+1,h.Entry=f,h.WantType={Block:u.Wantlist.WantType.Block,Have:u.Wantlist.WantType.Have},h.BlockPresenceType={Have:u.BlockPresenceType.Have,DontHave:u.BlockPresenceType.DontHave},e.exports=h},function(e,t,r){"use strict";const{URLWithLegacySupport:n,format:i,URLSearchParams:s,defaultBase:o}=r(197),a=r(369);e.exports={URL:n,URLSearchParams:s,format:i,relative:a,defaultBase:o}},function(e,t,r){"use strict";(function(e){var n=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function s(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new s(i.call(setTimeout,n,arguments),clearTimeout)},t.setInterval=function(){return new s(i.call(setInterval,n,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(n,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},r(395),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||void 0,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||void 0}).call(this,r(10))},function(e,t,r){"use strict";var n=r(5);if(r(43),r(91),r(72),r(401),r(403),r(47),r(9),void 0===i)var i=n.jsbn.BigInteger;var s=n.util.isNodejs?r(119):null,o=n.asn1,a=n.util;n.pki=n.pki||{},e.exports=n.pki.rsa=n.rsa=n.rsa||{};var c=n.pki,u=[6,4,2,4,2,4,6,2],f={name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},h={name:"RSAPrivateKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},l={name:"RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},d=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},p=function(e){var t;if(!(e.algorithm in c.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=c.oids[e.algorithm];var n=o.oidToDer(t).getBytes(),i=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]),s=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]);s.value.push(o.create(o.Class.UNIVERSAL,o.Type.OID,!1,n)),s.value.push(o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,""));var a=o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(s),i.value.push(a),o.toDer(i).getBytes()},b=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var s;t.dP||(t.dP=t.d.mod(t.p.subtract(i.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(i.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{s=new i(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16)}while(s.compareTo(t.n)>=0||!s.gcd(t.n).equals(i.ONE));for(var o=(e=e.multiply(s.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);o.compareTo(a)<0;)o=o.add(t.p);var c=o.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return c=c.multiply(s.modInverse(t.n)).mod(t.n)};function y(e,t,r){var i=n.util.createBuffer(),s=Math.ceil(t.n.bitLength()/8);if(e.length>s-11){var o=new Error("Message is too long for PKCS#1 v1.5 padding.");throw o.length=e.length,o.max=s-11,o}i.putByte(0),i.putByte(r);var a,c=s-3-e.length;if(0===r||1===r){a=0===r?0:255;for(var u=0;u<c;++u)i.putByte(a)}else for(;c>0;){var f=0,h=n.random.getBytes(c);for(u=0;u<c;++u)0===(a=h.charCodeAt(u))?++f:i.putByte(a);c=f}return i.putByte(0),i.putBytes(e),i}function m(e,t,r,i){var s=Math.ceil(t.n.bitLength()/8),o=n.util.createBuffer(e),a=o.getByte(),c=o.getByte();if(0!==a||r&&0!==c&&1!==c||!r&&2!=c||r&&0===c&&void 0===i)throw new Error("Encryption block is invalid.");var u=0;if(0===c){u=s-3-i;for(var f=0;f<u;++f)if(0!==o.getByte())throw new Error("Encryption block is invalid.")}else if(1===c)for(u=0;o.length()>1;){if(255!==o.getByte()){--o.read;break}++u}else if(2===c)for(u=0;o.length()>1;){if(0===o.getByte()){--o.read;break}++u}if(0!==o.getByte()||u!==s-3-o.length())throw new Error("Encryption block is invalid.");return o.getBytes()}function g(e,t,r){"function"==typeof t&&(r=t,t={});var s={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function o(){a(e.pBits,(function(t,n){return t?r(t):(e.p=n,null!==e.q?u(t,e.q):void a(e.qBits,u))}))}function a(e,t){n.prime.generateProbablePrime(e,s,t)}function u(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var s=e.p;e.p=e.q,e.q=s}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void o();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void a(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 o();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void a(e.qBits,u);var f=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(s.prng=t.prng),o()}function v(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=n.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function w(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){return n.util.isNodejs&&"function"==typeof s[e]}function E(e){return void 0!==a.globalScope&&"object"==typeof a.globalScope.crypto&&"object"==typeof a.globalScope.crypto.subtle&&"function"==typeof a.globalScope.crypto.subtle[e]}function k(e){return void 0!==a.globalScope&&"object"==typeof a.globalScope.msCrypto&&"object"==typeof a.globalScope.msCrypto.subtle&&"function"==typeof a.globalScope.msCrypto.subtle[e]}function S(e){for(var t=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),i=0;i<t.length;++i)r[i]=t.charCodeAt(i);return r}c.rsa.encrypt=function(e,t,r){var s,o=r,a=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(o=2===r,s=y(e,t,r)):(s=n.util.createBuffer()).putBytes(e);for(var c=new i(s.toHex(),16),u=b(c,t,o).toString(16),f=n.util.createBuffer(),h=a-Math.ceil(u.length/2);h>0;)f.putByte(0),--h;return f.putBytes(n.util.hexToBytes(u)),f.getBytes()},c.rsa.decrypt=function(e,t,r,s){var o=Math.ceil(t.n.bitLength()/8);if(e.length!==o){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=o,a}var c=new i(n.util.createBuffer(e).toHex(),16);if(c.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=b(c,t,r).toString(16),f=n.util.createBuffer(),h=o-Math.ceil(u.length/2);h>0;)f.putByte(0),--h;return f.putBytes(n.util.hexToBytes(u)),!1!==s?m(f.getBytes(),t,r):f.getBytes()},c.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var s,o=(r=r||{}).prng||n.random,a={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},c=r.algorithm||"PRIMEINC";if("PRIMEINC"!==c)throw new Error("Invalid key generation algorithm: "+c);return(s={algorithm:c,state:0,bits:e,rng:a,eInt:t||65537,e:new i(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(s.eInt),s},c.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new i(null);r.fromInt(30);for(var n,s=0,o=function(e,t){return e|t},a=+new Date,f=0;null===e.keys&&(t<=0||f<t);){if(0===e.state){var h=null===e.p?e.pBits:e.qBits,l=h-1;0===e.pqState?(e.num=new i(h,e.rng),e.num.testBit(l)||e.num.bitwiseTo(i.ONE.shiftLeft(l),o,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),s=0,++e.pqState):1===e.pqState?e.num.bitLength()>h?e.pqState=0:e.num.isProbablePrime(w(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(u[s++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var d=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,d,e.p,e.q,d.mod(e.p1),d.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)}}f+=(n=+new Date)-a,a=n}return null!==e.keys},c.rsa.generateKeyPair=function(e,t,r,i){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(i=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(i=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,i=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(i=r,r=void 0):(i=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!n.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(i){if(_("generateKeyPair"))return s.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return i(e);i(null,{privateKey:c.privateKeyFromPem(r),publicKey:c.publicKeyFromPem(t)})}));if(E("generateKey")&&E("exportKey"))return a.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:S(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return a.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){i(e)})).then((function(e){if(e){var t=c.privateKeyFromAsn1(o.fromDer(n.util.createBuffer(e)));i(null,{privateKey:t,publicKey:c.setRsaPublicKey(t.n,t.e)})}}));if(k("generateKey")&&k("exportKey")){var u=a.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:S(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return u.oncomplete=function(e){var t=e.target.result,r=a.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=c.privateKeyFromAsn1(o.fromDer(n.util.createBuffer(t)));i(null,{privateKey:r,publicKey:c.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){i(e)}},void(u.onerror=function(e){i(e)})}}else if(_("generateKeyPairSync")){var f=s.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:c.privateKeyFromPem(f.privateKey),publicKey:c.publicKeyFromPem(f.publicKey)}}var h=c.rsa.createKeyPairGenerationState(e,t,r);if(!i)return c.rsa.stepKeyPairGenerationState(h,0),h.keys;g(h,r,i)},c.setRsaPublicKey=c.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,i){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return y(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return n.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var s=t.encode(e,r,!0);return c.rsa.encrypt(s,r,!0)},verify:function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){return t=m(t,r,!0),e===o.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return e===(t=m(t,r,!0))}});var i=c.rsa.decrypt(t,r,!0,!1);return n.verify(e,i,r.n.bitLength())}};return r},c.setRsaPrivateKey=c.rsa.setPrivateKey=function(e,t,r,i,s,o,a,u){var f={n:e,e:t,d:r,p:i,q:s,dP:o,dQ:a,qInv:u,decrypt:function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=c.rsa.decrypt(e,f,!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 n.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,f,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:p},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,f.n.bitLength());return c.rsa.encrypt(n,f,r)}};return f},c.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(c.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())])},c.privateKeyFromAsn1=function(e){var t,r,s,a,u,l,d,p,b={},y=[];if(o.validate(e,f,b,y)&&(e=o.fromDer(n.util.createBuffer(b.privateKey))),b={},y=[],!o.validate(e,h,b,y)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=y,m}return t=n.util.createBuffer(b.privateKeyModulus).toHex(),r=n.util.createBuffer(b.privateKeyPublicExponent).toHex(),s=n.util.createBuffer(b.privateKeyPrivateExponent).toHex(),a=n.util.createBuffer(b.privateKeyPrime1).toHex(),u=n.util.createBuffer(b.privateKeyPrime2).toHex(),l=n.util.createBuffer(b.privateKeyExponent1).toHex(),d=n.util.createBuffer(b.privateKeyExponent2).toHex(),p=n.util.createBuffer(b.privateKeyCoefficient).toHex(),c.setRsaPrivateKey(new i(t,16),new i(r,16),new i(s,16),new i(a,16),new i(u,16),new i(l,16),new i(d,16),new i(p,16))},c.privateKeyToAsn1=c.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,v(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.qInv))])},c.publicKeyFromAsn1=function(e){var t={},r=[];if(o.validate(e,d,t,r)){var s,a=o.derToOid(t.publicKeyOid);if(a!==c.oids.rsaEncryption)throw(s=new Error("Cannot read public key. Unknown OID.")).oid=a,s;e=t.rsaPublicKey}if(r=[],!o.validate(e,l,t,r))throw(s=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,s;var u=n.util.createBuffer(t.publicKeyModulus).toHex(),f=n.util.createBuffer(t.publicKeyExponent).toHex();return c.setRsaPublicKey(new i(u,16),new i(f,16))},c.publicKeyToAsn1=c.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(c.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,[c.publicKeyToRSAPublicKey(e)])])},c.publicKeyToRSAPublicKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.e))])}},function(e,t,r){"use strict";var n,i=r(5);e.exports=i.jsbn=i.jsbn||{};function s(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function o(){return new s(null)}function a(e,t,r,n,i,s){for(var o=16383&t,a=t>>14;--s>=0;){var c=16383&this.data[e],u=this.data[e++]>>14,f=a*c+u*o;i=((c=o*c+((16383&f)<<14)+r.data[n]+i)>>28)+(f>>14)+a*u,r.data[n++]=268435455&c}return i}i.jsbn.BigInteger=s,"undefined"==typeof navigator?(s.prototype.am=a,n=28):"Microsoft Internet Explorer"==navigator.appName?(s.prototype.am=function(e,t,r,n,i,s){for(var o=32767&t,a=t>>15;--s>=0;){var c=32767&this.data[e],u=this.data[e++]>>15,f=a*c+u*o;i=((c=o*c+((32767&f)<<15)+r.data[n]+(1073741823&i))>>>30)+(f>>>15)+a*u+(i>>>30),r.data[n++]=1073741823&c}return i},n=30):"Netscape"!=navigator.appName?(s.prototype.am=function(e,t,r,n,i,s){for(;--s>=0;){var o=t*this.data[e++]+r.data[n]+i;i=Math.floor(o/67108864),r.data[n++]=67108863&o}return i},n=26):(s.prototype.am=a,n=28),s.prototype.DB=n,s.prototype.DM=(1<<n)-1,s.prototype.DV=1<<n;s.prototype.FV=Math.pow(2,52),s.prototype.F1=52-n,s.prototype.F2=2*n-52;var c,u,f=new Array;for(c="0".charCodeAt(0),u=0;u<=9;++u)f[c++]=u;for(c="a".charCodeAt(0),u=10;u<36;++u)f[c++]=u;for(c="A".charCodeAt(0),u=10;u<36;++u)f[c++]=u;function h(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function l(e,t){var r=f[e.charCodeAt(t)];return null==r?-1:r}function d(e){var t=o();return t.fromInt(e),t}function p(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function b(e){this.m=e}function y(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function m(e,t){return e&t}function g(e,t){return e|t}function v(e,t){return e^t}function w(e,t){return e&~t}function _(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=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 E(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function k(){}function S(e){return e}function A(e){this.r2=o(),this.q3=o(),s.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}b.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},b.prototype.revert=function(e){return e},b.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},b.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},b.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},y.prototype.convert=function(e){var t=o();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(s.ZERO)>0&&this.m.subTo(t,t),t},y.prototype.revert=function(e){var t=o();return e.copyTo(t),this.reduce(t),t},y.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],n=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},y.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},s.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},s.prototype.fromInt=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},s.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,i=!1,o=0;--n>=0;){var a=8==r?255&e[n]:l(e,n);a<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==o?this.data[this.t++]=a:o+r>this.DB?(this.data[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this.data[this.t++]=a>>this.DB-o):this.data[this.t-1]|=a<<o,(o+=r)>=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&s.ZERO.subTo(this,this)},s.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},s.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},s.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s},s.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,s=(1<<i)-1,o=Math.floor(e/this.DB),a=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+o+1]=this.data[r]>>i|a,a=(this.data[r]&s)<<n;for(r=o-1;r>=0;--r)t.data[r]=0;t.data[o]=a,t.t=this.t+o+1,t.s=this.s,t.clamp()},s.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,s=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var o=r+1;o<this.t;++o)t.data[o-r-1]|=(this.data[o]&s)<<i,t.data[o-r]=this.data[o]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&s)<<i),t.t=this.t-r,t.clamp()}},s.prototype.subTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()},s.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i<n.t;++i)t.data[i+r.t]=r.am(0,n.data[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&s.ZERO.subTo(t,t)},s.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},s.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=o());var a=o(),c=this.s,u=e.s,f=this.DB-p(n.data[n.t-1]);f>0?(n.lShiftTo(f,a),i.lShiftTo(f,r)):(n.copyTo(a),i.copyTo(r));var h=a.t,l=a.data[h-1];if(0!=l){var d=l*(1<<this.F1)+(h>1?a.data[h-2]>>this.F2:0),b=this.FV/d,y=(1<<this.F1)/d,m=1<<this.F2,g=r.t,v=g-h,w=null==t?o():t;for(a.dlShiftTo(v,w),r.compareTo(w)>=0&&(r.data[r.t++]=1,r.subTo(w,r)),s.ONE.dlShiftTo(h,w),w.subTo(a,a);a.t<h;)a.data[a.t++]=0;for(;--v>=0;){var _=r.data[--g]==l?this.DM:Math.floor(r.data[g]*b+(r.data[g-1]+m)*y);if((r.data[g]+=a.am(0,_,r,v,0,h))<_)for(a.dlShiftTo(v,w),r.subTo(w,r);r.data[g]<--_;)r.subTo(w,r)}null!=t&&(r.drShiftTo(h,t),c!=u&&s.ZERO.subTo(t,t)),r.t=h,r.clamp(),f>0&&r.rShiftTo(f,r),c<0&&s.ZERO.subTo(r,r)}}},s.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},s.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},s.prototype.exp=function(e,t){if(e>4294967295||e<1)return s.ONE;var r=o(),n=o(),i=t.convert(this),a=p(e)-1;for(i.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<<a)>0)t.mulTo(n,i,r);else{var c=r;r=n,n=c}return t.revert(r)},s.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,i=!1,s="",o=this.t,a=this.DB-o*this.DB%t;if(o-- >0)for(a<this.DB&&(r=this.data[o]>>a)>0&&(i=!0,s=h(r));o>=0;)a<t?(r=(this.data[o]&(1<<a)-1)<<t-a,r|=this.data[--o]>>(a+=this.DB-t)):(r=this.data[o]>>(a-=t)&n,a<=0&&(a+=this.DB,--o)),r>0&&(i=!0),i&&(s+=h(r));return i?s:"0"},s.prototype.negate=function(){var e=o();return s.ZERO.subTo(this,e),e},s.prototype.abs=function(){return this.s<0?this.negate():this},s.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},s.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+p(this.data[this.t-1]^this.s&this.DM)},s.prototype.mod=function(e){var t=o();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(s.ZERO)>0&&e.subTo(t,t),t},s.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new b(t):new y(t),this.exp(e,r)},s.ZERO=d(0),s.ONE=d(1),k.prototype.convert=S,k.prototype.revert=S,k.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},k.prototype.sqrTo=function(e,t){e.squareTo(t)},A.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=o();return e.copyTo(t),this.reduce(t),t},A.prototype.revert=function(e){return e},A.prototype.reduce=function(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)},A.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},A.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var I=[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],T=(1<<26)/I[I.length-1];s.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},s.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=d(r),i=o(),s=o(),a="";for(this.divRemTo(n,i,s);i.signum()>0;)a=(r+s.intValue()).toString(e).substr(1)+a,i.divRemTo(n,i,s);return s.intValue().toString(e)+a},s.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,o=0,a=0,c=0;c<e.length;++c){var u=l(e,c);u<0?"-"==e.charAt(c)&&0==this.signum()&&(i=!0):(a=t*a+u,++o>=r&&(this.dMultiply(n),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(a,0)),i&&s.ZERO.subTo(this,this)},s.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(s.ONE.shiftLeft(e-1),g,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(s.ONE.shiftLeft(e-1),this);else{var n=new Array,i=7&e;n.length=1+(e>>3),t.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}},s.prototype.bitwiseTo=function(e,t,r){var n,i,s=Math.min(e.t,this.t);for(n=0;n<s;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(i=e.s&this.DM,n=s;n<this.t;++n)r.data[n]=t(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=s;n<e.t;++n)r.data[n]=t(i,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},s.prototype.changeBit=function(e,t){var r=s.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r},s.prototype.addTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()},s.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},s.prototype.dAddOffset=function(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]}},s.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;for(n=r.t-this.t;i<n;++i)r.data[i+this.t]=this.am(0,e.data[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e.data[i],r,i,0,t-i);r.clamp()},s.prototype.multiplyUpperTo=function(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)},s.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r},s.prototype.millerRabin=function(e){var t=this.subtract(s.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,i=t.shiftRight(r),o={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},a=0;a<e;++a){do{n=new s(this.bitLength(),o)}while(n.compareTo(s.ONE)<=0||n.compareTo(t)>=0);var c=n.modPow(i,this);if(0!=c.compareTo(s.ONE)&&0!=c.compareTo(t)){for(var u=1;u++<r&&0!=c.compareTo(t);)if(0==(c=c.modPowInt(2,this)).compareTo(s.ONE))return!1;if(0!=c.compareTo(t))return!1}}return!0},s.prototype.clone=function(){var e=o();return this.copyTo(e),e},s.prototype.intValue=function(){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)<<this.DB|this.data[0]},s.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},s.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},s.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},s.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n<this.DB&&(r=this.data[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this.data[e]&(1<<n)-1)<<8-n,r|=this.data[--e]>>(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},s.prototype.equals=function(e){return 0==this.compareTo(e)},s.prototype.min=function(e){return this.compareTo(e)<0?this:e},s.prototype.max=function(e){return this.compareTo(e)>0?this:e},s.prototype.and=function(e){var t=o();return this.bitwiseTo(e,m,t),t},s.prototype.or=function(e){var t=o();return this.bitwiseTo(e,g,t),t},s.prototype.xor=function(e){var t=o();return this.bitwiseTo(e,v,t),t},s.prototype.andNot=function(e){var t=o();return this.bitwiseTo(e,w,t),t},s.prototype.not=function(){for(var e=o(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},s.prototype.shiftLeft=function(e){var t=o();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},s.prototype.shiftRight=function(e){var t=o();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},s.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+_(this.data[e]);return this.s<0?this.t*this.DB:-1},s.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=E(this.data[r]^t);return e},s.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this.data[t]&1<<e%this.DB)},s.prototype.setBit=function(e){return this.changeBit(e,g)},s.prototype.clearBit=function(e){return this.changeBit(e,w)},s.prototype.flipBit=function(e){return this.changeBit(e,v)},s.prototype.add=function(e){var t=o();return this.addTo(e,t),t},s.prototype.subtract=function(e){var t=o();return this.subTo(e,t),t},s.prototype.multiply=function(e){var t=o();return this.multiplyTo(e,t),t},s.prototype.divide=function(e){var t=o();return this.divRemTo(e,t,null),t},s.prototype.remainder=function(e){var t=o();return this.divRemTo(e,null,t),t},s.prototype.divideAndRemainder=function(e){var t=o(),r=o();return this.divRemTo(e,t,r),new Array(t,r)},s.prototype.modPow=function(e,t){var r,n,i=e.bitLength(),s=d(1);if(i<=0)return s;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new b(t):t.isEven()?new A(t):new y(t);var a=new Array,c=3,u=r-1,f=(1<<r)-1;if(a[1]=n.convert(this),r>1){var h=o();for(n.sqrTo(a[1],h);c<=f;)a[c]=o(),n.mulTo(h,a[c-2],a[c]),c+=2}var l,m,g=e.t-1,v=!0,w=o();for(i=p(e.data[g])-1;g>=0;){for(i>=u?l=e.data[g]>>i-u&f:(l=(e.data[g]&(1<<i+1)-1)<<u-i,g>0&&(l|=e.data[g-1]>>this.DB+i-u)),c=r;0==(1&l);)l>>=1,--c;if((i-=c)<0&&(i+=this.DB,--g),v)a[l].copyTo(s),v=!1;else{for(;c>1;)n.sqrTo(s,w),n.sqrTo(w,s),c-=2;c>0?n.sqrTo(s,w):(m=s,s=w,w=m),n.mulTo(w,a[l],s)}for(;g>=0&&0==(e.data[g]&1<<i);)n.sqrTo(s,w),m=s,s=w,w=m,--i<0&&(i=this.DB-1,--g)}return n.revert(s)},s.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return s.ZERO;for(var r=e.clone(),n=this.clone(),i=d(1),o=d(0),a=d(0),c=d(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),t?(a.isEven()&&c.isEven()||(a.addTo(this,a),c.subTo(e,c)),a.rShiftTo(1,a)):c.isEven()||c.subTo(e,c),c.rShiftTo(1,c);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(a,i),o.subTo(c,o)):(n.subTo(r,n),t&&a.subTo(i,a),c.subTo(o,c))}return 0!=n.compareTo(s.ONE)?s.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},s.prototype.pow=function(e){return this.exp(e,new k)},s.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)return t;for(i<s&&(s=i),s>0&&(t.rShiftTo(s,t),r.rShiftTo(s,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r},s.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=I[I.length-1]){for(t=0;t<I.length;++t)if(r.data[0]==I[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<I.length;){for(var n=I[t],i=t+1;i<I.length&&n<T;)n*=I[i++];for(n=r.modInt(n);t<i;)if(n%I[t++]==0)return!1}return r.millerRabin(e)}},function(e,t,r){"use strict";t.TextEncoder=TextEncoder,t.TextDecoder=TextDecoder},function(e,t,r){"use strict";t.get=(e=self)=>{const t=e.crypto||e.msCrypto;if(!t||!t.subtle)throw Object.assign(new Error("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p-crypto/blob/master/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return t}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(17),s=self.crypto||self.msCrypto,o=async(e,t)=>{if("undefined"==typeof self||!self.crypto&&!self.msCrypto)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");switch(t){case"sha1":return n.from(await s.subtle.digest({name:"SHA-1"},e));case"sha2-256":return n.from(await s.subtle.digest({name:"SHA-256"},e));case"sha2-512":return n.from(await s.subtle.digest({name:"SHA-512"},e));case"dbl-sha2-256":{const t=await s.subtle.digest({name:"SHA-256"},e);return n.from(await s.subtle.digest({name:"SHA-256"},t))}default:throw new Error("".concat(t," is not a supported algorithm"))}};e.exports={factory:e=>async t=>o(t,e),digest:o,multihashing:async(e,t,r)=>{const n=await o(e,t);return i.encode(n,t,r)}}},function(e,t,r){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";var n=r(33),i=r(29),s=i.getNAF,o=i.getJSF,a=i.assert;function c(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(e,t){a(e.precomputed);var r=e._getDoubles(),n=s(t,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;for(var o=[],c=0;c<n.length;c+=r.step){var u=0;for(t=c+r.step-1;t>=c;t--)u=(u<<1)+n[t];o.push(u)}for(var f=this.jpoint(null,null,null),h=this.jpoint(null,null,null),l=i;l>0;l--){for(c=0;c<o.length;c++){(u=o[c])===l?h=h.mixedAdd(r.points[c]):u===-l&&(h=h.mixedAdd(r.points[c].neg()))}f=f.add(h)}return f.toP()},c.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var i=n.points,o=s(t,r,this._bitLength),c=this.jpoint(null,null,null),u=o.length-1;u>=0;u--){for(t=0;u>=0&&0===o[u];u--)t++;if(u>=0&&t++,c=c.dblp(t),u<0)break;var f=o[u];a(0!==f),c="affine"===e.type?f>0?c.mixedAdd(i[f-1>>1]):c.mixedAdd(i[-f-1>>1].neg()):f>0?c.add(i[f-1>>1]):c.add(i[-f-1>>1].neg())}return"affine"===e.type?c.toP():c},c.prototype._wnafMulAdd=function(e,t,r,n,i){for(var a=this._wnafT1,c=this._wnafT2,u=this._wnafT3,f=0,h=0;h<n;h++){var l=(A=t[h])._getNAFPoints(e);a[h]=l.wnd,c[h]=l.points}for(h=n-1;h>=1;h-=2){var d=h-1,p=h;if(1===a[d]&&1===a[p]){var b=[t[d],null,null,t[p]];0===t[d].y.cmp(t[p].y)?(b[1]=t[d].add(t[p]),b[2]=t[d].toJ().mixedAdd(t[p].neg())):0===t[d].y.cmp(t[p].y.redNeg())?(b[1]=t[d].toJ().mixedAdd(t[p]),b[2]=t[d].add(t[p].neg())):(b[1]=t[d].toJ().mixedAdd(t[p]),b[2]=t[d].toJ().mixedAdd(t[p].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],m=o(r[d],r[p]);f=Math.max(m[0].length,f),u[d]=new Array(f),u[p]=new Array(f);for(var g=0;g<f;g++){var v=0|m[0][g],w=0|m[1][g];u[d][g]=y[3*(v+1)+(w+1)],u[p][g]=0,c[d]=b}}else u[d]=s(r[d],a[d],this._bitLength),u[p]=s(r[p],a[p],this._bitLength),f=Math.max(u[d].length,f),f=Math.max(u[p].length,f)}var _=this.jpoint(null,null,null),E=this._wnafT4;for(h=f;h>=0;h--){for(var k=0;h>=0;){var S=!0;for(g=0;g<n;g++)E[g]=0|u[g][h],0!==E[g]&&(S=!1);if(!S)break;k++,h--}if(h>=0&&k++,_=_.dblp(k),h<0)break;for(g=0;g<n;g++){var A,I=E[g];0!==I&&(I>0?A=c[g][I-1>>1]:I<0&&(A=c[g][-I-1>>1].neg()),_="affine"===A.type?_.mixedAdd(A):_.add(A))}}for(h=0;h<n;h++)c[h]=null;return i?_:_.toP()},c.BasePoint=u,u.prototype.eq=function(){throw new Error("Not implemented")},u.prototype.validate=function(){return this.curve.validate(this)},c.prototype.decodePoint=function(e,t){e=i.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?a(e[e.length-1]%2==0):7===e[0]&&a(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},u.prototype.encodeCompressed=function(e){return this.encode(e,!0)},u.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},u.prototype.encode=function(e,t){return i.encode(this._encode(t),e)},u.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},u.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},u.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<t;i+=e){for(var s=0;s<e;s++)n=n.dbl();r.push(n)}return{step:e,points:r}},u.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)t[i]=t[i-1].add(n);return{wnd:e,points:t}},u.prototype._getBeta=function(){return null},u.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}},function(e,t,r){"use strict";t.add=r(476),t.addAll=r(477),t.block={get:r(522),put:r(523),rm:r(524),stat:r(538)},t.bitswap={stat:r(539),unwant:r(540),wantlist:r(541),wantlistForPeer:r(542)},t.bootstrap={add:r(543),clear:r(544),list:r(545),reset:r(546),rm:r(547)},t.cat=r(548),t.config=r(248),t.dag={get:r(561),put:r(562),resolve:r(563),tree:r(564)},t.dht=r(565),t.dns=r(566),t.files=r(568),t.get=r(596),t.id=r(597),t.init=r(598),t.isOnline=r(731),t.key={export:r(732),gen:r(733),import:r(734),info:r(735),list:r(736),rename:r(737),rm:r(738)},t.libp2p=r(739),t.ls=r(1003),t.name={publish:r(1004),pubsub:{cancel:r(1006),state:r(1015),subs:r(1016)},resolve:r(1017)},t.object={data:r(1019),get:r(56),links:r(1020),new:r(1021),patch:{addLink:r(1022),appendData:r(1023),rmLink:r(1024),setData:r(1025)},put:r(86),stat:r(1026)},t.pin={add:r(1027),ls:r(1028),rm:r(1029)},t.ping=r(1030),t.pubsub=r(1031),t.refs=r(1032),t.refs.local=r(1033),t.repo={gc:r(1034),stat:r(1035),version:r(1036)},t.resolve=r(1037),t.start=r(1038),t.stats={bw:r(1059)},t.stop=r(1060),t.swarm={addrs:r(1061),connect:r(1062),disconnect:r(1063),localAddrs:r(1064),peers:r(1065)},t.version=r(1066)},function(e,t,r){"use strict";(function(t){const n=r(4),i=r(1);e.exports=e=>{if(t.isBuffer(e))try{e=new n(e)}catch(a){throw i(a,"ERR_INVALID_CID")}if(n.isCID(e))return{cid:e,path:void 0};e.startsWith("/ipfs/")&&(e=e.substring("/ipfs/".length));const r=e.split("/");let s,o;try{s=new n(r.shift())}catch(a){throw i(a,"ERR_INVALID_CID")}return r.length&&(o="/".concat(r.join("/"))),{cid:s,path:o}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";function n(e,t){return void 0===t?t=>n(e,t):t[Symbol.asyncIterator]?async function*(e,t){let r=[];for await(const n of t)r.push(n),r.length===e&&(yield r,r=[]);r.length>0&&(yield r)}(e,t):function*(e,t){let r=[];for(const n of t)r.push(n),r.length===e&&(yield r,r=[]);r.length>0&&(yield r)}(e,t)}function i(e){if("function"==typeof e.next)return e;if("function"==typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"==typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();throw new TypeError('"values" does not to conform to any of the iterator or iterable protocols')}function s(){let e,t;return{promise:new Promise((r,n)=>{t=r,e=n}),reject:e,resolve:t}}function o(e,t){const r=i(t),n=[],o=[];let a=!1,c=!1;async function u(){if(!c&&!(a||n.length>=e)){a=!0;try{const{done:e,value:t}=await r.next();e?c=!0:n.push({value:t})}catch(t){c=!0,n.push({error:t})}!function(){for(;o.length>0&&n.length>0;){const e=o.shift(),{error:t,value:r}=n.shift();t?e.reject(t):e.resolve({done:!1,value:r})}for(;o.length>0&&c;){const{resolve:e}=o.shift();e({done:!0,value:void 0})}}(),a=!1,u()}}const f={next:async function(){if(n.length>0){const{error:e,value:t}=n.shift();if(e)throw e;return u(),{done:!1,value:t}}if(c)return{done:!0,value:void 0};const e=s();return o.push(e),u(),e.promise},[Symbol.asyncIterator]:()=>f};return f}function a(e,t){return void 0===t?t=>a(e,t):t[Symbol.asyncIterator]?o(e,t):function*(e,t){const r=[];let n;try{for(const n of t)r.push(n),r.length<=e||(yield r.shift())}catch(i){n=i}for(const s of r)yield s;if(n)throw n}(e,t)}function c(e){return e[Symbol.asyncIterator]?async function(e){const t=[];for await(const r of e)t.push(r);return t}(e):Array.from(e)}function u(...e){return e.find(e=>void 0!==e[Symbol.asyncIterator])?async function*(e){for await(const t of e)yield*t}(e):function*(e){for(const t of e)yield*t}(e)}function f(e){if(e[Symbol.asyncIterator])return async function(e){for await(const t of e);}(e);for(const t of e);}async function*h(e,t){for await(const r of t)await e(r)&&(yield r)}function l(e,t){return void 0===t?t=>h(e,t):h(e,t)}async function*d(e){for await(const t of e)t&&"string"!=typeof t&&(t[Symbol.iterator]||t[Symbol.asyncIterator])?yield*d(t):yield t}async function*p(e,t){for await(const r of t)yield await e(r)}function b(e,t){return void 0===t?t=>p(e,t):p(e,t)}function y(e,t){return void 0===t?t=>y(e,t):l(e=>null!=e,d(b(e,t)))}function m(e,t,r){const n=i(r),o=[],a=[];let c=!1,u=!1,f=0,h=null;function l(){for(;a.length>0&&o.length>0;){const{resolve:e}=a.shift();e({done:!1,value:o.shift()})}for(;a.length>0&&0===f&&c;){const{resolve:e,reject:t}=a.shift();h?(t(h),h=null):e({done:!0,value:void 0})}}async function d(){if(c)l();else if(!(u||f+o.length>=e)){u=!0,f++;try{const{done:e,value:r}=await n.next();e?(c=!0,f--,l()):async function(e){try{const r=await t(e);if(r&&r[Symbol.asyncIterator])for await(const e of r)o.push(e);else o.push(r)}catch(r){c=!0,h=r}f--,l(),d()}(r)}catch(r){c=!0,f--,h=r,l()}u=!1,d()}}const p={next:async function(){if(0===o.length){const e=s();return a.push(e),d(),e.promise}const e=o.shift();return d(),{done:!1,value:e}},[Symbol.asyncIterator]:()=>p};return p}function g(e,t,r){return void 0===t?(t,r)=>r?g(e,t,r):g(e,t):void 0===r?r=>g(e,t,r):l(e=>null!=e,d(m(e,t,r)))}async function v(e){return new Promise(t=>{e.once("readable",()=>{t()})})}function w(e){return"function"==typeof e[Symbol.asyncIterator]?e:async function*(e){for(;;){const t=e.read();if(null===t){if(e._readableState.ended)break;await v(e)}else yield t}}(e)}async function*_(...e){const t=new Set(e.map(i));for(;t.size>0;)for(const e of t){const r=await e.next();r.done?t.delete(e):yield r.value}}function E(e,...t){let r=e();for(const n of t)r=n(r);return r}function k(e,t,r){return void 0===t?(t,r)=>k(e,t,r):void 0===r?r=>k(e,t,r):async function*(e,t,r){let n=null;const s=i(E(()=>r,a(1),(async function*(e){for await(const t of e){if(n)return;yield t}}),b(e=>({value:t(e)})),a(e)));for(;;){const{value:e,done:t}=await s.next();if(t)break;try{const t=await e.value;n||(yield t)}catch(o){n=o}}if(n)throw n}(e,t,r)}function S(e,t,r){return void 0===t?(t,r)=>r?S(e,t,r):S(e,t):void 0===r?r=>S(e,t,r):l(e=>null!=e,d(k(e,t,r)))}async function*A(...e){const t=e.map(i),r=new Set,n=new Map;let s=null,o=null,a=null;const c=e=>{s=e,o&&o(e)},u=e=>{a&&a(e)},f=e=>{const t=Promise.resolve(e.next()).then(async({done:i,value:s})=>{i||n.set(e,s),r.delete(t)});r.add(t),t.then(u,c)};for(const i of t)f(i);for(;;){if(0===r.size&&0===n.size)return;await new Promise((e,t)=>{if(s&&t(s),n.size>0)return e();a=e,o=t});for(const[e,t]of n)n.delete(e),yield t,f(e)}}async function I(e,t,r){let n=t;for await(const i of r)n=await e(n,i);return n}function T(e,t,r){return void 0===t?(t,r)=>r?I(e,t,r):T(e,t):void 0===r?r=>T(e,t,r):I(e,t,r)}function R(e,t){return void 0===t?t=>R(e,t):t[Symbol.asyncIterator]?async function*(e,t){let r=0;for await(const n of t)if(yield await n,r++,r>=e)break}(e,t):function*(e,t){let r=0;for(const n of t)if(yield n,r++,r>=e)break}(e,t)}async function*x(e,t){for await(const r of t)await e(r),yield r}function C(e,t){return void 0===t?t=>x(e,t):x(e,t)}function B(e,t){let r=e[0]+t[0],n=e[1]+t[1];if(n>=1e9){const e=n%1e9;r+=(n-e)/1e9,n=e}return[r,n]}function M(e={},t){return void 0===t?t=>M(e,t):void 0!==t[Symbol.asyncIterator]?async function*(e,t){const r=t[Symbol.asyncIterator]();let n=[0,0];for(;;){const t=process.hrtime(),{value:i,done:s}=await r.next(),o=process.hrtime(t);if(n=B(n,o),e.progress&&e.progress(o,n),s)return e.total&&e.total(n),i;yield i}}(e,t):function*(e,t){const r=t[Symbol.iterator]();let n=[0,0];for(;;){const t=process.hrtime(),{value:i,done:s}=r.next(),o=process.hrtime(t);if(n=B(n,o),e.progress&&e.progress(o,n),s)return e.total&&e.total(n),i;yield i}}(e,t)}function N(e,t,r){const n=i(r),o=[],a=[];let c=!1,u=!1,f=0,h=null;function l(){for(;a.length>0&&o.length>0;){const{resolve:e}=a.shift();e({done:!1,value:o.shift()})}for(;a.length>0&&0===f&&c;){const{resolve:e,reject:t}=a.shift();h?(t(h),h=null):e({done:!0,value:void 0})}}async function d(){if(c)l();else if(!(u||f+o.length>=e)){u=!0,f++;try{const{done:e,value:r}=await n.next();e?(c=!0,f--,l()):async function(e){try{const r=await t(e);o.push(r)}catch(r){c=!0,h=r}f--,l(),d()}(r)}catch(r){c=!0,f--,h=r,l()}u=!1,d()}}const p={next:async function(){if(0===o.length){const e=s();return a.push(e),d(),e.promise}const e=o.shift();return d(),{done:!1,value:e}},[Symbol.asyncIterator]:()=>p};return p}function P(e,t,r){return void 0===t?(t,r)=>r?P(e,t,r):P(e,t):void 0===r?r=>P(e,t,r):N(e,t,r)}async function O(e,t){let r=null,n=null,i=null;const s=e=>{r=e,n&&n(e)},o=()=>{i&&i()};e.once("error",s);for await(const a of t)if(!1===e.write(a)&&await new Promise((t,s)=>{if(r)return s(r);e.once("drain",o),i=t,n=s}),r)break;if(e.removeListener("error",s),e.removeListener("drain",o),r)throw r}function D(e,t){return void 0===t?t=>O(e,t):O(e,t)}r.r(t),r.d(t,"batch",(function(){return n})),r.d(t,"buffer",(function(){return a})),r.d(t,"collect",(function(){return c})),r.d(t,"concat",(function(){return u})),r.d(t,"consume",(function(){return f})),r.d(t,"filter",(function(){return l})),r.d(t,"flatMap",(function(){return y})),r.d(t,"flatTransform",(function(){return g})),r.d(t,"flatten",(function(){return d})),r.d(t,"fromStream",(function(){return w})),r.d(t,"getIterator",(function(){return i})),r.d(t,"map",(function(){return b})),r.d(t,"merge",(function(){return _})),r.d(t,"parallelFlatMap",(function(){return S})),r.d(t,"parallelMap",(function(){return k})),r.d(t,"parallelMerge",(function(){return A})),r.d(t,"pipeline",(function(){return E})),r.d(t,"reduce",(function(){return T})),r.d(t,"take",(function(){return R})),r.d(t,"tap",(function(){return C})),r.d(t,"time",(function(){return M})),r.d(t,"transform",(function(){return P})),r.d(t,"writeToStream",(function(){return D}))},function(e,t,r){"use strict";const{DAGNode:n,DAGLink:i}=r(12),s=r(4),{default:o}=r(51),{Key:a}=r(7),c=r(1),u=r(11),f=r(240),h=r(2),{Buffer:l}=r(0),{cidToString:d}=r(142),p=r(535),{Errors:b}=r(7),y=b.notFoundError().code,m=new a("/local/pins");const g={direct:"direct",recursive:"recursive",indirect:"indirect",all:"all"};class v{constructor(e,t){this.repo=e,this.dag=t,this.log=h("ipfs:pin"),this.pinset=p(t),this.directPins=new Set,this.recursivePins=new Set}async _walkDag({cid:e,preload:t=!1,onCid:r=(()=>{})}){s.isCID(e)||(e=new s(e));const n=e=>async()=>{const{value:s}=await this.dag.get(e,{preload:t});if(r(e),"dag-pb"===e.codec)i.addAll(s.Links.map(e=>n(e.Hash)));else if("dag-cbor"===e.codec)for(const[e,t]of f(s))i.add(n(t))},i=new o({concurrency:300});i.add(n(e)),await i.onIdle()}directKeys(){return Array.from(this.directPins,e=>new s(e).buffer)}recursiveKeys(){return Array.from(this.recursivePins,e=>new s(e).buffer)}async getIndirectKeys({preload:e}){const t=new Set;for(const r of this.recursiveKeys())await this._walkDag({cid:new s(r),preload:e||!1,onCid:e=>{e=e.toString(),this.recursivePins.has(e)||t.add(e)}});return Array.from(t)}async flushPins(){const[e,t]=await Promise.all([this.pinset.storeSet(this.directKeys()).then(e=>new i(g.direct,e.node.size,e.cid)),this.pinset.storeSet(this.recursiveKeys()).then(e=>new i(g.recursive,e.node.size,e.cid)),this.dag.put(new n(l.alloc(0)),{version:0,format:u.DAG_PB,hashAlg:u.SHA2_256,preload:!1})]),r=new n(l.alloc(0),[e,t]),s=await this.dag.put(r,{version:0,format:u.DAG_PB,hashAlg:u.SHA2_256,preload:!1});await this.repo.datastore.put(m,s.buffer),this.log("Flushed pins with root: ".concat(s))}async load(){if(!await this.repo.datastore.has(m))return;const e=await this.repo.datastore.get(m),t=await this.dag.get(new s(e),{preload:!1}),[r,n]=await Promise.all([this.pinset.loadSet(t.value,g.recursive),this.pinset.loadSet(t.value,g.direct)]);this.directPins=new Set(n.map(e=>d(e))),this.recursivePins=new Set(r.map(e=>d(e))),this.log("Loaded pins from the datastore")}async isPinnedWithType(e,t){const r=d(e),{recursive:n,direct:i,all:a}=g;if((t===n||t===a)&&this.recursivePins.has(r))return{key:r,pinned:!0,reason:n};if(t===n)return{key:r,pinned:!1};if((t===i||t===a)&&this.directPins.has(r))return{key:r,pinned:!0,reason:i};if(t===i)return{key:r,pinned:!1};const c=new o({concurrency:300});let u;return c.addAll(this.recursiveKeys().map(e=>(e=new s(e),async()=>{await this.pinset.hasDescendant(e,r)&&(u=e,c.clear())}))),await c.onIdle(),{key:r,pinned:Boolean(u),reason:u}}async getInternalBlocks(){let e;try{e=await this.repo.datastore.get(m)}catch(n){if(n.code===y)return this.log("No pinned blocks"),[];throw new Error("Could not get pin sets root from datastore: ".concat(n.message))}const t=new s(e),r=await this.dag.get(t,"",{preload:!1});return(await this.pinset.getInternalCids(r.value)).concat(t)}async fetchCompleteDag(e,t){await this._walkDag({cid:e,preload:t.preload})}static checkPinType(e){if("string"!=typeof e||!Object.keys(g).includes(e))return function(e){const t="Invalid type '".concat(e,"', must be one of {direct, indirect, recursive, all}");return c(new Error(t),"ERR_INVALID_PIN_TYPE")}(e)}}v.PinTypes=g,e.exports=v},function(e,t,r){"use strict";const n=r(37).BigNumber;t.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7},t.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36},t.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31},t.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23},t.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")},t.SHIFT32=Math.pow(2,32),t.SHIFT16=Math.pow(2,16),t.MAX_SAFE_HIGH=2097151,t.NEG_ONE=new n(-1),t.TEN=new n(10),t.TWO=new n(2),t.PARENT={ARRAY:0,OBJECT:1,MAP:2,TAG:3,BYTE_STRING:4,UTF8_STRING:5}},function(e,t,r){"use strict";var n,i,s,o=r(571),a="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";function c(){s=!1}function u(e){if(e){if(e!==n){if(e.length!==a.length)throw new Error("Custom alphabet for shortid must be "+a.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter((function(e,t,r){return t!==r.lastIndexOf(e)}));if(t.length)throw new Error("Custom alphabet for shortid must be "+a.length+" unique characters. These characters were not unique: "+t.join(", "));n=e,c()}}else n!==a&&(n=a,c())}function f(){return s||(s=function(){n||u(a);for(var e,t=n.split(""),r=[],i=o.nextValue();t.length>0;)i=o.nextValue(),e=Math.floor(i*t.length),r.push(t.splice(e,1)[0]);return r.join("")}())}e.exports={get:function(){return n||a},characters:function(e){return u(e),n},seed:function(e){o.seed(e),i!==e&&(c(),i=e)},lookup:function(e){return f()[e]},shuffled:f}},function(e,t,r){"use strict";const n=r(44),i=r(38),s=r(32),o=r(2)("ipfs:mfs:stat"),a=r(1),{withTimeoutOption:c}=r(3),u={withLocal:!1,signal:void 0};e.exports=e=>c((async function(t,r){r=n(r,u),o("Fetching stats for ".concat(t));const{type:c,cid:h,mfsPath:l}=await i(e,t,r),d="ipfs"===c&&h?h:l;let p;try{p=await s(d,e.ipld)}catch(b){if("ERR_NOT_FOUND"===b.code)throw a(new Error("".concat(t," does not exist")),"ERR_NOT_FOUND");throw b}if(!f[p.cid.codec])throw new Error("Cannot stat codec ".concat(p.cid.codec));return f[p.cid.codec](p,r)}));const f={raw:e=>({cid:e.cid,size:e.node.length,cumulativeSize:e.node.length,blocks:0,type:"file",local:void 0,sizeLocal:void 0,withLocality:!1}),"dag-pb":e=>{const t=e.node.Links.length,r=e.node.size,n=e.node.size,i={cid:e.cid,size:r,cumulativeSize:n,blocks:t,local:void 0,sizeLocal:void 0,withLocality:!1};return e.unixfs&&(i.size=e.unixfs.fileSize(),"hamt-sharded-directory"===e.unixfs.type?i.type="directory":i.type=e.unixfs.type,i.mode=e.unixfs.mode,e.unixfs.isDirectory()&&(i.size=0,i.cumulativeSize=e.node.size),"file"===i.type&&(i.blocks=e.unixfs.blockSizes.length),e.unixfs.mtime&&(i.mtime=e.unixfs.mtime)),i},"dag-cbor":e=>({cid:e.cid,local:void 0,sizeLocal:void 0,withLocality:!1}),identity:e=>({cid:e.cid,size:e.node.digest.length,cumulativeSize:e.node.digest.length,blocks:0,type:"file",local:void 0,sizeLocal:void 0,withLocality:!1})}},function(e,t,r){"use strict";const{Adapter:n,utils:i}=r(7),s=i.map;e.exports=class extends n{constructor(e,t){super(),this.child=e,this.transform=t}open(){return this.child.open()}put(e,t,r){return this.child.put(this.transform.convert(e),t,r)}get(e,t){return this.child.get(this.transform.convert(e),t)}has(e,t){return this.child.has(this.transform.convert(e),t)}delete(e,t){return this.child.delete(this.transform.convert(e),t)}batch(){const e=this.child.batch();return{put:(t,r)=>{e.put(this.transform.convert(t),r)},delete:t=>{e.delete(this.transform.convert(t))},commit:t=>e.commit(t)}}query(e,t){return s(this.child.query(e,t),e=>(e.key=this.transform.invert(e.key),e))}close(){return this.child.close()}}},function(e,t,r){"use strict";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,r){"use strict";const n=r(309);e.exports=async(e,t,{concurrency:r=1/0,stopOnError:i=!0}={})=>new Promise((s,o)=>{if("function"!=typeof t)throw new TypeError("Mapper function is required");if(!Number.isSafeInteger(r)&&r!==1/0||!(r>=1))throw new TypeError("Expected `concurrency` to be an integer from 1 and up or `Infinity`, got `".concat(r,"` (").concat(typeof r,")"));const a=[],c=[],u=e[Symbol.iterator]();let f=!1,h=!1,l=0,d=0;const p=()=>{if(f)return;const e=u.next(),r=d;if(d++,e.done)return h=!0,void(0===l&&(i||0===c.length?s(a):o(new n(c))));l++,(async()=>{try{const n=await e.value;a[r]=await t(n,r),l--,p()}catch(n){i?(f=!0,o(n)):(c.push(n),l--,p())}})()};for(let e=0;e<r&&(p(),!h);e++);})},function(e,t,r){"use strict";const n=r(1),i=r(6),{codes:{ERR_INVALID_PARAMETERS:s}}=r(20),o=e=>e;e.exports=class{constructor({peerStore:e,eventName:t,eventProperty:r,eventTransformer:n=o}){this._ps=e,this.eventName=t,this.eventProperty=r,this.eventTransformer=n,this.data=new Map}set(e,t){throw n(new Error("set must be implemented by the subclass"),"ERR_NOT_IMPLEMENTED")}_setData(e,t,{emit:r=!0}={}){const n=e.toB58String();this.data.set(n,t),r&&this._emit(e,t)}_emit(e,t){this._ps.emit(this.eventName,{peerId:e,[this.eventProperty]:this.eventTransformer(t)})}get(e){if(!i.isPeerId(e))throw n(new Error("peerId must be an instance of peer-id"),s);const t=this.data.get(e.toB58String());return t?[...t]:void 0}delete(e){if(!i.isPeerId(e))throw n(new Error("peerId must be an instance of peer-id"),s);return!!this.data.delete(e.toB58String())&&(this._emit(e,[]),!0)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(30);e.exports=async function*(e){for await(const t of e)n.isBuffer(t)?yield t:i.isBufferList(t)?yield t.slice():yield n.from(t)},e.exports.toBuffer=e.exports,e.exports.toList=async function*(e){for await(const t of e)n.isBuffer(t)?yield(new i).append(t):i.isBufferList(t)?yield t:yield(new i).append(n.from(t))}},function(e,t,r){"use strict";t.encode=function(e){var t="";for(var r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t},t.decode=function(e){for(var t={},r=e.split("&"),n=0,i=r.length;n<i;n++){var s=r[n].split("=");t[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return t}},function(e,t,r){"use strict";e.exports=function(e,t){var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.encode0=function(e){return n.Buffer.concat([e.ne,e.ciphertext])},t.encode1=function(e){return n.Buffer.concat([e.ne,e.ns,e.ciphertext])},t.encode2=function(e){return n.Buffer.concat([e.ns,e.ciphertext])},t.decode0=function(e){if(e.length<32)throw new Error("Cannot decode stage 0 MessageBuffer: length less than 32 bytes.");return{ne:e.slice(0,32),ciphertext:e.slice(32,e.length),ns:n.Buffer.alloc(0)}},t.decode1=function(e){if(e.length<80)throw new Error("Cannot decode stage 1 MessageBuffer: length less than 80 bytes.");return{ne:e.slice(0,32),ns:e.slice(32,80),ciphertext:e.slice(80,e.length)}},t.decode2=function(e){if(e.length<48)throw new Error("Cannot decode stage 2 MessageBuffer: length less than 48 bytes.");return{ne:n.Buffer.alloc(0),ns:e.slice(0,48),ciphertext:e.slice(48,e.length)}},t.uint16BEDecode=t.uint16BEEncode=void 0;var n=r(0);const i=(e,t,r)=>((t=t||n.Buffer.allocUnsafe(2)).writeUInt16BE(e,r),t);t.uint16BEEncode=i,i.bytes=2;const s=e=>{if(e.length<2)throw RangeError("Could not decode int16BE");return e.readUInt16BE(0)};t.uint16BEDecode=s,s.bytes=2},function(e,t,r){"use strict";const n=r(138);class i extends Error{constructor(e){super(e),this.name="TimeoutError"}}const s=(e,t,r)=>new Promise((s,o)=>{if("number"!=typeof t||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t===1/0)return void s(e);const a=setTimeout(()=>{if("function"==typeof r){try{s(r())}catch(c){o(c)}return}const n="string"==typeof r?r:"Promise timed out after ".concat(t," milliseconds"),a=r instanceof Error?r:new i(n);"function"==typeof e.cancel&&e.cancel(),o(a)},t);n(e.then(s,o),()=>{clearTimeout(a)})});e.exports=s,e.exports.default=s,e.exports.TimeoutError=i},function(e,t,r){"use strict";const{sortBy:n}=r(45),i=r(1045);class s{constructor(e){this.set=new Map,this._stats=e}get length(){return this.set.size}add(e,t,n){const s=r(87),o=e.toString("base58btc"),a=this.set.get(o);a?(a.inc(),a.priority=t,a.wantType===s.WantType.Have&&n===s.WantType.Block&&(a.wantType=n)):(this.set.set(o,new i(e,t,n)),this._stats&&this._stats.push(null,"wantListSize",1))}remove(e){const t=e.toString("base58btc"),r=this.set.get(t);r&&(r.dec(),r.hasRefs()||(this.set.delete(t),this._stats&&this._stats.push(null,"wantListSize",-1)))}removeForce(e){this.set.has(e)&&this.set.delete(e)}forEach(e){return this.set.forEach(e)}entries(){return this.set.entries()}sortedEntries(){return new Map(n(e=>e[1].key,Array.from(this.set.entries())))}contains(e){const t=e.toString("base58btc");return this.set.get(t)}}s.Entry=i,e.exports=s},function(e,t,r){"use strict";e.exports={maxProvidersPerRequest:3,providerRequestTimeout:1e4,hasBlockTimeout:15e3,provideTimeout:15e3,kMaxPriority:Math.pow(2,31)-1,maxListeners:1e3,wantlistSendDebounceMs:1}},function(e,t,r){"use strict";const n=r(368),i=r(26).bind({ignoreUndefined:!0}),{URL:s,URLSearchParams:o}=r(88),a=r(370),c=r(41),u=r(70),f=n.Request,h=n.Headers;class l extends Error{constructor(){super("Request timed out"),this.name="TimeoutError"}}class d extends Error{constructor(e){super(e.statusText),this.name="HTTPError",this.response=e}}const p={headers:{},throwHttpErrors:!0,credentials:"same-origin",transformSearchParams:e=>e};class b{constructor(e={}){this.opts=i(p,e)}async fetch(e,t={}){const r=i(this.opts,t);if(r.headers=new h(r.headers),"string"!=typeof e&&!(e instanceof s||e instanceof f))throw new TypeError("`resource` must be a string, URL, or Request");if(r.base&&"string"==typeof r.base&&"string"==typeof e){if(e.startsWith("/"))throw new Error("`resource` must not begin with a slash when using `base`");r.base.endsWith("/")||(r.base+="/"),e=r.base+e}const a=new s(e,r.base);r.searchParams&&(a.search=r.transformSearchParams(new o(r.searchParams))),void 0!==r.json&&(r.body=JSON.stringify(r.json),r.headers.set("content-type","application/json"));const p=new c,b=u([p.signal,r.signal]),v=await((e,t,r)=>{if(void 0===t)return e;const n=Date.now(),i=()=>Date.now()-n>=t;return new Promise((n,s)=>{const o=setTimeout(()=>{i()&&(s(new l),r.abort())},t),a=e=>t=>{clearTimeout(o),i()?s(new l):e(t)};e.then(a(n),a(s))})})(n(a,{...r,signal:b,timeout:void 0}),r.timeout,p);if(!v.ok&&r.throwHttpErrors)throw r.handleError&&await r.handleError(v),new d(v);return v.iterator=function(){const e=m(v.body);if(!g(e))throw new Error("Can't convert fetch body into a Async Iterator:");return e},v.ndjson=async function*(){for await(const e of y(v.iterator()))t.transform?yield t.transform(e):yield e},v}post(e,t={}){return this.fetch(e,{...t,method:"POST"})}get(e,t={}){return this.fetch(e,{...t,method:"GET"})}put(e,t={}){return this.fetch(e,{...t,method:"PUT"})}delete(e,t={}){return this.fetch(e,{...t,method:"DELETE"})}options(e,t={}){return this.fetch(e,{...t,method:"OPTIONS"})}}const y=async function*(e){const t=new a;let r="";for await(const n of e){r+=t.decode(n,{stream:!0});const e=r.split(/\r?\n/);for(let t=0;t<e.length-1;t++){const r=e[t].trim();r.length>0&&(yield JSON.parse(r))}r=e[e.length-1]}r+=t.decode(),r=r.trim(),0!==r.length&&(yield JSON.parse(r))},m=function(e){if(g(e)){if(Object.prototype.hasOwnProperty.call(e,"readable")&&Object.prototype.hasOwnProperty.call(e,"writable")){const t=e[Symbol.asyncIterator](),r={next:t.next.bind(t),return:()=>(e.destroy(),t.return()),[Symbol.asyncIterator]:()=>r};return r}return e}const t=e.getReader();return{next:()=>t.read(),return:()=>(t.releaseLock(),{}),[Symbol.asyncIterator](){return this}}},g=e=>"object"==typeof e&&null!==e&&"function"==typeof e[Symbol.asyncIterator];b.HTTPError=d,b.TimeoutError=l,b.streamToAsyncIterator=m,b.post=(e,t)=>new b(t).post(e,t),b.get=(e,t)=>new b(t).get(e,t),b.put=(e,t)=>new b(t).put(e,t),b.delete=(e,t)=>new b(t).delete(e,t),b.options=(e,t)=>new b(t).options(e,t),e.exports=b},function(e,t,r){"use strict";t.defined=function(e){return null!=e&&("number"!=typeof e||!isNaN(e))}},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){"use strict";var n=r(5);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.des.Algorithm(e,t)}))}r(203),r(204),r(9),e.exports=n.des=n.des||{},n.des.startEncrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createEncryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!1,mode:t})},n.des.startDecrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createDecryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!0,mode:t})},n.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return d(r._keys,e,t,!1)},decrypt:function(e,t){return d(r._keys,e,t,!0)}}}),r._init=!1},n.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=n.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],i=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],s=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],o=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],a=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],c=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],f=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],h=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],l=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],d=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],p=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],b=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=e.length()>8?3:1,m=[],g=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],v=0,w=0;w<y;w++){var _=e.getInt32(),E=e.getInt32();_^=(t=252645135&(_>>>4^E))<<4,_^=t=65535&((E^=t)>>>-16^_),_^=(t=858993459&(_>>>2^(E^=t<<-16)))<<2,_^=t=65535&((E^=t)>>>-16^_),_^=(t=1431655765&(_>>>1^(E^=t<<-16)))<<1,_^=t=16711935&((E^=t)>>>8^_),t=(_^=(t=1431655765&(_>>>1^(E^=t<<8)))<<1)<<8|(E^=t)>>>20&240,_=E<<24|E<<8&16711680|E>>>8&65280|E>>>24&240,E=t;for(var k=0;k<g.length;++k){g[k]?(_=_<<2|_>>>26,E=E<<2|E>>>26):(_=_<<1|_>>>27,E=E<<1|E>>>27);var S=r[(_&=-15)>>>28]|n[_>>>24&15]|i[_>>>20&15]|s[_>>>16&15]|o[_>>>12&15]|a[_>>>8&15]|c[_>>>4&15],A=u[(E&=-15)>>>28]|f[E>>>24&15]|h[E>>>20&15]|l[E>>>16&15]|d[E>>>12&15]|p[E>>>8&15]|b[E>>>4&15];t=65535&(A>>>16^S),m[v++]=S^t,m[v++]=A^t<<16}}return m}(t),this._init=!0}},i("DES-ECB",n.cipher.modes.ecb),i("DES-CBC",n.cipher.modes.cbc),i("DES-CFB",n.cipher.modes.cfb),i("DES-OFB",n.cipher.modes.ofb),i("DES-CTR",n.cipher.modes.ctr),i("3DES-ECB",n.cipher.modes.ecb),i("3DES-CBC",n.cipher.modes.cbc),i("3DES-CFB",n.cipher.modes.cfb),i("3DES-OFB",n.cipher.modes.ofb),i("3DES-CTR",n.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],o=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],a=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],u=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],f=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],h=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],l=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function d(e,t,r,n){var i,d,p=32===e.length?3:9;i=3===p?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var b=t[0],y=t[1];b^=(d=252645135&(b>>>4^y))<<4,b^=(d=65535&(b>>>16^(y^=d)))<<16,b^=d=858993459&((y^=d)>>>2^b),b^=d=16711935&((y^=d<<2)>>>8^b),b=(b^=(d=1431655765&(b>>>1^(y^=d<<8)))<<1)<<1|b>>>31,y=(y^=d)<<1|y>>>31;for(var m=0;m<p;m+=3){for(var g=i[m+1],v=i[m+2],w=i[m];w!=g;w+=v){var _=y^e[w],E=(y>>>4|y<<28)^e[w+1];d=b,b=y,y=d^(o[_>>>24&63]|c[_>>>16&63]|f[_>>>8&63]|l[63&_]|s[E>>>24&63]|a[E>>>16&63]|u[E>>>8&63]|h[63&E])}d=b,b=y,y=d}y=y>>>1|y<<31,y^=d=1431655765&((b=b>>>1|b<<31)>>>1^y),y^=(d=16711935&(y>>>8^(b^=d<<1)))<<8,y^=(d=858993459&(y>>>2^(b^=d)))<<2,y^=d=65535&((b^=d)>>>16^y),y^=d=252645135&((b^=d<<16)>>>4^y),b^=d<<4,r[0]=b,r[1]=y}function p(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var s=null;r instanceof n.util.ByteBuffer&&(s=r,r={}),(r=r||{}).output=s,r.iv=e,i.call(t,r)},t}},function(e,t){},function(e,t,r){"use strict";var n=r(5);r(9);var i=e.exports=n.pem=n.pem||{};function s(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i<e.values.length;++i)r.push(e.values[i].replace(/^(\S+\r\n)/,n));t+=r.join(",")+"\r\n";var s=0,o=-1;for(i=0;i<t.length;++i,++s)if(s>65&&-1!==o){var a=t[o];","===a?(++o,t=t.substr(0,o)+"\r\n "+t.substr(o)):t=t.substr(0,o)+"\r\n"+a+t.substr(o+1),s=i-o-1,o=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(o=i);return t}function o(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var r,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=s(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=s(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),i+=s(r)),e.headers)for(var o=0;o<e.headers.length;++o)i+=s(e.headers[o]);return e.procType&&(i+="\r\n"),i+=n.util.encode64(e.body,t.maxline||64)+"\r\n",i+="-----END "+e.type+"-----\r\n"},i.decode=function(e){for(var t,r=[],i=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,s=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,a=/\r?\n/;t=i.exec(e);){var c={type:t[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:n.util.decode64(t[3])};if(r.push(c),t[2]){for(var u=t[2].split(a),f=0;t&&f<u.length;){for(var h=u[f].replace(/\s+$/,""),l=f+1;l<u.length;++l){var d=u[l];if(!/\s/.test(d[0]))break;h+=d,f=l}if(t=h.match(s)){for(var p={name:t[1],values:[]},b=t[2].split(","),y=0;y<b.length;++y)p.values.push(o(b[y]));if(c.procType)if(c.contentDomain||"Content-Domain"!==p.name)if(c.dekInfo||"DEK-Info"!==p.name)c.headers.push(p);else{if(0===p.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');c.dekInfo={algorithm:b[0],parameters:b[1]||null}}else c.contentDomain=b[0]||"";else{if("Proc-Type"!==p.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==p.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');c.procType={version:b[0],type:b[1]}}}++f}if("ENCRYPTED"===c.procType&&!c.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===r.length)throw new Error("Invalid PEM formatted message.");return r}},function(e,t,r){"use strict";var n=r(5);r(46),r(9);var i=e.exports=n.sha512=n.sha512||{};n.md.sha512=n.md.algorithms.sha512=i;var s=n.sha384=n.sha512.sha384=n.sha512.sha384||{};s.create=function(){return i.create("SHA-384")},n.md.sha384=n.md.algorithms.sha384=s,n.sha512.sha256=n.sha512.sha256||{create:function(){return i.create("SHA-512/256")}},n.md["sha512/256"]=n.md.algorithms["sha512/256"]=n.sha512.sha256,n.sha512.sha224=n.sha512.sha224||{create:function(){return i.create("SHA-512/224")}},n.md["sha512/224"]=n.md.algorithms["sha512/224"]=n.sha512.sha224,i.create=function(e){if(a||(o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),128),c=[[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]],(u={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],u["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],u["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],u["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],a=!0),void 0===e&&(e="SHA-512"),!(e in u))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=u[e],r=null,i=n.util.createBuffer(),s=new Array(80),h=0;h<80;++h)s[h]=new Array(2);var l=64;switch(e){case"SHA-384":l=48;break;case"SHA-512/256":l=32;break;case"SHA-512/224":l=28}var d={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:l,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){d.messageLength=0,d.fullMessageLength=d.messageLength128=[];for(var e=d.messageLengthSize/4,s=0;s<e;++s)d.fullMessageLength.push(0);i=n.util.createBuffer(),r=new Array(t.length);for(s=0;s<t.length;++s)r[s]=t[s].slice(0);return d}};return d.start(),d.update=function(e,t){"utf8"===t&&(e=n.util.encodeUtf8(e));var o=e.length;d.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var a=d.fullMessageLength.length-1;a>=0;--a)d.fullMessageLength[a]+=o[1],o[1]=o[0]+(d.fullMessageLength[a]/4294967296>>>0),d.fullMessageLength[a]=d.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return i.putBytes(e),f(r,s,i),(i.read>2048||0===i.length())&&i.compact(),d},d.digest=function(){var t=n.util.createBuffer();t.putBytes(i.bytes());var a,c=d.fullMessageLength[d.fullMessageLength.length-1]+d.messageLengthSize&d.blockLength-1;t.putBytes(o.substr(0,d.blockLength-c));for(var u=8*d.fullMessageLength[0],h=0;h<d.fullMessageLength.length-1;++h)u+=(a=8*d.fullMessageLength[h+1])/4294967296>>>0,t.putInt32(u>>>0),u=a>>>0;t.putInt32(u);var l=new Array(r.length);for(h=0;h<r.length;++h)l[h]=r[h].slice(0);f(l,s,t);var p,b=n.util.createBuffer();p="SHA-512"===e?l.length:"SHA-384"===e?l.length-2:l.length-4;for(h=0;h<p;++h)b.putInt32(l[h][0]),h===p-1&&"SHA-512/224"===e||b.putInt32(l[h][1]);return b},d};var o=null,a=!1,c=null,u=null;function f(e,t,r){for(var n,i,s,o,a,u,f,h,l,d,p,b,y,m,g,v,w,_,E,k,S,A,I,T,R,x,C,B,M,N,P,O,D,L=r.length();L>=128;){for(C=0;C<16;++C)t[C][0]=r.getInt32()>>>0,t[C][1]=r.getInt32()>>>0;for(;C<80;++C)n=(((B=(N=t[C-2])[0])>>>19|(M=N[1])<<13)^(M>>>29|B<<3)^B>>>6)>>>0,i=((B<<13|M>>>19)^(M<<3|B>>>29)^(B<<26|M>>>6))>>>0,s=(((B=(O=t[C-15])[0])>>>1|(M=O[1])<<31)^(B>>>8|M<<24)^B>>>7)>>>0,o=((B<<31|M>>>1)^(B<<24|M>>>8)^(B<<25|M>>>7))>>>0,P=t[C-7],D=t[C-16],M=i+P[1]+o+D[1],t[C][0]=n+P[0]+s+D[0]+(M/4294967296>>>0)>>>0,t[C][1]=M>>>0;for(p=e[0][0],b=e[0][1],y=e[1][0],m=e[1][1],g=e[2][0],v=e[2][1],w=e[3][0],_=e[3][1],E=e[4][0],k=e[4][1],S=e[5][0],A=e[5][1],I=e[6][0],T=e[6][1],R=e[7][0],x=e[7][1],C=0;C<80;++C)f=((E>>>14|k<<18)^(E>>>18|k<<14)^(k>>>9|E<<23))>>>0,h=(I^E&(S^I))>>>0,a=((p>>>28|b<<4)^(b>>>2|p<<30)^(b>>>7|p<<25))>>>0,u=((p<<4|b>>>28)^(b<<30|p>>>2)^(b<<25|p>>>7))>>>0,l=(p&y|g&(p^y))>>>0,d=(b&m|v&(b^m))>>>0,M=x+(((E<<18|k>>>14)^(E<<14|k>>>18)^(k<<23|E>>>9))>>>0)+((T^k&(A^T))>>>0)+c[C][1]+t[C][1],n=R+f+h+c[C][0]+t[C][0]+(M/4294967296>>>0)>>>0,i=M>>>0,s=a+l+((M=u+d)/4294967296>>>0)>>>0,o=M>>>0,R=I,x=T,I=S,T=A,S=E,A=k,E=w+n+((M=_+i)/4294967296>>>0)>>>0,k=M>>>0,w=g,_=v,g=y,v=m,y=p,m=b,p=n+s+((M=i+o)/4294967296>>>0)>>>0,b=M>>>0;M=e[0][1]+b,e[0][0]=e[0][0]+p+(M/4294967296>>>0)>>>0,e[0][1]=M>>>0,M=e[1][1]+m,e[1][0]=e[1][0]+y+(M/4294967296>>>0)>>>0,e[1][1]=M>>>0,M=e[2][1]+v,e[2][0]=e[2][0]+g+(M/4294967296>>>0)>>>0,e[2][1]=M>>>0,M=e[3][1]+_,e[3][0]=e[3][0]+w+(M/4294967296>>>0)>>>0,e[3][1]=M>>>0,M=e[4][1]+k,e[4][0]=e[4][0]+E+(M/4294967296>>>0)>>>0,e[4][1]=M>>>0,M=e[5][1]+A,e[5][0]=e[5][0]+S+(M/4294967296>>>0)>>>0,e[5][1]=M>>>0,M=e[6][1]+T,e[6][0]=e[6][0]+I+(M/4294967296>>>0)>>>0,e[6][1]=M>>>0,M=e[7][1]+x,e[7][0]=e[7][0]+R+(M/4294967296>>>0)>>>0,e[7][1]=M>>>0,L-=128}}},function(e,t,r){"use strict";const n=r(410),i=r(1);e.exports=function(e){if(isNaN(e)||e<=0)throw i(new Error("random bytes length must be a Number bigger than 0"),"ERR_INVALID_LENGTH");return n(e)}},function(e,t,r){"use strict";const{Buffer:n}=r(0);r(9),r(91);const i=r(5);t.bigIntegerToUintBase64url=(e,r)=>{let i=n.from(e.abs().toByteArray());if(i=0===i[0]?i.slice(1):i,null!=r){if(i.length>r)throw new Error("byte array longer than desired length");i=n.concat([n.alloc(r-i.length),i])}return t.bufferToBase64url(i)},t.bufferToBase64url=e=>e.toString("base64").split("=")[0].replace(/\+/g,"-").replace(/\//g,"_"),t.base64urlToBigInteger=e=>{const r=t.base64urlToBuffer(e);return new i.jsbn.BigInteger(r.toString("hex"),16)},t.base64urlToBuffer=(e,t)=>{e=(e+"===".slice((e.length+3)%4)).replace(/-/g,"+").replace(/_/g,"/");let r=n.from(e,"base64");if(null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=n.concat([n.alloc(t-r.length),r])}return r}},function(e,t,r){"use strict";const n=r(27),i=r(206);e.exports={export:async function(e,t){const r=i.create(),s=await r.encrypt(e,t);return n.names.base64.encode(s)}}},function(e,t,r){"use strict";var n,i=t,s=r(126),o=r(215),a=r(29).assert;function c(e){"short"===e.type?this.curve=new o.short(e):"edwards"===e.type?this.curve=new o.edwards(e):this.curve=new o.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var r=new c(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=c,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:s.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:s.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:s.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:s.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:s.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r(433)}catch(f){n=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:s.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},function(e,t,r){"use strict";var n=t;n.utils=r(31),n.common=r(74),n.sha=r(427),n.ripemd=r(431),n.hmac=r(432),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},function(e,t,r){"use strict";function n(e){if("number"==typeof e){if(n.codes[e])return n.codes[e];throw new Error("no protocol with code: "+e)}if("string"==typeof e||e instanceof String){if(n.names[e])return n.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}const i=-1;function s(e,t,r,n,i){return{code:e,size:t,name:r,resolvable:Boolean(n),path:Boolean(i)}}n.lengthPrefixedVarSize=i,n.V=i,n.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,"ipfs"],[421,i,"p2p"],[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"],[777,i,"memory"]],n.names={},n.codes={},n.table.map(e=>{const t=s.apply(null,e);n.codes[t.code]=t,n.names[t.name]=t}),n.object=s,e.exports=n},function(e,t,r){"use strict";const n=r(223),i=r(26).bind({ignoreUndefined:!0}),s={chunker:"fixed",strategy:"balanced",rawLeaves:!1,onlyHash:!1,reduceSingleLeafToSelf:!0,codec:"dag-pb",hashAlg:"sha2-256",leafType:"file",cidVersion:0,progress:()=>()=>{},shardSplitThreshold:1e3,fileImportConcurrency:50,blockWriteConcurrency:10,minChunkSize:262144,maxChunkSize:262144,avgChunkSize:262144,window:16,polynomial:0x3df305dfb2a804,maxChildrenPerNode:174,layerRepeat:4,wrapWithDirectory:!1,pin:!1,recursive:!1,hidden:!1,preload:!1,chunkValidator:null,importBuffer:null};e.exports=async function*(e,t,o={}){const a=i(s,o);let c,u;o.cidVersion>0&&void 0===o.rawLeaves&&(a.rawLeaves=!0),void 0!==o.hashAlg&&void 0===o.rawLeaves&&(a.rawLeaves=!0),"trickle"===o.strategy&&(a.leafType="raw",a.reduceSingleLeafToSelf=!1),o.format&&(a.codec=o.format),c="function"==typeof o.dagBuilder?o.dagBuilder:r(478),u="function"==typeof o.treeBuilder?o.treeBuilder:r(508);for await(const r of u(n(c(e,t,a),a.fileImportConcurrency),t,a))yield{cid:r.cid,path:r.path,unixfs:r.unixfs,size:r.size}}},function(e,t,r){"use strict";e.exports=async function*(e,t){t=parseInt(t),(isNaN(t)||t<1)&&(t=1);let r=[];for await(const n of e)for(r.push(n);r.length>=t;)yield r.slice(0,t),r=r.slice(t);for(;r.length;)yield r.slice(0,t),r=r.slice(t)}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(1),s=r(17),o=r(481);async function a(e,t,r){const n=await a.digest(e,t,r);return s.encode(n,t,r)}a.Buffer=n,a.multihash=s,a.digest=async(e,t,r)=>{const n=a.createHash(t),i=await n(e);return r?i.slice(0,r):i},a.createHash=function(e){if(!e)throw i(new Error("hash algorithm must be specified"),"ERR_HASH_ALGORITHM_NOT_SPECIFIED");if(e=s.coerceCode(e),!a.functions[e])throw i(new Error("multihash function '".concat(e,"' not yet supported")),"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return a.functions[e]},a.functions={0:o.identity,17:o.sha1,18:o.sha2256,19:o.sha2512,20:o.sha3512,21:o.sha3384,22:o.sha3256,23:o.sha3224,24:o.shake128,25:o.shake256,26:o.keccak224,27:o.keccak256,28:o.keccak384,29:o.keccak512,34:o.murmur3128,35:o.murmur332,86:o.dblSha2256},o.addBlake(a.functions),a.validate=async(e,t)=>{const r=await a(e,s.decode(t).name);return 0===n.compare(t,r)},e.exports=a},function(e,t,r){"use strict";e.exports=async e=>{const t=[];for await(const r of e)t.push(r);return t}},function(e,t,r){"use strict";e.exports=class{constructor(e,t){this.options=t||{},Object.assign(this,e)}}},function(e,t,r){"use strict";const{DAGLink:n,DAGNode:i}=r(12),{Buffer:s}=r(0),o=r(23),a=r(130),c=r(132),u=r(59),f=r(511),h=r(26).bind({ignoreUndefined:!0}),l=async function(e){const t=(await a(s.from(e,"utf8"),"murmur3-128")).slice(2,10),r=t.length,n=s.alloc(r);for(let i=0;i<r;i++)n[r-i-1]=t[i];return n};l.code=34;const d={hamtHashFn:l,hamtBucketBits:8};e.exports=class extends c{constructor(e,t){super(e,t=h(d,t)),this._bucket=f({hashFn:t.hamtHashFn,bits:t.hamtBucketBits})}async put(e,t){await this._bucket.put(e,t)}get(e){return this._bucket.get(e)}childCount(){return this._bucket.leafCount()}directChildrenCount(){return this._bucket.childrenCount()}onlyChild(){return this._bucket.onlyChild()}async*eachChildSeries(){for await(const{key:e,value:t}of this._bucket.eachLeafSeries())yield{key:e,child:t}}async*flush(e,t){for await(const r of async function*e(t,r,a,c,h){const l=r._children,d=[];let p=0;for(let i=0;i<l.length;i++){const t=l.get(i);if(!t)continue;const r=i.toString(16).toUpperCase().padStart(2,"0");if(f.isBucket(t)){let i;for await(const r of await e("",t,a,null,h))i=r;d.push(new n(r,i.size,i.cid)),p+=i.size}else if("function"==typeof t.value.flush){const e=t.value;let i;for await(const t of e.flush(e.path,a))i=t,yield i;const s=r+t.key;d.push(new n(s,i.size,i.cid)),p+=i.size}else{const e=t.value;if(!e.cid)continue;const i=r+t.key,s=e.size;d.push(new n(i,s,e.cid)),p+=s}}const b=s.from(l.bitField().reverse()),y=new o({type:"hamt-sharded-directory",data:b,fanout:r.tableSize(),hashType:h.hamtHashFn.code,mtime:c&&c.mtime,mode:c&&c.mode}),m=new i(y.marshal(),d).serialize(),g=await u(m,a,h),v=m.length+p;yield{cid:g,unixfs:y,path:t,size:v}}(e,this._bucket,t,this,this.options))yield r}},e.exports.hashFn=l},function(e,t,r){"use strict";const n=r(512),i=r(513),s={bits:8};class o{constructor(e,t,r){if(this._options=Object.assign({},s,e),this._popCount=0,this._parent=t,this._posAtParent=r,!this._options.hashFn)throw new Error("please define an options.hashFn");this._options.hash||(this._options.hash=i(this._options.hashFn)),this._children=new n}static isBucket(e){return e instanceof o}async put(e,t){const r=await this._findNewBucketAndPos(e);await r.bucket._putAt(r,e,t)}async get(e){const t=await this._findChild(e);if(t)return t.value}async del(e){const t=await this._findPlace(e),r=t.bucket._at(t.pos);r&&r.key===e&&t.bucket._delAt(t.pos)}leafCount(){return this._children.compactArray().reduce((e,t)=>t instanceof o?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 o)for(const e of t.eachLeafSeries())yield e;else yield t}serialize(e,t){return t(this._children.reduce((r,n,i)=>(n&&(n instanceof o?r.push(n.serialize(e,t)):r.push(e(n,i))),r),[]))}asyncTransform(e,t){return async function e(t,r,n){const i=[];for(const s of t._children.compactArray()){if(s instanceof o)await e(s,r,n);else{const e=await r(s);i.push({bitField:t._children.bitField(),children:e})}return n(i)}}(this,e,t)}toJSON(){return this.serialize(c,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),r=t.bucket._at(t.pos);if(r&&r.key===e)return r}async _findPlace(e){const t=this._options.hash(e),r=await t.take(this._options.bits),n=this._children.get(r);return n instanceof o?n._findPlace(t):{bucket:this,pos:r,hash:t}}async _findNewBucketAndPos(e){const t=await this._findPlace(e),r=t.bucket._at(t.pos);if(r&&r.key!==e){const e=new o(this._options,t.bucket,t.pos);t.bucket._putObjectAt(t.pos,e);const n=await e._findPlace(r.hash);return n.bucket._putAt(n,r.key,r.value),e._findNewBucketAndPos(t.hash)}return t}_putAt(e,t,r){this._putObjectAt(e.pos,{key:t,value:r,hash:e.hash})}_putObjectAt(e,t){this._children.get(e)||this._popCount++,this._children.set(e,t)}_delAt(e){this._children.get(e)&&this._popCount--,this._children.unset(e),this._level()}_level(){if(this._parent&&this._popCount<=1)if(1===this._popCount){const e=this._children.find(a);if(!(e instanceof o)){const t=e.hash;t.untake(this._options.bits);const r={pos:this._posAtParent,hash:t};this._parent._putAt(r,e.key,e.value)}}else this._parent._delAt(this._posAtParent)}_at(e){return this._children.get(e)}}function a(e){return Boolean(e)}function c(e,t){return e.key}function u(e){return e}e.exports=o},function(e,t,r){"use strict";var n=r(518);function i(e,t,r){var i=this;this._started=n(),this._rescheduled=0,this._scheduled=t,this._args=r,this._timer=setTimeout((function t(){i._rescheduled>0?(i._scheduled=i._rescheduled-(n()-i._started),i._timer=setTimeout(t,i._scheduled),i._rescheduled=0):e.apply(null,i._args)}),t)}i.prototype.reschedule=function(e){var t=n();return!(t+e-(this._started+this._scheduled)<0)&&(this._started=t,this._rescheduled=e,!0)},i.prototype.clear=function(){clearTimeout(this._timer)},e.exports=function(){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<e.length;t++)e[t]=arguments[t+2]}return new i(arguments[0],arguments[1],e)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));let n=/(-?(?:\d+\.?\d*|\d*\.?\d+)(?:e[-+]?\d+)?)\s*([a-zµμ]*)/gi;function i(e="",t="ms"){var r=null;return(e=e.replace(/(\d),(\d)/g,"$1$2")).replace(n,(function(e,t,n){(n=i[n]||i[n.toLowerCase().replace(/s$/,"")])&&(r=(r||0)+parseFloat(t,10)*n)})),r&&r/i[t]}i.nanosecond=i.ns=1e-6,i["µs"]=i["μs"]=i.us=i.microsecond=.001,i.millisecond=i.ms=1,i.second=i.sec=i.s=1e3*i.ms,i.minute=i.min=i.m=60*i.s,i.hour=i.hr=i.h=60*i.m,i.day=i.d=24*i.h,i.week=i.wk=i.w=7*i.d,i.month=i.b=30.4375*i.d,i.year=i.yr=i.y=365.25*i.d},function(e,t,r){"use strict";const n=r(4),i=r(1);t.cleanCid=e=>{if(n.isCID(e))return e;try{return new n(e)}catch(t){throw i(t,"ERR_INVALID_CID")}}},function(e,t,r){"use strict";e.exports=(e,t)=>(t=t||(()=>{}),e.then(e=>new Promise(e=>{e(t())}).then(()=>e),e=>new Promise(e=>{e(t())}).then(()=>{throw e})))},function(e,t,r){"use strict";t.Diagnose=r(530),t.Decoder=r(242),t.Encoder=r(532),t.Simple=r(243),t.Tagged=r(244),t.decodeAll=t.Decoder.decodeAll,t.decodeFirst=t.Decoder.decodeFirst,t.diagnose=t.Diagnose.diagnose,t.encode=t.Encoder.encode,t.decode=t.Decoder.decode,t.leveldb={decode:t.Decoder.decodeAll,encode:t.Encoder.encode,buffer:!0,name:"cbor"}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(37).BigNumber,s=r(101),o=s.SHIFT32,a=s.SHIFT16;t.parseHalf=function(e){var t,r,n;return n=128&e[0]?-1:1,t=(124&e[0])>>2,r=(3&e[0])<<8|e[1],t?31===t?n*(r?NaN:Infinity):n*Math.pow(2,t-25)*(1024+r):5.960464477539063e-8*n*r},t.arrayBufferToBignumber=function(e){const t=e.byteLength;let r="";for(let i=0;i<t;i++)r+=(n=e[i])<16?"0"+n.toString(16):n.toString(16);var n;return new i(r,16)},t.buildMap=e=>{const t=new Map,r=Object.keys(e),n=r.length;for(let i=0;i<n;i++)t.set(r[i],e[r[i]]);return t},t.buildInt32=(e,t)=>e*a+t,t.buildInt64=(e,r,n,s)=>{const a=t.buildInt32(e,r),c=t.buildInt32(n,s);return a>2097151?new i(a).times(o).plus(c):a*o+c},t.writeHalf=function(e,t){const r=n.allocUnsafe(4);r.writeFloatBE(t,0);const i=r.readUInt32BE(0);if(0!=(8191&i))return!1;var s=i>>16&32768;const o=i>>23&255,a=8388607&i;if(o>=113&&o<=142)s+=(o-112<<10)+(a>>13);else{if(!(o>=103&&o<113))return!1;if(a&(1<<126-o)-1)return!1;s+=a+8388608>>126-o}return e.writeUInt16BE(s,0),!0},t.keySorter=function(e,t){var r=e[0].byteLength,n=t[0].byteLength;return r>n?1:n>r?-1:e[0].compare(t[0])},t.isNegativeZero=e=>0===e&&1/e<0,t.nextPowerOf2=e=>{let t=0;if(e&&!(e&e-1))return e;for(;0!==e;)e>>=1,t+=1;return 1<<t}},function(e,t,r){"use strict";var n=r(533);e.exports=function(e){if(!(e instanceof Object))throw new TypeError('"obj" must be an object (or inherit from it)');return function e(t,r){for(var i in r=new n(t,r),t){var s=t[i];if(s instanceof Object&&(r.contains(s)||e(s,r)))return!0}return!1}(e)}},function(e,t,r){"use strict";const n=r(4);t.cidToString=(e,t)=>{if((t=t||{}).upgrade=!1!==t.upgrade,n.isCID(e)||(e=new n(e)),0===e.version&&t.base&&"base58btc"!==t.base){if(!t.upgrade)return e.toString();e=e.toV1()}return e.toBaseEncodedString(t.base)}},function(e,t,r){"use strict";e.exports=()=>({Addresses:{Swarm:[],API:"",Gateway:"",Delegates:["/dns4/node0.delegate.ipfs.io/tcp/443/https","/dns4/node1.delegate.ipfs.io/tcp/443/https","/dns4/node2.delegate.ipfs.io/tcp/443/https","/dns4/node3.delegate.ipfs.io/tcp/443/https"]},Discovery:{MDNS:{Enabled:!1,Interval:10},webRTCStar:{Enabled:!0}},Bootstrap:["/dns4/ams-1.bootstrap.libp2p.io/tcp/443/wss/p2p/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd","/dns4/lon-1.bootstrap.libp2p.io/tcp/443/wss/p2p/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3","/dns4/sfo-3.bootstrap.libp2p.io/tcp/443/wss/p2p/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM","/dns4/sgp-1.bootstrap.libp2p.io/tcp/443/wss/p2p/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu","/dns4/nyc-1.bootstrap.libp2p.io/tcp/443/wss/p2p/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm","/dns4/nyc-2.bootstrap.libp2p.io/tcp/443/wss/p2p/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64","/dns4/node0.preload.ipfs.io/tcp/443/wss/p2p/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic","/dns4/node1.preload.ipfs.io/tcp/443/wss/p2p/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6","/dns4/node2.preload.ipfs.io/tcp/443/wss/p2p/QmV7gnbW5VTcJ3oyM2Xk1rdFBJ3kTkvxc87UFGsun29STS","/dns4/node3.preload.ipfs.io/tcp/443/wss/p2p/QmY7JB6MQXhxHvq7dBDh4HpbH29v4yE9JRadAVpndvzySN"],Pubsub:{Enabled:!0},Swarm:{ConnMgr:{LowWater:200,HighWater:500}},Routing:{Type:"none"}})},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports=function(e,t,r,i){const s=t+e.length;return r>=s||i<t?n.alloc(0):(i>=t&&i<s&&(e=e.slice(0,i-t)),r>=t&&r<s&&(e=e.slice(r-t)),e)}},function(e,t,r){"use strict";const n=r(1);e.exports=(e,t,r)=>{if(t||(t=0),t<0)throw n(new Error("Offset must be greater than or equal to 0"),"ERR_INVALID_PARAMS");if(t>e)throw n(new Error("Offset must be less than the file size"),"ERR_INVALID_PARAMS");if(r||0===r||(r=e-t),r<0)throw n(new Error("Length must be greater than or equal to 0"),"ERR_INVALID_PARAMS");return t+r>e&&(r=e-t),{offset:t,length:r}}},function(e,t,r){"use strict";e.exports=function(e){if(!e)throw Error("hashlru must have a max value, of type number, greater than 0");var t=0,r=Object.create(null),n=Object.create(null);function i(i,s){r[i]=s,++t>=e&&(t=0,n=r,r=Object.create(null))}return{has:function(e){return void 0!==r[e]||void 0!==n[e]},remove:function(e){void 0!==r[e]&&(r[e]=void 0),void 0!==n[e]&&(n[e]=void 0)},get:function(e){var t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(i(e,t),t):void 0},set:function(e,t){void 0!==r[e]?r[e]=t:i(e,t)},clear:function(){r=Object.create(null),n=Object.create(null)}}}},function(e,t,r){"use strict";e.exports=(e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean)},function(e,t,r){"use strict";const n=r(149),i=r(103),s=r(2)("ipfs:mfs:cp"),o=r(1),a=r(62),c=r(63),u=r(61),f=r(38),h=r(587),l=r(77),{withTimeoutOption:d}=r(3),p={parents:!1,flush:!0,hashAlg:"sha2-256",cidVersion:0,shardSplitThreshold:1e3,signal:void 0};e.exports=e=>d((async function(...t){let{sources:r,destination:a,options:c}=await h(e,t,p);if(!r.length)throw o(new Error("Please supply at least one source"),"ERR_INVALID_PARAMS");c.parents=c.p||c.parents;const u=r.find(e=>!e.exists);if(u)throw o(new Error("".concat(u.path," does not exist")),"ERR_INVALID_PARAMS");const d=b(a);if(a.exists){if(s("Destination exists"),1===r.length&&!d)throw o(new Error("directory already has entry by that name"),"ERR_ALREADY_EXISTS")}else if(s("Destination does not exist"),r.length>1){if(!c.parents)throw o(new Error("destination did not exist, pass -p to create intermediate directories"),"ERR_INVALID_PARAMS");await n(e)(a.path,c),a=await f(e,a.path,c)}else if(a.parts.length>1){const t="/".concat(a.parts.slice(0,-1).join("/"));try{await i(e)(t,c)}catch(w){if("ERR_NOT_FOUND"!==w.code)throw w;if(!c.parents)throw o(new Error("destination did not exist, pass -p to create intermediate directories"),"ERR_INVALID_PARAMS");await n(e)(t,c),a=await f(e,a.path,c)}}const g=b(a)?a.mfsPath:a.mfsDirectory,v=await l(e,g,c);if(1===r.length){const t=r.pop(),n=d?t.name:a.name;return s("Only one source, copying to destination ".concat(d?"directory":"file"," ").concat(n)),y(e,t,n,v,c)}return s("Multiple sources, wrapping in a directory"),m(e,r,a,v,c)}));const b=e=>e.unixfs&&e.unixfs.type&&e.unixfs.type.includes("directory"),y=async(e,t,r,n,i)=>{let s=n.pop();s=await g(e,t,r,s,i),n.push(s);const o=await a(e,n,i);await c(e,o,i)},m=async(e,t,r,n,i)=>{for(let o=0;o<t.length;o++){const n=t[o];r=await g(e,n,n.name,r,i)}n[n.length-1]=r;const s=await a(e,n,i);await c(e,s,i)},g=async(e,t,r,n,i)=>{const s=await e.repo.blocks.get(t.cid),{node:o,cid:a}=await u(e,{parentCid:n.cid,size:s.data.length,cid:t.cid,name:r,hashAlg:i.hashAlg,cidVersion:i.cidVersion,flush:i.flush});return n.node=o,n.cid=a,n.size=o.size,n}},function(e,t,r){"use strict";const n=r(1),i=r(2)("ipfs:mfs:mkdir"),s=r(32),o=r(586),a=r(147),c=r(63),u=r(62),f=r(61),h=r(259),l=r(44),{withTimeoutOption:d}=r(3),p={parents:!1,hashAlg:"sha2-256",cidVersion:0,shardSplitThreshold:1e3,flush:!0,mode:null,mtime:null,signal:void 0};e.exports=e=>d((async function(t,r){if(r=l(r,p),!t)throw new Error("no path given to Mkdir");if("/"===(t=t.trim())){if(r.parents)return;throw n(new Error("cannot create directory '/': Already exists"),"ERR_INVALID_PATH")}if("/"!==t.substring(0,1))throw n(new Error("paths must start with a leading slash"),"ERR_INVALID_PATH");i("Creating ".concat(t));const f=a(t);if("ipfs"===f[0])throw n(new Error("path cannot have the prefix 'ipfs'"),"ERR_INVALID_PATH");const d=await h(e,r);let y;const m=[],g=await o(e,"directory",r);for(let o=0;o<=f.length;o++){const t=f.slice(0,o),a="/ipfs/".concat(d,"/").concat(t.join("/"));try{if(y=await s(a,e.ipld),i("".concat(a," existed")),i("".concat(a," had children ").concat(y.node.Links.map(e=>e.Name))),o===f.length){if(r.parents)return;throw n(new Error("file already exists"),"ERR_ALREADY_EXISTS")}m.push({name:y.name,cid:y.cid})}catch(w){if("ERR_NOT_FOUND"!==w.code)throw w;if(o<f.length&&!r.parents)throw n(new Error("Intermediate directory path ".concat(a," does not exist, use the -p flag to create it")),"ERR_NOT_FOUND");await b(e,t[t.length-1],g,m[m.length-1],m,r)}}const v=await u(e,m,r);await c(e,v,r)}));const b=async(e,t,r,n,s,o)=>{i("Adding empty dir called ".concat(t," to ").concat(n.cid));const a=await f(e,{parent:n.node,parentCid:n.cid,size:r.node.size,cid:r.cid,name:t,hashAlg:o.hashAlg,cidVersion:o.cidVersion,flush:o.flush});s[s.length-1].cid=a.cid,s.push({name:t,cid:r.cid})}},function(e,t,r){"use strict";const n=r(38),i=r(44);e.exports=async function(e,t,r){const s=[];let o;for(let n=0;n<t.length;n++)"string"==typeof t[n]||t[n]instanceof String?s.push(t[n].trim()):n===t.length-1&&(o=t[n]);return o=i(o,r),{sources:await n(e,s,o),options:o}}},function(e,t,r){"use strict";const n=r(1),i=r(62),s=r(63),o=r(150),a=r(588),c=r(38),u=r(77),{withTimeoutOption:f}=r(3),h={recursive:!1,cidVersion:0,hashAlg:"sha2-256",flush:!0,signal:void 0};e.exports=e=>f((async function(...t){const{sources:r,options:i}=await o(e,t,h);if(!r.length)throw n(new Error("Please supply at least one path to remove"),"ERR_INVALID_PARAMS");r.forEach(e=>{if("/"===e.path)throw n(new Error("Cannot delete root"),"ERR_INVALID_PARAMS")});for(const n of r)await l(e,n.path,i)}));const l=async(e,t,r)=>{const o=await c(e,t,r),f=await u(e,o.mfsPath,r),h=f.pop(),l=f[f.length-1];if(!l)throw n(new Error("".concat(t," does not exist")),"ERR_NOT_FOUND");if("directory"===h.type&&!r.recursive)throw n(new Error("".concat(t," is a directory, use -r to remove directories")),"ERR_WAS_DIR");const{cid:d}=await a(e,{parentCid:l.cid,name:h.name,hashAlg:r.hashAlg,cidVersion:r.cidVersion,flush:r.flush});l.cid=d;const p=await i(e,f,r);await s(e,p,r)}},function(e,t,r){"use strict";const n=r(262),i=r(2),s=r(37),o=r(1),a=r(600),c=r(652),u=r(653),f=r(654),h=r(655),l=r(656),d=r(657),p=r(659),b=r(662),y=r(663),m=r(666),g=r(667),v=r(163),w=i("ipfs:repo"),_=Number.MAX_SAFE_INTEGER,E={memory:r(286),fs:r(286)};async function k(e){const t=new s(0);for await(const r of e.query({}))t.plus(r.value.byteLength).plus(r.key.toBuffer().byteLength);return t}e.exports=class{constructor(e,t){if("string"!=typeof e)throw new Error("missing repoPath");this.options=function(e){const t=Object.assign({},m,e);return t.storageBackends=Object.assign({},m.storageBackends,t.storageBackends),t.storageBackendOptions=Object.assign({},m.storageBackendOptions,t.storageBackendOptions),t}(t),this.closed=!0,this.path=e,this._locker=this._getLocker(),this.root=h.create("root",this.path,this.options),this.version=l(this.root),this.config=d(this.root),this.spec=p(this.root),this.apiAddr=b(this.root)}async init(e){var t;w("initializing at: %s",this.path),await this._openRoot(),await this.config.set((t=e,t.datastore=Object.assign({},g,n(t,"datastore",{})),t)),await this.spec.set(function(e){const t=Object.assign({},g.Spec,n(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)),await this.version.set(f.repoVersion)}async isInitialized(){if(!this.closed)return!0;try{return await this._openRoot(),await this._checkInitialized(),await this.root.close(),!0}catch(e){return!1}}async open(){if(!this.closed)throw o(new Error("repo is already open"),v.ERR_REPO_ALREADY_OPEN);w("opening at: %s",this.path);try{await this._openRoot(),await this._checkInitialized(),this.lockfile=await this._openLock(this.path),w("acquired repo.lock"),w("creating datastore"),this.datastore=h.create("datastore",u(this.path,"datastore"),this.options),await this.datastore.open(),w("creating blocks");const e=h.create("blocks",u(this.path,"blocks"),this.options);await e.open(),this.blocks=await y(e,this.options.storageBackendOptions.blocks),w("creating keystore"),this.keys=h.create("keys",u(this.path,"keys"),this.options),await this.keys.open();if(!await this.version.check(f.repoVersion)){if(!await this._isAutoMigrationEnabled())throw new v.InvalidRepoVersionError("Incompatible repo versions. Automatic migrations disabled. Please migrate the repo manually.");await this._migrate(f.repoVersion)}this.closed=!1,w("all opened")}catch(e){if(this.lockfile)try{await this._closeLock(),this.lockfile=null}catch(t){w("error removing lock",t)}throw e}}_getLocker(){if("string"==typeof this.options.lock){if(!E[this.options.lock])throw new Error("Unknown lock type: "+this.options.lock);return E[this.options.lock]}if(!this.options.lock)throw new Error("No lock provided");return this.options.lock}async _openRoot(){try{await this.root.open()}catch(e){if("Already open"!==e.message)throw e}}async _openLock(e){const t=await this._locker.lock(e);if("function"!=typeof t.close)throw o(new Error("Locks must have a close method"),"ERR_NO_CLOSE_FUNCTION");return t}_closeLock(){return this.lockfile.close()}async _checkInitialized(){let e;w("init check");try{[e]=await Promise.all([this.config.exists(),this.spec.exists(),this.version.exists()])}catch(t){if("ERR_NOT_FOUND"===t.code)throw o(new Error("repo is not initialized yet"),v.ERR_REPO_NOT_INITIALIZED,{path:this.path});throw t}if(!e)throw o(new Error("repo is not initialized yet"),v.ERR_REPO_NOT_INITIALIZED,{path:this.path})}async close(){if(this.closed)throw o(new Error("repo is already closed"),v.ERR_REPO_ALREADY_CLOSED);w("closing at: %s",this.path);try{await this.apiAddr.delete()}catch(e){if(e.code!==v.ERR_REPO_NOT_INITIALIZED&&!e.message.startsWith("ENOENT"))throw e}await Promise.all([this.root,this.blocks,this.keys,this.datastore].map(e=>e.close())),w("unlocking"),this.closed=!0,await this._closeLock(),this.lockfile=null}async exists(){return this.version.exists()}async stat(){const[e,t,r,n,i]=await Promise.all([this._storageMaxStat(),this._blockStat(),this.version.get(),k(this.datastore),k(this.keys)]),s=t.size.plus(n).plus(i);return{repoPath:this.path,storageMax:e,version:r,numObjects:t.count,repoSize:s}}async _isAutoMigrationEnabled(){if(void 0!==this.options.autoMigrate)return this.options.autoMigrate;let e;try{e=await this.config.get("repoAutoMigrate")}catch(t){if(t.code!==v.NotFoundError.code)throw t;e=!0}return e}async _migrate(e){return await this.version.get()>e?(w("reverting to version "+e),a.revert(this.path,e,{ignoreLock:!0,repoOptions:this.options})):(w("migrating to version "+e),a.migrate(this.path,e,{ignoreLock:!0,repoOptions:this.options}))}async _storageMaxStat(){try{const e=await this.config.get("Datastore.StorageMax");return new s(c(e))}catch(e){return new s(_)}}async _blockStat(){let e=new s(0),t=new s(0);for await(const r of this.blocks.query({}))e=e.plus(1),t=t.plus(r.data.byteLength).plus(r.cid.buffer.byteLength);return{count:e,size:t}}},e.exports.utils={blockstore:r(284)},e.exports.repoVersion=f.repoVersion,e.exports.errors=v},function(e,t,r){"use strict";const n=r(104),i=r(604),s=r(606),o=r(607),a=r(608),c=r(263);t.KeytransformDatastore=n,t.ShardingDatastore=i,t.MountDatastore=s,t.TieredDatastore=o,t.NamespaceDatastore=a,t.shard=c},function(e,t,r){"use strict";const n=r(78),i=r(7).Key;t.CONFIG_KEY=new i("/config"),t.VERSION_KEY=new i("/version"),t.getDatastoreAndOptions=function(e,t,r=n){let i,s;return i=void 0!==e&&void 0!==e.storageBackends&&void 0!==e.storageBackends[t]?e.storageBackends[t]:r,s=void 0!==e&&void 0!==e.storageBackendOptions&&void 0!==e.storageBackendOptions[t]?e.storageBackendOptions[t]:{},{StorageBackend:i,storageOptions:s}},t.containsIrreversibleMigration=function(e,t,r){return r.filter(r=>r.version>e&&r.version<=t).some(e=>void 0===e.revert)}},function(e,t,r){"use strict";var n=r(64),i=r(616);e.exports=function(){var e=n.apply(null,arguments);return i(e,{bufferKeys:e.bufferKeys||!1,snapshots:e.snapshots||!1,permanence:e.permanence||!1,seek:e.seek||!1,clear:e.clear||!1,status:e.status||!1,createIfMissing:e.createIfMissing||!1,errorIfExists:e.errorIfExists||!1,deferredOpen:e.deferredOpen||!1,openCallback:e.openCallback||!1,promises:e.promises||!1,streams:e.streams||!1,encodings:e.encodings||!1,additionalMethods:n(e.additionalMethods)})}},function(e,t,r){"use strict";e.exports=r(157)},function(e,t,r){"use strict";var n,i,s,o=[r(617),r(618),r(619),r(620),r(621)],a=-1,c=[],u=!1;function f(){n&&i&&(n=!1,i.length?c=i.concat(c):a=-1,c.length&&h())}function h(){if(!n){u=!1,n=!0;for(var e=c.length,t=setTimeout(f);e;){for(i=c,c=[];i&&++a<e;)i[a].run();a=-1,e=c.length}i=null,a=-1,n=!1,clearTimeout(t)}}for(var l=-1,d=o.length;++l<d;)if(o[l]&&o[l].test&&o[l].test()){s=o[l].install(h);break}function p(e,t){this.fun=e,this.array=t}p.prototype.run=function(){var e=this.fun,t=this.array;switch(t.length){case 0:return e();case 1:return e(t[0]);case 2:return e(t[0],t[1]);case 3:return e(t[0],t[1],t[2]);default:return e.apply(null,t)}},e.exports=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new p(e,t)),u||n||(u=!0,s())}},function(e,t,r){"use strict";var n=r(65).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function e(t,r,s){if("function"==typeof r)return e(t,null,r);r||(r={}),s=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}(s||i);var o=r.readable||!1!==r.readable&&t.readable,a=r.writable||!1!==r.writable&&t.writable,c=function(){t.writable||f()},u=t._writableState&&t._writableState.finished,f=function(){a=!1,u=!0,o||s.call(t)},h=t._readableState&&t._readableState.endEmitted,l=function(){o=!1,h=!0,a||s.call(t)},d=function(e){s.call(t,e)},p=function(){var e;return o&&!h?(t._readableState&&t._readableState.ended||(e=new n),s.call(t,e)):a&&!u?(t._writableState&&t._writableState.ended||(e=new n),s.call(t,e)):void 0},b=function(){t.req.on("finish",f)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?a&&!t._writableState&&(t.on("end",c),t.on("close",c)):(t.on("complete",f),t.on("abort",p),t.req?b():t.on("request",b)),t.on("end",l),t.on("finish",f),!1!==r.error&&t.on("error",d),t.on("close",p),function(){t.removeListener("complete",f),t.removeListener("abort",p),t.removeListener("request",b),t.req&&t.req.removeListener("finish",f),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",f),t.removeListener("end",l),t.removeListener("error",d),t.removeListener("close",p)}}},function(e,t,r){"use strict";var n=r(634).create,i=n("LevelUPError"),s=n("NotFoundError",i);s.prototype.notFound=!0,s.prototype.status=404,e.exports={LevelUPError:i,InitializationError:n("InitializationError",i),OpenError:n("OpenError",i),ReadError:n("ReadError",i),WriteError:n("WriteError",i),NotFoundError:s,EncodingError:n("EncodingError",i)}},function(e,t,r){"use strict";t.AbstractLevelDOWN=r(640),t.AbstractIterator=r(277),t.AbstractChainedBatch=r(278)},function(e,t,r){"use strict";e.exports=r(157)},function(e,t,r){"use strict";class n extends Error{constructor(e){super(e),this.name="NonReversibleMigrationError",this.code="ERR_NON_REVERSIBLE_MIGRATION",this.message=e}}n.code="ERR_NON_REVERSIBLE_MIGRATION",t.NonReversibleMigrationError=n;class i extends Error{constructor(e){super(e),this.name="NotInitializedRepoError",this.code="ERR_NOT_INITIALIZED_REPO",this.message=e}}i.code="ERR_NOT_INITIALIZED_REPO",t.NotInitializedRepoError=i;class s extends Error{constructor(e){super(e),this.name="RequiredParameterError",this.code="ERR_REQUIRED_PARAMETER",this.message=e}}s.code="ERR_REQUIRED_PARAMETER",t.RequiredParameterError=s;class o extends Error{constructor(e){super(e),this.name="InvalidValueError",this.code="ERR_INVALID_VALUE",this.message=e}}o.code="ERR_INVALID_VALUE",t.InvalidValueError=o;class a extends Error{constructor(e){super(e),this.name="MissingRepoOptionsError",this.code="ERR_MISSING_REPO_OPTIONS",this.message=e}}a.code="ERR_MISSING_REPO_OPTIONS",t.MissingRepoOptionsError=a},function(e,t,r){"use strict";class n extends Error{constructor(e){super(e),this.name="LockExistsError",this.code=n.code}}n.code="ERR_LOCK_EXISTS",t.LockExistsError=n;class i extends Error{constructor(e){super(e),this.name="NotFoundError",this.code=i.code}}i.code="ERR_NOT_FOUND",t.NotFoundError=i;class s extends Error{constructor(e){super(e),this.name="InvalidRepoVersionError",this.code=s.code}}s.code="ERR_INVALID_REPO_VERSION",t.InvalidRepoVersionError=s,t.ERR_REPO_NOT_INITIALIZED="ERR_REPO_NOT_INITIALIZED",t.ERR_REPO_ALREADY_OPEN="ERR_REPO_ALREADY_OPEN",t.ERR_REPO_ALREADY_CLOSED="ERR_REPO_ALREADY_CLOSED"},function(e,t,r){"use strict";const{TextEncoder:n,TextDecoder:i}=r(92),s=new i,o=new n;e.exports={decodeText:e=>s.decode(e),encodeText:e=>o.encode(e),concat:function(e,t){const r=new Uint8Array(t);let n=0;for(const i of e)r.set(i,n),n+=i.length;return r}}},function(e,t,r){"use strict";e.exports=function(e,t,r,n,i){for(t=t.split?t.split("."):t,n=0;n<t.length;n++)e=e?e[t[n]]:i;return e===i?r:e}},function(e,t,r){"use strict";const n=r(2),i=r(13),s=r(1),o=r(6),a=r(167),c=r(168),u=r(743),f=r(748),{signMessage:h,verifySignature:l}=r(755);e.exports=class extends i{constructor({debugName:e,multicodecs:t,peerId:r,registrar:i,signMessages:s=!0,strictSigning:a=!0}){if("string"!=typeof e)throw new Error("a debugname `string` is required");if(!t)throw new Error("multicodecs are required");if(!o.isPeerId(r))throw new Error("peerId must be an instance of `peer-id`");!function(e){if("object"!=typeof e)throw new Error("a registrar object is required");if("function"!=typeof e.handle)throw new Error("a handle function must be provided in registrar");if("function"!=typeof e.register)throw new Error("a register function must be provided in registrar");if("function"!=typeof e.unregister)throw new Error("a unregister function must be provided in registrar")}(i),super(),this.log=n(e),this.log.err=n("".concat(e,":error")),this.multicodecs=f.ensureArray(t),this.registrar=i,this.started=!1,this.peerId=r,this.topics=new Map,this.peers=new Map,this.signMessages=s,this.strictSigning=a,this._registrarId=void 0,this._onIncomingStream=this._onIncomingStream.bind(this),this._onPeerConnected=this._onPeerConnected.bind(this),this._onPeerDisconnected=this._onPeerDisconnected.bind(this)}async start(){if(this.started)return;this.log("starting"),this.registrar.handle(this.multicodecs,this._onIncomingStream);const e=new a({multicodecs:this.multicodecs,handlers:{onConnect:this._onPeerConnected,onDisconnect:this._onPeerDisconnected}});this._registrarId=await this.registrar.register(e),this.log("started"),this.started=!0}async stop(){this.started&&(await this.registrar.unregister(this._registrarId),this.log("stopping"),this.peers.forEach(e=>e.close()),this.peers=new Map,this.started=!1,this.log("stopped"))}_onIncomingStream({protocol:e,stream:t,connection:r}){const n=r.remotePeer,i=n.toB58String(),s=this._addPeer(n,[e]);this._processMessages(i,t,s)}async _onPeerConnected(e,t){const r=e.toB58String();this.log("connected",r);const n=this._addPeer(e,this.multicodecs);try{const{stream:e}=await t.newStream(this.multicodecs);n.attachConnection(e)}catch(i){this.log.err(i)}}_onPeerDisconnected(e,t){const r=e.toB58String(),n=this.peers.get(r);this.log("connection ended",r,t?t.message:""),this._removePeer(n)}_addPeer(e,t){const r=e.toB58String();let n=this.peers.get(r);if(!n){this.log("new peer",r);const i=new u({id:e,protocols:t});this.peers.set(r,i),n=i,i.once("close",()=>this._removePeer(i))}return n}_removePeer(e){if(!e)return;const t=e.id.toB58String();return this.log("delete peer",t),this.peers.delete(t),e}async validate(e){return this.strictSigning&&!e.signature?(this.log("Signing required and no signature was present, dropping message:",e),!1):!e.signature||l(e)}_buildMessage(e){const t=f.normalizeOutRpcMessage(e);return this.signMessages?h(this.peerId,t):e}getSubscribers(e){if(!this.started)throw s(new Error("not started yet"),"ERR_NOT_STARTED_YET");if(!e||"string"!=typeof e)throw s(new Error("a string topic must be provided"),"ERR_NOT_VALID_TOPIC");return Array.from(this.peers.values()).filter(t=>t.topics.has(e)).map(e=>e.id.toB58String())}publish(e,t){throw s(new Error("publish must be implemented by the subclass"),"ERR_NOT_IMPLEMENTED")}subscribe(e){throw s(new Error("subscribe must be implemented by the subclass"),"ERR_NOT_IMPLEMENTED")}unsubscribe(e){throw s(new Error("unsubscribe must be implemented by the subclass"),"ERR_NOT_IMPLEMENTED")}getTopics(){throw s(new Error("getTopics must be implemented by the subclass"),"ERR_NOT_IMPLEMENTED")}_processMessages(e,t,r){throw s(new Error("_processMessages must be implemented by the subclass"),"ERR_NOT_IMPLEMENTED")}},e.exports.message=c,e.exports.utils=f},function(e,t,r){"use strict";const n=r(21),i=r(304);e.exports=n(class extends i{constructor({min:e,max:t,multicodecs:r,handlers:n}){if(super({min:e,max:t,handlers:n}),!r)throw new Error("one or more multicodec should be provided");if(!n)throw new Error("the handlers should be provided");if("function"!=typeof n.onConnect)throw new Error("the 'onConnect' handler must be provided");if("function"!=typeof n.onDisconnect)throw new Error("the 'onDisconnect' handler must be provided");this.multicodecs=Array.isArray(r)?r:[r],this._registrar=void 0,this._onProtocolChange=this._onProtocolChange.bind(this),this._onPeerConnect=this._onPeerConnect.bind(this)}set registrar(e){this._registrar=e,this._registrar.peerStore.on("change:protocols",this._onProtocolChange),this._registrar.connectionManager.on("peer:connect",this._onPeerConnect),this._updatePeers(this._registrar.peerStore.peers.values())}_updatePeers(e){for(const{id:t,protocols:r}of e)if(this.multicodecs.filter(e=>r.includes(e)).length){this.peers.add(t.toB58String());const e=this._registrar.getConnection(t);e&&this._onConnect(t,e)}else this.peers.delete(t.toB58String())}_onProtocolChange({peerId:e,protocols:t}){const r=this.peers.has(e.toB58String()),n=t.filter(e=>this.multicodecs.includes(e));r&&0===n.length&&this._onDisconnect(e);for(const i of t)if(this.multicodecs.includes(i)){const t=this._registrar.peerStore.get(e);return void this._updatePeers([t])}}_onPeerConnect(e){const t=e.remotePeer,r=this._registrar.peerStore.protoBook.get(t);r&&this.multicodecs.find(e=>r.includes(e))&&(this.peers.add(t.toB58String()),this._onConnect(t,e))}},{className:"MulticodecTopology",symbolName:"@libp2p/js-interfaces/topology/multicodec-topology"})},function(e,t,r){"use strict";const n=r(16),i=n(r(741)),s=i.RPC,o=n(r(742));(t=e.exports).rpc=i,t.td=o,t.RPC=s,t.Message=s.Message,t.SubOpts=s.SubOpts},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GossipsubFanoutTTL=t.GossipsubHeartbeatInterval=t.GossipsubHeartbeatInitialDelay=t.GossipsubHistoryGossip=t.GossipsubHistoryLength=t.GossipsubDhi=t.GossipsubDlo=t.GossipsubD=t.GossipsubID=t.FloodSubID=void 0;const n=t.second=1e3,i=t.minute=60*n;t.FloodSubID="/floodsub/1.0.0",t.GossipsubID="/meshsub/1.0.0",t.GossipsubD=6,t.GossipsubDlo=4,t.GossipsubDhi=12,t.GossipsubHistoryLength=5,t.GossipsubHistoryGossip=3,t.GossipsubHeartbeatInitialDelay=100/n,t.GossipsubHeartbeatInterval=n,t.GossipsubFanoutTTL=i},function(e,t,r){"use strict";var n=Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]},i=function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(759),t),i(r(760),t)},function(e,t,r){"use strict";const n=r(769),i=r(771);e.exports=(e,t)=>{const r=n(e,{...t,count:1});return i.fn(async e=>{e(()=>{r.cancel()});const[t]=await r;return t})()},e.exports.AggregateError=n.AggregateError},function(e,t,r){"use strict";e.exports={DIAL_TIMEOUT:3e4,MAX_PARALLEL_DIALS:100,MAX_PER_PEER_DIALS:4,METRICS:{computeThrottleMaxQueueSize:1e3,computeThrottleTimeout:2e3,movingAverageIntervals:[6e4,3e5,9e5],maxOldPeersRetention:50}}},function(e,t,r){"use strict";e.exports=function(e){if(e){if("function"==typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"==typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();if("function"==typeof e.next)return e}throw new Error("argument is not an iterator or iterable")}},function(e,t,r){"use strict";e.exports={relay:"/libp2p/circuit/relay/0.1.0"}},function(e,t,r){"use strict";const n=r(25),i=r(82),{CircuitRelay:s}=r(81),o=r(2),a=o("libp2p:circuit:stream-handler");a.error=o("libp2p:circuit:stream-handler:error");e.exports=class{constructor({stream:e,maxLength:t=4096}){this.stream=e,this.shake=i(this.stream),this.decoder=n.decode.fromReader(this.shake.reader,{maxDataLength:t})}async read(){const e=await this.decoder.next();if(e.value){const t=s.decode(e.value.slice());return a("read message type",t.type),t}a("read received no value, closing stream"),this.close()}write(e){a("write message type %s",e.type),this.shake.write(n.encode.single(s.encode(e)))}rest(){return this.shake.rest(),this.shake.stream}end(e){this.write(e),this.close()}close(){a("closing the stream"),this.rest().sink([])}}},function(e,t,r){"use strict";(function(e){function r(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function n(e){return this instanceof n?(this.v=e,this):new n(e)}function i(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,s=r.apply(e,t||[]),o=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(e){s[e]&&(i[e]=function(t){return new Promise((function(r,n){o.push([e,t,r,n])>1||c(e,t)}))})}function c(e,t){try{(r=s[e](t)).value instanceof n?Promise.resolve(r.value.v).then(u,f):h(o[0][2],r)}catch(i){h(o[0][3],i)}var r}function u(e){c("next",e)}function f(e){c("throw",e)}function h(e,t){e(t),o.shift(),o.length&&c(o[0][0],o[0][1])}}function s(e){var t,r;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,s){t[i]=e[i]?function(t){return(r=!r)?{value:n(e[i](t)),done:"return"===i}:s?s(t):t}:s}}function o(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=r(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise((function(n,i){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,i,(t=e[r](t)).done,t.value)}))}}}function a(e){if("function"==typeof e.next)return e;if("function"==typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"==typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();throw new TypeError('"values" does not to conform to any of the iterator or iterable protocols')}function c(){let e,t;return{promise:new Promise((r,n)=>{t=r,e=n}),reject:e,resolve:t}}function u(e,t){const r=a(t),n=[],i=[];let s=!1,o=!1;async function u(){if(!o&&!(s||n.length>=e)){s=!0;try{const{done:e,value:t}=await r.next();e?o=!0:n.push({value:t})}catch(t){o=!0,n.push({error:t})}!function(){for(;i.length>0&&n.length>0;){const e=i.shift(),{error:t,value:r}=n.shift();t?e.reject(t):e.resolve({done:!1,value:r})}for(;i.length>0&&o;){const{resolve:e}=i.shift();e({done:!0,value:void 0})}}(),s=!1,u()}}const f={next:async function(){if(n.length>0){const{error:e,value:t}=n.shift();if(e)throw e;return u(),{done:!1,value:t}}if(o)return{done:!0,value:void 0};const e=c();return i.push(e),u(),e.promise},[Symbol.asyncIterator]:()=>f};return f}function f(e,t){return void 0===t?t=>f(e,t):t[Symbol.asyncIterator]?u(e,t):function*(e,t){const r=[];let n;try{for(const n of t)r.push(n),r.length<=e||(yield r.shift())}catch(i){n=i}for(const s of r)yield s;if(n)throw n}(e,t)}function h(e,t){return i(this,arguments,(function*(){var r,i;try{for(var s,a=o(t);!(s=yield n(a.next())).done;){const t=s.value;(yield n(e(t)))&&(yield yield n(t))}}catch(c){r={error:c}}finally{try{s&&!s.done&&(i=a.return)&&(yield n(i.call(a)))}finally{if(r)throw r.error}}}))}function l(e,t){return void 0===t?t=>h(e,t):h(e,t)}function d(e){return i(this,arguments,(function*(){var t,r;try{for(var i,a=o(e);!(i=yield n(a.next())).done;){const e=i.value;e&&"string"!=typeof e&&(e[Symbol.iterator]||e[Symbol.asyncIterator])?yield n(yield*s(o(d(e)))):yield yield n(e)}}catch(c){t={error:c}}finally{try{i&&!i.done&&(r=a.return)&&(yield n(r.call(a)))}finally{if(t)throw t.error}}}))}function p(e,t){return i(this,arguments,(function*(){var r,i;try{for(var s,a=o(t);!(s=yield n(a.next())).done;){const t=s.value;yield yield n(yield n(e(t)))}}catch(c){r={error:c}}finally{try{s&&!s.done&&(i=a.return)&&(yield n(i.call(a)))}finally{if(r)throw r.error}}}))}function b(e,t){return void 0===t?t=>p(e,t):p(e,t)}async function y(e){return new Promise(t=>{e.once("readable",()=>{t()})})}function m(e,...t){let r=e();for(const n of t)r=n(r);return r}function g(e,t,r){return void 0===t?(t,r)=>g(e,t,r):void 0===r?r=>g(e,t,r):function(e,t,r){return i(this,arguments,(function*(){let s=null;const c=a(m(()=>r,f(1),(function(e){return i(this,arguments,(function*(){var t,r;try{for(var i,a=o(e);!(i=yield n(a.next())).done;){const e=i.value;if(s)return yield n(void 0);yield yield n(e)}}catch(c){t={error:c}}finally{try{i&&!i.done&&(r=a.return)&&(yield n(r.call(a)))}finally{if(t)throw t.error}}}))}),b(e=>({value:t(e)})),f(e)));for(;;){const{value:e,done:t}=yield n(c.next());if(t)break;try{const t=yield n(e.value);s||(yield yield n(t))}catch(u){s=u}}if(s)throw s}))}(e,t,r)}function v(e,t){return i(this,arguments,(function*(){var r,i;try{for(var s,a=o(t);!(s=yield n(a.next())).done;){const t=s.value;yield n(e(t)),yield yield n(t)}}catch(c){r={error:c}}finally{try{s&&!s.done&&(i=a.return)&&(yield n(i.call(a)))}finally{if(r)throw r.error}}}))}function w(e,t){let r=e[0]+t[0],n=e[1]+t[1];if(n>=1e9){const e=n%1e9;r+=(n-e)/1e9,n=e}return[r,n]}async function _(e,t){var r,n;let i=null,s=null,a=null;const c=e=>{i=e,s&&s(e)},u=()=>{a&&a()};e.once("error",c);try{for(var f,h=o(t);!(f=await h.next()).done;){const t=f.value;if(!1===e.write(t)&&await new Promise((t,r)=>{if(i)return r(i);e.once("drain",u),a=t,s=r}),i)break}}catch(l){r={error:l}}finally{try{f&&!f.done&&(n=h.return)&&await n.call(h)}finally{if(r)throw r.error}}if(e.removeListener("error",c),e.removeListener("drain",u),i)throw i}Object.defineProperty(t,"__esModule",{value:!0}),t.batch=function e(t,r){if(void 0===r)return r=>e(t,r);if(r[Symbol.asyncIterator])return function(e,t){return i(this,arguments,(function*(){var r,i;let s=[];try{for(var a,c=o(t);!(a=yield n(c.next())).done;){const t=a.value;s.push(t),s.length===e&&(yield yield n(s),s=[])}}catch(u){r={error:u}}finally{try{a&&!a.done&&(i=c.return)&&(yield n(i.call(c)))}finally{if(r)throw r.error}}s.length>0&&(yield yield n(s))}))}(t,r);return function*(e,t){let r=[];for(const n of t)r.push(n),r.length===e&&(yield r,r=[]);r.length>0&&(yield r)}(t,r)},t.buffer=f,t.collect=function(e){if(e[Symbol.asyncIterator])return async function(e){var t,r;const n=[];try{for(var i,s=o(e);!(i=await s.next()).done;){const e=i.value;n.push(e)}}catch(a){t={error:a}}finally{try{i&&!i.done&&(r=s.return)&&await r.call(s)}finally{if(t)throw t.error}}return n}(e);return Array.from(e)},t.concat=function(...e){return e.find(e=>void 0!==e[Symbol.asyncIterator])?function(e){return i(this,arguments,(function*(){var t,r;try{for(var i,a=o(e);!(i=yield n(a.next())).done;){const e=i.value;yield n(yield*s(o(e)))}}catch(c){t={error:c}}finally{try{i&&!i.done&&(r=a.return)&&(yield n(r.call(a)))}finally{if(t)throw t.error}}}))}(e):function*(e){for(const t of e)yield*t}(e)},t.consume=function(e){if(e[Symbol.asyncIterator])return async function(e){var t,r;try{for(var n,i=o(e);!(n=await i.next()).done;){n.value}}catch(s){t={error:s}}finally{try{n&&!n.done&&(r=i.return)&&await r.call(i)}finally{if(t)throw t.error}}}(e)},t.filter=l,t.flatMap=function e(t,r){if(void 0===r)return r=>e(t,r);return l(e=>null!=e,d(b(t,r)))},t.flatten=d,t.flatTransform=function e(t,r,n){if(void 0===r)return(r,n)=>n?e(t,r,n):e(t,r);if(void 0===n)return n=>e(t,r,n);return l(e=>null!=e,d(function(e,t,r){const n=a(r),i=[],s=[];let u=!1,f=!1,h=0,l=null;function d(){for(;s.length>0&&i.length>0;){const{resolve:e}=s.shift();e({done:!1,value:i.shift()})}for(;s.length>0&&0===h&&u;){const{resolve:e,reject:t}=s.shift();l?(t(l),l=null):e({done:!0,value:void 0})}}async function p(){if(u)d();else if(!(f||h+i.length>=e)){f=!0,h++;try{const{done:e,value:r}=await n.next();e?(u=!0,h--,d()):async function(e){var r,n;try{const u=await t(e);if(u&&u[Symbol.asyncIterator])try{for(var s,a=o(u);!(s=await a.next()).done;){const e=s.value;i.push(e)}}catch(c){r={error:c}}finally{try{s&&!s.done&&(n=a.return)&&await n.call(a)}finally{if(r)throw r.error}}else i.push(u)}catch(f){u=!0,l=f}h--,d(),p()}(r)}catch(r){u=!0,h--,l=r,d()}f=!1,p()}}const b={next:async function(){if(0===i.length){const e=c();return s.push(e),p(),e.promise}const e=i.shift();return p(),{done:!1,value:e}},[Symbol.asyncIterator]:()=>b};return b}(t,r,n)))},t.fromStream=function(e){if("function"==typeof e[Symbol.asyncIterator])return e;return function(e){return i(this,arguments,(function*(){for(;;){const t=e.read();if(null===t){if(e._readableState.ended)return yield n(void 0);yield n(y(e))}else yield yield n(t)}}))}(e)},t.getIterator=a,t.map=b,t.merge=function(...e){return i(this,arguments,(function*(){const t=new Set(e.map(a));for(;t.size>0;)for(const e of t){const r=yield n(e.next());r.done?t.delete(e):yield yield n(r.value)}}))},t.parallelFlatMap=function e(t,r,n){if(void 0===r)return(r,n)=>n?e(t,r,n):e(t,r);if(void 0===n)return n=>e(t,r,n);return l(e=>null!=e,d(g(t,r,n)))},t.parallelMap=g,t.parallelMerge=function(...e){return i(this,arguments,(function*(){const t=e.map(a),r=new Set,i=new Map;let s=null,o=null,c=null;const u=e=>{s=e,o&&o(e)},f=e=>{c&&c(e)},h=e=>{const t=Promise.resolve(e.next()).then(async({done:n,value:s})=>{n||i.set(e,s),r.delete(t)});r.add(t),t.then(f,u)};for(const e of t)h(e);for(;;){if(0===r.size&&0===i.size)return yield n(void 0);yield n(new Promise((e,t)=>{if(s&&t(s),i.size>0)return e();c=e,o=t}));for(const[e,t]of i)i.delete(e),yield yield n(t),h(e)}}))},t.pipeline=m,t.reduce=function e(t,r,n){if(void 0===r)return(r,n)=>n?e(t,r,n):e(t,r);if(void 0===n)return n=>e(t,r,n);return async function(e,t,r){var n,i;let s=t;try{for(var a,c=o(r);!(a=await c.next()).done;){const t=a.value;s=await e(s,t)}}catch(u){n={error:u}}finally{try{a&&!a.done&&(i=c.return)&&await i.call(c)}finally{if(n)throw n.error}}return s}(t,r,n)},t.take=function e(t,r){if(void 0===r)return r=>e(t,r);if(r[Symbol.asyncIterator])return function(e,t){return i(this,arguments,(function*(){var r,i;let s=0;try{for(var a,c=o(t);!(a=yield n(c.next())).done;){const t=a.value;if(yield yield n(yield n(t)),s++,s>=e)return yield n(void 0)}}catch(u){r={error:u}}finally{try{a&&!a.done&&(i=c.return)&&(yield n(i.call(c)))}finally{if(r)throw r.error}}}))}(t,r);return function*(e,t){let r=0;for(const n of t)if(yield n,r++,r>=e)return}(t,r)},t.tap=function(e,t){if(void 0===t)return t=>v(e,t);return v(e,t)},t.time=function t(r={},s){if(void 0===s)return e=>t(r,e);return void 0!==s[Symbol.asyncIterator]?function(t,r){return i(this,arguments,(function*(){const i=r[Symbol.asyncIterator]();let s=[0,0];for(;;){const r=e.hrtime(),{value:o,done:a}=yield n(i.next()),c=e.hrtime(r);if(s=w(s,c),t.progress&&t.progress(c,s),a)return t.total&&t.total(s),yield n(o);yield yield n(o)}}))}(r,s):function*(t,r){const n=r[Symbol.iterator]();let i=[0,0];for(;;){const r=e.hrtime(),{value:s,done:o}=n.next(),a=e.hrtime(r);if(i=w(i,a),t.progress&&t.progress(a,i),o)return t.total&&t.total(i),s;yield s}}(r,s)},t.transform=function e(t,r,n){if(void 0===r)return(r,n)=>n?e(t,r,n):e(t,r);if(void 0===n)return n=>e(t,r,n);return function(e,t,r){const n=a(r),i=[],s=[];let o=!1,u=!1,f=0,h=null;function l(){for(;s.length>0&&i.length>0;){const{resolve:e}=s.shift();e({done:!1,value:i.shift()})}for(;s.length>0&&0===f&&o;){const{resolve:e,reject:t}=s.shift();h?(t(h),h=null):e({done:!0,value:void 0})}}async function d(){if(o)l();else if(!(u||f+i.length>=e)){u=!0,f++;try{const{done:e,value:r}=await n.next();e?(o=!0,f--,l()):async function(e){try{const r=await t(e);i.push(r)}catch(r){o=!0,h=r}f--,l(),d()}(r)}catch(r){o=!0,f--,h=r,l()}u=!1,d()}}const p={next:async function(){if(0===i.length){const e=c();return s.push(e),d(),e.promise}const e=i.shift();return d(),{done:!1,value:e}},[Symbol.asyncIterator]:()=>p};return p}(t,r,n)},t.writeToStream=function(e,t){if(void 0===t)return t=>_(e,t);return _(e,t)},void 0===Symbol.asyncIterator&&(Symbol.asyncIterator=Symbol.for("asyncIterator"))}).call(this,r(8))},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(30),s=r(25),o=r(19),a=r(1),c=n.from("\n");async function u(e){for await(const t of e)return t}t.encode=e=>s.encode.single(new i([e,c])),t.write=(e,r)=>e.push(t.encode(r)),t.writeAll=(e,r)=>{e.push(r.reduce((e,r)=>e.append(t.encode(r)),new i))},t.read=async e=>{let t=1;const r={[Symbol.asyncIterator](){return this},next:()=>e.next(t)},n=await o(r,s.decode({onLength:e=>{t=e}}),u);if(n.get(n.length-1)!==c[0])throw a(new Error("missing newline"),"ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");return n.shallowSlice(0,-1)}},function(e,t,r){"use strict";t.BITS=32,t.GROUPS=4,t.RE_ADDRESS=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,t.RE_SUBNET_STRING=/\/\d{1,2}$/},function(e,t,r){"use strict";t.BITS=128,t.GROUPS=8,t.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},t.TYPES={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"},t.RE_BAD_CHARACTERS=/([^0-9a-f:\/%])/gi,t.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,t.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/,t.RE_ZONE_STRING=/%.*$/,t.RE_URL=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),t.RE_URL_WITH_PORT=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/)},function(e,t,r){"use strict";t.CODE_P2P=421,t.CODE_CIRCUIT=290,t.CLOSE_TIMEOUT=2e3},function(e,t,r){"use strict";var n=r(869)("socket.io-parser"),i=r(182),s=r(872),o=r(330),a=r(331);function c(){}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=c,t.Decoder=h;var u=t.ERROR+'"encode error"';function f(e){var r=""+e.type;if(t.BINARY_EVENT!==e.type&&t.BINARY_ACK!==e.type||(r+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(r+=e.nsp+","),null!=e.id&&(r+=e.id),null!=e.data){var i=function(e){try{return JSON.stringify(e)}catch(t){return!1}}(e.data);if(!1===i)return u;r+=i}return n("encoded %j as %s",e,r),r}function h(){this.reconstructor=null}function l(e){this.reconPack=e,this.buffers=[]}function d(e){return{type:t.ERROR,data:"parser error: "+e}}c.prototype.encode=function(e,r){(n("encoding packet %j",e),t.BINARY_EVENT===e.type||t.BINARY_ACK===e.type)?function(e,t){s.removeBlobs(e,(function(e){var r=s.deconstructPacket(e),n=f(r.packet),i=r.buffers;i.unshift(n),t(i)}))}(e,r):r([f(e)])},i(h.prototype),h.prototype.add=function(e){var r;if("string"==typeof e)r=function(e){var r=0,i={type:Number(e.charAt(0))};if(null==t.types[i.type])return d("unknown packet type "+i.type);if(t.BINARY_EVENT===i.type||t.BINARY_ACK===i.type){for(var s="";"-"!==e.charAt(++r)&&(s+=e.charAt(r),r!=e.length););if(s!=Number(s)||"-"!==e.charAt(r))throw new Error("Illegal attachments");i.attachments=Number(s)}if("/"===e.charAt(r+1))for(i.nsp="";++r;){if(","===(c=e.charAt(r)))break;if(i.nsp+=c,r===e.length)break}else i.nsp="/";var a=e.charAt(r+1);if(""!==a&&Number(a)==a){for(i.id="";++r;){var c;if(null==(c=e.charAt(r))||Number(c)!=c){--r;break}if(i.id+=e.charAt(r),r===e.length)break}i.id=Number(i.id)}if(e.charAt(++r)){var u=function(e){try{return JSON.parse(e)}catch(t){return!1}}(e.substr(r));if(!(!1!==u&&(i.type===t.ERROR||o(u))))return d("invalid payload");i.data=u}return n("decoded %s as %j",e,i),i}(e),t.BINARY_EVENT===r.type||t.BINARY_ACK===r.type?(this.reconstructor=new l(r),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",r)):this.emit("decoded",r);else{if(!a(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(r=this.reconstructor.takeBinaryData(e))&&(this.reconstructor=null,this.emit("decoded",r))}},h.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},l.prototype.takeBinaryData=function(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t=s.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null},l.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(e,t,r){"use strict";function n(e){if(e)return function(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}(e)}e.exports=n,n.prototype.on=n.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},n.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<n.length;i++)if((r=n[i])===t||r.fn===t){n.splice(i,1);break}return this},n.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),r=this._callbacks["$"+e];if(r)for(var n=0,i=(r=r.slice(0)).length;n<i;++n)r[n].apply(this,t);return this},n.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},n.prototype.hasListeners=function(e){return!!this.listeners(e).length}},function(e,t,r){"use strict";var n=r(875),i=r(184);e.exports=function(e){var t=e.xdomain,r=e.xscheme,s=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||n))return new XMLHttpRequest}catch(o){}try{if("undefined"!=typeof XDomainRequest&&!r&&s)return new XDomainRequest}catch(o){}if(!t)try{return new(i[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(o){}}},function(e,t,r){"use strict";e.exports="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")()},function(e,t,r){"use strict";var n=r(69),i=r(186);function s(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.withCredentials=e.withCredentials,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=s,i(s.prototype),s.prototype.onError=function(e,t){var r=new Error(e);return r.type="TransportError",r.description=t,this.emit("error",r),this},s.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},s.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},s.prototype.send=function(e){if("open"!==this.readyState)throw new Error("Transport not open");this.write(e)},s.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},s.prototype.onData=function(e){var t=n.decodePacket(e,this.socket.binaryType);this.onPacket(t)},s.prototype.onPacket=function(e){this.emit("packet",e)},s.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(e,t,r){"use strict";function n(e){if(e)return function(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}(e)}e.exports=n,n.prototype.on=n.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},n.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<n.length;i++)if((r=n[i])===t||r.fn===t){n.splice(i,1);break}return 0===n.length&&delete this._callbacks["$"+e],this},n.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(r){n=0;for(var i=(r=r.slice(0)).length;n<i;++n)r[n].apply(this,t)}return this},n.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},n.prototype.hasListeners=function(e){return!!this.listeners(e).length}},function(e,t,r){"use strict";e.exports=e=>{if(e[Symbol.asyncIterator])return e;if(e.getReader)return async function*(){const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)return;yield r}}finally{t.releaseLock()}}();throw new Error("unknown stream")}},function(e,t,r){"use strict";const n=r(899),i=r(906);e.exports=new n("X25519","ED25519",i)},function(e,t,r){"use strict";const n=r(907),i=r(82),s=r(25);e.exports=(e,t={})=>{const r=i(e),o=s.decode.fromReader(r.reader,t);let a=!1;const c={read:async e=>{const{value:t,done:n}=await r.reader.next(e);if(n&&t.length<e)throw new Error("Couldn't read enough bytes");if(a=n,!t)throw new Error("Value is null");return t},readLP:async()=>{const{value:e,done:t}=await o.next();if(a=t,!e)throw new Error("Value is null");return e},readPB:async e=>{const t=await c.readLP();if(!t)throw new Error("Value is null");const r=n(t)?t:t.slice();return e.decode(r)},write:e=>{r.writer.push(e)},writeLP:e=>{c.write(s.encode.single(e,t))},writePB:(e,t)=>{c.writeLP(t.encode(e))},pb:e=>({read:()=>c.readPB(e),write:t=>c.writePB(t,e)}),unwrap:()=>(r.rest(),r.stream)};return c}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DUMP_SESSION_KEYS=t.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG=t.NOISE_MSG_MAX_LENGTH_BYTES=void 0;t.NOISE_MSG_MAX_LENGTH_BYTES=65535;t.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG=65519;const n={NODE_ENV:"production"}.DUMP_SESSION_KEYS;t.DUMP_SESSION_KEYS=n},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(6),s=r(28),o=r(2),a=o("libp2p:secio");a.error=o("libp2p:secio:error");const c=r(940),u=r(941),{UnexpectedPeerError:f}=r(192);t.createProposal=e=>(e.proposal.out={rand:s.randomBytes(16),pubkey:e.key.local.public.bytes,exchanges:u.exchanges.join(","),ciphers:u.ciphers.join(","),hashes:u.hashes.join(",")},e.proposalEncoded.out=c.Propose.encode(e.proposal.out),e.proposalEncoded.out),t.createExchange=async e=>{const t=await s.keys.generateEphemeralKeyPair(e.protocols.local.curveT);e.ephemeralKey.local=t.key,e.shared.generate=t.genSharedKey;const r=n.concat([e.proposalEncoded.out,e.proposalEncoded.in,e.ephemeralKey.local]),i=await e.key.local.sign(r);return e.exchange.out={epubkey:e.ephemeralKey.local,signature:i},c.Exchange.encode(e.exchange.out)},t.identify=async(e,t)=>{a("1.1 identify"),e.proposalEncoded.in=t,e.proposal.in=c.Propose.decode(t);const r=e.proposal.in.pubkey;e.key.remote=s.keys.unmarshalPublicKey(r);const n=await i.createFromPubKey(r.toString("base64"));if(e.id.remote){if(e.id.remote.toString()!==n.toString())throw new f("Dialed to the wrong peer: IDs do not match!");e.id.remote.pubKey=e.key.remote}else e.id.remote=n;a("1.1 identify - %s - identified remote peer as %s",e.id.local.toB58String(),e.id.remote.toB58String())},t.selectProtocols=async e=>{a("1.2 selection");const t={pubKeyBytes:e.key.local.public.bytes,exchanges:u.exchanges,hashes:u.hashes,ciphers:u.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},n=await u.selectBest(t,r);e.protocols.remote={order:n.order,curveT:n.curveT,cipherT:n.cipherT,hashT:n.hashT},e.protocols.local={order:n.order,curveT:n.curveT,cipherT:n.cipherT,hashT:n.hashT}},t.verify=async(e,t)=>{a("2.1. verify"),e.exchange.in=c.Exchange.decode(t),e.ephemeralKey.remote=e.exchange.in.epubkey;const r=n.concat([e.proposalEncoded.in,e.proposalEncoded.out,e.ephemeralKey.remote]);if(!await e.key.remote.verify(r,e.exchange.in.signature))throw new Error("Bad signature");a("2.1. verify - signature verified")},t.generateKeys=async e=>{a("2.2. keys");const t=await e.shared.generate(e.exchange.in.epubkey);e.shared.secret=t;const r=await s.keys.keyStretcher(e.protocols.local.cipherT,e.protocols.local.hashT,e.shared.secret);if(e.protocols.local.order>0)e.protocols.local.keys=r.k1,e.protocols.remote.keys=r.k2;else{if(!(e.protocols.local.order<0))throw new Error("you are trying to talk to yourself");e.protocols.local.keys=r.k2,e.protocols.remote.keys=r.k1}a("2.3. mac + cipher"),await Promise.all([e.protocols.local,e.protocols.remote].map(e=>u.makeMacAndCipher(e)))},t.verifyNonce=(e,t)=>{const r=e.proposal.out.rand;if(!r.equals(t))throw new Error("Failed to read our encrypted nonce: ".concat(r.toString("hex")," != ").concat(t.toString("hex")))}},function(e,t,r){"use strict";class n extends Error{constructor(e="Unexpected Peer"){super(e),this.code=n.code}static get code(){return"ERR_UNEXPECTED_PEER"}}class i extends Error{constructor(e="Invalid crypto exchange"){super(e),this.code=i.code}static get code(){return"ERR_INVALID_CRYPTO_EXCHANGE"}}class s extends Error{constructor(e="Invalid crypto transmission"){super(e),this.code=s.code}static get code(){return"ERR_INVALID_CRYPTO_TRANSMISSION"}}e.exports={UnexpectedPeerError:n,InvalidCryptoExchangeError:i,InvalidCryptoTransmissionError:s}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(1),s=r(17),o=r(954);async function a(e,t,r){const n=await a.digest(e,t,r);return s.encode(n,t,r)}a.Buffer=n,a.multihash=s,a.digest=async(e,t,r)=>{const n=a.createHash(t),i=await n(e);return r?i.slice(0,r):i},a.createHash=function(e){if(!e)throw i(new Error("hash algorithm must be specified"),"ERR_HASH_ALGORITHM_NOT_SPECIFIED");if(e=s.coerceCode(e),!a.functions[e])throw i(new Error("multihash function '".concat(e,"' not yet supported")),"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return a.functions[e]},a.functions={0:o.identity,17:o.sha1,18:o.sha2256,19:o.sha2512,20:o.sha3512,21:o.sha3384,22:o.sha3256,23:o.sha3224,24:o.shake128,25:o.shake256,26:o.keccak224,27:o.keccak256,28:o.keccak384,29:o.keccak512,34:o.murmur3128,35:o.murmur332,86:o.dblSha2256},o.addBlake(a.functions),a.validate=async(e,t)=>{const r=await a(e,s.decode(t).name);return 0===n.compare(t,r)},e.exports=a},function(e,t,r){"use strict";(function(t){function r(e,r){if(e.length!==r.length)throw new Error("Inputs should have the same length");for(var n=t.allocUnsafe(e.length),i=0;i<e.length;i++)n[i]=e[i]^r[i];return n}e.exports=r,r.compare=function(e,t){if(e.length!==t.length)throw new Error("Inputs should have the same length");for(var r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0},r.gt=function(e,t){return 1===r.compare(e,t)},r.lt=function(e,t){return-1===r.compare(e,t)},r.eq=function(e,t){return 0===r.compare(e,t)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(193).multihash,i=r(18),s=r(971);e.exports=class{constructor(e,t,r){this.dht=e,this.key=t,this.makePath=r,this._log=i.logger(this.dht.peerId,"query:"+n.toB58String(t)),this.running=!1,this._onStart=this._onStart.bind(this),this._onComplete=this._onComplete.bind(this)}async run(e){return this.dht._queryManager.running?0===e.length?(this._log.error("Running query with no peers"),{finalSet:new Set,paths:[]}):(this._run=new s(this),this._log("query running with K=".concat(this.dht.kBucketSize,", A=").concat(this.dht.concurrency,", D=").concat(Math.min(this.dht.disjointPaths,e.length))),this._run.once("start",this._onStart),this._run.once("complete",this._onComplete),this._run.execute(e)):(this._log.error("Attempt to run query after shutdown"),{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 ".concat(Date.now()-this._startTime,"ms")),this._run&&this._log("".concat(this._run.errors.length," of ").concat(this._run.peersSeen.size," peers errored (").concat(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))}}},function(e,t,r){"use strict";const n=r(357),i=r(1);t.getPubsubRouting=(e,t)=>{if(!e||!t.EXPERIMENTAL||!t.EXPERIMENTAL.ipnsPubsub)throw i(new Error("IPNS pubsub subsystem is not enabled"),"ERR_IPNS_PUBSUB_NOT_ENABLED");if(n.isIpnsPubsubDatastore(e.routing))return e.routing;const r=(e.routing.stores||[]).find(e=>n.isIpnsPubsubDatastore(e));if(!r)throw i(new Error("IPNS pubsub datastore not found"),"ERR_PUBSUB_DATASTORE_NOT_FOUND");return r}},function(e,t,r){"use strict";const n=self.location?self.location.protocol+"//"+self.location.host:"",i=self.URL;e.exports={URLWithLegacySupport:class{constructor(e="",t=n){this.super=new i(e,t),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set origin(e){this.super.origin=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set searchParams(e){this.super.searchParams=e}set username(e){this.super.username=e}createObjectURL(e){return this.super.createObjectURL(e)}revokeObjectURL(e){this.super.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}},URLSearchParams:self.URLSearchParams,defaultBase:n,format:function(e){if("string"==typeof e){return new i(e).toString()}if(!(e instanceof i)){const t=e.username&&e.password?"".concat(e.username,":").concat(e.password,"@"):"",r=e.auth?e.auth+"@":"",n=e.port?":"+e.port:"",i=e.protocol?e.protocol+"//":"",s=e.host||"",o=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),c=e.hash||"",u=e.pathname||"",f=e.path||u+a;return"".concat(i).concat(t||r).concat(s||o+n).concat(f).concat(c)}}}},function(e,t,r){"use strict";t.read=function(e,t,r,n,i){var s,o,a=8*i-n-1,c=(1<<a)-1,u=c>>1,f=-7,h=r?i-1:0,l=r?-1:1,d=e[t+h];for(h+=l,s=d&(1<<-f)-1,d>>=-f,f+=a;f>0;s=256*s+e[t+h],h+=l,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=256*o+e[t+h],h+=l,f-=8);if(0===s)s=1-u;else{if(s===c)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),s-=u}return(d?-1:1)*o*Math.pow(2,s-n)},t.write=function(e,t,r,n,i,s){var o,a,c,u=8*s-i-1,f=(1<<u)-1,h=f>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:s-1,p=n?1:-1,b=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+h>=1?l/c:l*Math.pow(2,1-h))*c>=2&&(o++,c/=2),o+h>=f?(a=0,o=f):o+h>=1?(a=(t*c-1)*Math.pow(2,i),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;e[r+d]=255&o,d+=p,o/=256,u-=8);e[r+d-p]|=128*b}},function(e,t,r){"use strict";var n=r(0),i=n.Buffer;function s(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(s(n,t),t.Buffer=o),o.prototype=Object.create(i.prototype),s(i,o),o.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},function(e,t,r){"use strict";const n=r(14),{Buffer:i}=r(0);function s(e){return parseInt(e.toString("hex"),16)}function o(e){let t=e.toString(16);return t.length%2==1&&(t="0"+t),i.from(t,"hex")}e.exports={numberToBuffer:o,bufferToNumber:s,varintBufferEncode:function(e){return i.from(n.encode(s(e)))},varintBufferDecode:function(e){return o(n.decode(e))},varintEncode:function(e){return i.from(n.encode(e))}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(16)(r(117));r(43),r(202);const s=r(5),o=r(1),a=r(404);t=e.exports;const c={rsa:r(407),ed25519:r(413),secp256k1:r(415)(i,r(122))};t.supportedKeys=c,t.keysPBM=i;const u="secp256k1 support requires libp2p-crypto-secp256k1 package",f="ERR_MISSING_PACKAGE";function h(e){const t=c[e.toLowerCase()];if(!t){const t=Object.keys(c).join(" / ");throw o(new Error("invalid or unsupported key type ".concat(e,". Must be ").concat(t)),"ERR_UNSUPPORTED_KEY_TYPE")}return t}t.keyStretcher=r(441),t.generateEphemeralKeyPair=r(443),t.generateKeyPair=async(e,t)=>h(e).generateKeyPair(t),t.generateKeyPairFromSeed=async(e,t,r)=>{const n=h(e);if("ed25519"!==e.toLowerCase())throw o(new Error("Seed key derivation is unimplemented for RSA or secp256k1"),"ERR_UNSUPPORTED_KEY_DERIVATION_TYPE");return n.generateKeyPairFromSeed(t,r)},t.unmarshalPublicKey=e=>{const t=i.PublicKey.decode(e),r=t.Data;switch(t.Type){case i.KeyType.RSA:return c.rsa.unmarshalRsaPublicKey(r);case i.KeyType.Ed25519:return c.ed25519.unmarshalEd25519PublicKey(r);case i.KeyType.Secp256k1:if(c.secp256k1)return c.secp256k1.unmarshalSecp256k1PublicKey(r);throw o(new Error(u),f);default:h(t.Type)}},t.marshalPublicKey=(e,t)=>(h(t=(t||"rsa").toLowerCase()),e.bytes),t.unmarshalPrivateKey=async e=>{const t=i.PrivateKey.decode(e),r=t.Data;switch(t.Type){case i.KeyType.RSA:return c.rsa.unmarshalRsaPrivateKey(r);case i.KeyType.Ed25519:return c.ed25519.unmarshalEd25519PrivateKey(r);case i.KeyType.Secp256k1:if(c.secp256k1)return c.secp256k1.unmarshalSecp256k1PrivateKey(r);throw o(new Error(u),f);default:h(t.Type)}},t.marshalPrivateKey=(e,t)=>(h(t=(t||"rsa").toLowerCase()),e.bytes),t.import=async(e,r)=>{try{const n=await a.import(e,r);return t.unmarshalPrivateKey(n)}catch(f){}const i=s.pki.decryptRsaPrivateKey(e,r);if(null===i)throw o(new Error("Cannot read the key, most likely the password is wrong or not a RSA key"),"ERR_CANNOT_DECRYPT_PEM");let u=s.asn1.toDer(s.pki.privateKeyToAsn1(i));return u=n.from(u.getBytes(),"binary"),c.rsa.unmarshalRsaPrivateKey(u)}},function(e,t,r){"use strict";var n=r(5);if(r(73),r(43),r(118),r(46),r(72),r(205),r(120),r(47),r(400),r(90),r(9),void 0===i)var i=n.jsbn.BigInteger;var s=n.asn1,o=n.pki=n.pki||{};e.exports=o.pbe=n.pbe=n.pbe||{};var a=o.oids,c={name:"EncryptedPrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},u={name:"PBES2Algorithms",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},f={name:"pkcs-12PbeParams",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"iterations"}]};function h(e,t){return e.start().update(t).digest().getBytes()}function l(e){var t;if(e){if(!(t=o.oids[s.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return d(t)}function d(e){var t=n.md;switch(e){case"hmacWithSHA224":t=n.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}o.encryptPrivateKeyInfo=function(e,t,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var i,c,u,f=n.random.getBytesSync(r.saltSize),h=r.count,l=s.integerToDer(h);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var p,b,y;switch(r.algorithm){case"aes128":i=16,p=16,b=a["aes128-CBC"],y=n.aes.createEncryptionCipher;break;case"aes192":i=24,p=16,b=a["aes192-CBC"],y=n.aes.createEncryptionCipher;break;case"aes256":i=32,p=16,b=a["aes256-CBC"],y=n.aes.createEncryptionCipher;break;case"des":i=8,p=8,b=a.desCBC,y=n.des.createEncryptionCipher;break;default:throw(E=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,E}var m="hmacWith"+r.prfAlgorithm.toUpperCase(),g=d(m),v=n.pkcs5.pbkdf2(t,f,h,i,g),w=n.random.getBytesSync(p);(k=y(v)).start(w),k.update(s.toDer(e)),k.finish(),u=k.output.getBytes();var _=function(e,t,r,i){var a=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,t.getBytes())]);"hmacWithSHA1"!==i&&a.value.push(s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,n.util.hexToBytes(r.toString(16))),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(o.oids[i]).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]));return a}(f,l,i,m);c=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a.pkcs5PBES2).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a.pkcs5PBKDF2).getBytes()),_]),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(b).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,w)])])])}else{var E;if("3des"!==r.algorithm)throw(E=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,E;i=24;var k,S=new n.util.ByteBuffer(f);v=o.pbe.generatePkcs12Key(t,S,1,h,i),w=o.pbe.generatePkcs12Key(t,S,2,h,i);(k=n.des.createEncryptionCipher(v)).start(w),k.update(s.toDer(e)),k.finish(),u=k.output.getBytes(),c=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,f),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,l.getBytes())])])}return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[c,s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,u)])},o.decryptPrivateKeyInfo=function(e,t){var r=null,i={},a=[];if(!s.validate(e,c,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 f=s.derToOid(i.encryptionOid),h=o.pbe.getCipher(f,i.encryptionParams,t),l=n.util.createBuffer(i.encryptedData);return h.update(l),h.finish()&&(r=s.fromDer(h.output)),r},o.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:s.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})},o.encryptedPrivateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return s.fromDer(t.body)},o.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var i=o.wrapRsaPrivateKey(o.privateKeyToAsn1(e));return i=o.encryptPrivateKeyInfo(i,t,r),o.encryptedPrivateKeyToPem(i)}var a,c,u,f;switch(r.algorithm){case"aes128":a="AES-128-CBC",u=16,c=n.random.getBytesSync(16),f=n.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",u=24,c=n.random.getBytesSync(16),f=n.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",u=32,c=n.random.getBytesSync(16),f=n.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",u=24,c=n.random.getBytesSync(8),f=n.des.createEncryptionCipher;break;case"des":a="DES-CBC",u=8,c=n.random.getBytesSync(8),f=n.des.createEncryptionCipher;break;default:var h=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw h.algorithm=r.algorithm,h}var l=f(n.pbe.opensslDeriveBytes(t,c.substr(0,8),u));l.start(c),l.update(s.toDer(o.privateKeyToAsn1(e))),l.finish();var d={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:n.util.bytesToHex(c).toUpperCase()},body:l.output.getBytes()};return n.pem.encode(d)},o.decryptRsaPrivateKey=function(e,t){var r=null,i=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type)throw(u=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=u,u;if(i.procType&&"ENCRYPTED"===i.procType.type){var a,c;switch(i.dekInfo.algorithm){case"DES-CBC":a=8,c=n.des.createDecryptionCipher;break;case"DES-EDE3-CBC":a=24,c=n.des.createDecryptionCipher;break;case"AES-128-CBC":a=16,c=n.aes.createDecryptionCipher;break;case"AES-192-CBC":a=24,c=n.aes.createDecryptionCipher;break;case"AES-256-CBC":a=32,c=n.aes.createDecryptionCipher;break;case"RC2-40-CBC":a=5,c=function(e){return n.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":a=8,c=function(e){return n.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":a=16,c=function(e){return n.rc2.createDecryptionCipher(e,128)};break;default:var u;throw(u=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,u}var f=n.util.hexToBytes(i.dekInfo.parameters),h=c(n.pbe.opensslDeriveBytes(t,f.substr(0,8),a));if(h.start(f),h.update(n.util.createBuffer(i.body)),!h.finish())return r;r=h.output.getBytes()}else r=i.body;return null!==(r="ENCRYPTED PRIVATE KEY"===i.type?o.decryptPrivateKeyInfo(s.fromDer(r),t):s.fromDer(r))&&(r=o.privateKeyFromAsn1(r)),r},o.pbe.generatePkcs12Key=function(e,t,r,i,s,o){var a,c;if(null==o){if(!("sha1"in n.md))throw new Error('"sha1" hash algorithm unavailable.');o=n.md.sha1.create()}var u=o.digestLength,f=o.blockLength,h=new n.util.ByteBuffer,l=new n.util.ByteBuffer;if(null!=e){for(c=0;c<e.length;c++)l.putInt16(e.charCodeAt(c));l.putInt16(0)}var d=l.length(),p=t.length(),b=new n.util.ByteBuffer;b.fillWithByte(r,f);var y=f*Math.ceil(p/f),m=new n.util.ByteBuffer;for(c=0;c<y;c++)m.putByte(t.at(c%p));var g=f*Math.ceil(d/f),v=new n.util.ByteBuffer;for(c=0;c<g;c++)v.putByte(l.at(c%d));var w=m;w.putBuffer(v);for(var _=Math.ceil(s/u),E=1;E<=_;E++){var k=new n.util.ByteBuffer;k.putBytes(b.bytes()),k.putBytes(w.bytes());for(var S=0;S<i;S++)o.start(),o.update(k.getBytes()),k=o.digest();var A=new n.util.ByteBuffer;for(c=0;c<f;c++)A.putByte(k.at(c%u));var I=Math.ceil(p/f)+Math.ceil(d/f),T=new n.util.ByteBuffer;for(a=0;a<I;a++){var R=new n.util.ByteBuffer(w.getBytes(f)),x=511;for(c=A.length()-1;c>=0;c--)x>>=8,x+=A.at(c)+R.at(c),R.setAt(c,255&x);T.putBuffer(R)}w=T,h.putBuffer(k)}return h.truncate(h.length()-s),h},o.pbe.getCipher=function(e,t,r){switch(e){case o.oids.pkcs5PBES2:return o.pbe.getCipherForPBES2(e,t,r);case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case o.oids["pbewithSHAAnd40BitRC2-CBC"]:return o.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},o.pbe.getCipherForPBES2=function(e,t,r){var i,a={},c=[];if(!s.validate(t,u,a,c))throw(i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=c,i;if((e=s.derToOid(a.kdfOid))!==o.oids.pkcs5PBKDF2)throw(i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,i.supportedOids=["pkcs5PBKDF2"],i;if((e=s.derToOid(a.encOid))!==o.oids["aes128-CBC"]&&e!==o.oids["aes192-CBC"]&&e!==o.oids["aes256-CBC"]&&e!==o.oids["des-EDE3-CBC"]&&e!==o.oids.desCBC)throw(i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i;var f,h,d=a.kdfSalt,p=n.util.createBuffer(a.kdfIterationCount);switch(p=p.getInt(p.length()<<3),o.oids[e]){case"aes128-CBC":f=16,h=n.aes.createDecryptionCipher;break;case"aes192-CBC":f=24,h=n.aes.createDecryptionCipher;break;case"aes256-CBC":f=32,h=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":f=24,h=n.des.createDecryptionCipher;break;case"desCBC":f=8,h=n.des.createDecryptionCipher}var b=l(a.prfOid),y=n.pkcs5.pbkdf2(r,d,p,f,b),m=a.encIv,g=h(y);return g.start(m),g},o.pbe.getCipherForPKCS12PBE=function(e,t,r){var i={},a=[];if(!s.validate(t,f,i,a))throw(b=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=a,b;var c,u,h,d=n.util.createBuffer(i.salt),p=n.util.createBuffer(i.iterations);switch(p=p.getInt(p.length()<<3),e){case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,u=8,h=n.des.startDecrypting;break;case o.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,u=8,h=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var b;throw(b=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,b}var y=l(i.prfOid),m=o.pbe.generatePkcs12Key(r,d,1,p,c,y);return y.start(),h(m,o.pbe.generatePkcs12Key(r,d,2,p,u,y))},o.pbe.opensslDeriveBytes=function(e,t,r,i){if(null==i){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');i=n.md.md5.create()}null===t&&(t="");for(var s=[h(i,e+t)],o=16,a=1;o<r;++a,o+=16)s.push(h(i,s[a-1]+e+t));return s.join("").substr(0,r)}},function(e,t,r){"use strict";var n=r(5);r(9),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return(e=e.toUpperCase())in n.cipher.algorithms?n.cipher.algorithms[e]:null};var i=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};i.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},i.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},i.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){"use strict";var n=r(5);r(9),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function s(e,t){if("string"==typeof e&&(e=n.util.createBuffer(e)),n.util.isArray(e)&&e.length>4){var r=e;e=n.util.createBuffer();for(var i=0;i<r.length;++i)e.putByte(r[i])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!n.util.isArray(e)){var s=[],o=t/4;for(i=0;i<o;++i)s.push(e.getInt32());e=s}return e}function o(e){e[e.length-1]=e[e.length-1]+1&4294967295}function a(e){return[e/4294967296|0,4294967295&e]}i.ecb=function(e){e=e||{},this.name="ECB",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.ecb.prototype.start=function(e){},i.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},i.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},i.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},i.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);this._prev=this._outBlock},i.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)},i.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},i.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32()^this._outBlock[i],t.putInt32(this._inBlock[i]);else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(s>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32(),t.putInt32(this._inBlock[i]^this._outBlock[i]);else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(s>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(s>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]);else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(s>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}o(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=n.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?n.util.createBuffer(e.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=n.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=r.length();if(12===i)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*i)))}this._inBlock=this._j0.slice(0),o(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=a(8*t.length());var s=t.length()%this.blockSize;for(s&&t.fillWithByte(0,this.blockSize-s),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},i.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^=e.getInt32());this._cipherLength+=this.blockSize}else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(s<=0||r){if(r){var a=n%this.blockSize;this._cipherLength+=a,this._partialOutput.truncate(this.blockSize-a)}else this._cipherLength+=this.blockSize;for(i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),o(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),o(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;i<this._ints;++i)t.putInt32(this._outBlock[i]^this._hashBlock[i]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize},i.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=n.util.createBuffer();var i=this._aDataLength.concat(a(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,i);var s=[];this.cipher.encrypt(this._j0,s);for(var o=0;o<this._ints;++o)this.tag.putInt32(this._s[o]^s[o]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},i.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),i=0;i<128;++i){e[i/32|0]&1<<31-i%32&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n)}return r},i.gcm.prototype.pow=function(e,t){for(var r=1&e[3],n=3;n>0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=e[r/8|0]>>>4*(7-r%8)&15,i=this._m[r][n];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},i.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,s=new Array(i),o=0;o<i;++o){var a=[0,0,0,0],c=(n-1-o%n)*t;a[o/n|0]=1<<t-1<<c,s[o]=this.generateSubHashTable(this.multiply(a,e),t)}return s},i.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,n=r>>>1,i=new Array(r);i[n]=e.slice(0);for(var s=n>>>1;s>0;)this.pow(i[2*s],i[s]=[]),s>>=1;for(s=2;s<n;){for(var o=1;o<s;++o){var a=i[s],c=i[o];i[s+o]=[a[0]^c[0],a[1]^c[1],a[2]^c[2],a[3]^c[3]]}s*=2}for(i[0]=[0,0,0,0],s=n+1;s<r;++s){var u=i[s^n];i[s]=[e[0]^u[0],e[1]^u[1],e[2]^u[2],e[3]^u[3]]}return i}},function(e,t,r){"use strict";(function(t){var n=r(5);r(397),r(46),r(9);var i,s=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(i=r(119)),e.exports=n.pbkdf2=s.pbkdf2=function(e,r,s,o,a,c){if("function"==typeof a&&(c=a,a=null),n.util.isNodejs&&!n.options.usePureJavaScript&&i.pbkdf2&&(null===a||"object"!=typeof a)&&(i.pbkdf2Sync.length>4||!a||"sha1"===a))return"string"!=typeof a&&(a="sha1"),e=t.from(e,"binary"),r=t.from(r,"binary"),c?4===i.pbkdf2Sync.length?i.pbkdf2(e,r,s,o,(function(e,t){if(e)return c(e);c(null,t.toString("binary"))})):i.pbkdf2(e,r,s,o,a,(function(e,t){if(e)return c(e);c(null,t.toString("binary"))})):4===i.pbkdf2Sync.length?i.pbkdf2Sync(e,r,s,o).toString("binary"):i.pbkdf2Sync(e,r,s,o,a).toString("binary");if(null==a&&(a="sha1"),"string"==typeof a){if(!(a in n.md.algorithms))throw new Error("Unknown hash algorithm: "+a);a=n.md[a].create()}var u=a.digestLength;if(o>4294967295*u){var f=new Error("Derived key is too long.");if(c)return c(f);throw f}var h=Math.ceil(o/u),l=o-(h-1)*u,d=n.hmac.create();d.start(a,e);var p,b,y,m="";if(!c){for(var g=1;g<=h;++g){d.start(null,null),d.update(r),d.update(n.util.int32ToBytes(g)),p=y=d.digest().getBytes();for(var v=2;v<=s;++v)d.start(null,null),d.update(y),b=d.digest().getBytes(),p=n.util.xorBytes(p,b,u),y=b;m+=g<h?p:p.substr(0,l)}return m}g=1;function w(){if(g>h)return c(null,m);d.start(null,null),d.update(r),d.update(n.util.int32ToBytes(g)),p=y=d.digest().getBytes(),v=2,_()}function _(){if(v<=s)return d.start(null,null),d.update(y),b=d.digest().getBytes(),p=n.util.xorBytes(p,b,u),y=b,++v,n.util.setImmediate(_);m+=g<h?p:p.substr(0,l),++g,w()}w()}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(207),i=r(208),s=r(93);e.exports={create:function({algorithm:e="AES-GCM",nonceLength:t=12,keyLength:r=16,digest:o="SHA-256",saltLength:a=16,iterations:c=32767}={}){const u=s.get();return r*=8,{encrypt:async function(s,f){const h=u.getRandomValues(new Uint8Array(a)),l=u.getRandomValues(new Uint8Array(t)),d={name:e,iv:l},p={name:"PBKDF2",salt:h,iterations:c,hash:{name:o}},b=await u.subtle.importKey("raw",i(f),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),y=await u.subtle.deriveKey(p,b,{name:e,length:r},!0,["encrypt"]),m=await u.subtle.encrypt(d,y,s);return n([h,d.iv,new Uint8Array(m)])},decrypt:async function(n,s){const f=n.slice(0,a),h=n.slice(a,a+t),l=n.slice(a+t),d={name:e,iv:h},p={name:"PBKDF2",salt:f,iterations:c,hash:{name:o}},b=await u.subtle.importKey("raw",i(s),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),y=await u.subtle.deriveKey(p,b,{name:e,length:r},!0,["decrypt"]),m=await u.subtle.decrypt(d,y,l);return new Uint8Array(m)}}}}},function(e,t,r){"use strict";e.exports=function(e,t){t||(t=e.reduce((e,t)=>e+t.length,0));const r=new Uint8Array(t);let n=0;for(const i of e)r.set(i,n),n+=i.length;return r}},function(e,t,r){"use strict";const{names:n}=r(209),{TextEncoder:i}=r(92),s=new i;e.exports=function(e,t="utf8"){if("utf8"===t||"utf-8"===t)return s.encode(e);const r=n[t];if(!r)throw new Error("Unknown base");return r.decode(e)}},function(e,t,r){"use strict";const n=r(42),i=r(405),s=r(406),{decodeText:o,encodeText:a}=r(210),c=[["identity","\0",()=>({encode:o,decode:a}),""],["base2","0",s(1),"01"],["base8","7",s(3),"01234567"],["base10","9",n,"0123456789"],["base16","f",s(4),"0123456789abcdef"],["base16upper","F",s(4),"0123456789ABCDEF"],["base32hex","v",s(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",s(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",s(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",s(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",s(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",s(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",s(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",s(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",s(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",n,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",n,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",n,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",n,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],u=c.reduce((e,t)=>(e[t[0]]=new i(t[0],t[1],t[2],t[3]),e),{}),f=c.reduce((e,t)=>(e[t[1]]=u[t[0]],e),{});e.exports={names:u,codes:f}},function(e,t,r){"use strict";const{TextEncoder:n,TextDecoder:i}=r(92),s=new i,o=new n;e.exports={decodeText:e=>s.decode(e),encodeText:e=>o.encode(e),concat:function(e,t){const r=new Uint8Array(t);let n=0;for(const i of e)r.set(i,n),n+=i.length;return r}}},function(e,t,r){"use strict";(function(t){var n=r(5);r(91),r(47),r(121),r(9);var i=r(408),s=i.publicKeyValidator,o=i.privateKeyValidator;if(void 0===a)var a=n.jsbn.BigInteger;var c=n.util.ByteBuffer,u=void 0===t?Uint8Array:t;n.pki=n.pki||{},e.exports=n.pki.ed25519=n.ed25519=n.ed25519||{};var f=n.ed25519;function h(e){var r=e.message;if(r instanceof Uint8Array||r instanceof u)return r;var n=e.encoding;if(void 0===r){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');r=e.md.digest().getBytes(),n="binary"}if("string"==typeof r&&!n)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof r){if(void 0!==t)return t.from(r,n);r=new c(r,n)}else if(!(r instanceof c))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var i=new u(r.length()),s=0;s<i.length;++s)i[s]=r.at(s);return i}f.constants={},f.constants.PUBLIC_KEY_BYTE_LENGTH=32,f.constants.PRIVATE_KEY_BYTE_LENGTH=64,f.constants.SEED_BYTE_LENGTH=32,f.constants.SIGN_BYTE_LENGTH=64,f.constants.HASH_BYTE_LENGTH=64,f.generateKeyPair=function(e){var t=(e=e||{}).seed;if(void 0===t)t=n.random.getBytesSync(f.constants.SEED_BYTE_LENGTH);else if("string"==typeof t){if(t.length!==f.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+f.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(t instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');t=h({message:t,encoding:"binary"});for(var r=new u(f.constants.PUBLIC_KEY_BYTE_LENGTH),i=new u(f.constants.PRIVATE_KEY_BYTE_LENGTH),s=0;s<32;++s)i[s]=t[s];return function(e,t){var r,n=[O(),O(),O(),O()],i=w(t,32);for(i[0]&=248,i[31]&=127,i[31]|=64,B(n,i),A(e,n),r=0;r<32;++r)t[r+32]=e[r]}(r,i),{publicKey:r,privateKey:i}},f.privateKeyFromAsn1=function(e){var t={},r=[];if(!n.asn1.validate(e,o,t,r)){var i=new Error("Invalid Key.");throw i.errors=r,i}var s=n.asn1.derToOid(t.privateKeyOid),a=n.oids.EdDSA25519;if(s!==a)throw new Error('Invalid OID "'+s+'"; OID must be "'+a+'".');var c=t.privateKey;return{privateKeyBytes:h({message:n.asn1.fromDer(c).value,encoding:"binary"})}},f.publicKeyFromAsn1=function(e){var t={},r=[];if(!n.asn1.validate(e,s,t,r)){var i=new Error("Invalid Key.");throw i.errors=r,i}var o=n.asn1.derToOid(t.publicKeyOid),a=n.oids.EdDSA25519;if(o!==a)throw new Error('Invalid OID "'+o+'"; OID must be "'+a+'".');var c=t.ed25519PublicKey;if(c.length!==f.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return h({message:c,encoding:"binary"})},f.publicKeyFromPrivateKey=function(e){var t=h({message:(e=e||{}).privateKey,encoding:"binary"});if(t.length!==f.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+f.constants.PRIVATE_KEY_BYTE_LENGTH);for(var r=new u(f.constants.PUBLIC_KEY_BYTE_LENGTH),n=0;n<r.length;++n)r[n]=t[32+n];return r},f.sign=function(e){var t=h(e=e||{}),r=h({message:e.privateKey,encoding:"binary"});if(r.length===f.constants.SEED_BYTE_LENGTH)r=f.generateKeyPair({seed:r}).privateKey;else if(r.length!==f.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+f.constants.SEED_BYTE_LENGTH+" or "+f.constants.PRIVATE_KEY_BYTE_LENGTH);var n=new u(f.constants.SIGN_BYTE_LENGTH+t.length);!function(e,t,r,n){var i,s,o=new Float64Array(64),a=[O(),O(),O(),O()],c=w(n,32);c[0]&=248,c[31]&=127,c[31]|=64;var u=r+64;for(i=0;i<r;++i)e[64+i]=t[i];for(i=0;i<32;++i)e[32+i]=c[32+i];var f=w(e.subarray(32),r+32);for(E(f),B(a,f),A(e,a),i=32;i<64;++i)e[i]=n[i];var h=w(e,r+64);for(E(h),i=32;i<64;++i)o[i]=0;for(i=0;i<32;++i)o[i]=f[i];for(i=0;i<32;++i)for(s=0;s<32;s++)o[i+s]+=h[i]*c[s];_(e.subarray(32),o)}(n,t,t.length,r);for(var i=new u(f.constants.SIGN_BYTE_LENGTH),s=0;s<i.length;++s)i[s]=n[s];return i},f.verify=function(e){var t=h(e=e||{});if(void 0===e.signature)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var r=h({message:e.signature,encoding:"binary"});if(r.length!==f.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+f.constants.SIGN_BYTE_LENGTH);var n=h({message:e.publicKey,encoding:"binary"});if(n.length!==f.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+f.constants.PUBLIC_KEY_BYTE_LENGTH);var i,s=new u(f.constants.SIGN_BYTE_LENGTH+t.length),o=new u(f.constants.SIGN_BYTE_LENGTH+t.length);for(i=0;i<f.constants.SIGN_BYTE_LENGTH;++i)s[i]=r[i];for(i=0;i<t.length;++i)s[i+f.constants.SIGN_BYTE_LENGTH]=t[i];return function(e,t,r,n){var i,s=new u(32),o=[O(),O(),O(),O()],a=[O(),O(),O(),O()];if(-1,r<64)return-1;if(function(e,t){var r=O(),n=O(),i=O(),s=O(),o=O(),a=O(),c=O();M(e[2],d),function(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(e[1],t),j(i,e[1]),U(s,i,p),L(i,i,e[2]),D(s,e[2],s),j(o,s),j(a,o),U(c,a,o),U(r,c,i),U(r,r,s),function(e,t){var r,n=O();for(r=0;r<16;++r)n[r]=t[r];for(r=250;r>=0;--r)j(n,n),1!==r&&U(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(r,r),U(r,r,i),U(r,r,s),U(r,r,s),U(e[0],r,s),j(n,e[0]),U(n,n,s),T(n,i)&&U(e[0],e[0],v);if(j(n,e[0]),U(n,n,s),T(n,i))return-1;x(e[0])===t[31]>>7&&L(e[0],l,e[0]);return U(e[3],e[0],e[1]),0}(a,n))return-1;for(i=0;i<r;++i)e[i]=t[i];for(i=0;i<32;++i)e[i+32]=n[i];var c=w(e,r);if(E(c),C(o,a,c),B(a,t.subarray(32)),k(o,a),A(s,o),r-=64,R(t,0,s,0)){for(i=0;i<r;++i)e[i]=0;return-1}for(i=0;i<r;++i)e[i]=t[i+64];return r}(o,s,s.length,n)>=0};var l=O(),d=O([1]),p=O([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),b=O([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),y=O([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),m=O([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),g=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]),v=O([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(e,r){var i=n.md.sha512.create(),s=new c(e);i.update(s.getBytes(r),"binary");var o=i.digest().getBytes();if(void 0!==t)return t.from(o,"binary");for(var a=new u(f.constants.HASH_BYTE_LENGTH),h=0;h<64;++h)a[h]=o.charCodeAt(h);return a}function _(e,t){var r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i<s;++i)t[i]+=r-16*t[n]*g[i-(n-32)],r=t[i]+128>>8,t[i]-=256*r;t[i]+=r,t[n]=0}for(r=0,i=0;i<32;++i)t[i]+=r-(t[31]>>4)*g[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;++i)t[i]-=r*g[i];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function E(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;_(e,t)}function k(e,t){var r=O(),n=O(),i=O(),s=O(),o=O(),a=O(),c=O(),u=O(),f=O();L(r,e[1],e[0]),L(f,t[1],t[0]),U(r,r,f),D(n,e[0],e[1]),D(f,t[0],t[1]),U(n,n,f),U(i,e[3],t[3]),U(i,i,b),U(s,e[2],t[2]),D(s,s,s),L(o,n,r),L(a,s,i),D(c,s,i),D(u,n,r),U(e[0],o,a),U(e[1],u,c),U(e[2],c,a),U(e[3],o,u)}function S(e,t,r){for(var n=0;n<4;++n)P(e[n],t[n],r)}function A(e,t){var r=O(),n=O(),i=O();!function(e,t){var r,n=O();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)j(n,n),2!==r&&4!==r&&U(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(i,t[2]),U(r,t[0],i),U(n,t[1],i),I(e,n),e[31]^=x(r)<<7}function I(e,t){var r,n,i,s=O(),o=O();for(r=0;r<16;++r)o[r]=t[r];for(N(o),N(o),N(o),n=0;n<2;++n){for(s[0]=o[0]-65517,r=1;r<15;++r)s[r]=o[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=o[15]-32767-(s[14]>>16&1),i=s[15]>>16&1,s[14]&=65535,P(o,s,1-i)}for(r=0;r<16;r++)e[2*r]=255&o[r],e[2*r+1]=o[r]>>8}function T(e,t){var r=new u(32),n=new u(32);return I(r,e),I(n,t),R(r,0,n,0)}function R(e,t,r,n){return function(e,t,r,n,i){var s,o=0;for(s=0;s<i;++s)o|=e[t+s]^r[n+s];return(1&o-1>>>8)-1}(e,t,r,n,32)}function x(e){var t=new u(32);return I(t,e),1&t[0]}function C(e,t,r){var n,i;for(M(e[0],l),M(e[1],d),M(e[2],d),M(e[3],l),i=255;i>=0;--i)S(e,t,n=r[i/8|0]>>(7&i)&1),k(t,e),k(e,e),S(e,t,n)}function B(e,t){var r=[O(),O(),O(),O()];M(r[0],y),M(r[1],m),M(r[2],d),U(r[3],y,m),C(e,r,t)}function M(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function N(e){var t,r,n=1;for(t=0;t<16;++t)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function P(e,t,r){for(var n,i=~(r-1),s=0;s<16;++s)n=i&(e[s]^t[s]),e[s]^=n,t[s]^=n}function O(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;++t)r[t]=e[t];return r}function D(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]+r[n]}function L(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]-r[n]}function j(e,t){U(e,t,t)}function U(e,t,r){var n,i,s=0,o=0,a=0,c=0,u=0,f=0,h=0,l=0,d=0,p=0,b=0,y=0,m=0,g=0,v=0,w=0,_=0,E=0,k=0,S=0,A=0,I=0,T=0,R=0,x=0,C=0,B=0,M=0,N=0,P=0,O=0,D=r[0],L=r[1],j=r[2],U=r[3],z=r[4],F=r[5],q=r[6],K=r[7],V=r[8],H=r[9],G=r[10],W=r[11],Y=r[12],J=r[13],X=r[14],Z=r[15];s+=(n=t[0])*D,o+=n*L,a+=n*j,c+=n*U,u+=n*z,f+=n*F,h+=n*q,l+=n*K,d+=n*V,p+=n*H,b+=n*G,y+=n*W,m+=n*Y,g+=n*J,v+=n*X,w+=n*Z,o+=(n=t[1])*D,a+=n*L,c+=n*j,u+=n*U,f+=n*z,h+=n*F,l+=n*q,d+=n*K,p+=n*V,b+=n*H,y+=n*G,m+=n*W,g+=n*Y,v+=n*J,w+=n*X,_+=n*Z,a+=(n=t[2])*D,c+=n*L,u+=n*j,f+=n*U,h+=n*z,l+=n*F,d+=n*q,p+=n*K,b+=n*V,y+=n*H,m+=n*G,g+=n*W,v+=n*Y,w+=n*J,_+=n*X,E+=n*Z,c+=(n=t[3])*D,u+=n*L,f+=n*j,h+=n*U,l+=n*z,d+=n*F,p+=n*q,b+=n*K,y+=n*V,m+=n*H,g+=n*G,v+=n*W,w+=n*Y,_+=n*J,E+=n*X,k+=n*Z,u+=(n=t[4])*D,f+=n*L,h+=n*j,l+=n*U,d+=n*z,p+=n*F,b+=n*q,y+=n*K,m+=n*V,g+=n*H,v+=n*G,w+=n*W,_+=n*Y,E+=n*J,k+=n*X,S+=n*Z,f+=(n=t[5])*D,h+=n*L,l+=n*j,d+=n*U,p+=n*z,b+=n*F,y+=n*q,m+=n*K,g+=n*V,v+=n*H,w+=n*G,_+=n*W,E+=n*Y,k+=n*J,S+=n*X,A+=n*Z,h+=(n=t[6])*D,l+=n*L,d+=n*j,p+=n*U,b+=n*z,y+=n*F,m+=n*q,g+=n*K,v+=n*V,w+=n*H,_+=n*G,E+=n*W,k+=n*Y,S+=n*J,A+=n*X,I+=n*Z,l+=(n=t[7])*D,d+=n*L,p+=n*j,b+=n*U,y+=n*z,m+=n*F,g+=n*q,v+=n*K,w+=n*V,_+=n*H,E+=n*G,k+=n*W,S+=n*Y,A+=n*J,I+=n*X,T+=n*Z,d+=(n=t[8])*D,p+=n*L,b+=n*j,y+=n*U,m+=n*z,g+=n*F,v+=n*q,w+=n*K,_+=n*V,E+=n*H,k+=n*G,S+=n*W,A+=n*Y,I+=n*J,T+=n*X,R+=n*Z,p+=(n=t[9])*D,b+=n*L,y+=n*j,m+=n*U,g+=n*z,v+=n*F,w+=n*q,_+=n*K,E+=n*V,k+=n*H,S+=n*G,A+=n*W,I+=n*Y,T+=n*J,R+=n*X,x+=n*Z,b+=(n=t[10])*D,y+=n*L,m+=n*j,g+=n*U,v+=n*z,w+=n*F,_+=n*q,E+=n*K,k+=n*V,S+=n*H,A+=n*G,I+=n*W,T+=n*Y,R+=n*J,x+=n*X,C+=n*Z,y+=(n=t[11])*D,m+=n*L,g+=n*j,v+=n*U,w+=n*z,_+=n*F,E+=n*q,k+=n*K,S+=n*V,A+=n*H,I+=n*G,T+=n*W,R+=n*Y,x+=n*J,C+=n*X,B+=n*Z,m+=(n=t[12])*D,g+=n*L,v+=n*j,w+=n*U,_+=n*z,E+=n*F,k+=n*q,S+=n*K,A+=n*V,I+=n*H,T+=n*G,R+=n*W,x+=n*Y,C+=n*J,B+=n*X,M+=n*Z,g+=(n=t[13])*D,v+=n*L,w+=n*j,_+=n*U,E+=n*z,k+=n*F,S+=n*q,A+=n*K,I+=n*V,T+=n*H,R+=n*G,x+=n*W,C+=n*Y,B+=n*J,M+=n*X,N+=n*Z,v+=(n=t[14])*D,w+=n*L,_+=n*j,E+=n*U,k+=n*z,S+=n*F,A+=n*q,I+=n*K,T+=n*V,R+=n*H,x+=n*G,C+=n*W,B+=n*Y,M+=n*J,N+=n*X,P+=n*Z,w+=(n=t[15])*D,o+=38*(E+=n*j),a+=38*(k+=n*U),c+=38*(S+=n*z),u+=38*(A+=n*F),f+=38*(I+=n*q),h+=38*(T+=n*K),l+=38*(R+=n*V),d+=38*(x+=n*H),p+=38*(C+=n*G),b+=38*(B+=n*W),y+=38*(M+=n*Y),m+=38*(N+=n*J),g+=38*(P+=n*X),v+=38*(O+=n*Z),s=(n=(s+=38*(_+=n*L))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),o=(n=o+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=(s+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),o=(n=o+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),s+=i-1+37*(i-1),e[0]=s,e[1]=o,e[2]=a,e[3]=c,e[4]=u,e[5]=f,e[6]=h,e[7]=l,e[8]=d,e[9]=p,e[10]=b,e[11]=y,e[12]=m,e[13]=g,e[14]=v,e[15]=w}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports=s,s.strict=o,s.loose=a;var n=Object.prototype.toString,i={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function s(e){return o(e)||a(e)}function o(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function a(e){return i[n.call(e)]}},function(e,t,r){"use strict";var n=t;function i(e){return 1===e.length?"0"+e:e}function s(e){for(var t="",r=0;r<e.length;r++)t+=i(e[r].toString(16));return t}n.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(n=0;n<e.length;n++){var i=e.charCodeAt(n),s=i>>8,o=255&i;s?r.push(s,o):r.push(o)}return r},n.zero2=i,n.toHex=s,n.encode=function(e,t){return"hex"===t?s(e):e}},function(e,t,r){"use strict";var n;function i(e){this.rand=e}if(e.exports=function(e){return n||(n=new i(null)),n.generate(e)},e.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?i.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(i.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var s=r(423);if("function"!=typeof s.randomBytes)throw new Error("Not supported");i.prototype._rand=function(e){return s.randomBytes(e)}}catch(o){}},function(e,t,r){"use strict";var n=t;n.base=r(96),n.short=r(424),n.mont=r(425),n.edwards=r(426)},function(e,t,r){"use strict";var n=r(31).rotr32;function i(e,t,r){return e&t^~e&r}function s(e,t,r){return e&t^e&r^t&r}function o(e,t,r){return e^t^r}t.ft_1=function(e,t,r,n){return 0===e?i(t,r,n):1===e||3===e?o(t,r,n):2===e?s(t,r,n):void 0},t.ch32=i,t.maj32=s,t.p32=o,t.s0_256=function(e){return n(e,2)^n(e,13)^n(e,22)},t.s1_256=function(e){return n(e,6)^n(e,11)^n(e,25)},t.g0_256=function(e){return n(e,7)^n(e,18)^e>>>3},t.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},function(e,t,r){"use strict";var n=r(31),i=r(74),s=r(216),o=r(48),a=n.sum32,c=n.sum32_4,u=n.sum32_5,f=s.ch32,h=s.maj32,l=s.s0_256,d=s.s1_256,p=s.g0_256,b=s.g1_256,y=i.BlockHash,m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function g(){if(!(this instanceof g))return new g;y.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=m,this.W=new Array(64)}n.inherits(g,y),e.exports=g,g.blockSize=512,g.outSize=256,g.hmacStrength=192,g.padLength=64,g.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=c(b(r[n-2]),r[n-7],p(r[n-15]),r[n-16]);var i=this.h[0],s=this.h[1],y=this.h[2],m=this.h[3],g=this.h[4],v=this.h[5],w=this.h[6],_=this.h[7];for(o(this.k.length===r.length),n=0;n<r.length;n++){var E=u(_,d(g),f(g,v,w),this.k[n],r[n]),k=a(l(i),h(i,s,y));_=w,w=v,v=g,g=a(m,E),m=y,y=s,s=i,i=a(E,k)}this.h[0]=a(this.h[0],i),this.h[1]=a(this.h[1],s),this.h[2]=a(this.h[2],y),this.h[3]=a(this.h[3],m),this.h[4]=a(this.h[4],g),this.h[5]=a(this.h[5],v),this.h[6]=a(this.h[6],w),this.h[7]=a(this.h[7],_)},g.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(e,t,r){"use strict";var n=r(31),i=r(74),s=r(48),o=n.rotr64_hi,a=n.rotr64_lo,c=n.shr64_hi,u=n.shr64_lo,f=n.sum64,h=n.sum64_hi,l=n.sum64_lo,d=n.sum64_4_hi,p=n.sum64_4_lo,b=n.sum64_5_hi,y=n.sum64_5_lo,m=i.BlockHash,g=[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];function v(){if(!(this instanceof v))return new v;m.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=g,this.W=new Array(160)}function w(e,t,r,n,i){var s=e&r^~e&i;return s<0&&(s+=4294967296),s}function _(e,t,r,n,i,s){var o=t&n^~t&s;return o<0&&(o+=4294967296),o}function E(e,t,r,n,i){var s=e&r^e&i^r&i;return s<0&&(s+=4294967296),s}function k(e,t,r,n,i,s){var o=t&n^t&s^n&s;return o<0&&(o+=4294967296),o}function S(e,t){var r=o(e,t,28)^o(t,e,2)^o(t,e,7);return r<0&&(r+=4294967296),r}function A(e,t){var r=a(e,t,28)^a(t,e,2)^a(t,e,7);return r<0&&(r+=4294967296),r}function I(e,t){var r=o(e,t,14)^o(e,t,18)^o(t,e,9);return r<0&&(r+=4294967296),r}function T(e,t){var r=a(e,t,14)^a(e,t,18)^a(t,e,9);return r<0&&(r+=4294967296),r}function R(e,t){var r=o(e,t,1)^o(e,t,8)^c(e,t,7);return r<0&&(r+=4294967296),r}function x(e,t){var r=a(e,t,1)^a(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function C(e,t){var r=o(e,t,19)^o(t,e,29)^c(e,t,6);return r<0&&(r+=4294967296),r}function B(e,t){var r=a(e,t,19)^a(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}n.inherits(v,m),e.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var i=C(r[n-4],r[n-3]),s=B(r[n-4],r[n-3]),o=r[n-14],a=r[n-13],c=R(r[n-30],r[n-29]),u=x(r[n-30],r[n-29]),f=r[n-32],h=r[n-31];r[n]=d(i,s,o,a,c,u,f,h),r[n+1]=p(i,s,o,a,c,u,f,h)}},v.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],c=this.h[4],u=this.h[5],d=this.h[6],p=this.h[7],m=this.h[8],g=this.h[9],v=this.h[10],R=this.h[11],x=this.h[12],C=this.h[13],B=this.h[14],M=this.h[15];s(this.k.length===r.length);for(var N=0;N<r.length;N+=2){var P=B,O=M,D=I(m,g),L=T(m,g),j=w(m,g,v,R,x),U=_(m,g,v,R,x,C),z=this.k[N],F=this.k[N+1],q=r[N],K=r[N+1],V=b(P,O,D,L,j,U,z,F,q,K),H=y(P,O,D,L,j,U,z,F,q,K);P=S(n,i),O=A(n,i),D=E(n,i,o,a,c),L=k(n,i,o,a,c,u);var G=h(P,O,D,L),W=l(P,O,D,L);B=x,M=C,x=v,C=R,v=m,R=g,m=h(d,p,V,H),g=l(p,p,V,H),d=c,p=u,c=o,u=a,o=n,a=i,n=h(V,H,G,W),i=l(V,H,G,W)}f(this.h,0,n,i),f(this.h,2,o,a),f(this.h,4,c,u),f(this.h,6,d,p),f(this.h,8,m,g),f(this.h,10,v,R),f(this.h,12,x,C),f(this.h,14,B,M)},v.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(93),s=r(442),o={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"};t.create=async function(e,t){const r=o[e],a=await i.get().subtle.importKey("raw",t,{name:"HMAC",hash:{name:r}},!1,["sign"]);return{digest:async e=>(async(e,t)=>n.from(await i.get().subtle.sign({name:"HMAC"},e,t)))(a,e),length:s[e]}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(452);function s(e,t){if(!t)throw new Error("requires an encoded buffer");const r=o(e),i=n.from(r.code);return function(e,t){o(e).decode(t.toString())}(r.name,t),n.concat([i,t])}function o(e){let t;if(i.names[e])t=i.names[e];else{if(!i.codes[e])throw new Error("Unsupported encoding");t=i.codes[e]}if(!t.isImplemented())throw new Error("Base "+e+" is not implemented yet");return t}(t=e.exports=s).encode=function(e,t){const r=o(e);return s(r.name,n.from(r.encode(t)))},t.decode=function(e){n.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);"string"==typeof(e=e.substring(1,e.length))&&(e=n.from(e));const r=o(t);return n.from(r.decode(e.toString()))},t.isEncoded=function(e){n.isBuffer(e)&&(e=e.toString());if("[object String]"!==Object.prototype.toString.call(e))return!1;const t=e.substring(0,1);try{return o(t).name}catch(r){return!1}},t.names=Object.freeze(Object.keys(i.names)),t.codes=Object.freeze(Object.keys(i.codes))},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(463);function s(e,t){if(!t)throw new Error("requires an encoded buffer");const r=o(e),i=n.from(r.code);return function(e,t){o(e).decode(t.toString())}(r.name,t),n.concat([i,t])}function o(e){let t;if(i.names[e])t=i.names[e];else{if(!i.codes[e])throw new Error("Unsupported encoding");t=i.codes[e]}if(!t.isImplemented())throw new Error("Base "+e+" is not implemented yet");return t}(t=e.exports=s).encode=function(e,t){const r=o(e);return s(r.name,n.from(r.encode(t)))},t.decode=function(e){n.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);"string"==typeof(e=e.substring(1,e.length))&&(e=n.from(e));const r=o(t);return n.from(r.decode(e.toString()))},t.isEncoded=function(e){n.isBuffer(e)&&(e=e.toString());if("[object String]"!==Object.prototype.toString.call(e))return!1;const t=e.substring(0,1);try{return o(t).name}catch(r){return!1}},t.names=Object.freeze(Object.keys(i.names)),t.codes=Object.freeze(Object.keys(i.codes))},function(e,t,r){"use strict";(function(t){function r(e){return(4294967296+e).toString(16).substring(1)}e.exports={normalizeInput:function(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("Input must be an string, Buffer or Uint8Array");r=new Uint8Array(t.from(e,"utf8"))}return r},toHex:function(e){return Array.prototype.map.call(e,(function(e){return(e<16?"0":"")+e.toString(16)})).join("")},debugPrint:function(e,t,n){for(var i="\n"+e+" = ",s=0;s<t.length;s+=2){if(32===n)i+=r(t[s]).toUpperCase(),i+=" ",i+=r(t[s+1]).toUpperCase();else{if(64!==n)throw new Error("Invalid size "+n);i+=r(t[s+1]).toUpperCase(),i+=r(t[s]).toUpperCase()}s%6==4?i+="\n"+new Array(e.length+4).join(" "):s<t.length-2&&(i+=" ")}console.log(i)},testSpeed:function(e,t,r){for(var n=(new Date).getTime(),i=new Uint8Array(t),s=0;s<t;s++)i[s]=s%256;var o=(new Date).getTime();for(console.log("Generated random input in "+(o-n)+"ms"),n=o,s=0;s<r;s++){var a=e(i),c=(new Date).getTime(),u=c-n;n=c,console.log("Hashed in "+u+"ms: "+a.substring(0,20)+"..."),console.log(Math.round(t/(1<<20)/(u/1e3)*100)/100+" MB PER SECOND")}}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(129);e.exports=async function*(e,t){t=parseInt(t),(isNaN(t)||t<1)&&(t=1);for await(let r of n(e,t)){r=r.map(e=>e().then(e=>({res:e}),e=>({err:e})));for(let e=0;e<r.length;e++){const{res:t,err:n}=await r[e];if(n)throw n;yield t}}}},function(e,t,r){"use strict";const n=r(21),{Buffer:i}=r(0),s=r(225),o=r(60),{serializeDAGNode:a}=r(227),c=r(486),u=r(492),f=r(494);e.exports=n(class{constructor(e,t=[],r=null){if(e||(e=i.alloc(0)),"string"==typeof e&&(e=i.from(e)),!i.isBuffer(e))throw new Error("Passed 'data' is not a buffer or a string!");if(null!==r&&"number"!=typeof r)throw new Error("Passed 'serializedSize' must be a number!");t=t.map(e=>o.isDAGLink(e)?e:o.util.createDagLinkFromB58EncodedHash(e)),t=s(t),this._data=e,this._links=t,this._serializedSize=r,this._size=null}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 <data: "'.concat(this.Data.toString("base64"),'", links: ').concat(this.Links.length,", size: ").concat(this.size,">")}_invalidateCached(){this._serializedSize=null,this._size=null}addLink(e){return this._invalidateCached(),u(this,e)}rmLink(e){return this._invalidateCached(),f(this,e)}toDAGLink(e){return c(this,e)}serialize(){return a({Data:this._data,Links:this._links})}get size(){return null===this._size&&(null===this._serializedSize&&(this._serializedSize=this.serialize().length),this._size=this._links.reduce((e,t)=>e+t.Tsize,this._serializedSize)),this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}get Data(){return this._data}set Data(e){throw new Error("Can't set property: 'Data' is immutable")}get Links(){return this._links.map(e=>({Name:e.Name,Tsize:e.Tsize,Hash:e.Hash}))}set Links(e){throw new Error("Can't set property: 'Links' is immutable")}},{className:"DAGNode",symbolName:"@ipld/js-ipld-dag-pb/dagnode"})},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(226),s=(e,t)=>n.compare(e.nameAsBuffer,t.nameAsBuffer);e.exports=e=>i(e,s)},function(e,t,r){"use strict";e.exports=function(){var e=function(e,r){return t(e.slice(),r)};function t(e,t){"function"!=typeof t&&(t=function(e,t){return String(e).localeCompare(t)});var n=e.length;if(n<=1)return e;for(var i=new Array(n),s=1;s<n;s*=2){r(e,t,s,i);var o=e;e=i,i=o}return e}e.inplace=function(e,n){var i=t(e,n);return i!==e&&r(i,null,e.length,e),e};var r=function(e,t,r,n){var i,s,o,a,c,u=e.length,f=0,h=2*r;for(i=0;i<u;i+=h)for(o=(s=i+r)+r,s>u&&(s=u),o>u&&(o=u),a=i,c=s;;)if(a<s&&c<o)t(e[a],e[c])<=0?n[f++]=e[a++]:n[f++]=e[c++];else if(a<s)n[f++]=e[a++];else{if(!(c<o))break;n[f++]=e[c++]}};return e}()},function(e,t,r){"use strict";const n=r(16)(r(228)),i=r(60);t=e.exports;const s=e=>{const t=e.Data,r=e.Links||[];return n.PBNode.encode((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.Hash.buffer,Name:e.Name,Tsize:e.Tsize})):t.Links=null,t})({Data:t,Links:r}))};t.serializeDAGNode=s,t.serializeDAGNodeLike=(e,t=[])=>{const r={Data:e};return r.Links=t.map(e=>i.isDAGLink(e)?e:i.util.createDagLinkFromB58EncodedHash(e)),s(r)}},function(e,t,r){"use strict";e.exports="// An IPFS MerkleDAG Link\nmessage PBLink {\n\n // multihash of the target object\n optional bytes Hash = 1;\n\n // utf string name. should be unique per object\n optional string Name = 2;\n\n // cumulative size of target object\n optional uint64 Tsize = 3;\n}\n\n// An IPFS MerkleDAG Node\nmessage PBNode {\n\n // refs to other objects\n repeated PBLink Links = 2;\n\n // opaque user data\n optional bytes Data = 1;\n}"},function(e,t,r){"use strict";const n=r(4),i=r(11),s=r(487);(t=e.exports).codec=i.DAG_PB,t.defaultHashAlg=i.SHA2_256;t.cid=async(e,r)=>{const o={cidVersion:1,hashAlg:t.defaultHashAlg},a=Object.assign(o,r),c=await s(e,a.hashAlg),u=i.print[t.codec];return new n(a.cidVersion,u,c)}},function(e,t,r){"use strict";(e.exports=r(60)).util=r(493)},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(16)(r(228)),s=r(60),o=r(224),{serializeDAGNodeLike:a}=r(227),c=r(229);(t=e.exports).codec=c.codec,t.defaultHashAlg=c.defaultHashAlg;t.serialize=e=>o.isDAGNode(e)?e.serialize():a(e.Data,e.Links),t.deserialize=e=>{const t=i.PBNode.decode(e),r=t.Links.map(e=>new s(e.Name,e.Tsize,e.Hash)),a=null==t.Data?n.alloc(0):t.Data;return new o(a,r,e.length)},t.cid=(e,t)=>c.cid(e,t)},function(e,t,r){"use strict";e.exports=async e=>{for await(const t of e)return t}},function(e,t,r){"use strict";const{AbortController:n}="undefined"!=typeof self?self:"undefined"!=typeof window?window:r(41),i=r(135);class s extends n{constructor(e){super(),this._ms=e,this._timer=i(()=>this.abort(),e),Object.setPrototypeOf(this,s.prototype)}abort(){return this._timer.clear(),super.abort()}clear(){this._timer.clear()}reset(){this._timer.clear(),this._timer=i(()=>this.abort(),this._ms)}}e.exports=s,e.exports.TimeoutController=s},function(e,t,r){"use strict";const{Buffer:n}=r(0),{nanoid:i}=r(235),s=r(21),o=n.from("/"),a=o[0];class c{constructor(e,t){if("string"==typeof e?this._buf=n.from(e):n.isBuffer(e)&&(this._buf=e),null==t&&(t=!0),t&&this.clean(),0===this._buf.length||this._buf[0]!==a)throw new Error("Invalid key")}toString(e){return this._buf.toString(e||"utf8")}toBuffer(){return this._buf}get[Symbol.toStringTag](){return"Key(".concat(this.toString(),")")}static withNamespaces(e){return new u(e.join("/"))}static random(){return new u(i().replace(/-/g,""))}clean(){for(this._buf&&0!==this._buf.length||(this._buf=n.from("/")),this._buf[0]!==a&&(this._buf=n.concat([o,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(),r=e.list();for(let n=0;n<t.length;n++){if(r.length<n+1)return!1;const e=t[n],i=r[n];if(e<i)return!0;if(e>i)return!1}return t.length<r.length}reverse(){return c.withNamespaces(this.list().slice().reverse())}namespaces(){return this.list()}baseNamespace(){const e=this.namespaces();return e[e.length-1]}list(){return this.toString().split("/").slice(1)}type(){return function(e){const t=e.split(":");if(t.length<2)return"";return t.slice(0,-1).join(":")}(this.baseNamespace())}name(){return function(e){const t=e.split(":");return t[t.length-1]}(this.baseNamespace())}instance(e){return new u(this.toString()+":"+e)}path(){let e=this.parent().toString();return e.endsWith("/")||(e+="/"),e+=this.type(),new u(e)}parent(){const e=this.list();return 1===e.length?new u("/"):new u(e.slice(0,-1).join("/"))}child(e){return"/"===this.toString()?e:"/"===e.toString()?this:new u(this.toString()+e.toString(),!1)}isAncestorOf(e){return e.toString()!==this.toString()&&e.toString().startsWith(this.toString())}isDecendantOf(e){return e.toString()!==this.toString()&&this.toString().startsWith(e.toString())}isTopLevel(){return 1===this.list().length}concat(...e){return c.withNamespaces([...this.namespaces(),...(t=e.map(e=>e.namespaces()),[].concat(...t))]);var t}}const u=s(c,{className:"Key",symbolName:"@ipfs/interface-datastore/key"});e.exports=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"urlAlphabet",{enumerable:!0,get:function(){return n.urlAlphabet}}),t.random=t.customRandom=t.customAlphabet=t.nanoid=void 0;var n=r(519);let i=e=>crypto.getRandomValues(new Uint8Array(e));t.random=i;let s=(e,t,r)=>{let n=(2<<Math.log(e.length-1)/Math.LN2)-1,i=-~(1.6*n*t/e.length);return()=>{let s="";for(;;){let o=r(i),a=i;for(;a--;)if(s+=e[o[a]&n]||"",s.length===+t)return s}}};t.customRandom=s;t.customAlphabet=(e,t)=>s(e,t,i);t.nanoid=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e));for(;e--;){let n=63&r[e];t+=n<36?n.toString(36):n<62?(n-26).toString(36).toUpperCase():n<63?"_":"-"}return t}},function(e,t,r){"use strict";const{filter:n,sortAll:i,take:s,map:o}=r(237),a=r(238);e.exports=class{async open(){}async close(){}async put(e,t,r={}){}async*putMany(e,t={}){for await(const{key:r,value:n}of e)await this.put(r,n,t),yield{key:r,value:n}}async get(e,t={}){}async*getMany(e,t={}){for await(const r of e)yield this.get(r,t)}async has(e){}async delete(e,t={}){}async*deleteMany(e,t={}){for await(const r of e)await this.delete(r,t),yield r}batch(){let e=[],t=[];return{put(t,r){e.push({key:t,value:r})},delete(e){t.push(e)},commit:async r=>{await a(this.putMany(e,r)),e=[],await a(this.deleteMany(t,r)),t=[]}}}async*_all(e,t){}async*query(e,t){let r=this._all(e,t);if(null!=e.prefix&&(r=n(r,t=>t.key.toString().startsWith(e.prefix))),Array.isArray(e.filters)&&(r=e.filters.reduce((e,t)=>n(e,t),r)),Array.isArray(e.orders)&&(r=e.orders.reduce((e,t)=>i(e,t),r)),null!=e.offset){let t=0;r=n(r,()=>t++>=e.offset)}null!=e.limit&&(r=s(r,e.limit)),!0===e.keysOnly&&(r=o(r,e=>({key:e.key}))),yield*r}}},function(e,t,r){"use strict";const n=r(521);t.filter=(e,t)=>async function*(){for await(const r of e){await t(r)&&(yield r)}}(),t.sortAll=(e,t)=>async function*(){let r=[];for await(const t of e)r.push(t);r=await t(r);for(const e of r)yield e}(),t.take=(e,t)=>async function*(){if(t<=0)return;let r=0;for await(const n of e)if(yield n,r++,r>=t)return}(),t.map=(e,t)=>async function*(){for await(const r of e)yield t(r)}(),t.replaceStartWith=function(e,t){const r=new RegExp("^"+t);return e.replace(r,"")},t.tmpdir=n},function(e,t,r){"use strict";e.exports=async e=>{for await(const t of e);}},function(e,t,r){"use strict";const n=r(1);e.exports.dbOpenFailedError=e=>(e=e||new Error("Cannot open database"),n(e,"ERR_DB_OPEN_FAILED")),e.exports.dbDeleteFailedError=e=>(e=e||new Error("Delete failed"),n(e,"ERR_DB_DELETE_FAILED")),e.exports.dbWriteFailedError=e=>(e=e||new Error("Write failed"),n(e,"ERR_DB_WRITE_FAILED")),e.exports.notFoundError=e=>(e=e||new Error("Not Found"),n(e,"ERR_NOT_FOUND")),e.exports.abortedError=e=>(e=e||new Error("Aborted"),n(e,"ERR_ABORTED"))},function(e,t,r){"use strict";(function(t){const n=r(529).util,i=r(4),s=(e,r=[])=>(t.isBuffer(e)&&(e=n.deserialize(e)),function*(){for(let t of Object.keys(e)){let n=r.slice();n.push(t);let o=e[t];if(o&&"object"==typeof o)if(Array.isArray(o))for(let e=0;e<o.length;e++){let t=n.slice();t.push(e);let r=o[e];i.isCID(r)?yield[t.join("/"),r]:"object"==typeof r&&(yield*s(r,n))}else i.isCID(o)?yield[n.join("/"),o]:yield*s(o,n)}}());e.exports=s}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(139),{Buffer:i}=r(0),s=r(11),o=r(22),a=r(4),c=r(141);function u(e){let t;try{t=c(e)}catch(r){t=!1}if(t)throw new Error("The object passed has circular references");return function e(t){if(!t||t instanceof Uint8Array||"string"==typeof t)return t;if(Array.isArray(t))return t.map(e);if(a.isCID(t))return"string"==typeof(r=t)?r=new a(r).buffer:a.isCID(r)&&(r=r.buffer),new n.Tagged(42,i.concat([i.from("00","hex"),r]));var r;const s=Object.keys(t);if(s.length>0){const r={};return s.forEach(n=>{"object"==typeof t[n]?r[n]=e(t[n]):r[n]=t[n]}),r}return t}(e)}(t=e.exports).codec=s.DAG_CBOR,t.defaultHashAlg=s.SHA2_256;const f={42:e=>(e=e.slice(1),new a(e))};let h=65536;let l=67108864,d=null;t.configureDecoder=e=>{let t=f;e?("number"==typeof e.size&&(h=e.size),"number"==typeof e.maxSize&&(l=e.maxSize),e.tags&&(t=Object.assign({},f,e&&e.tags))):(h=65536,l=67108864);const r={tags:t,size:h};d=new n.Decoder(r),h=r.size},t.configureDecoder(),t.serialize=e=>{const t=u(e);return n.encode(t)},t.deserialize=e=>{if(e.length>h&&e.length<=l&&t.configureDecoder({size:e.length}),e.length>h)throw new Error("Data is too large to deserialize with current decoder");const r=d.decodeAll(e);if(1!==r.length)throw new Error("Extraneous CBOR data found beyond initial top-level object");return r[0]},t.cid=async(e,r)=>{const n={cidVersion:1,hashAlg:t.defaultHashAlg},i=Object.assign(n,r),c=await o(e,i.hashAlg),u=s.print[t.codec];return new a(i.cidVersion,u,c)}},function(e,t,r){"use strict";(function(t){const{Buffer:n}=r(0),i=r(198),s=r(37).BigNumber,o=r(531),a=r(140),c=r(101),u=r(243),f=r(244),{URL:h}=r(88);class l{constructor(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=n.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=>c.NEG_ONE.minus(a.arrayBufferToBignumber(e)),4:e=>c.TEN.pow(e[0]).times(e[1]),5:e=>c.TWO.pow(e[0]).times(e[1]),32:e=>new h(e),35:e=>new RegExp(e)},e.tags),this.parser=o(t,{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 ".concat(e.length," elements"));switch(e.type){case c.PARENT.TAG:this._push(this.createTag(e.ref[0],e.ref[1]));break;case c.PARENT.BYTE_STRING:this._push(this.createByteString(e.ref,e.length));break;case c.PARENT.UTF8_STRING:this._push(this.createUtf8String(e.ref,e.length));break;case c.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 c.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 c.PARENT.ARRAY:this._push(this.createArray(e.ref,e.length))}this._currentParent&&this._currentParent.type===c.PARENT.TAG&&this._dec()}_dec(){const e=this._currentParent;e.length<0||(e.length--,0===e.length&&this._closeParent())}_push(e,t){const r=this._currentParent;switch(r.values++,r.type){case c.PARENT.ARRAY:case c.PARENT.BYTE_STRING:case c.PARENT.UTF8_STRING:r.length>-1?this._ref[this._ref.length-r.length]=e:this._ref.push(e),this._dec();break;case c.PARENT.OBJECT:null!=r.tmpKey?(this._ref[r.tmpKey]=e,r.tmpKey=null,this._dec()):(r.tmpKey=e,"string"!=typeof r.tmpKey&&(r.type=c.PARENT.MAP,r.ref=a.buildMap(r.ref)));break;case c.PARENT.MAP:null!=r.tmpKey?(this._ref.set(r.tmpKey,e),r.tmpKey=null,this._dec()):r.tmpKey=e;break;case c.PARENT.TAG:this._ref.push(e),t||this._dec();break;default:throw new Error("Unknown parent type")}}_createParent(e,t,r){this._parents[this._depth]={type:t,length:r,ref:e,values:0,tmpKey:null}}_reset(){this._res=[],this._parents=[{type:c.PARENT.ARRAY,length:-1,ref:this._res,values:0,tmpKey:null}]}createTag(e,t){const r=this._knownTags[e];return r?r(t):new f(e,t)}createMap(e,t){return e}createObject(e,t){return e}createArray(e,t){return e}createByteString(e,t){return n.concat(e)}createByteStringFromHeap(e,t){return e===t?n.alloc(0):n.from(this._heap.slice(e,t))}createInt(e){return e}createInt32(e,t){return a.buildInt32(e,t)}createInt64(e,t,r,n){return a.buildInt64(e,t,r,n)}createFloat(e){return e}createFloatSingle(e,t,r,n){return i.read([e,t,r,n],0,!1,23,4)}createFloatDouble(e,t,r,n,s,o,a,c){return i.read([e,t,r,n,s,o,a,c],0,!1,52,8)}createInt32Neg(e,t){return-1-a.buildInt32(e,t)}createInt64Neg(e,t,r,n){const i=a.buildInt32(e,t),o=a.buildInt32(r,n);return i>c.MAX_SAFE_HIGH?c.NEG_ONE.minus(new s(i).times(c.SHIFT32).plus(o)):-1-(i*c.SHIFT32+o)}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,r,n){this._push(this.createInt64(e,t,r,n))}pushFloat(e){this._push(this.createFloat(e))}pushFloatSingle(e,t,r,n){this._push(this.createFloatSingle(e,t,r,n))}pushFloatDouble(e,t,r,n,i,s,o,a){this._push(this.createFloatDouble(e,t,r,n,i,s,o,a))}pushInt32Neg(e,t){this._push(this.createInt32Neg(e,t))}pushInt64Neg(e,t,r,n){this._push(this.createInt64Neg(e,t,r,n))}pushTrue(){this._push(this.createTrue())}pushFalse(){this._push(this.createFalse())}pushNull(){this._push(this.createNull())}pushUndefined(){this._push(this.createUndefined())}pushInfinity(){this._push(this.createInfinity())}pushInfinityNeg(){this._push(this.createInfinityNeg())}pushNaN(){this._push(this.createNaN())}pushNaNNeg(){this._push(this.createNaNNeg())}pushArrayStart(){this._createParent([],c.PARENT.ARRAY,-1)}pushArrayStartFixed(e){this._createArrayStartFixed(e)}pushArrayStartFixed32(e,t){const r=a.buildInt32(e,t);this._createArrayStartFixed(r)}pushArrayStartFixed64(e,t,r,n){const i=a.buildInt64(e,t,r,n);this._createArrayStartFixed(i)}pushObjectStart(){this._createObjectStartFixed(-1)}pushObjectStartFixed(e){this._createObjectStartFixed(e)}pushObjectStartFixed32(e,t){const r=a.buildInt32(e,t);this._createObjectStartFixed(r)}pushObjectStartFixed64(e,t,r,n){const i=a.buildInt64(e,t,r,n);this._createObjectStartFixed(i)}pushByteStringStart(){this._parents[this._depth]={type:c.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:c.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:c.PARENT.TAG,length:1,ref:[e]}}pushTagStart4(e,t){this.pushTagStart(a.buildInt32(e,t))}pushTagStart8(e,t,r,n){this.pushTagStart(a.buildInt64(e,t,r,n))}pushTagUnassigned(e){this._push(this.createTag(e))}pushBreak(){if(this._currentParent.length>-1)throw new Error("Unexpected break");this._closeParent()}_createObjectStartFixed(e){0!==e?this._createParent({},c.PARENT.OBJECT,e):this._push(this.createObject({}))}_createArrayStartFixed(e){0!==e?this._createParent(new Array(e),c.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,t){"string"==typeof e&&(e=n.from(e,t||"hex"));return new l({size:e.length}).decodeFirst(e)}static decodeAll(e,t){"string"==typeof e&&(e=n.from(e,t||"hex"));return new l({size:e.length}).decodeAll(e)}}l.decodeFirst=l.decode,e.exports=l}).call(this,r(10))},function(e,t,r){"use strict";const n=r(101),i=n.MT,s=n.SIMPLE,o=n.SYMS;class a{constructor(e){if("number"!=typeof e)throw new Error("Invalid Simple type: "+typeof e);if(e<0||e>255||(0|e)!==e)throw new Error("value must be a small positive integer: "+e);this.value=e}toString(){return"simple("+this.value+")"}inspect(){return"simple("+this.value+")"}encodeCBOR(e){return e._pushInt(this.value,i.SIMPLE_FLOAT)}static isSimple(e){return e instanceof a}static decode(e,t){switch(null==t&&(t=!0),e){case s.FALSE:return!1;case s.TRUE:return!0;case s.NULL:return t?null:o.NULL;case s.UNDEFINED:return t?void 0:o.UNDEFINED;case-1:if(!t)throw new Error("Invalid BREAK");return o.BREAK;default:return new a(e)}}}e.exports=a},function(e,t,r){"use strict";class n{constructor(e,t,r){if(this.tag=e,this.value=t,this.err=r,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return"".concat(this.tag,"(").concat(JSON.stringify(this.value),")")}encodeCBOR(e){return e._pushTag(this.tag),e.pushAny(this.value)}convert(e){var t,r;if("function"!=typeof(r=null!=e?e[this.tag]:void 0)&&"function"!=typeof(r=n["_tag"+this.tag]))return this;try{return r.call(n,this.value)}catch(i){return t=i,this.err=t,this}}}e.exports=n},function(e,t,r){"use strict";const n=r(58).IPFS.matches;t.isValidMultiaddr=e=>{try{return n(e)}catch(t){return!1}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(1),s=r(17),o=r(552);async function a(e,t,r){const n=await a.digest(e,t,r);return s.encode(n,t,r)}a.Buffer=n,a.multihash=s,a.digest=async(e,t,r)=>{const n=a.createHash(t),i=await n(e);return r?i.slice(0,r):i},a.createHash=function(e){if(!e)throw i(new Error("hash algorithm must be specified"),"ERR_HASH_ALGORITHM_NOT_SPECIFIED");if(e=s.coerceCode(e),!a.functions[e])throw i(new Error("multihash function '".concat(e,"' not yet supported")),"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return a.functions[e]},a.functions={0:o.identity,17:o.sha1,18:o.sha2256,19:o.sha2512,20:o.sha3512,21:o.sha3384,22:o.sha3256,23:o.sha3224,24:o.shake128,25:o.shake256,26:o.keccak224,27:o.keccak256,28:o.keccak384,29:o.keccak512,34:o.murmur3128,35:o.murmur332,86:o.dblSha2256},o.addBlake(a.functions),a.validate=async(e,t)=>{const r=await a(e,s.decode(t).name);return 0===n.compare(t,r)},e.exports=a},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(144),s=r(145),o=r(23),a=r(1);e.exports=(e,t,r,c,u,f,h)=>(e={})=>{const c=r.fileSize(),{offset:u,length:f}=s(c,e.offset,e.length);return async function*e(t,r,s,c,u=0,f){if(n.isBuffer(r)){const e=i(r,u,s,c);return e.length&&(yield e),u+=e.length}let h;try{h=o.unmarshal(r.Data)}catch(d){throw a(d,"ERR_NOT_UNIXFS")}if(Boolean(h.data&&h.data.length)){const e=i(h.data,u,s,c);e.length&&(yield e),u+=h.data.length}let l=u;for(let n=0;n<r.Links.length;n++){const i=r.Links[n],o=u+h.blockSizes[n];if(s>=l&&s<o||c>l&&c<=o||s<l&&c>o){const r=await t.get(i.Hash,f);for await(const n of e(t,r,s,c,u,f))u+=n.length,yield n}u=o,l=o+1}}(h,t,u,u+f,0,e)}},function(e,t,r){"use strict";const n=r(143),{withTimeoutOption:i}=r(3),s=r(2)("ipfs:core:config");async function o(e){return Object.keys(a).map(e=>({name:e,description:a[e].description}))}e.exports=({repo:e})=>({getAll:i(e.config.getAll),get:i((t,r)=>t?e.config.get(t,r):Promise.reject(new Error("key argument is required"))),set:i(e.config.set),replace:i(e.config.replace),profiles:{apply:i((async function(t,r={}){const{dryRun:n}=r,i=a[t];if(!i)throw new Error("No profile with name '".concat(t,"' exists"));try{const t=await e.config.getAll(r);let s=JSON.parse(JSON.stringify(t));return s=i.transform(s),n||await e.config.replace(s,r),delete t.Identity.PrivKey,delete s.Identity.PrivKey,{original:t,updated:s}}catch(o){throw s(o),new Error("Could not apply profile '".concat(t,"' to config: ").concat(o.message))}})),list:i(o)}});const a={server:{description:"Recommended for nodes with public IPv4 address (servers, VPSes, etc.), disables host and content discovery in local networks.",transform:e=>(e.Discovery.MDNS.Enabled=!1,e.Discovery.webRTCStar.Enabled=!1,e)},"local-discovery":{description:"Sets default values to fields affected by `server` profile, enables discovery in local networks.",transform:e=>(e.Discovery.MDNS.Enabled=!0,e.Discovery.webRTCStar.Enabled=!0,e)},test:{description:"Reduces external interference, useful for running ipfs in test environments. Note that with these settings node won't be able to talk to the rest of the network without manual bootstrap.",transform:e=>{const t=n();return e.Addresses.API=t.Addresses.API?"/ip4/127.0.0.1/tcp/0":"",e.Addresses.Gateway=t.Addresses.Gateway?"/ip4/127.0.0.1/tcp/0":"",e.Addresses.Swarm=t.Addresses.Swarm.length?["/ip4/127.0.0.1/tcp/0"]:[],e.Addresses.Delegates=[],e.Bootstrap=[],e.Discovery.MDNS.Enabled=!1,e.Discovery.webRTCStar.Enabled=!1,e}},"default-networking":{description:"Restores default network settings. Inverse profile of the `test` profile.",transform:e=>{const t=n();return e.Addresses.API=t.Addresses.API,e.Addresses.Gateway=t.Addresses.Gateway,e.Addresses.Swarm=t.Addresses.Swarm,e.Addresses.Delegates=t.Addresses.Delegates,e.Bootstrap=t.Bootstrap,e.Discovery.MDNS.Enabled=t.Discovery.MDNS.Enabled,e.Discovery.webRTCStar.Enabled=t.Discovery.webRTCStar.Enabled,e}},lowpower:{description:"Reduces daemon overhead on the system. May affect node functionality,performance of content discovery and data fetching may be degraded. Recommended for low power systems.",transform:e=>(e.Swarm=e.Swarm||{},e.Swarm.ConnMgr=e.Swarm.ConnMgr||{},e.Swarm.ConnMgr.LowWater=20,e.Swarm.ConnMgr.HighWater=40,e)},"default-power":{description:'Inverse of "lowpower" profile.',transform:e=>{const t=n();return e.Swarm=t.Swarm,e}}};e.exports.profiles=a},function(e,t,r){"use strict";const n=r(146);e.exports=class{constructor(e){this.lru=n(e)}get(e){const t=this.lru.get(e);if(t)return t.expire&&t.expire<Date.now()?void this.lru.remove(e):t.value}set(e,t,r){this.lru.set(e,{value:t,expire:Date.now()+r})}has(e){return!!this.get(e)}remove(e){this.lru.remove(e)}clear(){this.lru.clear()}}},function(e,t,r){"use strict";const n=r(251);let i;e.exports=e=>{if(i)return i;const t=n({singleProcess:e});return i={readLock:e=>async(...r)=>{const n=await t.readLock();try{return await e.apply(null,r)}finally{n()}},writeLock:e=>async(...r)=>{const n=await t.writeLock();try{return await e.apply(null,r)}finally{n()}}},i}},function(e,t,r){"use strict";(function(t){const n=r(569),i=r(579),{default:s}=r(51),{timeout:o}=r(584),a=r(254),c={};let u;function f(e,t){let r;const n=new Promise(e=>{r=e});return e.add(()=>o(new Promise(e=>{r(()=>{e()})}),t.timeout)),n}const h={concurrency:1/0,timeout:846e5,global:t,singleProcess:!1};e.exports=(e,t)=>(t||(t={}),"object"==typeof e&&(t=e,e="lock"),e||(e="lock"),t=Object.assign({},h,t),u||(u=n(t)||i(t),u.isWorker||(u.on("requestReadLock",(e,t)=>{c[e]&&c[e].readLock().then(e=>t().finally(()=>e()))}),u.on("requestWriteLock",async(e,t)=>{c[e]&&c[e].writeLock().then(e=>t().finally(()=>e()))}))),c[e]||(c[e]=((e,t)=>{if(u.isWorker)return{readLock:u.readLock(e,t),writeLock:u.writeLock(e,t)};const r=new s({concurrency:1});let n=null;return{readLock:()=>{if(n)return f(n,t);n=new s({concurrency:t.concurrency,autoStart:!1});const e=n,i=f(n,t);return r.add(()=>(e.start(),e.onIdle().then(()=>{n===e&&(n=null)}))),i},writeLock:()=>(n=null,f(r,t))}})(e,t)),c[e]),e.exports.Worker=function(e,r){let n;r=r||t.Worker;try{n=new r(e)}catch(i){i.message.includes("not a constructor")&&(n=r(e))}if(!n)throw new Error("Could not create Worker from",r);return a(n),n}}).call(this,r(10))},function(e,t,r){"use strict";e.exports=r(570)},function(e,t,r){"use strict";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,r){"use strict";const n={},i=e=>{e.addEventListener("message",t=>{i.dispatchEvent("message",e,t)}),e.port&&e.port.addEventListener("message",t=>{i.dispatchEvent("message",e,t)})};i.addEventListener=(e,t)=>{n[e]||(n[e]=[]),n[e].push(t)},i.removeEventListener=(e,t)=>{n[e]&&(n[e]=n[e].filter(e=>e===t))},i.dispatchEvent=function(){const e=Array.prototype.slice.call(arguments),t=e.shift();n[t]&&n[t].forEach(t=>t.apply(null,e))},e.exports=i},function(e,t,r){"use strict";var n=r(581),i="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),s=Object.prototype.toString,o=Array.prototype.concat,a=Object.defineProperty,c=a&&function(){var e={};try{for(var t in a(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(r){return!1}}(),u=function(e,t,r,n){var i;(!(t in e)||"function"==typeof(i=n)&&"[object Function]"===s.call(i)&&n())&&(c?a(e,t,{configurable:!0,enumerable:!1,value:r,writable:!0}):e[t]=r)},f=function(e,t){var r=arguments.length>2?arguments[2]:{},s=n(t);i&&(s=o.call(s,Object.getOwnPropertySymbols(t)));for(var a=0;a<s.length;a+=1)u(e,s[a],t[s[a]],r[s[a]])};f.supportsDescriptors=!!c,e.exports=f},function(e,t,r){"use strict";var n=Object.prototype.toString;e.exports=function(e){var t=n.call(e),r="[object Arguments]"===t;return r||(r="[object Array]"!==t&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===n.call(e.callee)),r}},function(e,t,r){"use strict";"undefined"!=typeof self?e.exports=self:"undefined"!=typeof window?e.exports=window:e.exports=Function("return this")()},function(e,t,r){"use strict";(function(t){var n=r(257);e.exports=function(){return"object"==typeof t&&t&&t.Math===Math&&t.Array===Array?t:n}}).call(this,r(10))},function(e,t,r){"use strict";const n=r(4),i=r(23),{DAGNode:s}=r(12),o=r(2)("ipfs:mfs:utils:with-mfs-root"),a=r(11),c=r(22).multihash,u=r(1),{MFS_ROOT_KEY:f}=r(3);e.exports=async(e,t)=>{if(t&&t.signal&&t.signal.aborted)throw u(new Error("Request aborted"),"ERR_ABORTED",{name:"Aborted"});let r;await e.repo.datastore.open();try{const t=await e.repo.datastore.get(f);r=new n(t)}catch(h){if("ERR_NOT_FOUND"!==h.code)throw h;o("Creating new MFS root");const n=new s(new i({type:"directory"}).marshal());if(r=await e.ipld.put(n,a.DAG_PB,{cidVersion:0,hashAlg:c.names["sha2-256"]}),t&&t.signal&&t.signal.aborted)throw u(new Error("Request aborted"),"ERR_ABORTED",{name:"Aborted"});await e.repo.datastore.put(f,r.buffer)}return o("Loaded MFS root /ipfs/".concat(r)),r}},function(e,t,r){"use strict";const{DAGNode:n}=r(12),i=r(134),s=r(133),o=r(2)("ipfs:mfs:core:utils:hamt-utils"),a=r(23),c=r(11),u=r(22).multihash,f=r(50),{Buffer:h}=r(0),l=async(e,t,r,n)=>{const o=new i({hashFn:s.hashFn,hash:r?r._options.hash:void 0},r,n);return r&&r._putObjectAt(n,o),await d(e,o,t),o},d=async(e,t,r)=>{await Promise.all(e.map(e=>{if(2===e.Name.length){const r=parseInt(e.Name,16);return t._putObjectAt(r,new i({hashFn:s.hashFn},t,r)),Promise.resolve()}return(r||t).put(e.Name.substring(2),{size:e.Tsize,cid:e.Hash})}))},p=e=>e.toString("16").toUpperCase().padStart(2,"0").substring(0,2);e.exports={generatePath:async(e,t,r)=>{const n=await l(r.Links,null,null,null),i=await n._findNewBucketAndPos(t),s=[{bucket:i.bucket,prefix:p(i.pos)}];let a=i.bucket;for(;a!==n;)s.push({bucket:a,prefix:p(a._posAtParent)}),a=a._parent;s.reverse(),s[0].node=r;for(let c=0;c<s.length;c++){const r=s[c],i=r.node.Links.filter(e=>e.Name.substring(0,2)===r.prefix).pop();if(!i){o("Link ".concat(r.prefix).concat(t," will be added"));continue}if(i.Name==="".concat(r.prefix).concat(t)){o("Link ".concat(r.prefix).concat(t," will be replaced"));continue}o("Found subshard ".concat(r.prefix));const a=await e.ipld.get(i.Hash);if(!s[c+1]){o("Loaded new subshard ".concat(r.prefix)),await l(a.Links,n,r.bucket,parseInt(r.prefix,16));const e=await n._findNewBucketAndPos(t);s.push({bucket:e.bucket,prefix:p(e.pos),node:a});continue}const u=s[c+1];await d(a.Links,u.bucket,n),u.node=a}return await n.put(t,!0),s.reverse(),{rootBucket:n,path:s}},updateHamtDirectory:async(e,t,r,i)=>{const o=h.from(r._children.bitField().reverse()),f=a.unmarshal(i.parent.Data),l=new a({type:"hamt-sharded-directory",data:o,fanout:r.tableSize(),hashType:s.hashFn.code,mode:f.mode,mtime:f.mtime}),d=u.names[i.hashAlg],p=new n(l.marshal(),t);return{node:p,cid:await e.ipld.put(p,c.DAG_PB,{cidVersion:i.cidVersion,hashAlg:d,onlyHash:!i.flush}),size:p.size}},recreateHamtLevel:l,addLinksToHamtBucket:d,toPrefix:p,createShard:async(e,t,r)=>{const n=new s({root:!0,dir:!0,parent:null,parentKey:null,path:"",dirty:!0,flat:!1,mtime:r.mtime,mode:r.mode},{...r,codec:"dag-pb"});for(let i=0;i<t.length;i++)await n._bucket.put(t[i].name,{size:t[i].size,cid:t[i].cid});return f(n.flush("",e.block,null))}}},function(e){e.exports=JSON.parse('{"name":"ipfs","version":"0.48.1","description":"JavaScript implementation of the IPFS specification","keywords":["IPFS"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs#readme","bugs":"https://github.com/ipfs/js-ipfs/issues","license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","files":["src","dist"],"main":"src/core/index.js","browser":{"./src/core/runtime/init-assets-nodejs.js":"./src/core/runtime/init-assets-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/libp2p-nodejs.js":"./src/core/runtime/libp2p-browser.js","./src/core/runtime/libp2p-pubsub-routers-nodejs.js":"./src/core/runtime/libp2p-pubsub-routers-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","ipfs-utils/src/files/glob-source":false},"bin":{"jsipfs":"src/cli/bin.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"lint":"aegir lint","build":"aegir build","test":"aegir test","test:node":"aegir test -t node","test:browser":"aegir test -t browser","test:browser:http":"aegir test -t browser -f test/http-api/index.js","test:webworker":"aegir test -t webworker","test:electron":"aegir test -t electron-main -t electron-renderer","test:electron-main":"aegir test -t electron-main","test:electron-renderer":"aegir test -t electron-renderer","test:cli":"aegir test -t node -f test/cli/index.js","test:node:core":"aegir test -t node -f test/core/**/*.js","test:node:http":"aegir test -t node -f test/http-api/index.js","test:node:gateway":"aegir test -t node -f test/gateway/index.js","test:interface":"aegir test -f test/core/interface.spec.js","test:interface:http":"aegir test -f test/http-api/interface.js","test:bootstrapers":"IPFS_TEST=bootstrapers aegir test -t browser -f test/bootstrapers.js","test:interop":"cross-env IPFS_JS_EXEC=$PWD/src/cli/bin.js IPFS_JS_MODULE=$PWD IPFS_JS_HTTP_MODULE=$PWD/../ipfs-http-client IPFS_REUSEPORT=false ipfs-interop","test:interop:node":"cross-env IPFS_JS_EXEC=$PWD/src/cli/bin.js IPFS_JS_MODULE=$PWD IPFS_JS_HTTP_MODULE=$PWD/../ipfs-http-client IPFS_REUSEPORT=false ipfs-interop -- -t node","test:interop:browser":"cross-env IPFS_JS_EXEC=$PWD/src/cli/bin.js IPFS_JS_MODULE=$PWD IPFS_JS_HTTP_MODULE=$PWD/../ipfs-http-client IPFS_REUSEPORT=false ipfs-interop -- -t browser","test:interop:electron-main":"cross-env IPFS_JS_EXEC=$PWD/src/cli/bin.js IPFS_JS_MODULE=$PWD IPFS_JS_HTTP_MODULE=$PWD/../ipfs-http-client IPFS_REUSEPORT=false ipfs-interop -- -t electron-main -f ./test/node.js","test:interop:electron-renderer":"cross-env IPFS_JS_EXEC=$PWD/src/cli/bin.js IPFS_JS_MODULE=$PWD IPFS_JS_HTTP_MODULE=$PWD/../ipfs-http-client IPFS_REUSEPORT=false ipfs-interop -- -t electron-renderer -f ./test/browser.js","test:external":"aegir test-dependant","coverage":"nyc --reporter=text --reporter=lcov npm run test:node","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"@hapi/ammo":"^3.1.2","@hapi/boom":"^7.4.3","@hapi/content":"^4.1.0","@hapi/hapi":"^18.4.0","@hapi/joi":"^15.1.0","abort-controller":"^3.0.0","any-signal":"^1.1.0","array-shuffle":"^1.0.1","bignumber.js":"^9.0.0","bl":"^4.0.2","bs58":"^4.0.1","buffer":"^5.6.0","byteman":"^1.3.5","cid-tool":"^0.4.0","cids":"^0.8.3","class-is":"^1.1.0","dag-cbor-links":"^1.3.3","datastore-core":"^1.1.0","datastore-pubsub":"^0.3.2","debug":"^4.1.0","dlv":"^1.1.3","err-code":"^2.0.0","file-type":"^14.1.4","fnv1a":"^1.0.1","get-folder-size":"^2.0.0","hamt-sharding":"^1.0.0","hapi-pino":"^6.1.0","hashlru":"^2.3.0","interface-datastore":"^1.0.2","ipfs-bitswap":"^2.0.1","ipfs-block-service":"^0.17.1","ipfs-core-utils":"^0.3.0","ipfs-http-client":"^45.0.0","ipfs-http-response":"^0.5.0","ipfs-repo":"^4.0.0","ipfs-unixfs":"^1.0.3","ipfs-unixfs-exporter":"^2.0.2","ipfs-unixfs-importer":"^2.0.2","ipfs-utils":"^2.2.2","ipld":"^0.26.2","ipld-bitcoin":"^0.3.0","ipld-block":"^0.9.1","ipld-dag-cbor":"^0.15.2","ipld-dag-pb":"^0.18.5","ipld-ethereum":"^4.0.0","ipld-git":"^0.5.0","ipld-raw":"^5.0.0","ipld-zcash":"^0.4.0","ipns":"^0.7.1","is-domain-name":"^1.0.1","is-ipfs":"^1.0.3","iso-url":"^0.4.7","it-all":"^1.0.1","it-concat":"^1.0.0","it-drain":"^1.0.1","it-first":"^1.0.1","it-glob":"0.0.8","it-last":"^1.0.1","it-map":"^1.0.0","it-multipart":"^1.0.1","it-pipe":"^1.1.0","it-tar":"^1.2.2","it-to-stream":"^0.1.1","iterable-ndjson":"^1.1.0","jsondiffpatch":"^0.4.1","just-safe-set":"^2.1.0","libp2p":"^0.28.5","libp2p-bootstrap":"^0.11.0","libp2p-crypto":"^0.17.8","libp2p-delegated-content-routing":"^0.5.0","libp2p-delegated-peer-routing":"^0.5.0","libp2p-floodsub":"^0.21.0","libp2p-gossipsub":"^0.4.0","libp2p-kad-dht":"^0.19.9","libp2p-mdns":"^0.14.1","libp2p-mplex":"^0.9.5","libp2p-noise":"^1.1.1","libp2p-record":"^0.7.3","libp2p-secio":"^0.12.6","libp2p-tcp":"^0.14.5","libp2p-webrtc-star":"^0.18.0","libp2p-websockets":"^0.13.3","mafmt":"^7.0.0","merge-options":"^2.0.0","mortice":"^2.0.0","multiaddr":"^7.4.3","multiaddr-to-uri":"^5.1.0","multibase":"^1.0.1","multicodec":"^1.0.0","multihashing-async":"^1.0.0","p-defer":"^3.0.0","p-queue":"^6.1.0","parse-duration":"^0.4.4","peer-id":"^0.13.12","pretty-bytes":"^5.3.0","progress":"^2.0.1","protons":"^1.2.0","semver":"^7.3.2","stream-to-it":"^0.2.1","streaming-iterables":"^5.0.0","temp":"^0.9.0","timeout-abort-controller":"^1.1.0","update-notifier":"^4.0.0","uri-to-multiaddr":"^3.0.2","varint":"^5.0.0","yargs":"^15.1.0","yargs-promise":"^1.1.0"},"devDependencies":{"aegir":"^23.0.0","base64url":"^3.0.1","clear-module":"^4.0.0","cross-env":"^7.0.0","delay":"^4.3.0","execa":"^4.0.0","form-data":"^3.0.0","go-ipfs":"^0.6.0","interface-ipfs-core":"^0.138.0","ipfs-interop":"^2.0.0","ipfsd-ctl":"^5.0.0","iso-random-stream":"^1.1.1","it-to-buffer":"^1.0.0","nanoid":"^3.0.2","ncp":"^2.0.0","p-event":"^4.1.0","p-map":"^4.0.0","qs":"^6.9.3","rimraf":"^3.0.0","sinon":"^9.0.1","stream-to-promise":"^3.0.0","string-argv":"^0.3.1","temp-write":"^4.0.0","wrtc":"^0.4.4"},"optionalDependencies":{"prom-client":"^12.0.0","prometheus-gc-stats":"^0.6.0"},"engines":{"node":">=10.0.0","npm":">=6.0.0"},"contributors":["0xflotus <0xflotus@gmail.com>","A_A <21040751+Otto-AA@users.noreply.github.com>","Adam Uhlíř <adam@uhlir.dev>","Alan Shaw <alan.shaw@protocol.ai>","Alan Shaw <alan@tableflip.io>","Alex North <alex@alexnorth.me>","Alex Potsides <alex@achingbrain.net>","Andrew Nesbitt <andrewnez@gmail.com>","Andrew de Andrade <andrew@deandrade.com.br>","André Cruz <andremiguelcruz@msn.com>","Arkadiy Kukarkin <parkan@users.noreply.github.com>","Arpit Agarwal <93arpit@gmail.com>","Arpit Agarwal <atvanguard@users.noreply.github.com>","Ayush Mahajan <mahajan.ayush2306@gmail.com>","Bernard Mordan <bernard@tableflip.io>","Brian Vander Schaaf <bvs330@gmail.com>","Bruno Zell <bruno.zzell@gmail.com>","CHEVALAY JOSSELIN <josselin54.chevalay@gmail.com>","Caio Gondim <me@caiogondim.com>","Chance Hudson <jchancehud@gmail.com>","Chirag Shinde <chirag-shinde@users.noreply.github.com>","Christian Couder <chriscool@tuxfamily.org>","Dafeng <dfguo.joe@gmail.com>","Dan Ordille <dordille@gmail.com>","Dan Shields <35669742+NukeManDan@users.noreply.github.com>","Daniel Buchner <danieljb2@gmail.com>","Daniel J. O\'Quinn <danieljoquinn@gmail.com>","Daniela Borges Matos de Carvalho <alunassertiva@gmail.com>","David Dias <daviddias.p@gmail.com>","David Gilbertson <gilbertson.david@gmail.com>","David da Silva <dasilvacontin@gmail.com>","Diogo Silva <fsdiogo@gmail.com>","Dmitriy Ryajov <dryajov@gmail.com>","Dominic Della Valle <ddvpublic@Gmail.com>","Dzmitry Bachko <dbachko@gmail.com>","Enrico Marino <enrico.marino@email.com>","Faheel Ahmad <faheel@live.in>","Felix Yan <felixonmars@archlinux.org>","Francisco Baio Dias <xicombd@gmail.com>","Francisco Baio Dias <francisco@typeform.com>","Friedel Ziegelmayer <dignifiedquire@gmail.com>","Gabriel Garrido Calvo <gabriel.garrido.work@gmail.com>","Gar <gar+gh@danger.computer>","Georgios Rassias <georassias@gmail.com>","Gorka Ludlow <gorka@aquigorka.com>","Grant Herman <grantlouisherman041@gmail.com>","Greenkeeper <support@greenkeeper.io>","Haad <haadcode@users.noreply.github.com>","Haoliang Yu <haoliangyu@users.noreply.github.com>","Harsh Vakharia <harshjv@users.noreply.github.com>","Henrique Dias <hacdias@gmail.com>","Henry Rodrick <moshisushi@gmail.com>","Heo Sangmin <heo@mapiacompany.com>","Hugo Dias <hugomrdias@gmail.com>","Hugo Dias <mail@hugodias.me>","Irakli Gozalishvili <contact@gozala.io>","Jacob Heun <jacobheun@gmail.com>","Jacob Heun <jake@andyet.net>","Jade Meskill <jade.meskill@gmail.com>","Jessica Schilling <jessica@protocol.ai>","Johannes Wikner <johannes.wikner@gmail.com>","Jon Schlinkert <dev@sellside.com>","Jonathan <jkrone@vt.edu>","Jonybang <Jonybange@gmail.com>","Jorropo <jorropo.pgm@gmail.com>","João Antunes <j.goncalo.antunes@gmail.com>","João Santos <joaosantos15@users.noreply.github.com>","Kevin Wang <kevin@fossa.io>","Lars Gierth <larsg@systemli.org>","Lukas Drgon <lukas.drgon@gmail.com>","Maciej Krüger <mkg20001@gmail.com>","Marcin Rataj <lidel@lidel.org>","Marcus Bernales <mboperator@gmail.com>","Marius Darila <marius.darila@gmail.com>","Mark Robert Henderson <henderson.mark@gmail.com>","Mat Kelly <machawk1@gmail.com>","Michelle Lee <michelle@protocol.ai>","Mikeal Rogers <mikeal.rogers@gmail.com>","Mithgol <getgit@mithgol.ru>","Molly <momack2@users.noreply.github.com>","Mounish Sai <pvsmounish@gmail.com>","My9Bot <34904312+My9Bot@users.noreply.github.com>","Nick Poulden <nick@poulden.com>","Nitin Patel <31539366+niinpatel@users.noreply.github.com>","Nuno Nogueira <nunofmn@gmail.com>","Oli Evans <oli@tableflip.io>","Oskar Nyberg <oskar@oskarnyberg.com>","Pascal Precht <pascal.precht@googlemail.com>","Pau Ramon Revilla <masylum@gmail.com>","Paulo Rodrigues <me@paulogr.com>","Pedro Santos <pedro.santos@moxy.studio>","Pedro Santos <pedromiguelsousasantos@hotmail.com>","Pedro Teixeira <i@pgte.me>","Portia Burton <plburton@gmail.com>","Prabhakar Poudel <yuvrajzohan@gmail.com>","Qmstream <51881352+Qmstream@users.noreply.github.com>","Raoul Millais <raoul@raoulmillais.com>","RasmusErik Voel Jensen <github@solsort.com>","Richard Littauer <richard.littauer@gmail.com>","Richard Schneider <makaretu@gmail.com>","Rob Brackett <rob@robbrackett.com>","Rod Keys <rod@zokos.com>","Sangwon Hong <qpakzk@gmail.com>","Sid Harder <sideharder@gmail.com>","SidHarder <softwarenavigator@gmail.com>","Stephen Whitmore <stephen.whitmore@gmail.com>","Stephen Whitmore <noffle@users.noreply.github.com>","Steven Allen <steven@stebalien.com>","Tapasweni Pathak <tapaswenipathak@gmail.com>","Terence Pae <terencepae@gmail.com>","Teri Chadbourne <terichadbourne@users.noreply.github.com>","Travis CI <travis@travis-ci.org>","Uroš Jurglič <jurglic@gmail.com>","Vasco Santos <vasco.santos@moxy.studio>","Vasco Santos <vasco.santos@ua.pt>","Vincent Martin <vince@finalatomicbuster.net>","Volker Mische <volker.mische@gmail.com>","Xiao Liang <yxliang01@users.noreply.github.com>","Yahya <ya7yaz@gmail.com>","Yole <yole@ultiledger.io>","bitspill <bitspill+github@bitspill.net>","datafatmunger <jbg@peerparty.org>","dirkmc <dirkmdev@gmail.com>","dirkmc <dirk@mccormick.cx>","greenkeeper[bot] <23040076+greenkeeper[bot]@users.noreply.github.com>","greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com>","haad <haad@headbanggames.com>","hapsody <hapsody@gmail.com>","jbenet <juan@benet.ai>","jonahweissman <19804455+jonahweissman@users.noreply.github.com>","kevingzhang <kevin.zhang.canada@gmail.com>","kumavis <kumavis@users.noreply.github.com>","nginnever <ginneversource@gmail.com>","npmcdn-to-unpkg-bot <npmcdn-to-unpkg-bot@users.noreply.github.com>","reasv <7143787+reasv@users.noreply.github.com>","robbsolter <35879806+robbsolter@users.noreply.github.com>","seungwon-kang <ksw3894@gmail.com>","swedneck <40505480+swedneck@users.noreply.github.com>","tcme <hi@this-connect.me>","victorbjelkholm <victorbjelkholm@gmail.com>","Łukasz Magiera <magik6k@users.noreply.github.com>","Максим Ильин <negamaxi@gmail.com>"]}')},function(e,t,r){"use strict";e.exports=function(e,t,r){if(!e)return r;var n,i;Array.isArray(t)&&(n=t.slice(0));"string"==typeof t&&(n=t.split("."));"symbol"==typeof t&&(n=[t]);if(!Array.isArray(n))throw new Error("props arg must be an array, a string or a symbol");for(;n.length;){if(i=n.shift(),!e)return r;if(void 0===(e=e[i]))return r}return e}},function(e,t,r){"use strict";const n=r(7).Key,i=r(605),s=t.PREFIX="/repo/flatfs/shard/",o=t.SHARDING_FN="SHARDING";t.README_FN="_README";class a{constructor(e){this.param=e}fun(e){throw new Error("implement me")}toString(){return"".concat(s,"v1/").concat(this.name,"/").concat(this.param)}}class c 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 f extends a{constructor(e){super(e),this._padding="".padStart(e+1,"_"),this.name="next-to-last"}fun(e){const t=this._padding+e,r=t.length-this.param-1;return t.slice(r,r+this.param)}}function h(e){if(0===(e=e.trim()).length)throw new Error("empty shard string");if(!e.startsWith(s))throw new Error("invalid or no path prefix: ".concat(e));const t=e.slice(s.length).split("/"),r=t[0];if("v1"!==r)throw new Error("expect 'v1' version, got '".concat(r,"'"));const n=t[1];if(!t[2])throw new Error("missing param");const i=parseInt(t[2],10);switch(n){case"prefix":return new c(i);case"suffix":return new u(i);case"next-to-last":return new f(i);default:throw new Error("unkown sharding function: ".concat(n))}}t.readShardFun=async(e,t)=>{const r=new n(e).child(new n(o)),i="function"==typeof t.getRaw?t.getRaw.bind(t):t.get.bind(t);return h((await i(r)||"").toString().trim())},t.readme=i,t.parseShardFun=h,t.Prefix=c,t.Suffix=u,t.NextToLast=f},function(e,t,r){"use strict";(function(e){var n=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++)r[t[n]]=Object.getOwnPropertyDescriptor(e,t[n]);return r},i=/%[sdj%]/g;t.format=function(e){if(!m(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(a(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,s=n.length,o=String(e).replace(i,(function(e){if("%%"===e)return"%";if(r>=s)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return e}})),c=n[r];r<s;c=n[++r])b(c)||!w(c)?o+=" "+c:o+=" "+a(c);return o},t.deprecate=function(r,n){if(void 0!==e&&!0===e.noDeprecation)return r;if(void 0===e)return function(){return t.deprecate(r,n).apply(this,arguments)};var i=!1;return function(){if(!i){if(e.throwDeprecation)throw new Error(n);e.traceDeprecation?console.trace(n):console.error(n),i=!0}return r.apply(this,arguments)}};var s,o={};function a(e,r){var n={seen:[],stylize:u};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),p(r)?n.showHidden=r:r&&t._extend(n,r),g(n.showHidden)&&(n.showHidden=!1),g(n.depth)&&(n.depth=2),g(n.colors)&&(n.colors=!1),g(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=c),f(n,e,n.depth)}function c(e,t){var r=a.styles[t];return r?"["+a.colors[r][0]+"m"+e+"["+a.colors[r][1]+"m":e}function u(e,t){return e}function f(e,r,n){if(e.customInspect&&r&&k(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return m(i)||(i=f(e,i,n)),i}var s=function(e,t){if(g(t))return e.stylize("undefined","undefined");if(m(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(y(t))return e.stylize(""+t,"number");if(p(t))return e.stylize(""+t,"boolean");if(b(t))return e.stylize("null","null")}(e,r);if(s)return s;var o=Object.keys(r),a=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(r)),E(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return h(r);if(0===o.length){if(k(r)){var c=r.name?": "+r.name:"";return e.stylize("[Function"+c+"]","special")}if(v(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(_(r))return e.stylize(Date.prototype.toString.call(r),"date");if(E(r))return h(r)}var u,w="",S=!1,A=["{","}"];(d(r)&&(S=!0,A=["[","]"]),k(r))&&(w=" [Function"+(r.name?": "+r.name:"")+"]");return v(r)&&(w=" "+RegExp.prototype.toString.call(r)),_(r)&&(w=" "+Date.prototype.toUTCString.call(r)),E(r)&&(w=" "+h(r)),0!==o.length||S&&0!=r.length?n<0?v(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),u=S?function(e,t,r,n,i){for(var s=[],o=0,a=t.length;o<a;++o)R(t,String(o))?s.push(l(e,t,r,n,String(o),!0)):s.push("");return i.forEach((function(i){i.match(/^\d+$/)||s.push(l(e,t,r,n,i,!0))})),s}(e,r,n,a,o):o.map((function(t){return l(e,r,n,a,t,S)})),e.seen.pop(),function(e,t,r){if(e.reduce((function(e,t){return t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(u,w,A)):A[0]+w+A[1]}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,r,n,i,s){var o,a,c;if((c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(a=e.stylize("[Setter]","special")),R(n,i)||(o="["+i+"]"),a||(e.seen.indexOf(c.value)<0?(a=b(r)?f(e,c.value,null):f(e,c.value,r-1)).indexOf("\n")>-1&&(a=s?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")),g(o)){if(s&&i.match(/^\d+$/))return a;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function d(e){return Array.isArray(e)}function p(e){return"boolean"==typeof e}function b(e){return null===e}function y(e){return"number"==typeof e}function m(e){return"string"==typeof e}function g(e){return void 0===e}function v(e){return w(e)&&"[object RegExp]"===S(e)}function w(e){return"object"==typeof e&&null!==e}function _(e){return w(e)&&"[object Date]"===S(e)}function E(e){return w(e)&&("[object Error]"===S(e)||e instanceof Error)}function k(e){return"function"==typeof e}function S(e){return Object.prototype.toString.call(e)}function A(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(r){if(g(s)&&(s={NODE_ENV:"production"}.NODE_DEBUG||""),r=r.toUpperCase(),!o[r])if(new RegExp("\\b"+r+"\\b","i").test(s)){var n=e.pid;o[r]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",r,n,e)}}else o[r]=function(){};return o[r]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=d,t.isBoolean=p,t.isNull=b,t.isNullOrUndefined=function(e){return null==e},t.isNumber=y,t.isString=m,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=g,t.isRegExp=v,t.isObject=w,t.isDate=_,t.isError=E,t.isFunction=k,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(612);var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(){var e=new Date,t=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":");return[e.getDate(),I[e.getMonth()],t].join(" ")}function R(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",T(),t.format.apply(t,arguments))},t.inherits=r(613),t._extend=function(e,t){if(!t||!w(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var x="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function C(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(x&&e[x]){var t;if("function"!=typeof(t=e[x]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,x,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise((function(e,n){t=e,r=n})),i=[],s=0;s<arguments.length;s++)i.push(arguments[s]);i.push((function(e,n){e?r(e):t(n)}));try{e.apply(this,i)}catch(o){r(o)}return n}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),x&&Object.defineProperty(t,x,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,n(e))},t.promisify.custom=x,t.callbackify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');function r(){for(var r=[],n=0;n<arguments.length;n++)r.push(arguments[n]);var i=r.pop();if("function"!=typeof i)throw new TypeError("The last argument must be of type Function");var s=this,o=function(){return i.apply(s,arguments)};t.apply(this,r).then((function(t){e.nextTick(o,null,t)}),(function(t){e.nextTick(C,t,o)}))}return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),Object.defineProperties(r,n(t)),r}}).call(this,r(8))},function(e,t,r){"use strict";t.AbstractLevelDOWN=r(615),t.AbstractIterator=r(266),t.AbstractChainedBatch=r(267)},function(e,t,r){"use strict";var n=r(156);function i(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}i.prototype.next=function(e){var t=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return t._ended?(n(e,new Error("cannot call next() after end()")),t):t._nexting?(n(e,new Error("cannot call next() before previous next() has completed")),t):(t._nexting=!0,t._next((function(){t._nexting=!1,e.apply(null,arguments)})),t)},i.prototype._next=function(e){n(e)},i.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)},i.prototype._seek=function(e){},i.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return n(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},i.prototype._end=function(e){n(e)},i.prototype._nextTick=n,e.exports=i},function(e,t,r){"use strict";var n=r(156);function i(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}i.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},i.prototype.put=function(e,t){this._checkWritten();var r=this.db._checkKey(e)||this.db._checkValue(t);if(r)throw r;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t),this},i.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},i.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},i.prototype._del=function(e){this._operations.push({type:"del",key:e})},i.prototype.clear=function(){return this._checkWritten(),this._clear(),this},i.prototype._clear=function(){this._operations=[]},i.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)},i.prototype._write=function(e,t){this.db._batch(this._operations,e,t)},i.prototype._nextTick=n,e.exports=i},function(e,t,r){"use strict";(t=e.exports=r(269)).Stream=t,t.Readable=t,t.Writable=r(273),t.Duplex=r(66),t.Transform=r(275),t.PassThrough=r(631),t.finished=r(158),t.pipeline=r(632)},function(e,t,r){"use strict";(function(t,n){var i;e.exports=A,A.ReadableState=S;r(13).EventEmitter;var s=function(e,t){return e.listeners(t).length},o=r(270),a=r(0).Buffer,c=t.Uint8Array||function(){};var u,f=r(624);u=f&&f.debuglog?f.debuglog("stream"):function(){};var h,l,d,p=r(625),b=r(271),y=r(272).getHighWaterMark,m=r(65).codes,g=m.ERR_INVALID_ARG_TYPE,v=m.ERR_STREAM_PUSH_AFTER_EOF,w=m.ERR_METHOD_NOT_IMPLEMENTED,_=m.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(24)(A,o);var E=b.errorOrDestroy,k=["error","close","destroy","pause","resume"];function S(e,t,n){i=i||r(66),e=e||{},"boolean"!=typeof n&&(n=t instanceof i),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=y(this,e,"readableHighWaterMark",n),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(h||(h=r(274).StringDecoder),this.decoder=new h(e.encoding),this.encoding=e.encoding)}function A(e){if(i=i||r(66),!(this instanceof A))return new A(e);var t=this instanceof i;this._readableState=new S(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),o.call(this)}function I(e,t,r,n,i){u("readableAddChunk",t);var s,o=e._readableState;if(null===t)o.reading=!1,function(e,t){if(u("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?x(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,C(e)))}(e,o);else if(i||(s=function(e,t){var r;n=t,a.isBuffer(n)||n instanceof c||"string"==typeof t||void 0===t||e.objectMode||(r=new g("chunk",["string","Buffer","Uint8Array"],t));var n;return r}(o,t)),s)E(e,s);else if(o.objectMode||t&&t.length>0)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===a.prototype||(t=function(e){return a.from(e)}(t)),n)o.endEmitted?E(e,new _):T(e,o,t,!0);else if(o.ended)E(e,new v);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?T(e,o,t,!1):B(e,o)):T(e,o,t,!1)}else n||(o.reading=!1,B(e,o));return!o.ended&&(o.length<o.highWaterMark||0===o.length)}function T(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&x(e)),B(e,t)}Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),A.prototype.destroy=b.destroy,A.prototype._undestroy=b.undestroy,A.prototype._destroy=function(e,t){t(e)},A.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=a.from(e,t),t=""),r=!0),I(this,e,t,!1,r)},A.prototype.unshift=function(e){return I(this,e,null,!0,!1)},A.prototype.isPaused=function(){return!1===this._readableState.flowing},A.prototype.setEncoding=function(e){h||(h=r(274).StringDecoder);var t=new h(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};function R(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=1073741824?e=1073741824:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function x(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(C,e))}function C(e){var t=e._readableState;u("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,D(e)}function B(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(M,e,t))}function M(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(u("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function N(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function P(e){u("readable nexttick read 0"),e.read(0)}function O(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),D(e),t.flowing&&!t.reading&&e.read(0)}function D(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function L(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function j(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(U,t,e))}function U(e,t){if(u("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function z(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}A.prototype.read=function(e){u("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?j(this):x(this),null;if(0===(e=R(e,t))&&t.ended)return 0===t.length&&j(this),null;var n,i=t.needReadable;return u("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&u("length less than watermark",i=!0),t.ended||t.reading?u("reading or ended",i=!1):i&&(u("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=R(r,t))),null===(n=e>0?L(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&j(this)),null!==n&&this.emit("data",n),n},A.prototype._read=function(e){E(this,new w("_read()"))},A.prototype.pipe=function(e,t){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,u("pipe count=%d opts=%j",i.pipesCount,t);var o=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?c:y;function a(t,n){u("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,u("cleanup"),e.removeListener("close",p),e.removeListener("finish",b),e.removeListener("drain",f),e.removeListener("error",d),e.removeListener("unpipe",a),r.removeListener("end",c),r.removeListener("end",y),r.removeListener("data",l),h=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function c(){u("onend"),e.end()}i.endEmitted?n.nextTick(o):r.once("end",o),e.on("unpipe",a);var f=function(e){return function(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,D(e))}}(r);e.on("drain",f);var h=!1;function l(t){u("ondata");var n=e.write(t);u("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==z(i.pipes,e))&&!h&&(u("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function d(t){u("onerror",t),y(),e.removeListener("error",d),0===s(e,"error")&&E(e,t)}function p(){e.removeListener("finish",b),y()}function b(){u("onfinish"),e.removeListener("close",p),y()}function y(){u("unpipe"),r.unpipe(e)}return r.on("data",l),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",d),e.once("close",p),e.once("finish",b),e.emit("pipe",r),i.flowing||(u("pipe resume"),r.resume()),e},A.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<i;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=z(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},A.prototype.on=function(e,t){var r=o.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,u("on readable",i.length,i.reading),i.length?x(this):i.reading||n.nextTick(P,this))),r},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(e,t){var r=o.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(N,this),r},A.prototype.removeAllListeners=function(e){var t=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(N,this),t},A.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(O,e,t))}(this,e)),e.paused=!1,this},A.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(u("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var s=0;s<k.length;s++)e.on(k[s],this.emit.bind(this,k[s]));return this._read=function(t){u("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(A.prototype[Symbol.asyncIterator]=function(){return void 0===l&&(l=r(629)),l(this)}),Object.defineProperty(A.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(A.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(A.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),A._fromList=L,Object.defineProperty(A.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(A.from=function(e,t){return void 0===d&&(d=r(630)),d(A,e,t)})}).call(this,r(10),r(8))},function(e,t,r){"use strict";e.exports=r(13).EventEmitter},function(e,t,r){"use strict";(function(t){function r(e,t){i(e,t),n(e)}function n(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function i(e,t){e.emit("error",t)}e.exports={destroy:function(e,s){var o=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(s?s(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(i,this,e)):t.nextTick(i,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!s&&e?o._writableState?o._writableState.errorEmitted?t.nextTick(n,o):(o._writableState.errorEmitted=!0,t.nextTick(r,o,e)):t.nextTick(r,o,e):s?(t.nextTick(n,o),s(e)):t.nextTick(n,o)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}).call(this,r(8))},function(e,t,r){"use strict";var n=r(65).codes.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,r,i){var s=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0)throw new n(i?r:"highWaterMark",s);return Math.floor(s)}return e.objectMode?16:16384}}},function(e,t,r){"use strict";(function(t,n){function i(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}var s;e.exports=A,A.WritableState=S;var o={deprecate:r(627)},a=r(270),c=r(0).Buffer,u=t.Uint8Array||function(){};var f,h=r(271),l=r(272).getHighWaterMark,d=r(65).codes,p=d.ERR_INVALID_ARG_TYPE,b=d.ERR_METHOD_NOT_IMPLEMENTED,y=d.ERR_MULTIPLE_CALLBACK,m=d.ERR_STREAM_CANNOT_PIPE,g=d.ERR_STREAM_DESTROYED,v=d.ERR_STREAM_NULL_VALUES,w=d.ERR_STREAM_WRITE_AFTER_END,_=d.ERR_UNKNOWN_ENCODING,E=h.errorOrDestroy;function k(){}function S(e,t,o){s=s||r(66),e=e||{},"boolean"!=typeof o&&(o=t instanceof s),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=l(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===e.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,i=r.sync,s=r.writecb;if("function"!=typeof s)throw new y;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,i,s){--t.pendingcb,r?(n.nextTick(s,i),n.nextTick(B,e,t),e._writableState.errorEmitted=!0,E(e,i)):(s(i),e._writableState.errorEmitted=!0,E(e,i),B(e,t))}(e,r,i,t,s);else{var o=x(r)||e.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||R(e,r),i?n.nextTick(T,e,r,o,s):T(e,r,o,s)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function A(e){var t=this instanceof(s=s||r(66));if(!t&&!f.call(A,this))return new A(e);this._writableState=new S(e,this,t),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)),a.call(this)}function I(e,t,r,n,i,s,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new g("write")):r?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}function T(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),B(e,t)}function R(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,s=new Array(n),o=t.corkedRequestsFree;o.entry=r;for(var a=0,c=!0;r;)s[a]=r,r.isBuf||(c=!1),r=r.next,a+=1;s.allBuffers=c,I(e,t,!0,t.length,s,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new i(t),t.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,f=r.encoding,h=r.callback;if(I(e,t,!1,t.objectMode?1:u.length,u,f,h),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function x(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function C(e,t){e._final((function(r){t.pendingcb--,r&&E(e,r),t.prefinished=!0,e.emit("prefinish"),B(e,t)}))}function B(e,t){var r=x(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(C,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var i=e._readableState;(!i||i.autoDestroy&&i.endEmitted)&&e.destroy()}return r}r(24)(A,a),S.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(S.prototype,"buffer",{get:o.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(f=Function.prototype[Symbol.hasInstance],Object.defineProperty(A,Symbol.hasInstance,{value:function(e){return!!f.call(this,e)||this===A&&(e&&e._writableState instanceof S)}})):f=function(e){return e instanceof this},A.prototype.pipe=function(){E(this,new m)},A.prototype.write=function(e,t,r){var i,s=this._writableState,o=!1,a=!s.objectMode&&(i=e,c.isBuffer(i)||i instanceof u);return a&&!c.isBuffer(e)&&(e=function(e){return c.from(e)}(e)),"function"==typeof t&&(r=t,t=null),a?t="buffer":t||(t=s.defaultEncoding),"function"!=typeof r&&(r=k),s.ending?function(e,t){var r=new w;E(e,r),n.nextTick(t,r)}(this,r):(a||function(e,t,r,i){var s;return null===r?s=new v:"string"==typeof r||t.objectMode||(s=new p("chunk",["string","Buffer"],r)),!s||(E(e,s),n.nextTick(i,s),!1)}(this,s,e,r))&&(s.pendingcb++,o=function(e,t,r,n,i,s){if(!r){var o=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=c.from(t,r));return t}(t,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length<t.highWaterMark;u||(t.needDrain=!0);if(t.writing||t.corked){var f=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:s,next:null},f?f.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else I(e,t,!1,a,n,i,s);return u}(this,s,a,e,t,r)),o},A.prototype.cork=function(){this._writableState.corked++},A.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||R(this,e))},A.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new _(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,r){r(new b("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,r){var i=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,t,r){t.ending=!0,B(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,i,r),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=h.destroy,A.prototype._undestroy=h.undestroy,A.prototype._destroy=function(e,t){t(e)}}).call(this,r(10),r(8))},function(e,t,r){"use strict";var n=r(628).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=f,this.end=h,t=3;break;default:return this.write=l,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function f(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function l(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.StringDecoder=s,s.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},s.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},s.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=o(t[n]);if(i>=0)return i>0&&(e.lastNeed=i-1),i;if(--n<r||-2===i)return 0;if((i=o(t[n]))>=0)return i>0&&(e.lastNeed=i-2),i;if(--n<r||-2===i)return 0;if((i=o(t[n]))>=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,r){"use strict";e.exports=f;var n=r(65).codes,i=n.ERR_METHOD_NOT_IMPLEMENTED,s=n.ERR_MULTIPLE_CALLBACK,o=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,c=r(66);function u(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new s);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function f(e){if(!(this instanceof f))return new f(e);c.call(this,e),this._transformState={afterTransform:u.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",h)}function h(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?l(this,null,null):this._flush((function(t,r){l(e,t,r)}))}function l(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new a;if(e._transformState.transforming)throw new o;return e.push(null)}r(24)(f,c),f.prototype.push=function(e,t){return this._transformState.needTransform=!1,c.prototype.push.call(this,e,t)},f.prototype._transform=function(e,t,r){r(new i("_transform()"))},f.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},f.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},f.prototype._destroy=function(e,t){c.prototype._destroy.call(this,e,(function(e){t(e)}))}},function(e,t,r){"use strict";e.exports=function(){var e,t=new Promise((function(t,r){e=function(e,n){e?r(e):t(n)}}));return e.promise=t,e}},function(e,t,r){"use strict";var n=r(161);function i(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}i.prototype.next=function(e){var t=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return t._ended?(n(e,new Error("cannot call next() after end()")),t):t._nexting?(n(e,new Error("cannot call next() before previous next() has completed")),t):(t._nexting=!0,t._next((function(){t._nexting=!1,e.apply(null,arguments)})),t)},i.prototype._next=function(e){n(e)},i.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)},i.prototype._seek=function(e){},i.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return n(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},i.prototype._end=function(e){n(e)},i.prototype._nextTick=n,e.exports=i},function(e,t,r){"use strict";var n=r(161);function i(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}i.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},i.prototype.put=function(e,t){this._checkWritten();var r=this.db._checkKey(e)||this.db._checkValue(t);if(r)throw r;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t),this},i.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},i.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},i.prototype._del=function(e){this._operations.push({type:"del",key:e})},i.prototype.clear=function(){return this._checkWritten(),this._clear(),this},i.prototype._clear=function(){this._operations=[]},i.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)},i.prototype._write=function(e,t){this.db._batch(this._operations,e,t)},i.prototype._nextTick=n,e.exports=i},function(e,t,r){"use strict";t.AbstractLevelDOWN=r(644),t.AbstractIterator=r(280),t.AbstractChainedBatch=r(281)},function(e,t,r){"use strict";(function(t){function r(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}r.prototype.next=function(e){var r=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return r._ended?(t.nextTick(e,new Error("cannot call next() after end()")),r):r._nexting?(t.nextTick(e,new Error("cannot call next() before previous next() has completed")),r):(r._nexting=!0,r._next((function(){r._nexting=!1,e.apply(null,arguments)})),r)},r.prototype._next=function(e){t.nextTick(e)},r.prototype.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)},r.prototype._seek=function(e){},r.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return t.nextTick(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},r.prototype._end=function(e){t.nextTick(e)},e.exports=r}).call(this,r(8))},function(e,t,r){"use strict";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 r=this.db._checkKey(e)||this.db._checkValue(t);if(r)throw r;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,r){"use strict";(function(t){var n=r(647);e.exports=function(e){return e instanceof Uint8Array?n(e):e instanceof ArrayBuffer?t.from(e):t.from(String(e))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports=r(157)},function(e,t,r){"use strict";const{Key:n}=r(7),i=r(4),s=r(27),o=r(1);t.cidToKey=e=>{if(!i.isCID(e))throw o(new Error("Not a valid cid"),"ERR_INVALID_CID");return new n("/"+s.encode("base32",e.multihash).toString().slice(1).toUpperCase(),!1)},t.keyToCid=e=>new i(1,"raw",s.decode("b"+e.toString().slice(1).toLowerCase()))},function(e,t,r){"use strict";const n=r(665);e.exports=class{constructor(e){this.hwm=e||16,this.head=new n(this.hwm),this.tail=this.head}push(e){if(!this.head.push(e)){const t=this.head;this.head=t.next=new n(2*this.head.buffer.length),this.head.push(e)}}shift(){const e=this.tail.shift();if(void 0===e&&this.tail.next){const e=this.tail.next;return this.tail.next=null,this.tail=e,this.tail.shift()}return e}isEmpty(){return this.head.isEmpty()}}},function(e,t,r){"use strict";const n=r(163),i=r(2)("ipfs:repo:lock"),s={};t.lock=async e=>{const t=e+"/repo.lock";if(i("locking %s",t),!0===s[t])throw new n.LockExistsError("Lock already being held for file: ".concat(t));s[t]=!0;return{async close(){s[t]&&delete s[t]}}},t.locked=async e=>{const t=e+"/repo.lock";return i("checking lock: ".concat(t)),Boolean(s[t])}},function(e,t,r){"use strict";const n=r(139),{Buffer:i}=r(0),s=r(11),o=r(22),a=r(4),c=r(141);function u(e){let t;try{t=c(e)}catch(r){t=!1}if(t)throw new Error("The object passed has circular references");return function e(t){if(!t||t instanceof Uint8Array||"string"==typeof t)return t;if(Array.isArray(t))return t.map(e);if(a.isCID(t))return"string"==typeof(r=t)?r=new a(r).buffer:a.isCID(r)&&(r=r.buffer),new n.Tagged(42,i.concat([i.from("00","hex"),r]));var r;const s=Object.keys(t);if(s.length>0){const r={};return s.forEach(n=>{"object"==typeof t[n]?r[n]=e(t[n]):r[n]=t[n]}),r}return t}(e)}(t=e.exports).codec=s.DAG_CBOR,t.defaultHashAlg=s.SHA2_256;const f={42:e=>(e=e.slice(1),new a(e))};let h=65536;let l=67108864,d=null;t.configureDecoder=e=>{let t=f;e?("number"==typeof e.size&&(h=e.size),"number"==typeof e.maxSize&&(l=e.maxSize),e.tags&&(t=Object.assign({},f,e&&e.tags))):(h=65536,l=67108864);const r={tags:t,size:h};d=new n.Decoder(r),h=r.size},t.configureDecoder(),t.serialize=e=>{const t=u(e);return n.encode(t)},t.deserialize=e=>{if(e.length>h&&e.length<=l&&t.configureDecoder({size:e.length}),e.length>h)throw new Error("Data is too large to deserialize with current decoder");const r=d.decodeAll(e);if(1!==r.length)throw new Error("Extraneous CBOR data found beyond initial top-level object");return r[0]},t.cid=async(e,r)=>{const n={cidVersion:1,hashAlg:t.defaultHashAlg},i=Object.assign(n,r),c=await o(e,i.hashAlg),u=s.print[t.codec];return new a(i.cidVersion,u,c)}},function(e,t,r){"use strict";const n=r(21),{Buffer:i}=r(0),s=r(289),o=r(67),{serializeDAGNode:a}=r(290),c=r(675),u=r(676),f=r(678);e.exports=n(class{constructor(e,t=[],r=null){if(e||(e=i.alloc(0)),"string"==typeof e&&(e=i.from(e)),!i.isBuffer(e))throw new Error("Passed 'data' is not a buffer or a string!");if(null!==r&&"number"!=typeof r)throw new Error("Passed 'serializedSize' must be a number!");t=t.map(e=>o.isDAGLink(e)?e:o.util.createDagLinkFromB58EncodedHash(e)),s(t),Object.defineProperties(this,{Data:{value:e,writable:!1,enumerable:!0},Links:{value:t,writable:!1,enumerable:!0},_serializedSize:{value:r,writable:!0,enumerable:!1},_size:{value:null,writable:!0,enumerable:!1}})}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 <data: "'.concat(this.Data.toString("base64"),'", links: ').concat(this.Links.length,", size: ").concat(this.size,">")}_invalidateCached(){this._serializedSize=null,this._size=null}addLink(e){return this._invalidateCached(),u(this,e)}rmLink(e){return this._invalidateCached(),f(this,e)}toDAGLink(e){return c(this,e)}serialize(){return a(this)}get size(){return null===this._size&&(null===this._serializedSize&&(this._serializedSize=this.serialize().length),this._size=this.Links.reduce((e,t)=>e+t.Tsize,this._serializedSize)),this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}},{className:"DAGNode",symbolName:"@ipld/js-ipld-dag-pb/dagnode"})},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(226),s=(e,t)=>n.compare(e.nameAsBuffer,t.nameAsBuffer);e.exports=e=>{i.inplace(e,s)}},function(e,t,r){"use strict";const n=r(16)(r(291)),i=r(67);t=e.exports;const s=e=>{const t=e.Data,r=e.Links||[];return n.PBNode.encode((e=>{const t={};return e.Data&&e.Data.byteLength>0?t.Data=e.Data:t.Data=null,e.Links&&e.Links.length>0?t.Links=e.Links.map(e=>({Hash:e.Hash.buffer,Name:e.Name,Tsize:e.Tsize})):t.Links=null,t})({Data:t,Links:r}))};t.serializeDAGNode=s,t.serializeDAGNodeLike=(e,t=[])=>{const r={Data:e};return r.Links=t.map(e=>i.isDAGLink(e)?e:i.util.createDagLinkFromB58EncodedHash(e)),s(r)}},function(e,t,r){"use strict";e.exports="// An IPFS MerkleDAG Link\nmessage PBLink {\n\n // multihash of the target object\n optional bytes Hash = 1;\n\n // utf string name. should be unique per object\n optional string Name = 2;\n\n // cumulative size of target object\n optional uint64 Tsize = 3;\n}\n\n// An IPFS MerkleDAG Node\nmessage PBNode {\n\n // refs to other objects\n repeated PBLink Links = 2;\n\n // opaque user data\n optional bytes Data = 1;\n}"},function(e,t,r){"use strict";const n=r(4),i=r(11),s=r(22);(t=e.exports).codec=i.DAG_PB,t.defaultHashAlg=i.SHA2_256;t.cid=async(e,r)=>{const o={cidVersion:1,hashAlg:t.defaultHashAlg},a=Object.assign(o,r),c=await s(e,a.hashAlg),u=i.print[t.codec];return new n(a.cidVersion,u,c)}},function(e,t,r){"use strict";(e.exports=r(67)).util=r(677)},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(16)(r(291)),s=r(67),o=r(288),{serializeDAGNodeLike:a}=r(290),c=r(292);(t=e.exports).codec=c.codec,t.defaultHashAlg=c.defaultHashAlg;t.serialize=e=>o.isDAGNode(e)?e.serialize():a(e.Data,e.Links),t.deserialize=e=>{const t=i.PBNode.decode(e),r=t.Links.map(e=>new s(e.Name,e.Tsize,e.Hash)),a=null==t.Data?n.alloc(0):t.Data;return new o(a,r,e.length)},t.cid=(e,t)=>c.cid(e,t)},function(e,t,r){"use strict";const n=r(4),i=r(680),s=r(11);e.exports={codec:s.RAW,defaultHashAlg:s.SHA2_256,resolver:{resolve:(e,t)=>{if("/"!==t)throw new Error("Only the root path / may be resolved");return{value:e,remainderPath:""}},tree:e=>({done:!0})},util:{deserialize:e=>e,serialize:e=>e,cid:async(t,r)=>{const o={cidVersion:1,hashAlg:e.exports.defaultHashAlg},a=Object.assign(o,r),c=await i(t,a.hashAlg),u=s.print[e.exports.codec];return new n(a.cidVersion,u,c)}}}},function(e,t,r){"use strict";const n=r(139),{Buffer:i}=r(0),s=r(11),o=r(689),a=r(4),c=r(141);function u(e){let t;try{t=c(e)}catch(r){t=!1}if(t)throw new Error("The object passed has circular references");return function e(t){if(!t||t instanceof Uint8Array||"string"==typeof t)return t;if(Array.isArray(t))return t.map(e);if(a.isCID(t))return"string"==typeof(r=t)?r=new a(r).buffer:a.isCID(r)&&(r=r.buffer),new n.Tagged(42,i.concat([i.from("00","hex"),r]));var r;const s=Object.keys(t);if(s.length>0){const r={};return s.forEach(n=>{"object"==typeof t[n]?r[n]=e(t[n]):r[n]=t[n]}),r}return t}(e)}(t=e.exports).codec=s.DAG_CBOR,t.defaultHashAlg=s.SHA2_256;const f={42:e=>(e=e.slice(1),new a(e))};let h=65536;let l=67108864,d=null;t.configureDecoder=e=>{let t=f;e?("number"==typeof e.size&&(h=e.size),"number"==typeof e.maxSize&&(l=e.maxSize),e.tags&&(t=Object.assign({},f,e&&e.tags))):(h=65536,l=67108864);const r={tags:t,size:h};d=new n.Decoder(r),h=r.size},t.configureDecoder(),t.serialize=e=>{const t=u(e);return n.encode(t)},t.deserialize=e=>{if(e.length>h&&e.length<=l&&t.configureDecoder({size:e.length}),e.length>h)throw new Error("Data is too large to deserialize with current decoder");return d.decodeFirst(e)},t.cid=async(e,r)=>{const n={cidVersion:1,hashAlg:t.defaultHashAlg},i=Object.assign(n,r),c=await o(e,i.hashAlg),u=s.print[t.codec];return new a(i.cidVersion,u,c)}},function(e,t,r){"use strict";const n=r(15),i=(e,t)=>t,s={ip4:i,ip6:(e,t,r,n)=>1===n.length&&"ip6"===n[0].protocol?t:"[".concat(t,"]"),tcp:(e,t,r,n,i)=>n.some(e=>["http","https","ws","wss"].includes(e.protocol))?"".concat(e,":").concat(t):((e,t,r,n)=>{if(n&&!1===n.assumeHttp)return"tcp://".concat(e,":").concat(t);let i="tcp",s=":".concat(t);return"tcp"===r[r.length-1].protocol&&(i="443"===t?"https":"http",s="443"===t||"80"===t?"":s),"".concat(i,"://").concat(e).concat(s)})(e,t,n,i),udp:(e,t)=>"udp://".concat(e,":").concat(t),dnsaddr:i,dns4:i,dns6:i,ipfs:(e,t)=>"".concat(e,"/ipfs/").concat(t),p2p:(e,t)=>"".concat(e,"/p2p/").concat(t),http:e=>"http://".concat(e),https:e=>"https://".concat(e),ws:e=>"ws://".concat(e),wss:e=>"wss://".concat(e),"p2p-websocket-star":e=>"".concat(e,"/p2p-websocket-star"),"p2p-webrtc-star":e=>"".concat(e,"/p2p-webrtc-star"),"p2p-webrtc-direct":e=>"".concat(e,"/p2p-webrtc-direct")};e.exports=(e,t)=>{const r=n(e),i=e.toString().split("/").slice(1);return r.tuples().map(e=>({protocol:i.shift(),content:e[1]?i.shift():null})).reduce((e,r,n,i)=>{const o=s[r.protocol];if(!o)throw new Error("Unsupported protocol ".concat(r.protocol));return o(e,r.content,n,i,t)},"")}},function(e,t,r){"use strict";const{createFromPrivKey:n}=r(6),i=r(1),s=r(2),o=s("ipfs:ipns");o.error=s("ipfs:ipns:error");const a=r(698),c=r(709),u=r(710),{normalizePath:f}=r(3),h=r(249);e.exports=class{constructor(e,t,r,n,i){this.publisher=new a(e,t),this.republisher=new c(this.publisher,t,r,n,i),this.resolver=new u(e),this.cache=new h(1e3),this.routing=e}async publish(e,t,r=a.defaultRecordLifetime){try{t=f(t);const i=await n(e.bytes);await this.publisher.publishWithEOL(e,t,r),o("IPNS value ".concat(t," was published correctly"));const s=i.toB58String(),a=parseFloat(r),c=a<6e4?a:6e4;return this.cache.set(s,t,c),o("IPNS value ".concat(t," was cached correctly")),{name:s,value:t}}catch(i){throw o.error(i),i}}async resolve(e,t){if("string"!=typeof e)throw i(new Error("name received is not valid"),"ERR_INVALID_NAME");if(!(t=t||{}).nocache&&!t.recursive){const t=e.split("/")[2],r=this.cache.get(t);if(r)return r}try{const r=await this.resolver.resolve(e,t);return o("IPNS record from ".concat(e," was resolved correctly")),r}catch(r){throw o.error(r),r}}async initializeKeyspace(e,t){return this.publish(e,t,a.defaultRecordLifetime)}}},function(e,t,r){"use strict";const n=r(701),{encodeText:i,decodeText:s,concat:o}=r(164);function a(e){if(n.names[e])return n.names[e];if(n.codes[e])return n.codes[e];throw new Error("Unsupported encoding: ".concat(e))}(t=e.exports=function(e,t){if(!t)throw new Error("requires an encoded Uint8Array");const{name:r,codeBuf:n}=a(e);return function(e,t){a(e).decode(s(t))}(r,t),o([n,t],n.length+t.length)}).encode=function(e,t){const r=a(e),n=i(r.encode(t));return o([r.codeBuf,n],r.codeBuf.length+n.length)},t.decode=function(e){e instanceof Uint8Array&&(e=s(e));const t=e[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(t)&&(e=e.toLowerCase()),a(e[0]).decode(e.substring(1))},t.isEncoded=function(e){if(e instanceof Uint8Array&&(e=s(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return a(e[0]).name}catch(t){return!1}},t.encoding=a,t.encodingFromData=function(e){return e instanceof Uint8Array&&(e=s(e)),a(e[0])},t.names=Object.freeze(n.names),t.codes=Object.freeze(n.codes)},function(e,t,r){"use strict";const{Key:n}=r(7),{Record:i}=r(68),{Buffer:s}=r(0),{encodeBase32:o}=r(302),a=r(1),c=r(2),u=c("ipfs:ipns:offline-datastore");u.error=c("ipfs:ipns:offline-datastore:error");e.exports=class{constructor(e){this._repo=e}async put(e,t){if(!s.isBuffer(e))throw a(new Error("Offline datastore key must be a buffer"),"ERR_INVALID_KEY");if(!s.isBuffer(t))throw a(new Error("Offline datastore value must be a buffer"),"ERR_INVALID_VALUE");let r;try{r=this._routingKey(e)}catch(o){throw u.error(o),a(new Error("Not possible to generate the routing key"),"ERR_GENERATING_ROUTING_KEY")}const n=new i(e,t);return this._repo.datastore.put(r,n.serialize())}async get(e){if(!s.isBuffer(e))throw a(new Error("Offline datastore key must be a buffer"),"ERR_INVALID_KEY");let t;try{t=this._routingKey(e)}catch(o){throw u.error(o),a(new Error("Not possible to generate the routing key"),"ERR_GENERATING_ROUTING_KEY")}const r=await this._repo.datastore.get(t);let n;try{n=i.deserialize(r)}catch(o){throw u.error(o),o}return n.value}_routingKey(e){return new n("/"+o(e),!1)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(718),s=r(14),{names:o}=r(722),a={};for(const u in o)a[o[u]]=u;function c(e){t.decode(e)}t.names=o,t.codes=Object.freeze(a),t.toHexString=function(e){if(!n.isBuffer(e))throw new Error("must be passed a buffer");return e.toString("hex")},t.fromHexString=function(e){return n.from(e,"hex")},t.toB58String=function(e){if(!n.isBuffer(e))throw new Error("must be passed a buffer");return i.encode("base58btc",e).toString().slice(1)},t.fromB58String=function(e){let t=e;return n.isBuffer(e)&&(t=e.toString()),i.decode("z"+t)},t.decode=function(e){if(!n.isBuffer(e))throw new Error("multihash must be a Buffer");if(e.length<2)throw new Error("multihash too short. must be > 2 bytes.");const r=s.decode(e);if(!t.isValidCode(r))throw new Error("multihash unknown function code: 0x".concat(r.toString(16)));e=e.slice(s.decode.bytes);const i=s.decode(e);if(i<0)throw new Error("multihash invalid length: ".concat(i));if((e=e.slice(s.decode.bytes)).length!==i)throw new Error("multihash length inconsistent: 0x".concat(e.toString("hex")));return{code:r,name:a[r],length:i,digest:e}},t.encode=function(e,r,i){if(!e||void 0===r)throw new Error("multihash encode requires at least two args: digest, code");const o=t.coerceCode(r);if(!n.isBuffer(e))throw new Error("digest should be a Buffer");if(null==i&&(i=e.length),i&&e.length!==i)throw new Error("digest length should be equal to specified length.");return n.concat([n.from(s.encode(o)),n.from(s.encode(i)),e])},t.coerceCode=function(e){let r=e;if("string"==typeof e){if(void 0===o[e])throw new Error("Unrecognized hash function named: ".concat(e));r=o[e]}if("number"!=typeof r)throw new Error("Hash function code should be a number. Got: ".concat(r));if(void 0===a[r]&&!t.isAppCode(r))throw new Error("Unrecognized function code: ".concat(r));return r},t.isAppCode=function(e){return e>0&&e<16},t.isValidCode=function(e){return!!t.isAppCode(e)||!!a[e]},t.validate=c,t.prefix=function(e){return c(e),e.slice(0,2)}},function(e,t,r){"use strict";const n=r(27),i=r(80);e.exports={encodeBase32:e=>n.encode("base32",e).slice(1).toString().toUpperCase(),validator:{func:(e,t,r)=>i.validator.validate(t,e,r)},selector:(e,t)=>i.validator.select(t[0],t[1])}},function(e,t,r){"use strict";var n=Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]},i=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},o=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{c(n.next(e))}catch(t){s(t)}}function a(e){try{c(n.throw(e))}catch(t){s(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};const a=r(166),c=r(756),u=r(307),f=s(r(169)),h=r(758),l=r(308),d=r(170),p=r(761),b=r(763);class y extends b{constructor(e,t,r={}){const n=[f.GossipsubID],i=Object.assign({gossipIncoming:!0,fallbackToFloodsub:!0},r);i.fallbackToFloodsub&&n.push(f.FloodSubID),super({debugName:"libp2p:gossipsub",multicodecs:n,peerId:e,registrar:t,options:i}),this.seenCache=new p,this.mesh=new Map,this.fanout=new Map,this.lastpub=new Map,this.gossip=new Map,this.control=new Map,this._msgIdFn=r.msgIdFn||this.defaultMsgIdFn,this.messageCache=r.messageCache||new c.MessageCache(f.GossipsubHistoryGossip,f.GossipsubHistoryLength,this._msgIdFn),this.heartbeat=new h.Heartbeat(this)}_removePeer(e){super._removePeer(e);for(const t of this.mesh.values())t.delete(e);for(const t of this.fanout.values())t.delete(e);return this.gossip.delete(e),this.control.delete(e),e}_processRpc(e,t,r){super._processRpc(e,t,r),r.control&&this._processRpcControlMessage(t,r.control)}_processRpcControlMessage(e,t){if(!t)return;const r=this._handleIHave(e,t.ihave),n=this._handleIWant(e,t.iwant),i=this._handleGraft(e,t.graft);if(this._handlePrune(e,t.prune),!r||!n||!i)return;const s=d.createGossipRpc(n,{iwant:[r],prune:i});this._sendRpc(e,s)}_processRpcMessage(e,t){const r=this.getMsgId(t);if(this.seenCache.has(r))return;this.seenCache.put(r),super._processRpcMessage(e,t);const n=t.topicIDs;this._options.gossipIncoming&&(this.peers.forEach(e=>{e.protocols.includes(f.FloodSubID)&&e.id.toB58String()!==t.from&&a.utils.anyMatch(e.topics,n)&&e.isWritable&&(e.sendMessages(a.utils.normalizeOutRpcMessages([t])),this.log("publish msg on topics - floodsub",n,e.id.toB58String()))}),n.forEach(e=>{const r=this.mesh.get(e);r&&r.forEach(r=>{r.isWritable&&r.id.toB58String()!==t.from&&(r.sendMessages(a.utils.normalizeOutRpcMessages([t])),this.log("publish msg on topic - meshsub",e,r.id.toB58String()))})}))}_handleIHave(e,t){const r=new Set;if(t.forEach(({topicID:e,messageIDs:t})=>{e&&this.mesh.has(e)&&t.forEach(e=>{this.seenCache.has(e)||r.add(e)})}),r.size)return this.log("IHAVE: Asking for %d messages from %s",r.size,e.id.toB58String()),{messageIDs:Array.from(r)}}_handleIWant(e,t){const r=new Map;if(t.forEach(({messageIDs:e})=>{e.forEach(e=>{const t=this.messageCache.get(e);t&&r.set(e,t)})}),r.size)return this.log("IWANT: Sending %d messages to %s",r.size,e.id.toB58String()),Array.from(r.values())}_handleGraft(e,t){const r=[];if(t.forEach(({topicID:t})=>{if(!t)return;const n=this.mesh.get(t);n?(this.log("GRAFT: Add mesh link from %s in %s",e.id.toB58String(),t),n.add(e),e.topics.add(t),this.mesh.set(t,n)):r.push(t)}),!r.length)return;return r.map(e=>({topicID:e}))}_handlePrune(e,t){t.forEach(({topicID:t})=>{if(!t)return;const r=this.mesh.get(t);r&&(this.log("PRUNE: Remove mesh link to %s in %s",e.id.toB58String(),t),r.delete(e),e.topics.delete(t))})}start(){const e=Object.create(null,{start:{get:()=>super.start}});return o(this,void 0,void 0,(function*(){yield e.start.call(this),this.heartbeat.start()}))}stop(){const e=Object.create(null,{stop:{get:()=>super.stop}});return o(this,void 0,void 0,(function*(){yield e.stop.call(this),this.heartbeat.stop(),this.mesh=new Map,this.fanout=new Map,this.lastpub=new Map,this.gossip=new Map,this.control=new Map}))}_subscribe(e){super._subscribe(e),this.join(e)}_unsubscribe(e){super._unsubscribe(e),this.leave(e)}join(e){if(!this.started)throw new Error("Gossipsub has not started");e=a.utils.ensureArray(e),this.log("JOIN %s",e),e.forEach(e=>{const t=this.fanout.get(e);if(t)this.mesh.set(e,t),this.fanout.delete(e),this.lastpub.delete(e);else{const t=l.getGossipPeers(this,e,f.GossipsubD);this.mesh.set(e,t)}this.mesh.get(e).forEach(t=>{this.log("JOIN: Add mesh link to %s in %s",t.id.toB58String(),e),this._sendGraft(t,e)})})}leave(e){e=a.utils.ensureArray(e),this.log("LEAVE %s",e),e.forEach(e=>{const t=this.mesh.get(e);t&&(t.forEach(t=>{this.log("LEAVE: Remove mesh link to %s in %s",t.id.toB58String(),e),this._sendPrune(t,e)}),this.mesh.delete(e))})}getMsgId(e){return this._msgIdFn(e)}_publish(e){e.forEach(e=>{const t=this.getMsgId(e);this.seenCache.put(t),this.messageCache.put(e);const r=new Set;e.topicIDs.forEach(e=>{const t=this.topics.get(e);if(!t)return;t.forEach(e=>{e.protocols.includes(f.FloodSubID)&&r.add(e)});let n=this.mesh.get(e);if(!n||!n.size){if(n=this.fanout.get(e),!n){const t=l.getGossipPeers(this,e,f.GossipsubD);t.size>0?(n=t,this.fanout.set(e,t)):n=new Set}this.lastpub.set(e,this._now())}n.forEach(e=>{r.add(e)})}),r.forEach(t=>{t.id.toB58String()!==e.from&&this._sendRpc(t,d.createGossipRpc([a.utils.normalizeOutRpcMessage(e)]))})})}_sendGraft(e,t){const r=[{topicID:t}],n=d.createGossipRpc([],{graft:r});this._sendRpc(e,n)}_sendPrune(e,t){const r=[{topicID:t}],n=d.createGossipRpc([],{prune:r});this._sendRpc(e,n)}_sendRpc(e,t){if(!e||!e.isWritable)return;const r=this.control.get(e);r&&(this._piggybackControl(e,t,r),this.control.delete(e));const n=this.gossip.get(e);n&&(this._piggybackGossip(e,t,n),this.gossip.delete(e)),e.write(u.RPCCodec.encode(t))}_piggybackControl(e,t,r){const n=(r.graft||[]).filter(({topicID:t})=>(t&&this.mesh.get(t)||new Set).has(e)),i=(r.prune||[]).filter(({topicID:t})=>!(t&&this.mesh.get(t)||new Set).has(e));(n.length||i.length)&&(t.control?(t.control.graft=t.control.graft.concat(n),t.control.prune=t.control.prune.concat(i)):t.control={ihave:[],iwant:[],graft:n,prune:i})}_piggybackGossip(e,t,r){t.control||(t.control={ihave:[],iwant:[],graft:[],prune:[]}),t.control.ihave=r}_sendGraftPrune(e,t){for(const[r,n]of e){const e=n.map(e=>({topicID:e}));let i=[];const s=t.get(r);s&&(i=s.map(e=>({topicID:e})),t.delete(r));const o=d.createGossipRpc([],{graft:e,prune:i});this._sendRpc(r,o)}for(const[r,n]of t){const e=n.map(e=>({topicID:e})),t=d.createGossipRpc([],{prune:e});this._sendRpc(r,t)}}_emitGossip(e,t){const r=this.messageCache.getGossipIDs(e);if(!r.length)return;l.getGossipPeers(this,e,f.GossipsubD).forEach(n=>{t.has(n)||this._pushGossip(n,{topicID:e,messageIDs:r})})}_flush(){for(const[e,t]of this.gossip.entries()){this.gossip.delete(e);const r=d.createGossipRpc([],{ihave:t});this._sendRpc(e,r)}for(const[e,t]of this.control.entries()){this.control.delete(e);const r=d.createGossipRpc([],{graft:t.graft,prune:t.prune});this._sendRpc(e,r)}}_pushGossip(e,t){this.log("Add gossip to %s",e.id.toB58String());const r=this.gossip.get(e)||[];this.gossip.set(e,r.concat(t))}_now(){return Date.now()}}y.multicodec=f.GossipsubID,e.exports=y},function(e,t,r){"use strict";const n=r(21),i=()=>{};e.exports=n(class{constructor({min:e=0,max:t=1/0,handlers:r={}}){this.min=e,this.max=t,this._onConnect=r.onConnect||i,this._onDisconnect=r.onDisconnect||i,this.peers=new Set}set registrar(e){this._registrar=e}disconnect(e){this._onDisconnect(e)}},{className:"Topology",symbolName:"@libp2p/js-interfaces/topology"})},function(e,t,r){"use strict";const n=r(14),{Buffer:i}=r(0),s=(e,t,r)=>{const o=n.encode(e,t,r);return s.bytes=n.encode.bytes,t||i.from(o)};e.exports=s},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(14),s=e=>{const t=i.decode(n.isBuffer(e)?e:(r=e,new Proxy({},{get:(e,t)=>"l"===t[0]?r[t]:r.get(parseInt(t))})));var r;return s.bytes=i.decode.bytes,t};e.exports=s},function(e,t,r){"use strict";var n=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RPCCodec=void 0;const i=n(r(757)),s=r(16)(i.default);t.RPCCodec=s.RPC},function(e,t,r){"use strict";var n=Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]},i=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getGossipPeers=void 0;const o=s(r(169)),a=r(170);t.getGossipPeers=function(e,t,r){const n=e.topics.get(t);if(!n)return new Set;let i=[];return n.forEach(e=>{e.protocols.includes(o.GossipsubID)&&i.push(e)}),i=a.shuffle(i),r>0&&i.length>r&&(i=i.slice(0,r)),new Set(i)}},function(e,t,r){"use strict";const n=r(764),i=r(765);class s extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got ".concat(typeof e));let t=(e=[...e].map(e=>e instanceof Error?e:null!==e&&"object"==typeof e?Object.assign(new Error(e.message),e):new Error(e))).map(e=>"string"==typeof e.stack?i(e.stack).replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,""):String(e)).join("\n");t="\n"+n(t,4),super(t),this.name="AggregateError",Object.defineProperty(this,"_errors",{value:e})}*[Symbol.iterator](){for(const e of this._errors)yield e}}e.exports=s},function(e,t,r){"use strict";const n=r(6),i=r(15),s=r(1),{codes:o}=r(20);e.exports=function(e){let t;if("string"==typeof e&&(e=i(e)),i.isMultiaddr(e)){t=e;try{e=n.createFromB58String(e.getPeerId())}catch(r){throw s(new Error("".concat(e," is not a valid peer type")),o.ERR_INVALID_MULTIADDR)}}return{id:e,multiaddrs:t?[t]:void 0}}},function(e,t,r){"use strict";const n=r(775),{codes:i}=r(20),s=r(1),o=r(2),a=o("libp2p:transports");a.error=o("libp2p:transports:error");class c{constructor({libp2p:e,upgrader:t,faultTolerance:r=u.FATAL_ALL}){this.libp2p=e,this.upgrader=t,this._transports=new Map,this._listeners=new Map,this.faultTolerance=r}add(e,t,r={}){if(a("adding %s",e),!e)throw s(new Error("Transport must have a valid key, was given '".concat(e,"'")),i.ERR_INVALID_KEY);if(this._transports.has(e))throw s(new Error("There is already a transport with this key"),i.ERR_DUPLICATE_TRANSPORT);const n=new t({...r,libp2p:this.libp2p,upgrader:this.upgrader});this._transports.set(e,n),this._listeners.has(e)||this._listeners.set(e,[])}async close(){const e=[];for(const[t,r]of this._listeners)for(a("closing listeners for %s",t);r.length;){const t=r.pop();e.push(t.close())}await Promise.all(e),a("all listeners closed");for(const t of this._listeners.keys())this._listeners.set(t,[])}async dial(e,t){const r=this.transportForMultiaddr(e);if(!r)throw s(new Error("No transport available for address ".concat(String(e))),i.ERR_TRANSPORT_UNAVAILABLE);try{return await r.dial(e,t)}catch(n){throw n.code||(n.code=i.ERR_TRANSPORT_DIAL_FAILED),n}}getAddrs(){let e=[];for(const t of this._listeners.values())for(const r of t)e=[...e,...r.getAddrs()];return e}getTransports(){return this._transports.values()}transportForMultiaddr(e){for(const t of this._transports.values()){if(t.filter([e]).length)return t}return null}async listen(){const e=this.libp2p.addressManager.getListenAddrs();if(0===e.length)return void a("no addresses were provided for listening, this node is dial only");const t=[];for(const[r,o]of this._transports.entries()){const c=o.filter(e),u=[];for(const e of c){a("creating listener for %s on %s",r,e);const t=o.createListener({},this.onConnection);this._listeners.get(r).push(t),u.push(t.listen(e))}if(0===u.length){t.push(r);continue}if(!(await n(u)).find(e=>!0===e.isFulfilled))throw s(new Error("Transport (".concat(r,") could not listen on any available address")),i.ERR_NO_VALID_ADDRESSES)}if(t.length===this._transports.size){const e="no valid addresses were provided for transports [".concat(t,"]");if(this.faultTolerance===u.FATAL_ALL)throw s(new Error(e),i.ERR_NO_VALID_ADDRESSES);a("libp2p in dial mode only: ".concat(e))}}async remove(e){if(a("removing %s",e),this._listeners.has(e))for(const t of this._listeners.get(e))await t.close();this._transports.delete(e),this._listeners.delete(e)}async removeAll(){const e=[];for(const t of this._transports.keys())e.push(this.remove(t));await Promise.all(e)}}const u={FATAL_ALL:0,NO_FATAL:1};c.FaultTolerance=u,e.exports=c},function(e,t,r){"use strict";const n=r(15),{CircuitRelay:i}=r(81);function s(e,t){e.write({type:i.Type.STATUS,code:t})}e.exports={validateAddrs:function(e,t){try{e.dstPeer.addrs.forEach(e=>n(e))}catch(r){throw s(t,e.type===i.Type.HOP?i.Status.HOP_DST_MULTIADDR_INVALID:i.Status.STOP_DST_MULTIADDR_INVALID),r}try{e.srcPeer.addrs.forEach(e=>n(e))}catch(r){throw s(t,e.type===i.Type.HOP?i.Status.HOP_SRC_MULTIADDR_INVALID:i.Status.STOP_SRC_MULTIADDR_INVALID),r}}}},function(e,t,r){"use strict";const n=r(30);e.exports=e=>{const t=async function*(){let t=yield,r=new n;for await(const i of e)if(t)for(r.append(i);r.length>=t;){const e=r.shallowSlice(0,t);if(r.consume(t),t=yield e,!t){r.length&&(t=yield r,r=new n);break}}else t=yield r.append(i),r=new n;if(t)throw Object.assign(new Error("stream ended before ".concat(t," bytes became available")),{code:"ERR_UNDER_READ",buffer:r})}();return t.next(),t}},function(e,t,r){"use strict";const{CircuitRelay:n}=r(81),i=r(174),s=r(175),{validateAddrs:o}=r(312),a=r(2),c=a("libp2p:circuit:stop");c.error=a("libp2p:circuit:stop:error"),e.exports.handleStop=function({connection:e,request:t,streamHandler:r}){try{o(t,r)}catch(i){return c.error("invalid stop request via peer %s",e.remotePeer.toB58String(),i)}return c("stop request is valid"),r.write({type:n.Type.STATUS,code:n.Status.SUCCESS}),r.rest()},e.exports.stop=async function({connection:e,request:t}){const{stream:r}=await e.newStream([i.relay]);c("starting stop request to %s",e.remotePeer.toB58String());const o=new s({stream:r});o.write(t);const a=await o.read();if(a.code===n.Status.SUCCESS)return c("stop request to %s was successful",e.remotePeer.toB58String()),o.rest();c("stop request failed with code %d",a.code),o.close()}},function(e,t,r){"use strict";var n=r(5);r(73),r(43),r(118),r(46),r(799),r(72),r(120),r(801),r(90),r(9);var i=n.asn1,s=e.exports=n.pki=n.pki||{},o=s.oids,a={};a.CN=o.commonName,a.commonName="CN",a.C=o.countryName,a.countryName="C",a.L=o.localityName,a.localityName="L",a.ST=o.stateOrProvinceName,a.stateOrProvinceName="ST",a.O=o.organizationName,a.organizationName="O",a.OU=o.organizationalUnitName,a.organizationalUnitName="OU",a.E=o.emailAddress,a.emailAddress="E";var c=n.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"},c,{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"}]},f={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"},c,{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}]}]}]},l={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 d(e,t){"string"==typeof t&&(t={shortName:t});for(var r,n=null,i=0;null===n&&i<e.attributes.length;++i)r=e.attributes[i],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(n=r);return n}s.RDNAttributesAsArray=function(e,t){for(var r,n,s,c=[],u=0;u<e.value.length;++u){r=e.value[u];for(var f=0;f<r.value.length;++f)s={},n=r.value[f],s.type=i.derToOid(n.value[0].value),s.value=n.value[1].value,s.valueTagClass=n.value[1].type,s.type in o&&(s.name=o[s.type],s.name in a&&(s.shortName=a[s.name])),t&&(t.update(s.type),t.update(s.value)),c.push(s)}return c},s.CRIAttributesAsArray=function(e){for(var t=[],r=0;r<e.length;++r)for(var n=e[r],c=i.derToOid(n.value[0].value),u=n.value[1].value,f=0;f<u.length;++f){var h={};if(h.type=c,h.value=u[f].value,h.valueTagClass=u[f].type,h.type in o&&(h.name=o[h.type],h.name in a&&(h.shortName=a[h.name])),h.type===o.extensionRequest){h.extensions=[];for(var l=0;l<h.value.length;++l)h.extensions.push(s.certificateExtensionFromAsn1(h.value[l]))}t.push(h)}return t};var p=function(e,t,r){var n={};if(e!==o["RSASSA-PSS"])return n;r&&(n={hash:{algorithmOid:o.sha1},mgf:{algorithmOid:o.mgf1,hash:{algorithmOid:o.sha1}},saltLength:20});var s={},a=[];if(!i.validate(t,f,s,a)){var c=new Error("Cannot read RSASSA-PSS parameter block.");throw c.errors=a,c}return void 0!==s.hashOid&&(n.hash=n.hash||{},n.hash.algorithmOid=i.derToOid(s.hashOid)),void 0!==s.maskGenOid&&(n.mgf=n.mgf||{},n.mgf.algorithmOid=i.derToOid(s.maskGenOid),n.mgf.hash=n.mgf.hash||{},n.mgf.hash.algorithmOid=i.derToOid(s.maskGenHashOid)),void 0!==s.saltLength&&(n.saltLength=s.saltLength.charCodeAt(0)),n};function b(e){for(var t,r,s=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),o=e.attributes,a=0;a<o.length;++a){var c=(t=o[a]).value,u=i.Type.PRINTABLESTRING;"valueTagClass"in t&&(u=t.valueTagClass)===i.Type.UTF8&&(c=n.util.encodeUtf8(c)),r=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.type).getBytes()),i.create(i.Class.UNIVERSAL,u,!1,c)])]),s.value.push(r)}return s}function y(e){for(var t,r=0;r<e.length;++r){if(void 0===(t=e[r]).name&&(t.type&&t.type in s.oids?t.name=s.oids[t.type]:t.shortName&&t.shortName in a&&(t.name=s.oids[a[t.shortName]])),void 0===t.type){if(!t.name||!(t.name in s.oids))throw(c=new Error("Attribute type not specified.")).attribute=t,c;t.type=s.oids[t.name]}if(void 0===t.shortName&&t.name&&t.name in a&&(t.shortName=a[t.name]),t.type===o.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=i.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var n=0;n<t.extensions.length;++n)t.value.push(s.certificateExtensionToAsn1(m(t.extensions[n])))}var c;if(void 0===t.value)throw(c=new Error("Attribute value not specified.")).attribute=t,c}}function m(e,t){if(t=t||{},void 0===e.name&&e.id&&e.id in s.oids&&(e.name=s.oids[e.id]),void 0===e.id){if(!e.name||!(e.name in s.oids))throw(_=new Error("Extension ID not specified.")).extension=e,_;e.id=s.oids[e.name]}if(void 0!==e.value)return e;if("keyUsage"===e.name){var r=0,a=0,c=0;e.digitalSignature&&(a|=128,r=7),e.nonRepudiation&&(a|=64,r=6),e.keyEncipherment&&(a|=32,r=5),e.dataEncipherment&&(a|=16,r=4),e.keyAgreement&&(a|=8,r=3),e.keyCertSign&&(a|=4,r=2),e.cRLSign&&(a|=2,r=1),e.encipherOnly&&(a|=1,r=0),e.decipherOnly&&(c|=128,r=7);var u=String.fromCharCode(r);0!==c?u+=String.fromCharCode(a)+String.fromCharCode(c):0!==a&&(u+=String.fromCharCode(a)),e.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,u)}else if("basicConstraints"===e.name)e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(i.create(i.Class.UNIVERSAL,i.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.pathLenConstraint).getBytes()));else if("extKeyUsage"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);var f=e.value.value;for(var h in e)!0===e[h]&&(h in o?f.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o[h]).getBytes())):-1!==h.indexOf(".")&&f.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(h).getBytes())))}else if("nsCertType"===e.name){r=0,a=0;e.client&&(a|=128,r=7),e.server&&(a|=64,r=6),e.email&&(a|=32,r=5),e.objsign&&(a|=16,r=4),e.reserved&&(a|=8,r=3),e.sslCA&&(a|=4,r=2),e.emailCA&&(a|=2,r=1),e.objCA&&(a|=1,r=0);u=String.fromCharCode(r);0!==a&&(u+=String.fromCharCode(a)),e.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,u)}else if("subjectAltName"===e.name||"issuerAltName"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);for(var l=0;l<e.altNames.length;++l){u=(g=e.altNames[l]).value;if(7===g.type&&g.ip){if(null===(u=n.util.bytesFromIP(g.ip)))throw(_=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,_}else 8===g.type&&(u=g.oid?i.oidToDer(i.oidToDer(g.oid)):i.oidToDer(u));e.value.value.push(i.create(i.Class.CONTEXT_SPECIFIC,g.type,!1,u))}}else if("nsComment"===e.name&&t.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=i.create(i.Class.UNIVERSAL,i.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var d=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=d.toHex(),e.value=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,d.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);f=e.value.value;if(e.keyIdentifier){var p=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;f.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!1,p))}if(e.authorityCertIssuer){var y=[i.create(i.Class.CONTEXT_SPECIFIC,4,!0,[b(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];f.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,y))}if(e.serialNumber){var m=n.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);f.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!1,m))}}else if("cRLDistributionPoints"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);f=e.value.value;var g,v=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),w=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(l=0;l<e.altNames.length;++l){u=(g=e.altNames[l]).value;if(7===g.type&&g.ip){if(null===(u=n.util.bytesFromIP(g.ip)))throw(_=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,_}else 8===g.type&&(u=g.oid?i.oidToDer(i.oidToDer(g.oid)):i.oidToDer(u));w.value.push(i.create(i.Class.CONTEXT_SPECIFIC,g.type,!1,u))}v.value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[w])),f.push(v)}var _;if(void 0===e.value)throw(_=new Error("Extension value not specified.")).extension=e,_;return e}function g(e,t){switch(e){case o["RSASSA-PSS"]:var r=[];return void 0!==t.hash.algorithmOid&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.hash.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])])),void 0!==t.mgf.algorithmOid&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.mgf.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.mgf.hash.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])])])),void 0!==t.saltLength&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(t.saltLength).getBytes())])),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,r);default:return i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")}}function v(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===e.attributes.length)return t;for(var r=e.attributes,s=0;s<r.length;++s){var o=r[s],a=o.value,c=i.Type.UTF8;"valueTagClass"in o&&(c=o.valueTagClass),c===i.Type.UTF8&&(a=n.util.encodeUtf8(a));var u=!1;"valueConstructed"in o&&(u=o.valueConstructed);var f=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.type).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,c,u,a)])]);t.value.push(f)}return t}s.certificateFromPem=function(e,t,r){var o=n.pem.decode(e)[0];if("CERTIFICATE"!==o.type&&"X509 CERTIFICATE"!==o.type&&"TRUSTED CERTIFICATE"!==o.type){var a=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw a.headerType=o.type,a}if(o.procType&&"ENCRYPTED"===o.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var c=i.fromDer(o.body,r);return s.certificateFromAsn1(c,t)},s.certificateToPem=function(e,t){var r={type:"CERTIFICATE",body:i.toDer(s.certificateToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},s.publicKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("PUBLIC KEY"!==t.type&&"RSA PUBLIC KEY"!==t.type){var r=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var o=i.fromDer(t.body);return s.publicKeyFromAsn1(o)},s.publicKeyToPem=function(e,t){var r={type:"PUBLIC KEY",body:i.toDer(s.publicKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},s.publicKeyToRSAPublicKeyPem=function(e,t){var r={type:"RSA PUBLIC KEY",body:i.toDer(s.publicKeyToRSAPublicKey(e)).getBytes()};return n.pem.encode(r,{maxline:t})},s.getPublicKeyFingerprint=function(e,t){var r,o=(t=t||{}).md||n.md.sha1.create();switch(t.type||"RSAPublicKey"){case"RSAPublicKey":r=i.toDer(s.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":r=i.toDer(s.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}o.start(),o.update(r);var a=o.digest();if("hex"===t.encoding){var c=a.toHex();return t.delimiter?c.match(/.{2}/g).join(t.delimiter):c}if("binary"===t.encoding)return a.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return a},s.certificationRequestFromPem=function(e,t,r){var o=n.pem.decode(e)[0];if("CERTIFICATE REQUEST"!==o.type){var a=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw a.headerType=o.type,a}if(o.procType&&"ENCRYPTED"===o.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var c=i.fromDer(o.body,r);return s.certificationRequestFromAsn1(c,t)},s.certificationRequestToPem=function(e,t){var r={type:"CERTIFICATE REQUEST",body:i.toDer(s.certificationRequestToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},s.createCertificate=function(){var e={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return d(e.issuer,t)},e.issuer.addField=function(t){y([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return d(e.subject,t)},e.subject.addField=function(t){y([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,r){y(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){y(t),e.issuer.attributes=t,delete e.issuer.uniqueId,r&&(e.issuer.uniqueId=r),e.issuer.hash=null},e.setExtensions=function(t){for(var r=0;r<t.length;++r)m(t[r],{cert:e});e.extensions=t},e.getExtension=function(t){"string"==typeof t&&(t={name:t});for(var r,n=null,i=0;null===n&&i<e.extensions.length;++i)r=e.extensions[i],(t.id&&r.id===t.id||t.name&&r.name===t.name)&&(n=r);return n},e.sign=function(t,r){e.md=r||n.md.sha1.create();var a=o[e.md.algorithm+"WithRSAEncryption"];if(!a){var c=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw c.algorithm=e.md.algorithm,c}e.signatureOid=e.siginfo.algorithmOid=a,e.tbsCertificate=s.getTBSCertificate(e);var u=i.toDer(e.tbsCertificate);e.md.update(u.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var r=!1;if(!e.issued(t)){var a=t.issuer,c=e.subject;throw(b=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.")).expectedIssuer=a.attributes,b.actualIssuer=c.attributes,b}var u=t.md;if(null===u){if(t.signatureOid in o)switch(o[t.signatureOid]){case"sha1WithRSAEncryption":u=n.md.sha1.create();break;case"md5WithRSAEncryption":u=n.md.md5.create();break;case"sha256WithRSAEncryption":u=n.md.sha256.create();break;case"sha384WithRSAEncryption":u=n.md.sha384.create();break;case"sha512WithRSAEncryption":u=n.md.sha512.create();break;case"RSASSA-PSS":u=n.md.sha256.create()}if(null===u)throw(b=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=t.signatureOid,b;var f=t.tbsCertificate||s.getTBSCertificate(t),h=i.toDer(f);u.update(h.getBytes())}if(null!==u){var l;switch(t.signatureOid){case o.sha1WithRSAEncryption:l=void 0;break;case o["RSASSA-PSS"]:var d,p,b;if(void 0===(d=o[t.signatureParameters.mgf.hash.algorithmOid])||void 0===n.md[d])throw(b=new Error("Unsupported MGF hash function.")).oid=t.signatureParameters.mgf.hash.algorithmOid,b.name=d,b;if(void 0===(p=o[t.signatureParameters.mgf.algorithmOid])||void 0===n.mgf[p])throw(b=new Error("Unsupported MGF function.")).oid=t.signatureParameters.mgf.algorithmOid,b.name=p,b;if(p=n.mgf[p].create(n.md[d].create()),void 0===(d=o[t.signatureParameters.hash.algorithmOid])||void 0===n.md[d])throw{message:"Unsupported RSASSA-PSS hash function.",oid:t.signatureParameters.hash.algorithmOid,name:d};l=n.pss.create(n.md[d].create(),p,t.signatureParameters.saltLength)}r=e.publicKey.verify(u.digest().getBytes(),t.signature,l)}return r},e.isIssuer=function(t){var r=!1,n=e.issuer,i=t.subject;if(n.hash&&i.hash)r=n.hash===i.hash;else if(n.attributes.length===i.attributes.length){var s,o;r=!0;for(var a=0;r&&a<n.attributes.length;++a)s=n.attributes[a],o=i.attributes[a],s.type===o.type&&s.value===o.value||(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return s.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=o.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var i=e.extensions[r];if(i.id===t){var s=e.generateSubjectKeyIdentifier().getBytes();return n.util.hexToBytes(i.subjectKeyIdentifier)===s}}return!1},e},s.certificateFromAsn1=function(e,t){var r={},a=[];if(!i.validate(e,u,r,a))throw(l=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.")).errors=a,l;if(i.derToOid(r.publicKeyOid)!==s.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=s.createCertificate();c.version=r.certVersion?r.certVersion.charCodeAt(0):0;var f=n.util.createBuffer(r.certSerialNumber);c.serialNumber=f.toHex(),c.signatureOid=n.asn1.derToOid(r.certSignatureOid),c.signatureParameters=p(c.signatureOid,r.certSignatureParams,!0),c.siginfo.algorithmOid=n.asn1.derToOid(r.certinfoSignatureOid),c.siginfo.parameters=p(c.siginfo.algorithmOid,r.certinfoSignatureParams,!1),c.signature=r.certSignature;var h=[];if(void 0!==r.certValidity1UTCTime&&h.push(i.utcTimeToDate(r.certValidity1UTCTime)),void 0!==r.certValidity2GeneralizedTime&&h.push(i.generalizedTimeToDate(r.certValidity2GeneralizedTime)),void 0!==r.certValidity3UTCTime&&h.push(i.utcTimeToDate(r.certValidity3UTCTime)),void 0!==r.certValidity4GeneralizedTime&&h.push(i.generalizedTimeToDate(r.certValidity4GeneralizedTime)),h.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(h.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=h[0],c.validity.notAfter=h[1],c.tbsCertificate=r.tbsCertificate,t){var l;if(c.md=null,c.signatureOid in o)switch(o[c.signatureOid]){case"sha1WithRSAEncryption":c.md=n.md.sha1.create();break;case"md5WithRSAEncryption":c.md=n.md.md5.create();break;case"sha256WithRSAEncryption":c.md=n.md.sha256.create();break;case"sha384WithRSAEncryption":c.md=n.md.sha384.create();break;case"sha512WithRSAEncryption":c.md=n.md.sha512.create();break;case"RSASSA-PSS":c.md=n.md.sha256.create()}if(null===c.md)throw(l=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=c.signatureOid,l;var b=i.toDer(c.tbsCertificate);c.md.update(b.getBytes())}var m=n.md.sha1.create();c.issuer.getField=function(e){return d(c.issuer,e)},c.issuer.addField=function(e){y([e]),c.issuer.attributes.push(e)},c.issuer.attributes=s.RDNAttributesAsArray(r.certIssuer,m),r.certIssuerUniqueId&&(c.issuer.uniqueId=r.certIssuerUniqueId),c.issuer.hash=m.digest().toHex();var g=n.md.sha1.create();return c.subject.getField=function(e){return d(c.subject,e)},c.subject.addField=function(e){y([e]),c.subject.attributes.push(e)},c.subject.attributes=s.RDNAttributesAsArray(r.certSubject,g),r.certSubjectUniqueId&&(c.subject.uniqueId=r.certSubjectUniqueId),c.subject.hash=g.digest().toHex(),r.certExtensions?c.extensions=s.certificateExtensionsFromAsn1(r.certExtensions):c.extensions=[],c.publicKey=s.publicKeyFromAsn1(r.subjectPublicKeyInfo),c},s.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r<e.value.length;++r)for(var n=e.value[r],i=0;i<n.value.length;++i)t.push(s.certificateExtensionFromAsn1(n.value[i]));return t},s.certificateExtensionFromAsn1=function(e){var t={};if(t.id=i.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===i.Type.BOOLEAN?(t.critical=0!==e.value[1].value.charCodeAt(0),t.value=e.value[2].value):t.value=e.value[1].value,t.id in o)if(t.name=o[t.id],"keyUsage"===t.name){var r=0,s=0;(c=i.fromDer(t.value)).value.length>1&&(r=c.value.charCodeAt(1),s=c.value.length>2?c.value.charCodeAt(2):0),t.digitalSignature=128==(128&r),t.nonRepudiation=64==(64&r),t.keyEncipherment=32==(32&r),t.dataEncipherment=16==(16&r),t.keyAgreement=8==(8&r),t.keyCertSign=4==(4&r),t.cRLSign=2==(2&r),t.encipherOnly=1==(1&r),t.decipherOnly=128==(128&s)}else if("basicConstraints"===t.name){(c=i.fromDer(t.value)).value.length>0&&c.value[0].type===i.Type.BOOLEAN?t.cA=0!==c.value[0].value.charCodeAt(0):t.cA=!1;var a=null;c.value.length>0&&c.value[0].type===i.Type.INTEGER?a=c.value[0].value:c.value.length>1&&(a=c.value[1].value),null!==a&&(t.pathLenConstraint=i.derToInteger(a))}else if("extKeyUsage"===t.name)for(var c=i.fromDer(t.value),u=0;u<c.value.length;++u){var f=i.derToOid(c.value[u].value);f in o?t[o[f]]=!0:t[f]=!0}else if("nsCertType"===t.name){r=0;(c=i.fromDer(t.value)).value.length>1&&(r=c.value.charCodeAt(1)),t.client=128==(128&r),t.server=64==(64&r),t.email=32==(32&r),t.objsign=16==(16&r),t.reserved=8==(8&r),t.sslCA=4==(4&r),t.emailCA=2==(2&r),t.objCA=1==(1&r)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var h;t.altNames=[];c=i.fromDer(t.value);for(var l=0;l<c.value.length;++l){var d={type:(h=c.value[l]).type,value:h.value};switch(t.altNames.push(d),h.type){case 1:case 2:case 6:break;case 7:d.ip=n.util.bytesToIP(h.value);break;case 8:d.oid=i.derToOid(h.value)}}}else if("subjectKeyIdentifier"===t.name){c=i.fromDer(t.value);t.subjectKeyIdentifier=n.util.bytesToHex(c.value)}return t},s.certificationRequestFromAsn1=function(e,t){var r={},a=[];if(!i.validate(e,l,r,a))throw(u=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.")).errors=a,u;if(i.derToOid(r.publicKeyOid)!==s.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=s.createCertificationRequest();if(c.version=r.csrVersion?r.csrVersion.charCodeAt(0):0,c.signatureOid=n.asn1.derToOid(r.csrSignatureOid),c.signatureParameters=p(c.signatureOid,r.csrSignatureParams,!0),c.siginfo.algorithmOid=n.asn1.derToOid(r.csrSignatureOid),c.siginfo.parameters=p(c.siginfo.algorithmOid,r.csrSignatureParams,!1),c.signature=r.csrSignature,c.certificationRequestInfo=r.certificationRequestInfo,t){var u;if(c.md=null,c.signatureOid in o)switch(o[c.signatureOid]){case"sha1WithRSAEncryption":c.md=n.md.sha1.create();break;case"md5WithRSAEncryption":c.md=n.md.md5.create();break;case"sha256WithRSAEncryption":c.md=n.md.sha256.create();break;case"sha384WithRSAEncryption":c.md=n.md.sha384.create();break;case"sha512WithRSAEncryption":c.md=n.md.sha512.create();break;case"RSASSA-PSS":c.md=n.md.sha256.create()}if(null===c.md)throw(u=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=c.signatureOid,u;var f=i.toDer(c.certificationRequestInfo);c.md.update(f.getBytes())}var h=n.md.sha1.create();return c.subject.getField=function(e){return d(c.subject,e)},c.subject.addField=function(e){y([e]),c.subject.attributes.push(e)},c.subject.attributes=s.RDNAttributesAsArray(r.certificationRequestInfoSubject,h),c.subject.hash=h.digest().toHex(),c.publicKey=s.publicKeyFromAsn1(r.subjectPublicKeyInfo),c.getAttribute=function(e){return d(c,e)},c.addAttribute=function(e){y([e]),c.attributes.push(e)},c.attributes=s.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),c},s.createCertificationRequest=function(){var e={version:0,signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return d(e.subject,t)},e.subject.addField=function(t){y([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return d(e,t)},e.addAttribute=function(t){y([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){y(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){y(t),e.attributes=t},e.sign=function(t,r){e.md=r||n.md.sha1.create();var a=o[e.md.algorithm+"WithRSAEncryption"];if(!a){var c=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw c.algorithm=e.md.algorithm,c}e.signatureOid=e.siginfo.algorithmOid=a,e.certificationRequestInfo=s.getCertificationRequestInfo(e);var u=i.toDer(e.certificationRequestInfo);e.md.update(u.getBytes()),e.signature=t.sign(e.md)},e.verify=function(){var t=!1,r=e.md;if(null===r){if(e.signatureOid in o)switch(o[e.signatureOid]){case"sha1WithRSAEncryption":r=n.md.sha1.create();break;case"md5WithRSAEncryption":r=n.md.md5.create();break;case"sha256WithRSAEncryption":r=n.md.sha256.create();break;case"sha384WithRSAEncryption":r=n.md.sha384.create();break;case"sha512WithRSAEncryption":r=n.md.sha512.create();break;case"RSASSA-PSS":r=n.md.sha256.create()}if(null===r)throw(l=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=e.signatureOid,l;var a=e.certificationRequestInfo||s.getCertificationRequestInfo(e),c=i.toDer(a);r.update(c.getBytes())}if(null!==r){var u;switch(e.signatureOid){case o.sha1WithRSAEncryption:break;case o["RSASSA-PSS"]:var f,h,l;if(void 0===(f=o[e.signatureParameters.mgf.hash.algorithmOid])||void 0===n.md[f])throw(l=new Error("Unsupported MGF hash function.")).oid=e.signatureParameters.mgf.hash.algorithmOid,l.name=f,l;if(void 0===(h=o[e.signatureParameters.mgf.algorithmOid])||void 0===n.mgf[h])throw(l=new Error("Unsupported MGF function.")).oid=e.signatureParameters.mgf.algorithmOid,l.name=h,l;if(h=n.mgf[h].create(n.md[f].create()),void 0===(f=o[e.signatureParameters.hash.algorithmOid])||void 0===n.md[f])throw(l=new Error("Unsupported RSASSA-PSS hash function.")).oid=e.signatureParameters.hash.algorithmOid,l.name=f,l;u=n.pss.create(n.md[f].create(),h,e.signatureParameters.saltLength)}t=e.publicKey.verify(r.digest().getBytes(),e.signature,u)}return t},e};var w=new Date("1950-01-01T00:00:00Z"),_=new Date("2050-01-01T00:00:00Z");function E(e){return e>=w&&e<_?i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(e)):i.create(i.Class.UNIVERSAL,i.Type.GENERALIZEDTIME,!1,i.dateToGeneralizedTime(e))}s.getTBSCertificate=function(e){var t=E(e.validity.notBefore),r=E(e.validity.notAfter),o=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes())]),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.siginfo.algorithmOid).getBytes()),g(e.siginfo.algorithmOid,e.siginfo.parameters)]),b(e.issuer),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,r]),b(e.subject),s.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&o.value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&o.value.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&o.value.push(s.certificateExtensionsToAsn1(e.extensions)),o},s.getCertificationRequestInfo=function(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()),b(e.subject),s.publicKeyToAsn1(e.publicKey),v(e)])},s.distinguishedNameToAsn1=function(e){return b(e)},s.certificateToAsn1=function(e){var t=e.tbsCertificate||s.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()),g(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},s.certificateExtensionsToAsn1=function(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,3,!0,[]),r=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;n<e.length;++n)r.value.push(s.certificateExtensionToAsn1(e[n]));return t},s.certificateExtensionToAsn1=function(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.id).getBytes())),e.critical&&t.value.push(i.create(i.Class.UNIVERSAL,i.Type.BOOLEAN,!1,String.fromCharCode(255)));var r=e.value;return"string"!=typeof e.value&&(r=i.toDer(r).getBytes()),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r)),t},s.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||s.getCertificationRequestInfo(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()),g(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},s.createCaStore=function(e){var t={certs:{}};function r(e){return o(e),t.certs[e.hash]||null}function o(e){if(!e.hash){var t=n.md.sha1.create();e.attributes=s.RDNAttributesAsArray(b(e),t),e.hash=t.digest().toHex()}}if(t.getIssuer=function(e){return r(e.issuer)},t.addCertificate=function(e){if("string"==typeof e&&(e=n.pki.certificateFromPem(e)),o(e.subject),!t.hasCertificate(e))if(e.subject.hash in t.certs){var r=t.certs[e.subject.hash];n.util.isArray(r)||(r=[r]),r.push(e),t.certs[e.subject.hash]=r}else t.certs[e.subject.hash]=e},t.hasCertificate=function(e){"string"==typeof e&&(e=n.pki.certificateFromPem(e));var t=r(e.subject);if(!t)return!1;n.util.isArray(t)||(t=[t]);for(var o=i.toDer(s.certificateToAsn1(e)).getBytes(),a=0;a<t.length;++a){if(o===i.toDer(s.certificateToAsn1(t[a])).getBytes())return!0}return!1},t.listAllCertificates=function(){var e=[];for(var r in t.certs)if(t.certs.hasOwnProperty(r)){var i=t.certs[r];if(n.util.isArray(i))for(var s=0;s<i.length;++s)e.push(i[s]);else e.push(i)}return e},t.removeCertificate=function(e){var a;if("string"==typeof e&&(e=n.pki.certificateFromPem(e)),o(e.subject),!t.hasCertificate(e))return null;var c=r(e.subject);if(!n.util.isArray(c))return a=t.certs[e.subject.hash],delete t.certs[e.subject.hash],a;for(var u=i.toDer(s.certificateToAsn1(e)).getBytes(),f=0;f<c.length;++f){u===i.toDer(s.certificateToAsn1(c[f])).getBytes()&&(a=c[f],c.splice(f,1))}return 0===c.length&&delete t.certs[e.subject.hash],a},e)for(var a=0;a<e.length;++a){var c=e[a];t.addCertificate(c)}return t},s.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},s.verifyCertificateChain=function(e,t,r){"function"==typeof r&&(r={verify:r}),r=r||{};var i=(t=t.slice(0)).slice(0),o=r.validityCheckDate;void 0===o&&(o=new Date);var a=!0,c=null,u=0;do{var f=t.shift(),h=null,l=!1;if(o&&(o<f.validity.notBefore||o>f.validity.notAfter)&&(c={message:"Certificate is not valid yet or has expired.",error:s.certificateError.certificate_expired,notBefore:f.validity.notBefore,notAfter:f.validity.notAfter,now:o}),null===c){if(null===(h=t[0]||e.getIssuer(f))&&f.isIssuer(f)&&(l=!0,h=f),h){var d=h;n.util.isArray(d)||(d=[d]);for(var p=!1;!p&&d.length>0;){h=d.shift();try{p=h.verify(f)}catch(E){}}p||(c={message:"Certificate signature is invalid.",error:s.certificateError.bad_certificate})}null!==c||h&&!l||e.hasCertificate(f)||(c={message:"Certificate is not trusted.",error:s.certificateError.unknown_ca})}if(null===c&&h&&!f.isIssuer(h)&&(c={message:"Certificate issuer is invalid.",error:s.certificateError.bad_certificate}),null===c)for(var b={keyUsage:!0,basicConstraints:!0},y=0;null===c&&y<f.extensions.length;++y){var m=f.extensions[y];m.critical&&!(m.name in b)&&(c={message:"Certificate has an unsupported critical extension.",error:s.certificateError.unsupported_certificate})}if(null===c&&(!a||0===t.length&&(!h||l))){var g=f.getExtension("basicConstraints"),v=f.getExtension("keyUsage");if(null!==v&&(v.keyCertSign&&null!==g||(c={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:s.certificateError.bad_certificate})),null!==c||null===g||g.cA||(c={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:s.certificateError.bad_certificate}),null===c&&null!==v&&"pathLenConstraint"in g)u-1>g.pathLenConstraint&&(c={message:"Certificate basicConstraints pathLenConstraint violated.",error:s.certificateError.bad_certificate})}var w=null===c||c.error,_=r.verify?r.verify(w,u,i):w;if(!0!==_)throw!0===w&&(c={message:"The application rejected the certificate.",error:s.certificateError.bad_certificate}),(_||0===_)&&("object"!=typeof _||n.util.isArray(_)?"string"==typeof _&&(c.error=_):(_.message&&(c.message=_.message),_.error&&(c.error=_.error))),c;c=null,a=!1,++u}while(t.length>0);return!0}},function(e,t,r){"use strict";const n=Math.exp;e.exports=function(e){if("number"!=typeof e)throw new Error("must provide a timespan to the moving average constructor");if(e<=0)throw new Error("must provide a timespan > 0 to the moving average constructor");let t,r,i=0,s=0,o=0,a={};return a.push=function(a,c){if(r){const u=1-n(-(a-r)/e),f=c-t;t=u*c+(1-u)*t,i=(1-u)*(i+f*(u*f)),s=Math.sqrt(i),o=t+u*f}else t=c;r=a},a.movingAverage=function(){return t},a.variance=function(){return i},a.deviation=function(){return s},a.forecast=function(){return o},a}},function(e,t,r){"use strict";t.PROTOCOL_ID="/multistream/1.0.0"},function(e,t,r){"use strict";const n=r(1),i=r(2);i("libp2p:peer-store").error=i("libp2p:peer-store:error");const{EventEmitter:s}=r(13),o=r(6),a=r(815),c=r(816),u=r(817),f=r(818),{ERR_INVALID_PARAMETERS:h}=r(20);e.exports=class extends s{constructor(){super(),this.addressBook=new a(this),this.keyBook=new c(this),this.metadataBook=new u(this),this.protoBook=new f(this)}start(){}stop(){}get peers(){const e=new Set([...this.addressBook.data.keys(),...this.keyBook.data.keys(),...this.protoBook.data.keys(),...this.metadataBook.data.keys()]),t=new Map;return e.forEach(e=>{t.set(e,this.get(o.createFromCID(e)))}),t}delete(e){const t=this.addressBook.delete(e),r=this.keyBook.delete(e),n=this.protoBook.delete(e),i=this.metadataBook.delete(e);return t||r||n||i}get(e){if(!o.isPeerId(e))throw n(new Error("peerId must be an instance of peer-id"),h);const t=this.keyBook.data.get(e.toB58String()),r=this.addressBook.get(e),i=this.metadataBook.get(e),s=this.protoBook.get(e);if(t||r||i||s)return{id:t||e,addresses:r||[],protocols:s||[],metadata:i}}}},function(e,t,r){"use strict";t.CODE_P2P=421,t.CODE_CIRCUIT=290,t.CLOSE_TIMEOUT=2e3},function(e,t,r){"use strict";const n=r(15),i=r(1),{Address4:s,Address6:o}=r(853),a={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};e.exports=(e,t)=>{if("string"!=typeof e)throw i(new Error("invalid ip provided: ".concat(e)),a.ERR_INVALID_IP_PARAMETER);if(t=parseInt(t),isNaN(t))throw i(new Error("invalid port provided: ".concat(t)),a.ERR_INVALID_PORT_PARAMETER);if(new s(e).isValid())return n("/ip4/".concat(e,"/tcp/").concat(t));const r=new o(e);if(r.isValid())return r.is4()?n("/ip4/".concat(r.to4().correctForm(),"/tcp/").concat(t)):n("/ip6/".concat(e,"/tcp/").concat(t));throw i(new Error("invalid ip:port for creating a multiaddr: ".concat(e,":").concat(t)),a.ERR_INVALID_IP)},e.exports.Errors=a},function(e,t,r){"use strict";var n=r(322).BigInteger,i=r(323),s=r(84).sprintf,o=r(324),a=r(325),c=r(178);function u(e){this.valid=!1,this.address=e,this.groups=c.GROUPS,this.v4=!0,this.subnet="/32",this.subnetMask=32;var t=c.RE_SUBNET_STRING.exec(e);if(t){if(this.parsedSubnet=t[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet="/"+this.subnetMask,this.subnetMask<0||this.subnetMask>c.BITS)return this.valid=!1,void(this.error="Invalid subnet mask.");e=e.replace(c.RE_SUBNET_STRING,"")}this.addressMinusSuffix=e,this.parsedAddress=this.parse(e)}u.prototype.parse=function(e){var t=e.split(".");return e.match(c.RE_ADDRESS)?this.valid=!0:this.error="Invalid IPv4 address.",t},u.prototype.isValid=function(){return this.valid},u.prototype.correctForm=function(){return this.parsedAddress.map((function(e){return parseInt(e,10)})).join(".")},u.prototype.isCorrect=i.isCorrect(c.BITS),u.fromHex=function(e){var t,r=o(e.replace(/:/g,""),8,"0"),n=[];for(t=0;t<8;t+=2){var i=r.slice(t,t+2);n.push(parseInt(i,16))}return new u(n.join("."))},u.fromInteger=function(e){return u.fromHex(e.toString(16))},u.prototype.toHex=function(){return this.parsedAddress.map((function(e){return s("%02x",parseInt(e,10))})).join(":")},u.prototype.toArray=function(){return this.parsedAddress.map((function(e){return parseInt(e,10)}))},u.prototype.toGroup6=function(){var e,t=[];for(e=0;e<c.GROUPS;e+=2){var r=s("%02x%02x",parseInt(this.parsedAddress[e],10),parseInt(this.parsedAddress[e+1],10));t.push(s("%x",parseInt(r,16)))}return t.join(":")},u.prototype.bigInteger=function(){return this.valid?new n(this.parsedAddress.map((function(e){return s("%02x",parseInt(e,10))})).join(""),16):null},u.prototype._startAddress=function(){return new n(this.mask()+a("0",c.BITS-this.subnetMask),2)},u.prototype.startAddress=function(){return u.fromBigInteger(this._startAddress())},u.prototype.startAddressExclusive=function(){var e=new n("1");return u.fromBigInteger(this._startAddress().add(e))},u.prototype._endAddress=function(){return new n(this.mask()+a("1",c.BITS-this.subnetMask),2)},u.prototype.endAddress=function(){return u.fromBigInteger(this._endAddress())},u.prototype.endAddressExclusive=function(){var e=new n("1");return u.fromBigInteger(this._endAddress().subtract(e))},u.fromBigInteger=function(e){return u.fromInteger(parseInt(e.toString(),10))},u.prototype.mask=function(e){return void 0===e&&(e=this.subnetMask),this.getBitsBase2(0,e)},u.prototype.getBitsBase2=function(e,t){return this.binaryZeroPad().slice(e,t)},u.prototype.isInSubnet=i.isInSubnet,u.prototype.isMulticast=function(){return this.isInSubnet(new u("224.0.0.0/4"))},u.prototype.binaryZeroPad=function(){return o(this.bigInteger().toString(2),c.BITS,"0")},e.exports=u},function(e,t,r){"use strict";(function(){var t;function r(e,t,r){null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function n(){return new r(null)}var i="undefined"!=typeof navigator;i&&"Microsoft Internet Explorer"==navigator.appName?(r.prototype.am=function(e,t,r,n,i,s){for(var o=32767&t,a=t>>15;--s>=0;){var c=32767&this[e],u=this[e++]>>15,f=a*c+u*o;i=((c=o*c+((32767&f)<<15)+r[n]+(1073741823&i))>>>30)+(f>>>15)+a*u+(i>>>30),r[n++]=1073741823&c}return i},t=30):i&&"Netscape"!=navigator.appName?(r.prototype.am=function(e,t,r,n,i,s){for(;--s>=0;){var o=t*this[e++]+r[n]+i;i=Math.floor(o/67108864),r[n++]=67108863&o}return i},t=26):(r.prototype.am=function(e,t,r,n,i,s){for(var o=16383&t,a=t>>14;--s>=0;){var c=16383&this[e],u=this[e++]>>14,f=a*c+u*o;i=((c=o*c+((16383&f)<<14)+r[n]+i)>>28)+(f>>14)+a*u,r[n++]=268435455&c}return i},t=28),r.prototype.DB=t,r.prototype.DM=(1<<t)-1,r.prototype.DV=1<<t;r.prototype.FV=Math.pow(2,52),r.prototype.F1=52-t,r.prototype.F2=2*t-52;var s,o,a=new Array;for(s="0".charCodeAt(0),o=0;o<=9;++o)a[s++]=o;for(s="a".charCodeAt(0),o=10;o<36;++o)a[s++]=o;for(s="A".charCodeAt(0),o=10;o<36;++o)a[s++]=o;function c(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function u(e,t){var r=a[e.charCodeAt(t)];return null==r?-1:r}function f(e){var t=n();return t.fromInt(e),t}function h(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function l(e){this.m=e}function d(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function p(e,t){return e&t}function b(e,t){return e|t}function y(e,t){return e^t}function m(e,t){return e&~t}function g(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=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 v(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function w(){}function _(e){return e}function E(e){this.r2=n(),this.q3=n(),r.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}l.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},l.prototype.revert=function(e){return e},l.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},l.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},l.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},d.prototype.convert=function(e){var t=n();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(r.ZERO)>0&&this.m.subTo(t,t),t},d.prototype.revert=function(e){var t=n();return e.copyTo(t),this.reduce(t),t},d.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e[t],n=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[r=t+this.m.t]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},d.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},d.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},r.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},r.prototype.fromInt=function(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},r.prototype.fromString=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 i=e.length,s=!1,o=0;--i>=0;){var a=8==n?255&e[i]:u(e,i);a<0?"-"==e.charAt(i)&&(s=!0):(s=!1,0==o?this[this.t++]=a:o+n>this.DB?(this[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this[this.t++]=a>>this.DB-o):this[this.t-1]|=a<<o,(o+=n)>=this.DB&&(o-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),s&&r.ZERO.subTo(this,this)},r.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},r.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s},r.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s},r.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,s=(1<<i)-1,o=Math.floor(e/this.DB),a=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t[r+o+1]=this[r]>>i|a,a=(this[r]&s)<<n;for(r=o-1;r>=0;--r)t[r]=0;t[o]=a,t.t=this.t+o+1,t.s=this.s,t.clamp()},r.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,s=(1<<n)-1;t[0]=this[r]>>n;for(var o=r+1;o<this.t;++o)t[o-r-1]|=(this[o]&s)<<i,t[o-r]=this[o]>>n;n>0&&(t[this.t-r-1]|=(this.s&s)<<i),t.t=this.t-r,t.clamp()}},r.prototype.subTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this[r]-e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e[r],t[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()},r.prototype.multiplyTo=function(e,t){var n=this.abs(),i=e.abs(),s=n.t;for(t.t=s+i.t;--s>=0;)t[s]=0;for(s=0;s<i.t;++s)t[s+n.t]=n.am(0,i[s],t,s,0,n.t);t.s=0,t.clamp(),this.s!=e.s&&r.ZERO.subTo(t,t)},r.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()},r.prototype.divRemTo=function(e,t,i){var s=e.abs();if(!(s.t<=0)){var o=this.abs();if(o.t<s.t)return null!=t&&t.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=n());var a=n(),c=this.s,u=e.s,f=this.DB-h(s[s.t-1]);f>0?(s.lShiftTo(f,a),o.lShiftTo(f,i)):(s.copyTo(a),o.copyTo(i));var l=a.t,d=a[l-1];if(0!=d){var p=d*(1<<this.F1)+(l>1?a[l-2]>>this.F2:0),b=this.FV/p,y=(1<<this.F1)/p,m=1<<this.F2,g=i.t,v=g-l,w=null==t?n():t;for(a.dlShiftTo(v,w),i.compareTo(w)>=0&&(i[i.t++]=1,i.subTo(w,i)),r.ONE.dlShiftTo(l,w),w.subTo(a,a);a.t<l;)a[a.t++]=0;for(;--v>=0;){var _=i[--g]==d?this.DM:Math.floor(i[g]*b+(i[g-1]+m)*y);if((i[g]+=a.am(0,_,i,v,0,l))<_)for(a.dlShiftTo(v,w),i.subTo(w,i);i[g]<--_;)i.subTo(w,i)}null!=t&&(i.drShiftTo(l,t),c!=u&&r.ZERO.subTo(t,t)),i.t=l,i.clamp(),f>0&&i.rShiftTo(f,i),c<0&&r.ZERO.subTo(i,i)}}},r.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},r.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},r.prototype.exp=function(e,t){if(e>4294967295||e<1)return r.ONE;var i=n(),s=n(),o=t.convert(this),a=h(e)-1;for(o.copyTo(i);--a>=0;)if(t.sqrTo(i,s),(e&1<<a)>0)t.mulTo(s,o,i);else{var c=i;i=s,s=c}return t.revert(i)},r.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,i=!1,s="",o=this.t,a=this.DB-o*this.DB%t;if(o-- >0)for(a<this.DB&&(r=this[o]>>a)>0&&(i=!0,s=c(r));o>=0;)a<t?(r=(this[o]&(1<<a)-1)<<t-a,r|=this[--o]>>(a+=this.DB-t)):(r=this[o]>>(a-=t)&n,a<=0&&(a+=this.DB,--o)),r>0&&(i=!0),i&&(s+=c(r));return i?s:"0"},r.prototype.negate=function(){var e=n();return r.ZERO.subTo(this,e),e},r.prototype.abs=function(){return this.s<0?this.negate():this},r.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0},r.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+h(this[this.t-1]^this.s&this.DM)},r.prototype.mod=function(e){var t=n();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(r.ZERO)>0&&e.subTo(t,t),t},r.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new l(t):new d(t),this.exp(e,r)},r.ZERO=f(0),r.ONE=f(1),w.prototype.convert=_,w.prototype.revert=_,w.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},w.prototype.sqrTo=function(e,t){e.squareTo(t)},E.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=n();return e.copyTo(t),this.reduce(t),t},E.prototype.revert=function(e){return e},E.prototype.reduce=function(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)},E.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},E.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var k,S,A,I=[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],T=(1<<26)/I[I.length-1];function R(){var e;e=(new Date).getTime(),S[A++]^=255&e,S[A++]^=e>>8&255,S[A++]^=e>>16&255,S[A++]^=e>>24&255,A>=O&&(A-=O)}if(r.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},r.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),i=f(r),s=n(),o=n(),a="";for(this.divRemTo(i,s,o);s.signum()>0;)a=(r+o.intValue()).toString(e).substr(1)+a,s.divRemTo(i,s,o);return o.intValue().toString(e)+a},r.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),i=Math.pow(t,n),s=!1,o=0,a=0,c=0;c<e.length;++c){var f=u(e,c);f<0?"-"==e.charAt(c)&&0==this.signum()&&(s=!0):(a=t*a+f,++o>=n&&(this.dMultiply(i),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(a,0)),s&&r.ZERO.subTo(this,this)},r.prototype.fromNumber=function(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(r.ONE.shiftLeft(e-1),b,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(r.ONE.shiftLeft(e-1),this);else{var i=new Array,s=7&e;i.length=1+(e>>3),t.nextBytes(i),s>0?i[0]&=(1<<s)-1:i[0]=0,this.fromString(i,256)}},r.prototype.bitwiseTo=function(e,t,r){var n,i,s=Math.min(e.t,this.t);for(n=0;n<s;++n)r[n]=t(this[n],e[n]);if(e.t<this.t){for(i=e.s&this.DM,n=s;n<this.t;++n)r[n]=t(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=s;n<e.t;++n)r[n]=t(i,e[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},r.prototype.changeBit=function(e,t){var n=r.ONE.shiftLeft(e);return this.bitwiseTo(n,t,n),n},r.prototype.addTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this[r]+e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e[r],t[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()},r.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},r.prototype.dAddOffset=function(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]}},r.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r[--i]=0;for(n=r.t-this.t;i<n;++i)r[i+this.t]=this.am(0,e[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e[i],r,i,0,t-i);r.clamp()},r.prototype.multiplyUpperTo=function(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r[this.t+n-t]=this.am(t-n,e[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)},r.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r},r.prototype.millerRabin=function(e){var t=this.subtract(r.ONE),i=t.getLowestSetBit();if(i<=0)return!1;var s=t.shiftRight(i);(e=e+1>>1)>I.length&&(e=I.length);for(var o=n(),a=0;a<e;++a){o.fromInt(I[Math.floor(Math.random()*I.length)]);var c=o.modPow(s,this);if(0!=c.compareTo(r.ONE)&&0!=c.compareTo(t)){for(var u=1;u++<i&&0!=c.compareTo(t);)if(0==(c=c.modPowInt(2,this)).compareTo(r.ONE))return!1;if(0!=c.compareTo(t))return!1}}return!0},r.prototype.clone=function(){var e=n();return this.copyTo(e),e},r.prototype.intValue=function(){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)<<this.DB|this[0]},r.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},r.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},r.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},r.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n<this.DB&&(r=this[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this[e]&(1<<n)-1)<<8-n,r|=this[--e]>>(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},r.prototype.equals=function(e){return 0==this.compareTo(e)},r.prototype.min=function(e){return this.compareTo(e)<0?this:e},r.prototype.max=function(e){return this.compareTo(e)>0?this:e},r.prototype.and=function(e){var t=n();return this.bitwiseTo(e,p,t),t},r.prototype.or=function(e){var t=n();return this.bitwiseTo(e,b,t),t},r.prototype.xor=function(e){var t=n();return this.bitwiseTo(e,y,t),t},r.prototype.andNot=function(e){var t=n();return this.bitwiseTo(e,m,t),t},r.prototype.not=function(){for(var e=n(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},r.prototype.shiftLeft=function(e){var t=n();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},r.prototype.shiftRight=function(e){var t=n();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},r.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+g(this[e]);return this.s<0?this.t*this.DB:-1},r.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=v(this[r]^t);return e},r.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this[t]&1<<e%this.DB)},r.prototype.setBit=function(e){return this.changeBit(e,b)},r.prototype.clearBit=function(e){return this.changeBit(e,m)},r.prototype.flipBit=function(e){return this.changeBit(e,y)},r.prototype.add=function(e){var t=n();return this.addTo(e,t),t},r.prototype.subtract=function(e){var t=n();return this.subTo(e,t),t},r.prototype.multiply=function(e){var t=n();return this.multiplyTo(e,t),t},r.prototype.divide=function(e){var t=n();return this.divRemTo(e,t,null),t},r.prototype.remainder=function(e){var t=n();return this.divRemTo(e,null,t),t},r.prototype.divideAndRemainder=function(e){var t=n(),r=n();return this.divRemTo(e,t,r),new Array(t,r)},r.prototype.modPow=function(e,t){var r,i,s=e.bitLength(),o=f(1);if(s<=0)return o;r=s<18?1:s<48?3:s<144?4:s<768?5:6,i=s<8?new l(t):t.isEven()?new E(t):new d(t);var a=new Array,c=3,u=r-1,p=(1<<r)-1;if(a[1]=i.convert(this),r>1){var b=n();for(i.sqrTo(a[1],b);c<=p;)a[c]=n(),i.mulTo(b,a[c-2],a[c]),c+=2}var y,m,g=e.t-1,v=!0,w=n();for(s=h(e[g])-1;g>=0;){for(s>=u?y=e[g]>>s-u&p:(y=(e[g]&(1<<s+1)-1)<<u-s,g>0&&(y|=e[g-1]>>this.DB+s-u)),c=r;0==(1&y);)y>>=1,--c;if((s-=c)<0&&(s+=this.DB,--g),v)a[y].copyTo(o),v=!1;else{for(;c>1;)i.sqrTo(o,w),i.sqrTo(w,o),c-=2;c>0?i.sqrTo(o,w):(m=o,o=w,w=m),i.mulTo(w,a[y],o)}for(;g>=0&&0==(e[g]&1<<s);)i.sqrTo(o,w),m=o,o=w,w=m,--s<0&&(s=this.DB-1,--g)}return i.revert(o)},r.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return r.ZERO;for(var n=e.clone(),i=this.clone(),s=f(1),o=f(0),a=f(0),c=f(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),t?(s.isEven()&&o.isEven()||(s.addTo(this,s),o.subTo(e,o)),s.rShiftTo(1,s)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;i.isEven();)i.rShiftTo(1,i),t?(a.isEven()&&c.isEven()||(a.addTo(this,a),c.subTo(e,c)),a.rShiftTo(1,a)):c.isEven()||c.subTo(e,c),c.rShiftTo(1,c);n.compareTo(i)>=0?(n.subTo(i,n),t&&s.subTo(a,s),o.subTo(c,o)):(i.subTo(n,i),t&&a.subTo(s,a),c.subTo(o,c))}return 0!=i.compareTo(r.ONE)?r.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},r.prototype.pow=function(e){return this.exp(e,new w)},r.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)return t;for(i<s&&(s=i),s>0&&(t.rShiftTo(s,t),r.rShiftTo(s,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r},r.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r[0]<=I[I.length-1]){for(t=0;t<I.length;++t)if(r[0]==I[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<I.length;){for(var n=I[t],i=t+1;i<I.length&&n<T;)n*=I[i++];for(n=r.modInt(n);t<i;)if(n%I[t++]==0)return!1}return r.millerRabin(e)},r.prototype.square=function(){var e=n();return this.squareTo(e),e},r.prototype.Barrett=E,null==S){var x;if(S=new Array,A=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var C=new Uint8Array(32);for(window.crypto.getRandomValues(C),x=0;x<32;++x)S[A++]=C[x]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var B=window.crypto.random(32);for(x=0;x<B.length;++x)S[A++]=255&B.charCodeAt(x)}for(;A<O;)x=Math.floor(65536*Math.random()),S[A++]=x>>>8,S[A++]=255&x;A=0,R()}function M(){if(null==k){for(R(),(k=new P).init(S),A=0;A<S.length;++A)S[A]=0;A=0}return k.next()}function N(){}function P(){this.i=0,this.j=0,this.S=new Array}N.prototype.nextBytes=function(e){var t;for(t=0;t<e.length;++t)e[t]=M()},P.prototype.init=function(e){var t,r,n;for(t=0;t<256;++t)this.S[t]=t;for(r=0,t=0;t<256;++t)r=r+this.S[t]+e[t%e.length]&255,n=this.S[t],this.S[t]=this.S[r],this.S[r]=n;this.i=0,this.j=0},P.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]};var O=256;e.exports={default:r,BigInteger:r,SecureRandom:N}}).call(void 0)},function(e,t,r){"use strict";var n=t.falseIfInvalid=function(e){return function(){return!!this.valid&&e.apply(this,arguments)}};t.isInSubnet=n((function(e){return!(this.subnetMask<e.subnetMask)&&this.mask(e.subnetMask)===e.mask()})),t.isCorrect=function(e){return n((function(){return this.addressMinusSuffix===this.correctForm()&&(this.subnetMask===e&&!this.parsedSubnet||this.parsedSubnet===String(this.subnetMask))}))}},function(e,t,r){"use strict";(function(t){var r,n=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a="[\\ud800-\\udfff]",c="[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]",u="\\ud83c[\\udffb-\\udfff]",f="[^\\ud800-\\udfff]",h="(?:\\ud83c[\\udde6-\\uddff]){2}",l="[\\ud800-\\udbff][\\udc00-\\udfff]",d="(?:"+c+"|"+u+")"+"?",p="[\\ufe0e\\ufe0f]?"+d+("(?:\\u200d(?:"+[f,h,l].join("|")+")[\\ufe0e\\ufe0f]?"+d+")*"),b="(?:"+[f+c+"?",c,h,l,a].join("|")+")",y=RegExp(u+"(?="+u+")|"+b+p,"g"),m=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0\\ufe0e\\ufe0f]"),g=parseInt,v="object"==typeof t&&t&&t.Object===Object&&t,w="object"==typeof self&&self&&self.Object===Object&&self,_=v||w||Function("return this")(),E=(r="length",function(e){return null==e?void 0:e[r]});function k(e){return m.test(e)}function S(e){return k(e)?function(e){var t=y.lastIndex=0;for(;y.test(e);)t++;return t}(e):E(e)}function A(e){return k(e)?function(e){return e.match(y)||[]}(e):function(e){return e.split("")}(e)}var I=Object.prototype.toString,T=_.Symbol,R=Math.ceil,x=Math.floor,C=T?T.prototype:void 0,B=C?C.toString:void 0;function M(e,t){var r="";if(!e||t<1||t>9007199254740991)return r;do{t%2&&(r+=e),(t=x(t/2))&&(e+=e)}while(t);return r}function N(e){if("string"==typeof e)return e;if(D(e))return B?B.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function P(e,t,r){var n=e.length;return r=void 0===r?n:r,!t&&r>=n?e:function(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var s=Array(i);++n<i;)s[n]=e[n+t];return s}(e,t,r)}function O(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function D(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==I.call(e)}function L(e){return e?(e=function(e){if("number"==typeof e)return e;if(D(e))return NaN;if(O(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=O(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var r=s.test(e);return r||o.test(e)?g(e.slice(2),r?2:8):i.test(e)?NaN:+e}(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}e.exports=function(e,t,r){var n;e=null==(n=e)?"":N(n);var i=(t=function(e){var t=L(e),r=t%1;return t==t?r?t-r:t:0}(t))?S(e):0;return t&&i<t?function(e,t){var r=(t=void 0===t?" ":N(t)).length;if(r<2)return r?M(t,e):t;var n=M(t,R(e/S(t)));return k(t)?P(A(n),0,e).join(""):n.slice(0,e)}(t-i,r)+e:e}}).call(this,r(10))},function(e,t,r){"use strict";(function(t){var r=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=/^(?:0|[1-9]\d*)$/,a=parseInt,c="object"==typeof t&&t&&t.Object===Object&&t,u="object"==typeof self&&self&&self.Object===Object&&self,f=c||u||Function("return this")(),h=Object.prototype.toString,l=f.Symbol,d=Math.floor,p=l?l.prototype:void 0,b=p?p.toString:void 0;function y(e,t,r){if(!m(r))return!1;var n=typeof t;return!!("number"==n?function(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}(e.length)&&!function(e){var t=m(e)?h.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}(e)}(r)&&function(e,t){return!!(t=null==t?9007199254740991:t)&&("number"==typeof e||o.test(e))&&e>-1&&e%1==0&&e<t}(t,r.length):"string"==n&&t in r)&&function(e,t){return e===t||e!=e&&t!=t}(r[t],e)}function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==h.call(e)}function v(e){return e?(e=function(e){if("number"==typeof e)return e;if(g(e))return NaN;if(m(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=m(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(r,"");var o=i.test(e);return o||s.test(e)?a(e.slice(2),o?2:8):n.test(e)?NaN:+e}(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function w(e){return null==e?"":function(e){if("string"==typeof e)return e;if(g(e))return b?b.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}e.exports=function(e,t,r){var n,i;return(r?y(e,t,r):void 0===t)?t=1:(n=v(t),i=n%1,t=n==n?i?n-i:n:0),function(e,t){var r="";if(!e||t<1||t>9007199254740991)return r;do{t%2&&(r+=e),(t=d(t/2))&&(e+=e)}while(t);return r}(w(e),t)}}).call(this,r(10))},function(e,t,r){"use strict";var n=r(84).sprintf,i=t.spanAllZeroes=function(e){return e.replace(/(0+)/g,'<span class="zero">$1</span>')};function s(e){return e.replace(/^(0+)/,'<span class="zero">$1</span>')}t.spanAll=function(e,t){return void 0===t&&(t=0),e.split("").map((function(e,r){return n('<span class="digit value-%s position-%d">%s</span>',e,r+t,i(e))})).join("")},t.spanLeadingZeroes=function(e){return e.split(":").map((function(e){return s(e)})).join(":")},t.simpleGroup=function(e,t){var r=e.split(":");return t||(t=0),r.map((function(e,r){return/group-v4/.test(e)?e:n('<span class="hover-group group-%d">%s</span>',r+t,s(e))})).join(":")}},function(e,t,r){"use strict";(function(t){var n=r(2)("simple-peer"),i=r(863),s=r(328),o=r(268),a=r(864),c=r(1);function u(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}class f extends o.Duplex{constructor(e){if(super(e=Object.assign({allowHalfOpen:!1},e)),this._id=s(4).toString("hex").slice(0,7),this._debug("new peer %o",e),this.channelName=e.initiator?e.channelName||s(20).toString("hex"):null,this.initiator=e.initiator||!1,this.channelConfig=e.channelConfig||f.channelConfig,this.negotiated=this.channelConfig.negotiated,this.config=Object.assign({},f.config,e.config),this.offerOptions=e.offerOptions||{},this.answerOptions=e.answerOptions||{},this.sdpTransform=e.sdpTransform||(e=>e),this.streams=e.streams||(e.stream?[e.stream]:[]),this.trickle=void 0===e.trickle||e.trickle,this.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,this.iceCompleteTimeout=e.iceCompleteTimeout||5e3,this.destroyed=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:i(),!this._wrtc)throw"undefined"==typeof window?c(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):c(new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!this.negotiated&&!this.initiator,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._firstStable=!0,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(t){return void a(()=>this.destroy(c(t,"ERR_PC_CONSTRUCTOR")))}this._isReactNativeWebrtc="number"==typeof this._pc._peerConnectionId,this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=e=>{this._onIceCandidate(e)},this.initiator||this.negotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=e=>{this._setupData(e)},this.streams&&this.streams.forEach(e=>{this.addStream(e)}),this._pc.ontrack=e=>{this._onTrack(e)},this.initiator&&this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&"open"===this._channel.readyState}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(e){if(this.destroyed)throw c(new Error("cannot signal after peer is destroyed"),"ERR_SIGNALING");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}this._debug("signal()"),e.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),e.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(e.candidate):this._pendingCandidates.push(e.candidate)),e.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(e)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(e=>{this._addIceCandidate(e)}),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())}).catch(e=>{this.destroy(c(e,"ERR_SET_REMOTE_DESCRIPTION"))}),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||this.destroy(c(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}_addIceCandidate(e){var t=new this._wrtc.RTCIceCandidate(e);this._pc.addIceCandidate(t).catch(e=>{var r;!t.address||t.address.endsWith(".local")?(r="Ignoring unsupported ICE candidate.",console.warn(r)):this.destroy(c(e,"ERR_ADD_ICE_CANDIDATE"))})}send(e){this._channel.send(e)}addTransceiver(e,t){if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(r){this.destroy(c(r,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{transceiverRequest:{kind:e,init:t}})}addStream(e){this._debug("addStream()"),e.getTracks().forEach(t=>{this.addTrack(t,e)})}addTrack(e,t){this._debug("addTrack()");var r=this._senderMap.get(e)||new Map,n=r.get(t);if(n)throw n.removed?c(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):c(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED");n=this._pc.addTrack(e,t),r.set(t,n),this._senderMap.set(e,r),this._needsNegotiation()}replaceTrack(e,t,r){this._debug("replaceTrack()");var n=this._senderMap.get(e),i=n?n.get(r):null;if(!i)throw c(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");t&&this._senderMap.set(t,n),null!=i.replaceTrack?i.replaceTrack(t):this.destroy(c(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK"))}removeTrack(e,t){this._debug("removeSender()");var r=this._senderMap.get(e),n=r?r.get(t):null;if(!n)throw c(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{n.removed=!0,this._pc.removeTrack(n)}catch(i){"NS_ERROR_UNEXPECTED"===i.name?this._sendersAwaitingStable.push(n):this.destroy(c(i,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(e){this._debug("removeSenders()"),e.getTracks().forEach(t=>{this.removeTrack(t,e)})}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,a(()=>{this._batchedNegotiation=!1,this._debug("starting batched negotiation"),this.negotiate()}))}negotiate(){this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{renegotiate:!0})),this._isNegotiating=!0}destroy(e){this._destroy(e,()=>{})}_destroy(e,t){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()}}_setupData(e){if(!e.channel)return this.destroy(c(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=e.channel,this._channel.binaryType="arraybuffer","number"==typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=65536),this.channelName=this._channel.label,this._channel.onmessage=e=>{this._onChannelMessage(e)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=e=>{this.destroy(c(e,"ERR_DATA_CHANNEL"))};var t=!1;this._closingInterval=setInterval(()=>{this._channel&&"closing"===this._channel.readyState?(t&&this._onChannelClose(),t=!0):t=!1},5e3)}_read(){}_write(e,t,r){if(this.destroyed)return r(c(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(e)}catch(n){return this.destroy(c(n,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=r):r(null)}else this._debug("write before connect"),this._chunk=e,this._cb=r}_onFinish(){if(this.destroyed)return;const e=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?e():this.once("connect",e)}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=u(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(!this.destroyed){var t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp})}};this._pc.setLocalDescription(e).then(()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))}).catch(e=>{this.destroy(c(e,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(e=>{this.destroy(c(e,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(e=>{e.mid||!e.sender.track||e.requested||(e.requested=!0,this.addTransceiver(e.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=u(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(!this.destroyed){var t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp}),this.initiator||this._requestMissingTransceivers()}};this._pc.setLocalDescription(e).then(()=>{this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))}).catch(e=>{this.destroy(c(e,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(e=>{this.destroy(c(e,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||"failed"===this._pc.connectionState&&this.destroy(c(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(!this.destroyed){var e=this._pc.iceConnectionState,t=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",e,t),this.emit("iceStateChange",e,t),"connected"!==e&&"completed"!==e||(this._pcReady=!0,this._maybeReady()),"failed"===e&&this.destroy(c(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===e&&this.destroy(c(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}}getStats(e){const t=e=>("[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach(t=>{Object.assign(e,t)}),e);0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then(r=>{var n=[];r.forEach(e=>{n.push(t(e))}),e(null,n)},t=>e(t)):this._pc.getStats.length>0?this._pc.getStats(r=>{if(!this.destroyed){var n=[];r.result().forEach(e=>{var r={};e.names().forEach(t=>{r[t]=e.stat(t)}),r.id=e.id,r.type=e.type,r.timestamp=e.timestamp,n.push(t(r))}),e(null,n)}},t=>e(t)):e(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const e=()=>{this.destroyed||this.getStats((t,r)=>{if(this.destroyed)return;t&&(r=[]);var n={},i={},s={},o=!1;r.forEach(e=>{"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(n[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(i[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(s[e.id]=e)});const a=e=>{o=!0;var t=i[e.localCandidateId];t&&(t.ip||t.address)?(this.localAddress=t.ip||t.address,this.localPort=Number(t.port)):t&&t.ipAddress?(this.localAddress=t.ipAddress,this.localPort=Number(t.portNumber)):"string"==typeof e.googLocalAddress&&(t=e.googLocalAddress.split(":"),this.localAddress=t[0],this.localPort=Number(t[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");var r=n[e.remoteCandidateId];r&&(r.ip||r.address)?(this.remoteAddress=r.ip||r.address,this.remotePort=Number(r.port)):r&&r.ipAddress?(this.remoteAddress=r.ipAddress,this.remotePort=Number(r.portNumber)):"string"==typeof e.googRemoteAddress&&(r=e.googRemoteAddress.split(":"),this.remoteAddress=r[0],this.remotePort=Number(r[1])),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(r.forEach(e=>{"transport"===e.type&&e.selectedCandidatePairId&&a(s[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&a(e)}),o||Object.keys(s).length&&!Object.keys(i).length){if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(t){return this.destroy(c(t,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');var u=this._cb;this._cb=null,u(null)}"number"!=typeof this._channel.bufferedAmountLowThreshold&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}else setTimeout(e,100)})};e()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>65536||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||("stable"!==this._pc.signalingState||this._firstStable||(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(e=>{this._pc.removeTrack(e),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation&&(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()),this._debug("negotiate"),this.emit("negotiate")),this._firstStable=!1,this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(e){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())}_onChannelMessage(e){if(!this.destroyed){var r=e.data;r instanceof ArrayBuffer&&(r=t.from(r)),this.push(r)}}_onChannelBufferedAmountLow(){if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);var e=this._cb;this._cb=null,e(null)}}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(e){this.destroyed||e.streams.forEach(t=>{this._debug("on track"),this.emit("track",e.track,t),this._remoteTracks.push({track:e.track,stream:t}),this._remoteStreams.some(e=>e.id===t.id)||(this._remoteStreams.push(t),a(()=>{this.emit("stream",t)}))})}_debug(){var e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],n.apply(null,e)}}f.WEBRTC_SUPPORT=!!i(),f.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},f.channelConfig={},e.exports=f}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t,n){var i=r(199).Buffer,s=t.crypto||t.msCrypto;s&&s.getRandomValues?e.exports=function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var r=i.allocUnsafe(e);if(e>0)if(e>65536)for(var o=0;o<e;o+=65536)s.getRandomValues(r.slice(o,o+65536));else s.getRandomValues(r);if("function"==typeof t)return n.nextTick((function(){t(null,r)}));return r}:e.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,r(10),r(8))},function(e,t,r){"use strict";var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,i=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function(e){var t=e,r=e.indexOf("["),s=e.indexOf("]");-1!=r&&-1!=s&&(e=e.substring(0,r)+e.substring(r,s).replace(/:/g,";")+e.substring(s,e.length));for(var o=n.exec(e||""),a={},c=14;c--;)a[i[c]]=o[c]||"";return-1!=r&&-1!=s&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a}},function(e,t,r){"use strict";var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,r){"use strict";(function(t){e.exports=function(e){return r&&t.isBuffer(e)||n&&(e instanceof ArrayBuffer||function(e){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer}(e))};var r="function"==typeof t&&"function"==typeof t.isBuffer,n="function"==typeof ArrayBuffer}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(873),i=r(338),s=r(182),o=r(181),a=r(339),c=r(340),u=r(2)("socket.io-client:manager"),f=r(337),h=r(888),l=Object.prototype.hasOwnProperty;function d(e,t){if(!(this instanceof d))return new d(e,t);e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new h({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var r=t.parser||o;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}e.exports=d,d.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)l.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},d.prototype.updateSocketIds=function(){for(var e in this.nsps)l.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},d.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},s(d.prototype),d.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},d.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},d.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},d.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},d.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},d.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},d.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},d.prototype.open=d.prototype.connect=function(e,t){if(u("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;u("opening %s",this.uri),this.engine=n(this.uri,this.opts);var r=this.engine,i=this;this.readyState="opening",this.skipReconnect=!1;var s=a(r,"open",(function(){i.onopen(),e&&e()})),o=a(r,"error",(function(t){if(u("connect_error"),i.cleanup(),i.readyState="closed",i.emitAll("connect_error",t),e){var r=new Error("Connection error");r.data=t,e(r)}else i.maybeReconnectOnOpen()}));if(!1!==this._timeout){var c=this._timeout;u("connect attempt will timeout after %d",c);var f=setTimeout((function(){u("connect attempt timed out after %d",c),s.destroy(),r.close(),r.emit("error","timeout"),i.emitAll("connect_timeout",c)}),c);this.subs.push({destroy:function(){clearTimeout(f)}})}return this.subs.push(s),this.subs.push(o),this},d.prototype.onopen=function(){u("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(a(e,"data",c(this,"ondata"))),this.subs.push(a(e,"ping",c(this,"onping"))),this.subs.push(a(e,"pong",c(this,"onpong"))),this.subs.push(a(e,"error",c(this,"onerror"))),this.subs.push(a(e,"close",c(this,"onclose"))),this.subs.push(a(this.decoder,"decoded",c(this,"ondecoded")))},d.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},d.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},d.prototype.ondata=function(e){this.decoder.add(e)},d.prototype.ondecoded=function(e){this.emit("packet",e)},d.prototype.onerror=function(e){u("error",e),this.emitAll("error",e)},d.prototype.socket=function(e,t){var r=this.nsps[e];if(!r){r=new i(this,e,t),this.nsps[e]=r;var n=this;r.on("connecting",s),r.on("connect",(function(){r.id=n.generateId(e)})),this.autoConnect&&s()}function s(){~f(n.connecting,r)||n.connecting.push(r)}return r},d.prototype.destroy=function(e){var t=f(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},d.prototype.packet=function(e){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(r){for(var n=0;n<r.length;n++)t.engine.write(r[n],e.options);t.encoding=!1,t.processPacketQueue()})))},d.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},d.prototype.cleanup=function(){u("cleanup");for(var e=this.subs.length,t=0;t<e;t++){this.subs.shift().destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},d.prototype.close=d.prototype.disconnect=function(){u("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},d.prototype.onclose=function(e){u("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",e),this._reconnection&&!this.skipReconnect&&this.reconnect()},d.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var e=this;if(this.backoff.attempts>=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 r=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(r)}})}},d.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},function(e,t,r){"use strict";var n=r(183),i=r(876),s=r(884),o=r(885);t.polling=function(e){var t=!1,r=!1,o=!1!==e.jsonp;if("undefined"!=typeof location){var a="https:"===location.protocol,c=location.port;c||(c=a?443:80),t=e.hostname!==location.hostname||c!==e.port,r=e.secure!==a}if(e.xdomain=t,e.xscheme=r,"open"in new n(e)&&!e.forceJSONP)return new i(e);if(!o)throw new Error("JSONP disabled");return new s(e)},t.websocket=o},function(e,t,r){"use strict";var n=r(185),i=r(109),s=r(69),o=r(110),a=r(336),c=r(2)("engine.io-client:polling");e.exports=f;var u=null!=new(r(183))({xdomain:!1}).responseType;function f(e){var t=e&&e.forceBase64;u&&!t||(this.supportsBinary=!1),n.call(this,e)}o(f,n),f.prototype.name="polling",f.prototype.doOpen=function(){this.poll()},f.prototype.pause=function(e){var t=this;function r(){c("paused"),t.readyState="paused",e()}if(this.readyState="pausing",this.polling||!this.writable){var n=0;this.polling&&(c("we are currently polling - waiting to pause"),n++,this.once("pollComplete",(function(){c("pre-pause polling complete"),--n||r()}))),this.writable||(c("we are currently writing - waiting to pause"),n++,this.once("drain",(function(){c("pre-pause writing complete"),--n||r()})))}else r()},f.prototype.poll=function(){c("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},f.prototype.onData=function(e){var t=this;c("polling got data %s",e);s.decodePayload(e,this.socket.binaryType,(function(e,r,n){if("opening"===t.readyState&&t.onOpen(),"close"===e.type)return t.onClose(),!1;t.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():c('ignoring poll - transport state "%s"',this.readyState))},f.prototype.doClose=function(){var e=this;function t(){c("writing close packet"),e.write([{type:"close"}])}"open"===this.readyState?(c("transport open - closing"),t()):(c("transport not open - deferring close"),this.once("open",t))},f.prototype.write=function(e){var t=this;this.writable=!1;var r=function(){t.writable=!0,t.emit("drain")};s.encodePayload(e,this.supportsBinary,(function(e){t.doWrite(e,r)}))},f.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",r="";return!1!==this.timestampRequests&&(e[this.timestampParam]=a()),this.supportsBinary||e.sid||(e.b64=1),e=i.encode(e),this.port&&("https"===t&&443!==Number(this.port)||"http"===t&&80!==Number(this.port))&&(r=":"+this.port),e.length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+r+this.path+e}},function(e,t,r){"use strict";(function(t){var n=r(878),i=Object.prototype.toString,s="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===i.call(Blob),o="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===i.call(File);e.exports=function e(r){if(!r||"object"!=typeof r)return!1;if(n(r)){for(var i=0,a=r.length;i<a;i++)if(e(r[i]))return!0;return!1}if("function"==typeof t&&t.isBuffer&&t.isBuffer(r)||"function"==typeof ArrayBuffer&&r instanceof ArrayBuffer||s&&r instanceof Blob||o&&r instanceof File)return!0;if(r.toJSON&&"function"==typeof r.toJSON&&1===arguments.length)return e(r.toJSON(),!0);for(var c in r)if(Object.prototype.hasOwnProperty.call(r,c)&&e(r[c]))return!0;return!1}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n,i="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),s={},o=0,a=0;function c(e){var t="";do{t=i[e%64]+t,e=Math.floor(e/64)}while(e>0);return t}function u(){var e=c(+new Date);return e!==n?(o=0,n=e):e+"."+c(o++)}for(;a<64;a++)s[i[a]]=a;u.encode=c,u.decode=function(e){var t=0;for(a=0;a<e.length;a++)t=64*t+s[e.charAt(a)];return t},e.exports=u},function(e,t,r){"use strict";var n=[].indexOf;e.exports=function(e,t){if(n)return e.indexOf(t);for(var r=0;r<e.length;++r)if(e[r]===t)return r;return-1}},function(e,t,r){"use strict";var n=r(181),i=r(182),s=r(887),o=r(339),a=r(340),c=r(2)("socket.io-client:socket"),u=r(109),f=r(335);e.exports=d;var h={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},l=i.prototype.emit;function d(e,t,r){this.io=e,this.nsp=t,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},r&&r.query&&(this.query=r.query),this.io.autoConnect&&this.open()}i(d.prototype),d.prototype.subEvents=function(){if(!this.subs){var e=this.io;this.subs=[o(e,"open",a(this,"onopen")),o(e,"packet",a(this,"onpacket")),o(e,"close",a(this,"onclose"))]}},d.prototype.open=d.prototype.connect=function(){return this.connected||(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting")),this},d.prototype.send=function(){var e=s(arguments);return e.unshift("message"),this.emit.apply(this,e),this},d.prototype.emit=function(e){if(h.hasOwnProperty(e))return l.apply(this,arguments),this;var t=s(arguments),r={type:(void 0!==this.flags.binary?this.flags.binary:f(t))?n.BINARY_EVENT:n.EVENT,data:t,options:{}};return r.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof t[t.length-1]&&(c("emitting packet with ack id %d",this.ids),this.acks[this.ids]=t.pop(),r.id=this.ids++),this.connected?this.packet(r):this.sendBuffer.push(r),this.flags={},this},d.prototype.packet=function(e){e.nsp=this.nsp,this.io.packet(e)},d.prototype.onopen=function(){if(c("transport is open - connecting"),"/"!==this.nsp)if(this.query){var e="object"==typeof this.query?u.encode(this.query):this.query;c("sending connect packet with query %s",e),this.packet({type:n.CONNECT,query:e})}else this.packet({type:n.CONNECT})},d.prototype.onclose=function(e){c("close (%s)",e),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",e)},d.prototype.onpacket=function(e){var t=e.nsp===this.nsp,r=e.type===n.ERROR&&"/"===e.nsp;if(t||r)switch(e.type){case n.CONNECT:this.onconnect();break;case n.EVENT:case n.BINARY_EVENT:this.onevent(e);break;case n.ACK:case n.BINARY_ACK:this.onack(e);break;case n.DISCONNECT:this.ondisconnect();break;case n.ERROR:this.emit("error",e.data)}},d.prototype.onevent=function(e){var t=e.data||[];c("emitting event %j",t),null!=e.id&&(c("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?l.apply(this,t):this.receiveBuffer.push(t)},d.prototype.ack=function(e){var t=this,r=!1;return function(){if(!r){r=!0;var i=s(arguments);c("sending ack %j",i),t.packet({type:f(i)?n.BINARY_ACK:n.ACK,id:e,data:i})}}},d.prototype.onack=function(e){var t=this.acks[e.id];"function"==typeof t?(c("calling ack %s with %j",e.id,e.data),t.apply(this,e.data),delete this.acks[e.id]):c("bad ack %s",e.id)},d.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},d.prototype.emitBuffered=function(){var e;for(e=0;e<this.receiveBuffer.length;e++)l.apply(this,this.receiveBuffer[e]);for(this.receiveBuffer=[],e=0;e<this.sendBuffer.length;e++)this.packet(this.sendBuffer[e]);this.sendBuffer=[]},d.prototype.ondisconnect=function(){c("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},d.prototype.destroy=function(){if(this.subs){for(var e=0;e<this.subs.length;e++)this.subs[e].destroy();this.subs=null}this.io.destroy(this)},d.prototype.close=d.prototype.disconnect=function(){return this.connected&&(c("performing disconnect (%s)",this.nsp),this.packet({type:n.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},d.prototype.compress=function(e){return this.flags.compress=e,this},d.prototype.binary=function(e){return this.flags.binary=e,this}},function(e,t,r){"use strict";e.exports=function(e,t,r){return e.on(t,r),{destroy:function(){e.removeListener(t,r)}}}},function(e,t,r){"use strict";var n=[].slice;e.exports=function(e,t){if("string"==typeof t&&(t=e[t]),"function"!=typeof t)throw new Error("bind() requires a function");var r=n.call(arguments,2);return function(){return t.apply(e,r.concat(n.call(arguments)))}}},function(e,t,r){"use strict";const n=r(52),i=r(889),{Buffer:s}=r(0),{CLOSE_TIMEOUT:o}=r(180),a=r(320),c=r(2),u=c("libp2p:webrtc-star:socket");u.error=c("libp2p:webrtc-star:socket:error");const f=(e,t)=>{if(e&&t)try{return a(e,t)}catch(r){return u.error(r),a("0.0.0.0",t)}};e.exports=(e,t={})=>{const{sink:r,source:a}=i.duplex(e),c=t.remoteAddr||f(e.remoteAddress,e.remotePort),h=f(e.localAddress,e.localPort),l={async sink(e){t.signal&&(e=n(e,t.signal));try{await r(async function*(){for await(const t of e)yield s.isBuffer(t)?t:t.slice()}())}catch(i){"aborted"!==i.type&&u.error(i)}},source:t.signal?n(a,t.signal):a,conn:e,localAddr:h,remoteAddr:c,timeline:{open:Date.now()},close(){if(!e.destroyed)return new Promise((t,r)=>{const n=Date.now(),i=setTimeout(()=>{if(l.remoteAddr){const{host:e,port:t}=l.remoteAddr.toOptions();u("timeout closing socket to %s:%s after %dms, destroying it manually",e,t,Date.now()-n)}e.destroyed||e.destroy()},o);e.once("close",()=>{t()}),e.end(e=>{if(clearTimeout(i),l.timeline.close=Date.now(),e)return r(e)})})}};return e.once("close",()=>{l.timeline.close||(l.timeline.close=Date.now())}),l}},function(e,t,r){"use strict";const n=r(173);e.exports=e=>async t=>{t=n(t);const r=e=>{"function"==typeof e.return&&e.return()};let i=null,s=null;const o=e=>{i=e,s&&s(e),r(t)};let a=null,c=!1;const u=()=>{c=!0,a&&a()};let f=null,h=!1;const l=()=>{h=!0,f&&f()};let d=null;const p=()=>{d&&d()};e.once("error",o),e.once("close",u),e.once("finish",l);try{for await(const r of t){if(!e.writable||e.destroyed||i)break;!1===e.write(r)&&await new Promise((t,r)=>{a=d=t,s=r,e.once("drain",p)})}}catch(b){i||e.destroy(),i=b}try{if(e.writable&&e.end(),await(r(t),new Promise((e,t)=>{if(c||h||i)return e();f=a=e,s=t})),i)throw i}finally{e.removeListener("error",o),e.removeListener("close",u),e.removeListener("finish",l),e.removeListener("drain",p)}}},function(e,t,r){"use strict";const n=r(342),i=r(187);e.exports=e=>({sink:n(e),source:i(e)})},function(e,t,r){"use strict";const n=r(15);(t=e.exports).cleanUrlSIO=function(e){const t=e.toString().split("/"),r=e.protos()[1].name,i=e.protos()[2].name,s=e.stringTuples()[1][1];if("tcp"!==r||"ws"!==i&&"wss"!==i)throw new Error("invalid multiaddr: "+e.toString());return n.isName(e)?"ws"===i?"http://"+t[2]+(80===s?"":":"+s):"wss"===i?"https://"+t[2]+(443===s?"":":"+s):void 0:"http://"+t[2]+":"+t[4]},t.cleanMultiaddr=function(e){const t="/libp2p-webrtc-star";if(-1!==e.indexOf(t)){e=e.substring(t.length,e.length);let r=n(e);const i=r.stringTuples().filter(e=>421===e[0])[0];r=r.decapsulate("p2p"),r=r.encapsulate("/p2p-webrtc-star"),r=r.encapsulate("/p2p/".concat(i[1])),e=r.toString()}return e}},function(e,t,r){"use strict";e.exports=e=>{e=e||1<<20;const t=t=>{if(t.data&&t.data.length>e)throw Object.assign(new Error("message size too large!"),{code:"ERR_MSG_TOO_BIG"})};return e=>async function*(){for await(const r of e)Array.isArray(r)?r.forEach(t):t(r),yield r}()},e.exports.MAX_MSG_SIZE=1<<20},function(e,t,r){"use strict";const n=Object.freeze({NEW_STREAM:0,MESSAGE_RECEIVER:1,MESSAGE_INITIATOR:2,CLOSE_RECEIVER:3,CLOSE_INITIATOR:4,RESET_RECEIVER:5,RESET_INITIATOR:6});t.MessageTypes=n,t.InitiatorMessageTypes=Object.freeze({NEW_STREAM:n.NEW_STREAM,MESSAGE:n.MESSAGE_INITIATOR,CLOSE:n.CLOSE_INITIATOR,RESET:n.RESET_INITIATOR}),t.ReceiverMessageTypes=Object.freeze({MESSAGE:n.MESSAGE_RECEIVER,CLOSE:n.CLOSE_RECEIVER,RESET:n.RESET_RECEIVER}),t.MessageTypeNames=Object.freeze(Object.entries(n).reduce((e,t)=>(e[t[1]]=t[0],e),{}))},function(e,t,r){"use strict";t.custom="inspect"},function(e,t,r){"use strict";var n=r(908);e.exports=function(){var e=n(),t=n();return[{source:e.source,sink:t.sink},{source:t.source,sink:e.sink}]}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XXHandshake=void 0;var n=r(0),i=r(909),s=r(53),o=r(85),a=r(111);function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.XXHandshake=class{constructor(e,t,r,s,o,a,u){c(this,"isInitiator",void 0),c(this,"session",void 0),c(this,"remotePeer",void 0),c(this,"remoteEarlyData",void 0),c(this,"payload",void 0),c(this,"connection",void 0),c(this,"xx",void 0),c(this,"staticKeypair",void 0),c(this,"prologue",void 0),this.isInitiator=e,this.payload=t,this.prologue=r,this.staticKeypair=s,this.connection=o,a&&(this.remotePeer=a),this.xx=u||new i.XX,this.session=this.xx.initSession(this.isInitiator,this.prologue,this.staticKeypair),this.remoteEarlyData=n.Buffer.alloc(0)}async propose(){if((0,o.logLocalStaticKeys)(this.session.hs.s),this.isInitiator){(0,o.logger)("Stage 0 - Initiator starting to send first message.");const e=this.xx.sendMessage(this.session,n.Buffer.alloc(0));this.connection.writeLP((0,a.encode0)(e)),(0,o.logger)("Stage 0 - Initiator finished sending first message."),(0,o.logLocalEphemeralKeys)(this.session.hs.e)}else{(0,o.logger)("Stage 0 - Responder waiting to receive first message...");const e=(0,a.decode0)((await this.connection.readLP()).slice()),{valid:t}=this.xx.recvMessage(this.session,e);if(!t)throw new Error("xx handshake stage 0 validation fail");(0,o.logger)("Stage 0 - Responder received first message."),(0,o.logRemoteEphemeralKey)(this.session.hs.re)}}async exchange(){if(this.isInitiator){(0,o.logger)("Stage 1 - Initiator waiting to receive first message from responder...");const t=(0,a.decode1)((await this.connection.readLP()).slice()),{plaintext:r,valid:n}=this.xx.recvMessage(this.session,t);if(!n)throw new Error("xx handshake stage 1 validation fail");(0,o.logger)("Stage 1 - Initiator received the message."),(0,o.logRemoteEphemeralKey)(this.session.hs.re),(0,o.logRemoteStaticKey)(this.session.hs.rs),(0,o.logger)("Initiator going to check remote's signature...");try{const e=await(0,s.decodePayload)(r);this.remotePeer=this.remotePeer||await(0,s.getPeerIdFromPayload)(e),this.remotePeer=await(0,s.verifySignedPayload)(t.ns,e,this.remotePeer),this.setRemoteEarlyData(e.data)}catch(e){throw new Error("Error occurred while verifying signed payload: ".concat(e.message))}(0,o.logger)("All good with the signature!")}else{(0,o.logger)("Stage 1 - Responder sending out first message with signed payload and static key.");const e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP((0,a.encode1)(e)),(0,o.logger)("Stage 1 - Responder sent the second handshake message with signed payload."),(0,o.logLocalEphemeralKeys)(this.session.hs.e)}}async finish(){if(this.isInitiator){(0,o.logger)("Stage 2 - Initiator sending third handshake message.");const e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP((0,a.encode2)(e)),(0,o.logger)("Stage 2 - Initiator sent message with signed payload.")}else{(0,o.logger)("Stage 2 - Responder waiting for third handshake message...");const t=(0,a.decode2)((await this.connection.readLP()).slice()),{plaintext:r,valid:n}=this.xx.recvMessage(this.session,t);if(!n)throw new Error("xx handshake stage 2 validation fail");(0,o.logger)("Stage 2 - Responder received the message, finished handshake.");try{const e=await(0,s.decodePayload)(r);this.remotePeer=this.remotePeer||await(0,s.getPeerIdFromPayload)(e),await(0,s.verifySignedPayload)(this.session.hs.rs,e,this.remotePeer),this.setRemoteEarlyData(e.data)}catch(e){throw new Error("Error occurred while verifying signed payload: ".concat(e.message))}}(0,o.logCipherState)(this.session)}encrypt(e,t){const r=this.getCS(t);return this.xx.encryptWithAd(r,n.Buffer.alloc(0),e)}decrypt(e,t){const r=this.getCS(t,!1);return this.xx.decryptWithAd(r,n.Buffer.alloc(0),e)}getRemoteStaticKey(){return this.session.hs.rs}getCS(e,t=!0){if(!e.cs1||!e.cs2)throw new Error("Handshake not completed properly, cipher state does not exist.");return this.isInitiator?t?e.cs1:e.cs2:t?e.cs2:e.cs1}setRemoteEarlyData(e){e&&(this.remoteEarlyData=n.Buffer.from(e.buffer,e.byteOffset,e.length))}}},function(e,t,r){"use strict";(function(t){const n=r(39),i=r(911),s=t.alloc(8,0),o=t.alloc(64,0);o[0]=128;const a=new Uint32Array([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]);class c{constructor(){this.state=new Uint32Array(8),this.msg=new Uint32Array(64),this.block=t.allocUnsafe(64),this.size=-1}init(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.size=0,this}update(e){return n(t.isBuffer(e)),this._update(e,e.length),this}final(){return this._final(t.allocUnsafe(32))}_update(e,t){n(-1!==this.size,"Context is not initialized.");let r=63&this.size,i=0;if(this.size+=t,r>0){let n=64-r;if(n>t&&(n=t),e.copy(this.block,r,i,i+n),r+=n,t-=n,i+=n,r<64)return;this._transform(this.block,0)}for(;t>=64;)this._transform(e,i),i+=64,t-=64;t>0&&e.copy(this.block,0,i,i+t)}_final(e){n(-1!==this.size,"Context is not initialized.");const t=63&this.size,r=8*this.size;p(s,r*(1/4294967296)>>>0,0),p(s,r>>>0,4),this._update(o,1+(119-t&63)),this._update(s,8);for(let n=0;n<8;n++)p(e,this.state[n],4*n),this.state[n]=0;for(let n=0;n<64;n++)this.msg[n]=0;for(let n=0;n<64;n++)this.block[n]=0;return this.size=-1,e}_transform(e,t){const r=this.msg;let n=this.state[0],i=this.state[1],s=this.state[2],o=this.state[3],c=this.state[4],p=this.state[5],b=this.state[6],y=this.state[7],m=0;for(;m<16;m++)r[m]=(v=t+4*m,16777216*(g=e)[v++]+65536*g[v++]+256*g[v++]+g[v]);for(var g,v,w;m<64;m++)r[m]=(((w=r[m-2])>>>17|w<<15)^(w>>>19|w<<13)^w>>>10)+r[m-7]+h(r[m-15])+r[m-16];for(m=0;m<64;m++){const e=y+f(c)+l(c,p,b)+a[m]+r[m],t=u(n)+d(n,i,s);y=b,b=p,p=c,c=o+e>>>0,o=s,s=i,i=n,n=e+t>>>0}this.state[0]+=n,this.state[1]+=i,this.state[2]+=s,this.state[3]+=o,this.state[4]+=c,this.state[5]+=p,this.state[6]+=b,this.state[7]+=y}static hash(){return new c}static hmac(){return new i(c,64)}static digest(e){return c.ctx.init().update(e).final()}static root(e,r){return n(t.isBuffer(e)&&32===e.length),n(t.isBuffer(r)&&32===r.length),c.ctx.init().update(e).update(r).final()}static multi(e,t,r){const{ctx:n}=c;return n.init(),n.update(e),n.update(t),r&&n.update(r),n.final()}static mac(e,t){return c.hmac().init(t).update(e).final()}}function u(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 h(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function l(e,t,r){return r^e&(t^r)}function d(e,t,r){return e&t|r&(e|t)}function p(e,t,r){return e[r++]=t>>>24,e[r++]=t>>>16,e[r++]=t>>>8,e[r++]=t,r}c.native=0,c.id="SHA256",c.size=32,c.bits=256,c.blockSize=64,c.zero=t.alloc(32,0),c.ctx=new c,e.exports=c}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports=h;var n,i=r(54),s=i.LongBits,o=i.base64,a=i.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function u(){}function f(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new c(u,0,0),this.tail=this.head,this.states=null}function l(e,t,r){t[r]=255&e}function d(e,t){this.len=e,this.next=void 0,this.val=t}function p(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function b(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}h.create=i.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h},h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},d.prototype=Object.create(c.prototype),d.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new d((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(p,10,s.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=s.from(e);return this._push(p,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=s.from(e).zzEncode();return this._push(p,t.length(),t)},h.prototype.bool=function(e){return this._push(l,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(b,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=s.from(e);return this._push(b,4,t.lo)._push(b,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var y=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(l,1,0);if(i.isString(e)){var r=h.alloc(t=o.length(e));o.decode(e,r,0),e=r}return this.uint32(t)._push(y,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(l,1,0)},h.prototype.fork=function(){return this.states=new f(this),this.head=this.tail=new c(u,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(u,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},h._configure=function(e){n=e}},function(e,t,r){"use strict";e.exports=c;var n,i=r(54),s=i.LongBits,o=i.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var u,f="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")};function h(){var e=new s(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function l(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function d(){if(this.pos+8>this.len)throw a(this,8);return new s(l(this.buf,this.pos+=4),l(this.buf,this.pos+=4))}c.create=i.Buffer?function(e){return(c.create=function(e){return i.Buffer.isBuffer(e)?new n(e):f(e)})(e)}:f,c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=(u=4294967295,function(){if(u=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return u;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return u}),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return l(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|l(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},c.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e;var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return d.call(this)[t](!0)},sfixed64:function(){return d.call(this)[t](!1)}})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractHandshake=t.MIN_NONCE=void 0;var n=r(0),i=u(r(928)),s=u(r(188)),o=u(r(350)),a=r(53),c=r(85);function u(e){return e&&e.__esModule?e:{default:e}}t.MIN_NONCE=0;t.AbstractHandshake=class{encryptWithAd(e,t,r){const n=this.encrypt(e.k,e.n,t,r);return this.setNonce(e,this.incrementNonce(e.n)),n}decryptWithAd(e,t,r){const{plaintext:n,valid:i}=this.decrypt(e.k,e.n,t,r);return this.setNonce(e,this.incrementNonce(e.n)),{plaintext:n,valid:i}}hasKey(e){return!this.isEmptyKey(e.k)}setNonce(e,t){e.n=t}createEmptyKey(){return n.Buffer.alloc(32)}isEmptyKey(e){return this.createEmptyKey().equals(e)}incrementNonce(e){return e+1}nonceToBytes(e){const t=n.Buffer.alloc(12);return t.writeUInt32LE(e,4),t}encrypt(e,t,r,s){const o=this.nonceToBytes(t),a=new i.default;return s=n.Buffer.from(s),a.init(e,o),a.aad(r),a.encrypt(s),n.Buffer.concat([s,a.final()])}encryptAndHash(e,t){let r;return r=this.hasKey(e.cs)?this.encryptWithAd(e.cs,e.h,t):t,this.mixHash(e,r),r}decrypt(e,t,r,s){const o=this.nonceToBytes(t),a=new i.default,c=(s=n.Buffer.from(s)).slice(s.length-16);return s=s.slice(0,s.length-16),a.init(e,o),a.aad(r),a.decrypt(s),{plaintext:s,valid:a.verify(c)}}decryptAndHash(e,t){let r,n=!0;return this.hasKey(e.cs)?({plaintext:r,valid:n}=this.decryptWithAd(e.cs,e.h,t)):r=t,this.mixHash(e,t),{plaintext:r,valid:n}}dh(e,t){try{const r=s.default.derive(t,e),i=n.Buffer.alloc(32);return r.copy(i),i}catch(r){return(0,c.logger)(r.message),n.Buffer.alloc(32)}}mixHash(e,t){e.h=this.getHash(e.h,t)}getHash(e,t){return o.default.digest(n.Buffer.from([...e,...t]))}mixKey(e,t){const[r,n]=(0,a.getHkdf)(e.ck,t);e.cs=this.initializeKey(n),e.ck=r}initializeKey(e){return{k:e,n:0}}initializeSymmetric(e){const t=n.Buffer.from(e,"utf-8"),r=this.hashProtocolName(t),i=r,s=this.createEmptyKey();return{cs:this.initializeKey(s),ck:i,h:r}}hashProtocolName(e){if(e.length<=32){const t=n.Buffer.alloc(32);return e.copy(t),t}return this.getHash(e,n.Buffer.alloc(0))}split(e){const[t,r]=(0,a.getHkdf)(e.ck,n.Buffer.alloc(0));return{cs1:this.initializeKey(t),cs2:this.initializeKey(r)}}writeMessageRegular(e,t){const r=this.encryptWithAd(e,n.Buffer.alloc(0),t);return{ne:this.createEmptyKey(),ns:n.Buffer.alloc(0),ciphertext:r}}readMessageRegular(e,t){return this.decryptWithAd(e,n.Buffer.alloc(0),t.ciphertext)}}},function(e,t,r){"use strict";(function(e,n){Object.defineProperty(t,"__esModule",{value:!0}),t.hasNextTick=t.hasSetImmediate=void 0,t.fallback=f,t.wrap=h;var i,s=r(355),o=(i=s)&&i.__esModule?i:{default:i};var a,c=t.hasSetImmediate="function"==typeof e&&e,u=t.hasNextTick="object"==typeof n&&"function"==typeof n.nextTick;function f(e){setTimeout(e,0)}function h(e){return function(t){var r=(0,o.default)(arguments,1);e((function(){t.apply(null,r)}))}}a=c?e:u?n.nextTick:f,t.default=h(a)}).call(this,r(89).setImmediate,r(8))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){t|=0;for(var r=Math.max(e.length-t,0),n=Array(r),i=0;i<r;i++)n[i]=e[t+i];return n},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAsync=void 0;var n,i=r(988),s=(n=i)&&n.__esModule?n:{default:n};var o="function"==typeof Symbol;function a(e){return o&&"AsyncFunction"===e[Symbol.toStringTag]}t.default=function(e){return a(e)?(0,s.default)(e):e},t.isAsync=a},function(e,t,r){"use strict";const n=r(80),{Buffer:i}=r(0),{fromB58String:s,toB58String:o}=r(22).multihash,a=r(1007),c=r(21),u=r(1),f=r(2),h=f("ipfs:ipns:pubsub");h.error=f("ipfs:ipns:pubsub:error");e.exports=c(class{constructor(e,t,r){this._pubsub=e,this._subscriptions={},this._handleSubscriptionKey=this._handleSubscriptionKey.bind(this),this._pubsubDs=new a(e,t,r,n.validator,this._handleSubscriptionKey)}async put(e,t){return this._pubsubDs.put(e,t)}async get(e){let t,r;try{t=await this._pubsubDs.get(e)}catch(i){r=i}if(e.slice(0,n.namespaceLength).toString()===n.namespace){const t=o(e),r=o(e.slice(n.namespaceLength));this._subscriptions[t]=r,h("subscribed to pubsub topic ".concat(t,", id ").concat(r))}if(r)throw r;return t}_handleSubscriptionKey(e){i.isBuffer(e)&&(e=o(e));const t=this._subscriptions[e];if(!t)throw u(new Error("key ".concat(e," does not correspond to a subscription")),"ERR_INVALID_KEY");let r;try{r=n.getIdKeys(s(t))}catch(a){throw h.error(a),a}return r.routingKey.toBuffer()}getSubscriptions(){return Object.values(this._subscriptions).filter(Boolean).map(e=>"".concat(n.namespace).concat(e))}async cancel(e){if("string"!=typeof e)throw u(new Error("invalid subscription name"),"ERR_INVALID_SUBSCRIPTION_NAME");e.startsWith(n.namespace)&&(e=e.substring(n.namespaceLength));const t=Object.keys(this._subscriptions).find(t=>this._subscriptions[t]===e);if(!t)return{canceled:!1};const r=i.from(t);return this._pubsubDs.unsubscribe(r),this._subscriptions[t]=void 0,h("unsubscribed pubsub ".concat(t,": ").concat(e)),{canceled:!0}}},{className:"IpnsPubsubDatastore",symbolName:"@js-ipfs/ipns/IpnsPubsubDatastore"})},function(e,t,r){e.exports=r(359)},function(e,t,r){"use strict";const n=r(360);e.exports=n},function(e,t,r){"use strict";const n=r(2)("ipfs"),i=r(26),{isTest:s}=r(364),o=r(366),a=r(367),{Buffer:c}=r(0),u=r(6),f=r(28),h=r(49),l=r(15),d=r(27),p=r(11),b=r(22),y=b.multihash,m=r(4),{NotInitializedError:g}=r(75),v=r(97),w=r(1067);e.exports={create:async function(e){const t=(e=i({init:!0,start:!0,EXPERIMENTAL:{},preload:{enabled:!s,addresses:["/dns4/node0.preload.ipfs.io/https","/dns4/node1.preload.ipfs.io/https","/dns4/node2.preload.ipfs.io/https","/dns4/node3.preload.ipfs.io/https"]}},e)).silent?n:console.log,r=new w,{api:o}=r.update({init:v.init({apiManager:r,print:t,options:e}),dns:v.dns(),isOnline:v.isOnline({})},async()=>{throw new g});return e.init?(await o.init(),e.start?o.start():o):o},crypto:f,isIPFS:h,Buffer:c,CID:m,multiaddr:l,multibase:d,multihash:y,multihashing:b,multicodec:p,PeerId:u,globSource:o,urlSource:a}},function(e,t,r){"use strict";e.exports=function(e){function t(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return n.colors[Math.abs(t)%n.colors.length]}function n(e){let r;function o(...e){if(!o.enabled)return;const t=o,i=Number(new Date),s=i-(r||i);t.diff=s,t.prev=r,t.curr=i,r=i,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,i)=>{if("%%"===r)return r;a++;const s=n.formatters[i];if("function"==typeof s){const n=e[a];r=s.call(t,n),e.splice(a,1),a--}return r}),n.formatArgs.call(t,e);(t.log||n.log).apply(t,e)}return o.namespace=e,o.enabled=n.enabled(e),o.useColors=n.useColors(),o.color=t(e),o.destroy=i,o.extend=s,"function"==typeof n.init&&n.init(o),n.instances.push(o),o}function i(){const e=n.instances.indexOf(this);return-1!==e&&(n.instances.splice(e,1),!0)}function s(e,t){const r=n(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function o(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){const e=[...n.names.map(o),...n.skips.map(o).map(e=>"-"+e)].join(",");return n.enable(""),e},n.enable=function(e){let t;n.save(e),n.names=[],n.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(t=0;t<i;t++)r[t]&&("-"===(e=r[t].replace(/\*/g,".*?"))[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")));for(t=0;t<n.instances.length;t++){const e=n.instances[t];e.enabled=n.enabled(e.namespace)}},n.enabled=function(e){if("*"===e[e.length-1])return!0;let t,r;for(t=0,r=n.skips.length;t<r;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;t<r;t++)if(n.names[t].test(e))return!0;return!1},n.humanize=r(362),Object.keys(e).forEach(t=>{n[t]=e[t]}),n.instances=[],n.names=[],n.skips=[],n.formatters={},n.selectColor=t,n.enable(n.load()),n}},function(e,t,r){"use strict";var n=1e3,i=6e4,s=60*i,o=24*s;function a(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return function(e){if((e=String(e)).length>100)return;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)return;var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*r;case"weeks":case"week":case"w":return 6048e5*r;case"days":case"day":case"d":return r*o;case"hours":case"hour":case"hrs":case"hr":case"h":return r*s;case"minutes":case"minute":case"mins":case"min":case"m":return r*i;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===r&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=o)return a(e,t,o,"day");if(t>=s)return a(e,t,s,"hour");if(t>=i)return a(e,t,i,"minute");if(t>=n)return a(e,t,n,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=o)return Math.round(e/o)+"d";if(t>=s)return Math.round(e/s)+"h";if(t>=i)return Math.round(e/i)+"m";if(t>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,r){"use strict";e.exports=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}},function(e,t,r){"use strict";(function(t){const n=r(365),i="object"==typeof window&&"object"==typeof document&&9===document.nodeType,s=n(),o=i&&!s,a=s&&!i,c=s&&i,u=void 0!==t&&void 0!==t.release&&"node"===t.release.name&&!s,f="function"==typeof importScripts&&"undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,h=void 0!==t&&void 0!=={NODE_ENV:"production"}&&!1;e.exports={isTest:h,isElectron:s,isElectronMain:a,isElectronRenderer:c,isNode:u,isBrowser:o,isWebWorker:f,isEnvWithDom:i}}).call(this,r(8))},function(e,t,r){"use strict";(function(t){e.exports=function(){return"undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type||(!(void 0===t||"object"!=typeof t.versions||!t.versions.electron)||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}}).call(this,r(8))},function(e,t){},function(e,t,r){"use strict";const n=r(115);e.exports=async function*(e,t){const r=new n,i=await r.get(e,t);yield{path:decodeURIComponent(new URL(e).pathname.split("/").pop()||""),content:i.iterator()}}},function(e,t,r){"use strict";var n=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n)return n;throw new Error("unable to locate global object")}();e.exports=t=n.fetch,t.default=n.fetch.bind(n),t.Headers=n.Headers,t.Request=n.Request,t.Response=n.Response},function(e,t,r){"use strict";const{URLWithLegacySupport:n,format:i}=r(197);e.exports=(e,t={},r={},s)=>{let o,a=t.protocol?t.protocol.replace(":",""):"http";a=(r[a]||s||a)+":";try{o=new n(e)}catch(u){o={}}const c=Object.assign({},t,{protocol:a||o.protocol,host:t.host||o.host});return new n(e,i(c)).toString()}},function(e,t,r){"use strict";e.exports=r(57).TextDecoder},function(e,t,r){"use strict";t.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=u(e),o=n[0],a=n[1],c=new s(function(e,t,r){return 3*(t+r)/4-r}(0,o,a)),f=0,h=a>0?o-4:o;for(r=0;r<h;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],c[f++]=t>>16&255,c[f++]=t>>8&255,c[f++]=255&t;2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,c[f++]=255&t);1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,c[f++]=t>>8&255,c[f++]=255&t);return c},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,s=[],o=0,a=r-i;o<a;o+=16383)s.push(f(e,o,o+16383>a?a:o+16383));1===i?(t=e[r-1],s.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],s.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return s.join("")};for(var n=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=o.length;a<c;++a)n[a]=o[a],i[o.charCodeAt(a)]=a;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function f(e,t,r){for(var i,s,o=[],a=t;a<r;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(n[(s=i)>>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t,r){"use strict";var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,r){"use strict";const n=r(42),{Buffer:i}=r(0),s=r(374),o=r(375),a=[["identity","\0",()=>({encode:e=>i.from(e).toString(),decode:e=>i.from(e)}),""],["base2","0",o(1),"01"],["base8","7",o(3),"01234567"],["base10","9",n,"0123456789"],["base16","f",o(4),"0123456789abcdef"],["base16upper","F",o(4),"0123456789ABCDEF"],["base32hex","v",o(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",o(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",o(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",o(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",o(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",o(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",o(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",o(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",o(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",n,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",n,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",n,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",n,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",o(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",o(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",o(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",o(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],c=a.reduce((e,t)=>(e[t[0]]=new s(t[0],t[1],t[2],t[3]),e),{}),u=a.reduce((e,t)=>(e[t[1]]=c[t[0]],e),{});e.exports={names:c,codes:u}},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports=class{constructor(e,t,r,i){this.name=e,this.code=t,this.codeBuf=n.from(this.code),this.alphabet=i,this.engine=r(i)}encode(e){return this.engine.encode(e)}decode(e){for(const t of e)if(this.alphabet&&this.alphabet.indexOf(t)<0)throw new Error("invalid character '".concat(t,"' in '").concat(e,"'"));return this.engine.decode(e)}}},function(e,t,r){"use strict";e.exports=e=>t=>({encode:r=>((e,t,r)=>{const n="="===t[t.length-1],i=(1<<r)-1;let s="",o=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],o+=8;o>r;)o-=r,s+=t[i&a>>o];if(o&&(s+=t[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s})(r,t,e),decode:r=>((e,t,r)=>{const n={};for(let u=0;u<t.length;++u)n[t[u]]=u;let i=e.length;for(;"="===e[i-1];)--i;const s=new Uint8Array(i*r/8|0);let o=0,a=0,c=0;for(let u=0;u<i;++u){const t=n[e[u]];if(void 0===t)throw new SyntaxError("Invalid character "+e[u]);a=a<<r|t,o+=r,o>=8&&(o-=8,s[c++]=255&a>>o)}if(o>=r||255&a<<8-o)throw new SyntaxError("Unexpected end of data");return s})(r,t,e)})},function(e,t,r){"use strict";e.exports=function e(t,r,i){r=r||[];var s=i=i||0;for(;t>=n;)r[i++]=255&t|128,t/=128;for(;-128&t;)r[i++]=255&t|128,t>>>=7;return r[i]=0|t,e.bytes=i-s+1,r};var n=Math.pow(2,31)},function(e,t,r){"use strict";e.exports=function e(t,r){var n,i=0,s=0,o=r=r||0,a=t.length;do{if(o>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[o++],i+=s<28?(127&n)<<s:(127&n)*Math.pow(2,s),s+=7}while(n>=128);return e.bytes=o-r,i}},function(e,t,r){"use strict";var n=Math.pow(2,7),i=Math.pow(2,14),s=Math.pow(2,21),o=Math.pow(2,28),a=Math.pow(2,35),c=Math.pow(2,42),u=Math.pow(2,49),f=Math.pow(2,56),h=Math.pow(2,63);e.exports=function(e){return e<n?1:e<i?2:e<s?3:e<o?4:e<a?5:e<c?6:e<u?7:e<f?8:e<h?9:10}},function(e,t,r){"use strict";const n=Object.freeze({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,blake3:30,"murmur3-128":34,"murmur3-32":35,"dbl-sha2-256":86,md4:212,md5:213,bmt:214,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,x11:4352,"sm3-256":21325,"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,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082});e.exports={names:n}},function(e,t,r){"use strict";const n=r(71),i=new Map;for(const s in n){const e=n[s];i.set(e,s)}e.exports=Object.freeze(i)},function(e,t,r){"use strict";const n=r(71),i=r(200).varintEncode,s={};for(const o in n){const e=n[o];s[o]=i(e)}e.exports=Object.freeze(s)},function(e,t,r){"use strict";const n=r(71),i={};for(const[s,o]of Object.entries(n))i[s.toUpperCase().replace(/-/g,"_")]=o;e.exports=Object.freeze(i)},function(e,t,r){"use strict";const n=r(71),i={};for(const[s,o]of Object.entries(n))void 0===i[o]&&(i[o]=s);e.exports=Object.freeze(i)},function(e,t,r){"use strict";const n=r(17),{Buffer:i}=r(0);var s={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(!i.isBuffer(e.multihash))return"multihash must be a Buffer";try{n.validate(e.multihash)}catch(t){let e=t.message;return e||(e="Multihash validation failed"),e}}};e.exports=s},function(e,t,r){"use strict";var n=r(386),i=r(388);e.exports=n,e.exports.parse=n,e.exports.stringify=i},function(e,t,r){"use strict";var n=r(387),i=["int32","int64","uint32","uint64","sint32","sint64","bool","fixed64","sfixed64","double","fixed32","sfixed32","float"],s=function(e){for(var t={};e.length;)switch(e[0]){case"[":case",":e.shift();var r=e.shift();if("("===r&&(r=e.shift(),e.shift()),"="!==e[0])throw new Error("Unexpected token in field options: "+e[0]);if(e.shift(),"]"===e[0])throw new Error("Unexpected ] in field option");t[r]=e.shift();break;case"]":return e.shift(),t;default:throw new Error("Unexpected token in field options: "+e[0])}throw new Error("No closing tag for field options")},o=function(e){for(var t={name:null,type:null,tag:-1,map:null,oneof:null,required:!1,repeated:!1,options:{}};e.length;)switch(e[0]){case"=":e.shift(),t.tag=Number(e.shift());break;case"map":if(t.type="map",t.map={from:null,to:null},e.shift(),"<"!==e[0])throw new Error("Unexpected token in map type: "+e[0]);if(e.shift(),t.map.from=e.shift(),","!==e[0])throw new Error("Unexpected token in map type: "+e[0]);if(e.shift(),t.map.to=e.shift(),">"!==e[0])throw new Error("Unexpected token in map type: "+e[0]);e.shift(),t.name=e.shift();break;case"repeated":case"required":case"optional":var r=e.shift();t.required="required"===r,t.repeated="repeated"===r,t.type=e.shift(),t.name=e.shift();break;case"[":t.options=s(e);break;case";":if(null===t.name)throw new Error("Missing field name");if(null===t.type)throw new Error("Missing type in message field: "+t.name);if(-1===t.tag)throw new Error("Missing tag number in message field: "+t.name);return e.shift(),t;default:throw new Error("Unexpected token in message field: "+e[0])}throw new Error("No ; found for message field")},a=function(e){for(var t={enums:[],options:{},messages:[],fields:[],extends:[],extensions:null};e.length;)switch(e[0]){case"map":case"repeated":case"optional":case"required":t.fields.push(o(e));break;case"enum":t.enums.push(p(e));break;case"message":t.messages.push(f(e));break;case"extensions":t.extensions=u(e);break;case"oneof":e.shift();var r=e.shift();if("{"!==e[0])throw new Error("Unexpected token in oneof: "+e[0]);for(e.shift();"}"!==e[0];){e.unshift("optional");var n=o(e);n.oneof=r,t.fields.push(n)}e.shift();break;case"extend":t.extends.push(c(e));break;case";":e.shift();break;case"reserved":for(e.shift();";"!==e[0];)e.shift();break;case"option":var i=b(e);if(void 0!==t.options[i.name])throw new Error("Duplicate option "+i.name);t.options[i.name]=i.value;break;default:e.unshift("optional"),t.fields.push(o(e))}return t},c=function(e){return{name:e[1],message:f(e)}},u=function(e){e.shift();var t=Number(e.shift());if(isNaN(t))throw new Error("Invalid from in extensions definition");if("to"!==e.shift())throw new Error("Expected keyword 'to' in extensions definition");var r=e.shift();if("max"===r&&(r=536870911),r=Number(r),isNaN(r))throw new Error("Invalid to in extensions definition");if(";"!==e.shift())throw new Error("Missing ; in extensions definition");return{from:t,to:r}},f=function(e){e.shift();var t=1,r=[],n={name:e.shift(),options:{},enums:[],extends:[],messages:[],fields:[]};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("{"===e[0]?t++:"}"===e[0]&&t--,!t)return e.shift(),r=a(r),n.enums=r.enums,n.messages=r.messages,n.fields=r.fields,n.extends=r.extends,n.extensions=r.extensions,n.options=r.options,n;r.push(e.shift())}if(t)throw new Error("No closing tag for message")},h=function(e){e.shift();var t=e.shift();if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},l=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 r={value:null,options:{}};return r.value=Number(e.shift()),"["===e[0]&&(r.options=s(e)),e.shift(),{name:t,val:r}},p=function(e){e.shift();var t={},r={name:e.shift(),values:{},options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),r;if("option"!==e[0]){var n=d(e);r.values[n.name]=n.val}else t=b(e),r.options[t.name]=t.value}throw new Error("No closing tag for enum")},b=function(e){for(var t=null,r=null,n=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")};e.length;){if(";"===e[0])return e.shift(),{name:t,value:r};switch(e[0]){case"option":e.shift();var i="("===e[0];if(i&&e.shift(),t=e.shift(),i){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}"."===e[0][0]&&(t+=e.shift());break;case"=":if(e.shift(),null===t)throw new Error("Expected key for option with value: "+e[0]);if(r=n(e.shift()),"optimize_for"===t&&!/^(SPEED|CODE_SIZE|LITE_RUNTIME)$/.test(r))throw new Error("Unexpected value for option optimize_for: "+r);"{"===r&&(r=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,"")},r={};e.length;){if("}"===e[0])return e.shift(),r;var n="("===e[0];n&&e.shift();var i=e.shift();if(n){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}var s=null;switch(e[0]){case":":if(void 0!==r[i])throw new Error("Duplicate option map key "+i);e.shift(),"{"===(s=t(e.shift()))&&(s=y(e)),r[i]=s,";"===e[0]&&e.shift();break;case"{":if(e.shift(),s=y(e),void 0===r[i]&&(r[i]=[]),!Array.isArray(r[i]))throw new Error("Duplicate option map key "+i);r[i].push(s);break;default:throw new Error("Unexpected token in option map: "+e[0])}}throw new Error("No closing tag for option map")},m=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},g=function(e){e.shift();var t={name:e.shift(),methods:[],options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;switch(e[0]){case"option":var r=b(e);if(void 0!==t.options[r.name])throw new Error("Duplicate option "+r.name);t.options[r.name]=r.value;break;case"rpc":t.methods.push(v(e));break;default:throw new Error("Unexpected token in service: "+e[0])}}throw new Error("No closing tag for service")},v=function(e){e.shift();var t={name:e.shift(),input_type:null,output_type:null,client_streaming:!1,server_streaming:!1,options:{}};if("("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.client_streaming=!0),t.input_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),"returns"!==e[0])throw new Error("Expected returns but found "+e[0]);if(e.shift(),"("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.server_streaming=!0),t.output_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),";"===e[0])return e.shift(),t;if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;if("option"!==e[0])throw new Error("Unexpected token in rpc options: "+e[0]);var r=b(e);if(void 0!==t.options[r.name])throw new Error("Duplicate option "+r.name);t.options[r.name]=r.value}throw new Error("No closing tag for rpc")};e.exports=function(e){for(var t=n(e.toString()),r=0;r<t.length;r++){var s;if(/^("|')([^'"]*)$/.test(t[r]))for(s=1===t[r].length?r+1:r;s<t.length;s++)if(/^[^'"\\]*(?:\\.[^'"\\]*)*("|')$/.test(t[s])){t=t.slice(0,r).concat(t.slice(r,s+1).join("")).concat(t.slice(s+1));break}}for(var o={syntax:3,package:null,imports:[],enums:[],messages:[],options:{},extends:[]},a=!0;t.length;){switch(t[0]){case"package":o.package=h(t);break;case"syntax":if(!a)throw new Error("Protobuf syntax version should be first thing in file");o.syntax=l(t);break;case"message":o.messages.push(f(t));break;case"enum":o.enums.push(p(t));break;case"option":var u=b(t);if(o.options[u.name])throw new Error("Duplicate option "+u.name);o.options[u.name]=u.value;break;case"import":o.imports.push(m(t));break;case"extend":o.extends.push(c(t));break;case"service":o.services||(o.services=[]),o.services.push(g(t));break;default:throw new Error("Unexpected token: "+t[0])}a=!1}return o.extends.forEach((function(e){o.messages.forEach((function(t){t.name===e.name&&e.message.fields.forEach((function(e){if(!t.extensions||e.tag<t.extensions.from||e.tag>t.extensions.to)throw new Error(t.name+" does not declare "+e.tag+" as an extension number");t.fields.push(e)}))}))})),o.messages.forEach((function(e){e.fields.forEach((function(t){var r,n,s,a;if(t.options&&"true"===t.options.packed&&-1===i.indexOf(t.type)){if(-1===t.type.indexOf(".")){if(e.enums&&e.enums.some((function(e){return e.name===t.type})))return}else{if((r=t.type.split(".")).length>2)throw new Error("what is this?");if(n=r[0],s=r[1],o.messages.some((function(e){if(e.name===n)return a=e,e})),a&&a.enums&&a.enums.some((function(e){return e.name===s})))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')}}))})),o}},function(e,t,r){"use strict";e.exports=function(e){var t,r=function(e){return e.trim()};return e.replace(/([;,{}()=:[\]<>]|\/\*|\*\/)/g," $1 ").split(/\n/).map(r).filter(Boolean).map((function(e){var t=e.indexOf("//");return t>-1?e.slice(0,t):e})).map(r).filter(Boolean).join("\n").split(/\s+|\n+/gm).filter((t=!1,function(e){return"/*"===e?(t=!0,!1):"*/"===e?(t=!1,!1):!t}))}},function(e,t,r){"use strict";var n=function(e,t){var r=e.repeated?"repeated":e.required?"required":"optional";"map"===e.type&&(r="map<"+e.map.from+","+e.map.to+">"),e.oneof&&(r="");var n=Object.keys(e.options||{}).map((function(t){return t+" = "+e.options[t]})).join(",");return n&&(n=" ["+n+"]"),t.push((r?r+" ":"")+("map"===e.map?"":e.type+" ")+e.name+" = "+e.tag+n+";"),t},i=function(e,t){t.push("message "+e.name+" {"),e.options||(e.options={}),a(e.options,t),e.enums||(e.enums=[]),e.enums.forEach((function(e){t.push(s(e,[]))})),e.messages||(e.messages=[]),e.messages.forEach((function(e){t.push(i(e,[]))}));var r={};return e.fields||(e.fields=[]),e.fields.forEach((function(e){e.oneof?(r[e.oneof]||(r[e.oneof]=[]),r[e.oneof].push(n(e,[]))):t.push(n(e,[]))})),Object.keys(r).forEach((function(e){r[e].unshift("oneof "+e+" {"),r[e].push("}"),t.push(r[e])})),t.push("}",""),t},s=function(e,t){t.push("enum "+e.name+" {"),e.options||(e.options={});var r=a(e.options,[]);return r.length>1&&t.push(r.slice(0,-1)),Object.keys(e.values).map((function(r){var n=o(e.values[r]);t.push([r+" = "+n+";"])})),t.push("}",""),t},o=function(e,t){var r=Object.keys(e.options||{}).map((function(t){return t+" = "+e.options[t]})).join(",");return r&&(r=" ["+r+"]"),e.value+r},a=function(e,t){var r=Object.keys(e);return r.forEach((function(r){var n=e[r];~r.indexOf(".")&&(r="("+r+")");var i=typeof n;"object"===i?(n=c(n,[])).length&&t.push("option "+r+" = {",n,"};"):("string"===i&&"optimize_for"!==r&&(n='"'+n+'"'),t.push("option "+r+" = "+n+";"))})),r.length>0&&t.push(""),t},c=function(e,t){return Object.keys(e).forEach((function(r){var n=e[r],i=typeof n;"object"===i?Array.isArray(n)?n.forEach((function(e){(e=c(e,[])).length&&t.push(r+" {",e,"}")})):(n=c(n,[])).length&&t.push(r+" {",n,"}"):("string"===i&&(n='"'+n+'"'),t.push(r+": "+n))})),t},u=function(e,t){var r="rpc "+e.name+"(";e.client_streaming&&(r+="stream "),r+=e.input_type+") returns (",e.server_streaming&&(r+="stream "),r+=e.output_type+")",e.options||(e.options={});var n=a(e.options,[]);return n.length>1?t.push(r+" {",n.slice(0,-1),"}"):t.push(r+";"),t},f=function(e){return function(t){return Array.isArray(t)?t.map(f(e+" ")).join("\n"):e+t}};e.exports=function(e){var t=[];return t.push('syntax = "proto'+e.syntax+'";',""),e.package&&t.push("package "+e.package+";",""),e.options||(e.options={}),a(e.options,t),e.enums||(e.enums=[]),e.enums.forEach((function(e){s(e,t)})),e.messages||(e.messages=[]),e.messages.forEach((function(e){i(e,t)})),e.services&&e.services.forEach((function(e){!function(e,t){t.push("service "+e.name+" {"),e.options||(e.options={}),a(e.options,t),e.methods||(e.methods=[]),e.methods.forEach((function(e){t.push(u(e,[]))})),t.push("}","")}(e,t)})),t.map(f("")).join("\n")}},function(e,t,r){"use strict";var n=r(390),i=r(392),s=r(393),o=r(394),a=r(14);e.exports=function(e,t){var r={},c={},u={},f=function(e,t){e.enums&&e.enums.forEach((function(e){e.id=t+(t?".":"")+e.name,c[e.id]=e,f(e,e.id)})),e.messages&&e.messages.forEach((function(n){n.id=t+(t?".":"")+n.name,r[n.id]=n,n.fields.forEach((function(n){if(n.map){var i="Map_"+n.map.from+"_"+n.map.to,s={name:i,enums:[],messages:[],fields:[{name:"key",type:n.map.from,tag:1,repeated:!1,required:!0},{name:"value",type:n.map.to,tag:2,repeated:!1,required:!1}],extensions:null,id:t+(t?".":"")+i};r[s.id]||(r[s.id]=s,e.messages.push(s)),n.type=i,n.repeated=!0}})),f(n,n.id)}))};f(e,"");var h=function(e,t){e.messages.forEach((function(r){t[r.name]=l(r.name,e.id)})),e.enums.forEach((function(e){t[e.name]=function(e){if(!e)return null;var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].value})),t}(e.values)})),t.type=2,t.message=!0,t.name=e.name;var r={};e.fields.forEach((function(e){e.oneof&&(r[e.oneof]||(r[e.oneof]=[]),r[e.oneof].push(e.name))}));var n=e.fields.map((function(t){return l(t.type,e.id)})),a=o(e,n,r),c=s(e,l,n,r,a),u=i(e,l,n);return c.bytes=u.bytes=0,t.buffer=!0,t.encode=c,t.decode=u,t.encodingLength=a,t},l=function(e,i,s){if(t&&t[e])return t[e];if(n[e])return n[e];var o,f,l=(i?i+"."+e:e).split(".").map((function(t,r,n){return n.slice(0,r).concat(e).join(".")})).reverse().reduce((function(e,t){return e||r[t]||c[t]}),null);if(!1===s)return l;if(!l)throw new Error("Could not resolve "+e);return l.values?(o=l,f=Object.keys(o.values||[]).map((function(e){return parseInt(o.values[e].value,10)})),n.make(0,(function e(t,r,n){if(!f.length||-1===f.indexOf(t))throw new Error("Invalid enum value: "+t);return a.encode(t,r,n),e.bytes=a.encode.bytes,r}),(function e(t,r){var n=a.decode(t,r);if(!f.length||-1===f.indexOf(n))throw new Error("Invalid enum value: "+n);return e.bytes=a.decode.bytes,n}),a.encodingLength)):u[l.id]||h(l,u[l.id]={})};return(e.enums||[]).concat((e.messages||[]).map((function(e){return l(e.id)})))}},function(e,t,r){"use strict";var n=r(14),i=r(391);const{Buffer:s}=r(0);var o,a,c,u=function(e,t,r,n){return t.bytes=r.bytes=0,{type:e,encode:t,decode:r,encodingLength:n}};t.make=u,t.bytes=(o=function(e){return s.isBuffer(e)?e.length:s.byteLength(e)},u(2,a=function(e,t,r){var i=r,s=o(e);return n.encode(s,t,r),r+=n.encode.bytes,e instanceof Uint8Array?t.set(e,r):t.write(e,r,s),r+=s,a.bytes=r-i,t},c=function(e,t){var r=t,i=n.decode(e,t);t+=n.decode.bytes;var s=e.slice(t,t+i);return t+=s.length,c.bytes=t-r,s},(function(e){var t=o(e);return n.encodingLength(t)+t}))),t.string=function(){var e=function(t,r,i){var o=i,a=s.byteLength(t);return n.encode(a,r,i,"utf-8"),i+=n.encode.bytes,r.write(t,i,a),i+=a,e.bytes=i-o,r},t=function(e,r){var i=r,s=n.decode(e,r);r+=n.decode.bytes;var o=e.toString("utf-8",r,r+s);return r+=s,t.bytes=r-i,o};return u(2,e,t,(function(e){var t=s.byteLength(e);return n.encodingLength(t)+t}))}(),t.bool=function(){var e=function(t,r,n){return r[n]=t?1:0,e.bytes=1,r},t=function(e,r){var n=e[r]>0;return t.bytes=1,n};return u(0,e,t,(function(e){return 1}))}(),t.int32=function(){var e=function(t,r){var i=n.decode(t,r);return e.bytes=n.decode.bytes,i>2147483647?i-4294967296:i},t=function(e,r,i){return n.encode(e<0?e+4294967296:e,r,i),t.bytes=n.encode.bytes,r};return u(0,t,e,(function(e){return n.encodingLength(e<0?e+4294967296:e)}))}(),t.int64=function(){var e=function(t,r){var i=n.decode(t,r);if(i>=Math.pow(2,63)){for(var o=9;255===t[r+o-1];)o--;o=o||9;var a=s.allocUnsafe(o);t.copy(a,0,r,r+o),a[o-1]=127&a[o-1],i=-1*n.decode(a,0),e.bytes=10}else e.bytes=n.decode.bytes;return i},t=function(e,r,i){if(e<0){var s=i+9;for(n.encode(-1*e,r,i),r[i+=n.encode.bytes-1]=128|r[i];i<s-1;)r[++i]=255;r[s]=1,t.bytes=10}else n.encode(e,r,i),t.bytes=n.encode.bytes;return r};return u(0,t,e,(function(e){return e<0?10:n.encodingLength(e)}))}(),t.sint32=t.sint64=u(0,i.encode,i.decode,i.encodingLength),t.uint32=t.uint64=t.enum=t.varint=u(0,n.encode,n.decode,n.encodingLength),t.fixed64=t.sfixed64=function(){var e=function(t,r,n){return r.set(t,n),e.bytes=8,r},t=function(e,r){var n=e.slice(r,r+8);return t.bytes=8,n};return u(1,e,t,(function(e){return 8}))}(),t.double=function(){var e=function(t,r,n){return r.writeDoubleLE(t,n),e.bytes=8,r},t=function(e,r){var n=e.readDoubleLE(r);return t.bytes=8,n};return u(1,e,t,(function(e){return 8}))}(),t.fixed32=function(){var e=function(t,r,n){return r.writeUInt32LE(t,n),e.bytes=4,r},t=function(e,r){var n=e.readUInt32LE(r);return t.bytes=4,n};return u(5,e,t,(function(e){return 4}))}(),t.sfixed32=function(){var e=function(t,r,n){return r.writeInt32LE(t,n),e.bytes=4,r},t=function(e,r){var n=e.readInt32LE(r);return t.bytes=4,n};return u(5,e,t,(function(e){return 4}))}(),t.float=function(){var e=function(t,r,n){return r.writeFloatLE(t,n),e.bytes=4,r},t=function(e,r){var n=e.readFloatLE(r);return t.bytes=4,n};return u(5,e,t,(function(e){return 4}))}()},function(e,t,r){"use strict";var n=r(14);t.encode=function e(t,r,i){t=t>=0?2*t:-2*t-1;var s=n.encode(t,r,i);return e.bytes=n.encode.bytes,s},t.decode=function e(t,r){var i=n.decode(t,r);return e.bytes=n.decode.bytes,1&i?(i+1)/-2:i/2},t.encodingLength=function(e){return n.encodingLength(e>=0?2*e:-2*e-1)}},function(e,t,r){"use strict";var n=r(14),i=r(116).defined;function s(e){return"".concat(e.substring(0,1).toUpperCase()).concat(e.substring(1))}function o(e,t,r,n){if(Object.prototype.hasOwnProperty.call(e,t))return;const i=s(t);Object.defineProperties(e,{[t]:{enumerable:!0,configurable:!0,set:e=>{r=e},get:()=>void 0===r?n:r},["has".concat(i)]:{configurable:!0,value:()=>void 0!==r},["set".concat(i)]:{configurable:!0,value:e=>{r=e}},["get".concat(i)]:{configurable:!0,value:()=>r},["clear".concat(i)]:{configurable:!0,value:()=>{r=void 0,e[t]=void 0}}})}var a=function(e,t,r){switch(e){case 0:return n.decode(t,r),r+n.decode.bytes;case 1:return r+8;case 2:var i=n.decode(t,r);return r+n.decode.bytes+i;case 3:case 4:throw new Error("Groups are not supported");case 5:return r+4;default:throw new Error("Unknown wire type: "+e)}},c=function(e){if(e.map)return{};if(e.repeated)return[];switch(e.type){case"string":return"";case"bool":return!1;case"float":case"double":case"sfixed32":case"fixed32":case"varint":case"enum":case"uint64":case"uint32":case"int64":case"int32":case"sint64":case"sint32":return 0;default:return null}},u=function(e,t){if(void 0===t)return t;switch(e.type){case"bool":return"true"===t;case"float":case"double":case"sfixed32":case"fixed32":case"varint":case"enum":case"uint64":case"uint32":case"int64":case"int32":case"sint64":case"sint32":return parseInt(t,10);default:return t}};e.exports=function(e,t,r){for(var f=[],h={},l=[],d=[],p=0;p<r.length;p++){var b=e.fields[p];h[b.tag]=p;var y=b.options&&b.options.default,m=t(b.type,e.id,!1);d[p]=[y,m&&m.values],e.fields[p].packed=b.repeated&&b.options&&b.options.packed&&"false"!==b.options.packed,b.required&&f.push(b.name),b.oneof&&l.push(b.name)}function g(e,t,r,i,a,c){var u=t.name;if(t.oneof)for(var f=Object.keys(r),h=0;h<f.length;h++)if(l.indexOf(f[h])>-1){const e=s(f[h]);delete r["has".concat(e)],delete r["get".concat(e)],delete r["set".concat(e)],delete r["clear".concat(e)],delete r[f[h]]}let d;if(e.message){var p=n.decode(i,a);a+=n.decode.bytes;var b=e.decode(i,a,a+p);t.map?(d=r[u]||{},d[b.key]=b.value):t.repeated?(d=r[u]||[],d.push(b)):d=b}else t.repeated?(d=r[u]||[],d.push(e.decode(i,a))):d=e.decode(i,a);return o(r,u,d),a+=e.decode.bytes}return function t(s,p,b){if(null==p&&(p=0),null==b&&(b=s.length),!(b<=s.length&&p<=s.length))throw new Error("Decoded message is not valid");for(var y,m=p,v={};;){if(b<=p){var w,_,E="",k=0;for(k=0;k<f.length;k++)if(E=f[k],!i(v[E]))throw new Error("Decoded message is not valid, missing required field: "+E);for(k=0;k<r.length;k++){let t;if(y=e.fields[k],_=d[k][0],w=d[k][1],E=y.name,!Object.prototype.hasOwnProperty.call(v,E)){var S=!1;if(y.oneof)for(var A=Object.keys(v),I=0;I<A.length;I++)if(l.indexOf(A[I])>-1){S=!0;break}S||(w?y.repeated?_=[]:(_=_&&w[_]?w[_].value:w[Object.keys(w)[0]].value,_=parseInt(_||0,10)):(t=c(y),_=u(y,_)),o(v,E,_,t))}}return t.bytes=p-m,v}var T=n.decode(s,p);p+=n.decode.bytes;var R=h[T>>3];if(null!=R){var x=r[R];if((y=e.fields[R]).packed){var C=n.decode(s,p);for(C+=p+=n.decode.bytes;p<C;)p=g(x,y,v,s,p)}else p=g(x,y,v,s,p)}else p=a(7&T,s,p)}}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);var i=r(116).defined,s=r(14);e.exports=function(e,t,r,o,a){for(var c=Object.keys(o),u=r.length,f={},h=0;h<u;h++){f[h]={p:s.encode(e.fields[h].tag<<3|2),h:s.encode(e.fields[h].tag<<3|r[h].type)};var l=e.fields[h];e.fields[h].packed=l.repeated&&l.options&&l.options.packed&&"false"!==l.options.packed}function d(e,t,r,n,i,o){var a=0;if(!i)for(a=0;a<r.length;a++)e[t++]=r[a];return n.message&&(s.encode(n.encodingLength(o),e,t),t+=s.encode.bytes),n.encode(o,e,t),t+n.encode.bytes}return function t(h,l,p){null==p&&(p=0),null==l&&(l=n.allocUnsafe(a(h)));var b=p,y=Object.keys(h),m=0,g=!1;for(m=0;m<c.length;m++){var v=c[m],w=o[m];if(y.indexOf(w)>-1){if(g)throw new Error("only one of the properties defined in oneof "+v+" can be set");g=!0}}for(m=0;m<u;m++){var _=r[m],E=e.fields[m],k=h[E.name],S=0;if(i(k)){var A,I=f[m].p,T=f[m].h,R=E.packed;if(E.map){var x=Object.keys(k);for(S=0;S<x.length;S++)x[S]={key:x[S],value:k[x[S]]};k=x}if(R){var C=0;for(S=0;S<k.length;S++)Object.prototype.hasOwnProperty.call(k,S)&&(C+=_.encodingLength(k[S]));if(C){for(S=0;S<T.length;S++)l[p++]=I[S];s.encode(C,l,p),p+=s.encode.bytes}}if(E.repeated)for(S=0;S<k.length;S++)A=k[S],i(A)&&(p=d(l,p,T,_,R,A));else p=d(l,p,T,_,R,k)}else if(E.required)throw new Error(E.name+" is required")}return t.bytes=p-b,l}}},function(e,t,r){"use strict";var n=r(116).defined,i=r(14);e.exports=function(e,t,r){for(var s=Object.keys(r),o=t.length,a=new Array(o),c=0;c<e.fields.length;c++){a[c]=i.encodingLength(e.fields[c].tag<<3|t[c].type);var u=e.fields[c];e.fields[c].packed=u.repeated&&u.options&&u.options.packed&&"false"!==u.options.packed}return function(c){var u=0,f=0,h=0;for(f=0;f<s.length;f++){var l=s[f],d=r[l],p=!1;for(h=0;h<d.length;h++)if(n(c[d[h]])){if(p)throw new Error("only one of the properties defined in oneof "+l+" can be set");p=!0}}for(f=0;f<o;f++){var b,y=t[f],m=e.fields[f],g=c[m.name],v=a[f];if(n(g)){if(m.map){var w=Object.keys(g);for(h=0;h<w.length;h++)w[h]={key:w[h],value:g[w[h]]};g=w}if(m.packed){var _=0;for(h=0;h<g.length;h++)n(g[h])&&(_+=b=y.encodingLength(g[h]),y.message&&(_+=i.encodingLength(b)));_&&(u+=v+_+i.encodingLength(_))}else if(m.repeated)for(h=0;h<g.length;h++)n(g[h])&&(u+=v+(b=y.encodingLength(g[h]))+(y.message?i.encodingLength(b):0));else u+=v+(b=y.encodingLength(g))+(y.message?i.encodingLength(b):0)}else if(m.required)throw new Error(m.name+" is required")}return u}}},function(e,t,r){"use strict";(function(e,t){!function(e,r){if(!e.setImmediate){var n,i,s,o,a,c=1,u={},f=!1,h=e.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(e);l=l&&l.setTimeout?l:e,"[object process]"==={}.toString.call(e.process)?n=function(e){t.nextTick((function(){p(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?e.MessageChannel?((s=new MessageChannel).port1.onmessage=function(e){p(e.data)},n=function(e){s.port2.postMessage(e)}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,n=function(e){var t=h.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):n=function(e){setTimeout(p,0,e)}:(o="setImmediate$"+Math.random()+"$",a=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(o)&&p(+t.data.slice(o.length))},e.addEventListener?e.addEventListener("message",a,!1):e.attachEvent("onmessage",a),n=function(t){e.postMessage(o+t,"*")}),l.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r<t.length;r++)t[r]=arguments[r+1];var i={callback:e,args:t};return u[c]=i,n(c),c++},l.clearImmediate=d}function d(e){delete u[e]}function p(e){if(f)setTimeout(p,0,e);else{var t=u[e];if(t){f=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(void 0,r)}}(t)}finally{d(e),f=!1}}}}}("undefined"==typeof self?void 0===e?void 0:e:self)}).call(this,r(10),r(8))},function(e,t,r){"use strict";(function(t){var r={};e.exports=r;var n={};r.encode=function(e,t,r){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var i=0,s=t.length,o=t.charAt(0),a=[0];for(i=0;i<e.length;++i){for(var c=0,u=e[i];c<a.length;++c)u+=a[c]<<8,a[c]=u%s,u=u/s|0;for(;u>0;)a.push(u%s),u=u/s|0}for(i=0;0===e[i]&&i<e.length-1;++i)n+=o;for(i=a.length-1;i>=0;--i)n+=t[a[i]]}else n=function(e,t){var r=0,n=t.length,i=t.charAt(0),s=[0];for(r=0;r<e.length();++r){for(var o=0,a=e.at(r);o<s.length;++o)a+=s[o]<<8,s[o]=a%n,a=a/n|0;for(;a>0;)s.push(a%n),a=a/n|0}var c="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)c+=i;for(r=s.length-1;r>=0;--r)c+=t[s[r]];return c}(e,t);if(r){var f=new RegExp(".{1,"+r+"}","g");n=n.match(f).join("\r\n")}return n},r.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var i=n[r];if(!i){i=n[r]=[];for(var s=0;s<r.length;++s)i[r.charCodeAt(s)]=s}e=e.replace(/\s/g,"");var o=r.length,a=r.charAt(0),c=[0];for(s=0;s<e.length;s++){var u=i[e.charCodeAt(s)];if(void 0===u)return;for(var f=0,h=u;f<c.length;++f)h+=c[f]*o,c[f]=255&h,h>>=8;for(;h>0;)c.push(255&h),h>>=8}for(var l=0;e[l]===a&&l<e.length-1;++l)c.push(0);return void 0!==t?t.from(c.reverse()):new Uint8Array(c.reverse())}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(5);r(46),r(9),(e.exports=n.hmac=n.hmac||{}).create=function(){var e=null,t=null,r=null,i=null,s={start:function(s,o){if(null!==s)if("string"==typeof s){if(!((s=s.toLowerCase())in n.md.algorithms))throw new Error('Unknown hash algorithm "'+s+'"');t=n.md.algorithms[s].create()}else t=s;if(null===o)o=e;else{if("string"==typeof o)o=n.util.createBuffer(o);else if(n.util.isArray(o)){var a=o;o=n.util.createBuffer();for(var c=0;c<a.length;++c)o.putByte(a[c])}var u=o.length();u>t.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),r=n.util.createBuffer(),i=n.util.createBuffer(),u=o.length();for(c=0;c<u;++c){a=o.at(c);r.putByte(54^a),i.putByte(92^a)}if(u<t.blockLength)for(a=t.blockLength-u,c=0;c<a;++c)r.putByte(54),i.putByte(92);e=o,r=r.bytes(),i=i.bytes()}t.start(),t.update(r)},update:function(e){t.update(e)},getMac:function(){var e=t.digest().bytes();return t.start(),t.update(i),t.update(e),t.digest()}};return s.digest=s.getMac,s}},function(e,t,r){"use strict";var n=r(5);r(46),r(9);var i=e.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){o||(s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),64),a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],o=!0);var e=null,t=n.util.createBuffer(),r=new Array(64),i={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,s=0;s<r;++s)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},i}};return i.start(),i.update=function(s,o){"utf8"===o&&(s=n.util.encodeUtf8(s));var a=s.length;i.messageLength+=a,a=[a/4294967296>>>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(s),c(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var o=n.util.createBuffer();o.putBytes(t.bytes());var a,u=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;o.putBytes(s.substr(0,i.blockLength-u));for(var f=8*i.fullMessageLength[0],h=0;h<i.fullMessageLength.length-1;++h)f+=(a=8*i.fullMessageLength[h+1])/4294967296>>>0,o.putInt32(f>>>0),f=a>>>0;o.putInt32(f);var l={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};c(l,r,o);var d=n.util.createBuffer();return d.putInt32(l.h0),d.putInt32(l.h1),d.putInt32(l.h2),d.putInt32(l.h3),d.putInt32(l.h4),d.putInt32(l.h5),d.putInt32(l.h6),d.putInt32(l.h7),d},i};var s=null,o=!1,a=null;function c(e,t,r){for(var n,i,s,o,c,u,f,h,l,d,p,b,y,m=r.length();m>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)n=((n=t[c-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=((i=t[c-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[c]=n+t[c-7]+i+t[c-16]|0;for(u=e.h0,f=e.h1,h=e.h2,l=e.h3,d=e.h4,p=e.h5,b=e.h6,y=e.h7,c=0;c<64;++c)s=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),o=u&f|h&(u^f),n=y+((d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(b^d&(p^b))+a[c]+t[c],y=b,b=p,p=d,d=l+n>>>0,l=h,h=f,f=u,u=n+(i=s+o)>>>0;e.h0=e.h0+u|0,e.h1=e.h1+f|0,e.h2=e.h2+h|0,e.h3=e.h3+l|0,e.h4=e.h4+d|0,e.h5=e.h5+p|0,e.h6=e.h6+b|0,e.h7=e.h7+y|0,m-=64}}},function(e,t,r){"use strict";(function(t){var n=r(5);r(9);var i=null;!n.util.isNodejs||n.options.usePureJavaScript||t.versions["node-webkit"]||(i=r(119)),(e.exports=n.prng=n.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,s=new Array(32),o=0;o<32;++o)s[o]=r.create();function a(){if(t.pools[0].messageLength>=32)return c();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),c()}function c(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r==0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function u(e){var t=null,r=n.util.globalScope,i=r.crypto||r.msCrypto;i&&i.getRandomValues&&(t=function(e){return i.getRandomValues(e)});var s=n.util.createBuffer();if(t)for(;s.length()<e;){var o=Math.max(1,Math.min(e-s.length(),65536)/4),a=new Uint32Array(Math.floor(o));try{t(a);for(var c=0;c<a.length;++c)s.putInt32(a[c])}catch(d){if(!("undefined"!=typeof QuotaExceededError&&d instanceof QuotaExceededError))throw d}}if(s.length()<e)for(var u,f,h,l=Math.floor(65536*Math.random());s.length()<e;){f=16807*(65535&l),f+=(32767&(u=16807*(l>>16)))<<16,l=4294967295&(f=(2147483647&(f+=u>>15))+(f>>31));for(c=0;c<3;++c)h=l>>>(c<<3),h^=Math.floor(256*Math.random()),s.putByte(String.fromCharCode(255&h))}return s.getBytes(e)}return t.pools=s,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var i=t.plugin.cipher,s=t.plugin.increment,o=t.plugin.formatKey,a=t.plugin.formatSeed,u=n.util.createBuffer();t.key=null,function f(h){if(h)return r(h);if(u.length()>=e)return r(null,u.getBytes(e));t.generated>1048575&&(t.key=null);if(null===t.key)return n.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return c(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,n){if(r)return e(r);t.collect(n),c(),e()}))}(f)}));var l=i(t.key,t.seed);t.generated+=l.length,u.putBytes(l),t.key=o(i(t.key,s(t.seed))),t.seed=a(i(t.key,t.seed)),n.util.setImmediate(f)}()},t.generateSync=function(e){var r=t.plugin.cipher,i=t.plugin.increment,s=t.plugin.formatKey,o=t.plugin.formatSeed;t.key=null;for(var c=n.util.createBuffer();c.length()<e;){t.generated>1048575&&(t.key=null),null===t.key&&a();var u=r(t.key,t.seed);t.generated+=u.length,c.putBytes(u),t.key=s(r(t.key,i(t.seed))),t.seed=o(r(t.key,t.seed))}return c.getBytes(e)},i?(t.seedFile=function(e,t){i.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return i.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,u(e))}catch(r){t(r)}},t.seedFileSync=u),t.collect=function(e){for(var r=e.length,n=0;n<r;++n)t.pools[t.pool].update(e.substr(n,1)),t.pool=31===t.pool?0:t.pool+1},t.collectInt=function(e,r){for(var n="",i=0;i<r;i+=8)n+=String.fromCharCode(e>>i&255);t.collect(n)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){self.addEventListener("message",(function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",(function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))}))}},t}}).call(this,r(8))},function(e,t,r){"use strict";var n=r(5);r(9);var i=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],s=[1,2,3,5],o=function(e,t){return e<<t&65535|(65535&e)>>16-t},a=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"==typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,s=e,o=e.length(),a=t,c=Math.ceil(a/8),u=255>>(7&a);for(r=o;r<128;r++)s.putByte(i[s.at(r-1)+s.at(r-o)&255]);for(s.setAt(128-c,i[s.at(128-c)&u]),r=127-c;r>=0;r--)s.setAt(r,i[s.at(r+1)^s.at(r+c)]);return s};var c=function(e,t,r){var i,c,u,f,h=!1,l=null,d=null,p=null,b=[];for(e=n.rc2.expandKey(e,t),u=0;u<64;u++)b.push(e.getInt16Le());r?(i=function(e){for(u=0;u<4;u++)e[u]+=b[f]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),e[u]=o(e[u],s[u]),f++},c=function(e){for(u=0;u<4;u++)e[u]+=b[63&e[(u+3)%4]]}):(i=function(e){for(u=3;u>=0;u--)e[u]=a(e[u],s[u]),e[u]-=b[f]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),f--},c=function(e){for(u=3;u>=0;u--)e[u]-=b[63&e[(u+3)%4]]});var y=function(e){var t=[];for(u=0;u<4;u++){var n=l.getInt16Le();null!==p&&(r?n^=p.getInt16Le():p.putInt16Le(n)),t.push(65535&n)}f=r?0:63;for(var i=0;i<e.length;i++)for(var s=0;s<e[i][0];s++)e[i][1](t);for(u=0;u<4;u++)null!==p&&(r?p.putInt16Le(t[u]):t[u]^=p.getInt16Le()),d.putInt16Le(t[u])},m=null;return m={start:function(e,t){e&&"string"==typeof e&&(e=n.util.createBuffer(e)),h=!1,l=n.util.createBuffer(),d=t||new n.util.createBuffer,p=e,m.output=d},update:function(e){for(h||l.putBuffer(e);l.length()>=8;)y([[5,i],[1,c],[6,i],[1,c],[5,i]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,l,!r);else{var n=8===l.length()?8:8-l.length();l.fillWithByte(n,n)}if(t&&(h=!0,m.update()),!r&&(t=0===l.length()))if(e)t=e(8,d,!r);else{var i=d.length(),s=d.at(i-1);s>i?t=!1:d.truncate(s)}return t}}};n.rc2.startEncrypting=function(e,t,r){var i=n.rc2.createEncryptionCipher(e,128);return i.start(t,r),i},n.rc2.createEncryptionCipher=function(e,t){return c(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var i=n.rc2.createDecryptionCipher(e,128);return i.start(t,r),i},n.rc2.createDecryptionCipher=function(e,t){return c(e,t,!1)}},function(e,t,r){"use strict";var n=r(5);r(9),r(47),r(402);var i=e.exports=n.pkcs1=n.pkcs1||{};function s(e,t,r){r||(r=n.md.sha1.create());for(var i="",s=Math.ceil(t/r.digestLength),o=0;o<s;++o){var a=String.fromCharCode(o>>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+a),i+=r.digest().getBytes()}return i.substring(0,t)}i.encode_rsa_oaep=function(e,t,r){var i,o,a,c;"string"==typeof r?(i=r,o=arguments[3]||void 0,a=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,a=r.md||void 0,r.mgf1&&r.mgf1.md&&(c=r.mgf1.md)),a?a.start():a=n.md.sha1.create(),c||(c=a);var u=Math.ceil(e.n.bitLength()/8),f=u-2*a.digestLength-2;if(t.length>f)throw(y=new Error("RSAES-OAEP input message length is too long.")).length=t.length,y.maxLength=f,y;i||(i=""),a.update(i,"raw");for(var h=a.digest(),l="",d=f-t.length,p=0;p<d;p++)l+="\0";var b=h.getBytes()+l+""+t;if(o){if(o.length!==a.digestLength){var y;throw(y=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=o.length,y.digestLength=a.digestLength,y}}else o=n.random.getBytes(a.digestLength);var m=s(o,u-a.digestLength-1,c),g=n.util.xorBytes(b,m,b.length),v=s(g,a.digestLength,c),w=n.util.xorBytes(o,v,o.length);return"\0"+w+g},i.decode_rsa_oaep=function(e,t,r){var i,o,a;"string"==typeof r?(i=r,o=arguments[3]||void 0):r&&(i=r.label||void 0,o=r.md||void 0,r.mgf1&&r.mgf1.md&&(a=r.mgf1.md));var c=Math.ceil(e.n.bitLength()/8);if(t.length!==c)throw(g=new Error("RSAES-OAEP encoded message length is invalid.")).length=t.length,g.expectedLength=c,g;if(void 0===o?o=n.md.sha1.create():o.start(),a||(a=o),c<2*o.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");i||(i=""),o.update(i,"raw");for(var u=o.digest().getBytes(),f=t.charAt(0),h=t.substring(1,o.digestLength+1),l=t.substring(1+o.digestLength),d=s(l,o.digestLength,a),p=n.util.xorBytes(h,d,h.length),b=s(p,c-o.digestLength-1,a),y=n.util.xorBytes(l,b,l.length),m=y.substring(0,o.digestLength),g="\0"!==f,v=0;v<o.digestLength;++v)g|=u.charAt(v)!==m.charAt(v);for(var w=1,_=o.digestLength,E=o.digestLength;E<y.length;E++){var k=y.charCodeAt(E),S=1&k^1,A=w?65534:0;g|=k&A,_+=w&=S}if(g||1!==y.charCodeAt(_))throw new Error("Invalid RSAES-OAEP padding.");return y.substring(_+1)}},function(e,t,r){"use strict";var n=r(5);r(46),r(9);var i=e.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){o||(s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),64),o=!0);var e=null,t=n.util.createBuffer(),r=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,s=0;s<r;++s)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},i}};return i.start(),i.update=function(s,o){"utf8"===o&&(s=n.util.encodeUtf8(s));var c=s.length;i.messageLength+=c,c=[c/4294967296>>>0,c>>>0];for(var u=i.fullMessageLength.length-1;u>=0;--u)i.fullMessageLength[u]+=c[1],c[1]=c[0]+(i.fullMessageLength[u]/4294967296>>>0),i.fullMessageLength[u]=i.fullMessageLength[u]>>>0,c[0]=c[1]/4294967296>>>0;return t.putBytes(s),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var o=n.util.createBuffer();o.putBytes(t.bytes());var c,u=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;o.putBytes(s.substr(0,i.blockLength-u));for(var f=8*i.fullMessageLength[0],h=0;h<i.fullMessageLength.length-1;++h)f+=(c=8*i.fullMessageLength[h+1])/4294967296>>>0,o.putInt32(f>>>0),f=c>>>0;o.putInt32(f);var l={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};a(l,r,o);var d=n.util.createBuffer();return d.putInt32(l.h0),d.putInt32(l.h1),d.putInt32(l.h2),d.putInt32(l.h3),d.putInt32(l.h4),d},i};var s=null,o=!1;function a(e,t,r){for(var n,i,s,o,a,c,u,f=r.length();f>=64;){for(i=e.h0,s=e.h1,o=e.h2,a=e.h3,c=e.h4,u=0;u<16;++u)n=r.getInt32(),t[u]=n,n=(i<<5|i>>>27)+(a^s&(o^a))+c+1518500249+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;u<20;++u)n=(n=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|n>>>31,t[u]=n,n=(i<<5|i>>>27)+(a^s&(o^a))+c+1518500249+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;u<32;++u)n=(n=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|n>>>31,t[u]=n,n=(i<<5|i>>>27)+(s^o^a)+c+1859775393+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;u<40;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(i<<5|i>>>27)+(s^o^a)+c+1859775393+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;u<60;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(i<<5|i>>>27)+(s&o|a&(s^o))+c+2400959708+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;u<80;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(i<<5|i>>>27)+(s^o^a)+c+3395469782+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+s|0,e.h2=e.h2+o|0,e.h3=e.h3+a|0,e.h4=e.h4+c|0,f-=64}}},function(e,t,r){"use strict";var n=r(5);r(9),r(91),r(47),function(){if(n.prime)e.exports=n.prime;else{var t=e.exports=n.prime=n.prime||{},r=n.jsbn.BigInteger,i=[6,4,2,4,2,4,6,2],s=new r(null);s.fromInt(30);var o=function(e,t){return e|t};t.generateProbablePrime=function(e,t,i){"function"==typeof t&&(i=t,t={});var s=(t=t||{}).algorithm||"PRIMEINC";"string"==typeof s&&(s={name:s}),s.options=s.options||{};var o=t.prng||n.random,u={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===s.name)return function(e,t,i,s){if("workers"in i)return function(e,t,i,s){if("undefined"==typeof Worker)return a(e,t,i,s);var o=c(e,t),u=i.workers,f=i.workLoad||100,h=30*f/8,l=i.workerScript||"forge/prime.worker.js";if(-1===u)return n.util.estimateCores((function(e,t){e&&(t=2),u=t-1,d()}));function d(){u=Math.max(1,u);for(var n=[],i=0;i<u;++i)n[i]=new Worker(l);for(i=0;i<u;++i)n[i].addEventListener("message",d);var a=!1;function d(i){if(!a){0;var u=i.data;if(u.found){for(var l=0;l<n.length;++l)n[l].terminate();return a=!0,s(null,new r(u.prime,16))}o.bitLength()>e&&(o=c(e,t));var d=o.toString(16);i.target.postMessage({hex:d,workLoad:f}),o.dAddOffset(h,0)}}}d()}(e,t,i,s);return a(e,t,i,s)}(e,u,s.options,i);throw new Error("Invalid prime generation algorithm: "+s.name)}}function a(e,t,r,s){var o=c(e,t),a=function(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}(o.bitLength());"millerRabinTests"in r&&(a=r.millerRabinTests);var u=10;"maxBlockTime"in r&&(u=r.maxBlockTime),function e(t,r,s,o,a,u,f){var h=+new Date;do{if(t.bitLength()>r&&(t=c(r,s)),t.isProbablePrime(a))return f(null,t);t.dAddOffset(i[o++%8],0)}while(u<0||+new Date-h<u);n.util.setImmediate((function(){e(t,r,s,o,a,u,f)}))}(o,e,t,0,a,u,s)}function c(e,t){var n=new r(e,t),i=e-1;return n.testBit(i)||n.bitwiseTo(r.ONE.shiftLeft(i),o,n),n.dAddOffset(31-n.mod(s).byteValue(),0),n}}()},function(e,t,r){"use strict";const n=r(27),i=r(206);e.exports={import:async function(e,t){const r=n.names.base64.decode(e),s=i.create();return await s.decrypt(r,t)}}},function(e,t,r){"use strict";const{encodeText:n}=r(210);e.exports=class{constructor(e,t,r,i){this.name=e,this.code=t,this.codeBuf=n(this.code),this.alphabet=i,this.engine=r(i)}encode(e){return this.engine.encode(e)}decode(e){for(const t of e)if(this.alphabet&&this.alphabet.indexOf(t)<0)throw new Error("invalid character '".concat(t,"' in '").concat(e,"'"));return this.engine.decode(e)}}},function(e,t,r){"use strict";e.exports=e=>t=>({encode:r=>((e,t,r)=>{const n="="===t[t.length-1],i=(1<<r)-1;let s="",o=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],o+=8;o>r;)o-=r,s+=t[i&a>>o];if(o&&(s+=t[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s})(r,t,e),decode:r=>((e,t,r)=>{const n={};for(let u=0;u<t.length;++u)n[t[u]]=u;let i=e.length;for(;"="===e[i-1];)--i;const s=new Uint8Array(i*r/8|0);let o=0,a=0,c=0;for(let u=0;u<i;++u){const t=n[e[u]];if(void 0===t)throw new SyntaxError("Invalid character "+e[u]);a=a<<r|t,o+=r,o>=8&&(o-=8,s[c++]=255&a>>o)}if(o>=r||255&a<<8-o)throw new SyntaxError("Unexpected end of data");return s})(r,t,e)})},function(e,t,r){"use strict";const n=r(94),i=r(16),s=r(27),o=r(1);r(121),r(211);const a=r(5),c=r(409),u=i(r(117)),f=r(124);class h{constructor(e){this._key=e}async verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return c.utils.jwkToPkix(this._key)}get bytes(){return u.PublicKey.encode({Type:u.KeyType.RSA,Data:this.marshal()})}encrypt(e){return c.encrypt(this._key,e)}equals(e){return this.bytes.equals(e.bytes)}async hash(){return n.multihashing(this.bytes,"sha2-256")}}class l{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return c.getRandomValues(16)}async sign(e){return c.hashAndSign(this._key,e)}get public(){if(!this._publicKey)throw o(new Error("public key not provided"),"ERR_PUBKEY_NOT_PROVIDED");return new h(this._publicKey)}decrypt(e){return c.decrypt(this._key,e)}marshal(){return c.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)}async hash(){return n.multihashing(this.bytes,"sha2-256")}async id(){const e=await this.public.hash();return s.encode("base58btc",e).toString().slice(1)}async export(e,t="pkcs-8"){if("pkcs-8"===t){const t=new a.util.ByteBuffer(this.marshal()),r=a.asn1.fromDer(t),n=a.pki.privateKeyFromAsn1(r),i={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};return a.pki.encryptRsaPrivateKey(n,e,i)}if("libp2p-key"===t)return f.export(this.bytes,e);throw o(new Error("export format '".concat(t,"' is not supported")),"ERR_INVALID_EXPORT_FORMAT")}}e.exports={RsaPublicKey:h,RsaPrivateKey:l,unmarshalRsaPublicKey:function(e){const t=c.utils.pkixToJwk(e);return new h(t)},unmarshalRsaPrivateKey:async function(e){const t=c.utils.pkcs1ToJwk(e),r=await c.unmarshalPrivateKey(t);return new l(r.privateKey,r.publicKey)},generateKeyPair:async function(e){const t=await c.generateKey(e);return new l(t.privateKey,t.publicKey)},fromJwk:async function(e){const t=await c.unmarshalPrivateKey(e);return new l(t.privateKey,t.publicKey)}}},function(e,t,r){"use strict";var n=r(5);r(43);var i=n.asn1;t.privateKeyValidator={name:"PrivateKeyInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},t.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(93),s=r(122);function o(e){return Promise.all([i.get().subtle.exportKey("jwk",e.privateKey),i.get().subtle.exportKey("jwk",e.publicKey)])}t.utils=r(411),t.generateKey=async function(e){const t=await i.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),r=await o(t);return{privateKey:r[0],publicKey:r[1]}},t.unmarshalPrivateKey=async function(e){const t=[await i.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await(r=e,i.get().subtle.importKey("jwk",{kty:r.kty,n:r.n,e:r.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"]))];var r;const n=await o({privateKey:t[0],publicKey:t[1]});return{privateKey:n[0],publicKey:n[1]}},t.getRandomValues=s,t.hashAndSign=async function(e,t){const r=await i.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),s=await i.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,Uint8Array.from(t));return n.from(s)},t.hashAndVerify=async function(e,t,r){const n=await i.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return i.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},n,t,r)};const{jwk2pub:a,jwk2priv:c}=r(412);function u(e,t,r,i){const s=t?a(e):c(e),o=i(n.from(r).toString("binary"),s);return n.from(o,"binary")}t.encrypt=function(e,t){return u(e,!0,t,(e,t)=>t.encrypt(e))},t.decrypt=function(e,t){return u(e,!1,t,(e,t)=>t.decrypt(e))}},function(e,t,r){"use strict";const n=self.crypto||self.msCrypto,{Buffer:i}=r(0);n&&n.getRandomValues?e.exports=function(e){const t=new Uint8Array(e);let r=0;if(e>0)if(e>65536)for(;r<e;)r+65536>e?(n.getRandomValues(t.subarray(r,r+(e-r))),r+=e-r):(n.getRandomValues(t.subarray(r,r+65536)),r+=65536);else n.getRandomValues(t);return i.from(t)}:e.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}},function(e,t,r){"use strict";const{Buffer:n}=r(0);r(43),r(90);const i=r(5),{bigIntegerToUintBase64url:s,base64urlToBigInteger:o}=r(123);t.pkcs1ToJwk=function(e){e=n.from(e);const t=i.asn1.fromDer(e.toString("binary")),r=i.pki.privateKeyFromAsn1(t);return{kty:"RSA",n:s(r.n),e:s(r.e),d:s(r.d),p:s(r.p),q:s(r.q),dp:s(r.dP),dq:s(r.dQ),qi:s(r.qInv),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){const t=i.pki.privateKeyToAsn1({n:o(e.n),e:o(e.e),d:o(e.d),p:o(e.p),q:o(e.q),dP:o(e.dp),dQ:o(e.dq),qInv:o(e.qi)});return n.from(i.asn1.toDer(t).getBytes(),"binary")},t.pkixToJwk=function(e){const t=i.asn1.fromDer(e.toString("binary")),r=i.pki.publicKeyFromAsn1(t);return{kty:"RSA",n:s(r.n),e:s(r.e),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){const t=i.pki.publicKeyToAsn1({n:o(e.n),e:o(e.e)});return n.from(i.asn1.toDer(t).getBytes(),"binary")}},function(e,t,r){"use strict";r(90);const n=r(5),{base64urlToBigInteger:i}=r(123);function s(e,t){return t.map(t=>i(e[t]))}e.exports={jwk2pub:function(e){return n.pki.setRsaPublicKey(...s(e,["n","e"]))},jwk2priv:function(e){return n.pki.setRsaPrivateKey(...s(e,["n","e","d","p","q","dp","dq","qi"]))}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(94),s=r(16),o=r(27),a=r(1),c=r(414),u=s(r(117)),f=r(124);class h{constructor(e){this._key=d(e,c.publicKeyLength)}async verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return n.from(this._key)}get bytes(){return u.PublicKey.encode({Type:u.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}async hash(){return i.multihashing(this.bytes,"sha2-256")}}class l{constructor(e,t){this._key=d(e,c.privateKeyLength),this._publicKey=d(t,c.publicKeyLength)}async sign(e){return c.hashAndSign(this._key,e)}get public(){return new h(this._publicKey)}marshal(){return n.concat([n.from(this._key),n.from(this._publicKey)])}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}async hash(){return i.multihashing(this.bytes,"sha2-256")}async id(){const e=await this.public.hash();return o.encode("base58btc",e).toString().slice(1)}async export(e,t="libp2p-key"){if("libp2p-key"===t)return f.export(this.bytes,e);throw a(new Error("export format '".concat(t,"' is not supported")),"ERR_INVALID_EXPORT_FORMAT")}}function d(e,t){if((e=Uint8Array.from(e||[])).length!==t)throw a(new Error("Key must be a Uint8Array or Buffer of length ".concat(t,", got ").concat(e.length)),"ERR_INVALID_KEY_TYPE");return e}e.exports={Ed25519PublicKey:h,Ed25519PrivateKey:l,unmarshalEd25519PrivateKey:function(e){if(e.length>c.privateKeyLength){const t=(e=d(e,c.privateKeyLength+c.publicKeyLength)).slice(0,c.privateKeyLength),r=e.slice(c.privateKeyLength,e.length);return new l(t,r)}const t=(e=d(e,c.privateKeyLength)).slice(0,c.privateKeyLength),r=e.slice(c.publicKeyLength);return new l(t,r)},unmarshalEd25519PublicKey:function(e){return e=d(e,c.publicKeyLength),new h(e)},generateKeyPair:async function(){const{privateKey:e,publicKey:t}=await c.generateKey();return new l(e,t)},generateKeyPairFromSeed:async function(e){const{privateKey:t,publicKey:r}=await c.generateKeyFromSeed(e);return new l(t,r)}}},function(e,t,r){"use strict";r(211);const n=r(5);t.publicKeyLength=n.pki.ed25519.constants.PUBLIC_KEY_BYTE_LENGTH,t.privateKeyLength=n.pki.ed25519.constants.PRIVATE_KEY_BYTE_LENGTH,t.generateKey=async function(){return n.pki.ed25519.generateKeyPair()},t.generateKeyFromSeed=async function(e){return n.pki.ed25519.generateKeyPair({seed:e})},t.hashAndSign=async function(e,t){return n.pki.ed25519.sign({message:t,privateKey:e})},t.hashAndVerify=async function(e,t,r){return n.pki.ed25519.verify({signature:t,message:r,publicKey:e})}},function(e,t,r){"use strict";const n=r(27),i=r(94),s=r(1),o=r(124);e.exports=(e,t,a)=>{a=a||r(416)(t);class c{constructor(e){a.validatePublicKey(e),this._key=e}verify(e,t){return a.hashAndVerify(this._key,t,e)}marshal(){return a.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(){return i.multihashing(this.bytes,"sha2-256")}}class u{constructor(e,t){this._key=e,this._publicKey=t||a.computePublicKey(e),a.validatePrivateKey(this._key),a.validatePublicKey(this._publicKey)}sign(e){return a.hashAndSign(this._key,e)}get public(){return new c(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(){return i.multihashing(this.bytes,"sha2-256")}async id(){const e=await this.public.hash();return n.encode("base58btc",e).toString().slice(1)}async export(e,t="libp2p-key"){if("libp2p-key"===t)return o.export(this.bytes,e);throw s(new Error("export format '".concat(t,"' is not supported")),"ERR_INVALID_EXPORT_FORMAT")}}return{Secp256k1PublicKey:c,Secp256k1PrivateKey:u,unmarshalSecp256k1PrivateKey:function(e){return new u(e)},unmarshalSecp256k1PublicKey:function(e){return new c(e)},generateKeyPair:async function(){const e=await a.generateKey();return new u(e)}}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);var i=r(212).strict;const s=r(417),o=r(94);function a(e){if(i(e)){var t=n.from(e.buffer);return e.byteLength!==e.buffer.byteLength&&(t=t.slice(e.byteOffset,e.byteOffset+e.byteLength)),t}return n.from(e)}e.exports=e=>{function t(e){if(!s.privateKeyVerify(e))throw new Error("Invalid private key")}return{generateKey:function(){let t;do{t=e(32)}while(!s.privateKeyVerify(t));return t},privateKeyLength:32,hashAndSign:async function(e,t){const r=await o.digest(t,"sha2-256"),n=s.ecdsaSign(r,e);return a(s.signatureExport(n.signature))},hashAndVerify:async function(e,t,r){const n=await o.digest(r,"sha2-256");return t=a(s.signatureImport(t)),s.ecdsaVerify(t,n,e)},compressPublicKey:function(e){if(!s.publicKeyVerify(e))throw new Error("Invalid public key");return a(s.publicKeyConvert(e,!0))},decompressPublicKey:function(e){return a(s.publicKeyConvert(e,!1))},validatePrivateKey:t,validatePublicKey:function(e){if(!s.publicKeyVerify(e))throw new Error("Invalid public key")},computePublicKey:function(e){return t(e),a(s.publicKeyCreate(e))}}}},function(e,t,r){"use strict";e.exports=r(418)(r(419))},function(e,t,r){"use strict";const n="Impossible case. Please create issue.",i="The tweak was out of range or the resulted private key is invalid",s="The tweak was out of range or equal to zero",o="Unknow error on context randomization",a="Private Key is invalid",c="Public Key could not be parsed",u="Public Key serialization error",f="The sum of the public keys is not valid",h="Signature could not be parsed",l="The nonce generation function failed, or the private key was invalid",d="Public key could not be recover",p="Scalar was invalid (zero or overflow)";function b(e,t){if(!e)throw new Error(t)}function y(e,t,r){if(b(t instanceof Uint8Array,"Expected ".concat(e," to be an Uint8Array")),void 0!==r)if(Array.isArray(r)){const n=r.join(", "),i="Expected ".concat(e," to be an Uint8Array with length [").concat(n,"]");b(r.includes(t.length),i)}else{const n="Expected ".concat(e," to be an Uint8Array with length ").concat(r);b(t.length===r,n)}}function m(e){b("Boolean"===v(e),"Expected compressed to be a Boolean")}function g(e=(e=>new Uint8Array(e)),t){return"function"==typeof e&&(e=e(t)),y("output",e,t),e}function v(e){return Object.prototype.toString.call(e).slice(8,-1)}e.exports=e=>({contextRandomize(t){switch(b(null===t||t instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==t&&y("seed",t,32),e.contextRandomize(t)){case 1:throw new Error(o)}},privateKeyVerify:t=>(y("private key",t,32),0===e.privateKeyVerify(t)),privateKeyNegate(t){switch(y("private key",t,32),e.privateKeyNegate(t)){case 0:return t;case 1:throw new Error(n)}},privateKeyTweakAdd(t,r){switch(y("private key",t,32),y("tweak",r,32),e.privateKeyTweakAdd(t,r)){case 0:return t;case 1:throw new Error(i)}},privateKeyTweakMul(t,r){switch(y("private key",t,32),y("tweak",r,32),e.privateKeyTweakMul(t,r)){case 0:return t;case 1:throw new Error(s)}},publicKeyVerify:t=>(y("public key",t,[33,65]),0===e.publicKeyVerify(t)),publicKeyCreate(t,r=!0,n){switch(y("private key",t,32),m(r),n=g(n,r?33:65),e.publicKeyCreate(n,t)){case 0:return n;case 1:throw new Error(a);case 2:throw new Error(u)}},publicKeyConvert(t,r=!0,n){switch(y("public key",t,[33,65]),m(r),n=g(n,r?33:65),e.publicKeyConvert(n,t)){case 0:return n;case 1:throw new Error(c);case 2:throw new Error(u)}},publicKeyNegate(t,r=!0,i){switch(y("public key",t,[33,65]),m(r),i=g(i,r?33:65),e.publicKeyNegate(i,t)){case 0:return i;case 1:throw new Error(c);case 2:throw new Error(n);case 3:throw new Error(u)}},publicKeyCombine(t,r=!0,n){b(Array.isArray(t),"Expected public keys to be an Array"),b(t.length>0,"Expected public keys array will have more than zero items");for(const e of t)y("public key",e,[33,65]);switch(m(r),n=g(n,r?33:65),e.publicKeyCombine(n,t)){case 0:return n;case 1:throw new Error(c);case 2:throw new Error(f);case 3:throw new Error(u)}},publicKeyTweakAdd(t,r,n=!0,s){switch(y("public key",t,[33,65]),y("tweak",r,32),m(n),s=g(s,n?33:65),e.publicKeyTweakAdd(s,t,r)){case 0:return s;case 1:throw new Error(c);case 2:throw new Error(i)}},publicKeyTweakMul(t,r,n=!0,i){switch(y("public key",t,[33,65]),y("tweak",r,32),m(n),i=g(i,n?33:65),e.publicKeyTweakMul(i,t,r)){case 0:return i;case 1:throw new Error(c);case 2:throw new Error(s)}},signatureNormalize(t){switch(y("signature",t,64),e.signatureNormalize(t)){case 0:return t;case 1:throw new Error(h)}},signatureExport(t,r){y("signature",t,64);const i={output:r=g(r,72),outputlen:72};switch(e.signatureExport(i,t)){case 0:return r.slice(0,i.outputlen);case 1:throw new Error(h);case 2:throw new Error(n)}},signatureImport(t,r){switch(y("signature",t),r=g(r,64),e.signatureImport(r,t)){case 0:return r;case 1:throw new Error(h);case 2:throw new Error(n)}},ecdsaSign(t,r,i={},s){y("message",t,32),y("private key",r,32),b("Object"===v(i),"Expected options to be an Object"),void 0!==i.data&&y("options.data",i.data),void 0!==i.noncefn&&b("Function"===v(i.noncefn),"Expected options.noncefn to be a Function");const o={signature:s=g(s,64),recid:null};switch(e.ecdsaSign(o,t,r,i.data,i.noncefn)){case 0:return o;case 1:throw new Error(l);case 2:throw new Error(n)}},ecdsaVerify(t,r,n){switch(y("signature",t,64),y("message",r,32),y("public key",n,[33,65]),e.ecdsaVerify(t,r,n)){case 0:return!0;case 3:return!1;case 1:throw new Error(h);case 2:throw new Error(c)}},ecdsaRecover(t,r,i,s=!0,o){switch(y("signature",t,64),b("Number"===v(r)&&r>=0&&r<=3,"Expected recovery id to be a Number within interval [0, 3]"),y("message",i,32),m(s),o=g(o,s?33:65),e.ecdsaRecover(o,t,r,i)){case 0:return o;case 1:throw new Error(h);case 2:throw new Error(d);case 3:throw new Error(n)}},ecdh(t,r,n={},i){switch(y("public key",t,[33,65]),y("private key",r,32),b("Object"===v(n),"Expected options to be an Object"),void 0!==n.data&&y("options.data",n.data),void 0!==n.hashfn?(b("Function"===v(n.hashfn),"Expected options.hashfn to be a Function"),void 0!==n.xbuf&&y("options.xbuf",n.xbuf,32),void 0!==n.ybuf&&y("options.ybuf",n.ybuf,32),y("output",i)):i=g(i,32),e.ecdh(i,t,r,n.data,n.hashfn,n.xbuf,n.ybuf)){case 0:return i;case 1:throw new Error(c);case 2:throw new Error(p)}}})},function(e,t,r){"use strict";const n=new(0,r(420).ec)("secp256k1"),i=n.curve,s=i.n.constructor;function o(e){const t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){let r=new s(t);if(r.cmp(i.p)>=0)return null;r=r.toRed(i.red);let o=r.redSqr().redIMul(r).redIAdd(i.b).redSqrt();return 3===e!==o.isOdd()&&(o=o.redNeg()),n.keyPair({pub:{x:r,y:o}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,r){let o=new s(t),a=new s(r);if(o.cmp(i.p)>=0||a.cmp(i.p)>=0)return null;if(o=o.toRed(i.red),a=a.toRed(i.red),(6===e||7===e)&&a.isOdd()!==(7===e))return null;const c=o.redSqr().redIMul(o);return a.redSqr().redISub(c.redIAdd(i.b)).isZero()?n.keyPair({pub:{x:o,y:a}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function a(e,t){const r=t.encode(null,33===e.length);for(let n=0;n<e.length;++n)e[n]=r[n]}e.exports={contextRandomize:()=>0,privateKeyVerify(e){const t=new s(e);return t.cmp(i.n)<0&&!t.isZero()?0:1},privateKeyNegate(e){const t=new s(e),r=i.n.sub(t).umod(i.n).toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakAdd(e,t){const r=new s(t);if(r.cmp(i.n)>=0)return 1;if(r.iadd(new s(e)),r.cmp(i.n)>=0&&r.isub(i.n),r.isZero())return 1;const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},privateKeyTweakMul(e,t){let r=new s(t);if(r.cmp(i.n)>=0||r.isZero())return 1;r.imul(new s(e)),r.cmp(i.n)>=0&&(r=r.umod(i.n));const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},publicKeyVerify:e=>null===o(e)?1:0,publicKeyCreate(e,t){const r=new s(t);if(r.cmp(i.n)>=0||r.isZero())return 1;return a(e,n.keyFromPrivate(t).getPublic()),0},publicKeyConvert(e,t){const r=o(t);if(null===r)return 1;return a(e,r.getPublic()),0},publicKeyNegate(e,t){const r=o(t);if(null===r)return 1;const n=r.getPublic();return n.y=n.y.redNeg(),a(e,n),0},publicKeyCombine(e,t){const r=new Array(t.length);for(let i=0;i<t.length;++i)if(r[i]=o(t[i]),null===r[i])return 1;let n=r[0].getPublic();for(let i=1;i<r.length;++i)n=n.add(r[i].pub);return n.isInfinity()?2:(a(e,n),0)},publicKeyTweakAdd(e,t,r){const n=o(t);if(null===n)return 1;if((r=new s(r)).cmp(i.n)>=0)return 2;const c=n.getPublic().add(i.g.mul(r));return c.isInfinity()?2:(a(e,c),0)},publicKeyTweakMul(e,t,r){const n=o(t);if(null===n)return 1;if((r=new s(r)).cmp(i.n)>=0||r.isZero())return 2;return a(e,n.getPublic().mul(r)),0},signatureNormalize(e){const t=new s(e.subarray(0,32)),r=new s(e.subarray(32,64));return t.cmp(i.n)>=0||r.cmp(i.n)>=0?1:(1===r.cmp(n.nh)&&e.set(i.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){const r=t.subarray(0,32),n=t.subarray(32,64);if(new s(r).cmp(i.n)>=0)return 1;if(new s(n).cmp(i.n)>=0)return 1;const{output:o}=e;let a=o.subarray(4,37);a[0]=0,a.set(r,1);let c=33,u=0;for(;c>1&&0===a[u]&&!(128&a[u+1]);--c,++u);if(a=a.subarray(u),128&a[0])return 1;if(c>1&&0===a[0]&&!(128&a[1]))return 1;let f=o.subarray(39,72);f[0]=0,f.set(n,1);let h=33,l=0;for(;h>1&&0===f[l]&&!(128&f[l+1]);--h,++l);return f=f.subarray(l),128&f[0]||h>1&&0===f[0]&&!(128&f[1])?1:(e.outputlen=6+c+h,o[0]=48,o[1]=e.outputlen-2,o[2]=2,o[3]=a.length,o.set(a,4),o[4+c]=2,o[5+c]=f.length,o.set(f,6+c),0)},signatureImport(e,t){if(t.length<8)return 1;if(t.length>72)return 1;if(48!==t[0])return 1;if(t[1]!==t.length-2)return 1;if(2!==t[2])return 1;const r=t[3];if(0===r)return 1;if(5+r>=t.length)return 1;if(2!==t[4+r])return 1;const n=t[5+r];if(0===n)return 1;if(6+r+n!==t.length)return 1;if(128&t[4])return 1;if(r>1&&0===t[4]&&!(128&t[5]))return 1;if(128&t[r+6])return 1;if(n>1&&0===t[r+6]&&!(128&t[r+7]))return 1;let o=t.subarray(4,4+r);if(33===o.length&&0===o[0]&&(o=o.subarray(1)),o.length>32)return 1;let a=t.subarray(6+r);if(33===a.length&&0===a[0]&&(a=a.slice(1)),a.length>32)throw new Error("S length is too long");let c=new s(o);c.cmp(i.n)>=0&&(c=new s(0));let u=new s(t.subarray(6+r));return u.cmp(i.n)>=0&&(u=new s(0)),e.set(c.toArrayLike(Uint8Array,"be",32),0),e.set(u.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,r,o,a){if(a){const e=a;a=n=>{const i=e(t,r,null,o,n);if(!(i instanceof Uint8Array&&32===i.length))throw new Error("This is the way");return new s(i)}}const c=new s(r);if(c.cmp(i.n)>=0||c.isZero())return 1;let u;try{u=n.sign(t,r,{canonical:!0,k:a,pers:o})}catch(f){return 1}return e.signature.set(u.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(u.s.toArrayLike(Uint8Array,"be",32),32),e.recid=u.recoveryParam,0},ecdsaVerify(e,t,r){const a={r:e.subarray(0,32),s:e.subarray(32,64)},c=new s(a.r),u=new s(a.s);if(c.cmp(i.n)>=0||u.cmp(i.n)>=0)return 1;if(1===u.cmp(n.nh)||c.isZero()||u.isZero())return 3;const f=o(r);if(null===f)return 2;const h=f.getPublic();return n.verify(t,a,h)?0:3},ecdsaRecover(e,t,r,o){const c={r:t.slice(0,32),s:t.slice(32,64)},u=new s(c.r),f=new s(c.s);if(u.cmp(i.n)>=0||f.cmp(i.n)>=0)return 1;if(u.isZero()||f.isZero())return 2;let h;try{h=n.recoverPubKey(o,c,r)}catch(l){return 2}return a(e,h),0},ecdh(e,t,r,a,c,u,f){const h=o(t);if(null===h)return 1;const l=new s(r);if(l.cmp(i.n)>=0||l.isZero())return 2;const d=h.getPublic().mul(l);if(void 0===c){const t=d.encode(null,!0),r=n.hash().update(t).digest();for(let n=0;n<32;++n)e[n]=r[n]}else{u||(u=new Uint8Array(32));const t=d.getX().toArray("be",32);for(let e=0;e<32;++e)u[e]=t[e];f||(f=new Uint8Array(32));const r=d.getY().toArray("be",32);for(let e=0;e<32;++e)f[e]=r[e];const n=c(u,f,a);if(!(n instanceof Uint8Array&&n.length===e.length))return 2;e.set(n)}return 0}}},function(e,t,r){"use strict";var n=t;n.version=r(421).version,n.utils=r(29),n.rand=r(214),n.curve=r(215),n.curves=r(125),n.ec=r(434),n.eddsa=r(438)},function(e){e.exports=JSON.parse('{"_from":"elliptic@^6.5.3","_id":"elliptic@6.5.3","_inBundle":false,"_integrity":"sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==","_location":"/elliptic","_phantomChildren":{},"_requested":{"type":"range","registry":true,"raw":"elliptic@^6.5.3","name":"elliptic","escapedName":"elliptic","rawSpec":"^6.5.3","saveSpec":null,"fetchSpec":"^6.5.3"},"_requiredBy":["/browserify-sign","/create-ecdh","/ethereumjs-block/ethereumjs-util","/ethereumjs-util","/merkle-patricia-tree/ethereumjs-util","/secp256k1","/tiny-secp256k1"],"_resolved":"https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz","_shasum":"cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6","_spec":"elliptic@^6.5.3","_where":"/Users/alex/Documents/Workspaces/ipfs/js-ipfs/node_modules/browserify-sign","author":{"name":"Fedor Indutny","email":"fedor@indutny.com"},"bugs":{"url":"https://github.com/indutny/elliptic/issues"},"bundleDependencies":false,"dependencies":{"bn.js":"^4.4.0","brorand":"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0","inherits":"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},"deprecated":false,"description":"EC cryptography","devDependencies":{"brfs":"^1.4.3","coveralls":"^3.0.8","grunt":"^1.0.4","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^9.0.1","istanbul":"^0.4.2","jscs":"^3.0.7","jshint":"^2.10.3","mocha":"^6.2.2"},"files":["lib"],"homepage":"https://github.com/indutny/elliptic","keywords":["EC","Elliptic","curve","Cryptography"],"license":"MIT","main":"lib/elliptic.js","name":"elliptic","repository":{"type":"git","url":"git+ssh://git@github.com/indutny/elliptic.git"},"scripts":{"jscs":"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js","jshint":"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js","lint":"npm run jscs && npm run jshint","test":"npm run lint && npm run unit","unit":"istanbul test _mocha --reporter=spec test/index.js","version":"grunt dist && git add dist/"},"version":"6.5.3"}')},function(e,t){},function(e,t){},function(e,t,r){"use strict";var n=r(29),i=r(33),s=r(24),o=r(96),a=n.assert;function c(e){o.call(this,"short",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(e,t,r,n){o.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(t,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function f(e,t,r,n){o.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(t,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}s(c,o),e.exports=c,c.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new i(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new i(e.lambda,16);else{var s=this._getEndoRoots(this.n);0===this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))?r=s[0]:(r=s[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new i(e.a,16),b:new i(e.b,16)}})):this._getEndoBasis(r)}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:i.mont(e),r=new i(2).toRed(t).redInvm(),n=r.redNeg(),s=new i(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(s).fromRed(),n.redSub(s).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,r,n,s,o,a,c,u,f,h=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=e,d=this.n.clone(),p=new i(1),b=new i(0),y=new i(0),m=new i(1),g=0;0!==l.cmpn(0);){var v=d.div(l);u=d.sub(v.mul(l)),f=y.sub(v.mul(p));var w=m.sub(v.mul(b));if(!n&&u.cmp(h)<0)t=c.neg(),r=p,n=u.neg(),s=f;else if(n&&2==++g)break;c=u,d=l,l=u,y=p,p=f,m=b,b=w}o=u.neg(),a=f;var _=n.sqr().add(s.sqr());return o.sqr().add(a.sqr()).cmp(_)>=0&&(o=t,a=r),n.negative&&(n=n.neg(),s=s.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:s},{a:o,b:a}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),s=r.b.neg().mul(e).divRound(this.n),o=i.mul(r.a),a=s.mul(n.a),c=i.mul(r.b),u=s.mul(n.b);return{k1:e.sub(o).sub(a),k2:c.add(u).neg()}},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var s=n.fromRed().isOdd();return(t&&!s||!t&&s)&&(n=n.redNeg()),this.point(e,n)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s<e.length;s++){var o=this._endoSplit(t[s]),a=e[s],c=a._getBeta();o.k1.negative&&(o.k1.ineg(),a=a.neg(!0)),o.k2.negative&&(o.k2.ineg(),c=c.neg(!0)),n[2*s]=a,n[2*s+1]=c,i[2*s]=o.k1,i[2*s+1]=o.k2}for(var u=this._wnafMulAdd(1,n,i,2*s,r),f=0;f<2*s;f++)n[f]=null,i[f]=null;return u},s(u,o.BasePoint),c.prototype.point=function(e,t,r){return new u(this,e,t,r)},c.prototype.pointFromJSON=function(e,t){return u.fromJSON(this,e,t)},u.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},u.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},u.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function i(t){return e.point(t[0],t[1],r)}var s=t[2];return n.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[n].concat(s.doubles.points.map(i))},naf:s.naf&&{wnd:s.naf.wnd,points:[n].concat(s.naf.points.map(i))}},n},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},u.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(e){return e=new i(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},u.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},u.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},u.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},s(f,o.BasePoint),c.prototype.jpoint=function(e,t,r){return new f(this,e,t,r)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),s=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),a=n.redSub(i),c=s.redSub(o);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),f=u.redMul(a),h=n.redMul(u),l=c.redSqr().redIAdd(f).redISub(h).redISub(h),d=c.redMul(h.redISub(l)).redISub(s.redMul(f)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(l,d,p)},f.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,s=e.y.redMul(t).redMul(this.z),o=r.redSub(n),a=i.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=o.redSqr(),u=c.redMul(o),f=r.redMul(c),h=a.redSqr().redIAdd(u).redISub(f).redISub(f),l=a.redMul(f.redISub(h)).redISub(i.redMul(u)),d=this.z.redMul(o);return this.curve.jpoint(h,l,d)},f.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}var n=this.curve.a,i=this.curve.tinv,s=this.x,o=this.y,a=this.z,c=a.redSqr().redSqr(),u=o.redAdd(o);for(r=0;r<e;r++){var f=s.redSqr(),h=u.redSqr(),l=h.redSqr(),d=f.redAdd(f).redIAdd(f).redIAdd(n.redMul(c)),p=s.redMul(h),b=d.redSqr().redISub(p.redAdd(p)),y=p.redISub(b),m=d.redMul(y);m=m.redIAdd(m).redISub(l);var g=u.redMul(a);r+1<e&&(c=c.redMul(l)),s=b,a=g,u=m}return this.curve.jpoint(s,u.redMul(i),a)},f.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},f.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(n).redISub(s);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n),c=a.redSqr().redISub(o).redISub(o),u=s.redIAdd(s);u=(u=u.redIAdd(u)).redIAdd(u),e=c,t=a.redMul(o.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var f=this.x.redSqr(),h=this.y.redSqr(),l=h.redSqr(),d=this.x.redAdd(h).redSqr().redISub(f).redISub(l);d=d.redIAdd(d);var p=f.redAdd(f).redIAdd(f),b=p.redSqr(),y=l.redIAdd(l);y=(y=y.redIAdd(y)).redIAdd(y),e=b.redISub(d).redISub(d),t=p.redMul(d.redISub(e)).redISub(y),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},f.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(n).redISub(s);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),c=a.redSqr().redISub(o).redISub(o);e=c;var u=s.redIAdd(s);u=(u=u.redIAdd(u)).redIAdd(u),t=a.redMul(o.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var f=this.z.redSqr(),h=this.y.redSqr(),l=this.x.redMul(h),d=this.x.redSub(f).redMul(this.x.redAdd(f));d=d.redAdd(d).redIAdd(d);var p=l.redIAdd(l),b=(p=p.redIAdd(p)).redAdd(p);e=d.redSqr().redISub(b),r=this.y.redAdd(this.z).redSqr().redISub(h).redISub(f);var y=h.redSqr();y=(y=(y=y.redIAdd(y)).redIAdd(y)).redIAdd(y),t=d.redMul(p.redISub(e)).redISub(y)}return this.curve.jpoint(e,t,r)},f.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),s=t.redSqr(),o=r.redSqr(),a=s.redAdd(s).redIAdd(s).redIAdd(e.redMul(i)),c=t.redAdd(t),u=(c=c.redIAdd(c)).redMul(o),f=a.redSqr().redISub(u.redAdd(u)),h=u.redISub(f),l=o.redSqr();l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=a.redMul(h).redISub(l),p=r.redAdd(r).redMul(n);return this.curve.jpoint(f,d,p)},f.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),i=e.redAdd(e).redIAdd(e),s=i.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(n),a=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(s)).redSqr(),c=n.redIAdd(n);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var u=i.redIAdd(o).redSqr().redISub(s).redISub(a).redISub(c),f=t.redMul(u);f=(f=f.redIAdd(f)).redIAdd(f);var h=this.x.redMul(a).redISub(f);h=(h=h.redIAdd(h)).redIAdd(h);var l=this.y.redMul(u.redMul(c.redISub(u)).redISub(o.redMul(a)));l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=this.z.redAdd(o).redSqr().redISub(r).redISub(a);return this.curve.jpoint(h,l,d)},f.prototype.mul=function(e,t){return e=new i(e,t),this.curve._wnafMul(this,e)},f.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),i=r.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(n)).cmpn(0)},f.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),i=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},f.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(e,t,r){"use strict";var n=r(33),i=r(24),s=r(96),o=r(29);function a(e){s.call(this,"mont",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,r){s.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,s),e.exports=a,a.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},i(c,s.BasePoint),a.prototype.decodePoint=function(e,t){return this.point(o.toArray(e,t),1)},a.prototype.point=function(e,t){return new c(this,e,t)},a.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),s=e.x.redSub(e.z).redMul(r),o=i.redMul(n),a=t.z.redMul(s.redAdd(o).redSqr()),c=t.x.redMul(s.redISub(o).redSqr());return this.curve.point(a,c)},c.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var s=i.length-1;s>=0;s--)0===i[s]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(e,t,r){"use strict";var n=r(29),i=r(33),s=r(24),o=r(96),a=n.assert;function c(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,o.call(this,"edwards",e),this.a=new i(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function u(e,t,r,n,s){o.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(t,16),this.y=new i(r,16),this.z=n?new i(n,16):this.curve.one,this.t=s&&new i(s,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}s(c,o),e.exports=c,c.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},c.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},c.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),s=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=n.redMul(s.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var c=a.fromRed().isOdd();return(t&&!c||!t&&c)&&(a=a.redNeg()),this.point(e,a)},c.prototype.pointFromY=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),s=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=n.redMul(s.redInvm());if(0===o.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},c.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(i)},s(u,o.BasePoint),c.prototype.pointFromJSON=function(e){return u.fromJSON(this,e)},c.prototype.point=function(e,t,r,n){return new u(this,e,t,r,n)},u.fromJSON=function(e,t){return new u(e,t[0],t[1],t[2])},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),s=n.redAdd(t),o=s.redSub(r),a=n.redSub(t),c=i.redMul(o),u=s.redMul(a),f=i.redMul(a),h=o.redMul(s);return this.curve.point(c,u,h,f)},u.prototype._projDbl=function(){var e,t,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),s=this.y.redSqr();if(this.curve.twisted){var o=(u=this.curve._mulA(i)).redAdd(s);if(this.zOne)e=n.redSub(i).redSub(s).redMul(o.redSub(this.curve.two)),t=o.redMul(u.redSub(s)),r=o.redSqr().redSub(o).redSub(o);else{var a=this.z.redSqr(),c=o.redSub(a).redISub(a);e=n.redSub(i).redISub(s).redMul(c),t=o.redMul(u.redSub(s)),r=o.redMul(c)}}else{var u=i.redAdd(s);a=this.curve._mulC(this.z).redSqr(),c=u.redSub(a).redSub(a);e=this.curve._mulC(n.redISub(u)).redMul(c),t=this.curve._mulC(u).redMul(i.redISub(s)),r=u.redMul(c)}return this.curve.point(e,t,r)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),s=r.redSub(t),o=i.redSub(n),a=i.redAdd(n),c=r.redAdd(t),u=s.redMul(o),f=a.redMul(c),h=s.redMul(c),l=o.redMul(a);return this.curve.point(u,f,l,h)},u.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),s=this.x.redMul(e.x),o=this.y.redMul(e.y),a=this.curve.d.redMul(s).redMul(o),c=i.redSub(a),u=i.redAdd(a),f=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(s).redISub(o),h=n.redMul(c).redMul(f);return this.curve.twisted?(t=n.redMul(u).redMul(o.redSub(this.curve._mulA(s))),r=c.redMul(u)):(t=n.redMul(u).redMul(o.redSub(s)),r=this.curve._mulC(c).redMul(u)),this.curve.point(h,t,r)},u.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},u.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},u.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},u.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},function(e,t,r){"use strict";t.sha1=r(428),t.sha224=r(429),t.sha256=r(217),t.sha384=r(430),t.sha512=r(218)},function(e,t,r){"use strict";var n=r(31),i=r(74),s=r(216),o=n.rotl32,a=n.sum32,c=n.sum32_5,u=s.ft_1,f=i.BlockHash,h=[1518500249,1859775393,2400959708,3395469782];function l(){if(!(this instanceof l))return new l;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(l,f),e.exports=l,l.blockSize=512,l.outSize=160,l.hmacStrength=80,l.padLength=64,l.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=o(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],s=this.h[1],f=this.h[2],l=this.h[3],d=this.h[4];for(n=0;n<r.length;n++){var p=~~(n/20),b=c(o(i,5),u(p,s,f,l),d,r[n],h[p]);d=l,l=f,f=o(s,30),s=i,i=b}this.h[0]=a(this.h[0],i),this.h[1]=a(this.h[1],s),this.h[2]=a(this.h[2],f),this.h[3]=a(this.h[3],l),this.h[4]=a(this.h[4],d)},l.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(e,t,r){"use strict";var n=r(31),i=r(217);function s(){if(!(this instanceof s))return new s;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(s,i),e.exports=s,s.blockSize=512,s.outSize=224,s.hmacStrength=192,s.padLength=64,s.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},function(e,t,r){"use strict";var n=r(31),i=r(218);function s(){if(!(this instanceof s))return new s;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(s,i),e.exports=s,s.blockSize=1024,s.outSize=384,s.hmacStrength=192,s.padLength=128,s.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},function(e,t,r){"use strict";var n=r(31),i=r(74),s=n.rotl32,o=n.sum32,a=n.sum32_3,c=n.sum32_4,u=i.BlockHash;function f(){if(!(this instanceof f))return new f;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function h(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function l(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function d(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}n.inherits(f,u),t.ripemd160=f,f.blockSize=512,f.outSize=160,f.hmacStrength=192,f.padLength=64,f.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],i=this.h[2],u=this.h[3],f=this.h[4],g=r,v=n,w=i,_=u,E=f,k=0;k<80;k++){var S=o(s(c(r,h(k,n,i,u),e[p[k]+t],l(k)),y[k]),f);r=f,f=u,u=s(i,10),i=n,n=S,S=o(s(c(g,h(79-k,v,w,_),e[b[k]+t],d(k)),m[k]),E),g=E,E=_,_=s(w,10),w=v,v=S}S=a(this.h[1],i,_),this.h[1]=a(this.h[2],u,E),this.h[2]=a(this.h[3],f,g),this.h[3]=a(this.h[4],r,v),this.h[4]=a(this.h[0],n,w),this.h[0]=S},f.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var p=[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],b=[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],y=[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],m=[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]},function(e,t,r){"use strict";var n=r(31),i=r(48);function s(e,t,r){if(!(this instanceof s))return new s(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(t,r))}e.exports=s,s.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},s.prototype.update=function(e,t){return this.inner.update(e,t),this},s.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},function(e,t,r){"use strict";e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},function(e,t,r){"use strict";var n=r(33),i=r(435),s=r(29),o=r(125),a=r(214),c=s.assert,u=r(436),f=r(437);function h(e){if(!(this instanceof h))return new h(e);"string"==typeof e&&(c(o.hasOwnProperty(e),"Unknown curve "+e),e=o[e]),e instanceof o.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=h,h.prototype.keyPair=function(e){return new u(this,e)},h.prototype.keyFromPrivate=function(e,t){return u.fromPrivate(this,e,t)},h.prototype.keyFromPublic=function(e,t){return u.fromPublic(this,e,t)},h.prototype.genKeyPair=function(e){e||(e={});for(var t=new i({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||a(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),s=this.n.sub(new n(2));;){var o=new n(t.generate(r));if(!(o.cmp(s)>0))return o.iaddn(1),this.keyFromPrivate(o)}},h.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},h.prototype.sign=function(e,t,r,s){"object"==typeof r&&(s=r,r=null),s||(s={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new n(e,16));for(var o=this.n.byteLength(),a=t.getPrivate().toArray("be",o),c=e.toArray("be",o),u=new i({hash:this.hash,entropy:a,nonce:c,pers:s.pers,persEnc:s.persEnc||"utf8"}),h=this.n.sub(new n(1)),l=0;;l++){var d=s.k?s.k(l):new n(u.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(h)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var b=p.getX(),y=b.umod(this.n);if(0!==y.cmpn(0)){var m=d.invm(this.n).mul(y.mul(t.getPrivate()).iadd(e));if(0!==(m=m.umod(this.n)).cmpn(0)){var g=(p.getY().isOdd()?1:0)|(0!==b.cmp(y)?2:0);return s.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),g^=1),new f({r:y,s:m,recoveryParam:g})}}}}}},h.prototype.verify=function(e,t,r,i){e=this._truncateToN(new n(e,16)),r=this.keyFromPublic(r,i);var s=(t=new f(t,"hex")).r,o=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,c=o.invm(this.n),u=c.mul(e).umod(this.n),h=c.mul(s).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,r.getPublic(),h)).isInfinity()&&a.eqXToP(s):!(a=this.g.mulAdd(u,r.getPublic(),h)).isInfinity()&&0===a.getX().umod(this.n).cmp(s)},h.prototype.recoverPubKey=function(e,t,r,i){c((3&r)===r,"The recovery param is more than two bits"),t=new f(t,i);var s=this.n,o=new n(e),a=t.r,u=t.s,h=1&r,l=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");a=l?this.curve.pointFromX(a.add(this.curve.n),h):this.curve.pointFromX(a,h);var d=t.r.invm(s),p=s.sub(o).mul(d).umod(s),b=u.mul(d).umod(s);return this.g.mulAdd(p,a,b)},h.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new f(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(e,t,i)}catch(e){continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},function(e,t,r){"use strict";var n=r(126),i=r(213),s=r(48);function o(e){if(!(this instanceof o))return new o(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=i.toArray(e.entropy,e.entropyEnc||"hex"),r=i.toArray(e.nonce,e.nonceEnc||"hex"),n=i.toArray(e.pers,e.persEnc||"hex");s(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}e.exports=o,o.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},o.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},o.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},o.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=i.toArray(e,t),r=i.toArray(r,n),s(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},o.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var o=s.slice(0,e);return this._update(r),this._reseed++,i.encode(o,t)}},function(e,t,r){"use strict";var n=r(33),i=r(29).assert;function s(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=s,s.fromPublic=function(e,t,r){return t instanceof s?t:new s(e,{pub:t,pubEnc:r})},s.fromPrivate=function(e,t,r){return t instanceof s?t:new s(e,{priv:t,privEnc:r})},s.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},s.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},s.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},s.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},s.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},s.prototype.derive=function(e){return e.mul(this.priv).getX()},s.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},s.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},s.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},function(e,t,r){"use strict";var n=r(33),i=r(29),s=i.assert;function o(e,t){if(e instanceof o)return e;this._importDER(e,t)||(s(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a(){this.place=0}function c(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,s=0,o=t.place;s<n;s++,o++)i<<=8,i|=e[o],i>>>=0;return!(i<=127)&&(t.place=o,i)}function u(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function f(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}e.exports=o,o.prototype._importDER=function(e,t){e=i.toArray(e,t);var r=new a;if(48!==e[r.place++])return!1;var s=c(e,r);if(!1===s)return!1;if(s+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var o=c(e,r);if(!1===o)return!1;var u=e.slice(r.place,o+r.place);if(r.place+=o,2!==e[r.place++])return!1;var f=c(e,r);if(!1===f)return!1;if(e.length!==f+r.place)return!1;var h=e.slice(r.place,f+r.place);if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===h[0]){if(!(128&h[1]))return!1;h=h.slice(1)}return this.r=new n(u),this.s=new n(h),this.recoveryParam=null,!0},o.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=u(t),r=u(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];f(n,t.length),(n=n.concat(t)).push(2),f(n,r.length);var s=n.concat(r),o=[48];return f(o,s.length),o=o.concat(s),i.encode(o,e)}},function(e,t,r){"use strict";var n=r(126),i=r(125),s=r(29),o=s.assert,a=s.parseBytes,c=r(439),u=r(440);function f(e){if(o("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof f))return new f(e);e=i[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}e.exports=f,f.prototype.sign=function(e,t){e=a(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),s=this.encodePoint(i),o=this.hashInt(s,r.pubBytes(),e).mul(r.priv()),c=n.add(o).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:s})},f.prototype.verify=function(e,t,r){e=a(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),s=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(s)},f.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return s.intFromLE(e.digest()).umod(this.curve.n)},f.prototype.keyFromPublic=function(e){return c.fromPublic(this,e)},f.prototype.keyFromSecret=function(e){return c.fromSecret(this,e)},f.prototype.makeSignature=function(e){return e instanceof u?e:new u(this,e)},f.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},f.prototype.decodePoint=function(e){var t=(e=s.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),n=0!=(128&e[t]),i=s.intFromLE(r);return this.curve.pointFromY(i,n)},f.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},f.prototype.decodeInt=function(e){return s.intFromLE(e)},f.prototype.isPoint=function(e){return e instanceof this.pointClass}},function(e,t,r){"use strict";var n=r(29),i=n.assert,s=n.parseBytes,o=n.cachedProperty;function a(e,t){this.eddsa=e,this._secret=s(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=s(t.pub)}a.fromPublic=function(e,t){return t instanceof a?t:new a(e,{pub:t})},a.fromSecret=function(e,t){return t instanceof a?t:new a(e,{secret:t})},a.prototype.secret=function(){return this._secret},o(a,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),o(a,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),o(a,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),o(a,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),o(a,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),o(a,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),a.prototype.sign=function(e){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},a.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},a.prototype.getSecret=function(e){return i(this._secret,"KeyPair is public only"),n.encode(this.secret(),e)},a.prototype.getPublic=function(e){return n.encode(this.pubBytes(),e)},e.exports=a},function(e,t,r){"use strict";var n=r(33),i=r(29),s=i.assert,o=i.cachedProperty,a=i.parseBytes;function c(e,t){this.eddsa=e,"object"!=typeof t&&(t=a(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),s(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof n&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}o(c,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),o(c,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),o(c,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),o(c,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),c.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},c.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},e.exports=c},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(1),s=r(219),o={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=async(e,t,r)=>{const a=o[e];if(!a){const t=Object.keys(o).join(" / ");throw i(new Error("unknown cipher type '".concat(e,"'. Must be ").concat(t)),"ERR_INVALID_CIPHER_TYPE")}if(!t)throw i(new Error("missing hash type"),"ERR_MISSING_HASH_TYPE");const c=a.keySize,u=a.ivSize,f=n.from("key expansion"),h=2*(u+c+20),l=await s.create(t,r);let d=await l.digest(f);const p=[];let b=0;for(;b<h;){const e=await l.digest(n.concat([d,f]));let t=e.length;b+t>h&&(t=h-b),p.push(e),b+=t,d=await l.digest(d)}const y=h/2,m=n.concat(p),g=m.slice(0,y),v=m.slice(y,h),w=e=>({iv:e.slice(0,u),cipherKey:e.slice(u,u+c),macKey:e.slice(u+c)});return{k1:w(g),k2:w(v)}}},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(444);e.exports=async e=>n.generateEphmeralKeyPair(e)},function(e,t,r){"use strict";const n=r(1),{Buffer:i}=r(0),s=r(93),{bufferToBase64url:o,base64urlToBuffer:a}=r(123),c=r(445),u={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=async function(e){c(Object.keys(u),e);const t=await s.get().subtle.generateKey({name:"ECDH",namedCurve:e},!0,["deriveBits"]);return{key:h(await s.get().subtle.exportKey("jwk",t.publicKey)),genSharedKey:async(r,n)=>{let o;o=n?await s.get().subtle.importKey("jwk",d(e,n),{name:"ECDH",namedCurve:e},!1,["deriveBits"]):t.privateKey;const a=[await s.get().subtle.importKey("jwk",l(e,r),{name:"ECDH",namedCurve:e},!1,[]),o];return i.from(await s.get().subtle.deriveBits({name:"ECDH",namedCurve:e,public:a[0]},a[1],u[e]))}}};const f={"P-256":32,"P-384":48,"P-521":66};function h(e){const t=f[e.crv];return i.concat([i.from([4]),a(e.x,t),a(e.y,t)],1+2*t)}function l(e,t){const r=f[e];if(!t.slice(0,1).equals(i.from([4])))throw n(new Error("Cannot unmarshal public key - invalid key format"),"ERR_INVALID_KEY_FORMAT");return{kty:"EC",crv:e,x:o(t.slice(1,r+1),r),y:o(t.slice(1+r),r),ext:!0}}const d=(e,t)=>({...l(e,t.public),d:o(t.private)})},function(e,t,r){"use strict";const n=r(1);e.exports=function(e,t){if(!e.includes(t)){const r=e.join(" / ");throw n(new Error("Unknown curve: ".concat(t,". Must be ").concat(r)),"ERR_INVALID_CURVE")}}},function(e,t,r){"use strict";const n=r(16);e.exports=n("\n\nmessage PeerIdProto {\n required bytes id = 1;\n bytes pubKey = 2;\n bytes privKey = 3;\n}\n\n")},function(e,t,r){"use strict";const n=r(448),i=r(449);t.create=async function(e,t){const r=i(e),s=n.createCipheriv(r,e,t),o=n.createDecipheriv(r,e,t);return{encrypt:async e=>s.update(e),decrypt:async e=>o.update(e)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);r(73);const i=r(5);e.exports={createCipheriv:(e,t,r)=>{const s=i.cipher.createCipher("AES-CTR",t.toString("binary"));return s.start({iv:r.toString("binary")}),{update:e=>(s.update(i.util.createBuffer(e.toString("binary"))),n.from(s.output.getBytes(),"binary"))}},createDecipheriv:(e,t,r)=>{const s=i.cipher.createDecipher("AES-CTR",t.toString("binary"));return s.start({iv:r.toString("binary")}),{update:e=>(s.update(i.util.createBuffer(e.toString("binary"))),n.from(s.output.getBytes(),"binary"))}}}},function(e,t,r){"use strict";const n=r(1),i={16:"aes-128-ctr",32:"aes-256-ctr"};e.exports=function(e){const t=i[e.length];if(!t){const t=Object.entries(i).map(([e,t])=>"".concat(e," (").concat(t,")")).join(" / ");throw n(new Error("Invalid key length ".concat(e.length," bytes. Must be ").concat(t)),"ERR_INVALID_KEY_LENGTH")}return t}},function(e,t,r){"use strict";const n=r(205),i=r(9),s=r(1),o={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(e,t,r,a,c){const u=o[c];if(!u){const e=Object.keys(o).join(" / ");throw s(new Error("Hash '".concat(c,"' is unknown or not supported. Must be ").concat(e)),"ERR_UNSUPPORTED_HASH_TYPE")}const f=n(e,t,r,a,u);return i.encode64(f)}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(220),s=r(14),o=r(457);function a(e){t.decode(e)}t.names=o.names,t.codes=o.codes,t.defaultLengths=o.defaultLengths,t.toHexString=function(e){if(!n.isBuffer(e))throw new Error("must be passed a buffer");return e.toString("hex")},t.fromHexString=function(e){return n.from(e,"hex")},t.toB58String=function(e){if(!n.isBuffer(e))throw new Error("must be passed a buffer");return i.encode("base58btc",e).toString().slice(1)},t.fromB58String=function(e){let t=e;return n.isBuffer(e)&&(t=e.toString()),i.decode("z"+t)},t.decode=function(e){if(!n.isBuffer(e))throw new Error("multihash must be a Buffer");if(e.length<2)throw new Error("multihash too short. must be > 2 bytes.");const r=s.decode(e);if(!t.isValidCode(r))throw new Error("multihash unknown function code: 0x".concat(r.toString(16)));e=e.slice(s.decode.bytes);const i=s.decode(e);if(i<0)throw new Error("multihash invalid length: ".concat(i));if((e=e.slice(s.decode.bytes)).length!==i)throw new Error("multihash length inconsistent: 0x".concat(e.toString("hex")));return{code:r,name:o.codes[r],length:i,digest:e}},t.encode=function(e,r,i){if(!e||void 0===r)throw new Error("multihash encode requires at least two args: digest, code");const o=t.coerceCode(r);if(!n.isBuffer(e))throw new Error("digest should be a Buffer");if(null==i&&(i=e.length),i&&e.length!==i)throw new Error("digest length should be equal to specified length.");return n.concat([n.from(s.encode(o)),n.from(s.encode(i)),e])},t.coerceCode=function(e){let r=e;if("string"==typeof e){if(void 0===o.names[e])throw new Error("Unrecognized hash function named: ".concat(e));r=o.names[e]}if("number"!=typeof r)throw new Error("Hash function code should be a number. Got: ".concat(r));if(void 0===o.codes[r]&&!t.isAppCode(r))throw new Error("Unrecognized function code: ".concat(r));return r},t.isAppCode=function(e){return e>0&&e<16},t.isValidCode=function(e){return!!t.isAppCode(e)||!!o.codes[e]},t.validate=a,t.prefix=function(e){return a(e),e.slice(0,2)}},function(e,t,r){"use strict";const n=r(453),i=r(42),s=r(454),o=r(455),a=r(456),c=[["base1","1","","1"],["base2","0",i,"01"],["base8","7",i,"01234567"],["base10","9",i,"0123456789"],["base16","f",s,"0123456789abcdef"],["base32","b",o,"abcdefghijklmnopqrstuvwxyz234567"],["base32pad","c",o,"abcdefghijklmnopqrstuvwxyz234567="],["base32hex","v",o,"0123456789abcdefghijklmnopqrstuv"],["base32hexpad","t",o,"0123456789abcdefghijklmnopqrstuv="],["base32z","h",o,"ybndrfg8ejkmcpqxot1uwisza345h769"],["base58flickr","Z",i,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base58btc","z",i,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base64","m",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],u=c.reduce((e,t)=>(e[t[0]]=new n(t[0],t[1],t[2],t[3]),e),{}),f=c.reduce((e,t)=>(e[t[1]]=u[t[0]],e),{});e.exports={names:u,codes:f}},function(e,t,r){"use strict";e.exports=class{constructor(e,t,r,n){this.name=e,this.code=t,this.alphabet=n,r&&n&&(this.engine=r(n))}encode(e){return this.engine.encode(e)}decode(e){return this.engine.decode(e)}isImplemented(){return this.engine}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports=function(e){return{encode:e=>"string"==typeof e?n.from(e).toString("hex"):e.toString("hex"),decode(t){for(const r of t)if(e.indexOf(r)<0)throw new Error("invalid base16 character");return n.from(t,"hex")}}}},function(e,t,r){"use strict";function n(e,t){const r=e.byteLength,n=new Uint8Array(e),i=t.indexOf("=")===t.length-1;i&&(t=t.substring(0,t.length-1));let s=0,o=0,a="";for(let c=0;c<r;c++)for(o=o<<8|n[c],s+=8;s>=5;)a+=t[o>>>s-5&31],s-=5;if(s>0&&(a+=t[o<<5-s&31]),i)for(;a.length%8!=0;)a+="=";return a}e.exports=function(e){return{encode:t=>n("string"==typeof t?Uint8Array.from(t):t,e),decode(t){for(const r of t)if(e.indexOf(r)<0)throw new Error("invalid base32 character");return function(e,t){const r=(e=e.replace(new RegExp("=","g"),"")).length;let n=0,i=0,s=0;const o=new Uint8Array(5*r/8|0);for(let a=0;a<r;a++)i=i<<5|t.indexOf(e[a]),n+=5,n>=8&&(o[s++]=i>>>n-8&255,n-=8);return o.buffer}(t,e)}}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports=function(e){const t=e.indexOf("=")>-1,r=e.indexOf("-")>-1&&e.indexOf("_")>-1;return{encode(e){let i="";i="string"==typeof e?n.from(e).toString("base64"):e.toString("base64"),r&&(i=i.replace(/\+/g,"-").replace(/\//g,"_"));const s=i.indexOf("=");return s>0&&!t&&(i=i.substring(0,s)),i},decode(t){for(const r of t)if(e.indexOf(r)<0)throw new Error("invalid base64 character");return n.from(t,"base64")}}}},function(e,t,r){"use strict";t.names=Object.freeze({identity: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,md4:212,md5:213,"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({0:"identity",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",212:"md4",213:"md5",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",46e3:"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,46e3:80,46001:81,46002:82,46003:83,46004:84,46005:85,46006:86,46007:87,46008:88,46009:89,46010:90,46011:91,46012:92,46013:93,46014:94,46015:95,46016:96,46017:97,46018:98,46019:99,46020:100,46021:101,46022:102,46023:103,46024:104,46025:105,46026:106,46027:107,46028:108,46029:109,46030:110,46031:111,46032:112,46033:113,46034:114,46035:115,46036:116,46037:117,46038:118,46039:119,46040:120,46041:121,46042:122,46043:123,46044:124,46045:125,46046:126,46047:127,46048:128})},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(459),s=r(127),o=r(14);function a(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n<r.length;n++){const i=r[n],o=s(i);if(0!==o.size){if(n++,n>=r.length)throw g("invalid address: "+e);if(o.path){t.push([i,m(r.slice(n).join("/"))]);break}t.push([i,r[n]])}else t.push([i])}return t}function c(e){const t=[];return e.map(e=>{const r=v(e);t.push(r.name),e.length>1&&t.push(e[1])}),m(t.join("/"))}function u(e){return e.map(e=>{Array.isArray(e)||(e=[e]);const t=v(e);return e.length>1?[t.code,i.toBuffer(t.code,e[1])]:[t.code]})}function f(e){return e.map(e=>{const t=v(e);return e.length>1?[t.code,i.toString(t.code,e[1])]:[t.code]})}function h(e){return b(n.concat(e.map(e=>{const t=v(e);let r=n.from(o.encode(t.code));return e.length>1&&(r=n.concat([r,e[1]])),r})))}function l(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;return o.decode(t)+o.decode.bytes}function d(e){const t=[];let r=0;for(;r<e.length;){const n=o.decode(e,r),i=o.decode.bytes,a=l(s(n),e.slice(r+i));if(0===a){t.push([n]),r+=i;continue}const c=e.slice(r+i,r+i+a);if(r+=a+i,r>e.length)throw g("Invalid address buffer: "+e.toString("hex"));t.push([n,c])}return t}function p(e){return h(u(a(e=m(e))))}function b(e){const t=y(e);if(t)throw t;return n.from(e)}function y(e){try{d(e)}catch(t){return t}}function m(e){return"/"+e.trim().split("/").filter(e=>e).join("/")}function g(e){return new Error("Error parsing address: "+e)}function v(e){return s(e[0])}e.exports={stringToStringTuples:a,stringTuplesToString:c,tuplesToStringTuples:f,stringTuplesToTuples:u,bufferToTuples:d,tuplesToBuffer:h,bufferToString:function(e){const t=d(e);return c(f(t))},stringToBuffer:p,fromString:function(e){return p(e)},fromBuffer:b,validateBuffer:y,isValidBuffer:function(e){return void 0===y(e)},cleanPath:m,ParseError:g,protoFromTuple:v,sizeForAddr:l}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(460),s=r(127),o=r(4),a=r(221),c=r(14);function u(e,t){return t instanceof n?u.toString(e,t):u.toBuffer(e,t)}function f(e){if(!i.isIP(e))throw new Error("invalid ip address");return i.toBuffer(e)}function h(e){const t=n.alloc(2);return t.writeUInt16BE(e,0),t}function l(e){return e.readUInt16BE(0)}function d(e){const t=e.slice(0,e.length-2),r=e.slice(e.length-2);return a.encode("base32",t).toString().slice(1)+":"+l(r)}e.exports=u,u.toString=function(e,t){switch((e=s(e)).code){case 4:case 41:return function(e){const t=i.toString(e);if(!t||!i.isIP(t))throw new Error("invalid ip address");return t}(t);case 6:case 273:case 33:case 132:return l(t);case 53:case 54:case 55:case 56:case 400:case 777:return function(e){const t=c.decode(e);if((e=e.slice(c.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return e.toString()}(t);case 421:return function(e){const t=c.decode(e),r=e.slice(c.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return a.encode("base58btc",r).toString().slice(1)}(t);case 444:case 445:return d(t);default:return t.toString("hex")}},u.toBuffer=function(e,t){switch((e=s(e)).code){case 4:case 41:return f(t);case 6:case 273:case 33:case 132:return h(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 777:return function(e){const t=n.from(e),r=n.from(c.encode(t.length));return n.concat([r,t])}(t);case 421:return function(e){const t=new o(e).multihash,r=n.from(c.encode(t.length));return n.concat([r,t])}(t);case 444:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: "+t+" does not contain a port number");if(16!==t[0].length)throw new Error("failed to parse onion addr: "+t[0]+" not a Tor onion address.");const r=a.decode("b"+t[0]),i=parseInt(t[1],10);if(i<1||i>65536)throw new Error("Port number is not in range(1, 65536)");const s=h(i);return n.concat([r,s])}(t);case 445:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: "+t+" does not contain a port number");if(56!==t[0].length)throw new Error("failed to parse onion addr: "+t[0]+" not a Tor onion3 address.");const r=a.decode("b"+t[0]),i=parseInt(t[1],10);if(i<1||i>65536)throw new Error("Port number is not in range(1, 65536)");const s=h(i);return n.concat([r,s])}(t);default:return n.from(t,"hex")}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(461),s=i,o=i.v4,a=i.v6,c=function(e,t,r){var i;if(r=~~r,o(e))i=t||n.alloc(r+4),e.split(/\./g).map((function(e){i[r++]=255&parseInt(e,10)}));else if(a(e)){var s,u=e.split(":",8);for(s=0;s<u.length;s++){var f;o(u[s])&&(f=c(u[s]),u[s]=f.slice(0,2).toString("hex")),f&&++s<8&&u.splice(s,0,f.slice(2,4).toString("hex"))}if(""===u[0])for(;u.length<8;)u.unshift("0");else if(""===u[u.length-1])for(;u.length<8;)u.push("0");else if(u.length<8){for(s=0;s<u.length&&""!==u[s];s++);var h=[s,"1"];for(s=9-u.length;s>0;s--)h.push("0");u.splice.apply(u,h)}for(i=t||n.alloc(r+16),s=0;s<u.length;s++){var l=parseInt(u[s],16);i[r++]=l>>8&255,i[r++]=255&l}}if(!i)throw Error("Invalid ip address: "+e);return i};e.exports={isIP:s,isV4:o,isV6:a,toBuffer:c,toString:function(e,t,r){t=~~t;var n,i=[];if(4===(r=r||e.length-t)){for(let n=0;n<r;n++)i.push(e[t+n]);n=i.join(".")}else if(16===r){for(let n=0;n<r;n+=2)i.push(e.readUInt16BE(t+n).toString(16));n=(n=(n=i.join(":")).replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3")).replace(/:{3,4}/,"::")}return n}}},function(e,t,r){"use strict";const n=r(462),i=e=>n({exact:!0}).test(e);i.v4=e=>n.v4({exact:!0}).test(e),i.v6=e=>n.v6({exact:!0}).test(e),i.version=e=>i(e)?i.v4(e)?4:6:void 0,e.exports=i},function(e,t,r){"use strict";const n=e=>e&&e.includeBoundaries?"(?:(?<=\\s|^)(?=".concat("[a-fA-F\\d:]",")|(?<=").concat("[a-fA-F\\d:]",")(?=\\s|$))"):"",i="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",s="[a-fA-F\\d]{1,4}",o="\n(\n(?:".concat(s,":){7}(?:").concat(s,"|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:").concat(s,":){6}(?:").concat(i,"|:").concat(s,"|:)| // 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(?:").concat(s,":){5}(?::").concat(i,"|(:").concat(s,"){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(?:").concat(s,":){4}(?:(:").concat(s,"){0,1}:").concat(i,"|(:").concat(s,"){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(?:").concat(s,":){3}(?:(:").concat(s,"){0,2}:").concat(i,"|(:").concat(s,"){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(?:").concat(s,":){2}(?:(:").concat(s,"){0,3}:").concat(i,"|(:").concat(s,"){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(?:").concat(s,":){1}(?:(:").concat(s,"){0,4}:").concat(i,"|(:").concat(s,"){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::((?::").concat(s,"){0,5}:").concat(i,"|(?::").concat(s,"){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(),a=e=>e&&e.exact?new RegExp("(?:^".concat(i,"$)|(?:^").concat(o,"$)")):new RegExp("(?:".concat(n(e)).concat(i).concat(n(e),")|(?:").concat(n(e)).concat(o).concat(n(e),")"),"g");a.v4=e=>e&&e.exact?new RegExp("^".concat(i,"$")):new RegExp("".concat(n(e)).concat(i).concat(n(e)),"g"),a.v6=e=>e&&e.exact?new RegExp("^".concat(o,"$")):new RegExp("".concat(n(e)).concat(o).concat(n(e)),"g"),e.exports=a},function(e,t,r){"use strict";const n=r(464),i=r(42),s=r(465),o=r(466),a=r(467),c=[["base1","1","","1"],["base2","0",i,"01"],["base8","7",i,"01234567"],["base10","9",i,"0123456789"],["base16","f",s,"0123456789abcdef"],["base32","b",o,"abcdefghijklmnopqrstuvwxyz234567"],["base32pad","c",o,"abcdefghijklmnopqrstuvwxyz234567="],["base32hex","v",o,"0123456789abcdefghijklmnopqrstuv"],["base32hexpad","t",o,"0123456789abcdefghijklmnopqrstuv="],["base32z","h",o,"ybndrfg8ejkmcpqxot1uwisza345h769"],["base58flickr","Z",i,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base58btc","z",i,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base64","m",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],u=c.reduce((e,t)=>(e[t[0]]=new n(t[0],t[1],t[2],t[3]),e),{}),f=c.reduce((e,t)=>(e[t[1]]=u[t[0]],e),{});e.exports={names:u,codes:f}},function(e,t,r){"use strict";e.exports=class{constructor(e,t,r,n){this.name=e,this.code=t,this.alphabet=n,r&&n&&(this.engine=r(n))}encode(e){return this.engine.encode(e)}decode(e){return this.engine.decode(e)}isImplemented(){return this.engine}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports=function(e){return{encode:e=>"string"==typeof e?n.from(e).toString("hex"):e.toString("hex"),decode(t){for(const r of t)if(e.indexOf(r)<0)throw new Error("invalid base16 character");return n.from(t,"hex")}}}},function(e,t,r){"use strict";function n(e,t){const r=e.byteLength,n=new Uint8Array(e),i=t.indexOf("=")===t.length-1;i&&(t=t.substring(0,t.length-1));let s=0,o=0,a="";for(let c=0;c<r;c++)for(o=o<<8|n[c],s+=8;s>=5;)a+=t[o>>>s-5&31],s-=5;if(s>0&&(a+=t[o<<5-s&31]),i)for(;a.length%8!=0;)a+="=";return a}e.exports=function(e){return{encode:t=>n("string"==typeof t?Uint8Array.from(t):t,e),decode(t){for(const r of t)if(e.indexOf(r)<0)throw new Error("invalid base32 character");return function(e,t){const r=(e=e.replace(new RegExp("=","g"),"")).length;let n=0,i=0,s=0;const o=new Uint8Array(5*r/8|0);for(let a=0;a<r;a++)i=i<<5|t.indexOf(e[a]),n+=5,n>=8&&(o[s++]=i>>>n-8&255,n-=8);return o.buffer}(t,e)}}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports=function(e){const t=e.indexOf("=")>-1,r=e.indexOf("-")>-1&&e.indexOf("_")>-1;return{encode(e){let i="";i="string"==typeof e?n.from(e).toString("base64"):e.toString("base64"),r&&(i=i.replace(/\+/g,"-").replace(/\//g,"_"));const s=i.indexOf("=");return s>0&&!t&&(i=i.substring(0,s)),i},decode(t){for(const r of t)if(e.indexOf(r)<0)throw new Error("invalid base64 character");return n.from(t,"base64")}}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(34),s=r(35),{factory:o}=r(471),{fromNumberTo32BitBuf:a}=r(472),c=e=>async t=>{switch(e){case"sha3-224":return n.from(i.sha3_224.arrayBuffer(t));case"sha3-256":return n.from(i.sha3_256.arrayBuffer(t));case"sha3-384":return n.from(i.sha3_384.arrayBuffer(t));case"sha3-512":return n.from(i.sha3_512.arrayBuffer(t));case"shake-128":return n.from(i.shake128.create(128).update(t).arrayBuffer());case"shake-256":return n.from(i.shake256.create(256).update(t).arrayBuffer());case"keccak-224":return n.from(i.keccak224.arrayBuffer(t));case"keccak-256":return n.from(i.keccak256.arrayBuffer(t));case"keccak-384":return n.from(i.keccak384.arrayBuffer(t));case"keccak-512":return n.from(i.keccak512.arrayBuffer(t));case"murmur3-128":return n.from(s.x64.hash128(t),"hex");case"murmur3-32":return a(s.x86.hash32(t));default:throw new TypeError("".concat(e," is not a supported algorithm"))}};e.exports={identity:e=>n.from(e),sha1:o("sha1"),sha2256:o("sha2-256"),sha2512:o("sha2-512"),dblSha2256:o("dbl-sha2-256"),sha3224:c("sha3-224"),sha3256:c("sha3-256"),sha3384:c("sha3-384"),sha3512:c("sha3-512"),shake128:c("shake-128"),shake256:c("shake-256"),keccak224:c("keccak-224"),keccak256:c("keccak-256"),keccak384:c("keccak-384"),keccak512:c("keccak-512"),murmur3128:c("murmur3-128"),murmur332:c("murmur3-32"),addBlake:r(473)}},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t,r){"use strict";!function(r,n){var i={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function s(e){if(!Array.isArray(e)&&!ArrayBuffer.isView(e))return!1;for(var t=0;t<e.length;t++)if(!Number.isInteger(e[t])||e[t]<0||e[t]>255)return!1;return!0}function o(e,t){return(65535&e)*t+(((e>>>16)*t&65535)<<16)}function a(e,t){return e<<t|e>>>32-t}function c(e){return e=o(e^=e>>>16,2246822507),e=o(e^=e>>>13,3266489909),e^=e>>>16}function u(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]+t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]+t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]+t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]+t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]}function f(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]*t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]*t[3],r[1]+=r[2]>>>16,r[2]&=65535,r[2]+=e[3]*t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]*t[3],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[2]*t[2],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[3]*t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]}function h(e,t){return 32===(t%=64)?[e[1],e[0]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t|e[0]>>>32-t]:(t-=32,[e[1]<<t|e[0]>>>32-t,e[0]<<t|e[1]>>>32-t])}function l(e,t){return 0===(t%=64)?e:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t]:[e[1]<<t-32,0]}function d(e,t){return[e[0]^t[0],e[1]^t[1]]}function p(e){return e=d(e,[0,e[0]>>>1]),e=d(e=f(e,[4283543511,3981806797]),[0,e[0]>>>1]),e=d(e=f(e,[3301882366,444984403]),[0,e[0]>>>1])}i.x86.hash32=function(e,t){if(!i.inputValidation||s(e)){t=t||0;for(var r=e.length%4,n=e.length-r,u=t,f=0,h=3432918353,l=461845907,d=0;d<n;d+=4)f=o(f=e[d]|e[d+1]<<8|e[d+2]<<16|e[d+3]<<24,h),f=o(f=a(f,15),l),u=o(u=a(u^=f,13),5)+3864292196;switch(f=0,r){case 3:f^=e[d+2]<<16;case 2:f^=e[d+1]<<8;case 1:f=o(f^=e[d],h),u^=f=o(f=a(f,15),l)}return(u=c(u^=e.length))>>>0}},i.x86.hash128=function(e,t){if(!i.inputValidation||s(e)){t=t||0;for(var r=e.length%16,n=e.length-r,u=t,f=t,h=t,l=t,d=0,p=0,b=0,y=0,m=597399067,g=2869860233,v=951274213,w=2716044179,_=0;_<n;_+=16)d=e[_]|e[_+1]<<8|e[_+2]<<16|e[_+3]<<24,p=e[_+4]|e[_+5]<<8|e[_+6]<<16|e[_+7]<<24,b=e[_+8]|e[_+9]<<8|e[_+10]<<16|e[_+11]<<24,y=e[_+12]|e[_+13]<<8|e[_+14]<<16|e[_+15]<<24,d=a(d=o(d,m),15),u=a(u^=d=o(d,g),19),u=o(u+=f,5)+1444728091,p=a(p=o(p,g),16),f=a(f^=p=o(p,v),17),f=o(f+=h,5)+197830471,b=a(b=o(b,v),17),h=a(h^=b=o(b,w),15),h=o(h+=l,5)+2530024501,y=a(y=o(y,w),18),l=a(l^=y=o(y,m),13),l=o(l+=u,5)+850148119;switch(d=0,p=0,b=0,y=0,r){case 15:y^=e[_+14]<<16;case 14:y^=e[_+13]<<8;case 13:y=o(y^=e[_+12],w),l^=y=o(y=a(y,18),m);case 12:b^=e[_+11]<<24;case 11:b^=e[_+10]<<16;case 10:b^=e[_+9]<<8;case 9:b=o(b^=e[_+8],v),h^=b=o(b=a(b,17),w);case 8:p^=e[_+7]<<24;case 7:p^=e[_+6]<<16;case 6:p^=e[_+5]<<8;case 5:p=o(p^=e[_+4],g),f^=p=o(p=a(p,16),v);case 4:d^=e[_+3]<<24;case 3:d^=e[_+2]<<16;case 2:d^=e[_+1]<<8;case 1:d=o(d^=e[_],m),u^=d=o(d=a(d,15),g)}return u^=e.length,u+=f^=e.length,u+=h^=e.length,f+=u+=l^=e.length,h+=u,l+=u,u=c(u),u+=f=c(f),u+=h=c(h),f+=u+=l=c(l),h+=u,l+=u,("00000000"+(u>>>0).toString(16)).slice(-8)+("00000000"+(f>>>0).toString(16)).slice(-8)+("00000000"+(h>>>0).toString(16)).slice(-8)+("00000000"+(l>>>0).toString(16)).slice(-8)}},i.x64.hash128=function(e,t){if(!i.inputValidation||s(e)){t=t||0;for(var r=e.length%16,n=e.length-r,o=[0,t],a=[0,t],c=[0,0],b=[0,0],y=[2277735313,289559509],m=[1291169091,658871167],g=0;g<n;g+=16)c=[e[g+4]|e[g+5]<<8|e[g+6]<<16|e[g+7]<<24,e[g]|e[g+1]<<8|e[g+2]<<16|e[g+3]<<24],b=[e[g+12]|e[g+13]<<8|e[g+14]<<16|e[g+15]<<24,e[g+8]|e[g+9]<<8|e[g+10]<<16|e[g+11]<<24],c=h(c=f(c,y),31),o=u(o=h(o=d(o,c=f(c,m)),27),a),o=u(f(o,[0,5]),[0,1390208809]),b=h(b=f(b,m),33),a=u(a=h(a=d(a,b=f(b,y)),31),o),a=u(f(a,[0,5]),[0,944331445]);switch(c=[0,0],b=[0,0],r){case 15:b=d(b,l([0,e[g+14]],48));case 14:b=d(b,l([0,e[g+13]],40));case 13:b=d(b,l([0,e[g+12]],32));case 12:b=d(b,l([0,e[g+11]],24));case 11:b=d(b,l([0,e[g+10]],16));case 10:b=d(b,l([0,e[g+9]],8));case 9:b=f(b=d(b,[0,e[g+8]]),m),a=d(a,b=f(b=h(b,33),y));case 8:c=d(c,l([0,e[g+7]],56));case 7:c=d(c,l([0,e[g+6]],48));case 6:c=d(c,l([0,e[g+5]],40));case 5:c=d(c,l([0,e[g+4]],32));case 4:c=d(c,l([0,e[g+3]],24));case 3:c=d(c,l([0,e[g+2]],16));case 2:c=d(c,l([0,e[g+1]],8));case 1:c=f(c=d(c,[0,e[g]]),y),o=d(o,c=f(c=h(c,31),m))}return o=u(o=d(o,[0,e.length]),a=d(a,[0,e.length])),a=u(a,o),o=u(o=p(o),a=p(a)),a=u(a,o),("00000000"+(o[0]>>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)+("00000000"+(a[0]>>>0).toString(16)).slice(-8)+("00000000"+(a[1]>>>0).toString(16)).slice(-8)}},e.exports&&(t=e.exports=i),t.murmurHash3=i}()},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(17),s=self.crypto||self.msCrypto,o=async(e,t)=>{if("undefined"==typeof self||!self.crypto&&!self.msCrypto)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");switch(t){case"sha1":return n.from(await s.subtle.digest({name:"SHA-1"},e));case"sha2-256":return n.from(await s.subtle.digest({name:"SHA-256"},e));case"sha2-512":return n.from(await s.subtle.digest({name:"SHA-512"},e));case"dbl-sha2-256":{const t=await s.subtle.digest({name:"SHA-256"},e);return n.from(await s.subtle.digest({name:"SHA-256"},t))}default:throw new Error("".concat(t," is not a supported algorithm"))}};e.exports={factory:e=>async t=>o(t,e),digest:o,multihashing:async(e,t,r)=>{const n=await o(e,t);return i.encode(n,t,r)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports={fromNumberTo32BitBuf:e=>{const t=new Array(4);for(let r=0;r<4;r++)t[r]=255&e,e>>=8;return n.from(t)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(36),s={init:i.blake2bInit,update:i.blake2bUpdate,digest:i.blake2bFinal},o={init:i.blake2sInit,update:i.blake2sUpdate,digest:i.blake2sFinal},a=(e,t)=>async r=>{const i=t.init(e,null);return t.update(i,r),n.from(t.digest(i))};e.exports=e=>{for(let t=0;t<64;t++)e[45569+t]=a(t+1,s);for(let t=0;t<32;t++)e[45633+t]=a(t+1,o)}},function(e,t,r){"use strict";var n=r(222);function i(e,t,r){var n=e[t]+e[r],i=e[t+1]+e[r+1];n>=4294967296&&i++,e[t]=n,e[t+1]=i}function s(e,t,r,n){var i=e[t]+r;r<0&&(i+=4294967296);var s=e[t+1]+n;i>=4294967296&&s++,e[t]=i,e[t+1]=s}function o(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function a(e,t,r,n,o,a){var c=h[o],u=h[o+1],l=h[a],d=h[a+1];i(f,e,t),s(f,e,c,u);var p=f[n]^f[e],b=f[n+1]^f[e+1];f[n]=b,f[n+1]=p,i(f,r,n),p=f[t]^f[r],b=f[t+1]^f[r+1],f[t]=p>>>24^b<<8,f[t+1]=b>>>24^p<<8,i(f,e,t),s(f,e,l,d),p=f[n]^f[e],b=f[n+1]^f[e+1],f[n]=p>>>16^b<<16,f[n+1]=b>>>16^p<<16,i(f,r,n),p=f[t]^f[r],b=f[t+1]^f[r+1],f[t]=b>>>31^p<<1,f[t+1]=p>>>31^b<<1}var c=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,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,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].map((function(e){return 2*e}))),f=new Uint32Array(32),h=new Uint32Array(32);function l(e,t){var r=0;for(r=0;r<16;r++)f[r]=e.h[r],f[r+16]=c[r];for(f[24]=f[24]^e.t,f[25]=f[25]^e.t/4294967296,t&&(f[28]=~f[28],f[29]=~f[29]),r=0;r<32;r++)h[r]=o(e.b,4*r);for(r=0;r<12;r++)a(0,8,16,24,u[16*r+0],u[16*r+1]),a(2,10,18,26,u[16*r+2],u[16*r+3]),a(4,12,20,28,u[16*r+4],u[16*r+5]),a(6,14,22,30,u[16*r+6],u[16*r+7]),a(0,10,20,30,u[16*r+8],u[16*r+9]),a(2,12,22,24,u[16*r+10],u[16*r+11]),a(4,14,16,26,u[16*r+12],u[16*r+13]),a(6,8,18,28,u[16*r+14],u[16*r+15]);for(r=0;r<16;r++)e.h[r]=e.h[r]^f[r]^f[r+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 r={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e},n=0;n<16;n++)r.h[n]=c[n];var i=t?t.length:0;return r.h[0]^=16842752^i<<8^e,t&&(p(r,t),r.c=128),r}function p(e,t){for(var r=0;r<t.length;r++)128===e.c&&(e.t+=e.c,l(e,!1),e.c=0),e.b[e.c++]=t[r]}function b(e){for(e.t+=e.c;e.c<128;)e.b[e.c++]=0;l(e,!0);for(var t=new Uint8Array(e.outlen),r=0;r<e.outlen;r++)t[r]=e.h[r>>2]>>8*(3&r);return t}function y(e,t,r){r=r||64,e=n.normalizeInput(e);var i=d(r,t);return p(i,e),b(i)}e.exports={blake2b:y,blake2bHex:function(e,t,r){var i=y(e,t,r);return n.toHex(i)},blake2bInit:d,blake2bUpdate:p,blake2bFinal:b}},function(e,t,r){"use strict";var n=r(222);function i(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function s(e,t,r,n,i,s){u[e]=u[e]+u[t]+i,u[n]=o(u[n]^u[e],16),u[r]=u[r]+u[n],u[t]=o(u[t]^u[r],12),u[e]=u[e]+u[t]+s,u[n]=o(u[n]^u[e],8),u[r]=u[r]+u[n],u[t]=o(u[t]^u[r],7)}function o(e,t){return e>>>t^e<<32-t}var a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),c=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),f=new Uint32Array(16);function h(e,t){var r=0;for(r=0;r<8;r++)u[r]=e.h[r],u[r+8]=a[r];for(u[12]^=e.t,u[13]^=e.t/4294967296,t&&(u[14]=~u[14]),r=0;r<16;r++)f[r]=i(e.b,4*r);for(r=0;r<10;r++)s(0,4,8,12,f[c[16*r+0]],f[c[16*r+1]]),s(1,5,9,13,f[c[16*r+2]],f[c[16*r+3]]),s(2,6,10,14,f[c[16*r+4]],f[c[16*r+5]]),s(3,7,11,15,f[c[16*r+6]],f[c[16*r+7]]),s(0,5,10,15,f[c[16*r+8]],f[c[16*r+9]]),s(1,6,11,12,f[c[16*r+10]],f[c[16*r+11]]),s(2,7,8,13,f[c[16*r+12]],f[c[16*r+13]]),s(3,4,9,14,f[c[16*r+14]],f[c[16*r+15]]);for(r=0;r<8;r++)e.h[r]^=u[r]^u[r+8]}function l(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");var r=t?t.length:0;if(t&&!(r>0&&r<=32))throw new Error("Incorrect key length, should be in [1, 32]");var n={h:new Uint32Array(a),b:new Uint32Array(64),c:0,t:0,outlen:e};return n.h[0]^=16842752^r<<8^e,r>0&&(d(n,t),n.c=64),n}function d(e,t){for(var r=0;r<t.length;r++)64===e.c&&(e.t+=e.c,h(e,!1),e.c=0),e.b[e.c++]=t[r]}function p(e){for(e.t+=e.c;e.c<64;)e.b[e.c++]=0;h(e,!0);for(var t=new Uint8Array(e.outlen),r=0;r<e.outlen;r++)t[r]=e.h[r>>2]>>8*(3&r)&255;return t}function b(e,t,r){r=r||32,e=n.normalizeInput(e);var i=l(r,t);return d(i,e),p(i)}e.exports={blake2s:b,blake2sHex:function(e,t,r){var i=b(e,t,r);return n.toHex(i)},blake2sInit:l,blake2sUpdate:d,blake2sFinal:p}},function(e,t,r){"use strict";const n=r(50);e.exports=({addAll:e})=>async function(t,r){return n(e(t,r))}},function(e,t,r){"use strict";const n=r(128),i=r(516),{parseChunkerString:s}=r(517),o=r(19),{withTimeoutOption:a}=r(3);e.exports=({block:e,gcLock:t,preload:r,pin:c,options:u})=>{const f=u.EXPERIMENTAL&&u.EXPERIMENTAL.sharding;return a((async function*(a,u){u=u||{};const h={shardSplitThreshold:f?1e3:1/0,...u,strategy:"balanced",...s(u.chunker)};if(h.hashAlg&&"sha2-256"!==h.hashAlg&&1!==h.cidVersion&&(h.cidVersion=1),h.trickle&&(h.strategy="trickle"),delete h.trickle,h.progress){let e=0;const t=h.progress;h.progress=r=>{e+=r,t(e)}}const l=o(i(a),t=>n(t,e,{...h,pin:!1}),function(e){return async function*(t){for await(const r of t){let t=r.cid;1===e.cidVersion&&(t=t.toV1());let n=r.path?r.path:t.toString();e.wrapWithDirectory&&!r.path&&(n=""),yield{path:n,cid:t,size:r.size,mode:r.unixfs&&r.unixfs.mode,mtime:r.unixfs&&r.unixfs.mtime}}}}(h),function(e,t){return async function*(r){for await(const n of r){(!n.path||t.wrapWithDirectory?""===n.path:!n.path.includes("/"))&&!t.onlyHash&&!1!==t.preload&&e(n.cid),yield n}}}(r,h),function(e,t){return async function*(r){for await(const n of r){const r=!n.path.includes("/");(null==t.pin||t.pin)&&r&&!t.onlyHash&&await e.add(n.cid,{preload:!1,lock:!1}),yield n}}}(c,h)),d=await t.readLock();try{yield*l}finally{d()}}))}},function(e,t,r){"use strict";const n=r(479),i=r(496);e.exports=async function*(e,t,s){for await(const o of e)if(o.path&&("./"===o.path.substring(0,2)&&(s.wrapWithDirectory=!0),o.path=o.path.split("/").filter(e=>e&&"."!==e).join("/")),o.content){let e,n,a=o.content;(a[Symbol.asyncIterator]||a[Symbol.iterator])&&void 0===a.length||(a={[Symbol.iterator]:function*(){yield o.content}}),e="function"==typeof s.chunker?s.chunker:"rabin"===s.chunker?r(501):r(506),n="function"==typeof s.chunkValidator?s.chunkValidator:r(507),yield()=>i(o,e(n(a,s),s),t,s)}else yield()=>n(o,t,s)}},function(e,t,r){"use strict";const n=r(23),i=r(59),{DAGNode:s}=r(12);e.exports=async(e,t,r)=>{const o=new n({type:"directory",mtime:e.mtime,mode:e.mode}),a=new s(o.marshal()).serialize();return{cid:await i(a,t,r),path:e.path,unixfs:o,size:a.length}}},function(e,t,r){"use strict";e.exports='\nsyntax = "proto2";\n\nmessage Data {\n enum DataType {\n Raw = 0;\n Directory = 1;\n File = 2;\n Metadata = 3;\n Symlink = 4;\n HAMTShard = 5;\n }\n\n required DataType Type = 1;\n optional bytes Data = 2;\n optional uint64 filesize = 3;\n repeated uint64 blocksizes = 4;\n optional uint64 hashType = 5;\n optional uint64 fanout = 6;\n optional uint32 mode = 7;\n optional UnixTime mtime = 8;\n}\n\nmessage UnixTime {\n required int64 Seconds = 1;\n optional fixed32 FractionalNanoseconds = 2;\n}\n\nmessage Metadata {\n optional string MimeType = 1;\n}\n'},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(34),s=r(35),{factory:o}=r(482),{fromNumberTo32BitBuf:a}=r(483),c=e=>async t=>{switch(e){case"sha3-224":return n.from(i.sha3_224.arrayBuffer(t));case"sha3-256":return n.from(i.sha3_256.arrayBuffer(t));case"sha3-384":return n.from(i.sha3_384.arrayBuffer(t));case"sha3-512":return n.from(i.sha3_512.arrayBuffer(t));case"shake-128":return n.from(i.shake128.create(128).update(t).arrayBuffer());case"shake-256":return n.from(i.shake256.create(256).update(t).arrayBuffer());case"keccak-224":return n.from(i.keccak224.arrayBuffer(t));case"keccak-256":return n.from(i.keccak256.arrayBuffer(t));case"keccak-384":return n.from(i.keccak384.arrayBuffer(t));case"keccak-512":return n.from(i.keccak512.arrayBuffer(t));case"murmur3-128":return n.from(s.x64.hash128(t),"hex");case"murmur3-32":return a(s.x86.hash32(t));default:throw new TypeError("".concat(e," is not a supported algorithm"))}};e.exports={identity:e=>n.from(e),sha1:o("sha1"),sha2256:o("sha2-256"),sha2512:o("sha2-512"),dblSha2256:o("dbl-sha2-256"),sha3224:c("sha3-224"),sha3256:c("sha3-256"),sha3384:c("sha3-384"),sha3512:c("sha3-512"),shake128:c("shake-128"),shake256:c("shake-256"),keccak224:c("keccak-224"),keccak256:c("keccak-256"),keccak384:c("keccak-384"),keccak512:c("keccak-512"),murmur3128:c("murmur3-128"),murmur332:c("murmur3-32"),addBlake:r(484)}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(17),s=self.crypto||self.msCrypto,o=async(e,t)=>{if("undefined"==typeof self||!self.crypto&&!self.msCrypto)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");switch(t){case"sha1":return n.from(await s.subtle.digest({name:"SHA-1"},e));case"sha2-256":return n.from(await s.subtle.digest({name:"SHA-256"},e));case"sha2-512":return n.from(await s.subtle.digest({name:"SHA-512"},e));case"dbl-sha2-256":{const t=await s.subtle.digest({name:"SHA-256"},e);return n.from(await s.subtle.digest({name:"SHA-256"},t))}default:throw new Error("".concat(t," is not a supported algorithm"))}};e.exports={factory:e=>async t=>o(t,e),digest:o,multihashing:async(e,t,r)=>{const n=await o(e,t);return i.encode(n,t,r)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports={fromNumberTo32BitBuf:e=>{const t=new Array(4);for(let r=0;r<4;r++)t[r]=255&e,e>>=8;return n.from(t)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(36),s={init:i.blake2bInit,update:i.blake2bUpdate,digest:i.blake2bFinal},o={init:i.blake2sInit,update:i.blake2sUpdate,digest:i.blake2sFinal},a=(e,t)=>async r=>{const i=t.init(e,null);return t.update(i,r),n.from(t.digest(i))};e.exports=e=>{for(let t=0;t<64;t++)e[45569+t]=a(t+1,s);for(let t=0;t<32;t++)e[45633+t]=a(t+1,o)}},function(e,t,r){"use strict";e.exports=r(224)},function(e,t,r){"use strict";const n=r(60),i=r(229);e.exports=async(e,t={})=>{const r=await i.cid(e.serialize(),t);return new n(t.name||"",e.size,r)}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(1),s=r(17),o=r(488);async function a(e,t,r){const n=await a.digest(e,t,r);return s.encode(n,t,r)}a.Buffer=n,a.multihash=s,a.digest=async(e,t,r)=>{const n=a.createHash(t),i=await n(e);return r?i.slice(0,r):i},a.createHash=function(e){if(!e)throw i(new Error("hash algorithm must be specified"),"ERR_HASH_ALGORITHM_NOT_SPECIFIED");if(e=s.coerceCode(e),!a.functions[e])throw i(new Error("multihash function '".concat(e,"' not yet supported")),"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return a.functions[e]},a.functions={0:o.identity,17:o.sha1,18:o.sha2256,19:o.sha2512,20:o.sha3512,21:o.sha3384,22:o.sha3256,23:o.sha3224,24:o.shake128,25:o.shake256,26:o.keccak224,27:o.keccak256,28:o.keccak384,29:o.keccak512,34:o.murmur3128,35:o.murmur332,86:o.dblSha2256},o.addBlake(a.functions),a.validate=async(e,t)=>{const r=await a(e,s.decode(t).name);return 0===n.compare(t,r)},e.exports=a},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(34),s=r(35),{factory:o}=r(489),{fromNumberTo32BitBuf:a}=r(490),c=e=>async t=>{switch(e){case"sha3-224":return n.from(i.sha3_224.arrayBuffer(t));case"sha3-256":return n.from(i.sha3_256.arrayBuffer(t));case"sha3-384":return n.from(i.sha3_384.arrayBuffer(t));case"sha3-512":return n.from(i.sha3_512.arrayBuffer(t));case"shake-128":return n.from(i.shake128.create(128).update(t).arrayBuffer());case"shake-256":return n.from(i.shake256.create(256).update(t).arrayBuffer());case"keccak-224":return n.from(i.keccak224.arrayBuffer(t));case"keccak-256":return n.from(i.keccak256.arrayBuffer(t));case"keccak-384":return n.from(i.keccak384.arrayBuffer(t));case"keccak-512":return n.from(i.keccak512.arrayBuffer(t));case"murmur3-128":return n.from(s.x64.hash128(t),"hex");case"murmur3-32":return a(s.x86.hash32(t));default:throw new TypeError("".concat(e," is not a supported algorithm"))}};e.exports={identity:e=>n.from(e),sha1:o("sha1"),sha2256:o("sha2-256"),sha2512:o("sha2-512"),dblSha2256:o("dbl-sha2-256"),sha3224:c("sha3-224"),sha3256:c("sha3-256"),sha3384:c("sha3-384"),sha3512:c("sha3-512"),shake128:c("shake-128"),shake256:c("shake-256"),keccak224:c("keccak-224"),keccak256:c("keccak-256"),keccak384:c("keccak-384"),keccak512:c("keccak-512"),murmur3128:c("murmur3-128"),murmur332:c("murmur3-32"),addBlake:r(491)}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(17),s=self.crypto||self.msCrypto,o=async(e,t)=>{if("undefined"==typeof self||!self.crypto&&!self.msCrypto)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");switch(t){case"sha1":return n.from(await s.subtle.digest({name:"SHA-1"},e));case"sha2-256":return n.from(await s.subtle.digest({name:"SHA-256"},e));case"sha2-512":return n.from(await s.subtle.digest({name:"SHA-512"},e));case"dbl-sha2-256":{const t=await s.subtle.digest({name:"SHA-256"},e);return n.from(await s.subtle.digest({name:"SHA-256"},t))}default:throw new Error("".concat(t," is not a supported algorithm"))}};e.exports={factory:e=>async t=>o(t,e),digest:o,multihashing:async(e,t,r)=>{const n=await o(e,t);return i.encode(n,t,r)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports={fromNumberTo32BitBuf:e=>{const t=new Array(4);for(let r=0;r<4;r++)t[r]=255&e,e>>=8;return n.from(t)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(36),s={init:i.blake2bInit,update:i.blake2bUpdate,digest:i.blake2bFinal},o={init:i.blake2sInit,update:i.blake2sUpdate,digest:i.blake2sFinal},a=(e,t)=>async r=>{const i=t.init(e,null);return t.update(i,r),n.from(t.digest(i))};e.exports=e=>{for(let t=0;t<64;t++)e[45569+t]=a(t+1,s);for(let t=0;t<32;t++)e[45633+t]=a(t+1,o)}},function(e,t,r){"use strict";const n=r(225),i=r(230);e.exports=(e,t)=>{const r=(e=>{if(i.isDAGLink(e))return e;if(!("cid"in e||"hash"in e||"Hash"in e||"multihash"in e))throw new Error("Link must be a DAGLink or DAGLink-like. Convert the DAGNode into a DAGLink via `node.toDAGLink()`.");return new i(e.Name||e.name,e.Tsize||e.size,e.Hash||e.multihash||e.hash||e.cid)})(t);e._links.push(r),e._links=n(e._links)}},function(e,t,r){"use strict";const n=r(60);e.exports.createDagLinkFromB58EncodedHash=function(e){return new n(e.Name||e.name||"",e.Tsize||e.Size||e.size||0,e.Hash||e.hash||e.multihash||e.cid)}},function(e,t,r){"use strict";const n=r(4),{Buffer:i}=r(0);e.exports=(e,t)=>{if("string"==typeof t)e._links=e._links.filter(e=>e.Name!==t);else{if(!i.isBuffer(t)&&!n.isCID(t))throw new Error("second arg needs to be a name or CID");e._links=e._links.filter(e=>!e.Hash.equals(t))}}},function(e,t,r){"use strict";const n=r(4),i=r(231);t.resolve=(e,t)=>{let r=i.deserialize(e);const s=t.split("/").filter(Boolean);for(;s.length;){const e=s.shift();if(void 0===r[e]){for(const t of r.Links)if(t.Name===e)return{value:t.Hash,remainderPath:s.join("/")};throw new Error("Object has no property '".concat(e,"'"))}if(r=r[e],n.isCID(r))return{value:r,remainderPath:s.join("/")}}return{value:r,remainderPath:""}},t.tree=function*(e){const t=i.deserialize(e);yield"Data",yield"Links";for(let r=0;r<t.Links.length;r++)yield"Links/".concat(r),yield"Links/".concat(r,"/Name"),yield"Links/".concat(r,"/Tsize"),yield"Links/".concat(r,"/Hash")}},function(e,t,r){"use strict";const n=r(1),i=r(23),s=r(59),{DAGNode:o,DAGLink:a}=r(12),c=r(131),u=r(223),f=r(130).multihash,h={flat:r(497),balanced:r(498),trickle:r(499)};e.exports=async(e,t,l,d)=>{const p=h[d.strategy];if(!p)throw n(new Error("Unknown importer build strategy name: ".concat(d.strategy)),"ERR_BAD_STRATEGY");const b=await c(p(async function*(e,t,n,i){let s,o,a=-1;o="function"==typeof i.bufferImporter?i.bufferImporter:r(500);for await(const r of u(o(e,t,n,i),i.blockWriteConcurrency))a++,0!==a?(1===a&&(yield s,s=null),yield r):s=r;s&&(s.single=!0,yield s)}(e,t,l,d),((e,t,r)=>async function(n){if(1===n.length&&n[0].single&&r.reduceSingleLeafToSelf){const a=n[0];if("raw"===a.cid.codec&&(void 0!==e.mtime||void 0!==e.mode)){let{data:n}=await t.get(a.cid,r);a.unixfs=new i({type:"file",mtime:e.mtime,mode:e.mode,data:n});const c=f.decode(a.cid.multihash);n=new o(a.unixfs.marshal()).serialize(),a.cid=await s(n,t,{...r,codec:"dag-pb",hashAlg:c.name,cidVersion:r.cidVersion}),a.size=n.length}return{cid:a.cid,path:e.path,unixfs:a.unixfs,size:a.size}}const c=new i({type:"file",mtime:e.mtime,mode:e.mode}),u=n.filter(e=>!("raw"!==e.cid.codec||!e.size)||(!(e.unixfs.data||!e.unixfs.fileSize())||Boolean(e.unixfs.data.length))).map(e=>"raw"===e.cid.codec?(c.addBlockSize(e.size),new a(e.name,e.size,e.cid)):(e.unixfs.data?c.addBlockSize(e.unixfs.data.length):c.addBlockSize(e.unixfs.fileSize()),new a(e.name,e.size,e.cid))),h=new o(c.marshal(),u),l=h.serialize();return{cid:await s(l,t,r),path:e.path,unixfs:c,size:l.length+h.Links.reduce((e,t)=>e+t.Tsize,0)}})(e,l,d),d));if(b.length>1)throw n(new Error("expected a maximum of 1 roots and got "+b.length),"ETOOMANYROOTS");return b[0]}},function(e,t,r){"use strict";const n=r(131);e.exports=async function*(e,t){yield await t(await n(e))}},function(e,t,r){"use strict";const n=r(129);e.exports=async function*(e,t,r){yield await async function e(t,r,i){const s=[];for await(const o of n(t,i.maxChildrenPerNode))s.push(await r(o));if(s.length>1)return e(s,r,i);return s[0]}(e,t,r)}},function(e,t,r){"use strict";const n=r(129);e.exports=function*(e,t,r){yield async function(e,t,r){let o,a=0,c=1,u=o=new s(r.layerRepeat);for await(const s of n(e,r.maxChildrenPerNode))u.isFull()&&(u!==o&&o.addChild(await u.reduce(t)),a&&a%r.layerRepeat==0&&c++,u=new i(c,r.layerRepeat,a),a++),u.append(s);u&&u!==o&&o.addChild(await u.reduce(t));return o.reduce(t)}(e,t,r)};class i{constructor(e,t,r){this.maxDepth=e,this.layerRepeat=t,this.currentDepth=1,this.iteration=r,this.root=this.node=this.parent={children:[],depth:this.currentDepth,maxDepth:e,maxChildren:(this.maxDepth-this.currentDepth)*this.layerRepeat}}isFull(){if(!this.root.data)return!1;if(this.currentDepth<this.maxDepth&&this.node.maxChildren)return this._addNextNodeToParent(this.node),!1;const e=this._findParent(this.node,this.currentDepth);return!e||(this._addNextNodeToParent(e),!1)}_addNextNodeToParent(e){this.parent=e;const t={children:[],depth:e.depth+1,parent:e,maxDepth:this.maxDepth,maxChildren:Math.floor(e.children.length/this.layerRepeat)*this.layerRepeat};e.children.push(t),this.currentDepth=t.depth,this.node=t}append(e){this.node.data=e}reduce(e){return this._reduce(this.root,e)}async _reduce(e,t){let r=[];return e.children.length&&(r=await Promise.all(e.children.filter(e=>e.data).map(e=>this._reduce(e,t)))),t(e.data.concat(r))}_findParent(e,t){const r=e.parent;if(r&&0!==r.depth)return r.children.length!==r.maxChildren&&r.maxChildren?r:this._findParent(r,t)}}class s extends i{constructor(e){super(0,e),this.root.depth=0,this.currentDepth=1}addChild(e){this.root.children.push(e)}reduce(e){return e(this.root.data.concat(this.root.children))}}},function(e,t,r){"use strict";const n=r(23),i=r(59),{DAGNode:s}=r(12);e.exports=async function*(e,t,r,o){for await(let a of t)yield async()=>{let t;o.progress(a.length);const c={...o};return o.rawLeaves?(c.codec="raw",c.cidVersion=1):(t=new n({type:o.leafType,data:a,mtime:e.mtime,mode:e.mode}),a=new s(t.marshal()).serialize()),{cid:await i(a,r,c),unixfs:t,size:a.length}}}},function(e,t,r){"use strict";const n=r(30),{create:i}=r(502),s=r(1);e.exports=async function*(e,t){const r=o();let n,i,a;if(t.minChunkSize&&t.maxChunkSize&&t.avgChunkSize)a=t.avgChunkSize,n=t.minChunkSize,i=t.maxChunkSize;else{if(!t.avgChunkSize)throw s(new Error("please specify an average chunk size"),"ERR_INVALID_AVG_CHUNK_SIZE");a=t.avgChunkSize,n=a/3,i=a+a/2}if(n<16)throw s(new Error("rabin min must be greater than 16"),"ERR_INVALID_MIN_CHUNK_SIZE");i<n&&(i=n),a<n&&(a=n);const c=Math.floor(Math.log2(a));for await(const s of r(e,{min:n,max:i,bits:c,window:t.window,polynomial:t.polynomial}))yield s};const o=()=>async function*(e,t){const r=await i(t.bits,t.min,t.max,t.window),s=new n;for await(const n of e){s.append(n);const e=r.fingerprint(n);for(let t=0;t<e.length;t++){var o=e[t],a=s.slice(0,o);s.consume(o),yield a}}s.length&&(yield s.slice(0))}},function(e,t,r){"use strict";const n=r(503),i=r(504);e.exports={Rabin:n,create:async(e,t,r,s,o)=>{const a=await i();return new n(a,e,t,r,s,o)}}},function(e,t,r){"use strict";e.exports=class{constructor(e,t=12,r=8192,n=32768,i=64,s){this.bits=t,this.min=r,this.max=n,this.asModule=e,this.rabin=new e.Rabin(t,r,n,i,s),this.polynomial=s}fingerprint(e){const{__retain:t,__release:r,__allocArray:n,__getInt32Array:i,Int32Array_ID:s,Uint8Array_ID:o}=this.asModule,a=t(n(s,new Int32Array(Math.ceil(e.length/this.min)))),c=t(n(o,e)),u=i(this.rabin.fingerprint(c,a));r(c),r(a);const f=[];for(let h=0;h<u.length&&0!==u[h];h++)f[h]=u[h];return f}}},function(e,t,r){"use strict";const{instantiate:n}=r(505);function i(e={}){if(!i.supported)return null;var t=new Uint8Array([0,97,115,109,1,0,0,0,1,78,14,96,2,127,126,0,96,1,127,1,126,96,2,127,127,0,96,1,127,1,127,96,1,127,0,96,3,127,127,127,0,96,2,127,127,1,127,96,3,127,127,127,1,127,96,0,0,96,0,1,127,96,4,127,127,127,127,0,96,5,127,127,127,127,127,1,127,96,1,126,1,127,96,2,126,126,1,126,2,13,1,3,101,110,118,5,97,98,111,114,116,0,10,3,54,53,2,2,5,9,3,6,2,5,7,6,3,4,2,7,9,12,13,5,6,11,3,2,3,2,3,2,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,7,8,8,4,4,5,3,1,0,1,6,47,9,127,1,65,0,11,127,1,65,0,11,127,0,65,3,11,127,0,65,4,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,0,65,240,2,11,127,0,65,6,11,7,240,5,41,6,109,101,109,111,114,121,2,0,7,95,95,97,108,108,111,99,0,10,8,95,95,114,101,116,97,105,110,0,11,9,95,95,114,101,108,101,97,115,101,0,12,9,95,95,99,111,108,108,101,99,116,0,51,11,95,95,114,116,116,105,95,98,97,115,101,3,7,13,73,110,116,51,50,65,114,114,97,121,95,73,68,3,2,13,85,105,110,116,56,65,114,114,97,121,95,73,68,3,3,6,100,101,103,114,101,101,0,16,3,109,111,100,0,17,5,82,97,98,105,110,3,8,16,82,97,98,105,110,35,103,101,116,58,119,105,110,100,111,119,0,21,16,82,97,98,105,110,35,115,101,116,58,119,105,110,100,111,119,0,22,21,82,97,98,105,110,35,103,101,116,58,119,105,110,100,111,119,95,115,105,122,101,0,23,21,82,97,98,105,110,35,115,101,116,58,119,105,110,100,111,119,95,115,105,122,101,0,24,14,82,97,98,105,110,35,103,101,116,58,119,112,111,115,0,25,14,82,97,98,105,110,35,115,101,116,58,119,112,111,115,0,26,15,82,97,98,105,110,35,103,101,116,58,99,111,117,110,116,0,27,15,82,97,98,105,110,35,115,101,116,58,99,111,117,110,116,0,28,13,82,97,98,105,110,35,103,101,116,58,112,111,115,0,29,13,82,97,98,105,110,35,115,101,116,58,112,111,115,0,30,15,82,97,98,105,110,35,103,101,116,58,115,116,97,114,116,0,31,15,82,97,98,105,110,35,115,101,116,58,115,116,97,114,116,0,32,16,82,97,98,105,110,35,103,101,116,58,100,105,103,101,115,116,0,33,16,82,97,98,105,110,35,115,101,116,58,100,105,103,101,115,116,0,34,21,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,115,116,97,114,116,0,35,21,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,115,116,97,114,116,0,36,22,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,108,101,110,103,116,104,0,37,22,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,108,101,110,103,116,104,0,38,31,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,99,117,116,95,102,105,110,103,101,114,112,114,105,110,116,0,39,31,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,99,117,116,95,102,105,110,103,101,114,112,114,105,110,116,0,40,20,82,97,98,105,110,35,103,101,116,58,112,111,108,121,110,111,109,105,97,108,0,41,20,82,97,98,105,110,35,115,101,116,58,112,111,108,121,110,111,109,105,97,108,0,42,17,82,97,98,105,110,35,103,101,116,58,109,105,110,115,105,122,101,0,43,17,82,97,98,105,110,35,115,101,116,58,109,105,110,115,105,122,101,0,44,17,82,97,98,105,110,35,103,101,116,58,109,97,120,115,105,122,101,0,45,17,82,97,98,105,110,35,115,101,116,58,109,97,120,115,105,122,101,0,46,14,82,97,98,105,110,35,103,101,116,58,109,97,115,107,0,47,14,82,97,98,105,110,35,115,101,116,58,109,97,115,107,0,48,17,82,97,98,105,110,35,99,111,110,115,116,114,117,99,116,111,114,0,20,17,82,97,98,105,110,35,102,105,110,103,101,114,112,114,105,110,116,0,49,8,1,50,10,249,35,53,199,1,1,4,127,32,1,40,2,0,65,124,113,34,2,65,128,2,73,4,127,32,2,65,4,118,33,4,65,0,5,32,2,65,31,32,2,103,107,34,3,65,4,107,118,65,16,115,33,4,32,3,65,7,107,11,33,3,32,1,40,2,20,33,2,32,1,40,2,16,34,5,4,64,32,5,32,2,54,2,20,11,32,2,4,64,32,2,32,5,54,2,16,11,32,1,32,0,32,4,32,3,65,4,116,106,65,2,116,106,40,2,96,70,4,64,32,0,32,4,32,3,65,4,116,106,65,2,116,106,32,2,54,2,96,32,2,69,4,64,32,0,32,3,65,2,116,106,32,0,32,3,65,2,116,106,40,2,4,65,1,32,4,116,65,127,115,113,34,1,54,2,4,32,1,69,4,64,32,0,32,0,40,2,0,65,1,32,3,116,65,127,115,113,54,2,0,11,11,11,11,226,2,1,6,127,32,1,40,2,0,33,3,32,1,65,16,106,32,1,40,2,0,65,124,113,106,34,4,40,2,0,34,5,65,1,113,4,64,32,3,65,124,113,65,16,106,32,5,65,124,113,106,34,2,65,240,255,255,255,3,73,4,64,32,0,32,4,16,1,32,1,32,2,32,3,65,3,113,114,34,3,54,2,0,32,1,65,16,106,32,1,40,2,0,65,124,113,106,34,4,40,2,0,33,5,11,11,32,3,65,2,113,4,64,32,1,65,4,107,40,2,0,34,2,40,2,0,34,6,65,124,113,65,16,106,32,3,65,124,113,106,34,7,65,240,255,255,255,3,73,4,64,32,0,32,2,16,1,32,2,32,7,32,6,65,3,113,114,34,3,54,2,0,32,2,33,1,11,11,32,4,32,5,65,2,114,54,2,0,32,4,65,4,107,32,1,54,2,0,32,0,32,3,65,124,113,34,2,65,128,2,73,4,127,32,2,65,4,118,33,4,65,0,5,32,2,65,31,32,2,103,107,34,2,65,4,107,118,65,16,115,33,4,32,2,65,7,107,11,34,3,65,4,116,32,4,106,65,2,116,106,40,2,96,33,2,32,1,65,0,54,2,16,32,1,32,2,54,2,20,32,2,4,64,32,2,32,1,54,2,16,11,32,0,32,4,32,3,65,4,116,106,65,2,116,106,32,1,54,2,96,32,0,32,0,40,2,0,65,1,32,3,116,114,54,2,0,32,0,32,3,65,2,116,106,32,0,32,3,65,2,116,106,40,2,4,65,1,32,4,116,114,54,2,4,11,119,1,1,127,32,2,2,127,32,0,40,2,160,12,34,2,4,64,32,2,32,1,65,16,107,70,4,64,32,2,40,2,0,33,3,32,1,65,16,107,33,1,11,11,32,1,11,107,34,2,65,48,73,4,64,15,11,32,1,32,3,65,2,113,32,2,65,32,107,65,1,114,114,54,2,0,32,1,65,0,54,2,16,32,1,65,0,54,2,20,32,1,32,2,106,65,16,107,34,2,65,2,54,2,0,32,0,32,2,54,2,160,12,32,0,32,1,16,2,11,155,1,1,3,127,35,0,34,0,69,4,64,65,1,63,0,34,0,74,4,127,65,1,32,0,107,64,0,65,0,72,5,65,0,11,4,64,0,11,65,176,3,34,0,65,0,54,2,0,65,208,15,65,0,54,2,0,3,64,32,1,65,23,73,4,64,32,1,65,2,116,65,176,3,106,65,0,54,2,4,65,0,33,2,3,64,32,2,65,16,73,4,64,32,1,65,4,116,32,2,106,65,2,116,65,176,3,106,65,0,54,2,96,32,2,65,1,106,33,2,12,1,11,11,32,1,65,1,106,33,1,12,1,11,11,65,176,3,65,224,15,63,0,65,16,116,16,3,65,176,3,36,0,11,32,0,11,45,0,32,0,65,240,255,255,255,3,79,4,64,65,32,65,224,0,65,201,3,65,29,16,0,0,11,32,0,65,15,106,65,112,113,34,0,65,16,32,0,65,16,75,27,11,169,1,1,1,127,32,0,32,1,65,128,2,73,4,127,32,1,65,4,118,33,1,65,0,5,32,1,65,248,255,255,255,1,73,4,64,32,1,65,1,65,27,32,1,103,107,116,106,65,1,107,33,1,11,32,1,65,31,32,1,103,107,34,2,65,4,107,118,65,16,115,33,1,32,2,65,7,107,11,34,2,65,2,116,106,40,2,4,65,127,32,1,116,113,34,1,4,127,32,0,32,1,104,32,2,65,4,116,106,65,2,116,106,40,2,96,5,32,0,40,2,0,65,127,32,2,65,1,106,116,113,34,1,4,127,32,0,32,0,32,1,104,34,0,65,2,116,106,40,2,4,104,32,0,65,4,116,106,65,2,116,106,40,2,96,5,65,0,11,11,11,111,1,1,127,63,0,34,2,32,1,65,248,255,255,255,1,73,4,127,32,1,65,1,65,27,32,1,103,107,116,65,1,107,106,5,32,1,11,65,16,32,0,40,2,160,12,32,2,65,16,116,65,16,107,71,116,106,65,255,255,3,106,65,128,128,124,113,65,16,118,34,1,32,2,32,1,74,27,64,0,65,0,72,4,64,32,1,64,0,65,0,72,4,64,0,11,11,32,0,32,2,65,16,116,63,0,65,16,116,16,3,11,113,1,2,127,32,1,40,2,0,34,3,65,124,113,32,2,107,34,4,65,32,79,4,64,32,1,32,2,32,3,65,2,113,114,54,2,0,32,2,32,1,65,16,106,106,34,1,32,4,65,16,107,65,1,114,54,2,0,32,0,32,1,16,2,5,32,1,32,3,65,126,113,54,2,0,32,1,65,16,106,32,1,40,2,0,65,124,113,106,32,1,65,16,106,32,1,40,2,0,65,124,113,106,40,2,0,65,125,113,54,2,0,11,11,91,1,2,127,32,0,32,1,16,5,34,4,16,6,34,3,69,4,64,65,1,36,1,65,0,36,1,32,0,32,4,16,6,34,3,69,4,64,32,0,32,4,16,7,32,0,32,4,16,6,33,3,11,11,32,3,65,0,54,2,4,32,3,32,2,54,2,8,32,3,32,1,54,2,12,32,0,32,3,16,1,32,0,32,3,32,4,16,8,32,3,11,13,0,16,4,32,0,32,1,16,9,65,16,106,11,33,1,1,127,32,0,65,172,3,75,4,64,32,0,65,16,107,34,1,32,1,40,2,4,65,1,106,54,2,4,11,32,0,11,18,0,32,0,65,172,3,75,4,64,32,0,65,16,107,16,52,11,11,140,3,1,1,127,2,64,32,1,69,13,0,32,0,65,0,58,0,0,32,0,32,1,106,65,1,107,65,0,58,0,0,32,1,65,2,77,13,0,32,0,65,1,106,65,0,58,0,0,32,0,65,2,106,65,0,58,0,0,32,0,32,1,106,34,2,65,2,107,65,0,58,0,0,32,2,65,3,107,65,0,58,0,0,32,1,65,6,77,13,0,32,0,65,3,106,65,0,58,0,0,32,0,32,1,106,65,4,107,65,0,58,0,0,32,1,65,8,77,13,0,32,1,65,0,32,0,107,65,3,113,34,1,107,33,2,32,0,32,1,106,34,0,65,0,54,2,0,32,0,32,2,65,124,113,34,1,106,65,4,107,65,0,54,2,0,32,1,65,8,77,13,0,32,0,65,4,106,65,0,54,2,0,32,0,65,8,106,65,0,54,2,0,32,0,32,1,106,34,2,65,12,107,65,0,54,2,0,32,2,65,8,107,65,0,54,2,0,32,1,65,24,77,13,0,32,0,65,12,106,65,0,54,2,0,32,0,65,16,106,65,0,54,2,0,32,0,65,20,106,65,0,54,2,0,32,0,65,24,106,65,0,54,2,0,32,0,32,1,106,34,2,65,28,107,65,0,54,2,0,32,2,65,24,107,65,0,54,2,0,32,2,65,20,107,65,0,54,2,0,32,2,65,16,107,65,0,54,2,0,32,0,32,0,65,4,113,65,24,106,34,2,106,33,0,32,1,32,2,107,33,1,3,64,32,1,65,32,79,4,64,32,0,66,0,55,3,0,32,0,65,8,106,66,0,55,3,0,32,0,65,16,106,66,0,55,3,0,32,0,65,24,106,66,0,55,3,0,32,1,65,32,107,33,1,32,0,65,32,106,33,0,12,1,11,11,11,11,178,1,1,3,127,32,1,65,240,255,255,255,3,32,2,118,75,4,64,65,144,1,65,192,1,65,23,65,56,16,0,0,11,32,1,32,2,116,34,3,65,0,16,10,34,2,32,3,16,13,32,0,69,4,64,65,12,65,2,16,10,34,0,65,172,3,75,4,64,32,0,65,16,107,34,1,32,1,40,2,4,65,1,106,54,2,4,11,11,32,0,65,0,54,2,0,32,0,65,0,54,2,4,32,0,65,0,54,2,8,32,2,34,1,32,0,40,2,0,34,4,71,4,64,32,1,65,172,3,75,4,64,32,1,65,16,107,34,5,32,5,40,2,4,65,1,106,54,2,4,11,32,4,16,12,11,32,0,32,1,54,2,0,32,0,32,2,54,2,4,32,0,32,3,54,2,8,32,0,11,46,1,2,127,65,12,65,5,16,10,34,0,65,172,3,75,4,64,32,0,65,16,107,34,1,32,1,40,2,4,65,1,106,54,2,4,11,32,0,65,128,2,65,3,16,14,11,66,2,1,127,1,126,66,128,128,128,128,128,128,128,128,128,127,33,2,3,64,32,1,65,192,0,72,4,64,32,0,32,2,131,66,0,86,4,64,65,63,32,1,107,15,11,32,2,66,1,136,33,2,32,1,65,1,106,33,1,12,1,11,11,65,127,11,165,1,2,2,127,1,126,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,3,64,32,3,65,192,0,72,4,64,65,63,32,3,107,32,1,32,4,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,3,65,1,106,33,3,12,1,11,11,65,127,11,33,3,3,64,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,2,3,64,32,2,65,192,0,72,4,64,65,63,32,2,107,32,0,32,4,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,2,65,1,106,33,2,12,1,11,11,65,127,11,32,3,107,34,2,65,0,78,4,64,32,0,32,1,32,2,172,134,133,33,0,12,1,11,11,32,0,11,40,0,32,1,32,0,40,2,8,79,4,64,65,128,2,65,192,2,65,163,1,65,44,16,0,0,11,32,1,32,0,40,2,4,106,32,2,58,0,0,11,38,0,32,1,32,0,40,2,8,79,4,64,65,128,2,65,192,2,65,152,1,65,44,16,0,0,11,32,1,32,0,40,2,4,106,45,0,0,11,164,9,2,1,127,6,126,32,0,69,4,64,65,232,0,65,6,16,10,34,0,65,172,3,75,4,64,32,0,65,16,107,34,5,32,5,40,2,4,65,1,106,54,2,4,11,11,32,0,65,0,54,2,0,32,0,65,0,54,2,4,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,24,32,0,66,0,55,3,32,32,0,66,0,55,3,40,32,0,66,0,55,3,48,32,0,66,0,55,3,56,32,0,66,0,55,3,64,32,0,66,0,55,3,72,32,0,66,0,55,3,80,32,0,66,0,55,3,88,32,0,66,0,55,3,96,32,0,32,2,173,55,3,80,32,0,32,3,173,55,3,88,65,12,65,4,16,10,34,2,65,172,3,75,4,64,32,2,65,16,107,34,3,32,3,40,2,4,65,1,106,54,2,4,11,32,2,32,4,65,0,16,14,33,2,32,0,40,2,0,16,12,32,0,32,2,54,2,0,32,0,32,4,54,2,4,32,0,66,1,32,1,173,134,66,1,125,55,3,96,32,0,66,243,130,183,218,216,230,232,30,55,3,72,35,4,69,4,64,65,0,33,2,3,64,32,2,65,128,2,72,4,64,32,2,65,255,1,113,173,33,7,32,0,41,3,72,34,8,33,9,2,127,66,128,128,128,128,128,128,128,128,128,127,33,6,65,0,33,3,3,64,32,3,65,192,0,72,4,64,65,63,32,3,107,32,6,32,8,131,66,0,86,13,2,26,32,6,66,1,136,33,6,32,3,65,1,106,33,3,12,1,11,11,65,127,11,33,1,3,64,2,127,66,128,128,128,128,128,128,128,128,128,127,33,6,65,0,33,3,3,64,32,3,65,192,0,72,4,64,65,63,32,3,107,32,6,32,7,131,66,0,86,13,2,26,32,6,66,1,136,33,6,32,3,65,1,106,33,3,12,1,11,11,65,127,11,32,1,107,34,3,65,0,78,4,64,32,7,32,9,32,3,172,134,133,33,7,12,1,11,11,65,0,33,5,3,64,32,5,32,0,40,2,4,65,1,107,72,4,64,65,0,33,3,32,7,66,8,134,33,7,32,0,41,3,72,34,8,33,9,2,127,66,128,128,128,128,128,128,128,128,128,127,33,6,3,64,32,3,65,192,0,72,4,64,65,63,32,3,107,32,6,32,8,131,66,0,86,13,2,26,32,6,66,1,136,33,6,32,3,65,1,106,33,3,12,1,11,11,65,127,11,33,1,3,64,2,127,66,128,128,128,128,128,128,128,128,128,127,33,6,65,0,33,4,3,64,32,4,65,192,0,72,4,64,65,63,32,4,107,32,6,32,7,131,66,0,86,13,2,26,32,6,66,1,136,33,6,32,4,65,1,106,33,4,12,1,11,11,65,127,11,32,1,107,34,3,65,0,78,4,64,32,7,32,9,32,3,172,134,133,33,7,12,1,11,11,32,5,65,1,106,33,5,12,1,11,11,35,6,40,2,4,32,2,65,3,116,106,32,7,55,3,0,32,2,65,1,106,33,2,12,1,11,11,2,127,32,0,41,3,72,33,6,66,128,128,128,128,128,128,128,128,128,127,33,7,65,0,33,2,3,64,32,2,65,192,0,72,4,64,65,63,32,2,107,32,6,32,7,131,66,0,86,13,2,26,32,7,66,1,136,33,7,32,2,65,1,106,33,2,12,1,11,11,65,127,11,172,33,8,65,0,33,2,3,64,32,2,65,128,2,72,4,64,35,5,33,4,32,2,172,32,8,134,34,9,33,7,2,127,32,0,41,3,72,34,10,33,11,66,128,128,128,128,128,128,128,128,128,127,33,6,65,0,33,3,3,64,32,3,65,192,0,72,4,64,65,63,32,3,107,32,6,32,11,131,66,0,86,13,2,26,32,6,66,1,136,33,6,32,3,65,1,106,33,3,12,1,11,11,65,127,11,33,1,3,64,2,127,66,128,128,128,128,128,128,128,128,128,127,33,6,65,0,33,5,3,64,32,5,65,192,0,72,4,64,65,63,32,5,107,32,6,32,7,131,66,0,86,13,2,26,32,6,66,1,136,33,6,32,5,65,1,106,33,5,12,1,11,11,65,127,11,32,1,107,34,3,65,0,78,4,64,32,7,32,10,32,3,172,134,133,33,7,12,1,11,11,32,4,40,2,4,32,2,65,3,116,106,32,7,32,9,132,55,3,0,32,2,65,1,106,33,2,12,1,11,11,65,1,36,4,11,32,0,66,0,55,3,24,32,0,66,0,55,3,32,65,0,33,2,3,64,32,2,32,0,40,2,4,72,4,64,32,0,40,2,0,32,2,65,0,16,18,32,2,65,1,106,33,2,12,1,11,11,32,0,66,0,55,3,40,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,40,32,0,40,2,0,32,0,40,2,8,16,19,33,1,32,0,40,2,0,32,0,40,2,8,65,1,16,18,32,0,32,0,41,3,40,35,6,40,2,4,32,1,65,3,116,106,41,3,0,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,35,5,40,2,4,32,0,41,3,40,34,6,66,45,136,167,65,255,1,113,65,3,116,106,41,3,0,32,6,66,8,134,66,1,132,133,55,3,40,32,0,11,38,1,1,127,32,0,40,2,0,34,0,65,172,3,75,4,64,32,0,65,16,107,34,1,32,1,40,2,4,65,1,106,54,2,4,11,32,0,11,55,1,2,127,32,1,32,0,40,2,0,34,2,71,4,64,32,1,65,172,3,75,4,64,32,1,65,16,107,34,3,32,3,40,2,4,65,1,106,54,2,4,11,32,2,16,12,11,32,0,32,1,54,2,0,11,7,0,32,0,40,2,4,11,9,0,32,0,32,1,54,2,4,11,7,0,32,0,40,2,8,11,9,0,32,0,32,1,54,2,8,11,7,0,32,0,41,3,16,11,9,0,32,0,32,1,55,3,16,11,7,0,32,0,41,3,24,11,9,0,32,0,32,1,55,3,24,11,7,0,32,0,41,3,32,11,9,0,32,0,32,1,55,3,32,11,7,0,32,0,41,3,40,11,9,0,32,0,32,1,55,3,40,11,7,0,32,0,41,3,48,11,9,0,32,0,32,1,55,3,48,11,7,0,32,0,41,3,56,11,9,0,32,0,32,1,55,3,56,11,7,0,32,0,41,3,64,11,9,0,32,0,32,1,55,3,64,11,7,0,32,0,41,3,72,11,9,0,32,0,32,1,55,3,72,11,7,0,32,0,41,3,80,11,9,0,32,0,32,1,55,3,80,11,7,0,32,0,41,3,88,11,9,0,32,0,32,1,55,3,88,11,7,0,32,0,41,3,96,11,9,0,32,0,32,1,55,3,96,11,172,4,2,5,127,1,126,32,2,65,172,3,75,4,64,32,2,65,16,107,34,4,32,4,40,2,4,65,1,106,54,2,4,11,32,2,33,4,65,0,33,2,32,1,40,2,8,33,5,32,1,40,2,4,33,6,3,64,2,127,65,0,33,3,3,64,32,3,32,5,72,4,64,32,3,32,6,106,45,0,0,33,1,32,0,40,2,0,32,0,40,2,8,16,19,33,7,32,0,40,2,0,32,0,40,2,8,32,1,16,18,32,0,32,0,41,3,40,35,6,40,2,4,32,7,65,3,116,106,41,3,0,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,35,5,40,2,4,32,0,41,3,40,34,8,66,45,136,167,65,255,1,113,65,3,116,106,41,3,0,32,1,173,32,8,66,8,134,132,133,55,3,40,32,0,32,0,41,3,16,66,1,124,55,3,16,32,0,32,0,41,3,24,66,1,124,55,3,24,32,0,41,3,16,32,0,41,3,80,90,4,127,32,0,41,3,40,32,0,41,3,96,131,80,5,65,0,11,4,127,65,1,5,32,0,41,3,16,32,0,41,3,88,90,11,4,64,32,0,32,0,41,3,32,55,3,48,32,0,32,0,41,3,16,55,3,56,32,0,32,0,41,3,40,55,3,64,65,0,33,1,3,64,32,1,32,0,40,2,4,72,4,64,32,0,40,2,0,32,1,65,0,16,18,32,1,65,1,106,33,1,12,1,11,11,32,0,66,0,55,3,40,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,40,32,0,40,2,0,32,0,40,2,8,16,19,33,1,32,0,40,2,0,32,0,40,2,8,65,1,16,18,32,0,32,0,41,3,40,35,6,40,2,4,32,1,65,3,116,106,41,3,0,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,35,5,40,2,4,32,0,41,3,40,34,8,66,45,136,167,65,255,1,113,65,3,116,106,41,3,0,32,8,66,8,134,66,1,132,133,55,3,40,32,3,65,1,106,12,3,11,32,3,65,1,106,33,3,12,1,11,11,65,127,11,34,1,65,0,78,4,64,32,5,32,1,107,33,5,32,1,32,6,106,33,6,32,2,34,1,65,1,106,33,2,32,4,40,2,4,32,1,65,2,116,106,32,0,41,3,56,62,2,0,12,1,11,11,32,4,11,10,0,16,15,36,5,16,15,36,6,11,3,0,1,11,73,1,2,127,32,0,40,2,4,34,1,65,255,255,255,255,0,113,34,2,65,1,70,4,64,32,0,65,16,106,16,53,32,0,32,0,40,2,0,65,1,114,54,2,0,35,0,32,0,16,2,5,32,0,32,2,65,1,107,32,1,65,128,128,128,128,127,113,114,54,2,4,11,11,58,0,2,64,2,64,2,64,32,0,65,8,107,40,2,0,14,7,0,0,1,1,1,1,1,2,11,15,11,32,0,40,2,0,34,0,4,64,32,0,65,172,3,79,4,64,32,0,65,16,107,16,52,11,11,15,11,0,11,11,137,3,7,0,65,16,11,55,40,0,0,0,1,0,0,0,1,0,0,0,40,0,0,0,97,0,108,0,108,0,111,0,99,0,97,0,116,0,105,0,111,0,110,0,32,0,116,0,111,0,111,0,32,0,108,0,97,0,114,0,103,0,101,0,65,208,0,11,45,30,0,0,0,1,0,0,0,1,0,0,0,30,0,0,0,126,0,108,0,105,0,98,0,47,0,114,0,116,0,47,0,116,0,108,0,115,0,102,0,46,0,116,0,115,0,65,128,1,11,43,28,0,0,0,1,0,0,0,1,0,0,0,28,0,0,0,73,0,110,0,118,0,97,0,108,0,105,0,100,0,32,0,108,0,101,0,110,0,103,0,116,0,104,0,65,176,1,11,53,38,0,0,0,1,0,0,0,1,0,0,0,38,0,0,0,126,0,108,0,105,0,98,0,47,0,97,0,114,0,114,0,97,0,121,0,98,0,117,0,102,0,102,0,101,0,114,0,46,0,116,0,115,0,65,240,1,11,51,36,0,0,0,1,0,0,0,1,0,0,0,36,0,0,0,73,0,110,0,100,0,101,0,120,0,32,0,111,0,117,0,116,0,32,0,111,0,102,0,32,0,114,0,97,0,110,0,103,0,101,0,65,176,2,11,51,36,0,0,0,1,0,0,0,1,0,0,0,36,0,0,0,126,0,108,0,105,0,98,0,47,0,116,0,121,0,112,0,101,0,100,0,97,0,114,0,114,0,97,0,121,0,46,0,116,0,115,0,65,240,2,11,53,7,0,0,0,16,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,145,4,0,0,2,0,0,0,49,0,0,0,2,0,0,0,17,1,0,0,2,0,0,0,16,0,34,16,115,111,117,114,99,101,77,97,112,112,105,110,103,85,82,76,16,46,47,114,97,98,105,110,46,119,97,115,109,46,109,97,112]);return n(new Response(new Blob([t],{type:"application/wasm"})),e)}i.supported="undefined"!=typeof WebAssembly,e.exports=i},function(e,t,r){"use strict";const n="undefined"!=typeof BigUint64Array,i=Symbol();function s(e,t){const r=new Uint32Array(e),n=new Uint16Array(e);var i=r[t+-4>>>2]>>>1,s=t>>>1;if(i<=1024)return String.fromCharCode.apply(String,n.subarray(s,s+i));const o=[];do{const e=n[s+1024-1],t=e>=55296&&e<56320?1023:1024;o.push(String.fromCharCode.apply(String,n.subarray(s,s+=t))),i-=t}while(i>1024);return o.join("")+String.fromCharCode.apply(String,n.subarray(s,s+i))}function o(e){const t={};function r(e,t){return e?s(e.buffer,t):"<yet unknown>"}const n=e.env=e.env||{};return n.abort=n.abort||function(e,i,s,o){const a=t.memory||n.memory;throw Error("abort: "+r(a,e)+" at "+r(a,i)+":"+s+":"+o)},n.trace=n.trace||function(e,i){const s=t.memory||n.memory;console.log("trace: "+r(s,e)+(i?" ":"")+Array.prototype.slice.call(arguments,2,2+i).join(", "))},e.Math=e.Math||Math,e.Date=e.Date||Date,t}function a(e,t){const r=t.exports,i=r.memory,o=r.table,a=r.__alloc,c=r.__retain,u=r.__rtti_base||-1;function f(e){const t=new Uint32Array(i.buffer);if((e>>>=0)>=t[u>>>2])throw Error("invalid id: "+e);return t[(u+4>>>2)+2*e]}function l(e){const t=new Uint32Array(i.buffer);if((e>>>=0)>=t[u>>>2])throw Error("invalid id: "+e);return t[(u+4>>>2)+2*e+1]}function d(e){return 31-Math.clz32(e>>>5&31)}function p(e,t,r){const n=i.buffer;if(r)switch(e){case 2:return new Float32Array(n);case 3:return new Float64Array(n)}else switch(e){case 0:return new(t?Int8Array:Uint8Array)(n);case 1:return new(t?Int16Array:Uint16Array)(n);case 2:return new(t?Int32Array:Uint32Array)(n);case 3:return new(t?BigInt64Array:BigUint64Array)(n)}throw Error("unsupported align: "+e)}function b(e){const t=new Uint32Array(i.buffer),r=t[e+-8>>>2],n=f(r);if(!(1&n))throw Error("not an array: "+r);const s=d(n);var o=t[e+4>>>2];const a=2&n?t[e+12>>>2]:t[o+-4>>>2]>>>s;return p(s,1024&n,2048&n).subarray(o>>>=s,o+a)}function y(e,t,r){return new e(m(e,t,r))}function m(e,t,r){const n=i.buffer,s=new Uint32Array(n),o=s[r+4>>>2];return new e(n,o,s[o+-4>>>2]>>>t)}return e.__allocString=function(e){const t=e.length,r=a(t<<1,1),n=new Uint16Array(i.buffer);for(var s=0,o=r>>>1;s<t;++s)n[o+s]=e.charCodeAt(s);return r},e.__getString=function(e){const t=i.buffer;if(1!==new Uint32Array(t)[e+-8>>>2])throw Error("not a string: "+e);return s(t,e)},e.__allocArray=function(e,t){const r=f(e);if(!(3&r))throw Error("not an array: "+e+" @ "+r);const n=d(r),s=t.length,o=a(s<<n,0),u=a(2&r?16:12,e),h=new Uint32Array(i.buffer);h[u+0>>>2]=c(o),h[u+4>>>2]=o,h[u+8>>>2]=s<<n,2&r&&(h[u+12>>>2]=s);const l=p(n,1024&r,2048&r);if(8192&r)for(let i=0;i<s;++i)l[(o>>>n)+i]=c(t[i]);else l.set(t,o>>>n);return u},e.__getArrayView=b,e.__getArray=function(e){const t=b(e),r=t.length,n=new Array(r);for(let i=0;i<r;i++)n[i]=t[i];return n},e.__getArrayBuffer=function(e){const t=i.buffer,r=new Uint32Array(t)[e+-4>>>2];return t.slice(e,e+r)},e.__getInt8Array=y.bind(null,Int8Array,0),e.__getInt8ArrayView=m.bind(null,Int8Array,0),e.__getUint8Array=y.bind(null,Uint8Array,0),e.__getUint8ArrayView=m.bind(null,Uint8Array,0),e.__getUint8ClampedArray=y.bind(null,Uint8ClampedArray,0),e.__getUint8ClampedArrayView=m.bind(null,Uint8ClampedArray,0),e.__getInt16Array=y.bind(null,Int16Array,1),e.__getInt16ArrayView=m.bind(null,Int16Array,1),e.__getUint16Array=y.bind(null,Uint16Array,1),e.__getUint16ArrayView=m.bind(null,Uint16Array,1),e.__getInt32Array=y.bind(null,Int32Array,2),e.__getInt32ArrayView=m.bind(null,Int32Array,2),e.__getUint32Array=y.bind(null,Uint32Array,2),e.__getUint32ArrayView=m.bind(null,Uint32Array,2),n&&(e.__getInt64Array=y.bind(null,BigInt64Array,3),e.__getInt64ArrayView=m.bind(null,BigInt64Array,3),e.__getUint64Array=y.bind(null,BigUint64Array,3),e.__getUint64ArrayView=m.bind(null,BigUint64Array,3)),e.__getFloat32Array=y.bind(null,Float32Array,2),e.__getFloat32ArrayView=m.bind(null,Float32Array,2),e.__getFloat64Array=y.bind(null,Float64Array,3),e.__getFloat64ArrayView=m.bind(null,Float64Array,3),e.__instanceof=function(e,t){const r=new Uint32Array(i.buffer);var n=r[e+-8>>>2];if(n<=r[u>>>2])do{if(n==t)return!0}while(n=l(n));return!1},e.memory=e.memory||i,e.table=e.table||o,h(r,e)}function c(e){return"undefined"!=typeof Response&&e instanceof Response}async function u(e,t){return c(e=await e)?f(e,t):a(o(t||(t={})),await WebAssembly.instantiate(e instanceof WebAssembly.Module?e:await WebAssembly.compile(e),t))}async function f(e,t){return WebAssembly.instantiateStreaming?a(o(t||(t={})),(await WebAssembly.instantiateStreaming(e,t)).instance):u(c(e=await e)?e.arrayBuffer():e,t)}function h(e,t){var r=t?Object.create(t):{},n=e.__argumentsLength?function(t){e.__argumentsLength.value=t}:e.__setArgumentsLength||e.__setargc||function(){};for(let s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;const t=e[s];let o=s.split("."),a=r;for(;o.length>1;){let e=o.shift();Object.prototype.hasOwnProperty.call(a,e)||(a[e]={}),a=a[e]}let c=o[0],u=c.indexOf("#");if(u>=0){let r=c.substring(0,u),o=a[r];if(void 0===o||!o.prototype){let e=function(...t){return e.wrap(e.prototype.constructor(0,...t))};e.prototype={valueOf:function(){return this[i]}},e.wrap=function(t){return Object.create(e.prototype,{[i]:{value:t,writable:!1}})},o&&Object.getOwnPropertyNames(o).forEach(t=>Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))),a[r]=e}if(c=c.substring(u+1),a=a[r].prototype,/^(get|set):/.test(c)){if(!Object.prototype.hasOwnProperty.call(a,c=c.substring(4))){let t=e[s.replace("set:","get:")],r=e[s.replace("get:","set:")];Object.defineProperty(a,c,{get:function(){return t(this[i])},set:function(e){r(this[i],e)},enumerable:!0})}}else"constructor"===c?(a[c]=(...e)=>(n(e.length),t(...e))).original=t:(a[c]=function(...e){return n(e.length),t(this[i],...e)}).original=t}else/^(get|set):/.test(c)?Object.prototype.hasOwnProperty.call(a,c=c.substring(4))||Object.defineProperty(a,c,{get:e[s.replace("set:","get:")],set:e[s.replace("get:","set:")],enumerable:!0}):"function"==typeof t&&t!==n?(a[c]=(...e)=>(n(e.length),t(...e))).original=t:a[c]=t}return r}t.instantiate=u,t.instantiateSync=function(e,t){return a(o(t||(t={})),new WebAssembly.Instance(e instanceof WebAssembly.Module?e:new WebAssembly.Module(e),t))},t.instantiateStreaming=f,t.demangle=h},function(e,t,r){"use strict";const n=r(30);e.exports=async function*(e,t){let r=new n,i=0,s=!1;const o=t.maxChunkSize;for await(const a of e)for(r.append(a),i+=a.length;i>=o;)if(yield r.slice(0,o),s=!0,o===r.length)r=new n,i=0;else{const e=new n;e.append(r.shallowSlice(o)),r=e,i-=o}s&&!i||(yield r.slice(0,i))}},function(e,t,r){"use strict";const n=r(1),{Buffer:i}=r(0);e.exports=async function*(e){for await(const t of e){if(void 0===t.length)throw n(new Error("Content was invalid"),"ERR_INVALID_CONTENT");"string"==typeof t||t instanceof String?yield i.from(t,"utf8"):Array.isArray(t)?yield i.from(t):yield t}}},function(e,t,r){"use strict";const n=r(509),i=r(510),s=r(132),o=r(515),a=r(1),c=r(232);async function u(e,t,r){const a=o(e.path||""),c=a.length-1;let u=t,f="";for(let o=0;o<a.length;o++){const h=a[o];f+="".concat(f?"/":"").concat(h);const l=o===c;if(u.dirty=!0,u.cid=null,u.size=null,l)await u.put(h,e),t=await i(null,u,r.shardSplitThreshold,r);else{let e=await u.get(h);e&&e instanceof s||(e=new n({dir:!0,parent:u,parentKey:h,path:f,dirty:!0,flat:!0,mtime:e&&e.unixfs&&e.unixfs.mtime,mode:e&&e.unixfs&&e.unixfs.mode},r)),await u.put(h,e),u=e}}return t}e.exports=async function*(e,t,r){let i=new n({root:!0,dir:!0,path:"",dirty:!0,flat:!0},r);for await(const n of e)n&&(i=await u(n,i,r),n.unixfs&&n.unixfs.isDirectory()||(yield n));if(!r.wrapWithDirectory){if(i.childCount()>1)throw a(new Error("detected more than one root"),"ERR_MORE_THAN_ONE_ROOT");const e=await c(i.eachChildSeries());if(!e)return;i=e.child}i instanceof s?yield*i.flush(i.path,t):i&&i.unixfs&&i.unixfs.isDirectory()&&(yield i)}},function(e,t,r){"use strict";const{DAGLink:n,DAGNode:i}=r(12),s=r(23),o=r(132),a=r(59);e.exports=class extends o{constructor(e,t){super(e,t),this._children={}}put(e,t){this.cid=void 0,this.size=void 0,this._children[e]=t}get(e){return this._children[e]}childCount(){return Object.keys(this._children).length}directChildrenCount(){return this.childCount()}onlyChild(){return this._children[Object.keys(this._children)[0]]}*eachChildSeries(){const e=Object.keys(this._children);for(let t=0;t<e.length;t++){const r=e[t];yield{key:r,child:this._children[r]}}}async*flush(e,t){const r=Object.keys(this._children),o=[];for(let i=0;i<r.length;i++){let e=this._children[r[i]];if("function"==typeof e.flush)for await(const r of e.flush(e.path,t))e=r,yield e;o.push(new n(r[i],e.size,e.cid))}const c=new s({type:"directory",mtime:this.mtime,mode:this.mode}),u=new i(c.marshal(),o),f=u.serialize(),h=await a(f,t,this.options),l=f.length+u.Links.reduce((e,t)=>e+t.Tsize,0);this.cid=h,this.size=l,yield{cid:h,unixfs:c,path:e,size:l}}}},function(e,t,r){"use strict";const n=r(133);e.exports=async function e(t,r,i,s){let o=r;r.flat&&r.directChildrenCount()>=i&&(o=await async function(e,t){const r=new n({root:e.root,dir:!0,parent:e.parent,parentKey:e.parentKey,path:e.path,dirty:e.dirty,flat:!1,mtime:e.mtime,mode:e.mode},t);for await(const{key:n,child:i}of e.eachChildSeries())await r.put(n,i);return r}(r,s));const a=o.parent;return a?(o!==r&&(t&&(t.parent=o),await a.put(o.parentKey,o)),e(o,a,i,s)):o}},function(e,t,r){"use strict";const n=r(134);e.exports=function(e){return new n(e)},e.exports.isBucket=n.isBucket},function(e,t,r){"use strict";function n(e,t){return e+i(t)}function i(e){let t=e;return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),16843009*(t+(t>>4)&252645135)>>24}function s(e,t){return e[0]-t[0]}function o(e){return e[1]}e.exports=class{constructor(){this._bitArrays=[],this._data=[],this._length=0,this._changedLength=!1,this._changedData=!1}set(e,t){let r=this._internalPositionFor(e,!1);if(void 0===t)-1!==r&&(this._unsetInternalPos(r),this._unsetBit(e),this._changedLength=!0,this._changedData=!0);else{let n=!1;-1===r?(r=this._data.length,this._setBit(e),this._changedData=!0):n=!0,this._setInternalPos(r,e,t,n),this._changedLength=!0}}unset(e){this.set(e,void 0)}get(e){this._sortData();const t=this._internalPositionFor(e,!0);if(-1!==t)return this._data[t][1]}push(e){return this.set(this.length,e),this.length}get length(){if(this._sortData(),this._changedLength){const e=this._data[this._data.length-1];this._length=e?e[0]+1:0,this._changedLength=!1}return this._length}forEach(e){let t=0;for(;t<this.length;)e(this.get(t),t,this),t++}map(e){let t=0,r=new Array(this.length);for(;t<this.length;)r[t]=e(this.get(t),t,this),t++;return r}reduce(e,t){let r=0,n=t;for(;r<this.length;){n=e(n,this.get(r),r),r++}return n}find(e){let t,r,n=0;for(;n<this.length&&!t;)r=this.get(n),t=e(r),n++;return t?r:void 0}_internalPositionFor(e,t){const r=this._bytePosFor(e,t);if(r>=this._bitArrays.length)return-1;const s=this._bitArrays[r],o=e-7*r;if(!((s&1<<o)>0))return-1;return this._bitArrays.slice(0,r).reduce(n,0)+i(s&~(4294967295<<o+1))-1}_bytePosFor(e,t){const r=Math.floor(e/7),n=r+1;for(;!t&&this._bitArrays.length<n;)this._bitArrays.push(0);return r}_setBit(e){const t=this._bytePosFor(e,!1);this._bitArrays[t]|=1<<e-7*t}_unsetBit(e){const t=this._bytePosFor(e,!1);this._bitArrays[t]&=~(1<<e-7*t)}_setInternalPos(e,t,r,n){const i=this._data,s=[t,r];if(n)this._sortData(),i[e]=s;else{if(i.length)if(i[i.length-1][0]>=t)i.push(s);else if(i[0][0]<=t)i.unshift(s);else{const e=Math.round(i.length/2);this._data=i.slice(0,e).concat(s).concat(i.slice(e))}else this._data.push(s);this._changedData=!0,this._changedLength=!0}}_unsetInternalPos(e){this._data.splice(e,1)}_sortData(){this._changedData&&this._data.sort(s),this._changedData=!1}bitField(){const e=[];let t,r=8,n=0,i=0;const s=this._bitArrays.slice();for(;s.length||n;){0===n&&(t=s.shift(),n=7);const o=Math.min(n,r);i|=(t&~(255<<o))<<8-r,t>>>=o,n-=o,r-=o,r&&(n||s.length)||(e.push(i),i=0,r=8)}for(var o=e.length-1;o>0;o--){if(0!==e[o])break;e.pop()}return e}compactArray(){return this._sortData(),this._data.map(o)}}},function(e,t,r){"use strict";(function(t){const n=r(514);e.exports=function(e){return function(t){return t instanceof i?t:new i(t,e)}};class i{constructor(e,r){if("string"!=typeof e&&!t.isBuffer(e))throw new Error("can only hash strings or buffers");this._value=e,this._hashFn=r,this._depth=-1,this._availableBits=0,this._currentBufferIndex=0,this._buffers=[]}async take(e){let t=e;for(;this._availableBits<t;)await this._produceMoreBits();let r=0;for(;t>0;){const e=this._buffers[this._currentBufferIndex],n=Math.min(e.availableBits(),t);r=(r<<n)+e.take(n),t-=n,this._availableBits-=n,0===e.availableBits()&&this._currentBufferIndex++}return r}untake(e){let t=e;for(;t>0;){const e=this._buffers[this._currentBufferIndex],r=Math.min(e.totalBits()-e.availableBits(),t);e.untake(r),t-=r,this._availableBits+=r,this._currentBufferIndex>0&&e.totalBits()===e.availableBits()&&(this._depth--,this._currentBufferIndex--)}}async _produceMoreBits(){this._depth++;const e=this._depth?this._value+this._depth:this._value,t=await this._hashFn(e),r=new n(t);this._buffers.push(r),this._availableBits+=r.availableBits()}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=[255,254,252,248,240,224,192,128],i=[1,3,7,15,31,63,127,255];function s(e,t,r){return(e&function(e,t){return n[e]&i[Math.min(t+e-1,7)]}(t,r))>>>t}e.exports=class{constructor(e){this._value=e,this._currentBytePos=e.length-1,this._currentBitPos=7}availableBits(){return this._currentBitPos+1+8*this._currentBytePos}totalBits(){return 8*this._value.length}take(e){let t=e,r=0;for(;t&&this._haveBits();){const e=this._value[this._currentBytePos],n=this._currentBitPos+1,i=Math.min(n,t);r=(r<<i)+s(e,n-i,i),t-=i,this._currentBitPos-=i,this._currentBitPos<0&&(this._currentBitPos=7,this._currentBytePos--)}return r}untake(e){for(this._currentBitPos+=e;this._currentBitPos>7;)this._currentBitPos-=8,this._currentBytePos+=1}_haveBits(){return this._currentBytePos>=0}}},function(e,t,r){"use strict";e.exports=(e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean)},function(e,t,r){"use strict";const n=r(1),{Buffer:i}=r(0),s=r(57);function o(e){const t={path:e.path||"",mode:e.mode,mtime:e.mtime};return e.content?t.content=a(e.content):e.path||(t.content=a(e)),t}function a(e){if(u(e)||"string"==typeof e)return async function*(){yield c(e)}();if(f(e))return function(e){if("function"==typeof e.stream)return l(e.stream());return async function*(e,t){t=t||{};const r=new s.FileReader,n=t.chunkSize||1048576;let o=t.offset||0;for(;;){const t=await new Promise((t,i)=>{r.onloadend=e=>{const r=e.target.result;t(0===r.byteLength?null:r)},r.onerror=i;const s=o+n,a=e.slice(o,s);r.readAsArrayBuffer(a),o=s});if(null==t)return;yield i.from(t)}}(e)}(e);if("function"==typeof e.getReader)return l(e);if(e[Symbol.iterator])return async function*(){const t=e[Symbol.iterator](),r=t.next();if(r.done)return t;if(Number.isInteger(r.value))yield c(Array.from(function*(){yield r.value,yield*t}()));else{if(!u(r.value))throw n(new Error("Unexpected input: "+typeof e),"ERR_UNEXPECTED_INPUT");yield c(r.value);for(const e of t)yield c(e)}}();if(e[Symbol.asyncIterator])return async function*(){for await(const t of e)yield c(t)}();throw n(new Error("Unexpected input: ".concat(e)),"ERR_UNEXPECTED_INPUT")}function c(e){return u(e)?e:i.from(e)}function u(e){return i.isBuffer(e)||ArrayBuffer.isView(e)||e instanceof ArrayBuffer}function f(e){return void 0!==s.Blob&&e instanceof s.Blob}function h(e){return"object"==typeof e&&(e.path||e.content)}async function*l(e){const t=e.getReader();for(;;){const e=await t.read();if(e.done)return;yield e.value}}e.exports=function(e){if(null==e)throw n(new Error("Unexpected input: ".concat(e)),"ERR_UNEXPECTED_INPUT");if("string"==typeof e||e instanceof String)return async function*(){yield o(e)}();if(u(e)||f(e))return async function*(){yield o(e)}();if(e[Symbol.iterator])return async function*(){const t=e[Symbol.iterator](),r=t.next();if(r.done)return t;if(Number.isInteger(r.value)||u(r.value))yield o(function*(){yield r.value,yield*t}());else{if(!h(r.value)&&!f(r.value)&&"string"!=typeof r.value)throw n(new Error("Unexpected input: "+typeof e),"ERR_UNEXPECTED_INPUT");yield o(r.value);for(const e of t)yield o(e)}}();if("function"==typeof e.getReader)return async function*(){for await(const t of l(e))yield o(t)}();if(e[Symbol.asyncIterator])return async function*(){const t=e[Symbol.asyncIterator](),r=await t.next();if(r.done)return t;if(u(r.value))yield o(async function*(){yield r.value,yield*t}());else{if(!h(r.value)&&!f(r.value)&&"string"!=typeof r.value)throw n(new Error("Unexpected input: "+typeof e),"ERR_UNEXPECTED_INPUT");yield o(r.value);for await(const e of t)yield o(e)}}();if(h(e))return async function*(){yield o(e)}();throw n(new Error("Unexpected input: "+typeof e),"ERR_UNEXPECTED_INPUT")}},function(e,t,r){"use strict";const n=e=>{const t={},r=e.split("-");switch(r.length){case 1:t.avgChunkSize=262144;break;case 2:t.avgChunkSize=i(r[1],"avg");break;case 4:t.minChunkSize=i(r[1],"min"),t.avgChunkSize=i(r[2],"avg"),t.maxChunkSize=i(r[3],"max");break;default:throw new Error('Incorrect chunker format (expected "rabin" "rabin-[avg]" or "rabin-[min]-[avg]-[max]"')}return t},i=(e,t)=>{const r=parseInt(e);if(isNaN(r))throw new Error("Chunker parameter ".concat(t," must be an integer"));return r};e.exports={parseChunkSize:i,parseRabinString:n,parseChunkerString:e=>{if(e){if(e.startsWith("size-")){const t=e.split("-")[1],r=parseInt(t);if(isNaN(r))throw new Error("Chunker parameter size must be an integer");return{chunker:"fixed",maxChunkSize:r}}if(e.startsWith("rabin"))return{chunker:"rabin",...n(e)};throw new Error("Unrecognized chunker option: ".concat(e))}return{chunker:"fixed"}}}},function(e,t,r){"use strict";e.exports=function(){return Date.now()}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.urlAlphabet=void 0;t.urlAlphabet="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"},function(e,t,r){"use strict";const n=r(234),i=r(236),s=r(239);e.exports=class extends i{constructor(){super(),this.data={}}async put(e,t){this.data[e.toString()]=t}async get(e){if(!await this.has(e))throw s.notFoundError();return this.data[e.toString()]}async has(e){return void 0!==this.data[e.toString()]}async delete(e){delete this.data[e.toString()]}*_all(){yield*Object.entries(this.data).map(([e,t])=>({key:new n(e),value:t}))}}},function(e,t,r){"use strict";const{nanoid:n}=r(235);e.exports=(e=(e=>e))=>e(n())},function(e,t,r){"use strict";const{cleanCid:n}=r(137),{withTimeoutOption:i}=r(3);e.exports=({blockService:e,preload:t})=>i((async function(r,i){return i=i||{},r=n(r),!1!==i.preload&&t(r),e.get(r,i)}))},function(e,t,r){"use strict";const n=r(76),i=r(22),s=r(4),o=r(49),{withTimeoutOption:a}=r(3);e.exports=({blockService:e,pin:t,gcLock:r,preload:c})=>a((async function(a,u){if(u=u||{},Array.isArray(a))throw new Error("Array is not supported");if(!n.isBlock(a))if(u.cid&&o.cid(u.cid))a=new n(a,s.isCID(u.cid)?u.cid:new s(u.cid));else{const e=u.mhtype||"sha2-256",t=u.format||"dag-pb";let r;r=null==u.version?"sha2-256"===e&&"dag-pb"===t?0:1:u.version;const o=await i(a,e),c=new s(r,t,o);a=new n(a,c)}const f=await r.readLock();try{return await e.put(a,{signal:u.signal}),!1!==u.preload&&c(a.cid),!0===u.pin&&await t.add(a.cid,{recursive:!0,signal:u.signal}),a}finally{f()}}))},function(e,t,r){"use strict";const n=r(4),i=r(1),{parallelMap:s,filter:o}=r(99),a=r(19),{PinTypes:c}=r(100),{cleanCid:u}=r(137),{withTimeoutOption:f}=r(3);e.exports=({blockService:e,gcLock:t,pinManager:r})=>f((async function*(f,h){h=h||{},Array.isArray(f)||(f=[f]);const l=await t.writeLock();try{yield*a(f,s(8,async t=>{const s={cid:t=u(t)};try{const s=await r.isPinnedWithType(t,c.all);if(s.pinned){if(n.isCID(s.reason))throw i(new Error("pinned via ".concat(s.reason)));throw i(new Error("pinned: ".concat(s.reason)))}if(!await e._repo.blocks.has(t))throw i(new Error("block not found"),"ERR_BLOCK_NOT_FOUND");await e.delete(t)}catch(o){h.force||(o.message="cannot remove ".concat(t,": ").concat(o.message),s.error=o)}return s}),o(()=>!h.quiet))}finally{l()}}))},function(e,t,r){"use strict";var n=Object.prototype.hasOwnProperty,i="~";function s(){}function o(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function a(e,t,r,n,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new o(r,n||e,s),c=i?i+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function c(e,t){0==--e._eventsCount?e._events=new s:delete e._events[t]}function u(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),u.prototype.eventNames=function(){var e,t,r=[];if(0===this._eventsCount)return r;for(t in e=this._events)n.call(e,t)&&r.push(i?t.slice(1):t);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},u.prototype.listeners=function(e){var t=i?i+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,s=r.length,o=new Array(s);n<s;n++)o[n]=r[n].fn;return o},u.prototype.listenerCount=function(e){var t=i?i+e:e,r=this._events[t];return r?r.fn?1:r.length:0},u.prototype.emit=function(e,t,r,n,s,o){var a=i?i+e:e;if(!this._events[a])return!1;var c,u,f=this._events[a],h=arguments.length;if(f.fn){switch(f.once&&this.removeListener(e,f.fn,void 0,!0),h){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,t),!0;case 3:return f.fn.call(f.context,t,r),!0;case 4:return f.fn.call(f.context,t,r,n),!0;case 5:return f.fn.call(f.context,t,r,n,s),!0;case 6:return f.fn.call(f.context,t,r,n,s,o),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];f.fn.apply(f.context,c)}else{var l,d=f.length;for(u=0;u<d;u++)switch(f[u].once&&this.removeListener(e,f[u].fn,void 0,!0),h){case 1:f[u].fn.call(f[u].context);break;case 2:f[u].fn.call(f[u].context,t);break;case 3:f[u].fn.call(f[u].context,t,r);break;case 4:f[u].fn.call(f[u].context,t,r,n);break;default:if(!c)for(l=1,c=new Array(h-1);l<h;l++)c[l-1]=arguments[l];f[u].fn.apply(f[u].context,c)}}return!0},u.prototype.on=function(e,t,r){return a(this,e,t,r,!1)},u.prototype.once=function(e,t,r){return a(this,e,t,r,!0)},u.prototype.removeListener=function(e,t,r,n){var s=i?i+e:e;if(!this._events[s])return this;if(!t)return c(this,s),this;var o=this._events[s];if(o.fn)o.fn!==t||n&&!o.once||r&&o.context!==r||c(this,s);else{for(var a=0,u=[],f=o.length;a<f;a++)(o[a].fn!==t||n&&!o[a].once||r&&o[a].context!==r)&&u.push(o[a]);u.length?this._events[s]=1===u.length?u[0]:u:c(this,s)}return this},u.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&c(this,t)):(this._events=new s,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=i,u.EventEmitter=u,e.exports=u},function(e,t,r){"use strict";const n=r(138);class i extends Error{constructor(e){super(e),this.name="TimeoutError"}}const s=(e,t,r)=>new Promise((s,o)=>{if("number"!=typeof t||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t===1/0)return void s(e);const a=setTimeout(()=>{if("function"==typeof r){try{s(r())}catch(c){o(c)}return}const n="string"==typeof r?r:"Promise timed out after ".concat(t," milliseconds"),a=r instanceof Error?r:new i(n);"function"==typeof e.cancel&&e.cancel(),o(a)},t);n(e.then(s,o),()=>{clearTimeout(a)})});e.exports=s,e.exports.default=s,e.exports.TimeoutError=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(528);t.default=class{constructor(){this._queue=[]}enqueue(e,t){const r={priority:(t=Object.assign({priority:0},t)).priority,run:e};if(this.size&&this._queue[this.size-1].priority>=t.priority)return void this._queue.push(r);const i=n.default(this._queue,r,(e,t)=>t.priority-e.priority);this._queue.splice(i,0,r)}dequeue(){const e=this._queue.shift();return null==e?void 0:e.run}filter(e){return this._queue.filter(t=>t.priority===e.priority).map(e=>e.run)}get size(){return this._queue.length}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){let n=0,i=e.length;for(;i>0;){const s=i/2|0;let o=n+s;r(e[o],t)<=0?(n=++o,i-=s+1):i=s}return n}},function(e,t,r){"use strict";t.util=r(241),t.resolver=r(534),t.codec=t.util.codec,t.defaultHashAlg=t.util.defaultHashAlg},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(242),s=r(140);class o extends i{createTag(e,t){return"".concat(e,"(").concat(t,")")}createInt(e){return super.createInt(e).toString()}createInt32(e,t){return super.createInt32(e,t).toString()}createInt64(e,t,r,n){return super.createInt64(e,t,r,n).toString()}createInt32Neg(e,t){return super.createInt32Neg(e,t).toString()}createInt64Neg(e,t,r,n){return super.createInt64Neg(e,t,r,n).toString()}createTrue(){return"true"}createFalse(){return"false"}createFloat(e){const t=super.createFloat(e);return s.isNegativeZero(e)?"-0_1":"".concat(t,"_1")}createFloatSingle(e,t,r,n){const i=super.createFloatSingle(e,t,r,n);return"".concat(i,"_2")}createFloatDouble(e,t,r,n,i,s,o,a){const c=super.createFloatDouble(e,t,r,n,i,s,o,a);return"".concat(c,"_3")}createByteString(e,t){const r=e.join(", ");return-1===t?"(_ ".concat(r,")"):"h'".concat(r)}createByteStringFromHeap(e,t){const r=n.from(super.createByteStringFromHeap(e,t)).toString("hex");return"h'".concat(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(".concat(e,")")}createArray(e,t){const r=super.createArray(e,t);return-1===t?"[_ ".concat(r.join(", "),"]"):"[".concat(r.join(", "),"]")}createMap(e,t){const r=super.createMap(e),n=Array.from(r.keys()).reduce(a(r),"");return-1===t?"{_ ".concat(n,"}"):"{".concat(n,"}")}createObject(e,t){const r=super.createObject(e),n=Object.keys(r).reduce(a(r),"");return-1===t?"{_ ".concat(n,"}"):"{".concat(n,"}")}createUtf8String(e,t){const r=e.join(", ");return-1===t?"(_ ".concat(r,")"):'"'.concat(r,'"')}createUtf8StringFromHeap(e,t){const r=n.from(super.createUtf8StringFromHeap(e,t)).toString("utf8");return'"'.concat(r,'"')}static diagnose(e,t){"string"==typeof e&&(e=n.from(e,t||"hex"));return(new o).decodeFirst(e)}}function a(e){return(t,r)=>t?"".concat(t,", ").concat(r,": ").concat(e[r]):"".concat(r,": ").concat(e[r])}e.exports=o},function(e,t,r){"use strict";e.exports=function(e,t,r){"use asm";var n=new e.Uint8Array(r);var i=t.pushInt;var s=t.pushInt32;var o=t.pushInt32Neg;var a=t.pushInt64;var c=t.pushInt64Neg;var u=t.pushFloat;var f=t.pushFloatSingle;var h=t.pushFloatDouble;var l=t.pushTrue;var d=t.pushFalse;var p=t.pushUndefined;var b=t.pushNull;var y=t.pushInfinity;var m=t.pushInfinityNeg;var g=t.pushNaN;var v=t.pushNaNNeg;var w=t.pushArrayStart;var _=t.pushArrayStartFixed;var E=t.pushArrayStartFixed32;var k=t.pushArrayStartFixed64;var S=t.pushObjectStart;var A=t.pushObjectStartFixed;var I=t.pushObjectStartFixed32;var T=t.pushObjectStartFixed64;var R=t.pushByteString;var x=t.pushByteStringStart;var C=t.pushUtf8String;var B=t.pushUtf8StringStart;var M=t.pushSimpleUnassigned;var N=t.pushTagStart;var P=t.pushTagStart4;var O=t.pushTagStart8;var D=t.pushTagUnassigned;var L=t.pushBreak;var j=e.Math.pow;var U=0;var z=0;var F=0;function q(e){e=e|0;U=0;z=e;while((U|0)<(z|0)){F=Xe[n[U]&255](n[U]|0)|0;if((F|0)>0){break}}return F|0}function K(e){e=e|0;if(((U|0)+(e|0)|0)<(z|0)){return 0}return 1}function V(e){e=e|0;return n[e|0]<<8|n[e+1|0]|0}function H(e){e=e|0;return n[e|0]<<24|n[e+1|0]<<16|n[e+2|0]<<8|n[e+3|0]|0}function G(e){e=e|0;i(e|0);U=U+1|0;return 0}function W(e){e=e|0;if(K(1)|0){return 1}i(n[U+1|0]|0);U=U+2|0;return 0}function Y(e){e=e|0;if(K(2)|0){return 1}i(V(U+1|0)|0);U=U+3|0;return 0}function J(e){e=e|0;if(K(4)|0){return 1}s(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function X(e){e=e|0;if(K(8)|0){return 1}a(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 Z(e){e=e|0;i(-1-(e-32|0)|0);U=U+1|0;return 0}function Q(e){e=e|0;if(K(1)|0){return 1}i(-1-(n[U+1|0]|0)|0);U=U+2|0;return 0}function $(e){e=e|0;var t=0;if(K(2)|0){return 1}t=V(U+1|0)|0;i(-1-(t|0)|0);U=U+3|0;return 0}function ee(e){e=e|0;if(K(4)|0){return 1}o(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function te(e){e=e|0;if(K(8)|0){return 1}c(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 r=0;var n=0;n=e-64|0;if(K(n|0)|0){return 1}t=U+1|0;r=(U+1|0)+(n|0)|0;R(t|0,r|0);U=r|0;return 0}function ne(e){e=e|0;var t=0;var r=0;var i=0;if(K(1)|0){return 1}i=n[U+1|0]|0;t=U+2|0;r=(U+2|0)+(i|0)|0;if(K(i+1|0)|0){return 1}R(t|0,r|0);U=r|0;return 0}function ie(e){e=e|0;var t=0;var r=0;var n=0;if(K(2)|0){return 1}n=V(U+1|0)|0;t=U+3|0;r=(U+3|0)+(n|0)|0;if(K(n+2|0)|0){return 1}R(t|0,r|0);U=r|0;return 0}function se(e){e=e|0;var t=0;var r=0;var n=0;if(K(4)|0){return 1}n=H(U+1|0)|0;t=U+5|0;r=(U+5|0)+(n|0)|0;if(K(n+4|0)|0){return 1}R(t|0,r|0);U=r|0;return 0}function oe(e){e=e|0;return 1}function ae(e){e=e|0;x();U=U+1|0;return 0}function ce(e){e=e|0;var t=0;var r=0;var n=0;n=e-96|0;if(K(n|0)|0){return 1}t=U+1|0;r=(U+1|0)+(n|0)|0;C(t|0,r|0);U=r|0;return 0}function ue(e){e=e|0;var t=0;var r=0;var i=0;if(K(1)|0){return 1}i=n[U+1|0]|0;t=U+2|0;r=(U+2|0)+(i|0)|0;if(K(i+1|0)|0){return 1}C(t|0,r|0);U=r|0;return 0}function fe(e){e=e|0;var t=0;var r=0;var n=0;if(K(2)|0){return 1}n=V(U+1|0)|0;t=U+3|0;r=(U+3|0)+(n|0)|0;if(K(n+2|0)|0){return 1}C(t|0,r|0);U=r|0;return 0}function he(e){e=e|0;var t=0;var r=0;var n=0;if(K(4)|0){return 1}n=H(U+1|0)|0;t=U+5|0;r=(U+5|0)+(n|0)|0;if(K(n+4|0)|0){return 1}C(t|0,r|0);U=r|0;return 0}function le(e){e=e|0;return 1}function de(e){e=e|0;B();U=U+1|0;return 0}function pe(e){e=e|0;_(e-128|0);U=U+1|0;return 0}function be(e){e=e|0;if(K(1)|0){return 1}_(n[U+1|0]|0);U=U+2|0;return 0}function ye(e){e=e|0;if(K(2)|0){return 1}_(V(U+1|0)|0);U=U+3|0;return 0}function me(e){e=e|0;if(K(4)|0){return 1}E(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function ge(e){e=e|0;if(K(8)|0){return 1}k(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 ve(e){e=e|0;w();U=U+1|0;return 0}function we(e){e=e|0;var t=0;t=e-160|0;if(K(t|0)|0){return 1}A(t|0);U=U+1|0;return 0}function _e(e){e=e|0;if(K(1)|0){return 1}A(n[U+1|0]|0);U=U+2|0;return 0}function Ee(e){e=e|0;if(K(2)|0){return 1}A(V(U+1|0)|0);U=U+3|0;return 0}function ke(e){e=e|0;if(K(4)|0){return 1}I(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function Se(e){e=e|0;if(K(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 Ae(e){e=e|0;S();U=U+1|0;return 0}function Ie(e){e=e|0;N(e-192|0|0);U=U+1|0;return 0}function Te(e){e|0;N(e|0);U=U+1|0;return 0}function Re(e){e|0;N(e|0);U=U+1|0;return 0}function xe(e){e|0;N(e|0);U=U+1|0;return 0}function Ce(e){e|0;N(e|0);U=U+1|0;return 0}function Be(e){e=e|0;N(e-192|0|0);U=U+1|0;return 0}function Me(e){e|0;N(e|0);U=U+1|0;return 0}function Ne(e){e|0;N(e|0);U=U+1|0;return 0}function Pe(e){e|0;N(e|0);U=U+1|0;return 0}function Oe(e){e=e|0;if(K(1)|0){return 1}N(n[U+1|0]|0);U=U+2|0;return 0}function De(e){e=e|0;if(K(2)|0){return 1}N(V(U+1|0)|0);U=U+3|0;return 0}function Le(e){e=e|0;if(K(4)|0){return 1}P(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function je(e){e=e|0;if(K(8)|0){return 1}O(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;M((e|0)-224|0);U=U+1|0;return 0}function ze(e){e=e|0;d();U=U+1|0;return 0}function Fe(e){e=e|0;l();U=U+1|0;return 0}function qe(e){e=e|0;b();U=U+1|0;return 0}function Ke(e){e=e|0;p();U=U+1|0;return 0}function Ve(e){e=e|0;if(K(1)|0){return 1}M(n[U+1|0]|0);U=U+2|0;return 0}function He(e){e=e|0;var t=0;var r=0;var i=1.0;var s=0.0;var o=0.0;var a=0.0;if(K(2)|0){return 1}t=n[U+1|0]|0;r=n[U+2|0]|0;if((t|0)&0x80){i=-1.0}s=+(((t|0)&0x7C)>>2);o=+(((t|0)&0x03)<<8|r);if(+s==0.0){u(+(+i*+5.9604644775390625e-8*+o))}else if(+s==31.0){if(+i==1.0){if(+o>0.0){g()}else{y()}}else{if(+o>0.0){v()}else{m()}}}else{u(+(+i*j(+2,+(+s-25.0))*+(1024.0+o)))}U=U+3|0;return 0}function Ge(e){e=e|0;if(K(4)|0){return 1}f(n[U+1|0]|0,n[U+2|0]|0,n[U+3|0]|0,n[U+4|0]|0);U=U+5|0;return 0}function We(e){e=e|0;if(K(8)|0){return 1}h(n[U+1|0]|0,n[U+2|0]|0,n[U+3|0]|0,n[U+4|0]|0,n[U+5|0]|0,n[U+6|0]|0,n[U+7|0]|0,n[U+8|0]|0);U=U+9|0;return 0}function Ye(e){e=e|0;return 1}function Je(e){e=e|0;L();U=U+1|0;return 0}var Xe=[G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,W,Y,J,X,Ye,Ye,Ye,Ye,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Q,$,ee,te,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,ne,ie,se,oe,Ye,Ye,Ye,ae,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ue,fe,he,le,Ye,Ye,Ye,de,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,be,ye,me,ge,Ye,Ye,Ye,ve,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,_e,Ee,ke,Se,Ye,Ye,Ye,Ae,Ie,Ie,Ie,Ie,Ie,Ie,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Oe,De,Le,je,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,Fe,qe,Ke,Ve,He,Ge,We,Ye,Ye,Ye,Je];return{parse:q}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),{URL:i}=r(88),s=r(37).BigNumber,o=r(140),a=r(101),c=a.MT,u=a.NUMBYTES,f=a.SHIFT32,h=a.SYMS,l=a.TAG,d=a.MT.SIMPLE_FLOAT<<5|a.NUMBYTES.TWO,p=a.MT.SIMPLE_FLOAT<<5|a.NUMBYTES.FOUR,b=a.MT.SIMPLE_FLOAT<<5|a.NUMBYTES.EIGHT,y=a.MT.SIMPLE_FLOAT<<5|a.SIMPLE.TRUE,m=a.MT.SIMPLE_FLOAT<<5|a.SIMPLE.FALSE,g=a.MT.SIMPLE_FLOAT<<5|a.SIMPLE.UNDEFINED,v=a.MT.SIMPLE_FLOAT<<5|a.SIMPLE.NULL,w=new s("0x20000000000000"),_=n.from("f97e00","hex"),E=n.from("f9fc00","hex"),k=n.from("f97c00","hex");class S{constructor(e){e=e||{},this.streaming="function"==typeof e.stream,this.onData=e.stream,this.semanticTypes=[[i,this._pushUrl],[s,this._pushBigNumber]];const t=e.genTypes||[],r=t.length;for(let n=0;n<r;n++)this.addSemanticType(t[n][0],t[n][1]);this._reset()}addSemanticType(e,t){const r=this.semanticTypes.length;for(let n=0;n<r;n++){if(this.semanticTypes[n][0]===e){const e=this.semanticTypes[n][1];return this.semanticTypes[n][1]=t,e}}return this.semanticTypes.push([e,t]),null}push(e){return!e||(this.result[this.offset]=e,this.resultMethod[this.offset]=0,this.resultLength[this.offset]=e.length,this.offset++,this.streaming&&this.onData(this.finalize()),!0)}pushWrite(e,t,r){return this.result[this.offset]=e,this.resultMethod[this.offset]=t,this.resultLength[this.offset]=r,this.offset++,this.streaming&&this.onData(this.finalize()),!0}_pushUInt8(e){return this.pushWrite(e,1,1)}_pushUInt16BE(e){return this.pushWrite(e,2,2)}_pushUInt32BE(e){return this.pushWrite(e,3,4)}_pushDoubleBE(e){return this.pushWrite(e,4,8)}_pushNaN(){return this.push(_)}_pushInfinity(e){const t=e<0?E:k;return this.push(t)}_pushFloat(e){const t=n.allocUnsafe(2);if(o.writeHalf(t,e)&&o.parseHalf(t)===e)return this._pushUInt8(d)&&this.push(t);const r=n.allocUnsafe(4);return r.writeFloatBE(e,0),r.readFloatBE(0)===e?this._pushUInt8(p)&&this.push(r):this._pushUInt8(b)&&this._pushDoubleBE(e)}_pushInt(e,t,r){const n=t<<5;return e<24?this._pushUInt8(n|e):e<=255?this._pushUInt8(n|u.ONE)&&this._pushUInt8(e):e<=65535?this._pushUInt8(n|u.TWO)&&this._pushUInt16BE(e):e<=4294967295?this._pushUInt8(n|u.FOUR)&&this._pushUInt32BE(e):e<=Number.MAX_SAFE_INTEGER?this._pushUInt8(n|u.EIGHT)&&this._pushUInt32BE(Math.floor(e/f))&&this._pushUInt32BE(e%f):t===c.NEG_INT?this._pushFloat(r):this._pushFloat(e)}_pushIntNum(e){return e<0?this._pushInt(-e-1,c.NEG_INT,e):this._pushInt(e,c.POS_INT)}_pushNumber(e){switch(!1){case e==e:return this._pushNaN(e);case isFinite(e):return this._pushInfinity(e);case e%1!=0:return this._pushIntNum(e);default:return this._pushFloat(e)}}_pushString(e){const t=n.byteLength(e,"utf8");return this._pushInt(t,c.UTF8_STRING)&&this.pushWrite(e,5,t)}_pushBoolean(e){return this._pushUInt8(e?y:m)}_pushUndefined(e){return this._pushUInt8(g)}_pushArray(e,t){const r=t.length;if(!e._pushInt(r,c.ARRAY))return!1;for(let n=0;n<r;n++)if(!e.pushAny(t[n]))return!1;return!0}_pushTag(e){return this._pushInt(e,c.TAG)}_pushDate(e,t){return e._pushTag(l.DATE_EPOCH)&&e.pushAny(Math.round(t/1e3))}_pushBuffer(e,t){return e._pushInt(t.length,c.BYTE_STRING)&&e.push(t)}_pushNoFilter(e,t){return e._pushBuffer(e,t.slice())}_pushRegexp(e,t){return e._pushTag(l.REGEXP)&&e.pushAny(t.source)}_pushSet(e,t){if(!e._pushInt(t.size,c.ARRAY))return!1;for(const r of t)if(!e.pushAny(r))return!1;return!0}_pushUrl(e,t){return e._pushTag(l.URI)&&e.pushAny(t.format())}_pushBigint(e){let t=l.POS_BIGINT;e.isNegative()&&(e=e.negated().minus(1),t=l.NEG_BIGINT);let r=e.toString(16);r.length%2&&(r="0"+r);const i=n.from(r,"hex");return this._pushTag(t)&&this._pushBuffer(this,i)}_pushBigNumber(e,t){if(t.isNaN())return e._pushNaN();if(!t.isFinite())return e._pushInfinity(t.isNegative()?-1/0:1/0);if(t.isInteger())return e._pushBigint(t);if(!e._pushTag(l.DECIMAL_FRAC)||!e._pushInt(2,c.ARRAY))return!1;const r=t.decimalPlaces(),n=t.multipliedBy(new s(10).pow(r));return!!e._pushIntNum(-r)&&(n.abs().isLessThan(w)?e._pushIntNum(n.toNumber()):e._pushBigint(n))}_pushMap(e,t){return!!e._pushInt(t.size,c.MAP)&&this._pushRawMap(t.size,Array.from(t))}_pushObject(e){if(!e)return this._pushUInt8(v);for(var t=this.semanticTypes.length,r=0;r<t;r++)if(e instanceof this.semanticTypes[r][0])return this.semanticTypes[r][1].call(e,this,e);var n=e.encodeCBOR;if("function"==typeof n)return n.call(e,this);var i=Object.keys(e),s=i.length;return!!this._pushInt(s,c.MAP)&&this._pushRawMap(s,i.map(t=>[t,e[t]]))}_pushRawMap(e,t){t=t.map((function(e){return e[0]=S.encode(e[0]),e})).sort(o.keySorter);for(var r=0;r<e;r++){if(!this.push(t[r][0]))return!1;if(!this.pushAny(t[r][1]))return!1}return!0}write(e){return this.pushAny(e)}pushAny(e){switch(function(e){return{}.toString.call(e).slice(8,-1)}(e)){case"Number":return this._pushNumber(e);case"String":return this._pushString(e);case"Boolean":return this._pushBoolean(e);case"Object":return this._pushObject(e);case"Array":return this._pushArray(this,e);case"Uint8Array":return this._pushBuffer(this,n.isBuffer(e)?e:n.from(e));case"Null":return this._pushUInt8(v);case"Undefined":return this._pushUndefined(e);case"Map":return this._pushMap(this,e);case"Set":return this._pushSet(this,e);case"URL":return this._pushUrl(this,e);case"BigNumber":return this._pushBigNumber(this,e);case"Date":return this._pushDate(this,e);case"RegExp":return this._pushRegexp(this,e);case"Symbol":switch(e){case h.NULL:return this._pushObject(null);case h.UNDEFINED:return this._pushUndefined(void 0);default:throw new Error("Unknown symbol: "+e.toString())}default:throw new Error("Unknown type: "+typeof e+", "+(e?e.toString():""))}}finalize(){if(0===this.offset)return null;for(var e=this.result,t=this.resultLength,r=this.resultMethod,i=this.offset,s=0,o=0;o<i;o++)s+=t[o];var a=n.allocUnsafe(s),c=0,u=0;for(o=0;o<i;o++){switch(u=t[o],r[o]){case 0:e[o].copy(a,c);break;case 1:a.writeUInt8(e[o],c,!0);break;case 2:a.writeUInt16BE(e[o],c,!0);break;case 3:a.writeUInt32BE(e[o],c,!0);break;case 4:a.writeDoubleBE(e[o],c,!0);break;case 5:a.write(e[o],c,u,"utf8");break;default:throw new Error("unkown method")}c+=u}var f=a;return this._reset(),f}_reset(){this.result=[],this.resultMethod=[],this.resultLength=[],this.offset=0}static encode(e){const t=new S;if(!t.pushAny(e))throw new Error("Failed to encode input");return t.finalize()}}e.exports=S},function(e,t,r){"use strict";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,r){"use strict";const n=r(4),{Buffer:i}=r(0),s=r(241);t.resolve=(e,t)=>{let r=s.deserialize(e);const i=t.split("/").filter(Boolean);for(;i.length;){const e=i.shift();if(void 0===r[e])throw new Error("Object has no property '".concat(e,"'"));if(r=r[e],n.isCID(r))return{value:r,remainderPath:i.join("/")}}return{value:r,remainderPath:""}};const o=function*(e,t){if(!i.isBuffer(e)&&!n.isCID(e)&&"string"!=typeof e&&null!==e)for(const r of Object.keys(e)){const n=void 0===t?r:t+"/"+r;yield n,yield*o(e[r],n)}};t.tree=function*(e){const t=s.deserialize(e);yield*o(t)}},function(e,t,r){"use strict";const n=r(22).multihash,i=r(4),s=r(16),o=r(536),a=r(14),{DAGNode:c,DAGLink:u}=r(12),f=r(11),{default:h}=r(51),l=r(240),d=r(2)("ipfs:pin:pin-set"),p=r(537),{Buffer:b}=r(0),y=n.fromB58String("QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n"),m=s(p);function g(e){return new i(e).toBaseEncodedString()}e.exports=function(e){const t={hasDescendant:async(t,r)=>{if("dag-pb"!==t.codec&&"dag-cbor"!==t.codec)return!1;const{value:n}=await e.get(t,{preload:!1}),s=new h({concurrency:100});(i.isCID(r)||b.isBuffer(r))&&(r=g(r));let o=!1;const a={};function c(t){return async()=>{if(!o)try{const{value:r}=await e.get(t,{preload:!1});u(t,r)}catch(r){d(r)}}}function u(e,t){let n=[];"dag-pb"===e.codec?n=t.Links:"dag-cbor"===e.codec&&(n=function*(e){for(const[t,r]of l(e))yield r}(t));for(const i of n){const t="dag-pb"===e.codec?i.Hash:i[1],n=g(t);if(n===r)return s.clear(),void(o=!0);a[n]||(a[n]=!0,"dag-pb"!==t.codec&&"dag-cbor"!==t.codec||s.add(c(t)))}}return u(t,n),await s.onIdle(),o},storeSet:async r=>{const n=r.map(e=>(("string"==typeof e||b.isBuffer(e))&&(e=new i(e)),{key:e,data:null})),s=await t.storeItems(n);return{node:s,cid:await e.put(s,{version:0,format:f.DAG_PB,hashAlg:f.SHA2_256,preload:!1})}},storeItems:async t=>async function t(r,n){const i=m.Set.encode({version:1,fanout:256,seed:n}),s=b.concat([b.from(a.encode(i.length)),i]),h=[];for(let e=0;e<256;e++)h.push(new u("",1,y));if(r.length<=8192){const e=r.map(e=>({link:new u("",1,e.key),data:e.data||b.alloc(0)})).sort((e,t)=>b.compare(e.link.Hash.buffer,t.link.Hash.buffer)),t=h.concat(e.map(e=>e.link)),n=b.concat([s].concat(e.map(e=>e.data)));return new c(n,t)}{const e=r.reduce((e,t)=>{const r=function(e,t){const r=b.alloc(4);r.writeUInt32LE(e,0);const n=b.concat([r,b.from(g(t))]);return o(n.toString("binary"))}(n,t.key)%256;return e[r]=r in e?e[r].concat([t]):[t],e},[]);let i=0;for(const r of e){const e=await t(r,n+1);await l(e,i),i++}return new c(s,h)}async function l(t,r){const n={version:0,format:f.DAG_PB,hashAlg:f.SHA2_256,preload:!1},i=await e.put(t,n);h[r]=new u("",t.size,i)}}(t,0),loadSet:async(r,n)=>{const i=r.Links.find(e=>e.Name===n);if(!i)throw new Error("No link found with name "+n);const s=await e.get(i.Hash,{preload:!1}),o=[];return await t.walkItems(s.value,{stepPin:e=>o.push(e.Hash)}),o},walkItems:async(r,{stepPin:n=(()=>{}),stepBin:i=(()=>{})})=>{const s=function(e){const t=e.Data,r=a.decode(t),n=a.decode.bytes;if(n<=0)throw new Error("Invalid Set header length");if(n+r>t.length)throw new Error("Impossibly large set header length");const i=t.slice(n,r+n),s=m.Set.decode(i);if(1!==s.version)throw new Error("Unsupported Set version: ".concat(s.version));if(s.fanout>e.Links.length)throw new Error("Impossibly large fanout");return{header:s,data:t.slice(r+n)}}(r);let o=0;for(const a of r.Links){if(o<s.header.fanout){const r=a.Hash.buffer;if(!y.equals(r)){i(a,o,s.data);const r=await e.get(a.Hash,{preload:!1});await t.walkItems(r.value,{stepPin:n,stepBin:i})}}else n(a,o,s.data);o++}},getInternalCids:async r=>{const n=[new i(y)],s=e=>n.push(e.Hash);for(const i of r.Links){n.push(i.Hash);const r=await e.get(i.Hash,{preload:!1});await t.walkItems(r.value,{stepBin:s})}return n}};return t}},function(e,t,r){"use strict";function n(e){for(var t=n.BASE,r=0,i=e.length;r<i;r++)t^=e.charCodeAt(r),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return t>>>0}n.BASE=2166136261,e.exports=n},function(e,t,r){"use strict";e.exports='\n syntax = "proto2";\n\n package ipfs.pin;\n\n option go_package = "pb";\n\n message Set {\n optional uint32 version = 1;\n optional uint32 fanout = 2;\n optional fixed32 seed = 3;\n }\n'},function(e,t,r){"use strict";const{cleanCid:n}=r(137),{withTimeoutOption:i}=r(3);e.exports=({blockService:e,preload:t})=>i((async function(r,i){i=i||{},r=n(r),!1!==i.preload&&t(r);return{cid:r,size:(await e.get(r)).data.length}}))},function(e,t,r){"use strict";const n=r(37),i=r(4),{withTimeoutOption:s}=r(3);e.exports=({bitswap:e})=>s((async function(){const t=e.stat().snapshot;return{provideBufLen:parseInt(t.providesBufferLength.toString()),blocksReceived:new n(t.blocksReceived),wantlist:Array.from(e.getWantlist()).map(e=>e[1].cid),peers:e.peers().map(e=>new i(e.toB58String())),dupBlksReceived:new n(t.dupBlksReceived),dupDataReceived:new n(t.dupDataReceived),dataReceived:new n(t.dataReceived),blocksSent:new n(t.blocksSent),dataSent:new n(t.dataSent)}}))},function(e,t,r){"use strict";const n=r(4),i=r(1),{withTimeoutOption:s}=r(3);e.exports=({bitswap:e})=>s((async function(t,r){Array.isArray(t)||(t=[t]);try{t=t.map(e=>new n(e))}catch(s){throw i(s,"ERR_INVALID_CID")}return e.unwant(t,r)}))},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=({bitswap:e})=>n((async function(t={}){const r=e.getWantlist(t);return Array.from(r).map(e=>e[1].cid)}))},function(e,t,r){"use strict";const n=r(6),{withTimeoutOption:i}=r(3);e.exports=({bitswap:e})=>i((async function(t,r={}){const i=e.wantlistForPeer(n.createFromCID(t),r);return Array.from(i).map(e=>e[1].cid)}))},function(e,t,r){"use strict";const{isValidMultiaddr:n}=r(245),{withTimeoutOption:i}=r(3);e.exports=({repo:e})=>i((async function(t,r={}){if(!n(t))throw new Error("".concat(t," is not a valid Multiaddr"));const i=await e.config.getAll(r);return-1===i.Bootstrap.indexOf(t)&&i.Bootstrap.push(t),await e.config.set(i),{Peers:[t]}}))},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=({repo:e})=>n((async function(t={}){const r=await e.config.getAll(t),n=r.Bootstrap||[];return r.Bootstrap=[],await e.config.set(r),{Peers:n}}))},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=({repo:e})=>n((async function(t){return{Peers:await e.config.get("Bootstrap",t)||[]}}))},function(e,t,r){"use strict";const n=r(143),{withTimeoutOption:i}=r(3);e.exports=({repo:e})=>i((async function(t={}){const r=await e.config.getAll(t);return r.Bootstrap=n().Bootstrap,await e.config.set(r),{Peers:n().Bootstrap}}))},function(e,t,r){"use strict";const{isValidMultiaddr:n}=r(245),{withTimeoutOption:i}=r(3);e.exports=({repo:e})=>i((async function(t,r={}){if(!n(t))throw new Error("".concat(t," is not a valid Multiaddr"));const i=await e.config.getAll(r);return i.Bootstrap=(i.Bootstrap||[]).filter(e=>e!==t),await e.config.set(i),{Peers:[t]}}))},function(e,t,r){"use strict";const n=r(32),{normalizeCidPath:i,withTimeoutOption:s}=r(3);e.exports=function({ipld:e,preload:t}){return s((async function*(r,s){if(s=s||{},r=i(r),!1!==s.preload){const e=r.split("/");t(e[0])}const o=await n(r,e,s);if(o.unixfs&&o.unixfs.type.includes("dir"))throw new Error("this dag node is a directory");if(!o.content)throw new Error("this dag node has no content");yield*o.content(s)}))}},function(e,t,r){"use strict";const n=r(1),i={"dag-pb":r(550),raw:r(558),"dag-cbor":r(559),identity:r(560)},s=(e,t,r,o,a,c,u)=>{const f=i[e.codec];if(!f)throw n(new Error("No resolver for codec ".concat(e.codec)),"ERR_NO_RESOLVER");return f(e,t,r,o,s,a,c,u)};e.exports=s},function(e,t,r){"use strict";const n=r(1),i=r(23),s=r(551),o={raw:r(247),file:r(247),directory:r(556),"hamt-sharded-directory":r(557),metadata:(e,t,r,n,i,s,o)=>{},symlink:(e,t,r,n,i,s,o)=>{}};e.exports=async(e,t,r,a,c,u,f,h)=>{const l=await f.get(e,h);let d,p;t||(t=e.toBaseEncodedString());try{d=i.unmarshal(l.Data)}catch(b){throw n(b,"ERR_NOT_UNIXFS")}if(r||(r=t),a.length){let e;if(e=d&&"hamt-sharded-directory"===d.type?await s(l,a[0],f):((e,t)=>{const r=e.Links.find(e=>e.Name===t);return r&&r.Hash})(l,a[0]),!e)throw n(new Error("file does not exist"),"ERR_NOT_FOUND");const t=a.shift();p={cid:e,toResolve:a,name:t,path:"".concat(r,"/").concat(t)}}return{entry:{name:t,path:r,cid:e,node:l,content:o[d.type](e,l,d,r,c,u,f,h),unixfs:d,depth:u},next:p}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(134),s=r(246),o=async function(e){const t=(await s(n.from(e,"utf8"),"murmur3-128")).slice(2,10),r=t.length,i=n.alloc(r);for(let n=0;n<r;n++)i[r-n-1]=t[n];return i};o.code=34;const a=e=>e.toString("16").toUpperCase().padStart(2,"0").substring(0,2),c=async(e,t,r,n,s)=>{var u,f,h;n||((n={rootBucket:new i({hashFn:o}),hamtDepth:1}).lastBucket=n.rootBucket),await(u=e.Links,f=n.lastBucket,h=n.rootBucket,Promise.all(u.map(e=>{if(2===e.Name.length){const t=parseInt(e.Name,16);return f._putObjectAt(t,new i({hashFn:o},f,t))}return h.put(e.Name.substring(2),!0)})));const l=await n.rootBucket._findNewBucketAndPos(t);let d=a(l.pos);const p=(e=>{let t=e.bucket;const r=[];for(;t._parent;)r.push(t),t=t._parent;return r.push(t),r.reverse()})(l);p.length>n.hamtDepth&&(n.lastBucket=p[n.hamtDepth],d=a(n.lastBucket._posAtParent));const b=e.Links.find(e=>{const r=e.Name.substring(0,2),n=e.Name.substring(2);if(r===d&&(!n||n===t))return!0});return b?b.Name.substring(2)===t?b.Hash:(n.hamtDepth++,e=await r.get(b.Hash,s),c(e,t,r,n,s)):null};e.exports=c},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(34),s=r(35),{factory:o}=r(553),{fromNumberTo32BitBuf:a}=r(554),c=e=>async t=>{switch(e){case"sha3-224":return n.from(i.sha3_224.arrayBuffer(t));case"sha3-256":return n.from(i.sha3_256.arrayBuffer(t));case"sha3-384":return n.from(i.sha3_384.arrayBuffer(t));case"sha3-512":return n.from(i.sha3_512.arrayBuffer(t));case"shake-128":return n.from(i.shake128.create(128).update(t).arrayBuffer());case"shake-256":return n.from(i.shake256.create(256).update(t).arrayBuffer());case"keccak-224":return n.from(i.keccak224.arrayBuffer(t));case"keccak-256":return n.from(i.keccak256.arrayBuffer(t));case"keccak-384":return n.from(i.keccak384.arrayBuffer(t));case"keccak-512":return n.from(i.keccak512.arrayBuffer(t));case"murmur3-128":return n.from(s.x64.hash128(t),"hex");case"murmur3-32":return a(s.x86.hash32(t));default:throw new TypeError("".concat(e," is not a supported algorithm"))}};e.exports={identity:e=>n.from(e),sha1:o("sha1"),sha2256:o("sha2-256"),sha2512:o("sha2-512"),dblSha2256:o("dbl-sha2-256"),sha3224:c("sha3-224"),sha3256:c("sha3-256"),sha3384:c("sha3-384"),sha3512:c("sha3-512"),shake128:c("shake-128"),shake256:c("shake-256"),keccak224:c("keccak-224"),keccak256:c("keccak-256"),keccak384:c("keccak-384"),keccak512:c("keccak-512"),murmur3128:c("murmur3-128"),murmur332:c("murmur3-32"),addBlake:r(555)}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(17),s=self.crypto||self.msCrypto,o=async(e,t)=>{if("undefined"==typeof self||!self.crypto&&!self.msCrypto)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");switch(t){case"sha1":return n.from(await s.subtle.digest({name:"SHA-1"},e));case"sha2-256":return n.from(await s.subtle.digest({name:"SHA-256"},e));case"sha2-512":return n.from(await s.subtle.digest({name:"SHA-512"},e));case"dbl-sha2-256":{const t=await s.subtle.digest({name:"SHA-256"},e);return n.from(await s.subtle.digest({name:"SHA-256"},t))}default:throw new Error("".concat(t," is not a supported algorithm"))}};e.exports={factory:e=>async t=>o(t,e),digest:o,multihashing:async(e,t,r)=>{const n=await o(e,t);return i.encode(n,t,r)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports={fromNumberTo32BitBuf:e=>{const t=new Array(4);for(let r=0;r<4;r++)t[r]=255&e,e>>=8;return n.from(t)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(36),s={init:i.blake2bInit,update:i.blake2bUpdate,digest:i.blake2bFinal},o={init:i.blake2sInit,update:i.blake2sUpdate,digest:i.blake2sFinal},a=(e,t)=>async r=>{const i=t.init(e,null);return t.update(i,r),n.from(t.digest(i))};e.exports=e=>{for(let t=0;t<64;t++)e[45569+t]=a(t+1,s);for(let t=0;t<32;t++)e[45633+t]=a(t+1,o)}},function(e,t,r){"use strict";e.exports=(e,t,r,n,i,s,o,a)=>async function*(e={}){const r=e.offset||0,a=e.length||t.Links.length,c=t.Links.slice(r,a);for(const t of c){const r=await i(t.Hash,t.Name,"".concat(n,"/").concat(t.Name),[],s+1,o,e);yield r.entry}}},function(e,t,r){"use strict";e.exports=(e,t,r,n,i,s,o)=>(e={})=>async function*e(t,r,n,i,s,o){const a=t.Links;for(const c of a){const a=c.Name.substring(2);if(a){const e=await n(c.Hash,a,"".concat(r,"/").concat(a),[],i+1,s);yield e.entry}else{t=await s.get(c.Hash);for await(const a of e(t,r,n,i,s,o))yield a}}}(t,n,i,s,o,e)},function(e,t,r){"use strict";const n=r(1),i=r(144),s=r(145);e.exports=async(e,t,r,o,a,c,u,f)=>{if(o.length)throw n(new Error("No link named ".concat(r," found in raw node ").concat(e.toBaseEncodedString())),"ERR_NOT_FOUND");const h=await u.get(e,f);return{entry:{name:t,path:r,cid:e,node:h,content:(l=h,function*(e={}){const{offset:t,length:r}=s(l.length,e.offset,e.length);yield i(l,0,t,t+r)}),depth:c}};var l}},function(e,t,r){"use strict";const n=r(4),i=r(1);e.exports=async(e,t,r,s,o,a,c,u)=>{const f=await c.get(e,u);let h=f,l=r;for(;s.length;){const o=s[0];if(!(o in h))throw i(new Error("No property named ".concat(o," found in cbor node ").concat(e.toBaseEncodedString())),"ERR_NO_PROP");if(s.shift(),l="".concat(l,"/").concat(o),n.isCID(h[o]))return{entry:{name:t,path:r,cid:e,node:f,depth:a},next:{cid:h[o],name:o,path:l,toResolve:s}};h=h[o]}return{entry:{name:t,path:r,cid:e,node:f,depth:a}}}},function(e,t,r){"use strict";const n=r(1),i=r(144),s=r(145),o=r(246).multihash;e.exports=async(e,t,r,a,c,u,f,h)=>{if(a.length)throw n(new Error("No link named ".concat(r," found in raw node ").concat(e.toBaseEncodedString())),"ERR_NOT_FOUND");const l=await o.decode(e.multihash);return{entry:{name:t,path:r,cid:e,node:l,content:(d=l.digest,function*(e={}){const{offset:t,length:r}=s(d.length,e.offset,e.length);yield i(d,0,t,t+r)}),depth:u}};var d}},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3),i=r(232),s=r(50),o=r(98);e.exports=({ipld:e,preload:t})=>n((async function(r,n={}){const{cid:a,path:c}=o(r);return c&&(n.path=c),!1!==n.preload&&t(a),n.path?n.localResolve?i(e.resolve(a,n.path)):s(e.resolve(a,n.path)):{value:await e.get(a,n),remainderPath:""}}))},function(e,t,r){"use strict";const n=r(11),i=e=>n[e.toUpperCase().replace(/-/g,"_")],{withTimeoutOption:s}=r(3);e.exports=({ipld:e,pin:t,gcLock:r,preload:o})=>s((async function(s,a){if((a=a||{}).cid&&(a.format||a.hashAlg))throw new Error("Can't put dag node. Please provide either `cid` OR `format` and `hashAlg` options.");if(a.format&&!a.hashAlg||!a.format&&a.hashAlg)throw new Error("Can't put dag node. Please provide `format` AND `hashAlg` options.");const c={format:n.DAG_CBOR,hashAlg:n.SHA2_256};let u;a.format&&"string"==typeof a.format&&(a.format=i(a.format)),a.hashAlg&&"string"==typeof a.hashAlg&&(a.hashAlg=i(a.hashAlg)),void 0===(a=a.cid?a:Object.assign({},c,a)).version&&(a.format===n.DAG_PB&&a.hashAlg===n.SHA2_256?a.version=0:a.version=1),a.pin&&(u=await r.readLock());try{const r=await e.put(s,a.format,{hashAlg:a.hashAlg,cidVersion:a.version,signal:a.signal});return a.pin&&await t.add(r,{lock:!1}),!1!==a.preload&&o(r),r}finally{u&&u()}}))},function(e,t,r){"use strict";const n=r(4),{withTimeoutOption:i}=r(3),s=r(98);e.exports=({ipld:e,preload:t})=>i((async function(r,i={}){const{cid:o,path:a}=s(r);!1!==i.preload&&t(o),a&&(i.path=a);let c=o,u=i.path||"";if(u.startsWith("/")&&(u=u.substring(1)),i.path)try{for await(const{value:t,remainderPath:r}of e.resolve(o,i.path,{signal:i.signal})){if(!n.isCID(t))break;u=r,c=t}}catch(f){throw f.message.startsWith("Object has no property")&&(f.message='no link named "'.concat(u.split("/")[0],'" under ').concat(c),f.code="ERR_NO_LINK"),f}return{cid:c,remainderPath:u||""}}))},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3),i=r(98);e.exports=({ipld:e,preload:t})=>n((async function*(r,n={}){const{cid:s,path:o}=i(r);o&&(n.path=o),!1!==n.preload&&t(s),yield*e.tree(s,n.path,n)}))},function(e,t,r){"use strict";const n=r(6),i=r(4),s=r(1),{withTimeoutOption:o}=r(3),{Buffer:a}=r(0);e.exports=({libp2p:e,repo:t})=>({get:o(async(t,r)=>{if(r=r||{},!a.isBuffer(t))try{t=t.toString().split("/").filter(e=>e&&"ipfs"!==e&&"ipns"!==e).shift(),t=new i(t).buffer}catch(n){throw s(n,"ERR_INVALID_CID")}return e._dht.get(t,r)}),put:o(async(t,r)=>{if(!a.isBuffer(t))try{t=t.toString().split("/").filter(e=>e&&"ipfs"!==e&&"ipns"!==e).shift(),t=new i(t).buffer}catch(n){throw s(n,"ERR_INVALID_CID")}return e._dht.put(t,r)}),findProvs:o((async function*(t,r){if(r=r||{},"string"==typeof t)try{t=new i(t)}catch(n){throw s(n,"ERR_INVALID_CID")}r.numProviders&&(r.maxNumProviders=r.numProviders);for await(const i of e._dht.findProviders(t,r))yield{id:i.id.toB58String(),addrs:i.addrs}})),findPeer:o(async t=>{"string"==typeof t&&(t=n.createFromCID(t));const r=await e._dht.findPeer(t);return{id:r.id.toB58String(),addrs:r.multiaddrs}}),provide:o((async function*(r,n){for(var o in n=n||{},r=Array.isArray(r)?r:[r])if("string"==typeof r[o])try{r[o]=new i(r[o])}catch(a){throw s(a,"ERR_INVALID_CID")}if(!(await Promise.all(r.map(e=>t.blocks.has(e)))).every(e=>e))throw s(new Error("block(s) not found locally, cannot provide"),"ERR_BLOCK_NOT_FOUND");if(n.recursive)throw s(new Error("not implemented yet"),"ERR_NOT_IMPLEMENTED_YET");for(const t of r)yield e._dht.provide(t)})),query:o((async function*(t){"string"==typeof t&&(t=n.createFromCID(t));for await(const r of e._dht.getClosestPeers(t.toBytes()))yield{id:r.toB58String(),addrs:[]}}))})},function(e,t,r){"use strict";const n=r(567),{withTimeoutOption:i}=r(3);e.exports=()=>i(async(e,t)=>{if(t=t||{},"string"!=typeof e)throw new Error("Invalid arguments, domain must be a string");return e=function(e){return e.endsWith(".eth")&&(e=e.replace(/.eth$/,".eth.link")),e}(e),n(e,t)})},function(e,t,r){"use strict";const n=r(249),{default:i}=r(51),s=r(115),o=new n(1e3),a=new i({concurrency:4}),c=e=>{if(e.Path)return e.Path;throw new Error(e.Message)};e.exports=async(e,t)=>(async(e,t)=>{t=t||{};const r=new URLSearchParams(t);r.set("arg",e);const n=r.toString();if(!t.nocache&&o.has(n)){const e=o.get(n);return c(e)}const i=await a.add(async()=>{const e=await s.get("https://ipfs.io/api/v0/dns",{searchParams:r}),t=new URL(e.url).search.slice(1),n=await e.json();return o.set(t,n,6e4),n});return c(i)})(e,t)},function(e,t,r){"use strict";const n=r(250),i=r(49),s={stat:r(103)},o={chmod:r(585),cp:r(148),flush:r(589),mkdir:r(149),mv:r(590),rm:r(151),touch:r(591)},a={write:r(592),read:r(594),ls:r(595)},c=({options:e,mfs:t,operations:r,lock:n})=>{Object.keys(r).forEach(i=>{t[i]=n(r[i](e))})},u={repoOwner:!0,ipld:null,repo:null};e.exports=({ipld:e,block:t,blockService:r,repo:f,preload:h,options:l})=>{const d=function(e){const{repoOwner:t}=Object.assign({},u||{},e);e.repo={blocks:e.blocks,datastore:e.datastore};const r=n(t),i={};return c({options:e,mfs:i,operations:s,lock:e=>r.readLock(e)}),c({options:e,mfs:i,operations:o,lock:e=>r.writeLock(e)}),Object.keys(a).forEach(t=>{i[t]=a[t](e)}),i}({ipld:e,block:t,blocks:r,datastore:f.root,repoOwner:l.repoOwner}),p=e=>(...t)=>{const r=t.filter(e=>i.ipfsPath(e)||i.cid(e));if(r.length){const e=t[t.length-1];e&&!1!==e.preload&&r.forEach(e=>h(e))}return e(...t)};return{...d,chmod:d.chmod,cp:p(d.cp),mkdir:d.mkdir,stat:p(d.stat),rm:d.rm,read:p(d.read),touch:d.touch,write:d.write,mv:p(d.mv),flush:d.flush,ls:p((async function*(...e){for await(const t of d.ls(...e))yield{...t,size:t.size||0}}))}}},function(e,t,r){"use strict";(function(t){const n=r(13).EventEmitter,i=r(252),{WORKER_REQUEST_READ_LOCK:s,WORKER_RELEASE_READ_LOCK:o,MASTER_GRANT_READ_LOCK:a,WORKER_REQUEST_WRITE_LOCK:c,WORKER_RELEASE_WRITE_LOCK:u,MASTER_GRANT_WRITE_LOCK:f}=r(253);let h;const l=(e,t,r,n,i)=>(s,o)=>{o&&o.type===r&&e.emit(t,o.name,()=>(s.send({type:i,name:o.name,identifier:o.identifier}),new Promise(e=>{const t=r=>{r&&r.type===n&&r.identifier===o.identifier&&(s.removeListener("message",t),e())};s.on("message",t)})))},d=(e,r,n,s)=>()=>{const o=i.generate();return t.send({type:r,identifier:o,name:e}),new Promise(r=>{const i=a=>{a&&a.type===n&&a.identifier===o&&(t.removeListener("message",i),r(()=>{t.send({type:s,identifier:o,name:e})}))};t.on("message",i)})};e.exports=e=>{try{if(h=r(578),!Object.keys(h).length)return}catch(t){return}if(h.isMaster||e.singleProcess){const e=new n;return h.on("message",l(e,"requestReadLock",s,o,a)),h.on("message",l(e,"requestWriteLock",c,u,f)),e}return{isWorker:!0,readLock:e=>d(e,s,a,o),writeLock:e=>d(e,c,f,u)}}}).call(this,r(8))},function(e,t,r){"use strict";var n=r(102),i=r(572),s=r(576),o=r(577)||0;function a(){return i(o)}e.exports=a,e.exports.generate=a,e.exports.seed=function(t){return n.seed(t),e.exports},e.exports.worker=function(t){return o=t,e.exports},e.exports.characters=function(e){return void 0!==e&&n.characters(e),n.shuffled()},e.exports.isValid=s},function(e,t,r){"use strict";var n=1;e.exports={nextValue:function(){return(n=(9301*n+49297)%233280)/233280},seed:function(e){n=e}}},function(e,t,r){"use strict";var n,i,s=r(573);r(102);e.exports=function(e){var t="",r=Math.floor(.001*(Date.now()-1567752802062));return r===i?n++:(n=0,i=r),t+=s(7),t+=s(e),n>0&&(t+=s(n)),t+=s(r)}},function(e,t,r){"use strict";var n=r(102),i=r(574),s=r(575);e.exports=function(e){for(var t,r=0,o="";!t;)o+=s(i,n.get(),1),t=e<Math.pow(16,r+1),r++;return o}},function(e,t,r){"use strict";var n,i="object"==typeof window&&(window.crypto||window.msCrypto);n=i&&i.getRandomValues?function(e){return i.getRandomValues(new Uint8Array(e))}:function(e){for(var t=[],r=0;r<e;r++)t.push(Math.floor(256*Math.random()));return t},e.exports=n},function(e,t,r){"use strict";e.exports=function(e,t,r){for(var n=(2<<Math.log(t.length-1)/Math.LN2)-1,i=-~(1.6*n*r/t.length),s="";;)for(var o=e(i),a=i;a--;)if((s+=t[o[a]&n]||"").length===+r)return s}},function(e,t,r){"use strict";var n=r(102);e.exports=function(e){return!(!e||"string"!=typeof e||e.length<6)&&!new RegExp("[^"+n.get().replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")+"]").test(e)}},function(e,t,r){"use strict";e.exports=0},function(e,t){},function(e,t,r){"use strict";const n=r(13).EventEmitter,i=r(252),{WORKER_REQUEST_READ_LOCK:s,WORKER_RELEASE_READ_LOCK:o,MASTER_GRANT_READ_LOCK:a,WORKER_REQUEST_WRITE_LOCK:c,WORKER_RELEASE_WRITE_LOCK:u,MASTER_GRANT_WRITE_LOCK:f}=r(253),h=r(254),l=r(580)(),d=(e,t,r,n,i)=>(s,o)=>{if(!o||!o.data||o.data.type!==r)return;const a={type:o.data.type,name:o.data.name,identifier:o.data.identifier};e.emit(t,a.name,()=>(s.postMessage({type:i,name:a.name,identifier:a.identifier}),new Promise(e=>{const t=r=>{if(!r||!r.data)return;const i={type:r.data.type,name:r.data.name,identifier:r.data.identifier};i&&i.type===n&&i.identifier===a.identifier&&(s.removeEventListener("message",t),e())};s.addEventListener("message",t)})))},p=(e,t,r,n)=>()=>{const s=i.generate();return l.postMessage({type:t,identifier:s,name:e}),new Promise(t=>{const i=o=>{if(!o||!o.data)return;const a={type:o.data.type,identifier:o.data.identifier};a&&a.type===r&&a.identifier===s&&(l.removeEventListener("message",i),t(()=>{l.postMessage({type:n,identifier:s,name:e})}))};l.addEventListener("message",i)})},b={singleProcess:!1};e.exports=e=>{e=Object.assign({},b,e);if(!!l.document||e.singleProcess){const e=new n;return h.addEventListener("message",d(e,"requestReadLock",s,o,a)),h.addEventListener("message",d(e,"requestWriteLock",c,u,f)),e}return{isWorker:!0,readLock:e=>p(e,s,a,o),writeLock:e=>p(e,c,f,u)}}},function(e,t,r){"use strict";var n=r(255),i=r(257),s=r(258),o=r(583),a=s(),c=function(){return a};n(c,{getPolyfill:s,implementation:i,shim:o}),e.exports=c},function(e,t,r){"use strict";var n=Array.prototype.slice,i=r(256),s=Object.keys,o=s?function(e){return s(e)}:r(582),a=Object.keys;o.shim=function(){Object.keys?function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2)||(Object.keys=function(e){return i(e)?a(n.call(e)):a(e)}):Object.keys=o;return Object.keys||o},e.exports=o},function(e,t,r){"use strict";var n;if(!Object.keys){var i=Object.prototype.hasOwnProperty,s=Object.prototype.toString,o=r(256),a=Object.prototype.propertyIsEnumerable,c=!a.call({toString:null},"toString"),u=a.call((function(){}),"prototype"),f=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],h=function(e){var t=e.constructor;return t&&t.prototype===e},l={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!l["$"+e]&&i.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{h(window[e])}catch(t){return!0}}catch(t){return!0}return!1}();n=function(e){var t=null!==e&&"object"==typeof e,r="[object Function]"===s.call(e),n=o(e),a=t&&"[object String]"===s.call(e),l=[];if(!t&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var p=u&&r;if(a&&e.length>0&&!i.call(e,0))for(var b=0;b<e.length;++b)l.push(String(b));if(n&&e.length>0)for(var y=0;y<e.length;++y)l.push(String(y));else for(var m in e)p&&"prototype"===m||!i.call(e,m)||l.push(String(m));if(c)for(var g=function(e){if("undefined"==typeof window||!d)return h(e);try{return h(e)}catch(t){return!1}}(e),v=0;v<f.length;++v)g&&"constructor"===f[v]||!i.call(e,f[v])||l.push(f[v]);return l}}e.exports=n},function(e,t,r){"use strict";var n=r(255),i=r(258);e.exports=function(){var e=i();if(n.supportsDescriptors){var t=Object.getOwnPropertyDescriptor(e,"globalThis");(!t||t.configurable&&(t.enumerable||t.writable||globalThis!==e))&&Object.defineProperty(e,"globalThis",{configurable:!0,enumerable:!1,value:e,writable:!1})}else"object"==typeof globalThis&&globalThis===e||(e.globalThis=e);return e}},function(e,t,r){"use strict";var n;e.exports.timeout=function(e,t){var r,i=new n;return Promise.race([e,new Promise((function(e,n){r=setTimeout((function(){n(i)}),t)}))]).then((function(e){return clearTimeout(r),e}),(function(e){throw clearTimeout(r),e}))};(n=e.exports.TimeoutError=function(){Error.call(this),this.stack=Error().stack,this.message="Timeout"}).prototype=Object.create(Error.prototype),n.prototype.name="TimeoutError"},function(e,t,r){"use strict";const n=r(44),i=r(38),s=r(2)("ipfs:mfs:touch"),o=r(1),a=r(23),c=r(77),u=r(61),f=r(62),h=r(63),{DAGNode:l}=r(12),d=r(11),p=r(22).multihash,b=r(19),y=r(128),m=r(32),g=r(50),v=r(148),w=r(151),_=r(59),{withTimeoutOption:E}=r(3),k={flush:!0,shardSplitThreshold:1e3,hashAlg:"sha2-256",cidVersion:0,recursive:!1,signal:void 0};function S(e,t,r){t||(t=0);const n=e.match(/^(u?g?o?a?)(-?\+?=?)?(r?w?x?X?s?t?)$/);if(!n)throw new Error("Invalid file mode: ".concat(e));let[i,s,o,a]=n;"a"!==s&&s||(s="ugo");let c=function(e,t,r){let n=0;return(e.includes("x")||e.includes("X")&&(r||1&t||8&t||64&t))&&(n+=1),e.includes("w")&&(n+=2),e.includes("r")&&(n+=4),n}(a,t,r);return c=function(e,t){let r=0;return e.includes("u")&&(r+=t<<6),e.includes("g")&&(r+=t<<3),e.includes("o")&&(r+=t),r}(s,c),c=function(e,t,r){return t.includes("t")&&(r+=parseInt("1000",8)),t.includes("s")&&(e.includes("u")&&(r+=parseInt("4000",8)),e.includes("g")&&(r+=parseInt("2000",8))),r}(s,a,c),"="===o?(s.includes("u")&&(t&=parseInt("7077",8),t|=c),s.includes("g")&&(t&=parseInt("7707",8),t|=c),s.includes("o")&&(t&=parseInt("7770",8),t|=c),t):"+"===o?c|t:"-"===o?c^t:void 0}function A(e,t){return("string"==typeof e||e instanceof String)&&(e=e.match(/^\d+$/g)?parseInt(e,8):e.split(",").reduce((e,r)=>S(r,e,t.isDirectory()),t.mode)),e}e.exports=e=>E((async function(t,r,E){E=n(E,k),s("Fetching stats for ".concat(t));const{cid:S,mfsDirectory:I,name:T}=await i(e,t,E);if("dag-pb"!==S.codec)throw o(new Error("".concat(t," was not a UnixFS node")),"ERR_NOT_UNIXFS");if(E.recursive){const n=await b((async function*(){for await(const t of m.recursive(S,e.ipld)){let n=await e.ipld.get(t.cid);t.unixfs.mode=A(r,t.unixfs),n=new l(t.unixfs.marshal(),n.Links),yield{path:t.path,content:n}}}),t=>y(t,e.block,{...E,pin:!1,dagBuilder:async function*(e,t,r){for await(const n of e)yield async function(){return{cid:await _(n.content.serialize(),t,r),path:n.path,unixfs:a.unmarshal(n.content.Data),node:n.content}}}}),e=>g(e));return await w(e)(t,E),void await v(e)("/ipfs/".concat(n.cid),t,E)}let R=await e.ipld.get(S);const x=a.unmarshal(R.Data);x.mode=A(r,x),R=new l(x.marshal(),R.Links);const C=await e.ipld.put(R,d.DAG_PB,{cidVersion:S.version,hashAlg:p.names[E.hashAlg],onlyHash:!E.flush}),B=await c(e,I,E),M=B[B.length-1],N=await e.ipld.get(M.cid),P=await u(e,{parent:N,name:T,cid:C,size:R.serialize().length,flush:E.flush,hashAlg:E.hashAlg,cidVersion:S.version});M.cid=P.cid;const O=await f(e,B,E);await h(e,O,E)}))},function(e,t,r){"use strict";const n=r(23),{DAGNode:i}=r(12),s=r(11),o=r(22).multihash;e.exports=async(e,t,r)=>{const a=o.names[r.hashAlg],c=new n({type:t,mode:r.mode,mtime:r.mtime}),u=new i(c.marshal());return{cid:await e.ipld.put(u,s.DAG_PB,{cidVersion:r.cidVersion,hashAlg:a,onlyHash:!r.flush}),node:u}}},function(e,t,r){"use strict";const n=r(150);e.exports=async function(e,t,r){const{sources:i,options:s}=await n(e,t,r);return{destination:i.pop(),sources:i,options:s}}},function(e,t,r){"use strict";const{DAGNode:n,DAGLink:i}=r(12),s=r(4),o=r(2)("ipfs:mfs:core:utils:remove-link"),a=r(23),{generatePath:c,updateHamtDirectory:u}=r(260),f=r(1),h=r(11),l=r(22).multihash,d=async(e,t)=>{const r=l.names[t.hashAlg];t.parent.rmLink(t.name);const n=await e.ipld.put(t.parent,h.DAG_PB,{cidVersion:t.cidVersion,hashAlg:r});return o("Updated regular directory ".concat(n)),{node:t.parent,cid:n}},p=async(e,t)=>{const{rootBucket:r,path:n}=await c(e,t.name,t.parent);await r.del(t.name);const{node:i}=await b(e,n,{name:t.name,cid:t.cid,size:t.size,hashAlg:t.hashAlg,cidVersion:t.cidVersion,flush:t.flush},t);return u(e,i.Links,r,t)},b=async(e,t,r,i)=>{const{bucket:s,prefix:a,node:c}=t.pop(),h=c.Links.find(e=>e.Name.substring(0,2)===a);if(!h)throw f(new Error("No link found with prefix ".concat(a," for file ").concat(r.name)),"ERR_NOT_FOUND");if(h.Name==="".concat(a).concat(r.name))return o("Removing existing link ".concat(h.Name)),c.rmLink(h.Name),await s.del(r.name),u(e,c.Links,s,i);o("Descending into sub-shard ".concat(h.Name," for ").concat(a).concat(r.name));const l=await b(e,t,r,i);let d=a;1===l.node.Links.length&&(o("Removing subshard for ".concat(a)),l.cid=l.node.Links[0].Hash,l.node=l.node.Links[0],d="".concat(a).concat(l.node.Name.substring(2))),o("Updating shard ".concat(a," with name ").concat(d));const p=n.isDAGNode(l.node)?l.node.size:l.node.Tsize;return y(e,s,c,a,d,p,l.cid,i)},y=(e,t,r,n,s,o,a,c)=>(r.rmLink(n),r.addLink(new i(s,o,a)),u(e,r.Links,t,c));e.exports=async(e,t)=>{if(!t.parentCid&&!t.parent)throw f(new Error("No parent node or CID passed to removeLink"),"EINVALIDPARENT");if(t.parentCid&&!s.isCID(t.parentCid))throw f(new Error("Invalid CID passed to removeLink"),"EINVALIDPARENTCID");if(t.parent||(o("Loading parent node ".concat(t.parentCid)),t.parent=await e.ipld.get(t.parentCid)),!t.name)throw f(new Error("No child name passed to removeLink"),"EINVALIDCHILDNAME");return"hamt-sharded-directory"===a.unmarshal(t.parent.Data).type?(o("Removing ".concat(t.name," from sharded directory")),p(e,t)):(o("Removing link ".concat(t.name," regular directory")),d(e,t))}},function(e,t,r){"use strict";const n=r(44),i=r(103),{withTimeoutOption:s}=r(3),o={signal:void 0};e.exports=e=>s((async function(t,r={}){r=n(r,o);const{cid:s}=await i(e)(t,r);return s}))},function(e,t,r){"use strict";const n=r(150),i=r(148),s=r(151),{withTimeoutOption:o}=r(3),a={parents:!1,recursive:!1,flush:!0,cidVersion:0,hashAlg:"sha2-256",shardSplitThreshold:1e3,signal:void 0};e.exports=e=>o((async function(...t){const{sources:r,options:o}=await n(e,t,a),c=r.map(e=>e.path).concat(o),u=r.slice(0,-1).map(e=>e.path).concat(Object.assign(o,{recursive:!0}));await i(e).apply(null,c),await s(e).apply(null,u)}))},function(e,t,r){"use strict";const n=r(44),i=r(38),s=r(2)("ipfs:mfs:touch"),o=r(1),a=r(23),c=r(77),u=r(61),f=r(62),h=r(63),{DAGNode:l}=r(12),d=r(11),p=r(22).multihash,{withTimeoutOption:b}=r(3),y={mtime:void 0,flush:!0,shardSplitThreshold:1e3,cidVersion:0,hashAlg:"sha2-256",signal:void 0};e.exports=e=>b((async function(t,r){(r=n(r=r||{},y)).mtime=r.mtime||new Date,s("Touching ".concat(t," mtime: ").concat(r.mtime));const{cid:b,mfsDirectory:m,name:g,exists:v}=await i(e,t,r);let w,_,E=r.cidVersion;if(v){if("dag-pb"!==b.codec)throw o(new Error("".concat(t," was not a UnixFS node")),"ERR_NOT_UNIXFS");E=b.version,w=await e.ipld.get(b);const n=a.unmarshal(w.Data);n.mtime=r.mtime,w=new l(n.marshal(),w.Links),_=await e.ipld.put(w,d.DAG_PB,{cidVersion:b.version,hashAlg:p.names["sha2-256"],onlyHash:!r.flush})}else{const t=new a({type:"file",mtime:r.mtime});w=new l(t.marshal()),_=await e.ipld.put(w,d.DAG_PB,{cidVersion:r.cidVersion,hashAlg:p.names["sha2-256"],onlyHash:!r.flush})}const k=await c(e,m,r),S=k[k.length-1],A=await e.ipld.get(S.cid),I=await u(e,{parent:A,name:g,cid:_,size:w.serialize().length,flush:r.flush,shardSplitThreshold:r.shardSplitThreshold,hashAlg:"sha2-256",cidVersion:E});S.cid=I.cid;const T=await f(e,k,r);await h(e,T,r)}))},function(e,t,r){"use strict";const n=r(2)("ipfs:mfs:write"),i=r(128),{Buffer:s}=r(0),o=r(103),a=r(149),c=r(61),u=r(44),f=r(250),h=r(593),l=r(38),d=r(147),p=r(77),b=r(62),y=r(63),m=r(1),{MFS_MAX_CHUNK_SIZE:g}=r(3),v=r(50),{withTimeoutOption:w}=r(3),_={offset:0,length:void 0,create:!1,truncate:!1,rawLeaves:!1,reduceSingleLeafToSelf:!1,cidVersion:0,hashAlg:"sha2-256",parents:!1,progress:()=>{},strategy:"trickle",flush:!0,leafType:"raw",shardSplitThreshold:1e3,mode:void 0,mtime:void 0,signal:void 0};e.exports=e=>w((async function(t,r,i){let s,o,a;if(i=u(i,_),n("Reading source, destination and parent"),await f().readLock(async()=>{s=await h(r,i),o=await l(e,t,i),a=await l(e,o.mfsDirectory,i)})(),n("Read source, destination and parent"),!i.parents&&!a.exists)throw m(new Error("directory does not exist"),"ERR_NO_EXIST");if(!i.create&&!o.exists)throw m(new Error("file does not exist"),"ERR_NO_EXIST");return E(e,t,s,o,i)}));const E=async(e,t,r,n,i)=>{const s=await k(e,r,n,i);await f().writeLock(async()=>{const r=d(t),n=r.pop();let u=!1;try{await o(e)("/".concat(r.join("/")),i),u=!0}catch(E){if("ERR_NOT_FOUND"!==E.code)throw E}u||await a(e)("/".concat(r.join("/")),i);const f=await l(e,t,i),h=await p(e,f.mfsDirectory,i),g=h[h.length-1];if(!g.type.includes("directory"))throw m(new Error("cannot write to ".concat(g.name,": Not a directory")),"ERR_NOT_A_DIRECTORY");const v=await e.ipld.get(g.cid),w=await c(e,{parent:v,name:n,cid:s.cid,size:s.size,flush:i.flush,shardSplitThreshold:i.shardSplitThreshold,hashAlg:i.hashAlg,cidVersion:i.cidVersion});g.cid=w.cid;const _=await b(e,h,i);await y(e,_,i)})()},k=async(e,t,r,s)=>{r.exists?n("Overwriting file ".concat(r.cid," offset ").concat(s.offset," length ").concat(s.length)):n("Writing file offset ".concat(s.offset," length ").concat(s.length));const o=[];if(s.offset>0)if(r.unixfs){if(n("Writing first ".concat(s.offset," bytes of original file")),o.push(()=>r.content({offset:0,length:s.offset})),r.unixfs.fileSize()<s.offset){const e=s.offset-r.unixfs.fileSize();n("Writing zeros for extra ".concat(e," bytes")),o.push(A(e))}}else n("Writing zeros for first ".concat(s.offset," bytes")),o.push(A(s.offset));o.push(S(t,s.length));const a=T(I(o),e=>{if(r.unixfs&&!s.truncate){const t=r.unixfs.fileSize();if(t>e)return n("Writing last ".concat(t-e," of ").concat(t," bytes from original file starting at offset ").concat(e)),r.content({offset:e});n("Not writing last bytes from original file")}return{[Symbol.asyncIterator]:async function*(){}}});let c,u;void 0!==s.mode&&null!==s.mode?c=s.mode:r&&r.unixfs&&(c=r.unixfs.mode),void 0!==s.mtime&&null!==s.mtine?u=s.mtime:r&&r.unixfs&&(u=r.unixfs.mtime);const f=await v(i([{content:a,mode:c,mtime:u}],e.block,{progress:s.progress,hashAlg:s.hashAlg,cidVersion:s.cidVersion,strategy:s.strategy,rawLeaves:s.rawLeaves,reduceSingleLeafToSelf:s.reduceSingleLeafToSelf,leafType:s.leafType,pin:!1}));return n("Wrote ".concat(f.cid)),{cid:f.cid,size:f.size}},S=(e,t)=>async function*(){let r=0;for await(const n of e){if(r+=n.length,r>t)return void(yield n.slice(0,t-r));yield n}},A=(e,t=g)=>{const r=s.alloc(t,0),n={[Symbol.asyncIterator]:function*(){for(;;)yield r.slice()}};return S(n,e)},I=async function*(e){for(let t=0;t<e.length;t++)yield*e[t]()},T=async function*(e,t){let r=0;for await(const n of e)r+=n.length,yield n;for await(const n of t(r))r+=n.length,yield n}},function(e,t,r){"use strict";(function(t){const n=r(1),{Buffer:i}=r(0),s=r(2)("ipfs:mfs:utils:to-async-iterator"),{MFS_MAX_CHUNK_SIZE:o}=r(3);e.exports=e=>{if(!e)throw n(new Error("paths must start with a leading slash"),"ERR_INVALID_PATH");if(("string"==typeof e||e instanceof String)&&(s("Content was a string"),e=i.from(e)),e.length)return s("Content was array-like"),{[Symbol.asyncIterator]:function*(){yield e}};if(e[Symbol.asyncIterator])return s("Content was an async iterator"),e;if(e[Symbol.iterator])return s("Content was an iterator"),e;if(t.Blob&&e instanceof t.Blob){s("Content was an HTML5 Blob");let r=0;const n={next:()=>r>e.size?{done:!0}:new Promise((n,s)=>{const a=e.slice(r,o);r+=o;const c=new t.FileReader,u=e=>{if(c.removeEventListener("loadend",u,!1),e.error)return s(e.error);n({done:!1,value:i.from(c.result)})};c.addEventListener("loadend",u),c.readAsArrayBuffer(a)})};return{[Symbol.asyncIterator]:()=>n}}throw n(new Error("Don't know how to convert ".concat(e," into an async iterator")),"ERR_INVALID_PARAMS")}}).call(this,r(10))},function(e,t,r){"use strict";const n=r(32),i=r(44),s=r(38),o=r(1),{withTimeoutOption:a}=r(3),c={offset:0,length:1/0,signal:void 0};e.exports=e=>a((function(t,r={}){return r=i(r,c),{[Symbol.asyncIterator]:async function*(){const i=await s(e,t,r),a=await n(i.mfsPath,e.ipld);if("file"!==a.unixfs.type)throw o(new Error("".concat(t," was not a file")),"ERR_NOT_FILE");if(!a.content)throw o(new Error("Could not load content stream from ".concat(t)),"ERR_NO_CONTENT");for await(const e of a.content({offset:r.offset,length:r.length}))yield e}}}))},function(e,t,r){"use strict";const n=r(32),i=r(38),{MFS_FILE_TYPES:s,withTimeoutOption:o}=r(3),a=e=>{let t,r,n=0,i=e.node.size||e.node.length;e.unixfs&&(i=e.unixfs.fileSize(),n=s[e.unixfs.type],t=e.unixfs.mode,r=e.unixfs.mtime);const o={cid:e.cid,name:e.name,type:n,size:i};return void 0!==r&&(o.mtime=r),void 0!==t&&(o.mode=t),o};e.exports=e=>o((async function*(t,r={}){const s=await i(e,t,r),o=await n(s.mfsPath,e.ipld);if(o.unixfs&&o.unixfs.type.includes("directory"))for await(const e of o.content(r))yield a(e);else yield a(o)}))},function(e,t,r){"use strict";const n=r(32),i=r(1),{normalizeCidPath:s,mapFile:o,withTimeoutOption:a}=r(3);e.exports=function({ipld:e,preload:t}){return a((async function*(r,a){if(!1!==(a=a||{}).preload){let e;try{e=s(r).split("/")}catch(c){throw i(c,"ERR_INVALID_PATH")}t(e[0])}for await(const t of n.recursive(r,e,a))yield o(t,{...a,includeContent:!0})}))}},function(e,t,r){"use strict";const n=r(261).version,i=r(15),{withTimeoutOption:s}=r(3);e.exports=({peerId:e,libp2p:t})=>s((async function(){const r=e.toB58String();let s=[];return t&&(s=t.transportManager.getAddrs()),{id:r,publicKey:e.pubKey.bytes.toString("base64"),addresses:s.map(e=>{const t=e.toString();return t.endsWith("/p2p/".concat(r))?t:"".concat(t,"/p2p/").concat(r)}).sort().map(e=>i(e)),agentVersion:"js-ipfs/".concat(n),protocolVersion:"9000"}}))},function(e,t,r){"use strict";const n=r(2)("ipfs:components:init"),i=r(6),{Buffer:s}=r(0),o=r(26),a=r(143),c=r(599),u=r(251),{DAGNode:f}=r(12),h=r(23),l=r(11),{AlreadyInitializingError:d,AlreadyInitializedError:p,NotStartedError:b,NotEnabledError:y}=r(75),m=r(668),g=r(670),v=r(687),w=r(695),{ERR_REPO_NOT_INITIALIZED:_}=r(152).errors,E=r(298),k=r(300),S=r(730),A=r(100),I=r(97);function T(e,t){return(e||[]).reduce((e,t)=>{const i=r(248).profiles[t];if(!i)throw new Error("Could not find profile with name '".concat(t,"'"));return n("applying profile %s",t),i.transform(e)},t)}e.exports=({apiManager:e,print:t,options:r})=>async function(R){const{cancel:x}=e.update({init:()=>{throw new d}});try{R=R||{},"object"==typeof r.init&&(R=o(r.init,R)),R.pass=R.pass||r.pass,r.config&&(R.config=o(R.config,r.config)),R.repo=R.repo||r.repo,R.repoAutoMigrate=R.repoAutoMigrate||r.repoAutoMigrate;const d="string"==typeof R.repo||null==R.repo?c({path:R.repo,autoMigrate:R.repoAutoMigrate}):R.repo;let x=!0;if(d.closed)try{await d.open()}catch(C){if(C.code!==_)throw C;x=!1}if(!x&&!1===R.allowNew)throw new y("new repo initialization is not enabled");const{peerId:B,keychain:M}=x?await async function(e,{config:t,profiles:r,pass:n}){let s=await e.config.getAll();(t||r)&&(r&&(s=T(r,s)),t&&(s=o(s,t)),await e.config.set(s));const a=await i.createFromPrivKey(s.Identity.PrivKey),c=I.libp2p({peerId:a,repo:e,config:s,keychainConfig:{pass:n,...s.Keychain}});return c.keychain&&await c.loadKeychain(),{peerId:a,keychain:c.keychain}}(d,R):await async function(e,{privateKey:t,emptyRepo:r,bits:c,profiles:u,config:f,pass:h,print:l}){r=r||!1,c=null==c?2048:Number(c),f=o(T(u,a()),f);const d=await e.exists();if(n("repo exists?",d),!0===d)throw new Error("repo already exists");const p=await function({privateKey:e,bits:t,print:r}){return e?(n("using user-supplied private-key"),"object"==typeof e?e:i.createFromPrivKey(s.from(e,"base64"))):(r("generating %s-bit RSA keypair...",t),i.create({bits:t}))}({privateKey:t,bits:c,print:l});n("identity generated"),f.Identity={PeerID:p.toB58String(),PrivKey:p.privKey.bytes.toString("base64")},t=p.privKey,n("peer identity: %s",f.Identity.PeerID),await e.init(f),await e.open(),n("repo opened");const b=I.libp2p({peerId:p,repo:e,config:f,keychainConfig:{pass:h}});b.keychain&&b.keychain.opts&&(await b.loadKeychain(),await e.config.set("Keychain",{dek:b.keychain.opts.dek}));return{peerId:p,keychain:b.keychain}}(d,{...R,print:t});n("peer created");const N=new m(d),P=new g(v(N,r.ipld,n)),O=w(r.preload);await O.start();const D=u(d.path,{singleProcess:!1!==r.repoOwner}),L={get:I.dag.get({ipld:P,preload:O}),resolve:I.dag.resolve({ipld:P,preload:O}),tree:I.dag.tree({ipld:P,preload:O})},j={data:I.object.data({ipld:P,preload:O}),get:I.object.get({ipld:P,preload:O}),links:I.object.links({dag:L}),new:I.object.new({ipld:P,preload:O}),patch:{addLink:I.object.patch.addLink({ipld:P,gcLock:D,preload:O}),appendData:I.object.patch.appendData({ipld:P,gcLock:D,preload:O}),rmLink:I.object.patch.rmLink({ipld:P,gcLock:D,preload:O}),setData:I.object.patch.setData({ipld:P,gcLock:D,preload:O})},put:I.object.put({ipld:P,gcLock:D,preload:O}),stat:I.object.stat({ipld:P,preload:O})},U=new A(d,L);await U.load();const z={add:I.pin.add({pinManager:U,gcLock:D,dag:L}),ls:I.pin.ls({pinManager:U,dag:L}),rm:I.pin.rm({pinManager:U,gcLock:D,dag:L})};L.put=I.dag.put({ipld:P,pin:z,gcLock:D,preload:O});const F={get:I.block.get({blockService:N,preload:O}),put:I.block.put({blockService:N,pin:z,gcLock:D,preload:O}),rm:I.block.rm({blockService:N,gcLock:D,pinManager:U}),stat:I.block.stat({blockService:N,preload:O})},q=I.addAll({block:F,preload:O,pin:z,gcLock:D,options:r});if(!x&&!R.emptyRepo){const e=await function({dag:e}){const t=new f(new h("directory").marshal());return e.put(t,{version:0,format:l.DAG_PB,hashAlg:l.SHA2_256,preload:!1})}({dag:L});n("adding default assets"),await S({addAll:q,print:t}),n("initializing IPNS keyspace");const r=new k(d),i=new E(r,d.datastore,B,M,{pass:R.pass});await i.initializeKeyspace(B.privKey,e.toString())}const K=function({add:e,apiManager:t,constructorOptions:r,block:n,blockService:i,dag:s,gcLock:o,initOptions:a,ipld:c,keychain:u,object:f,peerId:h,pin:l,pinManager:d,preload:y,print:m,repo:g}){const v=async()=>{throw new b},w=I.resolve({ipld:c}),_=I.refs({ipld:c,resolve:w,preload:y});_.local=I.refs.local({repo:g});return{add:e,bitswap:{stat:v,unwant:v,wantlist:v,wantlistForPeer:v},bootstrap:{add:I.bootstrap.add({repo:g}),list:I.bootstrap.list({repo:g}),rm:I.bootstrap.rm({repo:g})},block:n,cat:I.cat({ipld:c,preload:y}),config:I.config({repo:g}),dag:s,dns:I.dns(),files:I.files({ipld:c,block:n,blockService:i,repo:g,preload:y,options:r}),get:I.get({ipld:c,preload:y}),id:I.id({peerId:h}),init:async()=>{throw new p},isOnline:I.isOnline({}),key:{export:I.key.export({keychain:u}),gen:I.key.gen({keychain:u}),import:I.key.import({keychain:u}),info:I.key.info({keychain:u}),list:I.key.list({keychain:u}),rename:I.key.rename({keychain:u}),rm:I.key.rm({keychain:u})},ls:I.ls({ipld:c,preload:y}),object:f,pin:l,refs:_,repo:{gc:I.repo.gc({gcLock:o,pin:l,pinManager:d,refs:_,repo:g}),stat:I.repo.stat({repo:g}),version:I.repo.version({repo:g})},resolve:w,start:I.start({apiManager:t,options:r,blockService:i,gcLock:o,initOptions:a,ipld:c,keychain:u,peerId:h,pinManager:d,preload:y,print:m,repo:g}),stats:{bitswap:v,bw:v,repo:I.repo.stat({repo:g})},stop:()=>{},swarm:{addrs:v,connect:v,disconnect:v,localAddrs:I.swarm.localAddrs({multiaddrs:[]}),peers:v},version:I.version({repo:g})}}({add:I.add({addAll:q}),addAll:q,apiManager:e,constructorOptions:r,block:F,blockService:N,dag:L,gcLock:D,initOptions:R,ipld:P,keychain:M,object:j,peerId:B,pin:z,pinManager:U,preload:O,print:t,repo:d});e.update(K,()=>{throw new b})}catch(C){throw x(),C}return e.api}},function(e,t,r){"use strict";const n=r(152);e.exports=e=>{const t=(e=e||{}).path||"ipfs";return new n(t,{autoMigrate:e.autoMigrate})}},function(e,t,r){"use strict";const n=r(601),i=r(649),s=r(651),o=r(162),a=r(2)("repo-migrations:migrator");function c(e){return e=e||n,Array.isArray(e)&&0!==e.length?e[e.length-1].version:0}function u(e,t,r,n=!1){let i=0;for(const s of e){if(s.version>r)break;if(s.version>t){if(n&&!s.revert)throw new o.NonReversibleMigrationError("It is not possible to revert to version ".concat(t," because migration version ").concat(s.version," is not reversible. Cancelling reversion."));i++}}if(i!==r-t)throw new o.InvalidValueError("The ipfs-repo-migrations package does not have all migration to migrate from version ".concat(t," to ").concat(r))}t.getCurrentRepoVersion=i.getVersion,t.errors=o,t.getLatestMigrationVersion=c,t.migrate=async function(e,t,{ignoreLock:r=!1,repoOptions:f,onProgress:h,isDryRun:l=!1,migrations:d}){if(d=d||n,h=h||(()=>{}),!e)throw new o.RequiredParameterError("Path argument is required!");if(!t)throw new o.RequiredParameterError("toVersion argument is required!");if(!Number.isInteger(t)||t<=0)throw new o.InvalidValueError("Version has to be positive integer!");const p=await i.getVersion(e,f);if(p===t)return void a("Nothing to migrate.");if(p>t)throw new o.InvalidValueError("Current repo's version (".concat(p,") is higher then toVersion (").concat(t,"), you probably wanted to revert it?"));let b;u(d,p,t),l||r||(b=await s.lock(p,e));try{let n=0;const s=t-p;for(const r of d){if(void 0!==t&&r.version>t)break;if(!(r.version<=p)){n++,a("Migrating version ".concat(r.version));try{l||await r.migrate(e,f)}catch(y){const t=r.version-1;throw a("An exception was raised during execution of migration. Setting the repo's version to last successfully migrated version: ".concat(t)),await i.setVersion(e,t),y.message="During migration to version ".concat(r.version," exception was raised: ").concat(y.message),y}h(r,n,s),a("Migrating to version ".concat(r.version," finished"))}}l||await i.setVersion(e,t||c(d),f),a("Repo successfully migrated ",void 0!==t?"to version ".concat(t,"!"):"to latest version!")}finally{l||r||await b.close()}},t.revert=async function(e,t,{ignoreLock:r=!1,repoOptions:c,onProgress:f,isDryRun:h=!1,migrations:l}){if(l=l||n,f=f||(()=>{}),!e)throw new o.RequiredParameterError("Path argument is required!");if(!t)throw new o.RequiredParameterError("When reverting migrations, you have to specify to which version to revert!");if(!Number.isInteger(t)||t<=0)throw new o.InvalidValueError("Version has to be positive integer!");const d=await i.getVersion(e,c);if(d===t)return void a("Nothing to revert.");if(d<t)throw new o.InvalidValueError("Current repo's version (".concat(d,") is lower then toVersion (").concat(t,"), you probably wanted to migrate it?"));let p;u(l,t,d,!0),h||r||(p=await s.lock(d,e)),a("Reverting from version ".concat(d," to ").concat(t));try{let n=0;const s=d-t,o=l.slice().reverse();for(const r of o){if(r.version<=t)break;if(!(r.version>d)){n++,a("Reverting migration version ".concat(r.version));try{h||await r.revert(e,c)}catch(b){const t=r.version;throw a("An exception was raised during execution of migration. Setting the repo's version to last successfully reverted version: ".concat(t)),await i.setVersion(e,t,c),b.message="During reversion to version ".concat(r.version," exception was raised: ").concat(b.message),b}f(r,n,s),a("Reverting to version ".concat(r.version," finished"))}}h||await i.setVersion(e,t,c),a("All migrations successfully reverted to version ".concat(t,"!"))}finally{h||r||await p.close()}}},function(e,t,r){"use strict";const n={description:"Empty migration.",migrate:()=>{},revert:()=>{},empty:!0};e.exports=[Object.assign({version:1},n),Object.assign({version:2},n),Object.assign({version:3},n),Object.assign({version:4},n),Object.assign({version:5},n),Object.assign({version:6},n),Object.assign({version:7},n),r(602)]},function(e,t,r){"use strict";const n=r(603),i=r(4),s=r(7).Key,o=r(153),a=o.ShardingDatastore,c=r(27),u=r(154),f=r(2)("ipfs-repo-migrations:migration-8");function h(e){const t=c.decode("b".concat(e.toString().slice(1)));let r=new i(t).multihash;return r=c.encode("base32",r).slice(1),r=r.toString().toUpperCase(),new s("/".concat(r),!1)}function l(e){const t=c.decode("b".concat(e.toString().slice(1))),r=c.encode("base32",new i(1,"raw",t).buffer).slice(1);return new s("/".concat(r).toUpperCase(),!1)}async function d(e,t,r){const{StorageBackend:i,storageOptions:s}=u.getDatastoreAndOptions(t,"blocks"),c=new i(n.join(e,"blocks"),s);await c.open();const h=await async function(e,t){if(!1===t.sharding)return e;const r=new o.shard.NextToLast(2);return a.createOrOpen(e,r)}(c,s);await h.open();try{let e=0;for await(const t of h.query({})){const n=r(t.key);n.toString()!==t.key.toString()&&(e+=1,f("Migrating Block from ".concat(t.key.toString()," to ").concat(n.toString())),await h.delete(t.key),await h.put(n,t.value))}f("Changed ".concat(e," blocks"))}finally{await h.close()}}e.exports={version:8,description:"Transforms key names into base32 encoding and converts Block store to use bare multihashes encoded as base32",migrate:(e,t={})=>d(e,t,h),revert:(e,t={})=>d(e,t,l)}},function(e,t,r){"use strict";(function(e){function r(e,t){for(var r=0,n=e.length-1;n>=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n<e.length;n++)t(e[n],n,e)&&r.push(e[n]);return r}t.resolve=function(){for(var t="",i=!1,s=arguments.length-1;s>=-1&&!i;s--){var o=s>=0?arguments[s]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(t=o+"/"+t,i="/"===o.charAt(0))}return(i?"/":"")+(t=r(n(t.split("/"),(function(e){return!!e})),!i).join("/"))||"."},t.normalize=function(e){var s=t.isAbsolute(e),o="/"===i(e,-1);return(e=r(n(e.split("/"),(function(e){return!!e})),!s).join("/"))||s||(e="."),e&&o&&(e+="/"),(s?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(n(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},t.relative=function(e,r){function n(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=t.resolve(e).substr(1),r=t.resolve(r).substr(1);for(var i=n(e.split("/")),s=n(r.split("/")),o=Math.min(i.length,s.length),a=o,c=0;c<o;c++)if(i[c]!==s[c]){a=c;break}var u=[];for(c=a;c<i.length;c++)u.push("..");return(u=u.concat(s.slice(a))).join("/")},t.sep="/",t.delimiter=":",t.dirname=function(e){if("string"!=typeof e&&(e+=""),0===e.length)return".";for(var t=e.charCodeAt(0),r=47===t,n=-1,i=!0,s=e.length-1;s>=1;--s)if(47===(t=e.charCodeAt(s))){if(!i){n=s;break}}else i=!1;return-1===n?r?"/":".":r&&1===n?"/":e.slice(0,n)},t.basename=function(e,t){var r=function(e){"string"!=typeof e&&(e+="");var t,r=0,n=-1,i=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!i){r=t+1;break}}else-1===n&&(i=!1,n=t+1);return-1===n?"":e.slice(r,n)}(e);return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,r=0,n=-1,i=!0,s=0,o=e.length-1;o>=0;--o){var a=e.charCodeAt(o);if(47!==a)-1===n&&(i=!1,n=o+1),46===a?-1===t?t=o:1!==s&&(s=1):-1!==t&&(s=-1);else if(!i){r=o+1;break}}return-1===t||-1===n||0===s||1===s&&t===n-1&&t===r+1?"":e.slice(t,n)};var i="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)}}).call(this,r(8))},function(e,t,r){"use strict";const{Buffer:n}=r(0),{Adapter:i,Key:s}=r(7),o=r(263),a=r(104),c=new s(o.SHARDING_FN),u=new s(o.README_FN);class f extends i{constructor(e,t){super(),this.child=new a(e,{convert:this._convertKey.bind(this),invert:this._invertKey.bind(this)}),this.shard=t}open(){return this.child.open()}_convertKey(e){const t=e.toString();if(t===c.toString()||t===u.toString())return e;return new s(this.shard.fun(t)).child(e)}_invertKey(e){const t=e.toString();return t===c.toString()||t===u.toString()?e:s.withNamespaces(e.list().slice(1))}static async createOrOpen(e,t){try{await f.create(e,t)}catch(r){if(r&&"datastore exists"!==r.message)throw r}return f.open(e)}static async open(e){const t=await o.readShardFun("/",e);return new f(e,t)}static async create(e,t){if(!await e.has(c)){const r="function"==typeof e.putRaw?e.putRaw.bind(e):e.put.bind(e);return Promise.all([r(c,n.from(t.toString()+"\n")),r(u,n.from(o.readme))])}const r=(await o.readShardFun("/",e)||"").toString(),i=t.toString();if(r!==i)throw new Error("specified fun ".concat(i," does not match repo shard fun ").concat(r));throw new Error("datastore exists")}put(e,t,r){return this.child.put(e,t,r)}get(e,t){return this.child.get(e,t)}has(e,t){return this.child.has(e,t)}delete(e,t){return this.child.delete(e,t)}batch(){return this.child.batch()}query(e,t){const r={keysOnly:e.keysOnly,offset:e.offset,limit:e.limit,filters:[e=>e.key.toString()!==c.toString(),e=>e.key.toString()!==u.toString()]};if(null!=e.prefix&&r.filters.push(t=>this._invertKey(t.key).toString().startsWith(e.prefix)),null!=e.filters){const t=e.filters.map(e=>t=>e(Object.assign({},t,{key:this._invertKey(t.key)})));r.filters=r.filters.concat(t)}return null!=e.orders&&(r.orders=e.orders.map(e=>async t=>{t.forEach(e=>{e.key=this._invertKey(e.key)});const r=await e(t);return r.forEach(e=>{e.key=this._convertKey(e.key)}),r})),this.child.query(r,t)}close(){return this.child.close()}}e.exports=f},function(e,t,r){"use strict";e.exports="This is a repository of IPLD objects. Each IPLD object is in a single file,\nnamed <base32 encoding of cid>.data. Where <base32 encoding of cid> is the\n\"base32\" encoding of the CID (as specified in\nhttps://github.com/multiformats/multibase) without the 'B' prefix.\nAll the object files are placed in a tree of directories, based on a\nfunction of the CID. This is a form of sharding similar to\nthe objects directory in git repositories. Previously, we used\nprefixes, we now use the next-to-last two charters.\n func NextToLast(base32cid string) {\n nextToLastLen := 2\n offset := len(base32cid) - nextToLastLen - 1\n return str[offset : offset+nextToLastLen]\n }\nFor example, an object with a base58 CIDv1 of\n zb2rhYSxw4ZjuzgCnWSt19Q94ERaeFhu9uSqRgjSdx9bsgM6f\nhas a base32 CIDv1 of\n BAFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA\nand will be placed at\n SC/AFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA.data\nwith 'SC' being the last-to-next two characters and the 'B' at the\nbeginning of the CIDv1 string is the multibase prefix that is not\nstored in the filename.\n"},function(e,t,r){"use strict";const{Adapter:n,Key:i,Errors:s,utils:{filter:o,take:a,sortAll:c,replaceStartWith:u}}=r(7),f=r(104);e.exports=class extends n{constructor(e){super(),this.mounts=e.slice()}open(){return Promise.all(this.mounts.map(e=>e.datastore.open()))}_lookup(e){for(const t of this.mounts)if(t.prefix.toString()===e.toString()||t.prefix.isAncestorOf(e)){const r=u(e.toString(),t.prefix.toString());return{datastore:t.datastore,mountpoint:t.prefix,rest:new i(r)}}}put(e,t,r){const n=this._lookup(e);if(null==n)throw s.dbWriteFailedError(new Error("No datastore mounted for this key"));return n.datastore.put(n.rest,t,r)}get(e,t){const r=this._lookup(e);if(null==r)throw s.notFoundError(new Error("No datastore mounted for this key"));return r.datastore.get(r.rest,t)}has(e,t){const r=this._lookup(e);return null!=r&&r.datastore.has(r.rest,t)}delete(e,t){const r=this._lookup(e);if(null==r)throw s.dbDeleteFailedError(new Error("No datastore mounted for this key"));return r.datastore.delete(r.rest,t)}close(){return Promise.all(this.mounts.map(e=>e.datastore.close()))}batch(){const e={},t=t=>{const r=this._lookup(t);if(null==r)throw new Error("No datastore mounted for this key");const n=r.mountpoint.toString();return null==e[n]&&(e[n]=r.datastore.batch()),{batch:e[n],rest:r.rest}};return{put:(e,r)=>{const n=t(e);n.batch.put(n.rest,r)},delete:e=>{const r=t(e);r.batch.delete(r.rest)},commit:t=>Promise.all(Object.keys(e).map(r=>e[r].commit(t)))}}query(e,t){const r=this.mounts.map(r=>{const n=new f(r.datastore,{convert:e=>{throw new Error("should never be called")},invert:e=>r.prefix.child(e)});let i;return null!=e.prefix&&(i=u(e.prefix,r.prefix.toString())),n.query({prefix:i,filters:e.filters,keysOnly:e.keysOnly},t)});let n=(i=r,async function*(){for(let e=0;e<i.length;e++)for await(const t of i[e])yield t}());var i;if(e.filters&&e.filters.forEach(e=>{n=o(n,e)}),e.orders&&e.orders.forEach(e=>{n=c(n,e)}),null!=e.offset){let t=0;n=o(n,()=>t++>=e.offset)}return null!=e.limit&&(n=a(n,e.limit)),n}}},function(e,t,r){"use strict";const{Adapter:n,Errors:i}=r(7),s=r(2)("datastore:core:tiered");e.exports=class extends n{constructor(e){super(),this.stores=e.slice()}async open(){try{await Promise.all(this.stores.map(e=>e.open()))}catch(e){throw i.dbOpenFailedError()}}async put(e,t){try{await Promise.all(this.stores.map(r=>r.put(e,t)))}catch(r){throw i.dbWriteFailedError()}}async get(e,t){for(const n of this.stores)try{const r=await n.get(e,t);if(r)return r}catch(r){s(r)}throw i.notFoundError()}async has(e,t){for(const r of this.stores)if(await r.has(e,t))return!0;return!1}async delete(e,t){try{await Promise.all(this.stores.map(r=>r.delete(e,t)))}catch(r){throw i.dbDeleteFailedError()}}async close(){await Promise.all(this.stores.map(e=>e.close()))}batch(){const e=this.stores.map(e=>e.batch());return{put:(t,r)=>{e.forEach(e=>e.put(t,r))},delete:t=>{e.forEach(e=>e.delete(t))},commit:async t=>{for(const r of e)await r.commit(t)}}}query(e,t){return this.stores[this.stores.length-1].query(e,t)}}},function(e,t,r){"use strict";const n=r(7).Key,i=r(104);e.exports=class 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: (".concat(t.toString(),") in key: ").concat(e.toString()));return new n(e.toString().slice(t.toString().length),!1)}}),this.prefix=t}query(e){return e.prefix&&"/"!==this.prefix.toString()?super.query(Object.assign({},e,{prefix:this.prefix.child(new n(e.prefix)).toString()})):super.query(e)}}},function(e,t,r){"use strict";e.exports=r(610)(r(643))},function(e,t,r){"use strict";var n=r(611),i=r(639);e.exports=function(e){function t(t,s,o){return"function"==typeof t?o=t:"function"==typeof s&&(o=s),r(s)||(s=r(t)?t:{}),n(i(e(t,s),s),s,o)}function r(e){return"object"==typeof e&&null!==e}return["destroy","repair"].forEach((function(r){"function"==typeof e[r]&&(t[r]=function(){e[r].apply(e,arguments)})})),t.errors=n.errors,t}},function(e,t,r){"use strict";(function(t){var n=r(13).EventEmitter,i=r(264).inherits,s=r(64),o=r(614),a=r(623),c=r(633),u=r(159),f=r(155),h=r(637),l=r(276),d=r(105).getCallback,p=r(105).getOptions,b=u.WriteError,y=u.ReadError,m=u.NotFoundError,g=u.OpenError,v=u.InitializationError;function w(e,r,i){if(!(this instanceof w))return new w(e,r,i);var s,a=this;if(n.call(this),this.setMaxListeners(1/0),"function"==typeof r&&(i=r,r={}),r=r||{},!e||"object"!=typeof e){if(s=new v("First argument must be an abstract-leveldown compliant store"),"function"==typeof i)return t.nextTick(i,s);throw s}h.strictEqual(typeof e.status,"string",".status required, old abstract-leveldown"),this.options=p(r),this._db=e,this.db=new o(e),this.open(i||function(e){e&&a.emit("error",e)}),this.supports=f(this.db.supports,{status:!1,deferredOpen:!0,openCallback:!0,promises:!0,streams:!0}),Object.keys(this.supports.additionalMethods).forEach((function(e){null==this[e]&&(this[e]=function(){return this.db[e].apply(this.db,arguments)})}),this)}function _(e,r){if(!e._isOpening()&&!e.isOpen())return t.nextTick(r,new y("Database is not open")),!0}w.prototype.emit=n.prototype.emit,w.prototype.once=n.prototype.once,i(w,n),w.prototype.open=function(e,r){var n,i=this;return"function"==typeof e&&(r=e,e=null),r||(n=(r=l()).promise),e||(e=this.options),this.isOpen()?(t.nextTick(r,null,i),n):this._isOpening()?(this.once("open",(function(){r(null,i)})),n):(this.emit("opening"),this.db.open(e,(function(e){if(e)return r(new g(e));i.db=i._db,r(null,i),i.emit("open"),i.emit("ready")})),n)},w.prototype.close=function(e){var r,n=this;return e||(r=(e=l()).promise),this.isOpen()?(this.db.close((function(){n.emit("closed"),e.apply(null,arguments)})),this.emit("closing"),this.db=new o(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},w.prototype.isOpen=function(){return"open"===this.db.status},w.prototype._isOpening=function(){return"opening"===this.db.status},w.prototype.isClosed=function(){return/^clos|new/.test(this.db.status)},w.prototype.get=function(e,t,r){var n;return(r=d(t,r))||(n=(r=l()).promise),_(this,r)||(t=p(t),this.db.get(e,t,(function(t,n){if(t)return t=/notfound/i.test(t)||t.notFound?new m("Key not found in database ["+e+"]",t):new y(t),r(t);r(null,n)}))),n},w.prototype.put=function(e,t,r,n){var i,s=this;return(n=d(r,n))||(i=(n=l()).promise),_(this,n)||(r=p(r),this.db.put(e,t,r,(function(r){if(r)return n(new b(r));s.emit("put",e,t),n()}))),i},w.prototype.del=function(e,t,r){var n,i=this;return(r=d(t,r))||(n=(r=l()).promise),_(this,r)||(t=p(t),this.db.del(e,t,(function(t){if(t)return r(new b(t));i.emit("del",e),r()}))),n},w.prototype.batch=function(e,t,r){if(!arguments.length)return new c(this);var n,i=this;return(r="function"==typeof e?e:d(t,r))||(n=(r=l()).promise),_(this,r)||(t=p(t),this.db.batch(e,t,(function(t){if(t)return r(new b(t));i.emit("batch",e),r()}))),n},w.prototype.iterator=function(e){return this.db.iterator(e)},w.prototype.clear=function(e,t){var r,n=this;return t=d(e,t),e=p(e),t||(r=(t=l()).promise),_(this,t)||this.db.clear(e,(function(r){if(r)return t(new b(r));n.emit("clear",e),t()})),r},w.prototype.readStream=w.prototype.createReadStream=function(e){return"number"!=typeof(e=s({keys:!0,values:!0},e)).limit&&(e.limit=-1),new a(this.db.iterator(e),e)},w.prototype.keyStream=w.prototype.createKeyStream=function(e){return this.createReadStream(s(e,{keys:!0,values:!1}))},w.prototype.valueStream=w.prototype.createValueStream=function(e){return this.createReadStream(s(e,{keys:!1,values:!0}))},w.prototype.toString=function(){return"LevelUP"},w.prototype.type="levelup",w.errors=u,e.exports=w.default=w}).call(this,r(8))},function(e,t,r){"use strict";e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t,r){"use strict";"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},function(e,t,r){"use strict";var n=r(265).AbstractLevelDOWN,i=r(24),s=r(622),o="put get del batch clear".split(" "),a="approximateSize compactRange".split(" ");function c(e){n.call(this,e.supports||{}),a.forEach((function(t){"function"!=typeof e[t]||this.supports.additionalMethods[t]||(this.supports.additionalMethods[t]=!0)}),this),this._db=e,this._operations=[],u(this)}function u(e){o.forEach((function(t){e["_"+t]=function(){this._operations.push({method:t,args:arguments})}})),Object.keys(e.supports.additionalMethods).forEach((function(t){e[t]=function(){this._operations.push({method:t,args:arguments})}})),e._iterator=function(t){var r=new s(e,t);return this._operations.push({iterator:r}),r}}i(c,n),c.prototype.type="deferred-leveldown",c.prototype._open=function(e,t){var r=this;this._db.open(e,(function(e){if(e)return t(e);r._operations.forEach((function(e){e.iterator?e.iterator.setDb(r._db):r._db[e.method].apply(r._db,e.args)})),r._operations=[],function(e){o.concat("iterator").forEach((function(t){e["_"+t]=function(){return this._db[t].apply(this._db,arguments)}})),Object.keys(e.supports.additionalMethods).forEach((function(t){e[t]=function(){return this._db[t].apply(this._db,arguments)}}))}(r),t()}))},c.prototype._close=function(e){var t=this;this._db.close((function(r){if(r)return e(r);u(t),e()}))},c.prototype._serializeKey=function(e){return e},c.prototype._serializeValue=function(e){return e},e.exports=c,e.exports.DeferredIterator=s},function(e,t,r){"use strict";var n=r(64),i=r(155),s=r(0).Buffer,o=r(266),a=r(267),c=r(156),u=Object.prototype.hasOwnProperty,f="start end gt gte lt lte".split(" ");function h(e){this.status="new",this.supports=i(e,{status:!0})}function l(e,t){var r={};for(var n in t)if(u.call(t,n)){var i=t[n];d(n)&&(i=e._serializeKey(i)),r[n]=i}return r}function d(e){return-1!==f.indexOf(e)}h.prototype.open=function(e,t){var r=this,n=this.status;if("function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("open() requires a callback argument");"object"==typeof e&&null!==e||(e={}),e.createIfMissing=!1!==e.createIfMissing,e.errorIfExists=!!e.errorIfExists,this.status="opening",this._open(e,(function(e){if(e)return r.status=n,t(e);r.status="open",t()}))},h.prototype._open=function(e,t){c(t)},h.prototype.close=function(e){var t=this,r=this.status;if("function"!=typeof e)throw new Error("close() requires a callback argument");this.status="closing",this._close((function(n){if(n)return t.status=r,e(n);t.status="closed",e()}))},h.prototype._close=function(e){c(e)},h.prototype.get=function(e,t,r){if("function"==typeof t&&(r=t),"function"!=typeof r)throw new Error("get() requires a callback argument");var n=this._checkKey(e);if(n)return c(r,n);e=this._serializeKey(e),"object"==typeof t&&null!==t||(t={}),t.asBuffer=!1!==t.asBuffer,this._get(e,t,r)},h.prototype._get=function(e,t,r){c((function(){r(new Error("NotFound"))}))},h.prototype.put=function(e,t,r,n){if("function"==typeof r&&(n=r),"function"!=typeof n)throw new Error("put() requires a callback argument");var i=this._checkKey(e)||this._checkValue(t);if(i)return c(n,i);e=this._serializeKey(e),t=this._serializeValue(t),"object"==typeof r&&null!==r||(r={}),this._put(e,t,r,n)},h.prototype._put=function(e,t,r,n){c(n)},h.prototype.del=function(e,t,r){if("function"==typeof t&&(r=t),"function"!=typeof r)throw new Error("del() requires a callback argument");var n=this._checkKey(e);if(n)return c(r,n);e=this._serializeKey(e),"object"==typeof t&&null!==t||(t={}),this._del(e,t,r)},h.prototype._del=function(e,t,r){c(r)},h.prototype.batch=function(e,t,r){if(!arguments.length)return this._chainedBatch();if("function"==typeof t&&(r=t),"function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return c(r,new Error("batch(array) requires an array argument"));if(0===e.length)return c(r);"object"==typeof t&&null!==t||(t={});for(var i=new Array(e.length),s=0;s<e.length;s++){if("object"!=typeof e[s]||null===e[s])return c(r,new Error("batch(array) element must be an object and not `null`"));var o=n(e[s]);if("put"!==o.type&&"del"!==o.type)return c(r,new Error("`type` must be 'put' or 'del'"));var a=this._checkKey(o.key);if(a)return c(r,a);if(o.key=this._serializeKey(o.key),"put"===o.type){var u=this._checkValue(o.value);if(u)return c(r,u);o.value=this._serializeValue(o.value)}i[s]=o}this._batch(i,t,r)},h.prototype._batch=function(e,t,r){c(r)},h.prototype.clear=function(e,t){if("function"==typeof e)t=e;else if("function"!=typeof t)throw new Error("clear() requires a callback argument");(e=l(this,e)).reverse=!!e.reverse,e.limit="limit"in e?e.limit:-1,this._clear(e,t)},h.prototype._clear=function(e,t){e.keys=!0,e.values=!1,e.keyAsBuffer=!0,e.valueAsBuffer=!0;var r=this._iterator(e),n={},i=this,s=function(e){if(e)return r.end((function(){t(e)}));r.next((function(e,o){return e?s(e):void 0===o?r.end(t):void i._del(o,n,s)}))};s()},h.prototype._setupIteratorOptions=function(e){return(e=l(this,e)).reverse=!!e.reverse,e.keys=!1!==e.keys,e.values=!1!==e.values,e.limit="limit"in e?e.limit:-1,e.keyAsBuffer=!1!==e.keyAsBuffer,e.valueAsBuffer=!1!==e.valueAsBuffer,e},h.prototype.iterator=function(e){return"object"==typeof e&&null!==e||(e={}),e=this._setupIteratorOptions(e),this._iterator(e)},h.prototype._iterator=function(e){return new o(this)},h.prototype._chainedBatch=function(){return new a(this)},h.prototype._serializeKey=function(e){return e},h.prototype._serializeValue=function(e){return e},h.prototype._checkKey=function(e){return null==e?new Error("key cannot be `null` or `undefined`"):s.isBuffer(e)&&0===e.length?new Error("key cannot be an empty Buffer"):""===e?new Error("key cannot be an empty String"):Array.isArray(e)&&0===e.length?new Error("key cannot be an empty Array"):void 0},h.prototype._checkValue=function(e){if(null==e)return new Error("value cannot be `null` or `undefined`")},h.prototype._nextTick=c,e.exports=h},function(e,t,r){"use strict";e.exports=function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)n.call(r,i)&&(e[i]=r[i])}return e};var n=Object.prototype.hasOwnProperty},function(e,t,r){"use strict";(function(e){t.test=function(){return void 0!==e&&!e.browser},t.install=function(t){return function(){e.nextTick(t)}}}).call(this,r(8))},function(e,t,r){"use strict";(function(e){var r=e.MutationObserver||e.WebKitMutationObserver;t.test=function(){return r},t.install=function(t){var n=0,i=new r(t),s=e.document.createTextNode("");return i.observe(s,{characterData:!0}),function(){s.data=n=++n%2}}}).call(this,r(10))},function(e,t,r){"use strict";(function(e){t.test=function(){return!e.setImmediate&&void 0!==e.MessageChannel},t.install=function(t){var r=new e.MessageChannel;return r.port1.onmessage=t,function(){r.port2.postMessage(0)}}}).call(this,r(10))},function(e,t,r){"use strict";(function(e){t.test=function(){return"document"in e&&"onreadystatechange"in e.document.createElement("script")},t.install=function(t){return function(){var r=e.document.createElement("script");return r.onreadystatechange=function(){t(),r.onreadystatechange=null,r.parentNode.removeChild(r),r=null},e.document.documentElement.appendChild(r),t}}}).call(this,r(10))},function(e,t,r){"use strict";t.test=function(){return!0},t.install=function(e){return function(){setTimeout(e,0)}}},function(e,t,r){"use strict";var n=r(265).AbstractIterator;function i(e,t){n.call(this,e),this._options=t,this._iterator=null,this._operations=[]}r(24)(i,n),i.prototype.setDb=function(e){var t=this._iterator=e.iterator(this._options);this._operations.forEach((function(e){t[e.method].apply(t,e.args)}))},i.prototype._operation=function(e,t){if(this._iterator)return this._iterator[e].apply(this._iterator,t);this._operations.push({method:e,args:t})},"next end".split(" ").forEach((function(e){i.prototype["_"+e]=function(){this._operation(e,arguments)}})),i.prototype.seek=function(){this._operation("seek",arguments)},e.exports=i},function(e,t,r){"use strict";var n=r(24),i=r(268).Readable,s=r(64);function o(e,t){if(!(this instanceof o))return new o(e,t);t=t||{},i.call(this,s(t,{objectMode:!0})),this._iterator=e,this._options=t,this.on("end",this.destroy.bind(this,null,null))}e.exports=o,n(o,i),o.prototype._read=function(){var e=this,t=this._options;this.destroyed||this._iterator.next((function(r,n,i){if(!e.destroyed)return r?e.destroy(r):void(void 0===n&&void 0===i?e.push(null):!1!==t.keys&&!1===t.values?e.push(n):!1===t.keys&&!1!==t.values?e.push(i):e.push({key:n,value:i}))}))},o.prototype._destroy=function(e,t){this._iterator.end((function(r){t(e||r)}))}},function(e,t){},function(e,t,r){"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var o=r(0).Buffer,a=r(626).inspect,c=a&&a.custom||"inspect";e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,r,u;return t=e,(r=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,r,n,i=o.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,r=i,n=a,o.prototype.copy.call(t,r,n),a+=s.data.length,s=s.next;return i}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,s=e>i.length?i.length:e;if(s===i.length?n+=i:n+=i.slice(0,e),0==(e-=s)){s===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(s));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,s=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,s),0==(e-=s)){s===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(s));break}++n}return this.length-=n,t}},{key:c,value:function(e,t){return a(this,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),u&&s(t,u),e}()},function(e,t){},function(e,t,r){"use strict";(function(t){function r(e){try{if(!t.localStorage)return!1}catch(n){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(e,t){if(r("noDeprecation"))return e;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}}).call(this,r(10))},function(e,t,r){"use strict";var n=r(0),i=n.Buffer;function s(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(s(n,t),t.Buffer=o),s(i,o),o.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},function(e,t,r){"use strict";(function(t){var n;function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s=r(158),o=Symbol("lastResolve"),a=Symbol("lastReject"),c=Symbol("error"),u=Symbol("ended"),f=Symbol("lastPromise"),h=Symbol("handlePromise"),l=Symbol("stream");function d(e,t){return{value:e,done:t}}function p(e){var t=e[o];if(null!==t){var r=e[l].read();null!==r&&(e[f]=null,e[o]=null,e[a]=null,t(d(r,!1)))}}function b(e){t.nextTick(p,e)}var y=Object.getPrototypeOf((function(){})),m=Object.setPrototypeOf((i(n={get stream(){return this[l]},next:function(){var e=this,r=this[c];if(null!==r)return Promise.reject(r);if(this[u])return Promise.resolve(d(void 0,!0));if(this[l].destroyed)return new Promise((function(r,n){t.nextTick((function(){e[c]?n(e[c]):r(d(void 0,!0))}))}));var n,i=this[f];if(i)n=new Promise(function(e,t){return function(r,n){e.then((function(){t[u]?r(d(void 0,!0)):t[h](r,n)}),n)}}(i,this));else{var s=this[l].read();if(null!==s)return Promise.resolve(d(s,!1));n=new Promise(this[h])}return this[f]=n,n}},Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var e=this;return new Promise((function(t,r){e[l].destroy(null,(function(e){e?r(e):t(d(void 0,!0))}))}))})),n),y);e.exports=function(e){var t,r=Object.create(m,(i(t={},l,{value:e,writable:!0}),i(t,o,{value:null,writable:!0}),i(t,a,{value:null,writable:!0}),i(t,c,{value:null,writable:!0}),i(t,u,{value:e._readableState.endEmitted,writable:!0}),i(t,h,{value:function(e,t){var n=r[l].read();n?(r[f]=null,r[o]=null,r[a]=null,e(d(n,!1))):(r[o]=e,r[a]=t)},writable:!0}),t));return r[f]=null,s(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[a];return null!==t&&(r[f]=null,r[o]=null,r[a]=null,t(e)),void(r[c]=e)}var n=r[o];null!==n&&(r[f]=null,r[o]=null,r[a]=null,n(d(void 0,!0))),r[u]=!0})),e.on("readable",b.bind(null,r)),r}}).call(this,r(8))},function(e,t,r){"use strict";e.exports=function(){throw new Error("Readable.from is not available in the browser")}},function(e,t,r){"use strict";e.exports=i;var n=r(275);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}r(24)(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},function(e,t,r){"use strict";var n;var i=r(65).codes,s=i.ERR_MISSING_ARGS,o=i.ERR_STREAM_DESTROYED;function a(e){if(e)throw e}function c(e,t,i,s){s=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(s);var a=!1;e.on("close",(function(){a=!0})),void 0===n&&(n=r(158)),n(e,{readable:t,writable:i},(function(e){if(e)return s(e);a=!0,s()}));var c=!1;return function(t){if(!a&&!c)return c=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void s(t||new o("pipe"))}}function u(e){e()}function f(e,t){return e.pipe(t)}function h(e){return e.length?"function"!=typeof e[e.length-1]?a:e.pop():a}e.exports=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n,i=h(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new s("streams");var o=t.map((function(e,r){var s=r<t.length-1;return c(e,s,r>0,(function(e){n||(n=e),e&&o.forEach(u),s||(o.forEach(u),i(n))}))}));return t.reduce(f)}},function(e,t,r){"use strict";var n=r(159).WriteError,i=r(276),s=r(105).getCallback,o=r(105).getOptions;function a(e){this.db=this._levelup=e,this.batch=e.db.batch(),this.ops=[],this.length=0}a.prototype.put=function(e,t){try{this.batch.put(e,t)}catch(r){throw new n(r)}return this.ops.push({type:"put",key:e,value:t}),this.length++,this},a.prototype.del=function(e){try{this.batch.del(e)}catch(t){throw new n(t)}return this.ops.push({type:"del",key:e}),this.length++,this},a.prototype.clear=function(){try{this.batch.clear()}catch(e){throw new n(e)}return this.ops=[],this.length=0,this},a.prototype.write=function(e,t){var r,a=this._levelup,c=this.ops;(t=s(e,t))||(r=(t=i()).promise),e=o(e);try{this.batch.write(e,(function(e){if(e)return t(new n(e));a.emit("batch",c),t()}))}catch(u){throw new n(u)}return r},e.exports=a},function(e,t,r){"use strict";var n=e.exports.all=[{errno:-2,code:"ENOENT",description:"no such file or directory"},{errno:-1,code:"UNKNOWN",description:"unknown error"},{errno:0,code:"OK",description:"success"},{errno:1,code:"EOF",description:"end of file"},{errno:2,code:"EADDRINFO",description:"getaddrinfo error"},{errno:3,code:"EACCES",description:"permission denied"},{errno:4,code:"EAGAIN",description:"resource temporarily unavailable"},{errno:5,code:"EADDRINUSE",description:"address already in use"},{errno:6,code:"EADDRNOTAVAIL",description:"address not available"},{errno:7,code:"EAFNOSUPPORT",description:"address family not supported"},{errno:8,code:"EALREADY",description:"connection already in progress"},{errno:9,code:"EBADF",description:"bad file descriptor"},{errno:10,code:"EBUSY",description:"resource busy or locked"},{errno:11,code:"ECONNABORTED",description:"software caused connection abort"},{errno:12,code:"ECONNREFUSED",description:"connection refused"},{errno:13,code:"ECONNRESET",description:"connection reset by peer"},{errno:14,code:"EDESTADDRREQ",description:"destination address required"},{errno:15,code:"EFAULT",description:"bad address in system call argument"},{errno:16,code:"EHOSTUNREACH",description:"host is unreachable"},{errno:17,code:"EINTR",description:"interrupted system call"},{errno:18,code:"EINVAL",description:"invalid argument"},{errno:19,code:"EISCONN",description:"socket is already connected"},{errno:20,code:"EMFILE",description:"too many open files"},{errno:21,code:"EMSGSIZE",description:"message too long"},{errno:22,code:"ENETDOWN",description:"network is down"},{errno:23,code:"ENETUNREACH",description:"network is unreachable"},{errno:24,code:"ENFILE",description:"file table overflow"},{errno:25,code:"ENOBUFS",description:"no buffer space available"},{errno:26,code:"ENOMEM",description:"not enough memory"},{errno:27,code:"ENOTDIR",description:"not a directory"},{errno:28,code:"EISDIR",description:"illegal operation on a directory"},{errno:29,code:"ENONET",description:"machine is not on the network"},{errno:31,code:"ENOTCONN",description:"socket is not connected"},{errno:32,code:"ENOTSOCK",description:"socket operation on non-socket"},{errno:33,code:"ENOTSUP",description:"operation not supported on socket"},{errno:34,code:"ENOENT",description:"no such file or directory"},{errno:35,code:"ENOSYS",description:"function not implemented"},{errno:36,code:"EPIPE",description:"broken pipe"},{errno:37,code:"EPROTO",description:"protocol error"},{errno:38,code:"EPROTONOSUPPORT",description:"protocol not supported"},{errno:39,code:"EPROTOTYPE",description:"protocol wrong type for socket"},{errno:40,code:"ETIMEDOUT",description:"connection timed out"},{errno:41,code:"ECHARSET",description:"invalid Unicode character"},{errno:42,code:"EAIFAMNOSUPPORT",description:"address family for hostname not supported"},{errno:44,code:"EAISERVICE",description:"servname not supported for ai_socktype"},{errno:45,code:"EAISOCKTYPE",description:"ai_socktype not supported"},{errno:46,code:"ESHUTDOWN",description:"cannot send after transport endpoint shutdown"},{errno:47,code:"EEXIST",description:"file already exists"},{errno:48,code:"ESRCH",description:"no such process"},{errno:49,code:"ENAMETOOLONG",description:"name too long"},{errno:50,code:"EPERM",description:"operation not permitted"},{errno:51,code:"ELOOP",description:"too many symbolic links encountered"},{errno:52,code:"EXDEV",description:"cross-device link not permitted"},{errno:53,code:"ENOTEMPTY",description:"directory not empty"},{errno:54,code:"ENOSPC",description:"no space left on device"},{errno:55,code:"EIO",description:"i/o error"},{errno:56,code:"EROFS",description:"read-only file system"},{errno:57,code:"ENODEV",description:"no such device"},{errno:58,code:"ESPIPE",description:"invalid seek"},{errno:59,code:"ECANCELED",description:"operation canceled"}];e.exports.errno={},e.exports.code={},n.forEach((function(t){e.exports.errno[t.errno]=t,e.exports.code[t.code]=t})),e.exports.custom=r(635)(e.exports),e.exports.create=e.exports.custom.createError},function(e,t,r){"use strict";var n=r(636);function i(e,t,r){t&&"string"!=typeof t&&(t=t.message||t.name),n(this,{type:e,name:e,cause:"string"!=typeof t?t:r,message:t},"ewr")}function s(e,t){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),i.call(this,"CustomError",e,t)}s.prototype=new Error,e.exports=function(e){var t=function(t,r){return function(e,t,r){var n=function(r,s){i.call(this,t,r,s),"FilesystemError"==t&&(this.code=this.cause.code,this.path=this.cause.path,this.errno=this.cause.errno,this.message=(e.errno[this.cause.errno]?e.errno[this.cause.errno].description:this.cause.message)+(this.cause.path?" ["+this.cause.path+"]":"")),Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,n)};return n.prototype=r?new r:new s,n}(e,t,r)};return{CustomError:s,FilesystemError:t("FilesystemError"),createError:t}}},function(e,t,r){"use strict";var n;n=function(){var e="function"==typeof Object.defineProperty?function(e,t,r){return Object.defineProperty(e,t,r),e}:function(e,t,r){return e[t]=r.value,e};return function(t,r,n,i){var s;if(i=function(e,t){var r="object"==typeof t,n=!r&&"string"==typeof t,i=function(e){return r?!!t[e]:!!n&&t.indexOf(e[0])>-1};return{enumerable:i("enumerable"),configurable:i("configurable"),writable:i("writable"),value:e}}(n,i),"object"==typeof r){for(s in r)Object.hasOwnProperty.call(r,s)&&(i.value=r[s],e(t,s,i));return t}return e(t,r,i)}},e.exports?e.exports=n():(void 0).prr=n()},function(e,t,r){"use strict";(function(t){var n=r(638);function i(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0}function s(e){return t.Buffer&&"function"==typeof t.Buffer.isBuffer?t.Buffer.isBuffer(e):!(null==e||!e._isBuffer)}var o=r(264),a=Object.prototype.hasOwnProperty,c=Array.prototype.slice,u="foo"===function(){}.name;function f(e){return Object.prototype.toString.call(e)}function h(e){return!s(e)&&("function"==typeof t.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}var l=e.exports=g,d=/\s*function\s+([^\(\s]*)\s*/;function p(e){if(o.isFunction(e)){if(u)return e.name;var t=e.toString().match(d);return t&&t[1]}}function b(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function y(e){if(u||!o.isFunction(e))return o.inspect(e);var t=p(e);return"[Function"+(t?": "+t:"")+"]"}function m(e,t,r,n,i){throw new l.AssertionError({message:r,actual:e,expected:t,operator:n,stackStartFunction:i})}function g(e,t){e||m(e,!0,t,"==",l.ok)}function v(e,t,r,n){if(e===t)return!0;if(s(e)&&s(t))return 0===i(e,t);if(o.isDate(e)&&o.isDate(t))return e.getTime()===t.getTime();if(o.isRegExp(e)&&o.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(h(e)&&h(t)&&f(e)===f(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===i(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(s(e)!==s(t))return!1;var a=(n=n||{actual:[],expected:[]}).actual.indexOf(e);return-1!==a&&a===n.expected.indexOf(t)||(n.actual.push(e),n.expected.push(t),function(e,t,r,n){if(null==e||null==t)return!1;if(o.isPrimitive(e)||o.isPrimitive(t))return e===t;if(r&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=w(e),s=w(t);if(i&&!s||!i&&s)return!1;if(i)return e=c.call(e),t=c.call(t),v(e,t,r);var a,u,f=k(e),h=k(t);if(f.length!==h.length)return!1;for(f.sort(),h.sort(),u=f.length-1;u>=0;u--)if(f[u]!==h[u])return!1;for(u=f.length-1;u>=0;u--)if(a=f[u],!v(e[a],t[a],r,n))return!1;return!0}(e,t,r,n))}return r?e===t:e==t}function w(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function _(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(r){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function E(e,t,r,n){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(e){var t;try{e()}catch(r){t=r}return t}(t),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&m(i,r,"Missing expected exception"+n);var s="string"==typeof n,a=!e&&i&&!r;if((!e&&o.isError(i)&&s&&_(i,r)||a)&&m(i,r,"Got unwanted exception"+n),e&&i&&r&&!_(i,r)||!e&&i)throw i}l.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return b(y(e.actual),128)+" "+e.operator+" "+b(y(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||m;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var n=r.stack,i=p(t),s=n.indexOf("\n"+i);if(s>=0){var o=n.indexOf("\n",s+1);n=n.substring(o+1)}this.stack=n}}},o.inherits(l.AssertionError,Error),l.fail=m,l.ok=g,l.equal=function(e,t,r){e!=t&&m(e,t,r,"==",l.equal)},l.notEqual=function(e,t,r){e==t&&m(e,t,r,"!=",l.notEqual)},l.deepEqual=function(e,t,r){v(e,t,!1)||m(e,t,r,"deepEqual",l.deepEqual)},l.deepStrictEqual=function(e,t,r){v(e,t,!0)||m(e,t,r,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function(e,t,r){v(e,t,!1)&&m(e,t,r,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=function e(t,r,n){v(t,r,!0)&&m(t,r,n,"notDeepStrictEqual",e)},l.strictEqual=function(e,t,r){e!==t&&m(e,t,r,"===",l.strictEqual)},l.notStrictEqual=function(e,t,r){e===t&&m(e,t,r,"!==",l.notStrictEqual)},l.throws=function(e,t,r){E(!0,e,t,r)},l.doesNotThrow=function(e,t,r){E(!1,e,t,r)},l.ifError=function(e){if(e)throw e},l.strict=n((function e(t,r){t||m(t,!0,r,"==",e)}),l,{equal:l.strictEqual,deepEqual:l.deepStrictEqual,notEqual:l.notStrictEqual,notDeepEqual:l.notDeepStrictEqual}),l.strict.strict=l.strict;var k=Object.keys||function(e){var t=[];for(var r in e)a.call(e,r)&&t.push(r);return t}}).call(this,r(10))},function(e,t,r){"use strict";var n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function o(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(i){return!1}}()?Object.assign:function(e,t){for(var r,a,c=o(e),u=1;u<arguments.length;u++){for(var f in r=Object(arguments[u]))i.call(r,f)&&(c[f]=r[f]);if(n){a=n(r);for(var h=0;h<a.length;h++)s.call(r,a[h])&&(c[a[h]]=r[a[h]])}}return c}},function(e,t,r){"use strict";var n=r(160).AbstractLevelDOWN,i=r(160).AbstractChainedBatch,s=r(160).AbstractIterator,o=r(24),a=r(641),c=r(159).EncodingError,u=["approximateSize","compactRange"];function f(e,t){if(!(this instanceof f))return new f(e,t);var r=e.supports||{},i=r.additionalMethods||{};n.call(this,r),this.supports.encodings=!0,this.supports.additionalMethods={},u.forEach((function(t){var r="function"==typeof e[t];(i[t]||r)&&(this.supports.additionalMethods[t]=!0,this[t]=function(e,r,n,i){return e=this.codec.encodeKey(e,n),r=this.codec.encodeKey(r,n),this.db[t](e,r,n,i)})}),this),void 0===(t=t||{}).keyEncoding&&(t.keyEncoding="utf8"),void 0===t.valueEncoding&&(t.valueEncoding="utf8"),this.db=e,this.codec=new a(t)}function h(e,t){s.call(this,e),this.codec=e.codec,this.keys=t.keys,this.values=t.values,this.opts=this.codec.encodeLtgt(t),this.it=e.db.iterator(this.opts)}function l(e,t){i.call(this,e),this.codec=e.codec,this.batch=e.db.batch()}e.exports=f.default=f,o(f,n),f.prototype.type="encoding-down",f.prototype._serializeKey=f.prototype._serializeValue=function(e){return e},f.prototype._open=function(e,t){this.db.open(e,t)},f.prototype._close=function(e){this.db.close(e)},f.prototype._put=function(e,t,r,n){e=this.codec.encodeKey(e,r),t=this.codec.encodeValue(t,r),this.db.put(e,t,r,n)},f.prototype._get=function(e,t,r){var n=this;e=this.codec.encodeKey(e,t),t.asBuffer=this.codec.valueAsBuffer(t),this.db.get(e,t,(function(e,i){if(e)return r(e);try{i=n.codec.decodeValue(i,t)}catch(e){return r(new c(e))}r(null,i)}))},f.prototype._del=function(e,t,r){e=this.codec.encodeKey(e,t),this.db.del(e,t,r)},f.prototype._chainedBatch=function(){return new l(this)},f.prototype._batch=function(e,t,r){e=this.codec.encodeBatch(e,t),this.db.batch(e,t,r)},f.prototype._iterator=function(e){return e.keyAsBuffer=this.codec.keyAsBuffer(e),e.valueAsBuffer=this.codec.valueAsBuffer(e),new h(this,e)},f.prototype._clear=function(e,t){e=this.codec.encodeLtgt(e),this.db.clear(e,t)},o(h,s),h.prototype._next=function(e){var t=this;this.it.next((function(r,n,i){if(r)return e(r);try{n=t.keys&&void 0!==n?t.codec.decodeKey(n,t.opts):void 0,i=t.values&&void 0!==i?t.codec.decodeValue(i,t.opts):void 0}catch(r){return e(new c(r))}e(null,n,i)}))},h.prototype._seek=function(e){e=this.codec.encodeKey(e,this.opts),this.it.seek(e)},h.prototype._end=function(e){this.it.end(e)},o(l,i),l.prototype._put=function(e,t){e=this.codec.encodeKey(e),t=this.codec.encodeValue(t),this.batch.put(e,t)},l.prototype._del=function(e){e=this.codec.encodeKey(e),this.batch.del(e)},l.prototype._clear=function(){this.batch.clear()},l.prototype._write=function(e,t){this.batch.write(e,t)}},function(e,t,r){"use strict";var n=r(64),i=r(155),s=r(0).Buffer,o=r(277),a=r(278),c=r(161),u=Object.prototype.hasOwnProperty,f="start end gt gte lt lte".split(" ");function h(e){this.status="new",this.supports=i(e,{status:!0})}function l(e,t){var r={};for(var n in t)if(u.call(t,n)){var i=t[n];d(n)&&(i=e._serializeKey(i)),r[n]=i}return r}function d(e){return-1!==f.indexOf(e)}h.prototype.open=function(e,t){var r=this,n=this.status;if("function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("open() requires a callback argument");"object"==typeof e&&null!==e||(e={}),e.createIfMissing=!1!==e.createIfMissing,e.errorIfExists=!!e.errorIfExists,this.status="opening",this._open(e,(function(e){if(e)return r.status=n,t(e);r.status="open",t()}))},h.prototype._open=function(e,t){c(t)},h.prototype.close=function(e){var t=this,r=this.status;if("function"!=typeof e)throw new Error("close() requires a callback argument");this.status="closing",this._close((function(n){if(n)return t.status=r,e(n);t.status="closed",e()}))},h.prototype._close=function(e){c(e)},h.prototype.get=function(e,t,r){if("function"==typeof t&&(r=t),"function"!=typeof r)throw new Error("get() requires a callback argument");var n=this._checkKey(e);if(n)return c(r,n);e=this._serializeKey(e),"object"==typeof t&&null!==t||(t={}),t.asBuffer=!1!==t.asBuffer,this._get(e,t,r)},h.prototype._get=function(e,t,r){c((function(){r(new Error("NotFound"))}))},h.prototype.put=function(e,t,r,n){if("function"==typeof r&&(n=r),"function"!=typeof n)throw new Error("put() requires a callback argument");var i=this._checkKey(e)||this._checkValue(t);if(i)return c(n,i);e=this._serializeKey(e),t=this._serializeValue(t),"object"==typeof r&&null!==r||(r={}),this._put(e,t,r,n)},h.prototype._put=function(e,t,r,n){c(n)},h.prototype.del=function(e,t,r){if("function"==typeof t&&(r=t),"function"!=typeof r)throw new Error("del() requires a callback argument");var n=this._checkKey(e);if(n)return c(r,n);e=this._serializeKey(e),"object"==typeof t&&null!==t||(t={}),this._del(e,t,r)},h.prototype._del=function(e,t,r){c(r)},h.prototype.batch=function(e,t,r){if(!arguments.length)return this._chainedBatch();if("function"==typeof t&&(r=t),"function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return c(r,new Error("batch(array) requires an array argument"));if(0===e.length)return c(r);"object"==typeof t&&null!==t||(t={});for(var i=new Array(e.length),s=0;s<e.length;s++){if("object"!=typeof e[s]||null===e[s])return c(r,new Error("batch(array) element must be an object and not `null`"));var o=n(e[s]);if("put"!==o.type&&"del"!==o.type)return c(r,new Error("`type` must be 'put' or 'del'"));var a=this._checkKey(o.key);if(a)return c(r,a);if(o.key=this._serializeKey(o.key),"put"===o.type){var u=this._checkValue(o.value);if(u)return c(r,u);o.value=this._serializeValue(o.value)}i[s]=o}this._batch(i,t,r)},h.prototype._batch=function(e,t,r){c(r)},h.prototype.clear=function(e,t){if("function"==typeof e)t=e;else if("function"!=typeof t)throw new Error("clear() requires a callback argument");(e=l(this,e)).reverse=!!e.reverse,e.limit="limit"in e?e.limit:-1,this._clear(e,t)},h.prototype._clear=function(e,t){e.keys=!0,e.values=!1,e.keyAsBuffer=!0,e.valueAsBuffer=!0;var r=this._iterator(e),n={},i=this,s=function(e){if(e)return r.end((function(){t(e)}));r.next((function(e,o){return e?s(e):void 0===o?r.end(t):void i._del(o,n,s)}))};s()},h.prototype._setupIteratorOptions=function(e){return(e=l(this,e)).reverse=!!e.reverse,e.keys=!1!==e.keys,e.values=!1!==e.values,e.limit="limit"in e?e.limit:-1,e.keyAsBuffer=!1!==e.keyAsBuffer,e.valueAsBuffer=!1!==e.valueAsBuffer,e},h.prototype.iterator=function(e){return"object"==typeof e&&null!==e||(e={}),e=this._setupIteratorOptions(e),this._iterator(e)},h.prototype._iterator=function(e){return new o(this)},h.prototype._chainedBatch=function(){return new a(this)},h.prototype._serializeKey=function(e){return e},h.prototype._serializeValue=function(e){return e},h.prototype._checkKey=function(e){return null==e?new Error("key cannot be `null` or `undefined`"):s.isBuffer(e)&&0===e.length?new Error("key cannot be an empty Buffer"):""===e?new Error("key cannot be an empty String"):Array.isArray(e)&&0===e.length?new Error("key cannot be an empty Array"):void 0},h.prototype._checkValue=function(e){if(null==e)return new Error("value cannot be `null` or `undefined`")},h.prototype._nextTick=c,e.exports=h},function(e,t,r){"use strict";var n=r(642);function i(e){if(!(this instanceof i))return new i(e);this.opts=e||{},this.encodings=n}e.exports=i,i.prototype._encoding=function(e){return"string"==typeof e&&(e=n[e]),e||(e=n.id),e},i.prototype._keyEncoding=function(e,t){return this._encoding(t&&t.keyEncoding||e&&e.keyEncoding||this.opts.keyEncoding)},i.prototype._valueEncoding=function(e,t){return this._encoding(t&&(t.valueEncoding||t.encoding)||e&&(e.valueEncoding||e.encoding)||this.opts.valueEncoding||this.opts.encoding)},i.prototype.encodeKey=function(e,t,r){return this._keyEncoding(t,r).encode(e)},i.prototype.encodeValue=function(e,t,r){return this._valueEncoding(t,r).encode(e)},i.prototype.decodeKey=function(e,t){return this._keyEncoding(t).decode(e)},i.prototype.decodeValue=function(e,t){return this._valueEncoding(t).decode(e)},i.prototype.encodeBatch=function(e,t){var r=this;return e.map((function(e){var n={type:e.type,key:r.encodeKey(e.key,t,e)};return r.keyAsBuffer(t,e)&&(n.keyEncoding="binary"),e.prefix&&(n.prefix=e.prefix),"value"in e&&(n.value=r.encodeValue(e.value,t,e),r.valueAsBuffer(t,e)&&(n.valueEncoding="binary")),n}))};var s=["lt","gt","lte","gte","start","end"];i.prototype.encodeLtgt=function(e){var t=this,r={};return Object.keys(e).forEach((function(n){r[n]=s.indexOf(n)>-1?t.encodeKey(e[n],e):e[n]})),r},i.prototype.createStreamDecoder=function(e){var t=this;return e.keys&&e.values?function(r,n){return{key:t.decodeKey(r,e),value:t.decodeValue(n,e)}}:e.keys?function(r){return t.decodeKey(r,e)}:e.values?function(r,n){return t.decodeValue(n,e)}:function(){}},i.prototype.keyAsBuffer=function(e){return this._keyEncoding(e).buffer},i.prototype.valueAsBuffer=function(e){return this._valueEncoding(e).buffer}},function(e,t,r){"use strict";var n=r(0).Buffer;t.utf8=t["utf-8"]={encode:function(e){return s(e)?e:String(e)},decode:i,buffer:!1,type:"utf8"},t.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},t.binary={encode:function(e){return s(e)?e:n.from(e)},decode:i,buffer:!0,type:"binary"},t.none={encode:i,decode:i,buffer:!1,type:"id"},t.id=t.none;function i(e){return e}function s(e){return null==e||n.isBuffer(e)}["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"].forEach((function(e){t[e]={encode:function(t){return s(t)?t:n.from(t,e)},decode:function(t){return t.toString(e)},buffer:!0,type:e}}))},function(e,t,r){"use strict";(function(t){e.exports=u;var n=r(279).AbstractLevelDOWN,i=r(24),s=r(645),o=r(282),a=r(283),c=r(648);function u(e,t){if(!(this instanceof u))return new u(e,t);if(n.call(this),t=t||{},"string"!=typeof e)throw new Error("constructor requires a location string argument");this.location=e,this.prefix=null==t.prefix?"level-js-":t.prefix,this.version=parseInt(t.version||1,10)}i(u,n),u.binaryKeys=c.binaryKeys(indexedDB),u.arrayKeys=c.arrayKeys(indexedDB),u.prototype._open=function(e,t){var r=indexedDB.open(this.prefix+this.location,this.version),n=this;r.onerror=function(){t(r.error||new Error("unknown error"))},r.onsuccess=function(){n.db=r.result,t()},r.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains(n.location)||t.createObjectStore(n.location)}},u.prototype.store=function(e){return this.db.transaction([this.location],e).objectStore(this.location)},u.prototype.await=function(e,t){var r=e.transaction;r.onabort=function(){t(r.error||new Error("aborted by user"))},r.oncomplete=function(){t(null,e.result)}},u.prototype._get=function(e,t,r){var n=this.store("readonly");try{var i=n.get(e)}catch(s){return a((function(){r(s)}))}this.await(i,(function(e,n){return e?r(e):void 0===n?r(new Error("NotFound")):(t.asBuffer&&(n=o(n)),void r(null,n))}))},u.prototype._del=function(e,t,r){var n=this.store("readwrite");try{var i=n.delete(e)}catch(s){return a((function(){r(s)}))}this.await(i,r)},u.prototype._put=function(e,t,r,n){var i=this.store("readwrite");try{var s=i.put(t,e)}catch(o){return a((function(){n(o)}))}this.await(s,n)},u.prototype._serializeKey=function(e){return t.isBuffer(e)?u.binaryKeys?e:e.toString():Array.isArray(e)?u.arrayKeys?e.map(this._serializeKey,this):String(e):e},u.prototype._serializeValue=function(e){return e},u.prototype._iterator=function(e){return new s(this,this.location,e)},u.prototype._batch=function(e,t,r){if(0===e.length)return a(r);var n,i=this.store("readwrite"),s=i.transaction,o=0;s.onabort=function(){r(n||s.error||new Error("aborted by user"))},s.oncomplete=function(){r()},function t(){var r=e[o++],a=r.key;try{var c="del"===r.type?i.delete(a):i.put(r.value,a)}catch(u){return n=u,void s.abort()}o<e.length&&(c.onsuccess=t)}()},u.prototype._close=function(e){this.db.close(),a(e)},u.destroy=function(e,t,r){"function"==typeof t&&(r=t,t="level-js-");var n=indexedDB.deleteDatabase(t+e);n.onsuccess=function(){r()},n.onerror=function(e){r(e)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t,n){var i=r(64),s=r(280),o=r(281),a=Object.prototype.hasOwnProperty,c="start end gt gte lt lte".split(" ");function u(){this.status="new"}function f(e){return-1!==c.indexOf(e)}u.prototype.open=function(e,t){var r=this,n=this.status;if("function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("open() requires a callback argument");"object"==typeof e&&null!==e||(e={}),e.createIfMissing=!1!==e.createIfMissing,e.errorIfExists=!!e.errorIfExists,this.status="opening",this._open(e,(function(e){if(e)return r.status=n,t(e);r.status="open",t()}))},u.prototype._open=function(e,r){t.nextTick(r)},u.prototype.close=function(e){var t=this,r=this.status;if("function"!=typeof e)throw new Error("close() requires a callback argument");this.status="closing",this._close((function(n){if(n)return t.status=r,e(n);t.status="closed",e()}))},u.prototype._close=function(e){t.nextTick(e)},u.prototype.get=function(e,r,n){if("function"==typeof r&&(n=r),"function"!=typeof n)throw new Error("get() requires a callback argument");var i=this._checkKey(e);if(i)return t.nextTick(n,i);e=this._serializeKey(e),"object"==typeof r&&null!==r||(r={}),r.asBuffer=!1!==r.asBuffer,this._get(e,r,n)},u.prototype._get=function(e,r,n){t.nextTick((function(){n(new Error("NotFound"))}))},u.prototype.put=function(e,r,n,i){if("function"==typeof n&&(i=n),"function"!=typeof i)throw new Error("put() requires a callback argument");var s=this._checkKey(e)||this._checkValue(r);if(s)return t.nextTick(i,s);e=this._serializeKey(e),r=this._serializeValue(r),"object"==typeof n&&null!==n||(n={}),this._put(e,r,n,i)},u.prototype._put=function(e,r,n,i){t.nextTick(i)},u.prototype.del=function(e,r,n){if("function"==typeof r&&(n=r),"function"!=typeof n)throw new Error("del() requires a callback argument");var i=this._checkKey(e);if(i)return t.nextTick(n,i);e=this._serializeKey(e),"object"==typeof r&&null!==r||(r={}),this._del(e,r,n)},u.prototype._del=function(e,r,n){t.nextTick(n)},u.prototype.batch=function(e,r,n){if(!arguments.length)return this._chainedBatch();if("function"==typeof r&&(n=r),"function"==typeof e&&(n=e),"function"!=typeof n)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return t.nextTick(n,new Error("batch(array) requires an array argument"));if(0===e.length)return t.nextTick(n);"object"==typeof r&&null!==r||(r={});for(var s=new Array(e.length),o=0;o<e.length;o++){if("object"!=typeof e[o]||null===e[o])return t.nextTick(n,new Error("batch(array) element must be an object and not `null`"));var a=i(e[o]);if("put"!==a.type&&"del"!==a.type)return t.nextTick(n,new Error("`type` must be 'put' or 'del'"));var c=this._checkKey(a.key);if(c)return t.nextTick(n,c);if(a.key=this._serializeKey(a.key),"put"===a.type){var u=this._checkValue(a.value);if(u)return t.nextTick(n,u);a.value=this._serializeValue(a.value)}s[o]=a}this._batch(s,r,n)},u.prototype._batch=function(e,r,n){t.nextTick(n)},u.prototype._setupIteratorOptions=function(e){return(e=function(e,t){var r={};for(var n in t)if(a.call(t,n)){var i=t[n];f(n)&&(i=e._serializeKey(i)),r[n]=i}return r}(this,e)).reverse=!!e.reverse,e.keys=!1!==e.keys,e.values=!1!==e.values,e.limit="limit"in e?e.limit:-1,e.keyAsBuffer=!1!==e.keyAsBuffer,e.valueAsBuffer=!1!==e.valueAsBuffer,e},u.prototype.iterator=function(e){return"object"==typeof e&&null!==e||(e={}),e=this._setupIteratorOptions(e),this._iterator(e)},u.prototype._iterator=function(e){return new s(this)},u.prototype._chainedBatch=function(){return new o(this)},u.prototype._serializeKey=function(e){return e},u.prototype._serializeValue=function(e){return e},u.prototype._checkKey=function(e){return null==e?new Error("key cannot be `null` or `undefined`"):n.isBuffer(e)&&0===e.length?new Error("key cannot be an empty Buffer"):""===e?new Error("key cannot be an empty String"):Array.isArray(e)&&0===e.length?new Error("key cannot be an empty Array"):void 0},u.prototype._checkValue=function(e){if(null==e)return new Error("value cannot be `null` or `undefined`")},e.exports=u}).call(this,r(8),r(0).Buffer)},function(e,t,r){"use strict";var n=r(24),i=r(279).AbstractIterator,s=r(646),o=r(282),a=r(283),c=function(){};function u(e,t,r){if(i.call(this,e),this._limit=r.limit,this._count=0,this._callback=null,this._cache=[],this._completed=!1,this._aborted=!1,this._error=null,this._transaction=null,this._keyAsBuffer=r.keyAsBuffer,this._valueAsBuffer=r.valueAsBuffer,0!==this._limit){try{var n=this.createKeyRange(r)}catch(s){return void(this._completed=!0)}this.createIterator(t,n,r.reverse)}else this._completed=!0}e.exports=u,n(u,i),u.prototype.createKeyRange=function(e){var t=s.lowerBound(e),r=s.upperBound(e),n=s.lowerBoundExclusive(e),i=s.upperBoundExclusive(e);return void 0!==t&&void 0!==r?IDBKeyRange.bound(t,r,n,i):void 0!==t?IDBKeyRange.lowerBound(t,n):void 0!==r?IDBKeyRange.upperBound(r,i):null},u.prototype.createIterator=function(e,t,r){var n=this,i=this.db.db.transaction([e],"readonly");i.objectStore(e).openCursor(t,r?"prev":"next").onsuccess=function(e){var t=e.target.result;t&&n.onItem(t)},this._transaction=i,i.onabort=function(){n.onAbort(n._transaction.error||new Error("aborted by user"))},i.oncomplete=function(){n.onComplete()}},u.prototype.onItem=function(e){this._cache.push(e.key,e.value),(this._limit<=0||++this._count<this._limit)&&e.continue(),this.maybeNext()},u.prototype.onAbort=function(e){this._aborted=!0,this._error=e,this.maybeNext()},u.prototype.onComplete=function(){this._completed=!0,this.maybeNext()},u.prototype.maybeNext=function(){this._callback&&(this._next(this._callback),this._callback=null)},u.prototype._next=function(e){if(this._aborted){var t=this._error;this._error=null,a((function(){e(t)}))}else if(this._cache.length>0){var r=this._cache.shift(),n=this._cache.shift();this._keyAsBuffer&&(r=o(r)),this._valueAsBuffer&&(n=o(n)),a((function(){e(null,r,n)}))}else this._completed?a(e):this._callback=e},u.prototype._end=function(e){if(this._aborted||this._completed){var t=this._error;a((function(){e(t)}))}else this.onItem=c,this.onAbort=e,this.onComplete=e}},function(e,t,r){"use strict";(function(e){function r(e){return void 0!==e&&""!==e}function n(e,t){return Object.hasOwnProperty.call(e,t)}function i(e,t){return Object.hasOwnProperty.call(e,t)&&t}t.compare=function(t,r){if(e.isBuffer(t)){for(var n=Math.min(t.length,r.length),i=0;i<n;i++){var s=t[i]-r[i];if(s)return s}return t.length-r.length}return t<r?-1:t>r?1:0};var s=t.lowerBoundKey=function(e){return i(e,"gt")||i(e,"gte")||i(e,"min")||(e.reverse?i(e,"end"):i(e,"start"))||void 0},o=t.lowerBound=function(e,t){var r=s(e);return r?e[r]:t},a=t.lowerBoundInclusive=function(e){return!n(e,"gt")},c=t.upperBoundInclusive=function(e){return!n(e,"lt")},u=t.lowerBoundExclusive=function(e){return!a(e)},f=t.upperBoundExclusive=function(e){return!c(e)},h=t.upperBoundKey=function(e){return i(e,"lt")||i(e,"lte")||i(e,"max")||(e.reverse?i(e,"start"):i(e,"end"))||void 0},l=t.upperBound=function(e,t){var r=h(e);return r?e[r]:t};function d(e){return e}t.start=function(e,t){return e.reverse?l(e,t):o(e,t)},t.end=function(e,t){return e.reverse?o(e,t):l(e,t)},t.startInclusive=function(e){return e.reverse?c(e):a(e)},t.endInclusive=function(e){return e.reverse?a(e):c(e)},t.toLtgt=function(e,r,i,s,o){r=r||{},i=i||d;var a=arguments.length>3,c=t.lowerBoundKey(e),u=t.upperBoundKey(e);return c?"gt"===c?r.gt=i(e.gt,!1):r.gte=i(e[c],!1):a&&(r.gte=i(s,!1)),u?"lt"===u?r.lt=i(e.lt,!0):r.lte=i(e[u],!0):a&&(r.lte=i(o,!0)),null!=e.reverse&&(r.reverse=!!e.reverse),n(r,"max")&&delete r.max,n(r,"min")&&delete r.min,n(r,"start")&&delete r.start,n(r,"end")&&delete r.end,r},t.contains=function(e,n,i){i=i||t.compare;var s=o(e);if(r(s)&&((a=i(n,s))<0||0===a&&u(e)))return!1;var a,c=l(e);if(r(c)&&((a=i(n,c))>0||0===a&&f(e)))return!1;return!0},t.filter=function(e,r){return function(n){return t.contains(e,n,r)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(212).strict;e.exports=function(e){if(n(e)){var r=t.from(e.buffer);return e.byteLength!==e.buffer.byteLength&&(r=r.slice(e.byteOffset,e.byteOffset+e.byteLength)),r}return t.from(e)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";t.test=function(e){return function(t){try{return t.cmp(e,0),!0}catch(r){return!1}}},t.binaryKeys=t.test(new Uint8Array(0)),t.arrayKeys=t.test([1])},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(650),{MissingRepoOptionsError:s,NotInitializedRepoError:o}=r(162),{VERSION_KEY:a,getDatastoreAndOptions:c}=r(154);t.getVersion=async function(e,t){if(!await i.isRepoInitialized(e,t))throw new o("Repo in path ".concat(e," is not initialized!"));if(!t)throw new s("Please pass repo options when trying to open a repo");const{StorageBackend:r,storageOptions:n}=c(t,"root"),u=new r(e,n);await u.open();const f=parseInt(await u.get(a));return await u.close(),f},t.setVersion=async function(e,t,r){if(!r)throw new s("Please pass repo options when trying to open a repo");const{StorageBackend:i,storageOptions:o}=c(r,"root"),u=new i(e,o);await u.open(),await u.put(a,n.from(String(t))),await u.close()}},function(e,t,r){"use strict";const n=r(2)("repo-migrations:repo:init"),{CONFIG_KEY:i,VERSION_KEY:s,getDatastoreAndOptions:o}=r(154),{MissingRepoOptionsError:a}=r(162);t.isRepoInitialized=async function(e,t){if(!t)throw new a("Please pass repo options when trying to open a repo");let r;try{const{StorageBackend:a,storageOptions:c}=o(t,"root");r=new a(e,c),await r.open();const u=await r.has(s),f=await r.has(i);return!(!u||!f)||(n("Version entry present: ".concat(u)),n("Config entry present: ".concat(f)),!1)}catch(c){return n("While checking if repo is initialized error was thrown: "+c.message),!1}finally{void 0!==r&&await r.close()}}},function(e,t,r){"use strict";const n=r(2)("repo-migrations:repo_mem_lock"),i={};t.lock=async function(e,t){const r=t+"/repo.lock";if(n("locking %s",r),!0===i[r])throw Error("There is already present lock for: ".concat(r));return i[r]=!0,{close(){i[r]&&(n("releasing lock %s",r),delete i[r])}}}},function(e,t,r){"use strict";e.exports=function(e,t){if("string"==typeof e)return c(e);if("number"==typeof e)return a(e,t);return null},e.exports.format=a,e.exports.parse=c;var n=/\B(?=(\d{3})+(?!\d))/g,i=/(?:\.0*|(\.[^0]+)0+)$/,s={b:1,kb:1024,mb:1<<20,gb:1<<30,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},o=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function a(e,t){if(!Number.isFinite(e))return null;var r=Math.abs(e),o=t&&t.thousandsSeparator||"",a=t&&t.unitSeparator||"",c=t&&void 0!==t.decimalPlaces?t.decimalPlaces:2,u=Boolean(t&&t.fixedDecimals),f=t&&t.unit||"";f&&s[f.toLowerCase()]||(f=r>=s.pb?"PB":r>=s.tb?"TB":r>=s.gb?"GB":r>=s.mb?"MB":r>=s.kb?"KB":"B");var h=(e/s[f.toLowerCase()]).toFixed(c);return u||(h=h.replace(i,"$1")),o&&(h=h.replace(n,o)),h+a+f}function c(e){if("number"==typeof e&&!isNaN(e))return e;if("string"!=typeof e)return null;var t,r=o.exec(e),n="b";return r?(t=parseFloat(r[1]),n=r[4].toLowerCase()):(t=parseInt(e,10),n="b"),Math.floor(s[n]*t)}},function(e,t,r){"use strict";e.exports=function(...e){return 0===e.length?".":e.join("/")}},function(e,t,r){"use strict";e.exports={repoVersion:8}},function(e,t,r){"use strict";t.create=function(e,t,r){return new(0,r.storageBackends[e])(t,Object.assign({},r.storageBackendOptions[e]||{}))}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(7).Key,s=r(2)("ipfs:repo:version"),o=new i("version");e.exports=e=>({exists:async()=>e.has(o),async get(){const t=await e.get(o);return parseInt(t.toString().trim(),10)},set:async t=>e.put(o,n.from(String(t))),async check(e){const t=await this.get();s("comparing version: %s and %s",t,e);return t===e||(6===t&&7===e||6===e&&7===t)}})},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(7).Key,{default:s}=r(51),o=r(262),a=r(658),c=r(1),u=r(163),f=new i("config");e.exports=e=>{const t=new s({concurrency:1}),r={getAll:async(e={})=>r.get(void 0,e),async get(t,r={}){t||(t=void 0);const n=await e.get(f);if(r.signal&&r.signal.aborted)return;const i=JSON.parse(n.toString());if(void 0!==t&&void 0===o(i,t))throw new u.NotFoundError("Key ".concat(t," does not exist in config"));return void 0!==t?o(i,t):i},async set(e,r,s={}){if(1===arguments.length)r=e,e=void 0;else if(!e||"string"!=typeof e)throw c(new Error("Invalid key type: "+typeof e),"ERR_INVALID_KEY");if(void 0===r||n.isBuffer(r))throw c(new Error("Invalid value type: "+typeof r),"ERR_INVALID_VALUE");return t.add(()=>i({key:e,value:r},s.signal))},async replace(e,r={}){if(!e||n.isBuffer(e))throw c(new Error("Invalid value type: "+typeof e),"ERR_INVALID_VALUE");return t.add(()=>i({key:void 0,value:e},r.signal))},exists:async()=>e.has(f)};return r;async function i(e,t){if(t&&t.aborted)return;const n=e.key,i=e.value;if(n){const e=await r.get();return a(e,n,i),h(e)}return h(i)}function h(t){const r=n.from(JSON.stringify(t,null,2));return e.put(f,r)}}},function(e,t,r){"use strict";e.exports=function(e,t,r){"string"==typeof t&&(t=t.split("."));"symbol"==typeof t&&(t=[t]);var n,i=t.pop();if(!i)return!1;for(;n=t.shift();)if(void 0===e[n]&&(e[n]={}),!(e=e[n])||"object"!=typeof e)return!1;return e[i]=r,!0}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(7).Key,s=r(660),o=new i("datastore_spec");e.exports=e=>({exists:async()=>e.has(o),async get(){const t=await e.get(o);return JSON.parse(t.toString())},set:async t=>e.put(o,n.from(JSON.stringify(s(t,{deep:!0}))))})},function(e,t,r){"use strict";const n=r(661);e.exports=(e,t={})=>{if(!n(e))throw new TypeError("Expected a plain object");const{deep:r}=t,i=[],s=[],o=e=>{const t=i.indexOf(e);if(-1!==t)return s[t];const r=[];return i.push(e),s.push(r),r.push(...e.map(e=>Array.isArray(e)?o(e):n(e)?a(e):e)),r},a=e=>{const c=i.indexOf(e);if(-1!==c)return s[c];const u={},f=Object.keys(e).sort(t.compare);i.push(e),s.push(u);for(const t of f){const i=e[t];r&&Array.isArray(i)?u[t]=o(i):u[t]=r&&n(i)?a(i):i}return u};return a(e)}},function(e,t,r){"use strict";e.exports=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=new(0,r(7).Key)("api");e.exports=e=>({async get(){const t=await e.get(i);return t&&t.toString()},set:async t=>e.put(i,n.from(t.toString())),delete:async()=>e.delete(i)})},function(e,t,r){"use strict";(function(t,n){const i=r(153),s=i.ShardingDatastore,o=r(76),{cidToKey:a,keyToCid:c}=r(284),u=r(664),f=r(238),h=r(79);e.exports=async(e,r)=>function(e){return{async*query(t,r){for await(const{key:n,value:i}of e.query(t,r))t.keysOnly?yield c(n):yield new o(i,c(n))},async get(t,r){const n=a(t),i=await e.get(n,r);return new o(i,t)},async*getMany(e,t){for await(const r of e)yield this.get(r,t)},async put(t,r){if(!o.isBlock(t))throw new Error("invalid block");const n=a(t.cid);return await e.has(n,r)||await e.put(n,t.data,r),t},async*putMany(r,i){const s=h();(t&&t.nextTick?t.nextTick:n)(async()=>{try{await f(e.putMany(async function*(){for await(const t of r){const r=a(t.cid);await e.has(r,i)||(yield{key:r,value:t.data}),s.push(t)}}())),s.end()}catch(t){s.end(t)}}),yield*s},has:async(t,r)=>e.has(a(t),r),delete:async(t,r)=>e.delete(a(t),r),async*deleteMany(t,r){yield*e.deleteMany(u(t,e=>a(e)),r)},close:async()=>e.close()}}(await function(e,t){if(t.sharding){const t=new i.shard.NextToLast(2);return s.createOrOpen(e,t)}return e}(e,r))}).call(this,r(8),r(89).setImmediate)},function(e,t,r){"use strict";e.exports=async function*(e,t){for await(const r of e)yield t(r)}},function(e,t,r){"use strict";e.exports=class{constructor(e){if(!(e>0)||0!=(e-1&e))throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){const e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return void 0===this.buffer[this.btm]}}},function(e,t,r){"use strict";e.exports={lock:"memory",storageBackends:{root:r(78),blocks:r(78),keys:r(78),datastore:r(78)},storageBackendOptions:{root:{extension:"",prefix:"",version:2},blocks:{sharding:!1,prefix:"",version:2},keys:{sharding:!1,prefix:"",version:2},datastore:{sharding:!1,prefix:"",version:2}}}},function(e,t,r){"use strict";e.exports={Spec:{type:"mount",mounts:[{mountpoint:"/blocks",type:"measure",prefix:"flatfs.datastore",child:{type:"flatfs",path:"blocks",sync:!0,shardFunc:"/repo/flatfs/shard/v1/next-to-last/2"}},{mountpoint:"/",type:"measure",prefix:"leveldb.datastore",child:{type:"levelds",path:"datastore",compression:"none"}}]}}},function(e,t,r){"use strict";const{map:n}=r(669),i=r(1);e.exports=class{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){return this.hasExchange()?this._bitswap.put(e,t):this._repo.blocks.put(e,t)}putMany(e,t){return this.hasExchange()?this._bitswap.putMany(e,t):this._repo.blocks.putMany(e,t)}get(e,t){return this.hasExchange()?this._bitswap.get(e,t):this._repo.blocks.get(e,t)}getMany(e,t){if(!Array.isArray(e))throw new Error("first arg must be an array of cids");if(this.hasExchange())return this._bitswap.getMany(e,t);return n(e=>this._repo.blocks.get(e,t))(e)}async delete(e,t){if(!await this._repo.blocks.has(e))throw i(new Error("blockstore: block not found"),"ERR_BLOCK_NOT_FOUND");return this._repo.blocks.delete(e,t)}deleteMany(e,t){const r=this._repo;return this._repo.blocks.deleteMany(async function*(){for await(const t of e){if(!await r.blocks.has(t))throw i(new Error("blockstore: block not found"),"ERR_BLOCK_NOT_FOUND");yield t}}(),t)}}},function(e,t,r){"use strict";(function(e){function r(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function n(e){return this instanceof n?(this.v=e,this):new n(e)}function i(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,s=r.apply(e,t||[]),o=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(e){s[e]&&(i[e]=function(t){return new Promise((function(r,n){o.push([e,t,r,n])>1||c(e,t)}))})}function c(e,t){try{(r=s[e](t)).value instanceof n?Promise.resolve(r.value.v).then(u,f):h(o[0][2],r)}catch(i){h(o[0][3],i)}var r}function u(e){c("next",e)}function f(e){c("throw",e)}function h(e,t){e(t),o.shift(),o.length&&c(o[0][0],o[0][1])}}function s(e){var t,r;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,s){t[i]=e[i]?function(t){return(r=!r)?{value:n(e[i](t)),done:"return"===i}:s?s(t):t}:s}}function o(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=r(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise((function(n,i){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,i,(t=e[r](t)).done,t.value)}))}}}function a(e){if("function"==typeof e.next)return e;if("function"==typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"==typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();throw new TypeError('"values" does not to conform to any of the iterator or iterable protocols')}function c(){let e,t;return{promise:new Promise((r,n)=>{t=r,e=n}),reject:e,resolve:t}}function u(e,t){const r=a(t),n=[],i=[];let s=!1,o=!1;async function u(){if(!o&&!(s||n.length>=e)){s=!0;try{const{done:e,value:t}=await r.next();e?o=!0:n.push({value:t})}catch(t){o=!0,n.push({error:t})}!function(){for(;i.length>0&&n.length>0;){const e=i.shift(),{error:t,value:r}=n.shift();t?e.reject(t):e.resolve({done:!1,value:r})}for(;i.length>0&&o;){const{resolve:e}=i.shift();e({done:!0,value:void 0})}}(),s=!1,u()}}const f={next:async function(){if(n.length>0){const{error:e,value:t}=n.shift();if(e)throw e;return u(),{done:!1,value:t}}if(o)return{done:!0,value:void 0};const e=c();return i.push(e),u(),e.promise},[Symbol.asyncIterator]:()=>f};return f}function f(e,t){return void 0===t?t=>f(e,t):t[Symbol.asyncIterator]?u(e,t):function*(e,t){const r=[];let n;try{for(const n of t)r.push(n),r.length<=e||(yield r.shift())}catch(i){n=i}for(const s of r)yield s;if(n)throw n}(e,t)}function h(e,t){return i(this,arguments,(function*(){var r,i;try{for(var s,a=o(t);!(s=yield n(a.next())).done;){const t=s.value;(yield n(e(t)))&&(yield yield n(t))}}catch(c){r={error:c}}finally{try{s&&!s.done&&(i=a.return)&&(yield n(i.call(a)))}finally{if(r)throw r.error}}}))}function l(e,t){return void 0===t?t=>h(e,t):h(e,t)}function d(e){return i(this,arguments,(function*(){var t,r;try{for(var i,a=o(e);!(i=yield n(a.next())).done;){const e=i.value;e&&"string"!=typeof e&&(e[Symbol.iterator]||e[Symbol.asyncIterator])?yield n(yield*s(o(d(e)))):yield yield n(e)}}catch(c){t={error:c}}finally{try{i&&!i.done&&(r=a.return)&&(yield n(r.call(a)))}finally{if(t)throw t.error}}}))}function p(e,t){return i(this,arguments,(function*(){var r,i;try{for(var s,a=o(t);!(s=yield n(a.next())).done;){const t=s.value;yield yield n(yield n(e(t)))}}catch(c){r={error:c}}finally{try{s&&!s.done&&(i=a.return)&&(yield n(i.call(a)))}finally{if(r)throw r.error}}}))}function b(e,t){return void 0===t?t=>p(e,t):p(e,t)}async function y(e){return new Promise(t=>{e.once("readable",()=>{t()})})}function m(e,...t){let r=e();for(const n of t)r=n(r);return r}function g(e,t,r){return void 0===t?(t,r)=>g(e,t,r):void 0===r?r=>g(e,t,r):function(e,t,r){return i(this,arguments,(function*(){let s=null;const c=a(m(()=>r,f(1),(function(e){return i(this,arguments,(function*(){var t,r;try{for(var i,a=o(e);!(i=yield n(a.next())).done;){const e=i.value;if(s)return yield n(void 0);yield yield n(e)}}catch(c){t={error:c}}finally{try{i&&!i.done&&(r=a.return)&&(yield n(r.call(a)))}finally{if(t)throw t.error}}}))}),b(e=>({value:t(e)})),f(e)));for(;;){const{value:e,done:t}=yield n(c.next());if(t)break;try{const t=yield n(e.value);s||(yield yield n(t))}catch(u){s=u}}if(s)throw s}))}(e,t,r)}function v(e,t){return i(this,arguments,(function*(){var r,i;try{for(var s,a=o(t);!(s=yield n(a.next())).done;){const t=s.value;yield n(e(t)),yield yield n(t)}}catch(c){r={error:c}}finally{try{s&&!s.done&&(i=a.return)&&(yield n(i.call(a)))}finally{if(r)throw r.error}}}))}function w(e,t){let r=e[0]+t[0],n=e[1]+t[1];if(n>=1e9){const e=n%1e9;r+=(n-e)/1e9,n=e}return[r,n]}async function _(e,t){var r,n;let i=null,s=null,a=null;const c=e=>{i=e,s&&s(e)},u=()=>{a&&a()};e.once("error",c);try{for(var f,h=o(t);!(f=await h.next()).done;){const t=f.value;if(!1===e.write(t)&&await new Promise((t,r)=>{if(i)return r(i);e.once("drain",u),a=t,s=r}),i)break}}catch(l){r={error:l}}finally{try{f&&!f.done&&(n=h.return)&&await n.call(h)}finally{if(r)throw r.error}}if(e.removeListener("error",c),e.removeListener("drain",u),i)throw i}Object.defineProperty(t,"__esModule",{value:!0}),t.batch=function e(t,r){if(void 0===r)return r=>e(t,r);if(r[Symbol.asyncIterator])return function(e,t){return i(this,arguments,(function*(){var r,i;let s=[];try{for(var a,c=o(t);!(a=yield n(c.next())).done;){const t=a.value;s.push(t),s.length===e&&(yield yield n(s),s=[])}}catch(u){r={error:u}}finally{try{a&&!a.done&&(i=c.return)&&(yield n(i.call(c)))}finally{if(r)throw r.error}}s.length>0&&(yield yield n(s))}))}(t,r);return function*(e,t){let r=[];for(const n of t)r.push(n),r.length===e&&(yield r,r=[]);r.length>0&&(yield r)}(t,r)},t.buffer=f,t.collect=function(e){if(e[Symbol.asyncIterator])return async function(e){var t,r;const n=[];try{for(var i,s=o(e);!(i=await s.next()).done;){const e=i.value;n.push(e)}}catch(a){t={error:a}}finally{try{i&&!i.done&&(r=s.return)&&await r.call(s)}finally{if(t)throw t.error}}return n}(e);return Array.from(e)},t.concat=function(...e){return e.find(e=>void 0!==e[Symbol.asyncIterator])?function(e){return i(this,arguments,(function*(){var t,r;try{for(var i,a=o(e);!(i=yield n(a.next())).done;){const e=i.value;yield n(yield*s(o(e)))}}catch(c){t={error:c}}finally{try{i&&!i.done&&(r=a.return)&&(yield n(r.call(a)))}finally{if(t)throw t.error}}}))}(e):function*(e){for(const t of e)yield*t}(e)},t.consume=function(e){if(e[Symbol.asyncIterator])return async function(e){var t,r;try{for(var n,i=o(e);!(n=await i.next()).done;){n.value}}catch(s){t={error:s}}finally{try{n&&!n.done&&(r=i.return)&&await r.call(i)}finally{if(t)throw t.error}}}(e)},t.filter=l,t.flatMap=function e(t,r){if(void 0===r)return r=>e(t,r);return l(e=>null!=e,d(b(t,r)))},t.flatten=d,t.flatTransform=function e(t,r,n){if(void 0===r)return(r,n)=>n?e(t,r,n):e(t,r);if(void 0===n)return n=>e(t,r,n);return l(e=>null!=e,d(function(e,t,r){const n=a(r),i=[],s=[];let u=!1,f=!1,h=0,l=null;function d(){for(;s.length>0&&i.length>0;){const{resolve:e}=s.shift();e({done:!1,value:i.shift()})}for(;s.length>0&&0===h&&u;){const{resolve:e,reject:t}=s.shift();l?(t(l),l=null):e({done:!0,value:void 0})}}async function p(){if(u)d();else if(!(f||h+i.length>=e)){f=!0,h++;try{const{done:e,value:r}=await n.next();e?(u=!0,h--,d()):async function(e){var r,n;try{const u=await t(e);if(u&&u[Symbol.asyncIterator])try{for(var s,a=o(u);!(s=await a.next()).done;){const e=s.value;i.push(e)}}catch(c){r={error:c}}finally{try{s&&!s.done&&(n=a.return)&&await n.call(a)}finally{if(r)throw r.error}}else i.push(u)}catch(f){u=!0,l=f}h--,d(),p()}(r)}catch(r){u=!0,h--,l=r,d()}f=!1,p()}}const b={next:async function(){if(0===i.length){const e=c();return s.push(e),p(),e.promise}const e=i.shift();return p(),{done:!1,value:e}},[Symbol.asyncIterator]:()=>b};return b}(t,r,n)))},t.fromStream=function(e){if("function"==typeof e[Symbol.asyncIterator])return e;return function(e){return i(this,arguments,(function*(){for(;;){const t=e.read();if(null===t){if(e._readableState.ended)return yield n(void 0);yield n(y(e))}else yield yield n(t)}}))}(e)},t.getIterator=a,t.map=b,t.merge=function(...e){return i(this,arguments,(function*(){const t=new Set(e.map(a));for(;t.size>0;)for(const e of t){const r=yield n(e.next());r.done?t.delete(e):yield yield n(r.value)}}))},t.parallelFlatMap=function e(t,r,n){if(void 0===r)return(r,n)=>n?e(t,r,n):e(t,r);if(void 0===n)return n=>e(t,r,n);return l(e=>null!=e,d(g(t,r,n)))},t.parallelMap=g,t.parallelMerge=function(...e){return i(this,arguments,(function*(){const t=e.map(a),r=new Set,i=new Map;let s=null,o=null,c=null;const u=e=>{s=e,o&&o(e)},f=e=>{c&&c(e)},h=e=>{const t=Promise.resolve(e.next()).then(async({done:n,value:s})=>{n||i.set(e,s),r.delete(t)});r.add(t),t.then(f,u)};for(const e of t)h(e);for(;;){if(0===r.size&&0===i.size)return yield n(void 0);yield n(new Promise((e,t)=>{if(s&&t(s),i.size>0)return e();c=e,o=t}));for(const[e,t]of i)i.delete(e),yield yield n(t),h(e)}}))},t.pipeline=m,t.reduce=function e(t,r,n){if(void 0===r)return(r,n)=>n?e(t,r,n):e(t,r);if(void 0===n)return n=>e(t,r,n);return async function(e,t,r){var n,i;let s=t;try{for(var a,c=o(r);!(a=await c.next()).done;){const t=a.value;s=await e(s,t)}}catch(u){n={error:u}}finally{try{a&&!a.done&&(i=c.return)&&await i.call(c)}finally{if(n)throw n.error}}return s}(t,r,n)},t.take=function e(t,r){if(void 0===r)return r=>e(t,r);if(r[Symbol.asyncIterator])return function(e,t){return i(this,arguments,(function*(){var r,i;let s=0;try{for(var a,c=o(t);!(a=yield n(c.next())).done;){const t=a.value;if(yield yield n(yield n(t)),s++,s>=e)return yield n(void 0)}}catch(u){r={error:u}}finally{try{a&&!a.done&&(i=c.return)&&(yield n(i.call(c)))}finally{if(r)throw r.error}}}))}(t,r);return function*(e,t){let r=0;for(const n of t)if(yield n,r++,r>=e)return}(t,r)},t.tap=function(e,t){if(void 0===t)return t=>v(e,t);return v(e,t)},t.time=function t(r={},s){if(void 0===s)return e=>t(r,e);return void 0!==s[Symbol.asyncIterator]?function(t,r){return i(this,arguments,(function*(){const i=r[Symbol.asyncIterator]();let s=[0,0];for(;;){const r=e.hrtime(),{value:o,done:a}=yield n(i.next()),c=e.hrtime(r);if(s=w(s,c),t.progress&&t.progress(c,s),a)return t.total&&t.total(s),yield n(o);yield yield n(o)}}))}(r,s):function*(t,r){const n=r[Symbol.iterator]();let i=[0,0];for(;;){const r=e.hrtime(),{value:s,done:o}=n.next(),a=e.hrtime(r);if(i=w(i,a),t.progress&&t.progress(a,i),o)return t.total&&t.total(i),s;yield s}}(r,s)},t.transform=function e(t,r,n){if(void 0===r)return(r,n)=>n?e(t,r,n):e(t,r);if(void 0===n)return n=>e(t,r,n);return function(e,t,r){const n=a(r),i=[],s=[];let o=!1,u=!1,f=0,h=null;function l(){for(;s.length>0&&i.length>0;){const{resolve:e}=s.shift();e({done:!1,value:i.shift()})}for(;s.length>0&&0===f&&o;){const{resolve:e,reject:t}=s.shift();h?(t(h),h=null):e({done:!0,value:void 0})}}async function d(){if(o)l();else if(!(u||f+i.length>=e)){u=!0,f++;try{const{done:e,value:r}=await n.next();e?(o=!0,f--,l()):async function(e){try{const r=await t(e);i.push(r)}catch(r){o=!0,h=r}f--,l(),d()}(r)}catch(r){o=!0,f--,h=r,l()}u=!1,d()}}const p={next:async function(){if(0===i.length){const e=c();return s.push(e),d(),e.promise}const e=i.shift();return d(),{done:!1,value:e}},[Symbol.asyncIterator]:()=>p};return p}(t,r,n)},t.writeToStream=function(e,t){if(void 0===t)return t=>_(e,t);return _(e,t)},void 0===Symbol.asyncIterator&&(Symbol.asyncIterator=Symbol.for("asyncIterator"))}).call(this,r(8))},function(e,t,r){"use strict";const n=r(76),i=r(4),s=r(26),o=r(671),a=r(673),c=r(295),u=r(11),f=r(685),{Buffer:h}=r(0),{extendIterator:l}=r(686);class d{constructor(e){const t=s(d.defaultOptions,e);if(!t.blockService)throw new Error("Missing blockservice");this.bs=t.blockService,this.resolvers={},"function"!=typeof t.loadFormat?this.loadFormat=e=>{const t=u.print[e];throw new Error('No resolver found for codec "'.concat(t,'"'))}:this.loadFormat=t.loadFormat;for(const r of t.formats)this.addFormat(r)}addFormat(e){const t=e.codec;if(this.resolvers[e.format]){const e=u.print[t];throw new Error('Resolver already exists for codec "'.concat(e,'"'))}return this.resolvers[t]=e,this}removeFormat(e){return this.resolvers[e]&&delete this.resolvers[e],this}resolve(e,t,r){if(!i.isCID(e))throw new Error("`cid` argument must be a CID");if("string"!=typeof t)throw new Error("`path` argument must be a string");const n=async function*(){for(;null!==e;){const s=await this._getFormat(e.codec),o=await this.bs.get(e,r),a=s.resolver.resolve(o.data,t);t=a.remainderPath;let c=a.value;if(1===Object.keys(c).length&&"/"in c)try{c=new i(c["/"])}catch(n){c=null}e=i.isCID(c)?c:null,yield{remainderPath:t,value:c}}}.bind(this);return l(n())}async get(e,t){const r=await this.bs.get(e,t);return(await this._getFormat(r.cid.codec)).util.deserialize(r.data)}getMany(e,t){if(!f.isIterable(e)||"string"==typeof e||h.isBuffer(e))throw new Error("`cids` must be an iterable of CIDs");const r=async function*(){for await(const r of e)yield this.get(r,t)}.bind(this);return l(r())}async put(e,t,r){if(void 0===t)throw new Error("`put` requires a format");if("number"!=typeof t)throw new Error("`format` parameter must be number (multicodec)");const i=await this._getFormat(t),o={hashAlg:i.defaultHashAlg,cidVersion:1,onlyHash:!1},a=s(o,r),c={cidVersion:a.cidVersion,hashAlg:a.hashAlg,onlyHash:a.onlyHash},u=i.util.serialize(e),f=await i.util.cid(u,c);if(!a.onlyHash){const e=new n(u,f);await this.bs.put(e,a)}return f}putMany(e,t,r){if(!f.isIterable(e)||"string"==typeof e||h.isBuffer(e))throw new Error("`nodes` must be an iterable");if(void 0===t)throw new Error("`put` requires a format");if("number"!=typeof t)throw new Error("`format` parameter must be number (multicodec)");let n,i;const o=async function*(){for await(const o of e){if(void 0===n){i=await this._getFormat(t);const e={hashAlg:i.defaultHashAlg,cidVersion:1,onlyHash:!1};n=s(e,r)}yield this.put(o,t,n)}}.bind(this);return l(o())}async remove(e,t){return this.bs.delete(e,t)}removeMany(e,t){if(!f.isIterable(e)||"string"==typeof e||h.isBuffer(e))throw new Error("`cids` must be an iterable of CIDs");const r=async function*(){for await(const r of e)yield this.remove(r,t)}.bind(this);return l(r())}tree(e,t,r){"object"==typeof t&&(r=t,t=void 0),t=t||"";const n=s({recursive:!1},r),o=async(e,t)=>{const r=(await this._getFormat(e.cid.codec)).resolver.resolve(e.data,t);return i.isCID(r.value)?r.value:null},a=async function*(){const r=[];let i;const s=[{cid:e,basePath:""}];let a;for(;r.length>0||s.length>0;){if(0===r.length&&s.length>0){({cid:e,basePath:a}=s.shift());const t=await this._getFormat(e.codec);i=await this.bs.get(e,n);const o=t.resolver.tree(i.data);r.push(...o)}const c=r.shift();let u=a+c;n.recursive&&null!==(e=await o(i,c))&&s.push({cid:e,basePath:u+"/"}),u.startsWith(t)&&u.length>t.length&&(t.length>0&&(u=u.slice(t.length+1)),yield u)}}.bind(this);return l(a())}async _getFormat(e){if("string"==typeof e){const t=e.toUpperCase().replace(/-/g,"_");e=u[t]}if(this.resolvers[e])return this.resolvers[e];const t=await this.loadFormat(e);return this.addFormat(t),t}}d.defaultOptions={formats:[o,a,c]},e.exports=d},function(e,t,r){"use strict";t.util=r(287),t.resolver=r(672),t.codec=t.util.codec,t.defaultHashAlg=t.util.defaultHashAlg},function(e,t,r){"use strict";const n=r(4),{Buffer:i}=r(0),s=r(287);t.resolve=(e,t)=>{let r=s.deserialize(e);const i=t.split("/").filter(Boolean);for(;i.length;){const e=i.shift();if(void 0===r[e])throw new Error("Object has no property '".concat(e,"'"));if(r=r[e],n.isCID(r))return{value:r,remainderPath:i.join("/")}}return{value:r,remainderPath:""}};const o=function*(e,t){if(!i.isBuffer(e)&&!n.isCID(e)&&"string"!=typeof e&&null!==e)for(const r of Object.keys(e)){const n=void 0===t?r:t+"/"+r;yield n,yield*o(e[r],n)}};t.tree=function*(e){const t=s.deserialize(e);yield*o(t)}},function(e,t,r){"use strict";t.DAGNode=r(674),t.DAGLink=r(293),t.resolver=r(679),t.util=r(294),t.codec=t.util.codec,t.defaultHashAlg=t.util.defaultHashAlg},function(e,t,r){"use strict";e.exports=r(288)},function(e,t,r){"use strict";const n=r(67),i=r(292);e.exports=async(e,t={})=>{const r=await i.cid(e.serialize(),t);return new n(t.name||"",e.size,r)}},function(e,t,r){"use strict";const n=r(289),i=r(293);e.exports=(e,t)=>{const r=(e=>{if(i.isDAGLink(e))return e;if(!("cid"in e||"hash"in e||"Hash"in e||"multihash"in e))throw new Error("Link must be a DAGLink or DAGLink-like. Convert the DAGNode into a DAGLink via `node.toDAGLink()`.");return new i(e.Name||e.name,e.Tsize||e.size,e.Hash||e.multihash||e.hash||e.cid)})(t);e.Links.push(r),n(e.Links)}},function(e,t,r){"use strict";const n=r(67);e.exports.createDagLinkFromB58EncodedHash=function(e){return new n(e.Name||e.name||"",e.Tsize||e.Size||e.size||0,e.Hash||e.hash||e.multihash||e.cid)}},function(e,t,r){"use strict";const n=r(4),{Buffer:i}=r(0);e.exports=(e,t)=>{let r=null;if("string"==typeof t?r=e=>e.Name===t:(i.isBuffer(t)||n.isCID(t))&&(r=e=>e.Hash.equals(t)),!r)throw new Error("second arg needs to be a name or CID");{const t=e.Links;let n=0;for(;n<t.length;){r(t[n])?t.splice(n,1):n++}}}},function(e,t,r){"use strict";const n=r(4),i=r(294);t.resolve=(e,t)=>{let r=i.deserialize(e);const s=t.split("/").filter(Boolean);for(;s.length;){const e=s.shift();if(void 0===r[e]){for(const t of r.Links)if(t.Name===e)return{value:t.Hash,remainderPath:s.join("/")};throw new Error("Object has no property '".concat(e,"'"))}if(r=r[e],n.isCID(r))return{value:r,remainderPath:s.join("/")}}return{value:r,remainderPath:""}},t.tree=function*(e){const t=i.deserialize(e);yield"Data",yield"Links";for(let r=0;r<t.Links.length;r++)yield"Links/".concat(r),yield"Links/".concat(r,"/Name"),yield"Links/".concat(r,"/Tsize"),yield"Links/".concat(r,"/Hash")}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(1),s=r(17),o=r(681);async function a(e,t,r){const n=await a.digest(e,t,r);return s.encode(n,t,r)}a.Buffer=n,a.multihash=s,a.digest=async(e,t,r)=>{const n=a.createHash(t),i=await n(e);return r?i.slice(0,r):i},a.createHash=function(e){if(!e)throw i(new Error("hash algorithm must be specified"),"ERR_HASH_ALGORITHM_NOT_SPECIFIED");if(e=s.coerceCode(e),!a.functions[e])throw i(new Error("multihash function '".concat(e,"' not yet supported")),"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return a.functions[e]},a.functions={0:o.identity,17:o.sha1,18:o.sha2256,19:o.sha2512,20:o.sha3512,21:o.sha3384,22:o.sha3256,23:o.sha3224,24:o.shake128,25:o.shake256,26:o.keccak224,27:o.keccak256,28:o.keccak384,29:o.keccak512,34:o.murmur3128,35:o.murmur332,86:o.dblSha2256},o.addBlake(a.functions),a.validate=async(e,t)=>{const r=await a(e,s.decode(t).name);return 0===n.compare(t,r)},e.exports=a},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(34),s=r(35),{factory:o}=r(682),{fromNumberTo32BitBuf:a}=r(683),c=e=>async t=>{switch(e){case"sha3-224":return n.from(i.sha3_224.arrayBuffer(t));case"sha3-256":return n.from(i.sha3_256.arrayBuffer(t));case"sha3-384":return n.from(i.sha3_384.arrayBuffer(t));case"sha3-512":return n.from(i.sha3_512.arrayBuffer(t));case"shake-128":return n.from(i.shake128.create(128).update(t).arrayBuffer());case"shake-256":return n.from(i.shake256.create(256).update(t).arrayBuffer());case"keccak-224":return n.from(i.keccak224.arrayBuffer(t));case"keccak-256":return n.from(i.keccak256.arrayBuffer(t));case"keccak-384":return n.from(i.keccak384.arrayBuffer(t));case"keccak-512":return n.from(i.keccak512.arrayBuffer(t));case"murmur3-128":return n.from(s.x64.hash128(t),"hex");case"murmur3-32":return a(s.x86.hash32(t));default:throw new TypeError("".concat(e," is not a supported algorithm"))}};e.exports={identity:e=>n.from(e),sha1:o("sha1"),sha2256:o("sha2-256"),sha2512:o("sha2-512"),dblSha2256:o("dbl-sha2-256"),sha3224:c("sha3-224"),sha3256:c("sha3-256"),sha3384:c("sha3-384"),sha3512:c("sha3-512"),shake128:c("shake-128"),shake256:c("shake-256"),keccak224:c("keccak-224"),keccak256:c("keccak-256"),keccak384:c("keccak-384"),keccak512:c("keccak-512"),murmur3128:c("murmur3-128"),murmur332:c("murmur3-32"),addBlake:r(684)}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(17),s=self.crypto||self.msCrypto,o=async(e,t)=>{if("undefined"==typeof self||!self.crypto&&!self.msCrypto)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");switch(t){case"sha1":return n.from(await s.subtle.digest({name:"SHA-1"},e));case"sha2-256":return n.from(await s.subtle.digest({name:"SHA-256"},e));case"sha2-512":return n.from(await s.subtle.digest({name:"SHA-512"},e));case"dbl-sha2-256":{const t=await s.subtle.digest({name:"SHA-256"},e);return n.from(await s.subtle.digest({name:"SHA-256"},t))}default:throw new Error("".concat(t," is not a supported algorithm"))}};e.exports={factory:e=>async t=>o(t,e),digest:o,multihashing:async(e,t,r)=>{const n=await o(e,t);return i.encode(n,t,r)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports={fromNumberTo32BitBuf:e=>{const t=new Array(4);for(let r=0;r<4;r++)t[r]=255&e,e>>=8;return n.from(t)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(36),s={init:i.blake2bInit,update:i.blake2bUpdate,digest:i.blake2bFinal},o={init:i.blake2sInit,update:i.blake2sUpdate,digest:i.blake2sFinal},a=(e,t)=>async r=>{const i=t.init(e,null);return t.update(i,r),n.from(t.digest(i))};e.exports=e=>{for(let t=0;t<64;t++)e[45569+t]=a(t+1,s);for(let t=0;t<32;t++)e[45633+t]=a(t+1,o)}},function(e,t,r){"use strict";function n(e){return!isNaN(parseFloat(e))&&isFinite(e)}function i(e){return null!==e&&"object"==typeof e&&e.constructor===Object}function s(e){return o(e)&&"number"==typeof e.length}function o(e){return"object"==typeof e&&null!==e}function a(e){return void 0!==e}function c(e){return!a(e)}function u(e){return null===e}function f(e){return a(e)&&!u(e)&&!Number.isNaN(e)}function h(e){return"function"==typeof e&&/^class /.test(Function.prototype.toString.call(e))}function l(e){if(null===e)return!0;switch(typeof e){case"string":case"number":case"symbol":case"undefined":case"boolean":return!0;default:return!1}}function d(e){if(e){const t=a(Promise)&&e instanceof Promise,r=e.then&&"function"==typeof e.then;return!(!t&&!r)}return!1}function p(e){return!(null===e||!a(e))&&("function"==typeof e[Symbol.iterator]||"function"==typeof e[Symbol.asyncIterator])}function b(e){return"string"==typeof e}function y(e){return"function"==typeof e}r.r(t),r.d(t,"isNumber",(function(){return n})),r.d(t,"isPlainObject",(function(){return i})),r.d(t,"isArrayLike",(function(){return s})),r.d(t,"isObject",(function(){return o})),r.d(t,"isDefined",(function(){return a})),r.d(t,"isUndefined",(function(){return c})),r.d(t,"isNull",(function(){return u})),r.d(t,"isDefinedValue",(function(){return f})),r.d(t,"isClass",(function(){return h})),r.d(t,"isPrimitive",(function(){return l})),r.d(t,"isPromise",(function(){return d})),r.d(t,"isIterable",(function(){return p})),r.d(t,"isString",(function(){return b})),r.d(t,"isFunction",(function(){return y})),t.default={isNumber:n,isPlainObject:i,isArrayLike:s,isObject:o,isDefined:a,isUndefined:c,isNull:u,isDefinedValue:f,isClass:h,isPrimitive:l,isPromise:d,isIterable:p,isString:b,isFunction:y}},function(e,t,r){"use strict";t.first=async e=>{for await(const t of e)return t},t.last=async e=>{let t;for await(t of e);return t},t.all=async e=>{const t=[];for await(const r of e)t.push(r);return t},t.extendIterator=e=>(e.first=()=>t.first(e),e.last=()=>t.last(e),e.all=()=>t.all(e),e)},function(e,t,r){"use strict";const n=r(26),i=r(688),s=r(12),o=r(295);e.exports=(e,t)=>(t=t||{},n.call({concatArrays:!0},{blockService:e,formats:[i,s,o]},t))},function(e,t,r){"use strict";t.util=r(296),t.resolver=r(694),t.codec=t.util.codec,t.defaultHashAlg=t.util.defaultHashAlg},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(1),s=r(17),o=r(690);async function a(e,t,r){const n=await a.digest(e,t,r);return s.encode(n,t,r)}a.Buffer=n,a.multihash=s,a.digest=async(e,t,r)=>{const n=a.createHash(t),i=await n(e);return r?i.slice(0,r):i},a.createHash=function(e){if(!e)throw i(new Error("hash algorithm must be specified"),"ERR_HASH_ALGORITHM_NOT_SPECIFIED");if(e=s.coerceCode(e),!a.functions[e])throw i(new Error("multihash function '".concat(e,"' not yet supported")),"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return a.functions[e]},a.functions={0:o.identity,17:o.sha1,18:o.sha2256,19:o.sha2512,20:o.sha3512,21:o.sha3384,22:o.sha3256,23:o.sha3224,24:o.shake128,25:o.shake256,26:o.keccak224,27:o.keccak256,28:o.keccak384,29:o.keccak512,34:o.murmur3128,35:o.murmur332,86:o.dblSha2256},o.addBlake(a.functions),a.validate=async(e,t)=>{const r=await a(e,s.decode(t).name);return 0===n.compare(t,r)},e.exports=a},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(34),s=r(35),{factory:o}=r(691),{fromNumberTo32BitBuf:a}=r(692),c=e=>async t=>{switch(e){case"sha3-224":return n.from(i.sha3_224.arrayBuffer(t));case"sha3-256":return n.from(i.sha3_256.arrayBuffer(t));case"sha3-384":return n.from(i.sha3_384.arrayBuffer(t));case"sha3-512":return n.from(i.sha3_512.arrayBuffer(t));case"shake-128":return n.from(i.shake128.create(128).update(t).arrayBuffer());case"shake-256":return n.from(i.shake256.create(256).update(t).arrayBuffer());case"keccak-224":return n.from(i.keccak224.arrayBuffer(t));case"keccak-256":return n.from(i.keccak256.arrayBuffer(t));case"keccak-384":return n.from(i.keccak384.arrayBuffer(t));case"keccak-512":return n.from(i.keccak512.arrayBuffer(t));case"murmur3-128":return n.from(s.x64.hash128(t),"hex");case"murmur3-32":return a(s.x86.hash32(t));default:throw new TypeError("".concat(e," is not a supported algorithm"))}};e.exports={identity:e=>n.from(e),sha1:o("sha1"),sha2256:o("sha2-256"),sha2512:o("sha2-512"),dblSha2256:o("dbl-sha2-256"),sha3224:c("sha3-224"),sha3256:c("sha3-256"),sha3384:c("sha3-384"),sha3512:c("sha3-512"),shake128:c("shake-128"),shake256:c("shake-256"),keccak224:c("keccak-224"),keccak256:c("keccak-256"),keccak384:c("keccak-384"),keccak512:c("keccak-512"),murmur3128:c("murmur3-128"),murmur332:c("murmur3-32"),addBlake:r(693)}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(17),s=self.crypto||self.msCrypto,o=async(e,t)=>{if("undefined"==typeof self||!self.crypto&&!self.msCrypto)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");switch(t){case"sha1":return n.from(await s.subtle.digest({name:"SHA-1"},e));case"sha2-256":return n.from(await s.subtle.digest({name:"SHA-256"},e));case"sha2-512":return n.from(await s.subtle.digest({name:"SHA-512"},e));case"dbl-sha2-256":{const t=await s.subtle.digest({name:"SHA-256"},e);return n.from(await s.subtle.digest({name:"SHA-256"},t))}default:throw new Error("".concat(t," is not a supported algorithm"))}};e.exports={factory:e=>async t=>o(t,e),digest:o,multihashing:async(e,t,r)=>{const n=await o(e,t);return i.encode(n,t,r)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports={fromNumberTo32BitBuf:e=>{const t=new Array(4);for(let r=0;r<4;r++)t[r]=255&e,e>>=8;return n.from(t)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(36),s={init:i.blake2bInit,update:i.blake2bUpdate,digest:i.blake2bFinal},o={init:i.blake2sInit,update:i.blake2sUpdate,digest:i.blake2sFinal},a=(e,t)=>async r=>{const i=t.init(e,null);return t.update(i,r),n.from(t.digest(i))};e.exports=e=>{for(let t=0;t<64;t++)e[45569+t]=a(t+1,s);for(let t=0;t<32;t++)e[45633+t]=a(t+1,o)}},function(e,t,r){"use strict";const n=r(4),{Buffer:i}=r(0),s=r(296);t.resolve=(e,t)=>{let r=s.deserialize(e);const i=t.split("/").filter(Boolean);for(;i.length;){const e=i.shift();if(void 0===r[e])throw new Error("Object has no property '".concat(e,"'"));if(r=r[e],n.isCID(r))return{value:r,remainderPath:i.join("/")}}return{value:r,remainderPath:""}};const o=function*(e,t){if(!i.isBuffer(e)&&!n.isCID(e)&&"string"!=typeof e&&null!==e)for(const r of Object.keys(e)){const n=void 0===t?r:t+"/"+r;yield n,yield*o(e[r],n)}};t.tree=function*(e){const t=s.deserialize(e);yield*o(t)}},function(e,t,r){"use strict";const n=r(297),i=r(2),s=r(4),o=r(696),a=r(41),c=r(697),u=i("ipfs:preload");u.error=i("ipfs:preload:error"),e.exports=e=>{if((e=e||{}).enabled=Boolean(e.enabled),e.addresses=e.addresses||[],!e.enabled||!e.addresses.length){u("preload disabled");const e=()=>{};return e.start=()=>{},e.stop=()=>{},e}let t=!0,r=[];const i=e.addresses.map(n),f=async e=>{try{if(t)throw new Error("preload ".concat(e," but preloader is not started"));"string"!=typeof e&&(e=new s(e).toString());const f=o(i);let h=!1;const l=Date.now();for(const i of f){if(t)throw new Error("preload aborted for ".concat(e));let s;try{s=new a,r=r.concat(s),await c("".concat(i,"/api/v0/refs?r=true&arg=").concat(encodeURIComponent(e)),{signal:s.signal}),h=!0}catch(n){"aborted"!==n.type&&u.error(n)}finally{r=r.filter(e=>e!==s)}if(h)break}u("".concat(h?"":"un","successfully preloaded ").concat(e," in ").concat(Date.now()-l,"ms"))}catch(n){u.error(n)}};return f.start=()=>{t=!1},f.stop=()=>{t=!0,u("aborting ".concat(r.length," pending preload request(s)")),r.forEach(e=>e.abort()),r=[]},f}},function(e,t,r){"use strict";e.exports=function(e){if(!Array.isArray(e))throw new TypeError("Expected Array, got "+typeof e);for(var t,r,n=e.length,i=e.slice();n;)t=Math.floor(Math.random()*n--),r=i[n],i[n]=i[t],i[t]=r;return i}},function(e,t,r){"use strict";const{default:n}=r(51),i=r(115),s=r(2),o=s("ipfs:preload");o.error=s("ipfs:preload:error");const a=new n({concurrency:4});e.exports=function(e,t){return o(e),t=t||{},a.add(async()=>{const r=(await i.post(e,{signal:t.signal})).body.getReader();try{for(;;){const{done:e}=await r.read();if(e)return}}finally{r.releaseLock()}})}},function(e,t,r){"use strict";const n=r(6),{Key:i,Errors:s}=r(7),o=r(1),a=r(2),c=a("ipfs:ipns:publisher");c.error=a("ipfs:ipns:publisher:error");const u=r(80),f=s.notFoundError().code;class h{constructor(e,t){this._routing=e,this._datastore=t}async publishWithEOL(e,t,r){if(!e||!e.bytes)throw o(new Error("invalid private key"),"ERR_INVALID_PRIVATE_KEY");const i=await n.createFromPrivKey(e.bytes),s=await this._updateOrCreateRecord(e,t,r,i);return this._putRecordToRouting(s,i)}publish(e,t){return this.publishWithEOL(e,t,36e5)}async _putRecordToRouting(e,t){if(!n.isPeerId(t)){const e="peerId received is not valid";throw c.error(e),o(new Error(e),"ERR_INVALID_PEER_ID")}const r=t._pubKey,i=await u.embedPublicKey(r,e),s=u.getIdKeys(t.toBytes());return await this._publishEntry(s.routingKey,i||e,t),await this._publishPublicKey(s.routingPubKey,r),i||e}async _publishEntry(e,t){if(!i.isKey(e)){const e="datastore key does not have a valid format";throw c.error(e),o(new Error(e),"ERR_INVALID_DATASTORE_KEY")}let r;try{r=u.marshal(t)}catch(n){throw c.error(n),n}try{const t=await this._routing.put(e.toBuffer(),r);return c("ipns record for ".concat(e.toString("base64")," was stored in the routing")),t}catch(n){const t="ipns record for ".concat(e.toString("base64")," could not be stored in the routing");throw c.error(t),c.error(n),o(new Error(t),"ERR_PUTTING_TO_ROUTING")}}async _publishPublicKey(e,t){if(!i.isKey(e)){const e="datastore key does not have a valid format";throw c.error(e),o(new Error(e),"ERR_INVALID_DATASTORE_KEY")}if(!t||!t.bytes){const e="one or more of the provided parameters are not defined";throw c.error(e),o(new Error(e),"ERR_UNDEFINED_PARAMETER")}try{const r=await this._routing.put(e.toBuffer(),t.bytes);return c("public key for ".concat(e.toString("base64")," was stored in the routing")),r}catch(r){const t="public key for ".concat(e.toString("base64")," could not be stored in the routing");throw c.error(t),c.error(r),o(new Error(t),"ERR_PUTTING_TO_ROUTING")}}async _getPublished(e,t){if(!n.isPeerId(e)){const e="peerId received is not valid";throw c.error(e),o(new Error(e),"ERR_INVALID_PEER_ID")}const r=!1!==(t=t||{}).checkRouting;try{const t=await this._datastore.get(u.getLocalKey(e.id));return this._unmarshalData(t)}catch(i){if(i.code!==f){const t="unexpected error getting the ipns record ".concat(e.id," from datastore");throw c.error(t),o(new Error(t),"ERR_UNEXPECTED_DATASTORE_RESPONSE")}if(!r)throw o(i);try{const t=u.getIdKeys(e.toBytes()),r=await this._routing.get(t.routingKey.toBuffer());return this._unmarshalData(r)}catch(i){throw c.error(i),i}}}_unmarshalData(e){try{return u.unmarshal(e)}catch(t){throw o(t,"ERR_INVALID_RECORD_DATA")}}async _updateOrCreateRecord(e,t,r,i){if(!n.isPeerId(i)){const e="peerId received is not valid";throw c.error(e),o(new Error(e),"ERR_INVALID_PEER_ID")}const s={checkRouting:!0};let a;try{a=await this._getPublished(i,s)}catch(d){if(d.code!==f){const e="unexpected error when determining the last published IPNS record for ".concat(i.id);throw c.error(e),o(new Error(e),"ERR_DETERMINING_PUBLISHED_RECORD")}}let h,l=0;a&&void 0!==a.sequence&&(l=a.value.toString()!==t?a.sequence+1:a.sequence);try{h=await u.create(e,t,l,r)}catch(d){const e="ipns record for ".concat(t," could not be created");throw c.error(d),o(new Error(e),"ERR_CREATING_IPNS_RECORD")}try{const e=u.marshal(h);return await this._datastore.put(u.getLocalKey(i.id),e),c("ipns record for ".concat(t," was stored in the datastore")),h}catch(d){const e="ipns record for ".concat(t," could not be stored in the datastore");throw c.error(e),o(new Error(e),"ERR_STORING_IN_DATASTORE")}}}h.defaultRecordLifetime=36e5,e.exports=h},function(e,t,r){"use strict";!function(){e.exports=u;var t=100982246400,r=864e13,n=4294967296,i=Math.trunc||function(e){var t=e-e%1;return 0===t&&(e<0||0===e&&1/e!=1/0)?-0:t},s=u.prototype;u.fromDate=function(e){return new u(+e)},u.fromInt64BE=p(0,1,2,3,0,4),u.fromInt64LE=p(3,2,1,0,4,0),u.fromString=function(e){var t,r=new u,n=(e+="").replace(/^\s*[+\-]?\d+/,(function(e){var t=+e,n=1970+(t-1970)%400;return r.year=t-n,n})).replace(/(?:Z|([+\-]\d{2}):?(\d{2}))$/,(function(e,r,n){return r<0&&(n*=-1),t=6e4*(60*+r+ +n),""})).replace(/\.\d+$/,(function(e){return r.nano=+(e+"000000000").substr(1,9),""})).split(/\D+/);n.length>1?n[1]--:n[1]=0;if(r.time=t=Date.UTC.apply(Date,n)-(t||0),isNaN(t))throw new TypeError("Invalid Date");return f(r)},u.fromTimeT=function(e){return l(e,0)},s.year=0,s.time=0,s.nano=0,s.addNano=function(e){return this.nano+=+e||0,this},s.getNano=function(){var e=f(this);return(e.time%1e3*1e6+ +e.nano+1e9)%1e9},s.getTimeT=function(){var e=f(this),t=Math.floor(e.time/1e3),r=e.year;r&&(t+=1168776*r*86400/3200);return t},s.getYear=function(){return this.toDate().getUTCFullYear()+this.year},s.toDate=function(){return h(f(this).time)},s.toJSON=function(){return this.toString().replace(/0{1,6}Z$/,"Z")},s.toString=function(e){var t=this,r=t.toDate(),n={H:function(){return y(r.getUTCHours())},L:function(){return m(r.getUTCMilliseconds(),3)},M:function(){return y(r.getUTCMinutes())},N:function(){return m(t.getNano(),9)},S:function(){return y(r.getUTCSeconds())},Y:function(){var e=t.getYear();return e>999999?"+"+e:e>9999?"+"+m(e,6):e>=0?m(e,4):e>=-999999?"-"+m(-e,6):e},a:function(){return a[r.getUTCDay()]},b:function(){return o[r.getUTCMonth()]},d:function(){return y(r.getUTCDate())},e:function(){return e=r.getUTCDate(),(e>9?"":" ")+(0|e);var e},m:function(){return y(r.getUTCMonth()+1)}};return function e(t){return t.replace(/%./g,(function(t){var r=t[1],i=c[r],s=n[r];return i?e(i):s?s():t}))}(e||"%Y-%m-%dT%H:%M:%S.%NZ")},s.writeInt64BE=d(0,1,2,3,0,4),s.writeInt64LE=d(3,2,1,0,4,0);var o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],c={"%":"%",F:"%Y-%m-%d",n:"\n",R:"%H:%M",T:"%H:%M:%S",t:"\t",X:"%T",Z:"GMT",z:"+0000"};return u;function u(e,t,r){var n=this;if(!(n instanceof u))return new u(e,t,r);n.time=+e||0,n.nano=+t||0,n.year=+r||0,f(n)}function f(e){var t,n,s=e.year,o=e.time,a=e.nano;if(a<0||1e6<=a){var c=Math.floor(a/1e6);a-=1e6*c,o+=c,t=1}var u=s%3200;if(o<-r||r<o||u){(n=i(o/1009822464e5))&&(s+=3200*n,o-=1009822464e5*n);var f=h(o);f.setUTCFullYear(u+f.getUTCFullYear());var l=(o=+f)+1009822464e5*(n=i((s-=u)/3200));n&&-r<=l&&l<=r&&(s-=3200*n,o=l),t=1}return t&&(e.year=s,e.time=o,e.nano=a),e}function h(e){var t=new Date(0);return t.setTime(e),t}function l(e,r){r|=0,e=+e||0;var s=i((r*=n)/t)+i(e/t),o=r%t+e%t,a=i(o/t);return a&&(s+=a,o-=a*t),new u(1e3*o,0,3200*s)}function d(e,t,r,s,o,a){return function(e,t){var r=f(this);e||(e=new Array(8));b(e,t|=0);var s=Math.floor(r.time/1e3),u=31556952*r.year,h=i(u/n)+i(s/n),l=u%n+s%n,d=Math.floor(l/n);d&&(h+=d,l-=d*n);return c(e,t+o,h),c(e,t+a,l),e};function c(n,i,o){n[i+e]=o>>24&255,n[i+t]=o>>16&255,n[i+r]=o>>8&255,n[i+s]=255&o}}function p(e,t,r,n,i,s){return function(e,t){b(e,t|=0);var r=o(e,t+i);return l(o(e,t+s),r)};function o(i,s){return 16777216*i[s+e]+(i[s+t]<<16|i[s+r]<<8|i[s+n])}}function b(e,t){var r=e&&e.length;if(null==r)throw new TypeError("Invalid Buffer");if(r<t+8)throw new RangeError("Out of range")}function y(e){return(e>9?"":"0")+(0|e)}function m(e,t){return("000000000"+(0|e)).substr(-t)}}()},function(e,t,r){"use strict";const n=r(299),i=r(14),{names:s}=r(704),o=r(705),a=r(208),c=r(207),u={};for(const h in s)u[s[h]]=h;function f(e){t.decode(e)}t.names=s,t.codes=Object.freeze(u),t.toHexString=function(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return o(e,"base16")},t.fromHexString=function(e){return a(e,"base16")},t.toB58String=function(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return o(n.encode("base58btc",e)).slice(1)},t.fromB58String=function(e){const t=e instanceof Uint8Array?o(e):e;return n.decode("z"+t)},t.decode=function(e){if(!(e instanceof Uint8Array))throw new Error("multihash must be a Uint8Array");if(e.length<2)throw new Error("multihash too short. must be > 2 bytes.");const r=i.decode(e);if(!t.isValidCode(r))throw new Error("multihash unknown function code: 0x".concat(r.toString(16)));e=e.slice(i.decode.bytes);const n=i.decode(e);if(n<0)throw new Error("multihash invalid length: ".concat(n));if((e=e.slice(i.decode.bytes)).length!==n)throw new Error("multihash length inconsistent: 0x".concat(o(e,"base16")));return{code:r,name:u[r],length:n,digest:e}},t.encode=function(e,r,n){if(!e||void 0===r)throw new Error("multihash encode requires at least two args: digest, code");const s=t.coerceCode(r);if(!(e instanceof Uint8Array))throw new Error("digest should be a Uint8Array");if(null==n&&(n=e.length),n&&e.length!==n)throw new Error("digest length should be equal to specified length.");const o=i.encode(s),a=i.encode(n);return c([o,a,e],o.length+a.length+e.length)},t.coerceCode=function(e){let r=e;if("string"==typeof e){if(void 0===s[e])throw new Error("Unrecognized hash function named: ".concat(e));r=s[e]}if("number"!=typeof r)throw new Error("Hash function code should be a number. Got: ".concat(r));if(void 0===u[r]&&!t.isAppCode(r))throw new Error("Unrecognized function code: ".concat(r));return r},t.isAppCode=function(e){return e>0&&e<16},t.isValidCode=function(e){return!!t.isAppCode(e)||!!u[e]},t.validate=f,t.prefix=function(e){return f(e),e.subarray(0,2)}},function(e,t,r){"use strict";const n=r(42),i=r(702),s=r(703),{decodeText:o,encodeText:a}=r(164),c=[["identity","\0",()=>({encode:o,decode:a}),""],["base2","0",s(1),"01"],["base8","7",s(3),"01234567"],["base10","9",n,"0123456789"],["base16","f",s(4),"0123456789abcdef"],["base16upper","F",s(4),"0123456789ABCDEF"],["base32hex","v",s(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",s(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",s(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",s(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",s(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",s(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",s(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",s(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",s(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",n,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",n,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",n,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",n,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],u=c.reduce((e,t)=>(e[t[0]]=new i(t[0],t[1],t[2],t[3]),e),{}),f=c.reduce((e,t)=>(e[t[1]]=u[t[0]],e),{});e.exports={names:u,codes:f}},function(e,t,r){"use strict";const{encodeText:n}=r(164);e.exports=class{constructor(e,t,r,i){this.name=e,this.code=t,this.codeBuf=n(this.code),this.alphabet=i,this.engine=r(i)}encode(e){return this.engine.encode(e)}decode(e){for(const t of e)if(this.alphabet&&this.alphabet.indexOf(t)<0)throw new Error("invalid character '".concat(t,"' in '").concat(e,"'"));return this.engine.decode(e)}}},function(e,t,r){"use strict";e.exports=e=>t=>({encode:r=>((e,t,r)=>{const n="="===t[t.length-1],i=(1<<r)-1;let s="",o=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],o+=8;o>r;)o-=r,s+=t[i&a>>o];if(o&&(s+=t[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s})(r,t,e),decode:r=>((e,t,r)=>{const n={};for(let u=0;u<t.length;++u)n[t[u]]=u;let i=e.length;for(;"="===e[i-1];)--i;const s=new Uint8Array(i*r/8|0);let o=0,a=0,c=0;for(let u=0;u<i;++u){const t=n[e[u]];if(void 0===t)throw new SyntaxError("Invalid character "+e[u]);a=a<<r|t,o+=r,o>=8&&(o-=8,s[c++]=255&a>>o)}if(o>=r||255&a<<8-o)throw new SyntaxError("Unexpected end of data");return s})(r,t,e)})},function(e,t,r){"use strict";const n=Object.freeze({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,blake3:30,"murmur3-128":34,"murmur3-32":35,"dbl-sha2-256":86,md4:212,md5:213,bmt:214,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,x11:4352,"sm3-256":21325,"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,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082});e.exports={names:n}},function(e,t,r){"use strict";const{names:n}=r(209),{TextDecoder:i}=r(92),s=new i("utf8");e.exports=function(e,t="utf8"){if("utf8"===t||"utf-8"===t)return s.decode(e);const r=n[t];if(!r)throw new Error("Unknown base");return r.encode(e)}},function(e,t,r){"use strict";const n=r(16);e.exports=n('\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').IpnsEntry},function(e,t,r){"use strict";e.exports.toRFC3339=e=>{const t=e.getUTCFullYear(),r=String(e.getUTCMonth()+1).padStart(2,"0"),n=String(e.getUTCDate()).padStart(2,"0"),i=String(e.getUTCHours()).padStart(2,"0"),s=String(e.getUTCMinutes()).padStart(2,"0"),o=String(e.getUTCSeconds()).padStart(2,"0"),a=1e3*e.getUTCMilliseconds()*1e3;return"".concat(t,"-").concat(r,"-").concat(n,"T").concat(i,":").concat(s,":").concat(o,".").concat(a,"Z")},e.exports.parseRFC3339=e=>{const t=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),r=String(e).trim().match(t);if(!r)throw new Error("Invalid format");const n=parseInt(r[1],10),i=parseInt(r[2],10)-1,s=parseInt(r[3],10),o=parseInt(r[4],10),a=parseInt(r[5],10),c=parseInt(r[6],10),u=parseInt(r[7].slice(0,-6),10);return new Date(Date.UTC(n,i,s,o,a,c,u))}},function(e,t,r){"use strict";t.ERR_IPNS_EXPIRED_RECORD="ERR_IPNS_EXPIRED_RECORD",t.ERR_UNRECOGNIZED_VALIDITY="ERR_UNRECOGNIZED_VALIDITY",t.ERR_SIGNATURE_CREATION="ERR_SIGNATURE_CREATION",t.ERR_SIGNATURE_VERIFICATION="ERR_SIGNATURE_VERIFICATION",t.ERR_UNRECOGNIZED_FORMAT="ERR_UNRECOGNIZED_FORMAT",t.ERR_PEER_ID_FROM_PUBLIC_KEY="ERR_PEER_ID_FROM_PUBLIC_KEY",t.ERR_PUBLIC_KEY_FROM_ID="ERR_PUBLIC_KEY_FROM_ID",t.ERR_UNDEFINED_PARAMETER="ERR_UNDEFINED_PARAMETER"},function(e,t,r){"use strict";const n=r(80),i=r(28),s=r(6),o=r(1),{Buffer:a}=r(0),c=r(2),u=c("ipfs:ipns:republisher");u.error=c("ipfs:ipns:republisher:error");e.exports=class{constructor(e,t,r,n,i){this._publisher=e,this._datastore=t,this._peerId=r,this._keychain=n,this._options=i||{},this._republishHandle=null}async start(){if(this._republishHandle)throw o(new Error("republisher is already running"),"ERR_REPUBLISH_ALREADY_RUNNING");const e={_task:null,_inflightTask:null,_timeoutId:null,runPeriodically:t=>{e._timeoutId=setTimeout(async()=>{e._timeoutId=null;try{e._inflightTask=e._task(),await e._inflightTask,e._task&&e.runPeriodically(t)}catch(r){u.error(r)}},t())},cancel:async()=>{clearTimeout(e._timeoutId),e._task=null,await e._inflightTask}},{privKey:t}=this._peerId,{pass:r}=this._options;let n=!0;e._task=()=>this._republishEntries(t,r),e.runPeriodically(()=>n?(n=!1,this._options.initialBroadcastInterval||6e4):this._options.broadcastInterval||144e5),this._republishHandle=e}async stop(){const e=this._republishHandle;if(!e)throw o(new Error("republisher is not running"),"ERR_REPUBLISH_NOT_RUNNING");this._republishHandle=null,await e.cancel()}async _republishEntries(e,t){try{await this._republishEntry(e)}catch(r){const e="cannot republish entry for the node's private key";return void u.error(e)}if(t)try{const e=await this._keychain.listKeys();for(const r of e){const e=await this._keychain.exportKey(r.name,t),n=await i.keys.import(e,t);await this._republishEntry(n)}}catch(r){u.error(r)}}async _republishEntry(e){if(!e||!e.bytes)throw o(new Error("invalid private key"),"ERR_INVALID_PRIVATE_KEY");try{const t=await s.createFromPrivKey(e.bytes),r=await this._getPreviousValue(t);await this._publisher.publishWithEOL(e,r,864e5)}catch(t){if("ERR_NO_ENTRY_FOUND"===t.code)return;throw t}}async _getPreviousValue(e){if(!s.isPeerId(e))throw o(new Error("invalid peer ID"),"ERR_INVALID_PEER_ID");try{const r=await this._datastore.get(n.getLocalKey(e.id));if(!a.isBuffer(r))throw o(new Error("found ipns record that we couldn't process"),"ERR_INVALID_IPNS_RECORD");try{return n.unmarshal(r).value}catch(t){throw u.error(t),o(new Error("found ipns record that we couldn't convert to a value"),"ERR_INVALID_IPNS_RECORD")}}catch(t){if(t&&t.notFound)throw o(new Error("no previous entry for record with id: ".concat(e.id)),"ERR_NO_ENTRY_FOUND");throw t}}}},function(e,t,r){"use strict";const n=r(80),i=r(28),s=r(6),o=r(1),a=r(2),c=a("ipfs:ipns:resolver");c.error=a("ipfs:ipns:resolver:error");const{Errors:u}=r(7),f=u.notFoundError().code;e.exports=class{constructor(e){this._routing=e}async resolve(e,t){if(t=t||{},"string"!=typeof e)throw o(new Error("invalid name"),"ERR_INVALID_NAME");const r=(t=t||{}).recursive&&"true"===t.recursive.toString(),n=e.split("/");if(3!==n.length||""!==n[0])throw o(new Error("invalid name"),"ERR_INVALID_NAME");const i=n[2];let s;r&&(s=32);const a=await this.resolver(i,s);return c("".concat(e," was locally resolved correctly")),a}async resolver(e,t){if(0===t){const e="could not resolve name (recursion limit of ".concat(32," exceeded)");throw c.error(e),o(new Error(e),"ERR_RESOLVE_RECURSION_LIMIT")}const r=await this._resolveName(e),n=r.split("/");return"ipfs"!==n[1]&&t?this.resolver(n[2],t-1):r}async _resolveName(e){const t=s.createFromCID(e),{routingKey:r}=n.getIdKeys(t.toBytes());let a,u,h;try{a=await this._routing.get(r.toBuffer())}catch(l){if(c.error(l),l.code===f)throw o(new Error("record requested for ".concat(e," was not found in the network")),"ERR_NO_RECORD_FOUND");throw o(new Error("unexpected error getting the ipns record ".concat(t.id)),"ERR_UNEXPECTED_ERROR_GETTING_RECORD")}try{u=n.unmarshal(a)}catch(l){throw c.error(l),o(new Error("found ipns record that we couldn't convert to a value"),"ERR_INVALID_RECORD_RECEIVED")}if(u.pubKey)return this._validateRecord(t,u);try{h=await this._routing.get(r.toBuffer())}catch(l){if(c.error(l),l.code===f)throw o(new Error("public key requested for ".concat(e," was not found in the network")),"ERR_NO_RECORD_FOUND");throw o(new Error("unexpected error getting the public key for the ipns record ".concat(t.id)),"ERR_UNEXPECTED_ERROR_GETTING_PUB_KEY")}try{t.pubKey=i.keys.unmarshalPublicKey(h)}catch(l){throw c.error(l),o(new Error("found public key record that we couldn't convert to a value"),"ERR_INVALID_PUB_KEY_RECEIVED")}return this._validateRecord(t,u)}async _validateRecord(e,t){const r=await n.extractPublicKey(e,t);return await n.validate(r,t),t.value.toString()}}},function(e,t,r){"use strict";const n=r(16),{Buffer:i}=r(0),s=n(r(712)).Record,o=r(713);class a{constructor(e,t,r){if(e&&!i.isBuffer(e))throw new Error("key must be a Buffer");if(t&&!i.isBuffer(t))throw new Error("value must be a buffer");this.key=e,this.value=t,this.timeReceived=r}serialize(){return s.encode(this.prepareSerialize())}prepareSerialize(){return{key:this.key,value:this.value,timeReceived:this.timeReceived&&o.toRFC3339(this.timeReceived)}}static deserialize(e){const t=s.decode(e);return a.fromDeserialized(t)}static fromDeserialized(e){let t;e.timeReceived&&(t=o.parseRFC3339(e.timeReceived));return new a(e.key,e.value,t)}}e.exports=a},function(e,t,r){"use strict";e.exports="// Record represents a dht record that contains a value\n// for a key value pair\nmessage Record {\n // The key that references this record\n bytes key = 1;\n\n // The actual value this record is storing\n bytes value = 2;\n\n // Note: These fields were removed from the Record message\n // hash of the authors public key\n // optional bytes author = 3;\n // A PKI signature for the key+value+author\n // optional bytes signature = 4;\n\n // Time the record was received, set by receiver\n optional string timeReceived = 5;\n}"},function(e,t,r){"use strict";e.exports.toRFC3339=e=>{const t=e.getUTCFullYear(),r=String(e.getUTCMonth()+1).padStart(2,"0"),n=String(e.getUTCDate()).padStart(2,"0"),i=String(e.getUTCHours()).padStart(2,"0"),s=String(e.getUTCMinutes()).padStart(2,"0"),o=String(e.getUTCSeconds()).padStart(2,"0"),a=1e3*e.getUTCMilliseconds()*1e3;return"".concat(t,"-").concat(r,"-").concat(n,"T").concat(i,":").concat(s,":").concat(o,".").concat(a,"Z")},e.exports.parseRFC3339=e=>{const t=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),r=String(e).trim().match(t);if(!r)throw new Error("Invalid format");const n=parseInt(r[1],10),i=parseInt(r[2],10)-1,s=parseInt(r[3],10),o=parseInt(r[4],10),a=parseInt(r[5],10),c=parseInt(r[6],10),u=parseInt(r[7].slice(0,-6),10);return new Date(Date.UTC(n,i,s,o,a,c,u))}},function(e,t,r){"use strict";const n=r(1);e.exports={verifyRecord:(e,t)=>{const r=t.key,i=r.toString().split("/");if(i.length<3)return;const s=e[i[1].toString()];if(!s){throw n(new Error("Invalid record keytype"),"ERR_INVALID_RECORD_KEY_TYPE")}return s.func(r,t.value)},validators:r(715)}},function(e,t,r){"use strict";e.exports={pk:r(716)}},function(e,t,r){"use strict";const n=r(717),i=r(1),{Buffer:s}=r(0);e.exports={func:async(e,t)=>{if(!s.isBuffer(e))throw i(new Error('"key" must be a Buffer'),"ERR_INVALID_RECORD_KEY_NOT_BUFFER");if(e.length<5)throw i(new Error("invalid public key record"),"ERR_INVALID_RECORD_KEY_TOO_SHORT");if("/pk/"!==e.slice(0,4).toString())throw i(new Error("key was not prefixed with /pk/"),"ERR_INVALID_RECORD_KEY_BAD_PREFIX");const r=e.slice(4),o=await n(t,"sha2-256");if(!r.equals(o))throw i(new Error("public key does not match passed in key"),"ERR_INVALID_RECORD_HASH_MISMATCH")},sign:!1}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(1),s=r(301),o=r(723);async function a(e,t,r){const n=await a.digest(e,t,r);return s.encode(n,t,r)}a.Buffer=n,a.multihash=s,a.digest=async(e,t,r)=>{const n=a.createHash(t),i=await n(e);return r?i.slice(0,r):i},a.createHash=function(e){if(!e)throw i(new Error("hash algorithm must be specified"),"ERR_HASH_ALGORITHM_NOT_SPECIFIED");if(e=s.coerceCode(e),!a.functions[e])throw i(new Error("multihash function '".concat(e,"' not yet supported")),"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return a.functions[e]},a.functions={0:o.identity,17:o.sha1,18:o.sha2256,19:o.sha2512,20:o.sha3512,21:o.sha3384,22:o.sha3256,23:o.sha3224,24:o.shake128,25:o.shake256,26:o.keccak224,27:o.keccak256,28:o.keccak384,29:o.keccak512,34:o.murmur3128,35:o.murmur332,86:o.dblSha2256},o.addBlake(a.functions),a.validate=async(e,t)=>{const r=await a(e,s.decode(t).name);return 0===n.compare(t,r)},e.exports=a},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(719);function s(e){if(i.names[e])return i.names[e];if(i.codes[e])return i.codes[e];throw new Error("Unsupported encoding: ".concat(e))}(t=e.exports=function(e,t){if(!t)throw new Error("requires an encoded buffer");const r=s(e);return function(e,t){s(e).decode(t.toString())}(r.name,t),n.concat([r.codeBuf,t])}).encode=function(e,t){const r=s(e);return n.concat([r.codeBuf,n.from(r.encode(t))])},t.decode=function(e){n.isBuffer(e)&&(e=e.toString());const t=e[0];["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(t)&&(e=e.toLowerCase());const r=s(e[0]);return n.from(r.decode(e.substring(1)))},t.isEncoded=function(e){if(n.isBuffer(e)&&(e=e.toString()),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return s(e[0]).name}catch(t){return!1}},t.encoding=s,t.encodingFromData=function(e){return n.isBuffer(e)&&(e=e.toString()),s(e[0])},t.names=Object.freeze(i.names),t.codes=Object.freeze(i.codes)},function(e,t,r){"use strict";const n=r(42),{Buffer:i}=r(0),s=r(720),o=r(721),a=[["identity","\0",()=>({encode:e=>i.from(e).toString(),decode:e=>i.from(e)}),""],["base2","0",o(1),"01"],["base8","7",o(3),"01234567"],["base10","9",n,"0123456789"],["base16","f",o(4),"0123456789abcdef"],["base16upper","F",o(4),"0123456789ABCDEF"],["base32hex","v",o(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",o(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",o(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",o(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",o(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",o(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",o(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",o(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",o(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",n,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",n,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",n,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",n,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",o(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",o(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",o(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",o(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],c=a.reduce((e,t)=>(e[t[0]]=new s(t[0],t[1],t[2],t[3]),e),{}),u=a.reduce((e,t)=>(e[t[1]]=c[t[0]],e),{});e.exports={names:c,codes:u}},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports=class{constructor(e,t,r,i){this.name=e,this.code=t,this.codeBuf=n.from(this.code),this.alphabet=i,this.engine=r(i)}encode(e){return this.engine.encode(e)}decode(e){for(const t of e)if(this.alphabet&&this.alphabet.indexOf(t)<0)throw new Error("invalid character '".concat(t,"' in '").concat(e,"'"));return this.engine.decode(e)}}},function(e,t,r){"use strict";e.exports=e=>t=>({encode:r=>((e,t,r)=>{const n="="===t[t.length-1],i=(1<<r)-1;let s="",o=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],o+=8;o>r;)o-=r,s+=t[i&a>>o];if(o&&(s+=t[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s})(r,t,e),decode:r=>((e,t,r)=>{const n={};for(let u=0;u<t.length;++u)n[t[u]]=u;let i=e.length;for(;"="===e[i-1];)--i;const s=new Uint8Array(i*r/8|0);let o=0,a=0,c=0;for(let u=0;u<i;++u){const t=n[e[u]];if(void 0===t)throw new SyntaxError("Invalid character "+e[u]);a=a<<r|t,o+=r,o>=8&&(o-=8,s[c++]=255&a>>o)}if(o>=r||255&a<<8-o)throw new SyntaxError("Unexpected end of data");return s})(r,t,e)})},function(e,t,r){"use strict";const n=Object.freeze({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,blake3:30,"murmur3-128":34,"murmur3-32":35,"dbl-sha2-256":86,md4:212,md5:213,bmt:214,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,x11:4352,"sm3-256":21325,"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,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082});e.exports={names:n}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(34),s=r(35),{factory:o}=r(724),{fromNumberTo32BitBuf:a}=r(725),c=e=>async t=>{switch(e){case"sha3-224":return n.from(i.sha3_224.arrayBuffer(t));case"sha3-256":return n.from(i.sha3_256.arrayBuffer(t));case"sha3-384":return n.from(i.sha3_384.arrayBuffer(t));case"sha3-512":return n.from(i.sha3_512.arrayBuffer(t));case"shake-128":return n.from(i.shake128.create(128).update(t).arrayBuffer());case"shake-256":return n.from(i.shake256.create(256).update(t).arrayBuffer());case"keccak-224":return n.from(i.keccak224.arrayBuffer(t));case"keccak-256":return n.from(i.keccak256.arrayBuffer(t));case"keccak-384":return n.from(i.keccak384.arrayBuffer(t));case"keccak-512":return n.from(i.keccak512.arrayBuffer(t));case"murmur3-128":return n.from(s.x64.hash128(t),"hex");case"murmur3-32":return a(s.x86.hash32(t));default:throw new TypeError("".concat(e," is not a supported algorithm"))}};e.exports={identity:e=>n.from(e),sha1:o("sha1"),sha2256:o("sha2-256"),sha2512:o("sha2-512"),dblSha2256:o("dbl-sha2-256"),sha3224:c("sha3-224"),sha3256:c("sha3-256"),sha3384:c("sha3-384"),sha3512:c("sha3-512"),shake128:c("shake-128"),shake256:c("shake-256"),keccak224:c("keccak-224"),keccak256:c("keccak-256"),keccak384:c("keccak-384"),keccak512:c("keccak-512"),murmur3128:c("murmur3-128"),murmur332:c("murmur3-32"),addBlake:r(726)}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(301),s=self.crypto||self.msCrypto,o=async(e,t)=>{if("undefined"==typeof self||!self.crypto&&!self.msCrypto)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");switch(t){case"sha1":return n.from(await s.subtle.digest({name:"SHA-1"},e));case"sha2-256":return n.from(await s.subtle.digest({name:"SHA-256"},e));case"sha2-512":return n.from(await s.subtle.digest({name:"SHA-512"},e));case"dbl-sha2-256":{const t=await s.subtle.digest({name:"SHA-256"},e);return n.from(await s.subtle.digest({name:"SHA-256"},t))}default:throw new Error("".concat(t," is not a supported algorithm"))}};e.exports={factory:e=>async t=>o(t,e),digest:o,multihashing:async(e,t,r)=>{const n=await o(e,t);return i.encode(n,t,r)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports={fromNumberTo32BitBuf:e=>{const t=new Array(4);for(let r=0;r<4;r++)t[r]=255&e,e>>=8;return n.from(t)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(36),s={init:i.blake2bInit,update:i.blake2bUpdate,digest:i.blake2bFinal},o={init:i.blake2sInit,update:i.blake2sUpdate,digest:i.blake2sFinal},a=(e,t)=>async r=>{const i=t.init(e,null);return t.update(i,r),n.from(t.digest(i))};e.exports=e=>{for(let t=0;t<64;t++)e[45569+t]=a(t+1,s);for(let t=0;t<32;t++)e[45633+t]=a(t+1,o)}},function(e,t,r){"use strict";const n=r(1);e.exports={bestRecord:(e,t,r)=>{if(0===r.length){throw n(new Error("No records given"),"ERR_NO_RECORDS_RECEIVED")}const i=t.toString().split("/");if(i.length<3){throw n(new Error("Record key does not have a selector function"),"ERR_NO_SELECTOR_FUNCTION_FOR_RECORD_KEY")}const s=e[i[1].toString()];if(!s){const e="Unrecognized key prefix: ".concat(i[1]);throw n(new Error(e),"ERR_UNRECOGNIZED_KEY_PREFIX")}return s(t,r)},selectors:r(728)}},function(e,t,r){"use strict";e.exports={pk:r(729)}},function(e,t,r){"use strict";e.exports=(e,t)=>0},function(e,t,r){"use strict";e.exports=()=>{}},function(e,t,r){"use strict";e.exports=({libp2p:e})=>()=>Boolean(e&&e.isStarted())},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=({keychain:e})=>n((t,r,n={})=>e.exportKey(t,r,n))},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=({keychain:e})=>n((t,r)=>(r=r||{},e.createKey(t,r.type||"rsa",r.size||2048)))},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=({keychain:e})=>n((t,r,n,i)=>e.importKey(t,r,n,i))},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=({keychain:e})=>n((t,r)=>e.findKeyByName(t,r))},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=({keychain:e})=>n(t=>e.listKeys(t))},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=({keychain:e})=>n(async(t,r,n)=>{const i=await e.renameKey(t,r,n);return{was:t,now:i.name,id:i.id,overwrite:!1}})},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=({keychain:e})=>n((t,r)=>e.removeKey(t,r))},function(e,t,r){"use strict";const n=r(165),i=r(26),s=r(1),o=r(740);e.exports=({options:e,peerId:t,multiaddrs:a=[],repo:c,keychainConfig:u={},config:f})=>{e=e||{},f=f||{};const{datastore:h,keys:l}=c,d=function({options:e,config:t,datastore:a,keys:c,keychainConfig:u,peerId:f,multiaddrs:h}){const l={datastore:a,peerId:f,modules:{}},d={modules:{pubsub:(()=>{const e=n(t,"Pubsub.Router")||"gossipsub";if(!o[e])throw s(new Error("Router unavailable. Configure libp2p.modules.pubsub to use the ".concat(e," router.")),"ERR_NOT_SUPPORTED");return o[e]})()},config:{peerDiscovery:{mdns:{enabled:n(e,"config.Discovery.MDNS.Enabled",n(t,"Discovery.MDNS.Enabled",!0))},webRTCStar:{enabled:n(e,"config.Discovery.webRTCStar.Enabled",n(t,"Discovery.webRTCStar.Enabled",!0))},bootstrap:{list:n(e,"config.Bootstrap",n(t,"Bootstrap",[]))}},relay:{enabled:n(e,"relay.enabled",n(t,"relay.enabled",!0)),hop:{enabled:n(e,"relay.hop.enabled",n(t,"relay.hop.enabled",!1)),active:n(e,"relay.hop.active",n(t,"relay.hop.active",!1))}},dht:{enabled:"none"!==n(t,"Routing.Type","none"),clientMode:"dhtserver"!==n(t,"Routing.Type","dht"),kBucketSize:n(e,"dht.kBucketSize",20)},pubsub:{enabled:n(e,"config.Pubsub.Enabled",n(t,"Pubsub.Enabled",!0))}},addresses:{listen:h},connectionManager:n(e,"connectionManager",{maxConnections:n(e,"config.Swarm.ConnMgr.HighWater",n(t,"Swarm.ConnMgr.HighWater")),minConnections:n(e,"config.Swarm.ConnMgr.LowWater",n(t,"Swarm.ConnMgr.LowWater"))}),keychain:{datastore:c,...u}},p=r(832);let b=n(e,"libp2p",{});"function"==typeof b&&(b={});const y=i(l,p(),d,b);n(y,"config.peerDiscovery.bootstrap.list",[]).length>0&&y.modules.peerDiscovery.push(r(1002));return y}({options:e,config:f,datastore:h,keys:l,keychainConfig:u,peerId:t,multiaddrs:a});if("function"==typeof e.libp2p)return e.libp2p({libp2pOptions:d,options:e,config:f,datastore:h,peerId:t});return new(r(767))(d)}},function(e,t,r){"use strict";e.exports={gossipsub:r(303)}},function(e,t,r){"use strict";e.exports="\nmessage RPC {\n repeated SubOpts subscriptions = 1;\n repeated Message msgs = 2;\n\n message SubOpts {\n optional bool subscribe = 1; // subscribe or unsubcribe\n optional string topicID = 2;\n }\n\n message Message {\n optional bytes from = 1;\n optional bytes data = 2;\n optional bytes seqno = 3;\n repeated string topicIDs = 4;\n optional bytes signature = 5;\n optional bytes key = 6;\n }\n}"},function(e,t,r){"use strict";e.exports="\n// topicCID = cid(merkledag_protobuf(topicDescriptor)); (not the topic.name)\nmessage TopicDescriptor {\n optional string name = 1;\n optional AuthOpts auth = 2;\n optional EncOpts enc = 2;\n\n message AuthOpts {\n optional AuthMode mode = 1;\n repeated bytes keys = 2; // root keys to trust\n\n enum AuthMode {\n NONE = 0; // no authentication, anyone can publish\n KEY = 1; // only messages signed by keys in the topic descriptor are accepted\n WOT = 2; // web of trust, certificates can allow publisher set to grow\n }\n }\n\n message EncOpts {\n optional EncMode mode = 1;\n repeated bytes keyHashes = 2; // the hashes of the shared keys used (salted)\n\n enum EncMode {\n NONE = 0; // no encryption, anyone can read\n SHAREDKEY = 1; // messages are encrypted with shared key\n WOT = 2; // web of trust, certificates can allow publisher set to grow\n }\n }\n}"},function(e,t,r){"use strict";const n=r(13),i=r(25),s=r(79),o=r(19),a=r(2),c=a("libp2p-pubsub:peer");c.error=a("libp2p-pubsub:peer:error");const{RPC:u}=r(168);e.exports=class extends n{constructor({id:e,protocols:t}){super(),this.id=e,this.protocols=t,this.conn=null,this.topics=new Set,this.stream=null}get isConnected(){return Boolean(this.conn)}get isWritable(){return Boolean(this.stream)}write(e){if(!this.isWritable){const e=this.id.toB58String();throw new Error("No writable connection to "+e)}this.stream.push(e)}async attachConnection(e){const t=this.stream;t&&await t.end(!1),this.stream=s({onEnd:e=>{this.conn.reset&&this.conn.reset(),this.conn=null,this.stream=null,!1!==e&&this.emit("close")}}),this.conn=e,o(this.stream,i.encode(),e).catch(e=>{c.error(e)}),t||this.emit("connection")}_sendRawSubscriptions(e,t){if(0===e.size)return;const r=[];e.forEach(e=>{r.push({subscribe:t,topicID:e})}),this.write(u.encode({subscriptions:r}))}sendSubscriptions(e){this._sendRawSubscriptions(e,!0)}sendUnsubscriptions(e){this._sendRawSubscriptions(e,!1)}sendMessages(e){this.write(u.encode({msgs:e}))}updateSubscriptions(e){e.forEach(e=>{e.subscribe?this.topics.add(e.topicID):this.topics.delete(e.topicID)})}close(){this.stream&&this.stream.end(),this.conn=null,this.stream=null,this.emit("close")}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(30),s=r(305);function o(e){e=e||{};const t=Math.max(e.poolSize||10240,e.minPoolSize||8),r=e.lengthEncoder||s;return e=>async function*(){let s=n.alloc(t),o=0;for await(const a of e){r(a.length,s,o);const e=s.slice(o,o+r.bytes);o+=r.bytes,s.length-o<8&&(s=n.alloc(t),o=0),yield(new i).append(e).append(a)}}()}o.single=(e,t)=>{const r=(t=t||{}).lengthEncoder||s;return new i([r(e.length),e])},e.exports=o,e.exports.MIN_POOL_SIZE=8,e.exports.DEFAULT_POOL_SIZE=10240},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(30),s=r(306),o=n.alloc(0),a="readLength",c="readData",u={[a]:(e,t,r,n)=>{let s;t=t.append(e);try{s=n.lengthDecoder(t)}catch(u){if(t.length>n.maxLengthLength)throw Object.assign(u,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(u instanceof RangeError)return{mode:a,buffer:t};throw u}if(s>n.maxDataLength)throw Object.assign(new Error("message data too long"),{code:"ERR_MSG_DATA_TOO_LONG"});return e=t.shallowSlice(n.lengthDecoder.bytes),t=new i,n.onLength&&n.onLength(s),s<=0?(n.onData&&n.onData(o),{mode:a,chunk:e,buffer:t,data:o}):{mode:c,chunk:e,buffer:t,state:{dataLength:s}}},[c]:(e,t,r,n)=>{if((t=t.append(e)).length<r.dataLength)return{mode:c,buffer:t,state:r};const{dataLength:s}=r,o=t.shallowSlice(0,s);return e=t.length>s?t.shallowSlice(s):null,t=new i,n.onData&&n.onData(o),{mode:a,chunk:e,buffer:t,data:o}}};function f(e){return(e=e||{}).lengthDecoder=e.lengthDecoder||s,e.maxLengthLength=e.maxLengthLength||8,e.maxDataLength=e.maxDataLength||4194304,t=>async function*(){let r,n=new i,s=a;for await(let i of t)for(;i;){const t=u[s](i,n,r,e);({mode:s,chunk:i,buffer:n,state:r}=t),t.data&&(yield t.data)}if(n.length)throw Object.assign(new Error("unexpected end of input"),{code:"ERR_UNEXPECTED_EOF"})}()}f.fromReader=(e,t)=>{t=t||{};let r=1;const n={[Symbol.asyncIterator](){return this},next:async()=>{try{return await e.next(r)}catch(t){if("ERR_UNDER_READ"===t.code)return{done:!0,value:null};throw t}finally{r=1}}};return t.onLength=e=>{r=e},f(t)(n)},e.exports=f,e.exports.MAX_LENGTH_LENGTH=8,e.exports.MAX_DATA_LENGTH=4194304},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=(e,t,r)=>((t=t||n.allocUnsafe(4)).writeInt32BE(e,r),t);i.bytes=4,e.exports=i},function(e,t,r){"use strict";const n=e=>{if(e.length<4)throw RangeError("Could not decode int32BE");return e.readInt32BE(0)};n.bytes=4,e.exports=n},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(28),s=r(749);(t=e.exports).randomSeqno=()=>i.randomBytes(8),t.msgId=(e,t)=>e+t.toString("hex"),t.anyMatch=(e,t)=>{let r;r=Array.isArray(t)?e=>t.indexOf(e)>-1:e=>t.has(e);for(const n of e)if(r(n))return!0;return!1},t.ensureArray=e=>Array.isArray(e)?e:[e],t.normalizeInRpcMessage=e=>{const t=Object.assign({},e);return n.isBuffer(e.from)&&(t.from=s.encode("base58btc",e.from).toString().slice(1)),t},t.normalizeInRpcMessages=e=>e?e.map(t.normalizeInRpcMessage):e,t.normalizeOutRpcMessage=e=>{const t=Object.assign({},e);return("string"==typeof e.from||e.from instanceof String)&&(t.from=s.decode("z"+e.from)),t},t.normalizeOutRpcMessages=e=>e?e.map(t.normalizeOutRpcMessage):e},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(750);function s(e,t){if(!t)throw new Error("requires an encoded buffer");const r=o(e),i=n.from(r.code);return function(e,t){o(e).decode(t.toString())}(r.name,t),n.concat([i,t])}function o(e){let t;if(i.names[e])t=i.names[e];else{if(!i.codes[e])throw new Error("Unsupported encoding");t=i.codes[e]}if(!t.isImplemented())throw new Error("Base "+e+" is not implemented yet");return t}(t=e.exports=s).encode=function(e,t){const r=o(e);return s(r.name,n.from(r.encode(t)))},t.decode=function(e){n.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);"string"==typeof(e=e.substring(1,e.length))&&(e=n.from(e));const r=o(t);return n.from(r.decode(e.toString()))},t.isEncoded=function(e){n.isBuffer(e)&&(e=e.toString());if("[object String]"!==Object.prototype.toString.call(e))return!1;const t=e.substring(0,1);try{return o(t).name}catch(r){return!1}},t.names=Object.freeze(Object.keys(i.names)),t.codes=Object.freeze(Object.keys(i.codes))},function(e,t,r){"use strict";const n=r(751),i=r(42),s=r(752),o=r(753),a=r(754),c=[["base1","1","","1"],["base2","0",i,"01"],["base8","7",i,"01234567"],["base10","9",i,"0123456789"],["base16","f",s,"0123456789abcdef"],["base32","b",o,"abcdefghijklmnopqrstuvwxyz234567"],["base32pad","c",o,"abcdefghijklmnopqrstuvwxyz234567="],["base32hex","v",o,"0123456789abcdefghijklmnopqrstuv"],["base32hexpad","t",o,"0123456789abcdefghijklmnopqrstuv="],["base32z","h",o,"ybndrfg8ejkmcpqxot1uwisza345h769"],["base58flickr","Z",i,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base58btc","z",i,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base64","m",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],u=c.reduce((e,t)=>(e[t[0]]=new n(t[0],t[1],t[2],t[3]),e),{}),f=c.reduce((e,t)=>(e[t[1]]=u[t[0]],e),{});e.exports={names:u,codes:f}},function(e,t,r){"use strict";e.exports=class{constructor(e,t,r,n){this.name=e,this.code=t,this.alphabet=n,r&&n&&(this.engine=r(n))}encode(e){return this.engine.encode(e)}decode(e){return this.engine.decode(e)}isImplemented(){return this.engine}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports=function(e){return{encode:e=>"string"==typeof e?n.from(e).toString("hex"):e.toString("hex"),decode(t){for(const r of t)if(e.indexOf(r)<0)throw new Error("invalid base16 character");return n.from(t,"hex")}}}},function(e,t,r){"use strict";function n(e,t){const r=e.byteLength,n=new Uint8Array(e),i=t.indexOf("=")===t.length-1;i&&(t=t.substring(0,t.length-1));let s=0,o=0,a="";for(let c=0;c<r;c++)for(o=o<<8|n[c],s+=8;s>=5;)a+=t[o>>>s-5&31],s-=5;if(s>0&&(a+=t[o<<5-s&31]),i)for(;a.length%8!=0;)a+="=";return a}e.exports=function(e){return{encode:t=>n("string"==typeof t?Uint8Array.from(t):t,e),decode(t){for(const r of t)if(e.indexOf(r)<0)throw new Error("invalid base32 character");return function(e,t){const r=(e=e.replace(new RegExp("=","g"),"")).length;let n=0,i=0,s=0;const o=new Uint8Array(5*r/8|0);for(let a=0;a<r;a++)i=i<<5|t.indexOf(e[a]),n+=5,n>=8&&(o[s++]=i>>>n-8&255,n-=8);return o.buffer}(t,e)}}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports=function(e){const t=e.indexOf("=")>-1,r=e.indexOf("-")>-1&&e.indexOf("_")>-1;return{encode(e){let i="";i="string"==typeof e?n.from(e).toString("base64"):e.toString("base64"),r&&(i=i.replace(/\+/g,"-").replace(/\//g,"_"));const s=i.indexOf("=");return s>0&&!t&&(i=i.substring(0,s)),i},decode(t){for(const r of t)if(e.indexOf(r)<0)throw new Error("invalid base64 character");return n.from(t,"base64")}}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(6),{Message:s}=r(168),o=n.from("libp2p-pubsub:");async function a(e){if(e.key){const t=await i.createFromPubKey(e.key);if(t.isEqual(e.from))return t.pubKey;throw new Error("Public Key does not match the originator")}{const t=i.createFromBytes(e.from);if(t.pubKey)return t.pubKey;throw new Error("Could not get the public key from the originator id")}}e.exports={messagePublicKey:a,signMessage:async function(e,t){const r=n.concat([o,s.encode(t)]),i=await e.privKey.sign(r);return{...t,signature:i,key:e.pubKey.bytes}},SignPrefix:o,verifySignature:async function(e){const t={...e};delete t.signature,delete t.key;const r=n.concat([o,s.encode(t)]);return(await a(e)).verify(r,e.signature)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageCache=void 0;t.MessageCache=class{constructor(e,t,r){this.msgs=new Map,this.history=[];for(let n=0;n<t;n++)this.history[n]=[];this.gossip=e,this.msgIdFn=r}put(e){const t=this.getMsgId(e);this.msgs.set(t,e),this.history[0].push({msgID:t,topics:e.topicIDs})}getMsgId(e){return this.msgIdFn(e)}get(e){return this.msgs.get(e)}getGossipIDs(e){const t=[];for(let r=0;r<this.gossip;r++)this.history[r].forEach(r=>{for(const n of r.topics)if(n===e){t.push(r.msgID);break}});return t}shift(){this.history[this.history.length-1].forEach(e=>{this.msgs.delete(e.msgID)}),this.history.pop(),this.history.unshift([])}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default="\nmessage RPC {\n repeated SubOpts subscriptions = 1;\n repeated Message msgs = 2;\n optional ControlMessage control = 3;\n\n message SubOpts {\n optional bool subscribe = 1; // subscribe or unsubcribe\n optional string topicID = 2;\n }\n\n message Message {\n optional bytes from = 1;\n optional bytes data = 2;\n optional bytes seqno = 3;\n repeated string topicIDs = 4; \n optional bytes signature = 5;\n optional bytes key = 6;\n }\n\n message ControlMessage {\n repeated ControlIHave ihave = 1;\n repeated ControlIWant iwant = 2;\n repeated ControlGraft graft = 3;\n repeated ControlPrune prune = 4;\n }\n\n message ControlIHave {\n optional string topicID = 1;\n repeated string messageIDs = 2;\n }\n\n message ControlIWant {\n repeated string messageIDs = 1; \n }\n\n message ControlGraft {\n optional string topicID = 1;\n }\n\n message ControlPrune {\n optional string topicID = 1;\n }\n}"},function(e,t,r){"use strict";var n=Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]},i=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Heartbeat=void 0;const o=s(r(169)),a=r(308),c=r(170),u=r(1);t.Heartbeat=class{constructor(e){this.gossipsub=e}start(){if(this._heartbeatTimer){const e="Heartbeat timer is already running";throw this.gossipsub.log(e),u(new Error(e),"ERR_HEARTBEAT_ALREADY_RUNNING")}const e=this._heartbeat.bind(this),t=setTimeout(()=>{e(),this._heartbeatTimer.runPeriodically(e,o.GossipsubHeartbeatInterval)},o.GossipsubHeartbeatInitialDelay);this._heartbeatTimer={_intervalId:void 0,runPeriodically:(e,t)=>{this._heartbeatTimer._intervalId=setInterval(e,t)},cancel:()=>{clearTimeout(t),clearInterval(this._heartbeatTimer._intervalId)}}}stop(){if(!this._heartbeatTimer){const e="Heartbeat timer is not running";throw this.gossipsub.log(e),u(new Error(e),"ERR_HEARTBEAT_NO_RUNNING")}this._heartbeatTimer.cancel(),this._heartbeatTimer=null}_heartbeat(){this.gossipsub._flush();const e=new Map,t=new Map;this.gossipsub.mesh.forEach((r,n)=>{if(r.size<o.GossipsubDlo){const t=o.GossipsubD-r.size;a.getGossipPeers(this.gossipsub,n,t).forEach(t=>{if(r.has(t))return;this.gossipsub.log("HEARTBEAT: Add mesh link to %s in %s",t.id.toB58String(),n),r.add(t);const i=e.get(t);i?i.push(n):e.set(t,[n])})}if(r.size>o.GossipsubDhi){const e=r.size-o.GossipsubD;let i=Array.from(r);i=c.shuffle(i),i=i.slice(0,e),i.forEach(e=>{this.gossipsub.log("HEARTBEAT: Remove mesh link to %s in %s",e.id.toB58String(),n),r.delete(e);const i=t.get(e);i?i.push(n):t.set(e,[n])})}this.gossipsub._emitGossip(n,r)});const r=this.gossipsub._now();this.gossipsub.lastpub.forEach((e,t)=>{e+o.GossipsubFanoutTTL<r&&(this.gossipsub.fanout.delete(t),this.gossipsub.lastpub.delete(t))}),this.gossipsub.fanout.forEach((e,t)=>{const r=this.gossipsub.topics.get(t);if(e.forEach(t=>{r.has(t)&&e.delete(t)}),e.size<o.GossipsubD){const r=o.GossipsubD-e.size;a.getGossipPeers(this.gossipsub,t,r).forEach(t=>{e.has(t)&&e.add(t)})}this.gossipsub._emitGossip(t,e)}),this.gossipsub._sendGraftPrune(e,t),this.gossipsub.messageCache.shift(),this.gossipsub.emit("gossipsub:heartbeat")}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createGossipRpc=void 0,t.createGossipRpc=function(e=[],t={}){return{subscriptions:[],msgs:e,control:Object.assign({ihave:[],iwant:[],graft:[],prune:[]},t)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shuffle=void 0,t.shuffle=function(e){if(e.length<=1)return e;for(let t=0;t<e.length;t++){const r=Math.floor(Math.random()*Math.floor(e.length)),n=e[t];e[t]=e[r],e[r]=n}return e}},function(e,t,r){"use strict";const n=r(762);e.exports=function e(t){if(!(this instanceof e))return new e(t);const r=(t=t||{}).validity||30,i=new Map,s=n(()=>{i.forEach((e,t)=>{const n=e.validity||r;(function(e){const t=(new Date).getTime()-e.getTime();return Math.floor(t/1e3)})(e.timestamp)>n&&i.delete(t)})},200);this.put=(e,t,r)=>{this.has(e)||i.set(e,{value:t,timestamp:new Date,validity:r}),s()},this.get=e=>{if(i.has(e))return i.get(e).value;throw new Error("key does not exist")},this.has=e=>i.has(e)}},function(e,t,r){"use strict";(function(t){var r=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt,a="object"==typeof t&&t&&t.Object===Object&&t,c="object"==typeof self&&self&&self.Object===Object&&self,u=a||c||Function("return this")(),f=Object.prototype.toString,h=Math.max,l=Math.min,d=function(){return u.Date.now()};function p(e,t,r){var n,i,s,o,a,c,u=0,f=!1,p=!1,m=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function g(t){var r=n,s=i;return n=i=void 0,u=t,o=e.apply(s,r)}function v(e){return u=e,a=setTimeout(_,t),f?g(e):o}function w(e){var r=e-c;return void 0===c||r>=t||r<0||p&&e-u>=s}function _(){var e=d();if(w(e))return E(e);a=setTimeout(_,function(e){var r=t-(e-c);return p?l(r,s-(e-u)):r}(e))}function E(e){return a=void 0,m&&n?g(e):(n=i=void 0,o)}function k(){var e=d(),r=w(e);if(n=arguments,i=this,c=e,r){if(void 0===a)return v(c);if(p)return a=setTimeout(_,t),g(c)}return void 0===a&&(a=setTimeout(_,t)),o}return t=y(t)||0,b(r)&&(f=!!r.leading,s=(p="maxWait"in r)?h(y(r.maxWait)||0,t):s,m="trailing"in r?!!r.trailing:m),k.cancel=function(){void 0!==a&&clearTimeout(a),u=0,n=c=i=a=void 0},k.flush=function(){return void 0===a?o:E(d())},k}function b(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function y(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==f.call(e)}(e))return NaN;if(b(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=b(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(r,"");var a=i.test(e);return a||s.test(e)?o(e.slice(2),a?2:8):n.test(e)?NaN:+e}e.exports=function(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return b(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),p(e,t,{leading:n,maxWait:t,trailing:i})}}).call(this,r(10))},function(e,t,r){"use strict";var n=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{c(n.next(e))}catch(t){s(t)}}function a(e){try{c(n.throw(e))}catch(t){s(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))},i=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,i){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,i,(t=e[r](t)).done,t.value)}))}}};const s=r(1),{Buffer:o}=r(0),a=r(6),c=r(19),u=r(25),f=r(106),h=r(166),{utils:l}=r(166),{RPCCodec:d}=r(307);e.exports=class extends h{constructor({debugName:e,multicodecs:t,peerId:r,registrar:n,options:i={}}){if(!a.isPeerId(r))throw new Error("peerId must be an instance of `peer-id`");const s=Object.assign({emitSelf:!1},i);super(Object.assign({debugName:e,multicodecs:t,peerId:r,registrar:n},s)),this.subscriptions=new Set,this._options=s,this.defaultMsgIdFn=e=>l.msgId(e.from,e.seqno),this.topicValidators=new Map}_onPeerConnected(e,t){const r=Object.create(null,{_onPeerConnected:{get:()=>super._onPeerConnected}});return n(this,void 0,void 0,(function*(){yield r._onPeerConnected.call(this,e,t);const n=e.toB58String(),i=this.peers.get(n);i&&i.isWritable&&i.sendSubscriptions(this.subscriptions)}))}_processMessages(e,t,r){return n(this,void 0,void 0,(function*(){try{yield c(t,u.decode(),t=>{var s,a;return n(this,void 0,void 0,(function*(){var n,c;try{for(s=i(t);!(a=yield s.next()).done;){const t=a.value,n=o.isBuffer(t)?t:t.slice(),i=this._decodeRpc(n);this._processRpc(e,r,i)}}catch(u){n={error:u}}finally{try{a&&!a.done&&(c=s.return)&&(yield c.call(s))}finally{if(n)throw n.error}}}))})}catch(s){this._onPeerDisconnected(r.id,s)}}))}_decodeRpc(e){return d.decode(e)}_processRpc(e,t,r){this.log("rpc from",e);const i=r.subscriptions,s=r.msgs;i.length&&(t.updateSubscriptions(i),i.forEach(e=>this._processRpcSubOpt(t,e)),this.emit("pubsub:subscription-change",t.id,t.topics,i)),s.length&&s.forEach(e=>n(this,void 0,void 0,(function*(){const r=l.normalizeInRpcMessage(e);try{if(!(yield this.validate(e,t)))return void this.log("Message is invalid, dropping it.")}catch(n){return void this.log("Error in message validation, dropping it. %O",n)}this._processRpcMessage(t,r)})))}validate(e,t){const r=Object.create(null,{validate:{get:()=>super.validate}});return n(this,void 0,void 0,(function*(){return!!(yield r.validate.call(this,e,t))&&(!t||e.topicIDs.every(r=>{const n=this.topicValidators.get(r);return!n||this._processTopicValidatorResult(r,t,e,n(r,t,e))}))}))}_processTopicValidatorResult(e,t,r,n){return Boolean(n)}_processRpcSubOpt(e,t){const r=t.topicID;let n=this.topics.get(r);n||(n=new Set,this.topics.set(r,n)),t.subscribe?n.add(e):n.delete(e)}_processRpcMessage(e,t){(this.peerId.toB58String()!==t.from||this._options.emitSelf)&&this._emitMessage(t.topicIDs,t)}_emitMessage(e,t){e.forEach(e=>{this.subscriptions.has(e)&&this.emit(e,t)})}stop(){const e=Object.create(null,{stop:{get:()=>super.stop}});return n(this,void 0,void 0,(function*(){yield e.stop.call(this),this.subscriptions=new Set}))}subscribe(e){if(!this.started)throw new Error("Pubsub has not started");const t=(e=l.ensureArray(e)).filter(e=>!this.subscriptions.has(e));0!==t.length&&this._subscribe(t)}_subscribe(e){e.forEach(e=>{this.subscriptions.add(e)}),this.peers.forEach(t=>function t(r){if(r&&r.isWritable)return r.sendSubscriptions(e);const n=()=>{r.removeListener("connection",n),t(r)};r.on("connection",n),r.once("close",()=>r.removeListener("connection",n))}(t))}unsubscribe(e){if(!this.started)throw new Error("Pubsub has not started");const t=(e=l.ensureArray(e)).filter(e=>this.subscriptions.has(e));0!==t.length&&this._unsubscribe(t)}_unsubscribe(e){e.forEach(e=>{this.subscriptions.delete(e)}),this.peers.forEach(t=>function t(r){if(r&&r.isWritable)return r.sendUnsubscriptions(e);const n=()=>{r.removeListener("connection",n),t(r)};r.on("connection",n),r.once("close",()=>r.removeListener("connection",n))}(t))}publish(e,t){return n(this,void 0,void 0,(function*(){if(!this.started)throw new Error("Pubsub has not started");this.log("publish",e,t),e=l.ensureArray(e),t=l.ensureArray(t);const r=this.peerId.toB58String(),n=yield f(t,(t,n)=>{const i=l.randomSeqno(),s={from:r,data:t,seqno:i,topicIDs:e};return this._options.emitSelf&&this._emitMessages(e,[s]),this._buildMessage(s)});this._publish(l.normalizeOutRpcMessages(n))}))}getTopics(){if(!this.started)throw new Error("Pubsub is not started");return Array.from(this.subscriptions)}getMsgId(e){return this.defaultMsgIdFn(e)}_emitMessages(e,t){e.forEach(e=>{this.subscriptions.has(e)&&t.forEach(t=>{this.emit(e,t)})})}_publish(e){throw s(new Error("_publish must be implemented by the subclass"),"ERR_NOT_IMPLEMENTED")}}},function(e,t,r){"use strict";e.exports=(e,t=1,r)=>{if(r={indent:" ",includeEmptyLines:!1,...r},"string"!=typeof e)throw new TypeError("Expected `input` to be a `string`, got `".concat(typeof e,"`"));if("number"!=typeof t)throw new TypeError("Expected `count` to be a `number`, got `".concat(typeof t,"`"));if("string"!=typeof r.indent)throw new TypeError("Expected `options.indent` to be a `string`, got `".concat(typeof r.indent,"`"));if(0===t)return e;const n=r.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return e.replace(n,r.indent.repeat(t))}},function(e,t,r){"use strict";const n=r(766),i=/\s+at.*(?:\(|\s)(.*)\)?/,s=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,o=void 0===n.homedir?"":n.homedir();e.exports=(e,t)=>(t=Object.assign({pretty:!1},t),e.replace(/\\/g,"/").split("\n").filter(e=>{const t=e.match(i);if(null===t||!t[1])return!0;const r=t[1];return!r.includes(".app/Contents/Resources/electron.asar")&&!r.includes(".app/Contents/Resources/default_app.asar")&&!s.test(r)}).filter(e=>""!==e.trim()).map(e=>t.pretty?e.replace(i,(e,t)=>e.replace(t,t.replace(o,"~"))):e).join("\n"))},function(e,t){},function(e,t,r){"use strict";const{EventEmitter:n}=r(13),i=r(2),s=r(57),o=i("libp2p");o.error=i("libp2p:error");const a=r(6),c=r(768),u=r(772),f=r(773),h=r(310),{validate:l}=r(774),{codes:d}=r(20),p=r(779),b=r(780),y=r(783),m=r(788),g=r(791),v=r(803),w=r(311),_=r(806),E=r(318),k=r(819),S=r(823),A=r(824),{IdentifyService:I,multicodecs:T}=r(826);class R extends n{constructor(e){if(super(),this._options=l(e),this.peerId=this._options.peerId,this.datastore=this._options.datastore,this.peerStore=this.datastore&&this._options.peerStore.persistence?new k({datastore:this.datastore,...this._options.peerStore}):new E,this.addresses=this._options.addresses,this.addressManager=new p(this._options.addresses),this._modules=this._options.modules,this._config=this._options.config,this._transport=[],this._discovery=new Map,this._options.connectionManager.minPeers&&(this._options.connectionManager.minConnections=this._options.connectionManager.minPeers),this.connectionManager=new b(this,{autoDial:this._config.peerDiscovery.autoDial,...this._options.connectionManager}),this._options.metrics.enabled&&(this.metrics=new v({...this._options.metrics,connectionManager:this.connectionManager})),this._options.keychain&&this._options.keychain.datastore){o("creating keychain");const e=g.generateOptions();this.keychain=new g(this._options.keychain.datastore,{passPhrase:this._options.keychain.pass,...e,...this._options.keychain}),o("keychain constructed")}if(this.upgrader=new _({localPeer:this.peerId,metrics:this.metrics,onConnection:e=>this.connectionManager.onConnect(e),onConnectionEnd:e=>this.connectionManager.onDisconnect(e)}),this.transportManager=new w({libp2p:this,upgrader:this.upgrader,faultTolerance:this._options.transportManager.faultTolerance}),this.registrar=new S({peerStore:this.peerStore,connectionManager:this.connectionManager}),this.handle=this.handle.bind(this),this.registrar.handle=this.handle,this._modules.connEncryption){this._modules.connEncryption.forEach(e=>{this.upgrader.cryptos.set(e.protocol,e)})}if(this.dialer=new m({transportManager:this.transportManager,peerStore:this.peerStore,concurrency:this._options.dialer.maxParallelDials,perPeerLimit:this._options.dialer.maxDialsPerPeer,timeout:this._options.dialer.dialTimeout}),this._modules.transport.forEach(e=>{const t=e.prototype[Symbol.toStringTag],r=this._config.transport[t];this.transportManager.add(t,e,r)}),this._config.relay.enabled&&this.transportManager.add(y.prototype[Symbol.toStringTag],y),this._modules.streamMuxer){this._modules.streamMuxer.forEach(e=>{this.upgrader.muxers.set(e.multicodec,e)}),this.identifyService=new I({libp2p:this,protocols:this.upgrader.protocols}),this.handle(Object.values(T),this.identifyService.handleMessage)}if(this._modules.connProtector)this.upgrader.protector=this._modules.connProtector;else if(void 0!==s.process&&s.process.env&&s.process.env.LIBP2P_FORCE_PNET)throw new Error("Private network is enforced, but no protector was provided");if(this._modules.dht){const e=this._modules.dht;this._dht=new e({libp2p:this,dialer:this.dialer,peerId:this.peerId,peerStore:this.peerStore,registrar:this.registrar,datastore:this.datastore,...this._config.dht})}this._modules.pubsub&&(this.pubsub=f(this,this._modules.pubsub,this._config.pubsub)),this.peerRouting=c(this),this.contentRouting=u(this),A.mount(this),this._onDiscoveryPeer=this._onDiscoveryPeer.bind(this)}emit(e,...t){"error"!==e||this._events.error?super.emit(e,...t):o.error(...t)}async start(){o("libp2p is starting");try{await this._onStarting(),await this._onDidStart(),o("libp2p has started")}catch(e){throw this.emit("error",e),o.error("An error occurred starting libp2p",e),await this.stop(),e}}async stop(){o("libp2p is stopping");try{for(const e of this._discovery.values())e.removeListener("peer",this._onDiscoveryPeer);await Promise.all(Array.from(this._discovery.values(),e=>e.stop())),this._discovery=new Map,await this.peerStore.stop(),await this.connectionManager.stop(),await Promise.all([this.pubsub&&this.pubsub.stop(),this._dht&&this._dht.stop(),this.metrics&&this.metrics.stop()]),await this.transportManager.close(),A.unmount(this),this.dialer.destroy()}catch(e){e&&(o.error(e),this.emit("error",e))}this._isStarted=!1,o("libp2p has stopped")}async loadKeychain(){try{await this.keychain.findKeyByName("self")}catch(e){await this.keychain.importPeer("self",this.peerId)}}isStarted(){return this._isStarted}get connections(){return this.connectionManager.connections}dial(e,t){return this.dialProtocol(e,null,t)}async dialProtocol(e,t,r){const{id:n,multiaddrs:i}=h(e);let s=this.connectionManager.get(n);return s?i&&this.peerStore.addressBook.add(n,i):s=await this.dialer.connectToPeer(e,r),t?s.newStream(t):s}get multiaddrs(){const e=this.addressManager.getNoAnnounceAddrs();return this.transportManager.getAddrs().concat(this.addressManager.getAnnounceAddrs()).filter((t,r,n)=>n.findIndex(e=>e.equals(t))===r&&!e.find(e=>e.equals(t)))}async hangUp(e){const{id:t}=h(e),r=this.connectionManager.connections.get(t.toB58String());r&&await Promise.all(r.map(e=>e.close()))}ping(e){const{id:t,multiaddrs:r}=h(e);return A(this,r?r[0]:t)}handle(e,t){(e=Array.isArray(e)?e:[e]).forEach(e=>{this.upgrader.protocols.set(e,t)}),this.isStarted()&&this.identifyService&&this.identifyService.pushToPeerStore(this.peerStore)}unhandle(e){(e=Array.isArray(e)?e:[e]).forEach(e=>{this.upgrader.protocols.delete(e)}),this.isStarted()&&this.identifyService&&this.identifyService.pushToPeerStore(this.peerStore)}async _onStarting(){await this.transportManager.listen(),await this.peerStore.start(),this._config.pubsub.enabled&&this.pubsub&&this.pubsub.start(),this._config.dht.enabled&&(this._dht&&this._dht.start(),this._dht.on("peer",this._onDiscoveryPeer)),this.metrics&&this.metrics.start()}async _onDidStart(){this._isStarted=!0,this.peerStore.on("peer",e=>{this.emit("peer:discovery",e),this._maybeConnect(e)});for(const e of this.peerStore.peers.values())this.emit("peer:discovery",e.id);this.connectionManager.start(),await this._setupPeerDiscovery()}_onDiscoveryPeer(e){e.id.toB58String()!==this.peerId.toB58String()?(e.multiaddrs&&this.peerStore.addressBook.add(e.id,e.multiaddrs),e.protocols&&this.peerStore.protoBook.set(e.id,e.protocols)):o.error(new Error(d.ERR_DISCOVERED_SELF))}async _maybeConnect(e){if(!0===this._config.peerDiscovery.autoDial&&!this.connectionManager.get(e)){if((this._options.connectionManager.minConnections||0)>this.connectionManager.size){o("connecting to discovered peer %s",e.toB58String());try{await this.dialer.connectToPeer(e)}catch(t){o.error("could not connect to discovered peer",t)}}}}async _setupPeerDiscovery(){const e=e=>{let t={enabled:!0};if(e.tag&&this._config.peerDiscovery&&this._config.peerDiscovery[e.tag]&&(t={...t,...this._config.peerDiscovery[e.tag]}),t.enabled&&!this._discovery.has(e.tag)){let r;r="function"==typeof e?new e(Object.assign({},t,{peerId:this.peerId,libp2p:this})):e,r.on("peer",this._onDiscoveryPeer),this._discovery.set(e.tag,r)}};for(const t of this._modules.peerDiscovery||[])e(t);for(const t of this.transportManager.getTransports())t.discovery&&e(t.discovery);await Promise.all(Array.from(this._discovery.values(),e=>e.start()))}}R.create=async function(e={}){if(e.peerId)return new R(e);const t=await a.create();return e.peerId=t,new R(e)},e.exports=R},function(e,t,r){"use strict";const n=r(1),i=r(171);e.exports=e=>{const t=e._modules.peerRouting||[];return e._dht&&t.unshift(e._dht),{findPeer:async(e,r)=>{if(!t.length)throw n(new Error("No peer routers available"),"NO_ROUTERS_AVAILABLE");return i(t.map(async t=>{const i=await t.findPeer(e,r);if(!i||0===Object.keys(i).length)throw n(new Error("not found"),"NOT_FOUND");return i}))}}}},function(e,t,r){"use strict";const n=r(309),i=r(770);class s extends Error{}e.exports=(e,t)=>new i((r,i,o)=>{const{count:a,filter:c=(()=>!0)}=t;if(!Number.isFinite(a))return void i(new TypeError("Expected a finite number, got ".concat(typeof t.count)));const u=[],f=[];let h=0,l=!1;const d=new Set,p=()=>{for(const t of e)d.has(t)||"function"!=typeof t.cancel||t.cancel()};o(p);for(const t of e)h++,(async()=>{try{const e=await t;if(l)return;if(!c(e))throw new s("Value does not satisfy filter");u.push(e)}catch(e){f.push(e)}finally{d.add(t),!l&&(u.length===a&&(r(u),l=!0),h-f.length<a&&(i(new n(f)),l=!0),l)&&p()}})();a>h&&(i(new RangeError("Expected input to contain at least ".concat(t.count," items, but contains ").concat(h," items"))),p())}),e.exports.AggregateError=n,e.exports.FilterError=s},function(e,t,r){"use strict";class n extends Error{constructor(e){super(e||"Promise was canceled"),this.name="CancelError"}get isCanceled(){return!0}}class i{static fn(e){return(...t)=>new i((r,n,i)=>{t.push(i),e(...t).then(r,n)})}constructor(e){this._cancelHandlers=[],this._isPending=!0,this._isCanceled=!1,this._rejectOnCancel=!0,this._promise=new Promise((t,r)=>{this._reject=r;const n=e=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(e)};return Object.defineProperties(n,{shouldReject:{get:()=>this._rejectOnCancel,set:e=>{this._rejectOnCancel=e}}}),e(e=>{this._isPending=!1,t(e)},e=>{this._isPending=!1,r(e)},n)})}then(e,t){return this._promise.then(e,t)}catch(e){return this._promise.catch(e)}finally(e){return this._promise.finally(e)}cancel(e){if(this._isPending&&!this._isCanceled){if(this._cancelHandlers.length>0)try{for(const e of this._cancelHandlers)e()}catch(t){this._reject(t)}this._isCanceled=!0,this._rejectOnCancel&&this._reject(new n(e))}}get isCanceled(){return this._isCanceled}}Object.setPrototypeOf(i.prototype,Promise.prototype),e.exports=i,e.exports.CancelError=n},function(e,t,r){"use strict";class n extends Error{constructor(e){super(e||"Promise was canceled"),this.name="CancelError"}get isCanceled(){return!0}}class i{static fn(e){return(...t)=>new i((r,n,i)=>{t.push(i),e(...t).then(r,n)})}constructor(e){this._cancelHandlers=[],this._isPending=!0,this._isCanceled=!1,this._rejectOnCancel=!0,this._promise=new Promise((t,r)=>{this._reject=r;const n=e=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(e)};return Object.defineProperties(n,{shouldReject:{get:()=>this._rejectOnCancel,set:e=>{this._rejectOnCancel=e}}}),e(e=>{this._isPending=!1,t(e)},e=>{this._isPending=!1,r(e)},n)})}then(e,t){return this._promise.then(e,t)}catch(e){return this._promise.catch(e)}finally(e){return this._promise.finally(e)}cancel(e){if(this._isPending&&!this._isCanceled){if(this._cancelHandlers.length>0)try{for(const e of this._cancelHandlers)e()}catch(t){this._reject(t)}this._isCanceled=!0,this._rejectOnCancel&&this._reject(new n(e))}}get isCanceled(){return this._isCanceled}}Object.setPrototypeOf(i.prototype,Promise.prototype),e.exports=i,e.exports.CancelError=n},function(e,t,r){"use strict";const n=r(1),{messages:i,codes:s}=r(20),o=r(131),a=r(171);e.exports=e=>{const t=e._modules.contentRouting||[],r=e._dht;return r&&t.unshift(r),{async*findProviders(e,r){if(!t.length)throw n(new Error("No content routers available"),"NO_ROUTERS_AVAILABLE");const i=await a(t.map(async t=>{const i=await o(t.findProviders(e,r));if(!i||!i.length)throw n(new Error("not found"),"NOT_FOUND");return i}));for(const t of i)yield t},async provide(e){if(!t.length)throw n(new Error("No content routers available"),"NO_ROUTERS_AVAILABLE");return Promise.all(t.map(t=>t.provide(e)))},async put(t,o,a){if(!e.isStarted()||!r.isStarted)throw n(new Error(i.NOT_STARTED_YET),s.DHT_NOT_STARTED);return r.put(t,o,a)},async get(t,o){if(!e.isStarted()||!r.isStarted)throw n(new Error(i.NOT_STARTED_YET),s.DHT_NOT_STARTED);return r.get(t,o)},async getMany(t,o,a){if(!e.isStarted()||!r.isStarted)throw n(new Error(i.NOT_STARTED_YET),s.DHT_NOT_STARTED);return r.getMany(t,o,a)}}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(1),{messages:s,codes:o}=r(20);e.exports=(e,t,r)=>{const a=new t(e.peerId,e.registrar,r);return{subscribe:(t,r)=>{if(!e.isStarted()&&!a.started)throw i(new Error(s.NOT_STARTED_YET),o.PUBSUB_NOT_STARTED);0===a.listenerCount(t)&&a.subscribe(t),a.on(t,r)},unsubscribe:(t,r)=>{if(!e.isStarted()&&!a.started)throw i(new Error(s.NOT_STARTED_YET),o.PUBSUB_NOT_STARTED);r?a.removeListener(t,r):a.removeAllListeners(t),0===a.listenerCount(t)&&a.unsubscribe(t)},publish:(t,r)=>{if(!e.isStarted()&&!a.started)throw i(new Error(s.NOT_STARTED_YET),o.PUBSUB_NOT_STARTED);try{r=n.from(r)}catch(c){throw i(new Error("data must be convertible to a Buffer"),"ERR_DATA_IS_NOT_VALID")}return a.publish(t,r)},getTopics:()=>{if(!e.isStarted()&&!a.started)throw i(new Error(s.NOT_STARTED_YET),o.PUBSUB_NOT_STARTED);return a.getTopics()},getSubscribers:t=>{if(!e.isStarted()&&!a.started)throw i(new Error(s.NOT_STARTED_YET),o.PUBSUB_NOT_STARTED);return a.getSubscribers(t)},setMaxListeners:e=>a.setMaxListeners(e),_pubsub:a,start:()=>a.start(),stop:()=>a.stop()}}},function(e,t,r){"use strict";const n=r(26),i=r(172),{FaultTolerance:s}=r(311),o={addresses:{listen:[],announce:[],noAnnounce:[]},connectionManager:{minConnections:25},transportManager:{faultTolerance:s.FATAL_ALL},dialer:{maxParallelDials:i.MAX_PARALLEL_DIALS,maxDialsPerPeer:i.MAX_PER_PEER_DIALS,dialTimeout:i.DIAL_TIMEOUT},metrics:{enabled:!1},peerStore:{persistence:!1,threshold:5},config:{dht:{enabled:!1,kBucketSize:20,randomWalk:{enabled:!1,queriesPerPeriod:1,interval:3e5,timeout:1e4}},peerDiscovery:{autoDial:!0},pubsub:{enabled:!0,emitSelf:!0,signMessages:!0,strictSigning:!0},relay:{enabled:!0,hop:{enabled:!1,active:!1}},transport:{}}};e.exports.validate=e=>{if((e=n(o,e)).modules.transport.length<1)throw new Error("'options.modules.transport' must contain at least 1 transport");return e}},function(e,t,r){"use strict";const n=r(776),i=r(777);e.exports=async(e,t={})=>{const{concurrency:r=1/0}=t,s=i(r);return Promise.all(e.map(e=>e&&"function"==typeof e.then?n(e):n("function"==typeof e?s(()=>e()):Promise.resolve(e))))}},function(e,t,r){"use strict";const n=async e=>{try{return{isFulfilled:!0,isRejected:!1,value:await e}}catch(t){return{isFulfilled:!1,isRejected:!0,reason:t}}};e.exports=n,e.exports.default=n},function(e,t,r){"use strict";const n=r(778),i=e=>{if(!Number.isInteger(e)&&e!==1/0||!(e>0))return Promise.reject(new TypeError("Expected `concurrency` to be a number from 1 and up"));const t=[];let r=0;const i=()=>{r--,t.length>0&&t.shift()()},s=(e,t,...s)=>{r++;const o=n(e,...s);t(o),o.then(i,i)},o=(n,...i)=>new Promise(o=>((n,i,...o)=>{r<e?s(n,i,...o):t.push(s.bind(null,n,i,...o))})(n,o,...i));return Object.defineProperties(o,{activeCount:{get:()=>r},pendingCount:{get:()=>t.length},clearQueue:{value:()=>{t.length=0}}}),o};e.exports=i,e.exports.default=i},function(e,t,r){"use strict";const n=(e,...t)=>new Promise(r=>{r(e(...t))});e.exports=n,e.exports.default=n},function(e,t,r){"use strict";const n=r(2);n("libp2p:addresses").error=n("libp2p:addresses:error");const i=r(15);e.exports=class{constructor({listen:e=[],announce:t=[],noAnnounce:r=[]}={}){this.listen=new Set(e),this.announce=new Set(t),this.noAnnounce=new Set(r)}getListenAddrs(){return Array.from(this.listen).map(e=>i(e))}getAnnounceAddrs(){return Array.from(this.announce).map(e=>i(e))}getNoAnnounceAddrs(){return Array.from(this.noAnnounce).map(e=>i(e))}}},function(e,t,r){"use strict";const n=r(2),i=n("libp2p:connection-manager");i.error=n("libp2p:connection-manager:error");const s=r(1),o=r(26),a=r(781),c=r(135),{EventEmitter:u}=r(13),f=r(6),{ERR_INVALID_PARAMETERS:h}=r(20),l={maxConnections:1/0,minConnections:0,maxData:1/0,maxSentData:1/0,maxReceivedData:1/0,maxEventLoopDelay:1/0,pollInterval:2e3,autoDialInterval:1e4,movingAverageInterval:6e4,defaultPeerValue:1};function d(e,t){return e[1]-t[1]}e.exports=class extends u{constructor(e,t){if(super(),this._libp2p=e,this._peerId=e.peerId.toB58String(),this._options=o.call({ignoreUndefined:!0},l,t),this._options.maxConnections<this._options.minConnections)throw s(new Error("Connection Manager maxConnections must be greater than minConnections"),h);i("options: %j",this._options),this._libp2p=e,this._peerValues=new Map,this.connections=new Map,this._started=!1,this._timer=null,this._autoDialTimeout=null,this._checkMetrics=this._checkMetrics.bind(this),this._autoDial=this._autoDial.bind(this)}get size(){return Array.from(this.connections.values()).reduce((e,t)=>e+t.length,0)}start(){this._libp2p.metrics&&(this._timer=this._timer||c(this._checkMetrics,this._options.pollInterval)),this._latencyMonitor=new a({latencyCheckIntervalMs:this._options.pollInterval,dataEmitIntervalMs:this._options.pollInterval}),this._onLatencyMeasure=this._onLatencyMeasure.bind(this),this._latencyMonitor.on("data",this._onLatencyMeasure),this._started=!0,i("started"),this._options.autoDial&&this._autoDial()}async stop(){this._autoDialTimeout&&this._autoDialTimeout.clear(),this._timer&&this._timer.clear(),this._latencyMonitor&&this._latencyMonitor.removeListener("data",this._onLatencyMeasure),this._started=!1,await this._close(),i("stopped")}async _close(){const e=[];for(const t of this.connections.values())for(const r of t)e.push(r.close());await e,this.connections.clear()}setPeerValue(e,t){if(t<0||t>1)throw new Error("value should be a number between 0 and 1");e.toB58String&&(e=e.toB58String()),this._peerValues.set(e,t)}_checkMetrics(){const e=this._libp2p.metrics.global.movingAverages,t=e.dataReceived[this._options.movingAverageInterval].movingAverage();this._checkMaxLimit("maxReceivedData",t);const r=e.dataSent[this._options.movingAverageInterval].movingAverage();this._checkMaxLimit("maxSentData",r);const n=t+r;this._checkMaxLimit("maxData",n),i("metrics update",n),this._timer=c(this._checkMetrics,this._options.pollInterval)}onConnect(e){const t=e.remotePeer,r=t.toB58String(),n=this.connections.get(r);this.emit("peer:connect",e),n?n.push(e):this.connections.set(r,[e]),this._libp2p.peerStore.keyBook.set(t,t.pubKey),this._peerValues.has(r)||this._peerValues.set(r,this._options.defaultPeerValue),this._checkMaxLimit("maxConnections",this.size)}onDisconnect(e){const t=e.remotePeer.toB58String();let r=this.connections.get(t);r&&r.length>1?(r=r.filter(t=>t.id!==e.id),this.connections.set(t,r)):r&&(this.connections.delete(t),this._peerValues.delete(e.remotePeer.toB58String()),this.emit("peer:disconnect",e))}get(e){const t=this.getAll(e);return t.length?t[0]:null}getAll(e){if(!f.isPeerId(e))throw s(new Error("peerId must be an instance of peer-id"),h);const t=e.toB58String(),r=this.connections.get(t);return r?r.filter(e=>"open"===e.stat.status):[]}_onLatencyMeasure(e){this._checkMaxLimit("maxEventLoopDelay",e.avgMs)}_checkMaxLimit(e,t){const r=this._options[e];i("checking limit of %s. current value: %d of %d",e,t,r),t>r&&(i("%s: limit exceeded: %s, %d",this._peerId,e,t),this._maybeDisconnectOne())}async _autoDial(){const e=this._options.minConnections;if(this.size>=e)return void(this._autoDialTimeout=c(this._autoDial,this._options.autoDialInterval));const t=Array.from(this._libp2p.peerStore.peers.values()).sort((e,t)=>!t.protocols||!t.protocols.length||e.protocols&&e.protocols.length?t.id.pubKey&&!e.id.pubKey?1:-1:1);for(let n=0;n<t.length&&this.size<e;n++)if(!this.get(t[n].id)){i("connecting to a peerStore stored peer %s",t[n].id.toB58String());try{if(await this._libp2p.dialer.connectToPeer(t[n].id),!this._started)return}catch(r){i.error("could not connect to peerStore stored peer",r)}}this._autoDialTimeout=c(this._autoDial,this._options.autoDialInterval)}_maybeDisconnectOne(){if(this._options.minConnections<this.connections.size){const e=Array.from(this._peerValues).sort(d);i("%s: sorted peer values: %j",this._peerId,e);const t=e[0];if(t){const e=t[0];i("%s: lowest value peer is %s",this._peerId,e),i("%s: closing a connection to %j",this._peerId,e);for(const t of this.connections.values())if(t[0].remotePeer.toB58String()===e){t[0].close();break}}}}}},function(e,t,r){"use strict";const n=r(57),i=r(13),s=r(782),o=r(2)("latency-monitor:LatencyMonitor");e.exports=class extends i{constructor({latencyCheckIntervalMs:e,dataEmitIntervalMs:t,asyncTestFn:r,latencyRandomPercentage:i}={}){super();const a=this;a.latencyCheckIntervalMs=e||500,a.latencyRandomPercentage=i||10,a._latecyCheckMultiply=a.latencyRandomPercentage/100*2*a.latencyCheckIntervalMs,a._latecyCheckSubtract=a._latecyCheckMultiply/2,a.dataEmitIntervalMs=null===t||0===t?void 0:t||5e3,o("latencyCheckIntervalMs: %s dataEmitIntervalMs: %s",a.latencyCheckIntervalMs,a.dataEmitIntervalMs),a.dataEmitIntervalMs?o("Expecting ~%s events per summary",a.latencyCheckIntervalMs/a.dataEmitIntervalMs):o("Not emitting summaries"),a.asyncTestFn=r,n.process&&n.process.hrtime?(o("Using process.hrtime for timing"),a.now=n.process.hrtime,a.getDeltaMS=e=>{const t=a.now(e);return 1e3*t[0]+t[1]/1e6}):"undefined"!=typeof window&&window.performance&&window.performance.now?(o("Using performance.now for timing"),a.now=window.performance.now.bind(window.performance),a.getDeltaMS=e=>Math.round(a.now()-e)):(o("Using Date.now for timing"),a.now=Date.now,a.getDeltaMS=e=>a.now()-e),a._latencyData=a._initLatencyData(),"undefined"!=typeof window&&(a._visibilityChangeEmitter=new s,a._visibilityChangeEmitter.on("visibilityChange",e=>{e?a._startTimers():(a._emitSummary(),a._stopTimers())})),a._visibilityChangeEmitter&&!a._visibilityChangeEmitter.isVisible()||a._startTimers()}_startTimers(){this._checkLatencyID||(this._checkLatency(),this.dataEmitIntervalMs&&(this._emitIntervalID=setInterval(()=>this._emitSummary(),this.dataEmitIntervalMs),"function"==typeof this._emitIntervalID.unref&&this._emitIntervalID.unref()))}_stopTimers(){this._checkLatencyID&&(clearTimeout(this._checkLatencyID),this._checkLatencyID=void 0),this._emitIntervalID&&(clearInterval(this._emitIntervalID),this._emitIntervalID=void 0)}_emitSummary(){const e=this.getSummary();e.events>0&&this.emit("data",e)}getSummary(){const e={events:this._latencyData.events,minMs:this._latencyData.minMs,maxMs:this._latencyData.maxMs,avgMs:this._latencyData.events?this._latencyData.totalMs/this._latencyData.events:Number.POSITIVE_INFINITY,lengthMs:this.getDeltaMS(this._latencyData.startTime)};return this._latencyData=this._initLatencyData(),o("Summary: %O",e),e}_checkLatency(){const e=this,t=Math.random()*e._latecyCheckMultiply-e._latecyCheckSubtract,r={deltaOffset:Math.ceil(e.latencyCheckIntervalMs+t),startTime:e.now()},n=()=>{if(!this._checkLatencyID)return;const t=e.getDeltaMS(r.startTime)-r.deltaOffset;e._checkLatency(),e._latencyData.events++,e._latencyData.minMs=Math.min(e._latencyData.minMs,t),e._latencyData.maxMs=Math.max(e._latencyData.maxMs,t),e._latencyData.totalMs+=t,o("MS: %s Data: %O",t,e._latencyData)};o("localData: %O",r),this._checkLatencyID=setTimeout(()=>{e.asyncTestFn?(r.deltaOffset=0,r.startTime=e.now(),e.asyncTestFn(n)):(r.deltaOffset-=1,n())},r.deltaOffset),"function"==typeof this._checkLatencyID.unref&&this._checkLatencyID.unref()}_initLatencyData(){return{startTime:this.now(),minMs:Number.POSITIVE_INFINITY,maxMs:Number.NEGATIVE_INFINITY,events:0,totalMs:0}}}},function(e,t,r){"use strict";const n=r(13),i=r(2)("latency-monitor:VisibilityChangeEmitter");e.exports=class extends n{constructor(){super(),"undefined"!=typeof document?(this._initializeVisibilityVarNames(),this._addVisibilityChangeListener()):i('This is not a browser, no "document" found. Stopping.')}_initializeVisibilityVarNames(){let e,t;void 0!==document.hidden?(e="hidden",t="visibilitychange"):void 0!==document.mozHidden?(e="mozHidden",t="mozvisibilitychange"):void 0!==document.msHidden?(e="msHidden",t="msvisibilitychange"):void 0!==document.webkitHidden&&(e="webkitHidden",t="webkitvisibilitychange"),this._hidden=e,this._visibilityChange=t}_addVisibilityChangeListener(){void 0===document.addEventListener||void 0===document[this._hidden]?i("Checking page visibility requires a browser that supports the Page Visibility API."):document.addEventListener(this._visibilityChange,this._handleVisibilityChange.bind(this),!1)}isVisible(){if(void 0!==this._hidden&&void 0!==document[this._hidden])return!document[this._hidden]}_handleVisibilityChange(){const e=!document[this._hidden];i(e?"Page Visible":"Page Hidden"),this.emit("visibilityChange",e)}}},function(e,t,r){"use strict";const n=r(58),i=r(15),s=r(6),o=r(21),{CircuitRelay:a}=r(81),c=r(2),u=c("libp2p:circuit");u.error=c("libp2p:circuit:error");const f=r(784),{relay:h}=r(174),l=r(786),{handleCanHop:d,handleHop:p,hop:b}=r(787),{handleStop:y}=r(314),m=r(175);e.exports=o(class{constructor({libp2p:e,upgrader:t}){this._dialer=e.dialer,this._registrar=e.registrar,this._connectionManager=e.connectionManager,this._upgrader=t,this._options=e._config.relay,this._libp2p=e,this.peerId=e.peerId,this._registrar.handle(h,this._onProtocol.bind(this))}async _onProtocol({connection:e,stream:t,protocol:r}){const n=new m({stream:t}),s=await n.read(),o=this;let c;switch(s.type){case a.Type.CAN_HOP:u("received CAN_HOP request from %s",e.remotePeer.toB58String()),await d({circuit:o,connection:e,streamHandler:n});break;case a.Type.HOP:u("received HOP request from %s",e.remotePeer.toB58String()),c=await p({connection:e,request:s,streamHandler:n,circuit:o});break;case a.Type.STOP:u("received STOP request from %s",e.remotePeer.toB58String()),c=await y({connection:e,request:s,streamHandler:n,circuit:o});break;default:u("Request of type %s not supported",s.type)}if(c){const e=i(s.dstPeer.addrs[0]),t=i(s.srcPeer.addrs[0]),r=f({stream:c,remoteAddr:e,localAddr:t}),n=a.Type===a.Type.HOP?"relay":"inbound";u("new %s connection %s",n,r.remoteAddr);const o=await this._upgrader.upgradeInbound(r);u("%s connection %s upgraded",n,r.remoteAddr),this.handler&&this.handler(o)}}async dial(e,t){const r=e.toString().split("/p2p-circuit"),n=i(r[0]),o=i(r[r.length-1]),c=s.createFromCID(n.getPeerId()),h=s.createFromCID(o.getPeerId());let l=!1,d=this._connectionManager.get(c);d||(d=await this._dialer.connectToPeer(n,t),l=!0);try{const t=await b({connection:d,circuit:this,request:{type:a.Type.HOP,srcPeer:{id:this.peerId.toBytes(),addrs:this._libp2p.multiaddrs.map(e=>e.buffer)},dstPeer:{id:h.toBytes(),addrs:[i(o).buffer]}}}),r=n.encapsulate("/p2p-circuit/p2p/".concat(this.peerId.toB58String())),s=f({stream:t,remoteAddr:e,localAddr:r});return u("new outbound connection %s",s.remoteAddr),this._upgrader.upgradeOutbound(s)}catch(p){throw u.error("Circuit relay dial failed",p),l&&await d.close(),p}}createListener(e,t){return"function"==typeof e&&(t=e,e={}),this.handler=t,l(this,e)}filter(e){return(e=Array.isArray(e)?e:[e]).filter(e=>n.Circuit.matches(e))}},{className:"Circuit",symbolName:"@libp2p/js-libp2p-circuit/circuit"})},function(e,t,r){"use strict";const n=r(52),i=r(2)("libp2p:stream:converter");e.exports=({stream:e,remoteAddr:t,localAddr:r},s={})=>{const{sink:o,source:a}=e,c={async sink(e){s.signal&&(e=n(e,s.signal));try{await o(e)}catch(t){"aborted"!==t.type&&i(t)}u()},source:s.signal?n(a,s.signal):a,conn:e,localAddr:r,remoteAddr:t,timeline:{open:Date.now()},close(){o([]),u()}};function u(){c.timeline.close||(c.timeline.close=Date.now())}return c}},function(e,t,r){"use strict";e.exports=class extends Error{constructor(e,t){super(e||"The operation was aborted"),this.type="aborted",this.code=t||"ABORT_ERR"}}},function(e,t,r){"use strict";const n=r(13),i=r(15),s=r(2);s("libp2p:circuit:listener").err=s("libp2p:circuit:error:listener"),e.exports=e=>{const t=new n,r=new Map;return t.listen=async n=>{const s=String(n).split("/p2p-circuit").find(e=>""!==e),o=await e._dialer.connectToPeer(i(s)),a=o.remoteAddr.encapsulate("/p2p-circuit");r.set(o.remotePeer.toB58String(),a),t.emit("listening")},t.close=()=>{},t.getAddrs=()=>{const e=[];for(const t of r.values())e.push(t);return e},t}},function(e,t,r){"use strict";const n=r(2),i=n("libp2p:circuit:hop");i.error=n("libp2p:circuit:hop:error");const s=r(6),{validateAddrs:o}=r(312),a=r(175),{CircuitRelay:c}=r(81),u=r(19),f=r(1),{codes:h}=r(20),{stop:l}=r(314),d=r(174);e.exports.handleHop=async function({connection:e,request:t,streamHandler:r,circuit:n}){if(!n._options.hop.enabled)return i("HOP request received but we are not acting as a relay"),r.end({type:c.Type.STATUS,code:c.Status.HOP_CANT_SPEAK_RELAY});try{o(t,r)}catch(b){return i.error("invalid hop request via peer %s",e.remotePeer.toB58String(),b)}const a=new s(t.dstPeer.id),f=n._connectionManager.get(a);if(!f&&!n._options.hop.active)return i("HOP request received but we are not connected to the destination peer"),r.end({type:c.Type.STATUS,code:c.Status.HOP_NO_CONN_TO_DST});const h={type:c.Type.STOP,dstPeer:t.dstPeer,srcPeer:t.srcPeer};let d;try{d=await l({connection:f,request:h,circuit:n})}catch(b){return i.error(b)}i("hop request from %s is valid",e.remotePeer.toB58String()),r.write({type:c.Type.STATUS,code:c.Status.SUCCESS});const p=r.rest();return u(p,d,p)},e.exports.hop=async function({connection:e,request:t}){const{stream:r}=await e.newStream([d.relay]),n=new a({stream:r});n.write(t);const s=await n.read();if(s.code===c.Status.SUCCESS)return i("hop request was successful"),n.rest();throw i("hop request failed with code %d, closing stream",s.code),n.close(),f(new Error("HOP request failed with code ".concat(s.code)),h.ERR_HOP_REQUEST_FAILED)},e.exports.handleCanHop=function({connection:e,streamHandler:t,circuit:r}){const n=r._options.hop.enabled;i("can hop (%s) request from %s",n,e.remotePeer.toB58String()),t.end({type:c.Type.STATUS,code:n?c.Status.SUCCESS:c.Status.HOP_CANT_SPEAK_RELAY})}},function(e,t,r){"use strict";const n=r(15),i=r(1),s=r(233),o=r(70),a=r(2),c=a("libp2p:dialer");c.error=a("libp2p:dialer:error");const{DialRequest:u}=r(789),f=r(310),{codes:h}=r(20),{DIAL_TIMEOUT:l,MAX_PARALLEL_DIALS:d,MAX_PER_PEER_DIALS:p}=r(172);e.exports=class{constructor({transportManager:e,peerStore:t,concurrency:r=d,timeout:n=l,perPeerLimit:i=p}){this.transportManager=e,this.peerStore=t,this.concurrency=r,this.timeout=n,this.perPeerLimit=i,this.tokens=[...new Array(r)].map((e,t)=>t),this._pendingDials=new Map}destroy(){for(const t of this._pendingDials.values())try{t.controller.abort()}catch(e){c.error(e)}this._pendingDials.clear()}async connectToPeer(e,t={}){const r=this._createDialTarget(e);if(!r.addrs.length)throw i(new Error("The dial request has no addresses"),h.ERR_NO_VALID_ADDRESSES);const n=this._pendingDials.get(r.id)||this._createPendingDial(r,t);try{const e=await n.promise;return c("dial succeeded to %s",r.id),e}catch(s){throw n.controller.signal.aborted&&(s.code=h.ERR_TIMEOUT),c.error(s),s}finally{n.destroy()}}_createDialTarget(e){const{id:t,multiaddrs:r}=f(e);r&&this.peerStore.addressBook.add(t,r);let i=this.peerStore.addressBook.getMultiaddrsForPeer(t)||[];return n.isMultiaddr(e)&&(i=i.filter(t=>!e.equals(t)),i.unshift(e)),{id:t.toB58String(),addrs:i}}_createPendingDial(e,t){const r=new u({addrs:e.addrs,dialAction:(e,t)=>{if(t.signal.aborted)throw i(new Error("already aborted"),h.ERR_ALREADY_ABORTED);return this.transportManager.dial(e,t)},dialer:this}),n=new s(this.timeout),a=[n.signal];t.signal&&a.push(t.signal);const c=o(a),f={dialRequest:r,controller:n,promise:r.run({...t,signal:c}),destroy:()=>{n.clear(),this._pendingDials.delete(e.id)}};return this._pendingDials.set(e.id,f),f}getTokens(e){const t=Math.min(e,this.perPeerLimit,this.tokens.length),r=this.tokens.splice(0,t);return c("%d tokens request, returning %d, %d remaining",e,t,this.tokens.length),r}releaseToken(e){this.tokens.indexOf(e)>-1||(c("token %d released",e),this.tokens.push(e))}}},function(e,t,r){"use strict";const n=r(41),i=r(70),s=r(2),o=r(1);s("libp2p:dialer:request").error=s("libp2p:dialer:request:error");const a=r(790),c=r(171);e.exports.DialRequest=class{constructor({addrs:e,dialAction:t,dialer:r}){this.addrs=e,this.dialer=r,this.dialAction=t}async run(e){const t=this.dialer.getTokens(this.addrs.length);if(t.length<1)throw o(new Error("No dial tokens available"),"ERR_NO_DIAL_TOKENS");const r=new a;t.forEach(e=>r.push(e));const s=this.addrs.map(()=>new n);let u=0;try{return await c(this.addrs.map(async(n,o)=>{const a=await r.shift();let c;try{const f=s[o].signal;c=await this.dialAction(n,{...e,signal:i([f,e.signal])}),s.splice(o,1)}finally{u++,this.addrs.length-u>=t.length?r.push(a):this.dialer.releaseToken(t.splice(t.indexOf(a),1)[0])}return c}))}finally{s.map(e=>e.abort()),t.forEach(e=>this.dialer.releaseToken(e))}}}},function(e,t,r){"use strict";const n=r(285),i=r(83);e.exports=class{constructor(){this._buffer=new n,this._waitingConsumers=new n}push(e){const{promise:t,resolve:r}=i();return this._buffer.push({chunk:e,resolve:r}),this._consume(),t}_consume(){for(;!this._waitingConsumers.isEmpty()&&!this._buffer.isEmpty();){const e=this._waitingConsumers.shift(),t=this._buffer.shift();e.resolve(t.chunk),t.resolve()}}shift(){const{promise:e,resolve:t}=i();return this._waitingConsumers.push({resolve:t}),this._consume(),e}isEmpty(){return this._buffer.isEmpty()}}},function(e,t,r){"use strict";const n=r(792),i=r(26),s=r(28),o=r(7),a=r(796),c=r(1),{Number:u}=r(57);r(121);const f=14,h=16,l=1e3,d={dek:{keyLength:64,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function p(e){return!!e&&("string"==typeof e&&e===n(e.trim()))}async function b(e){const t=800*Math.random()+200;throw await new Promise(e=>setTimeout(e,t)),e}function y(e){return new o.Key("/pkcs8/"+e)}function m(e){return new o.Key("/info/"+e)}e.exports=class{constructor(e,t){if(!e)throw new Error("store is required");if(this.store=e,this.opts=i(d,t),this.opts.passPhrase&&this.opts.passPhrase.length<20)throw new Error("passPhrase must be least 20 characters");if(this.opts.dek.keyLength<f)throw new Error("dek.keyLength must be least ".concat(f," bytes"));if(this.opts.dek.salt.length<h)throw new Error("dek.saltLength must be least ".concat(h," bytes"));if(this.opts.dek.iterationCount<l)throw new Error("dek.iterationCount must be least ".concat(l));const r=this.opts.passPhrase?s.pbkdf2(this.opts.passPhrase,this.opts.dek.salt,this.opts.dek.iterationCount,this.opts.dek.keyLength,this.opts.dek.hash):"";Object.defineProperty(this,"_",{value:()=>r})}get cms(){return new a(this)}static generateOptions(){const e=Object.assign({},d),t=3*Math.ceil(h/3);return e.dek.salt=s.randomBytes(t).toString("base64"),e}static get options(){return d}async createKey(e,t,r){const n=this;if(!p(e)||"self"===e)return b(c(new Error("Invalid key name '".concat(e,"'")),"ERR_INVALID_KEY_NAME"));if("string"!=typeof t)return b(c(new Error("Invalid key type '".concat(t,"'")),"ERR_INVALID_KEY_TYPE"));const i=y(e);if(await n.store.has(i))return b(c(new Error("Key '".concat(e,"' already exists")),"ERR_KEY_ALREADY_EXISTS"));switch(t.toLowerCase()){case"rsa":if(!u.isSafeInteger(r)||r<2048)return b(c(new Error("Invalid RSA key size ".concat(r)),"ERR_INVALID_KEY_SIZE"))}let o;try{const a=await s.keys.generateKeyPair(t,r),c=await a.id(),u=await a.export(this._());o={name:e,id:c};const f=n.store.batch();f.put(i,u),f.put(m(e),JSON.stringify(o)),await f.commit()}catch(a){return b(a)}return o}async listKeys(){const e=this,t={prefix:"/info/"},r=[];for await(const n of e.store.query(t))r.push(JSON.parse(n.value));return r}async findKeyById(e){try{return(await this.listKeys()).find(t=>t.id===e)}catch(t){return b(t)}}async findKeyByName(e){if(!p(e))return b(c(new Error("Invalid key name '".concat(e,"'")),"ERR_INVALID_KEY_NAME"));const t=m(e);try{const e=await this.store.get(t);return JSON.parse(e.toString())}catch(r){return b(c(new Error("Key '".concat(e,"' does not exist. ").concat(r.message)),"ERR_KEY_NOT_FOUND"))}}async removeKey(e){if(!p(e)||"self"===e)return b(c(new Error("Invalid key name '".concat(e,"'")),"ERR_INVALID_KEY_NAME"));const t=y(e),r=await this.findKeyByName(e),n=this.store.batch();return n.delete(t),n.delete(m(e)),await n.commit(),r}async renameKey(e,t){const r=this;if(!p(e)||"self"===e)return b(c(new Error("Invalid old key name '".concat(e,"'")),"ERR_OLD_KEY_NAME_INVALID"));if(!p(t)||"self"===t)return b(c(new Error("Invalid new key name '".concat(t,"'")),"ERR_NEW_KEY_NAME_INVALID"));const n=y(e),i=y(t),s=m(e),o=m(t);if(await r.store.has(i))return b(c(new Error("Key '".concat(t,"' already exists")),"ERR_KEY_ALREADY_EXISTS"));try{let e=await this.store.get(n);const a=e.toString();e=await r.store.get(s);const c=JSON.parse(e.toString());c.name=t;const u=r.store.batch();return u.put(i,a),u.put(o,JSON.stringify(c)),u.delete(n),u.delete(s),await u.commit(),c}catch(a){return b(a)}}async exportKey(e,t){if(!p(e))return b(c(new Error("Invalid key name '".concat(e,"'")),"ERR_INVALID_KEY_NAME"));if(!t)return b(c(new Error("Password is required"),"ERR_PASSWORD_REQUIRED"));const r=y(e);try{const e=(await this.store.get(r)).toString();return(await s.keys.import(e,this._())).export(t)}catch(n){return b(n)}}async importKey(e,t,r){if(!p(e)||"self"===e)return b(c(new Error("Invalid key name '".concat(e,"'")),"ERR_INVALID_KEY_NAME"));if(!t)return b(c(new Error("PEM encoded key is required"),"ERR_PEM_REQUIRED"));const n=y(e);if(await this.store.has(n))return b(c(new Error("Key '".concat(e,"' already exists")),"ERR_KEY_ALREADY_EXISTS"));let i,o;try{i=await s.keys.import(t,r)}catch(f){return b(c(new Error("Cannot read the key, most likely the password is wrong"),"ERR_CANNOT_READ_KEY"))}try{o=await i.id(),t=await i.export(this._())}catch(f){return b(f)}const a={name:e,id:o},u=this.store.batch();return u.put(n,t),u.put(m(e),JSON.stringify(a)),await u.commit(),a}async importPeer(e,t){const r=this;if(!p(e))return b(c(new Error("Invalid key name '".concat(e,"'")),"ERR_INVALID_KEY_NAME"));if(!t||!t.privKey)return b(c(new Error("Peer.privKey is required"),"ERR_MISSING_PRIVATE_KEY"));const n=t.privKey,i=y(e);if(await r.store.has(i))return b(c(new Error("Key '".concat(e,"' already exists")),"ERR_KEY_ALREADY_EXISTS"));try{const t=await n.id(),s=await n.export(this._()),o={name:e,id:t},a=r.store.batch();return a.put(i,s),a.put(m(e),JSON.stringify(o)),await a.commit(),o}catch(s){return b(s)}}async _getPrivateKey(e){if(!p(e))return b(c(new Error("Invalid key name '".concat(e,"'")),"ERR_INVALID_KEY_NAME"));try{const t=y(e);return(await this.store.get(t)).toString()}catch(t){return b(c(new Error("Key '".concat(e,"' does not exist. ").concat(t.message)),"ERR_KEY_NOT_FOUND"))}}}},function(e,t,r){"use strict";var n=r(793),i=/[\/\?<>\\:\*\|"]/g,s=/[\x00-\x1f\x80-\x9f]/g,o=/^\.+$/,a=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,c=/[\. ]+$/;function u(e,t){if("string"!=typeof e)throw new Error("Input must be string");var r=e.replace(i,t).replace(s,t).replace(o,t).replace(a,t).replace(c,t);return n(r,255)}e.exports=function(e,t){var r=t&&t.replacement||"",n=u(e,r);return""===r?n:u(n,"")}},function(e,t,r){"use strict";var n=r(794),i=r(795);e.exports=n.bind(null,i)},function(e,t,r){"use strict";function n(e){return e>=55296&&e<=56319}function i(e){return e>=56320&&e<=57343}e.exports=function(e,t,r){if("string"!=typeof t)throw new Error("Input must be string");for(var s,o,a=t.length,c=0,u=0;u<a;u+=1){if(s=t.charCodeAt(u),o=t[u],n(s)&&i(t.charCodeAt(u+1))&&(o+=t[u+=1]),(c+=e(o))===r)return t.slice(0,u+1);if(c>r)return t.slice(0,u-o.length+1)}return t}},function(e,t,r){"use strict";function n(e){return e>=55296&&e<=56319}function i(e){return e>=56320&&e<=57343}e.exports=function(e){if("string"!=typeof e)throw new Error("Input must be string");for(var t=e.length,r=0,s=null,o=null,a=0;a<t;a++)i(s=e.charCodeAt(a))?null!=o&&n(o)?r+=1:r+=3:s<=127?r+=1:s>=128&&s<=2047?r+=2:s>=2048&&s<=65535&&(r+=3),o=s;return r}},function(e,t,r){"use strict";(function(t){r(797),r(202);const n=r(5),{certificateForKey:i,findAsync:s}=r(802),o=r(1);e.exports=class{constructor(e){if(!e)throw o(new Error("keychain is required"),"ERR_KEYCHAIN_REQUIRED");this.keychain=e}async encrypt(e,r){if(!t.isBuffer(r))throw o(new Error("Plain data must be a Buffer"),"ERR_INVALID_PARAMS");const s=await this.keychain.findKeyByName(e),a=await this.keychain._getPrivateKey(e),c=n.pki.decryptRsaPrivateKey(a,this.keychain._()),u=await i(s,c),f=n.pkcs7.createEnvelopedData();f.addRecipient(u),f.content=n.util.createBuffer(r),f.encrypt();const h=n.asn1.toDer(f.toAsn1()).getBytes();return t.from(h,"binary")}async decrypt(e){if(!t.isBuffer(e))throw o(new Error("CMS data is required"),"ERR_INVALID_PARAMS");let r;try{const t=n.util.createBuffer(e.toString("binary")),i=n.asn1.fromDer(t);r=n.pkcs7.messageFromAsn1(i)}catch(h){throw o(new Error("Invalid CMS: "+h.message),"ERR_INVALID_CMS")}const i=r.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})),a=await s(i,async e=>{try{if(await this.keychain.findKeyById(e.keyId))return!0}catch(h){return!1}return!1});if(!a){const e=i.map(e=>e.keyId);throw o(new Error("Decryption needs one of the key(s): "+e.join(", ")),"ERR_MISSING_KEYS",{missingKeys:e})}const c=await this.keychain.findKeyById(a.keyId),u=await this.keychain._getPrivateKey(c.name),f=n.pki.decryptRsaPrivateKey(u,this.keychain._());return r.decrypt(a.recipient,f),t.from(r.content.getBytes(),"binary")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(5);r(73),r(43),r(118),r(72),r(120),r(798),r(47),r(9),r(315);var i=n.asn1,s=e.exports=n.pkcs7=n.pkcs7||{};function o(e){var t={},r=[];if(!i.validate(e,s.asn1.recipientInfoValidator,t,r)){var o=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw o.errors=r,o}return{version:t.version.charCodeAt(0),issuer:n.pki.RDNAttributesAsArray(t.issuer),serialNumber:n.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:i.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function a(e){for(var t,r=[],s=0;s<e.length;++s)r.push((t=e[s],i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(t.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[n.pki.distinguishedNameToAsn1({attributes:t.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(t.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.encryptedContent.algorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,t.encryptedContent.content)])));return r}function c(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()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[n.pki.distinguishedNameToAsn1({attributes:e.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.digestAlgorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&t.value.push(e.authenticatedAttributesAsn1),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureAlgorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var r=i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[]),s=0;s<e.unauthenticatedAttributes.length;++s){var o=e.unauthenticatedAttributes[s];r.values.push(u(o))}t.value.push(r)}return t}function u(e){var t;if(e.type===n.pki.oids.contentType)t=i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.value).getBytes());else if(e.type===n.pki.oids.messageDigest)t=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===n.pki.oids.signingTime){var r=new Date("1950-01-01T00:00:00Z"),s=new Date("2050-01-01T00:00:00Z"),o=e.value;if("string"==typeof o){var a=Date.parse(o);o=isNaN(a)?13===o.length?i.utcTimeToDate(o):i.generalizedTimeToDate(o):new Date(a)}t=o>=r&&o<s?i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(o)):i.create(i.Class.UNIVERSAL,i.Type.GENERALIZEDTIME,!1,i.dateToGeneralizedTime(o))}return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[t])])}function f(e,t,r){var s={};if(!i.validate(t,r,s,[])){var o=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw o.errors=o,o}if(i.derToOid(s.contentType)!==n.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(s.encryptedContent){var a="";if(n.util.isArray(s.encryptedContent))for(var c=0;c<s.encryptedContent.length;++c){if(s.encryptedContent[c].type!==i.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");a+=s.encryptedContent[c].value}else a=s.encryptedContent;e.encryptedContent={algorithm:i.derToOid(s.encAlgorithm),parameter:n.util.createBuffer(s.encParameter.value),content:n.util.createBuffer(a)}}if(s.content){a="";if(n.util.isArray(s.content))for(c=0;c<s.content.length;++c){if(s.content[c].type!==i.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");a+=s.content[c].value}else a=s.content;e.content=n.util.createBuffer(a)}return e.version=s.version.charCodeAt(0),e.rawCapture=s,s}function h(e){if(void 0===e.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===e.content){var t;switch(e.encryptedContent.algorithm){case n.pki.oids["aes128-CBC"]:case n.pki.oids["aes192-CBC"]:case n.pki.oids["aes256-CBC"]:t=n.aes.createDecryptionCipher(e.encryptedContent.key);break;case n.pki.oids.desCBC:case n.pki.oids["des-EDE3-CBC"]:t=n.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}}s.messageFromPem=function(e){var t=n.pem.decode(e)[0];if("PKCS7"!==t.type){var r=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var o=i.fromDer(t.body);return s.messageFromAsn1(o)},s.messageToPem=function(e,t){var r={type:"PKCS7",body:i.toDer(e.toAsn1()).getBytes()};return n.pem.encode(r,{maxline:t})},s.messageFromAsn1=function(e){var t={},r=[];if(!i.validate(e,s.asn1.contentInfoValidator,t,r)){var o=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw o.errors=r,o}var a,c=i.derToOid(t.contentType);switch(c){case n.pki.oids.envelopedData:a=s.createEnvelopedData();break;case n.pki.oids.encryptedData:a=s.createEncryptedData();break;case n.pki.oids.signedData:a=s.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+c+" is not (yet) supported.")}return a.fromAsn1(t.content.value[0]),a},s.createSignedData=function(){var e=null;return e={type:n.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(t){if(f(e,t,s.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[],e.rawCapture.certificates)for(var r=e.rawCapture.certificates.value,i=0;i<r.length;++i)e.certificates.push(n.pki.certificateFromAsn1(r[i]))},toAsn1:function(){e.contentInfo||e.sign();for(var t=[],r=0;r<e.certificates.length;++r)t.push(n.pki.certificateToAsn1(e.certificates[r]));var s=[],o=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[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.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo])]);return t.length>0&&o.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,t)),s.length>0&&o.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,s)),o.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()),o])},addSigner:function(t){var r=t.issuer,i=t.serialNumber;if(t.certificate){var s=t.certificate;"string"==typeof s&&(s=n.pki.certificateFromPem(s)),r=s.issuer.attributes,i=s.serialNumber}var o=t.key;if(!o)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof o&&(o=n.pki.privateKeyFromPem(o));var a=t.digestAlgorithm||n.pki.oids.sha1;switch(a){case n.pki.oids.sha1:case n.pki.oids.sha256:case n.pki.oids.sha384:case n.pki.oids.sha512:case n.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+a)}var c=t.authenticatedAttributes||[];if(c.length>0){for(var u=!1,f=!1,h=0;h<c.length;++h){var l=c[h];if(u||l.type!==n.pki.oids.contentType){if(f||l.type!==n.pki.oids.messageDigest);else if(f=!0,u)break}else if(u=!0,f)break}if(!u||!f)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}e.signers.push({key:o,version:1,issuer:r,serialNumber:i,digestAlgorithm:a,signatureAlgorithm:n.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:c,unauthenticatedAttributes:[]})},sign:function(t){var r;(t=t||{},"object"!=typeof e.content||null===e.contentInfo)&&(e.contentInfo=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(n.pki.oids.data).getBytes())]),"content"in e&&(e.content instanceof n.util.ByteBuffer?r=e.content.bytes():"string"==typeof e.content&&(r=n.util.encodeUtf8(e.content)),t.detached?e.detachedContent=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r):e.contentInfo.value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r)]))));0!==e.signers.length&&function(t){var r;r=e.detachedContent?e.detachedContent:(r=e.contentInfo.value[1]).value[0];if(!r)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var s=i.derToOid(e.contentInfo.value[0].value),o=i.toDer(r);for(var a in o.getByte(),i.getBerValueLength(o),o=o.getBytes(),t)t[a].start().update(o);for(var f=new Date,h=0;h<e.signers.length;++h){var l=e.signers[h];if(0===l.authenticatedAttributes.length){if(s!==n.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{l.authenticatedAttributesAsn1=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var d=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[]),p=0;p<l.authenticatedAttributes.length;++p){var b=l.authenticatedAttributes[p];b.type===n.pki.oids.messageDigest?b.value=t[l.digestAlgorithm].digest():b.type===n.pki.oids.signingTime&&(b.value||(b.value=f)),d.value.push(u(b)),l.authenticatedAttributesAsn1.value.push(u(b))}o=i.toDer(d).getBytes(),l.md.start().update(o)}l.signature=l.key.sign(l.md,"RSASSA-PKCS1-V1_5")}e.signerInfos=function(e){for(var t=[],r=0;r<e.length;++r)t.push(c(e[r]));return t}(e.signers)}(function(){for(var t={},r=0;r<e.signers.length;++r){var s=e.signers[r];(o=s.digestAlgorithm)in t||(t[o]=n.md[n.pki.oids[o]].create()),0===s.authenticatedAttributes.length?s.md=t[o]:s.md=n.md[n.pki.oids[o]].create()}for(var o in e.digestAlgorithmIdentifiers=[],t)e.digestAlgorithmIdentifiers.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]));return t}())},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(t){"string"==typeof t&&(t=n.pki.certificateFromPem(t)),e.certificates.push(t)},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.")}}},s.createEncryptedData=function(){var e=null;return e={type:n.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:n.pki.oids["aes256-CBC"]},fromAsn1:function(t){f(e,t,s.asn1.encryptedDataValidator)},decrypt:function(t){void 0!==t&&(e.encryptedContent.key=t),h(e)}}},s.createEnvelopedData=function(){var e=null;return e={type:n.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:n.pki.oids["aes256-CBC"]},fromAsn1:function(t){var r=f(e,t,s.asn1.envelopedDataValidator);e.recipients=function(e){for(var t=[],r=0;r<e.length;++r)t.push(o(e[r]));return t}(r.recipientInfos.value)},toAsn1:function(){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[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.SET,!0,a(e.recipients)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,(t=e.encryptedContent,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(n.pki.oids.data).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.algorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,t.parameter.getBytes())]),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,t.content.getBytes())])]))])])]);var t},findRecipient:function(t){for(var r=t.issuer.attributes,n=0;n<e.recipients.length;++n){var i=e.recipients[n],s=i.issuer;if(i.serialNumber===t.serialNumber&&s.length===r.length){for(var o=!0,a=0;a<r.length;++a)if(s[a].type!==r[a].type||s[a].value!==r[a].value){o=!1;break}if(o)return i}}return null},decrypt:function(t,r){if(void 0===e.encryptedContent.key&&void 0!==t&&void 0!==r)switch(t.encryptedContent.algorithm){case n.pki.oids.rsaEncryption:case n.pki.oids.desCBC:var i=r.decrypt(t.encryptedContent.content);e.encryptedContent.key=n.util.createBuffer(i);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}h(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:n.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,r){if(void 0===e.encryptedContent.content){var i,s,o;switch(r=r||e.encryptedContent.algorithm,t=t||e.encryptedContent.key,r){case n.pki.oids["aes128-CBC"]:i=16,s=16,o=n.aes.createEncryptionCipher;break;case n.pki.oids["aes192-CBC"]:i=24,s=16,o=n.aes.createEncryptionCipher;break;case n.pki.oids["aes256-CBC"]:i=32,s=16,o=n.aes.createEncryptionCipher;break;case n.pki.oids["des-EDE3-CBC"]:i=24,s=8,o=n.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(void 0===t)t=n.util.createBuffer(n.random.getBytes(i));else if(t.length()!=i)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+i+".");e.encryptedContent.algorithm=r,e.encryptedContent.key=t,e.encryptedContent.parameter=n.util.createBuffer(n.random.getBytes(s));var a=o(t);if(a.start(e.encryptedContent.parameter.copy()),a.update(e.content),!a.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=a.output}for(var c=0;c<e.recipients.length;++c){var u=e.recipients[c];if(void 0===u.encryptedContent.content)switch(u.encryptedContent.algorithm){case n.pki.oids.rsaEncryption:u.encryptedContent.content=u.encryptedContent.key.encrypt(e.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+u.encryptedContent.algorithm)}}}}}},function(e,t,r){"use strict";var n=r(5);r(43),r(9);var i=n.asn1,s=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=s;var o={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};s.contentInfoValidator=o;var a={name:"EncryptedContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};s.envelopedDataValidator={name:"EnvelopedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(a)},s.encryptedDataValidator={name:"EncryptedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"}].concat(a)};var c={name:"SignerInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};s.signedDataValidator={name:"SignedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},o,{name:"SignedData.Certificates",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,capture:"signerInfos",optional:!0,value:[c]}]},s.recipientInfoValidator={name:"RecipientInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(e,t,r){"use strict";var n=r(5);r(800),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},function(e,t,r){"use strict";var n=r(5);r(9),n.mgf=n.mgf||{},(e.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{}).create=function(e){return{generate:function(t,r){for(var i=new n.util.ByteBuffer,s=Math.ceil(r/e.digestLength),o=0;o<s;o++){var a=new n.util.ByteBuffer;a.putInt32(o),e.start(),e.update(t+a.getBytes()),i.putBuffer(e.digest())}return i.truncate(i.length()-r),i.getBytes()}}}},function(e,t,r){"use strict";var n=r(5);r(47),r(9),(e.exports=n.pss=n.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,i=e.mgf,s=r.digestLength,o=e.salt||null;if("string"==typeof o&&(o=n.util.createBuffer(o)),"saltLength"in e)t=e.saltLength;else{if(null===o)throw new Error("Salt length not specified or specific salt not given.");t=o.length()}if(null!==o&&o.length()!==t)throw new Error("Given salt length does not match length of given salt.");var a=e.prng||n.random,c={encode:function(e,c){var u,f,h=c-1,l=Math.ceil(h/8),d=e.digest().getBytes();if(l<s+t+2)throw new Error("Message is too long to encrypt.");f=null===o?a.getBytesSync(t):o.bytes();var p=new n.util.ByteBuffer;p.fillWithByte(0,8),p.putBytes(d),p.putBytes(f),r.start(),r.update(p.getBytes());var b=r.digest().getBytes(),y=new n.util.ByteBuffer;y.fillWithByte(0,l-t-s-2),y.putByte(1),y.putBytes(f);var m=y.getBytes(),g=l-s-1,v=i.generate(b,g),w="";for(u=0;u<g;u++)w+=String.fromCharCode(m.charCodeAt(u)^v.charCodeAt(u));var _=65280>>8*l-h&255;return(w=String.fromCharCode(w.charCodeAt(0)&~_)+w.substr(1))+b+String.fromCharCode(188)},verify:function(e,o,a){var c,u=a-1,f=Math.ceil(u/8);if(o=o.substr(-f),f<s+t+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==o.charCodeAt(f-1))throw new Error("Encoded message does not end in 0xBC.");var h=f-s-1,l=o.substr(0,h),d=o.substr(h,s),p=65280>>8*f-u&255;if(0!=(l.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var b=i.generate(d,h),y="";for(c=0;c<h;c++)y+=String.fromCharCode(l.charCodeAt(c)^b.charCodeAt(c));y=String.fromCharCode(y.charCodeAt(0)&~p)+y.substr(1);var m=f-s-t-2;for(c=0;c<m;c++)if(0!==y.charCodeAt(c))throw new Error("Leftmost octets not zero as expected");if(1!==y.charCodeAt(m))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var g=y.substr(-t),v=new n.util.ByteBuffer;return v.fillWithByte(0,8),v.putBytes(e),v.putBytes(g),r.start(),r.update(v.getBytes()),d===r.digest().getBytes()}};return c}},function(e,t,r){"use strict";r(315);const n=r(5).pki;e.exports.certificateForKey=(e,t)=>{const r=n.setRsaPublicKey(t.n,t.e),i=n.createCertificate();i.publicKey=r,i.serialNumber="01",i.validity.notBefore=new Date,i.validity.notAfter=new Date,i.validity.notAfter.setFullYear(i.validity.notBefore.getFullYear()+10);const s=[{name:"organizationName",value:"ipfs"},{shortName:"OU",value:"keystore"},{name:"commonName",value:e.id}];return i.setSubject(s),i.setIssuer(s),i.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}]),i.sign(t),i},e.exports.findAsync=async function(e,t){const r=e.map(t);return e[(await Promise.all(r)).findIndex(e=>e)]}},function(e,t,r){"use strict";const n=r(26),i=r(19),{tap:s}=r(176),o=r(804),{METRICS:a}=r(172),c=r(805),u=["dataReceived","dataSent"],f={in:"dataReceived",out:"dataSent"};class h{constructor(e){this._options=n(a,e),this._globalStats=new c(u,this._options),this._peerStats=new Map,this._protocolStats=new Map,this._oldPeers=o(this._options.maxOldPeersRetention),this._running=!1,this._onMessage=this._onMessage.bind(this),this._connectionManager=e.connectionManager,this._connectionManager.on("peer:disconnect",e=>{this.onPeerDisconnected(e.remotePeer)})}start(){this._running=!0}stop(){this._running=!1,this._globalStats.stop();for(const e of this._peerStats.values())e.stop();for(const e of this._protocolStats.values())e.stop()}get global(){return this._globalStats}get peers(){return Array.from(this._peerStats.keys())}forPeer(e){const t=e.toB58String();return this._peerStats.get(t)||this._oldPeers.get(t)}get protocols(){return Array.from(this._protocolStats.keys())}forProtocol(e){return this._protocolStats.get(e)}onPeerDisconnected(e){const t=e.toB58String(),r=this._peerStats.get(t);r&&(r.stop(),this._peerStats.delete(t),this._oldPeers.set(t,r))}_onMessage({remotePeer:e,protocol:t,direction:r,dataLength:n}){if(!this._running)return;const i=f[r];let s=this.forPeer(e);if(s||(s=new c(u,this._options),this._peerStats.set(e.toB58String(),s)),s.push(i,n),this._globalStats.push(i,n),t){let e=this.forProtocol(t);e||(e=new c(u,this._options),this._protocolStats.set(t,e)),e.push(i,n)}}updatePlaceholder(e,t){if(!this._running)return;const r=this.forPeer(e),n=t.toB58String(),i=this.forPeer(t);let s=r;i&&(s=h.mergeStats(i,s),this._oldPeers.delete(n)),this._peerStats.delete(e.toB58String()),this._peerStats.set(n,s),s.start()}trackStream({stream:e,remotePeer:t,protocol:r}){const n=this,o=e.source;e.source=s(e=>n._onMessage({remotePeer:t,protocol:r,direction:"in",dataLength:e.length}))(o);const a=e.sink;return e.sink=e=>i(e,s(e=>n._onMessage({remotePeer:t,protocol:r,direction:"out",dataLength:e.length})),a),e}static mergeStats(e,t){return e.stop(),t.stop(),e._queue=[...e._queue,...t._queue],e}}e.exports=h},function(e,t,r){"use strict";const n=r(146);e.exports=e=>{const t=n(e);return t.delete=t.remove,t}},function(e,t,r){"use strict";const n=r(13),i=r(37),s=r(316),o=r(135);e.exports=class extends n{constructor(e,t){super(),this._options=t,this._queue=[],this._stats={},this._frequencyLastTime=Date.now(),this._frequencyAccumulators={},this._movingAverages={},this._update=this._update.bind(this);const r=this._options.movingAverageIntervals;for(var n=0;n<e.length;n++){var o=e[n];this._stats[o]=i(0),this._movingAverages[o]={};for(var a=0;a<r.length;a++){var c=r[a];(this._movingAverages[o][c]=s(c)).push(this._frequencyLastTime,0)}}}start(){this._queue.length&&this._resetComputeTimeout()}stop(){this._timeout&&(this._timeout.clear(),this._timeout=null)}get snapshot(){return Object.assign({},this._stats)}get movingAverages(){return Object.assign({},this._movingAverages)}toJSON(){const e=this.snapshot,t=this.movingAverages,r={dataReceived:e.dataReceived.toString(),dataSent:e.dataSent.toString(),movingAverages:{}},n=Object.keys(t);for(const i of n){r.movingAverages[i]={};for(const e of Object.keys(t[i]))r.movingAverages[i][e]=t[i][e].movingAverage()}return r}push(e,t){this._queue.push([e,t,Date.now()]),this._resetComputeTimeout()}_resetComputeTimeout(){this._timeout=o(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(e of this._queue)this._applyOp(e);this._queue=[],this._updateFrequency(e[2]),this.emit("update",this._stats)}}_updateFrequency(e){const t=e-this._frequencyLastTime;Object.keys(this._stats).forEach(r=>{this._updateFrequencyFor(r,t,e)}),this._frequencyLastTime=e}_updateFrequencyFor(e,t,r){const n=this._frequencyAccumulators[e]||0;this._frequencyAccumulators[e]=0;const i=n/(t||1)*1e3;let o=this._movingAverages[e];o||(o=this._movingAverages[e]={});const a=this._options.movingAverageIntervals;for(var c=0;c<a.length;c++){var u=a[c],f=o[u];f||(f=o[u]=s(u)),f.push(r,i)}}_applyOp(e){const t=e[0],r=e[1];if("number"!=typeof r)throw new Error("invalid increment number:",r);let n;n=Object.prototype.hasOwnProperty.call(this._stats,t)?this._stats[t]:this._stats[t]=i(0),this._stats[t]=n.plus(r),this._frequencyAccumulators[t]||(this._frequencyAccumulators[t]=0),this._frequencyAccumulators[t]+=r}}},function(e,t,r){"use strict";const n=r(2),i=n("libp2p:upgrader");i.error=n("libp2p:upgrader:error");const s=r(807),{Connection:o}=r(811),a=r(6),c=r(19),u=r(1),f=r(814),{codes:h}=r(20);e.exports=class{constructor({localPeer:e,metrics:t,cryptos:r,muxers:n,onConnectionEnd:i=(()=>{}),onConnection:s=(()=>{})}){this.localPeer=e,this.metrics=t,this.cryptos=r||new Map,this.muxers=n||new Map,this.protector=null,this.protocols=new Map,this.onConnection=s,this.onConnectionEnd=i}async upgradeInbound(e){let t,r,n,s,o,a,c;if(this.metrics){({setTarget:a,proxy:c}=f());const t=parseInt(1e9*Math.random()).toString(36)+Date.now();a({toB58String:()=>t}),e=this.metrics.trackStream({stream:e,remotePeer:c})}i("Starting the inbound connection upgrade");let u=e;this.protector&&(u=await this.protector.protect(e));try{({conn:t,remotePeer:r,protocol:o}=await this._encryptInbound(this.localPeer,u,this.cryptos)),this.muxers.size?({stream:n,Muxer:s}=await this._multiplexInbound(t,this.muxers)):n=t}catch(h){throw i.error("Failed to upgrade inbound connection",h),await e.close(h),h}return this.metrics&&(this.metrics.updatePlaceholder(c,r),a(r)),i("Successfully upgraded inbound connection"),this._createConnection({cryptoProtocol:o,direction:"inbound",maConn:e,upgradedConn:n,Muxer:s,remotePeer:r})}async upgradeOutbound(e){let t,r,n,s,o,c,u,h;try{t=a.createFromB58String(e.remoteAddr.getPeerId())}catch(d){i.error("multiaddr did not contain a valid peer id",d)}if(this.metrics){({setTarget:u,proxy:h}=f());const t=parseInt(1e9*Math.random()).toString(36)+Date.now();u({toB58String:()=>t}),e=this.metrics.trackStream({stream:e,remotePeer:h})}i("Starting the outbound connection upgrade");let l=e;this.protector&&(l=await this.protector.protect(e));try{({conn:r,remotePeer:n,protocol:o}=await this._encryptOutbound(this.localPeer,l,t,this.cryptos)),this.muxers.size?({stream:s,Muxer:c}=await this._multiplexOutbound(r,this.muxers)):s=r}catch(d){throw i.error("Failed to upgrade outbound connection",d),await e.close(d),d}return this.metrics&&(this.metrics.updatePlaceholder(h,n),u(n)),i("Successfully upgraded outbound connection"),this._createConnection({cryptoProtocol:o,direction:"outbound",maConn:e,upgradedConn:s,Muxer:c,remotePeer:n})}_createConnection({cryptoProtocol:e,direction:t,maConn:r,upgradedConn:n,Muxer:a,remotePeer:f}){let l,d,p;a&&(l=new a({onStream:async e=>{const r=new s.Listener(e);try{const{stream:n,protocol:s}=await r.handle(Array.from(this.protocols.keys()));i("%s: incoming stream opened on %s",t,s),this.metrics&&this.metrics.trackStream({stream:n,remotePeer:f,protocol:s}),p.addStream(e,{protocol:s}),this._onStream({connection:p,stream:{...e,...n},protocol:s})}catch(n){i.error(n)}},onStreamEnd:e=>{p.removeStream(e.id)}}),d=async e=>{i("%s: starting new stream on %s",t,e);const r=l.newStream(),n=new s.Dialer(r);try{const{stream:t,protocol:i}=await n.select(e);return this.metrics&&this.metrics.trackStream({stream:t,remotePeer:f,protocol:i}),{stream:{...r,...t},protocol:i}}catch(o){throw i.error("could not create new stream",o),u(o,h.ERR_UNSUPPORTED_PROTOCOL)}},c(n,l,n).catch(i.error));const b=r.timeline;r.timeline=new Proxy(b,{set:(...e)=>(p&&"close"===e[1]&&e[2]&&!b.close&&(p.stat.status="closed",this.onConnectionEnd(p)),Reflect.set(...e))}),r.timeline.upgraded=Date.now();const y=()=>{throw u(new Error("connection is not multiplexed"),"ERR_CONNECTION_NOT_MULTIPLEXED")};return p=new o({localAddr:r.localAddr,remoteAddr:r.remoteAddr,localPeer:this.localPeer,remotePeer:f,stat:{direction:t,timeline:r.timeline,multiplexer:a&&a.multicodec,encryption:e},newStream:d||y,getStreams:()=>l?l.streams:y,close:e=>r.close(e)}),this.onConnection(p),p}_onStream({connection:e,stream:t,protocol:r}){this.protocols.get(r)({connection:e,stream:t,protocol:r})}async _encryptInbound(e,t,r){const n=new s.Listener(t),o=Array.from(r.keys());i("handling inbound crypto protocol selection",o);try{const{stream:t,protocol:s}=await n.handle(o),a=r.get(s);return i("encrypting inbound connection..."),{...await a.secureInbound(e,t),protocol:s}}catch(a){throw u(a,h.ERR_ENCRYPTION_FAILED)}}async _encryptOutbound(e,t,r,n){const o=new s.Dialer(t),a=Array.from(n.keys());i("selecting outbound crypto protocol",a);try{const{stream:t,protocol:s}=await o.select(a),c=n.get(s);return i("encrypting outbound connection to %j",r),{...await c.secureOutbound(e,t,r),protocol:s}}catch(c){throw u(c,h.ERR_ENCRYPTION_FAILED)}}async _multiplexOutbound(e,t){const r=new s.Dialer(e),n=Array.from(t.keys());i("outbound selecting muxer %s",n);try{const{stream:e,protocol:s}=await r.select(n);i("%s selected as muxer protocol",s);return{stream:e,Muxer:t.get(s)}}catch(o){throw u(o,h.ERR_MUXER_UNAVAILABLE)}}async _multiplexInbound(e,t){const r=new s.Listener(e),n=Array.from(t.keys());i("inbound handling muxers %s",n);try{const{stream:e,protocol:i}=await r.handle(n);return{stream:e,Muxer:t.get(i)}}catch(o){throw u(o,h.ERR_MUXER_UNAVAILABLE)}}}},function(e,t,r){"use strict";const n=r(808),i=r(809),s=r(810),{PROTOCOL_ID:o}=r(317);t.PROTOCOL_ID=o;class a{constructor(e){this._stream=e,this._shaken=!1}async _handshake(){if(this._shaken)return;const{stream:e}=await n(this._stream,o);this._stream=e,this._shaken=!0}}t.Dialer=class extends a{select(e){return n(this._stream,e,this._shaken?null:o)}async ls(){await this._handshake();const{stream:e,protocols:t}=await s(this._stream);return this._stream=e,t}};t.Listener=class extends a{handle(e){return i(this._stream,e)}}},function(e,t,r){"use strict";const n=r(2)("mss:select"),i=r(1),s=r(177),o=r(82);e.exports=async(e,t,r)=>{t=Array.isArray(t)?[...t]:[t];const{reader:a,writer:c,rest:u,stream:f}=o(e),h=t.shift();r?(n('select: write ["%s", "%s"]',r,h),s.writeAll(c,[r,h])):(n('select: write "%s"',h),s.write(c,h));let l=(await s.read(a)).toString();if(n('select: read "%s"',l),l===r&&(l=(await s.read(a)).toString(),n('select: read "%s"',l)),l===h)return u(),{stream:f,protocol:h};for(const i of t){n('select: write "%s"',i),s.write(c,i);const e=(await s.read(a)).toString();if(n('select: read "%s" for "%s"',e,i),e===i)return u(),{stream:f,protocol:i}}throw u(),i(new Error("protocol selection failed"),"ERR_UNSUPPORTED_PROTOCOL")}},function(e,t,r){"use strict";const n=r(2)("mss:handle"),i=r(30),s=r(177),o=r(82),{PROTOCOL_ID:a}=r(317);e.exports=async(e,t)=>{t=Array.isArray(t)?t:[t];const{writer:r,reader:c,rest:u,stream:f}=o(e);for(;;){const e=(await s.read(c)).toString();if(n('read "%s"',e),e!==a){if(t.includes(e))return s.write(r,e),n('respond with "%s" for "%s"',e,e),u(),{stream:f,protocol:e};"ls"!==e?(s.write(r,"na"),n('respond with "na" for "%s"',e)):(s.write(r,new i(t.map(e=>s.encode(e)))),n('respond with "%s" for %s',t,e))}else n('respond with "%s" for "%s"',a,e),s.write(r,a)}}},function(e,t,r){"use strict";const n=r(313),i=r(2)("it-multistream-select:ls"),s=r(177),o=r(82),a=r(25),c=r(19);e.exports=async e=>{const{reader:t,writer:r,rest:u,stream:f}=o(e);i('write "ls"'),s.write(r,"ls"),u();const h=await s.read(t),l=n([h]),d=[];return await c(l,a.decode(),async e=>{for await(const t of e)d.push(t.shallowSlice(0,-1).toString())}),{stream:f,protocols:d}}},function(e,t,r){"use strict";t.Connection=r(812)},function(e,t,r){"use strict";const n=r(6),i=r(15),s=r(21),o=r(1),a=r(813);e.exports=s(class{constructor({localAddr:e,remoteAddr:t,localPeer:r,remotePeer:s,newStream:c,close:u,getStreams:f,stat:h}){!function(e,t,r,s,a,c,u){if(e&&!i.isMultiaddr(e))throw o(new Error("localAddr must be an instance of multiaddr"),"ERR_INVALID_PARAMETERS");if(!n.isPeerId(t))throw o(new Error("localPeer must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");if(!n.isPeerId(r))throw o(new Error("remotePeer must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");if("function"!=typeof s)throw o(new Error("new stream must be a function"),"ERR_INVALID_PARAMETERS");if("function"!=typeof a)throw o(new Error("close must be a function"),"ERR_INVALID_PARAMETERS");if("function"!=typeof c)throw o(new Error("getStreams must be a function"),"ERR_INVALID_PARAMETERS");if(!u)throw o(new Error("connection metadata object must be provided"),"ERR_INVALID_PARAMETERS");if("inbound"!==u.direction&&"outbound"!==u.direction)throw o(new Error('direction must be "inbound" or "outbound"'),"ERR_INVALID_PARAMETERS");if(!u.timeline)throw o(new Error("connection timeline object must be provided in the stat object"),"ERR_INVALID_PARAMETERS");if(!u.timeline.open)throw o(new Error("connection open timestamp must be provided"),"ERR_INVALID_PARAMETERS");if(!u.timeline.upgraded)throw o(new Error("connection upgraded timestamp must be provided"),"ERR_INVALID_PARAMETERS")}(e,r,s,c,u,f,h),this.id=parseInt(1e9*Math.random()).toString(36)+Date.now(),this.localAddr=e,this.remoteAddr=t,this.localPeer=r,this.remotePeer=s,this._stat={...h,status:a.OPEN},this._newStream=c,this._close=u,this._getStreams=f,this.registry=new Map,this.tags=[]}get stat(){return this._stat}get streams(){return this._getStreams()}async newStream(e){if(this.stat.status===a.CLOSING)throw o(new Error("the connection is being closed"),"ERR_CONNECTION_BEING_CLOSED");if(this.stat.status===a.CLOSED)throw o(new Error("the connection is closed"),"ERR_CONNECTION_CLOSED");Array.isArray(e)||(e=[e]);const{stream:t,protocol:r}=await this._newStream(e);return this.addStream(t,{protocol:r}),{stream:t,protocol:r}}addStream(e,{protocol:t,metadata:r={}}){this.registry.set(e.id,{protocol:t,...r})}removeStream(e){this.registry.delete(e)}async close(){if(this.stat.status!==a.CLOSED){if(this._closing)return this._closing;this.stat.status=a.CLOSING,this._closing=await this._close(),this._stat.timeline.close=Date.now(),this.stat.status=a.CLOSED}}},{className:"Connection",symbolName:"@libp2p/interface-connection/connection"})},function(e,t,r){"use strict";e.exports={OPEN:"open",CLOSING:"closing",CLOSED:"closed"}},function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}e.exports=function(e){var t=void 0,r=void 0;function i(e){if(!(e instanceof Object))throw new Error('Target "'+e+'" is not an object');r=e}function s(e){Object.keys(e).forEach((function(t){var r=e[t];if("function"!=typeof r)throw new Error('Trap "'+t+": "+r+'" is not a function');if(!Reflect[t])throw new Error('Trap "'+t+": "+r+'" is not a valid trap')})),t=e}i((function(){})),e&&i(e),s(Reflect);var o=new Proxy({},{get:function(e,i){return function(){for(var e=arguments.length,s=Array(e),o=0;o<e;o++)s[o]=arguments[o];return t[i].apply(null,[r].concat(n(s.slice(1))))}}});return{setTarget:i,setHandler:s,getTarget:function(){return r},getHandler:function(){return t},proxy:new Proxy(r,o)}}},function(e,t,r){"use strict";const n=r(1),i=r(2),s=i("libp2p:peer-store:address-book");s.error=i("libp2p:peer-store:address-book:error");const o=r(15),a=r(6),c=r(107),{codes:{ERR_INVALID_PARAMETERS:u}}=r(20);e.exports=class extends c{constructor(e){super({peerStore:e,eventName:"change:multiaddrs",eventProperty:"multiaddrs",eventTransformer:e=>e.map(e=>e.multiaddr)}),this.data=new Map}set(e,t){if(!a.isPeerId(e))throw s.error("peerId must be an instance of peer-id to store data"),n(new Error("peerId must be an instance of peer-id"),u);const r=this._toAddresses(t),i=e.toB58String(),o=this.data.get(i);if(!r.length)return this;if(o&&o.length===r.length){if(o.filter(e=>r.some(t=>e.multiaddr.equals(t.multiaddr))).length===o.length)return s("the addresses provided to store are equal to the already stored for ".concat(i)),this}return this._setData(e,r),s("stored provided multiaddrs for ".concat(i)),o||this._ps.emit("peer",e),this}add(e,t){if(!a.isPeerId(e))throw s.error("peerId must be an instance of peer-id to store data"),n(new Error("peerId must be an instance of peer-id"),u);const r=this._toAddresses(t),i=e.toB58String(),o=this.data.get(i);return o&&o.forEach(e=>{r.find(t=>t.multiaddr.equals(e.multiaddr))||r.push(e)}),o&&o.length===r.length?(s("the addresses provided to store are already stored for ".concat(i)),this):(this._setData(e,r),s("added provided multiaddrs for ".concat(i)),o||this._ps.emit("peer",e),this)}_toAddresses(e){if(!e)throw s.error("multiaddrs must be provided to store data"),n(new Error("multiaddrs must be provided"),u);const t=[];return e.forEach(e=>{if(!o.isMultiaddr(e))throw s.error("multiaddr ".concat(e," must be an instance of multiaddr")),n(new Error("multiaddr ".concat(e," must be an instance of multiaddr")),u);t.push({multiaddr:e})}),t}getMultiaddrsForPeer(e){if(!a.isPeerId(e))throw n(new Error("peerId must be an instance of peer-id"),u);const t=this.data.get(e.toB58String());if(t)return t.map(t=>{const r=t.multiaddr,n=r.getPeerId();return n&&n===e.toB58String()?r:r.encapsulate("/p2p/".concat(e.toB58String()))})}}},function(e,t,r){"use strict";const n=r(1),i=r(2),s=i("libp2p:peer-store:key-book");s.error=i("libp2p:peer-store:key-book:error");const o=r(6),a=r(107),{codes:{ERR_INVALID_PARAMETERS:c}}=r(20);e.exports=class extends a{constructor(e){super({peerStore:e,eventName:"change:pubkey",eventProperty:"pubkey",eventTransformer:e=>e.pubKey}),this.data=new Map}set(e,t){if(!o.isPeerId(e))throw s.error("peerId must be an instance of peer-id to store data"),n(new Error("peerId must be an instance of peer-id"),c);const r=e.toB58String();return!this.data.get(r)&&t&&(e.pubKey=t,this._setData(e,e),s("stored provided public key for ".concat(r))),this}get(e){if(!o.isPeerId(e))throw n(new Error("peerId must be an instance of peer-id"),c);const t=this.data.get(e.toB58String());return t?t.pubKey:void 0}}},function(e,t,r){"use strict";const n=r(1),i=r(2),s=i("libp2p:peer-store:proto-book");s.error=i("libp2p:peer-store:proto-book:error");const{Buffer:o}=r(0),a=r(6),c=r(107),{codes:{ERR_INVALID_PARAMETERS:u}}=r(20);e.exports=class extends c{constructor(e){super({peerStore:e,eventName:"change:metadata",eventProperty:"metadata"}),this.data=new Map}set(e,t,r){if(!a.isPeerId(e))throw s.error("peerId must be an instance of peer-id to store data"),n(new Error("peerId must be an instance of peer-id"),u);if("string"!=typeof t||!o.isBuffer(r))throw s.error("valid key and value must be provided to store data"),n(new Error("valid key and value must be provided"),u);return this._setValue(e,t,r),this}_setValue(e,t,r,{emit:n=!0}={}){const i=e.toB58String(),o=this.data.get(i)||new Map,a=o.get(t);a&&r.equals(a)?s("the metadata provided to store is equal to the already stored for ".concat(i," on ").concat(t)):(o.set(t,r),this.data.set(i,o),n&&this._emit(e,t))}get(e){if(!a.isPeerId(e))throw n(new Error("peerId must be an instance of peer-id"),u);return this.data.get(e.toB58String())}getValue(e,t){if(!a.isPeerId(e))throw n(new Error("peerId must be an instance of peer-id"),u);const r=this.data.get(e.toB58String());return r&&r.get(t)}delete(e){if(!a.isPeerId(e))throw n(new Error("peerId must be an instance of peer-id"),u);return!!this.data.delete(e.toB58String())&&(this._emit(e),!0)}deleteValue(e,t){if(!a.isPeerId(e))throw n(new Error("peerId must be an instance of peer-id"),u);const r=this.data.get(e.toB58String());return!(!r||!r.delete(t))&&(this._emit(e,t),!0)}}},function(e,t,r){"use strict";const n=r(1),i=r(2),s=i("libp2p:peer-store:proto-book");s.error=i("libp2p:peer-store:proto-book:error");const o=r(6),a=r(107),{codes:{ERR_INVALID_PARAMETERS:c}}=r(20);e.exports=class extends a{constructor(e){super({peerStore:e,eventName:"change:protocols",eventProperty:"protocols",eventTransformer:e=>Array.from(e)}),this.data=new Map}set(e,t){if(!o.isPeerId(e))throw s.error("peerId must be an instance of peer-id to store data"),n(new Error("peerId must be an instance of peer-id"),c);if(!t)throw s.error("protocols must be provided to store data"),n(new Error("protocols must be provided"),c);const r=e.toB58String(),i=this.data.get(r),a=new Set(t);return i&&(f=a,(u=i).size===f.size&&[...u].every(e=>f.has(e)))?(s("the protocols provided to store are equal to the already stored for ".concat(r)),this):(this._setData(e,a),s("stored provided protocols for ".concat(r)),this);var u,f}add(e,t){if(!o.isPeerId(e))throw s.error("peerId must be an instance of peer-id to store data"),n(new Error("peerId must be an instance of peer-id"),c);if(!t)throw s.error("protocols must be provided to store data"),n(new Error("protocols must be provided"),c);const r=e.toB58String(),i=this.data.get(r)||new Set,a=new Set([...i,...t]);return i.size===a.size?(s("the protocols provided to store are already stored for ".concat(r)),this):(t=[...a],this._setData(e,a),s("added provided protocols for ".concat(r)),this)}}},function(e,t,r){"use strict";const n=r(2),i=n("libp2p:persistent-peer-store");i.error=n("libp2p:persistent-peer-store:error");const{Key:s}=r(7),o=r(15),a=r(6),c=r(318),{NAMESPACE_ADDRESS:u,NAMESPACE_COMMON:f,NAMESPACE_KEYS:h,NAMESPACE_METADATA:l,NAMESPACE_PROTOCOL:d}=r(820),p=r(821),b=r(822);e.exports=class extends c{constructor({datastore:e,threshold:t=5}){super(),this._datastore=e,this._dirtyPeers=new Set,this._dirtyMetadata=new Map,this.threshold=t,this._addDirtyPeer=this._addDirtyPeer.bind(this)}async start(){i("PeerStore is starting"),this.on("change:protocols",this._addDirtyPeer),this.on("change:multiaddrs",this._addDirtyPeer),this.on("change:pubkey",this._addDirtyPeer),this.on("change:metadata",this._addDirtyPeerMetadata);for await(const e of this._datastore.query({prefix:f}))await this._processDatastoreEntry(e);i("PeerStore started")}async stop(){i("PeerStore is stopping"),this.removeAllListeners(),await this._commitData(),i("PeerStore stopped")}_addDirtyPeer({peerId:e}){const t=e.toB58String();i("add dirty peer",t),this._dirtyPeers.add(t),this._dirtyPeers.size>=this.threshold&&this._commitData().catch(e=>{i.error("error committing data",e)})}_addDirtyPeerMetadata({peerId:e,metadata:t}){const r=e.toB58String();i("add dirty metadata peer",r),this._dirtyPeers.add(r);const n=this._dirtyMetadata.get(r)||new Set;n.add(t),this._dirtyMetadata.set(r,n),this._dirtyPeers.size>=this.threshold&&this._commitData().catch(e=>{i.error("error committing data",e)})}async _commitData(){const e=Array.from(this._dirtyPeers);if(!e.length)return;this._dirtyPeers.clear(),i("create batch commit");const t=this._datastore.batch();for(const r of e){const e=this.keyBook.data.get(r)||a.createFromCID(r);this._batchAddressBook(e,t),this._batchKeyBook(e,t),this._batchMetadataBook(e,t),this._batchProtoBook(e,t)}await t.commit(),i("batch committed")}_batchAddressBook(e,t){const r=e.toString(),n=new s("".concat(u).concat(r)),o=this.addressBook.get(e);try{if(!o)return void t.delete(n);const e=p.encode({addrs:o.map(e=>({multiaddr:e.multiaddr.buffer}))});t.put(n,e)}catch(a){i.error(a)}}_batchKeyBook(e,t){const r=e.toString(),n=new s("".concat(h).concat(r));try{if(!e.pubKey)return void t.delete(n);const r=e.marshalPubKey();t.put(n,r)}catch(o){i.error(o)}}_batchMetadataBook(e,t){const r=e.toString(),n=this._dirtyMetadata.get(e.toB58String())||[];try{n.forEach(n=>{const i=new s("".concat(l).concat(r,"/").concat(n)),o=this.metadataBook.getValue(e,n);o?t.put(i,o):t.delete(i)})}catch(o){i.error(o)}}_batchProtoBook(e,t){const r=e.toString(),n=new s("".concat(d).concat(r)),o=this.protoBook.get(e);try{if(!o)return void t.delete(n);const e=b.encode({protocols:o});t.put(n,e)}catch(a){i.error(a)}}async _processDatastoreEntry({key:e,value:t}){try{const r=e.toString().split("/"),n=a.createFromCID(r[3]);let s;switch(r[2]){case"addrs":s=p.decode(t),this.addressBook._setData(n,s.addrs.map(e=>({multiaddr:o(e.multiaddr)})),{emit:!1});break;case"keys":s=await a.createFromPubKey(t),this.keyBook._setData(s,s,{emit:!1});break;case"metadata":this.metadataBook._setValue(n,r[4],t,{emit:!1});break;case"protos":s=b.decode(t),this.protoBook._setData(n,new Set(s.protocols),{emit:!1});break;default:i("invalid data persisted for: ",e.toString())}}catch(r){i.error(r)}}}},function(e,t,r){"use strict";e.exports.NAMESPACE_COMMON="/peers/",e.exports.NAMESPACE_ADDRESS="/peers/addrs/",e.exports.NAMESPACE_KEYS="/peers/keys/",e.exports.NAMESPACE_METADATA="/peers/metadata/",e.exports.NAMESPACE_PROTOCOL="/peers/protos/"},function(e,t,r){"use strict";const n=r(16);e.exports=n("\nmessage Addresses {\n message Address {\n required bytes multiaddr = 1;\n }\n\n repeated Address addrs = 1;\n}\n").Addresses},function(e,t,r){"use strict";const n=r(16);e.exports=n("\nmessage Protocols {\n repeated string protocols = 1;\n}\n").Protocols},function(e,t,r){"use strict";const n=r(2),i=r(1);n("libp2p:peer-store").error=n("libp2p:peer-store:error");const{ERR_INVALID_PARAMETERS:s}=r(20),o=r(304);e.exports=class{constructor({peerStore:e,connectionManager:t}){this.peerStore=e,this.connectionManager=t,this.topologies=new Map,this._handle=void 0,this._onDisconnect=this._onDisconnect.bind(this),this.connectionManager.on("peer:disconnect",this._onDisconnect)}get handle(){return this._handle}set handle(e){this._handle=e}getConnection(e){return this.connectionManager.get(e)}register(e){if(!o.isTopology(e))throw i(new Error("topology must be an instance of interfaces/topology"),s);const t=parseInt(1e9*Math.random()).toString(36)+Date.now();return this.topologies.set(t,e),e.registrar=this,t}unregister(e){return this.topologies.delete(e)}_onDisconnect(e,t){for(const[,r]of this.topologies)r.disconnect(e.remotePeer,t)}}},function(e,t,r){"use strict";const n=r(2),i=n("libp2p-ping");i.error=n("libp2p-ping:error");const s=r(1),o=r(28),a=r(19),{toBuffer:c}=r(108),{collect:u,take:f}=r(176),{PROTOCOL:h,PING_LENGTH:l}=r(825);(t=e.exports=async function(e,t){i("dialing %s to %s",h,t.toB58String?t.toB58String():t);const{stream:r}=await e.dialProtocol(t,h),n=new Date,d=o.randomBytes(l),[p]=await a([d],r,e=>f(1,e),c,u),b=Date.now();if(!d.equals(p))throw s(new Error("Received wrong ping ack"),"ERR_WRONG_PING_ACK");return b-n}).mount=function(e){e.handle(h,({stream:e})=>a(e,e))},t.unmount=function(e){e.unhandle(h)}},function(e,t,r){"use strict";e.exports={PROTOCOL:"/ipfs/ping/1.0.0",PING_LENGTH:32}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(2),s=r(827),o=r(25),a=r(19),{collect:c,take:u,consume:f}=r(176),h=r(6),l=r(15),{toBuffer:d}=r(108),p=r(829),b=i("libp2p:identify");b.error=i("libp2p:identify:error");const{MULTICODEC_IDENTIFY:y,MULTICODEC_IDENTIFY_PUSH:m,AGENT_VERSION:g,PROTOCOL_VERSION:v}=r(830),w=r(1),{codes:_}=r(20);class E{static getCleanMultiaddr(e){if(e&&e.length>0)try{return l(e)}catch(t){return null}return null}constructor({libp2p:e,protocols:t}){this.peerStore=e.peerStore,this.connectionManager=e.connectionManager,this.connectionManager.on("peer:connect",e=>{const t=e.remotePeer;this.identify(e,t).catch(b.error)}),this.peerId=e.peerId,this._libp2p=e,this._protocols=t,this.handleMessage=this.handleMessage.bind(this)}push(e){const t=e.map(async e=>{try{const{stream:t}=await e.newStream(m);await a([{listenAddrs:this._libp2p.multiaddrs.map(e=>e.buffer),protocols:Array.from(this._protocols.keys())}],s.encode(p),t,f)}catch(t){b.error("could not push identify update to peer",t)}});return Promise.all(t)}pushToPeerStore(e){const t=[];let r;for(const n of e.peers.values())n.protocols.includes(m)&&(r=this.connectionManager.get(n.id))&&t.push(r);this.push(t)}async identify(e){const{stream:t}=await e.newStream(y),[r]=await a([],t,o.decode(),u(1),d,c);if(!r)throw w(new Error("No data could be retrieved"),_.ERR_CONNECTION_ENDED);let i;try{i=p.decode(r)}catch(k){throw w(k,_.ERR_INVALID_MESSAGE)}let{publicKey:s,listenAddrs:f,protocols:m,observedAddr:g}=i;const v=await h.createFromPubKey(s);if(e.remotePeer.toB58String()!==v.toB58String())throw w(new Error("identified peer does not match the expected peer"),_.ERR_INVALID_PEER);g=E.getCleanMultiaddr(g),this.peerStore.addressBook.set(v,f.map(e=>l(e))),this.peerStore.protoBook.set(v,m),this.peerStore.metadataBook.set(v,"AgentVersion",n.from(i.agentVersion)),b("received observed address of %s",g)}handleMessage({connection:e,stream:t,protocol:r}){switch(r){case y:return this._handleIdentify({connection:e,stream:t});case m:return this._handlePush({connection:e,stream:t});default:b.error("cannot handle unknown protocol %s",r)}}async _handleIdentify({connection:e,stream:t}){let r=n.alloc(0);this.peerId.pubKey&&(r=this.peerId.pubKey.bytes);const i=p.encode({protocolVersion:v,agentVersion:g,publicKey:r,listenAddrs:this._libp2p.multiaddrs.map(e=>e.buffer),observedAddr:e.remoteAddr.buffer,protocols:Array.from(this._protocols.keys())});try{await a([i],o.encode(),t,f)}catch(s){b.error("could not respond to identify request",s)}}async _handlePush({connection:e,stream:t}){let r;try{const[e]=await a([],t,o.decode(),u(1),d,c);r=p.decode(e)}catch(i){return b.error("received invalid message",i)}const n=e.remotePeer;try{this.peerStore.addressBook.set(n,r.listenAddrs.map(e=>l(e)))}catch(i){return b.error("received invalid listen addrs",i)}this.peerStore.protoBook.set(n,r.protocols)}}e.exports.IdentifyService=E,e.exports.multicodecs={IDENTIFY:y,IDENTIFY_PUSH:m},e.exports.Message=p},function(e,t,r){"use strict";const n=r(25),i=r(828),s=r(108);e.exports.encode=e=>t=>n.encode()(i.encode(e)(t)),e.exports.decode=e=>t=>i.decode(e)(s(n.decode()(t))),e.exports.it=i},function(e,t,r){"use strict";e.exports.encode=e=>t=>async function*(){for await(const r of t)yield e.encode(r)}(),e.exports.decode=e=>t=>async function*(){for await(const r of t)yield e.decode(r)}()},function(e,t,r){"use strict";const n=r(16);e.exports=n("\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").Identify},function(e,t,r){"use strict";const n=r(831).version;e.exports.PROTOCOL_VERSION="ipfs/0.1.0",e.exports.AGENT_VERSION="js-libp2p/".concat(n),e.exports.MULTICODEC_IDENTIFY="/ipfs/id/1.0.0",e.exports.MULTICODEC_IDENTIFY_PUSH="/ipfs/id/push/1.0.0"},function(e){e.exports=JSON.parse('{"_from":"libp2p@^0.28.5","_id":"libp2p@0.28.10","_inBundle":false,"_integrity":"sha512-0WR86vPj3RIEP7jFWBy1J4GBp8wweC1pmzy5nfKZazP22wA/crqqnxcr4xGs/7lzFyfBJuqRIswz3/IrlgO+ag==","_location":"/libp2p","_phantomChildren":{},"_requested":{"type":"range","registry":true,"raw":"libp2p@^0.28.5","name":"libp2p","escapedName":"libp2p","rawSpec":"^0.28.5","saveSpec":null,"fetchSpec":"^0.28.5"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/libp2p/-/libp2p-0.28.10.tgz","_shasum":"5d83cf6683c4bed09b6be59787e91ac96b29f91f","_spec":"libp2p@^0.28.5","_where":"/Users/alex/Documents/Workspaces/ipfs/js-ipfs","bugs":{"url":"https://github.com/libp2p/js-libp2p/issues"},"bundleDependencies":false,"contributors":[{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Alan Shaw","email":"alan@tableflip.io"},{"name":"Cayman","email":"caymannava@gmail.com"},{"name":"Alex Potsides","email":"alex@achingbrain.net"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Maciej Krüger","email":"mkg20001@gmail.com"},{"name":"Hugo Dias","email":"mail@hugodias.me"},{"name":"dirkmc","email":"dirkmdev@gmail.com"},{"name":"Volker Mische","email":"volker.mische@gmail.com"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"},{"name":"Andrew Nesbitt","email":"andrewnez@gmail.com"},{"name":"Elven","email":"mon.samuel@qq.com"},{"name":"Giovanni T. Parra","email":"fiatjaf@gmail.com"},{"name":"Ryan Bell","email":"ryan@piing.net"},{"name":"Thomas Eizinger","email":"thomas@eizinger.io"},{"name":"Didrik Nordström","email":"didrik@betamos.se"},{"name":"Francis Gulotta","email":"wizard@roborooter.com"},{"name":"Florian-Merle","email":"florian.david.merle@gmail.com"},{"name":"Joel Gustafson","email":"joelg@mit.edu"},{"name":"Julien Bouquillon","email":"contact@revolunet.com"},{"name":"Kevin Kwok","email":"antimatter15@gmail.com"},{"name":"Felipe Martins","email":"felipebrasil93@gmail.com"},{"name":"Nuno Nogueira","email":"nunofmn@gmail.com"},{"name":"Fei Liu","email":"liu.feiwood@gmail.com"},{"name":"RasmusErik Voel Jensen","email":"github@solsort.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Soeren","email":"nikorpoulsen@gmail.com"},{"name":"Sönke Hahn","email":"soenkehahn@gmail.com"},{"name":"Tiago Alves","email":"alvesjtiago@gmail.com"},{"name":"Diogo Silva","email":"fsdiogo@gmail.com"},{"name":"Yusef Napora","email":"yusef@napora.org"},{"name":"Zane Starr","email":"zcstarr@gmail.com"},{"name":"Daijiro Wachi","email":"daijiro.wachi@gmail.com"},{"name":"Chris Bratlien","email":"chrisbratlien@gmail.com"},{"name":"ebinks","email":"elizabethjbinks@gmail.com"},{"name":"Bernd Strehl","email":"bernd.strehl@gmail.com"},{"name":"isan_rivkin","email":"isanrivkin@gmail.com"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"robertkiel","email":"robert.kiel@validitylabs.org"},{"name":"Irakli Gozalishvili","email":"rfobic@gmail.com"}],"dependencies":{"abort-controller":"^3.0.0","aggregate-error":"^3.0.1","any-signal":"^1.1.0","bignumber.js":"^9.0.0","class-is":"^1.1.0","debug":"^4.1.1","err-code":"^2.0.0","events":"^3.1.0","hashlru":"^2.3.0","interface-datastore":"^1.0.4","ipfs-utils":"^2.2.0","it-all":"^1.0.1","it-buffer":"^0.1.2","it-handshake":"^1.0.1","it-length-prefixed":"^3.0.1","it-pipe":"^1.1.0","it-protocol-buffers":"^0.2.0","libp2p-crypto":"^0.17.9","libp2p-interfaces":"^0.3.1","libp2p-utils":"^0.1.2","mafmt":"^7.0.0","merge-options":"^2.0.0","moving-average":"^1.0.0","multiaddr":"^7.4.3","multistream-select":"^0.15.0","mutable-proxy":"^1.0.0","node-forge":"^0.9.1","p-any":"^3.0.0","p-fifo":"^1.0.0","p-settle":"^4.0.1","peer-id":"^0.13.11","protons":"^1.0.1","retimer":"^2.0.0","sanitize-filename":"^1.6.3","streaming-iterables":"^4.1.0","timeout-abort-controller":"^1.0.0","xsalsa20":"^1.0.2"},"deprecated":false,"description":"JavaScript implementation of libp2p, a modular peer to peer network stack","devDependencies":{"@nodeutils/defaults-deep":"^1.1.0","abortable-iterator":"^3.0.0","aegir":"^22.0.0","chai":"^4.2.0","chai-as-promised":"^7.1.1","chai-bytes":"^0.1.2","chai-string":"^1.5.0","cids":"^0.8.0","datastore-fs":"^1.1.0","datastore-level":"^1.1.0","delay":"^4.3.0","dirty-chai":"^2.0.1","interop-libp2p":"^0.1.0","ipfs-http-client":"^44.0.0","it-concat":"^1.0.0","it-pair":"^1.0.0","it-pushable":"^1.4.0","level":"^6.0.1","libp2p-bootstrap":"^0.11.0","libp2p-delegated-content-routing":"^0.5.0","libp2p-delegated-peer-routing":"^0.5.0","libp2p-floodsub":"^0.21.0","libp2p-gossipsub":"^0.4.6","libp2p-kad-dht":"^0.19.1","libp2p-mdns":"^0.14.1","libp2p-mplex":"^0.9.5","libp2p-noise":"^1.1.1","libp2p-secio":"^0.12.4","libp2p-tcp":"^0.14.1","libp2p-webrtc-star":"^0.18.0","libp2p-websockets":"^0.13.1","multihashes":"^0.4.19","nock":"^12.0.3","p-defer":"^3.0.0","p-times":"^3.0.0","p-wait-for":"^3.1.0","promisify-es6":"^1.0.3","rimraf":"^3.0.2","sinon":"^9.0.2"},"engines":{"node":">=10.0.0","npm":">=6.0.0"},"files":["dist","src"],"homepage":"https://libp2p.io","keywords":["libp2p","network","p2p","peer","peer-to-peer","IPFS"],"leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","license":"MIT","main":"src/index.js","name":"libp2p","repository":{"type":"git","url":"git+https://github.com/libp2p/js-libp2p.git"},"scripts":{"build":"aegir build","coverage":"nyc --reporter=text --reporter=lcov npm run test:node","lint":"aegir lint","release":"aegir release -t node -t browser","release-major":"aegir release --type major -t node -t browser","release-minor":"aegir release --type minor -t node -t browser","test":"npm run test:node && npm run test:browser","test:browser":"aegir test -t browser","test:node":"aegir test -t node -f \\"./test/**/*.{node,spec}.js\\""},"version":"0.28.10"}')},function(e,t,r){"use strict";const n=r(833),i=r(862),s=r(891),{NOISE:o}=r(897),a=r(937),c=r(951),u=r(303),f=r(302);e.exports=()=>({dialer:{maxParallelDials:150,maxDialsPerPeer:4,dialTimeout:1e4},modules:{transport:[n,i],streamMuxer:[s],connEncryption:[a,o],peerDiscovery:[],dht:c,pubsub:u},config:{peerDiscovery:{autoDial:!0,bootstrap:{enabled:!0},webRTCStar:{enabled:!0},websocketStar:{enabled:!0}},dht:{kBucketSize:20,enabled:!1,clientMode:!0,randomWalk:{enabled:!1},validators:{ipns:f.validator},selectors:{ipns:f.selector}},pubsub:{enabled:!0,emitSelf:!0}},metrics:{enabled:!0},peerStore:{persistence:!0,threshold:1}})},function(e,t,r){"use strict";const n=r(834),i=r(58),s=r(21),o=r(297),{AbortError:a}=r(52),c=r(2)("libp2p:websockets"),u=r(851),f=r(852),{CODE_CIRCUIT:h,CODE_P2P:l}=r(319);e.exports=s(class{constructor({upgrader:e}){if(!e)throw new Error("An upgrader must be provided. See https://github.com/libp2p/interface-transport#upgrader.");this._upgrader=e}async dial(e,t={}){c("dialing %s",e);const r=await this._connect(e,t),n=f(r,{remoteAddr:e,signal:t.signal});c("new outbound connection %s",n.remoteAddr);const i=await this._upgrader.upgradeOutbound(n);return c("outbound connection %s upgraded",n.remoteAddr),i}async _connect(e,t={}){if(t.signal&&t.signal.aborted)throw new a;const r=e.toOptions();c("dialing %s:%s",r.host,r.port);const i=n(o(e),Object.assign({binary:!0},t));if(!t.signal)return await i.connected(),c("connected %s",e),i;let s;const u=new Promise((e,r)=>{if(s=()=>{r(new a),i.close()},t.signal.aborted)return s();t.signal.addEventListener("abort",s)});try{await Promise.race([u,i.connected()])}finally{t.signal.removeEventListener("abort",s)}return c("connected %s",e),i}createListener(e={},t){return"function"==typeof e&&(t=e,e={}),u({handler:t,upgrader:this._upgrader},e)}filter(e){return(e=Array.isArray(e)?e:[e]).filter(e=>!e.protoCodes().includes(h)&&(i.WebSockets.matches(e.decapsulateCode(l))||i.WebSocketsSecure.matches(e.decapsulateCode(l))))}},{className:"WebSockets",symbolName:"@libp2p/js-libp2p-websockets/websockets"})},function(e,t,r){"use strict";var n=r(835),i=r(837),s=r(843);e.exports=function(e,t={}){const r="undefined"==typeof window?{}:window.location,o=s(e,r),a=new n(o,t.websocket),c=i(a,t);return c.remoteAddress=o,c.close=()=>new Promise((e,t)=>{a.addEventListener("close",e),a.close()}),c.destroy=()=>{a.terminate?a.terminate():a.close()},c.socket=a,c},e.exports.connect=e.exports},function(e,t,r){"use strict";e.exports="undefined"==typeof WebSocket?r(836):WebSocket},function(e,t){},function(e,t,r){"use strict";const n=r(838),i=r(841);e.exports=(e,t)=>{(t=t||{}).binaryType?e.binaryType=t.binaryType:t.binary&&(e.binaryType="arraybuffer");const r={sink:i(e,t),source:n(e,t),connected:()=>r.source.connected()};return r}},function(e,t,r){"use strict";const{Buffer:n}=r(0),{EventIterator:i}=r(839);e.exports=e=>{const t=e.removeEventListener||e.removeListener,r=async function*(){const r=new i(({push:r,stop:n,fail:i})=>(e.addEventListener("message",r),e.addEventListener("error",i),e.addEventListener("close",n),()=>{t.call(e,"message",r),t.call(e,"error",i),t.call(e,"close",n)}),{highWaterMark:1/0});for await(const{data:e}of r)yield(s=e,s instanceof ArrayBuffer||null!=s&&null!=s.constructor&&"ArrayBuffer"===s.constructor.name&&"number"==typeof s.byteLength?n.from(e):e);var s}();let s,o=1===e.readyState;return e.addEventListener("open",()=>{o=!0,s=null}),e.addEventListener("close",()=>{o=!1,s=null}),e.addEventListener("error",e=>{o||(s=e)}),r.connected=()=>new Promise((r,n)=>{if(o)return r();if(s)return n(s);const i=r=>{t.call(e,"open",a),t.call(e,"error",c),r()},a=()=>i(r),c=e=>i(()=>n(e));e.addEventListener("open",a),e.addEventListener("error",c)}),r}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(840);t.EventIterator=n.EventIterator,t.subscribe=function(e,t,r){return new n.EventIterator(({push:r})=>(this.addEventListener(e,r,t),()=>this.removeEventListener(e,r,t)),r)},t.default=n.EventIterator},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n{constructor(){this.pullQueue=[],this.pushQueue=[],this.eventHandlers={},this.isPaused=!1,this.isStopped=!1}push(e){if(this.isStopped)return;const t={value:e,done:!1};if(this.pullQueue.length){const e=this.pullQueue.shift();e&&e.resolve(t)}else this.pushQueue.push(Promise.resolve(t)),void 0!==this.highWaterMark&&this.pushQueue.length>=this.highWaterMark&&!this.isPaused&&(this.isPaused=!0,this.eventHandlers.highWater?this.eventHandlers.highWater():console&&console.warn("EventIterator queue reached ".concat(this.pushQueue.length," items")))}stop(){if(!this.isStopped){this.isStopped=!0,this.remove();for(const e of this.pullQueue)e.resolve({value:void 0,done:!0});this.pullQueue.length=0}}fail(e){if(!this.isStopped)if(this.isStopped=!0,this.remove(),this.pullQueue.length){for(const t of this.pullQueue)t.reject(e);this.pullQueue.length=0}else{const t=Promise.reject(e);t.catch(()=>{}),this.pushQueue.push(t)}}remove(){Promise.resolve().then(()=>{this.removeCallback&&this.removeCallback()})}[Symbol.asyncIterator](){return{next:e=>{const t=this.pushQueue.shift();return t?(void 0!==this.lowWaterMark&&this.pushQueue.length<=this.lowWaterMark&&this.isPaused&&(this.isPaused=!1,this.eventHandlers.lowWater&&this.eventHandlers.lowWater()),t):this.isStopped?Promise.resolve({value:void 0,done:!0}):new Promise((e,t)=>{this.pullQueue.push({resolve:e,reject:t})})},return:()=>(this.isStopped=!0,this.pushQueue.length=0,this.remove(),Promise.resolve({value:void 0,done:!0}))}}}class i{constructor(e,{highWaterMark:t=100,lowWaterMark:r=1}={}){const i=new n;i.highWaterMark=t,i.lowWaterMark=r,i.removeCallback=e({push:e=>i.push(e),stop:()=>i.stop(),fail:e=>i.fail(e),on:(e,t)=>{i.eventHandlers[e]=t}})||(()=>{}),this[Symbol.asyncIterator]=()=>i[Symbol.asyncIterator](),Object.freeze(this)}}t.EventIterator=i,t.default=i},function(e,t,r){"use strict";const n=r(842);e.exports=(e,t)=>((t=t||{}).closeOnEnd=!1!==t.closeOnEnd,async r=>{for await(const t of r){try{await n(e)}catch(i){if("socket closed"===i.message)break;throw i}e.send(t)}if(t.closeOnEnd&&e.readyState<=1)return new Promise((t,r)=>{e.addEventListener("close",e=>{if(e.wasClean||1006===e.code)t();else{const t=Object.assign(new Error("ws error"),{event:e});r(t)}}),setTimeout(()=>e.close())})})},function(e,t,r){"use strict";e.exports=async e=>{if(e.readyState>=2)throw new Error("socket closed");if(1!==e.readyState)return new Promise((t,r)=>{const n=e&&(e.removeEventListener||e.removeListener);function i(){"function"==typeof n&&(n.call(e,"open",s),n.call(e,"error",o))}function s(){i(),t()}function o(e){i(),r(e)}e.addEventListener("open",s),e.addEventListener("error",o)})}},function(e,t,r){"use strict";const n=r(844),i={http:"ws",https:"wss"};e.exports=(e,t)=>n(e,t,i,"ws")},function(e,t,r){"use strict";var n=r(845);e.exports=function(e,t,r,i){var s;return r=r||{},s=(e=n.parse(e,!1,!0)).protocol?e.protocol:(r[s=t.protocol?t.protocol.replace(/:$/,""):"http"]||i||s)+":",e.host&&":"===e.host[0]&&(e.host=null),e.hostname?n.format({protocol:s,slashes:!0,hostname:e.hostname,port:e.port,pathname:e.pathname,search:e.search}):(e.host=t.host,e.port?n.format({protocol:s,slashes:!0,host:t.hostname+":"+e.port,port:e.port,pathname:e.pathname,search:e.search}):e.pathname?n.format({protocol:s,slashes:!0,host:e.host,pathname:e.pathname,search:e.search}):(e.pathname=t.pathname,e.search?n.format({protocol:s,slashes:!0,host:e.host,pathname:e.pathname,search:e.search}):(e.search=t.search,e.format(e))))}},function(e,t,r){"use strict";var n=r(846),i=r(847);function s(){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=v,t.resolve=function(e,t){return v(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?v(e,!1,!0).resolveObject(t):t},t.format=function(e){i.isString(e)&&(e=v(e));return e instanceof s?e.format():s.prototype.format.call(e)},t.Url=s;var o=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,c=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),f=["'"].concat(u),h=["%","/","?",";","#"].concat(f),l=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,b={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},m={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},g=r(848);function v(e,t,r){if(e&&i.isObject(e)&&e instanceof s)return e;var n=new s;return n.parse(e,t,r),n}s.prototype.parse=function(e,t,r){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var s=e.indexOf("?"),a=-1!==s&&s<e.indexOf("#")?"?":"#",u=e.split(a);u[0]=u[0].replace(/\\/g,"/");var v=e=u.join(a);if(v=v.trim(),!r&&1===e.split("#").length){var w=c.exec(v);if(w)return this.path=v,this.href=v,this.pathname=w[1],w[2]?(this.search=w[2],this.query=t?g.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var _=o.exec(v);if(_){var E=(_=_[0]).toLowerCase();this.protocol=E,v=v.substr(_.length)}if(r||_||v.match(/^\/\/[^@\/]+@[^@\/]+/)){var k="//"===v.substr(0,2);!k||_&&y[_]||(v=v.substr(2),this.slashes=!0)}if(!y[_]&&(k||_&&!m[_])){for(var S,A,I=-1,T=0;T<l.length;T++){-1!==(R=v.indexOf(l[T]))&&(-1===I||R<I)&&(I=R)}-1!==(A=-1===I?v.lastIndexOf("@"):v.lastIndexOf("@",I))&&(S=v.slice(0,A),v=v.slice(A+1),this.auth=decodeURIComponent(S)),I=-1;for(T=0;T<h.length;T++){var R;-1!==(R=v.indexOf(h[T]))&&(-1===I||R<I)&&(I=R)}-1===I&&(I=v.length),this.host=v.slice(0,I),v=v.slice(I),this.parseHost(),this.hostname=this.hostname||"";var x="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!x)for(var C=this.hostname.split(/\./),B=(T=0,C.length);T<B;T++){var M=C[T];if(M&&!M.match(d)){for(var N="",P=0,O=M.length;P<O;P++)M.charCodeAt(P)>127?N+="x":N+=M[P];if(!N.match(d)){var D=C.slice(0,T),L=C.slice(T+1),j=M.match(p);j&&(D.push(j[1]),L.unshift(j[2])),L.length&&(v="/"+L.join(".")+v),this.hostname=D.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),x||(this.hostname=n.toASCII(this.hostname));var U=this.port?":"+this.port:"",z=this.hostname||"";this.host=z+U,this.href+=this.host,x&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==v[0]&&(v="/"+v))}if(!b[E])for(T=0,B=f.length;T<B;T++){var F=f[T];if(-1!==v.indexOf(F)){var q=encodeURIComponent(F);q===F&&(q=escape(F)),v=v.split(F).join(q)}}var K=v.indexOf("#");-1!==K&&(this.hash=v.substr(K),v=v.slice(0,K));var V=v.indexOf("?");if(-1!==V?(this.search=v.substr(V),this.query=v.substr(V+1),t&&(this.query=g.parse(this.query)),v=v.slice(0,V)):t&&(this.search="",this.query={}),v&&(this.pathname=v),m[E]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){U=this.pathname||"";var H=this.search||"";this.path=U+H}return this.href=this.format(),this},s.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",r=this.pathname||"",n=this.hash||"",s=!1,o="";this.host?s=e+this.host:this.hostname&&(s=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(o=g.stringify(this.query));var a=this.search||o&&"?"+o||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||m[t])&&!1!==s?(s="//"+(s||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):s||(s=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),t+s+(r=r.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(a=a.replace("#","%23"))+n},s.prototype.resolve=function(e){return this.resolveObject(v(e,!1,!0)).format()},s.prototype.resolveObject=function(e){if(i.isString(e)){var t=new s;t.parse(e,!1,!0),e=t}for(var r=new s,n=Object.keys(this),o=0;o<n.length;o++){var a=n[o];r[a]=this[a]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var c=Object.keys(e),u=0;u<c.length;u++){var f=c[u];"protocol"!==f&&(r[f]=e[f])}return m[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!m[e.protocol]){for(var h=Object.keys(e),l=0;l<h.length;l++){var d=h[l];r[d]=e[d]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||y[e.protocol])r.pathname=e.pathname;else{for(var p=(e.pathname||"").split("/");p.length&&!(e.host=p.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),r.pathname=p.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var b=r.pathname||"",g=r.search||"";r.path=b+g}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var v=r.pathname&&"/"===r.pathname.charAt(0),w=e.host||e.pathname&&"/"===e.pathname.charAt(0),_=w||v||r.host&&e.pathname,E=_,k=r.pathname&&r.pathname.split("/")||[],S=(p=e.pathname&&e.pathname.split("/")||[],r.protocol&&!m[r.protocol]);if(S&&(r.hostname="",r.port=null,r.host&&(""===k[0]?k[0]=r.host:k.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===p[0]?p[0]=e.host:p.unshift(e.host)),e.host=null),_=_&&(""===p[0]||""===k[0])),w)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,k=p;else if(p.length)k||(k=[]),k.pop(),k=k.concat(p),r.search=e.search,r.query=e.query;else if(!i.isNullOrUndefined(e.search)){if(S)r.hostname=r.host=k.shift(),(x=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=x.shift(),r.host=r.hostname=x.shift());return r.search=e.search,r.query=e.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!k.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var A=k.slice(-1)[0],I=(r.host||e.host||k.length>1)&&("."===A||".."===A)||""===A,T=0,R=k.length;R>=0;R--)"."===(A=k[R])?k.splice(R,1):".."===A?(k.splice(R,1),T++):T&&(k.splice(R,1),T--);if(!_&&!E)for(;T--;T)k.unshift("..");!_||""===k[0]||k[0]&&"/"===k[0].charAt(0)||k.unshift(""),I&&"/"!==k.join("/").substr(-1)&&k.push("");var x,C=""===k[0]||k[0]&&"/"===k[0].charAt(0);S&&(r.hostname=r.host=C?"":k.length?k.shift():"",(x=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=x.shift(),r.host=r.hostname=x.shift()));return(_=_||r.host&&k.length)&&!C&&k.unshift(""),k.length?r.pathname=k.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},s.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,r){"use strict";(function(e,n){var i;!function(s){t&&t.nodeType,e&&e.nodeType;var o="object"==typeof n&&n;o.global!==o&&o.window!==o&&o.self;var a,c=2147483647,u=/^xn--/,f=/[^\x20-\x7E]/,h=/[\x2E\u3002\uFF0E\uFF61]/g,l={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},d=Math.floor,p=String.fromCharCode;function b(e){throw new RangeError(l[e])}function y(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function m(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+y((e=e.replace(h,".")).split("."),t).join(".")}function g(e){for(var t,r,n=[],i=0,s=e.length;i<s;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<s?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}function v(e){return y(e,(function(e){var t="";return e>65535&&(t+=p((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=p(e)})).join("")}function w(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function _(e,t,r){var n=0;for(e=r?d(e/700):e>>1,e+=d(e/t);e>455;n+=36)e=d(e/35);return d(n+36*e/(e+38))}function E(e){var t,r,n,i,s,o,a,u,f,h,l,p=[],y=e.length,m=0,g=128,w=72;for((r=e.lastIndexOf("-"))<0&&(r=0),n=0;n<r;++n)e.charCodeAt(n)>=128&&b("not-basic"),p.push(e.charCodeAt(n));for(i=r>0?r+1:0;i<y;){for(s=m,o=1,a=36;i>=y&&b("invalid-input"),((u=(l=e.charCodeAt(i++))-48<10?l-22:l-65<26?l-65:l-97<26?l-97:36)>=36||u>d((c-m)/o))&&b("overflow"),m+=u*o,!(u<(f=a<=w?1:a>=w+26?26:a-w));a+=36)o>d(c/(h=36-f))&&b("overflow"),o*=h;w=_(m-s,t=p.length+1,0==s),d(m/t)>c-g&&b("overflow"),g+=d(m/t),m%=t,p.splice(m++,0,g)}return v(p)}function k(e){var t,r,n,i,s,o,a,u,f,h,l,y,m,v,E,k=[];for(y=(e=g(e)).length,t=128,r=0,s=72,o=0;o<y;++o)(l=e[o])<128&&k.push(p(l));for(n=i=k.length,i&&k.push("-");n<y;){for(a=c,o=0;o<y;++o)(l=e[o])>=t&&l<a&&(a=l);for(a-t>d((c-r)/(m=n+1))&&b("overflow"),r+=(a-t)*m,t=a,o=0;o<y;++o)if((l=e[o])<t&&++r>c&&b("overflow"),l==t){for(u=r,f=36;!(u<(h=f<=s?1:f>=s+26?26:f-s));f+=36)E=u-h,v=36-h,k.push(p(w(h+E%v,0))),u=d(E/v);k.push(p(w(u,0))),s=_(r,m,n==i),r=0,++n}++r,++t}return k.join("")}a={version:"1.4.1",ucs2:{decode:g,encode:v},decode:E,encode:k,toASCII:function(e){return m(e,(function(e){return f.test(e)?"xn--"+k(e):e}))},toUnicode:function(e){return m(e,(function(e){return u.test(e)?E(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return a}.call(t,r,t,e))||(e.exports=i)}()}).call(this,r(95)(e),r(10))},function(e,t,r){"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,r){"use strict";t.decode=t.parse=r(849),t.encode=t.stringify=r(850)},function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,r,s){t=t||"&",r=r||"=";var o={};if("string"!=typeof e||0===e.length)return o;var a=/\+/g;e=e.split(t);var c=1e3;s&&"number"==typeof s.maxKeys&&(c=s.maxKeys);var u=e.length;c>0&&u>c&&(u=c);for(var f=0;f<u;++f){var h,l,d,p,b=e[f].replace(a,"%20"),y=b.indexOf(r);y>=0?(h=b.substr(0,y),l=b.substr(y+1)):(h=b,l=""),d=decodeURIComponent(h),p=decodeURIComponent(l),n(o,d)?i(o[d])?o[d].push(p):o[d]=[o[d],p]:o[d]=p}return o};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,r,a){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?s(o(e),(function(o){var a=encodeURIComponent(n(o))+r;return i(e[o])?s(e[o],(function(e){return a+encodeURIComponent(n(e))})).join(t):a+encodeURIComponent(n(e[o]))})).join(t):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function s(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n<e.length;n++)r.push(t(e[n],n));return r}var o=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t}},function(e,t,r){"use strict";e.exports=function(){throw new Error("WebSocket Servers can not be created in the browser!")}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(52),{CLOSE_TIMEOUT:s}=r(319),o=r(320),a=r(861),c=r(2),u=c("libp2p:websockets:socket");u.error=c("libp2p:websockets:socket:error"),e.exports=(e,t={})=>{const r={async sink(r){t.signal&&(r=i(r,t.signal));try{await e.sink(async function*(){for await(const e of r)yield n.isBuffer(e)?e:e.slice()}())}catch(s){"aborted"!==s.type&&u.error(s)}},source:t.signal?i(e.source,t.signal):e.source,conn:e,localAddr:t.localAddr||(e.localAddress&&e.localPort?o(e.localAddress,e.localPort):void 0),remoteAddr:t.remoteAddr||o(e.remoteAddress,e.remotePort),timeline:{open:Date.now()},async close(){const t=Date.now();try{await a(e.close(),s)}catch(n){const{host:i,port:s}=r.remoteAddr.toOptions();u("timeout closing stream to %s:%s after %dms, destroying it manually",i,s,Date.now()-t),e.destroy()}finally{r.timeline.close=Date.now()}}};return e.socket.once&&e.socket.once("close",()=>{r.timeline.close||(r.timeline.close=Date.now())}),r}},function(e,t,r){"use strict";t.Address4=r(321),t.Address6=r(854),t.v6={helpers:r(326)}},function(e,t,r){"use strict";var n=r(322).BigInteger,i=r(84).sprintf,s=r(855),o=r(324),a=r(325),c=r(856),u=r(857),f=r(178),h=r(179),l=r(321);function d(e){return e=(e=e.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2')).replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2')}function p(e,t){this.groups=void 0===t?h.GROUPS:t,this.v4=!1,this.subnet="/128",this.subnetMask=128,this.zone="",this.address=e;var r=h.RE_SUBNET_STRING.exec(e);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet="/"+this.subnetMask,isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>h.BITS)return this.valid=!1,void(this.error="Invalid subnet mask.");e=e.replace(h.RE_SUBNET_STRING,"")}else if(/\//.test(e))return this.valid=!1,void(this.error="Invalid subnet mask.");var n=h.RE_ZONE_STRING.exec(e);n&&(this.zone=n[0],e=e.replace(h.RE_ZONE_STRING,"")),this.addressMinusSuffix=e,this.parsedAddress=this.parse(this.addressMinusSuffix)}function b(e){return i("%04x",parseInt(e,16))}function y(e){return 255&e}s(p.prototype,r(858)),s(p.prototype,r(859)),s(p.prototype,r(860)),p.fromBigInteger=function(e){var t,r=o(e.toString(16),32,"0"),n=[];for(t=0;t<h.GROUPS;t++)n.push(r.slice(4*t,4*(t+1)));return new p(n.join(":"))},p.fromURL=function(e){var t,r,n;if(-1!==e.indexOf("[")&&-1!==e.indexOf("]:")){if(null===(n=h.RE_URL_WITH_PORT.exec(e)))return{error:"failed to parse address with port",address:null,port:null};t=n[1],r=n[2]}else if(-1!==e.indexOf("/")){if(e=e.replace(/^[a-z0-9]+:\/\//,""),null===(n=h.RE_URL.exec(e)))return{error:"failed to parse address from URL",address:null,port:null};t=n[1]}else t=e;return r?((r=parseInt(r,10))<0||r>65536)&&(r=null):r=null,{address:new p(t),port:r}},p.fromAddress4=function(e){e=new l(e);var t=h.BITS-(f.BITS-e.subnetMask);return new p("::ffff:"+e.correctForm()+"/"+t)},p.fromArpa=function(e){var t=e.replace(/(\.ip6\.arpa)?\.$/,"");if(63!==t.length)return t={error:"Not Valid 'ip6.arpa' form",address:null};t=t.split(".").reverse();for(var r=7;r>0;r--){var n=4*r;t.splice(n,0,":")}return new p(t=t.join(""))},p.prototype.microsoftTranscription=function(){return i("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))},p.prototype.mask=function(e){return void 0===e&&(e=this.subnetMask),this.getBitsBase2(0,e)},p.prototype.possibleSubnets=function(e){void 0===e&&(e=128);var t=h.BITS-this.subnetMask-Math.abs(e-h.BITS);return t<0?"0":function(e){for(var t=/(\d+)(\d{3})/;t.test(e);)e=e.replace(t,"$1,$2");return e}(new n("2",10).pow(t).toString(10))},p.prototype._startAddress=function(){return new n(this.mask()+a("0",h.BITS-this.subnetMask),2)},p.prototype.startAddress=function(){return p.fromBigInteger(this._startAddress())},p.prototype.startAddressExclusive=function(){var e=new n("1");return p.fromBigInteger(this._startAddress().add(e))},p.prototype._endAddress=function(){return new n(this.mask()+a("1",h.BITS-this.subnetMask),2)},p.prototype.endAddress=function(){return p.fromBigInteger(this._endAddress())},p.prototype.endAddressExclusive=function(){var e=new n("1");return p.fromBigInteger(this._endAddress().subtract(e))},p.prototype.getScope=function(){var e=h.SCOPES[this.getBits(12,16)];return"Global unicast"===this.getType()&&"Link local"!==e&&(e="Global"),e},p.prototype.getType=function(){var e=this;return c(h.TYPES,(function(t,r){return e.isInSubnet(new p(r))}))||"Global unicast"},p.prototype.getBits=function(e,t){return new n(this.getBitsBase2(e,t),2)},p.prototype.getBitsBase2=function(e,t){return this.binaryZeroPad().slice(e,t)},p.prototype.getBitsBase16=function(e,t){var r=t-e;return r%4!=0?null:o(this.getBits(e,t).toString(16),r/4,"0")},p.prototype.getBitsPastSubnet=function(){return this.getBitsBase2(this.subnetMask,h.BITS)},p.prototype.reverseForm=function(e){e||(e={});var t=Math.floor(this.subnetMask/4),r=this.canonicalForm().replace(/:/g,"").split("").slice(0,t).reverse().join(".");return t>0?e.omitSuffix?r:i("%s.ip6.arpa.",r):e.omitSuffix?"":"ip6.arpa."},p.prototype.correctForm=function(){if(!this.parsedAddress)return null;var e,t=[],r=0,n=[];for(e=0;e<this.parsedAddress.length;e++){var i=parseInt(this.parsedAddress[e],16);0===i&&r++,0!==i&&r>0&&(r>1&&n.push([e-r,e-1]),r=0)}r>1&&n.push([this.parsedAddress.length-r,this.parsedAddress.length-1]);var s=n.map((function(e){return e[1]-e[0]+1}));if(n.length>0){var o=s.indexOf(u(s));t=function(e,t){var r,n=[],i=[];for(r=0;r<e.length;r++)r<t[0]?n.push(e[r]):r>t[1]&&i.push(e[r]);return n.concat(["compact"]).concat(i)}(this.parsedAddress,n[o])}else t=this.parsedAddress;for(e=0;e<t.length;e++)"compact"!==t[e]&&(t[e]=parseInt(t[e],16).toString(16));var a=t.join(":");return a=(a=(a=a.replace(/^compact$/,"::")).replace(/^compact|compact$/,":")).replace(/compact/,"")},p.prototype.binaryZeroPad=function(){return o(this.bigInteger().toString(2),h.BITS,"0")},p.prototype.parse4in6=function(e){var t=e.split(":"),r=t.slice(-1)[0].match(f.RE_ADDRESS);if(r){for(var n=new l(r[0]),i=0;i<n.groups;i++)if(/^0[0-9]+/.test(n.parsedAddress[i]))return this.valid=!1,this.error="IPv4 addresses can not have leading zeroes.",this.parseError=e.replace(f.RE_ADDRESS,n.parsedAddress.map(d).join(".")),null;this.v4=!0,t[t.length-1]=n.toGroup6(),e=t.join(":")}return e},p.prototype.parse=function(e){if(e=this.parse4in6(e),this.error)return null;var t=e.match(h.RE_BAD_CHARACTERS);if(t)return this.valid=!1,this.error=i("Bad character%s detected in address: %s",t.length>1?"s":"",t.join("")),this.parseError=e.replace(h.RE_BAD_CHARACTERS,'<span class="parse-error">$1</span>'),null;var r=e.match(h.RE_BAD_ADDRESS);if(r)return this.valid=!1,this.error=i("Address failed regex: %s",r.join("")),this.parseError=e.replace(h.RE_BAD_ADDRESS,'<span class="parse-error">$1</span>'),null;var n=[],s=e.split("::");if(2===s.length){var o=s[0].split(":"),a=s[1].split(":");1===o.length&&""===o[0]&&(o=[]),1===a.length&&""===a[0]&&(a=[]);var c=this.groups-(o.length+a.length);if(!c)return this.valid=!1,this.error="Error parsing groups",null;this.elidedGroups=c,this.elisionBegin=o.length,this.elisionEnd=o.length+this.elidedGroups,o.forEach((function(e){n.push(e)}));for(var u=0;u<c;u++)n.push(0);a.forEach((function(e){n.push(e)}))}else{if(1!==s.length)return this.valid=!1,this.error="Too many :: groups found",null;n=e.split(":"),this.elidedGroups=0}return(n=n.map((function(e){return i("%x",parseInt(e,16))}))).length!==this.groups?(this.valid=!1,this.error="Incorrect number of groups found",null):(this.valid=!0,n)},p.prototype.canonicalForm=function(){return this.valid?this.parsedAddress.map(b).join(":"):null},p.prototype.decimal=function(){return this.valid?this.parsedAddress.map((function(e){return i("%05d",parseInt(e,16))})).join(":"):null},p.prototype.bigInteger=function(){return this.valid?new n(this.parsedAddress.map(b).join(""),16):null},p.prototype.to4=function(){var e=this.binaryZeroPad().split("");return l.fromHex(new n(e.slice(96,128).join(""),2).toString(16))},p.prototype.to4in6=function(){var e=this.to4(),t=new p(this.parsedAddress.slice(0,6).join(":"),6),r=t.correctForm(),n="";return/:$/.test(r)||(n=":"),t.correctForm()+n+e.address},p.prototype.inspectTeredo=function(){var e=this.getBitsBase16(0,32),t=this.getBits(80,96).xor(new n("ffff",16)).toString(),r=l.fromHex(this.getBitsBase16(32,64)),s=l.fromHex(this.getBits(96,128).xor(new n("ffffffff",16)).toString(16)),o=this.getBits(64,80),a=this.getBitsBase2(64,80),c=o.testBit(15),u=o.testBit(14),f=o.testBit(8),h=o.testBit(9),d=new n(a.slice(2,6)+a.slice(8,16),2).toString(10);return{prefix:i("%s:%s",e.slice(0,4),e.slice(4,8)),server4:r.address,client4:s.address,flags:a,coneNat:c,microsoft:{reserved:u,universalLocal:h,groupIndividual:f,nonce:d},udpPort:t}},p.prototype.inspect6to4=function(){var e=this.getBitsBase16(0,16),t=l.fromHex(this.getBitsBase16(16,48));return{prefix:i("%s",e.slice(0,4)),gateway:t.address}},p.prototype.to6to4=function(){return this.is4()?new p(["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":")):null},p.prototype.toByteArray=function(){var e=this.bigInteger().toByteArray();return 17===e.length&&0===e[0]?e.slice(1):e},p.prototype.toUnsignedByteArray=function(){return this.toByteArray().map(y)},p.fromByteArray=function(e){return this.fromUnsignedByteArray(e.map(y))},p.fromUnsignedByteArray=function(e){for(var t=new n("256",10),r=new n("0",10),i=new n("1",10),s=e.length-1;s>=0;s--)r=r.add(i.multiply(new n(e[s].toString(10),10))),i=i.multiply(t);return p.fromBigInteger(r)},e.exports=p},function(e,t,r){"use strict";(function(e,r){var n=/^\[object .+?Constructor\]$/,i=/^(?:0|[1-9]\d*)$/,s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1;var o="object"==typeof e&&e&&e.Object===Object&&e,a="object"==typeof self&&self&&self.Object===Object&&self,c=o||a||Function("return this")(),u=t&&!t.nodeType&&t,f=u&&"object"==typeof r&&r&&!r.nodeType&&r,h=f&&f.exports===u,l=h&&o.process,d=function(){try{var e=f&&f.require&&f.require("util").types;return e||l&&l.binding&&l.binding("util")}catch(t){}}(),p=d&&d.isTypedArray;function b(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var y,m,g,v=Array.prototype,w=Function.prototype,_=Object.prototype,E=c["__core-js_shared__"],k=w.toString,S=_.hasOwnProperty,A=(y=/[^.]+$/.exec(E&&E.keys&&E.keys.IE_PROTO||""))?"Symbol(src)_1."+y:"",I=_.toString,T=k.call(Object),R=RegExp("^"+k.call(S).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),x=h?c.Buffer:void 0,C=c.Symbol,B=c.Uint8Array,M=x?x.allocUnsafe:void 0,N=(m=Object.getPrototypeOf,g=Object,function(e){return m(g(e))}),P=Object.create,O=_.propertyIsEnumerable,D=v.splice,L=C?C.toStringTag:void 0,j=function(){try{var e=ue(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),U=x?x.isBuffer:void 0,z=Math.max,F=Date.now,q=ue(c,"Map"),K=ue(Object,"create"),V=function(){function e(){}return function(t){if(!_e(t))return{};if(P)return P(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function H(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function G(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function W(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Y(e){var t=this.__data__=new G(e);this.size=t.size}function J(e,t){var r=ye(e),n=!r&&be(e),i=!r&&!n&&ge(e),s=!r&&!n&&!i&&ke(e),o=r||n||i||s,a=o?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=a.length;for(var u in e)!t&&!S.call(e,u)||o&&("length"==u||i&&("offset"==u||"parent"==u)||s&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||fe(u,c))||a.push(u);return a}function X(e,t,r){(void 0!==r&&!pe(e[t],r)||void 0===r&&!(t in e))&&$(e,t,r)}function Z(e,t,r){var n=e[t];S.call(e,t)&&pe(n,r)&&(void 0!==r||t in e)||$(e,t,r)}function Q(e,t){for(var r=e.length;r--;)if(pe(e[r][0],t))return r;return-1}function $(e,t,r){"__proto__"==t&&j?j(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}H.prototype.clear=function(){this.__data__=K?K(null):{},this.size=0},H.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},H.prototype.get=function(e){var t=this.__data__;if(K){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return S.call(t,e)?t[e]:void 0},H.prototype.has=function(e){var t=this.__data__;return K?void 0!==t[e]:S.call(t,e)},H.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=K&&void 0===t?"__lodash_hash_undefined__":t,this},G.prototype.clear=function(){this.__data__=[],this.size=0},G.prototype.delete=function(e){var t=this.__data__,r=Q(t,e);return!(r<0)&&(r==t.length-1?t.pop():D.call(t,r,1),--this.size,!0)},G.prototype.get=function(e){var t=this.__data__,r=Q(t,e);return r<0?void 0:t[r][1]},G.prototype.has=function(e){return Q(this.__data__,e)>-1},G.prototype.set=function(e,t){var r=this.__data__,n=Q(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},W.prototype.clear=function(){this.size=0,this.__data__={hash:new H,map:new(q||G),string:new H}},W.prototype.delete=function(e){var t=ce(this,e).delete(e);return this.size-=t?1:0,t},W.prototype.get=function(e){return ce(this,e).get(e)},W.prototype.has=function(e){return ce(this,e).has(e)},W.prototype.set=function(e,t){var r=ce(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Y.prototype.clear=function(){this.__data__=new G,this.size=0},Y.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Y.prototype.get=function(e){return this.__data__.get(e)},Y.prototype.has=function(e){return this.__data__.has(e)},Y.prototype.set=function(e,t){var r=this.__data__;if(r instanceof G){var n=r.__data__;if(!q||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new W(n)}return r.set(e,t),this.size=r.size,this};var ee,te=function(e,t,r){for(var n=-1,i=Object(e),s=r(e),o=s.length;o--;){var a=s[ee?o:++n];if(!1===t(i[a],a,i))break}return e};function re(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":L&&L in Object(e)?function(e){var t=S.call(e,L),r=e[L];try{e[L]=void 0;var n=!0}catch(s){}var i=I.call(e);n&&(t?e[L]=r:delete e[L]);return i}(e):function(e){return I.call(e)}(e)}function ne(e){return Ee(e)&&"[object Arguments]"==re(e)}function ie(e){return!(!_e(e)||function(e){return!!A&&A in e}(e))&&(ve(e)?R:n).test(function(e){if(null!=e){try{return k.call(e)}catch(t){}try{return e+""}catch(t){}}return""}(e))}function se(e){if(!_e(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=he(e),r=[];for(var n in e)("constructor"!=n||!t&&S.call(e,n))&&r.push(n);return r}function oe(e,t,r,n,i){e!==t&&te(t,(function(s,o){if(i||(i=new Y),_e(s))!function(e,t,r,n,i,s,o){var a=le(e,r),c=le(t,r),u=o.get(c);if(u)return void X(e,r,u);var f=s?s(a,c,r+"",e,t,o):void 0,h=void 0===f;if(h){var l=ye(c),d=!l&&ge(c),p=!l&&!d&&ke(c);f=c,l||d||p?ye(a)?f=a:Ee(v=a)&&me(v)?f=function(e,t){var r=-1,n=e.length;t||(t=Array(n));for(;++r<n;)t[r]=e[r];return t}(a):d?(h=!1,f=function(e,t){if(t)return e.slice();var r=e.length,n=M?M(r):new e.constructor(r);return e.copy(n),n}(c,!0)):p?(h=!1,b=c,y=!0?(m=b.buffer,g=new m.constructor(m.byteLength),new B(g).set(new B(m)),g):b.buffer,f=new b.constructor(y,b.byteOffset,b.length)):f=[]:function(e){if(!Ee(e)||"[object Object]"!=re(e))return!1;var t=N(e);if(null===t)return!0;var r=S.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&k.call(r)==T}(c)||be(c)?(f=a,be(a)?f=function(e){return function(e,t,r,n){var i=!r;r||(r={});var s=-1,o=t.length;for(;++s<o;){var a=t[s],c=n?n(r[a],e[a],a,r,e):void 0;void 0===c&&(c=e[a]),i?$(r,a,c):Z(r,a,c)}return r}(e,Se(e))}(a):_e(a)&&!ve(a)||(f=function(e){return"function"!=typeof e.constructor||he(e)?{}:V(N(e))}(c))):h=!1}var b,y,m,g;var v;h&&(o.set(c,f),i(f,c,n,s,o),o.delete(c));X(e,r,f)}(e,t,o,r,oe,n,i);else{var a=n?n(le(e,o),s,o+"",e,t,i):void 0;void 0===a&&(a=s),X(e,o,a)}}),Se)}function ae(e,t){return de(function(e,t,r){return t=z(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,s=z(n.length-t,0),o=Array(s);++i<s;)o[i]=n[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=n[i];return a[t]=r(o),b(e,this,a)}}(e,t,Te),e+"")}function ce(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function ue(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return ie(r)?r:void 0}function fe(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&i.test(e))&&e>-1&&e%1==0&&e<t}function he(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_)}function le(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var de=function(e){var t=0,r=0;return function(){var n=F(),i=16-(n-r);if(r=n,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(j?function(e,t){return j(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:Te);function pe(e,t){return e===t||e!=e&&t!=t}var be=ne(function(){return arguments}())?ne:function(e){return Ee(e)&&S.call(e,"callee")&&!O.call(e,"callee")},ye=Array.isArray;function me(e){return null!=e&&we(e.length)&&!ve(e)}var ge=U||function(){return!1};function ve(e){if(!_e(e))return!1;var t=re(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function we(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function _e(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ee(e){return null!=e&&"object"==typeof e}var ke=p?function(e){return function(t){return e(t)}}(p):function(e){return Ee(e)&&we(e.length)&&!!s[re(e)]};function Se(e){return me(e)?J(e,!0):se(e)}var Ae,Ie=(Ae=function(e,t,r){oe(e,t,r)},ae((function(e,t){var r=-1,n=t.length,i=n>1?t[n-1]:void 0,s=n>2?t[2]:void 0;for(i=Ae.length>3&&"function"==typeof i?(n--,i):void 0,s&&function(e,t,r){if(!_e(r))return!1;var n=typeof t;return!!("number"==n?me(r)&&fe(t,r.length):"string"==n&&t in r)&&pe(r[t],e)}(t[0],t[1],s)&&(i=n<3?void 0:i,n=1),e=Object(e);++r<n;){var o=t[r];o&&Ae(e,o,r,i)}return e})));function Te(e){return e}r.exports=Ie}).call(this,r(10),r(95)(e))},function(e,t,r){"use strict";(function(e,r){var n="[object Arguments]",i="[object Map]",s="[object Object]",o="[object Set]",a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,c=/^\w*$/,u=/^\./,f=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,h=/^\s+|\s+$/g,l=/\\(\\)?/g,d=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,b=/^\[object .+?Constructor\]$/,y=/^0o[0-7]+$/i,m=/^(?:0|[1-9]\d*)$/,g={};g["[object Float32Array]"]=g["[object Float64Array]"]=g["[object Int8Array]"]=g["[object Int16Array]"]=g["[object Int32Array]"]=g["[object Uint8Array]"]=g["[object Uint8ClampedArray]"]=g["[object Uint16Array]"]=g["[object Uint32Array]"]=!0,g[n]=g["[object Array]"]=g["[object ArrayBuffer]"]=g["[object Boolean]"]=g["[object DataView]"]=g["[object Date]"]=g["[object Error]"]=g["[object Function]"]=g[i]=g["[object Number]"]=g[s]=g["[object RegExp]"]=g[o]=g["[object String]"]=g["[object WeakMap]"]=!1;var v=parseInt,w="object"==typeof e&&e&&e.Object===Object&&e,_="object"==typeof self&&self&&self.Object===Object&&self,E=w||_||Function("return this")(),k=t&&!t.nodeType&&t,S=k&&"object"==typeof r&&r&&!r.nodeType&&r,A=S&&S.exports===k&&w.process,I=function(){try{return A&&A.binding("util")}catch(e){}}(),T=I&&I.isTypedArray;function R(e,t){for(var r=-1,n=e?e.length:0;++r<n;)if(t(e[r],r,e))return!0;return!1}function x(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(r){}return t}function C(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function B(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var M,N,P,O=Array.prototype,D=Function.prototype,L=Object.prototype,j=E["__core-js_shared__"],U=(M=/[^.]+$/.exec(j&&j.keys&&j.keys.IE_PROTO||""))?"Symbol(src)_1."+M:"",z=D.toString,F=L.hasOwnProperty,q=L.toString,K=RegExp("^"+z.call(F).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),V=E.Symbol,H=E.Uint8Array,G=L.propertyIsEnumerable,W=O.splice,Y=(N=Object.keys,P=Object,function(e){return N(P(e))}),J=Math.max,X=Ie(E,"DataView"),Z=Ie(E,"Map"),Q=Ie(E,"Promise"),$=Ie(E,"Set"),ee=Ie(E,"WeakMap"),te=Ie(Object,"create"),re=Pe(X),ne=Pe(Z),ie=Pe(Q),se=Pe($),oe=Pe(ee),ae=V?V.prototype:void 0,ce=ae?ae.valueOf:void 0,ue=ae?ae.toString:void 0;function fe(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function he(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function le(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function de(e){var t=-1,r=e?e.length:0;for(this.__data__=new le;++t<r;)this.add(e[t])}function pe(e){this.__data__=new he(e)}function be(e,t){var r=ze(e)||Ue(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,i=!!n;for(var s in e)!t&&!F.call(e,s)||i&&("length"==s||Re(s,n))||r.push(s);return r}function ye(e,t){for(var r=e.length;r--;)if(je(e[r][0],t))return r;return-1}function me(e,t){for(var r=0,n=(t=xe(t,e)?[t]:ke(t)).length;null!=e&&r<n;)e=e[Ne(t[r++])];return r&&r==n?e:void 0}function ge(e,t){return null!=e&&t in Object(e)}function ve(e,t,r,a,c){return e===t||(null==e||null==t||!Ve(e)&&!He(t)?e!=e&&t!=t:function(e,t,r,a,c,u){var f=ze(e),h=ze(t),l="[object Array]",d="[object Array]";f||(l=(l=Te(e))==n?s:l);h||(d=(d=Te(t))==n?s:d);var p=l==s&&!x(e),b=d==s&&!x(t),y=l==d;if(y&&!p)return u||(u=new pe),f||We(e)?Se(e,t,r,a,c,u):function(e,t,r,n,s,a,c){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!n(new H(e),new H(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return je(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case i:var u=C;case o:var f=2&a;if(u||(u=B),e.size!=t.size&&!f)return!1;var h=c.get(e);if(h)return h==t;a|=1,c.set(e,t);var l=Se(u(e),u(t),n,s,a,c);return c.delete(e),l;case"[object Symbol]":if(ce)return ce.call(e)==ce.call(t)}return!1}(e,t,l,r,a,c,u);if(!(2&c)){var m=p&&F.call(e,"__wrapped__"),g=b&&F.call(t,"__wrapped__");if(m||g){var v=m?e.value():e,w=g?t.value():t;return u||(u=new pe),r(v,w,a,c,u)}}if(!y)return!1;return u||(u=new pe),function(e,t,r,n,i,s){var o=2&i,a=Ye(e),c=a.length,u=Ye(t).length;if(c!=u&&!o)return!1;var f=c;for(;f--;){var h=a[f];if(!(o?h in t:F.call(t,h)))return!1}var l=s.get(e);if(l&&s.get(t))return l==t;var d=!0;s.set(e,t),s.set(t,e);var p=o;for(;++f<c;){h=a[f];var b=e[h],y=t[h];if(n)var m=o?n(y,b,h,t,e,s):n(b,y,h,e,t,s);if(!(void 0===m?b===y||r(b,y,n,i,s):m)){d=!1;break}p||(p="constructor"==h)}if(d&&!p){var g=e.constructor,v=t.constructor;g==v||!("constructor"in e)||!("constructor"in t)||"function"==typeof g&&g instanceof g&&"function"==typeof v&&v instanceof v||(d=!1)}return s.delete(e),s.delete(t),d}(e,t,r,a,c,u)}(e,t,ve,r,a,c))}function we(e){return!(!Ve(e)||function(e){return!!U&&U in e}(e))&&(qe(e)||x(e)?K:b).test(Pe(e))}function _e(e){return"function"==typeof e?e:null==e?Je:"object"==typeof e?ze(e)?function(e,t){if(xe(e)&&Ce(t))return Be(Ne(e),t);return function(r){var n=function(e,t,r){var n=null==e?void 0:me(e,t);return void 0===n?r:n}(r,e);return void 0===n&&n===t?function(e,t){return null!=e&&function(e,t,r){t=xe(t,e)?[t]:ke(t);var n,i=-1,s=t.length;for(;++i<s;){var o=Ne(t[i]);if(!(n=null!=e&&r(e,o)))break;e=e[o]}if(n)return n;return!!(s=e?e.length:0)&&Ke(s)&&Re(o,s)&&(ze(e)||Ue(e))}(e,t,ge)}(r,e):ve(t,n,void 0,3)}}(e[0],e[1]):function(e){var t=function(e){var t=Ye(e),r=t.length;for(;r--;){var n=t[r],i=e[n];t[r]=[n,i,Ce(i)]}return t}(e);if(1==t.length&&t[0][2])return Be(t[0][0],t[0][1]);return function(r){return r===e||function(e,t,r,n){var i=r.length,s=i,o=!n;if(null==e)return!s;for(e=Object(e);i--;){var a=r[i];if(o&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<s;){var c=(a=r[i])[0],u=e[c],f=a[1];if(o&&a[2]){if(void 0===u&&!(c in e))return!1}else{var h=new pe;if(n)var l=n(u,f,c,e,t,h);if(!(void 0===l?ve(f,u,n,3,h):l))return!1}}return!0}(r,e,t)}}(e):xe(t=e)?(r=Ne(t),function(e){return null==e?void 0:e[r]}):function(e){return function(t){return me(t,e)}}(t);var t,r}function Ee(e){if(r=(t=e)&&t.constructor,n="function"==typeof r&&r.prototype||L,t!==n)return Y(e);var t,r,n,i=[];for(var s in Object(e))F.call(e,s)&&"constructor"!=s&&i.push(s);return i}function ke(e){return ze(e)?e:Me(e)}function Se(e,t,r,n,i,s){var o=2&i,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var u=s.get(e);if(u&&s.get(t))return u==t;var f=-1,h=!0,l=1&i?new de:void 0;for(s.set(e,t),s.set(t,e);++f<a;){var d=e[f],p=t[f];if(n)var b=o?n(p,d,f,t,e,s):n(d,p,f,e,t,s);if(void 0!==b){if(b)continue;h=!1;break}if(l){if(!R(t,(function(e,t){if(!l.has(t)&&(d===e||r(d,e,n,i,s)))return l.add(t)}))){h=!1;break}}else if(d!==p&&!r(d,p,n,i,s)){h=!1;break}}return s.delete(e),s.delete(t),h}function Ae(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function Ie(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return we(r)?r:void 0}fe.prototype.clear=function(){this.__data__=te?te(null):{}},fe.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},fe.prototype.get=function(e){var t=this.__data__;if(te){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return F.call(t,e)?t[e]:void 0},fe.prototype.has=function(e){var t=this.__data__;return te?void 0!==t[e]:F.call(t,e)},fe.prototype.set=function(e,t){return this.__data__[e]=te&&void 0===t?"__lodash_hash_undefined__":t,this},he.prototype.clear=function(){this.__data__=[]},he.prototype.delete=function(e){var t=this.__data__,r=ye(t,e);return!(r<0)&&(r==t.length-1?t.pop():W.call(t,r,1),!0)},he.prototype.get=function(e){var t=this.__data__,r=ye(t,e);return r<0?void 0:t[r][1]},he.prototype.has=function(e){return ye(this.__data__,e)>-1},he.prototype.set=function(e,t){var r=this.__data__,n=ye(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},le.prototype.clear=function(){this.__data__={hash:new fe,map:new(Z||he),string:new fe}},le.prototype.delete=function(e){return Ae(this,e).delete(e)},le.prototype.get=function(e){return Ae(this,e).get(e)},le.prototype.has=function(e){return Ae(this,e).has(e)},le.prototype.set=function(e,t){return Ae(this,e).set(e,t),this},de.prototype.add=de.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},de.prototype.has=function(e){return this.__data__.has(e)},pe.prototype.clear=function(){this.__data__=new he},pe.prototype.delete=function(e){return this.__data__.delete(e)},pe.prototype.get=function(e){return this.__data__.get(e)},pe.prototype.has=function(e){return this.__data__.has(e)},pe.prototype.set=function(e,t){var r=this.__data__;if(r instanceof he){var n=r.__data__;if(!Z||n.length<199)return n.push([e,t]),this;r=this.__data__=new le(n)}return r.set(e,t),this};var Te=function(e){return q.call(e)};function Re(e,t){return!!(t=null==t?9007199254740991:t)&&("number"==typeof e||m.test(e))&&e>-1&&e%1==0&&e<t}function xe(e,t){if(ze(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!Ge(e))||(c.test(e)||!a.test(e)||null!=t&&e in Object(t))}function Ce(e){return e==e&&!Ve(e)}function Be(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}(X&&"[object DataView]"!=Te(new X(new ArrayBuffer(1)))||Z&&Te(new Z)!=i||Q&&"[object Promise]"!=Te(Q.resolve())||$&&Te(new $)!=o||ee&&"[object WeakMap]"!=Te(new ee))&&(Te=function(e){var t=q.call(e),r=t==s?e.constructor:void 0,n=r?Pe(r):void 0;if(n)switch(n){case re:return"[object DataView]";case ne:return i;case ie:return"[object Promise]";case se:return o;case oe:return"[object WeakMap]"}return t});var Me=Le((function(e){var t;e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(Ge(e))return ue?ue.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(t);var r=[];return u.test(e)&&r.push(""),e.replace(f,(function(e,t,n,i){r.push(n?i.replace(l,"$1"):t||e)})),r}));function Ne(e){if("string"==typeof e||Ge(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Pe(e){if(null!=e){try{return z.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var Oe,De=(Oe=function(e,t,r){var n=e?e.length:0;if(!n)return-1;var i,s,o=null==r?0:(i=function(e){return e?(e=function(e){if("number"==typeof e)return e;if(Ge(e))return NaN;if(Ve(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ve(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(h,"");var r=p.test(e);return r||y.test(e)?v(e.slice(2),r?2:8):d.test(e)?NaN:+e}(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}(r),s=i%1,i==i?s?i-s:i:0);return o<0&&(o=J(n+o,0)),function(e,t,r,n){for(var i=e.length,s=r+(n?1:-1);n?s--:++s<i;)if(t(e[s],s,e))return s;return-1}(e,_e(t),o)},function(e,t,r){var n=Object(e);if(!Fe(e)){var i=_e(t);e=Ye(e),t=function(e){return i(n[e],e,n)}}var s=Oe(e,t,r);return s>-1?n[i?e[s]:s]:void 0});function Le(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=e.apply(this,n);return r.cache=s.set(i,o),o};return r.cache=new(Le.Cache||le),r}function je(e,t){return e===t||e!=e&&t!=t}function Ue(e){return function(e){return He(e)&&Fe(e)}(e)&&F.call(e,"callee")&&(!G.call(e,"callee")||q.call(e)==n)}Le.Cache=le;var ze=Array.isArray;function Fe(e){return null!=e&&Ke(e.length)&&!qe(e)}function qe(e){var t=Ve(e)?q.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}function Ke(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Ve(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function He(e){return!!e&&"object"==typeof e}function Ge(e){return"symbol"==typeof e||He(e)&&"[object Symbol]"==q.call(e)}var We=T?function(e){return function(t){return e(t)}}(T):function(e){return He(e)&&Ke(e.length)&&!!g[q.call(e)]};function Ye(e){return Fe(e)?be(e):Ee(e)}function Je(e){return e}r.exports=De}).call(this,r(10),r(95)(e))},function(e,t,r){"use strict";var n=Object.prototype.toString;function i(e,t){return e>t}function s(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==n.call(e)}function o(e){return e}e.exports=function(e){return e&&e.length?function(e,t,r){for(var n=-1,i=e.length;++n<i;){var o=e[n],a=t(o);if(null!=a&&(void 0===c?a==a&&!s(a):r(a,c)))var c=a,u=o}return u}(e,o,i):void 0}},function(e,t,r){"use strict";var n=r(323),i=r(179);t.isValid=function(){return this.valid},t.isInSubnet=n.isInSubnet,t.isCorrect=n.isCorrect(i.BITS),t.isCanonical=n.falseIfInvalid((function(){return this.addressMinusSuffix===this.canonicalForm()})),t.isLinkLocal=n.falseIfInvalid((function(){return"1111111010000000000000000000000000000000000000000000000000000000"===this.getBitsBase2(0,64)})),t.isMulticast=n.falseIfInvalid((function(){return"Multicast"===this.getType()})),t.is4=n.falseIfInvalid((function(){return this.v4})),t.isTeredo=n.falseIfInvalid((function(){return this.isInSubnet(new this.constructor("2001::/32"))})),t.is6to4=n.falseIfInvalid((function(){return this.isInSubnet(new this.constructor("2002::/16"))})),t.isLoopback=n.falseIfInvalid((function(){return"Loopback"===this.getType()}))},function(e,t,r){"use strict";var n=r(178),i=r(326),s=r(84).sprintf;t.href=function(e){return e=void 0===e?"":s(":%s",e),s("http://[%s]%s/",this.correctForm(),e)},t.link=function(e){e||(e={}),void 0===e.className&&(e.className=""),void 0===e.prefix&&(e.prefix="/#address="),void 0===e.v4&&(e.v4=!1);var t=this.correctForm;return e.v4&&(t=this.to4in6),e.className?s('<a href="%1$s%2$s" class="%3$s">%2$s</a>',e.prefix,t.call(this),e.className):s('<a href="%1$s%2$s">%2$s</a>',e.prefix,t.call(this))},t.group=function(){var e,t=this.address.match(n.RE_ADDRESS);if(t){var r=t[0].split(".");this.address=this.address.replace(n.RE_ADDRESS,s('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',r.slice(0,2).join("."),r.slice(2,4).join(".")))}if(0===this.elidedGroups)return i.simpleGroup(this.address);var o=[],a=this.address.split("::");a[0].length?o.push(i.simpleGroup(a[0])):o.push("");var c=["hover-group"];for(e=this.elisionBegin;e<this.elisionBegin+this.elidedGroups;e++)c.push(s("group-%d",e));return o.push(s('<span class="%s"></span>',c.join(" "))),a[1].length?o.push(i.simpleGroup(a[1],this.elisionEnd)):o.push(""),o.join(":")}},function(e,t,r){"use strict";var n=r(84).sprintf,i=r(179);function s(e){return n("(%s)",e.join("|"))}function o(e){return e.length<4?n("0{0,%d}%s",4-e.length,e):e}function a(e){var t=[];e.forEach((function(e,r){0===parseInt(e,16)&&t.push(r)}));var r=t.map((function(t){return e.map((function(e,r){if(r===t){var n=0===r||r===i.GROUPS-1?":":"";return s([o(e),n])}return o(e)})).join(":")}));return r.push(e.map(o).join(":")),s(r)}function c(e,t,r){var i=t?"":":",o=r?"":":",a=[];t||r||a.push("::"),t&&r&&a.push(""),(r&&!t||!r&&t)&&a.push(":"),a.push(n("%s(:0{1,4}){1,%d}",i,e-1)),a.push(n("(0{1,4}:){1,%d}%s",e-1,o)),a.push(n("(0{1,4}:){%d}0{1,4}",e-1));for(var c=1;c<e-1;c++)for(var u=1;u<e-c;u++)a.push(n("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",u,e-u-c-1));return s(a)}t.regularExpressionString=function(e){void 0===e&&(e=!1);var t=[],r=new this.constructor(this.correctForm());if(0===r.elidedGroups)t.push(a(r.parsedAddress));else if(r.elidedGroups===i.GROUPS)t.push(c(i.GROUPS));else{var n=r.address.split("::");n[0].length&&t.push(a(n[0].split(":"))),t.push(c(r.elidedGroups,0!==n[0].length,0!==n[1].length)),n[1].length&&t.push(a(n[1].split(":"))),t=[t.join(":")]}return e||(t=[].concat("(?=^|","[^A-Fa-f0-9:]","|[^\\w\\:])(",t,")(?=[^\\w\\:]|","[^A-Fa-f0-9:]","|$)")),t.join("")},t.regularExpression=function(e){return new RegExp(this.regularExpressionString(e),"i")}},function(e,t,r){"use strict";const n=r(138);class i extends Error{constructor(e){super(e),this.name="TimeoutError"}}const s=(e,t,r)=>new Promise((s,o)=>{if("number"!=typeof t||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t===1/0)return void s(e);const a=setTimeout(()=>{if("function"==typeof r){try{s(r())}catch(c){o(c)}return}const n="string"==typeof r?r:"Promise timed out after ".concat(t," milliseconds"),a=r instanceof Error?r:new i(n);"function"==typeof e.cancel&&e.cancel(),o(a)},t);n(e.then(s,o),()=>{clearTimeout(a)})});e.exports=s,e.exports.default=s,e.exports.TimeoutError=i},function(e,t,r){"use strict";const n=r(2),i=n("libp2p:webrtc-star");i.error=n("libp2p:webrtc-star:error");const{EventEmitter:s}=r(13),o=r(1),a=r(21),{AbortError:c}=r(52),u=r(327),{supportsWebRTC:f}=r(865),h=r(15),l=r(58),d=r(6),{CODE_CIRCUIT:p}=r(180),b=r(866),y=r(341),{cleanMultiaddr:m}=r(344);function g(){}e.exports=a(class{constructor(e={}){if(!e.upgrader)throw new Error("An upgrader must be provided. See https://github.com/libp2p/interface-transport#upgrader.");this._upgrader=e.upgrader,this._signallingAddr=void 0,this.sioOptions={transports:["websocket"],"force new connection":!0},e.wrtc&&(this.wrtc=e.wrtc),this.listenersRefs={},this.discovery=new s,this.discovery.tag="webRTCStar",this.discovery._isStarted=!1,this.discovery.start=()=>{this.discovery._isStarted=!0},this.discovery.stop=()=>{this.discovery._isStarted=!1},this._peerDiscovered=this._peerDiscovered.bind(this)}async dial(e,t={}){const r=await this._connect(e,t),n=y(r,{remoteAddr:e,signal:t.signal});i("new outbound connection %s",n.remoteAddr);const s=await this._upgrader.upgradeOutbound(n);return i("outbound connection %s upgraded",n.remoteAddr),s}_connect(e,t={}){if(t.signal&&t.signal.aborted)throw new c;const r={initiator:!0,trickle:!1};this.wrtc&&(r.wrtc=this.wrtc);const n=e.toOptions(),s=(~~(1e9*Math.random())).toString(36)+Date.now(),a=this.listenersRefs[Object.keys(this.listenersRefs)[0]].io;return new Promise((f,h)=>{const l=Date.now();let d;i("dialing %s:%s",n.host,n.port);const p=new u(r),b=e=>{if(!d){const t="connection error ".concat(n.host,":").concat(n.port,": ").concat(e.message);e.message=t,i.error(t),v(e)}},y=()=>{i("connnection timeout %s:%s",n.host,n.port);const e=o(new Error("connection timeout after ".concat(Date.now()-l,"ms")),"ERR_CONNECT_TIMEOUT");p.emit("error",e)},m=()=>{d=!0,i("connection opened %s:%s",n.host,n.port),v(null)},g=()=>{i.error("connection aborted %s:%s",n.host,n.port),p.destroy(),v(new c)},v=e=>{p.removeListener("timeout",y),p.removeListener("connect",m),t.signal&&t.signal.removeEventListener("abort",g),e?h(e):f(p)};p.on("error",b),p.once("timeout",y),p.once("connect",m),p.on("close",()=>{p.removeListener("error",b)}),t.signal&&t.signal.addEventListener("abort",g),p.on("signal",t=>{a.emit("ss-handshake",{intentId:s,srcMultiaddr:this._signallingAddr.toString(),dstMultiaddr:e.toString(),signal:t})}),a.on("ws-handshake",e=>{e.intentId===s&&e.err&&h(o(e.err instanceof Error?e.err:new Error(e.err),"ERR_SIGNALLING_FAILED")),e.intentId===s&&e.answer&&!p.destroyed&&p.signal(e.signal)})})}createListener(e={},t){if(!f&&!this.wrtc)throw o(new Error("no WebRTC support"),"ERR_NO_WEBRTC_SUPPORT");return"function"==typeof e&&(t=e,e={}),b({handler:t=t||g,upgrader:this._upgrader},this,e)}filter(e){return(e=Array.isArray(e)?e:[e]).filter(e=>!e.protoCodes().includes(p)&&l.WebRTCStar.matches(e))}_peerDiscovered(e){if(!this.discovery._isStarted)return;i("Peer Discovered:",e),e=m(e);const t=h(e),r=d.createFromB58String(t.getPeerId());this.discovery.emit("peer",{id:r,multiaddrs:[t]})}},{className:"WebRTCStar",symbolName:"@libp2p/js-libp2p-webrtc-star/webrtcstar"})},function(e,t,r){"use strict";e.exports=function(){if("undefined"==typeof window)return null;var e={RTCPeerConnection:window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection,RTCSessionDescription:window.RTCSessionDescription||window.mozRTCSessionDescription||window.webkitRTCSessionDescription,RTCIceCandidate:window.RTCIceCandidate||window.mozRTCIceCandidate||window.webkitRTCIceCandidate};return e.RTCPeerConnection?e:null}},function(e,t,r){"use strict";let n;e.exports="function"==typeof queueMicrotask?queueMicrotask:e=>(n||(n=Promise.resolve())).then(e).catch(e=>setTimeout(()=>{throw e},0))},function(e,t,r){"use strict";const n=r(57);e.exports={supportsFileReader:"undefined"!=typeof self&&"FileReader"in self,supportsWebRTC:"RTCPeerConnection"in n&&"undefined"!=typeof navigator&&void 0!==navigator.mediaDevices&&"getUserMedia"in navigator.mediaDevices}},function(e,t,r){"use strict";const n=r(13),i=r(2),s=i("libp2p:webrtc-star:listener");s.error=i("libp2p:webrtc-star:listener:error");const o=r(15),a=r(867),c=r(327),u=r(83),f=r(341),{cleanUrlSIO:h}=r(344),{CODE_P2P:l}=r(180),d={transports:["websocket"],"force new connection":!0};e.exports=({handler:e,upgrader:t},r,i={})=>{const p=new n;let b;return p.__connections=[],p.listen=n=>{const o=u();b=n,!n.protoCodes().includes(l)&&t.localPeer?r._signallingAddr=n.encapsulate("/p2p/".concat(t.localPeer.toB58String())):r._signallingAddr=n;const y=h(n);s("Dialing to Signalling Server on: "+y),p.io=a.connect(y,d);return p.io.once("connect_error",e=>o.reject(e)),p.io.once("error",e=>{p.emit("error",e),p.emit("close")}),p.io.on("ws-handshake",o=>{if(o.answer||o.err)return;const a={trickle:!1,...i};r.wrtc&&(a.wrtc=r.wrtc);const u=new c(a),h=e=>{s.error("incoming connectioned errored",e)};u.on("error",h),u.once("close",(...e)=>{u.removeListener("error",h)}),u.once("signal",e=>{o.signal=e,o.answer=!0,p.io.emit("ss-handshake",o)}),u.signal(o.signal),u.once("connect",async()=>{const r=f(u);let i;s("new inbound connection %s",r.remoteAddr);try{i=await t.upgradeInbound(r)}catch(o){return s.error("inbound connection failed to upgrade",o),r.close()}if(!i.remoteAddr)try{i.remoteAddr=n.decapsulateCode(l).encapsulate("/p2p/".concat(i.remotePeer.toB58String()))}catch(o){s.error("could not determine remote address",o)}s("inbound connection %s upgraded",r.remoteAddr),function(e,t){e.__connections.push(t);t.conn.once("close",()=>{e.__connections=e.__connections.filter(e=>e!==t)})}(p,r),p.emit("connection",i),e(i)})}),p.io.on("ws-peer",r._peerDiscovered),p.io.on("connect",()=>{p.io.emit("ss-join",r._signallingAddr.toString())}),p.io.once("connect",()=>{p.emit("listening"),o.resolve()}),o.promise},p.close=async()=>{p.io&&p.io.emit("ss-leave"),await Promise.all(p.__connections.map(e=>e.close())),p.emit("close")},p.getAddrs=()=>[b],r.listenersRefs[o.toString()]=p,p}},function(e,t,r){"use strict";var n=r(868),i=r(181),s=r(332),o=r(2)("socket.io-client");e.exports=t=c;var a=t.managers={};function c(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,i=n(e),c=i.source,u=i.id,f=i.path,h=a[u]&&f in a[u].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||h?(o("ignoring socket cache for %s",c),r=s(c,t)):(a[u]||(o("new io instance for %s",c),a[u]=s(c,t)),r=a[u]),i.query&&!t.query&&(t.query=i.query),r.socket(i.path,t)}t.protocol=i.protocol,t.connect=c,t.Manager=r(332),t.Socket=r(338)},function(e,t,r){"use strict";var n=r(329),i=r(2)("socket.io-client:url");e.exports=function(e,t){var r=e;t=t||"undefined"!=typeof location&&location,null==e&&(e=t.protocol+"//"+t.host);"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(i("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),i("parse %s",e),r=n(e));r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443"));r.path=r.path||"/";var s=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+s+":"+r.port,r.href=r.protocol+"://"+s+(t&&t.port===r.port?"":":"+r.port),r}},function(e,t,r){"use strict";(function(n){function i(){var e;try{e=t.storage.debug}catch(r){}return!e&&void 0!==n&&"env"in n&&(e={NODE_ENV:"production"}.DEBUG),e}(t=e.exports=r(870)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),!r)return;var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0,s=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(i++,"%c"===e&&(s=i))})),e.splice(s,0,n)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(r){}},t.load=i,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"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+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),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(t){return"[UnexpectedJSONParseError]: "+t.message}},t.enable(i())}).call(this,r(8))},function(e,t,r){"use strict";function n(e){var r;function n(){if(n.enabled){var e=n,i=+new Date,s=i-(r||i);e.diff=s,e.prev=r,e.curr=i,r=i;for(var o=new Array(arguments.length),a=0;a<o.length;a++)o[a]=arguments[a];o[0]=t.coerce(o[0]),"string"!=typeof o[0]&&o.unshift("%O");var c=0;o[0]=o[0].replace(/%([a-zA-Z%])/g,(function(r,n){if("%%"===r)return r;c++;var i=t.formatters[n];if("function"==typeof i){var s=o[c];r=i.call(e,s),o.splice(c,1),c--}return r})),t.formatArgs.call(e,o);var u=n.log||t.log||console.log.bind(console);u.apply(e,o)}}return n.namespace=e,n.enabled=t.enabled(e),n.useColors=t.useColors(),n.color=function(e){var r,n=0;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}(e),n.destroy=i,"function"==typeof t.init&&t.init(n),t.instances.push(n),n}function i(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var r;t.save(e),t.names=[],t.skips=[];var n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r<i;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(r=0;r<t.instances.length;r++){var s=t.instances[r];s.enabled=t.enabled(s.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=r(871),t.instances=[],t.names=[],t.skips=[],t.formatters={}},function(e,t,r){"use strict";var n=1e3,i=6e4,s=60*i,o=24*s;function a(e,t,r){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}e.exports=function(e,t){t=t||{};var r,c=typeof e;if("string"===c&&e.length>0)return function(e){if((e=String(e)).length>100)return;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)return;var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*r;case"days":case"day":case"d":return r*o;case"hours":case"hour":case"hrs":case"hr":case"h":return r*s;case"minutes":case"minute":case"mins":case"min":case"m":return r*i;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===c&&!1===isNaN(e))return t.long?a(r=e,o,"day")||a(r,s,"hour")||a(r,i,"minute")||a(r,n,"second")||r+" ms":function(e){if(e>=o)return Math.round(e/o)+"d";if(e>=s)return Math.round(e/s)+"h";if(e>=i)return Math.round(e/i)+"m";if(e>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,r){"use strict";var n=r(330),i=r(331),s=Object.prototype.toString,o="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===s.call(Blob),a="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===s.call(File);t.deconstructPacket=function(e){var t=[],r=e.data,s=e;return s.data=function e(t,r){if(!t)return t;if(i(t)){var s={_placeholder:!0,num:r.length};return r.push(t),s}if(n(t)){for(var o=new Array(t.length),a=0;a<t.length;a++)o[a]=e(t[a],r);return o}if("object"==typeof t&&!(t instanceof Date)){o={};for(var c in t)o[c]=e(t[c],r);return o}return t}(r,t),s.attachments=t.length,{packet:s,buffers:t}},t.reconstructPacket=function(e,t){return e.data=function e(t,r){if(!t)return t;if(t&&t._placeholder)return r[t.num];if(n(t))for(var i=0;i<t.length;i++)t[i]=e(t[i],r);else if("object"==typeof t)for(var s in t)t[s]=e(t[s],r);return t}(e.data,t),e.attachments=void 0,e},t.removeBlobs=function(e,t){var r=0,s=e;!function e(c,u,f){if(!c)return c;if(o&&c instanceof Blob||a&&c instanceof File){r++;var h=new FileReader;h.onload=function(){f?f[u]=this.result:s=this.result,--r||t(s)},h.readAsArrayBuffer(c)}else if(n(c))for(var l=0;l<c.length;l++)e(c[l],l,c);else if("object"==typeof c&&!i(c))for(var d in c)e(c[d],d,c)}(s),r||t(s)}},function(e,t,r){"use strict";e.exports=r(874),e.exports.parser=r(69)},function(e,t,r){"use strict";var n=r(333),i=r(186),s=r(2)("engine.io-client:socket"),o=r(337),a=r(69),c=r(329),u=r(109);function f(e,t){if(!(this instanceof f))return new f(e,t);t=t||{},e&&"object"==typeof e&&(t=e,e=null),e?(e=c(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=c(t.host).host),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.agent=t.agent||!1,this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?443:80),this.query=t.query||{},"string"==typeof this.query&&(this.query=u.decode(this.query)),this.upgrade=!1!==t.upgrade,this.path=(t.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!t.forceJSONP,this.jsonp=!1!==t.jsonp,this.forceBase64=!!t.forceBase64,this.enablesXDR=!!t.enablesXDR,this.withCredentials=!1!==t.withCredentials,this.timestampParam=t.timestampParam||"t",this.timestampRequests=t.timestampRequests,this.transports=t.transports||["polling","websocket"],this.transportOptions=t.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=t.policyPort||843,this.rememberUpgrade=t.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=t.onlyBinaryUpgrades,this.perMessageDeflate=!1!==t.perMessageDeflate&&(t.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=t.pfx||null,this.key=t.key||null,this.passphrase=t.passphrase||null,this.cert=t.cert||null,this.ca=t.ca||null,this.ciphers=t.ciphers||null,this.rejectUnauthorized=void 0===t.rejectUnauthorized||t.rejectUnauthorized,this.forceNode=!!t.forceNode,this.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),("undefined"==typeof self||this.isReactNative)&&(t.extraHeaders&&Object.keys(t.extraHeaders).length>0&&(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()}e.exports=f,f.priorWebsocketSuccess=!1,i(f.prototype),f.protocol=a.protocol,f.Socket=f,f.Transport=r(185),f.transports=r(333),f.parser=r(69),f.prototype.createTransport=function(e){s('creating transport "%s"',e);var t=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}(this.query);t.EIO=a.protocol,t.transport=e;var r=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),new n[e]({query:t,socket:this,agent:r.agent||this.agent,hostname:r.hostname||this.hostname,port:r.port||this.port,secure:r.secure||this.secure,path:r.path||this.path,forceJSONP:r.forceJSONP||this.forceJSONP,jsonp:r.jsonp||this.jsonp,forceBase64:r.forceBase64||this.forceBase64,enablesXDR:r.enablesXDR||this.enablesXDR,withCredentials:r.withCredentials||this.withCredentials,timestampRequests:r.timestampRequests||this.timestampRequests,timestampParam:r.timestampParam||this.timestampParam,policyPort:r.policyPort||this.policyPort,pfx:r.pfx||this.pfx,key:r.key||this.key,passphrase:r.passphrase||this.passphrase,cert:r.cert||this.cert,ca:r.ca||this.ca,ciphers:r.ciphers||this.ciphers,rejectUnauthorized:r.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:r.perMessageDeflate||this.perMessageDeflate,extraHeaders:r.extraHeaders||this.extraHeaders,forceNode:r.forceNode||this.forceNode,localAddress:r.localAddress||this.localAddress,requestTimeout:r.requestTimeout||this.requestTimeout,protocols:r.protocols||void 0,isReactNative:this.isReactNative})},f.prototype.open=function(){var e;if(this.rememberUpgrade&&f.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout((function(){t.emit("error","No transports available")}),0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(r){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},f.prototype.setTransport=function(e){s("setting transport %s",e.name);var t=this;this.transport&&(s("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",(function(){t.onDrain()})).on("packet",(function(e){t.onPacket(e)})).on("error",(function(e){t.onError(e)})).on("close",(function(){t.onClose("transport close")}))},f.prototype.probe=function(e){s('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),r=!1,n=this;function i(){if(n.onlyBinaryUpgrades){var i=!this.supportsBinary&&n.transport.supportsBinary;r=r||i}r||(s('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",(function(i){if(!r)if("pong"===i.type&&"probe"===i.data){if(s('probe transport "%s" pong',e),n.upgrading=!0,n.emit("upgrading",t),!t)return;f.priorWebsocketSuccess="websocket"===t.name,s('pausing current transport "%s"',n.transport.name),n.transport.pause((function(){r||"closed"!==n.readyState&&(s("changing transport and sending upgrade packet"),l(),n.setTransport(t),t.send([{type:"upgrade"}]),n.emit("upgrade",t),t=null,n.upgrading=!1,n.flush())}))}else{s('probe transport "%s" failed',e);var o=new Error("probe error");o.transport=t.name,n.emit("upgradeError",o)}})))}function o(){r||(r=!0,l(),t.close(),t=null)}function a(r){var i=new Error("probe error: "+r);i.transport=t.name,o(),s('probe transport "%s" failed because of error: %s',e,r),n.emit("upgradeError",i)}function c(){a("transport closed")}function u(){a("socket closed")}function h(e){t&&e.name!==t.name&&(s('"%s" works - aborting "%s"',e.name,t.name),o())}function l(){t.removeListener("open",i),t.removeListener("error",a),t.removeListener("close",c),n.removeListener("close",u),n.removeListener("upgrading",h)}f.priorWebsocketSuccess=!1,t.once("open",i),t.once("error",a),t.once("close",c),this.once("close",u),this.once("upgrading",h),t.open()},f.prototype.onOpen=function(){if(s("socket open"),this.readyState="open",f.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){s("starting upgrade probes");for(var e=0,t=this.upgrades.length;e<t;e++)this.probe(this.upgrades[e])}},f.prototype.onPacket=function(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(s('socket receive: type "%s", data "%s"',e.type,e.data),this.emit("packet",e),this.emit("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emit("data",e.data),this.emit("message",e.data)}else s('packet received with socket readyState "%s"',this.readyState)},f.prototype.onHandshake=function(e){this.emit("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},f.prototype.onHeartbeat=function(e){clearTimeout(this.pingTimeoutTimer);var t=this;t.pingTimeoutTimer=setTimeout((function(){"closed"!==t.readyState&&t.onClose("ping timeout")}),e||t.pingInterval+t.pingTimeout)},f.prototype.setPing=function(){var e=this;clearTimeout(e.pingIntervalTimer),e.pingIntervalTimer=setTimeout((function(){s("writing ping packet - expecting pong within %sms",e.pingTimeout),e.ping(),e.onHeartbeat(e.pingTimeout)}),e.pingInterval)},f.prototype.ping=function(){var e=this;this.sendPacket("ping",(function(){e.emit("ping")}))},f.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},f.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(s("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},f.prototype.write=f.prototype.send=function(e,t,r){return this.sendPacket("message",e,t,r),this},f.prototype.sendPacket=function(e,t,r,n){if("function"==typeof t&&(n=t,t=void 0),"function"==typeof r&&(n=r,r=null),"closing"!==this.readyState&&"closed"!==this.readyState){(r=r||{}).compress=!1!==r.compress;var i={type:e,data:t,options:r};this.emit("packetCreate",i),this.writeBuffer.push(i),n&&this.once("flush",n),this.flush()}},f.prototype.close=function(){if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var e=this;this.writeBuffer.length?this.once("drain",(function(){this.upgrading?n():t()})):this.upgrading?n():t()}function t(){e.onClose("forced close"),s("socket closing - telling transport to close"),e.transport.close()}function r(){e.removeListener("upgrade",r),e.removeListener("upgradeError",r),t()}function n(){e.once("upgrade",r),e.once("upgradeError",r)}return this},f.prototype.onError=function(e){s("socket error %j",e),f.priorWebsocketSuccess=!1,this.emit("error",e),this.onClose("transport error",e)},f.prototype.onClose=function(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){s('socket close with reason: "%s"',e);clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",e,t),this.writeBuffer=[],this.prevBufferLen=0}},f.prototype.filterUpgrades=function(e){for(var t=[],r=0,n=e.length;r<n;r++)~o(this.transports,e[r])&&t.push(e[r]);return t}},function(e,t,r){"use strict";try{e.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(n){e.exports=!1}},function(e,t,r){"use strict";var n=r(183),i=r(334),s=r(186),o=r(110),a=r(2)("engine.io-client:polling-xhr"),c=r(184);function u(){}function f(e){if(i.call(this,e),this.requestTimeout=e.requestTimeout,this.extraHeaders=e.extraHeaders,"undefined"!=typeof location){var t="https:"===location.protocol,r=location.port;r||(r=t?443:80),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||r!==e.port,this.xs=e.secure!==t}}function h(e){this.method=e.method||"GET",this.uri=e.uri,this.xd=!!e.xd,this.xs=!!e.xs,this.async=!1!==e.async,this.data=void 0!==e.data?e.data:null,this.agent=e.agent,this.isBinary=e.isBinary,this.supportsBinary=e.supportsBinary,this.enablesXDR=e.enablesXDR,this.withCredentials=e.withCredentials,this.requestTimeout=e.requestTimeout,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.extraHeaders=e.extraHeaders,this.create()}if(e.exports=f,e.exports.Request=h,o(f,i),f.prototype.supportsBinary=!0,f.prototype.request=function(e){return(e=e||{}).uri=this.uri(),e.xd=this.xd,e.xs=this.xs,e.agent=this.agent||!1,e.supportsBinary=this.supportsBinary,e.enablesXDR=this.enablesXDR,e.withCredentials=this.withCredentials,e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized,e.requestTimeout=this.requestTimeout,e.extraHeaders=this.extraHeaders,new h(e)},f.prototype.doWrite=function(e,t){var r="string"!=typeof e&&void 0!==e,n=this.request({method:"POST",data:e,isBinary:r}),i=this;n.on("success",t),n.on("error",(function(e){i.onError("xhr post error",e)})),this.sendXhr=n},f.prototype.doPoll=function(){a("xhr poll");var e=this.request(),t=this;e.on("data",(function(e){t.onData(e)})),e.on("error",(function(e){t.onError("xhr poll error",e)})),this.pollXhr=e},s(h.prototype),h.prototype.create=function(){var e={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized;var t=this.xhr=new n(e),r=this;try{a("xhr open %s: %s",this.method,this.uri),t.open(this.method,this.uri,this.async);try{if(this.extraHeaders)for(var i in t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0),this.extraHeaders)this.extraHeaders.hasOwnProperty(i)&&t.setRequestHeader(i,this.extraHeaders[i])}catch(s){}if("POST"===this.method)try{this.isBinary?t.setRequestHeader("Content-type","application/octet-stream"):t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(s){}try{t.setRequestHeader("Accept","*/*")}catch(s){}"withCredentials"in t&&(t.withCredentials=this.withCredentials),this.requestTimeout&&(t.timeout=this.requestTimeout),this.hasXDR()?(t.onload=function(){r.onLoad()},t.onerror=function(){r.onError(t.responseText)}):t.onreadystatechange=function(){if(2===t.readyState)try{var e=t.getResponseHeader("Content-Type");(r.supportsBinary&&"application/octet-stream"===e||"application/octet-stream; charset=UTF-8"===e)&&(t.responseType="arraybuffer")}catch(s){}4===t.readyState&&(200===t.status||1223===t.status?r.onLoad():setTimeout((function(){r.onError("number"==typeof t.status?t.status:0)}),0))},a("xhr data %s",this.data),t.send(this.data)}catch(s){return void setTimeout((function(){r.onError(s)}),0)}"undefined"!=typeof document&&(this.index=h.requestsCount++,h.requests[this.index]=this)},h.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},h.prototype.onData=function(e){this.emit("data",e),this.onSuccess()},h.prototype.onError=function(e){this.emit("error",e),this.cleanup(!0)},h.prototype.cleanup=function(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=u:this.xhr.onreadystatechange=u,e)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete h.requests[this.index],this.xhr=null}},h.prototype.onLoad=function(){var e;try{var t;try{t=this.xhr.getResponseHeader("Content-Type")}catch(r){}e=("application/octet-stream"===t||"application/octet-stream; charset=UTF-8"===t)&&this.xhr.response||this.xhr.responseText}catch(r){this.onError(r)}null!=e&&this.onData(e)},h.prototype.hasXDR=function(){return"undefined"!=typeof XDomainRequest&&!this.xs&&this.enablesXDR},h.prototype.abort=function(){this.cleanup()},h.requestsCount=0,h.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",l);else if("function"==typeof addEventListener){addEventListener("onpagehide"in c?"pagehide":"unload",l,!1)}function l(){for(var e in h.requests)h.requests.hasOwnProperty(e)&&h.requests[e].abort()}},function(e,t,r){"use strict";e.exports=Object.keys||function(e){var t=[],r=Object.prototype.hasOwnProperty;for(var n in e)r.call(e,n)&&t.push(n);return t}},function(e,t,r){"use strict";var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,r){"use strict";e.exports=function(e,t,r){var n=e.byteLength;if(t=t||0,r=r||n,e.slice)return e.slice(t,r);if(t<0&&(t+=n),r<0&&(r+=n),r>n&&(r=n),t>=n||t>=r||0===n)return new ArrayBuffer(0);for(var i=new Uint8Array(e),s=new Uint8Array(r-t),o=t,a=0;o<r;o++,a++)s[a]=i[o];return s.buffer}},function(e,t,r){"use strict";function n(){}e.exports=function(e,t,r){var i=!1;return r=r||n,s.count=e,0===e?t():s;function s(e,n){if(s.count<=0)throw new Error("after called too many times");--s.count,e?(i=!0,t(e),t=r):0!==s.count||i||t(null,n)}}},function(e,t,r){"use strict";var n,i,s,o=String.fromCharCode;function a(e){for(var t,r,n=[],i=0,s=e.length;i<s;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<s?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}function c(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 u(e,t){return o(e>>t&63|128)}function f(e,t){if(0==(4294967168&e))return o(e);var r="";return 0==(4294965248&e)?r=o(e>>6&31|192):0==(4294901760&e)?(c(e,t)||(e=65533),r=o(e>>12&15|224),r+=u(e,6)):0==(4292870144&e)&&(r=o(e>>18&7|240),r+=u(e,12),r+=u(e,6)),r+=o(63&e|128)}function h(){if(s>=i)throw Error("Invalid byte index");var e=255&n[s];if(s++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function l(e){var t,r;if(s>i)throw Error("Invalid byte index");if(s==i)return!1;if(t=255&n[s],s++,0==(128&t))return t;if(192==(224&t)){if((r=(31&t)<<6|h())>=128)return r;throw Error("Invalid continuation byte")}if(224==(240&t)){if((r=(15&t)<<12|h()<<6|h())>=2048)return c(r,e)?r:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(r=(7&t)<<18|h()<<12|h()<<6|h())>=65536&&r<=1114111)return r;throw Error("Invalid UTF-8 detected")}e.exports={version:"2.1.2",encode:function(e,t){for(var r=!1!==(t=t||{}).strict,n=a(e),i=n.length,s=-1,o="";++s<i;)o+=f(n[s],r);return o},decode:function(e,t){var r=!1!==(t=t||{}).strict;n=a(e),i=n.length,s=0;for(var c,u=[];!1!==(c=l(r));)u.push(c);return function(e){for(var t,r=e.length,n=-1,i="";++n<r;)(t=e[n])>65535&&(i+=o((t-=65536)>>>10&1023|55296),t=56320|1023&t),i+=o(t);return i}(u)}}},function(e,t,r){"use strict";!function(){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(256),n=0;n<e.length;n++)r[e.charCodeAt(n)]=n;t.encode=function(t){var r,n=new Uint8Array(t),i=n.length,s="";for(r=0;r<i;r+=3)s+=e[n[r]>>2],s+=e[(3&n[r])<<4|n[r+1]>>4],s+=e[(15&n[r+1])<<2|n[r+2]>>6],s+=e[63&n[r+2]];return i%3==2?s=s.substring(0,s.length-1)+"=":i%3==1&&(s=s.substring(0,s.length-2)+"=="),s},t.decode=function(e){var t,n,i,s,o,a=.75*e.length,c=e.length,u=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var f=new ArrayBuffer(a),h=new Uint8Array(f);for(t=0;t<c;t+=4)n=r[e.charCodeAt(t)],i=r[e.charCodeAt(t+1)],s=r[e.charCodeAt(t+2)],o=r[e.charCodeAt(t+3)],h[u++]=n<<2|i>>4,h[u++]=(15&i)<<4|s>>2,h[u++]=(3&s)<<6|63&o;return f}}()},function(e,t,r){"use strict";var n=void 0!==n?n:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,i=function(){try{return 2===new Blob(["hi"]).size}catch(e){return!1}}(),s=i&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(e){return!1}}(),o=n&&n.prototype.append&&n.prototype.getBlob;function a(e){return e.map((function(e){if(e.buffer instanceof ArrayBuffer){var t=e.buffer;if(e.byteLength!==t.byteLength){var r=new Uint8Array(e.byteLength);r.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=r.buffer}return t}return e}))}function c(e,t){t=t||{};var r=new n;return a(e).forEach((function(e){r.append(e)})),t.type?r.getBlob(t.type):r.getBlob()}function u(e,t){return new Blob(a(e),t||{})}"undefined"!=typeof Blob&&(c.prototype=Blob.prototype,u.prototype=Blob.prototype),e.exports=i?s?Blob:u:o?c:void 0},function(e,t,r){"use strict";var n=r(334),i=r(110),s=r(184);e.exports=f;var o,a=/\n/g,c=/\\n/g;function u(){}function f(e){n.call(this,e),this.query=this.query||{},o||(o=s.___eio=s.___eio||[]),this.index=o.length;var t=this;o.push((function(e){t.onData(e)})),this.query.j=this.index,"function"==typeof addEventListener&&addEventListener("beforeunload",(function(){t.script&&(t.script.onerror=u)}),!1)}i(f,n),f.prototype.supportsBinary=!1,f.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),n.prototype.doClose.call(this)},f.prototype.doPoll=function(){var e=this,t=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),t.async=!0,t.src=this.uri(),t.onerror=function(t){e.onError("jsonp poll error",t)};var r=document.getElementsByTagName("script")[0];r?r.parentNode.insertBefore(t,r):(document.head||document.body).appendChild(t),this.script=t,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout((function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)}),100)},f.prototype.doWrite=function(e,t){var r=this;if(!this.form){var n,i=document.createElement("form"),s=document.createElement("textarea"),o=this.iframeId="eio_iframe_"+this.index;i.className="socketio",i.style.position="absolute",i.style.top="-1000px",i.style.left="-1000px",i.target=o,i.method="POST",i.setAttribute("accept-charset","utf-8"),s.name="d",i.appendChild(s),document.body.appendChild(i),this.form=i,this.area=s}function u(){f(),t()}function f(){if(r.iframe)try{r.form.removeChild(r.iframe)}catch(t){r.onError("jsonp polling iframe removal error",t)}try{var e='<iframe src="javascript:0" name="'+r.iframeId+'">';n=document.createElement(e)}catch(t){(n=document.createElement("iframe")).name=r.iframeId,n.src="javascript:0"}n.id=r.iframeId,r.form.appendChild(n),r.iframe=n}this.form.action=this.uri(),f(),e=e.replace(c,"\\\n"),this.area.value=e.replace(a,"\\n");try{this.form.submit()}catch(h){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===r.iframe.readyState&&u()}:this.iframe.onload=u}},function(e,t,r){"use strict";(function(t){var n,i,s=r(185),o=r(69),a=r(109),c=r(110),u=r(336),f=r(2)("engine.io-client:websocket");if("undefined"!=typeof WebSocket?n=WebSocket:"undefined"!=typeof self&&(n=self.WebSocket||self.MozWebSocket),"undefined"==typeof window)try{i=r(886)}catch(d){}var h=n||i;function l(e){e&&e.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=n&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(h=i),s.call(this,e)}e.exports=l,c(l,s),l.prototype.name="websocket",l.prototype.supportsBinary=!0,l.prototype.doOpen=function(){if(this.check()){var e=this.uri(),t=this.protocols,r={};this.isReactNative||(r.agent=this.agent,r.perMessageDeflate=this.perMessageDeflate,r.pfx=this.pfx,r.key=this.key,r.passphrase=this.passphrase,r.cert=this.cert,r.ca=this.ca,r.ciphers=this.ciphers,r.rejectUnauthorized=this.rejectUnauthorized),this.extraHeaders&&(r.headers=this.extraHeaders),this.localAddress&&(r.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?t?new h(e,t):new h(e):new h(e,t,r)}catch(n){return this.emit("error",n)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},l.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},l.prototype.write=function(e){var r=this;this.writable=!1;for(var n=e.length,i=0,s=n;i<s;i++)!function(e){o.encodePacket(e,r.supportsBinary,(function(i){if(!r.usingBrowserWebSocket){var s={};if(e.options&&(s.compress=e.options.compress),r.perMessageDeflate)("string"==typeof i?t.byteLength(i):i.length)<r.perMessageDeflate.threshold&&(s.compress=!1)}try{r.usingBrowserWebSocket?r.ws.send(i):r.ws.send(i,s)}catch(d){f("websocket closed before onclose event")}--n||a()}))}(e[i]);function a(){r.emit("flush"),setTimeout((function(){r.writable=!0,r.emit("drain")}),0)}},l.prototype.onClose=function(){s.prototype.onClose.call(this)},l.prototype.doClose=function(){void 0!==this.ws&&this.ws.close()},l.prototype.uri=function(){var e=this.query||{},t=this.secure?"wss":"ws",r="";return this.port&&("wss"===t&&443!==Number(this.port)||"ws"===t&&80!==Number(this.port))&&(r=":"+this.port),this.timestampRequests&&(e[this.timestampParam]=u()),this.supportsBinary||(e.b64=1),(e=a.encode(e)).length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+r+this.path+e},l.prototype.check=function(){return!(!h||"__initialize"in h&&this.name===l.prototype.name)}}).call(this,r(0).Buffer)},function(e,t){},function(e,t,r){"use strict";e.exports=function(e,t){for(var r=[],n=(t=t||0)||0;n<e.length;n++)r[n-t]=e[n];return r}},function(e,t,r){"use strict";function n(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}e.exports=n,n.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-r:e+r}return 0|Math.min(e,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(e){this.ms=e},n.prototype.setMax=function(e){this.max=e},n.prototype.setJitter=function(e){this.jitter=e}},function(e,t,r){"use strict";e.exports=r(187),e.exports.source=r(187),e.exports.sink=r(342),e.exports.transform=r(890),e.exports.duplex=r(343)},function(e,t,r){"use strict";const n=r(343);e.exports=e=>async function*(t){const r=n(e);r.sink(t).catch(e=>{}),yield*r.source}},function(e,t,r){"use strict";e.exports=r(892)},function(e,t,r){"use strict";const n=r(19),i=r(79),s=r(2)("libp2p:mplex"),o=r(52),a=r(893),c=r(345),{MessageTypes:u,MessageTypeNames:f}=r(346),h=r(896);class l{constructor(e){e="function"==typeof(e=e||{})?{onStream:e}:e,this._streamId=0,this._streams={initiators:new Map,receivers:new Map},this._options=e,this.sink=this._createSink(),this.source=this._createSource(),this.onStream=e.onStream,this.onStreamEnd=e.onStreamEnd}get streams(){const e=[];return this._streams.initiators.forEach(t=>{e.push(t)}),this._streams.receivers.forEach(t=>{e.push(t)}),e}newStream(e){const t=this._streamId++;e=null==e?t.toString():String(e);const r=this._streams.initiators;return this._newStream({id:t,name:e,type:"initiator",registry:r})}_newReceiverStream({id:e,name:t}){const r=this._streams.receivers;return this._newStream({id:e,name:t,type:"receiver",registry:r})}_newStream({id:e,name:t,type:r,registry:n}){if(n.has(e))throw new Error("".concat(r," stream ").concat(e," already exists!"));s("new %s stream %s %s",r,e,t);const i=h({id:e,name:t,send:n=>(s.enabled&&s("%s stream %s %s send",r,e,t,{...n,type:f[n.type],data:n.data&&n.data.slice()}),this.source.push(n)),type:r,onEnd:()=>{s("%s stream %s %s ended",r,e,t),n.delete(e),this.onStreamEnd&&this.onStreamEnd(i)},maxMsgSize:this._options.maxMsgSize});return n.set(e,i),i}_createSink(){return async e=>{this._options.signal&&(e=o(e,this._options.signal));try{await n(e,a.decode,c(this._options.maxMsgSize),async e=>{for await(const t of e)for(const e of t)this._handleIncoming(e)})}catch(t){return s("error in sink",t),this.source.end(t)}this.source.end()}}_createSource(){const e=i({onEnd:e=>{const{initiators:t,receivers:r}=this._streams;for(const n of t.values())n.abort(e);for(const n of r.values())n.abort(e)},writev:!0});return Object.assign(a.encode(e),{push:e.push,end:e.end,return:e.return})}_handleIncoming({id:e,type:t,data:r}){if(s.enabled&&s("incoming message",{id:e,type:f[t],data:r.slice()}),t===u.NEW_STREAM&&this.onStream){const t=this._newReceiverStream({id:e,name:r.toString()});return this.onStream(t)}const n=(1&t?this._streams.initiators:this._streams.receivers).get(e);if(!n)return s("missing stream %s",e);switch(t){case u.MESSAGE_INITIATOR:case u.MESSAGE_RECEIVER:n.source.push(r);break;case u.CLOSE_INITIATOR:case u.CLOSE_RECEIVER:n.close();break;case u.RESET_INITIATOR:case u.RESET_RECEIVER:n.reset();break;default:s("unknown message type %s",t)}}}l.multicodec="/mplex/6.7.0",e.exports=l},function(e,t,r){"use strict";t.encode=r(894),t.decode=r(895)},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(14),s=r(30);const o=new class{constructor(){this._pool=n.allocUnsafe(10240),this._poolOffset=0}write(e){const t=this._pool;let r=this._poolOffset;i.encode(e.id<<3|e.type,t,r),r+=i.encode.bytes,i.encode(e.data?e.data.length:0,t,r),r+=i.encode.bytes;const s=t.slice(this._poolOffset,r);return 10240-r<100?(this._pool=n.allocUnsafe(10240),this._poolOffset=0):this._poolOffset=r,e.data?[s,e.data]:s}};e.exports=e=>async function*(){for await(const t of e)Array.isArray(t)?yield new s(t.map(e=>o.write(e))):yield new s(o.write(t))}()},function(e,t,r){"use strict";const n=r(14),i=r(30);e.exports=e=>async function*(){const t=new s;for await(const r of e){const e=t.write(r);e.length&&(yield e)}}();class s{constructor(){this._buffer=new i,this._bufferProxy=new Proxy({},{get:(e,t)=>"l"===t[0]?this._buffer[t]:this._buffer.get(parseInt(t))}),this._headerInfo=null}write(e){if(!e||!e.length)return[];this._buffer.append(e);const t=[];for(;;){if(!this._headerInfo)try{this._headerInfo=this._decodeHeader(this._bufferProxy)}catch(r){break}const{id:e,type:n,length:i,offset:s}=this._headerInfo;if(this._buffer.length-s<i)break;t.push({id:e,type:n,data:this._buffer.shallowSlice(s,s+i)}),this._buffer.consume(s+i),this._headerInfo=null}return t}_decodeHeader(e){const t=n.decode(e);let r=n.decode.bytes;const i=n.decode(e,r);return r+=n.decode.bytes,{id:t>>3,type:7&t,offset:r,length:i}}}},function(e,t,r){"use strict";const n=r(52),i=r(41),s=r(2)("libp2p:mplex:stream"),o=r(79),a=r(30),{MAX_MSG_SIZE:c}=r(345),{InitiatorMessageTypes:u,ReceiverMessageTypes:f}=r(346);e.exports=({id:e,name:t,send:r,onEnd:h=(()=>{}),type:l="initiator",maxMsgSize:d=c})=>{const p=new i,b=new i,y="initiator"===l?u:f,m="initiator"===l?"i".concat(e):"r".concat(e);t=String(null==t?e:t);let g,v=!1,w=!1;const _=e=>{w=!0,s("%s stream %s sink end",l,t,e),e&&!g&&(g=e),v&&(E.timeline.close=Date.now(),h(g))},E={close:()=>E.source.end(),abort:e=>{s("%s stream %s abort",l,t,e),E.source.end(e),p.abort()},reset:()=>b.abort(),sink:async i=>{i=n(i,[{signal:p.signal,options:{abortMessage:"stream aborted",abortCode:"ERR_MPLEX_STREAM_ABORT"}},{signal:b.signal,options:{abortMessage:"stream reset",abortCode:"ERR_MPLEX_STREAM_RESET"}}]),"initiator"===l&&r({id:e,type:y.NEW_STREAM,data:t});try{for await(let t of i)for(;t.length;){if(t.length<=d){r({id:e,type:y.MESSAGE,data:t});break}t=a.isBufferList(t)?t:new a(t),r({id:e,type:y.MESSAGE,data:t.shallowSlice(0,d)}),t.consume(d)}}catch(o){return"ERR_MPLEX_STREAM_RESET"===o.code?s("%s stream %s reset",l,t):(s("%s stream %s error",l,t,o),r({id:e,type:y.RESET})),E.source.end(o),_(o)}r({id:e,type:y.CLOSE}),_()},source:o(e=>{v=!0,s("%s stream %s source end",l,t,e),e&&!g&&(g=e),w&&(E.timeline.close=Date.now(),h(g))}),timeline:{open:Date.now(),close:null},id:m};return E}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={NOISE:!0};t.NOISE=void 0;var i=r(898);Object.keys(i).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}}))}));const s=new i.Noise;t.NOISE=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Noise=void 0;var n=v(r(188)),i=r(0),s=v(r(189)),o=v(r(348)),a=v(r(108)),c=v(r(19)),u=r(25),f=r(349),h=r(931),l=r(934),d=r(53),p=r(111),b=r(935),y=r(936),m=r(85),g=r(190);function v(e){return e&&e.__esModule?e:{default:e}}function w(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.Noise=class{constructor(e,t){if(w(this,"protocol","/noise"),w(this,"prologue",i.Buffer.alloc(0)),w(this,"staticKeys",void 0),w(this,"earlyData",void 0),w(this,"useNoisePipes",void 0),this.earlyData=t||i.Buffer.alloc(0),this.useNoisePipes=!1,e){const t=n.default.publicKeyCreate(e);this.staticKeys={privateKey:e,publicKey:t}}else this.staticKeys=(0,d.generateKeypair)()}async secureOutbound(e,t,r){const n=(0,s.default)(t,{lengthEncoder:p.uint16BEEncode,lengthDecoder:p.uint16BEDecode,maxDataLength:g.NOISE_MSG_MAX_LENGTH_BYTES}),i=await this.performHandshake({connection:n,isInitiator:!0,localPeer:e,remotePeer:r});return{conn:await this.createSecureConnection(n,i),remoteEarlyData:i.remoteEarlyData,remotePeer:i.remotePeer}}async secureInbound(e,t,r){const n=(0,s.default)(t,{lengthEncoder:p.uint16BEEncode,lengthDecoder:p.uint16BEDecode,maxDataLength:g.NOISE_MSG_MAX_LENGTH_BYTES}),i=await this.performHandshake({connection:n,isInitiator:!1,localPeer:e,remotePeer:r});return{conn:await this.createSecureConnection(n,i),remoteEarlyData:i.remoteEarlyData,remotePeer:i.remotePeer}}async performHandshake(e){const t=await(0,d.getPayload)(e.localPeer,this.staticKeys.publicKey,this.earlyData);let r=this.useNoisePipes;if(e.isInitiator&&null===y.KeyCache.load(e.remotePeer)&&(r=!1),!r)return await this.performXXHandshake(e,t);{const{remotePeer:r,connection:s,isInitiator:o}=e,a=new h.IKHandshake(o,t,this.prologue,this.staticKeys,s,y.KeyCache.load(e.remotePeer)||i.Buffer.alloc(32),r);try{return await this.performIKHandshake(a)}catch(n){let r;return e.isInitiator&&(r=a.getLocalEphemeralKeys()),await this.performXXFallbackHandshake(e,t,n.initialMsg,r)}}}async performXXFallbackHandshake(e,t,r,n){const{isInitiator:i,remotePeer:s,connection:o}=e,a=new l.XXFallbackHandshake(i,t,this.prologue,this.staticKeys,o,r,s,n);try{await a.propose(),await a.exchange(),await a.finish()}catch(c){throw(0,m.logger)(c),new Error("Error occurred during XX Fallback handshake: ".concat(c.message))}return a}async performXXHandshake(e,t){const{isInitiator:r,remotePeer:n,connection:i}=e,s=new f.XXHandshake(r,t,this.prologue,this.staticKeys,i,n);try{await s.propose(),await s.exchange(),await s.finish(),this.useNoisePipes&&s.remotePeer&&y.KeyCache.store(s.remotePeer,s.getRemoteStaticKey())}catch(o){throw new Error("Error occurred during XX handshake: ".concat(o.message))}return s}async performIKHandshake(e){return await e.stage0(),await e.stage1(),e}async createSecureConnection(e,t){const[r,n]=(0,o.default)(),i=e.unwrap();return(0,c.default)(r,a.default,(0,b.encryptStream)(t),(0,u.encode)({lengthEncoder:p.uint16BEEncode}),i,(0,u.decode)({lengthDecoder:p.uint16BEDecode}),a.default,(0,b.decryptStream)(t),r),n}}},function(e,t,r){"use strict";(function(t){const n=r(39),i=r(900),s=r(903),{padRight:o}=r(905);e.exports=class{constructor(e,t,r){n("string"==typeof e),n(!t||"string"==typeof t),this.id=e,this.type="ecdh",this.eid=t||null,this._pre=r||null,this._curve=null,this._edwards=null,this.native=0}get curve(){return this._curve||(this._curve=i.curve(this.id)),this._curve}get edwards(){return this.eid&&!this._edwards&&(this._edwards=i.curve(this.eid,this._pre),this._edwards.precompute(s),this._pre=null),this._edwards}get size(){return this.curve.fieldSize}get bits(){return this.curve.fieldBits}privateKeyGenerate(){const e=s.randomBytes(this.curve.scalarSize);return this.curve.clamp(e)}privateKeyVerify(e){return n(t.isBuffer(e)),e.length===this.curve.scalarSize}privateKeyExport(e,r){const n=this.publicKeyCreate(e),{x:i,y:s}=this.publicKeyExport(n,r);return{d:t.from(e),x:i,y:s}}privateKeyImport(e){return n(e&&"object"==typeof e),o(e.d,this.curve.scalarSize)}publicKeyCreate(e){const t=this.curve.decodeScalar(e),r=this.curve.reduce(t);if(this.edwards&&this.edwards.g.pre){const e=this.edwards.g.mulBlind(r);return this.curve.pointFromEdwards(e).encode()}return this.curve.g.toX().mulBlind(r,s).encode()}publicKeyConvert(e,t){if(n(null==t||"boolean"==typeof t),!this.edwards)throw new Error("No equivalent edwards curve.");const r=this.curve.decodePoint(e),i=this.edwards.pointFromMont(r);return null!=t&&i.isOdd()!==t?i.neg().encode():i.encode()}publicKeyFromUniform(e){const t=this.curve.decodeUniform(e);return this.curve.pointFromUniform(t).encode()}publicKeyToUniform(e,t=s.randomInt()){const r=this.curve.decodePoint(e),n=this.curve.pointToUniform(r,t);return this.curve.encodeUniform(n,t>>>8)}publicKeyFromHash(e,t=!1){return this.curve.pointFromHash(e,t).encode()}publicKeyToHash(e,t=s.randomInt()){const r=this.curve.decodePoint(e);return this.curve.pointToHash(r,t,s)}publicKeyVerify(e){let r;n(t.isBuffer(e));try{r=this.curve.decodeX(e)}catch(i){return!1}return r.validate()}publicKeyIsSmall(e){let r;n(t.isBuffer(e));try{r=this.curve.decodeX(e)}catch(i){return!1}return!!r.validate()&&r.isSmall()}publicKeyHasTorsion(e){let r;n(t.isBuffer(e));try{r=this.curve.decodeX(e)}catch(i){return!1}return!!r.validate()&&r.hasTorsion()}publicKeyExport(e,t){const{x:r,y:n}=this.curve.decodePoint(e,t);return{x:this.curve.encodeField(r.fromRed()),y:this.curve.encodeField(n.fromRed())}}publicKeyImport(e){n(e&&"object"==typeof e);const t=o(e.x,this.curve.fieldSize),r=this.curve.decodeX(t);if(!r.validate())throw new Error("Invalid point.");return r.encode()}derive(e,t){const r=this.curve.decodeX(e),n=this.curve.decodeScalar(t),i=this.curve.reduce(n);return r.mulConst(i,s).encode()}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const{custom:n}=r(347),i=r(901),s=0,o=1,a=2,c=3,u=[-3,-1,-5,-7,0,7,5,1,3];class f{constructor(e,t,r){this.Point=null,this.id=null,this.ossl=null,this.type="base",this.endian="be",this.hash=null,this.prefix=null,this.context=!1,this.prime=null,this.p=null,this.red=null,this.fieldSize=0,this.fieldBits=0,this.adjustedSize=0,this.signBit=0,this.n=null,this.h=null,this.q=null,this.z=null,this.g=null,this.nh=null,this.scalarSize=0,this.scalarBits=0,this.mask=null,this.zero=null,this.one=null,this.two=null,this.three=null,this.four=null,this.i2=null,this.i3=null,this.i4=null,this.i6=null,this.torsion=null,this.endo=null,this.hi=null,this._init(e,t,r)}_init(t,r,n){M("function"==typeof t),M("string"==typeof r),M(n&&"object"==typeof n),M(null==n.red||n.red instanceof i.Red),M(null!=n.p,"Must pass a prime."),M(null==n.id||"string"==typeof n.id),M(null==n.ossl||"string"==typeof n.ossl),M(null==n.endian||"string"==typeof n.endian),M(null==n.hash||"string"==typeof n.hash),M(null==n.prefix||"string"==typeof n.prefix),M(null==n.context||"boolean"==typeof n.context),M(null==n.prime||"string"==typeof n.prime),M(null==n.torsion||Array.isArray(n.torsion)),this.Point=t,this.id=n.id||null,this.ossl=n.ossl||null,this.type=r,this.endian=n.endian||("short"===r?"be":"le"),this.hash=n.hash||null,this.prefix=n.prefix?e.from(n.prefix,"binary"):null,this.context=n.context||!1,this.prime=n.prime||null,this.p=i.fromJSON(n.p),n.red?this.red=n.red:(this.red=n.prime?i.red(n.prime):i.mont(this.p),this.red.precompute()),this.fieldSize=this.p.byteLength(),this.fieldBits=this.p.bitLength(),this.adjustedSize=this.fieldSize+(0==(7&this.fieldBits)),this.signBit=8*this.adjustedSize-1,this.n=i.fromJSON(n.n||"0"),this.h=i.fromJSON(n.h||"1"),this.q=this.n.mul(this.h),this.z=i.fromJSON(n.z||"0").toRed(this.red),this.g=null,this.nh=this.n.ushrn(1),this.scalarSize=this.n.byteLength(),this.scalarBits=this.n.bitLength(),this.mask=null,this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.three=new i(3).toRed(this.red),this.four=new i(4).toRed(this.red),this.i2=this.two.redInvert(),this.i3=this.three.redInvert(),this.i4=this.i2.redSqr(),this.i6=this.i2.redMul(this.i3),this.torsion=new Array(this.h.word(0));for(let e=0;e<this.torsion.length;e++)this.torsion[e]=this.point();return this.endo=null,this.hi=null,this._scale=D(this._scale,this),this.isIsomorphic=D(this.isIsomorphic,this),this.isIsogenous=D(this.isIsogenous,this),M(this.p.sign()>0&&this.p.isOdd()),M(this.n.sign()>=0),M(this.h.sign()>0&&this.h.cmpn(255)<=0),M("be"===this.endian||"le"===this.endian),this}_finalize(e){if(M(e&&"object"==typeof e),this.mask=new w(this),this.g=e.g?this.pointFromJSON(e.g):this.point(),e.torsion){M(e.torsion.length===this.torsion.length);for(let t=0;t<this.torsion.length;t++)this.torsion[t]=this.pointFromJSON(e.torsion[t])}return this}_simpleMul(e,t){M(e instanceof h),M(t instanceof i),M(!t.red);const r=t.bitLength();t.isNeg()&&(e=e.neg());let n=this.jpoint();for(let i=r-1;i>=0;i--){const r=t.bit(i);n=n.dbl(),1===r&&(n=n.add(e))}return n}_simpleMulAdd(e,t){M(Array.isArray(e)),M(Array.isArray(t)),M(e.length===t.length);const r=e.length,n=new Array(r),s=t;let o=0;for(let c=0;c<r;c++){const r=e[c],s=t[c];if(M(r instanceof h),M(s instanceof i),M(!s.red),c>0&&r.type!==e[c-1].type)throw new Error("Cannot mix points.");n[c]=s.isNeg()?r.neg():r,o=Math.max(o,s.bitLength())}let a=this.jpoint();for(let i=o-1;i>=0;i--){a=a.dbl();for(let e=0;e<r;e++){const t=n[e];1===s[e].bit(i)&&(a=a.add(t))}}return a}_constMul(e,t,r){return M(e instanceof h),this.n.isZero()?this._simpleMul(e,t):"short"===this.type&&0===this.h.cmpn(1)?this._coZLadderMul(e,t):this._ladderMul(e,t)}_ladderMul(e,t){M(e instanceof h),M(t instanceof i),M(!t.red);const[r,n,s]=function(e,t){M(e instanceof i),M(t instanceof i);const r=e.abs().add(t),n=r.add(t),s=r.bitLength(),o=t.bitLength();r.cinject(n,s-o-1>>>31);const a=1&e.isNeg(),c=r.bitLength(),u=r.toArray("le");return[a,c,u]}(t,this.q);let o=e.toJ().clone(),a=this.jpoint().clone(),c=0;for(let i=n-1;i>=0;i--){const e=s[i>>3]>>(7&i)&1;o.swap(a,c^e),o=o.uadd(a),a=a.udbl(),c=e}return o.swap(a,c),a.swap(a.neg(),r),a}_coZLadderMul(e,t){M(e instanceof h),M(t instanceof i),M(!t.red);const r=e.toJ().clone(),[n,s,o,a]=function(e,t){M(e instanceof i),M(t instanceof i);const r=e.mod(t),n=t.sub(r),s=r.bitLength(),o=n.bitLength(),a=s-o>>>31;r.cinject(n,a);const c=r.bitLength(),u=r.toArray("le"),f=r.ceq(t.subn(1));return[a,c,u,f]}(t,this.n);let[c,u]=r.zdblu(),f=0;for(let i=s-2;i>=0;i--){const e=o[i>>3]>>(7&i)&1;c.swap(u,f^e),[c,u]=u.zaddc(c),[u,c]=c.zaddu(u),f=e}return c.swap(u,f),u.swap(r.neg(),a),u.swap(u.neg(),n),u}_fixedMul(e,t){M(e instanceof h),M(t instanceof i),M(e.pre&&e.pre.windows);const{width:r,bits:n,points:s}=e._getWindows(0,0),o=1<<r,a=(n+r-1)/r>>>0;let c=this.jpoint();for(let i=0;i<a;i++){const e=t.bits(i*r,r);c=c.add(s[i*o+e])}return t.isNeg()&&(c=c.neg()),c}_fixedNafMul(e,t){M(e instanceof h),M(t instanceof i),M(e.pre&&e.pre.doubles);const{step:r,points:n}=e._getDoubles(0,0),s=function(e,t,r,n){M(n>>>0===n);const i=C(e,t,r),s=Math.ceil(i.length/n),o=new Array(s);let a=0;for(let c=0;c<i.length;c+=n){let e=0;for(let t=c+n-1;t>=c;t--)e=(e<<1)+i[t];o[a++]=e}return M(a===s),o}(t,1,t.bitLength()+1,r),o=((1<<r+1)-(r%2==0?2:1))/3;let a=this.jpoint(),c=this.jpoint();for(let i=o;i>0;i--){for(let e=0;e<s.length;e++){const t=s[e];t===i?c=c.add(n[e]):t===-i&&(c=c.sub(n[e]))}a=a.add(c)}return a}_windowMul(e,t,r){M(e>>>0===e),M(t instanceof h),M(r instanceof i);const n=1<<e,s=(Math.max(r.bitLength(),this.n.bitLength())+e-1)/e>>>0,o=new Array(n),a=t.toJ();o[0]=this.jpoint(),o[1]=a;for(let i=2;i<n;i+=2)o[i+0]=o[i>>1].dbl(),o[i+1]=o[i].add(a);let c=this.jpoint();for(let i=s-1;i>=0;i--){const t=r.bits(i*e,e);i===s-1?c=o[t]:(c=c.dblp(e),c=c.add(o[t]))}return r.isNeg()&&(c=c.neg()),c}_slideMul(e,t,r){M(e>>>0===e),M(t instanceof h),M(r instanceof i);const n=1<<e-1,s=new Array(n),o=t.toJ();s[0]=o.dblp(e-1),s[1]=s[0].add(o);for(let i=2;i<n;i++)s[i]=s[i-1].add(o);let a=r.bitLength(),c=this.jpoint();for(;a>=e;){const t=a-e,i=r.bits(t,e);i<n?(c=c.dbl(),a-=1):(c=c.dblp(e),c=c.add(s[i&~n]),a=t)}if(a>0){const e=r.bits(0,a);for(;a--;)c=c.dbl(),e>>a&1&&(c=c.add(t))}return r.isNeg()&&(c=c.neg()),c}_wnafMul(e,t,r){M(t instanceof h),M(r instanceof i);const{width:n,points:s}=t._safeNAF(e),o=C(r,n,r.bitLength()+1);let a=this.jpoint();for(let i=o.length-1;i>=0;i--){const e=o[i];i!==o.length-1&&(a=a.dbl()),e>0?a=a.add(s[e-1>>1]):e<0&&(a=a.sub(s[-e-1>>1]))}return a}_wnafMulAdd(e,t,r){M(e>>>0===e),M(Array.isArray(t)),M(Array.isArray(r)),M(t.length===r.length);const n=t.length,s=new Array(n),o=new Array(n);let a=0;for(let d=0;d<n;d++){const e=t[d],n=r[d];if(M(e instanceof h),M(n instanceof i),d>0&&e.type!==t[d-1].type)throw new Error("Cannot mix points.");s[d]=null,o[d]=null,a=Math.max(a,n.bitLength()+1)}let c=null,u=null,f=0;for(let i=0;i<n;i++){const e=t[i],n=r[i],h=e._getNAF(0);h?(s[f]=h.points,o[f]=C(n,h.width,a),f+=1):c?(s[f]=c._getJNAF(e),o[f]=B(u,n,a),c=null,u=null,f+=1):(c=e,u=n)}if(c){const t=c._safeNAF(e);s[f]=t.points,o[f]=C(u,t.width,a),f+=1}let l=this.jpoint();for(let i=a-1;i>=0;i--){i!==a-1&&(l=l.dbl());for(let e=0;e<f;e++){const t=o[e][i];t>0?l=l.add(s[e][t-1>>1]):t<0&&(l=l.sub(s[e][-t-1>>1]))}}return l}_endoWnafMulAdd(e,t){throw new Error("Not implemented.")}_scale(e,t){switch(M(e instanceof f),M(e.p.eq(this.p)),e.type){case"short":return this._scaleShort(e,t);case"mont":return this._scaleMont(e,t);case"edwards":return this._scaleEdwards(e,t);default:throw new Error("Not implemented.")}}_scaleShort(e,t){throw new Error("Not implemented.")}_scaleMont(e,t){throw new Error("Not implemented.")}_scaleEdwards(e,t){throw new Error("Not implemented.")}isElliptic(){throw new Error("Not implemented.")}jinv(){throw new Error("Not implemented.")}isComplete(){return!1}precompute(e){return M(!this.g.isInfinity(),"Must have base point."),M(!this.n.isZero(),"Must have order."),this.g.precompute(this.n.bitLength(),e),this}scalar(e,t,r){const n=new i(e,t,r);return M(!n.red),this.n.isZero()?n:n.imod(this.n)}field(e,t,r){const n=i.cast(e,t,r);return n.red?n.forceRed(this.red):n.toRed(this.red)}point(e,t){throw new Error("Not implemented.")}jpoint(e,t,r){throw new Error("Not implemented.")}xpoint(e,t){throw new Error("Not implemented.")}cpoint(e,t,r,n){if(M(e instanceof i),M(t instanceof i),M(r instanceof i),M(n instanceof i),t.isZero()||n.isZero())return this.point();const s=t.redMul(n).redInvert(),o=e.redMul(n).redMul(s),a=r.redMul(t).redMul(s);return this.point(o,a)}solveX2(e){throw new Error("Not implemented.")}solveX(e){return this.solveX2(e).redSqrt()}solveY2(e){throw new Error("Not implemented.")}solveY(e){return this.solveY2(e).redSqrt()}validate(e){throw new Error("Not implemented.")}pointFromX(e,t){throw new Error("Not implemented.")}pointFromY(e,t){throw new Error("Not implemented.")}isIsomorphic(e){throw new Error("Not implemented.")}isIsogenous(e){throw new Error("Not implemented.")}pointFromShort(e){throw new Error("Not implemented.")}pointFromMont(e,t){throw new Error("Not implemented.")}pointFromEdwards(e){throw new Error("Not implemented.")}pointFromUniform(e){throw new Error("Not implemented.")}pointToUniform(e){throw new Error("Not implemented.")}pointFromHash(t,r=!1){if(M(e.isBuffer(t)),M("boolean"==typeof r),t.length!==2*this.fieldSize)throw new Error("Invalid hash size.");const n=t.slice(0,this.fieldSize),i=t.slice(this.fieldSize),s=this.decodeUniform(n),o=this.decodeUniform(i),a=this.pointFromUniform(s),c=this.pointFromUniform(o),u=a.uadd(c);return r?u.mulH():u}pointToHash(t,r,n){M(t instanceof this.Point),M(r>>>0===r);const i=r%this.torsion.length,s=t.add(this.torsion[i]);for(;;){const t=this.randomField(n),r=this.pointFromUniform(t);if(r.neg().eq(r))continue;const i=s.usub(r),a=O(n);let c;try{c=this.pointToUniform(i,15&a)}catch(o){if("Invalid point."===o.message)continue;throw o}const u=this.encodeUniform(t,a>>>8),f=this.encodeUniform(c,a>>>16);return e.concat([u,f])}}randomScalar(e){const t=this.n.isZero()?this.p:this.n;return i.random(e,1,t)}randomField(e){return i.random(e,1,this.p).toRed(this.red)}randomPoint(e){let t;for(;;){const n=this.randomField(e),i=0!=(1&O(e));try{t=this.pointFromX(n,i)}catch(r){continue}return M(t.validate()),t.mulH()}}mulAll(e,t){return this.jmulAll(e,t)}mulAllSimple(e,t){return this.jmulAllSimple(e,t)}jmulAll(e,t){return M(Array.isArray(e)),M(0===e.length||e[0]instanceof h),this.endo&&e.length>0&&e[0].type===s?this._endoWnafMulAdd(e,t):this._wnafMulAdd(4,e,t)}jmulAllSimple(e,t){return this._simpleMulAdd(e,t)}mulH(e){return M(e instanceof i),this.imulH(e.clone())}imulH(e){M(e instanceof i),M(!e.red);const t=this.h.word(0);if(0==(t&t-1)){const t=this.h.bitLength();return e.iushln(t-1).imod(this.n)}return e.imuln(t).imod(this.n)}reduce(e){return this.mask.reduce(e)}splitHash(e){return this.mask.splitHash(e)}clamp(e){return this.mask.clamp(e)}encodeField(e){return M(e instanceof i),M(!e.red),e.encode(this.endian,this.fieldSize)}decodeField(t){if(M(e.isBuffer(t)),t.length!==this.fieldSize)throw new Error("Invalid field element size.");return i.decode(t,this.endian)}encodeAdjusted(e){return M(e instanceof i),M(!e.red),e.encode(this.endian,this.adjustedSize)}decodeAdjusted(t){if(M(e.isBuffer(t)),t.length!==this.adjustedSize)throw new Error("Invalid field element size.");return i.decode(t,this.endian)}encodeScalar(e){return M(e instanceof i),M(!e.red),e.encode(this.endian,this.scalarSize)}decodeScalar(t){if(M(e.isBuffer(t)),t.length!==this.scalarSize)throw new Error("Invalid scalar size.");return i.decode(t,this.endian)}encodeUniform(e,t){M(e instanceof i),M(t>>>0===t);let r=255;0!=(7&this.fieldBits)&&(r=(1<<(7&this.fieldBits))-1);const n=e.fromRed(),s="le"===this.endian?this.fieldSize-1:0,o=n.encode(this.endian,this.fieldSize);return o[s]|=t&~r&255,o}decodeUniform(t){if(M(e.isBuffer(t)),t.length!==this.fieldSize)throw new Error("Invalid field size.");const r=i.decode(t,this.endian);return r.iumaskn(this.fieldBits),r.toRed(this.red)}encodePoint(e,t){return M(e instanceof h),e.encode(t)}decodePoint(e){throw new Error("Not implemented.")}encodeX(e){throw new Error("Not implemented.")}decodeX(e){throw new Error("Not implemented.")}decodeEven(e){throw new Error("Not implemented.")}decodeSquare(e){throw new Error("Not implemented.")}toShort(){throw new Error("Not implemented.")}toMont(e){throw new Error("Not implemented.")}toEdwards(e){throw new Error("Not implemented.")}pointToJSON(e,t){return M(e instanceof h),e.toJSON(t)}pointFromJSON(e){throw new Error("Not implemented.")}toJSON(e){let t,r,n,i,s;return"edwards"===this.type&&(t=this.prefix?this.prefix.toString():null,r=this.context),this.n.isZero()||(n=this.n.toJSON()),this.z.isZero()||(i=this.z.fromRed(),this.z.redIsHigh()&&i.isub(this.p),i=i.toString(16)),this.endo&&(s=this.endo.toJSON()),{id:this.id,ossl:this.ossl,type:this.type,endian:this.endian,hash:this.hash,prefix:t,context:r,prime:this.prime,p:this.p.toJSON(),a:void 0,b:void 0,d:void 0,n:n,h:this.h.toString(16),s:void 0,z:i,c:void 0,g:this.g.toJSON(e),endo:s}}static fromJSON(e){return new this(e)}}class h{constructor(e,t){M(e instanceof f),M(t>>>0===t),this.curve=e,this.type=t,this.pre=null}_init(){throw new Error("Not implemented.")}_getNAF(e){if(M(e>>>0===e),this.pre&&this.pre.naf)return this.pre.naf;if(0===e)return null;const t=1<<e-1,r=new Array(t),n=1===t?null:this.dbl();r[0]=this;for(let i=1;i<t;i++)r[i]=r[i-1].add(n);return new E(e,r)}_safeNAF(e){return this._getNAF(e)}_getWindows(e,t){if(M(e>>>0===e),M(t>>>0===t),this.pre&&this.pre.windows)return this.pre.windows;if(0===e)return null;const r=1<<e,n=(t+e-1)/e>>>0,i=new Array(n*r);let s=this.toP();for(let o=0;o<n;o++){i[o*r]=this.curve.point();for(let e=1;e<r;e++)i[o*r+e]=i[o*r+e-1].add(s);s=s.dblp(e)}return new k(e,t,i)}_getDoubles(e,t){if(M(e>>>0===e),M(t>>>0===t),this.pre&&this.pre.doubles)return this.pre.doubles;if(0===e)return null;const r=Math.ceil(t/e)+1,n=new Array(r);let i=this,s=0;n[s++]=i;for(let o=0;o<t;o+=e){for(let t=0;t<e;t++)i=i.dbl();n[s++]=i}return M(s===r),new S(e,n)}_getBeta(){return null}_getBlinding(e){if(this.pre&&this.pre.blinding)return this.pre.blinding;if(!e)return null;if(this.curve.n.isZero())return null;const t=this.curve.randomScalar(e),r=this.mul(t);return new A(t,r)}_hasWindows(e){if(M(e instanceof i),!this.pre||!this.pre.windows)return!1;const{bits:t}=this.pre.windows;return t>=e.bitLength()}_hasDoubles(e){if(M(e instanceof i),!this.pre||!this.pre.doubles)return!1;const{step:t,points:r}=this.pre.doubles,n=e.bitLength()+1;return r.length>=Math.ceil(n/t)+1}_getJNAF(e){return M(e instanceof h),M(e.type===this.type),[this,this.add(e),this.sub(e),e]}_blind(e,t){if(M(e instanceof i),M(!e.red),this.pre&&this.pre.blinding){const{blind:t,unblind:r}=this.pre.blinding;return[this,e.sub(t),r]}if(!t)return[this,e,null];if(this.pre){if(this.curve.n.isZero())return[this,e,null];return[this,this.curve.randomScalar(t).mul(this.curve.n).iadd(e),null]}return[this.randomize(t),e,null]}clone(){throw new Error("Not implemented.")}swap(e,t){throw new Error("Not implemented.")}precompute(e,t){return M(e>>>0===e),this.pre||(this.pre=new _),this.pre.naf||(this.pre.naf=this._getNAF(8)),this.pre.doubles||(this.pre.doubles=this._getDoubles(4,e+1)),this.pre.beta||(this.pre.beta=this._getBeta()),this.pre.blinding||(this.pre.blinding=this._getBlinding(t)),this}validate(){return this.curve.validate(this)}normalize(){return this}scale(e){throw new Error("Not implemented.")}randomize(e){const t=this.curve.randomField(e);return this.scale(t)}neg(){throw new Error("Not implemented.")}add(e){throw new Error("Not implemented.")}sub(e){return M(e instanceof h),this.add(e.neg())}dbl(){throw new Error("Not implemented.")}dblp(e){M(e>>>0===e);let t=this;for(let r=0;r<e;r++)t=t.dbl();return t}uadd(e){throw new Error("Not implemented.")}usub(e){return M(e instanceof h),this.uadd(e.neg())}udbl(){throw new Error("Not implemented.")}zaddu(e){throw new Error("Not implemented.")}zaddc(e){throw new Error("Not implemented.")}zdblu(){throw new Error("Not implemented.")}diffAdd(e,t){throw new Error("Not implemented.")}diffAddDbl(e,t){throw new Error("Not implemented.")}recover(){throw new Error("Not implemented.")}getX(){throw new Error("Not implemented.")}getY(){throw new Error("Not implemented.")}eq(e){throw new Error("Not implemented.")}isInfinity(){throw new Error("Not implemented.")}isOdd(){throw new Error("Not implemented.")}isEven(){throw new Error("Not implemented.")}isSquare(){throw new Error("Not implemented.")}eqX(e){throw new Error("Not implemented.")}eqXToP(e){throw new Error("Not implemented.")}isSmall(){return!this.isInfinity()&&this.jmulH().isInfinity()}hasTorsion(){return!this.isInfinity()&&!this.jmul(this.curve.n).isInfinity()}mul(e){return this.jmul(e)}muln(e){return this.jmuln(e)}mulSimple(e){return this.jmulSimple(e)}mulBlind(e,t){return this.jmulBlind(e,t)}mulConst(e,t){return this.jmulConst(e,t)}mulAdd(e,t,r){return this.jmulAdd(e,t,r)}mulAddSimple(e,t,r){return this.jmulAddSimple(e,t,r)}mulH(){return this.jmulH()}div(e){return this.jdiv(e)}divn(e){return this.jdivn(e)}divH(){return this.jdivH()}jmul(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo&&this.type===s?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(4,this,e)}jmuln(e){return M((0|e)===e),this.jmulSimple(new i(e))}jmulSimple(e){return this.curve._simpleMul(this,e)}jmulBlind(e,t=null){const[r,n,i]=this._blind(e,t),s=r.jmul(n);return i?s.add(i):s}jmulConst(e,t=null){const[r,n,i]=this._blind(e,t),s=this.curve._constMul(r,n,t);return i?s.uadd(i):s}jmulAdd(e,t,r){return this.curve.endo&&this.type===s?this.curve._endoWnafMulAdd([this,t],[e,r]):this.curve._wnafMulAdd(4,[this,t],[e,r])}jmulAddSimple(e,t,r){return this.curve._simpleMulAdd([this,t],[e,r])}jmulH(){const e=this.curve.h.word(0);if(0==(e&e-1)){const e=this.curve.h.bitLength();return this.toJ().dblp(e-1)}return this.jmulSimple(this.curve.h)}jdiv(e){return M(e instanceof i),M(!e.red),this.jmul(e.invert(this.curve.n))}jdivn(e){return M(!this.curve.n.isZero()),0===this.curve.h.cmpn(e)?this.jdivH():this.jdiv(new i(e))}jdivH(){return this.curve.n.isZero()||0===this.curve.h.cmpn(1)?this.toJ():(null===this.curve.hi&&(this.curve.hi=this.curve.h.invert(this.curve.n)),this.jmul(this.curve.hi))}ladder(e){throw new Error("Not implemented.")}ladderSimple(e){throw new Error("Not implemented.")}ladderBlind(e,t){throw new Error("Not implemented.")}ladderConst(e,t){throw new Error("Not implemented.")}toP(){return this.normalize()}toJ(){return this}toX(){return this}encode(e){throw new Error("Not implemented.")}static decode(e,t){throw new Error("Not implemented.")}encodeX(){throw new Error("Not implemented.")}static decodeX(e,t){throw new Error("Not implemented.")}static decodeEven(e,t){throw new Error("Not implemented.")}static decodeSquare(e,t){throw new Error("Not implemented.")}toJSON(e){throw new Error("Not implemented.")}static fromJSON(e,t){throw new Error("Not implemented.")}[n](){return"<Point>"}}class l extends f{constructor(e){super(d,"short",e),this.a=i.fromJSON(e.a).toRed(this.red),this.b=i.fromJSON(e.b).toRed(this.red),this.c=i.fromJSON(e.c||"0").toRed(this.red),this.ai=this.a.isZero()?this.zero:this.a.redInvert(),this.zi=this.z.isZero()?this.zero:this.z.redInvert(),this.zeroA=this.a.isZero(),this.threeA=this.a.eq(this.three.redNeg()),this.redN=this.n.toRed(this.red),this.pmodn=this.p.clone(),this.highOrder=this.n.cmp(this.p)>=0,this.smallGap=!1,this._finalize(e)}_finalize(e){return super._finalize(e),null!=e.endo?this.endo=I.fromJSON(this,e.endo):this.endo=this._getEndomorphism(),this.n.isZero()||(this.pmodn=this.p.mod(this.n),this.smallGap=this.p.div(this.n).cmpn(1)<=0),this}static _isomorphism(e,t,r,n){M(e instanceof i),M(t instanceof i),M(r instanceof i),M(null==n||"boolean"==typeof n),M(!e.isZero()&&!t.isZero());const s=r.redDiv(e),o=s.redSqrt();if(null!=n?o.redIsOdd()!==n&&o.redINeg():1!==o.redJacobi()&&o.redINeg(),1!==o.redJacobi())throw new Error("Invalid `a` coefficient.");const a=s.redMul(o),c=e.redMul(s),u=t.redMul(a);return M(c.eq(r)),[c,u]}_short(e,t){return l._isomorphism(this.a,this.b,e,t)}_mont(e,t){const[r,n]=this._findRS(t),i=n.redInvert(),s=r.redMuln(3).redMul(i);return null!=e?b._isomorphism(s,i,e):[s,i]}_edwards(e,t){const[r,n]=this._findRS(t),i=r.redMuln(3),s=n.redMuln(2),o=i.redAdd(s),a=i.redSub(s);return null!=e?g._isomorphism(o,a,e):[o,a]}_findRS(e){M(null==e||"boolean"==typeof e),M(this.h.word(0)>=4),M(!this.n.isZero());const t=this.one.redNeg();let r;for(;;){t.redIAdd(this.one);try{r=this.pointFromX(t)}catch(s){continue}if(r=r.mul(this.n),!r.isInfinity()&&r.y.isZero())break}const n=r.x,i=n.redSqr().redMuln(3).redIAdd(this.a).redSqrt();return null!=e&&i.redIsOdd()!==e&&i.redINeg(),[n,i]}_scale0(e,t){const r=this.a.redDiv(this.field(e)),n=this.b.redDiv(this.field(t)),i=r.redSqrt();r.redMul(i).eq(n)||i.redINeg(),M(r.redMul(i).eq(n));const s=i.redSqrt(),o=i.redMul(s);return M(!s.isZero()),[i,o]}_scale1(e,t){const r=this.g.x.redDiv(this.field(e)),n=this.g.y.redDiv(this.field(t)),i=r.redSqrt();return r.redMul(i).eq(n)||i.redINeg(),M(r.redMul(i).eq(n)),M(!i.isZero()),[r,n]}_scaleShort(e){return M(e instanceof l),this.g.isInfinity()||e.g.isInfinity()?this._scale0(e.a,e.b):this._scale1(e.g.x,e.g.y)}_scaleMont(e){if(M(e instanceof b),this.g.isInfinity()||e.g.isInfinity()){const[t,r]=e._short();return this._scale0(t,r)}const{x:t,y:r}=e.g,n=t.redAdd(e.a3).redMul(e.bi),i=r.redMul(e.bi);return this._scale1(n,i)}_scaleEdwards(e){if(M(e instanceof g),this.g.isInfinity()||e.g.isInfinity()){const[t,r]=e._short();return this._scale0(t,r)}const{x:t,y:r,z:n}=e.g,i=e.a.redMuln(5),s=e.d.redMuln(5),o=e.d.redSub(e.a),a=s.redSub(e.a),c=e.d.redSub(i),u=r.redAdd(n),f=r.redSub(n),h=a.redMul(r).redIAdd(c.redMul(n)),l=f.redMuln(12),d=o.redMul(u).redMul(n),p=f.redMul(t).redIMuln(4),b=l.redMul(p).redInvert(),y=h.redMul(p).redMul(b),m=d.redMul(l).redMul(b);return this._scale1(y,m)}_getEndomorphism(e=0){if(this.n.isZero()||this.g.isInfinity())return null;if(!this.zeroA||1!==this.p.modrn(3)||1!==this.n.modrn(3))return null;const[t,r]=this._getEndoRoots(this.p),n=[t,r][1&e].toRed(this.red),[i,s]=this._getEndoRoots(this.n),o=this.point(this.g.x.redMul(n),this.g.y);let a;this.g.mul(i).eq(o)?a=i:(M(this.g.mul(s).eq(o)),a=s);const c=this._getEndoBasis(a),u=this._getEndoPrecomp(c);return new I(n,a,c,u)}_getEndoRoots(e){const t=e===this.p?this.red:i.mont(e),r=new i(2).toRed(t),n=new i(3).toRed(t),s=r.redInvert(),o=n.redNeg().redSqrt().redMul(s),a=o.redNeg();return[o.redSub(s).fromRed(),a.redSub(s).fromRed()].sort(i.cmp)}_getEndoBasis(e){const[t,r,n,i,s,o]=this._egcdSqrt(e),a=n,c=i.neg(),u=t.sqr().iadd(r.sqr()),f=s.sqr().iadd(o.sqr());let h,l;return u.cmp(f)<=0?(h=t,l=r.neg()):(h=s,l=o.neg()),[new T(a,c),new T(h,l)]}_egcdSqrt(e){M(e instanceof i),M(!e.red),M(e.sign()>0),M(this.n.sign()>0);const t=this.n.ushrn(this.n.bitLength()>>>1);let r,n,s,o,a,c=e,u=this.n.clone(),f=new i(1),h=new i(0),l=new i(0),d=new i(1),p=0,b=0;for(;!c.isZero()&&p<2;){const e=u.quo(c),i=u.sub(e.mul(c)),y=l.sub(e.mul(f)),m=d.sub(e.mul(h));0===b&&i.cmp(t)<0&&(r=a,n=f,s=i,o=y,b=1),a=i,u=c,c=i,l=f,f=y,d=h,h=m,p+=b}M(0!==b,"Could not find r < sqrt(n).");return[r,n,s,o,l,f]}_getEndoPrecomp(e){M(Array.isArray(e)),M(2===e.length),M(e[0]instanceof T),M(e[1]instanceof T);const[t,r]=e,n=t.a.mul(r.b).isub(t.b.mul(r.a)),s=n.bitLength()+16,o=i.shift(1,s),a=o.mul(r.b).divRound(n),c=o.mul(t.b).divRound(n);return M(n.eq(this.n)),[a,c]}_endoSplit(e){M(e instanceof i),M(!e.red),M(!this.n.isZero());const[t,r]=this.endo.basis,n=r.b.mul(e).divRound(this.n),s=t.b.neg().mul(e).divRound(this.n),o=n.mul(t.a),a=s.mul(r.a),c=n.ineg().mul(t.b),u=s.mul(r.b);return[e.sub(o).isub(a),c.isub(u)]}_endoBeta(e){return M(e instanceof d),[e,e._getBeta()]}_endoWnafMulAdd(e,t){M(Array.isArray(e)),M(Array.isArray(t)),M(e.length===t.length),M(null!=this.endo);const r=e.length,n=new Array(2*r),i=new Array(2*r);for(let s=0;s<r;s++){const[r,o]=this._endoBeta(e[s]),[a,c]=this._endoSplit(t[s]);n[2*s+0]=r,i[2*s+0]=a,n[2*s+1]=o,i[2*s+1]=c}return this._wnafMulAdd(4,n,i)}_icart(e){const{a:t,b:r,i3:n,one:i}=this,s=n.redSqr().redMul(n),o=this.p.ushln(1).isubn(1).idivn(3),a=e.clone();a.cinject(i,a.czero());const c=a.redSqr(),u=c.redSqr(),f=u.redMul(c),h=a.redMuln(6).redFermat(),l=t.redMuln(3).redISub(u).redMul(h),d=l.redSqr(),p=f.redMul(s),b=c.redMul(n),y=d.redISub(r).redISub(p).redPow(o).redIAdd(b),m=a.redMul(y).redIAdd(l);return this.point(y,m)}_sswu(e){const{b:t,z:r,ai:n,zi:i,one:s}=this,o=this.p.subn(2),a=r.redSqr(),c=t.redNeg().redMul(n),u=t.redMul(i).redMul(n),f=e.redSqr(),h=f.redSqr(),l=a.redMul(h).redIAdd(r.redMul(f)).redPow(o),d=c.redMul(s.redAdd(l));d.cinject(u,l.czero());const p=r.redMul(f).redMul(d),b=this.solveY2(d),y=this.solveY2(p),m=0|b.redIsSquare(),g=d.cinject(p,1^m),v=b.cinject(y,1^m).redSqrt();return v.cinject(v.redNeg(),v.redIsOdd()^e.redIsOdd()),this.point(g,v)}_sswui(e,t){const{a:r,b:n,z:i}=this,{x:s,y:o}=e,a=3&t,c=r.redSqr().redMul(s.redSqr()),u=r.redMul(n).redMul(s).redIMuln(2),f=n.redSqr().redMuln(3),h=r.redMul(s).redIAdd(n),[l,d]=N(c.redISub(u).redISub(f)),p=h.redSub(d).redINeg(),b=h.redAdd(d).redINeg(),y=h.redMul(i).redIMuln(2),m=n.redMul(i).redIMuln(2);p.cinject(b,1&a),y.cinject(m,a>>>1);const[g,v]=P(p,y);if(v.cinject(v.redNeg(),v.redIsOdd()^o.redIsOdd()),!(l&g))throw new Error("Invalid point.");return v}_svdwf(e){const{c:t,z:r,zi:n,i2:i,i3:s}=this,o=this.p.subn(2),a=this.solveY2(r),c=s.redMul(n.redSqr()),u=e.redSqr(),f=u.redSqr(),h=u.redAdd(a),l=u.redMul(h).redPow(o),d=f.redMul(l).redMul(t),p=h.redSqr().redMul(h),b=t.redSub(r).redMul(i).redISub(d),y=d.redSub(t.redAdd(r).redMul(i)),m=r.redSub(p.redMul(l).redMul(c)),g=this.solveY2(b),v=this.solveY2(y),w=this.solveY2(m),_=0|g.redIsSquare(),E=0|v.redIsSquare();return b.cinject(y,(1^_)&E),g.cinject(v,(1^_)&E),b.cinject(m,(1^_)&(1^E)),g.cinject(w,(1^_)&(1^E)),[b,g]}_svdw(e){const[t,r]=this._svdwf(e),n=r.redSqrt();return n.cinject(n.redNeg(),n.redIsOdd()^e.redIsOdd()),this.point(t,n)}_svdwi(e,t){const{b:r,c:n,z:i,two:s}=this,{x:o,y:a}=e,c=3&t,u=i.redSqr(),f=u.redMul(i),h=u.redSqr(),l=f.redAdd(r),d=l.redMuln(2),p=o.redSqr(),b=o.redMuln(2).redIAdd(i),y=o.redMul(u),m=n.redSub(b),g=n.redAdd(b),v=p.redMul(u).redIAdd(h).redIMuln(9),w=o.redMul(f).redIMuln(18),_=l.redMul(o.redSub(i)).redIMuln(12),[E,k]=N(v.redISub(w).redIAdd(_)),S=c-2>>>31|E,A=k.redMul(i),I=f.redISub(y).redIMuln(3).redISub(d),T=l.redMul(m),R=l.redMul(g),x=I.redAdd(A),C=I.redSub(A),B=s.clone();T.cinject(R,(1^c)-1>>>31),T.cinject(x,(2^c)-1>>>31),T.cinject(C,(3^c)-1>>>31),B.cinject(g,(0^c)-1>>>31),B.cinject(m,(1^c)-1>>>31);const[M,O]=P(T,B),[D]=this._svdwf(O),L=D.ceq(o);if(O.cinject(O.redNeg(),O.redIsOdd()^a.redIsOdd()),!(S&M&L))throw new Error("Invalid point.");return O}isElliptic(){const{a:e,b:t}=this,r=e.redSqr().redMul(e);return!t.redSqr().redMuln(27).redIAdd(r.redMuln(4)).isZero()}jinv(){const{a:e,b:t}=this,r=e.redSqr().redMul(e),n=t.redSqr(),i=r.redMuln(4),s=i.redMuln(1728),o=n.redMuln(27).redIAdd(i);if(o.isZero())throw new Error("Curve is not elliptic.");return s.redDiv(o).fromRed()}point(e,t,r=0){return new d(this,e,t,r)}jpoint(e,t,r){return new p(this,e,t,r)}solveY2(e){M(e instanceof i);const t=e.redSqr().redMul(e).redIAdd(this.b);return this.zeroA||(this.threeA?t.redIAdd(e.redMuln(-3)):t.redIAdd(this.a.redMul(e))),t}validate(e){if(M(e instanceof d),e.inf)return!0;const{x:t,y:r}=e,n=this.solveY2(t);return r.redSqr().eq(n)}pointFromX(e,t=null){M(e instanceof i),M(null==t||"boolean"==typeof t),e.red||(e=e.toRed(this.red));const r=this.solveY(e);return null!=t&&r.redIsOdd()!==t&&r.redINeg(),this.point(e,r)}isIsomorphic(e){if(M(e instanceof f),!e.p.eq(this.p))return!1;let t,r;try{[t,r]=this._scale(e)}catch(n){return!1}if("short"===e.type){const n=this.field(e.a).redMul(t.redSqr()),i=this.field(e.b).redMul(r.redSqr());return this.a.eq(n)&&this.b.eq(i)}if("mont"===e.type){const{a3:r,bi:n}=e,i=this.field(r.redMul(n)).redMul(t);return this.solveY2(i).isZero()}if("edwards"===e.type){const r=this.field(e.ad6).redMul(t);return this.solveY2(r).isZero()}return!1}isIsogenous(e){return M(e instanceof f),!1}pointFromShort(e){if(M(e instanceof d),this.isIsomorphic(e.curve)){if(e.isInfinity())return this.point();const[t,r]=this._scale(e.curve),n=this.field(e.x),i=this.field(e.y),s=n.redMul(t),o=i.redMul(r);return this.point(s,o)}throw new Error("Not implemented.")}pointFromMont(e){if(M(e instanceof y),this.isIsomorphic(e.curve)){if(e.isInfinity())return this.point();const{a3:t,bi:r}=e.curve,[n,i]=this._scale(e.curve),s=e.x.redAdd(t).redMul(r),o=e.y.redMul(r);return this.point(this.field(s).redMul(n),this.field(o).redMul(i))}throw new Error("Not implemented.")}pointFromEdwards(e){if(M(e instanceof v),this.isIsomorphic(e.curve)){const{a:t,d:r,ad6:n}=e.curve,[i,s]=this._scale(e.curve);if(e.isInfinity())return this.point();if(e.x.isZero()){const e=this.field(n).redMul(i);return this.point(e,this.zero)}const{x:o,y:a,z:c}=e,u=t.redMuln(5),f=r.redMuln(5),h=r.redSub(t),l=f.redSub(t),d=r.redSub(u),p=a.redAdd(c),b=a.redSub(c),y=l.redMul(a).redIAdd(d.redMul(c)),m=b.redMuln(12),g=h.redMul(p).redMul(c),v=b.redMul(o).redIMuln(4);return this.cpoint(this.field(y).redMul(i),this.field(m),this.field(g).redMul(s),this.field(v))}throw new Error("Not implemented.")}pointFromUniform(e){if(M(e instanceof i),this.z.isZero()||this.b.isZero())throw new Error("Not implemented.");if(!this.a.isZero())return this._sswu(e);if(!this.c.isZero())return this._svdw(e);throw new Error("Not implemented.")}pointToUniform(e,t){if(M(e instanceof d),M(t>>>0===t),this.z.isZero()||this.b.isZero())throw new Error("Not implemented.");if(e.isInfinity())throw new Error("Invalid point.");const r=(t>>>4&15)%this.torsion.length,n=e.add(this.torsion[r]);if(!this.a.isZero())return this._sswui(n,t);if(!this.c.isZero())return this._svdwi(n,t);throw new Error("Not implemented.")}mulAll(e,t){return super.mulAll(e,t).toP()}mulAllSimple(e,t){return super.mulAllSimple(e,t).toP()}decodePoint(e){return d.decode(this,e)}encodeX(e){return M(e instanceof h),e.encodeX()}decodeEven(e){return d.decodeEven(this,e)}decodeSquare(e){return d.decodeSquare(this,e)}toShort(e,t,r=null){const[n,i]=this._short(e,t),s=new l({red:this.red,prime:this.prime,p:this.p,a:n,b:i,n:this.n,h:this.h});if(null!=r){const[,e]=s._scale(this);e.redIsOdd()!==r&&e.redINeg()}this.g.isInfinity()||(s.g=s.pointFromShort(this.g));for(let o=0;o<this.h;o++)s.torsion[o]=s.pointFromShort(this.torsion[o]);return s}toMont(e,t,r=null){const[n,i]=this._mont(e,t),s=new b({red:this.red,prime:this.prime,p:this.p,a:n,b:i,n:this.n,h:this.h});if(null!=r){const[,e]=this._scale(s);e.redIsOdd()!==r&&e.redINeg()}this.g.isInfinity()||(s.g=s.pointFromShort(this.g));for(let o=0;o<this.h;o++)s.torsion[o]=s.pointFromShort(this.torsion[o]);return s}toEdwards(e,t,r=null){const[n,i]=this._edwards(e,t),s=new g({red:this.red,prime:this.prime,p:this.p,a:n,d:i,n:this.n,h:this.h});if(null!=r){const[,e]=this._scale(s);e.redIsOdd()!==r&&e.redINeg()}if(this.g.isInfinity()||(s.g=s.pointFromShort(this.g),s.g.normalize()),s.isComplete())for(let o=0;o<this.h;o++)s.torsion[o]=s.pointFromShort(this.torsion[o]),s.torsion[o].normalize();return s}pointFromJSON(e){return d.fromJSON(this,e)}toJSON(e){const t=super.toJSON(e);return t.a=this.a.fromRed().toJSON(),t.b=this.b.fromRed().toJSON(),this.c.isZero()||(t.c=this.c.fromRed().toJSON()),t}}class d extends h{constructor(e,t,r,n){M(e instanceof l),super(e,s),this.x=this.curve.zero,this.y=this.curve.zero,this.inf=1,null!=t&&this._init(t,r,n)}_init(e,t,r){M(e instanceof i),M(t instanceof i),this.x=e,this.y=t,this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=0|r}_safeNAF(e){return M(e>>>0===e),this.pre&&this.pre.naf?this.pre.naf:e>1?this.toJ()._getNAF(e):this._getNAF(e)}_getBeta(){if(!this.curve.endo)return null;if(this.pre&&this.pre.beta)return this.pre.beta;const e=this.x.redMul(this.curve.endo.beta),t=this.curve.point(e,this.y);return this.pre&&(t.pre=this.pre.map(e=>{const t=e.x.redMul(this.curve.endo.beta);return this.curve.point(t,e.y)}),this.pre.beta=t),t}_getJNAF(e){if(M(e instanceof d),this.inf|e.inf)return super._getJNAF(e);const t=[this,null,null,e];return this.y.eq(e.y)?(t[1]=this.add(e),t[2]=this.toJ().sub(e)):this.y.eq(e.y.redNeg())?(t[1]=this.toJ().add(e),t[2]=this.sub(e)):(t[1]=this.toJ().add(e),t[2]=this.toJ().sub(e)),t}clone(){return this.curve.point(this.x.clone(),this.y.clone(),this.inf)}swap(e,t){M(e instanceof d);const r=1&(t>>31|-t>>31),n=this.inf,i=e.inf;return this.x.cswap(e.x,t),this.y.cswap(e.y,t),this.inf=n&(1^r)|i&r,e.inf=i&(1^r)|n&r,this}scale(e){return this.toJ().scale(e)}neg(){return this.inf?this:this.curve.point(this.x,this.y.redNeg())}add(e){if(M(e instanceof d),this.inf)return e;if(e.inf)return this;if(this.x.eq(e.x))return this.y.eq(e.y)?this.dbl():this.curve.point();if(this.y.eq(e.y)){const t=this.x.redNeg().redISub(e.x),r=this.y.redNeg();return this.curve.point(t,r)}const t=this.x.redSub(e.x),r=this.y.redSub(e.y).redDiv(t),n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)}dbl(){if(this.inf)return this;if(this.y.isZero())return this.curve.point();const e=this.x.redSqr().redIMuln(3).redIAdd(this.curve.a),t=this.y.redMuln(2),r=e.redDiv(t),n=r.redSqr().redISub(this.x).redISub(this.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)}dblp(e){return this.toJ().dblp(e).toP()}uadd(e){M(e instanceof d);const t=this.y.redAdd(e.y),r=this.x.redAdd(e.x).redSqr(),n=this.x.redMul(e.x),i=r.redISub(n).redIAdd(this.curve.a),s=t.czero()&i.czero();t.cinject(this.x.redSub(e.x),s),i.cinject(this.y.redSub(e.y),s);const o=t.czero()&(1^(this.inf|e.inf));t.cinject(this.curve.one,t.czero());const a=i.redMul(t.redFermat()),c=a.redSqr().redISub(this.x).redISub(e.x),u=a.redMul(this.x.redSub(c)).redISub(this.y),f=o|this.inf&e.inf;return c.cinject(e.x,this.inf),u.cinject(e.y,this.inf),c.cinject(this.x,e.inf),u.cinject(this.y,e.inf),c.cinject(this.curve.zero,f),u.cinject(this.curve.zero,f),this.curve.point(c,u,f)}udbl(){return this.uadd(this)}recover(e,t,r,n){if(M(e instanceof i),M(t instanceof i),M(r instanceof i),M(n instanceof i),this.inf)return this.curve.jpoint();const s=t.redMul(n),o=s.redSqr(),a=o.redMul(s),c=this.x.redMul(s),u=e.redMul(n),f=r.redMul(t),h=this.curve.b.redMul(a).redIMuln(2),l=c.redMul(u).redIAdd(this.curve.a.redMul(o)),d=c.redAdd(u),p=c.redISub(u),b=h.redIAdd(l.redMul(d)),y=f.redMul(p.redSqr()),m=b.redISub(y),g=this.y.redMul(a).redIMuln(2),v=e.redMul(g),w=m.redMul(t),_=t.redMul(g),E=v.redMul(_),k=w.redMul(_.redSqr()),S=_;return this.curve.jpoint(E,k,S)}getX(){if(this.inf)throw new Error("Invalid point.");return this.x.fromRed()}getY(){if(this.inf)throw new Error("Invalid point.");return this.y.fromRed()}eq(e){return M(e instanceof d),this===e||(this.inf?0!==e.inf:!e.inf&&(this.x.eq(e.x)&&this.y.eq(e.y)))}isInfinity(){return 0!==this.inf}isOdd(){return!this.inf&&this.y.redIsOdd()}isEven(){return!this.inf&&this.y.redIsEven()}isSquare(){return!this.inf&&-1!==this.y.redJacobi()}eqX(e){return M(e instanceof i),M(!e.red),!this.inf&&this.getX().eq(e)}eqXToP(e){return M(e instanceof i),M(!e.red),M(!this.curve.n.isZero()),!this.inf&&this.getX().imod(this.curve.n).eq(e)}mul(e){return super.mul(e).toP()}muln(e){return super.muln(e).toP()}mulSimple(e){return super.mulSimple(e).toP()}mulBlind(e,t){return super.mulBlind(e,t).toP()}mulConst(e,t){return super.mulConst(e,t).toP()}mulAdd(e,t,r){return super.mulAdd(e,t,r).toP()}mulAddSimple(e,t,r){return super.mulAddSimple(e,t,r).toP()}mulH(){return super.mulH().toP()}div(e){return super.div(e).toP()}divn(e){return super.divn(e).toP()}divH(){return super.divH().toP()}toP(){return this}toJ(){return this.inf?this.curve.jpoint():this.curve.jpoint(this.x,this.y,this.curve.one)}encode(t){null==t&&(t=!0),M("boolean"==typeof t);const{fieldSize:r}=this.curve;if(this.inf)throw new Error("Invalid point.");if(t){const t=e.allocUnsafe(1+r),n=this.curve.encodeField(this.getX());return t[0]=2|this.y.redIsOdd(),n.copy(t,1),t}const n=e.allocUnsafe(1+2*r),i=this.curve.encodeField(this.getX()),s=this.curve.encodeField(this.getY());return n[0]=4,i.copy(n,1),s.copy(n,1+r),n}static decode(t,r){M(t instanceof l),M(e.isBuffer(r));const n=t.fieldSize;if(r.length<1+n)throw new Error("Not a point.");const i=r[0];switch(i){case 2:case 3:{if(r.length!==1+n)throw new Error("Invalid point size for compressed.");const e=t.decodeField(r.slice(1,1+n));if(e.cmp(t.p)>=0)throw new Error("Invalid point.");const s=t.pointFromX(e,3===i);return M(!s.isInfinity()),s}case 4:case 6:case 7:{if(r.length!==1+2*n)throw new Error("Invalid point size for uncompressed.");const e=t.decodeField(r.slice(1,1+n)),s=t.decodeField(r.slice(1+n,1+2*n));if(e.cmp(t.p)>=0||s.cmp(t.p)>=0)throw new Error("Invalid point.");if(4!==i&&i!==(6|s.isOdd()))throw new Error("Invalid hybrid encoding.");const o=t.point(e,s);if(!o.validate())throw new Error("Invalid point.");return M(!o.isInfinity()),o}default:throw new Error("Unknown point format.")}}encodeX(){return this.curve.encodeField(this.getX())}static decodeEven(e,t){M(e instanceof l);const r=e.decodeField(t);if(r.cmp(e.p)>=0)throw new Error("Invalid point.");return e.pointFromX(r,!1)}static decodeSquare(e,t){M(e instanceof l);const r=e.decodeField(t);if(r.cmp(e.p)>=0)throw new Error("Invalid point.");return e.pointFromX(r)}toJSON(e){if(this.inf)return[];const t=this.getX().toJSON(),r=this.getY().toJSON();return!0===e&&this.pre?[t,r,this.pre.toJSON()]:[t,r]}static fromJSON(e,t){if(M(e instanceof l),M(Array.isArray(t)),M(0===t.length||2===t.length||3===t.length),0===t.length)return e.point();const r=i.fromJSON(t[0]),n=i.fromJSON(t[1]),s=e.point(r,n);return t.length>2&&null!=t[2]&&(s.pre=_.fromJSON(s,t[2])),s}[n](){return this.inf?"<ShortPoint: Infinity>":"<ShortPoint: x="+this.x.fromRed().toString(16,2)+" y="+this.y.fromRed().toString(16,2)+">"}}class p extends h{constructor(e,t,r,n){M(e instanceof l),super(e,o),this.x=this.curve.one,this.y=this.curve.one,this.z=this.curve.zero,this.zOne=0,null!=t&&this._init(t,r,n)}_init(e,t,r){M(e instanceof i),M(t instanceof i),M(null==r||r instanceof i),this.x=e,this.y=t,this.z=r||this.curve.one,this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=0|this.z.eq(this.curve.one)}clone(){return this.curve.jpoint(this.x.clone(),this.y.clone(),this.z.clone())}swap(e,t){M(e instanceof p);const r=1&(t>>31|-t>>31),n=this.zOne,i=e.zOne;return this.x.cswap(e.x,t),this.y.cswap(e.y,t),this.z.cswap(e.z,t),this.zOne=n&(1^r)|i&r,e.zOne=i&(1^r)|n&r,this}validate(){const{a:e,b:t}=this.curve;if(this.isInfinity())return!0;if(this.zOne)return this.curve.validate(this.toP());const r=this.y.redSqr(),n=this.x.redSqr().redMul(this.x),i=this.z.redSqr(),s=i.redSqr(),o=s.redMul(i),a=n.redIAdd(t.redMul(o));return this.curve.zeroA||(this.curve.threeA?a.redIAdd(s.redIMuln(-3).redMul(this.x)):a.redIAdd(e.redMul(s).redMul(this.x))),r.eq(a)}normalize(){if(this.zOne)return this;if(this.isInfinity())return this;const e=this.z.redInvert(),t=e.redSqr();return this.x=this.x.redMul(t),this.y=this.y.redMul(t).redMul(e),this.z=this.curve.one,this.zOne=1,this}scale(e){if(M(e instanceof i),this.isInfinity())return this.curve.jpoint();const t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e),s=this.z.redMul(e);return this.curve.jpoint(r,n,s)}neg(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)}add(e){return M(e instanceof h),e.type===s?this._mixedAdd(e):this._add(e)}_add(e){return M(e instanceof p),this.isInfinity()?e:e.isInfinity()?this:this.zOne&&e.zOne?this._addAA(e):this.zOne?e._addJA(this):e.zOne?this._addJA(e):this._addJJ(e)}_mixedAdd(e){return M(e instanceof d),this.isInfinity()?e.toJ():e.isInfinity()?this:this.zOne?this._addAA(e):this._addJA(e)}_addJJ(e){const t=this.z.redSqr(),r=e.z.redSqr(),n=this.x.redMul(r),i=e.x.redMul(t),s=this.y.redMul(e.z).redMul(r),o=e.y.redMul(this.z).redMul(t),a=i.redISub(n),c=o.redISub(s);if(a.isZero())return c.isZero()?this.dbl():this.curve.jpoint();const u=a.redSqr(),f=a.redMul(u),h=n.redMul(u),l=c.redSqr().redISub(f).redISub(h).redISub(h),d=c.redMul(h.redISub(l)).redISub(s.redMul(f)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(l,d,p)}_addJA(e){const t=this.z.redSqr(),r=e.x.redMul(t),n=e.y.redMul(this.z).redMul(t),i=r.redISub(this.x),s=n.redISub(this.y).redIMuln(2);if(i.isZero())return s.isZero()?this.dbl():this.curve.jpoint();const o=i.redMuln(2).redSqr(),a=i.redMul(o),c=this.x.redMul(o),u=s.redSqr().redISub(a).redISub(c).redISub(c),f=s.redMul(c.redISub(u)).redISub(this.y.redMul(a).redIMuln(2)),h=this.z.redMul(i).redIMuln(2);return this.curve.jpoint(u,f,h)}_addAA(e){const t=e.x.redSub(this.x),r=e.y.redSub(this.y).redIMuln(2);if(t.isZero())return r.isZero()?this.dbl():this.curve.jpoint();const n=t.redSqr().redIMuln(4),i=t.redMul(n),s=this.x.redMul(n),o=r.redSqr().redISub(i).redISub(s).redISub(s),a=r.redMul(s.redISub(o)).redISub(this.y.redMul(i).redIMuln(2)),c=t.redIMuln(2);return this.curve.jpoint(o,a,c)}dbl(){return this.isInfinity()?this:this.y.isZero()?this.curve.jpoint():this.zOne?this._dblA():this.curve.zeroA?this._dbl0():this.curve.threeA?this._dbl3():this._dblJ()}_dblJ(){const e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t).redIMuln(4),i=e.redIMuln(3).redIAdd(this.curve.a.redMul(r.redSqr())),s=i.redSqr().redISub(n).redISub(n),o=s,a=i.redMul(n.redISub(s)).redISub(t.redSqr().redIMuln(8)),c=this.y.redMul(this.z).redIMuln(2);return this.curve.jpoint(o,a,c)}_dblA(){const e=this.x.redSqr(),t=this.y.redSqr(),r=t.redSqr(),n=t.redIAdd(this.x).redSqr().redISub(e).redISub(r).redIMuln(2),i=e.redIMuln(3).redIAdd(this.curve.a),s=i.redSqr().redISub(n).redISub(n),o=s,a=i.redMul(n.redISub(s)).redISub(r.redIMuln(8)),c=this.y.redMuln(2);return this.curve.jpoint(o,a,c)}_dbl0(){const e=this.x.redSqr(),t=this.y.redSqr(),r=t.redSqr(),n=t.redIAdd(this.x).redSqr().redISub(e).redISub(r).redIMuln(2),i=e.redIMuln(3),s=i.redSqr().redISub(n).redISub(n),o=i.redMul(n.redISub(s)).redISub(r.redIMuln(8)),a=this.y.redMul(this.z).redIMuln(2);return this.curve.jpoint(s,o,a)}_dbl3(){const e=this.z.redSqr(),t=this.y.redSqr(),r=this.x.redMul(t),n=this.x.redSub(e),i=this.x.redAdd(e),s=n.redMul(i).redIMuln(3),o=r.redIMuln(4),a=o.redMuln(2),c=t.redSqr().redIMuln(8),u=s.redSqr().redISub(a),f=this.y.redAdd(this.z).redSqr().redISub(t).redISub(e),h=s.redMul(o.redISub(u)).redISub(c);return this.curve.jpoint(u,h,f)}dblp(e){return M(e>>>0===e),this.curve.zeroA||this.curve.threeA?super.dblp(e):0===e||this.isInfinity()?this:this._dblp(e)}_dblp(e){const{a:t,i2:r}=this.curve;let n=this.x,i=this.z,s=this.y.redMuln(2),o=i.redPown(4);for(let a=0;a<e;a++){if(s.isZero())return this.curve.jpoint();const r=n.redSqr(),c=s.redSqr(),u=c.redSqr(),f=r.redIMuln(3).redIAdd(t.redMul(o)),h=n.redMul(c),l=f.redSqr().redISub(h).redISub(h),d=l,p=f.redMul(h.redISub(l)).redIMuln(2).redISub(u),b=s.redMul(i);a+1<e&&(o=o.redMul(u)),n=d,s=p,i=b}return this.curve.jpoint(n,s.redMul(r),i)}uadd(e){return M(e instanceof h),e.type===s?this._uadd(e.toJ()):this._uadd(e)}_uadd(e){M(e instanceof p);const{zero:t,one:r}=this.curve,n=this.z.redSqr(),i=e.z.redSqr(),s=this.x.redMul(i),o=e.x.redMul(n),a=this.y.redMul(i).redMul(e.z),c=e.y.redMul(n).redMul(this.z),u=this.z.redMul(e.z),f=s.redAdd(o),h=a.redAdd(c),l=f.redSqr().redISub(s.redMul(o));if(!this.curve.zeroA){const e=u.redPown(4);this.curve.threeA?l.redIAdd(e.redIMuln(-3)):l.redIAdd(this.curve.a.redMul(e))}const d=h.czero()&l.czero();h.cinject(s.redSub(o),d),l.cinject(a.redSub(c),d);const b=h.redSqr(),y=f.redMul(b),m=b.redSqr();m.cinject(t,d);const g=l.redSqr(),v=u.redMul(h),w=y.redMuln(3).redISub(g).redISub(g),_=g.redISub(y).redIMuln(4),E=l.redMul(w).redISub(m).redIMuln(4),k=v.redIMuln(2),S=this.z.czero(),A=e.z.czero(),I=k.czero()&(1^(S|A));return _.cinject(e.x,S),E.cinject(e.y,S),k.cinject(e.z,S),_.cinject(this.x,A),E.cinject(this.y,A),k.cinject(this.z,A),_.cinject(r,I),E.cinject(r,I),k.cinject(t,I),this.curve.jpoint(_,E,k)}udbl(){const e=this._udbl(),t=this.z.czero()|this.y.czero();return e.x.cinject(this.curve.one,t),e.y.cinject(this.curve.one,t),e.z.cinject(this.curve.zero,t),e}_udbl(){return this.curve.zeroA?this._dbl0():this.curve.threeA?this._dbl3():this._dblJ()}zaddu(e){M(e instanceof p);const t=this.x.redSub(e.x),r=this.y.redSub(e.y),n=t.redSqr(),i=this.x.redMul(n),s=e.x.redMul(n),o=i,a=r.redSqr().redISub(i).redISub(s),c=this.y.redMul(i.redSub(s)),u=r.redMul(o.redSub(a)).redISub(c),f=this.z.redMul(t),h=f;return[this.curve.jpoint(a,u,h),this.curve.jpoint(o,c,f)]}zaddc(e){M(e instanceof p);const t=this.x.redSub(e.x),r=this.y.redSub(e.y),n=this.y.redAdd(e.y),i=t.redSqr(),s=this.x.redMul(i),o=e.x.redMul(i),a=n.redSqr().redISub(s).redISub(o),c=r.redSqr().redISub(s).redISub(o),u=this.y.redMul(o.redISub(s)),f=e.y.redMuln(2).redIAdd(r),h=s.redISub(a),l=a.redAdd(h).redISub(c),d=f.redMul(h).redIAdd(u),b=r.redMul(l).redIAdd(u),y=this.z.redMul(t),m=y;return[this.curve.jpoint(c,b,m),this.curve.jpoint(a,d,y)]}zdblu(){const e=this.x.redSqr(),t=this.y.redSqr(),r=t.redSqr(),n=this.x.redAdd(t).redSqr(),i=e.redMuln(3);if(!this.curve.zeroA){const e=this.z.redPown(4);this.curve.threeA?i.redIAdd(e.redIMuln(-3)):i.redIAdd(this.curve.a.redMul(e))}const s=n.redISub(e).redISub(r).redIMuln(2),o=i.redSqr().redISub(s).redISub(s),a=r.redIMuln(8),c=s.redSub(o).redMul(i).redISub(a),u=this.y.redMul(this.z).redIMuln(2),f=u;return[this.curve.jpoint(o,c,f),this.curve.jpoint(s,a,u)]}recover(e,t,r,n){return this.toP().recover(e,t,r,n)}getX(){if(this.isInfinity())throw new Error("Invalid point.");return this.normalize(),this.x.fromRed()}getY(){if(this.isInfinity())throw new Error("Invalid point.");return this.normalize(),this.y.fromRed()}eq(e){if(M(e instanceof p),this===e)return!0;if(this.isInfinity())return e.isInfinity();if(e.isInfinity())return!1;if(this.z.eq(e.z))return this.x.eq(e.x)&&this.y.eq(e.y);const t=this.z.redSqr(),r=e.z.redSqr(),n=this.x.redMul(r),i=e.x.redMul(t);if(!n.eq(i))return!1;const s=t.redMul(this.z),o=r.redMul(e.z),a=this.y.redMul(o),c=e.y.redMul(s);return a.eq(c)}isInfinity(){return this.z.isZero()}isOdd(){return!this.isInfinity()&&(this.normalize(),this.y.redIsOdd())}isEven(){return!this.isInfinity()&&(this.normalize(),this.y.redIsEven())}isSquare(){return!this.isInfinity()&&-1!==this.y.redMul(this.z).redJacobi()}eqX(e){if(M(e instanceof i),M(!e.red),this.isInfinity())return!1;const t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);return this.x.eq(r)}eqXToP(e){if(M(e instanceof i),M(!e.red),!this.curve.smallGap)return this.toP().eqXToP(e);if(this.isInfinity())return!1;if(e.cmp(this.curve.p)>=0)return!1;const t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(this.x.eq(r))return!0;if(this.curve.highOrder)return!1;if(e.cmp(this.curve.pmodn)>=0)return!1;const n=this.curve.redN.redMul(t);return r.redIAdd(n),this.x.eq(r)}toP(){return this.isInfinity()?this.curve.point():(this.normalize(),this.curve.point(this.x,this.y))}toJ(){return this}encode(e){return this.toP().encode(e)}static decode(e,t){return d.decode(e,t).toJ()}encodeX(){return this.toP().encodeX()}static decodeEven(e,t){return d.decodeEven(e,t).toJ()}static decodeSquare(e,t){return d.decodeSquare(e,t).toJ()}toJSON(e){return this.toP().toJSON(e)}static fromJSON(e,t){return d.fromJSON(e,t).toJ()}[n](){return this.isInfinity()?"<JPoint: Infinity>":"<JPoint: x="+this.x.fromRed().toString(16,2)+" y="+this.y.fromRed().toString(16,2)+" z="+this.z.fromRed().toString(16,2)+">"}}class b extends f{constructor(e){super(y,"mont",e),this.a=i.fromJSON(e.a).toRed(this.red),this.b=i.fromJSON(e.b).toRed(this.red),this.bi=this.b.redInvert(),this.a2=this.a.redAdd(this.two),this.a24=this.a2.redMul(this.i4),this.a3=this.a.redMul(this.i3),this.a0=this.a.redMul(this.bi),this.b0=this.bi.redSqr(),this._finalize(e)}static _isomorphism(e,t,r){M(e instanceof i),M(t instanceof i),M(r instanceof i);const n=e.clone(),s=r.clone();if(1!==t.redDiv(r).redJacobi())throw new Error("Invalid `b` coefficient.");return[n,s]}_short(e,t){const{a:r,b:n,three:i}=this,s=r.redSqr(),o=s.redMul(r),a=n.redSqr(),c=a.redMul(n),u=i.redSub(s),f=a.redMuln(3),h=o.redMuln(2).redISub(r.redMuln(9)),d=c.redMuln(27),p=u.redDiv(f),b=h.redDiv(d);return null!=e?l._isomorphism(p,b,e,t):[p,b]}_mont(e){return b._isomorphism(this.a,this.b,e)}_edwards(e,t=!1){M("boolean"==typeof t);const{two:r,bi:n}=this,i=this.a.redAdd(r).redMul(n),s=this.a.redSub(r).redMul(n);return t&&i.swap(s),null!=e?g._isomorphism(i,s,e):[i,s]}_scaleShort(e){M(e instanceof l);const[t,r]=e._scale(this);return[this.field(t.redInvert()),this.field(r.redInvert())]}_scaleMont(e){return M(e instanceof b),this.g.isInfinity()||e.g.isInfinity()?this.field(e.b).redDivSqrt(this.b):this.g.y.redDiv(this.field(e.g.y))}_scaleEdwards(e,t){M(e instanceof g);const r=e._scale(this,t);return this.field(r)}_solveY0(e){M(e instanceof i);const t=this.a0,r=this.b0,n=e.redSqr();return n.redMul(e).redIAdd(t.redMul(n)).redIAdd(r.redMul(e))}_elligator2(e){const t=this.a0.redNeg(),r=this.one.redAdd(this.z.redMul(e.redSqr()));r.cinject(this.one,r.czero());const n=t.redMul(r.redFermat()),i=n.redNeg().redISub(this.a0),s=this._solveY0(n),o=this._solveY0(i),a=0|s.redIsSquare(),c=n.cinject(i,1^a),u=s.cinject(o,1^a).redSqrt();u.cinject(u.redNeg(),u.redIsOdd()^e.redIsOdd());const f=this.b.redMul(c),h=this.b.redMul(u);return this.point(f,h)}_invert2(e,t){const{x:r,y:n}=e,i=1&t,s=r.redMul(this.bi),o=n.redMul(this.bi),a=s.redAdd(this.a0),c=s;a.cswap(c,i);const u=a.redINeg(),f=c.redMul(this.z),[h,l]=P(u,f);if(l.cinject(l.redNeg(),l.redIsOdd()^o.redIsOdd()),!h)throw new Error("Invalid point.");return l}_constMul(e,t,r){M(e instanceof y);const n=e.toX(),[i,s]=n.ladderConst(t,r),o=e.recover(s,i);return t.isNeg()?o.neg():o}isElliptic(){const e=this.a.redSqr();return!this.b.redMul(e.redSub(this.four)).isZero()}jinv(){const{a:e,three:t,four:r}=this,n=e.redSqr(),i=n.redSub(t).redPown(3).redIMuln(256),s=n.redSub(r);if(s.isZero())throw new Error("Curve is not elliptic.");return i.redDiv(s).fromRed()}point(e,t,r=0){return new y(this,e,t,r)}jpoint(e,t,r){return M(null==e&&null==t&&null==r),this.point()}xpoint(e,t){return new m(this,e,t)}solveY2(e){M(e instanceof i);const t=e.redSqr();return t.redMul(e).redIAdd(this.a.redMul(t)).redIAdd(e).redMul(this.bi)}validate(e){if(M(e instanceof y),e.isInfinity())return!0;const{x:t,y:r}=e,n=this.solveY2(t);return r.redSqr().eq(n)}pointFromX(e,t=null){M(e instanceof i),M(null==t||"boolean"==typeof t),e.red||(e=e.toRed(this.red));const r=this.solveY(e);return null!=t&&r.redIsOdd()!==t&&r.redINeg(),this.point(e,r)}isIsomorphic(e,t){if(M(e instanceof f),!e.p.eq(this.p))return!1;if("mont"===e.type){const t=this.field(e.a),r=this.field(e.b);if(!this.a.eq(t))return!1;if(this.b.isZero())return!1;return 1===r.redDiv(this.b).redJacobi()}return e.isIsomorphic(this,t)}isIsogenous(e){return M(e instanceof f),"mont"!==e.type&&e.isIsogenous(this)}pointFromShort(e){if(M(e instanceof d),this.isIsomorphic(e.curve)){if(e.isInfinity())return this.point();const{a3:t,b:r}=this,[n,i]=this._scale(e.curve),s=this.field(e.x).redMul(n),o=this.field(e.y).redMul(i),a=r.redMul(s).redISub(t),c=r.redMul(o);return this.point(a,c)}throw new Error("Not implemented.")}pointFromMont(e){if(M(e instanceof y),this.isIsomorphic(e.curve)){if(e.isInfinity())return this.point();const t=this._scale(e.curve),r=this.field(e.x),n=this.field(e.y),i=r,s=t.redMul(n);return this.point(i,s)}throw new Error("Not implemented.")}pointFromEdwards(e){M(e instanceof v),M(e.curve.p.eq(this.p));const t=this.field(e.x),r=this.field(e.y),n=this.field(e.z);if(this.isIsogenous(e.curve)){if(e.isInfinity())return this.point();if(e.x.isZero())return this.point(this.zero,this.zero);const i=n.redSqr().redIMuln(2),s=r.redSqr(),o=t.redSqr(),a=i.redISub(o).redISub(s).redMul(r),c=o.redMul(t);return this.cpoint(s,o,a,c)}if(this.isIsomorphic(e.curve,!0)){if(e.isInfinity())return this.point();if(e.x.isZero())return this.point(this.zero,this.zero);const i=this._scale(e.curve,!0),s=r.redAdd(n),o=r.redSub(n),a=i.redMul(n).redMul(s),c=t.redMul(o);return this.cpoint(s,o,a,c)}if(this.isIsomorphic(e.curve,!1)){if(e.isInfinity())return this.point();if(e.x.isZero())return this.point(this.zero,this.zero);const i=this._scale(e.curve,!1),s=n.redAdd(r),o=n.redSub(r),a=i.redMul(n).redMul(s),c=t.redMul(o);return this.cpoint(s,o,a,c)}throw new Error("Not implemented.")}pointFromUniform(e){if(M(e instanceof i),this.z.isZero()||this.a.isZero())throw new Error("Not implemented.");return this._elligator2(e)}pointToUniform(e,t){if(M(e instanceof y),M(t>>>0===t),this.z.isZero()||this.a.isZero())throw new Error("Not implemented.");if(e.isInfinity())throw new Error("Invalid point.");const r=(t>>>4&15)%this.torsion.length,n=e.add(this.torsion[r]);return this._invert2(n,t)}decodePoint(e,t){return y.decode(this,e,t)}encodeX(e){return M(e instanceof m),e.encode()}decodeX(e){return m.decode(this,e)}toShort(e,t,r=null){const[n,i]=this._short(e,t),s=new l({red:this.red,prime:this.prime,p:this.p,a:n,b:i,n:this.n,h:this.h});if(null!=r){const[,e]=s._scale(this);e.redIsOdd()!==r&&e.redINeg()}this.g.isInfinity()||(s.g=s.pointFromMont(this.g));for(let o=0;o<this.h;o++)s.torsion[o]=s.pointFromMont(this.torsion[o]);return s}toMont(e,t=null){const[r,n]=this._mont(e),i=new b({red:this.red,prime:this.prime,p:this.p,a:r,b:n,n:this.n,h:this.h,z:this.z});if(null!=t){const e=i._scale(this);e.redIsOdd()!==t&&e.redINeg()}this.g.isInfinity()||(i.g=i.pointFromMont(this.g));for(let s=0;s<this.h;s++)i.torsion[s]=i.pointFromMont(this.torsion[s]);return i}toEdwards(e,t,r=null){const[n,i]=this._edwards(e,t),s=new g({red:this.red,prime:this.prime,p:this.p,a:n,d:i,n:this.n,h:this.h,z:this.z});if(null!=r){const e=s._scale(this,t);e.redIsOdd()!==r&&e.redINeg()}if(this.g.isInfinity()||(s.g=s.pointFromMont(this.g),s.g.normalize()),s.isComplete())for(let o=0;o<this.h;o++)s.torsion[o]=s.pointFromMont(this.torsion[o]),s.torsion[o].normalize();return s}pointFromJSON(e){return y.fromJSON(this,e)}toJSON(e){const t=super.toJSON(e);return t.a=this.a.fromRed().toJSON(),t.b=this.b.fromRed().toJSON(),t}}class y extends h{constructor(e,t,r,n){M(e instanceof b),super(e,s),this.x=this.curve.zero,this.y=this.curve.zero,this.inf=1,null!=t&&this._init(t,r,n)}_init(e,t,r){M(e instanceof i),M(t instanceof i),this.x=e,this.y=t,this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=0|r}clone(){return this.curve.point(this.x.clone(),this.y.clone(),this.inf)}swap(e,t){M(e instanceof y);const r=1&(t>>31|-t>>31),n=this.inf,i=e.inf;return this.x.cswap(e.x,t),this.y.cswap(e.y,t),this.inf=n&(1^r)|i&r,e.inf=i&(1^r)|n&r,this}scale(e){return this.clone()}randomize(e){return this.clone()}neg(){return this.inf?this:this.curve.point(this.x,this.y.redNeg())}add(e){if(M(e instanceof y),this.inf)return e;if(e.inf)return this;if(this.x.eq(e.x))return this.y.eq(e.y)?this.dbl():this.curve.point();const t=e.x.redSub(this.x),r=e.y.redSub(this.y).redDiv(t),n=this.curve.b.redMul(r.redSqr()).redISub(this.curve.a).redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)}dbl(){if(this.inf)return this;if(this.y.isZero())return this.curve.point();const e=this.x.redSqr().redIMuln(3),t=this.curve.a.redMul(this.x).redIMuln(2),r=e.redIAdd(t).redIAdd(this.curve.one),n=this.curve.b.redMul(this.y).redIMuln(2),i=r.redDiv(n),s=this.curve.b.redMul(i.redSqr()).redISub(this.curve.a).redISub(this.x).redISub(this.x),o=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)}uadd(e){M(e instanceof y);const t=e.x.redSub(this.x),r=e.y.redSub(this.y),n=this.x.redSqr().redIMuln(3),i=this.curve.a.redMul(this.x).redIMuln(2),s=n.redIAdd(i).redIAdd(this.curve.one),o=this.curve.b.redMul(this.y).redIMuln(2),a=t.czero()&r.czero();r.cinject(s,a),t.cinject(o,a);const c=t.czero()&(1^(this.inf|e.inf));t.cinject(this.curve.one,t.czero());const u=r.redMul(t.redFermat()),f=this.curve.b.redMul(u.redSqr()).redISub(this.curve.a).redISub(this.x).redISub(e.x),h=u.redMul(this.x.redSub(f)).redISub(this.y),l=c|this.inf&e.inf;return f.cinject(e.x,this.inf),h.cinject(e.y,this.inf),f.cinject(this.x,e.inf),h.cinject(this.y,e.inf),f.cinject(this.curve.zero,l),h.cinject(this.curve.zero,l),this.curve.point(f,h,l)}udbl(){return this.uadd(this)}recover(e,t){if(M(e instanceof m),M(t instanceof m),this.inf)return this.curve.point();const r=this.x.redMul(e.z),n=e.x.redAdd(r),i=e.x.redSub(r).redSqr().redMul(t.x),s=this.curve.a.redMul(e.z).redIMuln(2),o=n.redIAdd(s),a=this.x.redMul(e.x).redIAdd(e.z),c=o.redMul(a),u=s.redMul(e.z),f=c.redISub(u).redMul(t.z),h=this.curve.b.redMul(this.y).redIMuln(2).redMul(e.z).redMul(t.z),l=h.redMul(e.x),d=f.redISub(i),p=h.redMul(e.z);if(p.isZero())return this.curve.point();const b=p.redInvert(),y=l.redMul(b),g=d.redMul(b);return this.curve.point(y,g)}getX(){if(this.inf)throw new Error("Invalid point.");return this.x.fromRed()}getY(){if(this.inf)throw new Error("Invalid point.");return this.y.fromRed()}eq(e){return M(e instanceof y),this===e||(this.inf?0!==e.inf:!e.inf&&(this.x.eq(e.x)&&this.y.eq(e.y)))}isInfinity(){return 0!==this.inf}isOdd(){return!this.inf&&this.y.redIsOdd()}isEven(){return!this.inf&&this.y.redIsEven()}toP(){return this}toJ(){return this}toX(){return this.inf?this.curve.xpoint():this.curve.xpoint(this.x,this.curve.one)}encode(){return this.toX().encode()}static decode(e,t,r){return M(e instanceof b),e.decodeX(t).toP(r)}toJSON(e){if(this.inf)return[];return[this.getX().toJSON(),this.getY().toJSON()]}static fromJSON(e,t){if(M(e instanceof b),M(Array.isArray(t)),M(0===t.length||2===t.length||3===t.length),0===t.length)return e.point();const r=i.fromJSON(t[0]),n=i.fromJSON(t[1]);return e.point(r,n)}[n](){return this.inf?"<MontPoint: Infinity>":"<MontPoint: x="+this.x.fromRed().toString(16,2)+" y="+this.y.fromRed().toString(16,2)+">"}}class m extends h{constructor(e,t,r){M(e instanceof b),super(e,a),this.x=this.curve.one,this.z=this.curve.zero,null!=t&&this._init(t,r)}_init(e,t){M(e instanceof i),M(null==t||t instanceof i),this.x=e,this.z=t||this.curve.one,this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red))}clone(){return this.curve.xpoint(this.x.clone(),this.z.clone())}swap(e,t){return M(e instanceof m),this.x.cswap(e.x,t),this.z.cswap(e.z,t),this}precompute(e,t){return this}validate(){if(this.isInfinity())return!0;const{x:e,z:t}=this,r=e.redSqr(),n=r.redMul(e),i=t.redSqr(),s=this.curve.a.redMul(r).redMul(t);return-1!==n.redIAdd(s).redIAdd(e.redMul(i)).redMul(this.curve.bi).redMul(t).redJacobi()}normalize(){return this.isInfinity()||this.z.eq(this.curve.one)||(this.x=this.x.redDiv(this.z),this.z=this.curve.one),this}scale(e){if(M(e instanceof i),this.isInfinity())return this.curve.xpoint();const t=this.x.redMul(e),r=this.z.redMul(e);return this.curve.xpoint(t,r)}neg(){return this}dbl(){const e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redIAdd(this.curve.a24.redMul(r)));return this.curve.xpoint(n,i)}diffAdd(e,t){M(e instanceof m),M(t instanceof m);const r=e.x.redAdd(e.z),n=e.x.redSub(e.z),i=t.x.redAdd(t.z),s=t.x.redSub(t.z).redMul(r),o=i.redMul(n),a=this.z.redMul(s.redAdd(o).redSqr()),c=this.x.redMul(s.redISub(o).redSqr());return this.curve.xpoint(a,c)}diffAddDbl(e,t){M(e instanceof m),M(t instanceof m);const r=t.x.redAdd(t.z),n=r.redSqr(),i=t.x.redSub(t.z),s=i.redSqr(),o=n.redSub(s),a=e.x.redAdd(e.z),c=e.x.redSub(e.z).redMul(r),u=a.redMul(i),f=this.z.redMul(c.redAdd(u).redSqr()),h=this.x.redMul(c.redISub(u).redSqr()),l=n.redMul(s),d=o.redMul(s.redIAdd(this.curve.a24.redMul(o)));return[this.curve.xpoint(f,h),this.curve.xpoint(l,d)]}getX(){if(this.isInfinity())throw new Error("Invalid point.");return this.normalize(),this.x.fromRed()}getY(e){return this.toP(e).getY()}eq(e){if(M(e instanceof m),this===e)return!0;if(this.isInfinity())return e.isInfinity();if(e.isInfinity())return!1;if(this.z.eq(e.z))return this.x.eq(e.x);const t=this.x.redMul(e.z),r=e.x.redMul(this.z);return t.eq(r)}isInfinity(){return this.z.isZero()}isOdd(){return!1}isEven(){return!1}hasTorsion(){return!this.isInfinity()&&(!!this.x.isZero()||super.hasTorsion())}jmul(e){return this.ladder(e)[1]}jmulSimple(e){return this.ladderSimple(e)[1]}jmulBlind(e,t){return this.ladderBlind(e,t)[1]}jmulConst(e,t){return this.ladderConst(e,t)[1]}jmulAdd(e,t,r){throw new Error("Not implemented.")}jmulAddSimple(e,t,r){throw new Error("Not implemented.")}ladder(e){M(e instanceof i),M(!e.red);const t=e.bitLength();let r=this,n=this.curve.xpoint();for(let i=t-1;i>=0;i--){0===e.bit(i)?[r,n]=this.diffAddDbl(r,n):[n,r]=this.diffAddDbl(n,r)}return[r,n]}ladderSimple(e){M(e instanceof i),M(!e.red);const t=e.bitLength();let r=this,n=this.curve.xpoint();for(let i=t-1;i>=0;i--){0===e.bit(i)?(r=this.diffAdd(r,n),n=n.dbl()):(n=this.diffAdd(n,r),r=r.dbl())}return[r,n]}ladderBlind(e,t){return t?this.randomize(t).ladder(e):this.ladder(e)}ladderConst(e,t){M(e instanceof i),M(!e.red);const r=Math.max(e.bitLength(),this.curve.fieldBits),n=r+7>>>3,s=e.toArray("le",n),o=t?this.randomize(t):this;let a=o.clone(),c=this.curve.xpoint().clone(),u=0;for(let i=r-1;i>=0;i--){const e=s[i>>3]>>(7&i)&1;a.swap(c,u^e),[a,c]=o.diffAddDbl(a,c),u=e}return a.swap(c,u),[a,c]}toP(e=null){return M(null==e||"boolean"==typeof e),this.isInfinity()?this.curve.point():(this.normalize(),this.curve.pointFromX(this.x,e))}toJ(){return this}toX(){return this}encode(){return this.curve.encodeField(this.getX())}static decode(e,t){M(e instanceof b);const r=e.decodeField(t);r.iumaskn(e.fieldBits);const n=e.xpoint(r,e.one);return M(!n.isInfinity()),n}toJSON(e){return this.toP().toJSON(e)}static fromJSON(e,t){return y.fromJSON(e,t).toX()}[n](){return this.isInfinity()?"<XPoint: Infinity>":"<XPoint: x="+this.x.fromRed().toString(16,2)+" z="+this.z.fromRed().toString(16,2)+">"}}class g extends f{constructor(e){super(v,"edwards",e),this.a=i.fromJSON(e.a).toRed(this.red),this.d=i.fromJSON(e.d).toRed(this.red),this.s=i.fromJSON(e.s||"0").toRed(this.red),this.si=this.s.isZero()?this.zero:this.s.redInvert(),this.k=this.d.redMuln(2),this.smi=-this.d.redNeg().word(0),this.ad6=this.a.redAdd(this.d).redMul(this.i6),this.twisted=!this.a.eq(this.one),this.oneA=this.a.eq(this.one),this.mOneA=this.a.eq(this.one.redNeg()),this.smallD=null!=this.prime&&1===this.d.redNeg().length,this.alt=null,this._finalize(e)}static _isomorphism(e,t,r){M(e instanceof i),M(t instanceof i),M(r instanceof i);const n=r.clone(),s=r.redMul(t).redDiv(e);if(1!==e.redDiv(r).redJacobi())throw new Error("Invalid `a` coefficient.");return[n,s]}_short(e,t){const{a:r,d:n}=this,i=r.redSqr(),s=i.redMul(r),o=n.redSqr(),a=o.redMul(n),c=r.redMul(n).redIMuln(14),u=i.redMul(n),f=r.redMul(o),h=u.redIAdd(f).redIMuln(33),d=i.redAdd(c).redIAdd(o).redDivn(-48),p=h.redISub(s).redISub(a).redDivn(864);return null!=e?l._isomorphism(d,p,e,t):[d,p]}_mont(e,t=!1){let r,n;M("boolean"==typeof t),t?(r=this.d.redAdd(this.a),n=this.d.redSub(this.a)):(r=this.a.redAdd(this.d),n=this.a.redSub(this.d));const i=n.redInvert(),s=r.redMuln(2).redMul(i),o=i.redMuln(4);return null!=e?b._isomorphism(s,o,e):[s,o]}_edwards(e){return g._isomorphism(this.a,this.d,e)}_scaleShort(e){M(e instanceof l);const[t,r]=e._scale(this);return[this.field(t.redInvert()),this.field(r.redInvert())]}_scaleMont(e,t=!1){if(M(e instanceof b),M("boolean"==typeof t),this.g.isInfinity()||e.g.isInfinity()){const[r]=e._edwards(null,t);return this.field(r).redDivSqrt(this.a)}const r=e.g.x.redDiv(e.g.y);return this.g.x.redDiv(this.field(r))}_scaleEdwards(e){return M(e instanceof g),this.g.isInfinity()||e.g.isInfinity()?this.field(e.a).redDivSqrt(this.a):this.g.x.redDiv(this.field(e.g.x))}_mulA(e){return M(e instanceof i),this.oneA?e.clone():this.mOneA?e.redNeg():this.a.redMul(e)}_mulD(e){return M(e instanceof i),this.smallD?e.redMuln(this.smi):this.d.redMul(e)}_elligator1(e){const{s:t,si:r,i2:n,one:i,two:s}=this,o=r.redSqr().redIMuln(2),a=t.redSqr().redMul(n),c=a.redSqr(),u=o.redAdd(a),f=u.redSqr().redISub(s),h=o.redSub(i),l=this.p.subn(2),d=this.p.subn(1).iushrn(1),p=this.p.addn(1).iushrn(2),b=i.redSub(e),y=i.redAdd(e),m=b.redMul(y.redPow(l)),g=m.redSqr(),v=g.redMul(m),w=v.redMul(g).redAdd(f.redMul(v)).redIAdd(m),_=w.redPow(d),E=g.redAdd(c).redPow(d),k=_.redMul(E),S=_.redMul(m),A=_.redMul(w).redPow(p).redMul(k),I=i.redAdd(S),T=u.redMul(S),R=I.redSqr(),x=h.redMul(t).redMul(S).redMul(I),C=A.cinject(this.one,m.czero()),B=T.redSub(R),M=T.redAdd(R);return this.cpoint(x,C,B,M)}_invert1(e,t){const{s:r,si:n,i2:i,one:s}=this,{x:o,y:a,z:c}=e,u=1&t,f=n.redSqr().redIMuln(2),h=r.redSqr().redMul(i),l=h.redSqr(),d=f.redAdd(h),p=f.redSub(s),b=this.p.subn(2),y=this.p.subn(1).iushrn(1),m=this.p.addn(1).iushrn(2),g=a.redSub(c),v=a.redAdd(c).redIMuln(2),w=g.redMul(v.redPow(b)),_=s.redAdd(w.redMul(d)),E=_.redSqr().redISub(s),k=E.redPow(m),S=k.redSqr().ceq(E),A=k.redSub(_),I=s.redAdd(A),T=p.redMul(r).redMul(A).redMul(I).redMul(o.redMul(c)),R=A.redSqr().redIAdd(l),x=T.redMul(R).redPow(y).redMul(A),C=s.redSub(x),B=s.redAdd(x),M=C.redMul(B.redPow(b));if(M.cinject(M.redNeg(),M.redIsOdd()^u),!S)throw new Error("Invalid point.");return M}_alt(){return this.alt||(this.alt=this.toMont()),this.alt}isElliptic(){const e=this.a.redMul(this.d),t=this.a.redSub(this.d);return!e.redMul(t).isZero()}jinv(){const{a:e,d:t}=this,r=e.redMul(t),n=e.redSub(t).redPown(4),i=e.redSqr(),s=t.redSqr(),o=i.redAdd(r.redMuln(14)).redIAdd(s).redPown(3).redIMuln(16),a=r.redMul(n);if(a.isZero())throw new Error("Curve is not elliptic.");return o.redDiv(a).fromRed()}isComplete(){return 1===this.a.redJacobi()&&-1===this.d.redJacobi()}point(e,t,r,n){return new v(this,e,t,r,n)}jpoint(e,t,r){return M(null==e&&null==t&&null==r),this.point()}cpoint(e,t,r,n){M(e instanceof i),M(t instanceof i),M(r instanceof i),M(n instanceof i);const s=e.redMul(n),o=r.redMul(t),a=t.redMul(n),c=e.redMul(r);return this.point(s,o,a,c)}solveX2(e){M(e instanceof i);const t=e.redSqr(),r=this._mulD(t).redISub(this.a);return t.redISub(this.one).redDiv(r)}solveX(e){const t=e.redSqr(),r=this._mulD(t).redISub(this.a);return t.redISub(this.one).redDivSqrt(r)}solveY2(e){M(e instanceof i);const t=e.redSqr(),r=this._mulA(t).redISub(this.one),n=this._mulD(t).redISub(this.one);return r.redDiv(n)}solveY(e){const t=e.redSqr(),r=this._mulA(t).redISub(this.one),n=this._mulD(t).redISub(this.one);return r.redDivSqrt(n)}validate(e){if(M(e instanceof v),e.zOne){const t=e.x.redSqr(),r=e.y.redSqr(),n=this._mulD(t).redMul(r),i=this._mulA(t).redIAdd(r),s=this.one.redAdd(n),o=e.t,a=e.x.redMul(e.y);return i.eq(s)&&o.eq(a)}const t=e.x.redSqr(),r=e.y.redSqr(),n=e.z.redSqr(),i=n.redSqr(),s=this._mulD(t).redMul(r),o=this._mulA(t).redIAdd(r).redMul(n),a=i.redIAdd(s),c=e.t.redMul(e.z),u=e.x.redMul(e.y);return o.eq(a)&&c.eq(u)}pointFromX(e,t=null){M(e instanceof i),M(null==t||"boolean"==typeof t),e.red||(e=e.toRed(this.red));const r=this.solveY(e);if(null!=t){if(r.isZero()&&t)throw new Error("Invalid point.");r.redIsOdd()!==t&&r.redINeg()}return this.point(e,r)}pointFromY(e,t=null){M(e instanceof i),M(null==t||"boolean"==typeof t),e.red||(e=e.toRed(this.red));const r=this.solveX(e);if(null!=t){if(r.isZero()&&t)throw new Error("Invalid point.");r.redIsOdd()!==t&&r.redINeg()}return this.point(r,e)}isIsomorphic(e,t=!1){if(M(e instanceof f),M("boolean"==typeof t),!e.p.eq(this.p))return!1;if("short"===e.type)return e.isIsomorphic(this);if("mont"===e.type){const r=this.field(e.a);let n,i;return t?(n=this.d.redAdd(this.a),i=this.d.redSub(this.a)):(n=this.a.redAdd(this.d),i=this.a.redSub(this.d)),r.redMul(i).eq(n.redIMuln(2))}if("edwards"===e.type){const t=this.field(e.a),r=this.field(e.d);return this.a.redMul(r).eq(t.redMul(this.d))}return!1}isIsogenous(e){if(M(e instanceof f),!e.p.eq(this.p))return!1;if("mont"===e.type){if(!this.a.eq(this.one))return!1;const t=this.field(e.a),r=this.field(e.b),n=this.two.redSub(this.d.redMuln(4));return t.eq(n)&&r.eq(this.one)}if("edwards"===e.type){const t=this.field(e.a),r=this.field(e.d);return t.eq(this.a.redNeg())&&r.eq(this.d.redSub(this.a))}return!1}pointFromShort(e){if(M(e instanceof d),this.isIsomorphic(e.curve)){if(e.isInfinity())return this.point();if(e.y.isZero())return this.point(this.zero,this.one.redNeg());const{a:t,d:r}=this,[n,i]=this._scale(e.curve),s=t.redMuln(5),o=r.redMuln(5),a=this.field(e.x).redMul(n),c=this.field(e.y).redMul(i),u=a.redMuln(6),f=a.redMuln(12),h=u.redSub(t).redISub(r),l=c.redMuln(6),d=f.redSub(s).redIAdd(r),p=f.redAdd(t).redISub(o);return this.cpoint(h,l,d,p)}throw new Error("Not implemented.")}pointFromMont(e){M(e instanceof y),M(e.curve.p.eq(this.p));const t=this.field(e.x),r=this.field(e.y);if(this.isIsogenous(e.curve)){if(e.isInfinity())return this.point();if(e.x.isZero())return this.point();const n=t.redSqr(),i=n.redMul(t),s=i.redMul(t),o=s.redMul(t),a=r.redSqr(),c=r.redMuln(4),u=n.redSub(this.one),f=n.redMuln(2),h=a.redMuln(4),l=i.redIMuln(2),d=t.redMul(a).redIMuln(4),p=n.redMul(a).redIMuln(2),b=a.redIMuln(2),y=c.redMul(u),m=s.redISub(f).redIAdd(h).redIAdd(this.one),g=o.redSub(l).redISub(d).redIAdd(t).redINeg(),v=o.redISub(p).redISub(l).redISub(b).redIAdd(t);return this.cpoint(y,m,g,v).divn(4)}if(this.isIsomorphic(e.curve,!0)){if(e.isInfinity())return this.point();if(e.x.isZero())return this.point(this.zero,this.one.redNeg());const n=this._scale(e.curve,!0).redMul(t),i=r,s=t.redAdd(this.one),o=t.redSub(this.one);return this.cpoint(n,i,s,o)}if(this.isIsomorphic(e.curve,!1)){if(e.isInfinity())return this.point();if(e.x.isZero())return this.point(this.zero,this.one.redNeg());const n=this._scale(e.curve,!1).redMul(t),i=r,s=t.redSub(this.one),o=t.redAdd(this.one);return this.cpoint(n,i,s,o)}throw new Error("Not implemented.")}pointFromEdwards(e){M(e instanceof v),M(e.curve.p.eq(this.p));const t=this.field(e.curve.a),r=this.field(e.x),n=this.field(e.y),i=this.field(e.z),s=this.field(e.t);if(this.isIsogenous(e.curve)){const e=r.redMul(n),s=r.redSqr(),o=n.redSqr(),a=i.redSqr(),c=t.redMul(s),u=e.redIMuln(2),f=o.redSub(c),h=o.redAdd(c),l=a.redIMuln(2).redISub(h),d=this.cpoint(u,f,h,l);return this.twisted?d:d.divn(4)}if(this.isIsomorphic(e.curve)){const t=this._scale(e.curve),o=t.redMul(r),a=n,c=i,u=t.redMul(s);return this.point(o,a,c,u)}throw new Error("Not implemented.")}pointFromUniform(e,t=null){M(e instanceof i),M(e.red===this.red),M(null==t||t instanceof b),t||(t=this._alt());const r=t.field(e),n=t.pointFromUniform(r);return this.pointFromMont(n)}pointToUniform(e,t,r=null){M(e instanceof v),M(t>>>0===t),M(null==r||r instanceof b),r||(r=this._alt());const n=(t>>4&15)%this.torsion.length,i=e.add(this.torsion[n]),s=r.pointFromEdwards(i),o=r.pointToUniform(s,15&t);return this.field(o)}pointFromHash(e,t,r=null){M(null==r||r instanceof b),r||(r=this._alt());const n=r.pointFromHash(e,t);return this.pointFromMont(n)}pointToHash(e,t,r,n=null){M(e instanceof v),M(t>>>0===t),M(null==n||n instanceof b),n||(n=this._alt());const i=t%this.torsion.length,s=e.add(this.torsion[i]),o=n.pointFromEdwards(s);return n.pointToHash(o,0,r)}decodePoint(e){return v.decode(this,e)}toShort(e,t,r=null){const[n,i]=this._short(e,t),s=new l({red:this.red,prime:this.prime,p:this.p,a:n,b:i,n:this.n,h:this.h});if(null!=r){const[,e]=s._scale(this);e.redIsOdd()!==r&&e.redINeg()}this.g.isInfinity()||(s.g=s.pointFromEdwards(this.g));for(let o=0;o<this.h;o++)s.torsion[o]=s.pointFromEdwards(this.torsion[o]);return s}toMont(e,t,r=null){const[n,i]=this._mont(e,t),s=new b({red:this.red,prime:this.prime,p:this.p,a:n,b:i,n:this.n,h:this.h,z:this.z});if(null!=r){const e=this._scale(s,t);e.redIsOdd()!==r&&e.redINeg()}this.g.isInfinity()||(s.g=s.pointFromEdwards(this.g));for(let o=0;o<this.h;o++)s.torsion[o]=s.pointFromEdwards(this.torsion[o]);return s}toEdwards(e,t=null){const[r,n]=this._edwards(e),i=new g({red:this.red,prime:this.prime,p:this.p,a:r,d:n,n:this.n,h:this.h,z:this.z});if(null!=t){const e=i._scale(this);e.redIsOdd()!==t&&e.redINeg()}if(this.g.isInfinity()||(i.g=i.pointFromEdwards(this.g),i.g.normalize()),i.isComplete())for(let s=0;s<this.h;s++)i.torsion[s]=i.pointFromEdwards(this.torsion[s]),i.torsion[s].normalize();return i}pointFromJSON(e){return v.fromJSON(this,e)}toJSON(e){const t=super.toJSON(e);return t.a=this.a.fromRed().toJSON(),t.d=this.d.fromRed().toJSON(),this.s.isZero()||(t.s=this.s.fromRed().toJSON()),t}}class v extends h{constructor(e,t,r,n,i){M(e instanceof g),super(e,c),this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=1,null!=t&&this._init(t,r,n,i)}_init(e,t,r,n){M(e instanceof i),M(t instanceof i),M(null==r||r instanceof i),M(null==n||n instanceof i),this.x=e,this.y=t,this.z=r||this.curve.one,this.t=n||null,this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=0|this.z.eq(this.curve.one),this._check(),this.t||(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redDiv(this.z)))}_check(){if(this.z.isZero())throw new Error("Invalid point.")}clone(){return this.curve.point(this.x.clone(),this.y.clone(),this.z.clone(),this.t.clone())}swap(e,t){M(e instanceof v);const r=1&(t>>31|-t>>31),n=this.zOne,i=e.zOne;return this.x.cswap(e.x,t),this.y.cswap(e.y,t),this.z.cswap(e.z,t),this.t.cswap(e.t,t),this.zOne=n&(1^r)|i&r,e.zOne=i&(1^r)|n&r,this}normalize(){if(this.zOne)return this;const e=this.z.redInvert();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t=this.t.redMul(e),this.z=this.curve.one,this.zOne=1,this}scale(e){M(e instanceof i);const t=this.x.redMul(e),r=this.y.redMul(e),n=this.z.redMul(e),s=this.t.redMul(e);return this.curve.point(t,r,n,s)}neg(){const e=this.x.redNeg(),t=this.y,r=this.z,n=this.t.redNeg();return this.curve.point(e,t,r,n)}add(e){return M(e instanceof v),this.isInfinity()?e:e.isInfinity()?this:this.zOne?e._add(this,0):this._add(e,0)}_add(e,t){return this.curve.mOneA?this._addM1(e,t):this._addA(e,t)}_addM1(e,t){const r=e.zOne&(1^t),n=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),i=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),s=this.t.redMul(this.curve.k).redMul(e.t),o=r?this.z.redAdd(this.z):this.z.redMul(e.z).redIMuln(2),a=i.redSub(n),c=o.redSub(s),u=o.redIAdd(s),f=i.redIAdd(n),h=a.redMul(c),l=u.redMul(f),d=a.redMul(f),p=c.redMul(u);return this.curve.point(h,l,p,d)}_addA(e,t){const r=e.zOne&(1^t),n=this.x.redMul(e.x),i=this.y.redMul(e.y),s=this.curve._mulD(this.t).redMul(e.t),o=r?this.z.clone():this.z.redMul(e.z),a=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(n).redISub(i),c=o.redSub(s),u=o.redIAdd(s),f=i.redISub(this.curve._mulA(n)),h=a.redMul(c),l=u.redMul(f),d=a.redMul(f),p=c.redMul(u);return this.curve.point(h,l,p,d)}dbl(){return this.isInfinity()?this:this._dbl(0)}_dbl(e){const t=this.zOne&(1^e),r=this.x.redSqr(),n=this.y.redSqr(),i=t?this.curve.two:this.z.redSqr().redIMuln(2),s=this.curve._mulA(r),o=this.x.redAdd(this.y).redSqr().redISub(r).redISub(n),a=s.redAdd(n),c=a.redSub(i),u=s.redISub(n),f=o.redMul(c),h=a.redMul(u),l=o.redMul(u),d=c.redMul(a);return this.curve.point(f,h,d,l)}uadd(e){return M(e instanceof v),this._add(e,1)}udbl(){return this._dbl(1)}getX(){return this.normalize(),this.x.fromRed()}getY(){return this.normalize(),this.y.fromRed()}eq(e){if(M(e instanceof v),M(!this.z.isZero()),M(!e.z.isZero()),this===e)return!0;if(this.z.eq(e.z))return this.x.eq(e.x)&&this.y.eq(e.y);const t=this.x.redMul(e.z),r=e.x.redMul(this.z);if(!t.eq(r))return!1;const n=this.y.redMul(e.z),i=e.y.redMul(this.z);return n.eq(i)}isInfinity(){return M(!this.z.isZero()),!!this.x.isZero()&&this.y.eq(this.z)}isOdd(){return this.normalize(),this.x.redIsOdd()}isEven(){return this.normalize(),this.x.redIsEven()}toP(){return this.normalize()}toJ(){return this}encode(){const e=this.getY();return e.setn(this.curve.signBit,this.x.redIsOdd()),this.curve.encodeAdjusted(e)}static decode(e,t){M(e instanceof g);const r=e.decodeAdjusted(t),n=0!==r.testn(e.signBit);if(r.setn(e.signBit,0),r.cmp(e.p)>=0)throw new Error("Invalid point.");return e.pointFromY(r,n)}toJSON(e){if(this.isInfinity())return[];const t=this.getX().toJSON(),r=this.getY().toJSON();return!0===e&&this.pre?[t,r,this.pre.toJSON()]:[t,r]}static fromJSON(e,t){if(M(e instanceof g),M(Array.isArray(t)),M(0===t.length||2===t.length||3===t.length),0===t.length)return e.point();const r=i.fromJSON(t[0]),n=i.fromJSON(t[1]),s=e.point(r,n);return t.length>2&&null!=t[2]&&(s.pre=_.fromJSON(s,t[2])),s}[n](){return this.isInfinity()?"<EdwardsPoint: Infinity>":"<EdwardsPoint: x="+this.x.fromRed().toString(16,2)+" y="+this.y.fromRed().toString(16,2)+" z="+this.z.fromRed().toString(16,2)+">"}}class w{constructor(e){M(e instanceof f);let t=e.fieldBits,r=7&t;0===r&&(r=8),e.scalarSize<e.fieldSize&&(t=8*e.scalarSize,r=8),this.curve=e,this.h=255&-e.h.word(0),this.n=(1<<r)-1,this.b=1<<r-1,this.and=i.mask(t).iuxorn(255^this.h),this.or=i.shift(1,t-1)}reduce(e){return M(e instanceof i),M(!e.red),e.iuand(this.and),e.iuor(this.or),e}clamp(t){M(e.isBuffer(t)),M(t.length===this.curve.scalarSize);let r=0,n=this.curve.scalarSize-1;return"be"===this.curve.endian&&([r,n]=[n,r]),this.curve.scalarSize>this.curve.fieldSize&&("be"===this.curve.endian?t[n++]=0:t[n--]=0),t[r]&=this.h,t[n]&=this.n,t[n]|=this.b,t}splitHash(t){M(e.isBuffer(t)),M(t.length===2*this.curve.adjustedSize);let r=0;"be"===this.curve.endian&&(r=this.curve.adjustedSize-this.curve.scalarSize);const n=t.slice(r,r+this.curve.scalarSize),i=t.slice(this.curve.adjustedSize);return this.clamp(n),[n,i]}}class _{constructor(){this.naf=null,this.windows=null,this.doubles=null,this.blinding=null,this.beta=null}map(e){M("function"==typeof e);const t=new this.constructor;return this.naf&&(t.naf=this.naf.map(e)),this.doubles&&(t.doubles=this.doubles.map(e)),t}toJSON(){return{naf:this.naf?this.naf.toJSON():null,windows:this.windows?this.windows.toJSON():null,doubles:this.doubles?this.doubles.toJSON():null,blinding:this.blinding?this.blinding.toJSON():void 0}}fromJSON(e,t){return M(e instanceof h),M(t&&"object"==typeof t),null!=t.naf&&(this.naf=E.fromJSON(e,t.naf)),null!=t.windows&&(this.windows=k.fromJSON(e,t.windows)),null!=t.doubles&&(this.doubles=S.fromJSON(e,t.doubles)),null!=t.blinding&&(this.blinding=A.fromJSON(e,t.blinding)),this}static fromJSON(e,t){return(new this).fromJSON(e,t)}}class E{constructor(e,t){this.width=e,this.points=t}map(e){M("function"==typeof e);const{width:t}=this,r=[];for(const n of this.points)r.push(e(n));return new this.constructor(t,r)}toJSON(){return{width:this.width,points:this.points.slice(1).map(e=>e.toJSON())}}static fromJSON(e,t){M(e instanceof h),M(t&&"object"==typeof t),M(t.width>>>0===t.width),M(Array.isArray(t.points));const{curve:r}=e,{width:n}=t,i=[e];for(const s of t.points)i.push(r.pointFromJSON(s));return new this(n,i)}}class k{constructor(e,t,r){this.width=e,this.bits=t,this.points=r}toJSON(){return{width:this.width,bits:this.bits,points:this.points.slice(1).map(e=>e.toJSON())}}static fromJSON(e,t){M(e instanceof h),M(t&&"object"==typeof t),M(t.width>>>0===t.width),M(t.bits>>>0===t.bits),M(Array.isArray(t.points));const{curve:r}=e,{width:n,bits:i}=t,s=[e];for(const o of t.points)s.push(r.pointFromJSON(o));return new this(n,i,s)}}class S{constructor(e,t){this.step=e,this.points=t}map(e){M("function"==typeof e);const{step:t}=this,r=[];for(const n of this.points)r.push(e(n));return new this.constructor(t,r)}toJSON(){return{step:this.step,points:this.points.slice(1).map(e=>e.toJSON())}}static fromJSON(e,t){M(e instanceof h),M(t&&"object"==typeof t),M(t.step>>>0===t.step),M(Array.isArray(t.points));const{curve:r}=e,{step:n}=t,i=[e];for(const s of t.points)i.push(r.pointFromJSON(s));return new this(n,i)}}class A{constructor(e,t){this.blind=e,this.unblind=t}toJSON(){return{blind:this.blind.toJSON(),unblind:this.unblind.toJSON()}}static fromJSON(e,t){M(e instanceof h),M(t&&"object"==typeof t);const{curve:r}=e;return new this(i.fromJSON(t.blind),r.pointFromJSON(t.unblind))}}class I{constructor(e,t,r,n){this.beta=e,this.lambda=t,this.basis=r,this.pre=n}toJSON(){return{beta:this.beta.fromRed().toJSON(),lambda:this.lambda.toJSON(),basis:[this.basis[0].toJSON(),this.basis[1].toJSON()],pre:[this.pre[0].toJSON(),this.pre[1].toJSON()]}}static fromJSON(e,t){M(e instanceof f),M(t&&"object"==typeof t),M(Array.isArray(t.basis)),M(Array.isArray(t.pre)),M(2===t.basis.length),M(2===t.pre.length);return new this(i.fromJSON(t.beta).toRed(e.red),i.fromJSON(t.lambda),[T.fromJSON(t.basis[0]),T.fromJSON(t.basis[1])],[i.fromJSON(t.pre[0]),i.fromJSON(t.pre[1])])}}class T{constructor(e,t){this.a=e,this.b=t}toJSON(){return{a:this.a.toJSON(),b:this.b.toJSON()}}static fromJSON(e){M(e&&"object"==typeof e);return new this(i.fromJSON(e.a),i.fromJSON(e.b))}}const R={__proto__:null,P192:class extends l{constructor(e){super({id:"P192",ossl:"prime192v1",type:"short",endian:"be",hash:"SHA256",prime:"p192",p:["ffffffff ffffffff ffffffff fffffffe","ffffffff ffffffff"],a:["ffffffff ffffffff ffffffff fffffffe","ffffffff fffffffc"],b:["64210519 e59c80e7 0fa7e9ab 72243049","feb8deec c146b9b1"],n:["ffffffff ffffffff ffffffff 99def836","146bc9b1 b4d22831"],h:"1",z:"-5",g:[["188da80e b03090f6 7cbf20eb 43a18800","f4ff0afd 82ff1012"],["07192b95 ffc8da78 631011ed 6b24cdd5","73f977a1 1e794811"],e]})}},P224:class extends l{constructor(e){super({id:"P224",ossl:"secp224r1",type:"short",endian:"be",hash:"SHA256",prime:"p224",p:["ffffffff ffffffff ffffffff ffffffff","00000000 00000000 00000001"],a:["ffffffff ffffffff ffffffff fffffffe","ffffffff ffffffff fffffffe"],b:["b4050a85 0c04b3ab f5413256 5044b0b7","d7bfd8ba 270b3943 2355ffb4"],n:["ffffffff ffffffff ffffffff ffff16a2","e0b8f03e 13dd2945 5c5c2a3d"],h:"1",z:"1f",g:[["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3","56c21122 343280d6 115c1d21"],["bd376388 b5f723fb 4c22dfe6 cd4375a0","5a074764 44d58199 85007e34"],e]})}},P256:class extends l{constructor(e){super({id:"P256",ossl:"prime256v1",type:"short",endian:"be",hash:"SHA256",prime:null,p:["ffffffff 00000001 00000000 00000000","00000000 ffffffff ffffffff ffffffff"],a:["ffffffff 00000001 00000000 00000000","00000000 ffffffff ffffffff fffffffc"],b:["5ac635d8 aa3a93e7 b3ebbd55 769886bc","651d06b0 cc53b0f6 3bce3c3e 27d2604b"],n:["ffffffff 00000000 ffffffff ffffffff","bce6faad a7179e84 f3b9cac2 fc632551"],h:"1",z:"-a",g:[["6b17d1f2 e12c4247 f8bce6e5 63a440f2","77037d81 2deb33a0 f4a13945 d898c296"],["4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16","2bce3357 6b315ece cbb64068 37bf51f5"],e]})}},P384:class extends l{constructor(e){super({id:"P384",ossl:"secp384r1",type:"short",endian:"be",hash:"SHA384",prime:null,p:["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff fffffffe","ffffffff 00000000 00000000 ffffffff"],a:["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff fffffffe","ffffffff 00000000 00000000 fffffffc"],b:["b3312fa7 e23ee7e4 988e056b e3f82d19","181d9c6e fe814112 0314088f 5013875a","c656398d 8a2ed19d 2a85c8ed d3ec2aef"],n:["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff c7634d81 f4372ddf","581a0db2 48b0a77a ecec196a ccc52973"],h:"1",z:"-c",g:[["aa87ca22 be8b0537 8eb1c71e f320ad74","6e1d3b62 8ba79b98 59f741e0 82542a38","5502f25d bf55296c 3a545e38 72760ab7"],["3617de4a 96262c6f 5d9e98bf 9292dc29","f8f41dbd 289a147c e9da3113 b5f0b8c0","0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"],e]})}},P521:class extends l{constructor(e){super({id:"P521",ossl:"secp521r1",type:"short",endian:"be",hash:"SHA512",prime:"p521",p:["000001ff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff"],a:["000001ff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff ffffffff","fffffffc"],b:["00000051 953eb961 8e1c9a1f 929a21a0","b68540ee a2da725b 99b315f3 b8b48991","8ef109e1 56193951 ec7e937b 1652c0bd","3bb1bf07 3573df88 3d2c34f1 ef451fd4","6b503f00"],n:["000001ff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff ffffffff","fffffffa 51868783 bf2f966b 7fcc0148","f709a5d0 3bb5c9b8 899c47ae bb6fb71e","91386409"],h:"1",z:"-4",g:[["000000c6 858e06b7 0404e9cd 9e3ecb66","2395b442 9c648139 053fb521 f828af60","6b4d3dba a14b5e77 efe75928 fe1dc127","a2ffa8de 3348b3c1 856a429b f97e7e31","c2e5bd66"],["00000118 39296a78 9a3bc004 5c8a5fb4","2c7d1bd9 98f54449 579b4468 17afbd17","273e662c 97ee7299 5ef42640 c550b901","3fad0761 353c7086 a272c240 88be9476","9fd16650"],e]})}},SECP256K1:class extends l{constructor(e){super({id:"SECP256K1",ossl:"secp256k1",type:"short",endian:"be",hash:"SHA256",prime:"k256",p:["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe fffffc2f"],a:"0",b:"7",n:["ffffffff ffffffff ffffffff fffffffe","baaedce6 af48a03b bfd25e8c d0364141"],h:"1",z:"1",c:["0a2d2ba9 3507f1df 233770c2 a797962c","c61f6d15 da14ecd4 7d8d27ae 1cd5f852"],g:[["79be667e f9dcbbac 55a06295 ce870b07","029bfcdb 2dce28d9 59f2815b 16f81798"],["483ada77 26a3c465 5da4fbfc 0e1108a8","fd17b448 a6855419 9c47d08f fb10d4b8"],e],endo:{beta:["7ae96a2b 657c0710 6e64479e ac3434e9","9cf04975 12f58995 c1396c28 719501ee"],lambda:["5363ad4c c05c30e0 a5261c02 8812645a","122e22ea 20816678 df02967c 1b23bd72"],basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],pre:["3086d221a7d46bcde86c90e49284eb153dab","-e4437ed6010e88286f547fa90abfe4c42212"]}})}},BRAINPOOLP256:class extends l{constructor(e){super({id:"BRAINPOOLP256",ossl:"brainpoolP256r1",type:"short",endian:"be",hash:"SHA256",prime:null,p:["a9fb57db a1eea9bc 3e660a90 9d838d72","6e3bf623 d5262028 2013481d 1f6e5377"],a:["7d5a0975 fc2c3057 eef67530 417affe7","fb8055c1 26dc5c6c e94a4b44 f330b5d9"],b:["26dc5c6c e94a4b44 f330b5d9 bbd77cbf","95841629 5cf7e1ce 6bccdc18 ff8c07b6"],n:["a9fb57db a1eea9bc 3e660a90 9d838d71","8c397aa3 b561a6f7 901e0e82 974856a7"],h:"1",z:"-2",g:[["8bd2aeb9 cb7e57cb 2c4b482f fc81b7af","b9de27e1 e3bd23c2 3a4453bd 9ace3262"],["547ef835 c3dac4fd 97f8461a 14611dc9","c2774513 2ded8e54 5c1d54c7 2f046997"],e]})}},BRAINPOOLP384:class extends l{constructor(e){super({id:"BRAINPOOLP384",ossl:"brainpoolP384r1",type:"short",endian:"be",hash:"SHA384",prime:null,p:["8cb91e82 a3386d28 0f5d6f7e 50e641df","152f7109 ed5456b4 12b1da19 7fb71123","acd3a729 901d1a71 87470013 3107ec53"],a:["7bc382c6 3d8c150c 3c72080a ce05afa0","c2bea28e 4fb22787 139165ef ba91f90f","8aa5814a 503ad4eb 04a8c7dd 22ce2826"],b:["04a8c7dd 22ce2826 8b39b554 16f0447c","2fb77de1 07dcd2a6 2e880ea5 3eeb62d5","7cb43902 95dbc994 3ab78696 fa504c11"],n:["8cb91e82 a3386d28 0f5d6f7e 50e641df","152f7109 ed5456b3 1f166e6c ac0425a7","cf3ab6af 6b7fc310 3b883202 e9046565"],h:"1",z:"-5",g:[["1d1c64f0 68cf45ff a2a63a81 b7c13f6b","8847a3e7 7ef14fe3 db7fcafe 0cbd10e8","e826e034 36d646aa ef87b2e2 47d4af1e"],["8abe1d75 20f9c2a4 5cb1eb8e 95cfd552","62b70b29 feec5864 e19c054f f9912928","0e464621 77918111 42820341 263c5315"],e]})}},BRAINPOOLP512:class extends l{constructor(e){super({id:"BRAINPOOLP512",ossl:"brainpoolP512r1",type:"short",endian:"be",hash:"SHA512",prime:null,p:["aadd9db8 dbe9c48b 3fd4e6ae 33c9fc07","cb308db3 b3c9d20e d6639cca 70330871","7d4d9b00 9bc66842 aecda12a e6a380e6","2881ff2f 2d82c685 28aa6056 583a48f3"],a:["7830a331 8b603b89 e2327145 ac234cc5","94cbdd8d 3df91610 a83441ca ea9863bc","2ded5d5a a8253aa1 0a2ef1c9 8b9ac8b5","7f1117a7 2bf2c7b9 e7c1ac4d 77fc94ca"],b:["3df91610 a83441ca ea9863bc 2ded5d5a","a8253aa1 0a2ef1c9 8b9ac8b5 7f1117a7","2bf2c7b9 e7c1ac4d 77fc94ca dc083e67","984050b7 5ebae5dd 2809bd63 8016f723"],n:["aadd9db8 dbe9c48b 3fd4e6ae 33c9fc07","cb308db3 b3c9d20e d6639cca 70330870","553e5c41 4ca92619 41866119 7fac1047","1db1d381 085ddadd b5879682 9ca90069"],h:"1",z:"7",g:[["81aee4bd d82ed964 5a21322e 9c4c6a93","85ed9f70 b5d916c1 b43b62ee f4d0098e","ff3b1f78 e2d0d48d 50d1687b 93b97d5f","7c6d5047 406a5e68 8b352209 bcb9f822"],["7dde385d 566332ec c0eabfa9 cf7822fd","f209f700 24a57b1a a000c55b 881f8111","b2dcde49 4a5f485e 5bca4bd8 8a2763ae","d1ca2b2f a8f05406 78cd1e0f 3ad80892"],e]})}},X25519:class extends b{constructor(){super({id:"X25519",ossl:"X25519",type:"mont",endian:"le",hash:"SHA512",prime:"p25519",p:["7fffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff ffffffed"],a:"76d06",b:"1",n:["10000000 00000000 00000000 00000000","14def9de a2f79cd6 5812631a 5cf5d3ed"],h:"8",z:"2",g:[["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000009"],["5f51e65e 475f794b 1fe122d3 88b72eb3","6dc2b281 92839e4d d6163a5d 81312c14"]],torsion:[[],["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"],["0000000000000000000000000000000000000000000000000000000000000001","141b0b6806563d503de05885280b59109ca5ee38d7b56c9c165db7106377bbd8"],["0000000000000000000000000000000000000000000000000000000000000001","6be4f497f9a9c2afc21fa77ad7f4a6ef635a11c7284a9363e9a248ef9c884415"],["00b8495f16056286fdb1329ceb8d09da6ac49ff1fae35616aeb8413b7c7aebe0","46ce3ed6a9617c5ad6b7d3eb19d74ba86cc403d6127fe4b29778eb7c6daf84d3"],["00b8495f16056286fdb1329ceb8d09da6ac49ff1fae35616aeb8413b7c7aebe0","3931c129569e83a529482c14e628b457933bfc29ed801b4d6887148392507b1a"],["57119fd0dd4e22d8868e1c58c45c44045bef839c55b1d0b1248c50a3bc959c5f","173a6c76c2ba719bce3935ffba04afeadf5bbcb971559722f0efc7bdfb7f9a36"],["57119fd0dd4e22d8868e1c58c45c44045bef839c55b1d0b1248c50a3bc959c5f","68c593893d458e6431c6ca0045fb501520a443468eaa68dd0f103842048065b7"]]})}},X448:class extends b{constructor(){super({id:"X448",ossl:"X448",type:"mont",endian:"le",hash:"SHAKE256",prime:"p448",p:["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff"],a:"262a6",b:"1",n:["3fffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff 7cca23e9","c44edb49 aed63690 216cc272 8dc58f55","2378c292 ab5844f3"],h:"4",z:"-1",g:[["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000005"],["7d235d12 95f5b1f6 6c98ab6e 58326fce","cbae5d34 f55545d0 60f75dc2 8df3f6ed","b8027e23 46430d21 1312c4b1 50677af7","6fd7223d 457b5b1a"]],torsion:[[],[["00000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000"],["00000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000"]],[["fffffffffffffffffffffffffffffffffffffffffffffffffffffffe","fffffffffffffffffffffffffffffffffffffffffffffffffffffffe"],["ba4d3a0829b6112f8812e51ba0bb2abebc1cb08eb48e556936ba50fd","d2e7d68af8cb32160522425b3f990812abbe635ad37a21e17551b193"]],[["fffffffffffffffffffffffffffffffffffffffffffffffffffffffe","fffffffffffffffffffffffffffffffffffffffffffffffffffffffe"],["45b2c5f7d649eed077ed1ae45f44d54143e34f714b71aa96c945af01","2d1829750734cde9faddbda4c066f7ed54419ca52c85de1e8aae4e6c"]]]})}},MONT448:class extends b{constructor(){super({id:"MONT448",ossl:null,type:"mont",endian:"le",hash:"SHAKE256",prime:"p448",p:["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff"],a:["b2cf97d2 d43459a9 31ed36b1 fc4e3cb5","5d93f8d2 22746997 60ccffc6 49961ed6","c5b05fca c24864ed 6fb59697 931b78da","84ddecd8 ca2b5cfb"],b:"1",n:["3fffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff 7cca23e9","c44edb49 aed63690 216cc272 8dc58f55","2378c292 ab5844f3"],h:"4",z:"-1",g:[["ac0d24cc c6c75cb0 eb71f81e 7a6edf51","48e88aee 009a2a24 e795687e c28e125a","3e6730a6 0d46367b aa7fe99d 152128dc","41321bc7 7817f059"],["5a4437f6 80c0d0db 9b061276 d5d0ffcc","e786ff33 b6a53d30 98746425 82e66f09","4433dae7 7244a6e2 6b11e905 7228f483","556c41a5 913f55fe"]],torsion:[[],[["00000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000"],["00000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000"]],[["fffffffffffffffffffffffffffffffffffffffffffffffffffffffe","fffffffffffffffffffffffffffffffffffffffffffffffffffffffe"],["bec92fd06da2acf2b4e261e87cef0d3422e75c183c589857b71924e5","73c2f9cee18da5f2466e2f393c2eedf0f105a60ab40c717d4f1e1fd7"]],[["fffffffffffffffffffffffffffffffffffffffffffffffffffffffe","fffffffffffffffffffffffffffffffffffffffffffffffffffffffe"],["4136d02f925d530d4b1d9e178310f2cbdd18a3e7c3a767a848e6db19","8c3d06311e725a0db991d0c6c3d1120f0efa59f54bf38e82b0e1e028"]]]})}},ED25519:class extends g{constructor(e){super({id:"ED25519",ossl:"ED25519",type:"edwards",endian:"le",hash:"SHA512",prefix:"SigEd25519 no Ed25519 collisions",context:!1,prime:"p25519",p:["7fffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff ffffffed"],a:"-1",d:["52036cee 2b6ffe73 8cc74079 7779e898","00700a4d 4141d8ab 75eb4dca 135978a3"],n:["10000000 00000000 00000000 00000000","14def9de a2f79cd6 5812631a 5cf5d3ed"],h:"8",z:"2",g:[["216936d3 cd6e53fe c0a4e231 fdd6dc5c","692cc760 9525a7b2 c9562d60 8f25d51a"],["66666666 66666666 66666666 66666666","66666666 66666666 66666666 66666658"],e],torsion:[["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"],["0000000000000000000000000000000000000000000000000000000000000000","7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"],["547cdb7fb03e20f4d4b2ff66c2042858d0bce7f952d01b873b11e4d8b5f15f3d","0000000000000000000000000000000000000000000000000000000000000000"],["2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0","0000000000000000000000000000000000000000000000000000000000000000"],["602a465ff9c6b5d716cc66cdc721b544a3e6c38fec1a1dc7215eb9b93aba2ea3","7a03ac9277fdc74ec6cc392cfa53202a0f67100d760b3cba4fd84d3d706a17c7"],["1fd5b9a006394a28e933993238de4abb5c193c7013e5e238dea14646c545d14a","7a03ac9277fdc74ec6cc392cfa53202a0f67100d760b3cba4fd84d3d706a17c7"],["602a465ff9c6b5d716cc66cdc721b544a3e6c38fec1a1dc7215eb9b93aba2ea3","05fc536d880238b13933c6d305acdfd5f098eff289f4c345b027b2c28f95e826"],["1fd5b9a006394a28e933993238de4abb5c193c7013e5e238dea14646c545d14a","05fc536d880238b13933c6d305acdfd5f098eff289f4c345b027b2c28f95e826"]]})}},ISO448:class extends g{constructor(e){super({id:"ISO448",ossl:null,type:"edwards",endian:"le",hash:"SHAKE256",prefix:"SigEd448",context:!0,prime:"p448",p:["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff"],a:"1",d:["d78b4bdc 7f0daf19 f24f38c2 9373a2cc","ad461572 42a50f37 809b1da3 412a12e7","9ccc9c81 264cfe9a d0809970 58fb61c4","243cc32d baa156b9"],n:["3fffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff 7cca23e9","c44edb49 aed63690 216cc272 8dc58f55","2378c292 ab5844f3"],h:"4",z:"-1",g:[["79a70b2b 70400553 ae7c9df4 16c792c6","1128751a c9296924 0c25a07d 728bdc93","e21f7787 ed697224 9de732f3 8496cd11","69871309 3e9c04fc"],["7fffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff 80000000","00000000 00000000 00000000 00000000","00000000 00000001"],e],torsion:[[["00000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000"],["00000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000001"]],[["00000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000"],["fffffffffffffffffffffffffffffffffffffffffffffffffffffffe","fffffffffffffffffffffffffffffffffffffffffffffffffffffffe"]],[["00000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000001"],["00000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000"]],[["fffffffffffffffffffffffffffffffffffffffffffffffffffffffe","fffffffffffffffffffffffffffffffffffffffffffffffffffffffe"],["00000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000"]]]})}},ED448:class extends g{constructor(e){super({id:"ED448",ossl:"ED448",type:"edwards",endian:"le",hash:"SHAKE256",prefix:"SigEd448",context:!0,prime:"p448",p:["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff"],a:"1",d:["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff ffff6756"],n:["3fffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff 7cca23e9","c44edb49 aed63690 216cc272 8dc58f55","2378c292 ab5844f3"],h:"4",z:"-1",g:[["4f1970c6 6bed0ded 221d15a6 22bf36da","9e146570 470f1767 ea6de324 a3d3a464","12ae1af7 2ab66511 433b80e1 8b00938e","2626a82b c70cc05e"],["693f4671 6eb6bc24 88762037 56c9c762","4bea7373 6ca39840 87789c1e 05a0c2d7","3ad3ff1c e67c39c4 fdbd132c 4ed7c8ad","9808795b f230fa14"],e],torsion:[[["00000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000"],["00000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000001"]],[["00000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000"],["fffffffffffffffffffffffffffffffffffffffffffffffffffffffe","fffffffffffffffffffffffffffffffffffffffffffffffffffffffe"]],[["00000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000001"],["00000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000"]],[["fffffffffffffffffffffffffffffffffffffffffffffffffffffffe","fffffffffffffffffffffffffffffffffffffffffffffffffffffffe"],["00000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000"]]]})}}},x={__proto__:null,P192:null,P224:null,P256:null,P384:null,P521:null,SECP256K1:null,BRAINPOOLP256:null,BRAINPOOLP384:null,BRAINPOOLP512:null,X25519:null,X448:null,MONT448:null,ED25519:null,ISO448:null,ED448:null};function C(e,t,r){M(e instanceof i),M(!e.red),M(t>>>0===t),M(r>>>0===r);const n=new Array(r),s=1<<t+1,o=e.abs(),a=1|e.sign();let c=0;for(;!o.isZero();){let e=0;o.isOdd()&&(e=o.andln(s-1),e&s>>>1&&(e-=s),o.isubn(e)),n[c++]=e*a;let r=1;o.isZero()||0!==o.andln(s-1)||(r=t+1);for(let t=1;t<r;t++)n[c++]=0;o.iushrn(r)}for(M(c<=r);c<r;c++)n[c]=0;return n}function B(e,t,r){const n=function(e,t,r){M(e instanceof i),M(t instanceof i),M(!e.red),M(!t.red),M(r>>>0===r);const n=[new Array(r),new Array(r)],s=e.abs(),o=t.abs(),a=1|e.sign(),c=1|t.sign();let u=0,f=0,h=0;for(;s.cmpn(-f)>0||o.cmpn(-h)>0;){let e=s.andln(3)+f&3,t=o.andln(3)+h&3,r=0,i=0;if(3===e&&(e=-1),3===t&&(t=-1),1&e){const n=s.andln(7)+f&7;r=3!==n&&5!==n||2!==t?e:-e}if(1&t){const r=o.andln(7)+h&7;i=3!==r&&5!==r||2!==e?t:-t}n[0][u]=r*a,n[1][u]=i*c,2*f===r+1&&(f=1-f),2*h===i+1&&(h=1-h),s.iushrn(1),o.iushrn(1),u+=1}for(M(u<=r);u<r;u++)n[0][u]=0,n[1][u]=0;return n}(e,t,r),s=new Array(r);for(let i=0;i<r;i++){const e=n[0][i],t=n[1][i];s[i]=u[3*(e+1)+(t+1)]}return s}function M(e,t){if(!e){const e=new Error(t||"Assertion failed");throw Error.captureStackTrace&&Error.captureStackTrace(e,M),e}}function N(e){M(e instanceof i);try{return[1,e.redSqrt()]}catch(t){if("X is not a square mod P."===t.message)return[0,e.clone()];throw t}}function P(e,t){M(e instanceof i),M(t instanceof i);try{return[1,e.redDivSqrt(t)]}catch(r){if("Not invertible."===r.message||"X is not a square mod P."===r.message)return[0,e.clone()];throw r}}function O(e){return i.randomBits(e,32).toNumber()}function D(e,t){const r=new WeakMap;return function(n,i){const s=1&i,o=r.get(n);if(o&&null!==o[s])return o[s];const a=e.call(t,n,i);return r.has(n)||r.set(n,[null,null]),r.get(n)[s]=a,a}}t.Curve=f,t.Point=h,t.ShortCurve=l,t.ShortPoint=d,t.JPoint=p,t.MontCurve=b,t.MontPoint=y,t.XPoint=m,t.EdwardsCurve=g,t.EdwardsPoint=v,t.curves=R,t.curve=function(e,...t){M("string"==typeof e);const r=e.toUpperCase();let n=x[r];if(!n){const i=R[r];if(!i)throw new Error('Curve not found: "'.concat(e,'".'));n=new i(...t),x[r]=n}return n},t.register=function(e,t){M("string"==typeof e),M("function"==typeof t);const r=e.toUpperCase();if(R[r])throw new Error('Curve already registered: "'.concat(e,'".'));R[r]=t,x[r]=null}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports=r(902)},function(e,t,r){"use strict";(function(t){const{custom:n}=r(347),i=["","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"],s=[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],o=[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],a={p192:null,p224:null,p521:null,k256:null,p25519:null,p448:null},c=0,u=1,f=2,h=3,l=4,d=7,p="function"==typeof BigInt;class b{constructor(e,t,r){this.words=[0],this.length=1,this.negative=0,this.red=null,this.from(e,t,r)}_iadd(e,t){let r=0,n=0;for(e.length<t.length&&([e,t]=[t,e]),e!==this&&this._alloc(e.length);n<t.length;n++){const i=(0|e.words[n])+(0|t.words[n])+r;this.words[n]=67108863&i,r=i>>>26}for(;0!==r&&n<e.length;n++){const t=(0|e.words[n])+r;this.words[n]=67108863&t,r=t>>>26}if(this.length=e.length,0!==r)this._alloc(this.length+1),this.words[this.length++]=r;else if(e!==this)for(;n<e.length;n++)this.words[n]=e.words[n];return this}_iaddn(e){if(this.words[0]+=e,this.words[0]<67108864)return this;let t=0;for(this._alloc(this.length+1),this.words[this.length]=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,this.words[t+1]+=1;return this.length=Math.max(this.length,t+1),this}iadd(e){if(R(b.isBN(e),"num","bignum"),this.negative===e.negative)this._iadd(this,e);else{const t=this.ucmp(e);if(0===t)return this.words[0]=0,this.length=1,this.negative=0,this;t<0?(this._isub(e,this),this.negative^=1):this._isub(this,e)}return this}iaddn(e){R(P(e),"num","smi");const t=e<0|0;return t&&(e=-e),this.negative===t?this._iaddn(e):1===this.length&&this.words[0]<e?(this.words[0]=e-this.words[0],this.negative^=1):this._isubn(e),this}add(e){return R(b.isBN(e),"num","bignum"),e.length>this.length?e.clone().iadd(this):this.clone().iadd(e)}addn(e){return this.clone().iaddn(e)}_isub(e,t){let r=0,n=0;for(T(e.length>=t.length),e!==this&&this._alloc(e.length);n<t.length;n++){const i=(0|e.words[n])-(0|t.words[n])+r;r=i>>26,this.words[n]=67108863&i}for(;0!==r&&n<e.length;n++){const t=(0|e.words[n])+r;r=t>>26,this.words[n]=67108863&t}if(T(0===r),e!==this)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=Math.max(this.length,n),this._strip()}_isubn(e){if(this.words[0]-=e,this.words[0]>=0)return this._normalize();T(1!==this.length),this._alloc(this.length+1);for(let t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.words[this.length]=0,this._strip()}isub(e){if(R(b.isBN(e),"num","bignum"),this.negative!==e.negative)this._iadd(this,e);else{const t=this.ucmp(e);if(0===t)return this.words[0]=0,this.length=1,this.negative=0,this;t<0?(this._isub(e,this),this.negative^=1):this._isub(this,e)}return this}isubn(e){R(P(e),"num","smi");const t=e<0|0;return t&&(e=-e),this.negative!==t?this._iaddn(e):1===this.length&&this.words[0]<e?(this.words[0]=e-this.words[0],this.negative^=1):this._isubn(e),this}sub(e){return this.clone().isub(e)}subn(e){return this.clone().isubn(e)}_mul(e,t){if(R(b.isBN(e),"num","bignum"),R(b.isBN(t),"out","bignum"),10===this.length&&10===e.length)return K(this,e,t);const r=this.length+e.length;return r<63?F(this,e,t):r<1024?q(this,e,t):function(e,t,r){if(!p||e.length+t.length>82595519)return q(e,t,r);const n=BigInt(0),i=BigInt(67108863),s=BigInt(26);let o=e.toBigInt()*t.toBigInt();const a=o<n|0;a&&(o=-o);let c=0;for(;o>n;)r.words[c++]=Number(o&i),o>>=s;0===c&&(r.words[c++]=0);return r.length=c,r.negative=a,r}(this,e,t)}imul(e){return this.mul(e)._move(this)}imuln(e){R(P(e),"num","smi");const t=e<0|0;t&&(e=-e);let r=0;for(let n=0;n<this.length;n++){const t=this.words[n]*e,i=(67108863&t)+(67108863&r);r>>=26,r+=t/67108864|0,r+=i>>>26,this.words[n]=67108863&i}return this.negative^=t,0!==r?(this._alloc(this.length+1),this.words[this.length++]=r):this._strip(),this}mul(e){R(b.isBN(e),"num","bignum");const t=this.length+e.length,r=new b;r.words=new Array(t);for(let n=0;n<t;n++)r.words[n]=0;return this._mul(e,r)}muln(e){return this.clone().imuln(e)}mulShift(e,t){R(b.isBN(e),"num","bignum"),R(t>>>0===t,"bits","uint32");const r=this.mul(e),n=r.utestn(t-1);return r.iushrn(t),this.negative^e.negative?r.isubn(n):r.iaddn(n)}_div(e,t){R(b.isBN(e),"num","bignum"),T((t&d)===t),T(t!==c);const r=this,n=e;if(M(!n.isZero()),r.isZero())return[new b(0),new b(0)];const i=r.negative,s=n.negative;r.negative=0,n.negative=0;let o=null,a=null;return r.ucmp(n)<0?(t&u&&(o=new b(0)),t&f&&(a=r.clone())):1===n.length?(t&u&&(o=r.quon(n.words[0])),t&f&&(a=r.remn(n.words[0]))):[o,a]=r._wordDiv(n,t),r.negative=i,n.negative=s,t&u&&(o.negative=r.negative^n.negative,o._normalize()),t&f&&(a.negative=r.negative,a._normalize()),t&l&&(t&u&&(T(0!=(t&f)),0!==a.negative&&(0!==n.negative?o.iaddn(1):o.isubn(1))),t&f&&0!==a.negative&&(0!==n.negative?a.isub(n):a.iadd(n))),[o,a]}_wordDiv(e,t){let r,n=this.clone(),i=e,s=null;const o=0|i.words[i.length-1],a=26-D(o);0!==a?(i=i.clone(),n.iushln(a),i.iushln(a),r=0|i.words[i.length-1]):r=o;const c=n.length-i.length;if(T(c>=0),t&u){s=new b(0),s.length=c+1,s.words=new Array(s.length);for(let e=0;e<s.length;e++)s.words[e]=0}const h=n.clone();h._ishlnsubmul(i,1,c),0===h.negative&&(s&&(s.words[c]=1),n=h);for(let u=c-1;u>=0;u--){const e=(67108864*n.words[i.length+u]+n.words[i.length+u-1])/r|0;let t=Math.min(e,67108863);for(n._ishlnsubmul(i,t,u);0!==n.negative;)t-=1,n.negative=0,n._ishlnsubmul(i,1,u),n.ineg();s&&(s.words[u]=t)}return s&&s._strip(),t&f&&0!==a&&n.iushrn(a),[s,n]}_ishlnsubmul(e,t,r){let n=0,i=0;for(this._expand(e.length+r);i<e.length;i++){const s=(0|this.words[i+r])+n,o=e.words[i]*t,a=s-(67108863&o);n=(a>>26)-(o/67108864|0),this.words[i+r]=67108863&a}for(;i<this.length-r;i++){const e=(0|this.words[i+r])+n;n=e>>26,this.words[i+r]=67108863&e}if(0===n)return this._strip();T(-1===n),n=0;for(let s=0;s<this.length;s++){const e=-(0|this.words[s])+n;n=e>>26,this.words[s]=67108863&e}return this.negative=1,this._strip()}quorem(e){return this._div(e,h)}iquo(e){return this.quo(e)._move(this)}iquon(e){R(P(e),"num","smi"),M(0!==e);const t=e<0|0;t&&(e=-e);let r=0;for(let n=this.length-1;n>=0;n--){const t=(0|this.words[n])+67108864*r;this.words[n]=t/e|0,r=t%e}return this.negative^=t,this._strip()}quo(e){return this._div(e,u)[0]}quon(e){return this.clone().iquon(e)}irem(e){return this.rem(e)._move(this)}iremn(e){let t=this.remrn(e);return t<0&&(t=-t),this.words[0]=t,this.length=1,this._normalize()}rem(e){return this._div(e,f)[1]}remn(e){return this.clone().iremn(e)}remrn(e){R(P(e),"num","smi"),M(0!==e),e<0&&(e=-e);const t=(1<<26)%e;let r=0;for(let n=this.length-1;n>=0;n--)r=(t*r+(0|this.words[n]))%e;return 0!==this.negative?0|-r:r}divmod(e){return this._div(e,h|l)}idiv(e){return this.div(e)._move(this)}idivn(e){if(0===this.negative)return this.iquon(e);const t=this.remrn(e);return this.iquon(e),t<0&&(e<0?this.iaddn(1):this.isubn(1)),this}div(e){return this._div(e,h|l)[0]}divn(e){return this.clone().idivn(e)}imod(e){return this.ucmp(e)<0?(0!==this.negative&&(this._isub(e,this),this.negative=0),this):this.mod(e)._move(this)}imodn(e){return this.words[0]=this.modrn(e),this.length=1,this.negative=0,this}mod(e){return this._div(e,f|l)[1]}modn(e){return this.clone().imodn(e)}modrn(e){R(P(e),"num","smi");let t=this.remrn(e);return t<0&&(e<0?t-=e:t+=e),t}divRound(e){const[t,r]=this.quorem(e);if(r.isZero())return t;const n=1&e.words[0];e.iushrn(1);const i=r.ucmp(e);return e.iushln(1),e.words[0]|=n,i<0||e.isOdd()&&0===i?t:this.negative^e.negative?t.isubn(1):t.iaddn(1)}ipow(e){return this.pow(e)._move(this)}ipown(e){return this.pown(e)._move(this)}pow(e){R(b.isBN(e),"num","bignum");let t=D(e.words[e.length-1]),r=new b(1);for(let n=e.length-1;n>=0;n--){const i=e.words[n];for(let e=t-1;e>=0;e--)r=r.sqr(),i>>e&1&&(r=r.mul(this));t=26}return r}pown(e){if(R(P(e),"num","smi"),e<0&&(e=-e),0===e)return new b(1);if(1===e)return this.clone();let t=this;for(let r=D(e)-2;r>=0;r--)t=t.sqr(),e>>r&1&&(t=t.mul(this));return t}isqr(){return this.imul(this)}sqr(){return this.mul(this)}_rootrem(e,t){if(R(e>>>0===e,"num","uint32"),0===e)throw new RangeError("Zeroth root.");if(~e&this.negative)throw new RangeError("Negative with even root.");if(this.ucmpn(1)<=0)return[this.clone(),new b(0)];let r,n,i=new b(0),s=b.shift(1,this.bitLength()/e+1|0);if(0!==this.negative&&s.ineg(),2===e)do{i=s,s=this.quo(i),s.iadd(i),s.iushrn(1)}while(s.ucmp(i)<0);else do{i=s,s=i.pown(e-1),s=this.quo(s),r=i.muln(e-1),s.iadd(r),s=s.quon(e)}while(s.ucmp(i)<0);return t&&(s=i.pown(e),n=this.sub(s)),[i,n]}rootrem(e){return this._rootrem(e,1)}iroot(e){return this.root(e)._move(this)}root(e){return this._rootrem(e,0)[0]}isPower(e){if(R(e>>>0===e,"num","uint32"),0===e||~e&this.negative)return!1;const[,t]=this.rootrem(e);return 0===t.sign()}sqrtrem(){return this.rootrem(2)}isqrt(){return this.sqrt()._move(this)}sqrt(){return this.root(2)}isSquare(){return this.isPower(2)}iand(e){R(b.isBN(e),"num","bignum");let t=this,r=e;if(t===r)return t;if(0==(t.negative|r.negative))return t.iuand(r);if(1==(t.negative&r.negative))return t.iaddn(1),r.iaddn(1),t.iuor(r),t.isubn(1),r.isubn(1),t;0!==t.negative&&([t,r]=[r.clone(),t]);const n=t.bitLength();return r.iaddn(1),r.inotn(n),t.iuand(r),r.inotn(n),r.isubn(1),t._move(this)}iandn(e){return R(P(e),"num","smi"),0!=(this.negative|e<0)?this.iand(new b(e)):(this.words[0]&=e,this.length=1,this)}and(e){return this.clone().iand(e)}andn(e){return this.clone().iandn(e)}andrn(e){if(R(P(e),"num","smi"),0!=(this.negative|e<0)){const t=this.iand(new b(e));if(t.length>1)throw new RangeError("Number exceeds 26 bits.");return 0!==t.negative?-t.words[0]:t.words[0]}return this.words[0]&e}iuand(e){R(b.isBN(e),"num","bignum"),this.length=Math.min(this.length,e.length);for(let t=0;t<this.length;t++)this.words[t]&=e.words[t];return this._strip()}iuandn(e){return R(P(e),"num","smi"),this.words[0]&=Math.abs(e),this.length=1,this._normalize()}uand(e){return this.clone().iuand(e)}uandn(e){return this.clone().iuandn(e)}uandrn(e){R(P(e),"num","smi");const t=this.words[0]&Math.abs(e);return 0!==this.negative?0|-t:t}ior(e){R(b.isBN(e),"num","bignum");let t=this,r=e;return t===r?t:0==(t.negative|r.negative)?t.iuor(r):1==(t.negative&r.negative)?(t.iaddn(1),r.iaddn(1),t.iuand(r),t.isubn(1),r.isubn(1),t):(r=r.clone(),0!==t.negative&&([t,r]=[r,t]),r.iaddn(1),t.inotn(r.bitLength()),r.iuand(t),r.isubn(1),r._move(this))}iorn(e){return R(P(e),"num","smi"),0!=(this.negative|e<0)?this.ior(new b(e)):(this.words[0]|=e,this)}or(e){return this.clone().ior(e)}orn(e){return this.clone().iorn(e)}iuor(e){R(b.isBN(e),"num","bignum"),this._expand(e.length);for(let t=0;t<e.length;t++)this.words[t]|=e.words[t];return this}iuorn(e){return R(P(e),"num","smi"),this.words[0]|=Math.abs(e),this}uor(e){return this.clone().iuor(e)}uorn(e){return this.clone().iuorn(e)}ixor(e){R(b.isBN(e),"num","bignum");let t=this,r=e;return t===r?(t.words[0]=0,t.length=1,t.negative=0,t):0==(t.negative|r.negative)?t.iuxor(r):1==(t.negative&r.negative)?(t.iaddn(1),r.iaddn(1),t.iuxor(r),t.ineg(),r.isubn(1),t):(0!==t.negative&&([t,r]=[r.clone(),t]),r.iaddn(1),t.iuxor(r),t.iaddn(1),t.ineg(),r.isubn(1),t._move(this))}ixorn(e){return R(P(e),"num","smi"),0!=(this.negative|e<0)?this.ixor(new b(e)):(this.words[0]^=e,this)}xor(e){return this.clone().ixor(e)}xorn(e){return this.clone().ixorn(e)}iuxor(e){R(b.isBN(e),"num","bignum");let t=this,r=e;t.length<r.length&&([t,r]=[r,t]);let n=0;for(;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(t!==this)for(this._alloc(t.length);n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this._strip()}iuxorn(e){return R(P(e),"num","smi"),this.words[0]^=Math.abs(e),this._normalize()}uxor(e){return this.clone().iuxor(e)}uxorn(e){return this.clone().iuxorn(e)}inot(){return 0!==this.negative?this.ineg().isubn(1):this.iaddn(1).ineg(),this}not(){return this.clone().inot()}inotn(e){R(e>>>0===e,"width","uint32");const t=e%26;let r=Math.ceil(e/26),n=0;for(this._expand(r),t>0&&(r-=1);n<r;n++)this.words[n]^=67108863;return t>0&&(this.words[n]^=(1<<t)-1),this._strip()}notn(e){return this.clone().inotn(e)}ishl(e){return R(b.isBN(e),"bits","bignum"),R(e.bitLength()<=32,"bits","uint32"),this.ishln(e.toNumber())}ishln(e){return this.iushln(e)}shl(e){return this.clone().ishl(e)}shln(e){return this.clone().ishln(e)}iushl(e){return R(b.isBN(e),"bits","bignum"),R(e.bitLength()<=32,"bits","uint32"),this.iushln(e.toNumber())}iushln(e){R(e>>>0===e,"bits","uint32");const t=e%26,r=(e-t)/26,n=(1<<t)-1<<26-t;if(0!==t){let e=0;for(let r=0;r<this.length;r++){const i=this.words[r]&n,s=(0|this.words[r])-i<<t;this.words[r]=s|e,e=i>>>26-t}0!==e&&(this._alloc(this.length+1),this.words[this.length++]=e)}if(0!==r){this._alloc(this.length+r);for(let e=this.length-1;e>=0;e--)this.words[e+r]=this.words[e];for(let e=0;e<r;e++)this.words[e]=0;this.length+=r}return this._strip()}ushl(e){return this.clone().iushl(e)}ushln(e){return this.clone().iushln(e)}_split(e,t){const r=e%26,n=Math.min((e-r)/26,this.length),i=(1<<r)-1;if(t){t._alloc(n);for(let e=0;e<n;e++)t.words[e]=this.words[e];t.length=n}if(0===n);else if(this.length>n){this.length-=n;for(let e=0;e<this.length;e++)this.words[e]=this.words[e+n]}else this.words[0]=0,this.length=1;let s=0;if(0!==r)for(let o=this.length-1;o>=0;o--){const e=0|this.words[o];this.words[o]=s<<26-r|e>>>r,s=e&i}return t&&(0!==s?(t._alloc(t.length+1),t.words[t.length++]=s):(0===t.length&&(t.words[t.length++]=0),t._strip())),this._strip()}ishr(e){return R(b.isBN(e),"bits","bignum"),R(e.bitLength()<=32,"bits","uint32"),this.ishrn(e.toNumber())}ishrn(e){return R(e>>>0===e,"bits","uint32"),0!==this.negative?(this.iaddn(1),this.iushrn(e),this.isubn(1),this):this.iushrn(e)}shr(e){return this.clone().ishr(e)}shrn(e){return this.clone().ishrn(e)}iushr(e){return R(b.isBN(e),"bits","bignum"),R(e.bitLength()<=32,"bits","uint32"),this.iushrn(e.toNumber())}iushrn(e){return R(e>>>0===e,"bits","uint32"),this._split(e,null)}ushr(e){return this.clone().iushr(e)}ushrn(e){return this.clone().iushrn(e)}setn(e,t){return R(e>>>0===e,"bit","uint32"),0!==this.negative?(this.iaddn(1),this.usetn(e,!t),this.isubn(1),this):this.usetn(e,t)}usetn(e,t){R(e>>>0===e,"bit","uint32");const r=e%26,n=(e-r)/26;return this._expand(n+1),t?this.words[n]|=1<<r:this.words[n]&=~(1<<r),this._strip()}testn(e){R(e>>>0===e,"bit","uint32");const t=e%26,r=(e-t)/26;if(this.length<=r)return this.negative;const n=this.words[r],i=n>>t&1;if(0!==this.negative){if(t>0&&n&(1<<t)-1)return 1^i;let e=r;for(;e--;)if(this.words[e]>0)return 1^i}return i}utestn(e){R(e>>>0===e,"bit","uint32");const t=e%26,r=(e-t)/26;return this.length<=r?0:this.words[r]>>t&1}imaskn(e){return R(e>>>0===e,"bits","uint32"),0!==this.negative&&(this.iaddn(1),this.inotn(e+1),this.ineg()),this.iumaskn(e)}maskn(e){return this.clone().imaskn(e)}iumaskn(e){R(e>>>0===e,"bits","uint32");const t=e%26;let r=(e-t)/26;return this.length<=r?this:(0!==t&&(r+=1),this.length=Math.min(r,this.length),0!==t&&(this.words[this.length-1]&=(1<<t)-1),0===this.length&&(this.words[this.length++]=0),this._strip())}umaskn(e){return this.clone().iumaskn(e)}andln(e){return this.words[0]&e}bit(e){return this.utestn(e)}bits(e,t){R(e>>>0===e,"pos","uint32"),R(t>>>0===t,"width","uint32"),R(t<=26,"width","width");const r=e%26,n=(e-r)/26;if(n>=this.length)return 0;let i=this.words[n]>>r&(1<<t)-1;if(r+t>26&&n+1<this.length){const e=r+t-26;i|=(this.words[n+1]&(1<<e)-1)<<26-r}return i}ineg(){return this.isZero()||(this.negative^=1),this}neg(){return this.clone().ineg()}iabs(){return this.negative=0,this}abs(){return this.clone().iabs()}cmp(e){if(R(b.isBN(e),"num","bignum"),this.negative!==e.negative)return e.negative-this.negative;const t=this.ucmp(e);return 0!==this.negative?0|-t:t}cmpn(e){R(P(e),"num","smi");const t=e<0|0;if(this.negative!==t)return t-this.negative;const r=this.ucmpn(e);return 0!==this.negative?0|-r:r}eq(e){return 0===this.cmp(e)}eqn(e){return 0===this.cmpn(e)}gt(e){return this.cmp(e)>0}gtn(e){return this.cmpn(e)>0}gte(e){return this.cmp(e)>=0}gten(e){return this.cmpn(e)>=0}lt(e){return this.cmp(e)<0}ltn(e){return this.cmpn(e)<0}lte(e){return this.cmp(e)<=0}lten(e){return this.cmpn(e)<=0}sign(){return 0!==this.negative?-1:1===this.length&&0===this.words[0]?0:1}isZero(){return 1===this.length&&0===this.words[0]}isNeg(){return 0!==this.negative}isPos(){return 0===this.negative}isOdd(){return 1==(1&this.words[0])}isEven(){return 0==(1&this.words[0])}ucmp(e){if(R(b.isBN(e),"num","bignum"),this.length<e.length)return-1;if(this.length>e.length)return 1;for(let t=this.length-1;t>=0;t--){const r=0|this.words[t],n=0|e.words[t];if(r!==n)return(r>n)-(r<n)}return 0}ucmpn(e){if(R(P(e),"num","smi"),this.length>1)return 1;const t=0|this.words[0];return e<0&&(e=-e),(t>e)-(t<e)}legendre(e){const t=p?b.red(e):b.mont(e);return this.toRed(t).redLegendre()}jacobi(e){if(R(b.isBN(e),"num","bignum"),e.isZero()||e.isEven())throw new Error("jacobi: `num` must be odd.");let t=this._cloneNormal(),r=e.clone(),n=1;for(r.isNeg()&&(t.isNeg()&&(n=-1),r.ineg());;){if(0===r.cmpn(1))return n;if(t.isZero())return 0;if(t.imod(r),t.isZero())return 0;const e=t.zeroBits();if(1&e){const e=r.andln(7);3!==e&&5!==e||(n=-n)}const i=t.iushrn(e);3===r.andln(3)&&3===i.andln(3)&&(n=-n),t=r,r=i}}kronecker(e){R(b.isBN(e),"num","bignum");const t=[0,1,0,-1,0,-1,0,1];let r=this._cloneNormal(),n=e.clone(),i=1;if(n.isZero())return 0===r.ucmpn(1)?i:0;if(!r.isOdd()&&!n.isOdd())return 0;const s=n.zeroBits();for(n.iushrn(s),1&s&&(i=t[r.andln(7)]),n.isNeg()&&(r.isNeg()&&(i=-i),n.ineg());;){if(r.isZero())return 0===n.cmpn(1)?i:0;const e=r.zeroBits();r.iushrn(e),1&e&&(i*=t[n.andln(7)]);(r.words[0]^67108863*r.negative)&n.words[0]&2&&(i=-i),n.imod(r),[r,n]=[n,r],n.negative=0}}igcd(e){return this.gcd(e)._move(this)}gcd(e){if(R(b.isBN(e),"num","bignum"),this.isZero())return e.abs();if(e.isZero())return this.abs();let t=this.clone(),r=e.clone();t.negative=0,r.negative=0;const n=t._factor2(r);for(0!==n&&(t.iushrn(n),r.iushrn(n));;){const e=t.zeroBits(),n=r.zeroBits();0!==e&&t.iushrn(e),0!==n&&r.iushrn(n);const i=t.ucmp(r);if(i<0)[t,r]=[r,t];else if(0===i||0===r.ucmpn(1))break;t._isub(t,r)}return r.iushln(n)}ilcm(e){return this.lcm(e)._move(this)}lcm(e){return R(b.isBN(e),"num","bignum"),this.isZero()||e.isZero()?new b(0):this.quo(this.gcd(e)).mul(e).iabs()}egcd(e){if(R(b.isBN(e),"num","bignum"),this.isZero())return[new b(0),new b(e.sign()),e.abs()];if(e.isZero())return[new b(this.sign()),new b(0),this.abs()];const t=this.clone(),r=e.clone();t.negative=0,r.negative=0;const n=new b(1),i=new b(0),s=new b(0),o=new b(1),a=t._factor2(r);0!==a&&(t.iushrn(a),r.iushrn(a));const c=r.clone(),u=t.clone();for(;!t.isZero();){let e=0;for(let r=1;0==(t.words[0]&r)&&e<26;r<<=1)e+=1;if(e>0)for(t.iushrn(e);e>0;)(n.isOdd()||i.isOdd())&&(n.iadd(c),i.isub(u)),n.iushrn(1),i.iushrn(1),e-=1;let a=0;for(let t=1;0==(r.words[0]&t)&&a<26;t<<=1)a+=1;if(a>0)for(r.iushrn(a);a>0;)(s.isOdd()||o.isOdd())&&(s.iadd(c),o.isub(u)),s.iushrn(1),o.iushrn(1),a-=1;t.cmp(r)>=0?(t.isub(r),n.isub(s),i.isub(o)):(r.isub(t),s.isub(n),o.isub(i))}return 0!==this.negative&&s.ineg(),0!==e.negative&&o.ineg(),[s,o,r.iushln(a)]}iinvert(e){return this.invert(e)._move(this)}invert(e){if(R(b.isBN(e),"num","bignum"),x(e.sign()>0,"invert"),0===e.cmpn(1))throw new RangeError("Not invertible.");const[t,,r]=this.egcd(e);if(0!==r.cmpn(1))throw new RangeError("Not invertible.");return t.imod(e)}ifermat(e){return this.fermat(e)._move(this)}fermat(e){const t=p?b.red(e):b.mont(e);return this.toRed(t).redFermat().fromRed()}ipowm(e,t,r){return this.powm(e,t,r)._move(this)}powm(e,t,r){const n=!p&&r?b.mont(t):b.red(t);return this.toRed(n).redPow(e).fromRed()}ipowmn(e,t,r){return this.powmn(e,t,r)._move(this)}powmn(e,t,r){const n=r?b.mont(t):b.red(t);return this.toRed(n).redPown(e).fromRed()}isqrtm(e){return this.sqrtm(e)._move(this)}sqrtm(e){let t;return R(b.isBN(e),"p","bignum"),t=3===e.andln(3)||5===e.andln(7)?b.red(e):b.mont(e),this.toRed(t).redSqrt().fromRed()}isqrtpq(e,t){return this.sqrtpq(e,t)._move(this)}sqrtpq(e,t){const r=this.sqrtm(e),n=this.sqrtm(t),[i,s]=e.egcd(t),o=n.mul(i).mul(e),a=r.mul(s).mul(t),c=e.mul(t);return o.iadd(a).imod(c)}isPrime(e,t,r){return R(t>>>0===t,"reps","uint32"),!!this.isPrimeMR(e,t+1,!0)&&!!this.isPrimeLucas(r)}isPrimeMR(e,t,r=!1){R(t>>>0===t,"reps","uint32"),R(t>0,"reps","integer"),R("boolean"==typeof r,"force2","boolean");const n=this;if(n.cmpn(7)<0)return 0===n.cmpn(2)||0===n.cmpn(3)||0===n.cmpn(5);if(n.isEven())return!1;const i=n.subn(1),s=i.subn(2),o=i.zeroBits(),a=i.ushrn(o),c=b.red(n),u=i.toRed(c),f=new b(1).toRed(c);e:for(let h=0;h<t;h++){let n;h===t-1&&r?n=new b(2):(n=b.random(e,0,s),n.iaddn(2));let i=n.toRed(c).redPow(a);if(0!==i.cmp(f)&&0!==i.cmp(u)){for(let e=1;e<o;e++){if(i=i.redSqr(),0===i.cmp(u))continue e;if(0===i.cmp(f))return!1}return!1}}return!0}isPrimeLucas(e=0){R(e>>>0===e,"limit","uint32");const t=this;if(t.cmpn(1)<=0)return!1;if(t.isEven())return 0===t.cmpn(2);let r=3;for(;;){if(r>1e4)throw new Error("Cannot find (D/n) = -1 for ".concat(t.toString(10),"."));if(0!==e&&r>e)return!1;const n=new b(r*r-4).jacobi(t);if(-1===n)break;if(0===n)return 0===t.cmpn(r+2);if(40===r&&t.isSquare())return!1;r+=1}const n=t.addn(1),i=n.zeroBits(),s=t.subn(2);let o=new b(2),a=new b(r);n.iushrn(i);for(let c=n.bitLength();c>=0;c--)n.utestn(c)?(o=o.mul(a).iadd(t).isubn(r).imod(t),a=a.sqr().iadd(s).imod(t)):(a=a.mul(o).iadd(t).isubn(r).imod(t),o=o.sqr().iadd(s).imod(t));if(0===o.cmpn(2)||0===o.cmp(s)){let e=o.muln(r),n=a.ushln(1);if(e.cmp(n)<0&&([e,n]=[n,e]),e.isub(n).imod(t).isZero())return!0}for(let c=0;c<i-1;c++){if(o.isZero())return!0;if(0===o.cmpn(2))return!1;o=o.sqr().isubn(2).imod(t)}return!1}toTwos(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()}fromTwos(e){return R(e>>>0===e,"width","uint32"),x(e>0,"width"),this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()}toRed(e){if(R(e instanceof k,"ctx","reduction context"),this.red)throw new Error("Already in reduction context.");return e.convertTo(this)}fromRed(){return C(this.red,"fromRed"),this.red.convertFrom(this)}forceRed(e){if(R(e instanceof k,"ctx","reduction context"),this.red){if(!e.m.eq(this.red.m)||e.mont!==this.red.mont)throw new Error("Already in reduction context.")}else x(0===this.negative,"red"),x(this.ucmp(e.m)<0,"red");return this.clone()._forceRed(e)}redIAdd(e){return R(b.isBN(e),"num","bignum"),C(this.red,"redIAdd"),this.red.iadd(this,e)}redAdd(e){return R(b.isBN(e),"num","bignum"),C(this.red,"redAdd"),this.red.add(this,e)}redIAddn(e){return R(P(e),"num","smi"),C(this.red,"redIAddn"),this.red.iaddn(this,e)}redAddn(e){return R(P(e),"num","smi"),C(this.red,"redAddn"),this.red.addn(this,e)}redISub(e){return R(b.isBN(e),"num","bignum"),C(this.red,"redISub"),this.red.isub(this,e)}redSub(e){return R(b.isBN(e),"num","bignum"),C(this.red,"redSub"),this.red.sub(this,e)}redISubn(e){return R(P(e),"num","smi"),C(this.red,"redISubn"),this.red.isubn(this,e)}redSubn(e){return R(P(e),"num","smi"),C(this.red,"redSubn"),this.red.subn(this,e)}redIMul(e){return R(b.isBN(e),"num","bignum"),C(this.red,"redIMul"),this.red.imul(this,e)}redMul(e){return R(b.isBN(e),"num","bignum"),C(this.red,"redMul"),this.red.mul(this,e)}redIMuln(e){return R(P(e),"num","smi"),C(this.red,"redIMuln"),this.red.imuln(this,e)}redMuln(e){return R(P(e),"num","smi"),C(this.red,"redMuln"),this.red.muln(this,e)}redIDiv(e){return R(b.isBN(e),"num","bignum"),C(this.red,"redIDiv"),this.red.idiv(this,e)}redDiv(e){return R(b.isBN(e),"num","bignum"),C(this.red,"redDiv"),this.red.div(this,e)}redIDivn(e){return R(P(e),"num","smi"),C(this.red,"redIDivn"),this.red.idivn(this,e)}redDivn(e){return R(P(e),"num","smi"),C(this.red,"redDivn"),this.red.divn(this,e)}redIPow(e){return R(b.isBN(e),"num","bignum"),C(this.red,"redIPow"),B(!e.red,"redIPow"),this.red.ipow(this,e)}redPow(e){return R(b.isBN(e),"num","bignum"),C(this.red,"redPow"),B(!e.red,"redPow"),this.red.pow(this,e)}redIPown(e){return R(P(e),"num","smi"),C(this.red,"redIPown"),this.red.ipown(this,e)}redPown(e){return R(P(e),"num","smi"),C(this.red,"redPown"),this.red.pown(this,e)}redISqr(){return C(this.red,"redISqr"),this.red.isqr(this)}redSqr(){return C(this.red,"redSqr"),this.red.sqr(this)}redISqrt(){return C(this.red,"redISqrt"),this.red.isqrt(this)}redSqrt(){return C(this.red,"redSqrt"),this.red.sqrt(this)}redIDivSqrt(e){return C(this.red,"redIDivSqrt"),this.red.idivsqrt(this,e)}redDivSqrt(e){return C(this.red,"redDivSqrt"),this.red.divsqrt(this,e)}redIsSquare(){return C(this.red,"redIsSquare"),this.red.isSquare(this)}redIShl(e){return R(b.isBN(e),"num","bignum"),C(this.red,"redIShl"),B(!e.red,"redIShl"),this.red.ishl(this,e)}redShl(e){return R(b.isBN(e),"num","bignum"),C(this.red,"redShl"),B(!e.red,"redShl"),this.red.shl(this,e)}redIShln(e){return R(e>>>0===e,"num","uint32"),C(this.red,"redIShln"),this.red.ishln(this,e)}redShln(e){return R(e>>>0===e,"num","uint32"),C(this.red,"redShln"),this.red.shln(this,e)}redINeg(){return C(this.red,"redINeg"),this.red.ineg(this)}redNeg(){return C(this.red,"redNeg"),this.red.neg(this)}redEq(e){return R(b.isBN(e),"num","bignum"),C(this.red,"redEq"),this.red.eq(this,e)}redEqn(e){return R(P(e),"num","smi"),C(this.red,"redEqn"),this.red.eqn(this,e)}redIsHigh(){return C(this.red,"redIsHigh"),this.red.isHigh(this)}redIsLow(){return C(this.red,"redIsLow"),this.red.isLow(this)}redIsOdd(){return C(this.red,"redIsOdd"),this.red.isOdd(this)}redIsEven(){return C(this.red,"redIsEven"),this.red.isEven(this)}redLegendre(){return C(this.red,"redLegendre"),this.red.legendre(this)}redJacobi(){return C(this.red,"redJacobi"),this.red.jacobi(this)}redKronecker(){return C(this.red,"redKronecker"),this.red.kronecker(this)}redIInvert(){return C(this.red,"redIInvert"),this.red.iinvert(this)}redInvert(){return C(this.red,"redInvert"),this.red.invert(this)}redIFermat(){return C(this.red,"redIFermat"),this.red.ifermat(this)}redFermat(){return C(this.red,"redFermat"),this.red.fermat(this)}_move(e){return e.words=this.words,e.length=this.length,e.negative=this.negative,e.red=this.red,e}_alloc(e){for(;this.words.length<e;)this.words.push(0);return this}_expand(e){for(this._alloc(e);this.length<e;)this.words[this.length++]=0;return this}_strip(){for(;this.length>1&&0===this.words[this.length-1];)this.length-=1;return this._normalize()}_normalize(){return T(this.length>0),1===this.length&&0===this.words[0]&&(this.negative=0),this}_check(){return T(this.length>0),T(this.length<=this.words.length),1===this.length?(0===this.words[0]&&T(0===this.negative),this):(T(0!==this.words[this.length-1]),this)}_invertp(e){if(R(b.isBN(e),"p","bignum"),T(0===this.negative),T(e.sign()>0),this.isZero()||0===e.cmpn(1))throw new RangeError("Not invertible.");const t=this.clone(),r=e.clone(),n=new b(1),i=new b(0),s=r.clone();for(;t.cmpn(1)>0&&r.cmpn(1)>0;){let e=0;for(let r=1;0==(t.words[0]&r)&&e<26;r<<=1)e+=1;if(e>0)for(t.iushrn(e);e>0;)n.isOdd()&&n.iadd(s),n.iushrn(1),e-=1;let o=0;for(let t=1;0==(r.words[0]&t)&&o<26;t<<=1)o+=1;if(o>0)for(r.iushrn(o);o>0;)i.isOdd()&&i.iadd(s),i.iushrn(1),o-=1;t.cmp(r)>=0?(t.isub(r),n.isub(i)):(r.isub(t),i.isub(n))}const o=0===t.cmpn(1)?n:i;return o.ucmp(e)>=0&&(o._isub(o,e),o.ucmp(e)>=0&&o._isub(o,e)),o.isNeg()&&o.iadd(e),o}_factor2(e){if(1&(this.words[0]|e.words[0]))return 0;const t=Math.min(this.length,e.length);let r=0;for(let n=0;n<t;n++){const t=L(this.words[n]|e.words[n]);if(r+=t,26!==t)break}return r}_cloneNormal(){return this.red?this.fromRed():this.clone()}_forceRed(e){return this.red=e,this}clone(){const e=new b;e.words=new Array(this.length);for(let t=0;t<this.length;t++)e.words[t]=this.words[t];return e.length=this.length,e.negative=this.negative,e.red=this.red,e}inject(e){R(b.isBN(e),"num","bignum"),this._alloc(e.length);for(let t=0;t<e.length;t++)this.words[t]=e.words[t];return this.length=e.length,this.negative=e.negative,this.red=e.red,this}set(e,t){return this.fromNumber(e,t)}swap(e){R(b.isBN(e),"num","bignum");const t=this,r=e;return[t.words,r.words]=[r.words,t.words],[t.length,r.length]=[r.length,t.length],[t.negative,r.negative]=[r.negative,t.negative],[t.red,r.red]=[r.red,t.red],t}reverse(){const e=this.negative;return this.fromBuffer(this.toBuffer("be"),"le"),this.negative=e,this}byteLength(){return Math.ceil(this.bitLength()/8)}bitLength(){const e=D(this.words[this.length-1]);return 26*(this.length-1)+e}zeroBits(){if(this.isZero())return 0;if(this.isOdd())return 0;let e=0;for(let t=0;t<this.length;t++){const r=L(this.words[t]);if(e+=r,26!==r)break}return e}isSafe(){return this.length<=2||3===this.length&&1===this.words[2]}word(e){return R(e>>>0===e,"pos","uint32"),e>=this.length?0:this.words[e]}[n](){let e="BN";return this.red&&(e="BN-R"),"<".concat(e,": ").concat(this.toString(10),">")}csign(){return-2*this.negative+1-this.czero()}czero(){const e=this.words[0]-1>>>31;return this.length-2>>>31&e}cneg(){return this.negative}cpos(){return 1^this.negative}ceq(e){R(b.isBN(e),"num","bignum");let t=0;for(let r=0;r<e.length;r++)t|=this.words[r%this.length]^e.words[r];return t|=this.length^e.length,t|=this.negative^e.negative,t-1>>>31}ceqn(e){const t=e>>31&1,r=(0|e)*(1|-t)&67108863;let n=0;return n|=this.words[0]^r,n|=1^this.length,n|=this.negative^t,n-1>>>31}cswap(e,t){R(b.isBN(e),"num","bignum");const r=this,n=e,i=67108863&-(1&(t>>31|-t>>31));r._alloc(n.words.length),n._alloc(r.words.length);for(let a=0;a<r.words.length;a++){const e=(r.words[a]^n.words[a])&i;r.words[a]^=e,n.words[a]^=e}const s=(r.length^n.length)&i,o=(r.negative^n.negative)&i;return r.length^=s,n.length^=s,r.negative^=o,n.negative^=o,this}cinject(e,t){R(b.isBN(e),"num","bignum");const r=this,n=e,i=1&(t>>31|-t>>31),s=i-1&67108863,o=67108863&~(i-1);r._alloc(n.length);for(let a=0;a<n.length;a++)r.words[a]=r.words[a]&s|n.words[a]&o;return r.length=r.length&s|n.length&o,r.negative=r.negative&s|n.negative&o,this}cset(e,t){const r=1&(t>>31|-t>>31),n=r-1&67108863,i=67108863&~(r-1),s=e>>31&1,o=(0|e)*(1|-s)&67108863;return this.words[0]=this.words[0]&n|o&i,this.length=this.length&n|1&i,this.negative=this.negative&n|s&i,this}toNumber(){let e=this.words[0];if(2===this.length)e+=67108864*this.words[1];else if(3===this.length&&1===this.words[2])e+=4503599627370496+67108864*this.words[1];else if(this.length>2)throw new RangeError("Number can only safely store up to 53 bits.");return 0!==this.negative?-e:e}toDouble(){let e=0;for(let t=this.length-1;t>=0;t--)e=67108864*e+this.words[t];return 0!==this.negative?-e:e}valueOf(){return this.toDouble()}toBigInt(){if(!p)throw new Error("BigInt is not supported!");const e=BigInt(52),t=BigInt(26);let r=this.length-1,n=BigInt(0);for(;r>=1;r-=2){const t=67108864*this.words[r],i=this.words[r-1];n=n<<e|BigInt(t+i)}return r>=0&&(n=n<<t|BigInt(this.words[0])),0!==this.negative?-n:n}toBool(){return!this.isZero()}toString(e,t){if(null==t&&(t=0),0===t&&(t=1),R((e=O(e))>>>0===e,"base","uint32"),R(t>>>0===t,"padding","uint32"),e<2||e>36)throw new RangeError("Base ranges between 2 and 36.");if(this._check(),16===e){let e="",r=0,n=0;for(let t=0;t<this.length;t++){const s=this.words[t],o=(16777215&(s<<r|n)).toString(16);n=s>>>24-r&16777215,e=0!==n||t!==this.length-1?i[6-o.length]+o+e:o+e,r+=2,r>=26&&(r-=26,t-=1)}for(0!==n&&(e=n.toString(16)+e);e.length%t!=0;)e="0"+e;return 0!==this.negative&&(e="-"+e),e}const r=s[e-1],n=o[e-1],a=this.clone();let c="";for(a.negative=0;!a.isZero();){const t=a.remrn(n).toString(e);a.iquon(n),c=a.isZero()?t+c:i[r-t.length]+t+c}for(this.isZero()&&(c="0");c.length%t!=0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}toJSON(){return this.toString(16,2)}toArray(e,t){return this.toArrayLike(Array,e,t)}toBuffer(e,r){return this.toArrayLike(t,e,r)}toArrayLike(e,t,r){null==t&&(t="be"),null==r&&(r=0),R("function"==typeof e,"ArrayType","function"),R("be"===t||"le"===t,"endian","endianness"),R(r>>>0===r,"length","uint32"),this._check();const n=this.byteLength(),i=r||Math.max(1,n);if(n>i)throw new RangeError("Byte array longer than desired length.");const s=function(e,t){return e.allocUnsafeSlow?e.allocUnsafeSlow(t):new e(t)}(e,i);if("be"===t){let e=s.length-1,t=0;for(let r=0;r<this.length;r++){const n=(3&r)<<1,i=this.words[r]<<n|t;s[e--]=255&i,e>=0&&(s[e--]=i>>>8&255),e>=0&&(s[e--]=i>>>16&255),6===n?(e>=0&&(s[e--]=i>>>24&255),t=0):t=i>>>24}if(e>=0){for(s[e--]=t;e>=0;)s[e--]=0;t=0}T(0===t)}else{let e=0,t=0;for(let r=0;r<this.length;r++){const n=(3&r)<<1,i=this.words[r]<<n|t;s[e++]=255&i,e<s.length&&(s[e++]=i>>>8&255),e<s.length&&(s[e++]=i>>>16&255),6===n?(e<s.length&&(s[e++]=i>>>24&255),t=0):t=i>>>24}if(e<s.length){for(s[e++]=t;e<s.length;)s[e++]=0;t=0}T(0===t)}return s}encode(e,t){return this.toBuffer(e,t)}of(e,t){return this.fromNumber(e,t)}fromNumber(e,t){null==t&&(t="be"),R(N(e),"num","integer"),R("be"===t||"le"===t,"endian","endianness");const r=e<0|0;return r&&(e=-e),e<67108864?(this.words[0]=67108863&e,this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(this.words=[67108863&e,e/67108864&67108863,1],this.length=3),this.negative=r,"le"===t&&this.reverse(),this}fromDouble(e,t){null==t&&(t="be"),R("number"==typeof e,"num","double"),R("be"===t||"le"===t,"endian","endianness"),isFinite(e)||(e=0);const r=e<=-1|0;for(e<0&&(e=-e),e=Math.floor(e),this.words=[];e>0;){const t=e%67108864,r=(e-t)/67108864;this.words.push(t),e=r}return 0===this.words.length&&this.words.push(0),this.length=this.words.length,this.negative=r,"le"===t&&this.reverse(),this}fromBigInt(e,t){if(null==t&&(t="be"),R("bigint"==typeof e,"num","bigint"),R("be"===t||"le"===t,"endian","endianness"),!p)throw new Error("BigInt is not supported!");const r=e<BigInt(0)|0;return this._fromHex(e.toString(16),r),this.negative=r,"le"===t&&this.reverse(),this}fromBool(e){return R("boolean"==typeof e,"value","boolean"),this.words[0]=0|e,this.length=1,this.negative=0,this}fromString(e,t,r){if("le"!==t&&"be"!==t||([t,r]=[r,t]),t=O(t),null==r&&(r="be"),R("string"==typeof e,"string","string"),R(t>>>0===t,"base","uint32"),R("be"===r||"le"===r,"endian","endianness"),t<2||t>36)throw new Error("Base ranges between 2 and 36.");let n=0;return(e=e.replace(/\s+/g,"")).length>0&&45===e.charCodeAt(0)&&(n=1),16===t?this._fromHex(e,n):this._fromBase(e,t,n),this.negative=n,this._normalize(),"le"===r&&this.reverse(),this}_fromHex(e,t){this.length=Math.max(2,Math.ceil((e.length-t)/6)),this.words=new Array(this.length);for(let s=0;s<this.length;s++)this.words[s]=0;let r=0,n=e.length-6,i=0;for(;n>=t;n-=6){const t=j(e,n,n+6);this.words[i]|=t<<r&67108863,this.words[i+1]|=t>>>26-r&4194303,r+=24,r>=26&&(r-=26,i+=1)}if(n+6!==t){const s=j(e,t,n+6);this.words[i]|=s<<r&67108863,this.words[i+1]|=s>>>26-r&4194303}return this._strip()}_fromBase(e,t,r){this.words[0]=0,this.length=1,this.negative=0;let n=0,i=1;for(;i<=67108863;i*=t)n+=1;n-=1,i=i/t|0;const s=e.length-r,o=s%n,a=Math.min(s,s-o)+r;let c=r;for(;c<a;c+=n){const r=U(e,c,c+n,t);this.imuln(i),this._iaddn(r)}if(0!==o){const r=Math.pow(t,o),n=U(e,c,e.length,t);this.imuln(r),this._iaddn(n)}return this}fromJSON(e){if(b.isBN(e))return e.red?e.fromRed():e.clone();if(Array.isArray(e)){for(const t of e)R("string"==typeof t,"chunk","string");e=e.join("")}return this.fromString(e,16)}fromBN(e){return this.inject(e)}fromArray(e,t){return R(Array.isArray(e),"data","array"),this.fromArrayLike(e,t)}fromBuffer(e,r){return R(t.isBuffer(e),"data","buffer"),this.fromArrayLike(e,r)}fromArrayLike(e,t){if(null==t&&(t="be"),R(e&&e.length>>>0===e.length,"data","array-like"),R("be"===t||"le"===t,"endian","endianness"),0===e.length)return this.words[0]=0,this.length=1,this.negative=0,this;this.length=Math.max(2,Math.ceil(e.length/3)),this.words=new Array(this.length),this.negative=0;for(let o=0;o<this.length;o++)this.words[o]=0;const r=e.length%3;let n=0,i=0,s=0;if("be"===t){for(let t=e.length-1;t>=2;t-=3){const r=e[t]|e[t-1]<<8|e[t-2]<<16;this.words[i]|=r<<n&67108863,this.words[i+1]=r>>>26-n&67108863,n+=24,n>=26&&(n-=26,i+=1)}switch(r){case 2:s=e[1]|e[0]<<8;break;case 1:s=e[0]}}else{const t=e.length-r;for(let r=0;r<t;r+=3){const t=e[r]|e[r+1]<<8|e[r+2]<<16;this.words[i]|=t<<n&67108863,this.words[i+1]=t>>>26-n&67108863,n+=24,n>=26&&(n-=26,i+=1)}switch(r){case 2:s=e[t]|e[t+1]<<8;break;case 1:s=e[t]}}return r>0&&(this.words[i]|=s<<n&67108863,this.words[i+1]=s>>>26-n&67108863),this._strip()}decode(e,t){return this.fromBuffer(e,t)}from(e,t,r){if(null==e)return this;if("le"!==t&&"be"!==t||([t,r]=[r,t]),"number"==typeof e)return this.fromNumber(e,r);if("bigint"==typeof e)return this.fromBigInt(e,r);if("string"==typeof e)return this.fromString(e,t,r);if("object"==typeof e){if(b.isBN(e))return this.fromBN(e,r);if(e.length>>>0===e.length)return this.fromArrayLike(e,r)}if("boolean"==typeof e)return this.fromBool(e);throw new TypeError("Non-numeric object passed to BN.")}static min(...e){let t=null;for(const r of e)R(b.isBN(r),"num","bignum"),(!t||r.cmp(t)<0)&&(t=r);return t||new b(0)}static max(...e){let t=null;for(const r of e)R(b.isBN(r),"num","bignum"),(!t||r.cmp(t)>0)&&(t=r);return t||new b(0)}static cmp(e,t){return R(b.isBN(e),"a","bignum"),e.cmp(t)}static ucmp(e,t){return R(b.isBN(e),"a","bignum"),e.ucmp(t)}static red(e){return new k(e)}static barrett(e){return new S(e)}static mont(e){return new A(e)}static _prime(e){if(a[e])return a[e];let t;if("p192"===e)t=new m;else if("p224"===e)t=new g;else if("p521"===e)t=new v;else if("k256"===e)t=new w;else if("p25519"===e)t=new _;else{if("p448"!==e)throw new Error('Unknown prime: "'.concat(e,'".'));t=new E}return a[e]=t,t}static prime(e){return b._prime(e).p.clone()}static pow(e,t){return 2===e?b.shift(1,t):(new b).fromNumber(e).pown(t)}static shift(e,t){return 1===e?new b(0).usetn(t,1):(new b).fromNumber(e).ishln(t)}static mask(e){return b.shift(1,e).isubn(1)}static randomBits(e,r){if(R(null!=e,"rng","rng"),R(r>>>0===r,"bits","uint32"),"object"==typeof e){R("function"==typeof e.randomBytes,"rng","rng");const n=r+7>>>3,i=8*n,s=e.randomBytes(n);if(R(t.isBuffer(s),"bytes","buffer"),s.length!==n)throw new RangeError("Invalid number of bytes returned from RNG.");const o=b.fromBuffer(s);return i>r&&o.iushrn(i-r),o}R("function"==typeof e,"rng","rng");const n=e(r);if(R(b.isBN(n),"num","bignum"),x(0===n.negative,"RNG"),B(!n.red,"RNG"),n.bitLength()>r)throw new RangeError("Invalid number of bits returned from RNG.");return n}static random(e,t,r){if(t=b.cast(t,16),r=b.cast(r,16),t.cmp(r)>0)throw new RangeError("Minimum cannot be greater than maximum.");const n=r.sub(t).iabs(),i=n.bitLength();if(0===i)return t.clone();for(;;){const r=b.randomBits(e,i);if(!(r.cmp(n)>=0))return r.iadd(t),r}}static of(e,t){return(new b).of(e,t)}static fromNumber(e,t){return(new b).fromNumber(e,t)}static fromDouble(e,t){return(new b).fromDouble(e,t)}static fromBigInt(e,t){return(new b).fromBigInt(e,t)}static fromBool(e){return(new b).fromBool(e)}static fromString(e,t,r){return(new b).fromString(e,t,r)}static fromJSON(e){return(new b).fromJSON(e)}static fromBN(e){return(new b).fromBN(e)}static fromArray(e,t){return(new b).fromArray(e,t)}static fromBuffer(e,t){return(new b).fromBuffer(e,t)}static fromArrayLike(e,t){return(new b).fromArrayLike(e,t)}static decode(e,t){return(new b).decode(e,t)}static from(e,t,r){return(new b).from(e,t,r)}static cast(e,t,r){return b.isBN(e)?e:new b(e,t,r)}static isBN(e){return e instanceof b}}b.BN=b,b.wordSize=26,b.native=0;class y{constructor(e,t){this.name=e,this.p=new b(t,16),this.n=this.p.bitLength(),this.k=b.shift(1,this.n).isub(this.p),this.lo=this.p.clone(),this.one=this.p.clone()}ireduce(e){const t=0!==e.negative;let r=e.bitLength();for(T(r<=2*this.n),e.negative=0;r>this.n;)this.split(e,this.lo),this.imulK(e),e._iadd(e,this.lo),r=e.bitLength();const n=r<this.n?-1:e.ucmp(this.p);return 0===n?(e.words[0]=0,e.length=1):n>0&&e._isub(e,this.p),t&&!e.isZero()&&e._isub(this.p,e),e}split(e,t){e._split(this.n,t)}imulK(e){return e.imul(this.k)}}class m extends y{constructor(){super("p192","ffffffff ffffffff ffffffff fffffffeffffffff ffffffff")}imulK(e){const t=this.one.inject(e);return e.iushln(64)._iadd(e,t)}}class g extends y{constructor(){super("p224","ffffffff ffffffff ffffffff ffffffff00000000 00000000 00000001")}imulK(e){const t=this.one.inject(e);return e.iushln(96)._isub(e,t)}}class v extends y{constructor(){super("p521","000001ff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffffffffffff")}imulK(e){return e}}class w extends y{constructor(){super("k256","ffffffff ffffffff ffffffff ffffffffffffffff ffffffff fffffffe fffffc2f")}split(e,t){const r=Math.min(e.length,9);t._alloc(r+1);for(let s=0;s<r;s++)t.words[s]=e.words[s];if(t.length=r,e.length<=9)return t._strip(),e.words[0]=0,void(e.length=1);let n=e.words[9],i=10;for(t.words[t.length++]=4194303&n,t._strip();i<e.length;i++){const t=0|e.words[i];e.words[i-10]=(4194303&t)<<4|n>>>22,n=t}n>>>=22,e.words[i-10]=n,0===n&&e.length>10?e.length-=10:e.length-=9,e._strip()}imulK(e){e._expand(e.length+2);let t=0;for(let r=0;r<e.length;r++){const n=e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+Math.floor(t/67108864)}return 0===e.words[e.length-1]&&(e.length-=1,0===e.words[e.length-1]&&(e.length-=1)),e}}class _ extends y{constructor(){super("p25519","7fffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffed")}imulK(e){let t=0;for(let r=0;r<e.length;r++){const n=19*e.words[r]+t;t=n>>>26,e.words[r]=67108863&n}return 0!==t&&(e._alloc(e.length+1),e.words[e.length++]=t),e}}class E extends y{constructor(){super("p448","ffffffff ffffffff ffffffff ffffffffffffffff ffffffff fffffffe ffffffffffffffff ffffffff ffffffff ffffffffffffffff ffffffff")}imulK(e){const t=this.one.inject(e);return e.iushln(224)._iadd(e,t)}}class k{constructor(e){let t=null;"string"==typeof e&&(t=b._prime(e),e=t.p),R(b.isBN(e),"m","bignum"),B(!e.red,"reduction"),x(e.sign()>0,"reduction"),this.m=e,this.prime=t,this.mb=null,this.sm1=null}_verify1(e){x(0===e.negative,"red"),C(null!=e.red,"red")}_verify2(e,t){x(0==(e.negative|t.negative),"red"),C(null!=e.red&&e.red===t.red,"red")}get mont(){return!1}get coprime(){return!1}precompute(){if(null===this.sm1&&5===this.m.andln(7)){const e=new b(2).toRed(this),t=this.m.subn(1).iushrn(2);this.sm1=this.pow(e,t)}return this}convertTo(e){const t=e.mod(this.m);return t.red=this,t}convertFrom(e){const t=e.clone();return t.red=null,t}intTo(e){return e}intFrom(e){return e}imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.imod(this.m)._forceRed(this)}iadd(e,t){return this._verify2(e,t),e._iadd(e,t),e.ucmp(this.m)>=0&&e._isub(e,this.m),e}add(e,t){return e.length<t.length?this.iadd(t.clone(),e):this.iadd(e.clone(),t)}iaddn(e,t){return this._verify1(e),t<0?this.isubn(e,-t):(1===this.m.length&&(t%=this.m.words[0]),e._iaddn(t),e.ucmp(this.m)>=0&&e._isub(e,this.m),e)}addn(e,t){return this.iaddn(e.clone(),t)}isub(e,t){this._verify2(e,t);const r=e.ucmp(t);return 0===r?(e.words[0]=0,e.length=1,e):(r<0?(e._isub(t,e),e._isub(this.m,e)):e._isub(e,t),e)}sub(e,t){return this.isub(e.clone(),t)}isubn(e,t){return this._verify1(e),t<0?this.iaddn(e,-t):(1===this.m.length&&(t%=this.m.words[0]),1===e.length&&e.words[0]<t?(e.words[0]=t-e.words[0],e._isub(this.m,e)):e._isubn(t),e)}subn(e,t){return this.isubn(e.clone(),t)}imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))}mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))}imuln(e,t){if(this._verify1(e),e.isZero())return e;if(0===t)return e.words[0]=0,e.length=1,e;const r=t<0;if(r&&(t=-t),1===this.m.length&&(t%=this.m.words[0]),e.imuln(t),t<=16)for(;e.ucmp(this.m)>=0;)e._isub(e,this.m);else this.imod(e);return r&&this.ineg(e),e}muln(e,t){return this.imuln(e.clone(),t)}idiv(e,t){return this.div(e,t)._move(e)}div(e,t){return this.mul(e,this.invert(t))}idivn(e,t){return this.divn(e,t)._move(e)}divn(e,t){return this.div(e,this.convertTo(new b(t)))}ipow(e,t){return this.pow(e,t)._move(e)}pow(e,t){return this._verify1(e),t.isNeg()&&(e=this.invert(e)),1===t.length?this.pown(e,t.words[0]):p&&!this.prime?this.powInt(e,t):this.powNum(e,t)}powNum(e,t){const r=new Array(8);r[0]=this.sqrn(e,3),r[1]=this.mul(r[0],e);for(let s=2;s<8;s++)r[s]=this.mul(r[s-1],e);let n=t.bitLength(),i=new b(1).toRed(this);for(;n>=4;){const e=n-4,s=t.bits(e,4);s<8?(i=this.sqr(i),n-=1):(i=this.sqrn(i,4),i=this.mul(i,r[-9&s]),n=e)}if(n>0){const r=t.bits(0,n);for(;n--;)i=this.sqr(i),r>>n&1&&(i=this.mul(i,e))}return i}powInt(e,t){null===this.mb&&(this.mb=this.m.toBigInt());const r=function(e,t,r){const n=new Array(8);n[0]=z(e,3,r),n[1]=n[0]*e;for(let o=2;o<8;o++)n[o]=n[o-1]*e%r;let i=t.bitLength(),s=BigInt(1);for(;i>=4;){const e=i-4,o=t.bits(e,4);o<8?(s=s*s%r,i-=1):(s=z(s,4,r),s=s*n[-9&o]%r,i=e)}if(i>0){const n=t.bits(0,i);for(;i--;)s=s*s%r,n>>i&1&&(s=s*e%r)}return s}(this.intFrom(e.toBigInt()),t,this.mb),n=this.intTo(r);return b.fromBigInt(n)._forceRed(this)}sqrn(e,t){for(let r=0;r<t;r++)e=this.sqr(e);return e}ipown(e,t){return this.pown(e,t)._move(e)}pown(e,t){if(this._verify1(e),t<0&&(e=this.invert(e),t=-t),0===t)return new b(1).toRed(this);if(1===t)return e.clone();let r=e;for(let n=D(t)-2;n>=0;n--)r=this.sqr(r),t>>n&1&&(r=this.mul(r,e));return r}isqr(e){return this.imul(e,e)}sqr(e){return this.mul(e,e)}isqrt(e){return this.sqrt(e)._move(e)}sqrt(e){return this._verify1(e),3===this.m.andln(3)?this.sqrt3mod4(e):5===this.m.andln(7)?null!=this.sm1?this.sqrt5mod8sm1(e):this.sqrt5mod8(e):this.sqrt0(e)}sqrt3mod4(e){const t=this.m.addn(1).iushrn(2),r=this.pow(e,t);if(!this.sqr(r).eq(e))throw new Error("X is not a square mod P.");return r}sqrt5mod8(e){const t=new b(1).toRed(this),r=this.m.ushrn(3),n=this.add(e,e),i=this.pow(n,r),s=this.mul(n,this.sqr(i)),o=this.mul(this.mul(i,e),this.isub(s,t));if(!this.sqr(o).eq(e))throw new Error("X is not a square mod P.");return o}sqrt5mod8sm1(e){const t=this.m.addn(3).iushrn(3),r=this.pow(e,t);if(this.sqr(r).eq(e))return r;const n=this.mul(r,this.sm1);if(this.sqr(n).eq(e))return n;throw new Error("X is not a square mod P.")}sqrt0(e){if(0===this.m.cmpn(1)||!this.m.isOdd())throw new Error("Invalid prime.");switch(this.jacobi(e)){case-1:throw new Error("X is not a square mod P.");case 0:return new b(0)._forceRed(this)}const t=new b(1).toRed(this),r=this.m.subn(1),n=r.zeroBits();r.iushrn(n);const i=new b(2).toRed(this);for(;-1!==this.jacobi(i);)this.iadd(i,t);let s=this.pow(e,r),o=this.pow(i,r),a=this.pow(e,r.iaddn(1).iushrn(1)),c=n;for(;;){let e=s,r=0;for(;0!==e.cmp(t)&&r<c;)e=this.sqr(e),r+=1;if(0===r)break;T(r<c),e=this.sqrn(o,c-r-1),o=this.sqr(e),a=this.mul(a,e),s=this.mul(s,o),c=r}return a}idivsqrt(e,t){return this.divsqrt(e,t)._move(e)}divsqrt(e,t){if(this._verify2(e,t),t.isZero())throw new RangeError("Not invertible.");return 3===this.m.andln(3)?this.divsqrt3mod4(e,t):null!=this.sm1&&5===this.m.andln(7)?this.divsqrt5mod8(e,t):this.sqrt(this.div(e,t))}divsqrt3mod4(e,t){const r=this.m.subn(3).iushrn(2),n=this.sqr(e),i=this.mul(n,e),s=this.mul(i,n),o=this.mul(this.sqr(t),t),a=this.pow(this.mul(s,o),r),c=this.mul(this.mul(i,t),a);if(0===this.mul(t,this.sqr(c)).cmp(e))return c;throw new Error("X is not a square mod P.")}divsqrt5mod8(e,t){const r=this.m.subn(5).iushrn(3),n=this.mul(this.sqr(t),t),i=this.mul(this.sqr(n),t),s=this.pow(this.mul(e,i),r),o=this.mul(this.mul(e,n),s),a=this.mul(t,this.sqr(o));if(0===a.cmp(e))return o;if(0===this.ineg(a).cmp(e))return this.mul(o,this.sm1);throw new Error("X is not a square mod P.")}isSquare(e){let t;return t=this.prime||this.coprime?this.legendre(e):this.m.isOdd()?this.jacobi(e):this.kronecker(e),Boolean(~t>>>31)}ishl(e,t){return this._verify1(e),this.imod(e.iushl(t))}shl(e,t){return this.ishl(e.clone(),t)}ishln(e,t){if(this._verify1(e),e.iushln(t),t<=4)for(;e.ucmp(this.m)>=0;)e._isub(e,this.m);else this.imod(e);return e}shln(e,t){return this.ishln(e.clone(),t)}ineg(e){return this._verify1(e),e.isZero()||e._isub(this.m,e),e}neg(e){return this.ineg(e.clone())}eq(e,t){return this._verify2(e,t),0===e.ucmp(t)}eqn(e,t){if(this._verify1(e),1===this.m.length)return(t%=this.m.words[0])<0&&(t+=this.m.words[0]),0===e.ucmpn(t);if(t<0){this.m._isubn(-t);const r=e.ucmp(this.m);return this.m._iaddn(-t),0===r}return 0===e.ucmpn(t)}isHigh(e){return!this.isLow(e)}isLow(e){return this._verify1(e),e.ucmp(this.m.ushrn(1))<=0}isOdd(e){return this._verify1(e),e.isOdd()}isEven(e){return this._verify1(e),e.isEven()}legendre(e){if(this._verify1(e),this.m.isEven())throw new Error("legendre: `num` must be odd.");const t=this.m.subn(1).iushrn(1),r=this.pow(e,t),n=new b(1).toRed(this),i=r.czero(),s=r.ceq(n),o=r.ceq(this.ineg(n));if(0==(i|s|o))throw new Error("Invalid prime.");return T(i+s+o===1),s-o}jacobi(e){return this._verify1(e),e.jacobi(this.m)}kronecker(e){return this._verify1(e),e.kronecker(this.m)}iinvert(e){return this.invert(e)._move(e)}invert(e){return this._verify1(e),this.prime?this.imod(e._invertp(this.m)):e.invert(this.m)._forceRed(this)}ifermat(e){return this.fermat(e)._move(e)}fermat(e){if(this._verify1(e),e.isZero()||0===this.m.cmpn(1))throw new RangeError("Not invertible.");return this.pow(e,this.m.subn(2))}[n](){return this.prime?"<Red: ".concat(this.prime.name,">"):"<Red: ".concat(this.m.toString(10),">")}}class S extends k{constructor(e){super(e),this.prime=null,this.n=this.m.bitLength(),this.n%26!=0&&(this.n+=26-this.n%26),this.k=2*this.n,this.w=this.k/26,this.b=b.shift(1,this.k).div(this.m)}convertTo(e){return e.length>this.w?super.convertTo(e):this.imod(e.clone())}_shift(e){let t=0,r=this.w;for(;r<e.length;)e.words[t++]=e.words[r++];0===t&&(e.words[t++]=0),e.length=t}imod(e){const t=e.negative;T(e.length<=this.w),e.negative=0;const r=e.mul(this.b);return this._shift(r),e._isub(e,r.mul(this.m)),e.ucmp(this.m)>=0&&e._isub(e,this.m),t&&!e.isZero()&&e._isub(this.m,e),e.red=this,e}}class A extends k{constructor(e){super(e),this.prime=null,this.n=this.m.bitLength(),this.n%26!=0&&(this.n+=26-this.n%26),this.r=b.shift(1,this.n),this.r2=b.shift(1,2*this.n).imod(this.m),this.ri=this.r._invertp(this.m).imod(this.m),this.mi=this.r.mul(this.ri).isubn(1).div(this.m),this.rib=null}get mont(){return!0}get coprime(){return!0}convertTo(e){return this.imod(e.ushln(this.n))}convertFrom(e){const t=this.imod(e.mul(this.ri));return t.red=null,t}intTo(e){return(e<<BigInt(this.n))%this.mb}intFrom(e){return null===this.rib&&(this.rib=this.ri.toBigInt()),e*this.rib%this.mb}iaddn(e,t){return this.iadd(e,this.convertTo(new b(t)))}isubn(e,t){return this.isub(e,this.convertTo(new b(t)))}imul(e,t){return this.mul(e,t)._move(e)}mul(e,t){if(this._verify2(e,t),e.isZero()||t.isZero())return new b(0)._forceRed(this);const r=e.mul(t),n=r.umaskn(this.n).mul(this.mi).iumaskn(this.n),i=r.iadd(n.mul(this.m)).iushrn(this.n);return i.ucmp(this.m)>=0&&i._isub(i,this.m),i._forceRed(this)}imuln(e,t){if(this._verify1(e),e.isZero())return e;if(0===t)return e.words[0]=0,e.length=1,e;const r=t<0;r&&(t=-t),1===this.m.length&&(t%=this.m.words[0]);const n=D(t);if(n>5)this.imul(e,this.convertTo(new b(t)));else if(0==(t&t-1))for(let i=0;i<n-1;i++)this.iadd(e,e);else{const r=e.clone();for(let i=n-2;i>=0;i--)this.iadd(e,e),t>>i&1&&this.iadd(e,r)}return r&&this.ineg(e),e}eqn(e,t){return this._verify1(e),0===t?e.isZero():0===e.ucmp(this.convertTo(new b(t)))}isLow(e){return this._verify1(e),this.convertFrom(e).ucmp(this.m.ushrn(1))<=0}isOdd(e){return this._verify1(e),this.convertFrom(e).isOdd()}isEven(e){return this._verify1(e),this.convertFrom(e).isEven()}invert(e){return this._verify1(e),this.imod(e._invertp(this.m).mul(this.r2))}}function I(e,t,r){const n=new e(t);return e.captureStackTrace&&e.captureStackTrace(n,r),n}function T(e,t){if(!e){throw I(Error,t||"Assertion failed.",T)}}function R(e,t,r){if(!e){const e='"'.concat(t,'" must be a(n) ').concat(r,".");throw I(TypeError,e,R)}}function x(e,t){if(!e){const e='"'.concat(t,'" only works with positive numbers.');throw I(RangeError,e,x)}}function C(e,t){if(!e){const e='"'.concat(t,'" only works with red numbers.');throw I(TypeError,e,C)}}function B(e,t){if(!e){const e='"'.concat(t,'" only works with normal numbers.');throw I(TypeError,e,B)}}function M(e){if(!e){throw I(RangeError,"Cannot divide by zero.",M)}}function N(e){return Number.isSafeInteger(e)}function P(e){return N(e)&&e>=-67108863&&e<=67108863}function O(e){if(null==e)return 10;if("number"==typeof e)return e;switch(e){case"bin":return 2;case"oct":return 8;case"dec":return 10;case"hex":return 16}return 0}function D(e){if(Math.clz32)return 32-Math.clz32(e);let t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t}function L(e){if(0===e)return 26;let t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&(r+=1),r}function j(e,t,r){const n=Math.min(e.length,r);let i=0,s=0;for(let o=t;o<n;o++){const t=e.charCodeAt(o)-48;let r;i<<=4,r=t>=49&&t<=54?t-49+10:t>=17&&t<=22?t-17+10:t,i|=r,s|=r}if(-16&s)throw new Error("Invalid string.");return i}function U(e,t,r,n){const i=Math.min(e.length,r);let s=0;for(let o=t;o<i;o++){const t=e.charCodeAt(o)-48;let r;if(s*=n,r=t>=49?t-49+10:t>=17?t-17+10:t,t<0||t>207||r>=n)throw new Error("Invalid string.");s+=r}return s}function z(e,t,r){for(let n=0;n<t;n++)e=e*e%r;return e}function F(e,t,r){const n=e.length+t.length;r.negative=e.negative^t.negative,r._alloc(n),r.length=n;const i=e.words[0]*t.words[0],s=67108863&i;let o=i/67108864|0,a=1;for(r.words[0]=s;a<r.length-1;a++){let n=o>>>26,i=67108863&o;const s=Math.max(0,a-e.length+1),c=Math.min(a,t.length-1);for(let r=s;r<=c;r++){const s=a-r,o=e.words[s]*t.words[r]+i;n+=o/67108864|0,i=67108863&o}r.words[a]=0|i,o=0|n}return 0!==o?r.words[a]=0|o:r.length-=1,r._strip()}function q(e,t,r){const n=e.length+t.length;r.negative=e.negative^t.negative,r._alloc(n),r.length=n;let i=0,s=0,o=0;for(;o<r.length-1;o++){let n=s;s=0;let a=67108863&i;const c=Math.max(0,o-e.length+1),u=Math.min(o,t.length-1);for(let r=c;r<=u;r++){const i=o-r,c=e.words[i]*t.words[r];let u=67108863&c;n=n+(c/67108864|0)|0,u=u+a|0,a=67108863&u,n=n+(u>>>26)|0,s+=n>>>26,n&=67108863}r.words[o]=a,i=n,n=s}return 0!==i?r.words[o]=i:r.length-=1,r._strip()}function K(e,t,r){const n=e.words,i=t.words,s=r.words,o=0|n[0],a=8191&o,c=o>>>13,u=0|n[1],f=8191&u,h=u>>>13,l=0|n[2],d=8191&l,p=l>>>13,b=0|n[3],y=8191&b,m=b>>>13,g=0|n[4],v=8191&g,w=g>>>13,_=0|n[5],E=8191&_,k=_>>>13,S=0|n[6],A=8191&S,I=S>>>13,T=0|n[7],R=8191&T,x=T>>>13,C=0|n[8],B=8191&C,M=C>>>13,N=0|n[9],P=8191&N,O=N>>>13,D=0|i[0],L=8191&D,j=D>>>13,U=0|i[1],z=8191&U,F=U>>>13,q=0|i[2],K=8191&q,V=q>>>13,H=0|i[3],G=8191&H,W=H>>>13,Y=0|i[4],J=8191&Y,X=Y>>>13,Z=0|i[5],Q=8191&Z,$=Z>>>13,ee=0|i[6],te=8191&ee,re=ee>>>13,ne=0|i[7],ie=8191&ne,se=ne>>>13,oe=0|i[8],ae=8191&oe,ce=oe>>>13,ue=0|i[9],fe=8191&ue,he=ue>>>13;let le,de,pe,be=0;r.negative=e.negative^t.negative,r._alloc(20),r.length=19,le=Math.imul(a,L),de=Math.imul(a,j),de=de+Math.imul(c,L)|0,pe=Math.imul(c,j);let ye=(be+le|0)+((8191&de)<<13)|0;be=(pe+(de>>>13)|0)+(ye>>>26)|0,ye&=67108863,le=Math.imul(f,L),de=Math.imul(f,j),de=de+Math.imul(h,L)|0,pe=Math.imul(h,j),le=le+Math.imul(a,z)|0,de=de+Math.imul(a,F)|0,de=de+Math.imul(c,z)|0,pe=pe+Math.imul(c,F)|0;let me=(be+le|0)+((8191&de)<<13)|0;be=(pe+(de>>>13)|0)+(me>>>26)|0,me&=67108863,le=Math.imul(d,L),de=Math.imul(d,j),de=de+Math.imul(p,L)|0,pe=Math.imul(p,j),le=le+Math.imul(f,z)|0,de=de+Math.imul(f,F)|0,de=de+Math.imul(h,z)|0,pe=pe+Math.imul(h,F)|0,le=le+Math.imul(a,K)|0,de=de+Math.imul(a,V)|0,de=de+Math.imul(c,K)|0,pe=pe+Math.imul(c,V)|0;let ge=(be+le|0)+((8191&de)<<13)|0;be=(pe+(de>>>13)|0)+(ge>>>26)|0,ge&=67108863,le=Math.imul(y,L),de=Math.imul(y,j),de=de+Math.imul(m,L)|0,pe=Math.imul(m,j),le=le+Math.imul(d,z)|0,de=de+Math.imul(d,F)|0,de=de+Math.imul(p,z)|0,pe=pe+Math.imul(p,F)|0,le=le+Math.imul(f,K)|0,de=de+Math.imul(f,V)|0,de=de+Math.imul(h,K)|0,pe=pe+Math.imul(h,V)|0,le=le+Math.imul(a,G)|0,de=de+Math.imul(a,W)|0,de=de+Math.imul(c,G)|0,pe=pe+Math.imul(c,W)|0;let ve=(be+le|0)+((8191&de)<<13)|0;be=(pe+(de>>>13)|0)+(ve>>>26)|0,ve&=67108863,le=Math.imul(v,L),de=Math.imul(v,j),de=de+Math.imul(w,L)|0,pe=Math.imul(w,j),le=le+Math.imul(y,z)|0,de=de+Math.imul(y,F)|0,de=de+Math.imul(m,z)|0,pe=pe+Math.imul(m,F)|0,le=le+Math.imul(d,K)|0,de=de+Math.imul(d,V)|0,de=de+Math.imul(p,K)|0,pe=pe+Math.imul(p,V)|0,le=le+Math.imul(f,G)|0,de=de+Math.imul(f,W)|0,de=de+Math.imul(h,G)|0,pe=pe+Math.imul(h,W)|0,le=le+Math.imul(a,J)|0,de=de+Math.imul(a,X)|0,de=de+Math.imul(c,J)|0,pe=pe+Math.imul(c,X)|0;let we=(be+le|0)+((8191&de)<<13)|0;be=(pe+(de>>>13)|0)+(we>>>26)|0,we&=67108863,le=Math.imul(E,L),de=Math.imul(E,j),de=de+Math.imul(k,L)|0,pe=Math.imul(k,j),le=le+Math.imul(v,z)|0,de=de+Math.imul(v,F)|0,de=de+Math.imul(w,z)|0,pe=pe+Math.imul(w,F)|0,le=le+Math.imul(y,K)|0,de=de+Math.imul(y,V)|0,de=de+Math.imul(m,K)|0,pe=pe+Math.imul(m,V)|0,le=le+Math.imul(d,G)|0,de=de+Math.imul(d,W)|0,de=de+Math.imul(p,G)|0,pe=pe+Math.imul(p,W)|0,le=le+Math.imul(f,J)|0,de=de+Math.imul(f,X)|0,de=de+Math.imul(h,J)|0,pe=pe+Math.imul(h,X)|0,le=le+Math.imul(a,Q)|0,de=de+Math.imul(a,$)|0,de=de+Math.imul(c,Q)|0,pe=pe+Math.imul(c,$)|0;let _e=(be+le|0)+((8191&de)<<13)|0;be=(pe+(de>>>13)|0)+(_e>>>26)|0,_e&=67108863,le=Math.imul(A,L),de=Math.imul(A,j),de=de+Math.imul(I,L)|0,pe=Math.imul(I,j),le=le+Math.imul(E,z)|0,de=de+Math.imul(E,F)|0,de=de+Math.imul(k,z)|0,pe=pe+Math.imul(k,F)|0,le=le+Math.imul(v,K)|0,de=de+Math.imul(v,V)|0,de=de+Math.imul(w,K)|0,pe=pe+Math.imul(w,V)|0,le=le+Math.imul(y,G)|0,de=de+Math.imul(y,W)|0,de=de+Math.imul(m,G)|0,pe=pe+Math.imul(m,W)|0,le=le+Math.imul(d,J)|0,de=de+Math.imul(d,X)|0,de=de+Math.imul(p,J)|0,pe=pe+Math.imul(p,X)|0,le=le+Math.imul(f,Q)|0,de=de+Math.imul(f,$)|0,de=de+Math.imul(h,Q)|0,pe=pe+Math.imul(h,$)|0,le=le+Math.imul(a,te)|0,de=de+Math.imul(a,re)|0,de=de+Math.imul(c,te)|0,pe=pe+Math.imul(c,re)|0;let Ee=(be+le|0)+((8191&de)<<13)|0;be=(pe+(de>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,le=Math.imul(R,L),de=Math.imul(R,j),de=de+Math.imul(x,L)|0,pe=Math.imul(x,j),le=le+Math.imul(A,z)|0,de=de+Math.imul(A,F)|0,de=de+Math.imul(I,z)|0,pe=pe+Math.imul(I,F)|0,le=le+Math.imul(E,K)|0,de=de+Math.imul(E,V)|0,de=de+Math.imul(k,K)|0,pe=pe+Math.imul(k,V)|0,le=le+Math.imul(v,G)|0,de=de+Math.imul(v,W)|0,de=de+Math.imul(w,G)|0,pe=pe+Math.imul(w,W)|0,le=le+Math.imul(y,J)|0,de=de+Math.imul(y,X)|0,de=de+Math.imul(m,J)|0,pe=pe+Math.imul(m,X)|0,le=le+Math.imul(d,Q)|0,de=de+Math.imul(d,$)|0,de=de+Math.imul(p,Q)|0,pe=pe+Math.imul(p,$)|0,le=le+Math.imul(f,te)|0,de=de+Math.imul(f,re)|0,de=de+Math.imul(h,te)|0,pe=pe+Math.imul(h,re)|0,le=le+Math.imul(a,ie)|0,de=de+Math.imul(a,se)|0,de=de+Math.imul(c,ie)|0,pe=pe+Math.imul(c,se)|0;let ke=(be+le|0)+((8191&de)<<13)|0;be=(pe+(de>>>13)|0)+(ke>>>26)|0,ke&=67108863,le=Math.imul(B,L),de=Math.imul(B,j),de=de+Math.imul(M,L)|0,pe=Math.imul(M,j),le=le+Math.imul(R,z)|0,de=de+Math.imul(R,F)|0,de=de+Math.imul(x,z)|0,pe=pe+Math.imul(x,F)|0,le=le+Math.imul(A,K)|0,de=de+Math.imul(A,V)|0,de=de+Math.imul(I,K)|0,pe=pe+Math.imul(I,V)|0,le=le+Math.imul(E,G)|0,de=de+Math.imul(E,W)|0,de=de+Math.imul(k,G)|0,pe=pe+Math.imul(k,W)|0,le=le+Math.imul(v,J)|0,de=de+Math.imul(v,X)|0,de=de+Math.imul(w,J)|0,pe=pe+Math.imul(w,X)|0,le=le+Math.imul(y,Q)|0,de=de+Math.imul(y,$)|0,de=de+Math.imul(m,Q)|0,pe=pe+Math.imul(m,$)|0,le=le+Math.imul(d,te)|0,de=de+Math.imul(d,re)|0,de=de+Math.imul(p,te)|0,pe=pe+Math.imul(p,re)|0,le=le+Math.imul(f,ie)|0,de=de+Math.imul(f,se)|0,de=de+Math.imul(h,ie)|0,pe=pe+Math.imul(h,se)|0,le=le+Math.imul(a,ae)|0,de=de+Math.imul(a,ce)|0,de=de+Math.imul(c,ae)|0,pe=pe+Math.imul(c,ce)|0;let Se=(be+le|0)+((8191&de)<<13)|0;be=(pe+(de>>>13)|0)+(Se>>>26)|0,Se&=67108863,le=Math.imul(P,L),de=Math.imul(P,j),de=de+Math.imul(O,L)|0,pe=Math.imul(O,j),le=le+Math.imul(B,z)|0,de=de+Math.imul(B,F)|0,de=de+Math.imul(M,z)|0,pe=pe+Math.imul(M,F)|0,le=le+Math.imul(R,K)|0,de=de+Math.imul(R,V)|0,de=de+Math.imul(x,K)|0,pe=pe+Math.imul(x,V)|0,le=le+Math.imul(A,G)|0,de=de+Math.imul(A,W)|0,de=de+Math.imul(I,G)|0,pe=pe+Math.imul(I,W)|0,le=le+Math.imul(E,J)|0,de=de+Math.imul(E,X)|0,de=de+Math.imul(k,J)|0,pe=pe+Math.imul(k,X)|0,le=le+Math.imul(v,Q)|0,de=de+Math.imul(v,$)|0,de=de+Math.imul(w,Q)|0,pe=pe+Math.imul(w,$)|0,le=le+Math.imul(y,te)|0,de=de+Math.imul(y,re)|0,de=de+Math.imul(m,te)|0,pe=pe+Math.imul(m,re)|0,le=le+Math.imul(d,ie)|0,de=de+Math.imul(d,se)|0,de=de+Math.imul(p,ie)|0,pe=pe+Math.imul(p,se)|0,le=le+Math.imul(f,ae)|0,de=de+Math.imul(f,ce)|0,de=de+Math.imul(h,ae)|0,pe=pe+Math.imul(h,ce)|0,le=le+Math.imul(a,fe)|0,de=de+Math.imul(a,he)|0,de=de+Math.imul(c,fe)|0,pe=pe+Math.imul(c,he)|0;let Ae=(be+le|0)+((8191&de)<<13)|0;be=(pe+(de>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,le=Math.imul(P,z),de=Math.imul(P,F),de=de+Math.imul(O,z)|0,pe=Math.imul(O,F),le=le+Math.imul(B,K)|0,de=de+Math.imul(B,V)|0,de=de+Math.imul(M,K)|0,pe=pe+Math.imul(M,V)|0,le=le+Math.imul(R,G)|0,de=de+Math.imul(R,W)|0,de=de+Math.imul(x,G)|0,pe=pe+Math.imul(x,W)|0,le=le+Math.imul(A,J)|0,de=de+Math.imul(A,X)|0,de=de+Math.imul(I,J)|0,pe=pe+Math.imul(I,X)|0,le=le+Math.imul(E,Q)|0,de=de+Math.imul(E,$)|0,de=de+Math.imul(k,Q)|0,pe=pe+Math.imul(k,$)|0,le=le+Math.imul(v,te)|0,de=de+Math.imul(v,re)|0,de=de+Math.imul(w,te)|0,pe=pe+Math.imul(w,re)|0,le=le+Math.imul(y,ie)|0,de=de+Math.imul(y,se)|0,de=de+Math.imul(m,ie)|0,pe=pe+Math.imul(m,se)|0,le=le+Math.imul(d,ae)|0,de=de+Math.imul(d,ce)|0,de=de+Math.imul(p,ae)|0,pe=pe+Math.imul(p,ce)|0,le=le+Math.imul(f,fe)|0,de=de+Math.imul(f,he)|0,de=de+Math.imul(h,fe)|0,pe=pe+Math.imul(h,he)|0;let Ie=(be+le|0)+((8191&de)<<13)|0;be=(pe+(de>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,le=Math.imul(P,K),de=Math.imul(P,V),de=de+Math.imul(O,K)|0,pe=Math.imul(O,V),le=le+Math.imul(B,G)|0,de=de+Math.imul(B,W)|0,de=de+Math.imul(M,G)|0,pe=pe+Math.imul(M,W)|0,le=le+Math.imul(R,J)|0,de=de+Math.imul(R,X)|0,de=de+Math.imul(x,J)|0,pe=pe+Math.imul(x,X)|0,le=le+Math.imul(A,Q)|0,de=de+Math.imul(A,$)|0,de=de+Math.imul(I,Q)|0,pe=pe+Math.imul(I,$)|0,le=le+Math.imul(E,te)|0,de=de+Math.imul(E,re)|0,de=de+Math.imul(k,te)|0,pe=pe+Math.imul(k,re)|0,le=le+Math.imul(v,ie)|0,de=de+Math.imul(v,se)|0,de=de+Math.imul(w,ie)|0,pe=pe+Math.imul(w,se)|0,le=le+Math.imul(y,ae)|0,de=de+Math.imul(y,ce)|0,de=de+Math.imul(m,ae)|0,pe=pe+Math.imul(m,ce)|0,le=le+Math.imul(d,fe)|0,de=de+Math.imul(d,he)|0,de=de+Math.imul(p,fe)|0,pe=pe+Math.imul(p,he)|0;let Te=(be+le|0)+((8191&de)<<13)|0;be=(pe+(de>>>13)|0)+(Te>>>26)|0,Te&=67108863,le=Math.imul(P,G),de=Math.imul(P,W),de=de+Math.imul(O,G)|0,pe=Math.imul(O,W),le=le+Math.imul(B,J)|0,de=de+Math.imul(B,X)|0,de=de+Math.imul(M,J)|0,pe=pe+Math.imul(M,X)|0,le=le+Math.imul(R,Q)|0,de=de+Math.imul(R,$)|0,de=de+Math.imul(x,Q)|0,pe=pe+Math.imul(x,$)|0,le=le+Math.imul(A,te)|0,de=de+Math.imul(A,re)|0,de=de+Math.imul(I,te)|0,pe=pe+Math.imul(I,re)|0,le=le+Math.imul(E,ie)|0,de=de+Math.imul(E,se)|0,de=de+Math.imul(k,ie)|0,pe=pe+Math.imul(k,se)|0,le=le+Math.imul(v,ae)|0,de=de+Math.imul(v,ce)|0,de=de+Math.imul(w,ae)|0,pe=pe+Math.imul(w,ce)|0,le=le+Math.imul(y,fe)|0,de=de+Math.imul(y,he)|0,de=de+Math.imul(m,fe)|0,pe=pe+Math.imul(m,he)|0;let Re=(be+le|0)+((8191&de)<<13)|0;be=(pe+(de>>>13)|0)+(Re>>>26)|0,Re&=67108863,le=Math.imul(P,J),de=Math.imul(P,X),de=de+Math.imul(O,J)|0,pe=Math.imul(O,X),le=le+Math.imul(B,Q)|0,de=de+Math.imul(B,$)|0,de=de+Math.imul(M,Q)|0,pe=pe+Math.imul(M,$)|0,le=le+Math.imul(R,te)|0,de=de+Math.imul(R,re)|0,de=de+Math.imul(x,te)|0,pe=pe+Math.imul(x,re)|0,le=le+Math.imul(A,ie)|0,de=de+Math.imul(A,se)|0,de=de+Math.imul(I,ie)|0,pe=pe+Math.imul(I,se)|0,le=le+Math.imul(E,ae)|0,de=de+Math.imul(E,ce)|0,de=de+Math.imul(k,ae)|0,pe=pe+Math.imul(k,ce)|0,le=le+Math.imul(v,fe)|0,de=de+Math.imul(v,he)|0,de=de+Math.imul(w,fe)|0,pe=pe+Math.imul(w,he)|0;let xe=(be+le|0)+((8191&de)<<13)|0;be=(pe+(de>>>13)|0)+(xe>>>26)|0,xe&=67108863,le=Math.imul(P,Q),de=Math.imul(P,$),de=de+Math.imul(O,Q)|0,pe=Math.imul(O,$),le=le+Math.imul(B,te)|0,de=de+Math.imul(B,re)|0,de=de+Math.imul(M,te)|0,pe=pe+Math.imul(M,re)|0,le=le+Math.imul(R,ie)|0,de=de+Math.imul(R,se)|0,de=de+Math.imul(x,ie)|0,pe=pe+Math.imul(x,se)|0,le=le+Math.imul(A,ae)|0,de=de+Math.imul(A,ce)|0,de=de+Math.imul(I,ae)|0,pe=pe+Math.imul(I,ce)|0,le=le+Math.imul(E,fe)|0,de=de+Math.imul(E,he)|0,de=de+Math.imul(k,fe)|0,pe=pe+Math.imul(k,he)|0;let Ce=(be+le|0)+((8191&de)<<13)|0;be=(pe+(de>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,le=Math.imul(P,te),de=Math.imul(P,re),de=de+Math.imul(O,te)|0,pe=Math.imul(O,re),le=le+Math.imul(B,ie)|0,de=de+Math.imul(B,se)|0,de=de+Math.imul(M,ie)|0,pe=pe+Math.imul(M,se)|0,le=le+Math.imul(R,ae)|0,de=de+Math.imul(R,ce)|0,de=de+Math.imul(x,ae)|0,pe=pe+Math.imul(x,ce)|0,le=le+Math.imul(A,fe)|0,de=de+Math.imul(A,he)|0,de=de+Math.imul(I,fe)|0,pe=pe+Math.imul(I,he)|0;let Be=(be+le|0)+((8191&de)<<13)|0;be=(pe+(de>>>13)|0)+(Be>>>26)|0,Be&=67108863,le=Math.imul(P,ie),de=Math.imul(P,se),de=de+Math.imul(O,ie)|0,pe=Math.imul(O,se),le=le+Math.imul(B,ae)|0,de=de+Math.imul(B,ce)|0,de=de+Math.imul(M,ae)|0,pe=pe+Math.imul(M,ce)|0,le=le+Math.imul(R,fe)|0,de=de+Math.imul(R,he)|0,de=de+Math.imul(x,fe)|0,pe=pe+Math.imul(x,he)|0;let Me=(be+le|0)+((8191&de)<<13)|0;be=(pe+(de>>>13)|0)+(Me>>>26)|0,Me&=67108863,le=Math.imul(P,ae),de=Math.imul(P,ce),de=de+Math.imul(O,ae)|0,pe=Math.imul(O,ce),le=le+Math.imul(B,fe)|0,de=de+Math.imul(B,he)|0,de=de+Math.imul(M,fe)|0,pe=pe+Math.imul(M,he)|0;let Ne=(be+le|0)+((8191&de)<<13)|0;be=(pe+(de>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,le=Math.imul(P,fe),de=Math.imul(P,he),de=de+Math.imul(O,fe)|0,pe=Math.imul(O,he);let Pe=(be+le|0)+((8191&de)<<13)|0;return be=(pe+(de>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,s[0]=ye,s[1]=me,s[2]=ge,s[3]=ve,s[4]=we,s[5]=_e,s[6]=Ee,s[7]=ke,s[8]=Se,s[9]=Ae,s[10]=Ie,s[11]=Te,s[12]=Re,s[13]=xe,s[14]=Ce,s[15]=Be,s[16]=Me,s[17]=Ne,s[18]=Pe,0!==be&&(s[19]=be,r.length+=1),r}Math.imul||(K=F),b.Red=k,e.exports=b}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports=r(904)},function(e,t,r){"use strict";(function(e,n){const i=r(39),s=e.crypto||e.msCrypto,o=s&&"function"==typeof s.getRandomValues,a=o?s.getRandomValues.bind(s):null,c=new Uint32Array(1);function u(){f(c);const e=c[0];return c[0]=0,e}function f(e){if(!o)throw new Error("Entropy source not available.");return a(e)}function h(e,t,r){if(i(n.isBuffer(e)),i(e.buffer instanceof ArrayBuffer),i(e.byteOffset>>>0===e.byteOffset),i(e.byteLength>>>0===e.byteLength),i(t>>>0===t),i(r>>>0===r),i(t+r<=e.byteLength),r>2**31-1)throw new RangeError('The value "size" is out of range.');const s=e.byteOffset+t,o=new Uint8Array(e.buffer,s,r);if(o.length>65536)for(let n=0;n<o.length;n+=65536){let e=n+65536;e>o.length&&(e=o.length),f(o.subarray(n,e))}else o.length>0&&f(o)}t.native=0,t.randomBytes=function(e){i(e>>>0===e);const t=n.alloc(e);return h(t,0,e),t},t.randomFill=function(e,t,r){return i(n.isBuffer(e)),null==t&&(t=0),i(t>>>0===t),null==r&&(r=e.length-t),i(r>>>0===r),i(t+r<=e.length),e.fill(0,t,t+r),h(e,t,r),e},t.randomInt=u,t.randomRange=function(e,t){i(e>>>0===e),i(t>>>0===t),i(t>=e);const r=t-e;if(0===r)return e;const n=-r>>>0;let s,o;do{s=u(),o=s%r}while(s-o>n);return o+e}}).call(this,r(10),r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(39);function i(t){n(e.isBuffer(t));let r=0;for(;r<t.length&&0===t[r];)r+=1;return t.slice(r)}function s(t){n(e.isBuffer(t));let r=t.length;for(;r>0&&0===t[r-1];)r-=1;return t.slice(0,r)}t.countLeft=function(t){n(e.isBuffer(t));let r=0;for(;r<t.length&&0===t[r];)r+=1;let i=8*(t.length-r);if(0===i)return 0;i-=8;let s=t[r];for(;s;)i+=1,s>>>=1;return i},t.countRight=function(t){n(e.isBuffer(t));let r=t.length;for(;r>0&&0===t[r-1];)r-=1;let i=8*r;if(0===i)return 0;i-=8;let s=t[r-1];for(;s;)i+=1,s>>>=1;return i},t.compareLeft=function(t,r){n(e.isBuffer(t)),n(e.isBuffer(r));let i=0,s=t.length,o=0,a=r.length;for(;s>0&&0===t[i];)i+=1,s-=1;for(;a>0&&0===r[o];)o+=1,a-=1;if(s<a)return-1;if(s>a)return 1;for(let e=0;e<s;e++){if(t[i+e]<r[o+e])return-1;if(t[i+e]>r[o+e])return 1}return 0},t.compareRight=function(t,r){n(e.isBuffer(t)),n(e.isBuffer(r));let i=t.length,s=r.length;for(;i>0&&0===t[i-1];)i-=1;for(;s>0&&0===r[s-1];)s-=1;if(i<s)return-1;if(i>s)return 1;for(let e=i-1;e>=0;e--){if(t[e]<r[e])return-1;if(t[e]>r[e])return 1}return 0},t.trimLeft=i,t.trimRight=s,t.padLeft=function(t,r){if(n(e.isBuffer(t)),n(r>>>0===r),t.length>r&&(t=i(t)),t.length>r)throw new RangeError("Buffer expected to be ".concat(r," bytes in size."));const s=e.allocUnsafe(r),o=r-t.length;return s.fill(0,0,o),t.copy(s,o),s},t.padRight=function(t,r){if(n(e.isBuffer(t)),n(r>>>0===r),t.length>r&&(t=s(t)),t.length>r)throw new RangeError("Buffer expected to be ".concat(r," bytes in size."));const i=e.allocUnsafe(r);return t.copy(i,0),i.fill(0,t.length,r),i}}).call(this,r(0).Buffer)},function(e){e.exports=JSON.parse('{"naf":{"width":8,"points":[["67ae9c4a22928f491ff4ae743edac83a6343981981624886ac62485fd3f8e25c","1267b1d177ee69aba126a18e60269ef79f16ec176724030402c3684878f5b4d4"],["49fda73eade3587bfcef7cf7d12da5de5c2819f93e1be1a591409cc0322ef233","5f4825b298feae6fe02c6e148992466631282eca89430b5d10d21f83d676c8ed"],["14568685fcf4bd4ee9e3ee194b1d810783e809f3bbf1ce955855981af50e4107","31c563e32b47d52f87ce6468dd36ad41f0882b46f7abf23d12c4c4b59f4062b8"],["357cc970c80071651bf336e06f9422b886d80e5c2e4e0294d3e023065185715c","7f3d23c2c2dd0df4b2befce956f2d2fd1f789013236e4430c74e44845522f1c0"],["14e528b1154be417b6cf078dd6712438d381a5b2c593d552ff2fd2c1207cf3cb","2d9082313f21ab975a6f7ce340ff0fce1258591c3c9c58d4308f2dc36a033713"],["107427e0d5f366ccdb33adf0282d304f8843e3e88d22b7b83780e073b7c05fed","12dbb00ded538b7478466022d2da89b83740cfb2289a272387efe1aeea401f80"],["4f162deaec2ec435dc5ac6f95d20419ed9631374770189cb90617f3e66a18dc1","12cbfb2d04ff22f55162f70164d29331ace5af18a19a9aa1946d4cc4ad2e5cdf"],["7dc52d5a7db816e9b850741ea2fd72918d94985b85a20b4dc5597853a876df6a","6f6d2bca60003ef9f24ac245cc919fb717b188723b34f901cd6cfe9bec97be04"],["1d81f74a5ba45c7022e8c140d763b9c1b0e281a5304696e74f791a3a04a94472","3f185a93d95a4347227c5bb6ddd65cf42e1830823f435f3083fe6102691d55b9"],["6f0ac78e5eb90e87958588f9d47541edf252cb1dde3d073cc45e3e7ef9365716","6628d116b7975ae5f323e5ddf4f8cc35ae06d5c5c7d8a56effc66051336d289e"],["2188ac423c67db5625915e05222a391bcaf91f05d9b7cc2cab5798b2d2e14d95","23240c559c57b79a4df69a23fc46e50504277b1fa49369ab663d79782b33c0ee"],["794241471ed9ceb009384b370cb8790fca98552ecb822dc06b19362c36353455","71e918c03cdfca7207772e8d18ee8f9d92d79a0a83f378912362bc68d311dcd0"],["163bc180c22dfc5da23c5c052107bba93a88b4360aa1d4e729611d8f5a7f8079","631107a6ba83f7458194b9766a0a54f638ca20daf800384dbae1498677501939"],["39a32a30f3eb1da0eb7e3903b8ace3da3890b24b61a3a9e79db663b5db0f7a5d","4d4c54675dc1f1c9a1af9ca0010045dc803c16af345823136dd203715d67c491"],["38085391a0e2831f59c33fcce7591515784d359925f11ff958e0e4658efac0e9","42918001a829f49b5634e34ab7fac21b30e24660669ed91955cc31944a19e62a"],["5e3573b049d6135ffbbbbd9a480617434f2455b4a591f719e91153eeb75a32a1","54bc665420c789da1105d53983c1a0fc33bcc2690cd9b37d6566e21a85892871"],["7ed068b25b82c05fdc0e46bd80a357f3acd2f5c3b9330bc8d474e5b28270f6eb","01da83a187da8ccca704d46557a462551d70df7f943a681c3b97b1db6a21b7d3"],["05ca3370e7516f6686111b72650aab4c5484407f14b515ade03951c6a14a0aa3","6f407fc537b95277966e7f0f5e64b86904bf7baee091cee6011a3611834c6903"],["624cb312b698bbd6dbca79b8d2b53cb5d8b3ab33c19306e87c18211f095ab9c3","5b3336b2751e97c793731ac9b9a2243b6229f6d0bbea6b619395d0e5200bd8a3"],["1ddf6ece608fe2901b34b7e4f47cfcb75e947e293c704d8121b11a31a051b5f9","5e2dc58e9a48a749ce5296d229cfb34f96a147a8246d2e9844d52b52112ea94e"],["396b384f3d61cfc060308fbb1c941ebc9418e2d9abd81316e08d625f48c0e101","7223e5f7b66d1ca24962bac273a7aa6618cc60cb8a64a8837e0261107e7ad644"],["53cc3dca3410277fb38d75e4ac0dde8e77a99c817170dbc9696cffe7890fbd50","2592a3aafce64d7c69f4de468d5d5aa19845f5ca08f64a0a40e37d23ececbbe1"],["34705fe600f5aed77b29d3eacdffcd45d886904156d43dc550bb7fc889cc1368","299153c141a8950ffbcc8e9352993e642fa39a476200dd4acf42e158dbe3b01e"],["5969255bd089181b991fce96b1792ba330a14f8a0b061f8118c9c336b8504618","680a805fa0ae93c2a12b193517fb1147d355547e4ab18a9d6ca21575bbb4d7a4"],["27d1d57fa8808d3d452df14bda4248b37902752163b1fd499a92456c59918ecb","0a42f1c0f4c5d7de9e82904f0b4ff63988d31fedb8aad9d8ae009c7a1dff09c3"],["0811d14bfdfdcf2144edd9cf55bce584a9ba17aec3eac8aaa82987ad703d9b8a","42bea70d46f3ee0df0ec77d24c5495ea56ada2e0415920470c4746b68306376e"],["4de090761b863cb0f0650297f154a8e66d00c5119c38e5dd05303d905d527a4a","5eef0efd105361ce198a30e09e7e7edffbe3d70189e63ca68cf6057b9772baa8"],["1d45517858ce45556aaee056ebab7e0ef3dc9ae3740aed570f3e76bfb4fc4817","0b5a9d8fe8b7ccb04c0a5ef77798a3ec6e1bc1138604eb05e83844f0d4c5c699"],["4285edbe9117f30aae1ef5ee419eb1d472106c6b3d7f3ce3701e39324b0eeafc","503aa6104a682bcf2c0a60c84f4c22b50b0caa0fed8db87dedc7173eae04bdbd"],["3ef830cbeff9b79039b1b6bd9bb52bbcfa56d008d91b9703ea1c80351f8687d6","62349ff5d8dbd216a874769eec152ef9734bea9240eed623992c7553dc8ee4c8"],["649a996e6d4d3b60ccb526939ed8929134107e03e2fd4648eaa2fa9830822c1a","1648311b942fe95d492a1ace5e5235c1aea860d036d2475cc8964cd1acedee9c"],["3a95596d97770d050d1ecc075d58a74f5fe6b4b8222740534ba22c8be73f9d56","15a80cdcc03317a830fa4a7461de6bac136993e0a797f83b405c161a34c98fd7"],["2d265d3fe1c88903ca93685209418deec5af886bf0d9fdb3f499d831cbb76ce1","08376fb0663d3aa220948612b519af4a6a1f956622b15a305fb2e60a84210b3c"],["642cb15498d8c6b25803f3e56b98e2ea185ac808cbeab5eb0a610ed5babb9385","21b5ca5020a9e5a2334c0bee15193ea16c909963ffa6e1d93df4b239abeaeb3e"],["38e576301ff6cdd0822a19c6d610d445d3967e2bada903abb6220f68c6e79bef","458fe689e31a24952d2817dda4349109c1b26ef31699fa36c4f8389eeb60eac0"],["372bec78d75011a0ef2233cd08790a7f15c1ec1e3a78cac8d6652678641780db","32e9e47cf2f48612ed3e2c2006ea0c0c8476d3562aa88cefb67ec97abdb538e8"],["1aa3756aabcc3eb65afee34e0a15dd67bfb9fb199eb131f4cc6a3ca9ec4d1c77","42333e27831add6eb49af80e17347c63c26dd684758096ee3dbdbe03a49159ae"],["38db16447d79d3590c4a36e20286beadfbae91a4eed2e5e7dd4f975ac0537dc5","1c48ccaed60ec12ce862ea71165bba7df1739845df2a857f4ef0a0f714f96daa"],["176b78984cddfddef90bae619c6a98e951d9a7ac7d6af218ae7e76b273212fb7","7b5b93eda77443f366e2a127abe12212aad8536767ec1c5861143f777db85852"],["042d154bf7b4a7bd73897ae528c6bc552ea58d74f8109e8e4052d3e9d38bb0f6","42d1831323e279f9f7ee9e3470ba20ca7edc3245eca5d8ffa182de120a71fc90"],["1f8d28dd4f286a8d0687b626b01204434bf5874a9550d6e375116490c154e108","1ce82e2360367e06f41757fd45239f9bc2c61609139446b09b55a9c43da98bb8"],["613eb914c015076e9ae8356bf508c289e50b1c87d9e2546f6e406362e248e5e5","3edbaafcd8c41ef4aa18b254137d201a2ef0ca4ca28807156bc949e920b97353"],["27bf43826bf0310b4b3e3a405eff790a1d77a8d48b04891246cff8e193cb03a9","16a24d749cc1d234fbe8af9cfd782c3aaa5869d6db0afa7b4d4c67037514f2ea"],["769a6a59746d7bead417bdd9c3b5f5ae1dbd924083ffd9e88df7714f57a675c2","22dc1267cfb2b41c590abb7dc3df45619af688d0421f2bdfb50748335ec5da25"],["795734ee4fcc24194219d25d41a2889cdb942f765848e9df63bff0b158c7224d","756420ab5c71127d39d2e79907634a177af0e483e08484ea4d7b76f7100669b5"],["644d12fc5e7fcac5aeb5911d8240971a99fc59fdd2903f46958e6896aefbcf46","173450789fcd40172e8124fea56f7aedad2ee13fa8fc5209cc8cb572175216dc"],["5deca767ef17b9e8d4f351f5c8ad1fcc50e97a2ed687516bf5210679fd6c1110","4ddf2207da12f700708089989da016f3307ce5721c9e27c952599d67898aa396"],["296dcb24cb3185d037a94bef93c97cacd09fc7050ba8472da59d4a689d9d2848","0b17dc85a4acf73833fab728f15abccac97cd09e57975bd996d3e1dd8b060f7b"],["408a3f1af2e77dfe94f8e225b40dfc146abb1002db7bcf15fde61c1a6cf1b93f","4f01ec38854c15a879e7c7924f048e2ec951dcdf04a614088b68fbcc0954e1c8"],["07d2d9234970cdc9483e0a7c5ec52c49077c440e0a993a1e624f90b8fafbbf07","6ac2190030c210ae3e07b9239f6ee7affba263866ee7831a564c511f703f2295"],["2982d553002082320aa899b9b6887e40dedf11868fa931689795d93d58452873","215e16ca447978624cad0ea6bf45aada4eca914425ee275db2a26e980dc349b6"],["1d8649515cb49e136d2895b6276569e5c711fe1a343eeb5a3daaa8d0e7b42d1a","5b21e2f2978f343a3e9ec3316cdc111af3b55f34afa5fc3fcbf6c26c1bb7fb6c"],["5460df4d607147939cdbc04dbdcbdffd37c5eafdd501b50a67213a23ee724a97","69dfc7004263ccb52487d34ab134b80bb3030273999739cb9cdc16d71b9abcd8"],["24623476f0af9f42ca15a0697ad23abeaf5ed9dc4d2b44f7e8175486598125bb","6aebe4a1a22d9e31194dcde6d33ff3af77dda15c22b2ecba9329849b8c042687"],["64e507a02bfd8a8413117bac253b17f94b2911681ebc07c92da0de6a651dd538","513ac992d72b463da110afb612fbae36590248a0507d845ee95fab2d1caa03a4"],["47f3bd11324f6bee230a22a5bb06a3ccddbc0473b810689efaeef894a654bf0e","7e05db9b3ff886bf32608dfc8d14eaa91e2e2ef230e7c75618060e4285c492be"],["4a6d22703a7045d02d656015ea2d168385d42963a739a895e4fd87b3e55c5e0f","4c58d7a8c6ded0451798e51f16ffa5b637a87aa5defb119ba868d8cccf61776d"],["3e22af70a548097244d7798964598172a90391f84c59b04cea7af283ba368eb5","689d8b7cda23b8dea197c5119fbbbd81dd4b59a36cc283dbe292b5b6519a2968"],["61a6ba2ca42d9d557b3a2ff0867c1b8bb8fc40192d31ff637431a302bc065a10","63d805f5a79f845ea2915a25cf0a8cab2e0255212a1bd3c8852b25579b63721d"],["03d963eeae48556e88305f91c478efcfd2168c346b9ba185884ec8621e8cb414","74b75cc839a944ad8c639719d20fd9d48d2099ef24c8633eabec7a9ec1e7e183"],["0f04da69e0202f7b44c58b103c88de09a0599951fedb17e7f2152d6b93a58ae9","1fbc1c9cd03c4cfd46e8e90019debf86e8036587eade038346f91070c800b8c4"],["797899e488353ed0c6666aff11913b33be0190833766e809b2a68cbc671a9cfe","5dd70a33ff94a84b3fe660f7070e6179e86b5c846689265bf985ce424b8909cc"],["735b64bb872606510e4e7d57833eb7ffdc4aa0dbaa242439806be68379f77cdd","384aaaee3ca7ba2436fcb65910859ca5ec30c10af11df7d777d287bc1a2bce2c"],["6f6ea532a62cf4766f55a0a72a86b55e73fe9d3328ee94bfc271e122f99dc1ac","61d8203ef6da5d0b584541c02331c7f58617cf8d4f26d11776236ce8b113ac10"],["5d99a2a3d4aed730b827b68ed836a9910dce4e7b93faf456981ad6cd85748773","7eeacf5680fb6108a8b7edb45f7134644111b08e17c236469685af5a79474b9e"],["31d0b4bb57bd7b69363c064a49bf3c3b9d7635bcc287e7b3059d3d99fd8382e8","1592e581034e13d47d02b8966f5359097e652391be8fb1e803f4219a22aba2c0"],["424cf5c498bbbe8fa7e5c3247049cc3f45946d0e5f38c44a36a6c84b60a84aa0","34acd712d334a2315dc8fd00c5c9b7c5c9f29bca27380a018882a5ab4a0fcb43"],["33a6ae0522936ba774837aa7959972f9804e3ef02ae84c8039be6595598be247","37022798cc08be9b4ded34c1c5062ab3a26081d375cadf517972fb48135a6602"],["5939635b72aeba595b5f6e376d11a3e07d4b1153ab4d0a7ab267b8bcc47cc3cb","382162eb33db2322cbe01a38fa4d13720b6d8edfaf8116a628725ef4293a6c27"],["3649e78d2ae9fb0ee86b691c27386efce4f3e383790e3cfee2bd59c2e85c4036","09b0d9e0dd82e697b9be9d61ce0d1410e281122b483125c48f7942b22f5d5be4"],["62c7585d1677b7619d8200175346ec99118416d8fdf0103730d165934e96a973","5fef7955ee07304429995433a468d68dec4ecf6b08bbe8cd06869080094044de"],["0c94537d311e17f5b0c58989b5be7e40c88b978a8c074a1e9bb07a713f77f6d3","6deaaa5001bcbbbe9ae436fe42f7042ce74fbf83c14058427fad4587ed33c4e2"],["6f5c6894a8d3877312e608c11809c15dffec3df551711095c8cfc810533e1b3e","74eadab9389b40d6ac6cc0d6e333d628ced60a9ef7617751c20630d23477af7b"],["4e16e88e171f9a07e11f97bba65c0fe5483501f255343afb3335ed47fbcee08f","41bcd7dd328871247cb7995bc6bd2e1961e94b0fb12e5fb2f264f9ad2cf47d4c"],["65d8484cef146e6c232fb262c2ac8200a52c63ccec26ff6f038aa5c74982c741","67283346bbae9391952b141e57ca8e3a36f0363d3b81b1c0f2b3c30a92c74235"],["1c588485b64be8cb99bf97f065e75a82138ea2e035ba90b63745354e9cf729f8","7c9a18d6ebf5465a197989cfb9b5b2a66a5402f46c4708ac04187c6b157a0d77"],["2c80c4ad0aebcafab7e9d2519a329f8a1c7df21cb6b1acec7403c0204d6dce71","7f8e62983160756e35356df95d44467e621c7274372997ca74a9fb760b4db36f"],["1e1e5fc87fa2c49e2c44d5718e3d73c73a91a64ac1374652080bd9004291b9c6","153828e90ed8d94c0f86e0eb54ccb31073cd29ed62c34cd9f2dbc5d98872e597"],["0ce0488a30ed446d445efb1bd21ba32ec3d05d538e6393bc0e58e0849ad57129","7278074ac66ac779136f4d6a334b27633645dea0fc98d137e3dbd4015d12b5a1"],["01a6b81f7285f293f19ba019b009aed8280ce285af42fab91e87fb0bbfa6dea4","60f910dc7c9a82e7836f36acfe7ec26b9babfa8bf26b2945b3c1a43b0c19b4dc"],["79b4ce3c6990023859646690c9ea800174902acfa1aad7ff34eca032dbde7150","53a1053d3fc6c749bf8a928854f392d09fa851ba963ca661bffbe74f012ba45b"],["220ee355b5c39c1901ed34c0f50f7778ad1bedcd7259ae167c16514ffe333498","05fd9374986e1e06035dbfada0117035b96b159354262f2b2695af1256d6aa2a"],["1e2f97d2cb4a19ca40403b364253da71f65d2d4665894267e3c6a9db8b4a3a18","22804fb035acb519210ff99ed7a974a725d896a77933789b4dd45a37dea3466d"],["35b8699fa20987876ac3b3086965b05f8cc809d71cab45e017c68ac96e24ed5b","155079de21981778dc438353bf2c6a65967a1a33ebb74c866fb42f4e3cce3e39"],["3cb40c55f5f19c52958e8c4ecd9c459b1d3268b3971b2286d3e58d1fc6b6a6bd","379e1f1f59df05c74485615b87441ba6203f0cdddc6873a883d4cc6dd1b75921"],["6ad916290e0d003ce5c961679f77704dcd768589d7cb728c60f56852031803bf","1e602b4a6725832a56944234f84c4f85f79911b55beef903549089925f2ccbea"],["7c0162492ae668160aa56a60e8bd43ec088555f750d2223cc37362dead5de123","34e60b446eae100d4c3abc6cb02e4ca559457fb5a9030a290a2568fa4cbf118f"],["354c25bf7b3e83dd0c5e1f39b82e3567edeb5337634056c1091cd6a016caacdf","7abb271ef121630f85a9a1049b3ad78d5b889f533b37a713b8801de46770fc3a"],["1e581a4bcf7504f33f4342b2097504d13f9b5a27f4790a6cdde1242209862850","2164d56564360fd2b5dba2f2c6ef1045ab448c3b60b2f2196c2f74625fc39e07"],["533b56f18283ee79b9a180b887c298961bd9aaa6fa3ef97fcb0d5688e694bc3d","6011366753812df2bce83634a92dbac18dd1cffdbf9a97fa1b1d5b49e0026764"],["4b508b94e6e2e6cd260a20664ea7d727ad20587b63ebe826032e0d20cdc6627b","1e8ecd6ff5aabae78172a0214d07a5013992d133af58afa74049de726df2a6c4"],["3398c0c0219f5ac87a8c73fcd17b89311d120a53f5231cb761030c194fed4265","025b234a1dc8662c068c4ba903939c2f79f3f7a3ae64e5edbf667b13599142d9"],["5941a17b04cd3465031cb6745cb94eed24e1ff8d38a6e832f1637ae8e89c78e6","5309792c546b6cda458be331957763b5adb5d535d54a4a61023678faa2ee02ee"],["2cb490d2c0047fcbaffe1df26640bee73c158af6fec91343d606ce9d124a20c9","2e2952ebf089200aebfa3947f241e2fe85797afebdc1ea06d9d26de1b446a964"],["79305236b583232a91c63c7d9ca3750be7ee21711e4d6d257c39ae398212bde1","6f9ecdfa953e302c2014fd8512405e4be0d48302acd15e93936e8dba7d01053b"],["57d9fcb884b94664f35387fa6665cd9bc8136f90d804d77416ea99c3c653ee63","14197e65f0a3599c0b9fcef75b5fbb93580d1b2457b59fb70ce7b9bac88d0fbc"],["6d99df2c28c9fa1e38acddefd3e0931109143d873f3330377a9926bdacdd6523","2f21987905f397f092fc56c5ccd301a1e6afa3c4611627e25017b2e68d07c150"],["749d19591f1755bd481fa12a288166aac42911654c8c551395b265116269ceb9","7ec145aa7558d0342cd87b1750933cb6f3717e727a86a1cc1f2b0c274213688d"],["340f7f5ae19292957902635a5786d14fa38036b324ae759da501e32b8c4073f1","64e231a413f1379a26f4e8223ff91fe2ccd865549571d3c6c28871964b40a0ea"],["4aa33e00bf6e92cac4e84384e5dde0727394233afd5d24d357a8afeb94b08109","3385bb4fbc441937ee01b671d506227a654fd6c1c532cf5221710c6c56ec7e21"],["34b2ffca05f01088de266306c5cc122661e9308eab16929774e58565afc0e4eb","7662faf0f70e82c062c2b835fc6da3353d3cb20b80611ffa6ef2982cf62fa605"],["820fcb51326f1536ddb8dc1052aa198406c7e48f2c81e7664d15f8f9d3715e","756574c23bb01170b97d9fa1663a8ff2f5b97eaa5cd53f34140c1bcec8c262d9"],["0861d7e84cec6d6e33641ff6c85202fc0e9160797809ddc2193802499caf05d3","34936e0a5dc7e2a6217d475fbb8c1c607fb8b3565908a04fd5948abdd399c59f"],["5b4a1dc887ef684d7b4b165b70acb70842a2fa105935af15ecb4a097e33b8f2b","54d21511c05805e5298a72372b8289e9d59c46dc8b5c368bbfda620b68aa652c"],["755493ed60b13f03f9c019362a5af73fb49842dd6916e2572b1b6a312cd20cfc","0750bcbf7e449cec422b93ace1489e1b177d4dbbaa781d315c74d54bb444e9a9"],["5f1c341065b6a81ed2edb6bc38ba81b4c2e3fe2058e5baa13e1406eb2c5b4b4b","6179ebfa7f8086f26820fc99ca2f94c1be19bca672d79cea5b02a836119e06ba"],["1915024ee86acfba3f61ced9707521197195166fb1c4639bf3b3fcf0bf0ded46","5f2e0547032221d2b00937cf524590e3d90901ef0286ea0b032c1a81461b6d92"],["4e942d95930f38c8786ff4a8e576e7a29fb7627afe1fff91cda5006ba0624f5d","45902f695d512d70ce4c1e0520c0060896b94e14d2960b2fcf2ed5e138e0217b"],["63e45f3d91ab915d412bbaa17d1d249e1a1445077fbfaa6be7d35041c5116a91","46dad5a4ec2ad0b86938f5e09f1c03b53b660fc5137648b08527cd20708003da"],["5e2ddd2175417f72c9962c503ac5adf94ed11f28b9d41fccb6a4512886f3cc87","3523b218478911145af1dc431feb7db0a04066eb6e2ade3c7b67d11bc55323aa"],["62ff30a6b179a26e7247a8312cb3af3289e5d722f76a29f203aa623889aa05ec","562beb7999019346beaa80dfd5b95d614e1ff96c1cb1037f65c44997b797d066"],["14988b5d62084fb8335c2f261cdeddc1b634b09cedfce713ff5f0a0bb588a556","447068731fb98e821b8e413b3b48f2d1c8bea308f05aac877006b0f4c3b0cab3"],["1ac777f708a5942cc434236920e82ccc6af920c0a0676712255aa7082b37a5b6","52a6f88d92af1887c781501c6e3a88169a2831b74aefd416f22b47e8335ce317"],["5959792833b71bd5042b78e42212af671f5f87a08eafd8cdde2dcec8140e4bb3","41ce94633eabb8a1b08fac66f762997ed8c9e2af3558e1f6586ad6a5bf5b7b64"],["4464a7962e6722b457336fe98c91765b1ff178f9e892e90129e65fa7688a0607","3d1510b92fd33c501f058a7a86bddedf1b83f9b6e4f04829d321117013f891fe"],["62906d81e7f800e662519f4324ab4c8aac197661c729eed3e744d09efe721c08","4b68efb5b1b709ab86e3253d70bee87ba07875c04a64ecf7e35cd8cdc6c0f7d8"],["4300ff025ac78ef36e58ee7d0d732cf76cd0929fe265b3a093a57f23fc326757","2f92880570846ff2e90d91f16bce3705c9c3ca8011cc543091463b623e4b3c01"],["5427ba28d94652527a9b0c76f57a451e46bdc06cbc8a2481df17f66ffb1524e3","547a97c4afc8d1f74a5d51f7e524f68472f589cc0b396b21368628721537d722"],["424c4493810bfd5e3ffa21776326d8ff62bf8fe74504d7a2db5d3f74e5ce1015","74d0daa832d40405d01551a58b330ffc5abd5356230d6d7cabeb5b1a55046f32"],["54e10980d81b4ae8778896684295fa5c5475e8d68ec2a26e1b0a65383507b3cd","6b1eb48da6886c4d88cea720e9dc8b0d8c51a8f0e1943afa31a40eeb553c0676"],["732eb9e9ebb556e9f024c5574166738f4707b0fd005f568212ab575c1db71ddb","1fc6b00c89e48114d6b13d9920a0c78093994f2b08df147bdbb56bead2cea165"],["74029c04b34b7f314855fee42a04d0ddfdeb92ef3bf7cff629928a97733d96fb","501f63a252dfbc090733b5a208bfe08f81c91419ce3d2d6c0de8cdc5a5625014"],["04524402ebb71a60bf1055001000203a6d4917f112e50dd766cdd7b718a6edd7","71c9e2d15cdc47c565a696ffbe55277570930ed7ade13b9a254059365d5bf338"],["2555c620a50f2bbeeacac66228a96941fa733aa6070855331613578ed7c12794","2b3c1bc5cda7f93242561dbf7572237ac43bf013553230633a5e18b7e71597e5"],["555ea607b0ad18afaf70d7450543d7ffb5b883a3cad3e2778826ca97bf3211a6","6df903158f51aa530d411720a760f8ad0ce9904d54955fda74a349be58eddf5f"],["4db3cfa284207a250a9c83e1fec07e804d70065da586ff2c2a7d2bcb92e6fca6","2a4fbf1c51dc0b2a7783db2be3bd35c2d6462470c88c8b73ae3ce8503fa07154"],["5174e33ffdf28a87184a4d6427d821cbaa3b88ac293a90ca7e1eeae8c5050b16","315ca6bc8e35e4a3d06f89e1db1575b16197963ee8e64746fa998ccd403561cc"]]},"doubles":{"step":4,"points":[["23a4860627e53aeeb8e22b1508249c9109578d33e7bf237459b2596d6c28f9f8","709696f2827fc3729f980f2e3aad6e78b06a11ff8e079c27d87aab37c16727eb"],["5e7e07ed4e1decbfe6e9cbc126905449d4b578fbb561576d20b8bcdd0cc2a556","0f55755c51f102796bf5ebaa81d3260e7d1b3d9ac127d9a80e142031566cf6c7"],["7d13c0248b891b47eb524f2692008e2f97b199bac426cb5902b9003a29ded6ea","59a976ab2c01a81a91f1a56c75ccc77a9e1e9e878e9fe9c3952080a6805b20d5"],["5de7faa2ee4e70132f541f79ca07cd54a39fe1347a6844d19e9d678a8411a565","2c9f23641e1c2e0aab8ea9926b432d92c0e8bc08901d6ff6df85e4cef854ec36"],["06b349eebfed4dad4a805b63a6ed2231a565cda752d9477ff427dd9a8c9ab5ed","07a09289ff3e1f9aab68aa374c48df65f550c2323607b97744dee990608b64f8"],["0af367956af630266b1cc760154256ed79da960dddca9d72a1e8cf27d8d43a77","21108d900134d3b3708dd28ace96b0b23dda9100e4b6a62a8131bd2f2ba408c5"],["1e45a60140a3b2dee9b8dc6ff307154a1b410bcd38e0e38fb10b2f6da1afbe2b","0e730da473dffd60d2f3241a85e68acb47d26e5043ad047d893f072c8dda0a76"],["4d1e116d136158c5ddabd4276832800f2c081c1072de6f2d931797a46abc0cbb","6d415be49d4e35b65cc51354b5008f8c43e84b7b5e8a4b84f44e1efb10c9b91a"],["2b6b892ae94b454b2c2d92bb947fc4d506d173d281779c2c153c001ded42d3d0","7f1cf64e0e180fc4d6e12c1b5c5285f376e979616a52c94a0dea4d48c5880cd2"],["0f6c3a96e0032a9394337a02ffb2c83ba70efb8f566feab530fc90fa3b4710e5","3d4e97e286378675038a4b58e84224ee515e1d6697ac79389f78479be167635a"],["52ee53b981dfbc41ddaa5ddc2754c4175f4811aa45f8e2b19a425657c238a83e","7eb0a1be3400dec87b388cad51613957643cdf0595b891cc6f925fb36da7f1c3"],["52a837bc7a7bc9459bcc2ecf80f74d9ed99def0342e18cfbe8e799fbc504fd52","50d6460185d8924e5485f23f36a98c86053514d163547adab6fe91478a411196"],["6b2bd5d00fab38ceca21a27d6aaec82626b14b555d859527718f8ca404eba4","727340c27a15f6ab3d80547f0827c56ab1ba33bc30d1ef3909ea9a3af10c67e5"],["71dd75fe35761c01a48597ec730bc33237902fd4ad8612cbed1031eebdf40de4","39674a4532078e34378667beae5cb55f814ead9bbaf7e01b3b69533e9f88a411"],["57426aefc21be9ccf162e23d25ac3002ba8534351e65613f870f690f2fd46cf5","6b45b002fb4e8a6f59a6ffb006ed71f75434217333b266325204c7d1ac2e1f34"],["6222bd88bf2df9d5d44b60cfb4a08a960078db7ed51a35eb3e0b6b8ff4eda202","0325bb42ea4ed025dd6bdaed261b7c4f5410b608ba902b068f1efa5782e45313"],["71ac99647b61b9eca6f0c23432a518f738aee708d5932d4ef0f172240250a226","3a96c2c028ebe5f48913be30147e41bc5e1cab9595d5404138a9aa1b5574cf25"],["1f6a1fd8cc0e05b2742ba0fc0369b5247670543637dd033e64dbce90b2f23e9f","779964401ee869a9b31c0ef874a86440ba85d25c2ce932bd31a0865869605e19"],["22e2c039067920c42980dcb3a905fc91601c2b34e819ce1532ada4a5fc39d5cc","631cf9945a09bf26d7e595b3f8e3390696870512820df63c5418577089e1a8bb"],["608de273a9f6a534219d7aaede3cf65a81e4dc03d7a2765eced1d2b7be4610f4","3b31d0113f98d81ab1312fb2837aa9c8dcc7960f84eb371358c6d841f67144fa"],["3f748617ca63ab3e44c6e34f63e7328ea56a2a146da34368a57dca181254fe02","0fed89e6420fc47b3938a2891ba9acee4cbb2899ee4e9ca15a13dc527dc1641e"],["69d98b5ecc35d56c97c0bf312955d199befe116b417d70f5f57e2dfd0af81ce5","3e26d487fbfe36ab44e0ca3b248fe94bce92a69b8154d50e2d5481f8259f4e8e"],["1e34443347f9e627b3531157faab6eaca1bc3114df4a1423cc12bf8417b5d622","295955a5ed061eca7f87b9485666ba9489ec20a9c484224dc920350bb4a6fc79"],["51f4ff8c599b1c96da82941520a9f5abf4a31eb8b84fc95056145ceb3b5775d0","35ac9588d46e41f3f6f99aee3852eeb4b12e807807d4bd1b7f8406b0d7863ac1"],["3faa2a093a19a02424f65a10955101f4dc015c43b2dfce8e001507abd741b845","7a1de10dacfda389ca663b15574bdc8ae8c5b6e7cee647e77b11ddbfc6eb8edc"],["1924416956ea2c1269062588569b18178011ea7cba1a3266284f48aa01d5a90f","0c8e28127b7dcdd206fb6fee96eb88cfc7db7319826ac8cdb8b1fb8adaf021de"],["49761c57ce3c8c4f1435d495903e2f536f3be3712e76af8d0b5a8b7d1ebc8fac","3225035e1065094ef32d7f3e7a6f8ff2748025f96e0c0b44eb35576b61e150a8"],["4339fa86a23242851a16afc3ab05b352a7b4bf53599a49dd7e29d364fc3a757b","6d07cc3462bae9160bbebb997510817040767faa9dbd13f158a5fe8a63a34b0e"],["6bda13918dcbaf8529d6326ae7a9c278b72417c2188c5ea4f062fc50639295fb","2c3fa803b162ee887d0d97a6734866f992f846625f314117075da54bb6c20a36"],["4da4821314574d4fed4dcf692c8b15b99b73f13633210333ce7871359b6e6424","314016034673d2d20529bc93a2dab6e462bcb5f66e1f4a6bf2170759a40a6e65"],["0b2cea0029ee963c0034b61bf19e384435f14554a7d297b5144838c38e375586","47ea95da28d39aaade5edb8ed941c687603cfdd1508776e96d6683199e99daea"],["4c27afff3c45f32c952d3984e14e29a098e685c9c2e723e5fc8047ae60b7e824","5f2c99e6526dc87d95f11eb626c29c3a90d0be1e51a4c49e5bbabd114bf5a66b"],["53e2a4ed1bbb48bd016c524a02f797654cfc969849f867681da94e341f377534","5a2334fdda642732a3c9520ce06581aa7f0f082882554c37b8d390a25a9bd559"],["7b8d2c823baafe0d878a55e8af1db150dec85b1424a4901f9beffd3a6196e3d6","1c45a557b3624f9b89ed15b3c3e1a065f1b453d948f7cf45d9494483f8af0c85"],["78877b5d8777410997dacaeea59400fc9db4421fac02c4282301c67d35fb7ffe","0341b46c328333e4484ce8607619014d41775c408c88856d2f9e19812d90fbf5"],["2b556bbc070b5c4bae9e575836d1d68ee9fbe800448c0d2c233f78185eed3f91","7ba01332807ebd892e00ddb368c0fa1b3f19b5b32efd90b178d984e1d7174d6f"],["0f72556998b0044799f0fd03210ded3d984e3843bbaf3c1d5d692bc94d43c4e7","16c19c5037c103d447caef4efe6bd81a490e7c668f6870f1b080863b5315df5e"],["1cd96ef237b213cd446f13b3ec40d32ecc593bc6ea71e77efc284341a5f3da1a","7a626aeb91efcb5f9777264f5e17ced8b411f68c713673ef0f184a5ccd60dbe3"],["31a75b21cb532622a7caf9e29e652ac4e47b1450edf6655acaf3797b55a7ca46","77006e7cf104982f8865081a2ff8a6911546755e31c3586353b0bd0826c5d790"],["543d84cb04fb2bf787b7aa382eaab5cd8d050ad8ee52aa8a285b945652014031","0358fdc5b63ed49e693d838f182b275846f42dd49a42ec2e6e932ba4de59ef20"],["0a2818f5f5d8937800c30ac6b847db2cdef655b864126302249144a5a15b205a","187c76a49af10851bb049ba97c0fbbb14b2621522a4e8d9670ea46e56c9a1bd6"],["7efb45d3a2851109d7a8d50ddb08fe308bbf674c019b965cdad4570a141e648a","0fe1198b11a1bf56867091c69d71f8b7792257dda321d43652e818acd0c28cda"],["472e960dd122a534f52377235350549df4a1dd7a08cfc580bff5fb4b0a70aa7b","10585d04fc529fef4c0c0776154fc7ebbaedbae8a99937e47598d0578932b7cc"],["04892cfff7f94ff7f07c1241e3ac4945bc46ea9d6a3c1c3adbce109a9afceb6a","3ae2aa25e2555135a7a3251c11a3f8eebe81758bc1c3e2cbc6e6ca461a543130"],["2401d311a3abfd2583f1c6aa519c1f18ff730a0abf730ddcc9c9739b04d8a85e","653224f3488cae1ae19a414a9932035a2bf2c46803b5532bbb645e62387ee34d"],["0ea2c846a535a115972161612a192588d92d68a3c9050eae91b2817b94e68325","3b82a8337b05f11bbac176a113be183a50a0331f3d3116f24b971b5a8b0d031b"],["0fb3f87c2c6c89c65b74299b77f3736546a8b9e41b19197476bff27354e1c128","1034d42c15a2bfe3e682fad49dbc2812caadf0c584bc30b51625b85d74e9d5f7"],["1bc7af1e38185e7c2d8d04371c7e177d7a9ddee1b81d7d26db7ad644c7dad28d","61d909d855661f2f7a5eef87795dc0491d027e12631b270fcaf2f65900314833"],["469d0960dbd0ef9c91c4597ccf7c209549b187ff63bd378b7dac577198d74a4d","0b5f21c7f86832241f2157c288bdc9394f83f8d57457f6d9f6b345e4909478cb"],["5e9ac4ab2f4a3c3526e1317f913d69e3826fe862efd0c80d9310319170c5cbeb","505f00fa8aee03ccbd2f33529ae1e4e4bcf2644fe673d0b0290ec32be5b51bab"],["11cd80e1fdcbc565efed81d17f3f54643ffeed1cff38f3825e115adbd82759f1","43f11943f7ef3fa68b980fee45e98134f1df22263b2d14419d61ffe62822dbe0"],["3328bc121616a9477165ed282053d203c24f4826076c638a2c6723d42c9bfadb","2bbf3f26c21b5cb273e5f4f0114c6718c5eb7291939b7697c74333cdfafac039"],["0ba774bb605dd804cae6887e81f6bd2c59e024fac8bf5f5c48a841a037c28398","54ba013ad2d04dcdfb5a151b7347ee9a10067ddd0a3907e9bc337a77bf911321"],["1074ff0267662dc2b4ce65aaa0229c375a3d0d843ce9349233949581c869b64c","299be0decb680ec28923da4d049770107d42c180b460da13a7b1efc7e6d5b022"],["25ed76d78c87c3bd64b4331902c5a853734283e25f19f320295667b80a340d35","179b5f92f545c7b326b3a63fb0b32a0f52b4159988436d5af50c1d0d76373947"],["75d942c04210dcde5d1bd4fabfc732d3f95568e399382c0423c83c41cb05dc3f","696cc14856cdc13c8fd7e2c5771731cbf38e3fad47a424679765c4874e35ab2d"],["5d9324f56975477d5945599eeeccec67708c996cd3f3f2818bf2591507e3502a","10985a3cfd573205281aec24e2c8b41f5cd8cdfc9d7be34675cf306bbe1b4f6a"],["7511066c0e12105a7b937c7ecef367d5afe6e621e5cabf4e490b09b7ada7ee07","604df365b8391cbca8848f88daa700b770da5bb136f70bfb0a3ea33ba386fcd5"],["2596e5b3cf5494e60d2a750d03c66abc2e0183af53620b893f9cf9fc3b76dc26","68a0a7ac9a0cc093884a6b84f45a2cde595194e0f48dbd566fa78a3174b182fe"],["28bd38d44030dd9ca028b2a2f31a795f4c7a5e85a785df7847e3d525e99d4787","552dd7405c4183733ad3c4e7ccb999b4fed81b7a4444aab499d41d6d78d5bbfc"],["59233a3346f61135f431f96cf0197e24ad38240b222c010a6ce538cf4c24347b","3cce55908611d2b93f221613f09cfc4dbcd2e2b609233eea5439ad1908a10b20"],["5830f025f1078d408948f73096af97de1e9e70b3be85890acb21132c34ff961f","67d451752c2433ffe66e47242e301e56db2b2f8203553cab9de717e25793d41e"],["6a0c8b194571e874b82d904da36d43096bbe36d512e24ff8dcb2b00b57ffd3ec","5f85adb7749cc735ec838bcccfe7d4b52902c6132998d7ac8e032cad031c42b8"],["53b3f967bff8760948dec5e9282f35d1434a5503790b9012e17faefbe7c4d699","404462283c8664a17daa5b4059dcd10e2699fd86d0140de9f3e8ad0566098ae5"]]}}')},function(e,t,r){"use strict";e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},function(e,t,r){"use strict";const n=r(173);e.exports=function(){let e,t;return{sink:async r=>{if(e)throw new Error("already piped");e=n(r),t&&t(e)},source:{[Symbol.asyncIterator](){return this},next:()=>e?e.next():new Promise(e=>{t=r=>{t=null,e(r.next())}})}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XX=void 0;var n=r(0),i=r(53),s=r(353);class o extends s.AbstractHandshake{initializeInitiator(e,t,r,i){const s=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");this.mixHash(s,e);return{ss:s,s:t,rs:r,psk:i,re:n.Buffer.alloc(32)}}initializeResponder(e,t,r,i){const s=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");this.mixHash(s,e);return{ss:s,s:t,rs:r,psk:i,re:n.Buffer.alloc(32)}}writeMessageA(e,t,r){const s=n.Buffer.alloc(0);e.e=r||(0,i.generateKeypair)();const o=e.e.publicKey;this.mixHash(e.ss,o);return{ne:o,ns:s,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageB(e,t){e.e=(0,i.generateKeypair)();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));const s=n.Buffer.from(e.s.publicKey),o=this.encryptAndHash(e.ss,s);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));return{ne:r,ns:o,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageC(e,t){const r=n.Buffer.from(e.s.publicKey),i=this.encryptAndHash(e.ss,r);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const s=this.encryptAndHash(e.ss,t),o={ne:this.createEmptyKey(),ns:i,ciphertext:s},{cs1:a,cs2:c}=this.split(e.ss);return{h:e.ss.h,messageBuffer:o,cs1:a,cs2:c}}readMessageA(e,t){return(0,i.isValidPublicKey)(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),this.decryptAndHash(e.ss,t.ciphertext)}readMessageB(e,t){if((0,i.isValidPublicKey)(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),!e.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));const{plaintext:r,valid:n}=this.decryptAndHash(e.ss,t.ns);n&&32===r.length&&(0,i.isValidPublicKey)(r)&&(e.rs=r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const{plaintext:s,valid:o}=this.decryptAndHash(e.ss,t.ciphertext);return{plaintext:s,valid:n&&o}}readMessageC(e,t){const{plaintext:r,valid:n}=this.decryptAndHash(e.ss,t.ns);if(n&&32===r.length&&(0,i.isValidPublicKey)(r)&&(e.rs=r),!e.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const{plaintext:s,valid:o}=this.decryptAndHash(e.ss,t.ciphertext),{cs1:a,cs2:c}=this.split(e.ss);return{h:e.ss.h,plaintext:s,valid:n&&o,cs1:a,cs2:c}}initSession(e,t,r){const i=this.createEmptyKey(),s=n.Buffer.alloc(32);let o;return o=e?this.initializeInitiator(t,r,s,i):this.initializeResponder(t,r,s,i),{hs:o,i:e,mc:0}}sendMessage(e,t,r){let n;if(0===e.mc)n=this.writeMessageA(e.hs,t,r);else if(1===e.mc)n=this.writeMessageB(e.hs,t);else if(2===e.mc){const{h:r,messageBuffer:i,cs1:s,cs2:o}=this.writeMessageC(e.hs,t);n=i,e.h=r,e.cs1=s,e.cs2=o}else{if(!(e.mc>2))throw new Error("Session invalid.");if(e.i){if(!e.cs1)throw new Error("CS1 (cipher state) is not defined");n=this.writeMessageRegular(e.cs1,t)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");n=this.writeMessageRegular(e.cs2,t)}}return e.mc++,n}recvMessage(e,t){let r=n.Buffer.alloc(0),i=!1;if(0===e.mc)({plaintext:r,valid:i}=this.readMessageA(e.hs,t));else if(1===e.mc)({plaintext:r,valid:i}=this.readMessageB(e.hs,t));else if(2===e.mc){const{h:n,plaintext:s,valid:o,cs1:a,cs2:c}=this.readMessageC(e.hs,t);r=s,i=o,e.h=n,e.cs1=a,e.cs2=c}return e.mc++,{plaintext:r,valid:i}}}t.XX=o},function(e,t,r){"use strict";(function(t){const n=r(39);class i{constructor(e,t,r,i){n(e&&"string"==typeof e.id),this.hash=e,this.size=e.size,this.prk=null,this.state=null,this.slab=null,this.save=0,(t||r||i)&&this.init(t,r,i)}init(e,r,n){return null==e&&(e=t.alloc(0)),null==r&&(r=t.alloc(this.size,0)),this.prk=this.hash.mac(e,r),this.reset(n),this}set(e,r){return n(t.isBuffer(e)),n(e.length===this.size),this.prk=e,this.reset(r),this}reset(e){null==e&&(e=t.alloc(0)),n(t.isBuffer(e));const r=t.alloc(this.size+e.length+1);return r.fill(0,0,this.size),e.copy(r,this.size),r[r.length-1]=0,this.state=r,this.slab=t.alloc(this.size),this.save=0,this}generate(e){if(n(e>>>0===e),!this.prk||!this.state||!this.slab)throw new Error("HKDF is not initialized.");const r=(255-this.state[this.state.length-1])*this.size;if(e>this.save+r)throw new Error("Too many bytes requested.");const i=Math.ceil(Math.max(0,e-this.save)/this.size),s=t.alloc(this.save+i*this.size);this.slab.copy(s,0,0,this.save);for(let t=0;t<i;t++){let e=this.state;0===e[e.length-1]&&(e=e.slice(this.size)),n(255!==e[e.length-1]),e[e.length-1]+=1;const r=this.hash.mac(e,this.prk);r.copy(this.state,0),r.copy(s,this.save+t*this.size)}return this.save=s.copy(this.slab,0,e),s.slice(0,e)}randomBytes(e){return this.generate(e)}static extract(e,r,i){return n(e&&"string"==typeof e.id),null==r&&(r=t.alloc(0)),null==i&&(i=t.alloc(e.size,0)),e.mac(r,i)}static expand(e,t,r,n){return new i(e).set(t,r).generate(n)}static derive(e,t,r,n,s){return new i(e).init(t,r,n).generate(s)}}i.native=0,e.exports=i}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(39);e.exports=class{constructor(e,t,r=[],i=[]){n("function"==typeof e),n(t>>>0===t),n(Array.isArray(r)),n(Array.isArray(i)),this.hash=e,this.size=t,this.x=r,this.y=i,this.inner=new e,this.outer=new e}init(e){if(n(t.isBuffer(e)),e.length>this.size){const t=new(0,this.hash);t.init(...this.x),t.update(e),e=t.final(...this.y),n(e.length<=this.size)}const r=t.allocUnsafe(this.size);for(let t=0;t<e.length;t++)r[t]=54^e[t];for(let t=e.length;t<r.length;t++)r[t]=54;this.inner.init(...this.x),this.inner.update(r);for(let t=0;t<e.length;t++)r[t]=92^e[t];for(let t=e.length;t<r.length;t++)r[t]=92;return this.outer.init(...this.x),this.outer.update(r),this}update(e){return this.inner.update(e),this}final(){return this.outer.update(this.inner.final(...this.y)),this.outer.final(...this.y)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n,i,s;i=[r(913)],void 0===(s="function"==typeof(n=function(e){var t,r=e.Reader,n=e.Writer,i=e.util,s=e.roots.default||(e.roots.default={});return s.pb=((t={}).NoiseHandshakePayload=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return t.prototype.identityKey=i.newBuffer([]),t.prototype.identitySig=i.newBuffer([]),t.prototype.data=i.newBuffer([]),t.create=function(e){return new t(e)},t.encode=function(e,t){return t||(t=n.create()),null!=e.identityKey&&e.hasOwnProperty("identityKey")&&t.uint32(10).bytes(e.identityKey),null!=e.identitySig&&e.hasOwnProperty("identitySig")&&t.uint32(18).bytes(e.identitySig),null!=e.data&&e.hasOwnProperty("data")&&t.uint32(26).bytes(e.data),t},t.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},t.decode=function(e,t){e instanceof r||(e=r.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new s.pb.NoiseHandshakePayload;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:i.identityKey=e.bytes();break;case 2:i.identitySig=e.bytes();break;case 3:i.data=e.bytes();break;default:e.skipType(7&o)}}return i},t.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},t.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.identityKey&&e.hasOwnProperty("identityKey")&&!(e.identityKey&&"number"==typeof e.identityKey.length||i.isString(e.identityKey))?"identityKey: buffer expected":null!=e.identitySig&&e.hasOwnProperty("identitySig")&&!(e.identitySig&&"number"==typeof e.identitySig.length||i.isString(e.identitySig))?"identitySig: buffer expected":null!=e.data&&e.hasOwnProperty("data")&&!(e.data&&"number"==typeof e.data.length||i.isString(e.data))?"data: buffer expected":null},t.fromObject=function(e){if(e instanceof s.pb.NoiseHandshakePayload)return e;var t=new s.pb.NoiseHandshakePayload;return null!=e.identityKey&&("string"==typeof e.identityKey?i.base64.decode(e.identityKey,t.identityKey=i.newBuffer(i.base64.length(e.identityKey)),0):e.identityKey.length&&(t.identityKey=e.identityKey)),null!=e.identitySig&&("string"==typeof e.identitySig?i.base64.decode(e.identitySig,t.identitySig=i.newBuffer(i.base64.length(e.identitySig)),0):e.identitySig.length&&(t.identitySig=e.identitySig)),null!=e.data&&("string"==typeof e.data?i.base64.decode(e.data,t.data=i.newBuffer(i.base64.length(e.data)),0):e.data.length&&(t.data=e.data)),t},t.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.identityKey="":(r.identityKey=[],t.bytes!==Array&&(r.identityKey=i.newBuffer(r.identityKey))),t.bytes===String?r.identitySig="":(r.identitySig=[],t.bytes!==Array&&(r.identitySig=i.newBuffer(r.identitySig))),t.bytes===String?r.data="":(r.data=[],t.bytes!==Array&&(r.data=i.newBuffer(r.data)))),null!=e.identityKey&&e.hasOwnProperty("identityKey")&&(r.identityKey=t.bytes===String?i.base64.encode(e.identityKey,0,e.identityKey.length):t.bytes===Array?Array.prototype.slice.call(e.identityKey):e.identityKey),null!=e.identitySig&&e.hasOwnProperty("identitySig")&&(r.identitySig=t.bytes===String?i.base64.encode(e.identitySig,0,e.identitySig.length):t.bytes===Array?Array.prototype.slice.call(e.identitySig):e.identitySig),null!=e.data&&e.hasOwnProperty("data")&&(r.data=t.bytes===String?i.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t}(),t),s})?n.apply(t,i):n)||(e.exports=s)},function(e,t,r){"use strict";e.exports=r(914)},function(e,t,r){"use strict";var n=t;function i(){n.Reader._configure(n.BufferReader),n.util._configure()}n.build="minimal",n.Writer=r(351),n.BufferWriter=r(923),n.Reader=r(352),n.BufferReader=r(924),n.util=r(54),n.rpc=r(925),n.roots=r(927),n.configure=i,n.Writer._configure(n.BufferWriter),i()},function(e,t,r){"use strict";e.exports=function(e,t){var r=new Array(arguments.length-1),n=0,i=2,s=!0;for(;i<arguments.length;)r[n++]=arguments[i++];return new Promise((function(i,o){r[n]=function(e){if(s)if(s=!1,e)o(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];i.apply(null,t)}};try{e.apply(t||null,r)}catch(a){s&&(s=!1,o(a))}}))}},function(e,t,r){"use strict";var n=t;n.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var i=new Array(64),s=new Array(123),o=0;o<64;)s[i[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;n.encode=function(e,t,r){for(var n,s=null,o=[],a=0,c=0;t<r;){var u=e[t++];switch(c){case 0:o[a++]=i[u>>2],n=(3&u)<<4,c=1;break;case 1:o[a++]=i[n|u>>4],n=(15&u)<<2,c=2;break;case 2:o[a++]=i[n|u>>6],o[a++]=i[63&u],c=0}a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0)}return c&&(o[a++]=i[n],o[a++]=61,1===c&&(o[a++]=61)),s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};n.decode=function(e,t,r){for(var n,i=r,o=0,a=0;a<e.length;){var c=e.charCodeAt(a++);if(61===c&&o>1)break;if(void 0===(c=s[c]))throw Error("invalid encoding");switch(o){case 0:n=c,o=1;break;case 1:t[r++]=n<<2|(48&c)>>4,n=c,o=2;break;case 2:t[r++]=(15&n)<<4|(60&c)>>2,n=c,o=3;break;case 3:t[r++]=(3&n)<<6|c,o=0}}if(1===o)throw Error("invalid encoding");return r-i},n.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},function(e,t,r){"use strict";function n(){this._listeners={}}e.exports=n,n.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},n.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},n.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this}},function(e,t,r){"use strict";function n(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3]}function s(e,n,i){t[0]=e,n[i]=r[3],n[i+1]=r[2],n[i+2]=r[1],n[i+3]=r[0]}function o(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function a(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?i:s,e.writeFloatBE=n?s:i,e.readFloatLE=n?o:a,e.readFloatBE=n?a:o}():function(){function t(e,t,r,n){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var s=Math.floor(Math.log(t)/Math.LN2);e((i<<31|s+127<<23|8388607&Math.round(t*Math.pow(2,-s)*8388608))>>>0,r,n)}}function r(e,t,r){var n=e(t,r),i=2*(n>>31)+1,s=n>>>23&255,o=8388607&n;return 255===s?o?NaN:i*(1/0):0===s?1401298464324817e-60*i*o:i*Math.pow(2,s-150)*(o+8388608)}e.writeFloatLE=t.bind(null,i),e.writeFloatBE=t.bind(null,s),e.readFloatLE=r.bind(null,o),e.readFloatBE=r.bind(null,a)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3],n[i+4]=r[4],n[i+5]=r[5],n[i+6]=r[6],n[i+7]=r[7]}function s(e,n,i){t[0]=e,n[i]=r[7],n[i+1]=r[6],n[i+2]=r[5],n[i+3]=r[4],n[i+4]=r[3],n[i+5]=r[2],n[i+6]=r[1],n[i+7]=r[0]}function o(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function a(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?i:s,e.writeDoubleBE=n?s:i,e.readDoubleLE=n?o:a,e.readDoubleBE=n?a:o}():function(){function t(e,t,r,n,i,s){var o=n<0?1:0;if(o&&(n=-n),0===n)e(0,i,s+t),e(1/n>0?0:2147483648,i,s+r);else if(isNaN(n))e(0,i,s+t),e(2146959360,i,s+r);else if(n>17976931348623157e292)e(0,i,s+t),e((o<<31|2146435072)>>>0,i,s+r);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,i,s+t),e((o<<31|a/4294967296)>>>0,i,s+r);else{var c=Math.floor(Math.log(n)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=n*Math.pow(2,-c))>>>0,i,s+t),e((o<<31|c+1023<<20|1048576*a&1048575)>>>0,i,s+r)}}}function r(e,t,r,n,i){var s=e(n,i+t),o=e(n,i+r),a=2*(o>>31)+1,c=o>>>20&2047,u=4294967296*(1048575&o)+s;return 2047===c?u?NaN:a*(1/0):0===c?5e-324*a*u:a*Math.pow(2,c-1075)*(u+4503599627370496)}e.writeDoubleLE=t.bind(null,i,0,4),e.writeDoubleBE=t.bind(null,s,4,0),e.readDoubleLE=r.bind(null,o,0,4),e.readDoubleBE=r.bind(null,a,4,0)}(),e}function i(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function s(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function o(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function a(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=n(n)},function(module,exports,__webpack_require__){"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},function(e,t,r){"use strict";var n=t;n.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)(r=e.charCodeAt(n))<128?t+=1:r<2048?t+=2:55296==(64512&r)&&56320==(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},n.read=function(e,t,r){if(r-t<1)return"";for(var n,i=null,s=[],o=0;t<r;)(n=e[t++])<128?s[o++]=n:n>191&&n<224?s[o++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,s[o++]=55296+(n>>10),s[o++]=56320+(1023&n)):s[o++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0);return i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))},n.write=function(e,t,r){for(var n,i,s=r,o=0;o<e.length;++o)(n=e.charCodeAt(o))<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296==(64512&n)&&56320==(64512&(i=e.charCodeAt(o+1)))?(n=65536+((1023&n)<<10)+(1023&i),++o,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-s}},function(e,t,r){"use strict";e.exports=function(e,t,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(r){if(r<1||r>i)return e(r);o+r>n&&(s=e(n),o=0);var a=t.call(s,o,o+=r);return 7&o&&(o=1+(7|o)),a}}},function(e,t,r){"use strict";e.exports=i;var n=r(54);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var s=i.zero=new i(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var o=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return s;var t=e<0;t&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"==typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):s},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===o?s:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},function(e,t,r){"use strict";e.exports=o;var n=r(351);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(54),s=i.Buffer;function o(){n.call(this)}o.alloc=function(e){return(o.alloc=i._Buffer_allocUnsafe)(e)};var a=s&&s.prototype instanceof Uint8Array&&"set"===s.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]};function c(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write(e,r)}o.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(a,t,e),this},o.prototype.string=function(e){var t=s.byteLength(e);return this.uint32(t),t&&this._push(c,t,e),this}},function(e,t,r){"use strict";e.exports=s;var n=r(352);(s.prototype=Object.create(n.prototype)).constructor=s;var i=r(54);function s(e){n.call(this,e)}i.Buffer&&(s.prototype._slice=i.Buffer.prototype.slice),s.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len))}},function(e,t,r){"use strict";t.Service=r(926)},function(e,t,r){"use strict";e.exports=i;var n=r(54);function i(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(i.prototype=Object.create(n.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,r,i,s,o){if(!s)throw TypeError("request must be specified");var a=this;if(!o)return n.asPromise(e,a,t,r,i,s);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](s).finish(),(function(e,r){if(e)return a.emit("error",e,t),o(e);if(null!==r){if(!(r instanceof i))try{r=i[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),o(e)}return a.emit("data",r,t),o(null,r)}a.end(!0)}))}catch(c){return a.emit("error",c,t),void setTimeout((function(){o(c)}),0)}else setTimeout((function(){o(Error("already ended"))}),0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},function(e,t,r){"use strict";e.exports={}},function(e,t,r){"use strict";(function(t){const n=r(39),i=r(929),s=r(930);class o{constructor(){this.chacha=new i,this.poly=new s,this.key=t.alloc(64),this.mode=-1,this.aadLen=0,this.cipherLen=0}init(e,r){return n(t.isBuffer(e)),n(t.isBuffer(r)),this.key.fill(0),this.chacha.init(e,r,0),this.chacha.encrypt(this.key),this.poly.init(this.key),this.mode=0,this.aadLen=0,this.cipherLen=0,this}aad(e){if(-1===this.mode)throw new Error("Context is not initialized.");if(0!==this.mode)throw new Error("Invalid state for aad.");return this.poly.update(e),this.aadLen+=e.length,this}encrypt(e){if(-1===this.mode)throw new Error("Context is not initialized.");if(0!==this.mode&&1!==this.mode)throw new Error("Invalid state for encrypt.");return 0===this.mode&&(this._pad16(this.aadLen),this.mode=1),this.chacha.encrypt(e),this.poly.update(e),this.cipherLen+=e.length,e}decrypt(e){if(n(t.isBuffer(e)),-1===this.mode)throw new Error("Context is not initialized.");if(0!==this.mode&&2!==this.mode)throw new Error("Invalid state for decrypt.");return 0===this.mode&&(this._pad16(this.aadLen),this.mode=2),this.cipherLen+=e.length,this.poly.update(e),this.chacha.encrypt(e),e}auth(e){if(n(t.isBuffer(e)),-1===this.mode)throw new Error("Context is not initialized.");if(0!==this.mode&&3!==this.mode)throw new Error("Invalid state for auth.");return 0===this.mode&&(this._pad16(this.aadLen),this.mode=3),this.cipherLen+=e.length,this.poly.update(e),e}final(){if(-1===this.mode)throw new Error("Context is not initialized.");const e=t.allocUnsafe(16);c(e,this.aadLen,0),c(e,this.cipherLen,8),0===this.mode&&this._pad16(this.aadLen),this._pad16(this.cipherLen),this.poly.update(e);const r=this.poly.final();return this.destroy(),r}destroy(){this.chacha.destroy(),this.poly.destroy();for(let e=0;e<64;e++)this.key[e]=0;return this.mode=-1,this.aadLen=0,this.cipherLen=0,this}verify(e){n(t.isBuffer(e)),n(16===e.length);const r=this.final();let i=0;for(let t=0;t<16;t++)i|=r[t]^e[t];return i-1>>>31!=0}_pad16(e){const r=15&e;if(0===r)return;const n=t.allocUnsafe(16-r);n.fill(0),this.poly.update(n)}static encrypt(e,t,r,n){const i=new o;return i.init(e,t),n&&i.aad(n),i.encrypt(r),i.final()}static decrypt(e,t,r,n,i){const s=new o;return s.init(e,t),i&&s.aad(i),s.decrypt(r),s.verify(n)}static auth(e,t,r,n,i){const s=new o;return s.init(e,t),i&&s.aad(i),s.auth(r),s.verify(n)}}function a(e,t,r){return e[r++]=t,t>>>=8,e[r++]=t,t>>>=8,e[r++]=t,t>>>=8,e[r++]=t,r}function c(e,t,r){const n=t*(1/4294967296)>>>0;return a(e,t>>>0,r+0),a(e,n,r+4),r+8}o.native=i.native,e.exports=o}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(39),i=0===new Int8Array(new Int16Array([1]).buffer)[0];class s{constructor(){this.state=new Uint32Array(16),this.stream=new Uint32Array(16),this.bytes=new Uint8Array(this.stream.buffer),this.pos=-1,i&&(this.bytes=t.alloc(64))}init(e,r,i){if(null==i&&(i=0),n(t.isBuffer(e)),n(t.isBuffer(r)),n(Number.isSafeInteger(i)),16!==e.length&&32!==e.length)throw new RangeError("Invalid key size.");if(r.length>=24&&(e=s.derive(e,r.slice(0,16)),r=r.slice(16)),this.state[0]=1634760805,this.state[1]=e.length<32?824206446:857760878,this.state[2]=e.length<32?2036477238:2036477234,this.state[3]=1797285236,this.state[4]=c(e,0),this.state[5]=c(e,4),this.state[6]=c(e,8),this.state[7]=c(e,12),this.state[8]=c(e,16%e.length),this.state[9]=c(e,20%e.length),this.state[10]=c(e,24%e.length),this.state[11]=c(e,28%e.length),this.state[12]=i>>>0,8===r.length)this.state[13]=i/4294967296>>>0,this.state[14]=c(r,0),this.state[15]=c(r,4);else if(12===r.length)this.state[13]=c(r,0),this.state[14]=c(r,4),this.state[15]=c(r,8);else{if(16!==r.length)throw new RangeError("Invalid nonce size.");this.state[12]=c(r,0),this.state[13]=c(r,4),this.state[14]=c(r,8),this.state[15]=c(r,12)}return this.pos=0,this}encrypt(e){if(n(t.isBuffer(e)),-1===this.pos)throw new Error("Context is not initialized.");for(let t=0;t<e.length;t++)0==(63&this.pos)&&(this._block(),this.pos=0),e[t]^=this.bytes[this.pos++];return e}_block(){for(let e=0;e<16;e++)this.stream[e]=this.state[e];for(let e=0;e<10;e++)o(this.stream,0,4,8,12),o(this.stream,1,5,9,13),o(this.stream,2,6,10,14),o(this.stream,3,7,11,15),o(this.stream,0,5,10,15),o(this.stream,1,6,11,12),o(this.stream,2,7,8,13),o(this.stream,3,4,9,14);for(let e=0;e<16;e++)this.stream[e]+=this.state[e];if(i)for(let e=0;e<16;e++)u(this.bytes,this.stream[e],4*e);this.state[12]+=1,0===this.state[12]&&(this.state[13]+=1)}destroy(){for(let e=0;e<16;e++)this.state[e]=0,this.stream[e]=0;if(i)for(let e=0;e<64;e++)this.bytes[e]=0;return this.pos=-1,this}static derive(e,r){if(n(t.isBuffer(e)),n(t.isBuffer(r)),16!==e.length&&32!==e.length)throw new RangeError("Invalid key size.");if(16!==r.length)throw new RangeError("Invalid nonce size.");const i=new Uint32Array(16);i[0]=1634760805,i[1]=e.length<32?824206446:857760878,i[2]=e.length<32?2036477238:2036477234,i[3]=1797285236,i[4]=c(e,0),i[5]=c(e,4),i[6]=c(e,8),i[7]=c(e,12),i[8]=c(e,16%e.length),i[9]=c(e,20%e.length),i[10]=c(e,24%e.length),i[11]=c(e,28%e.length),i[12]=c(r,0),i[13]=c(r,4),i[14]=c(r,8),i[15]=c(r,12);for(let t=0;t<10;t++)o(i,0,4,8,12),o(i,1,5,9,13),o(i,2,6,10,14),o(i,3,7,11,15),o(i,0,5,10,15),o(i,1,6,11,12),o(i,2,7,8,13),o(i,3,4,9,14);const s=t.alloc(32);return u(s,i[0],0),u(s,i[1],4),u(s,i[2],8),u(s,i[3],12),u(s,i[12],16),u(s,i[13],20),u(s,i[14],24),u(s,i[15],28),s}}function o(e,t,r,n,i){e[t]+=e[r],e[i]=a(e[i]^e[t],16),e[n]+=e[i],e[r]=a(e[r]^e[n],12),e[t]+=e[r],e[i]=a(e[i]^e[t],8),e[n]+=e[i],e[r]=a(e[r]^e[n],7)}function a(e,t){return e<<t|e>>>32-t}function c(e,t){return e[t++]+256*e[t++]+65536*e[t++]+16777216*e[t]}function u(e,t,r){return e[r++]=t,t>>>=8,e[r++]=t,t>>>=8,e[r++]=t,t>>>=8,e[r++]=t,r}s.native=0,e.exports=s}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(39);class i{constructor(){this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.buffer=t.alloc(16),this.fin=-1,this.leftover=0}init(e){n(t.isBuffer(e)&&e.length>=32);const r=s(e,0),i=s(e,2),o=s(e,4),a=s(e,6),c=s(e,8),u=s(e,10),f=s(e,12),h=s(e,14);this.r[0]=8191&r,this.r[1]=8191&(r>>>13|i<<3),this.r[2]=7939&(i>>>10|o<<6),this.r[3]=8191&(o>>>7|a<<9),this.r[4]=255&(a>>>4|c<<12),this.r[5]=c>>>1&8190,this.r[6]=8191&(c>>>14|u<<2),this.r[7]=8065&(u>>>11|f<<5),this.r[8]=8191&(f>>>8|h<<8),this.r[9]=h>>>5&127;for(let t=0;t<10;t++)this.h[t]=0;for(let t=0;t<8;t++)this.pad[t]=s(e,16+2*t);return this.fin=0,this.leftover=0,this}_blocks(e,t,r){const n=this.fin?0:2048,i=new Uint32Array(10);for(;t>=16;){const o=s(e,r+0),a=s(e,r+2),c=s(e,r+4),u=s(e,r+6),f=s(e,r+8),h=s(e,r+10),l=s(e,r+12),d=s(e,r+14);this.h[0]+=8191&o,this.h[1]+=8191&(o>>>13|a<<3),this.h[2]+=8191&(a>>>10|c<<6),this.h[3]+=8191&(c>>>7|u<<9),this.h[4]+=8191&(u>>>4|f<<12),this.h[5]+=f>>>1&8191,this.h[6]+=8191&(f>>>14|h<<2),this.h[7]+=8191&(h>>>11|l<<5),this.h[8]+=8191&(l>>>8|d<<8),this.h[9]+=d>>>5|n;let p=0;for(let e=0;e<10;e++){i[e]=p;for(let t=0;t<10;t++){let r=this.h[t];r*=t<=e?this.r[e-t]:5*this.r[e+10-t],i[e]+=r,4===t&&(p=i[e]>>>13,i[e]&=8191)}p+=i[e]>>>13,i[e]&=8191}p=(p<<2)+p,p+=i[0],i[0]=8191&p,p>>>=13,i[1]+=p;for(let e=0;e<10;e++)this.h[e]=i[e];r+=16,t-=16}}update(e){if(n(t.isBuffer(e)),-1===this.fin)throw new Error("Context is not initialized.");let r=e.length,i=0;if(this.leftover){let t=16-this.leftover;t>r&&(t=r);for(let r=0;r<t;r++)this.buffer[this.leftover+r]=e[i+r];if(r-=t,i+=t,this.leftover+=t,this.leftover<16)return this;this._blocks(this.buffer,16,0),this.leftover=0}if(r>=16){const t=-16&r;this._blocks(e,t,i),i+=t,r-=t}if(r){for(let t=0;t<r;t++)this.buffer[this.leftover+t]=e[i+t];this.leftover+=r}return this}final(){if(-1===this.fin)throw new Error("Context is not initialized.");const e=t.alloc(16),r=new Uint16Array(10);if(this.leftover){let e=this.leftover;for(this.buffer[e++]=1;e<16;e++)this.buffer[e]=0;this.fin=1,this._blocks(this.buffer,16,0)}let n=this.h[1]>>>13;this.h[1]&=8191;for(let t=2;t<10;t++)this.h[t]+=n,n=this.h[t]>>>13,this.h[t]&=8191;this.h[0]+=5*n,n=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=n,n=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=n,r[0]=this.h[0]+5,n=r[0]>>>13,r[0]&=8191;for(let t=1;t<10;t++)r[t]=this.h[t]+n,n=r[t]>>>13,r[t]&=8191;let i=(1^n)-1;for(let t=0;t<10;t++)r[t]&=i;i=~i;for(let t=0;t<10;t++)this.h[t]=this.h[t]&i|r[t];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);let s=this.h[0]+this.pad[0];this.h[0]=s;for(let t=1;t<8;t++)s=this.h[t]+this.pad[t]+(s>>>16),this.h[t]=s;for(let t=0;t<8;t++)o(e,this.h[t],2*t);return this.destroy(),e}destroy(){for(let e=0;e<10;e++)this.r[e]=0,this.h[e]=0;for(let e=0;e<8;e++)this.pad[e]=0;for(let e=0;e<16;e++)this.buffer[e]=0;this.fin=-1,this.leftover=0}verify(e){n(t.isBuffer(e)),n(16===e.length);const r=this.final();let i=0;for(let t=0;t<16;t++)i|=r[t]^e[t];return i-1>>>31!=0}}function s(e,t){return e[t++]+256*e[t]}function o(e,t,r){return e[r++]=t,e[r++]=t>>>8,r}i.native=0,e.exports=i}).call(this,r(0).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IKHandshake=void 0;var n=r(932),i=r(0),s=r(111),o=r(53),a=r(933),c=r(85);function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.IKHandshake=class{constructor(e,t,r,s,o,a,c,f){u(this,"isInitiator",void 0),u(this,"session",void 0),u(this,"remotePeer",void 0),u(this,"remoteEarlyData",void 0),u(this,"payload",void 0),u(this,"prologue",void 0),u(this,"staticKeypair",void 0),u(this,"connection",void 0),u(this,"ik",void 0),this.isInitiator=e,this.payload=i.Buffer.from(t),this.prologue=r,this.staticKeypair=s,this.connection=o,c&&(this.remotePeer=c),this.ik=f||new n.IK,this.session=this.ik.initSession(this.isInitiator,this.prologue,this.staticKeypair,a),this.remoteEarlyData=i.Buffer.alloc(0)}async stage0(){if((0,c.logLocalStaticKeys)(this.session.hs.s),(0,c.logRemoteStaticKey)(this.session.hs.rs),this.isInitiator){(0,c.logger)("IK Stage 0 - Initiator sending message...");const e=this.ik.sendMessage(this.session,this.payload);this.connection.writeLP((0,s.encode1)(e)),(0,c.logger)("IK Stage 0 - Initiator sent message."),(0,c.logLocalEphemeralKeys)(this.session.hs.e)}else{(0,c.logger)("IK Stage 0 - Responder receiving message...");const t=await this.connection.readLP();try{const e=(0,s.decode1)(t.slice()),{plaintext:r,valid:n}=this.ik.recvMessage(this.session,e);if(!n)throw new Error("ik handshake stage 0 decryption validation fail");(0,c.logger)("IK Stage 0 - Responder got message, going to verify payload.");const i=await(0,o.decodePayload)(r);this.remotePeer=this.remotePeer||await(0,o.getPeerIdFromPayload)(i),await(0,o.verifySignedPayload)(this.session.hs.rs,i,this.remotePeer),this.setRemoteEarlyData(i.data),(0,c.logger)("IK Stage 0 - Responder successfully verified payload!"),(0,c.logRemoteEphemeralKey)(this.session.hs.re)}catch(e){throw(0,c.logger)("Responder breaking up with IK handshake in stage 0."),new a.FailedIKError(t,"Error occurred while verifying initiator's signed payload: ".concat(e.message))}}}async stage1(){if(this.isInitiator){(0,c.logger)("IK Stage 1 - Initiator receiving message...");const t=(await this.connection.readLP()).slice(),r=(0,s.decode0)(i.Buffer.from(t)),{plaintext:n,valid:u}=this.ik.recvMessage(this.session,r);(0,c.logger)("IK Stage 1 - Initiator got message, going to verify payload.");try{if(!u)throw new Error("ik stage 1 decryption validation fail");const e=await(0,o.decodePayload)(n);this.remotePeer=this.remotePeer||await(0,o.getPeerIdFromPayload)(e),await(0,o.verifySignedPayload)(r.ns.slice(0,32),e,this.remotePeer),this.setRemoteEarlyData(e.data),(0,c.logger)("IK Stage 1 - Initiator successfully verified payload!"),(0,c.logRemoteEphemeralKey)(this.session.hs.re)}catch(e){throw(0,c.logger)("Initiator breaking up with IK handshake in stage 1."),new a.FailedIKError(t,"Error occurred while verifying responder's signed payload: ".concat(e.message))}}else{(0,c.logger)("IK Stage 1 - Responder sending message...");const e=this.ik.sendMessage(this.session,this.payload);this.connection.writeLP((0,s.encode0)(e)),(0,c.logger)("IK Stage 1 - Responder sent message..."),(0,c.logLocalEphemeralKeys)(this.session.hs.e)}(0,c.logCipherState)(this.session)}decrypt(e,t){const r=this.getCS(t,!1);return this.ik.decryptWithAd(r,i.Buffer.alloc(0),e)}encrypt(e,t){const r=this.getCS(t);return this.ik.encryptWithAd(r,i.Buffer.alloc(0),e)}getLocalEphemeralKeys(){if(!this.session.hs.e)throw new Error("Ephemeral keys do not exist.");return this.session.hs.e}getCS(e,t=!0){if(!e.cs1||!e.cs2)throw new Error("Handshake not completed properly, cipher state does not exist.");return this.isInitiator?t?e.cs1:e.cs2:t?e.cs2:e.cs1}setRemoteEarlyData(e){e&&(this.remoteEarlyData=i.Buffer.from(e.buffer,e.byteOffset,e.length))}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IK=void 0;var n=r(0),i=r(53),s=r(353);class o extends s.AbstractHandshake{initSession(e,t,r,n){const i=this.createEmptyKey();let s;return s=e?this.initializeInitiator(t,r,n,i):this.initializeResponder(t,r,n,i),{hs:s,i:e,mc:0}}sendMessage(e,t){let r;if(0===e.mc)r=this.writeMessageA(e.hs,t);else if(1===e.mc){const{messageBuffer:n,h:i,cs1:s,cs2:o}=this.writeMessageB(e.hs,t);r=n,e.h=i,e.cs1=s,e.cs2=o}else{if(!(e.mc>1))throw new Error("Session invalid.");if(e.i){if(!e.cs1)throw new Error("CS1 (cipher state) is not defined");r=this.writeMessageRegular(e.cs1,t)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");r=this.writeMessageRegular(e.cs2,t)}}return e.mc++,r}recvMessage(e,t){let r=n.Buffer.alloc(0),i=!1;if(0===e.mc&&({plaintext:r,valid:i}=this.readMessageA(e.hs,t)),1===e.mc){const{plaintext:n,valid:s,h:o,cs1:a,cs2:c}=this.readMessageB(e.hs,t);r=n,i=s,e.h=o,e.cs1=a,e.cs2=c}return e.mc++,{plaintext:r,valid:i}}writeMessageA(e,t){e.e=(0,i.generateKeypair)();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const s=n.Buffer.from(e.s.publicKey),o=this.encryptAndHash(e.ss,s);this.mixKey(e.ss,this.dh(e.s.privateKey,e.rs));return{ne:r,ns:o,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageB(e,t){e.e=(0,i.generateKeypair)();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re)),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const n=this.encryptAndHash(e.ss,t),s={ne:r,ns:this.createEmptyKey(),ciphertext:n},{cs1:o,cs2:a}=this.split(e.ss);return{messageBuffer:s,cs1:o,cs2:a,h:e.ss.h}}readMessageA(e,t){(0,i.isValidPublicKey)(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const{plaintext:r,valid:n}=this.decryptAndHash(e.ss,t.ns);n&&32===r.length&&(0,i.isValidPublicKey)(r)&&(e.rs=r),this.mixKey(e.ss,this.dh(e.s.privateKey,e.rs));const{plaintext:s,valid:o}=this.decryptAndHash(e.ss,t.ciphertext);return{plaintext:s,valid:n&&o}}readMessageB(e,t){if((0,i.isValidPublicKey)(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),!e.e)throw new Error("Handshake state should contain ephemeral key by now.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.re)),this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const{plaintext:r,valid:n}=this.decryptAndHash(e.ss,t.ciphertext),{cs1:s,cs2:o}=this.split(e.ss);return{h:e.ss.h,valid:n,plaintext:r,cs1:s,cs2:o}}initializeInitiator(e,t,r,i){const s=this.initializeSymmetric("Noise_IK_25519_ChaChaPoly_SHA256");this.mixHash(s,e),this.mixHash(s,r);return{ss:s,s:t,rs:r,re:n.Buffer.alloc(32),psk:i}}initializeResponder(e,t,r,i){const s=this.initializeSymmetric("Noise_IK_25519_ChaChaPoly_SHA256");this.mixHash(s,e),this.mixHash(s,t.publicKey);return{ss:s,s:t,rs:r,re:n.Buffer.alloc(32),psk:i}}}t.IK=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FailedIKError=void 0;class n extends Error{constructor(e,t){var r,n,i;super(t),i=void 0,(n="initialMsg")in(r=this)?Object.defineProperty(r,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[n]=i,this.initialMsg=e,this.name="FailedIKhandshake"}}t.FailedIKError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XXFallbackHandshake=void 0;var n=r(0),i=r(349),s=r(53),o=r(85),a=r(111);function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class u extends i.XXHandshake{constructor(e,t,r,n,i,s,o,a,u){super(e,t,r,n,i,o,u),c(this,"ephemeralKeys",void 0),c(this,"initialMsg",void 0),a&&(this.ephemeralKeys=a),this.initialMsg=s}async propose(){if(this.isInitiator)this.xx.sendMessage(this.session,n.Buffer.alloc(0),this.ephemeralKeys),(0,o.logger)("XX Fallback Stage 0 - Initialized state as the first message was sent by initiator."),(0,o.logLocalEphemeralKeys)(this.session.hs.e);else{(0,o.logger)("XX Fallback Stage 0 - Responder decoding initial msg from IK.");const e=(0,a.decode0)(this.initialMsg),{valid:t}=this.xx.recvMessage(this.session,{ne:e.ne,ns:n.Buffer.alloc(0),ciphertext:n.Buffer.alloc(0)});if(!t)throw new Error("xx fallback stage 0 decryption validation fail");(0,o.logger)("XX Fallback Stage 0 - Responder used received message from IK."),(0,o.logRemoteEphemeralKey)(this.session.hs.re)}}async exchange(){if(this.isInitiator){const t=(0,a.decode1)(this.initialMsg),{plaintext:r,valid:n}=this.xx.recvMessage(this.session,t);if(!n)throw new Error("xx fallback stage 1 decryption validation fail");(0,o.logger)("XX Fallback Stage 1 - Initiator used received message from IK."),(0,o.logRemoteEphemeralKey)(this.session.hs.re),(0,o.logRemoteStaticKey)(this.session.hs.rs),(0,o.logger)("Initiator going to check remote's signature...");try{const e=await(0,s.decodePayload)(r);this.remotePeer=this.remotePeer||await(0,s.getPeerIdFromPayload)(e),await(0,s.verifySignedPayload)(this.session.hs.rs,e,this.remotePeer),this.setRemoteEarlyData(e.data)}catch(e){throw new Error("Error occurred while verifying signed payload from responder: ".concat(e.message))}(0,o.logger)("All good with the signature!")}else(0,o.logger)("XX Fallback Stage 1 - Responder start"),await super.exchange(),(0,o.logger)("XX Fallback Stage 1 - Responder end")}}t.XXFallbackHandshake=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.encryptStream=function(e){return function(){var t=o((function*(t){var r,o=!0,a=!1;try{for(var c,f,h=u(t);o=(c=yield s(h.next())).done,f=yield s(c.value),!o;o=!0){const t=f,r=n.Buffer.from(t.buffer,t.byteOffset,t.length);for(let n=0;n<r.length;n+=i.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG){let t=n+i.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG;t>r.length&&(t=r.length);const s=e.encrypt(r.slice(n,t),e.session);yield s}}}catch(l){a=!0,r=l}finally{try{o||null==h.return||(yield s(h.return()))}finally{if(a)throw r}}}));return function(e){return t.apply(this,arguments)}}()},t.decryptStream=function(e){return function(){var t=o((function*(t){var r,o=!0,a=!1;try{for(var c,f,h=u(t);o=(c=yield s(h.next())).done,f=yield s(c.value),!o;o=!0){const t=f,r=n.Buffer.from(t.buffer,t.byteOffset,t.length);for(let n=0;n<r.length;n+=i.NOISE_MSG_MAX_LENGTH_BYTES){let t=n+i.NOISE_MSG_MAX_LENGTH_BYTES;t>r.length&&(t=r.length);const o=r.slice(n,t),{plaintext:a,valid:c}=yield s(e.decrypt(o,e.session));if(!c)throw new Error("Failed to validate decrypted chunk");yield a}}}catch(l){a=!0,r=l}finally{try{o||null==h.return||(yield s(h.return()))}finally{if(a)throw r}}}));return function(e){return t.apply(this,arguments)}}()};var n=r(0),i=r(190);function s(e){return new c(e)}function o(e){return function(){return new a(e.apply(this,arguments))}}function a(e){var t,r;function n(t,r){try{var s=e[t](r),o=s.value,a=o instanceof c;Promise.resolve(a?o.wrapped:o).then((function(e){a?n("return"===t?"return":"next",e):i(s.done?"return":"normal",e)}),(function(e){n("throw",e)}))}catch(u){i("throw",u)}}function i(e,i){switch(e){case"return":t.resolve({value:i,done:!0});break;case"throw":t.reject(i);break;default:t.resolve({value:i,done:!1})}(t=t.next)?n(t.key,t.arg):r=null}this._invoke=function(e,i){return new Promise((function(s,o){var a={key:e,arg:i,resolve:s,reject:o,next:null};r?r=r.next=a:(t=r=a,n(e,i))}))},"function"!=typeof e.return&&(this.return=void 0)}function c(e){this.wrapped=e}function u(e){var t;if("undefined"!=typeof Symbol){if(Symbol.asyncIterator&&null!=(t=e[Symbol.asyncIterator]))return t.call(e);if(Symbol.iterator&&null!=(t=e[Symbol.iterator]))return t.call(e)}throw new TypeError("Object is not async iterable")}"function"==typeof Symbol&&Symbol.asyncIterator&&(a.prototype[Symbol.asyncIterator]=function(){return this}),a.prototype.next=function(e){return this._invoke("next",e)},a.prototype.throw=function(e){return this._invoke("throw",e)},a.prototype.return=function(e){return this._invoke("return",e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KeyCache=void 0;const n=new class{constructor(){var e,t,r;e=this,t="storage",r=new Map,t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}store(e,t){this.storage.set(e.id,t)}load(e){return e&&this.storage.get(e.id)||null}resetStorage(){this.storage.clear()}};t.KeyCache=n},function(e,t,r){"use strict";const n=r(2);n("libp2p:secio").error=n("libp2p:secio:error");const i=r(938),s=r(950),o=r(189),{int32BEDecode:a,int32BEEncode:c}=r(25);async function u(e,t,r){if(!e)throw new Error("no local private key provided");if(!t)throw new Error("no connection for the handshake provided");const n=new s(e,r),u=o(t,{lengthDecoder:a,lengthEncoder:c});return await i(n,u),{conn:n.secure,remotePeer:n.id.remote}}e.exports={protocol:"/secio/1.0.0",secureInbound:u,secureOutbound:u}},function(e,t,r){"use strict";const n=r(939),i=r(947),s=r(948);e.exports=async function(e,t){await n(e,t),await i(e,t),await s(e,t),e.cleanSecrets()}},function(e,t,r){"use strict";const n=r(191),i=r(25),{int32BEEncode:s}=i,o=r(2),a=o("libp2p:secio");a.error=o("libp2p:secio:error"),e.exports=async function(e,t){a("1. propose - start");const r=n.createProposal(e);a("1. propose - writing proposal",r),await t.write(i.encode.single(r,{lengthEncoder:s})),a("1. propose - reading proposal");const o=(await t.readLP()).slice();a("1. propose - read proposal",o),await n.identify(e,o),await n.selectProtocols(e),a("1. propose - finish")}},function(e,t,r){"use strict";const n=r(16);e.exports=n("message Propose {\n optional bytes rand = 1;\n optional bytes pubkey = 2;\n optional string exchanges = 3;\n optional string ciphers = 4;\n optional string hashes = 5;\n}\n\nmessage Exchange {\n optional bytes epubkey = 1;\n optional bytes signature = 2;\n}")},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(942),s=r(28),{InvalidCryptoExchangeError:o}=r(192);function a(e,t,r){if("AES-128"===e||"AES-256"===e)return s.aes.create(r,t);throw new o("unrecognized cipher type: ".concat(e))}t.exchanges=["P-256","P-384","P-521"],t.ciphers=["AES-256","AES-128"],t.hashes=["SHA256","SHA512"],t.theBest=(e,t,r)=>{let n,i;if(e<0)n=r,i=t;else{if(!(e>0))return t[0];n=t,i=r}for(const s of n)for(const e of i)if(s===e)return s;throw new o("No algorithms in common!")},t.makeMacAndCipher=async e=>{var t,r;[e.mac,e.cipher]=await Promise.all([(t=e.hashT,r=e.keys.macKey,s.hmac.create(t,r)),a(e.cipherT,e.keys.iv,e.keys.cipherKey)])},t.selectBest=async(e,r)=>{const i=await t.digest(n.concat([r.pubKeyBytes,e.nonce])),s=await t.digest(n.concat([e.pubKeyBytes,r.nonce])),a=n.compare(i,s);if(0===a)throw new o("you are trying to talk to yourself");return{curveT:t.theBest(a,e.exchanges,r.exchanges),cipherT:t.theBest(a,e.ciphers,r.ciphers),hashT:t.theBest(a,e.hashes,r.hashes),order:a}},t.digest=e=>i.digest(e,"sha2-256",e.length)},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(1),s=r(17),o=r(943);async function a(e,t,r){const n=await a.digest(e,t,r);return s.encode(n,t,r)}a.Buffer=n,a.multihash=s,a.digest=async(e,t,r)=>{const n=a.createHash(t),i=await n(e);return r?i.slice(0,r):i},a.createHash=function(e){if(!e)throw i(new Error("hash algorithm must be specified"),"ERR_HASH_ALGORITHM_NOT_SPECIFIED");if(e=s.coerceCode(e),!a.functions[e])throw i(new Error("multihash function '".concat(e,"' not yet supported")),"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return a.functions[e]},a.functions={0:o.identity,17:o.sha1,18:o.sha2256,19:o.sha2512,20:o.sha3512,21:o.sha3384,22:o.sha3256,23:o.sha3224,24:o.shake128,25:o.shake256,26:o.keccak224,27:o.keccak256,28:o.keccak384,29:o.keccak512,34:o.murmur3128,35:o.murmur332,86:o.dblSha2256},o.addBlake(a.functions),a.validate=async(e,t)=>{const r=await a(e,s.decode(t).name);return 0===n.compare(t,r)},e.exports=a},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(34),s=r(35),{factory:o}=r(944),{fromNumberTo32BitBuf:a}=r(945),c=e=>async t=>{switch(e){case"sha3-224":return n.from(i.sha3_224.arrayBuffer(t));case"sha3-256":return n.from(i.sha3_256.arrayBuffer(t));case"sha3-384":return n.from(i.sha3_384.arrayBuffer(t));case"sha3-512":return n.from(i.sha3_512.arrayBuffer(t));case"shake-128":return n.from(i.shake128.create(128).update(t).arrayBuffer());case"shake-256":return n.from(i.shake256.create(256).update(t).arrayBuffer());case"keccak-224":return n.from(i.keccak224.arrayBuffer(t));case"keccak-256":return n.from(i.keccak256.arrayBuffer(t));case"keccak-384":return n.from(i.keccak384.arrayBuffer(t));case"keccak-512":return n.from(i.keccak512.arrayBuffer(t));case"murmur3-128":return n.from(s.x64.hash128(t),"hex");case"murmur3-32":return a(s.x86.hash32(t));default:throw new TypeError("".concat(e," is not a supported algorithm"))}};e.exports={identity:e=>n.from(e),sha1:o("sha1"),sha2256:o("sha2-256"),sha2512:o("sha2-512"),dblSha2256:o("dbl-sha2-256"),sha3224:c("sha3-224"),sha3256:c("sha3-256"),sha3384:c("sha3-384"),sha3512:c("sha3-512"),shake128:c("shake-128"),shake256:c("shake-256"),keccak224:c("keccak-224"),keccak256:c("keccak-256"),keccak384:c("keccak-384"),keccak512:c("keccak-512"),murmur3128:c("murmur3-128"),murmur332:c("murmur3-32"),addBlake:r(946)}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(17),s=self.crypto||self.msCrypto,o=async(e,t)=>{if("undefined"==typeof self||!self.crypto&&!self.msCrypto)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");switch(t){case"sha1":return n.from(await s.subtle.digest({name:"SHA-1"},e));case"sha2-256":return n.from(await s.subtle.digest({name:"SHA-256"},e));case"sha2-512":return n.from(await s.subtle.digest({name:"SHA-512"},e));case"dbl-sha2-256":{const t=await s.subtle.digest({name:"SHA-256"},e);return n.from(await s.subtle.digest({name:"SHA-256"},t))}default:throw new Error("".concat(t," is not a supported algorithm"))}};e.exports={factory:e=>async t=>o(t,e),digest:o,multihashing:async(e,t,r)=>{const n=await o(e,t);return i.encode(n,t,r)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports={fromNumberTo32BitBuf:e=>{const t=new Array(4);for(let r=0;r<4;r++)t[r]=255&e,e>>=8;return n.from(t)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(36),s={init:i.blake2bInit,update:i.blake2bUpdate,digest:i.blake2bFinal},o={init:i.blake2sInit,update:i.blake2sUpdate,digest:i.blake2sFinal},a=(e,t)=>async r=>{const i=t.init(e,null);return t.update(i,r),n.from(t.digest(i))};e.exports=e=>{for(let t=0;t<64;t++)e[45569+t]=a(t+1,s);for(let t=0;t<32;t++)e[45633+t]=a(t+1,o)}},function(e,t,r){"use strict";const n=r(191),i=r(2),s=i("libp2p:secio");s.error=i("libp2p:secio:error"),e.exports=async function(e,t){s("2. exchange - start"),s("2. exchange - writing exchange");const r=await n.createExchange(e);await t.writeLP(r);const i=await t.readLP();s("2. exchange - reading exchange"),await n.verify(e,i.slice()),await n.generateKeys(e),s("2. exchange - finish")}},function(e,t,r){"use strict";const n=r(2),i=n("libp2p:secio");i.error=n("libp2p:secio:error");const s=r(348),o=r(19),a=r(25),c=r(189),{int32BEEncode:u,int32BEDecode:f}=a,h=r(949),l=r(191);e.exports=async function(e,t){i("3. finish - start");const r=e.protocols,[n,d]=s(),p=t.unwrap();o(n,h.createBoxStream(r.local.cipher,r.local.mac),a.encode({lengthEncoder:u}),p,a.decode({lengthDecoder:f,maxDataLength:8388608}),h.createUnboxStream(r.remote.cipher,r.remote.mac),n).catch(e=>{i.error("an error occurred in the crypto stream",e)});const b=c(d);b.write(e.proposal.in.rand);const y=await b.read(e.proposal.in.rand.length);l.verifyNonce(e,y.slice()),i("3. finish - finish"),e.secure=b.unwrap()}},function(e,t,r){"use strict";const n=r(30),{InvalidCryptoTransmissionError:i}=r(192);t.createBoxStream=(e,t)=>async function*(r){for await(const i of r){const r=await e.encrypt(n.isBufferList(i)?i.slice():i),s=await t.digest(r);yield new n([r,s])}},t.createUnboxStream=(e,t)=>async function*(r){for await(const n of r){const r=n.length,s=t.length;if(r<s)throw new i("buffer (".concat(r,") shorter than MAC size (").concat(s,")"));const o=r-s,a=n.slice(0,o),c=n.slice(o),u=await t.digest(a);if(!c.equals(u))throw new i("MAC Invalid: ".concat(c.toString("hex")," != ").concat(u.toString("hex")));const f=await e.decrypt(a);yield f}}},function(e,t,r){"use strict";e.exports=class{constructor(e,t){this.setup(),this.id.local=e,this.id.remote=t,this.key.local=e.privKey}setup(){this.id={local:null,remote:null},this.key={local:null,remote:null},this.shake=null,this.cleanSecrets()}cleanSecrets(){this.shared={},this.ephemeralKey={local:null,remote:null},this.proposal={in:null,out:null},this.proposalEncoded={in:null,out:null},this.protocols={local:null,remote:null},this.exchange={in:null,out:null}}}},function(e,t,r){"use strict";const{EventEmitter:n}=r(13),i=r(1),s=r(68),{MemoryDatastore:o}=r(7),a=r(952),c=r(18),u=r(55),f=r(959),h=r(970),l=r(994),d=r(997),p=r(40),b=r(998),y=r(999),m=r(1001),g=s.Record;e.exports=class extends n{constructor({libp2p:e,dialer:t,peerId:r,peerStore:n,registrar:i,datastore:p=new o,kBucketSize:g=u.K,clientMode:v=!1,concurrency:w=u.ALPHA,validators:_={},selectors:E={},randomWalk:k={}}){if(super(),!t)throw new Error("libp2p-kad-dht requires an instance of Dialer");this.libp2p=e,this.dialer=t,this.peerId=r,this.peerStore=n,this.registrar=i,this.kBucketSize=g,this._clientMode=v,this.concurrency=w,this.disjointPaths=Math.ceil(this.kBucketSize/2),this.routingTable=new a(this.peerId,this.kBucketSize),this.datastore=p,this.providers=new b(this.datastore,this.peerId),this.validators={pk:s.validator.validators.pk,..._},this.selectors={pk:s.selection.selectors.pk,...E},this.network=new f(this),this._log=c.logger(this.peerId),this.randomWalk=new y(this,k),this._queryManager=new m,this._running=!1,this.contentFetching=h(this),this.contentRouting=l(this),this.peerRouting=d(this)}get isStarted(){return this._running}async start(){this._running=!0,this.providers.start(),this._queryManager.start(),await this.network.start(),this.randomWalk.start()}stop(){return this._running=!1,this.randomWalk.stop(),this.providers.stop(),this._queryManager.stop(),this.network.stop()}async put(e,t,r={}){return this.contentFetching.put(e,t,r)}async get(e,t={}){return this.contentFetching.get(e,t)}async getMany(e,t,r={}){return this.contentFetching.getMany(e,t,r)}async provide(e){return this.contentRouting.provide(e)}async*findProviders(e,t={}){for await(const r of this.contentRouting.findProviders(e,t))yield r}async findPeer(e,t={}){return this.peerRouting.findPeer(e,t)}async*getClosestPeers(e,t={shallow:!1}){for await(const r of this.peerRouting.getClosestPeers(e,t))yield r}async getPublicKey(e){return this.peerRouting.getPublicKey(e)}_peerDiscovered(e,t){this.emit("peer",{id:e,multiaddrs:t})}async _nearestPeersToQuery(e){const t=await c.convertBuffer(e.key);return this.routingTable.closestPeers(t,this.kBucketSize).map(e=>{const t=this.peerStore.get(e);return{id:e,multiaddrs:t?t.addresses.map(e=>e.multiaddr):[]}})}async _betterPeersToQuery(e,t){this._log("betterPeersToQuery");return(await this._nearestPeersToQuery(e)).filter(e=>this._isSelf(e.id)?(this._log.error("trying to return self as closer"),!1):!e.id.isEqual(t))}async _checkLocalDatastore(e){this._log("checkLocalDatastore: %b",e);const t=c.bufferToKey(e);let r;try{r=await this.datastore.get(t)}catch(s){if("ERR_NOT_FOUND"===s.code)return;throw s}const n=g.deserialize(r);if(!n)throw i("Invalid record","ERR_INVALID_RECORD");if(!(null==n.timeReceived||c.now()-n.timeReceived>u.MAX_RECORD_AGE))return n;await this.datastore.delete(t)}async _add(e){await this.routingTable.add(e)}async _verifyRecordLocally(e){this._log("verifyRecordLocally"),await s.validator.verifyRecord(this.validators,e)}_isSelf(e){return e&&this.peerId.id.equals(e.id)}async _putValueToPeer(e,t,r){const n=new p(p.TYPES.PUT_VALUE,e,0);n.record=t;if(!(await this.network.sendRequest(r,n)).record.value.equals(g.deserialize(t).value))throw i(new Error("value not put correctly"),"ERR_PUT_VALUE_INVALID")}async _getValueOrPeers(e,t){const r=await this._getValueSingle(e,t),n=r.closerPeers,s=r.record;if(s){try{await this._verifyRecordOnline(s)}catch(o){const e="invalid record received, discarded";throw this._log(e),i(new Error(e),"ERR_INVALID_RECORD")}return{record:s,peers:n}}if(n.length>0)return{peers:n};throw i(new Error("Not found"),"ERR_NOT_FOUND")}async _getValueSingle(e,t){const r=new p(p.TYPES.GET_VALUE,t,0);return this.network.sendRequest(e,r)}async _verifyRecordOnline(e){await s.validator.verifyRecord(this.validators,e)}},e.exports.multicodec=u.PROTOCOL_DHT},function(e,t,r){"use strict";const n=r(953),i=r(18);e.exports=class{constructor(e,t){this.self=e,this._onPing=this._onPing.bind(this),this._onInit(t)}async _onInit(e){const t=await i.convertPeerId(this.self);this.kb=new n({localNodeId:t,numberOfNodesPerKBucket:e,numberOfNodesToPing:1}),this.kb.on("ping",this._onPing)}_onPing(e,t){const r=e[0];this.kb.remove(r.id),this.kb.add(t)}get size(){return this.kb.count()}async find(e){const t=await i.convertPeerId(e),r=this.closestPeer(t);if(r&&r.isEqual(e))return r}closestPeer(e){const t=this.closestPeers(e,1);if(t.length>0)return t[0]}closestPeers(e,t){return this.kb.closest(e,t).map(e=>e.peer)}async add(e){const t=await i.convertPeerId(e);this.kb.add({id:t,peer:e})}async remove(e){const t=await i.convertPeerId(e);this.kb.remove(t)}}},function(e,t,r){"use strict";const n=r(328),{EventEmitter:i}=r(13);function s(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0,n=e.length;r<n;++r)if(e[r]!==t[r])return!1;return!0}function o(e,t){if(!(t instanceof Uint8Array))throw new TypeError(e+" is not a Uint8Array")}class a extends i{constructor(e={}){super(),this.localNodeId=e.localNodeId||n(20),this.numberOfNodesPerKBucket=e.numberOfNodesPerKBucket||20,this.numberOfNodesToPing=e.numberOfNodesToPing||3,this.distance=e.distance||a.distance,this.arbiter=e.arbiter||a.arbiter,this.metadata=Object.assign({},e.metadata),o("option.localNodeId as parameter 1",this.localNodeId),this.root={contacts:[],dontSplit:!1,left:null,right:null}}static arbiter(e,t){return e.vectorClock>t.vectorClock?e:t}static distance(e,t){let r=0,n=0;const i=Math.min(e.length,t.length),s=Math.max(e.length,t.length);for(;n<i;++n)r=256*r+(e[n]^t[n]);for(;n<s;++n)r=256*r+255;return r}add(e){o("contact.id",(e||{}).id);let t=0,r=this.root;for(;null===r.contacts;)r=this._determineNode(r,e.id,t++);const n=this._indexOf(r,e.id);return n>=0?(this._update(r,n,e),this):r.contacts.length<this.numberOfNodesPerKBucket?(r.contacts.push(e),this.emit("added",e),this):r.dontSplit?(this.emit("ping",r.contacts.slice(0,this.numberOfNodesToPing),e),this):(this._split(r,t),this.add(e))}closest(e,t=1/0){if(o("id",e),!Number.isInteger(t)&&t!==1/0||t<=0)throw new TypeError("n is not positive number");let r=[];for(let n=[this.root],i=0;n.length>0&&r.length<t;){const t=n.pop();if(null===t.contacts){const r=this._determineNode(t,e,i++);n.push(t.left===r?t.right:t.left),n.push(r)}else r=r.concat(t.contacts)}return r.map(t=>[this.distance(t.id,e),t]).sort((e,t)=>e[0]-t[0]).slice(0,t).map(e=>e[1])}count(){let e=0;for(const t=[this.root];t.length>0;){const r=t.pop();null===r.contacts?t.push(r.right,r.left):e+=r.contacts.length}return e}_determineNode(e,t,r){const n=r>>3,i=r%8;if(t.length<=n&&0!==i)return e.left;return t[n]&1<<7-i?e.right:e.left}get(e){o("id",e);let t=0,r=this.root;for(;null===r.contacts;)r=this._determineNode(r,e,t++);const n=this._indexOf(r,e);return n>=0?r.contacts[n]:null}_indexOf(e,t){for(let r=0;r<e.contacts.length;++r)if(s(e.contacts[r].id,t))return r;return-1}remove(e){o("the id as parameter 1",e);let t=0,r=this.root;for(;null===r.contacts;)r=this._determineNode(r,e,t++);const n=this._indexOf(r,e);if(n>=0){const e=r.contacts.splice(n,1)[0];this.emit("removed",e)}return this}_split(e,t){e.left={contacts:[],dontSplit:!1,left:null,right:null},e.right={contacts:[],dontSplit:!1,left:null,right:null};for(const n of e.contacts)this._determineNode(e,n.id,t).contacts.push(n);e.contacts=null;const r=this._determineNode(e,this.localNodeId,t);(e.left===r?e.right:e.left).dontSplit=!0}toArray(){let e=[];for(const t=[this.root];t.length>0;){const r=t.pop();null===r.contacts?t.push(r.right,r.left):e=e.concat(r.contacts)}return e}_update(e,t,r){if(!s(e.contacts[t].id,r.id))throw new Error("wrong index for _update");const n=e.contacts[t],i=this.arbiter(n,r);i===n&&n!==r||(e.contacts.splice(t,1),e.contacts.push(i),this.emit("updated",n,i))}}e.exports=a},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(34),s=r(35),{factory:o}=r(955),{fromNumberTo32BitBuf:a}=r(956),c=e=>async t=>{switch(e){case"sha3-224":return n.from(i.sha3_224.arrayBuffer(t));case"sha3-256":return n.from(i.sha3_256.arrayBuffer(t));case"sha3-384":return n.from(i.sha3_384.arrayBuffer(t));case"sha3-512":return n.from(i.sha3_512.arrayBuffer(t));case"shake-128":return n.from(i.shake128.create(128).update(t).arrayBuffer());case"shake-256":return n.from(i.shake256.create(256).update(t).arrayBuffer());case"keccak-224":return n.from(i.keccak224.arrayBuffer(t));case"keccak-256":return n.from(i.keccak256.arrayBuffer(t));case"keccak-384":return n.from(i.keccak384.arrayBuffer(t));case"keccak-512":return n.from(i.keccak512.arrayBuffer(t));case"murmur3-128":return n.from(s.x64.hash128(t),"hex");case"murmur3-32":return a(s.x86.hash32(t));default:throw new TypeError("".concat(e," is not a supported algorithm"))}};e.exports={identity:e=>n.from(e),sha1:o("sha1"),sha2256:o("sha2-256"),sha2512:o("sha2-512"),dblSha2256:o("dbl-sha2-256"),sha3224:c("sha3-224"),sha3256:c("sha3-256"),sha3384:c("sha3-384"),sha3512:c("sha3-512"),shake128:c("shake-128"),shake256:c("shake-256"),keccak224:c("keccak-224"),keccak256:c("keccak-256"),keccak384:c("keccak-384"),keccak512:c("keccak-512"),murmur3128:c("murmur3-128"),murmur332:c("murmur3-32"),addBlake:r(957)}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(17),s=self.crypto||self.msCrypto,o=async(e,t)=>{if("undefined"==typeof self||!self.crypto&&!self.msCrypto)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");switch(t){case"sha1":return n.from(await s.subtle.digest({name:"SHA-1"},e));case"sha2-256":return n.from(await s.subtle.digest({name:"SHA-256"},e));case"sha2-512":return n.from(await s.subtle.digest({name:"SHA-512"},e));case"dbl-sha2-256":{const t=await s.subtle.digest({name:"SHA-256"},e);return n.from(await s.subtle.digest({name:"SHA-256"},t))}default:throw new Error("".concat(t," is not a supported algorithm"))}};e.exports={factory:e=>async t=>o(t,e),digest:o,multihashing:async(e,t,r)=>{const n=await o(e,t);return i.encode(n,t,r)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports={fromNumberTo32BitBuf:e=>{const t=new Array(4);for(let r=0;r<4;r++)t[r]=255&e,e>>=8;return n.from(t)}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(36),s={init:i.blake2bInit,update:i.blake2bUpdate,digest:i.blake2bFinal},o={init:i.blake2sInit,update:i.blake2sUpdate,digest:i.blake2sFinal},a=(e,t)=>async r=>{const i=t.init(e,null);return t.update(i,r),n.from(t.digest(i))};e.exports=e=>{for(let t=0;t<64;t++)e[45569+t]=a(t+1,s);for(let t=0;t<32;t++)e[45633+t]=a(t+1,o)}},function(e,t,r){"use strict";var n=function(e,t){return t||(t={}),e.split("").forEach((function(e,r){e in t||(t[e]=r)})),t},i={alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",charmap:{0:14,1:8}};i.charmap=n(i.alphabet,i.charmap);var s={alphabet:"0123456789ABCDEFGHJKMNPQRSTVWXYZ",charmap:{O:0,I:1,L:1}};s.charmap=n(s.alphabet,s.charmap);var o={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 c(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())}}o.charmap=n(o.alphabet,o.charmap),a.prototype.charmap=i.charmap,a.prototype.write=function(e){var t=this.charmap,r=this.buf,n=this.shift,i=this.carry;return e.toUpperCase().split("").forEach((function(e){if("="!=e){var s=255&t[e];(n-=5)>0?i|=s<<n:n<0?(r.push(i|s>>-n),i=s<<(n+=8)&255):(r.push(i|s),n=8,i=0)}})),this.shift=n,this.carry=i,this},a.prototype.finalize=function(e){return e&&this.write(e),8!==this.shift&&0!==this.carry&&(this.buf.push(this.carry),this.shift=8,this.carry=0),this.buf},c.prototype.alphabet=i.alphabet,c.prototype.write=function(e){var t,r,n,i=this.shift,s=this.carry;for(n=0;n<e.length;n++)t=s|(r=e[n])>>i,this.buf+=this.alphabet[31&t],i>5&&(t=r>>(i-=5),this.buf+=this.alphabet[31&t]),s=r<<(i=5-i),i=8-i;return this.shift=i,this.carry=s,this},c.prototype.finalize=function(e){return e&&this.write(e),3!==this.shift&&(this.buf+=this.alphabet[31&this.carry],this.shift=3,this.carry=0),this.buf},t.encode=function(e,t){return new c(t).finalize(e)},t.decode=function(e,t){return new a(t).finalize(e)},t.Decoder=a,t.Encoder=c,t.charmap=n,t.crockford=s,t.rfc4648=i,t.base32hex=o},function(e,t,r){"use strict";const n=r(1),i=r(19),s=r(25),o=r(112),{consume:a}=r(960),c=r(167),u=r(961),f=r(55),h=r(40),l=r(18);e.exports=class{constructor(e){this.dht=e,this.readMessageTimeout=f.READ_MESSAGE_TIMEOUT,this._log=l.logger(this.dht.peerId,"net"),this._rpc=u(this.dht),this._onPeerConnected=this._onPeerConnected.bind(this),this._running=!1}async start(){if(this._running)return;if(!this.dht.isStarted)throw n(new Error("Can not start network"),"ERR_CANNOT_START_NETWORK");this._running=!0,!1===this.dht._clientMode&&this.dht.registrar.handle(f.PROTOCOL_DHT,this._rpc);const e=new c({multicodecs:[f.PROTOCOL_DHT],handlers:{onConnect:this._onPeerConnected,onDisconnect:()=>{}}});this._registrarId=await this.dht.registrar.register(e)}async stop(){(this.dht.isStarted||this.isStarted)&&(this._running=!1,await this.dht.registrar.unregister(this._registrarId))}get isStarted(){return this._running}get isConnected(){return this.dht.isStarted&&this.isStarted}async _onPeerConnected(e){await this.dht._add(e),this._log("added to the routing table: %s",e.toB58String())}async sendRequest(e,t){if(!this.isConnected)throw n(new Error("Network is offline"),"ERR_NETWORK_OFFLINE");const r=e.toB58String();this._log("sending to: %s",r);let i=this.dht.registrar.connectionManager.get(e);i||(i=await this.dht.dialer.connectToPeer(e));const{stream:s}=await i.newStream(f.PROTOCOL_DHT);return this._writeReadMessage(s,t.serialize())}async sendMessage(e,t){if(!this.isConnected)throw n(new Error("Network is offline"),"ERR_NETWORK_OFFLINE");const r=e.toB58String();this._log("sending to: %s",r);let i=this.dht.registrar.connectionManager.get(e);i||(i=await this.dht.dialer.connectToPeer(e));const{stream:s}=await i.newStream(f.PROTOCOL_DHT);return this._writeMessage(s,t.serialize())}async _writeReadMessage(e,t){return o(async function(e,t){const r=await i([t],s.encode(),e,s.decode(),async e=>{for await(const t of e)return t.slice()});if(0===r.length)throw n(new Error("No message received"),"ERR_NO_MESSAGE_RECEIVED");return h.deserialize(r)}(e,t),this.readMessageTimeout)}_writeMessage(e,t){return i([t],s.encode(),e,a)}}},function(e,t,r){"use strict";(function(e){function r(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function n(e){return this instanceof n?(this.v=e,this):new n(e)}function i(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,s=r.apply(e,t||[]),o=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(e){s[e]&&(i[e]=function(t){return new Promise((function(r,n){o.push([e,t,r,n])>1||c(e,t)}))})}function c(e,t){try{(r=s[e](t)).value instanceof n?Promise.resolve(r.value.v).then(u,f):h(o[0][2],r)}catch(i){h(o[0][3],i)}var r}function u(e){c("next",e)}function f(e){c("throw",e)}function h(e,t){e(t),o.shift(),o.length&&c(o[0][0],o[0][1])}}function s(e){var t,r;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,s){t[i]=e[i]?function(t){return(r=!r)?{value:n(e[i](t)),done:"return"===i}:s?s(t):t}:s}}function o(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=r(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise((function(n,i){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,i,(t=e[r](t)).done,t.value)}))}}}function a(e){if("function"==typeof e.next)return e;if("function"==typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"==typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();throw new TypeError('"values" does not to conform to any of the iterator or iterable protocols')}function c(){let e,t;return{promise:new Promise((r,n)=>{t=r,e=n}),reject:e,resolve:t}}function u(e,t){const r=a(t),n=[],i=[];let s=!1,o=!1;async function u(){if(!o&&!(s||n.length>=e)){s=!0;try{const{done:e,value:t}=await r.next();e?o=!0:n.push({value:t})}catch(t){o=!0,n.push({error:t})}!function(){for(;i.length>0&&n.length>0;){const e=i.shift(),{error:t,value:r}=n.shift();t?e.reject(t):e.resolve({done:!1,value:r})}for(;i.length>0&&o;){const{resolve:e}=i.shift();e({done:!0,value:void 0})}}(),s=!1,u()}}const f={next:async function(){if(n.length>0){const{error:e,value:t}=n.shift();if(e)throw e;return u(),{done:!1,value:t}}if(o)return{done:!0,value:void 0};const e=c();return i.push(e),u(),e.promise},[Symbol.asyncIterator]:()=>f};return f}function f(e,t){return void 0===t?t=>f(e,t):t[Symbol.asyncIterator]?u(e,t):function*(e,t){const r=[];let n;try{for(const n of t)r.push(n),r.length<=e||(yield r.shift())}catch(i){n=i}for(const s of r)yield s;if(n)throw n}(e,t)}function h(e,t){return i(this,arguments,(function*(){var r,i;try{for(var s,a=o(t);!(s=yield n(a.next())).done;){const t=s.value;(yield n(e(t)))&&(yield yield n(t))}}catch(c){r={error:c}}finally{try{s&&!s.done&&(i=a.return)&&(yield n(i.call(a)))}finally{if(r)throw r.error}}}))}function l(e,t){return void 0===t?t=>h(e,t):h(e,t)}function d(e){return i(this,arguments,(function*(){var t,r;try{for(var i,a=o(e);!(i=yield n(a.next())).done;){const e=i.value;e&&"string"!=typeof e&&(e[Symbol.iterator]||e[Symbol.asyncIterator])?yield n(yield*s(o(d(e)))):yield yield n(e)}}catch(c){t={error:c}}finally{try{i&&!i.done&&(r=a.return)&&(yield n(r.call(a)))}finally{if(t)throw t.error}}}))}function p(e,t){return i(this,arguments,(function*(){var r,i;try{for(var s,a=o(t);!(s=yield n(a.next())).done;){const t=s.value;yield yield n(yield n(e(t)))}}catch(c){r={error:c}}finally{try{s&&!s.done&&(i=a.return)&&(yield n(i.call(a)))}finally{if(r)throw r.error}}}))}function b(e,t){return void 0===t?t=>p(e,t):p(e,t)}async function y(e){return new Promise(t=>{e.once("readable",()=>{t()})})}function m(e,...t){let r=e();for(const n of t)r=n(r);return r}function g(e,t,r){return void 0===t?(t,r)=>g(e,t,r):void 0===r?r=>g(e,t,r):function(e,t,r){return i(this,arguments,(function*(){let s=null;const c=a(m(()=>r,f(1),(function(e){return i(this,arguments,(function*(){var t,r;try{for(var i,a=o(e);!(i=yield n(a.next())).done;){const e=i.value;if(s)return yield n(void 0);yield yield n(e)}}catch(c){t={error:c}}finally{try{i&&!i.done&&(r=a.return)&&(yield n(r.call(a)))}finally{if(t)throw t.error}}}))}),b(e=>({value:t(e)})),f(e)));for(;;){const{value:e,done:t}=yield n(c.next());if(t)break;try{const t=yield n(e.value);s||(yield yield n(t))}catch(u){s=u}}if(s)throw s}))}(e,t,r)}function v(e,t){return i(this,arguments,(function*(){var r,i;try{for(var s,a=o(t);!(s=yield n(a.next())).done;){const t=s.value;yield n(e(t)),yield yield n(t)}}catch(c){r={error:c}}finally{try{s&&!s.done&&(i=a.return)&&(yield n(i.call(a)))}finally{if(r)throw r.error}}}))}function w(e,t){let r=e[0]+t[0],n=e[1]+t[1];if(n>=1e9){const e=n%1e9;r+=(n-e)/1e9,n=e}return[r,n]}async function _(e,t){var r,n;let i=null,s=null,a=null;const c=e=>{i=e,s&&s(e)},u=()=>{a&&a()};e.once("error",c);try{for(var f,h=o(t);!(f=await h.next()).done;){const t=f.value;if(!1===e.write(t)&&await new Promise((t,r)=>{if(i)return r(i);e.once("drain",u),a=t,s=r}),i)break}}catch(l){r={error:l}}finally{try{f&&!f.done&&(n=h.return)&&await n.call(h)}finally{if(r)throw r.error}}if(e.removeListener("error",c),e.removeListener("drain",u),i)throw i}Object.defineProperty(t,"__esModule",{value:!0}),t.batch=function e(t,r){if(void 0===r)return r=>e(t,r);if(r[Symbol.asyncIterator])return function(e,t){return i(this,arguments,(function*(){var r,i;let s=[];try{for(var a,c=o(t);!(a=yield n(c.next())).done;){const t=a.value;s.push(t),s.length===e&&(yield yield n(s),s=[])}}catch(u){r={error:u}}finally{try{a&&!a.done&&(i=c.return)&&(yield n(i.call(c)))}finally{if(r)throw r.error}}s.length>0&&(yield yield n(s))}))}(t,r);return function*(e,t){let r=[];for(const n of t)r.push(n),r.length===e&&(yield r,r=[]);r.length>0&&(yield r)}(t,r)},t.buffer=f,t.collect=function(e){if(e[Symbol.asyncIterator])return async function(e){var t,r;const n=[];try{for(var i,s=o(e);!(i=await s.next()).done;){const e=i.value;n.push(e)}}catch(a){t={error:a}}finally{try{i&&!i.done&&(r=s.return)&&await r.call(s)}finally{if(t)throw t.error}}return n}(e);return Array.from(e)},t.concat=function(...e){return e.find(e=>void 0!==e[Symbol.asyncIterator])?function(e){return i(this,arguments,(function*(){var t,r;try{for(var i,a=o(e);!(i=yield n(a.next())).done;){const e=i.value;yield n(yield*s(o(e)))}}catch(c){t={error:c}}finally{try{i&&!i.done&&(r=a.return)&&(yield n(r.call(a)))}finally{if(t)throw t.error}}}))}(e):function*(e){for(const t of e)yield*t}(e)},t.consume=function(e){if(e[Symbol.asyncIterator])return async function(e){var t,r;try{for(var n,i=o(e);!(n=await i.next()).done;){n.value}}catch(s){t={error:s}}finally{try{n&&!n.done&&(r=i.return)&&await r.call(i)}finally{if(t)throw t.error}}}(e)},t.filter=l,t.flatMap=function e(t,r){if(void 0===r)return r=>e(t,r);return l(e=>null!=e,d(b(t,r)))},t.flatten=d,t.flatTransform=function e(t,r,n){if(void 0===r)return(r,n)=>n?e(t,r,n):e(t,r);if(void 0===n)return n=>e(t,r,n);return l(e=>null!=e,d(function(e,t,r){const n=a(r),i=[],s=[];let u=!1,f=!1,h=0,l=null;function d(){for(;s.length>0&&i.length>0;){const{resolve:e}=s.shift();e({done:!1,value:i.shift()})}for(;s.length>0&&0===h&&u;){const{resolve:e,reject:t}=s.shift();l?(t(l),l=null):e({done:!0,value:void 0})}}async function p(){if(u)d();else if(!(f||h+i.length>=e)){f=!0,h++;try{const{done:e,value:r}=await n.next();e?(u=!0,h--,d()):async function(e){var r,n;try{const u=await t(e);if(u&&u[Symbol.asyncIterator])try{for(var s,a=o(u);!(s=await a.next()).done;){const e=s.value;i.push(e)}}catch(c){r={error:c}}finally{try{s&&!s.done&&(n=a.return)&&await n.call(a)}finally{if(r)throw r.error}}else i.push(u)}catch(f){u=!0,l=f}h--,d(),p()}(r)}catch(r){u=!0,h--,l=r,d()}f=!1,p()}}const b={next:async function(){if(0===i.length){const e=c();return s.push(e),p(),e.promise}const e=i.shift();return p(),{done:!1,value:e}},[Symbol.asyncIterator]:()=>b};return b}(t,r,n)))},t.fromStream=function(e){if("function"==typeof e[Symbol.asyncIterator])return e;return function(e){return i(this,arguments,(function*(){for(;;){const t=e.read();if(null===t){if(e._readableState.ended)return yield n(void 0);yield n(y(e))}else yield yield n(t)}}))}(e)},t.getIterator=a,t.map=b,t.merge=function(...e){return i(this,arguments,(function*(){const t=new Set(e.map(a));for(;t.size>0;)for(const e of t){const r=yield n(e.next());r.done?t.delete(e):yield yield n(r.value)}}))},t.parallelFlatMap=function e(t,r,n){if(void 0===r)return(r,n)=>n?e(t,r,n):e(t,r);if(void 0===n)return n=>e(t,r,n);return l(e=>null!=e,d(g(t,r,n)))},t.parallelMap=g,t.parallelMerge=function(...e){return i(this,arguments,(function*(){const t=e.map(a),r=new Set,i=new Map;let s=null,o=null,c=null;const u=e=>{s=e,o&&o(e)},f=e=>{c&&c(e)},h=e=>{const t=Promise.resolve(e.next()).then(async({done:n,value:s})=>{n||i.set(e,s),r.delete(t)});r.add(t),t.then(f,u)};for(const e of t)h(e);for(;;){if(0===r.size&&0===i.size)return yield n(void 0);yield n(new Promise((e,t)=>{if(s&&t(s),i.size>0)return e();c=e,o=t}));for(const[e,t]of i)i.delete(e),yield yield n(t),h(e)}}))},t.pipeline=m,t.reduce=function e(t,r,n){if(void 0===r)return(r,n)=>n?e(t,r,n):e(t,r);if(void 0===n)return n=>e(t,r,n);return async function(e,t,r){var n,i;let s=t;try{for(var a,c=o(r);!(a=await c.next()).done;){const t=a.value;s=await e(s,t)}}catch(u){n={error:u}}finally{try{a&&!a.done&&(i=c.return)&&await i.call(c)}finally{if(n)throw n.error}}return s}(t,r,n)},t.take=function e(t,r){if(void 0===r)return r=>e(t,r);if(r[Symbol.asyncIterator])return function(e,t){return i(this,arguments,(function*(){var r,i;let s=0;try{for(var a,c=o(t);!(a=yield n(c.next())).done;){const t=a.value;if(yield yield n(yield n(t)),s++,s>=e)return yield n(void 0)}}catch(u){r={error:u}}finally{try{a&&!a.done&&(i=c.return)&&(yield n(i.call(c)))}finally{if(r)throw r.error}}}))}(t,r);return function*(e,t){let r=0;for(const n of t)if(yield n,r++,r>=e)return}(t,r)},t.tap=function(e,t){if(void 0===t)return t=>v(e,t);return v(e,t)},t.time=function t(r={},s){if(void 0===s)return e=>t(r,e);return void 0!==s[Symbol.asyncIterator]?function(t,r){return i(this,arguments,(function*(){const i=r[Symbol.asyncIterator]();let s=[0,0];for(;;){const r=e.hrtime(),{value:o,done:a}=yield n(i.next()),c=e.hrtime(r);if(s=w(s,c),t.progress&&t.progress(c,s),a)return t.total&&t.total(s),yield n(o);yield yield n(o)}}))}(r,s):function*(t,r){const n=r[Symbol.iterator]();let i=[0,0];for(;;){const r=e.hrtime(),{value:s,done:o}=n.next(),a=e.hrtime(r);if(i=w(i,a),t.progress&&t.progress(a,i),o)return t.total&&t.total(i),s;yield s}}(r,s)},t.transform=function e(t,r,n){if(void 0===r)return(r,n)=>n?e(t,r,n):e(t,r);if(void 0===n)return n=>e(t,r,n);return function(e,t,r){const n=a(r),i=[],s=[];let o=!1,u=!1,f=0,h=null;function l(){for(;s.length>0&&i.length>0;){const{resolve:e}=s.shift();e({done:!1,value:i.shift()})}for(;s.length>0&&0===f&&o;){const{resolve:e,reject:t}=s.shift();h?(t(h),h=null):e({done:!0,value:void 0})}}async function d(){if(o)l();else if(!(u||f+i.length>=e)){u=!0,f++;try{const{done:e,value:r}=await n.next();e?(o=!0,f--,l()):async function(e){try{const r=await t(e);i.push(r)}catch(r){o=!0,h=r}f--,l(),d()}(r)}catch(r){o=!0,f--,h=r,l()}u=!1,d()}}const p={next:async function(){if(0===i.length){const e=c();return s.push(e),d(),e.promise}const e=i.shift();return d(),{done:!1,value:e}},[Symbol.asyncIterator]:()=>p};return p}(t,r,n)},t.writeToStream=function(e,t){if(void 0===t)return t=>_(e,t);return _(e,t)},void 0===Symbol.asyncIterator&&(Symbol.asyncIterator=Symbol.for("asyncIterator"))}).call(this,r(8))},function(e,t,r){"use strict";const n=r(19),i=r(25),s=r(40),o=r(963),a=r(18);e.exports=e=>{const t=a.logger(e.peerId,"rpc"),r=o(e);async function c(n,i){const s=r(i.type);try{await e._add(n)}catch(o){t.error("Failed to update the kbucket store",o)}if(s)return s(n,i);t.error("no handler found for message type: ".concat(i.type))}return async function({stream:r,connection:o}){const a=o.remotePeer;try{await e._add(a)}catch(f){t.error(f)}const u=a.toB58String();t("from: %s",u),await n(r.source,i.decode(),e=>async function*(){for await(const t of e){const e=s.deserialize(t.slice()),r=await c(a,e);r&&(yield r.serialize())}}(),i.encode(),r.sink)}}},function(e,t,r){"use strict";e.exports='// can\'t use, because protocol-buffers doesn\'t support imports\n// so we have to duplicate for now :(\n// import "record.proto";\n\nmessage Record {\n // adjusted for javascript\n optional bytes key = 1;\n optional bytes value = 2;\n optional bytes author = 3;\n optional bytes signature = 4;\n optional string timeReceived = 5;\n}\n\nmessage Message {\n enum MessageType {\n PUT_VALUE = 0;\n GET_VALUE = 1;\n ADD_PROVIDER = 2;\n GET_PROVIDERS = 3;\n FIND_NODE = 4;\n PING = 5;\n }\n\n enum ConnectionType {\n // sender does not have a connection to peer, and no extra information (default)\n NOT_CONNECTED = 0;\n\n // sender has a live connection to peer\n CONNECTED = 1;\n\n // sender recently connected to peer\n CAN_CONNECT = 2;\n\n // sender recently tried to connect to peer repeatedly but failed to connect\n // ("try" here is loose, but this should signal "made strong effort, failed")\n CANNOT_CONNECT = 3;\n }\n\n message Peer {\n // ID of a given peer.\n optional bytes id = 1;\n\n // multiaddrs for a given peer\n repeated bytes addrs = 2;\n\n // used to signal the sender\'s connection capabilities to the peer\n optional ConnectionType connection = 3;\n }\n\n // defines what type of message it is.\n optional MessageType type = 1;\n\n // defines what coral cluster level this query/response belongs to.\n // in case we want to implement coral\'s cluster rings in the future.\n optional int32 clusterLevelRaw = 10;\n\n // Used to specify the key associated with this message.\n // PUT_VALUE, GET_VALUE, ADD_PROVIDER, GET_PROVIDERS\n // adjusted for javascript\n optional bytes key = 2;\n\n // Used to return a value\n // PUT_VALUE, GET_VALUE\n // adjusted Record to bytes for js\n optional bytes record = 3;\n\n // Used to return peers closer to a key in a query\n // GET_VALUE, GET_PROVIDERS, FIND_NODE\n repeated Peer closerPeers = 8;\n\n // Used to return Providers\n // GET_VALUE, ADD_PROVIDER, GET_PROVIDERS\n repeated Peer providerPeers = 9;\n}'},function(e,t,r){"use strict";const n=r(40).TYPES;e.exports=e=>{const t={[n.GET_VALUE]:r(964)(e),[n.PUT_VALUE]:r(965)(e),[n.FIND_NODE]:r(966)(e),[n.ADD_PROVIDER]:r(967)(e),[n.GET_PROVIDERS]:r(968)(e),[n.PING]:r(969)(e)};return function(e){return t[e]}}},function(e,t,r){"use strict";const{Record:n}=r(68),i=r(1),s=r(40),o=r(18);e.exports=e=>{const t=o.logger(e.peerId,"rpc:get-value");return async function(r,a){const c=a.key;if(t("key: %b",c),!c||0===c.length)throw i(new Error("Invalid key"),"ERR_INVALID_KEY");const u=new s(s.TYPES.GET_VALUE,c,a.clusterLevel);if(o.isPublicKeyKey(c)){t("is public key");const r=o.fromPublicKeyKey(c);let i;if(e._isSelf(r))i=e.peerId;else{const t=e.peerStore.get(r);i=t&&t.id}if(i&&i.pubKey)return t("returning found public key"),u.record=new n(c,i.pubKey.bytes),u}const[f,h]=await Promise.all([e._checkLocalDatastore(c),e._betterPeersToQuery(a,r)]);return f&&(t("got record"),u.record=f),h.length>0&&(t("got closer %s",h.length),u.closerPeers=h),u}}},function(e,t,r){"use strict";const n=r(18),i=r(1);e.exports=e=>{const t=n.logger(e.peerId,"rpc:put-value");return async function(r,s){const o=s.key;t("key: %b",o);const a=s.record;if(!a){const e="Empty record from: ".concat(r.toB58String());throw t.error(e),i(new Error(e),"ERR_EMPTY_RECORD")}await e._verifyRecordLocally(a),a.timeReceived=new Date;const c=n.bufferToKey(a.key);return await e.datastore.put(c,a.serialize()),s}}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(40),s=r(18);e.exports=e=>{const t=s.logger(e.peerId,"rpc:find-node");return async function(r,s){let o;t("start"),o=s.key.equals(e.peerId.id)?[{id:e.peerId}]:await e._betterPeersToQuery(s,r);const a=new i(s.type,n.alloc(0),s.clusterLevel);return o.length>0?a.closerPeers=o:t("handle FindNode %s: could not find anything",r.toB58String()),a}}},function(e,t,r){"use strict";const n=r(4),i=r(1),s=r(18);e.exports=e=>{const t=s.logger(e.peerId,"rpc:add-provider");return async function(r,s){if(t("start"),!s.key||0===s.key.length)throw i(new Error("Missing key"),"ERR_MISSING_KEY");let o;try{o=new n(s.key)}catch(a){const e="Invalid CID: ".concat(a.message);throw i(new Error(e),"ERR_INVALID_CID")}return s.providerPeers.forEach(n=>{if(n.id.isEqual(r)){if(!(n.multiaddrs.length<1))return t("received provider %s for %s (addrs %s)",r.toB58String(),o.toBaseEncodedString(),n.multiaddrs.map(e=>e.toString())),e._isSelf(n.id)?void 0:(e.peerStore.addressBook.add(n.id,n.multiaddrs),e.providers.addProvider(o,n.id));t("no valid addresses for provider %s. Ignore",r.toB58String())}else t("invalid provider peer %s from %s",n.id.toB58String(),r.toB58String())}),e.providers.addProvider(o,r)}}},function(e,t,r){"use strict";const n=r(4),i=r(1),s=r(40),o=r(18);e.exports=e=>{const t=o.logger(e.peerId,"rpc:get-providers");return async function(r,a){let c;try{c=new n(a.key)}catch(y){throw i(new Error("Invalid CID: ".concat(y.message)),"ERR_INVALID_CID")}t("%s",c.toBaseEncodedString());const u=o.bufferToKey(c.buffer),[f,h,l]=await Promise.all([e.datastore.has(u),e.providers.getProviders(c),e._betterPeersToQuery(a,r)]),d=h.map(e=>({id:e})),p=l.map(e=>({id:e.id}));f&&d.push({id:e.peerId});const b=new s(a.type,a.key,a.clusterLevel);return d.length>0&&(b.providerPeers=d),p.length>0&&(b.closerPeers=p),t("got %s providers %s closerPeers",d.length,p.length),b}}},function(e,t,r){"use strict";const n=r(18);e.exports=e=>{const t=n.logger(e.peerId,"rpc:ping");return function(e,r){return t("from %s",e.toB58String()),r}}},function(e,t,r){"use strict";const n=r(1),i=r(112),s=r(68),o=r(55),a=r(195),c=r(18),u=s.Record;e.exports=e=>{const t=async(t,r)=>e.datastore.put(c.bufferToKey(t),r);return{_putLocal:async(e,r)=>t(e,r),async put(r,i,s={}){e._log("PutValue %b",r);const o=await c.createPutRecord(r,i);await t(r,o);let a=0,u=0;await c.mapParallel(e.getClosestPeers(r,{shallow:!0}),async t=>{try{a+=1,await e._putValueToPeer(r,o,t),u+=1}catch(n){e._log.error("Failed to put to peer (%b): %s",t.id,n)}});const f=s.minPeers||a;if(f>u){const t=n(new Error("Failed to put value to enough peers: ".concat(u,"/").concat(f)),"ERR_NOT_ENOUGH_PUT_PEERS");throw e._log.error(t),t}},async get(t,r={}){r.timeout=r.timeout||o.minute,e._log("_get %b",t);const i=await e.getMany(t,o.GET_MANY_RECORD_COUNT,r),a=i.map(e=>e.val);let u=0;try{u=s.selection.bestRecord(e.selectors,t,a)}catch(h){if("ERR_NO_SELECTOR_FUNCTION_FOR_RECORD_KEY"!==h.code)throw h}const f=a[u];if(e._log("GetValue %b %s",t,f),!f)throw n(new Error("best value was not found"),"ERR_NOT_FOUND");return await(async(t,r,n)=>{const i=await c.createPutRecord(t,n);return Promise.all(r.map(async r=>{if(!r.val.equals(n))if(e._isSelf(r.from))try{await e._putLocal(t,i)}catch(h){e._log.error("Failed error correcting self",h)}else try{await e._putValueToPeer(t,i,r.from)}catch(h){e._log.error("Failed error correcting entry",h)}}))})(t,i,f),f},async getMany(t,r,s={}){s.timeout=s.timeout||o.minute,e._log("getMany %b (%s)",t,r);let f,h=[];try{f=await(async t=>{e._log("getLocal %b",t);const r=await e.datastore.get(c.bufferToKey(t));e._log("found %b in local datastore",t);const n=u.deserialize(r);return await e._verifyRecordLocally(n),n})(t)}catch(m){if(0===r)throw m}if(f&&h.push({val:f.value,from:e.peerId}),h.length>=r)return h;const l=[],d=await c.convertBuffer(t),p=e.routingTable.closestPeers(d,this.kBucketSize);if(e._log("peers in rt: %d",p.length),0===p.length){const t="Failed to lookup key! No peers from routing table!";if(e._log.error(t),0===h.length)throw n(new Error(t),"ERR_NO_PEERS_IN_ROUTING_TABLE");return h}const b=new a(e,t,(n,i)=>{const s=c.pathSize(r-h.length,i),o=[];return l.push(o),async r=>{let n,i,a;try{const s=await e._getValueOrPeers(r,t);n=s.record,i=s.peers}catch(m){if("ERR_INVALID_RECORD"!==m.code)throw m;a=m}const c={closerPeers:i};return(n&&n.value||a)&&o.push({val:n&&n.value,from:r}),o.length>=s&&(c.pathComplete=!0),c}});let y;try{await i(b.run(p),s.timeout)}catch(m){y=m}if(b.stop(),h=[].concat.apply(h,l).slice(0,r),y&&0===h.length)throw y;return h}}}},function(e,t,r){"use strict";const n=r(972),i=r(13),s=r(973),o=r(977),a=r(18);e.exports=class extends i{constructor(e){super(),this.query=e,this.running=!1,this.workers=[],this.peersSeen=new Set,this.errors=[],this.peersQueried=null}stop(){if(this.running){this.running=!1;for(const e of this.workers)e.stop()}}async execute(e){const t=[],r=Math.min(this.query.dht.disjointPaths,e.length);for(let i=0;i<r;i++)t.push(new s(this,this.query.makePath(i,r)));e.forEach((e,n)=>{t[n%r].addInitialPeer(e)}),await this.executePaths(t);const n={finalSet:new Set(this.peersQueried.peers),paths:[]};for(const i of t)i.res&&(i.res.pathComplete||i.res.queryComplete)&&(i.res.success=!0,n.paths.push(i.res));return n}async executePaths(e){this.running=!0,this.emit("start");try{await Promise.all(e.map(e=>e.execute()))}finally{this.stop(),this.emit("complete")}if(this.errors.length===this.peersSeen.size)throw this.errors[0]}async workerQueue(e){await this.init(),await this.startWorker(e)}async startWorker(e){const t=new o(this.query.dht,this,e,this.query._log);this.workers.push(t),await t.execute()}async init(){this.peersQueried||(this.peersQueriedPromise?await this.peersQueriedPromise:(this.peersQueriedPromise=(async()=>{const e=await a.convertBuffer(this.query.key);this.peersQueried=new n(e,this.query.dht.kBucketSize)})(),await this.peersQueriedPromise,delete this.peersQueriedPromise))}async continueQuerying(e){if(this.peersQueried.length<this.peersQueried.capacity)return!0;const t=e.queue.workersList().map(e=>e.data);return!!await this.peersQueried.anyCloser(t)}}},function(e,t,r){"use strict";const n=r(194),i=r(18),s=r(106);e.exports=class{constructor(e,t){this.originDhtKey=e,this.capacity=t,this.peerDistances=[]}get length(){return this.peerDistances.length}get peers(){return this.peerDistances.map(e=>e.peerId)}async add(e){if(this.peerDistances.find(t=>t.peerId.id.equals(e.id)))return;const t=await i.convertPeerId(e),r={peerId:e,distance:n(this.originDhtKey,t)};this.peerDistances.push(r),this.peerDistances.sort((e,t)=>n.compare(e.distance,t.distance)),this.peerDistances=this.peerDistances.slice(0,this.capacity)}async anyCloser(e){if(!e.length)return!1;if(!this.length)return!0;const t=await s(e,e=>i.convertPeerId(e)),r=this.peerDistances[this.peerDistances.length-1].distance;for(const i of t){const e=n(this.originDhtKey,i);if(n.compare(e,r)<0)return!0}return!1}}},function(e,t,r){"use strict";const n=r(974),i=r(18);e.exports=class{constructor(e,t){if(this.run=e,this.queryFunc=i.withTimeout(t,3e4),!this.queryFunc)throw new Error("Path requires a `queryFn` to be specified");if("function"!=typeof this.queryFunc)throw new Error("Path expected `queryFn` to be a function. Got "+typeof this.queryFunc);this.initialPeers=[],this.peersToQuery=null}addInitialPeer(e){this.initialPeers.push(e)}async execute(){const e=await n.fromKey(this.run.query.key);this.peersToQuery=e,await Promise.all(this.initialPeers.map(e=>this.addPeerToQuery(e))),await this.run.workerQueue(this)}async addPeerToQuery(e){this.run.query.dht._isSelf(e)||this.run.peersSeen.has(e.toB58String())||await this.peersToQuery.enqueue(e)}}},function(e,t,r){"use strict";const n=r(975),i=r(194),s=r(2),o=r(18),a=s("libp2p:dht:peer-queue");class c{static async fromPeerId(e){const t=await o.convertPeerId(e);return new c(t)}static async fromKey(e){const t=await o.convertBuffer(e);return new c(t)}constructor(e){a("create: %b",e),this.from=e,this.heap=new n(o.xorCompare)}async enqueue(e){a("enqueue %s",e.toB58String());const t=await o.convertPeerId(e),r={id:e,distance:i(this.from,t)};this.heap.push(r)}dequeue(){const e=this.heap.pop();return a("dequeue %s",e.id.toB58String()),e.id}get length(){return this.heap.size()}}e.exports=c},function(e,t,r){"use strict";e.exports=r(976)},function(e,t,r){"use strict";var n,i,s;(function(){var r,o,a,c,u,f,h,l,d,p,b,y,m,g,v;a=Math.floor,p=Math.min,o=function(e,t){return e<t?-1:e>t?1:0},d=function(e,t,r,n,i){var s;if(null==r&&(r=0),null==i&&(i=o),r<0)throw new Error("lo must be non-negative");for(null==n&&(n=e.length);r<n;)i(t,e[s=a((r+n)/2)])<0?n=s:r=s+1;return[].splice.apply(e,[r,r-r].concat(t)),t},f=function(e,t,r){return null==r&&(r=o),e.push(t),g(e,0,e.length-1,r)},u=function(e,t){var r,n;return null==t&&(t=o),r=e.pop(),e.length?(n=e[0],e[0]=r,v(e,0,t)):n=r,n},l=function(e,t,r){var n;return null==r&&(r=o),n=e[0],e[0]=t,v(e,0,r),n},h=function(e,t,r){var n;return null==r&&(r=o),e.length&&r(e[0],t)<0&&(t=(n=[e[0],t])[0],e[0]=n[1],v(e,0,r)),t},c=function(e,t){var r,n,i,s,c,u;for(null==t&&(t=o),c=[],n=0,i=(s=function(){u=[];for(var t=0,r=a(e.length/2);0<=r?t<r:t>r;0<=r?t++:t--)u.push(t);return u}.apply(this).reverse()).length;n<i;n++)r=s[n],c.push(v(e,r,t));return c},m=function(e,t,r){var n;if(null==r&&(r=o),-1!==(n=e.indexOf(t)))return g(e,0,n,r),v(e,n,r)},b=function(e,t,r){var n,i,s,a,u;if(null==r&&(r=o),!(i=e.slice(0,t)).length)return i;for(c(i,r),s=0,a=(u=e.slice(t)).length;s<a;s++)n=u[s],h(i,n,r);return i.sort(r).reverse()},y=function(e,t,r){var n,i,s,a,f,h,l,b,y;if(null==r&&(r=o),10*t<=e.length){if(!(s=e.slice(0,t).sort(r)).length)return s;for(i=s[s.length-1],a=0,h=(l=e.slice(t)).length;a<h;a++)r(n=l[a],i)<0&&(d(s,n,0,null,r),s.pop(),i=s[s.length-1]);return s}for(c(e,r),y=[],f=0,b=p(t,e.length);0<=b?f<b:f>b;0<=b?++f:--f)y.push(u(e,r));return y},g=function(e,t,r,n){var i,s,a;for(null==n&&(n=o),i=e[r];r>t&&n(i,s=e[a=r-1>>1])<0;)e[r]=s,r=a;return e[r]=i},v=function(e,t,r){var n,i,s,a,c;for(null==r&&(r=o),i=e.length,c=t,s=e[t],n=2*t+1;n<i;)(a=n+1)<i&&!(r(e[n],e[a])<0)&&(n=a),e[t]=e[n],n=2*(t=n)+1;return e[t]=s,g(e,c,t,r)},r=function(){function e(e){this.cmp=null!=e?e:o,this.nodes=[]}return e.push=f,e.pop=u,e.replace=l,e.pushpop=h,e.heapify=c,e.updateItem=m,e.nlargest=b,e.nsmallest=y,e.prototype.push=function(e){return f(this.nodes,e,this.cmp)},e.prototype.pop=function(){return u(this.nodes,this.cmp)},e.prototype.peek=function(){return this.nodes[0]},e.prototype.contains=function(e){return-1!==this.nodes.indexOf(e)},e.prototype.replace=function(e){return l(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return h(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return c(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return m(this.nodes,e,this.cmp)},e.prototype.clear=function(){return this.nodes=[]},e.prototype.empty=function(){return 0===this.nodes.length},e.prototype.size=function(){return this.nodes.length},e.prototype.clone=function(){var t;return(t=new e).nodes=this.nodes.slice(0),t},e.prototype.toArray=function(){return this.nodes.slice(0)},e.prototype.insert=e.prototype.push,e.prototype.top=e.prototype.peek,e.prototype.front=e.prototype.peek,e.prototype.has=e.prototype.contains,e.prototype.copy=e.prototype.clone,e}(),i=[],void 0===(s="function"==typeof(n=function(){return r})?n.apply(t,i):n)||(e.exports=s)}).call(void 0)},function(e,t,r){"use strict";const n=r(978),i=r(991);e.exports=class{constructor(e,t,r,n){this.dht=e,this.run=t,this.path=r,this.log=n,this.concurrency=this.dht.concurrency,this.queue=this.setupQueue(),this.execution=null}setupQueue(){const e=n((e,t)=>{i(this.processNext(e))(t)},this.concurrency);return e.error=e=>{this.log.error("queue",e),this.stop(e)},e.drain=()=>{this.log("queue:drain"),this.stop()},e.unsaturated=()=>{this.running&&this.fill()},e.buffer=0,e}stop(e){this.running&&(this.running=!1,this.queue.kill(),this.log("worker:stop, %d workers still running",this.run.workers.filter(e=>e.running).length),e?this.execution.reject(e):this.execution.resolve())}async execute(){this.running=!0,this.execution={};const e=new Promise((e,t)=>Object.assign(this.execution,{resolve:e,reject:t}));this.fill(),await e}fill(){for(;this.queue.running()+this.queue.length()<this.concurrency&&this.path.peersToQuery.length>0;)this.queue.push(this.path.peersToQuery.dequeue())}async processNext(e){if(!this.running)return;if(this.run.peersSeen.has(e.toB58String()))return;let t,r,n,i;try{t=await this.run.continueQuerying(this)}catch(s){r=s}if(this.running){if(r)throw r;if(t){if(!this.run.peersSeen.has(e.toB58String())){this.run.peersSeen.add(e.toB58String()),this.log("queue:work");try{n=await this.execQuery(e)}catch(s){i=s}if(this.running){if(this.log("queue:work:done",i,n),i)throw i;if(n&&n.queryComplete)return this.log("query:complete"),void this.run.stop();n&&n.pathComplete&&this.stop()}}}else this.stop()}}async execQuery(e){let t,r;try{t=await this.path.queryFunc(e)}catch(n){r=n}if(this.running)if(r)this.run.errors.push(r);else{if(await this.run.peersQueried.add(e),t.pathComplete||t.queryComplete)return this.path.res=t,{pathComplete:t.pathComplete,queryComplete:t.queryComplete};t.closerPeers&&t.closerPeers.length>0&&await Promise.all(t.closerPeers.map(async e=>{this.dht._isSelf(e.id)||(this.dht._peerDiscovered(e.id,e.multiaddrs),await this.path.addPeerToQuery(e.id))}))}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var r=(0,i.default)(e);return(0,n.default)((function(e,t){r(e[0],t)}),t,1)};var n=s(r(979)),i=s(r(356));function s(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var f=(0,u.default)(e),h=0,l=[],d=!1;function p(e,t,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(m.started=!0,(0,i.default)(e)||(e=[e]),0===e.length&&m.idle())return(0,a.default)((function(){m.drain()}));for(var n=0,o=e.length;n<o;n++){var c={data:e[n],callback:r||s.default};t?m._tasks.unshift(c):m._tasks.push(c)}d||(d=!0,(0,a.default)((function(){d=!1,m.process()})))}function b(e){return function(t){h-=1;for(var r=0,i=e.length;r<i;r++){var s=e[r],o=(0,n.default)(l,s,0);0===o?l.shift():o>0&&l.splice(o,1),s.callback.apply(s,arguments),null!=t&&m.error(t,s.data)}h<=m.concurrency-m.buffer&&m.unsaturated(),m.idle()&&m.drain(),m.process()}}var y=!1,m={_tasks:new c.default,concurrency:t,payload:r,saturated:s.default,unsaturated:s.default,buffer:t/4,empty:s.default,drain:s.default,error:s.default,started:!1,paused:!1,push:function(e,t){p(e,!1,t)},kill:function(){m.drain=s.default,m._tasks.empty()},unshift:function(e,t){p(e,!0,t)},remove:function(e){m._tasks.remove(e)},process:function(){if(!y){for(y=!0;!m.paused&&h<m.concurrency&&m._tasks.length;){var e=[],t=[],r=m._tasks.length;m.payload&&(r=Math.min(r,m.payload));for(var n=0;n<r;n++){var i=m._tasks.shift();e.push(i),l.push(i),t.push(i.data)}h+=1,0===m._tasks.length&&m.empty(),h===m.concurrency&&m.saturated();var s=(0,o.default)(b(e));f(t,s)}y=!1}},length:function(){return m._tasks.length},running:function(){return h},workersList:function(){return l},idle:function(){return m._tasks.length+h===0},pause:function(){m.paused=!0},resume:function(){!1!==m.paused&&(m.paused=!1,(0,a.default)(m.process))}};return m};var n=f(r(980)),i=f(r(984)),s=f(r(985)),o=f(r(986)),a=f(r(354)),c=f(r(987)),u=f(r(356));function f(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){"use strict";var n=r(981),i=r(982),s=r(983);e.exports=function(e,t,r){return t==t?s(e,t,r):n(e,i,r)}},function(e,t,r){"use strict";e.exports=function(e,t,r,n){for(var i=e.length,s=r+(n?1:-1);n?s--:++s<i;)if(t(e[s],s,e))return s;return-1}},function(e,t,r){"use strict";e.exports=function(e){return e!=e}},function(e,t,r){"use strict";e.exports=function(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}},function(e,t,r){"use strict";var n=Array.isArray;e.exports=n},function(e,t,r){"use strict";e.exports=function(){}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(){if(null===e)throw new Error("Callback was already called.");var t=e;e=null,t.apply(this,arguments)}},e.exports=t.default},function(e,t,r){"use strict";function n(){this.head=this.tail=null,this.length=0}function i(e,t){e.length=1,e.head=e.tail=t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,n.prototype.removeLink=function(e){return e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=e.next=null,this.length-=1,e},n.prototype.empty=function(){for(;this.head;)this.shift();return this},n.prototype.insertAfter=function(e,t){t.prev=e,t.next=e.next,e.next?e.next.prev=t:this.tail=t,e.next=t,this.length+=1},n.prototype.insertBefore=function(e,t){t.prev=e.prev,t.next=e,e.prev?e.prev.next=t:this.head=t,e.prev=t,this.length+=1},n.prototype.unshift=function(e){this.head?this.insertBefore(this.head,e):i(this,e)},n.prototype.push=function(e){this.tail?this.insertAfter(this.tail,e):i(this,e)},n.prototype.shift=function(){return this.head&&this.removeLink(this.head)},n.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},n.prototype.toArray=function(){for(var e=Array(this.length),t=this.head,r=0;r<this.length;r++)e[r]=t.data,t=t.next;return e},n.prototype.remove=function(e){for(var t=this.head;t;){var r=t.next;e(t)&&this.removeLink(t),t=r}return this},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)((function(t,r){var i;try{i=e.apply(this,t)}catch(s){return r(s)}(0,n.default)(i)&&"function"==typeof i.then?i.then((function(e){a(r,null,e)}),(function(e){a(r,e.message?e:new Error(e))})):r(null,i)}))};var n=o(r(989)),i=o(r(990)),s=o(r(354));function o(e){return e&&e.__esModule?e:{default:e}}function a(e,t,r){try{e(t,r)}catch(n){(0,s.default)(c,n)}}function c(e){throw e}e.exports=t.default},function(e,t,r){"use strict";e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(){var t=(0,s.default)(arguments),r=t.pop();e.call(this,t,r)}};var n,i=r(355),s=(n=i)&&n.__esModule?n:{default:n};e.exports=t.default},function(e,t,r){"use strict";var n=r(992),i=r(993);e.exports=function(e){if(!n(e.then))throw new TypeError("Expected a promise");return function(t){e.then((function(e){i(t,null,e)}),(function(e){i(t,e)}))}}},function(e,t,r){"use strict";var n=Object.prototype.toString;e.exports=function(e){return"[object Function]"===n.call(e)}},function(e,t,r){"use strict";(function(t){e.exports="function"==typeof t?t:function(){var e=[].slice.apply(arguments);e.splice(1,0,0),setTimeout.apply(null,e)}}).call(this,r(89).setImmediate)},function(e,t,r){"use strict";const n=r(1),i=r(112),s=r(55),o=r(995),a=r(40),c=r(195),u=r(18);e.exports=e=>({async provide(t){e._log("provide: %s",t.toBaseEncodedString());const r=[];await e.providers.addProvider(t,e.peerId);const i=e.libp2p?e.libp2p.multiaddrs:[],s=new a(a.TYPES.ADD_PROVIDER,t.buffer,0);if(s.providerPeers=[{id:e.peerId,multiaddrs:i}],await u.mapParallel(e.getClosestPeers(t.buffer),async n=>{e._log("putProvider %s to %s",t.toBaseEncodedString(),n.toB58String());try{await e.network.sendMessage(n,s)}catch(i){r.push(i)}}),r.length)throw n(new Error("Failed to provide to ".concat(r.length," of ").concat(e.kBucketSize," peers"),"ERR_SOME_PROVIDES_FAILED"),{errors:r})},async*findProviders(t,r={}){const f=r.timeout||s.minute,h=r.maxNumProviders||s.K;e._log("findProviders %s",t.toBaseEncodedString());const l=new o(h);if((await e.providers.getProviders(t)).forEach(t=>{const r=e.peerStore.get(t)||{};l.push({id:r.id||t,multiaddrs:(r.addresses||[]).map(e=>e.multiaddr)})}),l.length>=h){for(const e of l.toArray())yield e;return}const d=[],p=new c(e,t.buffer,(r,n)=>{const i=u.pathSize(h-l.length,n),s=new o(i);return d.push(s),async r=>{const n=await(async(t,r)=>{const n=new a(a.TYPES.GET_PROVIDERS,r.buffer,0);return e.network.sendRequest(t,n)})(r,t),o=n.providerPeers;return e._log("(%s) found %s provider entries",e.peerId.toB58String(),o.length),o.forEach(e=>{s.push({id:e.id})}),s.length>=i?{pathComplete:!0}:{closerPeers:n.closerPeers}}}),b=e.routingTable.closestPeers(t.buffer,e.kBucketSize);try{await i(p.run(b),f)}catch(y){if(y.name!==i.TimeoutError.name)throw y}finally{p.stop()}if(d.forEach(e=>{e.toArray().forEach(e=>{l.push(e)})}),0===l.length)throw n(new Error("no providers found"),"ERR_NOT_FOUND");for(const e of l.toArray())yield e}})},function(e,t,r){"use strict";const n=r(996);e.exports=class extends n{constructor(e){super(),this.limit=e}push(e){return this.length<this.limit&&super.push(e)}}},function(e,t,r){"use strict";e.exports=class{constructor(){this.list=[]}push(e){return!this.has(e.id)&&(this.list.push(e),!0)}has(e){const t=this.list.find(t=>t.id.isEqual(e));return Boolean(t)}toArray(){return this.list.slice()}pop(){return this.list.pop()}get length(){return this.list.length}}},function(e,t,r){"use strict";const n=r(1),i=r(112),s=r(6),o=r(28),a=r(55),c=r(40),u=r(195),f=r(18);e.exports=e=>{const t=async t=>{const r=f.keyForPublicKey(t),i=await(async(t,r)=>{const n=new c(c.TYPES.GET_VALUE,r,0);return e.network.sendRequest(t,n)})(t,r);if(!i.record||!i.record.value)throw n("Node not responding with its public key: ".concat(t.toB58String()),"ERR_INVALID_RECORD");const o=s.createFromPubKey(i.record.value);if(!o.isEqual(t))throw n("public key does not match id","ERR_PUBLIC_KEY_DOES_NOT_MATCH_ID");return o.pubKey};return{async _findPeerSingle(t,r){e._log("findPeerSingle %s",t.toB58String());const n=new c(c.TYPES.FIND_NODE,r.id,0);return e.network.sendRequest(t,n)},async findPeer(t,r={}){r.timeout=r.timeout||a.minute,e._log("findPeer %s",t.toB58String());const s=await(async t=>{e._log("findPeerLocal %s",t.toB58String());const r=await e.routingTable.find(t),n=r&&e.peerStore.get(r);if(n)return{id:n.id,multiaddrs:n.addresses.map(e=>e.multiaddr)}})(t);if(null!=s)return e._log("found local"),s;const o=await f.convertPeerId(t),c=e.routingTable.closestPeers(o,e.kBucketSize);if(0===c.length)throw n(new Error("Peer lookup failed"),"ERR_LOOKUP_FAILED");if(c.find(e=>e.isEqual(t))){const r=e.peerStore.get(t);if(r)return e._log("found in peerStore"),{id:r.id,multiaddrs:r.addresses.map(e=>e.multiaddr)}}const h=new u(e,t.id,()=>async e=>{const r=await this._findPeerSingle(e,t),n=r.closerPeers.find(e=>e.id.isEqual(t));return n?{peer:n,queryComplete:!0}:{closerPeers:r.closerPeers}});let l,d;try{d=await i(h.run(c),r.timeout)}catch(y){l=y}if(h.stop(),l)throw l;let p=!1;if(d.paths.forEach(t=>{t.success&&(p=!0,e.peerStore.addressBook.add(t.peer.id,t.peer.multiaddrs))}),e._log("findPeer %s: %s",t.toB58String(),p),!p)throw n(new Error("No peer found"),"ERR_NOT_FOUND");const b=e.peerStore.get(t);return{id:b.id,multiaddrs:b.addresses.map(e=>e.multiaddr)}},async*getClosestPeers(t,r={shallow:!1}){e._log("getClosestPeers to %b",t);const n=await f.convertBuffer(t),i=e.routingTable.closestPeers(n,e.kBucketSize),o=new u(e,t,()=>async n=>({closerPeers:await(async(t,r)=>{e._log("closerPeersSingle %b from %s",t,r.toB58String());return(await e.peerRouting._findPeerSingle(r,new s(t))).closerPeers.filter(t=>!e._isSelf(t.id)).map(t=>(e.peerStore.addressBook.add(t.id,t.multiaddrs),t))})(t,n),pathComplete:!!r.shallow||void 0})),a=await o.run(i);if(!a||!a.finalSet)return[];const c=await f.sortClosestPeers(Array.from(a.finalSet),n);for(const s of c.slice(0,e.kBucketSize))yield s},async getPublicKey(r){e._log("getPublicKey %s",r.toB58String());const n=e.peerStore.get(r);if(n&&n.id.pubKey)return e._log("getPublicKey: found local copy"),n.id.pubKey;let i;try{i=await t(r)}catch(c){const t=f.keyForPublicKey(r),n=await e.get(t);i=o.keys.unmarshalPublicKey(n)}n.id=new s(r.id,null,i);const a=n.addresses.map(e=>e.multiaddr);return e.peerStore.addressBook.add(n.id,a),e.peerStore.keyBook.set(n.id,i),i}}}},function(e,t,r){"use strict";const n=r(146),i=r(14),s=r(6),{Key:o}=r(7),{default:a}=r(51),{Buffer:c}=r(0),u=r(55),f=r(18);function h(e){return e="string"==typeof e?e:f.encodeBase32(e.buffer),u.PROVIDERS_KEY_PREFIX+e}function l(e){const t=e.toString().split("/");if(4!==t.length)throw new Error("incorrectly formatted provider entry key in datastore: "+e);return{cid:t[2],peerId:t[3]}}function d(e){return i.decode(e)}e.exports=class{constructor(e,t,r){this.datastore=e,this._log=f.logger(t,"providers"),this.cleanupInterval=u.PROVIDERS_CLEANUP_INTERVAL,this.provideValidity=u.PROVIDERS_VALIDITY,this.lruCacheSize=r||u.PROVIDERS_LRU_CACHE_SIZE,this.providers=n(this.lruCacheSize),this.syncQueue=new a({concurrency:1})}start(){this._cleaner=setInterval(()=>this._cleanup(),this.cleanupInterval)}stop(){clearInterval(this._cleaner),this._cleaner=null}_cleanup(){return this.syncQueue.add(async()=>{this._log("start cleanup");const e=Date.now();let t=0,r=0;const n=new Map,i=this.datastore.batch(),s=this.datastore.query({prefix:u.PROVIDERS_KEY_PREFIX});for await(const a of s)try{const{cid:e,peerId:s}=l(a.key),o=d(a.value),c=Date.now(),u=c-o,f=u>this.provideValidity;if(this._log("comparing: %d - %d = %d > %d %s",c,o,u,this.provideValidity,f?"(expired)":""),f){r++,i.delete(a.key);const t=n.get(e)||new Set;t.add(s),n.set(e,t)}t++}catch(o){this._log.error(o.message)}this._log("deleting %d / %d entries",r,t),n.size&&await i.commit();for(const[a,c]of n){const e=h(a),t=this.providers.get(e);if(t){for(const e of c)t.delete(e);0===t.size?this.providers.remove(e):this.providers.set(e,t)}}this._log("Cleanup successful (%dms)",Date.now()-e)})}async _getProvidersMap(e){const t=h(e);let r=this.providers.get(t);return r||(r=await async function(e,t){const r=new Map,n=e.query({prefix:h(t)});for await(const i of n){const{peerId:e}=l(i.key);r.set(e,d(i.value))}return r}(this.datastore,e),this.providers.set(t,r)),r}async addProvider(e,t){return this.syncQueue.add(async()=>{this._log("addProvider %s",e.toBaseEncodedString());const r=await this._getProvidersMap(e);this._log("loaded %s provs",r.size);const n=Date.now();r.set(f.encodeBase32(t.id),n);const s=h(e);return this.providers.set(s,r),async function(e,t,r,n){const s=[h(t),"/",f.encodeBase32(r.id)].join(""),a=new o(s),u=c.from(i.encode(n));return e.put(a,u)}(this.datastore,e,t,n)})}async getProviders(e){return this.syncQueue.add(async()=>{this._log("getProviders %s",e.toBaseEncodedString());return[...(await this._getProvidersMap(e)).keys()].map(e=>new s(f.decodeBase32(e)))})}}},function(e,t,r){"use strict";const n=r(28),i=r(193),s=r(6),o=r(41),a=r(1),c=r(1e3),u=r(55),{logger:f}=r(18);e.exports=class{constructor(e,t){if(!e)throw new Error("Random Walk needs an instance of the Kademlia DHT");this._kadDHT=e,this._options={...u.defaultRandomWalk,...t},this.log=f(e.peerId,"random-walk"),this._timeoutId=void 0}start(){!this._timeoutId&&this._options.enabled&&(this._timeoutId=setTimeout(()=>{this._runPeriodically()},this._options.delay))}stop(){this._timeoutId&&(clearTimeout(this._timeoutId),this._timeoutId=void 0),this._controller&&this._controller.abort()}async _runPeriodically(){for(;this._timeoutId;){try{await this._walk(this._options.queriesPerPeriod,this._options.timeout)}catch(e){this._kadDHT._log.error("random-walk:error",e)}await new Promise(e=>{this._timeoutId=setTimeout(e,this._options.interval)})}}async _walk(e,t){this.log("start"),this._controller=new o;try{await c(e,async e=>{this.log("running query %d",e);try{const e=await this._randomPeerId();if(!this._controller)return;await this._query(e,{timeout:t,signal:this._controller.signal})}catch(r){if(r&&"ETIMEDOUT"!==r.code)throw this.log.error("query %d finished with error",e,r),r}this.log("finished query %d",e)})}finally{this._controller=null,this.log("finished queries")}}async _query(e,t){let r;this.log("query:%s",e.toB58String());try{r=await this._kadDHT.findPeer(e,t)}catch(n){if(n&&"ERR_NOT_FOUND"===n.code)return;throw n}throw this.log("query:found",r),a("random-walk: ACTUALLY FOUND PEER: ".concat(r,", ").concat(e.toB58String()),"ERR_FOUND_RANDOM_PEER")}async _randomPeerId(){const e=await i(n.randomBytes(16),"sha2-256");return new s(e)}}},function(e,t,r){"use strict";const n=r(106),i=async(e,t,r)=>n(new Array(e).fill(),(e,r)=>t(r),r);e.exports=i,e.exports.default=i},function(e,t,r){"use strict";e.exports=class{constructor(){this.queries=new Set,this.running=!1}queryStarted(e){this.queries.add(e)}queryCompleted(e){this.queries.delete(e)}start(){this.running=!0}stop(){this.running=!1;for(const e of this.queries)e.stop();this.queries.clear()}}},function(e,t,r){"use strict";const n=r(6),i=r(15),s=r(58),{EventEmitter:o}=r(13),a=r(2),c=a("libp2p:bootstrap");c.error=a("libp2p:bootstrap:error");(e.exports=class extends o{constructor(e={}){if(!e.list||!e.list.length)throw new Error("Bootstrap requires a list of peer addresses");super(),this._list=e.list,this._interval=e.interval||1e4,this._timer=null}start(){this._timer||(this._timer=setInterval(()=>this._discoverBootstrapPeers(),this._interval),this._discoverBootstrapPeers())}_discoverBootstrapPeers(){this._timer&&this._list.forEach(e=>{if(!s.P2P.matches(e))return c.error("Invalid multiaddr");const t=i(e),r=n.createFromB58String(t.getPeerId());try{this.emit("peer",{id:r,multiaddrs:[t]})}catch(o){c.error("Invalid bootstrap peer id",o)}})}stop(){clearInterval(this._timer),this._timer=null}}).tag="bootstrap"},function(e,t,r){"use strict";const n=r(32),i=r(1),{normalizeCidPath:s,mapFile:o,withTimeoutOption:a}=r(3);e.exports=function({ipld:e,preload:t}){return a((async function*(r,a){a=a||{};const c=s(r),u=a.recursive,f=c.split("/");!1!==a.preload&&t(f[0]);const h=await n(r,e,a);if(!h.unixfs)throw i(new Error("dag node was not a UnixFS node"),"ERR_NOT_UNIXFS");if("file"===h.unixfs.type)return o(h,a);if(!h.unixfs.type.includes("dir"))throw i(new Error("Unknown UnixFS type ".concat(h.unixfs.type)),"ERR_UNKNOWN_UNIXFS_TYPE");if(u)for await(const t of n.recursive(h.cid,e,a))h.cid.toBaseEncodedString()!==t.cid.toBaseEncodedString()&&(yield o(t,a));else for await(let e of h.content())e=o(e,a),e.depth--,yield e}))}},function(e,t,r){"use strict";const n=r(2),i=r(136).default,s=r(28),o=r(1),a=n("ipfs:name:publish");a.error=n("ipfs:name:publish:error");const{OFFLINE_ERROR:c,normalizePath:u,withTimeoutOption:f}=r(3),{resolvePath:h}=r(1005);e.exports=({ipns:e,dag:t,peerId:r,isOnline:n,keychain:l,options:d})=>{const p=async e=>{if("self"===e)return r.privKey;try{const t=d.pass,r=await l.exportKey(e,t);return await s.keys.import(r,t)}catch(t){throw a.error(t),o(t,"ERR_CANNOT_GET_KEY")}};return f((async function(r,s){const f=!(!1===(s=s||{}).resolve),l=s.lifetime||"24h",d=s.key||"self";if(!n())throw o(new Error(c),"OFFLINE_ERROR");try{r=u(r)}catch(m){throw a.error(m),m}let b;try{b=i(l),b=b.toFixed(6)}catch(m){throw a.error(m),m}const y=await Promise.all([p(d),f?h({ipns:e,dag:t},r):Promise.resolve()]);return e.publish(y[0],r,b)}))}},function(e,t,r){"use strict";const n=r(49);t.resolvePath=({ipns:e,dag:t},r)=>n.ipnsPath(r)?e.resolve(r):t.get(r.substring("/ipfs/".length))},function(e,t,r){"use strict";const{getPubsubRouting:n}=r(196),{withTimeoutOption:i}=r(3);e.exports=({ipns:e,options:t})=>i((async function(r,i){return n(e,t).cancel(r,i)}))},function(e,t,r){"use strict";const{Buffer:n}=r(0),{Key:i,Adapter:s}=r(7),{encodeBase32:o,keyToTopic:a,topicToKey:c}=r(1008),u=r(1),f=r(2),h=f("datastore-pubsub:publisher");h.error=f("datastore-pubsub:publisher:error");e.exports=class extends s{constructor(e,t,r,n,i){if(super(),!n)throw u(new TypeError("missing validator"),"ERR_INVALID_PARAMETERS");if("function"!=typeof n.validate)throw u(new TypeError("missing validate function"),"ERR_INVALID_PARAMETERS");if("function"!=typeof n.select)throw u(new TypeError("missing select function"),"ERR_INVALID_PARAMETERS");if(i&&"function"!=typeof i)throw u(new TypeError("invalid subscriptionKeyFn received"),"ERR_INVALID_PARAMETERS");this._pubsub=e,this._datastore=t,this._peerId=r,this._validator=n,this._handleSubscriptionKeyFn=i,this._onMessage=this._onMessage.bind(this)}async put(e,t){if(!n.isBuffer(e)){const e="datastore key does not have a valid format";throw h.error(e),u(new Error(e),"ERR_INVALID_DATASTORE_KEY")}if(!n.isBuffer(t)){const e="received value is not a buffer";throw h.error(e),u(new Error(e),"ERR_INVALID_VALUE_RECEIVED")}const r=a(e);return h("publish value for topic ".concat(r)),this._pubsub.publish(r,t)}async get(e){if(!n.isBuffer(e)){const e="datastore key does not have a valid format";throw h.error(e),u(new Error(e),"ERR_INVALID_DATASTORE_KEY")}const t=a(e),r=await this._pubsub.getTopics();if(r&&Array.isArray(r)&&r.indexOf(t)>-1)return this._getLocal(e);try{await this._pubsub.subscribe(t,this._onMessage)}catch(i){const e="cannot subscribe topic ".concat(t);throw h.error(e),u(new Error(e),"ERR_SUBSCRIBING_TOPIC")}return h("subscribed values for key ".concat(t)),this._getLocal(e)}unsubscribe(e){const t=a(e);return this._pubsub.unsubscribe(t,this._onMessage)}async _getLocal(e){const t=new i("/"+o(e),!1);let r;try{r=await this._datastore.get(t)}catch(s){if("ERR_NOT_FOUND"!==s.code){const e="unexpected error getting the ipns record for ".concat(t.toString());throw h.error(e),u(new Error(e),"ERR_UNEXPECTED_ERROR_GETTING_RECORD")}const e="local record requested was not found for ".concat(t.toString());throw h.error(e),u(new Error(e),"ERR_NOT_FOUND")}if(!n.isBuffer(r)){const e="found record that we couldn't convert to a value";throw h.error(e),u(new Error(e),"ERR_INVALID_RECORD_RECEIVED")}return r}async _onMessage(e){const{data:t,from:r,topicIDs:n}=e;let i;try{i=c(n[0])}catch(s){return void h.error(s)}if(h("message received for topic ".concat(n[0])),r!==this._peerId.toB58String()){if(this._handleSubscriptionKeyFn){let e;try{e=await this._handleSubscriptionKeyFn(i)}catch(s){return void h.error("message discarded by the subscriptionKeyFn")}i=e}try{await this._storeIfSubscriptionIsBetter(i,t)}catch(s){h.error(s)}}else h("message discarded as it is from the same peer")}async _storeIfSubscriptionIsBetter(e,t){let r=!1;try{r=await this._isBetter(e,t)}catch(i){if("ERR_NOT_VALID_RECORD"!==i.code)throw i}r&&await this._storeRecord(n.from(e),t)}async _validateRecord(e,t){return this._validator.validate(e,t)}async _selectRecord(e,t){return 0===await this._validator.select(e,t)}async _isBetter(e,t){let r,n;try{n=await this._validateRecord(t,e)}catch(a){r=a}if(r||!n){const e="record received through pubsub is not valid";throw h.error(e),u(new Error(e),"ERR_NOT_VALID_RECORD")}const s=new i(e);let o;try{o=await this._getLocal(s.toBuffer())}catch(a){return!0}return!o.equals(t)&&this._selectRecord(t,o)}async _storeRecord(e,t){const r=new i("/"+o(e),!1);await this._datastore.put(r,t),h("record for ".concat(a(e)," was stored in the datastore"))}open(){const e="open function was not implemented yet";throw h.error(e),u(new Error(e),"ERR_NOT_IMPLEMENTED_YET")}has(e){const t="has function was not implemented yet";throw h.error(t),u(new Error(t),"ERR_NOT_IMPLEMENTED_YET")}delete(e){const t="delete function was not implemented yet";throw h.error(t),u(new Error(t),"ERR_NOT_IMPLEMENTED_YET")}close(){const e="close function was not implemented yet";throw h.error(e),u(new Error(e),"ERR_NOT_IMPLEMENTED_YET")}batch(){const e="batch function was not implemented yet";throw h.error(e),u(new Error(e),"ERR_NOT_IMPLEMENTED_YET")}query(){const e="query function was not implemented yet";throw h.error(e),u(new Error(e),"ERR_NOT_IMPLEMENTED_YET")}}},function(e,t,r){"use strict";const n=r(1009),i=r(1);e.exports.encodeBase32=e=>n.encode("base32",e).slice(1),e.exports.keyToTopic=e=>{const t=n.encode("base64url",e).slice(1).toString();return"".concat("/record/").concat(t)},e.exports.topicToKey=e=>{if("/record/"!==e.substring(0,"/record/".length))throw i(new Error("topic received is not from a record"),"ERR_TOPIC_IS_NOT_FROM_RECORD_NAMESPACE");const t="".concat("u").concat(e.substring("/record/".length));return n.decode(t)}},function(e,t,r){"use strict";const{Buffer:n}=r(0),i=r(1010);function s(e,t){if(!t)throw new Error("requires an encoded buffer");const r=o(e),i=n.from(r.code);return function(e,t){o(e).decode(t.toString())}(r.name,t),n.concat([i,t])}function o(e){let t;if(i.names[e])t=i.names[e];else{if(!i.codes[e])throw new Error("Unsupported encoding");t=i.codes[e]}if(!t.isImplemented())throw new Error("Base "+e+" is not implemented yet");return t}(t=e.exports=s).encode=function(e,t){const r=o(e);return s(r.name,n.from(r.encode(t)))},t.decode=function(e){n.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);"string"==typeof(e=e.substring(1,e.length))&&(e=n.from(e));const r=o(t);return n.from(r.decode(e.toString()))},t.isEncoded=function(e){n.isBuffer(e)&&(e=e.toString());if("[object String]"!==Object.prototype.toString.call(e))return!1;const t=e.substring(0,1);try{return o(t).name}catch(r){return!1}},t.names=Object.freeze(Object.keys(i.names)),t.codes=Object.freeze(Object.keys(i.codes))},function(e,t,r){"use strict";const n=r(1011),i=r(42),s=r(1012),o=r(1013),a=r(1014),c=[["base1","1","","1"],["base2","0",i,"01"],["base8","7",i,"01234567"],["base10","9",i,"0123456789"],["base16","f",s,"0123456789abcdef"],["base32","b",o,"abcdefghijklmnopqrstuvwxyz234567"],["base32pad","c",o,"abcdefghijklmnopqrstuvwxyz234567="],["base32hex","v",o,"0123456789abcdefghijklmnopqrstuv"],["base32hexpad","t",o,"0123456789abcdefghijklmnopqrstuv="],["base32z","h",o,"ybndrfg8ejkmcpqxot1uwisza345h769"],["base58flickr","Z",i,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base58btc","z",i,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base64","m",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],u=c.reduce((e,t)=>(e[t[0]]=new n(t[0],t[1],t[2],t[3]),e),{}),f=c.reduce((e,t)=>(e[t[1]]=u[t[0]],e),{});e.exports={names:u,codes:f}},function(e,t,r){"use strict";e.exports=class{constructor(e,t,r,n){this.name=e,this.code=t,this.alphabet=n,r&&n&&(this.engine=r(n))}encode(e){return this.engine.encode(e)}decode(e){return this.engine.decode(e)}isImplemented(){return this.engine}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports=function(e){return{encode:e=>"string"==typeof e?n.from(e).toString("hex"):e.toString("hex"),decode(t){for(const r of t)if(e.indexOf(r)<0)throw new Error("invalid base16 character");return n.from(t,"hex")}}}},function(e,t,r){"use strict";function n(e,t){const r=e.byteLength,n=new Uint8Array(e),i=t.indexOf("=")===t.length-1;i&&(t=t.substring(0,t.length-1));let s=0,o=0,a="";for(let c=0;c<r;c++)for(o=o<<8|n[c],s+=8;s>=5;)a+=t[o>>>s-5&31],s-=5;if(s>0&&(a+=t[o<<5-s&31]),i)for(;a.length%8!=0;)a+="=";return a}e.exports=function(e){return{encode:t=>n("string"==typeof t?Uint8Array.from(t):t,e),decode(t){for(const r of t)if(e.indexOf(r)<0)throw new Error("invalid base32 character");return function(e,t){const r=(e=e.replace(new RegExp("=","g"),"")).length;let n=0,i=0,s=0;const o=new Uint8Array(5*r/8|0);for(let a=0;a<r;a++)i=i<<5|t.indexOf(e[a]),n+=5,n>=8&&(o[s++]=i>>>n-8&255,n-=8);return o.buffer}(t,e)}}}},function(e,t,r){"use strict";const{Buffer:n}=r(0);e.exports=function(e){const t=e.indexOf("=")>-1,r=e.indexOf("-")>-1&&e.indexOf("_")>-1;return{encode(e){let i="";i="string"==typeof e?n.from(e).toString("base64"):e.toString("base64"),r&&(i=i.replace(/\+/g,"-").replace(/\//g,"_"));const s=i.indexOf("=");return s>0&&!t&&(i=i.substring(0,s)),i},decode(t){for(const r of t)if(e.indexOf(r)<0)throw new Error("invalid base64 character");return n.from(t,"base64")}}}},function(e,t,r){"use strict";const{getPubsubRouting:n}=r(196),{withTimeoutOption:i}=r(3);e.exports=({ipns:e,options:t})=>i((async function(r){try{return{enabled:Boolean(n(e,t))}}catch(i){return!1}}))},function(e,t,r){"use strict";const{getPubsubRouting:n}=r(196),{withTimeoutOption:i}=r(3);e.exports=({ipns:e,options:t})=>i((async function(r){return n(e,t).getSubscriptions(r)}))},function(e,t,r){"use strict";const n=r(2),i=r(1),s=r(26),o=r(4),a=r(1018),c=n("ipfs:name:resolve");c.error=n("ipfs:name:resolve:error");const{OFFLINE_ERROR:u,withTimeoutOption:f}=r(3),h=async(e,t)=>(e=await e,t.length?e+"/"+t.join("/"):e);e.exports=({dns:e,ipns:t,peerId:r,isOnline:n,options:l})=>f((async function*(f,d){d=s({nocache:!1,recursive:!0},d||{});const{offline:p}=l;if(p&&d.nocache)throw i(new Error("cannot specify both offline and nocache"),"ERR_NOCACHE_AND_OFFLINE");f||(f=r.toB58String()),f.startsWith("/ipns/")||(f="/ipns/".concat(f));const[b,y,...m]=f.slice(1).split("/");try{new o(y)}catch(g){if(a(y))return void(yield h(e(y,d),m));throw c.error(g),i(new Error("Invalid IPNS name"),"ERR_IPNS_INVALID_NAME")}if(!n()&&!p)throw i(new Error(u),"OFFLINE_ERROR");yield h(t.resolve("/".concat(b,"/").concat(y),d),m)}))},function(e,t,r){"use strict";var n=/^(?:[a-z0-9](?:[a-z0-9\-]{0,61}[a-z0-9])?\.){0,126}(?:[a-z0-9](?:[a-z0-9\-]{0,61}[a-z0-9]))\.?$/i;e.exports=function(e,t){if(null==t&&(t=!1),e.length<2)return!1;if(e.length>255)return!1;var r=e[e.length-1];if(t){if("."!==r)return!1}else if("."===r)return!1;return n.test(e)}},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=({ipld:e,preload:t})=>{const i=r(56)({ipld:e,preload:t});return n((async function(e,t){return(await i(e,t)).Data}))}},function(e,t,r){"use strict";const n=r(12).DAGLink,i=r(4),{withTimeoutOption:s}=r(3);e.exports=({dag:e})=>s((async function(t,r){r=r||{};const s=new i(t),o=await e.get(s,r);if("raw"===s.codec)return[];if("dag-pb"===s.codec)return o.value.Links;if("dag-cbor"===s.codec)return function e(t,r=[]){for(const o in t){const a=t[o];if("/"===o&&1===Object.keys(t).length)try{r.push(new n("",0,new i(a)));continue}catch(s){}i.isCID(a)?r.push(new n("",0,a)):(Array.isArray(a)&&e(a,r),a&&"object"==typeof a&&e(a,r))}return r}(o);throw new Error("Cannot resolve links from codec ".concat(s.codec))}))},function(e,t,r){"use strict";const n=r(12).DAGNode,i=r(11),s=r(23),{withTimeoutOption:o}=r(3),{Buffer:a}=r(0);e.exports=({ipld:e,preload:t})=>o((async function(r={}){let o;if(r.template){if("unixfs-dir"!==r.template)throw new Error("unknown template");o=new s("directory").marshal()}else o=a.alloc(0);const c=new n(o),u=await e.put(c,i.DAG_PB,{cidVersion:0,hashAlg:i.SHA2_256,signal:r.signal});return!1!==r.preload&&t(u),u}))},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=({ipld:e,gcLock:t,preload:i})=>{const s=r(56)({ipld:e,preload:i}),o=r(86)({ipld:e,gcLock:t,preload:i});return n((async function(e,t,r){const n=await s(e,r);return n.addLink(t),o(n,r)}))}},function(e,t,r){"use strict";const{DAGNode:n}=r(12),{withTimeoutOption:i}=r(3),{Buffer:s}=r(0);e.exports=({ipld:e,gcLock:t,preload:o})=>{const a=r(56)({ipld:e,preload:o}),c=r(86)({ipld:e,gcLock:t,preload:o});return i((async function(e,t,r){const i=await a(e,r),o=s.concat([i.Data,t]);return c(new n(o,i.Links),r)}))}},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=({ipld:e,gcLock:t,preload:i})=>{const s=r(56)({ipld:e,preload:i}),o=r(86)({ipld:e,gcLock:t,preload:i});return n((async function(e,t,r){const n=await s(e,r);return n.rmLink(t.Name||t.name),o(n,r)}))}},function(e,t,r){"use strict";const{DAGNode:n}=r(12),{withTimeoutOption:i}=r(3);e.exports=({ipld:e,gcLock:t,preload:s})=>{const o=r(56)({ipld:e,preload:s}),a=r(86)({ipld:e,gcLock:t,preload:s});return i((async function(e,t,r){const i=await o(e,r);return a(new n(t,i.Links),r)}))}},function(e,t,r){"use strict";const n=r(12),{withTimeoutOption:i}=r(3);e.exports=({ipld:e,preload:t})=>{const s=r(56)({ipld:e,preload:t});return i((async function(e,t){t=t||{};const r=await s(e,t),i=n.util.serialize(r),o=await n.util.cid(i,{cidVersion:0}),a=i.length,c=r.Links.reduce((e,t)=>e+t.Tsize,0);return{Hash:o.toBaseEncodedString(),NumLinks:r.Links.length,BlockSize:a,LinksSize:a-r.Data.length,DataSize:r.Data.length,CumulativeSize:a+c}}))}},function(e,t,r){"use strict";const{resolvePath:n,withTimeoutOption:i}=r(3);e.exports=({pinManager:e,gcLock:t,dag:r})=>i((async function(i,s){const o=!1!==(s=s||{}).recursive,a=await n(r,i,{signal:s.signal}),c=async()=>{const t=[];for(const i of a){const n=i.toBaseEncodedString();if(o){if(e.recursivePins.has(n)){t.push(i);continue}await e.fetchCompleteDag(n,{preload:s.preload,signal:s.signal}),t.push(i)}else{if(e.recursivePins.has(n))throw new Error("".concat(n," already pinned recursively"));e.directPins.has(n)||await r.get(i,{preload:s.preload}),t.push(i)}}const n=o?e.recursivePins:e.directPins;return t.forEach(e=>n.add(e.toString())),await e.flushPins(),t.map(e=>({cid:e}))};if(!Boolean(s.lock))return c();const u=await t.readLock();try{await c()}finally{u()}}))},function(e,t,r){"use strict";const{parallelMap:n}=r(99),i=r(4),{resolvePath:s}=r(3),o=r(100),{PinTypes:a}=o,{withTimeoutOption:c}=r(3);e.exports=({pinManager:e,dag:t})=>c((async function*(r={}){let c=a.all;if(r.type){c=r.type,"string"==typeof r.type&&(c=r.type.toLowerCase());const e=o.checkPinType(c);if(e)throw e}if(r.paths){r.paths=Array.isArray(r.paths)?r.paths:[r.paths];const i=await s(t,r.paths);return void(yield*n(8,async t=>{const{reason:n,pinned:s}=await e.isPinnedWithType(t,c);if(!s)throw new Error("path '".concat(r.paths[i.indexOf(t)],"' is not pinned"));return n===a.direct||n===a.recursive?{cid:t,type:n}:{cid:t,type:"".concat(a.indirect," through ").concat(n)}},i))}let u=[];if(c!==a.direct&&c!==a.all||(u=u.concat(Array.from(e.directPins).map(e=>({type:a.direct,cid:new i(e)})))),c!==a.recursive&&c!==a.all||(u=u.concat(Array.from(e.recursivePins).map(e=>({type:a.recursive,cid:new i(e)})))),c===a.indirect||c===a.all){const t=await e.getIndirectKeys(r);u=u.filter(({cid:r})=>!t.includes(r.toString())||!e.directPins.has(r.toString())).concat(t.map(e=>({type:a.indirect,cid:new i(e)})))}yield*u}))},function(e,t,r){"use strict";const n=r(1),i=r(27),{parallelMap:s,collect:o}=r(99),a=r(19),{resolvePath:c,withTimeoutOption:u}=r(3),{PinTypes:f}=r(100);e.exports=({pinManager:e,gcLock:t,dag:r})=>u((async function(u,h){const l=!1!==(h=h||{}).recursive;if(h.cidBase&&!i.names[h.cidBase])throw n(new Error("invalid multibase"),"ERR_INVALID_MULTIBASE");const d=await c(r,u),p=await t.readLock();try{const t=await a(d,s(8,async t=>{const{pinned:r,reason:n}=await e.isPinnedWithType(t,f.all);if(!r)throw new Error("".concat(t," is not pinned"));if(n!==f.recursive&&n!==f.direct)throw new Error("".concat(t," is pinned indirectly under ").concat(n));if(n===f.recursive&&!l)throw new Error("".concat(t," is pinned recursively"));return t}),o);return t.forEach(t=>{l&&e.recursivePins.has(t.toString())?e.recursivePins.delete(t.toString()):e.directPins.delete(t.toString())}),await e.flushPins(),t.map(e=>({cid:e}))}finally{p()}}))},function(e,t,r){"use strict";const n=r(6),i={success:!0,time:0,text:""},{withTimeoutOption:s}=r(3);e.exports=({libp2p:e})=>s((async function*(t,r){(r=r||{}).count=r.count||10,n.isPeerId(t)||(t=n.createFromCID(t));let s=e.peerStore.get(t);s||(yield{...i,text:"Looking up peer ".concat(t)},s=await e.peerRouting.findPeer(t)),yield{...i,text:"PING ".concat(s.id.toB58String())};let o=0,a=0;for(let n=0;n<r.count;n++)try{const t=await e.ping(s.id);a+=t,o++,yield{...i,time:t}}catch(c){yield{...i,success:!1,text:c.toString()}}if(o){const e=a/o;yield{...i,text:"Average latency: ".concat(e,"ms")}}}))},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3),i=r(1);e.exports=({libp2p:e})=>({subscribe:n((...t)=>e.pubsub.subscribe(...t)),unsubscribe:n((...t)=>e.pubsub.unsubscribe(...t)),publish:n(async(t,r,n)=>{if(!r)throw i(new Error('argument "data" is required'),"ERR_ARG_REQUIRED");await e.pubsub.publish(t,r)}),ls:n((...t)=>e.pubsub.getTopics(...t)),peers:n((...t)=>e.pubsub.getSubscribers(...t))})},function(e,t,r){"use strict";const n=r(49),i=r(4),{DAGNode:s}=r(12),{normalizeCidPath:o}=r(3),{Errors:a}=r(7),c=a.notFoundError().code,{withTimeoutOption:u}=r(3),f={default:"<dst>",edges:"<src> -> <dst>"};async function*h(e,t,r,n){const o=(await e(r)).split("/")[2];for await(const a of async function*(e,t,r,n){const o=new Set;yield*async function*t(a,u){const f=u+1;if(!(f>r))try{for(const r of await async function(e,t){const r=await e.get(new i(t));if(s.isDAGNode(r))return r.Links.map(({Name:e,Hash:t})=>({name:e,cid:new i(t)}));return function e(t,r=""){let n=[];for(const[s,o]of Object.entries(t))i.isCID(o)?n.push({name:r+s,cid:o}):"object"==typeof o&&(n=n.concat(e(o,r+s+"/")));return n}(r)}(e,a.cid))yield{parent:a,node:r,isDuplicate:n&&o.has(r.cid.toString())},n&&o.add(r.cid.toString()),yield*t(r,f)}catch(h){throw h.code===c&&(h.message="Could not find object with CID: ".concat(a.cid)),h}}({cid:t},0)}(t,o,n.maxDepth,n.unique))a.parent&&(a.isDuplicate||(yield{ref:l(a.parent.cid,a.node.cid,a.node.name,n.format)}))}function l(e,t,r,n){let i=n.replace(/<src>/g,e.toString());return i=i.replace(/<dst>/g,t.toString()),i=i.replace(/<linkname>/g,r),i}e.exports=function({ipld:e,resolve:t,preload:r}){return u((async function*(i,s){if(0===(s=s||{}).maxDepth)return;if(s.edges&&s.format&&s.format!==f.default)throw new Error("Cannot set edges to true and also specify format");s.format=s.edges?f.edges:s.format||f.default,"number"!=typeof s.maxDepth&&(s.maxDepth=s.recursive?1/0:1);const a=(Array.isArray(i)?i:[i]).map(e=>function(e,t,r){const i=o(t),s=i.split("/")[0];if(!n.cid(s))throw new Error("Error resolving path '".concat(i,"': '").concat(s,"' is not a valid CID"));!1!==r.preload&&e(s);return"/ipfs/"+i}(r,e,s));for(const r of a)yield*h(t,e,r,s)}))},e.exports.Format=f},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=function({repo:e}){return n((async function*(t={}){for await(const r of e.blocks.query({keysOnly:!0,signal:t.signal}))yield{ref:r.toString()}}))}},function(e,t,r){"use strict";const n=r(4),i=r(2)("ipfs:repo:gc"),{MFS_ROOT_KEY:s,withTimeoutOption:o}=r(3),{Errors:a}=r(7),c=a.notFoundError().code,{parallelMerge:u,transform:f,map:h}=r(99),l=r(27);e.exports=({gcLock:e,pin:t,pinManager:r,refs:a,repo:d})=>o((async function*(o={}){const p=Date.now();i("Creating set of marked blocks");const b=await e.writeLock();try{const e=await async function({pin:e,pinManager:t,refs:r,repo:o}){const a=h(({cid:e})=>e,e.ls()),f=async function*(){const e=await t.getInternalBlocks();yield*e}(),d=async function*(){let e;try{e=await o.root.get(s)}catch(a){if(a.code===c)return void i("No blocks in MFS");throw a}const t=new n(e);yield t;for await(const{ref:i}of r(t,{recursive:!0}))yield new n(i)}(),p=new Set;for await(const n of u(a,f,d))p.add(l.encode("base32",n.multihash).toString());return p}({pin:t,pinManager:r,refs:a,repo:d}),o=d.blocks.query({keysOnly:!0});yield*async function*({repo:e,refs:t},r,n){let s=0,o=0;const a=async t=>{s++;try{const i=l.encode("base32",t.multihash).toString();if(r.has(i))return null;const s={cid:t};try{await e.blocks.delete(t),o++}catch(n){s.err=new Error("Could not delete block with CID ".concat(t,": ").concat(n.message))}return s}catch(n){const e="Could delete block with CID ".concat(t);return i(e,n),{err:new Error(e+": ".concat(n.message))}}};for await(const i of f(256,a,n))i&&(yield i);i("Marked set has ".concat(r.size," unique blocks. Blockstore has ").concat(s," blocks. ")+"Deleted ".concat(o," blocks."))}({repo:d,refs:a},e,o),i("Complete (".concat(Date.now()-p,"ms)"))}finally{b()}}))},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=({repo:e})=>n((async function(t){const r=await e.stat(t);return{numObjects:r.numObjects,repoSize:r.repoSize,repoPath:r.repoPath,version:r.version.toString(),storageMax:r.storageMax}}))},function(e,t,r){"use strict";const{repoVersion:n}=r(152),{withTimeoutOption:i}=r(3);e.exports=({repo:e})=>i((async function(t){try{await e._checkInitialized(t)}catch(r){if([/Key not found in database \[\/version\]/,/ENOENT/,/repo is not initialized yet/].some(e=>e.test(r.message)))return n;throw r}return e.version.get(t)}))},function(e,t,r){"use strict";const n=r(49),i=r(4),{cidToString:s}=r(142),{withTimeoutOption:o}=r(3);e.exports=({ipld:e,name:t})=>o((async function(r,o){if(o=o||{},!n.path(r))throw new Error("invalid argument "+r);if(n.ipnsPath(r)){if(!t)throw new Error("failed to resolve IPNS path: name API unavailable");for await(const e of t.resolve(r,o))r=e}const[,,a,...c]=r.split("/"),u=new i(a);if(0===c.length)return"/ipfs/".concat(s(u,{base:o.cidBase}));r=c.join("/");const f=e.resolve(u,r);let h=u,l=r;for await(const e of f)i.isCID(e.value)&&(h=e.value,l=e.remainderPath);return"/ipfs/".concat(s(h,{base:o.cidBase})).concat(l?"/"+l:"")}))},function(e,t,r){"use strict";const n=r(2)("ipfs:components:start"),i=r(1039),s=r(15),o=r(165),a=r(83),c=r(1),u=r(298),f=r(1057),{AlreadyInitializedError:h,NotEnabledError:l}=r(75),d=r(97),p=r(1058),{withTimeoutOption:b}=r(3);e.exports=({apiManager:e,options:t,blockService:r,gcLock:y,initOptions:m,ipld:g,keychain:v,peerId:w,pinManager:_,preload:E,print:k,repo:S})=>b((async function(){const b=a();b.promise.catch(e=>n(e));const{cancel:A}=e.update({start:()=>b.promise});try{S.closed&&await S.open();const n=await S.config.getAll(),a=[];n.Addresses&&n.Addresses.Swarm&&n.Addresses.Swarm.forEach(e=>{let t=s(e);if(t.protoCodes().includes(479))throw c(new Error("websocket-star swarm addresses are not supported. See https://github.com/ipfs/js-ipfs/issues/2779"),"ERR_WEBSOCKET_STAR_SWARM_ADDR_NOT_SUPPORTED");const r=t.getPeerId();r&&r!==w.toB58String()&&(t=t.encapsulate("/p2p/".concat(w.toB58String()))),a.push(t)});const b=d.libp2p({options:t,repo:S,peerId:w,multiaddrs:a,config:n});b.keychain&&await b.loadKeychain(),await b.start(),b.transportManager.getAddrs().forEach(e=>k("Swarm listening on ".concat(e,"/p2p/").concat(w.toB58String())));const A=f({libp2p:b,repo:S,peerId:w,options:t}),I=new u(A,S.datastore,w,v,{pass:m.pass}),T=new i(b,S.blocks,{statsEnabled:!0});await T.start(),r.setExchange(T);const R={get:d.dag.get({ipld:g,preload:E}),resolve:d.dag.resolve({ipld:g,preload:E}),tree:d.dag.tree({ipld:g,preload:E})},x={add:d.pin.add({pinManager:_,gcLock:y,dag:R}),ls:d.pin.ls({pinManager:_,dag:R}),rm:d.pin.rm({pinManager:_,gcLock:y,dag:R})};R.put=d.dag.put({ipld:g,pin:x,gcLock:y,preload:E});const C={get:d.block.get({blockService:r,preload:E}),put:d.block.put({blockService:r,pin:x,gcLock:y,preload:E}),rm:d.block.rm({blockService:r,gcLock:y,pinManager:_}),stat:d.block.stat({blockService:r,preload:E})},B=d.files({ipld:g,block:C,blockService:r,repo:S,preload:E,options:t}),M=p({files:B,preload:E,options:t.preload});await Promise.all([I.republisher.start(),E.start(),M.start()]);const N=function({apiManager:e,bitswap:t,block:r,blockService:n,config:i,constructorOptions:s,dag:a,files:c,gcLock:u,initOptions:f,ipld:p,ipns:b,keychain:y,libp2p:m,mfsPreload:g,peerId:v,pin:w,pinManager:_,preload:E,print:k,repo:S}){const A={data:d.object.data({ipld:p,preload:E}),get:d.object.get({ipld:p,preload:E}),links:d.object.links({dag:a}),new:d.object.new({ipld:p,preload:E}),patch:{addLink:d.object.patch.addLink({ipld:p,gcLock:u,preload:E}),appendData:d.object.patch.appendData({ipld:p,gcLock:u,preload:E}),rmLink:d.object.patch.rmLink({ipld:p,gcLock:u,preload:E}),setData:d.object.patch.setData({ipld:p,gcLock:u,preload:E})},put:d.object.put({ipld:p,gcLock:u,preload:E}),stat:d.object.stat({ipld:p,preload:E})},I=d.addAll({block:r,preload:E,pin:w,gcLock:u,options:s}),T=d.isOnline({libp2p:m}),R=async()=>{throw new l("dht not enabled")},x=async function*(){throw new l("dht not enabled")},C=o(m,"_config.dht.enabled",!1)?d.dht({libp2p:m,repo:S}):{get:R,put:R,findProvs:x,findPeer:R,provide:x,query:x},B=d.dns(),M={pubsub:{cancel:d.name.pubsub.cancel({ipns:b,options:s}),state:d.name.pubsub.state({ipns:b,options:s}),subs:d.name.pubsub.subs({ipns:b,options:s})},publish:d.name.publish({ipns:b,dag:a,peerId:v,isOnline:T,keychain:y,options:s}),resolve:d.name.resolve({dns:B,ipns:b,peerId:v,isOnline:T,options:s})},N=d.resolve({name:M,ipld:p}),P=d.refs({ipld:p,resolve:N,preload:E});P.local=d.refs.local({repo:S});const O=async()=>{throw new l("pubsub not enabled")},D=o(s,"config.Pubsub.Enabled",o(i,"Pubsub.Enabled",!0))?d.pubsub({libp2p:m}):{subscribe:O,unsubscribe:O,publish:O,ls:O,peers:O};return{add:d.add({addAll:I}),addAll:I,bitswap:{stat:d.bitswap.stat({bitswap:t}),unwant:d.bitswap.unwant({bitswap:t}),wantlist:d.bitswap.wantlist({bitswap:t}),wantlistForPeer:d.bitswap.wantlistForPeer({bitswap:t})},block:r,bootstrap:{add:d.bootstrap.add({repo:S}),clear:d.bootstrap.clear({repo:S}),list:d.bootstrap.list({repo:S}),reset:d.bootstrap.reset({repo:S}),rm:d.bootstrap.rm({repo:S})},cat:d.cat({ipld:p,preload:E}),config:d.config({repo:S}),dag:a,dht:C,dns:B,files:c,get:d.get({ipld:p,preload:E}),id:d.id({peerId:v,libp2p:m}),init:async()=>{throw new h},isOnline:T,key:{export:d.key.export({keychain:y}),gen:d.key.gen({keychain:y}),import:d.key.import({keychain:y}),info:d.key.info({keychain:y}),list:d.key.list({keychain:y}),rename:d.key.rename({keychain:y}),rm:d.key.rm({keychain:y})},libp2p:m,ls:d.ls({ipld:p,preload:E}),name:M,object:A,pin:w,ping:d.ping({libp2p:m}),pubsub:D,refs:P,repo:{gc:d.repo.gc({gcLock:u,pin:w,pinManager:_,refs:P,repo:S}),stat:d.repo.stat({repo:S}),version:d.repo.version({repo:S})},resolve:N,start:()=>e.api,stats:{bitswap:d.bitswap.stat({bitswap:t}),bw:m.metrics?d.stats.bw({libp2p:m}):async()=>{throw new l("libp2p metrics not enabled")},repo:d.repo.stat({repo:S})},stop:d.stop({apiManager:e,bitswap:t,options:s,blockService:n,gcLock:u,initOptions:f,ipld:p,ipns:b,keychain:y,libp2p:m,mfsPreload:g,peerId:v,preload:E,print:k,repo:S}),swarm:{addrs:d.swarm.addrs({libp2p:m}),connect:d.swarm.connect({libp2p:m}),disconnect:d.swarm.disconnect({libp2p:m}),localAddrs:d.swarm.localAddrs({multiaddrs:m.multiaddrs}),peers:d.swarm.peers({libp2p:m})},version:d.version({repo:S})}}({apiManager:e,bitswap:T,block:C,blockService:r,config:n,constructorOptions:t,dag:R,files:B,gcLock:y,initOptions:m,ipld:g,ipns:I,keychain:v,libp2p:b,mfsPreload:M,peerId:w,pin:x,pinManager:_,preload:E,print:k,repo:S});e.update(N,()=>{})}catch(I){throw A(),b.reject(I),I}return b.resolve(e.api),e.api}))},function(e,t,r){"use strict";const n=r(1040),i=r(1048),s=r(1049),o=r(1054),a=r(45).logger,c=r(1055),u=r(41),f=r(70),h={statsEnabled:!1,statsComputeThrottleTimeout:1e3,statsComputeThrottleMaxQueueSize:1e3},l=["blocksReceived","dataReceived","dupBlksReceived","dupDataReceived","blocksSent","dataSent","providesBufferLength","wantListLength","peerCount"];e.exports=class{constructor(e,t,r){this._libp2p=e,this._log=a(this.peerId),this._options=Object.assign({},h,r),this._stats=new c(l,{enabled:this._options.statsEnabled,computeThrottleTimeout:this._options.statsComputeThrottleTimeout,computeThrottleMaxQueueSize:this._options.statsComputeThrottleMaxQueueSize}),this.network=new i(e,this,{},this._stats),this.blockstore=t,this.engine=new s(this.peerId,t,this.network,this._stats),this.wm=new n(this.peerId,this.network,this._stats),this.notifications=new o(this.peerId)}get peerId(){return this._libp2p.peerId}async _receiveMessage(e,t){try{await this.engine.messageReceived(e,t)}catch(i){this._log("failed to receive message",t)}if(0===t.blocks.size)return;const r=Array.from(t.blocks.values()),n=r.filter(e=>this.wm.wantlist.contains(e.cid)).map(e=>e.cid);this.wm.cancelWants(n),await Promise.all(r.map(async t=>{const r=n.includes(t.cid);await this._handleReceivedBlock(e,t,r)}))}async _handleReceivedBlock(e,t,r){this._log("received block");const n=await this.blockstore.has(t.cid);this._updateReceiveCounters(e.toB58String(),t,n),r&&await this.put(t)}_updateReceiveCounters(e,t,r){this._stats.push(e,"blocksReceived",1),this._stats.push(e,"dataReceived",t.data.length),r&&(this._stats.push(e,"dupBlksReceived",1),this._stats.push(e,"dupDataReceived",t.data.length))}_receiveError(e){this._log.error("ReceiveError: %s",e.message)}_onPeerConnected(e){this.wm.connected(e)}_onPeerDisconnected(e){this.wm.disconnected(e),this.engine.peerDisconnected(e),this._stats.disconnected(e)}enableStats(){this._stats.enable()}disableStats(){this._stats.disable()}wantlistForPeer(e){return this.engine.wantlistForPeer(e)}ledgerForPeer(e){return this.engine.ledgerForPeer(e)}async get(e,t={}){const r=(e,t)=>(this.wm.wantBlocks([e],t),this.notifications.wantBlock(e,t));let n=!1;const i=new u,s=f([t.signal,i.signal]),o=await Promise.race([this.notifications.wantBlock(e,{signal:s}),(async(e,t)=>{try{return await this.blockstore.get(e,t)}catch(i){if("ERR_NOT_FOUND"!==i.code)throw i;return n||(n=!0,this.network.findAndConnect(e).catch(e=>this._log.error(e))),r(e,t)}})(e,{signal:s})]);return i.abort(),o}async*getMany(e,t={}){for await(const r of e)yield this.get(r,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)}async put(e){await this.blockstore.put(e),this._sendHaveBlockNotifications(e)}async*putMany(e){for await(const t of this.blockstore.putMany(e))this._sendHaveBlockNotifications(t),yield t}_sendHaveBlockNotifications(e){this.notifications.hasBlock(e),this.engine.receivedBlocks([e]),this.network.provide(e.cid).catch(e=>{this._log.error("Failed to provide: %s",e.message)})}getWantlist(){return this.wm.wantlist.entries()}peers(){return this.engine.peers()}stat(){return this._stats}start(){this.wm.start(),this.network.start(),this.engine.start()}stop(){this._stats.stop(),this.wm.stop(),this.network.stop(),this.engine.stop()}}},function(e,t,r){"use strict";const n=r(87),i=r(113),s=r(114),o=r(1046),a=r(45).logger;e.exports=class{constructor(e,t,r){this.peers=new Map,this.wantlist=new i(r),this.network=t,this._stats=r,this._peerId=e,this._log=a(e,"want")}_addEntries(e,t,r){const i=e.map((e,r)=>new n.Entry(e,s.kMaxPriority-r,n.WantType.Block,t));i.forEach(e=>{e.cancel?r?this.wantlist.removeForce(e.cid):this.wantlist.remove(e.cid):(this._log("adding to wl"),this.wantlist.add(e.cid,e.priority))});for(const n of this.peers.values())n.addEntries(i)}_startPeerHandler(e){let t=this.peers.get(e.toB58String());if(t)return void t.refcnt++;t=new o(this._peerId,e,this.network);const r=new n(!0);for(const n of this.wantlist.entries())r.addEntry(n[1].cid,n[1].priority);return t.addMessage(r),this.peers.set(e.toB58String(),t),t}_stopPeerHandler(e){const t=this.peers.get(e.toB58String());t&&(t.refcnt--,t.refcnt>0||this.peers.delete(e.toB58String()))}wantBlocks(e,t={}){this._addEntries(e,!1),t&&t.signal&&t.signal.addEventListener("abort",()=>{this.cancelWants(e)})}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(){}stop(){this.peers.forEach(e=>this.disconnected(e.peerId)),clearInterval(this.timer)}}},function(e,t,r){"use strict";const n=r(14),i=r(1042);e.exports=e=>{if(!i(e))throw new Error("arg needs to be a buffer");const t=[];for(;e.length>0;){const r=n.decode(e);t.push(r),e=e.slice(n.decode.bytes)}return t}},function(e,t,r){"use strict";e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},function(e,t,r){"use strict";const n=r(16);e.exports=n("\n message Message {\n message Wantlist {\n enum WantType {\n Block = 0;\n Have = 1;\n }\n\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 WantType wantType = 4; // Note: defaults to enum 0, ie Block\n bool sendDontHave = 5; // Note: defaults to false\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 enum BlockPresenceType {\n Have = 0;\n DontHave = 1;\n }\n message BlockPresence {\n bytes cid = 1;\n BlockPresenceType type = 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 repeated BlockPresence blockPresences = 4;\n int32 pendingBytes = 5;\n }\n")},function(e,t,r){"use strict";const n=r(113).Entry;e.exports=class{constructor(e,t,r,i,s){this.entry=new n(e,t,r),this.cancel=Boolean(i),this.sendDontHave=Boolean(s)}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 wantType(){return this.entry.wantType}set wantType(e){this.entry.wantType=e}get[Symbol.toStringTag](){const e=this.cid.toString("base58btc");return"BitswapMessageEntry ".concat(e," <cancel: ").concat(this.cancel,", priority: ").concat(this.priority,">")}equals(e){return this.cancel===e.cancel&&this.sendDontHave===e.sendDontHave&&this.wantType===e.wantType&&this.entry.equals(e.entry)}}},function(e,t,r){"use strict";class n{constructor(e,t,r){this._refCounter=1,this.cid=e,this.priority=t||1,this.wantType=r}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.toString("base58btc");return"WantlistEntry <key: ".concat(e,", priority: ").concat(this.priority,", refs: ").concat(this._refCounter,">")}equals(e){return this._refCounter===e._refCounter&&this.cid.equals(e.cid)&&this.priority===e.priority&&this.wantType===e.wantType}}e.exports=n},function(e,t,r){"use strict";const n=r(1047),i=r(87),s=r(45).logger,{wantlistSendDebounceMs:o}=r(114);e.exports=class{constructor(e,t,r){this.peerId=t,this.network=r,this.refcnt=1,this._entries=[],this._log=s(e,"msgqueue",t.toB58String().slice(0,8)),this.sendEntries=n(this._sendEntries.bind(this),o)}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)}async send(e){try{await this.network.connectTo(this.peerId)}catch(t){return void this._log.error("cant connect to peer %s: %s",this.peerId.toB58String(),t.message)}this._log("sending message to peer %s",this.peerId.toB58String()),this.network.sendMessage(this.peerId,e).catch(e=>{this._log.error("send error: %s",e.message)})}}},function(e,t,r){"use strict";e.exports=function(e,t,r){var n;return function(){if(!t)return e.apply(this,arguments);var i=this,s=arguments,o=r&&!n;return clearTimeout(n),n=setTimeout((function(){if(n=null,!o)return e.apply(i,s)}),t),o?e.apply(this,arguments):void 0}}},function(e,t,r){"use strict";const n=r(25),i=r(19),s=r(167),o=r(87),a=r(114),c=r(45).logger;e.exports=class{constructor(e,t,r,n){this._log=c(e.peerId,"network"),r=r||{},this.libp2p=e,this.bitswap=t,this.protocols=["/ipfs/bitswap/1.0.0"],r.b100Only||(this.protocols.unshift("/ipfs/bitswap/1.1.0"),this.protocols.unshift("/ipfs/bitswap/1.2.0")),this._stats=n,this._running=!1,this._onPeerConnect=this._onPeerConnect.bind(this),this._onPeerDisconnect=this._onPeerDisconnect.bind(this),this._onConnection=this._onConnection.bind(this)}start(){this._running=!0,this.libp2p.handle(this.protocols,this._onConnection);const e=new s({multicodecs:this.protocols,handlers:{onConnect:this._onPeerConnect,onDisconnect:this._onPeerDisconnect}});this._registrarId=this.libp2p.registrar.register(e);for(const t of this.libp2p.peerStore.peers.values()){const e=this.libp2p.connectionManager.get(t.id);e&&this._onPeerConnect(e.remotePeer)}}stop(){this._running=!1,this.libp2p.unhandle(this.protocols),this.libp2p.registrar.unregister(this._registrarId)}async _onConnection({protocol:e,stream:t,connection:r}){if(this._running){this._log("incoming new bitswap %s connection from %s",e,r.remotePeer.toB58String());try{await i(t,n.decode(),async e=>{for await(const n of e)try{const e=await o.deserialize(n.slice());await this.bitswap._receiveMessage(r.remotePeer,e)}catch(t){this.bitswap._receiveError(t);break}})}catch(s){this._log(s)}}}_onPeerConnect(e){this.bitswap._onPeerConnected(e)}_onPeerDisconnect(e){this.bitswap._onPeerDisconnected(e)}findProviders(e,t,r={}){return this.libp2p.contentRouting.findProviders(e,{maxTimeout:a.providerRequestTimeout,maxNumProviders:t,signal:r.signal})}async findAndConnect(e,t){const r=[];for await(const n of this.findProviders(e,a.maxProvidersPerRequest,t))this._log("connecting to providers",n.id.toB58String()),r.push(this.connectTo(n,t));await Promise.all(r)}async provide(e,t){await this.libp2p.contentRouting.provide(e,t)}async sendMessage(e,t){if(!this._running)throw new Error("network isn't running");const r=e.toB58String();this._log("sendMessage to %s",r,t);const{stream:s,protocol:o}=await this._dialPeer(e);let a;switch(o){case"/ipfs/bitswap/1.0.0":a=t.serializeToBitswap100();break;case"/ipfs/bitswap/1.1.0":case"/ipfs/bitswap/1.2.0":a=t.serializeToBitswap110();break;default:throw new Error("Unknown protocol: "+o)}!async function(e,t,r){try{await i([t],n.encode(),e)}catch(s){r(s)}}(s,a,this._log),this._updateSentStats(e,t.blocks)}async connectTo(e,t){if(!this._running)throw new Error("network isn't running");return this.libp2p.dial(e,t)}_dialPeer(e){return this.libp2p.dialProtocol(e,["/ipfs/bitswap/1.2.0","/ipfs/bitswap/1.1.0","/ipfs/bitswap/1.0.0"])}_updateSentStats(e,t){const r=e.toB58String();this._stats&&(t.forEach(e=>this._stats.push(r,"dataSent",e.data.length)),this._stats.push(r,"blocksSent",t.size))}}},function(e,t,r){"use strict";const n=r(4),i=r(87),s=i.WantType,o=r(113),a=r(1050),c=r(1051),u=r(1053),{logger:f}=r(45);e.exports=class{constructor(e,t,r,n,i){this._log=f(e,"engine"),this.blockstore=t,this.network=r,this._stats=n,this._opts=this._processOpts(i),this.ledgerMap=new Map,this._running=!1,this._requestQueue=new c(u)}_processOpts(e){return{maxSizeReplaceHasWithBlock:1024,targetMessageSize:16384,...e}}_scheduleProcessTasks(){setTimeout(()=>{this._processTasks()})}async _processTasks(){if(!this._running)return;const{peerId:e,tasks:t,pendingSize:r}=this._requestQueue.popTasks(this._opts.targetMessageSize);if(0===t.length)return;const s=new i(!1);s.setPendingBytes(r);const o=[],a=new Map;for(const i of t){const e=new n(i.topic);i.data.haveBlock?i.data.isWantBlock?(o.push(e),a.set(i.topic,i.data)):s.addHave(e):s.addDontHave(e)}const c=await this._getBlocks(o);for(const[i,f]of a){const e=c.get(i);if(e)s.addBlock(e);else if(f.sendDontHave){const e=new n(i);s.addDontHave(e)}}if(s.empty)return this._requestQueue.tasksDone(e,t),void this._scheduleProcessTasks();try{await this.network.sendMessage(e,s);for(const t of c.values())this.messageSent(e,t)}catch(u){this._log.error(u)}this._requestQueue.tasksDone(e,t),this._scheduleProcessTasks()}wantlistForPeer(e){const t=e.toB58String();return this.ledgerMap.has(t)?this.ledgerMap.get(t).wantlist.sortedEntries():new Map}ledgerForPeer(e){const t=e.toB58String(),r=this.ledgerMap.get(t);return r?{peer:r.partner.toPrint(),value:r.debtRatio(),sent:r.accounting.bytesSent,recv:r.accounting.bytesRecv,exchanged:r.exchangeCount}:null}peers(){return Array.from(this.ledgerMap.values()).map(e=>e.partner)}receivedBlocks(e){e.length&&(this.ledgerMap.forEach(t=>{e.forEach(e=>{const r=t.wantlistContains(e.cid);if(!r)return;const n=e.data.length,s=this._sendAsBlock(r.wantType,n);let o=n;s||(o=i.blockPresenceSize(r.cid)),this._requestQueue.pushTasks(t.partner,[{topic:r.cid.toString(),priority:r.priority,size:o,data:{blockSize:n,isWantBlock:s,haveBlock:!0,sendDontHave:!1}}])})}),this._scheduleProcessTasks())}async messageReceived(e,t){const r=this._findOrCreate(e);if(t.empty)return;if(t.full&&(r.wantlist=new o),this._updateBlockAccounting(t.blocks,r),0===t.wantlist.size)return void this._scheduleProcessTasks();const n=[],i=[];t.wantlist.forEach(e=>{e.cancel?(r.cancelWant(e.cid),n.push(e.cid)):(r.wants(e.cid,e.priority,e.wantType),i.push(e))}),this._cancelWants(e,n),await this._addWants(e,i),this._scheduleProcessTasks()}_cancelWants(e,t){for(const r of t)this._requestQueue.remove(r.toString(),e)}async _addWants(e,t){const r=await this._getBlockSizes(t.map(e=>e.cid)),n=[];for(const o of t){const t=o.cid.toString(),a=r.get(t);if(null==a)o.sendDontHave&&n.push({topic:t,priority:o.priority,size:i.blockPresenceSize(o.cid),data:{isWantBlock:o.wantType===s.Block,blockSize:0,haveBlock:!1,sendDontHave:o.sendDontHave}});else{const e=this._sendAsBlock(o.wantType,a);let r=a;e||(r=i.blockPresenceSize(o.cid)),n.push({topic:t,priority:o.priority,size:r,data:{isWantBlock:e,blockSize:a,haveBlock:!0,sendDontHave:o.sendDontHave}})}this._requestQueue.pushTasks(e,n)}}_sendAsBlock(e,t){return e===s.Block||t<=this._opts.maxSizeReplaceHasWithBlock}async _getBlockSizes(e){const t=await this._getBlocks(e);return new Map([...t].map(([e,t])=>[e,t.data.length]))}async _getBlocks(e){const t=new Map;return await Promise.all(e.map(async e=>{try{const r=await this.blockstore.get(e);t.set(e.toString(),r)}catch(r){"ERR_NOT_FOUND"!==r.code&&this._log.error("failed to query blockstore for %s: %s",e,r)}})),t}_updateBlockAccounting(e,t){e.forEach(e=>{this._log("got block (%s bytes)",e.data.length),t.receivedBytes(e.data.length)})}messageSent(e,t){const r=this._findOrCreate(e);r.sentBytes(t?t.data.length:0),t&&t.cid&&r.wantlist.remove(t.cid)}numBytesSentTo(e){return this._findOrCreate(e).accounting.bytesSent}numBytesReceivedFrom(e){return this._findOrCreate(e).accounting.bytesRecv}peerDisconnected(e){}_findOrCreate(e){const t=e.toB58String();if(this.ledgerMap.has(t))return this.ledgerMap.get(t);const r=new a(e);return this.ledgerMap.set(t,r),this._stats&&this._stats.push(t,"peerCount",1),r}start(){this._running=!0}stop(){this._running=!1}}},function(e,t,r){"use strict";const n=r(113);e.exports=class{constructor(e){this.partner=e,this.wantlist=new n,this.exchangeCount=0,this.sentToPeer=new Map,this.accounting={bytesSent:0,bytesRecv:0}}sentBytes(e){this.exchangeCount++,this.lastExchange=(new Date).getTime(),this.accounting.bytesSent+=e}receivedBytes(e){this.exchangeCount++,this.lastExchange=(new Date).getTime(),this.accounting.bytesRecv+=e}wants(e,t,r){this.wantlist.add(e,t,r)}cancelWant(e){this.wantlist.remove(e)}wantlistContains(e){return this.wantlist.contains(e)}debtRatio(){return this.accounting.bytesSent/(this.accounting.bytesRecv+1)}}},function(e,t,r){"use strict";const n=r(1052),i={hasNewInfo:()=>!1,merge(){}};class s{constructor(e,t){this.peerId=e,this._taskMerger=t,this._activeTotalSize=0,this._pending=new o,this._active=new Set}pushTasks(e){for(const t of e)this._pushTask(t)}_pushTask(e){if(!this._taskHasMoreInfoThanActiveTasks(e))return;const t=this._pending.get(e.topic);if(t)return e.priority>t.priority&&this._pending.updatePriority(e.topic,e.priority),void this._taskMerger.merge(e,t);this._pending.add(e)}_taskHasMoreInfoThanActiveTasks(e){const t=[];for(const r of this._active)r.topic===e.topic&&t.push(r);return 0===t.length||this._taskMerger.hasNewInfo(e,t)}popTasks(e){let t=0;const r=[],n=this._pending.tasks();for(let i=0;i<n.length&&t<e;i++){const e=n[i];r.push(e),t+=e.size,this._pending.delete(e.topic),this._activeTotalSize+=e.size,this._active.add(e)}return{tasks:r,pendingSize:this._pending.totalSize}}taskDone(e){this._active.has(e)&&(this._activeTotalSize-=e.size,this._active.delete(e))}remove(e){this._pending.delete(e)}isIdle(){return 0===this._pending.length&&0===this._active.length}static compare(e,t){return 0===e[1]._pending.length?1:0===t[1]._pending.length?-1:e[1]._activeTotalSize===t[1]._activeTotalSize?t[1]._pending.length-e[1]._pending.length:e[1]._activeTotalSize-t[1]._activeTotalSize}}class o{constructor(){this._tasks=new n([],this._compare)}get length(){return this._tasks.size}get totalSize(){return[...this._tasks.values()].reduce((e,t)=>e+t.task.size,0)}get(e){return(this._tasks.get(e)||{}).task}add(e){this._tasks.set(e.topic,{created:Date.now(),task:e})}delete(e){this._tasks.delete(e)}tasks(){return[...this._tasks.values()].map(e=>e.task)}updatePriority(e,t){const r=this._tasks.get(e);if(!r)return;const n=this._tasks.indexOf(e);r.task.priority=t,this._tasks.update(n)}_compare(e,t){return e[1].task.priority===t[1].task.priority?e[1].created-t[1].created:t[1].task.priority-e[1].task.priority}}e.exports=class{constructor(e){this._taskMerger=e||i,this._byPeer=new n([],s.compare,!0)}pushTasks(e,t){let r=this._byPeer.get(e.toB58String());r||(r=new s(e,this._taskMerger)),r.pushTasks(t),this._byPeer.set(e.toB58String(),r)}popTasks(e){if(0===this._byPeer.size)return{tasks:[],pendingSize:0};const t=this._head(),{tasks:r,pendingSize:n}=t.popTasks(e);if(0===r.length)return{tasks:r,pendingSize:n};const i=t.peerId;return t.isIdle()?this._byPeer.delete(i.toB58String()):this._byPeer.update(0),{peerId:i,tasks:r,pendingSize:n}}_head(){for(const[,e]of this._byPeer)return e}remove(e,t){const r=this._byPeer.get(t.toB58String());r&&r.remove(e)}tasksDone(e,t){const r=this._byPeer.get(e.toB58String());if(!r)return;const n=this._byPeer.indexOf(e.toB58String());for(const i of t)r.taskDone(i);this._byPeer.update(n)}}},function(e,t,r){"use strict";class n extends Map{constructor(e,t){super(),this._cmp=t||this._defaultSort,this._keys=[];for(const[r,n]of e||[])this.set(r,n)}update(e){if(e<0||e>=this._keys.length)return;const t=this._keys[e];this._keys.splice(e,1);const r=this._find(t);this._keys.splice(r,0,t)}set(e,t){if(this.has(e)){const t=this.indexOf(e);this._keys.splice(t,1)}super.set(e,t);const r=this._find(e);this._keys.splice(r,0,e)}clear(){super.clear(),this._keys=[]}delete(e){if(!this.has(e))return;const t=this.indexOf(e);this._keys.splice(t,1),super.delete(e)}indexOf(e){if(!this.has(e))return-1;const t=this._find(e);if(this._keys[t]===e)return t;for(let r=1;r<this._keys.length;r++){if(this._keys[t+r]===e)return t+r;if(this._keys[t-r]===e)return t-r}return-1}_find(e){let t=0,r=this._keys.length;for(;t<r;){const n=t+r>>>1,i=this._kCmp(this._keys[n],e);if(i<0)t=n+1;else{if(!(i>0))return n;r=n}}return t}*keys(){for(const e of this._keys)yield e}*values(){for(const e of this._keys)yield this.get(e)}*entries(){for(const e of this._keys)yield[e,this.get(e)]}*[Symbol.iterator](){yield*this.entries()}forEach(e,t){if(e)for(const r of this._keys)e.apply(t,[[r,this.get(r)]])}_defaultSort(e,t){return e[0]<t[0]?-1:t[0]<e[0]?1:0}_kCmp(e,t){return this._cmp([e,this.get(e)],[t,this.get(t)])}}e.exports=n},function(e,t,r){"use strict";const n={hasNewInfo(e,t){let r=!1,n=!1;for(const i of t)i.data.haveBlock&&(r=!0),i.data.isWantBlock&&(n=!0);return!(n||!e.data.isWantBlock)||!(r||!e.data.haveBlock)},merge(e,t){const r=e.data,n=t.data;!n.haveBlock&&r.haveBlock&&(n.haveBlock=r.haveBlock,n.blockSize=r.blockSize),!n.isWantBlock&&r.isWantBlock&&(n.isWantBlock=!0,n.haveBlock&&!r.haveBlock||(n.haveBlock=r.haveBlock,t.size=e.size)),n.isWantBlock&&n.haveBlock&&(t.size=n.blockSize)}};e.exports=n},function(e,t,r){"use strict";const n=r(13).EventEmitter,i=r(76),s=r(114),o=r(45).logger,a=e=>e.multihash.toString("base64"),c=e=>"unwant:".concat(a(e)),u=e=>"block:".concat(a(e));e.exports=class extends n{constructor(e){super(),this.setMaxListeners(s.maxListeners),this._log=o(e,"notif")}hasBlock(e){const t=u(e.cid);this._log(t),this.emit(t,e)}wantBlock(e,t={}){if(!e)throw new Error("Not a valid cid");const r=u(e),n=c(e);return this._log("wantBlock:".concat(e)),new Promise((s,o)=>{const a=()=>{this.removeListener(r,c),o(new Error("Block for ".concat(e," unwanted")))},c=t=>{if(this.removeListener(n,a),!e.multihash.equals(t.cid.multihash))return o(new Error("Incorrect block received for ".concat(e)));e.version===t.cid.version&&e.codec===t.cid.codec||(t=new i(t.data,e)),s(t)};this.once(n,a),this.once(r,c),t&&t.signal&&t.signal.addEventListener("abort",()=>{this.removeListener(r,c),this.removeListener(n,a),o(new Error("Want for ".concat(e," aborted")))})})}unwantBlock(e){const t=c(e);this._log(t),this.emit(t)}}},function(e,t,r){"use strict";const n=r(13),i=r(1056),s={movingAverageIntervals:[6e4,3e5,9e5]};e.exports=class extends n{constructor(e,t){super();const r=Object.assign({},s,t);if("number"!=typeof r.computeThrottleTimeout)throw new Error("need computeThrottleTimeout");if("number"!=typeof r.computeThrottleMaxQueueSize)throw new Error("need computeThrottleMaxQueueSize");this._initialCounters=e,this._options=r,this._enabled=this._options.enabled,this._global=new i(e,r),this._global.on("update",e=>this.emit("update",e)),this._peers=new Map}enable(){this._enabled=!0,this._options.enabled=!0,this._global.enable()}disable(){this._enabled=!1,this._options.enabled=!1,this._global.disable()}stop(){this._enabled=!1,this._global.stop();for(const e of this._peers)e[1].stop()}get snapshot(){return this._global.snapshot}get movingAverages(){return this._global.movingAverages}forPeer(e){return e.toB58String&&(e=e.toB58String()),this._peers.get(e)}push(e,t,r){if(this._enabled&&(this._global.push(t,r),e)){let n=this._peers.get(e);n||(n=new i(this._initialCounters,this._options),this._peers.set(e,n)),n.push(t,r)}}disconnected(e){const t=e.toB58String(),r=this._peers.get(t);r&&(r.stop(),this._peers.delete(t))}}},function(e,t,r){"use strict";const n=r(13),i=r(37),s=r(316);e.exports=class extends n{constructor(e,t){super(),this._options=t,this._queue=[],this._stats={},this._frequencyLastTime=Date.now(),this._frequencyAccumulators={},this._movingAverages={},this._update=this._update.bind(this),e.forEach(e=>{this._stats[e]=i(0),this._movingAverages[e]={},this._options.movingAverageIntervals.forEach(t=>{(this._movingAverages[e][t]=s(t)).push(this._frequencyLastTime,0)})}),this._enabled=this._options.enabled}enable(){this._enabled=!0}disable(){this._disabled=!0}stop(){this._timeout&&clearTimeout(this._timeout)}get snapshot(){return Object.assign({},this._stats)}get movingAverages(){return Object.assign({},this._movingAverages)}push(e,t){this._enabled&&(this._queue.push([e,t,Date.now()]),this._resetComputeTimeout())}_resetComputeTimeout(){this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout(this._update,this._nextTimeout())}_nextTimeout(){const e=this._queue.length/this._options.computeThrottleMaxQueueSize;return Math.max(this._options.computeThrottleTimeout*(1-e),0)}_update(){if(this._timeout=null,this._queue.length){let e;for(;this._queue.length;){const t=e=this._queue.shift();this._applyOp(t)}this._updateFrequency(e[2]),this.emit("update",this._stats)}}_updateFrequency(e){const t=e-this._frequencyLastTime;Object.keys(this._stats).forEach(r=>{this._updateFrequencyFor(r,t,e)}),this._frequencyLastTime=e}_updateFrequencyFor(e,t,r){const n=this._frequencyAccumulators[e]||0;this._frequencyAccumulators[e]=0;const i=n/t*1e3;let o=this._movingAverages[e];o||(o=this._movingAverages[e]={}),this._options.movingAverageIntervals.forEach(e=>{let t=o[e];t||(t=o[e]=s(e)),t.push(r,i)})}_applyOp(e){const t=e[0],r=e[1];if("number"!=typeof r)throw new Error("invalid increment number:",r);let n;n=Object.prototype.hasOwnProperty.call(this._stats,t)?this._stats[t]:this._stats[t]=i(0),this._stats[t]=n.plus(r),this._frequencyAccumulators[t]||(this._frequencyAccumulators[t]=0),this._frequencyAccumulators[t]+=r}}},function(e,t,r){"use strict";const{TieredDatastore:n}=r(153),i=r(165),s=r(357),o=r(300);e.exports=({libp2p:e,repo:t,peerId:r,options:a})=>{const c=[];let u;if(i(a,"EXPERIMENTAL.ipnsPubsub",!1)){const n=e.pubsub,i=t.datastore;u=new s(n,i,r),c.push(u)}if(i(a,"offline")||!i(a,"libp2p.config.dht.enabled",!1)){const e=new o(t);c.push(e)}else c.push(e._dht);return new n(c)}},function(e,t,r){"use strict";const n=r(2),{cidToString:i}=r(142),s=n("ipfs:mfs-preload");s.error=n("ipfs:mfs-preload:error"),e.exports=({preload:e,files:t,options:r})=>{if((r=r||{}).interval=r.interval||3e4,!r.enabled){s("MFS preload disabled");const e=async()=>{};return{start:e,stop:e}}let n,o;const a=async()=>{try{const c=await t.stat("/"),u=i(c.cid,{base:"base32"});n!==u&&(s("preloading updated MFS root ".concat(n," -> ").concat(c.cid)),await e(c.cid),n=u)}catch(c){s.error("failed to preload MFS root",c)}finally{o=setTimeout(a,r.interval)}};return{async start(){const e=await t.stat("/");n=i(e.cid,{base:"base32"}),s("monitoring MFS root ".concat(e.cid)),o=setTimeout(a,r.interval)},stop(){clearTimeout(o)}}}},function(e,t,r){"use strict";const n=r(37),i=r(136).default,s=r(1),{withTimeoutOption:o}=r(3);function a(e,t){let r;if(r=t.peer?e.metrics.forPeer(t.peer):t.proto?e.metrics.forProtocol(t.proto):e.metrics.global,!r)return{totalIn:new n(0),totalOut:new n(0),rateIn:new n(0),rateOut:new n(0)};const{movingAverages:i,snapshot:s}=r;return{totalIn:s.dataReceived,totalOut:s.dataSent,rateIn:new n(i.dataReceived[6e4].movingAverage()/60),rateOut:new n(i.dataSent[6e4].movingAverage()/60)}}e.exports=({libp2p:e})=>o((async function*(t){if(!(t=t||{}).poll)return void(yield a(e,t));let r,n=t.interval||1e3;try{if(n="string"==typeof n?i(n):n,!n||n<0)throw new Error("invalid poll interval")}catch(o){throw s(o,"ERR_INVALID_POLL_INTERVAL")}try{for(;;)yield a(e,t),await new Promise(e=>{r=setTimeout(e,n)})}finally{clearTimeout(r)}}))},function(e,t,r){"use strict";const n=r(83),{NotStartedError:i,AlreadyInitializedError:s}=r(75),o=r(97),{withTimeoutOption:a}=r(3);e.exports=({apiManager:e,options:t,bitswap:r,blockService:c,gcLock:u,initOptions:f,ipld:h,ipns:l,keychain:d,libp2p:p,mfsPreload:b,peerId:y,pinManager:m,preload:g,print:v,repo:w})=>a((async function(){const a=n(),{cancel:_}=e.update({stop:()=>a.promise});try{c.unsetExchange(),r.stop(),g.stop(),await Promise.all([l.republisher.stop(),b.stop(),p.stop(),w.close()]);const n=function({apiManager:e,constructorOptions:t,blockService:r,gcLock:n,initOptions:a,ipld:c,keychain:u,peerId:f,pinManager:h,preload:l,print:d,repo:p}){const b={get:o.dag.get({ipld:c,preload:l}),resolve:o.dag.resolve({ipld:c,preload:l}),tree:o.dag.tree({ipld:c,preload:l})},y={data:o.object.data({ipld:c,preload:l}),get:o.object.get({ipld:c,preload:l}),links:o.object.links({dag:b}),new:o.object.new({ipld:c,preload:l}),patch:{addLink:o.object.patch.addLink({ipld:c,gcLock:n,preload:l}),appendData:o.object.patch.appendData({ipld:c,gcLock:n,preload:l}),rmLink:o.object.patch.rmLink({ipld:c,gcLock:n,preload:l}),setData:o.object.patch.setData({ipld:c,gcLock:n,preload:l})},put:o.object.put({ipld:c,gcLock:n,preload:l}),stat:o.object.stat({ipld:c,preload:l})},m={add:o.pin.add({pinManager:h,gcLock:n,dag:b}),ls:o.pin.ls({pinManager:h,dag:b}),rm:o.pin.rm({pinManager:h,gcLock:n,dag:b})};b.put=o.dag.put({ipld:c,pin:m,gcLock:n,preload:l});const g={get:o.block.get({blockService:r,preload:l}),put:o.block.put({blockService:r,pin:m,gcLock:n,preload:l}),rm:o.block.rm({blockService:r,gcLock:n,pinManager:h}),stat:o.block.stat({blockService:r,preload:l})},v=o.addAll({block:g,preload:l,pin:m,gcLock:n,options:t}),w=o.resolve({ipld:c}),_=o.refs({ipld:c,resolve:w,preload:l});_.local=o.refs.local({repo:p});const E=async()=>{throw new i};return{add:o.add({addAll:v}),addAll:v,bitswap:{stat:E,unwant:E,wantlist:E,wantlistForPeer:E},block:g,bootstrap:{add:o.bootstrap.add({repo:p}),clear:o.bootstrap.clear({repo:p}),list:o.bootstrap.list({repo:p}),reset:o.bootstrap.reset({repo:p}),rm:o.bootstrap.rm({repo:p})},cat:o.cat({ipld:c,preload:l}),config:o.config({repo:p}),dag:b,dns:o.dns(),files:o.files({ipld:c,block:g,blockService:r,repo:p,preload:l,options:t}),get:o.get({ipld:c,preload:l}),id:o.id({peerId:f}),init:async()=>{throw new s},isOnline:o.isOnline({}),key:{export:o.key.export({keychain:u}),gen:o.key.gen({keychain:u}),import:o.key.import({keychain:u}),info:o.key.info({keychain:u}),list:o.key.list({keychain:u}),rename:o.key.rename({keychain:u}),rm:o.key.rm({keychain:u})},ls:o.ls({ipld:c,preload:l}),object:y,pin:m,refs:_,repo:{gc:o.repo.gc({gcLock:n,pin:m,pinManager:h,refs:_,repo:p}),stat:o.repo.stat({repo:p}),version:o.repo.version({repo:p})},resolve:w,start:o.start({apiManager:e,options:t,blockService:r,gcLock:n,initOptions:a,ipld:c,keychain:u,peerId:f,pinManager:h,preload:l,print:d,repo:p}),stats:{bitswap:E,bw:E,repo:o.repo.stat({repo:p})},stop:()=>{},swarm:{addrs:E,connect:E,disconnect:E,localAddrs:o.swarm.localAddrs({multiaddrs:[]}),peers:E},version:o.version({repo:p})}}({apiManager:e,constructorOptions:t,blockService:c,gcLock:u,initOptions:f,ipld:h,keychain:d,peerId:y,pinManager:m,preload:g,print:v,repo:w});e.update(n,()=>{throw new i})}catch(E){throw _(),a.reject(E),E}a.resolve()}))},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=({libp2p:e})=>n((async function(t){const r=[];for(const[n,i]of e.peerStore.peers.entries(t))r.push({id:n,addrs:i.addresses.map(e=>e.multiaddr)});return r}))},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=({libp2p:e})=>n((function(t,r){return e.dial(t,r)}))},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=({libp2p:e})=>n((function(t,r){return e.hangUp(t,r)}))},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=({multiaddrs:e})=>n((async function(){return e}))},function(e,t,r){"use strict";const{withTimeoutOption:n}=r(3);e.exports=({libp2p:e})=>n((async function(t){const r=(t=t||{}).v||t.verbose,n=[];for(const[i,s]of e.connections)for(const e of s){const s={addr:e.remoteAddr,peer:i};(r||t.direction)&&(s.direction=e.stat.direction),r&&(s.muxer=e.stat.multiplexer,s.latency="n/a"),n.push(s)}return n}))},function(e,t,r){"use strict";const n=r(261),{withTimeoutOption:i}=r(3);e.exports=({repo:e})=>i((async function(t){const r=await e.version.get(t);return{version:n.version,repo:r,commit:n.gitHead||"","interface-ipfs-core":n.devDependencies["interface-ipfs-core"],"ipfs-http-client":n.dependencies["ipfs-http-client"]}}))},function(e,t,r){"use strict";e.exports=class{constructor(){this._api={},this._onUndef=()=>{},this.api=new Proxy(this._api,{get:(e,t)=>{if("then"!==t)return void 0===this._api[t]?this._onUndef(t):this._api[t]}})}update(e,t){const r={...this._api},n=this._onUndef;return Object.keys(this._api).forEach(e=>{delete this._api[e]}),Object.assign(this._api,e),t&&(this._onUndef=t),{cancel:()=>this.update(r,n),api:this.api}}}}])}));
\No newline at end of file