ipfs-unixfs-importer 15.2.5 → 15.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -92,7 +92,7 @@ $ npm i ipfs-unixfs-importer
92
92
 
93
93
  ## Browser `<script>` tag
94
94
 
95
- Loading this module through a script tag will make it's exports available as `IpfsUnixfsImporter` in the global namespace.
95
+ Loading this module through a script tag will make its exports available as `IpfsUnixfsImporter` in the global namespace.
96
96
 
97
97
  ```html
98
98
  <script src="https://unpkg.com/ipfs-unixfs-importer/dist/index.min.js"></script>
@@ -106,8 +106,8 @@ Loading this module through a script tag will make it's exports available as `Ip
106
106
 
107
107
  Licensed under either of
108
108
 
109
- - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
110
- - MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
109
+ - Apache 2.0, ([LICENSE-APACHE](https://github.com/ipfs/js-ipfs-unixfs/blob/main/packages/ipfs-unixfs-importer/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
110
+ - MIT ([LICENSE-MIT](https://github.com/ipfs/js-ipfs-unixfs/blob/main/packages/ipfs-unixfs-importer/LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
111
111
 
112
112
  # Contribute
113
113
 
package/dist/index.min.js CHANGED
@@ -1,3 +1,3 @@
1
1
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.IpfsUnixfsImporter = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
- "use strict";var IpfsUnixfsImporter=(()=>{var gn=Object.create;var vt=Object.defineProperty;var wn=Object.getOwnPropertyDescriptor;var yn=Object.getOwnPropertyNames;var bn=Object.getPrototypeOf,xn=Object.prototype.hasOwnProperty;var Ct=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),E=(r,t)=>{for(var e in t)vt(r,e,{get:t[e],enumerable:!0})},$e=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of yn(t))!xn.call(r,i)&&i!==e&&vt(r,i,{get:()=>t[i],enumerable:!(n=wn(t,i))||n.enumerable});return r};var tt=(r,t,e)=>(e=r!=null?gn(bn(r)):{},$e(t||!r||!r.__esModule?vt(e,"default",{value:r,enumerable:!0}):e,r)),_n=r=>$e(vt({},"__esModule",{value:!0}),r);var ut=Ct((Ro,Xe)=>{"use strict";function qe(r,t){for(let e in t)Object.defineProperty(r,e,{value:t[e],enumerable:!0,configurable:!0});return r}function Bn(r,t,e){if(!r||typeof r=="string")throw new TypeError("Please pass an Error to err-code");e||(e={}),typeof t=="object"&&(e=t,t=""),t&&(e.code=t);try{return qe(r,e)}catch{e.message=r.message,e.stack=r.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(r)),qe(new i,e)}}Xe.exports=Bn});var Qr=Ct((Nt,$t)=>{(function(r,t){"use strict";var e={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function n(s){if(!Array.isArray(s)&&!ArrayBuffer.isView(s))return!1;for(var h=0;h<s.length;h++)if(!Number.isInteger(s[h])||s[h]<0||s[h]>255)return!1;return!0}function i(s,h){return(s&65535)*h+(((s>>>16)*h&65535)<<16)}function o(s,h){return s<<h|s>>>32-h}function a(s){return s^=s>>>16,s=i(s,2246822507),s^=s>>>13,s=i(s,3266489909),s^=s>>>16,s}function c(s,h){s=[s[0]>>>16,s[0]&65535,s[1]>>>16,s[1]&65535],h=[h[0]>>>16,h[0]&65535,h[1]>>>16,h[1]&65535];var d=[0,0,0,0];return d[3]+=s[3]+h[3],d[2]+=d[3]>>>16,d[3]&=65535,d[2]+=s[2]+h[2],d[1]+=d[2]>>>16,d[2]&=65535,d[1]+=s[1]+h[1],d[0]+=d[1]>>>16,d[1]&=65535,d[0]+=s[0]+h[0],d[0]&=65535,[d[0]<<16|d[1],d[2]<<16|d[3]]}function l(s,h){s=[s[0]>>>16,s[0]&65535,s[1]>>>16,s[1]&65535],h=[h[0]>>>16,h[0]&65535,h[1]>>>16,h[1]&65535];var d=[0,0,0,0];return d[3]+=s[3]*h[3],d[2]+=d[3]>>>16,d[3]&=65535,d[2]+=s[2]*h[3],d[1]+=d[2]>>>16,d[2]&=65535,d[2]+=s[3]*h[2],d[1]+=d[2]>>>16,d[2]&=65535,d[1]+=s[1]*h[3],d[0]+=d[1]>>>16,d[1]&=65535,d[1]+=s[2]*h[2],d[0]+=d[1]>>>16,d[1]&=65535,d[1]+=s[3]*h[1],d[0]+=d[1]>>>16,d[1]&=65535,d[0]+=s[0]*h[3]+s[1]*h[2]+s[2]*h[1]+s[3]*h[0],d[0]&=65535,[d[0]<<16|d[1],d[2]<<16|d[3]]}function b(s,h){return h%=64,h===32?[s[1],s[0]]:h<32?[s[0]<<h|s[1]>>>32-h,s[1]<<h|s[0]>>>32-h]:(h-=32,[s[1]<<h|s[0]>>>32-h,s[0]<<h|s[1]>>>32-h])}function f(s,h){return h%=64,h===0?s:h<32?[s[0]<<h|s[1]>>>32-h,s[1]<<h]:[s[1]<<h-32,0]}function w(s,h){return[s[0]^h[0],s[1]^h[1]]}function k(s){return s=w(s,[0,s[0]>>>1]),s=l(s,[4283543511,3981806797]),s=w(s,[0,s[0]>>>1]),s=l(s,[3301882366,444984403]),s=w(s,[0,s[0]>>>1]),s}e.x86.hash32=function(s,h){if(e.inputValidation&&!n(s))return t;h=h||0;for(var d=s.length%4,D=s.length-d,u=h,p=0,m=3432918353,y=461845907,x=0;x<D;x=x+4)p=s[x]|s[x+1]<<8|s[x+2]<<16|s[x+3]<<24,p=i(p,m),p=o(p,15),p=i(p,y),u^=p,u=o(u,13),u=i(u,5)+3864292196;switch(p=0,d){case 3:p^=s[x+2]<<16;case 2:p^=s[x+1]<<8;case 1:p^=s[x],p=i(p,m),p=o(p,15),p=i(p,y),u^=p}return u^=s.length,u=a(u),u>>>0},e.x86.hash128=function(s,h){if(e.inputValidation&&!n(s))return t;h=h||0;for(var d=s.length%16,D=s.length-d,u=h,p=h,m=h,y=h,x=0,_=0,g=0,A=0,O=597399067,It=2869860233,Lt=951274213,zt=2716044179,B=0;B<D;B=B+16)x=s[B]|s[B+1]<<8|s[B+2]<<16|s[B+3]<<24,_=s[B+4]|s[B+5]<<8|s[B+6]<<16|s[B+7]<<24,g=s[B+8]|s[B+9]<<8|s[B+10]<<16|s[B+11]<<24,A=s[B+12]|s[B+13]<<8|s[B+14]<<16|s[B+15]<<24,x=i(x,O),x=o(x,15),x=i(x,It),u^=x,u=o(u,19),u+=p,u=i(u,5)+1444728091,_=i(_,It),_=o(_,16),_=i(_,Lt),p^=_,p=o(p,17),p+=m,p=i(p,5)+197830471,g=i(g,Lt),g=o(g,17),g=i(g,zt),m^=g,m=o(m,15),m+=y,m=i(m,5)+2530024501,A=i(A,zt),A=o(A,18),A=i(A,O),y^=A,y=o(y,13),y+=u,y=i(y,5)+850148119;switch(x=0,_=0,g=0,A=0,d){case 15:A^=s[B+14]<<16;case 14:A^=s[B+13]<<8;case 13:A^=s[B+12],A=i(A,zt),A=o(A,18),A=i(A,O),y^=A;case 12:g^=s[B+11]<<24;case 11:g^=s[B+10]<<16;case 10:g^=s[B+9]<<8;case 9:g^=s[B+8],g=i(g,Lt),g=o(g,17),g=i(g,zt),m^=g;case 8:_^=s[B+7]<<24;case 7:_^=s[B+6]<<16;case 6:_^=s[B+5]<<8;case 5:_^=s[B+4],_=i(_,It),_=o(_,16),_=i(_,Lt),p^=_;case 4:x^=s[B+3]<<24;case 3:x^=s[B+2]<<16;case 2:x^=s[B+1]<<8;case 1:x^=s[B],x=i(x,O),x=o(x,15),x=i(x,It),u^=x}return u^=s.length,p^=s.length,m^=s.length,y^=s.length,u+=p,u+=m,u+=y,p+=u,m+=u,y+=u,u=a(u),p=a(p),m=a(m),y=a(y),u+=p,u+=m,u+=y,p+=u,m+=u,y+=u,("00000000"+(u>>>0).toString(16)).slice(-8)+("00000000"+(p>>>0).toString(16)).slice(-8)+("00000000"+(m>>>0).toString(16)).slice(-8)+("00000000"+(y>>>0).toString(16)).slice(-8)},e.x64.hash128=function(s,h){if(e.inputValidation&&!n(s))return t;h=h||0;for(var d=s.length%16,D=s.length-d,u=[0,h],p=[0,h],m=[0,0],y=[0,0],x=[2277735313,289559509],_=[1291169091,658871167],g=0;g<D;g=g+16)m=[s[g+4]|s[g+5]<<8|s[g+6]<<16|s[g+7]<<24,s[g]|s[g+1]<<8|s[g+2]<<16|s[g+3]<<24],y=[s[g+12]|s[g+13]<<8|s[g+14]<<16|s[g+15]<<24,s[g+8]|s[g+9]<<8|s[g+10]<<16|s[g+11]<<24],m=l(m,x),m=b(m,31),m=l(m,_),u=w(u,m),u=b(u,27),u=c(u,p),u=c(l(u,[0,5]),[0,1390208809]),y=l(y,_),y=b(y,33),y=l(y,x),p=w(p,y),p=b(p,31),p=c(p,u),p=c(l(p,[0,5]),[0,944331445]);switch(m=[0,0],y=[0,0],d){case 15:y=w(y,f([0,s[g+14]],48));case 14:y=w(y,f([0,s[g+13]],40));case 13:y=w(y,f([0,s[g+12]],32));case 12:y=w(y,f([0,s[g+11]],24));case 11:y=w(y,f([0,s[g+10]],16));case 10:y=w(y,f([0,s[g+9]],8));case 9:y=w(y,[0,s[g+8]]),y=l(y,_),y=b(y,33),y=l(y,x),p=w(p,y);case 8:m=w(m,f([0,s[g+7]],56));case 7:m=w(m,f([0,s[g+6]],48));case 6:m=w(m,f([0,s[g+5]],40));case 5:m=w(m,f([0,s[g+4]],32));case 4:m=w(m,f([0,s[g+3]],24));case 3:m=w(m,f([0,s[g+2]],16));case 2:m=w(m,f([0,s[g+1]],8));case 1:m=w(m,[0,s[g]]),m=l(m,x),m=b(m,31),m=l(m,_),u=w(u,m)}return u=w(u,[0,s.length]),p=w(p,[0,s.length]),u=c(u,p),p=c(p,u),u=k(u),p=k(p),u=c(u,p),p=c(p,u),("00000000"+(u[0]>>>0).toString(16)).slice(-8)+("00000000"+(u[1]>>>0).toString(16)).slice(-8)+("00000000"+(p[0]>>>0).toString(16)).slice(-8)+("00000000"+(p[1]>>>0).toString(16)).slice(-8)},typeof Nt<"u"?(typeof $t<"u"&&$t.exports&&(Nt=$t.exports=e),Nt.murmurHash3=e):typeof define=="function"&&define.amd?define([],function(){return e}):(e._murmurHash3=r.murmurHash3,e.noConflict=function(){return r.murmurHash3=e._murmurHash3,e._murmurHash3=t,e.noConflict=t,e},r.murmurHash3=e)})(Nt)});var Zr=Ct((xc,Yr)=>{Yr.exports=Qr()});var nn=Ct((Ec,rn)=>{"use strict";rn.exports=class{constructor(){this._bitArrays=[],this._data=[],this._length=0,this._changedLength=!1,this._changedData=!1}set(t,e){let n=this._internalPositionFor(t,!1);if(e===void 0)n!==-1&&(this._unsetInternalPos(n),this._unsetBit(t),this._changedLength=!0,this._changedData=!0);else{let i=!1;n===-1?(n=this._data.length,this._setBit(t),this._changedData=!0):i=!0,this._setInternalPos(n,t,e,i),this._changedLength=!0}}unset(t){this.set(t,void 0)}get(t){this._sortData();let e=this._internalPositionFor(t,!0);if(e!==-1)return this._data[e][1]}push(t){return this.set(this.length,t),this.length}get length(){if(this._sortData(),this._changedLength){let t=this._data[this._data.length-1];this._length=t?t[0]+1:0,this._changedLength=!1}return this._length}forEach(t){let e=0;for(;e<this.length;)t(this.get(e),e,this),e++}map(t){let e=0,n=new Array(this.length);for(;e<this.length;)n[e]=t(this.get(e),e,this),e++;return n}reduce(t,e){let n=0,i=e;for(;n<this.length;){let o=this.get(n);i=t(i,o,n),n++}return i}find(t){let e=0,n,i;for(;e<this.length&&!n;)i=this.get(e),n=t(i),e++;return n?i:void 0}_internalPositionFor(t,e){let n=this._bytePosFor(t,e);if(n>=this._bitArrays.length)return-1;let i=this._bitArrays[n],o=t-n*7;if(!((i&1<<o)>0))return-1;let c=this._bitArrays.slice(0,n).reduce(xo,0),l=~(4294967295<<o+1),b=en(i&l);return c+b-1}_bytePosFor(t,e){let n=Math.floor(t/7),i=n+1;for(;!e&&this._bitArrays.length<i;)this._bitArrays.push(0);return n}_setBit(t){let e=this._bytePosFor(t,!1);this._bitArrays[e]|=1<<t-e*7}_unsetBit(t){let e=this._bytePosFor(t,!1);this._bitArrays[e]&=~(1<<t-e*7)}_setInternalPos(t,e,n,i){let o=this._data,a=[e,n];if(i)this._sortData(),o[t]=a;else{if(o.length)if(o[o.length-1][0]>=e)o.push(a);else if(o[0][0]<=e)o.unshift(a);else{let c=Math.round(o.length/2);this._data=o.slice(0,c).concat(a).concat(o.slice(c))}else this._data.push(a);this._changedData=!0,this._changedLength=!0}}_unsetInternalPos(t){this._data.splice(t,1)}_sortData(){this._changedData&&this._data.sort(_o),this._changedData=!1}bitField(){let t=[],e=8,n=0,i=0,o,a=this._bitArrays.slice();for(;a.length||n;){n===0&&(o=a.shift(),n=7);let l=Math.min(n,e),b=~(255<<l),f=o&b;i|=f<<8-e,o=o>>>l,n-=l,e-=l,(!e||!n&&!a.length)&&(t.push(i),i=0,e=8)}for(var c=t.length-1;c>0&&t[c]===0;c--)t.pop();return t}compactArray(){return this._sortData(),this._data.map(Bo)}};function xo(r,t){return r+en(t)}function en(r){let t=r;return t=t-(t>>1&1431655765),t=(t&858993459)+(t>>2&858993459),(t+(t>>4)&252645135)*16843009>>24}function _o(r,t){return r[0]-t[0]}function Bo(r){return r[1]}});var Mo={};E(Mo,{importByteStream:()=>Uo,importBytes:()=>Po,importDirectory:()=>Fo,importFile:()=>Ge,importer:()=>Oe});var He=tt(ut(),1);function An(r){return r[Symbol.asyncIterator]!=null}function kn(r){if(An(r))return(async()=>{for await(let t of r)return t})();for(let t of r)return t}var Wt=kn;function Sn(r){return r[Symbol.asyncIterator]!=null}function Dn(r,t=1){return t=Number(t),Sn(r)?async function*(){let e=[];if(t<1&&(t=1),t!==Math.round(t))throw new Error("Batch size must be an integer");for await(let n of r)for(e.push(n);e.length>=t;)yield e.slice(0,t),e=e.slice(t);for(;e.length>0;)yield e.slice(0,t),e=e.slice(t)}():function*(){let e=[];if(t<1&&(t=1),t!==Math.round(t))throw new Error("Batch size must be an integer");for(let n of r)for(e.push(n);e.length>=t;)yield e.slice(0,t),e=e.slice(t);for(;e.length>0;)yield e.slice(0,t),e=e.slice(t)}()}var Ft=Dn;async function*lt(r,t=1){for await(let e of Ft(r,t)){let n=e.map(async i=>i().then(o=>({ok:!0,value:o}),o=>({ok:!1,err:o})));for(let i=0;i<n.length;i++){let o=await n[i];if(o.ok)yield o.value;else throw o.err}}}function G(r=0){return new Uint8Array(r)}function z(r=0){return new Uint8Array(r)}function dt(r,t){t==null&&(t=r.reduce((i,o)=>i+o.length,0));let e=z(t),n=0;for(let i of r)e.set(i,n),n+=i.length;return e}function Ke(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}var je=Symbol.for("@achingbrain/uint8arraylist");function We(r,t){if(t==null||t<0)throw new RangeError("index is out of bounds");let e=0;for(let n of r){let i=e+n.byteLength;if(t<i)return{buf:n,index:t-e};e=i}throw new RangeError("index is out of bounds")}function Pt(r){return!!r?.[je]}var et=class r{bufs;length;[je]=!0;constructor(...t){this.bufs=[],this.length=0,t.length>0&&this.appendAll(t)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...t){this.appendAll(t)}appendAll(t){let e=0;for(let n of t)if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.push(n);else if(Pt(n))e+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}prepend(...t){this.prependAll(t)}prependAll(t){let e=0;for(let n of t.reverse())if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.unshift(n);else if(Pt(n))e+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}get(t){let e=We(this.bufs,t);return e.buf[e.index]}set(t,e){let n=We(this.bufs,t);n.buf[n.index]=e}write(t,e=0){if(t instanceof Uint8Array)for(let n=0;n<t.length;n++)this.set(e+n,t[n]);else if(Pt(t))for(let n=0;n<t.length;n++)this.set(e+n,t.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(t){if(t=Math.trunc(t),!(Number.isNaN(t)||t<=0)){if(t===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(t>=this.bufs[0].byteLength)t-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(t),this.length-=t;break}}}slice(t,e){let{bufs:n,length:i}=this._subList(t,e);return dt(n,i)}subarray(t,e){let{bufs:n,length:i}=this._subList(t,e);return n.length===1?n[0]:dt(n,i)}sublist(t,e){let{bufs:n,length:i}=this._subList(t,e),o=new r;return o.length=i,o.bufs=[...n],o}_subList(t,e){if(t=t??0,e=e??this.length,t<0&&(t=this.length+t),e<0&&(e=this.length+e),t<0||e>this.length)throw new RangeError("index is out of bounds");if(t===e)return{bufs:[],length:0};if(t===0&&e===this.length)return{bufs:this.bufs,length:this.length};let n=[],i=0;for(let o=0;o<this.bufs.length;o++){let a=this.bufs[o],c=i,l=c+a.byteLength;if(i=l,t>=l)continue;let b=t>=c&&t<l,f=e>c&&e<=l;if(b&&f){if(t===c&&e===l){n.push(a);break}let w=t-c;n.push(a.subarray(w,w+(e-t)));break}if(b){if(t===0){n.push(a);continue}n.push(a.subarray(t-c));continue}if(f){if(e===l){n.push(a);break}n.push(a.subarray(0,e-c));break}n.push(a)}return{bufs:n,length:e-t}}indexOf(t,e=0){if(!Pt(t)&&!(t instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=t instanceof Uint8Array?t:t.subarray();if(e=Number(e??0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),t.length===0)return e>this.length?this.length:e;let i=n.byteLength;if(i===0)throw new TypeError("search must be at least 1 byte long");let o=256,a=new Int32Array(o);for(let w=0;w<o;w++)a[w]=-1;for(let w=0;w<i;w++)a[n[w]]=w;let c=a,l=this.byteLength-n.byteLength,b=n.byteLength-1,f;for(let w=e;w<=l;w+=f){f=0;for(let k=b;k>=0;k--){let s=this.get(w+k);if(n[k]!==s){f=Math.max(1,k-c[s]);break}}if(f===0)return w}return-1}getInt8(t){let e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt8(0)}setInt8(t,e){let n=z(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,e),this.write(n,t)}getInt16(t,e){let n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,e)}setInt16(t,e,n){let i=G(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,e,n),this.write(i,t)}getInt32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,e)}setInt32(t,e,n){let i=G(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,e,n),this.write(i,t)}getBigInt64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,e)}setBigInt64(t,e,n){let i=G(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,e,n),this.write(i,t)}getUint8(t){let e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0)}setUint8(t,e){let n=z(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,e),this.write(n,t)}getUint16(t,e){let n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,e)}setUint16(t,e,n){let i=G(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,e,n),this.write(i,t)}getUint32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,e)}setUint32(t,e,n){let i=G(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,e,n),this.write(i,t)}getBigUint64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,e)}setBigUint64(t,e,n){let i=G(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,e,n),this.write(i,t)}getFloat32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,e)}setFloat32(t,e,n){let i=G(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,e,n),this.write(i,t)}getFloat64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,e)}setFloat64(t,e,n){let i=G(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,e,n),this.write(i,t)}equals(t){if(t==null||!(t instanceof r)||t.bufs.length!==this.bufs.length)return!1;for(let e=0;e<this.bufs.length;e++)if(!Ke(this.bufs[e],t.bufs[e]))return!1;return!0}static fromUint8Arrays(t,e){let n=new r;return n.bufs=t,e==null&&(e=t.reduce((i,o)=>i+o.byteLength,0)),n.length=e,n}};var En=262144,Je=(r={})=>{let t=r.chunkSize??En;return async function*(n){let i=new et,o=0,a=!1;for await(let c of n)for(i.append(c),o+=c.length;o>=t;)if(yield i.slice(0,t),a=!0,t===i.length)i=new et,o=0;else{let l=new et;l.append(i.sublist(t)),i=l,o-=t}(!a||o>0)&&(yield i.subarray(0,o))}};var bt={};E(bt,{code:()=>Si,createLink:()=>wr,createNode:()=>gr,decode:()=>Di,encode:()=>C,name:()=>ki,prepare:()=>v,validate:()=>ce});var re={};E(re,{base32:()=>it,base32hex:()=>Vn,base32hexpad:()=>Hn,base32hexpadupper:()=>On,base32hexupper:()=>Rn,base32pad:()=>Un,base32padupper:()=>Mn,base32upper:()=>Pn,base32z:()=>Gn});var rt={};E(rt,{coerce:()=>P,empty:()=>Qe,equals:()=>jt,fromHex:()=>Nn,fromString:()=>Jt,isBinary:()=>In,toHex:()=>Tn,toString:()=>Qt});var Qe=new Uint8Array(0);function Tn(r){return r.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),"")}function Nn(r){let t=r.match(/../g);return t!=null?new Uint8Array(t.map(e=>parseInt(e,16))):Qe}function jt(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function P(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function In(r){return r instanceof ArrayBuffer||ArrayBuffer.isView(r)}function Jt(r){return new TextEncoder().encode(r)}function Qt(r){return new TextDecoder().decode(r)}function Ln(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var i=0;i<r.length;i++){var o=r.charAt(i),a=o.charCodeAt(0);if(e[a]!==255)throw new TypeError(o+" is ambiguous");e[a]=i}var c=r.length,l=r.charAt(0),b=Math.log(c)/Math.log(256),f=Math.log(256)/Math.log(c);function w(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var d=0,D=0,u=0,p=h.length;u!==p&&h[u]===0;)u++,d++;for(var m=(p-u)*f+1>>>0,y=new Uint8Array(m);u!==p;){for(var x=h[u],_=0,g=m-1;(x!==0||_<D)&&g!==-1;g--,_++)x+=256*y[g]>>>0,y[g]=x%c>>>0,x=x/c>>>0;if(x!==0)throw new Error("Non-zero carry");D=_,u++}for(var A=m-D;A!==m&&y[A]===0;)A++;for(var O=l.repeat(d);A<m;++A)O+=r.charAt(y[A]);return O}function k(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var d=0;if(h[d]!==" "){for(var D=0,u=0;h[d]===l;)D++,d++;for(var p=(h.length-d)*b+1>>>0,m=new Uint8Array(p);h[d];){var y=e[h.charCodeAt(d)];if(y===255)return;for(var x=0,_=p-1;(y!==0||x<u)&&_!==-1;_--,x++)y+=c*m[_]>>>0,m[_]=y%256>>>0,y=y/256>>>0;if(y!==0)throw new Error("Non-zero carry");u=x,d++}if(h[d]!==" "){for(var g=p-u;g!==p&&m[g]===0;)g++;for(var A=new Uint8Array(D+(p-g)),O=D;g!==p;)A[O++]=m[g++];return A}}}function s(h){var d=k(h);if(d)return d;throw new Error(`Non-${t} character`)}return{encode:w,decodeUnsafe:k,decode:s}}var zn=Ln,vn=zn,Ye=vn;var Yt=class{name;prefix;baseEncode;constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},Zt=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Ze(this,t)}},te=class{decoders;constructor(t){this.decoders=t}or(t){return Ze(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n!=null)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Ze(r,t){return new te({...r.decoders??{[r.prefix]:r},...t.decoders??{[t.prefix]:t}})}var ee=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,e,n,i){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=i,this.encoder=new Yt(t,e,n),this.decoder=new Zt(t,e,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function nt({name:r,prefix:t,encode:e,decode:n}){return new ee(r,t,e,n)}function q({name:r,prefix:t,alphabet:e}){let{encode:n,decode:i}=Ye(e,r);return nt({prefix:t,name:r,encode:n,decode:o=>P(i(o))})}function Cn(r,t,e,n){let i={};for(let f=0;f<t.length;++f)i[t[f]]=f;let o=r.length;for(;r[o-1]==="=";)--o;let a=new Uint8Array(o*e/8|0),c=0,l=0,b=0;for(let f=0;f<o;++f){let w=i[r[f]];if(w===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<e|w,c+=e,c>=8&&(c-=8,a[b++]=255&l>>c)}if(c>=e||255&l<<8-c)throw new SyntaxError("Unexpected end of data");return a}function Fn(r,t,e){let n=t[t.length-1]==="=",i=(1<<e)-1,o="",a=0,c=0;for(let l=0;l<r.length;++l)for(c=c<<8|r[l],a+=8;a>e;)a-=e,o+=t[i&c>>a];if(a!==0&&(o+=t[i&c<<e-a]),n)for(;o.length*e&7;)o+="=";return o}function S({name:r,prefix:t,bitsPerChar:e,alphabet:n}){return nt({prefix:t,name:r,encode(i){return Fn(i,n,e)},decode(i){return Cn(i,n,e,r)}})}var it=S({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Pn=S({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Un=S({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Mn=S({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Vn=S({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Rn=S({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Hn=S({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),On=S({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Gn=S({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ne={};E(ne,{base58btc:()=>R,base58flickr:()=>$n});var R=q({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),$n=q({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var qn=rr,tr=128,Xn=127,Kn=~Xn,Wn=Math.pow(2,31);function rr(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Wn;)t[e++]=r&255|tr,r/=128;for(;r&Kn;)t[e++]=r&255|tr,r>>>=7;return t[e]=r|0,rr.bytes=e-n+1,t}var jn=ie,Jn=128,er=127;function ie(r,n){var e=0,n=n||0,i=0,o=n,a,c=r.length;do{if(o>=c)throw ie.bytes=0,new RangeError("Could not decode varint");a=r[o++],e+=i<28?(a&er)<<i:(a&er)*Math.pow(2,i),i+=7}while(a>=Jn);return ie.bytes=o-n,e}var Qn=Math.pow(2,7),Yn=Math.pow(2,14),Zn=Math.pow(2,21),ti=Math.pow(2,28),ei=Math.pow(2,35),ri=Math.pow(2,42),ni=Math.pow(2,49),ii=Math.pow(2,56),oi=Math.pow(2,63),si=function(r){return r<Qn?1:r<Yn?2:r<Zn?3:r<ti?4:r<ei?5:r<ri?6:r<ni?7:r<ii?8:r<oi?9:10},ai={encode:qn,decode:jn,encodingLength:si},ci=ai,pt=ci;function mt(r,t=0){return[pt.decode(r,t),pt.decode.bytes]}function ot(r,t,e=0){return pt.encode(r,t,e),t}function st(r){return pt.encodingLength(r)}function j(r,t){let e=t.byteLength,n=st(r),i=n+st(e),o=new Uint8Array(i+e);return ot(r,o,0),ot(e,o,n),o.set(t,i),new at(r,e,t,o)}function nr(r){let t=P(r),[e,n]=mt(t),[i,o]=mt(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new at(e,i,a,t)}function ir(r,t){if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&jt(r.bytes,e.bytes)}}var at=class{code;size;digest;bytes;constructor(t,e,n,i){this.code=t,this.size=e,this.digest=n,this.bytes=i}};function or(r,t){let{bytes:e,version:n}=r;switch(n){case 0:return fi(e,oe(r),t??R.encoder);default:return ui(e,oe(r),t??it.encoder)}}var sr=new WeakMap;function oe(r){let t=sr.get(r);if(t==null){let e=new Map;return sr.set(r,e),e}return t}var T=class r{code;version;multihash;bytes;"/";constructor(t,e,n,i){this.code=e,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}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:t,multihash:e}=this;if(t!==wt)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==li)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}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:t,digest:e}=this.multihash,n=j(t,e);return r.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(t){return r.equals(this,t)}static equals(t,e){let n=e;return n!=null&&t.code===n.code&&t.version===n.version&&ir(t.multihash,n.multihash)}toString(t){return or(this,t)}toJSON(){return{"/":or(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:i,multihash:o,bytes:a}=e;return new r(n,i,o,a??ar(n,i,o.bytes))}else if(e[di]===!0){let{version:n,multihash:i,code:o}=e,a=nr(i);return r.create(n,o,a)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==wt)throw new Error(`Version 0 CID must use dag-pb (code: ${wt}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let i=ar(t,e,n.bytes);return new r(t,e,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,wt,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,i=P(t.subarray(n,n+e.multihashSize));if(i.byteLength!==e.multihashSize)throw new Error("Incorrect length");let o=i.subarray(e.multihashSize-e.digestSize),a=new at(e.multihashCode,e.digestSize,o,i);return[e.version===0?r.createV0(a):r.createV1(e.codec,a),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[w,k]=mt(t.subarray(e));return e+=k,w},i=n(),o=wt;if(i===18?(i=0,e=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=e,c=n(),l=n(),b=e+l,f=b-a;return{version:i,codec:o,multihashCode:c,digestSize:l,multihashSize:f,size:b}}static parse(t,e){let[n,i]=hi(t,e),o=r.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return oe(o).set(n,t),o}};function hi(r,t){switch(r[0]){case"Q":{let e=t??R;return[R.prefix,e.decode(`${R.prefix}${r}`)]}case R.prefix:{let e=t??R;return[R.prefix,e.decode(r)]}case it.prefix:{let e=t??it;return[it.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}}function fi(r,t,e){let{prefix:n}=e;if(n!==R.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let i=t.get(n);if(i==null){let o=e.encode(r).slice(1);return t.set(n,o),o}else return i}function ui(r,t,e){let{prefix:n}=e,i=t.get(n);if(i==null){let o=e.encode(r);return t.set(n,o),o}else return i}var wt=112,li=18;function ar(r,t,e){let n=st(r),i=n+st(t),o=new Uint8Array(i+e.byteLength);return ot(r,o,0),ot(t,o,n),o.set(e,i),o}var di=Symbol.for("@ipld/js-cid/CID");var pi=new TextDecoder;function se(r,t){let e=0;for(let n=0;;n+=7){if(n>=64)throw new Error("protobuf: varint overflow");if(t>=r.length)throw new Error("protobuf: unexpected end of data");let i=r[t++];if(e+=n<28?(i&127)<<n:(i&127)*2**n,i<128)break}return[e,t]}function Mt(r,t){let e;[e,t]=se(r,t);let n=t+e;if(e<0||n<0)throw new Error("protobuf: invalid length");if(n>r.length)throw new Error("protobuf: unexpected end of data");return[r.subarray(t,n),n]}function cr(r,t){let e;return[e,t]=se(r,t),[e&7,e>>3,t]}function mi(r){let t={},e=r.length,n=0;for(;n<e;){let i,o;if([i,o,n]=cr(r,n),o===1){if(t.Hash)throw new Error("protobuf: (PBLink) duplicate Hash section");if(i!==2)throw new Error(`protobuf: (PBLink) wrong wireType (${i}) for Hash`);if(t.Name!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Name before Hash");if(t.Tsize!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Tsize before Hash");[t.Hash,n]=Mt(r,n)}else if(o===2){if(t.Name!==void 0)throw new Error("protobuf: (PBLink) duplicate Name section");if(i!==2)throw new Error(`protobuf: (PBLink) wrong wireType (${i}) for Name`);if(t.Tsize!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Tsize before Name");let a;[a,n]=Mt(r,n),t.Name=pi.decode(a)}else if(o===3){if(t.Tsize!==void 0)throw new Error("protobuf: (PBLink) duplicate Tsize section");if(i!==0)throw new Error(`protobuf: (PBLink) wrong wireType (${i}) for Tsize`);[t.Tsize,n]=se(r,n)}else throw new Error(`protobuf: (PBLink) invalid fieldNumber, expected 1, 2 or 3, got ${o}`)}if(n>e)throw new Error("protobuf: (PBLink) unexpected end of data");return t}function hr(r){let t=r.length,e=0,n,i=!1,o;for(;e<t;){let c,l;if([c,l,e]=cr(r,e),c!==2)throw new Error(`protobuf: (PBNode) invalid wireType, expected 2, got ${c}`);if(l===1){if(o)throw new Error("protobuf: (PBNode) duplicate Data section");[o,e]=Mt(r,e),n&&(i=!0)}else if(l===2){if(i)throw new Error("protobuf: (PBNode) duplicate Links section");n||(n=[]);let b;[b,e]=Mt(r,e),n.push(mi(b))}else throw new Error(`protobuf: (PBNode) invalid fieldNumber, expected 1 or 2, got ${l}`)}if(e>t)throw new Error("protobuf: (PBNode) unexpected end of data");let a={};return o&&(a.Data=o),a.Links=n||[],a}var ur=new TextEncoder,fr=2**32,gi=2**31;function wi(r,t){let e=t.length;if(typeof r.Tsize=="number"){if(r.Tsize<0)throw new Error("Tsize cannot be negative");if(!Number.isSafeInteger(r.Tsize))throw new Error("Tsize too large for encoding");e=yt(t,e,r.Tsize)-1,t[e]=24}if(typeof r.Name=="string"){let n=ur.encode(r.Name);e-=n.length,t.set(n,e),e=yt(t,e,n.length)-1,t[e]=18}return r.Hash&&(e-=r.Hash.length,t.set(r.Hash,e),e=yt(t,e,r.Hash.length)-1,t[e]=10),t.length-e}function lr(r){let t=bi(r),e=new Uint8Array(t),n=t;if(r.Data&&(n-=r.Data.length,e.set(r.Data,n),n=yt(e,n,r.Data.length)-1,e[n]=10),r.Links)for(let i=r.Links.length-1;i>=0;i--){let o=wi(r.Links[i],e.subarray(0,n));n-=o,n=yt(e,n,o)-1,e[n]=18}return e}function yi(r){let t=0;if(r.Hash){let e=r.Hash.length;t+=1+e+ct(e)}if(typeof r.Name=="string"){let e=ur.encode(r.Name).length;t+=1+e+ct(e)}return typeof r.Tsize=="number"&&(t+=1+ct(r.Tsize)),t}function bi(r){let t=0;if(r.Data){let e=r.Data.length;t+=1+e+ct(e)}if(r.Links)for(let e of r.Links){let n=yi(e);t+=1+n+ct(n)}return t}function yt(r,t,e){t-=ct(e);let n=t;for(;e>=gi;)r[t++]=e&127|128,e/=128;for(;e>=128;)r[t++]=e&127|128,e>>>=7;return r[t]=e,n}function ct(r){return r%2===0&&r++,Math.floor((xi(r)+6)/7)}function xi(r){let t=0;return r>=fr&&(r=Math.floor(r/fr),t=32),r>=65536&&(r>>>=16,t+=16),r>=256&&(r>>>=8,t+=8),t+_i[r]}var _i=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8];var Bi=["Data","Links"],Ai=["Hash","Name","Tsize"],ae=new TextEncoder;function pr(r,t){if(r===t)return 0;let e=r.Name?ae.encode(r.Name):[],n=t.Name?ae.encode(t.Name):[],i=e.length,o=n.length;for(let a=0,c=Math.min(i,o);a<c;++a)if(e[a]!==n[a]){i=e[a],o=n[a];break}return i<o?-1:o<i?1:0}function dr(r,t){return!Object.keys(r).some(e=>!t.includes(e))}function mr(r){if(typeof r.asCID=="object"){let e=T.asCID(r);if(!e)throw new TypeError("Invalid DAG-PB form");return{Hash:e}}if(typeof r!="object"||Array.isArray(r))throw new TypeError("Invalid DAG-PB form");let t={};if(r.Hash){let e=T.asCID(r.Hash);try{e||(typeof r.Hash=="string"?e=T.parse(r.Hash):r.Hash instanceof Uint8Array&&(e=T.decode(r.Hash)))}catch(n){throw new TypeError(`Invalid DAG-PB form: ${n.message}`)}e&&(t.Hash=e)}if(!t.Hash)throw new TypeError("Invalid DAG-PB form");return typeof r.Name=="string"&&(t.Name=r.Name),typeof r.Tsize=="number"&&(t.Tsize=r.Tsize),t}function v(r){if((r instanceof Uint8Array||typeof r=="string")&&(r={Data:r}),typeof r!="object"||Array.isArray(r))throw new TypeError("Invalid DAG-PB form");let t={};if(r.Data!==void 0)if(typeof r.Data=="string")t.Data=ae.encode(r.Data);else if(r.Data instanceof Uint8Array)t.Data=r.Data;else throw new TypeError("Invalid DAG-PB form");if(r.Links!==void 0)if(Array.isArray(r.Links))t.Links=r.Links.map(mr),t.Links.sort(pr);else throw new TypeError("Invalid DAG-PB form");else t.Links=[];return t}function ce(r){if(!r||typeof r!="object"||Array.isArray(r)||r instanceof Uint8Array||r["/"]&&r["/"]===r.bytes)throw new TypeError("Invalid DAG-PB form");if(!dr(r,Bi))throw new TypeError("Invalid DAG-PB form (extraneous properties)");if(r.Data!==void 0&&!(r.Data instanceof Uint8Array))throw new TypeError("Invalid DAG-PB form (Data must be bytes)");if(!Array.isArray(r.Links))throw new TypeError("Invalid DAG-PB form (Links must be a list)");for(let t=0;t<r.Links.length;t++){let e=r.Links[t];if(!e||typeof e!="object"||Array.isArray(e)||e instanceof Uint8Array||e["/"]&&e["/"]===e.bytes)throw new TypeError("Invalid DAG-PB form (bad link)");if(!dr(e,Ai))throw new TypeError("Invalid DAG-PB form (extraneous properties on link)");if(e.Hash===void 0)throw new TypeError("Invalid DAG-PB form (link must have a Hash)");if(e.Hash==null||!e.Hash["/"]||e.Hash["/"]!==e.Hash.bytes)throw new TypeError("Invalid DAG-PB form (link Hash must be a CID)");if(e.Name!==void 0&&typeof e.Name!="string")throw new TypeError("Invalid DAG-PB form (link Name must be a string)");if(e.Tsize!==void 0){if(typeof e.Tsize!="number"||e.Tsize%1!==0)throw new TypeError("Invalid DAG-PB form (link Tsize must be an integer)");if(e.Tsize<0)throw new TypeError("Invalid DAG-PB form (link Tsize cannot be negative)")}if(t>0&&pr(e,r.Links[t-1])===-1)throw new TypeError("Invalid DAG-PB form (links must be sorted by Name bytes)")}}function gr(r,t=[]){return v({Data:r,Links:t})}function wr(r,t,e){return mr({Hash:e,Name:r,Tsize:t})}function yr(r){return r instanceof ArrayBuffer?new Uint8Array(r,0,r.byteLength):r}var ki="dag-pb",Si=112;function C(r){ce(r);let t={};return r.Links&&(t.Links=r.Links.map(e=>{let n={};return e.Hash&&(n.Hash=e.Hash.bytes),e.Name!==void 0&&(n.Name=e.Name),e.Tsize!==void 0&&(n.Tsize=e.Tsize),n})),r.Data&&(t.Data=r.Data),lr(t)}function Di(r){let t=yr(r),e=hr(t),n={};return e.Data&&(n.Data=e.Data),e.Links&&(n.Links=e.Links.map(i=>{let o={};try{o.Hash=T.decode(i.Hash)}catch{}if(!o.Hash)throw new Error("Invalid Hash field found in link, expected CID");return i.Name!==void 0&&(o.Name=i.Name),i.Tsize!==void 0&&(o.Tsize=i.Tsize),o})),n}var Fe=tt(ut(),1);var Ei=Math.pow(2,7),Ti=Math.pow(2,14),Ni=Math.pow(2,21),br=Math.pow(2,28),xr=Math.pow(2,35),_r=Math.pow(2,42),Br=Math.pow(2,49),I=128,X=127;function xt(r){if(r<Ei)return 1;if(r<Ti)return 2;if(r<Ni)return 3;if(r<br)return 4;if(r<xr)return 5;if(r<_r)return 6;if(r<Br)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Ar(r,t,e=0){switch(xt(r)){case 8:t[e++]=r&255|I,r/=128;case 7:t[e++]=r&255|I,r/=128;case 6:t[e++]=r&255|I,r/=128;case 5:t[e++]=r&255|I,r/=128;case 4:t[e++]=r&255|I,r>>>=7;case 3:t[e++]=r&255|I,r>>>=7;case 2:t[e++]=r&255|I,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function kr(r,t){let e=r[t],n=0;if(n+=e&X,e<I||(e=r[t+1],n+=(e&X)<<7,e<I)||(e=r[t+2],n+=(e&X)<<14,e<I)||(e=r[t+3],n+=(e&X)<<21,e<I)||(e=r[t+4],n+=(e&X)*br,e<I)||(e=r[t+5],n+=(e&X)*xr,e<I)||(e=r[t+6],n+=(e&X)*_r,e<I)||(e=r[t+7],n+=(e&X)*Br,e<I))return n;throw new RangeError("Could not decode varint")}var he=new Float32Array([-0]),K=new Uint8Array(he.buffer);function Sr(r,t,e){he[0]=r,t[e]=K[0],t[e+1]=K[1],t[e+2]=K[2],t[e+3]=K[3]}function Dr(r,t){return K[0]=r[t],K[1]=r[t+1],K[2]=r[t+2],K[3]=r[t+3],he[0]}var fe=new Float64Array([-0]),N=new Uint8Array(fe.buffer);function Er(r,t,e){fe[0]=r,t[e]=N[0],t[e+1]=N[1],t[e+2]=N[2],t[e+3]=N[3],t[e+4]=N[4],t[e+5]=N[5],t[e+6]=N[6],t[e+7]=N[7]}function Tr(r,t){return N[0]=r[t],N[1]=r[t+1],N[2]=r[t+2],N[3]=r[t+3],N[4]=r[t+4],N[5]=r[t+5],N[6]=r[t+6],N[7]=r[t+7],fe[0]}var Ii=BigInt(Number.MAX_SAFE_INTEGER),Li=BigInt(Number.MIN_SAFE_INTEGER),F=class r{lo;hi;constructor(t,e){this.lo=t|0,this.hi=e|0}toNumber(t=!1){if(!t&&this.hi>>>31>0){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(t=!1){if(t)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(BigInt(e)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(t=!1){return this.toBigInt(t).toString()}zzEncode(){let t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this}zzDecode(){let t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this}length(){let t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}static fromBigInt(t){if(t===0n)return J;if(t<Ii&&t>Li)return this.fromNumber(Number(t));let e=t<0n;e&&(t=-t);let n=t>>32n,i=t-(n<<32n);return e&&(n=~n|0n,i=~i|0n,++i>Nr&&(i=0n,++n>Nr&&(n=0n))),new r(Number(i),Number(n))}static fromNumber(t){if(t===0)return J;let e=t<0;e&&(t=-t);let n=t>>>0,i=(t-n)/4294967296>>>0;return e&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new r(n,i)}static from(t){return typeof t=="number"?r.fromNumber(t):typeof t=="bigint"?r.fromBigInt(t):typeof t=="string"?r.fromBigInt(BigInt(t)):t.low!=null||t.high!=null?new r(t.low>>>0,t.high>>>0):J}},J=new F(0,0);J.toBigInt=function(){return 0n};J.zzEncode=J.zzDecode=function(){return this};J.length=function(){return 1};var Nr=4294967296n;function Ir(r){let t=0,e=0;for(let n=0;n<r.length;++n)e=r.charCodeAt(n),e<128?t+=1:e<2048?t+=2:(e&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,t+=4):t+=3;return t}function Lr(r,t,e){if(e-t<1)return"";let i,o=[],a=0,c;for(;t<e;)c=r[t++],c<128?o[a++]=c:c>191&&c<224?o[a++]=(c&31)<<6|r[t++]&63:c>239&&c<365?(c=((c&7)<<18|(r[t++]&63)<<12|(r[t++]&63)<<6|r[t++]&63)-65536,o[a++]=55296+(c>>10),o[a++]=56320+(c&1023)):o[a++]=(c&15)<<12|(r[t++]&63)<<6|r[t++]&63,a>8191&&((i??(i=[])).push(String.fromCharCode.apply(String,o)),a=0);return i!=null?(a>0&&i.push(String.fromCharCode.apply(String,o.slice(0,a))),i.join("")):String.fromCharCode.apply(String,o.slice(0,a))}function ue(r,t,e){let n=e,i,o;for(let a=0;a<r.length;++a)i=r.charCodeAt(a),i<128?t[e++]=i:i<2048?(t[e++]=i>>6|192,t[e++]=i&63|128):(i&64512)===55296&&((o=r.charCodeAt(a+1))&64512)===56320?(i=65536+((i&1023)<<10)+(o&1023),++a,t[e++]=i>>18|240,t[e++]=i>>12&63|128,t[e++]=i>>6&63|128,t[e++]=i&63|128):(t[e++]=i>>12|224,t[e++]=i>>6&63|128,t[e++]=i&63|128);return e-n}function U(r,t){return RangeError(`index out of range: ${r.pos} + ${t??1} > ${r.len}`)}function Vt(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}var le=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(t){this.buf=t,this.pos=0,this.len=t.length}uint32(){let t=4294967295;if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,U(this,10);return t}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw U(this,4);return Vt(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw U(this,4);return Vt(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw U(this,4);let t=Dr(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw U(this,4);let t=Tr(this.buf,this.pos);return this.pos+=8,t}bytes(){let t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw U(this,t);return this.pos+=t,e===n?new Uint8Array(0):this.buf.subarray(e,n)}string(){let t=this.bytes();return Lr(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw U(this,t);this.pos+=t}else do if(this.pos>=this.len)throw U(this);while(this.buf[this.pos++]&128);return this}skipType(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${t} at offset ${this.pos}`)}return this}readLongVarint(){let t=new F(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw U(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw U(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw U(this,8);let t=Vt(this.buf,this.pos+=4),e=Vt(this.buf,this.pos+=4);return new F(t,e)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let t=kr(this.buf,this.pos);return this.pos+=xt(t),t}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function de(r){return new le(r instanceof Uint8Array?r:r.subarray())}function _t(r,t,e){let n=de(r);return t.decode(n,void 0,e)}var pe={};E(pe,{base10:()=>zi});var zi=q({prefix:"9",name:"base10",alphabet:"0123456789"});var me={};E(me,{base16:()=>vi,base16upper:()=>Ci});var vi=S({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ci=S({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ge={};E(ge,{base2:()=>Fi});var Fi=S({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var we={};E(we,{base256emoji:()=>Ri});var vr=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Pi=vr.reduce((r,t,e)=>(r[e]=t,r),[]),Ui=vr.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function Mi(r){return r.reduce((t,e)=>(t+=Pi[e],t),"")}function Vi(r){let t=[];for(let e of r){let n=Ui[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var Ri=nt({prefix:"\u{1F680}",name:"base256emoji",encode:Mi,decode:Vi});var ye={};E(ye,{base36:()=>Hi,base36upper:()=>Oi});var Hi=q({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Oi=q({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var be={};E(be,{base64:()=>Gi,base64pad:()=>$i,base64url:()=>qi,base64urlpad:()=>Xi});var Gi=S({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),$i=S({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),qi=S({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Xi=S({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var xe={};E(xe,{base8:()=>Ki});var Ki=S({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var _e={};E(_e,{identity:()=>Wi});var Wi=nt({prefix:"\0",name:"identity",encode:r=>Qt(r),decode:r=>Jt(r)});var qs=new TextEncoder,Xs=new TextDecoder;var Bt={};E(Bt,{code:()=>Rt,decode:()=>Yi,encode:()=>Qi,name:()=>Ji});var Ji="raw",Rt=85;function Qi(r){return P(r)}function Yi(r){return P(r)}var Be={};E(Be,{identity:()=>eo});var Cr=0,Zi="identity",Fr=P;function to(r){return j(Cr,Fr(r))}var eo={code:Cr,name:Zi,encode:Fr,digest:to};var Se={};E(Se,{sha256:()=>ke,sha512:()=>ro});function Q({name:r,code:t,encode:e}){return new Ae(r,t,e)}var Ae=class{name;code;encode;constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?j(this.code,e):e.then(n=>j(this.code,n))}else throw Error("Unknown type, must be binary type")}};function Ur(r){return async t=>new Uint8Array(await crypto.subtle.digest(r,t))}var ke=Q({name:"sha2-256",code:18,encode:Ur("SHA-256")}),ro=Q({name:"sha2-512",code:19,encode:Ur("SHA-512")});var De={..._e,...ge,...xe,...pe,...me,...re,...ye,...ne,...be,...we},oa={...Se,...Be};function Vr(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Mr=Vr("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Ee=Vr("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=z(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),no={utf8:Mr,"utf-8":Mr,hex:De.base16,latin1:Ee,ascii:Ee,binary:Ee,...De},Rr=no;function ht(r,t="utf8"){let e=Rr[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.decoder.decode(`${e.prefix}${r}`)}function Te(r){let t=r??8192,e=t>>>1,n,i=t;return function(a){if(a<1||a>e)return z(a);i+a>t&&(n=z(t),i=0);let c=n.subarray(i,i+=a);return i&7&&(i=(i|7)+1),c}}var Y=class{fn;len;next;val;constructor(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}};function Ne(){}var Le=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},io=Te();function oo(r){return globalThis.Buffer!=null?z(r):io(r)}var kt=class{len;head;tail;states;constructor(){this.len=0,this.head=new Y(Ne,0,0),this.tail=this.head,this.states=null}_push(t,e,n){return this.tail=this.tail.next=new Y(t,e,n),this.len+=e,this}uint32(t){return this.len+=(this.tail=this.tail.next=new ze((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this}int32(t){return t<0?this._push(Ht,10,F.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let e=F.fromBigInt(t);return this._push(Ht,e.length(),e)}uint64Number(t){return this._push(Ar,xt(t),t)}uint64String(t){return this.uint64(BigInt(t))}int64(t){return this.uint64(t)}int64Number(t){return this.uint64Number(t)}int64String(t){return this.uint64String(t)}sint64(t){let e=F.fromBigInt(t).zzEncode();return this._push(Ht,e.length(),e)}sint64Number(t){let e=F.fromNumber(t).zzEncode();return this._push(Ht,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(Ie,1,t?1:0)}fixed32(t){return this._push(At,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=F.fromBigInt(t);return this._push(At,4,e.lo)._push(At,4,e.hi)}fixed64Number(t){let e=F.fromNumber(t);return this._push(At,4,e.lo)._push(At,4,e.hi)}fixed64String(t){return this.fixed64(BigInt(t))}sfixed64(t){return this.fixed64(t)}sfixed64Number(t){return this.fixed64Number(t)}sfixed64String(t){return this.fixed64String(t)}float(t){return this._push(Sr,4,t)}double(t){return this._push(Er,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(Ie,1,0):this.uint32(e)._push(ao,e,t)}string(t){let e=Ir(t);return e!==0?this.uint32(e)._push(ue,e,t):this._push(Ie,1,0)}fork(){return this.states=new Le(this),this.head=this.tail=new Y(Ne,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Y(Ne,0,0),this.len=0),this}ldelim(){let t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=t.next,this.tail=e,this.len+=n),this}finish(){let t=this.head.next,e=oo(this.len),n=0;for(;t!=null;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e}};function Ie(r,t,e){t[e]=r&255}function so(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var ze=class extends Y{next;constructor(t,e){super(so,t,e),this.next=void 0}};function Ht(r,t,e){for(;r.hi!==0;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}function At(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function ao(r,t,e){t.set(r,e)}globalThis.Buffer!=null&&(kt.prototype.bytes=function(r){let t=r.length>>>0;return this.uint32(t),t>0&&this._push(co,t,r),this},kt.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(ho,t,r),this});function co(r,t,e){t.set(r,e)}function ho(r,t,e){r.length<40?ue(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(ht(r),e)}function ve(){return new kt}function St(r,t){let e=ve();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var ft;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(ft||(ft={}));function Ot(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function Ce(r){function t(i){if(r[i.toString()]==null)throw new Error("Invalid enum value");return r[i]}let e=function(o,a){let c=t(o);a.int32(c)},n=function(o){let a=o.int32();return t(a)};return Ot("enum",ft.VARINT,e,n)}function Dt(r,t){return Ot("message",ft.LENGTH_DELIMITED,r,t)}var M;(function(r){let t;(function(i){i.Raw="Raw",i.Directory="Directory",i.File="File",i.Metadata="Metadata",i.Symlink="Symlink",i.HAMTShard="HAMTShard"})(t=r.DataType||(r.DataType={}));let e;(function(i){i[i.Raw=0]="Raw",i[i.Directory=1]="Directory",i[i.File=2]="File",i[i.Metadata=3]="Metadata",i[i.Symlink=4]="Symlink",i[i.HAMTShard=5]="HAMTShard"})(e||(e={})),function(i){i.codec=()=>Ce(e)}(t=r.DataType||(r.DataType={}));let n;r.codec=()=>(n==null&&(n=Dt((i,o,a={})=>{if(a.lengthDelimited!==!1&&o.fork(),i.Type!=null&&(o.uint32(8),r.DataType.codec().encode(i.Type,o)),i.Data!=null&&(o.uint32(18),o.bytes(i.Data)),i.filesize!=null&&(o.uint32(24),o.uint64(i.filesize)),i.blocksizes!=null)for(let c of i.blocksizes)o.uint32(32),o.uint64(c);i.hashType!=null&&(o.uint32(40),o.uint64(i.hashType)),i.fanout!=null&&(o.uint32(48),o.uint64(i.fanout)),i.mode!=null&&(o.uint32(56),o.uint32(i.mode)),i.mtime!=null&&(o.uint32(66),Gt.codec().encode(i.mtime,o)),a.lengthDelimited!==!1&&o.ldelim()},(i,o)=>{let a={blocksizes:[]},c=o==null?i.len:i.pos+o;for(;i.pos<c;){let l=i.uint32();switch(l>>>3){case 1:a.Type=r.DataType.codec().decode(i);break;case 2:a.Data=i.bytes();break;case 3:a.filesize=i.uint64();break;case 4:a.blocksizes.push(i.uint64());break;case 5:a.hashType=i.uint64();break;case 6:a.fanout=i.uint64();break;case 7:a.mode=i.uint32();break;case 8:a.mtime=Gt.codec().decode(i,i.uint32());break;default:i.skipType(l&7);break}}return a})),n),r.encode=i=>St(i,r.codec()),r.decode=i=>_t(i,r.codec())})(M||(M={}));var Gt;(function(r){let t;r.codec=()=>(t==null&&(t=Dt((e,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),e.Seconds!=null&&(n.uint32(8),n.int64(e.Seconds)),e.FractionalNanoseconds!=null&&(n.uint32(21),n.fixed32(e.FractionalNanoseconds)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={},o=n==null?e.len:e.pos+n;for(;e.pos<o;){let a=e.uint32();switch(a>>>3){case 1:i.Seconds=e.int64();break;case 2:i.FractionalNanoseconds=e.fixed32();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>St(e,r.codec()),r.decode=e=>_t(e,r.codec())})(Gt||(Gt={}));var Hr;(function(r){let t;r.codec=()=>(t==null&&(t=Dt((e,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),e.MimeType!=null&&(n.uint32(10),n.string(e.MimeType)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={},o=n==null?e.len:e.pos+n;for(;e.pos<o;){let a=e.uint32();switch(a>>>3){case 1:i.MimeType=e.string();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>St(e,r.codec()),r.decode=e=>_t(e,r.codec())})(Hr||(Hr={}));var Or={Raw:"raw",Directory:"directory",File:"file",Metadata:"metadata",Symlink:"symlink",HAMTShard:"hamt-sharded-directory"},fo=["directory","hamt-sharded-directory"],Gr=parseInt("0644",8),$r=parseInt("0755",8),L=class r{static unmarshal(t){let e=M.decode(t),n=new r({type:Or[e.Type!=null?e.Type.toString():"File"],data:e.Data,blockSizes:e.blocksizes,mode:e.mode,mtime:e.mtime!=null?{secs:e.mtime.Seconds??0n,nsecs:e.mtime.FractionalNanoseconds}:void 0,fanout:e.fanout});return n._originalMode=e.mode??0,n}type;data;blockSizes;hashType;fanout;mtime;_mode;_originalMode;constructor(t={type:"file"}){let{type:e,data:n,blockSizes:i,hashType:o,fanout:a,mtime:c,mode:l}=t;if(e!=null&&!Object.values(Or).includes(e))throw(0,Fe.default)(new Error("Type: "+e+" is not valid"),"ERR_INVALID_TYPE");this.type=e??"file",this.data=n,this.hashType=o,this.fanout=a,this.blockSizes=i??[],this._originalMode=0,this.mode=l,this.mtime=c}set mode(t){t==null?this._mode=this.isDirectory()?$r:Gr:this._mode=t&4095}get mode(){return this._mode}isDirectory(){return fo.includes(this.type)}addBlockSize(t){this.blockSizes.push(t)}removeBlockSize(t){this.blockSizes.splice(t,1)}fileSize(){if(this.isDirectory())return 0n;let t=0n;return this.blockSizes.forEach(e=>{t+=e}),this.data!=null&&(t+=BigInt(this.data.length)),t}marshal(){let t;switch(this.type){case"raw":t=M.DataType.Raw;break;case"directory":t=M.DataType.Directory;break;case"file":t=M.DataType.File;break;case"metadata":t=M.DataType.Metadata;break;case"symlink":t=M.DataType.Symlink;break;case"hamt-sharded-directory":t=M.DataType.HAMTShard;break;default:throw(0,Fe.default)(new Error(`Type: ${t} is not valid`),"ERR_INVALID_TYPE")}let e=this.data;(this.data==null||this.data.length===0)&&(e=void 0);let n;this.mode!=null&&(n=this._originalMode&4294963200|(this.mode??0),n===Gr&&!this.isDirectory()&&(n=void 0),n===$r&&this.isDirectory()&&(n=void 0));let i;return this.mtime!=null&&(i={Seconds:this.mtime.secs,FractionalNanoseconds:this.mtime.nsecs}),M.encode({Type:t,Data:e,filesize:this.isDirectory()?void 0:this.fileSize(),blocksizes:this.blockSizes,hashType:this.hashType,fanout:this.fanout,mode:n,mtime:i})}};var $=class extends Event{constructor(t,e){super(t),this.detail=e}};var V=async(r,t,e)=>{e.codec==null&&(e.codec=bt);let n=await ke.digest(r),i=T.create(e.cidVersion,e.codec.code,n);return await t.put(i,r,e),i};function qr(r){return async function*(e,n){let i=0n;for await(let o of e.content)yield async()=>{let a,c={codec:bt,cidVersion:r.cidVersion,onProgress:r.onProgress};r.rawLeaves?(c.codec=Bt,c.cidVersion=1):(a=new L({type:r.leafType,data:o}),o=C({Data:a.marshal(),Links:[]}));let l=await V(o,n,c);return i+=BigInt(o.byteLength),r.onProgress?.(new $("unixfs:importer:progress:file:write",{bytesWritten:i,cid:l,path:e.path})),{cid:l,unixfs:a,size:BigInt(o.length),block:o}}}}var Pe=tt(ut(),1);var Xr=async(r,t,e)=>{let n=new L({type:"directory",mtime:r.mtime,mode:r.mode}),i=C(v({Data:n.marshal()})),o=await V(i,t,e),a=r.path;return{cid:o,path:a,unixfs:n,size:BigInt(i.length),originalPath:r.originalPath,block:i}};async function*uo(r,t,e){let n=-1,i;for await(let o of lt(e.bufferImporter(r,t),e.blockWriteConcurrency)){if(n++,n===0){i={...o,single:!0};continue}else n===1&&i!=null&&(yield{...i,block:void 0,single:void 0},i=void 0);yield{...o,block:void 0}}i!=null&&(yield i)}function Kr(r){return r.single===!0}var lo=(r,t,e)=>async function(i){if(i.length===1&&Kr(i[0])&&e.reduceSingleLeafToSelf){let f=i[0],w=f.block;return Kr(f)&&(r.mtime!==void 0||r.mode!==void 0)&&(f.unixfs=new L({type:"file",mtime:r.mtime,mode:r.mode,data:f.block}),w={Data:f.unixfs.marshal(),Links:[]},f.block=C(v(w)),f.cid=await V(f.block,t,{...e,cidVersion:e.cidVersion}),f.size=BigInt(f.block.length)),e.onProgress?.(new $("unixfs:importer:progress:file:layout",{cid:f.cid,path:f.originalPath})),{cid:f.cid,path:r.path,unixfs:f.unixfs,size:f.size,originalPath:f.originalPath}}let o=new L({type:"file",mtime:r.mtime,mode:r.mode}),a=i.filter(f=>f.cid.code===Rt&&f.size>0||f.unixfs!=null&&f.unixfs.data==null&&f.unixfs.fileSize()>0n?!0:!!f.unixfs?.data?.length).map(f=>f.cid.code===Rt?(o.addBlockSize(f.size),{Name:"",Tsize:Number(f.size),Hash:f.cid}):(f.unixfs==null||f.unixfs.data==null?o.addBlockSize(f.unixfs?.fileSize()??0n):o.addBlockSize(BigInt(f.unixfs.data.length)),{Name:"",Tsize:Number(f.size),Hash:f.cid})),c={Data:o.marshal(),Links:a},l=C(v(c)),b=await V(l,t,e);return e.onProgress?.(new $("unixfs:importer:progress:file:layout",{cid:b,path:r.originalPath})),{cid:b,path:r.path,unixfs:o,size:BigInt(l.length+c.Links.reduce((f,w)=>f+(w.Tsize??0),0)),originalPath:r.originalPath,block:l}},Wr=async(r,t,e)=>e.layout(uo(r,t,e),lo(r,t,e));function po(r){return Symbol.iterator in r}function mo(r){return Symbol.asyncIterator in r}function go(r){try{if(r instanceof Uint8Array)return async function*(){yield r}();if(po(r))return async function*(){yield*r}();if(mo(r))return r}catch{throw(0,Pe.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}throw(0,Pe.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}function jr(r){return async function*(e,n){for await(let i of e){let o;if(i.path!=null&&(o=i.path,i.path=i.path.split("/").filter(a=>a!=null&&a!==".").join("/")),wo(i)){let a={path:i.path,mtime:i.mtime,mode:i.mode,content:async function*(){let c=0n;for await(let l of r.chunker(r.chunkValidator(go(i.content)))){let b=BigInt(l.byteLength);c+=b,r.onProgress?.(new $("unixfs:importer:progress:file:read",{bytesRead:c,chunkSize:b,path:i.path})),yield l}}(),originalPath:o};yield async()=>Wr(a,n,r)}else if(i.path!=null){let a={path:i.path,mtime:i.mtime,mode:i.mode,originalPath:o};yield async()=>Xr(a,n,r)}else throw new Error("Import candidate must have content or path or both")}}}function wo(r){return r.content!=null}var Ue=tt(ut(),1);var Jr=()=>async function*(t){for await(let e of t){if(e.length===void 0)throw(0,Ue.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT");if(typeof e=="string"||e instanceof String)yield ht(e.toString());else if(Array.isArray(e))yield Uint8Array.from(e);else if(e instanceof Uint8Array)yield e;else throw(0,Ue.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}};var yo=174;function Me(r){let t=r?.maxChildrenPerNode??yo;return async function e(n,i){let o=[];for await(let a of Ft(n,t))o.push(await i(a));return o.length>1?e(o,i):o[0]}}var H=class{options;root;dir;path;dirty;flat;parent;parentKey;unixfs;mode;mtime;cid;size;nodeSize;constructor(t,e){this.options=e??{},this.root=t.root,this.dir=t.dir,this.path=t.path,this.dirty=t.dirty,this.flat=t.flat,this.parent=t.parent,this.parentKey=t.parentKey,this.unixfs=t.unixfs,this.mode=t.mode,this.mtime=t.mtime}},Et=T.parse("QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn"),Tt=T.parse("zdj7WbTaiJT1fgatdet9Ei9iDB5hdCxkbVyhyh8YTUnXMiwYi");var Z=class extends H{_children;constructor(t,e){super(t,e),this._children=new Map}async put(t,e){this.cid=void 0,this.size=void 0,this.nodeSize=void 0,this._children.set(t,e)}async get(t){return Promise.resolve(this._children.get(t))}childCount(){return this._children.size}directChildrenCount(){return this.childCount()}onlyChild(){return this._children.values().next().value}async*eachChildSeries(){for(let[t,e]of this._children.entries())yield{key:t,child:e}}estimateNodeSize(){if(this.nodeSize!==void 0)return this.nodeSize;this.nodeSize=0;for(let[t,e]of this._children.entries())e.size!=null&&e.cid!=null&&(this.nodeSize+=t.length+(this.options.cidVersion===1?Tt.bytes.byteLength:Et.bytes.byteLength));return this.nodeSize}async*flush(t){let e=[];for(let[l,b]of this._children.entries()){let f=b;if(b instanceof H)for await(let w of b.flush(t))f=w,yield w;f.size!=null&&f.cid!=null&&e.push({Name:l,Tsize:Number(f.size),Hash:f.cid})}let n=new L({type:"directory",mtime:this.mtime,mode:this.mode}),i={Data:n.marshal(),Links:e},o=C(v(i)),a=await V(o,t,this.options),c=o.length+i.Links.reduce((l,b)=>l+(b.Tsize==null?0:b.Tsize),0);this.cid=a,this.size=c,yield{cid:a,unixfs:n,path:this.path,size:BigInt(c)}}};var qt=tt(Zr(),1);function bo(r){let t=new Array(4);for(let e=0;e<4;e++)t[e]=r&255,r=r>>8;return new Uint8Array(t)}var Ac=Q({name:"murmur3-32",code:35,encode:r=>bo(qt.default.x86.hash32(r))}),tn=Q({name:"murmur3-128",code:34,encode:r=>rt.fromHex(qt.default.x64.hash128(r))}),kc=Q({name:"murmur3-x64-64",code:34,encode:r=>rt.fromHex(qt.default.x64.hash128(r)).subarray(0,8)});var on=tt(nn(),1);var W=class r{_options;_popCount;_parent;_posAtParent;_children;key;constructor(t,e,n=0){this._options=t,this._popCount=0,this._parent=e,this._posAtParent=n,this._children=new on.default,this.key=null}async put(t,e){let n=await this._findNewBucketAndPos(t);n.bucket._putAt(n,t,e)}async get(t){let e=await this._findChild(t);if(e!=null)return e.value}async del(t){let e=await this._findPlace(t),n=e.bucket._at(e.pos);n!=null&&n.key===t&&e.bucket._delAt(e.pos)}leafCount(){return this._children.compactArray().reduce((e,n)=>n instanceof r?e+n.leafCount():e+1,0)}childrenCount(){return this._children.length}onlyChild(){return this._children.get(0)}*eachLeafSeries(){let t=this._children.compactArray();for(let e of t)e instanceof r?yield*e.eachLeafSeries():yield e}serialize(t,e){let n=[];return e(this._children.reduce((i,o,a)=>(o!=null&&(o instanceof r?i.push(o.serialize(t,e)):i.push(t(o,a))),i),n))}async asyncTransform(t,e){return sn(this,t,e)}toJSON(){return this.serialize(ko,So)}prettyPrint(){return JSON.stringify(this.toJSON(),null," ")}tableSize(){return Math.pow(2,this._options.bits)}async _findChild(t){let e=await this._findPlace(t),n=e.bucket._at(e.pos);if(!(n instanceof r)&&n!=null&&n.key===t)return n}async _findPlace(t){let e=this._options.hash(typeof t=="string"?ht(t):t),n=await e.take(this._options.bits),i=this._children.get(n);return i instanceof r?i._findPlace(e):{bucket:this,pos:n,hash:e,existingChild:i}}async _findNewBucketAndPos(t){let e=await this._findPlace(t);if(e.existingChild!=null&&e.existingChild.key!==t){let n=new r(this._options,e.bucket,e.pos);e.bucket._putObjectAt(e.pos,n);let i=await n._findPlace(e.existingChild.hash);return i.bucket._putAt(i,e.existingChild.key,e.existingChild.value),n._findNewBucketAndPos(e.hash)}return e}_putAt(t,e,n){this._putObjectAt(t.pos,{key:e,value:n,hash:t.hash})}_putObjectAt(t,e){this._children.get(t)==null&&this._popCount++,this._children.set(t,e)}_delAt(t){if(t===-1)throw new Error("Invalid position");this._children.get(t)!=null&&this._popCount--,this._children.unset(t),this._level()}_level(){if(this._parent!=null&&this._popCount<=1)if(this._popCount===1){let t=this._children.find(Ao);if(t!=null&&!(t instanceof r)){let e=t.hash;e.untake(this._options.bits);let n={pos:this._posAtParent,hash:e,bucket:this._parent};this._parent._putAt(n,t.key,t.value)}}else this._parent._delAt(this._posAtParent)}_at(t){return this._children.get(t)}};function Ao(r){return!!r}function ko(r,t){return r.key}function So(r){return r}async function sn(r,t,e){let n=[];for(let i of r._children.compactArray())if(i instanceof W)await sn(i,t,e);else{let o=await t(i);n.push({bitField:r._children.bitField(),children:o})}return e(n)}var Do=[255,254,252,248,240,224,192,128],Eo=[1,3,7,15,31,63,127,255],Xt=class{_value;_currentBytePos;_currentBitPos;constructor(t){this._value=t,this._currentBytePos=t.length-1,this._currentBitPos=7}availableBits(){return this._currentBitPos+1+this._currentBytePos*8}totalBits(){return this._value.length*8}take(t){let e=t,n=0;for(;e>0&&this._haveBits();){let i=this._value[this._currentBytePos],o=this._currentBitPos+1,a=Math.min(o,e),c=To(i,o-a,a);n=(n<<a)+c,e-=a,this._currentBitPos-=a,this._currentBitPos<0&&(this._currentBitPos=7,this._currentBytePos--)}return n}untake(t){for(this._currentBitPos+=t;this._currentBitPos>7;)this._currentBitPos-=8,this._currentBytePos+=1}_haveBits(){return this._currentBytePos>=0}};function To(r,t,e){let n=No(t,e);return(r&n)>>>t}function No(r,t){return Do[r]&Eo[Math.min(t+r-1,7)]}function an(r){function t(e){return e instanceof Kt?e:new Kt(e,r)}return t}var Kt=class{_value;_hashFn;_depth;_availableBits;_currentBufferIndex;_buffers;constructor(t,e){if(!(t instanceof Uint8Array))throw new Error("can only hash Uint8Arrays");this._value=t,this._hashFn=e,this._depth=-1,this._availableBits=0,this._currentBufferIndex=0,this._buffers=[]}async take(t){let e=t;for(;this._availableBits<e;)await this._produceMoreBits();let n=0;for(;e>0;){let i=this._buffers[this._currentBufferIndex],o=Math.min(i.availableBits(),e),a=i.take(o);n=(n<<o)+a,e-=o,this._availableBits-=o,i.availableBits()===0&&this._currentBufferIndex++}return n}untake(t){let e=t;for(;e>0;){let n=this._buffers[this._currentBufferIndex],i=Math.min(n.totalBits()-n.availableBits(),e);n.untake(i),e-=i,this._availableBits+=i,this._currentBufferIndex>0&&n.totalBits()===n.availableBits()&&(this._depth--,this._currentBufferIndex--)}}async _produceMoreBits(){this._depth++;let t=this._depth>0?dt([this._value,Uint8Array.from([this._depth])]):this._value,e=await this._hashFn(t),n=new Xt(e);this._buffers.push(n),this._availableBits+=n.availableBits()}};function cn(r){if(r==null||r.hashFn==null)throw new Error("please define an options.hashFn");let t={bits:r.bits??8,hash:an(r.hashFn)};return new W(t)}async function Io(r){return(await tn.encode(r)).slice(0,8).reverse()}var hn=BigInt(34),Lo=8,Ve=class extends H{_bucket;constructor(t,e){super(t,e),this._bucket=cn({hashFn:Io,bits:e.shardFanoutBits??Lo})}async put(t,e){this.cid=void 0,this.size=void 0,this.nodeSize=void 0,await this._bucket.put(t,e)}async get(t){return this._bucket.get(t)}childCount(){return this._bucket.leafCount()}directChildrenCount(){return this._bucket.childrenCount()}onlyChild(){return this._bucket.onlyChild()}async*eachChildSeries(){for await(let{key:t,value:e}of this._bucket.eachLeafSeries())yield{key:t,child:e}}estimateNodeSize(){return this.nodeSize!==void 0?this.nodeSize:(this.nodeSize=ln(this._bucket,this,this.options),this.nodeSize)}async*flush(t){for await(let e of un(this._bucket,t,this,this.options))yield{...e,path:this.path}}},fn=Ve;async function*un(r,t,e,n){let i=r._children,o=(r.tableSize()-1).toString(16).length,a=[],c=0n;for(let h=0;h<i.length;h++){let d=i.get(h);if(d==null)continue;let D=h.toString(16).toUpperCase().padStart(o,"0");if(d instanceof W){let u;for await(let p of un(d,t,null,n))u=p;if(u==null)throw new Error("Could not flush sharded directory, no subshard found");a.push({Name:D,Tsize:Number(u.size),Hash:u.cid}),c+=u.size}else if(zo(d.value)){let u=d.value,p;for await(let y of u.flush(t))p=y,yield p;if(p==null)throw new Error("Did not flush dir");let m=D+d.key;a.push({Name:m,Tsize:Number(p.size),Hash:p.cid}),c+=p.size}else{let u=d.value;if(u.cid==null)continue;let p=D+d.key,m=u.size;a.push({Name:p,Tsize:Number(m),Hash:u.cid}),c+=BigInt(m??0)}}let l=Uint8Array.from(i.bitField().reverse()),b=new L({type:"hamt-sharded-directory",data:l,fanout:BigInt(r.tableSize()),hashType:hn,mtime:e?.mtime,mode:e?.mode}),f={Data:b.marshal(),Links:a},w=C(v(f)),k=await V(w,t,n),s=BigInt(w.byteLength)+c;yield{cid:k,unixfs:b,size:s}}function zo(r){return typeof r.flush=="function"}function ln(r,t,e){let n=r._children,i=(r.tableSize()-1).toString(16).length,o=[];for(let b=0;b<n.length;b++){let f=n.get(b);if(f==null)continue;let w=b.toString(16).toUpperCase().padStart(i,"0");if(f instanceof W){let k=ln(f,null,e);o.push({Name:w,Tsize:Number(k),Hash:e.cidVersion===0?Et:Tt})}else if(typeof f.value.flush=="function"){let s=f.value.nodeSize();o.push({Name:w+f.key,Tsize:Number(s),Hash:e.cidVersion===0?Et:Tt})}else{let k=f.value;if(k.cid==null)continue;let s=w+f.key,h=k.size;o.push({Name:s,Tsize:Number(h),Hash:k.cid})}}let a=Uint8Array.from(n.bitField().reverse()),c=new L({type:"hamt-sharded-directory",data:a,fanout:BigInt(r.tableSize()),hashType:hn,mtime:t?.mtime,mode:t?.mode});return C(v({Data:c.marshal(),Links:o})).length}async function Re(r,t,e,n){let i=t;t instanceof Z&&t.estimateNodeSize()>e&&(i=await vo(t,n));let o=i.parent;if(o!=null){if(i!==t){if(r!=null&&(r.parent=i),i.parentKey==null)throw new Error("No parent key found");await o.put(i.parentKey,i)}return Re(i,o,e,n)}return i}async function vo(r,t){let e=new fn({root:r.root,dir:!0,parent:r.parent,parentKey:r.parentKey,path:r.path,dirty:r.dirty,flat:!1,mtime:r.mtime,mode:r.mode},t);for await(let{key:n,child:i}of r.eachChildSeries())await e.put(n,i);return e}var dn=(r="")=>r.split(/(?<!\\)\//).filter(Boolean);async function Co(r,t,e){let n=dn(r.path??""),i=n.length-1,o=t,a="";for(let c=0;c<n.length;c++){let l=n[c];a+=`${a!==""?"/":""}${l}`;let b=c===i;if(o.dirty=!0,o.cid=void 0,o.size=void 0,b)await o.put(l,r),t=await Re(null,o,e.shardSplitThresholdBytes,e);else{let f=await o.get(l);(f==null||!(f instanceof H))&&(f=new Z({root:!1,dir:!0,parent:o,parentKey:l,path:a,dirty:!0,flat:!0,mtime:f?.unixfs?.mtime,mode:f?.unixfs?.mode},e)),await o.put(l,f),o=f}}return t}async function*pn(r,t){if(!(r instanceof H)){r.unixfs?.isDirectory()===!0&&(yield r);return}yield*r.flush(t)}function mn(r){return async function*(e,n){let i=new Z({root:!0,dir:!0,path:"",dirty:!0,flat:!0},r),o,a=!1;for await(let c of e){if(c==null)continue;let l=`${c.originalPath??""}`.split("/")[0];l!=null&&l!==""&&(o==null?(o=l,a=!0):o!==l&&(a=!1)),i=await Co(c,i,r),(c.unixfs==null||!c.unixfs.isDirectory())&&(yield c)}if(r.wrapWithDirectory||a&&i.childCount()>1)yield*pn(i,n);else for await(let c of i.eachChildSeries())c!=null&&(yield*pn(c.child,n))}}async function*Oe(r,t,e={}){let n;Symbol.asyncIterator in r||Symbol.iterator in r?n=r:n=[r];let i=e.wrapWithDirectory??!1,o=e.shardSplitThresholdBytes??262144,a=e.shardFanoutBits??8,c=e.cidVersion??1,l=e.rawLeaves??!0,b=e.leafType??"file",f=e.fileImportConcurrency??50,w=e.blockWriteConcurrency??10,k=e.reduceSingleLeafToSelf??!0,s=e.chunker??Je(),h=e.chunkValidator??Jr(),d=e.dagBuilder??jr({chunker:s,chunkValidator:h,wrapWithDirectory:i,layout:e.layout??Me(),bufferImporter:e.bufferImporter??qr({cidVersion:c,rawLeaves:l,leafType:b,onProgress:e.onProgress}),blockWriteConcurrency:w,reduceSingleLeafToSelf:k,cidVersion:c,onProgress:e.onProgress}),D=e.treeBuilder??mn({wrapWithDirectory:i,shardSplitThresholdBytes:o,shardFanoutBits:a,cidVersion:c,onProgress:e.onProgress});for await(let u of D(lt(d(n,t),f),t))yield{cid:u.cid,path:u.path,unixfs:u.unixfs,size:u.size}}async function Ge(r,t,e={}){let n=await Wt(Oe([r],t,e));if(n==null)throw(0,He.default)(new Error("Nothing imported"),"ERR_INVALID_PARAMS");return n}async function Fo(r,t,e={}){let n=await Wt(Oe([r],t,e));if(n==null)throw(0,He.default)(new Error("Nothing imported"),"ERR_INVALID_PARAMS");return n}async function Po(r,t,e={}){return Ge({content:r},t,e)}async function Uo(r,t,e={}){return Ge({content:r},t,e)}return _n(Mo);})();
2
+ "use strict";var IpfsUnixfsImporter=(()=>{var wn=Object.create;var Ct=Object.defineProperty;var yn=Object.getOwnPropertyDescriptor;var bn=Object.getOwnPropertyNames;var xn=Object.getPrototypeOf,_n=Object.prototype.hasOwnProperty;var Ft=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),D=(r,t)=>{for(var e in t)Ct(r,e,{get:t[e],enumerable:!0})},qe=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of bn(t))!_n.call(r,i)&&i!==e&&Ct(r,i,{get:()=>t[i],enumerable:!(n=yn(t,i))||n.enumerable});return r};var tt=(r,t,e)=>(e=r!=null?wn(xn(r)):{},qe(t||!r||!r.__esModule?Ct(e,"default",{value:r,enumerable:!0}):e,r)),Bn=r=>qe(Ct({},"__esModule",{value:!0}),r);var ut=Ft((Vo,Ke)=>{"use strict";function Xe(r,t){for(let e in t)Object.defineProperty(r,e,{value:t[e],enumerable:!0,configurable:!0});return r}function An(r,t,e){if(!r||typeof r=="string")throw new TypeError("Please pass an Error to err-code");e||(e={}),typeof t=="object"&&(e=t,t=""),t&&(e.code=t);try{return Xe(r,e)}catch{e.message=r.message,e.stack=r.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(r)),Xe(new i,e)}}Ke.exports=An});var Zr=Ft((It,qt)=>{(function(r,t){"use strict";var e={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function n(s){if(!Array.isArray(s)&&!ArrayBuffer.isView(s))return!1;for(var h=0;h<s.length;h++)if(!Number.isInteger(s[h])||s[h]<0||s[h]>255)return!1;return!0}function i(s,h){return(s&65535)*h+(((s>>>16)*h&65535)<<16)}function o(s,h){return s<<h|s>>>32-h}function a(s){return s^=s>>>16,s=i(s,2246822507),s^=s>>>13,s=i(s,3266489909),s^=s>>>16,s}function c(s,h){s=[s[0]>>>16,s[0]&65535,s[1]>>>16,s[1]&65535],h=[h[0]>>>16,h[0]&65535,h[1]>>>16,h[1]&65535];var d=[0,0,0,0];return d[3]+=s[3]+h[3],d[2]+=d[3]>>>16,d[3]&=65535,d[2]+=s[2]+h[2],d[1]+=d[2]>>>16,d[2]&=65535,d[1]+=s[1]+h[1],d[0]+=d[1]>>>16,d[1]&=65535,d[0]+=s[0]+h[0],d[0]&=65535,[d[0]<<16|d[1],d[2]<<16|d[3]]}function l(s,h){s=[s[0]>>>16,s[0]&65535,s[1]>>>16,s[1]&65535],h=[h[0]>>>16,h[0]&65535,h[1]>>>16,h[1]&65535];var d=[0,0,0,0];return d[3]+=s[3]*h[3],d[2]+=d[3]>>>16,d[3]&=65535,d[2]+=s[2]*h[3],d[1]+=d[2]>>>16,d[2]&=65535,d[2]+=s[3]*h[2],d[1]+=d[2]>>>16,d[2]&=65535,d[1]+=s[1]*h[3],d[0]+=d[1]>>>16,d[1]&=65535,d[1]+=s[2]*h[2],d[0]+=d[1]>>>16,d[1]&=65535,d[1]+=s[3]*h[1],d[0]+=d[1]>>>16,d[1]&=65535,d[0]+=s[0]*h[3]+s[1]*h[2]+s[2]*h[1]+s[3]*h[0],d[0]&=65535,[d[0]<<16|d[1],d[2]<<16|d[3]]}function b(s,h){return h%=64,h===32?[s[1],s[0]]:h<32?[s[0]<<h|s[1]>>>32-h,s[1]<<h|s[0]>>>32-h]:(h-=32,[s[1]<<h|s[0]>>>32-h,s[0]<<h|s[1]>>>32-h])}function f(s,h){return h%=64,h===0?s:h<32?[s[0]<<h|s[1]>>>32-h,s[1]<<h]:[s[1]<<h-32,0]}function w(s,h){return[s[0]^h[0],s[1]^h[1]]}function S(s){return s=w(s,[0,s[0]>>>1]),s=l(s,[4283543511,3981806797]),s=w(s,[0,s[0]>>>1]),s=l(s,[3301882366,444984403]),s=w(s,[0,s[0]>>>1]),s}e.x86.hash32=function(s,h){if(e.inputValidation&&!n(s))return t;h=h||0;for(var d=s.length%4,E=s.length-d,u=h,p=0,m=3432918353,y=461845907,x=0;x<E;x=x+4)p=s[x]|s[x+1]<<8|s[x+2]<<16|s[x+3]<<24,p=i(p,m),p=o(p,15),p=i(p,y),u^=p,u=o(u,13),u=i(u,5)+3864292196;switch(p=0,d){case 3:p^=s[x+2]<<16;case 2:p^=s[x+1]<<8;case 1:p^=s[x],p=i(p,m),p=o(p,15),p=i(p,y),u^=p}return u^=s.length,u=a(u),u>>>0},e.x86.hash128=function(s,h){if(e.inputValidation&&!n(s))return t;h=h||0;for(var d=s.length%16,E=s.length-d,u=h,p=h,m=h,y=h,x=0,_=0,g=0,A=0,O=597399067,Lt=2869860233,zt=951274213,vt=2716044179,B=0;B<E;B=B+16)x=s[B]|s[B+1]<<8|s[B+2]<<16|s[B+3]<<24,_=s[B+4]|s[B+5]<<8|s[B+6]<<16|s[B+7]<<24,g=s[B+8]|s[B+9]<<8|s[B+10]<<16|s[B+11]<<24,A=s[B+12]|s[B+13]<<8|s[B+14]<<16|s[B+15]<<24,x=i(x,O),x=o(x,15),x=i(x,Lt),u^=x,u=o(u,19),u+=p,u=i(u,5)+1444728091,_=i(_,Lt),_=o(_,16),_=i(_,zt),p^=_,p=o(p,17),p+=m,p=i(p,5)+197830471,g=i(g,zt),g=o(g,17),g=i(g,vt),m^=g,m=o(m,15),m+=y,m=i(m,5)+2530024501,A=i(A,vt),A=o(A,18),A=i(A,O),y^=A,y=o(y,13),y+=u,y=i(y,5)+850148119;switch(x=0,_=0,g=0,A=0,d){case 15:A^=s[B+14]<<16;case 14:A^=s[B+13]<<8;case 13:A^=s[B+12],A=i(A,vt),A=o(A,18),A=i(A,O),y^=A;case 12:g^=s[B+11]<<24;case 11:g^=s[B+10]<<16;case 10:g^=s[B+9]<<8;case 9:g^=s[B+8],g=i(g,zt),g=o(g,17),g=i(g,vt),m^=g;case 8:_^=s[B+7]<<24;case 7:_^=s[B+6]<<16;case 6:_^=s[B+5]<<8;case 5:_^=s[B+4],_=i(_,Lt),_=o(_,16),_=i(_,zt),p^=_;case 4:x^=s[B+3]<<24;case 3:x^=s[B+2]<<16;case 2:x^=s[B+1]<<8;case 1:x^=s[B],x=i(x,O),x=o(x,15),x=i(x,Lt),u^=x}return u^=s.length,p^=s.length,m^=s.length,y^=s.length,u+=p,u+=m,u+=y,p+=u,m+=u,y+=u,u=a(u),p=a(p),m=a(m),y=a(y),u+=p,u+=m,u+=y,p+=u,m+=u,y+=u,("00000000"+(u>>>0).toString(16)).slice(-8)+("00000000"+(p>>>0).toString(16)).slice(-8)+("00000000"+(m>>>0).toString(16)).slice(-8)+("00000000"+(y>>>0).toString(16)).slice(-8)},e.x64.hash128=function(s,h){if(e.inputValidation&&!n(s))return t;h=h||0;for(var d=s.length%16,E=s.length-d,u=[0,h],p=[0,h],m=[0,0],y=[0,0],x=[2277735313,289559509],_=[1291169091,658871167],g=0;g<E;g=g+16)m=[s[g+4]|s[g+5]<<8|s[g+6]<<16|s[g+7]<<24,s[g]|s[g+1]<<8|s[g+2]<<16|s[g+3]<<24],y=[s[g+12]|s[g+13]<<8|s[g+14]<<16|s[g+15]<<24,s[g+8]|s[g+9]<<8|s[g+10]<<16|s[g+11]<<24],m=l(m,x),m=b(m,31),m=l(m,_),u=w(u,m),u=b(u,27),u=c(u,p),u=c(l(u,[0,5]),[0,1390208809]),y=l(y,_),y=b(y,33),y=l(y,x),p=w(p,y),p=b(p,31),p=c(p,u),p=c(l(p,[0,5]),[0,944331445]);switch(m=[0,0],y=[0,0],d){case 15:y=w(y,f([0,s[g+14]],48));case 14:y=w(y,f([0,s[g+13]],40));case 13:y=w(y,f([0,s[g+12]],32));case 12:y=w(y,f([0,s[g+11]],24));case 11:y=w(y,f([0,s[g+10]],16));case 10:y=w(y,f([0,s[g+9]],8));case 9:y=w(y,[0,s[g+8]]),y=l(y,_),y=b(y,33),y=l(y,x),p=w(p,y);case 8:m=w(m,f([0,s[g+7]],56));case 7:m=w(m,f([0,s[g+6]],48));case 6:m=w(m,f([0,s[g+5]],40));case 5:m=w(m,f([0,s[g+4]],32));case 4:m=w(m,f([0,s[g+3]],24));case 3:m=w(m,f([0,s[g+2]],16));case 2:m=w(m,f([0,s[g+1]],8));case 1:m=w(m,[0,s[g]]),m=l(m,x),m=b(m,31),m=l(m,_),u=w(u,m)}return u=w(u,[0,s.length]),p=w(p,[0,s.length]),u=c(u,p),p=c(p,u),u=S(u),p=S(p),u=c(u,p),p=c(p,u),("00000000"+(u[0]>>>0).toString(16)).slice(-8)+("00000000"+(u[1]>>>0).toString(16)).slice(-8)+("00000000"+(p[0]>>>0).toString(16)).slice(-8)+("00000000"+(p[1]>>>0).toString(16)).slice(-8)},typeof It<"u"?(typeof qt<"u"&&qt.exports&&(It=qt.exports=e),It.murmurHash3=e):typeof define=="function"&&define.amd?define([],function(){return e}):(e._murmurHash3=r.murmurHash3,e.noConflict=function(){return r.murmurHash3=e._murmurHash3,e._murmurHash3=t,e.noConflict=t,e},r.murmurHash3=e)})(It)});var tn=Ft((_c,Yr)=>{Yr.exports=Zr()});var on=Ft((Tc,nn)=>{"use strict";nn.exports=class{constructor(){this._bitArrays=[],this._data=[],this._length=0,this._changedLength=!1,this._changedData=!1}set(t,e){let n=this._internalPositionFor(t,!1);if(e===void 0)n!==-1&&(this._unsetInternalPos(n),this._unsetBit(t),this._changedLength=!0,this._changedData=!0);else{let i=!1;n===-1?(n=this._data.length,this._setBit(t),this._changedData=!0):i=!0,this._setInternalPos(n,t,e,i),this._changedLength=!0}}unset(t){this.set(t,void 0)}get(t){this._sortData();let e=this._internalPositionFor(t,!0);if(e!==-1)return this._data[e][1]}push(t){return this.set(this.length,t),this.length}get length(){if(this._sortData(),this._changedLength){let t=this._data[this._data.length-1];this._length=t?t[0]+1:0,this._changedLength=!1}return this._length}forEach(t){let e=0;for(;e<this.length;)t(this.get(e),e,this),e++}map(t){let e=0,n=new Array(this.length);for(;e<this.length;)n[e]=t(this.get(e),e,this),e++;return n}reduce(t,e){let n=0,i=e;for(;n<this.length;){let o=this.get(n);i=t(i,o,n),n++}return i}find(t){let e=0,n,i;for(;e<this.length&&!n;)i=this.get(e),n=t(i),e++;return n?i:void 0}_internalPositionFor(t,e){let n=this._bytePosFor(t,e);if(n>=this._bitArrays.length)return-1;let i=this._bitArrays[n],o=t-n*7;if(!((i&1<<o)>0))return-1;let c=this._bitArrays.slice(0,n).reduce(xo,0),l=~(4294967295<<o+1),b=rn(i&l);return c+b-1}_bytePosFor(t,e){let n=Math.floor(t/7),i=n+1;for(;!e&&this._bitArrays.length<i;)this._bitArrays.push(0);return n}_setBit(t){let e=this._bytePosFor(t,!1);this._bitArrays[e]|=1<<t-e*7}_unsetBit(t){let e=this._bytePosFor(t,!1);this._bitArrays[e]&=~(1<<t-e*7)}_setInternalPos(t,e,n,i){let o=this._data,a=[e,n];if(i)this._sortData(),o[t]=a;else{if(o.length)if(o[o.length-1][0]>=e)o.push(a);else if(o[0][0]<=e)o.unshift(a);else{let c=Math.round(o.length/2);this._data=o.slice(0,c).concat(a).concat(o.slice(c))}else this._data.push(a);this._changedData=!0,this._changedLength=!0}}_unsetInternalPos(t){this._data.splice(t,1)}_sortData(){this._changedData&&this._data.sort(_o),this._changedData=!1}bitField(){let t=[],e=8,n=0,i=0,o,a=this._bitArrays.slice();for(;a.length||n;){n===0&&(o=a.shift(),n=7);let l=Math.min(n,e),b=~(255<<l),f=o&b;i|=f<<8-e,o=o>>>l,n-=l,e-=l,(!e||!n&&!a.length)&&(t.push(i),i=0,e=8)}for(var c=t.length-1;c>0&&t[c]===0;c--)t.pop();return t}compactArray(){return this._sortData(),this._data.map(Bo)}};function xo(r,t){return r+rn(t)}function rn(r){let t=r;return t=t-(t>>1&1431655765),t=(t&858993459)+(t>>2&858993459),(t+(t>>4)&252645135)*16843009>>24}function _o(r,t){return r[0]-t[0]}function Bo(r){return r[1]}});var Mo={};D(Mo,{importByteStream:()=>Uo,importBytes:()=>Po,importDirectory:()=>Fo,importFile:()=>$e,importer:()=>Ge});var Oe=tt(ut(),1);function Sn(r){return r[Symbol.asyncIterator]!=null}function kn(r){if(Sn(r))return(async()=>{for await(let t of r)return t})();for(let t of r)return t}var jt=kn;function En(r){return r[Symbol.asyncIterator]!=null}function Dn(r,t=1){return t=Number(t),En(r)?async function*(){let e=[];if(t<1&&(t=1),t!==Math.round(t))throw new Error("Batch size must be an integer");for await(let n of r)for(e.push(n);e.length>=t;)yield e.slice(0,t),e=e.slice(t);for(;e.length>0;)yield e.slice(0,t),e=e.slice(t)}():function*(){let e=[];if(t<1&&(t=1),t!==Math.round(t))throw new Error("Batch size must be an integer");for(let n of r)for(e.push(n);e.length>=t;)yield e.slice(0,t),e=e.slice(t);for(;e.length>0;)yield e.slice(0,t),e=e.slice(t)}()}var Pt=Dn;async function*lt(r,t=1){for await(let e of Pt(r,t)){let n=e.map(async i=>i().then(o=>({ok:!0,value:o}),o=>({ok:!1,err:o})));for(let i=0;i<n.length;i++){let o=await n[i];if(o.ok)yield o.value;else throw o.err}}}function G(r=0){return new Uint8Array(r)}function z(r=0){return new Uint8Array(r)}function dt(r,t){t==null&&(t=r.reduce((i,o)=>i+o.length,0));let e=z(t),n=0;for(let i of r)e.set(i,n),n+=i.length;return e}function We(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}var Je=Symbol.for("@achingbrain/uint8arraylist");function je(r,t){if(t==null||t<0)throw new RangeError("index is out of bounds");let e=0;for(let n of r){let i=e+n.byteLength;if(t<i)return{buf:n,index:t-e};e=i}throw new RangeError("index is out of bounds")}function Ut(r){return!!r?.[Je]}var et=class r{bufs;length;[Je]=!0;constructor(...t){this.bufs=[],this.length=0,t.length>0&&this.appendAll(t)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...t){this.appendAll(t)}appendAll(t){let e=0;for(let n of t)if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.push(n);else if(Ut(n))e+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}prepend(...t){this.prependAll(t)}prependAll(t){let e=0;for(let n of t.reverse())if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.unshift(n);else if(Ut(n))e+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}get(t){let e=je(this.bufs,t);return e.buf[e.index]}set(t,e){let n=je(this.bufs,t);n.buf[n.index]=e}write(t,e=0){if(t instanceof Uint8Array)for(let n=0;n<t.length;n++)this.set(e+n,t[n]);else if(Ut(t))for(let n=0;n<t.length;n++)this.set(e+n,t.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(t){if(t=Math.trunc(t),!(Number.isNaN(t)||t<=0)){if(t===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(t>=this.bufs[0].byteLength)t-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(t),this.length-=t;break}}}slice(t,e){let{bufs:n,length:i}=this._subList(t,e);return dt(n,i)}subarray(t,e){let{bufs:n,length:i}=this._subList(t,e);return n.length===1?n[0]:dt(n,i)}sublist(t,e){let{bufs:n,length:i}=this._subList(t,e),o=new r;return o.length=i,o.bufs=[...n],o}_subList(t,e){if(t=t??0,e=e??this.length,t<0&&(t=this.length+t),e<0&&(e=this.length+e),t<0||e>this.length)throw new RangeError("index is out of bounds");if(t===e)return{bufs:[],length:0};if(t===0&&e===this.length)return{bufs:this.bufs,length:this.length};let n=[],i=0;for(let o=0;o<this.bufs.length;o++){let a=this.bufs[o],c=i,l=c+a.byteLength;if(i=l,t>=l)continue;let b=t>=c&&t<l,f=e>c&&e<=l;if(b&&f){if(t===c&&e===l){n.push(a);break}let w=t-c;n.push(a.subarray(w,w+(e-t)));break}if(b){if(t===0){n.push(a);continue}n.push(a.subarray(t-c));continue}if(f){if(e===l){n.push(a);break}n.push(a.subarray(0,e-c));break}n.push(a)}return{bufs:n,length:e-t}}indexOf(t,e=0){if(!Ut(t)&&!(t instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=t instanceof Uint8Array?t:t.subarray();if(e=Number(e??0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),t.length===0)return e>this.length?this.length:e;let i=n.byteLength;if(i===0)throw new TypeError("search must be at least 1 byte long");let o=256,a=new Int32Array(o);for(let w=0;w<o;w++)a[w]=-1;for(let w=0;w<i;w++)a[n[w]]=w;let c=a,l=this.byteLength-n.byteLength,b=n.byteLength-1,f;for(let w=e;w<=l;w+=f){f=0;for(let S=b;S>=0;S--){let s=this.get(w+S);if(n[S]!==s){f=Math.max(1,S-c[s]);break}}if(f===0)return w}return-1}getInt8(t){let e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt8(0)}setInt8(t,e){let n=z(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,e),this.write(n,t)}getInt16(t,e){let n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,e)}setInt16(t,e,n){let i=G(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,e,n),this.write(i,t)}getInt32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,e)}setInt32(t,e,n){let i=G(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,e,n),this.write(i,t)}getBigInt64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,e)}setBigInt64(t,e,n){let i=G(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,e,n),this.write(i,t)}getUint8(t){let e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0)}setUint8(t,e){let n=z(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,e),this.write(n,t)}getUint16(t,e){let n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,e)}setUint16(t,e,n){let i=G(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,e,n),this.write(i,t)}getUint32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,e)}setUint32(t,e,n){let i=G(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,e,n),this.write(i,t)}getBigUint64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,e)}setBigUint64(t,e,n){let i=G(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,e,n),this.write(i,t)}getFloat32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,e)}setFloat32(t,e,n){let i=G(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,e,n),this.write(i,t)}getFloat64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,e)}setFloat64(t,e,n){let i=G(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,e,n),this.write(i,t)}equals(t){if(t==null||!(t instanceof r)||t.bufs.length!==this.bufs.length)return!1;for(let e=0;e<this.bufs.length;e++)if(!We(this.bufs[e],t.bufs[e]))return!1;return!0}static fromUint8Arrays(t,e){let n=new r;return n.bufs=t,e==null&&(e=t.reduce((i,o)=>i+o.byteLength,0)),n.length=e,n}};var Tn=262144,Qe=(r={})=>{let t=r.chunkSize??Tn;return async function*(n){let i=new et,o=0,a=!1;for await(let c of n)for(i.append(c),o+=c.length;o>=t;)if(yield i.slice(0,t),a=!0,t===i.length)i=new et,o=0;else{let l=new et;l.append(i.sublist(t)),i=l,o-=t}(!a||o>0)&&(yield i.subarray(0,o))}};var xt={};D(xt,{code:()=>Di,createLink:()=>yr,createNode:()=>wr,decode:()=>Ti,encode:()=>C,name:()=>Ei,prepare:()=>v,validate:()=>fe});var ne={};D(ne,{base32:()=>it,base32hex:()=>Vn,base32hexpad:()=>On,base32hexpadupper:()=>Gn,base32hexupper:()=>Hn,base32pad:()=>Mn,base32padupper:()=>Rn,base32upper:()=>Un,base32z:()=>$n});var rt={};D(rt,{coerce:()=>P,empty:()=>Ze,equals:()=>Jt,fromHex:()=>In,fromString:()=>Qt,isBinary:()=>Ln,toHex:()=>Nn,toString:()=>Zt});var Ze=new Uint8Array(0);function Nn(r){return r.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),"")}function In(r){let t=r.match(/../g);return t!=null?new Uint8Array(t.map(e=>parseInt(e,16))):Ze}function Jt(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function P(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function Ln(r){return r instanceof ArrayBuffer||ArrayBuffer.isView(r)}function Qt(r){return new TextEncoder().encode(r)}function Zt(r){return new TextDecoder().decode(r)}function zn(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var i=0;i<r.length;i++){var o=r.charAt(i),a=o.charCodeAt(0);if(e[a]!==255)throw new TypeError(o+" is ambiguous");e[a]=i}var c=r.length,l=r.charAt(0),b=Math.log(c)/Math.log(256),f=Math.log(256)/Math.log(c);function w(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var d=0,E=0,u=0,p=h.length;u!==p&&h[u]===0;)u++,d++;for(var m=(p-u)*f+1>>>0,y=new Uint8Array(m);u!==p;){for(var x=h[u],_=0,g=m-1;(x!==0||_<E)&&g!==-1;g--,_++)x+=256*y[g]>>>0,y[g]=x%c>>>0,x=x/c>>>0;if(x!==0)throw new Error("Non-zero carry");E=_,u++}for(var A=m-E;A!==m&&y[A]===0;)A++;for(var O=l.repeat(d);A<m;++A)O+=r.charAt(y[A]);return O}function S(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var d=0;if(h[d]!==" "){for(var E=0,u=0;h[d]===l;)E++,d++;for(var p=(h.length-d)*b+1>>>0,m=new Uint8Array(p);h[d];){var y=e[h.charCodeAt(d)];if(y===255)return;for(var x=0,_=p-1;(y!==0||x<u)&&_!==-1;_--,x++)y+=c*m[_]>>>0,m[_]=y%256>>>0,y=y/256>>>0;if(y!==0)throw new Error("Non-zero carry");u=x,d++}if(h[d]!==" "){for(var g=p-u;g!==p&&m[g]===0;)g++;for(var A=new Uint8Array(E+(p-g)),O=E;g!==p;)A[O++]=m[g++];return A}}}function s(h){var d=S(h);if(d)return d;throw new Error(`Non-${t} character`)}return{encode:w,decodeUnsafe:S,decode:s}}var vn=zn,Cn=vn,Ye=Cn;var Yt=class{name;prefix;baseEncode;constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},te=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return tr(this,t)}},ee=class{decoders;constructor(t){this.decoders=t}or(t){return tr(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n!=null)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function tr(r,t){return new ee({...r.decoders??{[r.prefix]:r},...t.decoders??{[t.prefix]:t}})}var re=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,e,n,i){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=i,this.encoder=new Yt(t,e,n),this.decoder=new te(t,e,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function nt({name:r,prefix:t,encode:e,decode:n}){return new re(r,t,e,n)}function q({name:r,prefix:t,alphabet:e}){let{encode:n,decode:i}=Ye(e,r);return nt({prefix:t,name:r,encode:n,decode:o=>P(i(o))})}function Fn(r,t,e,n){let i={};for(let f=0;f<t.length;++f)i[t[f]]=f;let o=r.length;for(;r[o-1]==="=";)--o;let a=new Uint8Array(o*e/8|0),c=0,l=0,b=0;for(let f=0;f<o;++f){let w=i[r[f]];if(w===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<e|w,c+=e,c>=8&&(c-=8,a[b++]=255&l>>c)}if(c>=e||255&l<<8-c)throw new SyntaxError("Unexpected end of data");return a}function Pn(r,t,e){let n=t[t.length-1]==="=",i=(1<<e)-1,o="",a=0,c=0;for(let l=0;l<r.length;++l)for(c=c<<8|r[l],a+=8;a>e;)a-=e,o+=t[i&c>>a];if(a!==0&&(o+=t[i&c<<e-a]),n)for(;o.length*e&7;)o+="=";return o}function k({name:r,prefix:t,bitsPerChar:e,alphabet:n}){return nt({prefix:t,name:r,encode(i){return Pn(i,n,e)},decode(i){return Fn(i,n,e,r)}})}var it=k({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Un=k({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Mn=k({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Rn=k({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Vn=k({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Hn=k({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),On=k({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Gn=k({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),$n=k({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ie={};D(ie,{base36:()=>pt,base36upper:()=>qn});var pt=q({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),qn=q({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var oe={};D(oe,{base58btc:()=>V,base58flickr:()=>Xn});var V=q({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Xn=q({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Kn=nr,er=128,Wn=127,jn=~Wn,Jn=Math.pow(2,31);function nr(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Jn;)t[e++]=r&255|er,r/=128;for(;r&jn;)t[e++]=r&255|er,r>>>=7;return t[e]=r|0,nr.bytes=e-n+1,t}var Qn=se,Zn=128,rr=127;function se(r,n){var e=0,n=n||0,i=0,o=n,a,c=r.length;do{if(o>=c)throw se.bytes=0,new RangeError("Could not decode varint");a=r[o++],e+=i<28?(a&rr)<<i:(a&rr)*Math.pow(2,i),i+=7}while(a>=Zn);return se.bytes=o-n,e}var Yn=Math.pow(2,7),ti=Math.pow(2,14),ei=Math.pow(2,21),ri=Math.pow(2,28),ni=Math.pow(2,35),ii=Math.pow(2,42),oi=Math.pow(2,49),si=Math.pow(2,56),ai=Math.pow(2,63),ci=function(r){return r<Yn?1:r<ti?2:r<ei?3:r<ri?4:r<ni?5:r<ii?6:r<oi?7:r<si?8:r<ai?9:10},hi={encode:Kn,decode:Qn,encodingLength:ci},fi=hi,mt=fi;function gt(r,t=0){return[mt.decode(r,t),mt.decode.bytes]}function ot(r,t,e=0){return mt.encode(r,t,e),t}function st(r){return mt.encodingLength(r)}function j(r,t){let e=t.byteLength,n=st(r),i=n+st(e),o=new Uint8Array(i+e);return ot(r,o,0),ot(e,o,n),o.set(t,i),new at(r,e,t,o)}function ir(r){let t=P(r),[e,n]=gt(t),[i,o]=gt(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new at(e,i,a,t)}function or(r,t){if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Jt(r.bytes,e.bytes)}}var at=class{code;size;digest;bytes;constructor(t,e,n,i){this.code=t,this.size=e,this.digest=n,this.bytes=i}};function sr(r,t){let{bytes:e,version:n}=r;switch(n){case 0:return li(e,ae(r),t??V.encoder);default:return di(e,ae(r),t??it.encoder)}}var ar=new WeakMap;function ae(r){let t=ar.get(r);if(t==null){let e=new Map;return ar.set(r,e),e}return t}var T=class r{code;version;multihash;bytes;"/";constructor(t,e,n,i){this.code=e,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}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:t,multihash:e}=this;if(t!==yt)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==pi)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}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:t,digest:e}=this.multihash,n=j(t,e);return r.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(t){return r.equals(this,t)}static equals(t,e){let n=e;return n!=null&&t.code===n.code&&t.version===n.version&&or(t.multihash,n.multihash)}toString(t){return sr(this,t)}toJSON(){return{"/":sr(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:i,multihash:o,bytes:a}=e;return new r(n,i,o,a??cr(n,i,o.bytes))}else if(e[mi]===!0){let{version:n,multihash:i,code:o}=e,a=ir(i);return r.create(n,o,a)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==yt)throw new Error(`Version 0 CID must use dag-pb (code: ${yt}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let i=cr(t,e,n.bytes);return new r(t,e,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,yt,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,i=P(t.subarray(n,n+e.multihashSize));if(i.byteLength!==e.multihashSize)throw new Error("Incorrect length");let o=i.subarray(e.multihashSize-e.digestSize),a=new at(e.multihashCode,e.digestSize,o,i);return[e.version===0?r.createV0(a):r.createV1(e.codec,a),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[w,S]=gt(t.subarray(e));return e+=S,w},i=n(),o=yt;if(i===18?(i=0,e=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=e,c=n(),l=n(),b=e+l,f=b-a;return{version:i,codec:o,multihashCode:c,digestSize:l,multihashSize:f,size:b}}static parse(t,e){let[n,i]=ui(t,e),o=r.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ae(o).set(n,t),o}};function ui(r,t){switch(r[0]){case"Q":{let e=t??V;return[V.prefix,e.decode(`${V.prefix}${r}`)]}case V.prefix:{let e=t??V;return[V.prefix,e.decode(r)]}case it.prefix:{let e=t??it;return[it.prefix,e.decode(r)]}case pt.prefix:{let e=t??pt;return[pt.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}}function li(r,t,e){let{prefix:n}=e;if(n!==V.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let i=t.get(n);if(i==null){let o=e.encode(r).slice(1);return t.set(n,o),o}else return i}function di(r,t,e){let{prefix:n}=e,i=t.get(n);if(i==null){let o=e.encode(r);return t.set(n,o),o}else return i}var yt=112,pi=18;function cr(r,t,e){let n=st(r),i=n+st(t),o=new Uint8Array(i+e.byteLength);return ot(r,o,0),ot(t,o,n),o.set(e,i),o}var mi=Symbol.for("@ipld/js-cid/CID");var gi=new TextDecoder;function ce(r,t){let e=0;for(let n=0;;n+=7){if(n>=64)throw new Error("protobuf: varint overflow");if(t>=r.length)throw new Error("protobuf: unexpected end of data");let i=r[t++];if(e+=n<28?(i&127)<<n:(i&127)*2**n,i<128)break}return[e,t]}function Rt(r,t){let e;[e,t]=ce(r,t);let n=t+e;if(e<0||n<0)throw new Error("protobuf: invalid length");if(n>r.length)throw new Error("protobuf: unexpected end of data");return[r.subarray(t,n),n]}function hr(r,t){let e;return[e,t]=ce(r,t),[e&7,e>>3,t]}function wi(r){let t={},e=r.length,n=0;for(;n<e;){let i,o;if([i,o,n]=hr(r,n),o===1){if(t.Hash)throw new Error("protobuf: (PBLink) duplicate Hash section");if(i!==2)throw new Error(`protobuf: (PBLink) wrong wireType (${i}) for Hash`);if(t.Name!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Name before Hash");if(t.Tsize!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Tsize before Hash");[t.Hash,n]=Rt(r,n)}else if(o===2){if(t.Name!==void 0)throw new Error("protobuf: (PBLink) duplicate Name section");if(i!==2)throw new Error(`protobuf: (PBLink) wrong wireType (${i}) for Name`);if(t.Tsize!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Tsize before Name");let a;[a,n]=Rt(r,n),t.Name=gi.decode(a)}else if(o===3){if(t.Tsize!==void 0)throw new Error("protobuf: (PBLink) duplicate Tsize section");if(i!==0)throw new Error(`protobuf: (PBLink) wrong wireType (${i}) for Tsize`);[t.Tsize,n]=ce(r,n)}else throw new Error(`protobuf: (PBLink) invalid fieldNumber, expected 1, 2 or 3, got ${o}`)}if(n>e)throw new Error("protobuf: (PBLink) unexpected end of data");return t}function fr(r){let t=r.length,e=0,n,i=!1,o;for(;e<t;){let c,l;if([c,l,e]=hr(r,e),c!==2)throw new Error(`protobuf: (PBNode) invalid wireType, expected 2, got ${c}`);if(l===1){if(o)throw new Error("protobuf: (PBNode) duplicate Data section");[o,e]=Rt(r,e),n&&(i=!0)}else if(l===2){if(i)throw new Error("protobuf: (PBNode) duplicate Links section");n||(n=[]);let b;[b,e]=Rt(r,e),n.push(wi(b))}else throw new Error(`protobuf: (PBNode) invalid fieldNumber, expected 1 or 2, got ${l}`)}if(e>t)throw new Error("protobuf: (PBNode) unexpected end of data");let a={};return o&&(a.Data=o),a.Links=n||[],a}var lr=new TextEncoder,ur=2**32,yi=2**31;function bi(r,t){let e=t.length;if(typeof r.Tsize=="number"){if(r.Tsize<0)throw new Error("Tsize cannot be negative");if(!Number.isSafeInteger(r.Tsize))throw new Error("Tsize too large for encoding");e=bt(t,e,r.Tsize)-1,t[e]=24}if(typeof r.Name=="string"){let n=lr.encode(r.Name);e-=n.length,t.set(n,e),e=bt(t,e,n.length)-1,t[e]=18}return r.Hash&&(e-=r.Hash.length,t.set(r.Hash,e),e=bt(t,e,r.Hash.length)-1,t[e]=10),t.length-e}function dr(r){let t=_i(r),e=new Uint8Array(t),n=t;if(r.Data&&(n-=r.Data.length,e.set(r.Data,n),n=bt(e,n,r.Data.length)-1,e[n]=10),r.Links)for(let i=r.Links.length-1;i>=0;i--){let o=bi(r.Links[i],e.subarray(0,n));n-=o,n=bt(e,n,o)-1,e[n]=18}return e}function xi(r){let t=0;if(r.Hash){let e=r.Hash.length;t+=1+e+ct(e)}if(typeof r.Name=="string"){let e=lr.encode(r.Name).length;t+=1+e+ct(e)}return typeof r.Tsize=="number"&&(t+=1+ct(r.Tsize)),t}function _i(r){let t=0;if(r.Data){let e=r.Data.length;t+=1+e+ct(e)}if(r.Links)for(let e of r.Links){let n=xi(e);t+=1+n+ct(n)}return t}function bt(r,t,e){t-=ct(e);let n=t;for(;e>=yi;)r[t++]=e&127|128,e/=128;for(;e>=128;)r[t++]=e&127|128,e>>>=7;return r[t]=e,n}function ct(r){return r%2===0&&r++,Math.floor((Bi(r)+6)/7)}function Bi(r){let t=0;return r>=ur&&(r=Math.floor(r/ur),t=32),r>=65536&&(r>>>=16,t+=16),r>=256&&(r>>>=8,t+=8),t+Ai[r]}var Ai=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8];var Si=["Data","Links"],ki=["Hash","Name","Tsize"],he=new TextEncoder;function mr(r,t){if(r===t)return 0;let e=r.Name?he.encode(r.Name):[],n=t.Name?he.encode(t.Name):[],i=e.length,o=n.length;for(let a=0,c=Math.min(i,o);a<c;++a)if(e[a]!==n[a]){i=e[a],o=n[a];break}return i<o?-1:o<i?1:0}function pr(r,t){return!Object.keys(r).some(e=>!t.includes(e))}function gr(r){if(typeof r.asCID=="object"){let e=T.asCID(r);if(!e)throw new TypeError("Invalid DAG-PB form");return{Hash:e}}if(typeof r!="object"||Array.isArray(r))throw new TypeError("Invalid DAG-PB form");let t={};if(r.Hash){let e=T.asCID(r.Hash);try{e||(typeof r.Hash=="string"?e=T.parse(r.Hash):r.Hash instanceof Uint8Array&&(e=T.decode(r.Hash)))}catch(n){throw new TypeError(`Invalid DAG-PB form: ${n.message}`)}e&&(t.Hash=e)}if(!t.Hash)throw new TypeError("Invalid DAG-PB form");return typeof r.Name=="string"&&(t.Name=r.Name),typeof r.Tsize=="number"&&(t.Tsize=r.Tsize),t}function v(r){if((r instanceof Uint8Array||typeof r=="string")&&(r={Data:r}),typeof r!="object"||Array.isArray(r))throw new TypeError("Invalid DAG-PB form");let t={};if(r.Data!==void 0)if(typeof r.Data=="string")t.Data=he.encode(r.Data);else if(r.Data instanceof Uint8Array)t.Data=r.Data;else throw new TypeError("Invalid DAG-PB form");if(r.Links!==void 0)if(Array.isArray(r.Links))t.Links=r.Links.map(gr),t.Links.sort(mr);else throw new TypeError("Invalid DAG-PB form");else t.Links=[];return t}function fe(r){if(!r||typeof r!="object"||Array.isArray(r)||r instanceof Uint8Array||r["/"]&&r["/"]===r.bytes)throw new TypeError("Invalid DAG-PB form");if(!pr(r,Si))throw new TypeError("Invalid DAG-PB form (extraneous properties)");if(r.Data!==void 0&&!(r.Data instanceof Uint8Array))throw new TypeError("Invalid DAG-PB form (Data must be bytes)");if(!Array.isArray(r.Links))throw new TypeError("Invalid DAG-PB form (Links must be a list)");for(let t=0;t<r.Links.length;t++){let e=r.Links[t];if(!e||typeof e!="object"||Array.isArray(e)||e instanceof Uint8Array||e["/"]&&e["/"]===e.bytes)throw new TypeError("Invalid DAG-PB form (bad link)");if(!pr(e,ki))throw new TypeError("Invalid DAG-PB form (extraneous properties on link)");if(e.Hash===void 0)throw new TypeError("Invalid DAG-PB form (link must have a Hash)");if(e.Hash==null||!e.Hash["/"]||e.Hash["/"]!==e.Hash.bytes)throw new TypeError("Invalid DAG-PB form (link Hash must be a CID)");if(e.Name!==void 0&&typeof e.Name!="string")throw new TypeError("Invalid DAG-PB form (link Name must be a string)");if(e.Tsize!==void 0){if(typeof e.Tsize!="number"||e.Tsize%1!==0)throw new TypeError("Invalid DAG-PB form (link Tsize must be an integer)");if(e.Tsize<0)throw new TypeError("Invalid DAG-PB form (link Tsize cannot be negative)")}if(t>0&&mr(e,r.Links[t-1])===-1)throw new TypeError("Invalid DAG-PB form (links must be sorted by Name bytes)")}}function wr(r,t=[]){return v({Data:r,Links:t})}function yr(r,t,e){return gr({Hash:e,Name:r,Tsize:t})}function br(r){return r instanceof ArrayBuffer?new Uint8Array(r,0,r.byteLength):r}var Ei="dag-pb",Di=112;function C(r){fe(r);let t={};return r.Links&&(t.Links=r.Links.map(e=>{let n={};return e.Hash&&(n.Hash=e.Hash.bytes),e.Name!==void 0&&(n.Name=e.Name),e.Tsize!==void 0&&(n.Tsize=e.Tsize),n})),r.Data&&(t.Data=r.Data),dr(t)}function Ti(r){let t=br(r),e=fr(t),n={};return e.Data&&(n.Data=e.Data),e.Links&&(n.Links=e.Links.map(i=>{let o={};try{o.Hash=T.decode(i.Hash)}catch{}if(!o.Hash)throw new Error("Invalid Hash field found in link, expected CID");return i.Name!==void 0&&(o.Name=i.Name),i.Tsize!==void 0&&(o.Tsize=i.Tsize),o})),n}var Pe=tt(ut(),1);var Ni=Math.pow(2,7),Ii=Math.pow(2,14),Li=Math.pow(2,21),xr=Math.pow(2,28),_r=Math.pow(2,35),Br=Math.pow(2,42),Ar=Math.pow(2,49),I=128,X=127;function _t(r){if(r<Ni)return 1;if(r<Ii)return 2;if(r<Li)return 3;if(r<xr)return 4;if(r<_r)return 5;if(r<Br)return 6;if(r<Ar)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Sr(r,t,e=0){switch(_t(r)){case 8:t[e++]=r&255|I,r/=128;case 7:t[e++]=r&255|I,r/=128;case 6:t[e++]=r&255|I,r/=128;case 5:t[e++]=r&255|I,r/=128;case 4:t[e++]=r&255|I,r>>>=7;case 3:t[e++]=r&255|I,r>>>=7;case 2:t[e++]=r&255|I,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function kr(r,t){let e=r[t],n=0;if(n+=e&X,e<I||(e=r[t+1],n+=(e&X)<<7,e<I)||(e=r[t+2],n+=(e&X)<<14,e<I)||(e=r[t+3],n+=(e&X)<<21,e<I)||(e=r[t+4],n+=(e&X)*xr,e<I)||(e=r[t+5],n+=(e&X)*_r,e<I)||(e=r[t+6],n+=(e&X)*Br,e<I)||(e=r[t+7],n+=(e&X)*Ar,e<I))return n;throw new RangeError("Could not decode varint")}var ue=new Float32Array([-0]),K=new Uint8Array(ue.buffer);function Er(r,t,e){ue[0]=r,t[e]=K[0],t[e+1]=K[1],t[e+2]=K[2],t[e+3]=K[3]}function Dr(r,t){return K[0]=r[t],K[1]=r[t+1],K[2]=r[t+2],K[3]=r[t+3],ue[0]}var le=new Float64Array([-0]),N=new Uint8Array(le.buffer);function Tr(r,t,e){le[0]=r,t[e]=N[0],t[e+1]=N[1],t[e+2]=N[2],t[e+3]=N[3],t[e+4]=N[4],t[e+5]=N[5],t[e+6]=N[6],t[e+7]=N[7]}function Nr(r,t){return N[0]=r[t],N[1]=r[t+1],N[2]=r[t+2],N[3]=r[t+3],N[4]=r[t+4],N[5]=r[t+5],N[6]=r[t+6],N[7]=r[t+7],le[0]}var zi=BigInt(Number.MAX_SAFE_INTEGER),vi=BigInt(Number.MIN_SAFE_INTEGER),F=class r{lo;hi;constructor(t,e){this.lo=t|0,this.hi=e|0}toNumber(t=!1){if(!t&&this.hi>>>31>0){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(t=!1){if(t)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(BigInt(e)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(t=!1){return this.toBigInt(t).toString()}zzEncode(){let t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this}zzDecode(){let t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this}length(){let t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}static fromBigInt(t){if(t===0n)return J;if(t<zi&&t>vi)return this.fromNumber(Number(t));let e=t<0n;e&&(t=-t);let n=t>>32n,i=t-(n<<32n);return e&&(n=~n|0n,i=~i|0n,++i>Ir&&(i=0n,++n>Ir&&(n=0n))),new r(Number(i),Number(n))}static fromNumber(t){if(t===0)return J;let e=t<0;e&&(t=-t);let n=t>>>0,i=(t-n)/4294967296>>>0;return e&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new r(n,i)}static from(t){return typeof t=="number"?r.fromNumber(t):typeof t=="bigint"?r.fromBigInt(t):typeof t=="string"?r.fromBigInt(BigInt(t)):t.low!=null||t.high!=null?new r(t.low>>>0,t.high>>>0):J}},J=new F(0,0);J.toBigInt=function(){return 0n};J.zzEncode=J.zzDecode=function(){return this};J.length=function(){return 1};var Ir=4294967296n;function Lr(r){let t=0,e=0;for(let n=0;n<r.length;++n)e=r.charCodeAt(n),e<128?t+=1:e<2048?t+=2:(e&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,t+=4):t+=3;return t}function zr(r,t,e){if(e-t<1)return"";let i,o=[],a=0,c;for(;t<e;)c=r[t++],c<128?o[a++]=c:c>191&&c<224?o[a++]=(c&31)<<6|r[t++]&63:c>239&&c<365?(c=((c&7)<<18|(r[t++]&63)<<12|(r[t++]&63)<<6|r[t++]&63)-65536,o[a++]=55296+(c>>10),o[a++]=56320+(c&1023)):o[a++]=(c&15)<<12|(r[t++]&63)<<6|r[t++]&63,a>8191&&((i??(i=[])).push(String.fromCharCode.apply(String,o)),a=0);return i!=null?(a>0&&i.push(String.fromCharCode.apply(String,o.slice(0,a))),i.join("")):String.fromCharCode.apply(String,o.slice(0,a))}function de(r,t,e){let n=e,i,o;for(let a=0;a<r.length;++a)i=r.charCodeAt(a),i<128?t[e++]=i:i<2048?(t[e++]=i>>6|192,t[e++]=i&63|128):(i&64512)===55296&&((o=r.charCodeAt(a+1))&64512)===56320?(i=65536+((i&1023)<<10)+(o&1023),++a,t[e++]=i>>18|240,t[e++]=i>>12&63|128,t[e++]=i>>6&63|128,t[e++]=i&63|128):(t[e++]=i>>12|224,t[e++]=i>>6&63|128,t[e++]=i&63|128);return e-n}function U(r,t){return RangeError(`index out of range: ${r.pos} + ${t??1} > ${r.len}`)}function Vt(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}var pe=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(t){this.buf=t,this.pos=0,this.len=t.length}uint32(){let t=4294967295;if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,U(this,10);return t}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw U(this,4);return Vt(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw U(this,4);return Vt(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw U(this,4);let t=Dr(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw U(this,4);let t=Nr(this.buf,this.pos);return this.pos+=8,t}bytes(){let t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw U(this,t);return this.pos+=t,e===n?new Uint8Array(0):this.buf.subarray(e,n)}string(){let t=this.bytes();return zr(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw U(this,t);this.pos+=t}else do if(this.pos>=this.len)throw U(this);while(this.buf[this.pos++]&128);return this}skipType(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${t} at offset ${this.pos}`)}return this}readLongVarint(){let t=new F(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw U(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw U(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw U(this,8);let t=Vt(this.buf,this.pos+=4),e=Vt(this.buf,this.pos+=4);return new F(t,e)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let t=kr(this.buf,this.pos);return this.pos+=_t(t),t}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function me(r){return new pe(r instanceof Uint8Array?r:r.subarray())}function Bt(r,t,e){let n=me(r);return t.decode(n,void 0,e)}var ge={};D(ge,{base10:()=>Ci});var Ci=q({prefix:"9",name:"base10",alphabet:"0123456789"});var we={};D(we,{base16:()=>Fi,base16upper:()=>Pi});var Fi=k({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Pi=k({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ye={};D(ye,{base2:()=>Ui});var Ui=k({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var be={};D(be,{base256emoji:()=>Oi});var Cr=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Mi=Cr.reduce((r,t,e)=>(r[e]=t,r),[]),Ri=Cr.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function Vi(r){return r.reduce((t,e)=>(t+=Mi[e],t),"")}function Hi(r){let t=[];for(let e of r){let n=Ri[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var Oi=nt({prefix:"\u{1F680}",name:"base256emoji",encode:Vi,decode:Hi});var xe={};D(xe,{base64:()=>Gi,base64pad:()=>$i,base64url:()=>qi,base64urlpad:()=>Xi});var Gi=k({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),$i=k({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),qi=k({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Xi=k({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var _e={};D(_e,{base8:()=>Ki});var Ki=k({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Be={};D(Be,{identity:()=>Wi});var Wi=nt({prefix:"\0",name:"identity",encode:r=>Zt(r),decode:r=>Qt(r)});var Xs=new TextEncoder,Ks=new TextDecoder;var At={};D(At,{code:()=>Ht,decode:()=>Zi,encode:()=>Qi,name:()=>Ji});var Ji="raw",Ht=85;function Qi(r){return P(r)}function Zi(r){return P(r)}var Ae={};D(Ae,{identity:()=>eo});var Fr=0,Yi="identity",Pr=P;function to(r){return j(Fr,Pr(r))}var eo={code:Fr,name:Yi,encode:Pr,digest:to};var Ee={};D(Ee,{sha256:()=>ke,sha512:()=>ro});function Q({name:r,code:t,encode:e}){return new Se(r,t,e)}var Se=class{name;code;encode;constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?j(this.code,e):e.then(n=>j(this.code,n))}else throw Error("Unknown type, must be binary type")}};function Mr(r){return async t=>new Uint8Array(await crypto.subtle.digest(r,t))}var ke=Q({name:"sha2-256",code:18,encode:Mr("SHA-256")}),ro=Q({name:"sha2-512",code:19,encode:Mr("SHA-512")});var De={...Be,...ye,..._e,...ge,...we,...ne,...ie,...oe,...xe,...be},sa={...Ee,...Ae};function Vr(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Rr=Vr("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Te=Vr("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=z(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),no={utf8:Rr,"utf-8":Rr,hex:De.base16,latin1:Te,ascii:Te,binary:Te,...De},Hr=no;function ht(r,t="utf8"){let e=Hr[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.decoder.decode(`${e.prefix}${r}`)}function Ne(r){let t=r??8192,e=t>>>1,n,i=t;return function(a){if(a<1||a>e)return z(a);i+a>t&&(n=z(t),i=0);let c=n.subarray(i,i+=a);return i&7&&(i=(i|7)+1),c}}var Z=class{fn;len;next;val;constructor(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}};function Ie(){}var ze=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},io=Ne();function oo(r){return globalThis.Buffer!=null?z(r):io(r)}var kt=class{len;head;tail;states;constructor(){this.len=0,this.head=new Z(Ie,0,0),this.tail=this.head,this.states=null}_push(t,e,n){return this.tail=this.tail.next=new Z(t,e,n),this.len+=e,this}uint32(t){return this.len+=(this.tail=this.tail.next=new ve((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this}int32(t){return t<0?this._push(Ot,10,F.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let e=F.fromBigInt(t);return this._push(Ot,e.length(),e)}uint64Number(t){return this._push(Sr,_t(t),t)}uint64String(t){return this.uint64(BigInt(t))}int64(t){return this.uint64(t)}int64Number(t){return this.uint64Number(t)}int64String(t){return this.uint64String(t)}sint64(t){let e=F.fromBigInt(t).zzEncode();return this._push(Ot,e.length(),e)}sint64Number(t){let e=F.fromNumber(t).zzEncode();return this._push(Ot,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(Le,1,t?1:0)}fixed32(t){return this._push(St,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=F.fromBigInt(t);return this._push(St,4,e.lo)._push(St,4,e.hi)}fixed64Number(t){let e=F.fromNumber(t);return this._push(St,4,e.lo)._push(St,4,e.hi)}fixed64String(t){return this.fixed64(BigInt(t))}sfixed64(t){return this.fixed64(t)}sfixed64Number(t){return this.fixed64Number(t)}sfixed64String(t){return this.fixed64String(t)}float(t){return this._push(Er,4,t)}double(t){return this._push(Tr,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(Le,1,0):this.uint32(e)._push(ao,e,t)}string(t){let e=Lr(t);return e!==0?this.uint32(e)._push(de,e,t):this._push(Le,1,0)}fork(){return this.states=new ze(this),this.head=this.tail=new Z(Ie,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Z(Ie,0,0),this.len=0),this}ldelim(){let t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=t.next,this.tail=e,this.len+=n),this}finish(){let t=this.head.next,e=oo(this.len),n=0;for(;t!=null;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e}};function Le(r,t,e){t[e]=r&255}function so(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var ve=class extends Z{next;constructor(t,e){super(so,t,e),this.next=void 0}};function Ot(r,t,e){for(;r.hi!==0;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}function St(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function ao(r,t,e){t.set(r,e)}globalThis.Buffer!=null&&(kt.prototype.bytes=function(r){let t=r.length>>>0;return this.uint32(t),t>0&&this._push(co,t,r),this},kt.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(ho,t,r),this});function co(r,t,e){t.set(r,e)}function ho(r,t,e){r.length<40?de(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(ht(r),e)}function Ce(){return new kt}function Et(r,t){let e=Ce();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var ft;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(ft||(ft={}));function Gt(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function Fe(r){function t(i){if(r[i.toString()]==null)throw new Error("Invalid enum value");return r[i]}let e=function(o,a){let c=t(o);a.int32(c)},n=function(o){let a=o.int32();return t(a)};return Gt("enum",ft.VARINT,e,n)}function Dt(r,t){return Gt("message",ft.LENGTH_DELIMITED,r,t)}var M;(function(r){let t;(function(i){i.Raw="Raw",i.Directory="Directory",i.File="File",i.Metadata="Metadata",i.Symlink="Symlink",i.HAMTShard="HAMTShard"})(t=r.DataType||(r.DataType={}));let e;(function(i){i[i.Raw=0]="Raw",i[i.Directory=1]="Directory",i[i.File=2]="File",i[i.Metadata=3]="Metadata",i[i.Symlink=4]="Symlink",i[i.HAMTShard=5]="HAMTShard"})(e||(e={})),function(i){i.codec=()=>Fe(e)}(t=r.DataType||(r.DataType={}));let n;r.codec=()=>(n==null&&(n=Dt((i,o,a={})=>{if(a.lengthDelimited!==!1&&o.fork(),i.Type!=null&&(o.uint32(8),r.DataType.codec().encode(i.Type,o)),i.Data!=null&&(o.uint32(18),o.bytes(i.Data)),i.filesize!=null&&(o.uint32(24),o.uint64(i.filesize)),i.blocksizes!=null)for(let c of i.blocksizes)o.uint32(32),o.uint64(c);i.hashType!=null&&(o.uint32(40),o.uint64(i.hashType)),i.fanout!=null&&(o.uint32(48),o.uint64(i.fanout)),i.mode!=null&&(o.uint32(56),o.uint32(i.mode)),i.mtime!=null&&(o.uint32(66),$t.codec().encode(i.mtime,o)),a.lengthDelimited!==!1&&o.ldelim()},(i,o)=>{let a={blocksizes:[]},c=o==null?i.len:i.pos+o;for(;i.pos<c;){let l=i.uint32();switch(l>>>3){case 1:a.Type=r.DataType.codec().decode(i);break;case 2:a.Data=i.bytes();break;case 3:a.filesize=i.uint64();break;case 4:a.blocksizes.push(i.uint64());break;case 5:a.hashType=i.uint64();break;case 6:a.fanout=i.uint64();break;case 7:a.mode=i.uint32();break;case 8:a.mtime=$t.codec().decode(i,i.uint32());break;default:i.skipType(l&7);break}}return a})),n),r.encode=i=>Et(i,r.codec()),r.decode=i=>Bt(i,r.codec())})(M||(M={}));var $t;(function(r){let t;r.codec=()=>(t==null&&(t=Dt((e,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),e.Seconds!=null&&(n.uint32(8),n.int64(e.Seconds)),e.FractionalNanoseconds!=null&&(n.uint32(21),n.fixed32(e.FractionalNanoseconds)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={},o=n==null?e.len:e.pos+n;for(;e.pos<o;){let a=e.uint32();switch(a>>>3){case 1:i.Seconds=e.int64();break;case 2:i.FractionalNanoseconds=e.fixed32();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>Et(e,r.codec()),r.decode=e=>Bt(e,r.codec())})($t||($t={}));var Or;(function(r){let t;r.codec=()=>(t==null&&(t=Dt((e,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),e.MimeType!=null&&(n.uint32(10),n.string(e.MimeType)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={},o=n==null?e.len:e.pos+n;for(;e.pos<o;){let a=e.uint32();switch(a>>>3){case 1:i.MimeType=e.string();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>Et(e,r.codec()),r.decode=e=>Bt(e,r.codec())})(Or||(Or={}));var Gr={Raw:"raw",Directory:"directory",File:"file",Metadata:"metadata",Symlink:"symlink",HAMTShard:"hamt-sharded-directory"},fo=["directory","hamt-sharded-directory"],$r=parseInt("0644",8),qr=parseInt("0755",8),L=class r{static unmarshal(t){let e=M.decode(t),n=new r({type:Gr[e.Type!=null?e.Type.toString():"File"],data:e.Data,blockSizes:e.blocksizes,mode:e.mode,mtime:e.mtime!=null?{secs:e.mtime.Seconds??0n,nsecs:e.mtime.FractionalNanoseconds}:void 0,fanout:e.fanout});return n._originalMode=e.mode??0,n}type;data;blockSizes;hashType;fanout;mtime;_mode;_originalMode;constructor(t={type:"file"}){let{type:e,data:n,blockSizes:i,hashType:o,fanout:a,mtime:c,mode:l}=t;if(e!=null&&!Object.values(Gr).includes(e))throw(0,Pe.default)(new Error("Type: "+e+" is not valid"),"ERR_INVALID_TYPE");this.type=e??"file",this.data=n,this.hashType=o,this.fanout=a,this.blockSizes=i??[],this._originalMode=0,this.mode=l,this.mtime=c}set mode(t){t==null?this._mode=this.isDirectory()?qr:$r:this._mode=t&4095}get mode(){return this._mode}isDirectory(){return fo.includes(this.type)}addBlockSize(t){this.blockSizes.push(t)}removeBlockSize(t){this.blockSizes.splice(t,1)}fileSize(){if(this.isDirectory())return 0n;let t=0n;return this.blockSizes.forEach(e=>{t+=e}),this.data!=null&&(t+=BigInt(this.data.length)),t}marshal(){let t;switch(this.type){case"raw":t=M.DataType.Raw;break;case"directory":t=M.DataType.Directory;break;case"file":t=M.DataType.File;break;case"metadata":t=M.DataType.Metadata;break;case"symlink":t=M.DataType.Symlink;break;case"hamt-sharded-directory":t=M.DataType.HAMTShard;break;default:throw(0,Pe.default)(new Error(`Type: ${t} is not valid`),"ERR_INVALID_TYPE")}let e=this.data;(this.data==null||this.data.length===0)&&(e=void 0);let n;this.mode!=null&&(n=this._originalMode&4294963200|(this.mode??0),n===$r&&!this.isDirectory()&&(n=void 0),n===qr&&this.isDirectory()&&(n=void 0));let i;return this.mtime!=null&&(i={Seconds:this.mtime.secs,FractionalNanoseconds:this.mtime.nsecs}),M.encode({Type:t,Data:e,filesize:this.isDirectory()?void 0:this.fileSize(),blocksizes:this.blockSizes,hashType:this.hashType,fanout:this.fanout,mode:n,mtime:i})}};var $=class extends Event{type;detail;constructor(t,e){super(t),this.type=t,this.detail=e}};var R=async(r,t,e)=>{e.codec==null&&(e.codec=xt);let n=await ke.digest(r),i=T.create(e.cidVersion,e.codec.code,n);return await t.put(i,r,e),i};function Xr(r){return async function*(e,n){let i=0n;for await(let o of e.content)yield async()=>{let a,c={codec:xt,cidVersion:r.cidVersion,onProgress:r.onProgress};r.rawLeaves?(c.codec=At,c.cidVersion=1):(a=new L({type:r.leafType,data:o}),o=C({Data:a.marshal(),Links:[]}));let l=await R(o,n,c);return i+=BigInt(o.byteLength),r.onProgress?.(new $("unixfs:importer:progress:file:write",{bytesWritten:i,cid:l,path:e.path})),{cid:l,unixfs:a,size:BigInt(o.length),block:o}}}}var Ue=tt(ut(),1);var Kr=async(r,t,e)=>{let n=new L({type:"directory",mtime:r.mtime,mode:r.mode}),i=C(v({Data:n.marshal()})),o=await R(i,t,e),a=r.path;return{cid:o,path:a,unixfs:n,size:BigInt(i.length),originalPath:r.originalPath,block:i}};async function*uo(r,t,e){let n=-1,i;for await(let o of lt(e.bufferImporter(r,t),e.blockWriteConcurrency)){if(n++,n===0){i={...o,single:!0};continue}else n===1&&i!=null&&(yield{...i,block:void 0,single:void 0},i=void 0);yield{...o,block:void 0}}i!=null&&(yield i)}function Wr(r){return r.single===!0}var lo=(r,t,e)=>async function(i){if(i.length===1&&Wr(i[0])&&e.reduceSingleLeafToSelf){let f=i[0],w=f.block;return Wr(f)&&(r.mtime!==void 0||r.mode!==void 0)&&(f.unixfs=new L({type:"file",mtime:r.mtime,mode:r.mode,data:f.block}),w={Data:f.unixfs.marshal(),Links:[]},f.block=C(v(w)),f.cid=await R(f.block,t,{...e,cidVersion:e.cidVersion}),f.size=BigInt(f.block.length)),e.onProgress?.(new $("unixfs:importer:progress:file:layout",{cid:f.cid,path:f.originalPath})),{cid:f.cid,path:r.path,unixfs:f.unixfs,size:f.size,originalPath:f.originalPath}}let o=new L({type:"file",mtime:r.mtime,mode:r.mode}),a=i.filter(f=>f.cid.code===Ht&&f.size>0||f.unixfs!=null&&f.unixfs.data==null&&f.unixfs.fileSize()>0n?!0:!!f.unixfs?.data?.length).map(f=>f.cid.code===Ht?(o.addBlockSize(f.size),{Name:"",Tsize:Number(f.size),Hash:f.cid}):(f.unixfs?.data==null?o.addBlockSize(f.unixfs?.fileSize()??0n):o.addBlockSize(BigInt(f.unixfs.data.length)),{Name:"",Tsize:Number(f.size),Hash:f.cid})),c={Data:o.marshal(),Links:a},l=C(v(c)),b=await R(l,t,e);return e.onProgress?.(new $("unixfs:importer:progress:file:layout",{cid:b,path:r.originalPath})),{cid:b,path:r.path,unixfs:o,size:BigInt(l.length+c.Links.reduce((f,w)=>f+(w.Tsize??0),0)),originalPath:r.originalPath,block:l}},jr=async(r,t,e)=>e.layout(uo(r,t,e),lo(r,t,e));function po(r){return Symbol.iterator in r}function mo(r){return Symbol.asyncIterator in r}function go(r){try{if(r instanceof Uint8Array)return async function*(){yield r}();if(po(r))return async function*(){yield*r}();if(mo(r))return r}catch{throw(0,Ue.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}throw(0,Ue.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}function Jr(r){return async function*(e,n){for await(let i of e){let o;if(i.path!=null&&(o=i.path,i.path=i.path.split("/").filter(a=>a!=null&&a!==".").join("/")),wo(i)){let a={path:i.path,mtime:i.mtime,mode:i.mode,content:async function*(){let c=0n;for await(let l of r.chunker(r.chunkValidator(go(i.content)))){let b=BigInt(l.byteLength);c+=b,r.onProgress?.(new $("unixfs:importer:progress:file:read",{bytesRead:c,chunkSize:b,path:i.path})),yield l}}(),originalPath:o};yield async()=>jr(a,n,r)}else if(i.path!=null){let a={path:i.path,mtime:i.mtime,mode:i.mode,originalPath:o};yield async()=>Kr(a,n,r)}else throw new Error("Import candidate must have content or path or both")}}}function wo(r){return r.content!=null}var Me=tt(ut(),1);var Qr=()=>async function*(t){for await(let e of t){if(e.length===void 0)throw(0,Me.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT");if(typeof e=="string"||e instanceof String)yield ht(e.toString());else if(Array.isArray(e))yield Uint8Array.from(e);else if(e instanceof Uint8Array)yield e;else throw(0,Me.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}};var yo=174;function Re(r){let t=r?.maxChildrenPerNode??yo;return async function e(n,i){let o=[];for await(let a of Pt(n,t))o.push(await i(a));return o.length>1?e(o,i):o[0]}}var H=class{options;root;dir;path;dirty;flat;parent;parentKey;unixfs;mode;mtime;cid;size;nodeSize;constructor(t,e){this.options=e??{},this.root=t.root,this.dir=t.dir,this.path=t.path,this.dirty=t.dirty,this.flat=t.flat,this.parent=t.parent,this.parentKey=t.parentKey,this.unixfs=t.unixfs,this.mode=t.mode,this.mtime=t.mtime}},Tt=T.parse("QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn"),Nt=T.parse("zdj7WbTaiJT1fgatdet9Ei9iDB5hdCxkbVyhyh8YTUnXMiwYi");var Y=class extends H{_children;constructor(t,e){super(t,e),this._children=new Map}async put(t,e){this.cid=void 0,this.size=void 0,this.nodeSize=void 0,this._children.set(t,e)}async get(t){return Promise.resolve(this._children.get(t))}childCount(){return this._children.size}directChildrenCount(){return this.childCount()}onlyChild(){return this._children.values().next().value}async*eachChildSeries(){for(let[t,e]of this._children.entries())yield{key:t,child:e}}estimateNodeSize(){if(this.nodeSize!==void 0)return this.nodeSize;this.nodeSize=0;for(let[t,e]of this._children.entries())e.size!=null&&e.cid!=null&&(this.nodeSize+=t.length+(this.options.cidVersion===1?Nt.bytes.byteLength:Tt.bytes.byteLength));return this.nodeSize}async*flush(t){let e=[];for(let[l,b]of this._children.entries()){let f=b;if(b instanceof H)for await(let w of b.flush(t))f=w,yield w;f.size!=null&&f.cid!=null&&e.push({Name:l,Tsize:Number(f.size),Hash:f.cid})}let n=new L({type:"directory",mtime:this.mtime,mode:this.mode}),i={Data:n.marshal(),Links:e},o=C(v(i)),a=await R(o,t,this.options),c=o.length+i.Links.reduce((l,b)=>l+(b.Tsize??0),0);this.cid=a,this.size=c,yield{cid:a,unixfs:n,path:this.path,size:BigInt(c)}}};var Xt=tt(tn(),1);function bo(r){let t=new Array(4);for(let e=0;e<4;e++)t[e]=r&255,r=r>>8;return new Uint8Array(t)}var Sc=Q({name:"murmur3-32",code:35,encode:r=>bo(Xt.default.x86.hash32(r))}),en=Q({name:"murmur3-128",code:34,encode:r=>rt.fromHex(Xt.default.x64.hash128(r))}),kc=Q({name:"murmur3-x64-64",code:34,encode:r=>rt.fromHex(Xt.default.x64.hash128(r)).subarray(0,8)});var sn=tt(on(),1);var W=class r{_options;_popCount;_parent;_posAtParent;_children;key;constructor(t,e,n=0){this._options=t,this._popCount=0,this._parent=e,this._posAtParent=n,this._children=new sn.default,this.key=null}async put(t,e){let n=await this._findNewBucketAndPos(t);n.bucket._putAt(n,t,e)}async get(t){let e=await this._findChild(t);if(e!=null)return e.value}async del(t){let e=await this._findPlace(t),n=e.bucket._at(e.pos);n!=null&&n.key===t&&e.bucket._delAt(e.pos)}leafCount(){return this._children.compactArray().reduce((e,n)=>n instanceof r?e+n.leafCount():e+1,0)}childrenCount(){return this._children.length}onlyChild(){return this._children.get(0)}*eachLeafSeries(){let t=this._children.compactArray();for(let e of t)e instanceof r?yield*e.eachLeafSeries():yield e}serialize(t,e){let n=[];return e(this._children.reduce((i,o,a)=>(o!=null&&(o instanceof r?i.push(o.serialize(t,e)):i.push(t(o,a))),i),n))}async asyncTransform(t,e){return an(this,t,e)}toJSON(){return this.serialize(So,ko)}prettyPrint(){return JSON.stringify(this.toJSON(),null," ")}tableSize(){return Math.pow(2,this._options.bits)}async _findChild(t){let e=await this._findPlace(t),n=e.bucket._at(e.pos);if(!(n instanceof r)&&n!=null&&n.key===t)return n}async _findPlace(t){let e=this._options.hash(typeof t=="string"?ht(t):t),n=await e.take(this._options.bits),i=this._children.get(n);return i instanceof r?i._findPlace(e):{bucket:this,pos:n,hash:e,existingChild:i}}async _findNewBucketAndPos(t){let e=await this._findPlace(t);if(e.existingChild!=null&&e.existingChild.key!==t){let n=new r(this._options,e.bucket,e.pos);e.bucket._putObjectAt(e.pos,n);let i=await n._findPlace(e.existingChild.hash);return i.bucket._putAt(i,e.existingChild.key,e.existingChild.value),n._findNewBucketAndPos(e.hash)}return e}_putAt(t,e,n){this._putObjectAt(t.pos,{key:e,value:n,hash:t.hash})}_putObjectAt(t,e){this._children.get(t)==null&&this._popCount++,this._children.set(t,e)}_delAt(t){if(t===-1)throw new Error("Invalid position");this._children.get(t)!=null&&this._popCount--,this._children.unset(t),this._level()}_level(){if(this._parent!=null&&this._popCount<=1)if(this._popCount===1){let t=this._children.find(Ao);if(t!=null&&!(t instanceof r)){let e=t.hash;e.untake(this._options.bits);let n={pos:this._posAtParent,hash:e,bucket:this._parent};this._parent._putAt(n,t.key,t.value)}}else this._parent._delAt(this._posAtParent)}_at(t){return this._children.get(t)}};function Ao(r){return!!r}function So(r,t){return r.key}function ko(r){return r}async function an(r,t,e){let n=[];for(let i of r._children.compactArray())if(i instanceof W)await an(i,t,e);else{let o=await t(i);n.push({bitField:r._children.bitField(),children:o})}return e(n)}var Eo=[255,254,252,248,240,224,192,128],Do=[1,3,7,15,31,63,127,255],Kt=class{_value;_currentBytePos;_currentBitPos;constructor(t){this._value=t,this._currentBytePos=t.length-1,this._currentBitPos=7}availableBits(){return this._currentBitPos+1+this._currentBytePos*8}totalBits(){return this._value.length*8}take(t){let e=t,n=0;for(;e>0&&this._haveBits();){let i=this._value[this._currentBytePos],o=this._currentBitPos+1,a=Math.min(o,e),c=To(i,o-a,a);n=(n<<a)+c,e-=a,this._currentBitPos-=a,this._currentBitPos<0&&(this._currentBitPos=7,this._currentBytePos--)}return n}untake(t){for(this._currentBitPos+=t;this._currentBitPos>7;)this._currentBitPos-=8,this._currentBytePos+=1}_haveBits(){return this._currentBytePos>=0}};function To(r,t,e){let n=No(t,e);return(r&n)>>>t}function No(r,t){return Eo[r]&Do[Math.min(t+r-1,7)]}function cn(r){function t(e){return e instanceof Wt?e:new Wt(e,r)}return t}var Wt=class{_value;_hashFn;_depth;_availableBits;_currentBufferIndex;_buffers;constructor(t,e){if(!(t instanceof Uint8Array))throw new Error("can only hash Uint8Arrays");this._value=t,this._hashFn=e,this._depth=-1,this._availableBits=0,this._currentBufferIndex=0,this._buffers=[]}async take(t){let e=t;for(;this._availableBits<e;)await this._produceMoreBits();let n=0;for(;e>0;){let i=this._buffers[this._currentBufferIndex],o=Math.min(i.availableBits(),e),a=i.take(o);n=(n<<o)+a,e-=o,this._availableBits-=o,i.availableBits()===0&&this._currentBufferIndex++}return n}untake(t){let e=t;for(;e>0;){let n=this._buffers[this._currentBufferIndex],i=Math.min(n.totalBits()-n.availableBits(),e);n.untake(i),e-=i,this._availableBits+=i,this._currentBufferIndex>0&&n.totalBits()===n.availableBits()&&(this._depth--,this._currentBufferIndex--)}}async _produceMoreBits(){this._depth++;let t=this._depth>0?dt([this._value,Uint8Array.from([this._depth])]):this._value,e=await this._hashFn(t),n=new Kt(e);this._buffers.push(n),this._availableBits+=n.availableBits()}};function hn(r){if(r==null||r.hashFn==null)throw new Error("please define an options.hashFn");let t={bits:r.bits??8,hash:cn(r.hashFn)};return new W(t)}async function Io(r){return(await en.encode(r)).slice(0,8).reverse()}var fn=BigInt(34),Lo=8,Ve=class extends H{_bucket;constructor(t,e){super(t,e),this._bucket=hn({hashFn:Io,bits:e.shardFanoutBits??Lo})}async put(t,e){this.cid=void 0,this.size=void 0,this.nodeSize=void 0,await this._bucket.put(t,e)}async get(t){return this._bucket.get(t)}childCount(){return this._bucket.leafCount()}directChildrenCount(){return this._bucket.childrenCount()}onlyChild(){return this._bucket.onlyChild()}async*eachChildSeries(){for await(let{key:t,value:e}of this._bucket.eachLeafSeries())yield{key:t,child:e}}estimateNodeSize(){return this.nodeSize!==void 0?this.nodeSize:(this.nodeSize=dn(this._bucket,this,this.options),this.nodeSize)}async*flush(t){for await(let e of ln(this._bucket,t,this,this.options))yield{...e,path:this.path}}},un=Ve;async function*ln(r,t,e,n){let i=r._children,o=(r.tableSize()-1).toString(16).length,a=[],c=0n;for(let h=0;h<i.length;h++){let d=i.get(h);if(d==null)continue;let E=h.toString(16).toUpperCase().padStart(o,"0");if(d instanceof W){let u;for await(let p of ln(d,t,null,n))u=p;if(u==null)throw new Error("Could not flush sharded directory, no subshard found");a.push({Name:E,Tsize:Number(u.size),Hash:u.cid}),c+=u.size}else if(zo(d.value)){let u=d.value,p;for await(let y of u.flush(t))p=y,yield p;if(p==null)throw new Error("Did not flush dir");let m=E+d.key;a.push({Name:m,Tsize:Number(p.size),Hash:p.cid}),c+=p.size}else{let u=d.value;if(u.cid==null)continue;let p=E+d.key,m=u.size;a.push({Name:p,Tsize:Number(m),Hash:u.cid}),c+=BigInt(m??0)}}let l=Uint8Array.from(i.bitField().reverse()),b=new L({type:"hamt-sharded-directory",data:l,fanout:BigInt(r.tableSize()),hashType:fn,mtime:e?.mtime,mode:e?.mode}),f={Data:b.marshal(),Links:a},w=C(v(f)),S=await R(w,t,n),s=BigInt(w.byteLength)+c;yield{cid:S,unixfs:b,size:s}}function zo(r){return typeof r.flush=="function"}function dn(r,t,e){let n=r._children,i=(r.tableSize()-1).toString(16).length,o=[];for(let b=0;b<n.length;b++){let f=n.get(b);if(f==null)continue;let w=b.toString(16).toUpperCase().padStart(i,"0");if(f instanceof W){let S=dn(f,null,e);o.push({Name:w,Tsize:Number(S),Hash:e.cidVersion===0?Tt:Nt})}else if(typeof f.value.flush=="function"){let s=f.value.nodeSize();o.push({Name:w+f.key,Tsize:Number(s),Hash:e.cidVersion===0?Tt:Nt})}else{let S=f.value;if(S.cid==null)continue;let s=w+f.key,h=S.size;o.push({Name:s,Tsize:Number(h),Hash:S.cid})}}let a=Uint8Array.from(n.bitField().reverse()),c=new L({type:"hamt-sharded-directory",data:a,fanout:BigInt(r.tableSize()),hashType:fn,mtime:t?.mtime,mode:t?.mode});return C(v({Data:c.marshal(),Links:o})).length}async function He(r,t,e,n){let i=t;t instanceof Y&&t.estimateNodeSize()>e&&(i=await vo(t,n));let o=i.parent;if(o!=null){if(i!==t){if(r!=null&&(r.parent=i),i.parentKey==null)throw new Error("No parent key found");await o.put(i.parentKey,i)}return He(i,o,e,n)}return i}async function vo(r,t){let e=new un({root:r.root,dir:!0,parent:r.parent,parentKey:r.parentKey,path:r.path,dirty:r.dirty,flat:!1,mtime:r.mtime,mode:r.mode},t);for await(let{key:n,child:i}of r.eachChildSeries())await e.put(n,i);return e}var pn=(r="")=>r.split(/(?<!\\)\//).filter(Boolean);async function Co(r,t,e){let n=pn(r.path??""),i=n.length-1,o=t,a="";for(let c=0;c<n.length;c++){let l=n[c];a+=`${a!==""?"/":""}${l}`;let b=c===i;if(o.dirty=!0,o.cid=void 0,o.size=void 0,b)await o.put(l,r),t=await He(null,o,e.shardSplitThresholdBytes,e);else{let f=await o.get(l);(f==null||!(f instanceof H))&&(f=new Y({root:!1,dir:!0,parent:o,parentKey:l,path:a,dirty:!0,flat:!0,mtime:f?.unixfs?.mtime,mode:f?.unixfs?.mode},e)),await o.put(l,f),o=f}}return t}async function*mn(r,t){if(!(r instanceof H)){r.unixfs?.isDirectory()===!0&&(yield r);return}yield*r.flush(t)}function gn(r){return async function*(e,n){let i=new Y({root:!0,dir:!0,path:"",dirty:!0,flat:!0},r),o,a=!1;for await(let c of e){if(c==null)continue;let l=`${c.originalPath??""}`.split("/")[0];l!=null&&l!==""&&(o==null?(o=l,a=!0):o!==l&&(a=!1)),i=await Co(c,i,r),c.unixfs?.isDirectory()!==!0&&(yield c)}if(r.wrapWithDirectory||a&&i.childCount()>1)yield*mn(i,n);else for await(let c of i.eachChildSeries())c!=null&&(yield*mn(c.child,n))}}async function*Ge(r,t,e={}){let n;Symbol.asyncIterator in r||Symbol.iterator in r?n=r:n=[r];let i=e.wrapWithDirectory??!1,o=e.shardSplitThresholdBytes??262144,a=e.shardFanoutBits??8,c=e.cidVersion??1,l=e.rawLeaves??!0,b=e.leafType??"file",f=e.fileImportConcurrency??50,w=e.blockWriteConcurrency??10,S=e.reduceSingleLeafToSelf??!0,s=e.chunker??Qe(),h=e.chunkValidator??Qr(),d=e.dagBuilder??Jr({chunker:s,chunkValidator:h,wrapWithDirectory:i,layout:e.layout??Re(),bufferImporter:e.bufferImporter??Xr({cidVersion:c,rawLeaves:l,leafType:b,onProgress:e.onProgress}),blockWriteConcurrency:w,reduceSingleLeafToSelf:S,cidVersion:c,onProgress:e.onProgress}),E=e.treeBuilder??gn({wrapWithDirectory:i,shardSplitThresholdBytes:o,shardFanoutBits:a,cidVersion:c,onProgress:e.onProgress});for await(let u of E(lt(d(n,t),f),t))yield{cid:u.cid,path:u.path,unixfs:u.unixfs,size:u.size}}async function $e(r,t,e={}){let n=await jt(Ge([r],t,e));if(n==null)throw(0,Oe.default)(new Error("Nothing imported"),"ERR_INVALID_PARAMS");return n}async function Fo(r,t,e={}){let n=await jt(Ge([r],t,e));if(n==null)throw(0,Oe.default)(new Error("Nothing imported"),"ERR_INVALID_PARAMS");return n}async function Po(r,t,e={}){return $e({content:r},t,e)}async function Uo(r,t,e={}){return $e({content:r},t,e)}return Bn(Mo);})();
3
3
  return IpfsUnixfsImporter}));
@@ -99,7 +99,7 @@ const reduce = (file, blockstore, options) => {
99
99
  Hash: leaf.cid
100
100
  };
101
101
  }
102
- if ((leaf.unixfs == null) || (leaf.unixfs.data == null)) {
102
+ if ((leaf.unixfs?.data == null)) {
103
103
  // node is an intermediate node
104
104
  f.addBlockSize(leaf.unixfs?.fileSize() ?? 0n);
105
105
  }
@@ -1 +1 @@
1
- {"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/dag-builder/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA4B,OAAO,EAAE,MAAM,cAAc,CAAA;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,aAAa,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,M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MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;QACnC,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;QAErD,OAAO,CAAC,UAAU,EAAE,CAAC,IAAI,mBAAmB,CAAqB,sCAAsC,EAAE;YACvG,GAAG;YACH,IAAI,EAAE,IAAI,CAAC,YAAY;SACxB,CAAC,CAAC,CAAA;QAEH,OAAO;YACL,GAAG;YACH,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,CAAC;YACT,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACzF,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,KAAK;SACN,CAAA;IACH,CAAC,CAAA;IAED,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAMD,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,IAAU,EAAE,KAAsB,EAAE,OAA2B,EAAmC,EAAE;IACpI,OAAO,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AAC3F,CAAC,CAAA"}
@@ -79,7 +79,7 @@ export class DirFlat extends Dir {
79
79
  * @param {number} acc
80
80
  * @param {PBLink} curr
81
81
  */
82
- (acc, curr) => acc + (curr.Tsize == null ? 0 : curr.Tsize), 0);
82
+ (acc, curr) => acc + (curr.Tsize ?? 0), 0);
83
83
  this.cid = cid;
84
84
  this.size = size;
85
85
  yield {
@@ -1 +1 @@
1
- {"version":3,"file":"dir-flat.js","sourceRoot":"","sources":["../../src/dir-flat.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null || !entry.unixfs.isDirectory()) {
79
+ if (entry.unixfs?.isDirectory() !== true) {
80
80
  yield entry;
81
81
  }
82
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tree-builder.js","sourceRoot":"","sources":["../../src/tree-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAShE,KAAK,UAAU,SAAS,CAAE,IAA4B,EAAE,IAAS,EAAE,OAAyB;IAC1F,MAAM,SAAS,GAAG,gBAAgB,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;IACnD,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAA;IACtC,IAAI,MAAM,GAAG,IAAI,CAAA;IACjB,IAAI,WAAW,GAAG,EAAE,CAAA;IAEpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;QAE7B,WAAW,IAAI,GAAG,WAAW,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAA;QAE5D,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,SAAS,CAAC,CAAA;QAC9B,MAAM,CAAC,KAAK,GAAG,IAAI,CAAA;QACnB,MAAM,CAAC,GAAG,GAAG,SAAS,CAAA;QACtB,MAAM,CAAC,IAAI,GAAG,SAAS,CAAA;QAEvB,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;YAChC,IAAI,GAAG,M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AAE,GAAG,CAAC,CAAC,EAAE,CAAC;YACvE,KAAM,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACpC,CAAC;aAAM,CAAC;YACN,IAAI,KAAK,EAAE,MAAM,SAAS,IAAI,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC;gBACrD,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;oBACtB,SAAQ;gBACV,CAAC;gBAED,KAAM,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;YAC/C,CAAC;QACH,CAAC;IACH,CAAC,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ipfs-unixfs-importer",
3
- "version": "15.2.5",
3
+ "version": "15.2.6",
4
4
  "description": "JavaScript implementation of the UnixFs importer used by IPFS",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/ipfs/js-ipfs-unixfs/tree/main/packages/ipfs-unixfs-importer#readme",
@@ -63,6 +63,91 @@
63
63
  "sourceType": "module"
64
64
  }
65
65
  },
66
+ "release": {
67
+ "branches": [
68
+ "main"
69
+ ],
70
+ "plugins": [
71
+ [
72
+ "@semantic-release/commit-analyzer",
73
+ {
74
+ "preset": "conventionalcommits",
75
+ "releaseRules": [
76
+ {
77
+ "breaking": true,
78
+ "release": "major"
79
+ },
80
+ {
81
+ "revert": true,
82
+ "release": "patch"
83
+ },
84
+ {
85
+ "type": "feat",
86
+ "release": "minor"
87
+ },
88
+ {
89
+ "type": "fix",
90
+ "release": "patch"
91
+ },
92
+ {
93
+ "type": "docs",
94
+ "release": "patch"
95
+ },
96
+ {
97
+ "type": "test",
98
+ "release": "patch"
99
+ },
100
+ {
101
+ "type": "deps",
102
+ "release": "patch"
103
+ },
104
+ {
105
+ "scope": "no-release",
106
+ "release": false
107
+ }
108
+ ]
109
+ }
110
+ ],
111
+ [
112
+ "@semantic-release/release-notes-generator",
113
+ {
114
+ "preset": "conventionalcommits",
115
+ "presetConfig": {
116
+ "types": [
117
+ {
118
+ "type": "feat",
119
+ "section": "Features"
120
+ },
121
+ {
122
+ "type": "fix",
123
+ "section": "Bug Fixes"
124
+ },
125
+ {
126
+ "type": "chore",
127
+ "section": "Trivial Changes"
128
+ },
129
+ {
130
+ "type": "docs",
131
+ "section": "Documentation"
132
+ },
133
+ {
134
+ "type": "deps",
135
+ "section": "Dependencies"
136
+ },
137
+ {
138
+ "type": "test",
139
+ "section": "Tests"
140
+ }
141
+ ]
142
+ }
143
+ }
144
+ ],
145
+ "@semantic-release/changelog",
146
+ "@semantic-release/npm",
147
+ "@semantic-release/github",
148
+ "@semantic-release/git"
149
+ ]
150
+ },
66
151
  "scripts": {
67
152
  "test": "aegir test",
68
153
  "test:node": "aegir test -t node --cov",
@@ -71,30 +156,31 @@
71
156
  "build": "aegir build",
72
157
  "clean": "aegir clean",
73
158
  "lint": "aegir lint",
74
- "dep-check": "aegir dep-check"
159
+ "dep-check": "aegir dep-check",
160
+ "release": "aegir release"
75
161
  },
76
162
  "dependencies": {
77
- "@ipld/dag-pb": "^4.1.0",
163
+ "@ipld/dag-pb": "^4.1.2",
78
164
  "@multiformats/murmur3": "^2.1.8",
79
165
  "err-code": "^3.0.1",
80
166
  "hamt-sharding": "^3.0.6",
81
- "interface-blockstore": "^5.2.10",
167
+ "interface-blockstore": "^5.3.0",
82
168
  "interface-store": "^5.1.8",
83
169
  "ipfs-unixfs": "^11.0.0",
84
- "it-all": "^3.0.4",
85
- "it-batch": "^3.0.4",
86
- "it-first": "^3.0.4",
87
- "it-parallel-batch": "^3.0.4",
88
- "multiformats": "^13.1.0",
89
- "progress-events": "^1.0.0",
170
+ "it-all": "^3.0.6",
171
+ "it-batch": "^3.0.6",
172
+ "it-first": "^3.0.6",
173
+ "it-parallel-batch": "^3.0.6",
174
+ "multiformats": "^13.2.3",
175
+ "progress-events": "^1.0.1",
90
176
  "rabin-wasm": "^0.1.5",
91
177
  "uint8arraylist": "^2.4.8",
92
- "uint8arrays": "^5.0.3"
178
+ "uint8arrays": "^5.1.0"
93
179
  },
94
180
  "devDependencies": {
95
- "aegir": "^42.2.5",
96
- "blockstore-core": "^4.4.0",
97
- "it-last": "^3.0.4",
181
+ "aegir": "^44.1.1",
182
+ "blockstore-core": "^4.4.1",
183
+ "it-last": "^3.0.6",
98
184
  "wherearewe": "^2.0.1"
99
185
  },
100
186
  "browser": {
@@ -148,7 +148,7 @@ const reduce = (file: File, blockstore: WritableStorage, options: ReduceOptions)
148
148
  }
149
149
  }
150
150
 
151
- if ((leaf.unixfs == null) || (leaf.unixfs.data == null)) {
151
+ if ((leaf.unixfs?.data == null)) {
152
152
  // node is an intermediate node
153
153
  f.addBlockSize(leaf.unixfs?.fileSize() ?? 0n)
154
154
  } else {
package/src/dir-flat.ts CHANGED
@@ -103,7 +103,7 @@ export class DirFlat extends Dir {
103
103
  * @param {number} acc
104
104
  * @param {PBLink} curr
105
105
  */
106
- (acc, curr) => acc + (curr.Tsize == null ? 0 : curr.Tsize),
106
+ (acc, curr) => acc + (curr.Tsize ?? 0),
107
107
  0)
108
108
 
109
109
  this.cid = cid
@@ -104,7 +104,7 @@ export function defaultTreeBuilder (options: TreeBuilderOptions): TreeBuilder {
104
104
 
105
105
  tree = await addToTree(entry, tree, options)
106
106
 
107
- if (entry.unixfs == null || !entry.unixfs.isDirectory()) {
107
+ if (entry.unixfs?.isDirectory() !== true) {
108
108
  yield entry
109
109
  }
110
110
  }