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

ipfs-unixfs

Package Overview
Dependencies
Maintainers
4
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipfs-unixfs - npm Package Compare versions

Comparing version 11.1.2 to 11.1.3

dist/typedoc-urls.json

2

dist/index.min.js
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.IpfsUnixfs = factory()}(typeof self !== 'undefined' ? self : this, function () {
"use strict";var IpfsUnixfs=(()=>{var Fe=Object.create;var et=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var ve=Object.getOwnPropertyNames;var Ce=Object.getPrototypeOf,Me=Object.prototype.hasOwnProperty;var Ue=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),p=(r,t)=>{for(var e in t)et(r,e,{get:t[e],enumerable:!0})},qt=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ve(t))!Me.call(r,n)&&n!==e&&et(r,n,{get:()=>t[n],enumerable:!(i=ze(t,n))||i.enumerable});return r};var Le=(r,t,e)=>(e=r!=null?Fe(Ce(r)):{},qt(t||!r||!r.__esModule?et(e,"default",{value:r,enumerable:!0}):e,r)),Re=r=>qt(et({},"__esModule",{value:!0}),r);var Xt=Ue((on,Jt)=>{"use strict";function Ht(r,t){for(let e in t)Object.defineProperty(r,e,{value:t[e],enumerable:!0,configurable:!0});return r}function Oe(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 Ht(r,e)}catch{e.message=r.message,e.stack=r.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(r)),Ht(new n,e)}}Jt.exports=Oe});var rn={};p(rn,{UnixFS:()=>Gt});var _t=Le(Xt(),1);var ct=new Float32Array([-0]),T=new Uint8Array(ct.buffer);function Wt(r,t,e){ct[0]=r,t[e]=T[0],t[e+1]=T[1],t[e+2]=T[2],t[e+3]=T[3]}function Qt(r,t){return T[0]=r[t],T[1]=r[t+1],T[2]=r[t+2],T[3]=r[t+3],ct[0]}var ht=new Float64Array([-0]),l=new Uint8Array(ht.buffer);function Kt(r,t,e){ht[0]=r,t[e]=l[0],t[e+1]=l[1],t[e+2]=l[2],t[e+3]=l[3],t[e+4]=l[4],t[e+5]=l[5],t[e+6]=l[6],t[e+7]=l[7]}function Zt(r,t){return l[0]=r[t],l[1]=r[t+1],l[2]=r[t+2],l[3]=r[t+3],l[4]=r[t+4],l[5]=r[t+5],l[6]=r[t+6],l[7]=r[t+7],ht[0]}var Ve=BigInt(Number.MAX_SAFE_INTEGER),Pe=BigInt(Number.MIN_SAFE_INTEGER),d=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,i=~this.hi>>>0;return e===0&&(i=i+1>>>0),-(e+i*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,i=~this.hi>>>0;return e===0&&(i=i+1>>>0),-(BigInt(e)+(BigInt(i)<<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,i=this.hi>>>24;return i===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:i<128?9:10}static fromBigInt(t){if(t===0n)return z;if(t<Ve&&t>Pe)return this.fromNumber(Number(t));let e=t<0n;e&&(t=-t);let i=t>>32n,n=t-(i<<32n);return e&&(i=~i|0n,n=~n|0n,++n>jt&&(n=0n,++i>jt&&(i=0n))),new r(Number(n),Number(i))}static fromNumber(t){if(t===0)return z;let e=t<0;e&&(t=-t);let i=t>>>0,n=(t-i)/4294967296>>>0;return e&&(n=~n>>>0,i=~i>>>0,++i>4294967295&&(i=0,++n>4294967295&&(n=0))),new r(i,n)}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):z}},z=new d(0,0);z.toBigInt=function(){return 0n};z.zzEncode=z.zzDecode=function(){return this};z.length=function(){return 1};var jt=4294967296n;function Yt(r){let t=0,e=0;for(let i=0;i<r.length;++i)e=r.charCodeAt(i),e<128?t+=1:e<2048?t+=2:(e&64512)===55296&&(r.charCodeAt(i+1)&64512)===56320?(++i,t+=4):t+=3;return t}function te(r,t,e){if(e-t<1)return"";let n,o=[],s=0,a;for(;t<e;)a=r[t++],a<128?o[s++]=a:a>191&&a<224?o[s++]=(a&31)<<6|r[t++]&63:a>239&&a<365?(a=((a&7)<<18|(r[t++]&63)<<12|(r[t++]&63)<<6|r[t++]&63)-65536,o[s++]=55296+(a>>10),o[s++]=56320+(a&1023)):o[s++]=(a&15)<<12|(r[t++]&63)<<6|r[t++]&63,s>8191&&((n??(n=[])).push(String.fromCharCode.apply(String,o)),s=0);return n!=null?(s>0&&n.push(String.fromCharCode.apply(String,o.slice(0,s))),n.join("")):String.fromCharCode.apply(String,o.slice(0,s))}function ft(r,t,e){let i=e,n,o;for(let s=0;s<r.length;++s)n=r.charCodeAt(s),n<128?t[e++]=n:n<2048?(t[e++]=n>>6|192,t[e++]=n&63|128):(n&64512)===55296&&((o=r.charCodeAt(s+1))&64512)===56320?(n=65536+((n&1023)<<10)+(o&1023),++s,t[e++]=n>>18|240,t[e++]=n>>12&63|128,t[e++]=n>>6&63|128,t[e++]=n&63|128):(t[e++]=n>>12|224,t[e++]=n>>6&63|128,t[e++]=n&63|128);return e-i}function y(r,t){return RangeError(`index out of range: ${r.pos} + ${t??1} > ${r.len}`)}function rt(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}var lt=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,y(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 y(this,4);return rt(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw y(this,4);return rt(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw y(this,4);let t=Qt(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw y(this,4);let t=Zt(this.buf,this.pos);return this.pos+=8,t}bytes(){let t=this.uint32(),e=this.pos,i=this.pos+t;if(i>this.len)throw y(this,t);return this.pos+=t,e===i?new Uint8Array(0):this.buf.subarray(e,i)}string(){let t=this.bytes();return te(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw y(this,t);this.pos+=t}else do if(this.pos>=this.len)throw y(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 d(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 y(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 y(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 y(this,8);let t=rt(this.buf,this.pos+=4),e=rt(this.buf,this.pos+=4);return new d(t,e)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){return this.readLongVarint().toNumber(!0)}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 ut(r){return new lt(r instanceof Uint8Array?r:r.subarray())}function G(r,t){let e=ut(r);return t.decode(e)}function nt(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function v(r=0){return globalThis.Buffer?.allocUnsafe!=null?nt(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}var gt={};p(gt,{base10:()=>Je});function $e(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),i=0;i<e.length;i++)e[i]=255;for(var n=0;n<r.length;n++){var o=r.charAt(n),s=o.charCodeAt(0);if(e[s]!==255)throw new TypeError(o+" is ambiguous");e[s]=n}var a=r.length,f=r.charAt(0),U=Math.log(a)/Math.log(256),m=Math.log(256)/Math.log(a);function L(c){if(c instanceof Uint8Array||(ArrayBuffer.isView(c)?c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength):Array.isArray(c)&&(c=Uint8Array.from(c))),!(c instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(c.length===0)return"";for(var u=0,F=0,g=0,S=c.length;g!==S&&c[g]===0;)g++,u++;for(var E=(S-g)*m+1>>>0,b=new Uint8Array(E);g!==S;){for(var A=c[g],B=0,x=E-1;(A!==0||B<F)&&x!==-1;x--,B++)A+=256*b[x]>>>0,b[x]=A%a>>>0,A=A/a>>>0;if(A!==0)throw new Error("Non-zero carry");F=B,g++}for(var k=E-F;k!==E&&b[k]===0;)k++;for(var tt=f.repeat(u);k<E;++k)tt+=r.charAt(b[k]);return tt}function Y(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var u=0;if(c[u]!==" "){for(var F=0,g=0;c[u]===f;)F++,u++;for(var S=(c.length-u)*U+1>>>0,E=new Uint8Array(S);c[u];){var b=e[c.charCodeAt(u)];if(b===255)return;for(var A=0,B=S-1;(b!==0||A<g)&&B!==-1;B--,A++)b+=a*E[B]>>>0,E[B]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");g=A,u++}if(c[u]!==" "){for(var x=S-g;x!==S&&E[x]===0;)x++;for(var k=new Uint8Array(F+(S-x)),tt=F;x!==S;)k[tt++]=E[x++];return k}}}function Ne(c){var u=Y(c);if(u)return u;throw new Error(`Non-${t} character`)}return{encode:L,decodeUnsafe:Y,decode:Ne}}var _e=$e,Ge=_e,re=Ge;var gn=new Uint8Array(0);var ne=(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},D=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")};var ie=r=>new TextEncoder().encode(r),oe=r=>new TextDecoder().decode(r);var dt=class{constructor(t,e,i){this.name=t,this.prefix=e,this.baseEncode=i}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},pt=class{constructor(t,e,i){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=i}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 ae(this,t)}},mt=class{constructor(t){this.decoders=t}or(t){return ae(this,t)}decode(t){let e=t[0],i=this.decoders[e];if(i)return i.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},ae=(r,t)=>new mt({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),bt=class{constructor(t,e,i,n){this.name=t,this.prefix=e,this.baseEncode=i,this.baseDecode=n,this.encoder=new dt(t,e,i),this.decoder=new pt(t,e,n)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},R=({name:r,prefix:t,encode:e,decode:i})=>new bt(r,t,e,i),N=({prefix:r,name:t,alphabet:e})=>{let{encode:i,decode:n}=re(e,t);return R({prefix:r,name:t,encode:i,decode:o=>D(n(o))})},qe=(r,t,e,i)=>{let n={};for(let m=0;m<t.length;++m)n[t[m]]=m;let o=r.length;for(;r[o-1]==="=";)--o;let s=new Uint8Array(o*e/8|0),a=0,f=0,U=0;for(let m=0;m<o;++m){let L=n[r[m]];if(L===void 0)throw new SyntaxError(`Non-${i} character`);f=f<<e|L,a+=e,a>=8&&(a-=8,s[U++]=255&f>>a)}if(a>=e||255&f<<8-a)throw new SyntaxError("Unexpected end of data");return s},He=(r,t,e)=>{let i=t[t.length-1]==="=",n=(1<<e)-1,o="",s=0,a=0;for(let f=0;f<r.length;++f)for(a=a<<8|r[f],s+=8;s>e;)s-=e,o+=t[n&a>>s];if(s&&(o+=t[n&a<<e-s]),i)for(;o.length*e&7;)o+="=";return o},h=({name:r,prefix:t,bitsPerChar:e,alphabet:i})=>R({prefix:t,name:r,encode(n){return He(n,i,e)},decode(n){return qe(n,i,e,r)}});var Je=N({prefix:"9",name:"base10",alphabet:"0123456789"});var xt={};p(xt,{base16:()=>Xe,base16upper:()=>We});var Xe=h({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),We=h({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var yt={};p(yt,{base2:()=>Qe});var Qe=h({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var wt={};p(wt,{base256emoji:()=>tr});var ce=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}"),Ke=ce.reduce((r,t,e)=>(r[e]=t,r),[]),Ze=ce.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function je(r){return r.reduce((t,e)=>(t+=Ke[e],t),"")}function Ye(r){let t=[];for(let e of r){let i=Ze[e.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(i)}return new Uint8Array(t)}var tr=R({prefix:"\u{1F680}",name:"base256emoji",encode:je,decode:Ye});var St={};p(St,{base32:()=>O,base32hex:()=>ir,base32hexpad:()=>sr,base32hexpadupper:()=>ar,base32hexupper:()=>or,base32pad:()=>rr,base32padupper:()=>nr,base32upper:()=>er,base32z:()=>cr});var O=h({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),er=h({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),rr=h({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),nr=h({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ir=h({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),or=h({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),sr=h({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ar=h({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),cr=h({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Et={};p(Et,{base36:()=>hr,base36upper:()=>fr});var hr=N({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),fr=N({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var At={};p(At,{base58btc:()=>I,base58flickr:()=>lr});var I=N({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),lr=N({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var It={};p(It,{base64:()=>ur,base64pad:()=>dr,base64url:()=>pr,base64urlpad:()=>mr});var ur=h({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),dr=h({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),pr=h({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),mr=h({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var kt={};p(kt,{base8:()=>br});var br=h({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Dt={};p(Dt,{identity:()=>gr});var gr=R({prefix:"\0",name:"identity",encode:r=>oe(r),decode:r=>ie(r)});var vn=new TextEncoder,Cn=new TextDecoder;var Tt={};p(Tt,{identity:()=>Pr});var wr=le,he=128,Sr=127,Er=~Sr,Ar=Math.pow(2,31);function le(r,t,e){t=t||[],e=e||0;for(var i=e;r>=Ar;)t[e++]=r&255|he,r/=128;for(;r&Er;)t[e++]=r&255|he,r>>>=7;return t[e]=r|0,le.bytes=e-i+1,t}var Ir=Bt,kr=128,fe=127;function Bt(r,i){var e=0,i=i||0,n=0,o=i,s,a=r.length;do{if(o>=a)throw Bt.bytes=0,new RangeError("Could not decode varint");s=r[o++],e+=n<28?(s&fe)<<n:(s&fe)*Math.pow(2,n),n+=7}while(s>=kr);return Bt.bytes=o-i,e}var Dr=Math.pow(2,7),Br=Math.pow(2,14),Tr=Math.pow(2,21),Nr=Math.pow(2,28),Fr=Math.pow(2,35),zr=Math.pow(2,42),vr=Math.pow(2,49),Cr=Math.pow(2,56),Mr=Math.pow(2,63),Ur=function(r){return r<Dr?1:r<Br?2:r<Tr?3:r<Nr?4:r<Fr?5:r<zr?6:r<vr?7:r<Cr?8:r<Mr?9:10},Lr={encode:wr,decode:Ir,encodingLength:Ur},Rr=Lr,q=Rr;var H=(r,t=0)=>[q.decode(r,t),q.decode.bytes],V=(r,t,e=0)=>(q.encode(r,t,e),t),P=r=>q.encodingLength(r);var C=(r,t)=>{let e=t.byteLength,i=P(r),n=i+P(e),o=new Uint8Array(n+e);return V(r,o,0),V(e,o,i),o.set(t,n),new $(r,e,t,o)},ue=r=>{let t=D(r),[e,i]=H(t),[n,o]=H(t.subarray(i)),s=t.subarray(i+o);if(s.byteLength!==n)throw new Error("Incorrect length");return new $(e,n,s,t)},de=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&ne(r.bytes,e.bytes)}},$=class{constructor(t,e,i,n){this.code=t,this.size=e,this.digest=i,this.bytes=n}};var pe=0,Or="identity",me=D,Vr=r=>C(pe,me(r)),Pr={code:pe,name:Or,encode:me,digest:Vr};var zt={};p(zt,{sha256:()=>$r,sha512:()=>_r});var Ft=({name:r,code:t,encode:e})=>new Nt(r,t,e),Nt=class{constructor(t,e,i){this.name=t,this.code=e,this.encode=i}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?C(this.code,e):e.then(i=>C(this.code,i))}else throw Error("Unknown type, must be binary type")}};var ge=r=>async t=>new Uint8Array(await crypto.subtle.digest(r,t)),$r=Ft({name:"sha2-256",code:18,encode:ge("SHA-256")}),_r=Ft({name:"sha2-512",code:19,encode:ge("SHA-512")});var xe=(r,t)=>{let{bytes:e,version:i}=r;switch(i){case 0:return qr(e,vt(r),t||I.encoder);default:return Hr(e,vt(r),t||O.encoder)}};var ye=new WeakMap,vt=r=>{let t=ye.get(r);if(t==null){let e=new Map;return ye.set(r,e),e}return t},ot=class r{constructor(t,e,i,n){this.code=e,this.version=t,this.multihash=i,this.bytes=n,this["/"]=n}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!==X)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Jr)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,i=C(t,e);return r.createV1(this.code,i)}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 i=e;return i&&t.code===i.code&&t.version===i.version&&de(t.multihash,i.multihash)}toString(t){return xe(this,t)}toJSON(){return{"/":xe(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 e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:i,code:n,multihash:o,bytes:s}=e;return new r(i,n,o,s||we(i,n,o.bytes))}else if(e[Xr]===!0){let{version:i,multihash:n,code:o}=e,s=ue(n);return r.create(i,o,s)}else return null}static create(t,e,i){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(i.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==X)throw new Error(`Version 0 CID must use dag-pb (code: ${X}) block encoding`);return new r(t,e,i,i.bytes)}case 1:{let n=we(t,e,i.bytes);return new r(t,e,i,n)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,X,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,i]=r.decodeFirst(t);if(i.length)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),i=e.size-e.multihashSize,n=D(t.subarray(i,i+e.multihashSize));if(n.byteLength!==e.multihashSize)throw new Error("Incorrect length");let o=n.subarray(e.multihashSize-e.digestSize),s=new $(e.multihashCode,e.digestSize,o,n);return[e.version===0?r.createV0(s):r.createV1(e.codec,s),t.subarray(e.size)]}static inspectBytes(t){let e=0,i=()=>{let[L,Y]=H(t.subarray(e));return e+=Y,L},n=i(),o=X;if(n===18?(n=0,e=0):o=i(),n!==0&&n!==1)throw new RangeError(`Invalid CID version ${n}`);let s=e,a=i(),f=i(),U=e+f,m=U-s;return{version:n,codec:o,multihashCode:a,digestSize:f,multihashSize:m,size:U}}static parse(t,e){let[i,n]=Gr(t,e),o=r.decode(n);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return vt(o).set(i,t),o}},Gr=(r,t)=>{switch(r[0]){case"Q":{let e=t||I;return[I.prefix,e.decode(`${I.prefix}${r}`)]}case I.prefix:{let e=t||I;return[I.prefix,e.decode(r)]}case O.prefix:{let e=t||O;return[O.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)]}}},qr=(r,t,e)=>{let{prefix:i}=e;if(i!==I.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let n=t.get(i);if(n==null){let o=e.encode(r).slice(1);return t.set(i,o),o}else return n},Hr=(r,t,e)=>{let{prefix:i}=e,n=t.get(i);if(n==null){let o=e.encode(r);return t.set(i,o),o}else return n},X=112,Jr=18,we=(r,t,e)=>{let i=P(r),n=i+P(t),o=new Uint8Array(n+e.byteLength);return V(r,o,0),V(t,o,i),o.set(e,n),o},Xr=Symbol.for("@ipld/js-cid/CID");var Ct={...Dt,...yt,...kt,...gt,...xt,...St,...Et,...At,...It,...wt},Qn={...zt,...Tt};function Ee(r,t,e,i){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:i}}}var Se=Ee("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Mt=Ee("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=v(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Wr={utf8:Se,"utf-8":Se,hex:Ct.base16,latin1:Mt,ascii:Mt,binary:Mt,...Ct},Ae=Wr;function Ie(r,t="utf8"){let e=Ae[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?nt(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}function Ut(r){let t=r??8192,e=t>>>1,i,n=t;return function(s){if(s<1||s>e)return v(s);n+s>t&&(i=v(t),n=0);let a=i.subarray(n,n+=s);return n&7&&(n=(n|7)+1),a}}var M=class{fn;len;next;val;constructor(t,e,i){this.fn=t,this.len=e,this.next=void 0,this.val=i}};function Lt(){}var Ot=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},Qr=Ut();function Kr(r){return globalThis.Buffer!=null?v(r):Qr(r)}var K=class{len;head;tail;states;constructor(){this.len=0,this.head=new M(Lt,0,0),this.tail=this.head,this.states=null}_push(t,e,i){return this.tail=this.tail.next=new M(t,e,i),this.len+=e,this}uint32(t){return this.len+=(this.tail=this.tail.next=new Vt((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(W,10,d.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let e=d.fromBigInt(t);return this._push(W,e.length(),e)}uint64Number(t){let e=d.fromNumber(t);return this._push(W,e.length(),e)}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=d.fromBigInt(t).zzEncode();return this._push(W,e.length(),e)}sint64Number(t){let e=d.fromNumber(t).zzEncode();return this._push(W,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(Rt,1,t?1:0)}fixed32(t){return this._push(Q,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=d.fromBigInt(t);return this._push(Q,4,e.lo)._push(Q,4,e.hi)}fixed64Number(t){let e=d.fromNumber(t);return this._push(Q,4,e.lo)._push(Q,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(Wt,4,t)}double(t){return this._push(Kt,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(Rt,1,0):this.uint32(e)._push(jr,e,t)}string(t){let e=Yt(t);return e!==0?this.uint32(e)._push(ft,e,t):this._push(Rt,1,0)}fork(){return this.states=new Ot(this),this.head=this.tail=new M(Lt,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 M(Lt,0,0),this.len=0),this}ldelim(){let t=this.head,e=this.tail,i=this.len;return this.reset().uint32(i),i!==0&&(this.tail.next=t.next,this.tail=e,this.len+=i),this}finish(){let t=this.head.next,e=Kr(this.len),i=0;for(;t!=null;)t.fn(t.val,e,i),i+=t.len,t=t.next;return e}};function Rt(r,t,e){t[e]=r&255}function Zr(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var Vt=class extends M{next;constructor(t,e){super(Zr,t,e),this.next=void 0}};function W(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 Q(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 jr(r,t,e){t.set(r,e)}globalThis.Buffer!=null&&(K.prototype.bytes=function(r){let t=r.length>>>0;return this.uint32(t),t>0&&this._push(Yr,t,r),this},K.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(tn,t,r),this});function Yr(r,t,e){t.set(r,e)}function tn(r,t,e){r.length<40?ft(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(Ie(r),e)}function Pt(){return new K}function Z(r,t){let e=Pt();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var _;(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"})(_||(_={}));function st(r,t,e,i){return{name:r,type:t,encode:e,decode:i}}function $t(r){function t(n){if(r[n.toString()]==null)throw new Error("Invalid enum value");return r[n]}let e=function(o,s){let a=t(o);s.int32(a)},i=function(o){let s=o.int32();return t(s)};return st("enum",_.VARINT,e,i)}function j(r,t){return st("message",_.LENGTH_DELIMITED,r,t)}var w;(function(r){let t;(function(n){n.Raw="Raw",n.Directory="Directory",n.File="File",n.Metadata="Metadata",n.Symlink="Symlink",n.HAMTShard="HAMTShard"})(t=r.DataType||(r.DataType={}));let e;(function(n){n[n.Raw=0]="Raw",n[n.Directory=1]="Directory",n[n.File=2]="File",n[n.Metadata=3]="Metadata",n[n.Symlink=4]="Symlink",n[n.HAMTShard=5]="HAMTShard"})(e||(e={})),function(n){n.codec=()=>$t(e)}(t=r.DataType||(r.DataType={}));let i;r.codec=()=>(i==null&&(i=j((n,o,s={})=>{if(s.lengthDelimited!==!1&&o.fork(),n.Type!=null&&(o.uint32(8),r.DataType.codec().encode(n.Type,o)),n.Data!=null&&(o.uint32(18),o.bytes(n.Data)),n.filesize!=null&&(o.uint32(24),o.uint64(n.filesize)),n.blocksizes!=null)for(let a of n.blocksizes)o.uint32(32),o.uint64(a);n.hashType!=null&&(o.uint32(40),o.uint64(n.hashType)),n.fanout!=null&&(o.uint32(48),o.uint64(n.fanout)),n.mode!=null&&(o.uint32(56),o.uint32(n.mode)),n.mtime!=null&&(o.uint32(66),at.codec().encode(n.mtime,o)),s.lengthDelimited!==!1&&o.ldelim()},(n,o)=>{let s={blocksizes:[]},a=o==null?n.len:n.pos+o;for(;n.pos<a;){let f=n.uint32();switch(f>>>3){case 1:s.Type=r.DataType.codec().decode(n);break;case 2:s.Data=n.bytes();break;case 3:s.filesize=n.uint64();break;case 4:s.blocksizes.push(n.uint64());break;case 5:s.hashType=n.uint64();break;case 6:s.fanout=n.uint64();break;case 7:s.mode=n.uint32();break;case 8:s.mtime=at.codec().decode(n,n.uint32());break;default:n.skipType(f&7);break}}return s})),i),r.encode=n=>Z(n,r.codec()),r.decode=n=>G(n,r.codec())})(w||(w={}));var at;(function(r){let t;r.codec=()=>(t==null&&(t=j((e,i,n={})=>{n.lengthDelimited!==!1&&i.fork(),e.Seconds!=null&&(i.uint32(8),i.int64(e.Seconds)),e.FractionalNanoseconds!=null&&(i.uint32(21),i.fixed32(e.FractionalNanoseconds)),n.lengthDelimited!==!1&&i.ldelim()},(e,i)=>{let n={},o=i==null?e.len:e.pos+i;for(;e.pos<o;){let s=e.uint32();switch(s>>>3){case 1:n.Seconds=e.int64();break;case 2:n.FractionalNanoseconds=e.fixed32();break;default:e.skipType(s&7);break}}return n})),t),r.encode=e=>Z(e,r.codec()),r.decode=e=>G(e,r.codec())})(at||(at={}));var ke;(function(r){let t;r.codec=()=>(t==null&&(t=j((e,i,n={})=>{n.lengthDelimited!==!1&&i.fork(),e.MimeType!=null&&(i.uint32(10),i.string(e.MimeType)),n.lengthDelimited!==!1&&i.ldelim()},(e,i)=>{let n={},o=i==null?e.len:e.pos+i;for(;e.pos<o;){let s=e.uint32();switch(s>>>3){case 1:n.MimeType=e.string();break;default:e.skipType(s&7);break}}return n})),t),r.encode=e=>Z(e,r.codec()),r.decode=e=>G(e,r.codec())})(ke||(ke={}));var De={Raw:"raw",Directory:"directory",File:"file",Metadata:"metadata",Symlink:"symlink",HAMTShard:"hamt-sharded-directory"},en=["directory","hamt-sharded-directory"],Be=parseInt("0644",8),Te=parseInt("0755",8),Gt=class r{static unmarshal(t){let e=w.decode(t),i=new r({type:De[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 i._originalMode=e.mode??0,i}type;data;blockSizes;hashType;fanout;mtime;_mode;_originalMode;constructor(t={type:"file"}){let{type:e,data:i,blockSizes:n,hashType:o,fanout:s,mtime:a,mode:f}=t;if(e!=null&&!Object.values(De).includes(e))throw(0,_t.default)(new Error("Type: "+e+" is not valid"),"ERR_INVALID_TYPE");this.type=e??"file",this.data=i,this.hashType=o,this.fanout=s,this.blockSizes=n??[],this._originalMode=0,this.mode=f,this.mtime=a}set mode(t){t==null?this._mode=this.isDirectory()?Te:Be:this._mode=t&4095}get mode(){return this._mode}isDirectory(){return en.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=w.DataType.Raw;break;case"directory":t=w.DataType.Directory;break;case"file":t=w.DataType.File;break;case"metadata":t=w.DataType.Metadata;break;case"symlink":t=w.DataType.Symlink;break;case"hamt-sharded-directory":t=w.DataType.HAMTShard;break;default:throw(0,_t.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 i;this.mode!=null&&(i=this._originalMode&4294963200|(this.mode??0),i===Be&&!this.isDirectory()&&(i=void 0),i===Te&&this.isDirectory()&&(i=void 0));let n;return this.mtime!=null&&(n={Seconds:this.mtime.secs,FractionalNanoseconds:this.mtime.nsecs}),w.encode({Type:t,Data:e,filesize:this.isDirectory()?void 0:this.fileSize(),blocksizes:this.blockSizes,hashType:this.hashType,fanout:this.fanout,mode:i,mtime:n})}};return Re(rn);})();
"use strict";var IpfsUnixfs=(()=>{var ze=Object.create;var et=Object.defineProperty;var Fe=Object.getOwnPropertyDescriptor;var ve=Object.getOwnPropertyNames;var Ce=Object.getPrototypeOf,Me=Object.prototype.hasOwnProperty;var Ue=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),p=(r,t)=>{for(var e in t)et(r,e,{get:t[e],enumerable:!0})},qt=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ve(t))!Me.call(r,n)&&n!==e&&et(r,n,{get:()=>t[n],enumerable:!(i=Fe(t,n))||i.enumerable});return r};var Le=(r,t,e)=>(e=r!=null?ze(Ce(r)):{},qt(t||!r||!r.__esModule?et(e,"default",{value:r,enumerable:!0}):e,r)),Re=r=>qt(et({},"__esModule",{value:!0}),r);var Xt=Ue((on,Jt)=>{"use strict";function Ht(r,t){for(let e in t)Object.defineProperty(r,e,{value:t[e],enumerable:!0,configurable:!0});return r}function Oe(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 Ht(r,e)}catch{e.message=r.message,e.stack=r.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(r)),Ht(new n,e)}}Jt.exports=Oe});var rn={};p(rn,{UnixFS:()=>Gt});var _t=Le(Xt(),1);var ct=new Float32Array([-0]),T=new Uint8Array(ct.buffer);function Wt(r,t,e){ct[0]=r,t[e]=T[0],t[e+1]=T[1],t[e+2]=T[2],t[e+3]=T[3]}function Qt(r,t){return T[0]=r[t],T[1]=r[t+1],T[2]=r[t+2],T[3]=r[t+3],ct[0]}var ht=new Float64Array([-0]),f=new Uint8Array(ht.buffer);function Kt(r,t,e){ht[0]=r,t[e]=f[0],t[e+1]=f[1],t[e+2]=f[2],t[e+3]=f[3],t[e+4]=f[4],t[e+5]=f[5],t[e+6]=f[6],t[e+7]=f[7]}function Zt(r,t){return f[0]=r[t],f[1]=r[t+1],f[2]=r[t+2],f[3]=r[t+3],f[4]=r[t+4],f[5]=r[t+5],f[6]=r[t+6],f[7]=r[t+7],ht[0]}var Ve=BigInt(Number.MAX_SAFE_INTEGER),$e=BigInt(Number.MIN_SAFE_INTEGER),d=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,i=~this.hi>>>0;return e===0&&(i=i+1>>>0),-(e+i*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,i=~this.hi>>>0;return e===0&&(i=i+1>>>0),-(BigInt(e)+(BigInt(i)<<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,i=this.hi>>>24;return i===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:i<128?9:10}static fromBigInt(t){if(t===0n)return F;if(t<Ve&&t>$e)return this.fromNumber(Number(t));let e=t<0n;e&&(t=-t);let i=t>>32n,n=t-(i<<32n);return e&&(i=~i|0n,n=~n|0n,++n>jt&&(n=0n,++i>jt&&(i=0n))),new r(Number(n),Number(i))}static fromNumber(t){if(t===0)return F;let e=t<0;e&&(t=-t);let i=t>>>0,n=(t-i)/4294967296>>>0;return e&&(n=~n>>>0,i=~i>>>0,++i>4294967295&&(i=0,++n>4294967295&&(n=0))),new r(i,n)}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):F}},F=new d(0,0);F.toBigInt=function(){return 0n};F.zzEncode=F.zzDecode=function(){return this};F.length=function(){return 1};var jt=4294967296n;function Yt(r){let t=0,e=0;for(let i=0;i<r.length;++i)e=r.charCodeAt(i),e<128?t+=1:e<2048?t+=2:(e&64512)===55296&&(r.charCodeAt(i+1)&64512)===56320?(++i,t+=4):t+=3;return t}function te(r,t,e){if(e-t<1)return"";let n,o=[],s=0,a;for(;t<e;)a=r[t++],a<128?o[s++]=a:a>191&&a<224?o[s++]=(a&31)<<6|r[t++]&63:a>239&&a<365?(a=((a&7)<<18|(r[t++]&63)<<12|(r[t++]&63)<<6|r[t++]&63)-65536,o[s++]=55296+(a>>10),o[s++]=56320+(a&1023)):o[s++]=(a&15)<<12|(r[t++]&63)<<6|r[t++]&63,s>8191&&((n??(n=[])).push(String.fromCharCode.apply(String,o)),s=0);return n!=null?(s>0&&n.push(String.fromCharCode.apply(String,o.slice(0,s))),n.join("")):String.fromCharCode.apply(String,o.slice(0,s))}function ut(r,t,e){let i=e,n,o;for(let s=0;s<r.length;++s)n=r.charCodeAt(s),n<128?t[e++]=n:n<2048?(t[e++]=n>>6|192,t[e++]=n&63|128):(n&64512)===55296&&((o=r.charCodeAt(s+1))&64512)===56320?(n=65536+((n&1023)<<10)+(o&1023),++s,t[e++]=n>>18|240,t[e++]=n>>12&63|128,t[e++]=n>>6&63|128,t[e++]=n&63|128):(t[e++]=n>>12|224,t[e++]=n>>6&63|128,t[e++]=n&63|128);return e-i}function y(r,t){return RangeError(`index out of range: ${r.pos} + ${t??1} > ${r.len}`)}function rt(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}var ft=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,y(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 y(this,4);return rt(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw y(this,4);return rt(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw y(this,4);let t=Qt(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw y(this,4);let t=Zt(this.buf,this.pos);return this.pos+=8,t}bytes(){let t=this.uint32(),e=this.pos,i=this.pos+t;if(i>this.len)throw y(this,t);return this.pos+=t,e===i?new Uint8Array(0):this.buf.subarray(e,i)}string(){let t=this.bytes();return te(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw y(this,t);this.pos+=t}else do if(this.pos>=this.len)throw y(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 d(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 y(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 y(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 y(this,8);let t=rt(this.buf,this.pos+=4),e=rt(this.buf,this.pos+=4);return new d(t,e)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){return this.readLongVarint().toNumber(!0)}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 lt(r){return new ft(r instanceof Uint8Array?r:r.subarray())}function G(r,t){let e=lt(r);return t.decode(e)}function nt(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function v(r=0){return globalThis.Buffer?.allocUnsafe!=null?nt(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}var bt={};p(bt,{base10:()=>Je});var xn=new Uint8Array(0);function re(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 D(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 ne(r){return new TextEncoder().encode(r)}function ie(r){return new TextDecoder().decode(r)}function Pe(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),i=0;i<e.length;i++)e[i]=255;for(var n=0;n<r.length;n++){var o=r.charAt(n),s=o.charCodeAt(0);if(e[s]!==255)throw new TypeError(o+" is ambiguous");e[s]=n}var a=r.length,u=r.charAt(0),U=Math.log(a)/Math.log(256),m=Math.log(256)/Math.log(a);function L(c){if(c instanceof Uint8Array||(ArrayBuffer.isView(c)?c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength):Array.isArray(c)&&(c=Uint8Array.from(c))),!(c instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(c.length===0)return"";for(var l=0,z=0,b=0,S=c.length;b!==S&&c[b]===0;)b++,l++;for(var E=(S-b)*m+1>>>0,x=new Uint8Array(E);b!==S;){for(var A=c[b],B=0,g=E-1;(A!==0||B<z)&&g!==-1;g--,B++)A+=256*x[g]>>>0,x[g]=A%a>>>0,A=A/a>>>0;if(A!==0)throw new Error("Non-zero carry");z=B,b++}for(var k=E-z;k!==E&&x[k]===0;)k++;for(var tt=u.repeat(l);k<E;++k)tt+=r.charAt(x[k]);return tt}function Y(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var l=0;if(c[l]!==" "){for(var z=0,b=0;c[l]===u;)z++,l++;for(var S=(c.length-l)*U+1>>>0,E=new Uint8Array(S);c[l];){var x=e[c.charCodeAt(l)];if(x===255)return;for(var A=0,B=S-1;(x!==0||A<b)&&B!==-1;B--,A++)x+=a*E[B]>>>0,E[B]=x%256>>>0,x=x/256>>>0;if(x!==0)throw new Error("Non-zero carry");b=A,l++}if(c[l]!==" "){for(var g=S-b;g!==S&&E[g]===0;)g++;for(var k=new Uint8Array(z+(S-g)),tt=z;g!==S;)k[tt++]=E[g++];return k}}}function Ne(c){var l=Y(c);if(l)return l;throw new Error(`Non-${t} character`)}return{encode:L,decodeUnsafe:Y,decode:Ne}}var _e=Pe,Ge=_e,se=Ge;var dt=class{name;prefix;baseEncode;constructor(t,e,i){this.name=t,this.prefix=e,this.baseEncode=i}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},pt=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,e,i){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=i}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 ae(this,t)}},mt=class{decoders;constructor(t){this.decoders=t}or(t){return ae(this,t)}decode(t){let e=t[0],i=this.decoders[e];if(i!=null)return i.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function ae(r,t){return new mt({...r.decoders??{[r.prefix]:r},...t.decoders??{[t.prefix]:t}})}var xt=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,e,i,n){this.name=t,this.prefix=e,this.baseEncode=i,this.baseDecode=n,this.encoder=new dt(t,e,i),this.decoder=new pt(t,e,n)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function R({name:r,prefix:t,encode:e,decode:i}){return new xt(r,t,e,i)}function N({name:r,prefix:t,alphabet:e}){let{encode:i,decode:n}=se(e,r);return R({prefix:t,name:r,encode:i,decode:o=>D(n(o))})}function qe(r,t,e,i){let n={};for(let m=0;m<t.length;++m)n[t[m]]=m;let o=r.length;for(;r[o-1]==="=";)--o;let s=new Uint8Array(o*e/8|0),a=0,u=0,U=0;for(let m=0;m<o;++m){let L=n[r[m]];if(L===void 0)throw new SyntaxError(`Non-${i} character`);u=u<<e|L,a+=e,a>=8&&(a-=8,s[U++]=255&u>>a)}if(a>=e||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return s}function He(r,t,e){let i=t[t.length-1]==="=",n=(1<<e)-1,o="",s=0,a=0;for(let u=0;u<r.length;++u)for(a=a<<8|r[u],s+=8;s>e;)s-=e,o+=t[n&a>>s];if(s!==0&&(o+=t[n&a<<e-s]),i)for(;o.length*e&7;)o+="=";return o}function h({name:r,prefix:t,bitsPerChar:e,alphabet:i}){return R({prefix:t,name:r,encode(n){return He(n,i,e)},decode(n){return qe(n,i,e,r)}})}var Je=N({prefix:"9",name:"base10",alphabet:"0123456789"});var gt={};p(gt,{base16:()=>Xe,base16upper:()=>We});var Xe=h({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),We=h({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var yt={};p(yt,{base2:()=>Qe});var Qe=h({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var wt={};p(wt,{base256emoji:()=>tr});var ce=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}"),Ke=ce.reduce((r,t,e)=>(r[e]=t,r),[]),Ze=ce.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function je(r){return r.reduce((t,e)=>(t+=Ke[e],t),"")}function Ye(r){let t=[];for(let e of r){let i=Ze[e.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(i)}return new Uint8Array(t)}var tr=R({prefix:"\u{1F680}",name:"base256emoji",encode:je,decode:Ye});var St={};p(St,{base32:()=>O,base32hex:()=>ir,base32hexpad:()=>sr,base32hexpadupper:()=>ar,base32hexupper:()=>or,base32pad:()=>rr,base32padupper:()=>nr,base32upper:()=>er,base32z:()=>cr});var O=h({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),er=h({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),rr=h({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),nr=h({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ir=h({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),or=h({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),sr=h({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ar=h({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),cr=h({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Et={};p(Et,{base36:()=>hr,base36upper:()=>ur});var hr=N({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ur=N({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var At={};p(At,{base58btc:()=>I,base58flickr:()=>fr});var I=N({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),fr=N({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var It={};p(It,{base64:()=>lr,base64pad:()=>dr,base64url:()=>pr,base64urlpad:()=>mr});var lr=h({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),dr=h({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),pr=h({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),mr=h({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var kt={};p(kt,{base8:()=>xr});var xr=h({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Dt={};p(Dt,{identity:()=>br});var br=R({prefix:"\0",name:"identity",encode:r=>ie(r),decode:r=>ne(r)});var vn=new TextEncoder,Cn=new TextDecoder;var Tt={};p(Tt,{identity:()=>$r});var wr=fe,he=128,Sr=127,Er=~Sr,Ar=Math.pow(2,31);function fe(r,t,e){t=t||[],e=e||0;for(var i=e;r>=Ar;)t[e++]=r&255|he,r/=128;for(;r&Er;)t[e++]=r&255|he,r>>>=7;return t[e]=r|0,fe.bytes=e-i+1,t}var Ir=Bt,kr=128,ue=127;function Bt(r,i){var e=0,i=i||0,n=0,o=i,s,a=r.length;do{if(o>=a)throw Bt.bytes=0,new RangeError("Could not decode varint");s=r[o++],e+=n<28?(s&ue)<<n:(s&ue)*Math.pow(2,n),n+=7}while(s>=kr);return Bt.bytes=o-i,e}var Dr=Math.pow(2,7),Br=Math.pow(2,14),Tr=Math.pow(2,21),Nr=Math.pow(2,28),zr=Math.pow(2,35),Fr=Math.pow(2,42),vr=Math.pow(2,49),Cr=Math.pow(2,56),Mr=Math.pow(2,63),Ur=function(r){return r<Dr?1:r<Br?2:r<Tr?3:r<Nr?4:r<zr?5:r<Fr?6:r<vr?7:r<Cr?8:r<Mr?9:10},Lr={encode:wr,decode:Ir,encodingLength:Ur},Rr=Lr,q=Rr;function H(r,t=0){return[q.decode(r,t),q.decode.bytes]}function V(r,t,e=0){return q.encode(r,t,e),t}function $(r){return q.encodingLength(r)}function C(r,t){let e=t.byteLength,i=$(r),n=i+$(e),o=new Uint8Array(n+e);return V(r,o,0),V(e,o,i),o.set(t,n),new P(r,e,t,o)}function le(r){let t=D(r),[e,i]=H(t),[n,o]=H(t.subarray(i)),s=t.subarray(i+o);if(s.byteLength!==n)throw new Error("Incorrect length");return new P(e,n,s,t)}function de(r,t){if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&re(r.bytes,e.bytes)}}var P=class{code;size;digest;bytes;constructor(t,e,i,n){this.code=t,this.size=e,this.digest=i,this.bytes=n}};var pe=0,Or="identity",me=D;function Vr(r){return C(pe,me(r))}var $r={code:pe,name:Or,encode:me,digest:Vr};var Ft={};p(Ft,{sha256:()=>Pr,sha512:()=>_r});function zt({name:r,code:t,encode:e}){return new Nt(r,t,e)}var Nt=class{name;code;encode;constructor(t,e,i){this.name=t,this.code=e,this.encode=i}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?C(this.code,e):e.then(i=>C(this.code,i))}else throw Error("Unknown type, must be binary type")}};function be(r){return async t=>new Uint8Array(await crypto.subtle.digest(r,t))}var Pr=zt({name:"sha2-256",code:18,encode:be("SHA-256")}),_r=zt({name:"sha2-512",code:19,encode:be("SHA-512")});function ge(r,t){let{bytes:e,version:i}=r;switch(i){case 0:return qr(e,vt(r),t??I.encoder);default:return Hr(e,vt(r),t??O.encoder)}}var ye=new WeakMap;function vt(r){let t=ye.get(r);if(t==null){let e=new Map;return ye.set(r,e),e}return t}var ot=class r{code;version;multihash;bytes;"/";constructor(t,e,i,n){this.code=e,this.version=t,this.multihash=i,this.bytes=n,this["/"]=n}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!==X)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Jr)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,i=C(t,e);return r.createV1(this.code,i)}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 i=e;return i!=null&&t.code===i.code&&t.version===i.version&&de(t.multihash,i.multihash)}toString(t){return ge(this,t)}toJSON(){return{"/":ge(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:i,code:n,multihash:o,bytes:s}=e;return new r(i,n,o,s??we(i,n,o.bytes))}else if(e[Xr]===!0){let{version:i,multihash:n,code:o}=e,s=le(n);return r.create(i,o,s)}else return null}static create(t,e,i){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(i.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==X)throw new Error(`Version 0 CID must use dag-pb (code: ${X}) block encoding`);return new r(t,e,i,i.bytes)}case 1:{let n=we(t,e,i.bytes);return new r(t,e,i,n)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,X,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,i]=r.decodeFirst(t);if(i.length!==0)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),i=e.size-e.multihashSize,n=D(t.subarray(i,i+e.multihashSize));if(n.byteLength!==e.multihashSize)throw new Error("Incorrect length");let o=n.subarray(e.multihashSize-e.digestSize),s=new P(e.multihashCode,e.digestSize,o,n);return[e.version===0?r.createV0(s):r.createV1(e.codec,s),t.subarray(e.size)]}static inspectBytes(t){let e=0,i=()=>{let[L,Y]=H(t.subarray(e));return e+=Y,L},n=i(),o=X;if(n===18?(n=0,e=0):o=i(),n!==0&&n!==1)throw new RangeError(`Invalid CID version ${n}`);let s=e,a=i(),u=i(),U=e+u,m=U-s;return{version:n,codec:o,multihashCode:a,digestSize:u,multihashSize:m,size:U}}static parse(t,e){let[i,n]=Gr(t,e),o=r.decode(n);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return vt(o).set(i,t),o}};function Gr(r,t){switch(r[0]){case"Q":{let e=t??I;return[I.prefix,e.decode(`${I.prefix}${r}`)]}case I.prefix:{let e=t??I;return[I.prefix,e.decode(r)]}case O.prefix:{let e=t??O;return[O.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 qr(r,t,e){let{prefix:i}=e;if(i!==I.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let n=t.get(i);if(n==null){let o=e.encode(r).slice(1);return t.set(i,o),o}else return n}function Hr(r,t,e){let{prefix:i}=e,n=t.get(i);if(n==null){let o=e.encode(r);return t.set(i,o),o}else return n}var X=112,Jr=18;function we(r,t,e){let i=$(r),n=i+$(t),o=new Uint8Array(n+e.byteLength);return V(r,o,0),V(t,o,i),o.set(e,n),o}var Xr=Symbol.for("@ipld/js-cid/CID");var Ct={...Dt,...yt,...kt,...bt,...gt,...St,...Et,...At,...It,...wt},ti={...Ft,...Tt};function Ee(r,t,e,i){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:i}}}var Se=Ee("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Mt=Ee("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=v(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Wr={utf8:Se,"utf-8":Se,hex:Ct.base16,latin1:Mt,ascii:Mt,binary:Mt,...Ct},Ae=Wr;function Ie(r,t="utf8"){let e=Ae[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?nt(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}function Ut(r){let t=r??8192,e=t>>>1,i,n=t;return function(s){if(s<1||s>e)return v(s);n+s>t&&(i=v(t),n=0);let a=i.subarray(n,n+=s);return n&7&&(n=(n|7)+1),a}}var M=class{fn;len;next;val;constructor(t,e,i){this.fn=t,this.len=e,this.next=void 0,this.val=i}};function Lt(){}var Ot=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},Qr=Ut();function Kr(r){return globalThis.Buffer!=null?v(r):Qr(r)}var K=class{len;head;tail;states;constructor(){this.len=0,this.head=new M(Lt,0,0),this.tail=this.head,this.states=null}_push(t,e,i){return this.tail=this.tail.next=new M(t,e,i),this.len+=e,this}uint32(t){return this.len+=(this.tail=this.tail.next=new Vt((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(W,10,d.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let e=d.fromBigInt(t);return this._push(W,e.length(),e)}uint64Number(t){let e=d.fromNumber(t);return this._push(W,e.length(),e)}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=d.fromBigInt(t).zzEncode();return this._push(W,e.length(),e)}sint64Number(t){let e=d.fromNumber(t).zzEncode();return this._push(W,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(Rt,1,t?1:0)}fixed32(t){return this._push(Q,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=d.fromBigInt(t);return this._push(Q,4,e.lo)._push(Q,4,e.hi)}fixed64Number(t){let e=d.fromNumber(t);return this._push(Q,4,e.lo)._push(Q,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(Wt,4,t)}double(t){return this._push(Kt,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(Rt,1,0):this.uint32(e)._push(jr,e,t)}string(t){let e=Yt(t);return e!==0?this.uint32(e)._push(ut,e,t):this._push(Rt,1,0)}fork(){return this.states=new Ot(this),this.head=this.tail=new M(Lt,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 M(Lt,0,0),this.len=0),this}ldelim(){let t=this.head,e=this.tail,i=this.len;return this.reset().uint32(i),i!==0&&(this.tail.next=t.next,this.tail=e,this.len+=i),this}finish(){let t=this.head.next,e=Kr(this.len),i=0;for(;t!=null;)t.fn(t.val,e,i),i+=t.len,t=t.next;return e}};function Rt(r,t,e){t[e]=r&255}function Zr(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var Vt=class extends M{next;constructor(t,e){super(Zr,t,e),this.next=void 0}};function W(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 Q(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 jr(r,t,e){t.set(r,e)}globalThis.Buffer!=null&&(K.prototype.bytes=function(r){let t=r.length>>>0;return this.uint32(t),t>0&&this._push(Yr,t,r),this},K.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(tn,t,r),this});function Yr(r,t,e){t.set(r,e)}function tn(r,t,e){r.length<40?ut(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(Ie(r),e)}function $t(){return new K}function Z(r,t){let e=$t();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var _;(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"})(_||(_={}));function st(r,t,e,i){return{name:r,type:t,encode:e,decode:i}}function Pt(r){function t(n){if(r[n.toString()]==null)throw new Error("Invalid enum value");return r[n]}let e=function(o,s){let a=t(o);s.int32(a)},i=function(o){let s=o.int32();return t(s)};return st("enum",_.VARINT,e,i)}function j(r,t){return st("message",_.LENGTH_DELIMITED,r,t)}var w;(function(r){let t;(function(n){n.Raw="Raw",n.Directory="Directory",n.File="File",n.Metadata="Metadata",n.Symlink="Symlink",n.HAMTShard="HAMTShard"})(t=r.DataType||(r.DataType={}));let e;(function(n){n[n.Raw=0]="Raw",n[n.Directory=1]="Directory",n[n.File=2]="File",n[n.Metadata=3]="Metadata",n[n.Symlink=4]="Symlink",n[n.HAMTShard=5]="HAMTShard"})(e||(e={})),function(n){n.codec=()=>Pt(e)}(t=r.DataType||(r.DataType={}));let i;r.codec=()=>(i==null&&(i=j((n,o,s={})=>{if(s.lengthDelimited!==!1&&o.fork(),n.Type!=null&&(o.uint32(8),r.DataType.codec().encode(n.Type,o)),n.Data!=null&&(o.uint32(18),o.bytes(n.Data)),n.filesize!=null&&(o.uint32(24),o.uint64(n.filesize)),n.blocksizes!=null)for(let a of n.blocksizes)o.uint32(32),o.uint64(a);n.hashType!=null&&(o.uint32(40),o.uint64(n.hashType)),n.fanout!=null&&(o.uint32(48),o.uint64(n.fanout)),n.mode!=null&&(o.uint32(56),o.uint32(n.mode)),n.mtime!=null&&(o.uint32(66),at.codec().encode(n.mtime,o)),s.lengthDelimited!==!1&&o.ldelim()},(n,o)=>{let s={blocksizes:[]},a=o==null?n.len:n.pos+o;for(;n.pos<a;){let u=n.uint32();switch(u>>>3){case 1:s.Type=r.DataType.codec().decode(n);break;case 2:s.Data=n.bytes();break;case 3:s.filesize=n.uint64();break;case 4:s.blocksizes.push(n.uint64());break;case 5:s.hashType=n.uint64();break;case 6:s.fanout=n.uint64();break;case 7:s.mode=n.uint32();break;case 8:s.mtime=at.codec().decode(n,n.uint32());break;default:n.skipType(u&7);break}}return s})),i),r.encode=n=>Z(n,r.codec()),r.decode=n=>G(n,r.codec())})(w||(w={}));var at;(function(r){let t;r.codec=()=>(t==null&&(t=j((e,i,n={})=>{n.lengthDelimited!==!1&&i.fork(),e.Seconds!=null&&(i.uint32(8),i.int64(e.Seconds)),e.FractionalNanoseconds!=null&&(i.uint32(21),i.fixed32(e.FractionalNanoseconds)),n.lengthDelimited!==!1&&i.ldelim()},(e,i)=>{let n={},o=i==null?e.len:e.pos+i;for(;e.pos<o;){let s=e.uint32();switch(s>>>3){case 1:n.Seconds=e.int64();break;case 2:n.FractionalNanoseconds=e.fixed32();break;default:e.skipType(s&7);break}}return n})),t),r.encode=e=>Z(e,r.codec()),r.decode=e=>G(e,r.codec())})(at||(at={}));var ke;(function(r){let t;r.codec=()=>(t==null&&(t=j((e,i,n={})=>{n.lengthDelimited!==!1&&i.fork(),e.MimeType!=null&&(i.uint32(10),i.string(e.MimeType)),n.lengthDelimited!==!1&&i.ldelim()},(e,i)=>{let n={},o=i==null?e.len:e.pos+i;for(;e.pos<o;){let s=e.uint32();switch(s>>>3){case 1:n.MimeType=e.string();break;default:e.skipType(s&7);break}}return n})),t),r.encode=e=>Z(e,r.codec()),r.decode=e=>G(e,r.codec())})(ke||(ke={}));var De={Raw:"raw",Directory:"directory",File:"file",Metadata:"metadata",Symlink:"symlink",HAMTShard:"hamt-sharded-directory"},en=["directory","hamt-sharded-directory"],Be=parseInt("0644",8),Te=parseInt("0755",8),Gt=class r{static unmarshal(t){let e=w.decode(t),i=new r({type:De[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 i._originalMode=e.mode??0,i}type;data;blockSizes;hashType;fanout;mtime;_mode;_originalMode;constructor(t={type:"file"}){let{type:e,data:i,blockSizes:n,hashType:o,fanout:s,mtime:a,mode:u}=t;if(e!=null&&!Object.values(De).includes(e))throw(0,_t.default)(new Error("Type: "+e+" is not valid"),"ERR_INVALID_TYPE");this.type=e??"file",this.data=i,this.hashType=o,this.fanout=s,this.blockSizes=n??[],this._originalMode=0,this.mode=u,this.mtime=a}set mode(t){t==null?this._mode=this.isDirectory()?Te:Be:this._mode=t&4095}get mode(){return this._mode}isDirectory(){return en.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=w.DataType.Raw;break;case"directory":t=w.DataType.Directory;break;case"file":t=w.DataType.File;break;case"metadata":t=w.DataType.Metadata;break;case"symlink":t=w.DataType.Symlink;break;case"hamt-sharded-directory":t=w.DataType.HAMTShard;break;default:throw(0,_t.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 i;this.mode!=null&&(i=this._originalMode&4294963200|(this.mode??0),i===Be&&!this.isDirectory()&&(i=void 0),i===Te&&this.isDirectory()&&(i=void 0));let n;return this.mtime!=null&&(n={Seconds:this.mtime.secs,FractionalNanoseconds:this.mtime.nsecs}),w.encode({Type:t,Data:e,filesize:this.isDirectory()?void 0:this.fileSize(),blocksizes:this.blockSizes,hashType:this.hashType,fanout:this.fanout,mode:i,mtime:n})}};return Re(rn);})();
return IpfsUnixfs}));

@@ -0,1 +1,92 @@

/**
* @packageDocumentation
*
* This module contains the protobuf definition of the UnixFS data structure found at the root of all UnixFS DAGs.
*
* The UnixFS spec can be found in the [ipfs/specs repository](http://github.com/ipfs/specs)
*
* @example Create a file composed of several blocks
*
* ```JavaScript
* const data = new UnixFS({ type: 'file' })
* data.addBlockSize(256) // add the size of each block
* data.addBlockSize(256)
* // ...
* ```
*
* @example Create a directory that contains several files
*
* Creating a directory that contains several files is achieve by creating a unixfs element that identifies a MerkleDAG node as a directory. The links of that MerkleDAG node are the files that are contained in this directory.
*
* ```JavaScript
* const data = new UnixFS({ type: 'directory' })
* ```
*
* @example Create an unixfs Data element
*
* ```JavaScript
* const data = new UnixFS([options])
* ```
*
* `options` is an optional object argument that might include the following keys:
*
* - type (string, default `file`): The type of UnixFS entry. Can be:
* - `raw`
* - `directory`
* - `file`
* - `metadata`
* - `symlink`
* - `hamt-sharded-directory`
* - data (Uint8Array): The optional data field for this node
* - blockSizes (Array, default: `[]`): If this is a `file` node that is made up of multiple blocks, `blockSizes` is a list numbers that represent the size of the file chunks stored in each child node. It is used to calculate the total file size.
* - mode (Number, default `0644` for files, `0755` for directories/hamt-sharded-directories) file mode
* - mtime (`Date`, `{ secs, nsecs }`, `{ Seconds, FractionalNanoseconds }`, `[ secs, nsecs ]`): The modification time of this node
*
* @example Add and remove a block size to the block size list
*
* ```JavaScript
* data.addBlockSize(<size in bytes>)
* ```
*
* ```JavaScript
* data.removeBlockSize(<index>)
* ```
*
* @example Get total fileSize
*
* ```JavaScript
* data.fileSize() // => size in bytes
* ```
*
* @example Marshal and unmarshal
*
* ```javascript
* const marshaled = data.marshal()
* const unmarshaled = Unixfs.unmarshal(marshaled)
* ```
*
* @example Is this UnixFS entry a directory?
*
* ```JavaScript
* const dir = new Data({ type: 'directory' })
* dir.isDirectory() // true
*
* const file = new Data({ type: 'file' })
* file.isDirectory() // false
* ```
*
* @example Has an mtime been set?
*
* If no modification time has been set, no `mtime` property will be present on the `Data` instance:
*
* ```JavaScript
* const file = new Data({ type: 'file' })
* file.mtime // undefined
*
* Object.prototype.hasOwnProperty.call(file, 'mtime') // false
*
* const dir = new Data({ type: 'dir', mtime: new Date() })
* dir.mtime // { secs: Number, nsecs: Number }
* ```
*/
export interface Mtime {

@@ -2,0 +93,0 @@ secs: bigint;

@@ -0,1 +1,92 @@

/**
* @packageDocumentation
*
* This module contains the protobuf definition of the UnixFS data structure found at the root of all UnixFS DAGs.
*
* The UnixFS spec can be found in the [ipfs/specs repository](http://github.com/ipfs/specs)
*
* @example Create a file composed of several blocks
*
* ```JavaScript
* const data = new UnixFS({ type: 'file' })
* data.addBlockSize(256) // add the size of each block
* data.addBlockSize(256)
* // ...
* ```
*
* @example Create a directory that contains several files
*
* Creating a directory that contains several files is achieve by creating a unixfs element that identifies a MerkleDAG node as a directory. The links of that MerkleDAG node are the files that are contained in this directory.
*
* ```JavaScript
* const data = new UnixFS({ type: 'directory' })
* ```
*
* @example Create an unixfs Data element
*
* ```JavaScript
* const data = new UnixFS([options])
* ```
*
* `options` is an optional object argument that might include the following keys:
*
* - type (string, default `file`): The type of UnixFS entry. Can be:
* - `raw`
* - `directory`
* - `file`
* - `metadata`
* - `symlink`
* - `hamt-sharded-directory`
* - data (Uint8Array): The optional data field for this node
* - blockSizes (Array, default: `[]`): If this is a `file` node that is made up of multiple blocks, `blockSizes` is a list numbers that represent the size of the file chunks stored in each child node. It is used to calculate the total file size.
* - mode (Number, default `0644` for files, `0755` for directories/hamt-sharded-directories) file mode
* - mtime (`Date`, `{ secs, nsecs }`, `{ Seconds, FractionalNanoseconds }`, `[ secs, nsecs ]`): The modification time of this node
*
* @example Add and remove a block size to the block size list
*
* ```JavaScript
* data.addBlockSize(<size in bytes>)
* ```
*
* ```JavaScript
* data.removeBlockSize(<index>)
* ```
*
* @example Get total fileSize
*
* ```JavaScript
* data.fileSize() // => size in bytes
* ```
*
* @example Marshal and unmarshal
*
* ```javascript
* const marshaled = data.marshal()
* const unmarshaled = Unixfs.unmarshal(marshaled)
* ```
*
* @example Is this UnixFS entry a directory?
*
* ```JavaScript
* const dir = new Data({ type: 'directory' })
* dir.isDirectory() // true
*
* const file = new Data({ type: 'file' })
* file.isDirectory() // false
* ```
*
* @example Has an mtime been set?
*
* If no modification time has been set, no `mtime` property will be present on the `Data` instance:
*
* ```JavaScript
* const file = new Data({ type: 'file' })
* file.mtime // undefined
*
* Object.prototype.hasOwnProperty.call(file, 'mtime') // false
*
* const dir = new Data({ type: 'dir', mtime: new Date() })
* dir.mtime // { secs: Number, nsecs: Number }
* ```
*/
import errcode from 'err-code';

@@ -2,0 +93,0 @@ import { Data as PBData } from './unixfs.js';

{
"name": "ipfs-unixfs",
"version": "11.1.2",
"version": "11.1.3",
"description": "JavaScript implementation of IPFS' unixfs (a Unix FileSystem representation on top of a MerkleDAG)",

@@ -14,9 +14,9 @@ "license": "Apache-2.0 OR MIT",

},
"publishConfig": {
"access": "public",
"provenance": true
},
"keywords": [
"IPFS"
],
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
},
"type": "module",

@@ -39,2 +39,3 @@ "types": "./dist/src/index.d.ts",

"parserOptions": {
"project": true,
"sourceType": "module"

@@ -46,87 +47,2 @@ },

},
"release": {
"branches": [
"master"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"breaking": true,
"release": "major"
},
{
"revert": true,
"release": "patch"
},
{
"type": "feat",
"release": "minor"
},
{
"type": "fix",
"release": "patch"
},
{
"type": "docs",
"release": "patch"
},
{
"type": "test",
"release": "patch"
},
{
"type": "deps",
"release": "patch"
},
{
"scope": "no-release",
"release": false
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"section": "Trivial Changes"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "deps",
"section": "Dependencies"
},
{
"type": "test",
"section": "Tests"
}
]
}
}
],
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/github",
"@semantic-release/git"
]
},
"scripts": {

@@ -141,4 +57,3 @@ "generate": "protons src/unixfs.proto",

"lint": "aegir lint",
"dep-check": "aegir dep-check -i protons",
"release": "aegir release"
"dep-check": "aegir dep-check"
},

@@ -151,3 +66,3 @@ "dependencies": {

"devDependencies": {
"aegir": "^41.3.2",
"aegir": "^42.2.2",
"protons": "^7.0.2",

@@ -158,6 +73,3 @@ "uint8arrays": "^5.0.0"

"fs": false
},
"typedoc": {
"entryPoint": "./src/index.ts"
}
}

@@ -10,60 +10,11 @@ # ipfs-unixfs <!-- omit in toc -->

## Table of contents <!-- omit in toc -->
# About
- [Install](#install)
- [Browser `<script>` tag](#browser-script-tag)
- [Spec](#spec)
- [Use in Node.js](#use-in-nodejs)
- [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)
- [Examples](#examples)
- [Create a file composed by several blocks](#create-a-file-composed-by-several-blocks)
- [Create a directory that contains several files](#create-a-directory-that-contains-several-files)
- [UnixFS Data Structure](#unixfs-data-structure)
- [create an unixfs Data element](#create-an-unixfs-data-element)
- [add and remove a block size to the block size list](#add-and-remove-a-block-size-to-the-block-size-list)
- [get total fileSize](#get-total-filesize)
- [marshal and unmarshal](#marshal-and-unmarshal)
- [is this UnixFS entry a directory?](#is-this-unixfs-entry-a-directory)
- [has an mtime been set?](#has-an-mtime-been-set)
- [API Docs](#api-docs)
- [License](#license)
- [Contribute](#contribute)
This module contains the protobuf definition of the UnixFS data structure found at the root of all UnixFS DAGs.
## Install
The UnixFS spec can be found in the [ipfs/specs repository](http://github.com/ipfs/specs)
```console
$ npm i ipfs-unixfs
```
## Example - Create a file composed of several blocks
### Browser `<script>` tag
Loading this module through a script tag will make it's exports available as `IpfsUnixfs` in the global namespace.
```html
<script src="https://unpkg.com/ipfs-unixfs/dist/index.min.js"></script>
```
## Spec
The UnixFS spec can be found inside the [ipfs/specs repository](http://github.com/ipfs/specs)
### Use in Node.js
```JavaScript
import { UnixFS } from 'ipfs-unixfs'
```
### Use in a browser with browserify, webpack or any other bundler
The code published to npm that gets loaded on require is in fact a ES5 transpiled version with the right shims added. This means that you can require it and use with your favourite bundler without having to adjust asset management process.
```JavaScript
import { UnixFS } from 'ipfs-unixfs'
```
## Examples
### Create a file composed by several blocks
```JavaScript
const data = new UnixFS({ type: 'file' })

@@ -75,3 +26,3 @@ data.addBlockSize(256) // add the size of each block

### Create a directory that contains several files
## Example - Create a directory that contains several files

@@ -84,39 +35,4 @@ Creating a directory that contains several files is achieve by creating a unixfs element that identifies a MerkleDAG node as a directory. The links of that MerkleDAG node are the files that are contained in this directory.

### UnixFS Data Structure
## Example - Create an unixfs Data element
```protobuf
syntax = "proto2";
message Data {
enum DataType {
Raw = 0;
Directory = 1;
File = 2;
Metadata = 3;
Symlink = 4;
HAMTShard = 5;
}
required DataType Type = 1;
optional bytes Data = 2;
optional uint64 filesize = 3;
repeated uint64 blocksizes = 4;
optional uint64 hashType = 5;
optional uint64 fanout = 6;
optional uint32 mode = 7;
optional UnixTime mtime = 8;
}
message UnixTime {
required int64 Seconds = 1;
optional fixed32 FractionalNanoseconds = 2;
}
message Metadata {
optional string MimeType = 1;
}
```
### create an unixfs Data element
```JavaScript

@@ -140,3 +56,3 @@ const data = new UnixFS([options])

### add and remove a block size to the block size list
## Example - Add and remove a block size to the block size list

@@ -151,3 +67,3 @@ ```JavaScript

### get total fileSize
## Example - Get total fileSize

@@ -158,3 +74,3 @@ ```JavaScript

### marshal and unmarshal
## Example - Marshal and unmarshal

@@ -166,3 +82,3 @@ ```javascript

### is this UnixFS entry a directory?
## Example - Is this UnixFS entry a directory?

@@ -177,3 +93,3 @@ ```JavaScript

### has an mtime been set?
## Example - Has an mtime been set?

@@ -192,7 +108,21 @@ If no modification time has been set, no `mtime` property will be present on the `Data` instance:

## API Docs
# Install
```console
$ npm i ipfs-unixfs
```
## Browser `<script>` tag
Loading this module through a script tag will make it's exports available as `IpfsUnixfs` in the global namespace.
```html
<script src="https://unpkg.com/ipfs-unixfs/dist/index.min.js"></script>
```
# API Docs
- <https://ipfs.github.io/js-ipfs-unixfs/modules/ipfs_unixfs.html>
## License
# License

@@ -204,3 +134,3 @@ Licensed under either of

## Contribute
# Contribute

@@ -207,0 +137,0 @@ Contributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs-unixfs/issues).

@@ -0,1 +1,93 @@

/**
* @packageDocumentation
*
* This module contains the protobuf definition of the UnixFS data structure found at the root of all UnixFS DAGs.
*
* The UnixFS spec can be found in the [ipfs/specs repository](http://github.com/ipfs/specs)
*
* @example Create a file composed of several blocks
*
* ```JavaScript
* const data = new UnixFS({ type: 'file' })
* data.addBlockSize(256) // add the size of each block
* data.addBlockSize(256)
* // ...
* ```
*
* @example Create a directory that contains several files
*
* Creating a directory that contains several files is achieve by creating a unixfs element that identifies a MerkleDAG node as a directory. The links of that MerkleDAG node are the files that are contained in this directory.
*
* ```JavaScript
* const data = new UnixFS({ type: 'directory' })
* ```
*
* @example Create an unixfs Data element
*
* ```JavaScript
* const data = new UnixFS([options])
* ```
*
* `options` is an optional object argument that might include the following keys:
*
* - type (string, default `file`): The type of UnixFS entry. Can be:
* - `raw`
* - `directory`
* - `file`
* - `metadata`
* - `symlink`
* - `hamt-sharded-directory`
* - data (Uint8Array): The optional data field for this node
* - blockSizes (Array, default: `[]`): If this is a `file` node that is made up of multiple blocks, `blockSizes` is a list numbers that represent the size of the file chunks stored in each child node. It is used to calculate the total file size.
* - mode (Number, default `0644` for files, `0755` for directories/hamt-sharded-directories) file mode
* - mtime (`Date`, `{ secs, nsecs }`, `{ Seconds, FractionalNanoseconds }`, `[ secs, nsecs ]`): The modification time of this node
*
* @example Add and remove a block size to the block size list
*
* ```JavaScript
* data.addBlockSize(<size in bytes>)
* ```
*
* ```JavaScript
* data.removeBlockSize(<index>)
* ```
*
* @example Get total fileSize
*
* ```JavaScript
* data.fileSize() // => size in bytes
* ```
*
* @example Marshal and unmarshal
*
* ```javascript
* const marshaled = data.marshal()
* const unmarshaled = Unixfs.unmarshal(marshaled)
* ```
*
* @example Is this UnixFS entry a directory?
*
* ```JavaScript
* const dir = new Data({ type: 'directory' })
* dir.isDirectory() // true
*
* const file = new Data({ type: 'file' })
* file.isDirectory() // false
* ```
*
* @example Has an mtime been set?
*
* If no modification time has been set, no `mtime` property will be present on the `Data` instance:
*
* ```JavaScript
* const file = new Data({ type: 'file' })
* file.mtime // undefined
*
* Object.prototype.hasOwnProperty.call(file, 'mtime') // false
*
* const dir = new Data({ type: 'dir', mtime: new Date() })
* dir.mtime // { secs: Number, nsecs: Number }
* ```
*/
import errcode from 'err-code'

@@ -2,0 +94,0 @@ import { Data as PBData } from './unixfs.js'

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc