Socket
Socket
Sign inDemoInstall

interface-datastore

Package Overview
Dependencies
Maintainers
3
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

interface-datastore - npm Package Compare versions

Comparing version 7.0.3 to 7.0.4

2

dist/index.min.js
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.InterfaceDatastore = factory()}(typeof self !== 'undefined' ? self : this, function () {
"use strict";var InterfaceDatastore=(()=>{var G=Object.defineProperty;var qe=Object.getOwnPropertyDescriptor;var Je=Object.getOwnPropertyNames;var Xe=Object.prototype.hasOwnProperty;var l=(r,e)=>{for(var t in e)G(r,t,{get:e[t],enumerable:!0})},We=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Je(e))!Xe.call(r,o)&&o!==t&&G(r,o,{get:()=>e[o],enumerable:!(n=qe(e,o))||n.enumerable});return r};var Ge=r=>We(G({},"__esModule",{value:!0}),r);var sr={};l(sr,{Key:()=>p});var me=(r=21)=>crypto.getRandomValues(new Uint8Array(r)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),"");var _={};l(_,{identity:()=>Ke});function Qe(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(t[i]!==255)throw new TypeError(s+" is ambiguous");t[i]=o}var c=r.length,d=r.charAt(0),z=Math.log(c)/Math.log(256),b=Math.log(256)/Math.log(c);function L(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length===0)return"";for(var u=0,B=0,g=0,x=a.length;g!==x&&a[g]===0;)g++,u++;for(var y=(x-g)*b+1>>>0,m=new Uint8Array(y);g!==x;){for(var v=a[g],C=0,w=y-1;(v!==0||C<B)&&w!==-1;w--,C++)v+=256*m[w]>>>0,m[w]=v%c>>>0,v=v/c>>>0;if(v!==0)throw new Error("Non-zero carry");B=C,g++}for(var A=y-B;A!==y&&m[A]===0;)A++;for(var R=d.repeat(u);A<y;++A)R+=r.charAt(m[A]);return R}function k(a){if(typeof a!="string")throw new TypeError("Expected String");if(a.length===0)return new Uint8Array;var u=0;if(a[u]!==" "){for(var B=0,g=0;a[u]===d;)B++,u++;for(var x=(a.length-u)*z+1>>>0,y=new Uint8Array(x);a[u];){var m=t[a.charCodeAt(u)];if(m===255)return;for(var v=0,C=x-1;(m!==0||v<g)&&C!==-1;C--,v++)m+=c*y[C]>>>0,y[C]=m%256>>>0,m=m/256>>>0;if(m!==0)throw new Error("Non-zero carry");g=v,u++}if(a[u]!==" "){for(var w=x-g;w!==x&&y[w]===0;)w++;for(var A=new Uint8Array(B+(x-w)),R=B;w!==x;)A[R++]=y[w++];return A}}}function Re(a){var u=k(a);if(u)return u;throw new Error(`Non-${e} character`)}return{encode:L,decodeUnsafe:k,decode:Re}}var He=Qe,Ze=He,ge=Ze;var fr=new Uint8Array(0);var we=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0},U=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 xe=r=>new TextEncoder().encode(r),ye=r=>new TextDecoder().decode(r);var Q=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},H=class{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Se(this,e)}},Z=class{constructor(e){this.decoders=e}or(e){return Se(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Se=(r,e)=>new Z({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),Y=class{constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new Q(e,t,n),this.decoder=new H(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},O=({name:r,prefix:e,encode:t,decode:n})=>new Y(r,e,t,n),T=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:o}=ge(t,e);return O({prefix:r,name:e,encode:n,decode:s=>U(o(s))})},Ye=(r,e,t,n)=>{let o={};for(let b=0;b<e.length;++b)o[e[b]]=b;let s=r.length;for(;r[s-1]==="=";)--s;let i=new Uint8Array(s*t/8|0),c=0,d=0,z=0;for(let b=0;b<s;++b){let L=o[r[b]];if(L===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<t|L,c+=t,c>=8&&(c-=8,i[z++]=255&d>>c)}if(c>=t||255&d<<8-c)throw new SyntaxError("Unexpected end of data");return i},_e=(r,e,t)=>{let n=e[e.length-1]==="=",o=(1<<t)-1,s="",i=0,c=0;for(let d=0;d<r.length;++d)for(c=c<<8|r[d],i+=8;i>t;)i-=t,s+=e[o&c>>i];if(i&&(s+=e[o&c<<t-i]),n)for(;s.length*t&7;)s+="=";return s},f=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>O({prefix:e,name:r,encode(o){return _e(o,n,t)},decode(o){return Ye(o,n,t,r)}});var Ke=O({prefix:"\0",name:"identity",encode:r=>ye(r),decode:r=>xe(r)});var K={};l(K,{base2:()=>et});var et=f({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ee={};l(ee,{base8:()=>tt});var tt=f({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var te={};l(te,{base10:()=>rt});var rt=T({prefix:"9",name:"base10",alphabet:"0123456789"});var re={};l(re,{base16:()=>nt,base16upper:()=>ot});var nt=f({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ot=f({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ne={};l(ne,{base32:()=>M,base32hex:()=>ct,base32hexpad:()=>ht,base32hexpadupper:()=>pt,base32hexupper:()=>ft,base32pad:()=>it,base32padupper:()=>at,base32upper:()=>st,base32z:()=>dt});var M=f({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),st=f({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),it=f({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),at=f({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ct=f({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ft=f({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ht=f({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),pt=f({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),dt=f({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var oe={};l(oe,{base36:()=>ut,base36upper:()=>lt});var ut=T({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),lt=T({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var se={};l(se,{base58btc:()=>S,base58flickr:()=>bt});var S=T({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),bt=T({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ie={};l(ie,{base64:()=>mt,base64pad:()=>gt,base64url:()=>wt,base64urlpad:()=>xt});var mt=f({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),gt=f({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wt=f({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),xt=f({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var ae={};l(ae,{base256emoji:()=>Ut});var Ae=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}"),yt=Ae.reduce((r,e,t)=>(r[t]=e,r),[]),vt=Ae.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function St(r){return r.reduce((e,t)=>(e+=yt[t],e),"")}function At(r){let e=[];for(let t of r){let n=vt[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var Ut=O({prefix:"\u{1F680}",name:"base256emoji",encode:St,decode:At});var pe={};l(pe,{sha256:()=>qt,sha512:()=>Jt});var Et=Ce,Ue=128,Ct=127,Tt=~Ct,Bt=Math.pow(2,31);function Ce(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Bt;)e[t++]=r&255|Ue,r/=128;for(;r&Tt;)e[t++]=r&255|Ue,r>>>=7;return e[t]=r|0,Ce.bytes=t-n+1,e}var Nt=ce,zt=128,Ee=127;function ce(r,n){var t=0,n=n||0,o=0,s=n,i,c=r.length;do{if(s>=c)throw ce.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&Ee)<<o:(i&Ee)*Math.pow(2,o),o+=7}while(i>=zt);return ce.bytes=s-n,t}var Lt=Math.pow(2,7),Ot=Math.pow(2,14),Mt=Math.pow(2,21),Dt=Math.pow(2,28),Vt=Math.pow(2,35),Pt=Math.pow(2,42),It=Math.pow(2,49),$t=Math.pow(2,56),jt=Math.pow(2,63),Ft=function(r){return r<Lt?1:r<Ot?2:r<Mt?3:r<Dt?4:r<Vt?5:r<Pt?6:r<It?7:r<$t?8:r<jt?9:10},kt={encode:Et,decode:Nt,encodingLength:Ft},Rt=kt,I=Rt;var $=(r,e=0)=>[I.decode(r,e),I.decode.bytes],D=(r,e,t=0)=>(I.encode(r,e,t),e),V=r=>I.encodingLength(r);var N=(r,e)=>{let t=e.byteLength,n=V(r),o=n+V(t),s=new Uint8Array(o+t);return D(r,s,0),D(t,s,n),s.set(e,o),new P(r,t,e,s)},Te=r=>{let e=U(r),[t,n]=$(e),[o,s]=$(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new P(t,o,i,e)},Be=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&we(r.bytes,t.bytes)}},P=class{constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var he=({name:r,code:e,encode:t})=>new fe(r,e,t),fe=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?N(this.code,t):t.then(n=>N(this.code,n))}else throw Error("Unknown type, must be binary type")}};var ze=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),qt=he({name:"sha2-256",code:18,encode:ze("SHA-256")}),Jt=he({name:"sha2-512",code:19,encode:ze("SHA-512")});var de={};l(de,{identity:()=>Gt});var Le=0,Xt="identity",Oe=U,Wt=r=>N(Le,Oe(r)),Gt={code:Le,name:Xt,encode:Oe,digest:Wt};var zr=new TextEncoder,Lr=new TextDecoder;var Me=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return Yt(t,ue(r),e||S.encoder);default:return _t(t,ue(r),e||M.encoder)}};var De=new WeakMap,ue=r=>{let e=De.get(r);if(e==null){let t=new Map;return De.set(r,t),t}return e},h=class{constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==F)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Kt)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return h.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=N(e,t);return h.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return h.equals(this,e)}static equals(e,t){let n=t;return n&&e.code===n.code&&e.version===n.version&&Be(e.multihash,n.multihash)}toString(e){return Me(this,e)}toJSON(){return{"/":Me(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof h)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:i}=t;return new h(n,o,s,i||Ve(n,o,s.bytes))}else if(t[er]===!0){let{version:n,multihash:o,code:s}=t,i=Te(o);return h.create(n,s,i)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==F)throw new Error(`Version 0 CID must use dag-pb (code: ${F}) block encoding`);return new h(e,t,n,n.bytes)}case 1:{let o=Ve(e,t,n.bytes);return new h(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return h.create(0,F,e)}static createV1(e,t){return h.create(1,e,t)}static decode(e){let[t,n]=h.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=h.inspectBytes(e),n=t.size-t.multihashSize,o=U(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),i=new P(t.multihashCode,t.digestSize,s,o);return[t.version===0?h.createV0(i):h.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[L,k]=$(e.subarray(t));return t+=k,L},o=n(),s=F;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,c=n(),d=n(),z=t+d,b=z-i;return{version:o,codec:s,multihashCode:c,digestSize:d,multihashSize:b,size:z}}static parse(e,t){let[n,o]=Zt(e,t),s=h.decode(o);return ue(s).set(n,e),s}},Zt=(r,e)=>{switch(r[0]){case"Q":{let t=e||S;return[S.prefix,t.decode(`${S.prefix}${r}`)]}case S.prefix:{let t=e||S;return[S.prefix,t.decode(r)]}case M.prefix:{let t=e||M;return[M.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},Yt=(r,e,t)=>{let{prefix:n}=t;if(n!==S.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o},_t=(r,e,t)=>{let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o},F=112,Kt=18,Ve=(r,e,t)=>{let n=V(r),o=n+V(e),s=new Uint8Array(o+t.byteLength);return D(r,s,0),D(e,s,n),s.set(t,o),s},er=Symbol.for("@ipld/js-cid/CID");var le={..._,...K,...ee,...te,...re,...ne,...oe,...se,...ie,...ae},kr={...pe,...de};function J(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Pe(r=0){return globalThis.Buffer?.allocUnsafe!=null?J(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function $e(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var Ie=$e("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),be=$e("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=Pe(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),tr={utf8:Ie,"utf-8":Ie,hex:le.base16,latin1:be,ascii:be,binary:be,...le},X=tr;function je(r,e="utf8"){let t=X[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}function Fe(r,e="utf8"){let t=X[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?J(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}var E="/",ke=new TextEncoder().encode(E),W=ke[0],p=class{constructor(e,t){if(typeof e=="string")this._buf=Fe(e);else if(e instanceof Uint8Array)this._buf=e;else throw new Error("Invalid key, should be String of Uint8Array");if(t==null&&(t=!0),t&&this.clean(),this._buf.byteLength===0||this._buf[0]!==W)throw new Error("Invalid key")}toString(e="utf8"){return je(this._buf,e)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return`Key(${this.toString()})`}static withNamespaces(e){return new p(e.join(E))}static random(){return new p(me().replace(/-/g,""))}static asKey(e){return e instanceof Uint8Array||typeof e=="string"?new p(e):typeof e.uint8Array=="function"?new p(e.uint8Array()):null}clean(){if((this._buf==null||this._buf.byteLength===0)&&(this._buf=ke),this._buf[0]!==W){let e=new Uint8Array(this._buf.byteLength+1);e.fill(W,0,1),e.set(this._buf,1),this._buf=e}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===W;)this._buf=this._buf.subarray(0,-1)}less(e){let t=this.list(),n=e.list();for(let o=0;o<t.length;o++){if(n.length<o+1)return!1;let s=t[o],i=n[o];if(s<i)return!0;if(s>i)return!1}return t.length<n.length}reverse(){return p.withNamespaces(this.list().slice().reverse())}namespaces(){return this.list()}baseNamespace(){let e=this.namespaces();return e[e.length-1]}list(){return this.toString().split(E).slice(1)}type(){return rr(this.baseNamespace())}name(){return nr(this.baseNamespace())}instance(e){return new p(this.toString()+":"+e)}path(){let e=this.parent().toString();return e.endsWith(E)||(e+=E),e+=this.type(),new p(e)}parent(){let e=this.list();return e.length===1?new p(E):new p(e.slice(0,-1).join(E))}child(e){return this.toString()===E?e:e.toString()===E?this:new p(this.toString()+e.toString(),!1)}isAncestorOf(e){return e.toString()===this.toString()?!1:e.toString().startsWith(this.toString())}isDecendantOf(e){return e.toString()===this.toString()?!1:this.toString().startsWith(e.toString())}isTopLevel(){return this.list().length===1}concat(...e){return p.withNamespaces([...this.namespaces(),...or(e.map(t=>t.namespaces()))])}};function rr(r){let e=r.split(":");return e.length<2?"":e.slice(0,-1).join(":")}function nr(r){let e=r.split(":");return e[e.length-1]}function or(r){return[].concat(...r)}return Ge(sr);})();
"use strict";var InterfaceDatastore=(()=>{var W=Object.defineProperty;var qe=Object.getOwnPropertyDescriptor;var Je=Object.getOwnPropertyNames;var Xe=Object.prototype.hasOwnProperty;var l=(r,e)=>{for(var t in e)W(r,t,{get:e[t],enumerable:!0})},Qe=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Je(e))!Xe.call(r,o)&&o!==t&&W(r,o,{get:()=>e[o],enumerable:!(n=qe(e,o))||n.enumerable});return r};var We=r=>Qe(W({},"__esModule",{value:!0}),r);var sr={};l(sr,{Key:()=>p});var be=(r=21)=>crypto.getRandomValues(new Uint8Array(r)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),"");var _={};l(_,{identity:()=>Ke});function Ge(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(t[i]!==255)throw new TypeError(s+" is ambiguous");t[i]=o}var c=r.length,d=r.charAt(0),z=Math.log(c)/Math.log(256),m=Math.log(256)/Math.log(c);function L(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length===0)return"";for(var u=0,B=0,g=0,x=a.length;g!==x&&a[g]===0;)g++,u++;for(var y=(x-g)*m+1>>>0,b=new Uint8Array(y);g!==x;){for(var v=a[g],C=0,w=y-1;(v!==0||C<B)&&w!==-1;w--,C++)v+=256*b[w]>>>0,b[w]=v%c>>>0,v=v/c>>>0;if(v!==0)throw new Error("Non-zero carry");B=C,g++}for(var A=y-B;A!==y&&b[A]===0;)A++;for(var R=d.repeat(u);A<y;++A)R+=r.charAt(b[A]);return R}function k(a){if(typeof a!="string")throw new TypeError("Expected String");if(a.length===0)return new Uint8Array;var u=0;if(a[u]!==" "){for(var B=0,g=0;a[u]===d;)B++,u++;for(var x=(a.length-u)*z+1>>>0,y=new Uint8Array(x);a[u];){var b=t[a.charCodeAt(u)];if(b===255)return;for(var v=0,C=x-1;(b!==0||v<g)&&C!==-1;C--,v++)b+=c*y[C]>>>0,y[C]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");g=v,u++}if(a[u]!==" "){for(var w=x-g;w!==x&&y[w]===0;)w++;for(var A=new Uint8Array(B+(x-w)),R=B;w!==x;)A[R++]=y[w++];return A}}}function Re(a){var u=k(a);if(u)return u;throw new Error(`Non-${e} character`)}return{encode:L,decodeUnsafe:k,decode:Re}}var He=Ge,Ze=He,ge=Ze;var fr=new Uint8Array(0);var we=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0},U=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 xe=r=>new TextEncoder().encode(r),ye=r=>new TextDecoder().decode(r);var G=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},H=class{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Se(this,e)}},Z=class{constructor(e){this.decoders=e}or(e){return Se(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Se=(r,e)=>new Z({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),Y=class{constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new G(e,t,n),this.decoder=new H(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},O=({name:r,prefix:e,encode:t,decode:n})=>new Y(r,e,t,n),T=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:o}=ge(t,e);return O({prefix:r,name:e,encode:n,decode:s=>U(o(s))})},Ye=(r,e,t,n)=>{let o={};for(let m=0;m<e.length;++m)o[e[m]]=m;let s=r.length;for(;r[s-1]==="=";)--s;let i=new Uint8Array(s*t/8|0),c=0,d=0,z=0;for(let m=0;m<s;++m){let L=o[r[m]];if(L===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<t|L,c+=t,c>=8&&(c-=8,i[z++]=255&d>>c)}if(c>=t||255&d<<8-c)throw new SyntaxError("Unexpected end of data");return i},_e=(r,e,t)=>{let n=e[e.length-1]==="=",o=(1<<t)-1,s="",i=0,c=0;for(let d=0;d<r.length;++d)for(c=c<<8|r[d],i+=8;i>t;)i-=t,s+=e[o&c>>i];if(i&&(s+=e[o&c<<t-i]),n)for(;s.length*t&7;)s+="=";return s},f=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>O({prefix:e,name:r,encode(o){return _e(o,n,t)},decode(o){return Ye(o,n,t,r)}});var Ke=O({prefix:"\0",name:"identity",encode:r=>ye(r),decode:r=>xe(r)});var K={};l(K,{base2:()=>et});var et=f({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ee={};l(ee,{base8:()=>tt});var tt=f({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var te={};l(te,{base10:()=>rt});var rt=T({prefix:"9",name:"base10",alphabet:"0123456789"});var re={};l(re,{base16:()=>nt,base16upper:()=>ot});var nt=f({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ot=f({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ne={};l(ne,{base32:()=>D,base32hex:()=>ct,base32hexpad:()=>ht,base32hexpadupper:()=>pt,base32hexupper:()=>ft,base32pad:()=>it,base32padupper:()=>at,base32upper:()=>st,base32z:()=>dt});var D=f({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),st=f({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),it=f({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),at=f({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ct=f({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ft=f({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ht=f({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),pt=f({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),dt=f({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var oe={};l(oe,{base36:()=>ut,base36upper:()=>lt});var ut=T({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),lt=T({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var se={};l(se,{base58btc:()=>S,base58flickr:()=>mt});var S=T({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mt=T({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ie={};l(ie,{base64:()=>bt,base64pad:()=>gt,base64url:()=>wt,base64urlpad:()=>xt});var bt=f({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),gt=f({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wt=f({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),xt=f({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var ae={};l(ae,{base256emoji:()=>Ut});var Ae=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}"),yt=Ae.reduce((r,e,t)=>(r[t]=e,r),[]),vt=Ae.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function St(r){return r.reduce((e,t)=>(e+=yt[t],e),"")}function At(r){let e=[];for(let t of r){let n=vt[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var Ut=O({prefix:"\u{1F680}",name:"base256emoji",encode:St,decode:At});var pe={};l(pe,{sha256:()=>qt,sha512:()=>Jt});var Et=Ce,Ue=128,Ct=127,Tt=~Ct,Bt=Math.pow(2,31);function Ce(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Bt;)e[t++]=r&255|Ue,r/=128;for(;r&Tt;)e[t++]=r&255|Ue,r>>>=7;return e[t]=r|0,Ce.bytes=t-n+1,e}var Nt=ce,zt=128,Ee=127;function ce(r,n){var t=0,n=n||0,o=0,s=n,i,c=r.length;do{if(s>=c)throw ce.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&Ee)<<o:(i&Ee)*Math.pow(2,o),o+=7}while(i>=zt);return ce.bytes=s-n,t}var Lt=Math.pow(2,7),Ot=Math.pow(2,14),Dt=Math.pow(2,21),Mt=Math.pow(2,28),Vt=Math.pow(2,35),It=Math.pow(2,42),Pt=Math.pow(2,49),$t=Math.pow(2,56),jt=Math.pow(2,63),Ft=function(r){return r<Lt?1:r<Ot?2:r<Dt?3:r<Mt?4:r<Vt?5:r<It?6:r<Pt?7:r<$t?8:r<jt?9:10},kt={encode:Et,decode:Nt,encodingLength:Ft},Rt=kt,P=Rt;var $=(r,e=0)=>[P.decode(r,e),P.decode.bytes],M=(r,e,t=0)=>(P.encode(r,e,t),e),V=r=>P.encodingLength(r);var N=(r,e)=>{let t=e.byteLength,n=V(r),o=n+V(t),s=new Uint8Array(o+t);return M(r,s,0),M(t,s,n),s.set(e,o),new I(r,t,e,s)},Te=r=>{let e=U(r),[t,n]=$(e),[o,s]=$(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new I(t,o,i,e)},Be=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&we(r.bytes,t.bytes)}},I=class{constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var he=({name:r,code:e,encode:t})=>new fe(r,e,t),fe=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?N(this.code,t):t.then(n=>N(this.code,n))}else throw Error("Unknown type, must be binary type")}};var ze=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),qt=he({name:"sha2-256",code:18,encode:ze("SHA-256")}),Jt=he({name:"sha2-512",code:19,encode:ze("SHA-512")});var de={};l(de,{identity:()=>Wt});var Le=0,Xt="identity",Oe=U,Qt=r=>N(Le,Oe(r)),Wt={code:Le,name:Xt,encode:Oe,digest:Qt};var zr=new TextEncoder,Lr=new TextDecoder;var De=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return Yt(t,ue(r),e||S.encoder);default:return _t(t,ue(r),e||D.encoder)}};var Me=new WeakMap,ue=r=>{let e=Me.get(r);if(e==null){let t=new Map;return Me.set(r,t),t}return e},h=class{constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==F)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Kt)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return h.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=N(e,t);return h.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return h.equals(this,e)}static equals(e,t){let n=t;return n&&e.code===n.code&&e.version===n.version&&Be(e.multihash,n.multihash)}toString(e){return De(this,e)}toJSON(){return{"/":De(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof h)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:i}=t;return new h(n,o,s,i||Ve(n,o,s.bytes))}else if(t[er]===!0){let{version:n,multihash:o,code:s}=t,i=Te(o);return h.create(n,s,i)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==F)throw new Error(`Version 0 CID must use dag-pb (code: ${F}) block encoding`);return new h(e,t,n,n.bytes)}case 1:{let o=Ve(e,t,n.bytes);return new h(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return h.create(0,F,e)}static createV1(e,t){return h.create(1,e,t)}static decode(e){let[t,n]=h.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=h.inspectBytes(e),n=t.size-t.multihashSize,o=U(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),i=new I(t.multihashCode,t.digestSize,s,o);return[t.version===0?h.createV0(i):h.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[L,k]=$(e.subarray(t));return t+=k,L},o=n(),s=F;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,c=n(),d=n(),z=t+d,m=z-i;return{version:o,codec:s,multihashCode:c,digestSize:d,multihashSize:m,size:z}}static parse(e,t){let[n,o]=Zt(e,t),s=h.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ue(s).set(n,e),s}},Zt=(r,e)=>{switch(r[0]){case"Q":{let t=e||S;return[S.prefix,t.decode(`${S.prefix}${r}`)]}case S.prefix:{let t=e||S;return[S.prefix,t.decode(r)]}case D.prefix:{let t=e||D;return[D.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},Yt=(r,e,t)=>{let{prefix:n}=t;if(n!==S.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o},_t=(r,e,t)=>{let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o},F=112,Kt=18,Ve=(r,e,t)=>{let n=V(r),o=n+V(e),s=new Uint8Array(o+t.byteLength);return M(r,s,0),M(e,s,n),s.set(t,o),s},er=Symbol.for("@ipld/js-cid/CID");var le={..._,...K,...ee,...te,...re,...ne,...oe,...se,...ie,...ae},kr={...pe,...de};function J(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Ie(r=0){return globalThis.Buffer?.allocUnsafe!=null?J(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function $e(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var Pe=$e("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),me=$e("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=Ie(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),tr={utf8:Pe,"utf-8":Pe,hex:le.base16,latin1:me,ascii:me,binary:me,...le},X=tr;function je(r,e="utf8"){let t=X[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}function Fe(r,e="utf8"){let t=X[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?J(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}var E="/",ke=new TextEncoder().encode(E),Q=ke[0],p=class{constructor(e,t){if(typeof e=="string")this._buf=Fe(e);else if(e instanceof Uint8Array)this._buf=e;else throw new Error("Invalid key, should be String of Uint8Array");if(t==null&&(t=!0),t&&this.clean(),this._buf.byteLength===0||this._buf[0]!==Q)throw new Error("Invalid key")}toString(e="utf8"){return je(this._buf,e)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return`Key(${this.toString()})`}static withNamespaces(e){return new p(e.join(E))}static random(){return new p(be().replace(/-/g,""))}static asKey(e){return e instanceof Uint8Array||typeof e=="string"?new p(e):typeof e.uint8Array=="function"?new p(e.uint8Array()):null}clean(){if((this._buf==null||this._buf.byteLength===0)&&(this._buf=ke),this._buf[0]!==Q){let e=new Uint8Array(this._buf.byteLength+1);e.fill(Q,0,1),e.set(this._buf,1),this._buf=e}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===Q;)this._buf=this._buf.subarray(0,-1)}less(e){let t=this.list(),n=e.list();for(let o=0;o<t.length;o++){if(n.length<o+1)return!1;let s=t[o],i=n[o];if(s<i)return!0;if(s>i)return!1}return t.length<n.length}reverse(){return p.withNamespaces(this.list().slice().reverse())}namespaces(){return this.list()}baseNamespace(){let e=this.namespaces();return e[e.length-1]}list(){return this.toString().split(E).slice(1)}type(){return rr(this.baseNamespace())}name(){return nr(this.baseNamespace())}instance(e){return new p(this.toString()+":"+e)}path(){let e=this.parent().toString();return e.endsWith(E)||(e+=E),e+=this.type(),new p(e)}parent(){let e=this.list();return e.length===1?new p(E):new p(e.slice(0,-1).join(E))}child(e){return this.toString()===E?e:e.toString()===E?this:new p(this.toString()+e.toString(),!1)}isAncestorOf(e){return e.toString()===this.toString()?!1:e.toString().startsWith(this.toString())}isDecendantOf(e){return e.toString()===this.toString()?!1:this.toString().startsWith(e.toString())}isTopLevel(){return this.list().length===1}concat(...e){return p.withNamespaces([...this.namespaces(),...or(e.map(t=>t.namespaces()))])}};function rr(r){let e=r.split(":");return e.length<2?"":e.slice(0,-1).join(":")}function nr(r){let e=r.split(":");return e[e.length-1]}function or(r){return[].concat(...r)}return We(sr);})();
return InterfaceDatastore}));
{
"name": "interface-datastore",
"version": "7.0.3",
"version": "7.0.4",
"description": "datastore interface",

@@ -168,3 +168,3 @@ "license": "Apache-2.0 OR MIT",

"devDependencies": {
"aegir": "^37.9.0"
"aegir": "^38.1.0"
},

@@ -171,0 +171,0 @@ "typedoc": {

@@ -15,3 +15,3 @@ import type {

export interface Options extends StoreOptions{
export interface Options extends StoreOptions {

@@ -18,0 +18,0 @@ }

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