>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new _;else if("p224"===t)e=new M;else if("p192"===t)e=new k;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return y[t]=e,e},C.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},C.prototype._verify2=function(t,e){n(0===(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},C.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},C.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},C.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},C.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},C.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},C.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},C.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},C.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},C.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},C.prototype.isqr=function(t){return this.imul(t,t.clone())},C.prototype.sqr=function(t){return this.mul(t,t)},C.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2===1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}var i=this.m.subn(1),s=0;while(!i.isZero()&&0===i.andln(1))s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),h=this.m.bitLength();h=new o(2*h*h).toRed(this);while(0!==this.pow(h,c).cmp(u))h.redIAdd(u);var f=this.pow(h,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;while(0!==d.cmp(a)){for(var m=d,v=0;0!==m.cmp(a);v++)m=m.redSqr();n(v=0;i--){for(var h=e.words[i],f=c-1;f>=0;f--){var l=h>>f&1;s!==n[0]&&(s=this.sqr(s)),0!==l||0!==a?(a<<=1,a|=l,u++,(u===r||0===i&&0===f)&&(s=this.mul(s,n[a]),u=0,a=0)):u=0}c=26}return s},C.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},C.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new x(t)},i(x,C),x.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},x.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},x.prototype.invm=function(t){var e=this.imod(t._invmp(this.m).mul(this.r2));return e._forceRed(this)}})(t,this)}).call(this,r("62e4")(t))},d1c8:function(t,e,r){"use strict";const n=r("3fb5");function i(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}e.Reporter=i,i.prototype.isError=function(t){return t instanceof o},i.prototype.save=function(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function(t){const e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},i.prototype.enterKey=function(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function(t){const e=this._reporterState;e.path=e.path.slice(0,t-1)},i.prototype.leaveKey=function(t,e,r){const n=this._reporterState;this.exitKey(t),null!==n.obj&&(n.obj[e]=r)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){const t=this._reporterState,e=t.obj;return t.obj={},e},i.prototype.leaveObject=function(t){const e=this._reporterState,r=e.obj;return e.obj=t,r},i.prototype.error=function(t){let e;const r=this._reporterState,n=t instanceof o;if(e=n?t:new o(r.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!r.options.partial)throw e;return n||r.errors.push(e),e},i.prototype.wrapResult=function(t){const e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},n(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},d3f8:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r("dc74");const i=n.rfc4648({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});e.base2=i},d424:function(t,e,r){"use strict";var n=r("3fb5"),i=r("8707").Buffer,o=r("6430"),s=i.alloc(128),a=64;function u(t,e){o.call(this,"digest"),"string"===typeof e&&(e=i.from(e)),this._alg=t,this._key=e,e.length>a?e=t(e):e.length1?o(i,e,r):i[0]}t.exports=i},d4dd:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r("fb86"),i=r("ac1b"),o=r("dd7b"),s=r("9a44"),a=r("29f9");e.CID=n.CID,e.varint=i,e.bytes=o,e.hasher=s,e.digest=a},d6dd:function(t,e,r){"use strict";var n=r("966d"),i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=f;var o=Object.create(r("3a7c"));o.inherits=r("3fb5");var s=r("6f2e"),a=r("6ffa");o.inherits(f,s);for(var u=i(a.prototype),c=0;c=n&&(a=await o(r,s));const u=a.parent;if(u){if(a!==r){if(e&&(e.parent=a),!a.parentKey)throw new Error("No parent key found");await u.put(a.parentKey,a)}return t(a,u,n,s)}return a}},da3e:function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=r,r.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},da60:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r("c0f8");function i(t,e="utf8"){const r=n[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return r.encoder.encode(t).substring(1)}e.toString=i},dc14:function(t,e,r){"use strict";(function(e,n){function i(t){var e=this;this.next=null,this.entry=null,this.finish=function(){V(e,t)}}var o;t.exports=A,A.WritableState=B;var s={deprecate:r("b7d1")},a=r("429b"),u=r("1c35").Buffer,c=e.Uint8Array||function(){};function h(t){return u.from(t)}function f(t){return u.isBuffer(t)||t instanceof c}var l,d=r("4681"),p=r("0db6"),m=p.getHighWaterMark,v=r("c9b8").codes,b=v.ERR_INVALID_ARG_TYPE,g=v.ERR_METHOD_NOT_IMPLEMENTED,y=v.ERR_MULTIPLE_CALLBACK,w=v.ERR_STREAM_CANNOT_PIPE,_=v.ERR_STREAM_DESTROYED,M=v.ERR_STREAM_NULL_VALUES,k=v.ERR_STREAM_WRITE_AFTER_END,S=v.ERR_UNKNOWN_ENCODING,C=d.errorOrDestroy;function x(){}function B(t,e,n){o=o||r("b19a"),t=t||{},"boolean"!==typeof n&&(n=e instanceof o),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=m(this,t,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===t.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){j(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function A(t){o=o||r("b19a");var e=this instanceof o;if(!e&&!l.call(A,this))return new A(t);this._writableState=new B(t,this,e),this.writable=!0,t&&("function"===typeof t.write&&(this._write=t.write),"function"===typeof t.writev&&(this._writev=t.writev),"function"===typeof t.destroy&&(this._destroy=t.destroy),"function"===typeof t.final&&(this._final=t.final)),a.call(this)}function E(t,e){var r=new k;C(t,r),n.nextTick(e,r)}function P(t,e,r,i){var o;return null===r?o=new M:"string"===typeof r||e.objectMode||(o=new b("chunk",["string","Buffer"],r)),!o||(C(t,o),n.nextTick(i,o),!1)}function T(t,e,r){return t.objectMode||!1===t.decodeStrings||"string"!==typeof e||(e=u.from(e,r)),e}function R(t,e,r,n,i,o){if(!r){var s=T(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length-1))throw new S(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(t,e,r){r(new g("_write()"))},A.prototype._writev=null,A.prototype.end=function(t,e,r){var n=this._writableState;return"function"===typeof t?(r=t,t=null,e=null):"function"===typeof e&&(r=e,e=null),null!==t&&void 0!==t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||$(this,n,r),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),A.prototype.destroy=d.destroy,A.prototype._undestroy=d.undestroy,A.prototype._destroy=function(t,e){e(t)}}).call(this,r("c8ba"),r("4362"))},dc6f:function(t,e,r){"use strict";t.exports=o;var n=r("0c83");(o.prototype=Object.create(n.prototype)).constructor=o;var i=r("e938");function o(){n.call(this)}function s(t,e,r){t.length<40?i.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(t,e,r){e.set(t,r)}:function(t,e,r){if(t.copy)t.copy(e,r,0,t.length);else for(var n=0;n>>0;return this.uint32(e),e&&this._push(o.writeBytesBuffer,e,t),this},o.prototype.string=function(t){var e=i.Buffer.byteLength(t);return this.uint32(e),e&&this._push(s,e,t),this},o._configure()},dc74:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r("6e41"),i=r("dd7b");class o{constructor(t,e,r){this.name=t,this.prefix=e,this.baseEncode=r}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class s{constructor(t,e,r){this.name=t,this.prefix=e,this.baseDecode=r}decode(t){if("string"!==typeof t)throw Error("Can only multibase decode strings");switch(t[0]){case this.prefix:return this.baseDecode(t.slice(1));default:throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`)}}or(t){const e={[this.prefix]:this,...t.decoders||{[t.prefix]:t}};return new a(e)}}class a{constructor(t){this.decoders=t}or(t){const e=t.decoders||{[t.prefix]:t};return new a({...this.decoders,...e})}decode(t){const e=t[0],r=this.decoders[e];if(r)return r.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}class u{constructor(t,e,r,n){this.name=t,this.prefix=e,this.baseEncode=r,this.baseDecode=n,this.encoder=new o(t,e,r),this.decoder=new s(t,e,n)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const c=({name:t,prefix:e,encode:r,decode:n})=>new u(t,e,r,n),h=({prefix:t,name:e,alphabet:r})=>{const{encode:o,decode:s}=n(r,e);return c({prefix:t,name:e,encode:o,decode:t=>i.coerce(s(t))})},f=(t,e,r,n)=>{const i={};for(let h=0;h=8&&(a-=8,s[c++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return s},l=(t,e,r)=>{const n="="===e[e.length-1],i=(1<r)s-=r,o+=e[i&a>>s]}if(s&&(o+=e[i&a<c({prefix:e,name:t,encode(t){return l(t,n,r)},decode(e){return f(e,n,r,t)}});e.Codec=u,e.baseX=h,e.from=c,e.rfc4648=d},dcd0:function(t,e,r){"use strict";t.exports=s;var n=r("d6dd"),i=Object.create(r("3a7c"));function o(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.lengtht.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),""),o=t=>{const e=t.match(/../g);return e?new Uint8Array(e.map(t=>parseInt(t,16))):n},s=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{if(t instanceof Uint8Array&&"Uint8Array"===t.constructor.name)return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},u=t=>t instanceof ArrayBuffer||ArrayBuffer.isView(t),c=t=>(new TextEncoder).encode(t),h=t=>(new TextDecoder).decode(t);e.coerce=a,e.empty=n,e.equals=s,e.fromHex=o,e.fromString=c,e.isBinary=u,e.toHex=i,e.toString=h},df7c:function(t,e,r){(function(t){function r(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function n(t){"string"!==typeof t&&(t+="");var e,r=0,n=-1,i=!0;for(e=t.length-1;e>=0;--e)if(47===t.charCodeAt(e)){if(!i){r=e+1;break}}else-1===n&&(i=!1,n=e+1);return-1===n?"":t.slice(r,n)}function i(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n=-1&&!n;o--){var s=o>=0?arguments[o]:t.cwd();if("string"!==typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(e=s+"/"+e,n="/"===s.charAt(0))}return e=r(i(e.split("/"),(function(t){return!!t})),!n).join("/"),(n?"/":"")+e||"."},e.normalize=function(t){var n=e.isAbsolute(t),s="/"===o(t,-1);return t=r(i(t.split("/"),(function(t){return!!t})),!n).join("/"),t||n||(t="."),t&&s&&(t+="/"),(n?"/":"")+t},e.isAbsolute=function(t){return"/"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(i(t,(function(t,e){if("string"!==typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))},e.relative=function(t,r){function n(t){for(var e=0;e=0;r--)if(""!==t[r])break;return e>r?[]:t.slice(e,r-e+1)}t=e.resolve(t).substr(1),r=e.resolve(r).substr(1);for(var i=n(t.split("/")),o=n(r.split("/")),s=Math.min(i.length,o.length),a=s,u=0;u=1;--o)if(e=t.charCodeAt(o),47===e){if(!i){n=o;break}}else i=!1;return-1===n?r?"/":".":r&&1===n?"/":t.slice(0,n)},e.basename=function(t,e){var r=n(t);return e&&r.substr(-1*e.length)===e&&(r=r.substr(0,r.length-e.length)),r},e.extname=function(t){"string"!==typeof t&&(t+="");for(var e=-1,r=0,n=-1,i=!0,o=0,s=t.length-1;s>=0;--s){var a=t.charCodeAt(s);if(47!==a)-1===n&&(i=!1,n=s+1),46===a?-1===e?e=s:1!==o&&(o=1):-1!==e&&(o=-1);else if(!i){r=s+1;break}}return-1===e||-1===n||0===o||1===o&&e===n-1&&e===r+1?"":t.slice(e,n)};var o="b"==="ab".substr(-1)?function(t,e,r){return t.substr(e,r)}:function(t,e,r){return e<0&&(e=t.length+e),t.substr(e,r)}}).call(this,r("4362"))},e07b:function(t,e,r){var n=r("5a76"),i=r("b5ca"),o=r("69f2"),s=r("8707").Buffer,a=r("7d2a"),u=r("9f9d"),c=r("8be6"),h=s.alloc(128),f={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function l(t,e,r){var n=d(t),i="sha512"===t||"sha384"===t?128:64;e.length>i?e=n(e):e.length{throw new Error("unexpected block API get for "+t)},put:async()=>{throw new Error("unexpected block API put")}};e.of=async(t,e)=>{let r;e=e||{},e.onlyHash=!0,"string"===typeof t&&(t=(new TextEncoder).encode(t));for await(const{cid:o}of n([{content:t}],i,e))r=o;return""+r}},e3c5:function(t,e,r){"use strict";function n(t,e){e||(e=t.reduce((t,e)=>t+e.length,0));const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}Object.defineProperty(e,"__esModule",{value:!0}),e.concat=n},e3db:function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},e4de:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r("dc74");const i=n.baseX({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),o=n.baseX({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});e.base58btc=i,e.base58flickr=o},e4e2:function(t,e,r){"use strict";const n=r("65a5");async function*i(t,e=1){for await(const r of n(t,e)){const t=r.map(t=>t().then(t=>({ok:!0,value:t}),t=>({ok:!1,err:t})));for(let e=0;e0)},n.Buffer=function(){try{var t=n.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch(e){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(t){return"number"===typeof t?n.Buffer?n._Buffer_allocUnsafe(t):new n.Array(t):n.Buffer?n._Buffer_from(t):"undefined"===typeof Uint8Array?t:new Uint8Array(t)},n.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(t){return t?n.LongBits.from(t).toHash():n.LongBits.zeroHash},n.longFromHash=function(t,e){var r=n.LongBits.fromHash(t);return n.Long?n.Long.fromBits(r.lo,r.hi,e):r.toNumber(Boolean(e))},n.merge=i,n.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(t){for(var e={},r=0;r-1;--r)if(1===e[t[r]]&&void 0!==this[t[r]]&&null!==this[t[r]])return t[r]}},n.oneOfSetter=function(t){return function(e){for(var r=0;r0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){a(t.precomputed);var r=t._getDoubles(),n=o(e,1,this._bitLength),i=(1<=s;h--)u=(u<<1)+n[h];c.push(u)}for(var f=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=i;d>0;d--){for(s=0;s=0;c--){for(var h=0;c>=0&&0===s[c];c--)h++;if(c>=0&&h++,u=u.dblp(h),c<0)break;var f=s[c];a(0!==f),u="affine"===t.type?f>0?u.mixedAdd(i[f-1>>1]):u.mixedAdd(i[-f-1>>1].neg()):f>0?u.add(i[f-1>>1]):u.add(i[-f-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,n,i){var a,u,c,h=this._wnafT1,f=this._wnafT2,l=this._wnafT3,d=0;for(a=0;a=1;a-=2){var m=a-1,v=a;if(1===h[m]&&1===h[v]){var b=[e[m],null,null,e[v]];0===e[m].y.cmp(e[v].y)?(b[1]=e[m].add(e[v]),b[2]=e[m].toJ().mixedAdd(e[v].neg())):0===e[m].y.cmp(e[v].y.redNeg())?(b[1]=e[m].toJ().mixedAdd(e[v]),b[2]=e[m].add(e[v].neg())):(b[1]=e[m].toJ().mixedAdd(e[v]),b[2]=e[m].toJ().mixedAdd(e[v].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=s(r[m],r[v]);for(d=Math.max(y[0].length,d),l[m]=new Array(d),l[v]=new Array(d),u=0;u=0;a--){var S=0;while(a>=0){var C=!0;for(u=0;u=0&&S++,M=M.dblp(S),a<0)break;for(u=0;u0?c=f[u][x-1>>1]:x<0&&(c=f[u][-x-1>>1].neg()),M="affine"===c.type?M.mixedAdd(c):M.add(c))}}for(a=0;a=Math.ceil((t.bitLength()+1)/e.step)},c.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=this._delta8){t=this.pending;var r=t.length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,h=new Uint8Array(u);while(i!==o){for(var f=e[i],l=0,d=u-1;(0!==f||l>>0,h[d]=f%s>>>0,f=f/s>>>0;if(0!==f)throw new Error("Non-zero carry");n=l,i++}var p=u-n;while(p!==u&&0===h[p])p++;for(var m=a.repeat(r);p>>0,c=new Uint8Array(o);while(t[r]){var h=e[t.charCodeAt(r)];if(255===h)return;for(var f=0,l=o-1;(0!==h||f>>0,c[l]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");i=f,r++}if(" "!==t[r]){var d=o-i;while(d!==o&&0===c[d])d++;var p=new Uint8Array(n+(o-d)),m=n;while(d!==o)p[m++]=c[d++];return p}}}function l(t){var e=f(t);if(e)return e;throw new Error("Non-base"+s+" character")}return{encode:h,decodeUnsafe:f,decode:l}}t.exports=n},f140:function(t,e,r){"use strict";const n=r("543b"),{PBLink:i}=r("892c"),{createDagLinkFromB58EncodedHash:o}=r("bf15"),s=t=>{const e={};return t.Data&&t.Data.byteLength>0?e.Data=t.Data:e.Data=null,t.Links&&t.Links.length>0?e.Links=t.Links.map(t=>({Hash:t.Hash.bytes,Name:t.Name,Tsize:t.Tsize})):e.Links=null,e},a=t=>c(s(t)),u=(t,e=[])=>{const r={Data:t,Links:e.map(t=>o(t))};return c(s(r))};function c(t){const e=n.Writer.create();if(null!=t.Links)for(let r=0;r(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n}function u(t,e){var r=[[],[]];t=t.clone(),e=e.clone();var n,i=0,o=0;while(t.cmpn(-i)>0||e.cmpn(-o)>0){var s,a,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),0===(1&u)?s=0:(n=t.andln(7)+i&7,s=3!==n&&5!==n||2!==c?u:-u),r[0].push(s),0===(1&c)?a=0:(n=e.andln(7)+o&7,a=3!==n&&5!==n||2!==u?c:-c),r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r}function c(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}}function h(t){return"string"===typeof t?n.toArray(t,"hex"):t}function f(t){return new i(t,"hex","le")}n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=a,n.getJSF=u,n.cachedProperty=c,n.parseBytes=h,n.intFromLE=f},f460:function(t,e,r){var n=r("98e6"),i=r("8707").Buffer;function o(t){var e=i.allocUnsafe(4);return e.writeUInt32BE(t,0),e}t.exports=function(t,e){var r,s=i.alloc(0),a=0;while(s.length>>32-e}function c(t,e,r,n,i,o,s){return u(t+(e&r|~e&n)+i+o|0,s)+e|0}function h(t,e,r,n,i,o,s){return u(t+(e&n|r&~n)+i+o|0,s)+e|0}function f(t,e,r,n,i,o,s){return u(t+(e^r^n)+i+o|0,s)+e|0}function l(t,e,r,n,i,o,s){return u(t+(r^(e|~n))+i+o|0,s)+e|0}n(a,i),a.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d;r=c(r,n,i,o,t[0],3614090360,7),o=c(o,r,n,i,t[1],3905402710,12),i=c(i,o,r,n,t[2],606105819,17),n=c(n,i,o,r,t[3],3250441966,22),r=c(r,n,i,o,t[4],4118548399,7),o=c(o,r,n,i,t[5],1200080426,12),i=c(i,o,r,n,t[6],2821735955,17),n=c(n,i,o,r,t[7],4249261313,22),r=c(r,n,i,o,t[8],1770035416,7),o=c(o,r,n,i,t[9],2336552879,12),i=c(i,o,r,n,t[10],4294925233,17),n=c(n,i,o,r,t[11],2304563134,22),r=c(r,n,i,o,t[12],1804603682,7),o=c(o,r,n,i,t[13],4254626195,12),i=c(i,o,r,n,t[14],2792965006,17),n=c(n,i,o,r,t[15],1236535329,22),r=h(r,n,i,o,t[1],4129170786,5),o=h(o,r,n,i,t[6],3225465664,9),i=h(i,o,r,n,t[11],643717713,14),n=h(n,i,o,r,t[0],3921069994,20),r=h(r,n,i,o,t[5],3593408605,5),o=h(o,r,n,i,t[10],38016083,9),i=h(i,o,r,n,t[15],3634488961,14),n=h(n,i,o,r,t[4],3889429448,20),r=h(r,n,i,o,t[9],568446438,5),o=h(o,r,n,i,t[14],3275163606,9),i=h(i,o,r,n,t[3],4107603335,14),n=h(n,i,o,r,t[8],1163531501,20),r=h(r,n,i,o,t[13],2850285829,5),o=h(o,r,n,i,t[2],4243563512,9),i=h(i,o,r,n,t[7],1735328473,14),n=h(n,i,o,r,t[12],2368359562,20),r=f(r,n,i,o,t[5],4294588738,4),o=f(o,r,n,i,t[8],2272392833,11),i=f(i,o,r,n,t[11],1839030562,16),n=f(n,i,o,r,t[14],4259657740,23),r=f(r,n,i,o,t[1],2763975236,4),o=f(o,r,n,i,t[4],1272893353,11),i=f(i,o,r,n,t[7],4139469664,16),n=f(n,i,o,r,t[10],3200236656,23),r=f(r,n,i,o,t[13],681279174,4),o=f(o,r,n,i,t[0],3936430074,11),i=f(i,o,r,n,t[3],3572445317,16),n=f(n,i,o,r,t[6],76029189,23),r=f(r,n,i,o,t[9],3654602809,4),o=f(o,r,n,i,t[12],3873151461,11),i=f(i,o,r,n,t[15],530742520,16),n=f(n,i,o,r,t[2],3299628645,23),r=l(r,n,i,o,t[0],4096336452,6),o=l(o,r,n,i,t[7],1126891415,10),i=l(i,o,r,n,t[14],2878612391,15),n=l(n,i,o,r,t[5],4237533241,21),r=l(r,n,i,o,t[12],1700485571,6),o=l(o,r,n,i,t[3],2399980690,10),i=l(i,o,r,n,t[10],4293915773,15),n=l(n,i,o,r,t[1],2240044497,21),r=l(r,n,i,o,t[8],1873313359,6),o=l(o,r,n,i,t[15],4264355552,10),i=l(i,o,r,n,t[6],2734768916,15),n=l(n,i,o,r,t[13],1309151649,21),r=l(r,n,i,o,t[4],4149444226,6),o=l(o,r,n,i,t[11],3174756917,10),i=l(i,o,r,n,t[2],718787259,15),n=l(n,i,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=a},f957:function(t,e){var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),s=Math.pow(2,35),a=Math.pow(2,42),u=Math.pow(2,49),c=Math.pow(2,56),h=Math.pow(2,63);t.exports=function(t){return te[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength=c||a>49)throw i.bytes=0,new RangeError("Could not decode varint");o=t[u++],s+=a<28?(o&n)<=r);return i.bytes=u-e,s}},faa1:function(t,e,r){"use strict";var n,i="object"===typeof Reflect?Reflect:null,o=i&&"function"===typeof i.apply?i.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};function s(t){console&&console.warn&&console.warn(t)}n=i&&"function"===typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!==t};function u(){u.init.call(this)}t.exports=u,t.exports.once=w,u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var c=10;function h(t){if("function"!==typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function f(t){return void 0===t._maxListeners?u.defaultMaxListeners:t._maxListeners}function l(t,e,r,n){var i,o,a;if(h(r),o=t._events,void 0===o?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),a=o[e]),void 0===a)a=o[e]=r,++t._eventsCount;else if("function"===typeof a?a=o[e]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),i=f(t),i>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,s(u)}return t}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=d.bind(n);return i.listener=r,n.wrapFn=i,i}function m(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"===typeof i?r?[i.listener||i]:[i]:r?y(i):b(i,i.length)}function v(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"===typeof r)return 1;if(void 0!==r)return r.length}return 0}function b(t,e){for(var r=new Array(e),n=0;n0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[t];if(void 0===u)return!1;if("function"===typeof u)o(u,this,e);else{var c=u.length,h=b(u,c);for(r=0;r=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():g(r,i),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},u.prototype.off=u.prototype.removeListener,u.prototype.removeAllListeners=function(t){var e,r,n;if(r=this._events,void 0===r)return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0===--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n=0;n--)this.removeListener(t,e[n]);return this},u.prototype.listeners=function(t){return m(this,t,!0)},u.prototype.rawListeners=function(t){return m(this,t,!1)},u.listenerCount=function(t,e){return"function"===typeof t.listenerCount?t.listenerCount(e):v.call(t,e)},u.prototype.listenerCount=v,u.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},fafd:function(t,e){t.exports=i;var r=128,n=127;function i(t,e){var o,s=0,a=(e=e||0,0),u=e,c=t.length;do{if(u>=c)throw i.bytes=0,new RangeError("Could not decode varint");o=t[u++],s+=a<28?(o&n)<=r);return i.bytes=u-e,s}},fb86:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r("ac1b"),i=r("29f9"),o=r("e4de"),s=r("17fb"),a=r("dd7b");class u{constructor(t,e,r,n){this.code=e,this.version=t,this.multihash=r,this.bytes=n,this.byteOffset=n.byteOffset,this.byteLength=n.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:b,byteLength:b,code:v,version:v,multihash:v,bytes:v,_baseCache:b,asCID:b})}toV0(){switch(this.version){case 0:return this;default:{const{code:t,multihash:e}=this;if(t!==l)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==d)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return u.createV0(e)}}}toV1(){switch(this.version){case 0:{const{code:t,digest:e}=this.multihash,r=i.create(t,e);return u.createV1(this.code,r)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(t){return t&&this.code===t.code&&this.version===t.version&&i.equals(this.multihash,t.multihash)}toString(t){const{bytes:e,version:r,_baseCache:n}=this;switch(r){case 0:return h(e,n,t||o.base58btc.encoder);default:return f(e,n,t||s.base32.encoder)}}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(t){return y(/^0\.0/,w),!(!t||!t[m]&&t.asCID!==t)}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(t){if(t instanceof u)return t;if(null!=t&&t.asCID===t){const{version:e,code:r,multihash:n,bytes:i}=t;return new u(e,r,n,i||p(e,r,n.bytes))}if(null!=t&&!0===t[m]){const{version:e,multihash:r,code:n}=t,o=i.decode(r);return u.create(e,n,o)}return null}static create(t,e,r){if("number"!==typeof e)throw new Error("String codecs are no longer supported");switch(t){case 0:if(e!==l)throw new Error(`Version 0 CID must use dag-pb (code: ${l}) block encoding`);return new u(t,e,r,r.bytes);case 1:{const n=p(t,e,r.bytes);return new u(t,e,r,n)}default:throw new Error("Invalid version")}}static createV0(t){return u.create(0,l,t)}static createV1(t,e){return u.create(1,t,e)}static decode(t){const[e,r]=u.decodeFirst(t);if(r.length)throw new Error("Incorrect length");return e}static decodeFirst(t){const e=u.inspectBytes(t),r=e.size-e.multihashSize,n=a.coerce(t.subarray(r,r+e.multihashSize));if(n.byteLength!==e.multihashSize)throw new Error("Incorrect length");const o=n.subarray(e.multihashSize-e.digestSize),s=new i.Digest(e.multihashCode,e.digestSize,o,n),c=0===e.version?u.createV0(s):u.createV1(e.codec,s);return[c,t.subarray(e.size)]}static inspectBytes(t){let e=0;const r=()=>{const[r,i]=n.decode(t.subarray(e));return e+=i,r};let i=r(),o=l;if(18===i?(i=0,e=0):1===i&&(o=r()),0!==i&&1!==i)throw new RangeError("Invalid CID version "+i);const s=e,a=r(),u=r(),c=e+u,h=c-s;return{version:i,codec:o,multihashCode:a,digestSize:u,multihashSize:h,size:c}}static parse(t,e){const[r,n]=c(t,e),i=u.decode(n);return i._baseCache.set(r,t),i}}const c=(t,e)=>{switch(t[0]){case"Q":{const r=e||o.base58btc;return[o.base58btc.prefix,r.decode(`${o.base58btc.prefix}${t}`)]}case o.base58btc.prefix:{const r=e||o.base58btc;return[o.base58btc.prefix,r.decode(t)]}case s.base32.prefix:{const r=e||s.base32;return[s.base32.prefix,r.decode(t)]}default:if(null==e)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}},h=(t,e,r)=>{const{prefix:n}=r;if(n!==o.base58btc.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);const i=e.get(n);if(null==i){const i=r.encode(t).slice(1);return e.set(n,i),i}return i},f=(t,e,r)=>{const{prefix:n}=r,i=e.get(n);if(null==i){const i=r.encode(t);return e.set(n,i),i}return i},l=112,d=18,p=(t,e,r)=>{const i=n.encodingLength(t),o=i+n.encodingLength(e),s=new Uint8Array(o+r.byteLength);return n.encodeTo(t,s,0),n.encodeTo(e,s,i),s.set(r,o),s},m=Symbol.for("@ipld/js-cid/CID"),v={writable:!1,configurable:!1,enumerable:!0},b={writable:!1,enumerable:!1,configurable:!1},g="0.0.0-dev",y=(t,e)=>{if(!t.test(g))throw new Error(e);console.warn(e)},w="CID.isCID(v) is deprecated and will be removed in the next major release.\nFollowing code pattern:\n\nif (CID.isCID(value)) {\n doSomethingWithCID(value)\n}\n\nIs replaced with:\n\nconst cid = CID.asCID(value)\nif (cid) {\n // Make sure to use cid instead of value\n doSomethingWithCID(cid)\n}\n";e.CID=u},fd46:function(t,e,r){"use strict";const n=[255,254,252,248,240,224,192,128],i=[1,3,7,15,31,63,127,255];function o(t,e,r){const n=s(e,r);return(t&n)>>>e}function s(t,e){return n[t]&i[Math.min(e+t-1,7)]}t.exports=class{constructor(t){this._value=t,this._currentBytePos=t.length-1,this._currentBitPos=7}availableBits(){return this._currentBitPos+1+8*this._currentBytePos}totalBits(){return 8*this._value.length}take(t){let e=t,r=0;while(e&&this._haveBits()){const t=this._value[this._currentBytePos],n=this._currentBitPos+1,i=Math.min(n,e),s=o(t,n-i,i);r=(r<7)this._currentBitPos-=8,this._currentBytePos+=1}_haveBits(){return this._currentBytePos>=0}}},fda6:function(t,e,r){var n=r("8947"),i=r("4228"),o=r("e85f");function s(){return Object.keys(o)}e.createCipher=e.Cipher=n.createCipher,e.createCipheriv=e.Cipheriv=n.createCipheriv,e.createDecipher=e.Decipher=i.createDecipher,e.createDecipheriv=e.Decipheriv=i.createDecipheriv,e.listCiphers=e.getCiphers=s},fdac:function(t,e,r){var n;function i(t){this.rand=t}if(t.exports=function(t){return n||(n=new i(null)),n.generate(t)},t.exports.Rand=i,i.prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r