datastore-idb
Advanced tools
Comparing version 2.1.2 to 2.1.3
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.DatastoreIdb = factory()}(typeof self !== 'undefined' ? self : this, function () { | ||
"use strict";var DatastoreIdb=(()=>{var $e=Object.create;var rt=Object.defineProperty;var Ve=Object.getOwnPropertyDescriptor;var Ke=Object.getOwnPropertyNames;var We=Object.getPrototypeOf,Je=Object.prototype.hasOwnProperty;var nt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),v=(e,t)=>{for(var r in t)rt(e,r,{get:t[r],enumerable:!0})},Gt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ke(t))!Je.call(e,o)&&o!==r&&rt(e,o,{get:()=>t[o],enumerable:!(n=Ve(t,o))||n.enumerable});return e};var Xt=(e,t,r)=>(r=e!=null?$e(We(e)):{},Gt(t||!e||!e.__esModule?rt(r,"default",{value:e,enumerable:!0}):r,e)),Ge=e=>Gt(rt({},"__esModule",{value:!0}),e);var Zt=nt((Wn,Qt)=>{"use strict";function Ht(e,t){for(let r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}function Xe(e,t,r){if(!e||typeof e=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof t=="object"&&(r=t,t=""),t&&(r.code=t);try{return Ht(e,r)}catch{r.message=e.message,r.stack=e.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(e)),Ht(new o,r)}}Qt.exports=Xe});var Me=nt((Rs,Ie)=>{var H=1e3,Q=H*60,Z=Q*60,$=Z*24,En=$*7,vn=$*365.25;Ie.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Cn(e);if(r==="number"&&isFinite(e))return t.long?An(e):Sn(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Cn(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*vn;case"weeks":case"week":case"w":return r*En;case"days":case"day":case"d":return r*$;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Z;case"minutes":case"minute":case"mins":case"min":case"m":return r*Q;case"seconds":case"second":case"secs":case"sec":case"s":return r*H;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Sn(e){var t=Math.abs(e);return t>=$?Math.round(e/$)+"d":t>=Z?Math.round(e/Z)+"h":t>=Q?Math.round(e/Q)+"m":t>=H?Math.round(e/H)+"s":e+"ms"}function An(e){var t=Math.abs(e);return t>=$?ft(e,t,$,"day"):t>=Z?ft(e,t,Z,"hour"):t>=Q?ft(e,t,Q,"minute"):t>=H?ft(e,t,H,"second"):e+" ms"}function ft(e,t,r,n){var o=t>=r*1.5;return Math.round(e/r)+" "+n+(o?"s":"")}});var Be=nt((js,ke)=>{function Fn(e){r.debug=r,r.default=r,r.coerce=l,r.disable=s,r.enable=o,r.enabled=i,r.humanize=Me(),r.destroy=x,Object.keys(e).forEach(a=>{r[a]=e[a]}),r.names=[],r.skips=[],r.formatters={};function t(a){let u=0;for(let h=0;h<a.length;h++)u=(u<<5)-u+a.charCodeAt(h),u|=0;return r.colors[Math.abs(u)%r.colors.length]}r.selectColor=t;function r(a){let u,h=null,V,f;function d(...y){if(!d.enabled)return;let w=d,E=Number(new Date),D=E-(u||E);w.diff=D,w.prev=u,w.curr=E,u=E,y[0]=r.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let g=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(I,C)=>{if(I==="%%")return"%";g++;let M=r.formatters[C];if(typeof M=="function"){let K=y[g];I=M.call(w,K),y.splice(g,1),g--}return I}),r.formatArgs.call(w,y),(w.log||r.log).apply(w,y)}return d.namespace=a,d.useColors=r.useColors(),d.color=r.selectColor(a),d.extend=n,d.destroy=r.destroy,Object.defineProperty(d,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(V!==r.namespaces&&(V=r.namespaces,f=r.enabled(a)),f),set:y=>{h=y}}),typeof r.init=="function"&&r.init(d),d}function n(a,u){let h=r(this.namespace+(typeof u>"u"?":":u)+a);return h.log=this.log,h}function o(a){r.save(a),r.namespaces=a,r.names=[],r.skips=[];let u,h=(typeof a=="string"?a:"").split(/[\s,]+/),V=h.length;for(u=0;u<V;u++)h[u]&&(a=h[u].replace(/\*/g,".*?"),a[0]==="-"?r.skips.push(new RegExp("^"+a.slice(1)+"$")):r.names.push(new RegExp("^"+a+"$")))}function s(){let a=[...r.names.map(c),...r.skips.map(c).map(u=>"-"+u)].join(",");return r.enable(""),a}function i(a){if(a[a.length-1]==="*")return!0;let u,h;for(u=0,h=r.skips.length;u<h;u++)if(r.skips[u].test(a))return!1;for(u=0,h=r.names.length;u<h;u++)if(r.names[u].test(a))return!0;return!1}function c(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}function l(a){return a instanceof Error?a.stack||a.message:a}function x(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}ke.exports=Fn});var Ue=nt((A,dt)=>{A.formatArgs=In;A.save=Mn;A.load=kn;A.useColors=Dn;A.storage=Bn();A.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();A.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Dn(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function In(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+dt.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),e.splice(n,0,t)}A.log=console.debug||console.log||(()=>{});function Mn(e){try{e?A.storage.setItem("debug",e):A.storage.removeItem("debug")}catch{}}function kn(){let e;try{e=A.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function Bn(){try{return localStorage}catch{}}dt.exports=Be()(A);var{formatters:Un}=dt.exports;Un.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var Vn={};v(Vn,{IDBDatastore:()=>Jt});var S={};v(S,{abortedError:()=>Qe,dbDeleteFailedError:()=>pt,dbOpenFailedError:()=>Yt,dbReadFailedError:()=>He,dbWriteFailedError:()=>mt,notFoundError:()=>ot});var R=Xt(Zt(),1);function Yt(e){return e=e??new Error("Cannot open database"),(0,R.default)(e,"ERR_DB_OPEN_FAILED")}function pt(e){return e=e??new Error("Delete failed"),(0,R.default)(e,"ERR_DB_DELETE_FAILED")}function mt(e){return e=e??new Error("Write failed"),(0,R.default)(e,"ERR_DB_WRITE_FAILED")}function He(e){return e=e??new Error("Read failed"),(0,R.default)(e,"ERR_DB_READ_FAILED")}function ot(e){return e=e??new Error("Not Found"),(0,R.default)(e,"ERR_NOT_FOUND")}function Qe(e){return e=e??new Error("Aborted"),(0,R.default)(e,"ERR_ABORTED")}var qt=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,r)=>(r&=63,r<36?t+=r.toString(36):r<62?t+=(r-26).toString(36).toUpperCase():r>62?t+="-":t+="_",t),"");var xt={};v(xt,{identity:()=>rr});function Ze(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<e.length;o++){var s=e.charAt(o),i=s.charCodeAt(0);if(r[i]!==255)throw new TypeError(s+" is ambiguous");r[i]=o}var c=e.length,l=e.charAt(0),x=Math.log(c)/Math.log(256),a=Math.log(256)/Math.log(c);function u(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var d=0,y=0,w=0,E=f.length;w!==E&&f[w]===0;)w++,d++;for(var D=(E-w)*a+1>>>0,g=new Uint8Array(D);w!==E;){for(var B=f[w],I=0,C=D-1;(B!==0||I<y)&&C!==-1;C--,I++)B+=256*g[C]>>>0,g[C]=B%c>>>0,B=B/c>>>0;if(B!==0)throw new Error("Non-zero carry");y=I,w++}for(var M=D-y;M!==D&&g[M]===0;)M++;for(var K=l.repeat(d);M<D;++M)K+=e.charAt(g[M]);return K}function h(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var d=0;if(f[d]!==" "){for(var y=0,w=0;f[d]===l;)y++,d++;for(var E=(f.length-d)*x+1>>>0,D=new Uint8Array(E);f[d];){var g=r[f.charCodeAt(d)];if(g===255)return;for(var B=0,I=E-1;(g!==0||B<w)&&I!==-1;I--,B++)g+=c*D[I]>>>0,D[I]=g%256>>>0,g=g/256>>>0;if(g!==0)throw new Error("Non-zero carry");w=B,d++}if(f[d]!==" "){for(var C=E-w;C!==E&&D[C]===0;)C++;for(var M=new Uint8Array(y+(E-C)),K=y;C!==E;)M[K++]=D[C++];return M}}}function V(f){var d=h(f);if(d)return d;throw new Error(`Non-${t} character`)}return{encode:u,decodeUnsafe:h,decode:V}}var Ye=Ze,qe=Ye,te=qe;var Xn=new Uint8Array(0);var ee=(e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0},L=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};var re=e=>new TextEncoder().encode(e),ne=e=>new TextDecoder().decode(e);var yt=class{constructor(t,r,n){this.name=t,this.prefix=r,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},bt=class{constructor(t,r,n){if(this.name=t,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return se(this,t)}},wt=class{constructor(t){this.decoders=t}or(t){return se(this,t)}decode(t){let r=t[0],n=this.decoders[r];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},se=(e,t)=>new wt({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}}),gt=class{constructor(t,r,n,o){this.name=t,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new yt(t,r,n),this.decoder=new bt(t,r,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},W=({name:e,prefix:t,encode:r,decode:n})=>new gt(e,t,r,n),_=({prefix:e,name:t,alphabet:r})=>{let{encode:n,decode:o}=te(r,t);return W({prefix:e,name:t,encode:n,decode:s=>L(o(s))})},tr=(e,t,r,n)=>{let o={};for(let a=0;a<t.length;++a)o[t[a]]=a;let s=e.length;for(;e[s-1]==="=";)--s;let i=new Uint8Array(s*r/8|0),c=0,l=0,x=0;for(let a=0;a<s;++a){let u=o[e[a]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<r|u,c+=r,c>=8&&(c-=8,i[x++]=255&l>>c)}if(c>=r||255&l<<8-c)throw new SyntaxError("Unexpected end of data");return i},er=(e,t,r)=>{let n=t[t.length-1]==="=",o=(1<<r)-1,s="",i=0,c=0;for(let l=0;l<e.length;++l)for(c=c<<8|e[l],i+=8;i>r;)i-=r,s+=t[o&c>>i];if(i&&(s+=t[o&c<<r-i]),n)for(;s.length*r&7;)s+="=";return s},p=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>W({prefix:t,name:e,encode(o){return er(o,n,r)},decode(o){return tr(o,n,r,e)}});var rr=W({prefix:"\0",name:"identity",encode:e=>ne(e),decode:e=>re(e)});var Et={};v(Et,{base2:()=>nr});var nr=p({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var vt={};v(vt,{base8:()=>or});var or=p({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Ct={};v(Ct,{base10:()=>sr});var sr=_({prefix:"9",name:"base10",alphabet:"0123456789"});var St={};v(St,{base16:()=>ir,base16upper:()=>ar});var ir=p({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ar=p({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var At={};v(At,{base32:()=>P,base32hex:()=>fr,base32hexpad:()=>hr,base32hexpadupper:()=>pr,base32hexupper:()=>dr,base32pad:()=>ur,base32padupper:()=>lr,base32upper:()=>cr,base32z:()=>mr});var P=p({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),cr=p({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ur=p({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),lr=p({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),fr=p({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),dr=p({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),hr=p({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),pr=p({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),mr=p({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ft={};v(Ft,{base36:()=>yr,base36upper:()=>br});var yr=_({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),br=_({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Dt={};v(Dt,{base58btc:()=>k,base58flickr:()=>wr});var k=_({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),wr=_({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Mt={};v(Mt,{base64:()=>It,base64pad:()=>gr,base64url:()=>xr,base64urlpad:()=>Er});var It=p({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),gr=p({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),xr=p({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Er=p({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var kt={};v(kt,{base256emoji:()=>Fr});var ie=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}"),vr=ie.reduce((e,t,r)=>(e[r]=t,e),[]),Cr=ie.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);function Sr(e){return e.reduce((t,r)=>(t+=vr[r],t),"")}function Ar(e){let t=[];for(let r of e){let n=Cr[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);t.push(n)}return new Uint8Array(t)}var Fr=W({prefix:"\u{1F680}",name:"base256emoji",encode:Sr,decode:Ar});var Tt={};v(Tt,{sha256:()=>Wr,sha512:()=>Jr});var Dr=ue,ae=128,Ir=127,Mr=~Ir,kr=Math.pow(2,31);function ue(e,t,r){t=t||[],r=r||0;for(var n=r;e>=kr;)t[r++]=e&255|ae,e/=128;for(;e&Mr;)t[r++]=e&255|ae,e>>>=7;return t[r]=e|0,ue.bytes=r-n+1,t}var Br=Bt,Ur=128,ce=127;function Bt(e,n){var r=0,n=n||0,o=0,s=n,i,c=e.length;do{if(s>=c)throw Bt.bytes=0,new RangeError("Could not decode varint");i=e[s++],r+=o<28?(i&ce)<<o:(i&ce)*Math.pow(2,o),o+=7}while(i>=Ur);return Bt.bytes=s-n,r}var Nr=Math.pow(2,7),Tr=Math.pow(2,14),Lr=Math.pow(2,21),Or=Math.pow(2,28),_r=Math.pow(2,35),Pr=Math.pow(2,42),Rr=Math.pow(2,49),jr=Math.pow(2,56),zr=Math.pow(2,63),$r=function(e){return e<Nr?1:e<Tr?2:e<Lr?3:e<Or?4:e<_r?5:e<Pr?6:e<Rr?7:e<jr?8:e<zr?9:10},Vr={encode:Dr,decode:Br,encodingLength:$r},Kr=Vr,Y=Kr;var q=(e,t=0)=>[Y.decode(e,t),Y.decode.bytes],J=(e,t,r=0)=>(Y.encode(e,t,r),t),G=e=>Y.encodingLength(e);var j=(e,t)=>{let r=t.byteLength,n=G(e),o=n+G(r),s=new Uint8Array(o+r);return J(e,s,0),J(r,s,n),s.set(t,o),new X(e,r,t,s)},le=e=>{let t=L(e),[r,n]=q(t),[o,s]=q(t.subarray(n)),i=t.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new X(r,o,i,t)},fe=(e,t)=>{if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&ee(e.bytes,r.bytes)}},X=class{constructor(t,r,n,o){this.code=t,this.size=r,this.digest=n,this.bytes=o}};var Nt=({name:e,code:t,encode:r})=>new Ut(e,t,r),Ut=class{constructor(t,r,n){this.name=t,this.code=r,this.encode=n}digest(t){if(t instanceof Uint8Array){let r=this.encode(t);return r instanceof Uint8Array?j(this.code,r):r.then(n=>j(this.code,n))}else throw Error("Unknown type, must be binary type")}};var he=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Wr=Nt({name:"sha2-256",code:18,encode:he("SHA-256")}),Jr=Nt({name:"sha2-512",code:19,encode:he("SHA-512")});var Lt={};v(Lt,{identity:()=>Hr});var pe=0,Gr="identity",me=L,Xr=e=>j(pe,me(e)),Hr={code:pe,name:Gr,encode:me,digest:Xr};var yo=new TextEncoder,bo=new TextDecoder;var ye=(e,t)=>{let{bytes:r,version:n}=e;switch(n){case 0:return qr(r,Ot(e),t||k.encoder);default:return tn(r,Ot(e),t||P.encoder)}};var be=new WeakMap,Ot=e=>{let t=be.get(e);if(t==null){let r=new Map;return be.set(e,r),r}return t},b=class{constructor(t,r,n,o){this.code=r,this.version=t,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==et)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==en)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return b.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=j(t,r);return b.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return b.equals(this,t)}static equals(t,r){let n=r;return n&&t.code===n.code&&t.version===n.version&&fe(t.multihash,n.multihash)}toString(t){return ye(this,t)}toJSON(){return{"/":ye(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof b)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:s,bytes:i}=r;return new b(n,o,s,i||we(n,o,s.bytes))}else if(r[rn]===!0){let{version:n,multihash:o,code:s}=r,i=le(o);return b.create(n,s,i)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==et)throw new Error(`Version 0 CID must use dag-pb (code: ${et}) block encoding`);return new b(t,r,n,n.bytes)}case 1:{let o=we(t,r,n.bytes);return new b(t,r,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return b.create(0,et,t)}static createV1(t,r){return b.create(1,t,r)}static decode(t){let[r,n]=b.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=b.inspectBytes(t),n=r.size-r.multihashSize,o=L(t.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=o.subarray(r.multihashSize-r.digestSize),i=new X(r.multihashCode,r.digestSize,s,o);return[r.version===0?b.createV0(i):b.createV1(r.codec,i),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[u,h]=q(t.subarray(r));return r+=h,u},o=n(),s=et;if(o===18?(o=0,r=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=r,c=n(),l=n(),x=r+l,a=x-i;return{version:o,codec:s,multihashCode:c,digestSize:l,multihashSize:a,size:x}}static parse(t,r){let[n,o]=Yr(t,r),s=b.decode(o);if(s.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ot(s).set(n,t),s}},Yr=(e,t)=>{switch(e[0]){case"Q":{let r=t||k;return[k.prefix,r.decode(`${k.prefix}${e}`)]}case k.prefix:{let r=t||k;return[k.prefix,r.decode(e)]}case P.prefix:{let r=t||P;return[P.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}},qr=(e,t,r)=>{let{prefix:n}=r;if(n!==k.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=t.get(n);if(o==null){let s=r.encode(e).slice(1);return t.set(n,s),s}else return o},tn=(e,t,r)=>{let{prefix:n}=r,o=t.get(n);if(o==null){let s=r.encode(e);return t.set(n,s),s}else return o},et=112,en=18,we=(e,t,r)=>{let n=G(e),o=n+G(t),s=new Uint8Array(o+r.byteLength);return J(e,s,0),J(t,s,n),s.set(r,o),s},rn=Symbol.for("@ipld/js-cid/CID");var _t={...xt,...Et,...vt,...Ct,...St,...At,...Ft,...Dt,...Mt,...kt},Do={...Tt,...Lt};function it(e){return globalThis.Buffer!=null?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function ge(e=0){return globalThis.Buffer?.allocUnsafe!=null?it(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function Ee(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}var xe=Ee("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),Pt=Ee("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{e=e.substring(1);let t=ge(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),nn={utf8:xe,"utf-8":xe,hex:_t.base16,latin1:Pt,ascii:Pt,binary:Pt,..._t},at=nn;function ve(e,t="utf8"){let r=at[t];if(r==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?it(globalThis.Buffer.from(e,"utf-8")):r.decoder.decode(`${r.prefix}${e}`)}function Ce(e,t="utf8"){let r=at[t];if(r==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"):r.encoder.encode(e).substring(1)}var O="/",Se=new TextEncoder().encode(O),ct=Se[0],m=class{_buf;constructor(t,r){if(typeof t=="string")this._buf=ve(t);else if(t instanceof Uint8Array)this._buf=t;else throw new Error("Invalid key, should be String of Uint8Array");if(r==null&&(r=!0),r&&this.clean(),this._buf.byteLength===0||this._buf[0]!==ct)throw new Error("Invalid key")}toString(t="utf8"){return Ce(this._buf,t)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return`Key(${this.toString()})`}static withNamespaces(t){return new m(t.join(O))}static random(){return new m(qt().replace(/-/g,""))}static asKey(t){return t instanceof Uint8Array||typeof t=="string"?new m(t):typeof t.uint8Array=="function"?new m(t.uint8Array()):null}clean(){if((this._buf==null||this._buf.byteLength===0)&&(this._buf=Se),this._buf[0]!==ct){let t=new Uint8Array(this._buf.byteLength+1);t.fill(ct,0,1),t.set(this._buf,1),this._buf=t}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===ct;)this._buf=this._buf.subarray(0,-1)}less(t){let r=this.list(),n=t.list();for(let o=0;o<r.length;o++){if(n.length<o+1)return!1;let s=r[o],i=n[o];if(s<i)return!0;if(s>i)return!1}return r.length<n.length}reverse(){return m.withNamespaces(this.list().slice().reverse())}namespaces(){return this.list()}baseNamespace(){let t=this.namespaces();return t[t.length-1]}list(){return this.toString().split(O).slice(1)}type(){return on(this.baseNamespace())}name(){return sn(this.baseNamespace())}instance(t){return new m(this.toString()+":"+t)}path(){let t=this.parent().toString();return t.endsWith(O)||(t+=O),t+=this.type(),new m(t)}parent(){let t=this.list();return t.length===1?new m(O):new m(t.slice(0,-1).join(O))}child(t){return this.toString()===O?t:t.toString()===O?this:new m(this.toString()+t.toString(),!1)}isAncestorOf(t){return t.toString()===this.toString()?!1:t.toString().startsWith(this.toString())}isDecendantOf(t){return t.toString()===this.toString()?!1:this.toString().startsWith(t.toString())}isTopLevel(){return this.list().length===1}concat(...t){return m.withNamespaces([...this.namespaces(),...an(t.map(r=>r.namespaces()))])}};function on(e){let t=e.split(":");return t.length<2?"":t.slice(0,-1).join(":")}function sn(e){let t=e.split(":");return t[t.length-1]}function an(e){return[].concat(...e)}var Ae="SHARDING";function un(e){return e[Symbol.asyncIterator]!=null}function ln(e){if(un(e))return(async()=>{for await(let t of e);})();for(let t of e);}var ut=ln;function fn(e){let[t,r]=e[Symbol.asyncIterator]!=null?[e[Symbol.asyncIterator](),Symbol.asyncIterator]:[e[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>t.next(),push:o=>{n.push(o)},next:()=>n.length>0?{done:!1,value:n.shift()}:t.next(),[r](){return this}}}var Rt=fn;function dn(e){return e[Symbol.asyncIterator]!=null}function hn(e,t){if(dn(e))return async function*(){for await(let c of e)await t(c)&&(yield c)}();let r=Rt(e),{value:n,done:o}=r.next();if(o===!0)return function*(){}();let s=t(n);if(typeof s.then=="function")return async function*(){await s&&(yield n);for await(let c of r)await t(c)&&(yield c)}();let i=t;return function*(){s===!0&&(yield n);for(let c of r)i(c)&&(yield c)}()}var U=hn;function pn(e){return e[Symbol.asyncIterator]!=null}function mn(e){if(pn(e))return(async()=>{let r=[];for await(let n of e)r.push(n);return r})();let t=[];for(let r of e)t.push(r);return t}var jt=mn;function yn(e){return e[Symbol.asyncIterator]!=null}function bn(e,t){return yn(e)?async function*(){yield*(await jt(e)).sort(t)}():function*(){yield*jt(e).sort(t)}()}var z=bn;function wn(e){return e[Symbol.asyncIterator]!=null}function gn(e,t){return wn(e)?async function*(){let r=0;if(!(t<1)){for await(let n of e)if(yield n,r++,r===t)return}}():function*(){let r=0;if(!(t<1)){for(let n of e)if(yield n,r++,r===t)return}}()}var lt=gn;var T=class{put(t,r,n){return Promise.reject(new Error(".put is not implemented"))}get(t,r){return Promise.reject(new Error(".get is not implemented"))}has(t,r){return Promise.reject(new Error(".has is not implemented"))}delete(t,r){return Promise.reject(new Error(".delete is not implemented"))}async*putMany(t,r={}){for await(let{key:n,value:o}of t)await this.put(n,o,r),yield n}async*getMany(t,r={}){for await(let n of t)yield{key:n,value:await this.get(n,r)}}async*deleteMany(t,r={}){for await(let n of t)await this.delete(n,r),yield n}batch(){let t=[],r=[];return{put(n,o){t.push({key:n,value:o})},delete(n){r.push(n)},commit:async n=>{await ut(this.putMany(t,n)),t=[],await ut(this.deleteMany(r,n)),r=[]}}}async*_all(t,r){throw new Error("._all is not implemented")}async*_allKeys(t,r){throw new Error("._allKeys is not implemented")}query(t,r){let n=this._all(t,r);if(t.prefix!=null){let o=t.prefix;n=U(n,s=>s.key.toString().startsWith(o))}if(Array.isArray(t.filters)&&(n=t.filters.reduce((o,s)=>U(o,s),n)),Array.isArray(t.orders)&&(n=t.orders.reduce((o,s)=>z(o,s),n)),t.offset!=null){let o=0,s=t.offset;n=U(n,()=>o++>=s)}return t.limit!=null&&(n=lt(n,t.limit)),n}queryKeys(t,r){let n=this._allKeys(t,r);if(t.prefix!=null){let o=t.prefix;n=U(n,s=>s.toString().startsWith(o))}if(Array.isArray(t.filters)&&(n=t.filters.reduce((o,s)=>U(o,s),n)),Array.isArray(t.orders)&&(n=t.orders.reduce((o,s)=>z(o,s),n)),t.offset!=null){let o=t.offset,s=0;n=U(n,()=>s++>=o)}return t.limit!=null&&(n=lt(n,t.limit)),n}};var Bs=new m(Ae);var F=Xt(Ue(),1);F.default.formatters.b=e=>e==null?"undefined":k.baseEncode(e);F.default.formatters.t=e=>e==null?"undefined":P.baseEncode(e);F.default.formatters.m=e=>e==null?"undefined":It.baseEncode(e);F.default.formatters.p=e=>e==null?"undefined":e.toString();F.default.formatters.c=e=>e==null?"undefined":e.toString();F.default.formatters.k=e=>e==null?"undefined":e.toString();F.default.formatters.a=e=>e==null?"undefined":e.toString();function Nn(e){let t=()=>{};return t.enabled=!1,t.color="",t.diff=0,t.log=()=>{},t.namespace=e,t.destroy=()=>!0,t.extend=()=>t,t}function Ne(e){let t=Nn(`${e}:trace`);return F.default.enabled(`${e}:trace`)&&F.default.names.map(r=>r.toString()).find(r=>r.includes(":trace"))!=null&&(t=(0,F.default)(`${e}:trace`)),Object.assign((0,F.default)(e),{error:(0,F.default)(`${e}:error`),trace:t})}var Hs=Ne("datastore:core:tiered");var Tn=(e,t)=>t.some(r=>e instanceof r),Te,Le;function Ln(){return Te||(Te=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function On(){return Le||(Le=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Oe=new WeakMap,$t=new WeakMap,_e=new WeakMap,zt=new WeakMap,Kt=new WeakMap;function _n(e){let t=new Promise((r,n)=>{let o=()=>{e.removeEventListener("success",s),e.removeEventListener("error",i)},s=()=>{r(N(e.result)),o()},i=()=>{n(e.error),o()};e.addEventListener("success",s),e.addEventListener("error",i)});return t.then(r=>{r instanceof IDBCursor&&Oe.set(r,e)}).catch(()=>{}),Kt.set(t,e),t}function Pn(e){if($t.has(e))return;let t=new Promise((r,n)=>{let o=()=>{e.removeEventListener("complete",s),e.removeEventListener("error",i),e.removeEventListener("abort",i)},s=()=>{r(),o()},i=()=>{n(e.error||new DOMException("AbortError","AbortError")),o()};e.addEventListener("complete",s),e.addEventListener("error",i),e.addEventListener("abort",i)});$t.set(e,t)}var Vt={get(e,t,r){if(e instanceof IDBTransaction){if(t==="done")return $t.get(e);if(t==="objectStoreNames")return e.objectStoreNames||_e.get(e);if(t==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return N(e[t])},set(e,t,r){return e[t]=r,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function Pe(e){Vt=e(Vt)}function Rn(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...r){let n=e.call(ht(this),t,...r);return _e.set(n,t.sort?t.sort():[t]),N(n)}:On().includes(e)?function(...t){return e.apply(ht(this),t),N(Oe.get(this))}:function(...t){return N(e.apply(ht(this),t))}}function jn(e){return typeof e=="function"?Rn(e):(e instanceof IDBTransaction&&Pn(e),Tn(e,Ln())?new Proxy(e,Vt):e)}function N(e){if(e instanceof IDBRequest)return _n(e);if(zt.has(e))return zt.get(e);let t=jn(e);return t!==e&&(zt.set(e,t),Kt.set(t,e)),t}var ht=e=>Kt.get(e);function je(e,t,{blocked:r,upgrade:n,blocking:o,terminated:s}={}){let i=indexedDB.open(e,t),c=N(i);return n&&i.addEventListener("upgradeneeded",l=>{n(N(i.result),l.oldVersion,l.newVersion,N(i.transaction),l)}),r&&i.addEventListener("blocked",l=>r(l.oldVersion,l.newVersion,l)),c.then(l=>{s&&l.addEventListener("close",()=>s()),o&&l.addEventListener("versionchange",x=>o(x.oldVersion,x.newVersion,x))}).catch(()=>{}),c}function ze(e,{blocked:t}={}){let r=indexedDB.deleteDatabase(e);return t&&r.addEventListener("blocked",n=>t(n.oldVersion,n)),N(r).then(()=>{})}var zn=["get","getKey","getAll","getAllKeys","count"],$n=["put","add","delete","clear"],Wt=new Map;function Re(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Wt.get(t))return Wt.get(t);let r=t.replace(/FromIndex$/,""),n=t!==r,o=$n.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(o||zn.includes(r)))return;let s=async function(i,...c){let l=this.transaction(i,o?"readwrite":"readonly"),x=l.store;return n&&(x=x.index(c.shift())),(await Promise.all([x[r](...c),o&&l.done]))[0]};return Wt.set(t,s),s}Pe(e=>({...e,get:(t,r,n)=>Re(t,r)||e.get(t,r,n),has:(t,r)=>!!Re(t,r)||e.has(t,r)}));var Jt=class extends T{location;version;db;constructor(t,r={}){super(),this.location=`${r.prefix??""}${t}`,this.version=r.version??1}async open(){try{let t=this.location;this.db=await je(t,this.version,{upgrade(r){r.createObjectStore(t)}})}catch(t){throw S.dbOpenFailedError(t)}}async close(){this.db?.close()}async put(t,r){if(this.db==null)throw new Error("Datastore needs to be opened.");try{return await this.db.put(this.location,r,t.toString()),t}catch(n){throw S.dbWriteFailedError(n)}}async get(t){if(this.db==null)throw new Error("Datastore needs to be opened.");let r;try{r=await this.db.get(this.location,t.toString())}catch(n){throw S.dbReadFailedError(n)}if(r===void 0)throw S.notFoundError();return r}async has(t){if(this.db==null)throw new Error("Blockstore needs to be opened.");try{return!!await this.db.getKey(this.location,t.toString())}catch(r){throw S.dbReadFailedError(r)}}async delete(t){if(this.db==null)throw new Error("Datastore needs to be opened.");try{await this.db.delete(this.location,t.toString())}catch(r){throw S.dbWriteFailedError(r)}}batch(){let t=[],r=[];return{put(n,o){t.push({key:n,value:o})},delete(n){r.push(n)},commit:async()=>{if(this.db==null)throw new Error("Datastore needs to be opened.");let n=this.db.transaction(this.location,"readwrite");try{let o=t.filter(({key:s})=>r.find(i=>i.toString()===s.toString())==null).map(s=>async()=>{await n.store.put(s.value,s.key.toString())}).concat(r.map(s=>async()=>{await n.store.delete(s.toString())})).concat(async()=>{await n.done});await Promise.all(o.map(async s=>{await s()}))}catch{n.abort()}}}}async*query(t){let r=this.#t(t,(n,o)=>({key:n,value:o}));Array.isArray(t.filters)&&(r=t.filters.reduce((n,o)=>U(n,o),r)),Array.isArray(t.orders)&&(r=t.orders.reduce((n,o)=>z(n,o),r)),yield*r}async*queryKeys(t){let r=this.#t(t,n=>n);Array.isArray(t.filters)&&(r=t.filters.reduce((n,o)=>U(n,o),r)),Array.isArray(t.orders)&&(r=t.orders.reduce((n,o)=>z(n,o),r)),yield*r}async*#t(t,r){if(this.db==null)throw new Error("Datastore needs to be opened.");let n=0,o=-1;for(let s of await this.db.getAllKeys(this.location)){if(t.prefix!=null&&!s.toString().startsWith(t.prefix))continue;if(t.limit!=null&&n===t.limit)return;if(o++,t.offset!=null&&o<t.offset)continue;let i=new m(s.toString()),c;try{c=await this.get(i)}catch(l){if(l.code!=="ERR_NOT_FOUND")throw l;continue}c!=null&&(yield r(i,c),n++)}}async destroy(){await ze(this.location)}};return Ge(Vn);})(); | ||
"use strict";var DatastoreIdb=(()=>{var er=Object.create;var re=Object.defineProperty;var tr=Object.getOwnPropertyDescriptor;var rr=Object.getOwnPropertyNames;var nr=Object.getPrototypeOf,or=Object.prototype.hasOwnProperty;var ne=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),F=(t,e)=>{for(var r in e)re(t,r,{get:e[r],enumerable:!0})},Ye=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of rr(e))!or.call(t,o)&&o!==r&&re(t,o,{get:()=>e[o],enumerable:!(n=tr(e,o))||n.enumerable});return t};var qe=(t,e,r)=>(r=t!=null?er(nr(t)):{},Ye(e||!t||!t.__esModule?re(r,"default",{value:t,enumerable:!0}):r,t)),sr=t=>Ye(re({},"__esModule",{value:!0}),t);var rt=ne((fo,tt)=>{"use strict";function et(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function ir(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return et(t,r)}catch{r.message=t.message,r.stack=t.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(t)),et(new o,r)}}tt.exports=ir});var Tt=ne((ii,Nt)=>{var Q=1e3,Z=Q*60,H=Z*60,K=H*24,Tn=K*7,On=K*365.25;Nt.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Ln(t);if(r==="number"&&isFinite(t))return e.long?_n(t):Pn(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Ln(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*On;case"weeks":case"week":case"w":return r*Tn;case"days":case"day":case"d":return r*K;case"hours":case"hour":case"hrs":case"hr":case"h":return r*H;case"minutes":case"minute":case"mins":case"min":case"m":return r*Z;case"seconds":case"second":case"secs":case"sec":case"s":return r*Q;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Pn(t){var e=Math.abs(t);return e>=K?Math.round(t/K)+"d":e>=H?Math.round(t/H)+"h":e>=Z?Math.round(t/Z)+"m":e>=Q?Math.round(t/Q)+"s":t+"ms"}function _n(t){var e=Math.abs(t);return e>=K?de(t,e,K,"day"):e>=H?de(t,e,H,"hour"):e>=Z?de(t,e,Z,"minute"):e>=Q?de(t,e,Q,"second"):t+" ms"}function de(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var Lt=ne((ai,Ot)=>{function Rn(t){r.debug=r,r.default=r,r.coerce=u,r.disable=s,r.enable=o,r.enabled=i,r.humanize=Tt(),r.destroy=S,Object.keys(t).forEach(c=>{r[c]=t[c]}),r.names=[],r.skips=[],r.formatters={};function e(c){let l=0;for(let y=0;y<c.length;y++)l=(l<<5)-l+c.charCodeAt(y),l|=0;return r.colors[Math.abs(l)%r.colors.length]}r.selectColor=e;function r(c){let l,y=null,_,f;function d(...m){if(!d.enabled)return;let h=d,b=Number(new Date),g=b-(l||b);h.diff=g,h.prev=l,h.curr=b,l=b,m[0]=r.coerce(m[0]),typeof m[0]!="string"&&m.unshift("%O");let p=0;m[0]=m[0].replace(/%([a-zA-Z%])/g,(C,w)=>{if(C==="%%")return"%";p++;let v=r.formatters[w];if(typeof v=="function"){let M=m[p];C=v.call(h,M),m.splice(p,1),p--}return C}),r.formatArgs.call(h,m),(h.log||r.log).apply(h,m)}return d.namespace=c,d.useColors=r.useColors(),d.color=r.selectColor(c),d.extend=n,d.destroy=r.destroy,Object.defineProperty(d,"enabled",{enumerable:!0,configurable:!1,get:()=>y!==null?y:(_!==r.namespaces&&(_=r.namespaces,f=r.enabled(c)),f),set:m=>{y=m}}),typeof r.init=="function"&&r.init(d),d}function n(c,l){let y=r(this.namespace+(typeof l>"u"?":":l)+c);return y.log=this.log,y}function o(c){r.save(c),r.namespaces=c,r.names=[],r.skips=[];let l,y=(typeof c=="string"?c:"").split(/[\s,]+/),_=y.length;for(l=0;l<_;l++)y[l]&&(c=y[l].replace(/\*/g,".*?"),c[0]==="-"?r.skips.push(new RegExp("^"+c.slice(1)+"$")):r.names.push(new RegExp("^"+c+"$")))}function s(){let c=[...r.names.map(a),...r.skips.map(a).map(l=>"-"+l)].join(",");return r.enable(""),c}function i(c){if(c[c.length-1]==="*")return!0;let l,y;for(l=0,y=r.skips.length;l<y;l++)if(r.skips[l].test(c))return!1;for(l=0,y=r.names.length;l<y;l++)if(r.names[l].test(c))return!0;return!1}function a(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}function u(c){return c instanceof Error?c.stack||c.message:c}function S(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}Ot.exports=Rn});var Pt=ne((I,he)=>{I.formatArgs=jn;I.save=$n;I.load=Kn;I.useColors=zn;I.storage=Vn();I.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();I.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function zn(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function jn(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+he.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}I.log=console.debug||console.log||(()=>{});function $n(t){try{t?I.storage.setItem("debug",t):I.storage.removeItem("debug")}catch{}}function Kn(){let t;try{t=I.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function Vn(){try{return localStorage}catch{}}he.exports=Lt()(I);var{formatters:Wn}=he.exports;Wn.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var ao={};F(ao,{IDBDatastore:()=>He});var D={};F(D,{abortedError:()=>cr,dbDeleteFailedError:()=>me,dbOpenFailedError:()=>nt,dbReadFailedError:()=>ar,dbWriteFailedError:()=>ye,notFoundError:()=>oe});var z=qe(rt(),1);function nt(t){return t=t??new Error("Cannot open database"),(0,z.default)(t,"ERR_DB_OPEN_FAILED")}function me(t){return t=t??new Error("Delete failed"),(0,z.default)(t,"ERR_DB_DELETE_FAILED")}function ye(t){return t=t??new Error("Write failed"),(0,z.default)(t,"ERR_DB_WRITE_FAILED")}function ar(t){return t=t??new Error("Read failed"),(0,z.default)(t,"ERR_DB_READ_FAILED")}function oe(t){return t=t??new Error("Not Found"),(0,z.default)(t,"ERR_NOT_FOUND")}function cr(t){return t=t??new Error("Aborted"),(0,z.default)(t,"ERR_ABORTED")}var ot=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),"");function se(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var ve={};F(ve,{identity:()=>pr});function fr(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<t.length;o++){var s=t.charAt(o),i=s.charCodeAt(0);if(r[i]!==255)throw new TypeError(s+" is ambiguous");r[i]=o}var a=t.length,u=t.charAt(0),S=Math.log(a)/Math.log(256),c=Math.log(256)/Math.log(a);function l(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var d=0,m=0,h=0,b=f.length;h!==b&&f[h]===0;)h++,d++;for(var g=(b-h)*c+1>>>0,p=new Uint8Array(g);h!==b;){for(var x=f[h],C=0,w=g-1;(x!==0||C<m)&&w!==-1;w--,C++)x+=256*p[w]>>>0,p[w]=x%a>>>0,x=x/a>>>0;if(x!==0)throw new Error("Non-zero carry");m=C,h++}for(var v=g-m;v!==g&&p[v]===0;)v++;for(var M=u.repeat(d);v<g;++v)M+=t.charAt(p[v]);return M}function y(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var d=0;if(f[d]!==" "){for(var m=0,h=0;f[d]===u;)m++,d++;for(var b=(f.length-d)*S+1>>>0,g=new Uint8Array(b);f[d];){var p=r[f.charCodeAt(d)];if(p===255)return;for(var x=0,C=b-1;(p!==0||x<h)&&C!==-1;C--,x++)p+=a*g[C]>>>0,g[C]=p%256>>>0,p=p/256>>>0;if(p!==0)throw new Error("Non-zero carry");h=x,d++}if(f[d]!==" "){for(var w=b-h;w!==b&&g[w]===0;)w++;for(var v=new Uint8Array(m+(b-w)),M=m;w!==b;)v[M++]=g[w++];return v}}}function _(f){var d=y(f);if(d)return d;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:y,decode:_}}var ur=fr,lr=ur,st=lr;var po=new Uint8Array(0);var it=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},L=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};var at=t=>new TextEncoder().encode(t),ct=t=>new TextDecoder().decode(t);var be=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},we=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return ut(this,e)}},ge=class{constructor(e){this.decoders=e}or(e){return ut(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},ut=(t,e)=>new ge({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),xe=class{constructor(e,r,n,o){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new be(e,r,n),this.decoder=new we(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},V=({name:t,prefix:e,encode:r,decode:n})=>new xe(t,e,r,n),R=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:o}=st(r,e);return V({prefix:t,name:e,encode:n,decode:s=>L(o(s))})},dr=(t,e,r,n)=>{let o={};for(let c=0;c<e.length;++c)o[e[c]]=c;let s=t.length;for(;t[s-1]==="=";)--s;let i=new Uint8Array(s*r/8|0),a=0,u=0,S=0;for(let c=0;c<s;++c){let l=o[t[c]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|l,a+=r,a>=8&&(a-=8,i[S++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return i},hr=(t,e,r)=>{let n=e[e.length-1]==="=",o=(1<<r)-1,s="",i=0,a=0;for(let u=0;u<t.length;++u)for(a=a<<8|t[u],i+=8;i>r;)i-=r,s+=e[o&a>>i];if(i&&(s+=e[o&a<<r-i]),n)for(;s.length*r&7;)s+="=";return s},E=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>V({prefix:e,name:t,encode(o){return hr(o,n,r)},decode(o){return dr(o,n,r,t)}});var pr=V({prefix:"\0",name:"identity",encode:t=>ct(t),decode:t=>at(t)});var Ee={};F(Ee,{base2:()=>mr});var mr=E({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ce={};F(Ce,{base8:()=>yr});var yr=E({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Se={};F(Se,{base10:()=>br});var br=R({prefix:"9",name:"base10",alphabet:"0123456789"});var Ae={};F(Ae,{base16:()=>wr,base16upper:()=>gr});var wr=E({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),gr=E({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Fe={};F(Fe,{base32:()=>W,base32hex:()=>Cr,base32hexpad:()=>Ar,base32hexpadupper:()=>Fr,base32hexupper:()=>Sr,base32pad:()=>vr,base32padupper:()=>Er,base32upper:()=>xr,base32z:()=>Dr});var W=E({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),xr=E({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),vr=E({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Er=E({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Cr=E({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Sr=E({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Ar=E({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Fr=E({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Dr=E({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var De={};F(De,{base36:()=>Ir,base36upper:()=>Ur});var Ir=R({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Ur=R({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ie={};F(Ie,{base58btc:()=>N,base58flickr:()=>Mr});var N=R({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Mr=R({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ue={};F(Ue,{base64:()=>kr,base64pad:()=>Br,base64url:()=>Nr,base64urlpad:()=>Tr});var kr=E({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Br=E({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Nr=E({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Tr=E({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Me={};F(Me,{base256emoji:()=>Rr});var lt=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}"),Or=lt.reduce((t,e,r)=>(t[r]=e,t),[]),Lr=lt.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Pr(t){return t.reduce((e,r)=>(e+=Or[r],e),"")}function _r(t){let e=[];for(let r of t){let n=Lr[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Rr=V({prefix:"\u{1F680}",name:"base256emoji",encode:Pr,decode:_r});var Te={};F(Te,{sha256:()=>on,sha512:()=>sn});var zr=pt,dt=128,jr=127,$r=~jr,Kr=Math.pow(2,31);function pt(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Kr;)e[r++]=t&255|dt,t/=128;for(;t&$r;)e[r++]=t&255|dt,t>>>=7;return e[r]=t|0,pt.bytes=r-n+1,e}var Vr=ke,Wr=128,ht=127;function ke(t,n){var r=0,n=n||0,o=0,s=n,i,a=t.length;do{if(s>=a)throw ke.bytes=0,new RangeError("Could not decode varint");i=t[s++],r+=o<28?(i&ht)<<o:(i&ht)*Math.pow(2,o),o+=7}while(i>=Wr);return ke.bytes=s-n,r}var Jr=Math.pow(2,7),Gr=Math.pow(2,14),Xr=Math.pow(2,21),Qr=Math.pow(2,28),Zr=Math.pow(2,35),Hr=Math.pow(2,42),Yr=Math.pow(2,49),qr=Math.pow(2,56),en=Math.pow(2,63),tn=function(t){return t<Jr?1:t<Gr?2:t<Xr?3:t<Qr?4:t<Zr?5:t<Hr?6:t<Yr?7:t<qr?8:t<en?9:10},rn={encode:zr,decode:Vr,encodingLength:tn},nn=rn,Y=nn;var q=(t,e=0)=>[Y.decode(t,e),Y.decode.bytes],J=(t,e,r=0)=>(Y.encode(t,e,r),e),G=t=>Y.encodingLength(t);var j=(t,e)=>{let r=e.byteLength,n=G(t),o=n+G(r),s=new Uint8Array(o+r);return J(t,s,0),J(r,s,n),s.set(e,o),new X(t,r,e,s)},mt=t=>{let e=L(t),[r,n]=q(e),[o,s]=q(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new X(r,o,i,e)},yt=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&it(t.bytes,r.bytes)}},X=class{constructor(e,r,n,o){this.code=e,this.size=r,this.digest=n,this.bytes=o}};var Ne=({name:t,code:e,encode:r})=>new Be(t,e,r),Be=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?j(this.code,r):r.then(n=>j(this.code,n))}else throw Error("Unknown type, must be binary type")}};var wt=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),on=Ne({name:"sha2-256",code:18,encode:wt("SHA-256")}),sn=Ne({name:"sha2-512",code:19,encode:wt("SHA-512")});var Oe={};F(Oe,{identity:()=>fn});var gt=0,an="identity",xt=L,cn=t=>j(gt,xt(t)),fn={code:gt,name:an,encode:xt,digest:cn};var Oo=new TextEncoder,Lo=new TextDecoder;var vt=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return hn(r,Le(t),e||N.encoder);default:return pn(r,Le(t),e||W.encoder)}};var Et=new WeakMap,Le=t=>{let e=Et.get(t);if(e==null){let r=new Map;return Et.set(t,r),r}return e},ae=class t{constructor(e,r,n,o){this.code=r,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==te)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==mn)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=j(e,r);return t.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return t.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&yt(e.multihash,n.multihash)}toString(e){return vt(this,e)}toJSON(){return{"/":vt(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 r=e;if(r instanceof t)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:s,bytes:i}=r;return new t(n,o,s,i||Ct(n,o,s.bytes))}else if(r[yn]===!0){let{version:n,multihash:o,code:s}=r,i=mt(o);return t.create(n,s,i)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==te)throw new Error(`Version 0 CID must use dag-pb (code: ${te}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let o=Ct(e,r,n.bytes);return new t(e,r,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,te,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,o=L(e.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=o.subarray(r.multihashSize-r.digestSize),i=new X(r.multihashCode,r.digestSize,s,o);return[r.version===0?t.createV0(i):t.createV1(r.codec,i),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[l,y]=q(e.subarray(r));return r+=y,l},o=n(),s=te;if(o===18?(o=0,r=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=r,a=n(),u=n(),S=r+u,c=S-i;return{version:o,codec:s,multihashCode:a,digestSize:u,multihashSize:c,size:S}}static parse(e,r){let[n,o]=dn(e,r),s=t.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Le(s).set(n,e),s}},dn=(t,e)=>{switch(t[0]){case"Q":{let r=e||N;return[N.prefix,r.decode(`${N.prefix}${t}`)]}case N.prefix:{let r=e||N;return[N.prefix,r.decode(t)]}case W.prefix:{let r=e||W;return[W.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},hn=(t,e,r)=>{let{prefix:n}=r;if(n!==N.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=e.get(n);if(o==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return o},pn=(t,e,r)=>{let{prefix:n}=r,o=e.get(n);if(o==null){let s=r.encode(t);return e.set(n,s),s}else return o},te=112,mn=18,Ct=(t,e,r)=>{let n=G(t),o=n+G(e),s=new Uint8Array(o+r.byteLength);return J(t,s,0),J(e,s,n),s.set(r,o),s},yn=Symbol.for("@ipld/js-cid/CID");var Pe={...ve,...Ee,...Ce,...Se,...Ae,...Fe,...De,...Ie,...Ue,...Me},Jo={...Te,...Oe};function St(t=0){return globalThis.Buffer?.allocUnsafe!=null?se(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Ft(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var At=Ft("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),_e=Ft("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=St(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),bn={utf8:At,"utf-8":At,hex:Pe.base16,latin1:_e,ascii:_e,binary:_e,...Pe},ce=bn;function Dt(t,e="utf8"){let r=ce[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?se(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function It(t,e="utf8"){let r=ce[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}var P="/",Ut=new TextEncoder().encode(P),fe=Ut[0],T=class t{_buf;constructor(e,r){if(typeof e=="string")this._buf=Dt(e);else if(e instanceof Uint8Array)this._buf=e;else throw new Error("Invalid key, should be String of Uint8Array");if(r==null&&(r=!0),r&&this.clean(),this._buf.byteLength===0||this._buf[0]!==fe)throw new Error("Invalid key")}toString(e="utf8"){return It(this._buf,e)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return`Key(${this.toString()})`}static withNamespaces(e){return new t(e.join(P))}static random(){return new t(ot().replace(/-/g,""))}static asKey(e){return e instanceof Uint8Array||typeof e=="string"?new t(e):typeof e.uint8Array=="function"?new t(e.uint8Array()):null}clean(){if((this._buf==null||this._buf.byteLength===0)&&(this._buf=Ut),this._buf[0]!==fe){let e=new Uint8Array(this._buf.byteLength+1);e.fill(fe,0,1),e.set(this._buf,1),this._buf=e}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===fe;)this._buf=this._buf.subarray(0,-1)}less(e){let r=this.list(),n=e.list();for(let o=0;o<r.length;o++){if(n.length<o+1)return!1;let s=r[o],i=n[o];if(s<i)return!0;if(s>i)return!1}return r.length<n.length}reverse(){return t.withNamespaces(this.list().slice().reverse())}namespaces(){return this.list()}baseNamespace(){let e=this.namespaces();return e[e.length-1]}list(){return this.toString().split(P).slice(1)}type(){return wn(this.baseNamespace())}name(){return gn(this.baseNamespace())}instance(e){return new t(this.toString()+":"+e)}path(){let e=this.parent().toString();return e.endsWith(P)||(e+=P),e+=this.type(),new t(e)}parent(){let e=this.list();return e.length===1?new t(P):new t(e.slice(0,-1).join(P))}child(e){return this.toString()===P?e:e.toString()===P?this:new t(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 t.withNamespaces([...this.namespaces(),...xn(e.map(r=>r.namespaces()))])}};function wn(t){let e=t.split(":");return e.length<2?"":e.slice(0,-1).join(":")}function gn(t){let e=t.split(":");return e[e.length-1]}function xn(t){return[].concat(...t)}var Mt="SHARDING";function En(t){return t[Symbol.asyncIterator]!=null}function Cn(t){if(En(t))return(async()=>{for await(let e of t);})();for(let e of t);}var ue=Cn;function Sn(t){let[e,r]=t[Symbol.asyncIterator]!=null?[t[Symbol.asyncIterator](),Symbol.asyncIterator]:[t[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>e.next(),push:o=>{n.push(o)},next:()=>n.length>0?{done:!1,value:n.shift()}:e.next(),[r](){return this}}}var Re=Sn;function An(t){return t[Symbol.asyncIterator]!=null}function Fn(t,e){if(An(t))return async function*(){for await(let a of t)await e(a)&&(yield a)}();let r=Re(t),{value:n,done:o}=r.next();if(o===!0)return function*(){}();let s=e(n);if(typeof s.then=="function")return async function*(){await s&&(yield n);for await(let a of r)await e(a)&&(yield a)}();let i=e;return function*(){s===!0&&(yield n);for(let a of r)i(a)&&(yield a)}()}var k=Fn;function Dn(t){return t[Symbol.asyncIterator]!=null}function In(t){if(Dn(t))return(async()=>{let r=[];for await(let n of t)r.push(n);return r})();let e=[];for(let r of t)e.push(r);return e}var ze=In;function Un(t){return t[Symbol.asyncIterator]!=null}function Mn(t,e){return Un(t)?async function*(){yield*(await ze(t)).sort(e)}():function*(){yield*ze(t).sort(e)}()}var $=Mn;function kn(t){return t[Symbol.asyncIterator]!=null}function Bn(t,e){return kn(t)?async function*(){let r=0;if(!(e<1)){for await(let n of t)if(yield n,r++,r===e)return}}():function*(){let r=0;if(!(e<1)){for(let n of t)if(yield n,r++,r===e)return}}()}var le=Bn;var O=class{put(e,r,n){return Promise.reject(new Error(".put is not implemented"))}get(e,r){return Promise.reject(new Error(".get is not implemented"))}has(e,r){return Promise.reject(new Error(".has is not implemented"))}delete(e,r){return Promise.reject(new Error(".delete is not implemented"))}async*putMany(e,r={}){for await(let{key:n,value:o}of e)await this.put(n,o,r),yield n}async*getMany(e,r={}){for await(let n of e)yield{key:n,value:await this.get(n,r)}}async*deleteMany(e,r={}){for await(let n of e)await this.delete(n,r),yield n}batch(){let e=[],r=[];return{put(n,o){e.push({key:n,value:o})},delete(n){r.push(n)},commit:async n=>{await ue(this.putMany(e,n)),e=[],await ue(this.deleteMany(r,n)),r=[]}}}async*_all(e,r){throw new Error("._all is not implemented")}async*_allKeys(e,r){throw new Error("._allKeys is not implemented")}query(e,r){let n=this._all(e,r);if(e.prefix!=null){let o=e.prefix;n=k(n,s=>s.key.toString().startsWith(o))}if(Array.isArray(e.filters)&&(n=e.filters.reduce((o,s)=>k(o,s),n)),Array.isArray(e.orders)&&(n=e.orders.reduce((o,s)=>$(o,s),n)),e.offset!=null){let o=0,s=e.offset;n=k(n,()=>o++>=s)}return e.limit!=null&&(n=le(n,e.limit)),n}queryKeys(e,r){let n=this._allKeys(e,r);if(e.prefix!=null){let o=e.prefix;n=k(n,s=>s.toString().startsWith(o))}if(Array.isArray(e.filters)&&(n=e.filters.reduce((o,s)=>k(o,s),n)),Array.isArray(e.orders)&&(n=e.orders.reduce((o,s)=>$(o,s),n)),e.offset!=null){let o=e.offset,s=0;n=k(n,()=>s++>=o)}return e.limit!=null&&(n=le(n,e.limit)),n}};var Ys=new T(Mt);var U=qe(Pt(),1);function Jn(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<t.length;o++){var s=t.charAt(o),i=s.charCodeAt(0);if(r[i]!==255)throw new TypeError(s+" is ambiguous");r[i]=o}var a=t.length,u=t.charAt(0),S=Math.log(a)/Math.log(256),c=Math.log(256)/Math.log(a);function l(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var d=0,m=0,h=0,b=f.length;h!==b&&f[h]===0;)h++,d++;for(var g=(b-h)*c+1>>>0,p=new Uint8Array(g);h!==b;){for(var x=f[h],C=0,w=g-1;(x!==0||C<m)&&w!==-1;w--,C++)x+=256*p[w]>>>0,p[w]=x%a>>>0,x=x/a>>>0;if(x!==0)throw new Error("Non-zero carry");m=C,h++}for(var v=g-m;v!==g&&p[v]===0;)v++;for(var M=u.repeat(d);v<g;++v)M+=t.charAt(p[v]);return M}function y(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var d=0;if(f[d]!==" "){for(var m=0,h=0;f[d]===u;)m++,d++;for(var b=(f.length-d)*S+1>>>0,g=new Uint8Array(b);f[d];){var p=r[f.charCodeAt(d)];if(p===255)return;for(var x=0,C=b-1;(p!==0||x<h)&&C!==-1;C--,x++)p+=a*g[C]>>>0,g[C]=p%256>>>0,p=p/256>>>0;if(p!==0)throw new Error("Non-zero carry");h=x,d++}if(f[d]!==" "){for(var w=b-h;w!==b&&g[w]===0;)w++;for(var v=new Uint8Array(m+(b-w)),M=m;w!==b;)v[M++]=g[w++];return v}}}function _(f){var d=y(f);if(d)return d;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:y,decode:_}}var Gn=Jn,Xn=Gn,_t=Xn;var fi=new Uint8Array(0);var Rt=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};var je=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},$e=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return zt(this,e)}},Ke=class{constructor(e){this.decoders=e}or(e){return zt(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},zt=(t,e)=>new Ke({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),Ve=class{constructor(e,r,n,o){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new je(e,r,n),this.decoder=new $e(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},jt=({name:t,prefix:e,encode:r,decode:n})=>new Ve(t,e,r,n),We=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:o}=_t(r,e);return jt({prefix:t,name:e,encode:n,decode:s=>Rt(o(s))})},Qn=(t,e,r,n)=>{let o={};for(let c=0;c<e.length;++c)o[e[c]]=c;let s=t.length;for(;t[s-1]==="=";)--s;let i=new Uint8Array(s*r/8|0),a=0,u=0,S=0;for(let c=0;c<s;++c){let l=o[t[c]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|l,a+=r,a>=8&&(a-=8,i[S++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return i},Zn=(t,e,r)=>{let n=e[e.length-1]==="=",o=(1<<r)-1,s="",i=0,a=0;for(let u=0;u<t.length;++u)for(a=a<<8|t[u],i+=8;i>r;)i-=r,s+=e[o&a>>i];if(i&&(s+=e[o&a<<r-i]),n)for(;s.length*r&7;)s+="=";return s},A=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>jt({prefix:e,name:t,encode(o){return Zn(o,n,r)},decode(o){return Qn(o,n,r,t)}});var $t=A({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),mi=A({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),yi=A({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),bi=A({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),wi=A({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),gi=A({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),xi=A({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),vi=A({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Ei=A({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Kt=We({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ai=We({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Vt=A({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ii=A({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Ui=A({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Mi=A({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});U.default.formatters.b=t=>t==null?"undefined":Kt.baseEncode(t);U.default.formatters.t=t=>t==null?"undefined":$t.baseEncode(t);U.default.formatters.m=t=>t==null?"undefined":Vt.baseEncode(t);U.default.formatters.p=t=>t==null?"undefined":t.toString();U.default.formatters.c=t=>t==null?"undefined":t.toString();U.default.formatters.k=t=>t==null?"undefined":t.toString();U.default.formatters.a=t=>t==null?"undefined":t.toString();function Hn(t){let e=()=>{};return e.enabled=!1,e.color="",e.diff=0,e.log=()=>{},e.namespace=t,e.destroy=()=>!0,e.extend=()=>e,e}function Wt(t){let e=Hn(`${t}:trace`);return U.default.enabled(`${t}:trace`)&&U.default.names.map(r=>r.toString()).find(r=>r.includes(":trace"))!=null&&(e=(0,U.default)(`${t}:trace`)),Object.assign((0,U.default)(t),{error:(0,U.default)(`${t}:error`),trace:e})}var zi=Wt("datastore:core:tiered");var Yn=(t,e)=>e.some(r=>t instanceof r),Jt,Gt;function qn(){return Jt||(Jt=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function eo(){return Gt||(Gt=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Xt=new WeakMap,Ge=new WeakMap,Qt=new WeakMap,Je=new WeakMap,Qe=new WeakMap;function to(t){let e=new Promise((r,n)=>{let o=()=>{t.removeEventListener("success",s),t.removeEventListener("error",i)},s=()=>{r(B(t.result)),o()},i=()=>{n(t.error),o()};t.addEventListener("success",s),t.addEventListener("error",i)});return e.then(r=>{r instanceof IDBCursor&&Xt.set(r,t)}).catch(()=>{}),Qe.set(e,t),e}function ro(t){if(Ge.has(t))return;let e=new Promise((r,n)=>{let o=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",i),t.removeEventListener("abort",i)},s=()=>{r(),o()},i=()=>{n(t.error||new DOMException("AbortError","AbortError")),o()};t.addEventListener("complete",s),t.addEventListener("error",i),t.addEventListener("abort",i)});Ge.set(t,e)}var Xe={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return Ge.get(t);if(e==="objectStoreNames")return t.objectStoreNames||Qt.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return B(t[e])},set(t,e,r){return t[e]=r,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function Zt(t){Xe=t(Xe)}function no(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...r){let n=t.call(pe(this),e,...r);return Qt.set(n,e.sort?e.sort():[e]),B(n)}:eo().includes(t)?function(...e){return t.apply(pe(this),e),B(Xt.get(this))}:function(...e){return B(t.apply(pe(this),e))}}function oo(t){return typeof t=="function"?no(t):(t instanceof IDBTransaction&&ro(t),Yn(t,qn())?new Proxy(t,Xe):t)}function B(t){if(t instanceof IDBRequest)return to(t);if(Je.has(t))return Je.get(t);let e=oo(t);return e!==t&&(Je.set(t,e),Qe.set(e,t)),e}var pe=t=>Qe.get(t);function Yt(t,e,{blocked:r,upgrade:n,blocking:o,terminated:s}={}){let i=indexedDB.open(t,e),a=B(i);return n&&i.addEventListener("upgradeneeded",u=>{n(B(i.result),u.oldVersion,u.newVersion,B(i.transaction),u)}),r&&i.addEventListener("blocked",u=>r(u.oldVersion,u.newVersion,u)),a.then(u=>{s&&u.addEventListener("close",()=>s()),o&&u.addEventListener("versionchange",S=>o(S.oldVersion,S.newVersion,S))}).catch(()=>{}),a}function qt(t,{blocked:e}={}){let r=indexedDB.deleteDatabase(t);return e&&r.addEventListener("blocked",n=>e(n.oldVersion,n)),B(r).then(()=>{})}var so=["get","getKey","getAll","getAllKeys","count"],io=["put","add","delete","clear"],Ze=new Map;function Ht(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Ze.get(e))return Ze.get(e);let r=e.replace(/FromIndex$/,""),n=e!==r,o=io.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(o||so.includes(r)))return;let s=async function(i,...a){let u=this.transaction(i,o?"readwrite":"readonly"),S=u.store;return n&&(S=S.index(a.shift())),(await Promise.all([S[r](...a),o&&u.done]))[0]};return Ze.set(e,s),s}Zt(t=>({...t,get:(e,r,n)=>Ht(e,r)||t.get(e,r,n),has:(e,r)=>!!Ht(e,r)||t.has(e,r)}));var He=class extends O{location;version;db;constructor(e,r={}){super(),this.location=`${r.prefix??""}${e}`,this.version=r.version??1}async open(){try{let e=this.location;this.db=await Yt(e,this.version,{upgrade(r){r.createObjectStore(e)}})}catch(e){throw D.dbOpenFailedError(e)}}async close(){this.db?.close()}async put(e,r){if(this.db==null)throw new Error("Datastore needs to be opened.");try{return await this.db.put(this.location,r,e.toString()),e}catch(n){throw D.dbWriteFailedError(n)}}async get(e){if(this.db==null)throw new Error("Datastore needs to be opened.");let r;try{r=await this.db.get(this.location,e.toString())}catch(n){throw D.dbReadFailedError(n)}if(r===void 0)throw D.notFoundError();return r}async has(e){if(this.db==null)throw new Error("Blockstore needs to be opened.");try{return!!await this.db.getKey(this.location,e.toString())}catch(r){throw D.dbReadFailedError(r)}}async delete(e){if(this.db==null)throw new Error("Datastore needs to be opened.");try{await this.db.delete(this.location,e.toString())}catch(r){throw D.dbWriteFailedError(r)}}batch(){let e=[],r=[];return{put(n,o){e.push({key:n,value:o})},delete(n){r.push(n)},commit:async()=>{if(this.db==null)throw new Error("Datastore needs to be opened.");let n=this.db.transaction(this.location,"readwrite");try{let o=e.filter(({key:s})=>r.find(i=>i.toString()===s.toString())==null).map(s=>async()=>{await n.store.put(s.value,s.key.toString())}).concat(r.map(s=>async()=>{await n.store.delete(s.toString())})).concat(async()=>{await n.done});await Promise.all(o.map(async s=>{await s()}))}catch{n.abort()}}}}async*query(e){let r=this.#e(e,(n,o)=>({key:n,value:o}));Array.isArray(e.filters)&&(r=e.filters.reduce((n,o)=>k(n,o),r)),Array.isArray(e.orders)&&(r=e.orders.reduce((n,o)=>$(n,o),r)),yield*r}async*queryKeys(e){let r=this.#e(e,n=>n);Array.isArray(e.filters)&&(r=e.filters.reduce((n,o)=>k(n,o),r)),Array.isArray(e.orders)&&(r=e.orders.reduce((n,o)=>$(n,o),r)),yield*r}async*#e(e,r){if(this.db==null)throw new Error("Datastore needs to be opened.");let n=0,o=-1;for(let s of await this.db.getAllKeys(this.location)){if(e.prefix!=null&&!s.toString().startsWith(e.prefix))continue;if(e.limit!=null&&n===e.limit)return;if(o++,e.offset!=null&&o<e.offset)continue;let i=new T(s.toString()),a;try{a=await this.get(i)}catch(u){if(u.code!=="ERR_NOT_FOUND")throw u;continue}a!=null&&(yield r(i,a),n++)}}async destroy(){await qt(this.location)}};return sr(ao);})(); | ||
return DatastoreIdb})); |
{ | ||
"name": "datastore-idb", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "Datastore implementation with IndexedDB backend.", | ||
@@ -153,3 +153,3 @@ "author": "Hugo Dias <hugomrdias@gmail.com>", | ||
"devDependencies": { | ||
"aegir": "^39.0.9", | ||
"aegir": "^40.0.8", | ||
"datastore-core": "^9.0.0", | ||
@@ -156,0 +156,0 @@ "interface-datastore-tests": "^5.0.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68147
563