@helia/dag-cbor 1.0.2 → 2.0.0

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
@@ -4,7 +4,7 @@
4
4
  </a>
5
5
  </p>
6
6
 
7
- # @helia/dag-cbor <!-- omit in toc -->
7
+ # @helia/dag-cbor
8
8
 
9
9
  [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)
10
10
  [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)
@@ -13,21 +13,36 @@
13
13
 
14
14
  > Add/get IPLD blocks containing dag-cbor with your Helia node
15
15
 
16
- ## Table of contents <!-- omit in toc -->
16
+ # About
17
17
 
18
- - [Install](#install)
19
- - [Browser `<script>` tag](#browser-script-tag)
20
- - [API Docs](#api-docs)
21
- - [License](#license)
22
- - [Contribute](#contribute)
18
+ `@helia/dag-cbor` makes working with DAG-JSON Helia simple & straightforward.
23
19
 
24
- ## Install
20
+ See the DAGCBOR interface for all available operations.
21
+
22
+ ## Example
23
+
24
+ ```typescript
25
+ import { createHelia } from 'helia'
26
+ import { dagCbor } from '@helia/dag-cbor'
27
+ import { CID } from 'multiformats/cid'
28
+
29
+ const d = dagCbor(helia)
30
+ const cid = await d.put({
31
+ hello: 'world'
32
+ })
33
+ const obj = await d.get(cid)
34
+
35
+ console.info(obj)
36
+ // { hello: 'world' }
37
+ ```
38
+
39
+ # Install
25
40
 
26
41
  ```console
27
42
  $ npm i @helia/dag-cbor
28
43
  ```
29
44
 
30
- ### Browser `<script>` tag
45
+ ## Browser `<script>` tag
31
46
 
32
47
  Loading this module through a script tag will make it's exports available as `HeliaDagCbor` in the global namespace.
33
48
 
@@ -35,18 +50,18 @@ Loading this module through a script tag will make it's exports available as `He
35
50
  <script src="https://unpkg.com/@helia/dag-cbor/dist/index.min.js"></script>
36
51
  ```
37
52
 
38
- ## API Docs
53
+ # API Docs
39
54
 
40
55
  - <https://ipfs.github.io/helia-dag-cbor/modules/_helia_dag_cbor.html>
41
56
 
42
- ## License
57
+ # License
43
58
 
44
59
  Licensed under either of
45
60
 
46
61
  - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
47
62
  - MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
48
63
 
49
- ## Contribute
64
+ # Contribute
50
65
 
51
66
  Contributions welcome! Please check out [the issues](https://github.com/ipfs/helia-dag-cbor/issues).
52
67
 
package/dist/index.min.js CHANGED
@@ -1,3 +1,3 @@
1
1
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.HeliaDagCbor = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
- "use strict";var HeliaDagCbor=(()=>{var ke=Object.defineProperty;var wr=Object.getOwnPropertyDescriptor;var br=Object.getOwnPropertyNames;var xr=Object.prototype.hasOwnProperty;var Er=(e,t)=>{for(var r in t)ke(e,r,{get:t[r],enumerable:!0})},Ur=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of br(t))!xr.call(e,o)&&o!==r&&ke(e,o,{get:()=>t[o],enumerable:!(n=wr(t,o))||n.enumerable});return e};var vr=e=>Ur(ke({},"__esModule",{value:!0}),e);var zn={};Er(zn,{dagCbor:()=>Dn});var Ar=["string","number","bigint","symbol"],kr=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function Je(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(Ar.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(Tr(e))return"Buffer";let r=Sr(e);return r||"Object"}function Tr(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function Sr(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(kr.includes(t))return t}var s=class{constructor(t,r,n){this.major=t,this.majorEncoded=t<<5,this.name=r,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(t){return this.major<t.major?-1:this.major>t.major?1:0}};s.uint=new s(0,"uint",!0);s.negint=new s(1,"negint",!0);s.bytes=new s(2,"bytes",!0);s.string=new s(3,"string",!0);s.array=new s(4,"array",!1);s.map=new s(5,"map",!1);s.tag=new s(6,"tag",!1);s.float=new s(7,"float",!0);s.false=new s(7,"false",!0);s.true=new s(7,"true",!0);s.null=new s(7,"null",!0);s.undefined=new s(7,"undefined",!0);s.break=new s(7,"break",!0);var a=class{constructor(t,r,n){this.type=t,this.value=r,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};var J=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Br=new TextDecoder,Ir=new TextEncoder;function he(e){return J&&globalThis.Buffer.isBuffer(e)}function Te(e){return e instanceof Uint8Array?he(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Qe=J?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):He(e,t,r):(e,t,r)=>r-t>64?Br.decode(e.subarray(t,r)):He(e,t,r),We=J?e=>e.length>64?globalThis.Buffer.from(e):Ke(e):e=>e.length>64?Ir.encode(e):Ke(e),M=e=>Uint8Array.from(e),K=J?(e,t,r)=>he(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Ze=J?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Te(globalThis.Buffer.concat(e,t))):(e,t)=>{let r=new Uint8Array(t),n=0;for(let o of e)n+o.length>r.length&&(o=o.subarray(0,r.length-n)),r.set(o,n),n+=o.length;return r},Ye=J?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function et(e,t){if(he(e)&&he(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}function Ke(e,t=1/0){let r,n=e.length,o=null,i=[];for(let u=0;u<n;++u){if(r=e.charCodeAt(u),r>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}else if(u+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return i}function He(e,t,r){let n=[];for(;t<r;){let o=e[t],i=null,u=o>239?4:o>223?3:o>191?2:1;if(t+u<=r){let d,p,w,h;switch(u){case 1:o<128&&(i=o);break;case 2:d=e[t+1],(d&192)===128&&(h=(o&31)<<6|d&63,h>127&&(i=h));break;case 3:d=e[t+1],p=e[t+2],(d&192)===128&&(p&192)===128&&(h=(o&15)<<12|(d&63)<<6|p&63,h>2047&&(h<55296||h>57343)&&(i=h));break;case 4:d=e[t+1],p=e[t+2],w=e[t+3],(d&192)===128&&(p&192)===128&&(w&192)===128&&(h=(o&15)<<18|(d&63)<<12|(p&63)<<6|w&63,h>65535&&h<1114112&&(i=h))}}i===null?(i=65533,u=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),t+=u}return Cr(n)}var Xe=4096;function Cr(e){let t=e.length;if(t<=Xe)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Xe));return r}var Nr=256,te=class{constructor(t=Nr){this.chunkSize=t,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(t){let r=this.chunks[this.chunks.length-1];if(this.cursor+t.length<=this.maxCursor+1){let o=r.length-(this.maxCursor-this.cursor)-1;r.set(t,o)}else{if(r){let o=r.length-(this.maxCursor-this.cursor)-1;o<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,o),this.maxCursor=this.cursor-1)}t.length<64&&t.length<this.chunkSize?(r=Ye(this.chunkSize),this.chunks.push(r),this.maxCursor+=r.length,this._initReuseChunk===null&&(this._initReuseChunk=r),r.set(t,0)):(this.chunks.push(t),this.maxCursor+=t.length)}this.cursor+=t.length}toBytes(t=!1){let r;if(this.chunks.length===1){let n=this.chunks[0];t&&this.cursor>n.length/2?(r=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=K(n,0,this.cursor)}else r=Ze(this.chunks,this.cursor);return t&&this.reset(),r}};var f="CBOR decode error:",Se="CBOR encode error:",re=[];re[23]=1;re[24]=2;re[25]=3;re[26]=5;re[27]=9;function O(e,t,r){if(e.length-t<r)throw new Error(`${f} not enough data for type`)}var y=[24,256,65536,4294967296,BigInt("18446744073709551616")];function x(e,t,r){O(e,t,1);let n=e[t];if(r.strict===!0&&n<y[0])throw new Error(`${f} integer encoded in more bytes than necessary (strict decode)`);return n}function E(e,t,r){O(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<y[1])throw new Error(`${f} integer encoded in more bytes than necessary (strict decode)`);return n}function U(e,t,r){O(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<y[2])throw new Error(`${f} integer encoded in more bytes than necessary (strict decode)`);return n}function v(e,t,r){O(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],o=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],i=(BigInt(n)<<BigInt(32))+BigInt(o);if(r.strict===!0&&i<y[3])throw new Error(`${f} integer encoded in more bytes than necessary (strict decode)`);if(i<=Number.MAX_SAFE_INTEGER)return Number(i);if(r.allowBigInt===!0)return i;throw new Error(`${f} integers outside of the safe integer range are not supported`)}function tt(e,t,r,n){return new a(s.uint,x(e,t+1,n),2)}function rt(e,t,r,n){return new a(s.uint,E(e,t+1,n),3)}function nt(e,t,r,n){return new a(s.uint,U(e,t+1,n),5)}function ot(e,t,r,n){return new a(s.uint,v(e,t+1,n),9)}function k(e,t){return g(e,0,t.value)}function g(e,t,r){if(r<y[0]){let n=Number(r);e.push([t|n])}else if(r<y[1]){let n=Number(r);e.push([t|24,n])}else if(r<y[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<y[3]){let n=Number(r);e.push([t|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<y[4]){let o=[t|27,0,0,0,0,0,0,0],i=Number(n&BigInt(4294967295)),u=Number(n>>BigInt(32)&BigInt(4294967295));o[8]=i&255,i=i>>8,o[7]=i&255,i=i>>8,o[6]=i&255,i=i>>8,o[5]=i&255,o[4]=u&255,u=u>>8,o[3]=u&255,u=u>>8,o[2]=u&255,u=u>>8,o[1]=u&255,e.push(o)}else throw new Error(`${f} encountered BigInt larger than allowable range`)}}k.encodedSize=function(t){return g.encodedSize(t.value)};g.encodedSize=function(t){return t<y[0]?1:t<y[1]?2:t<y[2]?3:t<y[3]?5:9};k.compareTokens=function(t,r){return t.value<r.value?-1:t.value>r.value?1:0};function it(e,t,r,n){return new a(s.negint,-1-x(e,t+1,n),2)}function st(e,t,r,n){return new a(s.negint,-1-E(e,t+1,n),3)}function ct(e,t,r,n){return new a(s.negint,-1-U(e,t+1,n),5)}var Be=BigInt(-1),at=BigInt(1);function ut(e,t,r,n){let o=v(e,t+1,n);if(typeof o!="bigint"){let i=-1-o;if(i>=Number.MIN_SAFE_INTEGER)return new a(s.negint,i,9)}if(n.allowBigInt!==!0)throw new Error(`${f} integers outside of the safe integer range are not supported`);return new a(s.negint,Be-BigInt(o),9)}function me(e,t){let r=t.value,n=typeof r=="bigint"?r*Be-at:r*-1-1;g(e,t.type.majorEncoded,n)}me.encodedSize=function(t){let r=t.value,n=typeof r=="bigint"?r*Be-at:r*-1-1;return n<y[0]?1:n<y[1]?2:n<y[2]?3:n<y[3]?5:9};me.compareTokens=function(t,r){return t.value<r.value?1:t.value>r.value?-1:0};function ne(e,t,r,n){O(e,t,r+n);let o=K(e,t+r,t+r+n);return new a(s.bytes,o,r+n)}function dt(e,t,r,n){return ne(e,t,1,r)}function ft(e,t,r,n){return ne(e,t,2,x(e,t+1,n))}function lt(e,t,r,n){return ne(e,t,3,E(e,t+1,n))}function pt(e,t,r,n){return ne(e,t,5,U(e,t+1,n))}function ht(e,t,r,n){let o=v(e,t+1,n);if(typeof o=="bigint")throw new Error(`${f} 64-bit integer bytes lengths not supported`);return ne(e,t,9,o)}function ye(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===s.string?We(e.value):e.value),e.encodedBytes}function H(e,t){let r=ye(t);g(e,t.type.majorEncoded,r.length),e.push(r)}H.encodedSize=function(t){let r=ye(t);return g.encodedSize(r.length)+r.length};H.compareTokens=function(t,r){return $r(ye(t),ye(r))};function $r(e,t){return e.length<t.length?-1:e.length>t.length?1:et(e,t)}function oe(e,t,r,n,o){let i=r+n;O(e,t,i);let u=new a(s.string,Qe(e,t+r,t+i),i);return o.retainStringBytes===!0&&(u.byteValue=K(e,t+r,t+i)),u}function mt(e,t,r,n){return oe(e,t,1,r,n)}function yt(e,t,r,n){return oe(e,t,2,x(e,t+1,n),n)}function gt(e,t,r,n){return oe(e,t,3,E(e,t+1,n),n)}function wt(e,t,r,n){return oe(e,t,5,U(e,t+1,n),n)}function bt(e,t,r,n){let o=v(e,t+1,n);if(typeof o=="bigint")throw new Error(`${f} 64-bit integer string lengths not supported`);return oe(e,t,9,o,n)}var xt=H;function X(e,t,r,n){return new a(s.array,n,r)}function Et(e,t,r,n){return X(e,t,1,r)}function Ut(e,t,r,n){return X(e,t,2,x(e,t+1,n))}function vt(e,t,r,n){return X(e,t,3,E(e,t+1,n))}function At(e,t,r,n){return X(e,t,5,U(e,t+1,n))}function kt(e,t,r,n){let o=v(e,t+1,n);if(typeof o=="bigint")throw new Error(`${f} 64-bit integer array lengths not supported`);return X(e,t,9,o)}function Tt(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${f} indefinite length items not allowed`);return X(e,t,1,1/0)}function ge(e,t){g(e,s.array.majorEncoded,t.value)}ge.compareTokens=k.compareTokens;ge.encodedSize=function(t){return g.encodedSize(t.value)};function Q(e,t,r,n){return new a(s.map,n,r)}function St(e,t,r,n){return Q(e,t,1,r)}function Bt(e,t,r,n){return Q(e,t,2,x(e,t+1,n))}function It(e,t,r,n){return Q(e,t,3,E(e,t+1,n))}function Ct(e,t,r,n){return Q(e,t,5,U(e,t+1,n))}function Nt(e,t,r,n){let o=v(e,t+1,n);if(typeof o=="bigint")throw new Error(`${f} 64-bit integer map lengths not supported`);return Q(e,t,9,o)}function _t(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${f} indefinite length items not allowed`);return Q(e,t,1,1/0)}function we(e,t){g(e,s.map.majorEncoded,t.value)}we.compareTokens=k.compareTokens;we.encodedSize=function(t){return g.encodedSize(t.value)};function $t(e,t,r,n){return new a(s.tag,r,1)}function Mt(e,t,r,n){return new a(s.tag,x(e,t+1,n),2)}function Dt(e,t,r,n){return new a(s.tag,E(e,t+1,n),3)}function zt(e,t,r,n){return new a(s.tag,U(e,t+1,n),5)}function Ot(e,t,r,n){return new a(s.tag,v(e,t+1,n),9)}function be(e,t){g(e,s.tag.majorEncoded,t.value)}be.compareTokens=k.compareTokens;be.encodedSize=function(t){return g.encodedSize(t.value)};var Vr=20,Lr=21,Rr=22,Pr=23;function Ft(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${f} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new a(s.null,null,1):new a(s.undefined,void 0,1)}function Vt(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${f} indefinite length items not allowed`);return new a(s.break,void 0,1)}function Ie(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${f} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${f} Infinity values are not supported`)}return new a(s.float,e,t)}function Lt(e,t,r,n){return Ie(Ce(e,t+1),3,n)}function Rt(e,t,r,n){return Ie(Ne(e,t+1),5,n)}function Pt(e,t,r,n){return Ie(Jt(e,t+1),9,n)}function xe(e,t,r){let n=t.value;if(n===!1)e.push([s.float.majorEncoded|Vr]);else if(n===!0)e.push([s.float.majorEncoded|Lr]);else if(n===null)e.push([s.float.majorEncoded|Rr]);else if(n===void 0)e.push([s.float.majorEncoded|Pr]);else{let o,i=!1;(!r||r.float64!==!0)&&(qt(n),o=Ce(I,1),n===o||Number.isNaN(n)?(I[0]=249,e.push(I.slice(0,3)),i=!0):(Gt(n),o=Ne(I,1),n===o&&(I[0]=250,e.push(I.slice(0,5)),i=!0))),i||(jr(n),o=Jt(I,1),I[0]=251,e.push(I.slice(0,9)))}}xe.encodedSize=function(t,r){let n=t.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){qt(n);let o=Ce(I,1);if(n===o||Number.isNaN(n))return 3;if(Gt(n),o=Ne(I,1),n===o)return 5}return 9};var jt=new ArrayBuffer(9),T=new DataView(jt,1),I=new Uint8Array(jt,0);function qt(e){if(e===1/0)T.setUint16(0,31744,!1);else if(e===-1/0)T.setUint16(0,64512,!1);else if(Number.isNaN(e))T.setUint16(0,32256,!1);else{T.setFloat32(0,e);let t=T.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)T.setUint16(0,31744,!1);else if(r===0)T.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let o=r-127;o<-24?T.setUint16(0,0):o<-14?T.setUint16(0,(t&2147483648)>>16|1<<24+o,!1):T.setUint16(0,(t&2147483648)>>16|o+15<<10|n>>13,!1)}}}function Ce(e,t){if(e.length-t<2)throw new Error(`${f} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,o=r&1023,i;return n===0?i=o*2**-24:n!==31?i=(o+1024)*2**(n-25):i=o===0?1/0:NaN,r&32768?-i:i}function Gt(e){T.setFloat32(0,e,!1)}function Ne(e,t){if(e.length-t<4)throw new Error(`${f} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function jr(e){T.setFloat64(0,e,!1)}function Jt(e,t){if(e.length-t<8)throw new Error(`${f} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}xe.compareTokens=k.compareTokens;function l(e,t,r){throw new Error(`${f} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Ee(e){return()=>{throw new Error(`${f} ${e}`)}}var c=[];for(let e=0;e<=23;e++)c[e]=l;c[24]=tt;c[25]=rt;c[26]=nt;c[27]=ot;c[28]=l;c[29]=l;c[30]=l;c[31]=l;for(let e=32;e<=55;e++)c[e]=l;c[56]=it;c[57]=st;c[58]=ct;c[59]=ut;c[60]=l;c[61]=l;c[62]=l;c[63]=l;for(let e=64;e<=87;e++)c[e]=dt;c[88]=ft;c[89]=lt;c[90]=pt;c[91]=ht;c[92]=l;c[93]=l;c[94]=l;c[95]=Ee("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)c[e]=mt;c[120]=yt;c[121]=gt;c[122]=wt;c[123]=bt;c[124]=l;c[125]=l;c[126]=l;c[127]=Ee("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)c[e]=Et;c[152]=Ut;c[153]=vt;c[154]=At;c[155]=kt;c[156]=l;c[157]=l;c[158]=l;c[159]=Tt;for(let e=160;e<=183;e++)c[e]=St;c[184]=Bt;c[185]=It;c[186]=Ct;c[187]=Nt;c[188]=l;c[189]=l;c[190]=l;c[191]=_t;for(let e=192;e<=215;e++)c[e]=$t;c[216]=Mt;c[217]=Dt;c[218]=zt;c[219]=Ot;c[220]=l;c[221]=l;c[222]=l;c[223]=l;for(let e=224;e<=243;e++)c[e]=Ee("simple values are not supported");c[244]=l;c[245]=l;c[246]=l;c[247]=Ft;c[248]=Ee("simple values are not supported");c[249]=Lt;c[250]=Rt;c[251]=Pt;c[252]=l;c[253]=l;c[254]=l;c[255]=Vt;var C=[];for(let e=0;e<24;e++)C[e]=new a(s.uint,e,1);for(let e=-1;e>=-24;e--)C[31-e]=new a(s.negint,e,1);C[64]=new a(s.bytes,new Uint8Array(0),1);C[96]=new a(s.string,"",1);C[128]=new a(s.array,0,1);C[160]=new a(s.map,0,1);C[244]=new a(s.false,!1,1);C[245]=new a(s.true,!0,1);C[246]=new a(s.null,null,1);function Kt(e){switch(e.type){case s.false:return M([244]);case s.true:return M([245]);case s.null:return M([246]);case s.bytes:return e.value.length?void 0:M([64]);case s.string:return e.value===""?M([96]):void 0;case s.array:return e.value===0?M([128]):void 0;case s.map:return e.value===0?M([160]):void 0;case s.uint:return e.value<24?M([Number(e.value)]):void 0;case s.negint:if(e.value>=-24)return M([31-Number(e.value)])}}var Gr={float64:!1,mapSorter:Hr,quickEncodeToken:Kt};function Jr(){let e=[];return e[s.uint.major]=k,e[s.negint.major]=me,e[s.bytes.major]=H,e[s.string.major]=xt,e[s.array.major]=ge,e[s.map.major]=we,e[s.tag.major]=be,e[s.float.major]=xe,e}var Ht=Jr(),_e=new te,ve=class e{constructor(t,r){this.obj=t,this.parent=r}includes(t){let r=this;do if(r.obj===t)return!0;while(r=r.parent);return!1}static createCheck(t,r){if(t&&t.includes(r))throw new Error(`${Se} object contains circular references`);return new e(r,t)}},L={null:new a(s.null,null),undefined:new a(s.undefined,void 0),true:new a(s.true,!0),false:new a(s.false,!1),emptyArray:new a(s.array,0),emptyMap:new a(s.map,0)},R={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new a(s.float,e):e>=0?new a(s.uint,e):new a(s.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new a(s.uint,e):new a(s.negint,e)},Uint8Array(e,t,r,n){return new a(s.bytes,e)},string(e,t,r,n){return new a(s.string,e)},boolean(e,t,r,n){return e?L.true:L.false},null(e,t,r,n){return L.null},undefined(e,t,r,n){return L.undefined},ArrayBuffer(e,t,r,n){return new a(s.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new a(s.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[L.emptyArray,new a(s.break)]:L.emptyArray;n=ve.createCheck(n,e);let o=[],i=0;for(let u of e)o[i++]=Ue(u,r,n);return r.addBreakTokens?[new a(s.array,e.length),o,new a(s.break)]:[new a(s.array,e.length),o]},Object(e,t,r,n){let o=t!=="Object",i=o?e.keys():Object.keys(e),u=o?e.size:i.length;if(!u)return r.addBreakTokens===!0?[L.emptyMap,new a(s.break)]:L.emptyMap;n=ve.createCheck(n,e);let d=[],p=0;for(let w of i)d[p++]=[Ue(w,r,n),Ue(o?e.get(w):e[w],r,n)];return Kr(d,r),r.addBreakTokens?[new a(s.map,u),d,new a(s.break)]:[new a(s.map,u),d]}};R.Map=R.Object;R.Buffer=R.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))R[`${e}Array`]=R.DataView;function Ue(e,t={},r){let n=Je(e),o=t&&t.typeEncoders&&t.typeEncoders[n]||R[n];if(typeof o=="function"){let u=o(e,n,t,r);if(u!=null)return u}let i=R[n];if(!i)throw new Error(`${Se} unsupported type: ${n}`);return i(e,n,t,r)}function Kr(e,t){t.mapSorter&&e.sort(t.mapSorter)}function Hr(e,t){let r=Array.isArray(e[0])?e[0][0]:e[0],n=Array.isArray(t[0])?t[0][0]:t[0];if(r.type!==n.type)return r.type.compare(n.type);let o=r.type.major,i=Ht[o].compareTokens(r,n);return i===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),i}function Xt(e,t,r,n){if(Array.isArray(t))for(let o of t)Xt(e,o,r,n);else r[t.type.major](e,t,n)}function Xr(e,t,r){let n=Ue(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){let o=r.quickEncodeToken(n);if(o)return o;let i=t[n.type.major];if(i.encodedSize){let u=i.encodedSize(n,r),d=new te(u);if(i(d,n,r),d.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return Te(d.chunks[0])}}return _e.reset(),Xt(_e,n,t,r),_e.toBytes(!0)}function $e(e,t){return t=Object.assign({},Gr,t),Xr(e,Ht,t)}var Qr={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Me=class{constructor(t,r={}){this.pos=0,this.data=t,this.options=r}done(){return this.pos>=this.data.length}next(){let t=this.data[this.pos],r=C[t];if(r===void 0){let n=c[t];if(!n)throw new Error(`${f} no decoder for major type ${t>>>5} (byte 0x${t.toString(16).padStart(2,"0")})`);let o=t&31;r=n(this.data,this.pos,o,this.options)}return this.pos+=r.encodedLength,r}},ie=Symbol.for("DONE"),Ae=Symbol.for("BREAK");function Wr(e,t,r){let n=[];for(let o=0;o<e.value;o++){let i=se(t,r);if(i===Ae){if(e.value===1/0)break;throw new Error(`${f} got unexpected break to lengthed array`)}if(i===ie)throw new Error(`${f} found array but not enough entries (got ${o}, expected ${e.value})`);n[o]=i}return n}function Zr(e,t,r){let n=r.useMaps===!0,o=n?void 0:{},i=n?new Map:void 0;for(let u=0;u<e.value;u++){let d=se(t,r);if(d===Ae){if(e.value===1/0)break;throw new Error(`${f} got unexpected break to lengthed map`)}if(d===ie)throw new Error(`${f} found map but not enough entries (got ${u} [no key], expected ${e.value})`);if(n!==!0&&typeof d!="string")throw new Error(`${f} non-string keys not supported (got ${typeof d})`);if(r.rejectDuplicateMapKeys===!0&&(n&&i.has(d)||!n&&d in o))throw new Error(`${f} found repeat map key "${d}"`);let p=se(t,r);if(p===ie)throw new Error(`${f} found map but not enough entries (got ${u} [no value], expected ${e.value})`);n?i.set(d,p):o[d]=p}return n?i:o}function se(e,t){if(e.done())return ie;let r=e.next();if(r.type===s.break)return Ae;if(r.type.terminal)return r.value;if(r.type===s.array)return Wr(r,e,t);if(r.type===s.map)return Zr(r,e,t);if(r.type===s.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=se(e,t);return t.tags[r.value](n)}throw new Error(`${f} tag not supported (${r.value})`)}throw new Error("unsupported")}function De(e,t){if(!(e instanceof Uint8Array))throw new Error(`${f} data to decode must be a Uint8Array`);t=Object.assign({},Qr,t);let r=t.tokenizer||new Me(e,t),n=se(r,t);if(n===ie)throw new Error(`${f} did not find any content to decode`);if(n===Ae)throw new Error(`${f} got unexpected break`);if(!r.done())throw new Error(`${f} too many terminals, data makes no sense`);return n}var en=Zt,Qt=128,tn=127,rn=~tn,nn=Math.pow(2,31);function Zt(e,t,r){t=t||[],r=r||0;for(var n=r;e>=nn;)t[r++]=e&255|Qt,e/=128;for(;e&rn;)t[r++]=e&255|Qt,e>>>=7;return t[r]=e|0,Zt.bytes=r-n+1,t}var on=ze,sn=128,Wt=127;function ze(e,n){var r=0,n=n||0,o=0,i=n,u,d=e.length;do{if(i>=d)throw ze.bytes=0,new RangeError("Could not decode varint");u=e[i++],r+=o<28?(u&Wt)<<o:(u&Wt)*Math.pow(2,o),o+=7}while(u>=sn);return ze.bytes=i-n,r}var cn=Math.pow(2,7),an=Math.pow(2,14),un=Math.pow(2,21),dn=Math.pow(2,28),fn=Math.pow(2,35),ln=Math.pow(2,42),pn=Math.pow(2,49),hn=Math.pow(2,56),mn=Math.pow(2,63),yn=function(e){return e<cn?1:e<an?2:e<un?3:e<dn?4:e<fn?5:e<ln?6:e<pn?7:e<hn?8:e<mn?9:10},gn={encode:en,decode:on,encodingLength:yn},wn=gn,ce=wn;var ae=(e,t=0)=>[ce.decode(e,t),ce.decode.bytes],W=(e,t,r=0)=>(ce.encode(e,t,r),t),Z=e=>ce.encodingLength(e);var Fo=new Uint8Array(0);var er=(e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0},Y=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};var ue=(e,t)=>{let r=t.byteLength,n=Z(e),o=n+Z(r),i=new Uint8Array(o+r);return W(e,i,0),W(r,i,n),i.set(t,o),new ee(e,r,t,i)},tr=e=>{let t=Y(e),[r,n]=ae(t),[o,i]=ae(t.subarray(n)),u=t.subarray(n+i);if(u.byteLength!==o)throw new Error("Incorrect length");return new ee(r,o,u,t)},rr=(e,t)=>{if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&er(e.bytes,r.bytes)}},ee=class{constructor(t,r,n,o){this.code=t,this.size=r,this.digest=n,this.bytes=o}};function bn(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<e.length;o++){var i=e.charAt(o),u=i.charCodeAt(0);if(r[u]!==255)throw new TypeError(i+" is ambiguous");r[u]=o}var d=e.length,p=e.charAt(0),w=Math.log(d)/Math.log(256),h=Math.log(256)/Math.log(d);function G(m){if(m instanceof Uint8Array||(ArrayBuffer.isView(m)?m=new Uint8Array(m.buffer,m.byteOffset,m.byteLength):Array.isArray(m)&&(m=Uint8Array.from(m))),!(m instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(m.length===0)return"";for(var b=0,P=0,S=0,N=m.length;S!==N&&m[S]===0;)S++,b++;for(var _=(N-S)*h+1>>>0,A=new Uint8Array(_);S!==N;){for(var $=m[S],V=0,B=_-1;($!==0||V<P)&&B!==-1;B--,V++)$+=256*A[B]>>>0,A[B]=$%d>>>0,$=$/d>>>0;if($!==0)throw new Error("Non-zero carry");P=V,S++}for(var z=_-P;z!==_&&A[z]===0;)z++;for(var pe=p.repeat(b);z<_;++z)pe+=e.charAt(A[z]);return pe}function le(m){if(typeof m!="string")throw new TypeError("Expected String");if(m.length===0)return new Uint8Array;var b=0;if(m[b]!==" "){for(var P=0,S=0;m[b]===p;)P++,b++;for(var N=(m.length-b)*w+1>>>0,_=new Uint8Array(N);m[b];){var A=r[m.charCodeAt(b)];if(A===255)return;for(var $=0,V=N-1;(A!==0||$<S)&&V!==-1;V--,$++)A+=d*_[V]>>>0,_[V]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");S=$,b++}if(m[b]!==" "){for(var B=N-S;B!==N&&_[B]===0;)B++;for(var z=new Uint8Array(P+(N-B)),pe=P;B!==N;)z[pe++]=_[B++];return z}}}function gr(m){var b=le(m);if(b)return b;throw new Error(`Non-${t} character`)}return{encode:G,decodeUnsafe:le,decode:gr}}var xn=bn,En=xn,or=En;var Oe=class{constructor(t,r,n){this.name=t,this.prefix=r,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},Fe=class{constructor(t,r,n){if(this.name=t,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.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 ir(this,t)}},Ve=class{constructor(t){this.decoders=t}or(t){return ir(this,t)}decode(t){let r=t[0],n=this.decoders[r];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},ir=(e,t)=>new Ve({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}}),Le=class{constructor(t,r,n,o){this.name=t,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new Oe(t,r,n),this.decoder=new Fe(t,r,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},sr=({name:e,prefix:t,encode:r,decode:n})=>new Le(e,t,r,n),Re=({prefix:e,name:t,alphabet:r})=>{let{encode:n,decode:o}=or(r,t);return sr({prefix:e,name:t,encode:n,decode:i=>Y(o(i))})},Un=(e,t,r,n)=>{let o={};for(let h=0;h<t.length;++h)o[t[h]]=h;let i=e.length;for(;e[i-1]==="=";)--i;let u=new Uint8Array(i*r/8|0),d=0,p=0,w=0;for(let h=0;h<i;++h){let G=o[e[h]];if(G===void 0)throw new SyntaxError(`Non-${n} character`);p=p<<r|G,d+=r,d>=8&&(d-=8,u[w++]=255&p>>d)}if(d>=r||255&p<<8-d)throw new SyntaxError("Unexpected end of data");return u},vn=(e,t,r)=>{let n=t[t.length-1]==="=",o=(1<<r)-1,i="",u=0,d=0;for(let p=0;p<e.length;++p)for(d=d<<8|e[p],u+=8;u>r;)u-=r,i+=t[o&d>>u];if(u&&(i+=t[o&d<<r-u]),n)for(;i.length*r&7;)i+="=";return i},D=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>sr({prefix:t,name:e,encode(o){return vn(o,n,r)},decode(o){return Un(o,n,r,e)}});var F=Re({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Jo=Re({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var de=D({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Xo=D({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Qo=D({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Wo=D({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Zo=D({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Yo=D({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ei=D({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ti=D({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ri=D({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var cr=(e,t)=>{let{bytes:r,version:n}=e;switch(n){case 0:return kn(r,Pe(e),t||F.encoder);default:return Tn(r,Pe(e),t||de.encoder)}};var ar=new WeakMap,Pe=e=>{let t=ar.get(e);if(t==null){let r=new Map;return ar.set(e,r),r}return t},q=class e{constructor(t,r,n,o){this.code=r,this.version=t,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==fe)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Sn)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return e.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=ue(t,r);return e.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 e.equals(this,t)}static equals(t,r){let n=r;return n&&t.code===n.code&&t.version===n.version&&rr(t.multihash,n.multihash)}toString(t){return cr(this,t)}toJSON(){return{"/":cr(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof e)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:i,bytes:u}=r;return new e(n,o,i,u||ur(n,o,i.bytes))}else if(r[Bn]===!0){let{version:n,multihash:o,code:i}=r,u=tr(o);return e.create(n,i,u)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==fe)throw new Error(`Version 0 CID must use dag-pb (code: ${fe}) block encoding`);return new e(t,r,n,n.bytes)}case 1:{let o=ur(t,r,n.bytes);return new e(t,r,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return e.create(0,fe,t)}static createV1(t,r){return e.create(1,t,r)}static decode(t){let[r,n]=e.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=e.inspectBytes(t),n=r.size-r.multihashSize,o=Y(t.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let i=o.subarray(r.multihashSize-r.digestSize),u=new ee(r.multihashCode,r.digestSize,i,o);return[r.version===0?e.createV0(u):e.createV1(r.codec,u),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[G,le]=ae(t.subarray(r));return r+=le,G},o=n(),i=fe;if(o===18?(o=0,r=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let u=r,d=n(),p=n(),w=r+p,h=w-u;return{version:o,codec:i,multihashCode:d,digestSize:p,multihashSize:h,size:w}}static parse(t,r){let[n,o]=An(t,r),i=e.decode(o);if(i.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Pe(i).set(n,t),i}},An=(e,t)=>{switch(e[0]){case"Q":{let r=t||F;return[F.prefix,r.decode(`${F.prefix}${e}`)]}case F.prefix:{let r=t||F;return[F.prefix,r.decode(e)]}case de.prefix:{let r=t||de;return[de.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}},kn=(e,t,r)=>{let{prefix:n}=r;if(n!==F.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=t.get(n);if(o==null){let i=r.encode(e).slice(1);return t.set(n,i),i}else return o},Tn=(e,t,r)=>{let{prefix:n}=r,o=t.get(n);if(o==null){let i=r.encode(e);return t.set(n,i),i}else return o},fe=112,Sn=18,ur=(e,t,r)=>{let n=Z(e),o=n+Z(t),i=new Uint8Array(o+r.byteLength);return W(e,i,0),W(t,i,n),i.set(r,o),i},Bn=Symbol.for("@ipld/js-cid/CID");var dr=42;function In(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=q.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new a(s.tag,dr),new a(s.bytes,r)]}function Cn(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function Nn(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}var _n={float64:!0,typeEncoders:{Object:In,undefined:Cn,number:Nn}};function $n(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return q.decode(e.subarray(1))}var fr={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};fr.tags[dr]=$n;var lr=113,pr=e=>$e(e,_n),hr=e=>De(e,fr);var qe=({name:e,code:t,encode:r})=>new je(e,t,r),je=class{constructor(t,r,n){this.name=t,this.code=r,this.encode=n}digest(t){if(t instanceof Uint8Array){let r=this.encode(t);return r instanceof Uint8Array?ue(this.code,r):r.then(n=>ue(this.code,n))}else throw Error("Unknown type, must be binary type")}};var mr=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),yr=qe({name:"sha2-256",code:18,encode:mr("SHA-256")}),li=qe({name:"sha2-512",code:19,encode:mr("SHA-512")});var Ge=class{components;constructor(t){this.components=t}async add(t,r={}){let n=pr(t),o=await(r.hasher??yr).digest(n),i=q.createV1(lr,o);return await this.components.blockstore.put(i,n,r),i}async get(t,r={}){let n=await this.components.blockstore.get(t,r);return hr(n)}};function Dn(e){return new Ge(e)}return vr(zn);})();
2
+ "use strict";var HeliaDagCbor=(()=>{var Te=Object.defineProperty;var wr=Object.getOwnPropertyDescriptor;var br=Object.getOwnPropertyNames;var Er=Object.prototype.hasOwnProperty;var Ur=(e,t)=>{for(var r in t)Te(e,r,{get:t[r],enumerable:!0})},vr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of br(t))!Er.call(e,o)&&o!==r&&Te(e,o,{get:()=>t[o],enumerable:!(n=wr(t,o))||n.enumerable});return e};var Ar=e=>vr(Te({},"__esModule",{value:!0}),e);var On={};Ur(On,{dagCbor:()=>zn});var Tr=["string","number","bigint","symbol"],Sr=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function Je(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(Tr.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(kr(e))return"Buffer";let r=Br(e);return r||"Object"}function kr(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function Br(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Sr.includes(t))return t}var i=class{constructor(t,r,n){this.major=t,this.majorEncoded=t<<5,this.name=r,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(t){return this.major<t.major?-1:this.major>t.major?1:0}};i.uint=new i(0,"uint",!0);i.negint=new i(1,"negint",!0);i.bytes=new i(2,"bytes",!0);i.string=new i(3,"string",!0);i.array=new i(4,"array",!1);i.map=new i(5,"map",!1);i.tag=new i(6,"tag",!1);i.float=new i(7,"float",!0);i.false=new i(7,"false",!0);i.true=new i(7,"true",!0);i.null=new i(7,"null",!0);i.undefined=new i(7,"undefined",!0);i.break=new i(7,"break",!0);var a=class{constructor(t,r,n){this.type=t,this.value=r,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};var J=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Ir=new TextDecoder,Cr=new TextEncoder;function he(e){return J&&globalThis.Buffer.isBuffer(e)}function Se(e){return e instanceof Uint8Array?he(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Qe=J?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):He(e,t,r):(e,t,r)=>r-t>64?Ir.decode(e.subarray(t,r)):He(e,t,r),We=J?e=>e.length>64?globalThis.Buffer.from(e):Ke(e):e=>e.length>64?Cr.encode(e):Ke(e),M=e=>Uint8Array.from(e),K=J?(e,t,r)=>he(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Ze=J?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Se(globalThis.Buffer.concat(e,t))):(e,t)=>{let r=new Uint8Array(t),n=0;for(let o of e)n+o.length>r.length&&(o=o.subarray(0,r.length-n)),r.set(o,n),n+=o.length;return r},Ye=J?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function et(e,t){if(he(e)&&he(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}function Ke(e){let t=[],r=0;for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);o<128?t[r++]=o:o<2048?(t[r++]=o>>6|192,t[r++]=o&63|128):(o&64512)===55296&&n+1<e.length&&(e.charCodeAt(n+1)&64512)===56320?(o=65536+((o&1023)<<10)+(e.charCodeAt(++n)&1023),t[r++]=o>>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=o&63|128):(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=o&63|128)}return t}function He(e,t,r){let n=[];for(;t<r;){let o=e[t],s=null,u=o>239?4:o>223?3:o>191?2:1;if(t+u<=r){let f,p,g,h;switch(u){case 1:o<128&&(s=o);break;case 2:f=e[t+1],(f&192)===128&&(h=(o&31)<<6|f&63,h>127&&(s=h));break;case 3:f=e[t+1],p=e[t+2],(f&192)===128&&(p&192)===128&&(h=(o&15)<<12|(f&63)<<6|p&63,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:f=e[t+1],p=e[t+2],g=e[t+3],(f&192)===128&&(p&192)===128&&(g&192)===128&&(h=(o&15)<<18|(f&63)<<12|(p&63)<<6|g&63,h>65535&&h<1114112&&(s=h))}}s===null?(s=65533,u=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),t+=u}return _r(n)}var Xe=4096;function _r(e){let t=e.length;if(t<=Xe)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Xe));return r}var Nr=256,te=class{constructor(t=Nr){this.chunkSize=t,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(t){let r=this.chunks[this.chunks.length-1];if(this.cursor+t.length<=this.maxCursor+1){let o=r.length-(this.maxCursor-this.cursor)-1;r.set(t,o)}else{if(r){let o=r.length-(this.maxCursor-this.cursor)-1;o<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,o),this.maxCursor=this.cursor-1)}t.length<64&&t.length<this.chunkSize?(r=Ye(this.chunkSize),this.chunks.push(r),this.maxCursor+=r.length,this._initReuseChunk===null&&(this._initReuseChunk=r),r.set(t,0)):(this.chunks.push(t),this.maxCursor+=t.length)}this.cursor+=t.length}toBytes(t=!1){let r;if(this.chunks.length===1){let n=this.chunks[0];t&&this.cursor>n.length/2?(r=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=K(n,0,this.cursor)}else r=Ze(this.chunks,this.cursor);return t&&this.reset(),r}};var d="CBOR decode error:",ke="CBOR encode error:",re=[];re[23]=1;re[24]=2;re[25]=3;re[26]=5;re[27]=9;function O(e,t,r){if(e.length-t<r)throw new Error(`${d} not enough data for type`)}var x=[24,256,65536,4294967296,BigInt("18446744073709551616")];function b(e,t,r){O(e,t,1);let n=e[t];if(r.strict===!0&&n<x[0])throw new Error(`${d} integer encoded in more bytes than necessary (strict decode)`);return n}function E(e,t,r){O(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<x[1])throw new Error(`${d} integer encoded in more bytes than necessary (strict decode)`);return n}function U(e,t,r){O(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<x[2])throw new Error(`${d} integer encoded in more bytes than necessary (strict decode)`);return n}function v(e,t,r){O(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],o=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],s=(BigInt(n)<<BigInt(32))+BigInt(o);if(r.strict===!0&&s<x[3])throw new Error(`${d} integer encoded in more bytes than necessary (strict decode)`);if(s<=Number.MAX_SAFE_INTEGER)return Number(s);if(r.allowBigInt===!0)return s;throw new Error(`${d} integers outside of the safe integer range are not supported`)}function tt(e,t,r,n){return new a(i.uint,b(e,t+1,n),2)}function rt(e,t,r,n){return new a(i.uint,E(e,t+1,n),3)}function nt(e,t,r,n){return new a(i.uint,U(e,t+1,n),5)}function ot(e,t,r,n){return new a(i.uint,v(e,t+1,n),9)}function T(e,t){return y(e,0,t.value)}function y(e,t,r){if(r<x[0]){let n=Number(r);e.push([t|n])}else if(r<x[1]){let n=Number(r);e.push([t|24,n])}else if(r<x[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<x[3]){let n=Number(r);e.push([t|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<x[4]){let o=[t|27,0,0,0,0,0,0,0],s=Number(n&BigInt(4294967295)),u=Number(n>>BigInt(32)&BigInt(4294967295));o[8]=s&255,s=s>>8,o[7]=s&255,s=s>>8,o[6]=s&255,s=s>>8,o[5]=s&255,o[4]=u&255,u=u>>8,o[3]=u&255,u=u>>8,o[2]=u&255,u=u>>8,o[1]=u&255,e.push(o)}else throw new Error(`${d} encountered BigInt larger than allowable range`)}}T.encodedSize=function(t){return y.encodedSize(t.value)};y.encodedSize=function(t){return t<x[0]?1:t<x[1]?2:t<x[2]?3:t<x[3]?5:9};T.compareTokens=function(t,r){return t.value<r.value?-1:t.value>r.value?1:0};function it(e,t,r,n){return new a(i.negint,-1-b(e,t+1,n),2)}function st(e,t,r,n){return new a(i.negint,-1-E(e,t+1,n),3)}function ct(e,t,r,n){return new a(i.negint,-1-U(e,t+1,n),5)}var Be=BigInt(-1),at=BigInt(1);function ut(e,t,r,n){let o=v(e,t+1,n);if(typeof o!="bigint"){let s=-1-o;if(s>=Number.MIN_SAFE_INTEGER)return new a(i.negint,s,9)}if(n.allowBigInt!==!0)throw new Error(`${d} integers outside of the safe integer range are not supported`);return new a(i.negint,Be-BigInt(o),9)}function me(e,t){let r=t.value,n=typeof r=="bigint"?r*Be-at:r*-1-1;y(e,t.type.majorEncoded,n)}me.encodedSize=function(t){let r=t.value,n=typeof r=="bigint"?r*Be-at:r*-1-1;return n<x[0]?1:n<x[1]?2:n<x[2]?3:n<x[3]?5:9};me.compareTokens=function(t,r){return t.value<r.value?1:t.value>r.value?-1:0};function ne(e,t,r,n){O(e,t,r+n);let o=K(e,t+r,t+r+n);return new a(i.bytes,o,r+n)}function ft(e,t,r,n){return ne(e,t,1,r)}function dt(e,t,r,n){return ne(e,t,2,b(e,t+1,n))}function lt(e,t,r,n){return ne(e,t,3,E(e,t+1,n))}function pt(e,t,r,n){return ne(e,t,5,U(e,t+1,n))}function ht(e,t,r,n){let o=v(e,t+1,n);if(typeof o=="bigint")throw new Error(`${d} 64-bit integer bytes lengths not supported`);return ne(e,t,9,o)}function xe(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===i.string?We(e.value):e.value),e.encodedBytes}function H(e,t){let r=xe(t);y(e,t.type.majorEncoded,r.length),e.push(r)}H.encodedSize=function(t){let r=xe(t);return y.encodedSize(r.length)+r.length};H.compareTokens=function(t,r){return Mr(xe(t),xe(r))};function Mr(e,t){return e.length<t.length?-1:e.length>t.length?1:et(e,t)}function oe(e,t,r,n,o){let s=r+n;O(e,t,s);let u=new a(i.string,Qe(e,t+r,t+s),s);return o.retainStringBytes===!0&&(u.byteValue=K(e,t+r,t+s)),u}function mt(e,t,r,n){return oe(e,t,1,r,n)}function xt(e,t,r,n){return oe(e,t,2,b(e,t+1,n),n)}function yt(e,t,r,n){return oe(e,t,3,E(e,t+1,n),n)}function gt(e,t,r,n){return oe(e,t,5,U(e,t+1,n),n)}function wt(e,t,r,n){let o=v(e,t+1,n);if(typeof o=="bigint")throw new Error(`${d} 64-bit integer string lengths not supported`);return oe(e,t,9,o,n)}var bt=H;function X(e,t,r,n){return new a(i.array,n,r)}function Et(e,t,r,n){return X(e,t,1,r)}function Ut(e,t,r,n){return X(e,t,2,b(e,t+1,n))}function vt(e,t,r,n){return X(e,t,3,E(e,t+1,n))}function At(e,t,r,n){return X(e,t,5,U(e,t+1,n))}function Tt(e,t,r,n){let o=v(e,t+1,n);if(typeof o=="bigint")throw new Error(`${d} 64-bit integer array lengths not supported`);return X(e,t,9,o)}function St(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${d} indefinite length items not allowed`);return X(e,t,1,1/0)}function ye(e,t){y(e,i.array.majorEncoded,t.value)}ye.compareTokens=T.compareTokens;ye.encodedSize=function(t){return y.encodedSize(t.value)};function Q(e,t,r,n){return new a(i.map,n,r)}function kt(e,t,r,n){return Q(e,t,1,r)}function Bt(e,t,r,n){return Q(e,t,2,b(e,t+1,n))}function It(e,t,r,n){return Q(e,t,3,E(e,t+1,n))}function Ct(e,t,r,n){return Q(e,t,5,U(e,t+1,n))}function _t(e,t,r,n){let o=v(e,t+1,n);if(typeof o=="bigint")throw new Error(`${d} 64-bit integer map lengths not supported`);return Q(e,t,9,o)}function Nt(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${d} indefinite length items not allowed`);return Q(e,t,1,1/0)}function ge(e,t){y(e,i.map.majorEncoded,t.value)}ge.compareTokens=T.compareTokens;ge.encodedSize=function(t){return y.encodedSize(t.value)};function $t(e,t,r,n){return new a(i.tag,r,1)}function Mt(e,t,r,n){return new a(i.tag,b(e,t+1,n),2)}function Dt(e,t,r,n){return new a(i.tag,E(e,t+1,n),3)}function zt(e,t,r,n){return new a(i.tag,U(e,t+1,n),5)}function Ot(e,t,r,n){return new a(i.tag,v(e,t+1,n),9)}function we(e,t){y(e,i.tag.majorEncoded,t.value)}we.compareTokens=T.compareTokens;we.encodedSize=function(t){return y.encodedSize(t.value)};var Lr=20,Rr=21,Pr=22,jr=23;function Ft(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${d} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new a(i.null,null,1):new a(i.undefined,void 0,1)}function Vt(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${d} indefinite length items not allowed`);return new a(i.break,void 0,1)}function Ie(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${d} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${d} Infinity values are not supported`)}return new a(i.float,e,t)}function Lt(e,t,r,n){return Ie(Ce(e,t+1),3,n)}function Rt(e,t,r,n){return Ie(_e(e,t+1),5,n)}function Pt(e,t,r,n){return Ie(Jt(e,t+1),9,n)}function be(e,t,r){let n=t.value;if(n===!1)e.push([i.float.majorEncoded|Lr]);else if(n===!0)e.push([i.float.majorEncoded|Rr]);else if(n===null)e.push([i.float.majorEncoded|Pr]);else if(n===void 0)e.push([i.float.majorEncoded|jr]);else{let o,s=!1;(!r||r.float64!==!0)&&(qt(n),o=Ce(I,1),n===o||Number.isNaN(n)?(I[0]=249,e.push(I.slice(0,3)),s=!0):(Gt(n),o=_e(I,1),n===o&&(I[0]=250,e.push(I.slice(0,5)),s=!0))),s||(qr(n),o=Jt(I,1),I[0]=251,e.push(I.slice(0,9)))}}be.encodedSize=function(t,r){let n=t.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){qt(n);let o=Ce(I,1);if(n===o||Number.isNaN(n))return 3;if(Gt(n),o=_e(I,1),n===o)return 5}return 9};var jt=new ArrayBuffer(9),S=new DataView(jt,1),I=new Uint8Array(jt,0);function qt(e){if(e===1/0)S.setUint16(0,31744,!1);else if(e===-1/0)S.setUint16(0,64512,!1);else if(Number.isNaN(e))S.setUint16(0,32256,!1);else{S.setFloat32(0,e);let t=S.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)S.setUint16(0,31744,!1);else if(r===0)S.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let o=r-127;o<-24?S.setUint16(0,0):o<-14?S.setUint16(0,(t&2147483648)>>16|1<<24+o,!1):S.setUint16(0,(t&2147483648)>>16|o+15<<10|n>>13,!1)}}}function Ce(e,t){if(e.length-t<2)throw new Error(`${d} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,o=r&1023,s;return n===0?s=o*2**-24:n!==31?s=(o+1024)*2**(n-25):s=o===0?1/0:NaN,r&32768?-s:s}function Gt(e){S.setFloat32(0,e,!1)}function _e(e,t){if(e.length-t<4)throw new Error(`${d} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function qr(e){S.setFloat64(0,e,!1)}function Jt(e,t){if(e.length-t<8)throw new Error(`${d} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}be.compareTokens=T.compareTokens;function l(e,t,r){throw new Error(`${d} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Ee(e){return()=>{throw new Error(`${d} ${e}`)}}var c=[];for(let e=0;e<=23;e++)c[e]=l;c[24]=tt;c[25]=rt;c[26]=nt;c[27]=ot;c[28]=l;c[29]=l;c[30]=l;c[31]=l;for(let e=32;e<=55;e++)c[e]=l;c[56]=it;c[57]=st;c[58]=ct;c[59]=ut;c[60]=l;c[61]=l;c[62]=l;c[63]=l;for(let e=64;e<=87;e++)c[e]=ft;c[88]=dt;c[89]=lt;c[90]=pt;c[91]=ht;c[92]=l;c[93]=l;c[94]=l;c[95]=Ee("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)c[e]=mt;c[120]=xt;c[121]=yt;c[122]=gt;c[123]=wt;c[124]=l;c[125]=l;c[126]=l;c[127]=Ee("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)c[e]=Et;c[152]=Ut;c[153]=vt;c[154]=At;c[155]=Tt;c[156]=l;c[157]=l;c[158]=l;c[159]=St;for(let e=160;e<=183;e++)c[e]=kt;c[184]=Bt;c[185]=It;c[186]=Ct;c[187]=_t;c[188]=l;c[189]=l;c[190]=l;c[191]=Nt;for(let e=192;e<=215;e++)c[e]=$t;c[216]=Mt;c[217]=Dt;c[218]=zt;c[219]=Ot;c[220]=l;c[221]=l;c[222]=l;c[223]=l;for(let e=224;e<=243;e++)c[e]=Ee("simple values are not supported");c[244]=l;c[245]=l;c[246]=l;c[247]=Ft;c[248]=Ee("simple values are not supported");c[249]=Lt;c[250]=Rt;c[251]=Pt;c[252]=l;c[253]=l;c[254]=l;c[255]=Vt;var C=[];for(let e=0;e<24;e++)C[e]=new a(i.uint,e,1);for(let e=-1;e>=-24;e--)C[31-e]=new a(i.negint,e,1);C[64]=new a(i.bytes,new Uint8Array(0),1);C[96]=new a(i.string,"",1);C[128]=new a(i.array,0,1);C[160]=new a(i.map,0,1);C[244]=new a(i.false,!1,1);C[245]=new a(i.true,!0,1);C[246]=new a(i.null,null,1);function Kt(e){switch(e.type){case i.false:return M([244]);case i.true:return M([245]);case i.null:return M([246]);case i.bytes:return e.value.length?void 0:M([64]);case i.string:return e.value===""?M([96]):void 0;case i.array:return e.value===0?M([128]):void 0;case i.map:return e.value===0?M([160]):void 0;case i.uint:return e.value<24?M([Number(e.value)]):void 0;case i.negint:if(e.value>=-24)return M([31-Number(e.value)])}}var Jr={float64:!1,mapSorter:Xr,quickEncodeToken:Kt};function Kr(){let e=[];return e[i.uint.major]=T,e[i.negint.major]=me,e[i.bytes.major]=H,e[i.string.major]=bt,e[i.array.major]=ye,e[i.map.major]=ge,e[i.tag.major]=we,e[i.float.major]=be,e}var Ht=Kr(),Ne=new te,ve=class e{constructor(t,r){this.obj=t,this.parent=r}includes(t){let r=this;do if(r.obj===t)return!0;while(r=r.parent);return!1}static createCheck(t,r){if(t&&t.includes(r))throw new Error(`${ke} object contains circular references`);return new e(r,t)}},L={null:new a(i.null,null),undefined:new a(i.undefined,void 0),true:new a(i.true,!0),false:new a(i.false,!1),emptyArray:new a(i.array,0),emptyMap:new a(i.map,0)},R={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new a(i.float,e):e>=0?new a(i.uint,e):new a(i.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new a(i.uint,e):new a(i.negint,e)},Uint8Array(e,t,r,n){return new a(i.bytes,e)},string(e,t,r,n){return new a(i.string,e)},boolean(e,t,r,n){return e?L.true:L.false},null(e,t,r,n){return L.null},undefined(e,t,r,n){return L.undefined},ArrayBuffer(e,t,r,n){return new a(i.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new a(i.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[L.emptyArray,new a(i.break)]:L.emptyArray;n=ve.createCheck(n,e);let o=[],s=0;for(let u of e)o[s++]=Ue(u,r,n);return r.addBreakTokens?[new a(i.array,e.length),o,new a(i.break)]:[new a(i.array,e.length),o]},Object(e,t,r,n){let o=t!=="Object",s=o?e.keys():Object.keys(e),u=o?e.size:s.length;if(!u)return r.addBreakTokens===!0?[L.emptyMap,new a(i.break)]:L.emptyMap;n=ve.createCheck(n,e);let f=[],p=0;for(let g of s)f[p++]=[Ue(g,r,n),Ue(o?e.get(g):e[g],r,n)];return Hr(f,r),r.addBreakTokens?[new a(i.map,u),f,new a(i.break)]:[new a(i.map,u),f]}};R.Map=R.Object;R.Buffer=R.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))R[`${e}Array`]=R.DataView;function Ue(e,t={},r){let n=Je(e),o=t&&t.typeEncoders&&t.typeEncoders[n]||R[n];if(typeof o=="function"){let u=o(e,n,t,r);if(u!=null)return u}let s=R[n];if(!s)throw new Error(`${ke} unsupported type: ${n}`);return s(e,n,t,r)}function Hr(e,t){t.mapSorter&&e.sort(t.mapSorter)}function Xr(e,t){let r=Array.isArray(e[0])?e[0][0]:e[0],n=Array.isArray(t[0])?t[0][0]:t[0];if(r.type!==n.type)return r.type.compare(n.type);let o=r.type.major,s=Ht[o].compareTokens(r,n);return s===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),s}function Xt(e,t,r,n){if(Array.isArray(t))for(let o of t)Xt(e,o,r,n);else r[t.type.major](e,t,n)}function Qr(e,t,r){let n=Ue(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){let o=r.quickEncodeToken(n);if(o)return o;let s=t[n.type.major];if(s.encodedSize){let u=s.encodedSize(n,r),f=new te(u);if(s(f,n,r),f.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return Se(f.chunks[0])}}return Ne.reset(),Xt(Ne,n,t,r),Ne.toBytes(!0)}function $e(e,t){return t=Object.assign({},Jr,t),Qr(e,Ht,t)}var Wr={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Me=class{constructor(t,r={}){this._pos=0,this.data=t,this.options=r}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let t=this.data[this._pos],r=C[t];if(r===void 0){let n=c[t];if(!n)throw new Error(`${d} no decoder for major type ${t>>>5} (byte 0x${t.toString(16).padStart(2,"0")})`);let o=t&31;r=n(this.data,this._pos,o,this.options)}return this._pos+=r.encodedLength,r}},ie=Symbol.for("DONE"),Ae=Symbol.for("BREAK");function Zr(e,t,r){let n=[];for(let o=0;o<e.value;o++){let s=se(t,r);if(s===Ae){if(e.value===1/0)break;throw new Error(`${d} got unexpected break to lengthed array`)}if(s===ie)throw new Error(`${d} found array but not enough entries (got ${o}, expected ${e.value})`);n[o]=s}return n}function Yr(e,t,r){let n=r.useMaps===!0,o=n?void 0:{},s=n?new Map:void 0;for(let u=0;u<e.value;u++){let f=se(t,r);if(f===Ae){if(e.value===1/0)break;throw new Error(`${d} got unexpected break to lengthed map`)}if(f===ie)throw new Error(`${d} found map but not enough entries (got ${u} [no key], expected ${e.value})`);if(n!==!0&&typeof f!="string")throw new Error(`${d} non-string keys not supported (got ${typeof f})`);if(r.rejectDuplicateMapKeys===!0&&(n&&s.has(f)||!n&&f in o))throw new Error(`${d} found repeat map key "${f}"`);let p=se(t,r);if(p===ie)throw new Error(`${d} found map but not enough entries (got ${u} [no value], expected ${e.value})`);n?s.set(f,p):o[f]=p}return n?s:o}function se(e,t){if(e.done())return ie;let r=e.next();if(r.type===i.break)return Ae;if(r.type.terminal)return r.value;if(r.type===i.array)return Zr(r,e,t);if(r.type===i.map)return Yr(r,e,t);if(r.type===i.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=se(e,t);return t.tags[r.value](n)}throw new Error(`${d} tag not supported (${r.value})`)}throw new Error("unsupported")}function Qt(e,t){if(!(e instanceof Uint8Array))throw new Error(`${d} data to decode must be a Uint8Array`);t=Object.assign({},Wr,t);let r=t.tokenizer||new Me(e,t),n=se(r,t);if(n===ie)throw new Error(`${d} did not find any content to decode`);if(n===Ae)throw new Error(`${d} got unexpected break`);return[n,e.subarray(r.pos())]}function De(e,t){let[r,n]=Qt(e,t);if(n.length>0)throw new Error(`${d} too many terminals, data makes no sense`);return r}var Oo=new Uint8Array(0);function Wt(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function W(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function tn(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<e.length;o++){var s=e.charAt(o),u=s.charCodeAt(0);if(r[u]!==255)throw new TypeError(s+" is ambiguous");r[u]=o}var f=e.length,p=e.charAt(0),g=Math.log(f)/Math.log(256),h=Math.log(256)/Math.log(f);function G(m){if(m instanceof Uint8Array||(ArrayBuffer.isView(m)?m=new Uint8Array(m.buffer,m.byteOffset,m.byteLength):Array.isArray(m)&&(m=Uint8Array.from(m))),!(m instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(m.length===0)return"";for(var w=0,P=0,k=0,_=m.length;k!==_&&m[k]===0;)k++,w++;for(var N=(_-k)*h+1>>>0,A=new Uint8Array(N);k!==_;){for(var $=m[k],V=0,B=N-1;($!==0||V<P)&&B!==-1;B--,V++)$+=256*A[B]>>>0,A[B]=$%f>>>0,$=$/f>>>0;if($!==0)throw new Error("Non-zero carry");P=V,k++}for(var z=N-P;z!==N&&A[z]===0;)z++;for(var pe=p.repeat(w);z<N;++z)pe+=e.charAt(A[z]);return pe}function le(m){if(typeof m!="string")throw new TypeError("Expected String");if(m.length===0)return new Uint8Array;var w=0;if(m[w]!==" "){for(var P=0,k=0;m[w]===p;)P++,w++;for(var _=(m.length-w)*g+1>>>0,N=new Uint8Array(_);m[w];){var A=r[m.charCodeAt(w)];if(A===255)return;for(var $=0,V=_-1;(A!==0||$<k)&&V!==-1;V--,$++)A+=f*N[V]>>>0,N[V]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");k=$,w++}if(m[w]!==" "){for(var B=_-k;B!==_&&N[B]===0;)B++;for(var z=new Uint8Array(P+(_-B)),pe=P;B!==_;)z[pe++]=N[B++];return z}}}function gr(m){var w=le(m);if(w)return w;throw new Error(`Non-${t} character`)}return{encode:G,decodeUnsafe:le,decode:gr}}var rn=tn,nn=rn,Zt=nn;var ze=class{name;prefix;baseEncode;constructor(t,r,n){this.name=t,this.prefix=r,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},Oe=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,r,n){if(this.name=t,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.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 Yt(this,t)}},Fe=class{decoders;constructor(t){this.decoders=t}or(t){return Yt(this,t)}decode(t){let r=t[0],n=this.decoders[r];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 Yt(e,t){return new Fe({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Ve=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,r,n,o){this.name=t,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new ze(t,r,n),this.decoder=new Oe(t,r,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function er({name:e,prefix:t,encode:r,decode:n}){return new Ve(e,t,r,n)}function Le({name:e,prefix:t,alphabet:r}){let{encode:n,decode:o}=Zt(r,e);return er({prefix:t,name:e,encode:n,decode:s=>W(o(s))})}function on(e,t,r,n){let o={};for(let h=0;h<t.length;++h)o[t[h]]=h;let s=e.length;for(;e[s-1]==="=";)--s;let u=new Uint8Array(s*r/8|0),f=0,p=0,g=0;for(let h=0;h<s;++h){let G=o[e[h]];if(G===void 0)throw new SyntaxError(`Non-${n} character`);p=p<<r|G,f+=r,f>=8&&(f-=8,u[g++]=255&p>>f)}if(f>=r||255&p<<8-f)throw new SyntaxError("Unexpected end of data");return u}function sn(e,t,r){let n=t[t.length-1]==="=",o=(1<<r)-1,s="",u=0,f=0;for(let p=0;p<e.length;++p)for(f=f<<8|e[p],u+=8;u>r;)u-=r,s+=t[o&f>>u];if(u!==0&&(s+=t[o&f<<r-u]),n)for(;s.length*r&7;)s+="=";return s}function D({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return er({prefix:t,name:e,encode(o){return sn(o,n,r)},decode(o){return on(o,n,r,e)}})}var ce=D({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),qo=D({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Go=D({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Jo=D({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ko=D({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ho=D({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Xo=D({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Qo=D({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Wo=D({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var F=Le({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ei=Le({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var cn=nr,tr=128,an=127,un=~an,fn=Math.pow(2,31);function nr(e,t,r){t=t||[],r=r||0;for(var n=r;e>=fn;)t[r++]=e&255|tr,e/=128;for(;e&un;)t[r++]=e&255|tr,e>>>=7;return t[r]=e|0,nr.bytes=r-n+1,t}var dn=Re,ln=128,rr=127;function Re(e,n){var r=0,n=n||0,o=0,s=n,u,f=e.length;do{if(s>=f)throw Re.bytes=0,new RangeError("Could not decode varint");u=e[s++],r+=o<28?(u&rr)<<o:(u&rr)*Math.pow(2,o),o+=7}while(u>=ln);return Re.bytes=s-n,r}var pn=Math.pow(2,7),hn=Math.pow(2,14),mn=Math.pow(2,21),xn=Math.pow(2,28),yn=Math.pow(2,35),gn=Math.pow(2,42),wn=Math.pow(2,49),bn=Math.pow(2,56),En=Math.pow(2,63),Un=function(e){return e<pn?1:e<hn?2:e<mn?3:e<xn?4:e<yn?5:e<gn?6:e<wn?7:e<bn?8:e<En?9:10},vn={encode:cn,decode:dn,encodingLength:Un},An=vn,ae=An;function ue(e,t=0){return[ae.decode(e,t),ae.decode.bytes]}function Z(e,t,r=0){return ae.encode(e,t,r),t}function Y(e){return ae.encodingLength(e)}function fe(e,t){let r=t.byteLength,n=Y(e),o=n+Y(r),s=new Uint8Array(o+r);return Z(e,s,0),Z(r,s,n),s.set(t,o),new ee(e,r,t,s)}function ir(e){let t=W(e),[r,n]=ue(t),[o,s]=ue(t.subarray(n)),u=t.subarray(n+s);if(u.byteLength!==o)throw new Error("Incorrect length");return new ee(r,o,u,t)}function sr(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Wt(e.bytes,r.bytes)}}var ee=class{code;size;digest;bytes;constructor(t,r,n,o){this.code=t,this.size=r,this.digest=n,this.bytes=o}};function ar(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return Sn(r,Pe(e),t??F.encoder);default:return kn(r,Pe(e),t??ce.encoder)}}var ur=new WeakMap;function Pe(e){let t=ur.get(e);if(t==null){let r=new Map;return ur.set(e,r),r}return t}var q=class e{code;version;multihash;bytes;"/";constructor(t,r,n,o){this.code=r,this.version=t,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==de)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Bn)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return e.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=fe(t,r);return e.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 e.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&sr(t.multihash,n.multihash)}toString(t){return ar(this,t)}toJSON(){return{"/":ar(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 r=t;if(r instanceof e)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:s,bytes:u}=r;return new e(n,o,s,u??fr(n,o,s.bytes))}else if(r[In]===!0){let{version:n,multihash:o,code:s}=r,u=ir(o);return e.create(n,s,u)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==de)throw new Error(`Version 0 CID must use dag-pb (code: ${de}) block encoding`);return new e(t,r,n,n.bytes)}case 1:{let o=fr(t,r,n.bytes);return new e(t,r,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return e.create(0,de,t)}static createV1(t,r){return e.create(1,t,r)}static decode(t){let[r,n]=e.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=e.inspectBytes(t),n=r.size-r.multihashSize,o=W(t.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=o.subarray(r.multihashSize-r.digestSize),u=new ee(r.multihashCode,r.digestSize,s,o);return[r.version===0?e.createV0(u):e.createV1(r.codec,u),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[G,le]=ue(t.subarray(r));return r+=le,G},o=n(),s=de;if(o===18?(o=0,r=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let u=r,f=n(),p=n(),g=r+p,h=g-u;return{version:o,codec:s,multihashCode:f,digestSize:p,multihashSize:h,size:g}}static parse(t,r){let[n,o]=Tn(t,r),s=e.decode(o);if(s.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Pe(s).set(n,t),s}};function Tn(e,t){switch(e[0]){case"Q":{let r=t??F;return[F.prefix,r.decode(`${F.prefix}${e}`)]}case F.prefix:{let r=t??F;return[F.prefix,r.decode(e)]}case ce.prefix:{let r=t??ce;return[ce.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function Sn(e,t,r){let{prefix:n}=r;if(n!==F.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=t.get(n);if(o==null){let s=r.encode(e).slice(1);return t.set(n,s),s}else return o}function kn(e,t,r){let{prefix:n}=r,o=t.get(n);if(o==null){let s=r.encode(e);return t.set(n,s),s}else return o}var de=112,Bn=18;function fr(e,t,r){let n=Y(e),o=n+Y(t),s=new Uint8Array(o+r.byteLength);return Z(e,s,0),Z(t,s,n),s.set(r,o),s}var In=Symbol.for("@ipld/js-cid/CID");var dr=42;function Cn(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=q.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new a(i.tag,dr),new a(i.bytes,r)]}function _n(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function Nn(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}var $n={float64:!0,typeEncoders:{Object:Cn,undefined:_n,number:Nn}};function Mn(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return q.decode(e.subarray(1))}var lr={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};lr.tags[dr]=Mn;var pr=113,hr=e=>$e(e,$n),mr=e=>De(e,lr);function qe({name:e,code:t,encode:r}){return new je(e,t,r)}var je=class{name;code;encode;constructor(t,r,n){this.name=t,this.code=r,this.encode=n}digest(t){if(t instanceof Uint8Array){let r=this.encode(t);return r instanceof Uint8Array?fe(this.code,r):r.then(n=>fe(this.code,n))}else throw Error("Unknown type, must be binary type")}};function xr(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var yr=qe({name:"sha2-256",code:18,encode:xr("SHA-256")}),pi=qe({name:"sha2-512",code:19,encode:xr("SHA-512")});var Ge=class{components;constructor(t){this.components=t}async add(t,r={}){let n=hr(t),o=await(r.hasher??yr).digest(n),s=q.createV1(pr,o);return await this.components.blockstore.put(s,n,r),s}async get(t,r={}){let n=await this.components.blockstore.get(t,r);return mr(n)}};function zn(e){return new Ge(e)}return Ar(On);})();
3
3
  return HeliaDagCbor}));
@@ -58,7 +58,7 @@ export interface DAGCBOR {
58
58
  * // CID(bafyreidykglsfhoixmivffc5uwhcgshx4j465xwqntbmu43nb2dzqwfvae)
59
59
  * ```
60
60
  */
61
- add: (str: unknown, options?: Partial<AddOptions>) => Promise<CID>;
61
+ add(str: unknown, options?: Partial<AddOptions>): Promise<CID>;
62
62
  /**
63
63
  * Get an object from your Helia node, either previously added to it or to
64
64
  * another node on the network.
@@ -77,7 +77,7 @@ export interface DAGCBOR {
77
77
  * // { hello: 'world' }
78
78
  * ```
79
79
  */
80
- get: <T>(cid: CID, options?: Partial<GetOptions>) => Promise<T>;
80
+ get<T>(cid: CID, options?: Partial<GetOptions>): Promise<T>;
81
81
  }
82
82
  /**
83
83
  * Create a {@link DAGCBOR} instance for use with {@link https://github.com/ipfs/helia Helia}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAEtC,OAAO,KAAK,EAAE,MAAM,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AACrG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,UAAW,SAAQ,YAAY,EAAE,eAAe,CAAC,sBAAsB,CAAC;IACvF,MAAM,EAAE,eAAe,CAAA;CACxB;AAED,MAAM,WAAW,UAAW,SAAQ,YAAY,EAAE,eAAe,CAAC,sBAAsB,CAAC;IACvF,KAAK,EAAE,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;CAChC;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB;;;;;;;;;;;;;;;OAeG;IACH,GAAG,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IAElE;;;;;;;;;;;;;;;;;OAiBG;IACH,GAAG,EAAE,CAAC,CAAC,EAAG,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;CACjE;AA0BD;;GAEG;AACH,wBAAgB,OAAO,CAAE,KAAK,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAE/D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAEtC,OAAO,KAAK,EAAE,MAAM,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AACrG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,UAAW,SAAQ,YAAY,EAAE,eAAe,CAAC,sBAAsB,CAAC;IACvF,MAAM,EAAE,eAAe,CAAA;CACxB;AAED,MAAM,WAAW,UAAW,SAAQ,YAAY,EAAE,eAAe,CAAC,sBAAsB,CAAC;IACvF,KAAK,EAAE,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;CAChC;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB;;;;;;;;;;;;;;;OAeG;IACH,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;IAE9D;;;;;;;;;;;;;;;;;OAiBG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;CAC5D;AA0BD;;GAEG;AACH,wBAAgB,OAAO,CAAE,KAAK,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAE/D"}
@@ -1,7 +1,12 @@
1
1
  {
2
2
  "AddOptions": "https://ipfs.github.io/helia-dag-cbor/interfaces/AddOptions.html",
3
+ ".:AddOptions": "https://ipfs.github.io/helia-dag-cbor/interfaces/AddOptions.html",
3
4
  "DAGCBOR": "https://ipfs.github.io/helia-dag-cbor/interfaces/DAGCBOR.html",
5
+ ".:DAGCBOR": "https://ipfs.github.io/helia-dag-cbor/interfaces/DAGCBOR.html",
4
6
  "DAGCBORComponents": "https://ipfs.github.io/helia-dag-cbor/interfaces/DAGCBORComponents.html",
7
+ ".:DAGCBORComponents": "https://ipfs.github.io/helia-dag-cbor/interfaces/DAGCBORComponents.html",
5
8
  "GetOptions": "https://ipfs.github.io/helia-dag-cbor/interfaces/GetOptions.html",
6
- "dagCbor": "https://ipfs.github.io/helia-dag-cbor/functions/dagCbor-1.html"
9
+ ".:GetOptions": "https://ipfs.github.io/helia-dag-cbor/interfaces/GetOptions.html",
10
+ "dagCbor": "https://ipfs.github.io/helia-dag-cbor/functions/dagCbor-1.html",
11
+ ".:dagCbor": "https://ipfs.github.io/helia-dag-cbor/functions/dagCbor-1.html"
7
12
  }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@helia/dag-cbor",
3
- "version": "1.0.2",
3
+ "version": "2.0.0",
4
4
  "description": "Add/get IPLD blocks containing dag-cbor with your Helia node",
5
5
  "license": "Apache-2.0 OR MIT",
6
- "homepage": "https://github.com/ipfs/helia-dag-cbor/tree/master/packages/dag-cbor#readme",
6
+ "homepage": "https://github.com/ipfs/helia-dag-cbor/tree/main/packages/dag-cbor#readme",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/ipfs/helia-dag-cbor.git"
@@ -11,6 +11,10 @@
11
11
  "bugs": {
12
12
  "url": "https://github.com/ipfs/helia-dag-cbor/issues"
13
13
  },
14
+ "publishConfig": {
15
+ "access": "public",
16
+ "provenance": true
17
+ },
14
18
  "keywords": [
15
19
  "IPFS"
16
20
  ],
@@ -31,6 +35,7 @@
31
35
  "eslintConfig": {
32
36
  "extends": "ipfs",
33
37
  "parserOptions": {
38
+ "project": true,
34
39
  "sourceType": "module"
35
40
  }
36
41
  },
@@ -135,15 +140,15 @@
135
140
  "release": "aegir release"
136
141
  },
137
142
  "dependencies": {
138
- "@helia/interface": "^2.0.0",
143
+ "@helia/interface": "^3.0.0",
139
144
  "@ipld/dag-cbor": "^9.0.0",
140
145
  "@libp2p/interfaces": "^3.3.1",
141
- "interface-blockstore": "^5.0.0",
142
- "multiformats": "^12.0.1",
146
+ "multiformats": "^13.0.0",
143
147
  "progress-events": "^1.0.0"
144
148
  },
145
149
  "devDependencies": {
146
- "aegir": "^40.0.11",
147
- "blockstore-core": "^4.0.1"
150
+ "aegir": "^42.0.1",
151
+ "blockstore-core": "^4.0.1",
152
+ "interface-blockstore": "^5.0.0"
148
153
  }
149
154
  }
package/src/index.ts CHANGED
@@ -65,7 +65,7 @@ export interface DAGCBOR {
65
65
  * // CID(bafyreidykglsfhoixmivffc5uwhcgshx4j465xwqntbmu43nb2dzqwfvae)
66
66
  * ```
67
67
  */
68
- add: (str: unknown, options?: Partial<AddOptions>) => Promise<CID>
68
+ add(str: unknown, options?: Partial<AddOptions>): Promise<CID>
69
69
 
70
70
  /**
71
71
  * Get an object from your Helia node, either previously added to it or to
@@ -85,7 +85,7 @@ export interface DAGCBOR {
85
85
  * // { hello: 'world' }
86
86
  * ```
87
87
  */
88
- get: <T> (cid: CID, options?: Partial<GetOptions>) => Promise<T>
88
+ get<T>(cid: CID, options?: Partial<GetOptions>): Promise<T>
89
89
  }
90
90
 
91
91
  class DefaultDAGCBOR implements DAGCBOR {