Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

blockstore-core

Package Overview
Dependencies
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blockstore-core - npm Package Compare versions

Comparing version 4.3.9 to 4.3.10

2

dist/index.min.js
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.BlockstoreCore = factory()}(typeof self !== 'undefined' ? self : this, function () {
"use strict";var BlockstoreCore=(()=>{var st=Object.create;var K=Object.defineProperty;var it=Object.getOwnPropertyDescriptor;var at=Object.getOwnPropertyNames;var ct=Object.getPrototypeOf,ut=Object.prototype.hasOwnProperty;var Z=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ve=(t,e)=>{for(var r in e)K(t,r,{get:e[r],enumerable:!0})},Ee=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of at(e))!ut.call(t,o)&&o!==r&&K(t,o,{get:()=>e[o],enumerable:!(n=it(e,o))||n.enumerable});return t};var Fe=(t,e,r)=>(r=t!=null?st(ct(t)):{},Ee(e||!t||!t.__esModule?K(r,"default",{value:t,enumerable:!0}):r,t)),ft=t=>Ee(K({},"__esModule",{value:!0}),t);var Ue=Z((vr,Se)=>{"use strict";function Ae(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function lt(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return Ae(t,r)}catch{r.message=t.message,r.stack=t.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(t)),Ae(new o,r)}}Se.exports=lt});var _e=Z((on,qe)=>{var j=1e3,V=j*60,q=V*60,R=q*24,Gt=R*7,Qt=R*365.25;qe.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Xt(t);if(r==="number"&&isFinite(t))return e.long?Zt(t):Kt(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Xt(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Qt;case"weeks":case"week":case"w":return r*Gt;case"days":case"day":case"d":return r*R;case"hours":case"hour":case"hrs":case"hr":case"h":return r*q;case"minutes":case"minute":case"mins":case"min":case"m":return r*V;case"seconds":case"second":case"secs":case"sec":case"s":return r*j;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Kt(t){var e=Math.abs(t);return e>=R?Math.round(t/R)+"d":e>=q?Math.round(t/q)+"h":e>=V?Math.round(t/V)+"m":e>=j?Math.round(t/j)+"s":t+"ms"}function Zt(t){var e=Math.abs(t);return e>=R?te(t,e,R,"day"):e>=q?te(t,e,q,"hour"):e>=V?te(t,e,V,"minute"):e>=j?te(t,e,j,"second"):t+" ms"}function te(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var Ge=Z((sn,Je)=>{function Wt(t){r.debug=r,r.default=r,r.coerce=y,r.disable=s,r.enable=o,r.enabled=i,r.humanize=_e(),r.destroy=E,Object.keys(t).forEach(a=>{r[a]=t[a]}),r.names=[],r.skips=[],r.formatters={};function e(a){let d=0;for(let p=0;p<a.length;p++)d=(d<<5)-d+a.charCodeAt(p),d|=0;return r.colors[Math.abs(d)%r.colors.length]}r.selectColor=e;function r(a){let d,p=null,k,u;function l(...f){if(!l.enabled)return;let h=l,b=Number(new Date),w=b-(d||b);h.diff=w,h.prev=d,h.curr=b,d=b,f[0]=r.coerce(f[0]),typeof f[0]!="string"&&f.unshift("%O");let m=0;f[0]=f[0].replace(/%([a-zA-Z%])/g,(v,g)=>{if(v==="%%")return"%";m++;let C=r.formatters[g];if(typeof C=="function"){let U=f[m];v=C.call(h,U),f.splice(m,1),m--}return v}),r.formatArgs.call(h,f),(h.log||r.log).apply(h,f)}return l.namespace=a,l.useColors=r.useColors(),l.color=r.selectColor(a),l.extend=n,l.destroy=r.destroy,Object.defineProperty(l,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(k!==r.namespaces&&(k=r.namespaces,u=r.enabled(a)),u),set:f=>{p=f}}),typeof r.init=="function"&&r.init(l),l}function n(a,d){let p=r(this.namespace+(typeof d>"u"?":":d)+a);return p.log=this.log,p}function o(a){r.save(a),r.namespaces=a,r.names=[],r.skips=[];let d,p=(typeof a=="string"?a:"").split(/[\s,]+/),k=p.length;for(d=0;d<k;d++)p[d]&&(a=p[d].replace(/\*/g,".*?"),a[0]==="-"?r.skips.push(new RegExp("^"+a.slice(1)+"$")):r.names.push(new RegExp("^"+a+"$")))}function s(){let a=[...r.names.map(c),...r.skips.map(c).map(d=>"-"+d)].join(",");return r.enable(""),a}function i(a){if(a[a.length-1]==="*")return!0;let d,p;for(d=0,p=r.skips.length;d<p;d++)if(r.skips[d].test(a))return!1;for(d=0,p=r.names.length;d<p;d++)if(r.names[d].test(a))return!0;return!1}function c(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}function y(a){return a instanceof Error?a.stack||a.message:a}function E(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}Je.exports=Wt});var Qe=Z((A,re)=>{A.formatArgs=Yt;A.save=er;A.load=tr;A.useColors=Ht;A.storage=rr();A.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();A.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Ht(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Yt(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+re.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}A.log=console.debug||console.log||(()=>{});function er(t){try{t?A.storage.setItem("debug",t):A.storage.removeItem("debug")}catch{}}function tr(){let t;try{t=A.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function rr(){try{return localStorage}catch{}}re.exports=Ge()(A);var{formatters:nr}=re.exports;nr.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var xr={};ve(xr,{BaseBlockstore:()=>z,BlackHoleBlockstore:()=>ee,Errors:()=>gr,MemoryBlockstore:()=>Y,TieredBlockstore:()=>se});var P={};ve(P,{abortedError:()=>mt,closeFailedError:()=>ht,deleteFailedError:()=>ae,getFailedError:()=>pt,hasFailedError:()=>bt,notFoundError:()=>O,openFailedError:()=>dt,putFailedError:()=>ie});var M=Fe(Ue(),1);function dt(t){return t=t??new Error("Open failed"),(0,M.default)(t,"ERR_OPEN_FAILED")}function ht(t){return t=t??new Error("Close failed"),(0,M.default)(t,"ERR_CLOSE_FAILED")}function ie(t){return t=t??new Error("Put failed"),(0,M.default)(t,"ERR_PUT_FAILED")}function pt(t){return t=t??new Error("Get failed"),(0,M.default)(t,"ERR_GET_FAILED")}function ae(t){return t=t??new Error("Delete failed"),(0,M.default)(t,"ERR_DELETE_FAILED")}function bt(t){return t=t??new Error("Has failed"),(0,M.default)(t,"ERR_HAS_FAILED")}function O(t){return t=t??new Error("Not Found"),(0,M.default)(t,"ERR_NOT_FOUND")}function mt(t){return t=t??new Error("Aborted"),(0,M.default)(t,"ERR_ABORTED")}var z=class{has(e,r){return Promise.reject(new Error(".has is not implemented"))}put(e,r,n){return Promise.reject(new Error(".put is not implemented"))}async*putMany(e,r){for await(let{cid:n,block:o}of e)await this.put(n,o,r),yield n}get(e,r){return Promise.reject(new Error(".get is not implemented"))}async*getMany(e,r){for await(let n of e)yield{cid:n,block:await this.get(n,r)}}async delete(e,r){await Promise.reject(new Error(".delete is not implemented"))}async*deleteMany(e,r){for await(let n of e)await this.delete(n,r),yield n}async*getAll(e){throw new Error(".getAll is not implemented")}};var Fr=new Uint8Array(0);function Ie(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}function N(t){if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")}function yt(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<t.length;o++){var s=t.charAt(o),i=s.charCodeAt(0);if(r[i]!==255)throw new TypeError(s+" is ambiguous");r[i]=o}var c=t.length,y=t.charAt(0),E=Math.log(c)/Math.log(256),a=Math.log(256)/Math.log(c);function d(u){if(u instanceof Uint8Array||(ArrayBuffer.isView(u)?u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength):Array.isArray(u)&&(u=Uint8Array.from(u))),!(u instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(u.length===0)return"";for(var l=0,f=0,h=0,b=u.length;h!==b&&u[h]===0;)h++,l++;for(var w=(b-h)*a+1>>>0,m=new Uint8Array(w);h!==b;){for(var x=u[h],v=0,g=w-1;(x!==0||v<f)&&g!==-1;g--,v++)x+=256*m[g]>>>0,m[g]=x%c>>>0,x=x/c>>>0;if(x!==0)throw new Error("Non-zero carry");f=v,h++}for(var C=w-f;C!==w&&m[C]===0;)C++;for(var U=y.repeat(l);C<w;++C)U+=t.charAt(m[C]);return U}function p(u){if(typeof u!="string")throw new TypeError("Expected String");if(u.length===0)return new Uint8Array;var l=0;if(u[l]!==" "){for(var f=0,h=0;u[l]===y;)f++,l++;for(var b=(u.length-l)*E+1>>>0,w=new Uint8Array(b);u[l];){var m=r[u.charCodeAt(l)];if(m===255)return;for(var x=0,v=b-1;(m!==0||x<h)&&v!==-1;v--,x++)m+=c*w[v]>>>0,w[v]=m%256>>>0,m=m/256>>>0;if(m!==0)throw new Error("Non-zero carry");h=x,l++}if(u[l]!==" "){for(var g=b-h;g!==b&&w[g]===0;)g++;for(var C=new Uint8Array(f+(b-g)),U=f;g!==b;)C[U++]=w[g++];return C}}}function k(u){var l=p(u);if(l)return l;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:p,decode:k}}var wt=yt,gt=wt,ke=gt;var ce=class{name;prefix;baseEncode;constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},ue=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return ze(this,e)}},fe=class{decoders;constructor(e){this.decoders=e}or(e){return ze(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function ze(t,e){return new fe({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var le=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,r,n,o){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new ce(e,r,n),this.decoder=new ue(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function De({name:t,prefix:e,encode:r,decode:n}){return new le(t,e,r,n)}function de({name:t,prefix:e,alphabet:r}){let{encode:n,decode:o}=ke(r,t);return De({prefix:e,name:t,encode:n,decode:s=>N(o(s))})}function xt(t,e,r,n){let o={};for(let a=0;a<e.length;++a)o[e[a]]=a;let s=t.length;for(;t[s-1]==="=";)--s;let i=new Uint8Array(s*r/8|0),c=0,y=0,E=0;for(let a=0;a<s;++a){let d=o[t[a]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);y=y<<r|d,c+=r,c>=8&&(c-=8,i[E++]=255&y>>c)}if(c>=r||255&y<<8-c)throw new SyntaxError("Unexpected end of data");return i}function Ct(t,e,r){let n=e[e.length-1]==="=",o=(1<<r)-1,s="",i=0,c=0;for(let y=0;y<t.length;++y)for(c=c<<8|t[y],i+=8;i>r;)i-=r,s+=e[o&c>>i];if(i!==0&&(s+=e[o&c<<r-i]),n)for(;s.length*r&7;)s+="=";return s}function D({name:t,prefix:e,bitsPerChar:r,alphabet:n}){return De({prefix:e,name:t,encode(o){return Ct(o,n,r)},decode(o){return xt(o,n,r,t)}})}var I=D({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Dr=D({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Mr=D({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Lr=D({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Or=D({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Nr=D({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Rr=D({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Pr=D({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Tr=D({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var L=de({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),jr=de({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var vt=Oe,Me=128,Et=127,Ft=~Et,At=Math.pow(2,31);function Oe(t,e,r){e=e||[],r=r||0;for(var n=r;t>=At;)e[r++]=t&255|Me,t/=128;for(;t&Ft;)e[r++]=t&255|Me,t>>>=7;return e[r]=t|0,Oe.bytes=r-n+1,e}var St=he,Ut=128,Le=127;function he(t,n){var r=0,n=n||0,o=0,s=n,i,c=t.length;do{if(s>=c)throw he.bytes=0,new RangeError("Could not decode varint");i=t[s++],r+=o<28?(i&Le)<<o:(i&Le)*Math.pow(2,o),o+=7}while(i>=Ut);return he.bytes=s-n,r}var It=Math.pow(2,7),kt=Math.pow(2,14),zt=Math.pow(2,21),Dt=Math.pow(2,28),Mt=Math.pow(2,35),Lt=Math.pow(2,42),Ot=Math.pow(2,49),Nt=Math.pow(2,56),Rt=Math.pow(2,63),Pt=function(t){return t<It?1:t<kt?2:t<zt?3:t<Dt?4:t<Mt?5:t<Lt?6:t<Ot?7:t<Nt?8:t<Rt?9:10},Tt={encode:vt,decode:St,encodingLength:Pt},Bt=Tt,J=Bt;function G(t,e=0){return[J.decode(t,e),J.decode.bytes]}function T(t,e,r=0){return J.encode(t,e,r),e}function B(t){return J.encodingLength(t)}function Re(t,e){let r=e.byteLength,n=B(t),o=n+B(r),s=new Uint8Array(o+r);return T(t,s,0),T(r,s,n),s.set(e,o),new $(t,r,e,s)}function W(t){let e=N(t),[r,n]=G(e),[o,s]=G(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new $(r,o,i,e)}function Pe(t,e){if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Ie(t.bytes,r.bytes)}}var $=class{code;size;digest;bytes;constructor(e,r,n,o){this.code=e,this.size=r,this.digest=n,this.bytes=o}};function Be(t,e){let{bytes:r,version:n}=t;switch(n){case 0:return jt(r,pe(t),e??L.encoder);default:return Vt(r,pe(t),e??I.encoder)}}var $e=new WeakMap;function pe(t){let e=$e.get(t);if(e==null){let r=new Map;return $e.set(t,r),r}return e}var H=class t{code;version;multihash;bytes;"/";constructor(e,r,n,o){this.code=r,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==Q)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==qt)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=Re(e,r);return t.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return t.equals(this,e)}static equals(e,r){let n=r;return n!=null&&e.code===n.code&&e.version===n.version&&Pe(e.multihash,n.multihash)}toString(e){return Be(this,e)}toJSON(){return{"/":Be(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof t)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:s,bytes:i}=r;return new t(n,o,s,i??je(n,o,s.bytes))}else if(r[_t]===!0){let{version:n,multihash:o,code:s}=r,i=W(o);return t.create(n,s,i)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==Q)throw new Error(`Version 0 CID must use dag-pb (code: ${Q}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let o=je(e,r,n.bytes);return new t(e,r,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,Q,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,o=N(e.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=o.subarray(r.multihashSize-r.digestSize),i=new $(r.multihashCode,r.digestSize,s,o);return[r.version===0?t.createV0(i):t.createV1(r.codec,i),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[d,p]=G(e.subarray(r));return r+=p,d},o=n(),s=Q;if(o===18?(o=0,r=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=r,c=n(),y=n(),E=r+y,a=E-i;return{version:o,codec:s,multihashCode:c,digestSize:y,multihashSize:a,size:E}}static parse(e,r){let[n,o]=$t(e,r),s=t.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return pe(s).set(n,e),s}};function $t(t,e){switch(t[0]){case"Q":{let r=e??L;return[L.prefix,r.decode(`${L.prefix}${t}`)]}case L.prefix:{let r=e??L;return[L.prefix,r.decode(t)]}case I.prefix:{let r=e??I;return[I.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}}function jt(t,e,r){let{prefix:n}=r;if(n!==L.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=e.get(n);if(o==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return o}function Vt(t,e,r){let{prefix:n}=r,o=e.get(n);if(o==null){let s=r.encode(t);return e.set(n,s),s}else return o}var Q=112,qt=18;function je(t,e,r){let n=B(t),o=n+B(e),s=new Uint8Array(o+r.byteLength);return T(t,s,0),T(e,s,n),s.set(r,o),s}var _t=Symbol.for("@ipld/js-cid/CID");var Ve=85;var Y=class extends z{data;constructor(){super(),this.data=new Map}put(e,r){return this.data.set(I.encode(e.multihash.bytes),r),e}get(e){let r=this.data.get(I.encode(e.multihash.bytes));if(r==null)throw O();return r}has(e){return this.data.has(I.encode(e.multihash.bytes))}async delete(e){this.data.delete(I.encode(e.multihash.bytes))}async*getAll(){for(let[e,r]of this.data.entries())yield{cid:H.createV1(Ve,W(I.decode(e))),block:r}}};var ee=class extends z{put(e){return e}get(){throw O()}has(){return!1}async delete(){}async*getAll(){}};var S=Fe(Qe(),1);function or(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<t.length;o++){var s=t.charAt(o),i=s.charCodeAt(0);if(r[i]!==255)throw new TypeError(s+" is ambiguous");r[i]=o}var c=t.length,y=t.charAt(0),E=Math.log(c)/Math.log(256),a=Math.log(256)/Math.log(c);function d(u){if(u instanceof Uint8Array||(ArrayBuffer.isView(u)?u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength):Array.isArray(u)&&(u=Uint8Array.from(u))),!(u instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(u.length===0)return"";for(var l=0,f=0,h=0,b=u.length;h!==b&&u[h]===0;)h++,l++;for(var w=(b-h)*a+1>>>0,m=new Uint8Array(w);h!==b;){for(var x=u[h],v=0,g=w-1;(x!==0||v<f)&&g!==-1;g--,v++)x+=256*m[g]>>>0,m[g]=x%c>>>0,x=x/c>>>0;if(x!==0)throw new Error("Non-zero carry");f=v,h++}for(var C=w-f;C!==w&&m[C]===0;)C++;for(var U=y.repeat(l);C<w;++C)U+=t.charAt(m[C]);return U}function p(u){if(typeof u!="string")throw new TypeError("Expected String");if(u.length===0)return new Uint8Array;var l=0;if(u[l]!==" "){for(var f=0,h=0;u[l]===y;)f++,l++;for(var b=(u.length-l)*E+1>>>0,w=new Uint8Array(b);u[l];){var m=r[u.charCodeAt(l)];if(m===255)return;for(var x=0,v=b-1;(m!==0||x<h)&&v!==-1;v--,x++)m+=c*w[v]>>>0,w[v]=m%256>>>0,m=m/256>>>0;if(m!==0)throw new Error("Non-zero carry");h=x,l++}if(u[l]!==" "){for(var g=b-h;g!==b&&w[g]===0;)g++;for(var C=new Uint8Array(f+(b-g)),U=f;g!==b;)C[U++]=w[g++];return C}}}function k(u){var l=p(u);if(l)return l;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:p,decode:k}}var sr=or,ir=sr,Xe=ir;var cn=new Uint8Array(0);var Ke=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};var be=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},me=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Ze(this,e)}},ye=class{constructor(e){this.decoders=e}or(e){return Ze(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Ze=(t,e)=>new ye({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),we=class{constructor(e,r,n,o){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new be(e,r,n),this.decoder=new me(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},We=({name:t,prefix:e,encode:r,decode:n})=>new we(t,e,r,n),ge=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:o}=Xe(r,e);return We({prefix:t,name:e,encode:n,decode:s=>Ke(o(s))})},ar=(t,e,r,n)=>{let o={};for(let a=0;a<e.length;++a)o[e[a]]=a;let s=t.length;for(;t[s-1]==="=";)--s;let i=new Uint8Array(s*r/8|0),c=0,y=0,E=0;for(let a=0;a<s;++a){let d=o[t[a]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);y=y<<r|d,c+=r,c>=8&&(c-=8,i[E++]=255&y>>c)}if(c>=r||255&y<<8-c)throw new SyntaxError("Unexpected end of data");return i},cr=(t,e,r)=>{let n=e[e.length-1]==="=",o=(1<<r)-1,s="",i=0,c=0;for(let y=0;y<t.length;++y)for(c=c<<8|t[y],i+=8;i>r;)i-=r,s+=e[o&c>>i];if(i&&(s+=e[o&c<<r-i]),n)for(;s.length*r&7;)s+="=";return s},F=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>We({prefix:e,name:t,encode(o){return cr(o,n,r)},decode(o){return ar(o,n,r,t)}});var He=F({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),pn=F({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),bn=F({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),mn=F({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),yn=F({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),wn=F({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),gn=F({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),xn=F({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Cn=F({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ye=ge({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Fn=ge({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var et=F({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Un=F({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),In=F({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),kn=F({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});S.default.formatters.b=t=>t==null?"undefined":Ye.baseEncode(t);S.default.formatters.t=t=>t==null?"undefined":He.baseEncode(t);S.default.formatters.m=t=>t==null?"undefined":et.baseEncode(t);S.default.formatters.p=t=>t==null?"undefined":t.toString();S.default.formatters.c=t=>t==null?"undefined":t.toString();S.default.formatters.k=t=>t==null?"undefined":t.toString();S.default.formatters.a=t=>t==null?"undefined":t.toString();function ur(t){let e=()=>{};return e.enabled=!1,e.color="",e.diff=0,e.log=()=>{},e.namespace=t,e.destroy=()=>!0,e.extend=()=>e,e}function tt(t){let e=ur(`${t}:trace`);return S.default.enabled(`${t}:trace`)&&S.default.names.map(r=>r.toString()).find(r=>r.includes(":trace"))!=null&&(e=(0,S.default)(`${t}:trace`)),Object.assign((0,S.default)(t),{error:(0,S.default)(`${t}:error`),trace:e})}function fr(t){return t[Symbol.asyncIterator]!=null}function lr(t){if(fr(t))return(async()=>{for await(let e of t);})();for(let e of t);}var xe=lr;function dr(t){let[e,r]=t[Symbol.asyncIterator]!=null?[t[Symbol.asyncIterator](),Symbol.asyncIterator]:[t[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>e.next(),push:o=>{n.push(o)},next:()=>n.length>0?{done:!1,value:n.shift()}:e.next(),[r](){return this}}}var rt=dr;function hr(t){return t[Symbol.asyncIterator]!=null}function pr(t,e){if(hr(t))return async function*(){for await(let c of t)await e(c)&&(yield c)}();let r=rt(t),{value:n,done:o}=r.next();if(o===!0)return function*(){}();let s=e(n);if(typeof s.then=="function")return async function*(){await s&&(yield n);for await(let c of r)await e(c)&&(yield c)}();let i=e;return function*(){s===!0&&(yield n);for(let c of r)i(c)&&(yield c)}()}var nt=pr;function ne(){let t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}var oe=class{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},_=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new oe(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let r=this.head;this.head=r.next=new oe(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let r=this.tail.next;this.tail.next=null,this.tail=r,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};var Ce=class extends Error{type;code;constructor(e,r){super(e??"The operation was aborted"),this.type="aborted",this.code=r??"ABORT_ERR"}};function X(t={}){return br(r=>{let n=r.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},t)}function br(t,e){e=e??{};let r=e.onEnd,n=new _,o,s,i,c=ne(),y=async()=>{try{return n.isEmpty()?i?{done:!0}:await new Promise((f,h)=>{s=b=>{s=null,n.push(b);try{f(t(n))}catch(w){h(w)}return o}}):t(n)}finally{n.isEmpty()&&queueMicrotask(()=>{c.resolve(),c=ne()})}},E=f=>s!=null?s(f):(n.push(f),o),a=f=>(n=new _,s!=null?s({error:f}):(n.push({error:f}),o)),d=f=>{if(i)return o;if(e?.objectMode!==!0&&f?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return E({done:!1,value:f})},p=f=>i?o:(i=!0,f!=null?a(f):E({done:!0})),k=()=>(n=new _,p(),{done:!0}),u=f=>(p(f),{done:!0});if(o={[Symbol.asyncIterator](){return this},next:y,return:k,throw:u,push:d,end:p,get readableLength(){return n.size},onEmpty:async f=>{let h=f?.signal;if(h?.throwIfAborted(),n.isEmpty())return;let b,w;h!=null&&(b=new Promise((m,x)=>{w=()=>{x(new Ce)},h.addEventListener("abort",w)}));try{await Promise.race([c.promise,b])}finally{w!=null&&h!=null&&h?.removeEventListener("abort",w)}}},r==null)return o;let l=o;return o={[Symbol.asyncIterator](){return this},next(){return l.next()},throw(f){return l.throw(f),r!=null&&(r(f),r=void 0),{done:!0}},return(){return l.return(),r!=null&&(r(),r=void 0),{done:!0}},push:d,end(f){return l.end(f),r!=null&&(r(f),r=void 0),o},get readableLength(){return l.readableLength},onEmpty:f=>l.onEmpty(f)},o}function mr(t){return t[Symbol.asyncIterator]!=null}function yr(...t){let e=[];for(let r of t)mr(r)||e.push(r);return e.length===t.length?function*(){for(let r of e)yield*r}():async function*(){let r=X({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(t.map(async n=>{for await(let o of n)r.push(o)})),r.end()}catch(n){r.end(n)}}),yield*r}()}var ot=yr;var wr=tt("blockstore:core:tiered"),se=class extends z{stores;constructor(e){super(),this.stores=e.slice()}async put(e,r,n){try{return await Promise.all(this.stores.map(async o=>{await o.put(e,r,n)})),e}catch(o){throw ie(o)}}async get(e,r){for(let n of this.stores)try{let o=await n.get(e,r);if(o!=null)return o}catch(o){wr.error(o)}throw O()}async has(e,r){for(let n of this.stores)if(await n.has(e,r))return!0;return!1}async delete(e,r){try{await Promise.all(this.stores.map(async n=>{await n.delete(e,r)}))}catch(n){throw ae(n)}}async*putMany(e,r={}){let n,o=this.stores.map(s=>{let i=X({objectMode:!0});return xe(s.putMany(i,r)).catch(c=>{n=c}),i});try{for await(let s of e){if(n!=null)throw n;o.forEach(i=>i.push(s)),yield s.cid}}finally{o.forEach(s=>s.end())}}async*deleteMany(e,r={}){let n,o=this.stores.map(s=>{let i=X({objectMode:!0});return xe(s.deleteMany(i,r)).catch(c=>{n=c}),i});try{for await(let s of e){if(n!=null)throw n;o.forEach(i=>i.push(s)),yield s}}finally{o.forEach(s=>s.end())}}async*getAll(e){let r=new Set;yield*nt(ot(...this.stores.map(n=>n.getAll(e))),n=>{let o=n.cid.toString();return r.has(o)?!1:(r.add(o),!0)})}};var gr={...P};return ft(xr);})();
"use strict";var BlockstoreCore=(()=>{var Qe=Object.create;var X=Object.defineProperty;var Xe=Object.getOwnPropertyDescriptor;var Ze=Object.getOwnPropertyNames;var He=Object.getPrototypeOf,Ke=Object.prototype.hasOwnProperty;var Z=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),be=(t,e)=>{for(var r in e)X(t,r,{get:e[r],enumerable:!0})},ye=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ze(e))!Ke.call(t,o)&&o!==r&&X(t,o,{get:()=>e[o],enumerable:!(n=Xe(e,o))||n.enumerable});return t};var ge=(t,e,r)=>(r=t!=null?Qe(He(t)):{},ye(e||!t||!t.__esModule?X(r,"default",{value:t,enumerable:!0}):r,t)),We=t=>ye(X({},"__esModule",{value:!0}),t);var Ce=Z((sr,xe)=>{"use strict";function we(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function Ye(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return we(t,r)}catch{r.message=t.message,r.stack=t.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(t)),we(new o,r)}}xe.exports=Ye});var Te=Z(($r,Re)=>{var B=1e3,$=B*60,V=$*60,U=V*24,Ut=U*7,Nt=U*365.25;Re.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Pt(t);if(r==="number"&&isFinite(t))return e.long?Tt(t):Rt(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Pt(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Nt;case"weeks":case"week":case"w":return r*Ut;case"days":case"day":case"d":return r*U;case"hours":case"hour":case"hrs":case"hr":case"h":return r*V;case"minutes":case"minute":case"mins":case"min":case"m":return r*$;case"seconds":case"second":case"secs":case"sec":case"s":return r*B;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Rt(t){var e=Math.abs(t);return e>=U?Math.round(t/U)+"d":e>=V?Math.round(t/V)+"h":e>=$?Math.round(t/$)+"m":e>=B?Math.round(t/B)+"s":t+"ms"}function Tt(t){var e=Math.abs(t);return e>=U?ee(t,e,U,"day"):e>=V?ee(t,e,V,"hour"):e>=$?ee(t,e,$,"minute"):e>=B?ee(t,e,B,"second"):t+" ms"}function ee(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var Be=Z((Vr,je)=>{function jt(t){r.debug=r,r.default=r,r.coerce=y,r.disable=s,r.enable=o,r.enabled=a,r.humanize=Te(),r.destroy=I,Object.keys(t).forEach(i=>{r[i]=t[i]}),r.names=[],r.skips=[],r.formatters={};function e(i){let f=0;for(let h=0;h<i.length;h++)f=(f<<5)-f+i.charCodeAt(h),f|=0;return r.colors[Math.abs(f)%r.colors.length]}r.selectColor=e;function r(i){let f,h=null,M,d;function l(...c){if(!l.enabled)return;let p=l,m=Number(new Date),b=m-(f||m);p.diff=b,p.prev=f,p.curr=m,f=m,c[0]=r.coerce(c[0]),typeof c[0]!="string"&&c.unshift("%O");let g=0;c[0]=c[0].replace(/%([a-zA-Z%])/g,(S,C)=>{if(S==="%%")return"%";g++;let A=r.formatters[C];if(typeof A=="function"){let N=c[g];S=A.call(p,N),c.splice(g,1),g--}return S}),r.formatArgs.call(p,c),(p.log||r.log).apply(p,c)}return l.namespace=i,l.useColors=r.useColors(),l.color=r.selectColor(i),l.extend=n,l.destroy=r.destroy,Object.defineProperty(l,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(M!==r.namespaces&&(M=r.namespaces,d=r.enabled(i)),d),set:c=>{h=c}}),typeof r.init=="function"&&r.init(l),l}function n(i,f){let h=r(this.namespace+(typeof f>"u"?":":f)+i);return h.log=this.log,h}function o(i){r.save(i),r.namespaces=i,r.names=[],r.skips=[];let f,h=(typeof i=="string"?i:"").split(/[\s,]+/),M=h.length;for(f=0;f<M;f++)h[f]&&(i=h[f].replace(/\*/g,".*?"),i[0]==="-"?r.skips.push(new RegExp("^"+i.slice(1)+"$")):r.names.push(new RegExp("^"+i+"$")))}function s(){let i=[...r.names.map(u),...r.skips.map(u).map(f=>"-"+f)].join(",");return r.enable(""),i}function a(i){if(i[i.length-1]==="*")return!0;let f,h;for(f=0,h=r.skips.length;f<h;f++)if(r.skips[f].test(i))return!1;for(f=0,h=r.names.length;f<h;f++)if(r.names[f].test(i))return!0;return!1}function u(i){return i.toString().substring(2,i.toString().length-2).replace(/\.\*\?$/,"*")}function y(i){return i instanceof Error?i.stack||i.message:i}function I(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}je.exports=jt});var $e=Z((v,te)=>{v.formatArgs=$t;v.save=Vt;v.load=_t;v.useColors=Bt;v.storage=qt();v.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();v.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Bt(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function $t(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+te.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}v.log=console.debug||console.log||(()=>{});function Vt(t){try{t?v.storage.setItem("debug",t):v.storage.removeItem("debug")}catch{}}function _t(){let t;try{t=v.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function qt(){try{return localStorage}catch{}}te.exports=Be()(v);var{formatters:Jt}=te.exports;Jt.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var nr={};be(nr,{BaseBlockstore:()=>D,BlackHoleBlockstore:()=>Y,Errors:()=>rr,MemoryBlockstore:()=>W,TieredBlockstore:()=>oe});var P={};be(P,{abortedError:()=>ot,closeFailedError:()=>tt,deleteFailedError:()=>ie,getFailedError:()=>rt,hasFailedError:()=>nt,notFoundError:()=>z,openFailedError:()=>et,putFailedError:()=>se});var L=ge(Ce(),1);function et(t){return t=t??new Error("Open failed"),(0,L.default)(t,"ERR_OPEN_FAILED")}function tt(t){return t=t??new Error("Close failed"),(0,L.default)(t,"ERR_CLOSE_FAILED")}function se(t){return t=t??new Error("Put failed"),(0,L.default)(t,"ERR_PUT_FAILED")}function rt(t){return t=t??new Error("Get failed"),(0,L.default)(t,"ERR_GET_FAILED")}function ie(t){return t=t??new Error("Delete failed"),(0,L.default)(t,"ERR_DELETE_FAILED")}function nt(t){return t=t??new Error("Has failed"),(0,L.default)(t,"ERR_HAS_FAILED")}function z(t){return t=t??new Error("Not Found"),(0,L.default)(t,"ERR_NOT_FOUND")}function ot(t){return t=t??new Error("Aborted"),(0,L.default)(t,"ERR_ABORTED")}var D=class{has(e,r){return Promise.reject(new Error(".has is not implemented"))}put(e,r,n){return Promise.reject(new Error(".put is not implemented"))}async*putMany(e,r){for await(let{cid:n,block:o}of e)await this.put(n,o,r),yield n}get(e,r){return Promise.reject(new Error(".get is not implemented"))}async*getMany(e,r){for await(let n of e)yield{cid:n,block:await this.get(n,r)}}async delete(e,r){await Promise.reject(new Error(".delete is not implemented"))}async*deleteMany(e,r){for await(let n of e)await this.delete(n,r),yield n}async*getAll(e){throw new Error(".getAll is not implemented")}};var ar=new Uint8Array(0);function Ee(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}function O(t){if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")}function st(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<t.length;o++){var s=t.charAt(o),a=s.charCodeAt(0);if(r[a]!==255)throw new TypeError(s+" is ambiguous");r[a]=o}var u=t.length,y=t.charAt(0),I=Math.log(u)/Math.log(256),i=Math.log(256)/Math.log(u);function f(d){if(d instanceof Uint8Array||(ArrayBuffer.isView(d)?d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):Array.isArray(d)&&(d=Uint8Array.from(d))),!(d instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(d.length===0)return"";for(var l=0,c=0,p=0,m=d.length;p!==m&&d[p]===0;)p++,l++;for(var b=(m-p)*i+1>>>0,g=new Uint8Array(b);p!==m;){for(var x=d[p],S=0,C=b-1;(x!==0||S<c)&&C!==-1;C--,S++)x+=256*g[C]>>>0,g[C]=x%u>>>0,x=x/u>>>0;if(x!==0)throw new Error("Non-zero carry");c=S,p++}for(var A=b-c;A!==b&&g[A]===0;)A++;for(var N=y.repeat(l);A<b;++A)N+=t.charAt(g[A]);return N}function h(d){if(typeof d!="string")throw new TypeError("Expected String");if(d.length===0)return new Uint8Array;var l=0;if(d[l]!==" "){for(var c=0,p=0;d[l]===y;)c++,l++;for(var m=(d.length-l)*I+1>>>0,b=new Uint8Array(m);d[l];){var g=r[d.charCodeAt(l)];if(g===255)return;for(var x=0,S=m-1;(g!==0||x<p)&&S!==-1;S--,x++)g+=u*b[S]>>>0,b[S]=g%256>>>0,g=g/256>>>0;if(g!==0)throw new Error("Non-zero carry");p=x,l++}if(d[l]!==" "){for(var C=m-p;C!==m&&b[C]===0;)C++;for(var A=new Uint8Array(c+(m-C)),N=c;C!==m;)A[N++]=b[C++];return A}}}function M(d){var l=h(d);if(l)return l;throw new Error(`Non-${e} character`)}return{encode:f,decodeUnsafe:h,decode:M}}var it=st,at=it,ve=at;var ae=class{name;prefix;baseEncode;constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},ce=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Fe(this,e)}},ue=class{decoders;constructor(e){this.decoders=e}or(e){return Fe(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Fe(t,e){return new ue({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var fe=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,r,n,o){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new ae(e,r,n),this.decoder=new ce(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Se({name:t,prefix:e,encode:r,decode:n}){return new fe(t,e,r,n)}function le({name:t,prefix:e,alphabet:r}){let{encode:n,decode:o}=ve(r,t);return Se({prefix:e,name:t,encode:n,decode:s=>O(o(s))})}function ct(t,e,r,n){let o={};for(let i=0;i<e.length;++i)o[e[i]]=i;let s=t.length;for(;t[s-1]==="=";)--s;let a=new Uint8Array(s*r/8|0),u=0,y=0,I=0;for(let i=0;i<s;++i){let f=o[t[i]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);y=y<<r|f,u+=r,u>=8&&(u-=8,a[I++]=255&y>>u)}if(u>=r||255&y<<8-u)throw new SyntaxError("Unexpected end of data");return a}function ut(t,e,r){let n=e[e.length-1]==="=",o=(1<<r)-1,s="",a=0,u=0;for(let y=0;y<t.length;++y)for(u=u<<8|t[y],a+=8;a>r;)a-=r,s+=e[o&u>>a];if(a!==0&&(s+=e[o&u<<r-a]),n)for(;s.length*r&7;)s+="=";return s}function w({name:t,prefix:e,bitsPerChar:r,alphabet:n}){return Se({prefix:e,name:t,encode(o){return ut(o,n,r)},decode(o){return ct(o,n,r,t)}})}var E=w({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),pr=w({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),mr=w({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),br=w({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),yr=w({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),gr=w({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),wr=w({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),xr=w({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Cr=w({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var k=le({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Fr=le({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ft=ke,Ae=128,lt=127,dt=~lt,ht=Math.pow(2,31);function ke(t,e,r){e=e||[],r=r||0;for(var n=r;t>=ht;)e[r++]=t&255|Ae,t/=128;for(;t&dt;)e[r++]=t&255|Ae,t>>>=7;return e[r]=t|0,ke.bytes=r-n+1,e}var pt=de,mt=128,Ie=127;function de(t,n){var r=0,n=n||0,o=0,s=n,a,u=t.length;do{if(s>=u)throw de.bytes=0,new RangeError("Could not decode varint");a=t[s++],r+=o<28?(a&Ie)<<o:(a&Ie)*Math.pow(2,o),o+=7}while(a>=mt);return de.bytes=s-n,r}var bt=Math.pow(2,7),yt=Math.pow(2,14),gt=Math.pow(2,21),wt=Math.pow(2,28),xt=Math.pow(2,35),Ct=Math.pow(2,42),Et=Math.pow(2,49),vt=Math.pow(2,56),Ft=Math.pow(2,63),St=function(t){return t<bt?1:t<yt?2:t<gt?3:t<wt?4:t<xt?5:t<Ct?6:t<Et?7:t<vt?8:t<Ft?9:10},At={encode:ft,decode:pt,encodingLength:St},It=At,q=It;function J(t,e=0){return[q.decode(t,e),q.decode.bytes]}function R(t,e,r=0){return q.encode(t,e,r),e}function T(t){return q.encodingLength(t)}function Le(t,e){let r=e.byteLength,n=T(t),o=n+T(r),s=new Uint8Array(o+r);return R(t,s,0),R(r,s,n),s.set(e,o),new j(t,r,e,s)}function H(t){let e=O(t),[r,n]=J(e),[o,s]=J(e.subarray(n)),a=e.subarray(n+s);if(a.byteLength!==o)throw new Error("Incorrect length");return new j(r,o,a,e)}function Me(t,e){if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Ee(t.bytes,r.bytes)}}var j=class{code;size;digest;bytes;constructor(e,r,n,o){this.code=e,this.size=r,this.digest=n,this.bytes=o}};function Oe(t,e){let{bytes:r,version:n}=t;switch(n){case 0:return Dt(r,he(t),e??k.encoder);default:return Lt(r,he(t),e??E.encoder)}}var Ue=new WeakMap;function he(t){let e=Ue.get(t);if(e==null){let r=new Map;return Ue.set(t,r),r}return e}var K=class t{code;version;multihash;bytes;"/";constructor(e,r,n,o){this.code=r,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==G)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Mt)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=Le(e,r);return t.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return t.equals(this,e)}static equals(e,r){let n=r;return n!=null&&e.code===n.code&&e.version===n.version&&Me(e.multihash,n.multihash)}toString(e){return Oe(this,e)}toJSON(){return{"/":Oe(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof t)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:s,bytes:a}=r;return new t(n,o,s,a??Ne(n,o,s.bytes))}else if(r[zt]===!0){let{version:n,multihash:o,code:s}=r,a=H(o);return t.create(n,s,a)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==G)throw new Error(`Version 0 CID must use dag-pb (code: ${G}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let o=Ne(e,r,n.bytes);return new t(e,r,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,G,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,o=O(e.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=o.subarray(r.multihashSize-r.digestSize),a=new j(r.multihashCode,r.digestSize,s,o);return[r.version===0?t.createV0(a):t.createV1(r.codec,a),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[f,h]=J(e.subarray(r));return r+=h,f},o=n(),s=G;if(o===18?(o=0,r=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let a=r,u=n(),y=n(),I=r+y,i=I-a;return{version:o,codec:s,multihashCode:u,digestSize:y,multihashSize:i,size:I}}static parse(e,r){let[n,o]=kt(e,r),s=t.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return he(s).set(n,e),s}};function kt(t,e){switch(t[0]){case"Q":{let r=e??k;return[k.prefix,r.decode(`${k.prefix}${t}`)]}case k.prefix:{let r=e??k;return[k.prefix,r.decode(t)]}case E.prefix:{let r=e??E;return[E.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}}function Dt(t,e,r){let{prefix:n}=r;if(n!==k.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=e.get(n);if(o==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return o}function Lt(t,e,r){let{prefix:n}=r,o=e.get(n);if(o==null){let s=r.encode(t);return e.set(n,s),s}else return o}var G=112,Mt=18;function Ne(t,e,r){let n=T(t),o=n+T(e),s=new Uint8Array(o+r.byteLength);return R(t,s,0),R(e,s,n),s.set(r,o),s}var zt=Symbol.for("@ipld/js-cid/CID");var Pe=85;var W=class extends D{data;constructor(){super(),this.data=new Map}put(e,r){return this.data.set(E.encode(e.multihash.bytes),r),e}get(e){let r=this.data.get(E.encode(e.multihash.bytes));if(r==null)throw z();return r}has(e){return this.data.has(E.encode(e.multihash.bytes))}async delete(e){this.data.delete(E.encode(e.multihash.bytes))}async*getAll(){for(let[e,r]of this.data.entries())yield{cid:K.createV1(Pe,H(E.decode(e))),block:r}}};var Y=class extends D{put(e){return e}get(){throw z()}has(){return!1}async delete(){}async*getAll(){}};var F=ge($e(),1);var Ve=w({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),qr=w({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Jr=w({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Gr=w({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});F.default.formatters.b=t=>t==null?"undefined":k.baseEncode(t);F.default.formatters.t=t=>t==null?"undefined":E.baseEncode(t);F.default.formatters.m=t=>t==null?"undefined":Ve.baseEncode(t);F.default.formatters.p=t=>t==null?"undefined":t.toString();F.default.formatters.c=t=>t==null?"undefined":t.toString();F.default.formatters.k=t=>t==null?"undefined":t.toString();F.default.formatters.a=t=>t==null?"undefined":t.toString();function Gt(t){let e=()=>{};return e.enabled=!1,e.color="",e.diff=0,e.log=()=>{},e.namespace=t,e.destroy=()=>!0,e.extend=()=>e,e}function _e(t){let e=Gt(`${t}:trace`);return F.default.enabled(`${t}:trace`)&&F.default.names.map(r=>r.toString()).find(r=>r.includes(":trace"))!=null&&(e=(0,F.default)(`${t}:trace`)),Object.assign((0,F.default)(t),{error:(0,F.default)(`${t}:error`),trace:e})}function Qt(t){return t[Symbol.asyncIterator]!=null}function Xt(t){if(Qt(t))return(async()=>{for await(let e of t);})();for(let e of t);}var pe=Xt;function Zt(t){let[e,r]=t[Symbol.asyncIterator]!=null?[t[Symbol.asyncIterator](),Symbol.asyncIterator]:[t[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>e.next(),push:o=>{n.push(o)},next:()=>n.length>0?{done:!1,value:n.shift()}:e.next(),[r](){return this}}}var qe=Zt;function Ht(t){return t[Symbol.asyncIterator]!=null}function Kt(t,e){if(Ht(t))return async function*(){for await(let u of t)await e(u)&&(yield u)}();let r=qe(t),{value:n,done:o}=r.next();if(o===!0)return function*(){}();let s=e(n);if(typeof s.then=="function")return async function*(){await s&&(yield n);for await(let u of r)await e(u)&&(yield u)}();let a=e;return function*(){s===!0&&(yield n);for(let u of r)a(u)&&(yield u)}()}var Je=Kt;function re(){let t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}var ne=class{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},_=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new ne(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let r=this.head;this.head=r.next=new ne(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let r=this.tail.next;this.tail.next=null,this.tail=r,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};var me=class extends Error{type;code;constructor(e,r){super(e??"The operation was aborted"),this.type="aborted",this.code=r??"ABORT_ERR"}};function Q(t={}){return Wt(r=>{let n=r.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},t)}function Wt(t,e){e=e??{};let r=e.onEnd,n=new _,o,s,a,u=re(),y=async()=>{try{return n.isEmpty()?a?{done:!0}:await new Promise((c,p)=>{s=m=>{s=null,n.push(m);try{c(t(n))}catch(b){p(b)}return o}}):t(n)}finally{n.isEmpty()&&queueMicrotask(()=>{u.resolve(),u=re()})}},I=c=>s!=null?s(c):(n.push(c),o),i=c=>(n=new _,s!=null?s({error:c}):(n.push({error:c}),o)),f=c=>{if(a)return o;if(e?.objectMode!==!0&&c?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return I({done:!1,value:c})},h=c=>a?o:(a=!0,c!=null?i(c):I({done:!0})),M=()=>(n=new _,h(),{done:!0}),d=c=>(h(c),{done:!0});if(o={[Symbol.asyncIterator](){return this},next:y,return:M,throw:d,push:f,end:h,get readableLength(){return n.size},onEmpty:async c=>{let p=c?.signal;if(p?.throwIfAborted(),n.isEmpty())return;let m,b;p!=null&&(m=new Promise((g,x)=>{b=()=>{x(new me)},p.addEventListener("abort",b)}));try{await Promise.race([u.promise,m])}finally{b!=null&&p!=null&&p?.removeEventListener("abort",b)}}},r==null)return o;let l=o;return o={[Symbol.asyncIterator](){return this},next(){return l.next()},throw(c){return l.throw(c),r!=null&&(r(c),r=void 0),{done:!0}},return(){return l.return(),r!=null&&(r(),r=void 0),{done:!0}},push:f,end(c){return l.end(c),r!=null&&(r(c),r=void 0),o},get readableLength(){return l.readableLength},onEmpty:c=>l.onEmpty(c)},o}function Yt(t){return t[Symbol.asyncIterator]!=null}function er(...t){let e=[];for(let r of t)Yt(r)||e.push(r);return e.length===t.length?function*(){for(let r of e)yield*r}():async function*(){let r=Q({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(t.map(async n=>{for await(let o of n)r.push(o)})),r.end()}catch(n){r.end(n)}}),yield*r}()}var Ge=er;var tr=_e("blockstore:core:tiered"),oe=class extends D{stores;constructor(e){super(),this.stores=e.slice()}async put(e,r,n){try{return await Promise.all(this.stores.map(async o=>{await o.put(e,r,n)})),e}catch(o){throw se(o)}}async get(e,r){for(let n of this.stores)try{let o=await n.get(e,r);if(o!=null)return o}catch(o){tr.error(o)}throw z()}async has(e,r){for(let n of this.stores)if(await n.has(e,r))return!0;return!1}async delete(e,r){try{await Promise.all(this.stores.map(async n=>{await n.delete(e,r)}))}catch(n){throw ie(n)}}async*putMany(e,r={}){let n,o=this.stores.map(s=>{let a=Q({objectMode:!0});return pe(s.putMany(a,r)).catch(u=>{n=u}),a});try{for await(let s of e){if(n!=null)throw n;o.forEach(a=>a.push(s)),yield s.cid}}finally{o.forEach(s=>s.end())}}async*deleteMany(e,r={}){let n,o=this.stores.map(s=>{let a=Q({objectMode:!0});return pe(s.deleteMany(a,r)).catch(u=>{n=u}),a});try{for await(let s of e){if(n!=null)throw n;o.forEach(a=>a.push(s)),yield s}}finally{o.forEach(s=>s.end())}}async*getAll(e){let r=new Set;yield*Je(Ge(...this.stores.map(n=>n.getAll(e))),n=>{let o=n.cid.toString();return r.has(o)?!1:(r.add(o),!0)})}};var rr={...P};return We(nr);})();
return BlockstoreCore}));
{
"name": "blockstore-core",
"version": "4.3.9",
"version": "4.3.10",
"description": "Contains various implementations of the API contract described in interface-blockstore",

@@ -5,0 +5,0 @@ "author": "Alex Potsides <alex.potsides@protocol.ai>",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc