UNPKG

@enbox/dids

Version:
1 lines 387 kB
"use strict";var Web5Dids=(()=>{var Hx=Object.create;var Na=Object.defineProperty;var jx=Object.getOwnPropertyDescriptor;var Wx=Object.getOwnPropertyNames;var zx=Object.getPrototypeOf,Gx=Object.prototype.hasOwnProperty;var $=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),$a=(t,e)=>{for(var r in e)Na(t,r,{get:e[r],enumerable:!0})},vp=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Wx(e))!Gx.call(t,i)&&i!==r&&Na(t,i,{get:()=>e[i],enumerable:!(n=jx(e,i))||n.enumerable});return t};var f=(t,e,r)=>(r=t!=null?Hx(zx(t)):{},vp(e||!t||!t.__esModule?Na(r,"default",{value:t,enumerable:!0}):r,t)),Jx=t=>vp(Na({},"__esModule",{value:!0}),t);var Ap=$(qa=>{"use strict";var VB=f(h());qa.byteLength=Xx;qa.toByteArray=Qx;qa.fromByteArray=rE;var xr=[],zt=[],Yx=typeof Uint8Array<"u"?Uint8Array:Array,ud="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ni=0,Sp=ud.length;ni<Sp;++ni)xr[ni]=ud[ni],zt[ud.charCodeAt(ni)]=ni;var ni,Sp;zt[45]=62;zt[95]=63;function _p(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function Xx(t){var e=_p(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Zx(t,e,r){return(e+r)*3/4-r}function Qx(t){var e,r=_p(t),n=r[0],i=r[1],o=new Yx(Zx(t,n,i)),s=0,a=i>0?n-4:n,u;for(u=0;u<a;u+=4)e=zt[t.charCodeAt(u)]<<18|zt[t.charCodeAt(u+1)]<<12|zt[t.charCodeAt(u+2)]<<6|zt[t.charCodeAt(u+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=zt[t.charCodeAt(u)]<<2|zt[t.charCodeAt(u+1)]>>4,o[s++]=e&255),i===1&&(e=zt[t.charCodeAt(u)]<<10|zt[t.charCodeAt(u+1)]<<4|zt[t.charCodeAt(u+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function eE(t){return xr[t>>18&63]+xr[t>>12&63]+xr[t>>6&63]+xr[t&63]}function tE(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(eE(n));return i.join("")}function rE(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(tE(t,s,s+o>a?a:s+o));return n===1?(e=t[r-1],i.push(xr[e>>2]+xr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(xr[e>>10]+xr[e>>4&63]+xr[e<<2&63]+"=")),i.join("")}});var Tp=$(dd=>{var jB=f(h());dd.read=function(t,e,r,n,i){var o,s,a=i*8-n-1,u=(1<<a)-1,d=u>>1,c=-7,l=r?i-1:0,g=r?-1:1,w=t[e+l];for(l+=g,o=w&(1<<-c)-1,w>>=-c,c+=a;c>0;o=o*256+t[e+l],l+=g,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=s*256+t[e+l],l+=g,c-=8);if(o===0)o=1-d;else{if(o===u)return s?NaN:(w?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-d}return(w?-1:1)*s*Math.pow(2,o-n)};dd.write=function(t,e,r,n,i,o){var s,a,u,d=o*8-i-1,c=(1<<d)-1,l=c>>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:o-1,m=n?1:-1,y=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+l>=1?e+=g/u:e+=g*Math.pow(2,1-l),e*u>=2&&(s++,u/=2),s+l>=c?(a=0,s=c):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s=s+l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+w]=a&255,w+=m,a/=256,i-=8);for(s=s<<i|a,d+=i;d>0;t[r+w]=s&255,w+=m,s/=256,d-=8);t[r+w-m]|=y*128}});var _t=$(no=>{"use strict";var GB=f(h());var ld=Ap(),to=Tp(),Ip=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;no.Buffer=T;no.SlowBuffer=cE;no.INSPECT_MAX_BYTES=50;var Fa=2147483647;no.kMaxLength=Fa;T.TYPED_ARRAY_SUPPORT=nE();!T.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function nE(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(T.prototype,"parent",{enumerable:!0,get:function(){if(T.isBuffer(this))return this.buffer}});Object.defineProperty(T.prototype,"offset",{enumerable:!0,get:function(){if(T.isBuffer(this))return this.byteOffset}});function Wr(t){if(t>Fa)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,T.prototype),e}function T(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return yd(t)}return Op(t,e,r)}T.poolSize=8192;function Op(t,e,r){if(typeof t=="string")return oE(t,e);if(ArrayBuffer.isView(t))return sE(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Er(t,ArrayBuffer)||t&&Er(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Er(t,SharedArrayBuffer)||t&&Er(t.buffer,SharedArrayBuffer)))return hd(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return T.from(n,e,r);let i=aE(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return T.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}T.from=function(t,e,r){return Op(t,e,r)};Object.setPrototypeOf(T.prototype,Uint8Array.prototype);Object.setPrototypeOf(T,Uint8Array);function kp(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function iE(t,e,r){return kp(t),t<=0?Wr(t):e!==void 0?typeof r=="string"?Wr(t).fill(e,r):Wr(t).fill(e):Wr(t)}T.alloc=function(t,e,r){return iE(t,e,r)};function yd(t){return kp(t),Wr(t<0?0:md(t)|0)}T.allocUnsafe=function(t){return yd(t)};T.allocUnsafeSlow=function(t){return yd(t)};function oE(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!T.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Cp(t,e)|0,n=Wr(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function fd(t){let e=t.length<0?0:md(t.length)|0,r=Wr(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function sE(t){if(Er(t,Uint8Array)){let e=new Uint8Array(t);return hd(e.buffer,e.byteOffset,e.byteLength)}return fd(t)}function hd(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,T.prototype),n}function aE(t){if(T.isBuffer(t)){let e=md(t.length)|0,r=Wr(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||wd(t.length)?Wr(0):fd(t);if(t.type==="Buffer"&&Array.isArray(t.data))return fd(t.data)}function md(t){if(t>=Fa)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Fa.toString(16)+" bytes");return t|0}function cE(t){return+t!=t&&(t=0),T.alloc(+t)}T.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==T.prototype};T.compare=function(e,r){if(Er(e,Uint8Array)&&(e=T.from(e,e.offset,e.byteLength)),Er(r,Uint8Array)&&(r=T.from(r,r.offset,r.byteLength)),!T.isBuffer(e)||!T.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let o=0,s=Math.min(n,i);o<s;++o)if(e[o]!==r[o]){n=e[o],i=r[o];break}return n<i?-1:i<n?1:0};T.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};T.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return T.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let i=T.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){let s=e[n];if(Er(s,Uint8Array))o+s.length>i.length?(T.isBuffer(s)||(s=T.from(s)),s.copy(i,o)):Uint8Array.prototype.set.call(i,s,o);else if(T.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function Cp(t,e){if(T.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Er(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return pd(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Fp(t).length;default:if(i)return n?-1:pd(t).length;e=(""+e).toLowerCase(),i=!0}}T.byteLength=Cp;function uE(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return bE(this,e,r);case"utf8":case"utf-8":return Pp(this,e,r);case"ascii":return gE(this,e,r);case"latin1":case"binary":return wE(this,e,r);case"base64":return yE(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xE(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}T.prototype._isBuffer=!0;function ii(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}T.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)ii(this,r,r+1);return this};T.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)ii(this,r,r+3),ii(this,r+1,r+2);return this};T.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)ii(this,r,r+7),ii(this,r+1,r+6),ii(this,r+2,r+5),ii(this,r+3,r+4);return this};T.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Pp(this,0,e):uE.apply(this,arguments)};T.prototype.toLocaleString=T.prototype.toString;T.prototype.equals=function(e){if(!T.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:T.compare(this,e)===0};T.prototype.inspect=function(){let e="",r=no.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Ip&&(T.prototype[Ip]=T.prototype.inspect);T.prototype.compare=function(e,r,n,i,o){if(Er(e,Uint8Array)&&(e=T.from(e,e.offset,e.byteLength)),!T.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;let s=o-i,a=n-r,u=Math.min(s,a),d=this.slice(i,o),c=e.slice(r,n);for(let l=0;l<u;++l)if(d[l]!==c[l]){s=d[l],a=c[l];break}return s<a?-1:a<s?1:0};function Up(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,wd(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=T.from(e,n)),T.isBuffer(e))return e.length===0?-1:Dp(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Dp(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Dp(t,e,r,n,i){let o=1,s=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,s/=2,a/=2,r/=2}function u(c,l){return o===1?c[l]:c.readUInt16BE(l*o)}let d;if(i){let c=-1;for(d=r;d<s;d++)if(u(t,d)===u(e,c===-1?0:d-c)){if(c===-1&&(c=d),d-c+1===a)return c*o}else c!==-1&&(d-=d-c),c=-1}else for(r+a>s&&(r=s-a),d=r;d>=0;d--){let c=!0;for(let l=0;l<a;l++)if(u(t,d+l)!==u(e,l)){c=!1;break}if(c)return d}return-1}T.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};T.prototype.indexOf=function(e,r,n){return Up(this,e,r,n,!0)};T.prototype.lastIndexOf=function(e,r,n){return Up(this,e,r,n,!1)};function dE(t,e,r,n){r=Number(r)||0;let i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;let o=e.length;n>o/2&&(n=o/2);let s;for(s=0;s<n;++s){let a=parseInt(e.substr(s*2,2),16);if(wd(a))return s;t[r+s]=a}return s}function lE(t,e,r,n){return Va(pd(e,t.length-r),t,r,n)}function fE(t,e,r,n){return Va(_E(e),t,r,n)}function hE(t,e,r,n){return Va(Fp(e),t,r,n)}function pE(t,e,r,n){return Va(AE(e,t.length-r),t,r,n)}T.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-r;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return dE(this,e,r,n);case"utf8":case"utf-8":return lE(this,e,r,n);case"ascii":case"latin1":case"binary":return fE(this,e,r,n);case"base64":return hE(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pE(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};T.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function yE(t,e,r){return e===0&&r===t.length?ld.fromByteArray(t):ld.fromByteArray(t.slice(e,r))}function Pp(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i<r;){let o=t[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=r){let u,d,c,l;switch(a){case 1:o<128&&(s=o);break;case 2:u=t[i+1],(u&192)===128&&(l=(o&31)<<6|u&63,l>127&&(s=l));break;case 3:u=t[i+1],d=t[i+2],(u&192)===128&&(d&192)===128&&(l=(o&15)<<12|(u&63)<<6|d&63,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:u=t[i+1],d=t[i+2],c=t[i+3],(u&192)===128&&(d&192)===128&&(c&192)===128&&(l=(o&15)<<18|(u&63)<<12|(d&63)<<6|c&63,l>65535&&l<1114112&&(s=l))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=a}return mE(n)}var Bp=4096;function mE(t){let e=t.length;if(e<=Bp)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Bp));return r}function gE(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function wE(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function bE(t,e,r){let n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let o=e;o<r;++o)i+=TE[t[o]];return i}function xE(t,e,r){let n=t.slice(e,r),i="";for(let o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}T.prototype.slice=function(e,r){let n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);let i=this.subarray(e,r);return Object.setPrototypeOf(i,T.prototype),i};function rt(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}T.prototype.readUintLE=T.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||rt(e,r,this.length);let i=this[e],o=1,s=0;for(;++s<r&&(o*=256);)i+=this[e+s]*o;return i};T.prototype.readUintBE=T.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||rt(e,r,this.length);let i=this[e+--r],o=1;for(;r>0&&(o*=256);)i+=this[e+--r]*o;return i};T.prototype.readUint8=T.prototype.readUInt8=function(e,r){return e=e>>>0,r||rt(e,1,this.length),this[e]};T.prototype.readUint16LE=T.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||rt(e,2,this.length),this[e]|this[e+1]<<8};T.prototype.readUint16BE=T.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||rt(e,2,this.length),this[e]<<8|this[e+1]};T.prototype.readUint32LE=T.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||rt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};T.prototype.readUint32BE=T.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||rt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};T.prototype.readBigUInt64LE=Sn(function(e){e=e>>>0,ro(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ps(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,o=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(o)<<BigInt(32))});T.prototype.readBigUInt64BE=Sn(function(e){e=e>>>0,ro(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ps(e,this.length-8);let i=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],o=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(o)});T.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||rt(e,r,this.length);let i=this[e],o=1,s=0;for(;++s<r&&(o*=256);)i+=this[e+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*r)),i};T.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||rt(e,r,this.length);let i=r,o=1,s=this[e+--i];for(;i>0&&(o*=256);)s+=this[e+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s};T.prototype.readInt8=function(e,r){return e=e>>>0,r||rt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};T.prototype.readInt16LE=function(e,r){e=e>>>0,r||rt(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};T.prototype.readInt16BE=function(e,r){e=e>>>0,r||rt(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};T.prototype.readInt32LE=function(e,r){return e=e>>>0,r||rt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};T.prototype.readInt32BE=function(e,r){return e=e>>>0,r||rt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};T.prototype.readBigInt64LE=Sn(function(e){e=e>>>0,ro(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ps(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});T.prototype.readBigInt64BE=Sn(function(e){e=e>>>0,ro(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ps(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});T.prototype.readFloatLE=function(e,r){return e=e>>>0,r||rt(e,4,this.length),to.read(this,e,!0,23,4)};T.prototype.readFloatBE=function(e,r){return e=e>>>0,r||rt(e,4,this.length),to.read(this,e,!1,23,4)};T.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||rt(e,8,this.length),to.read(this,e,!0,52,8)};T.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||rt(e,8,this.length),to.read(this,e,!1,52,8)};function St(t,e,r,n,i,o){if(!T.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}T.prototype.writeUintLE=T.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;St(this,e,r,n,a,0)}let o=1,s=0;for(this[r]=e&255;++s<n&&(o*=256);)this[r+s]=e/o&255;return r+n};T.prototype.writeUintBE=T.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;St(this,e,r,n,a,0)}let o=n-1,s=1;for(this[r+o]=e&255;--o>=0&&(s*=256);)this[r+o]=e/s&255;return r+n};T.prototype.writeUint8=T.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||St(this,e,r,1,255,0),this[r]=e&255,r+1};T.prototype.writeUint16LE=T.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||St(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};T.prototype.writeUint16BE=T.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||St(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};T.prototype.writeUint32LE=T.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||St(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};T.prototype.writeUint32BE=T.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||St(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function Kp(t,e,r,n,i){qp(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,r}function Lp(t,e,r,n,i){qp(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o=o>>8,t[r+6]=o,o=o>>8,t[r+5]=o,o=o>>8,t[r+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s=s>>8,t[r+2]=s,s=s>>8,t[r+1]=s,s=s>>8,t[r]=s,r+8}T.prototype.writeBigUInt64LE=Sn(function(e,r=0){return Kp(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});T.prototype.writeBigUInt64BE=Sn(function(e,r=0){return Lp(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});T.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);St(this,e,r,n,u-1,-u)}let o=0,s=1,a=0;for(this[r]=e&255;++o<n&&(s*=256);)e<0&&a===0&&this[r+o-1]!==0&&(a=1),this[r+o]=(e/s>>0)-a&255;return r+n};T.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);St(this,e,r,n,u-1,-u)}let o=n-1,s=1,a=0;for(this[r+o]=e&255;--o>=0&&(s*=256);)e<0&&a===0&&this[r+o+1]!==0&&(a=1),this[r+o]=(e/s>>0)-a&255;return r+n};T.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||St(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};T.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||St(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};T.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||St(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};T.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||St(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};T.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||St(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};T.prototype.writeBigInt64LE=Sn(function(e,r=0){return Kp(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});T.prototype.writeBigInt64BE=Sn(function(e,r=0){return Lp(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Mp(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Np(t,e,r,n,i){return e=+e,r=r>>>0,i||Mp(t,e,r,4,34028234663852886e22,-34028234663852886e22),to.write(t,e,r,n,23,4),r+4}T.prototype.writeFloatLE=function(e,r,n){return Np(this,e,r,!0,n)};T.prototype.writeFloatBE=function(e,r,n){return Np(this,e,r,!1,n)};function $p(t,e,r,n,i){return e=+e,r=r>>>0,i||Mp(t,e,r,8,17976931348623157e292,-17976931348623157e292),to.write(t,e,r,n,52,8),r+8}T.prototype.writeDoubleLE=function(e,r,n){return $p(this,e,r,!0,n)};T.prototype.writeDoubleBE=function(e,r,n){return $p(this,e,r,!1,n)};T.prototype.copy=function(e,r,n,i){if(!T.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);let o=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),r),o};T.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!T.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let s=e.charCodeAt(0);(i==="utf8"&&s<128||i==="latin1")&&(e=s)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let o;if(typeof e=="number")for(o=r;o<n;++o)this[o]=e;else{let s=T.isBuffer(e)?e:T.from(e,i),a=s.length;if(a===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-r;++o)this[o+r]=s[o%a]}return this};var eo={};function gd(t,e,r){eo[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}gd("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);gd("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);gd("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=Rp(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Rp(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Rp(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function EE(t,e,r){ro(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&ps(e,t.length-(r+1))}function qp(t,e,r,n,i,o){if(t>r||t<e){let s=typeof e=="bigint"?"n":"",a;throw o>3?e===0||e===BigInt(0)?a=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:a=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:a=`>= ${e}${s} and <= ${r}${s}`,new eo.ERR_OUT_OF_RANGE("value",a,t)}EE(n,i,o)}function ro(t,e){if(typeof t!="number")throw new eo.ERR_INVALID_ARG_TYPE(e,"number",t)}function ps(t,e,r){throw Math.floor(t)!==t?(ro(t,r),new eo.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new eo.ERR_BUFFER_OUT_OF_BOUNDS:new eo.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var vE=/[^+/0-9A-Za-z-_]/g;function SE(t){if(t=t.split("=")[0],t=t.trim().replace(vE,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function pd(t,e){e=e||1/0;let r,n=t.length,i=null,o=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function _E(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function AE(t,e){let r,n,i,o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function Fp(t){return ld.toByteArray(SE(t))}function Va(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Er(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function wd(t){return t!==t}var TE=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Sn(t){return typeof BigInt>"u"?IE:t}function IE(){throw new Error("BigInt not supported")}});var h=$(()=>{"use strict";var Vp=_t().Buffer,{Buffer:DE}=_t();Vp.prototype.writeBigUInt64BE=DE.prototype.writeBigUInt64BE;globalThis.Buffer=Vp});var jp=$((o6,Hp)=>{var s6=f(h()),BE=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ha=()=>BE.now(),RE=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),bd=t=>t===1/0||RE(t),xd=class t{constructor({max:e=1/0,ttl:r,updateAgeOnGet:n=!1,checkAgeOnGet:i=!1,noUpdateTTL:o=!1,dispose:s,noDisposeOnSet:a=!1}={}){if(this.expirations=Object.create(null),this.data=new Map,this.expirationMap=new Map,r!==void 0&&!bd(r))throw new TypeError("ttl must be positive integer or Infinity if set");if(!bd(e))throw new TypeError("max must be positive integer or Infinity");if(this.ttl=r,this.max=e,this.updateAgeOnGet=!!n,this.checkAgeOnGet=!!i,this.noUpdateTTL=!!o,this.noDisposeOnSet=!!a,s!==void 0){if(typeof s!="function")throw new TypeError("dispose must be function if set");this.dispose=s}this.timer=void 0,this.timerExpiration=void 0}setTimer(e,r){if(this.timerExpiration<e)return;this.timer&&clearTimeout(this.timer);let n=setTimeout(()=>{this.timer=void 0,this.timerExpiration=void 0,this.purgeStale();for(let i in this.expirations){this.setTimer(i,i-Ha());break}},r);n.unref&&n.unref(),this.timerExpiration=e,this.timer=n}cancelTimer(){this.timer&&(clearTimeout(this.timer),this.timerExpiration=void 0,this.timer=void 0)}cancelTimers(){return process.emitWarning('TTLCache.cancelTimers has been renamed to TTLCache.cancelTimer (no "s"), and will be removed in the next major version update'),this.cancelTimer()}clear(){let e=this.dispose!==t.prototype.dispose?[...this]:[];this.data.clear(),this.expirationMap.clear(),this.cancelTimer(),this.expirations=Object.create(null);for(let[r,n]of e)this.dispose(n,r,"delete")}setTTL(e,r=this.ttl){let n=this.expirationMap.get(e);if(n!==void 0){let i=this.expirations[n];!i||i.length<=1?delete this.expirations[n]:this.expirations[n]=i.filter(o=>o!==e)}if(r!==1/0){let i=Math.floor(Ha()+r);this.expirationMap.set(e,i),this.expirations[i]||(this.expirations[i]=[],this.setTimer(i,r)),this.expirations[i].push(e)}else this.expirationMap.set(e,1/0)}set(e,r,{ttl:n=this.ttl,noUpdateTTL:i=this.noUpdateTTL,noDisposeOnSet:o=this.noDisposeOnSet}={}){if(!bd(n))throw new TypeError("ttl must be positive integer or Infinity");if(this.expirationMap.has(e)){i||this.setTTL(e,n);let s=this.data.get(e);s!==r&&(this.data.set(e,r),o||this.dispose(s,e,"set"))}else this.setTTL(e,n),this.data.set(e,r);for(;this.size>this.max;)this.purgeToCapacity();return this}has(e){return this.data.has(e)}getRemainingTTL(e){let r=this.expirationMap.get(e);return r===1/0?r:r!==void 0?Math.max(0,Math.ceil(r-Ha())):0}get(e,{updateAgeOnGet:r=this.updateAgeOnGet,ttl:n=this.ttl,checkAgeOnGet:i=this.checkAgeOnGet}={}){let o=this.data.get(e);if(i&&this.getRemainingTTL(e)===0){this.delete(e);return}return r&&this.setTTL(e,n),o}dispose(e,r){}delete(e){let r=this.expirationMap.get(e);if(r!==void 0){let n=this.data.get(e);this.data.delete(e),this.expirationMap.delete(e);let i=this.expirations[r];return i&&(i.length<=1?delete this.expirations[r]:this.expirations[r]=i.filter(o=>o!==e)),this.dispose(n,e,"delete"),this.size===0&&this.cancelTimer(),!0}return!1}purgeToCapacity(){for(let e in this.expirations){let r=this.expirations[e];if(this.size-r.length>=this.max){delete this.expirations[e];let n=[];for(let i of r)n.push([i,this.data.get(i)]),this.data.delete(i),this.expirationMap.delete(i);for(let[i,o]of n)this.dispose(o,i,"evict")}else{let n=this.size-this.max,i=[];for(let o of r.splice(0,n))i.push([o,this.data.get(o)]),this.data.delete(o),this.expirationMap.delete(o);for(let[o,s]of i)this.dispose(s,o,"evict");return}}}get size(){return this.data.size}purgeStale(){let e=Math.ceil(Ha());for(let r in this.expirations){if(r==="Infinity"||r>e)return;let n=[...this.expirations[r]||[]],i=[];delete this.expirations[r];for(let o of n)i.push([o,this.data.get(o)]),this.data.delete(o),this.expirationMap.delete(o);for(let[o,s]of i)this.dispose(s,o,"stale")}this.size===0&&this.cancelTimer()}*entries(){for(let e in this.expirations)for(let r of this.expirations[e])yield[r,this.data.get(r)]}*keys(){for(let e in this.expirations)for(let r of this.expirations[e])yield r}*values(){for(let e in this.expirations)for(let r of this.expirations[e])yield this.data.get(r)}[Symbol.iterator](){return this.entries()}};Hp.exports=xd});var cy=$(ay=>{"use strict";var IR=f(h());ay.supports=function(...e){let r=e.reduce((n,i)=>Object.assign(n,i),{});return Object.assign(r,{snapshots:r.snapshots||!1,permanence:r.permanence||!1,seek:r.seek||!1,clear:r.clear||!1,getMany:r.getMany||!1,keyIterator:r.keyIterator||!1,valueIterator:r.valueIterator||!1,iteratorNextv:r.iteratorNextv||!1,iteratorAll:r.iteratorAll||!1,status:r.status||!1,createIfMissing:r.createIfMissing||!1,errorIfExists:r.errorIfExists||!1,deferredOpen:r.deferredOpen||!1,promises:r.promises||!1,streams:r.streams||!1,encodings:Object.assign({},r.encodings),events:Object.assign({},r.events),additionalMethods:Object.assign({},r.additionalMethods)})}});var or=$((BR,uy)=>{"use strict";var RR=f(h());uy.exports=class extends Error{constructor(e,r){super(e||""),typeof r=="object"&&r!==null&&(r.code&&(this.code=String(r.code)),r.expected&&(this.expected=!0),r.transient&&(this.transient=!0),r.cause&&(this.cause=r.cause)),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}});var Pd=$((OR,dy)=>{"use strict";var kR=f(h()),Ud=null;dy.exports=function(){return Ud===null&&(Ud={textEncoder:new TextEncoder,textDecoder:new TextDecoder}),Ud}});var Md=$(ly=>{"use strict";var UR=f(h()),Kd=or(),u1=new Set(["buffer","view","utf8"]),Ld=class{constructor(e){if(this.encode=e.encode||this.encode,this.decode=e.decode||this.decode,this.name=e.name||this.name,this.format=e.format||this.format,typeof this.encode!="function")throw new TypeError("The 'encode' property must be a function");if(typeof this.decode!="function")throw new TypeError("The 'decode' property must be a function");if(this.encode=this.encode.bind(this),this.decode=this.decode.bind(this),typeof this.name!="string"||this.name==="")throw new TypeError("The 'name' property must be a string");if(typeof this.format!="string"||!u1.has(this.format))throw new TypeError("The 'format' property must be one of 'buffer', 'view', 'utf8'");e.createViewTranscoder&&(this.createViewTranscoder=e.createViewTranscoder),e.createBufferTranscoder&&(this.createBufferTranscoder=e.createBufferTranscoder),e.createUTF8Transcoder&&(this.createUTF8Transcoder=e.createUTF8Transcoder)}get commonName(){return this.name.split("+")[0]}createBufferTranscoder(){throw new Kd(`Encoding '${this.name}' cannot be transcoded to 'buffer'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createViewTranscoder(){throw new Kd(`Encoding '${this.name}' cannot be transcoded to 'view'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createUTF8Transcoder(){throw new Kd(`Encoding '${this.name}' cannot be transcoded to 'utf8'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}};ly.Encoding=Ld});var Fd=$(Wa=>{"use strict";var KR=f(h()),{Buffer:$d}=_t()||{},{Encoding:qd}=Md(),d1=Pd(),xs=class extends qd{constructor(e){super({...e,format:"buffer"})}createViewTranscoder(){return new Es({encode:this.encode,decode:e=>this.decode($d.from(e.buffer,e.byteOffset,e.byteLength)),name:`${this.name}+view`})}createBufferTranscoder(){return this}},Es=class extends qd{constructor(e){super({...e,format:"view"})}createBufferTranscoder(){return new xs({encode:e=>{let r=this.encode(e);return $d.from(r.buffer,r.byteOffset,r.byteLength)},decode:this.decode,name:`${this.name}+buffer`})}createViewTranscoder(){return this}},Nd=class extends qd{constructor(e){super({...e,format:"utf8"})}createBufferTranscoder(){return new xs({encode:e=>$d.from(this.encode(e),"utf8"),decode:e=>this.decode(e.toString("utf8")),name:`${this.name}+buffer`})}createViewTranscoder(){let{textEncoder:e,textDecoder:r}=d1();return new Es({encode:n=>e.encode(this.encode(n)),decode:n=>this.decode(r.decode(n)),name:`${this.name}+view`})}createUTF8Transcoder(){return this}};Wa.BufferFormat=xs;Wa.ViewFormat=Es;Wa.UTF8Format=Nd});var yy=$(ui=>{"use strict";var MR=f(h()),{Buffer:pt}=_t()||{Buffer:{isBuffer:()=>!1}},{textEncoder:hy,textDecoder:fy}=Pd()(),{BufferFormat:vs,ViewFormat:Vd,UTF8Format:py}=Fd(),za=t=>t;ui.utf8=new py({encode:function(t){return pt.isBuffer(t)?t.toString("utf8"):ArrayBuffer.isView(t)?fy.decode(t):String(t)},decode:za,name:"utf8",createViewTranscoder(){return new Vd({encode:function(t){return ArrayBuffer.isView(t)?t:hy.encode(t)},decode:function(t){return fy.decode(t)},name:`${this.name}+view`})},createBufferTranscoder(){return new vs({encode:function(t){return pt.isBuffer(t)?t:ArrayBuffer.isView(t)?pt.from(t.buffer,t.byteOffset,t.byteLength):pt.from(String(t),"utf8")},decode:function(t){return t.toString("utf8")},name:`${this.name}+buffer`})}});ui.json=new py({encode:JSON.stringify,decode:JSON.parse,name:"json"});ui.buffer=new vs({encode:function(t){return pt.isBuffer(t)?t:ArrayBuffer.isView(t)?pt.from(t.buffer,t.byteOffset,t.byteLength):pt.from(String(t),"utf8")},decode:za,name:"buffer",createViewTranscoder(){return new Vd({encode:function(t){return ArrayBuffer.isView(t)?t:pt.from(String(t),"utf8")},decode:function(t){return pt.from(t.buffer,t.byteOffset,t.byteLength)},name:`${this.name}+view`})}});ui.view=new Vd({encode:function(t){return ArrayBuffer.isView(t)?t:hy.encode(t)},decode:za,name:"view",createBufferTranscoder(){return new vs({encode:function(t){return pt.isBuffer(t)?t:ArrayBuffer.isView(t)?pt.from(t.buffer,t.byteOffset,t.byteLength):pt.from(String(t),"utf8")},decode:za,name:`${this.name}+buffer`})}});ui.hex=new vs({encode:function(t){return pt.isBuffer(t)?t:pt.from(String(t),"hex")},decode:function(t){return t.toString("hex")},name:"hex"});ui.base64=new vs({encode:function(t){return pt.isBuffer(t)?t:pt.from(String(t),"base64")},decode:function(t){return t.toString("base64")},name:"base64"})});var wy=$(gy=>{"use strict";var $R=f(h()),my=or(),Ja=yy(),{Encoding:l1}=Md(),{BufferFormat:f1,ViewFormat:h1,UTF8Format:p1}=Fd(),Ss=Symbol("formats"),Ga=Symbol("encodings"),y1=new Set(["buffer","view","utf8"]),Hd=class{constructor(e){if(Array.isArray(e)){if(!e.every(r=>y1.has(r)))throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}else throw new TypeError("The first argument 'formats' must be an array");this[Ga]=new Map,this[Ss]=new Set(e);for(let r in Ja)try{this.encoding(r)}catch(n){if(n.code!=="LEVEL_ENCODING_NOT_SUPPORTED")throw n}}encodings(){return Array.from(new Set(this[Ga].values()))}encoding(e){let r=this[Ga].get(e);if(r===void 0){if(typeof e=="string"&&e!==""){if(r=b1[e],!r)throw new my(`Encoding '${e}' is not found`,{code:"LEVEL_ENCODING_NOT_FOUND"})}else{if(typeof e!="object"||e===null)throw new TypeError("First argument 'encoding' must be a string or object");r=m1(e)}let{name:n,format:i}=r;if(!this[Ss].has(i))if(this[Ss].has("view"))r=r.createViewTranscoder();else if(this[Ss].has("buffer"))r=r.createBufferTranscoder();else if(this[Ss].has("utf8"))r=r.createUTF8Transcoder();else throw new my(`Encoding '${n}' cannot be transcoded`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"});for(let o of[e,n,r.name,r.commonName])this[Ga].set(o,r)}return r}};gy.Transcoder=Hd;function m1(t){if(t instanceof l1)return t;let e="type"in t&&typeof t.type=="string"?t.type:void 0,r=t.name||e||`anonymous-${x1++}`;switch(g1(t)){case"view":return new h1({...t,name:r});case"utf8":return new p1({...t,name:r});case"buffer":return new f1({...t,name:r});default:throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}}function g1(t){return"format"in t&&t.format!==void 0?t.format:"buffer"in t&&typeof t.buffer=="boolean"?t.buffer?"buffer":"utf8":"code"in t&&Number.isInteger(t.code)?"view":"buffer"}var w1={binary:Ja.buffer,"utf-8":Ja.utf8},b1={...Ja,...w1},x1=0});var uo=$((qR,jd)=>{"use strict";var FR=f(h()),co=typeof Reflect=="object"?Reflect:null,by=co&&typeof co.apply=="function"?co.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Ya;co&&typeof co.ownKeys=="function"?Ya=co.ownKeys:Object.getOwnPropertySymbols?Ya=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Ya=function(e){return Object.getOwnPropertyNames(e)};function E1(t){console&&console.warn&&console.warn(t)}var Ey=Number.isNaN||function(e){return e!==e};function Ee(){Ee.init.call(this)}jd.exports=Ee;jd.exports.once=A1;Ee.EventEmitter=Ee;Ee.prototype._events=void 0;Ee.prototype._eventsCount=0;Ee.prototype._maxListeners=void 0;var xy=10;function Xa(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Ee,"defaultMaxListeners",{enumerable:!0,get:function(){return xy},set:function(t){if(typeof t!="number"||t<0||Ey(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");xy=t}});Ee.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};Ee.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Ey(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function vy(t){return t._maxListeners===void 0?Ee.defaultMaxListeners:t._maxListeners}Ee.prototype.getMaxListeners=function(){return vy(this)};Ee.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",o=this._events;if(o!==void 0)i=i&&o.error===void 0;else if(!i)return!1;if(i){var s;if(r.length>0&&(s=r[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=o[e];if(u===void 0)return!1;if(typeof u=="function")by(u,this,r);else for(var d=u.length,c=Iy(u,d),n=0;n<d;++n)by(c[n],this,r);return!0};function Sy(t,e,r,n){var i,o,s;if(Xa(r),o=t._events,o===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),s===void 0)s=o[e]=r,++t._eventsCount;else if(typeof s=="function"?s=o[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),i=vy(t),i>0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,E1(a)}return t}Ee.prototype.addListener=function(e,r){return Sy(this,e,r,!1)};Ee.prototype.on=Ee.prototype.addListener;Ee.prototype.prependListener=function(e,r){return Sy(this,e,r,!0)};function v1(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _y(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=v1.bind(n);return i.listener=r,n.wrapFn=i,i}Ee.prototype.once=function(e,r){return Xa(r),this.on(e,_y(this,e,r)),this};Ee.prototype.prependOnceListener=function(e,r){return Xa(r),this.prependListener(e,_y(this,e,r)),this};Ee.prototype.removeListener=function(e,r){var n,i,o,s,a;if(Xa(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(o=-1,s=n.length-1;s>=0;s--)if(n[s]===r||n[s].listener===r){a=n[s].listener,o=s;break}if(o<0)return this;o===0?n.shift():S1(n,o),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};Ee.prototype.off=Ee.prototype.removeListener;Ee.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var o=Object.keys(n),s;for(i=0;i<o.length;++i)s=o[i],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function Ay(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?_1(i):Iy(i,i.length)}Ee.prototype.listeners=function(e){return Ay(this,e,!0)};Ee.prototype.rawListeners=function(e){return Ay(this,e,!1)};Ee.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Ty.call(t,e)};Ee.prototype.listenerCount=Ty;function Ty(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Ee.prototype.eventNames=function(){return this._eventsCount>0?Ya(this._events):[]};function Iy(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function S1(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function _1(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function A1(t,e){return new Promise(function(r,n){function i(s){t.removeListener(e,o),n(s)}function o(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}Dy(t,e,o,{once:!0}),e!=="error"&&T1(t,i,{once:!0})})}function T1(t,e,r){typeof t.on=="function"&&Dy(t,"error",e,r)}function Dy(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(o){n.once&&t.removeEventListener(e,i),r(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var Ry=$((VR,By)=>{var HR=f(h());By.exports=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(t)});var _s=$(Wd=>{"use strict";var WR=f(h()),Oy=Ry();Wd.fromCallback=function(t,e){if(t===void 0){var r=new Promise(function(n,i){t=function(o,s){o?i(o):n(s)}});t[e!==void 0?e:"promise"]=r}else if(typeof t!="function")throw new TypeError("Callback must be a function");return t};Wd.fromPromise=function(t,e){if(e===void 0)return t;t.then(function(r){Oy(()=>e(null,r))}).catch(function(r){Oy(()=>e(r))})}});var Za=$(zd=>{"use strict";var GR=f(h());zd.getCallback=function(t,e){return typeof t=="function"?t:e};zd.getOptions=function(t,e){return typeof t=="object"&&t!==null?t:e!==void 0?e:{}}});var Bn=$(rc=>{"use strict";var YR=f(h()),{fromCallback:Gd}=_s(),Pt=or(),{getOptions:Jd,getCallback:ky}=Za(),di=Symbol("promise"),lo=Symbol("callback"),Sr=Symbol("working"),li=Symbol("handleOne"),Jr=Symbol("handleMany"),Yd=Symbol("autoClose"),In=Symbol("finishWork"),_r=Symbol("returnMany"),_n=Symbol("closing"),As=Symbol("handleClose"),Qa=Symbol("closed"),Ts=Symbol("closeCallbacks"),Tn=Symbol("keyEncoding"),fi=Symbol("valueEncoding"),Xd=Symbol("abortOnClose"),ec=Symbol("legacy"),Zd=Symbol("keys"),Qd=Symbol("values"),An=Symbol("limit"),Gt=Symbol("count"),tc=Object.freeze({}),I1=()=>{},Cy=!1,Is=class{constructor(e,r,n){if(typeof e!="object"||e===null){let i=e===null?"null":typeof e;throw new TypeError(`The first argument must be an abstract-level database, received ${i}`)}if(typeof r!="object"||r===null)throw new TypeError("The second argument must be an options object");this[Qa]=!1,this[Ts]=[],this[Sr]=!1,this[_n]=!1,this[Yd]=!1,this[lo]=null,this[li]=this[li].bind(this),this[Jr]=this[Jr].bind(this),this[As]=this[As].bind(this),this[Tn]=r[Tn],this[fi]=r[fi],this[ec]=n,this[An]=Number.isInteger(r.limit)&&r.limit>=0?r.limit:1/0,this[Gt]=0,this[Xd]=!!r.abortOnClose,this.db=e,this.db.attachResource(this),this.nextTick=e.nextTick}get count(){return this[Gt]}get limit(){return this[An]}next(e){let r;if(e===void 0)r=new Promise((n,i)=>{e=(o,s,a)=>{o?i(o):this[ec]?s===void 0&&a===void 0?n():n([s,a]):n(s)}});else if(typeof e!="function")throw new TypeError("Callback must be a function");return this[_n]?this.nextTick(e,new Pt("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Sr]?this.nextTick(e,new Pt("Iterator is busy: cannot call next() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[Sr]=!0,this[lo]=e,this[Gt]>=this[An]?this.nextTick(this[li],null):this._next(this[li])),r}_next(e){this.nextTick(e)}nextv(e,r,n){return n=ky(r,n),n=Gd(n,di),r=Jd(r,tc),Number.isInteger(e)?(this[_n]?this.nextTick(n,new Pt("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Sr]?this.nextTick(n,new Pt("Iterator is busy: cannot call nextv() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(e<1&&(e=1),this[An]<1/0&&(e=Math.min(e,this[An]-this[Gt])),this[Sr]=!0,this[lo]=n,e<=0?this.nextTick(this[Jr],null,[]):this._nextv(e,r,this[Jr])),n[di]):(this.nextTick(n,new TypeError("The first argument 'size' must be an integer")),n[di])}_nextv(e,r,n){let i=[],o=(s,a,u)=>{if(s)return n(s);if(this[ec]?a===void 0&&u===void 0:a===void 0)return n(null,i);i.push(this[ec]?[a,u]:a),i.length===e?n(null,i):this._next(o)};this._next(o)}all(e,r){return r=ky(e,r),r=Gd(r,di),e=Jd(e,tc),this[_n]?this.nextTick(r,new Pt("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Sr]?this.nextTick(r,new Pt("Iterator is b