From 803c15d2882798bcbc685589219d5e1658545558 Mon Sep 17 00:00:00 2001 From: Mitra Ardron Date: Mon, 1 Jul 2019 20:31:59 +1000 Subject: [PATCH] * 0.1.57: Fix heartbeat timer stopping --- README.md | 1 + dist/dweb-transports-bundle.js | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 697030f..6407d5f 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,7 @@ See [Dweb document index](./DOCUMENTINDEX.md) for a list of the repos that make ### Release Notes +* 0.1.57: Fix heartbeat timer stopping * 0.1.56: tweak http queue; changes to stop, status, info to support heartbeat on HTTP * 0.1.55: tweaking queue concurrency * 0.1.54: queue for http; disable fallback from IPFS to http://ipfs.io diff --git a/dist/dweb-transports-bundle.js b/dist/dweb-transports-bundle.js index 5422fe5..ecaf958 100644 --- a/dist/dweb-transports-bundle.js +++ b/dist/dweb-transports-bundle.js @@ -43,7 +43,7 @@ var r=function(e,t){return function(){var n=Array.prototype.slice.call(arguments * * @author Feross Aboukhadijeh * @license MIT - */function i(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i=0;f--)if(a[f]!==l[f])return!1;for(f=a.length-1;f>=0;f--)if(c=a[f],!w(e[c],t[c],n,r))return!1;return!0}function S(e,t,n){w(e,t,!0)&&b(e,t,n,"notDeepStrictEqual",S)}function E(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function x(e){var t;try{e()}catch(e){t=e}return t}function C(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=x(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&b(i,n,"Missing expected exception"+r);var o="string"==typeof r,a=!e&&s.isError(i),u=!e&&i&&!n;if((a&&o&&E(i,n)||u)&&b(i,n,"Got unwanted exception"+r),e&&i&&n&&!E(i,n)||!e&&i)throw i}function A(e,t){e||b(e,!0,t,"==",A)}h.AssertionError=function e(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=y(this),this.generatedMessage=!0);var n=t.stackStartFunction||b;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var i=r.stack,o=d(n),s=i.indexOf("\n"+o);if(s>=0){var a=i.indexOf("\n",s+1);i=i.substring(a+1)}this.stack=i}}},s.inherits(h.AssertionError,Error),h.fail=b,h.ok=v,h.equal=function e(t,n,r){t!=n&&b(t,n,r,"==",h.equal)},h.notEqual=function e(t,n,r){t==n&&b(t,n,r,"!=",h.notEqual)},h.deepEqual=function e(t,n,r){w(t,n,!1)||b(t,n,r,"deepEqual",h.deepEqual)},h.deepStrictEqual=function e(t,n,r){w(t,n,!0)||b(t,n,r,"deepStrictEqual",h.deepStrictEqual)},h.notDeepEqual=function e(t,n,r){w(t,n,!1)&&b(t,n,r,"notDeepEqual",h.notDeepEqual)},h.notDeepStrictEqual=S,h.strictEqual=function e(t,n,r){t!==n&&b(t,n,r,"===",h.strictEqual)},h.notStrictEqual=function e(t,n,r){t===n&&b(t,n,r,"!==",h.notStrictEqual)},h.throws=function(e,t,n){C(!0,e,t,n)},h.doesNotThrow=function(e,t,n){C(!1,e,t,n)},h.ifError=function(e){if(e)throw e},h.strict=r(A,h,{equal:h.strictEqual,deepEqual:h.deepStrictEqual,notEqual:h.notStrictEqual,notDeepEqual:h.notDeepStrictEqual}),h.strict.strict=h.strict;var I=Object.keys||function(e){var t=[];for(var n in e)a.call(e,n)&&t.push(n);return t}}).call(this,n(8))},function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,n){t=e.exports=n(396),t.Stream=t,t.Readable=t,t.Writable=n(400),t.Duplex=n(136),t.Transform=n(401),t.PassThrough=n(771),t.finished=n(294),t.pipeline=n(772)},function(e,t,n){"use strict";const r=n(633),i=n(634),o=n(24);e.exports=(e=>{const t=r();if("function"==typeof e)return e;if("object"==typeof e)return i(e);if("string"==typeof e){const n=o(e).nodeAddress();return t.host=n.address,t.port=n.port,i(t)}throw new Error("Argument must be a send function or a config object.")})},function(e,t,n){"use strict";function r(e,t,n){var r=e instanceof Error?e:new Error(e),i;if("object"==typeof t?n=t:null!=t&&(r.code=t),n)for(i in n)r[i]=n[i];return r}e.exports=r},function(e,t,n){"use strict";(function(r){const i=n(35),o=n(456),s=n(18),a=n(11),u=n(53);class l{constructor(e,t,n){s(r.isBuffer(e),"invalid id provided"),t&&n&&s(t.public.bytes.equals(n.bytes),"inconsistent arguments"),this._id=e,this._idB58String=i.toB58String(this.id),this._privKey=t,this._pubKey=n}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){return this._pubKey?this._pubKey:this._privKey?this._privKey.public:void 0}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return o.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.marshalPrivateKey(this.privKey)}toPrint(){let e=this.toB58String();e.startsWith("Qm")&&(e=e.slice(2));let t=6;return e.length"}toJSON(){return{id:this.toB58String(),privKey:f(this.marshalPrivKey()),pubKey:f(this.marshalPubKey())}}toHexString(){return i.toHexString(this.id)}toBytes(){return this.id}toB58String(){return this._idB58String}isEqual(e){if(r.isBuffer(e))return this.id.equals(e);if(e.id)return this.id.equals(e.id);throw new Error("not valid Id")}isValid(e){this.privKey&&this.privKey.public&&this.privKey.public.bytes&&r.isBuffer(this.pubKey.bytes)&&this.privKey.public.bytes.equals(this.pubKey.bytes)?e():e(new Error("Keys not match"))}}const c=u(l,{className:"PeerId",symbolName:"@libp2p/js-peer-id/PeerId"});function f(e){if(e)return e.toString("base64")}t=e.exports=c,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.generateKeyPair("RSA",e.bits,t),(e,t)=>e.public.hash((n,r)=>{t(n,r,e)})],(e,n,r)=>{if(e)return t(e);t(null,new c(n,r))})},t.createFromHexString=function(e){return new c(i.fromHexString(e))},t.createFromBytes=function(e){return new c(e)},t.createFromB58String=function(e){return new c(i.fromB58String(e))},t.createFromPubKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let n;try{let i=e;if("string"==typeof i&&(i=r.from(e,"base64")),!r.isBuffer(i))throw new Error("Supplied key is neither a base64 string nor a buffer");n=o.unmarshalPublicKey(i)}catch(e){return t(e)}n.hash((e,r)=>{if(e)return t(e);t(null,new c(r,null,n))})},t.createFromPrivKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let n=e;try{if("string"==typeof n&&(n=r.from(e,"base64")),!r.isBuffer(n))throw new Error("Supplied key is neither a base64 string nor a buffer")}catch(e){return t(e)}a([e=>o.unmarshalPrivateKey(n,e),(e,t)=>e.public.hash((n,r)=>{t(n,r,e)})],(e,n,r)=>{if(e)return t(e);t(null,new c(n,r,r.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let n,s,u,l;try{n=i.fromB58String(e.id),s=e.privKey&&r.from(e.privKey,"base64"),u=e.pubKey&&r.from(e.pubKey,"base64"),l=u&&o.unmarshalPublicKey(u)}catch(e){return t(e)}s?a([e=>o.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((n,r)=>{t(n,r,e)}),(e,t,n)=>{l?l.hash((r,i)=>{n(r,e,t,i)}):n(null,e,t)}],(e,r,i,o)=>e?t(e):l&&!r.equals(o)?t(new Error("Public and private key do not match")):n&&!r.equals(n)?t(new Error("Id and private key do not match")):void t(null,new c(n,i,l))):t(null,new c(n,null,l))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(937),o=n(320),s=n(39),a=n(76),u=n(53),l=u.proto(function(e){if(!(this instanceof l))return new l(e);if(null==e&&(e=""),e instanceof r)this.buffer=i.fromBuffer(e);else if("string"==typeof e||e instanceof String){if(e.length>0&&"/"!==e.charAt(0))throw new Error(`multiaddr "${e}" must start with a "/"`);this.buffer=i.fromString(e)}else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=i.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});l.prototype.toString=function e(){return i.bufferToString(this.buffer)},l.prototype.toJSON=l.prototype.toString,l.prototype.toOptions=function e(){const t={},n=this.toString().split("/");return t.family="ip4"===n[1]?"ipv4":"ipv6",t.host=n[2],t.transport=n[3],t.port=n[4],t},l.prototype.inspect=function e(){return""},l.prototype.protos=function e(){return this.protoCodes().map(e=>Object.assign({},o(e)))},l.prototype.protoCodes=function e(){const t=[],n=this.buffer;let r=0;for(;re.name)},l.prototype.tuples=function e(){return i.bufferToTuples(this.buffer)},l.prototype.stringTuples=function e(){const t=i.bufferToTuples(this.buffer);return i.tuplesToStringTuples(t)},l.prototype.encapsulate=function e(t){return t=l(t),l(this.toString()+t.toString())},l.prototype.decapsulate=function e(t){t=t.toString();const n=this.toString(),r=n.lastIndexOf(t);if(r<0)throw new Error("Address "+this+" does not contain subaddress: "+t);return l(n.slice(0,r))},l.prototype.getPeerId=function e(){let t=null;try{t=this.stringTuples().filter(e=>{if(e[0]===o.names.ipfs.code)return!0})[0][1],a.decode(t)}catch(e){t=null}return t},l.prototype.getPath=function e(){let t=null;try{t=this.stringTuples().filter(e=>{const t=o(e[0]);if(t.path)return!0})[0][1]}catch(e){t=null}return t},l.prototype.equals=function e(t){return this.buffer.equals(t.buffer)},l.prototype.nodeAddress=function e(){const t=this.protoCodes(),n=this.protoNames(),r=this.toString().split("/").slice(1);if(r.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==t[0]&&41!==t[0]&&54!==t[0]&&55!==t[0])throw new Error(`no protocol with name: "'${n[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if("tcp"!==r[2]&&"udp"!==r[2])throw new Error(`no protocol with name: "'${n[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:41===t[0]||55===t[0]?6:4,address:r[1],port:r[3]}},l.fromNodeAddress=function e(t,n){if(!t)throw new Error("requires node address object");if(!n)throw new Error("requires transport protocol");const r="IPv6"===t.family?"ip6":"ip4";return l("/"+[r,t.address,n,t.port].join("/"))},l.prototype.isThinWaistAddress=function e(t){const n=(t||this).protos();return 2===n.length&&((4===n[0].code||41===n[0].code)&&(6===n[1].code||273===n[1].code))},l.protocols=o,l.isName=function e(t){return!!l.isMultiaddr(t)&&t.protos().some(e=>e.resolvable)},l.resolve=function e(t,n){return l.isMultiaddr(t)&&l.isName(t)?n(new Error("not implemented yet")):n(new Error("not a valid name"))},t=e.exports=l}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(84),i=n(17);e.exports={checkState:function(e,t){if(!e)throw new r.InvalidState(t)},checkArgument:function(e,t,n,i){if(!e)throw new r.InvalidArgument(t,n,i)},checkArgumentType:function(e,t,o){if(o=o||"(unknown name)",i.isString(t)){if("Buffer"===t){var s=n(30);if(!s.isBuffer(e))throw new r.InvalidArgumentType(e,t,o)}else if(typeof e!==t)throw new r.InvalidArgumentType(e,t,o)}else if(!(e instanceof t))throw new r.InvalidArgumentType(e,t.name,o)}}},function(e,t,n){"use strict";var r=n(792),i=n(796),o=n(800);for(var s in t=e.exports=n(12),t.pull=t,r)t[s]=r[s];for(var s in o)t[s]=o[s];for(var s in i)t[s]=i[s]},function(e,t,n){(function(t,r){var i=n(18),o=n(57).Stream,s=n(13),a=/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;function u(e){return e.charAt(0).toUpperCase()+e.slice(1)}function l(e,t,n,r,o){throw new i.AssertionError({message:s.format("%s (%s) is required",e,t),actual:void 0===o?typeof r:o(r),expected:t,operator:n||"===",stackStartFunction:l.caller})}function c(e){return Object.prototype.toString.call(e).slice(8,-1)}function f(){}var h={bool:{check:function(e){return"boolean"==typeof e}},func:{check:function(e){return"function"==typeof e}},string:{check:function(e){return"string"==typeof e}},object:{check:function(e){return"object"==typeof e&&null!==e}},number:{check:function(e){return"number"==typeof e&&!isNaN(e)}},finite:{check:function(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}},buffer:{check:function(e){return t.isBuffer(e)},operator:"Buffer.isBuffer"},array:{check:function(e){return Array.isArray(e)},operator:"Array.isArray"},stream:{check:function(e){return e instanceof o},operator:"instanceof",actual:c},date:{check:function(e){return e instanceof Date},operator:"instanceof",actual:c},regexp:{check:function(e){return e instanceof RegExp},operator:"instanceof",actual:c},uuid:{check:function(e){return"string"==typeof e&&a.test(e)},operator:"isUUID"}};function p(e){var t=Object.keys(h),n;return n=r.env.NODE_NDEBUG?f:function(e,t){e||l(t,"true",e)},t.forEach(function(t){if(e)n[t]=f;else{var r=h[t];n[t]=function(e,n){r.check(e)||l(n,t,r.operator,e,r.actual)}}}),t.forEach(function(t){var r="optional"+u(t);if(e)n[r]=f;else{var i=h[t];n[r]=function(e,n){void 0!==e&&null!==e&&(i.check(e)||l(n,t,i.operator,e,i.actual))}}}),t.forEach(function(t){var r="arrayOf"+u(t);if(e)n[r]=f;else{var i=h[t],o="["+t+"]";n[r]=function(e,t){var n;for(Array.isArray(e)||l(t,o,i.operator,e,i.actual),n=0;n=c.OP_1&&e<=c.OP_16||e===c.OP_1NEGATE)}function d(e){return u.Buffer(e)||p(e)}function m(e){return u.Array(e)&&e.every(d)}function g(e){return 0===e.length?c.OP_0:1===e.length?e[0]>=1&&e[0]<=16?h+e[0]:129===e[0]?c.OP_1NEGATE:void 0:void 0}function y(e){if(r.isBuffer(e))return e;a(u.Array,e);const t=e.reduce(function(e,t){return r.isBuffer(t)?1===t.length&&void 0!==g(t)?e+1:e+s.encodingLength(t.length)+t.length:e+1},0),n=r.allocUnsafe(t);let i=0;if(e.forEach(function(e){if(r.isBuffer(e)){const t=g(e);if(void 0!==t)return n.writeUInt8(t,i),void(i+=1);i+=s.encode(n,e.length,i),e.copy(n,i),i+=e.length}else n.writeUInt8(e,i),i+=1}),i!==n.length)throw new Error("Could not decode chunks");return n}function b(e){if(u.Array(e))return e;a(u.Buffer,e);const t=[];let n=0;for(;nc.OP_0&&r<=c.OP_PUSHDATA4){const r=s.decode(e,n);if(null===r)return null;if(n+=r.size,n+r.number>e.length)return null;const i=e.slice(n,n+r.number);n+=r.number;const o=g(i);void 0!==o?t.push(o):t.push(i)}else t.push(r),n+=1}return t}function v(e){return r.isBuffer(e)&&(e=b(e)),e.map(function(e){if(r.isBuffer(e)){const t=g(e);if(void 0===t)return e.toString("hex");e=t}return f[e]}).join(" ")}function w(e){return a(u.String,e),y(e.split(" ").map(function(e){return void 0!==c[e]?c[e]:(a(u.Hex,e),r.from(e,"hex"))}))}function _(e){return e=b(e),a(m,e),e.map(function(e){return r.isBuffer(e)?e:e===c.OP_0?r.allocUnsafe(0):l.encode(e-h)})}function k(e){return o.isPoint(e)}function S(e){const t=-129&e;return t>0&&t<4}function E(e){return!!r.isBuffer(e)&&(!!S(e[e.length-1])&&i.check(e.slice(0,-1)))}e.exports={compile:y,decompile:b,fromASM:w,toASM:v,toStack:_,number:n(579),signature:n(1355),isCanonicalPubKey:k,isCanonicalScriptSignature:E,isPushOnly:m,isDefinedHashType:S}},function(e,t,n){"use strict";(function(t){var r=n(0),i=n(18),o=n(41),s=n(25);function a(e,t){if(e.length!==t.length)return!1;for(var n=e.length,r=0;r>24&255),r.push(n>>16&255),r.push(n>>8&255),r.push(255&n),new t(r)},integerFromBuffer:function e(t){return s.checkArgumentType(t,"Buffer","buffer"),t[0]<<24|t[1]<<16|t[2]<<8|t[3]},integerFromSingleByteBuffer:function e(t){return s.checkArgumentType(t,"Buffer","buffer"),t[0]},bufferToHex:function e(t){return s.checkArgumentType(t,"Buffer","buffer"),t.toString("hex")},reverse:function e(t){for(var n=new r.Buffer(t.length),i=0;i=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=i(e);return t&&0!==t.length?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r}),!o.kStringMaxLength)try{o.kStringMaxLength=t.binding("buffer").kStringMaxLength}catch(e){}o.constants||(o.constants={MAX_LENGTH:o.kMaxLength},o.kStringMaxLength&&(o.constants.MAX_STRING_LENGTH=o.kStringMaxLength)),e.exports=o}).call(this,n(2))},function(e,t,n){"use strict";var r=n(214),i=n(738);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=_,t.resolve=S,t.resolveObject=E,t.format=k,t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,l=["<",">",'"',"`"," ","\r","\n","\t"],c=["{","}","|","\\","^","`"].concat(l),f=["'"].concat(c),h=["%","/","?",";","#"].concat(f),p=["/","?","#"],d=255,m=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},b={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},w=n(169);function _(e,t,n){if(e&&i.isObject(e)&&e instanceof o)return e;var r=new o;return r.parse(e,t,n),r}function k(e){return i.isString(e)&&(e=_(e)),e instanceof o?e.format():o.prototype.format.call(e)}function S(e,t){return _(e,!1,!0).resolve(t)}function E(e,t){return e?_(e,!1,!0).resolveObject(t):t}o.prototype.parse=function(e,t,n){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o127?R+="x":R+=B[N];if(!R.match(m)){var L=O.slice(0,C),F=O.slice(C+1),D=B.match(g);D&&(L.push(D[1]),F.unshift(D[2])),F.length&&(d="/"+F.join(".")+d),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),j||(this.hostname=r.toASCII(this.hostname));var U=this.port?":"+this.port:"",z=this.hostname||"";this.host=z+U,this.href+=this.host,j&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==d[0]&&(d="/"+d))}if(!y[S])for(var C=0,P=f.length;C0)&&n.host.split("@");x&&(n.auth=x.shift(),n.host=n.hostname=x.shift())}return n.search=e.search,n.query=e.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!S.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var C=S.slice(-1)[0],A=(n.host||e.host||S.length>1)&&("."===C||".."===C)||""===C,I=0,T=S.length;T>=0;T--)C=S[T],"."===C?S.splice(T,1):".."===C?(S.splice(T,1),I++):I&&(S.splice(T,1),I--);if(!_&&!k)for(;I--;I)S.unshift("..");!_||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),A&&"/"!==S.join("/").substr(-1)&&S.push("");var j=""===S[0]||S[0]&&"/"===S[0].charAt(0);if(E){n.hostname=n.host=j?"":S.length?S.shift():"";var x=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");x&&(n.auth=x.shift(),n.host=n.hostname=x.shift())}return _=_||n.host&&S.length,_&&!j&&S.unshift(""),S.length?n.pathname=S.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){"use strict";const r=n(412),i=n(810),o=n(298),s=n(415);t.Key=r,t.MemoryDatastore=i,t.utils=o,t.Errors=s},function(e,t,n){(function(t,r){var i=n(19),o=n(891),s=e.exports=i.util=i.util||{};function a(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function u(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(s.isArrayBuffer(e)||s.isArrayBufferView(e))if(void 0!==r&&e instanceof r)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var n=0;n15?(i=Date.now(),u(e)):(n.push(e),1===n.length&&a.setAttribute("a",o=!o))}}s.nextTick=s.setImmediate}(),s.isNodejs=void 0!==t&&t.versions&&t.versions.node,s.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},s.isArrayBufferView=function(e){return e&&s.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},s.ByteBuffer=u,s.ByteStringBuffer=u;var l=4096;function c(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var n=s.isArrayBuffer(e),r=s.isArrayBufferView(e);if(n||r)return this.data=n?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==e&&void 0!==e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}s.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},s.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},s.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},s.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},s.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var n=this.data;t>0;)1&t&&(n+=e),t>>>=1,t>0&&(e+=e);return this.data=n,this._optimizeConstructedString(t),this},s.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},s.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(s.encodeUtf8(e))},s.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},s.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},s.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},s.ByteStringBuffer.prototype.putInt=function(e,t){a(t);var n="";do{t-=8,n+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(n)},s.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},s.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<=n&&(t-=n<<1),t},s.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},s.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},s.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},s.ByteStringBuffer.prototype.copy=function(){var e=s.createBuffer(this.data);return e.read=this.read,e},s.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},s.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},s.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},s.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var n=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),r=new Uint8Array(this.length()+t);return r.set(n),this.data=new DataView(r.buffer),this},s.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},s.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var n=0;n>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},s.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},s.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},s.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},s.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},s.DataBuffer.prototype.putInt=function(e,t){a(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},s.DataBuffer.prototype.putSignedInt=function(e,t){return a(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},s.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<=n&&(t-=n<<1),t},s.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},s.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},s.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},s.DataBuffer.prototype.copy=function(){return new s.DataBuffer(this)},s.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},s.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},s.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},s.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(n+=e),t>>>=1,t>0&&(e+=e);return n},s.xorBytes=function(e,t,n){for(var r="",i="",o="",s=0,a=0;n>0;--n,++s)i=e.charCodeAt(s)^t.charCodeAt(s),a>=10&&(r+=o,o="",a=0),o+=String.fromCharCode(i),++a;return r+=o,r},s.hexToBytes=function(e){var t="",n=0;for(!0&e.length&&(n=1,t+=String.fromCharCode(parseInt(e[0],16)));n>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";s.encode64=function(e,t){for(var n="",r="",i,o,s,a=0;a>2),n+=f.charAt((3&i)<<4|o>>4),isNaN(o)?n+="==":(n+=f.charAt((15&o)<<2|s>>6),n+=isNaN(s)?"=":f.charAt(63&s)),t&&n.length>t&&(r+=n.substr(0,t)+"\r\n",n=n.substr(t));return r+=n,r},s.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",n,r,i,o,s=0;s>4),64!==i&&(t+=String.fromCharCode((15&r)<<4|i>>2),64!==o&&(t+=String.fromCharCode((3&i)<<6|o)));return t},s.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},s.decodeUtf8=function(e){return decodeURIComponent(escape(e))},s.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:o.encode,decode:o.decode}},s.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},s.binary.raw.decode=function(e,t,n){var r=t;r||(r=new Uint8Array(e.length)),n=n||0;for(var i=n,o=0;o>2),n+=f.charAt((3&i)<<4|o>>4),isNaN(o)?n+="==":(n+=f.charAt((15&o)<<2|s>>6),n+=isNaN(s)?"=":f.charAt(63&s)),t&&n.length>t&&(r+=n.substr(0,t)+"\r\n",n=n.substr(t));return r+=n,r},s.binary.base64.decode=function(e,t,n){var r=t,i,o,s,a;r||(r=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),n=n||0;for(var u=0,l=n;u>4,64!==s&&(r[l++]=(15&o)<<4|s>>2,64!==a&&(r[l++]=(3&s)<<6|a));return t?l-n:r.subarray(0,l)},s.binary.base58.encode=function(e,t){return s.binary.baseN.encode(e,p,t)},s.binary.base58.decode=function(e,t){return s.binary.baseN.decode(e,p,t)},s.text={utf8:{},utf16:{}},s.text.utf8.encode=function(e,t,n){e=s.encodeUtf8(e);var r=t;r||(r=new Uint8Array(e.length)),n=n||0;for(var i=n,o=0;o0?(o=n[r].substring(0,i),s=n[r].substring(i+1)):(o=n[r],s=null),o in t||(t[o]=[]),o in Object.prototype||null===s||t[o].push(unescape(s))}return t},n;return void 0===e?(null===_&&(_="undefined"!=typeof window&&window.location&&window.location.search?t(window.location.search.substring(1)):{}),n=_):n=t(e),n},s.parseFragment=function(e){var t=e,n="",r=e.indexOf("?");r>0&&(t=e.substring(0,r),n=e.substring(r+1));var i=t.split("/");i.length>0&&""===i[0]&&i.shift();var o=""===n?{}:s.getQueryVariables(n);return{pathString:t,queryString:n,path:i,query:o}},s.makeRequest=function(e){var t=s.parseFragment(e),n={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,n){var r;return void 0===e?r=t.query:(r=t.query[e],r&&void 0!==n&&(r=r[n])),r},getQueryLast:function(e,t){var r,i=n.getQuery(e);return r=i?i[i.length-1]:t,r}};return n},s.makeLink=function(e,t,n){e=jQuery.isArray(e)?e.join("/"):e;var r=jQuery.param(t||{});return n=n||"",e+(r.length>0?"?"+r:"")+(n.length>0?"#"+n:"")},s.setPath=function(e,t,n){if("object"==typeof e&&null!==e)for(var r=0,i=t.length;r0&&o.push(r),s=t.lastIndex;var a=n[0][1];switch(a){case"s":case"o":i");break;case"%":o.push("%");break;default:o.push("<%"+a+"?>")}}return o.push(e.substring(s)),o.join("")},s.formatNumber=function(e,t,n,r){var i=e,o=isNaN(t=Math.abs(t))?2:t,s=void 0===n?",":n,a=void 0===r?".":r,u=i<0?"-":"",l=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",c=l.length>3?l.length%3:0;return u+(c?l.substr(0,c)+a:"")+l.substr(c).replace(/(\d{3})(?=\d)/g,"$1"+a)+(o?s+Math.abs(i-l).toFixed(o).slice(2):"")},s.formatSize=function(e){return e=e>=1073741824?s.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?s.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?s.formatNumber(e/1024,0)+" KiB":s.formatNumber(e,0)+" bytes",e},s.bytesFromIP=function(e){return-1!==e.indexOf(".")?s.bytesFromIPv4(e):-1!==e.indexOf(":")?s.bytesFromIPv6(e):null},s.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=s.createBuffer(),n=0;nn[r].end-n[r].start&&(r=n.length-1)):n.push({start:u,end:u})}t.push(o)}if(n.length>0){var l=n[r];l.end-l.start>0&&(t.splice(l.start,l.end-l.start+1,""),0===l.start&&t.unshift(""),7===l.end&&t.push(""))}return t.join(":")},s.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in s&&!e.update)return t(null,s.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return s.cores=navigator.hardwareConcurrency,t(null,s.cores);if("undefined"==typeof Worker)return s.cores=1,t(null,s.cores);if("undefined"==typeof Blob)return s.cores=2,t(null,s.cores);var n=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){for(var t=Date.now(),n=t+4;Date.now()a.st&&i.sti.st&&a.st 3 bytes.");let s=o.decode(r);if(!t.isValidCode(s))throw new Error(`multihash unknown function code: 0x${s.toString(16)}`);r=r.slice(o.decode.bytes);let a=o.decode(r);if(a<1)throw new Error(`multihash invalid length: 0x${a.toString(16)}`);if(r=r.slice(o.decode.bytes),r.length!==a)throw new Error(`multihash length inconsistent: 0x${r.toString("hex")}`);return{code:s,name:i.codes[s],length:a,digest:r}},t.encode=function n(r,i,s){if(!r||!i)throw new Error("multihash encode requires at least two args: digest, code");const a=t.coerceCode(i);if(!e.isBuffer(r))throw new Error("digest should be a Buffer");if(null==s&&(s=r.length),s&&r.length!==s)throw new Error("digest length should be equal to specified length.");return e.concat([e.from(o.encode(a)),e.from(o.encode(s)),r])},t.coerceCode=function e(n){let r=n;if("string"==typeof n){if(!i.names[n])throw new Error(`Unrecognized hash function named: ${n}`);r=i.names[n]}if("number"!=typeof r)throw new Error(`Hash function code should be a number. Got: ${r}`);if(!i.codes[r]&&!t.isAppCode(r))throw new Error(`Unrecognized function code: ${r}`);return r},t.isAppCode=function e(t){return t>0&&t<16},t.isValidCode=function e(n){return!!t.isAppCode(n)||!!i.codes[n]},t.validate=s,t.prefix=function e(t){return s(t),t.slice(0,2)}}).call(this,n(0).Buffer)},function(e){e.exports={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255}},function(e,t,n){"use strict";var r=n(222);e.exports=function e(t){return r(function(e,t){return e.push(t),e},[],t)}},function(e,t,n){"use strict";t.DAGNode=n(233),t.DAGLink=n(117),t.resolver=n(455),t.util=n(235)},function(e,t,n){e.exports={encode:n(778),decode:n(779),encodingLength:n(780)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=n(410),i=a(r),o=n(297),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){(0,i.default)(s.default,e,t)}e.exports=t.default},function(e,t,n){"use strict";var r=n(17),i=function e(t){return!!r.isString(t)&&/^[0-9a-fA-F]+$/.test(t)};e.exports={isValidJSON:function e(t){var n;if(!r.isString(t))return!1;try{n=JSON.parse(t)}catch(e){return!1}return"object"==typeof n},isHexa:i,isHexaString:i,cloneArray:function(e){return[].concat(e)},defineImmutable:function e(t,n){return Object.keys(n).forEach(function(e){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,value:n[e]})}),t},isNaturalNumber:function e(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t&&t>=0}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAsync=void 0;var r=n(216),i=o(r);function o(e){return e&&e.__esModule?e:{default:e}}var s="function"==typeof Symbol;function a(e){return s&&"AsyncFunction"===e[Symbol.toStringTag]}function u(e){return a(e)?(0,i.default)(e):e}t.default=u,t.isAsync=a},function(e,t,n){"use strict";var r=n(405);e.exports=function e(t,n){if(!t)return function(e,t){return e?r(t,e,n):t(!0)};Array.isArray(t)||(t=Object.keys(t).map(function(e){return t[e]}));var i=0;return function(e,o){if(e)return r(o,e,n);i>=t.length?o(!0):o(null,t[i++])}}},function(e,t,n){"use strict";const r=n(23),{ensureMultiaddr:i}=n(476),o=n(943),s=n(18);class a{constructor(e){s(e,"Missing peerId. Use Peer.create(cb) to create one"),this.id=e,this.multiaddrs=new o,this.protocols=new Set,this._connectedMultiaddr=void 0}connect(e){if(e=i(e),!this.multiaddrs.has(e)&&e.toString()!==`/ipfs/${this.id.toB58String()}`)throw new Error("can't be connected to missing multiaddr from set");this._connectedMultiaddr=e}disconnect(){this._connectedMultiaddr=void 0}isConnected(){return this._connectedMultiaddr}}a.create=((e,t)=>{if("function"==typeof e)return t=e,e=null,void r.create((e,n)=>{if(e)return t(e);t(null,new a(n))});"function"==typeof e.toJSON?t(null,new a(e)):r.createFromJSON(e,(e,n)=>t(e,new a(n)))}),a.isPeerInfo=(e=>Boolean("object"==typeof e&&e.id&&e.multiaddrs)),e.exports=a},function(e,t,n){var r=n(578),i=n(348),o=r.tfJSON,s=r.TfTypeError,a=r.TfPropertyTypeError,u=r.tfSubError,l=r.getValueTypeName,c={arrayOf:function e(t,n){function r(e,r){return!!i.Array(e)&&(!i.Nil(e)&&(!(void 0!==n.minLength&&e.lengthn.maxLength)&&((void 0===n.length||e.length===n.length)&&e.every(function(e,n){try{return h(t,e,r)}catch(e){throw u(e,n)}})))))}return t=f(t),n=n||{},r.toJSON=function(){var e="["+o(t)+"]";return void 0!==n.length?e+="{"+n.length+"}":void 0===n.minLength&&void 0===n.maxLength||(e+="{"+(void 0===n.minLength?0:n.minLength)+","+(void 0===n.maxLength?1/0:n.maxLength)+"}"),e},r},maybe:function e(t){function n(n,r){return i.Nil(n)||t(n,r,e)}return t=f(t),n.toJSON=function(){return"?"+o(t)},n},map:function e(t,n){function r(e,r){if(!i.Object(e))return!1;if(i.Nil(e))return!1;for(var o in e){try{n&&h(n,o,r)}catch(e){throw u(e,o,"key")}try{var s=e[o];h(t,s,r)}catch(e){throw u(e,o)}}return!0}return t=f(t),n&&(n=f(n)),r.toJSON=n?function(){return"{"+o(n)+": "+o(t)+"}"}:function(){return"{"+o(t)+"}"},r},object:function e(t){var n={};for(var r in t)n[r]=f(t[r]);function s(e,t){if(!i.Object(e))return!1;if(i.Nil(e))return!1;var r;try{for(r in n){var o=n[r],s=e[r];h(o,s,t)}}catch(e){throw u(e,r)}if(t)for(r in e)if(!n[r])throw new a(void 0,r);return!0}return s.toJSON=function(){return o(n)},s},anyOf:function e(){var t=[].slice.call(arguments).map(f);function n(e,n){return t.some(function(t){try{return h(t,e,n)}catch(e){return!1}})}return n.toJSON=function(){return t.map(o).join("|")},n},allOf:function e(){var t=[].slice.call(arguments).map(f);function n(e,n){return t.every(function(t){try{return h(t,e,n)}catch(e){return!1}})}return n.toJSON=function(){return t.map(o).join(" & ")},n},quacksLike:function e(t){function n(e){return t===l(e)}return n.toJSON=function(){return t},n},tuple:function e(){var t=[].slice.call(arguments).map(f);function n(e,n){return!i.Nil(e)&&(!i.Nil(e.length)&&((!n||e.length===t.length)&&t.every(function(t,r){try{return h(t,e[r],n)}catch(e){throw u(e,r)}})))}return n.toJSON=function(){return"("+t.map(o).join(", ")+")"},n},value:function e(t){function n(e){return e===t}return n.toJSON=function(){return t},n}};function f(e){if(i.String(e))return"?"===e[0]?c.maybe(e.slice(1)):i[e]||c.quacksLike(e);if(e&&i.Object(e)){if(i.Array(e)){if(1!==e.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return c.arrayOf(e[0])}return c.object(e)}return i.Function(e)?e:c.value(e)}function h(e,t,n,r){if(i.Function(e)){if(e(t,n))return!0;throw new s(r||e,t)}return h(f(e),t,n)}for(var p in c.oneOf=c.anyOf,i)h[p]=i[p];for(p in c)h[p]=c[p];var d=n(1353);for(p in d)h[p]=d[p];h.compile=f,h.TfTypeError=s,h.TfPropertyTypeError=a,e.exports=h},function(e,t,n){(function(t){e.exports=g;var r=n(27),i=n(55),o=n(15),s=n(207),a=n(102),u=n(379).DiffieHellman,l=n(97),c=n(47),f=n(50),h;try{h=n(712)}catch(e){}var p=l.InvalidAlgorithmError,d=l.KeyParseError,m={};function g(e){r.object(e,"options"),r.arrayOfObject(e.parts,"options.parts"),r.string(e.type,"options.type"),r.optionalString(e.comment,"options.comment");var t=i.info[e.type];if("object"!=typeof t)throw new p(e.type);for(var n={},o=0,s;o1024&&(e="sha256"),"ed25519"===this.type&&(e="sha512"),"ecdsa"===this.type&&(e=this.size<=256?"sha256":this.size<=384?"sha384":"sha512"),e},g.prototype.createVerify=function(e){if(void 0===e&&(e=this.defaultHashAlgorithm()),r.string(e,"hash algorithm"),"ed25519"===this.type&&void 0!==h)return new h.Verifier(this,e);if("curve25519"===this.type)throw new Error("Curve25519 keys are not suitable for signing or verification");var n,i,s;try{i=e.toUpperCase(),n=o.createVerify(i)}catch(e){s=e}(void 0===n||s instanceof Error&&s.message.match(/Unknown message digest/))&&(i="RSA-",i+=e.toUpperCase(),n=o.createVerify(i)),r.ok(n,"failed to create verifier");var u=n.verify.bind(n),l=this.toBuffer("pkcs8"),c=this.curve,f=this;return n.verify=function(n,r){if(a.isSignature(n,[2,0]))return n.type===f.type&&((!n.hashAlgorithm||n.hashAlgorithm===e)&&((!n.curve||"ecdsa"!==f.type||n.curve===c)&&u(l,n.toBuffer("asn1"))));if("string"==typeof n||t.isBuffer(n))return u(l,n,r);throw a.isSignature(n,[1,0])?new Error("signature was created by too old a version of sshpk and cannot be verified"):new TypeError("signature must be a string, Buffer, or Signature object")},n},g.prototype.createDiffieHellman=function(){if("rsa"===this.type)throw new Error("RSA keys do not support Diffie-Hellman");return new u(this)},g.prototype.createDH=g.prototype.createDiffieHellman,g.parse=function(e,t,n){"string"!=typeof e&&r.buffer(e,"data"),void 0===t&&(t="auto"),r.string(t,"format"),"string"==typeof n&&(n={filename:n}),r.optionalObject(n,"options"),void 0===n&&(n={}),r.optionalString(n.filename,"options.filename"),void 0===n.filename&&(n.filename="(unnamed)"),r.object(m[t],"formats[format]");try{var i=m[t].read(e,n);return i instanceof f&&(i=i.toPublic()),i.comment||(i.comment=n.filename),i}catch(e){if("KeyEncryptedError"===e.name)throw e;throw new d(n.filename,t,e)}},g.isKey=function(e,t){return c.isCompatible(e,g,t)},g.prototype._sshpkApiVersion=[1,7],g._oldVersionDetect=function(e){return r.func(e.toBuffer),r.func(e.fingerprint),e.createDH?[1,4]:e.defaultHashAlgorithm?[1,3]:e.formats.auto?[1,2]:e.formats.pkcs1?[1,1]:[1,0]}}).call(this,n(0).Buffer)},function(e,t,n){e.exports={bufferSplit:_,addRSAMissing:P,calculateDSAPublic:T,calculateED25519Public:j,calculateX25519Public:O,mpNormalize:x,mpDenormalize:C,ecNormalize:k,countZeros:w,assertCompatible:m,isCompatible:d,opensslKeyDeriv:b,opensshCipherInfo:R,publicFromPrivateECDSA:B,zeroPadToLength:A,writeBitString:E,readBitString:S,pbkdf2:v};var r=n(27),i=n(31).Buffer,o=n(50),s=n(46),a=n(15),u=n(55),l=n(103),c=n(286),f=n(208).BigInteger,h=n(209),p=3;function d(e,t,n){if(null===e||"object"!=typeof e)return!1;if(void 0===n&&(n=t.prototype._sshpkApiVersion),e instanceof t&&t.prototype._sshpkApiVersion[0]==n[0])return!0;for(var r=Object.getPrototypeOf(e),i=0;r.constructor.name!==t.name;)if(r=Object.getPrototypeOf(r),!r||++i>p)return!1;if(r.constructor.name!==t.name)return!1;var o=r._sshpkApiVersion;return void 0===o&&(o=t._oldVersionDetect(e)),!(o[0]!=n[0]||o[1]=n[1],i+" must be compatible with "+t.name+" klass version "+n[0]+"."+n[1])}}var g={"des-ede3-cbc":{key:24,iv:8},"aes-128-cbc":{key:16,iv:16},"aes-256-cbc":{key:32,iv:16}},y=8;function b(e,t,n,o){r.buffer(t,"salt"),r.buffer(n,"passphrase"),r.number(o,"iteration count");var s=g[e],u,l,c;r.object(s,"supported cipher"),t=t.slice(0,y);for(var f=i.alloc(0);f.length=t.length){var a=s+1;n.push(e.slice(i,a-o)),i=a,o=0}return i<=e.length&&n.push(e.slice(i,e.length)),n}function k(e,t){if(r.buffer(e),0===e[0]&&4===e[1])return t?e:e.slice(1);if(4===e[0]){if(!t)return e}else{for(;0===e[0];)e=e.slice(1);if(2===e[0]||3===e[0])throw new Error("Compressed elliptic curve points are not supported");if(4!==e[0])throw new Error("Not a valid elliptic curve point");if(!t)return e}var n=i.alloc(e.length+1);return n[0]=0,e.copy(n,1),n}function S(e,t){void 0===t&&(t=l.Ber.BitString);var n=e.readString(t,!0);return r.strictEqual(n[0],0,"bit strings with unused bits are not supported (0x"+n[0].toString(16)+")"),n.slice(1)}function E(e,t,n){void 0===n&&(n=l.Ber.BitString);var r=i.alloc(t.length+1);r[0]=0,t.copy(r,1),e.writeBuffer(r,n)}function x(e){for(r.buffer(e);e.length>1&&0===e[0]&&0==(128&e[1]);)e=e.slice(1);if(128==(128&e[0])){var t=i.alloc(e.length+1);t[0]=0,e.copy(t,1),e=t}return e}function C(e){for(r.buffer(e);e.length>1&&0===e[0];)e=e.slice(1);return e}function A(e,t){for(r.buffer(e),r.number(t);e.length>t;)r.equal(e[0],0),e=e.slice(1);for(;e.length{this.blockSizes.push(e)}),this.removeBlockSize=(e=>{this.blockSizes.splice(e,1)}),this.fileSize=(()=>{if(a.indexOf(this.type)>=0)return;let e=0;return this.blockSizes.forEach(t=>{e+=t}),t&&(e+=t.length),e}),this.marshal=(()=>{let e;switch(this.type){case"raw":e=o.DataType.Raw;break;case"directory":e=o.DataType.Directory;break;case"file":e=o.DataType.File;break;case"metadata":e=o.DataType.Metadata;break;case"symlink":e=o.DataType.Symlink;break;case"hamt-sharded-directory":e=o.DataType.HAMTShard;break;default:throw new Error(`Unkown type: "${this.type}"`)}let t=this.fileSize(),n=this.data;this.data&&this.data.length||(n=void 0);let r=this.blockSizes;return this.blockSizes&&this.blockSizes.length||(r=void 0),o.encode({Type:e,Data:n,filesize:t,blocksizes:r,hashType:this.hashType,fanout:this.fanout})})}u.unmarshal=(e=>{const t=o.decode(e);t.Data||(t.Data=void 0);const n=new u(s[t.Type],t.Data);return n.blockSizes=t.blocksizes,n}),t=e.exports=u},function(e,t,n){"use strict";(function(t){var r=n(597),i=n(25),o=n(17),s=function(e){for(var n=new t(e.length),r=0;re.size?n=r.trim(n,o):o0&&0==(127&e[e.length-1])&&(e.length<=1||0==(128&e[e.length-2])))throw new Error("non-minimally encoded script number");return r.fromSM(e,{endian:"little"})},r.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},r.prototype.gt=function(e){return this.cmp(e)>0},r.prototype.gte=function(e){return this.cmp(e)>=0},r.prototype.lt=function(e){return this.cmp(e)<0},r.trim=function(e,t){return e.slice(t-e.length,e.length)},r.pad=function(e,n,r){for(var i=new t(r),o=0;o!(!e||!e[r])),i}function i(e,{className:t,symbolName:n,withoutNew:r}){const i=Symbol.for(n),o={[t]:function(...t){if(r&&!(this instanceof o))return new o(...t);const n=e.call(this,...t)||this;return n&&!n[i]&&Object.defineProperty(n,i,{value:!0}),n}}[t];return o.prototype=Object.create(e.prototype),o.prototype.constructor=o,Object.defineProperty(o.prototype,Symbol.toStringTag,{get:()=>t}),o[`is${t}`]=(e=>!(!e||!e[i])),o}e.exports=r,e.exports.proto=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=n(218),i=a(r),o=n(410),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){(0,s.default)(i.default,e,t)}e.exports=t.default},function(e,t,n){var r=n(31).Buffer,i={dsa:{parts:["p","q","g","y"],sizePart:"p"},rsa:{parts:["e","n"],sizePart:"n"},ecdsa:{parts:["curve","Q"],sizePart:"Q"},ed25519:{parts:["A"],sizePart:"A"}};i.curve25519=i.ed25519;var o={dsa:{parts:["p","q","g","y","x"]},rsa:{parts:["n","e","d","iqmp","p","q"]},ecdsa:{parts:["curve","Q","d"]},ed25519:{parts:["A","k"]}};o.curve25519=o.ed25519;var s={md5:!0,sha1:!0,sha256:!0,sha384:!0,sha512:!0},a={nistp256:{size:256,pkcs8oid:"1.2.840.10045.3.1.7",p:r.from("00ffffffff 00000001 00000000 0000000000000000 ffffffff ffffffff ffffffff".replace(/ /g,""),"hex"),a:r.from("00FFFFFFFF 00000001 00000000 0000000000000000 FFFFFFFF FFFFFFFF FFFFFFFC".replace(/ /g,""),"hex"),b:r.from("5ac635d8 aa3a93e7 b3ebbd55 769886bc651d06b0 cc53b0f6 3bce3c3e 27d2604b".replace(/ /g,""),"hex"),s:r.from("00c49d3608 86e70493 6a6678e1 139d26b7819f7e90".replace(/ /g,""),"hex"),n:r.from("00ffffffff 00000000 ffffffff ffffffffbce6faad a7179e84 f3b9cac2 fc632551".replace(/ /g,""),"hex"),G:r.from("046b17d1f2 e12c4247 f8bce6e5 63a440f277037d81 2deb33a0 f4a13945 d898c2964fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e162bce3357 6b315ece cbb64068 37bf51f5".replace(/ /g,""),"hex")},nistp384:{size:384,pkcs8oid:"1.3.132.0.34",p:r.from("00ffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff fffffffeffffffff 00000000 00000000 ffffffff".replace(/ /g,""),"hex"),a:r.from("00FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFEFFFFFFFF 00000000 00000000 FFFFFFFC".replace(/ /g,""),"hex"),b:r.from("b3312fa7 e23ee7e4 988e056b e3f82d19181d9c6e fe814112 0314088f 5013875ac656398d 8a2ed19d 2a85c8ed d3ec2aef".replace(/ /g,""),"hex"),s:r.from("00a335926a a319a27a 1d00896a 6773a4827acdac73".replace(/ /g,""),"hex"),n:r.from("00ffffffff ffffffff ffffffff ffffffffffffffff ffffffff c7634d81 f4372ddf581a0db2 48b0a77a ecec196a ccc52973".replace(/ /g,""),"hex"),G:r.from("04aa87ca22 be8b0537 8eb1c71e f320ad746e1d3b62 8ba79b98 59f741e0 82542a385502f25d bf55296c 3a545e38 72760ab73617de4a 96262c6f 5d9e98bf 9292dc29f8f41dbd 289a147c e9da3113 b5f0b8c00a60b1ce 1d7e819d 7a431d7c 90ea0e5f".replace(/ /g,""),"hex")},nistp521:{size:521,pkcs8oid:"1.3.132.0.35",p:r.from("01ffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffffffff".replace(/ /g,""),"hex"),a:r.from("01FFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFC".replace(/ /g,""),"hex"),b:r.from("51953eb961 8e1c9a1f 929a21a0 b68540eea2da725b 99b315f3 b8b48991 8ef109e156193951 ec7e937b 1652c0bd 3bb1bf073573df88 3d2c34f1 ef451fd4 6b503f00".replace(/ /g,""),"hex"),s:r.from("00d09e8800 291cb853 96cc6717 393284aaa0da64ba".replace(/ /g,""),"hex"),n:r.from("01ffffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff fffffffa51868783 bf2f966b 7fcc0148 f709a5d03bb5c9b8 899c47ae bb6fb71e 91386409".replace(/ /g,""),"hex"),G:r.from("0400c6 858e06b7 0404e9cd 9e3ecb66 2395b4429c648139 053fb521 f828af60 6b4d3dbaa14b5e77 efe75928 fe1dc127 a2ffa8de3348b3c1 856a429b f97e7e31 c2e5bd660118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd998f54449 579b4468 17afbd17 273e662c97ee7299 5ef42640 c550b901 3fad0761353c7086 a272c240 88be9476 9fd16650".replace(/ /g,""),"hex")}};e.exports={info:i,privInfo:o,hashAlgs:s,curves:a}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var r=n(218),i=l(r),o=n(394),s=l(o),a=n(42),u=l(a);function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t,n){(0,i.default)(e,(0,s.default)((0,u.default)(t)),n)}e.exports=t.default},function(e,t,n){e.exports=o;var r=n(6).EventEmitter,i=n(1);function o(){r.call(this)}i(o,r),o.Readable=n(302),o.Writable=n(851),o.Duplex=n(852),o.Transform=n(853),o.PassThrough=n(854),o.Stream=o,o.prototype.pipe=function(e,t){var n=this;function i(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(n.on("end",a),n.on("close",u));var s=!1;function a(){s||(s=!0,e.end())}function u(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function l(e){if(c(),0===r.listenerCount(this,"error"))throw e}function c(){n.removeListener("data",i),e.removeListener("drain",o),n.removeListener("end",a),n.removeListener("close",u),n.removeListener("error",l),e.removeListener("error",l),n.removeListener("end",c),n.removeListener("close",c),e.removeListener("close",c)}return n.on("error",l),e.on("error",l),n.on("end",c),n.on("close",c),e.on("close",c),e.emit("pipe",n),e}},function(e,t,n){"use strict";(function(t){const r=n(35),i=n(864);function o(e,t,n,i){if("function"==typeof n&&(i=n,n=void 0),!i)throw new Error("Missing callback");o.digest(e,t,n,(e,o)=>{if(e)return i(e);i(null,r.encode(o,t,n))})}e.exports=o,o.Buffer=t,o.multihash=r,o.digest=function(e,t,n,r){if("function"==typeof n&&(r=n,n=void 0),!r)throw new Error("Missing callback");let i=r,s;n&&(i=((e,t)=>{if(e)return r(e);r(null,t.slice(0,n))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=r.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var r=n(28),i=n(255),o=n(1109),s=function(){},a=/^v?\.0/.test(t.version),u=function(e){return"function"==typeof e},l=function(e){return!!a&&(!!o&&((e instanceof(o.ReadStream||s)||e instanceof(o.WriteStream||s))&&u(e.close)))},c=function(e){return e.setHeader&&u(e.abort)},f=function(e,t,n,o){o=r(o);var a=!1;e.on("close",function(){a=!0}),i(e,{readable:t,writable:n},function(e){if(e)return o(e);a=!0,o()});var f=!1;return function(t){if(!a&&!f)return f=!0,l(e)?e.close(s):c(e)?e.abort():u(e.destroy)?e.destroy():void o(t||new Error("stream was destroyed"))}},h=function(e){e()},p=function(e,t){return e.pipe(t)},d=function(){var e=Array.prototype.slice.call(arguments),t=u(e[e.length-1]||s)&&e.pop()||s,n;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Error("pump requires two streams per minimum");var r=e.map(function(i,o){var s=o0;return f(i,s,a,function(e){n||(n=e),e&&r.forEach(h),s||(r.forEach(h),t(n))})});return e.reduce(p)};e.exports=d}).call(this,n(2))},function(e,t,n){"use strict";(function(t){var r=n(15),i=n(30),o=n(25),s=e.exports;s.sha1=function(e){return o.checkArgument(i.isBuffer(e)),r.createHash("sha1").update(e).digest()},s.sha1.blocksize=512,s.sha256=function(e){return o.checkArgument(i.isBuffer(e)),r.createHash("sha256").update(e).digest()},s.sha256.blocksize=512,s.sha256sha256=function(e){return o.checkArgument(i.isBuffer(e)),s.sha256(s.sha256(e))},s.ripemd160=function(e){return o.checkArgument(i.isBuffer(e)),r.createHash("ripemd160").update(e).digest()},s.sha256ripemd160=function(e){return o.checkArgument(i.isBuffer(e)),s.ripemd160(s.sha256(e))},s.sha512=function(e){return o.checkArgument(i.isBuffer(e)),r.createHash("sha512").update(e).digest()},s.sha512.blocksize=1024,s.hmac=function(e,n,r){o.checkArgument(i.isBuffer(n)),o.checkArgument(i.isBuffer(r)),o.checkArgument(e.blocksize);var s=e.blocksize/8;if(r.length>s)r=e(r);else if(r=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e){"string"!=typeof e&&(e+="");var t=0,n=-1,r=!0,i;for(i=e.length-1;i>=0;--i)if(47===e.charCodeAt(i)){if(!r){t=i+1;break}}else-1===n&&(r=!1,n=i+1);return-1===n?"":e.slice(t,n)}function i(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!r;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,r="/"===s.charAt(0))}return t=n(i(t.split("/"),function(e){return!!e}),!r).join("/"),(r?"/":"")+t||"."},t.normalize=function(e){var r=t.isAbsolute(e),s="/"===o(e,-1);return e=n(i(e.split("/"),function(e){return!!e}),!r).join("/"),e||r||(e="."),e&&s&&(e+="/"),(r?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(i(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,n){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var i=r(e.split("/")),o=r(n.split("/")),s=Math.min(i.length,o.length),a=s,u=0;u=1;--o)if(t=e.charCodeAt(o),47===t){if(!i){r=o;break}}else i=!1;return-1===r?n?"/":".":n&&1===r?"/":e.slice(0,r)},t.basename=function(e,t){var n=r(e);return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,n=0,r=-1,i=!0,o=0,s=e.length-1;s>=0;--s){var a=e.charCodeAt(s);if(47!==a)-1===r&&(i=!1,r=s+1),46===a?-1===t?t=s:1!==o&&(o=1):-1!==t&&(o=-1);else if(!i){n=s+1;break}}return-1===t||-1===r||0===o||1===o&&t===r-1&&t===n+1?"":e.slice(t,r)};var o="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}}).call(this,n(2))},function(e,t,n){var r;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,u=Math.ceil,l=Math.floor,c="[BigNumber Error] ",f=c+"Number primitive has more than 15 significant digits: ",h=1e14,p=14,d=9007199254740991,m=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,y=1e9;function b(e){var t,n,r,i=H.prototype={constructor:H,toString:null,valueOf:null},o=new H(1),C=20,A=4,I=-7,T=21,j=-1e7,O=1e7,P=!1,B=1,R=0,N={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},M="0123456789abcdefghijklmnopqrstuvwxyz",L,F,D,U,z,q,K;function H(e,t){var i,o,a,u,c,h,m,g,y=this;if(!(y instanceof H))return new H(e,t);if(null==t){if(e&&!0===e._isBigNumber)return y.s=e.s,void(!e.c||e.e>O?y.c=y.e=null:e.e=10;c/=10,u++);return void(u>O?y.c=y.e=null:(y.e=u,y.c=[e]))}g=String(e)}else{if(!s.test(g=String(e)))return r(y,g,h);y.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(u=g.indexOf("."))>-1&&(g=g.replace(".","")),(c=g.search(/e/i))>0?(u<0&&(u=c),u+=+g.slice(c+1),g=g.substring(0,c)):u<0&&(u=g.length)}else{if(k(t,2,M.length,"Base"),10==t)return y=new H(e),G(y,C+y.e+1,A);if(g=String(e),h="number"==typeof e){if(0*e!=0)return r(y,g,h,t);if(y.s=1/e<0?(g=g.slice(1),-1):1,H.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(f+e)}else y.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(i=M.slice(0,t),u=c=0,m=g.length;cu){u=m;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,c=-1,u=0;continue}return r(y,String(e),h,t)}h=!1,g=n(g,t,10,y.s),(u=g.indexOf("."))>-1?g=g.replace(".",""):u=g.length}for(c=0;48===g.charCodeAt(c);c++);for(m=g.length;48===g.charCodeAt(--m););if(g=g.slice(c,++m)){if(m-=c,h&&H.DEBUG&&m>15&&(e>d||e!==l(e)))throw Error(f+y.s*e);if((u=u-c-1)>O)y.c=y.e=null;else if(u=T)?E(u,s):x(u,s,"0");else if(e=G(new H(e),t,n),o=e.e,u=w(e.c),a=u.length,1==r||2==r&&(t<=o||o<=I)){for(;aa){if(--t>0)for(u+=".";t--;u+="0");}else if(t+=o-a,t>0)for(o+1==a&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function W(e,t){for(var n,r=1,i=new H(e[0]);r=10;i/=10,r++);return(n=r+n*p-1)>O?e.c=e.e=null:n=10;a/=10,i++);if(o=t-i,o<0)o+=p,s=t,c=g[f=0],d=c/y[i-s-1]%10|0;else if(f=u((o+1)/p),f>=g.length){if(!r)break e;for(;g.length<=f;g.push(0));c=d=0,i=1,o%=p,s=o-p+1}else{for(c=a=g[f],i=1;a>=10;a/=10,i++);o%=p,s=o-p+i,d=s<0?0:c/y[i-s-1]%10|0}if(r=r||t<0||null!=g[f+1]||(s<0?c:c%y[i-s-1]),r=n<4?(d||r)&&(0==n||n==(e.s<0?3:2)):d>5||5==d&&(4==n||r||6==n&&(o>0?s>0?c/y[i-s]:0:g[f-1])%10&1||n==(e.s<0?8:7)),t<1||!g[0])return g.length=0,r?(t-=e.e+1,g[0]=y[(p-t%p)%p],e.e=-t||0):g[0]=e.e=0,e;if(0==o?(g.length=f,a=1,f--):(g.length=f+1,a=y[p-o],g[f]=s>0?l(c/y[i-s]%y[s])*a:0),r)for(;;){if(0==f){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=a,a=1;s>=10;s/=10,a++);o!=a&&(e.e++,g[0]==h&&(g[0]=1));break}if(g[f]+=a,g[f]!=h)break;g[f--]=0,a=1}for(o=g.length;0===g[--o];g.pop());}e.e>O?e.c=e.e=null:e.e=T?E(t,n):x(t,n,"0"),e.s<0?"-"+t:t)}return H.clone=b,H.ROUND_UP=0,H.ROUND_DOWN=1,H.ROUND_CEIL=2,H.ROUND_FLOOR=3,H.ROUND_HALF_UP=4,H.ROUND_HALF_DOWN=5,H.ROUND_HALF_EVEN=6,H.ROUND_HALF_CEIL=7,H.ROUND_HALF_FLOOR=8,H.EUCLID=9,H.config=H.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(c+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(n=e[t],k(n,0,y,t),C=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(n=e[t],k(n,0,8,t),A=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&(n=e[t],n&&n.pop?(k(n[0],-y,0,t),k(n[1],0,y,t),I=n[0],T=n[1]):(k(n,-y,y,t),I=-(T=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if(n=e[t],n&&n.pop)k(n[0],-y,-1,t),k(n[1],1,y,t),j=n[0],O=n[1];else{if(k(n,-y,y,t),!n)throw Error(c+t+" cannot be zero: "+n);j=-(O=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if(n=e[t],n!==!!n)throw Error(c+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw P=!n,Error(c+"crypto unavailable");P=n}else P=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(n=e[t],k(n,0,9,t),B=n),e.hasOwnProperty(t="POW_PRECISION")&&(n=e[t],k(n,0,y,t),R=n),e.hasOwnProperty(t="FORMAT")){if(n=e[t],"object"!=typeof n)throw Error(c+t+" not an object: "+n);N=n}if(e.hasOwnProperty(t="ALPHABET")){if(n=e[t],"string"!=typeof n||/^.$|[+-.\s]|(.).*\1/.test(n))throw Error(c+t+" invalid: "+n);M=n}}return{DECIMAL_PLACES:C,ROUNDING_MODE:A,EXPONENTIAL_AT:[I,T],RANGE:[j,O],CRYPTO:P,MODULO_MODE:B,POW_PRECISION:R,FORMAT:N,ALPHABET:M}},H.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!H.DEBUG)return!0;var t,n,r=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-y&&i<=y&&i===l(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break e}if(t=(i+1)%p,t<1&&(t+=p),String(r[0]).length==t){for(t=0;t=h||n!==l(n))break e;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(c+"Invalid BigNumber: "+e)},H.maximum=H.max=function(){return W(arguments,i.lt)},H.minimum=H.min=function(){return W(arguments,i.gt)},H.random=(L=9007199254740992,F=Math.random()*L&2097151?function(){return l(Math.random()*L)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,i,s,a=0,f=[],h=new H(o);if(null==e?e=C:k(e,0,y),i=u(e/p),P)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));a>>11),s>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[a]=n[0],t[a+1]=n[1]):(f.push(s%1e14),a+=2);a=i/2}else{if(!crypto.randomBytes)throw P=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(i*=7);a=9e15?crypto.randomBytes(7).copy(t,a):(f.push(s%1e14),a+=7);a=i/7}if(!P)for(;a=10;s/=10,a++);an-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/n|0,o[i]%=n)}return o.reverse()}return function(r,i,o,s,a){var u,l,c,f,h,p,d,m,g=r.indexOf("."),y=C,b=A;for(g>=0&&(f=R,R=0,r=r.replace(".",""),m=new H(i),p=m.pow(r.length-g),R=f,m.c=n(x(w(p.c),p.e,"0"),10,o,e),m.e=m.c.length),d=n(r,i,o,a?(u=M,e):(u=e,M)),c=f=d.length;0==d[--f];d.pop());if(!d[0])return u.charAt(0);if(g<0?--c:(p.c=d,p.e=c,p.s=s,p=t(p,m,y,b,o),d=p.c,h=p.r,c=p.e),l=c+y+1,g=d[l],f=o/2,h=h||l<0||null!=d[l+1],h=b<4?(null!=g||h)&&(0==b||b==(p.s<0?3:2)):g>f||g==f&&(4==b||h||6==b&&1&d[l-1]||b==(p.s<0?8:7)),l<1||!d[0])r=h?x(u.charAt(1),-y,u.charAt(0)):u.charAt(0);else{if(d.length=l,h)for(--o;++d[--l]>o;)d[l]=0,l||(++c,d=[1].concat(d));for(f=d.length;!d[--f];);for(g=0,r="";g<=f;r+=u.charAt(d[g++]));r=x(r,c,u.charAt(0))}return r}}(),t=function(){function e(e,t,n){var r,i,o,s,a=0,u=e.length,l=t%g,c=t/g|0;for(e=e.slice();u--;)o=e[u]%g,s=e[u]/g|0,r=c*o+s*l,i=l*o+r%g*g+a,a=(i/n|0)+(r/g|0)+c*s,e[u]=i%n;return a&&(e=[a].concat(e)),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]1;e.splice(0,1));}return function(r,i,o,s,a){var u,c,f,d,m,g,y,b,w,_,k,S,E,x,C,A,I,T=r.s==i.s?1:-1,j=r.c,O=i.c;if(!(j&&j[0]&&O&&O[0]))return new H(r.s&&i.s&&(j?!O||j[0]!=O[0]:O)?j&&0==j[0]||!O?0*T:T/0:NaN);for(b=new H(T),w=b.c=[],c=r.e-i.e,T=o+c+1,a||(a=h,c=v(r.e/p)-v(i.e/p),T=T/p|0),f=0;O[f]==(j[f]||0);f++);if(O[f]>(j[f]||0)&&c--,T<0)w.push(1),d=!0;else{for(x=j.length,A=O.length,f=0,T+=2,m=l(a/(O[0]+1)),m>1&&(O=e(O,m,a),j=e(j,m,a),A=O.length,x=j.length),E=A,_=j.slice(0,A),k=_.length;k=a/2&&C++;do{if(m=0,u=t(O,_,A,k),u<0){if(S=_[0],A!=k&&(S=S*a+(_[1]||0)),m=l(S/C),m>1)for(m>=a&&(m=a-1),g=e(O,m,a),y=g.length,k=_.length;1==t(g,_,y,k);)m--,n(g,A=10;T/=10,f++);G(b,o+(b.e=f+c*p-1)+1,s,d)}else b.e=c,b.r=+d;return b}}(),D=/^(-?)0([xbo])(?=\w[\w.]*$)/i,U=/^([^.]+)\.$/,z=/^\.([^.]+)$/,q=/^-?(Infinity|NaN)$/,K=/^\s*\+(?=[\w.])|^\s+|\s+$/g,r=function(e,t,n,r){var i,o=n?t:t.replace(K,"");if(q.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(D,function(e,t,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?e:t}),r&&(i=r,o=o.replace(U,"$1").replace(z,"0.$1")),t!=o))return new H(o,i);if(H.DEBUG)throw Error(c+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},i.absoluteValue=i.abs=function(){var e=new H(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return _(this,new H(e,t))},i.decimalPlaces=i.dp=function(e,t){var n,r,i,o=this;if(null!=e)return k(e,0,y),null==t?t=A:k(t,0,8),G(new H(o),e+o.e+1,t);if(!(n=o.c))return null;if(r=((i=n.length-1)-v(this.e/p))*p,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},i.dividedBy=i.div=function(e,n){return t(this,new H(e,n),C,A)},i.dividedToIntegerBy=i.idiv=function(e,n){return t(this,new H(e,n),0,1)},i.exponentiatedBy=i.pow=function(e,t){var n,r,i,s,a,f,h,d,m,g=this;if(e=new H(e),e.c&&!e.isInteger())throw Error(c+"Exponent not an integer: "+Y(e));if(null!=t&&(t=new H(t)),f=e.e>14,!g.c||!g.c[0]||1==g.c[0]&&!g.e&&1==g.c.length||!e.c||!e.c[0])return m=new H(Math.pow(+Y(g),f?2-S(e):+Y(e))),t?m.mod(t):m;if(h=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new H(NaN);r=!h&&g.isInteger()&&t.isInteger(),r&&(g=g.mod(t))}else{if(e.e>9&&(g.e>0||g.e<-1||(0==g.e?g.c[0]>1||f&&g.c[1]>=24e7:g.c[0]<8e13||f&&g.c[0]<=9999975e7)))return s=g.s<0&&S(e)?-0:0,g.e>-1&&(s=1/s),new H(h?1/s:s);R&&(s=u(R/p+2))}for(f?(n=new H(.5),h&&(e.s=1),d=S(e)):(i=Math.abs(+Y(e)),d=i%2),m=new H(o);;){if(d){if(m=m.times(g),!m.c)break;s?m.c.length>s&&(m.c.length=s):r&&(m=m.mod(t))}if(i){if(i=l(i/2),0===i)break;d=i%2}else if(e=e.times(n),G(e,e.e+1,1),e.e>14)d=S(e);else{if(i=+Y(e),0===i)break;d=i%2}g=g.times(g),s?g.c&&g.c.length>s&&(g.c.length=s):r&&(g=g.mod(t))}return r?m:(h&&(m=o.div(m)),t?m.mod(t):s?G(m,R,A,a):m)},i.integerValue=function(e){var t=new H(this);return null==e?e=A:k(e,0,8),G(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return 0===_(this,new H(e,t))},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return _(this,new H(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return 1===(t=_(this,new H(e,t)))||0===t},i.isInteger=function(){return!!this.c&&v(this.e/p)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return _(this,new H(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return-1===(t=_(this,new H(e,t)))||0===t},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&0==this.c[0]},i.minus=function(e,t){var n,r,i,o,s=this,a=s.s;if(e=new H(e,t),t=e.s,!a||!t)return new H(NaN);if(a!=t)return e.s=-t,s.plus(e);var u=s.e/p,l=e.e/p,c=s.c,f=e.c;if(!u||!l){if(!c||!f)return c?(e.s=-t,e):new H(f?s:NaN);if(!c[0]||!f[0])return f[0]?(e.s=-t,e):new H(c[0]?s:3==A?-0:0)}if(u=v(u),l=v(l),c=c.slice(),a=u-l){for((o=a<0)?(a=-a,i=c):(l=u,i=f),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(r=(o=(a=c.length)<(t=f.length))?a:t,a=t=0;t0)for(;t--;c[n++]=0);for(t=h-1;r>a;){if(c[--r]=0;){for(n=0,d=S[i]%w,m=S[i]/w|0,s=u,o=i+s;o>i;)l=k[--s]%w,c=k[s]/w|0,a=m*l+c*d,l=d*l+a%w*w+y[o]+n,n=(l/b|0)+(a/w|0)+m*c,y[o--]=l%b;y[o]=n}return n?++r:y.splice(0,1),$(e,y,r)},i.negated=function(){var e=new H(this);return e.s=-e.s||null,e},i.plus=function(e,t){var n,r=this,i=r.s;if(e=new H(e,t),t=e.s,!i||!t)return new H(NaN);if(i!=t)return e.s=-t,r.minus(e);var o=r.e/p,s=e.e/p,a=r.c,u=e.c;if(!o||!s){if(!a||!u)return new H(i/0);if(!a[0]||!u[0])return u[0]?e:new H(a[0]?r:0*i)}if(o=v(o),s=v(s),a=a.slice(),i=o-s){for(i>0?(s=o,n=u):(i=-i,n=a),n.reverse();i--;n.push(0));n.reverse()}for(i=a.length,t=u.length,i-t<0&&(n=u,u=a,a=n,t=i),i=0;t;)i=(a[--t]=a[t]+u[t]+i)/h|0,a[t]=h===a[t]?0:a[t]%h;return i&&(a=[i].concat(a),++s),$(e,a,s)},i.precision=i.sd=function(e,t){var n,r,i,o=this;if(null!=e&&e!==!!e)return k(e,1,y),null==t?t=A:k(t,0,8),G(new H(o),e,t);if(!(n=o.c))return null;if(i=n.length-1,r=i*p+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&o.e+1>r&&(r=o.e+1),r},i.shiftedBy=function(e){return k(e,-d,d),this.times("1e"+e)},i.squareRoot=i.sqrt=function(){var e,n,r,i,o,s=this,a=s.c,u=s.s,l=s.e,c=C+4,f=new H("0.5");if(1!==u||!a||!a[0])return new H(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);if(u=Math.sqrt(+Y(s)),0==u||u==1/0?(n=w(a),(n.length+l)%2==0&&(n+="0"),u=Math.sqrt(+n),l=v((l+1)/2)-(l<0||l%2),u==1/0?n="1e"+l:(n=u.toExponential(),n=n.slice(0,n.indexOf("e")+1)+l),r=new H(n)):r=new H(u+""),r.c[0])for(l=r.e,u=l+c,u<3&&(u=0);;)if(o=r,r=f.times(o.plus(t(s,o,c,1))),w(o.c).slice(0,u)===(n=w(r.c)).slice(0,u)){if(r.e0&&m>0){for(o=m%a||a,f=d.substr(0,o);o0&&(f+=l+d.slice(o)),p&&(f="-"+f)}r=h?f+(n.decimalSeparator||"")+((u=+n.fractionGroupSize)?h.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):h):f}return(n.prefix||"")+r+(n.suffix||"")},i.toFraction=function(e){var n,r,i,s,a,u,l,f,h,d,g,y,b=this,v=b.c;if(null!=e&&(l=new H(e),!l.isInteger()&&(l.c||1!==l.s)||l.lt(o)))throw Error(c+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+Y(l));if(!v)return new H(b);for(n=new H(o),h=r=new H(o),i=f=new H(o),y=w(v),a=n.e=y.length-b.e-1,n.c[0]=m[(u=a%p)<0?p+u:u],e=!e||l.comparedTo(n)>0?a>0?n:h:l,u=O,O=1/0,l=new H(y),f.c[0]=0;d=t(l,n,0,1),s=r.plus(d.times(i)),1!=s.comparedTo(e);)r=i,i=s,h=f.plus(d.times(s=h)),f=s,n=l.minus(d.times(s=n)),l=s;return s=t(e.minus(r),i,0,1),f=f.plus(s.times(h)),r=r.plus(s.times(i)),f.s=h.s=b.s,a*=2,g=t(h,i,a,A).minus(b).abs().comparedTo(t(f,r,a,A).minus(b).abs())<1?[h,i]:[f,r],O=u,g},i.toNumber=function(){return+Y(this)},i.toPrecision=function(e,t){return null!=e&&k(e,1,y),V(this,e,t,2)},i.toString=function(e){var t,r=this,i=r.s,o=r.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=I||o>=T?E(w(r.c),o):x(w(r.c),o,"0"):10===e?(r=G(new H(r),C+o+1,A),t=x(w(r.c),r.e,"0")):(k(e,2,M.length,"Base"),t=n(x(w(r.c),o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},i.valueOf=i.toJSON=function(){return Y(this)},i._isBigNumber=!0,a&&(i[Symbol.toStringTag]="BigNumber",i[Symbol.for("nodejs.util.inspect.custom")]=i.valueOf),null!=e&&H.set(e),H}function v(e){var t=0|e;return e>0||e===t?t:t-1}function w(e){for(var t,n,r=1,i=e.length,o=e[0]+"";rl^n?1:-1;for(a=(u=i.length)<(l=o.length)?u:l,s=0;so[s]^n?1:-1;return u==l?0:u>l^n?1:-1}function k(e,t,n,r){if(en||e!==l(e))throw Error(c+(r||"Argument")+("number"==typeof e?en?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function S(e){var t=e.c.length-1;return v(e.e/p)==t&&e.c[t]%2!=0}function E(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function x(e,t,n){var r,i;if(t<0){for(i=n+".";++t;i+=n);e=i+e}else if(r=e.length,++t>r){for(i=n,t-=r;--t;i+=n);e+=i}else t=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function u(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function e(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function e(t,n){return t.cmp(n)>0?t:n},o.min=function e(t,n){return t.cmp(n)<0?t:n},o.prototype._init=function e(t,n,i){if("number"==typeof t)return this._initNumber(t,n,i);if("object"==typeof t)return this._initArray(t,n,i);"hex"===n&&(n=16),r(n===(0|n)&&n>=2&&n<=36),t=t.toString().replace(/\s+/g,"");var o=0;"-"===t[0]&&o++,16===n?this._parseHex(t,o):this._parseBase(t,n,o),"-"===t[0]&&(this.negative=1),this.strip(),"le"===i&&this._initArray(this.toArray(),n,i)},o.prototype._initNumber=function e(t,n,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),n,i)},o.prototype._initArray=function e(t,n,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var o=0;o=0;o-=3)a=t[o]|t[o-1]<<8|t[o-2]<<16,this.words[s]|=a<>>26-u&67108863,u+=24,u>=26&&(u-=26,s++);else if("le"===i)for(o=0,s=0;o>>26-u&67108863,u+=24,u>=26&&(u-=26,s++);return this.strip()},o.prototype._parseHex=function e(t,n){this.length=Math.ceil((t.length-n)/6),this.words=new Array(this.length);for(var r=0;r=n;r-=6)o=a(t,r,r+6),this.words[i]|=o<>>26-s&4194303,s+=24,s>=26&&(s-=26,i++);r+6!==n&&(o=a(t,n,r+6),this.words[i]|=o<>>26-s&4194303),this.strip()},o.prototype._parseBase=function e(t,n,r){this.words=[0],this.length=1;for(var i=0,o=1;o<=67108863;o*=n)i++;i--,o=o/n|0;for(var s=t.length-r,a=s%i,l=Math.min(s,s-a)+r,c=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function e(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function e(){return(this.red?""};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(e){for(var t=new Array(e.bitLength()),n=0;n>>i}return t}function p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var l=1;l>>26,f=67108863&u,h=Math.min(l,t.length-1),p=Math.max(0,l-e.length+1);p<=h;p++){var d=l-p|0;i=0|e.words[d],o=0|t.words[p],s=i*o+f,c+=s/67108864|0,f=67108863&s}n.words[l]=0|f,u=0|c}return 0!==u?n.words[l]=0|u:n.length--,n.strip()}o.prototype.toString=function e(t,n){var i;if(t=t||10,n=0|n||1,16===t||"hex"===t){i="";for(var o=0,s=0,a=0;a>>24-o&16777215,i=0!==s||a!==this.length-1?l[6-h.length]+h+i:h+i,o+=2,o>=26&&(o-=26,a--)}for(0!==s&&(i=s.toString(16)+i);i.length%n!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var p=c[t],d=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var g=m.modn(d).toString(t);m=m.idivn(d),i=m.isZero()?g+i:l[p-g.length]+g+i}for(this.isZero()&&(i="0"+i);i.length%n!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function e(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function e(){return this.toString(16)},o.prototype.toBuffer=function e(t,n){return r(void 0!==s),this.toArrayLike(s,t,n)},o.prototype.toArray=function e(t,n){return this.toArrayLike(Array,t,n)},o.prototype.toArrayLike=function e(t,n,i){var o=this.byteLength(),s=i||Math.max(1,o);r(o<=s,"byte array longer than desired length"),r(s>0,"Requested array length <= 0"),this.strip();var a="le"===n,u=new t(s),l,c,f=this.clone();if(a){for(c=0;!f.isZero();c++)l=f.andln(255),f.iushrn(8),u[c]=l;for(;c=4096&&(r+=13,n>>>=13),n>=64&&(r+=7,n>>>=7),n>=8&&(r+=4,n>>>=4),n>=2&&(r+=2,n>>>=2),r+n},o.prototype._zeroBits=function e(t){if(0===t)return 26;var n=t,r=0;return 0==(8191&n)&&(r+=13,n>>>=13),0==(127&n)&&(r+=7,n>>>=7),0==(15&n)&&(r+=4,n>>>=4),0==(3&n)&&(r+=2,n>>>=2),0==(1&n)&&r++,r},o.prototype.bitLength=function e(){var t=this.words[this.length-1],n=this._countBits(t);return 26*(this.length-1)+n},o.prototype.zeroBits=function e(){if(this.isZero())return 0;for(var t=0,n=0;nt.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function e(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function e(t){var n;n=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function e(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function e(t){var n,r;this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function e(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function e(t){r("number"==typeof t&&t>=0);var n=0|Math.ceil(t/26),i=t%26;this._expand(n),i>0&&n--;for(var o=0;o0&&(this.words[o]=~this.words[o]&67108863>>26-i),this.strip()},o.prototype.notn=function e(t){return this.clone().inotn(t)},o.prototype.setn=function e(t,n){r("number"==typeof t&&t>=0);var i=t/26|0,o=t%26;return this._expand(i+1),this.words[i]=n?this.words[i]|1<t.length?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>>26;for(;0!==o&&s>>26;if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function e(t){if(0!==t.negative){t.negative=0;var n=this.iadd(t);return t.negative=1,n._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r=this.cmp(t),i,o;if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;r>0?(i=this,o=t):(i=t,o=this);for(var s=0,a=0;a>26,this.words[a]=67108863&n;for(;0!==s&&a>26,this.words[a]=67108863&n;if(0===s&&a>>13,d=0|i[1],m=8191&d,g=d>>>13,y=0|i[2],b=8191&y,v=y>>>13,w=0|i[3],_=8191&w,k=w>>>13,S=0|i[4],E=8191&S,x=S>>>13,C=0|i[5],A=8191&C,I=C>>>13,T=0|i[6],j=8191&T,O=T>>>13,P=0|i[7],B=8191&P,R=P>>>13,N=0|i[8],M=8191&N,L=N>>>13,F=0|i[9],D=8191&F,U=F>>>13,z=0|o[0],q=8191&z,K=z>>>13,H=0|o[1],V=8191&H,W=H>>>13,$=0|o[2],G=8191&$,Y=$>>>13,J=0|o[3],Z=8191&J,Q=J>>>13,X=0|o[4],ee=8191&X,te=X>>>13,ne=0|o[5],re=8191&ne,ie=ne>>>13,oe=0|o[6],se=8191&oe,ae=oe>>>13,ue=0|o[7],le=8191&ue,ce=ue>>>13,fe=0|o[8],he=8191&fe,pe=fe>>>13,de=0|o[9],me=8191&de,ge=de>>>13;r.negative=t.negative^n.negative,r.length=19,u=Math.imul(h,q),l=Math.imul(h,K),l=l+Math.imul(p,q)|0,c=Math.imul(p,K);var ye=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(ye>>>26)|0,ye&=67108863,u=Math.imul(m,q),l=Math.imul(m,K),l=l+Math.imul(g,q)|0,c=Math.imul(g,K),u=u+Math.imul(h,V)|0,l=l+Math.imul(h,W)|0,l=l+Math.imul(p,V)|0,c=c+Math.imul(p,W)|0;var be=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(be>>>26)|0,be&=67108863,u=Math.imul(b,q),l=Math.imul(b,K),l=l+Math.imul(v,q)|0,c=Math.imul(v,K),u=u+Math.imul(m,V)|0,l=l+Math.imul(m,W)|0,l=l+Math.imul(g,V)|0,c=c+Math.imul(g,W)|0,u=u+Math.imul(h,G)|0,l=l+Math.imul(h,Y)|0,l=l+Math.imul(p,G)|0,c=c+Math.imul(p,Y)|0;var ve=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(ve>>>26)|0,ve&=67108863,u=Math.imul(_,q),l=Math.imul(_,K),l=l+Math.imul(k,q)|0,c=Math.imul(k,K),u=u+Math.imul(b,V)|0,l=l+Math.imul(b,W)|0,l=l+Math.imul(v,V)|0,c=c+Math.imul(v,W)|0,u=u+Math.imul(m,G)|0,l=l+Math.imul(m,Y)|0,l=l+Math.imul(g,G)|0,c=c+Math.imul(g,Y)|0,u=u+Math.imul(h,Z)|0,l=l+Math.imul(h,Q)|0,l=l+Math.imul(p,Z)|0,c=c+Math.imul(p,Q)|0;var we=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(we>>>26)|0,we&=67108863,u=Math.imul(E,q),l=Math.imul(E,K),l=l+Math.imul(x,q)|0,c=Math.imul(x,K),u=u+Math.imul(_,V)|0,l=l+Math.imul(_,W)|0,l=l+Math.imul(k,V)|0,c=c+Math.imul(k,W)|0,u=u+Math.imul(b,G)|0,l=l+Math.imul(b,Y)|0,l=l+Math.imul(v,G)|0,c=c+Math.imul(v,Y)|0,u=u+Math.imul(m,Z)|0,l=l+Math.imul(m,Q)|0,l=l+Math.imul(g,Z)|0,c=c+Math.imul(g,Q)|0,u=u+Math.imul(h,ee)|0,l=l+Math.imul(h,te)|0,l=l+Math.imul(p,ee)|0,c=c+Math.imul(p,te)|0;var _e=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(_e>>>26)|0,_e&=67108863,u=Math.imul(A,q),l=Math.imul(A,K),l=l+Math.imul(I,q)|0,c=Math.imul(I,K),u=u+Math.imul(E,V)|0,l=l+Math.imul(E,W)|0,l=l+Math.imul(x,V)|0,c=c+Math.imul(x,W)|0,u=u+Math.imul(_,G)|0,l=l+Math.imul(_,Y)|0,l=l+Math.imul(k,G)|0,c=c+Math.imul(k,Y)|0,u=u+Math.imul(b,Z)|0,l=l+Math.imul(b,Q)|0,l=l+Math.imul(v,Z)|0,c=c+Math.imul(v,Q)|0,u=u+Math.imul(m,ee)|0,l=l+Math.imul(m,te)|0,l=l+Math.imul(g,ee)|0,c=c+Math.imul(g,te)|0,u=u+Math.imul(h,re)|0,l=l+Math.imul(h,ie)|0,l=l+Math.imul(p,re)|0,c=c+Math.imul(p,ie)|0;var ke=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(ke>>>26)|0,ke&=67108863,u=Math.imul(j,q),l=Math.imul(j,K),l=l+Math.imul(O,q)|0,c=Math.imul(O,K),u=u+Math.imul(A,V)|0,l=l+Math.imul(A,W)|0,l=l+Math.imul(I,V)|0,c=c+Math.imul(I,W)|0,u=u+Math.imul(E,G)|0,l=l+Math.imul(E,Y)|0,l=l+Math.imul(x,G)|0,c=c+Math.imul(x,Y)|0,u=u+Math.imul(_,Z)|0,l=l+Math.imul(_,Q)|0,l=l+Math.imul(k,Z)|0,c=c+Math.imul(k,Q)|0,u=u+Math.imul(b,ee)|0,l=l+Math.imul(b,te)|0,l=l+Math.imul(v,ee)|0,c=c+Math.imul(v,te)|0,u=u+Math.imul(m,re)|0,l=l+Math.imul(m,ie)|0,l=l+Math.imul(g,re)|0,c=c+Math.imul(g,ie)|0,u=u+Math.imul(h,se)|0,l=l+Math.imul(h,ae)|0,l=l+Math.imul(p,se)|0,c=c+Math.imul(p,ae)|0;var Se=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Se>>>26)|0,Se&=67108863,u=Math.imul(B,q),l=Math.imul(B,K),l=l+Math.imul(R,q)|0,c=Math.imul(R,K),u=u+Math.imul(j,V)|0,l=l+Math.imul(j,W)|0,l=l+Math.imul(O,V)|0,c=c+Math.imul(O,W)|0,u=u+Math.imul(A,G)|0,l=l+Math.imul(A,Y)|0,l=l+Math.imul(I,G)|0,c=c+Math.imul(I,Y)|0,u=u+Math.imul(E,Z)|0,l=l+Math.imul(E,Q)|0,l=l+Math.imul(x,Z)|0,c=c+Math.imul(x,Q)|0,u=u+Math.imul(_,ee)|0,l=l+Math.imul(_,te)|0,l=l+Math.imul(k,ee)|0,c=c+Math.imul(k,te)|0,u=u+Math.imul(b,re)|0,l=l+Math.imul(b,ie)|0,l=l+Math.imul(v,re)|0,c=c+Math.imul(v,ie)|0,u=u+Math.imul(m,se)|0,l=l+Math.imul(m,ae)|0,l=l+Math.imul(g,se)|0,c=c+Math.imul(g,ae)|0,u=u+Math.imul(h,le)|0,l=l+Math.imul(h,ce)|0,l=l+Math.imul(p,le)|0,c=c+Math.imul(p,ce)|0;var Ee=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,u=Math.imul(M,q),l=Math.imul(M,K),l=l+Math.imul(L,q)|0,c=Math.imul(L,K),u=u+Math.imul(B,V)|0,l=l+Math.imul(B,W)|0,l=l+Math.imul(R,V)|0,c=c+Math.imul(R,W)|0,u=u+Math.imul(j,G)|0,l=l+Math.imul(j,Y)|0,l=l+Math.imul(O,G)|0,c=c+Math.imul(O,Y)|0,u=u+Math.imul(A,Z)|0,l=l+Math.imul(A,Q)|0,l=l+Math.imul(I,Z)|0,c=c+Math.imul(I,Q)|0,u=u+Math.imul(E,ee)|0,l=l+Math.imul(E,te)|0,l=l+Math.imul(x,ee)|0,c=c+Math.imul(x,te)|0,u=u+Math.imul(_,re)|0,l=l+Math.imul(_,ie)|0,l=l+Math.imul(k,re)|0,c=c+Math.imul(k,ie)|0,u=u+Math.imul(b,se)|0,l=l+Math.imul(b,ae)|0,l=l+Math.imul(v,se)|0,c=c+Math.imul(v,ae)|0,u=u+Math.imul(m,le)|0,l=l+Math.imul(m,ce)|0,l=l+Math.imul(g,le)|0,c=c+Math.imul(g,ce)|0,u=u+Math.imul(h,he)|0,l=l+Math.imul(h,pe)|0,l=l+Math.imul(p,he)|0,c=c+Math.imul(p,pe)|0;var xe=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(xe>>>26)|0,xe&=67108863,u=Math.imul(D,q),l=Math.imul(D,K),l=l+Math.imul(U,q)|0,c=Math.imul(U,K),u=u+Math.imul(M,V)|0,l=l+Math.imul(M,W)|0,l=l+Math.imul(L,V)|0,c=c+Math.imul(L,W)|0,u=u+Math.imul(B,G)|0,l=l+Math.imul(B,Y)|0,l=l+Math.imul(R,G)|0,c=c+Math.imul(R,Y)|0,u=u+Math.imul(j,Z)|0,l=l+Math.imul(j,Q)|0,l=l+Math.imul(O,Z)|0,c=c+Math.imul(O,Q)|0,u=u+Math.imul(A,ee)|0,l=l+Math.imul(A,te)|0,l=l+Math.imul(I,ee)|0,c=c+Math.imul(I,te)|0,u=u+Math.imul(E,re)|0,l=l+Math.imul(E,ie)|0,l=l+Math.imul(x,re)|0,c=c+Math.imul(x,ie)|0,u=u+Math.imul(_,se)|0,l=l+Math.imul(_,ae)|0,l=l+Math.imul(k,se)|0,c=c+Math.imul(k,ae)|0,u=u+Math.imul(b,le)|0,l=l+Math.imul(b,ce)|0,l=l+Math.imul(v,le)|0,c=c+Math.imul(v,ce)|0,u=u+Math.imul(m,he)|0,l=l+Math.imul(m,pe)|0,l=l+Math.imul(g,he)|0,c=c+Math.imul(g,pe)|0,u=u+Math.imul(h,me)|0,l=l+Math.imul(h,ge)|0,l=l+Math.imul(p,me)|0,c=c+Math.imul(p,ge)|0;var Ce=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,u=Math.imul(D,V),l=Math.imul(D,W),l=l+Math.imul(U,V)|0,c=Math.imul(U,W),u=u+Math.imul(M,G)|0,l=l+Math.imul(M,Y)|0,l=l+Math.imul(L,G)|0,c=c+Math.imul(L,Y)|0,u=u+Math.imul(B,Z)|0,l=l+Math.imul(B,Q)|0,l=l+Math.imul(R,Z)|0,c=c+Math.imul(R,Q)|0,u=u+Math.imul(j,ee)|0,l=l+Math.imul(j,te)|0,l=l+Math.imul(O,ee)|0,c=c+Math.imul(O,te)|0,u=u+Math.imul(A,re)|0,l=l+Math.imul(A,ie)|0,l=l+Math.imul(I,re)|0,c=c+Math.imul(I,ie)|0,u=u+Math.imul(E,se)|0,l=l+Math.imul(E,ae)|0,l=l+Math.imul(x,se)|0,c=c+Math.imul(x,ae)|0,u=u+Math.imul(_,le)|0,l=l+Math.imul(_,ce)|0,l=l+Math.imul(k,le)|0,c=c+Math.imul(k,ce)|0,u=u+Math.imul(b,he)|0,l=l+Math.imul(b,pe)|0,l=l+Math.imul(v,he)|0,c=c+Math.imul(v,pe)|0,u=u+Math.imul(m,me)|0,l=l+Math.imul(m,ge)|0,l=l+Math.imul(g,me)|0,c=c+Math.imul(g,ge)|0;var Ae=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,u=Math.imul(D,G),l=Math.imul(D,Y),l=l+Math.imul(U,G)|0,c=Math.imul(U,Y),u=u+Math.imul(M,Z)|0,l=l+Math.imul(M,Q)|0,l=l+Math.imul(L,Z)|0,c=c+Math.imul(L,Q)|0,u=u+Math.imul(B,ee)|0,l=l+Math.imul(B,te)|0,l=l+Math.imul(R,ee)|0,c=c+Math.imul(R,te)|0,u=u+Math.imul(j,re)|0,l=l+Math.imul(j,ie)|0,l=l+Math.imul(O,re)|0,c=c+Math.imul(O,ie)|0,u=u+Math.imul(A,se)|0,l=l+Math.imul(A,ae)|0,l=l+Math.imul(I,se)|0,c=c+Math.imul(I,ae)|0,u=u+Math.imul(E,le)|0,l=l+Math.imul(E,ce)|0,l=l+Math.imul(x,le)|0,c=c+Math.imul(x,ce)|0,u=u+Math.imul(_,he)|0,l=l+Math.imul(_,pe)|0,l=l+Math.imul(k,he)|0,c=c+Math.imul(k,pe)|0,u=u+Math.imul(b,me)|0,l=l+Math.imul(b,ge)|0,l=l+Math.imul(v,me)|0,c=c+Math.imul(v,ge)|0;var Ie=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,u=Math.imul(D,Z),l=Math.imul(D,Q),l=l+Math.imul(U,Z)|0,c=Math.imul(U,Q),u=u+Math.imul(M,ee)|0,l=l+Math.imul(M,te)|0,l=l+Math.imul(L,ee)|0,c=c+Math.imul(L,te)|0,u=u+Math.imul(B,re)|0,l=l+Math.imul(B,ie)|0,l=l+Math.imul(R,re)|0,c=c+Math.imul(R,ie)|0,u=u+Math.imul(j,se)|0,l=l+Math.imul(j,ae)|0,l=l+Math.imul(O,se)|0,c=c+Math.imul(O,ae)|0,u=u+Math.imul(A,le)|0,l=l+Math.imul(A,ce)|0,l=l+Math.imul(I,le)|0,c=c+Math.imul(I,ce)|0,u=u+Math.imul(E,he)|0,l=l+Math.imul(E,pe)|0,l=l+Math.imul(x,he)|0,c=c+Math.imul(x,pe)|0,u=u+Math.imul(_,me)|0,l=l+Math.imul(_,ge)|0,l=l+Math.imul(k,me)|0,c=c+Math.imul(k,ge)|0;var Te=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Te>>>26)|0,Te&=67108863,u=Math.imul(D,ee),l=Math.imul(D,te),l=l+Math.imul(U,ee)|0,c=Math.imul(U,te),u=u+Math.imul(M,re)|0,l=l+Math.imul(M,ie)|0,l=l+Math.imul(L,re)|0,c=c+Math.imul(L,ie)|0,u=u+Math.imul(B,se)|0,l=l+Math.imul(B,ae)|0,l=l+Math.imul(R,se)|0,c=c+Math.imul(R,ae)|0,u=u+Math.imul(j,le)|0,l=l+Math.imul(j,ce)|0,l=l+Math.imul(O,le)|0,c=c+Math.imul(O,ce)|0,u=u+Math.imul(A,he)|0,l=l+Math.imul(A,pe)|0,l=l+Math.imul(I,he)|0,c=c+Math.imul(I,pe)|0,u=u+Math.imul(E,me)|0,l=l+Math.imul(E,ge)|0,l=l+Math.imul(x,me)|0,c=c+Math.imul(x,ge)|0;var je=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(je>>>26)|0,je&=67108863,u=Math.imul(D,re),l=Math.imul(D,ie),l=l+Math.imul(U,re)|0,c=Math.imul(U,ie),u=u+Math.imul(M,se)|0,l=l+Math.imul(M,ae)|0,l=l+Math.imul(L,se)|0,c=c+Math.imul(L,ae)|0,u=u+Math.imul(B,le)|0,l=l+Math.imul(B,ce)|0,l=l+Math.imul(R,le)|0,c=c+Math.imul(R,ce)|0,u=u+Math.imul(j,he)|0,l=l+Math.imul(j,pe)|0,l=l+Math.imul(O,he)|0,c=c+Math.imul(O,pe)|0,u=u+Math.imul(A,me)|0,l=l+Math.imul(A,ge)|0,l=l+Math.imul(I,me)|0,c=c+Math.imul(I,ge)|0;var Oe=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,u=Math.imul(D,se),l=Math.imul(D,ae),l=l+Math.imul(U,se)|0,c=Math.imul(U,ae),u=u+Math.imul(M,le)|0,l=l+Math.imul(M,ce)|0,l=l+Math.imul(L,le)|0,c=c+Math.imul(L,ce)|0,u=u+Math.imul(B,he)|0,l=l+Math.imul(B,pe)|0,l=l+Math.imul(R,he)|0,c=c+Math.imul(R,pe)|0,u=u+Math.imul(j,me)|0,l=l+Math.imul(j,ge)|0,l=l+Math.imul(O,me)|0,c=c+Math.imul(O,ge)|0;var Pe=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,u=Math.imul(D,le),l=Math.imul(D,ce),l=l+Math.imul(U,le)|0,c=Math.imul(U,ce),u=u+Math.imul(M,he)|0,l=l+Math.imul(M,pe)|0,l=l+Math.imul(L,he)|0,c=c+Math.imul(L,pe)|0,u=u+Math.imul(B,me)|0,l=l+Math.imul(B,ge)|0,l=l+Math.imul(R,me)|0,c=c+Math.imul(R,ge)|0;var Be=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Be>>>26)|0,Be&=67108863,u=Math.imul(D,he),l=Math.imul(D,pe),l=l+Math.imul(U,he)|0,c=Math.imul(U,pe),u=u+Math.imul(M,me)|0,l=l+Math.imul(M,ge)|0,l=l+Math.imul(L,me)|0,c=c+Math.imul(L,ge)|0;var Re=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Re>>>26)|0,Re&=67108863,u=Math.imul(D,me),l=Math.imul(D,ge),l=l+Math.imul(U,me)|0,c=Math.imul(U,ge);var Ne=(a+u|0)+((8191&l)<<13)|0;return a=(c+(l>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,s[0]=ye,s[1]=be,s[2]=ve,s[3]=we,s[4]=_e,s[5]=ke,s[6]=Se,s[7]=Ee,s[8]=xe,s[9]=Ce,s[10]=Ae,s[11]=Ie,s[12]=Te,s[13]=je,s[14]=Oe,s[15]=Pe,s[16]=Be,s[17]=Re,s[18]=Ne,0!==a&&(s[19]=a,r.length++),r};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0,i+=s>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}function g(e,t,n){var r=new y;return r.mulp(e,t,n)}function y(e,t){this.x=e,this.y=t}Math.imul||(d=p),o.prototype.mulTo=function e(t,n){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?d(this,t,n):i<63?p(this,t,n):i<1024?m(this,t,n):g(this,t,n),r},y.prototype.makeRBT=function e(t){for(var n=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},y.prototype.permute=function e(t,n,r,i,o,s){for(var a=0;a>>=1)o++;return 1<>>=13,i[2*a+1]=8191&s,s>>>=13;for(a=2*n;a>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),this},o.prototype.muln=function e(t){return this.clone().imuln(t)},o.prototype.sqr=function e(){return this.mul(this)},o.prototype.isqr=function e(){return this.imul(this.clone())},o.prototype.pow=function e(t){var n=h(t);if(0===n.length)return new o(1);for(var r=this,i=0;i=0);var n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n,s;if(0!==n){var a=0;for(s=0;s>>26-n}a&&(this.words[s]=a,this.length++)}if(0!==i){for(s=this.length-1;s>=0;s--)this.words[s+i]=this.words[s];for(s=0;s=0),o=n?(n-n%26)/26:0;var s=t%26,a=Math.min((t-s)/26,this.length),u=67108863^67108863>>>s<a)for(this.length-=a,c=0;c=0&&(0!==f||c>=o);c--){var h=0|this.words[c];this.words[c]=f<<26-s|h>>>s,f=h&u}return l&&0!==f&&(l.words[l.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function e(t,n,i){return r(0===this.negative),this.iushrn(t,n,i)},o.prototype.shln=function e(t){return this.clone().ishln(t)},o.prototype.ushln=function e(t){return this.clone().iushln(t)},o.prototype.shrn=function e(t){return this.clone().ishrn(t)},o.prototype.ushrn=function e(t){return this.clone().iushrn(t)},o.prototype.testn=function e(t){r("number"==typeof t&&t>=0);var n=t%26,i=(t-n)/26,o=1<=0);var n=t%26,i=(t-n)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==n&&i++,this.length=Math.min(i,this.length),0!==n){var o=67108863^67108863>>>n<=67108864;n++)this.words[n]-=67108864,n===this.length-1?this.words[n+1]=1:this.words[n+1]++;return this.length=Math.max(this.length,n+1),this},o.prototype.isubn=function e(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var n=0;n>26)-(l/67108864|0),this.words[s+i]=67108863&a}for(;s>26,this.words[s+i]=67108863&a;if(0===u)return this.strip();for(r(-1===u),u=0,s=0;s>26,this.words[s]=67108863&a;return this.negative=1,this.strip()},o.prototype._wordDiv=function e(t,n){var r=this.length-t.length,i=this.clone(),s=t,a=0|s.words[s.length-1],u=this._countBits(a);r=26-u,0!==r&&(s=s.ushln(r),i.iushln(r),a=0|s.words[s.length-1]);var l=i.length-s.length,c;if("mod"!==n){c=new o(null),c.length=l+1,c.words=new Array(c.length);for(var f=0;f=0;p--){var d=67108864*(0|i.words[s.length+p])+(0|i.words[s.length+p-1]);for(d=Math.min(d/a|0,67108863),i._ishlnsubmul(s,d,p);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(s,1,p),i.isZero()||(i.negative^=1);c&&(c.words[p]=d)}return c&&c.strip(),i.strip(),"div"!==n&&0!==r&&i.iushrn(r),{div:c||null,mod:i}},o.prototype.divmod=function e(t,n,i){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(u=this.neg().divmod(t,n),"mod"!==n&&(s=u.div.neg()),"div"!==n&&(a=u.mod.neg(),i&&0!==a.negative&&a.iadd(t)),{div:s,mod:a}):0===this.negative&&0!==t.negative?(u=this.divmod(t.neg(),n),"mod"!==n&&(s=u.div.neg()),{div:s,mod:u.mod}):0!=(this.negative&t.negative)?(u=this.neg().divmod(t.neg(),n),"div"!==n&&(a=u.mod.neg(),i&&0!==a.negative&&a.isub(t)),{div:u.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===n?{div:this.divn(t.words[0]),mod:null}:"mod"===n?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,n);var s,a,u},o.prototype.div=function e(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function e(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function e(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function e(t){var n=this.divmod(t);if(n.mod.isZero())return n.div;var r=0!==n.div.negative?n.mod.isub(t):n.mod,i=t.ushrn(1),o=t.andln(1),s=r.cmp(i);return s<0||1===o&&0===s?n.div:0!==n.div.negative?n.div.isubn(1):n.div.iaddn(1)},o.prototype.modn=function e(t){r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return i},o.prototype.idivn=function e(t){r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this.strip()},o.prototype.divn=function e(t){return this.clone().idivn(t)},o.prototype.egcd=function e(t){r(0===t.negative),r(!t.isZero());var n=this,i=t.clone();n=0!==n.negative?n.umod(t):n.clone();for(var s=new o(1),a=new o(0),u=new o(0),l=new o(1),c=0;n.isEven()&&i.isEven();)n.iushrn(1),i.iushrn(1),++c;for(var f=i.clone(),h=n.clone();!n.isZero();){for(var p=0,d=1;0==(n.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||a.isOdd())&&(s.iadd(f),a.isub(h)),s.iushrn(1),a.iushrn(1);for(var m=0,g=1;0==(i.words[0]&g)&&m<26;++m,g<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(u.isOdd()||l.isOdd())&&(u.iadd(f),l.isub(h)),u.iushrn(1),l.iushrn(1);n.cmp(i)>=0?(n.isub(i),s.isub(u),a.isub(l)):(i.isub(n),u.isub(s),l.isub(a))}return{a:u,b:l,gcd:i.iushln(c)}},o.prototype._invmp=function e(t){r(0===t.negative),r(!t.isZero());var n=this,i=t.clone();n=0!==n.negative?n.umod(t):n.clone();for(var s=new o(1),a=new o(0),u=i.clone(),l;n.cmpn(1)>0&&i.cmpn(1)>0;){for(var c=0,f=1;0==(n.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(n.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var h=0,p=1;0==(i.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(i.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);n.cmp(i)>=0?(n.isub(i),s.isub(a)):(i.isub(n),a.isub(s))}return l=0===n.cmpn(1)?s:a,l.cmpn(0)<0&&l.iadd(t),l},o.prototype.gcd=function e(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var n=this.clone(),r=t.clone();n.negative=0,r.negative=0;for(var i=0;n.isEven()&&r.isEven();i++)n.iushrn(1),r.iushrn(1);for(;;){for(;n.isEven();)n.iushrn(1);for(;r.isEven();)r.iushrn(1);var o=n.cmp(r);if(o<0){var s=n;n=r,r=s}else if(0===o||0===r.cmpn(1))break;n.isub(r)}return r.iushln(i)},o.prototype.invm=function e(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function e(){return 0==(1&this.words[0])},o.prototype.isOdd=function e(){return 1==(1&this.words[0])},o.prototype.andln=function e(t){return this.words[0]&t},o.prototype.bincn=function e(t){r("number"==typeof t);var n=t%26,i=(t-n)/26,o=1<>>26,u&=67108863,this.words[a]=u}return 0!==s&&(this.words[a]=s,this.length++),this},o.prototype.isZero=function e(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function e(t){var n=t<0,i;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)i=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var o=0|this.words[0];i=o===t?0:ot.length)return 1;if(this.length=0;r--){var i=0|this.words[r],o=0|t.words[r];if(i!==o){io&&(n=1);break}}return n},o.prototype.gtn=function e(t){return 1===this.cmpn(t)},o.prototype.gt=function e(t){return 1===this.cmp(t)},o.prototype.gten=function e(t){return this.cmpn(t)>=0},o.prototype.gte=function e(t){return this.cmp(t)>=0},o.prototype.ltn=function e(t){return-1===this.cmpn(t)},o.prototype.lt=function e(t){return-1===this.cmp(t)},o.prototype.lten=function e(t){return this.cmpn(t)<=0},o.prototype.lte=function e(t){return this.cmp(t)<=0},o.prototype.eqn=function e(t){return 0===this.cmpn(t)},o.prototype.eq=function e(t){return 0===this.cmp(t)},o.red=function e(t){return new E(t)},o.prototype.toRed=function e(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function e(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function e(t){return this.red=t,this},o.prototype.forceRed=function e(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function e(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function e(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function e(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function e(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function e(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function e(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function e(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function e(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function e(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function e(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function e(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function e(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function e(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function x(e){E.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function e(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function e(t){var n=t,r;do{this.split(n,this.tmp),n=this.imulK(n),n=n.iadd(this.tmp),r=n.bitLength()}while(r>this.n);var i=r0?n.isub(this.p):n.strip(),n},v.prototype.split=function e(t,n){t.iushrn(this.n,0,n)},v.prototype.imulK=function e(t){return t.imul(this.k)},i(w,v),w.prototype.split=function e(t,n){for(var r=4194303,i=Math.min(t.length,9),o=0;o>>22,s=a}s>>>=22,t.words[o-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function e(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var n=0,r=0;r>>=26,t.words[r]=o,n=i}return 0!==n&&(t.words[t.length++]=n),t},o._prime=function e(t){if(b[t])return b[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new k;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return b[t]=e,e},E.prototype._verify1=function e(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function e(t,n){r(0==(t.negative|n.negative),"red works only with positives"),r(t.red&&t.red===n.red,"red works only with red numbers")},E.prototype.imod=function e(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function e(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function e(t,n){this._verify2(t,n);var r=t.add(n);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function e(t,n){this._verify2(t,n);var r=t.iadd(n);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function e(t,n){this._verify2(t,n);var r=t.sub(n);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function e(t,n){this._verify2(t,n);var r=t.isub(n);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function e(t,n){return this._verify1(t),this.imod(t.ushln(n))},E.prototype.imul=function e(t,n){return this._verify2(t,n),this.imod(t.imul(n))},E.prototype.mul=function e(t,n){return this._verify2(t,n),this.imod(t.mul(n))},E.prototype.isqr=function e(t){return this.imul(t,t.clone())},E.prototype.sqr=function e(t){return this.mul(t,t)},E.prototype.sqrt=function e(t){if(t.isZero())return t.clone();var n=this.m.andln(3);if(r(n%2==1),3===n){var i=this.m.add(new o(1)).iushrn(2);return this.pow(t,i)}for(var s=this.m.subn(1),a=0;!s.isZero()&&0===s.andln(1);)a++,s.iushrn(1);r(!s.isZero());var u=new o(1).toRed(this),l=u.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(l);)f.redIAdd(l);for(var h=this.pow(f,s),p=this.pow(t,s.addn(1).iushrn(1)),d=this.pow(t,s),m=a;0!==d.cmp(u);){for(var g=d,y=0;0!==g.cmp(u);y++)g=g.redSqr();r(y=0;s--){for(var f=n.words[s],h=c-1;h>=0;h--){var p=f>>h&1;a!==i[0]&&(a=this.sqr(a)),0!==p||0!==u?(u<<=1,u|=p,l++,(4===l||0===s&&0===h)&&(a=this.mul(a,i[u]),l=0,u=0)):l=0}c=26}return a},E.prototype.convertTo=function e(t){var n=t.umod(this.m);return n===t?n.clone():n},E.prototype.convertFrom=function e(t){var n=t.clone();return n.red=null,n},o.mont=function e(t){return new x(t)},i(x,E),x.prototype.convertTo=function e(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function e(t){var n=this.imod(t.mul(this.rinv));return n.red=null,n},x.prototype.imul=function e(t,n){if(t.isZero()||n.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(n),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},x.prototype.mul=function e(t,n){if(t.isZero()||n.isZero())return new o(0)._forceRed(this);var r=t.mul(n),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(i).iushrn(this.shift),a=s;return s.cmp(this.m)>=0?a=s.isub(this.m):s.cmpn(0)<0&&(a=s.iadd(this.m)),a._forceRed(this)},x.prototype.invm=function e(t){var n=this.imod(t._invmp(this.m).mul(this.r2));return n._forceRed(this)}}(e,this)}).call(this,n(75)(e))},function(e,t,n){"use strict";const r=n(475),i=n(945),o=n(456);t=e.exports,t.aes=i,t.hmac=r,t.keys=o,t.randomBytes=n(315),t.pbkdf2=n(957)},function(e,t,n){"use strict";(function(t){const r=n(76),i=n(35),o=n(89),s=n(9),a=/^https?:\/\/[^/]+\/(ip(f|n)s)\/((\w+).*)/,u=/^\/(ip(f|n)s)\/((\w+).*)/,l=1,c=4,f=/^https?:\/\/([^/]+)\.(ip(?:f|n)s)\.[^/]+/,h=1,p=2;function d(e){const n=v(e);try{const e=t.from(r.decode(n));return i.decode(e),!0}catch(e){return!1}}function m(e){try{return o.isEncoded(e)}catch(e){return!1}}function g(e){try{return s.isCID(new s(e))}catch(e){return!1}}function y(e,t,n=l,r=c){const i=v(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipfs"!==o[n])return!1;let s=o[r];return s&&t===f&&(s=s.toLowerCase()),g(s)}function b(e,t,n=l,r){const i=v(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipns"!==o[n])return!1;if(r&&t===f){let e=o[r];return e=e.toLowerCase(),g(e)}return!0}function v(e){return t.isBuffer(e)?r.encode(e):"string"==typeof e&&e}const w=e=>y(e,f,2,1),_=e=>b(e,f,2,1);e.exports={multihash:d,cid:g,base32cid:e=>"base32"===m(e)&&g(e),ipfsSubdomain:w,ipnsSubdomain:_,subdomain:e=>w(e)||_(e),subdomainPattern:f,ipfsUrl:e=>y(e,a),ipnsUrl:e=>b(e,a),url:e=>y(e,a)||b(e,a),urlPattern:a,ipfsPath:e=>y(e,u),ipnsPath:e=>b(e,u),path:e=>y(e,u)||b(e,u),pathPattern:u,urlOrPath:e=>y(e,a)||b(e,a)||y(e,u)||b(e,u)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";t.Connection=n(1058)},function(e,t){var n=Array.isArray;e.exports=n},function(e,t){function n(){}e.exports=n},function(e,t){e.exports=r;var n=Object.prototype.hasOwnProperty;function r(){for(var e={},t=0;t73)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-3)return!1;var t=e[3];if(5+t>=e.length)return!1;var n=e[5+t];if(t+n+7!==e.length)return!1;var r=e.slice(4);if(2!==e[2])return!1;if(0===t)return!1;if(128&r[0])return!1;if(t>1&&0===r[0]&&!(128&r[1]))return!1;var i=e.slice(6+t);return 2===e[6+t-2]&&(0!==n&&(!(128&i[0])&&!(n>1&&0===i[0]&&!(128&i[1]))))},u.prototype.hasLowS=function(){return!this.s.lt(new r(1))&&!this.s.gt(new r("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex"))},u.prototype.hasDefinedHashtype=function(){if(!a.isNaturalNumber(this.nhashtype))return!1;var e=this.nhashtype&~u.SIGHASH_ANYONECANPAY;return!(eu.SIGHASH_SINGLE)},u.prototype.toTxFormat=function(){var e=this.toDER(),n=new t(1);return n.writeUInt8(this.nhashtype,0),t.concat([e,n])},u.SIGHASH_ALL=1,u.SIGHASH_NONE=2,u.SIGHASH_SINGLE=3,u.SIGHASH_ANYONECANPAY=128,e.exports=u}).call(this,n(0).Buffer)},function(e,t,n){e.exports=n(600),e.exports.Interpreter=n(1446)},function(e,t){var n=1e3,r=60*n,i=60*r,o=24*i,s=7*o,a=365.25*o;function u(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var u=parseFloat(t[1]),l=(t[2]||"ms").toLowerCase();switch(l){case"years":case"year":case"yrs":case"yr":case"y":return u*a;case"weeks":case"week":case"w":return u*s;case"days":case"day":case"d":return u*o;case"hours":case"hour":case"hrs":case"hr":case"h":return u*i;case"minutes":case"minute":case"mins":case"min":case"m":return u*r;case"seconds":case"second":case"secs":case"sec":case"s":return u*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}}}function l(e){var t=Math.abs(e);return t>=o?Math.round(e/o)+"d":t>=i?Math.round(e/i)+"h":t>=r?Math.round(e/r)+"m":t>=n?Math.round(e/n)+"s":e+"ms"}function c(e){var t=Math.abs(e);return t>=o?f(e,t,o,"day"):t>=i?f(e,t,i,"hour"):t>=r?f(e,t,r,"minute"):t>=n?f(e,t,n,"second"):e+" ms"}function f(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}e.exports=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return u(e);if("number"===n&&isFinite(e))return t.long?c(e):l(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(175),i=a(r),o=n(395),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,i.default)(s.default),e.exports=t.default},function(e,t,n){"use strict";(function(r){const i=n(781);t=e.exports=s,t.encode=a,t.decode=u,t.isEncoded=l,t.names=Object.freeze(Object.keys(i.names)),t.codes=Object.freeze(Object.keys(i.codes));const o=new Error("Unsupported encoding");function s(e,t){if(!t)throw new Error("requires an encoded buffer");const n=f(e),i=r.from(n.code),o=n.name;return c(o,t),r.concat([i,t])}function a(e,t){const n=f(e),i=n.name;return s(i,r.from(n.encode(t)))}function u(e){r.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);e=e.substring(1,e.length),"string"==typeof e&&(e=r.from(e));const n=f(t);return r.from(n.decode(e.toString()))}function l(e){if(r.isBuffer(e)&&(e=e.toString()),"[object String]"!==Object.prototype.toString.call(e))return!1;const t=e.substring(0,1);try{const e=f(t);return e.name}catch(e){return!1}}function c(e,t){const n=f(e);n.decode(t.toString())}function f(e){let t;if(i.names[e])t=i.names[e];else{if(!i.codes[e])throw o;t=i.codes[e]}if(!t.isImplemented())throw new Error("Base "+e+" is not implemented yet");return t}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";function r(e){return e}var i=n(178);e.exports=function e(t){if(!t)return r;t=i(t);var n=!1,o,s;return function(e){return function r(i,a){if(s)return a(s);i?(s=i,e(i,n?function(e){n?o=a:a(i)}:function(e){a(i)})):e(null,function(e,i){e?a(e):s?a(s):(n=!0,t(i,function(e,t){n=!1,s?(a(s),o&&o(s)):e?r(e,a):a(null,t)}))})}}}},function(e,t,n){"use strict";(function(r){Object.defineProperty(t,"__esModule",{value:!0});var i=n(215),o;o=i.hasNextTick?r.nextTick:i.hasSetImmediate?setImmediate:i.fallback,t.default=(0,i.wrap)(o),e.exports=t.default}).call(this,n(2))},function(e,t,n){"use strict";const r=n(24),i=T("dns4"),o=T("dns6"),s=I(T("dnsaddr"),i,o),a=I(T("ip4"),T("ip6")),u=I(A(a,T("tcp")),A(s,T("tcp"))),l=A(a,T("udp")),c=A(l,T("utp")),f=I(A(s,T("tcp")),s),h=I(A(u,T("ws")),A(f,T("ws"))),p=I(A(u,T("wss")),A(f,T("wss"))),d=I(A(u,T("http")),A(a,T("http")),A(f,T("http")),A(f)),m=I(A(u,T("https")),A(a,T("https")),A(f,T("https"))),g=I(A(h,T("p2p-webrtc-star"),T("ipfs")),A(p,T("p2p-webrtc-star"),T("ipfs"))),y=I(A(h,T("p2p-websocket-star"),T("ipfs")),A(p,T("p2p-websocket-star"),T("ipfs")),A(h,T("p2p-websocket-star")),A(p,T("p2p-websocket-star"))),b=I(A(d,T("p2p-webrtc-direct")),A(m,T("p2p-webrtc-direct"))),v=I(h,p,d,m,g,b,u,c),w=I(A(v,T("p2p-stardust"),T("ipfs")),A(v,T("p2p-stardust")));let _=I(A(v,T("ipfs")),g,T("ipfs"));const k=I(A(_,T("p2p-circuit"),_),A(_,T("p2p-circuit")),A(T("p2p-circuit"),_),A(v,T("p2p-circuit")),A(T("p2p-circuit"),v),T("p2p-circuit")),S=()=>I(A(k,S),k),E=S(),x=I(A(E,_,E),A(_,E),A(E,_),E,_);function C(e){return function t(n){if(!r.isMultiaddr(n))try{n=r(n)}catch(e){return!1}let i=e(n.protoNames());return null!==i&&0===i.length}}function A(){const e=Array.from(arguments);function t(t){return t.length{if(t="function"==typeof e?e().partialMatch(t):e.partialMatch(t),null===t)return!0}),t)}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:C(t),partialMatch:t}}function I(){const e=Array.from(arguments);function t(t){let n=null;return e.some(e=>{const r="function"==typeof e?e().partialMatch(t):e.partialMatch(t);if(r)return n=r,!0}),n}const n={toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:C(t),partialMatch:t};return n}function T(e){const t=e;function n(e){if("string"==typeof e)try{e=r(e)}catch(e){return!1}const n=e.protoNames();return 1===n.length&&n[0]===t}function i(e){return 0===e.length?null:e[0]===t?e.slice(1):null}return{toString:function(){return t},matches:n,partialMatch:i}}t.DNS=f,t.DNS4=i,t.DNS6=o,t.IP=a,t.TCP=u,t.UDP=l,t.UTP=c,t.HTTP=d,t.HTTPS=m,t.WebSockets=h,t.WebSocketsSecure=p,t.WebSocketStar=y,t.WebRTCStar=g,t.WebRTCDirect=b,t.Reliable=v,t.Stardust=w,t.Circuit=E,t.IPFS=x},function(e,t,n){"use strict";var r=n(107),i=n(1);function o(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function s(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for(e=e.replace(/[^a-z0-9]+/gi,""),e.length%2!=0&&(e="0"+e),i=0;i>6|192,n[r++]=63&s|128):o(e,i)?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),n[r++]=s>>18|240,n[r++]=s>>12&63|128,n[r++]=s>>6&63|128,n[r++]=63&s|128):(n[r++]=s>>12|224,n[r++]=s>>6&63|128,n[r++]=63&s|128)}else for(i=0;i>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24;return t>>>0}function l(e,t){for(var n="",r=0;r>>0}return s}function p(e,t){for(var n=new Array(4*e.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n}function d(e,t){return e>>>t|e<<32-t}function m(e,t){return e<>>32-t}function g(e,t){return e+t>>>0}function y(e,t,n){return e+t+n>>>0}function b(e,t,n,r){return e+t+n+r>>>0}function v(e,t,n,r,i){return e+t+n+r+i>>>0}function w(e,t,n,r){var i=e[t],o=e[t+1],s=r+o>>>0,a=(s>>0,e[t+1]=s}function _(e,t,n,r){var i=t+r>>>0,o=(i>>0}function k(e,t,n,r){var i=t+r;return i>>>0}function S(e,t,n,r,i,o,s,a){var u=0,l=t;l=l+r>>>0,u+=l>>0,u+=l>>0,u+=l>>0}function E(e,t,n,r,i,o,s,a){var u=t+r+o+a;return u>>>0}function x(e,t,n,r,i,o,s,a,u,l){var c=0,f=t;f=f+r>>>0,c+=f>>0,c+=f>>0,c+=f>>0,c+=f>>0}function C(e,t,n,r,i,o,s,a,u,l){var c=t+r+o+a+l;return c>>>0}function A(e,t,n){var r=t<<32-n|e>>>n;return r>>>0}function I(e,t,n){var r=e<<32-n|t>>>n;return r>>>0}function T(e,t,n){return e>>>n}function j(e,t,n){var r=e<<32-n|t>>>n;return r>>>0}t.inherits=i,t.toArray=s,t.toHex=a,t.htonl=u,t.toHex32=l,t.zero2=c,t.zero8=f,t.join32=h,t.split32=p,t.rotr32=d,t.rotl32=m,t.sum32=g,t.sum32_3=y,t.sum32_4=b,t.sum32_5=v,t.sum64=w,t.sum64_hi=_,t.sum64_lo=k,t.sum64_4_hi=S,t.sum64_4_lo=E,t.sum64_5_hi=x,t.sum64_5_lo=C,t.rotr64_hi=A,t.rotr64_lo=I,t.shr64_hi=T,t.shr64_lo=j},function(e,t,n){const r=n(45),i=Math.pow(2,31)-1;function o(e){return r.UInt32(e)&&e<=i}function s(e){return r.String(e)&&e.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}s.toJSON=function(){return"BIP32 derivation path"};const a=21e14;function u(e){return r.UInt53(e)&&e<=a}const l=r.quacksLike("Point"),c=r.compile({messagePrefix:r.oneOf(r.Buffer,r.String),bip32:{public:r.UInt32,private:r.UInt32},pubKeyHash:r.UInt8,scriptHash:r.UInt8,wif:r.UInt8}),f={BIP32Path:s,Buffer256bit:r.BufferN(32),ECPoint:l,Hash160bit:r.BufferN(20),Hash256bit:r.BufferN(32),Network:c,Satoshi:u,UInt31:o};for(var h in r)f[h]=r[h];e.exports=f},function(e,t,n){"use strict";var r=t;r.version=n(1434).version,r.utils=n(1435),r.rand=n(574),r.hmacDRBG=n(1436),r.curve=n(272),r.curves=n(1441),r.ec=n(1443)},function(e,t,n){"use strict";(function(t){var r=n(49),i=n(152),o=n(60),s=n(41),a=n(128),u=n(17),l=n(25);function c(e,t){if(!(this instanceof c))return new c(e,t);if(l.checkArgument(e,"First argument is required, please include public key data."),e instanceof c)return e;t=t||{};var n=this._classifyArgs(e,t);return n.point.validate(),s.defineImmutable(this,{point:n.point,compressed:n.compressed,network:n.network||a.defaultNetwork}),this}c.prototype._classifyArgs=function(e,n){var r={compressed:u.isUndefined(n.compressed)||n.compressed};if(e instanceof i)r.point=e;else if(e.x&&e.y)r=c._transformObject(e);else if("string"==typeof e)r=c._transformDER(new t(e,"hex"));else if(c._isBuffer(e))r=c._transformDER(e);else{if(!c._isPrivateKey(e))throw new TypeError("First argument is an unrecognized data format.");r=c._transformPrivateKey(e)}return r.network||(r.network=u.isUndefined(n.network)?void 0:a.get(n.network)),r},c._isPrivateKey=function(e){var t=n(273);return e instanceof t},c._isBuffer=function(e){return e instanceof t||e instanceof Uint8Array},c._transformPrivateKey=function(e){l.checkArgument(c._isPrivateKey(e),"Must be an instance of PrivateKey");var t={};return t.point=i.getG().mul(e.bn),t.compressed=e.compressed,t.network=e.network,t},c._transformDER=function(e,t){l.checkArgument(c._isBuffer(e),"Must be a hex buffer of DER encoded public key");var n={},o,s,a,f;if(t=!!u.isUndefined(t)||t,4!==e[0]&&(t||6!==e[0]&&7!==e[0]))if(3===e[0])a=e.slice(1),o=new r(a),n=c._transformX(!0,o),n.compressed=!0;else{if(2!==e[0])throw new TypeError("Invalid DER format public key");a=e.slice(1),o=new r(a),n=c._transformX(!1,o),n.compressed=!0}else{if(a=e.slice(1,33),f=e.slice(33,65),32!==a.length||32!==f.length||65!==e.length)throw new TypeError("Length of x and y must be 32 bytes");o=new r(a),s=new r(f),n.point=new i(o,s),n.compressed=!1}return n},c._transformX=function(e,t){l.checkArgument("boolean"==typeof e,"Must specify whether y is odd or not (true or false)");var n={};return n.point=i.fromX(e,t),n},c._transformObject=function(e){var t=new r(e.x,"hex"),n=new r(e.y,"hex"),o=new i(t,n);return new c(o,{compressed:e.compressed})},c.fromPrivateKey=function(e){l.checkArgument(c._isPrivateKey(e),"Must be an instance of PrivateKey");var t=c._transformPrivateKey(e);return new c(t.point,{compressed:t.compressed,network:t.network})},c.fromDER=c.fromBuffer=function(e,t){l.checkArgument(c._isBuffer(e),"Must be a hex buffer of DER encoded public key");var n=c._transformDER(e,t);return new c(n.point,{compressed:n.compressed})},c.fromPoint=function(e,t){return l.checkArgument(e instanceof i,"First argument must be an instance of Point."),new c(e,{compressed:t})},c.fromString=function(e,n){var r=new t(e,n||"hex"),i=c._transformDER(r);return new c(i.point,{compressed:i.compressed})},c.fromX=function(e,t){var n=c._transformX(e,t);return new c(n.point,{compressed:n.compressed})},c.getValidationError=function(e){var t;try{new c(e)}catch(e){t=e}return t},c.isValid=function(e){return!c.getValidationError(e)},c.prototype.toObject=c.prototype.toJSON=function e(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}},c.prototype.toBuffer=c.prototype.toDER=function(){var e=this.point.getX(),n=this.point.getY(),r=e.toBuffer({size:32}),i=n.toBuffer({size:32}),o;if(this.compressed){var s=i[i.length-1]%2;return o=new t(s?[3]:[2]),t.concat([o,r])}return o=new t([4]),t.concat([o,r,i])},c.prototype._getID=function e(){return o.sha256ripemd160(this.toBuffer())},c.prototype.toAddress=function(e){var t=n(129);return t.fromPublicKey(this,e||this.network)},c.prototype.toString=function(){return this.toDER().toString("hex")},c.prototype.inspect=function(){return""},e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){var r=n(27),i=n(13);function o(e,t){Error.captureStackTrace&&Error.captureStackTrace(this,o),this.name="FingerprintFormatError",this.fingerprint=e,this.format=t,this.message="Fingerprint format is not supported, or is invalid: ",void 0!==e&&(this.message+=" fingerprint = "+e),void 0!==t&&(this.message+=" format = "+t)}function s(e){Error.captureStackTrace&&Error.captureStackTrace(this,s),this.name="InvalidAlgorithmError",this.algorithm=e,this.message='Algorithm "'+e+'" is not supported'}function a(e,t,n){Error.captureStackTrace&&Error.captureStackTrace(this,a),this.name="KeyParseError",this.format=t,this.keyName=e,this.innerErr=n,this.message="Failed to parse "+e+" as a valid "+t+" format key: "+n.message}function u(e,t,n){Error.captureStackTrace&&Error.captureStackTrace(this,u),this.name="SignatureParseError",this.type=e,this.format=t,this.innerErr=n,this.message="Failed to parse the given data as a "+e+" signature in "+t+" format: "+n.message}function l(e,t,n){Error.captureStackTrace&&Error.captureStackTrace(this,l),this.name="CertificateParseError",this.format=t,this.certName=e,this.innerErr=n,this.message="Failed to parse "+e+" as a valid "+t+" format certificate: "+n.message}function c(e,t){Error.captureStackTrace&&Error.captureStackTrace(this,c),this.name="KeyEncryptedError",this.format=t,this.keyName=e,this.message="The "+t+" format key "+e+" is encrypted (password-protected), and no passphrase was provided in `options`"}i.inherits(o,Error),i.inherits(s,Error),i.inherits(a,Error),i.inherits(u,Error),i.inherits(l,Error),i.inherits(c,Error),e.exports={FingerprintFormatError:o,InvalidAlgorithmError:s,KeyParseError:a,SignatureParseError:u,KeyEncryptedError:c,CertificateParseError:l}},function(e,t){errors={};class n extends Error{constructor(e){super(e||"Coding Error"),this.name="CodingError"}}errors.CodingError=n;class r extends Error{constructor(e){super("To be implemented: "+e),this.name="ToBeImplementedError"}}errors.ToBeImplementedError=r;class i extends Error{constructor(e){super(e||"Transport failure"),this.name="TransportError"}}errors.TransportError=i;class o extends Error{constructor(e){super(e||"Timed out"),this.name="TimeoutError"}}errors.TimeoutError=o;class s extends Error{constructor(e){super(e||"Intentionally Unimplemented Function"),this.name="IntentionallyUnimplementedError"}}errors.IntentionallyUnimplementedError=s,t=e.exports=errors},function(e,t,n){var r=n(389),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();e.exports=o},function(e,t,n){(function(t){var r=n(57);e.exports=o,e.exports.source=function(e){return o(null,e)},e.exports.sink=function(e){return o(e,null)};var i="undefined"==typeof setImmediate?t.nextTick:setImmediate;function o(e,t){e&&"object"==typeof e&&(t=e.source,e=e.sink);var n=[],o=[],s,a,u=new r,l;u.writable=u.readable=!0,u.write=function(e){return n.length?n.shift()(null,e):o.push(e),n.length||(a=!0),!!n.length},u.end=function(){t?o.length?g():t(s=!0,n.length?n.shift():function(){}):n.length&&n.shift()(!0)},u.source=function(e,t){o.length?(t(null,o.shift()),o.length||u.emit("drain")):((s=s||e)?t(s):n.push(t),a&&(a=!1,u.emit("drain")))},e&&(l=e(u.source)),l&&!t&&(t=l);var c=[],f=[],h=!1,p=!1,d=!1;if(u.sink=function(e){t=e,i(g)},t){u.sink(t);var m=u.pipe.bind(u);u.pipe=function(e,t){var n=m(e,t);return u.paused&&u.resume(),n}}function g(){if(p=!1,t&&!d){for(;c.length&&!u.paused;)u.emit("data",c.shift());if(!u.paused){if(h)return u.emit("end");d=!0,t(null,function e(n,r){d=!1,u.paused?(!0===n?h=n:n?u.emit("error",n):c.push(r),p=!0):n&&!0!==(s=n)?u.emit("error",n):(s=s||n)?u.emit("end"):(u.emit("data",r),d=!0,t(null,e))})}}}return u.pause=function(){return u.paused=!0,u},u.resume=function(){return u.paused=!1,g(),u},u.destroy=function(){!s&&t&&t(s=!0,function(){}),s=!0,n.length&&n.shift()(!0),u.emit("close")},u}}).call(this,n(2))},function(e,t,n){"use strict";(function(t){const r=n(9);e.exports=function(e){if(t.isBuffer(e))return new r(e).toString();if(r.isCID(e))return e.toString();if("string"!=typeof e)throw new Error("unexpected cid type: "+typeof e);return new r(e.split("/")[0]),e}}).call(this,n(0).Buffer)},function(e,t,n){e.exports=p;var r=n(27),i=n(31).Buffer,o=n(55),s=n(15),a=n(97),u=n(47),l=n(103),c=n(210),f=a.InvalidAlgorithmError,h=a.SignatureParseError;function p(e){r.object(e,"options"),r.arrayOfObject(e.parts,"options.parts"),r.string(e.type,"options.type");for(var t={},n=0;n20&&0===o[0]&&(o=o.slice(1)),s=this.part.s.data,s.length>20&&0===s[0]&&(s=s.slice(1)),this.hashAlgorithm&&"sha1"!==this.hashAlgorithm||o.length+s.length!==40)throw new Error("OpenSSH only supports DSA signatures with SHA1 hash");return t.writeBuffer(i.concat([o,s])),t.toBuffer()}if("ssh"===e&&"ecdsa"===this.type){var f=new c({}),h;o=this.part.r.data,f.writeBuffer(o),f.writePart(this.part.s),t=new c({}),0===o[0]&&(o=o.slice(1));var p=8*o.length;return 256===p?h="nistp256":384===p?h="nistp384":528===p&&(h="nistp521"),t.writeString("ecdsa-sha2-"+h),t.writeBuffer(f.toBuffer()),t.toBuffer()}throw new Error("Invalid signature format");default:throw new Error("Invalid signature data")}},p.prototype.toString=function(e){return r.optionalString(e,"format"),this.toBuffer(e).toString("base64")},p.parse=function(e,t,n){"string"==typeof e&&(e=i.from(e,"base64")),r.buffer(e,"data"),r.string(n,"format"),r.string(t,"type");var o={};o.type=t.toLowerCase(),o.parts=[];try{switch(r.ok(e.length>0,"signature must not be empty"),o.type){case"rsa":case"ed25519":return d(e,t,n,o);case"dsa":case"ecdsa":return"asn1"===n?m(e,t,n,o):"dsa"===o.type?g(e,t,n,o):y(e,t,n,o);default:throw new f(t)}}catch(e){if(e instanceof f)throw e;throw new h(t,n,e)}},p.isSignature=function(e,t){return u.isCompatible(e,p,t)},p.prototype._sshpkApiVersion=[2,1],p._oldVersionDetect=function(e){return r.func(e.toBuffer),e.hasOwnProperty("hashAlgorithm")?[2,0]:[1,0]}},function(e,t,n){var r=n(1853);e.exports={Ber:r,BerReader:r.Reader,BerWriter:r.Writer}},function(e,t,n){"use strict";function r(e,t){t|=0;for(var n=Math.max(e.length-t,0),r=Array(n),i=0;i=this.buf.length},a.prototype.finished=a.prototype.eof,a.prototype.read=function(e){i.checkArgument(!r.isUndefined(e),"Must specify a length");var t=this.buf.slice(this.pos,this.pos+e);return this.pos=this.pos+e,t},a.prototype.readAll=function(){var e=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,e},a.prototype.readUInt8=function(){var e=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,e},a.prototype.readUInt16BE=function(){var e=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,e},a.prototype.readUInt16LE=function(){var e=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,e},a.prototype.readUInt32BE=function(){var e=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,e},a.prototype.readUInt32LE=function(){var e=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,e},a.prototype.readUInt64BEBN=function(){var e=this.buf.slice(this.pos,this.pos+8),t=s.fromBuffer(e);return this.pos=this.pos+8,t},a.prototype.readUInt64LEBN=function(){var e=this.buf.readUInt32LE(this.pos),t=this.buf.readUInt32LE(this.pos+4),n=4294967296*t+e,r;if(n<=9007199254740991)r=new s(n);else{var i=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);r=new s(i,10,"le")}return this.pos=this.pos+8,r},a.prototype.readVarintNum=function(){var e=this.readUInt8();switch(e){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var t=this.readUInt64LEBN(),n=t.toNumber();if(n<=Math.pow(2,53))return n;throw new Error("number too large to retain precision - use readVarintBN");default:return e}},a.prototype.readVarLengthBuffer=function(){var e=this.readVarintNum(),t=this.read(e);return i.checkState(t.length===e,"Invalid length while reading varlength buffer. Expected to read: "+e+" and read "+t.length),t},a.prototype.readVarintBuf=function(){var e=this.buf.readUInt8(this.pos);switch(e){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}},a.prototype.readVarintBN=function(){var e=this.readUInt8();switch(e){case 253:return new s(this.readUInt16LE());case 254:return new s(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new s(e)}},a.prototype.reverse=function(){for(var e=new t(this.buf.length),n=0;n=w.outputs.length)return new t(d,"hex");for(w.outputs.length=p+1,v=0;v9007199254740991?"transaction txout satoshis greater than max safe integer":this._satoshis!==this._satoshisBN.toNumber()?"transaction txout satoshis has corrupted value":this._satoshis<0&&"transaction txout negative"},p.prototype.toObject=p.prototype.toJSON=function e(){var t={satoshis:this.satoshis};return t.script=this._scriptBuffer.toString("hex"),t},p.fromObject=function(e){return new p(e)},p.prototype.setScriptFromBuffer=function(e){this._scriptBuffer=e;try{this._script=l.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(e){if(!(e instanceof f.Script.InvalidBuffer))throw e;this._script=null}},p.prototype.setScript=function(e){if(e instanceof l)this._scriptBuffer=e.toBuffer(),this._script=e,this._script._isOutput=!0;else if(r.isString(e))this._script=l.fromString(e),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else{if(!s.isBuffer(e))throw new TypeError("Invalid argument type: script");this.setScriptFromBuffer(e)}return this},p.prototype.inspect=function(){var e;return e=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),""},p.fromBufferReader=function(e){var t={};t.satoshis=e.readUInt64LEBN();var n=e.readVarintNum();return t.script=0!==n?e.read(n):new o.Buffer([]),new p(t)},p.prototype.toBufferWriter=function(e){e||(e=new u),e.writeUInt64LEBN(this._satoshisBN);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e},e.exports=p},function(e,t,n){"use strict";const r=n(59),i=n(200);function o(e,t){r(e,i(e=>t(null,e)),e=>{e&&t(e)})}e.exports=o},function(e,t,n){e.exports={read:k,write:S};var r=n(27),i=n(103),o=n(15),s=n(31).Buffer,a=n(55),u=n(47),l=n(46),c=n(50),f=n(380),h=n(211),p=n(287),d=n(114),m=n(97),g="1.2.840.113549.1.5.13",y="1.2.840.113549.1.5.12",b={"1.2.840.113549.3.7":"3des-cbc","2.16.840.1.101.3.4.1.2":"aes128-cbc","2.16.840.1.101.3.4.1.42":"aes256-cbc"},v={};Object.keys(b).forEach(function(e){v[b[e]]=e});var w={"1.2.840.113549.2.7":"sha1","1.2.840.113549.2.9":"sha256","1.2.840.113549.2.11":"sha512"},_={};function k(e,t,n){var a=e;"string"!=typeof e&&(r.buffer(e,"buf"),e=e.toString("ascii"));for(var l=e.trim().split(/[\r\n]+/g),c,v=-1,_;!c&&v0;)_=l[--k].match(/[-]+[ ]*END ([A-Z0-9][A-Za-z0-9]+ )?(PUBLIC|PRIVATE) KEY[ ]*[-]+/);r.ok(_,"invalid PEM footer"),r.equal(c[2],_[2]);var S=c[2].toLowerCase(),E;c[1]&&(r.equal(c[1],_[1],"PEM header and footer mismatch"),E=c[1].trim()),l=l.slice(v,k+1);for(var x={},C,A,I;l=l.slice(1),c=l[0].match(/^([A-Za-z0-9-]+): (.+)$/),c;)x[c[1].toLowerCase()]=c[2];if(l=l.slice(0,-1).join(""),e=s.from(l,"base64"),x["proc-type"]){var T=x["proc-type"].split(",");if("4"===T[0]&&"ENCRYPTED"===T[1]){if("string"==typeof t.passphrase&&(t.passphrase=s.from(t.passphrase,"utf-8")),!s.isBuffer(t.passphrase))throw new m.KeyEncryptedError(t.filename,"PEM");T=x["dek-info"].split(","),r.ok(2===T.length),C=T[0].toLowerCase(),I=s.from(T[1],"hex"),A=u.opensslKeyDeriv(C,I,t.passphrase,1).key}}if(E&&"encrypted"===E.toLowerCase()){var j=new i.BerReader(e),O;j.readSequence(),j.readSequence(),O=j.offset+j.length;var P=j.readOID();if(P!==g)throw new Error("Unsupported PEM/PKCS8 encryption scheme: "+P);j.readSequence(),j.readSequence();var B=j.offset+j.length,R=j.readOID();if(R!==y)throw new Error("Unsupported PBES2 KDF: "+R);j.readSequence();var N=j.readString(i.Ber.OctetString,!0),M=j.readInt(),L="sha1";if(j.offsetp.length&&(b=p.length),g+=m.write(p.slice(y,b),g),m[g++]=10,y=b}return g+=m.write("-----END "+a+"-----\n",g),m.slice(0,g)}Object.keys(w).forEach(function(e){_[w[e]]=e})},function(e,t,n){e.exports={read:h.bind(void 0,!1,void 0),readType:h.bind(void 0,!1),write:p,readPartial:h.bind(void 0,!0),readInternal:h,keyTypeToAlg:f,algToKeyType:c};var r=n(27),i=n(31).Buffer,o=n(55),s=n(47),a=n(46),u=n(50),l=n(210);function c(e){if(r.string(e),"ssh-dss"===e)return"dsa";if("ssh-rsa"===e)return"rsa";if("ssh-ed25519"===e)return"ed25519";if("ssh-curve25519"===e)return"curve25519";if(e.match(/^ecdsa-sha2-/))return"ecdsa";throw new Error("Unknown algorithm "+e)}function f(e){if(r.object(e),"dsa"===e.type)return"ssh-dss";if("rsa"===e.type)return"ssh-rsa";if("ed25519"===e.type)return"ssh-ed25519";if("curve25519"===e.type)return"ssh-curve25519";if("ecdsa"===e.type)return"ecdsa-sha2-"+e.part.curve.data.toString();throw new Error("Unknown key type "+e.type)}function h(e,t,n,f){"string"==typeof n&&(n=i.from(n)),r.buffer(n,"buf");var h={},p=h.parts=[],d=new l({buffer:n}),m=d.readString();r.ok(!d.atEnd(),"key must have at least one part"),h.type=c(m);var g=o.info[h.type].parts.length;for(t&&"private"===t&&(g=o.privInfo[h.type].parts.length);!d.atEnd()&&p.length=1,"key must have at least one part"),r.ok(e||d.atEnd(),"leftover bytes at end of key");var y=a,b=o.info[h.type];if("private"!==t&&b.parts.length===p.length||(b=o.privInfo[h.type],y=u),r.strictEqual(b.parts.length,p.length),"ecdsa"===h.type){var v=/^ecdsa-sha2-(.+)$/.exec(m);r.ok(null!==v),r.strictEqual(v[1],p[0].data.toString())}for(var w=!0,_=0;_!e.status)}static p_connectedNames(e){const t=this._connected().map(e=>e.name);if(!e)return new Promise((e,n)=>e(t));e(null,t)}static async p_connectedNamesParm(){return(await this.p_connectedNames()).map(e=>"transport="+e).join("&")}static p_statuses(e){const t=c._transports.map(e=>({name:e.name,status:e.status}));if(!e)return new Promise((e,n)=>e(t));e(null,t)}static validFor(e,t,n){return"string"==typeof e&&(e=[e]),e&&e[0]||["store","newlisturls","newdatabase","newtable","seed"].includes(t)?e&&e.length>0?[].concat(...e.map(e=>"string"==typeof e?r.parse(e):e).map(e=>this._transports.filter(r=>r.validFor(e,t,n)).map(t=>[e,t]))):this._transports.filter(e=>e.validFor(void 0,t,n)).map(e=>[void 0,e]):(console.error("Transports.validFor called with invalid arguments: urls=",e,"func=",t),[])}static async p_urlsValidFor(e,t,n){return this.validFor(e,t,n).map(e=>e[0])}static http(){return c._connected().find(e=>"HTTP"===e.name)}static wolk(){return c._connected().find(e=>"WOLK"===e.name)}static ipfs(){return c._connected().find(e=>"IPFS"===e.name)}static webtorrent(){return c._connected().find(e=>"WEBTORRENT"===e.name)}static gun(){return c._connected().find(e=>"GUN"===e.name)}static async p_resolveNames(e){return this.mirror?Array.isArray(e)?this.gatewayUrls(e):this.gatewayUrl(url):this.namingcb?await this.namingcb(e):e}static resolveNamesWith(e){this.namingcb=e}static togglePaused(e,t){const n=this._transports.find(t=>t.name===e);n?n.togglePaused(e=>t(null,e.status)):t(void 0)}static async _p_rawstore(e,t){let n=[],r=await Promise.all(e.map(async function(e){try{s("Storing %d bytes to %s",t.length,e.name);let r=await e.p_rawstore(t);return s("Storing %d bytes to %s succeeded: %s",t.length,e.name,r),r}catch(r){return s("Storing %d bytes to %s failed: %s",t.length,e.name,r.message),void n.push(r)}}));if(r=r.filter(e=>!!e),!r.length)throw s("Storing %d bytes failed on all transports",t.length),new i.TransportError(n.map(e=>e.message).join(", "));return r}static async p_rawstore(e){let t=this.validFor(void 0,"store").map(([e,t])=>t);if(!t.length)throw s("Storing %d bytes failed: no transports available",e.length),new i.TransportError("Transports.p_rawstore: Cant find transport for store");return this._p_rawstore(t,e)}static async p_rawfetch(e,t={}){if(!e.length)throw new i.TransportError("Transports.p_rawfetch given an empty list of urls");let n=await this.p_resolveNames(e);if(!n.length)throw new i.TransportError("Transports.p_rawfetch none of the urls resolved: "+e);let r=this.validFor(n,"fetch",{noCache:t.noCache});if(!r.length)throw new i.TransportError("Transports.p_rawfetch cant find any transport for urls: "+n);let o=[],a=[];for(const[e,n]of r)try{s("Fetching %s via %s",e.href,n.name);let r=await n.p_rawfetch(e,t);return s("Fetching %s via %s succeeded %d bytes",e.href,n.name,r.length),t.relay&&a.length&&(s("Fetching attempting relay of %d bytes from %s to %o",r.length,e.href,a.map(e=>e.name)),this._p_rawstore(a,r).then(e=>s("Fetching relayed %d bytes to %o",r.length,e))),r}catch(t){a.push(n),o.push(t),s("Fetching %s via %s failed: %s",e.href,n.name,t.message)}throw s("Fetching %o failed on all transports",e),new i.TransportError(o.map(e=>e.message).join(", "))}static fetch(e,t={},n){"function"==typeof t&&(n=t,t={});const r=this.p_rawfetch(e,t);if(!n)return r;r.then(e=>{try{n(null,e)}catch(e){s("Uncaught error in fetch %O",e)}}).catch(e=>n(e))}static seed({directoryPath:e,fileRelativePath:t,ipfsHash:n,urlToFile:r,torrentRelativePath:i},o){if(!o)return new Promise((e,t)=>{try{a.call(this,(n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{a.call(this,o)}catch(e){o(e)}function a(o){let a=this.validFor(void 0,"seed").map(([e,t])=>t);if(a.length){const s={};u(a,(o,a)=>o.seed({directoryPath:e,torrentRelativePath:i,fileRelativePath:t,ipfsHash:n,urlToFile:r},(e,t)=>{s[o.name]=e?{err:e.message}:t,a(null)}),e=>o(null,s))}else s("Seeding: no transports available"),o(null)}}static async p_rawlist(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"list");if(!t.length)throw new i.TransportError('Transports.p_rawlist: Cant find transport to "list" urls:'+e.join(","));let n=[],r=await Promise.all(t.map(async function([e,t]){try{s("Listing %s via %s",e,t.name);let r=await t.p_rawlist(e);return s("Listing %s via %s retrieved %d items",e,t.name,r.length),r}catch(r){return s("Listing %s via %s failed: %s",e,t.name,r.message),n.push(r),[]}}));if(n.length>=t.length)throw s("Listing %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "));let o={};return[].concat(...r).filter(e=>!o[e.signature]&&(o[e.signature]=!0))}static async p_rawadd(e,t){e=await this.p_resolveNames(e);let n=this.validFor(e,"add");if(!n.length)throw s("Adding to %o failed: no transports available",e),new i.TransportError("Transports.p_rawstore: Cant find transport for urls:"+e.join(","));let r=[];if(await Promise.all(n.map(async function([e,n]){try{return s("Adding to %s via %s",e,n.name),await n.p_rawadd(e,t),void s("Adding to %s via %s succeeded",e,n.name)}catch(t){return s("Adding to %s via %s failed: %s",e,n.name,t.message),void r.push(t)}})),r.length>=n.length)throw s("Adding to %o failed on all transports",e),new i.TransportError(r.map(e=>e.message).join(", "))}static listmonitor(e,t,n={}){this.validFor(e,"listmonitor").map(([e,r])=>{r.listmonitor(e,t,n),s("Monitoring list %s via %s",e,r.name)})}static async p_newlisturls(e){let t=await Promise.all(this.validFor(void 0,"newlisturls").map(([t,n])=>n.p_newlisturls(e)));return[t.map(e=>e[0]),t.map(e=>e[1])]}static async p_f_createReadStream(e,{wanturl:t=!1,preferredTransports:n=[]}={}){let r=this.validFor(e,"createReadStream",{});if(!r.length)throw s("Opening stream from %o failed: no transports available",e),new i.TransportError("Transports.p_createReadStream cant find any transport for urls: "+e);let o=[];r.sort((e,t)=>(n.indexOf(e[1].name)+1||999+Math.random())-(n.indexOf(t[1].name)+1||999+Math.random()));for(const[e,n]of r)try{s("Opening stream from %s via %s",e.href,n.name);let r=await n.p_f_createReadStream(e,{wanturl:t});return s("Opening stream from %s via %s succeeded",e.href,n.name),r}catch(t){o.push(t),s("Opening stream from %s via %s failed: %s",e.href,n.name,t.message)}throw s("Opening stream from %o failed on all transports",e),new i.TransportError(o.map(e=>e.message).join(", "))}static createReadStream(e,t,n){"function"==typeof t&&(n=t,t={start:0}),DwebTransports.p_f_createReadStream(e,{preferredTransports:t.preferredTransports||[]}).then(e=>{let r=e(t);if(!n)return r;n(null,r)}).catch(e=>{e instanceof i.TransportError?console.warn("Transports.createReadStream caught",e.message):console.error("Transports.createReadStream caught",e),n?n(e):reject(e)})}static async p_get(e,t){let n=this.validFor(e,"get"),r=Array.isArray(t)?`${t.length} keys`:t;if(!n.length)throw s("Getting %s from %o failed: no transports available",r,e),new i.TransportError("Transports.p_get cant find any transport to get keys from urls: "+e);let o=[];for(const[e,i]of n)try{s("Getting %s from %s via %s",r,e.href,i.name);let n=await i.p_get(e,t);return s("Getting %s from %s via %s succeeded length=%d",r,e.href,i.name,n.length),n}catch(t){o.push(t),s("Getting %s from %s via %s failed: %s",r,e.href,i.name,t.message)}throw s("Getting %s from %o failed on all transports",r,e),new i.TransportError(o.map(e=>e.message).join(", "))}static async p_set(e,t,n){e=await this.p_resolveNames(e);let r="object"==typeof t?`${t.length} keys`:t,o=this.validFor(e,"set");if(!o.length)throw s("Setting %s on %o failed: no transports available",r,e),new i.TransportError("Transports.p_set cant find any transport for urls: "+e);let a=[],u=!1;if(await Promise.all(o.map(async function([e,i]){try{s("Setting %s on %s via %s",r,e.href,i.name),await i.p_set(e,t,n),s("Setting %s on %s via %s succeeded",r,e.href,i.name),u=!0}catch(t){s("Setting %s on %s via %s failed: %s",r,e.href,i.name,t.message),a.push(t)}})),!u)throw s("Setting %s on %o failed on all transports",r,e),new i.TransportError(a.map(e=>e.message).join(", "))}static async p_delete(e,t){e=await this.p_resolveNames(e);let n=Array.isArray(t)?`${t.length} keys`:t,r=this.validFor(e,"set");if(!r.length)throw s("Deleting %s on %o failed: no transports available",n,e),new i.TransportError("Transports.p_set cant find any transport for urls: "+e);let o=[],a=!1;if(await Promise.all(r.map(async function([e,r]){try{s("Deleting %s on %s via %s",n,e.href,r.name),await r.p_delete(e,t),s("Deleting %s on %s via %s succeeded",n,e.href,r.name),a=!0}catch(t){s("Deleting %s on %s via %s failed: %s",n,e.href,r.name,t.message),o.push(t)}})),!a)throw s("Deleting %s on %o failed on all transports",n,e),new i.TransportError(o.map(e=>e.message).join(", "))}static async p_keys(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"keys");if(!t.length)throw s("Getting all keys on %o failed: no transports available",e),new i.TransportError("Transports.p_keys cant find any transport for urls: "+e);let n=[];for(const[e,r]of t)try{s("Getting all keys on %s via %s",e.href,r.name);let t=await r.p_keys(e);return s("Getting all keys on %s via %s succeeded with %d keys",e.href,r.name,t.length),t}catch(t){n.push(t),s("Getting all keys on %s via %s failed: %s",e.href,r.name,t.message)}throw s("Getting all keys on %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "))}static async p_getall(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"getall");if(!t.length)throw s("Getting all values on %o failed: no transports available",e),new i.TransportError("Transports.p_getall cant find any transport for urls: "+e);let n=[];for(const[e,r]of t)try{s("Getting all values on %s via %s",e.href,r.name);let t=await r.p_getall(e);return s("Getting all values on %s via %s succeeded with %d values",e.href,r.name,t.length),t}catch(t){n.push(t),s("Getting all values on %s via %s failed: %s",e.href,r.name,t.message)}throw s("Getting all keys on %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "))}static async p_newdatabase(e){let t=await Promise.all(this.validFor(void 0,"newdatabase").map(([t,n])=>n.p_newdatabase(e)));return{privateurls:t.map(e=>e.privateurl),publicurls:t.map(e=>e.publicurl)}}static async p_newtable(e,t){let n=await Promise.all(this.validFor(void 0,"newtable").map(([n,r])=>r.p_newtable(e,t)));return{privateurls:n.map(e=>e.privateurl),publicurls:n.map(e=>e.publicurl)}}static async p_connection(e){e=await this.p_resolveNames(e),await Promise.all(this.validFor(e,"connection").map(([e,t])=>t.p_connection(e)))}static monitor(e,t,{current:n=!1}={}){this.validFor(e,"monitor").map(([e,r])=>{s("Monitoring table %s via %s",e,r.name),r.monitor(e,t,{current:n})})}static addtransport(e){c._transports.push(e)}static setup0(e,t,n){let r={http:{urlbase:"http://localhost:4244"}};return e.map(e=>{let n=this._transportclasses["LOCAL"===e?"HTTP":e];return n?(s("Setting up connection to %s with options %o",e,t),n.setup0("LOCAL"===e?r:t)):void s("Connection to %s unavailable",e)}).filter(e=>!!e)}static p_setup1(e,t){const n=Promise.all(this._transports.filter(e=>!this._optionspaused.includes(e.name)).map(t=>(s("Connection stage 1 to %s",t.name),t.p_setup1(e))));if(!t)return n;n.catch(e=>t(e)).then(e=>t(null,e))}static p_setup2(e,t){const n=Promise.all(this._transports.filter(e=>!this._optionspaused.includes(e.name)).map(t=>(s("Connection stage 2 to %s",t.name),t.p_setup2(e))));if(!t)return n;n.catch(e=>t(e)).then(e=>t(null,e))}static p_stop(e,t){if(!t)return new Promise((e,t)=>{try{n.call(this,(n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{n.call(this,t)}catch(e){t(e)}function n(t){l(this._connected(),(t,n)=>{s("Stopping %s",t.name),t.stop(e,n)},t)}}static async refreshstatus(e){let t=["transportstatus0","transportstatus1","transportstatus2","transportstatus3","transportstatus4"],n=e.statuselement;n&&(n.classList.remove(...t),n.classList.add(t[e.status])),c.statuscb&&c.statuscb(e)}static connect(e,t){const n=this.p_connect(e);if(!t)return n;n.catch(e=>t(e)).then(e=>t(null,e))}static async p_connect(e){try{e=e||{};let t=e.transports;this._optionspaused=(e.paused||[]).map(e=>e.toUpperCase()),t&&t.length||(t=e.defaulttransports||[]),t.length||(t=["HTTP","IPFS","WEBTORRENT","WOLK"]),t=t.map(e=>e.toUpperCase());let n=this.setup0(t,e);if(["statuscb","mirror"].forEach(t=>{e[t]&&(this[t]=e[t])}),e.statuselement){let t=e.statuselement;for(;t.lastChild;)t.removeChild(t.lastChild);t.appendChild(o.createElement("UL",{},n.map(e=>{let t=o.createElement("LI",{onclick:"this.source.togglePaused(DwebTransports.refreshstatus);",source:e,name:e.name},e.name);return e.statuselement=t,t})))}await this.p_setup1(this.refreshstatus),await this.p_setup2(this.refreshstatus),s("Connection completed to %o",this._connected().map(e=>e.name))}catch(e){throw console.error("ERROR in p_connect:",e.message),e}}static async p_urlsFrom(e){if("string"==typeof e&&(e="["===e[0]?JSON.parse(e):e.includes(",")?e.split(","):[e]),!Array.isArray(e))throw new Error(`Unparsable url: ${e}`);return e}static async p_httpfetchurl(e){return c.http()._url(e.find(e=>e.startsWith("contenthash")||e.startsWith("http")),"content/rawfetch")}static canonicalName(e,t={}){"string"!=typeof e&&(e=r.parse(e).href);const n=["dweb.me","ipfs.io"],i=["ipfs","gun","magnet","yjs","wolk","arc","contenthash","http","https"],o=["arc","http","https"],s=[/^http[s]?:[/]+([^/]+)[/](\w+)[/](.*)/i],a=[/^dweb:[/]+(\w+)[/]+(.*)/i,/^\w+:[/]+(\w+)[/](.*)/i,/^(\w+):[/]*(.*)/i,/^[/]*(\w+)[/](.*)/i,/^[/]*dweb[/]*(\w+)[/](.*)/i],u=[/^http[s]?:[/]+[^/]+[/](archive).(org)[/]*(.*)/i,/^http[s]?:[/]+[^/]+[/]arc[/](archive).(org)[/]*(.*)/i,/^http[s]?:[/]+dweb.(\w+)[.]([^/]+)[/]*(.*)/i,/^(http[s])?:[/]+([^/]+)[/]+(.*)/i];for(let t of s){let r=e.match(t);if(r&&n.includes(r[1])&&i.includes(r[2]))return{proto:r[2],internal:r[3]}}for(let t of u){let n=e.match(t);if(n)return i.includes(n[1])?{proto:n[1],internal:o.includes(n[1])?[n[2],n[3]].join("/"):n[3]}:{proto:"arc",internal:[[n[1],n[2]].join("."),n[3]].join("/")}}for(let t of a){let n=e.match(t);if(n&&i.includes(n[1]))return{proto:n[1],internal:n[2]}}}static canonicalUrl(e,t={}){let n=this.canonicalName(e,t);return n.protocol+":/"+n.internal}static _o2url(e){return["http","https"].includes(e.proto)?[e.proto,e.internal].join("://"):e.proto?[this.mirror,e.proto,e.internal].join("/"):e.internal}static gatewayUrl(e){let t=c.canonicalName(e);return t?this._o2url(t):e}static gatewayUrls(e){const t=e.map(e=>c.canonicalName(e)||{proto:void 0,internal:e}),n=t.filter(e=>["arc"].includes(e.proto));return(n.length?n:t).map(e=>this._o2url(e))}}c._transports=[],c.namingcb=void 0,c._transportclasses={},c.httptools=a,t=e.exports=c},function(e,t,n){"use strict";var r=n(10),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=f;var o=n(7);o.inherits=n(1);var s=n(431),a=n(303);o.inherits(f,s);for(var u=i(a.prototype),l=0;l`}toJSON(){return this._json||(this._json=Object.freeze({name:this.name,size:this.size,cid:this._cid.toBaseEncodedString()})),Object.assign({},this._json)}get name(){return this._name}get nameAsBuffer(){return null!==this._nameBuf?this._nameBuf:(this._nameBuf=r.from(this._name),this._nameBuf)}set name(e){throw new Error("Can't set property: 'name' is immutable")}get size(){return this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}get cid(){return this._cid}set cid(e){throw new Error("Can't set property: 'cid' is immutable")}}t=e.exports=s(a,{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"}),t.create=n(885),t.util=n(886)}).call(this,n(0).Buffer)},function(e,t,n){var r=n(19);e.exports=r.md=r.md||{},r.md.algorithms=r.md.algorithms||{}},function(e,t,n){var r=n(4).Buffer,i=n(57).Transform,o=n(16).StringDecoder,s=n(1);function a(e){i.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}s(a,i),a.prototype.update=function(e,t,n){"string"==typeof e&&(e=r.from(e,t));var i=this._update(e);return this.hashMode?this:(n&&(i=this._toString(i,n)),i)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(e,t,n){var r;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){r=e}finally{n(r)}},a.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},a.prototype._finalOrDigest=function(e){var t=this.__final()||r.alloc(0);return e&&(t=this._toString(t,e,!0)),t},a.prototype._toString=function(e,t,n){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var r=this._decoder.write(e);return n&&(r+=this._decoder.end()),r},e.exports=a},function(e,t,n){"use strict";const r=n(5),i=(e,t)=>{const n=["bitswap"];t&&n.push(t),e&&n.push(`${e.toB58String().slice(0,8)}`);const i=r(n.join(":"));return i.error=r(n.concat(["error"]).join(":")),i},o=(e,t,n)=>{let r=0;const i=n.length;for(;r{let n=0;const r=t.length,i=[];let s;for(;nt.reduce((t,n)=>{const r=e(n);return t[r]?t[r].push(n):t[r]=[n],t},{}),u=(e,t,n)=>t.filter(t=>!o(e,t,n)),l=(e,t)=>Array.prototype.slice.call(t,0).sort((t,n)=>{const r=e(t),i=e(n);return ri?1:0});e.exports={logger:i,includesWith:o,uniqWith:s,groupBy:a,pullAllWith:u,sortBy:l}},function(e,t,n){var r=n(1004),i=n(1007);function o(e,t){var n=i(e,t);return r(n)?n:void 0}e.exports=o},function(e,t,n){var r=n(490),i=n(73),o=n(256),s=n(257);function a(e){var t=0;return function(n,r,i){t++||e(n,r,i)}}function u(e){return"function"==typeof e}e.exports=function(e,t){u(e)&&(t=e,e={}),t=a(t||function e(){});var n=r(e&&e.timeout||5e3),l=i(function(e){e&&t(e)}),c=s();return{handshake:{read:n.read,abort:function(e){l.end(e),n.abort(e,function(e){}),t(e)},write:l.push,rest:function(){return l.end(),{source:n.read(),sink:c.sink}}},sink:n,source:o([l,c.source])}}},function(e,t,n){"use strict";(function(t){const r=n(12),i=n(43),o=n(81),s=n(78),a=n(77),u=n(9),l=n(1245).createResolver;function c(e){let n=e,r="/";if(t.isBuffer(e)&&(n=new u(e).toBaseEncodedString()),"string"==typeof e){0===e.indexOf("/ipfs/")&&(e=n=e.substring(6));const t=e.indexOf("/");t>0&&(n=e.substring(0,t),r=e.substring(t))}else u.isCID(n)&&(n=n.toBaseEncodedString());return n=new u(n).toBaseEncodedString(),{base:n,rest:p(r)}}const f={maxDepth:1/0,offset:void 0,length:void 0,fullPath:!1};function h(e){return e.reduce((e,t)=>(e.length&&(e+="/"),e+t),"")}e.exports=((e,t,n)=>{let p;n=Object.assign({},f,n);try{p=c(e)}catch(e){return o(e)}const d=h([p.base].concat(p.rest.slice(0,p.rest.length-1))).length,m=new u(p.base);return r(i([{multihash:m.buffer,name:p.base,path:p.base,pathRest:p.rest,depth:0}]),l(t,n),s(Boolean),a(e=>({depth:e.depth,name:e.name,path:n.fullPath?e.path:g(e),size:e.size,hash:e.multihash,content:e.content,type:e.type})));function g(e){if(!p.rest.length)return e.path;let t=e.path.substring(d);return"/"===t.charAt(0)&&(t=t.substring(1)),t||(t=p.rest[p.rest.length-1]||p.base),t}});const p=(e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean)}).call(this,n(0).Buffer)},function(e,t,n){(function(t){const r=n(63),i=n(74).ec,o=new i("secp256k1"),s=n(1351),a=t.alloc(32,0),u=t.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),l=t.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex"),c=o.curve.n,f=c.shrn(1),h=o.curve.g,p="Expected Private",d="Expected Point",m="Expected Tweak",g="Expected Hash",y="Expected Signature",b="Expected Extra Data (32 bytes)";function v(e){return t.isBuffer(e)&&32===e.length}function w(e){return!!v(e)&&e.compare(u)<0}function _(e){if(!t.isBuffer(e))return!1;if(e.length<33)return!1;const n=e[0],r=e.slice(1,33);if(0===r.compare(a))return!1;if(r.compare(l)>=0)return!1;if((2===n||3===n)&&33===e.length){try{T(e)}catch(e){return!1}return!0}const i=e.slice(33);return 0!==i.compare(a)&&(!(i.compare(l)>=0)&&(4===n&&65===e.length))}function k(e){return 4!==e[0]}function S(e){return!!_(e)&&k(e)}function E(e){return!!v(e)&&(e.compare(a)>0&&e.compare(u)<0)}function x(e){const n=e.slice(0,32),r=e.slice(32,64);return t.isBuffer(e)&&64===e.length&&n.compare(u)<0&&r.compare(u)<0}function C(e,t){return void 0===e&&void 0!==t?k(t):void 0===e||e}function A(e){return new r(e)}function I(e){return e.toArrayLike(t,"be",32)}function T(e){return o.curve.decodePoint(e)}function j(e,n){return t.from(e._encode(n))}function O(e,t,n){if(!_(e))throw new TypeError(d);if(!_(t))throw new TypeError(d);const r=T(e),i=T(t),o=r.add(i);if(o.isInfinity())return null;const s=C(n,e);return j(o,s)}function P(e,t,n){if(!_(e))throw new TypeError(d);if(!w(t))throw new TypeError(m);const r=C(n,e),i=T(e);if(0===t.compare(a))return j(i,r);const o=A(t),s=h.mul(o),u=i.add(s);return u.isInfinity()?null:j(u,r)}function B(e,t){if(!_(e))throw new TypeError(d);const n=T(e);if(n.isInfinity())throw new TypeError(d);return j(n,t)}function R(e,t){if(!E(e))throw new TypeError(p);const n=A(e),r=h.mul(n);if(r.isInfinity())return null;const i=C(t);return j(r,i)}function N(e,t,n){if(!_(e))throw new TypeError(d);if(!w(t))throw new TypeError(m);const r=C(n,e),i=T(e),o=A(t),s=i.mul(o);return s.isInfinity()?null:j(s,r)}function M(e,t){if(!E(e))throw new TypeError(p);if(!w(t))throw new TypeError(m);const n=A(e),r=A(t),i=I(n.add(r).umod(c));return E(i)?i:null}function L(e,t){if(!E(e))throw new TypeError(p);if(!w(t))throw new TypeError(m);const n=A(e),r=A(t),i=I(n.sub(r).umod(c));return E(i)?i:null}function F(e,t){return U(e,t)}function D(e,t,n){return U(e,t,n)}function U(e,n,r){if(!v(e))throw new TypeError(g);if(!E(n))throw new TypeError(p);if(void 0!==r&&!v(r))throw new TypeError(b);const i=A(n),o=A(e);let a,u;const l=function(e){const t=A(e),n=h.mul(t);return!n.isInfinity()&&(a=n.x.umod(c),0!==a.isZero()&&(u=t.invm(c).mul(o.add(i.mul(a))).umod(c),0!==u.isZero()))};s(e,n,l,E,r),u.cmp(f)>0&&(u=c.sub(u));const d=t.allocUnsafe(64);return I(a).copy(d,0),I(u).copy(d,32),d}function z(e,t,n){if(!v(e))throw new TypeError(g);if(!_(t))throw new TypeError(d);if(!x(n))throw new TypeError(y);const r=T(t),i=A(n.slice(0,32)),o=A(n.slice(32,64));if(i.gtn(0)<=0)return!1;if(o.gtn(0)<=0)return!1;const s=A(e),a=o.invm(c),u=s.mul(a).umod(c),l=i.mul(a).umod(c),f=h.mulAdd(u,r,l);if(f.isInfinity())return!1;const p=f.x,m=p.umod(c);return m.eq(i)}e.exports={isPoint:_,isPointCompressed:S,isPrivate:E,pointAdd:O,pointAddScalar:P,pointCompress:B,pointFromScalar:R,pointMultiply:N,privateAdd:M,privateSub:L,sign:F,signWithEntropy:D,verify:z}}).call(this,n(0).Buffer)},function(e,t){function n(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:function(){let e=n.call(this);return this[t]=e,e},set:function(e){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}})}function r(e){let t;return function(){return void 0!==t?t:(t=e(),t)}}e.exports={prop:n,value:r}},function(e,t,n){"use strict";t.ethAccountSnapshot=n(586),t.ethBlock=n(591),t.ethBlockList=n(1416),t.ethStateTrie=n(1417),t.ethStorageTrie=n(1420),t.ethTx=n(593),t.ethTxTrie=n(1423)},function(e,t,n){(function(e){!function(e,t){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(null!==e&&"object"==typeof e&&Array.isArray(e.words))return e;this.sign=!1,this.words=null,this.length=0,this.red=null,"le"!==t&&"be"!==t||(n=t,t=10),null!==e&&this._init(e||0,t||10,n||"be")}function o(e,t,n){for(var r=0,i=Math.min(e.length,n),o=t;o=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function s(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function e(t,r,i){if("number"==typeof t)return this._initNumber(t,r,i);if("object"==typeof t)return this._initArray(t,r,i);"hex"===r&&(r=16),n(r===(0|r)&&r>=2&&r<=36),t=t.toString().replace(/\s+/g,"");var o=0;"-"===t[0]&&o++,16===r?this._parseHex(t,o):this._parseBase(t,r,o),"-"===t[0]&&(this.sign=!0),this.strip(),"le"===i&&this._initArray(this.toArray(),r,i)},i.prototype._initNumber=function e(t,r,i){t<0&&(this.sign=!0,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),r,i)},i.prototype._initArray=function e(t,r,i){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var o=0;o=0;o-=3){var u=t[o]|t[o-1]<<8|t[o-2]<<16;this.words[a]|=u<>>26-s&67108863,s+=24,s>=26&&(s-=26,a++)}else if("le"===i)for(var o=0,a=0;o>>26-s&67108863,s+=24,s>=26&&(s-=26,a++)}return this.strip()},i.prototype._parseHex=function e(t,n){this.length=Math.ceil((t.length-n)/6),this.words=new Array(this.length);for(var r=0;r=n;r-=6){var a=o(t,r,r+6);this.words[s]|=a<>>26-i&4194303,i+=24,i>=26&&(i-=26,s++)}if(r+6!==n){var a=o(t,n,r+6);this.words[s]|=a<>>26-i&4194303}this.strip()},i.prototype._parseBase=function e(t,n,r){this.words=[0],this.length=1;for(var i=0,o=1;o<=67108863;o*=n)i++;i--,o=o/n|0;for(var a=t.length-r,u=a%i,l=Math.min(a,a-u)+r,c=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function e(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function e(){return(this.red?""};var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function e(t,r){if(t=t||10,16===t||"hex"===t){for(var i="",o=0,r=0|r||1,s=0,c=0;c>>24-o&16777215,i=0!==s||c!==this.length-1?a[6-h.length]+h+i:h+i,o+=2,o>=26&&(o-=26,c--)}for(0!==s&&(i=s.toString(16)+i);i.length%r!=0;)i="0"+i;return this.sign&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var p=u[t],d=l[t],i="",m=this.clone();for(m.sign=!1;0!==m.cmpn(0);){var g=m.modn(d).toString(t);m=m.idivn(d),i=0!==m.cmpn(0)?a[p-g.length]+g+i:g+i}return 0===this.cmpn(0)&&(i="0"+i),this.sign&&(i="-"+i),i}n(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function e(){return this.toString(16)},i.prototype.toArray=function e(t){this.strip();var n=new Array(this.byteLength());n[0]=0;var r=this.clone();if("le"!==t)for(var i=0;0!==r.cmpn(0);i++){var o=r.andln(255);r.ishrn(8),n[n.length-i-1]=o}else for(var i=0;0!==r.cmpn(0);i++){var o=r.andln(255);r.ishrn(8),n[i]=o}return n},Math.clz32?i.prototype._countBits=function e(t){return 32-Math.clz32(t)}:i.prototype._countBits=function e(t){var n=t,r=0;return n>=4096&&(r+=13,n>>>=13),n>=64&&(r+=7,n>>>=7),n>=8&&(r+=4,n>>>=4),n>=2&&(r+=2,n>>>=2),r+n},i.prototype._zeroBits=function e(t){if(0===t)return 26;var n=t,r=0;return 0==(8191&n)&&(r+=13,n>>>=13),0==(127&n)&&(r+=7,n>>>=7),0==(15&n)&&(r+=4,n>>>=4),0==(3&n)&&(r+=2,n>>>=2),0==(1&n)&&r++,r},i.prototype.bitLength=function e(){var t=0,n=this.words[this.length-1],t=this._countBits(n);return 26*(this.length-1)+t},i.prototype.zeroBits=function e(){if(0===this.cmpn(0))return 0;for(var t=0,n=0;nt.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.iand=function e(t){var n;this.sign=this.sign&&t.sign,n=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.ixor=function e(t){var n,r;this.sign=this.sign||t.sign,this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.setn=function e(t,r){n("number"==typeof t&&t>=0);for(var i=t/26|0,o=t%26;this.length<=i;)this.words[this.length++]=0;return this.words[i]=r?this.words[i]|1<t.length?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>>26}for(;0!==o&&s>>26}if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function e(t){if(t.sign){t.sign=!1;var n=this.iadd(t);return t.sign=!0,n._normSign()}if(this.sign)return this.sign=!1,this.iadd(t),this.sign=!0,this._normSign();var r=this.cmp(t),i,o;if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;r>0?(i=this,o=t):(i=t,o=this);for(var s=0,a=0;a>26,this.words[a]=67108863&n}for(;0!==s&&a>26,this.words[a]=67108863&n}if(0===s&&a>>26,s=67108863&r,a=Math.min(i,t.length-1),u=Math.max(0,i-this.length+1);u<=a;u++){var l=i-u,c=0|this.words[l],f=0|t.words[u],h=c*f,p=67108863&h;o=o+(h/67108864|0)|0,p=p+s|0,s=67108863&p,o=o+(p>>>26)|0}n.words[i]=s,r=o}return 0!==r?n.words[i]=r:n.length--,n.strip()},i.prototype._bigMulTo=function e(t,n){n.sign=t.sign!==this.sign,n.length=this.length+t.length;for(var r=0,i=0,o=0;o>>26)|0,i+=s>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()},i.prototype.mulTo=function e(t,n){var r;return r=this.length+t.length<63?this._smallMulTo(t,n):this._bigMulTo(t,n),r},i.prototype.mul=function e(t){var n=new i(null);return n.words=new Array(this.length+t.length),this.mulTo(t,n)},i.prototype.imul=function e(t){if(0===this.cmpn(0)||0===t.cmpn(0))return this.words[0]=0,this.length=1,this;var n=this.length,r=t.length;this.sign=t.sign!==this.sign,this.length=this.length+t.length,this.words[this.length-1]=0;for(var i=this.length-2;i>=0;i--){for(var o=0,s=0,a=Math.min(i,r-1),u=Math.max(0,i-n+1);u<=a;u++){var l=i-u,c=this.words[l],f=t.words[u],h=c*f,p=67108863&h;o+=h/67108864|0,p+=s,s=67108863&p,o+=p>>>26}this.words[i]=s,this.words[i+1]+=o,o=0}for(var o=0,l=1;l>>26}return this.strip()},i.prototype.imuln=function e(t){n("number"==typeof t);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),this},i.prototype.muln=function e(t){return this.clone().imuln(t)},i.prototype.sqr=function e(){return this.mul(this)},i.prototype.isqr=function e(){return this.mul(this)},i.prototype.ishln=function e(t){n("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){for(var s=0,a=0;a>>26-r}s&&(this.words[a]=s,this.length++)}if(0!==i){for(var a=this.length-1;a>=0;a--)this.words[a+i]=this.words[a];for(var a=0;a=0),o=r?(r-r%26)/26:0;var s=t%26,a=Math.min((t-s)/26,this.length),u=67108863^67108863>>>s<a){this.length-=a;for(var c=0;c=0&&(0!==f||c>=o);c--){var h=this.words[c];this.words[c]=f<<26-s|h>>>s,f=h&u}return l&&0!==f&&(l.words[l.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function e(t){return this.clone().ishln(t)},i.prototype.shrn=function e(t){return this.clone().ishrn(t)},i.prototype.testn=function e(t){n("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,o=1<=0);var r=t%26,i=(t-r)/26;if(n(!this.sign,"imaskn works only with positive numbers"),0!==r&&i++,this.length=Math.min(i,this.length),0!==r){var o=67108863^67108863>>>r<=67108864;n++)this.words[n]-=67108864,n===this.length-1?this.words[n+1]=1:this.words[n+1]++;return this.length=Math.max(this.length,n+1),this},i.prototype.isubn=function e(t){if(n("number"==typeof t),t<0)return this.iaddn(-t);if(this.sign)return this.sign=!1,this.iaddn(t),this.sign=!0,this;this.words[0]-=t;for(var r=0;r>26)-(c/67108864|0),this.words[s+i]=67108863&l}for(;s>26,this.words[s+i]=67108863&l}if(0===u)return this.strip();n(-1===u),u=0;for(var s=0;s>26,this.words[s]=67108863&l}return this.sign=!0,this.strip()},i.prototype._wordDiv=function e(t,n){var r=this.length-t.length,o=this.clone(),s=t,a=s.words[s.length-1],u=this._countBits(a);r=26-u,0!==r&&(s=s.shln(r),o.ishln(r),a=s.words[s.length-1]);var l=o.length-s.length,c;if("mod"!==n){c=new i(null),c.length=l+1,c.words=new Array(c.length);for(var f=0;f=0;p--){var d=67108864*o.words[s.length+p]+o.words[s.length+p-1];for(d=Math.min(d/a|0,67108863),o._ishlnsubmul(s,d,p);o.sign;)d--,o.sign=!1,o._ishlnsubmul(s,1,p),0!==o.cmpn(0)&&(o.sign=!o.sign);c&&(c.words[p]=d)}return c&&c.strip(),o.strip(),"div"!==n&&0!==r&&o.ishrn(r),{div:c||null,mod:o}},i.prototype.divmod=function e(t,r){if(n(0!==t.cmpn(0)),this.sign&&!t.sign){var o=this.neg().divmod(t,r),s,a;return"mod"!==r&&(s=o.div.neg()),"div"!==r&&(a=0===o.mod.cmpn(0)?o.mod:t.sub(o.mod)),{div:s,mod:a}}if(!this.sign&&t.sign){var o=this.divmod(t.neg(),r),s;return"mod"!==r&&(s=o.div.neg()),{div:s,mod:o.mod}}return this.sign&&t.sign?this.neg().divmod(t.neg(),r):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===r?{div:this.divn(t.words[0]),mod:null}:"mod"===r?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,r)},i.prototype.div=function e(t){return this.divmod(t,"div").div},i.prototype.mod=function e(t){return this.divmod(t,"mod").mod},i.prototype.divRound=function e(t){var n=this.divmod(t);if(0===n.mod.cmpn(0))return n.div;var r=n.div.sign?n.mod.isub(t):n.mod,i=t.shrn(1),o=t.andln(1),s=r.cmp(i);return s<0||1===o&&0===s?n.div:n.div.sign?n.div.isubn(1):n.div.iaddn(1)},i.prototype.modn=function e(t){n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+this.words[o])%t;return i},i.prototype.idivn=function e(t){n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=this.words[i]+67108864*r;this.words[i]=o/t|0,r=o%t}return this.strip()},i.prototype.divn=function e(t){return this.clone().idivn(t)},i.prototype.egcd=function e(t){n(!t.sign),n(0!==t.cmpn(0));var r=this,o=t.clone();r=r.sign?r.mod(t):r.clone();for(var s=new i(1),a=new i(0),u=new i(0),l=new i(1),c=0;r.isEven()&&o.isEven();)r.ishrn(1),o.ishrn(1),++c;for(var f=o.clone(),h=r.clone();0!==r.cmpn(0);){for(;r.isEven();)r.ishrn(1),s.isEven()&&a.isEven()?(s.ishrn(1),a.ishrn(1)):(s.iadd(f).ishrn(1),a.isub(h).ishrn(1));for(;o.isEven();)o.ishrn(1),u.isEven()&&l.isEven()?(u.ishrn(1),l.ishrn(1)):(u.iadd(f).ishrn(1),l.isub(h).ishrn(1));r.cmp(o)>=0?(r.isub(o),s.isub(u),a.isub(l)):(o.isub(r),u.isub(s),l.isub(a))}return{a:u,b:l,gcd:o.ishln(c)}},i.prototype._invmp=function e(t){n(!t.sign),n(0!==t.cmpn(0));var r=this,o=t.clone();r=r.sign?r.mod(t):r.clone();for(var s=new i(1),a=new i(0),u=o.clone();r.cmpn(1)>0&&o.cmpn(1)>0;){for(;r.isEven();)r.ishrn(1),s.isEven()?s.ishrn(1):s.iadd(u).ishrn(1);for(;o.isEven();)o.ishrn(1),a.isEven()?a.ishrn(1):a.iadd(u).ishrn(1);r.cmp(o)>=0?(r.isub(o),s.isub(a)):(o.isub(r),a.isub(s))}return 0===r.cmpn(1)?s:a},i.prototype.gcd=function e(t){if(0===this.cmpn(0))return t.clone();if(0===t.cmpn(0))return this.clone();var n=this.clone(),r=t.clone();n.sign=!1,r.sign=!1;for(var i=0;n.isEven()&&r.isEven();i++)n.ishrn(1),r.ishrn(1);for(;;){for(;n.isEven();)n.ishrn(1);for(;r.isEven();)r.ishrn(1);var o=n.cmp(r);if(o<0){var s=n;n=r,r=s}else if(0===o||0===r.cmpn(1))break;n.isub(r)}return r.ishln(i)},i.prototype.invm=function e(t){return this.egcd(t).a.mod(t)},i.prototype.isEven=function e(){return 0==(1&this.words[0])},i.prototype.isOdd=function e(){return 1==(1&this.words[0])},i.prototype.andln=function e(t){return this.words[0]&t},i.prototype.bincn=function e(t){n("number"==typeof t);var r=t%26,i=(t-r)/26,o=1<>>26,u&=67108863,this.words[s]=u}return 0!==a&&(this.words[s]=a,this.length++),this},i.prototype.cmpn=function e(t){var n=t<0,r;if(n&&(t=-t),this.sign&&!n)return-1;if(!this.sign&&n)return 1;if(t&=67108863,this.strip(),this.length>1)r=1;else{var i=this.words[0];r=i===t?0:it.length)return 1;if(this.length=0;r--){var i=this.words[r],o=t.words[r];if(i!==o){io&&(n=1);break}}return n},i.red=function e(t){return new g(t)},i.prototype.toRed=function e(t){return n(!this.red,"Already a number in reduction context"),n(!this.sign,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function e(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function e(t){return this.red=t,this},i.prototype.forceRed=function e(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function e(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function e(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function e(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function e(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function e(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function e(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function e(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function e(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function e(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function e(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function e(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function e(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function e(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var c={k256:null,p224:null,p192:null,p25519:null};function f(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function h(){f.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function p(){f.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function d(){f.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){f.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function g(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else this.m=e,this.prime=null}function y(e){g.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}f.prototype._tmp=function e(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},f.prototype.ireduce=function e(t){var n=t,r;do{this.split(n,this.tmp),n=this.imulK(n),n=n.iadd(this.tmp),r=n.bitLength()}while(r>this.n);var i=r0?n.isub(this.p):n.strip(),n},f.prototype.split=function e(t,n){t.ishrn(this.n,0,n)},f.prototype.imulK=function e(t){return t.imul(this.k)},r(h,f),h.prototype.split=function e(t,n){for(var r=4194303,i=Math.min(t.length,9),o=0;o>>22,s=a}t.words[o-10]=s>>>22,t.length-=9},h.prototype.imulK=function e(t){var n;t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var r=0,i=0;i>>=26,t.words[r]=o,n=i}return 0!==n&&(t.words[t.length++]=n),t},i._prime=function e(t){if(c[t])return c[t];var e;if("k256"===t)e=new h;else if("p224"===t)e=new p;else if("p192"===t)e=new d;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new m}return c[t]=e,e},g.prototype._verify1=function e(t){n(!t.sign,"red works only with positives"),n(t.red,"red works only with red numbers")},g.prototype._verify2=function e(t,r){n(!t.sign&&!r.sign,"red works only with positives"),n(t.red&&t.red===r.red,"red works only with red numbers")},g.prototype.imod=function e(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.mod(this.m)._forceRed(this)},g.prototype.neg=function e(t){var n=t.clone();return n.sign=!n.sign,n.iadd(this.m)._forceRed(this)},g.prototype.add=function e(t,n){this._verify2(t,n);var r=t.add(n);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},g.prototype.iadd=function e(t,n){this._verify2(t,n);var r=t.iadd(n);return r.cmp(this.m)>=0&&r.isub(this.m),r},g.prototype.sub=function e(t,n){this._verify2(t,n);var r=t.sub(n);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},g.prototype.isub=function e(t,n){this._verify2(t,n);var r=t.isub(n);return r.cmpn(0)<0&&r.iadd(this.m),r},g.prototype.shl=function e(t,n){return this._verify1(t),this.imod(t.shln(n))},g.prototype.imul=function e(t,n){return this._verify2(t,n),this.imod(t.imul(n))},g.prototype.mul=function e(t,n){return this._verify2(t,n),this.imod(t.mul(n))},g.prototype.isqr=function e(t){return this.imul(t,t)},g.prototype.sqr=function e(t){return this.mul(t,t)},g.prototype.sqrt=function e(t){if(0===t.cmpn(0))return t.clone();var r=this.m.andln(3);if(n(r%2==1),3===r){var o=this.m.add(new i(1)).ishrn(2),s=this.pow(t,o);return s}for(var a=this.m.subn(1),u=0;0!==a.cmpn(0)&&0===a.andln(1);)u++,a.ishrn(1);n(0!==a.cmpn(0));var l=new i(1).toRed(this),c=l.redNeg(),f=this.m.subn(1).ishrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,f).cmp(c);)h.redIAdd(c);for(var p=this.pow(h,a),s=this.pow(t,a.addn(1).ishrn(1)),d=this.pow(t,a),m=u;0!==d.cmp(l);){for(var g=d,y=0;0!==g.cmp(l);y++)g=g.redSqr();n(y=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},y.prototype.mul=function e(t,n){if(0===t.cmpn(0)||0===n.cmpn(0))return new i(0)._forceRed(this);var r=t.mul(n),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(o).ishrn(this.shift),a=s;return s.cmp(this.m)>=0?a=s.isub(this.m):s.cmpn(0)<0&&(a=s.iadd(this.m)),a._forceRed(this)},y.prototype.invm=function e(t){var n=this.imod(t._invmp(this.m).mul(this.r2));return n._forceRed(this)}}(e,this)}).call(this,n(75)(e))},function(e,t,n){"use strict";var r=n(17),i=n(30),o=n(41),s=[],a={};function u(){}function l(e,t){if(~s.indexOf(e))return e;if(!t)return a[e];r.isArray(t)||(t=[t]);var n=function(t){return s[i][t]===e};for(var i in s)if(r.any(t,n))return s[i]}function c(e){var t=new u;return o.defineImmutable(t,{name:e.name,alias:e.alias,pubkeyhash:e.pubkeyhash,privatekey:e.privatekey,scripthash:e.scripthash,xpubkey:e.xpubkey,xprivkey:e.xprivkey,zaddr:e.zaddr,zkey:e.zkey}),e.networkMagic&&o.defineImmutable(t,{networkMagic:i.integerAsBuffer(e.networkMagic)}),e.port&&o.defineImmutable(t,{port:e.port}),e.dnsSeeds&&o.defineImmutable(t,{dnsSeeds:e.dnsSeeds}),r.each(t,function(e){r.isUndefined(e)||r.isObject(e)||(a[e]=t)}),s.push(t),t}function f(e){for(var t=0;t"},e.exports=f;var h=n(86)}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var r=n(1497),i=n(1498);e.exports=function e(n,o,s){if("number"!=typeof n)throw new TypeError('"size" argument must be a number');if(n<0)throw new RangeError('"size" argument must not be negative');if(t.alloc)return t.alloc(n,o,s);var a=i(n);return 0===n?a:void 0===o?r(a,0):("string"!=typeof s&&(s=void 0),r(a,o,s))}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";function r(e){return function(){if(null===e)throw new Error("Callback was already called.");var t=e;e=null,t.apply(this,arguments)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,n){var r=n(174),i=n(750),o=n(751),s="[object Null]",a="[object Undefined]",u=r?r.toStringTag:void 0;function l(e){return null==e?void 0===e?a:s:u&&u in Object(e)?i(e):o(e)}e.exports=l},function(e,t,n){var r=n(754),i=n(761),o=n(172);function s(e){return o(e)?r(e):i(e)}e.exports=s},function(e,t,n){const r=n(32),i=n(20),o=n(98);function s(e,t){return new Promise(n=>{setTimeout(()=>{n(t)},e)})}class a{constructor(e){}static setup0(e){throw new o.IntentionallyUnimplementedError("Intentionally undefined function Transport.setup0 should have been subclassed")}p_setup1(e){return this}p_setup2(e){return this}static async p_setup(e,t){let n=await this.setup0(e).p_setup1(t);return n.p_setup2(t)}stop(e,t){this.status=a.STATUS_FAILED,e&&e(this),t(null,this)}togglePaused(e){switch(this.status){case a.STATUS_CONNECTED:this.status=a.STATUS_PAUSED;break;case a.STATUS_PAUSED:this.status=a.STATUS_CONNECTED;break;case a.STATUS_LOADED:this.p_setup1(e).then(t=>t.p_setup2(e))}e&&e(this)}async p_status(){return this.status}connected(){return!this.status}supports(e,t,{noCache:n}={}){if("string"==typeof e&&(e=r.parse(e)),e&&!e.protocol)throw new Error("URL failed to specific a scheme (before :) "+e.href);return(!e||this.supportURLs.includes(e.protocol.slice(0,-1)))&&(!t||this.supportFunctions.includes(t))&&(!n||this.supportFeatures.includes("noCache"))}validFor(e,t,n){return this.connected()&&this.supports(e,t,n)}p_rawstore(e,t){throw new o.ToBeImplementedError("Intentionally undefined function Transport.p_rawstore should have been subclassed")}async p_rawstoreCaught(e){try{return await this.p_rawstore(e)}catch(e){}}p_store(){throw new o.ToBeImplementedError("Undefined function Transport.p_store - may define higher level semantics here (see Python)")}p_rawfetch(e,{timeoutMS:t,start:n,end:r,relay:i=!1}={}){return console.assert(!1,"Intentionally undefined function Transport.p_rawfetch should have been subclassed"),"UNIMPLEMENTED"}p_fetch(){throw new o.ToBeImplementedError("Undefined function Transport.p_fetch - may define higher level semantics here (see Python)")}p_rawadd(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_rawadd")}p_rawlist(e){throw new o.ToBeImplementedError("Undefined function Transport.p_rawlist")}p_list(){throw new Error("Undefined function Transport.p_list")}p_newlisturls(e){throw new Error("undefined function Transport.p_newlisturls")}p_rawreverse(e){throw new o.ToBeImplementedError("Undefined function Transport.p_rawreverse")}listmonitor(e,t,{current:n=!1}={}){console.log("Undefined function Transport.listmonitor")}async p_newdatabase(e){throw new o.ToBeImplementedError("Undefined function Transport.p_newdatabase")}async p_newtable(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_newtable")}async p_set(e,t,n){throw new o.ToBeImplementedError("Undefined function Transport.p_set")}async p_get(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_get")}async p_delete(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_delete")}async p_keys(e){throw new o.ToBeImplementedError("Undefined function Transport.p_keys")}async p_getall(e){throw new o.ToBeImplementedError("Undefined function Transport.p_keys")}static async p_f_createReadStream(e,{wanturl:t=!1}){}static mergeoptions(e){let t={};for(let n=0;n",r),console.assert("bar"===r.testkey2.foo&&2===r.testkey3[1]&&!r.testkey),await s(200),console.log(this.name,"p_test_kvt complete")}catch(e){throw console.log("Exception thrown in ",this.name,"p_test_kvt:",e.message),e}}}a.STATUS_CONNECTED=0,a.STATUS_FAILED=1,a.STATUS_STARTING=2,a.STATUS_LOADED=3,a.STATUS_PAUSED=4,a.STATUSTEXT=["Connected","Failed","Starting","Loaded","Paused"],t=e.exports=a},function(e,t,n){"use strict";function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var i={};function o(e,t,n){function o(e,n,r){return"string"==typeof t?t:t(e,n,r)}n||(n=Error);var s=function(e){function t(t,n,r){return e.call(this,o(t,n,r))||this}return r(t,e),t}(n);s.prototype.name=n.name,s.prototype.code=e,i[e]=s}function s(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return String(e)}),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}function a(e,t,n){return e.substr(!n||n<0?0:+n,t.length)===t}function u(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}function l(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}o("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),o("ERR_INVALID_ARG_TYPE",function(e,t,n){var r,i;if("string"==typeof t&&a(t,"not ")?(r="must not be",t=t.replace(/^not /,"")):r="must be",u(e," argument"))i="The ".concat(e," ").concat(r," ").concat(s(t,"type"));else{var o=l(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(o," ").concat(r," ").concat(s(t,"type"))}return i+=". Received type ".concat(typeof n),i},TypeError),o("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),o("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),o("ERR_STREAM_PREMATURE_CLOSE","Premature close"),o("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),o("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),o("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),o("ERR_STREAM_WRITE_AFTER_END","write after end"),o("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),o("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),o("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=i},function(e,t,n){"use strict";(function(t){var r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=l;var i=n(396),o=n(400);n(1)(l,i);for(var s=r(o.prototype),a=0;at){var r=new Error("Too few bytes to parse DER.");throw r.available=e.length(),r.remaining=t,r.requested=n,r}}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},i.create=function(e,t,n,o,s){if(r.util.isArray(o)){for(var a=[],u=0;ut){if(r.strict){var m=new Error("Too few bytes to read ASN.1 value.");throw m.available=e.length(),m.remaining=t,m.requested=h,m}h=t}var g=32==(32&l);if(g)if(p=[],void 0===h)for(;;){if(o(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}u=e.length(),p.push(a(e,t,n+1,r)),t-=u-e.length()}else for(;h>0;)u=e.length(),p.push(a(e,h,n+1,r)),t-=u-e.length(),h-=u-e.length();if(void 0===p&&c===i.Class.UNIVERSAL&&f===i.Type.BITSTRING&&(d=e.bytes(h)),void 0===p&&r.decodeBitStrings&&c===i.Class.UNIVERSAL&&f===i.Type.BITSTRING&&h>1){var y=e.read,b=t,v=0;if(f===i.Type.BITSTRING&&(o(e,t,1),v=e.getByte(),t--),0===v)try{u=e.length();var w={verbose:r.verbose,strict:!0,decodeBitStrings:!0},_=a(e,t,n+1,w),k=u-e.length();t-=k,f==i.Type.BITSTRING&&k++;var S=_.tagClass;k!==h||S!==i.Class.UNIVERSAL&&S!==i.Class.CONTEXT_SPECIFIC||(p=[_])}catch(e){}void 0===p&&(e.read=y,t=b)}if(void 0===p){if(void 0===h){if(r.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");h=t}if(f===i.Type.BMPSTRING)for(p="";h>0;h-=2)o(e,t,2),p+=String.fromCharCode(e.getInt16()),t-=2;else p=e.getBytes(h)}var E=void 0===d?null:{bitStringContents:d};return i.create(c,f,g,p,E)}i.fromDer=function(e,t){return void 0===t&&(t={strict:!0,decodeBitStrings:!0}),"boolean"==typeof t&&(t={strict:t,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"==typeof e&&(e=r.util.createBuffer(e)),a(e,e.length(),0,t)},i.toDer=function(e){var t=r.util.createBuffer(),n=e.tagClass|e.type,o=r.util.createBuffer(),s=!1;if("bitStringContents"in e&&(s=!0,e.original&&(s=i.equals(e,e.original))),s)o.putBytes(e.bitStringContents);else if(e.composed){e.constructed?n|=32:o.putByte(0);for(var a=0;a1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?o.putBytes(e.value.substr(1)):o.putBytes(e.value);if(t.putByte(n),o.length()<=127)t.putByte(127&o.length());else{var u=o.length(),l="";do{l+=String.fromCharCode(255&u),u>>>=8}while(u>0);t.putByte(128|l.length);for(var a=l.length-1;a>=0;--a)t.putByte(l.charCodeAt(a))}return t.putBuffer(o),t},i.oidToDer=function(e){var t=e.split("."),n=r.util.createBuffer(),i,o,s,a;n.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var u=2;u>>=7,i||(a|=128),o.push(a),i=!1}while(s>0);for(var l=o.length-1;l>=0;--l)n.putByte(o[l])}return n},i.derToOid=function(e){var t;"string"==typeof e&&(e=r.util.createBuffer(e));var n=e.getByte();t=Math.floor(n/40)+"."+n%40;for(var i=0;e.length()>0;)n=e.getByte(),i<<=7,128&n?i+=127&n:(t+="."+(i+n),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,n=parseInt(e.substr(0,2),10);n=n>=50?1900+n:2e3+n;var r=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),o=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),a=0;if(e.length>11){var u=e.charAt(10),l=10;"+"!==u&&"-"!==u&&(a=parseInt(e.substr(10,2),10),l+=2)}if(t.setUTCFullYear(n,r,i),t.setUTCHours(o,s,a,0),l&&(u=e.charAt(l),"+"===u||"-"===u)){var c=parseInt(e.substr(l+1,2),10),f=parseInt(e.substr(l+4,2),10),h=60*c+f;h*=6e4,"+"===u?t.setTime(+t-h):t.setTime(+t+h)}return t},i.generalizedTimeToDate=function(e){var t=new Date,n=parseInt(e.substr(0,4),10),r=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),u=0,l=0,c=!1;"Z"===e.charAt(e.length-1)&&(c=!0);var f=e.length-5,h=e.charAt(f);if("+"===h||"-"===h){var p=parseInt(e.substr(f+1,2),10),d=parseInt(e.substr(f+4,2),10);l=60*p+d,l*=6e4,"+"===h&&(l*=-1),c=!0}return"."===e.charAt(14)&&(u=1e3*parseFloat(e.substr(14),10)),c?(t.setUTCFullYear(n,r,i),t.setUTCHours(o,s,a,u),t.setTime(+t+l)):(t.setFullYear(n,r,i),t.setHours(o,s,a,u)),t},i.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",n=[];n.push((""+e.getUTCFullYear()).substr(2)),n.push(""+(e.getUTCMonth()+1)),n.push(""+e.getUTCDate()),n.push(""+e.getUTCHours()),n.push(""+e.getUTCMinutes()),n.push(""+e.getUTCSeconds());for(var r=0;r=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var n=new Error("Integer too large; max is 32-bits.");throw n.integer=e,n},i.derToInteger=function(e){"string"==typeof e&&(e=r.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},i.validate=function(e,t,n,o){var s=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)o&&(e.tagClass!==t.tagClass&&o.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&o.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(s=!0,t.value&&r.util.isArray(t.value))for(var a=0,u=0;s&&u0&&(o+="\n");for(var s="",a=0;a1?o+="0x"+r.util.bytesToHex(e.value.slice(1)):o+="(none)",e.value.length>0){var h=e.value.charCodeAt(0);1==h?o+=" (1 unused bit shown)":h>1&&(o+=" ("+h+" unused bits shown)")}}else e.type===i.Type.OCTETSTRING?(u.test(e.value)||(o+="("+e.value+") "),o+="0x"+r.util.bytesToHex(e.value)):e.type===i.Type.UTF8?o+=r.util.decodeUtf8(e.value):e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?o+=e.value:u.test(e.value)?o+="0x"+r.util.bytesToHex(e.value):0===e.value.length?o+="[null]":o+=e.value}return o}},function(e,t,n){var r=n(19);n(237),n(893),n(894),n(34),r.random&&r.random.getBytes?e.exports=r.random:function(t){var n={},i=new Array(4),o=r.util.createBuffer();function s(){var e=r.prng.create(n);return e.getBytes=function(t,n){return e.generate(t,n)},e.getBytesSync=function(t){return e.generate(t)},e}n.formatKey=function(e){var t=r.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),r.aes._expandKey(e,!1)},n.formatSeed=function(e){var t=r.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},n.cipher=function(e,t){return r.aes._updateBlock(e,t,i,!1),o.putInt32(i[0]),o.putInt32(i[1]),o.putInt32(i[2]),o.putInt32(i[3]),o.getBytes()},n.increment=function(e){return++e[3],e},n.md=r.md.sha256;var a=s(),u=null;if("undefined"!=typeof window){var l=window.crypto||window.msCrypto;l&&l.getRandomValues&&(u=function(e){return l.getRandomValues(e)})}if(r.options.usePureJavaScript||!r.util.isNodejs&&!u){if("undefined"==typeof window||window.document,a.collectInt(+new Date,32),"undefined"!=typeof navigator){var c="";for(var f in navigator)try{"string"==typeof navigator[f]&&(c+=navigator[f])}catch(e){}a.collect(c),c=null}t&&(t().mousemove(function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)}),t().keypress(function(e){a.collectInt(e.charCode,8)}))}if(r.random)for(var f in a)r.random[f]=a[f];else r.random=a;r.random.createInstance=s,e.exports=r.random}("undefined"!=typeof jQuery?jQuery:null)},function(e,t,n){"use strict";const r=t;r.bignum=n(63),r.define=n(904).define,r.base=n(180),r.constants=n(463),r.decoders=n(908),r.encoders=n(910)},function(e,t,n){"use strict";var r=n(1),i=n(318),o=n(469),s=n(470),a=n(119);function u(e){a.call(this,"digest"),this._hash=e}r(u,a),u.prototype._update=function(e){this._hash.update(e)},u.prototype._final=function(){return this._hash.digest()},e.exports=function e(t){return t=t.toLowerCase(),"md5"===t?new i:"rmd160"===t||"ripemd160"===t?new o:new u(s(t))}},function(e,t,n){var r=n(4).Buffer;function i(e,t){this._block=r.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}i.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=r.from(e,t));for(var n=this._block,i=this._blockSize,o=e.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(491),i=a(r),o=n(220),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default,1),e.exports=t.default},function(e,t,n){function r(e){if(e)return i(e)}function i(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},r.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+e],r;if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i1?{type:p[i],data:e.substring(1)}:{type:p[i]}:d}var s=new Uint8Array(e),i=s[0],a=o(e,1);return m&&"blob"===n&&(a=new m([a])),{type:p[i],data:a}},t.decodeBase64Packet=function(e,t){var n=p[e.charAt(0)];if(!u)return{type:n,data:{base64:!0,data:e.substr(1)}};var r=u.decode(e.substr(1));return"blob"===t&&m&&(r=new m([r])),{type:n,data:r}},t.encodePayload=function(e,n,r){"function"==typeof n&&(r=n,n=null);var o=i(e);if(n&&o)return m&&!f?t.encodePayloadAsBlob(e,r):t.encodePayloadAsArrayBuffer(e,r);if(!e.length)return r("0:");function s(e){return e.length+":"+e}function a(e,r){t.encodePacket(e,!!o&&n,!1,function(e){r(null,s(e))})}_(e,a,function(e,t){return r(t.join(""))})},t.decodePayload=function(e,n,r){if("string"!=typeof e)return t.decodePayloadAsBinary(e,n,r);var i;if("function"==typeof n&&(r=n,n=null),""===e)return r(d,0,1);for(var o="",s,a,u=0,l=e.length;u0;){for(var a=new Uint8Array(i),u=0===a[0],l="",c=1;255!==a[c];c++){if(l.length>310)return r(d,0,1);l+=a[c]}i=o(i,2+l.length),l=parseInt(l);var f=o(i,0,l);if(u)try{f=String.fromCharCode.apply(null,new Uint8Array(f))}catch(e){var h=new Uint8Array(f);f="";for(var c=0;co)throw new RangeError("requested too many random bytes");var n=a.allocUnsafe(e);if(e>0)if(e>i)for(var s=0;s{const n=r(e,t);return(e,t,r)=>{n(e,t,(e,t)=>{if(e)return r(e);r(null,t[0])})}})},function(e,t,n){"use strict";var r=n(10),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=f;var o=n(7);o.inherits=n(1);var s=n(657),a=n(660);o.inherits(f,s);for(var u=i(a.prototype),l=0;l=t)throw new Error("Cannot access property/index "+r+" levels up, current level is "+t);return n[t-r]}if(r>t)throw new Error("Cannot access data "+r+" levels up, current level is "+t);if(o="data"+(t-r||""),!i)return o}for(var a=o,u=i.split("/"),l=0;l=0||1/0===e||-1/0===e)}},t.text={is:function(e){return"string"==typeof e}},t.text.ify=function(e){return t.text.is(e)?e:"undefined"!=typeof JSON?JSON.stringify(e):e&&e.toString?e.toString():e},t.text.random=function(e,t){var n="";for(e=e||24,t=t||"0123456789ABCDEFGHIJKLMNOPQRSTUVWXZabcdefghijklmnopqrstuvwxyz";e>0;)n+=t.charAt(Math.floor(Math.random()*t.length)),e--;return n},t.text.match=function(e,t){var n,r;return"string"==typeof e&&("string"==typeof t&&(t={"=":t}),t=t||{},n=t["="]||t["*"]||t[">"]||t["<"],e===n||r===t["="]&&(n=t["*"]||t[">"]||t["<"],e.slice(0,(n||"").length)===n||r===t["*"]&&(r!==t[">"]&&r!==t["<"]?e>=t[">"]&&e<=t["<"]:r!==t[">"]&&e>=t[">"]||r!==t["<"]&&e<=t["<"])))},t.list={is:function(e){return e instanceof Array}},t.list.slit=Array.prototype.slice,t.list.sort=function(e){return function(t,n){return t&&n?(t=t[e],n=n[e],tn?1:0):0}},t.list.map=function(e,t,n){return a(e,t,n)},t.list.index=1,t.obj={is:function(e){return!!e&&(e instanceof Object&&e.constructor===Object||"Object"===Object.prototype.toString.call(e).match(/^\[object (\w+)\]$/)[1])}},t.obj.put=function(e,t,n){return(e||{})[t]=n,e},t.obj.has=function(e,t){return e&&Object.prototype.hasOwnProperty.call(e,t)},t.obj.del=function(e,t){if(e)return e[t]=null,delete e[t],e},t.obj.as=function(e,t,n,r){return e[t]=e[t]||(r===n?{}:n)},t.obj.ify=function(e){if(o(e))return e;try{e=JSON.parse(e)}catch(t){e={}}return e},function(){var e;function n(t,n){s(this,n)&&e!==this[n]||(this[n]=t)}t.obj.to=function(e,t){return t=t||{},a(e,n,t),t}}(),t.obj.copy=function(e){return e?JSON.parse(JSON.stringify(e)):e},function(){function e(e,t){var n=this.n;if(!n||!(t===n||o(n)&&s(n,t)))return!!t||void 0}t.obj.empty=function(t,n){return!t||!a(t,e,{n:n})}}(),function(){function e(t,n){if(2===arguments.length)return e.r=e.r||{},void(e.r[t]=n);e.r=e.r||[],e.r.push(t)}var i=Object.keys;t.obj.map=function(a,u,l){var c,f=0,h,p,d,m,g=n(u);if(e.r=null,i&&o(a)&&(d=i(a),m=!0),r(a)||d)for(h=(d||a).length;f",r.drift=0,r.is=function(e,t,n){var i=t&&e&&e[_]&&e[_][r._]||n;if(i)return b(i=i[t])?i:-1/0},r.lex=function(){return r().toString(36).replace(".","")},r.ify=function(e,t,i,o,s){if(!e||!e[_]){if(!s)return;e=n.soul.ify(e,s)}var a=h(e[_],r._);return k!==t&&t!==_&&(b(i)&&(a[t]=i),k!==o&&(e[t]=o)),e},r.to=function(e,t,i){var o=(e||{})[t];return d(o)&&(o=g(o)),r.ify(i,t,r.is(e,t),o,n.soul(e))},function(){function e(e,t){_!==t&&r.ify(this.o,t,this.s)}r.map=function(t,n,i){var o,s=d(s=t||n)?s:null;return t=w(t=t||n)?t:null,s&&!t?(n=b(n)?n:r(),s[_]=s[_]||{},m(s,e,{o:s,s:n}),s):(i=i||d(n)?n:o,n=b(n)?n:r(),function(r,s,a,u){if(!t)return e.call({o:a,s:n},r,s),r;t.call(i||this||{},r,s,a,u),p(a,s)&&o===a[s]||e.call({o:a,s:n},r,s)})}}();var f=t.obj,h=f.as,p=f.has,d=f.is,m=f.map,g=f.copy,y=t.num,b=y.is,v=t.fn,w=v.is,_=n._,k;e.exports=r})(o,"./state"),o(function(e){var t=o("./type"),n=o("./val"),r=o("./node"),i={};!function(){function e(e,n){if(!e||n!==r.soul(e)||!r.is(e,this.fn,this.as))return!0;this.cb&&(t.n=e,t.as=this.as,this.cb.call(t.as,e,n,t))}function t(e){e&&r.is(t.n,e,t.as)}i.is=function(t,n,r,i){return!(!t||!u(t)||f(t))&&!p(t,e,{cb:n,fn:r,as:i})}}(),function(){function e(e,t){var i;return(i=f(e,t))?i:(t.env=e,t.soul=s,r.ify(t.obj,o,t)&&(t.link=t.link||n.link.ify(r.soul(t.node)),t.obj!==e.shell&&(e.graph[n.link.is(t.link)]=t.node)),t)}function o(t,i,o){var s=this,u=s.env,f,h;if(r._===i&&c(t,n.link._))return o._;if(f=a(t,i,o,s,u)){if(i||(s.node=s.node||o||{},c(t,r._)&&r.soul(t)&&(s.node._=d(t._)),s.node=r.soul.ify(s.node,n.link.is(s.link)),s.link=s.link||n.link.ify(r.soul(s.node))),(h=u.map)&&(h.call(u.as||{},t,i,o,s),c(o,i))){if(t=o[i],m===t)return void l(o,i);if(!(f=a(t,i,o,s,u)))return}if(!i)return s.node;if(!0===f)return t;if(h=e(u,{obj:t,path:s.path.concat(i)}),h.node)return h.link}}function s(e){var t=this,i=n.link.is(t.link),o=t.env.graph;t.link=t.link||n.link.ify(e),t.link[n.link._]=e,t.node&&t.node[r._]&&(t.node[r._][n.link._]=e),c(o,i)&&(o[e]=o[i],l(o,i))}function a(e,r,i,o,s){var l;return!!n.is(e)||(u(e)?1:(l=s.invalid)?(e=l.call(s.as||{},e,r,i),a(e,r,i,o,s)):(s.err="Invalid value at '"+o.path.concat(r).join(".")+"'!",void(t.list.is(e)&&(s.err+=" Use `.set(item)` instead of an Array."))))}function f(e,t){for(var n=e.seen,r=n.length,i;r--;)if(i=n[r],t.obj===i.obj)return i;n.push(t)}i.ify=function(t,r,i){var o={path:[],obj:t};return r?"string"==typeof r?r={soul:r}:r instanceof Function&&(r.map=r):r={},r.soul&&(o.link=n.link.ify(r.soul)),r.shell=(i||{}).shell,r.graph=r.graph||{},r.seen=r.seen||[],r.as=r.as||i,e(r,o),r.root=o.node,r.graph}}(),i.node=function(e){var t=r.soul(e);if(t)return h({},t,e)},function(){function e(e,t){var o,s;if(r._!==t)(o=n.link.is(e))?(s=this.opt.seen[o])?this.obj[t]=s:this.obj[t]=this.opt.seen[o]=i.to(this.graph,o,this.opt):this.obj[t]=e;else{if(f(e,n.link._))return;this.obj[t]=d(e)}}i.to=function(t,n,r){if(t){var i={};return r=r||{seen:{}},p(t[n],e,{obj:i,graph:t,opt:r}),i}}}();var s=t.fn.is,a=t.obj,u=a.is,l=a.del,c=a.has,f=a.empty,h=a.put,p=a.map,d=a.copy,m;e.exports=i})(o,"./graph"),o(function(e){o("./onto"),e.exports=function e(t,n){if(this.on){if(!(t instanceof Function)){if(!t||!n)return;var r=t["#"]||t,i=(this.tag||empty)[r];if(!i)return;return i=this.on(r,n),clearTimeout(i.err),!0}var r=n&&n["#"]||Math.random().toString(36).slice(2);if(!t)return r;var o=this.on(r,t,n);return o.err=o.err||setTimeout(function(){o.next({err:"Error: No ACK received yet.",lack:!0}),o.off()},(this.opt||{}).lack||9e3),r}}})(o,"./ask"),o(function(e){var t=o("./type");function n(e){var n={s:{}};return e=e||{max:1e3,age:9e3},n.check=function(e){var t;return!!(t=n.s[e])&&(t.pass?t.pass=!1:n.track(e))},n.track=function(i,o){var s=n.s[i]||(n.s[i]={});return s.was=r(),o&&(s.pass=!0),n.to||(n.to=setTimeout(function(){var i=r();t.obj.map(n.s,function(r,o){r&&e.age>i-r.was||t.obj.del(n.s,o)}),n.to=null},e.age+9)),s},n}var r=t.time.is;e.exports=n})(o,"./dup"),o(function(e){function t(e){return e instanceof t?(this._={gun:this,$:this}).$:this instanceof t?t.create(this._={gun:this,$:this,opt:e}):new t(e)}t.is=function(e){return e instanceof t||e&&e._&&e===e._.$||!1},t.version=.9,t.chain=t.prototype,t.chain.toJSON=function(){};var n=o("./type");n.obj.to(n,t),t.HAM=o("./HAM"),t.val=o("./val"),t.node=o("./node"),t.state=o("./state"),t.graph=o("./graph"),t.on=o("./onto"),t.ask=o("./ask"),t.dup=o("./dup"),function(){function e(n){var r=this,i=r.as,o=i.at||i,s=o.$,a,u;(u=n["#"])||(u=n["#"]=l(9)),(a=o.dup).check(u)?i.out===n.out&&(n.out=k,r.to.next(n)):(a.track(u),o.ask(n["@"],n)||(n.get&&t.on.get(n,s),n.put&&t.on.put(n,s)),r.to.next(n),i.out||(n.out=e,o.on("out",n)))}t.create=function(n){n.root=n.root||n,n.graph=n.graph||{},n.on=n.on||t.on,n.ask=n.ask||t.ask,n.dup=n.dup||t.dup();var r=n.$.opt(n.opt);return n.once||(n.on("in",e,n),n.on("out",e,{at:n,out:e}),t.on("create",n),n.on("create",n)),n.once=1,r}}(),function(){function e(e,n,r,i){var o=this,s=t.state.is(r,n),a;if(!s)return o.err="Error: No state on '"+n+"' in node '"+i+"'!";var u=o.graph[i]||_,l=t.state.is(u,n,!0),c=u[n],f=t.HAM(o.machine,s,l,e,c);f.incoming?(o.put[i]=t.state.to(r,n,o.put[i]),(o.diff||(o.diff={}))[i]=t.state.to(r,n,o.diff[i]),o.souls[i]=!0):f.defer&&(o.defer=s<(o.defer||1/0)?s:o.defer)}function n(e,t){var n=this,s=n.$._,a=(s.next||_)[t];if(!a){if(!(s.opt||_).super)return void(n.souls[t]=!1);a=n.$.get(t)._}var u=n.map[t]={put:e,get:t,$:a.$},l={ctx:n,msg:u};n.async=!!s.tag.node,n.ack&&(u["@"]=n.ack),d(e,r,l),n.async&&(n.and||s.on("node",function(e){this.to.next(e),e===n.map[e.get]&&(n.souls[e.get]=!1,d(e.put,i,e),d(n.souls,function(e){if(e)return e})||n.c||(n.c=1,this.off(),d(n.map,o,n)))}),n.and=!0,s.on("node",u))}function r(e,n){var r=this.ctx,i=r.graph,o=this.msg,s=o.get,a=o.put,u=o.$._,l;i[s]=t.state.to(a,n,i[s]),r.async||(u.put=t.state.to(a,n,u.put))}function i(e,n){var r=this,i=r.put,o=r.$._;o.put=t.state.to(i,n,o.put)}function o(e,t){e.$&&(this.cat.stop=this.stop,e.$._.on("in",e),this.cat.stop=null)}t.on.put=function(r,i){var s=i._,a={$:i,graph:s.graph,put:{},map:{},souls:{},machine:t.state(),ack:r["@"],cat:s,stop:{}};if(t.graph.is(r.put,null,e,a)||(a.err="Error: Invalid graph!"),a.err)return s.on("in",{"@":r["#"],err:t.log(a.err)});d(a.put,n,a),a.async||d(a.map,o,a),k!==a.defer&&setTimeout(function(){t.on.put(r,i)},a.defer-a.machine),a.diff&&s.on("put",p(r,{put:a.diff}))},t.on.get=function(e,n){var r=n._,i=e.get,o=i[y],s=r.graph[o],a=i[b],u,l=r.next||(r.next={}),c=l[o];if(!s)return r.on("get",e);if(a){if("string"!=typeof a||!h(s,a))return r.on("get",e);s=t.state.to(s,a)}else s=t.obj.copy(s);s=t.graph.node(s),u=(c||_).ack,r.on("in",{"@":e["#"],how:"mem",put:s,$:n}),r.on("get",e)}}(),t.chain.opt=function(e){e=e||{};var n=this,i=n._,o=e.peers||e;return f(e)||(e={}),f(i.opt)||(i.opt=e),u(o)&&(o=[o]),r(o)&&(o=d(o,function(e,t,n){t={},t.id=t.url=e,n(e,t)}),f(i.opt.peers)||(i.opt.peers={}),i.opt.peers=p(o,i.opt.peers)),i.opt.peers=i.opt.peers||{},p(e,i.opt),t.on("opt",i),i.opt.uuid=i.opt.uuid||function(){return g()+l(12)},n};var r=t.list.is,a=t.text,u=a.is,l=a.random,c=t.obj,f=c.is,h=c.has,p=c.to,d=c.map,m=c.copy,g=t.state.lex,y=t.val.link._,b=".",v=t.node._,w=t.val.link.is,_={},k;i.debug=function(e,t){return i.debug.i&&e===i.debug.i&&i.debug.i++&&(i.log.apply(i,arguments)||t)},t.log=function(){return!t.log.off&&i.log.apply(i,arguments),[].slice.call(arguments).join(" ")},t.log.once=function(e,n,r){return(r=t.log.once)[e]=r[e]||0,r[e]++||t.log(n)},t.log.once("welcome","Hello wonderful person! :) Thanks for using GUN, feel free to ask for help on https://gitter.im/amark/gun and ask StackOverflow questions tagged with 'gun'!"),"undefined"!=typeof window&&((window.GUN=window.Gun=t).window=window);try{void 0!==s&&(s.exports=t)}catch(e){}e.exports=t})(o,"./root"),o(function(e){var t=o("./root");t.chain.back=function(e,i){var o;if(e=e||1,-1===e||1/0===e)return this._.root.$;if(1===e)return(this._.back||this._).$;var s=this,a=s._;if("string"==typeof e&&(e=e.split(".")),e instanceof Array){for(var u=0,l=e.length,o=a;u(e.acks||0)&&this.off(),e.ack&&e.ack(r,this)},e.opt),i=0,o=n.root.now;h.del(n.root,"now");var s=n.root.mum;n.root.mum={},e.ref._.on("out",{$:e.ref,put:e.out=e.env.graph,opt:e.opt,"#":r}),n.root.mum=s?h.to(s,n.root.mum):s,n.root.now=o},e),e.res&&e.res())}function a(e,t){if(e)return!0}function u(e,n,r,i){var o=this,s=t.is(e);!n&&i.path.length&&(o.res||v)(function(){for(var n=i.path,r=o.ref,a=o.opt,u=0,c=n.length;uc){if((l.stack||(l.stack=[])).push([s,e,i,o]),l.puto)return;return l.puto=setTimeout(function e(){var t=l.stack.splice(0,c),n=0,r;for(l.puta=!0;r=t[n++];)r[0].put(r[1],r[2],r[3]);if(delete l.puta,l.stack.length)return l.puto=setTimeout(e,0);l.stack=l.puts=l.puto=null},0),s}++l.puts}else l.puts=1;return o=o||{},o.data=e,o.via=o.$=o.via||o.$||s,"string"==typeof i?o.soul=i:o.ack=o.ack||i,a.soul&&(o.soul=a.soul),o.soul||u===s?p(o.data)?(o.soul=o.soul||(o.not=t.node.soul(o.data)||(o.via.back("opt.uuid")||t.text.random)()),o.soul?(o.$=u.get(o.soul),o.ref=o.$,n(o),s):(o.via.back("opt.uuid")(function(e,n){if(e)return t.log(e);(o.ref||o.$).put(o.data,o.soul=n,o)}),s)):((o.ack||b).call(o,o.out={err:t.log("Data saved to the root level of the graph must be a node (an object), not a",typeof o.data,'of "'+o.data+'"!')}),o.res&&o.res(),s):t.is(e)?(e.get(function(e,n,r){if(!e)return t.log("The reference you are saving is a",typeof r.put,'"'+r.put+'", not a node (object)!');s.put(t.val.link.ify(e),i,o)},!0),s):(a.has&&(h=t.val.link.is(e))&&(a.dub=h),o.ref=o.ref||u._===(h=a.back)?s:h.$,o.ref._.soul&&t.val.is(o.data)&&a.get?(o.data=d({},a.get,o.data),o.ref.put(o.data,o.soul,o),s):(o.ref.get(f,!0,{as:o}),o.out||(o.res=o.res||r,o.$._.stun=o.ref._.stun),s))};var h=t.obj,p=h.is,d=h.put,m=h.map,g,y={},b=function(){},v=function(e,t){e.call(t||y)},w=t.node._})(o,"./put"),o(function(e){var t=o("./root");o("./chain"),o("./back"),o("./put"),o("./get"),e.exports=t})(o,"./index"),o(function(e){var t=o("./index");function n(e,t){var n=this,r=e.$,i=(r||{})._||{},o=i.put||e.put,s=n.at,a;if(h!==o){if(a=e.$$){if(a=e.$$._,h===a.put)return;o=a.put}n.change&&(o=e.put),n.as?n.ok.call(n.as,e,t):n.ok.call(r,o,e.get,e,t)}}function r(e,n,i){if(e.$){var o=this.as,a=o.at,u=e.$,l=u._,f=l.put||e.put,p,d;(d=e.$$)&&(p=d=e.$$._,h!==p.put&&(f=p.put)),(d=n.wait)&&(d=d[l.id])&&clearTimeout(d),!i&&(h===f||l.soul||l.link||p&&!(0 .once, apologies unexpected."),this.once(e,n)},t.chain.once=function(e,n){var i=this,o=i._,s=o.put;if(0=(t.batch||1e3))return f();s||(s=setTimeout(f,t.wait||1))}),e.on("get",function(t){this.to.next(t);var n=t.get,r,i,o;function s(){if(n&&(r=n["#"])){var s=n["."];i=a[r]||o,i&&s&&(i=Gun.state.to(i,s)),e.on("in",{"@":t["#"],put:Gun.graph.node(i),how:"lS",lS:t.$})}}Gun.debug?setTimeout(s,1):s()});var c=function(e,t,n,r){a[r]=Gun.state.to(n,t,a[r])},f=function(n){var u;o=0,clearTimeout(s),s=!1;var l=i;i={},n&&(a=n);try{r.setItem(t.prefix,JSON.stringify(a))}catch(n){Gun.log(u=(n||"localStorage failure")+" Consider using GUN's IndexedDB plugin for RAD for more storage space, temporary example at https://github.com/amark/gun/blob/master/test/tmp/indexedDB.html ."),e.on("localStorage:error",{err:u,file:t.prefix,flush:a,retry:f})}(u||Gun.obj.empty(t.peers))&&Gun.obj.map(l,function(t,n){e.on("in",{"@":n,err:u,ok:0})})}}})}})(o,"./adapters/localStorage"),o(function(e){var t=o("../type");function n(e){var n=function(){},o=e.opt||{};o.log=o.log||i.log,o.gap=o.gap||o.wait||1,o.pack=o.pack||.3*(o.memory?1e3*o.memory*1e3:1399e6);var a=e.dup;n.hear=function(r,i){if(r){var l,c,f,h=r[0];if(o.pack<=r.length)return n.say({dam:"!",err:"Message too big!"},i);if("{"!=r[2]&&(n.hear.d+=r.length||0,++n.hear.c),"["!==h){if("{"===h||t.obj.is(r)&&(l=r)){try{l=l||JSON.parse(r)}catch(e){return o.log("DAM JSON parse error",e)}if(!l)return;if((c=l["#"])||(c=l["#"]=t.text.random(9)),a.check(c))return;if(a.track(c,!0).it=l,(f=l["##"])||s===l.put||(f=l["##"]=t.obj.hash(l.put)),f&&(h=l["@"]||l.get&&c)){if(a.check(h+f))return;a.track(h+f,!0).it=l}return(l._=function(){}).via=i,(h=l["><"])&&(l._.to=t.obj.map(h.split(","),u)),l.dam?void((h=n.hear[l.dam])&&h(l,i,e)):void e.on("in",l)}}else{try{l=JSON.parse(r)}catch(e){o.log("DAM JSON parse error",e)}if(!l)return;for(var p=0,d;d=l[p++];)n.hear(d,i)}}};var u=function(e,t,n){n(e,!0)};function l(e,t){try{var r=t.wire;t.say?t.say(e):r.send&&r.send(e),n.say.d+=e.length||0,++n.say.c}catch(n){(t.queue=t.queue||[]).push(e)}}n.hear.c=n.hear.d=0,function(){var e;function i(t){n.say(e,t)}function u(e){var t=e.batch;if(e.batch=e.tail=null,t&&t.length){try{t=1===t.length?t[0]:JSON.stringify(t)}catch(e){return o.log("DAM JSON stringify error",e)}t&&l(t,e)}}n.say=function(c,f){if(this.to&&this.to.next(c),!c)return!1;var h,p,d,m,g=c._||(c._=function(){});if((h=c["#"])||(h=c["#"]=t.text.random(9)),(p=c["##"])||s===c.put||(p=c["##"]=t.obj.hash(c.put)),!(m=g.raw)&&(m=g.raw=n.raw(c),p&&(d=c["@"])&&(a.track(d+p).it=c,d=(a.s[d]||r).it))){if(p===d["##"])return!1;d["##"]=p}if(a.track(h).it=c,f||(f=(d=a.s[c["@"]])&&(d=d.it)&&(d=d._)&&(d=d.via)),!f&&n.way)return n.way(c);if(!f||!f.id)return e=c,!!t.obj.is(f||o.peers)&&void t.obj.map(f||o.peers,i);if(!f.wire&&n.wire&&n.wire(f),f===g.via)return!1;if((d=g.to)&&(d[f.url]||d[f.pid]||d[f.id]))return!1;if(f.batch){if(f.tail=(d=f.tail||0)+m.length,f.tail<=o.pack)return void f.batch.push(m);u(f)}f.batch=[],setTimeout(function(){u(f)},o.gap),l(m,f)},n.say.c=n.say.d=0}(),function(){n.raw=function(n){if(!n)return"";var r=n._||{},i,s,a;if(a=r.raw)return a;if("string"==typeof n)return n;if(!n.dam){var u=0,l=[];t.obj.map(o.peers,function(e){if(l.push(e.url||e.pid||e.id),++u>9)return!0}),u>1&&(n["><"]=l.join())}var c=e(n);return r&&(r.raw=c),c};var e=JSON.stringify,r=":])([:"}(),n.hi=function(r){var i=r.wire||{};r.id?o.peers[r.url||r.id]=r:(i=r.id=r.id||t.text.random(9),n.say({dam:"?"},o.peers[i]=r)),r.met=r.met||+new Date,i.hied||e.on(i.hied="hi",r),i=r.queue,r.queue=[],t.obj.map(i,function(e){l(e,r)})},n.bye=function(r){t.obj.del(o.peers,r.id),e.on("bye",r);var i=+new Date;i-=r.met||i,n.bye.time=((n.bye.time||i)+i)/2},n.hear["!"]=function(e,t){o.log("Error:",e.err)},n.hear["?"]=function(e,t){e.pid?t.pid||(t.pid=e.pid):n.say({dam:"?",pid:o.pid,"@":e["#"]},t)},e.on("create",function(e){e.opt.pid=e.opt.pid||t.text.random(9),this.to.next(e),e.on("out",n.say)});var c={};return e.on("bye",function(e,t){this.to.next(e),(t=e.url)&&(c[t]=!0,setTimeout(function(){delete c[t]},o.lack||9e3))}),e.on("hi",function(r,i){this.to.next(r),(i=r.url)&&c[i]&&(delete c[i],t.obj.map(e.next,function(o,s){i={},i[s]=e.graph[s],n.say({"##":t.obj.hash(i),get:{"#":s}},r)}))}),n}!function(){t.text.hash=function(e){if("string"!=typeof e)return{err:1};var t=0;if(!e.length)return t;for(var n=0,r=e.length,i;ne&&e.length>0?[e.length+" items inc:",e[e.length-1]]:e),utils.stringfrom=function(e,t={}){try{return"Url"===e.constructor.name?e.href:"string"==typeof e?e:e.toString()}catch(t){throw new r.CodingError(`Unable to turn ${e} into a string ${t.message}`)}},utils.p_timeout=function(e,t,n){let i=null;return Promise.race([new Promise((e,o)=>{i=setTimeout(o,t,new r.TimeoutError(n||`Timed out in ${t}ms`))}),e.then(e=>(clearTimeout(i),e))])},utils.createElement=function(e,t,n){var r=document.createElement(e);for(let e in t){let n="classname"===e.toLowerCase()?"class":e;if("dangerouslySetInnerHTML"===e&&(r.innerHTML=t[e].__html,delete t.dangerouslySetInnerHTML),t.hasOwnProperty(e)){let i=t[e];if(!0===i)r.setAttribute(n,e);else if("object"!=typeof i||Array.isArray(i))!1!==i&&null!=i&&r.setAttribute(n,i.toString());else if(["style"].includes(n))for(let e in i)r[n][e]=i[e];else r[n]=i}}for(let e=2;er.appendChild(null==e.nodeType?document.createTextNode(e.toString()):e)):r.appendChild(null==t.nodeType?document.createTextNode(t.toString()):t))}return r},t=e.exports=utils},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=(0,s.default)(e);return(0,i.default)(function(e,t){n(e[0],t)},t,1)};var r=n(744),i=a(r),o=n(42),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,n){var r=n(173),i=n(290);function o(e){return null!=e&&i(e.length)&&!r(e)}e.exports=o},function(e,t,n){var r=n(132),i=n(217),o="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",u="[object Proxy]";function l(e){if(!i(e))return!1;var t=r(e);return t==s||t==a||t==o||t==u}e.exports=l},function(e,t,n){var r=n(99),i=r.Symbol;e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=n(218),i=a(r),o=n(42),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e){return function(t,n,r){return e(i.default,t,(0,s.default)(n),r)}}e.exports=t.default},function(e,t,n){"use strict";(function(e){t.protobuf=e.from("50","hex"),t.cbor=e.from("51","hex"),t.rlp=e.from("60","hex"),t.bencode=e.from("63","hex"),t.multicodec=e.from("30","hex"),t.multihash=e.from("31","hex"),t.multiaddr=e.from("32","hex"),t.multibase=e.from("33","hex"),t.identity=e.from("00","hex"),t.sha1=e.from("11","hex"),t["sha2-256"]=e.from("12","hex"),t["sha2-512"]=e.from("13","hex"),t["sha3-512"]=e.from("14","hex"),t["sha3-384"]=e.from("15","hex"),t["sha3-256"]=e.from("16","hex"),t["sha3-224"]=e.from("17","hex"),t["shake-128"]=e.from("18","hex"),t["shake-256"]=e.from("19","hex"),t["keccak-224"]=e.from("1a","hex"),t["keccak-256"]=e.from("1b","hex"),t["keccak-384"]=e.from("1c","hex"),t["keccak-512"]=e.from("1d","hex"),t["murmur3-128"]=e.from("22","hex"),t["murmur3-32"]=e.from("23","hex"),t["dbl-sha2-256"]=e.from("56","hex"),t.md4=e.from("d4","hex"),t.md5=e.from("d5","hex"),t.bmt=e.from("d6","hex"),t.x11=e.from("1100","hex"),t["blake2b-8"]=e.from("b201","hex"),t["blake2b-16"]=e.from("b202","hex"),t["blake2b-24"]=e.from("b203","hex"),t["blake2b-32"]=e.from("b204","hex"),t["blake2b-40"]=e.from("b205","hex"),t["blake2b-48"]=e.from("b206","hex"),t["blake2b-56"]=e.from("b207","hex"),t["blake2b-64"]=e.from("b208","hex"),t["blake2b-72"]=e.from("b209","hex"),t["blake2b-80"]=e.from("b20a","hex"),t["blake2b-88"]=e.from("b20b","hex"),t["blake2b-96"]=e.from("b20c","hex"),t["blake2b-104"]=e.from("b20d","hex"),t["blake2b-112"]=e.from("b20e","hex"),t["blake2b-120"]=e.from("b20f","hex"),t["blake2b-128"]=e.from("b210","hex"),t["blake2b-136"]=e.from("b211","hex"),t["blake2b-144"]=e.from("b212","hex"),t["blake2b-152"]=e.from("b213","hex"),t["blake2b-160"]=e.from("b214","hex"),t["blake2b-168"]=e.from("b215","hex"),t["blake2b-176"]=e.from("b216","hex"),t["blake2b-184"]=e.from("b217","hex"),t["blake2b-192"]=e.from("b218","hex"),t["blake2b-200"]=e.from("b219","hex"),t["blake2b-208"]=e.from("b21a","hex"),t["blake2b-216"]=e.from("b21b","hex"),t["blake2b-224"]=e.from("b21c","hex"),t["blake2b-232"]=e.from("b21d","hex"),t["blake2b-240"]=e.from("b21e","hex"),t["blake2b-248"]=e.from("b21f","hex"),t["blake2b-256"]=e.from("b220","hex"),t["blake2b-264"]=e.from("b221","hex"),t["blake2b-272"]=e.from("b222","hex"),t["blake2b-280"]=e.from("b223","hex"),t["blake2b-288"]=e.from("b224","hex"),t["blake2b-296"]=e.from("b225","hex"),t["blake2b-304"]=e.from("b226","hex"),t["blake2b-312"]=e.from("b227","hex"),t["blake2b-320"]=e.from("b228","hex"),t["blake2b-328"]=e.from("b229","hex"),t["blake2b-336"]=e.from("b22a","hex"),t["blake2b-344"]=e.from("b22b","hex"),t["blake2b-352"]=e.from("b22c","hex"),t["blake2b-360"]=e.from("b22d","hex"),t["blake2b-368"]=e.from("b22e","hex"),t["blake2b-376"]=e.from("b22f","hex"),t["blake2b-384"]=e.from("b230","hex"),t["blake2b-392"]=e.from("b231","hex"),t["blake2b-400"]=e.from("b232","hex"),t["blake2b-408"]=e.from("b233","hex"),t["blake2b-416"]=e.from("b234","hex"),t["blake2b-424"]=e.from("b235","hex"),t["blake2b-432"]=e.from("b236","hex"),t["blake2b-440"]=e.from("b237","hex"),t["blake2b-448"]=e.from("b238","hex"),t["blake2b-456"]=e.from("b239","hex"),t["blake2b-464"]=e.from("b23a","hex"),t["blake2b-472"]=e.from("b23b","hex"),t["blake2b-480"]=e.from("b23c","hex"),t["blake2b-488"]=e.from("b23d","hex"),t["blake2b-496"]=e.from("b23e","hex"),t["blake2b-504"]=e.from("b23f","hex"),t["blake2b-512"]=e.from("b240","hex"),t["blake2s-8"]=e.from("b241","hex"),t["blake2s-16"]=e.from("b242","hex"),t["blake2s-24"]=e.from("b243","hex"),t["blake2s-32"]=e.from("b244","hex"),t["blake2s-40"]=e.from("b245","hex"),t["blake2s-48"]=e.from("b246","hex"),t["blake2s-56"]=e.from("b247","hex"),t["blake2s-64"]=e.from("b248","hex"),t["blake2s-72"]=e.from("b249","hex"),t["blake2s-80"]=e.from("b24a","hex"),t["blake2s-88"]=e.from("b24b","hex"),t["blake2s-96"]=e.from("b24c","hex"),t["blake2s-104"]=e.from("b24d","hex"),t["blake2s-112"]=e.from("b24e","hex"),t["blake2s-120"]=e.from("b24f","hex"),t["blake2s-128"]=e.from("b250","hex"),t["blake2s-136"]=e.from("b251","hex"),t["blake2s-144"]=e.from("b252","hex"),t["blake2s-152"]=e.from("b253","hex"),t["blake2s-160"]=e.from("b254","hex"),t["blake2s-168"]=e.from("b255","hex"),t["blake2s-176"]=e.from("b256","hex"),t["blake2s-184"]=e.from("b257","hex"),t["blake2s-192"]=e.from("b258","hex"),t["blake2s-200"]=e.from("b259","hex"),t["blake2s-208"]=e.from("b25a","hex"),t["blake2s-216"]=e.from("b25b","hex"),t["blake2s-224"]=e.from("b25c","hex"),t["blake2s-232"]=e.from("b25d","hex"),t["blake2s-240"]=e.from("b25e","hex"),t["blake2s-248"]=e.from("b25f","hex"),t["blake2s-256"]=e.from("b260","hex"),t["skein256-8"]=e.from("b301","hex"),t["skein256-16"]=e.from("b302","hex"),t["skein256-24"]=e.from("b303","hex"),t["skein256-32"]=e.from("b304","hex"),t["skein256-40"]=e.from("b305","hex"),t["skein256-48"]=e.from("b306","hex"),t["skein256-56"]=e.from("b307","hex"),t["skein256-64"]=e.from("b308","hex"),t["skein256-72"]=e.from("b309","hex"),t["skein256-80"]=e.from("b30a","hex"),t["skein256-88"]=e.from("b30b","hex"),t["skein256-96"]=e.from("b30c","hex"),t["skein256-104"]=e.from("b30d","hex"),t["skein256-112"]=e.from("b30e","hex"),t["skein256-120"]=e.from("b30f","hex"),t["skein256-128"]=e.from("b310","hex"),t["skein256-136"]=e.from("b311","hex"),t["skein256-144"]=e.from("b312","hex"),t["skein256-152"]=e.from("b313","hex"),t["skein256-160"]=e.from("b314","hex"),t["skein256-168"]=e.from("b315","hex"),t["skein256-176"]=e.from("b316","hex"),t["skein256-184"]=e.from("b317","hex"),t["skein256-192"]=e.from("b318","hex"),t["skein256-200"]=e.from("b319","hex"),t["skein256-208"]=e.from("b31a","hex"),t["skein256-216"]=e.from("b31b","hex"),t["skein256-224"]=e.from("b31c","hex"),t["skein256-232"]=e.from("b31d","hex"),t["skein256-240"]=e.from("b31e","hex"),t["skein256-248"]=e.from("b31f","hex"),t["skein256-256"]=e.from("b320","hex"),t["skein512-8"]=e.from("b321","hex"),t["skein512-16"]=e.from("b322","hex"),t["skein512-24"]=e.from("b323","hex"),t["skein512-32"]=e.from("b324","hex"),t["skein512-40"]=e.from("b325","hex"),t["skein512-48"]=e.from("b326","hex"),t["skein512-56"]=e.from("b327","hex"),t["skein512-64"]=e.from("b328","hex"),t["skein512-72"]=e.from("b329","hex"),t["skein512-80"]=e.from("b32a","hex"),t["skein512-88"]=e.from("b32b","hex"),t["skein512-96"]=e.from("b32c","hex"),t["skein512-104"]=e.from("b32d","hex"),t["skein512-112"]=e.from("b32e","hex"),t["skein512-120"]=e.from("b32f","hex"),t["skein512-128"]=e.from("b330","hex"),t["skein512-136"]=e.from("b331","hex"),t["skein512-144"]=e.from("b332","hex"),t["skein512-152"]=e.from("b333","hex"),t["skein512-160"]=e.from("b334","hex"),t["skein512-168"]=e.from("b335","hex"),t["skein512-176"]=e.from("b336","hex"),t["skein512-184"]=e.from("b337","hex"),t["skein512-192"]=e.from("b338","hex"),t["skein512-200"]=e.from("b339","hex"),t["skein512-208"]=e.from("b33a","hex"),t["skein512-216"]=e.from("b33b","hex"),t["skein512-224"]=e.from("b33c","hex"),t["skein512-232"]=e.from("b33d","hex"),t["skein512-240"]=e.from("b33e","hex"),t["skein512-248"]=e.from("b33f","hex"),t["skein512-256"]=e.from("b340","hex"),t["skein512-264"]=e.from("b341","hex"),t["skein512-272"]=e.from("b342","hex"),t["skein512-280"]=e.from("b343","hex"),t["skein512-288"]=e.from("b344","hex"),t["skein512-296"]=e.from("b345","hex"),t["skein512-304"]=e.from("b346","hex"),t["skein512-312"]=e.from("b347","hex"),t["skein512-320"]=e.from("b348","hex"),t["skein512-328"]=e.from("b349","hex"),t["skein512-336"]=e.from("b34a","hex"),t["skein512-344"]=e.from("b34b","hex"),t["skein512-352"]=e.from("b34c","hex"),t["skein512-360"]=e.from("b34d","hex"),t["skein512-368"]=e.from("b34e","hex"),t["skein512-376"]=e.from("b34f","hex"),t["skein512-384"]=e.from("b350","hex"),t["skein512-392"]=e.from("b351","hex"),t["skein512-400"]=e.from("b352","hex"),t["skein512-408"]=e.from("b353","hex"),t["skein512-416"]=e.from("b354","hex"),t["skein512-424"]=e.from("b355","hex"),t["skein512-432"]=e.from("b356","hex"),t["skein512-440"]=e.from("b357","hex"),t["skein512-448"]=e.from("b358","hex"),t["skein512-456"]=e.from("b359","hex"),t["skein512-464"]=e.from("b35a","hex"),t["skein512-472"]=e.from("b35b","hex"),t["skein512-480"]=e.from("b35c","hex"),t["skein512-488"]=e.from("b35d","hex"),t["skein512-496"]=e.from("b35e","hex"),t["skein512-504"]=e.from("b35f","hex"),t["skein512-512"]=e.from("b360","hex"),t["skein1024-8"]=e.from("b361","hex"),t["skein1024-16"]=e.from("b362","hex"),t["skein1024-24"]=e.from("b363","hex"),t["skein1024-32"]=e.from("b364","hex"),t["skein1024-40"]=e.from("b365","hex"),t["skein1024-48"]=e.from("b366","hex"),t["skein1024-56"]=e.from("b367","hex"),t["skein1024-64"]=e.from("b368","hex"),t["skein1024-72"]=e.from("b369","hex"),t["skein1024-80"]=e.from("b36a","hex"),t["skein1024-88"]=e.from("b36b","hex"),t["skein1024-96"]=e.from("b36c","hex"),t["skein1024-104"]=e.from("b36d","hex"),t["skein1024-112"]=e.from("b36e","hex"),t["skein1024-120"]=e.from("b36f","hex"),t["skein1024-128"]=e.from("b370","hex"),t["skein1024-136"]=e.from("b371","hex"),t["skein1024-144"]=e.from("b372","hex"),t["skein1024-152"]=e.from("b373","hex"),t["skein1024-160"]=e.from("b374","hex"),t["skein1024-168"]=e.from("b375","hex"),t["skein1024-176"]=e.from("b376","hex"),t["skein1024-184"]=e.from("b377","hex"),t["skein1024-192"]=e.from("b378","hex"),t["skein1024-200"]=e.from("b379","hex"),t["skein1024-208"]=e.from("b37a","hex"),t["skein1024-216"]=e.from("b37b","hex"),t["skein1024-224"]=e.from("b37c","hex"),t["skein1024-232"]=e.from("b37d","hex"),t["skein1024-240"]=e.from("b37e","hex"),t["skein1024-248"]=e.from("b37f","hex"),t["skein1024-256"]=e.from("b380","hex"),t["skein1024-264"]=e.from("b381","hex"),t["skein1024-272"]=e.from("b382","hex"),t["skein1024-280"]=e.from("b383","hex"),t["skein1024-288"]=e.from("b384","hex"),t["skein1024-296"]=e.from("b385","hex"),t["skein1024-304"]=e.from("b386","hex"),t["skein1024-312"]=e.from("b387","hex"),t["skein1024-320"]=e.from("b388","hex"),t["skein1024-328"]=e.from("b389","hex"),t["skein1024-336"]=e.from("b38a","hex"),t["skein1024-344"]=e.from("b38b","hex"),t["skein1024-352"]=e.from("b38c","hex"),t["skein1024-360"]=e.from("b38d","hex"),t["skein1024-368"]=e.from("b38e","hex"),t["skein1024-376"]=e.from("b38f","hex"),t["skein1024-384"]=e.from("b390","hex"),t["skein1024-392"]=e.from("b391","hex"),t["skein1024-400"]=e.from("b392","hex"),t["skein1024-408"]=e.from("b393","hex"),t["skein1024-416"]=e.from("b394","hex"),t["skein1024-424"]=e.from("b395","hex"),t["skein1024-432"]=e.from("b396","hex"),t["skein1024-440"]=e.from("b397","hex"),t["skein1024-448"]=e.from("b398","hex"),t["skein1024-456"]=e.from("b399","hex"),t["skein1024-464"]=e.from("b39a","hex"),t["skein1024-472"]=e.from("b39b","hex"),t["skein1024-480"]=e.from("b39c","hex"),t["skein1024-488"]=e.from("b39d","hex"),t["skein1024-496"]=e.from("b39e","hex"),t["skein1024-504"]=e.from("b39f","hex"),t["skein1024-512"]=e.from("b3a0","hex"),t["skein1024-520"]=e.from("b3a1","hex"),t["skein1024-528"]=e.from("b3a2","hex"),t["skein1024-536"]=e.from("b3a3","hex"),t["skein1024-544"]=e.from("b3a4","hex"),t["skein1024-552"]=e.from("b3a5","hex"),t["skein1024-560"]=e.from("b3a6","hex"),t["skein1024-568"]=e.from("b3a7","hex"),t["skein1024-576"]=e.from("b3a8","hex"),t["skein1024-584"]=e.from("b3a9","hex"),t["skein1024-592"]=e.from("b3aa","hex"),t["skein1024-600"]=e.from("b3ab","hex"),t["skein1024-608"]=e.from("b3ac","hex"),t["skein1024-616"]=e.from("b3ad","hex"),t["skein1024-624"]=e.from("b3ae","hex"),t["skein1024-632"]=e.from("b3af","hex"),t["skein1024-640"]=e.from("b3b0","hex"),t["skein1024-648"]=e.from("b3b1","hex"),t["skein1024-656"]=e.from("b3b2","hex"),t["skein1024-664"]=e.from("b3b3","hex"),t["skein1024-672"]=e.from("b3b4","hex"),t["skein1024-680"]=e.from("b3b5","hex"),t["skein1024-688"]=e.from("b3b6","hex"),t["skein1024-696"]=e.from("b3b7","hex"),t["skein1024-704"]=e.from("b3b8","hex"),t["skein1024-712"]=e.from("b3b9","hex"),t["skein1024-720"]=e.from("b3ba","hex"),t["skein1024-728"]=e.from("b3bb","hex"),t["skein1024-736"]=e.from("b3bc","hex"),t["skein1024-744"]=e.from("b3bd","hex"),t["skein1024-752"]=e.from("b3be","hex"),t["skein1024-760"]=e.from("b3bf","hex"),t["skein1024-768"]=e.from("b3c0","hex"),t["skein1024-776"]=e.from("b3c1","hex"),t["skein1024-784"]=e.from("b3c2","hex"),t["skein1024-792"]=e.from("b3c3","hex"),t["skein1024-800"]=e.from("b3c4","hex"),t["skein1024-808"]=e.from("b3c5","hex"),t["skein1024-816"]=e.from("b3c6","hex"),t["skein1024-824"]=e.from("b3c7","hex"),t["skein1024-832"]=e.from("b3c8","hex"),t["skein1024-840"]=e.from("b3c9","hex"),t["skein1024-848"]=e.from("b3ca","hex"),t["skein1024-856"]=e.from("b3cb","hex"),t["skein1024-864"]=e.from("b3cc","hex"),t["skein1024-872"]=e.from("b3cd","hex"),t["skein1024-880"]=e.from("b3ce","hex"),t["skein1024-888"]=e.from("b3cf","hex"),t["skein1024-896"]=e.from("b3d0","hex"),t["skein1024-904"]=e.from("b3d1","hex"),t["skein1024-912"]=e.from("b3d2","hex"),t["skein1024-920"]=e.from("b3d3","hex"),t["skein1024-928"]=e.from("b3d4","hex"),t["skein1024-936"]=e.from("b3d5","hex"),t["skein1024-944"]=e.from("b3d6","hex"),t["skein1024-952"]=e.from("b3d7","hex"),t["skein1024-960"]=e.from("b3d8","hex"),t["skein1024-968"]=e.from("b3d9","hex"),t["skein1024-976"]=e.from("b3da","hex"),t["skein1024-984"]=e.from("b3db","hex"),t["skein1024-992"]=e.from("b3dc","hex"),t["skein1024-1000"]=e.from("b3dd","hex"),t["skein1024-1008"]=e.from("b3de","hex"),t["skein1024-1016"]=e.from("b3df","hex"),t["skein1024-1024"]=e.from("b3e0","hex"),t.ip4=e.from("04","hex"),t.tcp=e.from("06","hex"),t.dccp=e.from("21","hex"),t.ip6=e.from("29","hex"),t.ip6zone=e.from("2a","hex"),t.dns=e.from("35","hex"),t.dns4=e.from("36","hex"),t.dns6=e.from("37","hex"),t.dnsaddr=e.from("38","hex"),t.sctp=e.from("84","hex"),t.udp=e.from("0111","hex"),t["p2p-webrtc-star"]=e.from("0113","hex"),t["p2p-webrtc-direct"]=e.from("0114","hex"),t["p2p-stardust"]=e.from("0115","hex"),t["p2p-circuit"]=e.from("0122","hex"),t.udt=e.from("012d","hex"),t.utp=e.from("012e","hex"),t.unix=e.from("0190","hex"),t.p2p=e.from("01a5","hex"),t.ipfs=e.from("01a5","hex"),t.https=e.from("01bb","hex"),t.onion=e.from("01bc","hex"),t.onion3=e.from("01bd","hex"),t.garlic64=e.from("01be","hex"),t.garlic32=e.from("01bf","hex"),t.quic=e.from("01cc","hex"),t.ws=e.from("01dd","hex"),t.wss=e.from("01de","hex"),t["p2p-websocket-star"]=e.from("01df","hex"),t.http=e.from("01e0","hex"),t.raw=e.from("55","hex"),t["dag-pb"]=e.from("70","hex"),t["dag-cbor"]=e.from("71","hex"),t["libp2p-key"]=e.from("72","hex"),t["git-raw"]=e.from("78","hex"),t["torrent-info"]=e.from("7b","hex"),t["torrent-file"]=e.from("7c","hex"),t["leofcoin-block"]=e.from("81","hex"),t["leofcoin-tx"]=e.from("82","hex"),t["leofcoin-pr"]=e.from("83","hex"),t["eth-block"]=e.from("90","hex"),t["eth-block-list"]=e.from("91","hex"),t["eth-tx-trie"]=e.from("92","hex"),t["eth-tx"]=e.from("93","hex"),t["eth-tx-receipt-trie"]=e.from("94","hex"),t["eth-tx-receipt"]=e.from("95","hex"),t["eth-state-trie"]=e.from("96","hex"),t["eth-account-snapshot"]=e.from("97","hex"),t["eth-storage-trie"]=e.from("98","hex"),t["bitcoin-block"]=e.from("b0","hex"),t["bitcoin-tx"]=e.from("b1","hex"),t["zcash-block"]=e.from("c0","hex"),t["zcash-tx"]=e.from("c1","hex"),t["stellar-block"]=e.from("d0","hex"),t["stellar-tx"]=e.from("d1","hex"),t["decred-block"]=e.from("e0","hex"),t["decred-tx"]=e.from("e1","hex"),t["dash-block"]=e.from("f0","hex"),t["dash-tx"]=e.from("f1","hex"),t["swarm-manifest"]=e.from("fa","hex"),t["swarm-feed"]=e.from("fb","hex"),t["dag-json"]=e.from("0129","hex"),t.path=e.from("2f","hex"),t["ipld-ns"]=e.from("e2","hex"),t["ipfs-ns"]=e.from("e3","hex"),t["swarm-ns"]=e.from("e4","hex"),t["ed25519-pub"]=e.from("ed","hex"),t["holochain-adr-v0"]=e.from("807124","hex"),t["holochain-adr-v1"]=e.from("817124","hex"),t["holochain-key-v0"]=e.from("947124","hex"),t["holochain-key-v1"]=e.from("957124","hex"),t["holochain-sig-v0"]=e.from("a27124","hex"),t["holochain-sig-v1"]=e.from("a37124","hex")}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=function e(t,n){var r,i;function o(e){if(r=e,i)return o.abort();!function e(){for(var o=!0,s=!1;o;)if(s=!1,r(null,function(a,u){if(s=!0,a=a||i){if(o=!1,n)n(!0===a?null:a);else if(a&&!0!==a)throw a}else t&&!1===t(u)||i?(o=!1,r(i||!0,n||function(){})):o||e()}),!s)return void(o=!1)}()}return o.abort=function(e,t){if("function"==typeof e&&(t=e,e=!0),i=e||!0,r)return r(i,t||function(){})},o}},function(e,t){e.exports=function e(t){return t&&("string"==typeof t?function(e){return e[t]}:"object"==typeof t&&"function"==typeof t.exec?function(e){var n=t.exec(e);return n&&n[0]}:t)}},function(e,t,n){var r=n(19);r.pki=r.pki||{};var i=e.exports=r.pki.oids=r.oids=r.oids||{};function o(e,t){i[e]=t,i[t]=e}function s(e,t){i[e]=t}o("1.2.840.113549.1.1.1","rsaEncryption"),o("1.2.840.113549.1.1.4","md5WithRSAEncryption"),o("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),o("1.2.840.113549.1.1.7","RSAES-OAEP"),o("1.2.840.113549.1.1.8","mgf1"),o("1.2.840.113549.1.1.9","pSpecified"),o("1.2.840.113549.1.1.10","RSASSA-PSS"),o("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),o("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),o("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),o("1.2.840.10040.4.3","dsa-with-sha1"),o("1.3.14.3.2.7","desCBC"),o("1.3.14.3.2.26","sha1"),o("2.16.840.1.101.3.4.2.1","sha256"),o("2.16.840.1.101.3.4.2.2","sha384"),o("2.16.840.1.101.3.4.2.3","sha512"),o("1.2.840.113549.2.5","md5"),o("1.2.840.113549.1.7.1","data"),o("1.2.840.113549.1.7.2","signedData"),o("1.2.840.113549.1.7.3","envelopedData"),o("1.2.840.113549.1.7.4","signedAndEnvelopedData"),o("1.2.840.113549.1.7.5","digestedData"),o("1.2.840.113549.1.7.6","encryptedData"),o("1.2.840.113549.1.9.1","emailAddress"),o("1.2.840.113549.1.9.2","unstructuredName"),o("1.2.840.113549.1.9.3","contentType"),o("1.2.840.113549.1.9.4","messageDigest"),o("1.2.840.113549.1.9.5","signingTime"),o("1.2.840.113549.1.9.6","counterSignature"),o("1.2.840.113549.1.9.7","challengePassword"),o("1.2.840.113549.1.9.8","unstructuredAddress"),o("1.2.840.113549.1.9.14","extensionRequest"),o("1.2.840.113549.1.9.20","friendlyName"),o("1.2.840.113549.1.9.21","localKeyId"),o("1.2.840.113549.1.9.22.1","x509Certificate"),o("1.2.840.113549.1.12.10.1.1","keyBag"),o("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),o("1.2.840.113549.1.12.10.1.3","certBag"),o("1.2.840.113549.1.12.10.1.4","crlBag"),o("1.2.840.113549.1.12.10.1.5","secretBag"),o("1.2.840.113549.1.12.10.1.6","safeContentsBag"),o("1.2.840.113549.1.5.13","pkcs5PBES2"),o("1.2.840.113549.1.5.12","pkcs5PBKDF2"),o("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),o("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),o("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),o("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),o("1.2.840.113549.2.7","hmacWithSHA1"),o("1.2.840.113549.2.8","hmacWithSHA224"),o("1.2.840.113549.2.9","hmacWithSHA256"),o("1.2.840.113549.2.10","hmacWithSHA384"),o("1.2.840.113549.2.11","hmacWithSHA512"),o("1.2.840.113549.3.7","des-EDE3-CBC"),o("2.16.840.1.101.3.4.1.2","aes128-CBC"),o("2.16.840.1.101.3.4.1.22","aes192-CBC"),o("2.16.840.1.101.3.4.1.42","aes256-CBC"),o("2.5.4.3","commonName"),o("2.5.4.5","serialName"),o("2.5.4.6","countryName"),o("2.5.4.7","localityName"),o("2.5.4.8","stateOrProvinceName"),o("2.5.4.10","organizationName"),o("2.5.4.11","organizationalUnitName"),o("2.16.840.1.113730.1.1","nsCertType"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),o("2.5.29.14","subjectKeyIdentifier"),o("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),o("2.5.29.17","subjectAltName"),o("2.5.29.18","issuerAltName"),o("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),o("2.5.29.31","cRLDistributionPoints"),o("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),o("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),o("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),o("1.3.6.1.4.1.11129.2.4.2","timestampList"),o("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),o("1.3.6.1.5.5.7.3.1","serverAuth"),o("1.3.6.1.5.5.7.3.2","clientAuth"),o("1.3.6.1.5.5.7.3.3","codeSigning"),o("1.3.6.1.5.5.7.3.4","emailProtection"),o("1.3.6.1.5.5.7.3.8","timeStamping")},function(e,t,n){"use strict";const r=t;r.Reporter=n(905).Reporter,r.DecoderBuffer=n(462).DecoderBuffer,r.EncoderBuffer=n(462).EncoderBuffer,r.Node=n(906)},function(e,t,n){(function(t){e.exports=function e(n,r){for(var i=Math.min(n.length,r.length),o=new t(i),s=0;s{const s=new i(Date.now()+Number(r)).toString(),a=f.ValidityType.EOL;b(e,t,n,s,a,o)},y=(e,t,n,r,i)=>{const o=f.ValidityType.EOL;b(e,t,n,r,o,i)},b=(e,t,n,r,i,o)=>{x(e,t,i,r,(e,s)=>{if(e)return c.error("record signature creation failed"),o(Object.assign(new Error("record signature verification failed"),{code:p.ERR_SIGNATURE_CREATION}));const a={value:t,signature:s,validityType:i,validity:r,sequence:n};return c(`ipns entry for ${t} created`),o(null,a)})},v=(e,t,n)=>{const{value:r,validityType:i,validity:o}=t,s=A(r,i,o);e.verify(s,t.signature,(e,t)=>{if(e||!t)return c.error("record signature verification failed"),n(Object.assign(new Error("record signature verification failed"),{code:p.ERR_SIGNATURE_VERIFICATION}));if(i===f.ValidityType.EOL){let e;try{e=h(o.toString())}catch(e){return c.error("unrecognized validity format (not an rfc3339 format)"),n(Object.assign(new Error("unrecognized validity format (not an rfc3339 format)"),{code:p.ERR_UNRECOGNIZED_FORMAT}))}if(e{if(!e||!e.bytes||!t){const e="one or more of the provided parameters are not defined";return c.error(e),n(Object.assign(new Error(e),{code:p.ERR_UNDEFINED_PARAMETER}))}a.createFromPubKey(e.bytes,(r,i)=>{if(r)return c.error(r),n(Object.assign(new Error(r),{code:p.ERR_PEER_ID_FROM_PUBLIC_KEY}));let o;try{o=I(i)}catch(r){return c.error(r),n(Object.assign(new Error(r),{code:p.ERR_PUBLIC_KEY_FROM_ID}))}if(o)return n(null,null);try{t.pubKey=s.keys.marshalPublicKey(e)}catch(r){return c.error(r),n(r)}n(null,t)})},_=(e,t,n)=>{if(!t||!e){const e="one or more of the provided parameters are not defined";return c.error(e),n(Object.assign(new Error(e),{code:p.ERR_UNDEFINED_PARAMETER}))}if(t.pubKey){let e;try{e=s.keys.unmarshalPublicKey(t.pubKey)}catch(e){return c.error(e),n(e)}return n(null,e)}e.pubKey?n(null,e.pubKey):n(Object.assign(new Error("no public key is available"),{code:p.ERR_UNDEFINED_PARAMETER}))},k=e=>r(e,"RFC4648",{padding:!1}),S=e=>new o(`/ipns/${k(e)}`),E=e=>{const n=t.from("/pk/"),r=t.from("/ipns/");return{routingPubKey:new o(t.concat([n,e])),pkKey:new o(k(t.concat([n,e]))),routingKey:new o(t.concat([r,e])),ipnsKey:new o(k(t.concat([r,e])))}},x=(e,t,n,r,i)=>{const o=A(t,n,r);e.sign(o,(e,t)=>e?i(e):i(null,t))},C=e=>{if("0"===e.toString())return"EOL";{const t=`unrecognized validity type ${e.toString()}`;throw c.error(t),Object.assign(new Error(t),{code:p.ERR_UNRECOGNIZED_VALIDITY})}},A=(e,n,r)=>{const i=t.from(e),o=t.from(C(n)),s=t.from(r);return t.concat([i,s,o])},I=e=>{const t=u.decode(e.id);return t.code!==d?null:s.keys.unmarshalPublicKey(t.digest)},T=f.encode,j=f.decode,O={validate:(e,t,n)=>{const r=j(e),i=t.slice("/ipns/".length);let o;try{o=a.createFromBytes(i)}catch(e){return n(e)}_(o,r,(e,t)=>{if(e)return n(e);v(t,r,e=>{if(e)return n(e);n(null,!0)})})},select:(e,t,n)=>{const r=j(e),i=j(t),o=r.sequence>i.sequence?0:1;if("function"!=typeof n)return o;n(null,o)}};e.exports={create:g,createWithExpiration:y,validate:v,embedPublicKey:w,extractPublicKey:_,getLocalKey:S,getIdKeys:E,marshal:T,unmarshal:j,validator:O,namespace:"/ipns/",namespaceLength:"/ipns/".length}}).call(this,n(0).Buffer)},function(e,t,n){const r=n(6).EventEmitter,i=n(18),o=n(1120);function s(e,t){"object"==typeof e&&(t=e,e="START"),i.equal(typeof e,"string"),i.equal(typeof t,"object"),i.ok(t[e],"invalid starting state "+e),i.ok(o.validate(t));const n=new r;return u._graph=o.reachable(t),u._emitter=n,u._events=t,u._state=e,u.emit=u,u.on=s,u;function s(e,t){n.on(e,t)}function u(e){const t=u._events[u._state][e];if(!a(u._state,t,u._graph)){const t="invalid transition: "+u._state+" -> "+e;return n.emit("error",t)}const r=u._state+":leave",i=t+":enter";return u._state?o():s();function o(){n._events[r]?n.emit(r,s):s()}function s(){n._events[i]?n.emit(i,l):l()}function l(){u._state=t,n.emit(t),n.emit("done")}}}function a(e,t,n){if(!t)return!1;if(!e)return!0;const r=n[e];return!(!r||!r[t])&&1===r[t].length}e.exports=s},function(e,t,n){"use strict";const r=n(24),i=n(44),o=n(23),s=n(186);e.exports=function(e){function t(e){let t=null;if(r.isMultiaddr(e)){const n=r(e);t=n.getPeerId()}else i.isPeerInfo(e)&&(t=e.id.toB58String());return t}function n(t){let n;if(i.isPeerInfo(t))n=t;else if(r.isMultiaddr(t)){const r=t.getPeerId();try{n=e._peerBook.get(r)}catch(e){n=new i(o.createFromB58String(r))}n.multiaddrs.add(t)}else if(o.isPeerId(t)){const r=t.toB58String();n=e._peerBook.has(r)?e._peerBook.get(r):t}return n}function a(t){return e.muxedConns[t]||e.conns[t]}function u(e,t,n){return n=n||(()=>{}),e.write(s.CircuitRelay.encode({type:s.CircuitRelay.Type.STATUS,code:t})),n()}function l(e,t,n,i){try{e.dstPeer.addrs.forEach(e=>r(e))}catch(e){return u(t,n===s.CircuitRelay.Type.HOP?s.CircuitRelay.Status.HOP_DST_MULTIADDR_INVALID:s.CircuitRelay.Status.STOP_DST_MULTIADDR_INVALID),i(e)}try{e.srcPeer.addrs.forEach(e=>r(e))}catch(e){return u(t,n===s.CircuitRelay.Type.HOP?s.CircuitRelay.Status.HOP_SRC_MULTIADDR_INVALID:s.CircuitRelay.Status.STOP_SRC_MULTIADDR_INVALID),i(e)}return i(null)}function c(e){return"string"==typeof e?o.createFromB58String(e):o.createFromBytes(e)}return{getB58String:t,peerInfoFromMa:n,isPeerConnected:a,validateAddrs:l,writeResponse:u,peerIdFromId:c}}},function(e,t,n){"use strict";const r=n(71);e.exports=r("\nmessage CircuitRelay {\n\n enum Status {\n SUCCESS = 100;\n HOP_SRC_ADDR_TOO_LONG = 220;\n HOP_DST_ADDR_TOO_LONG = 221;\n HOP_SRC_MULTIADDR_INVALID = 250;\n HOP_DST_MULTIADDR_INVALID = 251;\n HOP_NO_CONN_TO_DST = 260;\n HOP_CANT_DIAL_DST = 261;\n HOP_CANT_OPEN_DST_STREAM = 262;\n HOP_CANT_SPEAK_RELAY = 270;\n HOP_CANT_RELAY_TO_SELF = 280;\n STOP_SRC_ADDR_TOO_LONG = 320;\n STOP_DST_ADDR_TOO_LONG = 321;\n STOP_SRC_MULTIADDR_INVALID = 350;\n STOP_DST_MULTIADDR_INVALID = 351;\n STOP_RELAY_REFUSED = 390;\n MALFORMED_MESSAGE = 400;\n }\n\n enum Type { // RPC identifier, either HOP, STOP or STATUS\n HOP = 1;\n STOP = 2;\n STATUS = 3;\n CAN_HOP = 4;\n }\n\n message Peer {\n required bytes id = 1; // peer id\n repeated bytes addrs = 2; // peer's known addresses\n }\n\n optional Type type = 1; // Type of the message\n\n optional Peer srcPeer = 2; // srcPeer and dstPeer are used when Type is HOP or STATUS\n optional Peer dstPeer = 3;\n\n optional Status code = 4; // Status code, used when Type is STATUS\n}\n")},function(e,t,n){"use strict";const r=n(3),i=n(88),o=n(65),s=n(9),a="ERR_BAD_PATH";function u(e){const t=new Error("invalid ipfs ref path");e=e.replace(/^\/ipfs\//,"");const n=e.match(/([^/]+(?:\/[^/]+)*)\/?$/);if(!n)throw t;const[r,...i]=n[1].split("/");if(o.cid(r))return{hash:r,links:i};throw t}t.OFFLINE_ERROR="This command must be run in online mode. Try running 'ipfs daemon' first.";const l=e=>{if(o.cid(e))return`/ipfs/${e}`;if(o.path(e))return e;throw Object.assign(new Error(`invalid ${e} path`),{code:a})},c=r(function(e,n,r){Array.isArray(n)||(n=[n]),i(n,(n,r)=>{if("string"!=typeof n){let e;try{e=new s(n)}catch(e){return r(e)}return r(null,e.buffer)}let i;try{i=t.parseIpfsPath(n)}catch(e){return r(e)}const o=new s(i.hash),a=i.links;if(!a.length)return r(null,o.buffer);function u(t,n,i,o){if(i)return r(i);if(!n.length)return r(null,t.buffer);const s=n[0],a=o.links.find(e=>e.name===s);if(!a)return r(new Error(`no link named "${s}" under ${t.toBaseEncodedString()}`));e.get(a.cid,u.bind(null,a.cid,n.slice(1)))}e.get(o,u.bind(null,o,a))},r)});t.normalizePath=l,t.parseIpfsPath=u,t.resolvePath=c},function(e,t){function n(e){return"function"==typeof e}function r(e){return"object"==typeof e&&i(e.source)&&o(e.sink)}function i(e){return n(e)&&2===e.length}function o(e){return n(e)&&1===e.length}t.isDuplex=r,t.isSource=i,t.isSink=o},function(e,t,n){var r=n(525);e.exports=function(e,t){return function(n){var i=[],o,s;function a(e){i.push(e)}e=e||function(e){this.queue(e)},t=t||function(){this.queue(null)};var u={emit:function(e,t){"data"==e&&a(t),"end"==e&&(o=!0,a(null)),"error"==e&&(s=t)},queue:a},l;return function(a,c){if(o=o||a,a)return n(a,function(){if(l){var e=l;l=null,e(a)}c(a)});l=c,r(function r(a){if(l)if(c=l,s)l=null,c(s);else if(i.length){var f=i.shift();l=null,c(null===f,f)}else n(o,function(i,f){if(i&&!0!==i)return s=i,a();if(o=o||i)t.call(u);else if(null!==f&&(e.call(u,f),s||o))return n(s||o,function(){l=null,c(s||o)});a(r)})})}}}},function(e,t,n){var r=t;r.utils=n(93),r.common=n(191),r.sha=n(1337),r.ripemd=n(1341),r.hmac=n(1342),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},function(e,t,n){"use strict";var r=n(93),i=n(107);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=o,o.prototype.update=function e(t,n){if(t=r.toArray(t,n),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var i=t.length%this._delta8;this.pending=t.slice(t.length-i,t.length),0===this.pending.length&&(this.pending=null),t=r.join32(t,0,t.length-i,this.endian);for(var o=0;o>>24&255,i[o++]=t>>>16&255,i[o++]=t>>>8&255,i[o++]=255&t}else for(i[o++]=255&t,i[o++]=t>>>8&255,i[o++]=t>>>16&255,i[o++]=t>>>24&255,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,s=8;st.length)throw new Error("invalid rlp: total length is larger than the data");if(s=t.slice(r,f),0===s.length)throw new Error("invalid rlp, List has a invalid length");for(;s.length;)a=l(s),u.push(a.data),s=a.remainder;return{data:u,remainder:t.slice(f)}}function c(e){return"0x"===e.slice(0,2)}function f(e){return"string"!=typeof e?e:c(e)?e.slice(2):e}function h(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");var t=e.toString(16);return t.length%2?"0"+t:t}function p(e){return e.length%2?"0"+e:e}function d(t){var n=h(t);return e.from(n,"hex")}function m(t){if(!e.isBuffer(t)){if("string"==typeof t)return c(t)?e.from(p(f(t)),"hex"):e.from(t);if("number"==typeof t)return t?d(t):e.from([]);if(null===t||void 0===t)return e.from([]);if(t instanceof Uint8Array)return e.from(t);if(r.isBN(t))return e.from(t.toArray());throw new Error("invalid type")}return t}t.encode=i,t.decode=a,t.getLength=u}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(9),i=n(35);function o(e,t,n){n=n||{};const o=n.hashAlg||"keccak-256",s=void 0===n.version?1:n.version,a=i.encode(t,o);return new r(s,e,a)}e.exports=o},function(e,t,n){"use strict";const r=n(11),i=n(588),o=n(589);function s(e,t,n){const s=o(e,t),a={multicodec:e,defaultHashAlg:"keccak-256",resolve:c,tree:u,isLink:i(c),_resolveFromEthObject:f,_treeFromEthObject:l,_mapFromEthObject:n};return{resolver:a,util:s};function u(e,t,n){"function"==typeof t&&(n=t,t=void 0),t||(t={}),r([t=>s.deserialize(e,t),(e,n)=>l(e,t,n)],n)}function l(e,t,i){r([r=>n(e,t,r),(e,t)=>t(null,e.map(e=>e.path))],i)}function c(e,t,n){r([t=>s.deserialize(e,t),(e,n)=>f(e,t,n)],n)}function f(e,t,r){if(!t||"/"===t){const t={value:e,remainderPath:""};return r(null,t)}n(e,{},(e,n)=>{if(e)return r(e);const i=t.split("/");let o=n.filter(e=>e.path===t.slice(0,e.path.length));o=o.filter(e=>e.path.split("/").every((e,t)=>e===i[t]));const s=o.sort((e,t)=>t.path.length-e.path.length),a=s[0];if(!a){let e=new Error('Path not found ("'+t+'").');return r(e)}const u=t.slice(a.path.length+1),l={value:a.value,remainderPath:u};return r(null,l)})}}e.exports=s},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(274),o=n(0),s=n(60).sha256sha256,a=function e(n){if(!(this instanceof e))return new e(n);if(t.isBuffer(n)){var r=n;this.fromBuffer(r)}else if("string"==typeof n){var i=n;this.fromString(i)}else n&&this.set(n)};a.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},a.validChecksum=function e(t,n){return r.isString(t)&&(t=new o.Buffer(i.decode(t))),r.isString(n)&&(n=new o.Buffer(i.decode(n))),n||(n=t.slice(-4),t=t.slice(0,-4)),a.checksum(t).toString("hex")===n.toString("hex")},a.decode=function(e){if("string"!=typeof e)throw new Error("Input must be a string");var n=new t(i.decode(e));if(n.length<4)throw new Error("Input string too short");var r=n.slice(0,-4),o=n.slice(-4),a=s(r),u=a.slice(0,4);if(o.toString("hex")!==u.toString("hex"))throw new Error("Checksum mismatch");return r},a.checksum=function(e){return s(e).slice(0,4)},a.encode=function(e){if(!t.isBuffer(e))throw new Error("Input must be a buffer");var n=new t(e.length+4),r=a.checksum(e);return e.copy(n),r.copy(n,e.length),i.encode(n)},a.prototype.fromBuffer=function(e){return this.buf=e,this},a.prototype.fromString=function(e){var t=a.decode(e);return this.buf=t,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(17),i=n(25),o=n(84),s=n(80),a=n(0),u=n(30),l=n(41),c=n(86),f=n(110),h=n(111),p=4294967295,d=p-2,m=p,g=p-1;function y(e){return this instanceof y?e?this._fromObject(e):void 0:new y(e)}y.MAXINT=p,y.DEFAULT_SEQNUMBER=4294967295,y.DEFAULT_LOCKTIME_SEQNUMBER=4294967294,y.DEFAULT_RBF_SEQNUMBER=4294967293,Object.defineProperty(y.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new c(this._scriptBuffer),this._script._isInput=!0),this._script)}}),y.fromObject=function(e){i.checkArgument(r.isObject(e));var t=new y;return t._fromObject(e)},y.prototype._fromObject=function(e){var t;if(t=r.isString(e.prevTxId)&&l.isHexa(e.prevTxId)?new a.Buffer(e.prevTxId,"hex"):e.prevTxId,this.output=e.output?e.output instanceof h?e.output:new h(e.output):void 0,this.prevTxId=t||e.txidbuf,this.outputIndex=r.isUndefined(e.outputIndex)?e.txoutnum:e.outputIndex,this.sequenceNumber=r.isUndefined(e.sequenceNumber)?r.isUndefined(e.seqnum)?4294967295:e.seqnum:e.sequenceNumber,r.isUndefined(e.script)&&r.isUndefined(e.scriptBuffer))throw new o.Transaction.Input.MissingScript;return this.setScript(e.scriptBuffer||e.script),this},y.prototype.toObject=y.prototype.toJSON=function e(){var t={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(t.scriptString=this.script.toString()),this.output&&(t.output=this.output.toObject()),t},y.fromBufferReader=function(e){var t=new y;return t.prevTxId=e.readReverse(32),t.outputIndex=e.readUInt32LE(),t._scriptBuffer=e.readVarLengthBuffer(),t.sequenceNumber=e.readUInt32LE(),t},y.prototype.toBufferWriter=function(e){e||(e=new s),e.writeReverse(this.prevTxId),e.writeUInt32LE(this.outputIndex);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e.writeUInt32LE(this.sequenceNumber),e},y.prototype.setScript=function(e){if(this._script=null,e instanceof c)this._script=e,this._script._isInput=!0,this._scriptBuffer=e.toBuffer();else if(l.isHexa(e))this._scriptBuffer=new a.Buffer(e,"hex");else if(r.isString(e))this._script=new c(e),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else{if(!u.isBuffer(e))throw new TypeError("Invalid argument type: script");this._scriptBuffer=new a.Buffer(e)}return this},y.prototype.getSignatures=function(){throw new o.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))},y.prototype.isFullySigned=function(){throw new o.AbstractMethodInvoked("Input#isFullySigned")},y.prototype.isFinal=function(){return 4294967295!==this.sequenceNumber},y.prototype.addSignature=function(){throw new o.AbstractMethodInvoked("Input#addSignature")},y.prototype.clearSignatures=function(){throw new o.AbstractMethodInvoked("Input#clearSignatures")},y.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,f.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script)},y.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},y.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},e.exports=y},function(e,t){"function"==typeof Object.create?e.exports=function e(t,n){t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function e(t,n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(25),o=n(198),s=n(30),a=n(41),u=n(96),l=n(84),c=n(85);function f(e){if(!(this instanceof f))return new f(e);if(e instanceof f)return e;if(r.isObject(e))return this._fromObject(e);throw new l.InvalidArgument("TransactionSignatures must be instantiated from an object")}o(f,c),f.prototype._fromObject=function(e){return this._checkObjectArgs(e),this.publicKey=new u(e.publicKey),this.prevTxId=s.isBuffer(e.prevTxId)?e.prevTxId:new t(e.prevTxId,"hex"),this.outputIndex=e.outputIndex,this.inputIndex=e.inputIndex,this.signature=e.signature instanceof c?e.signature:s.isBuffer(e.signature)?c.fromBuffer(e.signature):c.fromString(e.signature),this.sigtype=e.sigtype,this},f.prototype._checkObjectArgs=function(e){i.checkArgument(u(e.publicKey),"publicKey"),i.checkArgument(!r.isUndefined(e.inputIndex),"inputIndex"),i.checkArgument(!r.isUndefined(e.outputIndex),"outputIndex"),i.checkState(r.isNumber(e.inputIndex),"inputIndex must be a number"),i.checkState(r.isNumber(e.outputIndex),"outputIndex must be a number"),i.checkArgument(e.signature,"signature"),i.checkArgument(e.prevTxId,"prevTxId"),i.checkState(e.signature instanceof c||s.isBuffer(e.signature)||a.isHexa(e.signature),"signature must be a buffer or hexa value"),i.checkState(s.isBuffer(e.prevTxId)||a.isHexa(e.prevTxId),"prevTxId must be a buffer or hexa value"),i.checkArgument(e.sigtype,"sigtype"),i.checkState(r.isNumber(e.sigtype),"sigtype must be a number")},f.prototype.toObject=f.prototype.toJSON=function e(){return{publicKey:this.publicKey.toString(),prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,inputIndex:this.inputIndex,signature:this.signature.toString(),sigtype:this.sigtype}},f.fromObject=function(e){return i.checkArgument(e),new f(e)},e.exports=f}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var r=n(20).Writable,i=n(1),o=n(278);if("undefined"==typeof Uint8Array)var s=n(1461).Uint8Array;else var s=Uint8Array;function a(e,t){if(!(this instanceof a))return new a(e,t);"function"==typeof e&&(t=e,e={}),e||(e={});var n=e.encoding,i=!1;n?(n=String(n).toLowerCase(),"u8"!==n&&"uint8"!==n||(n="uint8array")):i=!0,r.call(this,{objectMode:!0}),this.encoding=n,this.shouldInferEncoding=i,t&&this.on("finish",function(){t(this.getBody())}),this.body=[]}e.exports=a,i(a,r),a.prototype._write=function(e,t,n){this.body.push(e),n()},a.prototype.inferEncoding=function(e){var n=void 0===e?this.body[0]:e;return t.isBuffer(n)?"buffer":"undefined"!=typeof Uint8Array&&n instanceof Uint8Array?"uint8array":Array.isArray(n)?"array":"string"==typeof n?"string":"[object Object]"===Object.prototype.toString.call(n)?"object":"buffer"},a.prototype.getBody=function(){return this.encoding||0!==this.body.length?(this.shouldInferEncoding&&(this.encoding=this.inferEncoding()),"array"===this.encoding?p(this.body):"string"===this.encoding?f(this.body):"buffer"===this.encoding?h(this.body):"uint8array"===this.encoding?d(this.body):this.body):[]};var u=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)};function l(e){return/Array\]$/.test(Object.prototype.toString.call(e))}function c(e){return"string"==typeof e||l(e)||e&&"function"==typeof e.subarray}function f(e){for(var n=[],r=!1,i=0;in=>{let f,h=!1,p=!1;n=n?Object.assign({},n,n.qs):{};const d=new u,m=new r({objectMode:!0});m._read=(e=>{}),m._write=((e,t,r)=>{const o=s(r);try{const r=a(e,n).map(e=>Object.assign({headers:l(e)},e));p=!0,i(r,(e,n)=>d.write(e,t,n),e=>{if(p=!1,e)return o(e);h&&d.end(),o()})}catch(e){o(e)}}),m.once("finish",()=>{h||(h=!0,p||d.end())});const g=n.qs||{};g["cid-version"]=c(n,"cid-version","cidVersion"),g["raw-leaves"]=c(n,"raw-leaves","rawLeaves"),g["only-hash"]=c(n,"only-hash","onlyHash"),g["wrap-with-directory"]=c(n,"wrap-with-directory","wrapWithDirectory"),g.hash=c(n,"hash","hashAlg");const y={path:t,qs:g,args:n.args,multipart:!0,multipartBoundary:d._boundary,stream:!0,recursive:!0,progress:n.progress};return d.on("error",e=>{m.emit("error",e)}),f=e(y,(e,t)=>{if(e)return m.emit("error",e);if(!t)return m.push(null);if(!o(t))return m.push(t),void m.push(null);if(t.on("error",e=>m.emit("error",e)),n.converter){t.on("data",e=>{e.Bytes&&n.progress&&n.progress(e.Bytes)});const e=n.converter,r=new e;r.once("end",()=>m.push(null)),r.on("data",e=>m.push(e)),t.pipe(r)}else t.on("data",e=>{e.Bytes&&n.progress&&n.progress(e.Bytes),m.push(e)}),t.once("end",()=>m.push(null))}),f.on("drain",()=>d.emit("drain")),d.pipe(f),m})},function(e,t){e.exports=!1},function(e,t,n){var r=n(154),i=n(32),o=e.exports;for(var s in r)r.hasOwnProperty(s)&&(o[s]=r[s]);function a(e){if("string"==typeof e&&(e=i.parse(e)),e.protocol||(e.protocol="https:"),"https:"!==e.protocol)throw new Error('Protocol "'+e.protocol+'" not supported. Expected "https:"');return e}o.request=function(e,t){return e=a(e),r.request.call(this,e,t)},o.get=function(e,t){return e=a(e),r.get.call(this,e,t)}},function(e,t,n){"use strict";var r=n(10),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=f;var o=n(7);o.inherits=n(1);var s=n(1492),a=n(1496);o.inherits(f,s);for(var u=i(a.prototype),l=0;l>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")}e.exports=l,e.exports.sync=u},function(e,t,n){e.exports=d;var r=n(27),i=n(31).Buffer,o=n(55),s=n(15),a=n(97),u=n(46),l=n(50),c=n(212),f=n(47),h=a.FingerprintFormatError,p=a.InvalidAlgorithmError;function d(e){if(r.object(e,"options"),r.string(e.type,"options.type"),r.buffer(e.hash,"options.hash"),r.string(e.algorithm,"options.algorithm"),this.algorithm=e.algorithm.toLowerCase(),!0!==o.hashAlgs[this.algorithm])throw new p(this.algorithm);this.hash=e.hash,this.type=e.type,this.hashType=e.hashType}d.prototype.toString=function(e){switch(void 0===e&&(e="md5"===this.algorithm||"spki"===this.hashType?"hex":"base64"),r.string(e),e){case"hex":return"spki"===this.hashType?this.hash.toString("hex"):y(this.hash.toString("hex"));case"base64":return"spki"===this.hashType?this.hash.toString("base64"):v(this.algorithm,this.hash.toString("base64"));default:throw new h(void 0,e)}},d.prototype.matches=function(e){r.object(e,"key or certificate"),"key"===this.type&&"ssh"!==this.hashType?(f.assertCompatible(e,u,[1,7],"key with spki"),l.isPrivateKey(e)&&f.assertCompatible(e,l,[1,6],"privatekey with spki support")):"key"===this.type?f.assertCompatible(e,u,[1,0],"key"):f.assertCompatible(e,c,[1,0],"certificate");var t=e.hash(this.algorithm,this.hashType),n=s.createHash(this.algorithm).update(t).digest("base64");return void 0===this.hash2&&(this.hash2=s.createHash(this.algorithm).update(this.hash).digest("base64")),this.hash2===n};var m=/^[A-Za-z0-9+\/=]+$/,g=/^[a-fA-F0-9]+$/;function y(e){return e.replace(/(.{2})(?=.)/g,"$1:")}function b(e){return e.replace(/=*$/,"")}function v(e,t){return e.toUpperCase()+":"+b(t)}d.parse=function(e,t){var n,s,a;r.string(e,"fingerprint"),Array.isArray(t)&&(a=t,t={}),r.optionalObject(t,"options"),void 0===t&&(t={}),void 0!==t.enAlgs&&(a=t.enAlgs),void 0!==t.algorithms&&(a=t.algorithms),r.optionalArrayOfString(a,"algorithms");var u="ssh";void 0!==t.hashType&&(u=t.hashType),r.string(u,"options.hashType");var l=e.split(":");if(2==l.length){if(n=l[0].toLowerCase(),!m.test(l[1]))throw new h(e);try{s=i.from(l[1],"base64")}catch(t){throw new h(e)}}else if(l.length>2){if(n="md5","md5"===l[0].toLowerCase()&&(l=l.slice(1)),l=l.map(function(t){for(;t.length<2;)t="0"+t;if(t.length>2)throw new h(e);return t}),l=l.join(""),!g.test(l)||l.length%2!=0)throw new h(e);try{s=i.from(l,"hex")}catch(t){throw new h(e)}}else{if(g.test(e))s=i.from(e,"hex");else{if(!m.test(e))throw new h(e);s=i.from(e,"base64")}switch(s.length){case 32:n="sha256";break;case 16:n="md5";break;case 20:n="sha1";break;case 64:n="sha512";break;default:throw new h(e)}void 0===t.hashType&&(u="spki")}if(void 0===n)throw new h(e);if(void 0===o.hashAlgs[n])throw new p(n);if(void 0!==a&&(a=a.map(function(e){return e.toLowerCase()}),-1===a.indexOf(n)))throw new p(n);return new d({algorithm:n,hash:s,type:t.type||"key",hashType:u})},d.isFingerprint=function(e,t){return f.isCompatible(e,d,t)},d.prototype._sshpkApiVersion=[1,2],d._oldVersionDetect=function(e){return r.func(e.toString),r.func(e.matches),[1,0]}},function(e,t,n){(function(){var n,r=0xdeadbeefcafe,i=!0;function o(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new o(null)}function a(e,t,n,r,i,o){for(;--o>=0;){var s=t*this[e++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i}function u(e,t,n,r,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var u=32767&this[e],l=this[e++]>>15,c=a*u+l*s;u=s*u+((32767&c)<<15)+n[r]+(1073741823&i),i=(u>>>30)+(c>>>15)+a*l+(i>>>30),n[r++]=1073741823&u}return i}function l(e,t,n,r,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var u=16383&this[e],l=this[e++]>>14,c=a*u+l*s;u=s*u+((16383&c)<<14)+n[r]+i,i=(u>>28)+(c>>14)+a*l,n[r++]=268435455&u}return i}var c="undefined"!=typeof navigator;c&&"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=u,n=30):c&&"Netscape"!=navigator.appName?(o.prototype.am=a,n=26):(o.prototype.am=l,n=28),o.prototype.DB=n,o.prototype.DM=(1<=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function v(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function w(e){var t=s();return t.fromInt(e),t}function _(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,s=0;--r>=0;){var a=8==n?255&e[r]:y(e,r);a<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==s?this[this.t++]=a:s+n>this.DB?(this[this.t-1]|=(a&(1<>this.DB-s):this[this.t-1]|=a<=this.DB&&(s-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==e;)--this.t}function S(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n=(1<0)for(a>a)>0&&(i=!0,o=g(r));s>=0;)a>(a+=this.DB-t)):(r=this[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=g(r));return i?o:"0"}function E(){var e=s();return o.ZERO.subTo(this,e),e}function x(){return this.s<0?this.negate():this}function C(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(t=n-e.t,0!=t)return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0}function A(e){var t=1,n;return 0!=(n=e>>>16)&&(e=n,t+=16),0!=(n=e>>8)&&(e=n,t+=8),0!=(n=e>>4)&&(e=n,t+=4),0!=(n=e>>2)&&(e=n,t+=2),0!=(n=e>>1)&&(e=n,t+=1),t}function I(){return this.t<=0?0:this.DB*(this.t-1)+A(this[this.t-1]^this.s&this.DM)}function T(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s}function j(e,t){for(var n=e;n=0;--a)t[a+o+1]=this[a]>>r|s,s=(this[a]&i)<=0;--a)t[a]=0;t[o]=s,t.t=this.t+o+1,t.s=this.s,t.clamp()}function P(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<>r;for(var s=n+1;s>r;r>0&&(t[this.t-n-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()}function R(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t[i]=0;for(i=0;i=0;)e[n]=0;for(n=0;n=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()}function M(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t0?(r.lShiftTo(c,a),i.lShiftTo(c,n)):(r.copyTo(a),i.copyTo(n));var f=a.t,h=a[f-1];if(0!=h){var p=h*(1<1?a[f-2]>>this.F2:0),d=this.FV/p,m=(1<=0&&(n[n.t++]=1,n.subTo(v,n)),o.ONE.dlShiftTo(f,v),v.subTo(a,a);a.t=0;){var w=n[--y]==h?this.DM:Math.floor(n[y]*d+(n[y-1]+g)*m);if((n[y]+=a.am(0,w,n,b,0,f))0&&n.rShiftTo(c,n),u<0&&o.ZERO.subTo(n,n)}}}function L(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(o.ZERO)>0&&e.subTo(t,t),t}function F(e){this.m=e}function D(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function U(e){return e}function z(e){e.divRemTo(this.m,null,e)}function q(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function K(e,t){e.squareTo(t),this.reduce(t)}function H(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function V(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function $(e){var t=s();return e.copyTo(t),this.reduce(t),t}function G(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function Y(e,t){e.squareTo(t),this.reduce(t)}function J(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function Z(){return 0==(this.t>0?1&this[0]:this.s)}function Q(e,t){if(e>4294967295||e<1)return o.ONE;var n=s(),r=s(),i=t.convert(this),a=A(e)-1;for(i.copyTo(n);--a>=0;)if(t.sqrTo(n,r),(e&1<0)t.mulTo(r,i,n);else{var u=n;n=r,r=u}return t.revert(n)}function X(e,t){var n;return n=e<256||t.isEven()?new F(t):new V(t),this.exp(e,n)}function ee(){var e=s();return this.copyTo(e),e}function te(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function re(){return 0==this.t?this.s:this[0]<<16>>16}function ie(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function oe(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function se(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),r=w(n),i=s(),o=s(),a="";for(this.divRemTo(r,i,o);i.signum()>0;)a=(n+o.intValue()).toString(e).substr(1)+a,i.divRemTo(r,i,o);return o.intValue().toString(e)+a}function ae(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),r=Math.pow(t,n),i=!1,s=0,a=0,u=0;u=n&&(this.dMultiply(r),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(a,0)),i&&o.ZERO.subTo(this,this)}function ue(e,t,n){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(o.ONE.shiftLeft(e-1),ge,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(o.ONE.shiftLeft(e-1),this);else{var r=new Array,i=7&e;r.length=1+(e>>3),t.nextBytes(r),i>0?r[0]&=(1<0)for(n>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<=0;)n<8?(r=(this[e]&(1<>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t}function ce(e){return 0==this.compareTo(e)}function fe(e){return this.compareTo(e)<0?this:e}function he(e){return this.compareTo(e)>0?this:e}function pe(e,t,n){var r,i,o=Math.min(e.t,this.t);for(r=0;r>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function Ce(){for(var e=0;e=this.t?0!=this.s:0!=(this[t]&1<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()}function Ne(e){var t=s();return this.addTo(e,t),t}function Me(e){var t=s();return this.subTo(e,t),t}function Le(e){var t=s();return this.multiplyTo(e,t),t}function Fe(){var e=s();return this.squareTo(e),e}function De(e){var t=s();return this.divRemTo(e,t,null),t}function Ue(e){var t=s();return this.divRemTo(e,null,t),t}function ze(e){var t=s(),n=s();return this.divRemTo(e,t,n),new Array(t,n)}function qe(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Ke(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function He(){}function Ve(e){return e}function We(e,t,n){e.multiplyTo(t,n)}function $e(e,t){e.squareTo(t)}function Ge(e){return this.exp(e,new He)}function Ye(e,t,n){var r=Math.min(this.t+e.t,t),i;for(n.s=0,n.t=r;r>0;)n[--r]=0;for(i=n.t-this.t;r=0;)n[r]=0;for(r=Math.max(t-this.t,0);r2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t}function Xe(e){return e}function et(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function tt(e,t){e.squareTo(t),this.reduce(t)}function nt(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function rt(e,t){var n=e.bitLength(),r,i=w(1),o;if(n<=0)return i;r=n<18?1:n<48?3:n<144?4:n<768?5:6,o=n<8?new F(t):t.isEven()?new Ze(t):new V(t);var a=new Array,u=3,l=r-1,c=(1<1){var f=s();for(o.sqrTo(a[1],f);u<=c;)a[u]=s(),o.mulTo(f,a[u-2],a[u]),u+=2}var h=e.t-1,p,d=!0,m=s(),g;for(n=A(e[h])-1;h>=0;){for(n>=l?p=e[h]>>n-l&c:(p=(e[h]&(1<0&&(p|=e[h-1]>>this.DB+n-l)),u=r;0==(1&p);)p>>=1,--u;if((n-=u)<0&&(n+=this.DB,--h),d)a[p].copyTo(i),d=!1;else{for(;u>1;)o.sqrTo(i,m),o.sqrTo(m,i),u-=2;u>0?o.sqrTo(i,m):(g=i,i=m,m=g),o.mulTo(m,a[p],i)}for(;h>=0&&0==(e[h]&1<0&&(t.rShiftTo(o,t),n.rShiftTo(o,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n}function ot(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this[r])%e;return n}function st(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return o.ZERO;for(var n=e.clone(),r=this.clone(),i=w(1),s=w(0),a=w(0),u=w(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),t?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;r.isEven();)r.rShiftTo(1,r),t?(a.isEven()&&u.isEven()||(a.addTo(this,a),u.subTo(e,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);n.compareTo(r)>=0?(n.subTo(r,n),t&&i.subTo(a,i),s.subTo(u,s)):(r.subTo(n,r),t&&a.subTo(i,a),u.subTo(s,u))}return 0!=r.compareTo(o.ONE)?o.ZERO:u.compareTo(e)>=0?u.subtract(e):u.signum()<0?(u.addTo(e,u),u.signum()<0?u.add(e):u):u}F.prototype.convert=D,F.prototype.revert=U,F.prototype.reduce=z,F.prototype.mulTo=q,F.prototype.sqrTo=K,V.prototype.convert=W,V.prototype.revert=$,V.prototype.reduce=G,V.prototype.mulTo=J,V.prototype.sqrTo=Y,o.prototype.copyTo=b,o.prototype.fromInt=v,o.prototype.fromString=_,o.prototype.clamp=k,o.prototype.dlShiftTo=T,o.prototype.drShiftTo=j,o.prototype.lShiftTo=O,o.prototype.rShiftTo=P,o.prototype.subTo=B,o.prototype.multiplyTo=R,o.prototype.squareTo=N,o.prototype.divRemTo=M,o.prototype.invDigit=H,o.prototype.isEven=Z,o.prototype.exp=Q,o.prototype.toString=S,o.prototype.negate=E,o.prototype.abs=x,o.prototype.compareTo=C,o.prototype.bitLength=I,o.prototype.mod=L,o.prototype.modPowInt=X,o.ZERO=w(0),o.ONE=w(1),He.prototype.convert=Ve,He.prototype.revert=Ve,He.prototype.mulTo=We,He.prototype.sqrTo=$e,Ze.prototype.convert=Qe,Ze.prototype.revert=Xe,Ze.prototype.reduce=et,Ze.prototype.mulTo=nt,Ze.prototype.sqrTo=tt;var at=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],ut=(1<<26)/at[at.length-1],lt,ct,ft;function ht(e){var t,n=this.abs();if(1==n.t&&n[0]<=at[at.length-1]){for(t=0;t>1,e>at.length&&(e=at.length);for(var i=s(),a=0;a>8&255,ct[ft++]^=e>>16&255,ct[ft++]^=e>>24&255,ft>=Ct&&(ft-=Ct)}function mt(){dt((new Date).getTime())}if(o.prototype.chunkSize=ie,o.prototype.toRadix=se,o.prototype.fromRadix=ae,o.prototype.fromNumber=ue,o.prototype.bitwiseTo=pe,o.prototype.changeBit=je,o.prototype.addTo=Re,o.prototype.dMultiply=qe,o.prototype.dAddOffset=Ke,o.prototype.multiplyLowerTo=Ye,o.prototype.multiplyUpperTo=Je,o.prototype.modInt=ot,o.prototype.millerRabin=pt,o.prototype.clone=ee,o.prototype.intValue=te,o.prototype.byteValue=ne,o.prototype.shortValue=re,o.prototype.signum=oe,o.prototype.toByteArray=le,o.prototype.equals=ce,o.prototype.min=fe,o.prototype.max=he,o.prototype.and=me,o.prototype.or=ye,o.prototype.xor=ve,o.prototype.andNot=_e,o.prototype.not=ke,o.prototype.shiftLeft=Se,o.prototype.shiftRight=Ee,o.prototype.getLowestSetBit=Ce,o.prototype.bitCount=Ie,o.prototype.testBit=Te,o.prototype.setBit=Oe,o.prototype.clearBit=Pe,o.prototype.flipBit=Be,o.prototype.add=Ne,o.prototype.subtract=Me,o.prototype.multiply=Le,o.prototype.divide=De,o.prototype.remainder=Ue,o.prototype.divideAndRemainder=ze,o.prototype.modPow=rt,o.prototype.modInverse=st,o.prototype.pow=Ge,o.prototype.gcd=it,o.prototype.isProbablePrime=ht,o.prototype.square=Fe,o.prototype.Barrett=Ze,null==ct){var gt;if(ct=new Array,ft=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var yt=new Uint8Array(32);for(window.crypto.getRandomValues(yt),gt=0;gt<32;++gt)ct[ft++]=yt[gt]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var bt=window.crypto.random(32);for(gt=0;gt>>8,ct[ft++]=255>ft=0,mt()}function vt(){if(null==lt){for(mt(),lt=xt(),lt.init(ct),ft=0;ft>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=255&r}function m(e,t,n,r,i){var o,s=0;for(o=0;o>>8)-1}function g(e,t,n,r){return m(e,t,n,r,16)}function y(e,t,n,r){return m(e,t,n,r,32)}function b(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,l=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,b=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,v=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,w=i,_=o,k=s,S=a,E=u,x=l,C=c,A=f,I=h,T=p,j=d,O=m,P=g,B=y,R=b,N=v,M,L=0;L<20;L+=2)M=w+P|0,E^=M<<7|M>>>25,M=E+w|0,I^=M<<9|M>>>23,M=I+E|0,P^=M<<13|M>>>19,M=P+I|0,w^=M<<18|M>>>14,M=x+_|0,T^=M<<7|M>>>25,M=T+x|0,B^=M<<9|M>>>23,M=B+T|0,_^=M<<13|M>>>19,M=_+B|0,x^=M<<18|M>>>14,M=j+C|0,R^=M<<7|M>>>25,M=R+j|0,k^=M<<9|M>>>23,M=k+R|0,C^=M<<13|M>>>19,M=C+k|0,j^=M<<18|M>>>14,M=N+O|0,S^=M<<7|M>>>25,M=S+N|0,A^=M<<9|M>>>23,M=A+S|0,O^=M<<13|M>>>19,M=O+A|0,N^=M<<18|M>>>14,M=w+S|0,_^=M<<7|M>>>25,M=_+w|0,k^=M<<9|M>>>23,M=k+_|0,S^=M<<13|M>>>19,M=S+k|0,w^=M<<18|M>>>14,M=x+E|0,C^=M<<7|M>>>25,M=C+x|0,A^=M<<9|M>>>23,M=A+C|0,E^=M<<13|M>>>19,M=E+A|0,x^=M<<18|M>>>14,M=j+T|0,O^=M<<7|M>>>25,M=O+j|0,I^=M<<9|M>>>23,M=I+O|0,T^=M<<13|M>>>19,M=T+I|0,j^=M<<18|M>>>14,M=N+R|0,P^=M<<7|M>>>25,M=P+N|0,B^=M<<9|M>>>23,M=B+P|0,R^=M<<13|M>>>19,M=R+B|0,N^=M<<18|M>>>14;w=w+i|0,_=_+o|0,k=k+s|0,S=S+a|0,E=E+u|0,x=x+l|0,C=C+c|0,A=A+f|0,I=I+h|0,T=T+p|0,j=j+d|0,O=O+m|0,P=P+g|0,B=B+y|0,R=R+b|0,N=N+v|0,e[0]=w>>>0&255,e[1]=w>>>8&255,e[2]=w>>>16&255,e[3]=w>>>24&255,e[4]=_>>>0&255,e[5]=_>>>8&255,e[6]=_>>>16&255,e[7]=_>>>24&255,e[8]=k>>>0&255,e[9]=k>>>8&255,e[10]=k>>>16&255,e[11]=k>>>24&255,e[12]=S>>>0&255,e[13]=S>>>8&255,e[14]=S>>>16&255,e[15]=S>>>24&255,e[16]=E>>>0&255,e[17]=E>>>8&255,e[18]=E>>>16&255,e[19]=E>>>24&255,e[20]=x>>>0&255,e[21]=x>>>8&255,e[22]=x>>>16&255,e[23]=x>>>24&255,e[24]=C>>>0&255,e[25]=C>>>8&255,e[26]=C>>>16&255,e[27]=C>>>24&255,e[28]=A>>>0&255,e[29]=A>>>8&255,e[30]=A>>>16&255,e[31]=A>>>24&255,e[32]=I>>>0&255,e[33]=I>>>8&255,e[34]=I>>>16&255,e[35]=I>>>24&255,e[36]=T>>>0&255,e[37]=T>>>8&255,e[38]=T>>>16&255,e[39]=T>>>24&255,e[40]=j>>>0&255,e[41]=j>>>8&255,e[42]=j>>>16&255,e[43]=j>>>24&255,e[44]=O>>>0&255,e[45]=O>>>8&255,e[46]=O>>>16&255,e[47]=O>>>24&255,e[48]=P>>>0&255,e[49]=P>>>8&255,e[50]=P>>>16&255,e[51]=P>>>24&255,e[52]=B>>>0&255,e[53]=B>>>8&255,e[54]=B>>>16&255,e[55]=B>>>24&255,e[56]=R>>>0&255,e[57]=R>>>8&255,e[58]=R>>>16&255,e[59]=R>>>24&255,e[60]=N>>>0&255,e[61]=N>>>8&255,e[62]=N>>>16&255,e[63]=N>>>24&255}function v(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,l=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,b=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,v=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,w=i,_=o,k=s,S=a,E=u,x=l,C=c,A=f,I=h,T=p,j=d,O=m,P=g,B=y,R=b,N=v,M,L=0;L<20;L+=2)M=w+P|0,E^=M<<7|M>>>25,M=E+w|0,I^=M<<9|M>>>23,M=I+E|0,P^=M<<13|M>>>19,M=P+I|0,w^=M<<18|M>>>14,M=x+_|0,T^=M<<7|M>>>25,M=T+x|0,B^=M<<9|M>>>23,M=B+T|0,_^=M<<13|M>>>19,M=_+B|0,x^=M<<18|M>>>14,M=j+C|0,R^=M<<7|M>>>25,M=R+j|0,k^=M<<9|M>>>23,M=k+R|0,C^=M<<13|M>>>19,M=C+k|0,j^=M<<18|M>>>14,M=N+O|0,S^=M<<7|M>>>25,M=S+N|0,A^=M<<9|M>>>23,M=A+S|0,O^=M<<13|M>>>19,M=O+A|0,N^=M<<18|M>>>14,M=w+S|0,_^=M<<7|M>>>25,M=_+w|0,k^=M<<9|M>>>23,M=k+_|0,S^=M<<13|M>>>19,M=S+k|0,w^=M<<18|M>>>14,M=x+E|0,C^=M<<7|M>>>25,M=C+x|0,A^=M<<9|M>>>23,M=A+C|0,E^=M<<13|M>>>19,M=E+A|0,x^=M<<18|M>>>14,M=j+T|0,O^=M<<7|M>>>25,M=O+j|0,I^=M<<9|M>>>23,M=I+O|0,T^=M<<13|M>>>19,M=T+I|0,j^=M<<18|M>>>14,M=N+R|0,P^=M<<7|M>>>25,M=P+N|0,B^=M<<9|M>>>23,M=B+P|0,R^=M<<13|M>>>19,M=R+B|0,N^=M<<18|M>>>14;e[0]=w>>>0&255,e[1]=w>>>8&255,e[2]=w>>>16&255,e[3]=w>>>24&255,e[4]=x>>>0&255,e[5]=x>>>8&255,e[6]=x>>>16&255,e[7]=x>>>24&255,e[8]=j>>>0&255,e[9]=j>>>8&255,e[10]=j>>>16&255,e[11]=j>>>24&255,e[12]=N>>>0&255,e[13]=N>>>8&255,e[14]=N>>>16&255,e[15]=N>>>24&255,e[16]=C>>>0&255,e[17]=C>>>8&255,e[18]=C>>>16&255,e[19]=C>>>24&255,e[20]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=I>>>0&255,e[25]=I>>>8&255,e[26]=I>>>16&255,e[27]=I>>>24&255,e[28]=T>>>0&255,e[29]=T>>>8&255,e[30]=T>>>16&255,e[31]=T>>>24&255}function w(e,t,n,r){b(e,t,n,r)}function _(e,t,n,r){v(e,t,n,r)}var k=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function S(e,t,n,r,i,o,s){var a=new Uint8Array(16),u=new Uint8Array(64),l,c;for(c=0;c<16;c++)a[c]=0;for(c=0;c<8;c++)a[c]=o[c];for(;i>=64;){for(w(u,a,s,k),c=0;c<64;c++)e[t+c]=n[r+c]^u[c];for(l=1,c=8;c<16;c++)l=l+(255&a[c])|0,a[c]=255&l,l>>>=8;i-=64,t+=64,r+=64}if(i>0)for(w(u,a,s,k),c=0;c=64;){for(w(s,o,i,k),u=0;u<64;u++)e[t+u]=s[u];for(a=1,u=8;u<16;u++)a=a+(255&o[u])|0,o[u]=255&a,a>>>=8;n-=64,t+=64}if(n>0)for(w(s,o,i,k),u=0;u>>13|n<<3),r=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(n>>>10|r<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(r>>>7|i<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|s<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(s>>>11|a<<5),u=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|u<<8),this.r[9]=u>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function I(e,t,n,r,i,o){var s=new A(o);return s.update(n,r,i),s.finish(e,t),0}function T(e,t,n,r,i,o){var s=new Uint8Array(16);return I(s,0,n,r,i,o),g(e,t,s,0)}function j(e,t,n,r,i){var o;if(n<32)return-1;for(C(e,0,t,0,n,r,i),I(e,16,e,32,n-32,e),o=0;o<16;o++)e[o]=0;return 0}function O(e,t,n,r,i){var o,s=new Uint8Array(32);if(n<32)return-1;if(x(s,0,32,r,i),0!==T(t,16,t,32,n-32,s))return-1;for(C(e,0,t,0,n,r,i),o=0;o<32;o++)e[o]=0;return 0}function P(e,t){var n;for(n=0;n<16;n++)e[n]=0|t[n]}function B(e){var t,n,r=1;for(t=0;t<16;t++)n=e[t]+r+65535,r=Math.floor(n/65536),e[t]=n-65536*r;e[0]+=r-1+37*(r-1)}function R(e,t,n){for(var r,i=~(n-1),o=0;o<16;o++)r=i&(e[o]^t[o]),e[o]^=r,t[o]^=r}function N(e,n){var r,i,o,s=t(),a=t();for(r=0;r<16;r++)a[r]=n[r];for(B(a),B(a),B(a),i=0;i<2;i++){for(s[0]=a[0]-65517,r=1;r<15;r++)s[r]=a[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),o=s[15]>>16&1,s[14]&=65535,R(a,s,1-o)}for(r=0;r<16;r++)e[2*r]=255&a[r],e[2*r+1]=a[r]>>8}function M(e,t){var n=new Uint8Array(32),r=new Uint8Array(32);return N(n,e),N(r,t),y(n,0,r,0)}function L(e){var t=new Uint8Array(32);return N(t,e),1&t[0]}function F(e,t){var n;for(n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function D(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]+n[r]}function U(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]-n[r]}function z(e,t,n){var r,i,o=0,s=0,a=0,u=0,l=0,c=0,f=0,h=0,p=0,d=0,m=0,g=0,y=0,b=0,v=0,w=0,_=0,k=0,S=0,E=0,x=0,C=0,A=0,I=0,T=0,j=0,O=0,P=0,B=0,R=0,N=0,M=n[0],L=n[1],F=n[2],D=n[3],U=n[4],z=n[5],q=n[6],K=n[7],H=n[8],V=n[9],W=n[10],$=n[11],G=n[12],Y=n[13],J=n[14],Z=n[15];r=t[0],o+=r*M,s+=r*L,a+=r*F,u+=r*D,l+=r*U,c+=r*z,f+=r*q,h+=r*K,p+=r*H,d+=r*V,m+=r*W,g+=r*$,y+=r*G,b+=r*Y,v+=r*J,w+=r*Z,r=t[1],s+=r*M,a+=r*L,u+=r*F,l+=r*D,c+=r*U,f+=r*z,h+=r*q,p+=r*K,d+=r*H,m+=r*V,g+=r*W,y+=r*$,b+=r*G,v+=r*Y,w+=r*J,_+=r*Z,r=t[2],a+=r*M,u+=r*L,l+=r*F,c+=r*D,f+=r*U,h+=r*z,p+=r*q,d+=r*K,m+=r*H,g+=r*V,y+=r*W,b+=r*$,v+=r*G,w+=r*Y,_+=r*J,k+=r*Z,r=t[3],u+=r*M,l+=r*L,c+=r*F,f+=r*D,h+=r*U,p+=r*z,d+=r*q,m+=r*K,g+=r*H,y+=r*V,b+=r*W,v+=r*$,w+=r*G,_+=r*Y,k+=r*J,S+=r*Z,r=t[4],l+=r*M,c+=r*L,f+=r*F,h+=r*D,p+=r*U,d+=r*z,m+=r*q,g+=r*K,y+=r*H,b+=r*V,v+=r*W,w+=r*$,_+=r*G,k+=r*Y,S+=r*J,E+=r*Z,r=t[5],c+=r*M,f+=r*L,h+=r*F,p+=r*D,d+=r*U,m+=r*z,g+=r*q,y+=r*K,b+=r*H,v+=r*V,w+=r*W,_+=r*$,k+=r*G,S+=r*Y,E+=r*J,x+=r*Z,r=t[6],f+=r*M,h+=r*L,p+=r*F,d+=r*D,m+=r*U,g+=r*z,y+=r*q,b+=r*K,v+=r*H,w+=r*V,_+=r*W,k+=r*$,S+=r*G,E+=r*Y,x+=r*J,C+=r*Z,r=t[7],h+=r*M,p+=r*L,d+=r*F,m+=r*D,g+=r*U,y+=r*z,b+=r*q,v+=r*K,w+=r*H,_+=r*V,k+=r*W,S+=r*$,E+=r*G,x+=r*Y,C+=r*J,A+=r*Z,r=t[8],p+=r*M,d+=r*L,m+=r*F,g+=r*D,y+=r*U,b+=r*z,v+=r*q,w+=r*K,_+=r*H,k+=r*V,S+=r*W,E+=r*$,x+=r*G,C+=r*Y,A+=r*J,I+=r*Z,r=t[9],d+=r*M,m+=r*L,g+=r*F,y+=r*D,b+=r*U,v+=r*z,w+=r*q,_+=r*K,k+=r*H,S+=r*V,E+=r*W,x+=r*$,C+=r*G,A+=r*Y,I+=r*J,T+=r*Z,r=t[10],m+=r*M,g+=r*L,y+=r*F,b+=r*D,v+=r*U,w+=r*z,_+=r*q,k+=r*K,S+=r*H,E+=r*V,x+=r*W,C+=r*$,A+=r*G,I+=r*Y,T+=r*J,j+=r*Z,r=t[11],g+=r*M,y+=r*L,b+=r*F,v+=r*D,w+=r*U,_+=r*z,k+=r*q,S+=r*K,E+=r*H,x+=r*V,C+=r*W,A+=r*$,I+=r*G,T+=r*Y,j+=r*J,O+=r*Z,r=t[12],y+=r*M,b+=r*L,v+=r*F,w+=r*D,_+=r*U,k+=r*z,S+=r*q,E+=r*K,x+=r*H,C+=r*V,A+=r*W,I+=r*$,T+=r*G,j+=r*Y,O+=r*J,P+=r*Z,r=t[13],b+=r*M,v+=r*L,w+=r*F,_+=r*D,k+=r*U,S+=r*z,E+=r*q,x+=r*K,C+=r*H,A+=r*V,I+=r*W,T+=r*$,j+=r*G,O+=r*Y,P+=r*J,B+=r*Z,r=t[14],v+=r*M,w+=r*L,_+=r*F,k+=r*D,S+=r*U,E+=r*z,x+=r*q,C+=r*K,A+=r*H,I+=r*V,T+=r*W,j+=r*$,O+=r*G,P+=r*Y,B+=r*J,R+=r*Z,r=t[15],w+=r*M,_+=r*L,k+=r*F,S+=r*D,E+=r*U,x+=r*z,C+=r*q,A+=r*K,I+=r*H,T+=r*V,j+=r*W,O+=r*$,P+=r*G,B+=r*Y,R+=r*J,N+=r*Z,o+=38*_,s+=38*k,a+=38*S,u+=38*E,l+=38*x,c+=38*C,f+=38*A,h+=38*I,p+=38*T,d+=38*j,m+=38*O,g+=38*P,y+=38*B,b+=38*R,v+=38*N,i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=w+i+65535,i=Math.floor(r/65536),w=r-65536*i,o+=i-1+37*(i-1),i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=w+i+65535,i=Math.floor(r/65536),w=r-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=u,e[4]=l,e[5]=c,e[6]=f,e[7]=h,e[8]=p,e[9]=d,e[10]=m,e[11]=g,e[12]=y,e[13]=b,e[14]=v,e[15]=w}function q(e,t){z(e,t,t)}function K(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=253;i>=0;i--)q(r,r),2!==i&&4!==i&&z(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function H(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=250;i>=0;i--)q(r,r),1!==i&&z(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function V(e,n,r){var i=new Uint8Array(32),o=new Float64Array(80),s,a,l=t(),c=t(),f=t(),h=t(),p=t(),d=t();for(a=0;a<31;a++)i[a]=n[a];for(i[31]=127&n[31]|64,i[0]&=248,F(o,r),a=0;a<16;a++)c[a]=o[a],h[a]=l[a]=f[a]=0;for(l[0]=h[0]=1,a=254;a>=0;--a)s=i[a>>>3]>>>(7&a)&1,R(l,c,s),R(f,h,s),D(p,l,f),U(l,l,f),D(f,c,h),U(c,c,h),q(h,p),q(d,l),z(l,f,l),z(f,c,p),D(p,l,f),U(l,l,f),q(c,l),U(f,h,d),z(l,f,u),D(l,l,h),z(f,f,l),z(l,h,d),z(h,c,o),q(c,p),R(l,c,s),R(f,h,s);for(a=0;a<16;a++)o[a+16]=l[a],o[a+32]=f[a],o[a+48]=c[a],o[a+64]=h[a];var m=o.subarray(32),g=o.subarray(16);return K(m,m),z(g,g,m),N(e,g),0}function W(e,t){return V(e,t,o)}function $(e,t){return r(t,32),W(e,t)}function G(e,t,n){var r=new Uint8Array(32);return V(r,n,t),_(e,i,r,k)}A.prototype.blocks=function(e,t,n){for(var r=this.fin?0:2048,i,o,s,a,u,l,c,f,h,p,d,m,g,y,b,v,w,_,k,S=this.h[0],E=this.h[1],x=this.h[2],C=this.h[3],A=this.h[4],I=this.h[5],T=this.h[6],j=this.h[7],O=this.h[8],P=this.h[9],B=this.r[0],R=this.r[1],N=this.r[2],M=this.r[3],L=this.r[4],F=this.r[5],D=this.r[6],U=this.r[7],z=this.r[8],q=this.r[9];n>=16;)i=255&e[t+0]|(255&e[t+1])<<8,S+=8191&i,o=255&e[t+2]|(255&e[t+3])<<8,E+=8191&(i>>>13|o<<3),s=255&e[t+4]|(255&e[t+5])<<8,x+=8191&(o>>>10|s<<6),a=255&e[t+6]|(255&e[t+7])<<8,C+=8191&(s>>>7|a<<9),u=255&e[t+8]|(255&e[t+9])<<8,A+=8191&(a>>>4|u<<12),I+=u>>>1&8191,l=255&e[t+10]|(255&e[t+11])<<8,T+=8191&(u>>>14|l<<2),c=255&e[t+12]|(255&e[t+13])<<8,j+=8191&(l>>>11|c<<5),f=255&e[t+14]|(255&e[t+15])<<8,O+=8191&(c>>>8|f<<8),P+=f>>>5|r,h=0,p=h,p+=S*B,p+=E*(5*q),p+=x*(5*z),p+=C*(5*U),p+=A*(5*D),h=p>>>13,p&=8191,p+=I*(5*F),p+=T*(5*L),p+=j*(5*M),p+=O*(5*N),p+=P*(5*R),h+=p>>>13,p&=8191,d=h,d+=S*R,d+=E*B,d+=x*(5*q),d+=C*(5*z),d+=A*(5*U),h=d>>>13,d&=8191,d+=I*(5*D),d+=T*(5*F),d+=j*(5*L),d+=O*(5*M),d+=P*(5*N),h+=d>>>13,d&=8191,m=h,m+=S*N,m+=E*R,m+=x*B,m+=C*(5*q),m+=A*(5*z),h=m>>>13,m&=8191,m+=I*(5*U),m+=T*(5*D),m+=j*(5*F),m+=O*(5*L),m+=P*(5*M),h+=m>>>13,m&=8191,g=h,g+=S*M,g+=E*N,g+=x*R,g+=C*B,g+=A*(5*q),h=g>>>13,g&=8191,g+=I*(5*z),g+=T*(5*U),g+=j*(5*D),g+=O*(5*F),g+=P*(5*L),h+=g>>>13,g&=8191,y=h,y+=S*L,y+=E*M,y+=x*N,y+=C*R,y+=A*B,h=y>>>13,y&=8191,y+=I*(5*q),y+=T*(5*z),y+=j*(5*U),y+=O*(5*D),y+=P*(5*F),h+=y>>>13,y&=8191,b=h,b+=S*F,b+=E*L,b+=x*M,b+=C*N,b+=A*R,h=b>>>13,b&=8191,b+=I*B,b+=T*(5*q),b+=j*(5*z),b+=O*(5*U),b+=P*(5*D),h+=b>>>13,b&=8191,v=h,v+=S*D,v+=E*F,v+=x*L,v+=C*M,v+=A*N,h=v>>>13,v&=8191,v+=I*R,v+=T*B,v+=j*(5*q),v+=O*(5*z),v+=P*(5*U),h+=v>>>13,v&=8191,w=h,w+=S*U,w+=E*D,w+=x*F,w+=C*L,w+=A*M,h=w>>>13,w&=8191,w+=I*N,w+=T*R,w+=j*B,w+=O*(5*q),w+=P*(5*z),h+=w>>>13,w&=8191,_=h,_+=S*z,_+=E*U,_+=x*D,_+=C*F,_+=A*L,h=_>>>13,_&=8191,_+=I*M,_+=T*N,_+=j*R,_+=O*B,_+=P*(5*q),h+=_>>>13,_&=8191,k=h,k+=S*q,k+=E*z,k+=x*U,k+=C*D,k+=A*F,h=k>>>13,k&=8191,k+=I*L,k+=T*M,k+=j*N,k+=O*R,k+=P*B,h+=k>>>13,k&=8191,h=(h<<2)+h|0,h=h+p|0,p=8191&h,h>>>=13,d+=h,S=p,E=d,x=m,C=g,A=y,I=b,T=v,j=w,O=_,P=k,t+=16,n-=16;this.h[0]=S,this.h[1]=E,this.h[2]=x,this.h[3]=C,this.h[4]=A,this.h[5]=I,this.h[6]=T,this.h[7]=j,this.h[8]=O,this.h[9]=P},A.prototype.finish=function(e,t){var n=new Uint16Array(10),r,i,o,s;if(this.leftover){for(s=this.leftover,this.buffer[s++]=1;s<16;s++)this.buffer[s]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,s=2;s<10;s++)this.h[s]+=r,r=this.h[s]>>>13,this.h[s]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,n[0]=this.h[0]+5,r=n[0]>>>13,n[0]&=8191,s=1;s<10;s++)n[s]=this.h[s]+r,r=n[s]>>>13,n[s]&=8191;for(n[9]-=8192,i=(1^r)-1,s=0;s<10;s++)n[s]&=i;for(i=~i,s=0;s<10;s++)this.h[s]=this.h[s]&i|n[s];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,s=1;s<8;s++)o=(this.h[s]+this.pad[s]|0)+(o>>>16)|0,this.h[s]=65535&o;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},A.prototype.update=function(e,t,n){var r,i;if(this.leftover){for(i=16-this.leftover,i>n&&(i=n),r=0;r=16&&(i=n-n%16,this.blocks(e,t,i),t+=i,n-=i),n){for(r=0;r=128;){for(E=0;E<16;E++)x=8*E+G,i[E]=n[x+0]<<24|n[x+1]<<16|n[x+2]<<8|n[x+3],o[E]=n[x+4]<<24|n[x+5]<<16|n[x+6]<<8|n[x+7];for(E=0;E<80;E++)if(s=P,a=B,u=R,l=N,c=M,f=L,h=F,p=D,d=U,m=z,g=q,y=K,b=H,v=V,w=W,_=$,C=D,A=$,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=(M>>>14|H<<18)^(M>>>18|H<<14)^(H>>>9|M<<23),A=(H>>>14|M<<18)^(H>>>18|M<<14)^(M>>>9|H<<23),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=M&L^~M&F,A=H&V^~H&W,I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=X[2*E],A=X[2*E+1],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=i[E%16],A=o[E%16],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,k=65535&j|O<<16,S=65535&I|T<<16,C=k,A=S,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=(P>>>28|U<<4)^(U>>>2|P<<30)^(U>>>7|P<<25),A=(U>>>28|P<<4)^(P>>>2|U<<30)^(P>>>7|U<<25),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=P&B^P&R^B&R,A=U&z^U&q^z&q,I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,p=65535&j|O<<16,_=65535&I|T<<16,C=l,A=y,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=k,A=S,I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,l=65535&j|O<<16,y=65535&I|T<<16,B=s,R=a,N=u,M=l,L=c,F=f,D=h,P=p,z=d,q=m,K=g,H=y,V=b,W=v,$=w,U=_,E%16==15)for(x=0;x<16;x++)C=i[x],A=o[x],I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=i[(x+9)%16],A=o[(x+9)%16],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,k=i[(x+1)%16],S=o[(x+1)%16],C=(k>>>1|S<<31)^(k>>>8|S<<24)^k>>>7,A=(S>>>1|k<<31)^(S>>>8|k<<24)^(S>>>7|k<<25),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,k=i[(x+14)%16],S=o[(x+14)%16],C=(k>>>19|S<<13)^(S>>>29|k<<3)^k>>>6,A=(S>>>19|k<<13)^(k>>>29|S<<3)^(S>>>6|k<<26),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,i[x]=65535&j|O<<16,o[x]=65535&I|T<<16;C=P,A=U,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[0],A=t[0],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[0]=P=65535&j|O<<16,t[0]=U=65535&I|T<<16,C=B,A=z,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[1],A=t[1],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[1]=B=65535&j|O<<16,t[1]=z=65535&I|T<<16,C=R,A=q,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[2],A=t[2],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[2]=R=65535&j|O<<16,t[2]=q=65535&I|T<<16,C=N,A=K,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[3],A=t[3],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[3]=N=65535&j|O<<16,t[3]=K=65535&I|T<<16,C=M,A=H,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[4],A=t[4],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[4]=M=65535&j|O<<16,t[4]=H=65535&I|T<<16,C=L,A=V,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[5],A=t[5],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[5]=L=65535&j|O<<16,t[5]=V=65535&I|T<<16,C=F,A=W,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[6],A=t[6],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[6]=F=65535&j|O<<16,t[6]=W=65535&I|T<<16,C=D,A=$,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[7],A=t[7],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[7]=D=65535&j|O<<16,t[7]=$=65535&I|T<<16,G+=128,r-=128}return r}function te(e,t,n){var r=new Int32Array(8),i=new Int32Array(8),o=new Uint8Array(256),s,a=n;for(r[0]=1779033703,r[1]=3144134277,r[2]=1013904242,r[3]=2773480762,r[4]=1359893119,r[5]=2600822924,r[6]=528734635,r[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,ee(r,i,t,n),n%=128,s=0;s=0;--i)r=n[i/8|0]>>(7&i)&1,re(e,t,r),ne(t,e),ne(e,e),re(e,t,r)}function se(e,n){var r=[t(),t(),t(),t()];P(r[0],f),P(r[1],h),P(r[2],a),z(r[3],f,h),oe(e,r,n)}function ae(e,n,i){var o=new Uint8Array(64),s=[t(),t(),t(),t()],a;for(i||r(n,32),te(o,n,32),o[0]&=248,o[31]&=127,o[31]|=64,se(s,o),ie(e,s),a=0;a<32;a++)n[a+32]=e[a];return 0}var ue=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function le(e,t){var n,r,i,o;for(r=63;r>=32;--r){for(n=0,i=r-32,o=r-12;i>8,t[i]-=256*n;t[i]+=n,t[r]=0}for(n=0,i=0;i<32;i++)t[i]+=n-(t[31]>>4)*ue[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*ue[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function ce(e){var t=new Float64Array(64),n;for(n=0;n<64;n++)t[n]=e[n];for(n=0;n<64;n++)e[n]=0;le(e,t)}function fe(e,n,r,i){var o=new Uint8Array(64),s=new Uint8Array(64),a=new Uint8Array(64),u,l,c=new Float64Array(64),f=[t(),t(),t(),t()];te(o,i,32),o[0]&=248,o[31]&=127,o[31]|=64;var h=r+64;for(u=0;u>7&&U(e[0],s,e[0]),z(e[3],e[0],e[1]),0)}function pe(e,n,r,i){var o,s,a=new Uint8Array(32),u=new Uint8Array(64),l=[t(),t(),t(),t()],c=[t(),t(),t(),t()];if(s=-1,r<64)return-1;if(he(c,i))return-1;for(o=0;o=0},e.sign.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(64);return ae(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(Be(e),64!==e.length)throw new Error("bad secret key size");for(var t=new Uint8Array(32),n=0;n=this._buffer.length},o.prototype.remainder=function(){return this._buffer.slice(this._offset)},o.prototype.skip=function(e){this._offset+=e},o.prototype.expand=function(){this._size*=2;var e=i.alloc(this._size);this._buffer.copy(e,0),this._buffer=e},o.prototype.readPart=function(){return{data:this.readBuffer()}},o.prototype.readBuffer=function(){var e=this._buffer.readUInt32BE(this._offset);this._offset+=4,r.ok(this._offset+e<=this._buffer.length,"length out of bounds at +0x"+this._offset.toString(16)+" (data truncated?)");var t=this._buffer.slice(this._offset,this._offset+e);return this._offset+=e,t},o.prototype.readString=function(){return this.readBuffer().toString()},o.prototype.readCString=function(){for(var e=this._offset;ethis._size;)this.expand();this._buffer.writeUInt32BE(e.length,this._offset),this._offset+=4,e.copy(this._buffer,this._offset),this._offset+=e.length},o.prototype.writeString=function(e){this.writeBuffer(i.from(e,"utf8"))},o.prototype.writeCString=function(e){for(;this._offset+1+e.length>this._size;)this.expand();this._buffer.write(e,this._offset),this._offset+=e.length,this._buffer[this._offset++]=0},o.prototype.writeInt=function(e){for(;this._offset+4>this._size;)this.expand();this._buffer.writeUInt32BE(e,this._offset),this._offset+=4},o.prototype.writeInt64=function(e){if(r.buffer(e,"value"),e.length>8){for(var t=e.slice(0,e.length-8),n=0;nthis._size;)this.expand();e.copy(this._buffer,this._offset),this._offset+=8},o.prototype.writeChar=function(e){for(;this._offset+1>this._size;)this.expand();this._buffer[this._offset++]=e},o.prototype.writePart=function(e){this.writeBuffer(e.data)},o.prototype.write=function(e){for(;this._offset+e.length>this._size;)this.expand();e.copy(this._buffer,this._offset),this._offset+=e.length}},function(e,t,n){e.exports={read:f,readPkcs8:d,write:h,writePkcs8:A,pkcs8ToBuffer:C,readECDSACurve:v,writeECDSACurve:P};var r=n(27),i=n(103),o=n(31).Buffer,s=n(55),a=n(47),u=n(46),l=n(50),c=n(113);function f(e,t){return c.read(e,t,"pkcs8")}function h(e,t){return c.write(e,t,"pkcs8")}function p(e,t){return r.strictEqual(e.peek(),i.Ber.Integer,t+" is not an Integer"),a.mpNormalize(e.readString(i.Ber.Integer,!0))}function d(e,t,n){n.peek()===i.Ber.Integer&&(r.strictEqual(t,"private","unexpected Integer at start of public key"),n.readString(i.Ber.Integer,!0)),n.readSequence();var o=n.offset+n.length,s=n.readOID();switch(s){case"1.2.840.113549.1.1.1":return n._offset=o,"public"===t?m(n):g(n);case"1.2.840.10040.4.1":return"public"===t?y(n):b(n);case"1.2.840.10045.2.1":return"public"===t?_(n):w(n);case"1.3.101.112":return"public"===t?k(n):E(n);case"1.3.101.110":return"public"===t?S(n):x(n);default:throw new Error("Unknown key type OID "+s)}}function m(e){e.readSequence(i.Ber.BitString),e.readByte(),e.readSequence();var t=p(e,"modulus"),n=p(e,"exponent"),r={type:"rsa",source:e.originalInput,parts:[{name:"e",data:n},{name:"n",data:t}]};return new u(r)}function g(e){e.readSequence(i.Ber.OctetString),e.readSequence();var t=p(e,"version");r.equal(t[0],0,"unknown RSA private key version");var n=p(e,"modulus"),o=p(e,"public exponent"),s=p(e,"private exponent"),a=p(e,"prime1"),u=p(e,"prime2"),c=p(e,"exponent1"),f=p(e,"exponent2"),h=p(e,"iqmp"),d={type:"rsa",parts:[{name:"n",data:n},{name:"e",data:o},{name:"d",data:s},{name:"iqmp",data:h},{name:"p",data:a},{name:"q",data:u},{name:"dmodp",data:c},{name:"dmodq",data:f}]};return new l(d)}function y(e){e.readSequence();var t=p(e,"p"),n=p(e,"q"),r=p(e,"g");e.readSequence(i.Ber.BitString),e.readByte();var o=p(e,"y"),s={type:"dsa",parts:[{name:"p",data:t},{name:"q",data:n},{name:"g",data:r},{name:"y",data:o}]};return new u(s)}function b(e){e.readSequence();var t=p(e,"p"),n=p(e,"q"),r=p(e,"g");e.readSequence(i.Ber.OctetString);var o=p(e,"x"),s=a.calculateDSAPublic(r,t,o),u={type:"dsa",parts:[{name:"p",data:t},{name:"q",data:n},{name:"g",data:r},{name:"y",data:s},{name:"x",data:o}]};return new l(u)}function v(e){var t,n,u,l,c;if(e.peek()===i.Ber.OID){var f=e.readOID();for(n=Object.keys(s.curves),u=0;u=this.validFrom.getTime()&&e.getTime()0&&-1===this.issuer.purposes.indexOf("ca"))&&this.isSignedByKey(e.subjectKey))},b.prototype.getExtension=function(e){r.string(e,"keyOrOid");var t=this.getExtensions().filter(function(t){return"x509"===t.format?t.oid===e:"openssh"===t.format&&t.name===e})[0];return t},b.prototype.getExtensions=function(){var e=[],t=this.signatures.x509;t&&t.extras&&t.extras.exts&&t.extras.exts.forEach(function(t){t.format="x509",e.push(t)});var n=this.signatures.openssh;return n&&n.exts&&n.exts.forEach(function(t){t.format="openssh",e.push(t)}),e},b.prototype.isSignedByKey=function(e){if(f.assertCompatible(e,h,[1,2],"issuerKey"),void 0!==this.issuerKey)return this.issuerKey.fingerprint("sha512").matches(e);var t=Object.keys(this.signatures)[0],n=m[t].verify(this,e);return n&&(this.issuerKey=e),n},b.prototype.signWith=function(e){f.assertCompatible(e,p,[1,2],"key");for(var t=Object.keys(m),n=!1,r=0;r0&&-1===c.indexOf("serverAuth")&&c.push("serverAuth"),m.length>0&&-1===c.indexOf("clientAuth")&&c.push("clientAuth"),(m.length>0||h.length>0)&&(-1===c.indexOf("keyAgreement")&&c.push("keyAgreement"),"rsa"===t.type&&-1===c.indexOf("encryption")&&c.push("encryption"))}var g=new b({subjects:o,issuer:o[0],subjectKey:t.toPublic(),issuerKey:t.toPublic(),signatures:{},serial:l,validFrom:s,validUntil:a,purposes:c});return g.signWith(t),g},b.create=function(e,t,n,o,s){var a;a=Array.isArray(e)?e:[e],r.arrayOfObject(a),a.forEach(function(e){f.assertCompatible(e,d,[1,0],"subject")}),f.assertCompatible(t,h,[1,0],"key"),p.isPrivateKey(t)&&(t=t.toPublic()),f.assertCompatible(n,d,[1,0],"issuer"),f.assertCompatible(o,p,[1,2],"issuer key"),r.optionalObject(s,"options"),void 0===s&&(s={}),r.optionalObject(s.validFrom,"options.validFrom"),r.optionalObject(s.validUntil,"options.validUntil");var u=s.validFrom,l=s.validUntil;if(void 0===u&&(u=new Date),void 0===l){r.optionalNumber(s.lifetime,"options.lifetime");var c=s.lifetime;void 0===c&&(c=31536e4),l=new Date,l.setTime(l.getTime()+1e3*c)}r.optionalBuffer(s.serial,"options.serial");var m=s.serial;void 0===m&&(m=i.from("0000000000000001","hex"));var g=s.purposes;void 0===g&&(g=[]),-1===g.indexOf("signature")&&g.push("signature"),!0===s.ca&&(-1===g.indexOf("ca")&&g.push("ca"),-1===g.indexOf("crl")&&g.push("crl"));var y=a.filter(function(e){return"host"===e.type}),v=a.filter(function(e){return"user"===e.type});y.length>0&&-1===g.indexOf("serverAuth")&&g.push("serverAuth"),v.length>0&&-1===g.indexOf("clientAuth")&&g.push("clientAuth"),(v.length>0||y.length>0)&&(-1===g.indexOf("keyAgreement")&&g.push("keyAgreement"),"rsa"===t.type&&-1===g.indexOf("encryption")&&g.push("encryption"));var w=new b({subjects:a,issuer:n,subjectKey:t,issuerKey:o.toPublic(),signatures:{},serial:m,validFrom:u,validUntil:l,purposes:g});return w.signWith(o),w},b.parse=function(e,t,n){"string"!=typeof e&&r.buffer(e,"data"),void 0===t&&(t="auto"),r.string(t,"format"),"string"==typeof n&&(n={filename:n}),r.optionalObject(n,"options"),void 0===n&&(n={}),r.optionalString(n.filename,"options.filename"),void 0===n.filename&&(n.filename="(unnamed)"),r.object(m[t],"formats[format]");try{var i=m[t].read(e,n);return i}catch(e){throw new g(n.filename,t,e)}},b.isCertificate=function(e,t){return f.isCompatible(e,b,t)},b.prototype._sshpkApiVersion=[1,1],b._oldVersionDetect=function(e){return[1,0]}},function(e,t,n){e.exports=g;var r=n(27),i=n(55),o=n(15),s=n(207),a=n(102),u=n(97),l=n(13),c=n(47),f=n(103),h=n(31).Buffer,p=/^([*]|[a-z0-9][a-z0-9\-]{0,62})(?:\.([*]|[a-z0-9][a-z0-9\-]{0,62}))*$/i,d={cn:"2.5.4.3",o:"2.5.4.10",ou:"2.5.4.11",l:"2.5.4.7",s:"2.5.4.8",c:"2.5.4.6",sn:"2.5.4.4",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",street:"2.5.4.9",x500UniqueIdentifier:"2.5.4.45",role:"2.5.4.72",telephoneNumber:"2.5.4.20",description:"2.5.4.13",dc:"0.9.2342.19200300.100.1.25",uid:"0.9.2342.19200300.100.1.1",mail:"0.9.2342.19200300.100.1.3",title:"2.5.4.12",gn:"2.5.4.42",initials:"2.5.4.43",pseudonym:"2.5.4.65",emailAddress:"1.2.840.113549.1.9.1"},m={};function g(e){var t=this;if(r.object(e,"options"),r.arrayOfObject(e.components,"options.components"),this.components=e.components,this.componentLookup={},this.components.forEach(function(e){e.name&&!e.oid&&(e.oid=d[e.name]),e.oid&&!e.name&&(e.name=m[e.oid]),void 0===t.componentLookup[e.name]&&(t.componentLookup[e.name]=[]),t.componentLookup[e.name].push(e)}),this.componentLookup.cn&&this.componentLookup.cn.length>0&&(this.cn=this.componentLookup.cn[0].value),r.optionalString(e.type,"options.type"),void 0===e.type)1===this.components.length&&this.componentLookup.cn&&1===this.componentLookup.cn.length&&this.componentLookup.cn[0].value.match(p)?(this.type="host",this.hostname=this.componentLookup.cn[0].value):this.componentLookup.dc&&this.components.length===this.componentLookup.dc.length?(this.type="host",this.hostname=this.componentLookup.dc.map(function(e){return e.value}).join(".")):this.componentLookup.uid&&this.components.length===this.componentLookup.uid.length?(this.type="user",this.uid=this.componentLookup.uid[0].value):this.componentLookup.cn&&1===this.componentLookup.cn.length&&this.componentLookup.cn[0].value.match(p)?(this.type="host",this.hostname=this.componentLookup.cn[0].value):this.componentLookup.uid&&1===this.componentLookup.uid.length?(this.type="user",this.uid=this.componentLookup.uid[0].value):this.componentLookup.mail&&1===this.componentLookup.mail.length?(this.type="email",this.email=this.componentLookup.mail[0].value):this.componentLookup.cn&&1===this.componentLookup.cn.length?(this.type="user",this.uid=this.componentLookup.cn[0].value):this.type="unknown";else if(this.type=e.type,"host"===this.type)this.hostname=e.hostname;else if("user"===this.type)this.uid=e.uid;else{if("email"!==this.type)throw new Error("Unknown type "+this.type);this.email=e.email}}Object.keys(d).forEach(function(e){m[d[e]]=e}),g.prototype.toString=function(){return this.components.map(function(e){var t=e.name.toUpperCase();t=t.replace(/=/g,"\\=");var n=e.value;return n=n.replace(/,/g,"\\,"),t+"="+n}).join(", ")},g.prototype.get=function(e,t){r.string(e,"name");var n=this.componentLookup[e];if(void 0!==n&&0!==n.length){if(!t&&n.length>1)throw new Error("Multiple values for attribute "+e);return t?n.map(function(e){return e.value}):n[0].value}},g.prototype.toArray=function(e){return this.components.map(function(e){return{name:e.name,value:e.value}})};var y=/[^a-zA-Z0-9 '(),+.\/:=?-]/,b=/[^\x00-\x7f]/;function v(e,t){if("**"===e||"**"===t)return!0;var n=e.split("."),r=t.split(".");if(n.length!==r.length)return!1;for(var i=0;i0;){var o;if(null!==(o=/^,/.exec(i)))t[++n]="",i=i.slice(o[0].length);else if(null!==(o=/^\\,/.exec(i)))t[n]+=",",i=i.slice(o[0].length);else if(null!==(o=/^\\./.exec(i)))t[n]+=o[0],i=i.slice(o[0].length);else{if(null===(o=/^[^\\,]+/.exec(i)))throw new Error("Failed to parse DN");t[n]+=o[0],i=i.slice(o[0].length)}}var s=t.map(function(e){e=e.trim();for(var t=e.indexOf("=");t>0&&"\\"===e.charAt(t-1);)t=e.indexOf("=",t+1);if(-1===t)throw new Error("Failed to parse DN");var n=e.slice(0,t).toLowerCase().replace(/\\=/g,"="),r=e.slice(t+1);return{name:n,value:r}});return new g({components:s})},g.fromArray=function(e){return r.arrayOfObject(e,"components"),e.forEach(function(e){if(r.object(e,"component"),r.string(e.name,"component.name"),!h.isBuffer(e.value)&&"string"!=typeof e.value)throw new Error("Invalid component value")}),new g({components:e})},g.parseAsn1=function(e,t){var n=[];e.readSequence(t);for(var r=e.offset+e.length;e.offset= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=f-h,E=Math.floor,x=String.fromCharCode,C;function A(e){throw new RangeError(k[e])}function I(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function T(e,t){var n=e.split("@"),r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(_,".");var i=e.split("."),o=I(i,t).join(".");return r+o}function j(e){for(var t=[],n=0,r=e.length,i,o;n=55296&&i<=56319&&n65535&&(e-=65536,t+=x(e>>>10&1023|55296),e=56320|1023&e),t+=x(e),t}).join("")}function P(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:f}function B(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function R(e,t,n){var r=0;for(e=n?E(e/m):e>>1,e+=E(e/t);e>S*p>>1;r+=f)e=E(e/S);return E(r+(S+1)*e/(e+d))}function N(e){var t=[],n=e.length,r,i=0,o=y,s=g,a,u,l,d,m,v,w,_,k;for(a=e.lastIndexOf(b),a<0&&(a=0),u=0;u=128&&A("not-basic"),t.push(e.charCodeAt(u));for(l=a>0?a+1:0;l=n&&A("invalid-input"),w=P(e.charCodeAt(l++)),(w>=f||w>E((c-i)/m))&&A("overflow"),i+=w*m,_=v<=s?h:v>=s+p?p:v-s,!(w<_);v+=f)k=f-_,m>E(c/k)&&A("overflow"),m*=k;r=t.length+1,s=R(i-d,r,0==d),E(i/r)>c-o&&A("overflow"),o+=E(i/r),i%=r,t.splice(i++,0,o)}return O(t)}function M(e){var t,n,r,i,o,s,a,u,l,d,m,v=[],w,_,k,S;for(e=j(e),w=e.length,t=y,n=0,o=g,s=0;s=t&&mE((c-n)/_)&&A("overflow"),n+=(a-t)*_,t=a,s=0;sc&&A("overflow"),m==t){for(u=n,l=f;d=l<=o?h:l>=o+p?p:l-o,!(uthis.root.open(j(e)),t=>this.config.set(B(e),t),t=>this.spec.set(R(e),t),e=>this.version.set(C,e)],t)}open(e){this.closed?(S("opening at: %s",this.path),r([e=>this.root.open(j(e)),e=>this._isInitialized(e),e=>this._openLock(this.path,e),(e,t)=>{S("aquired repo.lock"),this.lockfile=e,t()},e=>{S("creating datastore"),this.datastore=d.create("datastore",l.join(this.path,"datastore"),this.options),S("creating blocks");const t=d.create("blocks",l.join(this.path,"blocks"),this.options);v(t,this.options.storageBackendOptions.blocks,e)},(e,t)=>{this.blocks=e,t()},e=>{S("creating keystore"),this.keys=d.create("keys",l.join(this.path,"keys"),this.options),e()},e=>{this.closed=!1,S("all opened"),e()}],t=>{t&&this.lockfile?this._closeLock(n=>{n?S("error removing lock",n):this.lockfile=null,e(t)}):e(t)})):setImmediate(()=>e(new Error("repo is already open")))}_getLocker(){return"string"==typeof this.options.lock?(u(x[this.options.lock],"Unknown lock type: "+this.options.lock),x[this.options.lock]):(u(this.options.lock,"No lock provided"),this.options.lock)}_openLock(e,t){this._locker.lock(e,(e,n)=>{if(e)return t(e,null);u.strictEqual(typeof n.close,"function","Locks must have a close method"),t(null,n)})}_closeLock(e){if(this.lockfile)return this.lockfile.close(e);e()}_isInitialized(e){S("init check"),o({config:e=>this.config.exists(e),spec:e=>this.spec.exists(e),version:e=>this.version.check(C,e)},(t,n)=>{if(S("init",t,n),t&&!n.config)return e(Object.assign(new Error("repo is not initialized yet"),{code:k.ERR_REPO_NOT_INITIALIZED,path:this.path}));e(t)})}close(e){if(this.closed)return e(new Error("repo is already closed"));S("closing at: %s",this.path),i([e=>this.apiAddr.delete(O(e)),e=>{s([this.blocks,this.keys,this.datastore],(e,t)=>e.close(t),e)},e=>{S("unlocking"),this.closed=!0,this._closeLock(e)},e=>{this.lockfile=null,e()}],t=>e(t))}exists(e){this.version.exists(e)}stat(e,t){"function"==typeof e&&(t=e,e={}),e=Object.assign({},{human:!1},e),o({storageMax:e=>this.config.get("Datastore.StorageMax",(t,n)=>{e(null,new f(t?E:n))}),version:e=>this.version.get(e),blocks:e=>this.blocks.query({},(t,n)=>{n=n||[];const r=new f(n.length);let i=new f(0);n.forEach(e=>{i=i.plus(e.value.byteLength).plus(e.key._buf.byteLength)}),e(t,{count:r,size:i})}),datastore:e=>I(this.datastore,e),keys:e=>I(this.keys,e)},(n,r)=>{if(n)return t(n);let i=r.blocks.size.plus(r.datastore).plus(r.keys);e.human&&(i=i.div(1048576)),t(null,{repoPath:this.path,storageMax:r.storageMax,version:r.version,numObjects:r.blocks.count,repoSize:i})})}}function I(e,t){h(e.query({}),p((e,t)=>e.plus(t.value.byteLength).plus(t.key._buf.byteLength),new f(0),t))}function T(e,t){return n=>{t(n&&!e(n)?n:null)}}function j(e){return T(e=>"Already open"===e.message,e)}function O(e){return T(e=>e&&(e.code===k.ERR_REPO_NOT_INITIALIZED||e.message.startsWith("ENOENT")),e)}function P(e){const t=Object.assign({},w,e);return t.storageBackends=Object.assign({},w.storageBackends,t.storageBackends),t.storageBackendOptions=Object.assign({},w.storageBackendOptions,t.storageBackendOptions),t}function B(e){return e.datastore=Object.assign({},_,a(e,"datastore",{})),e}function R(e){const t=Object.assign({},_.Spec,a(e,"datastore.Spec",{}));return{type:t.type,mounts:t.mounts.map(e=>({mountpoint:e.mountpoint,type:e.child.type,path:e.child.path,shardFunc:e.child.shardFunc}))}}e.exports=A,e.exports.repoVersion=C,e.exports.errors=k},function(e,t){e.exports=function(){var e,t,n,r,i=function(i,o){e?e(i,o):i?(r=i,n=o):t=o};return i.resolve=function(i){if(e)throw new Error("already resolved");if(e=i,!e)throw new Error("no read cannot resolve!"+e);t&&i(null,t),n&&i(r,n)},i.abort=function(e){i.resolve(function(t,n){n(e||!0)})},i}},function(e,t){t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n",t.homedir=function(){return"/"}},function(e,t,n){"use strict";const r=n(26);class i{constructor(e,t){this.child=e,this.transform=t}open(e){this.child.open(e)}put(e,t,n){this.child.put(this.transform.convert(e),t,n)}get(e,t){this.child.get(this.transform.convert(e),t)}has(e,t){this.child.has(this.transform.convert(e),t)}delete(e,t){this.child.delete(this.transform.convert(e),t)}batch(){const e=this.child.batch();return{put:(t,n)=>{e.put(this.transform.convert(t),n)},delete:t=>{e.delete(this.transform.convert(t))},commit:t=>{e.commit(t)}}}query(e){return r(this.child.query(e),r.map(e=>(e.key=this.transform.invert(e.key),e)))}close(e){this.child.close(e)}}e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var r=n(68),i=f(r),o=n(104),s=f(o),a=n(131),u=f(a),l=n(42),c=f(l);function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t,n){n=(0,u.default)(n||i.default);var r=(0,c.default)(t);if(!e())return n(null);var o=function(t){if(t)return n(t);if(e())return r(o);var i=(0,s.default)(arguments,1);n.apply(null,[null].concat(i))};r(o)}e.exports=t.default},function(e,t,n){"use strict";(function(t){const r=n(26),i=n(829),o=n(33).utils.asyncFilter,s=n(33).utils.asyncSort,a=n(33).Key,u=n(33).Errors,l=n(838);class c{constructor(e,t){let r;t&&t.db?(r=t.db,delete t.db):r=n(842),this.db=i(l(r(e),{valueEncoding:"binary"}),Object.assign({},t,{compression:!1}),e=>{if(e)throw e})}open(e){this.db.open(t=>{if(t)return e(u.dbOpenFailedError(t));e()})}put(e,t,n){this.db.put(e.toString(),t,e=>{if(e)return n(u.dbWriteFailedError(e));n()})}get(e,t){this.db.get(e.toString(),(e,n)=>{if(e)return t(u.notFoundError(e));t(null,n)})}has(e,t){this.db.get(e.toString(),(e,n)=>{if(e)return e.notFound?void t(null,!1):void t(e);t(null,!0)})}delete(e,t){this.db.del(e.toString(),e=>{if(e)return t(u.dbDeleteFailedError(e));t()})}close(e){this.db.close(e)}batch(){const e=[];return{put:(t,n)=>{e.push({type:"put",key:t.toString(),value:n})},delete:t=>{e.push({type:"del",key:t.toString()})},commit:t=>{this.db.batch(e,t)}}}query(e){let n=!0;null!=e.keysOnly&&(n=!e.keysOnly);const i=this.db.db.iterator({keys:!0,values:n,keyAsBuffer:!0}),u=(e,r)=>{if(e)return i.end(t=>{r(t||e)});i.next((e,o,s)=>{if(e)return r(e);if(null==e&&null==o&&null==s)return i.end(e=>{r(e||!0)});const u={key:new a(o,!1)};n&&(u.value=t.from(s)),r(null,u)})};let l=[u],c=[];if(null!=e.prefix){const t=e.prefix;c.push((e,n)=>n(null,e.key.toString().startsWith(t)))}if(null!=e.filters&&(c=c.concat(e.filters)),l=l.concat(c.map(e=>o(e))),null!=e.orders&&(l=l.concat(e.orders.map(e=>s(e)))),null!=e.offset){let t=0;l.push(r.filter(()=>t++>=e.offset))}return null!=e.limit&&l.push(r.take(e.limit)),r.apply(null,l)}}e.exports=c}).call(this,n(0).Buffer)},function(e,t){t.getCallback=function(e,t){return"function"==typeof e?e:t},t.getOptions=function(e){return"object"==typeof e&&null!==e?e:{}}},function(e,t,n){"use strict";const r=n(62);t.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7},t.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36},t.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31},t.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23},t.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")},t.SHIFT32=Math.pow(2,32),t.SHIFT16=Math.pow(2,16),t.MAX_SAFE_HIGH=2097151,t.NEG_ONE=new r(-1),t.TEN=new r(10),t.TWO=new r(2),t.PARENT={ARRAY:0,OBJECT:1,MAP:2,TAG:3,BYTE_STRING:4,UTF8_STRING:5}},function(e,t,n){"use strict";(function(r){const i=n(18),o=n(53);class s{constructor(e,t,n){0!==n&&i(n,"A DAGNode requires it's serialized size"),this._data=e||r.alloc(0),this._links=t||[],this._serializedSize=n}toJSON(){return this._json||(this._json=Object.freeze({data:this.data,links:this.links.map(e=>e.toJSON()),size:this.size})),Object.assign({},this._json)}toString(){return`DAGNode `}get data(){return this._data}set data(e){throw new Error("Can't set property: 'data' is immutable")}get links(){return this._links}set links(e){throw new Error("Can't set property: 'links' is immutable")}get size(){return void 0===this._size&&(this._size=this.links.reduce((e,t)=>e+t.size,this._serializedSize)),this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}}t=e.exports=o(s,{className:"DAGNode",symbolName:"@ipld/js-ipld-dag-pb/dagnode"}),t.create=n(234),t.clone=n(887),t.addLink=n(888),t.rmLink=n(889)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(873),{serialize:i}=n(235),o=n(236),s=o.linkSort,a=n(233),u=n(117);function l(e,n,o){if("function"==typeof e?(o=e,e=void 0):"string"==typeof e&&(e=t.from(e)),"function"==typeof n&&(o=n,n=[]),!t.isBuffer(e))return o(new Error("Passed 'data' is not a buffer or a string!"));n=n.map(e=>u.isDAGLink(e)?e:u.util.createDagLinkFromB58EncodedHash(e)),n=r(n,s),i({data:e,links:n},(t,r)=>t?o(t):o(null,new a(e,n,r.length)))}e.exports=l}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(9),o=n(71),s=o(n(884)),a=n(455),u=n(117),l=n(233),c=n(58),f=n(11),h=n(14);function p(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};const o=t.hashAlg||a.defaultHashAlg;let s=t.version;void 0===s&&(s="sha2-256"===o?0:1),f([t=>{if(r.isBuffer(e))return t(null,e);d(e,t)},(e,t)=>c(e,o,t),(e,t)=>t(null,new i(s,a.multicodec,e))],n)}function d(e,t){let n,{data:r,links:i=[]}=e;!l.isDAGNode(e)&&i&&(i=i.map(e=>u.isDAGLink(e)?e:u.util.createDagLinkFromB58EncodedHash(e)));try{n=s.PBNode.encode(g({data:r,links:i}))}catch(e){return t(e)}t(null,n)}function m(e,t){const n=s.PBNode.decode(e),i=n.Links.map(e=>new u(e.Name,e.Tsize,e.Hash)),o=null==n.Data?r.alloc(0):n.Data;h(()=>t(null,new l(o,i,e.length)))}function g(e){const t={};return e.data&&e.data.length>0?t.Data=e.data:t.Data=null,e.links&&e.links.length>0?t.Links=e.links.map(e=>({Hash:e.cid.buffer,Name:e.name,Tsize:e.size})):t.Links=null,t}t=e.exports,t.serialize=d,t.deserialize=m,t.cid=p}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(117),{cid:o}=n(235);function s(e){let t;return e.data&&e.data.length>0?(t=r.alloc(e.data.length),e.data.copy(t)):t=r.alloc(0),t}function a(e){return e.links.slice()}function u(e,t){return r.compare(e.nameAsBuffer,t.nameAsBuffer)}function l(e,t,n){"function"==typeof t&&(n=t,t={}),o(e,t,(r,o)=>{if(r)return n(r);n(null,new i(t.name||"",e.size,o))})}t=e.exports,t.cloneData=s,t.cloneLinks=a,t.linkSort=u,t.toDAGLink=l}).call(this,n(0).Buffer)},function(e,t,n){var r=n(19);function i(e,t){var n=function(){return new r.aes.Algorithm(e,t)};r.cipher.registerAlgorithm(e,n)}n(458),n(459),n(34),e.exports=r.aes=r.aes||{},r.aes.startEncrypting=function(e,t,n,r){var i=m({key:e,output:n,decrypt:!1,mode:r});return i.start(t),i},r.aes.createEncryptionCipher=function(e,t){return m({key:e,output:null,decrypt:!1,mode:t})},r.aes.startDecrypting=function(e,t,n,r){var i=m({key:e,output:n,decrypt:!0,mode:r});return i.start(t),i},r.aes.createDecryptionCipher=function(e,t){return m({key:e,output:null,decrypt:!0,mode:t})},r.aes.Algorithm=function(e,t){o||h();var n=this;n.name=e,n.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return d(n._w,e,t,!1)},decrypt:function(e,t){return d(n._w,e,t,!0)}}}),n._init=!1},r.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t=e.key,n;if("string"!=typeof t||16!==t.length&&24!==t.length&&32!==t.length){if(r.util.isArray(t)&&(16===t.length||24===t.length||32===t.length)){n=t,t=r.util.createBuffer();for(var i=0;i>>=2;for(var i=0;i>8^255&p^99,a[n]=p,u[p]=n,d=e[p],i=e[n],s=e[i],h=e[s],m=d<<24^p<<16^p<<8^p^d,g=(i^s^h)<<24^(n^h)<<16^(n^s^h)<<8^n^i^h;for(var y=0;y<4;++y)c[y][n]=m,f[y][p]=g,m=m<<24|m>>>8,g=g<<24|g>>>8;0===n?n=r=1:(n=i^e[e[e[i^h]]],r^=e[e[r]])}}function p(e,t){for(var n=e.slice(0),r,i=1,o=n.length,u=o+6+1,c=s*u,h=o;h>>16&255]<<24^a[r>>>8&255]<<16^a[255&r]<<8^a[r>>>24]^l[i]<<24,i++):o>6&&h%o==4&&(r=a[r>>>24]<<24^a[r>>>16&255]<<16^a[r>>>8&255]<<8^a[255&r]),n[h]=n[h-o]^r;if(t){var p,d=f[0],m=f[1],g=f[2],y=f[3],b=n.slice(0);c=n.length;for(var h=0,v=c-s;h>>24]]^m[a[p>>>16&255]]^g[a[p>>>8&255]]^y[a[255&p]];n=b}return n}function d(e,t,n,r){var i=e.length/4-1,o,s,l,h,p,d,m,g,y,b,v,w;r?(o=f[0],s=f[1],l=f[2],h=f[3],p=u):(o=c[0],s=c[1],l=c[2],h=c[3],p=a),d=t[0]^e[0],m=t[r?3:1]^e[1],g=t[2]^e[2],y=t[r?1:3]^e[3];for(var _=3,k=1;k>>24]^s[m>>>16&255]^l[g>>>8&255]^h[255&y]^e[++_],v=o[m>>>24]^s[g>>>16&255]^l[y>>>8&255]^h[255&d]^e[++_],w=o[g>>>24]^s[y>>>16&255]^l[d>>>8&255]^h[255&m]^e[++_],y=o[y>>>24]^s[d>>>16&255]^l[m>>>8&255]^h[255&g]^e[++_],d=b,m=v,g=w;n[0]=p[d>>>24]<<24^p[m>>>16&255]<<16^p[g>>>8&255]<<8^p[255&y]^e[++_],n[r?3:1]=p[m>>>24]<<24^p[g>>>16&255]<<16^p[y>>>8&255]<<8^p[255&d]^e[++_],n[2]=p[g>>>24]<<24^p[y>>>16&255]<<16^p[d>>>8&255]<<8^p[255&m]^e[++_],n[r?1:3]=p[y>>>24]<<24^p[d>>>16&255]<<16^p[m>>>8&255]<<8^p[255&g]^e[++_]}function m(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),n="AES-"+t,i;i=e.decrypt?r.cipher.createDecipher(n,e.key):r.cipher.createCipher(n,e.key);var o=i.start;return i.start=function(e,t){var n=null;t instanceof r.util.ByteBuffer&&(n=t,t={}),t=t||{},t.output=n,t.iv=e,o.call(i,t)},i}},function(e,t,n){"use strict";var r=n(4).Buffer,i=n(931),o;function s(){this.negative=0,this.words=null,this.length=0}s.fromNumber=function(e){var t=new s;return t.words=[67108863&e],t.length=1,t},s.fromBuffer=function(e){var t=new s;return t.words=new Array(10),t.words[0]=(3&e[28])<<24|e[29]<<16|e[30]<<8|e[31],t.words[1]=(15&e[25])<<22|e[26]<<14|e[27]<<6|e[28]>>>2,t.words[2]=(63&e[22])<<20|e[23]<<12|e[24]<<4|e[25]>>>4,t.words[3]=(255&e[19])<<18|e[20]<<10|e[21]<<2|e[22]>>>6,t.words[4]=(3&e[15])<<24|e[16]<<16|e[17]<<8|e[18],t.words[5]=(15&e[12])<<22|e[13]<<14|e[14]<<6|e[15]>>>2,t.words[6]=(63&e[9])<<20|e[10]<<12|e[11]<<4|e[12]>>>4,t.words[7]=(255&e[6])<<18|e[7]<<10|e[8]<<2|e[9]>>>6,t.words[8]=(3&e[2])<<24|e[3]<<16|e[4]<<8|e[5],t.words[9]=e[0]<<14|e[1]<<6|e[2]>>>2,t.length=10,t.strip()},s.prototype.toBuffer=function(){for(var e=this.words,t=this.length;t<10;++t)e[t]=0;return r.from([e[9]>>>14&255,e[9]>>>6&255,(63&e[9])<<2|e[8]>>>24&3,e[8]>>>16&255,e[8]>>>8&255,255&e[8],e[7]>>>18&255,e[7]>>>10&255,e[7]>>>2&255,(3&e[7])<<6|e[6]>>>20&63,e[6]>>>12&255,e[6]>>>4&255,(15&e[6])<<4|e[5]>>>22&15,e[5]>>>14&255,e[5]>>>6&255,(63&e[5])<<2|e[4]>>>24&3,e[4]>>>16&255,e[4]>>>8&255,255&e[4],e[3]>>>18&255,e[3]>>>10&255,e[3]>>>2&255,(3&e[3])<<6|e[2]>>>20&63,e[2]>>>12&255,e[2]>>>4&255,(15&e[2])<<4|e[1]>>>22&15,e[1]>>>14&255,e[1]>>>6&255,(63&e[1])<<2|e[0]>>>24&3,e[0]>>>16&255,e[0]>>>8&255,255&e[0]])},s.prototype.clone=function(){var e=new s;e.words=new Array(this.length);for(var t=0;t1&&0==(0|this.words[this.length-1]);)this.length--;return this},s.prototype.normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.ucmp=function(e){if(this.length!==e.length)return this.length>e.length?1:-1;for(var t=this.length-1;t>=0;--t)if(this.words[t]!==e.words[t])return this.words[t]>e.words[t]?1:-1;return 0},s.prototype.gtOne=function(){return this.length>1||this.words[0]>1},s.prototype.isOverflow=function(){return this.ucmp(s.n)>=0},s.prototype.isHigh=function(){return 1===this.ucmp(s.nh)},s.prototype.bitLengthGT256=function(){return this.length>10||10===this.length&&this.words[9]>4194303},s.prototype.iuaddn=function(e){this.words[0]+=e;for(var t=0;this.words[t]>67108863&&te.length?(t=this,n=e):(t=e,n=this);for(var r=0,i=0;r>>26}for(;0!==i&&r>>26;if(this.length=t.length,0!==i)this.words[this.length++]=i;else if(t!==this)for(;r0?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;i>26,this.words[i]=67108863&s}for(;0!==o&&i>26,this.words[i]=67108863&s;if(0===o&&i>>26,c=67108863&s,f=Math.max(0,a-e.length+1),h=Math.min(a,t.length-1);f<=h;f++){var p=a-f,d=e.words[p],m=t.words[f],g=d*m+c;l+=g/67108864|0,c=67108863&g}n.words[a]=c,s=l}return 0!==s&&(n.words[n.length++]=s),n.strip()},s.umulTo10x10=Math.imul?i.umulTo10x10:s.umulTo,s.umulnTo=function(e,t,n){if(0===t)return n.words=[0],n.length=1,n;for(var r=0,i=0;r0?(n.words[r]=i,n.length=e.length+1):n.length=e.length,n},s.prototype.umul=function(e){var t=new s;return t.words=new Array(this.length+e.length),10===this.length&&10===e.length?s.umulTo10x10(this,e,t):1===this.length?s.umulnTo(e,this.words[0],t):1===e.length?s.umulnTo(this,e.words[0],t):s.umulTo(this,e,t)},s.prototype.isplit=function(e){e.length=Math.min(this.length,9);for(var t=0;t>>22,n=r}return n>>>=22,this.words[t-10]=n,0===n&&this.length>10?this.length-=10:this.length-=9,this},s.prototype.fireduce=function(){return this.isOverflow()&&this.isub(s.n),this},s.prototype.ureduce=function(){var e=this.clone().isplit(s.tmp).umul(s.nc).iadd(s.tmp);return e.bitLengthGT256()&&(e=e.isplit(s.tmp).umul(s.nc).iadd(s.tmp),e.bitLengthGT256()&&(e=e.isplit(s.tmp).umul(s.nc).iadd(s.tmp))),e.fireduce()},s.prototype.ishrn=function(e){for(var t=(1<=0;--r){var o=this.words[r];this.words[r]=i<>>e,i=o&t}return this.length>1&&0===this.words[this.length-1]&&(this.length-=1),this},s.prototype.uinvm=function(){for(var e=this.clone(),t=s.n.clone(),n=s.fromNumber(1),r=s.fromNumber(0),i=s.fromNumber(0),o=s.fromNumber(1);e.isEven()&&t.isEven();){for(var a=1,u=1;0==(e.words[0]&u)&&0==(t.words[0]&u)&&a<26;++a,u<<=1);e.ishrn(a),t.ishrn(a)}for(var l=t.clone(),c=e.clone();!e.isZero();){for(var f=0,h=1;0==(e.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(e.ishrn(f);f-- >0;)(n.isOdd()||r.isOdd())&&(n.iadd(l),r.isub(c)),n.ishrn(1),r.ishrn(1);for(var p=0,d=1;0==(t.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(t.ishrn(p);p-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(l),o.isub(c)),i.ishrn(1),o.ishrn(1);e.ucmp(t)>=0?(e.isub(t),n.isub(i),r.isub(o)):(t.isub(e),i.isub(n),o.isub(r))}if(1===i.negative){i.negative=0;var m=i.ureduce();return m.negative^=1,m.normSign().iadd(s.n)}return i.ureduce()},s.prototype.imulK=function(){this.words[this.length]=0,this.words[this.length+1]=0,this.length+=2;for(var e=0,t=0;e0?this.isub(s.p):this.strip(),this},s.prototype.redNeg=function(){return this.isZero()?s.fromNumber(0):s.p.sub(this)},s.prototype.redAdd=function(e){return this.clone().redIAdd(e)},s.prototype.redIAdd=function(e){return this.iadd(e),this.ucmp(s.p)>=0&&this.isub(s.p),this},s.prototype.redIAdd7=function(){return this.iuaddn(7),this.ucmp(s.p)>=0&&this.isub(s.p),this},s.prototype.redSub=function(e){return this.clone().redISub(e)},s.prototype.redISub=function(e){return this.isub(e),0!==this.negative&&this.iadd(s.p),this},s.prototype.redMul=function(e){return this.umul(e).redIReduce()},s.prototype.redSqr=function(){return this.umul(this).redIReduce()},s.prototype.redSqrt=function(){if(this.isZero())return this.clone();for(var e=this.redSqr(),t=e.redSqr(),n=t.redSqr().redMul(t),r=n.redMul(e),i=r.redMul(this),o=i,s=0;s<54;++s)o=o.redSqr().redSqr().redSqr().redSqr().redMul(i);for(o=o.redSqr().redSqr().redSqr().redSqr().redMul(r),s=0;s<5;++s)o=o.redSqr().redSqr().redSqr().redSqr().redMul(i);return o=o.redSqr().redSqr().redSqr().redSqr().redMul(n),o=o.redSqr().redSqr().redSqr().redSqr().redSqr().redSqr().redMul(n),0===o.redSqr().ucmp(this)?o:null},s.prototype.redInvm=function(){for(var e=this.clone(),t=s.p.clone(),n=s.fromNumber(1),r=s.fromNumber(0),i;e.gtOne()&&t.gtOne();){for(var o=0,a=1;0==(e.words[0]&a)&&o<26;++o,a<<=1);if(o>0)for(e.ishrn(o);o-- >0;)n.isOdd()&&n.iadd(s.p),n.ishrn(1);for(var u=0,l=1;0==(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.ishrn(u);u-- >0;)r.isOdd()&&r.iadd(s.p),r.ishrn(1);e.ucmp(t)>=0?(e.isub(t),n.isub(r)):(t.isub(e),r.isub(n))}return i=1===e.length&&1===e.words[0]?n:r,0!==i.negative&&i.iadd(s.p),0!==i.negative?(i.negative=0,i.redIReduce().redNeg()):i.redIReduce()},s.prototype.getNAF=function(e){for(var t=[],n=1<>1,o=this.clone();!o.isZero();){for(var s=0,a=1;0==(o.words[0]&a)&&s<26;++s,a<<=1)t.push(0);if(0!==s)o.ishrn(s);else{var u=o.words[0]&r;if(u>=i)t.push(i-u),o.iuaddn(u-i).ishrn(1);else if(t.push(u),o.words[0]-=u,!o.isZero()){for(s=e-1;s>0;--s)t.push(0);o.ishrn(e)}}}return t},s.prototype.inspect=function(){if(this.isZero())return"0";for(var e=this.toBuffer().toString("hex"),t=0;"0"===e[t];++t);return e.slice(t)},s.n=s.fromBuffer(r.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","hex")),s.nh=s.n.clone().ishrn(1),s.nc=s.fromBuffer(r.from("000000000000000000000000000000014551231950B75FC4402DA1732FC9BEBF","hex")),s.p=s.fromBuffer(r.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","hex")),s.psn=s.p.sub(s.n),s.tmp=new s,s.tmp.words=new Array(10),o=s.fromNumber(1),o.words[3]=0,e.exports=s},function(e,t,n){var r=n(4).Buffer;function i(e){r.isBuffer(e)||(e=r.from(e));for(var t=e.length/4|0,n=new Array(t),i=0;i>>24]^s[c>>>16&255]^a[f>>>8&255]^u[255&h]^t[y++],d=o[c>>>24]^s[f>>>16&255]^a[h>>>8&255]^u[255&l]^t[y++],m=o[f>>>24]^s[h>>>16&255]^a[l>>>8&255]^u[255&c]^t[y++],g=o[h>>>24]^s[l>>>16&255]^a[c>>>8&255]^u[255&f]^t[y++],l=p,c=d,f=m,h=g;return p=(r[l>>>24]<<24|r[c>>>16&255]<<16|r[f>>>8&255]<<8|r[255&h])^t[y++],d=(r[c>>>24]<<24|r[f>>>16&255]<<16|r[h>>>8&255]<<8|r[255&l])^t[y++],m=(r[f>>>24]<<24|r[h>>>16&255]<<16|r[l>>>8&255]<<8|r[255&c])^t[y++],g=(r[h>>>24]<<24|r[l>>>16&255]<<16|r[c>>>8&255]<<8|r[255&f])^t[y++],p>>>=0,d>>>=0,m>>>=0,g>>>=0,[p,d,m,g]}var a=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var n=[],r=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,u=0;u<256;++u){var l=a^a<<1^a<<2^a<<3^a<<4;l=l>>>8^255&l^99,n[s]=l,r[l]=s;var c=e[s],f=e[c],h=e[f],p=257*e[l]^16843008*l;i[0][s]=p<<24|p>>>8,i[1][s]=p<<16|p>>>16,i[2][s]=p<<8|p>>>24,i[3][s]=p,p=16843009*h^65537*f^257*c^16843008*s,o[0][l]=p<<24|p>>>8,o[1][l]=p<<16|p>>>16,o[2][l]=p<<8|p>>>24,o[3][l]=p,0===s?s=a=1:(s=c^e[e[e[h^c]]],a^=e[e[a]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:o}}();function l(e){this._key=i(e),this._reset()}l.blockSize=16,l.keySize=32,l.prototype.blockSize=l.blockSize,l.prototype.keySize=l.keySize,l.prototype._reset=function(){for(var e=this._key,t=e.length,n=t+6,r=4*(n+1),i=[],o=0;o>>24,s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s],s^=a[o/t|0]<<24):t>6&&o%t==4&&(s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s]),i[o]=i[o-t]^s}for(var l=[],c=0;c>>24]]^u.INV_SUB_MIX[1][u.SBOX[h>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[h>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&h]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=l},l.prototype.encryptBlockRaw=function(e){return e=i(e),s(e,this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},l.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),n=r.allocUnsafe(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[1],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[3],12),n},l.prototype.decryptBlock=function(e){e=i(e);var t=e[1];e[1]=e[3],e[3]=t;var n=s(e,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=r.allocUnsafe(16);return o.writeUInt32BE(n[0],0),o.writeUInt32BE(n[3],4),o.writeUInt32BE(n[2],8),o.writeUInt32BE(n[1],12),o},l.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},e.exports.AES=l},function(e,t){function n(e){return e}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=n(68),i=a(r),o=n(291),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){return function(n,r,o,a){a=a||i.default;var u=!1,l;n(r,function(n,r,i){o(n,function(r,o){r?i(r):e(o)&&!l?(u=!0,l=t(!0,n),i(null,s.default)):i()})},function(e){e?a(e):a(null,u?l:t(!1))})}}e.exports=t.default},function(e,t,n){"use strict";const r=n(71),i=n(137),o=n(981),s=n(18),a=n(56),u=n(91),l=n(9),c=n(982),f=n(984),h=n(58),p=r(n(985)),d=n(986);class m{constructor(e){this.full=e,this.wantlist=new Map,this.blocks=new Map}get empty(){return 0===this.blocks.size&&0===this.wantlist.size}addEntry(e,t,n){s(e&&l.isCID(e),"must be a valid cid");const r=e.buffer.toString(),i=this.wantlist.get(r);i?(i.priority=t,i.cancel=Boolean(n)):this.wantlist.set(r,new d(e,t,n))}addBlock(e){s(i.isBlock(e),"must be a valid cid");const t=e.cid.buffer.toString();this.blocks.set(t,e)}cancel(e){s(l.isCID(e),"must be a valid cid");const t=e.buffer.toString();this.wantlist.delete(t),this.addEntry(e,0,!0)}serializeToBitswap100(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map(e=>({block:e.cid.buffer,priority:Number(e.priority),cancel:Boolean(e.cancel)}))},blocks:Array.from(this.blocks.values()).map(e=>e.data)};return this.full&&(e.wantlist.full=!0),p.Message.encode(e)}serializeToBitswap110(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map(e=>({block:e.cid.buffer,priority:Number(e.priority),cancel:Boolean(e.cancel)}))},payload:[]};return this.full&&(e.wantlist.full=!0),this.blocks.forEach(t=>{e.payload.push({prefix:t.cid.prefix,data:t.data})}),p.Message.encode(e)}equals(e){const t=(e,t)=>{if(e.equals&&"function"==typeof e.equals)return e.equals(t)};return!(this.full!==e.full||!o(this.wantlist,e.wantlist,t)||!o(this.blocks,e.blocks,t))}get[Symbol.toStringTag](){const e=Array.from(this.wantlist.keys()),t=Array.from(this.blocks.keys());return`BitswapMessage `}}m.deserialize=((e,t)=>{let n;try{n=p.Message.decode(e)}catch(e){return u(()=>t(e))}const r=n.wantlist&&n.wantlist.full||!1,o=new m(r);return n.wantlist&&n.wantlist.entries.forEach(e=>{let n;try{n=new l(e.block)}catch(e){return t(e)}o.addEntry(n,e.priority,e.cancel)}),n.blocks.length>0?a(n.blocks,(e,n)=>{h(e,"sha2-256",(r,s)=>{if(r)return n(r);let a;try{a=new l(s)}catch(r){return t(r)}o.addBlock(new i(e,a)),n()})},e=>{if(e)return t(e);t(null,o)}):n.payload.length>0?a(n.payload,(e,t)=>{if(!e.prefix||!e.data)return u(t);const n=f(e.prefix),r=n[0],s=n[1],a=n[2];h(e.data,a,(n,a)=>{if(n)return t(n);let u;try{u=new l(r,c[s.toString("16")],a)}catch(n){return t(n)}o.addBlock(new i(e.data,u)),t()})},e=>{if(e)return t(e);t(null,o)}):void t(null,o)}),m.Entry=d,e.exports=m},function(e,t,n){"use strict";const{sortBy:r}=n(120),i=n(987);class o{constructor(e){this.set=new Map,this._stats=e}get length(){return this.set.size}add(e,t){const n=e.buffer.toString(),r=this.set.get(n);r?(r.inc(),r.priority=t):(this.set.set(n,new i(e,t)),this._stats&&this._stats.push(null,"wantListSize",1))}remove(e){const t=e.buffer.toString(),n=this.set.get(t);n&&(n.dec(),n.hasRefs()||(this.set.delete(t),this._stats&&this._stats.push(null,"wantListSize",-1)))}removeForce(e){this.set.has(e)&&this.set.delete(e)}forEach(e){return this.set.forEach(e)}entries(){return this.set.entries()}sortedEntries(){return new Map(r(e=>e[1].key,Array.from(this.set.entries())))}contains(e){const t=e.buffer.toString();return this.set.get(t)}}o.Entry=i,e.exports=o},function(e,t,n){var r=n(493);function i(e,t,n){var i=null==e?void 0:r(e,t);return void 0===i?n:i}e.exports=i},function(e,t,n){var r=n(121),i=r(Object,"create");e.exports=i},function(e,t,n){var r=n(1012),i=n(1013),o=n(1014),s=n(1015),a=n(1016);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function l(){try{return window.localStorage}catch(e){}}t=e.exports=n(1062),t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:l(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(this,n(2))},function(e,t){t.encode=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t},t.decode=function(e){for(var t={},n=e.split("&"),r=0,i=n.length;r=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function l(){try{return window.localStorage}catch(e){}}t=e.exports=n(1079),t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:l(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(this,n(2))},function(e,t,n){(function(t){e.exports=f;var r=n(5)("simple-peer"),i=n(1086),o=n(1),s=n(148),a=n(1087),u=65536,l=5e3,c=5e3;function f(e){var t=this;if(!(t instanceof f))return new f(e);if(t._id=s(4).toString("hex").slice(0,7),t._debug("new peer %o",e),e=Object.assign({allowHalfOpen:!1},e),a.Duplex.call(t,e),t.channelName=e.initiator?e.channelName||s(20).toString("hex"):null,t.initiator=e.initiator||!1,t.channelConfig=e.channelConfig||f.channelConfig,t.config=Object.assign({},f.config,e.config),t.offerOptions=e.offerOptions||{},t.answerOptions=e.answerOptions||{},t.sdpTransform=e.sdpTransform||function(e){return e},t.streams=e.streams||(e.stream?[e.stream]:[]),t.trickle=void 0===e.trickle||e.trickle,t.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,t.iceCompleteTimeout=e.iceCompleteTimeout||l,t.destroyed=!1,t.connected=!1,t.remoteAddress=void 0,t.remoteFamily=void 0,t.remotePort=void 0,t.localAddress=void 0,t.localFamily=void 0,t.localPort=void 0,t._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:i(),!t._wrtc)throw"undefined"==typeof window?p("No WebRTC support: Specify `opts.wrtc` option in this environment","ERR_WEBRTC_SUPPORT"):p("No WebRTC support: Not a supported browser","ERR_WEBRTC_SUPPORT");t._pcReady=!1,t._channelReady=!1,t._iceComplete=!1,t._iceCompleteTimer=null,t._channel=null,t._pendingCandidates=[],t._isNegotiating=!t.initiator,t._batchedNegotiation=!1,t._queuedNegotiation=!1,t._sendersAwaitingStable=[],t._senderMap=new Map,t._firstStable=!0,t._closingInterval=null,t._remoteTracks=[],t._remoteStreams=[],t._chunk=null,t._cb=null,t._interval=null;try{t._pc=new t._wrtc.RTCPeerConnection(t.config)}catch(e){t.destroy(e)}t._isReactNativeWebrtc="number"==typeof t._pc._peerConnectionId,t._pc.oniceconnectionstatechange=function(){t._onIceStateChange()},t._pc.onicegatheringstatechange=function(){t._onIceStateChange()},t._pc.onsignalingstatechange=function(){t._onSignalingStateChange()},t._pc.onicecandidate=function(e){t._onIceCandidate(e)},t.initiator?t._setupData({channel:t._pc.createDataChannel(t.channelName,t.channelConfig)}):t._pc.ondatachannel=function(e){t._setupData(e)},t.streams&&t.streams.forEach(function(e){t.addStream(e)}),t._pc.ontrack=function(e){t._onTrack(e)},t.initiator&&t._needsNegotiation(),t._onFinishBound=function(){t._onFinish()},t.once("finish",t._onFinishBound)}function h(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}function p(e,t){var n=new Error(e);return n.code=t,n}o(f,a.Duplex),f.WEBRTC_SUPPORT=!!i(),f.config={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:global.stun.twilio.com:3478?transport=udp"}],sdpSemantics:"unified-plan"},f.channelConfig={},Object.defineProperty(f.prototype,"bufferSize",{get:function(){var e=this;return this._channel&&this._channel.bufferedAmount||0}}),f.prototype.address=function(){var e=this;return{port:this.localPort,family:this.localFamily,address:this.localAddress}},f.prototype.signal=function(e){var t=this;if(t.destroyed)throw p("cannot signal after peer is destroyed","ERR_SIGNALING");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}t._debug("signal()"),e.renegotiate&&t.initiator&&(t._debug("got request to renegotiate"),t._needsNegotiation()),e.transceiverRequest&&t.initiator&&(t._debug("got request for transceiver"),t.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(t._pc.localDescription&&t._pc.localDescription.type&&t._pc.remoteDescription&&t._pc.remoteDescription.type?t._addIceCandidate(e.candidate):t._pendingCandidates.push(e.candidate)),e.sdp&&t._pc.setRemoteDescription(new t._wrtc.RTCSessionDescription(e)).then(function(){t.destroyed||(t._pendingCandidates.forEach(function(e){t._addIceCandidate(e)}),t._pendingCandidates=[],"offer"===t._pc.remoteDescription.type&&t._createAnswer())}).catch(function(e){t.destroy(p(e,"ERR_SET_REMOTE_DESCRIPTION"))}),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||t.destroy(p("signal() called with invalid signal data","ERR_SIGNALING"))},f.prototype._addIceCandidate=function(e){var t=this;t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e)).catch(function(e){if("closed"!==t._pc.signalingState&&"Failed to set ICE candidate; RTCPeerConnection is closed."===e.message)return t._debug("ignoring incorrect wrtc error");t.destroy(p(e,"ERR_ADD_ICE_CANDIDATE"))})},f.prototype.send=function(e){var t=this;this._channel.send(e)},f.prototype.addTransceiver=function(e,t){var n=this;if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(e){this.destroy(e)}else this.emit("signal",{transceiverRequest:{kind:e,init:t}})},f.prototype.addStream=function(e){var t=this;t._debug("addStream()"),e.getTracks().forEach(function(n){t.addTrack(n,e)})},f.prototype.addTrack=function(e,t){var n=this;this._debug("addTrack()");var r=this._senderMap.get(e)||new Map,i=r.get(t);i?i.removed?this.destroy(p("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):this.destroy(p("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED"):(i=this._pc.addTrack(e,t),r.set(t,i),this._senderMap.set(e,r),this._needsNegotiation())},f.prototype.replaceTrack=function(e,t,n){var r=this;this._debug("replaceTrack()");var i=this._senderMap.get(e),o=i?i.get(n):null;o||this.destroy(p("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED"),t&&this._senderMap.set(t,i),null!=o.replaceTrack?o.replaceTrack(t):this.destroy(p("replaceTrack is not supported in this browser","ERR_UNSUPPORTED_REPLACETRACK"))},f.prototype.removeTrack=function(e,t){var n=this;this._debug("removeSender()");var r=this._senderMap.get(e),i=r?r.get(t):null;i||this.destroy(p("Cannot remove track that was never added.","ERR_TRACK_NOT_ADDED"));try{i.removed=!0,this._pc.removeTrack(i)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?this._sendersAwaitingStable.push(i):this.destroy(e)}this._needsNegotiation()},f.prototype.removeStream=function(e){var t=this;t._debug("removeSenders()"),e.getTracks().forEach(function(n){t.removeTrack(n,e)})},f.prototype._needsNegotiation=function(){var e=this;e._debug("_needsNegotiation"),e._batchedNegotiation||(e._batchedNegotiation=!0,setTimeout(function(){e._batchedNegotiation=!1,e._debug("starting batched negotiation"),e.negotiate()},0))},f.prototype.negotiate=function(){var e=this;e.initiator?e._isNegotiating?(e._queuedNegotiation=!0,e._debug("already negotiating, queueing")):(e._debug("start negotiation"),setTimeout(()=>{e._createOffer()},0)):e._isNegotiating||(e._debug("requesting negotiation from initiator"),e.emit("signal",{renegotiate:!0})),e._isNegotiating=!0},f.prototype.destroy=function(e){var t=this;this._destroy(e,function(){})},f.prototype._destroy=function(e,t){var n=this;if(!this.destroyed){if(this._debug("destroy (error: %s)",e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this.destroyed=!0,this.connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(e){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,e&&this.emit("error",e),this.emit("close"),t()}},f.prototype._setupData=function(e){var t=this;if(!e.channel)return t.destroy(p("Data channel event is missing `channel` property","ERR_DATA_CHANNEL"));t._channel=e.channel,t._channel.binaryType="arraybuffer","number"==typeof t._channel.bufferedAmountLowThreshold&&(t._channel.bufferedAmountLowThreshold=65536),t.channelName=t._channel.label,t._channel.onmessage=function(e){t._onChannelMessage(e)},t._channel.onbufferedamountlow=function(){t._onChannelBufferedAmountLow()},t._channel.onopen=function(){t._onChannelOpen()},t._channel.onclose=function(){t._onChannelClose()},t._channel.onerror=function(e){t.destroy(p(e,"ERR_DATA_CHANNEL"))};var n=!1;t._closingInterval=setInterval(function(){t._channel&&"closing"===t._channel.readyState?(n&&t._onChannelClose(),n=!0):n=!1},5e3)},f.prototype._read=function(){},f.prototype._write=function(e,t,n){var r=this;if(this.destroyed)return n(p("cannot write after peer is destroyed","ERR_DATA_CHANNEL"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(p(e,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=e,this._cb=n},f.prototype._onFinish=function(){var e=this;function t(){setTimeout(function(){e.destroy()},1e3)}e.destroyed||(e.connected?t():e.once("connect",t))},f.prototype._startIceCompleteTimeout=function(){var e=this;e.destroyed||e._iceCompleteTimer||(e._debug("started iceComplete timeout"),e._iceCompleteTimer=setTimeout(function(){e._iceComplete||(e._iceComplete=!0,e._debug("iceComplete timeout completed"),e.emit("iceTimeout"),e.emit("_iceComplete"))},e.iceCompleteTimeout))},f.prototype._createOffer=function(){var e=this;e.destroyed||e._pc.createOffer(e.offerOptions).then(function(t){function n(){e._debug("createOffer success"),e.destroyed||(e.trickle||e._iceComplete?i():e.once("_iceComplete",i))}function r(t){e.destroy(p(t,"ERR_SET_LOCAL_DESCRIPTION"))}function i(){if(!e.destroyed){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp})}}e.destroyed||(e.trickle||e.allowHalfTrickle||(t.sdp=h(t.sdp)),t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(n).catch(r))}).catch(function(t){e.destroy(p(t,"ERR_CREATE_OFFER"))})},f.prototype._requestMissingTransceivers=function(){var e=this;e._pc.getTransceivers&&e._pc.getTransceivers().forEach(t=>{!t.mid&&t.sender.track&&e.addTransceiver(t.sender.track.kind)})},f.prototype._createAnswer=function(){var e=this;e.destroyed||e._pc.createAnswer(e.answerOptions).then(function(t){function n(){e.destroyed||(e.trickle||e._iceComplete?i():e.once("_iceComplete",i))}function r(t){e.destroy(p(t,"ERR_SET_LOCAL_DESCRIPTION"))}function i(){if(!e.destroyed){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp}),e.initiator||e._requestMissingTransceivers()}}e.destroyed||(e.trickle||e.allowHalfTrickle||(t.sdp=h(t.sdp)),t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(n).catch(r))}).catch(function(t){e.destroy(p(t,"ERR_CREATE_ANSWER"))})},f.prototype._onIceStateChange=function(){var e=this;if(!this.destroyed){var t=this._pc.iceConnectionState,n=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",t,n),this.emit("iceStateChange",t,n),"connected"!==t&&"completed"!==t||(this._pcReady=!0,this._maybeReady()),"failed"===t&&this.destroy(p("Ice connection failed.","ERR_ICE_CONNECTION_FAILURE")),"closed"===t&&this.destroy(p("Ice connection closed.","ERR_ICE_CONNECTION_CLOSED"))}},f.prototype.getStats=function(e){var t=this;function n(e){return"[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach(function(t){Object.assign(e,t)}),e}0===t._pc.getStats.length?t._pc.getStats().then(function(t){var r=[];t.forEach(function(e){r.push(n(e))}),e(null,r)},function(t){e(t)}):t._isReactNativeWebrtc?t._pc.getStats(null,function(t){var r=[];t.forEach(function(e){r.push(n(e))}),e(null,r)},function(t){e(t)}):t._pc.getStats.length>0?t._pc.getStats(function(r){if(!t.destroyed){var i=[];r.result().forEach(function(e){var t={};e.names().forEach(function(n){t[n]=e.stat(n)}),t.id=e.id,t.type=e.type,t.timestamp=e.timestamp,i.push(n(t))}),e(null,i)}},function(t){e(t)}):e(null,[])},f.prototype._maybeReady=function(){var e=this;function t(){e.destroyed||e.getStats(function(n,r){if(!e.destroyed){n&&(r=[]);var i={},o={},s={},a=!1;if(r.forEach(function(e){"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(i[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(o[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(s[e.id]=e)}),r.forEach(function(e){"transport"===e.type&&e.selectedCandidatePairId&&l(s[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&l(e)}),a||Object.keys(s).length&&!Object.keys(o).length){if(e._connecting=!1,e.connected=!0,e._chunk){try{e.send(e._chunk)}catch(n){return e.destroy(p(n,"ERR_DATA_CHANNEL"))}e._chunk=null,e._debug('sent chunk from "write before connect"');var u=e._cb;e._cb=null,u(null)}"number"!=typeof e._channel.bufferedAmountLowThreshold&&(e._interval=setInterval(function(){e._onInterval()},150),e._interval.unref&&e._interval.unref()),e._debug("connect"),e.emit("connect")}else setTimeout(t,100)}function l(t){a=!0;var n=o[t.localCandidateId];n&&(n.ip||n.address)?(e.localAddress=n.ip||n.address,e.localPort=Number(n.port)):n&&n.ipAddress?(e.localAddress=n.ipAddress,e.localPort=Number(n.portNumber)):"string"==typeof t.googLocalAddress&&(n=t.googLocalAddress.split(":"),e.localAddress=n[0],e.localPort=Number(n[1])),e.localAddress&&(e.localFamily=e.localAddress.includes(":")?"IPv6":"IPv4");var r=i[t.remoteCandidateId];r&&(r.ip||r.address)?(e.remoteAddress=r.ip||r.address,e.remotePort=Number(r.port)):r&&r.ipAddress?(e.remoteAddress=r.ipAddress,e.remotePort=Number(r.portNumber)):"string"==typeof t.googRemoteAddress&&(r=t.googRemoteAddress.split(":"),e.remoteAddress=r[0],e.remotePort=Number(r[1])),e.remoteAddress&&(e.remoteFamily=e.remoteAddress.includes(":")?"IPv6":"IPv4"),e._debug("connect local: %s:%s remote: %s:%s",e.localAddress,e.localPort,e.remoteAddress,e.remotePort)}})}e._debug("maybeReady pc %s channel %s",e._pcReady,e._channelReady),!e.connected&&!e._connecting&&e._pcReady&&e._channelReady&&(e._connecting=!0,t())},f.prototype._onInterval=function(){var e=this;!this._cb||!this._channel||this._channel.bufferedAmount>65536||this._onChannelBufferedAmountLow()},f.prototype._onSignalingStateChange=function(){var e=this;e.destroyed||("stable"!==e._pc.signalingState||e._firstStable||(e._isNegotiating=!1,e._debug("flushing sender queue",e._sendersAwaitingStable),e._sendersAwaitingStable.forEach(function(t){e._pc.removeTrack(t),e._queuedNegotiation=!0}),e._sendersAwaitingStable=[],e._queuedNegotiation&&(e._debug("flushing negotiation queue"),e._queuedNegotiation=!1,e._needsNegotiation()),e._debug("negotiate"),e.emit("negotiate")),e._firstStable=!1,e._debug("signalingStateChange %s",e._pc.signalingState),e.emit("signalingStateChange",e._pc.signalingState))},f.prototype._onIceCandidate=function(e){var t=this;this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())},f.prototype._onChannelMessage=function(e){var n=this;if(!this.destroyed){var r=e.data;r instanceof ArrayBuffer&&(r=t.from(r)),this.push(r)}},f.prototype._onChannelBufferedAmountLow=function(){var e=this;if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);var t=this._cb;this._cb=null,t(null)}},f.prototype._onChannelOpen=function(){var e=this;this.connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())},f.prototype._onChannelClose=function(){var e=this;this.destroyed||(this._debug("on channel close"),this.destroy())},f.prototype._onTrack=function(e){var t=this;t.destroyed||e.streams.forEach(function(n){t._debug("on track"),t.emit("track",e.track,n),t._remoteTracks.push({track:e.track,stream:n}),t._remoteStreams.some(function(e){return e.id===n.id})||(t._remoteStreams.push(n),setTimeout(function(){t.emit("stream",n)},0))})},f.prototype._debug=function(){var e=this,t=[].slice.call(arguments);t[0]="["+this._id+"] "+t[0],r.apply(null,t)}}).call(this,n(0).Buffer)},function(e,t,n){var r=n(28),i=function(){},o=function(e){return e.setHeader&&"function"==typeof e.abort},s=function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length},a=function(e,t,n){if("function"==typeof t)return a(e,null,t);t||(t={}),n=r(n||i);var u=e._writableState,l=e._readableState,c=t.readable||!1!==t.readable&&e.readable,f=t.writable||!1!==t.writable&&e.writable,h=function(){e.writable||p()},p=function(){f=!1,c||n.call(e)},d=function(){c=!1,f||n.call(e)},m=function(t){n.call(e,t?new Error("exited with error code: "+t):null)},g=function(t){n.call(e,t)},y=function(){return(!c||l&&l.ended)&&(!f||u&&u.ended)?void 0:n.call(e,new Error("premature close"))},b=function(){e.req.on("finish",p)};return o(e)?(e.on("complete",p),e.on("abort",y),e.req?b():e.on("request",b)):f&&!u&&(e.on("end",h),e.on("close",h)),s(e)&&e.on("exit",m),e.on("end",d),e.on("finish",p),!1!==t.error&&e.on("error",g),e.on("close",y),function(){e.removeListener("complete",p),e.removeListener("abort",y),e.removeListener("request",b),e.req&&e.req.removeListener("finish",p),e.removeListener("end",h),e.removeListener("close",h),e.removeListener("finish",p),e.removeListener("exit",m),e.removeListener("end",d),e.removeListener("error",g),e.removeListener("close",y)}};e.exports=a},function(e,t){var n=function(){};function r(e,t,n){var r=e.length;if(!r)return n(t);function i(){--r||n(t)}e.forEach(function(e){e?e(t,i):i()}),r||i()}e.exports=function(e){return function(t,n){!function i(){t?r(e,t,n):e.length?e[0]?e[0](null,function(t,o){t?(e.shift(),!0===t?i():r(e,t,n)):n(null,o)}):(e.shift(),i()):n(!0)}()}}},function(e,t,n){"use strict";e.exports=function(){var e,t;function n(n){if("function"!=typeof n)throw new Error("read must be function");if(e)throw new Error("already piped");if(e=n,t){var r=t;t=null,e.apply(null,r)}}function r(n,r){e?e(n,r):t=[n,r]}return{source:r,sink:n}}},function(e,t,n){"use strict";t.Listener=t.listener=n(1129),t.Dialer=t.dialer=n(1132),t.matchSemver=n(1133),t.matchExact=n(532)},function(e,t,n){"use strict";(function(r){const i=n(12),o=n(43),s=n(37),a=n(72),u=n(5);function l(){return(~~(1e9*Math.random())).toString(36)}function c(e,t){i(o(r.isBuffer(e)?[e]:[r.from(e)]),a.encode(),s((e,n)=>{if(e)return t(e);t(null,n[0])}))}function f(e){const t=l();function n(e){return n=>{Array.isArray(n)&&(n=n.join(" ")),e("(%s) %s",t,n)}}const r=n(u("mss:"+e));return r.error=n(u("mss:"+e+":error")),r}t=e.exports,t.writeEncoded=((e,t,n)=>{c(t,(t,r)=>{if(t)return n(t);e.write(r)})}),t.log={},t.log.dialer=(()=>f("dialer\t")),t.log.listener=(()=>f("listener\t"))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";t.importer=t.Importer=n(550),t.exporter=t.Exporter=n(123)},function(e,t,n){var r=n(1216);function i(e,t){return(e=e||[]).push(t),e}e.exports=function(e,t,n,o){var s,a,u;function l(i){var c=null,f=!1,h=0;if(u=i,s)return i(!!s.abort||s,function(e){o(e),a&&a()});var p=!1,d=r(function(){p||s||(p=!0,i(null,function(e,r){p=!1,function(e,r){s||(s=e,s?f||o(!0===s?null:s):(c=t(c,r),h=c&&c.length||0,null!=c&&m(),h{let l=a.cidVersion||i,c=a.hashAlg||o,f=a.codec||s;if(t.isBuffer(e)&&(l=1,f="raw"),"sha2-256"!==c&&(l=1),a.onlyHash)return r(e,{version:l,hashAlg:c},(t,n)=>{u(t,{cid:n,node:e})});n.put(e,{version:l,hashAlg:c,format:f},(t,n)=>{u(t,{cid:n,node:e})})};e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(1231),i=n(229),o=n(11),s=n(38),a=n(48),u=s.DAGLink,l=s.DAGNode,c=n(58),f=n(341),h=n(262),p=n(1232),d=n(12),m=n(406),g=n(90),y=n(1235),b=function(e){return new Promise((n,r)=>{c(e,"murmur3-128",(e,i)=>{if(e)r(e);else{const e=i.slice(2,10),r=e.length,o=t.alloc(r);for(let t=0;t{e(t.key,t.value,n)}),m(t))}flush(e,t,n,r){k(this._options,this._bucket,e,t,n,(e,t)=>{if(e)return r(e);this.multihash=t.cid.buffer,this.size=t.node.size,r(null,t)})}}function _(e,t){return new w(e,t)}function k(e,n,s,c,f,p){const d=n._children;let m=0;const g=[];function b(t,n,i){const o=r(n.toString(16).toUpperCase(),2,"0");if(y.isBucket(t))k(e,t,s,c,null,(e,{cid:t,node:n})=>{e?i(e):(g.push(new u(o,n.size,t)),i())});else{const e=t.value,n=o+t.key;g.push(new u(n,e.size,e.multihash)),i()}}function v(r,i){const u=t.from(d.bitField().reverse()),p=new a("hamt-sharded-directory",u);p.fanout=n.tableSize(),p.hashType=e.hashFn.code,o([e=>l.create(p.marshal(),r,e),(t,n)=>h(t,c,e,n),({cid:e,node:t},n)=>{const r={path:s,size:t.size,multihash:e.buffer};f&&f.push(r),n(null,{cid:e,node:t})}],i)}i(()=>m{const t=d.get(m);t?b(t,m,t=>{m++,e(t)}):(m++,e())},e=>{e?p(e):v(g,p)})}e.exports=_,e.exports.hashFn=b}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(e){const r=n(9);function i(e){const t={},n=e.split("-");switch(n.length){case 1:t.avgChunkSize=262144;break;case 2:t.avgChunkSize=o(n[1],"avg");break;case 4:t.minChunkSize=o(n[1],"min"),t.avgChunkSize=o(n[2],"avg"),t.maxChunkSize=o(n[3],"max");break;default:throw new Error('Incorrect chunker format (expected "rabin" "rabin-[avg]" or "rabin-[min]-[avg]-[max]"')}return t}function o(e,t){let n=parseInt(e);if(isNaN(n))throw new Error(`Chunker parameter ${t} must be an integer`);return n}t.normalizePath=(t=>e.isBuffer(t)?new r(t).toString():r.isCID(t)?t.toString():(0===t.indexOf("/ipfs/")&&(t=t.substring("/ipfs/".length)),"/"===t.charAt(t.length-1)&&(t=t.substring(0,t.length-1)),t)),t.parseChunkerString=(e=>{if(e){if(e.startsWith("size-")){const t=e.split("-")[1],n=parseInt(t);if(isNaN(n))throw new Error("Chunker parameter size must be an integer");return{chunker:"fixed",chunkerOptions:{maxChunkSize:n}}}if(e.startsWith("rabin"))return{chunker:"rabin",chunkerOptions:i(e)};throw new Error(`Unrecognized chunker option: ${e}`)}return{chunker:"fixed"}})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(33).Key,i={file:0,directory:1,"hamt-sharded-directory":1};e.exports={FILE_SEPARATOR:"/",MFS_ROOT_KEY:new r("/local/filesroot"),MAX_CHUNK_SIZE:262144,MAX_LINKS:174,FILE_TYPES:i}},function(e,t,n){"use strict";var r=n(1269),i="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-",o,s,a;function u(){a=!1}function l(e){if(e){if(e!==o){if(e.length!==i.length)throw new Error("Custom alphabet for shortid must be "+i.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter(function(e,t,n){return t!==n.lastIndexOf(e)});if(t.length)throw new Error("Custom alphabet for shortid must be "+i.length+" unique characters. These characters were not unique: "+t.join(", "));o=e,u()}}else o!==i&&(o=i,u())}function c(e){return l(e),o}function f(e){r.seed(e),s!==e&&(u(),s=e)}function h(){o||l(i);for(var e=o.split(""),t=[],n=r.nextValue(),s;e.length>0;)n=r.nextValue(),s=Math.floor(n*e.length),t.push(e.splice(s,1)[0]);return t.join("")}function p(){return a||(a=h(),a)}function d(e){var t=p();return t[e]}function m(){return o||i}e.exports={get:m,characters:c,seed:f,lookup:d,shuffled:p}},function(e,t,n){"use strict";const r=n(48).unmarshal,{formatCid:i,toMfsPath:o,loadNode:s}=n(82),a=n(11),u=n(12),l=n(37),c=n(90),f=n(123),h=n(9),p=n(5)("ipfs:mfs:stat"),d={hash:!1,size:!1,withLocal:!1,cidBase:"base58btc"};e.exports=(e=>(function t(n,m,g){"function"==typeof m&&(g=m,m={}),m=Object.assign({},d,m),p(`Fetching stats for ${n}`),a([t=>o(e,n,t),({mfsPath:t,depth:o},a)=>{u(f(t,e.ipld,{maxDepth:o}),c((t,n)=>m.hash?n(null,{hash:i(new h(t.hash),m.cidBase)}):m.size?n(null,{size:t.size}):void s(e,{cid:t.hash},(e,t)=>{if(e)return n(e);const{node:o,cid:s}=t,a=r(o.data);let u=o.links.length;"file"===a.type&&(u=a.blockSizes.length),n(null,{hash:i(s,m.cidBase),size:a.fileSize()||0,cumulativeSize:o.size,blocks:u,type:a.type,local:void 0,sizeLocal:void 0,withLocality:!1})})),l((e,t)=>e?a(e):t.length?(p(`Stats for ${n}`,t[0]),a(null,t[0])):a(new Error(`${n} does not exist`))))}],g)}))},function(e,t,n){"use strict";var r=t;r.base=n(1332),r.short=n(1333),r.mont=n(1334),r.edwards=n(1335)},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=n(1388),o=n(1394),s=n(18),a=n(193),u=n(63),l=n(143),c=n(4).Buffer;Object.assign(t,n(1396)),t.MAX_INTEGER=new u("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new u("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.SHA3_NULL_S=t.KECCAK256_NULL_S,t.KECCAK256_NULL=c.from(t.KECCAK256_NULL_S,"hex"),t.SHA3_NULL=t.KECCAK256_NULL,t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.SHA3_RLP_ARRAY_S=t.KECCAK256_RLP_ARRAY_S,t.KECCAK256_RLP_ARRAY=c.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.SHA3_RLP_ARRAY=t.KECCAK256_RLP_ARRAY,t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.SHA3_RLP_S=t.KECCAK256_RLP_S,t.KECCAK256_RLP=c.from(t.KECCAK256_RLP_S,"hex"),t.SHA3_RLP=t.KECCAK256_RLP,t.BN=u,t.rlp=a,t.secp256k1=o,t.zeros=function(e){return c.allocUnsafe(e).fill(0)},t.zeroAddress=function(){var e=20,n=t.zeros(20);return t.bufferToHex(n)},t.setLengthLeft=t.setLength=function(e,n,r){var i=t.zeros(n);return e=t.toBuffer(e),r?e.length0&&"0"===n.toString();)e=e.slice(1),n=e[0];return e},t.toBuffer=function(e){if(!c.isBuffer(e))if(Array.isArray(e))e=c.from(e);else if("string"==typeof e)e=t.isHexString(e)?c.from(t.padToEven(t.stripHexPrefix(e)),"hex"):c.from(e);else if("number"==typeof e)e=t.intToBuffer(e);else if(null===e||void 0===e)e=c.allocUnsafe(0);else if(u.isBN(e))e=e.toArrayLike(c);else{if(!e.toArray)throw new Error("invalid type");e=c.from(e.toArray())}return e},t.bufferToInt=function(e){return new u(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return e=t.toBuffer(e),"0x"+e.toString("hex")},t.fromSigned=function(e){return new u(e).fromTwos(256)},t.toUnsigned=function(e){return c.from(e.toTwos(256).toArray())},t.keccak=function(e,n){return e=t.toBuffer(e),n||(n=256),i("keccak"+n).update(e).digest()},t.keccak256=function(e){return t.keccak(e)},t.sha3=t.keccak,t.sha256=function(e){return e=t.toBuffer(e),l("sha256").update(e).digest()},t.ripemd160=function(e,n){e=t.toBuffer(e);var r=l("rmd160").update(e).digest();return!0===n?t.setLength(r,32):r},t.rlphash=function(e){return t.keccak(a.encode(e))},t.isValidPrivate=function(e){return o.privateKeyVerify(e)},t.isValidPublic=function(e,t){return 64===e.length?o.publicKeyVerify(c.concat([c.from([4]),e])):!!t&&o.publicKeyVerify(e)},t.pubToAddress=t.publicToAddress=function(e,n){return e=t.toBuffer(e),n&&64!==e.length&&(e=o.publicKeyConvert(e,!1).slice(1)),s(64===e.length),t.keccak(e).slice(-20)};var f=t.privateToPublic=function(e){return e=t.toBuffer(e),o.publicKeyCreate(e,!1).slice(1)};t.importPublic=function(e){return e=t.toBuffer(e),64!==e.length&&(e=o.publicKeyConvert(e,!1).slice(1)),e},t.ecsign=function(e,t){var n=o.sign(e,t),r={};return r.r=n.signature.slice(0,32),r.s=n.signature.slice(32,64),r.v=n.recovery+27,r},t.hashPersonalMessage=function(e){var n=t.toBuffer("Ethereum Signed Message:\n"+e.length.toString());return t.keccak(c.concat([n,e]))},t.ecrecover=function(e,n,r,i){var s=c.concat([t.setLength(r,32),t.setLength(i,32)],64),a=n-27;if(0!==a&&1!==a)throw new Error("Invalid signature v value");var u=o.recover(e,s,a);return o.publicKeyConvert(u,!1).slice(1)},t.toRpcSig=function(e,n,r){if(27!==e&&28!==e)throw new Error("Invalid recovery id");return t.bufferToHex(c.concat([t.setLengthLeft(n,32),t.setLengthLeft(r,32),t.toBuffer(e-27)]))},t.fromRpcSig=function(e){if(e=t.toBuffer(e),65!==e.length)throw new Error("Invalid signature length");var n=e[64];return n<27&&(n+=27),{v:n,r:e.slice(0,32),s:e.slice(32,64)}},t.privateToAddress=function(e){return t.publicToAddress(f(e))},t.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/.test(e)},t.isZeroAddress=function(e){var n=t.zeroAddress();return n===t.addHexPrefix(e)},t.toChecksumAddress=function(e){e=t.stripHexPrefix(e).toLowerCase();for(var n=t.keccak(e).toString("hex"),r="0x",i=0;i=8?r+=e[i].toUpperCase():r+=e[i];return r},t.isValidChecksumAddress=function(e){return t.isValidAddress(e)&&t.toChecksumAddress(e)===e},t.generateAddress=function(e,n){return e=t.toBuffer(e),n=new u(n),n=n.isZero()?null:c.from(n.toArray()),t.rlphash([e,n]).slice(-20)},t.isPrecompiled=function(e){var n=t.unpad(e);return 1===n.length&&n[0]>=1&&n[0]<=8},t.addHexPrefix=function(e){return"string"!=typeof e?e:t.isHexPrefixed(e)?e:"0x"+e},t.isValidSignature=function(e,t,n,r){var i=new u("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),o=new u("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);return 32===t.length&&32===n.length&&((27===e||28===e)&&(t=new u(t),n=new u(n),!(t.isZero()||t.gt(o)||n.isZero()||n.gt(o))&&(!1!==r||1!==new u(n).cmp(i))))},t.baToJSON=function(e){if(c.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var n=[],r=0;r=i.length,"The field "+n.name+" must not have more "+n.length+" bytes")):n.allowZero&&0===i.length||!n.length||s(n.length===i.length,"The field "+n.name+" must have byte length of "+n.length),e.raw[r]=i}e._fields.push(n.name),Object.defineProperty(e,n.name,{enumerable:!0,configurable:!0,get:i,set:o}),n.default&&(e[n.name]=n.default),n.alias&&Object.defineProperty(e,n.alias,{enumerable:!1,configurable:!0,set:o,get:i})}),i)if("string"==typeof i&&(i=c.from(t.stripHexPrefix(i),"hex")),c.isBuffer(i)&&(i=a.decode(i)),Array.isArray(i)){if(i.length>e._fields.length)throw new Error("wrong number of fields in data");i.forEach(function(n,r){e[e._fields[r]]=t.toBuffer(n)})}else{if("object"!==(void 0===i?"undefined":r(i)))throw new Error("invalid data");var o=Object.keys(i);n.forEach(function(t){-1!==o.indexOf(t.name)&&(e[t.name]=i[t.name]),-1!==o.indexOf(t.alias)&&(e[t.alias]=i[t.alias])})}}},function(e,t,n){"use strict";const r=n(271).SmartBuffer,i=n(403),o=n(1426),s=n(35),a=n(9);t=e.exports,t.SHA1_LENGTH=i.defaultLengths[i.names.sha1],t.find=((e,t)=>{for(let n=0;n{let t=e.match(/^(([^<]+)\s)?\s?<([^>]+)>\s?(\d+\s[+\-\d]+)?$/);return null===t?null:{name:t[2],email:t[3],date:t[4]}}),t.serializePersonLine=(e=>{let t=[];return e.name&&t.push(e.name),t.push("<"+e.email+">"),e.date&&t.push(e.date),t.join(" ")}),t.shaToCid=(e=>{let n=new r;return n.writeUInt8(1),n.writeBuffer(o["git-raw"]),n.writeUInt8(i.names.sha1),n.writeUInt8(t.SHA1_LENGTH),n.writeBuffer(e),n.toBuffer()}),t.cidToSha=(e=>{let t=s.decode(new a(e).multihash);return"sha1"!==t.name?null:t.digest})},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const r=n(1425),i=4096,o="utf8";class s{constructor(t){if(this.length=0,this._encoding=o,this._writeOffset=0,this._readOffset=0,s.isSmartBufferOptions(t))if(t.encoding&&(r.checkEncoding(t.encoding),this._encoding=t.encoding),t.size){if(!(r.isFiniteInteger(t.size)&&t.size>0))throw new Error(r.ERRORS.INVALID_SMARTBUFFER_SIZE);this._buff=e.allocUnsafe(t.size)}else if(t.buff){if(!(t.buff instanceof e))throw new Error(r.ERRORS.INVALID_SMARTBUFFER_BUFFER);this._buff=t.buff,this.length=t.buff.length}else this._buff=e.allocUnsafe(i);else{if(void 0!==t)throw new Error(r.ERRORS.INVALID_SMARTBUFFER_OBJECT);this._buff=e.allocUnsafe(i)}}static fromSize(e,t){return new this({size:e,encoding:t})}static fromBuffer(e,t){return new this({buff:e,encoding:t})}static fromOptions(e){return new this(e)}static isSmartBufferOptions(e){const t=e;return t&&(void 0!==t.encoding||void 0!==t.size||void 0!==t.buff)}readInt8(t){return this._readNumberValue(e.prototype.readInt8,1,t)}readInt16BE(t){return this._readNumberValue(e.prototype.readInt16BE,2,t)}readInt16LE(t){return this._readNumberValue(e.prototype.readInt16LE,2,t)}readInt32BE(t){return this._readNumberValue(e.prototype.readInt32BE,4,t)}readInt32LE(t){return this._readNumberValue(e.prototype.readInt32LE,4,t)}writeInt8(t,n){return this._writeNumberValue(e.prototype.writeInt8,1,t,n),this}insertInt8(t,n){return this._insertNumberValue(e.prototype.writeInt8,1,t,n)}writeInt16BE(t,n){return this._writeNumberValue(e.prototype.writeInt16BE,2,t,n)}insertInt16BE(t,n){return this._insertNumberValue(e.prototype.writeInt16BE,2,t,n)}writeInt16LE(t,n){return this._writeNumberValue(e.prototype.writeInt16LE,2,t,n)}insertInt16LE(t,n){return this._insertNumberValue(e.prototype.writeInt16LE,2,t,n)}writeInt32BE(t,n){return this._writeNumberValue(e.prototype.writeInt32BE,4,t,n)}insertInt32BE(t,n){return this._insertNumberValue(e.prototype.writeInt32BE,4,t,n)}writeInt32LE(t,n){return this._writeNumberValue(e.prototype.writeInt32LE,4,t,n)}insertInt32LE(t,n){return this._insertNumberValue(e.prototype.writeInt32LE,4,t,n)}readUInt8(t){return this._readNumberValue(e.prototype.readUInt8,1,t)}readUInt16BE(t){return this._readNumberValue(e.prototype.readUInt16BE,2,t)}readUInt16LE(t){return this._readNumberValue(e.prototype.readUInt16LE,2,t)}readUInt32BE(t){return this._readNumberValue(e.prototype.readUInt32BE,4,t)}readUInt32LE(t){return this._readNumberValue(e.prototype.readUInt32LE,4,t)}writeUInt8(t,n){return this._writeNumberValue(e.prototype.writeUInt8,1,t,n)}insertUInt8(t,n){return this._insertNumberValue(e.prototype.writeUInt8,1,t,n)}writeUInt16BE(t,n){return this._writeNumberValue(e.prototype.writeUInt16BE,2,t,n)}insertUInt16BE(t,n){return this._insertNumberValue(e.prototype.writeUInt16BE,2,t,n)}writeUInt16LE(t,n){return this._writeNumberValue(e.prototype.writeUInt16LE,2,t,n)}insertUInt16LE(t,n){return this._insertNumberValue(e.prototype.writeUInt16LE,2,t,n)}writeUInt32BE(t,n){return this._writeNumberValue(e.prototype.writeUInt32BE,4,t,n)}insertUInt32BE(t,n){return this._insertNumberValue(e.prototype.writeUInt32BE,4,t,n)}writeUInt32LE(t,n){return this._writeNumberValue(e.prototype.writeUInt32LE,4,t,n)}insertUInt32LE(t,n){return this._insertNumberValue(e.prototype.writeUInt32LE,4,t,n)}readFloatBE(t){return this._readNumberValue(e.prototype.readFloatBE,4,t)}readFloatLE(t){return this._readNumberValue(e.prototype.readFloatLE,4,t)}writeFloatBE(t,n){return this._writeNumberValue(e.prototype.writeFloatBE,4,t,n)}insertFloatBE(t,n){return this._insertNumberValue(e.prototype.writeFloatBE,4,t,n)}writeFloatLE(t,n){return this._writeNumberValue(e.prototype.writeFloatLE,4,t,n)}insertFloatLE(t,n){return this._insertNumberValue(e.prototype.writeFloatLE,4,t,n)}readDoubleBE(t){return this._readNumberValue(e.prototype.readDoubleBE,8,t)}readDoubleLE(t){return this._readNumberValue(e.prototype.readDoubleLE,8,t)}writeDoubleBE(t,n){return this._writeNumberValue(e.prototype.writeDoubleBE,8,t,n)}insertDoubleBE(t,n){return this._insertNumberValue(e.prototype.writeDoubleBE,8,t,n)}writeDoubleLE(t,n){return this._writeNumberValue(e.prototype.writeDoubleLE,8,t,n)}insertDoubleLE(t,n){return this._insertNumberValue(e.prototype.writeDoubleLE,8,t,n)}readString(e,t){let n;"number"==typeof e?(r.checkLengthValue(e),n=Math.min(e,this.length-this._readOffset)):(t=e,n=this.length-this._readOffset),void 0!==t&&r.checkEncoding(t);const i=this._buff.slice(this._readOffset,this._readOffset+n).toString(t||this._encoding);return this._readOffset+=n,i}insertString(e,t,n){return r.checkOffsetValue(t),this._handleString(e,!0,t,n)}writeString(e,t,n){return this._handleString(e,!1,t,n)}readStringNT(e){void 0!==e&&r.checkEncoding(e);let t=this.length;for(let e=this._readOffset;ethis.length)throw new Error(r.ERRORS.INVALID_READ_BEYOND_BOUNDS)}ensureInsertable(e,t){r.checkOffsetValue(t),this._ensureCapacity(this.length+e),tthis.length?this.length=t+e:this.length+=e}_ensureWriteable(e,t){const n="number"==typeof t?t:this._writeOffset;this._ensureCapacity(n+e),n+e>this.length&&(this.length=n+e)}_ensureCapacity(t){const n=this._buff.length;if(t>n){let r=this._buff,i=3*n/2+1;i"},e.exports=p}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(599),o=n(0),s="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),a=function e(n){if(!(this instanceof e))return new e(n);if(t.isBuffer(n)){var r=n;this.fromBuffer(r)}else if("string"==typeof n){var i=n;this.fromString(i)}else n&&this.set(n)};a.validCharacters=function e(t){return o.Buffer.isBuffer(t)&&(t=t.toString()),r.all(r.map(t,function(e){return r.contains(s,e)}))},a.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},a.encode=function(e){if(!o.Buffer.isBuffer(e))throw new Error("Input should be a buffer");return i.encode(e)},a.decode=function(e){if("string"!=typeof e)throw new Error("Input should be a string");return new t(i.decode(e))},a.prototype.fromBuffer=function(e){return this.buf=e,this},a.prototype.fromString=function(e){var t=a.decode(e);return this.buf=t,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){e.exports=n(359),e.exports.Input=n(360),e.exports.Output=n(111),e.exports.UnspentOutput=n(601),e.exports.Signature=n(199),e.exports.Sighash=n(110)},function(e,t,n){"use strict";(function(t,r){function i(){}i.getRandomBuffer=function(e){return t.browser?i.getRandomBufferBrowser(e):i.getRandomBufferNode(e)},i.getRandomBufferNode=function(e){var t=n(15);return t.randomBytes(e)},i.getRandomBufferBrowser=function(e){if(!window.crypto&&!window.msCrypto)throw new Error("window.crypto not available");if(window.crypto&&window.crypto.getRandomValues)var t=window.crypto;else{if(!window.msCrypto||!window.msCrypto.getRandomValues)throw new Error("window.crypto.getRandomValues not available");var t=window.msCrypto}var n=new Uint8Array(e);t.getRandomValues(n);var i=new r(n);return i},i.getPseudoRandomBuffer=function(e){for(var t=4294967296,n=new r(e),i,o=0;o<=e;o++){var s=Math.floor(o/4),a=o-4*s;0===a?(i=Math.random()*t,n[o]=255&i):n[o]=255&(i>>>=8)}return n},e.exports=i}).call(this,n(2),n(0).Buffer)},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(49),o=n(30),s=n(109),a=n(80),u=n(60),l=n(41),c=n(25),f=537133055,h=function e(t){if(!(this instanceof e))return new e(t);var n=e._from(t);return this.version=n.version,this.prevHash=n.prevHash,this.merkleRoot=n.merkleRoot,this.reserved=n.reserved,this.time=n.time,this.timestamp=n.time,this.bits=n.bits,this.nonce=n.nonce,this.solution=n.solution,n.hash&&c.checkState(this.hash===n.hash,"Argument object hash property does not match block hash."),this};h._from=function e(t){var n={};if(o.isBuffer(t))n=h._fromBufferReader(s(t));else{if(!r.isObject(t))throw new TypeError("Unrecognized argument for BlockHeader");n=h._fromObject(t)}return n},h._fromObject=function e(n){c.checkArgument(n,"data is required");var i=n.prevHash,s=n.merkleRoot,a=n.reserved,u=n.nonce,l=n.solution;r.isString(n.prevHash)&&(i=o.reverse(new t(n.prevHash,"hex"))),r.isString(n.merkleRoot)&&(s=o.reverse(new t(n.merkleRoot,"hex"))),r.isString(n.reserved)&&(a=o.reverse(new t(n.reserved,"hex"))),r.isString(n.nonce)&&(u=o.reverse(new t(n.nonce,"hex"))),r.isString(n.solution)&&(l=new t(n.solution,"hex"));var f={hash:n.hash,version:n.version,prevHash:i,merkleRoot:s,reserved:a,time:n.time,timestamp:n.time,bits:n.bits,nonce:u,solution:l};return f},h.fromObject=function e(t){var n=h._fromObject(t);return new h(n)},h.fromRawBlock=function e(n){o.isBuffer(n)||(n=new t(n,"binary"));var r=s(n);r.pos=h.Constants.START_OF_HEADER;var i=h._fromBufferReader(r);return new h(i)},h.fromBuffer=function e(t){var n=h._fromBufferReader(s(t));return new h(n)},h.fromString=function e(n){var r=new t(n,"hex");return h.fromBuffer(r)},h._fromBufferReader=function e(t){var n={};n.version=t.readUInt32LE(),n.prevHash=t.read(32),n.merkleRoot=t.read(32),n.reserved=t.read(32),n.time=t.readUInt32LE(),n.bits=t.readUInt32LE(),n.nonce=t.read(32);var r=t.readVarintNum();return n.solution=t.read(r),n},h.fromBufferReader=function e(t){var n=h._fromBufferReader(t);return new h(n)},h.prototype.toObject=h.prototype.toJSON=function e(){return{hash:this.hash,version:this.version,prevHash:o.reverse(this.prevHash).toString("hex"),merkleRoot:o.reverse(this.merkleRoot).toString("hex"),reserved:o.reverse(this.reserved).toString("hex"),time:this.time,bits:this.bits,nonce:o.reverse(this.nonce).toString("hex"),solution:this.solution.toString("hex")}},h.prototype.toBuffer=function e(){return this.toBufferWriter().concat()},h.prototype.toString=function e(){return this.toBuffer().toString("hex")},h.prototype.toBufferWriter=function e(t){return t||(t=new a),t.writeUInt32LE(this.version),t.write(this.prevHash),t.write(this.merkleRoot),t.write(this.reserved),t.writeUInt32LE(this.time),t.writeUInt32LE(this.bits),t.write(this.nonce),t.writeVarintNum(this.solution.length),t.write(this.solution),t},h.prototype.getTargetDifficulty=function e(t){t=t||this.bits;for(var n=new i(16777215&t),r=8*((t>>>24)-3);r-- >0;)n=n.mul(new i(2));return n},h.prototype.getDifficulty=function e(){var t=this.getTargetDifficulty(537133055).mul(new i(Math.pow(10,8))),n=this.getTargetDifficulty(),r=t.div(n).toString(10),o=r.length-8;return r=r.slice(0,o)+"."+r.slice(o),parseFloat(r)},h.prototype._getHash=function e(){var t=this.toBuffer();return u.sha256sha256(t)};var p={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=s(this._getHash()).readReverse().toString("hex")),this._id},set:r.noop};Object.defineProperty(h.prototype,"id",p),Object.defineProperty(h.prototype,"hash",p),h.prototype.validTimestamp=function e(){var t=Math.round((new Date).getTime()/1e3);return!(this.time>t+h.Constants.MAX_TIME_OFFSET)},h.prototype.validProofOfWork=function e(){var t=new i(this.id,"hex"),n=this.getTargetDifficulty();return!(t.cmp(n)>0)},h.prototype.inspect=function e(){return""},h.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new i("10000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=h}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var n=Object.prototype.toString,r="function"==typeof t.alloc&&"function"==typeof t.allocUnsafe&&"function"==typeof t.from;function i(e){return"ArrayBuffer"===n.call(e).slice(8,-1)}function o(e,n,i){n>>>=0;var o=e.byteLength-n;if(o<0)throw new RangeError("'offset' is out of bounds");if(void 0===i)i=o;else if(i>>>=0,i>o)throw new RangeError("'length' is out of bounds");return r?t.from(e.slice(n,n+i)):new t(new Uint8Array(e.slice(n,n+i)))}function s(e,n){if("string"==typeof n&&""!==n||(n="utf8"),!t.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');return r?t.from(e,n):new t(e,n)}function a(e,n,a){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return i(e)?o(e,n,a):"string"==typeof e?s(e,n):r?t.from(e):new t(e)}e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){t=e.exports=n(628),t.Stream=t,t.Readable=t,t.Writable=n(631),t.Duplex=n(157),t.Transform=n(632),t.PassThrough=n(1502)},function(e,t,n){var r=e.exports;r.encode=n(1726),r.decode=n(1727),r.byteLength=r.encodingLength=function(e){return r.encode(e).length}},function(e,t,n){"use strict";function r(e,t){for(var n=1,r=e.length,i=e[0],o=e[0],s=1;s>3;return e%8!=0&&t++,t}r.prototype.get=function(e){var t=e>>3;return t>e%8)},r.prototype.set=function(e,t){var n=e>>3;t||1===arguments.length?(this.buffer.length>e%8):n>e%8))},r.prototype._grow=function(e){if(this.buffer.length4294967295&&(o=1),t.writeUInt32BE(o,n),t.write(e.type,n+4,4,"ascii");var a=n+8;if(1===o&&(r.encode(e.length,t,a),a+=8),s.fullBoxes[i]&&(t.writeUInt32BE(e.flags||0,a),t.writeUInt8(e.version||0,a),a+=4),l[i]){var c=l[i];c.forEach(function(n){if(5===n.length){var r=e[n]||[];n=n.substr(0,4),r.forEach(function(e){u._encode(e,t,a),a+=u.encode.bytes})}else e[n]&&(u._encode(e[n],t,a),a+=u.encode.bytes)}),e.otherBoxes&&e.otherBoxes.forEach(function(e){u._encode(e,t,a),a+=u.encode.bytes})}else if(s[i]){var f=s[i].encode;f(e,t,a),a+=f.bytes}else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+i+"') or `buffer` must be set");var h=e.buffer;h.copy(t,a),a+=e.buffer.length}return u.encode.bytes=a-n,t},u.readHeaders=function(e,t,n){if(t=t||0,n=n||e.length,n-t<8)return 8;var i=e.readUInt32BE(t),o=e.toString("ascii",t+4,t+8),a=t+8,u,l;if(1===i){if(n-t<16)return 16;i=r.decode(e,a),a+=8}return s.fullBoxes[o]&&(u=e.readUInt8(a),l=16777215&e.readUInt32BE(a),a+=4),{length:i,headersLen:a-t,contentLen:i-(a-t),type:o,version:u,flags:l}},u.decode=function(e,t,n){t=t||0,n=n||e.length;var r=u.readHeaders(e,t,n);if(!r||r.length>n-t)throw new Error("Data too short");return u.decodeWithoutHeaders(r,e,t+r.headersLen,t+r.length)},u.decodeWithoutHeaders=function(e,t,n,r){n=n||0,r=r||t.length;var i=e.type,a={};if(l[i]){a.otherBoxes=[];for(var c=l[i],f=n;r-f>=8;){var h=u.decode(t,f,r);if(f+=h.length,c.indexOf(h.type)>=0)a[h.type]=h;else if(c.indexOf(h.type+"s")>=0){var p=h.type+"s",d=a[p]=a[p]||[];d.push(h)}else a.otherBoxes.push(h)}}else if(s[i]){var m=s[i].decode;a=m(t,n,r)}else a.buffer=o(t.slice(n,r));return a.length=e.length,a.contentLen=e.contentLen,a.type=e.type,a.version=e.version,a.flags=e.flags,a},u.encodingLength=function(e){var t=e.type,n=8;if(s.fullBoxes[t]&&(n+=4),l[t]){var r=l[t];r.forEach(function(t){if(5===t.length){var r=e[t]||[];t=t.substr(0,4),r.forEach(function(e){e.type=t,n+=u.encodingLength(e)})}else if(e[t]){var i=e[t];i.type=t,n+=u.encodingLength(i)}}),e.otherBoxes&&e.otherBoxes.forEach(function(e){n+=u.encodingLength(e)})}else if(s[t])n+=s[t].encodingLength(e);else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+t+"') or `buffer` must be set");n+=e.buffer.length}return n>4294967295&&(n+=8),e.length=n,n}},function(e,t,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)i(n,r)&&(e[r]=n[r])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var o={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var o=0;o0;--s){o=o.twice();var a=n.testBit(s),u=t.testBit(s);a!=u&&(o=o.add(a?this:i))}return o}function S(e,t,n){var r;r=e.bitLength()>n.bitLength()?e.bitLength()-1:n.bitLength()-1;for(var i=this.curve.getInfinity(),o=this.add(t);r>=0;)i=i.twice(),e.testBit(r)?i=n.testBit(r)?i.add(o):i.add(this):n.testBit(r)&&(i=i.add(t)),--r;return i}function E(e,t,n){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(n),this.infinity=new d(this,null,null),this.reducer=new i(this.q)}function x(){return this.q}function C(){return this.a}function A(){return this.b}function I(e){return e==this||this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)}function T(){return this.infinity}function j(e){return new o(this.q,e)}function O(e){this.reducer.reduce(e)}function P(e){switch(parseInt(e.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var t=(e.length-2)/2,n=e.substr(2,t),i=e.substr(t+2,t);return new d(this,this.fromBigInteger(new r(n,16)),this.fromBigInteger(new r(i,16)));default:return null}}function B(e){if(e.isInfinity())return"00";var t=e.getX().toBigInteger().toString(16),n=e.getY().toBigInteger().toString(16),r=this.getQ().toString(16).length;for(r%2!=0&&r++;t.length128){var t=this.q.shiftRight(e-64);-1==t.intValue()&&(this.r=r.ONE.shiftLeft(e).subtract(this.q))}return this.r},o.prototype.modMult=function(e,t){return this.modReduce(e.multiply(t))},o.prototype.modReduce=function(e){if(null!=this.getR()){for(var t=q.bitLength();e.bitLength()>t+1;){var n=e.shiftRight(t),i=e.subtract(n.shiftLeft(t));this.getR().equals(r.ONE)||(n=n.multiply(this.getR())),e=n.add(i)}for(;e.compareTo(q)>=0;)e=e.subtract(q)}else e=e.mod(q);return e},o.prototype.sqrt=function(){if(!this.q.testBit(0))throw"unsupported";if(this.q.testBit(1)){var e=new o(this.q,this.x.modPow(this.q.shiftRight(2).add(r.ONE),this.q));return e.square().equals(this)?e:null}var t=this.q.subtract(r.ONE),n=t.shiftRight(1);if(!this.x.modPow(n,this.q).equals(r.ONE))return null;var i=t.shiftRight(2),s=i.shiftLeft(1).add(r.ONE),a=this.x,u=modDouble(modDouble(a)),l,c;do{var f;do{f=new r(this.q.bitLength(),new SecureRandom)}while(f.compareTo(this.q)>=0||!f.multiply(f).subtract(u).modPow(n,this.q).equals(t));var h=this.lucasSequence(f,a,s);if(l=h[0],c=h[1],this.modMult(c,c).equals(u))return c.testBit(0)&&(c=c.add(q)),c=c.shiftRight(1),new o(q,c)}while(l.equals(r.ONE)||l.equals(t));return null},o.prototype.lucasSequence=function(e,t,n){for(var i=n.bitLength(),o=n.getLowestSetBit(),s=r.ONE,a=r.TWO,u=e,l=r.ONE,c=r.ONE,f=i-1;f>=o+1;--f)l=this.modMult(l,c),n.testBit(f)?(c=this.modMult(l,t),s=this.modMult(s,u),a=this.modReduce(u.multiply(a).subtract(e.multiply(l))),u=this.modReduce(u.multiply(u).subtract(c.shiftLeft(1)))):(c=l,s=this.modReduce(s.multiply(a).subtract(l)),u=this.modReduce(u.multiply(a).subtract(e.multiply(l))),a=this.modReduce(a.multiply(a).subtract(l.shiftLeft(1))));l=this.modMult(l,c),c=this.modMult(l,t),s=this.modReduce(s.multiply(a).subtract(l)),a=this.modReduce(u.multiply(a).subtract(e.multiply(l))),l=this.modMult(l,c);for(var f=1;f<=o;++f)s=this.modMult(s,a),a=this.modReduce(a.multiply(a).subtract(l.shiftLeft(1))),l=this.modMult(l,l);return[s,a]};var t={ECCurveFp:E,ECPointFp:d,ECFieldElementFp:o};e.exports=t},function(e,t,n){e.exports={read:g,readSSHPrivate:b,write:v};var r=n(27),i=n(103),o=n(31).Buffer,s=n(55),a=n(47),u=n(15),l=n(46),c=n(50),f=n(113),h=n(114),p=n(210),d=n(97),m;function g(e,t){return f.read(e,t)}var y="openssh-key-v1";function b(e,t,i){t=new p({buffer:t});var s=t.readCString();r.strictEqual(s,y,"bad magic string");var l=t.readString(),c=t.readString(),f=t.readBuffer(),g=t.readInt();if(1!==g)throw new Error("OpenSSH-format key file contains multiple keys: this is unsupported.");var b=t.readBuffer();if("public"===e)return r.ok(t.atEnd(),"excess bytes left after key"),h.read(b);var v=t.readBuffer();r.ok(t.atEnd(),"excess bytes left after key");var w=new p({buffer:f});switch(c){case"none":if("none"!==l)throw new Error('OpenSSH-format key uses KDF "none" but specifies a cipher other than "none"');break;case"bcrypt":var _=w.readBuffer(),k=w.readInt(),S=a.opensshCipherInfo(l);if(void 0===m&&(m=n(714)),"string"==typeof i.passphrase&&(i.passphrase=o.from(i.passphrase,"utf-8")),!o.isBuffer(i.passphrase))throw new d.KeyEncryptedError(i.filename,"OpenSSH");var E=new Uint8Array(i.passphrase),x=new Uint8Array(_),C=new Uint8Array(S.keySize+S.blockSize),A=m.pbkdf(E,E.length,x,x.length,C,C.length,k);if(0!==A)throw new Error("bcrypt_pbkdf function returned failure, parameters invalid");C=o.from(C);var I=C.slice(0,S.keySize),T=C.slice(S.keySize,S.keySize+S.blockSize),j=u.createDecipheriv(S.opensslName,I,T);j.setAutoPadding(!1);var O,P=[];for(j.once("error",function(e){if(-1!==e.toString().indexOf("bad decrypt"))throw new Error("Incorrect passphrase supplied, could not decrypt key");throw e}),j.write(v),j.end();null!==(O=j.read());)P.push(O);v=o.concat(P);break;default:throw new Error('OpenSSH-format key uses unknown KDF "'+c+'"')}t=new p({buffer:v});var B=t.readInt(),R=t.readInt();if(B!==R)throw new Error("Incorrect passphrase supplied, could not decrypt key");var N={},M=h.readInternal(N,"private",t.remainder());t.skip(N.consumed);var L=t.readString();return M.comment=L,M}function v(e,t){var i;i=c.isPrivateKey(e)?e.toPublic():e;var s="none",l="none",f=o.alloc(0),h={blockSize:8},d,g;if(void 0!==t&&(d=t.passphrase,"string"==typeof d&&(d=o.from(d,"utf-8")),void 0!==d&&(r.buffer(d,"options.passphrase"),r.optionalString(t.cipher,"options.cipher"),s=t.cipher,void 0===s&&(s="aes128-ctr"),h=a.opensshCipherInfo(s),l="bcrypt")),c.isPrivateKey(e)){g=new p({});var b=u.randomBytes(4).readUInt32BE(0);g.writeInt(b),g.writeInt(b),g.write(e.toBuffer("rfc4253")),g.writeString(e.comment||"");for(var v=1;g._offset%h.blockSize!=0;)g.writeChar(v++);g=g.toBuffer()}switch(l){case"none":break;case"bcrypt":var w=u.randomBytes(16),_=16,k=new p({});k.writeBuffer(w),k.writeInt(16),f=k.toBuffer(),void 0===m&&(m=n(714));var S=new Uint8Array(d),E=new Uint8Array(w),x=new Uint8Array(h.keySize+h.blockSize),C=m.pbkdf(S,S.length,E,E.length,x,x.length,16);if(0!==C)throw new Error("bcrypt_pbkdf function returned failure, parameters invalid");x=o.from(x);var A=x.slice(0,h.keySize),I=x.slice(h.keySize,h.keySize+h.blockSize),T=u.createCipheriv(h.opensslName,A,I);T.setAutoPadding(!1);var j,O=[];for(T.once("error",function(e){throw e}),T.write(g),T.end();null!==(j=T.read());)O.push(j);g=o.concat(O);break;default:throw new Error("Unsupported kdf "+l)}var P=new p({}),B;P.writeCString(y),P.writeString(s),P.writeString(l),P.writeBuffer(f),P.writeInt(1),P.writeBuffer(i.toBuffer("rfc4253")),g&&P.writeBuffer(g),P=P.toBuffer(),B=c.isPrivateKey(e)?"OPENSSH PRIVATE KEY":"OPENSSH PUBLIC KEY";var R=P.toString("base64"),N=R.length+R.length/70+18+16+2*B.length+10;P=o.alloc(N);var M=0;M+=P.write("-----BEGIN "+B+"-----\n",M);for(var L=0;LR.length&&(F=R.length),M+=P.write(R.slice(L,F),M),P[M++]=10,L=F}return M+=P.write("-----END "+B+"-----\n",M),P.slice(0,M)}},function(e,t,n){e.exports={DataError:n(1966),InvalidAccessError:n(1967),KeyFormatNotSupportedError:n(1968),CurrentlyNotSupportedError:n(1969),NotSupportedError:n(386),OperationError:n(1970),QuotaExceededError:n(1971),TypeMismatchError:n(1972)}},function(e,t,n){(function(r){const i=n(743),o=n(98),s=n(5)("dweb-transports:httptools"),a=n(171);let u;function l({concurrency:e}){u=a((e,t)=>{e.loopguard===("undefined"!=typeof window&&window.loopguard)?fetch(e.req).then(n=>{s("Fetch of %s succeded",e.what),u.concurrency=Math.min(u.concurrency+1,u.running()+6),s("Raising concurrency to %s",u.concurrency),t(null),e.cb(null,n)}).catch(n=>{u.concurrency=Math.max(u.concurrency-1,6,u.running()-1),s("Dropping concurrency to %s",u.concurrency),t(n),--e.count>0?(s("Retrying fetch of %s in %s ms: %s",e.what,e.ms,n.message),u.push(e)):(s("Requeued fetch of %s failed: %s",e.what,n.message),e.cb(n))}):s("Dropping fetch of %s as window changed from %s to %s",e.what,e.loopguard,window.loopguard)},e)}function c(e,t,n,r){return new Promise((i,o)=>{n=n||1,u.push({req:e,count:n,ms:t,what:r,loopguard:"undefined"!=typeof window&&window.loopguard,cb:(e,t)=>{e?o(e):i(t)}})})}async function f(e,t,n,r){let i,o="undefined"!=typeof window&&window.loopguard;for(n=n||1;n--&&o===("undefined"!=typeof window&&window.loopguard);)try{return await fetch(e)}catch(e){i=e,s("Delaying %s by %d ms because %s",r,t,e.message),await new Promise(e=>{setTimeout(()=>{e()},t)}),t=Math.floor(t*(1+Math.random()))}throw console.warn("loopfetch of",r,"failed"),o!==("undefined"!=typeof window&&window.loopguard)?(s("Looping exited because of page change %s",r),new Error("Looping exited because of page change "+r)):i}"undefined"==typeof fetch&&(fetch=i,Headers=fetch.Headers,Request=fetch.Request),httptools={},l({concurrency:6}),httptools.p_httpfetch=async function(e,t,{wantstream:n=!1,retries:i}={}){try{s("p_httpfetch: %s %o",e,t.headers.range||"");let a=new Request(e,t),u=await c(a,500,i,"fetching "+e);if(u.ok){let e=u.headers.get("Content-Type");return n?u.body:void 0!==e&&e.startsWith("application/json")?u.json():void 0!==e&&e.startsWith("text")?u.text():new r(await u.arrayBuffer())}throw new o.TransportError(`Transport Error ${e} ${u.status}: ${u.statusText}`)}catch(t){throw s("p_httpfetch failed: %s",t.message),t instanceof o.TransportError?t:new o.TransportError(`Transport error thrown by ${e}: ${t.message}`)}},httptools.p_GET=function(e,t={},n){"function"==typeof t&&(n=t,t={});let r=new Headers;(t.start||t.end)&&r.append("range",`bytes=${t.start||0}-${t.end<1/0?t.end:""}`);const i=void 0===t.retries?12:t.retries;let o={method:"GET",headers:r,mode:"cors",cache:t.noCache?"no-cache":"default",redirect:"follow",keepalive:!0};const a=httptools.p_httpfetch(e,o,{retries:i,wantstream:t.wantstream});if(!n)return a;a.then(e=>{try{n(null,e)}catch(e){s("Uncaught error %O",e)}}).catch(e=>n(e))},httptools.p_POST=function(e,t={},n){"function"==typeof t&&(n=t,t={});const r=void 0===t.retries?0:t.retries;let i={method:"POST",headers:{},body:t.data,mode:"cors",cache:"default",redirect:"follow",keepalive:!1};t.contenttype&&(i.headers["Content-Type"]=t.contenttype);const o=httptools.p_httpfetch(e,i,{retries:r});if(!n)return o;o.then(e=>n(null,e)).catch(e=>n(e))},t=e.exports=httptools}).call(this,n(0).Buffer)},function(e,t){var n=9007199254740991;function r(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}e.exports=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={},e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var r=n(68),i=p(r),o=n(219),s=p(o),a=n(752),u=p(a),l=n(131),c=p(l),f=n(291),h=p(f);function p(e){return e&&e.__esModule?e:{default:e}}function d(e){return function(t,n,r){if(r=(0,s.default)(r||i.default),e<=0||!t)return r(null);var o=(0,u.default)(t),a=!1,l=0,f=!1;function p(e,t){if(l-=1,e)a=!0,r(e);else{if(t===h.default||a&&l<=0)return a=!0,r(null);f||d()}}function d(){for(f=!0;l{let n;if(r.isBuffer(e))n=a.varintBufferEncode(e);else{if(!o[e])throw new Error("multicodec not recognized");n=o[e]}return r.concat([n,t])}),t.rmPrefix=(e=>(i.decode(e),e.slice(i.decode.bytes))),t.getCodec=(e=>{const t=a.varintBufferDecode(e),n=s[t.toString("hex")];if(void 0===n)throw new Error("Code `0x"+t.toString("hex")+"` not found");return n}),t.getName=(e=>s[e.toString(16)]),t.getNumber=(e=>{const t=o[e];if(void 0===t)throw new Error("Codec `"+e+"` not found");return a.varintBufferDecode(t)[0]}),t.getCode=(e=>i.decode(e)),t.getCodeVarint=(e=>{const t=o[e];if(void 0===t)throw new Error("Codec `"+e+"` not found");return t}),t.getVarint=(e=>i.encode(e));const u=n(789);Object.assign(t,u),t.print=n(790)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=function e(t,n){n=n||{};var r=n.last||!1,i=!1;if("number"==typeof t){r=!0;var o=t;t=function(){return--o}}return function(e){function n(t){e(!0,function(e){r=!1,t(e||!0)})}return function(o,s){i&&!o?r?n(s):s(i):(i=o)?e(i,s):e(null,function(e,o){(i=i||e)?s(i):t(o)?s(null,o):(i=!0,r?s(null,o):n(s))})}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(390),i=a(r),o=n(220),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default,1),e.exports=t.default},function(e,t,n){"use strict";const r=n(26),i=n(226),o=n(61),s=n(227),a=n(139);t.asyncFilter=function(e){let t=!1,n,r;return function(i){return function o(s,a){if(r)return a(r);s?(r=s,i(s,t?()=>{t?n=a:a(s)}:a)):i(null,(i,s)=>{i?a(i):r?a(r):(t=!0,e(s,(e,i)=>{t=!1,r?(a(r),n(r)):e?o(e,a):i?a(null,s):o(null,a)}))})}}},t.asyncSort=function(e){const t=i(),n=r.collect((n,i)=>{if(n)return t.abort(n);e(i,(e,n)=>{if(e)return t.abort(e);t.resolve(r.values(i))})});return function(e){return n(e),t}},t.replaceStartWith=function(e,t){const n=new RegExp("^"+t);return e.replace(n,"")},t.tmpdir=(()=>o.join(s.tmpdir(),a()))},function(e,t){function n(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n-1?setImmediate:i.nextTick,u;w.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(52)},f=n(432),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(433),y;function b(){}function v(e,t){u=u||n(116),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function w(e){if(u=u||n(116),!(y.call(w,this)||this instanceof u))return new w(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function _(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},w.prototype._writev=null,w.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=g.destroy,w.prototype._undestroy=g.undestroy,w.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";t.util=n(440),t.resolver=n(453)},function(e,t,n){"use strict";(function(e){const r=n(62),i=n(232),o=i.SHIFT32,s=i.SHIFT16,a=2097151;function u(e){return e<16?"0"+e.toString(16):e.toString(16)}t.parseHalf=function e(t){var n,r,i;return i=128&t[0]?-1:1,n=(124&t[0])>>2,r=(3&t[0])<<8|t[1],n?31===n?i*(r?NaN:Infinity):i*Math.pow(2,n-25)*(1024+r):5.960464477539063e-8*i*r},t.arrayBufferToBignumber=function(e){const t=e.byteLength;let n="";for(let r=0;r{const t=new Map,n=Object.keys(e),r=n.length;for(let i=0;ie*s+t),t.buildInt64=((e,n,i,s)=>{const a=t.buildInt32(e,n),u=t.buildInt32(i,s);return a>2097151?new r(a).times(o).plus(u):a*o+u}),t.writeHalf=function t(n,r){const i=e.allocUnsafe(4);i.writeFloatBE(r,0);const o=i.readUInt32BE(0);if(0!=(8191&o))return!1;var s=o>>16&32768;const a=o>>23&255,u=8388607&o;if(a>=113&&a<=142)s+=(a-112<<10)+(u>>13);else{if(!(a>=103&&a<113))return!1;if(u&(1<<126-a)-1)return!1;s+=u+8388608>>126-a}return n.writeUInt16BE(s,0),!0},t.keySorter=function(e,t){var n=e[0].byteLength,r=t[0].byteLength;return n>r?1:r>n?-1:e[0].compare(t[0])},t.isNegativeZero=(e=>0===e&&1/e<0),t.nextPowerOf2=(e=>{let t=0;if(e&&!(e&e-1))return e;for(;0!==e;)e>>=1,t+=1;return 1<=0||!o.gcd(t.n).equals(i.ONE));e=e.multiply(o.modPow(t.e,t.n)).mod(t.n);for(var s=e.mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(a)<0;)s=s.add(t.p);var u=s.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return u=u.multiply(o.modInverse(t.n)).mod(t.n),u};function d(e,t,n){var i=r.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=o-11,s}i.putByte(0),i.putByte(n);var a=o-3-e.length,u;if(0===n||1===n){u=0===n?0:255;for(var l=0;l0;){for(var c=0,f=r.random.getBytes(a),l=0;l1;){if(255!==s.getByte()){--s.read;break}++l}else if(2===u)for(l=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++l}var f=s.getByte();if(0!==f||l!==o-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function g(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};var o={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function a(){u(e.pBits,function(t,r){return t?n(t):(e.p=r,null!==e.q?l(t,e.q):void u(e.qBits,l))})}function u(e,t){r.prime.generateProbablePrime(e,o,t)}function l(t,r){if(t)return n(t);if(e.q=r,e.p.compareTo(e.q)<0){var o=e.p;e.p=e.q,e.q=o}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void a();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void u(e.qBits,l);if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE))return e.p=e.q=null,void a();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void u(e.qBits,l);var c=e.e.modInverse(e.phi);e.keys={privateKey:s.rsa.setPrivateKey(e.n,e.e,c,e.p,e.q,c.mod(e.p1),c.mod(e.q1),e.q.modInverse(e.p)),publicKey:s.rsa.setPublicKey(e.n,e.e)},n(null,e.keys)}"prng"in t&&(o.prng=t.prng),a()}function y(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var n=r.util.hexToBytes(t);return n.length>1&&(0===n.charCodeAt(0)&&0==(128&n.charCodeAt(1))||255===n.charCodeAt(0)&&128==(128&n.charCodeAt(1)))?n.substr(1):n}function b(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function v(e){return"undefined"!=typeof window&&"object"==typeof window.crypto&&"object"==typeof window.crypto.subtle&&"function"==typeof window.crypto.subtle[e]}function w(e){return"undefined"!=typeof window&&"object"==typeof window.msCrypto&&"object"==typeof window.msCrypto.subtle&&"function"==typeof window.msCrypto.subtle[e]}function _(e){for(var t=r.util.hexToBytes(e.toString(16)),n=new Uint8Array(t.length),i=0;i0;)f.putByte(0),--h;return f.putBytes(r.util.hexToBytes(c)),f.getBytes()},s.rsa.decrypt=function(e,t,n,o){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=s,a}var u=new i(r.util.createBuffer(e).toHex(),16);if(u.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var l=p(u,t,n),c=l.toString(16),f=r.util.createBuffer(),h=s-Math.ceil(c.length/2);h>0;)f.putByte(0),--h;return f.putBytes(r.util.hexToBytes(c)),!1!==o?m(f.getBytes(),t,n):f.getBytes()},s.rsa.createKeyPairGenerationState=function(e,t,n){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048,n=n||{};var o=n.prng||r.random,s={nextBytes:function(e){for(var t=o.getBytesSync(e.length),n=0;n>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},u.e.fromInt(u.eInt),u},s.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var n=new i(null);n.fromInt(30);for(var r=0,o=function(e,t){return e|t},u=+new Date,l,c=0;null===e.keys&&(t<=0||cf?e.pqState=0:e.num.isProbablePrime(b(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(a[r++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var p=e.e.modInverse(e.phi);e.keys={privateKey:s.rsa.setPrivateKey(e.n,e.e,p,e.p,e.q,p.mod(e.p1),p.mod(e.q1),e.q.modInverse(e.p)),publicKey:s.rsa.setPublicKey(e.n,e.e)}}l=+new Date,c+=l-u,u=l}return null!==e.keys},s.rsa.generateKeyPair=function(e,t,n,i){if(1===arguments.length?"object"==typeof e?(n=e,e=void 0):"function"==typeof e&&(i=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(i=t,t=void 0):"number"!=typeof t&&(n=t,t=void 0):(n=e,i=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof n&&(i=n,n=void 0):(i=n,n=t,t=void 0)),n=n||{},void 0===e&&(e=n.bits||2048),void 0===t&&(t=n.e||65537),!r.options.usePureJavaScript&&i&&e>=256&&e<=16384&&(65537===t||3===t)){if(v("generateKey")&&v("exportKey"))return window.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:_(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return window.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){i(e)}).then(function(e){if(e){var t=s.privateKeyFromAsn1(o.fromDer(r.util.createBuffer(e)));i(null,{privateKey:t,publicKey:s.setRsaPublicKey(t.n,t.e)})}});if(w("generateKey")&&w("exportKey")){var a=window.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:_(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return a.oncomplete=function(e){var t=e.target.result,n=window.msCrypto.subtle.exportKey("pkcs8",t.privateKey);n.oncomplete=function(e){var t=e.target.result,n=s.privateKeyFromAsn1(o.fromDer(r.util.createBuffer(t)));i(null,{privateKey:n,publicKey:s.setRsaPublicKey(n.n,n.e)})},n.onerror=function(e){i(e)}},void(a.onerror=function(e){i(e)})}}var u=s.rsa.createKeyPairGenerationState(e,t,n);if(!i)return s.rsa.stepKeyPairGenerationState(u,0),u.keys;g(u,n,i)},s.setRsaPublicKey=s.rsa.setPublicKey=function(e,t){var n={n:e,e:t,encrypt:function(e,t,i){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,n){return d(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return r.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var o=t.encode(e,n,!0);return s.rsa.encrypt(o,n,!0)},verify:function(e,t,r){"string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===r?r={verify:function(e,t){t=m(t,n,!0);var r=o.fromDer(t);return e===r.value[1].value}}:"NONE"!==r&&"NULL"!==r&&null!==r||(r={verify:function(e,t){return t=m(t,n,!0),e===t}});var i=s.rsa.decrypt(t,n,!0,!1);return r.verify(e,i,n.n.bitLength())}};return n},s.setRsaPrivateKey=s.rsa.setPrivateKey=function(e,t,n,i,o,a,u,l){var c={n:e,e:t,d:n,p:i,q:o,dP:a,dQ:u,qInv:l,decrypt:function(e,t,n){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=s.rsa.decrypt(e,c,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:m};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return r.pkcs1.decode_rsa_oaep(t,e,n)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,c,!1)},sign:function(e,t){var n=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:h},n=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},n=1);var r=t.encode(e,c.n.bitLength());return s.rsa.encrypt(r,c,n)}};return c},s.wrapRsaPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(e).getBytes())])},s.privateKeyFromAsn1=function(e){var t={},n=[],a,c,f,h,p,d,m,g;if(o.validate(e,u,t,n)&&(e=o.fromDer(r.util.createBuffer(t.privateKey))),t={},n=[],!o.validate(e,l,t,n)){var y=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw y.errors=n,y}return a=r.util.createBuffer(t.privateKeyModulus).toHex(),c=r.util.createBuffer(t.privateKeyPublicExponent).toHex(),f=r.util.createBuffer(t.privateKeyPrivateExponent).toHex(),h=r.util.createBuffer(t.privateKeyPrime1).toHex(),p=r.util.createBuffer(t.privateKeyPrime2).toHex(),d=r.util.createBuffer(t.privateKeyExponent1).toHex(),m=r.util.createBuffer(t.privateKeyExponent2).toHex(),g=r.util.createBuffer(t.privateKeyCoefficient).toHex(),s.setRsaPrivateKey(new i(a,16),new i(c,16),new i(f,16),new i(h,16),new i(p,16),new i(d,16),new i(m,16),new i(g,16))},s.privateKeyToAsn1=s.privateKeyToRSAPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.qInv))])},s.publicKeyFromAsn1=function(e){var t={},n=[];if(o.validate(e,f,t,n)){var a=o.derToOid(t.publicKeyOid);if(a!==s.oids.rsaEncryption){var u=new Error("Cannot read public key. Unknown OID.");throw u.oid=a,u}e=t.rsaPublicKey}if(n=[],!o.validate(e,c,t,n)){var u=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw u.errors=n,u}var l=r.util.createBuffer(t.publicKeyModulus).toHex(),h=r.util.createBuffer(t.publicKeyExponent).toHex();return s.setRsaPublicKey(new i(l,16),new i(h,16))},s.publicKeyToAsn1=s.publicKeyToSubjectPublicKeyInfo=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,[s.publicKeyToRSAPublicKey(e)])])},s.publicKeyToRSAPublicKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.e))])}},function(e,t,n){var r=n(19);if(n(237),n(140),n(311),n(118),n(179),n(461),n(312),n(141),n(898),n(309),n(34),void 0===i)var i=r.jsbn.BigInteger;var o=r.asn1,s=r.pki=r.pki||{};e.exports=s.pbe=r.pbe=r.pbe||{};var a=s.oids,u={name:"EncryptedPrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},l={name:"PBES2Algorithms",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},c={name:"pkcs-12PbeParams",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"iterations"}]};function f(e,t){return e.start().update(t).digest().getBytes()}function h(e){var t;if(e){if(t=s.oids[o.derToOid(e)],!t){var n=new Error("Unsupported PRF OID.");throw n.oid=e,n.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],n}}else t="hmacWithSHA1";return p(t)}function p(e){var t=r.md;switch(e){case"hmacWithSHA224":t=r.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var n=new Error("Unsupported PRF algorithm.");throw n.algorithm=e,n.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],n}if(!(t&&e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function d(e,t,n,i){var a=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==i&&a.value.push(o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,r.util.hexToBytes(n.toString(16))),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids[i]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")])),a}s.encryptPrivateKeyInfo=function(e,t,n){n=n||{},n.saltSize=n.saltSize||8,n.count=n.count||2048,n.algorithm=n.algorithm||"aes128",n.prfAlgorithm=n.prfAlgorithm||"sha1";var i=r.random.getBytesSync(n.saltSize),u=n.count,l=o.integerToDer(u),c,f,h;if(0===n.algorithm.indexOf("aes")||"des"===n.algorithm){var m,g,y;switch(n.algorithm){case"aes128":c=16,m=16,g=a["aes128-CBC"],y=r.aes.createEncryptionCipher;break;case"aes192":c=24,m=16,g=a["aes192-CBC"],y=r.aes.createEncryptionCipher;break;case"aes256":c=32,m=16,g=a["aes256-CBC"],y=r.aes.createEncryptionCipher;break;case"des":c=8,m=8,g=a.desCBC,y=r.des.createEncryptionCipher;break;default:var b=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw b.algorithm=n.algorithm,b}var v="hmacWith"+n.prfAlgorithm.toUpperCase(),w=p(v),_=r.pkcs5.pbkdf2(t,i,u,c,w),k=r.random.getBytesSync(m),S=y(_);S.start(k),S.update(o.toDer(e)),S.finish(),h=S.output.getBytes();var E=d(i,l,c,v);f=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBES2).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBKDF2).getBytes()),E]),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(g).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,k)])])])}else{if("3des"!==n.algorithm){var b=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw b.algorithm=n.algorithm,b}c=24;var x=new r.util.ByteBuffer(i),_=s.pbe.generatePkcs12Key(t,x,1,u,c),k=s.pbe.generatePkcs12Key(t,x,2,u,c),S=r.des.createEncryptionCipher(_);S.start(k),S.update(o.toDer(e)),S.finish(),h=S.output.getBytes(),f=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,i),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,l.getBytes())])])}var C=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[f,o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,h)]);return C},s.decryptPrivateKeyInfo=function(e,t){var n=null,i={},a=[];if(!o.validate(e,u,i,a)){var l=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw l.errors=a,l}var c=o.derToOid(i.encryptionOid),f=s.pbe.getCipher(c,i.encryptionParams,t),h=r.util.createBuffer(i.encryptedData);return f.update(h),f.finish()&&(n=o.fromDer(f.output)),n},s.encryptedPrivateKeyToPem=function(e,t){var n={type:"ENCRYPTED PRIVATE KEY",body:o.toDer(e).getBytes()};return r.pem.encode(n,{maxline:t})},s.encryptedPrivateKeyFromPem=function(e){var t=r.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var n=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw n.headerType=t.type,n}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return o.fromDer(t.body)},s.encryptRsaPrivateKey=function(e,t,n){if(n=n||{},!n.legacy){var i=s.wrapRsaPrivateKey(s.privateKeyToAsn1(e));return i=s.encryptPrivateKeyInfo(i,t,n),s.encryptedPrivateKeyToPem(i)}var a,u,l,c;switch(n.algorithm){case"aes128":a="AES-128-CBC",l=16,u=r.random.getBytesSync(16),c=r.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",l=24,u=r.random.getBytesSync(16),c=r.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",l=32,u=r.random.getBytesSync(16),c=r.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",l=24,u=r.random.getBytesSync(8),c=r.des.createEncryptionCipher;break;case"des":a="DES-CBC",l=8,u=r.random.getBytesSync(8),c=r.des.createEncryptionCipher;break;default:var f=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+n.algorithm+'".');throw f.algorithm=n.algorithm,f}var h=r.pbe.opensslDeriveBytes(t,u.substr(0,8),l),p=c(h);p.start(u),p.update(o.toDer(s.privateKeyToAsn1(e))),p.finish();var d={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:r.util.bytesToHex(u).toUpperCase()},body:p.output.getBytes()};return r.pem.encode(d)},s.decryptRsaPrivateKey=function(e,t){var n=null,i=r.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type){var a=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw a.headerType=a,a}if(i.procType&&"ENCRYPTED"===i.procType.type){var u,l;switch(i.dekInfo.algorithm){case"DES-CBC":u=8,l=r.des.createDecryptionCipher;break;case"DES-EDE3-CBC":u=24,l=r.des.createDecryptionCipher;break;case"AES-128-CBC":u=16,l=r.aes.createDecryptionCipher;break;case"AES-192-CBC":u=24,l=r.aes.createDecryptionCipher;break;case"AES-256-CBC":u=32,l=r.aes.createDecryptionCipher;break;case"RC2-40-CBC":u=5,l=function(e){return r.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":u=8,l=function(e){return r.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":u=16,l=function(e){return r.rc2.createDecryptionCipher(e,128)};break;default:var a=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".');throw a.algorithm=i.dekInfo.algorithm,a}var c=r.util.hexToBytes(i.dekInfo.parameters),f=r.pbe.opensslDeriveBytes(t,c.substr(0,8),u),h=l(f);if(h.start(c),h.update(r.util.createBuffer(i.body)),!h.finish())return n;n=h.output.getBytes()}else n=i.body;return n="ENCRYPTED PRIVATE KEY"===i.type?s.decryptPrivateKeyInfo(o.fromDer(n),t):o.fromDer(n),null!==n&&(n=s.privateKeyFromAsn1(n)),n},s.pbe.generatePkcs12Key=function(e,t,n,i,o,s){var a,u;if(void 0===s||null===s){if(!("sha1"in r.md))throw new Error('"sha1" hash algorithm unavailable.');s=r.md.sha1.create()}var l=s.digestLength,c=s.blockLength,f=new r.util.ByteBuffer,h=new r.util.ByteBuffer;if(null!==e&&void 0!==e){for(u=0;u=0;u--)T>>=8,T+=x.at(u)+I.at(u),I.setAt(u,255&T);A.putBuffer(I)}w=A,f.putBuffer(S)}return f.truncate(f.length()-o),f},s.pbe.getCipher=function(e,t,n){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,n);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,n);default:var r=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw r.oid=e,r.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],r}},s.pbe.getCipherForPBES2=function(e,t,n){var i={},a=[];if(!o.validate(t,l,i,a)){var u=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=a,u}if(e=o.derToOid(i.kdfOid),e!==s.oids.pkcs5PBKDF2){var u=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw u.oid=e,u.supportedOids=["pkcs5PBKDF2"],u}if(e=o.derToOid(i.encOid),e!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC){var u=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw u.oid=e,u.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],u}var c=i.kdfSalt,f=r.util.createBuffer(i.kdfIterationCount),p,d;switch(f=f.getInt(f.length()<<3),s.oids[e]){case"aes128-CBC":p=16,d=r.aes.createDecryptionCipher;break;case"aes192-CBC":p=24,d=r.aes.createDecryptionCipher;break;case"aes256-CBC":p=32,d=r.aes.createDecryptionCipher;break;case"des-EDE3-CBC":p=24,d=r.des.createDecryptionCipher;break;case"desCBC":p=8,d=r.des.createDecryptionCipher}var m=h(i.prfOid),g=r.pkcs5.pbkdf2(n,c,f,p,m),y=i.encIv,b=d(g);return b.start(y),b},s.pbe.getCipherForPKCS12PBE=function(e,t,n){var i={},a=[];if(!o.validate(t,c,i,a)){var u=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=a,u}var l=r.util.createBuffer(i.salt),f=r.util.createBuffer(i.iterations),p,d,m;switch(f=f.getInt(f.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:p=24,d=8,m=r.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:p=5,d=8,m=function(e,t){var n=r.rc2.createDecryptionCipher(e,40);return n.start(t,null),n};break;default:var u=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw u.oid=e,u}var g=h(i.prfOid),y=s.pbe.generatePkcs12Key(n,l,1,f,p,g);g.start();var b=s.pbe.generatePkcs12Key(n,l,2,f,d,g);return m(y,b)},s.pbe.opensslDeriveBytes=function(e,t,n,i){if(void 0===i||null===i){if(!("md5"in r.md))throw new Error('"md5" hash algorithm unavailable.');i=r.md.md5.create()}null===t&&(t="");for(var o=[f(i,e+t)],s=16,a=1;s8?3:1,g=[],y=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,v,w=0;w>>4^k),k^=v,_^=v<<4,v=65535&(k>>>-16^_),_^=v,k^=v<<-16,v=858993459&(_>>>2^k),k^=v,_^=v<<2,v=65535&(k>>>-16^_),_^=v,k^=v<<-16,v=1431655765&(_>>>1^k),k^=v,_^=v<<1,v=16711935&(k>>>8^_),_^=v,k^=v<<8,v=1431655765&(_>>>1^k),k^=v,_^=v<<1,v=_<<8|k>>>20&240,_=k<<24|k<<8&16711680|k>>>8&65280|k>>>24&240,k=v;for(var S=0;S>>26,k=k<<2|k>>>26):(_=_<<1|_>>>27,k=k<<1|k>>>27),_&=-15,k&=-15;var E=t[_>>>28]|n[_>>>24&15]|r[_>>>20&15]|i[_>>>16&15]|o[_>>>12&15]|s[_>>>8&15]|a[_>>>4&15],x=u[k>>>28]|l[k>>>24&15]|c[k>>>20&15]|f[k>>>16&15]|h[k>>>12&15]|p[k>>>8&15]|d[k>>>4&15];v=65535&(x>>>16^E),g[b++]=E^v,g[b++]=x^v<<16}}return g}function d(e,t,n,r){var i=32===e.length?3:9,p,d;p=3===i?r?[30,-2,-2]:[0,32,2]:r?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var m=t[0],g=t[1];d=252645135&(m>>>4^g),g^=d,m^=d<<4,d=65535&(m>>>16^g),g^=d,m^=d<<16,d=858993459&(g>>>2^m),m^=d,g^=d<<2,d=16711935&(g>>>8^m),m^=d,g^=d<<8,d=1431655765&(m>>>1^g),g^=d,m^=d<<1,m=m<<1|m>>>31,g=g<<1|g>>>31;for(var y=0;y>>4|g<<28)^e[w+1];d=m,m=g,g=d^(s[_>>>24&63]|u[_>>>16&63]|c[_>>>8&63]|h[63&_]|o[k>>>24&63]|a[k>>>16&63]|l[k>>>8&63]|f[63&k])}d=m,m=g,g=d}m=m>>>1|m<<31,g=g>>>1|g<<31,d=1431655765&(m>>>1^g),g^=d,m^=d<<1,d=16711935&(g>>>8^m),m^=d,g^=d<<8,d=858993459&(g>>>2^m),m^=d,g^=d<<2,d=65535&(m>>>16^g),g^=d,m^=d<<16,d=252645135&(m>>>4^g),g^=d,m^=d<<4,n[0]=m,n[1]=g}function m(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),n="DES-"+t,i;i=e.decrypt?r.cipher.createDecipher(n,e.key):r.cipher.createCipher(n,e.key);var o=i.start;return i.start=function(e,t){var n=null;t instanceof r.util.ByteBuffer&&(n=t,t={}),t=t||{},t.output=n,t.iv=e,o.call(i,t)},i}},function(e,t,n){var r=n(19);n(34);var i=e.exports=r.pem=r.pem||{};function o(e){for(var t=e.name+": ",n=[],r=function(e,t){return" "+t},i=0;i65&&-1!==s){var a=t[s];","===a?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+a+t.substr(s+1),o=i-s-1,s=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(s=i);return t}function s(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var n="-----BEGIN "+e.type+"-----\r\n",i;if(e.procType&&(i={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},n+=o(i)),e.contentDomain&&(i={name:"Content-Domain",values:[e.contentDomain]},n+=o(i)),e.dekInfo&&(i={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&i.values.push(e.dekInfo.parameters),n+=o(i)),e.headers)for(var s=0;s{n(null,e)},e=>{n(e)})}},function(e,t,n){"use strict";e.exports=self.crypto||self.msCrypto},function(e,t,n){"use strict";const r=n(901);e.exports=function(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return r(e)}},function(e,t,n){var r=n(4).Buffer;function i(e){if(e.length<8)return!1;if(e.length>72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;var t=e[3];if(0===t)return!1;if(5+t>=e.length)return!1;if(2!==e[4+t])return!1;var n=e[5+t];return 0!==n&&(6+t+n===e.length&&(!(128&e[4])&&(!(t>1&&0===e[4]&&!(128&e[5]))&&(!(128&e[t+6])&&!(n>1&&0===e[t+6]&&!(128&e[t+7]))))))}function o(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(48!==e[0])throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(2!==e[2])throw new Error("Expected DER integer");var t=e[3];if(0===t)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");var n=e[5+t];if(0===n)throw new Error("S length is zero");if(6+t+n!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw new Error("R value excessively padded");if(128&e[t+6])throw new Error("S value is negative");if(n>1&&0===e[t+6]&&!(128&e[t+7]))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}}function s(e,t){var n=e.length,i=t.length;if(0===n)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(n>33)throw new Error("R length is too long");if(i>33)throw new Error("S length is too long");if(128&e[0])throw new Error("R value is negative");if(128&t[0])throw new Error("S value is negative");if(n>1&&0===e[0]&&!(128&e[1]))throw new Error("R value excessively padded");if(i>1&&0===t[0]&&!(128&t[1]))throw new Error("S value excessively padded");var o=r.allocUnsafe(6+n+i);return o[0]=48,o[1]=o.length-2,o[2]=2,o[3]=e.length,e.copy(o,4),o[4+n]=2,o[5+n]=t.length,t.copy(o,6+n),o}e.exports={check:i,decode:o,encode:s}},function(e){e.exports={COMPRESSED_TYPE_INVALID:"compressed should be a boolean",EC_PRIVATE_KEY_TYPE_INVALID:"private key should be a Buffer",EC_PRIVATE_KEY_LENGTH_INVALID:"private key length is invalid",EC_PRIVATE_KEY_RANGE_INVALID:"private key range is invalid",EC_PRIVATE_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting private key is invalid",EC_PRIVATE_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PRIVATE_KEY_EXPORT_DER_FAIL:"couldn't export to DER format",EC_PRIVATE_KEY_IMPORT_DER_FAIL:"couldn't import from DER format",EC_PUBLIC_KEYS_TYPE_INVALID:"public keys should be an Array",EC_PUBLIC_KEYS_LENGTH_INVALID:"public keys Array should have at least 1 element",EC_PUBLIC_KEY_TYPE_INVALID:"public key should be a Buffer",EC_PUBLIC_KEY_LENGTH_INVALID:"public key length is invalid",EC_PUBLIC_KEY_PARSE_FAIL:"the public key could not be parsed or is invalid",EC_PUBLIC_KEY_CREATE_FAIL:"private was invalid, try again",EC_PUBLIC_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting public key is invalid",EC_PUBLIC_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PUBLIC_KEY_COMBINE_FAIL:"the sum of the public keys is not valid",ECDH_FAIL:"scalar was invalid (zero or overflow)",ECDSA_SIGNATURE_TYPE_INVALID:"signature should be a Buffer",ECDSA_SIGNATURE_LENGTH_INVALID:"signature length is invalid",ECDSA_SIGNATURE_PARSE_FAIL:"couldn't parse signature",ECDSA_SIGNATURE_PARSE_DER_FAIL:"couldn't parse DER signature",ECDSA_SIGNATURE_SERIALIZE_DER_FAIL:"couldn't serialize signature to DER format",ECDSA_SIGN_FAIL:"nonce generation function failed or private key is invalid",ECDSA_RECOVER_FAIL:"couldn't recover public key from signature",MSG32_TYPE_INVALID:"message should be a Buffer",MSG32_LENGTH_INVALID:"message length is invalid",OPTIONS_TYPE_INVALID:"options should be an Object",OPTIONS_DATA_TYPE_INVALID:"options.data should be a Buffer",OPTIONS_DATA_LENGTH_INVALID:"options.data length is invalid",OPTIONS_NONCEFN_TYPE_INVALID:"options.noncefn should be a Function",RECOVERY_ID_TYPE_INVALID:"recovery should be a Number",RECOVERY_ID_VALUE_INVALID:"recovery should have value between -1 and 4",TWEAK_TYPE_INVALID:"tweak should be a Buffer",TWEAK_LENGTH_INVALID:"tweak length is invalid"}},function(e,t,n){"use strict";var r=n(1),i=n(468),o=n(4).Buffer,s=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(e,t){return e<>>32-t}function l(e,t,n,r,i,o,s){return u(e+(t&n|~t&r)+i+o|0,s)+t|0}function c(e,t,n,r,i,o,s){return u(e+(t&r|n&~r)+i+o|0,s)+t|0}function f(e,t,n,r,i,o,s){return u(e+(t^n^r)+i+o|0,s)+t|0}function h(e,t,n,r,i,o,s){return u(e+(n^(t|~r))+i+o|0,s)+t|0}r(a,i),a.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var n=this._a,r=this._b,i=this._c,o=this._d;n=l(n,r,i,o,e[0],3614090360,7),o=l(o,n,r,i,e[1],3905402710,12),i=l(i,o,n,r,e[2],606105819,17),r=l(r,i,o,n,e[3],3250441966,22),n=l(n,r,i,o,e[4],4118548399,7),o=l(o,n,r,i,e[5],1200080426,12),i=l(i,o,n,r,e[6],2821735955,17),r=l(r,i,o,n,e[7],4249261313,22),n=l(n,r,i,o,e[8],1770035416,7),o=l(o,n,r,i,e[9],2336552879,12),i=l(i,o,n,r,e[10],4294925233,17),r=l(r,i,o,n,e[11],2304563134,22),n=l(n,r,i,o,e[12],1804603682,7),o=l(o,n,r,i,e[13],4254626195,12),i=l(i,o,n,r,e[14],2792965006,17),r=l(r,i,o,n,e[15],1236535329,22),n=c(n,r,i,o,e[1],4129170786,5),o=c(o,n,r,i,e[6],3225465664,9),i=c(i,o,n,r,e[11],643717713,14),r=c(r,i,o,n,e[0],3921069994,20),n=c(n,r,i,o,e[5],3593408605,5),o=c(o,n,r,i,e[10],38016083,9),i=c(i,o,n,r,e[15],3634488961,14),r=c(r,i,o,n,e[4],3889429448,20),n=c(n,r,i,o,e[9],568446438,5),o=c(o,n,r,i,e[14],3275163606,9),i=c(i,o,n,r,e[3],4107603335,14),r=c(r,i,o,n,e[8],1163531501,20),n=c(n,r,i,o,e[13],2850285829,5),o=c(o,n,r,i,e[2],4243563512,9),i=c(i,o,n,r,e[7],1735328473,14),r=c(r,i,o,n,e[12],2368359562,20),n=f(n,r,i,o,e[5],4294588738,4),o=f(o,n,r,i,e[8],2272392833,11),i=f(i,o,n,r,e[11],1839030562,16),r=f(r,i,o,n,e[14],4259657740,23),n=f(n,r,i,o,e[1],2763975236,4),o=f(o,n,r,i,e[4],1272893353,11),i=f(i,o,n,r,e[7],4139469664,16),r=f(r,i,o,n,e[10],3200236656,23),n=f(n,r,i,o,e[13],681279174,4),o=f(o,n,r,i,e[0],3936430074,11),i=f(i,o,n,r,e[3],3572445317,16),r=f(r,i,o,n,e[6],76029189,23),n=f(n,r,i,o,e[9],3654602809,4),o=f(o,n,r,i,e[12],3873151461,11),i=f(i,o,n,r,e[15],530742520,16),r=f(r,i,o,n,e[2],3299628645,23),n=h(n,r,i,o,e[0],4096336452,6),o=h(o,n,r,i,e[7],1126891415,10),i=h(i,o,n,r,e[14],2878612391,15),r=h(r,i,o,n,e[5],4237533241,21),n=h(n,r,i,o,e[12],1700485571,6),o=h(o,n,r,i,e[3],2399980690,10),i=h(i,o,n,r,e[10],4293915773,15),r=h(r,i,o,n,e[1],2240044497,21),n=h(n,r,i,o,e[8],1873313359,6),o=h(o,n,r,i,e[15],4264355552,10),i=h(i,o,n,r,e[6],2734768916,15),r=h(r,i,o,n,e[13],1309151649,21),n=h(n,r,i,o,e[4],4149444226,6),o=h(o,n,r,i,e[11],3174756917,10),i=h(i,o,n,r,e[2],718787259,15),r=h(r,i,o,n,e[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+o|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=o.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=a},function(e,t,n){"use strict";var r=n(1),i=n(928),o=n(119),s=n(4).Buffer,a=n(929),u=n(469),l=n(470),c=s.alloc(128);function f(e,t){o.call(this,"digest"),"string"==typeof t&&(t=s.from(t));var n="sha512"===e||"sha384"===e?128:64;if(this._alg=e,this._key=t,t.length>n){var r="rmd160"===e?new u:l(e);t=r.update(t).digest()}else t.length{const t=o.apply(null,e);r.codes[t.code]=t,r.names[t.name]=t}),r.object=o,e.exports=r},function(e,t,n){"use strict";const r=1e3;e.exports={maxProvidersPerRequest:3,providerRequestTimeout:1e4,hasBlockTimeout:15e3,provideTimeout:15e3,kMaxPriority:Math.pow(2,31)-1,rebroadcastDelay:1e4,maxListeners:1e3}},function(e,t,n){var r=n(67),i=n(323),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!i(e))||(s.test(e)||!o.test(e)||null!=t&&e in Object(t))}e.exports=a},function(e,t,n){var r=n(132),i=n(105),o="[object Symbol]";function s(e){return"symbol"==typeof e||i(e)&&r(e)==o}e.exports=s},function(e,t,n){var r=n(1001),i=n(1017),o=n(1019),s=n(1020),a=n(1021);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{let r,i;if(e<0)r=n,i=t;else{if(!(e>0))return t[0];r=t,i=n}for(let e of r)for(let t of i)if(e===t)return e;throw new Error("No algorithms in common!")}),t.makeMacAndCipher=((e,t)=>{l([t=>c(e.hashT,e.keys.macKey,t),t=>f(e.cipherT,e.keys.iv,e.keys.cipherKey,t)],(n,r)=>{if(n)return t(n);e.mac=r[0],e.cipher=r[1],t()})}),t.selectBest=((n,r,i)=>{t.digest(e.concat([r.pubKeyBytes,n.nonce]),(o,s)=>{if(o)return i(o);t.digest(e.concat([n.pubKeyBytes,r.nonce]),(o,a)=>{if(o)return i(o);const u=e.compare(s,a);if(0===u)return i(new Error("you are trying to talk to yourself"));i(null,{curveT:t.theBest(u,n.exchanges,r.exchanges),cipherT:t.theBest(u,n.ciphers,r.ciphers),hashT:t.theBest(u,n.hashes,r.hashes),order:u})})})}),t.digest=((e,t)=>{r.digest(e,"sha2-256",e.length,t)}),t.write=function e(t,n,r){r=r||(()=>{}),o(s([n]),i.encode({fixed:!0,bytes:4}),a((e,n)=>{if(e)return r(e);t.shake.write(n[0]),r()}))},t.read=function e(t,n){i.decodeFromReader(t,{fixed:!0,bytes:4},n)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(e){const r=n(71),i=n(23),o=n(64),s=n(54),a=n(11),u=n(5),l=u("libp2p:secio");l.error=u("libp2p:secio:error");const c=r(n(1113)),f=n(330),h=16;t.createProposal=(e=>(e.proposal.out={rand:o.randomBytes(16),pubkey:e.key.local.public.bytes,exchanges:f.exchanges.join(","),ciphers:f.ciphers.join(","),hashes:f.hashes.join(",")},e.proposalEncoded.out=c.Propose.encode(e.proposal.out),e.proposalEncoded.out)),t.createExchange=((t,n)=>{o.keys.generateEphemeralKeyPair(t.protocols.local.curveT,(r,i)=>{if(r)return n(r);t.ephemeralKey.local=i.key,t.shared.generate=i.genSharedKey;const o=e.concat([t.proposalEncoded.out,t.proposalEncoded.in,t.ephemeralKey.local]);t.key.local.sign(o,(e,r)=>{if(e)return n(e);t.exchange.out={epubkey:t.ephemeralKey.local,signature:r},n(null,c.Exchange.encode(t.exchange.out))})})}),t.identify=((e,t,n)=>{l("1.1 identify"),e.proposalEncoded.in=t,e.proposal.in=c.Propose.decode(t);const r=e.proposal.in.pubkey;e.key.remote=o.keys.unmarshalPublicKey(r),i.createFromPubKey(r.toString("base64"),(t,r)=>{if(t)return n(t);if(e.id.remote){if(e.id.remote.toB58String()!==r.toB58String())return n(new Error("dialed to the wrong peer, Ids do not match"))}else e.id.remote=r;l("1.1 identify - %s - identified remote peer as %s",e.id.local.toB58String(),e.id.remote.toB58String()),n()})}),t.selectProtocols=((e,t)=>{l("1.2 selection");const n={pubKeyBytes:e.key.local.public.bytes,exchanges:f.exchanges,hashes:f.hashes,ciphers:f.ciphers,nonce:e.proposal.out.rand},r={pubKeyBytes:e.proposal.in.pubkey,exchanges:e.proposal.in.exchanges.split(","),hashes:e.proposal.in.hashes.split(","),ciphers:e.proposal.in.ciphers.split(","),nonce:e.proposal.in.rand};f.selectBest(n,r,(n,r)=>{if(n)return t(n);e.protocols.remote={order:r.order,curveT:r.curveT,cipherT:r.cipherT,hashT:r.hashT},e.protocols.local={order:r.order,curveT:r.curveT,cipherT:r.cipherT,hashT:r.hashT},t()})}),t.verify=((t,n,r)=>{l("2.1. verify"),t.exchange.in=c.Exchange.decode(n),t.ephemeralKey.remote=t.exchange.in.epubkey;const i=e.concat([t.proposalEncoded.in,t.proposalEncoded.out,t.ephemeralKey.remote]);t.key.remote.verify(i,t.exchange.in.signature,(e,t)=>e?r(e):t?(l("2.1. verify - signature verified"),void r()):r(new Error("Bad signature")))}),t.generateKeys=((e,t)=>{l("2.2. keys"),a([t=>e.shared.generate(e.exchange.in.epubkey,t),(t,n)=>{e.shared.secret=t,o.keys.keyStretcher(e.protocols.local.cipherT,e.protocols.local.hashT,e.shared.secret,n)},(t,n)=>{if(e.protocols.local.order>0)e.protocols.local.keys=t.k1,e.protocols.remote.keys=t.k2;else{if(!(e.protocols.local.order<0))return n(new Error("you are trying to talk to yourself"));e.protocols.local.keys=t.k2,e.protocols.remote.keys=t.k1}l("2.3. mac + cipher"),s([t=>f.makeMacAndCipher(e.protocols.local,t),t=>f.makeMacAndCipher(e.protocols.remote,t)],n)}],t)}),t.verifyNonce=((e,t)=>{const n=e.proposal.out.rand;if(!n.equals(t))throw new Error(`Failed to read our encrypted nonce: ${n.toString("hex")} != ${t.toString("hex")}`)})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var r=n(68),i=f(r),o=n(145),s=f(o),a=n(42),u=f(a),l=n(104),c=f(l);function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t){var n=null,r;t=t||i.default,(0,s.default)(e,function(e,t){(0,u.default)(e)(function(e,i){r=arguments.length>2?(0,c.default)(arguments,1):i,n=e,t(!e)})},function(){t(n,r)})}e.exports=t.default},function(e,t,n){"use strict";const r=n(71),i="\nmessage Identify {\n // protocolVersion determines compatibility between peers\n optional string protocolVersion = 5; // e.g. ipfs/1.0.0\n\n // agentVersion is like a UserAgent string in browsers, or client version in bittorrent\n // includes the client name and client.\n optional string agentVersion = 6; // e.g. go-ipfs/0.1.0\n\n // publicKey is this node's public key (which also gives its node.ID)\n // - may not need to be sent, as secure channel implies it has been sent.\n // - then again, if we change / disable secure channel, may still want it.\n optional bytes publicKey = 1;\n\n // listenAddrs are the multiaddrs the sender node listens for open connections on\n repeated bytes listenAddrs = 2;\n\n // oservedAddr is the multiaddr of the remote endpoint that the sender node perceives\n // this is useful information to convey to the other side, as it helps the remote endpoint\n // determine whether its connection to the local peer goes through NAT.\n optional bytes observedAddr = 4;\n\n repeated string protocols = 3;\n}\n";e.exports=r(i).Identify},function(e,t,n){"use strict";const r=n(43),i=n(37),o=n(106),s=n(12),a=n(72),u=n(122),l=n(5),c=l("libp2p:circuit:stream-handler");c.err=l("libp2p:circuit:error:stream-handler");class f{constructor(e,t,n,r){this.conn=e,this.stream=null,this.shake=null,this.timeout=t||6e4,this.maxLength=r||4096,"function"==typeof t&&(this.timeout=n||6e4),this.stream=u({timeout:this.timeout},t),this.shake=this.stream.handshake,s(this.stream,e,this.stream)}isValid(){return this.conn&&this.shake&&this.stream}read(e){if(!this.isValid())return e(new Error("handler is not in a valid state"));a.decodeFromReader(this.shake,{maxLength:this.maxLength},(t,n)=>t?(c.err(t),e(t)):e(null,n))}write(e,t){if(t=t||(()=>{}),!this.isValid())return t(new Error("handler is not in a valid state"));s(r([e]),a.encode(),i((e,n)=>{if(e)return c.err(e),this.shake.abort(e),t(e);n.forEach(e=>this.shake.write(e)),t()}))}getRawConn(){return this.conn}rest(){const e=this.shake.rest();return this.conn=null,this.stream=null,this.shake=null,e}close(){this.isValid()&&s(o(),this.rest())}}e.exports=f},function(e,t,n){"use strict";e.exports={relay:"/libp2p/circuit/relay/0.1.0"}},function(e,t,n){"use strict";const r=n(66).Connection,i=n(12);e.exports=((e,t,n,o)=>{const s=new Promise((e,t)=>{n.getPeerInfo((t,r)=>{if(!t&&r)return void e(r);const i=n.setPeerInfo;n.setPeerInfo=(t=>{i.call(n,t),e(t)})})}),a={source:i(n,o.incoming(e,t,s)),sink:i(o.outgoing(e,t,s),n)};return new r(a,n)})},function(e,t,n){"use strict";e.exports={PROTOCOL:"/ipfs/ping/1.0.0",PING_LENGTH:32}},function(e,t,n){var r=n(132),i=n(67),o=n(105),s="[object String]";function a(e){return"string"==typeof e||!i(e)&&o(e)&&r(e)==s}e.exports=a},function(e,t,n){var r=n(1221);e.exports=function(e,t,n){n=void 0===n||n;var i=!1,o;return function(s){var a=0,u=0,l=0,c=[],f=!1,h=!1,p,d;function m(){if(p){var e=p;if(d)return p=null,e(d);if(Object.hasOwnProperty.call(c,u)){p=null;var n=c[u];delete c[u],u++,e(null,n),t&&g()}else u>=l&&h&&(p=null,e(h))}}var g=r(function(){if(f=!0,h)return m();i||t&&a-t>=u||(i=!0,s(o,function(t,r){if(i=!1,t)l=a,h=t,m();else{var o=a++;e(r,function(e,t){n?c[o]=t:c.push(t),e&&(d=e),m()}),h||g()}}))});return function(e,t){e?s(h=o=e,function(e){if(t)return t(e)}):(p=t,f||g(),m())}}}},function(e,t,n){"use strict";const r=n(189),i=100;e.exports=function e(t){const n=t||100;var i=[];return r(function e(t){for(i=i.concat(t);i.length>=n;){const e=n,t=i.slice(0,e);i=i.slice(e),this.queue(t)}},function e(t){i.length&&(this.queue(i),i=[]),this.queue(null)})}},function(e,t,n){"use strict";e.exports=class e{constructor(e,t){this._options=t||{},Object.assign(this,e)}}},function(e,t,n){"use strict";const r=n(1236),i=n(1237),o={bits:8};class s{constructor(e,t,n){if(this._options=Object.assign({},o,e),this._popCount=0,this._parent=t,this._posAtParent=n,!this._options.hashFn)throw new Error("please define an options.hashFn");this._options.hash||(this._options.hash=i(this._options.hashFn)),this._children=new r}static isBucket(e){return e instanceof s}async put(e,t){const n=await this._findNewBucketAndPos(e);await n.bucket._putAt(n,e,t)}async get(e){const t=await this._findChild(e);if(t)return t.value}async del(e){const t=await this._findPlace(e),n=t.bucket._at(t.pos);n&&n.key===e&&t.bucket._delAt(t.pos)}leafCount(){return this._children.compactArray().reduce((e,t)=>t instanceof s?e+t.leafCount():e+1,0)}childrenCount(){return this._children.length}onlyChild(){return this._children.get(0)}*eachLeafSeries(){const e=this._children.compactArray();for(const t of e)if(t instanceof s)for(const e of t.eachLeafSeries())yield e;else yield t}serialize(e,t){return t(this._children.reduce((n,r,i)=>(r&&(r instanceof s?n.push(r.serialize(e,t)):n.push(e(r,i))),n),[]))}async asyncTransform(e,t){return c(this,e,t)}toJSON(){return this.serialize(u,l)}prettyPrint(){return JSON.stringify(this.toJSON(),null," ")}tableSize(){return Math.pow(2,this._options.bits)}async _findChild(e){const t=await this._findPlace(e),n=t.bucket._at(t.pos);if(n&&n.key===e)return n}async _findPlace(e){const t=this._options.hash(e),n=await t.take(this._options.bits),r=this._children.get(n);return r instanceof s?r._findPlace(t):{bucket:this,pos:n,hash:t}}async _findNewBucketAndPos(e){const t=await this._findPlace(e),n=t.bucket._at(t.pos);if(n&&n.key!==e){const e=new s(this._options,t.bucket,t.pos);t.bucket._putObjectAt(t.pos,e);const r=await e._findPlace(n.hash);return r.bucket._putAt(r,n.key,n.value),e._findNewBucketAndPos(t.hash)}return t}_putAt(e,t,n){this._putObjectAt(e.pos,{key:t,value:n,hash:e.hash})}_putObjectAt(e,t){this._children.get(e)||this._popCount++,this._children.set(e,t)}_delAt(e){this._children.get(e)&&this._popCount--,this._children.unset(e),this._level()}_level(){if(this._parent&&this._popCount<=1)if(1===this._popCount){const e=this._children.find(a);if(!(e instanceof s)){const t=e.hash;t.untake(this._options.bits);const n={pos:this._posAtParent,hash:t};this._parent._putAt(n,e.key,e.value)}}else this._parent._delAt(this._posAtParent)}_at(e){return this._children.get(e)}}function a(e){return Boolean(e)}function u(e,t){return e.key}function l(e){return e}async function c(e,t,n){const r=[];for(const i of e._children.compactArray()){if(i instanceof s)await c(i,t,n);else{const n=await t(i);r.push({bitField:e._children.bitField(),children:n})}return n(r)}}e.exports=s},function(e,t,n){"use strict";const r=(e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean);e.exports=r},function(e,t,n){"use strict";const r=n(11),i=n(48),o=n(123),{loadNode:s,formatCid:a,toMfsPath:u,FILE_SEPARATOR:l,FILE_TYPES:c}=n(82),f=n(12),h=n(37),p=n(90),d=n(78),m=n(138),g=n(81),y=n(70),b={long:!1,cidBase:"base58btc"};e.exports=(e=>(function t(n,v={}){"object"==typeof n&&(v=n,n=l),void 0===n&&(n=l),v=Object.assign({},b,v),v.long=v.l||v.long;const w=y.source();return r([t=>u(e,n,t),({mfsPath:t,depth:r},i)=>{f(o(t,e.ipld,{maxDepth:r}),h((s,a)=>{if(s)return i(s);if(a.length>1)return i(new Error(`Path ${n} had ${a.length} roots`));const u=a[0];if(!u)return i(new Error(`${n} does not exist`));if("dir"!==u.type)return i(null,m(u));let l=!0;return i(null,f(o(t,e.ipld,{maxDepth:r+1}),d(()=>!l||(l=!1,!1))))}))},(t,n)=>{n(null,f(t,p((t,n)=>{if(!v.long)return n(null,{name:t.name,type:0,size:0,hash:""});s(e,{cid:t.hash},(e,r)=>{if(e)return n(e);const o=i.unmarshal(r.node.data);n(null,{name:t.name,type:c[o.type],hash:a(t.hash,v.cidBase),size:o.fileSize()||0})})})))}],(e,t)=>{if(e)return w.resolve(g(e));w.resolve(t)}),w}))},function(e,t,n){"use strict";const r=n(11),i=n(88),o=n(5)("ipfs:mfs:mkdir"),s=n(123),a=n(12),u=n(78),l=n(77),c=n(37),f=n(9),{createNode:h,toMfsPath:p,toPathComponents:d,updateMfsRoot:m,updateTree:g,FILE_SEPARATOR:y}=n(82),b={parents:!1,hashAlg:"sha2-256",cidVersion:0,shardSplitThreshold:1e3,format:"dag-pb",flush:!0};e.exports=(e=>(function t(n,v,w){if("function"==typeof v&&(w=v,v={}),v=Object.assign({},b,v),v.parents=v.p||v.parents,v.cidVersion=v.cidVersion||0,!n)return w(new Error("no path given to Mkdir"));if(n=n.trim(),n===y)return w(v.parents?null:new Error(`cannot create directory '${y}': Already exists`));o(`Creating ${n}`);const _=d(n);r([t=>p(e,n,t),({mfsDirectory:t,mfsPath:n,root:r},i)=>{const o=d(n).slice(1);let h=0,p="";a(s(n,e.ipld,{fullPath:!0}),u(e=>e.name===o[h]&&(h++,!0)),l(e=>{const t=`${p}${p?"/":""}${o[e.depth]}`;if("dir"!==e.type)throw new Error(`cannot access ${t}: Not a directory`);return p=t,{cid:new f(e.hash),name:e.name}}),c(i))},(t,n)=>{if(_.unshift("/"),t.length===_.length)return n(new Error("file already exists"));i(_.map((e,t)=>({part:e,index:t})),({part:n,index:i},o)=>t[i]?o(null,{name:n,...t[i]}):i===_.length-1||v.parents?void r([t=>h(e,"directory",v,t),({cid:e,node:t},r)=>{r(null,{cid:e,size:t.size,name:n})}],o):o(new Error("file does not exist")),n)},(t,n)=>g(e,t,v,n),({cid:t},n)=>m(e,t,n)],e=>{e&&e.message.includes("file already exists")&&v.parents&&(e=null),w(e)})}))},function(e,t,n){"use strict";const r=n(123),i=n(12),o=n(138),s=n(90),a=n(224),u=n(78),l=n(70),c=n(37),{toMfsPath:f}=n(82),h=n(5)("ipfs:mfs:read-pull-stream"),p={offset:0,length:void 0};e.exports=(e=>(function t(n,d={}){d=Object.assign({},p,d),d.length=d.length||d.count,h(`Reading ${n}`);const m=l.source();return i(o(n),s((t,n)=>f(e,t,n)),s(({mfsPath:t,root:n},o)=>(h(`Exporting ${t}`),i(r(t,e.ipld,{offset:d.offset,length:d.length}),c(o)))),a(),u(),c((e,t)=>{if(e)return m.abort(e);if(!t||!t.length)return m.abort(new Error(`${n} does not exist`));const r=t[0];return"file"!==r.type?m.abort(new Error(`${n} was not a file`)):r.content?(h(`Got ${n} content`),void m.resolve(t[0].content)):m.abort(new Error(`Could not load content stream from ${n}`))})),m}))},function(e,t,n){"use strict";const r=n(572),i=(e,t,n)=>{"function"==typeof t&&(n=t,t=void 0),r.deserialize(e,(e,r)=>{if(e)return n(e);if(!t)return n(null,{value:r,remainderPath:""});const i=t.split("/"),o=s(r,i[0]);if(null===o)return n(new Error("No such path"),null);let a=i.slice(1).join("/");return void 0!==o["/"]?n(null,{value:o,remainderPath:a}):a.length>0?n(new Error("No such path"),null):n(null,{value:o,remainderPath:""})})},o=(e,t,n)=>{"function"==typeof t&&(n=t,t=void 0),t=t||{},r.deserialize(e,(e,r)=>{if(e)return n(e);const i=["version","timestamp","difficulty","nonce","parent","tx"];if(!0===t.values){const e={};for(let t of i)e[t]=s(r,t);return n(null,e)}return n(null,i)})},s=(e,t)=>{switch(t){case"version":return e.version;case"timestamp":return e.timestamp;case"difficulty":return e.bits;case"nonce":return e.nonce;case"parent":return{"/":r.hashToCid(e.prevHash)};case"tx":return{"/":r.hashToCid(e.merkleRoot)};default:return null}};e.exports={multicodec:"bitcoin-block",defaultHashAlg:"dbl-sha2-256",resolve:i,tree:o}},function(e,t){var n={Array:function(e){return null!==e&&void 0!==e&&e.constructor===Array},Boolean:function(e){return"boolean"==typeof e},Function:function(e){return"function"==typeof e},Nil:function(e){return void 0===e||null===e},Number:function(e){return"number"==typeof e},Object:function(e){return"object"==typeof e},String:function(e){return"string"==typeof e},"":function(){return!0}};for(var r in n.Null=n.Nil,n)n[r].toJSON=function(e){return e}.bind(null,r);e.exports=n},function(e,t,n){const r=n(4).Buffer,i=n(108),o=n(29),s=n(1358),a=n(36),u=n(45),l=n(94),c=n(580);function f(e){const t=e.length;return c.encodingLength(t)+t}function h(e){const t=e.length;return c.encodingLength(t)+e.reduce(function(e,t){return e+f(t)},0)}function p(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}p.DEFAULT_SEQUENCE=4294967295,p.SIGHASH_ALL=1,p.SIGHASH_NONE=2,p.SIGHASH_SINGLE=3,p.SIGHASH_ANYONECANPAY=128,p.ADVANCED_TRANSACTION_MARKER=0,p.ADVANCED_TRANSACTION_FLAG=1;const d=r.allocUnsafe(0),m=[],g=r.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),y=r.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),b=r.from("ffffffffffffffff","hex"),v={script:d,valueBuffer:b};p.fromBuffer=function(e,t){let n=0;function r(t){return n+=t,e.slice(n-t,n)}function i(){const t=e.readUInt32LE(n);return n+=4,t}function o(){const t=e.readInt32LE(n);return n+=4,t}function a(){const t=s.readUInt64LE(e,n);return n+=8,t}function u(){const t=c.decode(e,n);return n+=c.decode.bytes,t}function l(){return r(u())}function f(){const e=u(),t=[];for(var n=0;n=this.ins.length)return y;const s=o.compile(o.decompile(t).filter(function(e){return e!==a.OP_CODESEPARATOR})),c=this.clone();if((31&n)===p.SIGHASH_NONE)c.outs=[],c.ins.forEach(function(t,n){n!==e&&(t.sequence=0)});else if((31&n)===p.SIGHASH_SINGLE){if(e>=this.outs.length)return y;c.outs.length=e+1;for(var f=0;f>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function u(e){for(var t=1,n=0;n126)throw new Error("Invalid prefix ("+e+")");t=a(t)^r>>5}for(t=a(t),n=0;nn)throw new TypeError("Exceeds length limit");e=e.toLowerCase();for(var i=u(e),o=e+"1",s=0;s>5!=0)throw new Error("Non 5-bit word");i=a(i)^l,o+=r.charAt(l)}for(s=0;s<6;++s)i=a(i);for(i^=1,s=0;s<6;++s){var c=i>>5*(5-s)&31;o+=r.charAt(c)}return o}function c(e,t){if(t=t||90,e.length<8)throw new TypeError(e+" too short");if(e.length>t)throw new TypeError("Exceeds length limit");var n=e.toLowerCase(),r=e.toUpperCase();if(e!==n&&e!==r)throw new Error("Mixed-case string "+e);e=n;var o=e.lastIndexOf("1");if(-1===o)throw new Error("No separator character for "+e);if(0===o)throw new Error("Missing prefix for "+e);var s=e.slice(0,o),l=e.slice(o+1);if(l.length<6)throw new Error("Data too short");for(var c=u(s),f=[],h=0;h=l.length||f.push(d)}if(1!==c)throw new Error("Invalid checksum for "+e);return{prefix:s,words:f}}function f(e,t,n,r){for(var i=0,o=0,s=(1<=n;)o-=n,a.push(i>>o&s);if(r)o>0&&a.push(i<=t)throw new Error("Excess padding");if(i<{const t=s.decode(e),n=new a(t);return n}),c;function f(e,o,s){h(e,o,(e,a)=>{if(e)return s(e);if(!n)return s(null,a);let u=a.slice();const l=a.filter(e=>t.isBuffer(e.value));r(l,(e,t)=>i([t=>n.util.deserialize(e.value,t),(e,t)=>n.resolver._mapFromEthObject(e,o,t)],(n,r)=>{if(n)return t(n);r.forEach(t=>{u.push({path:e.path+"/"+t.path,value:t.value})}),t()}),e=>{if(e)return s(e);s(null,u)})})}function h(t,n,i){let o=[];"leaf"===t.type&&o.push({path:m(t.getKey()),value:t.getValue()}),r(t.getChildren(),(t,r)=>{const i=m(t[0]),s=t[1];if(a.isRawNode(s)){const e=new a(s);o.push({path:i,value:e}),h(e,n,(e,t)=>{if(e)return r(e);t.forEach(e=>{e.path=i+"/"+e.path}),o=o.concat(t),r()})}else{let t={"/":u(e,s).toBaseEncodedString()};o.push({path:i,value:t}),r()}},e=>{if(e)return i(e);i(null,o)})}}function m(e){return e.map(e=>e.toString(16)).join("/")}e.exports=d}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(596),i=(e,t,n)=>{"function"==typeof t&&(n=t,t=void 0),r.deserialize(e,(e,r)=>{if(e)return n(e);if(!t)return n(null,{value:r,remainderPath:""});const i=t.split("/"),o=s(r,i[0]);if(null===o)return n(new Error("No such path"),null);let a=i.slice(1).join("/");return void 0!==o["/"]?n(null,{value:o,remainderPath:a}):a.length>0?n(new Error("No such path"),null):n(null,{value:o,remainderPath:""})})},o=(e,t,n)=>{"function"==typeof t&&(n=t,t=void 0),t=t||{},r.deserialize(e,(e,r)=>{if(e)return n(e);const i=["version","timestamp","difficulty","nonce","solution","reserved","parent","tx"];if(!0===t.values){const e={};for(let t of i)e[t]=s(r,t);return n(null,e)}return n(null,i)})},s=(e,t)=>{switch(t){case"version":return e.version;case"timestamp":return e.time;case"difficulty":return e.bits;case"nonce":return e.nonce;case"solution":return e.solution;case"reserved":return e.reserved;case"parent":return{"/":r.hashToCid(e.prevHash)};case"tx":return{"/":r.hashToCid(e.merkleRoot)};default:return null}};e.exports={multicodec:"zcash-block",defaultHashAlg:"dbl-sha2-256",resolve:i,tree:o}},function(e,t){"function"==typeof Object.create?e.exports=function e(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function e(t,n){if(n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}}},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(25),o=n(30),s=n(41);function a(e){if(!(this instanceof a))return new a(e);var t;if(r.isNumber(e))t=e;else{if(!r.isString(e))throw new TypeError('Unrecognized num type: "'+typeof e+'" for Opcode');t=a.map[e]}return s.defineImmutable(this,{num:t}),this}for(var u in a.fromBuffer=function(e){return i.checkArgument(o.isBuffer(e)),new a(Number("0x"+e.toString("hex")))},a.fromNumber=function(e){return i.checkArgument(r.isNumber(e)),new a(e)},a.fromString=function(e){i.checkArgument(r.isString(e));var t=a.map[e];if(void 0===t)throw new TypeError("Invalid opcodestr");return new a(t)},a.prototype.toHex=function(){return this.num.toString(16)},a.prototype.toBuffer=function(){return new t(this.toHex(),"hex")},a.prototype.toNumber=function(){return this.num},a.prototype.toString=function(){var e=a.reverseMap[this.num];if(void 0===e)throw new Error("Opcode does not have a string representation");return e},a.smallInt=function(e){return i.checkArgument(r.isNumber(e),"Invalid Argument: n should be number"),i.checkArgument(e>=0&&e<=16,"Invalid Argument: n must be between 0 and 16"),0===e?a("OP_0"):new a(a.map.OP_1+e-1)},a.map={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP1:176,OP_NOP2:177,OP_NOP3:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255},a.reverseMap=[],a.map)a.reverseMap[a.map[u]]=u;r.extend(a,a.map),a.isSmallIntOp=function(e){return e instanceof a&&(e=e.toNumber()),e===a.map.OP_0||e>=a.map.OP_1&&e<=a.map.OP_16},a.prototype.inspect=function(){return""},e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(25),o=n(0),s=t.compare||n(1447),a=n(84),u=n(30),l=n(41),c=n(109),f=n(80),h=n(60),p=n(85),d=n(110),m=n(129),g=n(601),y=n(360),b=y.PublicKeyHash,v=y.PublicKey,w=y.MultiSigScriptHash,_=y.MultiSig,k=n(111),S=n(86),E=n(273),x=n(49),C=n(1452);function A(e){if(!(this instanceof A))return new A(e);if(this.inputs=[],this.outputs=[],this.joinSplits=[],this._inputAmount=void 0,this._outputAmount=void 0,e){if(e instanceof A)return A.shallowCopy(e);if(l.isHexa(e))this.fromString(e);else if(u.isBuffer(e))this.fromBuffer(e);else{if(!r.isObject(e))throw new a.InvalidArgument("Must provide an object or string to deserialize a transaction");this.fromObject(e)}}else this._newTransaction()}var I=1,T=0,j=1e6;A.DUST_AMOUNT=546,A.FEE_SECURITY_MARGIN=15,A.MAX_MONEY=21e14,A.NLOCKTIME_BLOCKHEIGHT_LIMIT=5e8,A.NLOCKTIME_MAX_VALUE=4294967295,A.FEE_PER_KB=1e4,A.CHANGE_OUTPUT_MAX_SIZE=62,A.MAXIMUM_EXTRA_SIZE=26,A.shallowCopy=function(e){var t=new A(e.toBuffer());return t};var O={configurable:!1,enumerable:!0,get:function(){return new c(this._getHash()).readReverse().toString("hex")}};Object.defineProperty(A.prototype,"hash",O),Object.defineProperty(A.prototype,"id",O);var P={configurable:!1,enumerable:!0,get:function(){return this._getInputAmount()}};Object.defineProperty(A.prototype,"inputAmount",P),P.get=function(){return this._getOutputAmount()},Object.defineProperty(A.prototype,"outputAmount",P),A.prototype._getHash=function(){return h.sha256sha256(this.toBuffer())},A.prototype.serialize=function(e){return!0===e||e&&e.disableAll?this.uncheckedSerialize():this.checkedSerialize(e)},A.prototype.uncheckedSerialize=A.prototype.toString=function(){return this.toBuffer().toString("hex")},A.prototype.checkedSerialize=function(e){var t=this.getSerializationError(e);if(t)throw t.message+=" Use Transaction#uncheckedSerialize if you want to skip security checks. See http://bitcore.io/guide/transaction.html#Serialization for more info.",t;return this.uncheckedSerialize()},A.prototype.invalidSatoshis=function(){for(var e=!1,t=0;tn)return this._missingChange()?new a.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new a.Transaction.FeeError.TooLarge("expected less than "+n+" but got "+t)}if(!e.disableSmallFees){var i=Math.ceil(this._estimateFee()/A.FEE_SECURITY_MARGIN);if(t"},A.prototype.toBuffer=function(){var e=new f;return this.toBufferWriter(e).toBuffer()},A.prototype.toBufferWriter=function(e){return e.writeUInt32LE(this.version),e.writeVarintNum(this.inputs.length),r.each(this.inputs,function(t){t.toBufferWriter(e)}),e.writeVarintNum(this.outputs.length),r.each(this.outputs,function(t){t.toBufferWriter(e)}),e.writeUInt32LE(this.nLockTime),this.version>=2&&(e.writeVarintNum(this.joinSplits.length),r.each(this.joinSplits,function(t){t.toBufferWriter(e)}),this.joinSplits.length>0&&(e.write(this.joinSplitPubKey),e.write(this.joinSplitSig))),e},A.prototype.fromBuffer=function(e){var t=new c(e);return this.fromBufferReader(t)},A.prototype.fromBufferReader=function(e){var t,n,r,o;for(i.checkArgument(!e.finished(),"No transaction data received"),this.version=e.readUInt32LE(),n=e.readVarintNum(),t=0;t=2){for(o=e.readVarintNum(),t=0;t0&&(this.joinSplitPubKey=e.read(32),this.joinSplitSig=e.read(64))}return this},A.prototype.toObject=A.prototype.toJSON=function e(){var t=[];this.inputs.forEach(function(e){t.push(e.toObject())});var n=[];this.outputs.forEach(function(e){n.push(e.toObject())});var i={hash:this.hash,version:this.version,inputs:t,outputs:n,nLockTime:this.nLockTime};if(this.version>=2){var o=[];this.joinSplits.forEach(function(e){o.push(e.toObject())}),i.joinSplits=o,this.joinSplits.length>0&&(i.joinSplitPubKey=u.reverse(this.joinSplitPubKey).toString("hex"),i.joinSplitSig=this.joinSplitSig.toString("hex"))}return this._changeScript&&(i.changeScript=this._changeScript.toString()),r.isUndefined(this._changeIndex)||(i.changeIndex=this._changeIndex),r.isUndefined(this._fee)||(i.fee=this._fee),i},A.prototype.fromObject=function e(n){i.checkArgument(r.isObject(n)||n instanceof A);var o=this,s;return s=n instanceof A?s.toObject():n,r.each(s.inputs,function(e){if(e.output&&e.output.script){var t=new S(e.output.script),n;if(t.isPublicKeyHashOut())n=new y.PublicKeyHash(e);else if(t.isScriptHashOut()&&e.publicKeys&&e.threshold)n=new y.MultiSigScriptHash(e,e.publicKeys,e.threshold,e.signatures);else{if(!t.isPublicKeyOut())throw new a.Transaction.Input.UnsupportedScript(e.output.script);n=new y.PublicKey(e)}o.addInput(n)}else o.uncheckedAddInput(new y(e))}),r.each(s.outputs,function(e){o.addOutput(new k(e))}),s.changeIndex&&(this._changeIndex=s.changeIndex),s.changeScript&&(this._changeScript=new S(s.changeScript)),s.fee&&(this._fee=s.fee),this.nLockTime=s.nLockTime,this.version=s.version,this.version>=2&&(r.each(s.joinSplits,function(e){o.joinSplits.push(new C(e))}),o.joinSplits.length>0&&(o.joinSplitPubKey=u.reverse(new t(s.joinSplitPubKey,"hex")),o.joinSplitSig=new t(s.joinSplitSig,"hex"))),this._checkConsistency(n),this},A.prototype._checkConsistency=function(e){r.isUndefined(this._changeIndex)||(i.checkState(this._changeScript),i.checkState(this.outputs[this._changeIndex]),i.checkState(this.outputs[this._changeIndex].script.toString()===this._changeScript.toString())),e&&e.hash&&i.checkState(e.hash===this.hash,"Hash in object does not match transaction hash")},A.prototype.lockUntilDate=function(e){if(i.checkArgument(e),r.isNumber(e)&&e=A.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new a.Transaction.BlockHeightTooHigh;if(e<0)throw new a.Transaction.NLockTimeOutOfRange;for(var t=0;t0?(this._changeIndex=this.outputs.length,this._addOutput(new k({script:this._changeScript,satoshis:n}))):this._changeIndex=void 0}},A.prototype.getFee=function(){return this.isCoinbase()?0:r.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee},A.prototype._estimateFee=function(){var e=this._estimateSize(),t=this._getUnspentValue();return A._estimateFee(e,t,this._feePerKb)},A.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()},A.prototype._clearSignatures=function(){r.each(this.inputs,function(e){e.clearSignatures()})},A._estimateFee=function(e,t,n){var r=Math.ceil(e/1e3)*(n||A.FEE_PER_KB);return t>r&&(e+=A.CHANGE_OUTPUT_MAX_SIZE),Math.ceil(e/1e3)*(n||A.FEE_PER_KB)},A.prototype._estimateSize=function(){var e=A.MAXIMUM_EXTRA_SIZE;return r.each(this.inputs,function(t){e+=t._estimateSize()}),r.each(this.outputs,function(t){e+=t.script.toBuffer().length+9}),e},A.prototype._removeOutput=function(e){var t=this.outputs[e];this.outputs=r.without(this.outputs,t),this._outputAmount=void 0},A.prototype.removeOutput=function(e){this._removeOutput(e),this._updateChangeOutput()},A.prototype.sort=function(){return this.sortInputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(e,t){return s(e.prevTxId,t.prevTxId)||e.outputIndex-t.outputIndex}),t}),this.sortOutputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(e,t){return e.satoshis-t.satoshis||s(e.script.toBuffer(),t.script.toBuffer())}),t}),this},A.prototype.shuffleOutputs=function(){return this.sortOutputs(r.shuffle)},A.prototype.sortOutputs=function(e){var t=e(this.outputs);return this._newOutputOrder(t)},A.prototype.sortInputs=function(e){return this.inputs=e(this.inputs),this._clearSignatures(),this},A.prototype._newOutputOrder=function(e){var t=this.outputs.length!==e.length||0!==r.difference(this.outputs,e).length;if(t)throw new a.Transaction.InvalidSorting;if(!r.isUndefined(this._changeIndex)){var n=this.outputs[this._changeIndex];this._changeIndex=r.findIndex(e,n)}return this.outputs=e,this},A.prototype.removeInput=function(e,t){var n;if(n=!t&&r.isNumber(e)?e:r.findIndex(this.inputs,function(n){return n.prevTxId.toString("hex")===e&&n.outputIndex===t}),n<0||n>=this.inputs.length)throw new a.Transaction.InvalidIndex(n,this.inputs.length);var i=this.inputs[n];this.inputs=r.without(this.inputs,i),this._inputAmount=void 0,this._updateChangeOutput()},A.prototype.sign=function(e,t){i.checkState(this.hasAllUtxoInfo());var n=this;return r.isArray(e)?(r.each(e,function(e){n.sign(e,t)}),this):(r.each(this.getSignatures(e,t),function(e){n.applySignature(e)}),this)},A.prototype.getSignatures=function(e,t){e=new E(e),t=t||p.SIGHASH_ALL;var n=this,i=[],o=h.sha256ripemd160(e.publicKey.toBuffer());return r.each(this.inputs,function s(a,u){r.each(a.getSignatures(n,e,u,t,o),function(e){i.push(e)})}),i},A.prototype.applySignature=function(e){return this.inputs[e.inputIndex].addSignature(this,e),this},A.prototype.isFullySigned=function(){return r.each(this.inputs,function(e){if(e.isFullySigned===y.prototype.isFullySigned)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction")}),r.all(r.map(this.inputs,function(e){return e.isFullySigned()}))},A.prototype.isValidSignature=function(e){var t=this;if(this.inputs[e.inputIndex].isValidSignature===y.prototype.isValidSignature)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction");return this.inputs[e.inputIndex].isValidSignature(this,e)},A.prototype.verifySignature=function(e,t,n,r){return d.verify(this,e,t,n,r)},A.prototype.verify=function(){if(0===this.inputs.length)return"transaction txins empty";if(0===this.outputs.length)return"transaction txouts empty";for(var e=new x(0),t=0;t1e6)return"transaction over the maximum block size";var i={};for(t=0;t100)return"coinbase transaction script size invalid"}else for(t=0;t=y.MAXINT-1&&(t.sequenceNumber=y.DEFAULT_RBF_SEQNUMBER)}return this},e.exports=A}).call(this,n(0).Buffer)},function(e,t,n){e.exports=n(197),e.exports.PublicKey=n(1448),e.exports.PublicKeyHash=n(1449),e.exports.MultiSig=n(1450),e.exports.MultiSigScriptHash=n(1451)},function(e,t,n){"use strict";var r=n(17),i=n(84),o=n(25),s={BTC:[1e8,8],mBTC:[1e5,5],uBTC:[100,2],bits:[100,2],satoshis:[1,0]};function a(e,t){if(!(this instanceof a))return new a(e,t);if(r.isNumber(t)){if(t<=0)throw new i.Unit.InvalidRate(t);e/=t,t=a.BTC}this._value=this._from(e,t);var n=this,o=function(e){Object.defineProperty(n,e,{get:function(){return n.to(e)},enumerable:!0})};Object.keys(s).forEach(o)}Object.keys(s).forEach(function(e){a[e]=e}),a.fromObject=function e(t){return o.checkArgument(r.isObject(t),"Argument is expected to be an object"),new a(t.amount,t.code)},a.fromBTC=function(e){return new a(e,a.BTC)},a.fromMillis=a.fromMilis=function(e){return new a(e,a.mBTC)},a.fromMicros=a.fromBits=function(e){return new a(e,a.bits)},a.fromSatoshis=function(e){return new a(e,a.satoshis)},a.fromFiat=function(e,t){return new a(e,t)},a.prototype._from=function(e,t){if(!s[t])throw new i.Unit.UnknownCode(t);return parseInt((e*s[t][0]).toFixed())},a.prototype.to=function(e){if(r.isNumber(e)){if(e<=0)throw new i.Unit.InvalidRate(e);return parseFloat((this.BTC*e).toFixed(2))}if(!s[e])throw new i.Unit.UnknownCode(e);var t=this._value/s[e][0];return parseFloat(t.toFixed(s[e][1]))},a.prototype.toBTC=function(){return this.to(a.BTC)},a.prototype.toMillis=a.prototype.toMilis=function(){return this.to(a.mBTC)},a.prototype.toMicros=a.prototype.toBits=function(){return this.to(a.bits)},a.prototype.toSatoshis=function(){return this.to(a.satoshis)},a.prototype.atRate=function(e){return this.to(e)},a.prototype.toString=function(){return this.satoshis+" satoshis"},a.prototype.toObject=a.prototype.toJSON=function e(){return{amount:this.BTC,code:a.BTC}},a.prototype.inspect=function(){return""},e.exports=a},function(e,t,n){"use strict";e.exports={_cache:{},_count:0,_eraseIndex:0,_usedList:{},_usedIndex:{},_CACHE_SIZE:5e3,get:function(e,t,n){n=!!n;var r=e+"/"+t+"/"+n;if(this._cache[r])return this._cacheHit(r),this._cache[r]},set:function(e,t,n,r){n=!!n;var i=e+"/"+t+"/"+n;this._cache[i]=r,this._cacheHit(i)},_cacheHit:function(e){this._usedIndex[e]&&delete this._usedList[this._usedIndex[e]],this._usedList[this._count]=e,this._usedIndex[e]=this._count,this._count++,this._cacheRemove()},_cacheRemove:function(){for(;this._eraseIndex{const n=o(e,t);return(e,t,o)=>{const s=r(o),a=n(t),u=i(e=>s(null,e));a.once("error",s),a.pipe(u),a.write(e),a.end()}})},function(e,t,n){"use strict";const r=n(59),i=n(1488),o=n(20).Readable;class s extends o{constructor(e){const t=Object.assign(e||{},{objectMode:!0});super(t)}_read(){}}const a=(e,t)=>{let n=new s,o=i.extract();o.on("entry",(e,t,r)=>{t.on("end",r),"directory"!==e.type?n.push({path:e.name,content:t}):(n.push({path:e.name}),t.resume())}).on("finish",()=>n.push(null)),r(e,o),t(null,n)};e.exports=a},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i=Array.isArray,o=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),s=function e(t){for(;t.length>1;){var n=t.pop(),r=n.obj[n.prop];if(i(r)){for(var o=[],s=0;s=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122?s+=i.charAt(a):u<128?s+=o[u]:u<2048?s+=o[192|u>>6]+o[128|63&u]:u<55296||u>=57344?s+=o[224|u>>12]+o[128|u>>6&63]+o[128|63&u]:(a+=1,u=65536+((1023&u)<<10|1023&i.charCodeAt(a)),s+=o[240|u>>18]+o[128|u>>12&63]+o[128|u>>6&63]+o[128|63&u])}return s},h=function e(t){for(var n=[{obj:{o:t},prop:"o"}],r=[],i=0;i1;class m{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");const t=this[i]=e.max||1/0,n=e.length||d;if(this[s]="function"!=typeof n?d:n,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[u]=e.maxAge||0,this[l]=e.dispose,this[c]=e.noDisposeOnSet||!1,this[p]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||1/0,b(this)}get max(){return this[i]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[u]=e,b(this)}get maxAge(){return this[u]}set lengthCalculator(e){"function"!=typeof e&&(e=d),e!==this[s]&&(this[s]=e,this[o]=0,this[f].forEach(e=>{e.length=this[s](e.value,e.key),this[o]+=e.length})),b(this)}get lengthCalculator(){return this[s]}get length(){return this[o]}get itemCount(){return this[f].length}rforEach(e,t){t=t||this;for(let n=this[f].tail;null!==n;){const r=n.prev;_(this,e,n,t),n=r}}forEach(e,t){t=t||this;for(let n=this[f].head;null!==n;){const r=n.next;_(this,e,n,t),n=r}}keys(){return this[f].toArray().map(e=>e.key)}values(){return this[f].toArray().map(e=>e.value)}reset(){this[l]&&this[f]&&this[f].length&&this[f].forEach(e=>this[l](e.key,e.value)),this[h]=new Map,this[f]=new r,this[o]=0}dump(){return this[f].map(e=>!y(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[f]}set(e,t,n){if(n=n||this[u],n&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const r=n?Date.now():0,a=this[s](t,e);if(this[h].has(e)){if(a>this[i])return v(this,this[h].get(e)),!1;const s=this[h].get(e),u=s.value;return this[l]&&(this[c]||this[l](e,u.value)),u.now=r,u.maxAge=n,u.value=t,this[o]+=a-u.length,u.length=a,this.get(e),b(this),!0}const p=new w(e,t,a,r,n);return p.length>this[i]?(this[l]&&this[l](e,t),!1):(this[o]+=p.length,this[f].unshift(p),this[h].set(e,this[f].head),b(this),!0)}has(e){if(!this[h].has(e))return!1;const t=this[h].get(e).value;return!y(this,t)}get(e){return g(this,e,!0)}peek(e){return g(this,e,!1)}pop(){const e=this[f].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[h].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{const e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[h].forEach((e,t)=>g(this,t,!1))}}const g=(e,t,n)=>{const r=e[h].get(t);if(r){const t=r.value;if(y(e,t)){if(v(e,r),!e[a])return}else n&&(e[p]&&(r.value.now=Date.now()),e[f].unshiftNode(r));return t.value}},y=(e,t)=>{if(!t||!t.maxAge&&!e[u])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[u]&&n>e[u]},b=e=>{if(e[o]>e[i])for(let t=e[f].tail;e[o]>e[i]&&null!==t;){const n=t.prev;v(e,t),t=n}},v=(e,t)=>{if(t){const n=t.value;e[l]&&e[l](n.key,n.value),e[o]-=n.length,e[h].delete(n.key),e[f].removeNode(t)}};class w{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}}const _=(e,t,n,r)=>{let i=n.value;y(e,i)&&(v(e,n),e[a]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};e.exports=m},function(e,t,n){"use strict";const r=n(112);function i(e,t,n){"function"==typeof e.pipe?r(e,(e,r)=>{if(e)return n(e);t(r,n)}):t(e,n)}e.exports=i},function(e,t,n){"use strict";const r=n(20).Transform,i=n(1569);class o extends r{constructor(e){const t=Object.assign(e||{},{objectMode:!0});super(t)}_transform(e,t,n){try{const t=i(e);if(this.push(t),!t.success)throw new Error(t.text)}catch(e){return n(e)}n()}}e.exports=o},function(e,t,n){"use strict";const r=n(62);e.exports=(e=>({totalIn:new r(e.TotalIn),totalOut:new r(e.TotalOut),rateIn:new r(e.RateIn),rateOut:new r(e.RateOut)}))},function(e,t,n){(function(t){e.exports=f;const r=n(655),i=n(1754),o=n(154),s=n(203),a=n(28),u=n(169),l=n(32),c=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;function f(e,n){if(e=Object.assign({maxRedirects:10},"string"==typeof e?{url:e}:e),n=a(n),e.url){const{hostname:t,port:n,protocol:r,auth:i,path:o}=l.parse(e.url);delete e.url,t||n||r||i?Object.assign(e,{hostname:t,port:n,protocol:r,auth:i,path:o}):e.path=o}const r={"accept-encoding":"gzip, deflate"};let h;e.headers&&Object.keys(e.headers).forEach(t=>r[t.toLowerCase()]=e.headers[t]),e.headers=r,e.body?h=e.json&&!c(e.body)?JSON.stringify(e.body):e.body:e.form&&(h="string"==typeof e.form?e.form:u.stringify(e.form),e.headers["content-type"]="application/x-www-form-urlencoded"),h&&(e.method||(e.method="POST"),c(h)||(e.headers["content-length"]=t.byteLength(h)),e.json&&!e.form&&(e.headers["content-type"]="application/json")),delete e.body,delete e.form,e.json&&(e.headers.accept="application/json"),e.method&&(e.method=e.method.toUpperCase());const p="https:"===e.protocol?s:o,d=p.request(e,t=>{if(t.statusCode>=300&&t.statusCode<400&&t.headers.location)return e.url=t.headers.location,delete e.headers.host,t.resume(),"POST"===e.method&&[301,302].includes(t.statusCode)&&(e.method="GET",delete e.headers["content-length"],delete e.headers["content-type"]),0==e.maxRedirects--?n(new Error("too many redirects")):f(e,n);const r="function"==typeof i&&"HEAD"!==e.method;n(null,r?i(t):t)});return d.on("timeout",()=>{d.abort(),n(new Error("Request timed out"))}),d.on("error",n),c(h)?h.on("error",n).pipe(d):d.end(h),d}f.concat=((e,t)=>f(e,(n,i)=>{if(n)return t(n);r(i,(n,r)=>{if(n)return t(n);if(e.json)try{r=JSON.parse(r.toString())}catch(n){return t(n,i,r)}t(null,i,r)})})),["get","post","put","patch","head","delete"].forEach(e=>{f[e]=((t,n)=>("string"==typeof t&&(t={url:t}),f(Object.assign({method:e.toUpperCase()},t),n)))})}).call(this,n(0).Buffer)},function(e,t){var n=1,r=65535,i=4,o,s=function(){n=n+1&65535};e.exports=function(e){o||(o=setInterval(s,250),o.unref&&o.unref());var t=4*(e||5),r=[0],i=1,a=n-1&65535;return function(e){var o=n-a&65535;for(o>t&&(o=t),a=n;o--;)i===t&&(i=0),r[i]=r[0===i?t-1:i-1],i++;e&&(r[i-1]+=e);var s=r[i-1],u=r.length=4"},homepage:"https://webtorrent.io",keywords:["bittorrent","bittorrent client","download","mad science","p2p","peer-to-peer","peers","streaming","swarm","torrent","web torrent","webrtc","webrtc data","webtorrent"],license:"MIT",main:"index.js",repository:{type:"git",url:"git://github.com/webtorrent/webtorrent.git"},scripts:{build:"browserify -s WebTorrent -e ./ | minify > webtorrent.min.js","build-debug":"browserify -s WebTorrent -e ./ > webtorrent.debug.js",size:"npm run build && cat webtorrent.min.js | gzip | wc -c",test:"standard && npm run test-node && npm run test-browser","test-browser":"airtap -- test/*.js test/browser/*.js","test-browser-local":"airtap --local -- test/*.js test/browser/*.js","test-node":"tape test/*.js test/node/*.js","update-authors":"./scripts/update-authors.sh"}}},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function e(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===i.call(t)},u=function e(t){if(!t||"[object Object]"!==i.call(t))return!1;var n=r.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&r.call(t.constructor.prototype,"isPrototypeOf"),s;if(t.constructor&&!n&&!o)return!1;for(s in t);return void 0===s||r.call(t,s)},l=function e(t,n){o&&"__proto__"===n.name?o(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},c=function e(t,n){if("__proto__"===n){if(!r.call(t,n))return;if(s)return s(t,n).value}return t[n]};e.exports=function e(){var t,n,r,i,o,s,f=arguments[0],h=1,p=arguments.length,d=!1;for("boolean"==typeof f&&(d=f,f=arguments[1]||{},h=2),(null==f||"object"!=typeof f&&"function"!=typeof f)&&(f={});h32;)t=t.slice(1);var n=this._priv;r.strictEqual(t.length,32),r.strictEqual(n.length,32);var i=u.box.before(new Uint8Array(t),new Uint8Array(n));return o.from(i)}throw new Error("Invalid algorithm: "+this._algo)},m.prototype.generateKey=function(){var e=[],t,n;if("dsa"===this._algo)return this._dh.generateKeys(),e.push({name:"p",data:this._p.data}),e.push({name:"q",data:this._key.part.q.data}),e.push({name:"g",data:this._g.data}),e.push({name:"y",data:this._dh.getPublicKey()}),e.push({name:"x",data:this._dh.getPrivateKey()}),this._key=new c({type:"dsa",parts:e}),this._isPriv=!0,this._key;if("ecdsa"===this._algo){if(f)return this._dh.generateKeys(),e.push({name:"curve",data:o.from(this._curve)}),e.push({name:"Q",data:this._dh.getPublicKey()}),e.push({name:"d",data:this._dh.getPrivateKey()}),this._key=new c({type:"ecdsa",curve:this._curve,parts:e}),this._isPriv=!0,this._key;var s=this._ecParams.getN(),a=new d(i.randomBytes(s.bitLength())),l=s.subtract(d.ONE);return t=a.mod(l).add(d.ONE),n=this._ecParams.getG().multiply(t),t=o.from(t.toByteArray()),n=o.from(this._ecParams.getCurve().encodePointHex(n),"hex"),this._priv=new b(this._ecParams,t),e.push({name:"curve",data:o.from(this._curve)}),e.push({name:"Q",data:n}),e.push({name:"d",data:t}),this._key=new c({type:"ecdsa",curve:this._curve,parts:e}),this._isPriv=!0,this._key}if("curve25519"===this._algo){var h=u.box.keyPair();return t=o.from(h.secretKey),n=o.from(h.publicKey),t=o.concat([t,n]),r.strictEqual(t.length,64),r.strictEqual(n.length,32),e.push({name:"A",data:n}),e.push({name:"k",data:t}),this._key=new c({type:"curve25519",parts:e}),this._isPriv=!0,this._key}throw new Error("Invalid algorithm: "+this._algo)},m.prototype.generateKeys=m.prototype.generateKey,g.prototype.getCurve=function(){return this.curve},g.prototype.getG=function(){return this.g},g.prototype.getN=function(){return this.n},g.prototype.getH=function(){return this.h},b.prototype.deriveSharedSecret=function(e){r.ok(e instanceof y);var t=e._pub.multiply(this._priv);return o.from(t.getX().toBigInteger().toByteArray())}},function(e,t,n){e.exports={read:p,readPkcs1:g,write:d,writePkcs1:E};var r=n(27),i=n(103),o=n(31).Buffer,s=n(55),a=n(47),u=n(46),l=n(50),c=n(113),f=n(211),h=f.readECDSACurve;function p(e,t){return c.read(e,t,"pkcs1")}function d(e,t){return c.write(e,t,"pkcs1")}function m(e,t){return r.strictEqual(e.peek(),i.Ber.Integer,t+" is not an Integer"),a.mpNormalize(e.readString(i.Ber.Integer,!0))}function g(e,t,n){switch(e){case"RSA":if("public"===t)return y(n);if("private"===t)return b(n);throw new Error("Unknown key type: "+t);case"DSA":if("public"===t)return _(n);if("private"===t)return v(n);throw new Error("Unknown key type: "+t);case"EC":case"ECDSA":if("private"===t)return S(n);if("public"===t)return k(n);throw new Error("Unknown key type: "+t);case"EDDSA":case"EdDSA":if("private"===t)return w(n);throw new Error(t+" keys not supported with EdDSA");default:throw new Error("Unknown key algo: "+e)}}function y(e){var t=m(e,"modulus"),n=m(e,"exponent"),r={type:"rsa",parts:[{name:"e",data:n},{name:"n",data:t}]};return new u(r)}function b(e){var t=m(e,"version");r.strictEqual(t[0],0);var n=m(e,"modulus"),i=m(e,"public exponent"),o=m(e,"private exponent"),s=m(e,"prime1"),a=m(e,"prime2"),u=m(e,"exponent1"),c=m(e,"exponent2"),f=m(e,"iqmp"),h={type:"rsa",parts:[{name:"n",data:n},{name:"e",data:i},{name:"d",data:o},{name:"iqmp",data:f},{name:"p",data:s},{name:"q",data:a},{name:"dmodp",data:u},{name:"dmodq",data:c}]};return new l(h)}function v(e){var t=m(e,"version");r.strictEqual(t.readUInt8(0),0);var n=m(e,"p"),i=m(e,"q"),o=m(e,"g"),s=m(e,"y"),a=m(e,"x"),u={type:"dsa",parts:[{name:"p",data:n},{name:"q",data:i},{name:"g",data:o},{name:"y",data:s},{name:"x",data:a}]};return new l(u)}function w(e){var t=m(e,"version");r.strictEqual(t.readUInt8(0),1);var n=e.readString(i.Ber.OctetString,!0);e.readSequence(160);var o=e.readOID();r.strictEqual(o,"1.3.101.112","the ed25519 curve identifier"),e.readSequence(161);var s=a.readBitString(e),u={type:"ed25519",parts:[{name:"A",data:a.zeroPadToLength(s,32)},{name:"k",data:n}]};return new l(u)}function _(e){var t=m(e,"y"),n=m(e,"p"),r=m(e,"q"),i=m(e,"g"),o={type:"dsa",parts:[{name:"y",data:t},{name:"p",data:n},{name:"q",data:r},{name:"g",data:i}]};return new u(o)}function k(e){e.readSequence();var t=e.readOID();r.strictEqual(t,"1.2.840.10045.2.1","must be ecPublicKey");for(var n=e.readOID(),l,c=Object.keys(s.curves),f=0;f>1,c=-7,f=n?i-1:0,h=n?-1:1,p=e[t+f];for(f+=h,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+e[t+f],f+=h,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+e[t+f],f+=h,c-=8);if(0===o)o=1-l;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=l}return(p?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,u,l=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+f>=1?h/u:h*Math.pow(2,1-f),t*u>=2&&(s++,u/=2),s+f>=c?(a=0,s=c):s+f>=1?(a=(t*u-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;e[n+p]=255&s,p+=d,s/=256,l-=8);e[n+p-d]|=128*m}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(){var t=(0,i.default)(arguments),n=t.pop();e.call(this,t,n)}};var r=n(104),i=o(r);function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(8))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=n(292),i=a(r),o=n(42),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t,n,r){(0,i.default)(t)(e,(0,s.default)(n),r)}e.exports=t.default},function(e,t,n){(function(e){var r=n(99),i=n(757),o=t&&!t.nodeType&&t,s=o&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===o,u=a?r.Buffer:void 0,l=u?u.isBuffer:void 0,c=l||i;e.exports=c}).call(this,n(75)(e))},function(e,t){var n=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function i(e,t){var i=typeof e;return t=null==t?n:t,!!t&&("number"==i||"symbol"!=i&&r.test(e))&&e>-1&&e%1==0&&e0)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=c(t)),r)o.endEmitted?e.emit("error",new k):P(e,o,t,!0);else if(o.ended)e.emit("error",new w);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?P(e,o,t,!1):U(e,o)):P(e,o,t,!1)}else r||(o.reading=!1,U(e,o));return!o.ended&&(o.length=R?e=R:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function M(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=N(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function L(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?F(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,D(e)))}}function F(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(D,e))}function D(e){var t=e._readableState;p("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||e.emit("readable"),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,$(e)}function U(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(z,e,t))}function z(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function H(e){p("readable nexttick read 0"),e.read(0)}function V(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(W,e,t))}function W(e,t){p("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),$(e),t.flowing&&!t.reading&&e.read(0)}function $(e){var t=e._readableState;for(p("flow",t.flowing);t.flowing&&null!==e.read(););}function G(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function Y(e){var t=e._readableState;p("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(J,t,e))}function J(e,t){p("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function Z(e,t){for(var n=0,r=e.length;n=t.highWaterMark:t.length>0)||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Y(this):F(this),null;if(e=M(e,t),0===e&&t.ended)return 0===t.length&&Y(this),null;var r=t.needReadable,i;return p("need readable",r),(0===t.length||t.length-e0?G(e,t):null,null===i?(t.needReadable=!0,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Y(this)),null!==i&&this.emit("data",i),i},j.prototype._read=function(e){this.emit("error",new _("_read()"))},j.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,p("pipe count=%d opts=%j",i.pipesCount,t);var o=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=o?l:b;function u(e,t){p("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,h())}function l(){p("onend"),e.end()}i.endEmitted?r.nextTick(a):n.once("end",a),e.on("unpipe",u);var c=q(n);e.on("drain",c);var f=!1;function h(){p("cleanup"),e.removeListener("close",g),e.removeListener("finish",y),e.removeListener("drain",c),e.removeListener("error",m),e.removeListener("unpipe",u),n.removeListener("end",l),n.removeListener("end",b),n.removeListener("data",d),f=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||c()}function d(t){p("ondata");var r=e.write(t);p("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==Z(i.pipes,e))&&!f&&(p("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function m(t){p("onerror",t),b(),e.removeListener("error",m),0===s(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",y),b()}function y(){p("onfinish"),e.removeListener("close",g),b()}function b(){p("unpipe"),n.unpipe(e)}return n.on("data",d),I(e,"error",m),e.once("close",g),e.once("finish",y),e.emit("pipe",n),i.flowing||(p("pipe resume"),n.resume()),e},j.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,p("on readable",i.length,i.reading),i.length?F(this):i.reading||r.nextTick(H,this))),n},j.prototype.addListener=j.prototype.on,j.prototype.removeListener=function(e,t){var n=a.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(K,this),n},j.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(K,this),t},j.prototype.resume=function(){var e=this._readableState;return e.flowing||(p("resume"),e.flowing=!e.readableListening,V(this,e)),e.paused=!1,this},j.prototype.pause=function(){return p("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(p("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},j.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",function(){if(p("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){if(p("wrapped data"),n.decoder&&(i=n.decoder.write(i)),(!n.objectMode||null!==i&&void 0!==i)&&(n.objectMode||i&&i.length)){var o=t.push(i);o||(r=!0,e.pause())}}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function t(n){return function t(){return e[n].apply(e,arguments)}}(i));for(var o=0;o-1))throw new E(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(I.prototype,"writableBuffer",{enumerable:!1,get:function e(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(I.prototype,"writableHighWaterMark",{enumerable:!1,get:function e(){return this._writableState.highWaterMark}}),I.prototype._write=function(e,t,n){n(new b("_write()"))},I.prototype._writev=null,I.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||H(this,r,n),this},Object.defineProperty(I.prototype,"writableLength",{enumerable:!1,get:function e(){return this._writableState.length}}),Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function e(){return void 0!==this._writableState&&this._writableState.destroyed},set:function e(t){this._writableState&&(this._writableState.destroyed=t)}}),I.prototype.destroy=p.destroy,I.prototype._undestroy=p.undestroy,I.prototype._destroy=function(e,t){t(e)}}).call(this,n(8),n(2))},function(e,t,n){"use strict";e.exports=c;var r=n(135).codes,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,s=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,u=n(136);function l(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.lengththis._repo.blocks.get(e,t),t):t(new Error("first arg must be an array of cids"))}delete(e,t){this._repo.blocks.delete(e,t)}}e.exports=i},function(e,t,n){"use strict";t.names=Object.freeze({id:0,sha1:17,"sha2-256":18,"sha2-512":19,"dbl-sha2-256":86,"sha3-224":23,"sha3-256":22,"sha3-384":21,"sha3-512":20,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,"murmur3-128":34,"murmur3-32":35,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"Skein256-8":45825,"Skein256-16":45826,"Skein256-24":45827,"Skein256-32":45828,"Skein256-40":45829,"Skein256-48":45830,"Skein256-56":45831,"Skein256-64":45832,"Skein256-72":45833,"Skein256-80":45834,"Skein256-88":45835,"Skein256-96":45836,"Skein256-104":45837,"Skein256-112":45838,"Skein256-120":45839,"Skein256-128":45840,"Skein256-136":45841,"Skein256-144":45842,"Skein256-152":45843,"Skein256-160":45844,"Skein256-168":45845,"Skein256-176":45846,"Skein256-184":45847,"Skein256-192":45848,"Skein256-200":45849,"Skein256-208":45850,"Skein256-216":45851,"Skein256-224":45852,"Skein256-232":45853,"Skein256-240":45854,"Skein256-248":45855,"Skein256-256":45856,"Skein512-8":45857,"Skein512-16":45858,"Skein512-24":45859,"Skein512-32":45860,"Skein512-40":45861,"Skein512-48":45862,"Skein512-56":45863,"Skein512-64":45864,"Skein512-72":45865,"Skein512-80":45866,"Skein512-88":45867,"Skein512-96":45868,"Skein512-104":45869,"Skein512-112":45870,"Skein512-120":45871,"Skein512-128":45872,"Skein512-136":45873,"Skein512-144":45874,"Skein512-152":45875,"Skein512-160":45876,"Skein512-168":45877,"Skein512-176":45878,"Skein512-184":45879,"Skein512-192":45880,"Skein512-200":45881,"Skein512-208":45882,"Skein512-216":45883,"Skein512-224":45884,"Skein512-232":45885,"Skein512-240":45886,"Skein512-248":45887,"Skein512-256":45888,"Skein512-264":45889,"Skein512-272":45890,"Skein512-280":45891,"Skein512-288":45892,"Skein512-296":45893,"Skein512-304":45894,"Skein512-312":45895,"Skein512-320":45896,"Skein512-328":45897,"Skein512-336":45898,"Skein512-344":45899,"Skein512-352":45900,"Skein512-360":45901,"Skein512-368":45902,"Skein512-376":45903,"Skein512-384":45904,"Skein512-392":45905,"Skein512-400":45906,"Skein512-408":45907,"Skein512-416":45908,"Skein512-424":45909,"Skein512-432":45910,"Skein512-440":45911,"Skein512-448":45912,"Skein512-456":45913,"Skein512-464":45914,"Skein512-472":45915,"Skein512-480":45916,"Skein512-488":45917,"Skein512-496":45918,"Skein512-504":45919,"Skein512-512":45920,"Skein1024-8":45921,"Skein1024-16":45922,"Skein1024-24":45923,"Skein1024-32":45924,"Skein1024-40":45925,"Skein1024-48":45926,"Skein1024-56":45927,"Skein1024-64":45928,"Skein1024-72":45929,"Skein1024-80":45930,"Skein1024-88":45931,"Skein1024-96":45932,"Skein1024-104":45933,"Skein1024-112":45934,"Skein1024-120":45935,"Skein1024-128":45936,"Skein1024-136":45937,"Skein1024-144":45938,"Skein1024-152":45939,"Skein1024-160":45940,"Skein1024-168":45941,"Skein1024-176":45942,"Skein1024-184":45943,"Skein1024-192":45944,"Skein1024-200":45945,"Skein1024-208":45946,"Skein1024-216":45947,"Skein1024-224":45948,"Skein1024-232":45949,"Skein1024-240":45950,"Skein1024-248":45951,"Skein1024-256":45952,"Skein1024-264":45953,"Skein1024-272":45954,"Skein1024-280":45955,"Skein1024-288":45956,"Skein1024-296":45957,"Skein1024-304":45958,"Skein1024-312":45959,"Skein1024-320":45960,"Skein1024-328":45961,"Skein1024-336":45962,"Skein1024-344":45963,"Skein1024-352":45964,"Skein1024-360":45965,"Skein1024-368":45966,"Skein1024-376":45967,"Skein1024-384":45968,"Skein1024-392":45969,"Skein1024-400":45970,"Skein1024-408":45971,"Skein1024-416":45972,"Skein1024-424":45973,"Skein1024-432":45974,"Skein1024-440":45975,"Skein1024-448":45976,"Skein1024-456":45977,"Skein1024-464":45978,"Skein1024-472":45979,"Skein1024-480":45980,"Skein1024-488":45981,"Skein1024-496":45982,"Skein1024-504":45983,"Skein1024-512":45984,"Skein1024-520":45985,"Skein1024-528":45986,"Skein1024-536":45987,"Skein1024-544":45988,"Skein1024-552":45989,"Skein1024-560":45990,"Skein1024-568":45991,"Skein1024-576":45992,"Skein1024-584":45993,"Skein1024-592":45994,"Skein1024-600":45995,"Skein1024-608":45996,"Skein1024-616":45997,"Skein1024-624":45998,"Skein1024-632":45999,"Skein1024-640":46e3,"Skein1024-648":46001,"Skein1024-656":46002,"Skein1024-664":46003,"Skein1024-672":46004,"Skein1024-680":46005,"Skein1024-688":46006,"Skein1024-696":46007,"Skein1024-704":46008,"Skein1024-712":46009,"Skein1024-720":46010,"Skein1024-728":46011,"Skein1024-736":46012,"Skein1024-744":46013,"Skein1024-752":46014,"Skein1024-760":46015,"Skein1024-768":46016,"Skein1024-776":46017,"Skein1024-784":46018,"Skein1024-792":46019,"Skein1024-800":46020,"Skein1024-808":46021,"Skein1024-816":46022,"Skein1024-824":46023,"Skein1024-832":46024,"Skein1024-840":46025,"Skein1024-848":46026,"Skein1024-856":46027,"Skein1024-864":46028,"Skein1024-872":46029,"Skein1024-880":46030,"Skein1024-888":46031,"Skein1024-896":46032,"Skein1024-904":46033,"Skein1024-912":46034,"Skein1024-920":46035,"Skein1024-928":46036,"Skein1024-936":46037,"Skein1024-944":46038,"Skein1024-952":46039,"Skein1024-960":46040,"Skein1024-968":46041,"Skein1024-976":46042,"Skein1024-984":46043,"Skein1024-992":46044,"Skein1024-1000":46045,"Skein1024-1008":46046,"Skein1024-1016":46047,"Skein1024-1024":46048}),t.codes=Object.freeze({17:"sha1",18:"sha2-256",19:"sha2-512",86:"dbl-sha2-256",23:"sha3-224",22:"sha3-256",21:"sha3-384",20:"sha3-512",24:"shake-128",25:"shake-256",26:"keccak-224",27:"keccak-256",28:"keccak-384",29:"keccak-512",34:"murmur3-128",35:"murmur3-32",45569:"blake2b-8",45570:"blake2b-16",45571:"blake2b-24",45572:"blake2b-32",45573:"blake2b-40",45574:"blake2b-48",45575:"blake2b-56",45576:"blake2b-64",45577:"blake2b-72",45578:"blake2b-80",45579:"blake2b-88",45580:"blake2b-96",45581:"blake2b-104",45582:"blake2b-112",45583:"blake2b-120",45584:"blake2b-128",45585:"blake2b-136",45586:"blake2b-144",45587:"blake2b-152",45588:"blake2b-160",45589:"blake2b-168",45590:"blake2b-176",45591:"blake2b-184",45592:"blake2b-192",45593:"blake2b-200",45594:"blake2b-208",45595:"blake2b-216",45596:"blake2b-224",45597:"blake2b-232",45598:"blake2b-240",45599:"blake2b-248",45600:"blake2b-256",45601:"blake2b-264",45602:"blake2b-272",45603:"blake2b-280",45604:"blake2b-288",45605:"blake2b-296",45606:"blake2b-304",45607:"blake2b-312",45608:"blake2b-320",45609:"blake2b-328",45610:"blake2b-336",45611:"blake2b-344",45612:"blake2b-352",45613:"blake2b-360",45614:"blake2b-368",45615:"blake2b-376",45616:"blake2b-384",45617:"blake2b-392",45618:"blake2b-400",45619:"blake2b-408",45620:"blake2b-416",45621:"blake2b-424",45622:"blake2b-432",45623:"blake2b-440",45624:"blake2b-448",45625:"blake2b-456",45626:"blake2b-464",45627:"blake2b-472",45628:"blake2b-480",45629:"blake2b-488",45630:"blake2b-496",45631:"blake2b-504",45632:"blake2b-512",45633:"blake2s-8",45634:"blake2s-16",45635:"blake2s-24",45636:"blake2s-32",45637:"blake2s-40",45638:"blake2s-48",45639:"blake2s-56",45640:"blake2s-64",45641:"blake2s-72",45642:"blake2s-80",45643:"blake2s-88",45644:"blake2s-96",45645:"blake2s-104",45646:"blake2s-112",45647:"blake2s-120",45648:"blake2s-128",45649:"blake2s-136",45650:"blake2s-144",45651:"blake2s-152",45652:"blake2s-160",45653:"blake2s-168",45654:"blake2s-176",45655:"blake2s-184",45656:"blake2s-192",45657:"blake2s-200",45658:"blake2s-208",45659:"blake2s-216",45660:"blake2s-224",45661:"blake2s-232",45662:"blake2s-240",45663:"blake2s-248",45664:"blake2s-256",45825:"Skein256-8",45826:"Skein256-16",45827:"Skein256-24",45828:"Skein256-32",45829:"Skein256-40",45830:"Skein256-48",45831:"Skein256-56",45832:"Skein256-64",45833:"Skein256-72",45834:"Skein256-80",45835:"Skein256-88",45836:"Skein256-96",45837:"Skein256-104",45838:"Skein256-112",45839:"Skein256-120",45840:"Skein256-128",45841:"Skein256-136",45842:"Skein256-144",45843:"Skein256-152",45844:"Skein256-160",45845:"Skein256-168",45846:"Skein256-176",45847:"Skein256-184",45848:"Skein256-192",45849:"Skein256-200",45850:"Skein256-208",45851:"Skein256-216",45852:"Skein256-224",45853:"Skein256-232",45854:"Skein256-240",45855:"Skein256-248",45856:"Skein256-256",45857:"Skein512-8",45858:"Skein512-16",45859:"Skein512-24",45860:"Skein512-32",45861:"Skein512-40",45862:"Skein512-48",45863:"Skein512-56",45864:"Skein512-64",45865:"Skein512-72",45866:"Skein512-80",45867:"Skein512-88",45868:"Skein512-96",45869:"Skein512-104",45870:"Skein512-112",45871:"Skein512-120",45872:"Skein512-128",45873:"Skein512-136",45874:"Skein512-144",45875:"Skein512-152",45876:"Skein512-160",45877:"Skein512-168",45878:"Skein512-176",45879:"Skein512-184",45880:"Skein512-192",45881:"Skein512-200",45882:"Skein512-208",45883:"Skein512-216",45884:"Skein512-224",45885:"Skein512-232",45886:"Skein512-240",45887:"Skein512-248",45888:"Skein512-256",45889:"Skein512-264",45890:"Skein512-272",45891:"Skein512-280",45892:"Skein512-288",45893:"Skein512-296",45894:"Skein512-304",45895:"Skein512-312",45896:"Skein512-320",45897:"Skein512-328",45898:"Skein512-336",45899:"Skein512-344",45900:"Skein512-352",45901:"Skein512-360",45902:"Skein512-368",45903:"Skein512-376",45904:"Skein512-384",45905:"Skein512-392",45906:"Skein512-400",45907:"Skein512-408",45908:"Skein512-416",45909:"Skein512-424",45910:"Skein512-432",45911:"Skein512-440",45912:"Skein512-448",45913:"Skein512-456",45914:"Skein512-464",45915:"Skein512-472",45916:"Skein512-480",45917:"Skein512-488",45918:"Skein512-496",45919:"Skein512-504",45920:"Skein512-512",45921:"Skein1024-8",45922:"Skein1024-16",45923:"Skein1024-24",45924:"Skein1024-32",45925:"Skein1024-40",45926:"Skein1024-48",45927:"Skein1024-56",45928:"Skein1024-64",45929:"Skein1024-72",45930:"Skein1024-80",45931:"Skein1024-88",45932:"Skein1024-96",45933:"Skein1024-104",45934:"Skein1024-112",45935:"Skein1024-120",45936:"Skein1024-128",45937:"Skein1024-136",45938:"Skein1024-144",45939:"Skein1024-152",45940:"Skein1024-160",45941:"Skein1024-168",45942:"Skein1024-176",45943:"Skein1024-184",45944:"Skein1024-192",45945:"Skein1024-200",45946:"Skein1024-208",45947:"Skein1024-216",45948:"Skein1024-224",45949:"Skein1024-232",45950:"Skein1024-240",45951:"Skein1024-248",45952:"Skein1024-256",45953:"Skein1024-264",45954:"Skein1024-272",45955:"Skein1024-280",45956:"Skein1024-288",45957:"Skein1024-296",45958:"Skein1024-304",45959:"Skein1024-312",45960:"Skein1024-320",45961:"Skein1024-328",45962:"Skein1024-336",45963:"Skein1024-344",45964:"Skein1024-352",45965:"Skein1024-360",45966:"Skein1024-368",45967:"Skein1024-376",45968:"Skein1024-384",45969:"Skein1024-392",45970:"Skein1024-400",45971:"Skein1024-408",45972:"Skein1024-416",45973:"Skein1024-424",45974:"Skein1024-432",45975:"Skein1024-440",45976:"Skein1024-448",45977:"Skein1024-456",45978:"Skein1024-464",45979:"Skein1024-472",45980:"Skein1024-480",45981:"Skein1024-488",45982:"Skein1024-496",45983:"Skein1024-504",45984:"Skein1024-512",45985:"Skein1024-520",45986:"Skein1024-528",45987:"Skein1024-536",45988:"Skein1024-544",45989:"Skein1024-552",45990:"Skein1024-560",45991:"Skein1024-568",45992:"Skein1024-576",45993:"Skein1024-584",45994:"Skein1024-592",45995:"Skein1024-600",45996:"Skein1024-608",45997:"Skein1024-616",45998:"Skein1024-624",45999:"Skein1024-632",46000:"Skein1024-640",46001:"Skein1024-648",46002:"Skein1024-656",46003:"Skein1024-664",46004:"Skein1024-672",46005:"Skein1024-680",46006:"Skein1024-688",46007:"Skein1024-696",46008:"Skein1024-704",46009:"Skein1024-712",46010:"Skein1024-720",46011:"Skein1024-728",46012:"Skein1024-736",46013:"Skein1024-744",46014:"Skein1024-752",46015:"Skein1024-760",46016:"Skein1024-768",46017:"Skein1024-776",46018:"Skein1024-784",46019:"Skein1024-792",46020:"Skein1024-800",46021:"Skein1024-808",46022:"Skein1024-816",46023:"Skein1024-824",46024:"Skein1024-832",46025:"Skein1024-840",46026:"Skein1024-848",46027:"Skein1024-856",46028:"Skein1024-864",46029:"Skein1024-872",46030:"Skein1024-880",46031:"Skein1024-888",46032:"Skein1024-896",46033:"Skein1024-904",46034:"Skein1024-912",46035:"Skein1024-920",46036:"Skein1024-928",46037:"Skein1024-936",46038:"Skein1024-944",46039:"Skein1024-952",46040:"Skein1024-960",46041:"Skein1024-968",46042:"Skein1024-976",46043:"Skein1024-984",46044:"Skein1024-992",46045:"Skein1024-1000",46046:"Skein1024-1008",46047:"Skein1024-1016",46048:"Skein1024-1024"}),t.defaultLengths=Object.freeze({17:20,18:32,19:64,86:32,23:28,22:32,21:48,20:64,24:32,25:64,26:28,27:32,28:48,29:64,34:32,45569:1,45570:2,45571:3,45572:4,45573:5,45574:6,45575:7,45576:8,45577:9,45578:10,45579:11,45580:12,45581:13,45582:14,45583:15,45584:16,45585:17,45586:18,45587:19,45588:20,45589:21,45590:22,45591:23,45592:24,45593:25,45594:26,45595:27,45596:28,45597:29,45598:30,45599:31,45600:32,45601:33,45602:34,45603:35,45604:36,45605:37,45606:38,45607:39,45608:40,45609:41,45610:42,45611:43,45612:44,45613:45,45614:46,45615:47,45616:48,45617:49,45618:50,45619:51,45620:52,45621:53,45622:54,45623:55,45624:56,45625:57,45626:58,45627:59,45628:60,45629:61,45630:62,45631:63,45632:64,45633:1,45634:2,45635:3,45636:4,45637:5,45638:6,45639:7,45640:8,45641:9,45642:10,45643:11,45644:12,45645:13,45646:14,45647:15,45648:16,45649:17,45650:18,45651:19,45652:20,45653:21,45654:22,45655:23,45656:24,45657:25,45658:26,45659:27,45660:28,45661:29,45662:30,45663:31,45664:32,45825:1,45826:2,45827:3,45828:4,45829:5,45830:6,45831:7,45832:8,45833:9,45834:10,45835:11,45836:12,45837:13,45838:14,45839:15,45840:16,45841:17,45842:18,45843:19,45844:20,45845:21,45846:22,45847:23,45848:24,45849:25,45850:26,45851:27,45852:28,45853:29,45854:30,45855:31,45856:32,45857:1,45858:2,45859:3,45860:4,45861:5,45862:6,45863:7,45864:8,45865:9,45866:10,45867:11,45868:12,45869:13,45870:14,45871:15,45872:16,45873:17,45874:18,45875:19,45876:20,45877:21,45878:22,45879:23,45880:24,45881:25,45882:26,45883:27,45884:28,45885:29,45886:30,45887:31,45888:32,45889:33,45890:34,45891:35,45892:36,45893:37,45894:38,45895:39,45896:40,45897:41,45898:42,45899:43,45900:44,45901:45,45902:46,45903:47,45904:48,45905:49,45906:50,45907:51,45908:52,45909:53,45910:54,45911:55,45912:56,45913:57,45914:58,45915:59,45916:60,45917:61,45918:62,45919:63,45920:64,45921:1,45922:2,45923:3,45924:4,45925:5,45926:6,45927:7,45928:8,45929:9,45930:10,45931:11,45932:12,45933:13,45934:14,45935:15,45936:16,45937:17,45938:18,45939:19,45940:20,45941:21,45942:22,45943:23,45944:24,45945:25,45946:26,45947:27,45948:28,45949:29,45950:30,45951:31,45952:32,45953:33,45954:34,45955:35,45956:36,45957:37,45958:38,45959:39,45960:40,45961:41,45962:42,45963:43,45964:44,45965:45,45966:46,45967:47,45968:48,45969:49,45970:50,45971:51,45972:52,45973:53,45974:54,45975:55,45976:56,45977:57,45978:58,45979:59,45980:60,45981:61,45982:62,45983:63,45984:64,45985:65,45986:66,45987:67,45988:68,45989:69,45990:70,45991:71,45992:72,45993:73,45994:74,45995:75,45996:76,45997:77,45998:78,45999:79,46000:80,46001:81,46002:82,46003:83,46004:84,46005:85,46006:86,46007:87,46008:88,46009:89,46010:90,46011:91,46012:92,46013:93,46014:94,46015:95,46016:96,46017:97,46018:98,46019:99,46020:100,46021:101,46022:102,46023:103,46024:104,46025:105,46026:106,46027:107,46028:108,46029:109,46030:110,46031:111,46032:112,46033:113,46034:114,46035:115,46036:116,46037:117,46038:118,46039:119,46040:120,46041:121,46042:122,46043:123,46044:124,46045:125,46046:126,46047:127,46048:128})},function(e,t,n){"use strict";(function(t){const r=n(39);function i(e){return parseInt(e.toString("hex"),16)}function o(e){let n=e.toString(16);return n.length%2==1&&(n="0"+n),t.from(n,"hex")}function s(e){return t.from(r.encode(i(e)))}function a(e){return o(r.decode(e))}e.exports={numberToBuffer:o,bufferToNumber:i,varintBufferEncode:s,varintBufferDecode:a}}).call(this,n(0).Buffer)},function(e,t){e.exports=function e(t,n,r){t(n),r&&r(!0===n?null:n)}},function(e,t,n){"use strict";var r=n(177);e.exports=function e(t){return r(null,t)}},function(e,t,n){var r=n(178);function i(e){return e}e.exports=function e(t){return"object"==typeof t&&"function"==typeof t.test?function(e){return t.test(e)}:r(t)||i}},function(e,t,n){"use strict";function r(e){return e}var i=n(178),o=n(78);e.exports=function e(t,n){t=i(t)||r;var s={};return o(function(e){var r=t(e);return s[r]?!!n:(s[r]=!0,!n)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;var r=n(804),i=o(r);function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t,n){(0,i.default)(e,function(){return!t.apply(this,arguments)},n)}e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var r=n(68),i=f(r),o=n(172),s=f(o),a=n(104),u=f(a),l=n(42),c=f(l);function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t,n){n=n||i.default;var r=(0,s.default)(t)?[]:{};e(t,function(e,t,n){(0,c.default)(e)(function(e,i){arguments.length>2&&(i=(0,u.default)(arguments,1)),r[t]=i,n(e)})},function(e){n(e,r)})}e.exports=t.default},function(e,t,n){var r,i;r=this,e.exports=function(e,t,n,r,i){for(t=t.split?t.split("."):t,r=0;r1&&this._buf[this._buf.length-1]===a;)this._buf=this._buf.slice(0,-1)}less(e){const t=this.list(),n=e.list();for(let e=0;ei)return!1}return t.length>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);function i(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}e.exports=i},function(e,t,n){"use strict";const r=n(22);e.exports.dbOpenFailedError=(e=>(e=e||new Error("Cannot open database"),r(e,"ERR_DB_OPEN_FAILED"))),e.exports.dbDeleteFailedError=(e=>(e=e||new Error("Delete failed"),r(e,"ERR_DB_DELETE_FAILED"))),e.exports.dbWriteFailedError=(e=>(e=e||new Error("Write failed"),r(e,"ERR_DB_WRITE_FAILED"))),e.exports.notFoundError=(e=>(e=e||new Error("Not Found"),r(e,"ERR_NOT_FOUND")))},function(e,t,n){"use strict";var r=Object.prototype.toString;e.exports=function(e){var t;return"[object Object]"===r.call(e)&&(t=Object.getPrototypeOf(e),null===t||t===Object.getPrototypeOf({}))}},function(e,t,n){"use strict";const r=n(228),i=n(817),o=n(819),s=n(821),a=n(822),u=n(418);t.KeytransformDatastore=r,t.ShardingDatastore=i,t.MountDatastore=o,t.TieredDatastore=s,t.NamespaceDatastore=a,t.shard=u},function(e,t,n){"use strict";const r=n(33).Key,i=n(818),o=t.PREFIX="/repo/flatfs/shard/",s=t.SHARDING_FN="SHARDING";t.README_FN="_README";class a{constructor(e){this.param=e}fun(e){throw new Error("implement me")}toString(){return`${o}v1/${this.name}/${this.param}`}}class u extends a{constructor(e){super(e),this._padding="".padStart(e,"_"),this.name="prefix"}fun(e){return(e+this._padding).slice(0,this.param)}}class l extends a{constructor(e){super(e),this._padding="".padStart(e,"_"),this.name="suffix"}fun(e){const t=this._padding+e;return t.slice(t.length-this.param)}}class c extends a{constructor(e){super(e),this._padding="".padStart(e+1,"_"),this.name="next-to-last"}fun(e){const t=this._padding+e,n=t.length-this.param-1;return t.slice(n,n+this.param)}}function f(e){if(e=e.trim(),0===e.length)throw new Error("empty shard string");if(!e.startsWith(o))throw new Error(`invalid or no path prefix: ${e}`);const t=e.slice(o.length).split("/"),n=t[0];if("v1"!==n)throw new Error(`expect 'v1' version, got '${n}'`);const r=t[1];if(!t[2])throw new Error("missing param");const i=parseInt(t[2],10);switch(r){case"prefix":return new u(i);case"suffix":return new l(i);case"next-to-last":return new c(i);default:throw new Error(`unkown sharding function: ${r}`)}}t.readShardFun=((e,t,n)=>{const i=new r(e).child(new r(s)),o="function"==typeof t.getRaw?t.getRaw.bind(t):t.get.bind(t);o(i,(e,t)=>{if(e)return n(e);let r;try{r=f((t||"").toString().trim())}catch(e){return n(e)}n(null,r)})}),t.readme=i,t.parseShardFun=f,t.Prefix=u,t.Suffix=l,t.NextToLast=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(824),i=a(r),o=n(175),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default),e.exports=t.default},function(e,t){function n(e){return function(t){return null==t?void 0:t[e]}}e.exports=n},function(e,t,n){t.AbstractLevelDOWN=n(831),t.AbstractIterator=n(422),t.AbstractChainedBatch=n(423)},function(e,t,n){(function(t){function n(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._ended=!1,this._nexting=!1}n.prototype.next=function(e){var n=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return n._ended?(t.nextTick(e,new Error("cannot call next() after end()")),n):n._nexting?(t.nextTick(e,new Error("cannot call next() before previous next() has completed")),n):(n._nexting=!0,n._next(function(){n._nexting=!1,e.apply(null,arguments)}),n)},n.prototype._next=function(e){t.nextTick(e)},n.prototype.seek=function(e){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");e=this.db._serializeKey(e),this._seek(e)},n.prototype._seek=function(e){},n.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return t.nextTick(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},n.prototype._end=function(e){t.nextTick(e)},e.exports=n}).call(this,n(2))},function(e,t){function n(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._operations=[],this._written=!1}n.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},n.prototype.put=function(e,t){this._checkWritten();var n=this.db._checkKey(e)||this.db._checkValue(t);if(n)throw n;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t),this},n.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},n.prototype.del=function(e){this._checkWritten();var t=this.db._checkKey(e);if(t)throw t;return e=this.db._serializeKey(e),this._del(e),this},n.prototype._del=function(e){this._operations.push({type:"del",key:e})},n.prototype.clear=function(){return this._checkWritten(),this._clear(),this},n.prototype._clear=function(){this._operations=[]},n.prototype.write=function(e,t){if(this._checkWritten(),"function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("write() requires a callback argument");"object"==typeof e&&null!==e||(e={}),this._written=!0,this._write(e,t)},n.prototype._write=function(e,t){this.db._batch(this._operations,e,t)},e.exports=n},function(e,t){function n(){var e,t=new Promise(function(t,n){e=function e(r,i){r?n(r):t(i)}});return e.promise=t,e}e.exports=n},function(e,t,n){(function(t){function n(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._ended=!1,this._nexting=!1}n.prototype.next=function(e){var n=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return n._ended?(t.nextTick(e,new Error("cannot call next() after end()")),n):n._nexting?(t.nextTick(e,new Error("cannot call next() before previous next() has completed")),n):(n._nexting=!0,n._next(function(){n._nexting=!1,e.apply(null,arguments)}),n)},n.prototype._next=function(e){t.nextTick(e)},n.prototype.seek=function(e){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");e=this.db._serializeKey(e),this._seek(e)},n.prototype._seek=function(e){},n.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return t.nextTick(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},n.prototype._end=function(e){t.nextTick(e)},e.exports=n}).call(this,n(2))},function(e,t){function n(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._operations=[],this._written=!1}n.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},n.prototype.put=function(e,t){this._checkWritten();var n=this.db._checkKey(e)||this.db._checkValue(t);if(n)throw n;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t),this},n.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},n.prototype.del=function(e){this._checkWritten();var t=this.db._checkKey(e);if(t)throw t;return e=this.db._serializeKey(e),this._del(e),this},n.prototype._del=function(e){this._operations.push({type:"del",key:e})},n.prototype.clear=function(){return this._checkWritten(),this._clear(),this},n.prototype._clear=function(){this._operations=[]},n.prototype.write=function(e,t){if(this._checkWritten(),"function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("write() requires a callback argument");"object"==typeof e&&null!==e||(e={}),this._written=!0,this._write(e,t)},n.prototype._write=function(e,t){this.db._batch(this._operations,e,t)},e.exports=n},function(e,t,n){t.AbstractLevelDOWN=n(428),t.AbstractIterator=n(429),t.AbstractChainedBatch=n(430),t.isLevelDOWN=n(843)},function(e,t,n){(function(t,r){var i=n(69),o=n(429),s=n(430);function a(e){if(!arguments.length||void 0===e)throw new Error("constructor requires at least a location argument");if("string"!=typeof e)throw new Error("constructor requires a location string argument");this.location=e,this.status="new"}a.prototype.open=function(e,n){var r=this,i=this.status;if("function"==typeof e&&(n=e),"function"!=typeof n)throw new Error("open() requires a callback argument");"object"!=typeof e&&(e={}),e.createIfMissing=0!=e.createIfMissing,e.errorIfExists=!!e.errorIfExists,"function"==typeof this._open?(this.status="opening",this._open(e,function(e){if(e)return r.status=i,n(e);r.status="open",n()})):(this.status="open",t.nextTick(n))},a.prototype.close=function(e){var n=this,r=this.status;if("function"!=typeof e)throw new Error("close() requires a callback argument");"function"==typeof this._close?(this.status="closing",this._close(function(t){if(t)return n.status=r,e(t);n.status="closed",e()})):(this.status="closed",t.nextTick(e))},a.prototype.get=function(e,n,r){var i;if("function"==typeof n&&(r=n),"function"!=typeof r)throw new Error("get() requires a callback argument");return(i=this._checkKey(e,"key",this._isBuffer))?r(i):(this._isBuffer(e)||(e=String(e)),"object"!=typeof n&&(n={}),n.asBuffer=0!=n.asBuffer,"function"==typeof this._get?this._get(e,n,r):void t.nextTick(function(){r(new Error("NotFound"))}))},a.prototype.put=function(e,n,r,i){var o;if("function"==typeof r&&(i=r),"function"!=typeof i)throw new Error("put() requires a callback argument");return(o=this._checkKey(e,"key",this._isBuffer))?i(o):(this._isBuffer(e)||(e=String(e)),null==n||this._isBuffer(n)||t.browser||(n=String(n)),"object"!=typeof r&&(r={}),"function"==typeof this._put?this._put(e,n,r,i):void t.nextTick(i))},a.prototype.del=function(e,n,r){var i;if("function"==typeof n&&(r=n),"function"!=typeof r)throw new Error("del() requires a callback argument");return(i=this._checkKey(e,"key",this._isBuffer))?r(i):(this._isBuffer(e)||(e=String(e)),"object"!=typeof n&&(n={}),"function"==typeof this._del?this._del(e,n,r):void t.nextTick(r))},a.prototype.batch=function(e,n,r){if(!arguments.length)return this._chainedBatch();if("function"==typeof n&&(r=n),"function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return r(new Error("batch(array) requires an array argument"));n&&"object"==typeof n||(n={});for(var i=0,o=e.length,s,a;i0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:w;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),w(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),w()}function v(){g("onfinish"),e.removeListener("close",b),w()}function w(){g("unpipe"),n.unpipe(e)}return n.on("data",m),_(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o{const n=e+"/"+s;o("locking %s",n),a[n]=!0;const r={close(e){a[n]&&delete a[n],i(e)}};i(()=>{t(null,r)})}),t.locked=((e,t)=>{const n=e+"/"+s;o("checking lock: %s");const r=a[n];i(()=>{t(null,r)})})},function(e,t){e.exports=function(e){var t,n=!1;function r(r){if(!r)throw new Error("must be passed a readable");t=r,n&&e(t)}return r.resolve=r.ready=r.start=function(i){return n=!0,e=i||e,t&&e(t),r},r}},function(e,t,n){var r=n(226),i=n(436);e.exports=function(){var e=r(),t=i();return{source:e,sink:t,resolve:function(n){e.resolve(n.source),t.resolve(n.sink)}}}},function(e,t){var n=t.once=function(e){return function(t,n){if(t)return n(t);if(null!=e){var r=e;e=null,n(null,r)}else n(!0)}},r=t.depthFirst=function(e,t){var r=[],i;return r.unshift(n(e)),function e(n,o){return r.length?i?o(i):void r[0](n,function(n,s){if(n){if(!0!==n){for(i=n,r.shift();r.length;)r.shift()(n,function(){});return o(n)}return r.shift(),e(null,o)}r.unshift(t(s)),o(n,s)}):o(!0)}},i=t.widthFirst=function(e,t){var r=[];return r.push(n(e)),function e(n,i){if(!r.length)return i(!0);r[0](n,function(n,o){if(n)return r.shift(),e(null,i);r.push(t(o)),i(n,o)})}},o=t.leafFirst=function(e,t){var r=[],i=[];return r.push(n(e)),function e(n,o){r[0](n,function(n,s){if(n)return r.shift(),i.length?o(null,i.shift()):o(!0);r.unshift(t(s)),i.unshift(s),e(null,o)})}}},function(e,t,n){"use strict";const r=n(416),i=Object.prototype.hasOwnProperty,o=Object.propertyIsEnumerable,s=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}),a=this,u={concatArrays:!1},l=e=>{const t=[];for(const n in e)i.call(e,n)&&t.push(n);if(Object.getOwnPropertySymbols){const n=Object.getOwnPropertySymbols(e);for(let r=0;r{s(t,n,c(e[n]))}),t}function h(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return l(e).forEach(n=>{s(t,n,c(e[n]))}),t}const p=(e,t,n,r)=>(n.forEach(n=>{n in e&&e[n]!==Object.getPrototypeOf(e)?s(e,n,m(e[n],t[n],r)):s(e,n,c(t[n]))}),e),d=(e,t,n)=>{let r=e.slice(0,0),o=0;return[e,t].forEach(t=>{const a=[];for(let n=0;n-1===a.indexOf(e)),n)}),r};function m(e,t,n){return n.concatArrays&&Array.isArray(e)&&Array.isArray(t)?d(e,t,n):r(t)&&r(e)?p(e,t,l(t),n):c(t)}e.exports=function(){const e=m(c(u),this!==a&&this||{},u);let t={foobar:{}};for(let n=0;n(e=e.slice(1),new s(e))}});function h(e){let t;try{t=a(e)}catch(e){t=!1}if(t)throw new Error("The object passed has circular references");function n(e){if(!e||r.isBuffer(e)||"string"==typeof e)return e;if(Array.isArray(e))return e.map(n);if(s.isCID(e))return c(e);const t=Object.keys(e);if(1===t.length&&"/"===t[0])return c(e["/"]);if(t.length>0){const r={};return t.forEach(t=>{"object"==typeof e[t]?r[t]=n(e[t]):r[t]=e[t]}),r}return e}return n(e)}t=e.exports,t.serialize=((e,t)=>{let n;try{const r=h(e);n=i.encode(r)}catch(e){return setImmediate(()=>t(e))}setImmediate(()=>t(null,n))}),t.deserialize=((e,t)=>{let n;try{n=f.decodeFirst(e)}catch(e){return setImmediate(()=>t(e))}setImmediate(()=>t(null,n))}),t.cid=((e,n,r)=>{"function"==typeof n&&(r=n,n={}),n=n||{};const i=n.hashAlg||u.defaultHashAlg,a=n.hashLen,l=void 0===n.version?1:n.version;t.serialize(e,(e,t)=>{if(e)return r(e);o(t,i,a,(e,t)=>{if(e)return r(e);r(null,new s(l,u.multicodec,t))})})})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t,r){const i=n(387),o=n(62),s=n(861),a=n(305),u=n(232),l=n(442),c=n(443),{URL:f}=n(306);class h{constructor(e){e=e||{},!e.size||e.size<65536?e.size=65536:e.size=a.nextPowerOf2(e.size),this._heap=new ArrayBuffer(e.size),this._heap8=new Uint8Array(this._heap),this._buffer=t.from(this._heap),this._reset(),this._knownTags=Object.assign({0:e=>new Date(e),1:e=>new Date(1e3*e),2:e=>a.arrayBufferToBignumber(e),3:e=>u.NEG_ONE.minus(a.arrayBufferToBignumber(e)),4:e=>u.TEN.pow(e[0]).times(e[1]),5:e=>u.TWO.pow(e[0]).times(e[1]),32:e=>new f(e),35:e=>new RegExp(e)},e.tags),this.parser=s(r,{log:console.log.bind(console),pushInt:this.pushInt.bind(this),pushInt32:this.pushInt32.bind(this),pushInt32Neg:this.pushInt32Neg.bind(this),pushInt64:this.pushInt64.bind(this),pushInt64Neg:this.pushInt64Neg.bind(this),pushFloat:this.pushFloat.bind(this),pushFloatSingle:this.pushFloatSingle.bind(this),pushFloatDouble:this.pushFloatDouble.bind(this),pushTrue:this.pushTrue.bind(this),pushFalse:this.pushFalse.bind(this),pushUndefined:this.pushUndefined.bind(this),pushNull:this.pushNull.bind(this),pushInfinity:this.pushInfinity.bind(this),pushInfinityNeg:this.pushInfinityNeg.bind(this),pushNaN:this.pushNaN.bind(this),pushNaNNeg:this.pushNaNNeg.bind(this),pushArrayStart:this.pushArrayStart.bind(this),pushArrayStartFixed:this.pushArrayStartFixed.bind(this),pushArrayStartFixed32:this.pushArrayStartFixed32.bind(this),pushArrayStartFixed64:this.pushArrayStartFixed64.bind(this),pushObjectStart:this.pushObjectStart.bind(this),pushObjectStartFixed:this.pushObjectStartFixed.bind(this),pushObjectStartFixed32:this.pushObjectStartFixed32.bind(this),pushObjectStartFixed64:this.pushObjectStartFixed64.bind(this),pushByteString:this.pushByteString.bind(this),pushByteStringStart:this.pushByteStringStart.bind(this),pushUtf8String:this.pushUtf8String.bind(this),pushUtf8StringStart:this.pushUtf8StringStart.bind(this),pushSimpleUnassigned:this.pushSimpleUnassigned.bind(this),pushTagUnassigned:this.pushTagUnassigned.bind(this),pushTagStart:this.pushTagStart.bind(this),pushTagStart4:this.pushTagStart4.bind(this),pushTagStart8:this.pushTagStart8.bind(this),pushBreak:this.pushBreak.bind(this)},this._heap)}get _depth(){return this._parents.length}get _currentParent(){return this._parents[this._depth-1]}get _ref(){return this._currentParent.ref}_closeParent(){var e=this._parents.pop();if(e.length>0)throw new Error(`Missing ${e.length} elements`);switch(e.type){case u.PARENT.TAG:this._push(this.createTag(e.ref[0],e.ref[1]));break;case u.PARENT.BYTE_STRING:this._push(this.createByteString(e.ref,e.length));break;case u.PARENT.UTF8_STRING:this._push(this.createUtf8String(e.ref,e.length));break;case u.PARENT.MAP:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createMap(e.ref,e.length));break;case u.PARENT.OBJECT:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createObject(e.ref,e.length));break;case u.PARENT.ARRAY:this._push(this.createArray(e.ref,e.length))}this._currentParent&&this._currentParent.type===u.PARENT.TAG&&this._dec()}_dec(){const e=this._currentParent;e.length<0||(e.length--,0===e.length&&this._closeParent())}_push(e,t){const n=this._currentParent;switch(n.values++,n.type){case u.PARENT.ARRAY:case u.PARENT.BYTE_STRING:case u.PARENT.UTF8_STRING:n.length>-1?this._ref[this._ref.length-n.length]=e:this._ref.push(e),this._dec();break;case u.PARENT.OBJECT:null!=n.tmpKey?(this._ref[n.tmpKey]=e,n.tmpKey=null,this._dec()):(n.tmpKey=e,"string"!=typeof n.tmpKey&&(n.type=u.PARENT.MAP,n.ref=a.buildMap(n.ref)));break;case u.PARENT.MAP:null!=n.tmpKey?(this._ref.set(n.tmpKey,e),n.tmpKey=null,this._dec()):n.tmpKey=e;break;case u.PARENT.TAG:this._ref.push(e),t||this._dec();break;default:throw new Error("Unknown parent type")}}_createParent(e,t,n){this._parents[this._depth]={type:t,length:n,ref:e,values:0,tmpKey:null}}_reset(){this._res=[],this._parents=[{type:u.PARENT.ARRAY,length:-1,ref:this._res,values:0,tmpKey:null}]}createTag(e,t){const n=this._knownTags[e];return n?n(t):new c(e,t)}createMap(e,t){return e}createObject(e,t){return e}createArray(e,t){return e}createByteString(e,n){return t.concat(e)}createByteStringFromHeap(e,n){return e===n?t.alloc(0):t.from(this._heap.slice(e,n))}createInt(e){return e}createInt32(e,t){return a.buildInt32(e,t)}createInt64(e,t,n,r){return a.buildInt64(e,t,n,r)}createFloat(e){return e}createFloatSingle(e,t,n,r){return i.read([e,t,n,r],0,!1,23,4)}createFloatDouble(e,t,n,r,o,s,a,u){return i.read([e,t,n,r,o,s,a,u],0,!1,52,8)}createInt32Neg(e,t){return-1-a.buildInt32(e,t)}createInt64Neg(e,t,n,r){const i=a.buildInt32(e,t),s=a.buildInt32(n,r);return i>u.MAX_SAFE_HIGH?u.NEG_ONE.minus(new o(i).times(u.SHIFT32).plus(s)):-1-(i*u.SHIFT32+s)}createTrue(){return!0}createFalse(){return!1}createNull(){return null}createUndefined(){}createInfinity(){return 1/0}createInfinityNeg(){return-1/0}createNaN(){return NaN}createNaNNeg(){return NaN}createUtf8String(e,t){return e.join("")}createUtf8StringFromHeap(e,t){return e===t?"":this._buffer.toString("utf8",e,t)}createSimpleUnassigned(e){return new l(e)}pushInt(e){this._push(this.createInt(e))}pushInt32(e,t){this._push(this.createInt32(e,t))}pushInt64(e,t,n,r){this._push(this.createInt64(e,t,n,r))}pushFloat(e){this._push(this.createFloat(e))}pushFloatSingle(e,t,n,r){this._push(this.createFloatSingle(e,t,n,r))}pushFloatDouble(e,t,n,r,i,o,s,a){this._push(this.createFloatDouble(e,t,n,r,i,o,s,a))}pushInt32Neg(e,t){this._push(this.createInt32Neg(e,t))}pushInt64Neg(e,t,n,r){this._push(this.createInt64Neg(e,t,n,r))}pushTrue(){this._push(this.createTrue())}pushFalse(){this._push(this.createFalse())}pushNull(){this._push(this.createNull())}pushUndefined(){this._push(this.createUndefined())}pushInfinity(){this._push(this.createInfinity())}pushInfinityNeg(){this._push(this.createInfinityNeg())}pushNaN(){this._push(this.createNaN())}pushNaNNeg(){this._push(this.createNaNNeg())}pushArrayStart(){this._createParent([],u.PARENT.ARRAY,-1)}pushArrayStartFixed(e){this._createArrayStartFixed(e)}pushArrayStartFixed32(e,t){const n=a.buildInt32(e,t);this._createArrayStartFixed(n)}pushArrayStartFixed64(e,t,n,r){const i=a.buildInt64(e,t,n,r);this._createArrayStartFixed(i)}pushObjectStart(){this._createObjectStartFixed(-1)}pushObjectStartFixed(e){this._createObjectStartFixed(e)}pushObjectStartFixed32(e,t){const n=a.buildInt32(e,t);this._createObjectStartFixed(n)}pushObjectStartFixed64(e,t,n,r){const i=a.buildInt64(e,t,n,r);this._createObjectStartFixed(i)}pushByteStringStart(){this._parents[this._depth]={type:u.PARENT.BYTE_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushByteString(e,t){this._push(this.createByteStringFromHeap(e,t))}pushUtf8StringStart(){this._parents[this._depth]={type:u.PARENT.UTF8_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushUtf8String(e,t){this._push(this.createUtf8StringFromHeap(e,t))}pushSimpleUnassigned(e){this._push(this.createSimpleUnassigned(e))}pushTagStart(e){this._parents[this._depth]={type:u.PARENT.TAG,length:1,ref:[e]}}pushTagStart4(e,t){this.pushTagStart(a.buildInt32(e,t))}pushTagStart8(e,t,n,r){this.pushTagStart(a.buildInt64(e,t,n,r))}pushTagUnassigned(e){this._push(this.createTag(e))}pushBreak(){if(this._currentParent.length>-1)throw new Error("Unexpected break");this._closeParent()}_createObjectStartFixed(e){0!==e?this._createParent({},u.PARENT.OBJECT,e):this._push(this.createObject({}))}_createArrayStartFixed(e){0!==e?this._createParent(new Array(e),u.PARENT.ARRAY,e):this._push(this.createArray([]))}_decode(e){if(0===e.byteLength)throw new Error("Input too short");this._reset(),this._heap8.set(e);const t=this.parser.parse(e.byteLength);if(this._depth>1){for(;0===this._currentParent.length;)this._closeParent();if(this._depth>1)throw new Error("Undeterminated nesting")}if(t>0)throw new Error("Failed to parse");if(0===this._res.length)throw new Error("No valid result")}decodeFirst(e){return this._decode(e),this._res[0]}decodeAll(e){return this._decode(e),this._res}static decode(e,n){"string"==typeof e&&(e=t.from(e,n||"hex"));const r=new h({size:e.length});return r.decodeFirst(e)}static decodeAll(e,n){"string"==typeof e&&(e=t.from(e,n||"hex"));const r=new h({size:e.length});return r.decodeAll(e)}}h.decodeFirst=h.decode,e.exports=h}).call(this,n(0).Buffer,n(8))},function(e,t,n){"use strict";const r=n(232),i=r.MT,o=r.SIMPLE,s=r.SYMS;class a{constructor(e){if("number"!=typeof e)throw new Error("Invalid Simple type: "+typeof e);if(e<0||e>255||(0|e)!==e)throw new Error("value must be a small positive integer: "+e);this.value=e}toString(){return"simple("+this.value+")"}inspect(){return"simple("+this.value+")"}encodeCBOR(e){return e._pushInt(this.value,i.SIMPLE_FLOAT)}static isSimple(e){return e instanceof a}static decode(e,t){switch(null==t&&(t=!0),e){case o.FALSE:return!1;case o.TRUE:return!0;case o.NULL:return t?null:s.NULL;case o.UNDEFINED:return t?void 0:s.UNDEFINED;case-1:if(!t)throw new Error("Invalid BREAK");return s.BREAK;default:return new a(e)}}}e.exports=a},function(e,t,n){"use strict";class r{constructor(e,t,n){if(this.tag=e,this.value=t,this.err=n,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(e){return e._pushTag(this.tag),e.pushAny(this.value)}convert(e){var t,n;if(n=null!=e?e[this.tag]:void 0,"function"!=typeof n&&(n=r["_tag"+this.tag],"function"!=typeof n))return this;try{return n.call(r,this.value)}catch(e){return t=e,this.err=t,this}}}e.exports=r},function(e,t,n){"use strict";const r=self.location?self.location.protocol+"//"+self.location.host:"",i=self.URL;class o{constructor(e,t=r){this.super=new i(e,t),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set origin(e){this.super.origin=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set searchParams(e){this.super.searchParams=e}set username(e){this.super.username=e}createObjectURL(e){return this.super.createObjectURL(e)}revokeObjectURL(e){this.super.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}}function s(e){if("string"==typeof e){const t=new i(e);return t.toString()}if(!(e instanceof i)){const t=e.username&&e.password?`${e.username}:${e.password}@`:"",n=e.auth?e.auth+"@":"",r=e.port?":"+e.port:"",i=e.protocol?e.protocol+"//":"",o=e.host||"",s=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),u=e.hash||"",l=e.pathname||"",c=e.path||l+a;return`${i}${t||n}${o||s+r}${c}${u}`}}e.exports={URLWithLegacySupport:o,URLSearchParams:self.URLSearchParams,defaultBase:r,format:s}},function(e,t,n){(function(r,i){var o; + */function i(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i=0;f--)if(a[f]!==l[f])return!1;for(f=a.length-1;f>=0;f--)if(c=a[f],!w(e[c],t[c],n,r))return!1;return!0}function S(e,t,n){w(e,t,!0)&&b(e,t,n,"notDeepStrictEqual",S)}function E(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function x(e){var t;try{e()}catch(e){t=e}return t}function C(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=x(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&b(i,n,"Missing expected exception"+r);var o="string"==typeof r,a=!e&&s.isError(i),u=!e&&i&&!n;if((a&&o&&E(i,n)||u)&&b(i,n,"Got unwanted exception"+r),e&&i&&n&&!E(i,n)||!e&&i)throw i}function A(e,t){e||b(e,!0,t,"==",A)}h.AssertionError=function e(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=y(this),this.generatedMessage=!0);var n=t.stackStartFunction||b;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var i=r.stack,o=d(n),s=i.indexOf("\n"+o);if(s>=0){var a=i.indexOf("\n",s+1);i=i.substring(a+1)}this.stack=i}}},s.inherits(h.AssertionError,Error),h.fail=b,h.ok=v,h.equal=function e(t,n,r){t!=n&&b(t,n,r,"==",h.equal)},h.notEqual=function e(t,n,r){t==n&&b(t,n,r,"!=",h.notEqual)},h.deepEqual=function e(t,n,r){w(t,n,!1)||b(t,n,r,"deepEqual",h.deepEqual)},h.deepStrictEqual=function e(t,n,r){w(t,n,!0)||b(t,n,r,"deepStrictEqual",h.deepStrictEqual)},h.notDeepEqual=function e(t,n,r){w(t,n,!1)&&b(t,n,r,"notDeepEqual",h.notDeepEqual)},h.notDeepStrictEqual=S,h.strictEqual=function e(t,n,r){t!==n&&b(t,n,r,"===",h.strictEqual)},h.notStrictEqual=function e(t,n,r){t===n&&b(t,n,r,"!==",h.notStrictEqual)},h.throws=function(e,t,n){C(!0,e,t,n)},h.doesNotThrow=function(e,t,n){C(!1,e,t,n)},h.ifError=function(e){if(e)throw e},h.strict=r(A,h,{equal:h.strictEqual,deepEqual:h.deepStrictEqual,notEqual:h.notStrictEqual,notDeepEqual:h.notDeepStrictEqual}),h.strict.strict=h.strict;var I=Object.keys||function(e){var t=[];for(var n in e)a.call(e,n)&&t.push(n);return t}}).call(this,n(8))},function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,n){t=e.exports=n(396),t.Stream=t,t.Readable=t,t.Writable=n(400),t.Duplex=n(136),t.Transform=n(401),t.PassThrough=n(771),t.finished=n(294),t.pipeline=n(772)},function(e,t,n){"use strict";const r=n(633),i=n(634),o=n(24);e.exports=(e=>{const t=r();if("function"==typeof e)return e;if("object"==typeof e)return i(e);if("string"==typeof e){const n=o(e).nodeAddress();return t.host=n.address,t.port=n.port,i(t)}throw new Error("Argument must be a send function or a config object.")})},function(e,t,n){"use strict";function r(e,t,n){var r=e instanceof Error?e:new Error(e),i;if("object"==typeof t?n=t:null!=t&&(r.code=t),n)for(i in n)r[i]=n[i];return r}e.exports=r},function(e,t,n){"use strict";(function(r){const i=n(35),o=n(456),s=n(18),a=n(11),u=n(53);class l{constructor(e,t,n){s(r.isBuffer(e),"invalid id provided"),t&&n&&s(t.public.bytes.equals(n.bytes),"inconsistent arguments"),this._id=e,this._idB58String=i.toB58String(this.id),this._privKey=t,this._pubKey=n}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){return this._pubKey?this._pubKey:this._privKey?this._privKey.public:void 0}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return o.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.marshalPrivateKey(this.privKey)}toPrint(){let e=this.toB58String();e.startsWith("Qm")&&(e=e.slice(2));let t=6;return e.length"}toJSON(){return{id:this.toB58String(),privKey:f(this.marshalPrivKey()),pubKey:f(this.marshalPubKey())}}toHexString(){return i.toHexString(this.id)}toBytes(){return this.id}toB58String(){return this._idB58String}isEqual(e){if(r.isBuffer(e))return this.id.equals(e);if(e.id)return this.id.equals(e.id);throw new Error("not valid Id")}isValid(e){this.privKey&&this.privKey.public&&this.privKey.public.bytes&&r.isBuffer(this.pubKey.bytes)&&this.privKey.public.bytes.equals(this.pubKey.bytes)?e():e(new Error("Keys not match"))}}const c=u(l,{className:"PeerId",symbolName:"@libp2p/js-peer-id/PeerId"});function f(e){if(e)return e.toString("base64")}t=e.exports=c,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.generateKeyPair("RSA",e.bits,t),(e,t)=>e.public.hash((n,r)=>{t(n,r,e)})],(e,n,r)=>{if(e)return t(e);t(null,new c(n,r))})},t.createFromHexString=function(e){return new c(i.fromHexString(e))},t.createFromBytes=function(e){return new c(e)},t.createFromB58String=function(e){return new c(i.fromB58String(e))},t.createFromPubKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let n;try{let i=e;if("string"==typeof i&&(i=r.from(e,"base64")),!r.isBuffer(i))throw new Error("Supplied key is neither a base64 string nor a buffer");n=o.unmarshalPublicKey(i)}catch(e){return t(e)}n.hash((e,r)=>{if(e)return t(e);t(null,new c(r,null,n))})},t.createFromPrivKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let n=e;try{if("string"==typeof n&&(n=r.from(e,"base64")),!r.isBuffer(n))throw new Error("Supplied key is neither a base64 string nor a buffer")}catch(e){return t(e)}a([e=>o.unmarshalPrivateKey(n,e),(e,t)=>e.public.hash((n,r)=>{t(n,r,e)})],(e,n,r)=>{if(e)return t(e);t(null,new c(n,r,r.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let n,s,u,l;try{n=i.fromB58String(e.id),s=e.privKey&&r.from(e.privKey,"base64"),u=e.pubKey&&r.from(e.pubKey,"base64"),l=u&&o.unmarshalPublicKey(u)}catch(e){return t(e)}s?a([e=>o.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((n,r)=>{t(n,r,e)}),(e,t,n)=>{l?l.hash((r,i)=>{n(r,e,t,i)}):n(null,e,t)}],(e,r,i,o)=>e?t(e):l&&!r.equals(o)?t(new Error("Public and private key do not match")):n&&!r.equals(n)?t(new Error("Id and private key do not match")):void t(null,new c(n,i,l))):t(null,new c(n,null,l))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(937),o=n(320),s=n(39),a=n(76),u=n(53),l=u.proto(function(e){if(!(this instanceof l))return new l(e);if(null==e&&(e=""),e instanceof r)this.buffer=i.fromBuffer(e);else if("string"==typeof e||e instanceof String){if(e.length>0&&"/"!==e.charAt(0))throw new Error(`multiaddr "${e}" must start with a "/"`);this.buffer=i.fromString(e)}else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=i.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});l.prototype.toString=function e(){return i.bufferToString(this.buffer)},l.prototype.toJSON=l.prototype.toString,l.prototype.toOptions=function e(){const t={},n=this.toString().split("/");return t.family="ip4"===n[1]?"ipv4":"ipv6",t.host=n[2],t.transport=n[3],t.port=n[4],t},l.prototype.inspect=function e(){return""},l.prototype.protos=function e(){return this.protoCodes().map(e=>Object.assign({},o(e)))},l.prototype.protoCodes=function e(){const t=[],n=this.buffer;let r=0;for(;re.name)},l.prototype.tuples=function e(){return i.bufferToTuples(this.buffer)},l.prototype.stringTuples=function e(){const t=i.bufferToTuples(this.buffer);return i.tuplesToStringTuples(t)},l.prototype.encapsulate=function e(t){return t=l(t),l(this.toString()+t.toString())},l.prototype.decapsulate=function e(t){t=t.toString();const n=this.toString(),r=n.lastIndexOf(t);if(r<0)throw new Error("Address "+this+" does not contain subaddress: "+t);return l(n.slice(0,r))},l.prototype.getPeerId=function e(){let t=null;try{t=this.stringTuples().filter(e=>{if(e[0]===o.names.ipfs.code)return!0})[0][1],a.decode(t)}catch(e){t=null}return t},l.prototype.getPath=function e(){let t=null;try{t=this.stringTuples().filter(e=>{const t=o(e[0]);if(t.path)return!0})[0][1]}catch(e){t=null}return t},l.prototype.equals=function e(t){return this.buffer.equals(t.buffer)},l.prototype.nodeAddress=function e(){const t=this.protoCodes(),n=this.protoNames(),r=this.toString().split("/").slice(1);if(r.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==t[0]&&41!==t[0]&&54!==t[0]&&55!==t[0])throw new Error(`no protocol with name: "'${n[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if("tcp"!==r[2]&&"udp"!==r[2])throw new Error(`no protocol with name: "'${n[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:41===t[0]||55===t[0]?6:4,address:r[1],port:r[3]}},l.fromNodeAddress=function e(t,n){if(!t)throw new Error("requires node address object");if(!n)throw new Error("requires transport protocol");const r="IPv6"===t.family?"ip6":"ip4";return l("/"+[r,t.address,n,t.port].join("/"))},l.prototype.isThinWaistAddress=function e(t){const n=(t||this).protos();return 2===n.length&&((4===n[0].code||41===n[0].code)&&(6===n[1].code||273===n[1].code))},l.protocols=o,l.isName=function e(t){return!!l.isMultiaddr(t)&&t.protos().some(e=>e.resolvable)},l.resolve=function e(t,n){return l.isMultiaddr(t)&&l.isName(t)?n(new Error("not implemented yet")):n(new Error("not a valid name"))},t=e.exports=l}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(84),i=n(17);e.exports={checkState:function(e,t){if(!e)throw new r.InvalidState(t)},checkArgument:function(e,t,n,i){if(!e)throw new r.InvalidArgument(t,n,i)},checkArgumentType:function(e,t,o){if(o=o||"(unknown name)",i.isString(t)){if("Buffer"===t){var s=n(30);if(!s.isBuffer(e))throw new r.InvalidArgumentType(e,t,o)}else if(typeof e!==t)throw new r.InvalidArgumentType(e,t,o)}else if(!(e instanceof t))throw new r.InvalidArgumentType(e,t.name,o)}}},function(e,t,n){"use strict";var r=n(792),i=n(796),o=n(800);for(var s in t=e.exports=n(12),t.pull=t,r)t[s]=r[s];for(var s in o)t[s]=o[s];for(var s in i)t[s]=i[s]},function(e,t,n){(function(t,r){var i=n(18),o=n(57).Stream,s=n(13),a=/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;function u(e){return e.charAt(0).toUpperCase()+e.slice(1)}function l(e,t,n,r,o){throw new i.AssertionError({message:s.format("%s (%s) is required",e,t),actual:void 0===o?typeof r:o(r),expected:t,operator:n||"===",stackStartFunction:l.caller})}function c(e){return Object.prototype.toString.call(e).slice(8,-1)}function f(){}var h={bool:{check:function(e){return"boolean"==typeof e}},func:{check:function(e){return"function"==typeof e}},string:{check:function(e){return"string"==typeof e}},object:{check:function(e){return"object"==typeof e&&null!==e}},number:{check:function(e){return"number"==typeof e&&!isNaN(e)}},finite:{check:function(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}},buffer:{check:function(e){return t.isBuffer(e)},operator:"Buffer.isBuffer"},array:{check:function(e){return Array.isArray(e)},operator:"Array.isArray"},stream:{check:function(e){return e instanceof o},operator:"instanceof",actual:c},date:{check:function(e){return e instanceof Date},operator:"instanceof",actual:c},regexp:{check:function(e){return e instanceof RegExp},operator:"instanceof",actual:c},uuid:{check:function(e){return"string"==typeof e&&a.test(e)},operator:"isUUID"}};function p(e){var t=Object.keys(h),n;return n=r.env.NODE_NDEBUG?f:function(e,t){e||l(t,"true",e)},t.forEach(function(t){if(e)n[t]=f;else{var r=h[t];n[t]=function(e,n){r.check(e)||l(n,t,r.operator,e,r.actual)}}}),t.forEach(function(t){var r="optional"+u(t);if(e)n[r]=f;else{var i=h[t];n[r]=function(e,n){void 0!==e&&null!==e&&(i.check(e)||l(n,t,i.operator,e,i.actual))}}}),t.forEach(function(t){var r="arrayOf"+u(t);if(e)n[r]=f;else{var i=h[t],o="["+t+"]";n[r]=function(e,t){var n;for(Array.isArray(e)||l(t,o,i.operator,e,i.actual),n=0;n=c.OP_1&&e<=c.OP_16||e===c.OP_1NEGATE)}function d(e){return u.Buffer(e)||p(e)}function m(e){return u.Array(e)&&e.every(d)}function g(e){return 0===e.length?c.OP_0:1===e.length?e[0]>=1&&e[0]<=16?h+e[0]:129===e[0]?c.OP_1NEGATE:void 0:void 0}function y(e){if(r.isBuffer(e))return e;a(u.Array,e);const t=e.reduce(function(e,t){return r.isBuffer(t)?1===t.length&&void 0!==g(t)?e+1:e+s.encodingLength(t.length)+t.length:e+1},0),n=r.allocUnsafe(t);let i=0;if(e.forEach(function(e){if(r.isBuffer(e)){const t=g(e);if(void 0!==t)return n.writeUInt8(t,i),void(i+=1);i+=s.encode(n,e.length,i),e.copy(n,i),i+=e.length}else n.writeUInt8(e,i),i+=1}),i!==n.length)throw new Error("Could not decode chunks");return n}function b(e){if(u.Array(e))return e;a(u.Buffer,e);const t=[];let n=0;for(;nc.OP_0&&r<=c.OP_PUSHDATA4){const r=s.decode(e,n);if(null===r)return null;if(n+=r.size,n+r.number>e.length)return null;const i=e.slice(n,n+r.number);n+=r.number;const o=g(i);void 0!==o?t.push(o):t.push(i)}else t.push(r),n+=1}return t}function v(e){return r.isBuffer(e)&&(e=b(e)),e.map(function(e){if(r.isBuffer(e)){const t=g(e);if(void 0===t)return e.toString("hex");e=t}return f[e]}).join(" ")}function w(e){return a(u.String,e),y(e.split(" ").map(function(e){return void 0!==c[e]?c[e]:(a(u.Hex,e),r.from(e,"hex"))}))}function _(e){return e=b(e),a(m,e),e.map(function(e){return r.isBuffer(e)?e:e===c.OP_0?r.allocUnsafe(0):l.encode(e-h)})}function k(e){return o.isPoint(e)}function S(e){const t=-129&e;return t>0&&t<4}function E(e){return!!r.isBuffer(e)&&(!!S(e[e.length-1])&&i.check(e.slice(0,-1)))}e.exports={compile:y,decompile:b,fromASM:w,toASM:v,toStack:_,number:n(579),signature:n(1355),isCanonicalPubKey:k,isCanonicalScriptSignature:E,isPushOnly:m,isDefinedHashType:S}},function(e,t,n){"use strict";(function(t){var r=n(0),i=n(18),o=n(41),s=n(25);function a(e,t){if(e.length!==t.length)return!1;for(var n=e.length,r=0;r>24&255),r.push(n>>16&255),r.push(n>>8&255),r.push(255&n),new t(r)},integerFromBuffer:function e(t){return s.checkArgumentType(t,"Buffer","buffer"),t[0]<<24|t[1]<<16|t[2]<<8|t[3]},integerFromSingleByteBuffer:function e(t){return s.checkArgumentType(t,"Buffer","buffer"),t[0]},bufferToHex:function e(t){return s.checkArgumentType(t,"Buffer","buffer"),t.toString("hex")},reverse:function e(t){for(var n=new r.Buffer(t.length),i=0;i=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=i(e);return t&&0!==t.length?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r}),!o.kStringMaxLength)try{o.kStringMaxLength=t.binding("buffer").kStringMaxLength}catch(e){}o.constants||(o.constants={MAX_LENGTH:o.kMaxLength},o.kStringMaxLength&&(o.constants.MAX_STRING_LENGTH=o.kStringMaxLength)),e.exports=o}).call(this,n(2))},function(e,t,n){"use strict";var r=n(214),i=n(738);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=_,t.resolve=S,t.resolveObject=E,t.format=k,t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,l=["<",">",'"',"`"," ","\r","\n","\t"],c=["{","}","|","\\","^","`"].concat(l),f=["'"].concat(c),h=["%","/","?",";","#"].concat(f),p=["/","?","#"],d=255,m=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},b={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},w=n(169);function _(e,t,n){if(e&&i.isObject(e)&&e instanceof o)return e;var r=new o;return r.parse(e,t,n),r}function k(e){return i.isString(e)&&(e=_(e)),e instanceof o?e.format():o.prototype.format.call(e)}function S(e,t){return _(e,!1,!0).resolve(t)}function E(e,t){return e?_(e,!1,!0).resolveObject(t):t}o.prototype.parse=function(e,t,n){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o127?R+="x":R+=B[N];if(!R.match(m)){var L=O.slice(0,C),F=O.slice(C+1),D=B.match(g);D&&(L.push(D[1]),F.unshift(D[2])),F.length&&(d="/"+F.join(".")+d),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),j||(this.hostname=r.toASCII(this.hostname));var U=this.port?":"+this.port:"",z=this.hostname||"";this.host=z+U,this.href+=this.host,j&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==d[0]&&(d="/"+d))}if(!y[S])for(var C=0,P=f.length;C0)&&n.host.split("@");x&&(n.auth=x.shift(),n.host=n.hostname=x.shift())}return n.search=e.search,n.query=e.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!S.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var C=S.slice(-1)[0],A=(n.host||e.host||S.length>1)&&("."===C||".."===C)||""===C,I=0,T=S.length;T>=0;T--)C=S[T],"."===C?S.splice(T,1):".."===C?(S.splice(T,1),I++):I&&(S.splice(T,1),I--);if(!_&&!k)for(;I--;I)S.unshift("..");!_||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),A&&"/"!==S.join("/").substr(-1)&&S.push("");var j=""===S[0]||S[0]&&"/"===S[0].charAt(0);if(E){n.hostname=n.host=j?"":S.length?S.shift():"";var x=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");x&&(n.auth=x.shift(),n.host=n.hostname=x.shift())}return _=_||n.host&&S.length,_&&!j&&S.unshift(""),S.length?n.pathname=S.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){"use strict";const r=n(412),i=n(810),o=n(298),s=n(415);t.Key=r,t.MemoryDatastore=i,t.utils=o,t.Errors=s},function(e,t,n){(function(t,r){var i=n(19),o=n(891),s=e.exports=i.util=i.util||{};function a(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function u(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(s.isArrayBuffer(e)||s.isArrayBufferView(e))if(void 0!==r&&e instanceof r)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var n=0;n15?(i=Date.now(),u(e)):(n.push(e),1===n.length&&a.setAttribute("a",o=!o))}}s.nextTick=s.setImmediate}(),s.isNodejs=void 0!==t&&t.versions&&t.versions.node,s.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},s.isArrayBufferView=function(e){return e&&s.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},s.ByteBuffer=u,s.ByteStringBuffer=u;var l=4096;function c(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var n=s.isArrayBuffer(e),r=s.isArrayBufferView(e);if(n||r)return this.data=n?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==e&&void 0!==e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}s.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},s.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},s.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},s.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},s.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var n=this.data;t>0;)1&t&&(n+=e),t>>>=1,t>0&&(e+=e);return this.data=n,this._optimizeConstructedString(t),this},s.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},s.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(s.encodeUtf8(e))},s.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},s.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},s.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},s.ByteStringBuffer.prototype.putInt=function(e,t){a(t);var n="";do{t-=8,n+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(n)},s.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},s.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<=n&&(t-=n<<1),t},s.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},s.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},s.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},s.ByteStringBuffer.prototype.copy=function(){var e=s.createBuffer(this.data);return e.read=this.read,e},s.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},s.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},s.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},s.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var n=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),r=new Uint8Array(this.length()+t);return r.set(n),this.data=new DataView(r.buffer),this},s.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},s.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var n=0;n>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},s.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},s.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},s.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},s.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},s.DataBuffer.prototype.putInt=function(e,t){a(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},s.DataBuffer.prototype.putSignedInt=function(e,t){return a(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},s.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<=n&&(t-=n<<1),t},s.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},s.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},s.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},s.DataBuffer.prototype.copy=function(){return new s.DataBuffer(this)},s.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},s.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},s.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},s.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(n+=e),t>>>=1,t>0&&(e+=e);return n},s.xorBytes=function(e,t,n){for(var r="",i="",o="",s=0,a=0;n>0;--n,++s)i=e.charCodeAt(s)^t.charCodeAt(s),a>=10&&(r+=o,o="",a=0),o+=String.fromCharCode(i),++a;return r+=o,r},s.hexToBytes=function(e){var t="",n=0;for(!0&e.length&&(n=1,t+=String.fromCharCode(parseInt(e[0],16)));n>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";s.encode64=function(e,t){for(var n="",r="",i,o,s,a=0;a>2),n+=f.charAt((3&i)<<4|o>>4),isNaN(o)?n+="==":(n+=f.charAt((15&o)<<2|s>>6),n+=isNaN(s)?"=":f.charAt(63&s)),t&&n.length>t&&(r+=n.substr(0,t)+"\r\n",n=n.substr(t));return r+=n,r},s.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",n,r,i,o,s=0;s>4),64!==i&&(t+=String.fromCharCode((15&r)<<4|i>>2),64!==o&&(t+=String.fromCharCode((3&i)<<6|o)));return t},s.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},s.decodeUtf8=function(e){return decodeURIComponent(escape(e))},s.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:o.encode,decode:o.decode}},s.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},s.binary.raw.decode=function(e,t,n){var r=t;r||(r=new Uint8Array(e.length)),n=n||0;for(var i=n,o=0;o>2),n+=f.charAt((3&i)<<4|o>>4),isNaN(o)?n+="==":(n+=f.charAt((15&o)<<2|s>>6),n+=isNaN(s)?"=":f.charAt(63&s)),t&&n.length>t&&(r+=n.substr(0,t)+"\r\n",n=n.substr(t));return r+=n,r},s.binary.base64.decode=function(e,t,n){var r=t,i,o,s,a;r||(r=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),n=n||0;for(var u=0,l=n;u>4,64!==s&&(r[l++]=(15&o)<<4|s>>2,64!==a&&(r[l++]=(3&s)<<6|a));return t?l-n:r.subarray(0,l)},s.binary.base58.encode=function(e,t){return s.binary.baseN.encode(e,p,t)},s.binary.base58.decode=function(e,t){return s.binary.baseN.decode(e,p,t)},s.text={utf8:{},utf16:{}},s.text.utf8.encode=function(e,t,n){e=s.encodeUtf8(e);var r=t;r||(r=new Uint8Array(e.length)),n=n||0;for(var i=n,o=0;o0?(o=n[r].substring(0,i),s=n[r].substring(i+1)):(o=n[r],s=null),o in t||(t[o]=[]),o in Object.prototype||null===s||t[o].push(unescape(s))}return t},n;return void 0===e?(null===_&&(_="undefined"!=typeof window&&window.location&&window.location.search?t(window.location.search.substring(1)):{}),n=_):n=t(e),n},s.parseFragment=function(e){var t=e,n="",r=e.indexOf("?");r>0&&(t=e.substring(0,r),n=e.substring(r+1));var i=t.split("/");i.length>0&&""===i[0]&&i.shift();var o=""===n?{}:s.getQueryVariables(n);return{pathString:t,queryString:n,path:i,query:o}},s.makeRequest=function(e){var t=s.parseFragment(e),n={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,n){var r;return void 0===e?r=t.query:(r=t.query[e],r&&void 0!==n&&(r=r[n])),r},getQueryLast:function(e,t){var r,i=n.getQuery(e);return r=i?i[i.length-1]:t,r}};return n},s.makeLink=function(e,t,n){e=jQuery.isArray(e)?e.join("/"):e;var r=jQuery.param(t||{});return n=n||"",e+(r.length>0?"?"+r:"")+(n.length>0?"#"+n:"")},s.setPath=function(e,t,n){if("object"==typeof e&&null!==e)for(var r=0,i=t.length;r0&&o.push(r),s=t.lastIndex;var a=n[0][1];switch(a){case"s":case"o":i");break;case"%":o.push("%");break;default:o.push("<%"+a+"?>")}}return o.push(e.substring(s)),o.join("")},s.formatNumber=function(e,t,n,r){var i=e,o=isNaN(t=Math.abs(t))?2:t,s=void 0===n?",":n,a=void 0===r?".":r,u=i<0?"-":"",l=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",c=l.length>3?l.length%3:0;return u+(c?l.substr(0,c)+a:"")+l.substr(c).replace(/(\d{3})(?=\d)/g,"$1"+a)+(o?s+Math.abs(i-l).toFixed(o).slice(2):"")},s.formatSize=function(e){return e=e>=1073741824?s.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?s.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?s.formatNumber(e/1024,0)+" KiB":s.formatNumber(e,0)+" bytes",e},s.bytesFromIP=function(e){return-1!==e.indexOf(".")?s.bytesFromIPv4(e):-1!==e.indexOf(":")?s.bytesFromIPv6(e):null},s.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=s.createBuffer(),n=0;nn[r].end-n[r].start&&(r=n.length-1)):n.push({start:u,end:u})}t.push(o)}if(n.length>0){var l=n[r];l.end-l.start>0&&(t.splice(l.start,l.end-l.start+1,""),0===l.start&&t.unshift(""),7===l.end&&t.push(""))}return t.join(":")},s.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in s&&!e.update)return t(null,s.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return s.cores=navigator.hardwareConcurrency,t(null,s.cores);if("undefined"==typeof Worker)return s.cores=1,t(null,s.cores);if("undefined"==typeof Blob)return s.cores=2,t(null,s.cores);var n=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){for(var t=Date.now(),n=t+4;Date.now()a.st&&i.sti.st&&a.st 3 bytes.");let s=o.decode(r);if(!t.isValidCode(s))throw new Error(`multihash unknown function code: 0x${s.toString(16)}`);r=r.slice(o.decode.bytes);let a=o.decode(r);if(a<1)throw new Error(`multihash invalid length: 0x${a.toString(16)}`);if(r=r.slice(o.decode.bytes),r.length!==a)throw new Error(`multihash length inconsistent: 0x${r.toString("hex")}`);return{code:s,name:i.codes[s],length:a,digest:r}},t.encode=function n(r,i,s){if(!r||!i)throw new Error("multihash encode requires at least two args: digest, code");const a=t.coerceCode(i);if(!e.isBuffer(r))throw new Error("digest should be a Buffer");if(null==s&&(s=r.length),s&&r.length!==s)throw new Error("digest length should be equal to specified length.");return e.concat([e.from(o.encode(a)),e.from(o.encode(s)),r])},t.coerceCode=function e(n){let r=n;if("string"==typeof n){if(!i.names[n])throw new Error(`Unrecognized hash function named: ${n}`);r=i.names[n]}if("number"!=typeof r)throw new Error(`Hash function code should be a number. Got: ${r}`);if(!i.codes[r]&&!t.isAppCode(r))throw new Error(`Unrecognized function code: ${r}`);return r},t.isAppCode=function e(t){return t>0&&t<16},t.isValidCode=function e(n){return!!t.isAppCode(n)||!!i.codes[n]},t.validate=s,t.prefix=function e(t){return s(t),t.slice(0,2)}}).call(this,n(0).Buffer)},function(e){e.exports={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255}},function(e,t,n){"use strict";var r=n(222);e.exports=function e(t){return r(function(e,t){return e.push(t),e},[],t)}},function(e,t,n){"use strict";t.DAGNode=n(233),t.DAGLink=n(117),t.resolver=n(455),t.util=n(235)},function(e,t,n){e.exports={encode:n(778),decode:n(779),encodingLength:n(780)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=n(410),i=a(r),o=n(297),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){(0,i.default)(s.default,e,t)}e.exports=t.default},function(e,t,n){"use strict";var r=n(17),i=function e(t){return!!r.isString(t)&&/^[0-9a-fA-F]+$/.test(t)};e.exports={isValidJSON:function e(t){var n;if(!r.isString(t))return!1;try{n=JSON.parse(t)}catch(e){return!1}return"object"==typeof n},isHexa:i,isHexaString:i,cloneArray:function(e){return[].concat(e)},defineImmutable:function e(t,n){return Object.keys(n).forEach(function(e){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,value:n[e]})}),t},isNaturalNumber:function e(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t&&t>=0}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAsync=void 0;var r=n(216),i=o(r);function o(e){return e&&e.__esModule?e:{default:e}}var s="function"==typeof Symbol;function a(e){return s&&"AsyncFunction"===e[Symbol.toStringTag]}function u(e){return a(e)?(0,i.default)(e):e}t.default=u,t.isAsync=a},function(e,t,n){"use strict";var r=n(405);e.exports=function e(t,n){if(!t)return function(e,t){return e?r(t,e,n):t(!0)};Array.isArray(t)||(t=Object.keys(t).map(function(e){return t[e]}));var i=0;return function(e,o){if(e)return r(o,e,n);i>=t.length?o(!0):o(null,t[i++])}}},function(e,t,n){"use strict";const r=n(23),{ensureMultiaddr:i}=n(476),o=n(943),s=n(18);class a{constructor(e){s(e,"Missing peerId. Use Peer.create(cb) to create one"),this.id=e,this.multiaddrs=new o,this.protocols=new Set,this._connectedMultiaddr=void 0}connect(e){if(e=i(e),!this.multiaddrs.has(e)&&e.toString()!==`/ipfs/${this.id.toB58String()}`)throw new Error("can't be connected to missing multiaddr from set");this._connectedMultiaddr=e}disconnect(){this._connectedMultiaddr=void 0}isConnected(){return this._connectedMultiaddr}}a.create=((e,t)=>{if("function"==typeof e)return t=e,e=null,void r.create((e,n)=>{if(e)return t(e);t(null,new a(n))});"function"==typeof e.toJSON?t(null,new a(e)):r.createFromJSON(e,(e,n)=>t(e,new a(n)))}),a.isPeerInfo=(e=>Boolean("object"==typeof e&&e.id&&e.multiaddrs)),e.exports=a},function(e,t,n){var r=n(578),i=n(348),o=r.tfJSON,s=r.TfTypeError,a=r.TfPropertyTypeError,u=r.tfSubError,l=r.getValueTypeName,c={arrayOf:function e(t,n){function r(e,r){return!!i.Array(e)&&(!i.Nil(e)&&(!(void 0!==n.minLength&&e.lengthn.maxLength)&&((void 0===n.length||e.length===n.length)&&e.every(function(e,n){try{return h(t,e,r)}catch(e){throw u(e,n)}})))))}return t=f(t),n=n||{},r.toJSON=function(){var e="["+o(t)+"]";return void 0!==n.length?e+="{"+n.length+"}":void 0===n.minLength&&void 0===n.maxLength||(e+="{"+(void 0===n.minLength?0:n.minLength)+","+(void 0===n.maxLength?1/0:n.maxLength)+"}"),e},r},maybe:function e(t){function n(n,r){return i.Nil(n)||t(n,r,e)}return t=f(t),n.toJSON=function(){return"?"+o(t)},n},map:function e(t,n){function r(e,r){if(!i.Object(e))return!1;if(i.Nil(e))return!1;for(var o in e){try{n&&h(n,o,r)}catch(e){throw u(e,o,"key")}try{var s=e[o];h(t,s,r)}catch(e){throw u(e,o)}}return!0}return t=f(t),n&&(n=f(n)),r.toJSON=n?function(){return"{"+o(n)+": "+o(t)+"}"}:function(){return"{"+o(t)+"}"},r},object:function e(t){var n={};for(var r in t)n[r]=f(t[r]);function s(e,t){if(!i.Object(e))return!1;if(i.Nil(e))return!1;var r;try{for(r in n){var o=n[r],s=e[r];h(o,s,t)}}catch(e){throw u(e,r)}if(t)for(r in e)if(!n[r])throw new a(void 0,r);return!0}return s.toJSON=function(){return o(n)},s},anyOf:function e(){var t=[].slice.call(arguments).map(f);function n(e,n){return t.some(function(t){try{return h(t,e,n)}catch(e){return!1}})}return n.toJSON=function(){return t.map(o).join("|")},n},allOf:function e(){var t=[].slice.call(arguments).map(f);function n(e,n){return t.every(function(t){try{return h(t,e,n)}catch(e){return!1}})}return n.toJSON=function(){return t.map(o).join(" & ")},n},quacksLike:function e(t){function n(e){return t===l(e)}return n.toJSON=function(){return t},n},tuple:function e(){var t=[].slice.call(arguments).map(f);function n(e,n){return!i.Nil(e)&&(!i.Nil(e.length)&&((!n||e.length===t.length)&&t.every(function(t,r){try{return h(t,e[r],n)}catch(e){throw u(e,r)}})))}return n.toJSON=function(){return"("+t.map(o).join(", ")+")"},n},value:function e(t){function n(e){return e===t}return n.toJSON=function(){return t},n}};function f(e){if(i.String(e))return"?"===e[0]?c.maybe(e.slice(1)):i[e]||c.quacksLike(e);if(e&&i.Object(e)){if(i.Array(e)){if(1!==e.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return c.arrayOf(e[0])}return c.object(e)}return i.Function(e)?e:c.value(e)}function h(e,t,n,r){if(i.Function(e)){if(e(t,n))return!0;throw new s(r||e,t)}return h(f(e),t,n)}for(var p in c.oneOf=c.anyOf,i)h[p]=i[p];for(p in c)h[p]=c[p];var d=n(1353);for(p in d)h[p]=d[p];h.compile=f,h.TfTypeError=s,h.TfPropertyTypeError=a,e.exports=h},function(e,t,n){(function(t){e.exports=g;var r=n(27),i=n(55),o=n(15),s=n(207),a=n(102),u=n(379).DiffieHellman,l=n(97),c=n(47),f=n(50),h;try{h=n(712)}catch(e){}var p=l.InvalidAlgorithmError,d=l.KeyParseError,m={};function g(e){r.object(e,"options"),r.arrayOfObject(e.parts,"options.parts"),r.string(e.type,"options.type"),r.optionalString(e.comment,"options.comment");var t=i.info[e.type];if("object"!=typeof t)throw new p(e.type);for(var n={},o=0,s;o1024&&(e="sha256"),"ed25519"===this.type&&(e="sha512"),"ecdsa"===this.type&&(e=this.size<=256?"sha256":this.size<=384?"sha384":"sha512"),e},g.prototype.createVerify=function(e){if(void 0===e&&(e=this.defaultHashAlgorithm()),r.string(e,"hash algorithm"),"ed25519"===this.type&&void 0!==h)return new h.Verifier(this,e);if("curve25519"===this.type)throw new Error("Curve25519 keys are not suitable for signing or verification");var n,i,s;try{i=e.toUpperCase(),n=o.createVerify(i)}catch(e){s=e}(void 0===n||s instanceof Error&&s.message.match(/Unknown message digest/))&&(i="RSA-",i+=e.toUpperCase(),n=o.createVerify(i)),r.ok(n,"failed to create verifier");var u=n.verify.bind(n),l=this.toBuffer("pkcs8"),c=this.curve,f=this;return n.verify=function(n,r){if(a.isSignature(n,[2,0]))return n.type===f.type&&((!n.hashAlgorithm||n.hashAlgorithm===e)&&((!n.curve||"ecdsa"!==f.type||n.curve===c)&&u(l,n.toBuffer("asn1"))));if("string"==typeof n||t.isBuffer(n))return u(l,n,r);throw a.isSignature(n,[1,0])?new Error("signature was created by too old a version of sshpk and cannot be verified"):new TypeError("signature must be a string, Buffer, or Signature object")},n},g.prototype.createDiffieHellman=function(){if("rsa"===this.type)throw new Error("RSA keys do not support Diffie-Hellman");return new u(this)},g.prototype.createDH=g.prototype.createDiffieHellman,g.parse=function(e,t,n){"string"!=typeof e&&r.buffer(e,"data"),void 0===t&&(t="auto"),r.string(t,"format"),"string"==typeof n&&(n={filename:n}),r.optionalObject(n,"options"),void 0===n&&(n={}),r.optionalString(n.filename,"options.filename"),void 0===n.filename&&(n.filename="(unnamed)"),r.object(m[t],"formats[format]");try{var i=m[t].read(e,n);return i instanceof f&&(i=i.toPublic()),i.comment||(i.comment=n.filename),i}catch(e){if("KeyEncryptedError"===e.name)throw e;throw new d(n.filename,t,e)}},g.isKey=function(e,t){return c.isCompatible(e,g,t)},g.prototype._sshpkApiVersion=[1,7],g._oldVersionDetect=function(e){return r.func(e.toBuffer),r.func(e.fingerprint),e.createDH?[1,4]:e.defaultHashAlgorithm?[1,3]:e.formats.auto?[1,2]:e.formats.pkcs1?[1,1]:[1,0]}}).call(this,n(0).Buffer)},function(e,t,n){e.exports={bufferSplit:_,addRSAMissing:P,calculateDSAPublic:T,calculateED25519Public:j,calculateX25519Public:O,mpNormalize:x,mpDenormalize:C,ecNormalize:k,countZeros:w,assertCompatible:m,isCompatible:d,opensslKeyDeriv:b,opensshCipherInfo:R,publicFromPrivateECDSA:B,zeroPadToLength:A,writeBitString:E,readBitString:S,pbkdf2:v};var r=n(27),i=n(31).Buffer,o=n(50),s=n(46),a=n(15),u=n(55),l=n(103),c=n(286),f=n(208).BigInteger,h=n(209),p=3;function d(e,t,n){if(null===e||"object"!=typeof e)return!1;if(void 0===n&&(n=t.prototype._sshpkApiVersion),e instanceof t&&t.prototype._sshpkApiVersion[0]==n[0])return!0;for(var r=Object.getPrototypeOf(e),i=0;r.constructor.name!==t.name;)if(r=Object.getPrototypeOf(r),!r||++i>p)return!1;if(r.constructor.name!==t.name)return!1;var o=r._sshpkApiVersion;return void 0===o&&(o=t._oldVersionDetect(e)),!(o[0]!=n[0]||o[1]=n[1],i+" must be compatible with "+t.name+" klass version "+n[0]+"."+n[1])}}var g={"des-ede3-cbc":{key:24,iv:8},"aes-128-cbc":{key:16,iv:16},"aes-256-cbc":{key:32,iv:16}},y=8;function b(e,t,n,o){r.buffer(t,"salt"),r.buffer(n,"passphrase"),r.number(o,"iteration count");var s=g[e],u,l,c;r.object(s,"supported cipher"),t=t.slice(0,y);for(var f=i.alloc(0);f.length=t.length){var a=s+1;n.push(e.slice(i,a-o)),i=a,o=0}return i<=e.length&&n.push(e.slice(i,e.length)),n}function k(e,t){if(r.buffer(e),0===e[0]&&4===e[1])return t?e:e.slice(1);if(4===e[0]){if(!t)return e}else{for(;0===e[0];)e=e.slice(1);if(2===e[0]||3===e[0])throw new Error("Compressed elliptic curve points are not supported");if(4!==e[0])throw new Error("Not a valid elliptic curve point");if(!t)return e}var n=i.alloc(e.length+1);return n[0]=0,e.copy(n,1),n}function S(e,t){void 0===t&&(t=l.Ber.BitString);var n=e.readString(t,!0);return r.strictEqual(n[0],0,"bit strings with unused bits are not supported (0x"+n[0].toString(16)+")"),n.slice(1)}function E(e,t,n){void 0===n&&(n=l.Ber.BitString);var r=i.alloc(t.length+1);r[0]=0,t.copy(r,1),e.writeBuffer(r,n)}function x(e){for(r.buffer(e);e.length>1&&0===e[0]&&0==(128&e[1]);)e=e.slice(1);if(128==(128&e[0])){var t=i.alloc(e.length+1);t[0]=0,e.copy(t,1),e=t}return e}function C(e){for(r.buffer(e);e.length>1&&0===e[0];)e=e.slice(1);return e}function A(e,t){for(r.buffer(e),r.number(t);e.length>t;)r.equal(e[0],0),e=e.slice(1);for(;e.length{this.blockSizes.push(e)}),this.removeBlockSize=(e=>{this.blockSizes.splice(e,1)}),this.fileSize=(()=>{if(a.indexOf(this.type)>=0)return;let e=0;return this.blockSizes.forEach(t=>{e+=t}),t&&(e+=t.length),e}),this.marshal=(()=>{let e;switch(this.type){case"raw":e=o.DataType.Raw;break;case"directory":e=o.DataType.Directory;break;case"file":e=o.DataType.File;break;case"metadata":e=o.DataType.Metadata;break;case"symlink":e=o.DataType.Symlink;break;case"hamt-sharded-directory":e=o.DataType.HAMTShard;break;default:throw new Error(`Unkown type: "${this.type}"`)}let t=this.fileSize(),n=this.data;this.data&&this.data.length||(n=void 0);let r=this.blockSizes;return this.blockSizes&&this.blockSizes.length||(r=void 0),o.encode({Type:e,Data:n,filesize:t,blocksizes:r,hashType:this.hashType,fanout:this.fanout})})}u.unmarshal=(e=>{const t=o.decode(e);t.Data||(t.Data=void 0);const n=new u(s[t.Type],t.Data);return n.blockSizes=t.blocksizes,n}),t=e.exports=u},function(e,t,n){"use strict";(function(t){var r=n(597),i=n(25),o=n(17),s=function(e){for(var n=new t(e.length),r=0;re.size?n=r.trim(n,o):o0&&0==(127&e[e.length-1])&&(e.length<=1||0==(128&e[e.length-2])))throw new Error("non-minimally encoded script number");return r.fromSM(e,{endian:"little"})},r.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},r.prototype.gt=function(e){return this.cmp(e)>0},r.prototype.gte=function(e){return this.cmp(e)>=0},r.prototype.lt=function(e){return this.cmp(e)<0},r.trim=function(e,t){return e.slice(t-e.length,e.length)},r.pad=function(e,n,r){for(var i=new t(r),o=0;o!(!e||!e[r])),i}function i(e,{className:t,symbolName:n,withoutNew:r}){const i=Symbol.for(n),o={[t]:function(...t){if(r&&!(this instanceof o))return new o(...t);const n=e.call(this,...t)||this;return n&&!n[i]&&Object.defineProperty(n,i,{value:!0}),n}}[t];return o.prototype=Object.create(e.prototype),o.prototype.constructor=o,Object.defineProperty(o.prototype,Symbol.toStringTag,{get:()=>t}),o[`is${t}`]=(e=>!(!e||!e[i])),o}e.exports=r,e.exports.proto=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=n(218),i=a(r),o=n(410),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){(0,s.default)(i.default,e,t)}e.exports=t.default},function(e,t,n){var r=n(31).Buffer,i={dsa:{parts:["p","q","g","y"],sizePart:"p"},rsa:{parts:["e","n"],sizePart:"n"},ecdsa:{parts:["curve","Q"],sizePart:"Q"},ed25519:{parts:["A"],sizePart:"A"}};i.curve25519=i.ed25519;var o={dsa:{parts:["p","q","g","y","x"]},rsa:{parts:["n","e","d","iqmp","p","q"]},ecdsa:{parts:["curve","Q","d"]},ed25519:{parts:["A","k"]}};o.curve25519=o.ed25519;var s={md5:!0,sha1:!0,sha256:!0,sha384:!0,sha512:!0},a={nistp256:{size:256,pkcs8oid:"1.2.840.10045.3.1.7",p:r.from("00ffffffff 00000001 00000000 0000000000000000 ffffffff ffffffff ffffffff".replace(/ /g,""),"hex"),a:r.from("00FFFFFFFF 00000001 00000000 0000000000000000 FFFFFFFF FFFFFFFF FFFFFFFC".replace(/ /g,""),"hex"),b:r.from("5ac635d8 aa3a93e7 b3ebbd55 769886bc651d06b0 cc53b0f6 3bce3c3e 27d2604b".replace(/ /g,""),"hex"),s:r.from("00c49d3608 86e70493 6a6678e1 139d26b7819f7e90".replace(/ /g,""),"hex"),n:r.from("00ffffffff 00000000 ffffffff ffffffffbce6faad a7179e84 f3b9cac2 fc632551".replace(/ /g,""),"hex"),G:r.from("046b17d1f2 e12c4247 f8bce6e5 63a440f277037d81 2deb33a0 f4a13945 d898c2964fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e162bce3357 6b315ece cbb64068 37bf51f5".replace(/ /g,""),"hex")},nistp384:{size:384,pkcs8oid:"1.3.132.0.34",p:r.from("00ffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff fffffffeffffffff 00000000 00000000 ffffffff".replace(/ /g,""),"hex"),a:r.from("00FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFEFFFFFFFF 00000000 00000000 FFFFFFFC".replace(/ /g,""),"hex"),b:r.from("b3312fa7 e23ee7e4 988e056b e3f82d19181d9c6e fe814112 0314088f 5013875ac656398d 8a2ed19d 2a85c8ed d3ec2aef".replace(/ /g,""),"hex"),s:r.from("00a335926a a319a27a 1d00896a 6773a4827acdac73".replace(/ /g,""),"hex"),n:r.from("00ffffffff ffffffff ffffffff ffffffffffffffff ffffffff c7634d81 f4372ddf581a0db2 48b0a77a ecec196a ccc52973".replace(/ /g,""),"hex"),G:r.from("04aa87ca22 be8b0537 8eb1c71e f320ad746e1d3b62 8ba79b98 59f741e0 82542a385502f25d bf55296c 3a545e38 72760ab73617de4a 96262c6f 5d9e98bf 9292dc29f8f41dbd 289a147c e9da3113 b5f0b8c00a60b1ce 1d7e819d 7a431d7c 90ea0e5f".replace(/ /g,""),"hex")},nistp521:{size:521,pkcs8oid:"1.3.132.0.35",p:r.from("01ffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffffffff".replace(/ /g,""),"hex"),a:r.from("01FFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFC".replace(/ /g,""),"hex"),b:r.from("51953eb961 8e1c9a1f 929a21a0 b68540eea2da725b 99b315f3 b8b48991 8ef109e156193951 ec7e937b 1652c0bd 3bb1bf073573df88 3d2c34f1 ef451fd4 6b503f00".replace(/ /g,""),"hex"),s:r.from("00d09e8800 291cb853 96cc6717 393284aaa0da64ba".replace(/ /g,""),"hex"),n:r.from("01ffffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff fffffffa51868783 bf2f966b 7fcc0148 f709a5d03bb5c9b8 899c47ae bb6fb71e 91386409".replace(/ /g,""),"hex"),G:r.from("0400c6 858e06b7 0404e9cd 9e3ecb66 2395b4429c648139 053fb521 f828af60 6b4d3dbaa14b5e77 efe75928 fe1dc127 a2ffa8de3348b3c1 856a429b f97e7e31 c2e5bd660118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd998f54449 579b4468 17afbd17 273e662c97ee7299 5ef42640 c550b901 3fad0761353c7086 a272c240 88be9476 9fd16650".replace(/ /g,""),"hex")}};e.exports={info:i,privInfo:o,hashAlgs:s,curves:a}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var r=n(218),i=l(r),o=n(394),s=l(o),a=n(42),u=l(a);function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t,n){(0,i.default)(e,(0,s.default)((0,u.default)(t)),n)}e.exports=t.default},function(e,t,n){e.exports=o;var r=n(6).EventEmitter,i=n(1);function o(){r.call(this)}i(o,r),o.Readable=n(302),o.Writable=n(851),o.Duplex=n(852),o.Transform=n(853),o.PassThrough=n(854),o.Stream=o,o.prototype.pipe=function(e,t){var n=this;function i(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(n.on("end",a),n.on("close",u));var s=!1;function a(){s||(s=!0,e.end())}function u(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function l(e){if(c(),0===r.listenerCount(this,"error"))throw e}function c(){n.removeListener("data",i),e.removeListener("drain",o),n.removeListener("end",a),n.removeListener("close",u),n.removeListener("error",l),e.removeListener("error",l),n.removeListener("end",c),n.removeListener("close",c),e.removeListener("close",c)}return n.on("error",l),e.on("error",l),n.on("end",c),n.on("close",c),e.on("close",c),e.emit("pipe",n),e}},function(e,t,n){"use strict";(function(t){const r=n(35),i=n(864);function o(e,t,n,i){if("function"==typeof n&&(i=n,n=void 0),!i)throw new Error("Missing callback");o.digest(e,t,n,(e,o)=>{if(e)return i(e);i(null,r.encode(o,t,n))})}e.exports=o,o.Buffer=t,o.multihash=r,o.digest=function(e,t,n,r){if("function"==typeof n&&(r=n,n=void 0),!r)throw new Error("Missing callback");let i=r,s;n&&(i=((e,t)=>{if(e)return r(e);r(null,t.slice(0,n))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=r.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var r=n(28),i=n(255),o=n(1109),s=function(){},a=/^v?\.0/.test(t.version),u=function(e){return"function"==typeof e},l=function(e){return!!a&&(!!o&&((e instanceof(o.ReadStream||s)||e instanceof(o.WriteStream||s))&&u(e.close)))},c=function(e){return e.setHeader&&u(e.abort)},f=function(e,t,n,o){o=r(o);var a=!1;e.on("close",function(){a=!0}),i(e,{readable:t,writable:n},function(e){if(e)return o(e);a=!0,o()});var f=!1;return function(t){if(!a&&!f)return f=!0,l(e)?e.close(s):c(e)?e.abort():u(e.destroy)?e.destroy():void o(t||new Error("stream was destroyed"))}},h=function(e){e()},p=function(e,t){return e.pipe(t)},d=function(){var e=Array.prototype.slice.call(arguments),t=u(e[e.length-1]||s)&&e.pop()||s,n;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Error("pump requires two streams per minimum");var r=e.map(function(i,o){var s=o0;return f(i,s,a,function(e){n||(n=e),e&&r.forEach(h),s||(r.forEach(h),t(n))})});return e.reduce(p)};e.exports=d}).call(this,n(2))},function(e,t,n){"use strict";(function(t){var r=n(15),i=n(30),o=n(25),s=e.exports;s.sha1=function(e){return o.checkArgument(i.isBuffer(e)),r.createHash("sha1").update(e).digest()},s.sha1.blocksize=512,s.sha256=function(e){return o.checkArgument(i.isBuffer(e)),r.createHash("sha256").update(e).digest()},s.sha256.blocksize=512,s.sha256sha256=function(e){return o.checkArgument(i.isBuffer(e)),s.sha256(s.sha256(e))},s.ripemd160=function(e){return o.checkArgument(i.isBuffer(e)),r.createHash("ripemd160").update(e).digest()},s.sha256ripemd160=function(e){return o.checkArgument(i.isBuffer(e)),s.ripemd160(s.sha256(e))},s.sha512=function(e){return o.checkArgument(i.isBuffer(e)),r.createHash("sha512").update(e).digest()},s.sha512.blocksize=1024,s.hmac=function(e,n,r){o.checkArgument(i.isBuffer(n)),o.checkArgument(i.isBuffer(r)),o.checkArgument(e.blocksize);var s=e.blocksize/8;if(r.length>s)r=e(r);else if(r=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e){"string"!=typeof e&&(e+="");var t=0,n=-1,r=!0,i;for(i=e.length-1;i>=0;--i)if(47===e.charCodeAt(i)){if(!r){t=i+1;break}}else-1===n&&(r=!1,n=i+1);return-1===n?"":e.slice(t,n)}function i(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!r;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,r="/"===s.charAt(0))}return t=n(i(t.split("/"),function(e){return!!e}),!r).join("/"),(r?"/":"")+t||"."},t.normalize=function(e){var r=t.isAbsolute(e),s="/"===o(e,-1);return e=n(i(e.split("/"),function(e){return!!e}),!r).join("/"),e||r||(e="."),e&&s&&(e+="/"),(r?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(i(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,n){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var i=r(e.split("/")),o=r(n.split("/")),s=Math.min(i.length,o.length),a=s,u=0;u=1;--o)if(t=e.charCodeAt(o),47===t){if(!i){r=o;break}}else i=!1;return-1===r?n?"/":".":n&&1===r?"/":e.slice(0,r)},t.basename=function(e,t){var n=r(e);return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,n=0,r=-1,i=!0,o=0,s=e.length-1;s>=0;--s){var a=e.charCodeAt(s);if(47!==a)-1===r&&(i=!1,r=s+1),46===a?-1===t?t=s:1!==o&&(o=1):-1!==t&&(o=-1);else if(!i){n=s+1;break}}return-1===t||-1===r||0===o||1===o&&t===r-1&&t===n+1?"":e.slice(t,r)};var o="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}}).call(this,n(2))},function(e,t,n){var r;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,u=Math.ceil,l=Math.floor,c="[BigNumber Error] ",f=c+"Number primitive has more than 15 significant digits: ",h=1e14,p=14,d=9007199254740991,m=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,y=1e9;function b(e){var t,n,r,i=H.prototype={constructor:H,toString:null,valueOf:null},o=new H(1),C=20,A=4,I=-7,T=21,j=-1e7,O=1e7,P=!1,B=1,R=0,N={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},M="0123456789abcdefghijklmnopqrstuvwxyz",L,F,D,U,z,q,K;function H(e,t){var i,o,a,u,c,h,m,g,y=this;if(!(y instanceof H))return new H(e,t);if(null==t){if(e&&!0===e._isBigNumber)return y.s=e.s,void(!e.c||e.e>O?y.c=y.e=null:e.e=10;c/=10,u++);return void(u>O?y.c=y.e=null:(y.e=u,y.c=[e]))}g=String(e)}else{if(!s.test(g=String(e)))return r(y,g,h);y.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(u=g.indexOf("."))>-1&&(g=g.replace(".","")),(c=g.search(/e/i))>0?(u<0&&(u=c),u+=+g.slice(c+1),g=g.substring(0,c)):u<0&&(u=g.length)}else{if(k(t,2,M.length,"Base"),10==t)return y=new H(e),G(y,C+y.e+1,A);if(g=String(e),h="number"==typeof e){if(0*e!=0)return r(y,g,h,t);if(y.s=1/e<0?(g=g.slice(1),-1):1,H.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(f+e)}else y.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(i=M.slice(0,t),u=c=0,m=g.length;cu){u=m;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,c=-1,u=0;continue}return r(y,String(e),h,t)}h=!1,g=n(g,t,10,y.s),(u=g.indexOf("."))>-1?g=g.replace(".",""):u=g.length}for(c=0;48===g.charCodeAt(c);c++);for(m=g.length;48===g.charCodeAt(--m););if(g=g.slice(c,++m)){if(m-=c,h&&H.DEBUG&&m>15&&(e>d||e!==l(e)))throw Error(f+y.s*e);if((u=u-c-1)>O)y.c=y.e=null;else if(u=T)?E(u,s):x(u,s,"0");else if(e=G(new H(e),t,n),o=e.e,u=w(e.c),a=u.length,1==r||2==r&&(t<=o||o<=I)){for(;aa){if(--t>0)for(u+=".";t--;u+="0");}else if(t+=o-a,t>0)for(o+1==a&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function W(e,t){for(var n,r=1,i=new H(e[0]);r=10;i/=10,r++);return(n=r+n*p-1)>O?e.c=e.e=null:n=10;a/=10,i++);if(o=t-i,o<0)o+=p,s=t,c=g[f=0],d=c/y[i-s-1]%10|0;else if(f=u((o+1)/p),f>=g.length){if(!r)break e;for(;g.length<=f;g.push(0));c=d=0,i=1,o%=p,s=o-p+1}else{for(c=a=g[f],i=1;a>=10;a/=10,i++);o%=p,s=o-p+i,d=s<0?0:c/y[i-s-1]%10|0}if(r=r||t<0||null!=g[f+1]||(s<0?c:c%y[i-s-1]),r=n<4?(d||r)&&(0==n||n==(e.s<0?3:2)):d>5||5==d&&(4==n||r||6==n&&(o>0?s>0?c/y[i-s]:0:g[f-1])%10&1||n==(e.s<0?8:7)),t<1||!g[0])return g.length=0,r?(t-=e.e+1,g[0]=y[(p-t%p)%p],e.e=-t||0):g[0]=e.e=0,e;if(0==o?(g.length=f,a=1,f--):(g.length=f+1,a=y[p-o],g[f]=s>0?l(c/y[i-s]%y[s])*a:0),r)for(;;){if(0==f){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=a,a=1;s>=10;s/=10,a++);o!=a&&(e.e++,g[0]==h&&(g[0]=1));break}if(g[f]+=a,g[f]!=h)break;g[f--]=0,a=1}for(o=g.length;0===g[--o];g.pop());}e.e>O?e.c=e.e=null:e.e=T?E(t,n):x(t,n,"0"),e.s<0?"-"+t:t)}return H.clone=b,H.ROUND_UP=0,H.ROUND_DOWN=1,H.ROUND_CEIL=2,H.ROUND_FLOOR=3,H.ROUND_HALF_UP=4,H.ROUND_HALF_DOWN=5,H.ROUND_HALF_EVEN=6,H.ROUND_HALF_CEIL=7,H.ROUND_HALF_FLOOR=8,H.EUCLID=9,H.config=H.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(c+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(n=e[t],k(n,0,y,t),C=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(n=e[t],k(n,0,8,t),A=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&(n=e[t],n&&n.pop?(k(n[0],-y,0,t),k(n[1],0,y,t),I=n[0],T=n[1]):(k(n,-y,y,t),I=-(T=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if(n=e[t],n&&n.pop)k(n[0],-y,-1,t),k(n[1],1,y,t),j=n[0],O=n[1];else{if(k(n,-y,y,t),!n)throw Error(c+t+" cannot be zero: "+n);j=-(O=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if(n=e[t],n!==!!n)throw Error(c+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw P=!n,Error(c+"crypto unavailable");P=n}else P=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(n=e[t],k(n,0,9,t),B=n),e.hasOwnProperty(t="POW_PRECISION")&&(n=e[t],k(n,0,y,t),R=n),e.hasOwnProperty(t="FORMAT")){if(n=e[t],"object"!=typeof n)throw Error(c+t+" not an object: "+n);N=n}if(e.hasOwnProperty(t="ALPHABET")){if(n=e[t],"string"!=typeof n||/^.$|[+-.\s]|(.).*\1/.test(n))throw Error(c+t+" invalid: "+n);M=n}}return{DECIMAL_PLACES:C,ROUNDING_MODE:A,EXPONENTIAL_AT:[I,T],RANGE:[j,O],CRYPTO:P,MODULO_MODE:B,POW_PRECISION:R,FORMAT:N,ALPHABET:M}},H.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!H.DEBUG)return!0;var t,n,r=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-y&&i<=y&&i===l(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break e}if(t=(i+1)%p,t<1&&(t+=p),String(r[0]).length==t){for(t=0;t=h||n!==l(n))break e;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(c+"Invalid BigNumber: "+e)},H.maximum=H.max=function(){return W(arguments,i.lt)},H.minimum=H.min=function(){return W(arguments,i.gt)},H.random=(L=9007199254740992,F=Math.random()*L&2097151?function(){return l(Math.random()*L)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,i,s,a=0,f=[],h=new H(o);if(null==e?e=C:k(e,0,y),i=u(e/p),P)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));a>>11),s>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[a]=n[0],t[a+1]=n[1]):(f.push(s%1e14),a+=2);a=i/2}else{if(!crypto.randomBytes)throw P=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(i*=7);a=9e15?crypto.randomBytes(7).copy(t,a):(f.push(s%1e14),a+=7);a=i/7}if(!P)for(;a=10;s/=10,a++);an-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/n|0,o[i]%=n)}return o.reverse()}return function(r,i,o,s,a){var u,l,c,f,h,p,d,m,g=r.indexOf("."),y=C,b=A;for(g>=0&&(f=R,R=0,r=r.replace(".",""),m=new H(i),p=m.pow(r.length-g),R=f,m.c=n(x(w(p.c),p.e,"0"),10,o,e),m.e=m.c.length),d=n(r,i,o,a?(u=M,e):(u=e,M)),c=f=d.length;0==d[--f];d.pop());if(!d[0])return u.charAt(0);if(g<0?--c:(p.c=d,p.e=c,p.s=s,p=t(p,m,y,b,o),d=p.c,h=p.r,c=p.e),l=c+y+1,g=d[l],f=o/2,h=h||l<0||null!=d[l+1],h=b<4?(null!=g||h)&&(0==b||b==(p.s<0?3:2)):g>f||g==f&&(4==b||h||6==b&&1&d[l-1]||b==(p.s<0?8:7)),l<1||!d[0])r=h?x(u.charAt(1),-y,u.charAt(0)):u.charAt(0);else{if(d.length=l,h)for(--o;++d[--l]>o;)d[l]=0,l||(++c,d=[1].concat(d));for(f=d.length;!d[--f];);for(g=0,r="";g<=f;r+=u.charAt(d[g++]));r=x(r,c,u.charAt(0))}return r}}(),t=function(){function e(e,t,n){var r,i,o,s,a=0,u=e.length,l=t%g,c=t/g|0;for(e=e.slice();u--;)o=e[u]%g,s=e[u]/g|0,r=c*o+s*l,i=l*o+r%g*g+a,a=(i/n|0)+(r/g|0)+c*s,e[u]=i%n;return a&&(e=[a].concat(e)),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]1;e.splice(0,1));}return function(r,i,o,s,a){var u,c,f,d,m,g,y,b,w,_,k,S,E,x,C,A,I,T=r.s==i.s?1:-1,j=r.c,O=i.c;if(!(j&&j[0]&&O&&O[0]))return new H(r.s&&i.s&&(j?!O||j[0]!=O[0]:O)?j&&0==j[0]||!O?0*T:T/0:NaN);for(b=new H(T),w=b.c=[],c=r.e-i.e,T=o+c+1,a||(a=h,c=v(r.e/p)-v(i.e/p),T=T/p|0),f=0;O[f]==(j[f]||0);f++);if(O[f]>(j[f]||0)&&c--,T<0)w.push(1),d=!0;else{for(x=j.length,A=O.length,f=0,T+=2,m=l(a/(O[0]+1)),m>1&&(O=e(O,m,a),j=e(j,m,a),A=O.length,x=j.length),E=A,_=j.slice(0,A),k=_.length;k=a/2&&C++;do{if(m=0,u=t(O,_,A,k),u<0){if(S=_[0],A!=k&&(S=S*a+(_[1]||0)),m=l(S/C),m>1)for(m>=a&&(m=a-1),g=e(O,m,a),y=g.length,k=_.length;1==t(g,_,y,k);)m--,n(g,A=10;T/=10,f++);G(b,o+(b.e=f+c*p-1)+1,s,d)}else b.e=c,b.r=+d;return b}}(),D=/^(-?)0([xbo])(?=\w[\w.]*$)/i,U=/^([^.]+)\.$/,z=/^\.([^.]+)$/,q=/^-?(Infinity|NaN)$/,K=/^\s*\+(?=[\w.])|^\s+|\s+$/g,r=function(e,t,n,r){var i,o=n?t:t.replace(K,"");if(q.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(D,function(e,t,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?e:t}),r&&(i=r,o=o.replace(U,"$1").replace(z,"0.$1")),t!=o))return new H(o,i);if(H.DEBUG)throw Error(c+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},i.absoluteValue=i.abs=function(){var e=new H(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return _(this,new H(e,t))},i.decimalPlaces=i.dp=function(e,t){var n,r,i,o=this;if(null!=e)return k(e,0,y),null==t?t=A:k(t,0,8),G(new H(o),e+o.e+1,t);if(!(n=o.c))return null;if(r=((i=n.length-1)-v(this.e/p))*p,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},i.dividedBy=i.div=function(e,n){return t(this,new H(e,n),C,A)},i.dividedToIntegerBy=i.idiv=function(e,n){return t(this,new H(e,n),0,1)},i.exponentiatedBy=i.pow=function(e,t){var n,r,i,s,a,f,h,d,m,g=this;if(e=new H(e),e.c&&!e.isInteger())throw Error(c+"Exponent not an integer: "+Y(e));if(null!=t&&(t=new H(t)),f=e.e>14,!g.c||!g.c[0]||1==g.c[0]&&!g.e&&1==g.c.length||!e.c||!e.c[0])return m=new H(Math.pow(+Y(g),f?2-S(e):+Y(e))),t?m.mod(t):m;if(h=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new H(NaN);r=!h&&g.isInteger()&&t.isInteger(),r&&(g=g.mod(t))}else{if(e.e>9&&(g.e>0||g.e<-1||(0==g.e?g.c[0]>1||f&&g.c[1]>=24e7:g.c[0]<8e13||f&&g.c[0]<=9999975e7)))return s=g.s<0&&S(e)?-0:0,g.e>-1&&(s=1/s),new H(h?1/s:s);R&&(s=u(R/p+2))}for(f?(n=new H(.5),h&&(e.s=1),d=S(e)):(i=Math.abs(+Y(e)),d=i%2),m=new H(o);;){if(d){if(m=m.times(g),!m.c)break;s?m.c.length>s&&(m.c.length=s):r&&(m=m.mod(t))}if(i){if(i=l(i/2),0===i)break;d=i%2}else if(e=e.times(n),G(e,e.e+1,1),e.e>14)d=S(e);else{if(i=+Y(e),0===i)break;d=i%2}g=g.times(g),s?g.c&&g.c.length>s&&(g.c.length=s):r&&(g=g.mod(t))}return r?m:(h&&(m=o.div(m)),t?m.mod(t):s?G(m,R,A,a):m)},i.integerValue=function(e){var t=new H(this);return null==e?e=A:k(e,0,8),G(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return 0===_(this,new H(e,t))},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return _(this,new H(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return 1===(t=_(this,new H(e,t)))||0===t},i.isInteger=function(){return!!this.c&&v(this.e/p)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return _(this,new H(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return-1===(t=_(this,new H(e,t)))||0===t},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&0==this.c[0]},i.minus=function(e,t){var n,r,i,o,s=this,a=s.s;if(e=new H(e,t),t=e.s,!a||!t)return new H(NaN);if(a!=t)return e.s=-t,s.plus(e);var u=s.e/p,l=e.e/p,c=s.c,f=e.c;if(!u||!l){if(!c||!f)return c?(e.s=-t,e):new H(f?s:NaN);if(!c[0]||!f[0])return f[0]?(e.s=-t,e):new H(c[0]?s:3==A?-0:0)}if(u=v(u),l=v(l),c=c.slice(),a=u-l){for((o=a<0)?(a=-a,i=c):(l=u,i=f),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(r=(o=(a=c.length)<(t=f.length))?a:t,a=t=0;t0)for(;t--;c[n++]=0);for(t=h-1;r>a;){if(c[--r]=0;){for(n=0,d=S[i]%w,m=S[i]/w|0,s=u,o=i+s;o>i;)l=k[--s]%w,c=k[s]/w|0,a=m*l+c*d,l=d*l+a%w*w+y[o]+n,n=(l/b|0)+(a/w|0)+m*c,y[o--]=l%b;y[o]=n}return n?++r:y.splice(0,1),$(e,y,r)},i.negated=function(){var e=new H(this);return e.s=-e.s||null,e},i.plus=function(e,t){var n,r=this,i=r.s;if(e=new H(e,t),t=e.s,!i||!t)return new H(NaN);if(i!=t)return e.s=-t,r.minus(e);var o=r.e/p,s=e.e/p,a=r.c,u=e.c;if(!o||!s){if(!a||!u)return new H(i/0);if(!a[0]||!u[0])return u[0]?e:new H(a[0]?r:0*i)}if(o=v(o),s=v(s),a=a.slice(),i=o-s){for(i>0?(s=o,n=u):(i=-i,n=a),n.reverse();i--;n.push(0));n.reverse()}for(i=a.length,t=u.length,i-t<0&&(n=u,u=a,a=n,t=i),i=0;t;)i=(a[--t]=a[t]+u[t]+i)/h|0,a[t]=h===a[t]?0:a[t]%h;return i&&(a=[i].concat(a),++s),$(e,a,s)},i.precision=i.sd=function(e,t){var n,r,i,o=this;if(null!=e&&e!==!!e)return k(e,1,y),null==t?t=A:k(t,0,8),G(new H(o),e,t);if(!(n=o.c))return null;if(i=n.length-1,r=i*p+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&o.e+1>r&&(r=o.e+1),r},i.shiftedBy=function(e){return k(e,-d,d),this.times("1e"+e)},i.squareRoot=i.sqrt=function(){var e,n,r,i,o,s=this,a=s.c,u=s.s,l=s.e,c=C+4,f=new H("0.5");if(1!==u||!a||!a[0])return new H(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);if(u=Math.sqrt(+Y(s)),0==u||u==1/0?(n=w(a),(n.length+l)%2==0&&(n+="0"),u=Math.sqrt(+n),l=v((l+1)/2)-(l<0||l%2),u==1/0?n="1e"+l:(n=u.toExponential(),n=n.slice(0,n.indexOf("e")+1)+l),r=new H(n)):r=new H(u+""),r.c[0])for(l=r.e,u=l+c,u<3&&(u=0);;)if(o=r,r=f.times(o.plus(t(s,o,c,1))),w(o.c).slice(0,u)===(n=w(r.c)).slice(0,u)){if(r.e0&&m>0){for(o=m%a||a,f=d.substr(0,o);o0&&(f+=l+d.slice(o)),p&&(f="-"+f)}r=h?f+(n.decimalSeparator||"")+((u=+n.fractionGroupSize)?h.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):h):f}return(n.prefix||"")+r+(n.suffix||"")},i.toFraction=function(e){var n,r,i,s,a,u,l,f,h,d,g,y,b=this,v=b.c;if(null!=e&&(l=new H(e),!l.isInteger()&&(l.c||1!==l.s)||l.lt(o)))throw Error(c+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+Y(l));if(!v)return new H(b);for(n=new H(o),h=r=new H(o),i=f=new H(o),y=w(v),a=n.e=y.length-b.e-1,n.c[0]=m[(u=a%p)<0?p+u:u],e=!e||l.comparedTo(n)>0?a>0?n:h:l,u=O,O=1/0,l=new H(y),f.c[0]=0;d=t(l,n,0,1),s=r.plus(d.times(i)),1!=s.comparedTo(e);)r=i,i=s,h=f.plus(d.times(s=h)),f=s,n=l.minus(d.times(s=n)),l=s;return s=t(e.minus(r),i,0,1),f=f.plus(s.times(h)),r=r.plus(s.times(i)),f.s=h.s=b.s,a*=2,g=t(h,i,a,A).minus(b).abs().comparedTo(t(f,r,a,A).minus(b).abs())<1?[h,i]:[f,r],O=u,g},i.toNumber=function(){return+Y(this)},i.toPrecision=function(e,t){return null!=e&&k(e,1,y),V(this,e,t,2)},i.toString=function(e){var t,r=this,i=r.s,o=r.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=I||o>=T?E(w(r.c),o):x(w(r.c),o,"0"):10===e?(r=G(new H(r),C+o+1,A),t=x(w(r.c),r.e,"0")):(k(e,2,M.length,"Base"),t=n(x(w(r.c),o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},i.valueOf=i.toJSON=function(){return Y(this)},i._isBigNumber=!0,a&&(i[Symbol.toStringTag]="BigNumber",i[Symbol.for("nodejs.util.inspect.custom")]=i.valueOf),null!=e&&H.set(e),H}function v(e){var t=0|e;return e>0||e===t?t:t-1}function w(e){for(var t,n,r=1,i=e.length,o=e[0]+"";rl^n?1:-1;for(a=(u=i.length)<(l=o.length)?u:l,s=0;so[s]^n?1:-1;return u==l?0:u>l^n?1:-1}function k(e,t,n,r){if(en||e!==l(e))throw Error(c+(r||"Argument")+("number"==typeof e?en?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function S(e){var t=e.c.length-1;return v(e.e/p)==t&&e.c[t]%2!=0}function E(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function x(e,t,n){var r,i;if(t<0){for(i=n+".";++t;i+=n);e=i+e}else if(r=e.length,++t>r){for(i=n,t-=r;--t;i+=n);e+=i}else t=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function u(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function e(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function e(t,n){return t.cmp(n)>0?t:n},o.min=function e(t,n){return t.cmp(n)<0?t:n},o.prototype._init=function e(t,n,i){if("number"==typeof t)return this._initNumber(t,n,i);if("object"==typeof t)return this._initArray(t,n,i);"hex"===n&&(n=16),r(n===(0|n)&&n>=2&&n<=36),t=t.toString().replace(/\s+/g,"");var o=0;"-"===t[0]&&o++,16===n?this._parseHex(t,o):this._parseBase(t,n,o),"-"===t[0]&&(this.negative=1),this.strip(),"le"===i&&this._initArray(this.toArray(),n,i)},o.prototype._initNumber=function e(t,n,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),n,i)},o.prototype._initArray=function e(t,n,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var o=0;o=0;o-=3)a=t[o]|t[o-1]<<8|t[o-2]<<16,this.words[s]|=a<>>26-u&67108863,u+=24,u>=26&&(u-=26,s++);else if("le"===i)for(o=0,s=0;o>>26-u&67108863,u+=24,u>=26&&(u-=26,s++);return this.strip()},o.prototype._parseHex=function e(t,n){this.length=Math.ceil((t.length-n)/6),this.words=new Array(this.length);for(var r=0;r=n;r-=6)o=a(t,r,r+6),this.words[i]|=o<>>26-s&4194303,s+=24,s>=26&&(s-=26,i++);r+6!==n&&(o=a(t,n,r+6),this.words[i]|=o<>>26-s&4194303),this.strip()},o.prototype._parseBase=function e(t,n,r){this.words=[0],this.length=1;for(var i=0,o=1;o<=67108863;o*=n)i++;i--,o=o/n|0;for(var s=t.length-r,a=s%i,l=Math.min(s,s-a)+r,c=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function e(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function e(){return(this.red?""};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(e){for(var t=new Array(e.bitLength()),n=0;n>>i}return t}function p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var l=1;l>>26,f=67108863&u,h=Math.min(l,t.length-1),p=Math.max(0,l-e.length+1);p<=h;p++){var d=l-p|0;i=0|e.words[d],o=0|t.words[p],s=i*o+f,c+=s/67108864|0,f=67108863&s}n.words[l]=0|f,u=0|c}return 0!==u?n.words[l]=0|u:n.length--,n.strip()}o.prototype.toString=function e(t,n){var i;if(t=t||10,n=0|n||1,16===t||"hex"===t){i="";for(var o=0,s=0,a=0;a>>24-o&16777215,i=0!==s||a!==this.length-1?l[6-h.length]+h+i:h+i,o+=2,o>=26&&(o-=26,a--)}for(0!==s&&(i=s.toString(16)+i);i.length%n!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var p=c[t],d=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var g=m.modn(d).toString(t);m=m.idivn(d),i=m.isZero()?g+i:l[p-g.length]+g+i}for(this.isZero()&&(i="0"+i);i.length%n!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function e(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function e(){return this.toString(16)},o.prototype.toBuffer=function e(t,n){return r(void 0!==s),this.toArrayLike(s,t,n)},o.prototype.toArray=function e(t,n){return this.toArrayLike(Array,t,n)},o.prototype.toArrayLike=function e(t,n,i){var o=this.byteLength(),s=i||Math.max(1,o);r(o<=s,"byte array longer than desired length"),r(s>0,"Requested array length <= 0"),this.strip();var a="le"===n,u=new t(s),l,c,f=this.clone();if(a){for(c=0;!f.isZero();c++)l=f.andln(255),f.iushrn(8),u[c]=l;for(;c=4096&&(r+=13,n>>>=13),n>=64&&(r+=7,n>>>=7),n>=8&&(r+=4,n>>>=4),n>=2&&(r+=2,n>>>=2),r+n},o.prototype._zeroBits=function e(t){if(0===t)return 26;var n=t,r=0;return 0==(8191&n)&&(r+=13,n>>>=13),0==(127&n)&&(r+=7,n>>>=7),0==(15&n)&&(r+=4,n>>>=4),0==(3&n)&&(r+=2,n>>>=2),0==(1&n)&&r++,r},o.prototype.bitLength=function e(){var t=this.words[this.length-1],n=this._countBits(t);return 26*(this.length-1)+n},o.prototype.zeroBits=function e(){if(this.isZero())return 0;for(var t=0,n=0;nt.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function e(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function e(t){var n;n=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function e(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function e(t){var n,r;this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function e(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function e(t){r("number"==typeof t&&t>=0);var n=0|Math.ceil(t/26),i=t%26;this._expand(n),i>0&&n--;for(var o=0;o0&&(this.words[o]=~this.words[o]&67108863>>26-i),this.strip()},o.prototype.notn=function e(t){return this.clone().inotn(t)},o.prototype.setn=function e(t,n){r("number"==typeof t&&t>=0);var i=t/26|0,o=t%26;return this._expand(i+1),this.words[i]=n?this.words[i]|1<t.length?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>>26;for(;0!==o&&s>>26;if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function e(t){if(0!==t.negative){t.negative=0;var n=this.iadd(t);return t.negative=1,n._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r=this.cmp(t),i,o;if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;r>0?(i=this,o=t):(i=t,o=this);for(var s=0,a=0;a>26,this.words[a]=67108863&n;for(;0!==s&&a>26,this.words[a]=67108863&n;if(0===s&&a>>13,d=0|i[1],m=8191&d,g=d>>>13,y=0|i[2],b=8191&y,v=y>>>13,w=0|i[3],_=8191&w,k=w>>>13,S=0|i[4],E=8191&S,x=S>>>13,C=0|i[5],A=8191&C,I=C>>>13,T=0|i[6],j=8191&T,O=T>>>13,P=0|i[7],B=8191&P,R=P>>>13,N=0|i[8],M=8191&N,L=N>>>13,F=0|i[9],D=8191&F,U=F>>>13,z=0|o[0],q=8191&z,K=z>>>13,H=0|o[1],V=8191&H,W=H>>>13,$=0|o[2],G=8191&$,Y=$>>>13,J=0|o[3],Z=8191&J,Q=J>>>13,X=0|o[4],ee=8191&X,te=X>>>13,ne=0|o[5],re=8191&ne,ie=ne>>>13,oe=0|o[6],se=8191&oe,ae=oe>>>13,ue=0|o[7],le=8191&ue,ce=ue>>>13,fe=0|o[8],he=8191&fe,pe=fe>>>13,de=0|o[9],me=8191&de,ge=de>>>13;r.negative=t.negative^n.negative,r.length=19,u=Math.imul(h,q),l=Math.imul(h,K),l=l+Math.imul(p,q)|0,c=Math.imul(p,K);var ye=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(ye>>>26)|0,ye&=67108863,u=Math.imul(m,q),l=Math.imul(m,K),l=l+Math.imul(g,q)|0,c=Math.imul(g,K),u=u+Math.imul(h,V)|0,l=l+Math.imul(h,W)|0,l=l+Math.imul(p,V)|0,c=c+Math.imul(p,W)|0;var be=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(be>>>26)|0,be&=67108863,u=Math.imul(b,q),l=Math.imul(b,K),l=l+Math.imul(v,q)|0,c=Math.imul(v,K),u=u+Math.imul(m,V)|0,l=l+Math.imul(m,W)|0,l=l+Math.imul(g,V)|0,c=c+Math.imul(g,W)|0,u=u+Math.imul(h,G)|0,l=l+Math.imul(h,Y)|0,l=l+Math.imul(p,G)|0,c=c+Math.imul(p,Y)|0;var ve=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(ve>>>26)|0,ve&=67108863,u=Math.imul(_,q),l=Math.imul(_,K),l=l+Math.imul(k,q)|0,c=Math.imul(k,K),u=u+Math.imul(b,V)|0,l=l+Math.imul(b,W)|0,l=l+Math.imul(v,V)|0,c=c+Math.imul(v,W)|0,u=u+Math.imul(m,G)|0,l=l+Math.imul(m,Y)|0,l=l+Math.imul(g,G)|0,c=c+Math.imul(g,Y)|0,u=u+Math.imul(h,Z)|0,l=l+Math.imul(h,Q)|0,l=l+Math.imul(p,Z)|0,c=c+Math.imul(p,Q)|0;var we=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(we>>>26)|0,we&=67108863,u=Math.imul(E,q),l=Math.imul(E,K),l=l+Math.imul(x,q)|0,c=Math.imul(x,K),u=u+Math.imul(_,V)|0,l=l+Math.imul(_,W)|0,l=l+Math.imul(k,V)|0,c=c+Math.imul(k,W)|0,u=u+Math.imul(b,G)|0,l=l+Math.imul(b,Y)|0,l=l+Math.imul(v,G)|0,c=c+Math.imul(v,Y)|0,u=u+Math.imul(m,Z)|0,l=l+Math.imul(m,Q)|0,l=l+Math.imul(g,Z)|0,c=c+Math.imul(g,Q)|0,u=u+Math.imul(h,ee)|0,l=l+Math.imul(h,te)|0,l=l+Math.imul(p,ee)|0,c=c+Math.imul(p,te)|0;var _e=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(_e>>>26)|0,_e&=67108863,u=Math.imul(A,q),l=Math.imul(A,K),l=l+Math.imul(I,q)|0,c=Math.imul(I,K),u=u+Math.imul(E,V)|0,l=l+Math.imul(E,W)|0,l=l+Math.imul(x,V)|0,c=c+Math.imul(x,W)|0,u=u+Math.imul(_,G)|0,l=l+Math.imul(_,Y)|0,l=l+Math.imul(k,G)|0,c=c+Math.imul(k,Y)|0,u=u+Math.imul(b,Z)|0,l=l+Math.imul(b,Q)|0,l=l+Math.imul(v,Z)|0,c=c+Math.imul(v,Q)|0,u=u+Math.imul(m,ee)|0,l=l+Math.imul(m,te)|0,l=l+Math.imul(g,ee)|0,c=c+Math.imul(g,te)|0,u=u+Math.imul(h,re)|0,l=l+Math.imul(h,ie)|0,l=l+Math.imul(p,re)|0,c=c+Math.imul(p,ie)|0;var ke=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(ke>>>26)|0,ke&=67108863,u=Math.imul(j,q),l=Math.imul(j,K),l=l+Math.imul(O,q)|0,c=Math.imul(O,K),u=u+Math.imul(A,V)|0,l=l+Math.imul(A,W)|0,l=l+Math.imul(I,V)|0,c=c+Math.imul(I,W)|0,u=u+Math.imul(E,G)|0,l=l+Math.imul(E,Y)|0,l=l+Math.imul(x,G)|0,c=c+Math.imul(x,Y)|0,u=u+Math.imul(_,Z)|0,l=l+Math.imul(_,Q)|0,l=l+Math.imul(k,Z)|0,c=c+Math.imul(k,Q)|0,u=u+Math.imul(b,ee)|0,l=l+Math.imul(b,te)|0,l=l+Math.imul(v,ee)|0,c=c+Math.imul(v,te)|0,u=u+Math.imul(m,re)|0,l=l+Math.imul(m,ie)|0,l=l+Math.imul(g,re)|0,c=c+Math.imul(g,ie)|0,u=u+Math.imul(h,se)|0,l=l+Math.imul(h,ae)|0,l=l+Math.imul(p,se)|0,c=c+Math.imul(p,ae)|0;var Se=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Se>>>26)|0,Se&=67108863,u=Math.imul(B,q),l=Math.imul(B,K),l=l+Math.imul(R,q)|0,c=Math.imul(R,K),u=u+Math.imul(j,V)|0,l=l+Math.imul(j,W)|0,l=l+Math.imul(O,V)|0,c=c+Math.imul(O,W)|0,u=u+Math.imul(A,G)|0,l=l+Math.imul(A,Y)|0,l=l+Math.imul(I,G)|0,c=c+Math.imul(I,Y)|0,u=u+Math.imul(E,Z)|0,l=l+Math.imul(E,Q)|0,l=l+Math.imul(x,Z)|0,c=c+Math.imul(x,Q)|0,u=u+Math.imul(_,ee)|0,l=l+Math.imul(_,te)|0,l=l+Math.imul(k,ee)|0,c=c+Math.imul(k,te)|0,u=u+Math.imul(b,re)|0,l=l+Math.imul(b,ie)|0,l=l+Math.imul(v,re)|0,c=c+Math.imul(v,ie)|0,u=u+Math.imul(m,se)|0,l=l+Math.imul(m,ae)|0,l=l+Math.imul(g,se)|0,c=c+Math.imul(g,ae)|0,u=u+Math.imul(h,le)|0,l=l+Math.imul(h,ce)|0,l=l+Math.imul(p,le)|0,c=c+Math.imul(p,ce)|0;var Ee=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,u=Math.imul(M,q),l=Math.imul(M,K),l=l+Math.imul(L,q)|0,c=Math.imul(L,K),u=u+Math.imul(B,V)|0,l=l+Math.imul(B,W)|0,l=l+Math.imul(R,V)|0,c=c+Math.imul(R,W)|0,u=u+Math.imul(j,G)|0,l=l+Math.imul(j,Y)|0,l=l+Math.imul(O,G)|0,c=c+Math.imul(O,Y)|0,u=u+Math.imul(A,Z)|0,l=l+Math.imul(A,Q)|0,l=l+Math.imul(I,Z)|0,c=c+Math.imul(I,Q)|0,u=u+Math.imul(E,ee)|0,l=l+Math.imul(E,te)|0,l=l+Math.imul(x,ee)|0,c=c+Math.imul(x,te)|0,u=u+Math.imul(_,re)|0,l=l+Math.imul(_,ie)|0,l=l+Math.imul(k,re)|0,c=c+Math.imul(k,ie)|0,u=u+Math.imul(b,se)|0,l=l+Math.imul(b,ae)|0,l=l+Math.imul(v,se)|0,c=c+Math.imul(v,ae)|0,u=u+Math.imul(m,le)|0,l=l+Math.imul(m,ce)|0,l=l+Math.imul(g,le)|0,c=c+Math.imul(g,ce)|0,u=u+Math.imul(h,he)|0,l=l+Math.imul(h,pe)|0,l=l+Math.imul(p,he)|0,c=c+Math.imul(p,pe)|0;var xe=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(xe>>>26)|0,xe&=67108863,u=Math.imul(D,q),l=Math.imul(D,K),l=l+Math.imul(U,q)|0,c=Math.imul(U,K),u=u+Math.imul(M,V)|0,l=l+Math.imul(M,W)|0,l=l+Math.imul(L,V)|0,c=c+Math.imul(L,W)|0,u=u+Math.imul(B,G)|0,l=l+Math.imul(B,Y)|0,l=l+Math.imul(R,G)|0,c=c+Math.imul(R,Y)|0,u=u+Math.imul(j,Z)|0,l=l+Math.imul(j,Q)|0,l=l+Math.imul(O,Z)|0,c=c+Math.imul(O,Q)|0,u=u+Math.imul(A,ee)|0,l=l+Math.imul(A,te)|0,l=l+Math.imul(I,ee)|0,c=c+Math.imul(I,te)|0,u=u+Math.imul(E,re)|0,l=l+Math.imul(E,ie)|0,l=l+Math.imul(x,re)|0,c=c+Math.imul(x,ie)|0,u=u+Math.imul(_,se)|0,l=l+Math.imul(_,ae)|0,l=l+Math.imul(k,se)|0,c=c+Math.imul(k,ae)|0,u=u+Math.imul(b,le)|0,l=l+Math.imul(b,ce)|0,l=l+Math.imul(v,le)|0,c=c+Math.imul(v,ce)|0,u=u+Math.imul(m,he)|0,l=l+Math.imul(m,pe)|0,l=l+Math.imul(g,he)|0,c=c+Math.imul(g,pe)|0,u=u+Math.imul(h,me)|0,l=l+Math.imul(h,ge)|0,l=l+Math.imul(p,me)|0,c=c+Math.imul(p,ge)|0;var Ce=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,u=Math.imul(D,V),l=Math.imul(D,W),l=l+Math.imul(U,V)|0,c=Math.imul(U,W),u=u+Math.imul(M,G)|0,l=l+Math.imul(M,Y)|0,l=l+Math.imul(L,G)|0,c=c+Math.imul(L,Y)|0,u=u+Math.imul(B,Z)|0,l=l+Math.imul(B,Q)|0,l=l+Math.imul(R,Z)|0,c=c+Math.imul(R,Q)|0,u=u+Math.imul(j,ee)|0,l=l+Math.imul(j,te)|0,l=l+Math.imul(O,ee)|0,c=c+Math.imul(O,te)|0,u=u+Math.imul(A,re)|0,l=l+Math.imul(A,ie)|0,l=l+Math.imul(I,re)|0,c=c+Math.imul(I,ie)|0,u=u+Math.imul(E,se)|0,l=l+Math.imul(E,ae)|0,l=l+Math.imul(x,se)|0,c=c+Math.imul(x,ae)|0,u=u+Math.imul(_,le)|0,l=l+Math.imul(_,ce)|0,l=l+Math.imul(k,le)|0,c=c+Math.imul(k,ce)|0,u=u+Math.imul(b,he)|0,l=l+Math.imul(b,pe)|0,l=l+Math.imul(v,he)|0,c=c+Math.imul(v,pe)|0,u=u+Math.imul(m,me)|0,l=l+Math.imul(m,ge)|0,l=l+Math.imul(g,me)|0,c=c+Math.imul(g,ge)|0;var Ae=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,u=Math.imul(D,G),l=Math.imul(D,Y),l=l+Math.imul(U,G)|0,c=Math.imul(U,Y),u=u+Math.imul(M,Z)|0,l=l+Math.imul(M,Q)|0,l=l+Math.imul(L,Z)|0,c=c+Math.imul(L,Q)|0,u=u+Math.imul(B,ee)|0,l=l+Math.imul(B,te)|0,l=l+Math.imul(R,ee)|0,c=c+Math.imul(R,te)|0,u=u+Math.imul(j,re)|0,l=l+Math.imul(j,ie)|0,l=l+Math.imul(O,re)|0,c=c+Math.imul(O,ie)|0,u=u+Math.imul(A,se)|0,l=l+Math.imul(A,ae)|0,l=l+Math.imul(I,se)|0,c=c+Math.imul(I,ae)|0,u=u+Math.imul(E,le)|0,l=l+Math.imul(E,ce)|0,l=l+Math.imul(x,le)|0,c=c+Math.imul(x,ce)|0,u=u+Math.imul(_,he)|0,l=l+Math.imul(_,pe)|0,l=l+Math.imul(k,he)|0,c=c+Math.imul(k,pe)|0,u=u+Math.imul(b,me)|0,l=l+Math.imul(b,ge)|0,l=l+Math.imul(v,me)|0,c=c+Math.imul(v,ge)|0;var Ie=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,u=Math.imul(D,Z),l=Math.imul(D,Q),l=l+Math.imul(U,Z)|0,c=Math.imul(U,Q),u=u+Math.imul(M,ee)|0,l=l+Math.imul(M,te)|0,l=l+Math.imul(L,ee)|0,c=c+Math.imul(L,te)|0,u=u+Math.imul(B,re)|0,l=l+Math.imul(B,ie)|0,l=l+Math.imul(R,re)|0,c=c+Math.imul(R,ie)|0,u=u+Math.imul(j,se)|0,l=l+Math.imul(j,ae)|0,l=l+Math.imul(O,se)|0,c=c+Math.imul(O,ae)|0,u=u+Math.imul(A,le)|0,l=l+Math.imul(A,ce)|0,l=l+Math.imul(I,le)|0,c=c+Math.imul(I,ce)|0,u=u+Math.imul(E,he)|0,l=l+Math.imul(E,pe)|0,l=l+Math.imul(x,he)|0,c=c+Math.imul(x,pe)|0,u=u+Math.imul(_,me)|0,l=l+Math.imul(_,ge)|0,l=l+Math.imul(k,me)|0,c=c+Math.imul(k,ge)|0;var Te=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Te>>>26)|0,Te&=67108863,u=Math.imul(D,ee),l=Math.imul(D,te),l=l+Math.imul(U,ee)|0,c=Math.imul(U,te),u=u+Math.imul(M,re)|0,l=l+Math.imul(M,ie)|0,l=l+Math.imul(L,re)|0,c=c+Math.imul(L,ie)|0,u=u+Math.imul(B,se)|0,l=l+Math.imul(B,ae)|0,l=l+Math.imul(R,se)|0,c=c+Math.imul(R,ae)|0,u=u+Math.imul(j,le)|0,l=l+Math.imul(j,ce)|0,l=l+Math.imul(O,le)|0,c=c+Math.imul(O,ce)|0,u=u+Math.imul(A,he)|0,l=l+Math.imul(A,pe)|0,l=l+Math.imul(I,he)|0,c=c+Math.imul(I,pe)|0,u=u+Math.imul(E,me)|0,l=l+Math.imul(E,ge)|0,l=l+Math.imul(x,me)|0,c=c+Math.imul(x,ge)|0;var je=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(je>>>26)|0,je&=67108863,u=Math.imul(D,re),l=Math.imul(D,ie),l=l+Math.imul(U,re)|0,c=Math.imul(U,ie),u=u+Math.imul(M,se)|0,l=l+Math.imul(M,ae)|0,l=l+Math.imul(L,se)|0,c=c+Math.imul(L,ae)|0,u=u+Math.imul(B,le)|0,l=l+Math.imul(B,ce)|0,l=l+Math.imul(R,le)|0,c=c+Math.imul(R,ce)|0,u=u+Math.imul(j,he)|0,l=l+Math.imul(j,pe)|0,l=l+Math.imul(O,he)|0,c=c+Math.imul(O,pe)|0,u=u+Math.imul(A,me)|0,l=l+Math.imul(A,ge)|0,l=l+Math.imul(I,me)|0,c=c+Math.imul(I,ge)|0;var Oe=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,u=Math.imul(D,se),l=Math.imul(D,ae),l=l+Math.imul(U,se)|0,c=Math.imul(U,ae),u=u+Math.imul(M,le)|0,l=l+Math.imul(M,ce)|0,l=l+Math.imul(L,le)|0,c=c+Math.imul(L,ce)|0,u=u+Math.imul(B,he)|0,l=l+Math.imul(B,pe)|0,l=l+Math.imul(R,he)|0,c=c+Math.imul(R,pe)|0,u=u+Math.imul(j,me)|0,l=l+Math.imul(j,ge)|0,l=l+Math.imul(O,me)|0,c=c+Math.imul(O,ge)|0;var Pe=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,u=Math.imul(D,le),l=Math.imul(D,ce),l=l+Math.imul(U,le)|0,c=Math.imul(U,ce),u=u+Math.imul(M,he)|0,l=l+Math.imul(M,pe)|0,l=l+Math.imul(L,he)|0,c=c+Math.imul(L,pe)|0,u=u+Math.imul(B,me)|0,l=l+Math.imul(B,ge)|0,l=l+Math.imul(R,me)|0,c=c+Math.imul(R,ge)|0;var Be=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Be>>>26)|0,Be&=67108863,u=Math.imul(D,he),l=Math.imul(D,pe),l=l+Math.imul(U,he)|0,c=Math.imul(U,pe),u=u+Math.imul(M,me)|0,l=l+Math.imul(M,ge)|0,l=l+Math.imul(L,me)|0,c=c+Math.imul(L,ge)|0;var Re=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Re>>>26)|0,Re&=67108863,u=Math.imul(D,me),l=Math.imul(D,ge),l=l+Math.imul(U,me)|0,c=Math.imul(U,ge);var Ne=(a+u|0)+((8191&l)<<13)|0;return a=(c+(l>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,s[0]=ye,s[1]=be,s[2]=ve,s[3]=we,s[4]=_e,s[5]=ke,s[6]=Se,s[7]=Ee,s[8]=xe,s[9]=Ce,s[10]=Ae,s[11]=Ie,s[12]=Te,s[13]=je,s[14]=Oe,s[15]=Pe,s[16]=Be,s[17]=Re,s[18]=Ne,0!==a&&(s[19]=a,r.length++),r};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0,i+=s>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}function g(e,t,n){var r=new y;return r.mulp(e,t,n)}function y(e,t){this.x=e,this.y=t}Math.imul||(d=p),o.prototype.mulTo=function e(t,n){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?d(this,t,n):i<63?p(this,t,n):i<1024?m(this,t,n):g(this,t,n),r},y.prototype.makeRBT=function e(t){for(var n=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},y.prototype.permute=function e(t,n,r,i,o,s){for(var a=0;a>>=1)o++;return 1<>>=13,i[2*a+1]=8191&s,s>>>=13;for(a=2*n;a>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),this},o.prototype.muln=function e(t){return this.clone().imuln(t)},o.prototype.sqr=function e(){return this.mul(this)},o.prototype.isqr=function e(){return this.imul(this.clone())},o.prototype.pow=function e(t){var n=h(t);if(0===n.length)return new o(1);for(var r=this,i=0;i=0);var n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n,s;if(0!==n){var a=0;for(s=0;s>>26-n}a&&(this.words[s]=a,this.length++)}if(0!==i){for(s=this.length-1;s>=0;s--)this.words[s+i]=this.words[s];for(s=0;s=0),o=n?(n-n%26)/26:0;var s=t%26,a=Math.min((t-s)/26,this.length),u=67108863^67108863>>>s<a)for(this.length-=a,c=0;c=0&&(0!==f||c>=o);c--){var h=0|this.words[c];this.words[c]=f<<26-s|h>>>s,f=h&u}return l&&0!==f&&(l.words[l.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function e(t,n,i){return r(0===this.negative),this.iushrn(t,n,i)},o.prototype.shln=function e(t){return this.clone().ishln(t)},o.prototype.ushln=function e(t){return this.clone().iushln(t)},o.prototype.shrn=function e(t){return this.clone().ishrn(t)},o.prototype.ushrn=function e(t){return this.clone().iushrn(t)},o.prototype.testn=function e(t){r("number"==typeof t&&t>=0);var n=t%26,i=(t-n)/26,o=1<=0);var n=t%26,i=(t-n)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==n&&i++,this.length=Math.min(i,this.length),0!==n){var o=67108863^67108863>>>n<=67108864;n++)this.words[n]-=67108864,n===this.length-1?this.words[n+1]=1:this.words[n+1]++;return this.length=Math.max(this.length,n+1),this},o.prototype.isubn=function e(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var n=0;n>26)-(l/67108864|0),this.words[s+i]=67108863&a}for(;s>26,this.words[s+i]=67108863&a;if(0===u)return this.strip();for(r(-1===u),u=0,s=0;s>26,this.words[s]=67108863&a;return this.negative=1,this.strip()},o.prototype._wordDiv=function e(t,n){var r=this.length-t.length,i=this.clone(),s=t,a=0|s.words[s.length-1],u=this._countBits(a);r=26-u,0!==r&&(s=s.ushln(r),i.iushln(r),a=0|s.words[s.length-1]);var l=i.length-s.length,c;if("mod"!==n){c=new o(null),c.length=l+1,c.words=new Array(c.length);for(var f=0;f=0;p--){var d=67108864*(0|i.words[s.length+p])+(0|i.words[s.length+p-1]);for(d=Math.min(d/a|0,67108863),i._ishlnsubmul(s,d,p);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(s,1,p),i.isZero()||(i.negative^=1);c&&(c.words[p]=d)}return c&&c.strip(),i.strip(),"div"!==n&&0!==r&&i.iushrn(r),{div:c||null,mod:i}},o.prototype.divmod=function e(t,n,i){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(u=this.neg().divmod(t,n),"mod"!==n&&(s=u.div.neg()),"div"!==n&&(a=u.mod.neg(),i&&0!==a.negative&&a.iadd(t)),{div:s,mod:a}):0===this.negative&&0!==t.negative?(u=this.divmod(t.neg(),n),"mod"!==n&&(s=u.div.neg()),{div:s,mod:u.mod}):0!=(this.negative&t.negative)?(u=this.neg().divmod(t.neg(),n),"div"!==n&&(a=u.mod.neg(),i&&0!==a.negative&&a.isub(t)),{div:u.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===n?{div:this.divn(t.words[0]),mod:null}:"mod"===n?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,n);var s,a,u},o.prototype.div=function e(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function e(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function e(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function e(t){var n=this.divmod(t);if(n.mod.isZero())return n.div;var r=0!==n.div.negative?n.mod.isub(t):n.mod,i=t.ushrn(1),o=t.andln(1),s=r.cmp(i);return s<0||1===o&&0===s?n.div:0!==n.div.negative?n.div.isubn(1):n.div.iaddn(1)},o.prototype.modn=function e(t){r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return i},o.prototype.idivn=function e(t){r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this.strip()},o.prototype.divn=function e(t){return this.clone().idivn(t)},o.prototype.egcd=function e(t){r(0===t.negative),r(!t.isZero());var n=this,i=t.clone();n=0!==n.negative?n.umod(t):n.clone();for(var s=new o(1),a=new o(0),u=new o(0),l=new o(1),c=0;n.isEven()&&i.isEven();)n.iushrn(1),i.iushrn(1),++c;for(var f=i.clone(),h=n.clone();!n.isZero();){for(var p=0,d=1;0==(n.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||a.isOdd())&&(s.iadd(f),a.isub(h)),s.iushrn(1),a.iushrn(1);for(var m=0,g=1;0==(i.words[0]&g)&&m<26;++m,g<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(u.isOdd()||l.isOdd())&&(u.iadd(f),l.isub(h)),u.iushrn(1),l.iushrn(1);n.cmp(i)>=0?(n.isub(i),s.isub(u),a.isub(l)):(i.isub(n),u.isub(s),l.isub(a))}return{a:u,b:l,gcd:i.iushln(c)}},o.prototype._invmp=function e(t){r(0===t.negative),r(!t.isZero());var n=this,i=t.clone();n=0!==n.negative?n.umod(t):n.clone();for(var s=new o(1),a=new o(0),u=i.clone(),l;n.cmpn(1)>0&&i.cmpn(1)>0;){for(var c=0,f=1;0==(n.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(n.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var h=0,p=1;0==(i.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(i.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);n.cmp(i)>=0?(n.isub(i),s.isub(a)):(i.isub(n),a.isub(s))}return l=0===n.cmpn(1)?s:a,l.cmpn(0)<0&&l.iadd(t),l},o.prototype.gcd=function e(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var n=this.clone(),r=t.clone();n.negative=0,r.negative=0;for(var i=0;n.isEven()&&r.isEven();i++)n.iushrn(1),r.iushrn(1);for(;;){for(;n.isEven();)n.iushrn(1);for(;r.isEven();)r.iushrn(1);var o=n.cmp(r);if(o<0){var s=n;n=r,r=s}else if(0===o||0===r.cmpn(1))break;n.isub(r)}return r.iushln(i)},o.prototype.invm=function e(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function e(){return 0==(1&this.words[0])},o.prototype.isOdd=function e(){return 1==(1&this.words[0])},o.prototype.andln=function e(t){return this.words[0]&t},o.prototype.bincn=function e(t){r("number"==typeof t);var n=t%26,i=(t-n)/26,o=1<>>26,u&=67108863,this.words[a]=u}return 0!==s&&(this.words[a]=s,this.length++),this},o.prototype.isZero=function e(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function e(t){var n=t<0,i;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)i=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var o=0|this.words[0];i=o===t?0:ot.length)return 1;if(this.length=0;r--){var i=0|this.words[r],o=0|t.words[r];if(i!==o){io&&(n=1);break}}return n},o.prototype.gtn=function e(t){return 1===this.cmpn(t)},o.prototype.gt=function e(t){return 1===this.cmp(t)},o.prototype.gten=function e(t){return this.cmpn(t)>=0},o.prototype.gte=function e(t){return this.cmp(t)>=0},o.prototype.ltn=function e(t){return-1===this.cmpn(t)},o.prototype.lt=function e(t){return-1===this.cmp(t)},o.prototype.lten=function e(t){return this.cmpn(t)<=0},o.prototype.lte=function e(t){return this.cmp(t)<=0},o.prototype.eqn=function e(t){return 0===this.cmpn(t)},o.prototype.eq=function e(t){return 0===this.cmp(t)},o.red=function e(t){return new E(t)},o.prototype.toRed=function e(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function e(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function e(t){return this.red=t,this},o.prototype.forceRed=function e(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function e(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function e(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function e(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function e(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function e(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function e(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function e(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function e(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function e(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function e(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function e(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function e(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function e(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function x(e){E.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function e(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function e(t){var n=t,r;do{this.split(n,this.tmp),n=this.imulK(n),n=n.iadd(this.tmp),r=n.bitLength()}while(r>this.n);var i=r0?n.isub(this.p):n.strip(),n},v.prototype.split=function e(t,n){t.iushrn(this.n,0,n)},v.prototype.imulK=function e(t){return t.imul(this.k)},i(w,v),w.prototype.split=function e(t,n){for(var r=4194303,i=Math.min(t.length,9),o=0;o>>22,s=a}s>>>=22,t.words[o-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function e(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var n=0,r=0;r>>=26,t.words[r]=o,n=i}return 0!==n&&(t.words[t.length++]=n),t},o._prime=function e(t){if(b[t])return b[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new k;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return b[t]=e,e},E.prototype._verify1=function e(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function e(t,n){r(0==(t.negative|n.negative),"red works only with positives"),r(t.red&&t.red===n.red,"red works only with red numbers")},E.prototype.imod=function e(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function e(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function e(t,n){this._verify2(t,n);var r=t.add(n);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function e(t,n){this._verify2(t,n);var r=t.iadd(n);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function e(t,n){this._verify2(t,n);var r=t.sub(n);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function e(t,n){this._verify2(t,n);var r=t.isub(n);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function e(t,n){return this._verify1(t),this.imod(t.ushln(n))},E.prototype.imul=function e(t,n){return this._verify2(t,n),this.imod(t.imul(n))},E.prototype.mul=function e(t,n){return this._verify2(t,n),this.imod(t.mul(n))},E.prototype.isqr=function e(t){return this.imul(t,t.clone())},E.prototype.sqr=function e(t){return this.mul(t,t)},E.prototype.sqrt=function e(t){if(t.isZero())return t.clone();var n=this.m.andln(3);if(r(n%2==1),3===n){var i=this.m.add(new o(1)).iushrn(2);return this.pow(t,i)}for(var s=this.m.subn(1),a=0;!s.isZero()&&0===s.andln(1);)a++,s.iushrn(1);r(!s.isZero());var u=new o(1).toRed(this),l=u.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(l);)f.redIAdd(l);for(var h=this.pow(f,s),p=this.pow(t,s.addn(1).iushrn(1)),d=this.pow(t,s),m=a;0!==d.cmp(u);){for(var g=d,y=0;0!==g.cmp(u);y++)g=g.redSqr();r(y=0;s--){for(var f=n.words[s],h=c-1;h>=0;h--){var p=f>>h&1;a!==i[0]&&(a=this.sqr(a)),0!==p||0!==u?(u<<=1,u|=p,l++,(4===l||0===s&&0===h)&&(a=this.mul(a,i[u]),l=0,u=0)):l=0}c=26}return a},E.prototype.convertTo=function e(t){var n=t.umod(this.m);return n===t?n.clone():n},E.prototype.convertFrom=function e(t){var n=t.clone();return n.red=null,n},o.mont=function e(t){return new x(t)},i(x,E),x.prototype.convertTo=function e(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function e(t){var n=this.imod(t.mul(this.rinv));return n.red=null,n},x.prototype.imul=function e(t,n){if(t.isZero()||n.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(n),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},x.prototype.mul=function e(t,n){if(t.isZero()||n.isZero())return new o(0)._forceRed(this);var r=t.mul(n),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(i).iushrn(this.shift),a=s;return s.cmp(this.m)>=0?a=s.isub(this.m):s.cmpn(0)<0&&(a=s.iadd(this.m)),a._forceRed(this)},x.prototype.invm=function e(t){var n=this.imod(t._invmp(this.m).mul(this.r2));return n._forceRed(this)}}(e,this)}).call(this,n(75)(e))},function(e,t,n){"use strict";const r=n(475),i=n(945),o=n(456);t=e.exports,t.aes=i,t.hmac=r,t.keys=o,t.randomBytes=n(315),t.pbkdf2=n(957)},function(e,t,n){"use strict";(function(t){const r=n(76),i=n(35),o=n(89),s=n(9),a=/^https?:\/\/[^/]+\/(ip(f|n)s)\/((\w+).*)/,u=/^\/(ip(f|n)s)\/((\w+).*)/,l=1,c=4,f=/^https?:\/\/([^/]+)\.(ip(?:f|n)s)\.[^/]+/,h=1,p=2;function d(e){const n=v(e);try{const e=t.from(r.decode(n));return i.decode(e),!0}catch(e){return!1}}function m(e){try{return o.isEncoded(e)}catch(e){return!1}}function g(e){try{return s.isCID(new s(e))}catch(e){return!1}}function y(e,t,n=l,r=c){const i=v(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipfs"!==o[n])return!1;let s=o[r];return s&&t===f&&(s=s.toLowerCase()),g(s)}function b(e,t,n=l,r){const i=v(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipns"!==o[n])return!1;if(r&&t===f){let e=o[r];return e=e.toLowerCase(),g(e)}return!0}function v(e){return t.isBuffer(e)?r.encode(e):"string"==typeof e&&e}const w=e=>y(e,f,2,1),_=e=>b(e,f,2,1);e.exports={multihash:d,cid:g,base32cid:e=>"base32"===m(e)&&g(e),ipfsSubdomain:w,ipnsSubdomain:_,subdomain:e=>w(e)||_(e),subdomainPattern:f,ipfsUrl:e=>y(e,a),ipnsUrl:e=>b(e,a),url:e=>y(e,a)||b(e,a),urlPattern:a,ipfsPath:e=>y(e,u),ipnsPath:e=>b(e,u),path:e=>y(e,u)||b(e,u),pathPattern:u,urlOrPath:e=>y(e,a)||b(e,a)||y(e,u)||b(e,u)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";t.Connection=n(1058)},function(e,t){var n=Array.isArray;e.exports=n},function(e,t){function n(){}e.exports=n},function(e,t){e.exports=r;var n=Object.prototype.hasOwnProperty;function r(){for(var e={},t=0;t73)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-3)return!1;var t=e[3];if(5+t>=e.length)return!1;var n=e[5+t];if(t+n+7!==e.length)return!1;var r=e.slice(4);if(2!==e[2])return!1;if(0===t)return!1;if(128&r[0])return!1;if(t>1&&0===r[0]&&!(128&r[1]))return!1;var i=e.slice(6+t);return 2===e[6+t-2]&&(0!==n&&(!(128&i[0])&&!(n>1&&0===i[0]&&!(128&i[1]))))},u.prototype.hasLowS=function(){return!this.s.lt(new r(1))&&!this.s.gt(new r("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex"))},u.prototype.hasDefinedHashtype=function(){if(!a.isNaturalNumber(this.nhashtype))return!1;var e=this.nhashtype&~u.SIGHASH_ANYONECANPAY;return!(eu.SIGHASH_SINGLE)},u.prototype.toTxFormat=function(){var e=this.toDER(),n=new t(1);return n.writeUInt8(this.nhashtype,0),t.concat([e,n])},u.SIGHASH_ALL=1,u.SIGHASH_NONE=2,u.SIGHASH_SINGLE=3,u.SIGHASH_ANYONECANPAY=128,e.exports=u}).call(this,n(0).Buffer)},function(e,t,n){e.exports=n(600),e.exports.Interpreter=n(1446)},function(e,t){var n=1e3,r=60*n,i=60*r,o=24*i,s=7*o,a=365.25*o;function u(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var u=parseFloat(t[1]),l=(t[2]||"ms").toLowerCase();switch(l){case"years":case"year":case"yrs":case"yr":case"y":return u*a;case"weeks":case"week":case"w":return u*s;case"days":case"day":case"d":return u*o;case"hours":case"hour":case"hrs":case"hr":case"h":return u*i;case"minutes":case"minute":case"mins":case"min":case"m":return u*r;case"seconds":case"second":case"secs":case"sec":case"s":return u*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}}}function l(e){var t=Math.abs(e);return t>=o?Math.round(e/o)+"d":t>=i?Math.round(e/i)+"h":t>=r?Math.round(e/r)+"m":t>=n?Math.round(e/n)+"s":e+"ms"}function c(e){var t=Math.abs(e);return t>=o?f(e,t,o,"day"):t>=i?f(e,t,i,"hour"):t>=r?f(e,t,r,"minute"):t>=n?f(e,t,n,"second"):e+" ms"}function f(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}e.exports=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return u(e);if("number"===n&&isFinite(e))return t.long?c(e):l(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(175),i=a(r),o=n(395),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,i.default)(s.default),e.exports=t.default},function(e,t,n){"use strict";(function(r){const i=n(781);t=e.exports=s,t.encode=a,t.decode=u,t.isEncoded=l,t.names=Object.freeze(Object.keys(i.names)),t.codes=Object.freeze(Object.keys(i.codes));const o=new Error("Unsupported encoding");function s(e,t){if(!t)throw new Error("requires an encoded buffer");const n=f(e),i=r.from(n.code),o=n.name;return c(o,t),r.concat([i,t])}function a(e,t){const n=f(e),i=n.name;return s(i,r.from(n.encode(t)))}function u(e){r.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);e=e.substring(1,e.length),"string"==typeof e&&(e=r.from(e));const n=f(t);return r.from(n.decode(e.toString()))}function l(e){if(r.isBuffer(e)&&(e=e.toString()),"[object String]"!==Object.prototype.toString.call(e))return!1;const t=e.substring(0,1);try{const e=f(t);return e.name}catch(e){return!1}}function c(e,t){const n=f(e);n.decode(t.toString())}function f(e){let t;if(i.names[e])t=i.names[e];else{if(!i.codes[e])throw o;t=i.codes[e]}if(!t.isImplemented())throw new Error("Base "+e+" is not implemented yet");return t}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";function r(e){return e}var i=n(178);e.exports=function e(t){if(!t)return r;t=i(t);var n=!1,o,s;return function(e){return function r(i,a){if(s)return a(s);i?(s=i,e(i,n?function(e){n?o=a:a(i)}:function(e){a(i)})):e(null,function(e,i){e?a(e):s?a(s):(n=!0,t(i,function(e,t){n=!1,s?(a(s),o&&o(s)):e?r(e,a):a(null,t)}))})}}}},function(e,t,n){"use strict";(function(r){Object.defineProperty(t,"__esModule",{value:!0});var i=n(215),o;o=i.hasNextTick?r.nextTick:i.hasSetImmediate?setImmediate:i.fallback,t.default=(0,i.wrap)(o),e.exports=t.default}).call(this,n(2))},function(e,t,n){"use strict";const r=n(24),i=T("dns4"),o=T("dns6"),s=I(T("dnsaddr"),i,o),a=I(T("ip4"),T("ip6")),u=I(A(a,T("tcp")),A(s,T("tcp"))),l=A(a,T("udp")),c=A(l,T("utp")),f=I(A(s,T("tcp")),s),h=I(A(u,T("ws")),A(f,T("ws"))),p=I(A(u,T("wss")),A(f,T("wss"))),d=I(A(u,T("http")),A(a,T("http")),A(f,T("http")),A(f)),m=I(A(u,T("https")),A(a,T("https")),A(f,T("https"))),g=I(A(h,T("p2p-webrtc-star"),T("ipfs")),A(p,T("p2p-webrtc-star"),T("ipfs"))),y=I(A(h,T("p2p-websocket-star"),T("ipfs")),A(p,T("p2p-websocket-star"),T("ipfs")),A(h,T("p2p-websocket-star")),A(p,T("p2p-websocket-star"))),b=I(A(d,T("p2p-webrtc-direct")),A(m,T("p2p-webrtc-direct"))),v=I(h,p,d,m,g,b,u,c),w=I(A(v,T("p2p-stardust"),T("ipfs")),A(v,T("p2p-stardust")));let _=I(A(v,T("ipfs")),g,T("ipfs"));const k=I(A(_,T("p2p-circuit"),_),A(_,T("p2p-circuit")),A(T("p2p-circuit"),_),A(v,T("p2p-circuit")),A(T("p2p-circuit"),v),T("p2p-circuit")),S=()=>I(A(k,S),k),E=S(),x=I(A(E,_,E),A(_,E),A(E,_),E,_);function C(e){return function t(n){if(!r.isMultiaddr(n))try{n=r(n)}catch(e){return!1}let i=e(n.protoNames());return null!==i&&0===i.length}}function A(){const e=Array.from(arguments);function t(t){return t.length{if(t="function"==typeof e?e().partialMatch(t):e.partialMatch(t),null===t)return!0}),t)}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:C(t),partialMatch:t}}function I(){const e=Array.from(arguments);function t(t){let n=null;return e.some(e=>{const r="function"==typeof e?e().partialMatch(t):e.partialMatch(t);if(r)return n=r,!0}),n}const n={toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:C(t),partialMatch:t};return n}function T(e){const t=e;function n(e){if("string"==typeof e)try{e=r(e)}catch(e){return!1}const n=e.protoNames();return 1===n.length&&n[0]===t}function i(e){return 0===e.length?null:e[0]===t?e.slice(1):null}return{toString:function(){return t},matches:n,partialMatch:i}}t.DNS=f,t.DNS4=i,t.DNS6=o,t.IP=a,t.TCP=u,t.UDP=l,t.UTP=c,t.HTTP=d,t.HTTPS=m,t.WebSockets=h,t.WebSocketsSecure=p,t.WebSocketStar=y,t.WebRTCStar=g,t.WebRTCDirect=b,t.Reliable=v,t.Stardust=w,t.Circuit=E,t.IPFS=x},function(e,t,n){"use strict";var r=n(107),i=n(1);function o(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function s(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for(e=e.replace(/[^a-z0-9]+/gi,""),e.length%2!=0&&(e="0"+e),i=0;i>6|192,n[r++]=63&s|128):o(e,i)?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),n[r++]=s>>18|240,n[r++]=s>>12&63|128,n[r++]=s>>6&63|128,n[r++]=63&s|128):(n[r++]=s>>12|224,n[r++]=s>>6&63|128,n[r++]=63&s|128)}else for(i=0;i>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24;return t>>>0}function l(e,t){for(var n="",r=0;r>>0}return s}function p(e,t){for(var n=new Array(4*e.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n}function d(e,t){return e>>>t|e<<32-t}function m(e,t){return e<>>32-t}function g(e,t){return e+t>>>0}function y(e,t,n){return e+t+n>>>0}function b(e,t,n,r){return e+t+n+r>>>0}function v(e,t,n,r,i){return e+t+n+r+i>>>0}function w(e,t,n,r){var i=e[t],o=e[t+1],s=r+o>>>0,a=(s>>0,e[t+1]=s}function _(e,t,n,r){var i=t+r>>>0,o=(i>>0}function k(e,t,n,r){var i=t+r;return i>>>0}function S(e,t,n,r,i,o,s,a){var u=0,l=t;l=l+r>>>0,u+=l>>0,u+=l>>0,u+=l>>0}function E(e,t,n,r,i,o,s,a){var u=t+r+o+a;return u>>>0}function x(e,t,n,r,i,o,s,a,u,l){var c=0,f=t;f=f+r>>>0,c+=f>>0,c+=f>>0,c+=f>>0,c+=f>>0}function C(e,t,n,r,i,o,s,a,u,l){var c=t+r+o+a+l;return c>>>0}function A(e,t,n){var r=t<<32-n|e>>>n;return r>>>0}function I(e,t,n){var r=e<<32-n|t>>>n;return r>>>0}function T(e,t,n){return e>>>n}function j(e,t,n){var r=e<<32-n|t>>>n;return r>>>0}t.inherits=i,t.toArray=s,t.toHex=a,t.htonl=u,t.toHex32=l,t.zero2=c,t.zero8=f,t.join32=h,t.split32=p,t.rotr32=d,t.rotl32=m,t.sum32=g,t.sum32_3=y,t.sum32_4=b,t.sum32_5=v,t.sum64=w,t.sum64_hi=_,t.sum64_lo=k,t.sum64_4_hi=S,t.sum64_4_lo=E,t.sum64_5_hi=x,t.sum64_5_lo=C,t.rotr64_hi=A,t.rotr64_lo=I,t.shr64_hi=T,t.shr64_lo=j},function(e,t,n){const r=n(45),i=Math.pow(2,31)-1;function o(e){return r.UInt32(e)&&e<=i}function s(e){return r.String(e)&&e.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}s.toJSON=function(){return"BIP32 derivation path"};const a=21e14;function u(e){return r.UInt53(e)&&e<=a}const l=r.quacksLike("Point"),c=r.compile({messagePrefix:r.oneOf(r.Buffer,r.String),bip32:{public:r.UInt32,private:r.UInt32},pubKeyHash:r.UInt8,scriptHash:r.UInt8,wif:r.UInt8}),f={BIP32Path:s,Buffer256bit:r.BufferN(32),ECPoint:l,Hash160bit:r.BufferN(20),Hash256bit:r.BufferN(32),Network:c,Satoshi:u,UInt31:o};for(var h in r)f[h]=r[h];e.exports=f},function(e,t,n){"use strict";var r=t;r.version=n(1434).version,r.utils=n(1435),r.rand=n(574),r.hmacDRBG=n(1436),r.curve=n(272),r.curves=n(1441),r.ec=n(1443)},function(e,t,n){"use strict";(function(t){var r=n(49),i=n(152),o=n(60),s=n(41),a=n(128),u=n(17),l=n(25);function c(e,t){if(!(this instanceof c))return new c(e,t);if(l.checkArgument(e,"First argument is required, please include public key data."),e instanceof c)return e;t=t||{};var n=this._classifyArgs(e,t);return n.point.validate(),s.defineImmutable(this,{point:n.point,compressed:n.compressed,network:n.network||a.defaultNetwork}),this}c.prototype._classifyArgs=function(e,n){var r={compressed:u.isUndefined(n.compressed)||n.compressed};if(e instanceof i)r.point=e;else if(e.x&&e.y)r=c._transformObject(e);else if("string"==typeof e)r=c._transformDER(new t(e,"hex"));else if(c._isBuffer(e))r=c._transformDER(e);else{if(!c._isPrivateKey(e))throw new TypeError("First argument is an unrecognized data format.");r=c._transformPrivateKey(e)}return r.network||(r.network=u.isUndefined(n.network)?void 0:a.get(n.network)),r},c._isPrivateKey=function(e){var t=n(273);return e instanceof t},c._isBuffer=function(e){return e instanceof t||e instanceof Uint8Array},c._transformPrivateKey=function(e){l.checkArgument(c._isPrivateKey(e),"Must be an instance of PrivateKey");var t={};return t.point=i.getG().mul(e.bn),t.compressed=e.compressed,t.network=e.network,t},c._transformDER=function(e,t){l.checkArgument(c._isBuffer(e),"Must be a hex buffer of DER encoded public key");var n={},o,s,a,f;if(t=!!u.isUndefined(t)||t,4!==e[0]&&(t||6!==e[0]&&7!==e[0]))if(3===e[0])a=e.slice(1),o=new r(a),n=c._transformX(!0,o),n.compressed=!0;else{if(2!==e[0])throw new TypeError("Invalid DER format public key");a=e.slice(1),o=new r(a),n=c._transformX(!1,o),n.compressed=!0}else{if(a=e.slice(1,33),f=e.slice(33,65),32!==a.length||32!==f.length||65!==e.length)throw new TypeError("Length of x and y must be 32 bytes");o=new r(a),s=new r(f),n.point=new i(o,s),n.compressed=!1}return n},c._transformX=function(e,t){l.checkArgument("boolean"==typeof e,"Must specify whether y is odd or not (true or false)");var n={};return n.point=i.fromX(e,t),n},c._transformObject=function(e){var t=new r(e.x,"hex"),n=new r(e.y,"hex"),o=new i(t,n);return new c(o,{compressed:e.compressed})},c.fromPrivateKey=function(e){l.checkArgument(c._isPrivateKey(e),"Must be an instance of PrivateKey");var t=c._transformPrivateKey(e);return new c(t.point,{compressed:t.compressed,network:t.network})},c.fromDER=c.fromBuffer=function(e,t){l.checkArgument(c._isBuffer(e),"Must be a hex buffer of DER encoded public key");var n=c._transformDER(e,t);return new c(n.point,{compressed:n.compressed})},c.fromPoint=function(e,t){return l.checkArgument(e instanceof i,"First argument must be an instance of Point."),new c(e,{compressed:t})},c.fromString=function(e,n){var r=new t(e,n||"hex"),i=c._transformDER(r);return new c(i.point,{compressed:i.compressed})},c.fromX=function(e,t){var n=c._transformX(e,t);return new c(n.point,{compressed:n.compressed})},c.getValidationError=function(e){var t;try{new c(e)}catch(e){t=e}return t},c.isValid=function(e){return!c.getValidationError(e)},c.prototype.toObject=c.prototype.toJSON=function e(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}},c.prototype.toBuffer=c.prototype.toDER=function(){var e=this.point.getX(),n=this.point.getY(),r=e.toBuffer({size:32}),i=n.toBuffer({size:32}),o;if(this.compressed){var s=i[i.length-1]%2;return o=new t(s?[3]:[2]),t.concat([o,r])}return o=new t([4]),t.concat([o,r,i])},c.prototype._getID=function e(){return o.sha256ripemd160(this.toBuffer())},c.prototype.toAddress=function(e){var t=n(129);return t.fromPublicKey(this,e||this.network)},c.prototype.toString=function(){return this.toDER().toString("hex")},c.prototype.inspect=function(){return""},e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){var r=n(27),i=n(13);function o(e,t){Error.captureStackTrace&&Error.captureStackTrace(this,o),this.name="FingerprintFormatError",this.fingerprint=e,this.format=t,this.message="Fingerprint format is not supported, or is invalid: ",void 0!==e&&(this.message+=" fingerprint = "+e),void 0!==t&&(this.message+=" format = "+t)}function s(e){Error.captureStackTrace&&Error.captureStackTrace(this,s),this.name="InvalidAlgorithmError",this.algorithm=e,this.message='Algorithm "'+e+'" is not supported'}function a(e,t,n){Error.captureStackTrace&&Error.captureStackTrace(this,a),this.name="KeyParseError",this.format=t,this.keyName=e,this.innerErr=n,this.message="Failed to parse "+e+" as a valid "+t+" format key: "+n.message}function u(e,t,n){Error.captureStackTrace&&Error.captureStackTrace(this,u),this.name="SignatureParseError",this.type=e,this.format=t,this.innerErr=n,this.message="Failed to parse the given data as a "+e+" signature in "+t+" format: "+n.message}function l(e,t,n){Error.captureStackTrace&&Error.captureStackTrace(this,l),this.name="CertificateParseError",this.format=t,this.certName=e,this.innerErr=n,this.message="Failed to parse "+e+" as a valid "+t+" format certificate: "+n.message}function c(e,t){Error.captureStackTrace&&Error.captureStackTrace(this,c),this.name="KeyEncryptedError",this.format=t,this.keyName=e,this.message="The "+t+" format key "+e+" is encrypted (password-protected), and no passphrase was provided in `options`"}i.inherits(o,Error),i.inherits(s,Error),i.inherits(a,Error),i.inherits(u,Error),i.inherits(l,Error),i.inherits(c,Error),e.exports={FingerprintFormatError:o,InvalidAlgorithmError:s,KeyParseError:a,SignatureParseError:u,KeyEncryptedError:c,CertificateParseError:l}},function(e,t){errors={};class n extends Error{constructor(e){super(e||"Coding Error"),this.name="CodingError"}}errors.CodingError=n;class r extends Error{constructor(e){super("To be implemented: "+e),this.name="ToBeImplementedError"}}errors.ToBeImplementedError=r;class i extends Error{constructor(e){super(e||"Transport failure"),this.name="TransportError"}}errors.TransportError=i;class o extends Error{constructor(e){super(e||"Timed out"),this.name="TimeoutError"}}errors.TimeoutError=o;class s extends Error{constructor(e){super(e||"Intentionally Unimplemented Function"),this.name="IntentionallyUnimplementedError"}}errors.IntentionallyUnimplementedError=s,t=e.exports=errors},function(e,t,n){var r=n(389),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();e.exports=o},function(e,t,n){(function(t){var r=n(57);e.exports=o,e.exports.source=function(e){return o(null,e)},e.exports.sink=function(e){return o(e,null)};var i="undefined"==typeof setImmediate?t.nextTick:setImmediate;function o(e,t){e&&"object"==typeof e&&(t=e.source,e=e.sink);var n=[],o=[],s,a,u=new r,l;u.writable=u.readable=!0,u.write=function(e){return n.length?n.shift()(null,e):o.push(e),n.length||(a=!0),!!n.length},u.end=function(){t?o.length?g():t(s=!0,n.length?n.shift():function(){}):n.length&&n.shift()(!0)},u.source=function(e,t){o.length?(t(null,o.shift()),o.length||u.emit("drain")):((s=s||e)?t(s):n.push(t),a&&(a=!1,u.emit("drain")))},e&&(l=e(u.source)),l&&!t&&(t=l);var c=[],f=[],h=!1,p=!1,d=!1;if(u.sink=function(e){t=e,i(g)},t){u.sink(t);var m=u.pipe.bind(u);u.pipe=function(e,t){var n=m(e,t);return u.paused&&u.resume(),n}}function g(){if(p=!1,t&&!d){for(;c.length&&!u.paused;)u.emit("data",c.shift());if(!u.paused){if(h)return u.emit("end");d=!0,t(null,function e(n,r){d=!1,u.paused?(!0===n?h=n:n?u.emit("error",n):c.push(r),p=!0):n&&!0!==(s=n)?u.emit("error",n):(s=s||n)?u.emit("end"):(u.emit("data",r),d=!0,t(null,e))})}}}return u.pause=function(){return u.paused=!0,u},u.resume=function(){return u.paused=!1,g(),u},u.destroy=function(){!s&&t&&t(s=!0,function(){}),s=!0,n.length&&n.shift()(!0),u.emit("close")},u}}).call(this,n(2))},function(e,t,n){"use strict";(function(t){const r=n(9);e.exports=function(e){if(t.isBuffer(e))return new r(e).toString();if(r.isCID(e))return e.toString();if("string"!=typeof e)throw new Error("unexpected cid type: "+typeof e);return new r(e.split("/")[0]),e}}).call(this,n(0).Buffer)},function(e,t,n){e.exports=p;var r=n(27),i=n(31).Buffer,o=n(55),s=n(15),a=n(97),u=n(47),l=n(103),c=n(210),f=a.InvalidAlgorithmError,h=a.SignatureParseError;function p(e){r.object(e,"options"),r.arrayOfObject(e.parts,"options.parts"),r.string(e.type,"options.type");for(var t={},n=0;n20&&0===o[0]&&(o=o.slice(1)),s=this.part.s.data,s.length>20&&0===s[0]&&(s=s.slice(1)),this.hashAlgorithm&&"sha1"!==this.hashAlgorithm||o.length+s.length!==40)throw new Error("OpenSSH only supports DSA signatures with SHA1 hash");return t.writeBuffer(i.concat([o,s])),t.toBuffer()}if("ssh"===e&&"ecdsa"===this.type){var f=new c({}),h;o=this.part.r.data,f.writeBuffer(o),f.writePart(this.part.s),t=new c({}),0===o[0]&&(o=o.slice(1));var p=8*o.length;return 256===p?h="nistp256":384===p?h="nistp384":528===p&&(h="nistp521"),t.writeString("ecdsa-sha2-"+h),t.writeBuffer(f.toBuffer()),t.toBuffer()}throw new Error("Invalid signature format");default:throw new Error("Invalid signature data")}},p.prototype.toString=function(e){return r.optionalString(e,"format"),this.toBuffer(e).toString("base64")},p.parse=function(e,t,n){"string"==typeof e&&(e=i.from(e,"base64")),r.buffer(e,"data"),r.string(n,"format"),r.string(t,"type");var o={};o.type=t.toLowerCase(),o.parts=[];try{switch(r.ok(e.length>0,"signature must not be empty"),o.type){case"rsa":case"ed25519":return d(e,t,n,o);case"dsa":case"ecdsa":return"asn1"===n?m(e,t,n,o):"dsa"===o.type?g(e,t,n,o):y(e,t,n,o);default:throw new f(t)}}catch(e){if(e instanceof f)throw e;throw new h(t,n,e)}},p.isSignature=function(e,t){return u.isCompatible(e,p,t)},p.prototype._sshpkApiVersion=[2,1],p._oldVersionDetect=function(e){return r.func(e.toBuffer),e.hasOwnProperty("hashAlgorithm")?[2,0]:[1,0]}},function(e,t,n){var r=n(1853);e.exports={Ber:r,BerReader:r.Reader,BerWriter:r.Writer}},function(e,t,n){"use strict";function r(e,t){t|=0;for(var n=Math.max(e.length-t,0),r=Array(n),i=0;i=this.buf.length},a.prototype.finished=a.prototype.eof,a.prototype.read=function(e){i.checkArgument(!r.isUndefined(e),"Must specify a length");var t=this.buf.slice(this.pos,this.pos+e);return this.pos=this.pos+e,t},a.prototype.readAll=function(){var e=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,e},a.prototype.readUInt8=function(){var e=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,e},a.prototype.readUInt16BE=function(){var e=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,e},a.prototype.readUInt16LE=function(){var e=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,e},a.prototype.readUInt32BE=function(){var e=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,e},a.prototype.readUInt32LE=function(){var e=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,e},a.prototype.readUInt64BEBN=function(){var e=this.buf.slice(this.pos,this.pos+8),t=s.fromBuffer(e);return this.pos=this.pos+8,t},a.prototype.readUInt64LEBN=function(){var e=this.buf.readUInt32LE(this.pos),t=this.buf.readUInt32LE(this.pos+4),n=4294967296*t+e,r;if(n<=9007199254740991)r=new s(n);else{var i=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);r=new s(i,10,"le")}return this.pos=this.pos+8,r},a.prototype.readVarintNum=function(){var e=this.readUInt8();switch(e){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var t=this.readUInt64LEBN(),n=t.toNumber();if(n<=Math.pow(2,53))return n;throw new Error("number too large to retain precision - use readVarintBN");default:return e}},a.prototype.readVarLengthBuffer=function(){var e=this.readVarintNum(),t=this.read(e);return i.checkState(t.length===e,"Invalid length while reading varlength buffer. Expected to read: "+e+" and read "+t.length),t},a.prototype.readVarintBuf=function(){var e=this.buf.readUInt8(this.pos);switch(e){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}},a.prototype.readVarintBN=function(){var e=this.readUInt8();switch(e){case 253:return new s(this.readUInt16LE());case 254:return new s(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new s(e)}},a.prototype.reverse=function(){for(var e=new t(this.buf.length),n=0;n=w.outputs.length)return new t(d,"hex");for(w.outputs.length=p+1,v=0;v9007199254740991?"transaction txout satoshis greater than max safe integer":this._satoshis!==this._satoshisBN.toNumber()?"transaction txout satoshis has corrupted value":this._satoshis<0&&"transaction txout negative"},p.prototype.toObject=p.prototype.toJSON=function e(){var t={satoshis:this.satoshis};return t.script=this._scriptBuffer.toString("hex"),t},p.fromObject=function(e){return new p(e)},p.prototype.setScriptFromBuffer=function(e){this._scriptBuffer=e;try{this._script=l.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(e){if(!(e instanceof f.Script.InvalidBuffer))throw e;this._script=null}},p.prototype.setScript=function(e){if(e instanceof l)this._scriptBuffer=e.toBuffer(),this._script=e,this._script._isOutput=!0;else if(r.isString(e))this._script=l.fromString(e),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else{if(!s.isBuffer(e))throw new TypeError("Invalid argument type: script");this.setScriptFromBuffer(e)}return this},p.prototype.inspect=function(){var e;return e=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),""},p.fromBufferReader=function(e){var t={};t.satoshis=e.readUInt64LEBN();var n=e.readVarintNum();return t.script=0!==n?e.read(n):new o.Buffer([]),new p(t)},p.prototype.toBufferWriter=function(e){e||(e=new u),e.writeUInt64LEBN(this._satoshisBN);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e},e.exports=p},function(e,t,n){"use strict";const r=n(59),i=n(200);function o(e,t){r(e,i(e=>t(null,e)),e=>{e&&t(e)})}e.exports=o},function(e,t,n){e.exports={read:k,write:S};var r=n(27),i=n(103),o=n(15),s=n(31).Buffer,a=n(55),u=n(47),l=n(46),c=n(50),f=n(380),h=n(211),p=n(287),d=n(114),m=n(97),g="1.2.840.113549.1.5.13",y="1.2.840.113549.1.5.12",b={"1.2.840.113549.3.7":"3des-cbc","2.16.840.1.101.3.4.1.2":"aes128-cbc","2.16.840.1.101.3.4.1.42":"aes256-cbc"},v={};Object.keys(b).forEach(function(e){v[b[e]]=e});var w={"1.2.840.113549.2.7":"sha1","1.2.840.113549.2.9":"sha256","1.2.840.113549.2.11":"sha512"},_={};function k(e,t,n){var a=e;"string"!=typeof e&&(r.buffer(e,"buf"),e=e.toString("ascii"));for(var l=e.trim().split(/[\r\n]+/g),c,v=-1,_;!c&&v0;)_=l[--k].match(/[-]+[ ]*END ([A-Z0-9][A-Za-z0-9]+ )?(PUBLIC|PRIVATE) KEY[ ]*[-]+/);r.ok(_,"invalid PEM footer"),r.equal(c[2],_[2]);var S=c[2].toLowerCase(),E;c[1]&&(r.equal(c[1],_[1],"PEM header and footer mismatch"),E=c[1].trim()),l=l.slice(v,k+1);for(var x={},C,A,I;l=l.slice(1),c=l[0].match(/^([A-Za-z0-9-]+): (.+)$/),c;)x[c[1].toLowerCase()]=c[2];if(l=l.slice(0,-1).join(""),e=s.from(l,"base64"),x["proc-type"]){var T=x["proc-type"].split(",");if("4"===T[0]&&"ENCRYPTED"===T[1]){if("string"==typeof t.passphrase&&(t.passphrase=s.from(t.passphrase,"utf-8")),!s.isBuffer(t.passphrase))throw new m.KeyEncryptedError(t.filename,"PEM");T=x["dek-info"].split(","),r.ok(2===T.length),C=T[0].toLowerCase(),I=s.from(T[1],"hex"),A=u.opensslKeyDeriv(C,I,t.passphrase,1).key}}if(E&&"encrypted"===E.toLowerCase()){var j=new i.BerReader(e),O;j.readSequence(),j.readSequence(),O=j.offset+j.length;var P=j.readOID();if(P!==g)throw new Error("Unsupported PEM/PKCS8 encryption scheme: "+P);j.readSequence(),j.readSequence();var B=j.offset+j.length,R=j.readOID();if(R!==y)throw new Error("Unsupported PBES2 KDF: "+R);j.readSequence();var N=j.readString(i.Ber.OctetString,!0),M=j.readInt(),L="sha1";if(j.offsetp.length&&(b=p.length),g+=m.write(p.slice(y,b),g),m[g++]=10,y=b}return g+=m.write("-----END "+a+"-----\n",g),m.slice(0,g)}Object.keys(w).forEach(function(e){_[w[e]]=e})},function(e,t,n){e.exports={read:h.bind(void 0,!1,void 0),readType:h.bind(void 0,!1),write:p,readPartial:h.bind(void 0,!0),readInternal:h,keyTypeToAlg:f,algToKeyType:c};var r=n(27),i=n(31).Buffer,o=n(55),s=n(47),a=n(46),u=n(50),l=n(210);function c(e){if(r.string(e),"ssh-dss"===e)return"dsa";if("ssh-rsa"===e)return"rsa";if("ssh-ed25519"===e)return"ed25519";if("ssh-curve25519"===e)return"curve25519";if(e.match(/^ecdsa-sha2-/))return"ecdsa";throw new Error("Unknown algorithm "+e)}function f(e){if(r.object(e),"dsa"===e.type)return"ssh-dss";if("rsa"===e.type)return"ssh-rsa";if("ed25519"===e.type)return"ssh-ed25519";if("curve25519"===e.type)return"ssh-curve25519";if("ecdsa"===e.type)return"ecdsa-sha2-"+e.part.curve.data.toString();throw new Error("Unknown key type "+e.type)}function h(e,t,n,f){"string"==typeof n&&(n=i.from(n)),r.buffer(n,"buf");var h={},p=h.parts=[],d=new l({buffer:n}),m=d.readString();r.ok(!d.atEnd(),"key must have at least one part"),h.type=c(m);var g=o.info[h.type].parts.length;for(t&&"private"===t&&(g=o.privInfo[h.type].parts.length);!d.atEnd()&&p.length=1,"key must have at least one part"),r.ok(e||d.atEnd(),"leftover bytes at end of key");var y=a,b=o.info[h.type];if("private"!==t&&b.parts.length===p.length||(b=o.privInfo[h.type],y=u),r.strictEqual(b.parts.length,p.length),"ecdsa"===h.type){var v=/^ecdsa-sha2-(.+)$/.exec(m);r.ok(null!==v),r.strictEqual(v[1],p[0].data.toString())}for(var w=!0,_=0;_!e.status)}static p_connectedNames(e){const t=this._connected().map(e=>e.name);if(!e)return new Promise((e,n)=>e(t));e(null,t)}static async p_connectedNamesParm(){return(await this.p_connectedNames()).map(e=>"transport="+e).join("&")}static p_statuses(e){const t=c._transports.map(e=>({name:e.name,status:e.status}));if(!e)return new Promise((e,n)=>e(t));e(null,t)}static validFor(e,t,n){return"string"==typeof e&&(e=[e]),e&&e[0]||["store","newlisturls","newdatabase","newtable","seed"].includes(t)?e&&e.length>0?[].concat(...e.map(e=>"string"==typeof e?r.parse(e):e).map(e=>this._transports.filter(r=>r.validFor(e,t,n)).map(t=>[e,t]))):this._transports.filter(e=>e.validFor(void 0,t,n)).map(e=>[void 0,e]):(console.error("Transports.validFor called with invalid arguments: urls=",e,"func=",t),[])}static async p_urlsValidFor(e,t,n){return this.validFor(e,t,n).map(e=>e[0])}static http(){return c._connected().find(e=>"HTTP"===e.name)}static wolk(){return c._connected().find(e=>"WOLK"===e.name)}static ipfs(){return c._connected().find(e=>"IPFS"===e.name)}static webtorrent(){return c._connected().find(e=>"WEBTORRENT"===e.name)}static gun(){return c._connected().find(e=>"GUN"===e.name)}static async p_resolveNames(e){return this.mirror?Array.isArray(e)?this.gatewayUrls(e):this.gatewayUrl(url):this.namingcb?await this.namingcb(e):e}static resolveNamesWith(e){this.namingcb=e}static togglePaused(e,t){const n=this._transports.find(t=>t.name===e);n?n.togglePaused(e=>t(null,e.status)):t(void 0)}static async _p_rawstore(e,t){let n=[],r=await Promise.all(e.map(async function(e){try{s("Storing %d bytes to %s",t.length,e.name);let r=await e.p_rawstore(t);return s("Storing %d bytes to %s succeeded: %s",t.length,e.name,r),r}catch(r){return s("Storing %d bytes to %s failed: %s",t.length,e.name,r.message),void n.push(r)}}));if(r=r.filter(e=>!!e),!r.length)throw s("Storing %d bytes failed on all transports",t.length),new i.TransportError(n.map(e=>e.message).join(", "));return r}static async p_rawstore(e){let t=this.validFor(void 0,"store").map(([e,t])=>t);if(!t.length)throw s("Storing %d bytes failed: no transports available",e.length),new i.TransportError("Transports.p_rawstore: Cant find transport for store");return this._p_rawstore(t,e)}static async p_rawfetch(e,t={}){if(!e.length)throw new i.TransportError("Transports.p_rawfetch given an empty list of urls");let n=await this.p_resolveNames(e);if(!n.length)throw new i.TransportError("Transports.p_rawfetch none of the urls resolved: "+e);let r=this.validFor(n,"fetch",{noCache:t.noCache});if(!r.length)throw new i.TransportError("Transports.p_rawfetch cant find any transport for urls: "+n);let o=[],a=[];for(const[e,n]of r)try{s("Fetching %s via %s",e.href,n.name);let r=await n.p_rawfetch(e,t);return s("Fetching %s via %s succeeded %d bytes",e.href,n.name,r.length),t.relay&&a.length&&(s("Fetching attempting relay of %d bytes from %s to %o",r.length,e.href,a.map(e=>e.name)),this._p_rawstore(a,r).then(e=>s("Fetching relayed %d bytes to %o",r.length,e))),r}catch(t){a.push(n),o.push(t),s("Fetching %s via %s failed: %s",e.href,n.name,t.message)}throw s("Fetching %o failed on all transports",e),new i.TransportError(o.map(e=>e.message).join(", "))}static fetch(e,t={},n){"function"==typeof t&&(n=t,t={});const r=this.p_rawfetch(e,t);if(!n)return r;r.then(e=>{try{n(null,e)}catch(e){s("Uncaught error in fetch %O",e)}}).catch(e=>n(e))}static seed({directoryPath:e,fileRelativePath:t,ipfsHash:n,urlToFile:r,torrentRelativePath:i},o){if(!o)return new Promise((e,t)=>{try{a.call(this,(n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{a.call(this,o)}catch(e){o(e)}function a(o){let a=this.validFor(void 0,"seed").map(([e,t])=>t);if(a.length){const s={};u(a,(o,a)=>o.seed({directoryPath:e,torrentRelativePath:i,fileRelativePath:t,ipfsHash:n,urlToFile:r},(e,t)=>{s[o.name]=e?{err:e.message}:t,a(null)}),e=>o(null,s))}else s("Seeding: no transports available"),o(null)}}static async p_rawlist(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"list");if(!t.length)throw new i.TransportError('Transports.p_rawlist: Cant find transport to "list" urls:'+e.join(","));let n=[],r=await Promise.all(t.map(async function([e,t]){try{s("Listing %s via %s",e,t.name);let r=await t.p_rawlist(e);return s("Listing %s via %s retrieved %d items",e,t.name,r.length),r}catch(r){return s("Listing %s via %s failed: %s",e,t.name,r.message),n.push(r),[]}}));if(n.length>=t.length)throw s("Listing %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "));let o={};return[].concat(...r).filter(e=>!o[e.signature]&&(o[e.signature]=!0))}static async p_rawadd(e,t){e=await this.p_resolveNames(e);let n=this.validFor(e,"add");if(!n.length)throw s("Adding to %o failed: no transports available",e),new i.TransportError("Transports.p_rawstore: Cant find transport for urls:"+e.join(","));let r=[];if(await Promise.all(n.map(async function([e,n]){try{return s("Adding to %s via %s",e,n.name),await n.p_rawadd(e,t),void s("Adding to %s via %s succeeded",e,n.name)}catch(t){return s("Adding to %s via %s failed: %s",e,n.name,t.message),void r.push(t)}})),r.length>=n.length)throw s("Adding to %o failed on all transports",e),new i.TransportError(r.map(e=>e.message).join(", "))}static listmonitor(e,t,n={}){this.validFor(e,"listmonitor").map(([e,r])=>{r.listmonitor(e,t,n),s("Monitoring list %s via %s",e,r.name)})}static async p_newlisturls(e){let t=await Promise.all(this.validFor(void 0,"newlisturls").map(([t,n])=>n.p_newlisturls(e)));return[t.map(e=>e[0]),t.map(e=>e[1])]}static async p_f_createReadStream(e,{wanturl:t=!1,preferredTransports:n=[]}={}){let r=this.validFor(e,"createReadStream",{});if(!r.length)throw s("Opening stream from %o failed: no transports available",e),new i.TransportError("Transports.p_createReadStream cant find any transport for urls: "+e);let o=[];r.sort((e,t)=>(n.indexOf(e[1].name)+1||999+Math.random())-(n.indexOf(t[1].name)+1||999+Math.random()));for(const[e,n]of r)try{s("Opening stream from %s via %s",e.href,n.name);let r=await n.p_f_createReadStream(e,{wanturl:t});return s("Opening stream from %s via %s succeeded",e.href,n.name),r}catch(t){o.push(t),s("Opening stream from %s via %s failed: %s",e.href,n.name,t.message)}throw s("Opening stream from %o failed on all transports",e),new i.TransportError(o.map(e=>e.message).join(", "))}static createReadStream(e,t,n){"function"==typeof t&&(n=t,t={start:0}),DwebTransports.p_f_createReadStream(e,{preferredTransports:t.preferredTransports||[]}).then(e=>{let r=e(t);if(!n)return r;n(null,r)}).catch(e=>{e instanceof i.TransportError?console.warn("Transports.createReadStream caught",e.message):console.error("Transports.createReadStream caught",e),n?n(e):reject(e)})}static async p_get(e,t){let n=this.validFor(e,"get"),r=Array.isArray(t)?`${t.length} keys`:t;if(!n.length)throw s("Getting %s from %o failed: no transports available",r,e),new i.TransportError("Transports.p_get cant find any transport to get keys from urls: "+e);let o=[];for(const[e,i]of n)try{s("Getting %s from %s via %s",r,e.href,i.name);let n=await i.p_get(e,t);return s("Getting %s from %s via %s succeeded length=%d",r,e.href,i.name,n.length),n}catch(t){o.push(t),s("Getting %s from %s via %s failed: %s",r,e.href,i.name,t.message)}throw s("Getting %s from %o failed on all transports",r,e),new i.TransportError(o.map(e=>e.message).join(", "))}static async p_set(e,t,n){e=await this.p_resolveNames(e);let r="object"==typeof t?`${t.length} keys`:t,o=this.validFor(e,"set");if(!o.length)throw s("Setting %s on %o failed: no transports available",r,e),new i.TransportError("Transports.p_set cant find any transport for urls: "+e);let a=[],u=!1;if(await Promise.all(o.map(async function([e,i]){try{s("Setting %s on %s via %s",r,e.href,i.name),await i.p_set(e,t,n),s("Setting %s on %s via %s succeeded",r,e.href,i.name),u=!0}catch(t){s("Setting %s on %s via %s failed: %s",r,e.href,i.name,t.message),a.push(t)}})),!u)throw s("Setting %s on %o failed on all transports",r,e),new i.TransportError(a.map(e=>e.message).join(", "))}static async p_delete(e,t){e=await this.p_resolveNames(e);let n=Array.isArray(t)?`${t.length} keys`:t,r=this.validFor(e,"set");if(!r.length)throw s("Deleting %s on %o failed: no transports available",n,e),new i.TransportError("Transports.p_set cant find any transport for urls: "+e);let o=[],a=!1;if(await Promise.all(r.map(async function([e,r]){try{s("Deleting %s on %s via %s",n,e.href,r.name),await r.p_delete(e,t),s("Deleting %s on %s via %s succeeded",n,e.href,r.name),a=!0}catch(t){s("Deleting %s on %s via %s failed: %s",n,e.href,r.name,t.message),o.push(t)}})),!a)throw s("Deleting %s on %o failed on all transports",n,e),new i.TransportError(o.map(e=>e.message).join(", "))}static async p_keys(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"keys");if(!t.length)throw s("Getting all keys on %o failed: no transports available",e),new i.TransportError("Transports.p_keys cant find any transport for urls: "+e);let n=[];for(const[e,r]of t)try{s("Getting all keys on %s via %s",e.href,r.name);let t=await r.p_keys(e);return s("Getting all keys on %s via %s succeeded with %d keys",e.href,r.name,t.length),t}catch(t){n.push(t),s("Getting all keys on %s via %s failed: %s",e.href,r.name,t.message)}throw s("Getting all keys on %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "))}static async p_getall(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"getall");if(!t.length)throw s("Getting all values on %o failed: no transports available",e),new i.TransportError("Transports.p_getall cant find any transport for urls: "+e);let n=[];for(const[e,r]of t)try{s("Getting all values on %s via %s",e.href,r.name);let t=await r.p_getall(e);return s("Getting all values on %s via %s succeeded with %d values",e.href,r.name,t.length),t}catch(t){n.push(t),s("Getting all values on %s via %s failed: %s",e.href,r.name,t.message)}throw s("Getting all keys on %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "))}static async p_newdatabase(e){let t=await Promise.all(this.validFor(void 0,"newdatabase").map(([t,n])=>n.p_newdatabase(e)));return{privateurls:t.map(e=>e.privateurl),publicurls:t.map(e=>e.publicurl)}}static async p_newtable(e,t){let n=await Promise.all(this.validFor(void 0,"newtable").map(([n,r])=>r.p_newtable(e,t)));return{privateurls:n.map(e=>e.privateurl),publicurls:n.map(e=>e.publicurl)}}static async p_connection(e){e=await this.p_resolveNames(e),await Promise.all(this.validFor(e,"connection").map(([e,t])=>t.p_connection(e)))}static monitor(e,t,{current:n=!1}={}){this.validFor(e,"monitor").map(([e,r])=>{s("Monitoring table %s via %s",e,r.name),r.monitor(e,t,{current:n})})}static addtransport(e){c._transports.push(e)}static setup0(e,t,n){let r={http:{urlbase:"http://localhost:4244"}};return e.map(e=>{let n=this._transportclasses["LOCAL"===e?"HTTP":e];return n?(s("Setting up connection to %s with options %o",e,t),n.setup0("LOCAL"===e?r:t)):void s("Connection to %s unavailable",e)}).filter(e=>!!e)}static p_setup1(e,t){const n=Promise.all(this._transports.filter(e=>!this._optionspaused.includes(e.name)).map(t=>(s("Connection stage 1 to %s",t.name),t.p_setup1(e))));if(!t)return n;n.catch(e=>t(e)).then(e=>t(null,e))}static p_setup2(e,t){const n=Promise.all(this._transports.filter(e=>!this._optionspaused.includes(e.name)).map(t=>(s("Connection stage 2 to %s",t.name),t.p_setup2(e))));if(!t)return n;n.catch(e=>t(e)).then(e=>t(null,e))}static p_stop(e,t){if(!t)return new Promise((e,t)=>{try{n.call(this,(n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{n.call(this,t)}catch(e){t(e)}function n(t){l(this._connected(),(t,n)=>{s("Stopping %s",t.name),t.stop(e,n)},t)}}static async refreshstatus(e){let t=["transportstatus0","transportstatus1","transportstatus2","transportstatus3","transportstatus4"],n=e.statuselement;n&&(n.classList.remove(...t),n.classList.add(t[e.status])),c.statuscb&&c.statuscb(e)}static connect(e,t){const n=this.p_connect(e);if(!t)return n;n.catch(e=>t(e)).then(e=>t(null,e))}static async p_connect(e){try{e=e||{};let t=e.transports;this._optionspaused=(e.paused||[]).map(e=>e.toUpperCase()),t&&t.length||(t=e.defaulttransports||[]),t.length||(t=["HTTP","IPFS","WEBTORRENT","WOLK"]),t=t.map(e=>e.toUpperCase());let n=this.setup0(t,e);if(["statuscb","mirror"].forEach(t=>{e[t]&&(this[t]=e[t])}),e.statuselement){let t=e.statuselement;for(;t.lastChild;)t.removeChild(t.lastChild);t.appendChild(o.createElement("UL",{},n.map(e=>{let t=o.createElement("LI",{onclick:"this.source.togglePaused(DwebTransports.refreshstatus);",source:e,name:e.name},e.name);return e.statuselement=t,t})))}await this.p_setup1(this.refreshstatus),await this.p_setup2(this.refreshstatus),s("Connection completed to %o",this._connected().map(e=>e.name))}catch(e){throw console.error("ERROR in p_connect:",e.message),e}}static async p_urlsFrom(e){if("string"==typeof e&&(e="["===e[0]?JSON.parse(e):e.includes(",")?e.split(","):[e]),!Array.isArray(e))throw new Error(`Unparsable url: ${e}`);return e}static async p_httpfetchurl(e){return c.http()._url(e.find(e=>e.startsWith("contenthash")||e.startsWith("http")),"content/rawfetch")}static canonicalName(e,t={}){"string"!=typeof e&&(e=r.parse(e).href);const n=["dweb.me","ipfs.io"],i=["ipfs","gun","magnet","yjs","wolk","arc","contenthash","http","https"],o=["arc","http","https"],s=[/^http[s]?:[/]+([^/]+)[/](\w+)[/](.*)/i],a=[/^dweb:[/]+(\w+)[/]+(.*)/i,/^\w+:[/]+(\w+)[/](.*)/i,/^(\w+):[/]*(.*)/i,/^[/]*(\w+)[/](.*)/i,/^[/]*dweb[/]*(\w+)[/](.*)/i],u=[/^http[s]?:[/]+[^/]+[/](archive).(org)[/]*(.*)/i,/^http[s]?:[/]+[^/]+[/]arc[/](archive).(org)[/]*(.*)/i,/^http[s]?:[/]+dweb.(\w+)[.]([^/]+)[/]*(.*)/i,/^(http[s])?:[/]+([^/]+)[/]+(.*)/i];for(let t of s){let r=e.match(t);if(r&&n.includes(r[1])&&i.includes(r[2]))return{proto:r[2],internal:r[3]}}for(let t of u){let n=e.match(t);if(n)return i.includes(n[1])?{proto:n[1],internal:o.includes(n[1])?[n[2],n[3]].join("/"):n[3]}:{proto:"arc",internal:[[n[1],n[2]].join("."),n[3]].join("/")}}for(let t of a){let n=e.match(t);if(n&&i.includes(n[1]))return{proto:n[1],internal:n[2]}}}static canonicalUrl(e,t={}){let n=this.canonicalName(e,t);return n.protocol+":/"+n.internal}static _o2url(e){return["http","https"].includes(e.proto)?[e.proto,e.internal].join("://"):e.proto?[this.mirror,e.proto,e.internal].join("/"):e.internal}static gatewayUrl(e){let t=c.canonicalName(e);return t?this._o2url(t):e}static gatewayUrls(e){const t=e.map(e=>c.canonicalName(e)||{proto:void 0,internal:e}),n=t.filter(e=>["arc"].includes(e.proto));return(n.length?n:t).map(e=>this._o2url(e))}}c._transports=[],c.namingcb=void 0,c._transportclasses={},c.httptools=a,t=e.exports=c},function(e,t,n){"use strict";var r=n(10),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=f;var o=n(7);o.inherits=n(1);var s=n(431),a=n(303);o.inherits(f,s);for(var u=i(a.prototype),l=0;l`}toJSON(){return this._json||(this._json=Object.freeze({name:this.name,size:this.size,cid:this._cid.toBaseEncodedString()})),Object.assign({},this._json)}get name(){return this._name}get nameAsBuffer(){return null!==this._nameBuf?this._nameBuf:(this._nameBuf=r.from(this._name),this._nameBuf)}set name(e){throw new Error("Can't set property: 'name' is immutable")}get size(){return this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}get cid(){return this._cid}set cid(e){throw new Error("Can't set property: 'cid' is immutable")}}t=e.exports=s(a,{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"}),t.create=n(885),t.util=n(886)}).call(this,n(0).Buffer)},function(e,t,n){var r=n(19);e.exports=r.md=r.md||{},r.md.algorithms=r.md.algorithms||{}},function(e,t,n){var r=n(4).Buffer,i=n(57).Transform,o=n(16).StringDecoder,s=n(1);function a(e){i.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}s(a,i),a.prototype.update=function(e,t,n){"string"==typeof e&&(e=r.from(e,t));var i=this._update(e);return this.hashMode?this:(n&&(i=this._toString(i,n)),i)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(e,t,n){var r;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){r=e}finally{n(r)}},a.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},a.prototype._finalOrDigest=function(e){var t=this.__final()||r.alloc(0);return e&&(t=this._toString(t,e,!0)),t},a.prototype._toString=function(e,t,n){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var r=this._decoder.write(e);return n&&(r+=this._decoder.end()),r},e.exports=a},function(e,t,n){"use strict";const r=n(5),i=(e,t)=>{const n=["bitswap"];t&&n.push(t),e&&n.push(`${e.toB58String().slice(0,8)}`);const i=r(n.join(":"));return i.error=r(n.concat(["error"]).join(":")),i},o=(e,t,n)=>{let r=0;const i=n.length;for(;r{let n=0;const r=t.length,i=[];let s;for(;nt.reduce((t,n)=>{const r=e(n);return t[r]?t[r].push(n):t[r]=[n],t},{}),u=(e,t,n)=>t.filter(t=>!o(e,t,n)),l=(e,t)=>Array.prototype.slice.call(t,0).sort((t,n)=>{const r=e(t),i=e(n);return ri?1:0});e.exports={logger:i,includesWith:o,uniqWith:s,groupBy:a,pullAllWith:u,sortBy:l}},function(e,t,n){var r=n(1004),i=n(1007);function o(e,t){var n=i(e,t);return r(n)?n:void 0}e.exports=o},function(e,t,n){var r=n(490),i=n(73),o=n(256),s=n(257);function a(e){var t=0;return function(n,r,i){t++||e(n,r,i)}}function u(e){return"function"==typeof e}e.exports=function(e,t){u(e)&&(t=e,e={}),t=a(t||function e(){});var n=r(e&&e.timeout||5e3),l=i(function(e){e&&t(e)}),c=s();return{handshake:{read:n.read,abort:function(e){l.end(e),n.abort(e,function(e){}),t(e)},write:l.push,rest:function(){return l.end(),{source:n.read(),sink:c.sink}}},sink:n,source:o([l,c.source])}}},function(e,t,n){"use strict";(function(t){const r=n(12),i=n(43),o=n(81),s=n(78),a=n(77),u=n(9),l=n(1245).createResolver;function c(e){let n=e,r="/";if(t.isBuffer(e)&&(n=new u(e).toBaseEncodedString()),"string"==typeof e){0===e.indexOf("/ipfs/")&&(e=n=e.substring(6));const t=e.indexOf("/");t>0&&(n=e.substring(0,t),r=e.substring(t))}else u.isCID(n)&&(n=n.toBaseEncodedString());return n=new u(n).toBaseEncodedString(),{base:n,rest:p(r)}}const f={maxDepth:1/0,offset:void 0,length:void 0,fullPath:!1};function h(e){return e.reduce((e,t)=>(e.length&&(e+="/"),e+t),"")}e.exports=((e,t,n)=>{let p;n=Object.assign({},f,n);try{p=c(e)}catch(e){return o(e)}const d=h([p.base].concat(p.rest.slice(0,p.rest.length-1))).length,m=new u(p.base);return r(i([{multihash:m.buffer,name:p.base,path:p.base,pathRest:p.rest,depth:0}]),l(t,n),s(Boolean),a(e=>({depth:e.depth,name:e.name,path:n.fullPath?e.path:g(e),size:e.size,hash:e.multihash,content:e.content,type:e.type})));function g(e){if(!p.rest.length)return e.path;let t=e.path.substring(d);return"/"===t.charAt(0)&&(t=t.substring(1)),t||(t=p.rest[p.rest.length-1]||p.base),t}});const p=(e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean)}).call(this,n(0).Buffer)},function(e,t,n){(function(t){const r=n(63),i=n(74).ec,o=new i("secp256k1"),s=n(1351),a=t.alloc(32,0),u=t.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),l=t.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex"),c=o.curve.n,f=c.shrn(1),h=o.curve.g,p="Expected Private",d="Expected Point",m="Expected Tweak",g="Expected Hash",y="Expected Signature",b="Expected Extra Data (32 bytes)";function v(e){return t.isBuffer(e)&&32===e.length}function w(e){return!!v(e)&&e.compare(u)<0}function _(e){if(!t.isBuffer(e))return!1;if(e.length<33)return!1;const n=e[0],r=e.slice(1,33);if(0===r.compare(a))return!1;if(r.compare(l)>=0)return!1;if((2===n||3===n)&&33===e.length){try{T(e)}catch(e){return!1}return!0}const i=e.slice(33);return 0!==i.compare(a)&&(!(i.compare(l)>=0)&&(4===n&&65===e.length))}function k(e){return 4!==e[0]}function S(e){return!!_(e)&&k(e)}function E(e){return!!v(e)&&(e.compare(a)>0&&e.compare(u)<0)}function x(e){const n=e.slice(0,32),r=e.slice(32,64);return t.isBuffer(e)&&64===e.length&&n.compare(u)<0&&r.compare(u)<0}function C(e,t){return void 0===e&&void 0!==t?k(t):void 0===e||e}function A(e){return new r(e)}function I(e){return e.toArrayLike(t,"be",32)}function T(e){return o.curve.decodePoint(e)}function j(e,n){return t.from(e._encode(n))}function O(e,t,n){if(!_(e))throw new TypeError(d);if(!_(t))throw new TypeError(d);const r=T(e),i=T(t),o=r.add(i);if(o.isInfinity())return null;const s=C(n,e);return j(o,s)}function P(e,t,n){if(!_(e))throw new TypeError(d);if(!w(t))throw new TypeError(m);const r=C(n,e),i=T(e);if(0===t.compare(a))return j(i,r);const o=A(t),s=h.mul(o),u=i.add(s);return u.isInfinity()?null:j(u,r)}function B(e,t){if(!_(e))throw new TypeError(d);const n=T(e);if(n.isInfinity())throw new TypeError(d);return j(n,t)}function R(e,t){if(!E(e))throw new TypeError(p);const n=A(e),r=h.mul(n);if(r.isInfinity())return null;const i=C(t);return j(r,i)}function N(e,t,n){if(!_(e))throw new TypeError(d);if(!w(t))throw new TypeError(m);const r=C(n,e),i=T(e),o=A(t),s=i.mul(o);return s.isInfinity()?null:j(s,r)}function M(e,t){if(!E(e))throw new TypeError(p);if(!w(t))throw new TypeError(m);const n=A(e),r=A(t),i=I(n.add(r).umod(c));return E(i)?i:null}function L(e,t){if(!E(e))throw new TypeError(p);if(!w(t))throw new TypeError(m);const n=A(e),r=A(t),i=I(n.sub(r).umod(c));return E(i)?i:null}function F(e,t){return U(e,t)}function D(e,t,n){return U(e,t,n)}function U(e,n,r){if(!v(e))throw new TypeError(g);if(!E(n))throw new TypeError(p);if(void 0!==r&&!v(r))throw new TypeError(b);const i=A(n),o=A(e);let a,u;const l=function(e){const t=A(e),n=h.mul(t);return!n.isInfinity()&&(a=n.x.umod(c),0!==a.isZero()&&(u=t.invm(c).mul(o.add(i.mul(a))).umod(c),0!==u.isZero()))};s(e,n,l,E,r),u.cmp(f)>0&&(u=c.sub(u));const d=t.allocUnsafe(64);return I(a).copy(d,0),I(u).copy(d,32),d}function z(e,t,n){if(!v(e))throw new TypeError(g);if(!_(t))throw new TypeError(d);if(!x(n))throw new TypeError(y);const r=T(t),i=A(n.slice(0,32)),o=A(n.slice(32,64));if(i.gtn(0)<=0)return!1;if(o.gtn(0)<=0)return!1;const s=A(e),a=o.invm(c),u=s.mul(a).umod(c),l=i.mul(a).umod(c),f=h.mulAdd(u,r,l);if(f.isInfinity())return!1;const p=f.x,m=p.umod(c);return m.eq(i)}e.exports={isPoint:_,isPointCompressed:S,isPrivate:E,pointAdd:O,pointAddScalar:P,pointCompress:B,pointFromScalar:R,pointMultiply:N,privateAdd:M,privateSub:L,sign:F,signWithEntropy:D,verify:z}}).call(this,n(0).Buffer)},function(e,t){function n(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:function(){let e=n.call(this);return this[t]=e,e},set:function(e){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}})}function r(e){let t;return function(){return void 0!==t?t:(t=e(),t)}}e.exports={prop:n,value:r}},function(e,t,n){"use strict";t.ethAccountSnapshot=n(586),t.ethBlock=n(591),t.ethBlockList=n(1416),t.ethStateTrie=n(1417),t.ethStorageTrie=n(1420),t.ethTx=n(593),t.ethTxTrie=n(1423)},function(e,t,n){(function(e){!function(e,t){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(null!==e&&"object"==typeof e&&Array.isArray(e.words))return e;this.sign=!1,this.words=null,this.length=0,this.red=null,"le"!==t&&"be"!==t||(n=t,t=10),null!==e&&this._init(e||0,t||10,n||"be")}function o(e,t,n){for(var r=0,i=Math.min(e.length,n),o=t;o=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function s(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function e(t,r,i){if("number"==typeof t)return this._initNumber(t,r,i);if("object"==typeof t)return this._initArray(t,r,i);"hex"===r&&(r=16),n(r===(0|r)&&r>=2&&r<=36),t=t.toString().replace(/\s+/g,"");var o=0;"-"===t[0]&&o++,16===r?this._parseHex(t,o):this._parseBase(t,r,o),"-"===t[0]&&(this.sign=!0),this.strip(),"le"===i&&this._initArray(this.toArray(),r,i)},i.prototype._initNumber=function e(t,r,i){t<0&&(this.sign=!0,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),r,i)},i.prototype._initArray=function e(t,r,i){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var o=0;o=0;o-=3){var u=t[o]|t[o-1]<<8|t[o-2]<<16;this.words[a]|=u<>>26-s&67108863,s+=24,s>=26&&(s-=26,a++)}else if("le"===i)for(var o=0,a=0;o>>26-s&67108863,s+=24,s>=26&&(s-=26,a++)}return this.strip()},i.prototype._parseHex=function e(t,n){this.length=Math.ceil((t.length-n)/6),this.words=new Array(this.length);for(var r=0;r=n;r-=6){var a=o(t,r,r+6);this.words[s]|=a<>>26-i&4194303,i+=24,i>=26&&(i-=26,s++)}if(r+6!==n){var a=o(t,n,r+6);this.words[s]|=a<>>26-i&4194303}this.strip()},i.prototype._parseBase=function e(t,n,r){this.words=[0],this.length=1;for(var i=0,o=1;o<=67108863;o*=n)i++;i--,o=o/n|0;for(var a=t.length-r,u=a%i,l=Math.min(a,a-u)+r,c=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function e(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function e(){return(this.red?""};var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function e(t,r){if(t=t||10,16===t||"hex"===t){for(var i="",o=0,r=0|r||1,s=0,c=0;c>>24-o&16777215,i=0!==s||c!==this.length-1?a[6-h.length]+h+i:h+i,o+=2,o>=26&&(o-=26,c--)}for(0!==s&&(i=s.toString(16)+i);i.length%r!=0;)i="0"+i;return this.sign&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var p=u[t],d=l[t],i="",m=this.clone();for(m.sign=!1;0!==m.cmpn(0);){var g=m.modn(d).toString(t);m=m.idivn(d),i=0!==m.cmpn(0)?a[p-g.length]+g+i:g+i}return 0===this.cmpn(0)&&(i="0"+i),this.sign&&(i="-"+i),i}n(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function e(){return this.toString(16)},i.prototype.toArray=function e(t){this.strip();var n=new Array(this.byteLength());n[0]=0;var r=this.clone();if("le"!==t)for(var i=0;0!==r.cmpn(0);i++){var o=r.andln(255);r.ishrn(8),n[n.length-i-1]=o}else for(var i=0;0!==r.cmpn(0);i++){var o=r.andln(255);r.ishrn(8),n[i]=o}return n},Math.clz32?i.prototype._countBits=function e(t){return 32-Math.clz32(t)}:i.prototype._countBits=function e(t){var n=t,r=0;return n>=4096&&(r+=13,n>>>=13),n>=64&&(r+=7,n>>>=7),n>=8&&(r+=4,n>>>=4),n>=2&&(r+=2,n>>>=2),r+n},i.prototype._zeroBits=function e(t){if(0===t)return 26;var n=t,r=0;return 0==(8191&n)&&(r+=13,n>>>=13),0==(127&n)&&(r+=7,n>>>=7),0==(15&n)&&(r+=4,n>>>=4),0==(3&n)&&(r+=2,n>>>=2),0==(1&n)&&r++,r},i.prototype.bitLength=function e(){var t=0,n=this.words[this.length-1],t=this._countBits(n);return 26*(this.length-1)+t},i.prototype.zeroBits=function e(){if(0===this.cmpn(0))return 0;for(var t=0,n=0;nt.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.iand=function e(t){var n;this.sign=this.sign&&t.sign,n=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.ixor=function e(t){var n,r;this.sign=this.sign||t.sign,this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.setn=function e(t,r){n("number"==typeof t&&t>=0);for(var i=t/26|0,o=t%26;this.length<=i;)this.words[this.length++]=0;return this.words[i]=r?this.words[i]|1<t.length?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>>26}for(;0!==o&&s>>26}if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function e(t){if(t.sign){t.sign=!1;var n=this.iadd(t);return t.sign=!0,n._normSign()}if(this.sign)return this.sign=!1,this.iadd(t),this.sign=!0,this._normSign();var r=this.cmp(t),i,o;if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;r>0?(i=this,o=t):(i=t,o=this);for(var s=0,a=0;a>26,this.words[a]=67108863&n}for(;0!==s&&a>26,this.words[a]=67108863&n}if(0===s&&a>>26,s=67108863&r,a=Math.min(i,t.length-1),u=Math.max(0,i-this.length+1);u<=a;u++){var l=i-u,c=0|this.words[l],f=0|t.words[u],h=c*f,p=67108863&h;o=o+(h/67108864|0)|0,p=p+s|0,s=67108863&p,o=o+(p>>>26)|0}n.words[i]=s,r=o}return 0!==r?n.words[i]=r:n.length--,n.strip()},i.prototype._bigMulTo=function e(t,n){n.sign=t.sign!==this.sign,n.length=this.length+t.length;for(var r=0,i=0,o=0;o>>26)|0,i+=s>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()},i.prototype.mulTo=function e(t,n){var r;return r=this.length+t.length<63?this._smallMulTo(t,n):this._bigMulTo(t,n),r},i.prototype.mul=function e(t){var n=new i(null);return n.words=new Array(this.length+t.length),this.mulTo(t,n)},i.prototype.imul=function e(t){if(0===this.cmpn(0)||0===t.cmpn(0))return this.words[0]=0,this.length=1,this;var n=this.length,r=t.length;this.sign=t.sign!==this.sign,this.length=this.length+t.length,this.words[this.length-1]=0;for(var i=this.length-2;i>=0;i--){for(var o=0,s=0,a=Math.min(i,r-1),u=Math.max(0,i-n+1);u<=a;u++){var l=i-u,c=this.words[l],f=t.words[u],h=c*f,p=67108863&h;o+=h/67108864|0,p+=s,s=67108863&p,o+=p>>>26}this.words[i]=s,this.words[i+1]+=o,o=0}for(var o=0,l=1;l>>26}return this.strip()},i.prototype.imuln=function e(t){n("number"==typeof t);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),this},i.prototype.muln=function e(t){return this.clone().imuln(t)},i.prototype.sqr=function e(){return this.mul(this)},i.prototype.isqr=function e(){return this.mul(this)},i.prototype.ishln=function e(t){n("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){for(var s=0,a=0;a>>26-r}s&&(this.words[a]=s,this.length++)}if(0!==i){for(var a=this.length-1;a>=0;a--)this.words[a+i]=this.words[a];for(var a=0;a=0),o=r?(r-r%26)/26:0;var s=t%26,a=Math.min((t-s)/26,this.length),u=67108863^67108863>>>s<a){this.length-=a;for(var c=0;c=0&&(0!==f||c>=o);c--){var h=this.words[c];this.words[c]=f<<26-s|h>>>s,f=h&u}return l&&0!==f&&(l.words[l.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function e(t){return this.clone().ishln(t)},i.prototype.shrn=function e(t){return this.clone().ishrn(t)},i.prototype.testn=function e(t){n("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,o=1<=0);var r=t%26,i=(t-r)/26;if(n(!this.sign,"imaskn works only with positive numbers"),0!==r&&i++,this.length=Math.min(i,this.length),0!==r){var o=67108863^67108863>>>r<=67108864;n++)this.words[n]-=67108864,n===this.length-1?this.words[n+1]=1:this.words[n+1]++;return this.length=Math.max(this.length,n+1),this},i.prototype.isubn=function e(t){if(n("number"==typeof t),t<0)return this.iaddn(-t);if(this.sign)return this.sign=!1,this.iaddn(t),this.sign=!0,this;this.words[0]-=t;for(var r=0;r>26)-(c/67108864|0),this.words[s+i]=67108863&l}for(;s>26,this.words[s+i]=67108863&l}if(0===u)return this.strip();n(-1===u),u=0;for(var s=0;s>26,this.words[s]=67108863&l}return this.sign=!0,this.strip()},i.prototype._wordDiv=function e(t,n){var r=this.length-t.length,o=this.clone(),s=t,a=s.words[s.length-1],u=this._countBits(a);r=26-u,0!==r&&(s=s.shln(r),o.ishln(r),a=s.words[s.length-1]);var l=o.length-s.length,c;if("mod"!==n){c=new i(null),c.length=l+1,c.words=new Array(c.length);for(var f=0;f=0;p--){var d=67108864*o.words[s.length+p]+o.words[s.length+p-1];for(d=Math.min(d/a|0,67108863),o._ishlnsubmul(s,d,p);o.sign;)d--,o.sign=!1,o._ishlnsubmul(s,1,p),0!==o.cmpn(0)&&(o.sign=!o.sign);c&&(c.words[p]=d)}return c&&c.strip(),o.strip(),"div"!==n&&0!==r&&o.ishrn(r),{div:c||null,mod:o}},i.prototype.divmod=function e(t,r){if(n(0!==t.cmpn(0)),this.sign&&!t.sign){var o=this.neg().divmod(t,r),s,a;return"mod"!==r&&(s=o.div.neg()),"div"!==r&&(a=0===o.mod.cmpn(0)?o.mod:t.sub(o.mod)),{div:s,mod:a}}if(!this.sign&&t.sign){var o=this.divmod(t.neg(),r),s;return"mod"!==r&&(s=o.div.neg()),{div:s,mod:o.mod}}return this.sign&&t.sign?this.neg().divmod(t.neg(),r):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===r?{div:this.divn(t.words[0]),mod:null}:"mod"===r?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,r)},i.prototype.div=function e(t){return this.divmod(t,"div").div},i.prototype.mod=function e(t){return this.divmod(t,"mod").mod},i.prototype.divRound=function e(t){var n=this.divmod(t);if(0===n.mod.cmpn(0))return n.div;var r=n.div.sign?n.mod.isub(t):n.mod,i=t.shrn(1),o=t.andln(1),s=r.cmp(i);return s<0||1===o&&0===s?n.div:n.div.sign?n.div.isubn(1):n.div.iaddn(1)},i.prototype.modn=function e(t){n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+this.words[o])%t;return i},i.prototype.idivn=function e(t){n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=this.words[i]+67108864*r;this.words[i]=o/t|0,r=o%t}return this.strip()},i.prototype.divn=function e(t){return this.clone().idivn(t)},i.prototype.egcd=function e(t){n(!t.sign),n(0!==t.cmpn(0));var r=this,o=t.clone();r=r.sign?r.mod(t):r.clone();for(var s=new i(1),a=new i(0),u=new i(0),l=new i(1),c=0;r.isEven()&&o.isEven();)r.ishrn(1),o.ishrn(1),++c;for(var f=o.clone(),h=r.clone();0!==r.cmpn(0);){for(;r.isEven();)r.ishrn(1),s.isEven()&&a.isEven()?(s.ishrn(1),a.ishrn(1)):(s.iadd(f).ishrn(1),a.isub(h).ishrn(1));for(;o.isEven();)o.ishrn(1),u.isEven()&&l.isEven()?(u.ishrn(1),l.ishrn(1)):(u.iadd(f).ishrn(1),l.isub(h).ishrn(1));r.cmp(o)>=0?(r.isub(o),s.isub(u),a.isub(l)):(o.isub(r),u.isub(s),l.isub(a))}return{a:u,b:l,gcd:o.ishln(c)}},i.prototype._invmp=function e(t){n(!t.sign),n(0!==t.cmpn(0));var r=this,o=t.clone();r=r.sign?r.mod(t):r.clone();for(var s=new i(1),a=new i(0),u=o.clone();r.cmpn(1)>0&&o.cmpn(1)>0;){for(;r.isEven();)r.ishrn(1),s.isEven()?s.ishrn(1):s.iadd(u).ishrn(1);for(;o.isEven();)o.ishrn(1),a.isEven()?a.ishrn(1):a.iadd(u).ishrn(1);r.cmp(o)>=0?(r.isub(o),s.isub(a)):(o.isub(r),a.isub(s))}return 0===r.cmpn(1)?s:a},i.prototype.gcd=function e(t){if(0===this.cmpn(0))return t.clone();if(0===t.cmpn(0))return this.clone();var n=this.clone(),r=t.clone();n.sign=!1,r.sign=!1;for(var i=0;n.isEven()&&r.isEven();i++)n.ishrn(1),r.ishrn(1);for(;;){for(;n.isEven();)n.ishrn(1);for(;r.isEven();)r.ishrn(1);var o=n.cmp(r);if(o<0){var s=n;n=r,r=s}else if(0===o||0===r.cmpn(1))break;n.isub(r)}return r.ishln(i)},i.prototype.invm=function e(t){return this.egcd(t).a.mod(t)},i.prototype.isEven=function e(){return 0==(1&this.words[0])},i.prototype.isOdd=function e(){return 1==(1&this.words[0])},i.prototype.andln=function e(t){return this.words[0]&t},i.prototype.bincn=function e(t){n("number"==typeof t);var r=t%26,i=(t-r)/26,o=1<>>26,u&=67108863,this.words[s]=u}return 0!==a&&(this.words[s]=a,this.length++),this},i.prototype.cmpn=function e(t){var n=t<0,r;if(n&&(t=-t),this.sign&&!n)return-1;if(!this.sign&&n)return 1;if(t&=67108863,this.strip(),this.length>1)r=1;else{var i=this.words[0];r=i===t?0:it.length)return 1;if(this.length=0;r--){var i=this.words[r],o=t.words[r];if(i!==o){io&&(n=1);break}}return n},i.red=function e(t){return new g(t)},i.prototype.toRed=function e(t){return n(!this.red,"Already a number in reduction context"),n(!this.sign,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function e(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function e(t){return this.red=t,this},i.prototype.forceRed=function e(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function e(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function e(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function e(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function e(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function e(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function e(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function e(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function e(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function e(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function e(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function e(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function e(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function e(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var c={k256:null,p224:null,p192:null,p25519:null};function f(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function h(){f.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function p(){f.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function d(){f.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){f.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function g(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else this.m=e,this.prime=null}function y(e){g.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}f.prototype._tmp=function e(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},f.prototype.ireduce=function e(t){var n=t,r;do{this.split(n,this.tmp),n=this.imulK(n),n=n.iadd(this.tmp),r=n.bitLength()}while(r>this.n);var i=r0?n.isub(this.p):n.strip(),n},f.prototype.split=function e(t,n){t.ishrn(this.n,0,n)},f.prototype.imulK=function e(t){return t.imul(this.k)},r(h,f),h.prototype.split=function e(t,n){for(var r=4194303,i=Math.min(t.length,9),o=0;o>>22,s=a}t.words[o-10]=s>>>22,t.length-=9},h.prototype.imulK=function e(t){var n;t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var r=0,i=0;i>>=26,t.words[r]=o,n=i}return 0!==n&&(t.words[t.length++]=n),t},i._prime=function e(t){if(c[t])return c[t];var e;if("k256"===t)e=new h;else if("p224"===t)e=new p;else if("p192"===t)e=new d;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new m}return c[t]=e,e},g.prototype._verify1=function e(t){n(!t.sign,"red works only with positives"),n(t.red,"red works only with red numbers")},g.prototype._verify2=function e(t,r){n(!t.sign&&!r.sign,"red works only with positives"),n(t.red&&t.red===r.red,"red works only with red numbers")},g.prototype.imod=function e(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.mod(this.m)._forceRed(this)},g.prototype.neg=function e(t){var n=t.clone();return n.sign=!n.sign,n.iadd(this.m)._forceRed(this)},g.prototype.add=function e(t,n){this._verify2(t,n);var r=t.add(n);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},g.prototype.iadd=function e(t,n){this._verify2(t,n);var r=t.iadd(n);return r.cmp(this.m)>=0&&r.isub(this.m),r},g.prototype.sub=function e(t,n){this._verify2(t,n);var r=t.sub(n);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},g.prototype.isub=function e(t,n){this._verify2(t,n);var r=t.isub(n);return r.cmpn(0)<0&&r.iadd(this.m),r},g.prototype.shl=function e(t,n){return this._verify1(t),this.imod(t.shln(n))},g.prototype.imul=function e(t,n){return this._verify2(t,n),this.imod(t.imul(n))},g.prototype.mul=function e(t,n){return this._verify2(t,n),this.imod(t.mul(n))},g.prototype.isqr=function e(t){return this.imul(t,t)},g.prototype.sqr=function e(t){return this.mul(t,t)},g.prototype.sqrt=function e(t){if(0===t.cmpn(0))return t.clone();var r=this.m.andln(3);if(n(r%2==1),3===r){var o=this.m.add(new i(1)).ishrn(2),s=this.pow(t,o);return s}for(var a=this.m.subn(1),u=0;0!==a.cmpn(0)&&0===a.andln(1);)u++,a.ishrn(1);n(0!==a.cmpn(0));var l=new i(1).toRed(this),c=l.redNeg(),f=this.m.subn(1).ishrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,f).cmp(c);)h.redIAdd(c);for(var p=this.pow(h,a),s=this.pow(t,a.addn(1).ishrn(1)),d=this.pow(t,a),m=u;0!==d.cmp(l);){for(var g=d,y=0;0!==g.cmp(l);y++)g=g.redSqr();n(y=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},y.prototype.mul=function e(t,n){if(0===t.cmpn(0)||0===n.cmpn(0))return new i(0)._forceRed(this);var r=t.mul(n),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(o).ishrn(this.shift),a=s;return s.cmp(this.m)>=0?a=s.isub(this.m):s.cmpn(0)<0&&(a=s.iadd(this.m)),a._forceRed(this)},y.prototype.invm=function e(t){var n=this.imod(t._invmp(this.m).mul(this.r2));return n._forceRed(this)}}(e,this)}).call(this,n(75)(e))},function(e,t,n){"use strict";var r=n(17),i=n(30),o=n(41),s=[],a={};function u(){}function l(e,t){if(~s.indexOf(e))return e;if(!t)return a[e];r.isArray(t)||(t=[t]);var n=function(t){return s[i][t]===e};for(var i in s)if(r.any(t,n))return s[i]}function c(e){var t=new u;return o.defineImmutable(t,{name:e.name,alias:e.alias,pubkeyhash:e.pubkeyhash,privatekey:e.privatekey,scripthash:e.scripthash,xpubkey:e.xpubkey,xprivkey:e.xprivkey,zaddr:e.zaddr,zkey:e.zkey}),e.networkMagic&&o.defineImmutable(t,{networkMagic:i.integerAsBuffer(e.networkMagic)}),e.port&&o.defineImmutable(t,{port:e.port}),e.dnsSeeds&&o.defineImmutable(t,{dnsSeeds:e.dnsSeeds}),r.each(t,function(e){r.isUndefined(e)||r.isObject(e)||(a[e]=t)}),s.push(t),t}function f(e){for(var t=0;t"},e.exports=f;var h=n(86)}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var r=n(1497),i=n(1498);e.exports=function e(n,o,s){if("number"!=typeof n)throw new TypeError('"size" argument must be a number');if(n<0)throw new RangeError('"size" argument must not be negative');if(t.alloc)return t.alloc(n,o,s);var a=i(n);return 0===n?a:void 0===o?r(a,0):("string"!=typeof s&&(s=void 0),r(a,o,s))}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";function r(e){return function(){if(null===e)throw new Error("Callback was already called.");var t=e;e=null,t.apply(this,arguments)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,n){var r=n(174),i=n(750),o=n(751),s="[object Null]",a="[object Undefined]",u=r?r.toStringTag:void 0;function l(e){return null==e?void 0===e?a:s:u&&u in Object(e)?i(e):o(e)}e.exports=l},function(e,t,n){var r=n(754),i=n(761),o=n(172);function s(e){return o(e)?r(e):i(e)}e.exports=s},function(e,t,n){const r=n(32),i=n(20),o=n(98);function s(e,t){return new Promise(n=>{setTimeout(()=>{n(t)},e)})}class a{constructor(e){}static setup0(e){throw new o.IntentionallyUnimplementedError("Intentionally undefined function Transport.setup0 should have been subclassed")}p_setup1(e){return this}p_setup2(e){return this}static async p_setup(e,t){let n=await this.setup0(e).p_setup1(t);return n.p_setup2(t)}stop(e,t){this.status=a.STATUS_FAILED,e&&e(this),t(null,this)}togglePaused(e){switch(this.status){case a.STATUS_CONNECTED:this.status=a.STATUS_PAUSED;break;case a.STATUS_PAUSED:this.status=a.STATUS_CONNECTED;break;case a.STATUS_LOADED:this.p_setup1(e).then(t=>t.p_setup2(e))}e&&e(this)}async p_status(){return this.status}connected(){return!this.status}supports(e,t,{noCache:n}={}){if("string"==typeof e&&(e=r.parse(e)),e&&!e.protocol)throw new Error("URL failed to specific a scheme (before :) "+e.href);return(!e||this.supportURLs.includes(e.protocol.slice(0,-1)))&&(!t||this.supportFunctions.includes(t))&&(!n||this.supportFeatures.includes("noCache"))}validFor(e,t,n){return this.connected()&&this.supports(e,t,n)}p_rawstore(e,t){throw new o.ToBeImplementedError("Intentionally undefined function Transport.p_rawstore should have been subclassed")}async p_rawstoreCaught(e){try{return await this.p_rawstore(e)}catch(e){}}p_store(){throw new o.ToBeImplementedError("Undefined function Transport.p_store - may define higher level semantics here (see Python)")}p_rawfetch(e,{timeoutMS:t,start:n,end:r,relay:i=!1}={}){return console.assert(!1,"Intentionally undefined function Transport.p_rawfetch should have been subclassed"),"UNIMPLEMENTED"}p_fetch(){throw new o.ToBeImplementedError("Undefined function Transport.p_fetch - may define higher level semantics here (see Python)")}p_rawadd(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_rawadd")}p_rawlist(e){throw new o.ToBeImplementedError("Undefined function Transport.p_rawlist")}p_list(){throw new Error("Undefined function Transport.p_list")}p_newlisturls(e){throw new Error("undefined function Transport.p_newlisturls")}p_rawreverse(e){throw new o.ToBeImplementedError("Undefined function Transport.p_rawreverse")}listmonitor(e,t,{current:n=!1}={}){console.log("Undefined function Transport.listmonitor")}async p_newdatabase(e){throw new o.ToBeImplementedError("Undefined function Transport.p_newdatabase")}async p_newtable(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_newtable")}async p_set(e,t,n){throw new o.ToBeImplementedError("Undefined function Transport.p_set")}async p_get(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_get")}async p_delete(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_delete")}async p_keys(e){throw new o.ToBeImplementedError("Undefined function Transport.p_keys")}async p_getall(e){throw new o.ToBeImplementedError("Undefined function Transport.p_keys")}static async p_f_createReadStream(e,{wanturl:t=!1}){}static mergeoptions(e){let t={};for(let n=0;n",r),console.assert("bar"===r.testkey2.foo&&2===r.testkey3[1]&&!r.testkey),await s(200),console.log(this.name,"p_test_kvt complete")}catch(e){throw console.log("Exception thrown in ",this.name,"p_test_kvt:",e.message),e}}}a.STATUS_CONNECTED=0,a.STATUS_FAILED=1,a.STATUS_STARTING=2,a.STATUS_LOADED=3,a.STATUS_PAUSED=4,a.STATUSTEXT=["Connected","Failed","Starting","Loaded","Paused"],t=e.exports=a},function(e,t,n){"use strict";function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var i={};function o(e,t,n){function o(e,n,r){return"string"==typeof t?t:t(e,n,r)}n||(n=Error);var s=function(e){function t(t,n,r){return e.call(this,o(t,n,r))||this}return r(t,e),t}(n);s.prototype.name=n.name,s.prototype.code=e,i[e]=s}function s(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return String(e)}),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}function a(e,t,n){return e.substr(!n||n<0?0:+n,t.length)===t}function u(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}function l(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}o("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),o("ERR_INVALID_ARG_TYPE",function(e,t,n){var r,i;if("string"==typeof t&&a(t,"not ")?(r="must not be",t=t.replace(/^not /,"")):r="must be",u(e," argument"))i="The ".concat(e," ").concat(r," ").concat(s(t,"type"));else{var o=l(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(o," ").concat(r," ").concat(s(t,"type"))}return i+=". Received type ".concat(typeof n),i},TypeError),o("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),o("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),o("ERR_STREAM_PREMATURE_CLOSE","Premature close"),o("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),o("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),o("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),o("ERR_STREAM_WRITE_AFTER_END","write after end"),o("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),o("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),o("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=i},function(e,t,n){"use strict";(function(t){var r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=l;var i=n(396),o=n(400);n(1)(l,i);for(var s=r(o.prototype),a=0;at){var r=new Error("Too few bytes to parse DER.");throw r.available=e.length(),r.remaining=t,r.requested=n,r}}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},i.create=function(e,t,n,o,s){if(r.util.isArray(o)){for(var a=[],u=0;ut){if(r.strict){var m=new Error("Too few bytes to read ASN.1 value.");throw m.available=e.length(),m.remaining=t,m.requested=h,m}h=t}var g=32==(32&l);if(g)if(p=[],void 0===h)for(;;){if(o(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}u=e.length(),p.push(a(e,t,n+1,r)),t-=u-e.length()}else for(;h>0;)u=e.length(),p.push(a(e,h,n+1,r)),t-=u-e.length(),h-=u-e.length();if(void 0===p&&c===i.Class.UNIVERSAL&&f===i.Type.BITSTRING&&(d=e.bytes(h)),void 0===p&&r.decodeBitStrings&&c===i.Class.UNIVERSAL&&f===i.Type.BITSTRING&&h>1){var y=e.read,b=t,v=0;if(f===i.Type.BITSTRING&&(o(e,t,1),v=e.getByte(),t--),0===v)try{u=e.length();var w={verbose:r.verbose,strict:!0,decodeBitStrings:!0},_=a(e,t,n+1,w),k=u-e.length();t-=k,f==i.Type.BITSTRING&&k++;var S=_.tagClass;k!==h||S!==i.Class.UNIVERSAL&&S!==i.Class.CONTEXT_SPECIFIC||(p=[_])}catch(e){}void 0===p&&(e.read=y,t=b)}if(void 0===p){if(void 0===h){if(r.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");h=t}if(f===i.Type.BMPSTRING)for(p="";h>0;h-=2)o(e,t,2),p+=String.fromCharCode(e.getInt16()),t-=2;else p=e.getBytes(h)}var E=void 0===d?null:{bitStringContents:d};return i.create(c,f,g,p,E)}i.fromDer=function(e,t){return void 0===t&&(t={strict:!0,decodeBitStrings:!0}),"boolean"==typeof t&&(t={strict:t,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"==typeof e&&(e=r.util.createBuffer(e)),a(e,e.length(),0,t)},i.toDer=function(e){var t=r.util.createBuffer(),n=e.tagClass|e.type,o=r.util.createBuffer(),s=!1;if("bitStringContents"in e&&(s=!0,e.original&&(s=i.equals(e,e.original))),s)o.putBytes(e.bitStringContents);else if(e.composed){e.constructed?n|=32:o.putByte(0);for(var a=0;a1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?o.putBytes(e.value.substr(1)):o.putBytes(e.value);if(t.putByte(n),o.length()<=127)t.putByte(127&o.length());else{var u=o.length(),l="";do{l+=String.fromCharCode(255&u),u>>>=8}while(u>0);t.putByte(128|l.length);for(var a=l.length-1;a>=0;--a)t.putByte(l.charCodeAt(a))}return t.putBuffer(o),t},i.oidToDer=function(e){var t=e.split("."),n=r.util.createBuffer(),i,o,s,a;n.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var u=2;u>>=7,i||(a|=128),o.push(a),i=!1}while(s>0);for(var l=o.length-1;l>=0;--l)n.putByte(o[l])}return n},i.derToOid=function(e){var t;"string"==typeof e&&(e=r.util.createBuffer(e));var n=e.getByte();t=Math.floor(n/40)+"."+n%40;for(var i=0;e.length()>0;)n=e.getByte(),i<<=7,128&n?i+=127&n:(t+="."+(i+n),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,n=parseInt(e.substr(0,2),10);n=n>=50?1900+n:2e3+n;var r=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),o=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),a=0;if(e.length>11){var u=e.charAt(10),l=10;"+"!==u&&"-"!==u&&(a=parseInt(e.substr(10,2),10),l+=2)}if(t.setUTCFullYear(n,r,i),t.setUTCHours(o,s,a,0),l&&(u=e.charAt(l),"+"===u||"-"===u)){var c=parseInt(e.substr(l+1,2),10),f=parseInt(e.substr(l+4,2),10),h=60*c+f;h*=6e4,"+"===u?t.setTime(+t-h):t.setTime(+t+h)}return t},i.generalizedTimeToDate=function(e){var t=new Date,n=parseInt(e.substr(0,4),10),r=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),u=0,l=0,c=!1;"Z"===e.charAt(e.length-1)&&(c=!0);var f=e.length-5,h=e.charAt(f);if("+"===h||"-"===h){var p=parseInt(e.substr(f+1,2),10),d=parseInt(e.substr(f+4,2),10);l=60*p+d,l*=6e4,"+"===h&&(l*=-1),c=!0}return"."===e.charAt(14)&&(u=1e3*parseFloat(e.substr(14),10)),c?(t.setUTCFullYear(n,r,i),t.setUTCHours(o,s,a,u),t.setTime(+t+l)):(t.setFullYear(n,r,i),t.setHours(o,s,a,u)),t},i.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",n=[];n.push((""+e.getUTCFullYear()).substr(2)),n.push(""+(e.getUTCMonth()+1)),n.push(""+e.getUTCDate()),n.push(""+e.getUTCHours()),n.push(""+e.getUTCMinutes()),n.push(""+e.getUTCSeconds());for(var r=0;r=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var n=new Error("Integer too large; max is 32-bits.");throw n.integer=e,n},i.derToInteger=function(e){"string"==typeof e&&(e=r.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},i.validate=function(e,t,n,o){var s=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)o&&(e.tagClass!==t.tagClass&&o.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&o.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(s=!0,t.value&&r.util.isArray(t.value))for(var a=0,u=0;s&&u0&&(o+="\n");for(var s="",a=0;a1?o+="0x"+r.util.bytesToHex(e.value.slice(1)):o+="(none)",e.value.length>0){var h=e.value.charCodeAt(0);1==h?o+=" (1 unused bit shown)":h>1&&(o+=" ("+h+" unused bits shown)")}}else e.type===i.Type.OCTETSTRING?(u.test(e.value)||(o+="("+e.value+") "),o+="0x"+r.util.bytesToHex(e.value)):e.type===i.Type.UTF8?o+=r.util.decodeUtf8(e.value):e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?o+=e.value:u.test(e.value)?o+="0x"+r.util.bytesToHex(e.value):0===e.value.length?o+="[null]":o+=e.value}return o}},function(e,t,n){var r=n(19);n(237),n(893),n(894),n(34),r.random&&r.random.getBytes?e.exports=r.random:function(t){var n={},i=new Array(4),o=r.util.createBuffer();function s(){var e=r.prng.create(n);return e.getBytes=function(t,n){return e.generate(t,n)},e.getBytesSync=function(t){return e.generate(t)},e}n.formatKey=function(e){var t=r.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),r.aes._expandKey(e,!1)},n.formatSeed=function(e){var t=r.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},n.cipher=function(e,t){return r.aes._updateBlock(e,t,i,!1),o.putInt32(i[0]),o.putInt32(i[1]),o.putInt32(i[2]),o.putInt32(i[3]),o.getBytes()},n.increment=function(e){return++e[3],e},n.md=r.md.sha256;var a=s(),u=null;if("undefined"!=typeof window){var l=window.crypto||window.msCrypto;l&&l.getRandomValues&&(u=function(e){return l.getRandomValues(e)})}if(r.options.usePureJavaScript||!r.util.isNodejs&&!u){if("undefined"==typeof window||window.document,a.collectInt(+new Date,32),"undefined"!=typeof navigator){var c="";for(var f in navigator)try{"string"==typeof navigator[f]&&(c+=navigator[f])}catch(e){}a.collect(c),c=null}t&&(t().mousemove(function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)}),t().keypress(function(e){a.collectInt(e.charCode,8)}))}if(r.random)for(var f in a)r.random[f]=a[f];else r.random=a;r.random.createInstance=s,e.exports=r.random}("undefined"!=typeof jQuery?jQuery:null)},function(e,t,n){"use strict";const r=t;r.bignum=n(63),r.define=n(904).define,r.base=n(180),r.constants=n(463),r.decoders=n(908),r.encoders=n(910)},function(e,t,n){"use strict";var r=n(1),i=n(318),o=n(469),s=n(470),a=n(119);function u(e){a.call(this,"digest"),this._hash=e}r(u,a),u.prototype._update=function(e){this._hash.update(e)},u.prototype._final=function(){return this._hash.digest()},e.exports=function e(t){return t=t.toLowerCase(),"md5"===t?new i:"rmd160"===t||"ripemd160"===t?new o:new u(s(t))}},function(e,t,n){var r=n(4).Buffer;function i(e,t){this._block=r.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}i.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=r.from(e,t));for(var n=this._block,i=this._blockSize,o=e.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(491),i=a(r),o=n(220),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default,1),e.exports=t.default},function(e,t,n){function r(e){if(e)return i(e)}function i(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},r.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+e],r;if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i1?{type:p[i],data:e.substring(1)}:{type:p[i]}:d}var s=new Uint8Array(e),i=s[0],a=o(e,1);return m&&"blob"===n&&(a=new m([a])),{type:p[i],data:a}},t.decodeBase64Packet=function(e,t){var n=p[e.charAt(0)];if(!u)return{type:n,data:{base64:!0,data:e.substr(1)}};var r=u.decode(e.substr(1));return"blob"===t&&m&&(r=new m([r])),{type:n,data:r}},t.encodePayload=function(e,n,r){"function"==typeof n&&(r=n,n=null);var o=i(e);if(n&&o)return m&&!f?t.encodePayloadAsBlob(e,r):t.encodePayloadAsArrayBuffer(e,r);if(!e.length)return r("0:");function s(e){return e.length+":"+e}function a(e,r){t.encodePacket(e,!!o&&n,!1,function(e){r(null,s(e))})}_(e,a,function(e,t){return r(t.join(""))})},t.decodePayload=function(e,n,r){if("string"!=typeof e)return t.decodePayloadAsBinary(e,n,r);var i;if("function"==typeof n&&(r=n,n=null),""===e)return r(d,0,1);for(var o="",s,a,u=0,l=e.length;u0;){for(var a=new Uint8Array(i),u=0===a[0],l="",c=1;255!==a[c];c++){if(l.length>310)return r(d,0,1);l+=a[c]}i=o(i,2+l.length),l=parseInt(l);var f=o(i,0,l);if(u)try{f=String.fromCharCode.apply(null,new Uint8Array(f))}catch(e){var h=new Uint8Array(f);f="";for(var c=0;co)throw new RangeError("requested too many random bytes");var n=a.allocUnsafe(e);if(e>0)if(e>i)for(var s=0;s{const n=r(e,t);return(e,t,r)=>{n(e,t,(e,t)=>{if(e)return r(e);r(null,t[0])})}})},function(e,t,n){"use strict";var r=n(10),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=f;var o=n(7);o.inherits=n(1);var s=n(657),a=n(660);o.inherits(f,s);for(var u=i(a.prototype),l=0;l=t)throw new Error("Cannot access property/index "+r+" levels up, current level is "+t);return n[t-r]}if(r>t)throw new Error("Cannot access data "+r+" levels up, current level is "+t);if(o="data"+(t-r||""),!i)return o}for(var a=o,u=i.split("/"),l=0;l=0||1/0===e||-1/0===e)}},t.text={is:function(e){return"string"==typeof e}},t.text.ify=function(e){return t.text.is(e)?e:"undefined"!=typeof JSON?JSON.stringify(e):e&&e.toString?e.toString():e},t.text.random=function(e,t){var n="";for(e=e||24,t=t||"0123456789ABCDEFGHIJKLMNOPQRSTUVWXZabcdefghijklmnopqrstuvwxyz";e>0;)n+=t.charAt(Math.floor(Math.random()*t.length)),e--;return n},t.text.match=function(e,t){var n,r;return"string"==typeof e&&("string"==typeof t&&(t={"=":t}),t=t||{},n=t["="]||t["*"]||t[">"]||t["<"],e===n||r===t["="]&&(n=t["*"]||t[">"]||t["<"],e.slice(0,(n||"").length)===n||r===t["*"]&&(r!==t[">"]&&r!==t["<"]?e>=t[">"]&&e<=t["<"]:r!==t[">"]&&e>=t[">"]||r!==t["<"]&&e<=t["<"])))},t.list={is:function(e){return e instanceof Array}},t.list.slit=Array.prototype.slice,t.list.sort=function(e){return function(t,n){return t&&n?(t=t[e],n=n[e],tn?1:0):0}},t.list.map=function(e,t,n){return a(e,t,n)},t.list.index=1,t.obj={is:function(e){return!!e&&(e instanceof Object&&e.constructor===Object||"Object"===Object.prototype.toString.call(e).match(/^\[object (\w+)\]$/)[1])}},t.obj.put=function(e,t,n){return(e||{})[t]=n,e},t.obj.has=function(e,t){return e&&Object.prototype.hasOwnProperty.call(e,t)},t.obj.del=function(e,t){if(e)return e[t]=null,delete e[t],e},t.obj.as=function(e,t,n,r){return e[t]=e[t]||(r===n?{}:n)},t.obj.ify=function(e){if(o(e))return e;try{e=JSON.parse(e)}catch(t){e={}}return e},function(){var e;function n(t,n){s(this,n)&&e!==this[n]||(this[n]=t)}t.obj.to=function(e,t){return t=t||{},a(e,n,t),t}}(),t.obj.copy=function(e){return e?JSON.parse(JSON.stringify(e)):e},function(){function e(e,t){var n=this.n;if(!n||!(t===n||o(n)&&s(n,t)))return!!t||void 0}t.obj.empty=function(t,n){return!t||!a(t,e,{n:n})}}(),function(){function e(t,n){if(2===arguments.length)return e.r=e.r||{},void(e.r[t]=n);e.r=e.r||[],e.r.push(t)}var i=Object.keys;t.obj.map=function(a,u,l){var c,f=0,h,p,d,m,g=n(u);if(e.r=null,i&&o(a)&&(d=i(a),m=!0),r(a)||d)for(h=(d||a).length;f",r.drift=0,r.is=function(e,t,n){var i=t&&e&&e[_]&&e[_][r._]||n;if(i)return b(i=i[t])?i:-1/0},r.lex=function(){return r().toString(36).replace(".","")},r.ify=function(e,t,i,o,s){if(!e||!e[_]){if(!s)return;e=n.soul.ify(e,s)}var a=h(e[_],r._);return k!==t&&t!==_&&(b(i)&&(a[t]=i),k!==o&&(e[t]=o)),e},r.to=function(e,t,i){var o=(e||{})[t];return d(o)&&(o=g(o)),r.ify(i,t,r.is(e,t),o,n.soul(e))},function(){function e(e,t){_!==t&&r.ify(this.o,t,this.s)}r.map=function(t,n,i){var o,s=d(s=t||n)?s:null;return t=w(t=t||n)?t:null,s&&!t?(n=b(n)?n:r(),s[_]=s[_]||{},m(s,e,{o:s,s:n}),s):(i=i||d(n)?n:o,n=b(n)?n:r(),function(r,s,a,u){if(!t)return e.call({o:a,s:n},r,s),r;t.call(i||this||{},r,s,a,u),p(a,s)&&o===a[s]||e.call({o:a,s:n},r,s)})}}();var f=t.obj,h=f.as,p=f.has,d=f.is,m=f.map,g=f.copy,y=t.num,b=y.is,v=t.fn,w=v.is,_=n._,k;e.exports=r})(o,"./state"),o(function(e){var t=o("./type"),n=o("./val"),r=o("./node"),i={};!function(){function e(e,n){if(!e||n!==r.soul(e)||!r.is(e,this.fn,this.as))return!0;this.cb&&(t.n=e,t.as=this.as,this.cb.call(t.as,e,n,t))}function t(e){e&&r.is(t.n,e,t.as)}i.is=function(t,n,r,i){return!(!t||!u(t)||f(t))&&!p(t,e,{cb:n,fn:r,as:i})}}(),function(){function e(e,t){var i;return(i=f(e,t))?i:(t.env=e,t.soul=s,r.ify(t.obj,o,t)&&(t.link=t.link||n.link.ify(r.soul(t.node)),t.obj!==e.shell&&(e.graph[n.link.is(t.link)]=t.node)),t)}function o(t,i,o){var s=this,u=s.env,f,h;if(r._===i&&c(t,n.link._))return o._;if(f=a(t,i,o,s,u)){if(i||(s.node=s.node||o||{},c(t,r._)&&r.soul(t)&&(s.node._=d(t._)),s.node=r.soul.ify(s.node,n.link.is(s.link)),s.link=s.link||n.link.ify(r.soul(s.node))),(h=u.map)&&(h.call(u.as||{},t,i,o,s),c(o,i))){if(t=o[i],m===t)return void l(o,i);if(!(f=a(t,i,o,s,u)))return}if(!i)return s.node;if(!0===f)return t;if(h=e(u,{obj:t,path:s.path.concat(i)}),h.node)return h.link}}function s(e){var t=this,i=n.link.is(t.link),o=t.env.graph;t.link=t.link||n.link.ify(e),t.link[n.link._]=e,t.node&&t.node[r._]&&(t.node[r._][n.link._]=e),c(o,i)&&(o[e]=o[i],l(o,i))}function a(e,r,i,o,s){var l;return!!n.is(e)||(u(e)?1:(l=s.invalid)?(e=l.call(s.as||{},e,r,i),a(e,r,i,o,s)):(s.err="Invalid value at '"+o.path.concat(r).join(".")+"'!",void(t.list.is(e)&&(s.err+=" Use `.set(item)` instead of an Array."))))}function f(e,t){for(var n=e.seen,r=n.length,i;r--;)if(i=n[r],t.obj===i.obj)return i;n.push(t)}i.ify=function(t,r,i){var o={path:[],obj:t};return r?"string"==typeof r?r={soul:r}:r instanceof Function&&(r.map=r):r={},r.soul&&(o.link=n.link.ify(r.soul)),r.shell=(i||{}).shell,r.graph=r.graph||{},r.seen=r.seen||[],r.as=r.as||i,e(r,o),r.root=o.node,r.graph}}(),i.node=function(e){var t=r.soul(e);if(t)return h({},t,e)},function(){function e(e,t){var o,s;if(r._!==t)(o=n.link.is(e))?(s=this.opt.seen[o])?this.obj[t]=s:this.obj[t]=this.opt.seen[o]=i.to(this.graph,o,this.opt):this.obj[t]=e;else{if(f(e,n.link._))return;this.obj[t]=d(e)}}i.to=function(t,n,r){if(t){var i={};return r=r||{seen:{}},p(t[n],e,{obj:i,graph:t,opt:r}),i}}}();var s=t.fn.is,a=t.obj,u=a.is,l=a.del,c=a.has,f=a.empty,h=a.put,p=a.map,d=a.copy,m;e.exports=i})(o,"./graph"),o(function(e){o("./onto"),e.exports=function e(t,n){if(this.on){if(!(t instanceof Function)){if(!t||!n)return;var r=t["#"]||t,i=(this.tag||empty)[r];if(!i)return;return i=this.on(r,n),clearTimeout(i.err),!0}var r=n&&n["#"]||Math.random().toString(36).slice(2);if(!t)return r;var o=this.on(r,t,n);return o.err=o.err||setTimeout(function(){o.next({err:"Error: No ACK received yet.",lack:!0}),o.off()},(this.opt||{}).lack||9e3),r}}})(o,"./ask"),o(function(e){var t=o("./type");function n(e){var n={s:{}};return e=e||{max:1e3,age:9e3},n.check=function(e){var t;return!!(t=n.s[e])&&(t.pass?t.pass=!1:n.track(e))},n.track=function(i,o){var s=n.s[i]||(n.s[i]={});return s.was=r(),o&&(s.pass=!0),n.to||(n.to=setTimeout(function(){var i=r();t.obj.map(n.s,function(r,o){r&&e.age>i-r.was||t.obj.del(n.s,o)}),n.to=null},e.age+9)),s},n}var r=t.time.is;e.exports=n})(o,"./dup"),o(function(e){function t(e){return e instanceof t?(this._={gun:this,$:this}).$:this instanceof t?t.create(this._={gun:this,$:this,opt:e}):new t(e)}t.is=function(e){return e instanceof t||e&&e._&&e===e._.$||!1},t.version=.9,t.chain=t.prototype,t.chain.toJSON=function(){};var n=o("./type");n.obj.to(n,t),t.HAM=o("./HAM"),t.val=o("./val"),t.node=o("./node"),t.state=o("./state"),t.graph=o("./graph"),t.on=o("./onto"),t.ask=o("./ask"),t.dup=o("./dup"),function(){function e(n){var r=this,i=r.as,o=i.at||i,s=o.$,a,u;(u=n["#"])||(u=n["#"]=l(9)),(a=o.dup).check(u)?i.out===n.out&&(n.out=k,r.to.next(n)):(a.track(u),o.ask(n["@"],n)||(n.get&&t.on.get(n,s),n.put&&t.on.put(n,s)),r.to.next(n),i.out||(n.out=e,o.on("out",n)))}t.create=function(n){n.root=n.root||n,n.graph=n.graph||{},n.on=n.on||t.on,n.ask=n.ask||t.ask,n.dup=n.dup||t.dup();var r=n.$.opt(n.opt);return n.once||(n.on("in",e,n),n.on("out",e,{at:n,out:e}),t.on("create",n),n.on("create",n)),n.once=1,r}}(),function(){function e(e,n,r,i){var o=this,s=t.state.is(r,n),a;if(!s)return o.err="Error: No state on '"+n+"' in node '"+i+"'!";var u=o.graph[i]||_,l=t.state.is(u,n,!0),c=u[n],f=t.HAM(o.machine,s,l,e,c);f.incoming?(o.put[i]=t.state.to(r,n,o.put[i]),(o.diff||(o.diff={}))[i]=t.state.to(r,n,o.diff[i]),o.souls[i]=!0):f.defer&&(o.defer=s<(o.defer||1/0)?s:o.defer)}function n(e,t){var n=this,s=n.$._,a=(s.next||_)[t];if(!a){if(!(s.opt||_).super)return void(n.souls[t]=!1);a=n.$.get(t)._}var u=n.map[t]={put:e,get:t,$:a.$},l={ctx:n,msg:u};n.async=!!s.tag.node,n.ack&&(u["@"]=n.ack),d(e,r,l),n.async&&(n.and||s.on("node",function(e){this.to.next(e),e===n.map[e.get]&&(n.souls[e.get]=!1,d(e.put,i,e),d(n.souls,function(e){if(e)return e})||n.c||(n.c=1,this.off(),d(n.map,o,n)))}),n.and=!0,s.on("node",u))}function r(e,n){var r=this.ctx,i=r.graph,o=this.msg,s=o.get,a=o.put,u=o.$._,l;i[s]=t.state.to(a,n,i[s]),r.async||(u.put=t.state.to(a,n,u.put))}function i(e,n){var r=this,i=r.put,o=r.$._;o.put=t.state.to(i,n,o.put)}function o(e,t){e.$&&(this.cat.stop=this.stop,e.$._.on("in",e),this.cat.stop=null)}t.on.put=function(r,i){var s=i._,a={$:i,graph:s.graph,put:{},map:{},souls:{},machine:t.state(),ack:r["@"],cat:s,stop:{}};if(t.graph.is(r.put,null,e,a)||(a.err="Error: Invalid graph!"),a.err)return s.on("in",{"@":r["#"],err:t.log(a.err)});d(a.put,n,a),a.async||d(a.map,o,a),k!==a.defer&&setTimeout(function(){t.on.put(r,i)},a.defer-a.machine),a.diff&&s.on("put",p(r,{put:a.diff}))},t.on.get=function(e,n){var r=n._,i=e.get,o=i[y],s=r.graph[o],a=i[b],u,l=r.next||(r.next={}),c=l[o];if(!s)return r.on("get",e);if(a){if("string"!=typeof a||!h(s,a))return r.on("get",e);s=t.state.to(s,a)}else s=t.obj.copy(s);s=t.graph.node(s),u=(c||_).ack,r.on("in",{"@":e["#"],how:"mem",put:s,$:n}),r.on("get",e)}}(),t.chain.opt=function(e){e=e||{};var n=this,i=n._,o=e.peers||e;return f(e)||(e={}),f(i.opt)||(i.opt=e),u(o)&&(o=[o]),r(o)&&(o=d(o,function(e,t,n){t={},t.id=t.url=e,n(e,t)}),f(i.opt.peers)||(i.opt.peers={}),i.opt.peers=p(o,i.opt.peers)),i.opt.peers=i.opt.peers||{},p(e,i.opt),t.on("opt",i),i.opt.uuid=i.opt.uuid||function(){return g()+l(12)},n};var r=t.list.is,a=t.text,u=a.is,l=a.random,c=t.obj,f=c.is,h=c.has,p=c.to,d=c.map,m=c.copy,g=t.state.lex,y=t.val.link._,b=".",v=t.node._,w=t.val.link.is,_={},k;i.debug=function(e,t){return i.debug.i&&e===i.debug.i&&i.debug.i++&&(i.log.apply(i,arguments)||t)},t.log=function(){return!t.log.off&&i.log.apply(i,arguments),[].slice.call(arguments).join(" ")},t.log.once=function(e,n,r){return(r=t.log.once)[e]=r[e]||0,r[e]++||t.log(n)},t.log.once("welcome","Hello wonderful person! :) Thanks for using GUN, feel free to ask for help on https://gitter.im/amark/gun and ask StackOverflow questions tagged with 'gun'!"),"undefined"!=typeof window&&((window.GUN=window.Gun=t).window=window);try{void 0!==s&&(s.exports=t)}catch(e){}e.exports=t})(o,"./root"),o(function(e){var t=o("./root");t.chain.back=function(e,i){var o;if(e=e||1,-1===e||1/0===e)return this._.root.$;if(1===e)return(this._.back||this._).$;var s=this,a=s._;if("string"==typeof e&&(e=e.split(".")),e instanceof Array){for(var u=0,l=e.length,o=a;u(e.acks||0)&&this.off(),e.ack&&e.ack(r,this)},e.opt),i=0,o=n.root.now;h.del(n.root,"now");var s=n.root.mum;n.root.mum={},e.ref._.on("out",{$:e.ref,put:e.out=e.env.graph,opt:e.opt,"#":r}),n.root.mum=s?h.to(s,n.root.mum):s,n.root.now=o},e),e.res&&e.res())}function a(e,t){if(e)return!0}function u(e,n,r,i){var o=this,s=t.is(e);!n&&i.path.length&&(o.res||v)(function(){for(var n=i.path,r=o.ref,a=o.opt,u=0,c=n.length;uc){if((l.stack||(l.stack=[])).push([s,e,i,o]),l.puto)return;return l.puto=setTimeout(function e(){var t=l.stack.splice(0,c),n=0,r;for(l.puta=!0;r=t[n++];)r[0].put(r[1],r[2],r[3]);if(delete l.puta,l.stack.length)return l.puto=setTimeout(e,0);l.stack=l.puts=l.puto=null},0),s}++l.puts}else l.puts=1;return o=o||{},o.data=e,o.via=o.$=o.via||o.$||s,"string"==typeof i?o.soul=i:o.ack=o.ack||i,a.soul&&(o.soul=a.soul),o.soul||u===s?p(o.data)?(o.soul=o.soul||(o.not=t.node.soul(o.data)||(o.via.back("opt.uuid")||t.text.random)()),o.soul?(o.$=u.get(o.soul),o.ref=o.$,n(o),s):(o.via.back("opt.uuid")(function(e,n){if(e)return t.log(e);(o.ref||o.$).put(o.data,o.soul=n,o)}),s)):((o.ack||b).call(o,o.out={err:t.log("Data saved to the root level of the graph must be a node (an object), not a",typeof o.data,'of "'+o.data+'"!')}),o.res&&o.res(),s):t.is(e)?(e.get(function(e,n,r){if(!e)return t.log("The reference you are saving is a",typeof r.put,'"'+r.put+'", not a node (object)!');s.put(t.val.link.ify(e),i,o)},!0),s):(a.has&&(h=t.val.link.is(e))&&(a.dub=h),o.ref=o.ref||u._===(h=a.back)?s:h.$,o.ref._.soul&&t.val.is(o.data)&&a.get?(o.data=d({},a.get,o.data),o.ref.put(o.data,o.soul,o),s):(o.ref.get(f,!0,{as:o}),o.out||(o.res=o.res||r,o.$._.stun=o.ref._.stun),s))};var h=t.obj,p=h.is,d=h.put,m=h.map,g,y={},b=function(){},v=function(e,t){e.call(t||y)},w=t.node._})(o,"./put"),o(function(e){var t=o("./root");o("./chain"),o("./back"),o("./put"),o("./get"),e.exports=t})(o,"./index"),o(function(e){var t=o("./index");function n(e,t){var n=this,r=e.$,i=(r||{})._||{},o=i.put||e.put,s=n.at,a;if(h!==o){if(a=e.$$){if(a=e.$$._,h===a.put)return;o=a.put}n.change&&(o=e.put),n.as?n.ok.call(n.as,e,t):n.ok.call(r,o,e.get,e,t)}}function r(e,n,i){if(e.$){var o=this.as,a=o.at,u=e.$,l=u._,f=l.put||e.put,p,d;(d=e.$$)&&(p=d=e.$$._,h!==p.put&&(f=p.put)),(d=n.wait)&&(d=d[l.id])&&clearTimeout(d),!i&&(h===f||l.soul||l.link||p&&!(0 .once, apologies unexpected."),this.once(e,n)},t.chain.once=function(e,n){var i=this,o=i._,s=o.put;if(0=(t.batch||1e3))return f();s||(s=setTimeout(f,t.wait||1))}),e.on("get",function(t){this.to.next(t);var n=t.get,r,i,o;function s(){if(n&&(r=n["#"])){var s=n["."];i=a[r]||o,i&&s&&(i=Gun.state.to(i,s)),e.on("in",{"@":t["#"],put:Gun.graph.node(i),how:"lS",lS:t.$})}}Gun.debug?setTimeout(s,1):s()});var c=function(e,t,n,r){a[r]=Gun.state.to(n,t,a[r])},f=function(n){var u;o=0,clearTimeout(s),s=!1;var l=i;i={},n&&(a=n);try{r.setItem(t.prefix,JSON.stringify(a))}catch(n){Gun.log(u=(n||"localStorage failure")+" Consider using GUN's IndexedDB plugin for RAD for more storage space, temporary example at https://github.com/amark/gun/blob/master/test/tmp/indexedDB.html ."),e.on("localStorage:error",{err:u,file:t.prefix,flush:a,retry:f})}(u||Gun.obj.empty(t.peers))&&Gun.obj.map(l,function(t,n){e.on("in",{"@":n,err:u,ok:0})})}}})}})(o,"./adapters/localStorage"),o(function(e){var t=o("../type");function n(e){var n=function(){},o=e.opt||{};o.log=o.log||i.log,o.gap=o.gap||o.wait||1,o.pack=o.pack||.3*(o.memory?1e3*o.memory*1e3:1399e6);var a=e.dup;n.hear=function(r,i){if(r){var l,c,f,h=r[0];if(o.pack<=r.length)return n.say({dam:"!",err:"Message too big!"},i);if("{"!=r[2]&&(n.hear.d+=r.length||0,++n.hear.c),"["!==h){if("{"===h||t.obj.is(r)&&(l=r)){try{l=l||JSON.parse(r)}catch(e){return o.log("DAM JSON parse error",e)}if(!l)return;if((c=l["#"])||(c=l["#"]=t.text.random(9)),a.check(c))return;if(a.track(c,!0).it=l,(f=l["##"])||s===l.put||(f=l["##"]=t.obj.hash(l.put)),f&&(h=l["@"]||l.get&&c)){if(a.check(h+f))return;a.track(h+f,!0).it=l}return(l._=function(){}).via=i,(h=l["><"])&&(l._.to=t.obj.map(h.split(","),u)),l.dam?void((h=n.hear[l.dam])&&h(l,i,e)):void e.on("in",l)}}else{try{l=JSON.parse(r)}catch(e){o.log("DAM JSON parse error",e)}if(!l)return;for(var p=0,d;d=l[p++];)n.hear(d,i)}}};var u=function(e,t,n){n(e,!0)};function l(e,t){try{var r=t.wire;t.say?t.say(e):r.send&&r.send(e),n.say.d+=e.length||0,++n.say.c}catch(n){(t.queue=t.queue||[]).push(e)}}n.hear.c=n.hear.d=0,function(){var e;function i(t){n.say(e,t)}function u(e){var t=e.batch;if(e.batch=e.tail=null,t&&t.length){try{t=1===t.length?t[0]:JSON.stringify(t)}catch(e){return o.log("DAM JSON stringify error",e)}t&&l(t,e)}}n.say=function(c,f){if(this.to&&this.to.next(c),!c)return!1;var h,p,d,m,g=c._||(c._=function(){});if((h=c["#"])||(h=c["#"]=t.text.random(9)),(p=c["##"])||s===c.put||(p=c["##"]=t.obj.hash(c.put)),!(m=g.raw)&&(m=g.raw=n.raw(c),p&&(d=c["@"])&&(a.track(d+p).it=c,d=(a.s[d]||r).it))){if(p===d["##"])return!1;d["##"]=p}if(a.track(h).it=c,f||(f=(d=a.s[c["@"]])&&(d=d.it)&&(d=d._)&&(d=d.via)),!f&&n.way)return n.way(c);if(!f||!f.id)return e=c,!!t.obj.is(f||o.peers)&&void t.obj.map(f||o.peers,i);if(!f.wire&&n.wire&&n.wire(f),f===g.via)return!1;if((d=g.to)&&(d[f.url]||d[f.pid]||d[f.id]))return!1;if(f.batch){if(f.tail=(d=f.tail||0)+m.length,f.tail<=o.pack)return void f.batch.push(m);u(f)}f.batch=[],setTimeout(function(){u(f)},o.gap),l(m,f)},n.say.c=n.say.d=0}(),function(){n.raw=function(n){if(!n)return"";var r=n._||{},i,s,a;if(a=r.raw)return a;if("string"==typeof n)return n;if(!n.dam){var u=0,l=[];t.obj.map(o.peers,function(e){if(l.push(e.url||e.pid||e.id),++u>9)return!0}),u>1&&(n["><"]=l.join())}var c=e(n);return r&&(r.raw=c),c};var e=JSON.stringify,r=":])([:"}(),n.hi=function(r){var i=r.wire||{};r.id?o.peers[r.url||r.id]=r:(i=r.id=r.id||t.text.random(9),n.say({dam:"?"},o.peers[i]=r)),r.met=r.met||+new Date,i.hied||e.on(i.hied="hi",r),i=r.queue,r.queue=[],t.obj.map(i,function(e){l(e,r)})},n.bye=function(r){t.obj.del(o.peers,r.id),e.on("bye",r);var i=+new Date;i-=r.met||i,n.bye.time=((n.bye.time||i)+i)/2},n.hear["!"]=function(e,t){o.log("Error:",e.err)},n.hear["?"]=function(e,t){e.pid?t.pid||(t.pid=e.pid):n.say({dam:"?",pid:o.pid,"@":e["#"]},t)},e.on("create",function(e){e.opt.pid=e.opt.pid||t.text.random(9),this.to.next(e),e.on("out",n.say)});var c={};return e.on("bye",function(e,t){this.to.next(e),(t=e.url)&&(c[t]=!0,setTimeout(function(){delete c[t]},o.lack||9e3))}),e.on("hi",function(r,i){this.to.next(r),(i=r.url)&&c[i]&&(delete c[i],t.obj.map(e.next,function(o,s){i={},i[s]=e.graph[s],n.say({"##":t.obj.hash(i),get:{"#":s}},r)}))}),n}!function(){t.text.hash=function(e){if("string"!=typeof e)return{err:1};var t=0;if(!e.length)return t;for(var n=0,r=e.length,i;ne&&e.length>0?[e.length+" items inc:",e[e.length-1]]:e),utils.stringfrom=function(e,t={}){try{return"Url"===e.constructor.name?e.href:"string"==typeof e?e:e.toString()}catch(t){throw new r.CodingError(`Unable to turn ${e} into a string ${t.message}`)}},utils.p_timeout=function(e,t,n){let i=null;return Promise.race([new Promise((e,o)=>{i=setTimeout(o,t,new r.TimeoutError(n||`Timed out in ${t}ms`))}),e.then(e=>(clearTimeout(i),e))])},utils.createElement=function(e,t,n){var r=document.createElement(e);for(let e in t){let n="classname"===e.toLowerCase()?"class":e;if("dangerouslySetInnerHTML"===e&&(r.innerHTML=t[e].__html,delete t.dangerouslySetInnerHTML),t.hasOwnProperty(e)){let i=t[e];if(!0===i)r.setAttribute(n,e);else if("object"!=typeof i||Array.isArray(i))!1!==i&&null!=i&&r.setAttribute(n,i.toString());else if(["style"].includes(n))for(let e in i)r[n][e]=i[e];else r[n]=i}}for(let e=2;er.appendChild(null==e.nodeType?document.createTextNode(e.toString()):e)):r.appendChild(null==t.nodeType?document.createTextNode(t.toString()):t))}return r},t=e.exports=utils},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=(0,s.default)(e);return(0,i.default)(function(e,t){n(e[0],t)},t,1)};var r=n(744),i=a(r),o=n(42),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,n){var r=n(173),i=n(290);function o(e){return null!=e&&i(e.length)&&!r(e)}e.exports=o},function(e,t,n){var r=n(132),i=n(217),o="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",u="[object Proxy]";function l(e){if(!i(e))return!1;var t=r(e);return t==s||t==a||t==o||t==u}e.exports=l},function(e,t,n){var r=n(99),i=r.Symbol;e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=n(218),i=a(r),o=n(42),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e){return function(t,n,r){return e(i.default,t,(0,s.default)(n),r)}}e.exports=t.default},function(e,t,n){"use strict";(function(e){t.protobuf=e.from("50","hex"),t.cbor=e.from("51","hex"),t.rlp=e.from("60","hex"),t.bencode=e.from("63","hex"),t.multicodec=e.from("30","hex"),t.multihash=e.from("31","hex"),t.multiaddr=e.from("32","hex"),t.multibase=e.from("33","hex"),t.identity=e.from("00","hex"),t.sha1=e.from("11","hex"),t["sha2-256"]=e.from("12","hex"),t["sha2-512"]=e.from("13","hex"),t["sha3-512"]=e.from("14","hex"),t["sha3-384"]=e.from("15","hex"),t["sha3-256"]=e.from("16","hex"),t["sha3-224"]=e.from("17","hex"),t["shake-128"]=e.from("18","hex"),t["shake-256"]=e.from("19","hex"),t["keccak-224"]=e.from("1a","hex"),t["keccak-256"]=e.from("1b","hex"),t["keccak-384"]=e.from("1c","hex"),t["keccak-512"]=e.from("1d","hex"),t["murmur3-128"]=e.from("22","hex"),t["murmur3-32"]=e.from("23","hex"),t["dbl-sha2-256"]=e.from("56","hex"),t.md4=e.from("d4","hex"),t.md5=e.from("d5","hex"),t.bmt=e.from("d6","hex"),t.x11=e.from("1100","hex"),t["blake2b-8"]=e.from("b201","hex"),t["blake2b-16"]=e.from("b202","hex"),t["blake2b-24"]=e.from("b203","hex"),t["blake2b-32"]=e.from("b204","hex"),t["blake2b-40"]=e.from("b205","hex"),t["blake2b-48"]=e.from("b206","hex"),t["blake2b-56"]=e.from("b207","hex"),t["blake2b-64"]=e.from("b208","hex"),t["blake2b-72"]=e.from("b209","hex"),t["blake2b-80"]=e.from("b20a","hex"),t["blake2b-88"]=e.from("b20b","hex"),t["blake2b-96"]=e.from("b20c","hex"),t["blake2b-104"]=e.from("b20d","hex"),t["blake2b-112"]=e.from("b20e","hex"),t["blake2b-120"]=e.from("b20f","hex"),t["blake2b-128"]=e.from("b210","hex"),t["blake2b-136"]=e.from("b211","hex"),t["blake2b-144"]=e.from("b212","hex"),t["blake2b-152"]=e.from("b213","hex"),t["blake2b-160"]=e.from("b214","hex"),t["blake2b-168"]=e.from("b215","hex"),t["blake2b-176"]=e.from("b216","hex"),t["blake2b-184"]=e.from("b217","hex"),t["blake2b-192"]=e.from("b218","hex"),t["blake2b-200"]=e.from("b219","hex"),t["blake2b-208"]=e.from("b21a","hex"),t["blake2b-216"]=e.from("b21b","hex"),t["blake2b-224"]=e.from("b21c","hex"),t["blake2b-232"]=e.from("b21d","hex"),t["blake2b-240"]=e.from("b21e","hex"),t["blake2b-248"]=e.from("b21f","hex"),t["blake2b-256"]=e.from("b220","hex"),t["blake2b-264"]=e.from("b221","hex"),t["blake2b-272"]=e.from("b222","hex"),t["blake2b-280"]=e.from("b223","hex"),t["blake2b-288"]=e.from("b224","hex"),t["blake2b-296"]=e.from("b225","hex"),t["blake2b-304"]=e.from("b226","hex"),t["blake2b-312"]=e.from("b227","hex"),t["blake2b-320"]=e.from("b228","hex"),t["blake2b-328"]=e.from("b229","hex"),t["blake2b-336"]=e.from("b22a","hex"),t["blake2b-344"]=e.from("b22b","hex"),t["blake2b-352"]=e.from("b22c","hex"),t["blake2b-360"]=e.from("b22d","hex"),t["blake2b-368"]=e.from("b22e","hex"),t["blake2b-376"]=e.from("b22f","hex"),t["blake2b-384"]=e.from("b230","hex"),t["blake2b-392"]=e.from("b231","hex"),t["blake2b-400"]=e.from("b232","hex"),t["blake2b-408"]=e.from("b233","hex"),t["blake2b-416"]=e.from("b234","hex"),t["blake2b-424"]=e.from("b235","hex"),t["blake2b-432"]=e.from("b236","hex"),t["blake2b-440"]=e.from("b237","hex"),t["blake2b-448"]=e.from("b238","hex"),t["blake2b-456"]=e.from("b239","hex"),t["blake2b-464"]=e.from("b23a","hex"),t["blake2b-472"]=e.from("b23b","hex"),t["blake2b-480"]=e.from("b23c","hex"),t["blake2b-488"]=e.from("b23d","hex"),t["blake2b-496"]=e.from("b23e","hex"),t["blake2b-504"]=e.from("b23f","hex"),t["blake2b-512"]=e.from("b240","hex"),t["blake2s-8"]=e.from("b241","hex"),t["blake2s-16"]=e.from("b242","hex"),t["blake2s-24"]=e.from("b243","hex"),t["blake2s-32"]=e.from("b244","hex"),t["blake2s-40"]=e.from("b245","hex"),t["blake2s-48"]=e.from("b246","hex"),t["blake2s-56"]=e.from("b247","hex"),t["blake2s-64"]=e.from("b248","hex"),t["blake2s-72"]=e.from("b249","hex"),t["blake2s-80"]=e.from("b24a","hex"),t["blake2s-88"]=e.from("b24b","hex"),t["blake2s-96"]=e.from("b24c","hex"),t["blake2s-104"]=e.from("b24d","hex"),t["blake2s-112"]=e.from("b24e","hex"),t["blake2s-120"]=e.from("b24f","hex"),t["blake2s-128"]=e.from("b250","hex"),t["blake2s-136"]=e.from("b251","hex"),t["blake2s-144"]=e.from("b252","hex"),t["blake2s-152"]=e.from("b253","hex"),t["blake2s-160"]=e.from("b254","hex"),t["blake2s-168"]=e.from("b255","hex"),t["blake2s-176"]=e.from("b256","hex"),t["blake2s-184"]=e.from("b257","hex"),t["blake2s-192"]=e.from("b258","hex"),t["blake2s-200"]=e.from("b259","hex"),t["blake2s-208"]=e.from("b25a","hex"),t["blake2s-216"]=e.from("b25b","hex"),t["blake2s-224"]=e.from("b25c","hex"),t["blake2s-232"]=e.from("b25d","hex"),t["blake2s-240"]=e.from("b25e","hex"),t["blake2s-248"]=e.from("b25f","hex"),t["blake2s-256"]=e.from("b260","hex"),t["skein256-8"]=e.from("b301","hex"),t["skein256-16"]=e.from("b302","hex"),t["skein256-24"]=e.from("b303","hex"),t["skein256-32"]=e.from("b304","hex"),t["skein256-40"]=e.from("b305","hex"),t["skein256-48"]=e.from("b306","hex"),t["skein256-56"]=e.from("b307","hex"),t["skein256-64"]=e.from("b308","hex"),t["skein256-72"]=e.from("b309","hex"),t["skein256-80"]=e.from("b30a","hex"),t["skein256-88"]=e.from("b30b","hex"),t["skein256-96"]=e.from("b30c","hex"),t["skein256-104"]=e.from("b30d","hex"),t["skein256-112"]=e.from("b30e","hex"),t["skein256-120"]=e.from("b30f","hex"),t["skein256-128"]=e.from("b310","hex"),t["skein256-136"]=e.from("b311","hex"),t["skein256-144"]=e.from("b312","hex"),t["skein256-152"]=e.from("b313","hex"),t["skein256-160"]=e.from("b314","hex"),t["skein256-168"]=e.from("b315","hex"),t["skein256-176"]=e.from("b316","hex"),t["skein256-184"]=e.from("b317","hex"),t["skein256-192"]=e.from("b318","hex"),t["skein256-200"]=e.from("b319","hex"),t["skein256-208"]=e.from("b31a","hex"),t["skein256-216"]=e.from("b31b","hex"),t["skein256-224"]=e.from("b31c","hex"),t["skein256-232"]=e.from("b31d","hex"),t["skein256-240"]=e.from("b31e","hex"),t["skein256-248"]=e.from("b31f","hex"),t["skein256-256"]=e.from("b320","hex"),t["skein512-8"]=e.from("b321","hex"),t["skein512-16"]=e.from("b322","hex"),t["skein512-24"]=e.from("b323","hex"),t["skein512-32"]=e.from("b324","hex"),t["skein512-40"]=e.from("b325","hex"),t["skein512-48"]=e.from("b326","hex"),t["skein512-56"]=e.from("b327","hex"),t["skein512-64"]=e.from("b328","hex"),t["skein512-72"]=e.from("b329","hex"),t["skein512-80"]=e.from("b32a","hex"),t["skein512-88"]=e.from("b32b","hex"),t["skein512-96"]=e.from("b32c","hex"),t["skein512-104"]=e.from("b32d","hex"),t["skein512-112"]=e.from("b32e","hex"),t["skein512-120"]=e.from("b32f","hex"),t["skein512-128"]=e.from("b330","hex"),t["skein512-136"]=e.from("b331","hex"),t["skein512-144"]=e.from("b332","hex"),t["skein512-152"]=e.from("b333","hex"),t["skein512-160"]=e.from("b334","hex"),t["skein512-168"]=e.from("b335","hex"),t["skein512-176"]=e.from("b336","hex"),t["skein512-184"]=e.from("b337","hex"),t["skein512-192"]=e.from("b338","hex"),t["skein512-200"]=e.from("b339","hex"),t["skein512-208"]=e.from("b33a","hex"),t["skein512-216"]=e.from("b33b","hex"),t["skein512-224"]=e.from("b33c","hex"),t["skein512-232"]=e.from("b33d","hex"),t["skein512-240"]=e.from("b33e","hex"),t["skein512-248"]=e.from("b33f","hex"),t["skein512-256"]=e.from("b340","hex"),t["skein512-264"]=e.from("b341","hex"),t["skein512-272"]=e.from("b342","hex"),t["skein512-280"]=e.from("b343","hex"),t["skein512-288"]=e.from("b344","hex"),t["skein512-296"]=e.from("b345","hex"),t["skein512-304"]=e.from("b346","hex"),t["skein512-312"]=e.from("b347","hex"),t["skein512-320"]=e.from("b348","hex"),t["skein512-328"]=e.from("b349","hex"),t["skein512-336"]=e.from("b34a","hex"),t["skein512-344"]=e.from("b34b","hex"),t["skein512-352"]=e.from("b34c","hex"),t["skein512-360"]=e.from("b34d","hex"),t["skein512-368"]=e.from("b34e","hex"),t["skein512-376"]=e.from("b34f","hex"),t["skein512-384"]=e.from("b350","hex"),t["skein512-392"]=e.from("b351","hex"),t["skein512-400"]=e.from("b352","hex"),t["skein512-408"]=e.from("b353","hex"),t["skein512-416"]=e.from("b354","hex"),t["skein512-424"]=e.from("b355","hex"),t["skein512-432"]=e.from("b356","hex"),t["skein512-440"]=e.from("b357","hex"),t["skein512-448"]=e.from("b358","hex"),t["skein512-456"]=e.from("b359","hex"),t["skein512-464"]=e.from("b35a","hex"),t["skein512-472"]=e.from("b35b","hex"),t["skein512-480"]=e.from("b35c","hex"),t["skein512-488"]=e.from("b35d","hex"),t["skein512-496"]=e.from("b35e","hex"),t["skein512-504"]=e.from("b35f","hex"),t["skein512-512"]=e.from("b360","hex"),t["skein1024-8"]=e.from("b361","hex"),t["skein1024-16"]=e.from("b362","hex"),t["skein1024-24"]=e.from("b363","hex"),t["skein1024-32"]=e.from("b364","hex"),t["skein1024-40"]=e.from("b365","hex"),t["skein1024-48"]=e.from("b366","hex"),t["skein1024-56"]=e.from("b367","hex"),t["skein1024-64"]=e.from("b368","hex"),t["skein1024-72"]=e.from("b369","hex"),t["skein1024-80"]=e.from("b36a","hex"),t["skein1024-88"]=e.from("b36b","hex"),t["skein1024-96"]=e.from("b36c","hex"),t["skein1024-104"]=e.from("b36d","hex"),t["skein1024-112"]=e.from("b36e","hex"),t["skein1024-120"]=e.from("b36f","hex"),t["skein1024-128"]=e.from("b370","hex"),t["skein1024-136"]=e.from("b371","hex"),t["skein1024-144"]=e.from("b372","hex"),t["skein1024-152"]=e.from("b373","hex"),t["skein1024-160"]=e.from("b374","hex"),t["skein1024-168"]=e.from("b375","hex"),t["skein1024-176"]=e.from("b376","hex"),t["skein1024-184"]=e.from("b377","hex"),t["skein1024-192"]=e.from("b378","hex"),t["skein1024-200"]=e.from("b379","hex"),t["skein1024-208"]=e.from("b37a","hex"),t["skein1024-216"]=e.from("b37b","hex"),t["skein1024-224"]=e.from("b37c","hex"),t["skein1024-232"]=e.from("b37d","hex"),t["skein1024-240"]=e.from("b37e","hex"),t["skein1024-248"]=e.from("b37f","hex"),t["skein1024-256"]=e.from("b380","hex"),t["skein1024-264"]=e.from("b381","hex"),t["skein1024-272"]=e.from("b382","hex"),t["skein1024-280"]=e.from("b383","hex"),t["skein1024-288"]=e.from("b384","hex"),t["skein1024-296"]=e.from("b385","hex"),t["skein1024-304"]=e.from("b386","hex"),t["skein1024-312"]=e.from("b387","hex"),t["skein1024-320"]=e.from("b388","hex"),t["skein1024-328"]=e.from("b389","hex"),t["skein1024-336"]=e.from("b38a","hex"),t["skein1024-344"]=e.from("b38b","hex"),t["skein1024-352"]=e.from("b38c","hex"),t["skein1024-360"]=e.from("b38d","hex"),t["skein1024-368"]=e.from("b38e","hex"),t["skein1024-376"]=e.from("b38f","hex"),t["skein1024-384"]=e.from("b390","hex"),t["skein1024-392"]=e.from("b391","hex"),t["skein1024-400"]=e.from("b392","hex"),t["skein1024-408"]=e.from("b393","hex"),t["skein1024-416"]=e.from("b394","hex"),t["skein1024-424"]=e.from("b395","hex"),t["skein1024-432"]=e.from("b396","hex"),t["skein1024-440"]=e.from("b397","hex"),t["skein1024-448"]=e.from("b398","hex"),t["skein1024-456"]=e.from("b399","hex"),t["skein1024-464"]=e.from("b39a","hex"),t["skein1024-472"]=e.from("b39b","hex"),t["skein1024-480"]=e.from("b39c","hex"),t["skein1024-488"]=e.from("b39d","hex"),t["skein1024-496"]=e.from("b39e","hex"),t["skein1024-504"]=e.from("b39f","hex"),t["skein1024-512"]=e.from("b3a0","hex"),t["skein1024-520"]=e.from("b3a1","hex"),t["skein1024-528"]=e.from("b3a2","hex"),t["skein1024-536"]=e.from("b3a3","hex"),t["skein1024-544"]=e.from("b3a4","hex"),t["skein1024-552"]=e.from("b3a5","hex"),t["skein1024-560"]=e.from("b3a6","hex"),t["skein1024-568"]=e.from("b3a7","hex"),t["skein1024-576"]=e.from("b3a8","hex"),t["skein1024-584"]=e.from("b3a9","hex"),t["skein1024-592"]=e.from("b3aa","hex"),t["skein1024-600"]=e.from("b3ab","hex"),t["skein1024-608"]=e.from("b3ac","hex"),t["skein1024-616"]=e.from("b3ad","hex"),t["skein1024-624"]=e.from("b3ae","hex"),t["skein1024-632"]=e.from("b3af","hex"),t["skein1024-640"]=e.from("b3b0","hex"),t["skein1024-648"]=e.from("b3b1","hex"),t["skein1024-656"]=e.from("b3b2","hex"),t["skein1024-664"]=e.from("b3b3","hex"),t["skein1024-672"]=e.from("b3b4","hex"),t["skein1024-680"]=e.from("b3b5","hex"),t["skein1024-688"]=e.from("b3b6","hex"),t["skein1024-696"]=e.from("b3b7","hex"),t["skein1024-704"]=e.from("b3b8","hex"),t["skein1024-712"]=e.from("b3b9","hex"),t["skein1024-720"]=e.from("b3ba","hex"),t["skein1024-728"]=e.from("b3bb","hex"),t["skein1024-736"]=e.from("b3bc","hex"),t["skein1024-744"]=e.from("b3bd","hex"),t["skein1024-752"]=e.from("b3be","hex"),t["skein1024-760"]=e.from("b3bf","hex"),t["skein1024-768"]=e.from("b3c0","hex"),t["skein1024-776"]=e.from("b3c1","hex"),t["skein1024-784"]=e.from("b3c2","hex"),t["skein1024-792"]=e.from("b3c3","hex"),t["skein1024-800"]=e.from("b3c4","hex"),t["skein1024-808"]=e.from("b3c5","hex"),t["skein1024-816"]=e.from("b3c6","hex"),t["skein1024-824"]=e.from("b3c7","hex"),t["skein1024-832"]=e.from("b3c8","hex"),t["skein1024-840"]=e.from("b3c9","hex"),t["skein1024-848"]=e.from("b3ca","hex"),t["skein1024-856"]=e.from("b3cb","hex"),t["skein1024-864"]=e.from("b3cc","hex"),t["skein1024-872"]=e.from("b3cd","hex"),t["skein1024-880"]=e.from("b3ce","hex"),t["skein1024-888"]=e.from("b3cf","hex"),t["skein1024-896"]=e.from("b3d0","hex"),t["skein1024-904"]=e.from("b3d1","hex"),t["skein1024-912"]=e.from("b3d2","hex"),t["skein1024-920"]=e.from("b3d3","hex"),t["skein1024-928"]=e.from("b3d4","hex"),t["skein1024-936"]=e.from("b3d5","hex"),t["skein1024-944"]=e.from("b3d6","hex"),t["skein1024-952"]=e.from("b3d7","hex"),t["skein1024-960"]=e.from("b3d8","hex"),t["skein1024-968"]=e.from("b3d9","hex"),t["skein1024-976"]=e.from("b3da","hex"),t["skein1024-984"]=e.from("b3db","hex"),t["skein1024-992"]=e.from("b3dc","hex"),t["skein1024-1000"]=e.from("b3dd","hex"),t["skein1024-1008"]=e.from("b3de","hex"),t["skein1024-1016"]=e.from("b3df","hex"),t["skein1024-1024"]=e.from("b3e0","hex"),t.ip4=e.from("04","hex"),t.tcp=e.from("06","hex"),t.dccp=e.from("21","hex"),t.ip6=e.from("29","hex"),t.ip6zone=e.from("2a","hex"),t.dns=e.from("35","hex"),t.dns4=e.from("36","hex"),t.dns6=e.from("37","hex"),t.dnsaddr=e.from("38","hex"),t.sctp=e.from("84","hex"),t.udp=e.from("0111","hex"),t["p2p-webrtc-star"]=e.from("0113","hex"),t["p2p-webrtc-direct"]=e.from("0114","hex"),t["p2p-stardust"]=e.from("0115","hex"),t["p2p-circuit"]=e.from("0122","hex"),t.udt=e.from("012d","hex"),t.utp=e.from("012e","hex"),t.unix=e.from("0190","hex"),t.p2p=e.from("01a5","hex"),t.ipfs=e.from("01a5","hex"),t.https=e.from("01bb","hex"),t.onion=e.from("01bc","hex"),t.onion3=e.from("01bd","hex"),t.garlic64=e.from("01be","hex"),t.garlic32=e.from("01bf","hex"),t.quic=e.from("01cc","hex"),t.ws=e.from("01dd","hex"),t.wss=e.from("01de","hex"),t["p2p-websocket-star"]=e.from("01df","hex"),t.http=e.from("01e0","hex"),t.raw=e.from("55","hex"),t["dag-pb"]=e.from("70","hex"),t["dag-cbor"]=e.from("71","hex"),t["libp2p-key"]=e.from("72","hex"),t["git-raw"]=e.from("78","hex"),t["torrent-info"]=e.from("7b","hex"),t["torrent-file"]=e.from("7c","hex"),t["leofcoin-block"]=e.from("81","hex"),t["leofcoin-tx"]=e.from("82","hex"),t["leofcoin-pr"]=e.from("83","hex"),t["eth-block"]=e.from("90","hex"),t["eth-block-list"]=e.from("91","hex"),t["eth-tx-trie"]=e.from("92","hex"),t["eth-tx"]=e.from("93","hex"),t["eth-tx-receipt-trie"]=e.from("94","hex"),t["eth-tx-receipt"]=e.from("95","hex"),t["eth-state-trie"]=e.from("96","hex"),t["eth-account-snapshot"]=e.from("97","hex"),t["eth-storage-trie"]=e.from("98","hex"),t["bitcoin-block"]=e.from("b0","hex"),t["bitcoin-tx"]=e.from("b1","hex"),t["zcash-block"]=e.from("c0","hex"),t["zcash-tx"]=e.from("c1","hex"),t["stellar-block"]=e.from("d0","hex"),t["stellar-tx"]=e.from("d1","hex"),t["decred-block"]=e.from("e0","hex"),t["decred-tx"]=e.from("e1","hex"),t["dash-block"]=e.from("f0","hex"),t["dash-tx"]=e.from("f1","hex"),t["swarm-manifest"]=e.from("fa","hex"),t["swarm-feed"]=e.from("fb","hex"),t["dag-json"]=e.from("0129","hex"),t.path=e.from("2f","hex"),t["ipld-ns"]=e.from("e2","hex"),t["ipfs-ns"]=e.from("e3","hex"),t["swarm-ns"]=e.from("e4","hex"),t["ed25519-pub"]=e.from("ed","hex"),t["holochain-adr-v0"]=e.from("807124","hex"),t["holochain-adr-v1"]=e.from("817124","hex"),t["holochain-key-v0"]=e.from("947124","hex"),t["holochain-key-v1"]=e.from("957124","hex"),t["holochain-sig-v0"]=e.from("a27124","hex"),t["holochain-sig-v1"]=e.from("a37124","hex")}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=function e(t,n){var r,i;function o(e){if(r=e,i)return o.abort();!function e(){for(var o=!0,s=!1;o;)if(s=!1,r(null,function(a,u){if(s=!0,a=a||i){if(o=!1,n)n(!0===a?null:a);else if(a&&!0!==a)throw a}else t&&!1===t(u)||i?(o=!1,r(i||!0,n||function(){})):o||e()}),!s)return void(o=!1)}()}return o.abort=function(e,t){if("function"==typeof e&&(t=e,e=!0),i=e||!0,r)return r(i,t||function(){})},o}},function(e,t){e.exports=function e(t){return t&&("string"==typeof t?function(e){return e[t]}:"object"==typeof t&&"function"==typeof t.exec?function(e){var n=t.exec(e);return n&&n[0]}:t)}},function(e,t,n){var r=n(19);r.pki=r.pki||{};var i=e.exports=r.pki.oids=r.oids=r.oids||{};function o(e,t){i[e]=t,i[t]=e}function s(e,t){i[e]=t}o("1.2.840.113549.1.1.1","rsaEncryption"),o("1.2.840.113549.1.1.4","md5WithRSAEncryption"),o("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),o("1.2.840.113549.1.1.7","RSAES-OAEP"),o("1.2.840.113549.1.1.8","mgf1"),o("1.2.840.113549.1.1.9","pSpecified"),o("1.2.840.113549.1.1.10","RSASSA-PSS"),o("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),o("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),o("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),o("1.2.840.10040.4.3","dsa-with-sha1"),o("1.3.14.3.2.7","desCBC"),o("1.3.14.3.2.26","sha1"),o("2.16.840.1.101.3.4.2.1","sha256"),o("2.16.840.1.101.3.4.2.2","sha384"),o("2.16.840.1.101.3.4.2.3","sha512"),o("1.2.840.113549.2.5","md5"),o("1.2.840.113549.1.7.1","data"),o("1.2.840.113549.1.7.2","signedData"),o("1.2.840.113549.1.7.3","envelopedData"),o("1.2.840.113549.1.7.4","signedAndEnvelopedData"),o("1.2.840.113549.1.7.5","digestedData"),o("1.2.840.113549.1.7.6","encryptedData"),o("1.2.840.113549.1.9.1","emailAddress"),o("1.2.840.113549.1.9.2","unstructuredName"),o("1.2.840.113549.1.9.3","contentType"),o("1.2.840.113549.1.9.4","messageDigest"),o("1.2.840.113549.1.9.5","signingTime"),o("1.2.840.113549.1.9.6","counterSignature"),o("1.2.840.113549.1.9.7","challengePassword"),o("1.2.840.113549.1.9.8","unstructuredAddress"),o("1.2.840.113549.1.9.14","extensionRequest"),o("1.2.840.113549.1.9.20","friendlyName"),o("1.2.840.113549.1.9.21","localKeyId"),o("1.2.840.113549.1.9.22.1","x509Certificate"),o("1.2.840.113549.1.12.10.1.1","keyBag"),o("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),o("1.2.840.113549.1.12.10.1.3","certBag"),o("1.2.840.113549.1.12.10.1.4","crlBag"),o("1.2.840.113549.1.12.10.1.5","secretBag"),o("1.2.840.113549.1.12.10.1.6","safeContentsBag"),o("1.2.840.113549.1.5.13","pkcs5PBES2"),o("1.2.840.113549.1.5.12","pkcs5PBKDF2"),o("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),o("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),o("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),o("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),o("1.2.840.113549.2.7","hmacWithSHA1"),o("1.2.840.113549.2.8","hmacWithSHA224"),o("1.2.840.113549.2.9","hmacWithSHA256"),o("1.2.840.113549.2.10","hmacWithSHA384"),o("1.2.840.113549.2.11","hmacWithSHA512"),o("1.2.840.113549.3.7","des-EDE3-CBC"),o("2.16.840.1.101.3.4.1.2","aes128-CBC"),o("2.16.840.1.101.3.4.1.22","aes192-CBC"),o("2.16.840.1.101.3.4.1.42","aes256-CBC"),o("2.5.4.3","commonName"),o("2.5.4.5","serialName"),o("2.5.4.6","countryName"),o("2.5.4.7","localityName"),o("2.5.4.8","stateOrProvinceName"),o("2.5.4.10","organizationName"),o("2.5.4.11","organizationalUnitName"),o("2.16.840.1.113730.1.1","nsCertType"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),o("2.5.29.14","subjectKeyIdentifier"),o("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),o("2.5.29.17","subjectAltName"),o("2.5.29.18","issuerAltName"),o("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),o("2.5.29.31","cRLDistributionPoints"),o("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),o("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),o("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),o("1.3.6.1.4.1.11129.2.4.2","timestampList"),o("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),o("1.3.6.1.5.5.7.3.1","serverAuth"),o("1.3.6.1.5.5.7.3.2","clientAuth"),o("1.3.6.1.5.5.7.3.3","codeSigning"),o("1.3.6.1.5.5.7.3.4","emailProtection"),o("1.3.6.1.5.5.7.3.8","timeStamping")},function(e,t,n){"use strict";const r=t;r.Reporter=n(905).Reporter,r.DecoderBuffer=n(462).DecoderBuffer,r.EncoderBuffer=n(462).EncoderBuffer,r.Node=n(906)},function(e,t,n){(function(t){e.exports=function e(n,r){for(var i=Math.min(n.length,r.length),o=new t(i),s=0;s{const s=new i(Date.now()+Number(r)).toString(),a=f.ValidityType.EOL;b(e,t,n,s,a,o)},y=(e,t,n,r,i)=>{const o=f.ValidityType.EOL;b(e,t,n,r,o,i)},b=(e,t,n,r,i,o)=>{x(e,t,i,r,(e,s)=>{if(e)return c.error("record signature creation failed"),o(Object.assign(new Error("record signature verification failed"),{code:p.ERR_SIGNATURE_CREATION}));const a={value:t,signature:s,validityType:i,validity:r,sequence:n};return c(`ipns entry for ${t} created`),o(null,a)})},v=(e,t,n)=>{const{value:r,validityType:i,validity:o}=t,s=A(r,i,o);e.verify(s,t.signature,(e,t)=>{if(e||!t)return c.error("record signature verification failed"),n(Object.assign(new Error("record signature verification failed"),{code:p.ERR_SIGNATURE_VERIFICATION}));if(i===f.ValidityType.EOL){let e;try{e=h(o.toString())}catch(e){return c.error("unrecognized validity format (not an rfc3339 format)"),n(Object.assign(new Error("unrecognized validity format (not an rfc3339 format)"),{code:p.ERR_UNRECOGNIZED_FORMAT}))}if(e{if(!e||!e.bytes||!t){const e="one or more of the provided parameters are not defined";return c.error(e),n(Object.assign(new Error(e),{code:p.ERR_UNDEFINED_PARAMETER}))}a.createFromPubKey(e.bytes,(r,i)=>{if(r)return c.error(r),n(Object.assign(new Error(r),{code:p.ERR_PEER_ID_FROM_PUBLIC_KEY}));let o;try{o=I(i)}catch(r){return c.error(r),n(Object.assign(new Error(r),{code:p.ERR_PUBLIC_KEY_FROM_ID}))}if(o)return n(null,null);try{t.pubKey=s.keys.marshalPublicKey(e)}catch(r){return c.error(r),n(r)}n(null,t)})},_=(e,t,n)=>{if(!t||!e){const e="one or more of the provided parameters are not defined";return c.error(e),n(Object.assign(new Error(e),{code:p.ERR_UNDEFINED_PARAMETER}))}if(t.pubKey){let e;try{e=s.keys.unmarshalPublicKey(t.pubKey)}catch(e){return c.error(e),n(e)}return n(null,e)}e.pubKey?n(null,e.pubKey):n(Object.assign(new Error("no public key is available"),{code:p.ERR_UNDEFINED_PARAMETER}))},k=e=>r(e,"RFC4648",{padding:!1}),S=e=>new o(`/ipns/${k(e)}`),E=e=>{const n=t.from("/pk/"),r=t.from("/ipns/");return{routingPubKey:new o(t.concat([n,e])),pkKey:new o(k(t.concat([n,e]))),routingKey:new o(t.concat([r,e])),ipnsKey:new o(k(t.concat([r,e])))}},x=(e,t,n,r,i)=>{const o=A(t,n,r);e.sign(o,(e,t)=>e?i(e):i(null,t))},C=e=>{if("0"===e.toString())return"EOL";{const t=`unrecognized validity type ${e.toString()}`;throw c.error(t),Object.assign(new Error(t),{code:p.ERR_UNRECOGNIZED_VALIDITY})}},A=(e,n,r)=>{const i=t.from(e),o=t.from(C(n)),s=t.from(r);return t.concat([i,s,o])},I=e=>{const t=u.decode(e.id);return t.code!==d?null:s.keys.unmarshalPublicKey(t.digest)},T=f.encode,j=f.decode,O={validate:(e,t,n)=>{const r=j(e),i=t.slice("/ipns/".length);let o;try{o=a.createFromBytes(i)}catch(e){return n(e)}_(o,r,(e,t)=>{if(e)return n(e);v(t,r,e=>{if(e)return n(e);n(null,!0)})})},select:(e,t,n)=>{const r=j(e),i=j(t),o=r.sequence>i.sequence?0:1;if("function"!=typeof n)return o;n(null,o)}};e.exports={create:g,createWithExpiration:y,validate:v,embedPublicKey:w,extractPublicKey:_,getLocalKey:S,getIdKeys:E,marshal:T,unmarshal:j,validator:O,namespace:"/ipns/",namespaceLength:"/ipns/".length}}).call(this,n(0).Buffer)},function(e,t,n){const r=n(6).EventEmitter,i=n(18),o=n(1120);function s(e,t){"object"==typeof e&&(t=e,e="START"),i.equal(typeof e,"string"),i.equal(typeof t,"object"),i.ok(t[e],"invalid starting state "+e),i.ok(o.validate(t));const n=new r;return u._graph=o.reachable(t),u._emitter=n,u._events=t,u._state=e,u.emit=u,u.on=s,u;function s(e,t){n.on(e,t)}function u(e){const t=u._events[u._state][e];if(!a(u._state,t,u._graph)){const t="invalid transition: "+u._state+" -> "+e;return n.emit("error",t)}const r=u._state+":leave",i=t+":enter";return u._state?o():s();function o(){n._events[r]?n.emit(r,s):s()}function s(){n._events[i]?n.emit(i,l):l()}function l(){u._state=t,n.emit(t),n.emit("done")}}}function a(e,t,n){if(!t)return!1;if(!e)return!0;const r=n[e];return!(!r||!r[t])&&1===r[t].length}e.exports=s},function(e,t,n){"use strict";const r=n(24),i=n(44),o=n(23),s=n(186);e.exports=function(e){function t(e){let t=null;if(r.isMultiaddr(e)){const n=r(e);t=n.getPeerId()}else i.isPeerInfo(e)&&(t=e.id.toB58String());return t}function n(t){let n;if(i.isPeerInfo(t))n=t;else if(r.isMultiaddr(t)){const r=t.getPeerId();try{n=e._peerBook.get(r)}catch(e){n=new i(o.createFromB58String(r))}n.multiaddrs.add(t)}else if(o.isPeerId(t)){const r=t.toB58String();n=e._peerBook.has(r)?e._peerBook.get(r):t}return n}function a(t){return e.muxedConns[t]||e.conns[t]}function u(e,t,n){return n=n||(()=>{}),e.write(s.CircuitRelay.encode({type:s.CircuitRelay.Type.STATUS,code:t})),n()}function l(e,t,n,i){try{e.dstPeer.addrs.forEach(e=>r(e))}catch(e){return u(t,n===s.CircuitRelay.Type.HOP?s.CircuitRelay.Status.HOP_DST_MULTIADDR_INVALID:s.CircuitRelay.Status.STOP_DST_MULTIADDR_INVALID),i(e)}try{e.srcPeer.addrs.forEach(e=>r(e))}catch(e){return u(t,n===s.CircuitRelay.Type.HOP?s.CircuitRelay.Status.HOP_SRC_MULTIADDR_INVALID:s.CircuitRelay.Status.STOP_SRC_MULTIADDR_INVALID),i(e)}return i(null)}function c(e){return"string"==typeof e?o.createFromB58String(e):o.createFromBytes(e)}return{getB58String:t,peerInfoFromMa:n,isPeerConnected:a,validateAddrs:l,writeResponse:u,peerIdFromId:c}}},function(e,t,n){"use strict";const r=n(71);e.exports=r("\nmessage CircuitRelay {\n\n enum Status {\n SUCCESS = 100;\n HOP_SRC_ADDR_TOO_LONG = 220;\n HOP_DST_ADDR_TOO_LONG = 221;\n HOP_SRC_MULTIADDR_INVALID = 250;\n HOP_DST_MULTIADDR_INVALID = 251;\n HOP_NO_CONN_TO_DST = 260;\n HOP_CANT_DIAL_DST = 261;\n HOP_CANT_OPEN_DST_STREAM = 262;\n HOP_CANT_SPEAK_RELAY = 270;\n HOP_CANT_RELAY_TO_SELF = 280;\n STOP_SRC_ADDR_TOO_LONG = 320;\n STOP_DST_ADDR_TOO_LONG = 321;\n STOP_SRC_MULTIADDR_INVALID = 350;\n STOP_DST_MULTIADDR_INVALID = 351;\n STOP_RELAY_REFUSED = 390;\n MALFORMED_MESSAGE = 400;\n }\n\n enum Type { // RPC identifier, either HOP, STOP or STATUS\n HOP = 1;\n STOP = 2;\n STATUS = 3;\n CAN_HOP = 4;\n }\n\n message Peer {\n required bytes id = 1; // peer id\n repeated bytes addrs = 2; // peer's known addresses\n }\n\n optional Type type = 1; // Type of the message\n\n optional Peer srcPeer = 2; // srcPeer and dstPeer are used when Type is HOP or STATUS\n optional Peer dstPeer = 3;\n\n optional Status code = 4; // Status code, used when Type is STATUS\n}\n")},function(e,t,n){"use strict";const r=n(3),i=n(88),o=n(65),s=n(9),a="ERR_BAD_PATH";function u(e){const t=new Error("invalid ipfs ref path");e=e.replace(/^\/ipfs\//,"");const n=e.match(/([^/]+(?:\/[^/]+)*)\/?$/);if(!n)throw t;const[r,...i]=n[1].split("/");if(o.cid(r))return{hash:r,links:i};throw t}t.OFFLINE_ERROR="This command must be run in online mode. Try running 'ipfs daemon' first.";const l=e=>{if(o.cid(e))return`/ipfs/${e}`;if(o.path(e))return e;throw Object.assign(new Error(`invalid ${e} path`),{code:a})},c=r(function(e,n,r){Array.isArray(n)||(n=[n]),i(n,(n,r)=>{if("string"!=typeof n){let e;try{e=new s(n)}catch(e){return r(e)}return r(null,e.buffer)}let i;try{i=t.parseIpfsPath(n)}catch(e){return r(e)}const o=new s(i.hash),a=i.links;if(!a.length)return r(null,o.buffer);function u(t,n,i,o){if(i)return r(i);if(!n.length)return r(null,t.buffer);const s=n[0],a=o.links.find(e=>e.name===s);if(!a)return r(new Error(`no link named "${s}" under ${t.toBaseEncodedString()}`));e.get(a.cid,u.bind(null,a.cid,n.slice(1)))}e.get(o,u.bind(null,o,a))},r)});t.normalizePath=l,t.parseIpfsPath=u,t.resolvePath=c},function(e,t){function n(e){return"function"==typeof e}function r(e){return"object"==typeof e&&i(e.source)&&o(e.sink)}function i(e){return n(e)&&2===e.length}function o(e){return n(e)&&1===e.length}t.isDuplex=r,t.isSource=i,t.isSink=o},function(e,t,n){var r=n(525);e.exports=function(e,t){return function(n){var i=[],o,s;function a(e){i.push(e)}e=e||function(e){this.queue(e)},t=t||function(){this.queue(null)};var u={emit:function(e,t){"data"==e&&a(t),"end"==e&&(o=!0,a(null)),"error"==e&&(s=t)},queue:a},l;return function(a,c){if(o=o||a,a)return n(a,function(){if(l){var e=l;l=null,e(a)}c(a)});l=c,r(function r(a){if(l)if(c=l,s)l=null,c(s);else if(i.length){var f=i.shift();l=null,c(null===f,f)}else n(o,function(i,f){if(i&&!0!==i)return s=i,a();if(o=o||i)t.call(u);else if(null!==f&&(e.call(u,f),s||o))return n(s||o,function(){l=null,c(s||o)});a(r)})})}}}},function(e,t,n){var r=t;r.utils=n(93),r.common=n(191),r.sha=n(1337),r.ripemd=n(1341),r.hmac=n(1342),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},function(e,t,n){"use strict";var r=n(93),i=n(107);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=o,o.prototype.update=function e(t,n){if(t=r.toArray(t,n),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var i=t.length%this._delta8;this.pending=t.slice(t.length-i,t.length),0===this.pending.length&&(this.pending=null),t=r.join32(t,0,t.length-i,this.endian);for(var o=0;o>>24&255,i[o++]=t>>>16&255,i[o++]=t>>>8&255,i[o++]=255&t}else for(i[o++]=255&t,i[o++]=t>>>8&255,i[o++]=t>>>16&255,i[o++]=t>>>24&255,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,s=8;st.length)throw new Error("invalid rlp: total length is larger than the data");if(s=t.slice(r,f),0===s.length)throw new Error("invalid rlp, List has a invalid length");for(;s.length;)a=l(s),u.push(a.data),s=a.remainder;return{data:u,remainder:t.slice(f)}}function c(e){return"0x"===e.slice(0,2)}function f(e){return"string"!=typeof e?e:c(e)?e.slice(2):e}function h(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");var t=e.toString(16);return t.length%2?"0"+t:t}function p(e){return e.length%2?"0"+e:e}function d(t){var n=h(t);return e.from(n,"hex")}function m(t){if(!e.isBuffer(t)){if("string"==typeof t)return c(t)?e.from(p(f(t)),"hex"):e.from(t);if("number"==typeof t)return t?d(t):e.from([]);if(null===t||void 0===t)return e.from([]);if(t instanceof Uint8Array)return e.from(t);if(r.isBN(t))return e.from(t.toArray());throw new Error("invalid type")}return t}t.encode=i,t.decode=a,t.getLength=u}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(9),i=n(35);function o(e,t,n){n=n||{};const o=n.hashAlg||"keccak-256",s=void 0===n.version?1:n.version,a=i.encode(t,o);return new r(s,e,a)}e.exports=o},function(e,t,n){"use strict";const r=n(11),i=n(588),o=n(589);function s(e,t,n){const s=o(e,t),a={multicodec:e,defaultHashAlg:"keccak-256",resolve:c,tree:u,isLink:i(c),_resolveFromEthObject:f,_treeFromEthObject:l,_mapFromEthObject:n};return{resolver:a,util:s};function u(e,t,n){"function"==typeof t&&(n=t,t=void 0),t||(t={}),r([t=>s.deserialize(e,t),(e,n)=>l(e,t,n)],n)}function l(e,t,i){r([r=>n(e,t,r),(e,t)=>t(null,e.map(e=>e.path))],i)}function c(e,t,n){r([t=>s.deserialize(e,t),(e,n)=>f(e,t,n)],n)}function f(e,t,r){if(!t||"/"===t){const t={value:e,remainderPath:""};return r(null,t)}n(e,{},(e,n)=>{if(e)return r(e);const i=t.split("/");let o=n.filter(e=>e.path===t.slice(0,e.path.length));o=o.filter(e=>e.path.split("/").every((e,t)=>e===i[t]));const s=o.sort((e,t)=>t.path.length-e.path.length),a=s[0];if(!a){let e=new Error('Path not found ("'+t+'").');return r(e)}const u=t.slice(a.path.length+1),l={value:a.value,remainderPath:u};return r(null,l)})}}e.exports=s},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(274),o=n(0),s=n(60).sha256sha256,a=function e(n){if(!(this instanceof e))return new e(n);if(t.isBuffer(n)){var r=n;this.fromBuffer(r)}else if("string"==typeof n){var i=n;this.fromString(i)}else n&&this.set(n)};a.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},a.validChecksum=function e(t,n){return r.isString(t)&&(t=new o.Buffer(i.decode(t))),r.isString(n)&&(n=new o.Buffer(i.decode(n))),n||(n=t.slice(-4),t=t.slice(0,-4)),a.checksum(t).toString("hex")===n.toString("hex")},a.decode=function(e){if("string"!=typeof e)throw new Error("Input must be a string");var n=new t(i.decode(e));if(n.length<4)throw new Error("Input string too short");var r=n.slice(0,-4),o=n.slice(-4),a=s(r),u=a.slice(0,4);if(o.toString("hex")!==u.toString("hex"))throw new Error("Checksum mismatch");return r},a.checksum=function(e){return s(e).slice(0,4)},a.encode=function(e){if(!t.isBuffer(e))throw new Error("Input must be a buffer");var n=new t(e.length+4),r=a.checksum(e);return e.copy(n),r.copy(n,e.length),i.encode(n)},a.prototype.fromBuffer=function(e){return this.buf=e,this},a.prototype.fromString=function(e){var t=a.decode(e);return this.buf=t,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(17),i=n(25),o=n(84),s=n(80),a=n(0),u=n(30),l=n(41),c=n(86),f=n(110),h=n(111),p=4294967295,d=p-2,m=p,g=p-1;function y(e){return this instanceof y?e?this._fromObject(e):void 0:new y(e)}y.MAXINT=p,y.DEFAULT_SEQNUMBER=4294967295,y.DEFAULT_LOCKTIME_SEQNUMBER=4294967294,y.DEFAULT_RBF_SEQNUMBER=4294967293,Object.defineProperty(y.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new c(this._scriptBuffer),this._script._isInput=!0),this._script)}}),y.fromObject=function(e){i.checkArgument(r.isObject(e));var t=new y;return t._fromObject(e)},y.prototype._fromObject=function(e){var t;if(t=r.isString(e.prevTxId)&&l.isHexa(e.prevTxId)?new a.Buffer(e.prevTxId,"hex"):e.prevTxId,this.output=e.output?e.output instanceof h?e.output:new h(e.output):void 0,this.prevTxId=t||e.txidbuf,this.outputIndex=r.isUndefined(e.outputIndex)?e.txoutnum:e.outputIndex,this.sequenceNumber=r.isUndefined(e.sequenceNumber)?r.isUndefined(e.seqnum)?4294967295:e.seqnum:e.sequenceNumber,r.isUndefined(e.script)&&r.isUndefined(e.scriptBuffer))throw new o.Transaction.Input.MissingScript;return this.setScript(e.scriptBuffer||e.script),this},y.prototype.toObject=y.prototype.toJSON=function e(){var t={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(t.scriptString=this.script.toString()),this.output&&(t.output=this.output.toObject()),t},y.fromBufferReader=function(e){var t=new y;return t.prevTxId=e.readReverse(32),t.outputIndex=e.readUInt32LE(),t._scriptBuffer=e.readVarLengthBuffer(),t.sequenceNumber=e.readUInt32LE(),t},y.prototype.toBufferWriter=function(e){e||(e=new s),e.writeReverse(this.prevTxId),e.writeUInt32LE(this.outputIndex);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e.writeUInt32LE(this.sequenceNumber),e},y.prototype.setScript=function(e){if(this._script=null,e instanceof c)this._script=e,this._script._isInput=!0,this._scriptBuffer=e.toBuffer();else if(l.isHexa(e))this._scriptBuffer=new a.Buffer(e,"hex");else if(r.isString(e))this._script=new c(e),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else{if(!u.isBuffer(e))throw new TypeError("Invalid argument type: script");this._scriptBuffer=new a.Buffer(e)}return this},y.prototype.getSignatures=function(){throw new o.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))},y.prototype.isFullySigned=function(){throw new o.AbstractMethodInvoked("Input#isFullySigned")},y.prototype.isFinal=function(){return 4294967295!==this.sequenceNumber},y.prototype.addSignature=function(){throw new o.AbstractMethodInvoked("Input#addSignature")},y.prototype.clearSignatures=function(){throw new o.AbstractMethodInvoked("Input#clearSignatures")},y.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,f.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script)},y.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},y.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},e.exports=y},function(e,t){"function"==typeof Object.create?e.exports=function e(t,n){t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function e(t,n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(25),o=n(198),s=n(30),a=n(41),u=n(96),l=n(84),c=n(85);function f(e){if(!(this instanceof f))return new f(e);if(e instanceof f)return e;if(r.isObject(e))return this._fromObject(e);throw new l.InvalidArgument("TransactionSignatures must be instantiated from an object")}o(f,c),f.prototype._fromObject=function(e){return this._checkObjectArgs(e),this.publicKey=new u(e.publicKey),this.prevTxId=s.isBuffer(e.prevTxId)?e.prevTxId:new t(e.prevTxId,"hex"),this.outputIndex=e.outputIndex,this.inputIndex=e.inputIndex,this.signature=e.signature instanceof c?e.signature:s.isBuffer(e.signature)?c.fromBuffer(e.signature):c.fromString(e.signature),this.sigtype=e.sigtype,this},f.prototype._checkObjectArgs=function(e){i.checkArgument(u(e.publicKey),"publicKey"),i.checkArgument(!r.isUndefined(e.inputIndex),"inputIndex"),i.checkArgument(!r.isUndefined(e.outputIndex),"outputIndex"),i.checkState(r.isNumber(e.inputIndex),"inputIndex must be a number"),i.checkState(r.isNumber(e.outputIndex),"outputIndex must be a number"),i.checkArgument(e.signature,"signature"),i.checkArgument(e.prevTxId,"prevTxId"),i.checkState(e.signature instanceof c||s.isBuffer(e.signature)||a.isHexa(e.signature),"signature must be a buffer or hexa value"),i.checkState(s.isBuffer(e.prevTxId)||a.isHexa(e.prevTxId),"prevTxId must be a buffer or hexa value"),i.checkArgument(e.sigtype,"sigtype"),i.checkState(r.isNumber(e.sigtype),"sigtype must be a number")},f.prototype.toObject=f.prototype.toJSON=function e(){return{publicKey:this.publicKey.toString(),prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,inputIndex:this.inputIndex,signature:this.signature.toString(),sigtype:this.sigtype}},f.fromObject=function(e){return i.checkArgument(e),new f(e)},e.exports=f}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var r=n(20).Writable,i=n(1),o=n(278);if("undefined"==typeof Uint8Array)var s=n(1461).Uint8Array;else var s=Uint8Array;function a(e,t){if(!(this instanceof a))return new a(e,t);"function"==typeof e&&(t=e,e={}),e||(e={});var n=e.encoding,i=!1;n?(n=String(n).toLowerCase(),"u8"!==n&&"uint8"!==n||(n="uint8array")):i=!0,r.call(this,{objectMode:!0}),this.encoding=n,this.shouldInferEncoding=i,t&&this.on("finish",function(){t(this.getBody())}),this.body=[]}e.exports=a,i(a,r),a.prototype._write=function(e,t,n){this.body.push(e),n()},a.prototype.inferEncoding=function(e){var n=void 0===e?this.body[0]:e;return t.isBuffer(n)?"buffer":"undefined"!=typeof Uint8Array&&n instanceof Uint8Array?"uint8array":Array.isArray(n)?"array":"string"==typeof n?"string":"[object Object]"===Object.prototype.toString.call(n)?"object":"buffer"},a.prototype.getBody=function(){return this.encoding||0!==this.body.length?(this.shouldInferEncoding&&(this.encoding=this.inferEncoding()),"array"===this.encoding?p(this.body):"string"===this.encoding?f(this.body):"buffer"===this.encoding?h(this.body):"uint8array"===this.encoding?d(this.body):this.body):[]};var u=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)};function l(e){return/Array\]$/.test(Object.prototype.toString.call(e))}function c(e){return"string"==typeof e||l(e)||e&&"function"==typeof e.subarray}function f(e){for(var n=[],r=!1,i=0;in=>{let f,h=!1,p=!1;n=n?Object.assign({},n,n.qs):{};const d=new u,m=new r({objectMode:!0});m._read=(e=>{}),m._write=((e,t,r)=>{const o=s(r);try{const r=a(e,n).map(e=>Object.assign({headers:l(e)},e));p=!0,i(r,(e,n)=>d.write(e,t,n),e=>{if(p=!1,e)return o(e);h&&d.end(),o()})}catch(e){o(e)}}),m.once("finish",()=>{h||(h=!0,p||d.end())});const g=n.qs||{};g["cid-version"]=c(n,"cid-version","cidVersion"),g["raw-leaves"]=c(n,"raw-leaves","rawLeaves"),g["only-hash"]=c(n,"only-hash","onlyHash"),g["wrap-with-directory"]=c(n,"wrap-with-directory","wrapWithDirectory"),g.hash=c(n,"hash","hashAlg");const y={path:t,qs:g,args:n.args,multipart:!0,multipartBoundary:d._boundary,stream:!0,recursive:!0,progress:n.progress};return d.on("error",e=>{m.emit("error",e)}),f=e(y,(e,t)=>{if(e)return m.emit("error",e);if(!t)return m.push(null);if(!o(t))return m.push(t),void m.push(null);if(t.on("error",e=>m.emit("error",e)),n.converter){t.on("data",e=>{e.Bytes&&n.progress&&n.progress(e.Bytes)});const e=n.converter,r=new e;r.once("end",()=>m.push(null)),r.on("data",e=>m.push(e)),t.pipe(r)}else t.on("data",e=>{e.Bytes&&n.progress&&n.progress(e.Bytes),m.push(e)}),t.once("end",()=>m.push(null))}),f.on("drain",()=>d.emit("drain")),d.pipe(f),m})},function(e,t){e.exports=!1},function(e,t,n){var r=n(154),i=n(32),o=e.exports;for(var s in r)r.hasOwnProperty(s)&&(o[s]=r[s]);function a(e){if("string"==typeof e&&(e=i.parse(e)),e.protocol||(e.protocol="https:"),"https:"!==e.protocol)throw new Error('Protocol "'+e.protocol+'" not supported. Expected "https:"');return e}o.request=function(e,t){return e=a(e),r.request.call(this,e,t)},o.get=function(e,t){return e=a(e),r.get.call(this,e,t)}},function(e,t,n){"use strict";var r=n(10),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=f;var o=n(7);o.inherits=n(1);var s=n(1492),a=n(1496);o.inherits(f,s);for(var u=i(a.prototype),l=0;l>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")}e.exports=l,e.exports.sync=u},function(e,t,n){e.exports=d;var r=n(27),i=n(31).Buffer,o=n(55),s=n(15),a=n(97),u=n(46),l=n(50),c=n(212),f=n(47),h=a.FingerprintFormatError,p=a.InvalidAlgorithmError;function d(e){if(r.object(e,"options"),r.string(e.type,"options.type"),r.buffer(e.hash,"options.hash"),r.string(e.algorithm,"options.algorithm"),this.algorithm=e.algorithm.toLowerCase(),!0!==o.hashAlgs[this.algorithm])throw new p(this.algorithm);this.hash=e.hash,this.type=e.type,this.hashType=e.hashType}d.prototype.toString=function(e){switch(void 0===e&&(e="md5"===this.algorithm||"spki"===this.hashType?"hex":"base64"),r.string(e),e){case"hex":return"spki"===this.hashType?this.hash.toString("hex"):y(this.hash.toString("hex"));case"base64":return"spki"===this.hashType?this.hash.toString("base64"):v(this.algorithm,this.hash.toString("base64"));default:throw new h(void 0,e)}},d.prototype.matches=function(e){r.object(e,"key or certificate"),"key"===this.type&&"ssh"!==this.hashType?(f.assertCompatible(e,u,[1,7],"key with spki"),l.isPrivateKey(e)&&f.assertCompatible(e,l,[1,6],"privatekey with spki support")):"key"===this.type?f.assertCompatible(e,u,[1,0],"key"):f.assertCompatible(e,c,[1,0],"certificate");var t=e.hash(this.algorithm,this.hashType),n=s.createHash(this.algorithm).update(t).digest("base64");return void 0===this.hash2&&(this.hash2=s.createHash(this.algorithm).update(this.hash).digest("base64")),this.hash2===n};var m=/^[A-Za-z0-9+\/=]+$/,g=/^[a-fA-F0-9]+$/;function y(e){return e.replace(/(.{2})(?=.)/g,"$1:")}function b(e){return e.replace(/=*$/,"")}function v(e,t){return e.toUpperCase()+":"+b(t)}d.parse=function(e,t){var n,s,a;r.string(e,"fingerprint"),Array.isArray(t)&&(a=t,t={}),r.optionalObject(t,"options"),void 0===t&&(t={}),void 0!==t.enAlgs&&(a=t.enAlgs),void 0!==t.algorithms&&(a=t.algorithms),r.optionalArrayOfString(a,"algorithms");var u="ssh";void 0!==t.hashType&&(u=t.hashType),r.string(u,"options.hashType");var l=e.split(":");if(2==l.length){if(n=l[0].toLowerCase(),!m.test(l[1]))throw new h(e);try{s=i.from(l[1],"base64")}catch(t){throw new h(e)}}else if(l.length>2){if(n="md5","md5"===l[0].toLowerCase()&&(l=l.slice(1)),l=l.map(function(t){for(;t.length<2;)t="0"+t;if(t.length>2)throw new h(e);return t}),l=l.join(""),!g.test(l)||l.length%2!=0)throw new h(e);try{s=i.from(l,"hex")}catch(t){throw new h(e)}}else{if(g.test(e))s=i.from(e,"hex");else{if(!m.test(e))throw new h(e);s=i.from(e,"base64")}switch(s.length){case 32:n="sha256";break;case 16:n="md5";break;case 20:n="sha1";break;case 64:n="sha512";break;default:throw new h(e)}void 0===t.hashType&&(u="spki")}if(void 0===n)throw new h(e);if(void 0===o.hashAlgs[n])throw new p(n);if(void 0!==a&&(a=a.map(function(e){return e.toLowerCase()}),-1===a.indexOf(n)))throw new p(n);return new d({algorithm:n,hash:s,type:t.type||"key",hashType:u})},d.isFingerprint=function(e,t){return f.isCompatible(e,d,t)},d.prototype._sshpkApiVersion=[1,2],d._oldVersionDetect=function(e){return r.func(e.toString),r.func(e.matches),[1,0]}},function(e,t,n){(function(){var n,r=0xdeadbeefcafe,i=!0;function o(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new o(null)}function a(e,t,n,r,i,o){for(;--o>=0;){var s=t*this[e++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i}function u(e,t,n,r,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var u=32767&this[e],l=this[e++]>>15,c=a*u+l*s;u=s*u+((32767&c)<<15)+n[r]+(1073741823&i),i=(u>>>30)+(c>>>15)+a*l+(i>>>30),n[r++]=1073741823&u}return i}function l(e,t,n,r,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var u=16383&this[e],l=this[e++]>>14,c=a*u+l*s;u=s*u+((16383&c)<<14)+n[r]+i,i=(u>>28)+(c>>14)+a*l,n[r++]=268435455&u}return i}var c="undefined"!=typeof navigator;c&&"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=u,n=30):c&&"Netscape"!=navigator.appName?(o.prototype.am=a,n=26):(o.prototype.am=l,n=28),o.prototype.DB=n,o.prototype.DM=(1<=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function v(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function w(e){var t=s();return t.fromInt(e),t}function _(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,s=0;--r>=0;){var a=8==n?255&e[r]:y(e,r);a<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==s?this[this.t++]=a:s+n>this.DB?(this[this.t-1]|=(a&(1<>this.DB-s):this[this.t-1]|=a<=this.DB&&(s-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==e;)--this.t}function S(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n=(1<0)for(a>a)>0&&(i=!0,o=g(r));s>=0;)a>(a+=this.DB-t)):(r=this[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=g(r));return i?o:"0"}function E(){var e=s();return o.ZERO.subTo(this,e),e}function x(){return this.s<0?this.negate():this}function C(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(t=n-e.t,0!=t)return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0}function A(e){var t=1,n;return 0!=(n=e>>>16)&&(e=n,t+=16),0!=(n=e>>8)&&(e=n,t+=8),0!=(n=e>>4)&&(e=n,t+=4),0!=(n=e>>2)&&(e=n,t+=2),0!=(n=e>>1)&&(e=n,t+=1),t}function I(){return this.t<=0?0:this.DB*(this.t-1)+A(this[this.t-1]^this.s&this.DM)}function T(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s}function j(e,t){for(var n=e;n=0;--a)t[a+o+1]=this[a]>>r|s,s=(this[a]&i)<=0;--a)t[a]=0;t[o]=s,t.t=this.t+o+1,t.s=this.s,t.clamp()}function P(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<>r;for(var s=n+1;s>r;r>0&&(t[this.t-n-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()}function R(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t[i]=0;for(i=0;i=0;)e[n]=0;for(n=0;n=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()}function M(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t0?(r.lShiftTo(c,a),i.lShiftTo(c,n)):(r.copyTo(a),i.copyTo(n));var f=a.t,h=a[f-1];if(0!=h){var p=h*(1<1?a[f-2]>>this.F2:0),d=this.FV/p,m=(1<=0&&(n[n.t++]=1,n.subTo(v,n)),o.ONE.dlShiftTo(f,v),v.subTo(a,a);a.t=0;){var w=n[--y]==h?this.DM:Math.floor(n[y]*d+(n[y-1]+g)*m);if((n[y]+=a.am(0,w,n,b,0,f))0&&n.rShiftTo(c,n),u<0&&o.ZERO.subTo(n,n)}}}function L(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(o.ZERO)>0&&e.subTo(t,t),t}function F(e){this.m=e}function D(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function U(e){return e}function z(e){e.divRemTo(this.m,null,e)}function q(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function K(e,t){e.squareTo(t),this.reduce(t)}function H(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function V(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function $(e){var t=s();return e.copyTo(t),this.reduce(t),t}function G(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function Y(e,t){e.squareTo(t),this.reduce(t)}function J(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function Z(){return 0==(this.t>0?1&this[0]:this.s)}function Q(e,t){if(e>4294967295||e<1)return o.ONE;var n=s(),r=s(),i=t.convert(this),a=A(e)-1;for(i.copyTo(n);--a>=0;)if(t.sqrTo(n,r),(e&1<0)t.mulTo(r,i,n);else{var u=n;n=r,r=u}return t.revert(n)}function X(e,t){var n;return n=e<256||t.isEven()?new F(t):new V(t),this.exp(e,n)}function ee(){var e=s();return this.copyTo(e),e}function te(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function re(){return 0==this.t?this.s:this[0]<<16>>16}function ie(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function oe(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function se(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),r=w(n),i=s(),o=s(),a="";for(this.divRemTo(r,i,o);i.signum()>0;)a=(n+o.intValue()).toString(e).substr(1)+a,i.divRemTo(r,i,o);return o.intValue().toString(e)+a}function ae(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),r=Math.pow(t,n),i=!1,s=0,a=0,u=0;u=n&&(this.dMultiply(r),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(a,0)),i&&o.ZERO.subTo(this,this)}function ue(e,t,n){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(o.ONE.shiftLeft(e-1),ge,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(o.ONE.shiftLeft(e-1),this);else{var r=new Array,i=7&e;r.length=1+(e>>3),t.nextBytes(r),i>0?r[0]&=(1<0)for(n>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<=0;)n<8?(r=(this[e]&(1<>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t}function ce(e){return 0==this.compareTo(e)}function fe(e){return this.compareTo(e)<0?this:e}function he(e){return this.compareTo(e)>0?this:e}function pe(e,t,n){var r,i,o=Math.min(e.t,this.t);for(r=0;r>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function Ce(){for(var e=0;e=this.t?0!=this.s:0!=(this[t]&1<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()}function Ne(e){var t=s();return this.addTo(e,t),t}function Me(e){var t=s();return this.subTo(e,t),t}function Le(e){var t=s();return this.multiplyTo(e,t),t}function Fe(){var e=s();return this.squareTo(e),e}function De(e){var t=s();return this.divRemTo(e,t,null),t}function Ue(e){var t=s();return this.divRemTo(e,null,t),t}function ze(e){var t=s(),n=s();return this.divRemTo(e,t,n),new Array(t,n)}function qe(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Ke(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function He(){}function Ve(e){return e}function We(e,t,n){e.multiplyTo(t,n)}function $e(e,t){e.squareTo(t)}function Ge(e){return this.exp(e,new He)}function Ye(e,t,n){var r=Math.min(this.t+e.t,t),i;for(n.s=0,n.t=r;r>0;)n[--r]=0;for(i=n.t-this.t;r=0;)n[r]=0;for(r=Math.max(t-this.t,0);r2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t}function Xe(e){return e}function et(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function tt(e,t){e.squareTo(t),this.reduce(t)}function nt(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function rt(e,t){var n=e.bitLength(),r,i=w(1),o;if(n<=0)return i;r=n<18?1:n<48?3:n<144?4:n<768?5:6,o=n<8?new F(t):t.isEven()?new Ze(t):new V(t);var a=new Array,u=3,l=r-1,c=(1<1){var f=s();for(o.sqrTo(a[1],f);u<=c;)a[u]=s(),o.mulTo(f,a[u-2],a[u]),u+=2}var h=e.t-1,p,d=!0,m=s(),g;for(n=A(e[h])-1;h>=0;){for(n>=l?p=e[h]>>n-l&c:(p=(e[h]&(1<0&&(p|=e[h-1]>>this.DB+n-l)),u=r;0==(1&p);)p>>=1,--u;if((n-=u)<0&&(n+=this.DB,--h),d)a[p].copyTo(i),d=!1;else{for(;u>1;)o.sqrTo(i,m),o.sqrTo(m,i),u-=2;u>0?o.sqrTo(i,m):(g=i,i=m,m=g),o.mulTo(m,a[p],i)}for(;h>=0&&0==(e[h]&1<0&&(t.rShiftTo(o,t),n.rShiftTo(o,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n}function ot(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this[r])%e;return n}function st(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return o.ZERO;for(var n=e.clone(),r=this.clone(),i=w(1),s=w(0),a=w(0),u=w(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),t?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;r.isEven();)r.rShiftTo(1,r),t?(a.isEven()&&u.isEven()||(a.addTo(this,a),u.subTo(e,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);n.compareTo(r)>=0?(n.subTo(r,n),t&&i.subTo(a,i),s.subTo(u,s)):(r.subTo(n,r),t&&a.subTo(i,a),u.subTo(s,u))}return 0!=r.compareTo(o.ONE)?o.ZERO:u.compareTo(e)>=0?u.subtract(e):u.signum()<0?(u.addTo(e,u),u.signum()<0?u.add(e):u):u}F.prototype.convert=D,F.prototype.revert=U,F.prototype.reduce=z,F.prototype.mulTo=q,F.prototype.sqrTo=K,V.prototype.convert=W,V.prototype.revert=$,V.prototype.reduce=G,V.prototype.mulTo=J,V.prototype.sqrTo=Y,o.prototype.copyTo=b,o.prototype.fromInt=v,o.prototype.fromString=_,o.prototype.clamp=k,o.prototype.dlShiftTo=T,o.prototype.drShiftTo=j,o.prototype.lShiftTo=O,o.prototype.rShiftTo=P,o.prototype.subTo=B,o.prototype.multiplyTo=R,o.prototype.squareTo=N,o.prototype.divRemTo=M,o.prototype.invDigit=H,o.prototype.isEven=Z,o.prototype.exp=Q,o.prototype.toString=S,o.prototype.negate=E,o.prototype.abs=x,o.prototype.compareTo=C,o.prototype.bitLength=I,o.prototype.mod=L,o.prototype.modPowInt=X,o.ZERO=w(0),o.ONE=w(1),He.prototype.convert=Ve,He.prototype.revert=Ve,He.prototype.mulTo=We,He.prototype.sqrTo=$e,Ze.prototype.convert=Qe,Ze.prototype.revert=Xe,Ze.prototype.reduce=et,Ze.prototype.mulTo=nt,Ze.prototype.sqrTo=tt;var at=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],ut=(1<<26)/at[at.length-1],lt,ct,ft;function ht(e){var t,n=this.abs();if(1==n.t&&n[0]<=at[at.length-1]){for(t=0;t>1,e>at.length&&(e=at.length);for(var i=s(),a=0;a>8&255,ct[ft++]^=e>>16&255,ct[ft++]^=e>>24&255,ft>=Ct&&(ft-=Ct)}function mt(){dt((new Date).getTime())}if(o.prototype.chunkSize=ie,o.prototype.toRadix=se,o.prototype.fromRadix=ae,o.prototype.fromNumber=ue,o.prototype.bitwiseTo=pe,o.prototype.changeBit=je,o.prototype.addTo=Re,o.prototype.dMultiply=qe,o.prototype.dAddOffset=Ke,o.prototype.multiplyLowerTo=Ye,o.prototype.multiplyUpperTo=Je,o.prototype.modInt=ot,o.prototype.millerRabin=pt,o.prototype.clone=ee,o.prototype.intValue=te,o.prototype.byteValue=ne,o.prototype.shortValue=re,o.prototype.signum=oe,o.prototype.toByteArray=le,o.prototype.equals=ce,o.prototype.min=fe,o.prototype.max=he,o.prototype.and=me,o.prototype.or=ye,o.prototype.xor=ve,o.prototype.andNot=_e,o.prototype.not=ke,o.prototype.shiftLeft=Se,o.prototype.shiftRight=Ee,o.prototype.getLowestSetBit=Ce,o.prototype.bitCount=Ie,o.prototype.testBit=Te,o.prototype.setBit=Oe,o.prototype.clearBit=Pe,o.prototype.flipBit=Be,o.prototype.add=Ne,o.prototype.subtract=Me,o.prototype.multiply=Le,o.prototype.divide=De,o.prototype.remainder=Ue,o.prototype.divideAndRemainder=ze,o.prototype.modPow=rt,o.prototype.modInverse=st,o.prototype.pow=Ge,o.prototype.gcd=it,o.prototype.isProbablePrime=ht,o.prototype.square=Fe,o.prototype.Barrett=Ze,null==ct){var gt;if(ct=new Array,ft=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var yt=new Uint8Array(32);for(window.crypto.getRandomValues(yt),gt=0;gt<32;++gt)ct[ft++]=yt[gt]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var bt=window.crypto.random(32);for(gt=0;gt>>8,ct[ft++]=255>ft=0,mt()}function vt(){if(null==lt){for(mt(),lt=xt(),lt.init(ct),ft=0;ft>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=255&r}function m(e,t,n,r,i){var o,s=0;for(o=0;o>>8)-1}function g(e,t,n,r){return m(e,t,n,r,16)}function y(e,t,n,r){return m(e,t,n,r,32)}function b(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,l=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,b=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,v=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,w=i,_=o,k=s,S=a,E=u,x=l,C=c,A=f,I=h,T=p,j=d,O=m,P=g,B=y,R=b,N=v,M,L=0;L<20;L+=2)M=w+P|0,E^=M<<7|M>>>25,M=E+w|0,I^=M<<9|M>>>23,M=I+E|0,P^=M<<13|M>>>19,M=P+I|0,w^=M<<18|M>>>14,M=x+_|0,T^=M<<7|M>>>25,M=T+x|0,B^=M<<9|M>>>23,M=B+T|0,_^=M<<13|M>>>19,M=_+B|0,x^=M<<18|M>>>14,M=j+C|0,R^=M<<7|M>>>25,M=R+j|0,k^=M<<9|M>>>23,M=k+R|0,C^=M<<13|M>>>19,M=C+k|0,j^=M<<18|M>>>14,M=N+O|0,S^=M<<7|M>>>25,M=S+N|0,A^=M<<9|M>>>23,M=A+S|0,O^=M<<13|M>>>19,M=O+A|0,N^=M<<18|M>>>14,M=w+S|0,_^=M<<7|M>>>25,M=_+w|0,k^=M<<9|M>>>23,M=k+_|0,S^=M<<13|M>>>19,M=S+k|0,w^=M<<18|M>>>14,M=x+E|0,C^=M<<7|M>>>25,M=C+x|0,A^=M<<9|M>>>23,M=A+C|0,E^=M<<13|M>>>19,M=E+A|0,x^=M<<18|M>>>14,M=j+T|0,O^=M<<7|M>>>25,M=O+j|0,I^=M<<9|M>>>23,M=I+O|0,T^=M<<13|M>>>19,M=T+I|0,j^=M<<18|M>>>14,M=N+R|0,P^=M<<7|M>>>25,M=P+N|0,B^=M<<9|M>>>23,M=B+P|0,R^=M<<13|M>>>19,M=R+B|0,N^=M<<18|M>>>14;w=w+i|0,_=_+o|0,k=k+s|0,S=S+a|0,E=E+u|0,x=x+l|0,C=C+c|0,A=A+f|0,I=I+h|0,T=T+p|0,j=j+d|0,O=O+m|0,P=P+g|0,B=B+y|0,R=R+b|0,N=N+v|0,e[0]=w>>>0&255,e[1]=w>>>8&255,e[2]=w>>>16&255,e[3]=w>>>24&255,e[4]=_>>>0&255,e[5]=_>>>8&255,e[6]=_>>>16&255,e[7]=_>>>24&255,e[8]=k>>>0&255,e[9]=k>>>8&255,e[10]=k>>>16&255,e[11]=k>>>24&255,e[12]=S>>>0&255,e[13]=S>>>8&255,e[14]=S>>>16&255,e[15]=S>>>24&255,e[16]=E>>>0&255,e[17]=E>>>8&255,e[18]=E>>>16&255,e[19]=E>>>24&255,e[20]=x>>>0&255,e[21]=x>>>8&255,e[22]=x>>>16&255,e[23]=x>>>24&255,e[24]=C>>>0&255,e[25]=C>>>8&255,e[26]=C>>>16&255,e[27]=C>>>24&255,e[28]=A>>>0&255,e[29]=A>>>8&255,e[30]=A>>>16&255,e[31]=A>>>24&255,e[32]=I>>>0&255,e[33]=I>>>8&255,e[34]=I>>>16&255,e[35]=I>>>24&255,e[36]=T>>>0&255,e[37]=T>>>8&255,e[38]=T>>>16&255,e[39]=T>>>24&255,e[40]=j>>>0&255,e[41]=j>>>8&255,e[42]=j>>>16&255,e[43]=j>>>24&255,e[44]=O>>>0&255,e[45]=O>>>8&255,e[46]=O>>>16&255,e[47]=O>>>24&255,e[48]=P>>>0&255,e[49]=P>>>8&255,e[50]=P>>>16&255,e[51]=P>>>24&255,e[52]=B>>>0&255,e[53]=B>>>8&255,e[54]=B>>>16&255,e[55]=B>>>24&255,e[56]=R>>>0&255,e[57]=R>>>8&255,e[58]=R>>>16&255,e[59]=R>>>24&255,e[60]=N>>>0&255,e[61]=N>>>8&255,e[62]=N>>>16&255,e[63]=N>>>24&255}function v(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,l=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,b=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,v=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,w=i,_=o,k=s,S=a,E=u,x=l,C=c,A=f,I=h,T=p,j=d,O=m,P=g,B=y,R=b,N=v,M,L=0;L<20;L+=2)M=w+P|0,E^=M<<7|M>>>25,M=E+w|0,I^=M<<9|M>>>23,M=I+E|0,P^=M<<13|M>>>19,M=P+I|0,w^=M<<18|M>>>14,M=x+_|0,T^=M<<7|M>>>25,M=T+x|0,B^=M<<9|M>>>23,M=B+T|0,_^=M<<13|M>>>19,M=_+B|0,x^=M<<18|M>>>14,M=j+C|0,R^=M<<7|M>>>25,M=R+j|0,k^=M<<9|M>>>23,M=k+R|0,C^=M<<13|M>>>19,M=C+k|0,j^=M<<18|M>>>14,M=N+O|0,S^=M<<7|M>>>25,M=S+N|0,A^=M<<9|M>>>23,M=A+S|0,O^=M<<13|M>>>19,M=O+A|0,N^=M<<18|M>>>14,M=w+S|0,_^=M<<7|M>>>25,M=_+w|0,k^=M<<9|M>>>23,M=k+_|0,S^=M<<13|M>>>19,M=S+k|0,w^=M<<18|M>>>14,M=x+E|0,C^=M<<7|M>>>25,M=C+x|0,A^=M<<9|M>>>23,M=A+C|0,E^=M<<13|M>>>19,M=E+A|0,x^=M<<18|M>>>14,M=j+T|0,O^=M<<7|M>>>25,M=O+j|0,I^=M<<9|M>>>23,M=I+O|0,T^=M<<13|M>>>19,M=T+I|0,j^=M<<18|M>>>14,M=N+R|0,P^=M<<7|M>>>25,M=P+N|0,B^=M<<9|M>>>23,M=B+P|0,R^=M<<13|M>>>19,M=R+B|0,N^=M<<18|M>>>14;e[0]=w>>>0&255,e[1]=w>>>8&255,e[2]=w>>>16&255,e[3]=w>>>24&255,e[4]=x>>>0&255,e[5]=x>>>8&255,e[6]=x>>>16&255,e[7]=x>>>24&255,e[8]=j>>>0&255,e[9]=j>>>8&255,e[10]=j>>>16&255,e[11]=j>>>24&255,e[12]=N>>>0&255,e[13]=N>>>8&255,e[14]=N>>>16&255,e[15]=N>>>24&255,e[16]=C>>>0&255,e[17]=C>>>8&255,e[18]=C>>>16&255,e[19]=C>>>24&255,e[20]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=I>>>0&255,e[25]=I>>>8&255,e[26]=I>>>16&255,e[27]=I>>>24&255,e[28]=T>>>0&255,e[29]=T>>>8&255,e[30]=T>>>16&255,e[31]=T>>>24&255}function w(e,t,n,r){b(e,t,n,r)}function _(e,t,n,r){v(e,t,n,r)}var k=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function S(e,t,n,r,i,o,s){var a=new Uint8Array(16),u=new Uint8Array(64),l,c;for(c=0;c<16;c++)a[c]=0;for(c=0;c<8;c++)a[c]=o[c];for(;i>=64;){for(w(u,a,s,k),c=0;c<64;c++)e[t+c]=n[r+c]^u[c];for(l=1,c=8;c<16;c++)l=l+(255&a[c])|0,a[c]=255&l,l>>>=8;i-=64,t+=64,r+=64}if(i>0)for(w(u,a,s,k),c=0;c=64;){for(w(s,o,i,k),u=0;u<64;u++)e[t+u]=s[u];for(a=1,u=8;u<16;u++)a=a+(255&o[u])|0,o[u]=255&a,a>>>=8;n-=64,t+=64}if(n>0)for(w(s,o,i,k),u=0;u>>13|n<<3),r=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(n>>>10|r<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(r>>>7|i<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|s<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(s>>>11|a<<5),u=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|u<<8),this.r[9]=u>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function I(e,t,n,r,i,o){var s=new A(o);return s.update(n,r,i),s.finish(e,t),0}function T(e,t,n,r,i,o){var s=new Uint8Array(16);return I(s,0,n,r,i,o),g(e,t,s,0)}function j(e,t,n,r,i){var o;if(n<32)return-1;for(C(e,0,t,0,n,r,i),I(e,16,e,32,n-32,e),o=0;o<16;o++)e[o]=0;return 0}function O(e,t,n,r,i){var o,s=new Uint8Array(32);if(n<32)return-1;if(x(s,0,32,r,i),0!==T(t,16,t,32,n-32,s))return-1;for(C(e,0,t,0,n,r,i),o=0;o<32;o++)e[o]=0;return 0}function P(e,t){var n;for(n=0;n<16;n++)e[n]=0|t[n]}function B(e){var t,n,r=1;for(t=0;t<16;t++)n=e[t]+r+65535,r=Math.floor(n/65536),e[t]=n-65536*r;e[0]+=r-1+37*(r-1)}function R(e,t,n){for(var r,i=~(n-1),o=0;o<16;o++)r=i&(e[o]^t[o]),e[o]^=r,t[o]^=r}function N(e,n){var r,i,o,s=t(),a=t();for(r=0;r<16;r++)a[r]=n[r];for(B(a),B(a),B(a),i=0;i<2;i++){for(s[0]=a[0]-65517,r=1;r<15;r++)s[r]=a[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),o=s[15]>>16&1,s[14]&=65535,R(a,s,1-o)}for(r=0;r<16;r++)e[2*r]=255&a[r],e[2*r+1]=a[r]>>8}function M(e,t){var n=new Uint8Array(32),r=new Uint8Array(32);return N(n,e),N(r,t),y(n,0,r,0)}function L(e){var t=new Uint8Array(32);return N(t,e),1&t[0]}function F(e,t){var n;for(n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function D(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]+n[r]}function U(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]-n[r]}function z(e,t,n){var r,i,o=0,s=0,a=0,u=0,l=0,c=0,f=0,h=0,p=0,d=0,m=0,g=0,y=0,b=0,v=0,w=0,_=0,k=0,S=0,E=0,x=0,C=0,A=0,I=0,T=0,j=0,O=0,P=0,B=0,R=0,N=0,M=n[0],L=n[1],F=n[2],D=n[3],U=n[4],z=n[5],q=n[6],K=n[7],H=n[8],V=n[9],W=n[10],$=n[11],G=n[12],Y=n[13],J=n[14],Z=n[15];r=t[0],o+=r*M,s+=r*L,a+=r*F,u+=r*D,l+=r*U,c+=r*z,f+=r*q,h+=r*K,p+=r*H,d+=r*V,m+=r*W,g+=r*$,y+=r*G,b+=r*Y,v+=r*J,w+=r*Z,r=t[1],s+=r*M,a+=r*L,u+=r*F,l+=r*D,c+=r*U,f+=r*z,h+=r*q,p+=r*K,d+=r*H,m+=r*V,g+=r*W,y+=r*$,b+=r*G,v+=r*Y,w+=r*J,_+=r*Z,r=t[2],a+=r*M,u+=r*L,l+=r*F,c+=r*D,f+=r*U,h+=r*z,p+=r*q,d+=r*K,m+=r*H,g+=r*V,y+=r*W,b+=r*$,v+=r*G,w+=r*Y,_+=r*J,k+=r*Z,r=t[3],u+=r*M,l+=r*L,c+=r*F,f+=r*D,h+=r*U,p+=r*z,d+=r*q,m+=r*K,g+=r*H,y+=r*V,b+=r*W,v+=r*$,w+=r*G,_+=r*Y,k+=r*J,S+=r*Z,r=t[4],l+=r*M,c+=r*L,f+=r*F,h+=r*D,p+=r*U,d+=r*z,m+=r*q,g+=r*K,y+=r*H,b+=r*V,v+=r*W,w+=r*$,_+=r*G,k+=r*Y,S+=r*J,E+=r*Z,r=t[5],c+=r*M,f+=r*L,h+=r*F,p+=r*D,d+=r*U,m+=r*z,g+=r*q,y+=r*K,b+=r*H,v+=r*V,w+=r*W,_+=r*$,k+=r*G,S+=r*Y,E+=r*J,x+=r*Z,r=t[6],f+=r*M,h+=r*L,p+=r*F,d+=r*D,m+=r*U,g+=r*z,y+=r*q,b+=r*K,v+=r*H,w+=r*V,_+=r*W,k+=r*$,S+=r*G,E+=r*Y,x+=r*J,C+=r*Z,r=t[7],h+=r*M,p+=r*L,d+=r*F,m+=r*D,g+=r*U,y+=r*z,b+=r*q,v+=r*K,w+=r*H,_+=r*V,k+=r*W,S+=r*$,E+=r*G,x+=r*Y,C+=r*J,A+=r*Z,r=t[8],p+=r*M,d+=r*L,m+=r*F,g+=r*D,y+=r*U,b+=r*z,v+=r*q,w+=r*K,_+=r*H,k+=r*V,S+=r*W,E+=r*$,x+=r*G,C+=r*Y,A+=r*J,I+=r*Z,r=t[9],d+=r*M,m+=r*L,g+=r*F,y+=r*D,b+=r*U,v+=r*z,w+=r*q,_+=r*K,k+=r*H,S+=r*V,E+=r*W,x+=r*$,C+=r*G,A+=r*Y,I+=r*J,T+=r*Z,r=t[10],m+=r*M,g+=r*L,y+=r*F,b+=r*D,v+=r*U,w+=r*z,_+=r*q,k+=r*K,S+=r*H,E+=r*V,x+=r*W,C+=r*$,A+=r*G,I+=r*Y,T+=r*J,j+=r*Z,r=t[11],g+=r*M,y+=r*L,b+=r*F,v+=r*D,w+=r*U,_+=r*z,k+=r*q,S+=r*K,E+=r*H,x+=r*V,C+=r*W,A+=r*$,I+=r*G,T+=r*Y,j+=r*J,O+=r*Z,r=t[12],y+=r*M,b+=r*L,v+=r*F,w+=r*D,_+=r*U,k+=r*z,S+=r*q,E+=r*K,x+=r*H,C+=r*V,A+=r*W,I+=r*$,T+=r*G,j+=r*Y,O+=r*J,P+=r*Z,r=t[13],b+=r*M,v+=r*L,w+=r*F,_+=r*D,k+=r*U,S+=r*z,E+=r*q,x+=r*K,C+=r*H,A+=r*V,I+=r*W,T+=r*$,j+=r*G,O+=r*Y,P+=r*J,B+=r*Z,r=t[14],v+=r*M,w+=r*L,_+=r*F,k+=r*D,S+=r*U,E+=r*z,x+=r*q,C+=r*K,A+=r*H,I+=r*V,T+=r*W,j+=r*$,O+=r*G,P+=r*Y,B+=r*J,R+=r*Z,r=t[15],w+=r*M,_+=r*L,k+=r*F,S+=r*D,E+=r*U,x+=r*z,C+=r*q,A+=r*K,I+=r*H,T+=r*V,j+=r*W,O+=r*$,P+=r*G,B+=r*Y,R+=r*J,N+=r*Z,o+=38*_,s+=38*k,a+=38*S,u+=38*E,l+=38*x,c+=38*C,f+=38*A,h+=38*I,p+=38*T,d+=38*j,m+=38*O,g+=38*P,y+=38*B,b+=38*R,v+=38*N,i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=w+i+65535,i=Math.floor(r/65536),w=r-65536*i,o+=i-1+37*(i-1),i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=w+i+65535,i=Math.floor(r/65536),w=r-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=u,e[4]=l,e[5]=c,e[6]=f,e[7]=h,e[8]=p,e[9]=d,e[10]=m,e[11]=g,e[12]=y,e[13]=b,e[14]=v,e[15]=w}function q(e,t){z(e,t,t)}function K(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=253;i>=0;i--)q(r,r),2!==i&&4!==i&&z(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function H(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=250;i>=0;i--)q(r,r),1!==i&&z(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function V(e,n,r){var i=new Uint8Array(32),o=new Float64Array(80),s,a,l=t(),c=t(),f=t(),h=t(),p=t(),d=t();for(a=0;a<31;a++)i[a]=n[a];for(i[31]=127&n[31]|64,i[0]&=248,F(o,r),a=0;a<16;a++)c[a]=o[a],h[a]=l[a]=f[a]=0;for(l[0]=h[0]=1,a=254;a>=0;--a)s=i[a>>>3]>>>(7&a)&1,R(l,c,s),R(f,h,s),D(p,l,f),U(l,l,f),D(f,c,h),U(c,c,h),q(h,p),q(d,l),z(l,f,l),z(f,c,p),D(p,l,f),U(l,l,f),q(c,l),U(f,h,d),z(l,f,u),D(l,l,h),z(f,f,l),z(l,h,d),z(h,c,o),q(c,p),R(l,c,s),R(f,h,s);for(a=0;a<16;a++)o[a+16]=l[a],o[a+32]=f[a],o[a+48]=c[a],o[a+64]=h[a];var m=o.subarray(32),g=o.subarray(16);return K(m,m),z(g,g,m),N(e,g),0}function W(e,t){return V(e,t,o)}function $(e,t){return r(t,32),W(e,t)}function G(e,t,n){var r=new Uint8Array(32);return V(r,n,t),_(e,i,r,k)}A.prototype.blocks=function(e,t,n){for(var r=this.fin?0:2048,i,o,s,a,u,l,c,f,h,p,d,m,g,y,b,v,w,_,k,S=this.h[0],E=this.h[1],x=this.h[2],C=this.h[3],A=this.h[4],I=this.h[5],T=this.h[6],j=this.h[7],O=this.h[8],P=this.h[9],B=this.r[0],R=this.r[1],N=this.r[2],M=this.r[3],L=this.r[4],F=this.r[5],D=this.r[6],U=this.r[7],z=this.r[8],q=this.r[9];n>=16;)i=255&e[t+0]|(255&e[t+1])<<8,S+=8191&i,o=255&e[t+2]|(255&e[t+3])<<8,E+=8191&(i>>>13|o<<3),s=255&e[t+4]|(255&e[t+5])<<8,x+=8191&(o>>>10|s<<6),a=255&e[t+6]|(255&e[t+7])<<8,C+=8191&(s>>>7|a<<9),u=255&e[t+8]|(255&e[t+9])<<8,A+=8191&(a>>>4|u<<12),I+=u>>>1&8191,l=255&e[t+10]|(255&e[t+11])<<8,T+=8191&(u>>>14|l<<2),c=255&e[t+12]|(255&e[t+13])<<8,j+=8191&(l>>>11|c<<5),f=255&e[t+14]|(255&e[t+15])<<8,O+=8191&(c>>>8|f<<8),P+=f>>>5|r,h=0,p=h,p+=S*B,p+=E*(5*q),p+=x*(5*z),p+=C*(5*U),p+=A*(5*D),h=p>>>13,p&=8191,p+=I*(5*F),p+=T*(5*L),p+=j*(5*M),p+=O*(5*N),p+=P*(5*R),h+=p>>>13,p&=8191,d=h,d+=S*R,d+=E*B,d+=x*(5*q),d+=C*(5*z),d+=A*(5*U),h=d>>>13,d&=8191,d+=I*(5*D),d+=T*(5*F),d+=j*(5*L),d+=O*(5*M),d+=P*(5*N),h+=d>>>13,d&=8191,m=h,m+=S*N,m+=E*R,m+=x*B,m+=C*(5*q),m+=A*(5*z),h=m>>>13,m&=8191,m+=I*(5*U),m+=T*(5*D),m+=j*(5*F),m+=O*(5*L),m+=P*(5*M),h+=m>>>13,m&=8191,g=h,g+=S*M,g+=E*N,g+=x*R,g+=C*B,g+=A*(5*q),h=g>>>13,g&=8191,g+=I*(5*z),g+=T*(5*U),g+=j*(5*D),g+=O*(5*F),g+=P*(5*L),h+=g>>>13,g&=8191,y=h,y+=S*L,y+=E*M,y+=x*N,y+=C*R,y+=A*B,h=y>>>13,y&=8191,y+=I*(5*q),y+=T*(5*z),y+=j*(5*U),y+=O*(5*D),y+=P*(5*F),h+=y>>>13,y&=8191,b=h,b+=S*F,b+=E*L,b+=x*M,b+=C*N,b+=A*R,h=b>>>13,b&=8191,b+=I*B,b+=T*(5*q),b+=j*(5*z),b+=O*(5*U),b+=P*(5*D),h+=b>>>13,b&=8191,v=h,v+=S*D,v+=E*F,v+=x*L,v+=C*M,v+=A*N,h=v>>>13,v&=8191,v+=I*R,v+=T*B,v+=j*(5*q),v+=O*(5*z),v+=P*(5*U),h+=v>>>13,v&=8191,w=h,w+=S*U,w+=E*D,w+=x*F,w+=C*L,w+=A*M,h=w>>>13,w&=8191,w+=I*N,w+=T*R,w+=j*B,w+=O*(5*q),w+=P*(5*z),h+=w>>>13,w&=8191,_=h,_+=S*z,_+=E*U,_+=x*D,_+=C*F,_+=A*L,h=_>>>13,_&=8191,_+=I*M,_+=T*N,_+=j*R,_+=O*B,_+=P*(5*q),h+=_>>>13,_&=8191,k=h,k+=S*q,k+=E*z,k+=x*U,k+=C*D,k+=A*F,h=k>>>13,k&=8191,k+=I*L,k+=T*M,k+=j*N,k+=O*R,k+=P*B,h+=k>>>13,k&=8191,h=(h<<2)+h|0,h=h+p|0,p=8191&h,h>>>=13,d+=h,S=p,E=d,x=m,C=g,A=y,I=b,T=v,j=w,O=_,P=k,t+=16,n-=16;this.h[0]=S,this.h[1]=E,this.h[2]=x,this.h[3]=C,this.h[4]=A,this.h[5]=I,this.h[6]=T,this.h[7]=j,this.h[8]=O,this.h[9]=P},A.prototype.finish=function(e,t){var n=new Uint16Array(10),r,i,o,s;if(this.leftover){for(s=this.leftover,this.buffer[s++]=1;s<16;s++)this.buffer[s]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,s=2;s<10;s++)this.h[s]+=r,r=this.h[s]>>>13,this.h[s]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,n[0]=this.h[0]+5,r=n[0]>>>13,n[0]&=8191,s=1;s<10;s++)n[s]=this.h[s]+r,r=n[s]>>>13,n[s]&=8191;for(n[9]-=8192,i=(1^r)-1,s=0;s<10;s++)n[s]&=i;for(i=~i,s=0;s<10;s++)this.h[s]=this.h[s]&i|n[s];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,s=1;s<8;s++)o=(this.h[s]+this.pad[s]|0)+(o>>>16)|0,this.h[s]=65535&o;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},A.prototype.update=function(e,t,n){var r,i;if(this.leftover){for(i=16-this.leftover,i>n&&(i=n),r=0;r=16&&(i=n-n%16,this.blocks(e,t,i),t+=i,n-=i),n){for(r=0;r=128;){for(E=0;E<16;E++)x=8*E+G,i[E]=n[x+0]<<24|n[x+1]<<16|n[x+2]<<8|n[x+3],o[E]=n[x+4]<<24|n[x+5]<<16|n[x+6]<<8|n[x+7];for(E=0;E<80;E++)if(s=P,a=B,u=R,l=N,c=M,f=L,h=F,p=D,d=U,m=z,g=q,y=K,b=H,v=V,w=W,_=$,C=D,A=$,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=(M>>>14|H<<18)^(M>>>18|H<<14)^(H>>>9|M<<23),A=(H>>>14|M<<18)^(H>>>18|M<<14)^(M>>>9|H<<23),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=M&L^~M&F,A=H&V^~H&W,I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=X[2*E],A=X[2*E+1],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=i[E%16],A=o[E%16],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,k=65535&j|O<<16,S=65535&I|T<<16,C=k,A=S,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=(P>>>28|U<<4)^(U>>>2|P<<30)^(U>>>7|P<<25),A=(U>>>28|P<<4)^(P>>>2|U<<30)^(P>>>7|U<<25),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=P&B^P&R^B&R,A=U&z^U&q^z&q,I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,p=65535&j|O<<16,_=65535&I|T<<16,C=l,A=y,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=k,A=S,I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,l=65535&j|O<<16,y=65535&I|T<<16,B=s,R=a,N=u,M=l,L=c,F=f,D=h,P=p,z=d,q=m,K=g,H=y,V=b,W=v,$=w,U=_,E%16==15)for(x=0;x<16;x++)C=i[x],A=o[x],I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=i[(x+9)%16],A=o[(x+9)%16],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,k=i[(x+1)%16],S=o[(x+1)%16],C=(k>>>1|S<<31)^(k>>>8|S<<24)^k>>>7,A=(S>>>1|k<<31)^(S>>>8|k<<24)^(S>>>7|k<<25),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,k=i[(x+14)%16],S=o[(x+14)%16],C=(k>>>19|S<<13)^(S>>>29|k<<3)^k>>>6,A=(S>>>19|k<<13)^(k>>>29|S<<3)^(S>>>6|k<<26),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,i[x]=65535&j|O<<16,o[x]=65535&I|T<<16;C=P,A=U,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[0],A=t[0],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[0]=P=65535&j|O<<16,t[0]=U=65535&I|T<<16,C=B,A=z,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[1],A=t[1],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[1]=B=65535&j|O<<16,t[1]=z=65535&I|T<<16,C=R,A=q,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[2],A=t[2],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[2]=R=65535&j|O<<16,t[2]=q=65535&I|T<<16,C=N,A=K,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[3],A=t[3],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[3]=N=65535&j|O<<16,t[3]=K=65535&I|T<<16,C=M,A=H,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[4],A=t[4],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[4]=M=65535&j|O<<16,t[4]=H=65535&I|T<<16,C=L,A=V,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[5],A=t[5],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[5]=L=65535&j|O<<16,t[5]=V=65535&I|T<<16,C=F,A=W,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[6],A=t[6],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[6]=F=65535&j|O<<16,t[6]=W=65535&I|T<<16,C=D,A=$,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[7],A=t[7],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[7]=D=65535&j|O<<16,t[7]=$=65535&I|T<<16,G+=128,r-=128}return r}function te(e,t,n){var r=new Int32Array(8),i=new Int32Array(8),o=new Uint8Array(256),s,a=n;for(r[0]=1779033703,r[1]=3144134277,r[2]=1013904242,r[3]=2773480762,r[4]=1359893119,r[5]=2600822924,r[6]=528734635,r[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,ee(r,i,t,n),n%=128,s=0;s=0;--i)r=n[i/8|0]>>(7&i)&1,re(e,t,r),ne(t,e),ne(e,e),re(e,t,r)}function se(e,n){var r=[t(),t(),t(),t()];P(r[0],f),P(r[1],h),P(r[2],a),z(r[3],f,h),oe(e,r,n)}function ae(e,n,i){var o=new Uint8Array(64),s=[t(),t(),t(),t()],a;for(i||r(n,32),te(o,n,32),o[0]&=248,o[31]&=127,o[31]|=64,se(s,o),ie(e,s),a=0;a<32;a++)n[a+32]=e[a];return 0}var ue=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function le(e,t){var n,r,i,o;for(r=63;r>=32;--r){for(n=0,i=r-32,o=r-12;i>8,t[i]-=256*n;t[i]+=n,t[r]=0}for(n=0,i=0;i<32;i++)t[i]+=n-(t[31]>>4)*ue[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*ue[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function ce(e){var t=new Float64Array(64),n;for(n=0;n<64;n++)t[n]=e[n];for(n=0;n<64;n++)e[n]=0;le(e,t)}function fe(e,n,r,i){var o=new Uint8Array(64),s=new Uint8Array(64),a=new Uint8Array(64),u,l,c=new Float64Array(64),f=[t(),t(),t(),t()];te(o,i,32),o[0]&=248,o[31]&=127,o[31]|=64;var h=r+64;for(u=0;u>7&&U(e[0],s,e[0]),z(e[3],e[0],e[1]),0)}function pe(e,n,r,i){var o,s,a=new Uint8Array(32),u=new Uint8Array(64),l=[t(),t(),t(),t()],c=[t(),t(),t(),t()];if(s=-1,r<64)return-1;if(he(c,i))return-1;for(o=0;o=0},e.sign.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(64);return ae(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(Be(e),64!==e.length)throw new Error("bad secret key size");for(var t=new Uint8Array(32),n=0;n=this._buffer.length},o.prototype.remainder=function(){return this._buffer.slice(this._offset)},o.prototype.skip=function(e){this._offset+=e},o.prototype.expand=function(){this._size*=2;var e=i.alloc(this._size);this._buffer.copy(e,0),this._buffer=e},o.prototype.readPart=function(){return{data:this.readBuffer()}},o.prototype.readBuffer=function(){var e=this._buffer.readUInt32BE(this._offset);this._offset+=4,r.ok(this._offset+e<=this._buffer.length,"length out of bounds at +0x"+this._offset.toString(16)+" (data truncated?)");var t=this._buffer.slice(this._offset,this._offset+e);return this._offset+=e,t},o.prototype.readString=function(){return this.readBuffer().toString()},o.prototype.readCString=function(){for(var e=this._offset;ethis._size;)this.expand();this._buffer.writeUInt32BE(e.length,this._offset),this._offset+=4,e.copy(this._buffer,this._offset),this._offset+=e.length},o.prototype.writeString=function(e){this.writeBuffer(i.from(e,"utf8"))},o.prototype.writeCString=function(e){for(;this._offset+1+e.length>this._size;)this.expand();this._buffer.write(e,this._offset),this._offset+=e.length,this._buffer[this._offset++]=0},o.prototype.writeInt=function(e){for(;this._offset+4>this._size;)this.expand();this._buffer.writeUInt32BE(e,this._offset),this._offset+=4},o.prototype.writeInt64=function(e){if(r.buffer(e,"value"),e.length>8){for(var t=e.slice(0,e.length-8),n=0;nthis._size;)this.expand();e.copy(this._buffer,this._offset),this._offset+=8},o.prototype.writeChar=function(e){for(;this._offset+1>this._size;)this.expand();this._buffer[this._offset++]=e},o.prototype.writePart=function(e){this.writeBuffer(e.data)},o.prototype.write=function(e){for(;this._offset+e.length>this._size;)this.expand();e.copy(this._buffer,this._offset),this._offset+=e.length}},function(e,t,n){e.exports={read:f,readPkcs8:d,write:h,writePkcs8:A,pkcs8ToBuffer:C,readECDSACurve:v,writeECDSACurve:P};var r=n(27),i=n(103),o=n(31).Buffer,s=n(55),a=n(47),u=n(46),l=n(50),c=n(113);function f(e,t){return c.read(e,t,"pkcs8")}function h(e,t){return c.write(e,t,"pkcs8")}function p(e,t){return r.strictEqual(e.peek(),i.Ber.Integer,t+" is not an Integer"),a.mpNormalize(e.readString(i.Ber.Integer,!0))}function d(e,t,n){n.peek()===i.Ber.Integer&&(r.strictEqual(t,"private","unexpected Integer at start of public key"),n.readString(i.Ber.Integer,!0)),n.readSequence();var o=n.offset+n.length,s=n.readOID();switch(s){case"1.2.840.113549.1.1.1":return n._offset=o,"public"===t?m(n):g(n);case"1.2.840.10040.4.1":return"public"===t?y(n):b(n);case"1.2.840.10045.2.1":return"public"===t?_(n):w(n);case"1.3.101.112":return"public"===t?k(n):E(n);case"1.3.101.110":return"public"===t?S(n):x(n);default:throw new Error("Unknown key type OID "+s)}}function m(e){e.readSequence(i.Ber.BitString),e.readByte(),e.readSequence();var t=p(e,"modulus"),n=p(e,"exponent"),r={type:"rsa",source:e.originalInput,parts:[{name:"e",data:n},{name:"n",data:t}]};return new u(r)}function g(e){e.readSequence(i.Ber.OctetString),e.readSequence();var t=p(e,"version");r.equal(t[0],0,"unknown RSA private key version");var n=p(e,"modulus"),o=p(e,"public exponent"),s=p(e,"private exponent"),a=p(e,"prime1"),u=p(e,"prime2"),c=p(e,"exponent1"),f=p(e,"exponent2"),h=p(e,"iqmp"),d={type:"rsa",parts:[{name:"n",data:n},{name:"e",data:o},{name:"d",data:s},{name:"iqmp",data:h},{name:"p",data:a},{name:"q",data:u},{name:"dmodp",data:c},{name:"dmodq",data:f}]};return new l(d)}function y(e){e.readSequence();var t=p(e,"p"),n=p(e,"q"),r=p(e,"g");e.readSequence(i.Ber.BitString),e.readByte();var o=p(e,"y"),s={type:"dsa",parts:[{name:"p",data:t},{name:"q",data:n},{name:"g",data:r},{name:"y",data:o}]};return new u(s)}function b(e){e.readSequence();var t=p(e,"p"),n=p(e,"q"),r=p(e,"g");e.readSequence(i.Ber.OctetString);var o=p(e,"x"),s=a.calculateDSAPublic(r,t,o),u={type:"dsa",parts:[{name:"p",data:t},{name:"q",data:n},{name:"g",data:r},{name:"y",data:s},{name:"x",data:o}]};return new l(u)}function v(e){var t,n,u,l,c;if(e.peek()===i.Ber.OID){var f=e.readOID();for(n=Object.keys(s.curves),u=0;u=this.validFrom.getTime()&&e.getTime()0&&-1===this.issuer.purposes.indexOf("ca"))&&this.isSignedByKey(e.subjectKey))},b.prototype.getExtension=function(e){r.string(e,"keyOrOid");var t=this.getExtensions().filter(function(t){return"x509"===t.format?t.oid===e:"openssh"===t.format&&t.name===e})[0];return t},b.prototype.getExtensions=function(){var e=[],t=this.signatures.x509;t&&t.extras&&t.extras.exts&&t.extras.exts.forEach(function(t){t.format="x509",e.push(t)});var n=this.signatures.openssh;return n&&n.exts&&n.exts.forEach(function(t){t.format="openssh",e.push(t)}),e},b.prototype.isSignedByKey=function(e){if(f.assertCompatible(e,h,[1,2],"issuerKey"),void 0!==this.issuerKey)return this.issuerKey.fingerprint("sha512").matches(e);var t=Object.keys(this.signatures)[0],n=m[t].verify(this,e);return n&&(this.issuerKey=e),n},b.prototype.signWith=function(e){f.assertCompatible(e,p,[1,2],"key");for(var t=Object.keys(m),n=!1,r=0;r0&&-1===c.indexOf("serverAuth")&&c.push("serverAuth"),m.length>0&&-1===c.indexOf("clientAuth")&&c.push("clientAuth"),(m.length>0||h.length>0)&&(-1===c.indexOf("keyAgreement")&&c.push("keyAgreement"),"rsa"===t.type&&-1===c.indexOf("encryption")&&c.push("encryption"))}var g=new b({subjects:o,issuer:o[0],subjectKey:t.toPublic(),issuerKey:t.toPublic(),signatures:{},serial:l,validFrom:s,validUntil:a,purposes:c});return g.signWith(t),g},b.create=function(e,t,n,o,s){var a;a=Array.isArray(e)?e:[e],r.arrayOfObject(a),a.forEach(function(e){f.assertCompatible(e,d,[1,0],"subject")}),f.assertCompatible(t,h,[1,0],"key"),p.isPrivateKey(t)&&(t=t.toPublic()),f.assertCompatible(n,d,[1,0],"issuer"),f.assertCompatible(o,p,[1,2],"issuer key"),r.optionalObject(s,"options"),void 0===s&&(s={}),r.optionalObject(s.validFrom,"options.validFrom"),r.optionalObject(s.validUntil,"options.validUntil");var u=s.validFrom,l=s.validUntil;if(void 0===u&&(u=new Date),void 0===l){r.optionalNumber(s.lifetime,"options.lifetime");var c=s.lifetime;void 0===c&&(c=31536e4),l=new Date,l.setTime(l.getTime()+1e3*c)}r.optionalBuffer(s.serial,"options.serial");var m=s.serial;void 0===m&&(m=i.from("0000000000000001","hex"));var g=s.purposes;void 0===g&&(g=[]),-1===g.indexOf("signature")&&g.push("signature"),!0===s.ca&&(-1===g.indexOf("ca")&&g.push("ca"),-1===g.indexOf("crl")&&g.push("crl"));var y=a.filter(function(e){return"host"===e.type}),v=a.filter(function(e){return"user"===e.type});y.length>0&&-1===g.indexOf("serverAuth")&&g.push("serverAuth"),v.length>0&&-1===g.indexOf("clientAuth")&&g.push("clientAuth"),(v.length>0||y.length>0)&&(-1===g.indexOf("keyAgreement")&&g.push("keyAgreement"),"rsa"===t.type&&-1===g.indexOf("encryption")&&g.push("encryption"));var w=new b({subjects:a,issuer:n,subjectKey:t,issuerKey:o.toPublic(),signatures:{},serial:m,validFrom:u,validUntil:l,purposes:g});return w.signWith(o),w},b.parse=function(e,t,n){"string"!=typeof e&&r.buffer(e,"data"),void 0===t&&(t="auto"),r.string(t,"format"),"string"==typeof n&&(n={filename:n}),r.optionalObject(n,"options"),void 0===n&&(n={}),r.optionalString(n.filename,"options.filename"),void 0===n.filename&&(n.filename="(unnamed)"),r.object(m[t],"formats[format]");try{var i=m[t].read(e,n);return i}catch(e){throw new g(n.filename,t,e)}},b.isCertificate=function(e,t){return f.isCompatible(e,b,t)},b.prototype._sshpkApiVersion=[1,1],b._oldVersionDetect=function(e){return[1,0]}},function(e,t,n){e.exports=g;var r=n(27),i=n(55),o=n(15),s=n(207),a=n(102),u=n(97),l=n(13),c=n(47),f=n(103),h=n(31).Buffer,p=/^([*]|[a-z0-9][a-z0-9\-]{0,62})(?:\.([*]|[a-z0-9][a-z0-9\-]{0,62}))*$/i,d={cn:"2.5.4.3",o:"2.5.4.10",ou:"2.5.4.11",l:"2.5.4.7",s:"2.5.4.8",c:"2.5.4.6",sn:"2.5.4.4",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",street:"2.5.4.9",x500UniqueIdentifier:"2.5.4.45",role:"2.5.4.72",telephoneNumber:"2.5.4.20",description:"2.5.4.13",dc:"0.9.2342.19200300.100.1.25",uid:"0.9.2342.19200300.100.1.1",mail:"0.9.2342.19200300.100.1.3",title:"2.5.4.12",gn:"2.5.4.42",initials:"2.5.4.43",pseudonym:"2.5.4.65",emailAddress:"1.2.840.113549.1.9.1"},m={};function g(e){var t=this;if(r.object(e,"options"),r.arrayOfObject(e.components,"options.components"),this.components=e.components,this.componentLookup={},this.components.forEach(function(e){e.name&&!e.oid&&(e.oid=d[e.name]),e.oid&&!e.name&&(e.name=m[e.oid]),void 0===t.componentLookup[e.name]&&(t.componentLookup[e.name]=[]),t.componentLookup[e.name].push(e)}),this.componentLookup.cn&&this.componentLookup.cn.length>0&&(this.cn=this.componentLookup.cn[0].value),r.optionalString(e.type,"options.type"),void 0===e.type)1===this.components.length&&this.componentLookup.cn&&1===this.componentLookup.cn.length&&this.componentLookup.cn[0].value.match(p)?(this.type="host",this.hostname=this.componentLookup.cn[0].value):this.componentLookup.dc&&this.components.length===this.componentLookup.dc.length?(this.type="host",this.hostname=this.componentLookup.dc.map(function(e){return e.value}).join(".")):this.componentLookup.uid&&this.components.length===this.componentLookup.uid.length?(this.type="user",this.uid=this.componentLookup.uid[0].value):this.componentLookup.cn&&1===this.componentLookup.cn.length&&this.componentLookup.cn[0].value.match(p)?(this.type="host",this.hostname=this.componentLookup.cn[0].value):this.componentLookup.uid&&1===this.componentLookup.uid.length?(this.type="user",this.uid=this.componentLookup.uid[0].value):this.componentLookup.mail&&1===this.componentLookup.mail.length?(this.type="email",this.email=this.componentLookup.mail[0].value):this.componentLookup.cn&&1===this.componentLookup.cn.length?(this.type="user",this.uid=this.componentLookup.cn[0].value):this.type="unknown";else if(this.type=e.type,"host"===this.type)this.hostname=e.hostname;else if("user"===this.type)this.uid=e.uid;else{if("email"!==this.type)throw new Error("Unknown type "+this.type);this.email=e.email}}Object.keys(d).forEach(function(e){m[d[e]]=e}),g.prototype.toString=function(){return this.components.map(function(e){var t=e.name.toUpperCase();t=t.replace(/=/g,"\\=");var n=e.value;return n=n.replace(/,/g,"\\,"),t+"="+n}).join(", ")},g.prototype.get=function(e,t){r.string(e,"name");var n=this.componentLookup[e];if(void 0!==n&&0!==n.length){if(!t&&n.length>1)throw new Error("Multiple values for attribute "+e);return t?n.map(function(e){return e.value}):n[0].value}},g.prototype.toArray=function(e){return this.components.map(function(e){return{name:e.name,value:e.value}})};var y=/[^a-zA-Z0-9 '(),+.\/:=?-]/,b=/[^\x00-\x7f]/;function v(e,t){if("**"===e||"**"===t)return!0;var n=e.split("."),r=t.split(".");if(n.length!==r.length)return!1;for(var i=0;i0;){var o;if(null!==(o=/^,/.exec(i)))t[++n]="",i=i.slice(o[0].length);else if(null!==(o=/^\\,/.exec(i)))t[n]+=",",i=i.slice(o[0].length);else if(null!==(o=/^\\./.exec(i)))t[n]+=o[0],i=i.slice(o[0].length);else{if(null===(o=/^[^\\,]+/.exec(i)))throw new Error("Failed to parse DN");t[n]+=o[0],i=i.slice(o[0].length)}}var s=t.map(function(e){e=e.trim();for(var t=e.indexOf("=");t>0&&"\\"===e.charAt(t-1);)t=e.indexOf("=",t+1);if(-1===t)throw new Error("Failed to parse DN");var n=e.slice(0,t).toLowerCase().replace(/\\=/g,"="),r=e.slice(t+1);return{name:n,value:r}});return new g({components:s})},g.fromArray=function(e){return r.arrayOfObject(e,"components"),e.forEach(function(e){if(r.object(e,"component"),r.string(e.name,"component.name"),!h.isBuffer(e.value)&&"string"!=typeof e.value)throw new Error("Invalid component value")}),new g({components:e})},g.parseAsn1=function(e,t){var n=[];e.readSequence(t);for(var r=e.offset+e.length;e.offset= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=f-h,E=Math.floor,x=String.fromCharCode,C;function A(e){throw new RangeError(k[e])}function I(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function T(e,t){var n=e.split("@"),r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(_,".");var i=e.split("."),o=I(i,t).join(".");return r+o}function j(e){for(var t=[],n=0,r=e.length,i,o;n=55296&&i<=56319&&n65535&&(e-=65536,t+=x(e>>>10&1023|55296),e=56320|1023&e),t+=x(e),t}).join("")}function P(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:f}function B(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function R(e,t,n){var r=0;for(e=n?E(e/m):e>>1,e+=E(e/t);e>S*p>>1;r+=f)e=E(e/S);return E(r+(S+1)*e/(e+d))}function N(e){var t=[],n=e.length,r,i=0,o=y,s=g,a,u,l,d,m,v,w,_,k;for(a=e.lastIndexOf(b),a<0&&(a=0),u=0;u=128&&A("not-basic"),t.push(e.charCodeAt(u));for(l=a>0?a+1:0;l=n&&A("invalid-input"),w=P(e.charCodeAt(l++)),(w>=f||w>E((c-i)/m))&&A("overflow"),i+=w*m,_=v<=s?h:v>=s+p?p:v-s,!(w<_);v+=f)k=f-_,m>E(c/k)&&A("overflow"),m*=k;r=t.length+1,s=R(i-d,r,0==d),E(i/r)>c-o&&A("overflow"),o+=E(i/r),i%=r,t.splice(i++,0,o)}return O(t)}function M(e){var t,n,r,i,o,s,a,u,l,d,m,v=[],w,_,k,S;for(e=j(e),w=e.length,t=y,n=0,o=g,s=0;s=t&&mE((c-n)/_)&&A("overflow"),n+=(a-t)*_,t=a,s=0;sc&&A("overflow"),m==t){for(u=n,l=f;d=l<=o?h:l>=o+p?p:l-o,!(uthis.root.open(j(e)),t=>this.config.set(B(e),t),t=>this.spec.set(R(e),t),e=>this.version.set(C,e)],t)}open(e){this.closed?(S("opening at: %s",this.path),r([e=>this.root.open(j(e)),e=>this._isInitialized(e),e=>this._openLock(this.path,e),(e,t)=>{S("aquired repo.lock"),this.lockfile=e,t()},e=>{S("creating datastore"),this.datastore=d.create("datastore",l.join(this.path,"datastore"),this.options),S("creating blocks");const t=d.create("blocks",l.join(this.path,"blocks"),this.options);v(t,this.options.storageBackendOptions.blocks,e)},(e,t)=>{this.blocks=e,t()},e=>{S("creating keystore"),this.keys=d.create("keys",l.join(this.path,"keys"),this.options),e()},e=>{this.closed=!1,S("all opened"),e()}],t=>{t&&this.lockfile?this._closeLock(n=>{n?S("error removing lock",n):this.lockfile=null,e(t)}):e(t)})):setImmediate(()=>e(new Error("repo is already open")))}_getLocker(){return"string"==typeof this.options.lock?(u(x[this.options.lock],"Unknown lock type: "+this.options.lock),x[this.options.lock]):(u(this.options.lock,"No lock provided"),this.options.lock)}_openLock(e,t){this._locker.lock(e,(e,n)=>{if(e)return t(e,null);u.strictEqual(typeof n.close,"function","Locks must have a close method"),t(null,n)})}_closeLock(e){if(this.lockfile)return this.lockfile.close(e);e()}_isInitialized(e){S("init check"),o({config:e=>this.config.exists(e),spec:e=>this.spec.exists(e),version:e=>this.version.check(C,e)},(t,n)=>{if(S("init",t,n),t&&!n.config)return e(Object.assign(new Error("repo is not initialized yet"),{code:k.ERR_REPO_NOT_INITIALIZED,path:this.path}));e(t)})}close(e){if(this.closed)return e(new Error("repo is already closed"));S("closing at: %s",this.path),i([e=>this.apiAddr.delete(O(e)),e=>{s([this.blocks,this.keys,this.datastore],(e,t)=>e.close(t),e)},e=>{S("unlocking"),this.closed=!0,this._closeLock(e)},e=>{this.lockfile=null,e()}],t=>e(t))}exists(e){this.version.exists(e)}stat(e,t){"function"==typeof e&&(t=e,e={}),e=Object.assign({},{human:!1},e),o({storageMax:e=>this.config.get("Datastore.StorageMax",(t,n)=>{e(null,new f(t?E:n))}),version:e=>this.version.get(e),blocks:e=>this.blocks.query({},(t,n)=>{n=n||[];const r=new f(n.length);let i=new f(0);n.forEach(e=>{i=i.plus(e.value.byteLength).plus(e.key._buf.byteLength)}),e(t,{count:r,size:i})}),datastore:e=>I(this.datastore,e),keys:e=>I(this.keys,e)},(n,r)=>{if(n)return t(n);let i=r.blocks.size.plus(r.datastore).plus(r.keys);e.human&&(i=i.div(1048576)),t(null,{repoPath:this.path,storageMax:r.storageMax,version:r.version,numObjects:r.blocks.count,repoSize:i})})}}function I(e,t){h(e.query({}),p((e,t)=>e.plus(t.value.byteLength).plus(t.key._buf.byteLength),new f(0),t))}function T(e,t){return n=>{t(n&&!e(n)?n:null)}}function j(e){return T(e=>"Already open"===e.message,e)}function O(e){return T(e=>e&&(e.code===k.ERR_REPO_NOT_INITIALIZED||e.message.startsWith("ENOENT")),e)}function P(e){const t=Object.assign({},w,e);return t.storageBackends=Object.assign({},w.storageBackends,t.storageBackends),t.storageBackendOptions=Object.assign({},w.storageBackendOptions,t.storageBackendOptions),t}function B(e){return e.datastore=Object.assign({},_,a(e,"datastore",{})),e}function R(e){const t=Object.assign({},_.Spec,a(e,"datastore.Spec",{}));return{type:t.type,mounts:t.mounts.map(e=>({mountpoint:e.mountpoint,type:e.child.type,path:e.child.path,shardFunc:e.child.shardFunc}))}}e.exports=A,e.exports.repoVersion=C,e.exports.errors=k},function(e,t){e.exports=function(){var e,t,n,r,i=function(i,o){e?e(i,o):i?(r=i,n=o):t=o};return i.resolve=function(i){if(e)throw new Error("already resolved");if(e=i,!e)throw new Error("no read cannot resolve!"+e);t&&i(null,t),n&&i(r,n)},i.abort=function(e){i.resolve(function(t,n){n(e||!0)})},i}},function(e,t){t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n",t.homedir=function(){return"/"}},function(e,t,n){"use strict";const r=n(26);class i{constructor(e,t){this.child=e,this.transform=t}open(e){this.child.open(e)}put(e,t,n){this.child.put(this.transform.convert(e),t,n)}get(e,t){this.child.get(this.transform.convert(e),t)}has(e,t){this.child.has(this.transform.convert(e),t)}delete(e,t){this.child.delete(this.transform.convert(e),t)}batch(){const e=this.child.batch();return{put:(t,n)=>{e.put(this.transform.convert(t),n)},delete:t=>{e.delete(this.transform.convert(t))},commit:t=>{e.commit(t)}}}query(e){return r(this.child.query(e),r.map(e=>(e.key=this.transform.invert(e.key),e)))}close(e){this.child.close(e)}}e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var r=n(68),i=f(r),o=n(104),s=f(o),a=n(131),u=f(a),l=n(42),c=f(l);function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t,n){n=(0,u.default)(n||i.default);var r=(0,c.default)(t);if(!e())return n(null);var o=function(t){if(t)return n(t);if(e())return r(o);var i=(0,s.default)(arguments,1);n.apply(null,[null].concat(i))};r(o)}e.exports=t.default},function(e,t,n){"use strict";(function(t){const r=n(26),i=n(829),o=n(33).utils.asyncFilter,s=n(33).utils.asyncSort,a=n(33).Key,u=n(33).Errors,l=n(838);class c{constructor(e,t){let r;t&&t.db?(r=t.db,delete t.db):r=n(842),this.db=i(l(r(e),{valueEncoding:"binary"}),Object.assign({},t,{compression:!1}),e=>{if(e)throw e})}open(e){this.db.open(t=>{if(t)return e(u.dbOpenFailedError(t));e()})}put(e,t,n){this.db.put(e.toString(),t,e=>{if(e)return n(u.dbWriteFailedError(e));n()})}get(e,t){this.db.get(e.toString(),(e,n)=>{if(e)return t(u.notFoundError(e));t(null,n)})}has(e,t){this.db.get(e.toString(),(e,n)=>{if(e)return e.notFound?void t(null,!1):void t(e);t(null,!0)})}delete(e,t){this.db.del(e.toString(),e=>{if(e)return t(u.dbDeleteFailedError(e));t()})}close(e){this.db.close(e)}batch(){const e=[];return{put:(t,n)=>{e.push({type:"put",key:t.toString(),value:n})},delete:t=>{e.push({type:"del",key:t.toString()})},commit:t=>{this.db.batch(e,t)}}}query(e){let n=!0;null!=e.keysOnly&&(n=!e.keysOnly);const i=this.db.db.iterator({keys:!0,values:n,keyAsBuffer:!0}),u=(e,r)=>{if(e)return i.end(t=>{r(t||e)});i.next((e,o,s)=>{if(e)return r(e);if(null==e&&null==o&&null==s)return i.end(e=>{r(e||!0)});const u={key:new a(o,!1)};n&&(u.value=t.from(s)),r(null,u)})};let l=[u],c=[];if(null!=e.prefix){const t=e.prefix;c.push((e,n)=>n(null,e.key.toString().startsWith(t)))}if(null!=e.filters&&(c=c.concat(e.filters)),l=l.concat(c.map(e=>o(e))),null!=e.orders&&(l=l.concat(e.orders.map(e=>s(e)))),null!=e.offset){let t=0;l.push(r.filter(()=>t++>=e.offset))}return null!=e.limit&&l.push(r.take(e.limit)),r.apply(null,l)}}e.exports=c}).call(this,n(0).Buffer)},function(e,t){t.getCallback=function(e,t){return"function"==typeof e?e:t},t.getOptions=function(e){return"object"==typeof e&&null!==e?e:{}}},function(e,t,n){"use strict";const r=n(62);t.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7},t.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36},t.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31},t.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23},t.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")},t.SHIFT32=Math.pow(2,32),t.SHIFT16=Math.pow(2,16),t.MAX_SAFE_HIGH=2097151,t.NEG_ONE=new r(-1),t.TEN=new r(10),t.TWO=new r(2),t.PARENT={ARRAY:0,OBJECT:1,MAP:2,TAG:3,BYTE_STRING:4,UTF8_STRING:5}},function(e,t,n){"use strict";(function(r){const i=n(18),o=n(53);class s{constructor(e,t,n){0!==n&&i(n,"A DAGNode requires it's serialized size"),this._data=e||r.alloc(0),this._links=t||[],this._serializedSize=n}toJSON(){return this._json||(this._json=Object.freeze({data:this.data,links:this.links.map(e=>e.toJSON()),size:this.size})),Object.assign({},this._json)}toString(){return`DAGNode `}get data(){return this._data}set data(e){throw new Error("Can't set property: 'data' is immutable")}get links(){return this._links}set links(e){throw new Error("Can't set property: 'links' is immutable")}get size(){return void 0===this._size&&(this._size=this.links.reduce((e,t)=>e+t.size,this._serializedSize)),this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}}t=e.exports=o(s,{className:"DAGNode",symbolName:"@ipld/js-ipld-dag-pb/dagnode"}),t.create=n(234),t.clone=n(887),t.addLink=n(888),t.rmLink=n(889)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(873),{serialize:i}=n(235),o=n(236),s=o.linkSort,a=n(233),u=n(117);function l(e,n,o){if("function"==typeof e?(o=e,e=void 0):"string"==typeof e&&(e=t.from(e)),"function"==typeof n&&(o=n,n=[]),!t.isBuffer(e))return o(new Error("Passed 'data' is not a buffer or a string!"));n=n.map(e=>u.isDAGLink(e)?e:u.util.createDagLinkFromB58EncodedHash(e)),n=r(n,s),i({data:e,links:n},(t,r)=>t?o(t):o(null,new a(e,n,r.length)))}e.exports=l}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(9),o=n(71),s=o(n(884)),a=n(455),u=n(117),l=n(233),c=n(58),f=n(11),h=n(14);function p(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};const o=t.hashAlg||a.defaultHashAlg;let s=t.version;void 0===s&&(s="sha2-256"===o?0:1),f([t=>{if(r.isBuffer(e))return t(null,e);d(e,t)},(e,t)=>c(e,o,t),(e,t)=>t(null,new i(s,a.multicodec,e))],n)}function d(e,t){let n,{data:r,links:i=[]}=e;!l.isDAGNode(e)&&i&&(i=i.map(e=>u.isDAGLink(e)?e:u.util.createDagLinkFromB58EncodedHash(e)));try{n=s.PBNode.encode(g({data:r,links:i}))}catch(e){return t(e)}t(null,n)}function m(e,t){const n=s.PBNode.decode(e),i=n.Links.map(e=>new u(e.Name,e.Tsize,e.Hash)),o=null==n.Data?r.alloc(0):n.Data;h(()=>t(null,new l(o,i,e.length)))}function g(e){const t={};return e.data&&e.data.length>0?t.Data=e.data:t.Data=null,e.links&&e.links.length>0?t.Links=e.links.map(e=>({Hash:e.cid.buffer,Name:e.name,Tsize:e.size})):t.Links=null,t}t=e.exports,t.serialize=d,t.deserialize=m,t.cid=p}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(117),{cid:o}=n(235);function s(e){let t;return e.data&&e.data.length>0?(t=r.alloc(e.data.length),e.data.copy(t)):t=r.alloc(0),t}function a(e){return e.links.slice()}function u(e,t){return r.compare(e.nameAsBuffer,t.nameAsBuffer)}function l(e,t,n){"function"==typeof t&&(n=t,t={}),o(e,t,(r,o)=>{if(r)return n(r);n(null,new i(t.name||"",e.size,o))})}t=e.exports,t.cloneData=s,t.cloneLinks=a,t.linkSort=u,t.toDAGLink=l}).call(this,n(0).Buffer)},function(e,t,n){var r=n(19);function i(e,t){var n=function(){return new r.aes.Algorithm(e,t)};r.cipher.registerAlgorithm(e,n)}n(458),n(459),n(34),e.exports=r.aes=r.aes||{},r.aes.startEncrypting=function(e,t,n,r){var i=m({key:e,output:n,decrypt:!1,mode:r});return i.start(t),i},r.aes.createEncryptionCipher=function(e,t){return m({key:e,output:null,decrypt:!1,mode:t})},r.aes.startDecrypting=function(e,t,n,r){var i=m({key:e,output:n,decrypt:!0,mode:r});return i.start(t),i},r.aes.createDecryptionCipher=function(e,t){return m({key:e,output:null,decrypt:!0,mode:t})},r.aes.Algorithm=function(e,t){o||h();var n=this;n.name=e,n.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return d(n._w,e,t,!1)},decrypt:function(e,t){return d(n._w,e,t,!0)}}}),n._init=!1},r.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t=e.key,n;if("string"!=typeof t||16!==t.length&&24!==t.length&&32!==t.length){if(r.util.isArray(t)&&(16===t.length||24===t.length||32===t.length)){n=t,t=r.util.createBuffer();for(var i=0;i>>=2;for(var i=0;i>8^255&p^99,a[n]=p,u[p]=n,d=e[p],i=e[n],s=e[i],h=e[s],m=d<<24^p<<16^p<<8^p^d,g=(i^s^h)<<24^(n^h)<<16^(n^s^h)<<8^n^i^h;for(var y=0;y<4;++y)c[y][n]=m,f[y][p]=g,m=m<<24|m>>>8,g=g<<24|g>>>8;0===n?n=r=1:(n=i^e[e[e[i^h]]],r^=e[e[r]])}}function p(e,t){for(var n=e.slice(0),r,i=1,o=n.length,u=o+6+1,c=s*u,h=o;h>>16&255]<<24^a[r>>>8&255]<<16^a[255&r]<<8^a[r>>>24]^l[i]<<24,i++):o>6&&h%o==4&&(r=a[r>>>24]<<24^a[r>>>16&255]<<16^a[r>>>8&255]<<8^a[255&r]),n[h]=n[h-o]^r;if(t){var p,d=f[0],m=f[1],g=f[2],y=f[3],b=n.slice(0);c=n.length;for(var h=0,v=c-s;h>>24]]^m[a[p>>>16&255]]^g[a[p>>>8&255]]^y[a[255&p]];n=b}return n}function d(e,t,n,r){var i=e.length/4-1,o,s,l,h,p,d,m,g,y,b,v,w;r?(o=f[0],s=f[1],l=f[2],h=f[3],p=u):(o=c[0],s=c[1],l=c[2],h=c[3],p=a),d=t[0]^e[0],m=t[r?3:1]^e[1],g=t[2]^e[2],y=t[r?1:3]^e[3];for(var _=3,k=1;k>>24]^s[m>>>16&255]^l[g>>>8&255]^h[255&y]^e[++_],v=o[m>>>24]^s[g>>>16&255]^l[y>>>8&255]^h[255&d]^e[++_],w=o[g>>>24]^s[y>>>16&255]^l[d>>>8&255]^h[255&m]^e[++_],y=o[y>>>24]^s[d>>>16&255]^l[m>>>8&255]^h[255&g]^e[++_],d=b,m=v,g=w;n[0]=p[d>>>24]<<24^p[m>>>16&255]<<16^p[g>>>8&255]<<8^p[255&y]^e[++_],n[r?3:1]=p[m>>>24]<<24^p[g>>>16&255]<<16^p[y>>>8&255]<<8^p[255&d]^e[++_],n[2]=p[g>>>24]<<24^p[y>>>16&255]<<16^p[d>>>8&255]<<8^p[255&m]^e[++_],n[r?1:3]=p[y>>>24]<<24^p[d>>>16&255]<<16^p[m>>>8&255]<<8^p[255&g]^e[++_]}function m(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),n="AES-"+t,i;i=e.decrypt?r.cipher.createDecipher(n,e.key):r.cipher.createCipher(n,e.key);var o=i.start;return i.start=function(e,t){var n=null;t instanceof r.util.ByteBuffer&&(n=t,t={}),t=t||{},t.output=n,t.iv=e,o.call(i,t)},i}},function(e,t,n){"use strict";var r=n(4).Buffer,i=n(931),o;function s(){this.negative=0,this.words=null,this.length=0}s.fromNumber=function(e){var t=new s;return t.words=[67108863&e],t.length=1,t},s.fromBuffer=function(e){var t=new s;return t.words=new Array(10),t.words[0]=(3&e[28])<<24|e[29]<<16|e[30]<<8|e[31],t.words[1]=(15&e[25])<<22|e[26]<<14|e[27]<<6|e[28]>>>2,t.words[2]=(63&e[22])<<20|e[23]<<12|e[24]<<4|e[25]>>>4,t.words[3]=(255&e[19])<<18|e[20]<<10|e[21]<<2|e[22]>>>6,t.words[4]=(3&e[15])<<24|e[16]<<16|e[17]<<8|e[18],t.words[5]=(15&e[12])<<22|e[13]<<14|e[14]<<6|e[15]>>>2,t.words[6]=(63&e[9])<<20|e[10]<<12|e[11]<<4|e[12]>>>4,t.words[7]=(255&e[6])<<18|e[7]<<10|e[8]<<2|e[9]>>>6,t.words[8]=(3&e[2])<<24|e[3]<<16|e[4]<<8|e[5],t.words[9]=e[0]<<14|e[1]<<6|e[2]>>>2,t.length=10,t.strip()},s.prototype.toBuffer=function(){for(var e=this.words,t=this.length;t<10;++t)e[t]=0;return r.from([e[9]>>>14&255,e[9]>>>6&255,(63&e[9])<<2|e[8]>>>24&3,e[8]>>>16&255,e[8]>>>8&255,255&e[8],e[7]>>>18&255,e[7]>>>10&255,e[7]>>>2&255,(3&e[7])<<6|e[6]>>>20&63,e[6]>>>12&255,e[6]>>>4&255,(15&e[6])<<4|e[5]>>>22&15,e[5]>>>14&255,e[5]>>>6&255,(63&e[5])<<2|e[4]>>>24&3,e[4]>>>16&255,e[4]>>>8&255,255&e[4],e[3]>>>18&255,e[3]>>>10&255,e[3]>>>2&255,(3&e[3])<<6|e[2]>>>20&63,e[2]>>>12&255,e[2]>>>4&255,(15&e[2])<<4|e[1]>>>22&15,e[1]>>>14&255,e[1]>>>6&255,(63&e[1])<<2|e[0]>>>24&3,e[0]>>>16&255,e[0]>>>8&255,255&e[0]])},s.prototype.clone=function(){var e=new s;e.words=new Array(this.length);for(var t=0;t1&&0==(0|this.words[this.length-1]);)this.length--;return this},s.prototype.normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.ucmp=function(e){if(this.length!==e.length)return this.length>e.length?1:-1;for(var t=this.length-1;t>=0;--t)if(this.words[t]!==e.words[t])return this.words[t]>e.words[t]?1:-1;return 0},s.prototype.gtOne=function(){return this.length>1||this.words[0]>1},s.prototype.isOverflow=function(){return this.ucmp(s.n)>=0},s.prototype.isHigh=function(){return 1===this.ucmp(s.nh)},s.prototype.bitLengthGT256=function(){return this.length>10||10===this.length&&this.words[9]>4194303},s.prototype.iuaddn=function(e){this.words[0]+=e;for(var t=0;this.words[t]>67108863&&te.length?(t=this,n=e):(t=e,n=this);for(var r=0,i=0;r>>26}for(;0!==i&&r>>26;if(this.length=t.length,0!==i)this.words[this.length++]=i;else if(t!==this)for(;r0?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;i>26,this.words[i]=67108863&s}for(;0!==o&&i>26,this.words[i]=67108863&s;if(0===o&&i>>26,c=67108863&s,f=Math.max(0,a-e.length+1),h=Math.min(a,t.length-1);f<=h;f++){var p=a-f,d=e.words[p],m=t.words[f],g=d*m+c;l+=g/67108864|0,c=67108863&g}n.words[a]=c,s=l}return 0!==s&&(n.words[n.length++]=s),n.strip()},s.umulTo10x10=Math.imul?i.umulTo10x10:s.umulTo,s.umulnTo=function(e,t,n){if(0===t)return n.words=[0],n.length=1,n;for(var r=0,i=0;r0?(n.words[r]=i,n.length=e.length+1):n.length=e.length,n},s.prototype.umul=function(e){var t=new s;return t.words=new Array(this.length+e.length),10===this.length&&10===e.length?s.umulTo10x10(this,e,t):1===this.length?s.umulnTo(e,this.words[0],t):1===e.length?s.umulnTo(this,e.words[0],t):s.umulTo(this,e,t)},s.prototype.isplit=function(e){e.length=Math.min(this.length,9);for(var t=0;t>>22,n=r}return n>>>=22,this.words[t-10]=n,0===n&&this.length>10?this.length-=10:this.length-=9,this},s.prototype.fireduce=function(){return this.isOverflow()&&this.isub(s.n),this},s.prototype.ureduce=function(){var e=this.clone().isplit(s.tmp).umul(s.nc).iadd(s.tmp);return e.bitLengthGT256()&&(e=e.isplit(s.tmp).umul(s.nc).iadd(s.tmp),e.bitLengthGT256()&&(e=e.isplit(s.tmp).umul(s.nc).iadd(s.tmp))),e.fireduce()},s.prototype.ishrn=function(e){for(var t=(1<=0;--r){var o=this.words[r];this.words[r]=i<>>e,i=o&t}return this.length>1&&0===this.words[this.length-1]&&(this.length-=1),this},s.prototype.uinvm=function(){for(var e=this.clone(),t=s.n.clone(),n=s.fromNumber(1),r=s.fromNumber(0),i=s.fromNumber(0),o=s.fromNumber(1);e.isEven()&&t.isEven();){for(var a=1,u=1;0==(e.words[0]&u)&&0==(t.words[0]&u)&&a<26;++a,u<<=1);e.ishrn(a),t.ishrn(a)}for(var l=t.clone(),c=e.clone();!e.isZero();){for(var f=0,h=1;0==(e.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(e.ishrn(f);f-- >0;)(n.isOdd()||r.isOdd())&&(n.iadd(l),r.isub(c)),n.ishrn(1),r.ishrn(1);for(var p=0,d=1;0==(t.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(t.ishrn(p);p-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(l),o.isub(c)),i.ishrn(1),o.ishrn(1);e.ucmp(t)>=0?(e.isub(t),n.isub(i),r.isub(o)):(t.isub(e),i.isub(n),o.isub(r))}if(1===i.negative){i.negative=0;var m=i.ureduce();return m.negative^=1,m.normSign().iadd(s.n)}return i.ureduce()},s.prototype.imulK=function(){this.words[this.length]=0,this.words[this.length+1]=0,this.length+=2;for(var e=0,t=0;e0?this.isub(s.p):this.strip(),this},s.prototype.redNeg=function(){return this.isZero()?s.fromNumber(0):s.p.sub(this)},s.prototype.redAdd=function(e){return this.clone().redIAdd(e)},s.prototype.redIAdd=function(e){return this.iadd(e),this.ucmp(s.p)>=0&&this.isub(s.p),this},s.prototype.redIAdd7=function(){return this.iuaddn(7),this.ucmp(s.p)>=0&&this.isub(s.p),this},s.prototype.redSub=function(e){return this.clone().redISub(e)},s.prototype.redISub=function(e){return this.isub(e),0!==this.negative&&this.iadd(s.p),this},s.prototype.redMul=function(e){return this.umul(e).redIReduce()},s.prototype.redSqr=function(){return this.umul(this).redIReduce()},s.prototype.redSqrt=function(){if(this.isZero())return this.clone();for(var e=this.redSqr(),t=e.redSqr(),n=t.redSqr().redMul(t),r=n.redMul(e),i=r.redMul(this),o=i,s=0;s<54;++s)o=o.redSqr().redSqr().redSqr().redSqr().redMul(i);for(o=o.redSqr().redSqr().redSqr().redSqr().redMul(r),s=0;s<5;++s)o=o.redSqr().redSqr().redSqr().redSqr().redMul(i);return o=o.redSqr().redSqr().redSqr().redSqr().redMul(n),o=o.redSqr().redSqr().redSqr().redSqr().redSqr().redSqr().redMul(n),0===o.redSqr().ucmp(this)?o:null},s.prototype.redInvm=function(){for(var e=this.clone(),t=s.p.clone(),n=s.fromNumber(1),r=s.fromNumber(0),i;e.gtOne()&&t.gtOne();){for(var o=0,a=1;0==(e.words[0]&a)&&o<26;++o,a<<=1);if(o>0)for(e.ishrn(o);o-- >0;)n.isOdd()&&n.iadd(s.p),n.ishrn(1);for(var u=0,l=1;0==(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.ishrn(u);u-- >0;)r.isOdd()&&r.iadd(s.p),r.ishrn(1);e.ucmp(t)>=0?(e.isub(t),n.isub(r)):(t.isub(e),r.isub(n))}return i=1===e.length&&1===e.words[0]?n:r,0!==i.negative&&i.iadd(s.p),0!==i.negative?(i.negative=0,i.redIReduce().redNeg()):i.redIReduce()},s.prototype.getNAF=function(e){for(var t=[],n=1<>1,o=this.clone();!o.isZero();){for(var s=0,a=1;0==(o.words[0]&a)&&s<26;++s,a<<=1)t.push(0);if(0!==s)o.ishrn(s);else{var u=o.words[0]&r;if(u>=i)t.push(i-u),o.iuaddn(u-i).ishrn(1);else if(t.push(u),o.words[0]-=u,!o.isZero()){for(s=e-1;s>0;--s)t.push(0);o.ishrn(e)}}}return t},s.prototype.inspect=function(){if(this.isZero())return"0";for(var e=this.toBuffer().toString("hex"),t=0;"0"===e[t];++t);return e.slice(t)},s.n=s.fromBuffer(r.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","hex")),s.nh=s.n.clone().ishrn(1),s.nc=s.fromBuffer(r.from("000000000000000000000000000000014551231950B75FC4402DA1732FC9BEBF","hex")),s.p=s.fromBuffer(r.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","hex")),s.psn=s.p.sub(s.n),s.tmp=new s,s.tmp.words=new Array(10),o=s.fromNumber(1),o.words[3]=0,e.exports=s},function(e,t,n){var r=n(4).Buffer;function i(e){r.isBuffer(e)||(e=r.from(e));for(var t=e.length/4|0,n=new Array(t),i=0;i>>24]^s[c>>>16&255]^a[f>>>8&255]^u[255&h]^t[y++],d=o[c>>>24]^s[f>>>16&255]^a[h>>>8&255]^u[255&l]^t[y++],m=o[f>>>24]^s[h>>>16&255]^a[l>>>8&255]^u[255&c]^t[y++],g=o[h>>>24]^s[l>>>16&255]^a[c>>>8&255]^u[255&f]^t[y++],l=p,c=d,f=m,h=g;return p=(r[l>>>24]<<24|r[c>>>16&255]<<16|r[f>>>8&255]<<8|r[255&h])^t[y++],d=(r[c>>>24]<<24|r[f>>>16&255]<<16|r[h>>>8&255]<<8|r[255&l])^t[y++],m=(r[f>>>24]<<24|r[h>>>16&255]<<16|r[l>>>8&255]<<8|r[255&c])^t[y++],g=(r[h>>>24]<<24|r[l>>>16&255]<<16|r[c>>>8&255]<<8|r[255&f])^t[y++],p>>>=0,d>>>=0,m>>>=0,g>>>=0,[p,d,m,g]}var a=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var n=[],r=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,u=0;u<256;++u){var l=a^a<<1^a<<2^a<<3^a<<4;l=l>>>8^255&l^99,n[s]=l,r[l]=s;var c=e[s],f=e[c],h=e[f],p=257*e[l]^16843008*l;i[0][s]=p<<24|p>>>8,i[1][s]=p<<16|p>>>16,i[2][s]=p<<8|p>>>24,i[3][s]=p,p=16843009*h^65537*f^257*c^16843008*s,o[0][l]=p<<24|p>>>8,o[1][l]=p<<16|p>>>16,o[2][l]=p<<8|p>>>24,o[3][l]=p,0===s?s=a=1:(s=c^e[e[e[h^c]]],a^=e[e[a]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:o}}();function l(e){this._key=i(e),this._reset()}l.blockSize=16,l.keySize=32,l.prototype.blockSize=l.blockSize,l.prototype.keySize=l.keySize,l.prototype._reset=function(){for(var e=this._key,t=e.length,n=t+6,r=4*(n+1),i=[],o=0;o>>24,s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s],s^=a[o/t|0]<<24):t>6&&o%t==4&&(s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s]),i[o]=i[o-t]^s}for(var l=[],c=0;c>>24]]^u.INV_SUB_MIX[1][u.SBOX[h>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[h>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&h]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=l},l.prototype.encryptBlockRaw=function(e){return e=i(e),s(e,this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},l.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),n=r.allocUnsafe(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[1],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[3],12),n},l.prototype.decryptBlock=function(e){e=i(e);var t=e[1];e[1]=e[3],e[3]=t;var n=s(e,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=r.allocUnsafe(16);return o.writeUInt32BE(n[0],0),o.writeUInt32BE(n[3],4),o.writeUInt32BE(n[2],8),o.writeUInt32BE(n[1],12),o},l.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},e.exports.AES=l},function(e,t){function n(e){return e}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=n(68),i=a(r),o=n(291),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){return function(n,r,o,a){a=a||i.default;var u=!1,l;n(r,function(n,r,i){o(n,function(r,o){r?i(r):e(o)&&!l?(u=!0,l=t(!0,n),i(null,s.default)):i()})},function(e){e?a(e):a(null,u?l:t(!1))})}}e.exports=t.default},function(e,t,n){"use strict";const r=n(71),i=n(137),o=n(981),s=n(18),a=n(56),u=n(91),l=n(9),c=n(982),f=n(984),h=n(58),p=r(n(985)),d=n(986);class m{constructor(e){this.full=e,this.wantlist=new Map,this.blocks=new Map}get empty(){return 0===this.blocks.size&&0===this.wantlist.size}addEntry(e,t,n){s(e&&l.isCID(e),"must be a valid cid");const r=e.buffer.toString(),i=this.wantlist.get(r);i?(i.priority=t,i.cancel=Boolean(n)):this.wantlist.set(r,new d(e,t,n))}addBlock(e){s(i.isBlock(e),"must be a valid cid");const t=e.cid.buffer.toString();this.blocks.set(t,e)}cancel(e){s(l.isCID(e),"must be a valid cid");const t=e.buffer.toString();this.wantlist.delete(t),this.addEntry(e,0,!0)}serializeToBitswap100(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map(e=>({block:e.cid.buffer,priority:Number(e.priority),cancel:Boolean(e.cancel)}))},blocks:Array.from(this.blocks.values()).map(e=>e.data)};return this.full&&(e.wantlist.full=!0),p.Message.encode(e)}serializeToBitswap110(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map(e=>({block:e.cid.buffer,priority:Number(e.priority),cancel:Boolean(e.cancel)}))},payload:[]};return this.full&&(e.wantlist.full=!0),this.blocks.forEach(t=>{e.payload.push({prefix:t.cid.prefix,data:t.data})}),p.Message.encode(e)}equals(e){const t=(e,t)=>{if(e.equals&&"function"==typeof e.equals)return e.equals(t)};return!(this.full!==e.full||!o(this.wantlist,e.wantlist,t)||!o(this.blocks,e.blocks,t))}get[Symbol.toStringTag](){const e=Array.from(this.wantlist.keys()),t=Array.from(this.blocks.keys());return`BitswapMessage `}}m.deserialize=((e,t)=>{let n;try{n=p.Message.decode(e)}catch(e){return u(()=>t(e))}const r=n.wantlist&&n.wantlist.full||!1,o=new m(r);return n.wantlist&&n.wantlist.entries.forEach(e=>{let n;try{n=new l(e.block)}catch(e){return t(e)}o.addEntry(n,e.priority,e.cancel)}),n.blocks.length>0?a(n.blocks,(e,n)=>{h(e,"sha2-256",(r,s)=>{if(r)return n(r);let a;try{a=new l(s)}catch(r){return t(r)}o.addBlock(new i(e,a)),n()})},e=>{if(e)return t(e);t(null,o)}):n.payload.length>0?a(n.payload,(e,t)=>{if(!e.prefix||!e.data)return u(t);const n=f(e.prefix),r=n[0],s=n[1],a=n[2];h(e.data,a,(n,a)=>{if(n)return t(n);let u;try{u=new l(r,c[s.toString("16")],a)}catch(n){return t(n)}o.addBlock(new i(e.data,u)),t()})},e=>{if(e)return t(e);t(null,o)}):void t(null,o)}),m.Entry=d,e.exports=m},function(e,t,n){"use strict";const{sortBy:r}=n(120),i=n(987);class o{constructor(e){this.set=new Map,this._stats=e}get length(){return this.set.size}add(e,t){const n=e.buffer.toString(),r=this.set.get(n);r?(r.inc(),r.priority=t):(this.set.set(n,new i(e,t)),this._stats&&this._stats.push(null,"wantListSize",1))}remove(e){const t=e.buffer.toString(),n=this.set.get(t);n&&(n.dec(),n.hasRefs()||(this.set.delete(t),this._stats&&this._stats.push(null,"wantListSize",-1)))}removeForce(e){this.set.has(e)&&this.set.delete(e)}forEach(e){return this.set.forEach(e)}entries(){return this.set.entries()}sortedEntries(){return new Map(r(e=>e[1].key,Array.from(this.set.entries())))}contains(e){const t=e.buffer.toString();return this.set.get(t)}}o.Entry=i,e.exports=o},function(e,t,n){var r=n(493);function i(e,t,n){var i=null==e?void 0:r(e,t);return void 0===i?n:i}e.exports=i},function(e,t,n){var r=n(121),i=r(Object,"create");e.exports=i},function(e,t,n){var r=n(1012),i=n(1013),o=n(1014),s=n(1015),a=n(1016);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function l(){try{return window.localStorage}catch(e){}}t=e.exports=n(1062),t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:l(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(this,n(2))},function(e,t){t.encode=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t},t.decode=function(e){for(var t={},n=e.split("&"),r=0,i=n.length;r=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function l(){try{return window.localStorage}catch(e){}}t=e.exports=n(1079),t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:l(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(this,n(2))},function(e,t,n){(function(t){e.exports=f;var r=n(5)("simple-peer"),i=n(1086),o=n(1),s=n(148),a=n(1087),u=65536,l=5e3,c=5e3;function f(e){var t=this;if(!(t instanceof f))return new f(e);if(t._id=s(4).toString("hex").slice(0,7),t._debug("new peer %o",e),e=Object.assign({allowHalfOpen:!1},e),a.Duplex.call(t,e),t.channelName=e.initiator?e.channelName||s(20).toString("hex"):null,t.initiator=e.initiator||!1,t.channelConfig=e.channelConfig||f.channelConfig,t.config=Object.assign({},f.config,e.config),t.offerOptions=e.offerOptions||{},t.answerOptions=e.answerOptions||{},t.sdpTransform=e.sdpTransform||function(e){return e},t.streams=e.streams||(e.stream?[e.stream]:[]),t.trickle=void 0===e.trickle||e.trickle,t.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,t.iceCompleteTimeout=e.iceCompleteTimeout||l,t.destroyed=!1,t.connected=!1,t.remoteAddress=void 0,t.remoteFamily=void 0,t.remotePort=void 0,t.localAddress=void 0,t.localFamily=void 0,t.localPort=void 0,t._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:i(),!t._wrtc)throw"undefined"==typeof window?p("No WebRTC support: Specify `opts.wrtc` option in this environment","ERR_WEBRTC_SUPPORT"):p("No WebRTC support: Not a supported browser","ERR_WEBRTC_SUPPORT");t._pcReady=!1,t._channelReady=!1,t._iceComplete=!1,t._iceCompleteTimer=null,t._channel=null,t._pendingCandidates=[],t._isNegotiating=!t.initiator,t._batchedNegotiation=!1,t._queuedNegotiation=!1,t._sendersAwaitingStable=[],t._senderMap=new Map,t._firstStable=!0,t._closingInterval=null,t._remoteTracks=[],t._remoteStreams=[],t._chunk=null,t._cb=null,t._interval=null;try{t._pc=new t._wrtc.RTCPeerConnection(t.config)}catch(e){t.destroy(e)}t._isReactNativeWebrtc="number"==typeof t._pc._peerConnectionId,t._pc.oniceconnectionstatechange=function(){t._onIceStateChange()},t._pc.onicegatheringstatechange=function(){t._onIceStateChange()},t._pc.onsignalingstatechange=function(){t._onSignalingStateChange()},t._pc.onicecandidate=function(e){t._onIceCandidate(e)},t.initiator?t._setupData({channel:t._pc.createDataChannel(t.channelName,t.channelConfig)}):t._pc.ondatachannel=function(e){t._setupData(e)},t.streams&&t.streams.forEach(function(e){t.addStream(e)}),t._pc.ontrack=function(e){t._onTrack(e)},t.initiator&&t._needsNegotiation(),t._onFinishBound=function(){t._onFinish()},t.once("finish",t._onFinishBound)}function h(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}function p(e,t){var n=new Error(e);return n.code=t,n}o(f,a.Duplex),f.WEBRTC_SUPPORT=!!i(),f.config={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:global.stun.twilio.com:3478?transport=udp"}],sdpSemantics:"unified-plan"},f.channelConfig={},Object.defineProperty(f.prototype,"bufferSize",{get:function(){var e=this;return this._channel&&this._channel.bufferedAmount||0}}),f.prototype.address=function(){var e=this;return{port:this.localPort,family:this.localFamily,address:this.localAddress}},f.prototype.signal=function(e){var t=this;if(t.destroyed)throw p("cannot signal after peer is destroyed","ERR_SIGNALING");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}t._debug("signal()"),e.renegotiate&&t.initiator&&(t._debug("got request to renegotiate"),t._needsNegotiation()),e.transceiverRequest&&t.initiator&&(t._debug("got request for transceiver"),t.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(t._pc.localDescription&&t._pc.localDescription.type&&t._pc.remoteDescription&&t._pc.remoteDescription.type?t._addIceCandidate(e.candidate):t._pendingCandidates.push(e.candidate)),e.sdp&&t._pc.setRemoteDescription(new t._wrtc.RTCSessionDescription(e)).then(function(){t.destroyed||(t._pendingCandidates.forEach(function(e){t._addIceCandidate(e)}),t._pendingCandidates=[],"offer"===t._pc.remoteDescription.type&&t._createAnswer())}).catch(function(e){t.destroy(p(e,"ERR_SET_REMOTE_DESCRIPTION"))}),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||t.destroy(p("signal() called with invalid signal data","ERR_SIGNALING"))},f.prototype._addIceCandidate=function(e){var t=this;t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e)).catch(function(e){if("closed"!==t._pc.signalingState&&"Failed to set ICE candidate; RTCPeerConnection is closed."===e.message)return t._debug("ignoring incorrect wrtc error");t.destroy(p(e,"ERR_ADD_ICE_CANDIDATE"))})},f.prototype.send=function(e){var t=this;this._channel.send(e)},f.prototype.addTransceiver=function(e,t){var n=this;if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(e){this.destroy(e)}else this.emit("signal",{transceiverRequest:{kind:e,init:t}})},f.prototype.addStream=function(e){var t=this;t._debug("addStream()"),e.getTracks().forEach(function(n){t.addTrack(n,e)})},f.prototype.addTrack=function(e,t){var n=this;this._debug("addTrack()");var r=this._senderMap.get(e)||new Map,i=r.get(t);i?i.removed?this.destroy(p("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):this.destroy(p("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED"):(i=this._pc.addTrack(e,t),r.set(t,i),this._senderMap.set(e,r),this._needsNegotiation())},f.prototype.replaceTrack=function(e,t,n){var r=this;this._debug("replaceTrack()");var i=this._senderMap.get(e),o=i?i.get(n):null;o||this.destroy(p("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED"),t&&this._senderMap.set(t,i),null!=o.replaceTrack?o.replaceTrack(t):this.destroy(p("replaceTrack is not supported in this browser","ERR_UNSUPPORTED_REPLACETRACK"))},f.prototype.removeTrack=function(e,t){var n=this;this._debug("removeSender()");var r=this._senderMap.get(e),i=r?r.get(t):null;i||this.destroy(p("Cannot remove track that was never added.","ERR_TRACK_NOT_ADDED"));try{i.removed=!0,this._pc.removeTrack(i)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?this._sendersAwaitingStable.push(i):this.destroy(e)}this._needsNegotiation()},f.prototype.removeStream=function(e){var t=this;t._debug("removeSenders()"),e.getTracks().forEach(function(n){t.removeTrack(n,e)})},f.prototype._needsNegotiation=function(){var e=this;e._debug("_needsNegotiation"),e._batchedNegotiation||(e._batchedNegotiation=!0,setTimeout(function(){e._batchedNegotiation=!1,e._debug("starting batched negotiation"),e.negotiate()},0))},f.prototype.negotiate=function(){var e=this;e.initiator?e._isNegotiating?(e._queuedNegotiation=!0,e._debug("already negotiating, queueing")):(e._debug("start negotiation"),setTimeout(()=>{e._createOffer()},0)):e._isNegotiating||(e._debug("requesting negotiation from initiator"),e.emit("signal",{renegotiate:!0})),e._isNegotiating=!0},f.prototype.destroy=function(e){var t=this;this._destroy(e,function(){})},f.prototype._destroy=function(e,t){var n=this;if(!this.destroyed){if(this._debug("destroy (error: %s)",e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this.destroyed=!0,this.connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(e){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,e&&this.emit("error",e),this.emit("close"),t()}},f.prototype._setupData=function(e){var t=this;if(!e.channel)return t.destroy(p("Data channel event is missing `channel` property","ERR_DATA_CHANNEL"));t._channel=e.channel,t._channel.binaryType="arraybuffer","number"==typeof t._channel.bufferedAmountLowThreshold&&(t._channel.bufferedAmountLowThreshold=65536),t.channelName=t._channel.label,t._channel.onmessage=function(e){t._onChannelMessage(e)},t._channel.onbufferedamountlow=function(){t._onChannelBufferedAmountLow()},t._channel.onopen=function(){t._onChannelOpen()},t._channel.onclose=function(){t._onChannelClose()},t._channel.onerror=function(e){t.destroy(p(e,"ERR_DATA_CHANNEL"))};var n=!1;t._closingInterval=setInterval(function(){t._channel&&"closing"===t._channel.readyState?(n&&t._onChannelClose(),n=!0):n=!1},5e3)},f.prototype._read=function(){},f.prototype._write=function(e,t,n){var r=this;if(this.destroyed)return n(p("cannot write after peer is destroyed","ERR_DATA_CHANNEL"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(p(e,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=e,this._cb=n},f.prototype._onFinish=function(){var e=this;function t(){setTimeout(function(){e.destroy()},1e3)}e.destroyed||(e.connected?t():e.once("connect",t))},f.prototype._startIceCompleteTimeout=function(){var e=this;e.destroyed||e._iceCompleteTimer||(e._debug("started iceComplete timeout"),e._iceCompleteTimer=setTimeout(function(){e._iceComplete||(e._iceComplete=!0,e._debug("iceComplete timeout completed"),e.emit("iceTimeout"),e.emit("_iceComplete"))},e.iceCompleteTimeout))},f.prototype._createOffer=function(){var e=this;e.destroyed||e._pc.createOffer(e.offerOptions).then(function(t){function n(){e._debug("createOffer success"),e.destroyed||(e.trickle||e._iceComplete?i():e.once("_iceComplete",i))}function r(t){e.destroy(p(t,"ERR_SET_LOCAL_DESCRIPTION"))}function i(){if(!e.destroyed){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp})}}e.destroyed||(e.trickle||e.allowHalfTrickle||(t.sdp=h(t.sdp)),t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(n).catch(r))}).catch(function(t){e.destroy(p(t,"ERR_CREATE_OFFER"))})},f.prototype._requestMissingTransceivers=function(){var e=this;e._pc.getTransceivers&&e._pc.getTransceivers().forEach(t=>{!t.mid&&t.sender.track&&e.addTransceiver(t.sender.track.kind)})},f.prototype._createAnswer=function(){var e=this;e.destroyed||e._pc.createAnswer(e.answerOptions).then(function(t){function n(){e.destroyed||(e.trickle||e._iceComplete?i():e.once("_iceComplete",i))}function r(t){e.destroy(p(t,"ERR_SET_LOCAL_DESCRIPTION"))}function i(){if(!e.destroyed){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp}),e.initiator||e._requestMissingTransceivers()}}e.destroyed||(e.trickle||e.allowHalfTrickle||(t.sdp=h(t.sdp)),t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(n).catch(r))}).catch(function(t){e.destroy(p(t,"ERR_CREATE_ANSWER"))})},f.prototype._onIceStateChange=function(){var e=this;if(!this.destroyed){var t=this._pc.iceConnectionState,n=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",t,n),this.emit("iceStateChange",t,n),"connected"!==t&&"completed"!==t||(this._pcReady=!0,this._maybeReady()),"failed"===t&&this.destroy(p("Ice connection failed.","ERR_ICE_CONNECTION_FAILURE")),"closed"===t&&this.destroy(p("Ice connection closed.","ERR_ICE_CONNECTION_CLOSED"))}},f.prototype.getStats=function(e){var t=this;function n(e){return"[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach(function(t){Object.assign(e,t)}),e}0===t._pc.getStats.length?t._pc.getStats().then(function(t){var r=[];t.forEach(function(e){r.push(n(e))}),e(null,r)},function(t){e(t)}):t._isReactNativeWebrtc?t._pc.getStats(null,function(t){var r=[];t.forEach(function(e){r.push(n(e))}),e(null,r)},function(t){e(t)}):t._pc.getStats.length>0?t._pc.getStats(function(r){if(!t.destroyed){var i=[];r.result().forEach(function(e){var t={};e.names().forEach(function(n){t[n]=e.stat(n)}),t.id=e.id,t.type=e.type,t.timestamp=e.timestamp,i.push(n(t))}),e(null,i)}},function(t){e(t)}):e(null,[])},f.prototype._maybeReady=function(){var e=this;function t(){e.destroyed||e.getStats(function(n,r){if(!e.destroyed){n&&(r=[]);var i={},o={},s={},a=!1;if(r.forEach(function(e){"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(i[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(o[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(s[e.id]=e)}),r.forEach(function(e){"transport"===e.type&&e.selectedCandidatePairId&&l(s[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&l(e)}),a||Object.keys(s).length&&!Object.keys(o).length){if(e._connecting=!1,e.connected=!0,e._chunk){try{e.send(e._chunk)}catch(n){return e.destroy(p(n,"ERR_DATA_CHANNEL"))}e._chunk=null,e._debug('sent chunk from "write before connect"');var u=e._cb;e._cb=null,u(null)}"number"!=typeof e._channel.bufferedAmountLowThreshold&&(e._interval=setInterval(function(){e._onInterval()},150),e._interval.unref&&e._interval.unref()),e._debug("connect"),e.emit("connect")}else setTimeout(t,100)}function l(t){a=!0;var n=o[t.localCandidateId];n&&(n.ip||n.address)?(e.localAddress=n.ip||n.address,e.localPort=Number(n.port)):n&&n.ipAddress?(e.localAddress=n.ipAddress,e.localPort=Number(n.portNumber)):"string"==typeof t.googLocalAddress&&(n=t.googLocalAddress.split(":"),e.localAddress=n[0],e.localPort=Number(n[1])),e.localAddress&&(e.localFamily=e.localAddress.includes(":")?"IPv6":"IPv4");var r=i[t.remoteCandidateId];r&&(r.ip||r.address)?(e.remoteAddress=r.ip||r.address,e.remotePort=Number(r.port)):r&&r.ipAddress?(e.remoteAddress=r.ipAddress,e.remotePort=Number(r.portNumber)):"string"==typeof t.googRemoteAddress&&(r=t.googRemoteAddress.split(":"),e.remoteAddress=r[0],e.remotePort=Number(r[1])),e.remoteAddress&&(e.remoteFamily=e.remoteAddress.includes(":")?"IPv6":"IPv4"),e._debug("connect local: %s:%s remote: %s:%s",e.localAddress,e.localPort,e.remoteAddress,e.remotePort)}})}e._debug("maybeReady pc %s channel %s",e._pcReady,e._channelReady),!e.connected&&!e._connecting&&e._pcReady&&e._channelReady&&(e._connecting=!0,t())},f.prototype._onInterval=function(){var e=this;!this._cb||!this._channel||this._channel.bufferedAmount>65536||this._onChannelBufferedAmountLow()},f.prototype._onSignalingStateChange=function(){var e=this;e.destroyed||("stable"!==e._pc.signalingState||e._firstStable||(e._isNegotiating=!1,e._debug("flushing sender queue",e._sendersAwaitingStable),e._sendersAwaitingStable.forEach(function(t){e._pc.removeTrack(t),e._queuedNegotiation=!0}),e._sendersAwaitingStable=[],e._queuedNegotiation&&(e._debug("flushing negotiation queue"),e._queuedNegotiation=!1,e._needsNegotiation()),e._debug("negotiate"),e.emit("negotiate")),e._firstStable=!1,e._debug("signalingStateChange %s",e._pc.signalingState),e.emit("signalingStateChange",e._pc.signalingState))},f.prototype._onIceCandidate=function(e){var t=this;this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())},f.prototype._onChannelMessage=function(e){var n=this;if(!this.destroyed){var r=e.data;r instanceof ArrayBuffer&&(r=t.from(r)),this.push(r)}},f.prototype._onChannelBufferedAmountLow=function(){var e=this;if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);var t=this._cb;this._cb=null,t(null)}},f.prototype._onChannelOpen=function(){var e=this;this.connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())},f.prototype._onChannelClose=function(){var e=this;this.destroyed||(this._debug("on channel close"),this.destroy())},f.prototype._onTrack=function(e){var t=this;t.destroyed||e.streams.forEach(function(n){t._debug("on track"),t.emit("track",e.track,n),t._remoteTracks.push({track:e.track,stream:n}),t._remoteStreams.some(function(e){return e.id===n.id})||(t._remoteStreams.push(n),setTimeout(function(){t.emit("stream",n)},0))})},f.prototype._debug=function(){var e=this,t=[].slice.call(arguments);t[0]="["+this._id+"] "+t[0],r.apply(null,t)}}).call(this,n(0).Buffer)},function(e,t,n){var r=n(28),i=function(){},o=function(e){return e.setHeader&&"function"==typeof e.abort},s=function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length},a=function(e,t,n){if("function"==typeof t)return a(e,null,t);t||(t={}),n=r(n||i);var u=e._writableState,l=e._readableState,c=t.readable||!1!==t.readable&&e.readable,f=t.writable||!1!==t.writable&&e.writable,h=function(){e.writable||p()},p=function(){f=!1,c||n.call(e)},d=function(){c=!1,f||n.call(e)},m=function(t){n.call(e,t?new Error("exited with error code: "+t):null)},g=function(t){n.call(e,t)},y=function(){return(!c||l&&l.ended)&&(!f||u&&u.ended)?void 0:n.call(e,new Error("premature close"))},b=function(){e.req.on("finish",p)};return o(e)?(e.on("complete",p),e.on("abort",y),e.req?b():e.on("request",b)):f&&!u&&(e.on("end",h),e.on("close",h)),s(e)&&e.on("exit",m),e.on("end",d),e.on("finish",p),!1!==t.error&&e.on("error",g),e.on("close",y),function(){e.removeListener("complete",p),e.removeListener("abort",y),e.removeListener("request",b),e.req&&e.req.removeListener("finish",p),e.removeListener("end",h),e.removeListener("close",h),e.removeListener("finish",p),e.removeListener("exit",m),e.removeListener("end",d),e.removeListener("error",g),e.removeListener("close",y)}};e.exports=a},function(e,t){var n=function(){};function r(e,t,n){var r=e.length;if(!r)return n(t);function i(){--r||n(t)}e.forEach(function(e){e?e(t,i):i()}),r||i()}e.exports=function(e){return function(t,n){!function i(){t?r(e,t,n):e.length?e[0]?e[0](null,function(t,o){t?(e.shift(),!0===t?i():r(e,t,n)):n(null,o)}):(e.shift(),i()):n(!0)}()}}},function(e,t,n){"use strict";e.exports=function(){var e,t;function n(n){if("function"!=typeof n)throw new Error("read must be function");if(e)throw new Error("already piped");if(e=n,t){var r=t;t=null,e.apply(null,r)}}function r(n,r){e?e(n,r):t=[n,r]}return{source:r,sink:n}}},function(e,t,n){"use strict";t.Listener=t.listener=n(1129),t.Dialer=t.dialer=n(1132),t.matchSemver=n(1133),t.matchExact=n(532)},function(e,t,n){"use strict";(function(r){const i=n(12),o=n(43),s=n(37),a=n(72),u=n(5);function l(){return(~~(1e9*Math.random())).toString(36)}function c(e,t){i(o(r.isBuffer(e)?[e]:[r.from(e)]),a.encode(),s((e,n)=>{if(e)return t(e);t(null,n[0])}))}function f(e){const t=l();function n(e){return n=>{Array.isArray(n)&&(n=n.join(" ")),e("(%s) %s",t,n)}}const r=n(u("mss:"+e));return r.error=n(u("mss:"+e+":error")),r}t=e.exports,t.writeEncoded=((e,t,n)=>{c(t,(t,r)=>{if(t)return n(t);e.write(r)})}),t.log={},t.log.dialer=(()=>f("dialer\t")),t.log.listener=(()=>f("listener\t"))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";t.importer=t.Importer=n(550),t.exporter=t.Exporter=n(123)},function(e,t,n){var r=n(1216);function i(e,t){return(e=e||[]).push(t),e}e.exports=function(e,t,n,o){var s,a,u;function l(i){var c=null,f=!1,h=0;if(u=i,s)return i(!!s.abort||s,function(e){o(e),a&&a()});var p=!1,d=r(function(){p||s||(p=!0,i(null,function(e,r){p=!1,function(e,r){s||(s=e,s?f||o(!0===s?null:s):(c=t(c,r),h=c&&c.length||0,null!=c&&m(),h{let l=a.cidVersion||i,c=a.hashAlg||o,f=a.codec||s;if(t.isBuffer(e)&&(l=1,f="raw"),"sha2-256"!==c&&(l=1),a.onlyHash)return r(e,{version:l,hashAlg:c},(t,n)=>{u(t,{cid:n,node:e})});n.put(e,{version:l,hashAlg:c,format:f},(t,n)=>{u(t,{cid:n,node:e})})};e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(1231),i=n(229),o=n(11),s=n(38),a=n(48),u=s.DAGLink,l=s.DAGNode,c=n(58),f=n(341),h=n(262),p=n(1232),d=n(12),m=n(406),g=n(90),y=n(1235),b=function(e){return new Promise((n,r)=>{c(e,"murmur3-128",(e,i)=>{if(e)r(e);else{const e=i.slice(2,10),r=e.length,o=t.alloc(r);for(let t=0;t{e(t.key,t.value,n)}),m(t))}flush(e,t,n,r){k(this._options,this._bucket,e,t,n,(e,t)=>{if(e)return r(e);this.multihash=t.cid.buffer,this.size=t.node.size,r(null,t)})}}function _(e,t){return new w(e,t)}function k(e,n,s,c,f,p){const d=n._children;let m=0;const g=[];function b(t,n,i){const o=r(n.toString(16).toUpperCase(),2,"0");if(y.isBucket(t))k(e,t,s,c,null,(e,{cid:t,node:n})=>{e?i(e):(g.push(new u(o,n.size,t)),i())});else{const e=t.value,n=o+t.key;g.push(new u(n,e.size,e.multihash)),i()}}function v(r,i){const u=t.from(d.bitField().reverse()),p=new a("hamt-sharded-directory",u);p.fanout=n.tableSize(),p.hashType=e.hashFn.code,o([e=>l.create(p.marshal(),r,e),(t,n)=>h(t,c,e,n),({cid:e,node:t},n)=>{const r={path:s,size:t.size,multihash:e.buffer};f&&f.push(r),n(null,{cid:e,node:t})}],i)}i(()=>m{const t=d.get(m);t?b(t,m,t=>{m++,e(t)}):(m++,e())},e=>{e?p(e):v(g,p)})}e.exports=_,e.exports.hashFn=b}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(e){const r=n(9);function i(e){const t={},n=e.split("-");switch(n.length){case 1:t.avgChunkSize=262144;break;case 2:t.avgChunkSize=o(n[1],"avg");break;case 4:t.minChunkSize=o(n[1],"min"),t.avgChunkSize=o(n[2],"avg"),t.maxChunkSize=o(n[3],"max");break;default:throw new Error('Incorrect chunker format (expected "rabin" "rabin-[avg]" or "rabin-[min]-[avg]-[max]"')}return t}function o(e,t){let n=parseInt(e);if(isNaN(n))throw new Error(`Chunker parameter ${t} must be an integer`);return n}t.normalizePath=(t=>e.isBuffer(t)?new r(t).toString():r.isCID(t)?t.toString():(0===t.indexOf("/ipfs/")&&(t=t.substring("/ipfs/".length)),"/"===t.charAt(t.length-1)&&(t=t.substring(0,t.length-1)),t)),t.parseChunkerString=(e=>{if(e){if(e.startsWith("size-")){const t=e.split("-")[1],n=parseInt(t);if(isNaN(n))throw new Error("Chunker parameter size must be an integer");return{chunker:"fixed",chunkerOptions:{maxChunkSize:n}}}if(e.startsWith("rabin"))return{chunker:"rabin",chunkerOptions:i(e)};throw new Error(`Unrecognized chunker option: ${e}`)}return{chunker:"fixed"}})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(33).Key,i={file:0,directory:1,"hamt-sharded-directory":1};e.exports={FILE_SEPARATOR:"/",MFS_ROOT_KEY:new r("/local/filesroot"),MAX_CHUNK_SIZE:262144,MAX_LINKS:174,FILE_TYPES:i}},function(e,t,n){"use strict";var r=n(1269),i="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-",o,s,a;function u(){a=!1}function l(e){if(e){if(e!==o){if(e.length!==i.length)throw new Error("Custom alphabet for shortid must be "+i.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter(function(e,t,n){return t!==n.lastIndexOf(e)});if(t.length)throw new Error("Custom alphabet for shortid must be "+i.length+" unique characters. These characters were not unique: "+t.join(", "));o=e,u()}}else o!==i&&(o=i,u())}function c(e){return l(e),o}function f(e){r.seed(e),s!==e&&(u(),s=e)}function h(){o||l(i);for(var e=o.split(""),t=[],n=r.nextValue(),s;e.length>0;)n=r.nextValue(),s=Math.floor(n*e.length),t.push(e.splice(s,1)[0]);return t.join("")}function p(){return a||(a=h(),a)}function d(e){var t=p();return t[e]}function m(){return o||i}e.exports={get:m,characters:c,seed:f,lookup:d,shuffled:p}},function(e,t,n){"use strict";const r=n(48).unmarshal,{formatCid:i,toMfsPath:o,loadNode:s}=n(82),a=n(11),u=n(12),l=n(37),c=n(90),f=n(123),h=n(9),p=n(5)("ipfs:mfs:stat"),d={hash:!1,size:!1,withLocal:!1,cidBase:"base58btc"};e.exports=(e=>(function t(n,m,g){"function"==typeof m&&(g=m,m={}),m=Object.assign({},d,m),p(`Fetching stats for ${n}`),a([t=>o(e,n,t),({mfsPath:t,depth:o},a)=>{u(f(t,e.ipld,{maxDepth:o}),c((t,n)=>m.hash?n(null,{hash:i(new h(t.hash),m.cidBase)}):m.size?n(null,{size:t.size}):void s(e,{cid:t.hash},(e,t)=>{if(e)return n(e);const{node:o,cid:s}=t,a=r(o.data);let u=o.links.length;"file"===a.type&&(u=a.blockSizes.length),n(null,{hash:i(s,m.cidBase),size:a.fileSize()||0,cumulativeSize:o.size,blocks:u,type:a.type,local:void 0,sizeLocal:void 0,withLocality:!1})})),l((e,t)=>e?a(e):t.length?(p(`Stats for ${n}`,t[0]),a(null,t[0])):a(new Error(`${n} does not exist`))))}],g)}))},function(e,t,n){"use strict";var r=t;r.base=n(1332),r.short=n(1333),r.mont=n(1334),r.edwards=n(1335)},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=n(1388),o=n(1394),s=n(18),a=n(193),u=n(63),l=n(143),c=n(4).Buffer;Object.assign(t,n(1396)),t.MAX_INTEGER=new u("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new u("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.SHA3_NULL_S=t.KECCAK256_NULL_S,t.KECCAK256_NULL=c.from(t.KECCAK256_NULL_S,"hex"),t.SHA3_NULL=t.KECCAK256_NULL,t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.SHA3_RLP_ARRAY_S=t.KECCAK256_RLP_ARRAY_S,t.KECCAK256_RLP_ARRAY=c.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.SHA3_RLP_ARRAY=t.KECCAK256_RLP_ARRAY,t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.SHA3_RLP_S=t.KECCAK256_RLP_S,t.KECCAK256_RLP=c.from(t.KECCAK256_RLP_S,"hex"),t.SHA3_RLP=t.KECCAK256_RLP,t.BN=u,t.rlp=a,t.secp256k1=o,t.zeros=function(e){return c.allocUnsafe(e).fill(0)},t.zeroAddress=function(){var e=20,n=t.zeros(20);return t.bufferToHex(n)},t.setLengthLeft=t.setLength=function(e,n,r){var i=t.zeros(n);return e=t.toBuffer(e),r?e.length0&&"0"===n.toString();)e=e.slice(1),n=e[0];return e},t.toBuffer=function(e){if(!c.isBuffer(e))if(Array.isArray(e))e=c.from(e);else if("string"==typeof e)e=t.isHexString(e)?c.from(t.padToEven(t.stripHexPrefix(e)),"hex"):c.from(e);else if("number"==typeof e)e=t.intToBuffer(e);else if(null===e||void 0===e)e=c.allocUnsafe(0);else if(u.isBN(e))e=e.toArrayLike(c);else{if(!e.toArray)throw new Error("invalid type");e=c.from(e.toArray())}return e},t.bufferToInt=function(e){return new u(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return e=t.toBuffer(e),"0x"+e.toString("hex")},t.fromSigned=function(e){return new u(e).fromTwos(256)},t.toUnsigned=function(e){return c.from(e.toTwos(256).toArray())},t.keccak=function(e,n){return e=t.toBuffer(e),n||(n=256),i("keccak"+n).update(e).digest()},t.keccak256=function(e){return t.keccak(e)},t.sha3=t.keccak,t.sha256=function(e){return e=t.toBuffer(e),l("sha256").update(e).digest()},t.ripemd160=function(e,n){e=t.toBuffer(e);var r=l("rmd160").update(e).digest();return!0===n?t.setLength(r,32):r},t.rlphash=function(e){return t.keccak(a.encode(e))},t.isValidPrivate=function(e){return o.privateKeyVerify(e)},t.isValidPublic=function(e,t){return 64===e.length?o.publicKeyVerify(c.concat([c.from([4]),e])):!!t&&o.publicKeyVerify(e)},t.pubToAddress=t.publicToAddress=function(e,n){return e=t.toBuffer(e),n&&64!==e.length&&(e=o.publicKeyConvert(e,!1).slice(1)),s(64===e.length),t.keccak(e).slice(-20)};var f=t.privateToPublic=function(e){return e=t.toBuffer(e),o.publicKeyCreate(e,!1).slice(1)};t.importPublic=function(e){return e=t.toBuffer(e),64!==e.length&&(e=o.publicKeyConvert(e,!1).slice(1)),e},t.ecsign=function(e,t){var n=o.sign(e,t),r={};return r.r=n.signature.slice(0,32),r.s=n.signature.slice(32,64),r.v=n.recovery+27,r},t.hashPersonalMessage=function(e){var n=t.toBuffer("Ethereum Signed Message:\n"+e.length.toString());return t.keccak(c.concat([n,e]))},t.ecrecover=function(e,n,r,i){var s=c.concat([t.setLength(r,32),t.setLength(i,32)],64),a=n-27;if(0!==a&&1!==a)throw new Error("Invalid signature v value");var u=o.recover(e,s,a);return o.publicKeyConvert(u,!1).slice(1)},t.toRpcSig=function(e,n,r){if(27!==e&&28!==e)throw new Error("Invalid recovery id");return t.bufferToHex(c.concat([t.setLengthLeft(n,32),t.setLengthLeft(r,32),t.toBuffer(e-27)]))},t.fromRpcSig=function(e){if(e=t.toBuffer(e),65!==e.length)throw new Error("Invalid signature length");var n=e[64];return n<27&&(n+=27),{v:n,r:e.slice(0,32),s:e.slice(32,64)}},t.privateToAddress=function(e){return t.publicToAddress(f(e))},t.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/.test(e)},t.isZeroAddress=function(e){var n=t.zeroAddress();return n===t.addHexPrefix(e)},t.toChecksumAddress=function(e){e=t.stripHexPrefix(e).toLowerCase();for(var n=t.keccak(e).toString("hex"),r="0x",i=0;i=8?r+=e[i].toUpperCase():r+=e[i];return r},t.isValidChecksumAddress=function(e){return t.isValidAddress(e)&&t.toChecksumAddress(e)===e},t.generateAddress=function(e,n){return e=t.toBuffer(e),n=new u(n),n=n.isZero()?null:c.from(n.toArray()),t.rlphash([e,n]).slice(-20)},t.isPrecompiled=function(e){var n=t.unpad(e);return 1===n.length&&n[0]>=1&&n[0]<=8},t.addHexPrefix=function(e){return"string"!=typeof e?e:t.isHexPrefixed(e)?e:"0x"+e},t.isValidSignature=function(e,t,n,r){var i=new u("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),o=new u("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);return 32===t.length&&32===n.length&&((27===e||28===e)&&(t=new u(t),n=new u(n),!(t.isZero()||t.gt(o)||n.isZero()||n.gt(o))&&(!1!==r||1!==new u(n).cmp(i))))},t.baToJSON=function(e){if(c.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var n=[],r=0;r=i.length,"The field "+n.name+" must not have more "+n.length+" bytes")):n.allowZero&&0===i.length||!n.length||s(n.length===i.length,"The field "+n.name+" must have byte length of "+n.length),e.raw[r]=i}e._fields.push(n.name),Object.defineProperty(e,n.name,{enumerable:!0,configurable:!0,get:i,set:o}),n.default&&(e[n.name]=n.default),n.alias&&Object.defineProperty(e,n.alias,{enumerable:!1,configurable:!0,set:o,get:i})}),i)if("string"==typeof i&&(i=c.from(t.stripHexPrefix(i),"hex")),c.isBuffer(i)&&(i=a.decode(i)),Array.isArray(i)){if(i.length>e._fields.length)throw new Error("wrong number of fields in data");i.forEach(function(n,r){e[e._fields[r]]=t.toBuffer(n)})}else{if("object"!==(void 0===i?"undefined":r(i)))throw new Error("invalid data");var o=Object.keys(i);n.forEach(function(t){-1!==o.indexOf(t.name)&&(e[t.name]=i[t.name]),-1!==o.indexOf(t.alias)&&(e[t.alias]=i[t.alias])})}}},function(e,t,n){"use strict";const r=n(271).SmartBuffer,i=n(403),o=n(1426),s=n(35),a=n(9);t=e.exports,t.SHA1_LENGTH=i.defaultLengths[i.names.sha1],t.find=((e,t)=>{for(let n=0;n{let t=e.match(/^(([^<]+)\s)?\s?<([^>]+)>\s?(\d+\s[+\-\d]+)?$/);return null===t?null:{name:t[2],email:t[3],date:t[4]}}),t.serializePersonLine=(e=>{let t=[];return e.name&&t.push(e.name),t.push("<"+e.email+">"),e.date&&t.push(e.date),t.join(" ")}),t.shaToCid=(e=>{let n=new r;return n.writeUInt8(1),n.writeBuffer(o["git-raw"]),n.writeUInt8(i.names.sha1),n.writeUInt8(t.SHA1_LENGTH),n.writeBuffer(e),n.toBuffer()}),t.cidToSha=(e=>{let t=s.decode(new a(e).multihash);return"sha1"!==t.name?null:t.digest})},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const r=n(1425),i=4096,o="utf8";class s{constructor(t){if(this.length=0,this._encoding=o,this._writeOffset=0,this._readOffset=0,s.isSmartBufferOptions(t))if(t.encoding&&(r.checkEncoding(t.encoding),this._encoding=t.encoding),t.size){if(!(r.isFiniteInteger(t.size)&&t.size>0))throw new Error(r.ERRORS.INVALID_SMARTBUFFER_SIZE);this._buff=e.allocUnsafe(t.size)}else if(t.buff){if(!(t.buff instanceof e))throw new Error(r.ERRORS.INVALID_SMARTBUFFER_BUFFER);this._buff=t.buff,this.length=t.buff.length}else this._buff=e.allocUnsafe(i);else{if(void 0!==t)throw new Error(r.ERRORS.INVALID_SMARTBUFFER_OBJECT);this._buff=e.allocUnsafe(i)}}static fromSize(e,t){return new this({size:e,encoding:t})}static fromBuffer(e,t){return new this({buff:e,encoding:t})}static fromOptions(e){return new this(e)}static isSmartBufferOptions(e){const t=e;return t&&(void 0!==t.encoding||void 0!==t.size||void 0!==t.buff)}readInt8(t){return this._readNumberValue(e.prototype.readInt8,1,t)}readInt16BE(t){return this._readNumberValue(e.prototype.readInt16BE,2,t)}readInt16LE(t){return this._readNumberValue(e.prototype.readInt16LE,2,t)}readInt32BE(t){return this._readNumberValue(e.prototype.readInt32BE,4,t)}readInt32LE(t){return this._readNumberValue(e.prototype.readInt32LE,4,t)}writeInt8(t,n){return this._writeNumberValue(e.prototype.writeInt8,1,t,n),this}insertInt8(t,n){return this._insertNumberValue(e.prototype.writeInt8,1,t,n)}writeInt16BE(t,n){return this._writeNumberValue(e.prototype.writeInt16BE,2,t,n)}insertInt16BE(t,n){return this._insertNumberValue(e.prototype.writeInt16BE,2,t,n)}writeInt16LE(t,n){return this._writeNumberValue(e.prototype.writeInt16LE,2,t,n)}insertInt16LE(t,n){return this._insertNumberValue(e.prototype.writeInt16LE,2,t,n)}writeInt32BE(t,n){return this._writeNumberValue(e.prototype.writeInt32BE,4,t,n)}insertInt32BE(t,n){return this._insertNumberValue(e.prototype.writeInt32BE,4,t,n)}writeInt32LE(t,n){return this._writeNumberValue(e.prototype.writeInt32LE,4,t,n)}insertInt32LE(t,n){return this._insertNumberValue(e.prototype.writeInt32LE,4,t,n)}readUInt8(t){return this._readNumberValue(e.prototype.readUInt8,1,t)}readUInt16BE(t){return this._readNumberValue(e.prototype.readUInt16BE,2,t)}readUInt16LE(t){return this._readNumberValue(e.prototype.readUInt16LE,2,t)}readUInt32BE(t){return this._readNumberValue(e.prototype.readUInt32BE,4,t)}readUInt32LE(t){return this._readNumberValue(e.prototype.readUInt32LE,4,t)}writeUInt8(t,n){return this._writeNumberValue(e.prototype.writeUInt8,1,t,n)}insertUInt8(t,n){return this._insertNumberValue(e.prototype.writeUInt8,1,t,n)}writeUInt16BE(t,n){return this._writeNumberValue(e.prototype.writeUInt16BE,2,t,n)}insertUInt16BE(t,n){return this._insertNumberValue(e.prototype.writeUInt16BE,2,t,n)}writeUInt16LE(t,n){return this._writeNumberValue(e.prototype.writeUInt16LE,2,t,n)}insertUInt16LE(t,n){return this._insertNumberValue(e.prototype.writeUInt16LE,2,t,n)}writeUInt32BE(t,n){return this._writeNumberValue(e.prototype.writeUInt32BE,4,t,n)}insertUInt32BE(t,n){return this._insertNumberValue(e.prototype.writeUInt32BE,4,t,n)}writeUInt32LE(t,n){return this._writeNumberValue(e.prototype.writeUInt32LE,4,t,n)}insertUInt32LE(t,n){return this._insertNumberValue(e.prototype.writeUInt32LE,4,t,n)}readFloatBE(t){return this._readNumberValue(e.prototype.readFloatBE,4,t)}readFloatLE(t){return this._readNumberValue(e.prototype.readFloatLE,4,t)}writeFloatBE(t,n){return this._writeNumberValue(e.prototype.writeFloatBE,4,t,n)}insertFloatBE(t,n){return this._insertNumberValue(e.prototype.writeFloatBE,4,t,n)}writeFloatLE(t,n){return this._writeNumberValue(e.prototype.writeFloatLE,4,t,n)}insertFloatLE(t,n){return this._insertNumberValue(e.prototype.writeFloatLE,4,t,n)}readDoubleBE(t){return this._readNumberValue(e.prototype.readDoubleBE,8,t)}readDoubleLE(t){return this._readNumberValue(e.prototype.readDoubleLE,8,t)}writeDoubleBE(t,n){return this._writeNumberValue(e.prototype.writeDoubleBE,8,t,n)}insertDoubleBE(t,n){return this._insertNumberValue(e.prototype.writeDoubleBE,8,t,n)}writeDoubleLE(t,n){return this._writeNumberValue(e.prototype.writeDoubleLE,8,t,n)}insertDoubleLE(t,n){return this._insertNumberValue(e.prototype.writeDoubleLE,8,t,n)}readString(e,t){let n;"number"==typeof e?(r.checkLengthValue(e),n=Math.min(e,this.length-this._readOffset)):(t=e,n=this.length-this._readOffset),void 0!==t&&r.checkEncoding(t);const i=this._buff.slice(this._readOffset,this._readOffset+n).toString(t||this._encoding);return this._readOffset+=n,i}insertString(e,t,n){return r.checkOffsetValue(t),this._handleString(e,!0,t,n)}writeString(e,t,n){return this._handleString(e,!1,t,n)}readStringNT(e){void 0!==e&&r.checkEncoding(e);let t=this.length;for(let e=this._readOffset;ethis.length)throw new Error(r.ERRORS.INVALID_READ_BEYOND_BOUNDS)}ensureInsertable(e,t){r.checkOffsetValue(t),this._ensureCapacity(this.length+e),tthis.length?this.length=t+e:this.length+=e}_ensureWriteable(e,t){const n="number"==typeof t?t:this._writeOffset;this._ensureCapacity(n+e),n+e>this.length&&(this.length=n+e)}_ensureCapacity(t){const n=this._buff.length;if(t>n){let r=this._buff,i=3*n/2+1;i"},e.exports=p}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(599),o=n(0),s="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),a=function e(n){if(!(this instanceof e))return new e(n);if(t.isBuffer(n)){var r=n;this.fromBuffer(r)}else if("string"==typeof n){var i=n;this.fromString(i)}else n&&this.set(n)};a.validCharacters=function e(t){return o.Buffer.isBuffer(t)&&(t=t.toString()),r.all(r.map(t,function(e){return r.contains(s,e)}))},a.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},a.encode=function(e){if(!o.Buffer.isBuffer(e))throw new Error("Input should be a buffer");return i.encode(e)},a.decode=function(e){if("string"!=typeof e)throw new Error("Input should be a string");return new t(i.decode(e))},a.prototype.fromBuffer=function(e){return this.buf=e,this},a.prototype.fromString=function(e){var t=a.decode(e);return this.buf=t,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){e.exports=n(359),e.exports.Input=n(360),e.exports.Output=n(111),e.exports.UnspentOutput=n(601),e.exports.Signature=n(199),e.exports.Sighash=n(110)},function(e,t,n){"use strict";(function(t,r){function i(){}i.getRandomBuffer=function(e){return t.browser?i.getRandomBufferBrowser(e):i.getRandomBufferNode(e)},i.getRandomBufferNode=function(e){var t=n(15);return t.randomBytes(e)},i.getRandomBufferBrowser=function(e){if(!window.crypto&&!window.msCrypto)throw new Error("window.crypto not available");if(window.crypto&&window.crypto.getRandomValues)var t=window.crypto;else{if(!window.msCrypto||!window.msCrypto.getRandomValues)throw new Error("window.crypto.getRandomValues not available");var t=window.msCrypto}var n=new Uint8Array(e);t.getRandomValues(n);var i=new r(n);return i},i.getPseudoRandomBuffer=function(e){for(var t=4294967296,n=new r(e),i,o=0;o<=e;o++){var s=Math.floor(o/4),a=o-4*s;0===a?(i=Math.random()*t,n[o]=255&i):n[o]=255&(i>>>=8)}return n},e.exports=i}).call(this,n(2),n(0).Buffer)},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(49),o=n(30),s=n(109),a=n(80),u=n(60),l=n(41),c=n(25),f=537133055,h=function e(t){if(!(this instanceof e))return new e(t);var n=e._from(t);return this.version=n.version,this.prevHash=n.prevHash,this.merkleRoot=n.merkleRoot,this.reserved=n.reserved,this.time=n.time,this.timestamp=n.time,this.bits=n.bits,this.nonce=n.nonce,this.solution=n.solution,n.hash&&c.checkState(this.hash===n.hash,"Argument object hash property does not match block hash."),this};h._from=function e(t){var n={};if(o.isBuffer(t))n=h._fromBufferReader(s(t));else{if(!r.isObject(t))throw new TypeError("Unrecognized argument for BlockHeader");n=h._fromObject(t)}return n},h._fromObject=function e(n){c.checkArgument(n,"data is required");var i=n.prevHash,s=n.merkleRoot,a=n.reserved,u=n.nonce,l=n.solution;r.isString(n.prevHash)&&(i=o.reverse(new t(n.prevHash,"hex"))),r.isString(n.merkleRoot)&&(s=o.reverse(new t(n.merkleRoot,"hex"))),r.isString(n.reserved)&&(a=o.reverse(new t(n.reserved,"hex"))),r.isString(n.nonce)&&(u=o.reverse(new t(n.nonce,"hex"))),r.isString(n.solution)&&(l=new t(n.solution,"hex"));var f={hash:n.hash,version:n.version,prevHash:i,merkleRoot:s,reserved:a,time:n.time,timestamp:n.time,bits:n.bits,nonce:u,solution:l};return f},h.fromObject=function e(t){var n=h._fromObject(t);return new h(n)},h.fromRawBlock=function e(n){o.isBuffer(n)||(n=new t(n,"binary"));var r=s(n);r.pos=h.Constants.START_OF_HEADER;var i=h._fromBufferReader(r);return new h(i)},h.fromBuffer=function e(t){var n=h._fromBufferReader(s(t));return new h(n)},h.fromString=function e(n){var r=new t(n,"hex");return h.fromBuffer(r)},h._fromBufferReader=function e(t){var n={};n.version=t.readUInt32LE(),n.prevHash=t.read(32),n.merkleRoot=t.read(32),n.reserved=t.read(32),n.time=t.readUInt32LE(),n.bits=t.readUInt32LE(),n.nonce=t.read(32);var r=t.readVarintNum();return n.solution=t.read(r),n},h.fromBufferReader=function e(t){var n=h._fromBufferReader(t);return new h(n)},h.prototype.toObject=h.prototype.toJSON=function e(){return{hash:this.hash,version:this.version,prevHash:o.reverse(this.prevHash).toString("hex"),merkleRoot:o.reverse(this.merkleRoot).toString("hex"),reserved:o.reverse(this.reserved).toString("hex"),time:this.time,bits:this.bits,nonce:o.reverse(this.nonce).toString("hex"),solution:this.solution.toString("hex")}},h.prototype.toBuffer=function e(){return this.toBufferWriter().concat()},h.prototype.toString=function e(){return this.toBuffer().toString("hex")},h.prototype.toBufferWriter=function e(t){return t||(t=new a),t.writeUInt32LE(this.version),t.write(this.prevHash),t.write(this.merkleRoot),t.write(this.reserved),t.writeUInt32LE(this.time),t.writeUInt32LE(this.bits),t.write(this.nonce),t.writeVarintNum(this.solution.length),t.write(this.solution),t},h.prototype.getTargetDifficulty=function e(t){t=t||this.bits;for(var n=new i(16777215&t),r=8*((t>>>24)-3);r-- >0;)n=n.mul(new i(2));return n},h.prototype.getDifficulty=function e(){var t=this.getTargetDifficulty(537133055).mul(new i(Math.pow(10,8))),n=this.getTargetDifficulty(),r=t.div(n).toString(10),o=r.length-8;return r=r.slice(0,o)+"."+r.slice(o),parseFloat(r)},h.prototype._getHash=function e(){var t=this.toBuffer();return u.sha256sha256(t)};var p={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=s(this._getHash()).readReverse().toString("hex")),this._id},set:r.noop};Object.defineProperty(h.prototype,"id",p),Object.defineProperty(h.prototype,"hash",p),h.prototype.validTimestamp=function e(){var t=Math.round((new Date).getTime()/1e3);return!(this.time>t+h.Constants.MAX_TIME_OFFSET)},h.prototype.validProofOfWork=function e(){var t=new i(this.id,"hex"),n=this.getTargetDifficulty();return!(t.cmp(n)>0)},h.prototype.inspect=function e(){return""},h.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new i("10000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=h}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var n=Object.prototype.toString,r="function"==typeof t.alloc&&"function"==typeof t.allocUnsafe&&"function"==typeof t.from;function i(e){return"ArrayBuffer"===n.call(e).slice(8,-1)}function o(e,n,i){n>>>=0;var o=e.byteLength-n;if(o<0)throw new RangeError("'offset' is out of bounds");if(void 0===i)i=o;else if(i>>>=0,i>o)throw new RangeError("'length' is out of bounds");return r?t.from(e.slice(n,n+i)):new t(new Uint8Array(e.slice(n,n+i)))}function s(e,n){if("string"==typeof n&&""!==n||(n="utf8"),!t.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');return r?t.from(e,n):new t(e,n)}function a(e,n,a){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return i(e)?o(e,n,a):"string"==typeof e?s(e,n):r?t.from(e):new t(e)}e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){t=e.exports=n(628),t.Stream=t,t.Readable=t,t.Writable=n(631),t.Duplex=n(157),t.Transform=n(632),t.PassThrough=n(1502)},function(e,t,n){var r=e.exports;r.encode=n(1726),r.decode=n(1727),r.byteLength=r.encodingLength=function(e){return r.encode(e).length}},function(e,t,n){"use strict";function r(e,t){for(var n=1,r=e.length,i=e[0],o=e[0],s=1;s>3;return e%8!=0&&t++,t}r.prototype.get=function(e){var t=e>>3;return t>e%8)},r.prototype.set=function(e,t){var n=e>>3;t||1===arguments.length?(this.buffer.length>e%8):n>e%8))},r.prototype._grow=function(e){if(this.buffer.length4294967295&&(o=1),t.writeUInt32BE(o,n),t.write(e.type,n+4,4,"ascii");var a=n+8;if(1===o&&(r.encode(e.length,t,a),a+=8),s.fullBoxes[i]&&(t.writeUInt32BE(e.flags||0,a),t.writeUInt8(e.version||0,a),a+=4),l[i]){var c=l[i];c.forEach(function(n){if(5===n.length){var r=e[n]||[];n=n.substr(0,4),r.forEach(function(e){u._encode(e,t,a),a+=u.encode.bytes})}else e[n]&&(u._encode(e[n],t,a),a+=u.encode.bytes)}),e.otherBoxes&&e.otherBoxes.forEach(function(e){u._encode(e,t,a),a+=u.encode.bytes})}else if(s[i]){var f=s[i].encode;f(e,t,a),a+=f.bytes}else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+i+"') or `buffer` must be set");var h=e.buffer;h.copy(t,a),a+=e.buffer.length}return u.encode.bytes=a-n,t},u.readHeaders=function(e,t,n){if(t=t||0,n=n||e.length,n-t<8)return 8;var i=e.readUInt32BE(t),o=e.toString("ascii",t+4,t+8),a=t+8,u,l;if(1===i){if(n-t<16)return 16;i=r.decode(e,a),a+=8}return s.fullBoxes[o]&&(u=e.readUInt8(a),l=16777215&e.readUInt32BE(a),a+=4),{length:i,headersLen:a-t,contentLen:i-(a-t),type:o,version:u,flags:l}},u.decode=function(e,t,n){t=t||0,n=n||e.length;var r=u.readHeaders(e,t,n);if(!r||r.length>n-t)throw new Error("Data too short");return u.decodeWithoutHeaders(r,e,t+r.headersLen,t+r.length)},u.decodeWithoutHeaders=function(e,t,n,r){n=n||0,r=r||t.length;var i=e.type,a={};if(l[i]){a.otherBoxes=[];for(var c=l[i],f=n;r-f>=8;){var h=u.decode(t,f,r);if(f+=h.length,c.indexOf(h.type)>=0)a[h.type]=h;else if(c.indexOf(h.type+"s")>=0){var p=h.type+"s",d=a[p]=a[p]||[];d.push(h)}else a.otherBoxes.push(h)}}else if(s[i]){var m=s[i].decode;a=m(t,n,r)}else a.buffer=o(t.slice(n,r));return a.length=e.length,a.contentLen=e.contentLen,a.type=e.type,a.version=e.version,a.flags=e.flags,a},u.encodingLength=function(e){var t=e.type,n=8;if(s.fullBoxes[t]&&(n+=4),l[t]){var r=l[t];r.forEach(function(t){if(5===t.length){var r=e[t]||[];t=t.substr(0,4),r.forEach(function(e){e.type=t,n+=u.encodingLength(e)})}else if(e[t]){var i=e[t];i.type=t,n+=u.encodingLength(i)}}),e.otherBoxes&&e.otherBoxes.forEach(function(e){n+=u.encodingLength(e)})}else if(s[t])n+=s[t].encodingLength(e);else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+t+"') or `buffer` must be set");n+=e.buffer.length}return n>4294967295&&(n+=8),e.length=n,n}},function(e,t,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)i(n,r)&&(e[r]=n[r])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var o={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var o=0;o0;--s){o=o.twice();var a=n.testBit(s),u=t.testBit(s);a!=u&&(o=o.add(a?this:i))}return o}function S(e,t,n){var r;r=e.bitLength()>n.bitLength()?e.bitLength()-1:n.bitLength()-1;for(var i=this.curve.getInfinity(),o=this.add(t);r>=0;)i=i.twice(),e.testBit(r)?i=n.testBit(r)?i.add(o):i.add(this):n.testBit(r)&&(i=i.add(t)),--r;return i}function E(e,t,n){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(n),this.infinity=new d(this,null,null),this.reducer=new i(this.q)}function x(){return this.q}function C(){return this.a}function A(){return this.b}function I(e){return e==this||this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)}function T(){return this.infinity}function j(e){return new o(this.q,e)}function O(e){this.reducer.reduce(e)}function P(e){switch(parseInt(e.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var t=(e.length-2)/2,n=e.substr(2,t),i=e.substr(t+2,t);return new d(this,this.fromBigInteger(new r(n,16)),this.fromBigInteger(new r(i,16)));default:return null}}function B(e){if(e.isInfinity())return"00";var t=e.getX().toBigInteger().toString(16),n=e.getY().toBigInteger().toString(16),r=this.getQ().toString(16).length;for(r%2!=0&&r++;t.length128){var t=this.q.shiftRight(e-64);-1==t.intValue()&&(this.r=r.ONE.shiftLeft(e).subtract(this.q))}return this.r},o.prototype.modMult=function(e,t){return this.modReduce(e.multiply(t))},o.prototype.modReduce=function(e){if(null!=this.getR()){for(var t=q.bitLength();e.bitLength()>t+1;){var n=e.shiftRight(t),i=e.subtract(n.shiftLeft(t));this.getR().equals(r.ONE)||(n=n.multiply(this.getR())),e=n.add(i)}for(;e.compareTo(q)>=0;)e=e.subtract(q)}else e=e.mod(q);return e},o.prototype.sqrt=function(){if(!this.q.testBit(0))throw"unsupported";if(this.q.testBit(1)){var e=new o(this.q,this.x.modPow(this.q.shiftRight(2).add(r.ONE),this.q));return e.square().equals(this)?e:null}var t=this.q.subtract(r.ONE),n=t.shiftRight(1);if(!this.x.modPow(n,this.q).equals(r.ONE))return null;var i=t.shiftRight(2),s=i.shiftLeft(1).add(r.ONE),a=this.x,u=modDouble(modDouble(a)),l,c;do{var f;do{f=new r(this.q.bitLength(),new SecureRandom)}while(f.compareTo(this.q)>=0||!f.multiply(f).subtract(u).modPow(n,this.q).equals(t));var h=this.lucasSequence(f,a,s);if(l=h[0],c=h[1],this.modMult(c,c).equals(u))return c.testBit(0)&&(c=c.add(q)),c=c.shiftRight(1),new o(q,c)}while(l.equals(r.ONE)||l.equals(t));return null},o.prototype.lucasSequence=function(e,t,n){for(var i=n.bitLength(),o=n.getLowestSetBit(),s=r.ONE,a=r.TWO,u=e,l=r.ONE,c=r.ONE,f=i-1;f>=o+1;--f)l=this.modMult(l,c),n.testBit(f)?(c=this.modMult(l,t),s=this.modMult(s,u),a=this.modReduce(u.multiply(a).subtract(e.multiply(l))),u=this.modReduce(u.multiply(u).subtract(c.shiftLeft(1)))):(c=l,s=this.modReduce(s.multiply(a).subtract(l)),u=this.modReduce(u.multiply(a).subtract(e.multiply(l))),a=this.modReduce(a.multiply(a).subtract(l.shiftLeft(1))));l=this.modMult(l,c),c=this.modMult(l,t),s=this.modReduce(s.multiply(a).subtract(l)),a=this.modReduce(u.multiply(a).subtract(e.multiply(l))),l=this.modMult(l,c);for(var f=1;f<=o;++f)s=this.modMult(s,a),a=this.modReduce(a.multiply(a).subtract(l.shiftLeft(1))),l=this.modMult(l,l);return[s,a]};var t={ECCurveFp:E,ECPointFp:d,ECFieldElementFp:o};e.exports=t},function(e,t,n){e.exports={read:g,readSSHPrivate:b,write:v};var r=n(27),i=n(103),o=n(31).Buffer,s=n(55),a=n(47),u=n(15),l=n(46),c=n(50),f=n(113),h=n(114),p=n(210),d=n(97),m;function g(e,t){return f.read(e,t)}var y="openssh-key-v1";function b(e,t,i){t=new p({buffer:t});var s=t.readCString();r.strictEqual(s,y,"bad magic string");var l=t.readString(),c=t.readString(),f=t.readBuffer(),g=t.readInt();if(1!==g)throw new Error("OpenSSH-format key file contains multiple keys: this is unsupported.");var b=t.readBuffer();if("public"===e)return r.ok(t.atEnd(),"excess bytes left after key"),h.read(b);var v=t.readBuffer();r.ok(t.atEnd(),"excess bytes left after key");var w=new p({buffer:f});switch(c){case"none":if("none"!==l)throw new Error('OpenSSH-format key uses KDF "none" but specifies a cipher other than "none"');break;case"bcrypt":var _=w.readBuffer(),k=w.readInt(),S=a.opensshCipherInfo(l);if(void 0===m&&(m=n(714)),"string"==typeof i.passphrase&&(i.passphrase=o.from(i.passphrase,"utf-8")),!o.isBuffer(i.passphrase))throw new d.KeyEncryptedError(i.filename,"OpenSSH");var E=new Uint8Array(i.passphrase),x=new Uint8Array(_),C=new Uint8Array(S.keySize+S.blockSize),A=m.pbkdf(E,E.length,x,x.length,C,C.length,k);if(0!==A)throw new Error("bcrypt_pbkdf function returned failure, parameters invalid");C=o.from(C);var I=C.slice(0,S.keySize),T=C.slice(S.keySize,S.keySize+S.blockSize),j=u.createDecipheriv(S.opensslName,I,T);j.setAutoPadding(!1);var O,P=[];for(j.once("error",function(e){if(-1!==e.toString().indexOf("bad decrypt"))throw new Error("Incorrect passphrase supplied, could not decrypt key");throw e}),j.write(v),j.end();null!==(O=j.read());)P.push(O);v=o.concat(P);break;default:throw new Error('OpenSSH-format key uses unknown KDF "'+c+'"')}t=new p({buffer:v});var B=t.readInt(),R=t.readInt();if(B!==R)throw new Error("Incorrect passphrase supplied, could not decrypt key");var N={},M=h.readInternal(N,"private",t.remainder());t.skip(N.consumed);var L=t.readString();return M.comment=L,M}function v(e,t){var i;i=c.isPrivateKey(e)?e.toPublic():e;var s="none",l="none",f=o.alloc(0),h={blockSize:8},d,g;if(void 0!==t&&(d=t.passphrase,"string"==typeof d&&(d=o.from(d,"utf-8")),void 0!==d&&(r.buffer(d,"options.passphrase"),r.optionalString(t.cipher,"options.cipher"),s=t.cipher,void 0===s&&(s="aes128-ctr"),h=a.opensshCipherInfo(s),l="bcrypt")),c.isPrivateKey(e)){g=new p({});var b=u.randomBytes(4).readUInt32BE(0);g.writeInt(b),g.writeInt(b),g.write(e.toBuffer("rfc4253")),g.writeString(e.comment||"");for(var v=1;g._offset%h.blockSize!=0;)g.writeChar(v++);g=g.toBuffer()}switch(l){case"none":break;case"bcrypt":var w=u.randomBytes(16),_=16,k=new p({});k.writeBuffer(w),k.writeInt(16),f=k.toBuffer(),void 0===m&&(m=n(714));var S=new Uint8Array(d),E=new Uint8Array(w),x=new Uint8Array(h.keySize+h.blockSize),C=m.pbkdf(S,S.length,E,E.length,x,x.length,16);if(0!==C)throw new Error("bcrypt_pbkdf function returned failure, parameters invalid");x=o.from(x);var A=x.slice(0,h.keySize),I=x.slice(h.keySize,h.keySize+h.blockSize),T=u.createCipheriv(h.opensslName,A,I);T.setAutoPadding(!1);var j,O=[];for(T.once("error",function(e){throw e}),T.write(g),T.end();null!==(j=T.read());)O.push(j);g=o.concat(O);break;default:throw new Error("Unsupported kdf "+l)}var P=new p({}),B;P.writeCString(y),P.writeString(s),P.writeString(l),P.writeBuffer(f),P.writeInt(1),P.writeBuffer(i.toBuffer("rfc4253")),g&&P.writeBuffer(g),P=P.toBuffer(),B=c.isPrivateKey(e)?"OPENSSH PRIVATE KEY":"OPENSSH PUBLIC KEY";var R=P.toString("base64"),N=R.length+R.length/70+18+16+2*B.length+10;P=o.alloc(N);var M=0;M+=P.write("-----BEGIN "+B+"-----\n",M);for(var L=0;LR.length&&(F=R.length),M+=P.write(R.slice(L,F),M),P[M++]=10,L=F}return M+=P.write("-----END "+B+"-----\n",M),P.slice(0,M)}},function(e,t,n){e.exports={DataError:n(1966),InvalidAccessError:n(1967),KeyFormatNotSupportedError:n(1968),CurrentlyNotSupportedError:n(1969),NotSupportedError:n(386),OperationError:n(1970),QuotaExceededError:n(1971),TypeMismatchError:n(1972)}},function(e,t,n){(function(r){const i=n(743),o=n(98),s=n(5)("dweb-transports:httptools"),a=n(171);let u;function l({concurrency:e}){u=a((e,t)=>{e.loopguard===("undefined"!=typeof window&&window.loopguard)?fetch(e.req).then(n=>{s("Fetch of %s succeeded",e.what),u.concurrency=Math.min(u.concurrency+1,u.running()+6),t(null),e.cb(null,n)}).catch(n=>{u.concurrency=Math.max(u.concurrency-1,6,u.running()-1),t(n),--e.count>0?(s("Retrying fetch of %s in %s ms: %s",e.what,e.ms,n.message),u.push(e)):(s("Requeued fetch of %s failed: %s",e.what,n.message),e.cb(n))}):s("Dropping fetch of %s as window changed from %s to %s",e.what,e.loopguard,window.loopguard)},e)}function c(e,t,n,r){return new Promise((i,o)=>{n=n||1,u.push({req:e,count:n,ms:t,what:r,loopguard:"undefined"!=typeof window&&window.loopguard,cb:(e,t)=>{e?o(e):i(t)}})})}async function f(e,t,n,r){let i,o="undefined"!=typeof window&&window.loopguard;for(n=n||1;n--&&o===("undefined"!=typeof window&&window.loopguard);)try{return await fetch(e)}catch(e){i=e,s("Delaying %s by %d ms because %s",r,t,e.message),await new Promise(e=>{setTimeout(()=>{e()},t)}),t=Math.floor(t*(1+Math.random()))}throw console.warn("loopfetch of",r,"failed"),o!==("undefined"!=typeof window&&window.loopguard)?(s("Looping exited because of page change %s",r),new Error("Looping exited because of page change "+r)):i}"undefined"==typeof fetch&&(fetch=i,Headers=fetch.Headers,Request=fetch.Request),httptools={},l({concurrency:6}),httptools.p_httpfetch=async function(e,t,{wantstream:n=!1,retries:i}={}){try{s("p_httpfetch: %s %o",e,t.headers.range||"");let a=new Request(e,t),u=await c(a,500,i,"fetching "+e);if(u.ok){let e=u.headers.get("Content-Type");return n?u.body:void 0!==e&&e.startsWith("application/json")?u.json():void 0!==e&&e.startsWith("text")?u.text():new r(await u.arrayBuffer())}throw new o.TransportError(`Transport Error ${e} ${u.status}: ${u.statusText}`)}catch(t){throw s("p_httpfetch failed: %s",t.message),t instanceof o.TransportError?t:new o.TransportError(`Transport error thrown by ${e}: ${t.message}`)}},httptools.p_GET=function(e,t={},n){"function"==typeof t&&(n=t,t={});let r=new Headers;(t.start||t.end)&&r.append("range",`bytes=${t.start||0}-${t.end<1/0?t.end:""}`);const i=void 0===t.retries?12:t.retries;let o={method:"GET",headers:r,mode:"cors",cache:t.noCache?"no-cache":"default",redirect:"follow",keepalive:!0};const a=httptools.p_httpfetch(e,o,{retries:i,wantstream:t.wantstream});if(!n)return a;a.then(e=>{try{n(null,e)}catch(e){s("Uncaught error %O",e)}}).catch(e=>n(e))},httptools.p_POST=function(e,t={},n){"function"==typeof t&&(n=t,t={});const r=void 0===t.retries?0:t.retries;let i={method:"POST",headers:{},body:t.data,mode:"cors",cache:"default",redirect:"follow",keepalive:!1};t.contenttype&&(i.headers["Content-Type"]=t.contenttype);const o=httptools.p_httpfetch(e,i,{retries:r});if(!n)return o;o.then(e=>n(null,e)).catch(e=>n(e))},t=e.exports=httptools}).call(this,n(0).Buffer)},function(e,t){var n=9007199254740991;function r(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}e.exports=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={},e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var r=n(68),i=p(r),o=n(219),s=p(o),a=n(752),u=p(a),l=n(131),c=p(l),f=n(291),h=p(f);function p(e){return e&&e.__esModule?e:{default:e}}function d(e){return function(t,n,r){if(r=(0,s.default)(r||i.default),e<=0||!t)return r(null);var o=(0,u.default)(t),a=!1,l=0,f=!1;function p(e,t){if(l-=1,e)a=!0,r(e);else{if(t===h.default||a&&l<=0)return a=!0,r(null);f||d()}}function d(){for(f=!0;l{let n;if(r.isBuffer(e))n=a.varintBufferEncode(e);else{if(!o[e])throw new Error("multicodec not recognized");n=o[e]}return r.concat([n,t])}),t.rmPrefix=(e=>(i.decode(e),e.slice(i.decode.bytes))),t.getCodec=(e=>{const t=a.varintBufferDecode(e),n=s[t.toString("hex")];if(void 0===n)throw new Error("Code `0x"+t.toString("hex")+"` not found");return n}),t.getName=(e=>s[e.toString(16)]),t.getNumber=(e=>{const t=o[e];if(void 0===t)throw new Error("Codec `"+e+"` not found");return a.varintBufferDecode(t)[0]}),t.getCode=(e=>i.decode(e)),t.getCodeVarint=(e=>{const t=o[e];if(void 0===t)throw new Error("Codec `"+e+"` not found");return t}),t.getVarint=(e=>i.encode(e));const u=n(789);Object.assign(t,u),t.print=n(790)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=function e(t,n){n=n||{};var r=n.last||!1,i=!1;if("number"==typeof t){r=!0;var o=t;t=function(){return--o}}return function(e){function n(t){e(!0,function(e){r=!1,t(e||!0)})}return function(o,s){i&&!o?r?n(s):s(i):(i=o)?e(i,s):e(null,function(e,o){(i=i||e)?s(i):t(o)?s(null,o):(i=!0,r?s(null,o):n(s))})}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(390),i=a(r),o=n(220),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default,1),e.exports=t.default},function(e,t,n){"use strict";const r=n(26),i=n(226),o=n(61),s=n(227),a=n(139);t.asyncFilter=function(e){let t=!1,n,r;return function(i){return function o(s,a){if(r)return a(r);s?(r=s,i(s,t?()=>{t?n=a:a(s)}:a)):i(null,(i,s)=>{i?a(i):r?a(r):(t=!0,e(s,(e,i)=>{t=!1,r?(a(r),n(r)):e?o(e,a):i?a(null,s):o(null,a)}))})}}},t.asyncSort=function(e){const t=i(),n=r.collect((n,i)=>{if(n)return t.abort(n);e(i,(e,n)=>{if(e)return t.abort(e);t.resolve(r.values(i))})});return function(e){return n(e),t}},t.replaceStartWith=function(e,t){const n=new RegExp("^"+t);return e.replace(n,"")},t.tmpdir=(()=>o.join(s.tmpdir(),a()))},function(e,t){function n(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n-1?setImmediate:i.nextTick,u;w.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(52)},f=n(432),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(433),y;function b(){}function v(e,t){u=u||n(116),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function w(e){if(u=u||n(116),!(y.call(w,this)||this instanceof u))return new w(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function _(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},w.prototype._writev=null,w.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=g.destroy,w.prototype._undestroy=g.undestroy,w.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";t.util=n(440),t.resolver=n(453)},function(e,t,n){"use strict";(function(e){const r=n(62),i=n(232),o=i.SHIFT32,s=i.SHIFT16,a=2097151;function u(e){return e<16?"0"+e.toString(16):e.toString(16)}t.parseHalf=function e(t){var n,r,i;return i=128&t[0]?-1:1,n=(124&t[0])>>2,r=(3&t[0])<<8|t[1],n?31===n?i*(r?NaN:Infinity):i*Math.pow(2,n-25)*(1024+r):5.960464477539063e-8*i*r},t.arrayBufferToBignumber=function(e){const t=e.byteLength;let n="";for(let r=0;r{const t=new Map,n=Object.keys(e),r=n.length;for(let i=0;ie*s+t),t.buildInt64=((e,n,i,s)=>{const a=t.buildInt32(e,n),u=t.buildInt32(i,s);return a>2097151?new r(a).times(o).plus(u):a*o+u}),t.writeHalf=function t(n,r){const i=e.allocUnsafe(4);i.writeFloatBE(r,0);const o=i.readUInt32BE(0);if(0!=(8191&o))return!1;var s=o>>16&32768;const a=o>>23&255,u=8388607&o;if(a>=113&&a<=142)s+=(a-112<<10)+(u>>13);else{if(!(a>=103&&a<113))return!1;if(u&(1<<126-a)-1)return!1;s+=u+8388608>>126-a}return n.writeUInt16BE(s,0),!0},t.keySorter=function(e,t){var n=e[0].byteLength,r=t[0].byteLength;return n>r?1:r>n?-1:e[0].compare(t[0])},t.isNegativeZero=(e=>0===e&&1/e<0),t.nextPowerOf2=(e=>{let t=0;if(e&&!(e&e-1))return e;for(;0!==e;)e>>=1,t+=1;return 1<=0||!o.gcd(t.n).equals(i.ONE));e=e.multiply(o.modPow(t.e,t.n)).mod(t.n);for(var s=e.mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(a)<0;)s=s.add(t.p);var u=s.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return u=u.multiply(o.modInverse(t.n)).mod(t.n),u};function d(e,t,n){var i=r.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=o-11,s}i.putByte(0),i.putByte(n);var a=o-3-e.length,u;if(0===n||1===n){u=0===n?0:255;for(var l=0;l0;){for(var c=0,f=r.random.getBytes(a),l=0;l1;){if(255!==s.getByte()){--s.read;break}++l}else if(2===u)for(l=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++l}var f=s.getByte();if(0!==f||l!==o-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function g(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};var o={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function a(){u(e.pBits,function(t,r){return t?n(t):(e.p=r,null!==e.q?l(t,e.q):void u(e.qBits,l))})}function u(e,t){r.prime.generateProbablePrime(e,o,t)}function l(t,r){if(t)return n(t);if(e.q=r,e.p.compareTo(e.q)<0){var o=e.p;e.p=e.q,e.q=o}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void a();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void u(e.qBits,l);if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE))return e.p=e.q=null,void a();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void u(e.qBits,l);var c=e.e.modInverse(e.phi);e.keys={privateKey:s.rsa.setPrivateKey(e.n,e.e,c,e.p,e.q,c.mod(e.p1),c.mod(e.q1),e.q.modInverse(e.p)),publicKey:s.rsa.setPublicKey(e.n,e.e)},n(null,e.keys)}"prng"in t&&(o.prng=t.prng),a()}function y(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var n=r.util.hexToBytes(t);return n.length>1&&(0===n.charCodeAt(0)&&0==(128&n.charCodeAt(1))||255===n.charCodeAt(0)&&128==(128&n.charCodeAt(1)))?n.substr(1):n}function b(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function v(e){return"undefined"!=typeof window&&"object"==typeof window.crypto&&"object"==typeof window.crypto.subtle&&"function"==typeof window.crypto.subtle[e]}function w(e){return"undefined"!=typeof window&&"object"==typeof window.msCrypto&&"object"==typeof window.msCrypto.subtle&&"function"==typeof window.msCrypto.subtle[e]}function _(e){for(var t=r.util.hexToBytes(e.toString(16)),n=new Uint8Array(t.length),i=0;i0;)f.putByte(0),--h;return f.putBytes(r.util.hexToBytes(c)),f.getBytes()},s.rsa.decrypt=function(e,t,n,o){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=s,a}var u=new i(r.util.createBuffer(e).toHex(),16);if(u.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var l=p(u,t,n),c=l.toString(16),f=r.util.createBuffer(),h=s-Math.ceil(c.length/2);h>0;)f.putByte(0),--h;return f.putBytes(r.util.hexToBytes(c)),!1!==o?m(f.getBytes(),t,n):f.getBytes()},s.rsa.createKeyPairGenerationState=function(e,t,n){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048,n=n||{};var o=n.prng||r.random,s={nextBytes:function(e){for(var t=o.getBytesSync(e.length),n=0;n>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},u.e.fromInt(u.eInt),u},s.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var n=new i(null);n.fromInt(30);for(var r=0,o=function(e,t){return e|t},u=+new Date,l,c=0;null===e.keys&&(t<=0||cf?e.pqState=0:e.num.isProbablePrime(b(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(a[r++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var p=e.e.modInverse(e.phi);e.keys={privateKey:s.rsa.setPrivateKey(e.n,e.e,p,e.p,e.q,p.mod(e.p1),p.mod(e.q1),e.q.modInverse(e.p)),publicKey:s.rsa.setPublicKey(e.n,e.e)}}l=+new Date,c+=l-u,u=l}return null!==e.keys},s.rsa.generateKeyPair=function(e,t,n,i){if(1===arguments.length?"object"==typeof e?(n=e,e=void 0):"function"==typeof e&&(i=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(i=t,t=void 0):"number"!=typeof t&&(n=t,t=void 0):(n=e,i=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof n&&(i=n,n=void 0):(i=n,n=t,t=void 0)),n=n||{},void 0===e&&(e=n.bits||2048),void 0===t&&(t=n.e||65537),!r.options.usePureJavaScript&&i&&e>=256&&e<=16384&&(65537===t||3===t)){if(v("generateKey")&&v("exportKey"))return window.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:_(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return window.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){i(e)}).then(function(e){if(e){var t=s.privateKeyFromAsn1(o.fromDer(r.util.createBuffer(e)));i(null,{privateKey:t,publicKey:s.setRsaPublicKey(t.n,t.e)})}});if(w("generateKey")&&w("exportKey")){var a=window.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:_(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return a.oncomplete=function(e){var t=e.target.result,n=window.msCrypto.subtle.exportKey("pkcs8",t.privateKey);n.oncomplete=function(e){var t=e.target.result,n=s.privateKeyFromAsn1(o.fromDer(r.util.createBuffer(t)));i(null,{privateKey:n,publicKey:s.setRsaPublicKey(n.n,n.e)})},n.onerror=function(e){i(e)}},void(a.onerror=function(e){i(e)})}}var u=s.rsa.createKeyPairGenerationState(e,t,n);if(!i)return s.rsa.stepKeyPairGenerationState(u,0),u.keys;g(u,n,i)},s.setRsaPublicKey=s.rsa.setPublicKey=function(e,t){var n={n:e,e:t,encrypt:function(e,t,i){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,n){return d(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return r.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var o=t.encode(e,n,!0);return s.rsa.encrypt(o,n,!0)},verify:function(e,t,r){"string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===r?r={verify:function(e,t){t=m(t,n,!0);var r=o.fromDer(t);return e===r.value[1].value}}:"NONE"!==r&&"NULL"!==r&&null!==r||(r={verify:function(e,t){return t=m(t,n,!0),e===t}});var i=s.rsa.decrypt(t,n,!0,!1);return r.verify(e,i,n.n.bitLength())}};return n},s.setRsaPrivateKey=s.rsa.setPrivateKey=function(e,t,n,i,o,a,u,l){var c={n:e,e:t,d:n,p:i,q:o,dP:a,dQ:u,qInv:l,decrypt:function(e,t,n){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=s.rsa.decrypt(e,c,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:m};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return r.pkcs1.decode_rsa_oaep(t,e,n)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,c,!1)},sign:function(e,t){var n=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:h},n=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},n=1);var r=t.encode(e,c.n.bitLength());return s.rsa.encrypt(r,c,n)}};return c},s.wrapRsaPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(e).getBytes())])},s.privateKeyFromAsn1=function(e){var t={},n=[],a,c,f,h,p,d,m,g;if(o.validate(e,u,t,n)&&(e=o.fromDer(r.util.createBuffer(t.privateKey))),t={},n=[],!o.validate(e,l,t,n)){var y=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw y.errors=n,y}return a=r.util.createBuffer(t.privateKeyModulus).toHex(),c=r.util.createBuffer(t.privateKeyPublicExponent).toHex(),f=r.util.createBuffer(t.privateKeyPrivateExponent).toHex(),h=r.util.createBuffer(t.privateKeyPrime1).toHex(),p=r.util.createBuffer(t.privateKeyPrime2).toHex(),d=r.util.createBuffer(t.privateKeyExponent1).toHex(),m=r.util.createBuffer(t.privateKeyExponent2).toHex(),g=r.util.createBuffer(t.privateKeyCoefficient).toHex(),s.setRsaPrivateKey(new i(a,16),new i(c,16),new i(f,16),new i(h,16),new i(p,16),new i(d,16),new i(m,16),new i(g,16))},s.privateKeyToAsn1=s.privateKeyToRSAPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.qInv))])},s.publicKeyFromAsn1=function(e){var t={},n=[];if(o.validate(e,f,t,n)){var a=o.derToOid(t.publicKeyOid);if(a!==s.oids.rsaEncryption){var u=new Error("Cannot read public key. Unknown OID.");throw u.oid=a,u}e=t.rsaPublicKey}if(n=[],!o.validate(e,c,t,n)){var u=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw u.errors=n,u}var l=r.util.createBuffer(t.publicKeyModulus).toHex(),h=r.util.createBuffer(t.publicKeyExponent).toHex();return s.setRsaPublicKey(new i(l,16),new i(h,16))},s.publicKeyToAsn1=s.publicKeyToSubjectPublicKeyInfo=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,[s.publicKeyToRSAPublicKey(e)])])},s.publicKeyToRSAPublicKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.e))])}},function(e,t,n){var r=n(19);if(n(237),n(140),n(311),n(118),n(179),n(461),n(312),n(141),n(898),n(309),n(34),void 0===i)var i=r.jsbn.BigInteger;var o=r.asn1,s=r.pki=r.pki||{};e.exports=s.pbe=r.pbe=r.pbe||{};var a=s.oids,u={name:"EncryptedPrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},l={name:"PBES2Algorithms",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},c={name:"pkcs-12PbeParams",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"iterations"}]};function f(e,t){return e.start().update(t).digest().getBytes()}function h(e){var t;if(e){if(t=s.oids[o.derToOid(e)],!t){var n=new Error("Unsupported PRF OID.");throw n.oid=e,n.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],n}}else t="hmacWithSHA1";return p(t)}function p(e){var t=r.md;switch(e){case"hmacWithSHA224":t=r.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var n=new Error("Unsupported PRF algorithm.");throw n.algorithm=e,n.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],n}if(!(t&&e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function d(e,t,n,i){var a=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==i&&a.value.push(o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,r.util.hexToBytes(n.toString(16))),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids[i]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")])),a}s.encryptPrivateKeyInfo=function(e,t,n){n=n||{},n.saltSize=n.saltSize||8,n.count=n.count||2048,n.algorithm=n.algorithm||"aes128",n.prfAlgorithm=n.prfAlgorithm||"sha1";var i=r.random.getBytesSync(n.saltSize),u=n.count,l=o.integerToDer(u),c,f,h;if(0===n.algorithm.indexOf("aes")||"des"===n.algorithm){var m,g,y;switch(n.algorithm){case"aes128":c=16,m=16,g=a["aes128-CBC"],y=r.aes.createEncryptionCipher;break;case"aes192":c=24,m=16,g=a["aes192-CBC"],y=r.aes.createEncryptionCipher;break;case"aes256":c=32,m=16,g=a["aes256-CBC"],y=r.aes.createEncryptionCipher;break;case"des":c=8,m=8,g=a.desCBC,y=r.des.createEncryptionCipher;break;default:var b=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw b.algorithm=n.algorithm,b}var v="hmacWith"+n.prfAlgorithm.toUpperCase(),w=p(v),_=r.pkcs5.pbkdf2(t,i,u,c,w),k=r.random.getBytesSync(m),S=y(_);S.start(k),S.update(o.toDer(e)),S.finish(),h=S.output.getBytes();var E=d(i,l,c,v);f=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBES2).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBKDF2).getBytes()),E]),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(g).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,k)])])])}else{if("3des"!==n.algorithm){var b=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw b.algorithm=n.algorithm,b}c=24;var x=new r.util.ByteBuffer(i),_=s.pbe.generatePkcs12Key(t,x,1,u,c),k=s.pbe.generatePkcs12Key(t,x,2,u,c),S=r.des.createEncryptionCipher(_);S.start(k),S.update(o.toDer(e)),S.finish(),h=S.output.getBytes(),f=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,i),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,l.getBytes())])])}var C=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[f,o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,h)]);return C},s.decryptPrivateKeyInfo=function(e,t){var n=null,i={},a=[];if(!o.validate(e,u,i,a)){var l=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw l.errors=a,l}var c=o.derToOid(i.encryptionOid),f=s.pbe.getCipher(c,i.encryptionParams,t),h=r.util.createBuffer(i.encryptedData);return f.update(h),f.finish()&&(n=o.fromDer(f.output)),n},s.encryptedPrivateKeyToPem=function(e,t){var n={type:"ENCRYPTED PRIVATE KEY",body:o.toDer(e).getBytes()};return r.pem.encode(n,{maxline:t})},s.encryptedPrivateKeyFromPem=function(e){var t=r.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var n=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw n.headerType=t.type,n}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return o.fromDer(t.body)},s.encryptRsaPrivateKey=function(e,t,n){if(n=n||{},!n.legacy){var i=s.wrapRsaPrivateKey(s.privateKeyToAsn1(e));return i=s.encryptPrivateKeyInfo(i,t,n),s.encryptedPrivateKeyToPem(i)}var a,u,l,c;switch(n.algorithm){case"aes128":a="AES-128-CBC",l=16,u=r.random.getBytesSync(16),c=r.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",l=24,u=r.random.getBytesSync(16),c=r.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",l=32,u=r.random.getBytesSync(16),c=r.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",l=24,u=r.random.getBytesSync(8),c=r.des.createEncryptionCipher;break;case"des":a="DES-CBC",l=8,u=r.random.getBytesSync(8),c=r.des.createEncryptionCipher;break;default:var f=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+n.algorithm+'".');throw f.algorithm=n.algorithm,f}var h=r.pbe.opensslDeriveBytes(t,u.substr(0,8),l),p=c(h);p.start(u),p.update(o.toDer(s.privateKeyToAsn1(e))),p.finish();var d={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:r.util.bytesToHex(u).toUpperCase()},body:p.output.getBytes()};return r.pem.encode(d)},s.decryptRsaPrivateKey=function(e,t){var n=null,i=r.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type){var a=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw a.headerType=a,a}if(i.procType&&"ENCRYPTED"===i.procType.type){var u,l;switch(i.dekInfo.algorithm){case"DES-CBC":u=8,l=r.des.createDecryptionCipher;break;case"DES-EDE3-CBC":u=24,l=r.des.createDecryptionCipher;break;case"AES-128-CBC":u=16,l=r.aes.createDecryptionCipher;break;case"AES-192-CBC":u=24,l=r.aes.createDecryptionCipher;break;case"AES-256-CBC":u=32,l=r.aes.createDecryptionCipher;break;case"RC2-40-CBC":u=5,l=function(e){return r.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":u=8,l=function(e){return r.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":u=16,l=function(e){return r.rc2.createDecryptionCipher(e,128)};break;default:var a=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".');throw a.algorithm=i.dekInfo.algorithm,a}var c=r.util.hexToBytes(i.dekInfo.parameters),f=r.pbe.opensslDeriveBytes(t,c.substr(0,8),u),h=l(f);if(h.start(c),h.update(r.util.createBuffer(i.body)),!h.finish())return n;n=h.output.getBytes()}else n=i.body;return n="ENCRYPTED PRIVATE KEY"===i.type?s.decryptPrivateKeyInfo(o.fromDer(n),t):o.fromDer(n),null!==n&&(n=s.privateKeyFromAsn1(n)),n},s.pbe.generatePkcs12Key=function(e,t,n,i,o,s){var a,u;if(void 0===s||null===s){if(!("sha1"in r.md))throw new Error('"sha1" hash algorithm unavailable.');s=r.md.sha1.create()}var l=s.digestLength,c=s.blockLength,f=new r.util.ByteBuffer,h=new r.util.ByteBuffer;if(null!==e&&void 0!==e){for(u=0;u=0;u--)T>>=8,T+=x.at(u)+I.at(u),I.setAt(u,255&T);A.putBuffer(I)}w=A,f.putBuffer(S)}return f.truncate(f.length()-o),f},s.pbe.getCipher=function(e,t,n){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,n);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,n);default:var r=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw r.oid=e,r.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],r}},s.pbe.getCipherForPBES2=function(e,t,n){var i={},a=[];if(!o.validate(t,l,i,a)){var u=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=a,u}if(e=o.derToOid(i.kdfOid),e!==s.oids.pkcs5PBKDF2){var u=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw u.oid=e,u.supportedOids=["pkcs5PBKDF2"],u}if(e=o.derToOid(i.encOid),e!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC){var u=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw u.oid=e,u.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],u}var c=i.kdfSalt,f=r.util.createBuffer(i.kdfIterationCount),p,d;switch(f=f.getInt(f.length()<<3),s.oids[e]){case"aes128-CBC":p=16,d=r.aes.createDecryptionCipher;break;case"aes192-CBC":p=24,d=r.aes.createDecryptionCipher;break;case"aes256-CBC":p=32,d=r.aes.createDecryptionCipher;break;case"des-EDE3-CBC":p=24,d=r.des.createDecryptionCipher;break;case"desCBC":p=8,d=r.des.createDecryptionCipher}var m=h(i.prfOid),g=r.pkcs5.pbkdf2(n,c,f,p,m),y=i.encIv,b=d(g);return b.start(y),b},s.pbe.getCipherForPKCS12PBE=function(e,t,n){var i={},a=[];if(!o.validate(t,c,i,a)){var u=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=a,u}var l=r.util.createBuffer(i.salt),f=r.util.createBuffer(i.iterations),p,d,m;switch(f=f.getInt(f.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:p=24,d=8,m=r.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:p=5,d=8,m=function(e,t){var n=r.rc2.createDecryptionCipher(e,40);return n.start(t,null),n};break;default:var u=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw u.oid=e,u}var g=h(i.prfOid),y=s.pbe.generatePkcs12Key(n,l,1,f,p,g);g.start();var b=s.pbe.generatePkcs12Key(n,l,2,f,d,g);return m(y,b)},s.pbe.opensslDeriveBytes=function(e,t,n,i){if(void 0===i||null===i){if(!("md5"in r.md))throw new Error('"md5" hash algorithm unavailable.');i=r.md.md5.create()}null===t&&(t="");for(var o=[f(i,e+t)],s=16,a=1;s8?3:1,g=[],y=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,v,w=0;w>>4^k),k^=v,_^=v<<4,v=65535&(k>>>-16^_),_^=v,k^=v<<-16,v=858993459&(_>>>2^k),k^=v,_^=v<<2,v=65535&(k>>>-16^_),_^=v,k^=v<<-16,v=1431655765&(_>>>1^k),k^=v,_^=v<<1,v=16711935&(k>>>8^_),_^=v,k^=v<<8,v=1431655765&(_>>>1^k),k^=v,_^=v<<1,v=_<<8|k>>>20&240,_=k<<24|k<<8&16711680|k>>>8&65280|k>>>24&240,k=v;for(var S=0;S>>26,k=k<<2|k>>>26):(_=_<<1|_>>>27,k=k<<1|k>>>27),_&=-15,k&=-15;var E=t[_>>>28]|n[_>>>24&15]|r[_>>>20&15]|i[_>>>16&15]|o[_>>>12&15]|s[_>>>8&15]|a[_>>>4&15],x=u[k>>>28]|l[k>>>24&15]|c[k>>>20&15]|f[k>>>16&15]|h[k>>>12&15]|p[k>>>8&15]|d[k>>>4&15];v=65535&(x>>>16^E),g[b++]=E^v,g[b++]=x^v<<16}}return g}function d(e,t,n,r){var i=32===e.length?3:9,p,d;p=3===i?r?[30,-2,-2]:[0,32,2]:r?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var m=t[0],g=t[1];d=252645135&(m>>>4^g),g^=d,m^=d<<4,d=65535&(m>>>16^g),g^=d,m^=d<<16,d=858993459&(g>>>2^m),m^=d,g^=d<<2,d=16711935&(g>>>8^m),m^=d,g^=d<<8,d=1431655765&(m>>>1^g),g^=d,m^=d<<1,m=m<<1|m>>>31,g=g<<1|g>>>31;for(var y=0;y>>4|g<<28)^e[w+1];d=m,m=g,g=d^(s[_>>>24&63]|u[_>>>16&63]|c[_>>>8&63]|h[63&_]|o[k>>>24&63]|a[k>>>16&63]|l[k>>>8&63]|f[63&k])}d=m,m=g,g=d}m=m>>>1|m<<31,g=g>>>1|g<<31,d=1431655765&(m>>>1^g),g^=d,m^=d<<1,d=16711935&(g>>>8^m),m^=d,g^=d<<8,d=858993459&(g>>>2^m),m^=d,g^=d<<2,d=65535&(m>>>16^g),g^=d,m^=d<<16,d=252645135&(m>>>4^g),g^=d,m^=d<<4,n[0]=m,n[1]=g}function m(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),n="DES-"+t,i;i=e.decrypt?r.cipher.createDecipher(n,e.key):r.cipher.createCipher(n,e.key);var o=i.start;return i.start=function(e,t){var n=null;t instanceof r.util.ByteBuffer&&(n=t,t={}),t=t||{},t.output=n,t.iv=e,o.call(i,t)},i}},function(e,t,n){var r=n(19);n(34);var i=e.exports=r.pem=r.pem||{};function o(e){for(var t=e.name+": ",n=[],r=function(e,t){return" "+t},i=0;i65&&-1!==s){var a=t[s];","===a?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+a+t.substr(s+1),o=i-s-1,s=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(s=i);return t}function s(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var n="-----BEGIN "+e.type+"-----\r\n",i;if(e.procType&&(i={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},n+=o(i)),e.contentDomain&&(i={name:"Content-Domain",values:[e.contentDomain]},n+=o(i)),e.dekInfo&&(i={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&i.values.push(e.dekInfo.parameters),n+=o(i)),e.headers)for(var s=0;s{n(null,e)},e=>{n(e)})}},function(e,t,n){"use strict";e.exports=self.crypto||self.msCrypto},function(e,t,n){"use strict";const r=n(901);e.exports=function(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return r(e)}},function(e,t,n){var r=n(4).Buffer;function i(e){if(e.length<8)return!1;if(e.length>72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;var t=e[3];if(0===t)return!1;if(5+t>=e.length)return!1;if(2!==e[4+t])return!1;var n=e[5+t];return 0!==n&&(6+t+n===e.length&&(!(128&e[4])&&(!(t>1&&0===e[4]&&!(128&e[5]))&&(!(128&e[t+6])&&!(n>1&&0===e[t+6]&&!(128&e[t+7]))))))}function o(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(48!==e[0])throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(2!==e[2])throw new Error("Expected DER integer");var t=e[3];if(0===t)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");var n=e[5+t];if(0===n)throw new Error("S length is zero");if(6+t+n!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw new Error("R value excessively padded");if(128&e[t+6])throw new Error("S value is negative");if(n>1&&0===e[t+6]&&!(128&e[t+7]))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}}function s(e,t){var n=e.length,i=t.length;if(0===n)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(n>33)throw new Error("R length is too long");if(i>33)throw new Error("S length is too long");if(128&e[0])throw new Error("R value is negative");if(128&t[0])throw new Error("S value is negative");if(n>1&&0===e[0]&&!(128&e[1]))throw new Error("R value excessively padded");if(i>1&&0===t[0]&&!(128&t[1]))throw new Error("S value excessively padded");var o=r.allocUnsafe(6+n+i);return o[0]=48,o[1]=o.length-2,o[2]=2,o[3]=e.length,e.copy(o,4),o[4+n]=2,o[5+n]=t.length,t.copy(o,6+n),o}e.exports={check:i,decode:o,encode:s}},function(e){e.exports={COMPRESSED_TYPE_INVALID:"compressed should be a boolean",EC_PRIVATE_KEY_TYPE_INVALID:"private key should be a Buffer",EC_PRIVATE_KEY_LENGTH_INVALID:"private key length is invalid",EC_PRIVATE_KEY_RANGE_INVALID:"private key range is invalid",EC_PRIVATE_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting private key is invalid",EC_PRIVATE_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PRIVATE_KEY_EXPORT_DER_FAIL:"couldn't export to DER format",EC_PRIVATE_KEY_IMPORT_DER_FAIL:"couldn't import from DER format",EC_PUBLIC_KEYS_TYPE_INVALID:"public keys should be an Array",EC_PUBLIC_KEYS_LENGTH_INVALID:"public keys Array should have at least 1 element",EC_PUBLIC_KEY_TYPE_INVALID:"public key should be a Buffer",EC_PUBLIC_KEY_LENGTH_INVALID:"public key length is invalid",EC_PUBLIC_KEY_PARSE_FAIL:"the public key could not be parsed or is invalid",EC_PUBLIC_KEY_CREATE_FAIL:"private was invalid, try again",EC_PUBLIC_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting public key is invalid",EC_PUBLIC_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PUBLIC_KEY_COMBINE_FAIL:"the sum of the public keys is not valid",ECDH_FAIL:"scalar was invalid (zero or overflow)",ECDSA_SIGNATURE_TYPE_INVALID:"signature should be a Buffer",ECDSA_SIGNATURE_LENGTH_INVALID:"signature length is invalid",ECDSA_SIGNATURE_PARSE_FAIL:"couldn't parse signature",ECDSA_SIGNATURE_PARSE_DER_FAIL:"couldn't parse DER signature",ECDSA_SIGNATURE_SERIALIZE_DER_FAIL:"couldn't serialize signature to DER format",ECDSA_SIGN_FAIL:"nonce generation function failed or private key is invalid",ECDSA_RECOVER_FAIL:"couldn't recover public key from signature",MSG32_TYPE_INVALID:"message should be a Buffer",MSG32_LENGTH_INVALID:"message length is invalid",OPTIONS_TYPE_INVALID:"options should be an Object",OPTIONS_DATA_TYPE_INVALID:"options.data should be a Buffer",OPTIONS_DATA_LENGTH_INVALID:"options.data length is invalid",OPTIONS_NONCEFN_TYPE_INVALID:"options.noncefn should be a Function",RECOVERY_ID_TYPE_INVALID:"recovery should be a Number",RECOVERY_ID_VALUE_INVALID:"recovery should have value between -1 and 4",TWEAK_TYPE_INVALID:"tweak should be a Buffer",TWEAK_LENGTH_INVALID:"tweak length is invalid"}},function(e,t,n){"use strict";var r=n(1),i=n(468),o=n(4).Buffer,s=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(e,t){return e<>>32-t}function l(e,t,n,r,i,o,s){return u(e+(t&n|~t&r)+i+o|0,s)+t|0}function c(e,t,n,r,i,o,s){return u(e+(t&r|n&~r)+i+o|0,s)+t|0}function f(e,t,n,r,i,o,s){return u(e+(t^n^r)+i+o|0,s)+t|0}function h(e,t,n,r,i,o,s){return u(e+(n^(t|~r))+i+o|0,s)+t|0}r(a,i),a.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var n=this._a,r=this._b,i=this._c,o=this._d;n=l(n,r,i,o,e[0],3614090360,7),o=l(o,n,r,i,e[1],3905402710,12),i=l(i,o,n,r,e[2],606105819,17),r=l(r,i,o,n,e[3],3250441966,22),n=l(n,r,i,o,e[4],4118548399,7),o=l(o,n,r,i,e[5],1200080426,12),i=l(i,o,n,r,e[6],2821735955,17),r=l(r,i,o,n,e[7],4249261313,22),n=l(n,r,i,o,e[8],1770035416,7),o=l(o,n,r,i,e[9],2336552879,12),i=l(i,o,n,r,e[10],4294925233,17),r=l(r,i,o,n,e[11],2304563134,22),n=l(n,r,i,o,e[12],1804603682,7),o=l(o,n,r,i,e[13],4254626195,12),i=l(i,o,n,r,e[14],2792965006,17),r=l(r,i,o,n,e[15],1236535329,22),n=c(n,r,i,o,e[1],4129170786,5),o=c(o,n,r,i,e[6],3225465664,9),i=c(i,o,n,r,e[11],643717713,14),r=c(r,i,o,n,e[0],3921069994,20),n=c(n,r,i,o,e[5],3593408605,5),o=c(o,n,r,i,e[10],38016083,9),i=c(i,o,n,r,e[15],3634488961,14),r=c(r,i,o,n,e[4],3889429448,20),n=c(n,r,i,o,e[9],568446438,5),o=c(o,n,r,i,e[14],3275163606,9),i=c(i,o,n,r,e[3],4107603335,14),r=c(r,i,o,n,e[8],1163531501,20),n=c(n,r,i,o,e[13],2850285829,5),o=c(o,n,r,i,e[2],4243563512,9),i=c(i,o,n,r,e[7],1735328473,14),r=c(r,i,o,n,e[12],2368359562,20),n=f(n,r,i,o,e[5],4294588738,4),o=f(o,n,r,i,e[8],2272392833,11),i=f(i,o,n,r,e[11],1839030562,16),r=f(r,i,o,n,e[14],4259657740,23),n=f(n,r,i,o,e[1],2763975236,4),o=f(o,n,r,i,e[4],1272893353,11),i=f(i,o,n,r,e[7],4139469664,16),r=f(r,i,o,n,e[10],3200236656,23),n=f(n,r,i,o,e[13],681279174,4),o=f(o,n,r,i,e[0],3936430074,11),i=f(i,o,n,r,e[3],3572445317,16),r=f(r,i,o,n,e[6],76029189,23),n=f(n,r,i,o,e[9],3654602809,4),o=f(o,n,r,i,e[12],3873151461,11),i=f(i,o,n,r,e[15],530742520,16),r=f(r,i,o,n,e[2],3299628645,23),n=h(n,r,i,o,e[0],4096336452,6),o=h(o,n,r,i,e[7],1126891415,10),i=h(i,o,n,r,e[14],2878612391,15),r=h(r,i,o,n,e[5],4237533241,21),n=h(n,r,i,o,e[12],1700485571,6),o=h(o,n,r,i,e[3],2399980690,10),i=h(i,o,n,r,e[10],4293915773,15),r=h(r,i,o,n,e[1],2240044497,21),n=h(n,r,i,o,e[8],1873313359,6),o=h(o,n,r,i,e[15],4264355552,10),i=h(i,o,n,r,e[6],2734768916,15),r=h(r,i,o,n,e[13],1309151649,21),n=h(n,r,i,o,e[4],4149444226,6),o=h(o,n,r,i,e[11],3174756917,10),i=h(i,o,n,r,e[2],718787259,15),r=h(r,i,o,n,e[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+o|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=o.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=a},function(e,t,n){"use strict";var r=n(1),i=n(928),o=n(119),s=n(4).Buffer,a=n(929),u=n(469),l=n(470),c=s.alloc(128);function f(e,t){o.call(this,"digest"),"string"==typeof t&&(t=s.from(t));var n="sha512"===e||"sha384"===e?128:64;if(this._alg=e,this._key=t,t.length>n){var r="rmd160"===e?new u:l(e);t=r.update(t).digest()}else t.length{const t=o.apply(null,e);r.codes[t.code]=t,r.names[t.name]=t}),r.object=o,e.exports=r},function(e,t,n){"use strict";const r=1e3;e.exports={maxProvidersPerRequest:3,providerRequestTimeout:1e4,hasBlockTimeout:15e3,provideTimeout:15e3,kMaxPriority:Math.pow(2,31)-1,rebroadcastDelay:1e4,maxListeners:1e3}},function(e,t,n){var r=n(67),i=n(323),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!i(e))||(s.test(e)||!o.test(e)||null!=t&&e in Object(t))}e.exports=a},function(e,t,n){var r=n(132),i=n(105),o="[object Symbol]";function s(e){return"symbol"==typeof e||i(e)&&r(e)==o}e.exports=s},function(e,t,n){var r=n(1001),i=n(1017),o=n(1019),s=n(1020),a=n(1021);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{let r,i;if(e<0)r=n,i=t;else{if(!(e>0))return t[0];r=t,i=n}for(let e of r)for(let t of i)if(e===t)return e;throw new Error("No algorithms in common!")}),t.makeMacAndCipher=((e,t)=>{l([t=>c(e.hashT,e.keys.macKey,t),t=>f(e.cipherT,e.keys.iv,e.keys.cipherKey,t)],(n,r)=>{if(n)return t(n);e.mac=r[0],e.cipher=r[1],t()})}),t.selectBest=((n,r,i)=>{t.digest(e.concat([r.pubKeyBytes,n.nonce]),(o,s)=>{if(o)return i(o);t.digest(e.concat([n.pubKeyBytes,r.nonce]),(o,a)=>{if(o)return i(o);const u=e.compare(s,a);if(0===u)return i(new Error("you are trying to talk to yourself"));i(null,{curveT:t.theBest(u,n.exchanges,r.exchanges),cipherT:t.theBest(u,n.ciphers,r.ciphers),hashT:t.theBest(u,n.hashes,r.hashes),order:u})})})}),t.digest=((e,t)=>{r.digest(e,"sha2-256",e.length,t)}),t.write=function e(t,n,r){r=r||(()=>{}),o(s([n]),i.encode({fixed:!0,bytes:4}),a((e,n)=>{if(e)return r(e);t.shake.write(n[0]),r()}))},t.read=function e(t,n){i.decodeFromReader(t,{fixed:!0,bytes:4},n)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(e){const r=n(71),i=n(23),o=n(64),s=n(54),a=n(11),u=n(5),l=u("libp2p:secio");l.error=u("libp2p:secio:error");const c=r(n(1113)),f=n(330),h=16;t.createProposal=(e=>(e.proposal.out={rand:o.randomBytes(16),pubkey:e.key.local.public.bytes,exchanges:f.exchanges.join(","),ciphers:f.ciphers.join(","),hashes:f.hashes.join(",")},e.proposalEncoded.out=c.Propose.encode(e.proposal.out),e.proposalEncoded.out)),t.createExchange=((t,n)=>{o.keys.generateEphemeralKeyPair(t.protocols.local.curveT,(r,i)=>{if(r)return n(r);t.ephemeralKey.local=i.key,t.shared.generate=i.genSharedKey;const o=e.concat([t.proposalEncoded.out,t.proposalEncoded.in,t.ephemeralKey.local]);t.key.local.sign(o,(e,r)=>{if(e)return n(e);t.exchange.out={epubkey:t.ephemeralKey.local,signature:r},n(null,c.Exchange.encode(t.exchange.out))})})}),t.identify=((e,t,n)=>{l("1.1 identify"),e.proposalEncoded.in=t,e.proposal.in=c.Propose.decode(t);const r=e.proposal.in.pubkey;e.key.remote=o.keys.unmarshalPublicKey(r),i.createFromPubKey(r.toString("base64"),(t,r)=>{if(t)return n(t);if(e.id.remote){if(e.id.remote.toB58String()!==r.toB58String())return n(new Error("dialed to the wrong peer, Ids do not match"))}else e.id.remote=r;l("1.1 identify - %s - identified remote peer as %s",e.id.local.toB58String(),e.id.remote.toB58String()),n()})}),t.selectProtocols=((e,t)=>{l("1.2 selection");const n={pubKeyBytes:e.key.local.public.bytes,exchanges:f.exchanges,hashes:f.hashes,ciphers:f.ciphers,nonce:e.proposal.out.rand},r={pubKeyBytes:e.proposal.in.pubkey,exchanges:e.proposal.in.exchanges.split(","),hashes:e.proposal.in.hashes.split(","),ciphers:e.proposal.in.ciphers.split(","),nonce:e.proposal.in.rand};f.selectBest(n,r,(n,r)=>{if(n)return t(n);e.protocols.remote={order:r.order,curveT:r.curveT,cipherT:r.cipherT,hashT:r.hashT},e.protocols.local={order:r.order,curveT:r.curveT,cipherT:r.cipherT,hashT:r.hashT},t()})}),t.verify=((t,n,r)=>{l("2.1. verify"),t.exchange.in=c.Exchange.decode(n),t.ephemeralKey.remote=t.exchange.in.epubkey;const i=e.concat([t.proposalEncoded.in,t.proposalEncoded.out,t.ephemeralKey.remote]);t.key.remote.verify(i,t.exchange.in.signature,(e,t)=>e?r(e):t?(l("2.1. verify - signature verified"),void r()):r(new Error("Bad signature")))}),t.generateKeys=((e,t)=>{l("2.2. keys"),a([t=>e.shared.generate(e.exchange.in.epubkey,t),(t,n)=>{e.shared.secret=t,o.keys.keyStretcher(e.protocols.local.cipherT,e.protocols.local.hashT,e.shared.secret,n)},(t,n)=>{if(e.protocols.local.order>0)e.protocols.local.keys=t.k1,e.protocols.remote.keys=t.k2;else{if(!(e.protocols.local.order<0))return n(new Error("you are trying to talk to yourself"));e.protocols.local.keys=t.k2,e.protocols.remote.keys=t.k1}l("2.3. mac + cipher"),s([t=>f.makeMacAndCipher(e.protocols.local,t),t=>f.makeMacAndCipher(e.protocols.remote,t)],n)}],t)}),t.verifyNonce=((e,t)=>{const n=e.proposal.out.rand;if(!n.equals(t))throw new Error(`Failed to read our encrypted nonce: ${n.toString("hex")} != ${t.toString("hex")}`)})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var r=n(68),i=f(r),o=n(145),s=f(o),a=n(42),u=f(a),l=n(104),c=f(l);function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t){var n=null,r;t=t||i.default,(0,s.default)(e,function(e,t){(0,u.default)(e)(function(e,i){r=arguments.length>2?(0,c.default)(arguments,1):i,n=e,t(!e)})},function(){t(n,r)})}e.exports=t.default},function(e,t,n){"use strict";const r=n(71),i="\nmessage Identify {\n // protocolVersion determines compatibility between peers\n optional string protocolVersion = 5; // e.g. ipfs/1.0.0\n\n // agentVersion is like a UserAgent string in browsers, or client version in bittorrent\n // includes the client name and client.\n optional string agentVersion = 6; // e.g. go-ipfs/0.1.0\n\n // publicKey is this node's public key (which also gives its node.ID)\n // - may not need to be sent, as secure channel implies it has been sent.\n // - then again, if we change / disable secure channel, may still want it.\n optional bytes publicKey = 1;\n\n // listenAddrs are the multiaddrs the sender node listens for open connections on\n repeated bytes listenAddrs = 2;\n\n // oservedAddr is the multiaddr of the remote endpoint that the sender node perceives\n // this is useful information to convey to the other side, as it helps the remote endpoint\n // determine whether its connection to the local peer goes through NAT.\n optional bytes observedAddr = 4;\n\n repeated string protocols = 3;\n}\n";e.exports=r(i).Identify},function(e,t,n){"use strict";const r=n(43),i=n(37),o=n(106),s=n(12),a=n(72),u=n(122),l=n(5),c=l("libp2p:circuit:stream-handler");c.err=l("libp2p:circuit:error:stream-handler");class f{constructor(e,t,n,r){this.conn=e,this.stream=null,this.shake=null,this.timeout=t||6e4,this.maxLength=r||4096,"function"==typeof t&&(this.timeout=n||6e4),this.stream=u({timeout:this.timeout},t),this.shake=this.stream.handshake,s(this.stream,e,this.stream)}isValid(){return this.conn&&this.shake&&this.stream}read(e){if(!this.isValid())return e(new Error("handler is not in a valid state"));a.decodeFromReader(this.shake,{maxLength:this.maxLength},(t,n)=>t?(c.err(t),e(t)):e(null,n))}write(e,t){if(t=t||(()=>{}),!this.isValid())return t(new Error("handler is not in a valid state"));s(r([e]),a.encode(),i((e,n)=>{if(e)return c.err(e),this.shake.abort(e),t(e);n.forEach(e=>this.shake.write(e)),t()}))}getRawConn(){return this.conn}rest(){const e=this.shake.rest();return this.conn=null,this.stream=null,this.shake=null,e}close(){this.isValid()&&s(o(),this.rest())}}e.exports=f},function(e,t,n){"use strict";e.exports={relay:"/libp2p/circuit/relay/0.1.0"}},function(e,t,n){"use strict";const r=n(66).Connection,i=n(12);e.exports=((e,t,n,o)=>{const s=new Promise((e,t)=>{n.getPeerInfo((t,r)=>{if(!t&&r)return void e(r);const i=n.setPeerInfo;n.setPeerInfo=(t=>{i.call(n,t),e(t)})})}),a={source:i(n,o.incoming(e,t,s)),sink:i(o.outgoing(e,t,s),n)};return new r(a,n)})},function(e,t,n){"use strict";e.exports={PROTOCOL:"/ipfs/ping/1.0.0",PING_LENGTH:32}},function(e,t,n){var r=n(132),i=n(67),o=n(105),s="[object String]";function a(e){return"string"==typeof e||!i(e)&&o(e)&&r(e)==s}e.exports=a},function(e,t,n){var r=n(1221);e.exports=function(e,t,n){n=void 0===n||n;var i=!1,o;return function(s){var a=0,u=0,l=0,c=[],f=!1,h=!1,p,d;function m(){if(p){var e=p;if(d)return p=null,e(d);if(Object.hasOwnProperty.call(c,u)){p=null;var n=c[u];delete c[u],u++,e(null,n),t&&g()}else u>=l&&h&&(p=null,e(h))}}var g=r(function(){if(f=!0,h)return m();i||t&&a-t>=u||(i=!0,s(o,function(t,r){if(i=!1,t)l=a,h=t,m();else{var o=a++;e(r,function(e,t){n?c[o]=t:c.push(t),e&&(d=e),m()}),h||g()}}))});return function(e,t){e?s(h=o=e,function(e){if(t)return t(e)}):(p=t,f||g(),m())}}}},function(e,t,n){"use strict";const r=n(189),i=100;e.exports=function e(t){const n=t||100;var i=[];return r(function e(t){for(i=i.concat(t);i.length>=n;){const e=n,t=i.slice(0,e);i=i.slice(e),this.queue(t)}},function e(t){i.length&&(this.queue(i),i=[]),this.queue(null)})}},function(e,t,n){"use strict";e.exports=class e{constructor(e,t){this._options=t||{},Object.assign(this,e)}}},function(e,t,n){"use strict";const r=n(1236),i=n(1237),o={bits:8};class s{constructor(e,t,n){if(this._options=Object.assign({},o,e),this._popCount=0,this._parent=t,this._posAtParent=n,!this._options.hashFn)throw new Error("please define an options.hashFn");this._options.hash||(this._options.hash=i(this._options.hashFn)),this._children=new r}static isBucket(e){return e instanceof s}async put(e,t){const n=await this._findNewBucketAndPos(e);await n.bucket._putAt(n,e,t)}async get(e){const t=await this._findChild(e);if(t)return t.value}async del(e){const t=await this._findPlace(e),n=t.bucket._at(t.pos);n&&n.key===e&&t.bucket._delAt(t.pos)}leafCount(){return this._children.compactArray().reduce((e,t)=>t instanceof s?e+t.leafCount():e+1,0)}childrenCount(){return this._children.length}onlyChild(){return this._children.get(0)}*eachLeafSeries(){const e=this._children.compactArray();for(const t of e)if(t instanceof s)for(const e of t.eachLeafSeries())yield e;else yield t}serialize(e,t){return t(this._children.reduce((n,r,i)=>(r&&(r instanceof s?n.push(r.serialize(e,t)):n.push(e(r,i))),n),[]))}async asyncTransform(e,t){return c(this,e,t)}toJSON(){return this.serialize(u,l)}prettyPrint(){return JSON.stringify(this.toJSON(),null," ")}tableSize(){return Math.pow(2,this._options.bits)}async _findChild(e){const t=await this._findPlace(e),n=t.bucket._at(t.pos);if(n&&n.key===e)return n}async _findPlace(e){const t=this._options.hash(e),n=await t.take(this._options.bits),r=this._children.get(n);return r instanceof s?r._findPlace(t):{bucket:this,pos:n,hash:t}}async _findNewBucketAndPos(e){const t=await this._findPlace(e),n=t.bucket._at(t.pos);if(n&&n.key!==e){const e=new s(this._options,t.bucket,t.pos);t.bucket._putObjectAt(t.pos,e);const r=await e._findPlace(n.hash);return r.bucket._putAt(r,n.key,n.value),e._findNewBucketAndPos(t.hash)}return t}_putAt(e,t,n){this._putObjectAt(e.pos,{key:t,value:n,hash:e.hash})}_putObjectAt(e,t){this._children.get(e)||this._popCount++,this._children.set(e,t)}_delAt(e){this._children.get(e)&&this._popCount--,this._children.unset(e),this._level()}_level(){if(this._parent&&this._popCount<=1)if(1===this._popCount){const e=this._children.find(a);if(!(e instanceof s)){const t=e.hash;t.untake(this._options.bits);const n={pos:this._posAtParent,hash:t};this._parent._putAt(n,e.key,e.value)}}else this._parent._delAt(this._posAtParent)}_at(e){return this._children.get(e)}}function a(e){return Boolean(e)}function u(e,t){return e.key}function l(e){return e}async function c(e,t,n){const r=[];for(const i of e._children.compactArray()){if(i instanceof s)await c(i,t,n);else{const n=await t(i);r.push({bitField:e._children.bitField(),children:n})}return n(r)}}e.exports=s},function(e,t,n){"use strict";const r=(e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean);e.exports=r},function(e,t,n){"use strict";const r=n(11),i=n(48),o=n(123),{loadNode:s,formatCid:a,toMfsPath:u,FILE_SEPARATOR:l,FILE_TYPES:c}=n(82),f=n(12),h=n(37),p=n(90),d=n(78),m=n(138),g=n(81),y=n(70),b={long:!1,cidBase:"base58btc"};e.exports=(e=>(function t(n,v={}){"object"==typeof n&&(v=n,n=l),void 0===n&&(n=l),v=Object.assign({},b,v),v.long=v.l||v.long;const w=y.source();return r([t=>u(e,n,t),({mfsPath:t,depth:r},i)=>{f(o(t,e.ipld,{maxDepth:r}),h((s,a)=>{if(s)return i(s);if(a.length>1)return i(new Error(`Path ${n} had ${a.length} roots`));const u=a[0];if(!u)return i(new Error(`${n} does not exist`));if("dir"!==u.type)return i(null,m(u));let l=!0;return i(null,f(o(t,e.ipld,{maxDepth:r+1}),d(()=>!l||(l=!1,!1))))}))},(t,n)=>{n(null,f(t,p((t,n)=>{if(!v.long)return n(null,{name:t.name,type:0,size:0,hash:""});s(e,{cid:t.hash},(e,r)=>{if(e)return n(e);const o=i.unmarshal(r.node.data);n(null,{name:t.name,type:c[o.type],hash:a(t.hash,v.cidBase),size:o.fileSize()||0})})})))}],(e,t)=>{if(e)return w.resolve(g(e));w.resolve(t)}),w}))},function(e,t,n){"use strict";const r=n(11),i=n(88),o=n(5)("ipfs:mfs:mkdir"),s=n(123),a=n(12),u=n(78),l=n(77),c=n(37),f=n(9),{createNode:h,toMfsPath:p,toPathComponents:d,updateMfsRoot:m,updateTree:g,FILE_SEPARATOR:y}=n(82),b={parents:!1,hashAlg:"sha2-256",cidVersion:0,shardSplitThreshold:1e3,format:"dag-pb",flush:!0};e.exports=(e=>(function t(n,v,w){if("function"==typeof v&&(w=v,v={}),v=Object.assign({},b,v),v.parents=v.p||v.parents,v.cidVersion=v.cidVersion||0,!n)return w(new Error("no path given to Mkdir"));if(n=n.trim(),n===y)return w(v.parents?null:new Error(`cannot create directory '${y}': Already exists`));o(`Creating ${n}`);const _=d(n);r([t=>p(e,n,t),({mfsDirectory:t,mfsPath:n,root:r},i)=>{const o=d(n).slice(1);let h=0,p="";a(s(n,e.ipld,{fullPath:!0}),u(e=>e.name===o[h]&&(h++,!0)),l(e=>{const t=`${p}${p?"/":""}${o[e.depth]}`;if("dir"!==e.type)throw new Error(`cannot access ${t}: Not a directory`);return p=t,{cid:new f(e.hash),name:e.name}}),c(i))},(t,n)=>{if(_.unshift("/"),t.length===_.length)return n(new Error("file already exists"));i(_.map((e,t)=>({part:e,index:t})),({part:n,index:i},o)=>t[i]?o(null,{name:n,...t[i]}):i===_.length-1||v.parents?void r([t=>h(e,"directory",v,t),({cid:e,node:t},r)=>{r(null,{cid:e,size:t.size,name:n})}],o):o(new Error("file does not exist")),n)},(t,n)=>g(e,t,v,n),({cid:t},n)=>m(e,t,n)],e=>{e&&e.message.includes("file already exists")&&v.parents&&(e=null),w(e)})}))},function(e,t,n){"use strict";const r=n(123),i=n(12),o=n(138),s=n(90),a=n(224),u=n(78),l=n(70),c=n(37),{toMfsPath:f}=n(82),h=n(5)("ipfs:mfs:read-pull-stream"),p={offset:0,length:void 0};e.exports=(e=>(function t(n,d={}){d=Object.assign({},p,d),d.length=d.length||d.count,h(`Reading ${n}`);const m=l.source();return i(o(n),s((t,n)=>f(e,t,n)),s(({mfsPath:t,root:n},o)=>(h(`Exporting ${t}`),i(r(t,e.ipld,{offset:d.offset,length:d.length}),c(o)))),a(),u(),c((e,t)=>{if(e)return m.abort(e);if(!t||!t.length)return m.abort(new Error(`${n} does not exist`));const r=t[0];return"file"!==r.type?m.abort(new Error(`${n} was not a file`)):r.content?(h(`Got ${n} content`),void m.resolve(t[0].content)):m.abort(new Error(`Could not load content stream from ${n}`))})),m}))},function(e,t,n){"use strict";const r=n(572),i=(e,t,n)=>{"function"==typeof t&&(n=t,t=void 0),r.deserialize(e,(e,r)=>{if(e)return n(e);if(!t)return n(null,{value:r,remainderPath:""});const i=t.split("/"),o=s(r,i[0]);if(null===o)return n(new Error("No such path"),null);let a=i.slice(1).join("/");return void 0!==o["/"]?n(null,{value:o,remainderPath:a}):a.length>0?n(new Error("No such path"),null):n(null,{value:o,remainderPath:""})})},o=(e,t,n)=>{"function"==typeof t&&(n=t,t=void 0),t=t||{},r.deserialize(e,(e,r)=>{if(e)return n(e);const i=["version","timestamp","difficulty","nonce","parent","tx"];if(!0===t.values){const e={};for(let t of i)e[t]=s(r,t);return n(null,e)}return n(null,i)})},s=(e,t)=>{switch(t){case"version":return e.version;case"timestamp":return e.timestamp;case"difficulty":return e.bits;case"nonce":return e.nonce;case"parent":return{"/":r.hashToCid(e.prevHash)};case"tx":return{"/":r.hashToCid(e.merkleRoot)};default:return null}};e.exports={multicodec:"bitcoin-block",defaultHashAlg:"dbl-sha2-256",resolve:i,tree:o}},function(e,t){var n={Array:function(e){return null!==e&&void 0!==e&&e.constructor===Array},Boolean:function(e){return"boolean"==typeof e},Function:function(e){return"function"==typeof e},Nil:function(e){return void 0===e||null===e},Number:function(e){return"number"==typeof e},Object:function(e){return"object"==typeof e},String:function(e){return"string"==typeof e},"":function(){return!0}};for(var r in n.Null=n.Nil,n)n[r].toJSON=function(e){return e}.bind(null,r);e.exports=n},function(e,t,n){const r=n(4).Buffer,i=n(108),o=n(29),s=n(1358),a=n(36),u=n(45),l=n(94),c=n(580);function f(e){const t=e.length;return c.encodingLength(t)+t}function h(e){const t=e.length;return c.encodingLength(t)+e.reduce(function(e,t){return e+f(t)},0)}function p(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}p.DEFAULT_SEQUENCE=4294967295,p.SIGHASH_ALL=1,p.SIGHASH_NONE=2,p.SIGHASH_SINGLE=3,p.SIGHASH_ANYONECANPAY=128,p.ADVANCED_TRANSACTION_MARKER=0,p.ADVANCED_TRANSACTION_FLAG=1;const d=r.allocUnsafe(0),m=[],g=r.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),y=r.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),b=r.from("ffffffffffffffff","hex"),v={script:d,valueBuffer:b};p.fromBuffer=function(e,t){let n=0;function r(t){return n+=t,e.slice(n-t,n)}function i(){const t=e.readUInt32LE(n);return n+=4,t}function o(){const t=e.readInt32LE(n);return n+=4,t}function a(){const t=s.readUInt64LE(e,n);return n+=8,t}function u(){const t=c.decode(e,n);return n+=c.decode.bytes,t}function l(){return r(u())}function f(){const e=u(),t=[];for(var n=0;n=this.ins.length)return y;const s=o.compile(o.decompile(t).filter(function(e){return e!==a.OP_CODESEPARATOR})),c=this.clone();if((31&n)===p.SIGHASH_NONE)c.outs=[],c.ins.forEach(function(t,n){n!==e&&(t.sequence=0)});else if((31&n)===p.SIGHASH_SINGLE){if(e>=this.outs.length)return y;c.outs.length=e+1;for(var f=0;f>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function u(e){for(var t=1,n=0;n126)throw new Error("Invalid prefix ("+e+")");t=a(t)^r>>5}for(t=a(t),n=0;nn)throw new TypeError("Exceeds length limit");e=e.toLowerCase();for(var i=u(e),o=e+"1",s=0;s>5!=0)throw new Error("Non 5-bit word");i=a(i)^l,o+=r.charAt(l)}for(s=0;s<6;++s)i=a(i);for(i^=1,s=0;s<6;++s){var c=i>>5*(5-s)&31;o+=r.charAt(c)}return o}function c(e,t){if(t=t||90,e.length<8)throw new TypeError(e+" too short");if(e.length>t)throw new TypeError("Exceeds length limit");var n=e.toLowerCase(),r=e.toUpperCase();if(e!==n&&e!==r)throw new Error("Mixed-case string "+e);e=n;var o=e.lastIndexOf("1");if(-1===o)throw new Error("No separator character for "+e);if(0===o)throw new Error("Missing prefix for "+e);var s=e.slice(0,o),l=e.slice(o+1);if(l.length<6)throw new Error("Data too short");for(var c=u(s),f=[],h=0;h=l.length||f.push(d)}if(1!==c)throw new Error("Invalid checksum for "+e);return{prefix:s,words:f}}function f(e,t,n,r){for(var i=0,o=0,s=(1<=n;)o-=n,a.push(i>>o&s);if(r)o>0&&a.push(i<=t)throw new Error("Excess padding");if(i<{const t=s.decode(e),n=new a(t);return n}),c;function f(e,o,s){h(e,o,(e,a)=>{if(e)return s(e);if(!n)return s(null,a);let u=a.slice();const l=a.filter(e=>t.isBuffer(e.value));r(l,(e,t)=>i([t=>n.util.deserialize(e.value,t),(e,t)=>n.resolver._mapFromEthObject(e,o,t)],(n,r)=>{if(n)return t(n);r.forEach(t=>{u.push({path:e.path+"/"+t.path,value:t.value})}),t()}),e=>{if(e)return s(e);s(null,u)})})}function h(t,n,i){let o=[];"leaf"===t.type&&o.push({path:m(t.getKey()),value:t.getValue()}),r(t.getChildren(),(t,r)=>{const i=m(t[0]),s=t[1];if(a.isRawNode(s)){const e=new a(s);o.push({path:i,value:e}),h(e,n,(e,t)=>{if(e)return r(e);t.forEach(e=>{e.path=i+"/"+e.path}),o=o.concat(t),r()})}else{let t={"/":u(e,s).toBaseEncodedString()};o.push({path:i,value:t}),r()}},e=>{if(e)return i(e);i(null,o)})}}function m(e){return e.map(e=>e.toString(16)).join("/")}e.exports=d}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(596),i=(e,t,n)=>{"function"==typeof t&&(n=t,t=void 0),r.deserialize(e,(e,r)=>{if(e)return n(e);if(!t)return n(null,{value:r,remainderPath:""});const i=t.split("/"),o=s(r,i[0]);if(null===o)return n(new Error("No such path"),null);let a=i.slice(1).join("/");return void 0!==o["/"]?n(null,{value:o,remainderPath:a}):a.length>0?n(new Error("No such path"),null):n(null,{value:o,remainderPath:""})})},o=(e,t,n)=>{"function"==typeof t&&(n=t,t=void 0),t=t||{},r.deserialize(e,(e,r)=>{if(e)return n(e);const i=["version","timestamp","difficulty","nonce","solution","reserved","parent","tx"];if(!0===t.values){const e={};for(let t of i)e[t]=s(r,t);return n(null,e)}return n(null,i)})},s=(e,t)=>{switch(t){case"version":return e.version;case"timestamp":return e.time;case"difficulty":return e.bits;case"nonce":return e.nonce;case"solution":return e.solution;case"reserved":return e.reserved;case"parent":return{"/":r.hashToCid(e.prevHash)};case"tx":return{"/":r.hashToCid(e.merkleRoot)};default:return null}};e.exports={multicodec:"zcash-block",defaultHashAlg:"dbl-sha2-256",resolve:i,tree:o}},function(e,t){"function"==typeof Object.create?e.exports=function e(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function e(t,n){if(n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}}},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(25),o=n(30),s=n(41);function a(e){if(!(this instanceof a))return new a(e);var t;if(r.isNumber(e))t=e;else{if(!r.isString(e))throw new TypeError('Unrecognized num type: "'+typeof e+'" for Opcode');t=a.map[e]}return s.defineImmutable(this,{num:t}),this}for(var u in a.fromBuffer=function(e){return i.checkArgument(o.isBuffer(e)),new a(Number("0x"+e.toString("hex")))},a.fromNumber=function(e){return i.checkArgument(r.isNumber(e)),new a(e)},a.fromString=function(e){i.checkArgument(r.isString(e));var t=a.map[e];if(void 0===t)throw new TypeError("Invalid opcodestr");return new a(t)},a.prototype.toHex=function(){return this.num.toString(16)},a.prototype.toBuffer=function(){return new t(this.toHex(),"hex")},a.prototype.toNumber=function(){return this.num},a.prototype.toString=function(){var e=a.reverseMap[this.num];if(void 0===e)throw new Error("Opcode does not have a string representation");return e},a.smallInt=function(e){return i.checkArgument(r.isNumber(e),"Invalid Argument: n should be number"),i.checkArgument(e>=0&&e<=16,"Invalid Argument: n must be between 0 and 16"),0===e?a("OP_0"):new a(a.map.OP_1+e-1)},a.map={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP1:176,OP_NOP2:177,OP_NOP3:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255},a.reverseMap=[],a.map)a.reverseMap[a.map[u]]=u;r.extend(a,a.map),a.isSmallIntOp=function(e){return e instanceof a&&(e=e.toNumber()),e===a.map.OP_0||e>=a.map.OP_1&&e<=a.map.OP_16},a.prototype.inspect=function(){return""},e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(25),o=n(0),s=t.compare||n(1447),a=n(84),u=n(30),l=n(41),c=n(109),f=n(80),h=n(60),p=n(85),d=n(110),m=n(129),g=n(601),y=n(360),b=y.PublicKeyHash,v=y.PublicKey,w=y.MultiSigScriptHash,_=y.MultiSig,k=n(111),S=n(86),E=n(273),x=n(49),C=n(1452);function A(e){if(!(this instanceof A))return new A(e);if(this.inputs=[],this.outputs=[],this.joinSplits=[],this._inputAmount=void 0,this._outputAmount=void 0,e){if(e instanceof A)return A.shallowCopy(e);if(l.isHexa(e))this.fromString(e);else if(u.isBuffer(e))this.fromBuffer(e);else{if(!r.isObject(e))throw new a.InvalidArgument("Must provide an object or string to deserialize a transaction");this.fromObject(e)}}else this._newTransaction()}var I=1,T=0,j=1e6;A.DUST_AMOUNT=546,A.FEE_SECURITY_MARGIN=15,A.MAX_MONEY=21e14,A.NLOCKTIME_BLOCKHEIGHT_LIMIT=5e8,A.NLOCKTIME_MAX_VALUE=4294967295,A.FEE_PER_KB=1e4,A.CHANGE_OUTPUT_MAX_SIZE=62,A.MAXIMUM_EXTRA_SIZE=26,A.shallowCopy=function(e){var t=new A(e.toBuffer());return t};var O={configurable:!1,enumerable:!0,get:function(){return new c(this._getHash()).readReverse().toString("hex")}};Object.defineProperty(A.prototype,"hash",O),Object.defineProperty(A.prototype,"id",O);var P={configurable:!1,enumerable:!0,get:function(){return this._getInputAmount()}};Object.defineProperty(A.prototype,"inputAmount",P),P.get=function(){return this._getOutputAmount()},Object.defineProperty(A.prototype,"outputAmount",P),A.prototype._getHash=function(){return h.sha256sha256(this.toBuffer())},A.prototype.serialize=function(e){return!0===e||e&&e.disableAll?this.uncheckedSerialize():this.checkedSerialize(e)},A.prototype.uncheckedSerialize=A.prototype.toString=function(){return this.toBuffer().toString("hex")},A.prototype.checkedSerialize=function(e){var t=this.getSerializationError(e);if(t)throw t.message+=" Use Transaction#uncheckedSerialize if you want to skip security checks. See http://bitcore.io/guide/transaction.html#Serialization for more info.",t;return this.uncheckedSerialize()},A.prototype.invalidSatoshis=function(){for(var e=!1,t=0;tn)return this._missingChange()?new a.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new a.Transaction.FeeError.TooLarge("expected less than "+n+" but got "+t)}if(!e.disableSmallFees){var i=Math.ceil(this._estimateFee()/A.FEE_SECURITY_MARGIN);if(t"},A.prototype.toBuffer=function(){var e=new f;return this.toBufferWriter(e).toBuffer()},A.prototype.toBufferWriter=function(e){return e.writeUInt32LE(this.version),e.writeVarintNum(this.inputs.length),r.each(this.inputs,function(t){t.toBufferWriter(e)}),e.writeVarintNum(this.outputs.length),r.each(this.outputs,function(t){t.toBufferWriter(e)}),e.writeUInt32LE(this.nLockTime),this.version>=2&&(e.writeVarintNum(this.joinSplits.length),r.each(this.joinSplits,function(t){t.toBufferWriter(e)}),this.joinSplits.length>0&&(e.write(this.joinSplitPubKey),e.write(this.joinSplitSig))),e},A.prototype.fromBuffer=function(e){var t=new c(e);return this.fromBufferReader(t)},A.prototype.fromBufferReader=function(e){var t,n,r,o;for(i.checkArgument(!e.finished(),"No transaction data received"),this.version=e.readUInt32LE(),n=e.readVarintNum(),t=0;t=2){for(o=e.readVarintNum(),t=0;t0&&(this.joinSplitPubKey=e.read(32),this.joinSplitSig=e.read(64))}return this},A.prototype.toObject=A.prototype.toJSON=function e(){var t=[];this.inputs.forEach(function(e){t.push(e.toObject())});var n=[];this.outputs.forEach(function(e){n.push(e.toObject())});var i={hash:this.hash,version:this.version,inputs:t,outputs:n,nLockTime:this.nLockTime};if(this.version>=2){var o=[];this.joinSplits.forEach(function(e){o.push(e.toObject())}),i.joinSplits=o,this.joinSplits.length>0&&(i.joinSplitPubKey=u.reverse(this.joinSplitPubKey).toString("hex"),i.joinSplitSig=this.joinSplitSig.toString("hex"))}return this._changeScript&&(i.changeScript=this._changeScript.toString()),r.isUndefined(this._changeIndex)||(i.changeIndex=this._changeIndex),r.isUndefined(this._fee)||(i.fee=this._fee),i},A.prototype.fromObject=function e(n){i.checkArgument(r.isObject(n)||n instanceof A);var o=this,s;return s=n instanceof A?s.toObject():n,r.each(s.inputs,function(e){if(e.output&&e.output.script){var t=new S(e.output.script),n;if(t.isPublicKeyHashOut())n=new y.PublicKeyHash(e);else if(t.isScriptHashOut()&&e.publicKeys&&e.threshold)n=new y.MultiSigScriptHash(e,e.publicKeys,e.threshold,e.signatures);else{if(!t.isPublicKeyOut())throw new a.Transaction.Input.UnsupportedScript(e.output.script);n=new y.PublicKey(e)}o.addInput(n)}else o.uncheckedAddInput(new y(e))}),r.each(s.outputs,function(e){o.addOutput(new k(e))}),s.changeIndex&&(this._changeIndex=s.changeIndex),s.changeScript&&(this._changeScript=new S(s.changeScript)),s.fee&&(this._fee=s.fee),this.nLockTime=s.nLockTime,this.version=s.version,this.version>=2&&(r.each(s.joinSplits,function(e){o.joinSplits.push(new C(e))}),o.joinSplits.length>0&&(o.joinSplitPubKey=u.reverse(new t(s.joinSplitPubKey,"hex")),o.joinSplitSig=new t(s.joinSplitSig,"hex"))),this._checkConsistency(n),this},A.prototype._checkConsistency=function(e){r.isUndefined(this._changeIndex)||(i.checkState(this._changeScript),i.checkState(this.outputs[this._changeIndex]),i.checkState(this.outputs[this._changeIndex].script.toString()===this._changeScript.toString())),e&&e.hash&&i.checkState(e.hash===this.hash,"Hash in object does not match transaction hash")},A.prototype.lockUntilDate=function(e){if(i.checkArgument(e),r.isNumber(e)&&e=A.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new a.Transaction.BlockHeightTooHigh;if(e<0)throw new a.Transaction.NLockTimeOutOfRange;for(var t=0;t0?(this._changeIndex=this.outputs.length,this._addOutput(new k({script:this._changeScript,satoshis:n}))):this._changeIndex=void 0}},A.prototype.getFee=function(){return this.isCoinbase()?0:r.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee},A.prototype._estimateFee=function(){var e=this._estimateSize(),t=this._getUnspentValue();return A._estimateFee(e,t,this._feePerKb)},A.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()},A.prototype._clearSignatures=function(){r.each(this.inputs,function(e){e.clearSignatures()})},A._estimateFee=function(e,t,n){var r=Math.ceil(e/1e3)*(n||A.FEE_PER_KB);return t>r&&(e+=A.CHANGE_OUTPUT_MAX_SIZE),Math.ceil(e/1e3)*(n||A.FEE_PER_KB)},A.prototype._estimateSize=function(){var e=A.MAXIMUM_EXTRA_SIZE;return r.each(this.inputs,function(t){e+=t._estimateSize()}),r.each(this.outputs,function(t){e+=t.script.toBuffer().length+9}),e},A.prototype._removeOutput=function(e){var t=this.outputs[e];this.outputs=r.without(this.outputs,t),this._outputAmount=void 0},A.prototype.removeOutput=function(e){this._removeOutput(e),this._updateChangeOutput()},A.prototype.sort=function(){return this.sortInputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(e,t){return s(e.prevTxId,t.prevTxId)||e.outputIndex-t.outputIndex}),t}),this.sortOutputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(e,t){return e.satoshis-t.satoshis||s(e.script.toBuffer(),t.script.toBuffer())}),t}),this},A.prototype.shuffleOutputs=function(){return this.sortOutputs(r.shuffle)},A.prototype.sortOutputs=function(e){var t=e(this.outputs);return this._newOutputOrder(t)},A.prototype.sortInputs=function(e){return this.inputs=e(this.inputs),this._clearSignatures(),this},A.prototype._newOutputOrder=function(e){var t=this.outputs.length!==e.length||0!==r.difference(this.outputs,e).length;if(t)throw new a.Transaction.InvalidSorting;if(!r.isUndefined(this._changeIndex)){var n=this.outputs[this._changeIndex];this._changeIndex=r.findIndex(e,n)}return this.outputs=e,this},A.prototype.removeInput=function(e,t){var n;if(n=!t&&r.isNumber(e)?e:r.findIndex(this.inputs,function(n){return n.prevTxId.toString("hex")===e&&n.outputIndex===t}),n<0||n>=this.inputs.length)throw new a.Transaction.InvalidIndex(n,this.inputs.length);var i=this.inputs[n];this.inputs=r.without(this.inputs,i),this._inputAmount=void 0,this._updateChangeOutput()},A.prototype.sign=function(e,t){i.checkState(this.hasAllUtxoInfo());var n=this;return r.isArray(e)?(r.each(e,function(e){n.sign(e,t)}),this):(r.each(this.getSignatures(e,t),function(e){n.applySignature(e)}),this)},A.prototype.getSignatures=function(e,t){e=new E(e),t=t||p.SIGHASH_ALL;var n=this,i=[],o=h.sha256ripemd160(e.publicKey.toBuffer());return r.each(this.inputs,function s(a,u){r.each(a.getSignatures(n,e,u,t,o),function(e){i.push(e)})}),i},A.prototype.applySignature=function(e){return this.inputs[e.inputIndex].addSignature(this,e),this},A.prototype.isFullySigned=function(){return r.each(this.inputs,function(e){if(e.isFullySigned===y.prototype.isFullySigned)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction")}),r.all(r.map(this.inputs,function(e){return e.isFullySigned()}))},A.prototype.isValidSignature=function(e){var t=this;if(this.inputs[e.inputIndex].isValidSignature===y.prototype.isValidSignature)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction");return this.inputs[e.inputIndex].isValidSignature(this,e)},A.prototype.verifySignature=function(e,t,n,r){return d.verify(this,e,t,n,r)},A.prototype.verify=function(){if(0===this.inputs.length)return"transaction txins empty";if(0===this.outputs.length)return"transaction txouts empty";for(var e=new x(0),t=0;t1e6)return"transaction over the maximum block size";var i={};for(t=0;t100)return"coinbase transaction script size invalid"}else for(t=0;t=y.MAXINT-1&&(t.sequenceNumber=y.DEFAULT_RBF_SEQNUMBER)}return this},e.exports=A}).call(this,n(0).Buffer)},function(e,t,n){e.exports=n(197),e.exports.PublicKey=n(1448),e.exports.PublicKeyHash=n(1449),e.exports.MultiSig=n(1450),e.exports.MultiSigScriptHash=n(1451)},function(e,t,n){"use strict";var r=n(17),i=n(84),o=n(25),s={BTC:[1e8,8],mBTC:[1e5,5],uBTC:[100,2],bits:[100,2],satoshis:[1,0]};function a(e,t){if(!(this instanceof a))return new a(e,t);if(r.isNumber(t)){if(t<=0)throw new i.Unit.InvalidRate(t);e/=t,t=a.BTC}this._value=this._from(e,t);var n=this,o=function(e){Object.defineProperty(n,e,{get:function(){return n.to(e)},enumerable:!0})};Object.keys(s).forEach(o)}Object.keys(s).forEach(function(e){a[e]=e}),a.fromObject=function e(t){return o.checkArgument(r.isObject(t),"Argument is expected to be an object"),new a(t.amount,t.code)},a.fromBTC=function(e){return new a(e,a.BTC)},a.fromMillis=a.fromMilis=function(e){return new a(e,a.mBTC)},a.fromMicros=a.fromBits=function(e){return new a(e,a.bits)},a.fromSatoshis=function(e){return new a(e,a.satoshis)},a.fromFiat=function(e,t){return new a(e,t)},a.prototype._from=function(e,t){if(!s[t])throw new i.Unit.UnknownCode(t);return parseInt((e*s[t][0]).toFixed())},a.prototype.to=function(e){if(r.isNumber(e)){if(e<=0)throw new i.Unit.InvalidRate(e);return parseFloat((this.BTC*e).toFixed(2))}if(!s[e])throw new i.Unit.UnknownCode(e);var t=this._value/s[e][0];return parseFloat(t.toFixed(s[e][1]))},a.prototype.toBTC=function(){return this.to(a.BTC)},a.prototype.toMillis=a.prototype.toMilis=function(){return this.to(a.mBTC)},a.prototype.toMicros=a.prototype.toBits=function(){return this.to(a.bits)},a.prototype.toSatoshis=function(){return this.to(a.satoshis)},a.prototype.atRate=function(e){return this.to(e)},a.prototype.toString=function(){return this.satoshis+" satoshis"},a.prototype.toObject=a.prototype.toJSON=function e(){return{amount:this.BTC,code:a.BTC}},a.prototype.inspect=function(){return""},e.exports=a},function(e,t,n){"use strict";e.exports={_cache:{},_count:0,_eraseIndex:0,_usedList:{},_usedIndex:{},_CACHE_SIZE:5e3,get:function(e,t,n){n=!!n;var r=e+"/"+t+"/"+n;if(this._cache[r])return this._cacheHit(r),this._cache[r]},set:function(e,t,n,r){n=!!n;var i=e+"/"+t+"/"+n;this._cache[i]=r,this._cacheHit(i)},_cacheHit:function(e){this._usedIndex[e]&&delete this._usedList[this._usedIndex[e]],this._usedList[this._count]=e,this._usedIndex[e]=this._count,this._count++,this._cacheRemove()},_cacheRemove:function(){for(;this._eraseIndex{const n=o(e,t);return(e,t,o)=>{const s=r(o),a=n(t),u=i(e=>s(null,e));a.once("error",s),a.pipe(u),a.write(e),a.end()}})},function(e,t,n){"use strict";const r=n(59),i=n(1488),o=n(20).Readable;class s extends o{constructor(e){const t=Object.assign(e||{},{objectMode:!0});super(t)}_read(){}}const a=(e,t)=>{let n=new s,o=i.extract();o.on("entry",(e,t,r)=>{t.on("end",r),"directory"!==e.type?n.push({path:e.name,content:t}):(n.push({path:e.name}),t.resume())}).on("finish",()=>n.push(null)),r(e,o),t(null,n)};e.exports=a},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i=Array.isArray,o=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),s=function e(t){for(;t.length>1;){var n=t.pop(),r=n.obj[n.prop];if(i(r)){for(var o=[],s=0;s=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122?s+=i.charAt(a):u<128?s+=o[u]:u<2048?s+=o[192|u>>6]+o[128|63&u]:u<55296||u>=57344?s+=o[224|u>>12]+o[128|u>>6&63]+o[128|63&u]:(a+=1,u=65536+((1023&u)<<10|1023&i.charCodeAt(a)),s+=o[240|u>>18]+o[128|u>>12&63]+o[128|u>>6&63]+o[128|63&u])}return s},h=function e(t){for(var n=[{obj:{o:t},prop:"o"}],r=[],i=0;i1;class m{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");const t=this[i]=e.max||1/0,n=e.length||d;if(this[s]="function"!=typeof n?d:n,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[u]=e.maxAge||0,this[l]=e.dispose,this[c]=e.noDisposeOnSet||!1,this[p]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||1/0,b(this)}get max(){return this[i]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[u]=e,b(this)}get maxAge(){return this[u]}set lengthCalculator(e){"function"!=typeof e&&(e=d),e!==this[s]&&(this[s]=e,this[o]=0,this[f].forEach(e=>{e.length=this[s](e.value,e.key),this[o]+=e.length})),b(this)}get lengthCalculator(){return this[s]}get length(){return this[o]}get itemCount(){return this[f].length}rforEach(e,t){t=t||this;for(let n=this[f].tail;null!==n;){const r=n.prev;_(this,e,n,t),n=r}}forEach(e,t){t=t||this;for(let n=this[f].head;null!==n;){const r=n.next;_(this,e,n,t),n=r}}keys(){return this[f].toArray().map(e=>e.key)}values(){return this[f].toArray().map(e=>e.value)}reset(){this[l]&&this[f]&&this[f].length&&this[f].forEach(e=>this[l](e.key,e.value)),this[h]=new Map,this[f]=new r,this[o]=0}dump(){return this[f].map(e=>!y(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[f]}set(e,t,n){if(n=n||this[u],n&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const r=n?Date.now():0,a=this[s](t,e);if(this[h].has(e)){if(a>this[i])return v(this,this[h].get(e)),!1;const s=this[h].get(e),u=s.value;return this[l]&&(this[c]||this[l](e,u.value)),u.now=r,u.maxAge=n,u.value=t,this[o]+=a-u.length,u.length=a,this.get(e),b(this),!0}const p=new w(e,t,a,r,n);return p.length>this[i]?(this[l]&&this[l](e,t),!1):(this[o]+=p.length,this[f].unshift(p),this[h].set(e,this[f].head),b(this),!0)}has(e){if(!this[h].has(e))return!1;const t=this[h].get(e).value;return!y(this,t)}get(e){return g(this,e,!0)}peek(e){return g(this,e,!1)}pop(){const e=this[f].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[h].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{const e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[h].forEach((e,t)=>g(this,t,!1))}}const g=(e,t,n)=>{const r=e[h].get(t);if(r){const t=r.value;if(y(e,t)){if(v(e,r),!e[a])return}else n&&(e[p]&&(r.value.now=Date.now()),e[f].unshiftNode(r));return t.value}},y=(e,t)=>{if(!t||!t.maxAge&&!e[u])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[u]&&n>e[u]},b=e=>{if(e[o]>e[i])for(let t=e[f].tail;e[o]>e[i]&&null!==t;){const n=t.prev;v(e,t),t=n}},v=(e,t)=>{if(t){const n=t.value;e[l]&&e[l](n.key,n.value),e[o]-=n.length,e[h].delete(n.key),e[f].removeNode(t)}};class w{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}}const _=(e,t,n,r)=>{let i=n.value;y(e,i)&&(v(e,n),e[a]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};e.exports=m},function(e,t,n){"use strict";const r=n(112);function i(e,t,n){"function"==typeof e.pipe?r(e,(e,r)=>{if(e)return n(e);t(r,n)}):t(e,n)}e.exports=i},function(e,t,n){"use strict";const r=n(20).Transform,i=n(1569);class o extends r{constructor(e){const t=Object.assign(e||{},{objectMode:!0});super(t)}_transform(e,t,n){try{const t=i(e);if(this.push(t),!t.success)throw new Error(t.text)}catch(e){return n(e)}n()}}e.exports=o},function(e,t,n){"use strict";const r=n(62);e.exports=(e=>({totalIn:new r(e.TotalIn),totalOut:new r(e.TotalOut),rateIn:new r(e.RateIn),rateOut:new r(e.RateOut)}))},function(e,t,n){(function(t){e.exports=f;const r=n(655),i=n(1754),o=n(154),s=n(203),a=n(28),u=n(169),l=n(32),c=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;function f(e,n){if(e=Object.assign({maxRedirects:10},"string"==typeof e?{url:e}:e),n=a(n),e.url){const{hostname:t,port:n,protocol:r,auth:i,path:o}=l.parse(e.url);delete e.url,t||n||r||i?Object.assign(e,{hostname:t,port:n,protocol:r,auth:i,path:o}):e.path=o}const r={"accept-encoding":"gzip, deflate"};let h;e.headers&&Object.keys(e.headers).forEach(t=>r[t.toLowerCase()]=e.headers[t]),e.headers=r,e.body?h=e.json&&!c(e.body)?JSON.stringify(e.body):e.body:e.form&&(h="string"==typeof e.form?e.form:u.stringify(e.form),e.headers["content-type"]="application/x-www-form-urlencoded"),h&&(e.method||(e.method="POST"),c(h)||(e.headers["content-length"]=t.byteLength(h)),e.json&&!e.form&&(e.headers["content-type"]="application/json")),delete e.body,delete e.form,e.json&&(e.headers.accept="application/json"),e.method&&(e.method=e.method.toUpperCase());const p="https:"===e.protocol?s:o,d=p.request(e,t=>{if(t.statusCode>=300&&t.statusCode<400&&t.headers.location)return e.url=t.headers.location,delete e.headers.host,t.resume(),"POST"===e.method&&[301,302].includes(t.statusCode)&&(e.method="GET",delete e.headers["content-length"],delete e.headers["content-type"]),0==e.maxRedirects--?n(new Error("too many redirects")):f(e,n);const r="function"==typeof i&&"HEAD"!==e.method;n(null,r?i(t):t)});return d.on("timeout",()=>{d.abort(),n(new Error("Request timed out"))}),d.on("error",n),c(h)?h.on("error",n).pipe(d):d.end(h),d}f.concat=((e,t)=>f(e,(n,i)=>{if(n)return t(n);r(i,(n,r)=>{if(n)return t(n);if(e.json)try{r=JSON.parse(r.toString())}catch(n){return t(n,i,r)}t(null,i,r)})})),["get","post","put","patch","head","delete"].forEach(e=>{f[e]=((t,n)=>("string"==typeof t&&(t={url:t}),f(Object.assign({method:e.toUpperCase()},t),n)))})}).call(this,n(0).Buffer)},function(e,t){var n=1,r=65535,i=4,o,s=function(){n=n+1&65535};e.exports=function(e){o||(o=setInterval(s,250),o.unref&&o.unref());var t=4*(e||5),r=[0],i=1,a=n-1&65535;return function(e){var o=n-a&65535;for(o>t&&(o=t),a=n;o--;)i===t&&(i=0),r[i]=r[0===i?t-1:i-1],i++;e&&(r[i-1]+=e);var s=r[i-1],u=r.length=4"},homepage:"https://webtorrent.io",keywords:["bittorrent","bittorrent client","download","mad science","p2p","peer-to-peer","peers","streaming","swarm","torrent","web torrent","webrtc","webrtc data","webtorrent"],license:"MIT",main:"index.js",repository:{type:"git",url:"git://github.com/webtorrent/webtorrent.git"},scripts:{build:"browserify -s WebTorrent -e ./ | minify > webtorrent.min.js","build-debug":"browserify -s WebTorrent -e ./ > webtorrent.debug.js",size:"npm run build && cat webtorrent.min.js | gzip | wc -c",test:"standard && npm run test-node && npm run test-browser","test-browser":"airtap -- test/*.js test/browser/*.js","test-browser-local":"airtap --local -- test/*.js test/browser/*.js","test-node":"tape test/*.js test/node/*.js","update-authors":"./scripts/update-authors.sh"}}},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function e(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===i.call(t)},u=function e(t){if(!t||"[object Object]"!==i.call(t))return!1;var n=r.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&r.call(t.constructor.prototype,"isPrototypeOf"),s;if(t.constructor&&!n&&!o)return!1;for(s in t);return void 0===s||r.call(t,s)},l=function e(t,n){o&&"__proto__"===n.name?o(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},c=function e(t,n){if("__proto__"===n){if(!r.call(t,n))return;if(s)return s(t,n).value}return t[n]};e.exports=function e(){var t,n,r,i,o,s,f=arguments[0],h=1,p=arguments.length,d=!1;for("boolean"==typeof f&&(d=f,f=arguments[1]||{},h=2),(null==f||"object"!=typeof f&&"function"!=typeof f)&&(f={});h32;)t=t.slice(1);var n=this._priv;r.strictEqual(t.length,32),r.strictEqual(n.length,32);var i=u.box.before(new Uint8Array(t),new Uint8Array(n));return o.from(i)}throw new Error("Invalid algorithm: "+this._algo)},m.prototype.generateKey=function(){var e=[],t,n;if("dsa"===this._algo)return this._dh.generateKeys(),e.push({name:"p",data:this._p.data}),e.push({name:"q",data:this._key.part.q.data}),e.push({name:"g",data:this._g.data}),e.push({name:"y",data:this._dh.getPublicKey()}),e.push({name:"x",data:this._dh.getPrivateKey()}),this._key=new c({type:"dsa",parts:e}),this._isPriv=!0,this._key;if("ecdsa"===this._algo){if(f)return this._dh.generateKeys(),e.push({name:"curve",data:o.from(this._curve)}),e.push({name:"Q",data:this._dh.getPublicKey()}),e.push({name:"d",data:this._dh.getPrivateKey()}),this._key=new c({type:"ecdsa",curve:this._curve,parts:e}),this._isPriv=!0,this._key;var s=this._ecParams.getN(),a=new d(i.randomBytes(s.bitLength())),l=s.subtract(d.ONE);return t=a.mod(l).add(d.ONE),n=this._ecParams.getG().multiply(t),t=o.from(t.toByteArray()),n=o.from(this._ecParams.getCurve().encodePointHex(n),"hex"),this._priv=new b(this._ecParams,t),e.push({name:"curve",data:o.from(this._curve)}),e.push({name:"Q",data:n}),e.push({name:"d",data:t}),this._key=new c({type:"ecdsa",curve:this._curve,parts:e}),this._isPriv=!0,this._key}if("curve25519"===this._algo){var h=u.box.keyPair();return t=o.from(h.secretKey),n=o.from(h.publicKey),t=o.concat([t,n]),r.strictEqual(t.length,64),r.strictEqual(n.length,32),e.push({name:"A",data:n}),e.push({name:"k",data:t}),this._key=new c({type:"curve25519",parts:e}),this._isPriv=!0,this._key}throw new Error("Invalid algorithm: "+this._algo)},m.prototype.generateKeys=m.prototype.generateKey,g.prototype.getCurve=function(){return this.curve},g.prototype.getG=function(){return this.g},g.prototype.getN=function(){return this.n},g.prototype.getH=function(){return this.h},b.prototype.deriveSharedSecret=function(e){r.ok(e instanceof y);var t=e._pub.multiply(this._priv);return o.from(t.getX().toBigInteger().toByteArray())}},function(e,t,n){e.exports={read:p,readPkcs1:g,write:d,writePkcs1:E};var r=n(27),i=n(103),o=n(31).Buffer,s=n(55),a=n(47),u=n(46),l=n(50),c=n(113),f=n(211),h=f.readECDSACurve;function p(e,t){return c.read(e,t,"pkcs1")}function d(e,t){return c.write(e,t,"pkcs1")}function m(e,t){return r.strictEqual(e.peek(),i.Ber.Integer,t+" is not an Integer"),a.mpNormalize(e.readString(i.Ber.Integer,!0))}function g(e,t,n){switch(e){case"RSA":if("public"===t)return y(n);if("private"===t)return b(n);throw new Error("Unknown key type: "+t);case"DSA":if("public"===t)return _(n);if("private"===t)return v(n);throw new Error("Unknown key type: "+t);case"EC":case"ECDSA":if("private"===t)return S(n);if("public"===t)return k(n);throw new Error("Unknown key type: "+t);case"EDDSA":case"EdDSA":if("private"===t)return w(n);throw new Error(t+" keys not supported with EdDSA");default:throw new Error("Unknown key algo: "+e)}}function y(e){var t=m(e,"modulus"),n=m(e,"exponent"),r={type:"rsa",parts:[{name:"e",data:n},{name:"n",data:t}]};return new u(r)}function b(e){var t=m(e,"version");r.strictEqual(t[0],0);var n=m(e,"modulus"),i=m(e,"public exponent"),o=m(e,"private exponent"),s=m(e,"prime1"),a=m(e,"prime2"),u=m(e,"exponent1"),c=m(e,"exponent2"),f=m(e,"iqmp"),h={type:"rsa",parts:[{name:"n",data:n},{name:"e",data:i},{name:"d",data:o},{name:"iqmp",data:f},{name:"p",data:s},{name:"q",data:a},{name:"dmodp",data:u},{name:"dmodq",data:c}]};return new l(h)}function v(e){var t=m(e,"version");r.strictEqual(t.readUInt8(0),0);var n=m(e,"p"),i=m(e,"q"),o=m(e,"g"),s=m(e,"y"),a=m(e,"x"),u={type:"dsa",parts:[{name:"p",data:n},{name:"q",data:i},{name:"g",data:o},{name:"y",data:s},{name:"x",data:a}]};return new l(u)}function w(e){var t=m(e,"version");r.strictEqual(t.readUInt8(0),1);var n=e.readString(i.Ber.OctetString,!0);e.readSequence(160);var o=e.readOID();r.strictEqual(o,"1.3.101.112","the ed25519 curve identifier"),e.readSequence(161);var s=a.readBitString(e),u={type:"ed25519",parts:[{name:"A",data:a.zeroPadToLength(s,32)},{name:"k",data:n}]};return new l(u)}function _(e){var t=m(e,"y"),n=m(e,"p"),r=m(e,"q"),i=m(e,"g"),o={type:"dsa",parts:[{name:"y",data:t},{name:"p",data:n},{name:"q",data:r},{name:"g",data:i}]};return new u(o)}function k(e){e.readSequence();var t=e.readOID();r.strictEqual(t,"1.2.840.10045.2.1","must be ecPublicKey");for(var n=e.readOID(),l,c=Object.keys(s.curves),f=0;f>1,c=-7,f=n?i-1:0,h=n?-1:1,p=e[t+f];for(f+=h,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+e[t+f],f+=h,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+e[t+f],f+=h,c-=8);if(0===o)o=1-l;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=l}return(p?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,u,l=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+f>=1?h/u:h*Math.pow(2,1-f),t*u>=2&&(s++,u/=2),s+f>=c?(a=0,s=c):s+f>=1?(a=(t*u-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;e[n+p]=255&s,p+=d,s/=256,l-=8);e[n+p-d]|=128*m}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(){var t=(0,i.default)(arguments),n=t.pop();e.call(this,t,n)}};var r=n(104),i=o(r);function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(8))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=n(292),i=a(r),o=n(42),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t,n,r){(0,i.default)(t)(e,(0,s.default)(n),r)}e.exports=t.default},function(e,t,n){(function(e){var r=n(99),i=n(757),o=t&&!t.nodeType&&t,s=o&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===o,u=a?r.Buffer:void 0,l=u?u.isBuffer:void 0,c=l||i;e.exports=c}).call(this,n(75)(e))},function(e,t){var n=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function i(e,t){var i=typeof e;return t=null==t?n:t,!!t&&("number"==i||"symbol"!=i&&r.test(e))&&e>-1&&e%1==0&&e0)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=c(t)),r)o.endEmitted?e.emit("error",new k):P(e,o,t,!0);else if(o.ended)e.emit("error",new w);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?P(e,o,t,!1):U(e,o)):P(e,o,t,!1)}else r||(o.reading=!1,U(e,o));return!o.ended&&(o.length=R?e=R:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function M(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=N(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function L(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?F(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,D(e)))}}function F(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(D,e))}function D(e){var t=e._readableState;p("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||e.emit("readable"),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,$(e)}function U(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(z,e,t))}function z(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function H(e){p("readable nexttick read 0"),e.read(0)}function V(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(W,e,t))}function W(e,t){p("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),$(e),t.flowing&&!t.reading&&e.read(0)}function $(e){var t=e._readableState;for(p("flow",t.flowing);t.flowing&&null!==e.read(););}function G(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function Y(e){var t=e._readableState;p("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(J,t,e))}function J(e,t){p("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function Z(e,t){for(var n=0,r=e.length;n=t.highWaterMark:t.length>0)||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Y(this):F(this),null;if(e=M(e,t),0===e&&t.ended)return 0===t.length&&Y(this),null;var r=t.needReadable,i;return p("need readable",r),(0===t.length||t.length-e0?G(e,t):null,null===i?(t.needReadable=!0,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Y(this)),null!==i&&this.emit("data",i),i},j.prototype._read=function(e){this.emit("error",new _("_read()"))},j.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,p("pipe count=%d opts=%j",i.pipesCount,t);var o=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=o?l:b;function u(e,t){p("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,h())}function l(){p("onend"),e.end()}i.endEmitted?r.nextTick(a):n.once("end",a),e.on("unpipe",u);var c=q(n);e.on("drain",c);var f=!1;function h(){p("cleanup"),e.removeListener("close",g),e.removeListener("finish",y),e.removeListener("drain",c),e.removeListener("error",m),e.removeListener("unpipe",u),n.removeListener("end",l),n.removeListener("end",b),n.removeListener("data",d),f=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||c()}function d(t){p("ondata");var r=e.write(t);p("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==Z(i.pipes,e))&&!f&&(p("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function m(t){p("onerror",t),b(),e.removeListener("error",m),0===s(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",y),b()}function y(){p("onfinish"),e.removeListener("close",g),b()}function b(){p("unpipe"),n.unpipe(e)}return n.on("data",d),I(e,"error",m),e.once("close",g),e.once("finish",y),e.emit("pipe",n),i.flowing||(p("pipe resume"),n.resume()),e},j.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,p("on readable",i.length,i.reading),i.length?F(this):i.reading||r.nextTick(H,this))),n},j.prototype.addListener=j.prototype.on,j.prototype.removeListener=function(e,t){var n=a.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(K,this),n},j.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(K,this),t},j.prototype.resume=function(){var e=this._readableState;return e.flowing||(p("resume"),e.flowing=!e.readableListening,V(this,e)),e.paused=!1,this},j.prototype.pause=function(){return p("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(p("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},j.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",function(){if(p("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){if(p("wrapped data"),n.decoder&&(i=n.decoder.write(i)),(!n.objectMode||null!==i&&void 0!==i)&&(n.objectMode||i&&i.length)){var o=t.push(i);o||(r=!0,e.pause())}}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function t(n){return function t(){return e[n].apply(e,arguments)}}(i));for(var o=0;o-1))throw new E(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(I.prototype,"writableBuffer",{enumerable:!1,get:function e(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(I.prototype,"writableHighWaterMark",{enumerable:!1,get:function e(){return this._writableState.highWaterMark}}),I.prototype._write=function(e,t,n){n(new b("_write()"))},I.prototype._writev=null,I.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||H(this,r,n),this},Object.defineProperty(I.prototype,"writableLength",{enumerable:!1,get:function e(){return this._writableState.length}}),Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function e(){return void 0!==this._writableState&&this._writableState.destroyed},set:function e(t){this._writableState&&(this._writableState.destroyed=t)}}),I.prototype.destroy=p.destroy,I.prototype._undestroy=p.undestroy,I.prototype._destroy=function(e,t){t(e)}}).call(this,n(8),n(2))},function(e,t,n){"use strict";e.exports=c;var r=n(135).codes,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,s=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,u=n(136);function l(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.lengththis._repo.blocks.get(e,t),t):t(new Error("first arg must be an array of cids"))}delete(e,t){this._repo.blocks.delete(e,t)}}e.exports=i},function(e,t,n){"use strict";t.names=Object.freeze({id:0,sha1:17,"sha2-256":18,"sha2-512":19,"dbl-sha2-256":86,"sha3-224":23,"sha3-256":22,"sha3-384":21,"sha3-512":20,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,"murmur3-128":34,"murmur3-32":35,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"Skein256-8":45825,"Skein256-16":45826,"Skein256-24":45827,"Skein256-32":45828,"Skein256-40":45829,"Skein256-48":45830,"Skein256-56":45831,"Skein256-64":45832,"Skein256-72":45833,"Skein256-80":45834,"Skein256-88":45835,"Skein256-96":45836,"Skein256-104":45837,"Skein256-112":45838,"Skein256-120":45839,"Skein256-128":45840,"Skein256-136":45841,"Skein256-144":45842,"Skein256-152":45843,"Skein256-160":45844,"Skein256-168":45845,"Skein256-176":45846,"Skein256-184":45847,"Skein256-192":45848,"Skein256-200":45849,"Skein256-208":45850,"Skein256-216":45851,"Skein256-224":45852,"Skein256-232":45853,"Skein256-240":45854,"Skein256-248":45855,"Skein256-256":45856,"Skein512-8":45857,"Skein512-16":45858,"Skein512-24":45859,"Skein512-32":45860,"Skein512-40":45861,"Skein512-48":45862,"Skein512-56":45863,"Skein512-64":45864,"Skein512-72":45865,"Skein512-80":45866,"Skein512-88":45867,"Skein512-96":45868,"Skein512-104":45869,"Skein512-112":45870,"Skein512-120":45871,"Skein512-128":45872,"Skein512-136":45873,"Skein512-144":45874,"Skein512-152":45875,"Skein512-160":45876,"Skein512-168":45877,"Skein512-176":45878,"Skein512-184":45879,"Skein512-192":45880,"Skein512-200":45881,"Skein512-208":45882,"Skein512-216":45883,"Skein512-224":45884,"Skein512-232":45885,"Skein512-240":45886,"Skein512-248":45887,"Skein512-256":45888,"Skein512-264":45889,"Skein512-272":45890,"Skein512-280":45891,"Skein512-288":45892,"Skein512-296":45893,"Skein512-304":45894,"Skein512-312":45895,"Skein512-320":45896,"Skein512-328":45897,"Skein512-336":45898,"Skein512-344":45899,"Skein512-352":45900,"Skein512-360":45901,"Skein512-368":45902,"Skein512-376":45903,"Skein512-384":45904,"Skein512-392":45905,"Skein512-400":45906,"Skein512-408":45907,"Skein512-416":45908,"Skein512-424":45909,"Skein512-432":45910,"Skein512-440":45911,"Skein512-448":45912,"Skein512-456":45913,"Skein512-464":45914,"Skein512-472":45915,"Skein512-480":45916,"Skein512-488":45917,"Skein512-496":45918,"Skein512-504":45919,"Skein512-512":45920,"Skein1024-8":45921,"Skein1024-16":45922,"Skein1024-24":45923,"Skein1024-32":45924,"Skein1024-40":45925,"Skein1024-48":45926,"Skein1024-56":45927,"Skein1024-64":45928,"Skein1024-72":45929,"Skein1024-80":45930,"Skein1024-88":45931,"Skein1024-96":45932,"Skein1024-104":45933,"Skein1024-112":45934,"Skein1024-120":45935,"Skein1024-128":45936,"Skein1024-136":45937,"Skein1024-144":45938,"Skein1024-152":45939,"Skein1024-160":45940,"Skein1024-168":45941,"Skein1024-176":45942,"Skein1024-184":45943,"Skein1024-192":45944,"Skein1024-200":45945,"Skein1024-208":45946,"Skein1024-216":45947,"Skein1024-224":45948,"Skein1024-232":45949,"Skein1024-240":45950,"Skein1024-248":45951,"Skein1024-256":45952,"Skein1024-264":45953,"Skein1024-272":45954,"Skein1024-280":45955,"Skein1024-288":45956,"Skein1024-296":45957,"Skein1024-304":45958,"Skein1024-312":45959,"Skein1024-320":45960,"Skein1024-328":45961,"Skein1024-336":45962,"Skein1024-344":45963,"Skein1024-352":45964,"Skein1024-360":45965,"Skein1024-368":45966,"Skein1024-376":45967,"Skein1024-384":45968,"Skein1024-392":45969,"Skein1024-400":45970,"Skein1024-408":45971,"Skein1024-416":45972,"Skein1024-424":45973,"Skein1024-432":45974,"Skein1024-440":45975,"Skein1024-448":45976,"Skein1024-456":45977,"Skein1024-464":45978,"Skein1024-472":45979,"Skein1024-480":45980,"Skein1024-488":45981,"Skein1024-496":45982,"Skein1024-504":45983,"Skein1024-512":45984,"Skein1024-520":45985,"Skein1024-528":45986,"Skein1024-536":45987,"Skein1024-544":45988,"Skein1024-552":45989,"Skein1024-560":45990,"Skein1024-568":45991,"Skein1024-576":45992,"Skein1024-584":45993,"Skein1024-592":45994,"Skein1024-600":45995,"Skein1024-608":45996,"Skein1024-616":45997,"Skein1024-624":45998,"Skein1024-632":45999,"Skein1024-640":46e3,"Skein1024-648":46001,"Skein1024-656":46002,"Skein1024-664":46003,"Skein1024-672":46004,"Skein1024-680":46005,"Skein1024-688":46006,"Skein1024-696":46007,"Skein1024-704":46008,"Skein1024-712":46009,"Skein1024-720":46010,"Skein1024-728":46011,"Skein1024-736":46012,"Skein1024-744":46013,"Skein1024-752":46014,"Skein1024-760":46015,"Skein1024-768":46016,"Skein1024-776":46017,"Skein1024-784":46018,"Skein1024-792":46019,"Skein1024-800":46020,"Skein1024-808":46021,"Skein1024-816":46022,"Skein1024-824":46023,"Skein1024-832":46024,"Skein1024-840":46025,"Skein1024-848":46026,"Skein1024-856":46027,"Skein1024-864":46028,"Skein1024-872":46029,"Skein1024-880":46030,"Skein1024-888":46031,"Skein1024-896":46032,"Skein1024-904":46033,"Skein1024-912":46034,"Skein1024-920":46035,"Skein1024-928":46036,"Skein1024-936":46037,"Skein1024-944":46038,"Skein1024-952":46039,"Skein1024-960":46040,"Skein1024-968":46041,"Skein1024-976":46042,"Skein1024-984":46043,"Skein1024-992":46044,"Skein1024-1000":46045,"Skein1024-1008":46046,"Skein1024-1016":46047,"Skein1024-1024":46048}),t.codes=Object.freeze({17:"sha1",18:"sha2-256",19:"sha2-512",86:"dbl-sha2-256",23:"sha3-224",22:"sha3-256",21:"sha3-384",20:"sha3-512",24:"shake-128",25:"shake-256",26:"keccak-224",27:"keccak-256",28:"keccak-384",29:"keccak-512",34:"murmur3-128",35:"murmur3-32",45569:"blake2b-8",45570:"blake2b-16",45571:"blake2b-24",45572:"blake2b-32",45573:"blake2b-40",45574:"blake2b-48",45575:"blake2b-56",45576:"blake2b-64",45577:"blake2b-72",45578:"blake2b-80",45579:"blake2b-88",45580:"blake2b-96",45581:"blake2b-104",45582:"blake2b-112",45583:"blake2b-120",45584:"blake2b-128",45585:"blake2b-136",45586:"blake2b-144",45587:"blake2b-152",45588:"blake2b-160",45589:"blake2b-168",45590:"blake2b-176",45591:"blake2b-184",45592:"blake2b-192",45593:"blake2b-200",45594:"blake2b-208",45595:"blake2b-216",45596:"blake2b-224",45597:"blake2b-232",45598:"blake2b-240",45599:"blake2b-248",45600:"blake2b-256",45601:"blake2b-264",45602:"blake2b-272",45603:"blake2b-280",45604:"blake2b-288",45605:"blake2b-296",45606:"blake2b-304",45607:"blake2b-312",45608:"blake2b-320",45609:"blake2b-328",45610:"blake2b-336",45611:"blake2b-344",45612:"blake2b-352",45613:"blake2b-360",45614:"blake2b-368",45615:"blake2b-376",45616:"blake2b-384",45617:"blake2b-392",45618:"blake2b-400",45619:"blake2b-408",45620:"blake2b-416",45621:"blake2b-424",45622:"blake2b-432",45623:"blake2b-440",45624:"blake2b-448",45625:"blake2b-456",45626:"blake2b-464",45627:"blake2b-472",45628:"blake2b-480",45629:"blake2b-488",45630:"blake2b-496",45631:"blake2b-504",45632:"blake2b-512",45633:"blake2s-8",45634:"blake2s-16",45635:"blake2s-24",45636:"blake2s-32",45637:"blake2s-40",45638:"blake2s-48",45639:"blake2s-56",45640:"blake2s-64",45641:"blake2s-72",45642:"blake2s-80",45643:"blake2s-88",45644:"blake2s-96",45645:"blake2s-104",45646:"blake2s-112",45647:"blake2s-120",45648:"blake2s-128",45649:"blake2s-136",45650:"blake2s-144",45651:"blake2s-152",45652:"blake2s-160",45653:"blake2s-168",45654:"blake2s-176",45655:"blake2s-184",45656:"blake2s-192",45657:"blake2s-200",45658:"blake2s-208",45659:"blake2s-216",45660:"blake2s-224",45661:"blake2s-232",45662:"blake2s-240",45663:"blake2s-248",45664:"blake2s-256",45825:"Skein256-8",45826:"Skein256-16",45827:"Skein256-24",45828:"Skein256-32",45829:"Skein256-40",45830:"Skein256-48",45831:"Skein256-56",45832:"Skein256-64",45833:"Skein256-72",45834:"Skein256-80",45835:"Skein256-88",45836:"Skein256-96",45837:"Skein256-104",45838:"Skein256-112",45839:"Skein256-120",45840:"Skein256-128",45841:"Skein256-136",45842:"Skein256-144",45843:"Skein256-152",45844:"Skein256-160",45845:"Skein256-168",45846:"Skein256-176",45847:"Skein256-184",45848:"Skein256-192",45849:"Skein256-200",45850:"Skein256-208",45851:"Skein256-216",45852:"Skein256-224",45853:"Skein256-232",45854:"Skein256-240",45855:"Skein256-248",45856:"Skein256-256",45857:"Skein512-8",45858:"Skein512-16",45859:"Skein512-24",45860:"Skein512-32",45861:"Skein512-40",45862:"Skein512-48",45863:"Skein512-56",45864:"Skein512-64",45865:"Skein512-72",45866:"Skein512-80",45867:"Skein512-88",45868:"Skein512-96",45869:"Skein512-104",45870:"Skein512-112",45871:"Skein512-120",45872:"Skein512-128",45873:"Skein512-136",45874:"Skein512-144",45875:"Skein512-152",45876:"Skein512-160",45877:"Skein512-168",45878:"Skein512-176",45879:"Skein512-184",45880:"Skein512-192",45881:"Skein512-200",45882:"Skein512-208",45883:"Skein512-216",45884:"Skein512-224",45885:"Skein512-232",45886:"Skein512-240",45887:"Skein512-248",45888:"Skein512-256",45889:"Skein512-264",45890:"Skein512-272",45891:"Skein512-280",45892:"Skein512-288",45893:"Skein512-296",45894:"Skein512-304",45895:"Skein512-312",45896:"Skein512-320",45897:"Skein512-328",45898:"Skein512-336",45899:"Skein512-344",45900:"Skein512-352",45901:"Skein512-360",45902:"Skein512-368",45903:"Skein512-376",45904:"Skein512-384",45905:"Skein512-392",45906:"Skein512-400",45907:"Skein512-408",45908:"Skein512-416",45909:"Skein512-424",45910:"Skein512-432",45911:"Skein512-440",45912:"Skein512-448",45913:"Skein512-456",45914:"Skein512-464",45915:"Skein512-472",45916:"Skein512-480",45917:"Skein512-488",45918:"Skein512-496",45919:"Skein512-504",45920:"Skein512-512",45921:"Skein1024-8",45922:"Skein1024-16",45923:"Skein1024-24",45924:"Skein1024-32",45925:"Skein1024-40",45926:"Skein1024-48",45927:"Skein1024-56",45928:"Skein1024-64",45929:"Skein1024-72",45930:"Skein1024-80",45931:"Skein1024-88",45932:"Skein1024-96",45933:"Skein1024-104",45934:"Skein1024-112",45935:"Skein1024-120",45936:"Skein1024-128",45937:"Skein1024-136",45938:"Skein1024-144",45939:"Skein1024-152",45940:"Skein1024-160",45941:"Skein1024-168",45942:"Skein1024-176",45943:"Skein1024-184",45944:"Skein1024-192",45945:"Skein1024-200",45946:"Skein1024-208",45947:"Skein1024-216",45948:"Skein1024-224",45949:"Skein1024-232",45950:"Skein1024-240",45951:"Skein1024-248",45952:"Skein1024-256",45953:"Skein1024-264",45954:"Skein1024-272",45955:"Skein1024-280",45956:"Skein1024-288",45957:"Skein1024-296",45958:"Skein1024-304",45959:"Skein1024-312",45960:"Skein1024-320",45961:"Skein1024-328",45962:"Skein1024-336",45963:"Skein1024-344",45964:"Skein1024-352",45965:"Skein1024-360",45966:"Skein1024-368",45967:"Skein1024-376",45968:"Skein1024-384",45969:"Skein1024-392",45970:"Skein1024-400",45971:"Skein1024-408",45972:"Skein1024-416",45973:"Skein1024-424",45974:"Skein1024-432",45975:"Skein1024-440",45976:"Skein1024-448",45977:"Skein1024-456",45978:"Skein1024-464",45979:"Skein1024-472",45980:"Skein1024-480",45981:"Skein1024-488",45982:"Skein1024-496",45983:"Skein1024-504",45984:"Skein1024-512",45985:"Skein1024-520",45986:"Skein1024-528",45987:"Skein1024-536",45988:"Skein1024-544",45989:"Skein1024-552",45990:"Skein1024-560",45991:"Skein1024-568",45992:"Skein1024-576",45993:"Skein1024-584",45994:"Skein1024-592",45995:"Skein1024-600",45996:"Skein1024-608",45997:"Skein1024-616",45998:"Skein1024-624",45999:"Skein1024-632",46000:"Skein1024-640",46001:"Skein1024-648",46002:"Skein1024-656",46003:"Skein1024-664",46004:"Skein1024-672",46005:"Skein1024-680",46006:"Skein1024-688",46007:"Skein1024-696",46008:"Skein1024-704",46009:"Skein1024-712",46010:"Skein1024-720",46011:"Skein1024-728",46012:"Skein1024-736",46013:"Skein1024-744",46014:"Skein1024-752",46015:"Skein1024-760",46016:"Skein1024-768",46017:"Skein1024-776",46018:"Skein1024-784",46019:"Skein1024-792",46020:"Skein1024-800",46021:"Skein1024-808",46022:"Skein1024-816",46023:"Skein1024-824",46024:"Skein1024-832",46025:"Skein1024-840",46026:"Skein1024-848",46027:"Skein1024-856",46028:"Skein1024-864",46029:"Skein1024-872",46030:"Skein1024-880",46031:"Skein1024-888",46032:"Skein1024-896",46033:"Skein1024-904",46034:"Skein1024-912",46035:"Skein1024-920",46036:"Skein1024-928",46037:"Skein1024-936",46038:"Skein1024-944",46039:"Skein1024-952",46040:"Skein1024-960",46041:"Skein1024-968",46042:"Skein1024-976",46043:"Skein1024-984",46044:"Skein1024-992",46045:"Skein1024-1000",46046:"Skein1024-1008",46047:"Skein1024-1016",46048:"Skein1024-1024"}),t.defaultLengths=Object.freeze({17:20,18:32,19:64,86:32,23:28,22:32,21:48,20:64,24:32,25:64,26:28,27:32,28:48,29:64,34:32,45569:1,45570:2,45571:3,45572:4,45573:5,45574:6,45575:7,45576:8,45577:9,45578:10,45579:11,45580:12,45581:13,45582:14,45583:15,45584:16,45585:17,45586:18,45587:19,45588:20,45589:21,45590:22,45591:23,45592:24,45593:25,45594:26,45595:27,45596:28,45597:29,45598:30,45599:31,45600:32,45601:33,45602:34,45603:35,45604:36,45605:37,45606:38,45607:39,45608:40,45609:41,45610:42,45611:43,45612:44,45613:45,45614:46,45615:47,45616:48,45617:49,45618:50,45619:51,45620:52,45621:53,45622:54,45623:55,45624:56,45625:57,45626:58,45627:59,45628:60,45629:61,45630:62,45631:63,45632:64,45633:1,45634:2,45635:3,45636:4,45637:5,45638:6,45639:7,45640:8,45641:9,45642:10,45643:11,45644:12,45645:13,45646:14,45647:15,45648:16,45649:17,45650:18,45651:19,45652:20,45653:21,45654:22,45655:23,45656:24,45657:25,45658:26,45659:27,45660:28,45661:29,45662:30,45663:31,45664:32,45825:1,45826:2,45827:3,45828:4,45829:5,45830:6,45831:7,45832:8,45833:9,45834:10,45835:11,45836:12,45837:13,45838:14,45839:15,45840:16,45841:17,45842:18,45843:19,45844:20,45845:21,45846:22,45847:23,45848:24,45849:25,45850:26,45851:27,45852:28,45853:29,45854:30,45855:31,45856:32,45857:1,45858:2,45859:3,45860:4,45861:5,45862:6,45863:7,45864:8,45865:9,45866:10,45867:11,45868:12,45869:13,45870:14,45871:15,45872:16,45873:17,45874:18,45875:19,45876:20,45877:21,45878:22,45879:23,45880:24,45881:25,45882:26,45883:27,45884:28,45885:29,45886:30,45887:31,45888:32,45889:33,45890:34,45891:35,45892:36,45893:37,45894:38,45895:39,45896:40,45897:41,45898:42,45899:43,45900:44,45901:45,45902:46,45903:47,45904:48,45905:49,45906:50,45907:51,45908:52,45909:53,45910:54,45911:55,45912:56,45913:57,45914:58,45915:59,45916:60,45917:61,45918:62,45919:63,45920:64,45921:1,45922:2,45923:3,45924:4,45925:5,45926:6,45927:7,45928:8,45929:9,45930:10,45931:11,45932:12,45933:13,45934:14,45935:15,45936:16,45937:17,45938:18,45939:19,45940:20,45941:21,45942:22,45943:23,45944:24,45945:25,45946:26,45947:27,45948:28,45949:29,45950:30,45951:31,45952:32,45953:33,45954:34,45955:35,45956:36,45957:37,45958:38,45959:39,45960:40,45961:41,45962:42,45963:43,45964:44,45965:45,45966:46,45967:47,45968:48,45969:49,45970:50,45971:51,45972:52,45973:53,45974:54,45975:55,45976:56,45977:57,45978:58,45979:59,45980:60,45981:61,45982:62,45983:63,45984:64,45985:65,45986:66,45987:67,45988:68,45989:69,45990:70,45991:71,45992:72,45993:73,45994:74,45995:75,45996:76,45997:77,45998:78,45999:79,46000:80,46001:81,46002:82,46003:83,46004:84,46005:85,46006:86,46007:87,46008:88,46009:89,46010:90,46011:91,46012:92,46013:93,46014:94,46015:95,46016:96,46017:97,46018:98,46019:99,46020:100,46021:101,46022:102,46023:103,46024:104,46025:105,46026:106,46027:107,46028:108,46029:109,46030:110,46031:111,46032:112,46033:113,46034:114,46035:115,46036:116,46037:117,46038:118,46039:119,46040:120,46041:121,46042:122,46043:123,46044:124,46045:125,46046:126,46047:127,46048:128})},function(e,t,n){"use strict";(function(t){const r=n(39);function i(e){return parseInt(e.toString("hex"),16)}function o(e){let n=e.toString(16);return n.length%2==1&&(n="0"+n),t.from(n,"hex")}function s(e){return t.from(r.encode(i(e)))}function a(e){return o(r.decode(e))}e.exports={numberToBuffer:o,bufferToNumber:i,varintBufferEncode:s,varintBufferDecode:a}}).call(this,n(0).Buffer)},function(e,t){e.exports=function e(t,n,r){t(n),r&&r(!0===n?null:n)}},function(e,t,n){"use strict";var r=n(177);e.exports=function e(t){return r(null,t)}},function(e,t,n){var r=n(178);function i(e){return e}e.exports=function e(t){return"object"==typeof t&&"function"==typeof t.test?function(e){return t.test(e)}:r(t)||i}},function(e,t,n){"use strict";function r(e){return e}var i=n(178),o=n(78);e.exports=function e(t,n){t=i(t)||r;var s={};return o(function(e){var r=t(e);return s[r]?!!n:(s[r]=!0,!n)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;var r=n(804),i=o(r);function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t,n){(0,i.default)(e,function(){return!t.apply(this,arguments)},n)}e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var r=n(68),i=f(r),o=n(172),s=f(o),a=n(104),u=f(a),l=n(42),c=f(l);function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t,n){n=n||i.default;var r=(0,s.default)(t)?[]:{};e(t,function(e,t,n){(0,c.default)(e)(function(e,i){arguments.length>2&&(i=(0,u.default)(arguments,1)),r[t]=i,n(e)})},function(e){n(e,r)})}e.exports=t.default},function(e,t,n){var r,i;r=this,e.exports=function(e,t,n,r,i){for(t=t.split?t.split("."):t,r=0;r1&&this._buf[this._buf.length-1]===a;)this._buf=this._buf.slice(0,-1)}less(e){const t=this.list(),n=e.list();for(let e=0;ei)return!1}return t.length>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);function i(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}e.exports=i},function(e,t,n){"use strict";const r=n(22);e.exports.dbOpenFailedError=(e=>(e=e||new Error("Cannot open database"),r(e,"ERR_DB_OPEN_FAILED"))),e.exports.dbDeleteFailedError=(e=>(e=e||new Error("Delete failed"),r(e,"ERR_DB_DELETE_FAILED"))),e.exports.dbWriteFailedError=(e=>(e=e||new Error("Write failed"),r(e,"ERR_DB_WRITE_FAILED"))),e.exports.notFoundError=(e=>(e=e||new Error("Not Found"),r(e,"ERR_NOT_FOUND")))},function(e,t,n){"use strict";var r=Object.prototype.toString;e.exports=function(e){var t;return"[object Object]"===r.call(e)&&(t=Object.getPrototypeOf(e),null===t||t===Object.getPrototypeOf({}))}},function(e,t,n){"use strict";const r=n(228),i=n(817),o=n(819),s=n(821),a=n(822),u=n(418);t.KeytransformDatastore=r,t.ShardingDatastore=i,t.MountDatastore=o,t.TieredDatastore=s,t.NamespaceDatastore=a,t.shard=u},function(e,t,n){"use strict";const r=n(33).Key,i=n(818),o=t.PREFIX="/repo/flatfs/shard/",s=t.SHARDING_FN="SHARDING";t.README_FN="_README";class a{constructor(e){this.param=e}fun(e){throw new Error("implement me")}toString(){return`${o}v1/${this.name}/${this.param}`}}class u extends a{constructor(e){super(e),this._padding="".padStart(e,"_"),this.name="prefix"}fun(e){return(e+this._padding).slice(0,this.param)}}class l extends a{constructor(e){super(e),this._padding="".padStart(e,"_"),this.name="suffix"}fun(e){const t=this._padding+e;return t.slice(t.length-this.param)}}class c extends a{constructor(e){super(e),this._padding="".padStart(e+1,"_"),this.name="next-to-last"}fun(e){const t=this._padding+e,n=t.length-this.param-1;return t.slice(n,n+this.param)}}function f(e){if(e=e.trim(),0===e.length)throw new Error("empty shard string");if(!e.startsWith(o))throw new Error(`invalid or no path prefix: ${e}`);const t=e.slice(o.length).split("/"),n=t[0];if("v1"!==n)throw new Error(`expect 'v1' version, got '${n}'`);const r=t[1];if(!t[2])throw new Error("missing param");const i=parseInt(t[2],10);switch(r){case"prefix":return new u(i);case"suffix":return new l(i);case"next-to-last":return new c(i);default:throw new Error(`unkown sharding function: ${r}`)}}t.readShardFun=((e,t,n)=>{const i=new r(e).child(new r(s)),o="function"==typeof t.getRaw?t.getRaw.bind(t):t.get.bind(t);o(i,(e,t)=>{if(e)return n(e);let r;try{r=f((t||"").toString().trim())}catch(e){return n(e)}n(null,r)})}),t.readme=i,t.parseShardFun=f,t.Prefix=u,t.Suffix=l,t.NextToLast=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(824),i=a(r),o=n(175),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default),e.exports=t.default},function(e,t){function n(e){return function(t){return null==t?void 0:t[e]}}e.exports=n},function(e,t,n){t.AbstractLevelDOWN=n(831),t.AbstractIterator=n(422),t.AbstractChainedBatch=n(423)},function(e,t,n){(function(t){function n(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._ended=!1,this._nexting=!1}n.prototype.next=function(e){var n=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return n._ended?(t.nextTick(e,new Error("cannot call next() after end()")),n):n._nexting?(t.nextTick(e,new Error("cannot call next() before previous next() has completed")),n):(n._nexting=!0,n._next(function(){n._nexting=!1,e.apply(null,arguments)}),n)},n.prototype._next=function(e){t.nextTick(e)},n.prototype.seek=function(e){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");e=this.db._serializeKey(e),this._seek(e)},n.prototype._seek=function(e){},n.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return t.nextTick(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},n.prototype._end=function(e){t.nextTick(e)},e.exports=n}).call(this,n(2))},function(e,t){function n(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._operations=[],this._written=!1}n.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},n.prototype.put=function(e,t){this._checkWritten();var n=this.db._checkKey(e)||this.db._checkValue(t);if(n)throw n;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t),this},n.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},n.prototype.del=function(e){this._checkWritten();var t=this.db._checkKey(e);if(t)throw t;return e=this.db._serializeKey(e),this._del(e),this},n.prototype._del=function(e){this._operations.push({type:"del",key:e})},n.prototype.clear=function(){return this._checkWritten(),this._clear(),this},n.prototype._clear=function(){this._operations=[]},n.prototype.write=function(e,t){if(this._checkWritten(),"function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("write() requires a callback argument");"object"==typeof e&&null!==e||(e={}),this._written=!0,this._write(e,t)},n.prototype._write=function(e,t){this.db._batch(this._operations,e,t)},e.exports=n},function(e,t){function n(){var e,t=new Promise(function(t,n){e=function e(r,i){r?n(r):t(i)}});return e.promise=t,e}e.exports=n},function(e,t,n){(function(t){function n(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._ended=!1,this._nexting=!1}n.prototype.next=function(e){var n=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return n._ended?(t.nextTick(e,new Error("cannot call next() after end()")),n):n._nexting?(t.nextTick(e,new Error("cannot call next() before previous next() has completed")),n):(n._nexting=!0,n._next(function(){n._nexting=!1,e.apply(null,arguments)}),n)},n.prototype._next=function(e){t.nextTick(e)},n.prototype.seek=function(e){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");e=this.db._serializeKey(e),this._seek(e)},n.prototype._seek=function(e){},n.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return t.nextTick(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},n.prototype._end=function(e){t.nextTick(e)},e.exports=n}).call(this,n(2))},function(e,t){function n(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._operations=[],this._written=!1}n.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},n.prototype.put=function(e,t){this._checkWritten();var n=this.db._checkKey(e)||this.db._checkValue(t);if(n)throw n;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t),this},n.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},n.prototype.del=function(e){this._checkWritten();var t=this.db._checkKey(e);if(t)throw t;return e=this.db._serializeKey(e),this._del(e),this},n.prototype._del=function(e){this._operations.push({type:"del",key:e})},n.prototype.clear=function(){return this._checkWritten(),this._clear(),this},n.prototype._clear=function(){this._operations=[]},n.prototype.write=function(e,t){if(this._checkWritten(),"function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("write() requires a callback argument");"object"==typeof e&&null!==e||(e={}),this._written=!0,this._write(e,t)},n.prototype._write=function(e,t){this.db._batch(this._operations,e,t)},e.exports=n},function(e,t,n){t.AbstractLevelDOWN=n(428),t.AbstractIterator=n(429),t.AbstractChainedBatch=n(430),t.isLevelDOWN=n(843)},function(e,t,n){(function(t,r){var i=n(69),o=n(429),s=n(430);function a(e){if(!arguments.length||void 0===e)throw new Error("constructor requires at least a location argument");if("string"!=typeof e)throw new Error("constructor requires a location string argument");this.location=e,this.status="new"}a.prototype.open=function(e,n){var r=this,i=this.status;if("function"==typeof e&&(n=e),"function"!=typeof n)throw new Error("open() requires a callback argument");"object"!=typeof e&&(e={}),e.createIfMissing=0!=e.createIfMissing,e.errorIfExists=!!e.errorIfExists,"function"==typeof this._open?(this.status="opening",this._open(e,function(e){if(e)return r.status=i,n(e);r.status="open",n()})):(this.status="open",t.nextTick(n))},a.prototype.close=function(e){var n=this,r=this.status;if("function"!=typeof e)throw new Error("close() requires a callback argument");"function"==typeof this._close?(this.status="closing",this._close(function(t){if(t)return n.status=r,e(t);n.status="closed",e()})):(this.status="closed",t.nextTick(e))},a.prototype.get=function(e,n,r){var i;if("function"==typeof n&&(r=n),"function"!=typeof r)throw new Error("get() requires a callback argument");return(i=this._checkKey(e,"key",this._isBuffer))?r(i):(this._isBuffer(e)||(e=String(e)),"object"!=typeof n&&(n={}),n.asBuffer=0!=n.asBuffer,"function"==typeof this._get?this._get(e,n,r):void t.nextTick(function(){r(new Error("NotFound"))}))},a.prototype.put=function(e,n,r,i){var o;if("function"==typeof r&&(i=r),"function"!=typeof i)throw new Error("put() requires a callback argument");return(o=this._checkKey(e,"key",this._isBuffer))?i(o):(this._isBuffer(e)||(e=String(e)),null==n||this._isBuffer(n)||t.browser||(n=String(n)),"object"!=typeof r&&(r={}),"function"==typeof this._put?this._put(e,n,r,i):void t.nextTick(i))},a.prototype.del=function(e,n,r){var i;if("function"==typeof n&&(r=n),"function"!=typeof r)throw new Error("del() requires a callback argument");return(i=this._checkKey(e,"key",this._isBuffer))?r(i):(this._isBuffer(e)||(e=String(e)),"object"!=typeof n&&(n={}),"function"==typeof this._del?this._del(e,n,r):void t.nextTick(r))},a.prototype.batch=function(e,n,r){if(!arguments.length)return this._chainedBatch();if("function"==typeof n&&(r=n),"function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return r(new Error("batch(array) requires an array argument"));n&&"object"==typeof n||(n={});for(var i=0,o=e.length,s,a;i0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:w;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),w(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),w()}function v(){g("onfinish"),e.removeListener("close",b),w()}function w(){g("unpipe"),n.unpipe(e)}return n.on("data",m),_(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o{const n=e+"/"+s;o("locking %s",n),a[n]=!0;const r={close(e){a[n]&&delete a[n],i(e)}};i(()=>{t(null,r)})}),t.locked=((e,t)=>{const n=e+"/"+s;o("checking lock: %s");const r=a[n];i(()=>{t(null,r)})})},function(e,t){e.exports=function(e){var t,n=!1;function r(r){if(!r)throw new Error("must be passed a readable");t=r,n&&e(t)}return r.resolve=r.ready=r.start=function(i){return n=!0,e=i||e,t&&e(t),r},r}},function(e,t,n){var r=n(226),i=n(436);e.exports=function(){var e=r(),t=i();return{source:e,sink:t,resolve:function(n){e.resolve(n.source),t.resolve(n.sink)}}}},function(e,t){var n=t.once=function(e){return function(t,n){if(t)return n(t);if(null!=e){var r=e;e=null,n(null,r)}else n(!0)}},r=t.depthFirst=function(e,t){var r=[],i;return r.unshift(n(e)),function e(n,o){return r.length?i?o(i):void r[0](n,function(n,s){if(n){if(!0!==n){for(i=n,r.shift();r.length;)r.shift()(n,function(){});return o(n)}return r.shift(),e(null,o)}r.unshift(t(s)),o(n,s)}):o(!0)}},i=t.widthFirst=function(e,t){var r=[];return r.push(n(e)),function e(n,i){if(!r.length)return i(!0);r[0](n,function(n,o){if(n)return r.shift(),e(null,i);r.push(t(o)),i(n,o)})}},o=t.leafFirst=function(e,t){var r=[],i=[];return r.push(n(e)),function e(n,o){r[0](n,function(n,s){if(n)return r.shift(),i.length?o(null,i.shift()):o(!0);r.unshift(t(s)),i.unshift(s),e(null,o)})}}},function(e,t,n){"use strict";const r=n(416),i=Object.prototype.hasOwnProperty,o=Object.propertyIsEnumerable,s=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}),a=this,u={concatArrays:!1},l=e=>{const t=[];for(const n in e)i.call(e,n)&&t.push(n);if(Object.getOwnPropertySymbols){const n=Object.getOwnPropertySymbols(e);for(let r=0;r{s(t,n,c(e[n]))}),t}function h(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return l(e).forEach(n=>{s(t,n,c(e[n]))}),t}const p=(e,t,n,r)=>(n.forEach(n=>{n in e&&e[n]!==Object.getPrototypeOf(e)?s(e,n,m(e[n],t[n],r)):s(e,n,c(t[n]))}),e),d=(e,t,n)=>{let r=e.slice(0,0),o=0;return[e,t].forEach(t=>{const a=[];for(let n=0;n-1===a.indexOf(e)),n)}),r};function m(e,t,n){return n.concatArrays&&Array.isArray(e)&&Array.isArray(t)?d(e,t,n):r(t)&&r(e)?p(e,t,l(t),n):c(t)}e.exports=function(){const e=m(c(u),this!==a&&this||{},u);let t={foobar:{}};for(let n=0;n(e=e.slice(1),new s(e))}});function h(e){let t;try{t=a(e)}catch(e){t=!1}if(t)throw new Error("The object passed has circular references");function n(e){if(!e||r.isBuffer(e)||"string"==typeof e)return e;if(Array.isArray(e))return e.map(n);if(s.isCID(e))return c(e);const t=Object.keys(e);if(1===t.length&&"/"===t[0])return c(e["/"]);if(t.length>0){const r={};return t.forEach(t=>{"object"==typeof e[t]?r[t]=n(e[t]):r[t]=e[t]}),r}return e}return n(e)}t=e.exports,t.serialize=((e,t)=>{let n;try{const r=h(e);n=i.encode(r)}catch(e){return setImmediate(()=>t(e))}setImmediate(()=>t(null,n))}),t.deserialize=((e,t)=>{let n;try{n=f.decodeFirst(e)}catch(e){return setImmediate(()=>t(e))}setImmediate(()=>t(null,n))}),t.cid=((e,n,r)=>{"function"==typeof n&&(r=n,n={}),n=n||{};const i=n.hashAlg||u.defaultHashAlg,a=n.hashLen,l=void 0===n.version?1:n.version;t.serialize(e,(e,t)=>{if(e)return r(e);o(t,i,a,(e,t)=>{if(e)return r(e);r(null,new s(l,u.multicodec,t))})})})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t,r){const i=n(387),o=n(62),s=n(861),a=n(305),u=n(232),l=n(442),c=n(443),{URL:f}=n(306);class h{constructor(e){e=e||{},!e.size||e.size<65536?e.size=65536:e.size=a.nextPowerOf2(e.size),this._heap=new ArrayBuffer(e.size),this._heap8=new Uint8Array(this._heap),this._buffer=t.from(this._heap),this._reset(),this._knownTags=Object.assign({0:e=>new Date(e),1:e=>new Date(1e3*e),2:e=>a.arrayBufferToBignumber(e),3:e=>u.NEG_ONE.minus(a.arrayBufferToBignumber(e)),4:e=>u.TEN.pow(e[0]).times(e[1]),5:e=>u.TWO.pow(e[0]).times(e[1]),32:e=>new f(e),35:e=>new RegExp(e)},e.tags),this.parser=s(r,{log:console.log.bind(console),pushInt:this.pushInt.bind(this),pushInt32:this.pushInt32.bind(this),pushInt32Neg:this.pushInt32Neg.bind(this),pushInt64:this.pushInt64.bind(this),pushInt64Neg:this.pushInt64Neg.bind(this),pushFloat:this.pushFloat.bind(this),pushFloatSingle:this.pushFloatSingle.bind(this),pushFloatDouble:this.pushFloatDouble.bind(this),pushTrue:this.pushTrue.bind(this),pushFalse:this.pushFalse.bind(this),pushUndefined:this.pushUndefined.bind(this),pushNull:this.pushNull.bind(this),pushInfinity:this.pushInfinity.bind(this),pushInfinityNeg:this.pushInfinityNeg.bind(this),pushNaN:this.pushNaN.bind(this),pushNaNNeg:this.pushNaNNeg.bind(this),pushArrayStart:this.pushArrayStart.bind(this),pushArrayStartFixed:this.pushArrayStartFixed.bind(this),pushArrayStartFixed32:this.pushArrayStartFixed32.bind(this),pushArrayStartFixed64:this.pushArrayStartFixed64.bind(this),pushObjectStart:this.pushObjectStart.bind(this),pushObjectStartFixed:this.pushObjectStartFixed.bind(this),pushObjectStartFixed32:this.pushObjectStartFixed32.bind(this),pushObjectStartFixed64:this.pushObjectStartFixed64.bind(this),pushByteString:this.pushByteString.bind(this),pushByteStringStart:this.pushByteStringStart.bind(this),pushUtf8String:this.pushUtf8String.bind(this),pushUtf8StringStart:this.pushUtf8StringStart.bind(this),pushSimpleUnassigned:this.pushSimpleUnassigned.bind(this),pushTagUnassigned:this.pushTagUnassigned.bind(this),pushTagStart:this.pushTagStart.bind(this),pushTagStart4:this.pushTagStart4.bind(this),pushTagStart8:this.pushTagStart8.bind(this),pushBreak:this.pushBreak.bind(this)},this._heap)}get _depth(){return this._parents.length}get _currentParent(){return this._parents[this._depth-1]}get _ref(){return this._currentParent.ref}_closeParent(){var e=this._parents.pop();if(e.length>0)throw new Error(`Missing ${e.length} elements`);switch(e.type){case u.PARENT.TAG:this._push(this.createTag(e.ref[0],e.ref[1]));break;case u.PARENT.BYTE_STRING:this._push(this.createByteString(e.ref,e.length));break;case u.PARENT.UTF8_STRING:this._push(this.createUtf8String(e.ref,e.length));break;case u.PARENT.MAP:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createMap(e.ref,e.length));break;case u.PARENT.OBJECT:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createObject(e.ref,e.length));break;case u.PARENT.ARRAY:this._push(this.createArray(e.ref,e.length))}this._currentParent&&this._currentParent.type===u.PARENT.TAG&&this._dec()}_dec(){const e=this._currentParent;e.length<0||(e.length--,0===e.length&&this._closeParent())}_push(e,t){const n=this._currentParent;switch(n.values++,n.type){case u.PARENT.ARRAY:case u.PARENT.BYTE_STRING:case u.PARENT.UTF8_STRING:n.length>-1?this._ref[this._ref.length-n.length]=e:this._ref.push(e),this._dec();break;case u.PARENT.OBJECT:null!=n.tmpKey?(this._ref[n.tmpKey]=e,n.tmpKey=null,this._dec()):(n.tmpKey=e,"string"!=typeof n.tmpKey&&(n.type=u.PARENT.MAP,n.ref=a.buildMap(n.ref)));break;case u.PARENT.MAP:null!=n.tmpKey?(this._ref.set(n.tmpKey,e),n.tmpKey=null,this._dec()):n.tmpKey=e;break;case u.PARENT.TAG:this._ref.push(e),t||this._dec();break;default:throw new Error("Unknown parent type")}}_createParent(e,t,n){this._parents[this._depth]={type:t,length:n,ref:e,values:0,tmpKey:null}}_reset(){this._res=[],this._parents=[{type:u.PARENT.ARRAY,length:-1,ref:this._res,values:0,tmpKey:null}]}createTag(e,t){const n=this._knownTags[e];return n?n(t):new c(e,t)}createMap(e,t){return e}createObject(e,t){return e}createArray(e,t){return e}createByteString(e,n){return t.concat(e)}createByteStringFromHeap(e,n){return e===n?t.alloc(0):t.from(this._heap.slice(e,n))}createInt(e){return e}createInt32(e,t){return a.buildInt32(e,t)}createInt64(e,t,n,r){return a.buildInt64(e,t,n,r)}createFloat(e){return e}createFloatSingle(e,t,n,r){return i.read([e,t,n,r],0,!1,23,4)}createFloatDouble(e,t,n,r,o,s,a,u){return i.read([e,t,n,r,o,s,a,u],0,!1,52,8)}createInt32Neg(e,t){return-1-a.buildInt32(e,t)}createInt64Neg(e,t,n,r){const i=a.buildInt32(e,t),s=a.buildInt32(n,r);return i>u.MAX_SAFE_HIGH?u.NEG_ONE.minus(new o(i).times(u.SHIFT32).plus(s)):-1-(i*u.SHIFT32+s)}createTrue(){return!0}createFalse(){return!1}createNull(){return null}createUndefined(){}createInfinity(){return 1/0}createInfinityNeg(){return-1/0}createNaN(){return NaN}createNaNNeg(){return NaN}createUtf8String(e,t){return e.join("")}createUtf8StringFromHeap(e,t){return e===t?"":this._buffer.toString("utf8",e,t)}createSimpleUnassigned(e){return new l(e)}pushInt(e){this._push(this.createInt(e))}pushInt32(e,t){this._push(this.createInt32(e,t))}pushInt64(e,t,n,r){this._push(this.createInt64(e,t,n,r))}pushFloat(e){this._push(this.createFloat(e))}pushFloatSingle(e,t,n,r){this._push(this.createFloatSingle(e,t,n,r))}pushFloatDouble(e,t,n,r,i,o,s,a){this._push(this.createFloatDouble(e,t,n,r,i,o,s,a))}pushInt32Neg(e,t){this._push(this.createInt32Neg(e,t))}pushInt64Neg(e,t,n,r){this._push(this.createInt64Neg(e,t,n,r))}pushTrue(){this._push(this.createTrue())}pushFalse(){this._push(this.createFalse())}pushNull(){this._push(this.createNull())}pushUndefined(){this._push(this.createUndefined())}pushInfinity(){this._push(this.createInfinity())}pushInfinityNeg(){this._push(this.createInfinityNeg())}pushNaN(){this._push(this.createNaN())}pushNaNNeg(){this._push(this.createNaNNeg())}pushArrayStart(){this._createParent([],u.PARENT.ARRAY,-1)}pushArrayStartFixed(e){this._createArrayStartFixed(e)}pushArrayStartFixed32(e,t){const n=a.buildInt32(e,t);this._createArrayStartFixed(n)}pushArrayStartFixed64(e,t,n,r){const i=a.buildInt64(e,t,n,r);this._createArrayStartFixed(i)}pushObjectStart(){this._createObjectStartFixed(-1)}pushObjectStartFixed(e){this._createObjectStartFixed(e)}pushObjectStartFixed32(e,t){const n=a.buildInt32(e,t);this._createObjectStartFixed(n)}pushObjectStartFixed64(e,t,n,r){const i=a.buildInt64(e,t,n,r);this._createObjectStartFixed(i)}pushByteStringStart(){this._parents[this._depth]={type:u.PARENT.BYTE_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushByteString(e,t){this._push(this.createByteStringFromHeap(e,t))}pushUtf8StringStart(){this._parents[this._depth]={type:u.PARENT.UTF8_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushUtf8String(e,t){this._push(this.createUtf8StringFromHeap(e,t))}pushSimpleUnassigned(e){this._push(this.createSimpleUnassigned(e))}pushTagStart(e){this._parents[this._depth]={type:u.PARENT.TAG,length:1,ref:[e]}}pushTagStart4(e,t){this.pushTagStart(a.buildInt32(e,t))}pushTagStart8(e,t,n,r){this.pushTagStart(a.buildInt64(e,t,n,r))}pushTagUnassigned(e){this._push(this.createTag(e))}pushBreak(){if(this._currentParent.length>-1)throw new Error("Unexpected break");this._closeParent()}_createObjectStartFixed(e){0!==e?this._createParent({},u.PARENT.OBJECT,e):this._push(this.createObject({}))}_createArrayStartFixed(e){0!==e?this._createParent(new Array(e),u.PARENT.ARRAY,e):this._push(this.createArray([]))}_decode(e){if(0===e.byteLength)throw new Error("Input too short");this._reset(),this._heap8.set(e);const t=this.parser.parse(e.byteLength);if(this._depth>1){for(;0===this._currentParent.length;)this._closeParent();if(this._depth>1)throw new Error("Undeterminated nesting")}if(t>0)throw new Error("Failed to parse");if(0===this._res.length)throw new Error("No valid result")}decodeFirst(e){return this._decode(e),this._res[0]}decodeAll(e){return this._decode(e),this._res}static decode(e,n){"string"==typeof e&&(e=t.from(e,n||"hex"));const r=new h({size:e.length});return r.decodeFirst(e)}static decodeAll(e,n){"string"==typeof e&&(e=t.from(e,n||"hex"));const r=new h({size:e.length});return r.decodeAll(e)}}h.decodeFirst=h.decode,e.exports=h}).call(this,n(0).Buffer,n(8))},function(e,t,n){"use strict";const r=n(232),i=r.MT,o=r.SIMPLE,s=r.SYMS;class a{constructor(e){if("number"!=typeof e)throw new Error("Invalid Simple type: "+typeof e);if(e<0||e>255||(0|e)!==e)throw new Error("value must be a small positive integer: "+e);this.value=e}toString(){return"simple("+this.value+")"}inspect(){return"simple("+this.value+")"}encodeCBOR(e){return e._pushInt(this.value,i.SIMPLE_FLOAT)}static isSimple(e){return e instanceof a}static decode(e,t){switch(null==t&&(t=!0),e){case o.FALSE:return!1;case o.TRUE:return!0;case o.NULL:return t?null:s.NULL;case o.UNDEFINED:return t?void 0:s.UNDEFINED;case-1:if(!t)throw new Error("Invalid BREAK");return s.BREAK;default:return new a(e)}}}e.exports=a},function(e,t,n){"use strict";class r{constructor(e,t,n){if(this.tag=e,this.value=t,this.err=n,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(e){return e._pushTag(this.tag),e.pushAny(this.value)}convert(e){var t,n;if(n=null!=e?e[this.tag]:void 0,"function"!=typeof n&&(n=r["_tag"+this.tag],"function"!=typeof n))return this;try{return n.call(r,this.value)}catch(e){return t=e,this.err=t,this}}}e.exports=r},function(e,t,n){"use strict";const r=self.location?self.location.protocol+"//"+self.location.host:"",i=self.URL;class o{constructor(e,t=r){this.super=new i(e,t),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set origin(e){this.super.origin=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set searchParams(e){this.super.searchParams=e}set username(e){this.super.username=e}createObjectURL(e){return this.super.createObjectURL(e)}revokeObjectURL(e){this.super.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}}function s(e){if("string"==typeof e){const t=new i(e);return t.toString()}if(!(e instanceof i)){const t=e.username&&e.password?`${e.username}:${e.password}@`:"",n=e.auth?e.auth+"@":"",r=e.port?":"+e.port:"",i=e.protocol?e.protocol+"//":"",o=e.host||"",s=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),u=e.hash||"",l=e.pathname||"",c=e.path||l+a;return`${i}${t||n}${o||s+r}${c}${u}`}}e.exports={URLWithLegacySupport:o,URLSearchParams:self.URLSearchParams,defaultBase:r,format:s}},function(e,t,n){(function(r,i){var o; /** * [js-sha3]{@link https://github.com/emn178/js-sha3} * @@ -314,7 +314,7 @@ function r(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - */function r(e,t){if(t===e)return!0;var n=e.indexOf(t);if(0===n){if("/"===t.substr(-1))return!0;if("/"===e.substr(t.length,1))return!0}return!1}t.pathMatch=r},function(e,t,n){!function(){function t(){var e=function(t,n,r){if(t=""+t,r||s===n||(e.last=t=e.batch)return l.thrash();l.batch.to||(l.batch.to=setTimeout(l.thrash,e.until||1))},c,f,h,p,d;l.batch=s(),l.batch.acks=[],l.batch.ed=0,l.thrash=function(){var t=l.thrash;if(t.ing)return t.more=!0;t.more=!1,t.ing=!0;var n=t.at=l.batch,r=0;clearTimeout(l.batch.to),l.batch=null,l.batch=s(),l.batch.acks=[],l.batch.ed=0,l.save(n,function(i,o){++r>1?e.log("RAD ERR: Radisk has callbacked multiple times, please report this as a BUG at github.com/amark/gun/issues ! "+r):(i&&e.log("err",i),a(n.acks,function(e){e(i,o)}),t.at=null,t.ing=!1,t.more&&t())})},l.save=function(t,n){var r=function e(){};r.find=function(e,t){if(!(tr.start)return r.mix(r.file||e.code.from,r.start,r.end=t),!0;r.file=t},r.mix=function(e,i,o){r.start=r.end=r.file=y,l.parse(e,function(a,u){if(a)return n(a);u=u||s(),s.map(t,function(e,t){if(!(ti))return(r.next||r.reverse)&&(s.file=e),(i=c[s.file])?(i.push({key:t,ack:n,file:s.file,opt:r}),!0):(c[s.file]=[{key:t,ack:n,file:s.file,opt:r}],s.file?(l.parse(s.file,s.it),!0):(s.it(null,y,{}),!0));s.file=e},s.it=function(t,n,r){(s.err=t)&&e.log("err",t),s.info=r,n&&(g=s.disk=n),n=c[s.file],delete c[s.file],a(n,s.ack)},s.ack=function(e){if(e.ack){var t=e.key,n=e.opt,r=s.info,i=s.disk||m,o=l.range(i(t),n),a=i.last;if(n.parsed=(n.parsed||0)+(r.parsed||0),n.chunks=(n.chunks||0)+1,n.some||(n.some=y!==o),y!==o)e.ack(s.err,o,n);else if(!e.file)return void(!n.some&&e.ack(s.err,y,n));if(!n.span){if(/*!last || */a===t)return void(!n.some&&e.ack(s.err,y,n));if(a&&a>t&&0!=a.indexOf(t))return void(!n.some&&e.ack(s.err,y,n))}n.some&&n.parsed>=n.limit||(n.next=e.file,l.read(t,e.ack,n))}},r.reverse&&(s.lex.reverse=!0),l.list(s.lex)},function(){var n={},i=String.fromCharCode(31);l.parse=function(o,u,l){var c;if(c=n[o])return c.push(u);c=n[o]=[u];var f=function e(){},h={};if(f.disk=s(),f.read=function(t,r){var i,s,s;if(delete n[o],(f.err=t)||(f.not=!r))return a(c,f.ack);if("string"!=typeof r){try{e.pack<=r.length?f.err="Chunk too big!":r=r.toString()}catch(e){f.err=e}if(f.err)return a(c,f.ack)}if(h.parsed=r.length,e.jsonify){try{var u=JSON.parse(r);return f.disk.$=u,void a(c,f.ack)}catch(e){i=e}if("{"===r[0])return f.err=i||"JSON error!",a(c,f.ack)}var i=f.split(r),l=[],p,d,m;if(!i||0!==i[1])return f.err="File '"+o+"' does not have root radix! ",a(c,f.ack);for(;i;)d=m=y,p=i[1],i=f.split(i[2])||"","#"==i[0]&&(d=i[1],l=l.slice(0,p),p<=l.length&&l.push(d)),i=f.split(i[2])||"","\n"!=i[0]&&("="!=i[0]&&":"!=i[0]||(m=i[1]),y!==d&&y!==m&&f.disk(l.join(""),m),i=f.split(i[2]));a(c,f.ack)},f.split=function(e){if(e){var n=[],r={},o=-1,s="",a,u;if(o=e.indexOf(i),e[o])return s=e.slice(0,o),n[0]=s,n[1]=a=t.decode(e.slice(o),r),n[2]=e.slice(o+r.i),n}},f.ack=function(e){if(e)return f.err||f.not?e(f.err,y,h):void e(y,f.disk,h)},l)return f.read(null,l);e.store.get(r(o),f.read)}}(),p=String.fromCharCode(28),d=r(p),l.list=function(e){if(f){var t={reverse:e.reverse?1:0};s.map(f,function(t,n){return e(n)},t)||e()}else{if(h)return h.push(e);h=[e],l.parse(p,l.list.init)}},l.list.add=function(e,t){var n=f(e);if(n||e===d)return t(y,1);f(e,!0),t.listed=(t.listed||0)+1,l.write(p,f,function(e,n){if(e)return t(e);t.listed=(t.listed||0)-1,0===t.listed&&t(y,1)},!0)},l.list.init=function(t,n){if(t)return e.log("list",t),void setTimeout(function(){l.parse(p,l.list.init)},1e3);n?l.list.drain(n):e.store.list?e.store.list(function(e){if(f=f||s(),!e)return l.list.drain(f);l.list.add(e,m)}):l.list.drain(s())},l.list.drain=function(e,t){l.list.dir=f=e,t=h,h=null,o.list.map(t,function(e){l.list(e)})};var m=function(){},g,y;return t.has[e.file]=l,l}var r,i;if(r=String.fromCharCode(31),t.encode=function(e,t,n){n=n||r;var i=n,s;if("string"==typeof e){for(var a=e.indexOf(n);-1!=a;)i+=n,a=e.indexOf(n,a+1);return i+'"'+e+n}return e&&e["#"]&&(s=o.val.link.is(e))?i+"#"+s+i:o.num.is(e)?i+"+"+(e||0)+i:null===e?i+" "+i:!0===e?i+"+"+i:!1===e?i+"-"+i:void 0},t.decode=function(e,t,n){n=n||r;var i="",s=-1,a=0,u,l;if(n===e[0]){for(;n===e[++s];)++a;for(l=e[u=a]||!0;--a>=0;)s=e.indexOf(n,s+1);return-1==s&&(s=e.length),i=e.slice(u+1,s),t&&(t.i=s+1),'"'===l?i:"#"===l?o.val.link.ify(i):"+"===l?0===i.length||parseFloat(i):" "===l?null:"-"!==l&&void 0}},"undefined"!=typeof window){var o=window.Gun,s=window.Radix;window.Radisk=t}else{var o=n(168),s=n(735);try{e.exports=t}catch(e){}}t.Radix=s}()},function(e,t,n){const r=n(115);n(765),n(773),n(1688),n(1723),n(1831),n(1984),"undefined"!=typeof window&&(window.DwebTransports=r),t=e.exports=r},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var l=e.length;u>0&&l>u&&(l=u);for(var c=0;c=0?(p=f.substr(0,h),d=f.substr(h+1)):(p=f,d=""),m=decodeURIComponent(p),g=decodeURIComponent(d),r(s,m)?i(s[m])?s[m].push(g):s[m]=[s[m],g]:s[m]=g}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),function(s){var a=encodeURIComponent(r(s))+n;return i(e[s])?o(e[s],function(e){return a+encodeURIComponent(r(e))}).join(t):a+encodeURIComponent(r(e[s]))}).join(t):a?encodeURIComponent(r(a))+n+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r{if("%%"===n)return n;a++;const o=r.formatters[i];if("function"==typeof o){const r=e[a];n=o.call(t,r),e.splice(a,1),a--}return n}),r.formatArgs.call(t,e);const u=t.log||r.log;u.apply(t,e)}return s.namespace=e,s.enabled=r.enabled(e),s.useColors=r.useColors(),s.color=t(e),s.destroy=i,s.extend=o,"function"==typeof r.init&&r.init(s),r.instances.push(s),s}function i(){const e=r.instances.indexOf(this);return-1!==e&&(r.instances.splice(e,1),!0)}function o(e,t){const n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function s(e){let t;r.save(e),r.names=[],r.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(t=0;t"-"+e)].join(",");return r.enable(""),e}function u(e){if("*"===e[e.length-1])return!0;let t,n;for(t=0,n=r.skips.length;t{r[t]=e[t]}),r.instances=[],r.names=[],r.skips=[],r.formatters={},r.selectColor=t,r.enable(r.load()),r}e.exports=r},function(e,t,n){"use strict";t.byteLength=c,t.toByteArray=h,t.fromByteArray=m;for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");-1===n&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=l(e),n=t[0],r=t[1];return 3*(n+r)/4-r}function f(e,t,n){return 3*(t+n)/4-n}function h(e){for(var t,n=l(e),r=n[0],s=n[1],a=new o(f(e,r,s)),u=0,c=s>0?r-4:r,h=0;h>16&255,a[u++]=t>>8&255,a[u++]=255&t;return 2===s&&(t=i[e.charCodeAt(h)]<<2|i[e.charCodeAt(h+1)]>>4,a[u++]=255&t),1===s&&(t=i[e.charCodeAt(h)]<<10|i[e.charCodeAt(h+1)]<<4|i[e.charCodeAt(h+2)]>>2,a[u++]=t>>8&255,a[u++]=255&t),a}function p(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function d(e,t,n){for(var r,i=[],o=t;ou?u:a+16383));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=b;var r=n(745),i=y(r),o=n(67),s=y(o),a=n(68),u=y(a),l=n(131),c=y(l),f=n(215),h=y(f),p=n(749),d=y(p),m=n(42),g=y(m);function y(e){return e&&e.__esModule?e:{default:e}}function b(e,t,n){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var r=(0,g.default)(e),o=0,a=[],l=!1;function f(e,t,n){if(null!=n&&"function"!=typeof n)throw new Error("task callback must be a function");if(y.started=!0,(0,s.default)(e)||(e=[e]),0===e.length&&y.idle())return(0,h.default)(function(){y.drain()});for(var r=0,i=e.length;r0&&a.splice(u,1),s.callback.apply(s,arguments),null!=t&&y.error(t,s.data)}o<=y.concurrency-y.buffer&&y.unsaturated(),y.idle()&&y.drain(),y.process()}}var m=!1,y={_tasks:new d.default,concurrency:t,payload:n,saturated:u.default,unsaturated:u.default,buffer:t/4,empty:u.default,drain:u.default,error:u.default,started:!1,paused:!1,push:function(e,t){f(e,!1,t)},kill:function(){y.drain=u.default,y._tasks.empty()},unshift:function(e,t){f(e,!0,t)},remove:function(e){y._tasks.remove(e)},process:function(){if(!m){for(m=!0;!y.paused&&o{this.status=r.STATUS_STARTING,e&&e(this),this.updateStatus((n,r)=>{e&&e(this),this.startHeartbeat(this.options.heartbeat),t(this)})})}async p_status(e){if(!e)return new Promise((e,t)=>{try{this.updateStatus((n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{this.updateStatus(e)}catch(t){e(t)}}updateStatus(e){this.updateInfo((t,n)=>{t?(u("Error status call to info failed %s",t.message),this.status=r.STATUS_FAILED,e(null,this.status)):(this.info=n,this.status=r.STATUS_CONNECTED,e(null,this.status))})}startHeartbeat({delay:e,statusCB:t}){e&&(this.heartbeatTimer=setInterval(()=>{this.updateStatus((e,n)=>{t&&t(this)},(e,t)=>{})},e))}stopHeartbeat(){this.heartbeatTimer&&clearInterval(this.hearbeatTimer)}stop(e,t){this.stopHeartbeat(),this.status=r.STATUS_FAILED,e&&e(this),t(null,this)}_cmdurl(e){return`${this.urlbase}/${e}`}_url(e,t,n){if(!e)throw new errors.CodingError(`${t}: requires url`);return"string"!=typeof e&&(e=e.href),e=e.replace("contenthash:/contenthash",this._cmdurl(t)),e=e.replace("getall/table",t),e+=n?"?"+n:"",e}validFor(e,t,n){return(this.connected()||e.protocol.startsWith("http")&&!e.href.startsWith(this.urlbase))&&this.supports(e,t,n)}async p_rawfetch(e,t={}){if(("string"==typeof e?e:e.href).includes("/getall/table"))throw new Error("Probably dont want to be calling p_rawfetch on a KeyValueTable, especially since dont know if its keyvaluetable or subclass");return await o.p_GET(this._url(e,servercommands.rawfetch),t)}p_rawlist(e){if(!e)throw new errors.CodingError("TransportHTTP.p_rawlist: requires url");return o.p_GET(this._url(e,servercommands.rawlist))}rawreverse(){throw new errors.ToBeImplementedError("Undefined function TransportHTTP.rawreverse")}async p_rawstore(e){console.assert(e,"TransportHttp.p_rawstore: requires data");const t=await o.p_POST(this._cmdurl(servercommands.rawstore),{data:e,contenttype:"application/octet-stream"});let n=s.parse(t),r=n.pathname.split("/");return`contenthash:/contenthash/${r.slice(-1)}`}p_rawadd(e,t){if(!e||!t)throw new errors.CodingError("TransportHTTP.p_rawadd: invalid parms",e,t);const n=l(t.preflight(Object.assign({},t)))+"\n";return o.p_POST(this._url(e,servercommands.rawadd),{data:n,contenttype:"application/json"})}p_newlisturls(e){let t=e._publicurls.map(e=>s.parse(e)).find(e=>"https:"===e.protocol&&["gateway.dweb.me","dweb.me"].includes(e.host)&&(e.pathname.includes("/content/rawfetch")||e.pathname.includes("/contenthash/"))||"contenthash:"===e.protocol&&"contenthash"===e.pathname.split("/")[1]);return t||(t=`contenthash:/contenthash/${e.keypair.verifyexportmultihashsha256_58()}`),[t,t]}async p_f_createReadStream(e,{wanturl:t=!1}={}){try{let n=this;return t?e:function(t){return n.createReadStream(e,t)}}catch(e){throw e}}createReadStream(e,t){let n;return u("createreadstream %s %o",s.parse(e).href,t),n=new a.PassThrough,o.p_GET(this._url(e,servercommands.rawfetch),Object.assign({wantstream:!0},t)).then(e=>e.pipe(n)).catch(e=>{console.warn(this.name,"createReadStream caught error",e.message),"function"==typeof n.destroy?n.destroy(e):n.emit("error",e)}),n}async p_createReadStream(e,t){u("createreadstream %s %o",s.parse(e).href,t);try{return await o.p_GET(this._url(e,servercommands.rawfetch),Object.assign({wantstream:!0},t))}catch(e){throw console.warn(this.name,"caught error",e),e}}async p_newdatabase(e){e.hasOwnProperty("keypair")&&(e=e.keypair.signingexport());let t=`${this.urlbase}/getall/table/${encodeURIComponent(e)}`;return{publicurl:t,privateurl:t}}async p_newtable(e,t){if(!e)throw new errors.CodingError("p_newtable currently requires a pubkey");let n=await this.p_newdatabase(e);return{privateurl:`${n.privateurl}/${t}`,publicurl:`${n.publicurl}/${t}`}}async p_set(e,t,n){if(!e||!t)throw new errors.CodingError("TransportHTTP.p_set: invalid parms",e,keyvalyes);if("string"==typeof t){let r=l([{key:t,value:n}]);await o.p_POST(this._url(e,servercommands.set),{data:r,contenttype:"application/json"})}else{let n=l(Object.keys(t).map(e=>({key:e,value:t[e]})));await o.p_POST(this._url(e,servercommands.set),{data:n,contenttype:"application/json"})}}_keyparm(e){return`key=${encodeURIComponent(e)}`}async p_get(e,t){if(!e&&t)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");let n=Array.isArray(t)?t.map(e=>this._keyparm(e)).join("&"):this._keyparm(t);const r=await o.p_GET(this._url(e,servercommands.get,n));return Array.isArray(t)?r:r[t]}async p_delete(e,t){if(!e&&t)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");let n=t.map(e=>this._keyparm(e)).join("&");await o.p_GET(this._url(e,servercommands.delete,n))}async p_keys(e){if(!e&&keys)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");return await o.p_GET(this._url(e,servercommands.keys))}async p_getall(e){if(!e&&keys)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");return await o.p_GET(this._url(e,servercommands.getall))}async p_info(){return new Promise((e,t)=>{try{this.updateInfo((n,r)=>{n?t(n):e(r)})}catch(e){t(e)}})}updateInfo(e){o.p_GET(`${this.urlbase}/info`,{retries:1},e)}static async p_test(e={}){console.log("TransportHTTP.test");try{let t=await this.p_setup(e);console.log("HTTP connected");let n=await t.p_info();console.log("TransportHTTP info=",n),n=await t.p_status(),console.assert(n===r.STATUS_CONNECTED),await t.p_test_kvt("NACL%20VERIFY")}catch(e){throw console.log("Exception thrown in TransportHTTP.test:",e.message),e}}static async test(){return this}}i._transportclasses.HTTP=c,t=e.exports=c},function(e,t){},function(e,t,n){"use strict";function r(e){for(var t=1;t0?this.tail.next=n:this.head=n,this.tail=n,++this.length},t.unshift=function e(t){var n={data:t,next:this.head};0===this.length&&(this.tail=n),this.head=n,++this.length},t.shift=function e(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.clear=function e(){this.head=this.tail=null,this.length=0},t.join=function e(t){if(0===this.length)return"";for(var n=this.head,r=""+n.data;n=n.next;)r+=t+n.data;return r},t.concat=function e(t){if(0===this.length)return s.alloc(0);for(var n=s.allocUnsafe(t>>>0),r=this.head,i=0;r;)c(r.data,n,i),i+=r.data.length,r=r.next;return n},t.consume=function e(t,n){var r;return to.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),t-=s,0===t){s===o.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(s));break}++r}return this.length-=r,i},t._getBuffer=function e(t){var n=s.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(n),t-=r.data.length;r=r.next;){var o=r.data,a=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,a),t-=a,0===t){a===o.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=o.slice(a));break}++i}return this.length-=i,n},t[l]=function(e,t){return u(this,r({},t,{depth:0,customInspect:!1}))},e}()},function(e,t){},function(e,t,n){"use strict";(function(t){var n=new Set;function r(e){if(!n.has(e)){var r=e+" is an experimental feature. This feature could change at any time";n.add(e),t.emitWarning(r,"ExperimentalWarning")}}function i(){}e.exports.emitExperimentalWarning=t.emitWarning?r:i}).call(this,n(2))},function(e,t,n){"use strict";(function(t){var r;function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var o=n(294),s=Symbol("lastResolve"),a=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),c=Symbol("lastPromise"),f=Symbol("handlePromise"),h=Symbol("stream");function p(e,t){return{value:e,done:t}}function d(e){var t=e[s];if(null!==t){var n=e[h].read();null!==n&&(e[c]=null,e[s]=null,e[a]=null,t(p(n,!1)))}}function m(e){t.nextTick(d,e)}function g(e,t){return function(n,r){e.then(function(){t[l]?n(p(void 0,!0)):t[f](n,r)},r)}}var y=Object.getPrototypeOf(function(){}),b=Object.setPrototypeOf((r={get stream(){return this[h]},next:function e(){var n=this,r=this[u];if(null!==r)return Promise.reject(r);if(this[l])return Promise.resolve(p(void 0,!0));if(this[h].destroyed)return new Promise(function(e,r){t.nextTick(function(){n[u]?r(n[u]):e(p(void 0,!0))})});var i=this[c],o;if(i)o=new Promise(g(i,this));else{var s=this[h].read();if(null!==s)return Promise.resolve(p(s,!1));o=new Promise(this[f])}return this[c]=o,o}},i(r,Symbol.asyncIterator,function(){return this}),i(r,"return",function e(){var t=this;return new Promise(function(e,n){t[h].destroy(null,function(t){t?n(t):e(p(void 0,!0))})})}),r),y),v=function e(t){var n,r=Object.create(b,(n={},i(n,h,{value:t,writable:!0}),i(n,s,{value:null,writable:!0}),i(n,a,{value:null,writable:!0}),i(n,u,{value:null,writable:!0}),i(n,l,{value:t._readableState.endEmitted,writable:!0}),i(n,f,{value:function e(t,n){var i=r[h].read();i?(r[c]=null,r[s]=null,r[a]=null,t(p(i,!1))):(r[s]=t,r[a]=n)},writable:!0}),n));return r[c]=null,o(t,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[a];return null!==t&&(r[c]=null,r[s]=null,r[a]=null,t(e)),void(r[u]=e)}var n=r[s];null!==n&&(r[c]=null,r[s]=null,r[a]=null,n(p(void 0,!0))),r[l]=!0}),t.on("readable",m.bind(null,r)),r};e.exports=v}).call(this,n(2))},function(e,t,n){"use strict";e.exports=i;var r=n(401);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}n(1)(i,r),i.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){"use strict";var r;function i(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var o=n(135).codes,s=o.ERR_MISSING_ARGS,a=o.ERR_STREAM_DESTROYED;function u(e){if(e)throw e}function l(e){return e.setHeader&&"function"==typeof e.abort}function c(e,t,o,s){s=i(s);var u=!1;e.on("close",function(){u=!0}),void 0===r&&(r=n(294)),r(e,{readable:t,writable:o},function(e){if(e)return s(e);u=!0,s()});var c=!1;return function(t){if(!u&&!c)return c=!0,l(e)?e.abort():"function"==typeof e.destroy?e.destroy():void s(t||new a("pipe"))}}function f(e){e()}function h(e,t){return e.pipe(t)}function p(e){return e.length?"function"!=typeof e[e.length-1]?u:e.pop():u}function d(){for(var e=arguments.length,t=new Array(e),n=0;n0;return c(e,s,a,function(e){i||(i=e),e&&o.forEach(f),s||(o.forEach(f),r(i))})});return t.reduce(h)}e.exports=d},function(e,t,n){(function(r,i){const o=n(289),s=n(5)("dweb-transports:ipfs"),a=n(774),u=n(1459),l=n(9),c=n(48),f=n(32),h=n(20),p=n(98),d=n(134),m=n(115),g=n(170),y={repo:"/tmp/dweb_ipfsv3107",config:{Bootstrap:["/dns4/dweb.me/tcp/4245/wss/ipfs/QmQz3p44VVQDeAieaW28DMjcTVzLbpxqaQB9bkXnyd7HY5"]},EXPERIMENTAL:{pubsub:!0},preload:{enabled:!1}};class b extends d{constructor(e){super(e),["urlUrlstore","httpIPFSgateway"].forEach(t=>{this[t]=e[t],delete e[t]}),this.ipfs=void 0,this.options=e,this.name="IPFS",this.supportURLs=["ipfs"],this.supportFunctions=["fetch","store","seed","createReadStream"],this.supportFeatures=["noCache"],this.status=d.STATUS_LOADED}_ipfsversion(e,t,n){e.version((r,i)=>{r?(s("IPFS via %s present but unresponsive: %o",t,i),this.ipfstype="FAILED",n(r)):(s("IPFS available via %s: %o",t,i),this.ipfstype=t,n(null,e))})}IPFSAutoConnect(e){if(r.ipfs)this._ipfsversion(r.ipfs,"global.ipfs",e);else if("undefined"!=typeof window&&window.ipfs)this._ipfsversion(window.ipfs,"window.ipfs",e);else{var t=u("localhost","5001",{protocol:"http"});t.version((n,r)=>{n?(s("IPFS via API failed %s, trying running own IPFS client",n.message),t=new a(this.options),t.on("ready",()=>{this._ipfsversion(t,"client",e)}),t.on("error",t=>{s("IPFS via client error %s",t.message),e(t)})):this._ipfsversion(t,"API",e)})}}static setup0(e){const t=d.mergeoptions(y,e.ipfs);s("setup options=%o",t);const n=new b(t);return m.addtransport(n),n}p_setup1(e,t){if(!t)return new Promise((e,t)=>{try{n.call(this,(n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{n.call(this,t)}catch(e){t(e)}function n(t){this.status=d.STATUS_STARTING,e&&e(this),this.IPFSAutoConnect((n,r)=>{n?(s("Failed to connect %s",n.message),this.status=d.STATUS_FAILED):(this.ipfs=r,this.status=d.STATUS_CONNECTED),e&&e(this),t(null,this)})}}p_setup2(e){return this.status===d.STATUS_FAILED&&s("Stage 1 failed, skipping"),this}stop(e,t){"client"===this.ipfstype?this.ipfs.stop((n,r)=>{this.status=d.STATUS_FAILED,e&&e(this),t(n,r)}):(this.status=d.STATUS_FAILED,e&&e(this),t(miull,this))}async p_status(){return this.status=await this.ipfs.isOnline()?d.STATUS_CONNECTED:d.STATUS_FAILED,super.p_status()}static urlFrom(e){if(e instanceof l)return"ipfs:/ipfs/"+e.toBaseEncodedString();if("object"==typeof e&&e.hash)return"ipfs:/ipfs/"+e.hash;if("string"==typeof e)return"ipfs:/ipfs/"+e;throw new p.CodingError("TransportIPFS.urlFrom: Cant convert to url from",e)}static cidFrom(e){if(e instanceof l)return e;if("string"==typeof e&&(e=f.parse(e)),e&&e.pathname){const t=e.pathname.split("/");if(!["ipfs:","dweb:"].includes(e.protocol)||"ipfs"!==t[1]||t.length<3)throw new p.TransportError("TransportIPFS.cidFrom bad format for url should be dweb: or ipfs:/ipfs/...: "+e.href);if(t.length>3)throw new p.TransportError("TransportIPFS.cidFrom not supporting paths in url yet, should be dweb: or ipfs:/ipfs/...: "+e.href);return new l(t[2])}throw new p.CodingError("TransportIPFS.cidFrom: Cant convert url",e)}static _stringFrom(e){return e instanceof l?"/ipfs/"+e.toBaseEncodedString():"object"==typeof e&&e.path?e.path:void 0}static ipfsFrom(e){if(e=this._stringFrom(e),e.indexOf("/ipfs/")>-1)return e.slice(e.indexOf("/ipfs/"));throw new p.CodingError(`TransportIPFS.ipfsFrom: Cant convert url ${e} into a path starting /ipfs/`)}ipfsGatewayFrom(e){if(e=this._stringFrom(e),e.indexOf("/ipfs/")>-1)return this.httpIPFSgateway+e.slice(e.indexOf("/ipfs/"));throw new p.CodingError(`TransportIPFS.ipfsGatewayFrom: Cant convert url ${e} into a path starting /ipfs/`)}static multihashFrom(e){if(e instanceof l)return e.toBaseEncodedString();if("object"==typeof e&&e.path&&(e=e.path),"string"==typeof e){const t=e.indexOf("/ipfs/");if(t>-1)return e.slice(t+6)}throw new p.CodingError(`Cant turn ${e} into a multihash`)}async p_rawfetch(e,{timeoutMS:t=6e4,relay:n=!1}={}){if(!e)throw new p.CodingError("TransportIPFS.p_rawfetch: requires url");const r=b.cidFrom(e),i=b.ipfsFrom(e);try{const n=await g.p_timeout(this.ipfs.dag.get(r),t,"Timed out IPFS fetch of "+b._stringFrom(r));if(n.remainderPath.length)throw new p.TransportError("Not yet supporting paths in p_rawfetch");let a;return"DAGNode"===n.value.constructor.name?a=await this.ipfs.cat(i):(s("Found a raw IPFS block (unusual) - not a DAGNode - handling as such"),a=n.value),a}catch(n){if(s("Caught error '%s' fetching via IPFS",n.message),!this.httpIPFSgateway)throw n;try{s("Trying IPFS HTTP gateway");let n=this.ipfsGatewayFrom(e);return await g.p_timeout(o.p_GET(n),t,"Timed out IPFS fetch of "+n)}catch(e){throw e}}}async p_rawstore(e){console.assert(e,"TransportIPFS.p_rawstore: requires data");const t=e instanceof i?e:new i(e),n=(await this.ipfs.add(t,{"cid-version":1,hashAlg:"sha2-256"}))[0];return b.urlFrom(n)}seed({directoryPath:e,fileRelativePath:t,ipfsHash:n,urlToFile:r},i){if(this.urlUrlstore&&r){const e=`${this.urlUrlstore}?arg=${encodeURIComponent(r)}`;o.p_GET(e,{retries:0},(e,t)=>{e?(s("IPFS.seed for %s failed in http: %s",r,e.message),i(e)):(s("Added %s to IPFS key=",r,t.Key),n&&n!==t.Key&&s("ipfs hash doesnt match expected metadata has %s daemon returned %s",n,t.Key),i(null,t))})}else s("IPFS.seed support requires urlUrlstore and urlToFile"),i(new Error("IPFS.seed support requires urlUrlstore and urlToFile"))}async p_f_createReadStream(e,{wanturl:t=!1}={}){let n;try{let r=e.pathname.split("/ipfs/")[1];if(r.includes("/"))throw new CodingError("Should not be seeing URLS with a path here:"+e);let i=this;return t?e:function e(t){s("reading from stream %o %o",r,t||"");const o=t?t.start:0,a=t&&t.end?o+t.end+1:void 0;return n&&n.destroy&&n.destroy(),n=i.ipfs.catReadableStream(r,{offset:o,length:a&&a-o}),n.on("error",e=>console.error(e)),n}}catch(e){throw n&&n.destroy&&n.destroy(),e}}static async p_test(e){console.log("TransportIPFS.test");try{const t=await this.p_setup(e);console.log(t.name,"setup");const n=await t.p_status();let r;console.assert(n===d.STATUS_CONNECTED);const i="The quick brown fox",o="ipfs:/ipfs/zdpuAscRnisRkYnEyJAp1LydQ3po25rCEDPPEDMymYRfN1yPK",s="1114",a=await t.p_rawstore(i);console.log("rawstore returned",a);const u=b.cidFrom(a);console.assert(a===o,"url should match url from rawstore");const l=a.split("/")[2],c=b.urlFrom(u);console.assert(a===c,"Should round trip"),r=a;const f=await t.p_rawfetch(r);return console.assert(f.toString()===i,"Should fetch block stored above"),t}catch(e){throw console.log("Exception thrown in TransportIPFS.test:",e.message),e}}}m._transportclasses.IPFS=b,t=e.exports=b}).call(this,n(8),n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(402),o=n(775),s=n(23),a=n(44),u=n(64),l=n(65),c=n(24),f=n(35),h=n(484),p=n(89),d=n(9),m=n(5),g=n(182),y=n(6),b=n(959),v=n(961),w=n(962),_=n(1321),k=n(1322),S=n(1326),E={get"bitcoin-block"(){return n(1327)},get"eth-account-snapshot"(){return n(126).ethAccountSnapshot},get"eth-block"(){return n(126).ethBlock},get"eth-block-list"(){return n(126).ethBlockList},get"eth-state-trie"(){return n(126).ethStateTrie},get"eth-storage-trie"(){return n(126).ethStorageTrie},get"eth-tx"(){return n(126).ethTx},get"eth-tx-trie"(){return n(126).ethTxTrie},get"git-raw"(){return n(1424)},get"zcash-block"(){return n(1430)}};class x extends y{constructor(e){super();const t={init:!0,start:!0,EXPERIMENTAL:{},preload:{enabled:!0,addresses:["/dnsaddr/node0.preload.ipfs.io/https","/dnsaddr/node1.preload.ipfs.io/https"]}};e=b.validate(e||{}),this._options=g(e,t),!1===e.init&&(this._options.init=!1),!1!==e.start&&(this._options.start=!0),"string"==typeof e.repo||void 0===e.repo?this._repo=_(e.repo):this._repo=e.repo,this.log=m("jsipfs"),this.log.err=m("jsipfs:err"),this.types={Buffer:r,PeerId:s,PeerInfo:a,multiaddr:c,multibase:p,multihash:f,CID:d},this._peerInfoBook=new h,this._peerInfo=void 0,this._bitswap=void 0,this._blockService=new i(this._repo),this._ipld=new o({blockService:this._blockService,loadFormat:(e,t)=>{if(this.log("Loading IPLD format",e),E[e])return t(null,E[e]);t(new Error(`Missing IPLD format "${e}"`))}}),this._preload=k(this),this._mfsPreload=S(this),this._ipns=void 0,this._print=this._options.silent?this.log:console.log,this.init=w.init(this),this.preStart=w.preStart(this),this.start=w.start(this),this.stop=w.stop(this),this.shutdown=this.stop,this.isOnline=w.isOnline(this),Object.assign(this,w.filesRegular(this)),this.version=w.version(this),this.id=w.id(this),this.repo=w.repo(this),this.bootstrap=w.bootstrap(this),this.config=w.config(this),this.block=w.block(this),this.object=w.object(this),this.dag=w.dag(this),this.files=w.filesMFS(this),this.libp2p=null,this.swarm=w.swarm(this),this.name=w.name(this),this.bitswap=w.bitswap(this),this.pin=w.pin(this),this.ping=w.ping(this),this.pingPullStream=w.pingPullStream(this),this.pingReadableStream=w.pingReadableStream(this),this.pubsub=w.pubsub(this),this.dht=w.dht(this),this.dns=w.dns(this),this.key=w.key(this),this.stats=w.stats(this),this.resolve=w.resolve(this),this._options.EXPERIMENTAL.pubsub&&this.log("EXPERIMENTAL pubsub is enabled"),this._options.EXPERIMENTAL.ipnsPubsub&&(this._options.EXPERIMENTAL.pubsub||(this.log("EXPERIMENTAL pubsub is enabled to use IPNS pubsub"),this._options.EXPERIMENTAL.pubsub=!0),this.log("EXPERIMENTAL IPNS pubsub is enabled")),this._options.EXPERIMENTAL.sharding&&this.log("EXPERIMENTAL sharding is enabled"),this._options.EXPERIMENTAL.dht&&this.log("EXPERIMENTAL Kademlia DHT is enabled"),this.state=n(1458)(this),this.util={crypto:u,isIPFS:l},v(this)}}t=e.exports=x,t.createNode=(e=>new x(e))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(137),i=n(26),o=n(9),s=n(409),a=n(225),u=n(402),l=n(61).join,c=n(61).sep,f=n(70).source,h=n(438),p=n(88),d=n(40),m=n(11),g=n(33).MemoryDatastore,y=n(439),b=n(304),v=n(38),w=n(890);function _(){}class k{constructor(e){const t=y(k.defaultOptions,e);if(!t.blockService)throw new Error("Missing blockservice");this.bs=t.blockService,this.resolvers={},this.support={},this.support.add=((e,t,n)=>{if(this.resolvers[e])throw new Error('Resolver already exists for codec "'+e+'"');this.resolvers[e]={resolver:t,util:n}}),this.support.load=t.loadFormat||((e,t)=>{t(new Error(`No resolver found for codec "${e}"`))}),this.support.rm=(e=>{this.resolvers[e]&&delete this.resolvers[e]});for(const e of t.formats){const{resolver:t,util:n}=e,r=t.multicodec;this.support.add(r,t,n)}}get(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n={}),"string"==typeof t&&(t=l("/",t).substr(1).split(c).join("/")),""===t||!t)return this._get(e,(t,n)=>{if(t)return r(t);r(null,{value:n,remainderPath:"",cid:e})});let i;s(n=>{this._getFormat(e.codec,(r,o)=>{if(r)return n(r);this.bs.get(e,(e,r)=>{if(e)return n(e);o.resolver.resolve(r.data,t,(e,r)=>{if(e)return n(e);i=r.value,t=r.remainderPath,n()})})})},()=>{const r=!t||""===t||"/"===t,o=i&&!k._maybeCID(i);return r&&o||n.localResolve?(e=k._maybeCID(i)||e,!0):(i=k._maybeCID(i),i&&(e=i),!1)},(n,o)=>n?r(n):r(null,{value:i,remainderPath:t,cid:e}))}getStream(e,t,n){const r=f();return this.get(e,t,n,(e,t)=>{if(e)return r.resolve(i.error(e));r.resolve(i.values([t]))}),r}getMany(e,t){if(!Array.isArray(e))return t(new Error("Argument must be an array of CIDs"));this.bs.getMany(e,(e,n)=>{if(e)return t(e);p(n,(e,t)=>{this._getFormat(e.cid.codec,(n,r)=>{if(n)return t(n);r.util.deserialize(e.data,t)})},t)})}put(e,t,n){return"function"==typeof t?(n=t,setImmediate(()=>n(new Error("IPLDResolver.put requires options")))):(n=n||_,t.cid&&o.isCID(t.cid)?t.onlyHash?setImmediate(()=>n(null,t.cid)):this._put(t.cid,e,n):void this._getFormat(t.format,(r,i)=>{if(r)return n(r);i.util.cid(e,t,(r,i)=>r?n(r):t.onlyHash?n(null,i):void this._put(i,e,n))}))}treeStream(e,t,n){let r;return"object"==typeof t&&(n=t,t=void 0),n=n||{},n.recursive||(r=f(),m([t=>this._getFormat(e.codec,t),(t,n)=>this.bs.get(e,(e,r)=>{if(e)return n(e);n(null,t,r)}),(e,t,n)=>e.resolver.tree(t.data,n)],(e,t)=>{if(e)return r.abort(e),r;r.resolve(i.values(t))})),n.recursive&&(r=i(h.widthFirst({basePath:null,cid:e},e=>{if("string"==typeof e)return i.empty();const t=f(),n=e.cid;return m([e=>this._getFormat(n.codec,e),(e,t)=>this.bs.get(n,(n,r)=>{if(n)return t(n);t(null,e,r)}),(e,t,n)=>e.resolver.tree(t.data,(r,i)=>{if(r)return n(r);p(i,(n,r)=>{e.resolver.isLink(t.data,n,(e,t)=>{if(e)return r(e);r(null,{path:n,link:t})})},n)})],(n,r)=>{if(n)return t.abort(n),t;t.resolve(i.values(r.map(t=>{const n=e.basePath?e.basePath+"/"+t.path:t.path;return t.link?{basePath:n,cid:k._maybeCID(t.link)}:n})))}),t}),i.map(e=>"string"==typeof e?e:e.basePath),i.filter(Boolean))),t?i(r,i.map(e=>{if(0===e.indexOf(t))return e=e.slice(t.length+1),e}),i.filter(Boolean)):r}remove(e,t){this.bs.delete(e,t)}_get(e,t){m([t=>this._getFormat(e.codec,t),(t,n)=>this.bs.get(e,(e,r)=>{if(e)return n(e);n(null,t,r)}),(e,t,n)=>{e.util.deserialize(t.data,(e,t)=>{if(e)return n(e);n(null,t)})}],t)}_getFormat(e,t){if(this.resolvers[e])return t(null,this.resolvers[e]);this.support.load(e,(n,r)=>{if(n)return t(n);this.resolvers[e]=r,t(null,r)})}_put(e,t,n){n=n||_,m([t=>this._getFormat(e.codec,t),(e,n)=>e.util.serialize(t,n),(t,n)=>this.bs.put(new r(t,e),n)],t=>{if(t)return n(t);n(null,e)})}static _maybeCID(e){return o.isCID(e)?e:e&&void 0!==e["/"]?new o(e["/"]):null}}k.defaultOptions={formats:[b,v,w]},k.inMemory=function(e){const t=new a("in-memory",{storageBackends:{root:g,blocks:g,datastore:g},lock:"memory"}),n=new u(t);d([e=>t.init({},e),e=>t.open(e)],t=>{if(t)return e(t);e(null,new k({blockService:n}))})},e.exports=k},function(e,t,n){"use strict";(function(t){const r=n(35),i=n(89),o=n(295),s=n(176),a=n(791),u=n(53);class l{constructor(e,n,s,a){if(c.isCID(e)){const n=e;return this.version=n.version,this.codec=n.codec,this.multihash=t.from(n.multihash),void(this.multibaseName=n.multibaseName||(0===n.version?"base58btc":"base32"))}if("string"==typeof e){const t=i.isEncoded(e);if(t){const n=i.decode(e);this.version=parseInt(n.slice(0,1).toString("hex"),16),this.codec=o.getCodec(n.slice(1)),this.multihash=o.rmPrefix(n.slice(1)),this.multibaseName=t}else this.version=0,this.codec="dag-pb",this.multihash=r.fromB58String(e),this.multibaseName="base58btc";return l.validateCID(this),void Object.defineProperty(this,"string",{value:e})}if(t.isBuffer(e)){const t=e.slice(0,1),n=parseInt(t.toString("hex"),16);if(1===n){const t=e;this.version=n,this.codec=o.getCodec(t.slice(1)),this.multihash=o.rmPrefix(t.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=e,this.multibaseName="base58btc";l.validateCID(this)}else this.version=e,this.codec=n,this.multihash=s,this.multibaseName=a||(0===e?"base58btc":"base32"),l.validateCID(this)}get buffer(){let e=this._buffer;if(!e){if(0===this.version)e=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");e=t.concat([t.from("01","hex"),o.getCodeVarint(this.codec),this.multihash])}Object.defineProperty(this,"_buffer",{value:e})}return e}get prefix(){return t.concat([t.from(`0${this.version}`,"hex"),o.getCodeVarint(this.codec),r.prefix(this.multihash)])}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:t}=r.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==t)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new c(0,this.codec,this.multihash)}toV1(){return new c(1,this.codec,this.multihash)}toBaseEncodedString(e=this.multibaseName){if(this.string&&e===this.multibaseName)return this.string;let t=null;if(0===this.version){if("base58btc"!==e)throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");t=r.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");t=i.encode(e,this.buffer).toString()}return e===this.multibaseName&&Object.defineProperty(this,"string",{value:t}),t}toString(e){return this.toBaseEncodedString(e)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(e){return this.codec===e.codec&&this.version===e.version&&this.multihash.equals(e.multihash)}static validateCID(e){let t=a.checkCIDComponents(e);if(t)throw new Error(t)}}const c=u(l,{className:"CID",symbolName:"@ipld/js-cid/CID"});c.codecs=s,e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){const r=n(4).Buffer;e.exports=function e(t){if(t.length>=255)throw new TypeError("Alphabet too long");const n=new Uint8Array(256);n.fill(255);for(let e=0;e>>0,f=new Uint8Array(c);for(;u!==l;){let t=e[u],n=0;for(let e=c-1;(0!==t||n>>0,f[e]=t%i>>>0,t=t/i>>>0;if(0!==t)throw new Error("Non-zero carry");s=n,u++}let h=c-s;for(;h!==c&&0===f[h];)h++;let p=o.repeat(n);for(;h>>0,c=new Uint8Array(l);for(;e[t];){let r=n[e.charCodeAt(t)];if(255===r)return;let o=0;for(let e=l-1;(0!==r||o>>0,c[e]=r%256>>>0,r=r/256>>>0;if(0!==r)throw new Error("Non-zero carry");u=o,t++}if(" "===e[t])return;let f=l-u;for(;f!==l&&0===c[f];)f++;const h=r.allocUnsafe(a+(l-f));h.fill(0,0,a);let p=a;for(;f!==l;)h[p++]=c[f++];return h}function c(e){const t=l(e);if(t)return t;throw new Error("Non-base"+i+" character")}return{encode:u,decodeUnsafe:l,decode:c}}},function(e,t){e.exports=s;var n=128,r=127,i=-128,o=Math.pow(2,31);function s(e,t,r){t=t||[],r=r||0;for(var a=r;e>=o;)t[r++]=255&e|n,e/=128;for(;e&i;)t[r++]=255&e|n,e>>>=7;return t[r]=0|e,s.bytes=r-a+1,t}},function(e,t){e.exports=i;var n=128,r=127;function i(e,t){var o=0,t=t||0,s=0,a=t,u,l=e.length;do{if(a>=l)throw i.bytes=0,new RangeError("Could not decode varint");u=e[a++],o+=s<28?(u&r)<=n);return i.bytes=a-t,o}},function(e,t){var n=Math.pow(2,7),r=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),s=Math.pow(2,35),a=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),c=Math.pow(2,63);e.exports=function(e){return e(e[t[0]]=new r(t[0],t[1],t[2],t[3]),e),{}),c=u.reduce((e,t)=>(e[t[1]]=l[t[0]],e),{});e.exports={names:l,codes:c}},function(e,t,n){"use strict";class r{constructor(e,t,n,r){this.name=e,this.code=t,this.alphabet=r,n&&r&&(this.engine=n(r))}encode(e){return this.engine.encode(e)}decode(e){return this.engine.decode(e)}isImplemented(){return this.engine}}e.exports=r},function(e,t,n){var r=n(4).Buffer;e.exports=function e(t){for(var n={},i=t.length,o=t.charAt(0),s=0;s0;)n.push(a%i),a=a/i|0}for(var u="",l=0;0===e[l]&&l=0;--c)u+=t[n[c]];return u}function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return r.allocUnsafe(0);for(var t=[0],s=0;s>=8;for(;l>0;)t.push(255&l),l>>=8}for(var c=0;e[c]===o&&c"string"==typeof e?t.from(e).toString("hex"):e.toString("hex"),decode(e){for(let t of e)if(n.indexOf(t)<0)throw new Error("invalid base16 character");return t.from(e,"hex")}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){function n(e,t){e=e.replace(new RegExp("=","g"),"");let n=e.length,r=0,i=0,o=0,s=new Uint8Array(5*n/8|0);for(let a=0;a=8&&(s[o++]=i>>>r-8&255,r-=8);return s.buffer}function r(e,t){let n=e.byteLength,r=new Uint8Array(e),i=t.indexOf("=")===t.length-1;i&&(t=t.substring(0,t.length-2));let o=0,s=0,a="";for(let e=0;e=5;)a+=t[s>>>o-5&31],o-=5;if(o>0&&(a+=t[s<<5-o&31]),i)for(;a.length%8!=0;)a+="=";return a}e.exports=function e(i){return{encode:e=>r("string"==typeof e?t.from(e):e,i),decode(e){for(let t of e)if(i.indexOf(t)<0)throw new Error("invalid base32 character");return n(e,i)}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){e.exports=function e(n){const r=n.indexOf("=")>-1,i=n.indexOf("-")>-1&&n.indexOf("_")>-1;return{encode(e){let n="";n="string"==typeof e?t.from(e).toString("base64"):e.toString("base64"),i&&(n=n.replace(/\+/g,"-").replace(/\//g,"_"));const o=n.indexOf("=");return o>0&&!r&&(n=n.substring(0,o)),n},decode(e){for(let t of e)if(n.indexOf(t)<0)throw new Error("invalid base64 character");return t.from(e,"base64")}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(176),i=n(404).varintBufferEncode,o={};e.exports=o;for(let e in r){let t=r[e];o[e]=i(t)}},function(e,t,n){"use strict";const r=n(176),i={};e.exports=i;for(let e in r){let t=r[e];i[t.toString("hex")]=e}},function(e,t,n){"use strict";e.exports=Object.freeze({PROTOBUF:80,CBOR:81,RLP:96,BENCODE:99,MULTICODEC:48,MULTIHASH:49,MULTIADDR:50,MULTIBASE:51,IDENTITY:0,SHA1:17,SHA2_256:18,SHA2_512:19,SHA3_512:20,SHA3_384:21,SHA3_256:22,SHA3_224:23,SHAKE_128:24,SHAKE_256:25,KECCAK_224:26,KECCAK_256:27,KECCAK_384:28,KECCAK_512:29,MURMUR3_128:34,MURMUR3_32:35,DBL_SHA2_256:86,MD4:212,MD5:213,BMT:214,X11:4352,BLAKE2B_8:45569,BLAKE2B_16:45570,BLAKE2B_24:45571,BLAKE2B_32:45572,BLAKE2B_40:45573,BLAKE2B_48:45574,BLAKE2B_56:45575,BLAKE2B_64:45576,BLAKE2B_72:45577,BLAKE2B_80:45578,BLAKE2B_88:45579,BLAKE2B_96:45580,BLAKE2B_104:45581,BLAKE2B_112:45582,BLAKE2B_120:45583,BLAKE2B_128:45584,BLAKE2B_136:45585,BLAKE2B_144:45586,BLAKE2B_152:45587,BLAKE2B_160:45588,BLAKE2B_168:45589,BLAKE2B_176:45590,BLAKE2B_184:45591,BLAKE2B_192:45592,BLAKE2B_200:45593,BLAKE2B_208:45594,BLAKE2B_216:45595,BLAKE2B_224:45596,BLAKE2B_232:45597,BLAKE2B_240:45598,BLAKE2B_248:45599,BLAKE2B_256:45600,BLAKE2B_264:45601,BLAKE2B_272:45602,BLAKE2B_280:45603,BLAKE2B_288:45604,BLAKE2B_296:45605,BLAKE2B_304:45606,BLAKE2B_312:45607,BLAKE2B_320:45608,BLAKE2B_328:45609,BLAKE2B_336:45610,BLAKE2B_344:45611,BLAKE2B_352:45612,BLAKE2B_360:45613,BLAKE2B_368:45614,BLAKE2B_376:45615,BLAKE2B_384:45616,BLAKE2B_392:45617,BLAKE2B_400:45618,BLAKE2B_408:45619,BLAKE2B_416:45620,BLAKE2B_424:45621,BLAKE2B_432:45622,BLAKE2B_440:45623,BLAKE2B_448:45624,BLAKE2B_456:45625,BLAKE2B_464:45626,BLAKE2B_472:45627,BLAKE2B_480:45628,BLAKE2B_488:45629,BLAKE2B_496:45630,BLAKE2B_504:45631,BLAKE2B_512:45632,BLAKE2S_8:45633,BLAKE2S_16:45634,BLAKE2S_24:45635,BLAKE2S_32:45636,BLAKE2S_40:45637,BLAKE2S_48:45638,BLAKE2S_56:45639,BLAKE2S_64:45640,BLAKE2S_72:45641,BLAKE2S_80:45642,BLAKE2S_88:45643,BLAKE2S_96:45644,BLAKE2S_104:45645,BLAKE2S_112:45646,BLAKE2S_120:45647,BLAKE2S_128:45648,BLAKE2S_136:45649,BLAKE2S_144:45650,BLAKE2S_152:45651,BLAKE2S_160:45652,BLAKE2S_168:45653,BLAKE2S_176:45654,BLAKE2S_184:45655,BLAKE2S_192:45656,BLAKE2S_200:45657,BLAKE2S_208:45658,BLAKE2S_216:45659,BLAKE2S_224:45660,BLAKE2S_232:45661,BLAKE2S_240:45662,BLAKE2S_248:45663,BLAKE2S_256:45664,SKEIN256_8:45825,SKEIN256_16:45826,SKEIN256_24:45827,SKEIN256_32:45828,SKEIN256_40:45829,SKEIN256_48:45830,SKEIN256_56:45831,SKEIN256_64:45832,SKEIN256_72:45833,SKEIN256_80:45834,SKEIN256_88:45835,SKEIN256_96:45836,SKEIN256_104:45837,SKEIN256_112:45838,SKEIN256_120:45839,SKEIN256_128:45840,SKEIN256_136:45841,SKEIN256_144:45842,SKEIN256_152:45843,SKEIN256_160:45844,SKEIN256_168:45845,SKEIN256_176:45846,SKEIN256_184:45847,SKEIN256_192:45848,SKEIN256_200:45849,SKEIN256_208:45850,SKEIN256_216:45851,SKEIN256_224:45852,SKEIN256_232:45853,SKEIN256_240:45854,SKEIN256_248:45855,SKEIN256_256:45856,SKEIN512_8:45857,SKEIN512_16:45858,SKEIN512_24:45859,SKEIN512_32:45860,SKEIN512_40:45861,SKEIN512_48:45862,SKEIN512_56:45863,SKEIN512_64:45864,SKEIN512_72:45865,SKEIN512_80:45866,SKEIN512_88:45867,SKEIN512_96:45868,SKEIN512_104:45869,SKEIN512_112:45870,SKEIN512_120:45871,SKEIN512_128:45872,SKEIN512_136:45873,SKEIN512_144:45874,SKEIN512_152:45875,SKEIN512_160:45876,SKEIN512_168:45877,SKEIN512_176:45878,SKEIN512_184:45879,SKEIN512_192:45880,SKEIN512_200:45881,SKEIN512_208:45882,SKEIN512_216:45883,SKEIN512_224:45884,SKEIN512_232:45885,SKEIN512_240:45886,SKEIN512_248:45887,SKEIN512_256:45888,SKEIN512_264:45889,SKEIN512_272:45890,SKEIN512_280:45891,SKEIN512_288:45892,SKEIN512_296:45893,SKEIN512_304:45894,SKEIN512_312:45895,SKEIN512_320:45896,SKEIN512_328:45897,SKEIN512_336:45898,SKEIN512_344:45899,SKEIN512_352:45900,SKEIN512_360:45901,SKEIN512_368:45902,SKEIN512_376:45903,SKEIN512_384:45904,SKEIN512_392:45905,SKEIN512_400:45906,SKEIN512_408:45907,SKEIN512_416:45908,SKEIN512_424:45909,SKEIN512_432:45910,SKEIN512_440:45911,SKEIN512_448:45912,SKEIN512_456:45913,SKEIN512_464:45914,SKEIN512_472:45915,SKEIN512_480:45916,SKEIN512_488:45917,SKEIN512_496:45918,SKEIN512_504:45919,SKEIN512_512:45920,SKEIN1024_8:45921,SKEIN1024_16:45922,SKEIN1024_24:45923,SKEIN1024_32:45924,SKEIN1024_40:45925,SKEIN1024_48:45926,SKEIN1024_56:45927,SKEIN1024_64:45928,SKEIN1024_72:45929,SKEIN1024_80:45930,SKEIN1024_88:45931,SKEIN1024_96:45932,SKEIN1024_104:45933,SKEIN1024_112:45934,SKEIN1024_120:45935,SKEIN1024_128:45936,SKEIN1024_136:45937,SKEIN1024_144:45938,SKEIN1024_152:45939,SKEIN1024_160:45940,SKEIN1024_168:45941,SKEIN1024_176:45942,SKEIN1024_184:45943,SKEIN1024_192:45944,SKEIN1024_200:45945,SKEIN1024_208:45946,SKEIN1024_216:45947,SKEIN1024_224:45948,SKEIN1024_232:45949,SKEIN1024_240:45950,SKEIN1024_248:45951,SKEIN1024_256:45952,SKEIN1024_264:45953,SKEIN1024_272:45954,SKEIN1024_280:45955,SKEIN1024_288:45956,SKEIN1024_296:45957,SKEIN1024_304:45958,SKEIN1024_312:45959,SKEIN1024_320:45960,SKEIN1024_328:45961,SKEIN1024_336:45962,SKEIN1024_344:45963,SKEIN1024_352:45964,SKEIN1024_360:45965,SKEIN1024_368:45966,SKEIN1024_376:45967,SKEIN1024_384:45968,SKEIN1024_392:45969,SKEIN1024_400:45970,SKEIN1024_408:45971,SKEIN1024_416:45972,SKEIN1024_424:45973,SKEIN1024_432:45974,SKEIN1024_440:45975,SKEIN1024_448:45976,SKEIN1024_456:45977,SKEIN1024_464:45978,SKEIN1024_472:45979,SKEIN1024_480:45980,SKEIN1024_488:45981,SKEIN1024_496:45982,SKEIN1024_504:45983,SKEIN1024_512:45984,SKEIN1024_520:45985,SKEIN1024_528:45986,SKEIN1024_536:45987,SKEIN1024_544:45988,SKEIN1024_552:45989,SKEIN1024_560:45990,SKEIN1024_568:45991,SKEIN1024_576:45992,SKEIN1024_584:45993,SKEIN1024_592:45994,SKEIN1024_600:45995,SKEIN1024_608:45996,SKEIN1024_616:45997,SKEIN1024_624:45998,SKEIN1024_632:45999,SKEIN1024_640:46e3,SKEIN1024_648:46001,SKEIN1024_656:46002,SKEIN1024_664:46003,SKEIN1024_672:46004,SKEIN1024_680:46005,SKEIN1024_688:46006,SKEIN1024_696:46007,SKEIN1024_704:46008,SKEIN1024_712:46009,SKEIN1024_720:46010,SKEIN1024_728:46011,SKEIN1024_736:46012,SKEIN1024_744:46013,SKEIN1024_752:46014,SKEIN1024_760:46015,SKEIN1024_768:46016,SKEIN1024_776:46017,SKEIN1024_784:46018,SKEIN1024_792:46019,SKEIN1024_800:46020,SKEIN1024_808:46021,SKEIN1024_816:46022,SKEIN1024_824:46023,SKEIN1024_832:46024,SKEIN1024_840:46025,SKEIN1024_848:46026,SKEIN1024_856:46027,SKEIN1024_864:46028,SKEIN1024_872:46029,SKEIN1024_880:46030,SKEIN1024_888:46031,SKEIN1024_896:46032,SKEIN1024_904:46033,SKEIN1024_912:46034,SKEIN1024_920:46035,SKEIN1024_928:46036,SKEIN1024_936:46037,SKEIN1024_944:46038,SKEIN1024_952:46039,SKEIN1024_960:46040,SKEIN1024_968:46041,SKEIN1024_976:46042,SKEIN1024_984:46043,SKEIN1024_992:46044,SKEIN1024_1000:46045,SKEIN1024_1008:46046,SKEIN1024_1016:46047,SKEIN1024_1024:46048,IP4:4,TCP:6,DCCP:33,IP6:41,IP6ZONE:42,DNS:53,DNS4:54,DNS6:55,DNSADDR:56,SCTP:132,UDP:273,P2P_WEBRTC_STAR:275,P2P_WEBRTC_DIRECT:276,P2P_STARDUST:277,P2P_CIRCUIT:290,UDT:301,UTP:302,UNIX:400,P2P:421,IPFS:421,HTTPS:443,ONION:444,ONION3:445,GARLIC64:446,GARLIC32:447,QUIC:460,WS:477,WSS:478,P2P_WEBSOCKET_STAR:479,HTTP:480,RAW:85,DAG_PB:112,DAG_CBOR:113,LIBP2P_KEY:114,GIT_RAW:120,TORRENT_INFO:123,TORRENT_FILE:124,LEOFCOIN_BLOCK:129,LEOFCOIN_TX:130,LEOFCOIN_PR:131,ETH_BLOCK:144,ETH_BLOCK_LIST:145,ETH_TX_TRIE:146,ETH_TX:147,ETH_TX_RECEIPT_TRIE:148,ETH_TX_RECEIPT:149,ETH_STATE_TRIE:150,ETH_ACCOUNT_SNAPSHOT:151,ETH_STORAGE_TRIE:152,BITCOIN_BLOCK:176,BITCOIN_TX:177,ZCASH_BLOCK:192,ZCASH_TX:193,STELLAR_BLOCK:208,STELLAR_TX:209,DECRED_BLOCK:224,DECRED_TX:225,DASH_BLOCK:240,DASH_TX:241,SWARM_MANIFEST:250,SWARM_FEED:251,DAG_JSON:297,PATH:47,IPLD_NS:226,IPFS_NS:227,SWARM_NS:228,ED25519_PUB:237,HOLOCHAIN_ADR_V0:8417572,HOLOCHAIN_ADR_V1:8483108,HOLOCHAIN_KEY_V0:9728292,HOLOCHAIN_KEY_V1:9793828,HOLOCHAIN_SIG_V0:10645796,HOLOCHAIN_SIG_V1:10711332})},function(e,t,n){"use strict";e.exports=Object.freeze({80:"protobuf",81:"cbor",96:"rlp",99:"bencode",48:"multicodec",49:"multihash",50:"multiaddr",51:"multibase",0:"identity",17:"sha1",18:"sha2-256",19:"sha2-512",20:"sha3-512",21:"sha3-384",22:"sha3-256",23:"sha3-224",24:"shake-128",25:"shake-256",26:"keccak-224",27:"keccak-256",28:"keccak-384",29:"keccak-512",34:"murmur3-128",35:"murmur3-32",86:"dbl-sha2-256",212:"md4",213:"md5",214:"bmt",4352:"x11",45569:"blake2b-8",45570:"blake2b-16",45571:"blake2b-24",45572:"blake2b-32",45573:"blake2b-40",45574:"blake2b-48",45575:"blake2b-56",45576:"blake2b-64",45577:"blake2b-72",45578:"blake2b-80",45579:"blake2b-88",45580:"blake2b-96",45581:"blake2b-104",45582:"blake2b-112",45583:"blake2b-120",45584:"blake2b-128",45585:"blake2b-136",45586:"blake2b-144",45587:"blake2b-152",45588:"blake2b-160",45589:"blake2b-168",45590:"blake2b-176",45591:"blake2b-184",45592:"blake2b-192",45593:"blake2b-200",45594:"blake2b-208",45595:"blake2b-216",45596:"blake2b-224",45597:"blake2b-232",45598:"blake2b-240",45599:"blake2b-248",45600:"blake2b-256",45601:"blake2b-264",45602:"blake2b-272",45603:"blake2b-280",45604:"blake2b-288",45605:"blake2b-296",45606:"blake2b-304",45607:"blake2b-312",45608:"blake2b-320",45609:"blake2b-328",45610:"blake2b-336",45611:"blake2b-344",45612:"blake2b-352",45613:"blake2b-360",45614:"blake2b-368",45615:"blake2b-376",45616:"blake2b-384",45617:"blake2b-392",45618:"blake2b-400",45619:"blake2b-408",45620:"blake2b-416",45621:"blake2b-424",45622:"blake2b-432",45623:"blake2b-440",45624:"blake2b-448",45625:"blake2b-456",45626:"blake2b-464",45627:"blake2b-472",45628:"blake2b-480",45629:"blake2b-488",45630:"blake2b-496",45631:"blake2b-504",45632:"blake2b-512",45633:"blake2s-8",45634:"blake2s-16",45635:"blake2s-24",45636:"blake2s-32",45637:"blake2s-40",45638:"blake2s-48",45639:"blake2s-56",45640:"blake2s-64",45641:"blake2s-72",45642:"blake2s-80",45643:"blake2s-88",45644:"blake2s-96",45645:"blake2s-104",45646:"blake2s-112",45647:"blake2s-120",45648:"blake2s-128",45649:"blake2s-136",45650:"blake2s-144",45651:"blake2s-152",45652:"blake2s-160",45653:"blake2s-168",45654:"blake2s-176",45655:"blake2s-184",45656:"blake2s-192",45657:"blake2s-200",45658:"blake2s-208",45659:"blake2s-216",45660:"blake2s-224",45661:"blake2s-232",45662:"blake2s-240",45663:"blake2s-248",45664:"blake2s-256",45825:"skein256-8",45826:"skein256-16",45827:"skein256-24",45828:"skein256-32",45829:"skein256-40",45830:"skein256-48",45831:"skein256-56",45832:"skein256-64",45833:"skein256-72",45834:"skein256-80",45835:"skein256-88",45836:"skein256-96",45837:"skein256-104",45838:"skein256-112",45839:"skein256-120",45840:"skein256-128",45841:"skein256-136",45842:"skein256-144",45843:"skein256-152",45844:"skein256-160",45845:"skein256-168",45846:"skein256-176",45847:"skein256-184",45848:"skein256-192",45849:"skein256-200",45850:"skein256-208",45851:"skein256-216",45852:"skein256-224",45853:"skein256-232",45854:"skein256-240",45855:"skein256-248",45856:"skein256-256",45857:"skein512-8",45858:"skein512-16",45859:"skein512-24",45860:"skein512-32",45861:"skein512-40",45862:"skein512-48",45863:"skein512-56",45864:"skein512-64",45865:"skein512-72",45866:"skein512-80",45867:"skein512-88",45868:"skein512-96",45869:"skein512-104",45870:"skein512-112",45871:"skein512-120",45872:"skein512-128",45873:"skein512-136",45874:"skein512-144",45875:"skein512-152",45876:"skein512-160",45877:"skein512-168",45878:"skein512-176",45879:"skein512-184",45880:"skein512-192",45881:"skein512-200",45882:"skein512-208",45883:"skein512-216",45884:"skein512-224",45885:"skein512-232",45886:"skein512-240",45887:"skein512-248",45888:"skein512-256",45889:"skein512-264",45890:"skein512-272",45891:"skein512-280",45892:"skein512-288",45893:"skein512-296",45894:"skein512-304",45895:"skein512-312",45896:"skein512-320",45897:"skein512-328",45898:"skein512-336",45899:"skein512-344",45900:"skein512-352",45901:"skein512-360",45902:"skein512-368",45903:"skein512-376",45904:"skein512-384",45905:"skein512-392",45906:"skein512-400",45907:"skein512-408",45908:"skein512-416",45909:"skein512-424",45910:"skein512-432",45911:"skein512-440",45912:"skein512-448",45913:"skein512-456",45914:"skein512-464",45915:"skein512-472",45916:"skein512-480",45917:"skein512-488",45918:"skein512-496",45919:"skein512-504",45920:"skein512-512",45921:"skein1024-8",45922:"skein1024-16",45923:"skein1024-24",45924:"skein1024-32",45925:"skein1024-40",45926:"skein1024-48",45927:"skein1024-56",45928:"skein1024-64",45929:"skein1024-72",45930:"skein1024-80",45931:"skein1024-88",45932:"skein1024-96",45933:"skein1024-104",45934:"skein1024-112",45935:"skein1024-120",45936:"skein1024-128",45937:"skein1024-136",45938:"skein1024-144",45939:"skein1024-152",45940:"skein1024-160",45941:"skein1024-168",45942:"skein1024-176",45943:"skein1024-184",45944:"skein1024-192",45945:"skein1024-200",45946:"skein1024-208",45947:"skein1024-216",45948:"skein1024-224",45949:"skein1024-232",45950:"skein1024-240",45951:"skein1024-248",45952:"skein1024-256",45953:"skein1024-264",45954:"skein1024-272",45955:"skein1024-280",45956:"skein1024-288",45957:"skein1024-296",45958:"skein1024-304",45959:"skein1024-312",45960:"skein1024-320",45961:"skein1024-328",45962:"skein1024-336",45963:"skein1024-344",45964:"skein1024-352",45965:"skein1024-360",45966:"skein1024-368",45967:"skein1024-376",45968:"skein1024-384",45969:"skein1024-392",45970:"skein1024-400",45971:"skein1024-408",45972:"skein1024-416",45973:"skein1024-424",45974:"skein1024-432",45975:"skein1024-440",45976:"skein1024-448",45977:"skein1024-456",45978:"skein1024-464",45979:"skein1024-472",45980:"skein1024-480",45981:"skein1024-488",45982:"skein1024-496",45983:"skein1024-504",45984:"skein1024-512",45985:"skein1024-520",45986:"skein1024-528",45987:"skein1024-536",45988:"skein1024-544",45989:"skein1024-552",45990:"skein1024-560",45991:"skein1024-568",45992:"skein1024-576",45993:"skein1024-584",45994:"skein1024-592",45995:"skein1024-600",45996:"skein1024-608",45997:"skein1024-616",45998:"skein1024-624",45999:"skein1024-632",46000:"skein1024-640",46001:"skein1024-648",46002:"skein1024-656",46003:"skein1024-664",46004:"skein1024-672",46005:"skein1024-680",46006:"skein1024-688",46007:"skein1024-696",46008:"skein1024-704",46009:"skein1024-712",46010:"skein1024-720",46011:"skein1024-728",46012:"skein1024-736",46013:"skein1024-744",46014:"skein1024-752",46015:"skein1024-760",46016:"skein1024-768",46017:"skein1024-776",46018:"skein1024-784",46019:"skein1024-792",46020:"skein1024-800",46021:"skein1024-808",46022:"skein1024-816",46023:"skein1024-824",46024:"skein1024-832",46025:"skein1024-840",46026:"skein1024-848",46027:"skein1024-856",46028:"skein1024-864",46029:"skein1024-872",46030:"skein1024-880",46031:"skein1024-888",46032:"skein1024-896",46033:"skein1024-904",46034:"skein1024-912",46035:"skein1024-920",46036:"skein1024-928",46037:"skein1024-936",46038:"skein1024-944",46039:"skein1024-952",46040:"skein1024-960",46041:"skein1024-968",46042:"skein1024-976",46043:"skein1024-984",46044:"skein1024-992",46045:"skein1024-1000",46046:"skein1024-1008",46047:"skein1024-1016",46048:"skein1024-1024",4:"ip4",6:"tcp",33:"dccp",41:"ip6",42:"ip6zone",53:"dns",54:"dns4",55:"dns6",56:"dnsaddr",132:"sctp",273:"udp",275:"p2p-webrtc-star",276:"p2p-webrtc-direct",277:"p2p-stardust",290:"p2p-circuit",301:"udt",302:"utp",400:"unix",421:"p2p",443:"https",444:"onion",445:"onion3",446:"garlic64",447:"garlic32",460:"quic",477:"ws",478:"wss",479:"p2p-websocket-star",480:"http",85:"raw",112:"dag-pb",113:"dag-cbor",114:"libp2p-key",120:"git-raw",123:"torrent-info",124:"torrent-file",129:"leofcoin-block",130:"leofcoin-tx",131:"leofcoin-pr",144:"eth-block",145:"eth-block-list",146:"eth-tx-trie",147:"eth-tx",148:"eth-tx-receipt-trie",149:"eth-tx-receipt",150:"eth-state-trie",151:"eth-account-snapshot",152:"eth-storage-trie",176:"bitcoin-block",177:"bitcoin-tx",192:"zcash-block",193:"zcash-tx",208:"stellar-block",209:"stellar-tx",224:"decred-block",225:"decred-tx",240:"dash-block",241:"dash-tx",250:"swarm-manifest",251:"swarm-feed",297:"dag-json",47:"path",226:"ipld-ns",227:"ipfs-ns",228:"swarm-ns",237:"ed25519-pub",8417572:"holochain-adr-v0",8483108:"holochain-adr-v1",9728292:"holochain-key-v0",9793828:"holochain-key-v1",10645796:"holochain-sig-v0",10711332:"holochain-sig-v1"})},function(e,t,n){"use strict";(function(t){const r=n(35);var i={checkCIDComponents:function(e){if(null==e)return"null values are not valid CIDs";if(0!==e.version&&1!==e.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof e.codec)return"codec must be string";if(0===e.version){if("dag-pb"!==e.codec)return"codec must be 'dag-pb' for CIDv0";if("base58btc"!==e.multibaseName)return"multibaseName must be 'base58btc' for CIDv0"}if(!t.isBuffer(e.multihash))return"multihash must be a Buffer";try{r.validate(e.multihash)}catch(e){let t=e.message;return t||(t="Multihash validation failed"),t}}};e.exports=i}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports={keys:n(793),once:n(138),values:n(43),count:n(794),infinite:n(795),empty:n(106),error:n(81)}},function(e,t,n){"use strict";var r=n(43);e.exports=function(e){return r(Object.keys(e))}},function(e,t,n){"use strict";e.exports=function e(t){var n=0;return t=t||1/0,function(e,r){return e?r&&r(e):n>t?r(!0):void r(null,n++)}}},function(e,t,n){"use strict";e.exports=function e(t){return t=t||Math.random,function(e,n){return e?n&&n(e):n(null,t())}}},function(e,t,n){"use strict";e.exports={drain:n(177),onEnd:n(406),log:n(797),find:n(798),reduce:n(222),collect:n(37),concat:n(799)}},function(e,t,n){"use strict";var r=n(177);e.exports=function e(t){return r(function(e){console.log(e)},t)}},function(e,t,n){"use strict";function r(e){return e}var i=n(178),o=n(177);e.exports=function e(t,n){var s=!1;return n?t=i(t)||r:(n=t,t=r),o(function(e){if(t(e))return s=!0,n(null,e),!1},function(e){s||n(!0===e?null:e,null)})}},function(e,t,n){"use strict";var r=n(222);e.exports=function e(t){return r(function(e,t){return e+t},"",t)}},function(e,t,n){"use strict";e.exports={map:n(77),asyncMap:n(90),filter:n(78),filterNot:n(801),through:n(223),take:n(296),unique:n(408),nonUnique:n(802),flatten:n(224)}},function(e,t,n){"use strict";var r=n(407),i=n(78);e.exports=function e(t){return t=r(t),i(function(e){return!t(e)})}},function(e,t,n){"use strict";var r=n(408);e.exports=function e(t){return r(t,!0)}},function(e,t,n){"use strict";(function(t){const r=n(35);var i={checkCIDComponents:function(e){if(null==e)return"null values are not valid CIDs";if(0!==e.version&&1!==e.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof e.codec)return"codec must be string";if(!t.isBuffer(e.multihash))return"multihash must be a Buffer";try{r.validate(e.multihash)}catch(e){let t=e.message;return t||(t="Multihash validation failed"),t}}};e.exports=i}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var r=n(68),i=f(r),o=n(104),s=f(o),a=n(131),u=f(a),l=n(42),c=f(l);function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t,n){n=(0,u.default)(n||i.default);var r=(0,c.default)(e),o=function(e){if(e)return n(e);var i=(0,s.default)(arguments,1);if(t.apply(this,i))return r(o);n.apply(null,[null].concat(i))};r(o)}e.exports=t.default},function(e,t,n){"use strict"; + */function r(e,t){if(t===e)return!0;var n=e.indexOf(t);if(0===n){if("/"===t.substr(-1))return!0;if("/"===e.substr(t.length,1))return!0}return!1}t.pathMatch=r},function(e,t,n){!function(){function t(){var e=function(t,n,r){if(t=""+t,r||s===n||(e.last=t=e.batch)return l.thrash();l.batch.to||(l.batch.to=setTimeout(l.thrash,e.until||1))},c,f,h,p,d;l.batch=s(),l.batch.acks=[],l.batch.ed=0,l.thrash=function(){var t=l.thrash;if(t.ing)return t.more=!0;t.more=!1,t.ing=!0;var n=t.at=l.batch,r=0;clearTimeout(l.batch.to),l.batch=null,l.batch=s(),l.batch.acks=[],l.batch.ed=0,l.save(n,function(i,o){++r>1?e.log("RAD ERR: Radisk has callbacked multiple times, please report this as a BUG at github.com/amark/gun/issues ! "+r):(i&&e.log("err",i),a(n.acks,function(e){e(i,o)}),t.at=null,t.ing=!1,t.more&&t())})},l.save=function(t,n){var r=function e(){};r.find=function(e,t){if(!(tr.start)return r.mix(r.file||e.code.from,r.start,r.end=t),!0;r.file=t},r.mix=function(e,i,o){r.start=r.end=r.file=y,l.parse(e,function(a,u){if(a)return n(a);u=u||s(),s.map(t,function(e,t){if(!(ti))return(r.next||r.reverse)&&(s.file=e),(i=c[s.file])?(i.push({key:t,ack:n,file:s.file,opt:r}),!0):(c[s.file]=[{key:t,ack:n,file:s.file,opt:r}],s.file?(l.parse(s.file,s.it),!0):(s.it(null,y,{}),!0));s.file=e},s.it=function(t,n,r){(s.err=t)&&e.log("err",t),s.info=r,n&&(g=s.disk=n),n=c[s.file],delete c[s.file],a(n,s.ack)},s.ack=function(e){if(e.ack){var t=e.key,n=e.opt,r=s.info,i=s.disk||m,o=l.range(i(t),n),a=i.last;if(n.parsed=(n.parsed||0)+(r.parsed||0),n.chunks=(n.chunks||0)+1,n.some||(n.some=y!==o),y!==o)e.ack(s.err,o,n);else if(!e.file)return void(!n.some&&e.ack(s.err,y,n));if(!n.span){if(/*!last || */a===t)return void(!n.some&&e.ack(s.err,y,n));if(a&&a>t&&0!=a.indexOf(t))return void(!n.some&&e.ack(s.err,y,n))}n.some&&n.parsed>=n.limit||(n.next=e.file,l.read(t,e.ack,n))}},r.reverse&&(s.lex.reverse=!0),l.list(s.lex)},function(){var n={},i=String.fromCharCode(31);l.parse=function(o,u,l){var c;if(c=n[o])return c.push(u);c=n[o]=[u];var f=function e(){},h={};if(f.disk=s(),f.read=function(t,r){var i,s,s;if(delete n[o],(f.err=t)||(f.not=!r))return a(c,f.ack);if("string"!=typeof r){try{e.pack<=r.length?f.err="Chunk too big!":r=r.toString()}catch(e){f.err=e}if(f.err)return a(c,f.ack)}if(h.parsed=r.length,e.jsonify){try{var u=JSON.parse(r);return f.disk.$=u,void a(c,f.ack)}catch(e){i=e}if("{"===r[0])return f.err=i||"JSON error!",a(c,f.ack)}var i=f.split(r),l=[],p,d,m;if(!i||0!==i[1])return f.err="File '"+o+"' does not have root radix! ",a(c,f.ack);for(;i;)d=m=y,p=i[1],i=f.split(i[2])||"","#"==i[0]&&(d=i[1],l=l.slice(0,p),p<=l.length&&l.push(d)),i=f.split(i[2])||"","\n"!=i[0]&&("="!=i[0]&&":"!=i[0]||(m=i[1]),y!==d&&y!==m&&f.disk(l.join(""),m),i=f.split(i[2]));a(c,f.ack)},f.split=function(e){if(e){var n=[],r={},o=-1,s="",a,u;if(o=e.indexOf(i),e[o])return s=e.slice(0,o),n[0]=s,n[1]=a=t.decode(e.slice(o),r),n[2]=e.slice(o+r.i),n}},f.ack=function(e){if(e)return f.err||f.not?e(f.err,y,h):void e(y,f.disk,h)},l)return f.read(null,l);e.store.get(r(o),f.read)}}(),p=String.fromCharCode(28),d=r(p),l.list=function(e){if(f){var t={reverse:e.reverse?1:0};s.map(f,function(t,n){return e(n)},t)||e()}else{if(h)return h.push(e);h=[e],l.parse(p,l.list.init)}},l.list.add=function(e,t){var n=f(e);if(n||e===d)return t(y,1);f(e,!0),t.listed=(t.listed||0)+1,l.write(p,f,function(e,n){if(e)return t(e);t.listed=(t.listed||0)-1,0===t.listed&&t(y,1)},!0)},l.list.init=function(t,n){if(t)return e.log("list",t),void setTimeout(function(){l.parse(p,l.list.init)},1e3);n?l.list.drain(n):e.store.list?e.store.list(function(e){if(f=f||s(),!e)return l.list.drain(f);l.list.add(e,m)}):l.list.drain(s())},l.list.drain=function(e,t){l.list.dir=f=e,t=h,h=null,o.list.map(t,function(e){l.list(e)})};var m=function(){},g,y;return t.has[e.file]=l,l}var r,i;if(r=String.fromCharCode(31),t.encode=function(e,t,n){n=n||r;var i=n,s;if("string"==typeof e){for(var a=e.indexOf(n);-1!=a;)i+=n,a=e.indexOf(n,a+1);return i+'"'+e+n}return e&&e["#"]&&(s=o.val.link.is(e))?i+"#"+s+i:o.num.is(e)?i+"+"+(e||0)+i:null===e?i+" "+i:!0===e?i+"+"+i:!1===e?i+"-"+i:void 0},t.decode=function(e,t,n){n=n||r;var i="",s=-1,a=0,u,l;if(n===e[0]){for(;n===e[++s];)++a;for(l=e[u=a]||!0;--a>=0;)s=e.indexOf(n,s+1);return-1==s&&(s=e.length),i=e.slice(u+1,s),t&&(t.i=s+1),'"'===l?i:"#"===l?o.val.link.ify(i):"+"===l?0===i.length||parseFloat(i):" "===l?null:"-"!==l&&void 0}},"undefined"!=typeof window){var o=window.Gun,s=window.Radix;window.Radisk=t}else{var o=n(168),s=n(735);try{e.exports=t}catch(e){}}t.Radix=s}()},function(e,t,n){const r=n(115);n(765),n(773),n(1688),n(1723),n(1831),n(1984),"undefined"!=typeof window&&(window.DwebTransports=r),t=e.exports=r},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var l=e.length;u>0&&l>u&&(l=u);for(var c=0;c=0?(p=f.substr(0,h),d=f.substr(h+1)):(p=f,d=""),m=decodeURIComponent(p),g=decodeURIComponent(d),r(s,m)?i(s[m])?s[m].push(g):s[m]=[s[m],g]:s[m]=g}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),function(s){var a=encodeURIComponent(r(s))+n;return i(e[s])?o(e[s],function(e){return a+encodeURIComponent(r(e))}).join(t):a+encodeURIComponent(r(e[s]))}).join(t):a?encodeURIComponent(r(a))+n+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r{if("%%"===n)return n;a++;const o=r.formatters[i];if("function"==typeof o){const r=e[a];n=o.call(t,r),e.splice(a,1),a--}return n}),r.formatArgs.call(t,e);const u=t.log||r.log;u.apply(t,e)}return s.namespace=e,s.enabled=r.enabled(e),s.useColors=r.useColors(),s.color=t(e),s.destroy=i,s.extend=o,"function"==typeof r.init&&r.init(s),r.instances.push(s),s}function i(){const e=r.instances.indexOf(this);return-1!==e&&(r.instances.splice(e,1),!0)}function o(e,t){const n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function s(e){let t;r.save(e),r.names=[],r.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(t=0;t"-"+e)].join(",");return r.enable(""),e}function u(e){if("*"===e[e.length-1])return!0;let t,n;for(t=0,n=r.skips.length;t{r[t]=e[t]}),r.instances=[],r.names=[],r.skips=[],r.formatters={},r.selectColor=t,r.enable(r.load()),r}e.exports=r},function(e,t,n){"use strict";t.byteLength=c,t.toByteArray=h,t.fromByteArray=m;for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");-1===n&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=l(e),n=t[0],r=t[1];return 3*(n+r)/4-r}function f(e,t,n){return 3*(t+n)/4-n}function h(e){for(var t,n=l(e),r=n[0],s=n[1],a=new o(f(e,r,s)),u=0,c=s>0?r-4:r,h=0;h>16&255,a[u++]=t>>8&255,a[u++]=255&t;return 2===s&&(t=i[e.charCodeAt(h)]<<2|i[e.charCodeAt(h+1)]>>4,a[u++]=255&t),1===s&&(t=i[e.charCodeAt(h)]<<10|i[e.charCodeAt(h+1)]<<4|i[e.charCodeAt(h+2)]>>2,a[u++]=t>>8&255,a[u++]=255&t),a}function p(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function d(e,t,n){for(var r,i=[],o=t;ou?u:a+16383));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=b;var r=n(745),i=y(r),o=n(67),s=y(o),a=n(68),u=y(a),l=n(131),c=y(l),f=n(215),h=y(f),p=n(749),d=y(p),m=n(42),g=y(m);function y(e){return e&&e.__esModule?e:{default:e}}function b(e,t,n){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var r=(0,g.default)(e),o=0,a=[],l=!1;function f(e,t,n){if(null!=n&&"function"!=typeof n)throw new Error("task callback must be a function");if(y.started=!0,(0,s.default)(e)||(e=[e]),0===e.length&&y.idle())return(0,h.default)(function(){y.drain()});for(var r=0,i=e.length;r0&&a.splice(u,1),s.callback.apply(s,arguments),null!=t&&y.error(t,s.data)}o<=y.concurrency-y.buffer&&y.unsaturated(),y.idle()&&y.drain(),y.process()}}var m=!1,y={_tasks:new d.default,concurrency:t,payload:n,saturated:u.default,unsaturated:u.default,buffer:t/4,empty:u.default,drain:u.default,error:u.default,started:!1,paused:!1,push:function(e,t){f(e,!1,t)},kill:function(){y.drain=u.default,y._tasks.empty()},unshift:function(e,t){f(e,!0,t)},remove:function(e){y._tasks.remove(e)},process:function(){if(!m){for(m=!0;!y.paused&&o{this.status=r.STATUS_STARTING,e&&e(this),this.updateStatus((n,r)=>{e&&e(this),this.startHeartbeat(this.options.heartbeat),t(this)})})}async p_status(e){if(!e)return new Promise((e,t)=>{try{this.updateStatus((n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{this.updateStatus(e)}catch(t){e(t)}}updateStatus(e){this.updateInfo((t,n)=>{t?(u("Error status call to info failed %s",t.message),this.status=r.STATUS_FAILED,e(null,this.status)):(this.info=n,this.status=r.STATUS_CONNECTED,e(null,this.status))})}startHeartbeat({delay:e,statusCB:t}){e&&(u("HTTP Starting Heartbeat"),this.HTTPheartbeatTimer=setInterval(()=>{this.updateStatus((e,n)=>{t&&t(this)},(e,t)=>{})},e))}stopHeartbeat(){this.HTTPheartbeatTimer&&(u("HTTP stopping heartbeat"),clearInterval(this.HTTPheartbeatTimer))}stop(e,t){this.stopHeartbeat(),this.status=r.STATUS_FAILED,e&&e(this),t(null,this)}_cmdurl(e){return`${this.urlbase}/${e}`}_url(e,t,n){if(!e)throw new errors.CodingError(`${t}: requires url`);return"string"!=typeof e&&(e=e.href),e=e.replace("contenthash:/contenthash",this._cmdurl(t)),e=e.replace("getall/table",t),e+=n?"?"+n:"",e}validFor(e,t,n){return(this.connected()||e.protocol.startsWith("http")&&!e.href.startsWith(this.urlbase))&&this.supports(e,t,n)}async p_rawfetch(e,t={}){if(("string"==typeof e?e:e.href).includes("/getall/table"))throw new Error("Probably dont want to be calling p_rawfetch on a KeyValueTable, especially since dont know if its keyvaluetable or subclass");return await o.p_GET(this._url(e,servercommands.rawfetch),t)}p_rawlist(e){if(!e)throw new errors.CodingError("TransportHTTP.p_rawlist: requires url");return o.p_GET(this._url(e,servercommands.rawlist))}rawreverse(){throw new errors.ToBeImplementedError("Undefined function TransportHTTP.rawreverse")}async p_rawstore(e){console.assert(e,"TransportHttp.p_rawstore: requires data");const t=await o.p_POST(this._cmdurl(servercommands.rawstore),{data:e,contenttype:"application/octet-stream"});let n=s.parse(t),r=n.pathname.split("/");return`contenthash:/contenthash/${r.slice(-1)}`}p_rawadd(e,t){if(!e||!t)throw new errors.CodingError("TransportHTTP.p_rawadd: invalid parms",e,t);const n=l(t.preflight(Object.assign({},t)))+"\n";return o.p_POST(this._url(e,servercommands.rawadd),{data:n,contenttype:"application/json"})}p_newlisturls(e){let t=e._publicurls.map(e=>s.parse(e)).find(e=>"https:"===e.protocol&&["gateway.dweb.me","dweb.me"].includes(e.host)&&(e.pathname.includes("/content/rawfetch")||e.pathname.includes("/contenthash/"))||"contenthash:"===e.protocol&&"contenthash"===e.pathname.split("/")[1]);return t||(t=`contenthash:/contenthash/${e.keypair.verifyexportmultihashsha256_58()}`),[t,t]}async p_f_createReadStream(e,{wanturl:t=!1}={}){try{let n=this;return t?e:function(t){return n.createReadStream(e,t)}}catch(e){throw e}}createReadStream(e,t){let n;return u("createreadstream %s %o",s.parse(e).href,t),n=new a.PassThrough,o.p_GET(this._url(e,servercommands.rawfetch),Object.assign({wantstream:!0},t)).then(e=>e.pipe(n)).catch(e=>{console.warn(this.name,"createReadStream caught error",e.message),"function"==typeof n.destroy?n.destroy(e):n.emit("error",e)}),n}async p_createReadStream(e,t){u("createreadstream %s %o",s.parse(e).href,t);try{return await o.p_GET(this._url(e,servercommands.rawfetch),Object.assign({wantstream:!0},t))}catch(e){throw console.warn(this.name,"caught error",e),e}}async p_newdatabase(e){e.hasOwnProperty("keypair")&&(e=e.keypair.signingexport());let t=`${this.urlbase}/getall/table/${encodeURIComponent(e)}`;return{publicurl:t,privateurl:t}}async p_newtable(e,t){if(!e)throw new errors.CodingError("p_newtable currently requires a pubkey");let n=await this.p_newdatabase(e);return{privateurl:`${n.privateurl}/${t}`,publicurl:`${n.publicurl}/${t}`}}async p_set(e,t,n){if(!e||!t)throw new errors.CodingError("TransportHTTP.p_set: invalid parms",e,keyvalyes);if("string"==typeof t){let r=l([{key:t,value:n}]);await o.p_POST(this._url(e,servercommands.set),{data:r,contenttype:"application/json"})}else{let n=l(Object.keys(t).map(e=>({key:e,value:t[e]})));await o.p_POST(this._url(e,servercommands.set),{data:n,contenttype:"application/json"})}}_keyparm(e){return`key=${encodeURIComponent(e)}`}async p_get(e,t){if(!e&&t)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");let n=Array.isArray(t)?t.map(e=>this._keyparm(e)).join("&"):this._keyparm(t);const r=await o.p_GET(this._url(e,servercommands.get,n));return Array.isArray(t)?r:r[t]}async p_delete(e,t){if(!e&&t)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");let n=t.map(e=>this._keyparm(e)).join("&");await o.p_GET(this._url(e,servercommands.delete,n))}async p_keys(e){if(!e&&keys)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");return await o.p_GET(this._url(e,servercommands.keys))}async p_getall(e){if(!e&&keys)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");return await o.p_GET(this._url(e,servercommands.getall))}async p_info(){return new Promise((e,t)=>{try{this.updateInfo((n,r)=>{n?t(n):e(r)})}catch(e){t(e)}})}updateInfo(e){o.p_GET(`${this.urlbase}/info`,{retries:1},e)}static async p_test(e={}){console.log("TransportHTTP.test");try{let t=await this.p_setup(e);console.log("HTTP connected");let n=await t.p_info();console.log("TransportHTTP info=",n),n=await t.p_status(),console.assert(n===r.STATUS_CONNECTED),await t.p_test_kvt("NACL%20VERIFY")}catch(e){throw console.log("Exception thrown in TransportHTTP.test:",e.message),e}}static async test(){return this}}i._transportclasses.HTTP=c,t=e.exports=c},function(e,t){},function(e,t,n){"use strict";function r(e){for(var t=1;t0?this.tail.next=n:this.head=n,this.tail=n,++this.length},t.unshift=function e(t){var n={data:t,next:this.head};0===this.length&&(this.tail=n),this.head=n,++this.length},t.shift=function e(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.clear=function e(){this.head=this.tail=null,this.length=0},t.join=function e(t){if(0===this.length)return"";for(var n=this.head,r=""+n.data;n=n.next;)r+=t+n.data;return r},t.concat=function e(t){if(0===this.length)return s.alloc(0);for(var n=s.allocUnsafe(t>>>0),r=this.head,i=0;r;)c(r.data,n,i),i+=r.data.length,r=r.next;return n},t.consume=function e(t,n){var r;return to.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),t-=s,0===t){s===o.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(s));break}++r}return this.length-=r,i},t._getBuffer=function e(t){var n=s.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(n),t-=r.data.length;r=r.next;){var o=r.data,a=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,a),t-=a,0===t){a===o.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=o.slice(a));break}++i}return this.length-=i,n},t[l]=function(e,t){return u(this,r({},t,{depth:0,customInspect:!1}))},e}()},function(e,t){},function(e,t,n){"use strict";(function(t){var n=new Set;function r(e){if(!n.has(e)){var r=e+" is an experimental feature. This feature could change at any time";n.add(e),t.emitWarning(r,"ExperimentalWarning")}}function i(){}e.exports.emitExperimentalWarning=t.emitWarning?r:i}).call(this,n(2))},function(e,t,n){"use strict";(function(t){var r;function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var o=n(294),s=Symbol("lastResolve"),a=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),c=Symbol("lastPromise"),f=Symbol("handlePromise"),h=Symbol("stream");function p(e,t){return{value:e,done:t}}function d(e){var t=e[s];if(null!==t){var n=e[h].read();null!==n&&(e[c]=null,e[s]=null,e[a]=null,t(p(n,!1)))}}function m(e){t.nextTick(d,e)}function g(e,t){return function(n,r){e.then(function(){t[l]?n(p(void 0,!0)):t[f](n,r)},r)}}var y=Object.getPrototypeOf(function(){}),b=Object.setPrototypeOf((r={get stream(){return this[h]},next:function e(){var n=this,r=this[u];if(null!==r)return Promise.reject(r);if(this[l])return Promise.resolve(p(void 0,!0));if(this[h].destroyed)return new Promise(function(e,r){t.nextTick(function(){n[u]?r(n[u]):e(p(void 0,!0))})});var i=this[c],o;if(i)o=new Promise(g(i,this));else{var s=this[h].read();if(null!==s)return Promise.resolve(p(s,!1));o=new Promise(this[f])}return this[c]=o,o}},i(r,Symbol.asyncIterator,function(){return this}),i(r,"return",function e(){var t=this;return new Promise(function(e,n){t[h].destroy(null,function(t){t?n(t):e(p(void 0,!0))})})}),r),y),v=function e(t){var n,r=Object.create(b,(n={},i(n,h,{value:t,writable:!0}),i(n,s,{value:null,writable:!0}),i(n,a,{value:null,writable:!0}),i(n,u,{value:null,writable:!0}),i(n,l,{value:t._readableState.endEmitted,writable:!0}),i(n,f,{value:function e(t,n){var i=r[h].read();i?(r[c]=null,r[s]=null,r[a]=null,t(p(i,!1))):(r[s]=t,r[a]=n)},writable:!0}),n));return r[c]=null,o(t,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[a];return null!==t&&(r[c]=null,r[s]=null,r[a]=null,t(e)),void(r[u]=e)}var n=r[s];null!==n&&(r[c]=null,r[s]=null,r[a]=null,n(p(void 0,!0))),r[l]=!0}),t.on("readable",m.bind(null,r)),r};e.exports=v}).call(this,n(2))},function(e,t,n){"use strict";e.exports=i;var r=n(401);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}n(1)(i,r),i.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){"use strict";var r;function i(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var o=n(135).codes,s=o.ERR_MISSING_ARGS,a=o.ERR_STREAM_DESTROYED;function u(e){if(e)throw e}function l(e){return e.setHeader&&"function"==typeof e.abort}function c(e,t,o,s){s=i(s);var u=!1;e.on("close",function(){u=!0}),void 0===r&&(r=n(294)),r(e,{readable:t,writable:o},function(e){if(e)return s(e);u=!0,s()});var c=!1;return function(t){if(!u&&!c)return c=!0,l(e)?e.abort():"function"==typeof e.destroy?e.destroy():void s(t||new a("pipe"))}}function f(e){e()}function h(e,t){return e.pipe(t)}function p(e){return e.length?"function"!=typeof e[e.length-1]?u:e.pop():u}function d(){for(var e=arguments.length,t=new Array(e),n=0;n0;return c(e,s,a,function(e){i||(i=e),e&&o.forEach(f),s||(o.forEach(f),r(i))})});return t.reduce(h)}e.exports=d},function(e,t,n){(function(r,i){const o=n(289),s=n(5)("dweb-transports:ipfs"),a=n(774),u=n(1459),l=n(9),c=n(48),f=n(32),h=n(20),p=n(98),d=n(134),m=n(115),g=n(170),y={repo:"/tmp/dweb_ipfsv3107",config:{Bootstrap:["/dns4/dweb.me/tcp/4245/wss/ipfs/QmQz3p44VVQDeAieaW28DMjcTVzLbpxqaQB9bkXnyd7HY5"]},EXPERIMENTAL:{pubsub:!0},preload:{enabled:!1}};class b extends d{constructor(e){super(e),["urlUrlstore","httpIPFSgateway"].forEach(t=>{this[t]=e[t],delete e[t]}),this.ipfs=void 0,this.options=e,this.name="IPFS",this.supportURLs=["ipfs"],this.supportFunctions=["fetch","store","seed","createReadStream"],this.supportFeatures=["noCache"],this.status=d.STATUS_LOADED}_ipfsversion(e,t,n){e.version((r,i)=>{r?(s("IPFS via %s present but unresponsive: %o",t,i),this.ipfstype="FAILED",n(r)):(s("IPFS available via %s: %o",t,i),this.ipfstype=t,n(null,e))})}IPFSAutoConnect(e){if(r.ipfs)this._ipfsversion(r.ipfs,"global.ipfs",e);else if("undefined"!=typeof window&&window.ipfs)this._ipfsversion(window.ipfs,"window.ipfs",e);else{var t=u("localhost","5001",{protocol:"http"});t.version((n,r)=>{n?(s("IPFS via API failed %s, trying running own IPFS client",n.message),t=new a(this.options),t.on("ready",()=>{this._ipfsversion(t,"client",e)}),t.on("error",t=>{s("IPFS via client error %s",t.message),e(t)})):this._ipfsversion(t,"API",e)})}}static setup0(e){const t=d.mergeoptions(y,e.ipfs);s("setup options=%o",t);const n=new b(t);return m.addtransport(n),n}p_setup1(e,t){if(!t)return new Promise((e,t)=>{try{n.call(this,(n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{n.call(this,t)}catch(e){t(e)}function n(t){this.status=d.STATUS_STARTING,e&&e(this),this.IPFSAutoConnect((n,r)=>{n?(s("Failed to connect %s",n.message),this.status=d.STATUS_FAILED):(this.ipfs=r,this.status=d.STATUS_CONNECTED),e&&e(this),t(null,this)})}}p_setup2(e){return this.status===d.STATUS_FAILED&&s("Stage 1 failed, skipping"),this}stop(e,t){"client"===this.ipfstype?this.ipfs.stop((n,r)=>{this.status=d.STATUS_FAILED,e&&e(this),t(n,r)}):(this.status=d.STATUS_FAILED,e&&e(this),t(miull,this))}async p_status(){return this.status=await this.ipfs.isOnline()?d.STATUS_CONNECTED:d.STATUS_FAILED,super.p_status()}static urlFrom(e){if(e instanceof l)return"ipfs:/ipfs/"+e.toBaseEncodedString();if("object"==typeof e&&e.hash)return"ipfs:/ipfs/"+e.hash;if("string"==typeof e)return"ipfs:/ipfs/"+e;throw new p.CodingError("TransportIPFS.urlFrom: Cant convert to url from",e)}static cidFrom(e){if(e instanceof l)return e;if("string"==typeof e&&(e=f.parse(e)),e&&e.pathname){const t=e.pathname.split("/");if(!["ipfs:","dweb:"].includes(e.protocol)||"ipfs"!==t[1]||t.length<3)throw new p.TransportError("TransportIPFS.cidFrom bad format for url should be dweb: or ipfs:/ipfs/...: "+e.href);if(t.length>3)throw new p.TransportError("TransportIPFS.cidFrom not supporting paths in url yet, should be dweb: or ipfs:/ipfs/...: "+e.href);return new l(t[2])}throw new p.CodingError("TransportIPFS.cidFrom: Cant convert url",e)}static _stringFrom(e){return e instanceof l?"/ipfs/"+e.toBaseEncodedString():"object"==typeof e&&e.path?e.path:void 0}static ipfsFrom(e){if(e=this._stringFrom(e),e.indexOf("/ipfs/")>-1)return e.slice(e.indexOf("/ipfs/"));throw new p.CodingError(`TransportIPFS.ipfsFrom: Cant convert url ${e} into a path starting /ipfs/`)}ipfsGatewayFrom(e){if(e=this._stringFrom(e),e.indexOf("/ipfs/")>-1)return this.httpIPFSgateway+e.slice(e.indexOf("/ipfs/"));throw new p.CodingError(`TransportIPFS.ipfsGatewayFrom: Cant convert url ${e} into a path starting /ipfs/`)}static multihashFrom(e){if(e instanceof l)return e.toBaseEncodedString();if("object"==typeof e&&e.path&&(e=e.path),"string"==typeof e){const t=e.indexOf("/ipfs/");if(t>-1)return e.slice(t+6)}throw new p.CodingError(`Cant turn ${e} into a multihash`)}async p_rawfetch(e,{timeoutMS:t=6e4,relay:n=!1}={}){if(!e)throw new p.CodingError("TransportIPFS.p_rawfetch: requires url");const r=b.cidFrom(e),i=b.ipfsFrom(e);try{const n=await g.p_timeout(this.ipfs.dag.get(r),t,"Timed out IPFS fetch of "+b._stringFrom(r));if(n.remainderPath.length)throw new p.TransportError("Not yet supporting paths in p_rawfetch");let a;return"DAGNode"===n.value.constructor.name?a=await this.ipfs.cat(i):(s("Found a raw IPFS block (unusual) - not a DAGNode - handling as such"),a=n.value),a}catch(n){if(s("Caught error '%s' fetching via IPFS",n.message),!this.httpIPFSgateway)throw n;try{s("Trying IPFS HTTP gateway");let n=this.ipfsGatewayFrom(e);return await g.p_timeout(o.p_GET(n),t,"Timed out IPFS fetch of "+n)}catch(e){throw e}}}async p_rawstore(e){console.assert(e,"TransportIPFS.p_rawstore: requires data");const t=e instanceof i?e:new i(e),n=(await this.ipfs.add(t,{"cid-version":1,hashAlg:"sha2-256"}))[0];return b.urlFrom(n)}seed({directoryPath:e,fileRelativePath:t,ipfsHash:n,urlToFile:r},i){if(this.urlUrlstore&&r){const e=`${this.urlUrlstore}?arg=${encodeURIComponent(r)}`;o.p_GET(e,{retries:0},(e,t)=>{e?(s("IPFS.seed for %s failed in http: %s",r,e.message),i(e)):(s("Added %s to IPFS key=",r,t.Key),n&&n!==t.Key&&s("ipfs hash doesnt match expected metadata has %s daemon returned %s",n,t.Key),i(null,t))})}else s("IPFS.seed support requires urlUrlstore and urlToFile"),i(new Error("IPFS.seed support requires urlUrlstore and urlToFile"))}async p_f_createReadStream(e,{wanturl:t=!1}={}){let n;try{let r=e.pathname.split("/ipfs/")[1];if(r.includes("/"))throw new CodingError("Should not be seeing URLS with a path here:"+e);let i=this;return t?e:function e(t){s("reading from stream %o %o",r,t||"");const o=t?t.start:0,a=t&&t.end?o+t.end+1:void 0;return n&&n.destroy&&n.destroy(),n=i.ipfs.catReadableStream(r,{offset:o,length:a&&a-o}),n.on("error",e=>console.error(e)),n}}catch(e){throw n&&n.destroy&&n.destroy(),e}}static async p_test(e){console.log("TransportIPFS.test");try{const t=await this.p_setup(e);console.log(t.name,"setup");const n=await t.p_status();let r;console.assert(n===d.STATUS_CONNECTED);const i="The quick brown fox",o="ipfs:/ipfs/zdpuAscRnisRkYnEyJAp1LydQ3po25rCEDPPEDMymYRfN1yPK",s="1114",a=await t.p_rawstore(i);console.log("rawstore returned",a);const u=b.cidFrom(a);console.assert(a===o,"url should match url from rawstore");const l=a.split("/")[2],c=b.urlFrom(u);console.assert(a===c,"Should round trip"),r=a;const f=await t.p_rawfetch(r);return console.assert(f.toString()===i,"Should fetch block stored above"),t}catch(e){throw console.log("Exception thrown in TransportIPFS.test:",e.message),e}}}m._transportclasses.IPFS=b,t=e.exports=b}).call(this,n(8),n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(402),o=n(775),s=n(23),a=n(44),u=n(64),l=n(65),c=n(24),f=n(35),h=n(484),p=n(89),d=n(9),m=n(5),g=n(182),y=n(6),b=n(959),v=n(961),w=n(962),_=n(1321),k=n(1322),S=n(1326),E={get"bitcoin-block"(){return n(1327)},get"eth-account-snapshot"(){return n(126).ethAccountSnapshot},get"eth-block"(){return n(126).ethBlock},get"eth-block-list"(){return n(126).ethBlockList},get"eth-state-trie"(){return n(126).ethStateTrie},get"eth-storage-trie"(){return n(126).ethStorageTrie},get"eth-tx"(){return n(126).ethTx},get"eth-tx-trie"(){return n(126).ethTxTrie},get"git-raw"(){return n(1424)},get"zcash-block"(){return n(1430)}};class x extends y{constructor(e){super();const t={init:!0,start:!0,EXPERIMENTAL:{},preload:{enabled:!0,addresses:["/dnsaddr/node0.preload.ipfs.io/https","/dnsaddr/node1.preload.ipfs.io/https"]}};e=b.validate(e||{}),this._options=g(e,t),!1===e.init&&(this._options.init=!1),!1!==e.start&&(this._options.start=!0),"string"==typeof e.repo||void 0===e.repo?this._repo=_(e.repo):this._repo=e.repo,this.log=m("jsipfs"),this.log.err=m("jsipfs:err"),this.types={Buffer:r,PeerId:s,PeerInfo:a,multiaddr:c,multibase:p,multihash:f,CID:d},this._peerInfoBook=new h,this._peerInfo=void 0,this._bitswap=void 0,this._blockService=new i(this._repo),this._ipld=new o({blockService:this._blockService,loadFormat:(e,t)=>{if(this.log("Loading IPLD format",e),E[e])return t(null,E[e]);t(new Error(`Missing IPLD format "${e}"`))}}),this._preload=k(this),this._mfsPreload=S(this),this._ipns=void 0,this._print=this._options.silent?this.log:console.log,this.init=w.init(this),this.preStart=w.preStart(this),this.start=w.start(this),this.stop=w.stop(this),this.shutdown=this.stop,this.isOnline=w.isOnline(this),Object.assign(this,w.filesRegular(this)),this.version=w.version(this),this.id=w.id(this),this.repo=w.repo(this),this.bootstrap=w.bootstrap(this),this.config=w.config(this),this.block=w.block(this),this.object=w.object(this),this.dag=w.dag(this),this.files=w.filesMFS(this),this.libp2p=null,this.swarm=w.swarm(this),this.name=w.name(this),this.bitswap=w.bitswap(this),this.pin=w.pin(this),this.ping=w.ping(this),this.pingPullStream=w.pingPullStream(this),this.pingReadableStream=w.pingReadableStream(this),this.pubsub=w.pubsub(this),this.dht=w.dht(this),this.dns=w.dns(this),this.key=w.key(this),this.stats=w.stats(this),this.resolve=w.resolve(this),this._options.EXPERIMENTAL.pubsub&&this.log("EXPERIMENTAL pubsub is enabled"),this._options.EXPERIMENTAL.ipnsPubsub&&(this._options.EXPERIMENTAL.pubsub||(this.log("EXPERIMENTAL pubsub is enabled to use IPNS pubsub"),this._options.EXPERIMENTAL.pubsub=!0),this.log("EXPERIMENTAL IPNS pubsub is enabled")),this._options.EXPERIMENTAL.sharding&&this.log("EXPERIMENTAL sharding is enabled"),this._options.EXPERIMENTAL.dht&&this.log("EXPERIMENTAL Kademlia DHT is enabled"),this.state=n(1458)(this),this.util={crypto:u,isIPFS:l},v(this)}}t=e.exports=x,t.createNode=(e=>new x(e))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(137),i=n(26),o=n(9),s=n(409),a=n(225),u=n(402),l=n(61).join,c=n(61).sep,f=n(70).source,h=n(438),p=n(88),d=n(40),m=n(11),g=n(33).MemoryDatastore,y=n(439),b=n(304),v=n(38),w=n(890);function _(){}class k{constructor(e){const t=y(k.defaultOptions,e);if(!t.blockService)throw new Error("Missing blockservice");this.bs=t.blockService,this.resolvers={},this.support={},this.support.add=((e,t,n)=>{if(this.resolvers[e])throw new Error('Resolver already exists for codec "'+e+'"');this.resolvers[e]={resolver:t,util:n}}),this.support.load=t.loadFormat||((e,t)=>{t(new Error(`No resolver found for codec "${e}"`))}),this.support.rm=(e=>{this.resolvers[e]&&delete this.resolvers[e]});for(const e of t.formats){const{resolver:t,util:n}=e,r=t.multicodec;this.support.add(r,t,n)}}get(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n={}),"string"==typeof t&&(t=l("/",t).substr(1).split(c).join("/")),""===t||!t)return this._get(e,(t,n)=>{if(t)return r(t);r(null,{value:n,remainderPath:"",cid:e})});let i;s(n=>{this._getFormat(e.codec,(r,o)=>{if(r)return n(r);this.bs.get(e,(e,r)=>{if(e)return n(e);o.resolver.resolve(r.data,t,(e,r)=>{if(e)return n(e);i=r.value,t=r.remainderPath,n()})})})},()=>{const r=!t||""===t||"/"===t,o=i&&!k._maybeCID(i);return r&&o||n.localResolve?(e=k._maybeCID(i)||e,!0):(i=k._maybeCID(i),i&&(e=i),!1)},(n,o)=>n?r(n):r(null,{value:i,remainderPath:t,cid:e}))}getStream(e,t,n){const r=f();return this.get(e,t,n,(e,t)=>{if(e)return r.resolve(i.error(e));r.resolve(i.values([t]))}),r}getMany(e,t){if(!Array.isArray(e))return t(new Error("Argument must be an array of CIDs"));this.bs.getMany(e,(e,n)=>{if(e)return t(e);p(n,(e,t)=>{this._getFormat(e.cid.codec,(n,r)=>{if(n)return t(n);r.util.deserialize(e.data,t)})},t)})}put(e,t,n){return"function"==typeof t?(n=t,setImmediate(()=>n(new Error("IPLDResolver.put requires options")))):(n=n||_,t.cid&&o.isCID(t.cid)?t.onlyHash?setImmediate(()=>n(null,t.cid)):this._put(t.cid,e,n):void this._getFormat(t.format,(r,i)=>{if(r)return n(r);i.util.cid(e,t,(r,i)=>r?n(r):t.onlyHash?n(null,i):void this._put(i,e,n))}))}treeStream(e,t,n){let r;return"object"==typeof t&&(n=t,t=void 0),n=n||{},n.recursive||(r=f(),m([t=>this._getFormat(e.codec,t),(t,n)=>this.bs.get(e,(e,r)=>{if(e)return n(e);n(null,t,r)}),(e,t,n)=>e.resolver.tree(t.data,n)],(e,t)=>{if(e)return r.abort(e),r;r.resolve(i.values(t))})),n.recursive&&(r=i(h.widthFirst({basePath:null,cid:e},e=>{if("string"==typeof e)return i.empty();const t=f(),n=e.cid;return m([e=>this._getFormat(n.codec,e),(e,t)=>this.bs.get(n,(n,r)=>{if(n)return t(n);t(null,e,r)}),(e,t,n)=>e.resolver.tree(t.data,(r,i)=>{if(r)return n(r);p(i,(n,r)=>{e.resolver.isLink(t.data,n,(e,t)=>{if(e)return r(e);r(null,{path:n,link:t})})},n)})],(n,r)=>{if(n)return t.abort(n),t;t.resolve(i.values(r.map(t=>{const n=e.basePath?e.basePath+"/"+t.path:t.path;return t.link?{basePath:n,cid:k._maybeCID(t.link)}:n})))}),t}),i.map(e=>"string"==typeof e?e:e.basePath),i.filter(Boolean))),t?i(r,i.map(e=>{if(0===e.indexOf(t))return e=e.slice(t.length+1),e}),i.filter(Boolean)):r}remove(e,t){this.bs.delete(e,t)}_get(e,t){m([t=>this._getFormat(e.codec,t),(t,n)=>this.bs.get(e,(e,r)=>{if(e)return n(e);n(null,t,r)}),(e,t,n)=>{e.util.deserialize(t.data,(e,t)=>{if(e)return n(e);n(null,t)})}],t)}_getFormat(e,t){if(this.resolvers[e])return t(null,this.resolvers[e]);this.support.load(e,(n,r)=>{if(n)return t(n);this.resolvers[e]=r,t(null,r)})}_put(e,t,n){n=n||_,m([t=>this._getFormat(e.codec,t),(e,n)=>e.util.serialize(t,n),(t,n)=>this.bs.put(new r(t,e),n)],t=>{if(t)return n(t);n(null,e)})}static _maybeCID(e){return o.isCID(e)?e:e&&void 0!==e["/"]?new o(e["/"]):null}}k.defaultOptions={formats:[b,v,w]},k.inMemory=function(e){const t=new a("in-memory",{storageBackends:{root:g,blocks:g,datastore:g},lock:"memory"}),n=new u(t);d([e=>t.init({},e),e=>t.open(e)],t=>{if(t)return e(t);e(null,new k({blockService:n}))})},e.exports=k},function(e,t,n){"use strict";(function(t){const r=n(35),i=n(89),o=n(295),s=n(176),a=n(791),u=n(53);class l{constructor(e,n,s,a){if(c.isCID(e)){const n=e;return this.version=n.version,this.codec=n.codec,this.multihash=t.from(n.multihash),void(this.multibaseName=n.multibaseName||(0===n.version?"base58btc":"base32"))}if("string"==typeof e){const t=i.isEncoded(e);if(t){const n=i.decode(e);this.version=parseInt(n.slice(0,1).toString("hex"),16),this.codec=o.getCodec(n.slice(1)),this.multihash=o.rmPrefix(n.slice(1)),this.multibaseName=t}else this.version=0,this.codec="dag-pb",this.multihash=r.fromB58String(e),this.multibaseName="base58btc";return l.validateCID(this),void Object.defineProperty(this,"string",{value:e})}if(t.isBuffer(e)){const t=e.slice(0,1),n=parseInt(t.toString("hex"),16);if(1===n){const t=e;this.version=n,this.codec=o.getCodec(t.slice(1)),this.multihash=o.rmPrefix(t.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=e,this.multibaseName="base58btc";l.validateCID(this)}else this.version=e,this.codec=n,this.multihash=s,this.multibaseName=a||(0===e?"base58btc":"base32"),l.validateCID(this)}get buffer(){let e=this._buffer;if(!e){if(0===this.version)e=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");e=t.concat([t.from("01","hex"),o.getCodeVarint(this.codec),this.multihash])}Object.defineProperty(this,"_buffer",{value:e})}return e}get prefix(){return t.concat([t.from(`0${this.version}`,"hex"),o.getCodeVarint(this.codec),r.prefix(this.multihash)])}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:t}=r.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==t)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new c(0,this.codec,this.multihash)}toV1(){return new c(1,this.codec,this.multihash)}toBaseEncodedString(e=this.multibaseName){if(this.string&&e===this.multibaseName)return this.string;let t=null;if(0===this.version){if("base58btc"!==e)throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");t=r.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");t=i.encode(e,this.buffer).toString()}return e===this.multibaseName&&Object.defineProperty(this,"string",{value:t}),t}toString(e){return this.toBaseEncodedString(e)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(e){return this.codec===e.codec&&this.version===e.version&&this.multihash.equals(e.multihash)}static validateCID(e){let t=a.checkCIDComponents(e);if(t)throw new Error(t)}}const c=u(l,{className:"CID",symbolName:"@ipld/js-cid/CID"});c.codecs=s,e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){const r=n(4).Buffer;e.exports=function e(t){if(t.length>=255)throw new TypeError("Alphabet too long");const n=new Uint8Array(256);n.fill(255);for(let e=0;e>>0,f=new Uint8Array(c);for(;u!==l;){let t=e[u],n=0;for(let e=c-1;(0!==t||n>>0,f[e]=t%i>>>0,t=t/i>>>0;if(0!==t)throw new Error("Non-zero carry");s=n,u++}let h=c-s;for(;h!==c&&0===f[h];)h++;let p=o.repeat(n);for(;h>>0,c=new Uint8Array(l);for(;e[t];){let r=n[e.charCodeAt(t)];if(255===r)return;let o=0;for(let e=l-1;(0!==r||o>>0,c[e]=r%256>>>0,r=r/256>>>0;if(0!==r)throw new Error("Non-zero carry");u=o,t++}if(" "===e[t])return;let f=l-u;for(;f!==l&&0===c[f];)f++;const h=r.allocUnsafe(a+(l-f));h.fill(0,0,a);let p=a;for(;f!==l;)h[p++]=c[f++];return h}function c(e){const t=l(e);if(t)return t;throw new Error("Non-base"+i+" character")}return{encode:u,decodeUnsafe:l,decode:c}}},function(e,t){e.exports=s;var n=128,r=127,i=-128,o=Math.pow(2,31);function s(e,t,r){t=t||[],r=r||0;for(var a=r;e>=o;)t[r++]=255&e|n,e/=128;for(;e&i;)t[r++]=255&e|n,e>>>=7;return t[r]=0|e,s.bytes=r-a+1,t}},function(e,t){e.exports=i;var n=128,r=127;function i(e,t){var o=0,t=t||0,s=0,a=t,u,l=e.length;do{if(a>=l)throw i.bytes=0,new RangeError("Could not decode varint");u=e[a++],o+=s<28?(u&r)<=n);return i.bytes=a-t,o}},function(e,t){var n=Math.pow(2,7),r=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),s=Math.pow(2,35),a=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),c=Math.pow(2,63);e.exports=function(e){return e(e[t[0]]=new r(t[0],t[1],t[2],t[3]),e),{}),c=u.reduce((e,t)=>(e[t[1]]=l[t[0]],e),{});e.exports={names:l,codes:c}},function(e,t,n){"use strict";class r{constructor(e,t,n,r){this.name=e,this.code=t,this.alphabet=r,n&&r&&(this.engine=n(r))}encode(e){return this.engine.encode(e)}decode(e){return this.engine.decode(e)}isImplemented(){return this.engine}}e.exports=r},function(e,t,n){var r=n(4).Buffer;e.exports=function e(t){for(var n={},i=t.length,o=t.charAt(0),s=0;s0;)n.push(a%i),a=a/i|0}for(var u="",l=0;0===e[l]&&l=0;--c)u+=t[n[c]];return u}function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return r.allocUnsafe(0);for(var t=[0],s=0;s>=8;for(;l>0;)t.push(255&l),l>>=8}for(var c=0;e[c]===o&&c"string"==typeof e?t.from(e).toString("hex"):e.toString("hex"),decode(e){for(let t of e)if(n.indexOf(t)<0)throw new Error("invalid base16 character");return t.from(e,"hex")}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){function n(e,t){e=e.replace(new RegExp("=","g"),"");let n=e.length,r=0,i=0,o=0,s=new Uint8Array(5*n/8|0);for(let a=0;a=8&&(s[o++]=i>>>r-8&255,r-=8);return s.buffer}function r(e,t){let n=e.byteLength,r=new Uint8Array(e),i=t.indexOf("=")===t.length-1;i&&(t=t.substring(0,t.length-2));let o=0,s=0,a="";for(let e=0;e=5;)a+=t[s>>>o-5&31],o-=5;if(o>0&&(a+=t[s<<5-o&31]),i)for(;a.length%8!=0;)a+="=";return a}e.exports=function e(i){return{encode:e=>r("string"==typeof e?t.from(e):e,i),decode(e){for(let t of e)if(i.indexOf(t)<0)throw new Error("invalid base32 character");return n(e,i)}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){e.exports=function e(n){const r=n.indexOf("=")>-1,i=n.indexOf("-")>-1&&n.indexOf("_")>-1;return{encode(e){let n="";n="string"==typeof e?t.from(e).toString("base64"):e.toString("base64"),i&&(n=n.replace(/\+/g,"-").replace(/\//g,"_"));const o=n.indexOf("=");return o>0&&!r&&(n=n.substring(0,o)),n},decode(e){for(let t of e)if(n.indexOf(t)<0)throw new Error("invalid base64 character");return t.from(e,"base64")}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(176),i=n(404).varintBufferEncode,o={};e.exports=o;for(let e in r){let t=r[e];o[e]=i(t)}},function(e,t,n){"use strict";const r=n(176),i={};e.exports=i;for(let e in r){let t=r[e];i[t.toString("hex")]=e}},function(e,t,n){"use strict";e.exports=Object.freeze({PROTOBUF:80,CBOR:81,RLP:96,BENCODE:99,MULTICODEC:48,MULTIHASH:49,MULTIADDR:50,MULTIBASE:51,IDENTITY:0,SHA1:17,SHA2_256:18,SHA2_512:19,SHA3_512:20,SHA3_384:21,SHA3_256:22,SHA3_224:23,SHAKE_128:24,SHAKE_256:25,KECCAK_224:26,KECCAK_256:27,KECCAK_384:28,KECCAK_512:29,MURMUR3_128:34,MURMUR3_32:35,DBL_SHA2_256:86,MD4:212,MD5:213,BMT:214,X11:4352,BLAKE2B_8:45569,BLAKE2B_16:45570,BLAKE2B_24:45571,BLAKE2B_32:45572,BLAKE2B_40:45573,BLAKE2B_48:45574,BLAKE2B_56:45575,BLAKE2B_64:45576,BLAKE2B_72:45577,BLAKE2B_80:45578,BLAKE2B_88:45579,BLAKE2B_96:45580,BLAKE2B_104:45581,BLAKE2B_112:45582,BLAKE2B_120:45583,BLAKE2B_128:45584,BLAKE2B_136:45585,BLAKE2B_144:45586,BLAKE2B_152:45587,BLAKE2B_160:45588,BLAKE2B_168:45589,BLAKE2B_176:45590,BLAKE2B_184:45591,BLAKE2B_192:45592,BLAKE2B_200:45593,BLAKE2B_208:45594,BLAKE2B_216:45595,BLAKE2B_224:45596,BLAKE2B_232:45597,BLAKE2B_240:45598,BLAKE2B_248:45599,BLAKE2B_256:45600,BLAKE2B_264:45601,BLAKE2B_272:45602,BLAKE2B_280:45603,BLAKE2B_288:45604,BLAKE2B_296:45605,BLAKE2B_304:45606,BLAKE2B_312:45607,BLAKE2B_320:45608,BLAKE2B_328:45609,BLAKE2B_336:45610,BLAKE2B_344:45611,BLAKE2B_352:45612,BLAKE2B_360:45613,BLAKE2B_368:45614,BLAKE2B_376:45615,BLAKE2B_384:45616,BLAKE2B_392:45617,BLAKE2B_400:45618,BLAKE2B_408:45619,BLAKE2B_416:45620,BLAKE2B_424:45621,BLAKE2B_432:45622,BLAKE2B_440:45623,BLAKE2B_448:45624,BLAKE2B_456:45625,BLAKE2B_464:45626,BLAKE2B_472:45627,BLAKE2B_480:45628,BLAKE2B_488:45629,BLAKE2B_496:45630,BLAKE2B_504:45631,BLAKE2B_512:45632,BLAKE2S_8:45633,BLAKE2S_16:45634,BLAKE2S_24:45635,BLAKE2S_32:45636,BLAKE2S_40:45637,BLAKE2S_48:45638,BLAKE2S_56:45639,BLAKE2S_64:45640,BLAKE2S_72:45641,BLAKE2S_80:45642,BLAKE2S_88:45643,BLAKE2S_96:45644,BLAKE2S_104:45645,BLAKE2S_112:45646,BLAKE2S_120:45647,BLAKE2S_128:45648,BLAKE2S_136:45649,BLAKE2S_144:45650,BLAKE2S_152:45651,BLAKE2S_160:45652,BLAKE2S_168:45653,BLAKE2S_176:45654,BLAKE2S_184:45655,BLAKE2S_192:45656,BLAKE2S_200:45657,BLAKE2S_208:45658,BLAKE2S_216:45659,BLAKE2S_224:45660,BLAKE2S_232:45661,BLAKE2S_240:45662,BLAKE2S_248:45663,BLAKE2S_256:45664,SKEIN256_8:45825,SKEIN256_16:45826,SKEIN256_24:45827,SKEIN256_32:45828,SKEIN256_40:45829,SKEIN256_48:45830,SKEIN256_56:45831,SKEIN256_64:45832,SKEIN256_72:45833,SKEIN256_80:45834,SKEIN256_88:45835,SKEIN256_96:45836,SKEIN256_104:45837,SKEIN256_112:45838,SKEIN256_120:45839,SKEIN256_128:45840,SKEIN256_136:45841,SKEIN256_144:45842,SKEIN256_152:45843,SKEIN256_160:45844,SKEIN256_168:45845,SKEIN256_176:45846,SKEIN256_184:45847,SKEIN256_192:45848,SKEIN256_200:45849,SKEIN256_208:45850,SKEIN256_216:45851,SKEIN256_224:45852,SKEIN256_232:45853,SKEIN256_240:45854,SKEIN256_248:45855,SKEIN256_256:45856,SKEIN512_8:45857,SKEIN512_16:45858,SKEIN512_24:45859,SKEIN512_32:45860,SKEIN512_40:45861,SKEIN512_48:45862,SKEIN512_56:45863,SKEIN512_64:45864,SKEIN512_72:45865,SKEIN512_80:45866,SKEIN512_88:45867,SKEIN512_96:45868,SKEIN512_104:45869,SKEIN512_112:45870,SKEIN512_120:45871,SKEIN512_128:45872,SKEIN512_136:45873,SKEIN512_144:45874,SKEIN512_152:45875,SKEIN512_160:45876,SKEIN512_168:45877,SKEIN512_176:45878,SKEIN512_184:45879,SKEIN512_192:45880,SKEIN512_200:45881,SKEIN512_208:45882,SKEIN512_216:45883,SKEIN512_224:45884,SKEIN512_232:45885,SKEIN512_240:45886,SKEIN512_248:45887,SKEIN512_256:45888,SKEIN512_264:45889,SKEIN512_272:45890,SKEIN512_280:45891,SKEIN512_288:45892,SKEIN512_296:45893,SKEIN512_304:45894,SKEIN512_312:45895,SKEIN512_320:45896,SKEIN512_328:45897,SKEIN512_336:45898,SKEIN512_344:45899,SKEIN512_352:45900,SKEIN512_360:45901,SKEIN512_368:45902,SKEIN512_376:45903,SKEIN512_384:45904,SKEIN512_392:45905,SKEIN512_400:45906,SKEIN512_408:45907,SKEIN512_416:45908,SKEIN512_424:45909,SKEIN512_432:45910,SKEIN512_440:45911,SKEIN512_448:45912,SKEIN512_456:45913,SKEIN512_464:45914,SKEIN512_472:45915,SKEIN512_480:45916,SKEIN512_488:45917,SKEIN512_496:45918,SKEIN512_504:45919,SKEIN512_512:45920,SKEIN1024_8:45921,SKEIN1024_16:45922,SKEIN1024_24:45923,SKEIN1024_32:45924,SKEIN1024_40:45925,SKEIN1024_48:45926,SKEIN1024_56:45927,SKEIN1024_64:45928,SKEIN1024_72:45929,SKEIN1024_80:45930,SKEIN1024_88:45931,SKEIN1024_96:45932,SKEIN1024_104:45933,SKEIN1024_112:45934,SKEIN1024_120:45935,SKEIN1024_128:45936,SKEIN1024_136:45937,SKEIN1024_144:45938,SKEIN1024_152:45939,SKEIN1024_160:45940,SKEIN1024_168:45941,SKEIN1024_176:45942,SKEIN1024_184:45943,SKEIN1024_192:45944,SKEIN1024_200:45945,SKEIN1024_208:45946,SKEIN1024_216:45947,SKEIN1024_224:45948,SKEIN1024_232:45949,SKEIN1024_240:45950,SKEIN1024_248:45951,SKEIN1024_256:45952,SKEIN1024_264:45953,SKEIN1024_272:45954,SKEIN1024_280:45955,SKEIN1024_288:45956,SKEIN1024_296:45957,SKEIN1024_304:45958,SKEIN1024_312:45959,SKEIN1024_320:45960,SKEIN1024_328:45961,SKEIN1024_336:45962,SKEIN1024_344:45963,SKEIN1024_352:45964,SKEIN1024_360:45965,SKEIN1024_368:45966,SKEIN1024_376:45967,SKEIN1024_384:45968,SKEIN1024_392:45969,SKEIN1024_400:45970,SKEIN1024_408:45971,SKEIN1024_416:45972,SKEIN1024_424:45973,SKEIN1024_432:45974,SKEIN1024_440:45975,SKEIN1024_448:45976,SKEIN1024_456:45977,SKEIN1024_464:45978,SKEIN1024_472:45979,SKEIN1024_480:45980,SKEIN1024_488:45981,SKEIN1024_496:45982,SKEIN1024_504:45983,SKEIN1024_512:45984,SKEIN1024_520:45985,SKEIN1024_528:45986,SKEIN1024_536:45987,SKEIN1024_544:45988,SKEIN1024_552:45989,SKEIN1024_560:45990,SKEIN1024_568:45991,SKEIN1024_576:45992,SKEIN1024_584:45993,SKEIN1024_592:45994,SKEIN1024_600:45995,SKEIN1024_608:45996,SKEIN1024_616:45997,SKEIN1024_624:45998,SKEIN1024_632:45999,SKEIN1024_640:46e3,SKEIN1024_648:46001,SKEIN1024_656:46002,SKEIN1024_664:46003,SKEIN1024_672:46004,SKEIN1024_680:46005,SKEIN1024_688:46006,SKEIN1024_696:46007,SKEIN1024_704:46008,SKEIN1024_712:46009,SKEIN1024_720:46010,SKEIN1024_728:46011,SKEIN1024_736:46012,SKEIN1024_744:46013,SKEIN1024_752:46014,SKEIN1024_760:46015,SKEIN1024_768:46016,SKEIN1024_776:46017,SKEIN1024_784:46018,SKEIN1024_792:46019,SKEIN1024_800:46020,SKEIN1024_808:46021,SKEIN1024_816:46022,SKEIN1024_824:46023,SKEIN1024_832:46024,SKEIN1024_840:46025,SKEIN1024_848:46026,SKEIN1024_856:46027,SKEIN1024_864:46028,SKEIN1024_872:46029,SKEIN1024_880:46030,SKEIN1024_888:46031,SKEIN1024_896:46032,SKEIN1024_904:46033,SKEIN1024_912:46034,SKEIN1024_920:46035,SKEIN1024_928:46036,SKEIN1024_936:46037,SKEIN1024_944:46038,SKEIN1024_952:46039,SKEIN1024_960:46040,SKEIN1024_968:46041,SKEIN1024_976:46042,SKEIN1024_984:46043,SKEIN1024_992:46044,SKEIN1024_1000:46045,SKEIN1024_1008:46046,SKEIN1024_1016:46047,SKEIN1024_1024:46048,IP4:4,TCP:6,DCCP:33,IP6:41,IP6ZONE:42,DNS:53,DNS4:54,DNS6:55,DNSADDR:56,SCTP:132,UDP:273,P2P_WEBRTC_STAR:275,P2P_WEBRTC_DIRECT:276,P2P_STARDUST:277,P2P_CIRCUIT:290,UDT:301,UTP:302,UNIX:400,P2P:421,IPFS:421,HTTPS:443,ONION:444,ONION3:445,GARLIC64:446,GARLIC32:447,QUIC:460,WS:477,WSS:478,P2P_WEBSOCKET_STAR:479,HTTP:480,RAW:85,DAG_PB:112,DAG_CBOR:113,LIBP2P_KEY:114,GIT_RAW:120,TORRENT_INFO:123,TORRENT_FILE:124,LEOFCOIN_BLOCK:129,LEOFCOIN_TX:130,LEOFCOIN_PR:131,ETH_BLOCK:144,ETH_BLOCK_LIST:145,ETH_TX_TRIE:146,ETH_TX:147,ETH_TX_RECEIPT_TRIE:148,ETH_TX_RECEIPT:149,ETH_STATE_TRIE:150,ETH_ACCOUNT_SNAPSHOT:151,ETH_STORAGE_TRIE:152,BITCOIN_BLOCK:176,BITCOIN_TX:177,ZCASH_BLOCK:192,ZCASH_TX:193,STELLAR_BLOCK:208,STELLAR_TX:209,DECRED_BLOCK:224,DECRED_TX:225,DASH_BLOCK:240,DASH_TX:241,SWARM_MANIFEST:250,SWARM_FEED:251,DAG_JSON:297,PATH:47,IPLD_NS:226,IPFS_NS:227,SWARM_NS:228,ED25519_PUB:237,HOLOCHAIN_ADR_V0:8417572,HOLOCHAIN_ADR_V1:8483108,HOLOCHAIN_KEY_V0:9728292,HOLOCHAIN_KEY_V1:9793828,HOLOCHAIN_SIG_V0:10645796,HOLOCHAIN_SIG_V1:10711332})},function(e,t,n){"use strict";e.exports=Object.freeze({80:"protobuf",81:"cbor",96:"rlp",99:"bencode",48:"multicodec",49:"multihash",50:"multiaddr",51:"multibase",0:"identity",17:"sha1",18:"sha2-256",19:"sha2-512",20:"sha3-512",21:"sha3-384",22:"sha3-256",23:"sha3-224",24:"shake-128",25:"shake-256",26:"keccak-224",27:"keccak-256",28:"keccak-384",29:"keccak-512",34:"murmur3-128",35:"murmur3-32",86:"dbl-sha2-256",212:"md4",213:"md5",214:"bmt",4352:"x11",45569:"blake2b-8",45570:"blake2b-16",45571:"blake2b-24",45572:"blake2b-32",45573:"blake2b-40",45574:"blake2b-48",45575:"blake2b-56",45576:"blake2b-64",45577:"blake2b-72",45578:"blake2b-80",45579:"blake2b-88",45580:"blake2b-96",45581:"blake2b-104",45582:"blake2b-112",45583:"blake2b-120",45584:"blake2b-128",45585:"blake2b-136",45586:"blake2b-144",45587:"blake2b-152",45588:"blake2b-160",45589:"blake2b-168",45590:"blake2b-176",45591:"blake2b-184",45592:"blake2b-192",45593:"blake2b-200",45594:"blake2b-208",45595:"blake2b-216",45596:"blake2b-224",45597:"blake2b-232",45598:"blake2b-240",45599:"blake2b-248",45600:"blake2b-256",45601:"blake2b-264",45602:"blake2b-272",45603:"blake2b-280",45604:"blake2b-288",45605:"blake2b-296",45606:"blake2b-304",45607:"blake2b-312",45608:"blake2b-320",45609:"blake2b-328",45610:"blake2b-336",45611:"blake2b-344",45612:"blake2b-352",45613:"blake2b-360",45614:"blake2b-368",45615:"blake2b-376",45616:"blake2b-384",45617:"blake2b-392",45618:"blake2b-400",45619:"blake2b-408",45620:"blake2b-416",45621:"blake2b-424",45622:"blake2b-432",45623:"blake2b-440",45624:"blake2b-448",45625:"blake2b-456",45626:"blake2b-464",45627:"blake2b-472",45628:"blake2b-480",45629:"blake2b-488",45630:"blake2b-496",45631:"blake2b-504",45632:"blake2b-512",45633:"blake2s-8",45634:"blake2s-16",45635:"blake2s-24",45636:"blake2s-32",45637:"blake2s-40",45638:"blake2s-48",45639:"blake2s-56",45640:"blake2s-64",45641:"blake2s-72",45642:"blake2s-80",45643:"blake2s-88",45644:"blake2s-96",45645:"blake2s-104",45646:"blake2s-112",45647:"blake2s-120",45648:"blake2s-128",45649:"blake2s-136",45650:"blake2s-144",45651:"blake2s-152",45652:"blake2s-160",45653:"blake2s-168",45654:"blake2s-176",45655:"blake2s-184",45656:"blake2s-192",45657:"blake2s-200",45658:"blake2s-208",45659:"blake2s-216",45660:"blake2s-224",45661:"blake2s-232",45662:"blake2s-240",45663:"blake2s-248",45664:"blake2s-256",45825:"skein256-8",45826:"skein256-16",45827:"skein256-24",45828:"skein256-32",45829:"skein256-40",45830:"skein256-48",45831:"skein256-56",45832:"skein256-64",45833:"skein256-72",45834:"skein256-80",45835:"skein256-88",45836:"skein256-96",45837:"skein256-104",45838:"skein256-112",45839:"skein256-120",45840:"skein256-128",45841:"skein256-136",45842:"skein256-144",45843:"skein256-152",45844:"skein256-160",45845:"skein256-168",45846:"skein256-176",45847:"skein256-184",45848:"skein256-192",45849:"skein256-200",45850:"skein256-208",45851:"skein256-216",45852:"skein256-224",45853:"skein256-232",45854:"skein256-240",45855:"skein256-248",45856:"skein256-256",45857:"skein512-8",45858:"skein512-16",45859:"skein512-24",45860:"skein512-32",45861:"skein512-40",45862:"skein512-48",45863:"skein512-56",45864:"skein512-64",45865:"skein512-72",45866:"skein512-80",45867:"skein512-88",45868:"skein512-96",45869:"skein512-104",45870:"skein512-112",45871:"skein512-120",45872:"skein512-128",45873:"skein512-136",45874:"skein512-144",45875:"skein512-152",45876:"skein512-160",45877:"skein512-168",45878:"skein512-176",45879:"skein512-184",45880:"skein512-192",45881:"skein512-200",45882:"skein512-208",45883:"skein512-216",45884:"skein512-224",45885:"skein512-232",45886:"skein512-240",45887:"skein512-248",45888:"skein512-256",45889:"skein512-264",45890:"skein512-272",45891:"skein512-280",45892:"skein512-288",45893:"skein512-296",45894:"skein512-304",45895:"skein512-312",45896:"skein512-320",45897:"skein512-328",45898:"skein512-336",45899:"skein512-344",45900:"skein512-352",45901:"skein512-360",45902:"skein512-368",45903:"skein512-376",45904:"skein512-384",45905:"skein512-392",45906:"skein512-400",45907:"skein512-408",45908:"skein512-416",45909:"skein512-424",45910:"skein512-432",45911:"skein512-440",45912:"skein512-448",45913:"skein512-456",45914:"skein512-464",45915:"skein512-472",45916:"skein512-480",45917:"skein512-488",45918:"skein512-496",45919:"skein512-504",45920:"skein512-512",45921:"skein1024-8",45922:"skein1024-16",45923:"skein1024-24",45924:"skein1024-32",45925:"skein1024-40",45926:"skein1024-48",45927:"skein1024-56",45928:"skein1024-64",45929:"skein1024-72",45930:"skein1024-80",45931:"skein1024-88",45932:"skein1024-96",45933:"skein1024-104",45934:"skein1024-112",45935:"skein1024-120",45936:"skein1024-128",45937:"skein1024-136",45938:"skein1024-144",45939:"skein1024-152",45940:"skein1024-160",45941:"skein1024-168",45942:"skein1024-176",45943:"skein1024-184",45944:"skein1024-192",45945:"skein1024-200",45946:"skein1024-208",45947:"skein1024-216",45948:"skein1024-224",45949:"skein1024-232",45950:"skein1024-240",45951:"skein1024-248",45952:"skein1024-256",45953:"skein1024-264",45954:"skein1024-272",45955:"skein1024-280",45956:"skein1024-288",45957:"skein1024-296",45958:"skein1024-304",45959:"skein1024-312",45960:"skein1024-320",45961:"skein1024-328",45962:"skein1024-336",45963:"skein1024-344",45964:"skein1024-352",45965:"skein1024-360",45966:"skein1024-368",45967:"skein1024-376",45968:"skein1024-384",45969:"skein1024-392",45970:"skein1024-400",45971:"skein1024-408",45972:"skein1024-416",45973:"skein1024-424",45974:"skein1024-432",45975:"skein1024-440",45976:"skein1024-448",45977:"skein1024-456",45978:"skein1024-464",45979:"skein1024-472",45980:"skein1024-480",45981:"skein1024-488",45982:"skein1024-496",45983:"skein1024-504",45984:"skein1024-512",45985:"skein1024-520",45986:"skein1024-528",45987:"skein1024-536",45988:"skein1024-544",45989:"skein1024-552",45990:"skein1024-560",45991:"skein1024-568",45992:"skein1024-576",45993:"skein1024-584",45994:"skein1024-592",45995:"skein1024-600",45996:"skein1024-608",45997:"skein1024-616",45998:"skein1024-624",45999:"skein1024-632",46000:"skein1024-640",46001:"skein1024-648",46002:"skein1024-656",46003:"skein1024-664",46004:"skein1024-672",46005:"skein1024-680",46006:"skein1024-688",46007:"skein1024-696",46008:"skein1024-704",46009:"skein1024-712",46010:"skein1024-720",46011:"skein1024-728",46012:"skein1024-736",46013:"skein1024-744",46014:"skein1024-752",46015:"skein1024-760",46016:"skein1024-768",46017:"skein1024-776",46018:"skein1024-784",46019:"skein1024-792",46020:"skein1024-800",46021:"skein1024-808",46022:"skein1024-816",46023:"skein1024-824",46024:"skein1024-832",46025:"skein1024-840",46026:"skein1024-848",46027:"skein1024-856",46028:"skein1024-864",46029:"skein1024-872",46030:"skein1024-880",46031:"skein1024-888",46032:"skein1024-896",46033:"skein1024-904",46034:"skein1024-912",46035:"skein1024-920",46036:"skein1024-928",46037:"skein1024-936",46038:"skein1024-944",46039:"skein1024-952",46040:"skein1024-960",46041:"skein1024-968",46042:"skein1024-976",46043:"skein1024-984",46044:"skein1024-992",46045:"skein1024-1000",46046:"skein1024-1008",46047:"skein1024-1016",46048:"skein1024-1024",4:"ip4",6:"tcp",33:"dccp",41:"ip6",42:"ip6zone",53:"dns",54:"dns4",55:"dns6",56:"dnsaddr",132:"sctp",273:"udp",275:"p2p-webrtc-star",276:"p2p-webrtc-direct",277:"p2p-stardust",290:"p2p-circuit",301:"udt",302:"utp",400:"unix",421:"p2p",443:"https",444:"onion",445:"onion3",446:"garlic64",447:"garlic32",460:"quic",477:"ws",478:"wss",479:"p2p-websocket-star",480:"http",85:"raw",112:"dag-pb",113:"dag-cbor",114:"libp2p-key",120:"git-raw",123:"torrent-info",124:"torrent-file",129:"leofcoin-block",130:"leofcoin-tx",131:"leofcoin-pr",144:"eth-block",145:"eth-block-list",146:"eth-tx-trie",147:"eth-tx",148:"eth-tx-receipt-trie",149:"eth-tx-receipt",150:"eth-state-trie",151:"eth-account-snapshot",152:"eth-storage-trie",176:"bitcoin-block",177:"bitcoin-tx",192:"zcash-block",193:"zcash-tx",208:"stellar-block",209:"stellar-tx",224:"decred-block",225:"decred-tx",240:"dash-block",241:"dash-tx",250:"swarm-manifest",251:"swarm-feed",297:"dag-json",47:"path",226:"ipld-ns",227:"ipfs-ns",228:"swarm-ns",237:"ed25519-pub",8417572:"holochain-adr-v0",8483108:"holochain-adr-v1",9728292:"holochain-key-v0",9793828:"holochain-key-v1",10645796:"holochain-sig-v0",10711332:"holochain-sig-v1"})},function(e,t,n){"use strict";(function(t){const r=n(35);var i={checkCIDComponents:function(e){if(null==e)return"null values are not valid CIDs";if(0!==e.version&&1!==e.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof e.codec)return"codec must be string";if(0===e.version){if("dag-pb"!==e.codec)return"codec must be 'dag-pb' for CIDv0";if("base58btc"!==e.multibaseName)return"multibaseName must be 'base58btc' for CIDv0"}if(!t.isBuffer(e.multihash))return"multihash must be a Buffer";try{r.validate(e.multihash)}catch(e){let t=e.message;return t||(t="Multihash validation failed"),t}}};e.exports=i}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports={keys:n(793),once:n(138),values:n(43),count:n(794),infinite:n(795),empty:n(106),error:n(81)}},function(e,t,n){"use strict";var r=n(43);e.exports=function(e){return r(Object.keys(e))}},function(e,t,n){"use strict";e.exports=function e(t){var n=0;return t=t||1/0,function(e,r){return e?r&&r(e):n>t?r(!0):void r(null,n++)}}},function(e,t,n){"use strict";e.exports=function e(t){return t=t||Math.random,function(e,n){return e?n&&n(e):n(null,t())}}},function(e,t,n){"use strict";e.exports={drain:n(177),onEnd:n(406),log:n(797),find:n(798),reduce:n(222),collect:n(37),concat:n(799)}},function(e,t,n){"use strict";var r=n(177);e.exports=function e(t){return r(function(e){console.log(e)},t)}},function(e,t,n){"use strict";function r(e){return e}var i=n(178),o=n(177);e.exports=function e(t,n){var s=!1;return n?t=i(t)||r:(n=t,t=r),o(function(e){if(t(e))return s=!0,n(null,e),!1},function(e){s||n(!0===e?null:e,null)})}},function(e,t,n){"use strict";var r=n(222);e.exports=function e(t){return r(function(e,t){return e+t},"",t)}},function(e,t,n){"use strict";e.exports={map:n(77),asyncMap:n(90),filter:n(78),filterNot:n(801),through:n(223),take:n(296),unique:n(408),nonUnique:n(802),flatten:n(224)}},function(e,t,n){"use strict";var r=n(407),i=n(78);e.exports=function e(t){return t=r(t),i(function(e){return!t(e)})}},function(e,t,n){"use strict";var r=n(408);e.exports=function e(t){return r(t,!0)}},function(e,t,n){"use strict";(function(t){const r=n(35);var i={checkCIDComponents:function(e){if(null==e)return"null values are not valid CIDs";if(0!==e.version&&1!==e.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof e.codec)return"codec must be string";if(!t.isBuffer(e.multihash))return"multihash must be a Buffer";try{r.validate(e.multihash)}catch(e){let t=e.message;return t||(t="Multihash validation failed"),t}}};e.exports=i}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var r=n(68),i=f(r),o=n(104),s=f(o),a=n(131),u=f(a),l=n(42),c=f(l);function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t,n){n=(0,u.default)(n||i.default);var r=(0,c.default)(e),o=function(e){if(e)return n(e);var i=(0,s.default)(arguments,1);if(t.apply(this,i))return r(o);n.apply(null,[null].concat(i))};r(o)}e.exports=t.default},function(e,t,n){"use strict"; /* object-assign (c) Sindre Sorhus diff --git a/package.json b/package.json index 37f8712..581a468 100644 --- a/package.json +++ b/package.json @@ -53,5 +53,5 @@ "test": "cd src; node ./test.js", "help": "echo 'test (test it)'; echo 'build (creates dweb-transports-bundle)'" }, - "version": "0.1.56" + "version": "0.1.57" }