From 5076bef3060f1d78b2456539142deeec5331e259 Mon Sep 17 00:00:00 2001 From: haad Date: Mon, 18 Nov 2019 11:49:23 +0200 Subject: [PATCH] Improve entry fetching algorithm Fix tests Clean up code Improve loading visualization Increase browser tests timeout Use await in entry-io --- .gitignore | 1 + Makefile | 1 + benchmarks/benchmark-append.js | 2 +- benchmarks/benchmark-join2.js | 16 +- dist/ipfslog.min.js | 14 +- examples/browser/loader-visualization.html | 107 ++--- lib/es5/entry-io.js | 445 +++++++++++++-------- lib/es5/lamport-clock.js | 2 +- lib/es5/log-io.js | 135 +++---- lib/es5/log.js | 281 ++++++------- package.json | 2 +- src/entry-io.js | 172 ++++---- src/log-io.js | 88 ++-- src/log.js | 129 ++---- test/log-load.spec.js | 16 +- 15 files changed, 697 insertions(+), 714 deletions(-) diff --git a/.gitignore b/.gitignore index 73aba241..3229a7aa 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ node_modules/ coverage/ ipfs/ ipfs-log/ +orbitdb/ dist/*.js.map examples/browser/bundle.js test/keystore/ diff --git a/Makefile b/Makefile index ea4083ae..bab0e2b8 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ build: test clean: rm -rf ipfs/ rm -rf ipfs-log-benchmarks/ + rm -rf orbitdb/ rm -rf node_modules/ rm -rf coverage/ rm -rf test/keystore/ diff --git a/benchmarks/benchmark-append.js b/benchmarks/benchmark-append.js index 1d41c814..8a048538 100644 --- a/benchmarks/benchmark-append.js +++ b/benchmarks/benchmark-append.js @@ -56,7 +56,7 @@ let run = (() => { // const memstore = new MemStore() // ipfs.dag.put = memstore.put.bind(memstore) // ipfs.dag.get = memstore.get.bind(memstore) - const signingKeysPath = './benchmarks/ipfs-log-benchmarks/keys1' + const signingKeysPath = './test/fixtures/keys/signing-keys' const store = await storage.createStore(signingKeysPath) const keystore = new Keystore(store) const identity = await IdentityProvider.createIdentity({ id: 'userA', keystore }) diff --git a/benchmarks/benchmark-join2.js b/benchmarks/benchmark-join2.js index cc237ca7..303ede0b 100644 --- a/benchmarks/benchmark-join2.js +++ b/benchmarks/benchmark-join2.js @@ -9,6 +9,7 @@ const Keystore = require('orbit-db-keystore') const leveldown = require('leveldown') const storage = require('orbit-db-storage-adapter')(leveldown) + // State let ipfs let log1, log2 @@ -60,14 +61,11 @@ let run = (() => { // ipfs.dag.put = memstore.put.bind(memstore) // ipfs.dag.get = memstore.get.bind(memstore) - const signingKeysPath1 = './benchmarks/ipfs-log-benchmarks/keys1' - const signingKeysPath2 = './benchmarks/ipfs-log-benchmarks/keys2' - const store1 = await storage.createStore(signingKeysPath1) - const store2 = await storage.createStore(signingKeysPath2) - const keystore1 = new Keystore(store1) - const keystore2 = new Keystore(store2) - const identity = await IdentityProvider.createIdentity({ id: 'userA', keystore: keystore1 }) - const identity2 = await IdentityProvider.createIdentity({ id: 'userB', keystore: keystore2 }) + const signingKeysPath = './test/fixtures/keys/signing-keys' + const store = await storage.createStore(signingKeysPath) + const keystore = new Keystore(store) + const identity = await IdentityProvider.createIdentity({ id: 'userA', keystore }) + const identity2 = await IdentityProvider.createIdentity({ id: 'userB', keystore }) log1 = new Log(ipfs, identity, { logId: 'A' }) log2 = new Log(ipfs, identity2, { logId: 'A' }) @@ -97,7 +95,7 @@ let run = (() => { console.log('Entry size:', Buffer.from(JSON.stringify(l2.heads)).length, 'bytes') // console.log(log2.heads) console.log('log length:', log2.values.length) - console.log(log2.values.map(e => e.payload)) + // console.log(log2.values.map(e => e.payload)) }) })() diff --git a/dist/ipfslog.min.js b/dist/ipfslog.min.js index 1d95e628..6ad1d2d8 100644 --- a/dist/ipfslog.min.js +++ b/dist/ipfslog.min.js @@ -1,25 +1,25 @@ -var Log=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=26)}([function(e,t,n){"use strict";(function(e){ +var Log=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=28)}([function(e,t,n){"use strict";(function(e){ /*! * The buffer module from node.js, for the browser. * - * @author Feross Aboukhadijeh + * @author Feross Aboukhadijeh * @license MIT */ -var r=n(27),i=n(28),o=n(29);function s(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function k(e,t){if(f.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(r)return z(e).length;t=(""+t).toLowerCase(),r=!0}}function d(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return K(this,t,n);case"utf8":case"utf-8":return A(this,t,n);case"ascii":return N(this,t,n);case"latin1":case"binary":return B(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function p(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function m(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=f.from(t,r)),f.isBuffer(t))return 0===t.length?-1:g(e,t,n,r,i);if("number"==typeof t)return t&=255,f.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):g(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,n,r,i){var o,s=1,a=e.length,f=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,f/=2,n/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var u=-1;for(o=n;oa&&(n=a-f),o=n;o>=0;o--){for(var h=!0,l=0;li&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function A(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:c>223?3:c>191?2:1;if(i+h<=n)switch(h){case 1:c<128&&(u=c);break;case 2:128==(192&(o=e[i+1]))&&(f=(31&c)<<6|63&o)>127&&(u=f);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(f=(15&c)<<12|(63&o)<<6|63&s)>2047&&(f<55296||f>57343)&&(u=f);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(f=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&f<1114112&&(u=f)}null===u?(u=65533,h=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=h}return function(e){var t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},f.prototype.compare=function(e,t,n,r,i){if(!f.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),c=this.slice(r,i),u=e.slice(t,n),h=0;hi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return S(this,e,t,n);case"utf8":case"utf-8":return y(this,e,t,n);case"ascii":return E(this,e,t,n);case"latin1":case"binary":return x(this,e,t,n);case"base64":return w(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function N(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function T(e,t,n,r,i,o){if(!f.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function P(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function j(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function C(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,o){return o||C(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,o){return o||C(e,0,n,8),i.write(e,t,n,r,52,8),n+8}f.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},f.prototype.readUInt8=function(e,t){return t||L(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return t||L(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return t||L(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||L(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},f.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||L(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},f.prototype.readInt8=function(e,t){return t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){t||L(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},f.prototype.readInt16BE=function(e,t){t||L(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},f.prototype.readInt32LE=function(e,t){return t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return t||L(e,4,this.length),i.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return t||L(e,4,this.length),i.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return t||L(e,8,this.length),i.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return t||L(e,8,this.length),i.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||T(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},f.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,1,255,0),f.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},f.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},f.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):j(this,e,t,!0),t+4},f.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},f.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);T(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+n},f.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);T(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},f.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,1,127,-128),f.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},f.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},f.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},f.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):j(this,e,t,!0),t+4},f.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),f.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},f.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},f.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},f.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},f.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},f.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!f.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function H(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(R,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(10))},function(e,t,n){e.exports={encode:n(38),decode:n(39),encodingLength:n(40)}},function(e,t,n){"use strict";e.exports={isArray:Array.isArray,assign:Object.assign,isObject:e=>"object"==typeof e,isFunction:e=>"function"==typeof e,isBoolean:e=>"boolean"==typeof e,isRegex:e=>e instanceof RegExp,keys:Object.keys}},function(e,t,n){"use strict";(function(t){const r=n(4),i=n(21),o=n(15),s=n(23);(e.exports=o(class{constructor(e,t,n){i(n,"A link requires a cid to point to"),this._name=e||"",this._nameBuf=null,this._size=t,this._cid=new r(n),s.hidePrivateFields(this),s.addEnumerableGetters(this,["Hash","Name","Tsize"])}toString(){return`DAGLink <${this._cid.toBaseEncodedString()} - name: "${this.Name}", size: ${this.Tsize}>`}toJSON(){return this._json||(this._json=Object.freeze({name:this.Name,size:this.Tsize,cid:this.Hash.toBaseEncodedString()})),Object.assign({},this._json)}get Name(){return this._name}get nameAsBuffer(){return null!==this._nameBuf?this._nameBuf:(this._nameBuf=t.from(this._name),this._nameBuf)}set Name(e){throw new Error("Can't set property: 'name' is immutable")}get Tsize(){return this._size}set Tsize(e){throw new Error("Can't set property: 'size' is immutable")}get Hash(){return this._cid}set Hash(e){throw new Error("Can't set property: 'cid' is immutable")}},{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"})).util=n(71)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(13),i=n(41),o=n(19),s=n(14),a=n(51);class f{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 f.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";f.validateCID(this)}else this.version=e,this.codec=n,this.multihash=s,this.multibaseName=a||(0===e?"base58btc":"base32"),f.validateCID(this)}get buffer(){let e=this._buffer;if(!e){if(0===this.version)e=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");e=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=n(15)(f,{className:"CID",symbolName:"@ipld/js-cid/CID"});c.codecs=s,e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){"use strict";class r{constructor(e,t){this.id=e,this.time=t||0}tick(){return new r(this.id,++this.time)}merge(e){return this.time=Math.max(this.time,e.time),new r(this.id,this.time)}clone(){return new r(this.id,this.time)}static compare(e,t){var n=e.time-t.time;return 0===n&&e.id!==t.id?e.id{s(this,e.Name,t)})}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 size(){return void 0===this._size&&(this._size=this._links.reduce((e,t)=>e+t.Tsize,this._serializedSize)),this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}get Data(){return this._data}set Data(e){throw new Error("Can't set property: 'Data' is immutable")}get Links(){return this._links.map(e=>({Name:e.Name,Tsize:e.Tsize,Hash:e.Hash}))}set Links(e){throw new Error("Can't set property: 'Links' is immutable")}},{className:"DAGNode",symbolName:"@ipld/js-ipld-dag-pb/dagnode"})).create=n(7),t.clone=n(85),t.addLink=n(86),t.rmLink=n(87)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(58),{serialize:i}=n(8),o=n(9).linkSort,s=n(6),a=n(3);e.exports=(e,n=[])=>{if("string"==typeof e&&(e=t.from(e)),!t.isBuffer(e))throw new Error("Passed 'data' is not a buffer or a string!");n=n.map(e=>a.isDAGLink(e)?e:a.util.createDagLinkFromB58EncodedHash(e)),n=r(n,o);const f=i({Data:e,Links:n});return new s(e,n,f.length)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(4),o=n(59)(n(70)),s=n(3),a=n(6),f=n(19),c=n(72);(t=e.exports).codec=f.DAG_PB,t.defaultHashAlg=f.SHA2_256;t.serialize=e=>{let t=e.Data,n=e.Links||[];return!a.isDAGNode(e)&&n&&(n=n.map(e=>s.isDAGLink(e)?e:s.util.createDagLinkFromB58EncodedHash(e))),o.PBNode.encode(function(e){const t={};e.Data&&e.Data.length>0?t.Data=e.Data:t.Data=null;e.Links&&e.Links.length>0?t.Links=e.Links.map(e=>({Hash:e.Hash.buffer,Name:e.Name,Tsize:e.Tsize})):t.Links=null;return t}({Data:t,Links:n}))},t.deserialize=e=>{const t=o.PBNode.decode(e),n=t.Links.map(e=>new s(e.Name,e.Tsize,e.Hash)),i=null==t.Data?r.alloc(0):t.Data;return new a(i,n,e.length)},t.cid=async(e,n)=>{const r={cidVersion:1,hashAlg:t.defaultHashAlg},o=Object.assign(r,n),s=await c(e,o.hashAlg),a=f.print[t.codec];return new i(o.cidVersion,a,s)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(3),{cid:o,serialize:s}=n(8);(t=e.exports).cloneData=function(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},t.cloneLinks=function(e){return e.Links.slice()},t.linkSort=function(e,t){return r.compare(e.nameAsBuffer,t.nameAsBuffer)},t.toDAGLink=async(e,t={})=>{const n=s(e),r=await o(n);return new i(t.name||"",n.length,r)}}).call(this,n(0).Buffer)},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";(function(t){const r=n(5),{isDefined:i,io:o}=n(12),s=n(89),a=["next"],f=()=>new Error("Ipfs instance not defined"),c={0:"dag-pb",1:"dag-cbor"};class u{static async create(e,t,n,o,s=[],a,c=[]){if(!i(e))throw f();if(!i(t))throw new Error("Identity is required, cannot create entry");if(!i(n))throw new Error("Entry requires an id");if(!i(o))throw new Error("Entry requires data");if(!i(s)||!Array.isArray(s))throw new Error("'next' argument is not an array");const h={hash:null,id:n,payload:o,next:s.filter(i).map(e=>e.hash?e.hash:e),refs:c,v:1,clock:a||new r(t.publicKey)},l=await t.provider.sign(t,u.toBuffer(h));return h.key=t.publicKey,h.identity=t.toJSON(),h.sig=l,h.hash=await u.toMultihash(e,h),h}static async verify(e,t){if(!e)throw new Error("Identity-provider is required, cannot verify entry");if(!u.isEntry(t))throw new Error("Invalid Log entry");if(!t.key)throw new Error("Entry doesn't have a key");if(!t.sig)throw new Error("Entry doesn't have a signature");const n={hash:null,id:t.id,payload:t.payload,next:t.next,refs:t.refs,v:t.v,clock:t.clock};return e.verify(t.sig,t.key,u.toBuffer(n),"v"+t.v)}static toBuffer(e){const n=0===e.v?JSON.stringify(e):s(e);return t.from(n)}static async toMultihash(e,t){if(!e)throw f();if(!u.isEntry(t))throw new Error("Invalid object format, cannot generate entry hash");const n={hash:null,id:t.id,payload:t.payload,next:t.next,refs:t.refs,v:t.v,clock:t.clock};return t.key&&Object.assign(n,{key:t.key}),t.identity&&Object.assign(n,{identity:t.identity}),t.sig&&Object.assign(n,{sig:t.sig}),o.write(e,c[n.v],n,{links:a})}static async fromMultihash(e,t){if(!e)throw f();if(!t)throw new Error(`Invalid hash: ${t}`);const n=await o.read(e,t,{links:a});let i={hash:t,id:n.id,payload:n.payload,next:n.next,refs:n.refs,v:n.v,clock:new r(n.clock.id,n.clock.time)};return n.key&&Object.assign(i,{key:n.key}),n.identity&&Object.assign(i,{identity:n.identity}),n.sig&&Object.assign(i,{sig:n.sig}),i}static isEntry(e){return e&&void 0!==e.id&&void 0!==e.next&&void 0!==e.payload&&void 0!==e.v&&void 0!==e.hash&&void 0!==e.clock}static compare(e,t){var n=r.compare(e.clock,t.clock);return 0===n?e.clock.id-1}static findChildren(e,t){for(var n=[],r=t.find(t=>u.isParent(e,t)),i=e;r;)n.push(r),i=r,r=t.find(e=>u.isParent(i,e));return n=n.sort((e,t)=>e.clock.time>t.clock.time)}}e.exports=u}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(32),i=n(33),o=n(34),s=n(35);e.exports={difference:r,findUniques:i,isDefined:o,io:s}},function(e,t,n){"use strict";(function(e){const r=n(36),i=n(37);t.names=i.names,t.codes=i.codes,t.defaultLengths=i.defaultLengths;const o=n(1);function s(e){t.decode(e)}t.toHexString=function(t){if(!e.isBuffer(t))throw new Error("must be passed a buffer");return t.toString("hex")},t.fromHexString=function(t){return e.from(t,"hex")},t.toB58String=function(t){if(!e.isBuffer(t))throw new Error("must be passed a buffer");return r.encode(t)},t.fromB58String=function(t){let n=t;return e.isBuffer(t)&&(n=t.toString()),e.from(r.decode(n))},t.decode=function(n){if(!e.isBuffer(n))throw new Error("multihash must be a Buffer");if(n.length<3)throw new Error("multihash too short. must be > 3 bytes.");const r=o.decode(n);if(!t.isValidCode(r))throw new Error(`multihash unknown function code: 0x${r.toString(16)}`);n=n.slice(o.decode.bytes);const s=o.decode(n);if(s<1)throw new Error(`multihash invalid length: 0x${s.toString(16)}`);if((n=n.slice(o.decode.bytes)).length!==s)throw new Error(`multihash length inconsistent: 0x${n.toString("hex")}`);return{code:r,name:i.codes[r],length:s,digest:n}},t.encode=function(n,r,i){if(!n||void 0===r)throw new Error("multihash encode requires at least two args: digest, code");const s=t.coerceCode(r);if(!e.isBuffer(n))throw new Error("digest should be a Buffer");if(null==i&&(i=n.length),i&&n.length!==i)throw new Error("digest length should be equal to specified length.");return e.concat([e.from(o.encode(s)),e.from(o.encode(i)),n])},t.coerceCode=function(e){let n=e;if("string"==typeof e){if(void 0===i.names[e])throw new Error(`Unrecognized hash function named: ${e}`);n=i.names[e]}if("number"!=typeof n)throw new Error(`Hash function code should be a number. Got: ${n}`);if(void 0===i.codes[n]&&!t.isAppCode(n))throw new Error(`Unrecognized function code: ${n}`);return n},t.isAppCode=function(e){return e>0&&e<16},t.isValidCode=function(e){return!!t.isAppCode(e)||!!i.codes[e]},t.validate=s,t.prefix=function(e){return s(e),e.slice(0,2)}}).call(this,n(0).Buffer)},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.json=e.from("0200","hex"),t.messagepack=e.from("0201","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["ipns-ns"]=e.from("e5","hex"),t.zeronet=e.from("e6","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,{className:t,symbolName:n}){const r=Symbol.for(n),i={[t]:class extends e{constructor(...e){super(...e),Object.defineProperty(this,r,{value:!0})}get[Symbol.toStringTag](){return t}}}[t];return i[`is${t}`]=e=>!(!e||!e[r]),i},e.exports.proto=function(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}},function(e,t,n){"use strict";t.defined=function(e){return null!=e&&("number"!=typeof e||!isNaN(e))}},function(e,t,n){var r=n(18).Buffer;e.exports=function(e){for(var t={},n=e.length,i=e.charAt(0),o=0;o>=8;for(;c>0;)o.push(255&c),c>>=8}for(var u=0;e[u]===i&&u0;)r.push(a%n),a=a/n|0}for(var f="",c=0;0===t[c]&&c=0;--u)f+=e[r[u]];return f},decodeUnsafe:a,decode:function(e){var t=a(e);if(t)return t;throw new Error("Non-base"+n+" character")}}}},function(e,t,n){var r=n(0),i=r.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";(function(r){const i=n(1),o=n(47),s=n(48),a=n(20);(t=e.exports).addPrefix=(e,t)=>{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 f=n(49);Object.assign(t,f),t.print=n(50)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(1);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")}e.exports={numberToBuffer:o,bufferToNumber:i,varintBufferEncode:function(e){return t.from(r.encode(i(e)))},varintBufferDecode:function(e){return o(r.decode(e))}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){var r=n(53); +var r=n(29),i=n(30),o=n(31);function s(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function k(e,t){if(f.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(r)return z(e).length;t=(""+t).toLowerCase(),r=!0}}function d(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return K(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return N(this,t,n);case"latin1":case"binary":return B(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function p(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function m(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=f.from(t,r)),f.isBuffer(t))return 0===t.length?-1:g(e,t,n,r,i);if("number"==typeof t)return t&=255,f.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):g(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,n,r,i){var o,s=1,a=e.length,f=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,f/=2,n/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var u=-1;for(o=n;oa&&(n=a-f),o=n;o>=0;o--){for(var h=!0,l=0;li&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function I(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:c>223?3:c>191?2:1;if(i+h<=n)switch(h){case 1:c<128&&(u=c);break;case 2:128==(192&(o=e[i+1]))&&(f=(31&c)<<6|63&o)>127&&(u=f);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(f=(15&c)<<12|(63&o)<<6|63&s)>2047&&(f<55296||f>57343)&&(u=f);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(f=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&f<1114112&&(u=f)}null===u?(u=65533,h=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=h}return function(e){var t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},f.prototype.compare=function(e,t,n,r,i){if(!f.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),c=this.slice(r,i),u=e.slice(t,n),h=0;hi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return S(this,e,t,n);case"utf8":case"utf-8":return y(this,e,t,n);case"ascii":return E(this,e,t,n);case"latin1":case"binary":return x(this,e,t,n);case"base64":return w(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function N(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function T(e,t,n,r,i,o){if(!f.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function j(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function P(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function C(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,o){return o||C(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,o){return o||C(e,0,n,8),i.write(e,t,n,r,52,8),n+8}f.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},f.prototype.readUInt8=function(e,t){return t||L(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return t||L(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return t||L(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||L(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},f.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||L(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},f.prototype.readInt8=function(e,t){return t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){t||L(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},f.prototype.readInt16BE=function(e,t){t||L(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},f.prototype.readInt32LE=function(e,t){return t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return t||L(e,4,this.length),i.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return t||L(e,4,this.length),i.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return t||L(e,8,this.length),i.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return t||L(e,8,this.length),i.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||T(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},f.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,1,255,0),f.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):j(this,e,t,!0),t+2},f.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):j(this,e,t,!1),t+2},f.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):P(this,e,t,!0),t+4},f.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):P(this,e,t,!1),t+4},f.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);T(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+n},f.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);T(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},f.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,1,127,-128),f.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},f.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):j(this,e,t,!0),t+2},f.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):j(this,e,t,!1),t+2},f.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):P(this,e,t,!0),t+4},f.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),f.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):P(this,e,t,!1),t+4},f.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},f.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},f.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},f.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},f.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!f.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function H(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(R,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(10))},function(e,t,n){e.exports={encode:n(39),decode:n(40),encodingLength:n(41)}},function(e,t,n){"use strict";e.exports={isArray:Array.isArray,assign:Object.assign,isObject:e=>"object"==typeof e,isFunction:e=>"function"==typeof e,isBoolean:e=>"boolean"==typeof e,isRegex:e=>e instanceof RegExp,keys:Object.keys}},function(e,t,n){"use strict";(function(t){const r=n(4),i=n(22),o=n(15),s=n(24);(e.exports=o(class{constructor(e,t,n){i(n,"A link requires a cid to point to"),this._name=e||"",this._nameBuf=null,this._size=t,this._cid=new r(n),s.hidePrivateFields(this),s.addEnumerableGetters(this,["Hash","Name","Tsize"])}toString(){return`DAGLink <${this._cid.toBaseEncodedString()} - name: "${this.Name}", size: ${this.Tsize}>`}toJSON(){return this._json||(this._json=Object.freeze({name:this.Name,size:this.Tsize,cid:this.Hash.toBaseEncodedString()})),Object.assign({},this._json)}get Name(){return this._name}get nameAsBuffer(){return null!==this._nameBuf?this._nameBuf:(this._nameBuf=t.from(this._name),this._nameBuf)}set Name(e){throw new Error("Can't set property: 'name' is immutable")}get Tsize(){return this._size}set Tsize(e){throw new Error("Can't set property: 'size' is immutable")}get Hash(){return this._cid}set Hash(e){throw new Error("Can't set property: 'cid' is immutable")}},{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"})).util=n(72)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(13),i=n(42),o=n(20),s=n(14),a=n(52);class f{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 f.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";f.validateCID(this)}else this.version=e,this.codec=n,this.multihash=s,this.multibaseName=a||(0===e?"base58btc":"base32"),f.validateCID(this)}get buffer(){let e=this._buffer;if(!e){if(0===this.version)e=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");e=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=n(15)(f,{className:"CID",symbolName:"@ipld/js-cid/CID"});c.codecs=s,e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){"use strict";class r{constructor(e,t){this.id=e,this.time=t||0}tick(){return new r(this.id,++this.time)}merge(e){return this.time=Math.max(this.time,e.time),new r(this.id,this.time)}clone(){return new r(this.id,this.time)}static compare(e,t){return e.time-t.time}}e.exports=r},function(e,t,n){"use strict";(function(r){const i=n(22),o=n(15),s=n(58),a=n(24);(t=e.exports=o(class{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,a.hidePrivateFields(this),a.addEnumerableGetters(this,["Data","Links"]),t.forEach((e,t)=>{s(this,e.Name,t)})}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 size(){return void 0===this._size&&(this._size=this._links.reduce((e,t)=>e+t.Tsize,this._serializedSize)),this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}get Data(){return this._data}set Data(e){throw new Error("Can't set property: 'Data' is immutable")}get Links(){return this._links.map(e=>({Name:e.Name,Tsize:e.Tsize,Hash:e.Hash}))}set Links(e){throw new Error("Can't set property: 'Links' is immutable")}},{className:"DAGNode",symbolName:"@ipld/js-ipld-dag-pb/dagnode"})).create=n(7),t.clone=n(86),t.addLink=n(87),t.rmLink=n(88)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(59),{serialize:i}=n(8),o=n(9).linkSort,s=n(6),a=n(3);e.exports=(e,n=[])=>{if("string"==typeof e&&(e=t.from(e)),!t.isBuffer(e))throw new Error("Passed 'data' is not a buffer or a string!");n=n.map(e=>a.isDAGLink(e)?e:a.util.createDagLinkFromB58EncodedHash(e)),n=r(n,o);const f=i({Data:e,Links:n});return new s(e,n,f.length)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(4),o=n(60)(n(71)),s=n(3),a=n(6),f=n(20),c=n(73);(t=e.exports).codec=f.DAG_PB,t.defaultHashAlg=f.SHA2_256;t.serialize=e=>{let t=e.Data,n=e.Links||[];return!a.isDAGNode(e)&&n&&(n=n.map(e=>s.isDAGLink(e)?e:s.util.createDagLinkFromB58EncodedHash(e))),o.PBNode.encode(function(e){const t={};e.Data&&e.Data.length>0?t.Data=e.Data:t.Data=null;e.Links&&e.Links.length>0?t.Links=e.Links.map(e=>({Hash:e.Hash.buffer,Name:e.Name,Tsize:e.Tsize})):t.Links=null;return t}({Data:t,Links:n}))},t.deserialize=e=>{const t=o.PBNode.decode(e),n=t.Links.map(e=>new s(e.Name,e.Tsize,e.Hash)),i=null==t.Data?r.alloc(0):t.Data;return new a(i,n,e.length)},t.cid=async(e,n)=>{const r={cidVersion:1,hashAlg:t.defaultHashAlg},o=Object.assign(r,n),s=await c(e,o.hashAlg),a=f.print[t.codec];return new i(o.cidVersion,a,s)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(3),{cid:o,serialize:s}=n(8);(t=e.exports).cloneData=function(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},t.cloneLinks=function(e){return e.Links.slice()},t.linkSort=function(e,t){return r.compare(e.nameAsBuffer,t.nameAsBuffer)},t.toDAGLink=async(e,t={})=>{const n=s(e),r=await o(n);return new i(t.name||"",n.length,r)}}).call(this,n(0).Buffer)},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";(function(t){const r=n(5),{isDefined:i,io:o}=n(12),s=n(90),a=["next"],f=()=>new Error("Ipfs instance not defined"),c={0:"dag-pb",1:"dag-cbor"};class u{static async create(e,t,n,o,s=[],a,c=[]){if(!i(e))throw f();if(!i(t))throw new Error("Identity is required, cannot create entry");if(!i(n))throw new Error("Entry requires an id");if(!i(o))throw new Error("Entry requires data");if(!i(s)||!Array.isArray(s))throw new Error("'next' argument is not an array");const h={hash:null,id:n,payload:o,next:s.filter(i).map(e=>e.hash?e.hash:e),refs:c,v:1,clock:a||new r(t.publicKey)},l=await t.provider.sign(t,u.toBuffer(h));return h.key=t.publicKey,h.identity=t.toJSON(),h.sig=l,h.hash=await u.toMultihash(e,h),h}static async verify(e,t){if(!e)throw new Error("Identity-provider is required, cannot verify entry");if(!u.isEntry(t))throw new Error("Invalid Log entry");if(!t.key)throw new Error("Entry doesn't have a key");if(!t.sig)throw new Error("Entry doesn't have a signature");const n={hash:null,id:t.id,payload:t.payload,next:t.next,refs:t.refs,v:t.v,clock:t.clock};return e.verify(t.sig,t.key,u.toBuffer(n),"v"+t.v)}static toBuffer(e){const n=0===e.v?JSON.stringify(e):s(e);return t.from(n)}static async toMultihash(e,t){if(!e)throw f();if(!u.isEntry(t))throw new Error("Invalid object format, cannot generate entry hash");const n={hash:null,id:t.id,payload:t.payload,next:t.next,refs:t.refs,v:t.v,clock:t.clock};return t.key&&Object.assign(n,{key:t.key}),t.identity&&Object.assign(n,{identity:t.identity}),t.sig&&Object.assign(n,{sig:t.sig}),o.write(e,c[n.v],n,{links:a})}static async fromMultihash(e,t){if(!e)throw f();if(!t)throw new Error(`Invalid hash: ${t}`);const n=await o.read(e,t,{links:a});let i={hash:t,id:n.id,payload:n.payload,next:n.next,refs:n.refs,v:n.v,clock:new r(n.clock.id,n.clock.time)};return n.key&&Object.assign(i,{key:n.key}),n.identity&&Object.assign(i,{identity:n.identity}),n.sig&&Object.assign(i,{sig:n.sig}),i}static isEntry(e){return e&&void 0!==e.id&&void 0!==e.next&&void 0!==e.payload&&void 0!==e.v&&void 0!==e.hash&&void 0!==e.clock}static compare(e,t){var n=r.compare(e.clock,t.clock);return 0===n?e.clock.id-1}static findChildren(e,t){for(var n=[],r=t.find(t=>u.isParent(e,t)),i=e;r;)n.push(r),i=r,r=t.find(e=>u.isParent(i,e));return n=n.sort((e,t)=>e.clock.time>t.clock.time)}}e.exports=u}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(33),i=n(34),o=n(35),s=n(36);e.exports={difference:r,findUniques:i,isDefined:o,io:s}},function(e,t,n){"use strict";(function(e){const r=n(37),i=n(38);t.names=i.names,t.codes=i.codes,t.defaultLengths=i.defaultLengths;const o=n(1);function s(e){t.decode(e)}t.toHexString=function(t){if(!e.isBuffer(t))throw new Error("must be passed a buffer");return t.toString("hex")},t.fromHexString=function(t){return e.from(t,"hex")},t.toB58String=function(t){if(!e.isBuffer(t))throw new Error("must be passed a buffer");return r.encode(t)},t.fromB58String=function(t){let n=t;return e.isBuffer(t)&&(n=t.toString()),e.from(r.decode(n))},t.decode=function(n){if(!e.isBuffer(n))throw new Error("multihash must be a Buffer");if(n.length<3)throw new Error("multihash too short. must be > 3 bytes.");const r=o.decode(n);if(!t.isValidCode(r))throw new Error(`multihash unknown function code: 0x${r.toString(16)}`);n=n.slice(o.decode.bytes);const s=o.decode(n);if(s<1)throw new Error(`multihash invalid length: 0x${s.toString(16)}`);if((n=n.slice(o.decode.bytes)).length!==s)throw new Error(`multihash length inconsistent: 0x${n.toString("hex")}`);return{code:r,name:i.codes[r],length:s,digest:n}},t.encode=function(n,r,i){if(!n||void 0===r)throw new Error("multihash encode requires at least two args: digest, code");const s=t.coerceCode(r);if(!e.isBuffer(n))throw new Error("digest should be a Buffer");if(null==i&&(i=n.length),i&&n.length!==i)throw new Error("digest length should be equal to specified length.");return e.concat([e.from(o.encode(s)),e.from(o.encode(i)),n])},t.coerceCode=function(e){let n=e;if("string"==typeof e){if(void 0===i.names[e])throw new Error(`Unrecognized hash function named: ${e}`);n=i.names[e]}if("number"!=typeof n)throw new Error(`Hash function code should be a number. Got: ${n}`);if(void 0===i.codes[n]&&!t.isAppCode(n))throw new Error(`Unrecognized function code: ${n}`);return n},t.isAppCode=function(e){return e>0&&e<16},t.isValidCode=function(e){return!!t.isAppCode(e)||!!i.codes[e]},t.validate=s,t.prefix=function(e){return s(e),e.slice(0,2)}}).call(this,n(0).Buffer)},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.json=e.from("0200","hex"),t.messagepack=e.from("0201","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["ipns-ns"]=e.from("e5","hex"),t.zeronet=e.from("e6","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,{className:t,symbolName:n}){const r=Symbol.for(n),i={[t]:class extends e{constructor(...e){super(...e),Object.defineProperty(this,r,{value:!0})}get[Symbol.toStringTag](){return t}}}[t];return i[`is${t}`]=e=>!(!e||!e[r]),i},e.exports.proto=function(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}},function(e,t,n){"use strict";t.defined=function(e){return null!=e&&("number"!=typeof e||!isNaN(e))}},function(e,t,n){"use strict";e.exports=(e,t,n)=>new Promise((r,i)=>{if(n=Object.assign({concurrency:1/0},n),"function"!=typeof t)throw new TypeError("Mapper function is required");const o=n.concurrency;if(!("number"==typeof o&&o>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${o}\` (${typeof o})`);const s=[],a=e[Symbol.iterator]();let f=!1,c=!1,u=0,h=0;const l=()=>{if(f)return;const e=a.next(),n=h;if(h++,e.done)return c=!0,void(0===u&&r(s));u++,Promise.resolve(e.value).then(e=>t(e,n)).then(e=>{s[n]=e,u--,l()},e=>{f=!0,i(e)})};for(let e=0;e>=8;for(;c>0;)o.push(255&c),c>>=8}for(var u=0;e[u]===i&&u0;)r.push(a%n),a=a/n|0}for(var f="",c=0;0===t[c]&&c=0;--u)f+=e[r[u]];return f},decodeUnsafe:a,decode:function(e){var t=a(e);if(t)return t;throw new Error("Non-base"+n+" character")}}}},function(e,t,n){var r=n(0),i=r.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";(function(r){const i=n(1),o=n(48),s=n(49),a=n(21);(t=e.exports).addPrefix=(e,t)=>{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 f=n(50);Object.assign(t,f),t.print=n(51)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(1);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")}e.exports={numberToBuffer:o,bufferToNumber:i,varintBufferEncode:function(e){return t.from(r.encode(i(e)))},varintBufferDecode:function(e){return o(r.decode(e))}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){var r=n(54); /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */function i(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i=0;c--)if(u[c]!==h[c])return!1;for(c=u.length-1;c>=0;c--)if(a=u[c],!S(e[a],t[a],n,r))return!1;return!0}(e,t,n,r))}return n?e===t:e==t}function y(e){return"[object Arguments]"==Object.prototype.toString.call(e)}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,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=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&m(i,n,"Missing expected exception"+r);var o="string"==typeof r,a=!e&&i&&!n;if((!e&&s.isError(i)&&o&&E(i,n)||a)&&m(i,n,"Got unwanted exception"+r),e&&i&&n&&!E(i,n)||!e&&i)throw i}l.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return d(p(e.actual),128)+" "+e.operator+" "+d(p(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||m;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var n=new Error;if(n.stack){var r=n.stack,i=k(t),o=r.indexOf("\n"+i);if(o>=0){var s=r.indexOf("\n",o+1);r=r.substring(s+1)}this.stack=r}}},s.inherits(l.AssertionError,Error),l.fail=m,l.ok=g,l.equal=function(e,t,n){e!=t&&m(e,t,n,"==",l.equal)},l.notEqual=function(e,t,n){e==t&&m(e,t,n,"!=",l.notEqual)},l.deepEqual=function(e,t,n){S(e,t,!1)||m(e,t,n,"deepEqual",l.deepEqual)},l.deepStrictEqual=function(e,t,n){S(e,t,!0)||m(e,t,n,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function(e,t,n){S(e,t,!1)&&m(e,t,n,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=function e(t,n,r){S(t,n,!0)&&m(t,n,r,"notDeepStrictEqual",e)},l.strictEqual=function(e,t,n){e!==t&&m(e,t,n,"===",l.strictEqual)},l.notStrictEqual=function(e,t,n){e===t&&m(e,t,n,"!==",l.notStrictEqual)},l.throws=function(e,t,n){x(!0,e,t,n)},l.doesNotThrow=function(e,t,n){x(!1,e,t,n)},l.ifError=function(e){if(e)throw e},l.strict=r((function e(t,n){t||m(t,!0,n,"==",e)}),l,{equal:l.strictEqual,deepEqual:l.deepStrictEqual,notEqual:l.notStrictEqual,notDeepEqual:l.notDeepStrictEqual}),l.strict.strict=l.strict;var w=Object.keys||function(e){var t=[];for(var n in e)a.call(e,n)&&t.push(n);return t}}).call(this,n(10))},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var f,c=[],u=!1,h=-1;function l(){u&&f&&(u=!1,f.length?c=f.concat(c):h=-1,c.length&&b())}function b(){if(!u){var e=a(l);u=!0;for(var t=c.length;t;){for(f=c,c=[];++h1)for(var n=1;n{for(const n of t){let t,r=e;for(;void 0===t;){if(null===(r=Object.getPrototypeOf(r)))throw new Error(`no getter named '${n}' found`);t=Object.getOwnPropertyDescriptor(r,n)}if(void 0===t.get)throw new Error(`no getter named '${n}' found`);Object.defineProperty(e,n,{enumerable:!0,get:t.get})}},hidePrivateFields:e=>{for(const t in e)"_"===t[0]&&Object.defineProperty(e,t,{enumerable:!1})}}},function(e,t,n){(function(t){var n="Input must be an string, Buffer or Uint8Array";function r(e){return(4294967296+e).toString(16).substring(1)}e.exports={normalizeInput:function(e){var r;if(e instanceof Uint8Array)r=e;else if(e instanceof t)r=new Uint8Array(e);else{if("string"!=typeof e)throw new Error(n);r=new Uint8Array(t.from(e,"utf8"))}return r},toHex:function(e){return Array.prototype.map.call(e,(function(e){return(e<16?"0":"")+e.toString(16)})).join("")},debugPrint:function(e,t,n){for(var i="\n"+e+" = ",o=0;onew Error("IPFS instance not defined"),LogNotDefinedError:()=>new Error("Log instance not defined"),NotALogError:()=>new Error("Given argument is not an instance of Log"),CannotJoinWithDifferentId:()=>new Error("Can't join logs with different IDs"),LtOrLteMustBeStringOrArray:()=>new Error("lt or lte must be a string or array of Entries")}},function(e,t,n){"use strict";(function(t){const r=n(30),i=n(31),o=n(11),s=n(91),a=n(25),f=n(5),c=n(95),{LastWriteWins:u,NoZeroes:h}=c,l=n(96),{isDefined:b,findUniques:k}=n(12),d=n(97),p=()=>(new Date).getTime().toString(),m=e=>e.hash,g=(e,t)=>e.concat(t),S=e=>e.next,y=(e,t)=>Math.max(e,t.clock.time),E=(e,t)=>(e[t.hash]=t,e);class x extends i{constructor(e,t,{logId:n,access:r,entries:i,heads:o,clock:s,sortFn:c}={}){if(!b(e))throw a.IPFSNotDefinedError();if(!b(t))throw new Error("Identity is required");if(b(r)||(r=new l),b(i)&&!Array.isArray(i))throw new Error("'entries' argument must be an array of Entry instances");if(b(o)&&!Array.isArray(o))throw new Error("'heads' argument must be an array");b(c)||(c=u),super(),this._sortFn=h(c),this._storage=e,this._id=n||p(),this._access=r,this._identity=t,i=i||[],this._entryIndex=new d(i.reduce(E,{})),o=o||x.findHeads(i),this._headsIndex=o.reduce(E,{}),this._nextsIndex={};i.forEach(e=>e.next.forEach(t=>this._nextsIndex[t]=e.hash)),this._length=i.length;const k=Math.max(s?s.time:0,this.heads.reduce(y,0));this._clock=new f(this._identity.publicKey,k)}get id(){return this._id}get clock(){return this._clock}get length(){return this._length}get values(){return Object.values(this.traverse(this.heads)).reverse()}get heads(){return Object.values(this._headsIndex).sort(this._sortFn).reverse()}get tails(){return x.findTails(this.values)}get tailHashes(){return x.findTailHashes(this.values)}setIdentity(e){this._identity=e;const t=Math.max(this.clock.time,this.heads.reduce(y,0));this._clock=new f(this._identity.publicKey,t)}get(e){return this._entryIndex.get(e)}has(e){return void 0!==this._entryIndex.get(e.hash||e)}getNextAndTraverse(e,t){let n=e.map(e=>e.refs[0]).map(e=>this.get(e)).filter(b),r={},i={},o=0;const s=e=>this.get(e),a=e=>{e&&!r[e.hash]&&(n=[e,...n].sort(this._sortFn).reverse(),r[e.hash]=!0)},f=e=>{i[e.hash]=e,r[e.hash]=!0,o++};for(e.forEach(f);n.length>0&&(othis.get(e),f=e=>{e&&!i[e.hash]&&(r=[e,...r].sort(this._sortFn).reverse(),i[e.hash]=!0)};for(;r.length>0&&(s{const t=new Set;for(let n=1;n<=e;n*=2){const e=Math.min(n-1,a.length-1),r=a[e];t.add(r)}return t})(Math.min(t,a.length));let u=new Set(c);a.lengthu.delete(e));const h=Array.from(u).map(m),l=await o.create(this._storage,this._identity,this.id,e,s,this.clock,h);if(!await this._access.canAppend(l,this._identity.provider))throw new Error(`Could not append entry, key "${this._identity.id}" is not allowed to write to the log`);return this._entryIndex.set(l.hash,l),s.forEach(e=>this._nextsIndex[e]=l.hash),this._headsIndex={},this._headsIndex[l.hash]=l,this._length++,l}iterator({gt:e,gte:t,lt:n,lte:r,amount:i=-1}={}){if(0===i)return function*(){}();if("string"==typeof r&&(r=[this.get(r)]),"string"==typeof n&&(n=[this.get(this.get(n).next)]),r&&!Array.isArray(r))throw a.LtOrLteMustBeStringOrArray();if(n&&!Array.isArray(n))throw a.LtOrLteMustBeStringOrArray();let o=(r||n||this.heads).filter(b),s=t?this.get(t).hash:e?this.get(e).hash:null,f=s?-1:i||-1,c=this.traverse(o,f,s),u=Object.values(c);return e&&u.pop(),(e||t)&&i>-1&&(u=u.slice(u.length-i,u.length)),function*(){for(let e in u)yield u[e]}()}async join(e,t=-1){if(!b(e))throw a.LogNotDefinedError();if(!x.isLog(e))throw a.NotALogError();if(this.id!==e.id)return;const n=x.difference(e,this),i=this._identity.provider,s=async e=>{if(!await this._access.canAppend(e,i))throw new Error(`Could not append entry, key "${e.identity.id}" is not allowed to write to the log`)},c=Object.values(n);await r(c,async e=>{await s(e),await(async e=>{const t=await o.verify(i,e),n=e.identity?e.identity.publicKey:e.key;if(!t)throw new Error(`Could not validate signature "${e.sig}" for entry "${e.hash}" and key "${n}"`)})(e)});Object.values(n).forEach(e=>{this.get(e.hash)||this._length++,e.next.forEach(t=>this._nextsIndex[t]=e.hash)}),this._entryIndex.add(n);const u=Object.values(n).map(S).reduce(g,[]),h=x.findHeads(Object.values(Object.assign({},this._headsIndex,e._headsIndex))).filter(e=>!u.find(t=>t===e.hash)).filter(e=>!this._nextsIndex[e.hash]).reduce(E,{});if(this._headsIndex=h,t>-1){let e=this.values;e=e.slice(-t),this._entryIndex=null,this._entryIndex=new d(e.reduce(E,{})),this._headsIndex=x.findHeads(e).reduce(E,{}),this._length=this._entryIndex.length}const l=Object.values(this._headsIndex).reduce(y,0);return this._clock=new f(this.clock.id,Math.max(this.clock.time,l)),this}toJSON(){return{id:this.id,heads:this.heads.sort(this._sortFn).reverse().map(m)}}toSnapshot(){return{id:this.id,heads:this.heads,values:this.values}}toBuffer(){return t.from(JSON.stringify(this.toJSON()))}toString(e){return this.values.slice().reverse().map((t,n)=>{const r=o.findChildren(t,this.values).length;let i=new Array(Math.max(r-1,0));return i=r>1?i.fill(" "):i,(i=r>0?i.concat(["└─"]):i).join("")+(e?e(t.payload):t.payload)}).join("\n")}static isLog(e){return void 0!==e.id&&void 0!==e.heads&&void 0!==e._entryIndex}toMultihash({format:e}={}){return s.toMultihash(this._storage,this,{format:e})}static async fromMultihash(e,t,n,{access:r,length:i=-1,exclude:o,onProgressCallback:a,sortFn:c,timeout:u,format:h}={}){const l=await s.fromMultihash(e,n,{length:i,exclude:o,onProgressCallback:a,timeout:u,format:h});return new x(e,t,{logId:l.id,access:r,entries:l.values,heads:l.heads,clock:new f(l.clock.id,l.clock.time),sortFn:c})}static async fromEntryHash(e,t,n,{logId:r,access:i,length:o=-1,exclude:a,onProgressCallback:f,sortFn:c,timeout:u}){const h=await s.fromEntryHash(e,n,{length:o,exclude:a,onProgressCallback:f,timeout:u});return new x(e,t,{logId:r,access:i,entries:h.values,sortFn:c})}static async fromJSON(e,t,n,{access:r,length:i=-1,timeout:o,onProgressCallback:a,sortFn:f}={}){const c=await s.fromJSON(e,n,{length:i,timeout:o,onProgressCallback:a});return new x(e,t,{logId:c.id,access:r,entries:c.values,sortFn:f})}static async fromEntry(e,t,n,{access:r,length:i=-1,exclude:o,onProgressCallback:a,timeout:f,sortFn:c}={}){const u=await s.fromEntry(e,n,{length:i,exclude:o,onProgressCallback:a,timeout:f});return new x(e,t,{logId:u.id,access:r,entries:u.values,sortFn:c})}static findHeads(e){var t=e.reduce((e,t,n,r)=>{return t.next.forEach(n=>e[n]=t.hash),e},{});return e.filter(e=>void 0===t[e.hash]).sort((e,t)=>e.clock.id>t.clock.id)}static findTails(e){var t={},n=[],r={},i=[];e.forEach(e=>{0===e.next.length&&n.push(e);e.next.forEach(n=>{t[n]||(t[n]=[]),t[n].push(e)}),i=i.concat(e.next),r[e.hash]=!0});const s=i.filter(e=>void 0===r[e]).map(e=>t[e]).reduce((e,t,n,r)=>e.concat(k(t,"hash")),[]).concat(n);return k(s,"hash").sort(o.compare)}static findTailHashes(e){var t={};return e.forEach(e=>t[e.hash]=!0),e.reduce((e,n,r,i)=>{return n.next.reverse().forEach(n=>{void 0===t[n]&&e.splice(0,0,n)}),e},[])}static difference(e,t){let n=Object.keys(e._headsIndex),r={},i={};const o=e=>{r[e]||t.get(e)||(n.push(e),r[e]=!0)};for(;n.length>0;){const s=n.shift(),a=e.get(s);a&&!t.get(s)&&a.id===t.id&&(i[a.hash]=a,r[a.hash]=!0,a.next.forEach(o))}return i}}e.exports=x,e.exports.Sorting=c,e.exports.AccessController=l}).call(this,n(0).Buffer)},function(e,t,n){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=c(e),s=r[0],a=r[1],f=new o(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),u=0,h=a>0?s-4:s;for(n=0;n>16&255,f[u++]=t>>8&255,f[u++]=255&t;2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,f[u++]=255&t);1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,f[u++]=t>>8&255,f[u++]=255&t);return f},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=0,a=n-i;sa?a:s+16383));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]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,f=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function u(e,t,n){for(var i,o,s=[],a=t;a>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,f=(1<>1,u=-7,h=n?i-1:0,l=n?-1:1,b=e[t+h];for(h+=l,o=b&(1<<-u)-1,b>>=-u,u+=a;u>0;o=256*o+e[t+h],h+=l,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+e[t+h],h+=l,u-=8);if(0===o)o=1-c;else{if(o===f)return s?NaN:1/0*(b?-1:1);s+=Math.pow(2,r),o-=c}return(b?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,f,c=8*o-i-1,u=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,b=r?0:o-1,k=r?1:-1,d=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=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-s))<1&&(s--,f*=2),(t+=s+h>=1?l/f:l*Math.pow(2,1-h))*f>=2&&(s++,f/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(t*f-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[n+b]=255&a,b+=k,a/=256,i-=8);for(s=s<0;e[n+b]=255&s,b+=k,s/=256,c-=8);e[n+b-k]|=128*d}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";const r=async(e,t)=>{let n=0;for(const r of e)await t(await r,n++);return e};e.exports=r,e.exports.default=r},function(e,t,n){"use strict";e.exports=class{constructor(e){}append(e){}merge(e){}get(e){}has(e){}get values(){}get length(){}}},function(e,t,n){"use strict";e.exports=function(e,t,n){var r={},i={};return e.forEach(e=>i[n?e[n]:e]=!0),t.reduce((e,t)=>{var o=void 0!==i[n?t[n]:t],s=void 0!==r[n?t[n]:t];return o||s||(e.push(t),r[n?t[n]:t]=!0),e},[])}},function(e,t,n){"use strict";e.exports=function(e,t){let n={};return e.forEach(e=>n[t?e[t]:e]=e),Object.keys(n).map(e=>n[e])}},function(e,t,n){"use strict";e.exports=e=>null!=e},function(e,t,n){(function(t){const r=n(4),i=n(52),o=e=>e?Array.isArray(e)?e.map(o):new r(e):e,s=(e,t)=>{if(!e)return e;if(Array.isArray(e))return e.map(s);if(e["/"])return e["/"];const n=t.base||"base58btc";return e.toBaseEncodedString(n)},a={"dag-pb":{read:async(e,t)=>{const n=(await e.dag.get(t)).value;return JSON.parse(n.toJSON().data)},write:async(e,n)=>{const r=t.from(JSON.stringify(n)),o=i.DAGNode.create(r);return(await e.dag.put(o,{format:"dag-pb",hashAlg:"sha2-256"})).toV0().toBaseEncodedString()}},"dag-cbor":{write:async(e,t,n)=>{const r=Object.assign({},t);(n.links||[]).forEach(e=>{r[e]=o(r[e])});const i=n.base||"base58btc",s=n.onlyHash||!1;return(await e.dag.put(r,{onlyHash:s})).toBaseEncodedString(i)},read:async(e,t,n)=>{const r=(await e.dag.get(t)).value;return(n.links||[]).forEach(e=>{r[e]=s(r[e],n)}),r}},raw:{write:async(e,t,n)=>{const r=n.onlyHash||!1,o=n.base||"base58btc",s=Object.assign({},{onlyHash:r},n.format?{format:n.format,hashAlg:"sha2-256"}:{});return"dag-pb"===s.format&&(t=i.DAGNode.create(t)),(await e.dag.put(t,s)).toBaseEncodedString(o)}}};e.exports={read:(e,t,n={})=>{t=new r(t);const i=a[t.codec];if(!i)throw new Error("Unsupported codec");return i.read(e,t,n)},write:(e,t,n,r={})=>{const i=a[t];if(!i)throw new Error("Unsupported codec");return i.write(e,n,r)}}}).call(this,n(0).Buffer)},function(e,t,n){var r=n(17);e.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},function(e,t,n){"use strict";t.names=Object.freeze({identity:0,sha1:17,"sha2-256":18,"sha2-512":19,"dbl-sha2-256":86,"sha3-224":23,"sha3-256":22,"sha3-384":21,"sha3-512":20,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,"murmur3-128":34,"murmur3-32":35,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"Skein256-8":45825,"Skein256-16":45826,"Skein256-24":45827,"Skein256-32":45828,"Skein256-40":45829,"Skein256-48":45830,"Skein256-56":45831,"Skein256-64":45832,"Skein256-72":45833,"Skein256-80":45834,"Skein256-88":45835,"Skein256-96":45836,"Skein256-104":45837,"Skein256-112":45838,"Skein256-120":45839,"Skein256-128":45840,"Skein256-136":45841,"Skein256-144":45842,"Skein256-152":45843,"Skein256-160":45844,"Skein256-168":45845,"Skein256-176":45846,"Skein256-184":45847,"Skein256-192":45848,"Skein256-200":45849,"Skein256-208":45850,"Skein256-216":45851,"Skein256-224":45852,"Skein256-232":45853,"Skein256-240":45854,"Skein256-248":45855,"Skein256-256":45856,"Skein512-8":45857,"Skein512-16":45858,"Skein512-24":45859,"Skein512-32":45860,"Skein512-40":45861,"Skein512-48":45862,"Skein512-56":45863,"Skein512-64":45864,"Skein512-72":45865,"Skein512-80":45866,"Skein512-88":45867,"Skein512-96":45868,"Skein512-104":45869,"Skein512-112":45870,"Skein512-120":45871,"Skein512-128":45872,"Skein512-136":45873,"Skein512-144":45874,"Skein512-152":45875,"Skein512-160":45876,"Skein512-168":45877,"Skein512-176":45878,"Skein512-184":45879,"Skein512-192":45880,"Skein512-200":45881,"Skein512-208":45882,"Skein512-216":45883,"Skein512-224":45884,"Skein512-232":45885,"Skein512-240":45886,"Skein512-248":45887,"Skein512-256":45888,"Skein512-264":45889,"Skein512-272":45890,"Skein512-280":45891,"Skein512-288":45892,"Skein512-296":45893,"Skein512-304":45894,"Skein512-312":45895,"Skein512-320":45896,"Skein512-328":45897,"Skein512-336":45898,"Skein512-344":45899,"Skein512-352":45900,"Skein512-360":45901,"Skein512-368":45902,"Skein512-376":45903,"Skein512-384":45904,"Skein512-392":45905,"Skein512-400":45906,"Skein512-408":45907,"Skein512-416":45908,"Skein512-424":45909,"Skein512-432":45910,"Skein512-440":45911,"Skein512-448":45912,"Skein512-456":45913,"Skein512-464":45914,"Skein512-472":45915,"Skein512-480":45916,"Skein512-488":45917,"Skein512-496":45918,"Skein512-504":45919,"Skein512-512":45920,"Skein1024-8":45921,"Skein1024-16":45922,"Skein1024-24":45923,"Skein1024-32":45924,"Skein1024-40":45925,"Skein1024-48":45926,"Skein1024-56":45927,"Skein1024-64":45928,"Skein1024-72":45929,"Skein1024-80":45930,"Skein1024-88":45931,"Skein1024-96":45932,"Skein1024-104":45933,"Skein1024-112":45934,"Skein1024-120":45935,"Skein1024-128":45936,"Skein1024-136":45937,"Skein1024-144":45938,"Skein1024-152":45939,"Skein1024-160":45940,"Skein1024-168":45941,"Skein1024-176":45942,"Skein1024-184":45943,"Skein1024-192":45944,"Skein1024-200":45945,"Skein1024-208":45946,"Skein1024-216":45947,"Skein1024-224":45948,"Skein1024-232":45949,"Skein1024-240":45950,"Skein1024-248":45951,"Skein1024-256":45952,"Skein1024-264":45953,"Skein1024-272":45954,"Skein1024-280":45955,"Skein1024-288":45956,"Skein1024-296":45957,"Skein1024-304":45958,"Skein1024-312":45959,"Skein1024-320":45960,"Skein1024-328":45961,"Skein1024-336":45962,"Skein1024-344":45963,"Skein1024-352":45964,"Skein1024-360":45965,"Skein1024-368":45966,"Skein1024-376":45967,"Skein1024-384":45968,"Skein1024-392":45969,"Skein1024-400":45970,"Skein1024-408":45971,"Skein1024-416":45972,"Skein1024-424":45973,"Skein1024-432":45974,"Skein1024-440":45975,"Skein1024-448":45976,"Skein1024-456":45977,"Skein1024-464":45978,"Skein1024-472":45979,"Skein1024-480":45980,"Skein1024-488":45981,"Skein1024-496":45982,"Skein1024-504":45983,"Skein1024-512":45984,"Skein1024-520":45985,"Skein1024-528":45986,"Skein1024-536":45987,"Skein1024-544":45988,"Skein1024-552":45989,"Skein1024-560":45990,"Skein1024-568":45991,"Skein1024-576":45992,"Skein1024-584":45993,"Skein1024-592":45994,"Skein1024-600":45995,"Skein1024-608":45996,"Skein1024-616":45997,"Skein1024-624":45998,"Skein1024-632":45999,"Skein1024-640":46e3,"Skein1024-648":46001,"Skein1024-656":46002,"Skein1024-664":46003,"Skein1024-672":46004,"Skein1024-680":46005,"Skein1024-688":46006,"Skein1024-696":46007,"Skein1024-704":46008,"Skein1024-712":46009,"Skein1024-720":46010,"Skein1024-728":46011,"Skein1024-736":46012,"Skein1024-744":46013,"Skein1024-752":46014,"Skein1024-760":46015,"Skein1024-768":46016,"Skein1024-776":46017,"Skein1024-784":46018,"Skein1024-792":46019,"Skein1024-800":46020,"Skein1024-808":46021,"Skein1024-816":46022,"Skein1024-824":46023,"Skein1024-832":46024,"Skein1024-840":46025,"Skein1024-848":46026,"Skein1024-856":46027,"Skein1024-864":46028,"Skein1024-872":46029,"Skein1024-880":46030,"Skein1024-888":46031,"Skein1024-896":46032,"Skein1024-904":46033,"Skein1024-912":46034,"Skein1024-920":46035,"Skein1024-928":46036,"Skein1024-936":46037,"Skein1024-944":46038,"Skein1024-952":46039,"Skein1024-960":46040,"Skein1024-968":46041,"Skein1024-976":46042,"Skein1024-984":46043,"Skein1024-992":46044,"Skein1024-1000":46045,"Skein1024-1008":46046,"Skein1024-1016":46047,"Skein1024-1024":46048}),t.codes=Object.freeze({0:"identity",17:"sha1",18:"sha2-256",19:"sha2-512",86:"dbl-sha2-256",23:"sha3-224",22:"sha3-256",21:"sha3-384",20:"sha3-512",24:"shake-128",25:"shake-256",26:"keccak-224",27:"keccak-256",28:"keccak-384",29:"keccak-512",34:"murmur3-128",35:"murmur3-32",45569:"blake2b-8",45570:"blake2b-16",45571:"blake2b-24",45572:"blake2b-32",45573:"blake2b-40",45574:"blake2b-48",45575:"blake2b-56",45576:"blake2b-64",45577:"blake2b-72",45578:"blake2b-80",45579:"blake2b-88",45580:"blake2b-96",45581:"blake2b-104",45582:"blake2b-112",45583:"blake2b-120",45584:"blake2b-128",45585:"blake2b-136",45586:"blake2b-144",45587:"blake2b-152",45588:"blake2b-160",45589:"blake2b-168",45590:"blake2b-176",45591:"blake2b-184",45592:"blake2b-192",45593:"blake2b-200",45594:"blake2b-208",45595:"blake2b-216",45596:"blake2b-224",45597:"blake2b-232",45598:"blake2b-240",45599:"blake2b-248",45600:"blake2b-256",45601:"blake2b-264",45602:"blake2b-272",45603:"blake2b-280",45604:"blake2b-288",45605:"blake2b-296",45606:"blake2b-304",45607:"blake2b-312",45608:"blake2b-320",45609:"blake2b-328",45610:"blake2b-336",45611:"blake2b-344",45612:"blake2b-352",45613:"blake2b-360",45614:"blake2b-368",45615:"blake2b-376",45616:"blake2b-384",45617:"blake2b-392",45618:"blake2b-400",45619:"blake2b-408",45620:"blake2b-416",45621:"blake2b-424",45622:"blake2b-432",45623:"blake2b-440",45624:"blake2b-448",45625:"blake2b-456",45626:"blake2b-464",45627:"blake2b-472",45628:"blake2b-480",45629:"blake2b-488",45630:"blake2b-496",45631:"blake2b-504",45632:"blake2b-512",45633:"blake2s-8",45634:"blake2s-16",45635:"blake2s-24",45636:"blake2s-32",45637:"blake2s-40",45638:"blake2s-48",45639:"blake2s-56",45640:"blake2s-64",45641:"blake2s-72",45642:"blake2s-80",45643:"blake2s-88",45644:"blake2s-96",45645:"blake2s-104",45646:"blake2s-112",45647:"blake2s-120",45648:"blake2s-128",45649:"blake2s-136",45650:"blake2s-144",45651:"blake2s-152",45652:"blake2s-160",45653:"blake2s-168",45654:"blake2s-176",45655:"blake2s-184",45656:"blake2s-192",45657:"blake2s-200",45658:"blake2s-208",45659:"blake2s-216",45660:"blake2s-224",45661:"blake2s-232",45662:"blake2s-240",45663:"blake2s-248",45664:"blake2s-256",45825:"Skein256-8",45826:"Skein256-16",45827:"Skein256-24",45828:"Skein256-32",45829:"Skein256-40",45830:"Skein256-48",45831:"Skein256-56",45832:"Skein256-64",45833:"Skein256-72",45834:"Skein256-80",45835:"Skein256-88",45836:"Skein256-96",45837:"Skein256-104",45838:"Skein256-112",45839:"Skein256-120",45840:"Skein256-128",45841:"Skein256-136",45842:"Skein256-144",45843:"Skein256-152",45844:"Skein256-160",45845:"Skein256-168",45846:"Skein256-176",45847:"Skein256-184",45848:"Skein256-192",45849:"Skein256-200",45850:"Skein256-208",45851:"Skein256-216",45852:"Skein256-224",45853:"Skein256-232",45854:"Skein256-240",45855:"Skein256-248",45856:"Skein256-256",45857:"Skein512-8",45858:"Skein512-16",45859:"Skein512-24",45860:"Skein512-32",45861:"Skein512-40",45862:"Skein512-48",45863:"Skein512-56",45864:"Skein512-64",45865:"Skein512-72",45866:"Skein512-80",45867:"Skein512-88",45868:"Skein512-96",45869:"Skein512-104",45870:"Skein512-112",45871:"Skein512-120",45872:"Skein512-128",45873:"Skein512-136",45874:"Skein512-144",45875:"Skein512-152",45876:"Skein512-160",45877:"Skein512-168",45878:"Skein512-176",45879:"Skein512-184",45880:"Skein512-192",45881:"Skein512-200",45882:"Skein512-208",45883:"Skein512-216",45884:"Skein512-224",45885:"Skein512-232",45886:"Skein512-240",45887:"Skein512-248",45888:"Skein512-256",45889:"Skein512-264",45890:"Skein512-272",45891:"Skein512-280",45892:"Skein512-288",45893:"Skein512-296",45894:"Skein512-304",45895:"Skein512-312",45896:"Skein512-320",45897:"Skein512-328",45898:"Skein512-336",45899:"Skein512-344",45900:"Skein512-352",45901:"Skein512-360",45902:"Skein512-368",45903:"Skein512-376",45904:"Skein512-384",45905:"Skein512-392",45906:"Skein512-400",45907:"Skein512-408",45908:"Skein512-416",45909:"Skein512-424",45910:"Skein512-432",45911:"Skein512-440",45912:"Skein512-448",45913:"Skein512-456",45914:"Skein512-464",45915:"Skein512-472",45916:"Skein512-480",45917:"Skein512-488",45918:"Skein512-496",45919:"Skein512-504",45920:"Skein512-512",45921:"Skein1024-8",45922:"Skein1024-16",45923:"Skein1024-24",45924:"Skein1024-32",45925:"Skein1024-40",45926:"Skein1024-48",45927:"Skein1024-56",45928:"Skein1024-64",45929:"Skein1024-72",45930:"Skein1024-80",45931:"Skein1024-88",45932:"Skein1024-96",45933:"Skein1024-104",45934:"Skein1024-112",45935:"Skein1024-120",45936:"Skein1024-128",45937:"Skein1024-136",45938:"Skein1024-144",45939:"Skein1024-152",45940:"Skein1024-160",45941:"Skein1024-168",45942:"Skein1024-176",45943:"Skein1024-184",45944:"Skein1024-192",45945:"Skein1024-200",45946:"Skein1024-208",45947:"Skein1024-216",45948:"Skein1024-224",45949:"Skein1024-232",45950:"Skein1024-240",45951:"Skein1024-248",45952:"Skein1024-256",45953:"Skein1024-264",45954:"Skein1024-272",45955:"Skein1024-280",45956:"Skein1024-288",45957:"Skein1024-296",45958:"Skein1024-304",45959:"Skein1024-312",45960:"Skein1024-320",45961:"Skein1024-328",45962:"Skein1024-336",45963:"Skein1024-344",45964:"Skein1024-352",45965:"Skein1024-360",45966:"Skein1024-368",45967:"Skein1024-376",45968:"Skein1024-384",45969:"Skein1024-392",45970:"Skein1024-400",45971:"Skein1024-408",45972:"Skein1024-416",45973:"Skein1024-424",45974:"Skein1024-432",45975:"Skein1024-440",45976:"Skein1024-448",45977:"Skein1024-456",45978:"Skein1024-464",45979:"Skein1024-472",45980:"Skein1024-480",45981:"Skein1024-488",45982:"Skein1024-496",45983:"Skein1024-504",45984:"Skein1024-512",45985:"Skein1024-520",45986:"Skein1024-528",45987:"Skein1024-536",45988:"Skein1024-544",45989:"Skein1024-552",45990:"Skein1024-560",45991:"Skein1024-568",45992:"Skein1024-576",45993:"Skein1024-584",45994:"Skein1024-592",45995:"Skein1024-600",45996:"Skein1024-608",45997:"Skein1024-616",45998:"Skein1024-624",45999:"Skein1024-632",46e3:"Skein1024-640",46001:"Skein1024-648",46002:"Skein1024-656",46003:"Skein1024-664",46004:"Skein1024-672",46005:"Skein1024-680",46006:"Skein1024-688",46007:"Skein1024-696",46008:"Skein1024-704",46009:"Skein1024-712",46010:"Skein1024-720",46011:"Skein1024-728",46012:"Skein1024-736",46013:"Skein1024-744",46014:"Skein1024-752",46015:"Skein1024-760",46016:"Skein1024-768",46017:"Skein1024-776",46018:"Skein1024-784",46019:"Skein1024-792",46020:"Skein1024-800",46021:"Skein1024-808",46022:"Skein1024-816",46023:"Skein1024-824",46024:"Skein1024-832",46025:"Skein1024-840",46026:"Skein1024-848",46027:"Skein1024-856",46028:"Skein1024-864",46029:"Skein1024-872",46030:"Skein1024-880",46031:"Skein1024-888",46032:"Skein1024-896",46033:"Skein1024-904",46034:"Skein1024-912",46035:"Skein1024-920",46036:"Skein1024-928",46037:"Skein1024-936",46038:"Skein1024-944",46039:"Skein1024-952",46040:"Skein1024-960",46041:"Skein1024-968",46042:"Skein1024-976",46043:"Skein1024-984",46044:"Skein1024-992",46045:"Skein1024-1000",46046:"Skein1024-1008",46047:"Skein1024-1016",46048:"Skein1024-1024"}),t.defaultLengths=Object.freeze({17:20,18:32,19:64,86:32,23:28,22:32,21:48,20:64,24:32,25:64,26:28,27:32,28:48,29:64,34:32,45569:1,45570:2,45571:3,45572:4,45573:5,45574:6,45575:7,45576:8,45577:9,45578:10,45579:11,45580:12,45581:13,45582:14,45583:15,45584:16,45585:17,45586:18,45587:19,45588:20,45589:21,45590:22,45591:23,45592:24,45593:25,45594:26,45595:27,45596:28,45597:29,45598:30,45599:31,45600:32,45601:33,45602:34,45603:35,45604:36,45605:37,45606:38,45607:39,45608:40,45609:41,45610:42,45611:43,45612:44,45613:45,45614:46,45615:47,45616:48,45617:49,45618:50,45619:51,45620:52,45621:53,45622:54,45623:55,45624:56,45625:57,45626:58,45627:59,45628:60,45629:61,45630:62,45631:63,45632:64,45633:1,45634:2,45635:3,45636:4,45637:5,45638:6,45639:7,45640:8,45641:9,45642:10,45643:11,45644:12,45645:13,45646:14,45647:15,45648:16,45649:17,45650:18,45651:19,45652:20,45653:21,45654:22,45655:23,45656:24,45657:25,45658:26,45659:27,45660:28,45661:29,45662:30,45663:31,45664:32,45825:1,45826:2,45827:3,45828:4,45829:5,45830:6,45831:7,45832:8,45833:9,45834:10,45835:11,45836:12,45837:13,45838:14,45839:15,45840:16,45841:17,45842:18,45843:19,45844:20,45845:21,45846:22,45847:23,45848:24,45849:25,45850:26,45851:27,45852:28,45853:29,45854:30,45855:31,45856:32,45857:1,45858:2,45859:3,45860:4,45861:5,45862:6,45863:7,45864:8,45865:9,45866:10,45867:11,45868:12,45869:13,45870:14,45871:15,45872:16,45873:17,45874:18,45875:19,45876:20,45877:21,45878:22,45879:23,45880:24,45881:25,45882:26,45883:27,45884:28,45885:29,45886:30,45887:31,45888:32,45889:33,45890:34,45891:35,45892:36,45893:37,45894:38,45895:39,45896:40,45897:41,45898:42,45899:43,45900:44,45901:45,45902:46,45903:47,45904:48,45905:49,45906:50,45907:51,45908:52,45909:53,45910:54,45911:55,45912:56,45913:57,45914:58,45915:59,45916:60,45917:61,45918:62,45919:63,45920:64,45921:1,45922:2,45923:3,45924:4,45925:5,45926:6,45927:7,45928:8,45929:9,45930:10,45931:11,45932:12,45933:13,45934:14,45935:15,45936:16,45937:17,45938:18,45939:19,45940:20,45941:21,45942:22,45943:23,45944:24,45945:25,45946:26,45947:27,45948:28,45949:29,45950:30,45951:31,45952:32,45953:33,45954:34,45955:35,45956:36,45957:37,45958:38,45959:39,45960:40,45961:41,45962:42,45963:43,45964:44,45965:45,45966:46,45967:47,45968:48,45969:49,45970:50,45971:51,45972:52,45973:53,45974:54,45975:55,45976:56,45977:57,45978:58,45979:59,45980:60,45981:61,45982:62,45983:63,45984:64,45985:65,45986:66,45987:67,45988:68,45989:69,45990:70,45991:71,45992:72,45993:73,45994:74,45995:75,45996:76,45997:77,45998:78,45999:79,46e3:80,46001:81,46002:82,46003:83,46004:84,46005:85,46006:86,46007:87,46008:88,46009:89,46010:90,46011:91,46012:92,46013:93,46014:94,46015:95,46016:96,46017:97,46018:98,46019:99,46020:100,46021:101,46022:102,46023:103,46024:104,46025:105,46026:106,46027:107,46028:108,46029:109,46030:110,46031:111,46032:112,46033:113,46034:114,46035:115,46036:116,46037:117,46038:118,46039:119,46040:120,46041:121,46042:122,46043:123,46044:124,46045:125,46046:126,46047:127,46048:128})},function(e,t){e.exports=function e(t,o,s){o=o||[];s=s||0;var a=s;for(;t>=i;)o[s++]=255&t|n,t/=128;for(;t&r;)o[s++]=255&t|n,t>>>=7;o[s]=0|t;e.bytes=s-a+1;return o};var n=128,r=-128,i=Math.pow(2,31)},function(e,t){e.exports=function e(t,i){var o,s=0,a=(i=i||0,0),f=i,c=t.length;do{if(f>=c)throw e.bytes=0,new RangeError("Could not decode varint");o=t[f++],s+=a<28?(o&r)<=n);e.bytes=f-i;return s};var n=128,r=127},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),f=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e(e[t[0]]=new r(t[0],t[1],t[2],t[3]),e),{}),u=f.reduce((e,t)=>(e[t[1]]=c[t[0]],e),{});e.exports={names:c,codes:u}},function(e,t,n){"use strict";e.exports=class{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}}},function(e,t,n){"use strict";(function(t){e.exports=function(e){return{encode:e=>"string"==typeof e?t.from(e).toString("hex"):e.toString("hex"),decode(n){for(let t of n)if(e.indexOf(t)<0)throw new Error("invalid base16 character");return t.from(n,"hex")}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){function n(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){return{encode:r=>n("string"==typeof r?t.from(r):r,e),decode(t){for(let n of t)if(e.indexOf(n)<0)throw new Error("invalid base32 character");return function(e,t){let n=(e=e.replace(new RegExp("=","g"),"")).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}(t,e)}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){e.exports=function(e){const n=e.indexOf("=")>-1,r=e.indexOf("-")>-1&&e.indexOf("_")>-1;return{encode(e){let i="";i="string"==typeof e?t.from(e).toString("base64"):e.toString("base64"),r&&(i=i.replace(/\+/g,"-").replace(/\//g,"_"));const o=i.indexOf("=");return o>0&&!n&&(i=i.substring(0,o)),i},decode(n){for(let t of n)if(e.indexOf(t)<0)throw new Error("invalid base64 character");return t.from(n,"base64")}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(14),i=n(20).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(14),i={};e.exports=i;for(let e in r){i[r[e].toString("hex")]=e}},function(e,t,n){"use strict";e.exports=Object.freeze({PROTOBUF:80,CBOR:81,RLP:96,BENCODE:99,JSON:512,MESSAGEPACK:513,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,IPNS_NS:229,ZERONET:230,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",512:"json",513:"messagepack",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",46e3:"skein1024-640",46001:"skein1024-648",46002:"skein1024-656",46003:"skein1024-664",46004:"skein1024-672",46005:"skein1024-680",46006:"skein1024-688",46007:"skein1024-696",46008:"skein1024-704",46009:"skein1024-712",46010:"skein1024-720",46011:"skein1024-728",46012:"skein1024-736",46013:"skein1024-744",46014:"skein1024-752",46015:"skein1024-760",46016:"skein1024-768",46017:"skein1024-776",46018:"skein1024-784",46019:"skein1024-792",46020:"skein1024-800",46021:"skein1024-808",46022:"skein1024-816",46023:"skein1024-824",46024:"skein1024-832",46025:"skein1024-840",46026:"skein1024-848",46027:"skein1024-856",46028:"skein1024-864",46029:"skein1024-872",46030:"skein1024-880",46031:"skein1024-888",46032:"skein1024-896",46033:"skein1024-904",46034:"skein1024-912",46035:"skein1024-920",46036:"skein1024-928",46037:"skein1024-936",46038:"skein1024-944",46039:"skein1024-952",46040:"skein1024-960",46041:"skein1024-968",46042:"skein1024-976",46043:"skein1024-984",46044:"skein1024-992",46045:"skein1024-1000",46046:"skein1024-1008",46047:"skein1024-1016",46048:"skein1024-1024",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",229:"ipns-ns",230:"zeronet",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(13);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";t.DAGNode=n(6),t.DAGLink=n(3),t.resolver=n(88),t.util=n(8),t.codec=t.util.codec,t.defaultHashAlg=t.util.defaultHashAlg},function(e,t,n){"use strict"; + */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;c--)if(u[c]!==h[c])return!1;for(c=u.length-1;c>=0;c--)if(a=u[c],!S(e[a],t[a],n,r))return!1;return!0}(e,t,n,r))}return n?e===t:e==t}function y(e){return"[object Arguments]"==Object.prototype.toString.call(e)}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,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=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&m(i,n,"Missing expected exception"+r);var o="string"==typeof r,a=!e&&i&&!n;if((!e&&s.isError(i)&&o&&E(i,n)||a)&&m(i,n,"Got unwanted exception"+r),e&&i&&n&&!E(i,n)||!e&&i)throw i}l.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return d(p(e.actual),128)+" "+e.operator+" "+d(p(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||m;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var n=new Error;if(n.stack){var r=n.stack,i=k(t),o=r.indexOf("\n"+i);if(o>=0){var s=r.indexOf("\n",o+1);r=r.substring(s+1)}this.stack=r}}},s.inherits(l.AssertionError,Error),l.fail=m,l.ok=g,l.equal=function(e,t,n){e!=t&&m(e,t,n,"==",l.equal)},l.notEqual=function(e,t,n){e==t&&m(e,t,n,"!=",l.notEqual)},l.deepEqual=function(e,t,n){S(e,t,!1)||m(e,t,n,"deepEqual",l.deepEqual)},l.deepStrictEqual=function(e,t,n){S(e,t,!0)||m(e,t,n,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function(e,t,n){S(e,t,!1)&&m(e,t,n,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=function e(t,n,r){S(t,n,!0)&&m(t,n,r,"notDeepStrictEqual",e)},l.strictEqual=function(e,t,n){e!==t&&m(e,t,n,"===",l.strictEqual)},l.notStrictEqual=function(e,t,n){e===t&&m(e,t,n,"!==",l.notStrictEqual)},l.throws=function(e,t,n){x(!0,e,t,n)},l.doesNotThrow=function(e,t,n){x(!1,e,t,n)},l.ifError=function(e){if(e)throw e},l.strict=r((function e(t,n){t||m(t,!0,n,"==",e)}),l,{equal:l.strictEqual,deepEqual:l.deepStrictEqual,notEqual:l.notStrictEqual,notDeepEqual:l.notDeepStrictEqual}),l.strict.strict=l.strict;var w=Object.keys||function(e){var t=[];for(var n in e)a.call(e,n)&&t.push(n);return t}}).call(this,n(10))},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var f,c=[],u=!1,h=-1;function l(){u&&f&&(u=!1,f.length?c=f.concat(c):h=-1,c.length&&b())}function b(){if(!u){var e=a(l);u=!0;for(var t=c.length;t;){for(f=c,c=[];++h1)for(var n=1;n{for(const n of t){let t,r=e;for(;void 0===t;){if(null===(r=Object.getPrototypeOf(r)))throw new Error(`no getter named '${n}' found`);t=Object.getOwnPropertyDescriptor(r,n)}if(void 0===t.get)throw new Error(`no getter named '${n}' found`);Object.defineProperty(e,n,{enumerable:!0,get:t.get})}},hidePrivateFields:e=>{for(const t in e)"_"===t[0]&&Object.defineProperty(e,t,{enumerable:!1})}}},function(e,t,n){(function(t){var n="Input must be an string, Buffer or Uint8Array";function r(e){return(4294967296+e).toString(16).substring(1)}e.exports={normalizeInput:function(e){var r;if(e instanceof Uint8Array)r=e;else if(e instanceof t)r=new Uint8Array(e);else{if("string"!=typeof e)throw new Error(n);r=new Uint8Array(t.from(e,"utf8"))}return r},toHex:function(e){return Array.prototype.map.call(e,(function(e){return(e<16?"0":"")+e.toString(16)})).join("")},debugPrint:function(e,t,n){for(var i="\n"+e+" = ",o=0;oe,r=(e,t)=>o(e,t,n);return((e,t)=>i(e,t,r))(e,t)},t.SortByEntryHash=function(e,t){const n=(e,t)=>e.hasho(e,t,n);return((e,t)=>i(e,t,r))(e,t)},t.NoZeroes=function(e){const t=`Your log's tiebreaker function, ${e.name}, has returned zero and therefore cannot be`;return(n,r)=>{const i=e(n,r);if(0===i)throw Error(t);return i}}},function(e,t,n){"use strict";e.exports={IPFSNotDefinedError:()=>new Error("IPFS instance not defined"),LogNotDefinedError:()=>new Error("Log instance not defined"),NotALogError:()=>new Error("Given argument is not an instance of Log"),CannotJoinWithDifferentId:()=>new Error("Can't join logs with different IDs"),LtOrLteMustBeStringOrArray:()=>new Error("lt or lte must be a string or array of Entries")}},function(e,t,n){"use strict";(function(t){const r=n(17),i=n(32),o=n(11),s=n(92),a=n(27),f=n(5),c=n(26),{LastWriteWins:u,NoZeroes:h}=c,l=n(95),{isDefined:b,findUniques:k}=n(12),d=n(96),p=()=>(new Date).getTime().toString(),m=e=>e.hash,g=(e,t)=>e.concat(t),S=e=>e.next,y=(e,t)=>Math.max(e,t.clock.time),E=(e,t)=>(e[t.hash]=t,e);class x extends i{constructor(e,t,{logId:n,access:r,entries:i,heads:o,clock:s,sortFn:c}={}){if(!b(e))throw a.IPFSNotDefinedError();if(!b(t))throw new Error("Identity is required");if(b(r)||(r=new l),b(i)&&!Array.isArray(i))throw new Error("'entries' argument must be an array of Entry instances");if(b(o)&&!Array.isArray(o))throw new Error("'heads' argument must be an array");b(c)||(c=u),super(),this._sortFn=h(c),this._storage=e,this._id=n||p(),this._access=r,this._identity=t;const k=(i||[]).reduce(E,{});this._entryIndex=new d(k),i=Object.values(k)||[],o=o||x.findHeads(i),this._headsIndex=o.reduce(E,{}),this._nextsIndex={};i.forEach(e=>e.next.forEach(t=>this._nextsIndex[t]=e.hash)),this._length=i.length;const m=Math.max(s?s.time:0,this.heads.reduce(y,0));this._clock=new f(this._identity.publicKey,m)}get id(){return this._id}get clock(){return this._clock}get length(){return this._length}get values(){return Object.values(this.traverse(this.heads)).reverse()}get heads(){return Object.values(this._headsIndex).sort(this._sortFn).reverse()}get tails(){return x.findTails(this.values)}get tailHashes(){return x.findTailHashes(this.values)}setIdentity(e){this._identity=e;const t=Math.max(this.clock.time,this.heads.reduce(y,0));this._clock=new f(this._identity.publicKey,t)}get(e){return this._entryIndex.get(e)}has(e){return void 0!==this._entryIndex.get(e.hash||e)}traverse(e,t=-1,n){let r=e.sort(this._sortFn).reverse(),i={},o={},s=0;const a=e=>this.get(e),f=e=>{e&&!i[e.hash]&&(r=[e,...r].sort(this._sortFn).reverse(),i[e.hash]=!0)};for(;r.length>0&&(s{let t=new Set;for(let n=1;n<=e;n*=2){const e=Math.min(n-1,r.length-1);t.add(r[e])}return t})(Math.min(t,r.length));r.length!s.includes(e)),c=await o.create(this._storage,this._identity,this.id,e,s,this.clock,a);if(!await this._access.canAppend(c,this._identity.provider))throw new Error(`Could not append entry, key "${this._identity.id}" is not allowed to write to the log`);return this._entryIndex.set(c.hash,c),s.forEach(e=>this._nextsIndex[e]=c.hash),this._headsIndex={},this._headsIndex[c.hash]=c,this._length++,c}iterator({gt:e,gte:t,lt:n,lte:r,amount:i=-1}={}){if(0===i)return function*(){}();if("string"==typeof r&&(r=[this.get(r)]),"string"==typeof n&&(n=[this.get(this.get(n).next)]),r&&!Array.isArray(r))throw a.LtOrLteMustBeStringOrArray();if(n&&!Array.isArray(n))throw a.LtOrLteMustBeStringOrArray();let o=(r||n||this.heads).filter(b),s=t?this.get(t).hash:e?this.get(e).hash:null,f=s?-1:i||-1,c=this.traverse(o,f,s),u=Object.values(c);return e&&u.pop(),(e||t)&&i>-1&&(u=u.slice(u.length-i,u.length)),function*(){for(let e in u)yield u[e]}()}async join(e,t=-1){if(!b(e))throw a.LogNotDefinedError();if(!x.isLog(e))throw a.NotALogError();if(this.id!==e.id)return;const n=x.difference(e,this),i=this._identity.provider,s=async e=>{if(!await this._access.canAppend(e,i))throw new Error(`Could not append entry, key "${e.identity.id}" is not allowed to write to the log`)},c=Object.values(n);await r(c,async e=>{await s(e),await(async e=>{const t=await o.verify(i,e),n=e.identity?e.identity.publicKey:e.key;if(!t)throw new Error(`Could not validate signature "${e.sig}" for entry "${e.hash}" and key "${n}"`)})(e)},{concurrency:100});Object.values(n).forEach(e=>{this.get(e.hash)||this._length++,e.next.forEach(t=>this._nextsIndex[t]=e.hash)}),this._entryIndex.add(n);const u=Object.values(n).map(S).reduce(g,[]),h=x.findHeads(Object.values(Object.assign({},this._headsIndex,e._headsIndex))).filter(e=>!u.find(t=>t===e.hash)).filter(e=>!this._nextsIndex[e.hash]).reduce(E,{});if(this._headsIndex=h,t>-1){let e=this.values;e=e.slice(-t),this._entryIndex=null,this._entryIndex=new d(e.reduce(E,{})),this._headsIndex=x.findHeads(e).reduce(E,{}),this._length=this._entryIndex.length}const l=Object.values(this._headsIndex).reduce(y,0);return this._clock=new f(this.clock.id,Math.max(this.clock.time,l)),this}toJSON(){return{id:this.id,heads:this.heads.sort(this._sortFn).reverse().map(m)}}toSnapshot(){return{id:this.id,heads:this.heads,values:this.values}}toBuffer(){return t.from(JSON.stringify(this.toJSON()))}toString(e){return this.values.slice().reverse().map((t,n)=>{const r=o.findChildren(t,this.values).length;let i=new Array(Math.max(r-1,0));return i=r>1?i.fill(" "):i,(i=r>0?i.concat(["└─"]):i).join("")+(e?e(t.payload):t.payload)}).join("\n")}static isLog(e){return void 0!==e.id&&void 0!==e.heads&&void 0!==e._entryIndex}toMultihash({format:e}={}){return s.toMultihash(this._storage,this,{format:e})}static async fromMultihash(e,t,n,{access:r,length:i=-1,exclude:o=[],concurrency:a,sortFn:f,onProgressCallback:c}={}){const{logId:u,entries:h,heads:l}=await s.fromMultihash(e,n,{length:i,exclude:o,onProgressCallback:c,concurrency:a,sortFn:f});return new x(e,t,{logId:u,access:r,entries:h,heads:l,sortFn:f})}static async fromEntryHash(e,t,n,{logId:r,access:i,length:o=-1,exclude:a=[],concurrency:f,sortFn:c,onProgressCallback:u}={}){const{entries:h}=await s.fromEntryHash(e,n,{length:o,exclude:a,concurrency:f,onProgressCallback:u});return new x(e,t,{logId:r,access:i,entries:h,sortFn:c})}static async fromJSON(e,t,n,{access:r,length:i=-1,sortFn:o,onProgressCallback:a}={}){const{logId:f,entries:c}=await s.fromJSON(e,n,{length:i,onProgressCallback:a});return new x(e,t,{logId:f,access:r,entries:c,sortFn:o})}static async fromEntry(e,t,n,{access:r,length:i=-1,exclude:o=[],concurrency:a,sortFn:f,onProgressCallback:c}={}){const{logId:u,entries:h}=await s.fromEntry(e,n,{length:i,exclude:o,concurrency:a,onProgressCallback:c});return new x(e,t,{logId:u,access:r,entries:h,sortFn:f})}static findHeads(e){var t=e.reduce((e,t,n,r)=>{return t.next.forEach(n=>e[n]=t.hash),e},{});return e.filter(e=>void 0===t[e.hash]).sort((e,t)=>e.clock.id>t.clock.id)}static findTails(e){var t={},n=[],r={},i=[];e.forEach(e=>{0===e.next.length&&n.push(e);e.next.forEach(n=>{t[n]||(t[n]=[]),t[n].push(e)}),i=i.concat(e.next),r[e.hash]=!0});const s=i.filter(e=>void 0===r[e]).map(e=>t[e]).reduce((e,t,n,r)=>e.concat(k(t,"hash")),[]).concat(n);return k(s,"hash").sort(o.compare)}static findTailHashes(e){var t={};return e.forEach(e=>t[e.hash]=!0),e.reduce((e,n,r,i)=>{return n.next.reverse().forEach(n=>{void 0===t[n]&&e.splice(0,0,n)}),e},[])}static difference(e,t){let n=Object.keys(e._headsIndex),r={},i={};const o=e=>{r[e]||t.get(e)||(n.push(e),r[e]=!0)};for(;n.length>0;){const s=n.shift(),a=e.get(s);a&&!t.get(s)&&a.id===t.id&&(i[a.hash]=a,r[a.hash]=!0,a.next.forEach(o))}return i}}e.exports=x,e.exports.Sorting=c,e.exports.AccessController=l}).call(this,n(0).Buffer)},function(e,t,n){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=c(e),s=r[0],a=r[1],f=new o(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),u=0,h=a>0?s-4:s;for(n=0;n>16&255,f[u++]=t>>8&255,f[u++]=255&t;2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,f[u++]=255&t);1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,f[u++]=t>>8&255,f[u++]=255&t);return f},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=0,a=n-i;sa?a:s+16383));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]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,f=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function u(e,t,n){for(var i,o,s=[],a=t;a>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,f=(1<>1,u=-7,h=n?i-1:0,l=n?-1:1,b=e[t+h];for(h+=l,o=b&(1<<-u)-1,b>>=-u,u+=a;u>0;o=256*o+e[t+h],h+=l,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+e[t+h],h+=l,u-=8);if(0===o)o=1-c;else{if(o===f)return s?NaN:1/0*(b?-1:1);s+=Math.pow(2,r),o-=c}return(b?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,f,c=8*o-i-1,u=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,b=r?0:o-1,k=r?1:-1,d=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=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-s))<1&&(s--,f*=2),(t+=s+h>=1?l/f:l*Math.pow(2,1-h))*f>=2&&(s++,f/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(t*f-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[n+b]=255&a,b+=k,a/=256,i-=8);for(s=s<0;e[n+b]=255&s,b+=k,s/=256,c-=8);e[n+b-k]|=128*d}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";e.exports=class{constructor(e){}append(e){}merge(e){}get(e){}has(e){}get values(){}get length(){}}},function(e,t,n){"use strict";e.exports=function(e,t,n){var r={},i={};return e.forEach(e=>i[n?e[n]:e]=!0),t.reduce((e,t)=>{var o=void 0!==i[n?t[n]:t],s=void 0!==r[n?t[n]:t];return o||s||(e.push(t),r[n?t[n]:t]=!0),e},[])}},function(e,t,n){"use strict";e.exports=function(e,t){let n={};return e.forEach(e=>n[t?e[t]:e]=e),Object.keys(n).map(e=>n[e])}},function(e,t,n){"use strict";e.exports=e=>null!=e},function(e,t,n){(function(t){const r=n(4),i=n(53),o=e=>e?Array.isArray(e)?e.map(o):new r(e):e,s=(e,t)=>{if(!e)return e;if(Array.isArray(e))return e.map(s);if(e["/"])return e["/"];const n=t.base||"base58btc";return e.toBaseEncodedString(n)},a={"dag-pb":{read:async(e,t)=>{const n=(await e.dag.get(t)).value;return JSON.parse(n.toJSON().data)},write:async(e,n)=>{const r=t.from(JSON.stringify(n)),o=i.DAGNode.create(r);return(await e.dag.put(o,{format:"dag-pb",hashAlg:"sha2-256"})).toV0().toBaseEncodedString()}},"dag-cbor":{write:async(e,t,n)=>{const r=Object.assign({},t);(n.links||[]).forEach(e=>{r[e]=o(r[e])});const i=n.base||"base58btc",s=n.onlyHash||!1;return(await e.dag.put(r,{onlyHash:s})).toBaseEncodedString(i)},read:async(e,t,n)=>{const r=(await e.dag.get(t)).value;return(n.links||[]).forEach(e=>{r[e]=s(r[e],n)}),r}},raw:{write:async(e,t,n)=>{const r=n.onlyHash||!1,o=n.base||"base58btc",s=Object.assign({},{onlyHash:r},n.format?{format:n.format,hashAlg:"sha2-256"}:{});return"dag-pb"===s.format&&(t=i.DAGNode.create(t)),(await e.dag.put(t,s)).toBaseEncodedString(o)}}};e.exports={read:(e,t,n={})=>{t=new r(t);const i=a[t.codec];if(!i)throw new Error("Unsupported codec");return i.read(e,t,n)},write:(e,t,n,r={})=>{const i=a[t];if(!i)throw new Error("Unsupported codec");return i.write(e,n,r)}}}).call(this,n(0).Buffer)},function(e,t,n){var r=n(18);e.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},function(e,t,n){"use strict";t.names=Object.freeze({identity:0,sha1:17,"sha2-256":18,"sha2-512":19,"dbl-sha2-256":86,"sha3-224":23,"sha3-256":22,"sha3-384":21,"sha3-512":20,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,"murmur3-128":34,"murmur3-32":35,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"Skein256-8":45825,"Skein256-16":45826,"Skein256-24":45827,"Skein256-32":45828,"Skein256-40":45829,"Skein256-48":45830,"Skein256-56":45831,"Skein256-64":45832,"Skein256-72":45833,"Skein256-80":45834,"Skein256-88":45835,"Skein256-96":45836,"Skein256-104":45837,"Skein256-112":45838,"Skein256-120":45839,"Skein256-128":45840,"Skein256-136":45841,"Skein256-144":45842,"Skein256-152":45843,"Skein256-160":45844,"Skein256-168":45845,"Skein256-176":45846,"Skein256-184":45847,"Skein256-192":45848,"Skein256-200":45849,"Skein256-208":45850,"Skein256-216":45851,"Skein256-224":45852,"Skein256-232":45853,"Skein256-240":45854,"Skein256-248":45855,"Skein256-256":45856,"Skein512-8":45857,"Skein512-16":45858,"Skein512-24":45859,"Skein512-32":45860,"Skein512-40":45861,"Skein512-48":45862,"Skein512-56":45863,"Skein512-64":45864,"Skein512-72":45865,"Skein512-80":45866,"Skein512-88":45867,"Skein512-96":45868,"Skein512-104":45869,"Skein512-112":45870,"Skein512-120":45871,"Skein512-128":45872,"Skein512-136":45873,"Skein512-144":45874,"Skein512-152":45875,"Skein512-160":45876,"Skein512-168":45877,"Skein512-176":45878,"Skein512-184":45879,"Skein512-192":45880,"Skein512-200":45881,"Skein512-208":45882,"Skein512-216":45883,"Skein512-224":45884,"Skein512-232":45885,"Skein512-240":45886,"Skein512-248":45887,"Skein512-256":45888,"Skein512-264":45889,"Skein512-272":45890,"Skein512-280":45891,"Skein512-288":45892,"Skein512-296":45893,"Skein512-304":45894,"Skein512-312":45895,"Skein512-320":45896,"Skein512-328":45897,"Skein512-336":45898,"Skein512-344":45899,"Skein512-352":45900,"Skein512-360":45901,"Skein512-368":45902,"Skein512-376":45903,"Skein512-384":45904,"Skein512-392":45905,"Skein512-400":45906,"Skein512-408":45907,"Skein512-416":45908,"Skein512-424":45909,"Skein512-432":45910,"Skein512-440":45911,"Skein512-448":45912,"Skein512-456":45913,"Skein512-464":45914,"Skein512-472":45915,"Skein512-480":45916,"Skein512-488":45917,"Skein512-496":45918,"Skein512-504":45919,"Skein512-512":45920,"Skein1024-8":45921,"Skein1024-16":45922,"Skein1024-24":45923,"Skein1024-32":45924,"Skein1024-40":45925,"Skein1024-48":45926,"Skein1024-56":45927,"Skein1024-64":45928,"Skein1024-72":45929,"Skein1024-80":45930,"Skein1024-88":45931,"Skein1024-96":45932,"Skein1024-104":45933,"Skein1024-112":45934,"Skein1024-120":45935,"Skein1024-128":45936,"Skein1024-136":45937,"Skein1024-144":45938,"Skein1024-152":45939,"Skein1024-160":45940,"Skein1024-168":45941,"Skein1024-176":45942,"Skein1024-184":45943,"Skein1024-192":45944,"Skein1024-200":45945,"Skein1024-208":45946,"Skein1024-216":45947,"Skein1024-224":45948,"Skein1024-232":45949,"Skein1024-240":45950,"Skein1024-248":45951,"Skein1024-256":45952,"Skein1024-264":45953,"Skein1024-272":45954,"Skein1024-280":45955,"Skein1024-288":45956,"Skein1024-296":45957,"Skein1024-304":45958,"Skein1024-312":45959,"Skein1024-320":45960,"Skein1024-328":45961,"Skein1024-336":45962,"Skein1024-344":45963,"Skein1024-352":45964,"Skein1024-360":45965,"Skein1024-368":45966,"Skein1024-376":45967,"Skein1024-384":45968,"Skein1024-392":45969,"Skein1024-400":45970,"Skein1024-408":45971,"Skein1024-416":45972,"Skein1024-424":45973,"Skein1024-432":45974,"Skein1024-440":45975,"Skein1024-448":45976,"Skein1024-456":45977,"Skein1024-464":45978,"Skein1024-472":45979,"Skein1024-480":45980,"Skein1024-488":45981,"Skein1024-496":45982,"Skein1024-504":45983,"Skein1024-512":45984,"Skein1024-520":45985,"Skein1024-528":45986,"Skein1024-536":45987,"Skein1024-544":45988,"Skein1024-552":45989,"Skein1024-560":45990,"Skein1024-568":45991,"Skein1024-576":45992,"Skein1024-584":45993,"Skein1024-592":45994,"Skein1024-600":45995,"Skein1024-608":45996,"Skein1024-616":45997,"Skein1024-624":45998,"Skein1024-632":45999,"Skein1024-640":46e3,"Skein1024-648":46001,"Skein1024-656":46002,"Skein1024-664":46003,"Skein1024-672":46004,"Skein1024-680":46005,"Skein1024-688":46006,"Skein1024-696":46007,"Skein1024-704":46008,"Skein1024-712":46009,"Skein1024-720":46010,"Skein1024-728":46011,"Skein1024-736":46012,"Skein1024-744":46013,"Skein1024-752":46014,"Skein1024-760":46015,"Skein1024-768":46016,"Skein1024-776":46017,"Skein1024-784":46018,"Skein1024-792":46019,"Skein1024-800":46020,"Skein1024-808":46021,"Skein1024-816":46022,"Skein1024-824":46023,"Skein1024-832":46024,"Skein1024-840":46025,"Skein1024-848":46026,"Skein1024-856":46027,"Skein1024-864":46028,"Skein1024-872":46029,"Skein1024-880":46030,"Skein1024-888":46031,"Skein1024-896":46032,"Skein1024-904":46033,"Skein1024-912":46034,"Skein1024-920":46035,"Skein1024-928":46036,"Skein1024-936":46037,"Skein1024-944":46038,"Skein1024-952":46039,"Skein1024-960":46040,"Skein1024-968":46041,"Skein1024-976":46042,"Skein1024-984":46043,"Skein1024-992":46044,"Skein1024-1000":46045,"Skein1024-1008":46046,"Skein1024-1016":46047,"Skein1024-1024":46048}),t.codes=Object.freeze({0:"identity",17:"sha1",18:"sha2-256",19:"sha2-512",86:"dbl-sha2-256",23:"sha3-224",22:"sha3-256",21:"sha3-384",20:"sha3-512",24:"shake-128",25:"shake-256",26:"keccak-224",27:"keccak-256",28:"keccak-384",29:"keccak-512",34:"murmur3-128",35:"murmur3-32",45569:"blake2b-8",45570:"blake2b-16",45571:"blake2b-24",45572:"blake2b-32",45573:"blake2b-40",45574:"blake2b-48",45575:"blake2b-56",45576:"blake2b-64",45577:"blake2b-72",45578:"blake2b-80",45579:"blake2b-88",45580:"blake2b-96",45581:"blake2b-104",45582:"blake2b-112",45583:"blake2b-120",45584:"blake2b-128",45585:"blake2b-136",45586:"blake2b-144",45587:"blake2b-152",45588:"blake2b-160",45589:"blake2b-168",45590:"blake2b-176",45591:"blake2b-184",45592:"blake2b-192",45593:"blake2b-200",45594:"blake2b-208",45595:"blake2b-216",45596:"blake2b-224",45597:"blake2b-232",45598:"blake2b-240",45599:"blake2b-248",45600:"blake2b-256",45601:"blake2b-264",45602:"blake2b-272",45603:"blake2b-280",45604:"blake2b-288",45605:"blake2b-296",45606:"blake2b-304",45607:"blake2b-312",45608:"blake2b-320",45609:"blake2b-328",45610:"blake2b-336",45611:"blake2b-344",45612:"blake2b-352",45613:"blake2b-360",45614:"blake2b-368",45615:"blake2b-376",45616:"blake2b-384",45617:"blake2b-392",45618:"blake2b-400",45619:"blake2b-408",45620:"blake2b-416",45621:"blake2b-424",45622:"blake2b-432",45623:"blake2b-440",45624:"blake2b-448",45625:"blake2b-456",45626:"blake2b-464",45627:"blake2b-472",45628:"blake2b-480",45629:"blake2b-488",45630:"blake2b-496",45631:"blake2b-504",45632:"blake2b-512",45633:"blake2s-8",45634:"blake2s-16",45635:"blake2s-24",45636:"blake2s-32",45637:"blake2s-40",45638:"blake2s-48",45639:"blake2s-56",45640:"blake2s-64",45641:"blake2s-72",45642:"blake2s-80",45643:"blake2s-88",45644:"blake2s-96",45645:"blake2s-104",45646:"blake2s-112",45647:"blake2s-120",45648:"blake2s-128",45649:"blake2s-136",45650:"blake2s-144",45651:"blake2s-152",45652:"blake2s-160",45653:"blake2s-168",45654:"blake2s-176",45655:"blake2s-184",45656:"blake2s-192",45657:"blake2s-200",45658:"blake2s-208",45659:"blake2s-216",45660:"blake2s-224",45661:"blake2s-232",45662:"blake2s-240",45663:"blake2s-248",45664:"blake2s-256",45825:"Skein256-8",45826:"Skein256-16",45827:"Skein256-24",45828:"Skein256-32",45829:"Skein256-40",45830:"Skein256-48",45831:"Skein256-56",45832:"Skein256-64",45833:"Skein256-72",45834:"Skein256-80",45835:"Skein256-88",45836:"Skein256-96",45837:"Skein256-104",45838:"Skein256-112",45839:"Skein256-120",45840:"Skein256-128",45841:"Skein256-136",45842:"Skein256-144",45843:"Skein256-152",45844:"Skein256-160",45845:"Skein256-168",45846:"Skein256-176",45847:"Skein256-184",45848:"Skein256-192",45849:"Skein256-200",45850:"Skein256-208",45851:"Skein256-216",45852:"Skein256-224",45853:"Skein256-232",45854:"Skein256-240",45855:"Skein256-248",45856:"Skein256-256",45857:"Skein512-8",45858:"Skein512-16",45859:"Skein512-24",45860:"Skein512-32",45861:"Skein512-40",45862:"Skein512-48",45863:"Skein512-56",45864:"Skein512-64",45865:"Skein512-72",45866:"Skein512-80",45867:"Skein512-88",45868:"Skein512-96",45869:"Skein512-104",45870:"Skein512-112",45871:"Skein512-120",45872:"Skein512-128",45873:"Skein512-136",45874:"Skein512-144",45875:"Skein512-152",45876:"Skein512-160",45877:"Skein512-168",45878:"Skein512-176",45879:"Skein512-184",45880:"Skein512-192",45881:"Skein512-200",45882:"Skein512-208",45883:"Skein512-216",45884:"Skein512-224",45885:"Skein512-232",45886:"Skein512-240",45887:"Skein512-248",45888:"Skein512-256",45889:"Skein512-264",45890:"Skein512-272",45891:"Skein512-280",45892:"Skein512-288",45893:"Skein512-296",45894:"Skein512-304",45895:"Skein512-312",45896:"Skein512-320",45897:"Skein512-328",45898:"Skein512-336",45899:"Skein512-344",45900:"Skein512-352",45901:"Skein512-360",45902:"Skein512-368",45903:"Skein512-376",45904:"Skein512-384",45905:"Skein512-392",45906:"Skein512-400",45907:"Skein512-408",45908:"Skein512-416",45909:"Skein512-424",45910:"Skein512-432",45911:"Skein512-440",45912:"Skein512-448",45913:"Skein512-456",45914:"Skein512-464",45915:"Skein512-472",45916:"Skein512-480",45917:"Skein512-488",45918:"Skein512-496",45919:"Skein512-504",45920:"Skein512-512",45921:"Skein1024-8",45922:"Skein1024-16",45923:"Skein1024-24",45924:"Skein1024-32",45925:"Skein1024-40",45926:"Skein1024-48",45927:"Skein1024-56",45928:"Skein1024-64",45929:"Skein1024-72",45930:"Skein1024-80",45931:"Skein1024-88",45932:"Skein1024-96",45933:"Skein1024-104",45934:"Skein1024-112",45935:"Skein1024-120",45936:"Skein1024-128",45937:"Skein1024-136",45938:"Skein1024-144",45939:"Skein1024-152",45940:"Skein1024-160",45941:"Skein1024-168",45942:"Skein1024-176",45943:"Skein1024-184",45944:"Skein1024-192",45945:"Skein1024-200",45946:"Skein1024-208",45947:"Skein1024-216",45948:"Skein1024-224",45949:"Skein1024-232",45950:"Skein1024-240",45951:"Skein1024-248",45952:"Skein1024-256",45953:"Skein1024-264",45954:"Skein1024-272",45955:"Skein1024-280",45956:"Skein1024-288",45957:"Skein1024-296",45958:"Skein1024-304",45959:"Skein1024-312",45960:"Skein1024-320",45961:"Skein1024-328",45962:"Skein1024-336",45963:"Skein1024-344",45964:"Skein1024-352",45965:"Skein1024-360",45966:"Skein1024-368",45967:"Skein1024-376",45968:"Skein1024-384",45969:"Skein1024-392",45970:"Skein1024-400",45971:"Skein1024-408",45972:"Skein1024-416",45973:"Skein1024-424",45974:"Skein1024-432",45975:"Skein1024-440",45976:"Skein1024-448",45977:"Skein1024-456",45978:"Skein1024-464",45979:"Skein1024-472",45980:"Skein1024-480",45981:"Skein1024-488",45982:"Skein1024-496",45983:"Skein1024-504",45984:"Skein1024-512",45985:"Skein1024-520",45986:"Skein1024-528",45987:"Skein1024-536",45988:"Skein1024-544",45989:"Skein1024-552",45990:"Skein1024-560",45991:"Skein1024-568",45992:"Skein1024-576",45993:"Skein1024-584",45994:"Skein1024-592",45995:"Skein1024-600",45996:"Skein1024-608",45997:"Skein1024-616",45998:"Skein1024-624",45999:"Skein1024-632",46e3:"Skein1024-640",46001:"Skein1024-648",46002:"Skein1024-656",46003:"Skein1024-664",46004:"Skein1024-672",46005:"Skein1024-680",46006:"Skein1024-688",46007:"Skein1024-696",46008:"Skein1024-704",46009:"Skein1024-712",46010:"Skein1024-720",46011:"Skein1024-728",46012:"Skein1024-736",46013:"Skein1024-744",46014:"Skein1024-752",46015:"Skein1024-760",46016:"Skein1024-768",46017:"Skein1024-776",46018:"Skein1024-784",46019:"Skein1024-792",46020:"Skein1024-800",46021:"Skein1024-808",46022:"Skein1024-816",46023:"Skein1024-824",46024:"Skein1024-832",46025:"Skein1024-840",46026:"Skein1024-848",46027:"Skein1024-856",46028:"Skein1024-864",46029:"Skein1024-872",46030:"Skein1024-880",46031:"Skein1024-888",46032:"Skein1024-896",46033:"Skein1024-904",46034:"Skein1024-912",46035:"Skein1024-920",46036:"Skein1024-928",46037:"Skein1024-936",46038:"Skein1024-944",46039:"Skein1024-952",46040:"Skein1024-960",46041:"Skein1024-968",46042:"Skein1024-976",46043:"Skein1024-984",46044:"Skein1024-992",46045:"Skein1024-1000",46046:"Skein1024-1008",46047:"Skein1024-1016",46048:"Skein1024-1024"}),t.defaultLengths=Object.freeze({17:20,18:32,19:64,86:32,23:28,22:32,21:48,20:64,24:32,25:64,26:28,27:32,28:48,29:64,34:32,45569:1,45570:2,45571:3,45572:4,45573:5,45574:6,45575:7,45576:8,45577:9,45578:10,45579:11,45580:12,45581:13,45582:14,45583:15,45584:16,45585:17,45586:18,45587:19,45588:20,45589:21,45590:22,45591:23,45592:24,45593:25,45594:26,45595:27,45596:28,45597:29,45598:30,45599:31,45600:32,45601:33,45602:34,45603:35,45604:36,45605:37,45606:38,45607:39,45608:40,45609:41,45610:42,45611:43,45612:44,45613:45,45614:46,45615:47,45616:48,45617:49,45618:50,45619:51,45620:52,45621:53,45622:54,45623:55,45624:56,45625:57,45626:58,45627:59,45628:60,45629:61,45630:62,45631:63,45632:64,45633:1,45634:2,45635:3,45636:4,45637:5,45638:6,45639:7,45640:8,45641:9,45642:10,45643:11,45644:12,45645:13,45646:14,45647:15,45648:16,45649:17,45650:18,45651:19,45652:20,45653:21,45654:22,45655:23,45656:24,45657:25,45658:26,45659:27,45660:28,45661:29,45662:30,45663:31,45664:32,45825:1,45826:2,45827:3,45828:4,45829:5,45830:6,45831:7,45832:8,45833:9,45834:10,45835:11,45836:12,45837:13,45838:14,45839:15,45840:16,45841:17,45842:18,45843:19,45844:20,45845:21,45846:22,45847:23,45848:24,45849:25,45850:26,45851:27,45852:28,45853:29,45854:30,45855:31,45856:32,45857:1,45858:2,45859:3,45860:4,45861:5,45862:6,45863:7,45864:8,45865:9,45866:10,45867:11,45868:12,45869:13,45870:14,45871:15,45872:16,45873:17,45874:18,45875:19,45876:20,45877:21,45878:22,45879:23,45880:24,45881:25,45882:26,45883:27,45884:28,45885:29,45886:30,45887:31,45888:32,45889:33,45890:34,45891:35,45892:36,45893:37,45894:38,45895:39,45896:40,45897:41,45898:42,45899:43,45900:44,45901:45,45902:46,45903:47,45904:48,45905:49,45906:50,45907:51,45908:52,45909:53,45910:54,45911:55,45912:56,45913:57,45914:58,45915:59,45916:60,45917:61,45918:62,45919:63,45920:64,45921:1,45922:2,45923:3,45924:4,45925:5,45926:6,45927:7,45928:8,45929:9,45930:10,45931:11,45932:12,45933:13,45934:14,45935:15,45936:16,45937:17,45938:18,45939:19,45940:20,45941:21,45942:22,45943:23,45944:24,45945:25,45946:26,45947:27,45948:28,45949:29,45950:30,45951:31,45952:32,45953:33,45954:34,45955:35,45956:36,45957:37,45958:38,45959:39,45960:40,45961:41,45962:42,45963:43,45964:44,45965:45,45966:46,45967:47,45968:48,45969:49,45970:50,45971:51,45972:52,45973:53,45974:54,45975:55,45976:56,45977:57,45978:58,45979:59,45980:60,45981:61,45982:62,45983:63,45984:64,45985:65,45986:66,45987:67,45988:68,45989:69,45990:70,45991:71,45992:72,45993:73,45994:74,45995:75,45996:76,45997:77,45998:78,45999:79,46e3:80,46001:81,46002:82,46003:83,46004:84,46005:85,46006:86,46007:87,46008:88,46009:89,46010:90,46011:91,46012:92,46013:93,46014:94,46015:95,46016:96,46017:97,46018:98,46019:99,46020:100,46021:101,46022:102,46023:103,46024:104,46025:105,46026:106,46027:107,46028:108,46029:109,46030:110,46031:111,46032:112,46033:113,46034:114,46035:115,46036:116,46037:117,46038:118,46039:119,46040:120,46041:121,46042:122,46043:123,46044:124,46045:125,46046:126,46047:127,46048:128})},function(e,t){e.exports=function e(t,o,s){o=o||[];var a=s=s||0;for(;t>=i;)o[s++]=255&t|n,t/=128;for(;t&r;)o[s++]=255&t|n,t>>>=7;return o[s]=0|t,e.bytes=s-a+1,o};var n=128,r=-128,i=Math.pow(2,31)},function(e,t){e.exports=function e(t,i){var o,s=0,a=0,f=i=i||0,c=t.length;do{if(f>=c)throw e.bytes=0,new RangeError("Could not decode varint");o=t[f++],s+=a<28?(o&r)<=n);return e.bytes=f-i,s};var n=128,r=127},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),f=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e(e[t[0]]=new r(t[0],t[1],t[2],t[3]),e),{}),u=f.reduce((e,t)=>(e[t[1]]=c[t[0]],e),{});e.exports={names:c,codes:u}},function(e,t,n){"use strict";e.exports=class{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}}},function(e,t,n){"use strict";(function(t){e.exports=function(e){return{encode:e=>"string"==typeof e?t.from(e).toString("hex"):e.toString("hex"),decode(n){for(let t of n)if(e.indexOf(t)<0)throw new Error("invalid base16 character");return t.from(n,"hex")}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){function n(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){return{encode:r=>n("string"==typeof r?t.from(r):r,e),decode(t){for(let n of t)if(e.indexOf(n)<0)throw new Error("invalid base32 character");return function(e,t){let n=(e=e.replace(new RegExp("=","g"),"")).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}(t,e)}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){e.exports=function(e){const n=e.indexOf("=")>-1,r=e.indexOf("-")>-1&&e.indexOf("_")>-1;return{encode(e){let i="";i="string"==typeof e?t.from(e).toString("base64"):e.toString("base64"),r&&(i=i.replace(/\+/g,"-").replace(/\//g,"_"));const o=i.indexOf("=");return o>0&&!n&&(i=i.substring(0,o)),i},decode(n){for(let t of n)if(e.indexOf(t)<0)throw new Error("invalid base64 character");return t.from(n,"base64")}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(14),i=n(21).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(14),i={};e.exports=i;for(let e in r){i[r[e].toString("hex")]=e}},function(e,t,n){"use strict";e.exports=Object.freeze({PROTOBUF:80,CBOR:81,RLP:96,BENCODE:99,JSON:512,MESSAGEPACK:513,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,IPNS_NS:229,ZERONET:230,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",512:"json",513:"messagepack",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",46e3:"skein1024-640",46001:"skein1024-648",46002:"skein1024-656",46003:"skein1024-664",46004:"skein1024-672",46005:"skein1024-680",46006:"skein1024-688",46007:"skein1024-696",46008:"skein1024-704",46009:"skein1024-712",46010:"skein1024-720",46011:"skein1024-728",46012:"skein1024-736",46013:"skein1024-744",46014:"skein1024-752",46015:"skein1024-760",46016:"skein1024-768",46017:"skein1024-776",46018:"skein1024-784",46019:"skein1024-792",46020:"skein1024-800",46021:"skein1024-808",46022:"skein1024-816",46023:"skein1024-824",46024:"skein1024-832",46025:"skein1024-840",46026:"skein1024-848",46027:"skein1024-856",46028:"skein1024-864",46029:"skein1024-872",46030:"skein1024-880",46031:"skein1024-888",46032:"skein1024-896",46033:"skein1024-904",46034:"skein1024-912",46035:"skein1024-920",46036:"skein1024-928",46037:"skein1024-936",46038:"skein1024-944",46039:"skein1024-952",46040:"skein1024-960",46041:"skein1024-968",46042:"skein1024-976",46043:"skein1024-984",46044:"skein1024-992",46045:"skein1024-1000",46046:"skein1024-1008",46047:"skein1024-1016",46048:"skein1024-1024",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",229:"ipns-ns",230:"zeronet",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(13);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";t.DAGNode=n(6),t.DAGLink=n(3),t.resolver=n(89),t.util=n(8),t.codec=t.util.codec,t.defaultHashAlg=t.util.defaultHashAlg},function(e,t,n){"use strict"; /* object-assign (c) Sindre Sorhus @license MIT -*/var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function s(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,a,f=s(e),c=1;c=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),f=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),k(n)?r.showHidden=n:n&&t._extend(r,n),g(r.showHidden)&&(r.showHidden=!1),g(r.depth)&&(r.depth=2),g(r.colors)&&(r.colors=!1),g(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=f),u(r,e,r.depth)}function f(e,t){var n=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.colors[n][1]+"m":e}function c(e,t){return e}function u(e,n,r){if(e.customInspect&&n&&w(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return m(i)||(i=u(e,i,r)),i}var o=function(e,t){if(g(t))return e.stylize("undefined","undefined");if(m(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(p(t))return e.stylize(""+t,"number");if(k(t))return e.stylize(""+t,"boolean");if(d(t))return e.stylize("null","null")}(e,n);if(o)return o;var s=Object.keys(n),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(n)),x(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return h(n);if(0===s.length){if(w(n)){var f=n.name?": "+n.name:"";return e.stylize("[Function"+f+"]","special")}if(S(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(E(n))return e.stylize(Date.prototype.toString.call(n),"date");if(x(n))return h(n)}var c,y="",v=!1,_=["{","}"];(b(n)&&(v=!0,_=["[","]"]),w(n))&&(y=" [Function"+(n.name?": "+n.name:"")+"]");return S(n)&&(y=" "+RegExp.prototype.toString.call(n)),E(n)&&(y=" "+Date.prototype.toUTCString.call(n)),x(n)&&(y=" "+h(n)),0!==s.length||v&&0!=n.length?r<0?S(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),c=v?function(e,t,n,r,i){for(var o=[],s=0,a=t.length;s=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(c,y,_)):_[0]+y+_[1]}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,n,r,i,o){var s,a,f;if((f=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=f.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):f.set&&(a=e.stylize("[Setter]","special")),N(r,i)||(s="["+i+"]"),a||(e.seen.indexOf(f.value)<0?(a=d(n)?u(e,f.value,null):u(e,f.value,n-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),g(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function b(e){return Array.isArray(e)}function k(e){return"boolean"==typeof e}function d(e){return null===e}function p(e){return"number"==typeof e}function m(e){return"string"==typeof e}function g(e){return void 0===e}function S(e){return y(e)&&"[object RegExp]"===v(e)}function y(e){return"object"==typeof e&&null!==e}function E(e){return y(e)&&"[object Date]"===v(e)}function x(e){return y(e)&&("[object Error]"===v(e)||e instanceof Error)}function w(e){return"function"==typeof e}function v(e){return Object.prototype.toString.call(e)}function _(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(g(o)&&(o=e.env.NODE_DEBUG||""),n=n.toUpperCase(),!s[n])if(new RegExp("\\b"+n+"\\b","i").test(o)){var r=e.pid;s[n]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",n,r,e)}}else s[n]=function(){};return s[n]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=b,t.isBoolean=k,t.isNull=d,t.isNullOrUndefined=function(e){return null==e},t.isNumber=p,t.isString=m,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=g,t.isRegExp=S,t.isObject=y,t.isDate=E,t.isError=x,t.isFunction=w,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(55);var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function I(){var e=new Date,t=[_(e.getHours()),_(e.getMinutes()),_(e.getSeconds())].join(":");return[e.getDate(),A[e.getMonth()],t].join(" ")}function N(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",I(),t.format.apply(t,arguments))},t.inherits=n(56),t._extend=function(e,t){if(!t||!y(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var B="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function K(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(B&&e[B]){var t;if("function"!=typeof(t=e[B]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,B,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise((function(e,r){t=e,n=r})),i=[],o=0;o{["",...Object.keys(e)].includes(t)||Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:()=>e._links[n].Hash})}},function(e,t,n){ +*/var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function s(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,a,f=s(e),c=1;c=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),f=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),k(n)?r.showHidden=n:n&&t._extend(r,n),g(r.showHidden)&&(r.showHidden=!1),g(r.depth)&&(r.depth=2),g(r.colors)&&(r.colors=!1),g(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=f),u(r,e,r.depth)}function f(e,t){var n=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.colors[n][1]+"m":e}function c(e,t){return e}function u(e,n,r){if(e.customInspect&&n&&w(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return m(i)||(i=u(e,i,r)),i}var o=function(e,t){if(g(t))return e.stylize("undefined","undefined");if(m(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(p(t))return e.stylize(""+t,"number");if(k(t))return e.stylize(""+t,"boolean");if(d(t))return e.stylize("null","null")}(e,n);if(o)return o;var s=Object.keys(n),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(n)),x(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return h(n);if(0===s.length){if(w(n)){var f=n.name?": "+n.name:"";return e.stylize("[Function"+f+"]","special")}if(S(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(E(n))return e.stylize(Date.prototype.toString.call(n),"date");if(x(n))return h(n)}var c,y="",v=!1,_=["{","}"];(b(n)&&(v=!0,_=["[","]"]),w(n))&&(y=" [Function"+(n.name?": "+n.name:"")+"]");return S(n)&&(y=" "+RegExp.prototype.toString.call(n)),E(n)&&(y=" "+Date.prototype.toUTCString.call(n)),x(n)&&(y=" "+h(n)),0!==s.length||v&&0!=n.length?r<0?S(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),c=v?function(e,t,n,r,i){for(var o=[],s=0,a=t.length;s=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(c,y,_)):_[0]+y+_[1]}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,n,r,i,o){var s,a,f;if((f=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=f.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):f.set&&(a=e.stylize("[Setter]","special")),N(r,i)||(s="["+i+"]"),a||(e.seen.indexOf(f.value)<0?(a=d(n)?u(e,f.value,null):u(e,f.value,n-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),g(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function b(e){return Array.isArray(e)}function k(e){return"boolean"==typeof e}function d(e){return null===e}function p(e){return"number"==typeof e}function m(e){return"string"==typeof e}function g(e){return void 0===e}function S(e){return y(e)&&"[object RegExp]"===v(e)}function y(e){return"object"==typeof e&&null!==e}function E(e){return y(e)&&"[object Date]"===v(e)}function x(e){return y(e)&&("[object Error]"===v(e)||e instanceof Error)}function w(e){return"function"==typeof e}function v(e){return Object.prototype.toString.call(e)}function _(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(g(o)&&(o=e.env.NODE_DEBUG||""),n=n.toUpperCase(),!s[n])if(new RegExp("\\b"+n+"\\b","i").test(o)){var r=e.pid;s[n]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",n,r,e)}}else s[n]=function(){};return s[n]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=b,t.isBoolean=k,t.isNull=d,t.isNullOrUndefined=function(e){return null==e},t.isNumber=p,t.isString=m,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=g,t.isRegExp=S,t.isObject=y,t.isDate=E,t.isError=x,t.isFunction=w,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(56);var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function A(){var e=new Date,t=[_(e.getHours()),_(e.getMinutes()),_(e.getSeconds())].join(":");return[e.getDate(),I[e.getMonth()],t].join(" ")}function N(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",A(),t.format.apply(t,arguments))},t.inherits=n(57),t._extend=function(e,t){if(!t||!y(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var B="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function K(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(B&&e[B]){var t;if("function"!=typeof(t=e[B]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,B,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise((function(e,r){t=e,n=r})),i=[],o=0;o{["",...Object.keys(e)].includes(t)||Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:()=>e._links[n].Hash})}},function(e,t,n){ //! stable.js 0.1.8, https://github.com/Two-Screen/stable //! © 2018 Angry Bytes and contributors. MIT licensed. -e.exports=function(){"use strict";var e=function(e,n){return t(e.slice(),n)};function t(e,t){"function"!=typeof t&&(t=function(e,t){return String(e).localeCompare(t)});var r=e.length;if(r<=1)return e;for(var i=new Array(r),o=1;oc&&(o=c),s>c&&(s=c),a=i,f=o;;)if(a"!==e[0])throw new Error("Unexpected token in map type: "+e[0]);e.shift(),t.name=e.shift();break;case"repeated":case"required":case"optional":var n=e.shift();t.required="required"===n,t.repeated="repeated"===n,t.type=e.shift(),t.name=e.shift();break;case"[":t.options=o(e);break;case";":if(null===t.name)throw new Error("Missing field name");if(null===t.type)throw new Error("Missing type in message field: "+t.name);if(-1===t.tag)throw new Error("Missing tag number in message field: "+t.name);return e.shift(),t;default:throw new Error("Unexpected token in message field: "+e[0])}throw new Error("No ; found for message field")},a=function(e){for(var t={enums:[],messages:[],fields:[],extends:[],extensions:null};e.length;)switch(e[0]){case"map":case"repeated":case"optional":case"required":t.fields.push(s(e));break;case"enum":t.enums.push(k(e));break;case"message":t.messages.push(u(e));break;case"extensions":t.extensions=c(e);break;case"oneof":e.shift();var n=e.shift();if("{"!==e[0])throw new Error("Unexpected token in oneof: "+e[0]);for(e.shift();"}"!==e[0];){e.unshift("optional");var r=s(e);r.oneof=n,t.fields.push(r)}e.shift();break;case"extend":t.extends.push(f(e));break;case";":e.shift();break;case"reserved":case"option":for(e.shift();";"!==e[0];)e.shift();break;default:e.unshift("optional"),t.fields.push(s(e))}return t},f=function(e){return{name:e[1],message:u(e)}},c=function(e){e.shift();var t=Number(e.shift());if(isNaN(t))throw new Error("Invalid from in extensions definition");if("to"!==e.shift())throw new Error("Expected keyword 'to' in extensions definition");var n=e.shift();if("max"===n&&(n=536870911),n=Number(n),isNaN(n))throw new Error("Invalid to in extensions definition");if(";"!==e.shift())throw new Error("Missing ; in extensions definition");return{from:t,to:n}},u=function(e){e.shift();var t=1,n=[],r={name:e.shift(),enums:[],extends:[],messages:[],fields:[]};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("{"===e[0]?t++:"}"===e[0]&&t--,!t)return e.shift(),n=a(n),r.enums=n.enums,r.messages=n.messages,r.fields=n.fields,r.extends=n.extends,r.extensions=n.extensions,r;n.push(e.shift())}if(t)throw new Error("No closing tag for message")},h=function(e){e.shift();var t=e.shift();if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},l=function(e){if(e.shift(),"="!==e[0])throw new Error("Expected = but found "+e[0]);e.shift();var t=e.shift();switch(t){case'"proto2"':t=2;break;case'"proto3"':t=3;break;default:throw new Error("Expected protobuf syntax version but found "+t)}if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},b=function(e){if(e.length<4)throw new Error("Invalid enum value: "+e.slice(0,3).join(" "));if("="!==e[1])throw new Error("Expected = but found "+e[1]);if(";"!==e[3]&&"["!==e[3])throw new Error("Expected ; or [ but found "+e[1]);var t=e.shift();e.shift();var n={value:null,options:{}};return n.value=Number(e.shift()),"["===e[0]&&(n.options=o(e)),e.shift(),{name:t,val:n}},k=function(e){e.shift();var t={},n={name:e.shift(),values:{},options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),n;if("option"!==e[0]){var r=b(e);n.values[r.name]=r.val}else t=d(e),n.options[t.name]=t.value}throw new Error("No closing tag for enum")},d=function(e){for(var t=null,n=null,r=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")};e.length;){if(";"===e[0])return e.shift(),{name:t,value:n};switch(e[0]){case"option":e.shift();var i="("===e[0];if(i&&e.shift(),t=e.shift(),i){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}"."===e[0][0]&&(t+=e.shift());break;case"=":if(e.shift(),null===t)throw new Error("Expected key for option with value: "+e[0]);if(n=r(e.shift()),"optimize_for"===t&&!/^(SPEED|CODE_SIZE|LITE_RUNTIME)$/.test(n))throw new Error("Unexpected value for option optimize_for: "+n);"{"===n&&(n=p(e));break;default:throw new Error("Unexpected token in option: "+e[0])}}},p=function(e){for(var t=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")},n={};e.length;){if("}"===e[0])return e.shift(),n;var r="("===e[0];r&&e.shift();var i=e.shift();if(r){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}var o=null;switch(e[0]){case":":if(void 0!==n[i])throw new Error("Duplicate option map key "+i);e.shift(),"{"===(o=t(e.shift()))&&(o=p(e)),n[i]=o,";"===e[0]&&e.shift();break;case"{":if(e.shift(),o=p(e),void 0===n[i]&&(n[i]=[]),!Array.isArray(n[i]))throw new Error("Duplicate option map key "+i);n[i].push(o);break;default:throw new Error("Unexpected token in option map: "+e[0])}}throw new Error("No closing tag for option map")},m=function(e){e.shift();var t=e.shift().replace(/^"+|"+$/gm,"");if(";"!==e[0])throw new Error("Unexpected token: "+e[0]+'. Expected ";"');return e.shift(),t},g=function(e){e.shift();var t={name:e.shift(),methods:[],options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;switch(e[0]){case"option":var n=d(e);if(void 0!==t.options[n.name])throw new Error("Duplicate option "+n.name);t.options[n.name]=n.value;break;case"rpc":t.methods.push(S(e));break;default:throw new Error("Unexpected token in service: "+e[0])}}throw new Error("No closing tag for service")},S=function(e){e.shift();var t={name:e.shift(),input_type:null,output_type:null,client_streaming:!1,server_streaming:!1,options:{}};if("("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.client_streaming=!0),t.input_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),"returns"!==e[0])throw new Error("Expected returns but found "+e[0]);if(e.shift(),"("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.server_streaming=!0),t.output_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),";"===e[0])return e.shift(),t;if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;if("option"!==e[0])throw new Error("Unexpected token in rpc options: "+e[0]);var n=d(e);if(void 0!==t.options[n.name])throw new Error("Duplicate option "+n.name);t.options[n.name]=n.value}throw new Error("No closing tag for rpc")};e.exports=function(e){for(var t=r(e.toString()),n=0;nt.extensions.to)throw new Error(t.name+" does not declare "+e.tag+" as an extension number");t.fields.push(e)}))}))})),s.messages.forEach((function(e){e.fields.forEach((function(t){var n,r,o,a;if(t.options&&"true"===t.options.packed&&-1===i.indexOf(t.type)){if(-1===t.type.indexOf(".")){if(e.enums&&e.enums.some((function(e){return e.name===t.type})))return}else{if((n=t.type.split(".")).length>2)throw new Error("what is this?");if(r=n[0],o=n[1],s.messages.some((function(e){if(e.name===r)return a=e,e})),a&&a.enums&&a.enums.some((function(e){return e.name===o})))return}throw new Error("Fields of type "+t.type+' cannot be declared [packed=true]. Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire types) can be declared "packed". See https://developers.google.com/protocol-buffers/docs/encoding#optional')}}))})),s}},function(e,t){e.exports=function(e){var t,n=function(e){return e.trim()};return e.replace(/([;,{}()=:[\]<>]|\/\*|\*\/)/g," $1 ").split(/\n/).map(n).filter(Boolean).map((function(e){var t=e.indexOf("//");return t>-1?e.slice(0,t):e})).map(n).filter(Boolean).join("\n").split(/\s+|\n+/gm).filter((t=!1,function(e){return"/*"===e?(t=!0,!1):"*/"===e?(t=!1,!1):!t}))}},function(e,t){var n=function(e,t){var n=e.repeated?"repeated":e.required?"required":"optional";"map"===e.type&&(n="map<"+e.map.from+","+e.map.to+">"),e.oneof&&(n="");var r=Object.keys(e.options||{}).map((function(t){return t+" = "+e.options[t]})).join(",");return r&&(r=" ["+r+"]"),t.push((n?n+" ":"")+("map"===e.map?"":e.type+" ")+e.name+" = "+e.tag+r+";"),t},r=function(e,t){t.push("message "+e.name+" {"),e.enums||(e.enums=[]),e.enums.forEach((function(e){t.push(i(e,[]))})),e.messages||(e.messages=[]),e.messages.forEach((function(e){t.push(r(e,[]))}));var o={};return e.fields||(e.fields=[]),e.fields.forEach((function(e){e.oneof?(o[e.oneof]||(o[e.oneof]=[]),o[e.oneof].push(n(e,[]))):t.push(n(e,[]))})),Object.keys(o).forEach((function(e){o[e].unshift("oneof "+e+" {"),o[e].push("}"),t.push(o[e])})),t.push("}",""),t},i=function(e,t){t.push("enum "+e.name+" {"),e.options||(e.options={});var n=s(e.options,[]);return n.length>1&&t.push(n.slice(0,-1)),Object.keys(e.values).map((function(n){var r=o(e.values[n]);t.push([n+" = "+r+";"])})),t.push("}",""),t},o=function(e,t){var n=Object.keys(e.options||{}).map((function(t){return t+" = "+e.options[t]})).join(",");return n&&(n=" ["+n+"]"),e.value+n},s=function(e,t){var n=Object.keys(e);return n.forEach((function(n){var r=e[n];~n.indexOf(".")&&(n="("+n+")");var i=typeof r;"object"===i?(r=a(r,[])).length&&t.push("option "+n+" = {",r,"};"):("string"===i&&"optimize_for"!==n&&(r='"'+r+'"'),t.push("option "+n+" = "+r+";"))})),n.length>0&&t.push(""),t},a=function(e,t){return Object.keys(e).forEach((function(n){var r=e[n],i=typeof r;"object"===i?Array.isArray(r)?r.forEach((function(e){(e=a(e,[])).length&&t.push(n+" {",e,"}")})):(r=a(r,[])).length&&t.push(n+" {",r,"}"):("string"===i&&(r='"'+r+'"'),t.push(n+": "+r))})),t},f=function(e,t){var n="rpc "+e.name+"(";e.client_streaming&&(n+="stream "),n+=e.input_type+") returns (",e.server_streaming&&(n+="stream "),n+=e.output_type+")",e.options||(e.options={});var r=s(e.options,[]);return r.length>1?t.push(n+" {",r.slice(0,-1),"}"):t.push(n+";"),t},c=function(e){return function(t){return Array.isArray(t)?t.map(c(e+" ")).join("\n"):e+t}};e.exports=function(e){var t=[];return t.push('syntax = "proto'+e.syntax+'";',""),e.package&&t.push("package "+e.package+";",""),e.options||(e.options={}),s(e.options,t),e.enums||(e.enums=[]),e.enums.forEach((function(e){i(e,t)})),e.messages||(e.messages=[]),e.messages.forEach((function(e){r(e,t)})),e.services&&e.services.forEach((function(e){!function(e,t){t.push("service "+e.name+" {"),e.options||(e.options={}),s(e.options,t),e.methods||(e.methods=[]),e.methods.forEach((function(e){t.push(f(e,[]))})),t.push("}","")}(e,t)})),t.map(c("")).join("\n")}},function(e,t,n){"use strict";var r=n(65),i=n(67),o=n(68),s=n(69),a=n(1);e.exports=function(e,t){var n={},f={},c={},u=function(e,t){e.enums&&e.enums.forEach((function(e){e.id=t+(t?".":"")+e.name,f[e.id]=e,u(e,e.id)})),e.messages&&e.messages.forEach((function(r){r.id=t+(t?".":"")+r.name,n[r.id]=r,r.fields.forEach((function(r){if(r.map){var i="Map_"+r.map.from+"_"+r.map.to,o={name:i,enums:[],messages:[],fields:[{name:"key",type:r.map.from,tag:1,repeated:!1,required:!0},{name:"value",type:r.map.to,tag:2,repeated:!1,required:!1}],extensions:null,id:t+(t?".":"")+i};n[o.id]||(n[o.id]=o,e.messages.push(o)),r.type=i,r.repeated=!0}})),u(r,r.id)}))};u(e,"");var h=function(e,t){e.messages.forEach((function(n){t[n.name]=l(n.name,e.id)})),e.enums.forEach((function(e){t[e.name]=function(e){if(!e)return null;var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].value})),t}(e.values)})),t.type=2,t.message=!0,t.name=e.name;var n={};e.fields.forEach((function(e){e.oneof&&(n[e.oneof]||(n[e.oneof]=[]),n[e.oneof].push(e.name))}));var r=e.fields.map((function(t){return l(t.type,e.id)})),a=s(e,r,n),f=o(e,l,r,n,a),c=i(e,l,r);return f.bytes=c.bytes=0,t.buffer=!0,t.encode=f,t.decode=c,t.encodingLength=a,t},l=function(e,i,o){if(t&&t[e])return t[e];if(r[e])return r[e];var s,u,l=(i?i+"."+e:e).split(".").map((function(t,n,r){return r.slice(0,n).concat(e).join(".")})).reverse().reduce((function(e,t){return e||n[t]||f[t]}),null);if(!1===o)return l;if(!l)throw new Error("Could not resolve "+e);return l.values?(s=l,u=Object.keys(s.values||[]).map((function(e){return parseInt(s.values[e].value,10)})),r.make(0,(function e(t,n,r){if(!u.length||-1===u.indexOf(t))throw new Error("Invalid enum value: "+t);return a.encode(t,n,r),e.bytes=a.encode.bytes,n}),(function e(t,n){var r=a.decode(t,n);if(!u.length||-1===u.indexOf(r))throw new Error("Invalid enum value: "+r);return e.bytes=a.decode.bytes,r}),a.encodingLength)):c[l.id]||h(l,c[l.id]={})};return(e.enums||[]).concat((e.messages||[]).map((function(e){return l(e.id)})))}},function(e,t,n){"use strict";var r,i,o,s=n(1),a=n(66),f=n(18).Buffer,c=function(e,t,n,r){return t.bytes=n.bytes=0,{type:e,encode:t,decode:n,encodingLength:r}};t.make=c,t.bytes=(r=function(e){return f.isBuffer(e)?e.length:f.byteLength(e)},c(2,i=function(e,t,n){var o=n,a=r(e);return s.encode(a,t,n),n+=s.encode.bytes,f.isBuffer(e)?e.copy(t,n):t.write(e,n,a),n+=a,i.bytes=n-o,t},o=function(e,t){var n=t,r=s.decode(e,t);t+=s.decode.bytes;var i=e.slice(t,t+r);return t+=i.length,o.bytes=t-n,i},(function(e){var t=r(e);return s.encodingLength(t)+t}))),t.string=function(){var e=function(t,n,r){var i=r,o=f.byteLength(t);return s.encode(o,n,r,"utf-8"),r+=s.encode.bytes,n.write(t,r,o),r+=o,e.bytes=r-i,n},t=function(e,n){var r=n,i=s.decode(e,n);n+=s.decode.bytes;var o=e.toString("utf-8",n,n+i);return n+=i,t.bytes=n-r,o};return c(2,e,t,(function(e){var t=f.byteLength(e);return s.encodingLength(t)+t}))}(),t.bool=function(){var e=function(t,n,r){return n[r]=t?1:0,e.bytes=1,n},t=function(e,n){var r=e[n]>0;return t.bytes=1,r};return c(0,e,t,(function(e){return 1}))}(),t.int32=function(){var e=function(t,n){var r=s.decode(t,n);return e.bytes=s.decode.bytes,r>2147483647?r-4294967296:r};return c(0,s.encode,e,(function(e){return s.encodingLength(e<0?e+4294967296:e)}))}(),t.int64=function(){var e=function(t,n){var r=s.decode(t,n);if(r>=Math.pow(2,63)){for(var i=9;255===t[n+i-1];)i--;i=i||9;var o=f.allocUnsafe(i);t.copy(o,0,n,n+i),o[i-1]=127&o[i-1],r=-1*s.decode(o,0),e.bytes=10}else e.bytes=s.decode.bytes;return r},t=function(e,n,r){if(e<0){var i=r+9;for(s.encode(-1*e,n,r),n[r+=s.encode.bytes-1]=128|n[r];r=0?2*t:-2*t-1;var o=r.encode(t,n,i);return e.bytes=r.encode.bytes,o},t.decode=function e(t,n){var i=r.decode(t,n);return e.bytes=r.decode.bytes,1&i?(i+1)/-2:i/2},t.encodingLength=function(e){return r.encodingLength(e>=0?2*e:-2*e-1)}},function(e,t,n){"use strict";var r=n(1),i=n(16).defined;var o=function(e,t,n){switch(e){case 0:return r.decode(t,n),n+r.decode.bytes;case 1:return n+8;case 2:var i=r.decode(t,n);return n+r.decode.bytes+i;case 3:case 4:throw new Error("Groups are not supported");case 5:return n+4;default:throw new Error("Unknown wire type: "+e)}},s=function(e,t){if(e.map)return{};if(e.repeated)return[];switch(e.type){case"string":return null!=t?t:"";case"bool":return"true"===t;case"float":case"double":case"sfixed32":case"fixed32":case"varint":case"enum":case"uint64":case"uint32":case"int64":case"int32":case"sint64":case"sint32":return parseInt(t||0,10);default:return null}};e.exports=function(e,t,n){for(var a=[],f={},c=[],u=[],h=0;h-1&&delete n[f[u]];if(e.message){var h=r.decode(i,o);o+=r.decode.bytes;var l=e.decode(i,o,o+h);t.map?(n[a]=n[a]||{},n[a][l.key]=l.value):t.repeated?(n[a]=n[a]||[],n[a].push(l)):n[a]=l}else t.repeated?(n[a]=n[a]||[],n[a].push(e.decode(i,o))):n[a]=e.decode(i,o);return o+=e.decode.bytes}return function t(h,l,b){if(null==l&&(l=0),null==b&&(b=h.length),!(b<=h.length&&l<=h.length))throw new Error("Decoded message is not valid");for(var k,p=l,m={};;){if(b<=l){var g,S,y="",E=0;for(E=0;E-1){x=!0;break}x||(g?k.repeated?m[y]=[]:(S=S&&g[S]?g[S].value:g[Object.keys(g)[0]].value,m[y]=parseInt(S||0,10)):m[y]=s(k,S))}return t.bytes=l-p,m}var _=r.decode(h,l);l+=r.decode.bytes;var A=f[_>>3];if(null!=A){var I=n[A];if((k=e.fields[A]).packed){var N=r.decode(h,l);for(N+=l+=r.decode.bytes;l-1){if(g)throw new Error("only one of the properties defined in oneof "+S+" can be set");g=!0}}for(m=0;m{const r=a.createHash(t),i=await r(e);return n?i.slice(0,n):i},a.createHash=function(e){if(!e)throw i("hash algorithm must be specified","ERR_HASH_ALGORITHM_NOT_SPECIFIED");if(e=o.coerceCode(e),!a.functions[e])throw i(`multihash function '${e}' not yet supported`,"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return a.functions[e]},a.functions={17:s.sha1,18:s.sha2256,19:s.sha2512,20:s.sha3512,21:s.sha3384,22:s.sha3256,23:s.sha3224,24:s.shake128,25:s.shake256,26:s.keccak224,27:s.keccak256,28:s.keccak384,29:s.keccak512,34:s.murmur3128,35:s.murmur332,86:s.dblSha2256},s.addBlake(a.functions),a.validate=async(e,t)=>{const n=await a(e,o.decode(t).name);return 0===r.compare(t,n)},e.exports=a},function(e,t,n){"use strict";e.exports=function(e,t,n){var r,i=e instanceof Error?e:new Error(e);if("object"==typeof t?n=t:null!=t&&(i.code=t),n)for(r in n)i[r]=n[r];return i}},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=n(75),o=n(77),s=n(79),{fromNumberTo32BitBuf:a}=n(80),f=e=>async t=>{switch(e){case"sha3-224":return r.from(i.sha3_224.arrayBuffer(t));case"sha3-256":return r.from(i.sha3_256.arrayBuffer(t));case"sha3-384":return r.from(i.sha3_384.arrayBuffer(t));case"sha3-512":return r.from(i.sha3_512.arrayBuffer(t));case"shake-128":return r.from(i.shake128.create(128).update(t).arrayBuffer());case"shake-256":return r.from(i.shake256.create(256).update(t).arrayBuffer());case"keccak-224":return r.from(i.keccak224.arrayBuffer(t));case"keccak-256":return r.from(i.keccak256.arrayBuffer(t));case"keccak-384":return r.from(i.keccak384.arrayBuffer(t));case"keccak-512":return r.from(i.keccak512.arrayBuffer(t));case"murmur3-128":return r.from(o.x64.hash128(t),"hex");case"murmur3-32":return a(o.x86.hash32(t));default:throw new TypeError(`${e} is not a supported algorithm`)}};e.exports={sha1:s("sha1"),sha2256:s("sha2-256"),sha2512:s("sha2-512"),dblSha2256:s("dbl-sha2-256"),sha3224:f("sha3-224"),sha3256:f("sha3-256"),sha3384:f("sha3-384"),sha3512:f("sha3-512"),shake128:f("shake-128"),shake256:f("shake-256"),keccak224:f("keccak-224"),keccak256:f("keccak-256"),keccak384:f("keccak-384"),keccak512:f("keccak-512"),murmur3128:f("murmur3-128"),murmur332:f("murmur3-32"),addBlake:n(81)}},function(e,t,n){(function(r,i){var o; +e.exports=function(){"use strict";var e=function(e,n){return t(e.slice(),n)};function t(e,t){"function"!=typeof t&&(t=function(e,t){return String(e).localeCompare(t)});var r=e.length;if(r<=1)return e;for(var i=new Array(r),o=1;oc&&(o=c),s>c&&(s=c),a=i,f=o;;)if(a"!==e[0])throw new Error("Unexpected token in map type: "+e[0]);e.shift(),t.name=e.shift();break;case"repeated":case"required":case"optional":var n=e.shift();t.required="required"===n,t.repeated="repeated"===n,t.type=e.shift(),t.name=e.shift();break;case"[":t.options=o(e);break;case";":if(null===t.name)throw new Error("Missing field name");if(null===t.type)throw new Error("Missing type in message field: "+t.name);if(-1===t.tag)throw new Error("Missing tag number in message field: "+t.name);return e.shift(),t;default:throw new Error("Unexpected token in message field: "+e[0])}throw new Error("No ; found for message field")},a=function(e){for(var t={enums:[],messages:[],fields:[],extends:[],extensions:null};e.length;)switch(e[0]){case"map":case"repeated":case"optional":case"required":t.fields.push(s(e));break;case"enum":t.enums.push(k(e));break;case"message":t.messages.push(u(e));break;case"extensions":t.extensions=c(e);break;case"oneof":e.shift();var n=e.shift();if("{"!==e[0])throw new Error("Unexpected token in oneof: "+e[0]);for(e.shift();"}"!==e[0];){e.unshift("optional");var r=s(e);r.oneof=n,t.fields.push(r)}e.shift();break;case"extend":t.extends.push(f(e));break;case";":e.shift();break;case"reserved":case"option":for(e.shift();";"!==e[0];)e.shift();break;default:e.unshift("optional"),t.fields.push(s(e))}return t},f=function(e){return{name:e[1],message:u(e)}},c=function(e){e.shift();var t=Number(e.shift());if(isNaN(t))throw new Error("Invalid from in extensions definition");if("to"!==e.shift())throw new Error("Expected keyword 'to' in extensions definition");var n=e.shift();if("max"===n&&(n=536870911),n=Number(n),isNaN(n))throw new Error("Invalid to in extensions definition");if(";"!==e.shift())throw new Error("Missing ; in extensions definition");return{from:t,to:n}},u=function(e){e.shift();var t=1,n=[],r={name:e.shift(),enums:[],extends:[],messages:[],fields:[]};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("{"===e[0]?t++:"}"===e[0]&&t--,!t)return e.shift(),n=a(n),r.enums=n.enums,r.messages=n.messages,r.fields=n.fields,r.extends=n.extends,r.extensions=n.extensions,r;n.push(e.shift())}if(t)throw new Error("No closing tag for message")},h=function(e){e.shift();var t=e.shift();if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},l=function(e){if(e.shift(),"="!==e[0])throw new Error("Expected = but found "+e[0]);e.shift();var t=e.shift();switch(t){case'"proto2"':t=2;break;case'"proto3"':t=3;break;default:throw new Error("Expected protobuf syntax version but found "+t)}if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},b=function(e){if(e.length<4)throw new Error("Invalid enum value: "+e.slice(0,3).join(" "));if("="!==e[1])throw new Error("Expected = but found "+e[1]);if(";"!==e[3]&&"["!==e[3])throw new Error("Expected ; or [ but found "+e[1]);var t=e.shift();e.shift();var n={value:null,options:{}};return n.value=Number(e.shift()),"["===e[0]&&(n.options=o(e)),e.shift(),{name:t,val:n}},k=function(e){e.shift();var t={},n={name:e.shift(),values:{},options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),n;if("option"!==e[0]){var r=b(e);n.values[r.name]=r.val}else t=d(e),n.options[t.name]=t.value}throw new Error("No closing tag for enum")},d=function(e){for(var t=null,n=null,r=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")};e.length;){if(";"===e[0])return e.shift(),{name:t,value:n};switch(e[0]){case"option":e.shift();var i="("===e[0];if(i&&e.shift(),t=e.shift(),i){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}"."===e[0][0]&&(t+=e.shift());break;case"=":if(e.shift(),null===t)throw new Error("Expected key for option with value: "+e[0]);if(n=r(e.shift()),"optimize_for"===t&&!/^(SPEED|CODE_SIZE|LITE_RUNTIME)$/.test(n))throw new Error("Unexpected value for option optimize_for: "+n);"{"===n&&(n=p(e));break;default:throw new Error("Unexpected token in option: "+e[0])}}},p=function(e){for(var t=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")},n={};e.length;){if("}"===e[0])return e.shift(),n;var r="("===e[0];r&&e.shift();var i=e.shift();if(r){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}var o=null;switch(e[0]){case":":if(void 0!==n[i])throw new Error("Duplicate option map key "+i);e.shift(),"{"===(o=t(e.shift()))&&(o=p(e)),n[i]=o,";"===e[0]&&e.shift();break;case"{":if(e.shift(),o=p(e),void 0===n[i]&&(n[i]=[]),!Array.isArray(n[i]))throw new Error("Duplicate option map key "+i);n[i].push(o);break;default:throw new Error("Unexpected token in option map: "+e[0])}}throw new Error("No closing tag for option map")},m=function(e){e.shift();var t=e.shift().replace(/^"+|"+$/gm,"");if(";"!==e[0])throw new Error("Unexpected token: "+e[0]+'. Expected ";"');return e.shift(),t},g=function(e){e.shift();var t={name:e.shift(),methods:[],options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;switch(e[0]){case"option":var n=d(e);if(void 0!==t.options[n.name])throw new Error("Duplicate option "+n.name);t.options[n.name]=n.value;break;case"rpc":t.methods.push(S(e));break;default:throw new Error("Unexpected token in service: "+e[0])}}throw new Error("No closing tag for service")},S=function(e){e.shift();var t={name:e.shift(),input_type:null,output_type:null,client_streaming:!1,server_streaming:!1,options:{}};if("("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.client_streaming=!0),t.input_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),"returns"!==e[0])throw new Error("Expected returns but found "+e[0]);if(e.shift(),"("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.server_streaming=!0),t.output_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),";"===e[0])return e.shift(),t;if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;if("option"!==e[0])throw new Error("Unexpected token in rpc options: "+e[0]);var n=d(e);if(void 0!==t.options[n.name])throw new Error("Duplicate option "+n.name);t.options[n.name]=n.value}throw new Error("No closing tag for rpc")};e.exports=function(e){for(var t=r(e.toString()),n=0;nt.extensions.to)throw new Error(t.name+" does not declare "+e.tag+" as an extension number");t.fields.push(e)}))}))})),s.messages.forEach((function(e){e.fields.forEach((function(t){var n,r,o,a;if(t.options&&"true"===t.options.packed&&-1===i.indexOf(t.type)){if(-1===t.type.indexOf(".")){if(e.enums&&e.enums.some((function(e){return e.name===t.type})))return}else{if((n=t.type.split(".")).length>2)throw new Error("what is this?");if(r=n[0],o=n[1],s.messages.some((function(e){if(e.name===r)return a=e,e})),a&&a.enums&&a.enums.some((function(e){return e.name===o})))return}throw new Error("Fields of type "+t.type+' cannot be declared [packed=true]. Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire types) can be declared "packed". See https://developers.google.com/protocol-buffers/docs/encoding#optional')}}))})),s}},function(e,t){e.exports=function(e){var t,n=function(e){return e.trim()};return e.replace(/([;,{}()=:[\]<>]|\/\*|\*\/)/g," $1 ").split(/\n/).map(n).filter(Boolean).map((function(e){var t=e.indexOf("//");return t>-1?e.slice(0,t):e})).map(n).filter(Boolean).join("\n").split(/\s+|\n+/gm).filter((t=!1,function(e){return"/*"===e?(t=!0,!1):"*/"===e?(t=!1,!1):!t}))}},function(e,t){var n=function(e,t){var n=e.repeated?"repeated":e.required?"required":"optional";"map"===e.type&&(n="map<"+e.map.from+","+e.map.to+">"),e.oneof&&(n="");var r=Object.keys(e.options||{}).map((function(t){return t+" = "+e.options[t]})).join(",");return r&&(r=" ["+r+"]"),t.push((n?n+" ":"")+("map"===e.map?"":e.type+" ")+e.name+" = "+e.tag+r+";"),t},r=function(e,t){t.push("message "+e.name+" {"),e.enums||(e.enums=[]),e.enums.forEach((function(e){t.push(i(e,[]))})),e.messages||(e.messages=[]),e.messages.forEach((function(e){t.push(r(e,[]))}));var o={};return e.fields||(e.fields=[]),e.fields.forEach((function(e){e.oneof?(o[e.oneof]||(o[e.oneof]=[]),o[e.oneof].push(n(e,[]))):t.push(n(e,[]))})),Object.keys(o).forEach((function(e){o[e].unshift("oneof "+e+" {"),o[e].push("}"),t.push(o[e])})),t.push("}",""),t},i=function(e,t){t.push("enum "+e.name+" {"),e.options||(e.options={});var n=s(e.options,[]);return n.length>1&&t.push(n.slice(0,-1)),Object.keys(e.values).map((function(n){var r=o(e.values[n]);t.push([n+" = "+r+";"])})),t.push("}",""),t},o=function(e,t){var n=Object.keys(e.options||{}).map((function(t){return t+" = "+e.options[t]})).join(",");return n&&(n=" ["+n+"]"),e.value+n},s=function(e,t){var n=Object.keys(e);return n.forEach((function(n){var r=e[n];~n.indexOf(".")&&(n="("+n+")");var i=typeof r;"object"===i?(r=a(r,[])).length&&t.push("option "+n+" = {",r,"};"):("string"===i&&"optimize_for"!==n&&(r='"'+r+'"'),t.push("option "+n+" = "+r+";"))})),n.length>0&&t.push(""),t},a=function(e,t){return Object.keys(e).forEach((function(n){var r=e[n],i=typeof r;"object"===i?Array.isArray(r)?r.forEach((function(e){(e=a(e,[])).length&&t.push(n+" {",e,"}")})):(r=a(r,[])).length&&t.push(n+" {",r,"}"):("string"===i&&(r='"'+r+'"'),t.push(n+": "+r))})),t},f=function(e,t){var n="rpc "+e.name+"(";e.client_streaming&&(n+="stream "),n+=e.input_type+") returns (",e.server_streaming&&(n+="stream "),n+=e.output_type+")",e.options||(e.options={});var r=s(e.options,[]);return r.length>1?t.push(n+" {",r.slice(0,-1),"}"):t.push(n+";"),t},c=function(e){return function(t){return Array.isArray(t)?t.map(c(e+" ")).join("\n"):e+t}};e.exports=function(e){var t=[];return t.push('syntax = "proto'+e.syntax+'";',""),e.package&&t.push("package "+e.package+";",""),e.options||(e.options={}),s(e.options,t),e.enums||(e.enums=[]),e.enums.forEach((function(e){i(e,t)})),e.messages||(e.messages=[]),e.messages.forEach((function(e){r(e,t)})),e.services&&e.services.forEach((function(e){!function(e,t){t.push("service "+e.name+" {"),e.options||(e.options={}),s(e.options,t),e.methods||(e.methods=[]),e.methods.forEach((function(e){t.push(f(e,[]))})),t.push("}","")}(e,t)})),t.map(c("")).join("\n")}},function(e,t,n){"use strict";var r=n(66),i=n(68),o=n(69),s=n(70),a=n(1);e.exports=function(e,t){var n={},f={},c={},u=function(e,t){e.enums&&e.enums.forEach((function(e){e.id=t+(t?".":"")+e.name,f[e.id]=e,u(e,e.id)})),e.messages&&e.messages.forEach((function(r){r.id=t+(t?".":"")+r.name,n[r.id]=r,r.fields.forEach((function(r){if(r.map){var i="Map_"+r.map.from+"_"+r.map.to,o={name:i,enums:[],messages:[],fields:[{name:"key",type:r.map.from,tag:1,repeated:!1,required:!0},{name:"value",type:r.map.to,tag:2,repeated:!1,required:!1}],extensions:null,id:t+(t?".":"")+i};n[o.id]||(n[o.id]=o,e.messages.push(o)),r.type=i,r.repeated=!0}})),u(r,r.id)}))};u(e,"");var h=function(e,t){e.messages.forEach((function(n){t[n.name]=l(n.name,e.id)})),e.enums.forEach((function(e){t[e.name]=function(e){if(!e)return null;var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].value})),t}(e.values)})),t.type=2,t.message=!0,t.name=e.name;var n={};e.fields.forEach((function(e){e.oneof&&(n[e.oneof]||(n[e.oneof]=[]),n[e.oneof].push(e.name))}));var r=e.fields.map((function(t){return l(t.type,e.id)})),a=s(e,r,n),f=o(e,l,r,n,a),c=i(e,l,r);return f.bytes=c.bytes=0,t.buffer=!0,t.encode=f,t.decode=c,t.encodingLength=a,t},l=function(e,i,o){if(t&&t[e])return t[e];if(r[e])return r[e];var s,u,l=(i?i+"."+e:e).split(".").map((function(t,n,r){return r.slice(0,n).concat(e).join(".")})).reverse().reduce((function(e,t){return e||n[t]||f[t]}),null);if(!1===o)return l;if(!l)throw new Error("Could not resolve "+e);return l.values?(s=l,u=Object.keys(s.values||[]).map((function(e){return parseInt(s.values[e].value,10)})),r.make(0,(function e(t,n,r){if(!u.length||-1===u.indexOf(t))throw new Error("Invalid enum value: "+t);return a.encode(t,n,r),e.bytes=a.encode.bytes,n}),(function e(t,n){var r=a.decode(t,n);if(!u.length||-1===u.indexOf(r))throw new Error("Invalid enum value: "+r);return e.bytes=a.decode.bytes,r}),a.encodingLength)):c[l.id]||h(l,c[l.id]={})};return(e.enums||[]).concat((e.messages||[]).map((function(e){return l(e.id)})))}},function(e,t,n){"use strict";var r,i,o,s=n(1),a=n(67),f=n(19).Buffer,c=function(e,t,n,r){return t.bytes=n.bytes=0,{type:e,encode:t,decode:n,encodingLength:r}};t.make=c,t.bytes=(r=function(e){return f.isBuffer(e)?e.length:f.byteLength(e)},c(2,i=function(e,t,n){var o=n,a=r(e);return s.encode(a,t,n),n+=s.encode.bytes,f.isBuffer(e)?e.copy(t,n):t.write(e,n,a),n+=a,i.bytes=n-o,t},o=function(e,t){var n=t,r=s.decode(e,t);t+=s.decode.bytes;var i=e.slice(t,t+r);return t+=i.length,o.bytes=t-n,i},(function(e){var t=r(e);return s.encodingLength(t)+t}))),t.string=function(){var e=function(t,n,r){var i=r,o=f.byteLength(t);return s.encode(o,n,r,"utf-8"),r+=s.encode.bytes,n.write(t,r,o),r+=o,e.bytes=r-i,n},t=function(e,n){var r=n,i=s.decode(e,n);n+=s.decode.bytes;var o=e.toString("utf-8",n,n+i);return n+=i,t.bytes=n-r,o};return c(2,e,t,(function(e){var t=f.byteLength(e);return s.encodingLength(t)+t}))}(),t.bool=function(){var e=function(t,n,r){return n[r]=t?1:0,e.bytes=1,n},t=function(e,n){var r=e[n]>0;return t.bytes=1,r};return c(0,e,t,(function(e){return 1}))}(),t.int32=function(){var e=function(t,n){var r=s.decode(t,n);return e.bytes=s.decode.bytes,r>2147483647?r-4294967296:r};return c(0,s.encode,e,(function(e){return s.encodingLength(e<0?e+4294967296:e)}))}(),t.int64=function(){var e=function(t,n){var r=s.decode(t,n);if(r>=Math.pow(2,63)){for(var i=9;255===t[n+i-1];)i--;i=i||9;var o=f.allocUnsafe(i);t.copy(o,0,n,n+i),o[i-1]=127&o[i-1],r=-1*s.decode(o,0),e.bytes=10}else e.bytes=s.decode.bytes;return r},t=function(e,n,r){if(e<0){var i=r+9;for(s.encode(-1*e,n,r),n[r+=s.encode.bytes-1]=128|n[r];r=0?2*t:-2*t-1;var o=r.encode(t,n,i);return e.bytes=r.encode.bytes,o},t.decode=function e(t,n){var i=r.decode(t,n);return e.bytes=r.decode.bytes,1&i?(i+1)/-2:i/2},t.encodingLength=function(e){return r.encodingLength(e>=0?2*e:-2*e-1)}},function(e,t,n){"use strict";var r=n(1),i=n(16).defined;var o=function(e,t,n){switch(e){case 0:return r.decode(t,n),n+r.decode.bytes;case 1:return n+8;case 2:var i=r.decode(t,n);return n+r.decode.bytes+i;case 3:case 4:throw new Error("Groups are not supported");case 5:return n+4;default:throw new Error("Unknown wire type: "+e)}},s=function(e,t){if(e.map)return{};if(e.repeated)return[];switch(e.type){case"string":return null!=t?t:"";case"bool":return"true"===t;case"float":case"double":case"sfixed32":case"fixed32":case"varint":case"enum":case"uint64":case"uint32":case"int64":case"int32":case"sint64":case"sint32":return parseInt(t||0,10);default:return null}};e.exports=function(e,t,n){for(var a=[],f={},c=[],u=[],h=0;h-1&&delete n[f[u]];if(e.message){var h=r.decode(i,o);o+=r.decode.bytes;var l=e.decode(i,o,o+h);t.map?(n[a]=n[a]||{},n[a][l.key]=l.value):t.repeated?(n[a]=n[a]||[],n[a].push(l)):n[a]=l}else t.repeated?(n[a]=n[a]||[],n[a].push(e.decode(i,o))):n[a]=e.decode(i,o);return o+=e.decode.bytes}return function t(h,l,b){if(null==l&&(l=0),null==b&&(b=h.length),!(b<=h.length&&l<=h.length))throw new Error("Decoded message is not valid");for(var k,p=l,m={};;){if(b<=l){var g,S,y="",E=0;for(E=0;E-1){x=!0;break}x||(g?k.repeated?m[y]=[]:(S=S&&g[S]?g[S].value:g[Object.keys(g)[0]].value,m[y]=parseInt(S||0,10)):m[y]=s(k,S))}return t.bytes=l-p,m}var _=r.decode(h,l);l+=r.decode.bytes;var I=f[_>>3];if(null!=I){var A=n[I];if((k=e.fields[I]).packed){var N=r.decode(h,l);for(N+=l+=r.decode.bytes;l-1){if(g)throw new Error("only one of the properties defined in oneof "+S+" can be set");g=!0}}for(m=0;m{const r=a.createHash(t),i=await r(e);return n?i.slice(0,n):i},a.createHash=function(e){if(!e)throw i("hash algorithm must be specified","ERR_HASH_ALGORITHM_NOT_SPECIFIED");if(e=o.coerceCode(e),!a.functions[e])throw i(`multihash function '${e}' not yet supported`,"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return a.functions[e]},a.functions={17:s.sha1,18:s.sha2256,19:s.sha2512,20:s.sha3512,21:s.sha3384,22:s.sha3256,23:s.sha3224,24:s.shake128,25:s.shake256,26:s.keccak224,27:s.keccak256,28:s.keccak384,29:s.keccak512,34:s.murmur3128,35:s.murmur332,86:s.dblSha2256},s.addBlake(a.functions),a.validate=async(e,t)=>{const n=await a(e,o.decode(t).name);return 0===r.compare(t,n)},e.exports=a},function(e,t,n){"use strict";e.exports=function(e,t,n){var r,i=e instanceof Error?e:new Error(e);if("object"==typeof t?n=t:null!=t&&(i.code=t),n)for(r in n)i[r]=n[r];return i}},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=n(76),o=n(78),s=n(80),{fromNumberTo32BitBuf:a}=n(81),f=e=>async t=>{switch(e){case"sha3-224":return r.from(i.sha3_224.arrayBuffer(t));case"sha3-256":return r.from(i.sha3_256.arrayBuffer(t));case"sha3-384":return r.from(i.sha3_384.arrayBuffer(t));case"sha3-512":return r.from(i.sha3_512.arrayBuffer(t));case"shake-128":return r.from(i.shake128.create(128).update(t).arrayBuffer());case"shake-256":return r.from(i.shake256.create(256).update(t).arrayBuffer());case"keccak-224":return r.from(i.keccak224.arrayBuffer(t));case"keccak-256":return r.from(i.keccak256.arrayBuffer(t));case"keccak-384":return r.from(i.keccak384.arrayBuffer(t));case"keccak-512":return r.from(i.keccak512.arrayBuffer(t));case"murmur3-128":return r.from(o.x64.hash128(t),"hex");case"murmur3-32":return a(o.x86.hash32(t));default:throw new TypeError(`${e} is not a supported algorithm`)}};e.exports={sha1:s("sha1"),sha2256:s("sha2-256"),sha2512:s("sha2-512"),dblSha2256:s("dbl-sha2-256"),sha3224:f("sha3-224"),sha3256:f("sha3-256"),sha3384:f("sha3-384"),sha3512:f("sha3-512"),shake128:f("shake-128"),shake256:f("shake-256"),keccak224:f("keccak-224"),keccak256:f("keccak-256"),keccak384:f("keccak-384"),keccak512:f("keccak-512"),murmur3128:f("murmur3-128"),murmur332:f("murmur3-32"),addBlake:n(82)}},function(e,t,n){(function(r,i){var o; /** * [js-sha3]{@link https://github.com/emn178/js-sha3} * @@ -27,5 +27,5 @@ e.exports=function(){"use strict";var e=function(e,n){return t(e.slice(),n)};fun * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT - */!function(){"use strict";var s="input is invalid type",a="object"==typeof window,f=a?window:{};f.JS_SHA3_NO_WINDOW&&(a=!1);var c=!a&&"object"==typeof self;!f.JS_SHA3_NO_NODE_JS&&"object"==typeof r&&r.versions&&r.versions.node?f=i:c&&(f=self);var u=!f.JS_SHA3_NO_COMMON_JS&&"object"==typeof e&&e.exports,h=n(76),l=!f.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,b="0123456789abcdef".split(""),k=[4,1024,262144,67108864],d=[0,8,16,24],p=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],m=[224,256,384,512],g=[128,256],S=["hex","buffer","arrayBuffer","array","digest"],y={128:168,256:136};!f.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!l||!f.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var E=function(e,t,n){return function(r){return new C(e,t,e).update(r)[n]()}},x=function(e,t,n){return function(r,i){return new C(e,t,i).update(r)[n]()}},w=function(e,t,n){return function(t,r,i,o){return N["cshake"+e].update(t,r,i,o)[n]()}},v=function(e,t,n){return function(t,r,i,o){return N["kmac"+e].update(t,r,i,o)[n]()}},_=function(e,t,n,r){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function D(e,t,n){C.call(this,e,t,n)}C.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(s);if(null===e)throw new Error(s);if(l&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||l&&ArrayBuffer.isView(e)))throw new Error(s);t=!0}for(var r,i,o=this.blocks,a=this.byteCount,f=e.length,c=this.blockCount,u=0,h=this.s;u>2]|=e[u]<>2]|=i<>2]|=(192|i>>6)<>2]|=(128|63&i)<=57344?(o[r>>2]|=(224|i>>12)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|i>>12&63)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<=a){for(this.start=r-a,this.block=o[c],r=0;r>=8);n>0;)i.unshift(n),n=255&(e>>=8),++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},C.prototype.encodeString=function(e){var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(s);if(null===e)throw new Error(s);if(l&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||l&&ArrayBuffer.isView(e)))throw new Error(s);t=!0}var r=0,i=e.length;if(t)r=i;else for(var o=0;o=57344?r+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++o)),r+=4)}return r+=this.encode(8*r),this.update(e),r},C.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t>4&15]+b[15&e]+b[e>>12&15]+b[e>>8&15]+b[e>>20&15]+b[e>>16&15]+b[e>>28&15]+b[e>>24&15];s%t==0&&(U(n),o=0)}return i&&(e=n[o],a+=b[e>>4&15]+b[15&e],i>1&&(a+=b[e>>12&15]+b[e>>8&15]),i>2&&(a+=b[e>>20&15]+b[e>>16&15])),a},C.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;e=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(a);for(var f=new Uint32Array(e);s>8&255,f[e+2]=t>>16&255,f[e+3]=t>>24&255;a%n==0&&U(r)}return o&&(e=a<<2,t=r[s],f[e]=255&t,o>1&&(f[e+1]=t>>8&255),o>2&&(f[e+2]=t>>16&255)),f},D.prototype=new C,D.prototype.finalize=function(){return this.encode(this.outputBits,!0),C.prototype.finalize.call(this)};var U=function(e){var t,n,r,i,o,s,a,f,c,u,h,l,b,k,d,m,g,S,y,E,x,w,v,_,A,I,N,B,K,O,L,T,P,j,C,D,U,R,M,z,H,F,q,Y,G,J,$,V,W,X,Z,Q,ee,te,ne,re,ie,oe,se,ae,fe,ce,ue;for(r=0;r<48;r+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],f=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],u=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(l=e[8]^e[18]^e[28]^e[38]^e[48])^(s<<1|a>>>31),n=(b=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|s>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=i^(f<<1|c>>>31),n=o^(c<<1|f>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=s^(u<<1|h>>>31),n=a^(h<<1|u>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=f^(l<<1|b>>>31),n=c^(b<<1|l>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=u^(i<<1|o>>>31),n=h^(o<<1|i>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,k=e[0],d=e[1],J=e[11]<<4|e[10]>>>28,$=e[10]<<4|e[11]>>>28,B=e[20]<<3|e[21]>>>29,K=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,fe=e[30]<<9|e[31]>>>23,F=e[40]<<18|e[41]>>>14,q=e[41]<<18|e[40]>>>14,j=e[2]<<1|e[3]>>>31,C=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,V=e[22]<<10|e[23]>>>22,W=e[23]<<10|e[22]>>>22,O=e[33]<<13|e[32]>>>19,L=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,ue=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,D=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,S=e[25]<<11|e[24]>>>21,y=e[24]<<11|e[25]>>>21,X=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,T=e[45]<<29|e[44]>>>3,P=e[44]<<29|e[45]>>>3,_=e[6]<<28|e[7]>>>4,A=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,R=e[26]<<25|e[27]>>>7,M=e[27]<<25|e[26]>>>7,E=e[36]<<21|e[37]>>>11,x=e[37]<<21|e[36]>>>11,Q=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,Y=e[8]<<27|e[9]>>>5,G=e[9]<<27|e[8]>>>5,I=e[18]<<20|e[19]>>>12,N=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,z=e[38]<<8|e[39]>>>24,H=e[39]<<8|e[38]>>>24,w=e[48]<<14|e[49]>>>18,v=e[49]<<14|e[48]>>>18,e[0]=k^~m&S,e[1]=d^~g&y,e[10]=_^~I&B,e[11]=A^~N&K,e[20]=j^~D&R,e[21]=C^~U&M,e[30]=Y^~J&V,e[31]=G^~$&W,e[40]=te^~re&oe,e[41]=ne^~ie&se,e[2]=m^~S&E,e[3]=g^~y&x,e[12]=I^~B&O,e[13]=N^~K&L,e[22]=D^~R&z,e[23]=U^~M&H,e[32]=J^~V&X,e[33]=$^~W&Z,e[42]=re^~oe&ae,e[43]=ie^~se&fe,e[4]=S^~E&w,e[5]=y^~x&v,e[14]=B^~O&T,e[15]=K^~L&P,e[24]=R^~z&F,e[25]=M^~H&q,e[34]=V^~X&Q,e[35]=W^~Z&ee,e[44]=oe^~ae&ce,e[45]=se^~fe&ue,e[6]=E^~w&k,e[7]=x^~v&d,e[16]=O^~T&_,e[17]=L^~P&A,e[26]=z^~F&j,e[27]=H^~q&C,e[36]=X^~Q&Y,e[37]=Z^~ee&G,e[46]=ae^~ce&te,e[47]=fe^~ue&ne,e[8]=w^~k&m,e[9]=v^~d&g,e[18]=T^~_&I,e[19]=P^~A&N,e[28]=F^~j&D,e[29]=q^~C&U,e[38]=Q^~Y&J,e[39]=ee^~G&$,e[48]=ce^~te&re,e[49]=ue^~ne&ie,e[0]^=p[r],e[1]^=p[r+1]};if(u)e.exports=N;else{for(K=0;K255)return!1;return!0}function s(e,t){return(65535&e)*t+(((e>>>16)*t&65535)<<16)}function a(e,t){return e<>>32-t}function f(e){return e=s(e^=e>>>16,2246822507),e=s(e^=e>>>13,3266489909),e^=e>>>16}function c(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function u(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function h(e,t){return 32===(t%=64)?[e[1],e[0]]:t<32?[e[0]<>>32-t,e[1]<>>32-t]:(t-=32,[e[1]<>>32-t,e[0]<>>32-t])}function l(e,t){return 0===(t%=64)?e:t<32?[e[0]<>>32-t,e[1]<>>1]),e=b(e=u(e,[4283543511,3981806797]),[0,e[0]>>>1]),e=b(e=u(e,[3301882366,444984403]),[0,e[0]>>>1])}i.x86.hash32=function(e,t){if(!i.inputValidation||o(e)){t=t||0;for(var n=e.length%4,r=e.length-n,c=t,u=0,h=3432918353,l=461845907,b=0;b>>0}},i.x86.hash128=function(e,t){if(!i.inputValidation||o(e)){t=t||0;for(var n=e.length%16,r=e.length-n,c=t,u=t,h=t,l=t,b=0,k=0,d=0,p=0,m=597399067,g=2869860233,S=951274213,y=2716044179,E=0;E>>0).toString(16)).slice(-8)+("00000000"+(u>>>0).toString(16)).slice(-8)+("00000000"+(h>>>0).toString(16)).slice(-8)+("00000000"+(l>>>0).toString(16)).slice(-8)}},i.x64.hash128=function(e,t){if(!i.inputValidation||o(e)){t=t||0;for(var n=e.length%16,r=e.length-n,s=[0,t],a=[0,t],f=[0,0],d=[0,0],p=[2277735313,289559509],m=[1291169091,658871167],g=0;g>>0).toString(16)).slice(-8)+("00000000"+(s[1]>>>0).toString(16)).slice(-8)+("00000000"+(a[0]>>>0).toString(16)).slice(-8)+("00000000"+(a[1]>>>0).toString(16)).slice(-8)}},e.exports&&(t=e.exports=i),t.murmurHash3=i}()},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=self.crypto||self.msCrypto;e.exports=e=>{if("undefined"==typeof self||!self.crypto&&!self.msCrypto)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");return async t=>{switch(e){case"sha1":return r.from(await i.subtle.digest({name:"SHA-1"},t));case"sha2-256":return r.from(await i.subtle.digest({name:"SHA-256"},t));case"sha2-512":return r.from(await i.subtle.digest({name:"SHA-512"},t));case"dbl-sha2-256":{const e=await i.subtle.digest({name:"SHA-256"},t);return r.from(await i.subtle.digest({name:"SHA-256"},e))}default:throw new Error(`${e} is not a supported algorithm`)}}}},function(e,t,n){"use strict";const{Buffer:r}=n(0);e.exports={fromNumberTo32BitBuf:e=>{const t=new Array(4);for(let n=0;n<4;n++)t[n]=255&e,e>>=8;return r.from(t)}}},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=n(82),o={init:i.blake2bInit,update:i.blake2bUpdate,digest:i.blake2bFinal},s={init:i.blake2sInit,update:i.blake2sUpdate,digest:i.blake2sFinal},a=(e,t)=>async n=>{const i=t.init(e,null);return t.update(i,n),r.from(t.digest(i))};e.exports=e=>{for(let t=0;t<64;t++)e[45569+t]=a(t+1,o);for(let t=0;t<32;t++)e[45633+t]=a(t+1,s)}},function(e,t,n){var r=n(83),i=n(84);e.exports={blake2b:r.blake2b,blake2bHex:r.blake2bHex,blake2bInit:r.blake2bInit,blake2bUpdate:r.blake2bUpdate,blake2bFinal:r.blake2bFinal,blake2s:i.blake2s,blake2sHex:i.blake2sHex,blake2sInit:i.blake2sInit,blake2sUpdate:i.blake2sUpdate,blake2sFinal:i.blake2sFinal}},function(e,t,n){var r=n(24);function i(e,t,n){var r=e[t]+e[n],i=e[t+1]+e[n+1];r>=4294967296&&i++,e[t]=r,e[t+1]=i}function o(e,t,n,r){var i=e[t]+n;n<0&&(i+=4294967296);var o=e[t+1]+r;i>=4294967296&&o++,e[t]=i,e[t+1]=o}function s(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function a(e,t,n,r,s,a){var f=h[s],c=h[s+1],l=h[a],b=h[a+1];i(u,e,t),o(u,e,f,c);var k=u[r]^u[e],d=u[r+1]^u[e+1];u[r]=d,u[r+1]=k,i(u,n,r),k=u[t]^u[n],d=u[t+1]^u[n+1],u[t]=k>>>24^d<<8,u[t+1]=d>>>24^k<<8,i(u,e,t),o(u,e,l,b),k=u[r]^u[e],d=u[r+1]^u[e+1],u[r]=k>>>16^d<<16,u[r+1]=d>>>16^k<<16,i(u,n,r),k=u[t]^u[n],d=u[t+1]^u[n+1],u[t]=d>>>31^k<<1,u[t+1]=k>>>31^d<<1}var f=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),c=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map((function(e){return 2*e}))),u=new Uint32Array(32),h=new Uint32Array(32);function l(e,t){var n=0;for(n=0;n<16;n++)u[n]=e.h[n],u[n+16]=f[n];for(u[24]=u[24]^e.t,u[25]=u[25]^e.t/4294967296,t&&(u[28]=~u[28],u[29]=~u[29]),n=0;n<32;n++)h[n]=s(e.b,4*n);for(n=0;n<12;n++)a(0,8,16,24,c[16*n+0],c[16*n+1]),a(2,10,18,26,c[16*n+2],c[16*n+3]),a(4,12,20,28,c[16*n+4],c[16*n+5]),a(6,14,22,30,c[16*n+6],c[16*n+7]),a(0,10,20,30,c[16*n+8],c[16*n+9]),a(2,12,22,24,c[16*n+10],c[16*n+11]),a(4,14,16,26,c[16*n+12],c[16*n+13]),a(6,8,18,28,c[16*n+14],c[16*n+15]);for(n=0;n<16;n++)e.h[n]=e.h[n]^u[n]^u[n+16]}function b(e,t){if(0===e||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");for(var n={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e},r=0;r<16;r++)n.h[r]=f[r];var i=t?t.length:0;return n.h[0]^=16842752^i<<8^e,t&&(k(n,t),n.c=128),n}function k(e,t){for(var n=0;n>2]>>8*(3&n);return t}function p(e,t,n){n=n||64,e=r.normalizeInput(e);var i=b(n,t);return k(i,e),d(i)}e.exports={blake2b:p,blake2bHex:function(e,t,n){var i=p(e,t,n);return r.toHex(i)},blake2bInit:b,blake2bUpdate:k,blake2bFinal:d}},function(e,t,n){var r=n(24);function i(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function o(e,t,n,r,i,o){c[e]=c[e]+c[t]+i,c[r]=s(c[r]^c[e],16),c[n]=c[n]+c[r],c[t]=s(c[t]^c[n],12),c[e]=c[e]+c[t]+o,c[r]=s(c[r]^c[e],8),c[n]=c[n]+c[r],c[t]=s(c[t]^c[n],7)}function s(e,t){return e>>>t^e<<32-t}var a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),f=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),c=new Uint32Array(16),u=new Uint32Array(16);function h(e,t){var n=0;for(n=0;n<8;n++)c[n]=e.h[n],c[n+8]=a[n];for(c[12]^=e.t,c[13]^=e.t/4294967296,t&&(c[14]=~c[14]),n=0;n<16;n++)u[n]=i(e.b,4*n);for(n=0;n<10;n++)o(0,4,8,12,u[f[16*n+0]],u[f[16*n+1]]),o(1,5,9,13,u[f[16*n+2]],u[f[16*n+3]]),o(2,6,10,14,u[f[16*n+4]],u[f[16*n+5]]),o(3,7,11,15,u[f[16*n+6]],u[f[16*n+7]]),o(0,5,10,15,u[f[16*n+8]],u[f[16*n+9]]),o(1,6,11,12,u[f[16*n+10]],u[f[16*n+11]]),o(2,7,8,13,u[f[16*n+12]],u[f[16*n+13]]),o(3,4,9,14,u[f[16*n+14]],u[f[16*n+15]]);for(n=0;n<8;n++)e.h[n]^=c[n]^c[n+8]}function l(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");var n=t?t.length:0;if(t&&!(n>0&&n<=32))throw new Error("Incorrect key length, should be in [1, 32]");var r={h:new Uint32Array(a),b:new Uint32Array(64),c:0,t:0,outlen:e};return r.h[0]^=16842752^n<<8^e,n>0&&(b(r,t),r.c=64),r}function b(e,t){for(var n=0;n>2]>>8*(3&n)&255;return t}function d(e,t,n){n=n||32,e=r.normalizeInput(e);var i=l(n,t);return b(i,e),k(i)}e.exports={blake2s:d,blake2sHex:function(e,t,n){var i=d(e,t,n);return r.toHex(i)},blake2sInit:l,blake2sUpdate:b,blake2sFinal:k}},function(e,t,n){"use strict";const r=n(9),i=r.cloneLinks,o=r.cloneData,s=n(7);e.exports=function(e){const t=o(e),n=i(e);return s(t,n)}},function(e,t,n){"use strict";const r=n(9),i=r.cloneLinks,o=r.cloneData,s=r.toDAGLink,a=n(3),f=n(6),c=n(7);e.exports=async(e,t)=>{const n=i(e),r=o(e),u=await(async e=>a.isDAGLink(e)?e:f.isDAGNode(e)?s(e,{}):new a(e.Name||e.name,e.Tsize||e.size,e.Hash||e.multihash||e.hash||e.cid))(t);return n.push(u),c(r,n)}},function(e,t,n){"use strict";(function(t){const r=n(9),i=r.cloneLinks,o=r.cloneData,s=n(7),a=n(4);e.exports=(e,n)=>{const r=o(e);let f=i(e);if("string"==typeof n)f=f.filter(e=>e.Name!==n);else{if(!t.isBuffer(n)&&!a.isCID(n))throw new Error("second arg needs to be a name or CID");f=f.filter(e=>!e.Hash.equals(n))}return s(r,f)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(e){const r=n(4),i=n(8);t.resolve=(e,t)=>{let n=i.deserialize(e);const o=t.split("/").filter(Boolean);for(;o.length;){const e=o.shift();if(void 0===n[e])throw new Error(`Object has no property '${e}'`);if(n=n[e],r.isCID(n))return{value:n,remainderPath:o.join("/")}}return{value:n,remainderPath:""}};const o=function*(t,n){if(!e.isBuffer(t)&&!r.isCID(t)&&"string"!=typeof t&&null!==t)for(const e of Object.keys(t)){const r=void 0===n?e:n+"/"+e;yield r,yield*o(t[e],r)}};t.tree=function*(e){const t=i.deserialize(e);yield*o(t)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(90),i=n(2).isFunction,o=n(2).isBoolean,s=n(2).isObject,a=n(2).isArray,f=n(2).isRegex,c=n(2).assign,u=n(2).keys;e.exports=function(e,t){t=t||c({},r),i(t)&&(t={compare:t});const n=t.space||r.space,h=o(t.cycles)?t.cycles:r.cycles,l=t.replacer||r.replacer,b=t.stringify||r.stringify,k=t.compare&&(d=t.compare,function(e){return function(t,n){const r={key:t,value:e[t]},i={key:n,value:e[n]};return d(r,i)}});var d;h||b(e);const p=[];return function e(t,r,i,o){const c=n?"\n"+new Array(o+1).join(n):"",d=n?": ":":";if(i=function(e){return null==e?e:f(e)?e.toString():e.toJSON?e.toJSON():e}(i),void 0!==(i=l.call(t,r,i))){if(!s(i)||null===i)return b(i);if(a(i)){const t=[];for(let r=0;rt,stringify:JSON.stringify}},function(e,t,n){"use strict";const r=n(11),i=n(92),o=n(5),s=n(25),{isDefined:a,findUniques:f,difference:c,io:u}=n(12),h=["heads"],l=(e,t)=>e.slice(e.length-Math.min(e.length,t),e.length);e.exports=class{static async toMultihash(e,t,{format:n}={}){if(!a(e))throw s.IPFSNotDefinedError();if(!a(t))throw s.LogNotDefinedError();if(a(n)||(n="dag-cbor"),t.values.length<1)throw new Error("Can't serialize an empty log");return u.write(e,n,t.toJSON(),{links:h})}static async fromMultihash(e,t,{length:n=-1,exclude:f,onProgressCallback:c,timeout:l}={}){if(!a(e))throw s.IPFSNotDefinedError();if(!a(t))throw new Error(`Invalid hash: ${t}`);const b=await u.read(e,t,{links:h});if(!b.heads||!b.id)throw s.NotALogError();const k=await i.fetchAll(e,b.heads,{length:n,exclude:f,onProgressCallback:c,timeout:l}),d=k.reduce((e,t)=>t.clock.time>e.time?new o(t.clock.id,t.clock.time):e,new o(b.id)),p=k.slice().sort(r.compare),m=p.filter(e=>b.heads.includes(e.hash));return{id:b.id,values:p,heads:m,clock:d}}static async fromEntryHash(e,t,{length:n=-1,exclude:r,onProgressCallback:o,timeout:f}){if(!a(e))throw s.IpfsNotDefinedError();if(!a(t))throw new Error("'hash' must be defined");const c=Array.isArray(t)?t:[t];n=n>-1?Math.max(n,1):n;const u=await i.fetchParallel(e,c,{length:n,exclude:r,onProgressCallback:o,timeout:f});return{values:n>-1?l(u,n):u}}static async fromJSON(e,t,{length:n=-1,timeout:o,onProgressCallback:f}){if(!a(e))throw s.IPFSNotDefinedError();const c=t.heads.map(e=>e.hash),u=(await i.fetchParallel(e,c,{length:n,exclude:[],concurrency:16,timeout:o,onProgressCallback:f})).slice().sort(r.compare);return{id:t.id,values:u,heads:t.heads}}static async fromEntry(e,t,{length:n=-1,exclude:o,onProgressCallback:u,timeout:h}){if(!a(e))throw s.IPFSNotDefinedError();if(!a(t))throw new Error("'sourceEntries' must be defined");if(!Array.isArray(t)&&!r.isEntry(t))throw new Error("'sourceEntries' argument must be an array of Entry instances or a single Entry");Array.isArray(t)||(t=[t]),n=n>-1?Math.max(n,t.length):n;const l=t.map(e=>e.hash),b=await i.fetchParallel(e,l,{length:n,exclude:o,onProgressCallback:u,timeout:h}),k=t.concat(b),d=f(k,"hash").sort(r.compare),p=d.slice(n>-1?-n:-d.length),m=((e,t)=>{var n=e.slice(t.length,e.length);return t.concat(n)})(p,c(p,t,"hash"));return{id:m[m.length-1].id,values:m}}}},function(e,t,n){"use strict";const r=n(93),i=n(94),o=n(11);class s{static async fetchParallel(e,t,{length:n=-1,exclude:r=[],concurrency:o=null,timeout:a,onProgressCallback:f}={}){const c=e=>e.hash,u=(e,t)=>{const n=e.map(c);return t.forEach(t=>{-1===n.indexOf(t.hash)&&e.push(t)}),e},h=Array.isArray(t)?t.slice():[t];return o=Math.max(o||h.length,1),(e=>e.reduce(u,[]))(await i(h,t=>s.fetchAll(e,t,{length:n,exclude:r,timeout:a,onProgressCallback:f}),{concurrency:o}))}static async fetchAll(e,t,{length:n=-1,exclude:i=[],timeout:s=null,onProgressCallback:a,concurrency:f=32}={}){let c=[],u={},h=Array.isArray(t)?t.slice():[t];const l=e=>h.push(e);(i=i&&Array.isArray(i)?i:[]).forEach(e=>{o.isEntry(e)&&(c.push(e),u[e.hash]=e)});return await r(()=>h.length>0&&(c.length{const t=h.shift();return!t||u[t]?Promise.resolve():new Promise(async(n,r)=>{const i=s?setTimeout(()=>{console.warn(`Warning: Couldn't fetch entry '${t}', request timed out (${s}ms)`),n()},s):null;try{(e=>{o.isEntry(e)&&(e.next.forEach(l),e.refs.forEach(l),c.push(e),u[t]=e,a&&a(t,e,c.length,c,h))})(await o.fromMultihash(e,t)),n()}catch(e){r(e)}finally{clearTimeout(i)}})}),u={},h=[],c}}e.exports=s},function(e,t,n){"use strict";const r=e=>new Promise(t=>{t(e())});e.exports=(e,t)=>r((function n(){if(e())return r(t).then(n)}))},function(e,t,n){"use strict";e.exports=(e,t,n)=>new Promise((r,i)=>{if(n=Object.assign({concurrency:1/0},n),"function"!=typeof t)throw new TypeError("Mapper function is required");const o=n.concurrency;if(!("number"==typeof o&&o>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${o}\` (${typeof o})`);const s=[],a=e[Symbol.iterator]();let f=!1,c=!1,u=0,h=0;const l=()=>{if(f)return;const e=a.next(),n=h;if(h++,e.done)return c=!0,void(0===u&&r(s));u++,Promise.resolve(e.value).then(e=>t(e,n)).then(e=>{s[n]=e,u--,l()},e=>{f=!0,i(e)})};for(let e=0;ee,r=(e,t)=>o(e,t,n);return((e,t)=>i(e,t,r))(e,t)},t.SortByEntryHash=function(e,t){const n=(e,t)=>e.hasho(e,t,n);return((e,t)=>i(e,t,r))(e,t)},t.NoZeroes=function(e){const t=`Your log's tiebreaker function, ${e.name}, has returned zero and therefore cannot be`;return(n,r)=>{const i=e(n,r);if(0===i)throw Error(t);return i}}},function(e,t,n){"use strict";e.exports=class{async canAppend(e,t){return!0}}},function(e,t,n){"use strict";e.exports=class{constructor(e={}){this._cache=e}set(e,t){this._cache[e]=t}get(e){return this._cache[e]}delete(e){return delete this._cache[e]}add(e){this._cache=Object.assign(this._cache,e)}get length(){return Object.values(this._cache).length}}}]); + */!function(){"use strict";var s="input is invalid type",a="object"==typeof window,f=a?window:{};f.JS_SHA3_NO_WINDOW&&(a=!1);var c=!a&&"object"==typeof self;!f.JS_SHA3_NO_NODE_JS&&"object"==typeof r&&r.versions&&r.versions.node?f=i:c&&(f=self);var u=!f.JS_SHA3_NO_COMMON_JS&&"object"==typeof e&&e.exports,h=n(77),l=!f.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,b="0123456789abcdef".split(""),k=[4,1024,262144,67108864],d=[0,8,16,24],p=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],m=[224,256,384,512],g=[128,256],S=["hex","buffer","arrayBuffer","array","digest"],y={128:168,256:136};!f.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!l||!f.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var E=function(e,t,n){return function(r){return new C(e,t,e).update(r)[n]()}},x=function(e,t,n){return function(r,i){return new C(e,t,i).update(r)[n]()}},w=function(e,t,n){return function(t,r,i,o){return N["cshake"+e].update(t,r,i,o)[n]()}},v=function(e,t,n){return function(t,r,i,o){return N["kmac"+e].update(t,r,i,o)[n]()}},_=function(e,t,n,r){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function D(e,t,n){C.call(this,e,t,n)}C.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(s);if(null===e)throw new Error(s);if(l&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||l&&ArrayBuffer.isView(e)))throw new Error(s);t=!0}for(var r,i,o=this.blocks,a=this.byteCount,f=e.length,c=this.blockCount,u=0,h=this.s;u>2]|=e[u]<>2]|=i<>2]|=(192|i>>6)<>2]|=(128|63&i)<=57344?(o[r>>2]|=(224|i>>12)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|i>>12&63)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<=a){for(this.start=r-a,this.block=o[c],r=0;r>=8);n>0;)i.unshift(n),n=255&(e>>=8),++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},C.prototype.encodeString=function(e){var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(s);if(null===e)throw new Error(s);if(l&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||l&&ArrayBuffer.isView(e)))throw new Error(s);t=!0}var r=0,i=e.length;if(t)r=i;else for(var o=0;o=57344?r+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++o)),r+=4)}return r+=this.encode(8*r),this.update(e),r},C.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t>4&15]+b[15&e]+b[e>>12&15]+b[e>>8&15]+b[e>>20&15]+b[e>>16&15]+b[e>>28&15]+b[e>>24&15];s%t==0&&(U(n),o=0)}return i&&(e=n[o],a+=b[e>>4&15]+b[15&e],i>1&&(a+=b[e>>12&15]+b[e>>8&15]),i>2&&(a+=b[e>>20&15]+b[e>>16&15])),a},C.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;e=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(a);for(var f=new Uint32Array(e);s>8&255,f[e+2]=t>>16&255,f[e+3]=t>>24&255;a%n==0&&U(r)}return o&&(e=a<<2,t=r[s],f[e]=255&t,o>1&&(f[e+1]=t>>8&255),o>2&&(f[e+2]=t>>16&255)),f},D.prototype=new C,D.prototype.finalize=function(){return this.encode(this.outputBits,!0),C.prototype.finalize.call(this)};var U=function(e){var t,n,r,i,o,s,a,f,c,u,h,l,b,k,d,m,g,S,y,E,x,w,v,_,I,A,N,B,K,O,L,T,j,P,C,D,U,R,M,z,H,F,q,Y,G,J,$,V,W,X,Z,Q,ee,te,ne,re,ie,oe,se,ae,fe,ce,ue;for(r=0;r<48;r+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],f=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],u=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(l=e[8]^e[18]^e[28]^e[38]^e[48])^(s<<1|a>>>31),n=(b=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|s>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=i^(f<<1|c>>>31),n=o^(c<<1|f>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=s^(u<<1|h>>>31),n=a^(h<<1|u>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=f^(l<<1|b>>>31),n=c^(b<<1|l>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=u^(i<<1|o>>>31),n=h^(o<<1|i>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,k=e[0],d=e[1],J=e[11]<<4|e[10]>>>28,$=e[10]<<4|e[11]>>>28,B=e[20]<<3|e[21]>>>29,K=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,fe=e[30]<<9|e[31]>>>23,F=e[40]<<18|e[41]>>>14,q=e[41]<<18|e[40]>>>14,P=e[2]<<1|e[3]>>>31,C=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,V=e[22]<<10|e[23]>>>22,W=e[23]<<10|e[22]>>>22,O=e[33]<<13|e[32]>>>19,L=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,ue=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,D=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,S=e[25]<<11|e[24]>>>21,y=e[24]<<11|e[25]>>>21,X=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,T=e[45]<<29|e[44]>>>3,j=e[44]<<29|e[45]>>>3,_=e[6]<<28|e[7]>>>4,I=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,R=e[26]<<25|e[27]>>>7,M=e[27]<<25|e[26]>>>7,E=e[36]<<21|e[37]>>>11,x=e[37]<<21|e[36]>>>11,Q=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,Y=e[8]<<27|e[9]>>>5,G=e[9]<<27|e[8]>>>5,A=e[18]<<20|e[19]>>>12,N=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,z=e[38]<<8|e[39]>>>24,H=e[39]<<8|e[38]>>>24,w=e[48]<<14|e[49]>>>18,v=e[49]<<14|e[48]>>>18,e[0]=k^~m&S,e[1]=d^~g&y,e[10]=_^~A&B,e[11]=I^~N&K,e[20]=P^~D&R,e[21]=C^~U&M,e[30]=Y^~J&V,e[31]=G^~$&W,e[40]=te^~re&oe,e[41]=ne^~ie&se,e[2]=m^~S&E,e[3]=g^~y&x,e[12]=A^~B&O,e[13]=N^~K&L,e[22]=D^~R&z,e[23]=U^~M&H,e[32]=J^~V&X,e[33]=$^~W&Z,e[42]=re^~oe&ae,e[43]=ie^~se&fe,e[4]=S^~E&w,e[5]=y^~x&v,e[14]=B^~O&T,e[15]=K^~L&j,e[24]=R^~z&F,e[25]=M^~H&q,e[34]=V^~X&Q,e[35]=W^~Z&ee,e[44]=oe^~ae&ce,e[45]=se^~fe&ue,e[6]=E^~w&k,e[7]=x^~v&d,e[16]=O^~T&_,e[17]=L^~j&I,e[26]=z^~F&P,e[27]=H^~q&C,e[36]=X^~Q&Y,e[37]=Z^~ee&G,e[46]=ae^~ce&te,e[47]=fe^~ue&ne,e[8]=w^~k&m,e[9]=v^~d&g,e[18]=T^~_&A,e[19]=j^~I&N,e[28]=F^~P&D,e[29]=q^~C&U,e[38]=Q^~Y&J,e[39]=ee^~G&$,e[48]=ce^~te&re,e[49]=ue^~ne&ie,e[0]^=p[r],e[1]^=p[r+1]};if(u)e.exports=N;else{for(K=0;K255)return!1;return!0}function s(e,t){return(65535&e)*t+(((e>>>16)*t&65535)<<16)}function a(e,t){return e<>>32-t}function f(e){return e=s(e^=e>>>16,2246822507),e=s(e^=e>>>13,3266489909),e^=e>>>16}function c(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function u(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function h(e,t){return 32===(t%=64)?[e[1],e[0]]:t<32?[e[0]<>>32-t,e[1]<>>32-t]:(t-=32,[e[1]<>>32-t,e[0]<>>32-t])}function l(e,t){return 0===(t%=64)?e:t<32?[e[0]<>>32-t,e[1]<>>1]),e=b(e=u(e,[4283543511,3981806797]),[0,e[0]>>>1]),e=b(e=u(e,[3301882366,444984403]),[0,e[0]>>>1])}i.x86.hash32=function(e,t){if(!i.inputValidation||o(e)){t=t||0;for(var n=e.length%4,r=e.length-n,c=t,u=0,h=3432918353,l=461845907,b=0;b>>0}},i.x86.hash128=function(e,t){if(!i.inputValidation||o(e)){t=t||0;for(var n=e.length%16,r=e.length-n,c=t,u=t,h=t,l=t,b=0,k=0,d=0,p=0,m=597399067,g=2869860233,S=951274213,y=2716044179,E=0;E>>0).toString(16)).slice(-8)+("00000000"+(u>>>0).toString(16)).slice(-8)+("00000000"+(h>>>0).toString(16)).slice(-8)+("00000000"+(l>>>0).toString(16)).slice(-8)}},i.x64.hash128=function(e,t){if(!i.inputValidation||o(e)){t=t||0;for(var n=e.length%16,r=e.length-n,s=[0,t],a=[0,t],f=[0,0],d=[0,0],p=[2277735313,289559509],m=[1291169091,658871167],g=0;g>>0).toString(16)).slice(-8)+("00000000"+(s[1]>>>0).toString(16)).slice(-8)+("00000000"+(a[0]>>>0).toString(16)).slice(-8)+("00000000"+(a[1]>>>0).toString(16)).slice(-8)}},e.exports&&(t=e.exports=i),t.murmurHash3=i}()},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=self.crypto||self.msCrypto;e.exports=e=>{if("undefined"==typeof self||!self.crypto&&!self.msCrypto)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");return async t=>{switch(e){case"sha1":return r.from(await i.subtle.digest({name:"SHA-1"},t));case"sha2-256":return r.from(await i.subtle.digest({name:"SHA-256"},t));case"sha2-512":return r.from(await i.subtle.digest({name:"SHA-512"},t));case"dbl-sha2-256":{const e=await i.subtle.digest({name:"SHA-256"},t);return r.from(await i.subtle.digest({name:"SHA-256"},e))}default:throw new Error(`${e} is not a supported algorithm`)}}}},function(e,t,n){"use strict";const{Buffer:r}=n(0);e.exports={fromNumberTo32BitBuf:e=>{const t=new Array(4);for(let n=0;n<4;n++)t[n]=255&e,e>>=8;return r.from(t)}}},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=n(83),o={init:i.blake2bInit,update:i.blake2bUpdate,digest:i.blake2bFinal},s={init:i.blake2sInit,update:i.blake2sUpdate,digest:i.blake2sFinal},a=(e,t)=>async n=>{const i=t.init(e,null);return t.update(i,n),r.from(t.digest(i))};e.exports=e=>{for(let t=0;t<64;t++)e[45569+t]=a(t+1,o);for(let t=0;t<32;t++)e[45633+t]=a(t+1,s)}},function(e,t,n){var r=n(84),i=n(85);e.exports={blake2b:r.blake2b,blake2bHex:r.blake2bHex,blake2bInit:r.blake2bInit,blake2bUpdate:r.blake2bUpdate,blake2bFinal:r.blake2bFinal,blake2s:i.blake2s,blake2sHex:i.blake2sHex,blake2sInit:i.blake2sInit,blake2sUpdate:i.blake2sUpdate,blake2sFinal:i.blake2sFinal}},function(e,t,n){var r=n(25);function i(e,t,n){var r=e[t]+e[n],i=e[t+1]+e[n+1];r>=4294967296&&i++,e[t]=r,e[t+1]=i}function o(e,t,n,r){var i=e[t]+n;n<0&&(i+=4294967296);var o=e[t+1]+r;i>=4294967296&&o++,e[t]=i,e[t+1]=o}function s(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function a(e,t,n,r,s,a){var f=h[s],c=h[s+1],l=h[a],b=h[a+1];i(u,e,t),o(u,e,f,c);var k=u[r]^u[e],d=u[r+1]^u[e+1];u[r]=d,u[r+1]=k,i(u,n,r),k=u[t]^u[n],d=u[t+1]^u[n+1],u[t]=k>>>24^d<<8,u[t+1]=d>>>24^k<<8,i(u,e,t),o(u,e,l,b),k=u[r]^u[e],d=u[r+1]^u[e+1],u[r]=k>>>16^d<<16,u[r+1]=d>>>16^k<<16,i(u,n,r),k=u[t]^u[n],d=u[t+1]^u[n+1],u[t]=d>>>31^k<<1,u[t+1]=k>>>31^d<<1}var f=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),c=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map((function(e){return 2*e}))),u=new Uint32Array(32),h=new Uint32Array(32);function l(e,t){var n=0;for(n=0;n<16;n++)u[n]=e.h[n],u[n+16]=f[n];for(u[24]=u[24]^e.t,u[25]=u[25]^e.t/4294967296,t&&(u[28]=~u[28],u[29]=~u[29]),n=0;n<32;n++)h[n]=s(e.b,4*n);for(n=0;n<12;n++)a(0,8,16,24,c[16*n+0],c[16*n+1]),a(2,10,18,26,c[16*n+2],c[16*n+3]),a(4,12,20,28,c[16*n+4],c[16*n+5]),a(6,14,22,30,c[16*n+6],c[16*n+7]),a(0,10,20,30,c[16*n+8],c[16*n+9]),a(2,12,22,24,c[16*n+10],c[16*n+11]),a(4,14,16,26,c[16*n+12],c[16*n+13]),a(6,8,18,28,c[16*n+14],c[16*n+15]);for(n=0;n<16;n++)e.h[n]=e.h[n]^u[n]^u[n+16]}function b(e,t){if(0===e||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");for(var n={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e},r=0;r<16;r++)n.h[r]=f[r];var i=t?t.length:0;return n.h[0]^=16842752^i<<8^e,t&&(k(n,t),n.c=128),n}function k(e,t){for(var n=0;n>2]>>8*(3&n);return t}function p(e,t,n){n=n||64,e=r.normalizeInput(e);var i=b(n,t);return k(i,e),d(i)}e.exports={blake2b:p,blake2bHex:function(e,t,n){var i=p(e,t,n);return r.toHex(i)},blake2bInit:b,blake2bUpdate:k,blake2bFinal:d}},function(e,t,n){var r=n(25);function i(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function o(e,t,n,r,i,o){c[e]=c[e]+c[t]+i,c[r]=s(c[r]^c[e],16),c[n]=c[n]+c[r],c[t]=s(c[t]^c[n],12),c[e]=c[e]+c[t]+o,c[r]=s(c[r]^c[e],8),c[n]=c[n]+c[r],c[t]=s(c[t]^c[n],7)}function s(e,t){return e>>>t^e<<32-t}var a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),f=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),c=new Uint32Array(16),u=new Uint32Array(16);function h(e,t){var n=0;for(n=0;n<8;n++)c[n]=e.h[n],c[n+8]=a[n];for(c[12]^=e.t,c[13]^=e.t/4294967296,t&&(c[14]=~c[14]),n=0;n<16;n++)u[n]=i(e.b,4*n);for(n=0;n<10;n++)o(0,4,8,12,u[f[16*n+0]],u[f[16*n+1]]),o(1,5,9,13,u[f[16*n+2]],u[f[16*n+3]]),o(2,6,10,14,u[f[16*n+4]],u[f[16*n+5]]),o(3,7,11,15,u[f[16*n+6]],u[f[16*n+7]]),o(0,5,10,15,u[f[16*n+8]],u[f[16*n+9]]),o(1,6,11,12,u[f[16*n+10]],u[f[16*n+11]]),o(2,7,8,13,u[f[16*n+12]],u[f[16*n+13]]),o(3,4,9,14,u[f[16*n+14]],u[f[16*n+15]]);for(n=0;n<8;n++)e.h[n]^=c[n]^c[n+8]}function l(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");var n=t?t.length:0;if(t&&!(n>0&&n<=32))throw new Error("Incorrect key length, should be in [1, 32]");var r={h:new Uint32Array(a),b:new Uint32Array(64),c:0,t:0,outlen:e};return r.h[0]^=16842752^n<<8^e,n>0&&(b(r,t),r.c=64),r}function b(e,t){for(var n=0;n>2]>>8*(3&n)&255;return t}function d(e,t,n){n=n||32,e=r.normalizeInput(e);var i=l(n,t);return b(i,e),k(i)}e.exports={blake2s:d,blake2sHex:function(e,t,n){var i=d(e,t,n);return r.toHex(i)},blake2sInit:l,blake2sUpdate:b,blake2sFinal:k}},function(e,t,n){"use strict";const r=n(9),i=r.cloneLinks,o=r.cloneData,s=n(7);e.exports=function(e){const t=o(e),n=i(e);return s(t,n)}},function(e,t,n){"use strict";const r=n(9),i=r.cloneLinks,o=r.cloneData,s=r.toDAGLink,a=n(3),f=n(6),c=n(7);e.exports=async(e,t)=>{const n=i(e),r=o(e),u=await(async e=>a.isDAGLink(e)?e:f.isDAGNode(e)?s(e,{}):new a(e.Name||e.name,e.Tsize||e.size,e.Hash||e.multihash||e.hash||e.cid))(t);return n.push(u),c(r,n)}},function(e,t,n){"use strict";(function(t){const r=n(9),i=r.cloneLinks,o=r.cloneData,s=n(7),a=n(4);e.exports=(e,n)=>{const r=o(e);let f=i(e);if("string"==typeof n)f=f.filter(e=>e.Name!==n);else{if(!t.isBuffer(n)&&!a.isCID(n))throw new Error("second arg needs to be a name or CID");f=f.filter(e=>!e.Hash.equals(n))}return s(r,f)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(e){const r=n(4),i=n(8);t.resolve=(e,t)=>{let n=i.deserialize(e);const o=t.split("/").filter(Boolean);for(;o.length;){const e=o.shift();if(void 0===n[e])throw new Error(`Object has no property '${e}'`);if(n=n[e],r.isCID(n))return{value:n,remainderPath:o.join("/")}}return{value:n,remainderPath:""}};const o=function*(t,n){if(!e.isBuffer(t)&&!r.isCID(t)&&"string"!=typeof t&&null!==t)for(const e of Object.keys(t)){const r=void 0===n?e:n+"/"+e;yield r,yield*o(t[e],r)}};t.tree=function*(e){const t=i.deserialize(e);yield*o(t)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(91),i=n(2).isFunction,o=n(2).isBoolean,s=n(2).isObject,a=n(2).isArray,f=n(2).isRegex,c=n(2).assign,u=n(2).keys;e.exports=function(e,t){t=t||c({},r),i(t)&&(t={compare:t});const n=t.space||r.space,h=o(t.cycles)?t.cycles:r.cycles,l=t.replacer||r.replacer,b=t.stringify||r.stringify,k=t.compare&&(d=t.compare,function(e){return function(t,n){const r={key:t,value:e[t]},i={key:n,value:e[n]};return d(r,i)}});var d;h||b(e);const p=[];return function e(t,r,i,o){const c=n?"\n"+new Array(o+1).join(n):"",d=n?": ":":";if(i=function(e){return null==e?e:f(e)?e.toString():e.toJSON?e.toJSON():e}(i),void 0!==(i=l.call(t,r,i))){if(!s(i)||null===i)return b(i);if(a(i)){const t=[];for(let r=0;rt,stringify:JSON.stringify}},function(e,t,n){"use strict";const r=n(11),i=n(93),o=(n(5),n(26)),{LastWriteWins:s,NoZeroes:a}=o,f=n(27),{isDefined:c,findUniques:u,difference:h,io:l}=n(12),b=["heads"],k=(e,t)=>e.slice(e.length-Math.min(e.length,t),e.length);e.exports=class{static async toMultihash(e,t,{format:n}={}){if(!c(e))throw f.IPFSNotDefinedError();if(!c(t))throw f.LogNotDefinedError();if(c(n)||(n="dag-cbor"),t.values.length<1)throw new Error("Can't serialize an empty log");return l.write(e,n,t.toJSON(),{links:b})}static async fromMultihash(e,t,{length:n=-1,exclude:r=[],concurrency:o,sortFn:u,onProgressCallback:h}){if(!c(e))throw f.IPFSNotDefinedError();if(!c(t))throw new Error(`Invalid hash: ${t}`);const d=await l.read(e,t,{links:b});if(!d.heads||!d.id)throw f.NotALogError();u=u||a(s);const p=await i.fetchAll(e,d.heads,{length:n,exclude:r,concurrency:o,onProgressCallback:h}),m=d.id,g=n>-1?k(p.sort(u),n):p,S=g.filter(e=>d.heads.includes(e.hash));return{logId:m,entries:g,heads:S}}static async fromEntryHash(e,t,{length:n=-1,exclude:r=[],concurrency:o,onProgressCallback:s}){if(!c(e))throw f.IpfsNotDefinedError();if(!c(t))throw new Error("'hash' must be defined");const a=Array.isArray(t)?t:[t];n=n>-1?Math.max(n,1):n;const u=await i.fetchParallel(e,a,{length:n,exclude:r,concurrency:o,onProgressCallback:s});return{entries:n>-1?k(u,n):u}}static async fromJSON(e,t,{length:n=-1,concurrency:o,onProgressCallback:s}){if(!c(e))throw f.IPFSNotDefinedError();const{id:a,heads:u}=t,h=u.map(e=>e.hash);return{logId:a,entries:(await i.fetchParallel(e,h,{length:n,concurrency:o,onProgressCallback:s})).sort(r.compare),heads:u}}static async fromEntry(e,t,{length:n=-1,exclude:o=[],concurrency:s,onProgressCallback:a}){if(!c(e))throw f.IPFSNotDefinedError();if(!c(t))throw new Error("'sourceEntries' must be defined");if(!Array.isArray(t)&&!r.isEntry(t))throw new Error("'sourceEntries' argument must be an array of Entry instances or a single Entry");Array.isArray(t)||(t=[t]),n=n>-1?Math.max(n,t.length):n;const l=t.map(e=>e.hash),b=await i.fetchParallel(e,l,{length:n,exclude:o,concurrency:s,onProgressCallback:a}),k=t.concat(b).concat(o),d=u(k,"hash").sort(r.compare),p=d.slice(n>-1?-n:-d.length),m=((e,t)=>{var n=e.slice(t.length,e.length);return t.concat(n)})(p,h(p,t,"hash"));return{logId:m[m.length-1].id,entries:m}}}},function(e,t,n){"use strict";const r=n(17),i=n(94),o=n(11),s=e=>e&&e.length>0;class a{static async fetchParallel(e,t,{length:n,exclude:i=[],concurrency:o,onProgressCallback:s}){o=Math.max(o||t.length,1);const f=(e,t)=>e.concat(t);return(e=>e.reduce(f,[]))(await r(t,async t=>a.fetchAll(e,t,{length:n,exclude:i,onProgressCallback:s,concurrency:o}),{concurrency:o}))}static async fetchAll(e,t,{length:n=-1,exclude:a=[],onProgressCallback:f,onStartProgressCallback:c,concurrency:u=32,delay:h=0}={}){let l=[],b={},k={},d=Array.isArray(t)?{0:t.slice()}:{0:[t]},p=0,m=0,g=0;const S=(e,t)=>{k[e]||(d[t]||(d[t]=[]),d[t].includes(e)||d[t].push(e),k[e]=!0)},y=async t=>{if(!t||b[t])return;c&&c(t,null,l.length,l,d);const r=await o.fromMultihash(e,t);if((e=>{if(o.isEntry(e)){const r=e.clock.time;m=Math.max(m,r),g=l.length>0?Math.min(l[l.length-1].clock.time,g):m;const i=l.length>=n&&r>=g,o=e=>m-r+(e+1)*e;(n<0||l.length=g)&&e.next.forEach(e=>S(e,o(0))),l.length+e.refs.length<=n&&e.refs.forEach((e,t)=>S(e,o(t))))}})(r),f&&f(t,r,l.length,l,d),h>0){const e=(e=0)=>new Promise(t=>setTimeout(t,e));await e(h)}};return a.forEach(e=>{b[e.hash]=!0}),await i(async()=>{if(p{return Object.keys(d).reduce((t,n,r)=>{const i=d[n];for(;i.length>0&&t.lengthvoid 0!==Object.values(d).find(s)),l}}e.exports=a},function(e,t,n){"use strict";const r=async(e,t)=>{if(t(await e()))return r(e,t)};e.exports=r,e.exports.default=r},function(e,t,n){"use strict";e.exports=class{async canAppend(e,t){return!0}}},function(e,t,n){"use strict";e.exports=class{constructor(e={}){this._cache=e}set(e,t){this._cache[e]=t}get(e){return this._cache[e]}delete(e){return delete this._cache[e]}add(e){this._cache=Object.assign(this._cache,e)}get length(){return Object.values(this._cache).length}}}]); //# sourceMappingURL=ipfslog.min.js.map \ No newline at end of file diff --git a/examples/browser/loader-visualization.html b/examples/browser/loader-visualization.html index 3a5dcb7d..89f543eb 100644 --- a/examples/browser/loader-visualization.html +++ b/examples/browser/loader-visualization.html @@ -67,19 +67,19 @@

ipfs-log

-

loading simulation

+

loading visualization

https://github.com/orbitdb/ipfs-log
+ -

     

     
-    
+    
 
     
   
diff --git a/lib/es5/entry-io.js b/lib/es5/entry-io.js
index cd5e520d..3c3f535e 100644
--- a/lib/es5/entry-io.js
+++ b/lib/es5/entry-io.js
@@ -10,12 +10,16 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
 
 var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
 
-var pWhilst = require('p-whilst');
-
 var pMap = require('p-map');
 
+var pDoWhilst = require('p-do-whilst');
+
 var Entry = require('./entry');
 
+var hasItems = function hasItems(arr) {
+  return arr && arr.length > 0;
+};
+
 var EntryIO =
 /*#__PURE__*/
 function () {
@@ -25,107 +29,91 @@ function () {
 
   (0, _createClass2.default)(EntryIO, null, [{
     key: "fetchParallel",
-
-    /**
-     * Fetch log entries in parallel.
-     * @param {IPFS} ipfs An IPFS instance
-     * @param {string|Array} hashes hashes of the entries to fetch
-     * @param {Object} options
-     * @param {number} options.length How many entries to fetch
-     * @param {Array} options.exclude Entries to not fetch
-     * @param {number} options.concurrency Max concurrent fetch operations
-     * @param {number} options.timeout Maximum time to wait for each fetch operation, in ms
-     * @param {function(hash, entry, parent, depth)} options.onProgressCallback
-     * @returns {Promise>}
-     */
+    // Fetch log graphs in parallel
     value: function () {
       var _fetchParallel = (0, _asyncToGenerator2.default)(
       /*#__PURE__*/
-      _regenerator.default.mark(function _callee(ipfs, hashes) {
-        var _ref,
-            _ref$length,
-            length,
-            _ref$exclude,
-            exclude,
-            _ref$concurrency,
-            concurrency,
-            timeout,
-            onProgressCallback,
-            fetchOne,
-            getHashes,
-            uniquelyConcatArrays,
-            flatten,
-            hashesToFetch,
-            entries,
-            _args = arguments;
-
-        return _regenerator.default.wrap(function _callee$(_context) {
+      _regenerator.default.mark(function _callee2(ipfs, hashes, _ref) {
+        var length, _ref$exclude, exclude, concurrency, onProgressCallback, fetchOne, concatArrays, flatten, res;
+
+        return _regenerator.default.wrap(function _callee2$(_context2) {
           while (1) {
-            switch (_context.prev = _context.next) {
+            switch (_context2.prev = _context2.next) {
               case 0:
-                _ref = _args.length > 2 && _args[2] !== undefined ? _args[2] : {}, _ref$length = _ref.length, length = _ref$length === void 0 ? -1 : _ref$length, _ref$exclude = _ref.exclude, exclude = _ref$exclude === void 0 ? [] : _ref$exclude, _ref$concurrency = _ref.concurrency, concurrency = _ref$concurrency === void 0 ? null : _ref$concurrency, timeout = _ref.timeout, onProgressCallback = _ref.onProgressCallback;
-
-                fetchOne = function fetchOne(hash) {
-                  return EntryIO.fetchAll(ipfs, hash, {
-                    length: length,
-                    exclude: exclude,
-                    timeout: timeout,
-                    onProgressCallback: onProgressCallback
-                  });
-                };
+                length = _ref.length, _ref$exclude = _ref.exclude, exclude = _ref$exclude === void 0 ? [] : _ref$exclude, concurrency = _ref.concurrency, onProgressCallback = _ref.onProgressCallback;
+                concurrency = Math.max(concurrency || hashes.length, 1);
 
-                getHashes = function getHashes(e) {
-                  return e.hash;
-                };
+                fetchOne =
+                /*#__PURE__*/
+                function () {
+                  var _ref2 = (0, _asyncToGenerator2.default)(
+                  /*#__PURE__*/
+                  _regenerator.default.mark(function _callee(hash) {
+                    return _regenerator.default.wrap(function _callee$(_context) {
+                      while (1) {
+                        switch (_context.prev = _context.next) {
+                          case 0:
+                            return _context.abrupt("return", EntryIO.fetchAll(ipfs, hash, {
+                              length: length,
+                              exclude: exclude,
+                              onProgressCallback: onProgressCallback,
+                              concurrency: concurrency
+                            }));
+
+                          case 1:
+                          case "end":
+                            return _context.stop();
+                        }
+                      }
+                    }, _callee);
+                  }));
+
+                  return function fetchOne(_x4) {
+                    return _ref2.apply(this, arguments);
+                  };
+                }();
 
-                uniquelyConcatArrays = function uniquelyConcatArrays(arr1, arr2) {
-                  // Add any new entries to arr1
-                  var entryHashes = arr1.map(getHashes);
-                  arr2.forEach(function (entry) {
-                    if (entryHashes.indexOf(entry.hash) === -1) arr1.push(entry);
-                  });
-                  return arr1;
+                concatArrays = function concatArrays(arr1, arr2) {
+                  return arr1.concat(arr2);
                 };
 
                 flatten = function flatten(arr) {
-                  return arr.reduce(uniquelyConcatArrays, []);
+                  return arr.reduce(concatArrays, []);
                 };
 
-                hashesToFetch = Array.isArray(hashes) ? hashes.slice() : [hashes];
-                concurrency = Math.max(concurrency || hashesToFetch.length, 1);
-                _context.next = 9;
-                return pMap(hashesToFetch, fetchOne, {
+                _context2.next = 7;
+                return pMap(hashes, fetchOne, {
                   concurrency: concurrency
                 });
 
-              case 9:
-                entries = _context.sent;
-                return _context.abrupt("return", flatten(entries));
+              case 7:
+                res = _context2.sent;
+                return _context2.abrupt("return", flatten(res));
 
-              case 11:
+              case 9:
               case "end":
-                return _context.stop();
+                return _context2.stop();
             }
           }
-        }, _callee);
+        }, _callee2);
       }));
 
-      function fetchParallel(_x, _x2) {
+      function fetchParallel(_x, _x2, _x3) {
         return _fetchParallel.apply(this, arguments);
       }
 
       return fetchParallel;
     }()
     /**
-     * Fetch log entries sequentially.
-     * @param {IPFS} ipfs An IPFS instance
-     * @param {string|Array} hashes hashes of the entries to fetch
-     * @param {Object} options
-     * @param {number} options.length How many entries to fetch
-     * @param {Array} options.exclude Entries to not fetch
-     * @param {number} options.concurrency Max concurrent fetch operations
-     * @param {number} options.timeout Maximum time to wait for each fetch operation, in ms
-     * @param {function(hash, entry, parent, depth)} options.onProgressCallback
+     * Fetch log entries
+     *
+     * @param {IPFS} [ipfs] An IPFS instance
+     * @param {string} [hash] Multihash of the entry to fetch
+     * @param {string} [parent] Parent of the node to be fetched
+     * @param {Object} [all] Entries to skip
+     * @param {Number} [amount=-1] How many entries to fetch
+     * @param {Number} [depth=0] Current depth of the recursion
+     * @param {function(hash, entry, parent, depth)} onProgressCallback
      * @returns {Promise>}
      */
 
@@ -134,147 +122,266 @@ function () {
     value: function () {
       var _fetchAll = (0, _asyncToGenerator2.default)(
       /*#__PURE__*/
-      _regenerator.default.mark(function _callee3(ipfs, hashes) {
-        var _ref2,
-            _ref2$length,
+      _regenerator.default.mark(function _callee5(ipfs, hashes) {
+        var _ref3,
+            _ref3$length,
             length,
-            _ref2$exclude,
+            _ref3$exclude,
             exclude,
-            _ref2$timeout,
-            timeout,
             onProgressCallback,
-            _ref2$concurrency,
+            onStartProgressCallback,
+            _ref3$concurrency,
             concurrency,
+            _ref3$delay,
+            delay,
             result,
             cache,
+            loadingCache,
             loadingQueue,
+            running,
+            maxClock,
+            minClock,
+            loadingQueueHasMore,
             addToLoadingQueue,
-            shouldFetchMore,
+            getNextFromQueue,
             addToExcludeCache,
             fetchEntry,
-            _args3 = arguments;
+            _processQueue,
+            _args5 = arguments;
 
-        return _regenerator.default.wrap(function _callee3$(_context3) {
+        return _regenerator.default.wrap(function _callee5$(_context5) {
           while (1) {
-            switch (_context3.prev = _context3.next) {
+            switch (_context5.prev = _context5.next) {
               case 0:
-                _ref2 = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {}, _ref2$length = _ref2.length, length = _ref2$length === void 0 ? -1 : _ref2$length, _ref2$exclude = _ref2.exclude, exclude = _ref2$exclude === void 0 ? [] : _ref2$exclude, _ref2$timeout = _ref2.timeout, timeout = _ref2$timeout === void 0 ? null : _ref2$timeout, onProgressCallback = _ref2.onProgressCallback, _ref2$concurrency = _ref2.concurrency, concurrency = _ref2$concurrency === void 0 ? 32 : _ref2$concurrency;
+                _ref3 = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : {}, _ref3$length = _ref3.length, length = _ref3$length === void 0 ? -1 : _ref3$length, _ref3$exclude = _ref3.exclude, exclude = _ref3$exclude === void 0 ? [] : _ref3$exclude, onProgressCallback = _ref3.onProgressCallback, onStartProgressCallback = _ref3.onStartProgressCallback, _ref3$concurrency = _ref3.concurrency, concurrency = _ref3$concurrency === void 0 ? 32 : _ref3$concurrency, _ref3$delay = _ref3.delay, delay = _ref3$delay === void 0 ? 0 : _ref3$delay;
                 result = [];
                 cache = {};
-                loadingQueue = Array.isArray(hashes) ? hashes.slice() : [hashes]; // Add a hash to the loading queue
-
-                addToLoadingQueue = function addToLoadingQueue(e) {
-                  return loadingQueue.push(e);
+                loadingCache = {};
+                loadingQueue = Array.isArray(hashes) ? {
+                  0: hashes.slice()
+                } : {
+                  0: [hashes]
                 };
+                running = 0; // keep track of how many entries are being fetched at any time
 
-                shouldFetchMore = function shouldFetchMore() {
-                  return loadingQueue.length > 0 && (result.length < length || length < 0);
-                }; // Add entries that we don't need to fetch to the "cache"
+                maxClock = 0; // keep track of the latest clock time during load
 
+                minClock = 0; // keep track of the minimum clock time during load
+                // Does the loading queue have more to process?
 
-                exclude = exclude && Array.isArray(exclude) ? exclude : [];
+                loadingQueueHasMore = function loadingQueueHasMore() {
+                  return Object.values(loadingQueue).find(hasItems) !== undefined;
+                }; // Add a multihash to the loading queue
 
-                addToExcludeCache = function addToExcludeCache(e) {
-                  if (Entry.isEntry(e)) {
-                    result.push(e);
-                    cache[e.hash] = e;
-                  }
-                };
 
-                exclude.forEach(addToExcludeCache);
+                addToLoadingQueue = function addToLoadingQueue(e, idx) {
+                  if (!loadingCache[e]) {
+                    if (!loadingQueue[idx]) loadingQueue[idx] = [];
 
-                fetchEntry = function fetchEntry() {
-                  var hash = loadingQueue.shift();
+                    if (!loadingQueue[idx].includes(e)) {
+                      loadingQueue[idx].push(e);
+                    }
 
-                  if (!hash || cache[hash]) {
-                    return Promise.resolve();
+                    loadingCache[e] = true;
                   }
+                }; // Get the next items to process from the loading queue
+
+
+                getNextFromQueue = function getNextFromQueue() {
+                  var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
+
+                  var getNext = function getNext(res, key, idx) {
+                    var nextItems = loadingQueue[key];
+
+                    while (nextItems.length > 0 && res.length < length) {
+                      var hash = nextItems.shift();
+                      res.push(hash);
+                    }
+
+                    if (nextItems.length === 0) {
+                      delete loadingQueue[key];
+                    }
+
+                    return res;
+                  };
+
+                  return Object.keys(loadingQueue).reduce(getNext, []);
+                }; // Add entries that we don't need to fetch to the "cache"
+
 
-                  return new Promise(
+                addToExcludeCache = function addToExcludeCache(e) {
+                  cache[e.hash] = true;
+                }; // Fetch one entry and add it to the results
+
+
+                fetchEntry =
+                /*#__PURE__*/
+                function () {
+                  var _ref4 = (0, _asyncToGenerator2.default)(
                   /*#__PURE__*/
-                  function () {
-                    var _ref3 = (0, _asyncToGenerator2.default)(
-                    /*#__PURE__*/
-                    _regenerator.default.mark(function _callee2(resolve, reject) {
-                      var timer, addToResults, entry;
-                      return _regenerator.default.wrap(function _callee2$(_context2) {
-                        while (1) {
-                          switch (_context2.prev = _context2.next) {
-                            case 0:
-                              // Resolve the promise after a timeout (if given) in order to
-                              // not get stuck loading a block that is unreachable
-                              timer = timeout ? setTimeout(function () {
-                                console.warn("Warning: Couldn't fetch entry '".concat(hash, "', request timed out (").concat(timeout, "ms)"));
-                                resolve();
-                              }, timeout) : null;
-
-                              addToResults = function addToResults(entry) {
-                                if (Entry.isEntry(entry)) {
+                  _regenerator.default.mark(function _callee3(hash) {
+                    var addToResults, entry, sleep;
+                    return _regenerator.default.wrap(function _callee3$(_context3) {
+                      while (1) {
+                        switch (_context3.prev = _context3.next) {
+                          case 0:
+                            if (!(!hash || cache[hash])) {
+                              _context3.next = 2;
+                              break;
+                            }
+
+                            return _context3.abrupt("return");
+
+                          case 2:
+                            addToResults = function addToResults(entry) {
+                              if (Entry.isEntry(entry)) {
+                                var ts = entry.clock.time; // Update min/max clocks
+
+                                maxClock = Math.max(maxClock, ts);
+                                minClock = result.length > 0 ? Math.min(result[result.length - 1].clock.time, minClock) : maxClock;
+                                var isLater = result.length >= length && ts >= minClock;
+
+                                var calculateIndex = function calculateIndex(idx) {
+                                  return maxClock - ts + (idx + 1) * idx;
+                                }; // Add the entry to the results if 
+                                // 1) we're fetching all entries
+                                // 2) results is not filled yet
+                                // the clock of the entry is later than current known minimum clock time
+
+
+                                if (length < 0 || result.length < length || isLater) {
+                                  result.push(entry);
+                                  cache[hash] = true;
+                                }
+
+                                if (length < 0) {
+                                  // If we're fetching all entries (length === -1), adds nexts and refs to the queue
                                   entry.next.forEach(addToLoadingQueue);
                                   entry.refs.forEach(addToLoadingQueue);
-                                  result.push(entry);
-                                  cache[hash] = entry;
+                                } else {
+                                  // If we're fetching entries up to certain length,
+                                  // fetch the next if result is filled up, to make sure we "check"
+                                  // the next entry if its clock is later than what we have in the result
+                                  if (result.length <= length || ts >= minClock) {
+                                    entry.next.forEach(function (e) {
+                                      return addToLoadingQueue(e, calculateIndex(0));
+                                    });
+                                  }
 
-                                  if (onProgressCallback) {
-                                    onProgressCallback(hash, entry, result.length, result, loadingQueue);
+                                  if (result.length + entry.refs.length <= length) {
+                                    entry.refs.forEach(function (e, i) {
+                                      return addToLoadingQueue(e, calculateIndex(i));
+                                    });
                                   }
                                 }
-                              }; // // Load the entry
+                              }
+                            };
+
+                            if (onStartProgressCallback) {
+                              onStartProgressCallback(hash, null, result.length, result, loadingQueue);
+                            } // Load the entry
+
 
+                            _context3.next = 6;
+                            return Entry.fromMultihash(ipfs, hash);
 
-                              _context2.prev = 2;
-                              _context2.next = 5;
-                              return Entry.fromMultihash(ipfs, hash);
+                          case 6:
+                            entry = _context3.sent;
+                            // Add it to the results
+                            addToResults(entry);
 
-                            case 5:
-                              entry = _context2.sent;
-                              addToResults(entry);
-                              resolve();
-                              _context2.next = 13;
+                            if (onProgressCallback) {
+                              onProgressCallback(hash, entry, result.length, result, loadingQueue);
+                            } // Simulate network latency (for debugging purposes)
+
+
+                            if (!(delay > 0)) {
+                              _context3.next = 13;
                               break;
+                            }
 
-                            case 10:
-                              _context2.prev = 10;
-                              _context2.t0 = _context2["catch"](2);
-                              reject(_context2.t0);
+                            sleep = function sleep() {
+                              var ms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+                              return new Promise(function (resolve) {
+                                return setTimeout(resolve, ms);
+                              });
+                            };
 
-                            case 13:
-                              _context2.prev = 13;
-                              clearTimeout(timer);
-                              return _context2.finish(13);
+                            _context3.next = 13;
+                            return sleep(delay);
 
-                            case 16:
-                            case "end":
-                              return _context2.stop();
-                          }
+                          case 13:
+                            return _context3.abrupt("return");
+
+                          case 14:
+                          case "end":
+                            return _context3.stop();
                         }
-                      }, _callee2, null, [[2, 10, 13, 16]]);
-                    }));
+                      }
+                    }, _callee3);
+                  }));
 
-                    return function (_x5, _x6) {
-                      return _ref3.apply(this, arguments);
-                    };
-                  }());
-                };
+                  return function fetchEntry(_x7) {
+                    return _ref4.apply(this, arguments);
+                  };
+                }(); // One loop of processing the loading queue
 
-                _context3.next = 12;
-                return pWhilst(shouldFetchMore, fetchEntry);
 
-              case 12:
-                // Free memory to avoid minor GC
-                cache = {};
-                loadingQueue = [];
-                return _context3.abrupt("return", result);
+                _processQueue =
+                /*#__PURE__*/
+                function () {
+                  var _ref5 = (0, _asyncToGenerator2.default)(
+                  /*#__PURE__*/
+                  _regenerator.default.mark(function _callee4() {
+                    var nexts;
+                    return _regenerator.default.wrap(function _callee4$(_context4) {
+                      while (1) {
+                        switch (_context4.prev = _context4.next) {
+                          case 0:
+                            if (!(running < concurrency)) {
+                              _context4.next = 6;
+                              break;
+                            }
+
+                            nexts = getNextFromQueue(concurrency);
+                            running += nexts.length;
+                            _context4.next = 5;
+                            return pMap(nexts, fetchEntry);
+
+                          case 5:
+                            running -= nexts.length;
+
+                          case 6:
+                          case "end":
+                            return _context4.stop();
+                        }
+                      }
+                    }, _callee4);
+                  }));
+
+                  return function _processQueue() {
+                    return _ref5.apply(this, arguments);
+                  };
+                }(); // Add entries to exclude from processing to the cache before we start
+
+
+                exclude.forEach(addToExcludeCache); // Fetch entries
+
+                _context5.next = 17;
+                return pDoWhilst(_processQueue, loadingQueueHasMore);
+
+              case 17:
+                return _context5.abrupt("return", result);
 
-              case 15:
+              case 18:
               case "end":
-                return _context3.stop();
+                return _context5.stop();
             }
           }
-        }, _callee3);
+        }, _callee5);
       }));
 
-      function fetchAll(_x3, _x4) {
+      function fetchAll(_x5, _x6) {
         return _fetchAll.apply(this, arguments);
       }
 
diff --git a/lib/es5/lamport-clock.js b/lib/es5/lamport-clock.js
index f64116ed..c1015cfa 100644
--- a/lib/es5/lamport-clock.js
+++ b/lib/es5/lamport-clock.js
@@ -37,8 +37,8 @@ function () {
       // Calculate the "distance" based on the clock, ie. lower or greater
       var dist = a.time - b.time; // If the sequence number is the same (concurrent events),
       // and the IDs are different, take the one with a "lower" id
+      // if (dist === 0 && a.id !== b.id) return a.id < b.id ? -1 : 1
 
-      if (dist === 0 && a.id !== b.id) return a.id < b.id ? -1 : 1;
       return dist;
     }
   }]);
diff --git a/lib/es5/log-io.js b/lib/es5/log-io.js
index 5f093740..0b817abf 100644
--- a/lib/es5/log-io.js
+++ b/lib/es5/log-io.js
@@ -16,6 +16,11 @@ var EntryIO = require('./entry-io');
 
 var Clock = require('./lamport-clock');
 
+var Sorting = require('./log-sorting');
+
+var LastWriteWins = Sorting.LastWriteWins,
+    NoZeroes = Sorting.NoZeroes;
+
 var LogError = require('./log-errors');
 
 var _require = require('./utils'),
@@ -121,25 +126,14 @@ function () {
     value: function () {
       var _fromMultihash = (0, _asyncToGenerator2.default)(
       /*#__PURE__*/
-      _regenerator.default.mark(function _callee2(ipfs, hash) {
-        var _ref2,
-            _ref2$length,
-            length,
-            exclude,
-            onProgressCallback,
-            timeout,
-            logData,
-            entries,
-            clock,
-            finalEntries,
-            heads,
-            _args2 = arguments;
+      _regenerator.default.mark(function _callee2(ipfs, hash, _ref2) {
+        var _ref2$length, length, _ref2$exclude, exclude, concurrency, sortFn, onProgressCallback, logData, isHead, all, logId, entries, heads;
 
         return _regenerator.default.wrap(function _callee2$(_context2) {
           while (1) {
             switch (_context2.prev = _context2.next) {
               case 0:
-                _ref2 = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {}, _ref2$length = _ref2.length, length = _ref2$length === void 0 ? -1 : _ref2$length, exclude = _ref2.exclude, onProgressCallback = _ref2.onProgressCallback, timeout = _ref2.timeout;
+                _ref2$length = _ref2.length, length = _ref2$length === void 0 ? -1 : _ref2$length, _ref2$exclude = _ref2.exclude, exclude = _ref2$exclude === void 0 ? [] : _ref2$exclude, concurrency = _ref2.concurrency, sortFn = _ref2.sortFn, onProgressCallback = _ref2.onProgressCallback;
 
                 if (isDefined(ipfs)) {
                   _context2.next = 3;
@@ -173,36 +167,33 @@ function () {
                 throw LogError.NotALogError();
 
               case 10:
-                _context2.next = 12;
+                // Use user provided sorting function or the default one
+                sortFn = sortFn || NoZeroes(LastWriteWins);
+
+                isHead = function isHead(e) {
+                  return logData.heads.includes(e.hash);
+                };
+
+                _context2.next = 14;
                 return EntryIO.fetchAll(ipfs, logData.heads, {
                   length: length,
                   exclude: exclude,
-                  onProgressCallback: onProgressCallback,
-                  timeout: timeout
+                  concurrency: concurrency,
+                  onProgressCallback: onProgressCallback
                 });
 
-              case 12:
-                entries = _context2.sent;
-                // Find latest clock
-                clock = entries.reduce(function (clock, entry) {
-                  if (entry.clock.time > clock.time) {
-                    return new Clock(entry.clock.id, entry.clock.time);
-                  }
-
-                  return clock;
-                }, new Clock(logData.id));
-                finalEntries = entries.slice().sort(Entry.compare);
-                heads = finalEntries.filter(function (e) {
-                  return logData.heads.includes(e.hash);
-                });
+              case 14:
+                all = _context2.sent;
+                logId = logData.id;
+                entries = length > -1 ? last(all.sort(sortFn), length) : all;
+                heads = entries.filter(isHead);
                 return _context2.abrupt("return", {
-                  id: logData.id,
-                  values: finalEntries,
-                  heads: heads,
-                  clock: clock
+                  logId: logId,
+                  entries: entries,
+                  heads: heads
                 });
 
-              case 17:
+              case 19:
               case "end":
                 return _context2.stop();
             }
@@ -210,7 +201,7 @@ function () {
         }, _callee2);
       }));
 
-      function fromMultihash(_x3, _x4) {
+      function fromMultihash(_x3, _x4, _x5) {
         return _fromMultihash.apply(this, arguments);
       }
 
@@ -224,7 +215,6 @@ function () {
      * @param {number} options.length How many items to include in the log
      * @param {Array} options.exclude Entries to not fetch (cached)
      * @param {function(hash, entry, parent, depth)} options.onProgressCallback
-     * @param {number} options.timeout Timeout for fetching a log entry from IPFS
      */
 
   }, {
@@ -233,13 +223,13 @@ function () {
       var _fromEntryHash = (0, _asyncToGenerator2.default)(
       /*#__PURE__*/
       _regenerator.default.mark(function _callee3(ipfs, hash, _ref3) {
-        var _ref3$length, length, exclude, onProgressCallback, timeout, hashes, entries, sliced;
+        var _ref3$length, length, _ref3$exclude, exclude, concurrency, onProgressCallback, hashes, all, entries;
 
         return _regenerator.default.wrap(function _callee3$(_context3) {
           while (1) {
             switch (_context3.prev = _context3.next) {
               case 0:
-                _ref3$length = _ref3.length, length = _ref3$length === void 0 ? -1 : _ref3$length, exclude = _ref3.exclude, onProgressCallback = _ref3.onProgressCallback, timeout = _ref3.timeout;
+                _ref3$length = _ref3.length, length = _ref3$length === void 0 ? -1 : _ref3$length, _ref3$exclude = _ref3.exclude, exclude = _ref3$exclude === void 0 ? [] : _ref3$exclude, concurrency = _ref3.concurrency, onProgressCallback = _ref3.onProgressCallback;
 
                 if (isDefined(ipfs)) {
                   _context3.next = 3;
@@ -265,17 +255,17 @@ function () {
                 return EntryIO.fetchParallel(ipfs, hashes, {
                   length: length,
                   exclude: exclude,
-                  onProgressCallback: onProgressCallback,
-                  timeout: timeout
+                  concurrency: concurrency,
+                  onProgressCallback: onProgressCallback
                 });
 
               case 9:
-                entries = _context3.sent;
+                all = _context3.sent;
                 // Cap the result at the right size by taking the last n entries,
                 // or if given length is -1, then take all
-                sliced = length > -1 ? last(entries, length) : entries;
+                entries = length > -1 ? last(all, length) : all;
                 return _context3.abrupt("return", {
-                  values: sliced
+                  entries: entries
                 });
 
               case 12:
@@ -286,7 +276,7 @@ function () {
         }, _callee3);
       }));
 
-      function fromEntryHash(_x5, _x6, _x7) {
+      function fromEntryHash(_x6, _x7, _x8) {
         return _fromEntryHash.apply(this, arguments);
       }
 
@@ -299,7 +289,6 @@ function () {
      * @param {json} json A json object containing valid log data
      * @param {Object} options
      * @param {number} options.length How many entries to include
-     * @param {number} options.timeout Maximum time to wait for each fetch operation, in ms
      * @param {function(hash, entry, parent, depth)} options.onProgressCallback
      **/
 
@@ -309,13 +298,13 @@ function () {
       var _fromJSON = (0, _asyncToGenerator2.default)(
       /*#__PURE__*/
       _regenerator.default.mark(function _callee4(ipfs, json, _ref4) {
-        var _ref4$length, length, timeout, onProgressCallback, headHashes, entries, finalEntries;
+        var _ref4$length, length, concurrency, onProgressCallback, id, heads, headHashes, all, entries;
 
         return _regenerator.default.wrap(function _callee4$(_context4) {
           while (1) {
             switch (_context4.prev = _context4.next) {
               case 0:
-                _ref4$length = _ref4.length, length = _ref4$length === void 0 ? -1 : _ref4$length, timeout = _ref4.timeout, onProgressCallback = _ref4.onProgressCallback;
+                _ref4$length = _ref4.length, length = _ref4$length === void 0 ? -1 : _ref4$length, concurrency = _ref4.concurrency, onProgressCallback = _ref4.onProgressCallback;
 
                 if (isDefined(ipfs)) {
                   _context4.next = 3;
@@ -325,28 +314,27 @@ function () {
                 throw LogError.IPFSNotDefinedError();
 
               case 3:
-                headHashes = json.heads.map(function (e) {
+                id = json.id, heads = json.heads;
+                headHashes = heads.map(function (e) {
                   return e.hash;
                 });
-                _context4.next = 6;
+                _context4.next = 7;
                 return EntryIO.fetchParallel(ipfs, headHashes, {
                   length: length,
-                  exclude: [],
-                  concurrency: 16,
-                  timeout: timeout,
+                  concurrency: concurrency,
                   onProgressCallback: onProgressCallback
                 });
 
-              case 6:
-                entries = _context4.sent;
-                finalEntries = entries.slice().sort(Entry.compare);
+              case 7:
+                all = _context4.sent;
+                entries = all.sort(Entry.compare);
                 return _context4.abrupt("return", {
-                  id: json.id,
-                  values: finalEntries,
-                  heads: json.heads
+                  logId: id,
+                  entries: entries,
+                  heads: heads
                 });
 
-              case 9:
+              case 10:
               case "end":
                 return _context4.stop();
             }
@@ -354,7 +342,7 @@ function () {
         }, _callee4);
       }));
 
-      function fromJSON(_x8, _x9, _x10) {
+      function fromJSON(_x9, _x10, _x11) {
         return _fromJSON.apply(this, arguments);
       }
 
@@ -376,13 +364,13 @@ function () {
       var _fromEntry = (0, _asyncToGenerator2.default)(
       /*#__PURE__*/
       _regenerator.default.mark(function _callee5(ipfs, sourceEntries, _ref5) {
-        var _ref5$length, length, exclude, onProgressCallback, timeout, hashes, entries, combined, uniques, sliced, missingSourceEntries, replaceInFront, result;
+        var _ref5$length, length, _ref5$exclude, exclude, concurrency, onProgressCallback, hashes, all, combined, uniques, sliced, missingSourceEntries, replaceInFront, entries, logId;
 
         return _regenerator.default.wrap(function _callee5$(_context5) {
           while (1) {
             switch (_context5.prev = _context5.next) {
               case 0:
-                _ref5$length = _ref5.length, length = _ref5$length === void 0 ? -1 : _ref5$length, exclude = _ref5.exclude, onProgressCallback = _ref5.onProgressCallback, timeout = _ref5.timeout;
+                _ref5$length = _ref5.length, length = _ref5$length === void 0 ? -1 : _ref5$length, _ref5$exclude = _ref5.exclude, exclude = _ref5$exclude === void 0 ? [] : _ref5$exclude, concurrency = _ref5.concurrency, onProgressCallback = _ref5.onProgressCallback;
 
                 if (isDefined(ipfs)) {
                   _context5.next = 3;
@@ -423,14 +411,14 @@ function () {
                 return EntryIO.fetchParallel(ipfs, hashes, {
                   length: length,
                   exclude: exclude,
-                  onProgressCallback: onProgressCallback,
-                  timeout: timeout
+                  concurrency: concurrency,
+                  onProgressCallback: onProgressCallback
                 });
 
               case 12:
-                entries = _context5.sent;
+                all = _context5.sent;
                 // Combine the fetches with the source entries and take only uniques
-                combined = sourceEntries.concat(entries);
+                combined = sourceEntries.concat(all).concat(exclude);
                 uniques = findUniques(combined, 'hash').sort(Entry.compare); // Cap the result at the right size by taking the last n entries
 
                 sliced = uniques.slice(length > -1 ? -length : -uniques.length); // Make sure that the given input entries are present in the result
@@ -445,13 +433,14 @@ function () {
                 // as many elements from the array before inserting the original entries
 
 
-                result = replaceInFront(sliced, missingSourceEntries);
+                entries = replaceInFront(sliced, missingSourceEntries);
+                logId = entries[entries.length - 1].id;
                 return _context5.abrupt("return", {
-                  id: result[result.length - 1].id,
-                  values: result
+                  logId: logId,
+                  entries: entries
                 });
 
-              case 20:
+              case 21:
               case "end":
                 return _context5.stop();
             }
@@ -459,7 +448,7 @@ function () {
         }, _callee5);
       }));
 
-      function fromEntry(_x11, _x12, _x13) {
+      function fromEntry(_x12, _x13, _x14) {
         return _fromEntry.apply(this, arguments);
       }
 
diff --git a/lib/es5/log.js b/lib/es5/log.js
index e946b850..33607658 100644
--- a/lib/es5/log.js
+++ b/lib/es5/log.js
@@ -18,7 +18,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
 
 var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
 
-var pEachSeries = require('p-each-series');
+var pMap = require('p-map');
 
 var GSet = require('./g-set');
 
@@ -143,8 +143,9 @@ function (_GSet) {
 
     _this._identity = identity; // Add entries to the internal cache
 
-    entries = entries || [];
-    _this._entryIndex = new EntryIndex(entries.reduce(uniqueEntriesReducer, {})); // Set heads if not passed as an argument
+    var uniqueEntries = (entries || []).reduce(uniqueEntriesReducer, {});
+    _this._entryIndex = new EntryIndex(uniqueEntries);
+    entries = Object.values(uniqueEntries) || []; // Set heads if not passed as an argument
 
     heads = heads || Log.findHeads(entries);
     _this._headsIndex = heads.reduce(uniqueEntriesReducer, {}); // Index of all next pointers in this log
@@ -209,73 +210,10 @@ function (_GSet) {
     value: function has(entry) {
       return this._entryIndex.get(entry.hash || entry) !== undefined;
     }
-  }, {
-    key: "getNextAndTraverse",
-    value: function getNextAndTraverse(rootEntries, amount) {
-      var _this2 = this;
-
-      var getFirstNextPointer = function getFirstNextPointer(entry) {
-        return entry.refs[0];
-      };
-
-      var stack = rootEntries.map(getFirstNextPointer).map(function (e) {
-        return _this2.get(e);
-      }).filter(isDefined); // Cache for checking if we've processed an entry already
-
-      var traversed = {}; // End result
-
-      var result = {}; // We keep a counter to check if we have traversed requested amount of entries
-
-      var count = 0; // Named function for getting an entry from the log
-
-      var getEntry = function getEntry(e) {
-        return _this2.get(e);
-      }; // Add an entry to the stack and traversed nodes index
-
-
-      var addToStack = function addToStack(entry) {
-        // If we've already processed the entry, don't add it to the stack
-        if (!entry || traversed[entry.hash]) {
-          return;
-        } // Add the entry in front of the stack and sort
-
-
-        stack = [entry].concat((0, _toConsumableArray2.default)(stack)).sort(_this2._sortFn).reverse(); // Add to the cache of processed entries
-
-        traversed[entry.hash] = true;
-      };
-
-      var addEntry = function addEntry(rootEntry) {
-        result[rootEntry.hash] = rootEntry;
-        traversed[rootEntry.hash] = true;
-        count++;
-      };
-
-      rootEntries.forEach(addEntry); // Start traversal
-      // Process stack until it's empty (traversed the full log)
-      // or when we have the requested amount of entries
-      // If requested entry amount is -1, traverse all
-
-      while (stack.length > 0 && (count < amount || amount < 0)) {
-        // eslint-disable-line no-unmodified-loop-condition
-        // Get the next element from the stack
-        var entry = stack.shift(); // Add to the result
-        // result[entry.hash] = entry
-
-        addEntry(entry); // if ((amount !== -1) && (++count >= amount)) break
-        // Add entry's next references to the stack
-
-        var entries = entry.next.map(getEntry);
-        var defined = entries.filter(isDefined);
-        defined.forEach(addToStack);
-      }
-
-      return result;
-    }
   }, {
     key: "traverse",
     value: function traverse(rootEntries) {
-      var _this3 = this;
+      var _this2 = this;
 
       var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
       var endHash = arguments.length > 2 ? arguments[2] : undefined;
@@ -288,7 +226,7 @@ function (_GSet) {
       var count = 0; // Named function for getting an entry from the log
 
       var getEntry = function getEntry(e) {
-        return _this3.get(e);
+        return _this2.get(e);
       }; // Add an entry to the stack and traversed nodes index
 
 
@@ -299,7 +237,7 @@ function (_GSet) {
         } // Add the entry in front of the stack and sort
 
 
-        stack = [entry].concat((0, _toConsumableArray2.default)(stack)).sort(_this3._sortFn).reverse(); // Add to the cache of processed entries
+        stack = [entry].concat((0, _toConsumableArray2.default)(stack)).sort(_this2._sortFn).reverse(); // Add to the cache of processed entries
 
         traversed[entry.hash] = true;
       };
@@ -345,18 +283,15 @@ function (_GSet) {
       var _append = (0, _asyncToGenerator2.default)(
       /*#__PURE__*/
       _regenerator.default.mark(function _callee(data) {
-        var _this4 = this;
+        var _this3 = this;
 
         var pointerCount,
             newTime,
-            heads,
-            sortedHeadIndex,
-            nexts,
             all,
             getEveryPow2,
             references,
-            refSet,
-            delRef,
+            nexts,
+            isNext,
             refs,
             entry,
             canAppend,
@@ -369,63 +304,62 @@ function (_GSet) {
                 // Update the clock (find the latest clock)
                 newTime = Math.max(this.clock.time, this.heads.reduce(maxClockTimeReducer, 0)) + 1;
                 this._clock = new Clock(this.clock.id, newTime);
-                heads = this.traverse(this.heads, this.heads.length);
-                sortedHeadIndex = this.heads.reverse().reduce(uniqueEntriesReducer, {});
-                nexts = Object.keys(Object.assign({}, sortedHeadIndex, heads));
-                all = Object.values(this.getNextAndTraverse(this.heads, pointerCount));
+                all = Object.values(this.traverse(this.heads, pointerCount)); // If pointer count is 4, returns 2
+                // If pointer count is 8, returns 3 references
+                // If pointer count is 512, returns 9 references
+                // If pointer count is 2048, returns 11 references
 
                 getEveryPow2 = function getEveryPow2(maxDistance) {
                   var entries = new Set();
 
                   for (var i = 1; i <= maxDistance; i *= 2) {
                     var index = Math.min(i - 1, all.length - 1);
-                    var ref = all[index];
-                    entries.add(ref);
+                    entries.add(all[index]);
                   }
 
                   return entries;
-                }; // If pointer count is 4, returns 2
-                // If pointer count is 8, returns 3 references
-                // If pointer count is 512, returns 9 references
-                // If pointer count is 2048, returns 11 references
+                };
 
+                references = getEveryPow2(Math.min(pointerCount, all.length)); // Always include the last known reference
 
-                references = getEveryPow2(Math.min(pointerCount, all.length));
-                refSet = new Set(references); // Always include the last known reference
+                if (all.length < pointerCount && all[all.length - 1]) {
+                  references.add(all[all.length - 1]);
+                } // Create the next pointers from heads
 
-                if (all.length < pointerCount && all[all.length - 1]) refSet.add(all[all.length - 1]); // Delete the heads from the refs
 
-                delRef = function delRef(e) {
-                  return refSet.delete(e);
-                };
+                nexts = Object.keys(this.heads.reverse().reduce(uniqueEntriesReducer, {}));
 
-                nexts.forEach(delRef);
-                refs = Array.from(refSet).map(getHash); // @TODO: Split Entry.create into creating object, checking permission, signing and then posting to IPFS
+                isNext = function isNext(e) {
+                  return !nexts.includes(e);
+                }; // Delete the heads from the refs
+
+
+                refs = Array.from(references).map(getHash).filter(isNext); // @TODO: Split Entry.create into creating object, checking permission, signing and then posting to IPFS
                 // Create the entry and add it to the internal cache
 
-                _context.next = 16;
+                _context.next = 12;
                 return Entry.create(this._storage, this._identity, this.id, data, nexts, this.clock, refs);
 
-              case 16:
+              case 12:
                 entry = _context.sent;
-                _context.next = 19;
+                _context.next = 15;
                 return this._access.canAppend(entry, this._identity.provider);
 
-              case 19:
+              case 15:
                 canAppend = _context.sent;
 
                 if (canAppend) {
-                  _context.next = 22;
+                  _context.next = 18;
                   break;
                 }
 
                 throw new Error("Could not append entry, key \"".concat(this._identity.id, "\" is not allowed to write to the log"));
 
-              case 22:
+              case 18:
                 this._entryIndex.set(entry.hash, entry);
 
                 nexts.forEach(function (e) {
-                  return _this4._nextsIndex[e] = entry.hash;
+                  return _this3._nextsIndex[e] = entry.hash;
                 });
                 this._headsIndex = {};
                 this._headsIndex[entry.hash] = entry; // Update the length
@@ -433,7 +367,7 @@ function (_GSet) {
                 this._length++;
                 return _context.abrupt("return", entry);
 
-              case 28:
+              case 24:
               case "end":
                 return _context.stop();
             }
@@ -574,7 +508,7 @@ function (_GSet) {
       var _join = (0, _asyncToGenerator2.default)(
       /*#__PURE__*/
       _regenerator.default.mark(function _callee7(log) {
-        var _this5 = this;
+        var _this4 = this;
 
         var size,
             newItems,
@@ -637,7 +571,7 @@ function (_GSet) {
                         switch (_context4.prev = _context4.next) {
                           case 0:
                             _context4.next = 2;
-                            return _this5._access.canAppend(entry, identityProvider);
+                            return _this4._access.canAppend(entry, identityProvider);
 
                           case 2:
                             canAppend = _context4.sent;
@@ -703,7 +637,7 @@ function (_GSet) {
 
                 entriesToJoin = Object.values(newItems);
                 _context7.next = 14;
-                return pEachSeries(entriesToJoin,
+                return pMap(entriesToJoin,
                 /*#__PURE__*/
                 function () {
                   var _ref5 = (0, _asyncToGenerator2.default)(
@@ -731,18 +665,20 @@ function (_GSet) {
                   return function (_x5) {
                     return _ref5.apply(this, arguments);
                   };
-                }());
+                }(), {
+                  concurrency: 100
+                });
 
               case 14:
                 // Update the internal next pointers index
                 addToNextsIndex = function addToNextsIndex(e) {
-                  var entry = _this5.get(e.hash);
+                  var entry = _this4.get(e.hash);
 
-                  if (!entry) _this5._length++;
+                  if (!entry) _this4._length++;
                   /* istanbul ignore else */
 
                   e.next.forEach(function (a) {
-                    return _this5._nextsIndex[a] = e.hash;
+                    return _this4._nextsIndex[a] = e.hash;
                   });
                 };
 
@@ -758,7 +694,7 @@ function (_GSet) {
                 };
 
                 notInCurrentNexts = function notInCurrentNexts(e) {
-                  return !_this5._nextsIndex[e.hash];
+                  return !_this4._nextsIndex[e.hash];
                 };
 
                 nextsFromNewItems = Object.values(newItems).map(getNextPointers).reduce(flatMap, []);
@@ -845,10 +781,10 @@ function (_GSet) {
   }, {
     key: "toString",
     value: function toString(payloadMapper) {
-      var _this6 = this;
+      var _this5 = this;
 
       return this.values.slice().reverse().map(function (e, idx) {
-        var parents = Entry.findChildren(e, _this6.values);
+        var parents = Entry.findChildren(e, _this5.values);
         var len = parents.length;
         var padding = new Array(Math.max(len - 1, 0));
         padding = len > 1 ? padding.fill('  ') : padding;
@@ -869,7 +805,7 @@ function (_GSet) {
 
     /**
      * Get the log's multihash.
-     * @returns {Promise} Multihash of the Log as Base58 encoded stringx
+     * @returns {Promise} Multihash of the Log as Base58 encoded string.
      */
     value: function toMultihash() {
       var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
@@ -975,40 +911,45 @@ function (_GSet) {
             access,
             _ref7$length,
             length,
+            _ref7$exclude,
             exclude,
-            onProgressCallback,
+            concurrency,
             sortFn,
-            timeout,
-            format,
-            data,
+            onProgressCallback,
+            _ref8,
+            logId,
+            entries,
+            heads,
             _args8 = arguments;
 
         return _regenerator.default.wrap(function _callee8$(_context8) {
           while (1) {
             switch (_context8.prev = _context8.next) {
               case 0:
-                _ref7 = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : {}, access = _ref7.access, _ref7$length = _ref7.length, length = _ref7$length === void 0 ? -1 : _ref7$length, exclude = _ref7.exclude, onProgressCallback = _ref7.onProgressCallback, sortFn = _ref7.sortFn, timeout = _ref7.timeout, format = _ref7.format;
+                _ref7 = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : {}, access = _ref7.access, _ref7$length = _ref7.length, length = _ref7$length === void 0 ? -1 : _ref7$length, _ref7$exclude = _ref7.exclude, exclude = _ref7$exclude === void 0 ? [] : _ref7$exclude, concurrency = _ref7.concurrency, sortFn = _ref7.sortFn, onProgressCallback = _ref7.onProgressCallback;
                 _context8.next = 3;
                 return LogIO.fromMultihash(ipfs, hash, {
                   length: length,
                   exclude: exclude,
                   onProgressCallback: onProgressCallback,
-                  timeout: timeout,
-                  format: format
+                  concurrency: concurrency,
+                  sortFn: sortFn
                 });
 
               case 3:
-                data = _context8.sent;
+                _ref8 = _context8.sent;
+                logId = _ref8.logId;
+                entries = _ref8.entries;
+                heads = _ref8.heads;
                 return _context8.abrupt("return", new Log(ipfs, identity, {
-                  logId: data.id,
+                  logId: logId,
                   access: access,
-                  entries: data.values,
-                  heads: data.heads,
-                  clock: new Clock(data.clock.id, data.clock.time),
+                  entries: entries,
+                  heads: heads,
                   sortFn: sortFn
                 }));
 
-              case 5:
+              case 8:
               case "end":
                 return _context8.stop();
             }
@@ -1034,7 +975,6 @@ function (_GSet) {
      * @param {Array} options.exclude Entries to not fetch (cached)
      * @param {function(hash, entry, parent, depth)} options.onProgressCallback
      * @param {Function} options.sortFn The sort function - by default LastWriteWins
-     * @param {number} options.timeout Timeout for fetching a log entry from IPFS
      * @return {Promise} New Log
      */
 
@@ -1043,32 +983,45 @@ function (_GSet) {
     value: function () {
       var _fromEntryHash = (0, _asyncToGenerator2.default)(
       /*#__PURE__*/
-      _regenerator.default.mark(function _callee9(ipfs, identity, hash, _ref8) {
-        var logId, access, _ref8$length, length, exclude, onProgressCallback, sortFn, timeout, data;
+      _regenerator.default.mark(function _callee9(ipfs, identity, hash) {
+        var _ref9,
+            logId,
+            access,
+            _ref9$length,
+            length,
+            _ref9$exclude,
+            exclude,
+            concurrency,
+            sortFn,
+            onProgressCallback,
+            _ref10,
+            entries,
+            _args9 = arguments;
 
         return _regenerator.default.wrap(function _callee9$(_context9) {
           while (1) {
             switch (_context9.prev = _context9.next) {
               case 0:
-                logId = _ref8.logId, access = _ref8.access, _ref8$length = _ref8.length, length = _ref8$length === void 0 ? -1 : _ref8$length, exclude = _ref8.exclude, onProgressCallback = _ref8.onProgressCallback, sortFn = _ref8.sortFn, timeout = _ref8.timeout;
+                _ref9 = _args9.length > 3 && _args9[3] !== undefined ? _args9[3] : {}, logId = _ref9.logId, access = _ref9.access, _ref9$length = _ref9.length, length = _ref9$length === void 0 ? -1 : _ref9$length, _ref9$exclude = _ref9.exclude, exclude = _ref9$exclude === void 0 ? [] : _ref9$exclude, concurrency = _ref9.concurrency, sortFn = _ref9.sortFn, onProgressCallback = _ref9.onProgressCallback;
                 _context9.next = 3;
                 return LogIO.fromEntryHash(ipfs, hash, {
                   length: length,
                   exclude: exclude,
-                  onProgressCallback: onProgressCallback,
-                  timeout: timeout
+                  concurrency: concurrency,
+                  onProgressCallback: onProgressCallback
                 });
 
               case 3:
-                data = _context9.sent;
+                _ref10 = _context9.sent;
+                entries = _ref10.entries;
                 return _context9.abrupt("return", new Log(ipfs, identity, {
                   logId: logId,
                   access: access,
-                  entries: data.values,
+                  entries: entries,
                   sortFn: sortFn
                 }));
 
-              case 5:
+              case 6:
               case "end":
                 return _context9.stop();
             }
@@ -1076,7 +1029,7 @@ function (_GSet) {
         }, _callee9);
       }));
 
-      function fromEntryHash(_x9, _x10, _x11, _x12) {
+      function fromEntryHash(_x9, _x10, _x11) {
         return _fromEntryHash.apply(this, arguments);
       }
 
@@ -1090,7 +1043,6 @@ function (_GSet) {
      * @param {Object} options
      * @param {AccessController} options.access The access controller instance
      * @param {number} options.length How many entries to include in the log
-     * @param {number} options.timeout Maximum time to wait for each fetch operation, in ms
      * @param {function(hash, entry, parent, depth)} [options.onProgressCallback]
      * @param {Function} options.sortFn The sort function - by default LastWriteWins
      * @return {Promise} New Log
@@ -1102,38 +1054,40 @@ function (_GSet) {
       var _fromJSON = (0, _asyncToGenerator2.default)(
       /*#__PURE__*/
       _regenerator.default.mark(function _callee10(ipfs, identity, json) {
-        var _ref9,
+        var _ref11,
             access,
-            _ref9$length,
+            _ref11$length,
             length,
-            timeout,
-            onProgressCallback,
             sortFn,
-            data,
+            onProgressCallback,
+            _ref12,
+            logId,
+            entries,
             _args10 = arguments;
 
         return _regenerator.default.wrap(function _callee10$(_context10) {
           while (1) {
             switch (_context10.prev = _context10.next) {
               case 0:
-                _ref9 = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : {}, access = _ref9.access, _ref9$length = _ref9.length, length = _ref9$length === void 0 ? -1 : _ref9$length, timeout = _ref9.timeout, onProgressCallback = _ref9.onProgressCallback, sortFn = _ref9.sortFn;
+                _ref11 = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : {}, access = _ref11.access, _ref11$length = _ref11.length, length = _ref11$length === void 0 ? -1 : _ref11$length, sortFn = _ref11.sortFn, onProgressCallback = _ref11.onProgressCallback;
                 _context10.next = 3;
                 return LogIO.fromJSON(ipfs, json, {
                   length: length,
-                  timeout: timeout,
                   onProgressCallback: onProgressCallback
                 });
 
               case 3:
-                data = _context10.sent;
+                _ref12 = _context10.sent;
+                logId = _ref12.logId;
+                entries = _ref12.entries;
                 return _context10.abrupt("return", new Log(ipfs, identity, {
-                  logId: data.id,
+                  logId: logId,
                   access: access,
-                  entries: data.values,
+                  entries: entries,
                   sortFn: sortFn
                 }));
 
-              case 5:
+              case 7:
               case "end":
                 return _context10.stop();
             }
@@ -1141,7 +1095,7 @@ function (_GSet) {
         }, _callee10);
       }));
 
-      function fromJSON(_x13, _x14, _x15) {
+      function fromJSON(_x12, _x13, _x14) {
         return _fromJSON.apply(this, arguments);
       }
 
@@ -1167,40 +1121,45 @@ function (_GSet) {
       var _fromEntry = (0, _asyncToGenerator2.default)(
       /*#__PURE__*/
       _regenerator.default.mark(function _callee11(ipfs, identity, sourceEntries) {
-        var _ref10,
+        var _ref13,
             access,
-            _ref10$length,
+            _ref13$length,
             length,
+            _ref13$exclude,
             exclude,
-            onProgressCallback,
-            timeout,
+            concurrency,
             sortFn,
-            data,
+            onProgressCallback,
+            _ref14,
+            logId,
+            entries,
             _args11 = arguments;
 
         return _regenerator.default.wrap(function _callee11$(_context11) {
           while (1) {
             switch (_context11.prev = _context11.next) {
               case 0:
-                _ref10 = _args11.length > 3 && _args11[3] !== undefined ? _args11[3] : {}, access = _ref10.access, _ref10$length = _ref10.length, length = _ref10$length === void 0 ? -1 : _ref10$length, exclude = _ref10.exclude, onProgressCallback = _ref10.onProgressCallback, timeout = _ref10.timeout, sortFn = _ref10.sortFn;
+                _ref13 = _args11.length > 3 && _args11[3] !== undefined ? _args11[3] : {}, access = _ref13.access, _ref13$length = _ref13.length, length = _ref13$length === void 0 ? -1 : _ref13$length, _ref13$exclude = _ref13.exclude, exclude = _ref13$exclude === void 0 ? [] : _ref13$exclude, concurrency = _ref13.concurrency, sortFn = _ref13.sortFn, onProgressCallback = _ref13.onProgressCallback;
                 _context11.next = 3;
                 return LogIO.fromEntry(ipfs, sourceEntries, {
                   length: length,
                   exclude: exclude,
-                  onProgressCallback: onProgressCallback,
-                  timeout: timeout
+                  concurrency: concurrency,
+                  onProgressCallback: onProgressCallback
                 });
 
               case 3:
-                data = _context11.sent;
+                _ref14 = _context11.sent;
+                logId = _ref14.logId;
+                entries = _ref14.entries;
                 return _context11.abrupt("return", new Log(ipfs, identity, {
-                  logId: data.id,
+                  logId: logId,
                   access: access,
-                  entries: data.values,
+                  entries: entries,
                   sortFn: sortFn
                 }));
 
-              case 5:
+              case 7:
               case "end":
                 return _context11.stop();
             }
@@ -1208,7 +1167,7 @@ function (_GSet) {
         }, _callee11);
       }));
 
-      function fromEntry(_x16, _x17, _x18) {
+      function fromEntry(_x15, _x16, _x17) {
         return _fromEntry.apply(this, arguments);
       }
 
diff --git a/package.json b/package.json
index 5d11bc8b..9a9f79f8 100644
--- a/package.json
+++ b/package.json
@@ -72,7 +72,7 @@
   "scripts": {
     "test": "TEST=all mocha",
     "test:coverage": "istanbul cover -x src/g-set.js _mocha",
-    "test:browser": "npm run build:tests && mocha-headless-chrome -t 240000 -f ./test/browser/index.html -a no-sandbox",
+    "test:browser": "npm run build:tests && mocha-headless-chrome -t 360000 -f ./test/browser/index.html -a no-sandbox",
     "build": "npm run build:es5 && npm run build:examples && npm run build:dist",
     "build:tests": "webpack --config webpack.tests.config.js --mode production",
     "build:examples": "webpack --config webpack.example.config.js --sort-modules-by size --mode production",
diff --git a/src/entry-io.js b/src/entry-io.js
index 579b28bd..cff89c68 100644
--- a/src/entry-io.js
+++ b/src/entry-io.js
@@ -4,18 +4,21 @@ const pMap = require('p-map')
 const pDoWhilst = require('p-do-whilst')
 const Entry = require('./entry')
 
+const hasItems = arr => arr && arr.length > 0
+
 class EntryIO {
   // Fetch log graphs in parallel
-  static fetchParallel (ipfs, hashes, { length, exclude = [], concurrency, timeout, onProgressCallback }) {
-    const fetchOne = (hash) => EntryIO.fetchAll(ipfs, hash, length, exclude, timeout, onProgressCallback)
+  static async fetchParallel (ipfs, hashes, { length, exclude = [], concurrency, onProgressCallback }) {
+    concurrency = Math.max(concurrency || hashes.length, 1)
+    const fetchOne = async (hash) => EntryIO.fetchAll(ipfs, hash, { length, exclude, onProgressCallback, concurrency })
     const concatArrays = (arr1, arr2) => arr1.concat(arr2)
     const flatten = (arr) => arr.reduce(concatArrays, [])
-    return pMap(hashes, fetchOne, { concurrency: Math.max(concurrency || hashes.length, 1) })
-      .then(flatten) // Flatten the results
+    const res = await pMap(hashes, fetchOne, { concurrency })
+    return flatten(res)
   }
 
   /**
-   * Fetch log entries sequentially
+   * Fetch log entries
    *
    * @param {IPFS} [ipfs] An IPFS instance
    * @param {string} [hash] Multihash of the entry to fetch
@@ -26,13 +29,20 @@ class EntryIO {
    * @param {function(hash, entry, parent, depth)} onProgressCallback
    * @returns {Promise>}
    */
-  static async fetchAll (ipfs, hashes, { length = -1, exclude = [], timeout = null, onProgressCallback, onStartProgressCallback, concurrency = 32, delay = 0 } = {}) {
+  static async fetchAll (ipfs, hashes, { length = -1, exclude = [], onProgressCallback, onStartProgressCallback, concurrency = 32, delay = 0 } = {}) {
     let result = []
     let cache = {}
     let loadingCache = {}
     let loadingQueue = Array.isArray(hashes)
       ? { 0: hashes.slice() }
       : { 0: [hashes] }
+    let running = 0 // keep track of how many entries are being fetched at any time
+    let maxClock = 0 // keep track of the latest clock time during load
+    let minClock = 0 // keep track of the minimum clock time during load
+
+    // Does the loading queue have more to process?
+    const loadingQueueHasMore = () => Object.values(loadingQueue).find(hasItems) !== undefined
+
     // Add a multihash to the loading queue
     const addToLoadingQueue = (e, idx) => {
       if (!loadingCache[e]) {
@@ -40,107 +50,111 @@ class EntryIO {
         if (!loadingQueue[idx].includes(e)) {
           loadingQueue[idx].push(e)
         }
-        loadingCache[e] = idx
+        loadingCache[e] = true
       }
     }
 
-    // Add entries that we don't need to fetch to the "cache"
-    const addToExcludeCache = e => { cache[e.hash] = e }
-    exclude.forEach(addToExcludeCache)
-
-    const loadingQueueHasMore = () => Object.values(loadingQueue)
-      .find(e => e && e.length > 0) !== undefined
-
-    const shouldFetchMore = () => {
-      return loadingQueueHasMore() &&
-          (result.length < length || length < 0)
-    }
-
+    // Get the next items to process from the loading queue
     const getNextFromQueue = (length = 1) => {
-      const all = Object.values(loadingQueue).reduce((res, acc) => {
-        while (acc.length > 0 && res.length < length) {
-          const e = acc.shift()
-          res.push(e)
+      const getNext = (res, key, idx) => {
+        const nextItems = loadingQueue[key]
+        while (nextItems.length > 0 && res.length < length) {
+          const hash = nextItems.shift()
+          res.push(hash)
+        }
+        if (nextItems.length === 0) {
+          delete loadingQueue[key]
         }
         return res
-      }, [])
-      return all
+      }
+      return Object.keys(loadingQueue).reduce(getNext, [])
     }
 
-    const fetchEntry = (hash) => {
+    // Add entries that we don't need to fetch to the "cache"
+    const addToExcludeCache = e => { cache[e.hash] = true }
+
+    // Fetch one entry and add it to the results
+    const fetchEntry = async (hash) => {
       if (!hash || cache[hash]) {
-        return Promise.resolve()
+        return
       }
 
-      return new Promise((resolve, reject) => {
-        // Resolve the promise after a timeout (if given) in order to
-        // not get stuck loading a block that is unreachable
-        // const timer = timeout
-        // ? setTimeout(() => {
-        //     console.warn(`Warning: Couldn't fetch entry '${hash}', request timed out (${timeout}ms)`)
-        //     resolve()
-        //   } , timeout)
-        // : null
-
-        const sleep = (ms = 0) => new Promise(resolve => setTimeout(resolve, ms))
+      const addToResults = (entry) => {
+        if (Entry.isEntry(entry)) {
+          const ts = entry.clock.time
+
+          // Update min/max clocks
+          maxClock = Math.max(maxClock, ts)
+          minClock = result.length > 0
+            ? Math.min(result[result.length - 1].clock.time, minClock)
+            : maxClock
+
+          const isLater = (result.length >= length && ts >= minClock)
+          const calculateIndex = (idx) => maxClock - ts + ((idx + 1) * idx)
+
+          // Add the entry to the results if
+          // 1) we're fetching all entries
+          // 2) results is not filled yet
+          // the clock of the entry is later than current known minimum clock time
+          if (length < 0 || result.length < length || isLater) {
+            result.push(entry)
+            cache[hash] = true
+          }
 
-        const addToResults = (entry) => {
-          // clearTimeout(timer)
-          if (Entry.isEntry(entry)) {
-            try {
-              entry.next.forEach(addToLoadingQueue)
-              entry.refs.forEach(addToLoadingQueue)
-
-              result.push(entry)
-              cache[hash] = entry
-              if (onProgressCallback) {
-                onProgressCallback(hash, entry, result.length, result, loadingQueue)
-              }
-            } catch (e) {
-              console.error(e)
+          if (length < 0) {
+            // If we're fetching all entries (length === -1), adds nexts and refs to the queue
+            entry.next.forEach(addToLoadingQueue)
+            entry.refs.forEach(addToLoadingQueue)
+          } else {
+            // If we're fetching entries up to certain length,
+            // fetch the next if result is filled up, to make sure we "check"
+            // the next entry if its clock is later than what we have in the result
+            if (result.length <= length || ts >= minClock) {
+              entry.next.forEach(e => addToLoadingQueue(e, calculateIndex(0)))
+            }
+            if ((result.length + entry.refs.length) <= length) {
+              entry.refs.forEach((e, i) => addToLoadingQueue(e, calculateIndex(i)))
             }
           }
         }
+      }
 
-        if (onStartProgressCallback) {
-          onStartProgressCallback(hash, null, result.length, result, loadingQueue)
-        }
+      if (onStartProgressCallback) {
+        onStartProgressCallback(hash, null, result.length, result, loadingQueue)
+      }
+
+      // Load the entry
+      const entry = await Entry.fromMultihash(ipfs, hash)
 
-        // Load the entry
-        Entry.fromMultihash(ipfs, hash)
-          .then(addToResults)
-          .then(async (entry) => {
-            // Simulate network latency
-            if (delay > 0) { await sleep(delay) }
-
-            return entry
-          })
-          .then(resolve)
-          .catch(err => {
-            reject(err)
-          })
-      })
+      // Add it to the results
+      addToResults(entry)
+
+      if (onProgressCallback) {
+        onProgressCallback(hash, entry, result.length, result, loadingQueue)
+      }
+
+      // Simulate network latency (for debugging purposes)
+      if (delay > 0) {
+        const sleep = (ms = 0) => new Promise(resolve => setTimeout(resolve, ms))
+        await sleep(delay)
+      }
     }
 
-    let running = 0
+    // One loop of processing the loading queue
     const _processQueue = async () => {
       if (running < concurrency) {
-        let nexts = getNextFromQueue(concurrency)
-        if (result.length + nexts.length > length && !(length < 0)) {
-          nexts = nexts.slice(0, length - result.length) // trim nexts to match length
-        }
+        const nexts = getNextFromQueue(concurrency)
         running += nexts.length
         await pMap(nexts, fetchEntry)
         running -= nexts.length
       }
     }
 
-    await pDoWhilst(async () => _processQueue(), shouldFetchMore)
+    // Add entries to exclude from processing to the cache before we start
+    exclude.forEach(addToExcludeCache)
 
-    // Free memory to avoid minor GC
-    cache = {}
-    loadingCache = {}
-    loadingQueue = []
+    // Fetch entries
+    await pDoWhilst(_processQueue, loadingQueueHasMore)
 
     return result
   }
diff --git a/src/log-io.js b/src/log-io.js
index 47af5d45..e1bbcb0c 100644
--- a/src/log-io.js
+++ b/src/log-io.js
@@ -2,7 +2,8 @@
 
 const Entry = require('./entry')
 const EntryIO = require('./entry-io')
-const Clock = require('./lamport-clock')
+const Sorting = require('./log-sorting')
+const { LastWriteWins, NoZeroes } = Sorting
 const LogError = require('./log-errors')
 const { isDefined, findUniques, difference, io } = require('./utils')
 
@@ -36,30 +37,26 @@ class LogIO {
    * @param {Array} options.exclude Entries to not fetch (cached)
    * @param {function(hash, entry, parent, depth)} options.onProgressCallback
    */
-  static async fromMultihash (ipfs, hash, { length = -1, exclude, onProgressCallback, timeout } = {}) {
+  static async fromMultihash (ipfs, hash,
+    { length = -1, exclude = [], concurrency, sortFn, onProgressCallback }) {
     if (!isDefined(ipfs)) throw LogError.IPFSNotDefinedError()
     if (!isDefined(hash)) throw new Error(`Invalid hash: ${hash}`)
 
     const logData = await io.read(ipfs, hash, { links: IPLD_LINKS })
+
     if (!logData.heads || !logData.id) throw LogError.NotALogError()
-    const entries = await EntryIO.fetchAll(ipfs, logData.heads,
-      { length, exclude, onProgressCallback, timeout })
-
-    // Find latest clock
-    const clock = entries.reduce((clock, entry) => {
-      if (entry.clock.time > clock.time) {
-        return new Clock(entry.clock.id, entry.clock.time)
-      }
-      return clock
-    }, new Clock(logData.id))
-    const finalEntries = entries.slice().sort(Entry.compare)
-    const heads = finalEntries.filter(e => logData.heads.includes(e.hash))
-    return {
-      id: logData.id,
-      values: finalEntries,
-      heads: heads,
-      clock: clock
-    }
+
+    // Use user provided sorting function or the default one
+    sortFn = sortFn || NoZeroes(LastWriteWins)
+    const isHead = e => logData.heads.includes(e.hash)
+
+    const all = await EntryIO.fetchAll(ipfs, logData.heads,
+      { length, exclude, concurrency, onProgressCallback })
+
+    const logId = logData.id
+    const entries = length > -1 ? last(all.sort(sortFn), length) : all
+    const heads = entries.filter(isHead)
+    return { logId, entries, heads }
   }
 
   /**
@@ -70,25 +67,21 @@ class LogIO {
    * @param {number} options.length How many items to include in the log
    * @param {Array} options.exclude Entries to not fetch (cached)
    * @param {function(hash, entry, parent, depth)} options.onProgressCallback
-   * @param {number} options.timeout Timeout for fetching a log entry from IPFS
    */
-  static async fromEntryHash (ipfs, hash, { length = -1, exclude, onProgressCallback, timeout }) {
+  static async fromEntryHash (ipfs, hash,
+    { length = -1, exclude = [], concurrency, onProgressCallback }) {
     if (!isDefined(ipfs)) throw LogError.IpfsNotDefinedError()
     if (!isDefined(hash)) throw new Error("'hash' must be defined")
     // Convert input hash(s) to an array
     const hashes = Array.isArray(hash) ? hash : [hash]
     // Fetch given length, return size at least the given input entries
     length = length > -1 ? Math.max(length, 1) : length
-
-    const entries = await EntryIO.fetchParallel(ipfs, hashes,
-      { length, exclude, onProgressCallback, timeout, concurrency: 128 })
+    const all = await EntryIO.fetchParallel(ipfs, hashes,
+      { length, exclude, concurrency, onProgressCallback })
     // Cap the result at the right size by taking the last n entries,
     // or if given length is -1, then take all
-    const sliced = length > -1 ? last(entries, length) : entries
-    // console.log(">>>", sliced.length)
-    return {
-      values: sliced
-    }
+    const entries = length > -1 ? last(all, length) : all
+    return { entries }
   }
 
   /**
@@ -98,20 +91,16 @@ class LogIO {
    * @param {json} json A json object containing valid log data
    * @param {Object} options
    * @param {number} options.length How many entries to include
-   * @param {number} options.timeout Maximum time to wait for each fetch operation, in ms
    * @param {function(hash, entry, parent, depth)} options.onProgressCallback
    **/
-  static async fromJSON (ipfs, json, { length = -1, timeout, onProgressCallback }) {
+  static async fromJSON (ipfs, json, { length = -1, concurrency, onProgressCallback }) {
     if (!isDefined(ipfs)) throw LogError.IPFSNotDefinedError()
-    const headHashes = json.heads.map(e => e.hash)
-    const entries = await EntryIO.fetchParallel(ipfs, headHashes,
-      { length, exclude: [], concurrency: 16, timeout, onProgressCallback })
-    const finalEntries = entries.slice().sort(Entry.compare)
-    return {
-      id: json.id,
-      values: finalEntries,
-      heads: json.heads
-    }
+    const { id, heads } = json
+    const headHashes = heads.map(e => e.hash)
+    const all = await EntryIO.fetchParallel(ipfs, headHashes,
+      { length, concurrency, onProgressCallback })
+    const entries = all.sort(Entry.compare)
+    return { logId: id, entries, heads }
   }
 
   /**
@@ -123,7 +112,8 @@ class LogIO {
    * @param {Array} options.exclude Entries to not fetch (cached)
    * @param {function(hash, entry, parent, depth)} options.onProgressCallback
    */
-  static async fromEntry (ipfs, sourceEntries, { length = -1, exclude, onProgressCallback, timeout }) {
+  static async fromEntry (ipfs, sourceEntries,
+    { length = -1, exclude = [], concurrency, onProgressCallback }) {
     if (!isDefined(ipfs)) throw LogError.IPFSNotDefinedError()
     if (!isDefined(sourceEntries)) throw new Error("'sourceEntries' must be defined")
 
@@ -143,11 +133,11 @@ class LogIO {
     const hashes = sourceEntries.map(e => e.hash)
 
     // Fetch the entries
-    const entries = await EntryIO.fetchParallel(ipfs, hashes,
-      { length, exclude, onProgressCallback, timeout, concurrency: 64 })
+    const all = await EntryIO.fetchParallel(ipfs, hashes,
+      { length, exclude, concurrency, onProgressCallback })
 
     // Combine the fetches with the source entries and take only uniques
-    const combined = sourceEntries.concat(entries)
+    const combined = sourceEntries.concat(all).concat(exclude)
     const uniques = findUniques(combined, 'hash').sort(Entry.compare)
 
     // Cap the result at the right size by taking the last n entries
@@ -164,11 +154,9 @@ class LogIO {
 
     // Add the input entries at the beginning of the array and remove
     // as many elements from the array before inserting the original entries
-    const result = replaceInFront(sliced, missingSourceEntries)
-    return {
-      id: result[result.length - 1].id,
-      values: result
-    }
+    const entries = replaceInFront(sliced, missingSourceEntries)
+    const logId = entries[entries.length - 1].id
+    return { logId, entries }
   }
 }
 
diff --git a/src/log.js b/src/log.js
index fe36aad0..9a2ff06d 100644
--- a/src/log.js
+++ b/src/log.js
@@ -194,69 +194,6 @@ class Log extends GSet {
     return this._entryIndex.get(entry.hash || entry) !== undefined
   }
 
-  getNextAndTraverse (rootEntries, amount) {
-    let stack = rootEntries
-    // .map(getFirstNextPointer)
-    // .map(e => this.get(e))
-    // .filter(isDefined)
-
-    // Cache for checking if we've processed an entry already
-    let traversed = {}
-    // End result
-    let result = {}
-    // We keep a counter to check if we have traversed requested amount of entries
-    let count = 0
-
-    // Named function for getting an entry from the log
-    const getEntry = e => this.get(e)
-
-    // Add an entry to the stack and traversed nodes index
-    const addToStack = entry => {
-      // If we've already processed the entry, don't add it to the stack
-      if (!entry || traversed[entry.hash]) {
-        return
-      }
-
-      // Add the entry in front of the stack and sort
-      stack = [entry, ...stack]
-        .sort(this._sortFn)
-        .reverse()
-        // Add to the cache of processed entries
-      traversed[entry.hash] = true
-    }
-
-    const addEntry = rootEntry => {
-      result[rootEntry.hash] = rootEntry
-      traversed[rootEntry.hash] = true
-      count++
-    }
-
-    // rootEntries.forEach(addEntry)
-
-    // Start traversal
-    // Process stack until it's empty (traversed the full log)
-    // or when we have the requested amount of entries
-    // If requested entry amount is -1, traverse all
-    while (stack.length > 0 && (count < amount || amount < 0)) { // eslint-disable-line no-unmodified-loop-condition
-      // Get the next element from the stack
-      const entry = stack.shift()
-
-      // Add to the result
-      // result[entry.hash] = entry
-      addEntry(entry)
-      // if ((amount !== -1) && (++count >= amount)) break
-
-      // Add entry's next references to the stack
-      const entries = entry.next.map(getEntry)
-      const defined = entries.filter(isDefined)
-      defined.forEach(addToStack)
-    }
-
-    stack = []
-    traversed = {}
-    return result
-  }
-
   traverse (rootEntries, amount = -1, endHash) {
     // Sort the given given root entries and use as the starting stack
     let stack = rootEntries.sort(this._sortFn).reverse()
@@ -324,37 +261,32 @@ class Log extends GSet {
     const newTime = Math.max(this.clock.time, this.heads.reduce(maxClockTimeReducer, 0)) + 1
     this._clock = new Clock(this.clock.id, newTime)
 
-    const heads = this.traverse(this.heads, this.heads.length)
+    const all = Object.values(this.traverse(this.heads, pointerCount))
 
-    const sortedHeadIndex = this.heads.reverse().reduce(uniqueEntriesReducer, {})
-    const nexts = Object.keys(Object.assign({}, sortedHeadIndex, heads))
-    const all = Object.values(this.getNextAndTraverse(this.heads, pointerCount))
+    // If pointer count is 4, returns 2
+    // If pointer count is 8, returns 3 references
+    // If pointer count is 512, returns 9 references
+    // If pointer count is 2048, returns 11 references
     const getEveryPow2 = (maxDistance) => {
       let entries = new Set()
       for (let i = 1; i <= maxDistance; i *= 2) {
         const index = Math.min(i - 1, all.length - 1)
-        const ref = all[index]
-        entries.add(ref)
+        entries.add(all[index])
       }
-
       return entries
     }
-
-    // If pointer count is 4, returns 2
-    // If pointer count is 8, returns 3 references
-    // If pointer count is 512, returns 9 references
-    // If pointer count is 2048, returns 11 references
     const references = getEveryPow2(Math.min(pointerCount, all.length))
-    let refSet = new Set(references)
 
     // Always include the last known reference
     if (all.length < pointerCount && all[all.length - 1]) {
-      refSet.add(all[all.length - 1])
+      references.add(all[all.length - 1])
     }
 
-    // Delete the heads from the refs
+    // Create the next pointers from heads
+    const nexts = Object.keys(this.heads.reverse().reduce(uniqueEntriesReducer, {}))
     const isNext = e => !nexts.includes(e)
-    const refs = Array.from(refSet).map(getHash).filter(isNext)
+    // Delete the heads from the refs
+    const refs = Array.from(references).map(getHash).filter(isNext)
 
     // @TODO: Split Entry.create into creating object, checking permission, signing and then posting to IPFS
     // Create the entry and add it to the internal cache
@@ -594,7 +526,7 @@ class Log extends GSet {
 
   /**
    * Get the log's multihash.
-   * @returns {Promise} Multihash of the Log as Base58 encoded stringx
+   * @returns {Promise} Multihash of the Log as Base58 encoded string.
    */
   toMultihash ({ format } = {}) {
     return LogIO.toMultihash(this._storage, this, { format })
@@ -614,17 +546,11 @@ class Log extends GSet {
    * @returns {Promise}
    */
   static async fromMultihash (ipfs, identity, hash,
-    { access, length = -1, exclude, onProgressCallback, sortFn, timeout, format } = {}) {
+    { access, length = -1, exclude = [], concurrency, sortFn, onProgressCallback } = {}) {
     // TODO: need to verify the entries with 'key'
-    const data = await LogIO.fromMultihash(ipfs, hash, { length, exclude, onProgressCallback, timeout, format })
-    return new Log(ipfs, identity, {
-      logId: data.id,
-      access: access,
-      entries: data.values,
-      heads: data.heads,
-      clock: new Clock(data.clock.id, data.clock.time),
-      sortFn: sortFn
-    })
+    const { logId, entries, heads } = await LogIO.fromMultihash(ipfs, hash,
+      { length, exclude, onProgressCallback, concurrency, sortFn })
+    return new Log(ipfs, identity, { logId, access, entries, heads, sortFn })
   }
 
   /**
@@ -639,14 +565,14 @@ class Log extends GSet {
    * @param {Array} options.exclude Entries to not fetch (cached)
    * @param {function(hash, entry, parent, depth)} options.onProgressCallback
    * @param {Function} options.sortFn The sort function - by default LastWriteWins
-   * @param {number} options.timeout Timeout for fetching a log entry from IPFS
    * @return {Promise} New Log
    */
   static async fromEntryHash (ipfs, identity, hash,
-    { logId, access, length = -1, exclude, onProgressCallback, sortFn, timeout }) {
+    { logId, access, length = -1, exclude = [], concurrency, sortFn, onProgressCallback } = {}) {
     // TODO: need to verify the entries with 'key'
-    const data = await LogIO.fromEntryHash(ipfs, hash, { length, exclude, onProgressCallback, timeout })
-    return new Log(ipfs, identity, { logId, access, entries: data.values, sortFn })
+    const { entries } = await LogIO.fromEntryHash(ipfs, hash,
+      { length, exclude, concurrency, onProgressCallback })
+    return new Log(ipfs, identity, { logId, access, entries, sortFn })
   }
 
   /**
@@ -657,16 +583,15 @@ class Log extends GSet {
    * @param {Object} options
    * @param {AccessController} options.access The access controller instance
    * @param {number} options.length How many entries to include in the log
-   * @param {number} options.timeout Maximum time to wait for each fetch operation, in ms
    * @param {function(hash, entry, parent, depth)} [options.onProgressCallback]
    * @param {Function} options.sortFn The sort function - by default LastWriteWins
    * @return {Promise} New Log
    */
   static async fromJSON (ipfs, identity, json,
-    { access, length = -1, timeout, onProgressCallback, sortFn } = {}) {
+    { access, length = -1, sortFn, onProgressCallback } = {}) {
     // TODO: need to verify the entries with 'key'
-    const data = await LogIO.fromJSON(ipfs, json, { length, timeout, onProgressCallback })
-    return new Log(ipfs, identity, { logId: data.id, access, entries: data.values, sortFn })
+    const { logId, entries } = await LogIO.fromJSON(ipfs, json, { length, onProgressCallback })
+    return new Log(ipfs, identity, { logId, access, entries, sortFn })
   }
 
   /**
@@ -683,11 +608,11 @@ class Log extends GSet {
    * @return {Promise} New Log
    */
   static async fromEntry (ipfs, identity, sourceEntries,
-    { access, length = -1, exclude, onProgressCallback, timeout, sortFn } = {}) {
+    { access, length = -1, exclude = [], concurrency, sortFn, onProgressCallback } = {}) {
     // TODO: need to verify the entries with 'key'
-    const data = await LogIO.fromEntry(ipfs, sourceEntries,
-      { length, exclude, onProgressCallback, timeout })
-    return new Log(ipfs, identity, { logId: data.id, access, entries: data.values, sortFn })
+    const { logId, entries } = await LogIO.fromEntry(ipfs, sourceEntries,
+      { length, exclude, concurrency, onProgressCallback })
+    return new Log(ipfs, identity, { logId, access, entries, sortFn })
   }
 
   /**
diff --git a/test/log-load.spec.js b/test/log-load.spec.js
index 9c9bb5fc..2e570f2d 100644
--- a/test/log-load.spec.js
+++ b/test/log-load.spec.js
@@ -673,7 +673,7 @@ Object.keys(testAPIs).forEach((IPFS) => {
         let res = await Log.fromMultihash(ipfs, testIdentity2, hash, { length: 5 })
 
         const first5 = [
-          'entryA5', 'entryB5', 'entryC0', 'entryA9', 'entryA10'
+          'entryC0', 'entryA7', 'entryA8', 'entryA9', 'entryA10'
         ]
 
         assert.deepStrictEqual(res.values.map(e => e.payload), first5)
@@ -682,10 +682,10 @@ Object.keys(testAPIs).forEach((IPFS) => {
         res = await Log.fromMultihash(ipfs, testIdentity2, hash, { length: 11 })
 
         const first11 = [
-          'entryA3', 'entryB3', 'entryA4', 'entryB4',
+          'entryB3', 'entryA4', 'entryB4',
           'entryA5', 'entryB5',
-          'entryC0',
-          'entryA7', 'entryA8', 'entryA9', 'entryA10'
+          'entryA6',
+          'entryC0', 'entryA7', 'entryA8', 'entryA9', 'entryA10'
         ]
 
         assert.deepStrictEqual(res.values.map(e => e.payload), first11)
@@ -694,7 +694,7 @@ Object.keys(testAPIs).forEach((IPFS) => {
         res = await Log.fromMultihash(ipfs, testIdentity2, hash, { length: 16 - 1 })
 
         const all = [
-          'entryA1', /* excl */ 'entryA2', 'entryB2', 'entryA3', 'entryB3',
+          /* excl */ 'entryB1', 'entryA2', 'entryB2', 'entryA3', 'entryB3',
           'entryA4', 'entryB4', 'entryA5', 'entryB5',
           'entryA6',
           'entryC0', 'entryA7', 'entryA8', 'entryA9', 'entryA10'
@@ -746,8 +746,8 @@ Object.keys(testAPIs).forEach((IPFS) => {
         res = await Log.fromMultihash(ipfs, testIdentity2, hash, { length: 11 })
 
         const first11 = [
-          'entryA1', 'entryA2', 'entryA3', 'entryA4',
-          'entryA5', 'entryA6',
+          'entryB3', 'entryA4', 'entryB4', 'entryA5',
+          'entryB5', 'entryA6',
           'entryC0',
           'entryA7', 'entryA8', 'entryA9', 'entryA10'
         ]
@@ -758,7 +758,7 @@ Object.keys(testAPIs).forEach((IPFS) => {
         res = await Log.fromMultihash(ipfs, testIdentity2, hash, { length: 16 - 1 })
 
         const all = [
-          'entryA1', /* excl */ 'entryA2', 'entryB2', 'entryA3', 'entryB3',
+          /* excl */ 'entryB1', 'entryA2', 'entryB2', 'entryA3', 'entryB3',
           'entryA4', 'entryB4', 'entryA5', 'entryB5',
           'entryA6',
           'entryC0', 'entryA7', 'entryA8', 'entryA9', 'entryA10'