You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1014 KiB

  1. var OrbitDB=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=221)}([function(e,t,r){"use strict";(function(e){
  2. /*!
  3. * The buffer module from node.js, for the browser.
  4. *
  5. * @author Feross Aboukhadijeh <http://feross.org>
  6. * @license MIT
  7. */
  8. var n=r(222),i=r(223),o=r(100);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=c.prototype:(null===e&&(e=new c(t)),e.length=t),e}function c(e,t,r){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return h(this,e)}return u(this,e,t,r)}function u(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);c.TYPED_ARRAY_SUPPORT?(e=t).__proto__=c.prototype:e=l(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!c.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(t,r),i=(e=a(e,n)).write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(c.isBuffer(t)){var r=0|d(t.length);return 0===(e=a(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?a(e,0):l(e,t);if("Buffer"===t.type&&o(t.data))return l(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function f(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function h(e,t){if(f(t),e=a(e,t<0?0:0|d(t)),!c.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function l(e,t){var r=t.length<0?0:0|d(t.length);e=a(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function d(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(e).length;default:if(n)return K(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,r);case"utf8":case"utf-8":return C(this,t,r);case"ascii":return I(this,t,r);case"latin1":case"binary":return T(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function b(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,i){var o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"
  9. /*!
  10. * The buffer module from node.js, for the browser.
  11. *
  12. * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  13. * @license MIT
  14. */function i(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0}function o(e){return t.Buffer&&"function"==typeof t.Buffer.isBuffer?t.Buffer.isBuffer(e):!(null==e||!e._isBuffer)}var s=r(40),a=Object.prototype.hasOwnProperty,c=Array.prototype.slice,u="foo"===function(){}.name;function f(e){return Object.prototype.toString.call(e)}function h(e){return!o(e)&&("function"==typeof t.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}var l=e.exports=m,d=/\s*function\s+([^\(\s]*)\s*/;function p(e){if(s.isFunction(e)){if(u)return e.name;var t=e.toString().match(d);return t&&t[1]}}function y(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function b(e){if(u||!s.isFunction(e))return s.inspect(e);var t=p(e);return"[Function"+(t?": "+t:"")+"]"}function g(e,t,r,n,i){throw new l.AssertionError({message:r,actual:e,expected:t,operator:n,stackStartFunction:i})}function m(e,t){e||g(e,!0,t,"==",l.ok)}function v(e,t,r,n){if(e===t)return!0;if(o(e)&&o(t))return 0===i(e,t);if(s.isDate(e)&&s.isDate(t))return e.getTime()===t.getTime();if(s.isRegExp(e)&&s.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(h(e)&&h(t)&&f(e)===f(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===i(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(o(e)!==o(t))return!1;var a=(n=n||{actual:[],expected:[]}).actual.indexOf(e);return-1!==a&&a===n.expected.indexOf(t)||(n.actual.push(e),n.expected.push(t),function(e,t,r,n){if(null==e||null==t)return!1;if(s.isPrimitive(e)||s.isPrimitive(t))return e===t;if(r&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=w(e),o=w(t);if(i&&!o||!i&&o)return!1;if(i)return e=c.call(e),t=c.call(t),v(e,t,r);var a,u,f=E(e),h=E(t);if(f.length!==h.length)return!1;for(f.sort(),h.sort(),u=f.length-1;u>=0;u--)if(f[u]!==h[u])return!1;for(u=f.length-1;u>=0;u--)if(a=f[u],!v(e[a],t[a],r,n))return!1;return!0}(e,t,r,n))}return r?e===t:e==t}function w(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function _(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function S(e,t,r,n){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&g(i,r,"Missing expected exception"+n);var o="string"==typeof n,a=!e&&i&&!r;if((!e&&s.isError(i)&&o&&_(i,r)||a)&&g(i,r,"Got unwanted exception"+n),e&&i&&r&&!_(i,r)||!e&&i)throw i}l.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return y(b(e.actual),128)+" "+e.operator+" "+y(b(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||g;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var n=r.stack,i=p(t),o=n.indexOf("\n"+i);if(o>=0){var s=n.indexOf("\n",o+1);n=n.substring(s+1)}this.stack=n}}},s.inherits(l.AssertionError,Error),l.fail=g,l.ok=m,l.equal=function(e,t,r){e!=t&&g(e,t,r,"==",l.equal)},l.notEqual=function(e,t,r){e==t&&g(e,t,r,"!=",l.notEqual)},l.deepEqual=function(e,t,r){v(e,t,!1)||g(e,t,r,"deepEqual",l.deepEqual)},l.deepStrictEqual=function(e,t,r){v(e,t,!0)||g(e,t,r,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function(e,t,r){v(e,t,!1)&&g(e,t,r,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=function e(t,r,n){v(t,r,!0)&&g(t,r,n,"notDeepStrictEqual",e)},l.strictEqual=function(e,t,r){e!==t&&g(e,t,r,"===",l.strictEqual)},l.notStrictEqual=function(e,t,r){e===t&&g(e,t,r,"!=="
  15. /**
  16. * [js-sha3]{@link https://github.com/emn178/js-sha3}
  17. *
  18. * @version 0.8.0
  19. * @author Chen, Yi-Cyuan [emn178@gmail.com]
  20. * @copyright Chen, Yi-Cyuan 2015-2018
  21. * @license MIT
  22. */!function(){"use strict";var s="input is invalid type",a="object"==typeof window,c=a?window:{};c.JS_SHA3_NO_WINDOW&&(a=!1);var u=!a&&"object"==typeof self;!c.JS_SHA3_NO_NODE_JS&&"object"==typeof n&&n.versions&&n.versions.node?c=i:u&&(c=self);var f=!c.JS_SHA3_NO_COMMON_JS&&"object"==typeof e&&e.exports,h=r(387),l=!c.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,d="0123456789abcdef".split(""),p=[4,1024,262144,67108864],y=[0,8,16,24],b=[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],g=[224,256,384,512],m=[128,256],v=["hex","buffer","arrayBuffer","array","digest"],w={128:168,256:136};!c.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!l||!c.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var _=function(e,t,r){return function(n){return new P(e,t,e).update(n)[r]()}},S=function(e,t,r){return function(n,i){return new P(e,t,i).update(n)[r]()}},E=function(e,t,r){return function(t,n,i,o){return T["cshake"+e].update(t,n,i,o)[r]()}},k=function(e,t,r){return function(t,n,i,o){return T["kmac"+e].update(t,n,i,o)[r]()}},A=function(e,t,r,n){for(var i=0;i<v.length;++i){var o=v[i];e[o]=t(r,n,o)}return e},C=function(e,t){var r=_(e,t,"hex");return r.create=function(){return new P(e,t,e)},r.update=function(e){return r.create().update(e)},A(r,_,e,t)},I=[{name:"keccak",padding:[1,256,65536,16777216],bits:g,createMethod:C},{name:"sha3",padding:[6,1536,393216,100663296],bits:g,createMethod:C},{name:"shake",padding:[31,7936,2031616,520093696],bits:m,createMethod:function(e,t){var r=S(e,t,"hex");return r.create=function(r){return new P(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},A(r,S,e,t)}},{name:"cshake",padding:p,bits:m,createMethod:function(e,t){var r=w[e],n=E(e,0,"hex");return n.create=function(n,i,o){return i||o?new P(e,t,n).bytepad([i,o],r):T["shake"+e].create(n)},n.update=function(e,t,r,i){return n.create(t,r,i).update(e)},A(n,E,e,t)}},{name:"kmac",padding:p,bits:m,createMethod:function(e,t){var r=w[e],n=k(e,0,"hex");return n.create=function(n,i,o){return new U(e,t,i).bytepad(["KMAC",o],r).bytepad([n],r)},n.update=function(e,t,r,i){return n.create(e,r,i).update(t)},A(n,k,e,t)}}],T={},x=[],B=0;B<I.length;++B)for(var M=I[B],R=M.bits,N=0;N<R.length;++N){var O=M.name+"_"+R[N];if(x.push(O),T[O]=M.createMethod(R[N],M.padding),"sha3"!==M.name){var L=M.name+R[N];x.push(L),T[L]=T[O]}}function P(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function U(e,t,r){P.call(this,e,t,r)}P.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(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 n,i,o=this.blocks,a=this.byteCount,c=e.length,u=this.blockCount,f=0,h=this.s;f<c;){if(this.reset)for(this.reset=!1,o[0]=this.block,n=1;n<u+1;++n)o[n]=0;if(t)for(n=this.start;f<c&&n<a;++f)o[n>>2]|=e[f]<<y[3&n++];else for(n=this.start;f<c&&n<a;++f)(i=e.charCodeAt(f))<128?o[n>>2]|=i<<y[3&n++]:i<2048?(o[n>>2]|=(192|i>>6)<<y[3&n++],o[n>>2]|=(128|63&i)<<y[3&n++]):i<55296||i>=57344?(o[n>>2]|=(224|i>>12)<<y[3&n++],o[n>>2]|=(128|i>>6&63)<<y[3&n++],o[n>>2]|=(128|63&i)<<y[3&n++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++f)),o[n>>2]|=(240|i>>18)<<y[3&n++],o[n>>2]|=(128|i>>12&63)<<y[3&n++],o[n>>2]|=(128|i>>6&63)<<y[3&n++],o[n>>2]|=(
  23. /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
  24. var n=r(0),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},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 n.SlowBuffer(e)}},function(e,t,r){"use strict";e.exports=class{async getId(e){}async signIdentity(e,t){}static async verifyIdentity(e){}static get type(){throw new Error("'static get type ()' needs to be defined in the inheriting class")}get type(){return this.constructor.type}}},function(e,t,r){(function(t){var n=r(7).EventEmitter,i=r(40).inherits,o=r(9),s=r(517),a=r(520),c=r(529),u=r(97),f=r(94),h=r(136),l=r(213),d=r(56).getCallback,p=r(56).getOptions,y=u.WriteError,b=u.ReadError,g=u.NotFoundError,m=u.OpenError,v=u.InitializationError;function w(e,r,i){if(!(this instanceof w))return new w(e,r,i);var o,a=this;if(n.call(this),this.setMaxListeners(1/0),"function"==typeof r&&(i=r,r={}),r=r||{},!e||"object"!=typeof e){if(o=new v("First argument must be an abstract-leveldown compliant store"),"function"==typeof i)return t.nextTick(i,o);throw o}h.strictEqual(typeof e.status,"string",".status required, old abstract-leveldown"),this.options=p(r),this._db=e,this.db=new s(e),this.open(i||function(e){e&&a.emit("error",e)}),this.supports=f(this.db.supports,{status:!1,deferredOpen:!0,openCallback:!0,promises:!0,streams:!0}),Object.keys(this.supports.additionalMethods).forEach((function(e){null==this[e]&&(this[e]=function(){return this.db[e].apply(this.db,arguments)})}),this)}function _(e,r){if(!e._isOpening()&&!e.isOpen())return t.nextTick(r,new b("Database is not open")),!0}w.prototype.emit=n.prototype.emit,w.prototype.once=n.prototype.once,i(w,n),w.prototype.open=function(e,r){var n,i=this;return"function"==typeof e&&(r=e,e=null),r||(n=(r=l()).promise),e||(e=this.options),this.isOpen()?(t.nextTick(r,null,i),n):this._isOpening()?(this.once("open",(function(){r(null,i)})),n):(this.emit("opening"),this.db.open(e,(function(e){if(e)return r(new m(e));i.db=i._db,r(null,i),i.emit("open"),i.emit("ready")})),n)},w.prototype.close=function(e){var r,n=this;return e||(r=(e=l()).promise),this.isOpen()?(this.db.close((function(){n.emit("closed"),e.apply(null,arguments)})),this.emit("closing"),this.db=new s(this._db)):this.isClosed()?t.nextTick(e):"closing"===this.db.status?this.once("closed",e):this._isOpening()&&this.once("open",(function(){n.close(e)})),r},w.prototype.isOpen=function(){return"open"===this.db.status},w.prototype._isOpening=function(){return"opening"===this.db.status},w.prototype.isClosed=function(){return/^clos|new/.test(this.db.status)},w.prototype.get=function(e,t,r){var n;return(r=d(t,r))||(n=(r=l()).promise),_(this,r)||(t=p(t),this.db.get(e,t,(function(t,n){if(t)return t=/notfound/i.test(t)||t.notFound?new g("Key not found in database ["+e+"]",t):new b(t),r(t);r(null,n)}))),n},w.prototype.put=function(e,t,r,n){var i,o=this;return(n=d(r,n))||(i=(n=l()).promise),_(this,n)||(r=p(r),this.db.put(e,t,r,(function(r){if(r)return n(new y(r));o.emit("put",e,t),n()}))),i},w.prototype.del=function(e,t,r){var n,i=this;return(r=d(t,r))||(n=(r=l()).promise),_(this,r)||(t=p(t),this.db.del(e,t,(function(t){if(t)return r(new y(t));i.emit("del",e),r()}))),n},w.prototype.batch=function(e,t,r){if(!arguments.length)return new c(this);var n,i=this;return(r="function"==typeof e?e:d(t,r))||(n=(r=l()).promise),_(this,r)||(t=p(t),this.db.batch(e,t,(function(t){if(t)return r(new y(t));i.emit("batch",e),r()}))),n},w.prototype.iterator=function(e){return this.db.iterator(e)},w.prototype.clear=function(e,t){var r,n=this;return t=d
  25. /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
  26. t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,u=c>>1,f=-7,h=r?i-1:0,l=r?-1:1,d=e[t+h];for(h+=l,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=256*o+e[t+h],h+=l,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+e[t+h],h+=l,f-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=u}return(d?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,c,u=8*o-i-1,f=(1<<u)-1,h=f>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=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=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+h>=1?l/c:l*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=f?(a=0,s=f):s+h>=1?(a=(t*c-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[r+d]=255&s,d+=p,s/=256,u-=8);e[r+d-p]|=128*y}},function(e,t,r){"use strict";const n=async(e,t)=>{let r=0;for(const i of e){if(await t(await i,r++)===n.stop)break}return e};n.stop=Symbol("pEachSeries.stop"),e.exports=n,e.exports.default=n},function(e,t,r){"use strict";var n=Object.prototype.hasOwnProperty,i="~";function o(){}function s(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function a(e,t,r,n,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new s(r,n||e,o),c=i?i+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function c(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function u(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(i=!1)),u.prototype.eventNames=function(){var e,t,r=[];if(0===this._eventsCount)return r;for(t in e=this._events)n.call(e,t)&&r.push(i?t.slice(1):t);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},u.prototype.listeners=function(e){var t=i?i+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,o=r.length,s=new Array(o);n<o;n++)s[n]=r[n].fn;return s},u.prototype.listenerCount=function(e){var t=i?i+e:e,r=this._events[t];return r?r.fn?1:r.length:0},u.prototype.emit=function(e,t,r,n,o,s){var a=i?i+e:e;if(!this._events[a])return!1;var c,u,f=this._events[a],h=arguments.length;if(f.fn){switch(f.once&&this.removeListener(e,f.fn,void 0,!0),h){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,t),!0;case 3:return f.fn.call(f.context,t,r),!0;case 4:return f.fn.call(f.context,t,r,n),!0;case 5:return f.fn.call(f.context,t,r,n,o),!0;case 6:return f.fn.call(f.context,t,r,n,o,s),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];f.fn.apply(f.context,c)}else{var l,d=f.length;for(u=0;u<d;u++)switch(f[u].once&&this.removeListener(e,f[u].fn,void 0,!0),h){case 1:f[u].fn.call(f[u].context);break;case 2:f[u].fn.call(f[u].context,t);break;case 3:f[u].fn.call(f[u].context,t,r);break;case 4:f[u].fn.call(f[u].context,t,r,n);break;default:if(!c)for(l=1,c=new Array(h-1);l<h;l++)c[l-1]=arguments[l];f[u].fn.apply(f[u].context,c)}}return!0},u.prototype.on=function(e,t,r){return a(this,e,t,r,!1)},u.prototype.once=function(e,t,r){return a(this,e,t,r,!0)},u.prototype.removeListener=function(e,t,r,n){var o=i?i+e:e;if(!this._events[o])return this;if(!t)return c(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||n&&!s.once||r&&s.context!==r||c(this,o);else{for(var a=0,u=[],f=s.length;a<f;a++)(s[a].fn!==t||n&&!s[a].once||r&&s[a].context!==r)&&u.push(s[a]);u.length?this._events[o]=1===u.length?u[0]:u:c(this,o)}return this},u.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&c(this,t)):(this._events=new o,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=i,u.EventEmitter=u,e.exports=u},function(e,t,r){"use strict";const n=r(227);class i extends Error{constructor(e){super(e),this.name="TimeoutError"}}const o=(e,t,r)=>new Promise((o,s)=>{if("number"!=typeof t||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t===1/0)return void o(e);co
  27. /*!
  28. * prr
  29. * (c) 2013 Rod Vagg <rod@vagg.org>
  30. * https://github.com/rvagg/prr
  31. * License: MIT
  32. */
  33. var n,i;n=this,i=function(){var e="function"==typeof Object.defineProperty?function(e,t,r){return Object.defineProperty(e,t,r),e}:function(e,t,r){return e[t]=r.value,e};return function(t,r,n,i){var o;if(i=function(e,t){var r="object"==typeof t,n=!r&&"string"==typeof t,i=function(e){return r?!!t[e]:!!n&&t.indexOf(e[0])>-1};return{enumerable:i("enumerable"),configurable:i("configurable"),writable:i("writable"),value:e}}(n,i),"object"==typeof r){for(o in r)Object.hasOwnProperty.call(r,o)&&(i.value=r[o],e(t,o,i));return t}return e(t,r,i)}},e.exports?e.exports=i():n.prr=i()},function(e,t,r){"use strict";
  34. /*
  35. object-assign
  36. (c) Sindre Sorhus
  37. @license MIT
  38. */var n=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={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,a,c=s(e),u=1;u<arguments.length;u++){for(var f in r=Object(arguments[u]))i.call(r,f)&&(c[f]=r[f]);if(n){a=n(r);for(var h=0;h<a.length;h++)o.call(r,a[h])&&(c[a[h]]=r[a[h]])}}return c}},function(e,t,r){"use strict";var n=r(69).AbstractLevelDOWN,i=r(69).AbstractChainedBatch,o=r(69).AbstractIterator,s=r(1),a=r(315),c=r(68).EncodingError,u=["approximateSize","compactRange"];function f(e,t){if(!(this instanceof f))return new f(e,t);var r=e.supports||{},i=r.additionalMethods||{};n.call(this,r),this.supports.encodings=!0,this.supports.additionalMethods={},u.forEach((function(t){var r="function"==typeof e[t];(i[t]||r)&&(this.supports.additionalMethods[t]=!0,this[t]=function(e,r,n,i){return e=this.codec.encodeKey(e,n),r=this.codec.encodeKey(r,n),this.db[t](e,r,n,i)})}),this),void 0===(t=t||{}).keyEncoding&&(t.keyEncoding="utf8"),void 0===t.valueEncoding&&(t.valueEncoding="utf8"),this.db=e,this.codec=new a(t)}function h(e,t){o.call(this,e),this.codec=e.codec,this.keys=t.keys,this.values=t.values,this.opts=this.codec.encodeLtgt(t),this.it=e.db.iterator(this.opts)}function l(e,t){i.call(this,e),this.codec=e.codec,this.batch=e.db.batch()}e.exports=f.default=f,s(f,n),f.prototype.type="encoding-down",f.prototype._serializeKey=f.prototype._serializeValue=function(e){return e},f.prototype._open=function(e,t){this.db.open(e,t)},f.prototype._close=function(e){this.db.close(e)},f.prototype._put=function(e,t,r,n){e=this.codec.encodeKey(e,r),t=this.codec.encodeValue(t,r),this.db.put(e,t,r,n)},f.prototype._get=function(e,t,r){var n=this;e=this.codec.encodeKey(e,t),t.asBuffer=this.codec.valueAsBuffer(t),this.db.get(e,t,(function(e,i){if(e)return r(e);try{i=n.codec.decodeValue(i,t)}catch(e){return r(new c(e))}r(null,i)}))},f.prototype._del=function(e,t,r){e=this.codec.encodeKey(e,t),this.db.del(e,t,r)},f.prototype._chainedBatch=function(){return new l(this)},f.prototype._batch=function(e,t,r){e=this.codec.encodeBatch(e,t),this.db.batch(e,t,r)},f.prototype._iterator=function(e){return e.keyAsBuffer=this.codec.keyAsBuffer(e),e.valueAsBuffer=this.codec.valueAsBuffer(e),new h(this,e)},f.prototype._clear=function(e,t){e=this.codec.encodeLtgt(e),this.db.clear(e,t)},s(h,o),h.prototype._next=function(e){var t=this;this.it.next((function(r,n,i){if(r)return e(r);try{n=t.keys&&void 0!==n?t.codec.decodeKey(n,t.opts):void 0,i=t.values&&void 0!==i?t.codec.decodeValue(i,t.opts):void 0}catch(r){return e(new c(r))}e(null,n,i)}))},h.prototype._seek=function(e){e=this.codec.encodeKey(e,this.opts),this.it.seek(e)},h.prototype._end=function(e){this.it.end(e)},s(l,i),l.prototype._put=function(e,t){e=this.codec.encodeKey(e),t=this.codec.encodeValue(t),this.batch.put(e,t)},l.prototype._del=function(e){e=this.codec.encodeKey(e),this.batch.del(e)},l.prototype._clear=function(){this.batch.clear()},l.prototype._write=function(e,t){this.batch.write(e,t)}},function(e,t,r){var n=r(9),i=r(65),o=r(0).Buffer,s=r(137),a=r(138),c=r(70),u=Object.prototype.hasOwnProperty,f="start end gt gte lt lte".split(" ");function h(e){this.status="new",this.supports=i(e,{status:!0})}function l(e,t){var r={};for(var n in t)if(u.call(t,n)){var i=t[n];d(n)&&(i=e._serializeKey(i)),r[n]=i}return r}function d(e){return-1!==f.indexOf(e)}h.prototype.open=function(e,t){var r=this,n=this.status;if("function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("open() requires a callback
  39. /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
  40. var n=r(0),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},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 n.SlowBuffer(e)}},function(e,t,r){(t=e.exports=r(156)).Stream=t,t.Readable=t,t.Writable=r(160),t.Duplex=r(31),t.Transform=r(161),t.PassThrough=r(346),t.finished=r(74),t.pipeline=r(347)},function(e,t){},function(e,t,r){"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s=r(0).Buffer,a=r(343).inspect,c=a&&a.custom||"inspect";e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,r,u;return t=e,(r=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return s.alloc(0);for(var t,r,n,i=s.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,r=i,n=a,s.prototype.copy.call(t,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=s.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:c,value:function(e,t){return a(this,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},t,{depth:0,customInspect:!1}))}}])&&o(t.prototype,r),u&&o(t,u),e}()},function(e,t){},function(e,t,r){"use strict";(function(t){var n;function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,confi
  41. /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
  42. var n=r(0),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},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 n.SlowBuffer(e)}},function(e,t,r){"use strict";e.exports=async(e,t,r,n)=>{const i=async()=>{const n=await e.pubsub.peers(r);return 0===t.map(e=>n.includes(e)).filter(e=>!1===e).length};return await i()?Promise.resolve():new Promise(async(e,t)=>{const r=setInterval(async()=>{try{n()?clearInterval(r):await i()&&(clearInterval(r),e())}catch(e){t(e)}},100)})}},function(e,t,r){"use strict";e.exports=async e=>(await e.id()).id},function(e,t,r){"use strict";const n=r(515),i=r(18);e.exports={isDefined:n,io:i}},function(e,t,r){"use strict";e.exports=e=>null!=e},function(module,exports,__webpack_require__){"use strict";const levelup=__webpack_require__(203),level=__webpack_require__(530),fs="object"==typeof window||"object"==typeof self?null:eval('require("fs")');class Storage{constructor(e,t={}){this.storage=e,this.preCreate=t.preCreate?t.preCreate:()=>{};const r=Object.assign({},t,{createIfMissing:!0,errorIfExists:!1,compression:!0,cacheSize:8388608});delete r.preCreate,this.options={down:r}}createStore(e="./orbitdb",t={}){return new Promise(async(r,n)=>{let i,o;if(this.options.up=t,await this.preCreate(e,this.options),this.storage)o=this.storage(e,this.options.down),o.status||(o.status="unknown-shim"),o.location||(o.location=e),i=levelup(o,t),i.open(e=>{if(e)return n(e);o&&"unknown-shim"===o.status&&(o.status="open"),r(i)});else{fs&&fs.mkdirSync&&fs.mkdirSync(e,{recursive:!0});const n=level(e,t);await n.open(),r(n)}})}destroy(e){return new Promise((t,r)=>{this.storage.destroy||t(),this.storage.destroy(e._db.location,e=>{if(e)return r(e);t()})})}async preCreate(e,t){}}module.exports=(e,t)=>new Storage(e,t)},function(e,t,r){var n=r(204).AbstractLevelDOWN,i=r(1),o=r(519),s="put get del batch clear".split(" "),a="approximateSize compactRange".split(" ");function c(e){n.call(this,e.supports||{}),a.forEach((function(t){"function"!=typeof e[t]||this.supports.additionalMethods[t]||(this.supports.additionalMethods[t]=!0)}),this),this._db=e,this._operations=[],u(this)}function u(e){s.forEach((function(t){e["_"+t]=function(){this._operations.push({method:t,args:arguments})}})),Object.keys(e.supports.additionalMethods).forEach((function(t){e[t]=function(){this._operations.push({method:t,args:arguments})}})),e._iterator=function(t){var r=new o(e,t);return this._operations.push({iterator:r}),r}}i(c,n),c.prototype.type="deferred-leveldown",c.prototype._open=function(e,t){var r=this;this._db.open(e,(function(e){if(e)return t(e);r._operations.forEach((function(e){e.iterator?e.iterator.setDb(r._db):r._db[e.method].apply(r._db,e.args)})),r._operations=[],function(e){s.concat("iterator").forEach((function(t){e["_"+t]=function(){return this._db[t].apply(this._db,arguments)}})),Object.keys(e.supports.additionalMethods).forEach((function(t){e[t]=function(){return this._db[t].apply(this._db,arguments)}}))}(r),t()}))},c.prototype._close=function(e){var t=this;this._db.close((function(r){if(r)return e(r);u(t),e()}))},c.prototype._serializeKey=function(e){return e},c.prototype._serializeValue=function(e){return e},e.exports=c,e.exports.DeferredIterator=o},function(e,t,r){var n=r(9),i=r(94),o=r(0).Buffer,s=r(205),a=r(206),c=r(95),u=Object.prototype.hasOwnProperty,f="start end gt gte lt lte".split(" ");function h(e){this.status="new",this.supports=i(e,{status:!0})}function l(e,t){var r={};for(var n in t)if(u.call(t,n)){var i=t[n];d(n
  43. //# sourceMappingURL=orbitdb.js.map