var Bx=Object.create;var Yu=Object.defineProperty;var Dx=Object.getOwnPropertyDescriptor;var Rx=Object.getOwnPropertyNames;var Ox=Object.getPrototypeOf,Ux=Object.prototype.hasOwnProperty;var z=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Rc=(t,e)=>{for(var r in e)Yu(t,r,{get:e[r],enumerable:!0})},Cx=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Rx(e))!Ux.call(t,i)&&i!==r&&Yu(t,i,{get:()=>e[i],enumerable:!(n=Dx(e,i))||n.enumerable});return t};var f=(t,e,r)=>(r=t!=null?Bx(Ox(t)):{},Cx(e||!t||!t.__esModule?Yu(r,"default",{value:t,enumerable:!0}):r,t));var op=z(Oc=>{"use strict";var S6=f(h());Oc.byteLength=kx;Oc.toByteArray=Lx;Oc.fromByteArray=$x;var xr=[],Wt=[],Px=typeof Uint8Array<"u"?Uint8Array:Array,Xu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ei=0,np=Xu.length;ei0)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 kx(t){var e=ip(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Kx(t,e,r){return(e+r)*3/4-r}function Lx(t){var e,r=ip(t),n=r[0],i=r[1],o=new Px(Kx(t,n,i)),s=0,c=i>0?n-4:n,a;for(a=0;a>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=Wt[t.charCodeAt(a)]<<2|Wt[t.charCodeAt(a+1)]>>4,o[s++]=e&255),i===1&&(e=Wt[t.charCodeAt(a)]<<10|Wt[t.charCodeAt(a+1)]<<4|Wt[t.charCodeAt(a+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function Mx(t){return xr[t>>18&63]+xr[t>>12&63]+xr[t>>6&63]+xr[t&63]}function Nx(t,e,r){for(var n,i=[],o=e;oc?c: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 sp=z(Zu=>{var T6=f(h());Zu.read=function(t,e,r,n,i){var o,s,c=i*8-n-1,a=(1<>1,u=-7,l=r?i-1:0,y=r?-1:1,g=t[e+l];for(l+=y,o=g&(1<<-u)-1,g>>=-u,u+=c;u>0;o=o*256+t[e+l],l+=y,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=n;u>0;s=s*256+t[e+l],l+=y,u-=8);if(o===0)o=1-d;else{if(o===a)return s?NaN:(g?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-d}return(g?-1:1)*s*Math.pow(2,o-n)};Zu.write=function(t,e,r,n,i,o){var s,c,a,d=o*8-i-1,u=(1<>1,y=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:o-1,p=n?1:-1,w=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-s))<1&&(s--,a*=2),s+l>=1?e+=y/a:e+=y*Math.pow(2,1-l),e*a>=2&&(s++,a/=2),s+l>=u?(c=0,s=u):s+l>=1?(c=(e*a-1)*Math.pow(2,i),s=s+l):(c=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+g]=c&255,g+=p,c/=256,i-=8);for(s=s<0;t[r+g]=s&255,g+=p,s/=256,d-=8);t[r+g-p]|=w*128}});var St=z(ro=>{"use strict";var B6=f(h());var Qu=op(),eo=sp(),cp=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ro.Buffer=B;ro.SlowBuffer=Wx;ro.INSPECT_MAX_BYTES=50;var Uc=2147483647;ro.kMaxLength=Uc;B.TYPED_ARRAY_SUPPORT=qx();!B.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 qx(){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(B.prototype,"parent",{enumerable:!0,get:function(){if(B.isBuffer(this))return this.buffer}});Object.defineProperty(B.prototype,"offset",{enumerable:!0,get:function(){if(B.isBuffer(this))return this.byteOffset}});function zr(t){if(t>Uc)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,B.prototype),e}function B(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 nd(t)}return lp(t,e,r)}B.poolSize=8192;function lp(t,e,r){if(typeof t=="string")return Vx(t,e);if(ArrayBuffer.isView(t))return Hx(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 td(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 B.from(n,e,r);let i=jx(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return B.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)}B.from=function(t,e,r){return lp(t,e,r)};Object.setPrototypeOf(B.prototype,Uint8Array.prototype);Object.setPrototypeOf(B,Uint8Array);function fp(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 Fx(t,e,r){return fp(t),t<=0?zr(t):e!==void 0?typeof r=="string"?zr(t).fill(e,r):zr(t).fill(e):zr(t)}B.alloc=function(t,e,r){return Fx(t,e,r)};function nd(t){return fp(t),zr(t<0?0:id(t)|0)}B.allocUnsafe=function(t){return nd(t)};B.allocUnsafeSlow=function(t){return nd(t)};function Vx(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!B.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=hp(t,e)|0,n=zr(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function ed(t){let e=t.length<0?0:id(t.length)|0,r=zr(e);for(let n=0;n=Uc)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Uc.toString(16)+" bytes");return t|0}function Wx(t){return+t!=t&&(t=0),B.alloc(+t)}B.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==B.prototype};B.compare=function(e,r){if(Er(e,Uint8Array)&&(e=B.from(e,e.offset,e.byteLength)),Er(r,Uint8Array)&&(r=B.from(r,r.offset,r.byteLength)),!B.isBuffer(e)||!B.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);oi.length?(B.isBuffer(s)||(s=B.from(s)),s.copy(i,o)):Uint8Array.prototype.set.call(i,s,o);else if(B.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function hp(t,e){if(B.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 rd(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return vp(t).length;default:if(i)return n?-1:rd(t).length;e=(""+e).toLowerCase(),i=!0}}B.byteLength=hp;function zx(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 nE(this,e,r);case"utf8":case"utf-8":return yp(this,e,r);case"ascii":return tE(this,e,r);case"latin1":case"binary":return rE(this,e,r);case"base64":return Qx(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return iE(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}B.prototype._isBuffer=!0;function ti(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}B.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;rr&&(e+=" ... "),""};cp&&(B.prototype[cp]=B.prototype.inspect);B.prototype.compare=function(e,r,n,i,o){if(Er(e,Uint8Array)&&(e=B.from(e,e.offset,e.byteLength)),!B.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,c=n-r,a=Math.min(s,c),d=this.slice(i,o),u=e.slice(r,n);for(let l=0;l2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,sd(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=B.from(e,n)),B.isBuffer(e))return e.length===0?-1:ap(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):ap(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function ap(t,e,r,n,i){let o=1,s=t.length,c=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,c/=2,r/=2}function a(u,l){return o===1?u[l]:u.readUInt16BE(l*o)}let d;if(i){let u=-1;for(d=r;ds&&(r=s-c),d=r;d>=0;d--){let u=!0;for(let l=0;li&&(n=i)):n=i;let o=e.length;n>o/2&&(n=o/2);let s;for(s=0;s>>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 Gx(this,e,r,n);case"utf8":case"utf-8":return Jx(this,e,r,n);case"ascii":case"latin1":case"binary":return Yx(this,e,r,n);case"base64":return Xx(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Zx(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};B.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Qx(t,e,r){return e===0&&r===t.length?Qu.fromByteArray(t):Qu.fromByteArray(t.slice(e,r))}function yp(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i239?4:o>223?3:o>191?2:1;if(i+c<=r){let a,d,u,l;switch(c){case 1:o<128&&(s=o);break;case 2:a=t[i+1],(a&192)===128&&(l=(o&31)<<6|a&63,l>127&&(s=l));break;case 3:a=t[i+1],d=t[i+2],(a&192)===128&&(d&192)===128&&(l=(o&15)<<12|(a&63)<<6|d&63,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:a=t[i+1],d=t[i+2],u=t[i+3],(a&192)===128&&(d&192)===128&&(u&192)===128&&(l=(o&15)<<18|(a&63)<<12|(d&63)<<6|u&63,l>65535&&l<1114112&&(s=l))}}s===null?(s=65533,c=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=c}return eE(n)}var up=4096;function eE(t){let e=t.length;if(e<=up)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn)&&(r=n);let i="";for(let o=e;on&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}B.prototype.readUintLE=B.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>>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};B.prototype.readUint8=B.prototype.readUInt8=function(e,r){return e=e>>>0,r||rt(e,1,this.length),this[e]};B.prototype.readUint16LE=B.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||rt(e,2,this.length),this[e]|this[e+1]<<8};B.prototype.readUint16BE=B.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||rt(e,2,this.length),this[e]<<8|this[e+1]};B.prototype.readUint32LE=B.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};B.prototype.readUint32BE=B.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])};B.prototype.readBigUInt64LE=An(function(e){e=e>>>0,to(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&us(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)<>>0,to(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&us(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)<>>0,r=r>>>0,n||rt(e,r,this.length);let i=this[e],o=1,s=0;for(;++s=o&&(i-=Math.pow(2,8*r)),i};B.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};B.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]};B.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};B.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};B.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};B.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]};B.prototype.readBigInt64LE=An(function(e){e=e>>>0,to(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&us(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<>>0,to(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&us(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||rt(e,4,this.length),eo.read(this,e,!0,23,4)};B.prototype.readFloatBE=function(e,r){return e=e>>>0,r||rt(e,4,this.length),eo.read(this,e,!1,23,4)};B.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||rt(e,8,this.length),eo.read(this,e,!0,52,8)};B.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||rt(e,8,this.length),eo.read(this,e,!1,52,8)};function vt(t,e,r,n,i,o){if(!B.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}B.prototype.writeUintLE=B.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;vt(this,e,r,n,c,0)}let o=1,s=0;for(this[r]=e&255;++s>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;vt(this,e,r,n,c,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};B.prototype.writeUint8=B.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||vt(this,e,r,1,255,0),this[r]=e&255,r+1};B.prototype.writeUint16LE=B.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||vt(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};B.prototype.writeUint16BE=B.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||vt(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};B.prototype.writeUint32LE=B.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||vt(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};B.prototype.writeUint32BE=B.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||vt(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 mp(t,e,r,n,i){Ep(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 gp(t,e,r,n,i){Ep(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}B.prototype.writeBigUInt64LE=An(function(e,r=0){return mp(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});B.prototype.writeBigUInt64BE=An(function(e,r=0){return gp(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});B.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let a=Math.pow(2,8*n-1);vt(this,e,r,n,a-1,-a)}let o=0,s=1,c=0;for(this[r]=e&255;++o>0)-c&255;return r+n};B.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let a=Math.pow(2,8*n-1);vt(this,e,r,n,a-1,-a)}let o=n-1,s=1,c=0;for(this[r+o]=e&255;--o>=0&&(s*=256);)e<0&&c===0&&this[r+o+1]!==0&&(c=1),this[r+o]=(e/s>>0)-c&255;return r+n};B.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||vt(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};B.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||vt(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};B.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||vt(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};B.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||vt(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};B.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||vt(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};B.prototype.writeBigInt64LE=An(function(e,r=0){return mp(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});B.prototype.writeBigInt64BE=An(function(e,r=0){return gp(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function wp(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 bp(t,e,r,n,i){return e=+e,r=r>>>0,i||wp(t,e,r,4,34028234663852886e22,-34028234663852886e22),eo.write(t,e,r,n,23,4),r+4}B.prototype.writeFloatLE=function(e,r,n){return bp(this,e,r,!0,n)};B.prototype.writeFloatBE=function(e,r,n){return bp(this,e,r,!1,n)};function xp(t,e,r,n,i){return e=+e,r=r>>>0,i||wp(t,e,r,8,17976931348623157e292,-17976931348623157e292),eo.write(t,e,r,n,52,8),r+8}B.prototype.writeDoubleLE=function(e,r,n){return xp(this,e,r,!0,n)};B.prototype.writeDoubleBE=function(e,r,n){return xp(this,e,r,!1,n)};B.prototype.copy=function(e,r,n,i){if(!B.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=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>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let o;if(typeof e=="number")for(o=r;o2**32?i=dp(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=dp(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function dp(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 oE(t,e,r){to(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&us(e,t.length-(r+1))}function Ep(t,e,r,n,i,o){if(t>r||t3?e===0||e===BigInt(0)?c=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:c=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:c=`>= ${e}${s} and <= ${r}${s}`,new Qi.ERR_OUT_OF_RANGE("value",c,t)}oE(n,i,o)}function to(t,e){if(typeof t!="number")throw new Qi.ERR_INVALID_ARG_TYPE(e,"number",t)}function us(t,e,r){throw Math.floor(t)!==t?(to(t,r),new Qi.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Qi.ERR_BUFFER_OUT_OF_BOUNDS:new Qi.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var sE=/[^+/0-9A-Za-z-_]/g;function cE(t){if(t=t.split("=")[0],t=t.trim().replace(sE,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function rd(t,e){e=e||1/0;let r,n=t.length,i=null,o=[];for(let s=0;s55295&&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 aE(t){let e=[];for(let r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function vp(t){return Qu.toByteArray(cE(t))}function Cc(t,e,r,n){let i;for(i=0;i=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 sd(t){return t!==t}var dE=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 An(t){return typeof BigInt>"u"?lE:t}function lE(){throw new Error("BigInt not supported")}});var h=z(()=>{"use strict";var Sp=St().Buffer,{Buffer:fE}=St();Sp.prototype.writeBigUInt64BE=fE.prototype.writeBigUInt64BE;globalThis.Buffer=Sp});var Tp=z((N6,Ap)=>{var $6=f(h()),hE=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Pc=()=>hE.now(),pE=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),cd=t=>t===1/0||pE(t),ad=class t{constructor({max:e=1/0,ttl:r,updateAgeOnGet:n=!1,checkAgeOnGet:i=!1,noUpdateTTL:o=!1,dispose:s,noDisposeOnSet:c=!1}={}){if(this.expirations=Object.create(null),this.data=new Map,this.expirationMap=new Map,r!==void 0&&!cd(r))throw new TypeError("ttl must be positive integer or Infinity if set");if(!cd(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=!!c,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{this.timer=void 0,this.timerExpiration=void 0,this.purgeStale();for(let i in this.expirations){this.setTimer(i,i-Pc());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(Pc()+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(!cd(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-Pc())):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(Pc());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()}};Ap.exports=ad});var Fp=z(qp=>{"use strict";var QD=f(h());qp.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=z((t8,Vp)=>{"use strict";var r8=f(h());Vp.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 vd=z((n8,Hp)=>{"use strict";var i8=f(h()),Ed=null;Hp.exports=function(){return Ed===null&&(Ed={textEncoder:new TextEncoder,textDecoder:new TextDecoder}),Ed}});var Td=z(jp=>{"use strict";var s8=f(h()),Sd=or(),WE=new Set(["buffer","view","utf8"]),Ad=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"||!WE.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 Sd(`Encoding '${this.name}' cannot be transcoded to 'buffer'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createViewTranscoder(){throw new Sd(`Encoding '${this.name}' cannot be transcoded to 'view'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createUTF8Transcoder(){throw new Sd(`Encoding '${this.name}' cannot be transcoded to 'utf8'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}};jp.Encoding=Ad});var Dd=z(Kc=>{"use strict";var a8=f(h()),{Buffer:Id}=St()||{},{Encoding:Bd}=Td(),zE=vd(),ps=class extends Bd{constructor(e){super({...e,format:"buffer"})}createViewTranscoder(){return new ys({encode:this.encode,decode:e=>this.decode(Id.from(e.buffer,e.byteOffset,e.byteLength)),name:`${this.name}+view`})}createBufferTranscoder(){return this}},ys=class extends Bd{constructor(e){super({...e,format:"view"})}createBufferTranscoder(){return new ps({encode:e=>{let r=this.encode(e);return Id.from(r.buffer,r.byteOffset,r.byteLength)},decode:this.decode,name:`${this.name}+buffer`})}createViewTranscoder(){return this}},_d=class extends Bd{constructor(e){super({...e,format:"utf8"})}createBufferTranscoder(){return new ps({encode:e=>Id.from(this.encode(e),"utf8"),decode:e=>this.decode(e.toString("utf8")),name:`${this.name}+buffer`})}createViewTranscoder(){let{textEncoder:e,textDecoder:r}=zE();return new ys({encode:n=>e.encode(this.encode(n)),decode:n=>this.decode(r.decode(n)),name:`${this.name}+view`})}createUTF8Transcoder(){return this}};Kc.BufferFormat=ps;Kc.ViewFormat=ys;Kc.UTF8Format=_d});var Jp=z(oi=>{"use strict";var d8=f(h()),{Buffer:yt}=St()||{Buffer:{isBuffer:()=>!1}},{textEncoder:zp,textDecoder:Wp}=vd()(),{BufferFormat:ms,ViewFormat:Rd,UTF8Format:Gp}=Dd(),Lc=t=>t;oi.utf8=new Gp({encode:function(t){return yt.isBuffer(t)?t.toString("utf8"):ArrayBuffer.isView(t)?Wp.decode(t):String(t)},decode:Lc,name:"utf8",createViewTranscoder(){return new Rd({encode:function(t){return ArrayBuffer.isView(t)?t:zp.encode(t)},decode:function(t){return Wp.decode(t)},name:`${this.name}+view`})},createBufferTranscoder(){return new ms({encode:function(t){return yt.isBuffer(t)?t:ArrayBuffer.isView(t)?yt.from(t.buffer,t.byteOffset,t.byteLength):yt.from(String(t),"utf8")},decode:function(t){return t.toString("utf8")},name:`${this.name}+buffer`})}});oi.json=new Gp({encode:JSON.stringify,decode:JSON.parse,name:"json"});oi.buffer=new ms({encode:function(t){return yt.isBuffer(t)?t:ArrayBuffer.isView(t)?yt.from(t.buffer,t.byteOffset,t.byteLength):yt.from(String(t),"utf8")},decode:Lc,name:"buffer",createViewTranscoder(){return new Rd({encode:function(t){return ArrayBuffer.isView(t)?t:yt.from(String(t),"utf8")},decode:function(t){return yt.from(t.buffer,t.byteOffset,t.byteLength)},name:`${this.name}+view`})}});oi.view=new Rd({encode:function(t){return ArrayBuffer.isView(t)?t:zp.encode(t)},decode:Lc,name:"view",createBufferTranscoder(){return new ms({encode:function(t){return yt.isBuffer(t)?t:ArrayBuffer.isView(t)?yt.from(t.buffer,t.byteOffset,t.byteLength):yt.from(String(t),"utf8")},decode:Lc,name:`${this.name}+buffer`})}});oi.hex=new ms({encode:function(t){return yt.isBuffer(t)?t:yt.from(String(t),"hex")},decode:function(t){return t.toString("hex")},name:"hex"});oi.base64=new ms({encode:function(t){return yt.isBuffer(t)?t:yt.from(String(t),"base64")},decode:function(t){return t.toString("base64")},name:"base64"})});var Zp=z(Xp=>{"use strict";var f8=f(h()),Yp=or(),Nc=Jp(),{Encoding:GE}=Td(),{BufferFormat:JE,ViewFormat:YE,UTF8Format:XE}=Dd(),gs=Symbol("formats"),Mc=Symbol("encodings"),ZE=new Set(["buffer","view","utf8"]),Od=class{constructor(e){if(Array.isArray(e)){if(!e.every(r=>ZE.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[Mc]=new Map,this[gs]=new Set(e);for(let r in Nc)try{this.encoding(r)}catch(n){if(n.code!=="LEVEL_ENCODING_NOT_SUPPORTED")throw n}}encodings(){return Array.from(new Set(this[Mc].values()))}encoding(e){let r=this[Mc].get(e);if(r===void 0){if(typeof e=="string"&&e!==""){if(r=r1[e],!r)throw new Yp(`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=QE(e)}let{name:n,format:i}=r;if(!this[gs].has(i))if(this[gs].has("view"))r=r.createViewTranscoder();else if(this[gs].has("buffer"))r=r.createBufferTranscoder();else if(this[gs].has("utf8"))r=r.createUTF8Transcoder();else throw new Yp(`Encoding '${n}' cannot be transcoded`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"});for(let o of[e,n,r.name,r.commonName])this[Mc].set(o,r)}return r}};Xp.Transcoder=Od;function QE(t){if(t instanceof GE)return t;let e="type"in t&&typeof t.type=="string"?t.type:void 0,r=t.name||e||`anonymous-${n1++}`;switch(e1(t)){case"view":return new YE({...t,name:r});case"utf8":return new XE({...t,name:r});case"buffer":return new JE({...t,name:r});default:throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}}function e1(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 t1={binary:Nc.buffer,"utf-8":Nc.utf8},r1={...Nc,...t1},n1=0});var ws=z((h8,Ud)=>{"use strict";var p8=f(h()),ao=typeof Reflect=="object"?Reflect:null,Qp=ao&&typeof ao.apply=="function"?ao.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},$c;ao&&typeof ao.ownKeys=="function"?$c=ao.ownKeys:Object.getOwnPropertySymbols?$c=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:$c=function(e){return Object.getOwnPropertyNames(e)};function i1(t){console&&console.warn&&console.warn(t)}var ty=Number.isNaN||function(e){return e!==e};function Te(){Te.init.call(this)}Ud.exports=Te;Ud.exports.once=a1;Te.EventEmitter=Te;Te.prototype._events=void 0;Te.prototype._eventsCount=0;Te.prototype._maxListeners=void 0;var ey=10;function qc(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Te,"defaultMaxListeners",{enumerable:!0,get:function(){return ey},set:function(t){if(typeof t!="number"||t<0||ty(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");ey=t}});Te.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};Te.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||ty(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 ry(t){return t._maxListeners===void 0?Te.defaultMaxListeners:t._maxListeners}Te.prototype.getMaxListeners=function(){return ry(this)};Te.prototype.emit=function(e){for(var r=[],n=1;n0&&(s=r[0]),s instanceof Error)throw s;var c=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw c.context=s,c}var a=o[e];if(a===void 0)return!1;if(typeof a=="function")Qp(a,this,r);else for(var d=a.length,u=cy(a,d),n=0;n0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=s.length,i1(c)}return t}Te.prototype.addListener=function(e,r){return ny(this,e,r,!1)};Te.prototype.on=Te.prototype.addListener;Te.prototype.prependListener=function(e,r){return ny(this,e,r,!0)};function o1(){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 iy(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=o1.bind(n);return i.listener=r,n.wrapFn=i,i}Te.prototype.once=function(e,r){return qc(r),this.on(e,iy(this,e,r)),this};Te.prototype.prependOnceListener=function(e,r){return qc(r),this.prependListener(e,iy(this,e,r)),this};Te.prototype.removeListener=function(e,r){var n,i,o,s,c;if(qc(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){c=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,c||r)}return this};Te.prototype.off=Te.prototype.removeListener;Te.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=0;i--)this.removeListener(e,r[i]);return this};function oy(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?c1(i):cy(i,i.length)}Te.prototype.listeners=function(e){return oy(this,e,!0)};Te.prototype.rawListeners=function(e){return oy(this,e,!1)};Te.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):sy.call(t,e)};Te.prototype.listenerCount=sy;function sy(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}Te.prototype.eventNames=function(){return this._eventsCount>0?$c(this._events):[]};function cy(t,e){for(var r=new Array(e),n=0;n{var m8=f(h());uy.exports=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(t)});var bs=z(Cd=>{"use strict";var w8=f(h()),ly=dy();Cd.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};Cd.fromPromise=function(t,e){if(e===void 0)return t;t.then(function(r){ly(()=>e(null,r))}).catch(function(r){ly(()=>e(r))})}});var Fc=z(Pd=>{"use strict";var x8=f(h());Pd.getCallback=function(t,e){return typeof t=="function"?t:e};Pd.getOptions=function(t,e){return typeof t=="object"&&t!==null?t:e!==void 0?e:{}}});var On=z(Wc=>{"use strict";var v8=f(h()),{fromCallback:kd}=bs(),kt=or(),{getOptions:Kd,getCallback:fy}=Fc(),si=Symbol("promise"),uo=Symbol("callback"),Sr=Symbol("working"),ci=Symbol("handleOne"),Jr=Symbol("handleMany"),Ld=Symbol("autoClose"),Dn=Symbol("finishWork"),Ar=Symbol("returnMany"),_n=Symbol("closing"),xs=Symbol("handleClose"),Vc=Symbol("closed"),Es=Symbol("closeCallbacks"),Bn=Symbol("keyEncoding"),ai=Symbol("valueEncoding"),Md=Symbol("abortOnClose"),Hc=Symbol("legacy"),Nd=Symbol("keys"),$d=Symbol("values"),In=Symbol("limit"),zt=Symbol("count"),jc=Object.freeze({}),d1=()=>{},hy=!1,vs=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[Vc]=!1,this[Es]=[],this[Sr]=!1,this[_n]=!1,this[Ld]=!1,this[uo]=null,this[ci]=this[ci].bind(this),this[Jr]=this[Jr].bind(this),this[xs]=this[xs].bind(this),this[Bn]=r[Bn],this[ai]=r[ai],this[Hc]=n,this[In]=Number.isInteger(r.limit)&&r.limit>=0?r.limit:1/0,this[zt]=0,this[Md]=!!r.abortOnClose,this.db=e,this.db.attachResource(this),this.nextTick=e.nextTick}get count(){return this[zt]}get limit(){return this[In]}next(e){let r;if(e===void 0)r=new Promise((n,i)=>{e=(o,s,c)=>{o?i(o):this[Hc]?s===void 0&&c===void 0?n():n([s,c]):n(s)}});else if(typeof e!="function")throw new TypeError("Callback must be a function");return this[_n]?this.nextTick(e,new kt("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Sr]?this.nextTick(e,new kt("Iterator is busy: cannot call next() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[Sr]=!0,this[uo]=e,this[zt]>=this[In]?this.nextTick(this[ci],null):this._next(this[ci])),r}_next(e){this.nextTick(e)}nextv(e,r,n){return n=fy(r,n),n=kd(n,si),r=Kd(r,jc),Number.isInteger(e)?(this[_n]?this.nextTick(n,new kt("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Sr]?this.nextTick(n,new kt("Iterator is busy: cannot call nextv() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(e<1&&(e=1),this[In]<1/0&&(e=Math.min(e,this[In]-this[zt])),this[Sr]=!0,this[uo]=n,e<=0?this.nextTick(this[Jr],null,[]):this._nextv(e,r,this[Jr])),n[si]):(this.nextTick(n,new TypeError("The first argument 'size' must be an integer")),n[si])}_nextv(e,r,n){let i=[],o=(s,c,a)=>{if(s)return n(s);if(this[Hc]?c===void 0&&a===void 0:c===void 0)return n(null,i);i.push(this[Hc]?[c,a]:c),i.length===e?n(null,i):this._next(o)};this._next(o)}all(e,r){return r=fy(e,r),r=kd(r,si),e=Kd(e,jc),this[_n]?this.nextTick(r,new kt("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Sr]?this.nextTick(r,new kt("Iterator is busy: cannot call all() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[Sr]=!0,this[uo]=r,this[Ld]=!0,this[zt]>=this[In]?this.nextTick(this[Jr],null,[]):this._all(e,this[Jr])),r[si]}_all(e,r){let n=this[zt],i=[],o=()=>{let c=this[In]<1/0?Math.min(1e3,this[In]-n):1e3;c<=0?this.nextTick(r,null,i):this._nextv(c,jc,s)},s=(c,a)=>{c?r(c):a.length===0?r(null,i):(i.push.apply(i,a),n+=a.length,o())};o()}[Dn](){let e=this[uo];return this[Md]&&e===null?d1:(this[Sr]=!1,this[uo]=null,this[_n]&&this._close(this[xs]),e)}[Ar](e,r,n){this[Ld]?this.close(e.bind(null,r,n)):e(r,n)}seek(e,r){if(r=Kd(r,jc),!this[_n]){if(this[Sr])throw new kt("Iterator is busy: cannot call seek() until next() has completed",{code:"LEVEL_ITERATOR_BUSY"});{let n=this.db.keyEncoding(r.keyEncoding||this[Bn]),i=n.format;r.keyEncoding!==i&&(r={...r,keyEncoding:i});let o=this.db.prefixKey(n.encode(e),i);this._seek(o,r)}}}_seek(e,r){throw new kt("Iterator does not support seek()",{code:"LEVEL_NOT_SUPPORTED"})}close(e){return e=kd(e,si),this[Vc]?this.nextTick(e):this[_n]?this[Es].push(e):(this[_n]=!0,this[Es].push(e),this[Sr]?this[Md]&&this[Dn]()(new kt("Aborted on iterator close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this._close(this[xs])),e[si]}_close(e){this.nextTick(e)}[xs](){this[Vc]=!0,this.db.detachResource(this);let e=this[Es];this[Es]=[];for(let r of e)r()}async*[Symbol.asyncIterator](){try{let e;for(;(e=await this.next())!==void 0;)yield e}finally{this[Vc]||await this.close()}}},lo=class extends vs{constructor(e,r){super(e,r,!0),this[Nd]=r.keys!==!1,this[$d]=r.values!==!1}[ci](e,r,n){let i=this[Dn]();if(e)return i(e);try{r=this[Nd]&&r!==void 0?this[Bn].decode(r):void 0,n=this[$d]&&n!==void 0?this[ai].decode(n):void 0}catch(o){return i(new Rn("entry",o))}r===void 0&&n===void 0||this[zt]++,i(null,r,n)}[Jr](e,r){let n=this[Dn]();if(e)return this[Ar](n,e);try{for(let i of r){let o=i[0],s=i[1];i[0]=this[Nd]&&o!==void 0?this[Bn].decode(o):void 0,i[1]=this[$d]&&s!==void 0?this[ai].decode(s):void 0}}catch(i){return this[Ar](n,new Rn("entries",i))}this[zt]+=r.length,this[Ar](n,null,r)}end(e){return!hy&&typeof console<"u"&&(hy=!0,console.warn(new kt("The iterator.end() method was renamed to close() and end() is an alias that will be removed in a future version",{code:"LEVEL_LEGACY"}))),this.close(e)}},qd=class extends vs{constructor(e,r){super(e,r,!1)}[ci](e,r){let n=this[Dn]();if(e)return n(e);try{r=r!==void 0?this[Bn].decode(r):void 0}catch(i){return n(new Rn("key",i))}r!==void 0&&this[zt]++,n(null,r)}[Jr](e,r){let n=this[Dn]();if(e)return this[Ar](n,e);try{for(let i=0;i{"use strict";var A8=f(h()),{AbstractKeyIterator:l1,AbstractValueIterator:f1}=On(),ui=Symbol("iterator"),Ss=Symbol("callback"),fo=Symbol("handleOne"),di=Symbol("handleMany"),As=class extends l1{constructor(e,r){super(e,r),this[ui]=e.iterator({...r,keys:!0,values:!1}),this[fo]=this[fo].bind(this),this[di]=this[di].bind(this)}},zc=class extends f1{constructor(e,r){super(e,r),this[ui]=e.iterator({...r,keys:!1,values:!0}),this[fo]=this[fo].bind(this),this[di]=this[di].bind(this)}};for(let t of[As,zc]){let e=t===As,r=e?n=>n[0]:n=>n[1];t.prototype._next=function(n){this[Ss]=n,this[ui].next(this[fo])},t.prototype[fo]=function(n,i,o){let s=this[Ss];n?s(n):s(null,e?i:o)},t.prototype._nextv=function(n,i,o){this[Ss]=o,this[ui].nextv(n,i,this[di])},t.prototype._all=function(n,i){this[Ss]=i,this[ui].all(n,this[di])},t.prototype[di]=function(n,i){let o=this[Ss];n?o(n):o(null,i.map(r))},t.prototype._seek=function(n,i){this[ui].seek(n,i)},t.prototype._close=function(n){this[ui].close(n)}}Vd.DefaultKeyIterator=As;Vd.DefaultValueIterator=zc});var yy=z(Qc=>{"use strict";var _8=f(h()),{AbstractIterator:h1,AbstractKeyIterator:p1,AbstractValueIterator:y1}=On(),Hd=or(),Tt=Symbol("nut"),Xc=Symbol("undefer"),Zc=Symbol("factory"),Gc=class extends h1{constructor(e,r){super(e,r),this[Tt]=null,this[Zc]=()=>e.iterator(r),this.db.defer(()=>this[Xc]())}},Jc=class extends p1{constructor(e,r){super(e,r),this[Tt]=null,this[Zc]=()=>e.keys(r),this.db.defer(()=>this[Xc]())}},Yc=class extends y1{constructor(e,r){super(e,r),this[Tt]=null,this[Zc]=()=>e.values(r),this.db.defer(()=>this[Xc]())}};for(let t of[Gc,Jc,Yc])t.prototype[Xc]=function(){this.db.status==="open"&&(this[Tt]=this[Zc]())},t.prototype._next=function(e){this[Tt]!==null?this[Tt].next(e):this.db.status==="opening"?this.db.defer(()=>this._next(e)):this.nextTick(e,new Hd("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._nextv=function(e,r,n){this[Tt]!==null?this[Tt].nextv(e,r,n):this.db.status==="opening"?this.db.defer(()=>this._nextv(e,r,n)):this.nextTick(n,new Hd("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._all=function(e,r){this[Tt]!==null?this[Tt].all(r):this.db.status==="opening"?this.db.defer(()=>this._all(e,r)):this.nextTick(r,new Hd("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._seek=function(e,r){this[Tt]!==null?this[Tt]._seek(e,r):this.db.status==="opening"&&this.db.defer(()=>this._seek(e,r))},t.prototype._close=function(e){this[Tt]!==null?this[Tt].close(e):this.db.status==="opening"?this.db.defer(()=>this._close(e)):this.nextTick(e)};Qc.DeferredIterator=Gc;Qc.DeferredKeyIterator=Jc;Qc.DeferredValueIterator=Yc});var Wd=z(gy=>{"use strict";var B8=f(h()),{fromCallback:my}=bs(),ea=or(),{getCallback:m1,getOptions:g1}=Fc(),ta=Symbol("promise"),Gt=Symbol("status"),ho=Symbol("operations"),Ts=Symbol("finishClose"),po=Symbol("closeCallbacks"),jd=class{constructor(e){if(typeof e!="object"||e===null){let r=e===null?"null":typeof e;throw new TypeError(`The first argument must be an abstract-level database, received ${r}`)}this[ho]=[],this[po]=[],this[Gt]="open",this[Ts]=this[Ts].bind(this),this.db=e,this.db.attachResource(this),this.nextTick=e.nextTick}get length(){return this[ho].length}put(e,r,n){if(this[Gt]!=="open")throw new ea("Batch is not open: cannot call put() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let i=this.db._checkKey(e)||this.db._checkValue(r);if(i)throw i;let o=n&&n.sublevel!=null?n.sublevel:this.db,s=n,c=o.keyEncoding(n&&n.keyEncoding),a=o.valueEncoding(n&&n.valueEncoding),d=c.format;n={...n,keyEncoding:d,valueEncoding:a.format},o!==this.db&&(n.sublevel=null);let u=o.prefixKey(c.encode(e),d),l=a.encode(r);return this._put(u,l,n),this[ho].push({...s,type:"put",key:e,value:r}),this}_put(e,r,n){}del(e,r){if(this[Gt]!=="open")throw new ea("Batch is not open: cannot call del() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let n=this.db._checkKey(e);if(n)throw n;let i=r&&r.sublevel!=null?r.sublevel:this.db,o=r,s=i.keyEncoding(r&&r.keyEncoding),c=s.format;return r={...r,keyEncoding:c},i!==this.db&&(r.sublevel=null),this._del(i.prefixKey(s.encode(e),c),r),this[ho].push({...o,type:"del",key:e}),this}_del(e,r){}clear(){if(this[Gt]!=="open")throw new ea("Batch is not open: cannot call clear() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});return this._clear(),this[ho]=[],this}_clear(){}write(e,r){return r=m1(e,r),r=my(r,ta),e=g1(e),this[Gt]!=="open"?this.nextTick(r,new ea("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"})):this.length===0?this.close(r):(this[Gt]="writing",this._write(e,n=>{this[Gt]="closing",this[po].push(()=>r(n)),n||this.db.emit("batch",this[ho]),this._close(this[Ts])})),r[ta]}_write(e,r){}close(e){return e=my(e,ta),this[Gt]==="closing"?this[po].push(e):this[Gt]==="closed"?this.nextTick(e):(this[po].push(e),this[Gt]!=="writing"&&(this[Gt]="closing",this._close(this[Ts]))),e[ta]}_close(e){this.nextTick(e)}[Ts](){this[Gt]="closed",this.db.detachResource(this);let e=this[po];this[po]=[];for(let r of e)r()}};gy.AbstractChainedBatch=jd});var by=z(wy=>{"use strict";var R8=f(h()),{AbstractChainedBatch:w1}=Wd(),b1=or(),yo=Symbol("encoded"),zd=class extends w1{constructor(e){super(e),this[yo]=[]}_put(e,r,n){this[yo].push({...n,type:"put",key:e,value:r})}_del(e,r){this[yo].push({...r,type:"del",key:e})}_clear(){this[yo]=[]}_write(e,r){this.db.status==="opening"?this.db.defer(()=>this._write(e,r)):this.db.status==="open"?this[yo].length===0?this.nextTick(r):this.db._batch(this[yo],e,r):this.nextTick(r,new b1("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"}))}};wy.DefaultChainedBatch=zd});var vy=z((O8,Ey)=>{"use strict";var U8=f(h()),xy=or(),x1=Object.prototype.hasOwnProperty,E1=new Set(["lt","lte","gt","gte"]);Ey.exports=function(t,e){let r={};for(let n in t)if(x1.call(t,n)&&!(n==="keyEncoding"||n==="valueEncoding")){if(n==="start"||n==="end")throw new xy(`The legacy range option '${n}' has been removed`,{code:"LEVEL_LEGACY"});if(n==="encoding")throw new xy("The levelup-style 'encoding' alias has been removed, use 'valueEncoding' instead",{code:"LEVEL_LEGACY"});E1.has(n)?r[n]=e.encode(t[n]):r[n]=t[n]}return r.reverse=!!r.reverse,r.limit=Number.isInteger(r.limit)&&r.limit>=0?r.limit:-1,r}});var Gd=z((C8,Ay)=>{var P8=f(h());var Sy;Ay.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:globalThis):t=>(Sy||(Sy=Promise.resolve())).then(t).catch(e=>setTimeout(()=>{throw e},0))});var Iy=z((k8,_y)=>{"use strict";var K8=f(h()),Ty=Gd();_y.exports=function(t,...e){e.length===0?Ty(t):Ty(()=>t(...e))}});var By=z(ra=>{"use strict";var M8=f(h()),{AbstractIterator:v1,AbstractKeyIterator:S1,AbstractValueIterator:A1}=On(),mo=Symbol("unfix"),sr=Symbol("iterator"),li=Symbol("handleOne"),Un=Symbol("handleMany"),Yr=Symbol("callback"),_s=class extends v1{constructor(e,r,n,i){super(e,r),this[sr]=n,this[mo]=i,this[li]=this[li].bind(this),this[Un]=this[Un].bind(this),this[Yr]=null}[li](e,r,n){let i=this[Yr];if(e)return i(e);r!==void 0&&(r=this[mo](r)),i(e,r,n)}[Un](e,r){let n=this[Yr];if(e)return n(e);for(let i of r){let o=i[0];o!==void 0&&(i[0]=this[mo](o))}n(e,r)}},Is=class extends S1{constructor(e,r,n,i){super(e,r),this[sr]=n,this[mo]=i,this[li]=this[li].bind(this),this[Un]=this[Un].bind(this),this[Yr]=null}[li](e,r){let n=this[Yr];if(e)return n(e);r!==void 0&&(r=this[mo](r)),n(e,r)}[Un](e,r){let n=this[Yr];if(e)return n(e);for(let i=0;i{"use strict";var $8=f(h()),Jd=or(),{Buffer:Zd}=St()||{},{AbstractSublevelIterator:T1,AbstractSublevelKeyIterator:_1,AbstractSublevelValueIterator:I1}=By(),Xr=Symbol("prefix"),Dy=Symbol("upperBound"),Ds=Symbol("prefixRange"),Kt=Symbol("parent"),Yd=Symbol("unfix"),Ry=new TextEncoder,B1={separator:"!"};Oy.exports=function({AbstractLevel:t}){class e extends t{static defaults(n){if(typeof n=="string")throw new Jd("The subleveldown string shorthand for { separator } has been removed",{code:"LEVEL_LEGACY"});if(n&&n.open)throw new Jd("The subleveldown open option has been removed",{code:"LEVEL_LEGACY"});return n==null?B1:n.separator?n:{...n,separator:"!"}}constructor(n,i,o){let{separator:s,manifest:c,...a}=e.defaults(o);i=R1(i,s);let d=s.charCodeAt(0)+1,u=n[Kt]||n;if(!Ry.encode(i).every(g=>g>d&&g<127))throw new Jd(`Prefix must use bytes > ${d} < 127`,{code:"LEVEL_INVALID_PREFIX"});super(D1(u,c),a);let l=(n.prefix||"")+s+i+s,y=l.slice(0,-1)+String.fromCharCode(d);this[Kt]=u,this[Xr]=new na(l),this[Dy]=new na(y),this[Yd]=new Qd,this.nextTick=u.nextTick}prefixKey(n,i){if(i==="utf8")return this[Xr].utf8+n;if(n.byteLength===0)return this[Xr][i];if(i==="view"){let o=this[Xr].view,s=new Uint8Array(o.byteLength+n.byteLength);return s.set(o,0),s.set(n,o.byteLength),s}else{let o=this[Xr].buffer;return Zd.concat([o,n],o.byteLength+n.byteLength)}}[Ds](n,i){n.gte!==void 0?n.gte=this.prefixKey(n.gte,i):n.gt!==void 0?n.gt=this.prefixKey(n.gt,i):n.gte=this[Xr][i],n.lte!==void 0?n.lte=this.prefixKey(n.lte,i):n.lt!==void 0?n.lt=this.prefixKey(n.lt,i):n.lte=this[Dy][i]}get prefix(){return this[Xr].utf8}get db(){return this[Kt]}_open(n,i){this[Kt].open({passive:!0},i)}_put(n,i,o,s){this[Kt].put(n,i,o,s)}_get(n,i,o){this[Kt].get(n,i,o)}_getMany(n,i,o){this[Kt].getMany(n,i,o)}_del(n,i,o){this[Kt].del(n,i,o)}_batch(n,i,o){this[Kt].batch(n,i,o)}_clear(n,i){this[Ds](n,n.keyEncoding),this[Kt].clear(n,i)}_iterator(n){this[Ds](n,n.keyEncoding);let i=this[Kt].iterator(n),o=this[Yd].get(this[Xr].utf8.length,n.keyEncoding);return new T1(this,n,i,o)}_keys(n){this[Ds](n,n.keyEncoding);let i=this[Kt].keys(n),o=this[Yd].get(this[Xr].utf8.length,n.keyEncoding);return new _1(this,n,i,o)}_values(n){this[Ds](n,n.keyEncoding);let i=this[Kt].values(n);return new I1(this,n,i)}}return{AbstractSublevel:e}};var D1=function(t,e){return{...t.supports,createIfMissing:!1,errorIfExists:!1,events:{},additionalMethods:{},...e,encodings:{utf8:Xd(t,"utf8"),buffer:Xd(t,"buffer"),view:Xd(t,"view")}}},Xd=function(t,e){return t.supports.encodings[e]?t.keyEncoding(e).name===e:!1},na=class{constructor(e){this.utf8=e,this.view=Ry.encode(e),this.buffer=Zd?Zd.from(this.view.buffer,0,this.view.byteLength):{}}},Qd=class{constructor(){this.cache=new Map}get(e,r){let n=this.cache.get(r);return n===void 0&&(r==="view"?n=(function(i,o){return o.subarray(i)}).bind(null,e):n=(function(i,o){return o.slice(i)}).bind(null,e),this.cache.set(r,n)),n}},R1=function(t,e){let r=0,n=t.length;for(;rr&&t[n-1]===e;)n--;return t.slice(r,n)}});var il=z(nl=>{"use strict";var F8=f(h()),{supports:O1}=Fp(),{Transcoder:U1}=Zp(),{EventEmitter:C1}=ws(),{fromCallback:Cn}=bs(),cr=or(),{AbstractIterator:fi}=On(),{DefaultKeyIterator:P1,DefaultValueIterator:k1}=py(),{DeferredIterator:K1,DeferredKeyIterator:L1,DeferredValueIterator:M1}=yy(),{DefaultChainedBatch:Cy}=by(),{getCallback:hi,getOptions:Pn}=Fc(),ia=vy(),fe=Symbol("promise"),Zr=Symbol("landed"),pi=Symbol("resources"),el=Symbol("closeResources"),Rs=Symbol("operations"),Os=Symbol("undefer"),oa=Symbol("deferOpen"),Py=Symbol("options"),pe=Symbol("status"),yi=Symbol("defaultOptions"),go=Symbol("transcoder"),sa=Symbol("keyEncoding"),tl=Symbol("valueEncoding"),N1=()=>{},Us=class extends C1{constructor(e,r){if(super(),typeof e!="object"||e===null)throw new TypeError("The first argument 'manifest' must be an object");r=Pn(r);let{keyEncoding:n,valueEncoding:i,passive:o,...s}=r;this[pi]=new Set,this[Rs]=[],this[oa]=!0,this[Py]=s,this[pe]="opening",this.supports=O1(e,{status:!0,promises:!0,clear:!0,getMany:!0,deferredOpen:!0,snapshots:e.snapshots!==!1,permanence:e.permanence!==!1,keyIterator:!0,valueIterator:!0,iteratorNextv:!0,iteratorAll:!0,encodings:e.encodings||{},events:Object.assign({},e.events,{opening:!0,open:!0,closing:!0,closed:!0,put:!0,del:!0,batch:!0,clear:!0})}),this[go]=new U1($1(this)),this[sa]=this[go].encoding(n||"utf8"),this[tl]=this[go].encoding(i||"utf8");for(let c of this[go].encodings())this.supports.encodings[c.commonName]||(this.supports.encodings[c.commonName]=!0);this[yi]={empty:Object.freeze({}),entry:Object.freeze({keyEncoding:this[sa].commonName,valueEncoding:this[tl].commonName}),key:Object.freeze({keyEncoding:this[sa].commonName})},this.nextTick(()=>{this[oa]&&this.open({passive:!1},N1)})}get status(){return this[pe]}keyEncoding(e){return this[go].encoding(e??this[sa])}valueEncoding(e){return this[go].encoding(e??this[tl])}open(e,r){r=hi(e,r),r=Cn(r,fe),e={...this[Py],...Pn(e)},e.createIfMissing=e.createIfMissing!==!1,e.errorIfExists=!!e.errorIfExists;let n=i=>{this[pe]==="closing"||this[pe]==="opening"?this.once(Zr,i?()=>n(i):n):this[pe]!=="open"?r(new cr("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN",cause:i})):r()};return e.passive?this[pe]==="opening"?this.once(Zr,n):this.nextTick(n):this[pe]==="closed"||this[oa]?(this[oa]=!1,this[pe]="opening",this.emit("opening"),this._open(e,i=>{if(i){this[pe]="closed",this[el](()=>{this.emit(Zr),n(i)}),this[Os]();return}this[pe]="open",this[Os](),this.emit(Zr),this[pe]==="open"&&this.emit("open"),this[pe]==="open"&&this.emit("ready"),n()})):this[pe]==="open"?this.nextTick(n):this.once(Zr,()=>this.open(e,r)),r[fe]}_open(e,r){this.nextTick(r)}close(e){e=Cn(e,fe);let r=n=>{this[pe]==="opening"||this[pe]==="closing"?this.once(Zr,n?r(n):r):this[pe]!=="closed"?e(new cr("Database is not closed",{code:"LEVEL_DATABASE_NOT_CLOSED",cause:n})):e()};if(this[pe]==="open"){this[pe]="closing",this.emit("closing");let n=i=>{this[pe]="open",this[Os](),this.emit(Zr),r(i)};this[el](()=>{this._close(i=>{if(i)return n(i);this[pe]="closed",this[Os](),this.emit(Zr),this[pe]==="closed"&&this.emit("closed"),r()})})}else this[pe]==="closed"?this.nextTick(r):this.once(Zr,()=>this.close(e));return e[fe]}[el](e){if(this[pi].size===0)return this.nextTick(e);let r=this[pi].size,n=!0,i=()=>{--r===0&&(n?this.nextTick(e):e())};for(let o of this[pi])o.close(i);n=!1,this[pi].clear()}_close(e){this.nextTick(e)}get(e,r,n){if(n=hi(r,n),n=Cn(n,fe),r=Pn(r,this[yi].entry),this[pe]==="opening")return this.defer(()=>this.get(e,r,n)),n[fe];if(wo(this,n))return n[fe];let i=this._checkKey(e);if(i)return this.nextTick(n,i),n[fe];let o=this.keyEncoding(r.keyEncoding),s=this.valueEncoding(r.valueEncoding),c=o.format,a=s.format;return(r.keyEncoding!==c||r.valueEncoding!==a)&&(r=Object.assign({},r,{keyEncoding:c,valueEncoding:a})),this._get(this.prefixKey(o.encode(e),c),r,(d,u)=>{if(d)return(d.code==="LEVEL_NOT_FOUND"||d.notFound||/NotFound/i.test(d))&&(d.code||(d.code="LEVEL_NOT_FOUND"),d.notFound||(d.notFound=!0),d.status||(d.status=404)),n(d);try{u=s.decode(u)}catch(l){return n(new cr("Could not decode value",{code:"LEVEL_DECODE_ERROR",cause:l}))}n(null,u)}),n[fe]}_get(e,r,n){this.nextTick(n,new Error("NotFound"))}getMany(e,r,n){if(n=hi(r,n),n=Cn(n,fe),r=Pn(r,this[yi].entry),this[pe]==="opening")return this.defer(()=>this.getMany(e,r,n)),n[fe];if(wo(this,n))return n[fe];if(!Array.isArray(e))return this.nextTick(n,new TypeError("The first argument 'keys' must be an array")),n[fe];if(e.length===0)return this.nextTick(n,null,[]),n[fe];let i=this.keyEncoding(r.keyEncoding),o=this.valueEncoding(r.valueEncoding),s=i.format,c=o.format;(r.keyEncoding!==s||r.valueEncoding!==c)&&(r=Object.assign({},r,{keyEncoding:s,valueEncoding:c}));let a=new Array(e.length);for(let d=0;d{if(d)return n(d);try{for(let l=0;lthis.put(e,r,n,i)),i[fe];if(wo(this,i))return i[fe];let o=this._checkKey(e)||this._checkValue(r);if(o)return this.nextTick(i,o),i[fe];let s=this.keyEncoding(n.keyEncoding),c=this.valueEncoding(n.valueEncoding),a=s.format,d=c.format;(n.keyEncoding!==a||n.valueEncoding!==d)&&(n=Object.assign({},n,{keyEncoding:a,valueEncoding:d}));let u=this.prefixKey(s.encode(e),a),l=c.encode(r);return this._put(u,l,n,y=>{if(y)return i(y);this.emit("put",e,r),i()}),i[fe]}_put(e,r,n,i){this.nextTick(i)}del(e,r,n){if(n=hi(r,n),n=Cn(n,fe),r=Pn(r,this[yi].key),this[pe]==="opening")return this.defer(()=>this.del(e,r,n)),n[fe];if(wo(this,n))return n[fe];let i=this._checkKey(e);if(i)return this.nextTick(n,i),n[fe];let o=this.keyEncoding(r.keyEncoding),s=o.format;return r.keyEncoding!==s&&(r=Object.assign({},r,{keyEncoding:s})),this._del(this.prefixKey(o.encode(e),s),r,c=>{if(c)return n(c);this.emit("del",e),n()}),n[fe]}_del(e,r,n){this.nextTick(n)}batch(e,r,n){if(!arguments.length){if(this[pe]==="opening")return new Cy(this);if(this[pe]!=="open")throw new cr("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._chainedBatch()}if(typeof e=="function"?n=e:n=hi(r,n),n=Cn(n,fe),r=Pn(r,this[yi].empty),this[pe]==="opening")return this.defer(()=>this.batch(e,r,n)),n[fe];if(wo(this,n))return n[fe];if(!Array.isArray(e))return this.nextTick(n,new TypeError("The first argument 'operations' must be an array")),n[fe];if(e.length===0)return this.nextTick(n),n[fe];let i=new Array(e.length),{keyEncoding:o,valueEncoding:s,...c}=r;for(let a=0;a{if(a)return n(a);this.emit("batch",e),n()}),n[fe]}_batch(e,r,n){this.nextTick(n)}sublevel(e,r){return this._sublevel(e,rl.defaults(r))}_sublevel(e,r){return new rl(this,e,r)}prefixKey(e,r){return e}clear(e,r){if(r=hi(e,r),r=Cn(r,fe),e=Pn(e,this[yi].empty),this[pe]==="opening")return this.defer(()=>this.clear(e,r)),r[fe];if(wo(this,r))return r[fe];let n=e,i=this.keyEncoding(e.keyEncoding);return e=ia(e,i),e.keyEncoding=i.format,e.limit===0?this.nextTick(r):this._clear(e,o=>{if(o)return r(o);this.emit("clear",n),r()}),r[fe]}_clear(e,r){this.nextTick(r)}iterator(e){let r=this.keyEncoding(e&&e.keyEncoding),n=this.valueEncoding(e&&e.valueEncoding);if(e=ia(e,r),e.keys=e.keys!==!1,e.values=e.values!==!1,e[fi.keyEncoding]=r,e[fi.valueEncoding]=n,e.keyEncoding=r.format,e.valueEncoding=n.format,this[pe]==="opening")return new K1(this,e);if(this[pe]!=="open")throw new cr("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._iterator(e)}_iterator(e){return new fi(this,e)}keys(e){let r=this.keyEncoding(e&&e.keyEncoding),n=this.valueEncoding(e&&e.valueEncoding);if(e=ia(e,r),e[fi.keyEncoding]=r,e[fi.valueEncoding]=n,e.keyEncoding=r.format,e.valueEncoding=n.format,this[pe]==="opening")return new L1(this,e);if(this[pe]!=="open")throw new cr("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._keys(e)}_keys(e){return new P1(this,e)}values(e){let r=this.keyEncoding(e&&e.keyEncoding),n=this.valueEncoding(e&&e.valueEncoding);if(e=ia(e,r),e[fi.keyEncoding]=r,e[fi.valueEncoding]=n,e.keyEncoding=r.format,e.valueEncoding=n.format,this[pe]==="opening")return new M1(this,e);if(this[pe]!=="open")throw new cr("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._values(e)}_values(e){return new k1(this,e)}defer(e){if(typeof e!="function")throw new TypeError("The first argument must be a function");this[Rs].push(e)}[Os](){if(this[Rs].length===0)return;let e=this[Rs];this[Rs]=[];for(let r of e)r()}attachResource(e){if(typeof e!="object"||e===null||typeof e.close!="function")throw new TypeError("The first argument must be a resource object");this[pi].add(e)}detachResource(e){this[pi].delete(e)}_chainedBatch(){return new Cy(this)}_checkKey(e){if(e==null)return new cr("Key cannot be null or undefined",{code:"LEVEL_INVALID_KEY"})}_checkValue(e){if(e==null)return new cr("Value cannot be null or undefined",{code:"LEVEL_INVALID_VALUE"})}};Us.prototype.nextTick=Iy();var{AbstractSublevel:rl}=Uy()({AbstractLevel:Us});nl.AbstractLevel=Us;nl.AbstractSublevel=rl;var wo=function(t,e){return t[pe]!=="open"?(t.nextTick(e,new cr("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"})),!0):!1},$1=function(t){return Object.keys(t.supports.encodings).filter(e=>!!t.supports.encodings[e])}});var ol=z(mi=>{"use strict";var H8=f(h());mi.AbstractLevel=il().AbstractLevel;mi.AbstractSublevel=il().AbstractSublevel;mi.AbstractIterator=On().AbstractIterator;mi.AbstractKeyIterator=On().AbstractKeyIterator;mi.AbstractValueIterator=On().AbstractValueIterator;mi.AbstractChainedBatch=Wd().AbstractChainedBatch});var Ky=z((j8,ky)=>{var W8=f(h());ky.exports=F1;var q1=Gd();function F1(t,e,r){if(typeof e!="number")throw new Error("second argument must be a Number");let n,i,o,s,c,a=!0,d;Array.isArray(t)?(n=[],o=i=t.length):(s=Object.keys(t),n={},o=i=s.length);function u(y){function g(){r&&r(y,n),r=null}a?q1(g):g()}function l(y,g,p){if(n[y]=p,g&&(c=!0),--o===0||g)u(g);else if(!c&&d{"use strict";var G8=f(h());Ly.exports=function(e){let r=e.gte!==void 0?e.gte:e.gt!==void 0?e.gt:void 0,n=e.lte!==void 0?e.lte:e.lt!==void 0?e.lt:void 0,i=e.gte===void 0,o=e.lte===void 0;return r!==void 0&&n!==void 0?IDBKeyRange.bound(r,n,i,o):r!==void 0?IDBKeyRange.lowerBound(r,i):n!==void 0?IDBKeyRange.upperBound(n,o):null}});var cl=z((J8,My)=>{"use strict";var Y8=f(h()),V1=new TextEncoder;My.exports=function(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):V1.encode(t)}});var Vy=z(Fy=>{"use strict";var Z8=f(h()),{AbstractIterator:H1}=ol(),Ny=sl(),ca=cl(),Tr=Symbol("cache"),Qr=Symbol("finished"),Lt=Symbol("options"),en=Symbol("currentOptions"),gi=Symbol("position"),al=Symbol("location"),bo=Symbol("first"),$y={},ul=class extends H1{constructor(e,r,n){super(e,n),this[Tr]=[],this[Qr]=this.limit===0,this[Lt]=n,this[en]={...n},this[gi]=void 0,this[al]=r,this[bo]=!0}_nextv(e,r,n){if(this[bo]=!1,this[Qr])return this.nextTick(n,null,[]);if(this[Tr].length>0)return e=Math.min(e,this[Tr].length),this.nextTick(n,null,this[Tr].splice(0,e));this[gi]!==void 0&&(this[Lt].reverse?(this[en].lt=this[gi],this[en].lte=void 0):(this[en].gt=this[gi],this[en].gte=void 0));let i;try{i=Ny(this[en])}catch{return this[Qr]=!0,this.nextTick(n,null,[])}let o=this.db.db.transaction([this[al]],"readonly"),s=o.objectStore(this[al]),c=[];if(this[Lt].reverse){let a=!this[Lt].values&&s.openKeyCursor?"openKeyCursor":"openCursor";s[a](i,"prev").onsuccess=d=>{let u=d.target.result;if(u){let{key:l,value:y}=u;this[gi]=l,c.push([this[Lt].keys&&l!==void 0?ca(l):void 0,this[Lt].values&&y!==void 0?ca(y):void 0]),c.length{if(a===void 0||d===void 0)return;let l=Math.max(a.length,d.length);l===0||e===1/0?this[Qr]=!0:this[gi]=a[l-1],c.length=l;for(let y=0;y{a=l.target.result,u()}:(a=[],this.nextTick(u)),this[Lt].values?s.getAll(i,e<1/0?e:void 0).onsuccess=l=>{d=l.target.result,u()}:(d=[],this.nextTick(u))}o.onabort=()=>{n(o.error||new Error("aborted by user")),n=null},o.oncomplete=()=>{n(null,c),n=null}}_next(e){if(this[Tr].length>0){let[r,n]=this[Tr].shift();this.nextTick(e,null,r,n)}else if(this[Qr])this.nextTick(e);else{let r=Math.min(100,this.limit-this.count);this[bo]&&(this[bo]=!1,r=1),this._nextv(r,$y,(n,i)=>{if(n)return e(n);this[Tr]=i,this._next(e)})}}_all(e,r){this[bo]=!1;let n=this[Tr].splice(0,this[Tr].length),i=this.limit-this.count-n.length;if(i<=0)return this.nextTick(r,null,n);this._nextv(i,$y,(o,s)=>{if(o)return r(o);n.length>0&&(s=n.concat(s)),r(null,s)})}_seek(e,r){this[bo]=!0,this[Tr]=[],this[Qr]=!1,this[gi]=void 0,this[en]={...this[Lt]};let n;try{n=Ny(this[Lt])}catch{this[Qr]=!0;return}n!==null&&!n.includes(e)?this[Qr]=!0:this[Lt].reverse?this[en].lte=e:this[en].gte=e}};Fy.Iterator=ul;function qy(t){typeof t.commit=="function"&&t.commit()}});var jy=z((Q8,Hy)=>{"use strict";var eR=f(h());Hy.exports=function(e,r,n,i,o){if(i.limit===0)return e.nextTick(o);let s=e.db.transaction([r],"readwrite"),c=s.objectStore(r),a=0;s.oncomplete=function(){o()},s.onabort=function(){o(s.error||new Error("aborted by user"))};let d=c.openKeyCursor?"openKeyCursor":"openCursor",u=i.reverse?"prev":"next";c[d](n,u).onsuccess=function(l){let y=l.target.result;y&&(c.delete(y.key).onsuccess=function(){(i.limit<=0||++a{"use strict";var rR=f(h()),{AbstractLevel:j1}=ol(),Wy=or(),W1=Ky(),{fromCallback:z1}=bs(),{Iterator:G1}=Vy(),zy=cl(),J1=jy(),Y1=sl(),Jy="level-js-",Cs=Symbol("idb"),dl=Symbol("namePrefix"),tn=Symbol("location"),ll=Symbol("version"),wi=Symbol("store"),Ps=Symbol("onComplete"),Gy=Symbol("promise"),aa=class extends j1{constructor(e,r,n){if(typeof r=="function"||typeof n=="function")throw new Wy("The levelup-style callback argument has been removed",{code:"LEVEL_LEGACY"});let{prefix:i,version:o,...s}=r||{};if(super({encodings:{view:!0},snapshots:!1,createIfMissing:!1,errorIfExists:!1,seek:!0},s),typeof e!="string")throw new Error("constructor requires a location string argument");this[tn]=e,this[dl]=i??Jy,this[ll]=parseInt(o||1,10),this[Cs]=null}get location(){return this[tn]}get namePrefix(){return this[dl]}get version(){return this[ll]}get db(){return this[Cs]}get type(){return"browser-level"}_open(e,r){let n=indexedDB.open(this[dl]+this[tn],this[ll]);n.onerror=function(){r(n.error||new Error("unknown error"))},n.onsuccess=()=>{this[Cs]=n.result,r()},n.onupgradeneeded=i=>{let o=i.target.result;o.objectStoreNames.contains(this[tn])||o.createObjectStore(this[tn])}}[wi](e){return this[Cs].transaction([this[tn]],e).objectStore(this[tn])}[Ps](e,r){let n=e.transaction;n.onabort=function(){r(n.error||new Error("aborted by user"))},n.oncomplete=function(){r(null,e.result)}}_get(e,r,n){let i=this[wi]("readonly"),o;try{o=i.get(e)}catch(s){return this.nextTick(n,s)}this[Ps](o,function(s,c){if(s)return n(s);if(c===void 0)return n(new Wy("Entry not found",{code:"LEVEL_NOT_FOUND"}));n(null,zy(c))})}_getMany(e,r,n){let i=this[wi]("readonly"),o=e.map(s=>c=>{let a;try{a=i.get(s)}catch(d){return c(d)}a.onsuccess=()=>{let d=a.result;c(null,d===void 0?d:zy(d))},a.onerror=d=>{d.stopPropagation(),c(a.error)}});W1(o,16,n)}_del(e,r,n){let i=this[wi]("readwrite"),o;try{o=i.delete(e)}catch(s){return this.nextTick(n,s)}this[Ps](o,n)}_put(e,r,n,i){let o=this[wi]("readwrite"),s;try{s=o.put(r,e)}catch(c){return this.nextTick(i,c)}this[Ps](s,i)}_iterator(e){return new G1(this,this[tn],e)}_batch(e,r,n){let i=this[wi]("readwrite"),o=i.transaction,s=0,c;o.onabort=function(){n(c||o.error||new Error("aborted by user"))},o.oncomplete=function(){n()};function a(){let d=e[s++],u=d.key,l;try{l=d.type==="del"?i.delete(u):i.put(d.value,u)}catch(y){c=y,o.abort();return}s=0)return J1(this,this[tn],n,e,r);try{let o=this[wi]("readwrite");i=n?o.delete(n):o.clear()}catch(o){return this.nextTick(r,o)}this[Ps](i,r)}_close(e){this[Cs].close(),this.nextTick(e)}};aa.destroy=function(t,e,r){typeof e=="function"&&(r=e,e=Jy),r=z1(r,Gy);let n=indexedDB.deleteDatabase(e+t);return n.onsuccess=function(){r()},n.onerror=function(i){r(i)},r[Gy]};Yy.BrowserLevel=aa});var Zy=z(Xy=>{var iR=f(h());Xy.Level=fl().BrowserLevel});var ze=z((dR,Qy)=>{"use strict";var lR=f(h());Qy.exports={ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Uint8Array}});var _r=z((fR,pl)=>{"use strict";var hR=f(h()),Z1=St(),Q1=Object.getPrototypeOf(async function(){}).constructor,e0=globalThis.Blob||Z1.Blob,ev=typeof e0<"u"?function(e){return e instanceof e0}:function(e){return!1},hl=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let n=0;n{t=n,e=i}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((n,...i)=>n?r(n):e(...i))})},debuglog(){return function(){}},format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,n]){let i=e.shift();return n==="f"?i.toFixed(6):n==="j"?JSON.stringify(i):n==="s"&&typeof i=="object"?`${i.constructor!==Object?i.constructor.name:""} {}`.trim():i.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}},types:{isAsyncFunction(t){return t instanceof Q1},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:ev};pl.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var la=z((pR,da)=>{"use strict";var yR=f(h()),{AbortController:t0,AbortSignal:tv}=typeof self<"u"?self:typeof window<"u"?window:void 0;da.exports=t0;da.exports.AbortSignal=tv;da.exports.default=t0});var wt=z((mR,i0)=>{"use strict";var gR=f(h()),{format:rv,inspect:fa,AggregateError:nv}=_r(),iv=globalThis.AggregateError||nv,ov=Symbol("kIsNodeError"),sv=["string","function","number","object","Function","Object","boolean","bigint","symbol"],cv=/^([A-Z][a-z0-9]*)+$/,av="__node_internal_",ha={};function xi(t,e){if(!t)throw new ha.ERR_INTERNAL_ASSERTION(e)}function r0(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 uv(t,e,r){if(typeof e=="function")return xi(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let n=(e.match(/%[dfijoOs]/g)||[]).length;return xi(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:rv(e,...r)}function ct(t,e,r){r||(r=Error);class n extends r{constructor(...o){super(uv(t,e,o))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=t,n.prototype[ov]=!0,ha[t]=n}function n0(t){let e=av+t.name;return Object.defineProperty(t,"name",{value:e}),t}function dv(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new iv([e,t],e.message);return r.code=e.code,r}return t||e}var yl=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new ha.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};ct("ERR_ASSERTION","%s",Error);ct("ERR_INVALID_ARG_TYPE",(t,e,r)=>{xi(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let n="The ";t.endsWith(" argument")?n+=`${t} `:n+=`"${t}" ${t.includes(".")?"property":"argument"} `,n+="must be ";let i=[],o=[],s=[];for(let a of e)xi(typeof a=="string","All expected entries have to be of type string"),sv.includes(a)?i.push(a.toLowerCase()):cv.test(a)?o.push(a):(xi(a!=="object",'The value "object" should be written as "Object"'),s.push(a));if(o.length>0){let a=i.indexOf("object");a!==-1&&(i.splice(i,a,1),o.push("Object"))}if(i.length>0){switch(i.length){case 1:n+=`of type ${i[0]}`;break;case 2:n+=`one of type ${i[0]} or ${i[1]}`;break;default:{let a=i.pop();n+=`one of type ${i.join(", ")}, or ${a}`}}(o.length>0||s.length>0)&&(n+=" or ")}if(o.length>0){switch(o.length){case 1:n+=`an instance of ${o[0]}`;break;case 2:n+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let a=o.pop();n+=`an instance of ${o.join(", ")}, or ${a}`}}s.length>0&&(n+=" or ")}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(n+="an "),n+=`${s[0]}`;break;case 2:n+=`one of ${s[0]} or ${s[1]}`;break;default:{let a=s.pop();n+=`one of ${s.join(", ")}, or ${a}`}}if(r==null)n+=`. Received ${r}`;else if(typeof r=="function"&&r.name)n+=`. Received function ${r.name}`;else if(typeof r=="object"){var c;if((c=r.constructor)!==null&&c!==void 0&&c.name)n+=`. Received an instance of ${r.constructor.name}`;else{let a=fa(r,{depth:-1});n+=`. Received ${a}`}}else{let a=fa(r,{colors:!1});a.length>25&&(a=`${a.slice(0,25)}...`),n+=`. Received type ${typeof r} (${a})`}return n},TypeError);ct("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=fa(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);ct("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var n;let i=r!=null&&(n=r.constructor)!==null&&n!==void 0&&n.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${i}.`},TypeError);ct("ERR_MISSING_ARGS",(...t)=>{xi(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(n=>`"${n}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let n=t.pop();e+=`The ${t.join(", ")}, and ${n} arguments`}break}return`${e} must be specified`},TypeError);ct("ERR_OUT_OF_RANGE",(t,e,r)=>{xi(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=r0(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=r0(n)),n+="n"):n=fa(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);ct("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);ct("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);ct("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);ct("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);ct("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);ct("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);ct("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);ct("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);ct("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);ct("ERR_STREAM_WRITE_AFTER_END","write after end",Error);ct("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);i0.exports={AbortError:yl,aggregateTwoErrors:n0(dv),hideStackFrames:n0,codes:ha}});var ks=z((wR,h0)=>{"use strict";var bR=f(h()),{ArrayIsArray:gl,ArrayPrototypeIncludes:a0,ArrayPrototypeJoin:u0,ArrayPrototypeMap:lv,NumberIsInteger:wl,NumberIsNaN:fv,NumberMAX_SAFE_INTEGER:hv,NumberMIN_SAFE_INTEGER:pv,NumberParseInt:yv,ObjectPrototypeHasOwnProperty:mv,RegExpPrototypeExec:d0,String:gv,StringPrototypeToUpperCase:wv,StringPrototypeTrim:bv}=ze(),{hideStackFrames:Jt,codes:{ERR_SOCKET_BAD_PORT:xv,ERR_INVALID_ARG_TYPE:bt,ERR_INVALID_ARG_VALUE:xo,ERR_OUT_OF_RANGE:Ei,ERR_UNKNOWN_SIGNAL:o0}}=wt(),{normalizeEncoding:Ev}=_r(),{isAsyncFunction:vv,isArrayBufferView:Sv}=_r().types,s0={};function Av(t){return t===(t|0)}function Tv(t){return t===t>>>0}var _v=/^[0-7]+$/,Iv="must be a 32-bit unsigned integer or an octal string";function Bv(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(d0(_v,t)===null)throw new xo(e,t,Iv);t=yv(t,8)}return l0(t,e),t}var Dv=Jt((t,e,r=pv,n=hv)=>{if(typeof t!="number")throw new bt(e,"number",t);if(!wl(t))throw new Ei(e,"an integer",t);if(tn)throw new Ei(e,`>= ${r} && <= ${n}`,t)}),Rv=Jt((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new bt(e,"number",t);if(!wl(t))throw new Ei(e,"an integer",t);if(tn)throw new Ei(e,`>= ${r} && <= ${n}`,t)}),l0=Jt((t,e,r=!1)=>{if(typeof t!="number")throw new bt(e,"number",t);if(!wl(t))throw new Ei(e,"an integer",t);let n=r?1:0,i=4294967295;if(ti)throw new Ei(e,`>= ${n} && <= ${i}`,t)});function bl(t,e){if(typeof t!="string")throw new bt(e,"string",t)}function Ov(t,e,r=void 0,n){if(typeof t!="number")throw new bt(e,"number",t);if(r!=null&&tn||(r!=null||n!=null)&&fv(t))throw new Ei(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var Uv=Jt((t,e,r)=>{if(!a0(r,t)){let i="must be one of: "+u0(lv(r,o=>typeof o=="string"?`'${o}'`:gv(o)),", ");throw new xo(e,t,i)}});function f0(t,e){if(typeof t!="boolean")throw new bt(e,"boolean",t)}function ml(t,e,r){return t==null||!mv(t,e)?r:t[e]}var Cv=Jt((t,e,r=null)=>{let n=ml(r,"allowArray",!1),i=ml(r,"allowFunction",!1);if(!ml(r,"nullable",!1)&&t===null||!n&&gl(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new bt(e,"Object",t)}),Pv=Jt((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new bt(e,"a dictionary",t)}),xl=Jt((t,e,r=0)=>{if(!gl(t))throw new bt(e,"Array",t);if(t.length{if(!Sv(t))throw new bt(e,["Buffer","TypedArray","DataView"],t)});function Nv(t,e){let r=Ev(e),n=t.length;if(r==="hex"&&n%2!==0)throw new xo("encoding",e,`is invalid for data of length ${n}`)}function $v(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&bv(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new xv(e,t,r);return t|0}var qv=Jt((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new bt(e,"AbortSignal",t)}),Fv=Jt((t,e)=>{if(typeof t!="function")throw new bt(e,"Function",t)}),Vv=Jt((t,e)=>{if(typeof t!="function"||vv(t))throw new bt(e,"Function",t)}),Hv=Jt((t,e)=>{if(t!==void 0)throw new bt(e,"undefined",t)});function jv(t,e,r){if(!a0(r,t))throw new bt(e,`('${u0(r,"|")}')`,t)}var Wv=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function c0(t,e){if(typeof t>"u"||!d0(Wv,t))throw new xo(e,t,'must be an array or string of format "; rel=preload; as=style"')}function zv(t){if(typeof t=="string")return c0(t,"hints"),t;if(gl(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n; rel=preload; as=style"')}h0.exports={isInt32:Av,isUint32:Tv,parseFileMode:Bv,validateArray:xl,validateStringArray:kv,validateBooleanArray:Kv,validateBoolean:f0,validateBuffer:Mv,validateDictionary:Pv,validateEncoding:Nv,validateFunction:Fv,validateInt32:Rv,validateInteger:Dv,validateNumber:Ov,validateObject:Cv,validateOneOf:Uv,validatePlainFunction:Vv,validatePort:$v,validateSignalName:Lv,validateString:bl,validateUint32:l0,validateUndefined:Hv,validateUnion:jv,validateAbortSignal:qv,validateLinkHeaderValue:zv}});var kn=z((xR,g0)=>{var ER=f(h()),qe=g0.exports={},Ir,Br;function El(){throw new Error("setTimeout has not been defined")}function vl(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Ir=setTimeout:Ir=El}catch{Ir=El}try{typeof clearTimeout=="function"?Br=clearTimeout:Br=vl}catch{Br=vl}})();function p0(t){if(Ir===setTimeout)return setTimeout(t,0);if((Ir===El||!Ir)&&setTimeout)return Ir=setTimeout,setTimeout(t,0);try{return Ir(t,0)}catch{try{return Ir.call(null,t,0)}catch{return Ir.call(this,t,0)}}}function Gv(t){if(Br===clearTimeout)return clearTimeout(t);if((Br===vl||!Br)&&clearTimeout)return Br=clearTimeout,clearTimeout(t);try{return Br(t)}catch{try{return Br.call(null,t)}catch{return Br.call(this,t)}}}var rn=[],Eo=!1,vi,pa=-1;function Jv(){!Eo||!vi||(Eo=!1,vi.length?rn=vi.concat(rn):pa=-1,rn.length&&y0())}function y0(){if(!Eo){var t=p0(Jv);Eo=!0;for(var e=rn.length;e;){for(vi=rn,rn=[];++pa1)for(var r=1;r{"use strict";var SR=f(h()),{Symbol:ya,SymbolAsyncIterator:w0,SymbolIterator:b0,SymbolFor:x0}=ze(),E0=ya("kDestroyed"),v0=ya("kIsErrored"),Sl=ya("kIsReadable"),S0=ya("kIsDisturbed"),Yv=x0("nodejs.webstream.isClosedPromise"),Xv=x0("nodejs.webstream.controllerErrorFunction");function ma(t,e=!1){var r;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}function ga(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function Zv(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function Dr(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function A0(t){return!!(t&&!Dr(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function T0(t){return!!(t&&!Dr(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function _0(t){return!!(t&&!Dr(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function Qv(t){return A0(t)||T0(t)||_0(t)}function e2(t,e){return t==null?!1:e===!0?typeof t[w0]=="function":e===!1?typeof t[b0]=="function":typeof t[w0]=="function"||typeof t[b0]=="function"}function wa(t){if(!Dr(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[E0]||n!=null&&n.destroyed)}function I0(t){if(!ga(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function t2(t,e){if(!ga(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function r2(t){if(!ma(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function B0(t,e){if(!ma(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function D0(t){return t&&t[Sl]!=null?t[Sl]:typeof t?.readable!="boolean"?null:wa(t)?!1:ma(t)&&t.readable&&!B0(t)}function R0(t){return typeof t?.writable!="boolean"?null:wa(t)?!1:ga(t)&&t.writable&&!I0(t)}function n2(t,e){return Dr(t)?wa(t)?!0:!(e?.readable!==!1&&D0(t)||e?.writable!==!1&&R0(t)):null}function i2(t){var e,r;return Dr(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function o2(t){var e,r;return Dr(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function s2(t){if(!Dr(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&O0(t)?t._closed:null}function O0(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function U0(t){return typeof t._sent100=="boolean"&&O0(t)}function c2(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function a2(t){if(!Dr(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&U0(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function u2(t){var e;return!!(t&&((e=t[S0])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function d2(t){var e,r,n,i,o,s,c,a,d,u;return!!(t&&((e=(r=(n=(i=(o=(s=t[v0])!==null&&s!==void 0?s:t.readableErrored)!==null&&o!==void 0?o:t.writableErrored)!==null&&i!==void 0?i:(c=t._readableState)===null||c===void 0?void 0:c.errorEmitted)!==null&&n!==void 0?n:(a=t._writableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&r!==void 0?r:(d=t._readableState)===null||d===void 0?void 0:d.errored)!==null&&e!==void 0?e:!((u=t._writableState)===null||u===void 0)&&u.errored))}C0.exports={kDestroyed:E0,isDisturbed:u2,kIsDisturbed:S0,isErrored:d2,kIsErrored:v0,isReadable:D0,kIsReadable:Sl,kIsClosedPromise:Yv,kControllerErrorFunction:Xv,isClosed:s2,isDestroyed:wa,isDuplexNodeStream:Zv,isFinished:n2,isIterable:e2,isReadableNodeStream:ma,isReadableStream:A0,isReadableEnded:r2,isReadableFinished:B0,isReadableErrored:o2,isNodeStream:Dr,isWebStream:Qv,isWritable:R0,isWritableNodeStream:ga,isWritableStream:T0,isWritableEnded:I0,isWritableFinished:t2,isWritableErrored:i2,isServerRequest:c2,isServerResponse:U0,willEmitClose:a2,isTransformStream:_0}});var on=z((AR,Bl)=>{var TR=f(h()),Kn=kn(),{AbortError:F0,codes:l2}=wt(),{ERR_INVALID_ARG_TYPE:f2,ERR_STREAM_PREMATURE_CLOSE:P0}=l2,{kEmptyObject:Tl,once:_l}=_r(),{validateAbortSignal:h2,validateFunction:p2,validateObject:y2,validateBoolean:m2}=ks(),{Promise:g2,PromisePrototypeThen:w2}=ze(),{isClosed:b2,isReadable:k0,isReadableNodeStream:Al,isReadableStream:x2,isReadableFinished:K0,isReadableErrored:L0,isWritable:M0,isWritableNodeStream:N0,isWritableStream:E2,isWritableFinished:$0,isWritableErrored:q0,isNodeStream:v2,willEmitClose:S2,kIsClosedPromise:A2}=Rr();function T2(t){return t.setHeader&&typeof t.abort=="function"}var Il=()=>{};function V0(t,e,r){var n,i;if(arguments.length===2?(r=e,e=Tl):e==null?e=Tl:y2(e,"options"),p2(r,"callback"),h2(e.signal,"options.signal"),r=_l(r),x2(t)||E2(t))return _2(t,e,r);if(!v2(t))throw new f2("stream",["ReadableStream","WritableStream","Stream"],t);let o=(n=e.readable)!==null&&n!==void 0?n:Al(t),s=(i=e.writable)!==null&&i!==void 0?i:N0(t),c=t._writableState,a=t._readableState,d=()=>{t.writable||y()},u=S2(t)&&Al(t)===o&&N0(t)===s,l=$0(t,!1),y=()=>{l=!0,t.destroyed&&(u=!1),!(u&&(!t.readable||o))&&(!o||g)&&r.call(t)},g=K0(t,!1),p=()=>{g=!0,t.destroyed&&(u=!1),!(u&&(!t.writable||s))&&(!s||l)&&r.call(t)},w=D=>{r.call(t,D)},x=b2(t),S=()=>{x=!0;let D=q0(t)||L0(t);if(D&&typeof D!="boolean")return r.call(t,D);if(o&&!g&&Al(t,!0)&&!K0(t,!1))return r.call(t,new P0);if(s&&!l&&!$0(t,!1))return r.call(t,new P0);r.call(t)},T=()=>{x=!0;let D=q0(t)||L0(t);if(D&&typeof D!="boolean")return r.call(t,D);r.call(t)},E=()=>{t.req.on("finish",y)};T2(t)?(t.on("complete",y),u||t.on("abort",S),t.req?E():t.on("request",E)):s&&!c&&(t.on("end",d),t.on("close",d)),!u&&typeof t.aborted=="boolean"&&t.on("aborted",S),t.on("end",p),t.on("finish",y),e.error!==!1&&t.on("error",w),t.on("close",S),x?Kn.nextTick(S):c!=null&&c.errorEmitted||a!=null&&a.errorEmitted?u||Kn.nextTick(T):(!o&&(!u||k0(t))&&(l||M0(t)===!1)||!s&&(!u||M0(t))&&(g||k0(t)===!1)||a&&t.req&&t.aborted)&&Kn.nextTick(T);let R=()=>{r=Il,t.removeListener("aborted",S),t.removeListener("complete",y),t.removeListener("abort",S),t.removeListener("request",E),t.req&&t.req.removeListener("finish",y),t.removeListener("end",d),t.removeListener("close",d),t.removeListener("finish",y),t.removeListener("end",p),t.removeListener("error",w),t.removeListener("close",S)};if(e.signal&&!x){let D=()=>{let O=r;R(),O.call(t,new F0(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Kn.nextTick(D);else{let O=r;r=_l((...k)=>{e.signal.removeEventListener("abort",D),O.apply(t,k)}),e.signal.addEventListener("abort",D)}}return R}function _2(t,e,r){let n=!1,i=Il;if(e.signal)if(i=()=>{n=!0,r.call(t,new F0(void 0,{cause:e.signal.reason}))},e.signal.aborted)Kn.nextTick(i);else{let s=r;r=_l((...c)=>{e.signal.removeEventListener("abort",i),s.apply(t,c)}),e.signal.addEventListener("abort",i)}let o=(...s)=>{n||Kn.nextTick(()=>r.apply(t,s))};return w2(t[A2].promise,o,o),Il}function I2(t,e){var r;let n=!1;return e===null&&(e=Tl),(r=e)!==null&&r!==void 0&&r.cleanup&&(m2(e.cleanup,"cleanup"),n=e.cleanup),new g2((i,o)=>{let s=V0(t,e,c=>{n&&s(),c?o(c):i()})})}Bl.exports=V0;Bl.exports.finished=I2});var Si=z((_R,X0)=>{"use strict";var IR=f(h()),Or=kn(),{aggregateTwoErrors:B2,codes:{ERR_MULTIPLE_CALLBACK:D2},AbortError:R2}=wt(),{Symbol:W0}=ze(),{kDestroyed:O2,isDestroyed:U2,isFinished:C2,isServerRequest:P2}=Rr(),z0=W0("kDestroy"),Dl=W0("kConstruct");function G0(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function k2(t,e){let r=this._readableState,n=this._writableState,i=n||r;return n!=null&&n.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(G0(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?H0(this,t,e):this.once(z0,function(o){H0(this,B2(o,t),e)}),this)}function H0(t,e,r){let n=!1;function i(o){if(n)return;n=!0;let s=t._readableState,c=t._writableState;G0(o,c,s),c&&(c.closed=!0),s&&(s.closed=!0),typeof r=="function"&&r(o),o?Or.nextTick(K2,t,o):Or.nextTick(J0,t)}try{t._destroy(e||null,i)}catch(o){i(o)}}function K2(t,e){Rl(t,e),J0(t)}function J0(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close")}function Rl(t,e){let r=t._readableState,n=t._writableState;n!=null&&n.errorEmitted||r!=null&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function L2(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function Ol(t,e,r){let n=t._readableState,i=t._writableState;if(i!=null&&i.destroyed||n!=null&&n.destroyed)return this;n!=null&&n.autoDestroy||i!=null&&i.autoDestroy?t.destroy(e):e&&(e.stack,i&&!i.errored&&(i.errored=e),n&&!n.errored&&(n.errored=e),r?Or.nextTick(Rl,t,e):Rl(t,e))}function M2(t,e){if(typeof t._construct!="function")return;let r=t._readableState,n=t._writableState;r&&(r.constructed=!1),n&&(n.constructed=!1),t.once(Dl,e),!(t.listenerCount(Dl)>1)&&Or.nextTick(N2,t)}function N2(t){let e=!1;function r(n){if(e){Ol(t,n??new D2);return}e=!0;let i=t._readableState,o=t._writableState,s=o||i;i&&(i.constructed=!0),o&&(o.constructed=!0),s.destroyed?t.emit(z0,n):n?Ol(t,n,!0):Or.nextTick($2,t)}try{t._construct(n=>{Or.nextTick(r,n)})}catch(n){Or.nextTick(r,n)}}function $2(t){t.emit(Dl)}function j0(t){return t?.setHeader&&typeof t.abort=="function"}function Y0(t){t.emit("close")}function q2(t,e){t.emit("error",e),Or.nextTick(Y0,t)}function F2(t,e){!t||U2(t)||(!e&&!C2(t)&&(e=new R2),P2(t)?(t.socket=null,t.destroy(e)):j0(t)?t.abort():j0(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?Or.nextTick(q2,t,e):Or.nextTick(Y0,t),t.destroyed||(t[O2]=!0))}X0.exports={construct:M2,destroyer:F2,destroy:k2,undestroy:L2,errorOrDestroy:Ol}});var Ea=z((BR,Q0)=>{"use strict";var DR=f(h()),{ArrayIsArray:V2,ObjectSetPrototypeOf:Z0}=ze(),{EventEmitter:ba}=ws();function xa(t){ba.call(this,t)}Z0(xa.prototype,ba.prototype);Z0(xa,ba);xa.prototype.pipe=function(t,e){let r=this;function n(u){t.writable&&t.write(u)===!1&&r.pause&&r.pause()}r.on("data",n);function i(){r.readable&&r.resume&&r.resume()}t.on("drain",i),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",s),r.on("close",c));let o=!1;function s(){o||(o=!0,t.end())}function c(){o||(o=!0,typeof t.destroy=="function"&&t.destroy())}function a(u){d(),ba.listenerCount(this,"error")===0&&this.emit("error",u)}Ul(r,"error",a),Ul(t,"error",a);function d(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",s),r.removeListener("close",c),r.removeListener("error",a),t.removeListener("error",a),r.removeListener("end",d),r.removeListener("close",d),t.removeListener("close",d)}return r.on("end",d),r.on("close",d),t.on("close",d),t.emit("pipe",r),t};function Ul(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):V2(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}Q0.exports={Stream:xa,prependListener:Ul}});var Ks=z((RR,va)=>{"use strict";var OR=f(h()),{AbortError:em,codes:H2}=wt(),{isNodeStream:tm,isWebStream:j2,kControllerErrorFunction:W2}=Rr(),z2=on(),{ERR_INVALID_ARG_TYPE:rm}=H2,G2=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new rm(e,"AbortSignal",t)};va.exports.addAbortSignal=function(e,r){if(G2(e,"signal"),!tm(r)&&!j2(r))throw new rm("stream",["ReadableStream","WritableStream","Stream"],r);return va.exports.addAbortSignalNoValidate(e,r)};va.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=tm(e)?()=>{e.destroy(new em(void 0,{cause:t.reason}))}:()=>{e[W2](new em(void 0,{cause:t.reason}))};return t.aborted?r():(t.addEventListener("abort",r),z2(e,()=>t.removeEventListener("abort",r))),e}});var om=z((CR,im)=>{"use strict";var PR=f(h()),{StringPrototypeSlice:nm,SymbolIterator:J2,TypedArrayPrototypeSet:Sa,Uint8Array:Y2}=ze(),{Buffer:Cl}=St(),{inspect:X2}=_r();im.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let r=this.head,n=""+r.data;for(;(r=r.next)!==null;)n+=e+r.data;return n}concat(e){if(this.length===0)return Cl.alloc(0);let r=Cl.allocUnsafe(e>>>0),n=this.head,i=0;for(;n;)Sa(r,n.data,i),i+=n.data.length,n=n.next;return r}consume(e,r){let n=this.head.data;if(eo.length)r+=o,e-=o.length;else{e===o.length?(r+=o,++i,n.next?this.head=n.next:this.head=this.tail=null):(r+=nm(o,0,e),this.head=n,n.data=nm(o,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=Cl.allocUnsafe(e),n=e,i=this.head,o=0;do{let s=i.data;if(e>s.length)Sa(r,s,n-e),e-=s.length;else{e===s.length?(Sa(r,s,n-e),++o,i.next?this.head=i.next:this.head=this.tail=null):(Sa(r,new Y2(s.buffer,s.byteOffset,e),n-e),this.head=i,i.data=s.slice(e));break}++o}while((i=i.next)!==null);return this.length-=o,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return X2(this,{...r,depth:0,customInspect:!1})}}});var Aa=z((kR,cm)=>{"use strict";var KR=f(h()),{MathFloor:Z2,NumberIsInteger:Q2}=ze(),{ERR_INVALID_ARG_VALUE:eS}=wt().codes;function tS(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function sm(t){return t?16:16*1024}function rS(t,e,r,n){let i=tS(e,n,r);if(i!=null){if(!Q2(i)||i<0){let o=n?`options.${r}`:"options.highWaterMark";throw new eS(o,i)}return Z2(i)}return sm(t.objectMode)}cm.exports={getHighWaterMark:rS,getDefaultHighWaterMark:sm}});var dm=z((Pl,um)=>{var LR=f(h());var Ta=St(),Ur=Ta.Buffer;function am(t,e){for(var r in t)e[r]=t[r]}Ur.from&&Ur.alloc&&Ur.allocUnsafe&&Ur.allocUnsafeSlow?um.exports=Ta:(am(Ta,Pl),Pl.Buffer=Ai);function Ai(t,e,r){return Ur(t,e,r)}Ai.prototype=Object.create(Ur.prototype);am(Ur,Ai);Ai.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Ur(t,e,r)};Ai.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=Ur(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Ai.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Ur(t)};Ai.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Ta.SlowBuffer(t)}});var hm=z(fm=>{"use strict";var NR=f(h()),Kl=dm().Buffer,lm=Kl.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function nS(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function iS(t){var e=nS(t);if(typeof e!="string"&&(Kl.isEncoding===lm||!lm(t)))throw new Error("Unknown encoding: "+t);return e||t}fm.StringDecoder=Ls;function Ls(t){this.encoding=iS(t);var e;switch(this.encoding){case"utf16le":this.text=dS,this.end=lS,e=4;break;case"utf8":this.fillLast=cS,e=4;break;case"base64":this.text=fS,this.end=hS,e=3;break;default:this.write=pS,this.end=yS;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Kl.allocUnsafe(e)}Ls.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function oS(t,e,r){var n=e.length-1;if(n=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function sS(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function cS(t){var e=this.lastTotal-this.lastNeed,r=sS(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function aS(t,e){var r=oS(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function uS(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function dS(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function lS(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function fS(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function hS(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function pS(t){return t.toString(this.encoding)}function yS(t){return t&&t.length?this.write(t):""}});var Ll=z(($R,gm)=>{"use strict";var qR=f(h()),pm=kn(),{PromisePrototypeThen:mS,SymbolAsyncIterator:ym,SymbolIterator:mm}=ze(),{Buffer:gS}=St(),{ERR_INVALID_ARG_TYPE:wS,ERR_STREAM_NULL_VALUES:bS}=wt().codes;function xS(t,e,r){let n;if(typeof e=="string"||e instanceof gS)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[ym])i=!0,n=e[ym]();else if(e&&e[mm])i=!1,n=e[mm]();else throw new wS("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...r}),s=!1;o._read=function(){s||(s=!0,a())},o._destroy=function(d,u){mS(c(d),()=>pm.nextTick(u,d),l=>pm.nextTick(u,l||d))};async function c(d){let u=d!=null,l=typeof n.throw=="function";if(u&&l){let{value:y,done:g}=await n.throw(d);if(await y,g)return}if(typeof n.return=="function"){let{value:y}=await n.return();await y}}async function a(){for(;;){try{let{value:d,done:u}=i?await n.next():n.next();if(u)o.push(null);else{let l=d&&typeof d.then=="function"?await d:d;if(l===null)throw s=!1,new bS;if(o.push(l))continue;s=!1}}catch(d){o.destroy(d)}break}}return o}gm.exports=xS});var Ms=z((FR,Rm)=>{var VR=f(h()),ar=kn(),{ArrayPrototypeIndexOf:ES,NumberIsInteger:vS,NumberIsNaN:SS,NumberParseInt:AS,ObjectDefineProperties:xm,ObjectKeys:TS,ObjectSetPrototypeOf:Em,Promise:_S,SafeSet:IS,SymbolAsyncIterator:BS,Symbol:DS}=ze();Rm.exports=he;he.ReadableState=Vl;var{EventEmitter:RS}=ws(),{Stream:Ln,prependListener:OS}=Ea(),{Buffer:Ml}=St(),{addAbortSignal:US}=Ks(),CS=on(),ye=_r().debuglog("stream",t=>{ye=t}),PS=om(),So=Si(),{getHighWaterMark:kS,getDefaultHighWaterMark:KS}=Aa(),{aggregateTwoErrors:wm,codes:{ERR_INVALID_ARG_TYPE:LS,ERR_METHOD_NOT_IMPLEMENTED:MS,ERR_OUT_OF_RANGE:NS,ERR_STREAM_PUSH_AFTER_EOF:$S,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:qS}}=wt(),{validateObject:FS}=ks(),Ti=DS("kPaused"),{StringDecoder:vm}=hm(),VS=Ll();Em(he.prototype,Ln.prototype);Em(he,Ln);var Nl=()=>{},{errorOrDestroy:vo}=So;function Vl(t,e,r){typeof r!="boolean"&&(r=e instanceof Cr()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.readableObjectMode)),this.highWaterMark=t?kS(this,t,"readableHighWaterMark",r):KS(!1),this.buffer=new PS,this.length=0,this.pipes=[],this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.constructed=!0,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this[Ti]=null,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.destroyed=!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.multiAwaitDrain=!1,this.readingMore=!1,this.dataEmitted=!1,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new vm(t.encoding),this.encoding=t.encoding)}function he(t){if(!(this instanceof he))return new he(t);let e=this instanceof Cr();this._readableState=new Vl(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&US(t.signal,this)),Ln.call(this,t),So.construct(this,()=>{this._readableState.needReadable&&_a(this,this._readableState)})}he.prototype.destroy=So.destroy;he.prototype._undestroy=So.undestroy;he.prototype._destroy=function(t,e){e(t)};he.prototype[RS.captureRejectionSymbol]=function(t){this.destroy(t)};he.prototype.push=function(t,e){return Sm(this,t,e,!1)};he.prototype.unshift=function(t,e){return Sm(this,t,e,!0)};function Sm(t,e,r,n){ye("readableAddChunk",e);let i=t._readableState,o;if(i.objectMode||(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=Ml.from(e,r).toString(i.encoding):(e=Ml.from(e,r),r=""))):e instanceof Ml?r="":Ln._isUint8Array(e)?(e=Ln._uint8ArrayToBuffer(e),r=""):e!=null&&(o=new LS("chunk",["string","Buffer","Uint8Array"],e))),o)vo(t,o);else if(e===null)i.reading=!1,WS(t,i);else if(i.objectMode||e&&e.length>0)if(n)if(i.endEmitted)vo(t,new qS);else{if(i.destroyed||i.errored)return!1;$l(t,i,e,!0)}else if(i.ended)vo(t,new $S);else{if(i.destroyed||i.errored)return!1;i.reading=!1,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?$l(t,i,e,!1):_a(t,i)):$l(t,i,e,!1)}else n||(i.reading=!1,_a(t,i));return!i.ended&&(i.length0?(e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&Ia(t)),_a(t,e)}he.prototype.isPaused=function(){let t=this._readableState;return t[Ti]===!0||t.flowing===!1};he.prototype.setEncoding=function(t){let e=new vm(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,n="";for(let i of r)n+=e.write(i);return r.clear(),n!==""&&r.push(n),this._readableState.length=n.length,this};var HS=1073741824;function jS(t){if(t>HS)throw new NS("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function bm(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:SS(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}he.prototype.read=function(t){ye("read",t),t===void 0?t=NaN:vS(t)||(t=AS(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=jS(t)),t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return ye("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?ql(this):Ia(this),null;if(t=bm(t,e),t===0&&e.ended)return e.length===0&&ql(this),null;let n=e.needReadable;if(ye("need readable",n),(e.length===0||e.length-t0?i=Bm(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&ql(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function WS(t,e){if(ye("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?Ia(t):(e.needReadable=!1,e.emittedReadable=!0,Am(t))}}function Ia(t){let e=t._readableState;ye("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(ye("emitReadable",e.flowing),e.emittedReadable=!0,ar.nextTick(Am,t))}function Am(t){let e=t._readableState;ye("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,_m(t)}function _a(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,ar.nextTick(zS,t,e))}function zS(t,e){for(;!e.reading&&!e.ended&&(e.length1&&n.pipes.includes(t)&&(ye("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),a||(a=GS(r,t),t.on("drain",a))}r.on("data",y);function y(S){ye("ondata");let T=t.write(S);ye("dest.write",T),T===!1&&l()}function g(S){if(ye("onerror",S),x(),t.removeListener("error",g),t.listenerCount("error")===0){let T=t._writableState||t._readableState;T&&!T.errorEmitted?vo(t,S):t.emit("error",S)}}OS(t,"error",g);function p(){t.removeListener("finish",w),x()}t.once("close",p);function w(){ye("onfinish"),t.removeListener("close",p),x()}t.once("finish",w);function x(){ye("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?n.flowing&&l():n.flowing||(ye("pipe resume"),r.resume()),t};function GS(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(ye("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(ye("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}he.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let i=e.pipes;e.pipes=[],this.pause();for(let o=0;o0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,ye("on readable",n.length,n.reading),n.length?Ia(this):n.reading||ar.nextTick(JS,this)),r};he.prototype.addListener=he.prototype.on;he.prototype.removeListener=function(t,e){let r=Ln.prototype.removeListener.call(this,t,e);return t==="readable"&&ar.nextTick(Tm,this),r};he.prototype.off=he.prototype.removeListener;he.prototype.removeAllListeners=function(t){let e=Ln.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&ar.nextTick(Tm,this),e};function Tm(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[Ti]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function JS(t){ye("readable nexttick read 0"),t.read(0)}he.prototype.resume=function(){let t=this._readableState;return t.flowing||(ye("resume"),t.flowing=!t.readableListening,YS(this,t)),t[Ti]=!1,this};function YS(t,e){e.resumeScheduled||(e.resumeScheduled=!0,ar.nextTick(XS,t,e))}function XS(t,e){ye("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),_m(t),e.flowing&&!e.reading&&t.read(0)}he.prototype.pause=function(){return ye("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(ye("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[Ti]=!0,this};function _m(t){let e=t._readableState;for(ye("flow",e.flowing);e.flowing&&t.read()!==null;);}he.prototype.wrap=function(t){let e=!1;t.on("data",n=>{!this.push(n)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",n=>{vo(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=TS(t);for(let n=1;n{i=s?wm(i,s):null,r(),r=Nl});try{for(;;){let s=t.destroyed?null:t.read();if(s!==null)yield s;else{if(i)throw i;if(i===null)return;await new _S(n)}}}catch(s){throw i=wm(i,s),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?So.destroyer(t,null):(t.off("readable",n),o())}}xm(he.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});xm(Vl.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Ti]!==!1},set(t){this[Ti]=!!t}}});he._fromList=Bm;function Bm(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function ql(t){let e=t._readableState;ye("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,ar.nextTick(QS,e,t))}function QS(t,e){if(ye("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)ar.nextTick(eA,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function eA(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}he.from=function(t,e){return VS(he,t,e)};var Fl;function Dm(){return Fl===void 0&&(Fl={}),Fl}he.fromWeb=function(t,e){return Dm().newStreamReadableFromReadableStream(t,e)};he.toWeb=function(t,e){return Dm().newReadableStreamFromStreamReadable(t,e)};he.wrap=function(t,e){var r,n;return new he({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(i,o){So.destroyer(t,i),o(i)}}).wrap(t)}});var Yl=z((HR,Fm)=>{var jR=f(h()),_i=kn(),{ArrayPrototypeSlice:Cm,Error:tA,FunctionPrototypeSymbolHasInstance:Pm,ObjectDefineProperty:km,ObjectDefineProperties:rA,ObjectSetPrototypeOf:Km,StringPrototypeToLowerCase:nA,Symbol:iA,SymbolHasInstance:oA}=ze();Fm.exports=Me;Me.WritableState=qs;var{EventEmitter:sA}=ws(),Ns=Ea().Stream,{Buffer:Ba}=St(),Oa=Si(),{addAbortSignal:cA}=Ks(),{getHighWaterMark:aA,getDefaultHighWaterMark:uA}=Aa(),{ERR_INVALID_ARG_TYPE:dA,ERR_METHOD_NOT_IMPLEMENTED:lA,ERR_MULTIPLE_CALLBACK:Lm,ERR_STREAM_CANNOT_PIPE:fA,ERR_STREAM_DESTROYED:$s,ERR_STREAM_ALREADY_FINISHED:hA,ERR_STREAM_NULL_VALUES:pA,ERR_STREAM_WRITE_AFTER_END:yA,ERR_UNKNOWN_ENCODING:Mm}=wt().codes,{errorOrDestroy:Ao}=Oa;Km(Me.prototype,Ns.prototype);Km(Me,Ns);function Wl(){}var To=iA("kOnFinished");function qs(t,e,r){typeof r!="boolean"&&(r=e instanceof Cr()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?aA(this,t,"writableHighWaterMark",r):uA(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let n=!!(t&&t.decodeStrings===!1);this.decodeStrings=!n,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=gA.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Ra(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[To]=[]}function Ra(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}qs.prototype.getBuffer=function(){return Cm(this.buffered,this.bufferedIndex)};km(qs.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function Me(t){let e=this instanceof Cr();if(!e&&!Pm(Me,this))return new Me(t);this._writableState=new qs(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&cA(t.signal,this)),Ns.call(this,t),Oa.construct(this,()=>{let r=this._writableState;r.writing||Gl(this,r),Jl(this,r)})}km(Me,oA,{__proto__:null,value:function(t){return Pm(this,t)?!0:this!==Me?!1:t&&t._writableState instanceof qs}});Me.prototype.pipe=function(){Ao(this,new fA)};function Nm(t,e,r,n){let i=t._writableState;if(typeof r=="function")n=r,r=i.defaultEncoding;else{if(!r)r=i.defaultEncoding;else if(r!=="buffer"&&!Ba.isEncoding(r))throw new Mm(r);typeof n!="function"&&(n=Wl)}if(e===null)throw new pA;if(!i.objectMode)if(typeof e=="string")i.decodeStrings!==!1&&(e=Ba.from(e,r),r="buffer");else if(e instanceof Ba)r="buffer";else if(Ns._isUint8Array(e))e=Ns._uint8ArrayToBuffer(e),r="buffer";else throw new dA("chunk",["string","Buffer","Uint8Array"],e);let o;return i.ending?o=new yA:i.destroyed&&(o=new $s("write")),o?(_i.nextTick(n,o),Ao(t,o,!0),o):(i.pendingcb++,mA(t,i,e,r,n))}Me.prototype.write=function(t,e,r){return Nm(this,t,e,r)===!0};Me.prototype.cork=function(){this._writableState.corked++};Me.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Gl(this,t))};Me.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=nA(e)),!Ba.isEncoding(e))throw new Mm(e);return this._writableState.defaultEncoding=e,this};function mA(t,e,r,n,i){let o=e.objectMode?1:r.length;e.length+=o;let s=e.lengthr.bufferedIndex&&Gl(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},_i.nextTick(wA,r.afterWriteTickInfo)):$m(t,r,1,i))}function wA({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,$m(t,e,r,n)}function $m(t,e,r,n){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,n();e.destroyed&&zl(e),Jl(t,e)}function zl(t){if(t.writing)return;for(let i=t.bufferedIndex;i1&&t._writev){e.pendingcb-=o-1;let c=e.allNoop?Wl:d=>{for(let u=s;u256?(r.splice(0,s),e.bufferedIndex=0):e.bufferedIndex=s}e.bufferProcessing=!1}Me.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new lA("_write()")};Me.prototype._writev=null;Me.prototype.end=function(t,e,r){let n=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let i;if(t!=null){let o=Nm(this,t,e);o instanceof tA&&(i=o)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,Jl(this,n,!0),n.ended=!0):n.finished?i=new hA("end"):n.destroyed&&(i=new $s("end"))),typeof r=="function"&&(i||n.finished?_i.nextTick(r,i):n[To].push(r)),this};function Da(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function bA(t,e){let r=!1;function n(i){if(r){Ao(t,i??Lm());return}if(r=!0,e.pendingcb--,i){let o=e[To].splice(0);for(let s=0;s{Da(i)?jl(n,i):i.pendingcb--},t,e)):Da(e)&&(e.pendingcb++,jl(t,e))))}function jl(t,e){e.pendingcb--,e.finished=!0;let r=e[To].splice(0);for(let n=0;n{var zR=f(h()),Xl=kn(),vA=St(),{isReadable:SA,isWritable:AA,isIterable:Vm,isNodeStream:TA,isReadableNodeStream:Hm,isWritableNodeStream:jm,isDuplexNodeStream:_A}=Rr(),Wm=on(),{AbortError:Zm,codes:{ERR_INVALID_ARG_TYPE:IA,ERR_INVALID_RETURN_VALUE:zm}}=wt(),{destroyer:_o}=Si(),BA=Cr(),DA=Ms(),{createDeferredPromise:Gm}=_r(),Jm=Ll(),Ym=globalThis.Blob||vA.Blob,RA=typeof Ym<"u"?function(e){return e instanceof Ym}:function(e){return!1},OA=globalThis.AbortController||la().AbortController,{FunctionPrototypeCall:Xm}=ze(),Ii=class extends BA{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};Qm.exports=function t(e,r){if(_A(e))return e;if(Hm(e))return Ua({readable:e});if(jm(e))return Ua({writable:e});if(TA(e))return Ua({writable:!1,readable:!1});if(typeof e=="function"){let{value:i,write:o,final:s,destroy:c}=UA(e);if(Vm(i))return Jm(Ii,i,{objectMode:!0,write:o,final:s,destroy:c});let a=i?.then;if(typeof a=="function"){let d,u=Xm(a,i,l=>{if(l!=null)throw new zm("nully","body",l)},l=>{_o(d,l)});return d=new Ii({objectMode:!0,readable:!1,write:o,final(l){s(async()=>{try{await u,Xl.nextTick(l,null)}catch(y){Xl.nextTick(l,y)}})},destroy:c})}throw new zm("Iterable, AsyncIterable or AsyncFunction",r,i)}if(RA(e))return t(e.arrayBuffer());if(Vm(e))return Jm(Ii,e,{objectMode:!0,writable:!1});if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?Hm(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?jm(e?.writable)?e?.writable:t(e.writable):void 0;return Ua({readable:i,writable:o})}let n=e?.then;if(typeof n=="function"){let i;return Xm(n,e,o=>{o!=null&&i.push(o),i.push(null)},o=>{_o(i,o)}),i=new Ii({objectMode:!0,writable:!1,read(){}})}throw new IA(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function UA(t){let{promise:e,resolve:r}=Gm(),n=new OA,i=n.signal;return{value:t(async function*(){for(;;){let s=e;e=null;let{chunk:c,done:a,cb:d}=await s;if(Xl.nextTick(d),a)return;if(i.aborted)throw new Zm(void 0,{cause:i.reason});({promise:e,resolve:r}=Gm()),yield c}}(),{signal:i}),write(s,c,a){let d=r;r=null,d({chunk:s,done:!1,cb:a})},final(s){let c=r;r=null,c({done:!0,cb:s})},destroy(s,c){n.abort(),c(s)}}}function Ua(t){let e=t.readable&&typeof t.readable.read!="function"?DA.wrap(t.readable):t.readable,r=t.writable,n=!!SA(e),i=!!AA(r),o,s,c,a,d;function u(l){let y=a;a=null,y?y(l):l&&d.destroy(l)}return d=new Ii({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:i}),i&&(Wm(r,l=>{i=!1,l&&_o(e,l),u(l)}),d._write=function(l,y,g){r.write(l,y)?g():o=g},d._final=function(l){r.end(),s=l},r.on("drain",function(){if(o){let l=o;o=null,l()}}),r.on("finish",function(){if(s){let l=s;s=null,l()}})),n&&(Wm(e,l=>{n=!1,l&&_o(e,l),u(l)}),e.on("readable",function(){if(c){let l=c;c=null,l()}}),e.on("end",function(){d.push(null)}),d._read=function(){for(;;){let l=e.read();if(l===null){c=d._read;return}if(!d.push(l))return}}),d._destroy=function(l,y){!l&&a!==null&&(l=new Zm),c=null,o=null,s=null,a===null?y(l):(a=y,_o(r,l),_o(e,l))},d}});var Cr=z((GR,ng)=>{"use strict";var JR=f(h()),{ObjectDefineProperties:CA,ObjectGetOwnPropertyDescriptor:sn,ObjectKeys:PA,ObjectSetPrototypeOf:tg}=ze();ng.exports=ur;var ef=Ms(),Yt=Yl();tg(ur.prototype,ef.prototype);tg(ur,ef);{let t=PA(Yt.prototype);for(let e=0;e{"use strict";var XR=f(h()),{ObjectSetPrototypeOf:ig,Symbol:kA}=ze();og.exports=cn;var{ERR_METHOD_NOT_IMPLEMENTED:KA}=wt().codes,rf=Cr(),{getHighWaterMark:LA}=Aa();ig(cn.prototype,rf.prototype);ig(cn,rf);var Fs=kA("kCallback");function cn(t){if(!(this instanceof cn))return new cn(t);let e=t?LA(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),rf.call(this,t),this._readableState.sync=!1,this[Fs]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",MA)}function tf(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}function MA(){this._final!==tf&&tf.call(this)}cn.prototype._final=tf;cn.prototype._transform=function(t,e,r){throw new KA("_transform()")};cn.prototype._write=function(t,e,r){let n=this._readableState,i=this._writableState,o=n.length;this._transform(t,e,(s,c)=>{if(s){r(s);return}c!=null&&this.push(c),i.ended||o===n.length||n.length{"use strict";var QR=f(h()),{ObjectSetPrototypeOf:sg}=ze();cg.exports=Io;var of=nf();sg(Io.prototype,of.prototype);sg(Io,of);function Io(t){if(!(this instanceof Io))return new Io(t);of.call(this,t)}Io.prototype._transform=function(t,e,r){r(null,t)}});var Ka=z((e5,fg)=>{var t5=f(h()),Vs=kn(),{ArrayIsArray:NA,Promise:$A,SymbolAsyncIterator:qA}=ze(),ka=on(),{once:FA}=_r(),VA=Si(),ag=Cr(),{aggregateTwoErrors:HA,codes:{ERR_INVALID_ARG_TYPE:pf,ERR_INVALID_RETURN_VALUE:cf,ERR_MISSING_ARGS:jA,ERR_STREAM_DESTROYED:WA,ERR_STREAM_PREMATURE_CLOSE:zA},AbortError:GA}=wt(),{validateFunction:JA,validateAbortSignal:YA}=ks(),{isIterable:Bi,isReadable:af,isReadableNodeStream:Pa,isNodeStream:ug,isTransformStream:Bo,isWebStream:XA,isReadableStream:uf,isReadableEnded:ZA}=Rr(),QA=globalThis.AbortController||la().AbortController,df,lf;function dg(t,e,r){let n=!1;t.on("close",()=>{n=!0});let i=ka(t,{readable:e,writable:r},o=>{n=!o});return{destroy:o=>{n||(n=!0,VA.destroyer(t,o||new WA("pipe")))},cleanup:i}}function eT(t){return JA(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function ff(t){if(Bi(t))return t;if(Pa(t))return tT(t);throw new pf("val",["Readable","Iterable","AsyncIterable"],t)}async function*tT(t){lf||(lf=Ms()),yield*lf.prototype[qA].call(t)}async function Ca(t,e,r,{end:n}){let i,o=null,s=d=>{if(d&&(i=d),o){let u=o;o=null,u()}},c=()=>new $A((d,u)=>{i?u(i):o=()=>{i?u(i):d()}});e.on("drain",s);let a=ka(e,{readable:!1},s);try{e.writableNeedDrain&&await c();for await(let d of t)e.write(d)||await c();n&&e.end(),await c(),r()}catch(d){r(i!==d?HA(i,d):d)}finally{a(),e.off("drain",s)}}async function hf(t,e,r,{end:n}){Bo(e)&&(e=e.writable);let i=e.getWriter();try{for await(let o of t)await i.ready,i.write(o).catch(()=>{});await i.ready,n&&await i.close(),r()}catch(o){try{await i.abort(o),r(o)}catch(s){r(s)}}}function rT(...t){return lg(t,FA(eT(t)))}function lg(t,e,r){if(t.length===1&&NA(t[0])&&(t=t[0]),t.length<2)throw new jA("streams");let n=new QA,i=n.signal,o=r?.signal,s=[];YA(o,"options.signal");function c(){g(new GA)}o?.addEventListener("abort",c);let a,d,u=[],l=0;function y(T){g(T,--l===0)}function g(T,E){if(T&&(!a||a.code==="ERR_STREAM_PREMATURE_CLOSE")&&(a=T),!(!a&&!E)){for(;u.length;)u.shift()(a);o?.removeEventListener("abort",c),n.abort(),E&&(a||s.forEach(R=>R()),Vs.nextTick(e,a,d))}}let p;for(let T=0;T0,O=R||r?.end!==!1,k=T===t.length-1;if(ug(E)){let P=function($){$&&$.name!=="AbortError"&&$.code!=="ERR_STREAM_PREMATURE_CLOSE"&&y($)};var S=P;if(O){let{destroy:$,cleanup:N}=dg(E,R,D);u.push($),af(E)&&k&&s.push(N)}E.on("error",P),af(E)&&k&&s.push(()=>{E.removeListener("error",P)})}if(T===0)if(typeof E=="function"){if(p=E({signal:i}),!Bi(p))throw new cf("Iterable, AsyncIterable or Stream","source",p)}else Bi(E)||Pa(E)||Bo(E)?p=E:p=ag.from(E);else if(typeof E=="function"){if(Bo(p)){var w;p=ff((w=p)===null||w===void 0?void 0:w.readable)}else p=ff(p);if(p=E(p,{signal:i}),R){if(!Bi(p,!0))throw new cf("AsyncIterable",`transform[${T-1}]`,p)}else{var x;df||(df=sf());let P=new df({objectMode:!0}),$=(x=p)===null||x===void 0?void 0:x.then;if(typeof $=="function")l++,$.call(p,V=>{d=V,V!=null&&P.write(V),O&&P.end(),Vs.nextTick(y)},V=>{P.destroy(V),Vs.nextTick(y,V)});else if(Bi(p,!0))l++,Ca(p,P,y,{end:O});else if(uf(p)||Bo(p)){let V=p.readable||p;l++,Ca(V,P,y,{end:O})}else throw new cf("AsyncIterable or Promise","destination",p);p=P;let{destroy:N,cleanup:q}=dg(p,!1,!0);u.push(N),k&&s.push(q)}}else if(ug(E)){if(Pa(p)){l+=2;let P=nT(p,E,y,{end:O});af(E)&&k&&s.push(P)}else if(Bo(p)||uf(p)){let P=p.readable||p;l++,Ca(P,E,y,{end:O})}else if(Bi(p))l++,Ca(p,E,y,{end:O});else throw new pf("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],p);p=E}else if(XA(E)){if(Pa(p))l++,hf(ff(p),E,y,{end:O});else if(uf(p)||Bi(p))l++,hf(p,E,y,{end:O});else if(Bo(p))l++,hf(p.readable,E,y,{end:O});else throw new pf("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],p);p=E}else p=ag.from(E)}return(i!=null&&i.aborted||o!=null&&o.aborted)&&Vs.nextTick(c),p}function nT(t,e,r,{end:n}){let i=!1;if(e.on("close",()=>{i||r(new zA)}),t.pipe(e,{end:!1}),n){let s=function(){i=!0,e.end()};var o=s;ZA(t)?Vs.nextTick(s):t.once("end",s)}else r();return ka(t,{readable:!0,writable:!1},s=>{let c=t._readableState;s&&s.code==="ERR_STREAM_PREMATURE_CLOSE"&&c&&c.ended&&!c.errored&&!c.errorEmitted?t.once("end",r).once("error",r):r(s)}),ka(e,{readable:!1,writable:!0},r)}fg.exports={pipelineImpl:lg,pipeline:rT}});var mf=z((r5,wg)=>{"use strict";var n5=f(h()),{pipeline:iT}=Ka(),La=Cr(),{destroyer:oT}=Si(),{isNodeStream:Ma,isReadable:hg,isWritable:pg,isWebStream:yf,isTransformStream:Di,isWritableStream:yg,isReadableStream:mg}=Rr(),{AbortError:sT,codes:{ERR_INVALID_ARG_VALUE:gg,ERR_MISSING_ARGS:cT}}=wt(),aT=on();wg.exports=function(...e){if(e.length===0)throw new cT("streams");if(e.length===1)return La.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=La.from(e[0])),typeof e[e.length-1]=="function"){let g=e.length-1;e[g]=La.from(e[g])}for(let g=0;g0&&!(pg(e[g])||yg(e[g])||Di(e[g])))throw new gg(`streams[${g}]`,r[g],"must be writable")}let n,i,o,s,c;function a(g){let p=s;s=null,p?p(g):g?c.destroy(g):!y&&!l&&c.destroy()}let d=e[0],u=iT(e,a),l=!!(pg(d)||yg(d)||Di(d)),y=!!(hg(u)||mg(u)||Di(u));if(c=new La({writableObjectMode:!!(d!=null&&d.writableObjectMode),readableObjectMode:!!(u!=null&&u.writableObjectMode),writable:l,readable:y}),l){if(Ma(d))c._write=function(p,w,x){d.write(p,w)?x():n=x},c._final=function(p){d.end(),i=p},d.on("drain",function(){if(n){let p=n;n=null,p()}});else if(yf(d)){let w=(Di(d)?d.writable:d).getWriter();c._write=async function(x,S,T){try{await w.ready,w.write(x).catch(()=>{}),T()}catch(E){T(E)}},c._final=async function(x){try{await w.ready,w.close().catch(()=>{}),i=x}catch(S){x(S)}}}let g=Di(u)?u.readable:u;aT(g,()=>{if(i){let p=i;i=null,p()}})}if(y){if(Ma(u))u.on("readable",function(){if(o){let g=o;o=null,g()}}),u.on("end",function(){c.push(null)}),c._read=function(){for(;;){let g=u.read();if(g===null){o=c._read;return}if(!c.push(g))return}};else if(yf(u)){let p=(Di(u)?u.readable:u).getReader();c._read=async function(){for(;;)try{let{value:w,done:x}=await p.read();if(!c.push(w))return;if(x){c.push(null);return}}catch{return}}}}return c._destroy=function(g,p){!g&&s!==null&&(g=new sT),o=null,n=null,i=null,s===null?p(g):(s=p,Ma(u)&&oT(u,g))},c}});var _g=z((i5,bf)=>{"use strict";var o5=f(h()),vg=globalThis.AbortController||la().AbortController,{codes:{ERR_INVALID_ARG_VALUE:uT,ERR_INVALID_ARG_TYPE:Hs,ERR_MISSING_ARGS:dT,ERR_OUT_OF_RANGE:lT},AbortError:Pr}=wt(),{validateAbortSignal:Ri,validateInteger:fT,validateObject:Oi}=ks(),hT=ze().Symbol("kWeak"),{finished:pT}=on(),yT=mf(),{addAbortSignalNoValidate:mT}=Ks(),{isWritable:gT,isNodeStream:wT}=Rr(),{ArrayPrototypePush:bT,MathFloor:xT,Number:ET,NumberIsNaN:vT,Promise:bg,PromiseReject:xg,PromisePrototypeThen:ST,Symbol:Sg}=ze(),Na=Sg("kEmpty"),Eg=Sg("kEof");function AT(t,e){if(e!=null&&Oi(e,"options"),e?.signal!=null&&Ri(e.signal,"options.signal"),wT(t)&&!gT(t))throw new uT("stream",t,"must be writable");let r=yT(this,t);return e!=null&&e.signal&&mT(e.signal,r),r}function $a(t,e){if(typeof t!="function")throw new Hs("fn",["Function","AsyncFunction"],t);e!=null&&Oi(e,"options"),e?.signal!=null&&Ri(e.signal,"options.signal");let r=1;return e?.concurrency!=null&&(r=xT(e.concurrency)),fT(r,"concurrency",1),(async function*(){var i,o;let s=new vg,c=this,a=[],d=s.signal,u={signal:d},l=()=>s.abort();e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted&&l(),e==null||(o=e.signal)===null||o===void 0||o.addEventListener("abort",l);let y,g,p=!1;function w(){p=!0}async function x(){try{for await(let E of c){var S;if(p)return;if(d.aborted)throw new Pr;try{E=t(E,u)}catch(R){E=xg(R)}E!==Na&&(typeof((S=E)===null||S===void 0?void 0:S.catch)=="function"&&E.catch(w),a.push(E),y&&(y(),y=null),!p&&a.length&&a.length>=r&&await new bg(R=>{g=R}))}a.push(Eg)}catch(E){let R=xg(E);ST(R,void 0,w),a.push(R)}finally{var T;p=!0,y&&(y(),y=null),e==null||(T=e.signal)===null||T===void 0||T.removeEventListener("abort",l)}}x();try{for(;;){for(;a.length>0;){let S=await a[0];if(S===Eg)return;if(d.aborted)throw new Pr;S!==Na&&(yield S),a.shift(),g&&(g(),g=null)}await new bg(S=>{y=S})}}finally{s.abort(),p=!0,g&&(g(),g=null)}}).call(this)}function TT(t=void 0){return t!=null&&Oi(t,"options"),t?.signal!=null&&Ri(t.signal,"options.signal"),(async function*(){let r=0;for await(let i of this){var n;if(t!=null&&(n=t.signal)!==null&&n!==void 0&&n.aborted)throw new Pr({cause:t.signal.reason});yield[r++,i]}}).call(this)}async function Ag(t,e=void 0){for await(let r of wf.call(this,t,e))return!0;return!1}async function _T(t,e=void 0){if(typeof t!="function")throw new Hs("fn",["Function","AsyncFunction"],t);return!await Ag.call(this,async(...r)=>!await t(...r),e)}async function IT(t,e){for await(let r of wf.call(this,t,e))return r}async function BT(t,e){if(typeof t!="function")throw new Hs("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),Na}for await(let n of $a.call(this,r,e));}function wf(t,e){if(typeof t!="function")throw new Hs("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:Na}return $a.call(this,r,e)}var gf=class extends dT{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function DT(t,e,r){var n;if(typeof t!="function")throw new Hs("reducer",["Function","AsyncFunction"],t);r!=null&&Oi(r,"options"),r?.signal!=null&&Ri(r.signal,"options.signal");let i=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let d=new Pr(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await pT(this.destroy(d)),d}let o=new vg,s=o.signal;if(r!=null&&r.signal){let d={once:!0,[hT]:this};r.signal.addEventListener("abort",()=>o.abort(),d)}let c=!1;try{for await(let d of this){var a;if(c=!0,r!=null&&(a=r.signal)!==null&&a!==void 0&&a.aborted)throw new Pr;i?e=await t(e,d,{signal:s}):(e=d,i=!0)}if(!c&&!i)throw new gf}finally{o.abort()}return e}async function RT(t){t!=null&&Oi(t,"options"),t?.signal!=null&&Ri(t.signal,"options.signal");let e=[];for await(let n of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new Pr(void 0,{cause:t.signal.reason});bT(e,n)}return e}function OT(t,e){let r=$a.call(this,t,e);return(async function*(){for await(let i of r)yield*i}).call(this)}function Tg(t){if(t=ET(t),vT(t))return 0;if(t<0)throw new lT("number",">= 0",t);return t}function UT(t,e=void 0){return e!=null&&Oi(e,"options"),e?.signal!=null&&Ri(e.signal,"options.signal"),t=Tg(t),(async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Pr;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Pr;t--<=0&&(yield o)}}).call(this)}function CT(t,e=void 0){return e!=null&&Oi(e,"options"),e?.signal!=null&&Ri(e.signal,"options.signal"),t=Tg(t),(async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Pr;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Pr;if(t-- >0)yield o;else return}}).call(this)}bf.exports.streamReturningOperators={asIndexedPairs:TT,drop:UT,filter:wf,flatMap:OT,map:$a,take:CT,compose:AT};bf.exports.promiseReturningOperators={every:_T,forEach:BT,reduce:DT,toArray:RT,some:Ag,find:IT}});var xf=z((s5,Ig)=>{"use strict";var c5=f(h()),{ArrayPrototypePop:PT,Promise:kT}=ze(),{isIterable:KT,isNodeStream:LT,isWebStream:MT}=Rr(),{pipelineImpl:NT}=Ka(),{finished:$T}=on();Ef();function qT(...t){return new kT((e,r)=>{let n,i,o=t[t.length-1];if(o&&typeof o=="object"&&!LT(o)&&!KT(o)&&!MT(o)){let s=PT(t);n=s.signal,i=s.end}NT(t,(s,c)=>{s?r(s):e(c)},{signal:n,end:i})})}Ig.exports={finished:$T,pipeline:qT}});var Ef=z((a5,Kg)=>{var u5=f(h()),{Buffer:FT}=St(),{ObjectDefineProperty:an,ObjectKeys:Rg,ReflectApply:Og}=ze(),{promisify:{custom:Ug}}=_r(),{streamReturningOperators:Bg,promiseReturningOperators:Dg}=_g(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:Cg}}=wt(),VT=mf(),{pipeline:Pg}=Ka(),{destroyer:HT}=Si(),kg=on(),vf=xf(),Sf=Rr(),Fe=Kg.exports=Ea().Stream;Fe.isDisturbed=Sf.isDisturbed;Fe.isErrored=Sf.isErrored;Fe.isReadable=Sf.isReadable;Fe.Readable=Ms();for(let t of Rg(Bg)){let r=function(...n){if(new.target)throw Cg();return Fe.Readable.from(Og(e,this,n))};Af=r;let e=Bg[t];an(r,"name",{__proto__:null,value:e.name}),an(r,"length",{__proto__:null,value:e.length}),an(Fe.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var Af;for(let t of Rg(Dg)){let r=function(...i){if(new.target)throw Cg();return Og(e,this,i)};Af=r;let e=Dg[t];an(r,"name",{__proto__:null,value:e.name}),an(r,"length",{__proto__:null,value:e.length}),an(Fe.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var Af;Fe.Writable=Yl();Fe.Duplex=Cr();Fe.Transform=nf();Fe.PassThrough=sf();Fe.pipeline=Pg;var{addAbortSignal:jT}=Ks();Fe.addAbortSignal=jT;Fe.finished=kg;Fe.destroy=HT;Fe.compose=VT;an(Fe,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return vf}});an(Pg,Ug,{__proto__:null,enumerable:!0,get(){return vf.pipeline}});an(kg,Ug,{__proto__:null,enumerable:!0,get(){return vf.finished}});Fe.Stream=Fe;Fe._isUint8Array=function(e){return e instanceof Uint8Array};Fe._uint8ArrayToBuffer=function(e){return FT.from(e.buffer,e.byteOffset,e.byteLength)}});var Tf=z((d5,Ve)=>{"use strict";var l5=f(h()),Ye=Ef(),WT=xf(),zT=Ye.Readable.destroy;Ve.exports=Ye.Readable;Ve.exports._uint8ArrayToBuffer=Ye._uint8ArrayToBuffer;Ve.exports._isUint8Array=Ye._isUint8Array;Ve.exports.isDisturbed=Ye.isDisturbed;Ve.exports.isErrored=Ye.isErrored;Ve.exports.isReadable=Ye.isReadable;Ve.exports.Readable=Ye.Readable;Ve.exports.Writable=Ye.Writable;Ve.exports.Duplex=Ye.Duplex;Ve.exports.Transform=Ye.Transform;Ve.exports.PassThrough=Ye.PassThrough;Ve.exports.addAbortSignal=Ye.addAbortSignal;Ve.exports.finished=Ye.finished;Ve.exports.destroy=Ye.destroy;Ve.exports.destroy=zT;Ve.exports.pipeline=Ye.pipeline;Ve.exports.compose=Ye.compose;Object.defineProperty(Ye,"promises",{configurable:!0,enumerable:!0,get(){return WT}});Ve.exports.Stream=Ye.Stream;Ve.exports.default=Ve.exports});var lb=z((Ru,db)=>{var N3=f(h());(function(t,e){typeof Ru=="object"&&typeof db<"u"?e(Ru):typeof define=="function"&&define.amd?define(["exports"],e):e(t.URI=t.URI||{})})(Ru,function(t){"use strict";function e(){for(var b=arguments.length,m=Array(b),v=0;v1){m[0]=m[0].slice(0,-1);for(var _=m.length-1,I=1;I<_;++I)m[I]=m[I].slice(1,-1);return m[_]=m[_].slice(1),m.join("")}else return m[0]}function r(b){return"(?:"+b+")"}function n(b){return b===void 0?"undefined":b===null?"null":Object.prototype.toString.call(b).split(" ").pop().split("]").shift().toLowerCase()}function i(b){return b.toUpperCase()}function o(b){return b!=null?b instanceof Array?b:typeof b.length!="number"||b.split||b.setInterval||b.call?[b]:Array.prototype.slice.call(b):[]}function s(b,m){var v=b;if(m)for(var _ in m)v[_]=m[_];return v}function c(b){var m="[A-Za-z]",v="[\\x0D]",_="[0-9]",I="[\\x22]",j=e(_,"[A-Fa-f]"),ue="[\\x0A]",we="[\\x20]",Se=r(r("%[EFef]"+j+"%"+j+j+"%"+j+j)+"|"+r("%[89A-Fa-f]"+j+"%"+j+j)+"|"+r("%"+j+j)),je="[\\:\\/\\?\\#\\[\\]\\@]",me="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Pe=e(je,me),We=b?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Ue=b?"[\\uE000-\\uF8FF]":"[]",be=e(m,_,"[\\-\\.\\_\\~]",We),ke=r(m+e(m,_,"[\\+\\-\\.]")+"*"),Ae=r(r(Se+"|"+e(be,me,"[\\:]"))+"*"),Xn=r(r("25[0-5]")+"|"+r("2[0-4]"+_)+"|"+r("1"+_+_)+"|"+r("[1-9]"+_)+"|"+_),Ct=r(r("25[0-5]")+"|"+r("2[0-4]"+_)+"|"+r("1"+_+_)+"|"+r("0?[1-9]"+_)+"|0?0?"+_),Ht=r(Ct+"\\."+Ct+"\\."+Ct+"\\."+Ct),Ie=r(j+"{1,4}"),Pt=r(r(Ie+"\\:"+Ie)+"|"+Ht),jt=r(r(Ie+"\\:")+"{6}"+Pt),br=r("\\:\\:"+r(Ie+"\\:")+"{5}"+Pt),Zn=r(r(Ie)+"?\\:\\:"+r(Ie+"\\:")+"{4}"+Pt),Hr=r(r(r(Ie+"\\:")+"{0,1}"+Ie)+"?\\:\\:"+r(Ie+"\\:")+"{3}"+Pt),is=r(r(r(Ie+"\\:")+"{0,2}"+Ie)+"?\\:\\:"+r(Ie+"\\:")+"{2}"+Pt),Ic=r(r(r(Ie+"\\:")+"{0,3}"+Ie)+"?\\:\\:"+Ie+"\\:"+Pt),Bc=r(r(r(Ie+"\\:")+"{0,4}"+Ie)+"?\\:\\:"+Pt),zi=r(r(r(Ie+"\\:")+"{0,5}"+Ie)+"?\\:\\:"+Ie),Gi=r(r(r(Ie+"\\:")+"{0,6}"+Ie)+"?\\:\\:"),jr=r([jt,br,Zn,Hr,is,Ic,Bc,zi,Gi].join("|")),Ji=r(r(be+"|"+Se)+"+"),Gu=r(jr+"\\%25"+Ji),Qn=r(jr+r("\\%25|\\%(?!"+j+"{2})")+Ji),Ex=r("[vV]"+j+"+\\."+e(be,me,"[\\:]")+"+"),vx=r("\\["+r(Qn+"|"+jr+"|"+Ex)+"\\]"),Qh=r(r(Se+"|"+e(be,me))+"*"),os=r(vx+"|"+Ht+"(?!"+Qh+")|"+Qh),ss=r(_+"*"),ep=r(r(Ae+"@")+"?"+os+r("\\:"+ss)+"?"),cs=r(Se+"|"+e(be,me,"[\\:\\@]")),Sx=r(cs+"*"),tp=r(cs+"+"),Ax=r(r(Se+"|"+e(be,me,"[\\@]"))+"+"),Wr=r(r("\\/"+Sx)+"*"),Yi=r("\\/"+r(tp+Wr)+"?"),Ju=r(Ax+Wr),Dc=r(tp+Wr),Xi="(?!"+cs+")",h6=r(Wr+"|"+Yi+"|"+Ju+"|"+Dc+"|"+Xi),Zi=r(r(cs+"|"+e("[\\/\\?]",Ue))+"*"),as=r(r(cs+"|[\\/\\?]")+"*"),rp=r(r("\\/\\/"+ep+Wr)+"|"+Yi+"|"+Dc+"|"+Xi),Tx=r(ke+"\\:"+rp+r("\\?"+Zi)+"?"+r("\\#"+as)+"?"),_x=r(r("\\/\\/"+ep+Wr)+"|"+Yi+"|"+Ju+"|"+Xi),Ix=r(_x+r("\\?"+Zi)+"?"+r("\\#"+as)+"?"),p6=r(Tx+"|"+Ix),y6=r(ke+"\\:"+rp+r("\\?"+Zi)+"?"),m6="^("+ke+")\\:"+r(r("\\/\\/("+r("("+Ae+")@")+"?("+os+")"+r("\\:("+ss+")")+"?)")+"?("+Wr+"|"+Yi+"|"+Dc+"|"+Xi+")")+r("\\?("+Zi+")")+"?"+r("\\#("+as+")")+"?$",g6="^(){0}"+r(r("\\/\\/("+r("("+Ae+")@")+"?("+os+")"+r("\\:("+ss+")")+"?)")+"?("+Wr+"|"+Yi+"|"+Ju+"|"+Xi+")")+r("\\?("+Zi+")")+"?"+r("\\#("+as+")")+"?$",w6="^("+ke+")\\:"+r(r("\\/\\/("+r("("+Ae+")@")+"?("+os+")"+r("\\:("+ss+")")+"?)")+"?("+Wr+"|"+Yi+"|"+Dc+"|"+Xi+")")+r("\\?("+Zi+")")+"?$",b6="^"+r("\\#("+as+")")+"?$",x6="^"+r("("+Ae+")@")+"?("+os+")"+r("\\:("+ss+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",m,_,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",be,me),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",be,me),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",be,me),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",be,me),"g"),NOT_QUERY:new RegExp(e("[^\\%]",be,me,"[\\:\\@\\/\\?]",Ue),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",be,me,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",be,me),"g"),UNRESERVED:new RegExp(be,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",be,Pe),"g"),PCT_ENCODED:new RegExp(Se,"g"),IPV4ADDRESS:new RegExp("^("+Ht+")$"),IPV6ADDRESS:new RegExp("^\\[?("+jr+")"+r(r("\\%25|\\%(?!"+j+"{2})")+"("+Ji+")")+"?\\]?$")}}var a=c(!1),d=c(!0),u=function(){function b(m,v){var _=[],I=!0,j=!1,ue=void 0;try{for(var we=m[Symbol.iterator](),Se;!(I=(Se=we.next()).done)&&(_.push(Se.value),!(v&&_.length===v));I=!0);}catch(je){j=!0,ue=je}finally{try{!I&&we.return&&we.return()}finally{if(j)throw ue}}return _}return function(m,v){if(Array.isArray(m))return m;if(Symbol.iterator in Object(m))return b(m,v);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(b){if(Array.isArray(b)){for(var m=0,v=Array(b.length);m= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$=g-p,N=Math.floor,q=String.fromCharCode;function V(b){throw new RangeError(P[b])}function X(b,m){for(var v=[],_=b.length;_--;)v[_]=m(b[_]);return v}function ce(b,m){var v=b.split("@"),_="";v.length>1&&(_=v[0]+"@",b=v[1]),b=b.replace(k,".");var I=b.split("."),j=X(I,m).join(".");return _+j}function U(b){for(var m=[],v=0,_=b.length;v<_;){var I=b.charCodeAt(v++);if(I>=55296&&I<=56319&&v<_){var j=b.charCodeAt(v++);(j&64512)==56320?m.push(((I&1023)<<10)+(j&1023)+65536):(m.push(I),v--)}else m.push(I)}return m}var L=function(m){return String.fromCodePoint.apply(String,l(m))},H=function(m){return m-48<10?m-22:m-65<26?m-65:m-97<26?m-97:g},C=function(m,v){return m+22+75*(m<26)-((v!=0)<<5)},A=function(m,v,_){var I=0;for(m=_?N(m/S):m>>1,m+=N(m/v);m>$*w>>1;I+=g)m=N(m/$);return N(I+($+1)*m/(m+x))},K=function(m){var v=[],_=m.length,I=0,j=E,ue=T,we=m.lastIndexOf(R);we<0&&(we=0);for(var Se=0;Se=128&&V("not-basic"),v.push(m.charCodeAt(Se));for(var je=we>0?we+1:0;je<_;){for(var me=I,Pe=1,We=g;;We+=g){je>=_&&V("invalid-input");var Ue=H(m.charCodeAt(je++));(Ue>=g||Ue>N((y-I)/Pe))&&V("overflow"),I+=Ue*Pe;var be=We<=ue?p:We>=ue+w?w:We-ue;if(UeN(y/ke)&&V("overflow"),Pe*=ke}var Ae=v.length+1;ue=A(I-me,Ae,me==0),N(I/Ae)>y-j&&V("overflow"),j+=N(I/Ae),I%=Ae,v.splice(I++,0,j)}return String.fromCodePoint.apply(String,v)},M=function(m){var v=[];m=U(m);var _=m.length,I=E,j=0,ue=T,we=!0,Se=!1,je=void 0;try{for(var me=m[Symbol.iterator](),Pe;!(we=(Pe=me.next()).done);we=!0){var We=Pe.value;We<128&&v.push(q(We))}}catch(Qn){Se=!0,je=Qn}finally{try{!we&&me.return&&me.return()}finally{if(Se)throw je}}var Ue=v.length,be=Ue;for(Ue&&v.push(R);be<_;){var ke=y,Ae=!0,Xn=!1,Ct=void 0;try{for(var Ht=m[Symbol.iterator](),Ie;!(Ae=(Ie=Ht.next()).done);Ae=!0){var Pt=Ie.value;Pt>=I&&PtN((y-j)/jt)&&V("overflow"),j+=(ke-I)*jt,I=ke;var br=!0,Zn=!1,Hr=void 0;try{for(var is=m[Symbol.iterator](),Ic;!(br=(Ic=is.next()).done);br=!0){var Bc=Ic.value;if(Bcy&&V("overflow"),Bc==I){for(var zi=j,Gi=g;;Gi+=g){var jr=Gi<=ue?p:Gi>=ue+w?w:Gi-ue;if(zi>6|192).toString(16).toUpperCase()+"%"+(m&63|128).toString(16).toUpperCase():v="%"+(m>>12|224).toString(16).toUpperCase()+"%"+(m>>6&63|128).toString(16).toUpperCase()+"%"+(m&63|128).toString(16).toUpperCase(),v}function oe(b){for(var m="",v=0,_=b.length;v<_;){var I=parseInt(b.substr(v+1,2),16);if(I<128)m+=String.fromCharCode(I),v+=3;else if(I>=194&&I<224){if(_-v>=6){var j=parseInt(b.substr(v+4,2),16);m+=String.fromCharCode((I&31)<<6|j&63)}else m+=b.substr(v,6);v+=6}else if(I>=224){if(_-v>=9){var ue=parseInt(b.substr(v+4,2),16),we=parseInt(b.substr(v+7,2),16);m+=String.fromCharCode((I&15)<<12|(ue&63)<<6|we&63)}else m+=b.substr(v,9);v+=9}else m+=b.substr(v,3),v+=3}return m}function xe(b,m){function v(_){var I=oe(_);return I.match(m.UNRESERVED)?I:_}return b.scheme&&(b.scheme=String(b.scheme).replace(m.PCT_ENCODED,v).toLowerCase().replace(m.NOT_SCHEME,"")),b.userinfo!==void 0&&(b.userinfo=String(b.userinfo).replace(m.PCT_ENCODED,v).replace(m.NOT_USERINFO,Q).replace(m.PCT_ENCODED,i)),b.host!==void 0&&(b.host=String(b.host).replace(m.PCT_ENCODED,v).toLowerCase().replace(m.NOT_HOST,Q).replace(m.PCT_ENCODED,i)),b.path!==void 0&&(b.path=String(b.path).replace(m.PCT_ENCODED,v).replace(b.scheme?m.NOT_PATH:m.NOT_PATH_NOSCHEME,Q).replace(m.PCT_ENCODED,i)),b.query!==void 0&&(b.query=String(b.query).replace(m.PCT_ENCODED,v).replace(m.NOT_QUERY,Q).replace(m.PCT_ENCODED,i)),b.fragment!==void 0&&(b.fragment=String(b.fragment).replace(m.PCT_ENCODED,v).replace(m.NOT_FRAGMENT,Q).replace(m.PCT_ENCODED,i)),b}function ge(b){return b.replace(/^0*(.*)/,"$1")||"0"}function Ne(b,m){var v=b.match(m.IPV4ADDRESS)||[],_=u(v,2),I=_[1];return I?I.split(".").map(ge).join("."):b}function He(b,m){var v=b.match(m.IPV6ADDRESS)||[],_=u(v,3),I=_[1],j=_[2];if(I){for(var ue=I.toLowerCase().split("::").reverse(),we=u(ue,2),Se=we[0],je=we[1],me=je?je.split(":").map(ge):[],Pe=Se.split(":").map(ge),We=m.IPV4ADDRESS.test(Pe[Pe.length-1]),Ue=We?7:8,be=Pe.length-Ue,ke=Array(Ue),Ae=0;Ae1){var Ie=ke.slice(0,Ct.index),Pt=ke.slice(Ct.index+Ct.length);Ht=Ie.join(":")+"::"+Pt.join(":")}else Ht=ke.join(":");return j&&(Ht+="%"+j),Ht}else return b}var $e=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,tt="".match(/(){0}/)[1]===void 0;function Ge(b){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v={},_=m.iri!==!1?d:a;m.reference==="suffix"&&(b=(m.scheme?m.scheme+":":"")+"//"+b);var I=b.match($e);if(I){tt?(v.scheme=I[1],v.userinfo=I[3],v.host=I[4],v.port=parseInt(I[5],10),v.path=I[6]||"",v.query=I[7],v.fragment=I[8],isNaN(v.port)&&(v.port=I[5])):(v.scheme=I[1]||void 0,v.userinfo=b.indexOf("@")!==-1?I[3]:void 0,v.host=b.indexOf("//")!==-1?I[4]:void 0,v.port=parseInt(I[5],10),v.path=I[6]||"",v.query=b.indexOf("?")!==-1?I[7]:void 0,v.fragment=b.indexOf("#")!==-1?I[8]:void 0,isNaN(v.port)&&(v.port=b.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?I[4]:void 0)),v.host&&(v.host=He(Ne(v.host,_),_)),v.scheme===void 0&&v.userinfo===void 0&&v.host===void 0&&v.port===void 0&&!v.path&&v.query===void 0?v.reference="same-document":v.scheme===void 0?v.reference="relative":v.fragment===void 0?v.reference="absolute":v.reference="uri",m.reference&&m.reference!=="suffix"&&m.reference!==v.reference&&(v.error=v.error||"URI is not a "+m.reference+" reference.");var j=ne[(m.scheme||v.scheme||"").toLowerCase()];if(!m.unicodeSupport&&(!j||!j.unicodeSupport)){if(v.host&&(m.domainHost||j&&j.domainHost))try{v.host=re.toASCII(v.host.replace(_.PCT_ENCODED,oe).toLowerCase())}catch(ue){v.error=v.error||"Host's domain name can not be converted to ASCII via punycode: "+ue}xe(v,a)}else xe(v,_);j&&j.parse&&j.parse(v,m)}else v.error=v.error||"URI can not be parsed.";return v}function Vr(b,m){var v=m.iri!==!1?d:a,_=[];return b.userinfo!==void 0&&(_.push(b.userinfo),_.push("@")),b.host!==void 0&&_.push(He(Ne(String(b.host),v),v).replace(v.IPV6ADDRESS,function(I,j,ue){return"["+j+(ue?"%25"+ue:"")+"]"})),(typeof b.port=="number"||typeof b.port=="string")&&(_.push(":"),_.push(String(b.port))),_.length?_.join(""):void 0}var En=/^\.\.?\//,es=/^\/\.(\/|$)/,Ec=/^\/\.\.(\/|$)/,ju=/^\/?(?:.|\n)*?(?=\/|$)/;function vn(b){for(var m=[];b.length;)if(b.match(En))b=b.replace(En,"");else if(b.match(es))b=b.replace(es,"/");else if(b.match(Ec))b=b.replace(Ec,"/"),m.pop();else if(b==="."||b==="..")b="";else{var v=b.match(ju);if(v){var _=v[0];b=b.slice(_.length),m.push(_)}else throw new Error("Unexpected dot segment condition")}return m.join("")}function Ft(b){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v=m.iri?d:a,_=[],I=ne[(m.scheme||b.scheme||"").toLowerCase()];if(I&&I.serialize&&I.serialize(b,m),b.host&&!v.IPV6ADDRESS.test(b.host)){if(m.domainHost||I&&I.domainHost)try{b.host=m.iri?re.toUnicode(b.host):re.toASCII(b.host.replace(v.PCT_ENCODED,oe).toLowerCase())}catch(we){b.error=b.error||"Host's domain name can not be converted to "+(m.iri?"Unicode":"ASCII")+" via punycode: "+we}}xe(b,v),m.reference!=="suffix"&&b.scheme&&(_.push(b.scheme),_.push(":"));var j=Vr(b,m);if(j!==void 0&&(m.reference!=="suffix"&&_.push("//"),_.push(j),b.path&&b.path.charAt(0)!=="/"&&_.push("/")),b.path!==void 0){var ue=b.path;!m.absolutePath&&(!I||!I.absolutePath)&&(ue=vn(ue)),j===void 0&&(ue=ue.replace(/^\/\//,"/%2F")),_.push(ue)}return b.query!==void 0&&(_.push("?"),_.push(b.query)),b.fragment!==void 0&&(_.push("#"),_.push(b.fragment)),_.join("")}function ts(b,m){var v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},_=arguments[3],I={};return _||(b=Ge(Ft(b,v),v),m=Ge(Ft(m,v),v)),v=v||{},!v.tolerant&&m.scheme?(I.scheme=m.scheme,I.userinfo=m.userinfo,I.host=m.host,I.port=m.port,I.path=vn(m.path||""),I.query=m.query):(m.userinfo!==void 0||m.host!==void 0||m.port!==void 0?(I.userinfo=m.userinfo,I.host=m.host,I.port=m.port,I.path=vn(m.path||""),I.query=m.query):(m.path?(m.path.charAt(0)==="/"?I.path=vn(m.path):((b.userinfo!==void 0||b.host!==void 0||b.port!==void 0)&&!b.path?I.path="/"+m.path:b.path?I.path=b.path.slice(0,b.path.lastIndexOf("/")+1)+m.path:I.path=m.path,I.path=vn(I.path)),I.query=m.query):(I.path=b.path,m.query!==void 0?I.query=m.query:I.query=b.query),I.userinfo=b.userinfo,I.host=b.host,I.port=b.port),I.scheme=b.scheme),I.fragment=m.fragment,I}function vc(b,m,v){var _=s({scheme:"null"},v);return Ft(ts(Ge(b,_),Ge(m,_),_,!0),_)}function rs(b,m){return typeof b=="string"?b=Ft(Ge(b,m),m):n(b)==="object"&&(b=Ge(Ft(b,m),m)),b}function Sc(b,m,v){return typeof b=="string"?b=Ft(Ge(b,v),v):n(b)==="object"&&(b=Ft(b,v)),typeof m=="string"?m=Ft(Ge(m,v),v):n(m)==="object"&&(m=Ft(m,v)),b===m}function Ac(b,m){return b&&b.toString().replace(!m||!m.iri?a.ESCAPE:d.ESCAPE,Q)}function Vt(b,m){return b&&b.toString().replace(!m||!m.iri?a.PCT_ENCODED:d.PCT_ENCODED,oe)}var Sn={scheme:"http",domainHost:!0,parse:function(m,v){return m.host||(m.error=m.error||"HTTP URIs must have a host."),m},serialize:function(m,v){var _=String(m.scheme).toLowerCase()==="https";return(m.port===(_?443:80)||m.port==="")&&(m.port=void 0),m.path||(m.path="/"),m}},ns={scheme:"https",domainHost:Sn.domainHost,parse:Sn.parse,serialize:Sn.serialize};function Tc(b){return typeof b.secure=="boolean"?b.secure:String(b.scheme).toLowerCase()==="wss"}var Yn={scheme:"ws",domainHost:!0,parse:function(m,v){var _=m;return _.secure=Tc(_),_.resourceName=(_.path||"/")+(_.query?"?"+_.query:""),_.path=void 0,_.query=void 0,_},serialize:function(m,v){if((m.port===(Tc(m)?443:80)||m.port==="")&&(m.port=void 0),typeof m.secure=="boolean"&&(m.scheme=m.secure?"wss":"ws",m.secure=void 0),m.resourceName){var _=m.resourceName.split("?"),I=u(_,2),j=I[0],ue=I[1];m.path=j&&j!=="/"?j:void 0,m.query=ue,m.resourceName=void 0}return m.fragment=void 0,m}},_c={scheme:"wss",domainHost:Yn.domainHost,parse:Yn.parse,serialize:Yn.serialize},Wu={},dx=!0,Gh="[A-Za-z0-9\\-\\.\\_\\~"+(dx?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",wr="[0-9A-Fa-f]",lx=r(r("%[EFef]"+wr+"%"+wr+wr+"%"+wr+wr)+"|"+r("%[89A-Fa-f]"+wr+"%"+wr+wr)+"|"+r("%"+wr+wr)),fx="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",hx="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",px=e(hx,'[\\"\\\\]'),yx="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",mx=new RegExp(Gh,"g"),Wi=new RegExp(lx,"g"),gx=new RegExp(e("[^]",fx,"[\\.]",'[\\"]',px),"g"),Jh=new RegExp(e("[^]",Gh,yx),"g"),wx=Jh;function zu(b){var m=oe(b);return m.match(mx)?m:b}var Yh={scheme:"mailto",parse:function(m,v){var _=m,I=_.to=_.path?_.path.split(","):[];if(_.path=void 0,_.query){for(var j=!1,ue={},we=_.query.split("&"),Se=0,je=we.length;Se{"use strict";var X3=f(h());fb.exports=function t(e){if(typeof e=="number"&&isNaN(e))throw new Error("NaN is not allowed");if(typeof e=="number"&&!isFinite(e))throw new Error("Infinity is not allowed");return e===null||typeof e!="object"?JSON.stringify(e):e.toJSON instanceof Function?t(e.toJSON()):Array.isArray(e)?`[${e.reduce((i,o,s)=>`${i}${s===0?"":","}${t(o===void 0||typeof o=="symbol"?null:o)}`,"")}]`:`{${Object.keys(e).sort().reduce((n,i)=>{if(e[i]===void 0||typeof e[i]=="symbol")return n;let o=n.length===0?"":",";return`${n}${o}${t(i)}:${t(e[i])}`},"")}}`}});var rx=z((s4,tx)=>{var c4=f(h()),Xo=1e3,Zo=Xo*60,Qo=Zo*60,ji=Qo*24,a6=ji*7,u6=ji*365.25;tx.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return d6(t);if(r==="number"&&isFinite(t))return e.long?f6(t):l6(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function d6(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*u6;case"weeks":case"week":case"w":return r*a6;case"days":case"day":case"d":return r*ji;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Qo;case"minutes":case"minute":case"mins":case"min":case"m":return r*Zo;case"seconds":case"second":case"secs":case"sec":case"s":return r*Xo;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function l6(t){var e=Math.abs(t);return e>=ji?Math.round(t/ji)+"d":e>=Qo?Math.round(t/Qo)+"h":e>=Zo?Math.round(t/Zo)+"m":e>=Xo?Math.round(t/Xo)+"s":t+"ms"}function f6(t){var e=Math.abs(t);return e>=ji?Hu(t,e,ji,"day"):e>=Qo?Hu(t,e,Qo,"hour"):e>=Zo?Hu(t,e,Zo,"minute"):e>=Xo?Hu(t,e,Xo,"second"):t+" ms"}function Hu(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var ix=z(nx=>{var u4=f(h());nx.Level=fl().BrowserLevel});var E4=f(h(),1);var U6=f(h(),1),no=(o=>(o.authentication="authentication",o.assertionMethod="assertionMethod",o.keyAgreement="keyAgreement",o.capabilityInvocation="capabilityInvocation",o.capabilityDelegation="capabilityDelegation",o))(no||{});var P6=f(h(),1),Ke={"@context":"https://w3id.org/did-resolution/v1",didResolutionMetadata:{},didDocument:null,didDocumentMetadata:{}};var K6=f(h(),1),Je=class Je{constructor({method:e,id:r,path:n,query:i,fragment:o,params:s}){this.uri=`did:${e}:${r}`,this.method=e,this.id=r,this.path=n,this.query=i,this.fragment=o,this.params=s}static parse(e){if(!e)return null;let r=Je.DID_URI_PATTERN.exec(e);if(!r||!r.groups)return null;let{method:n,id:i,path:o,query:s,fragment:c}=r.groups,a={uri:`did:${n}:${i}`,method:n,id:i};if(o&&(a.path=o),s&&(a.query=s.slice(1)),c&&(a.fragment=c.slice(1)),s){let d={},u=s.slice(1).split("&");for(let l of u){let[y,g]=l.split("=");d[y]=g}a.params=d}return a}};Je.METHOD_PATTERN="([a-z0-9]+)",Je.PCT_ENCODED_PATTERN="(?:%[0-9a-fA-F]{2})",Je.ID_CHAR_PATTERN=`(?:[a-zA-Z0-9._-]|${Je.PCT_ENCODED_PATTERN})`,Je.METHOD_ID_PATTERN=`((?:${Je.ID_CHAR_PATTERN}*:)*(${Je.ID_CHAR_PATTERN}+))`,Je.PATH_PATTERN="(/[^#?]*)?",Je.QUERY_PATTERN="([?][^#]*)?",Je.FRAGMENT_PATTERN="(#.*)?",Je.DID_URI_PATTERN=new RegExp(`^did:(?${Je.METHOD_PATTERN}):(?${Je.METHOD_ID_PATTERN})(?${Je.PATH_PATTERN})(?${Je.QUERY_PATTERN})(?${Je.FRAGMENT_PATTERN})$`);var Le=Je;var M6=f(h(),1),Y=class t extends Error{constructor(r,n){super(`${r}: ${n}`);this.code=r;this.name="DidError",Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,t)}},Tn=(p=>(p.InvalidDid="invalidDid",p.MethodNotSupported="methodNotSupported",p.InternalError="internalError",p.InvalidDidDocument="invalidDidDocument",p.InvalidDidDocumentLength="invalidDidDocumentLength",p.InvalidDidUrl="invalidDidUrl",p.InvalidPreviousDidProof="invalidPreviousDidProof",p.InvalidPublicKey="invalidPublicKey",p.InvalidPublicKeyLength="invalidPublicKeyLength",p.InvalidPublicKeyType="invalidPublicKeyType",p.InvalidSignature="invalidSignature",p.NotFound="notFound",p.RepresentationNotSupported="representationNotSupported",p.UnsupportedPublicKeyType="unsupportedPublicKeyType",p))(Tn||{});var ak=f(h(),1);var _P=f(h(),1);var iC=f(h(),1);var w5=f(h(),1);var F6=f(h(),1),yE=f(Tp(),1);var _D=f(h(),1);var aD=f(h(),1);var Z6=f(h(),1);var H6=f(h(),1);function mE(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,R=new Uint8Array(E);S!==T;){for(var D=p[S],O=0,k=E-1;(D!==0||O>>0,R[k]=D%c>>>0,D=D/c>>>0;if(D!==0)throw new Error("Non-zero carry");x=O,S++}for(var P=E-x;P!==E&&R[P]===0;)P++;for(var $=a.repeat(w);P>>0,E=new Uint8Array(T);p[w];){var R=r[p.charCodeAt(w)];if(R===255)return;for(var D=0,O=T-1;(R!==0||D>>0,E[O]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");S=D,w++}if(p[w]!==" "){for(var k=T-S;k!==T&&E[k]===0;)k++;for(var P=new Uint8Array(x+(T-k)),$=x;k!==T;)P[$++]=E[k++];return P}}}function g(p){var w=y(p);if(w)return w;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:y,decode:g}}var gE=mE,wE=gE,_p=wE;var W6=f(h(),1),j6=new Uint8Array(0);var Ip=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{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 z6=f(h(),1);var ud=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")}},dd=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 Bp(this,e)}},ld=class{constructor(e){this.decoders=e}or(e){return Bp(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`)}},Bp=(t,e)=>new ld({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),fd=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new ud(e,r,n),this.decoder=new dd(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Dp=({name:t,prefix:e,encode:r,decode:n})=>new fd(t,e,r,n),hd=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=_p(r,e);return Dp({prefix:t,name:e,encode:n,decode:o=>io(i(o))})},xE=(t,e,r,n)=>{let i={};for(let u=0;u=8&&(c-=8,s[d++]=255&a>>c)}if(c>=r||255&a<<8-c)throw new SyntaxError("Unexpected end of data");return s},EE=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)s-=r,o+=e[i&c>>s];if(s&&(o+=e[i&c<Dp({prefix:e,name:t,encode(i){return EE(i,n,r)},decode(i){return xE(i,n,r,t)}});var ds=gt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),eD=gt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),tD=gt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),rD=gt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),nD=gt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),iD=gt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),oD=gt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),sD=gt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),pd=gt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var fD=f(h(),1);var At=hd({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),dD=hd({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var wD=f(h(),1);var pD=gt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),yD=gt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),vr=gt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),mD=gt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var xD=f(h(),1);function Rp(t){return t.byteOffset!==0||t.byteLength!==t.buffer.byteLength}function Op(t){return typeof t!="object"||t===null?!1:typeof t[Symbol.asyncIterator]=="function"}function oo(t){let r=Object.prototype.toString.call(t).match(/\s([a-zA-Z0-9]+)/),[n,i]=r;return i}var ls=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{d(n.next(u))}catch(l){s(l)}}function a(u){try{d(n.throw(u))}catch(l){s(l)}}function d(u){u.done?o(u.value):i(u.value).then(c,a)}d((n=n.apply(t,e||[])).next())})},Up=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=t[o]&&function(s){return new Promise(function(c,a){s=t[o](s),i(c,a,s.done,s.value)})}}function i(o,s,c,a){Promise.resolve(a).then(function(d){o({value:d,done:c})},s)}},kc=new TextEncoder,ri=new TextDecoder,W=class t{constructor(e,r){this.data=e,this.format=r}static arrayBuffer(e){return new t(e,"ArrayBuffer")}static asyncIterable(e){if(!Op(e))throw new TypeError("Input must be of type AsyncIterable.");return new t(e,"AsyncIterable")}static base32Z(e){return new t(e,"Base32Z")}static base58Btc(e){return new t(e,"Base58Btc")}static base64Url(e){return new t(e,"Base64Url")}static bufferSource(e){return new t(e,"BufferSource")}static hex(e){if(typeof e!="string")throw new TypeError("Hex input must be a string.");if(e.length%2!==0)throw new TypeError("Hex input must have an even number of characters.");return new t(e,"Hex")}static multibase(e){return new t(e,"Multibase")}static object(e){return new t(e,"Object")}static string(e){return new t(e,"String")}static uint8Array(e){return new t(e,"Uint8Array")}toArrayBuffer(){switch(this.format){case"Base58Btc":return At.baseDecode(this.data).buffer;case"Base64Url":return vr.baseDecode(this.data).buffer;case"BufferSource":{if(oo(this.data)==="ArrayBuffer")return this.data;if(ArrayBuffer.isView(this.data))return Rp(this.data)?this.data.buffer.slice(this.data.byteOffset,this.data.byteOffset+this.data.byteLength):this.data.buffer;throw new TypeError(`${this.format} value is not of type: ArrayBuffer, DataView, or TypedArray.`)}case"Hex":return this.toUint8Array().buffer;case"String":return this.toUint8Array().buffer;case"Uint8Array":return this.data.buffer;default:throw new TypeError(`Conversion from ${this.format} to ArrayBuffer is not supported.`)}}toArrayBufferAsync(){return ls(this,void 0,void 0,function*(){switch(this.format){case"AsyncIterable":return yield(yield this.toBlobAsync()).arrayBuffer();default:throw new TypeError(`Asynchronous conversion from ${this.format} to ArrayBuffer is not supported.`)}})}toBase32Z(){switch(this.format){case"Uint8Array":return pd.baseEncode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Base64Z is not supported.`)}}toBase58Btc(){switch(this.format){case"ArrayBuffer":{let e=new Uint8Array(this.data);return At.baseEncode(e)}case"Multibase":return this.data.substring(1);case"Uint8Array":return At.baseEncode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Base58Btc is not supported.`)}}toBase64Url(){switch(this.format){case"ArrayBuffer":{let e=new Uint8Array(this.data);return vr.baseEncode(e)}case"BufferSource":{let e=this.toUint8Array();return vr.baseEncode(e)}case"Object":{let e=JSON.stringify(this.data),r=kc.encode(e);return vr.baseEncode(r)}case"String":{let e=kc.encode(this.data);return vr.baseEncode(e)}case"Uint8Array":return vr.baseEncode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Base64Url is not supported.`)}}toBlobAsync(){var e,r,n,i;return ls(this,void 0,void 0,function*(){switch(this.format){case"AsyncIterable":{let a=[];try{for(var o=!0,s=Up(this.data),c;c=yield s.next(),e=c.done,!e;o=!0){i=c.value,o=!1;let u=i;a.push(u)}}catch(u){r={error:u}}finally{try{!o&&!e&&(n=s.return)&&(yield n.call(s))}finally{if(r)throw r.error}}return new Blob(a)}default:throw new TypeError(`Asynchronous conversion from ${this.format} to Blob is not supported.`)}})}toHex(){let e=Array.from({length:256},(r,n)=>n.toString(16).padStart(2,"0"));switch(this.format){case"ArrayBuffer":{let r=this.toUint8Array();return t.uint8Array(r).toHex()}case"Base64Url":{let r=this.toUint8Array();return t.uint8Array(r).toHex()}case"Uint8Array":{let r="";for(let n=0;nso,encodeTo:()=>ni,encodingLength:()=>ii});var RD=f(h(),1);var BD=f(h(),1),vE=kp,Cp=128,SE=127,AE=~SE,TE=Math.pow(2,31);function kp(t,e,r){e=e||[],r=r||0;for(var n=r;t>=TE;)e[r++]=t&255|Cp,t/=128;for(;t&AE;)e[r++]=t&255|Cp,t>>>=7;return e[r]=t|0,kp.bytes=r-n+1,e}var _E=yd,IE=128,Pp=127;function yd(t,n){var r=0,n=n||0,i=0,o=n,s,c=t.length;do{if(o>=c)throw yd.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&Pp)<=IE);return yd.bytes=o-n,r}var BE=Math.pow(2,7),DE=Math.pow(2,14),RE=Math.pow(2,21),OE=Math.pow(2,28),UE=Math.pow(2,35),CE=Math.pow(2,42),PE=Math.pow(2,49),kE=Math.pow(2,56),KE=Math.pow(2,63),LE=function(t){return t[fs.decode(t,e),fs.decode.bytes],ni=(t,e,r=0)=>(fs.encode(t,e,r),e),ii=t=>fs.encodingLength(t);var UD=f(h(),1);var md=(t,e)=>{let r=e.byteLength,n=ii(t),i=n+ii(r),o=new Uint8Array(i+r);return ni(t,o,0),ni(r,o,n),o.set(e,i),new co(t,r,e,o)},Kp=t=>{let e=io(t),[r,n]=so(e),[i,o]=so(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new co(r,i,s,e)},Lp=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Ip(t.bytes,r.bytes)}},co=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var CD=f(h(),1);var Mp=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return qE(r,wd(t),e||At.encoder);default:return FE(r,wd(t),e||ds.encoder)}};var Np=new WeakMap,wd=t=>{let e=Np.get(t);if(e==null){let r=new Map;return Np.set(t,r),r}return e},bd=class t{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}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!==hs)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==VE)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=md(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&&Lp(e.multihash,n.multihash)}toString(e){return Mp(this,e)}toJSON(){return{"/":Mp(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:i,multihash:o,bytes:s}=r;return new t(n,i,o,s||$p(n,i,o.bytes))}else if(r[HE]===!0){let{version:n,multihash:i,code:o}=r,s=Kp(i);return t.create(n,o,s)}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!==hs)throw new Error(`Version 0 CID must use dag-pb (code: ${hs}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=$p(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,hs,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,i=io(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new co(r.multihashCode,r.digestSize,o,i);return[r.version===0?t.createV0(s):t.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[l,y]=so(e.subarray(r));return r+=y,l},i=n(),o=hs;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,c=n(),a=n(),d=r+a,u=d-s;return{version:i,codec:o,multihashCode:c,digestSize:a,multihashSize:u,size:d}}static parse(e,r){let[n,i]=$E(e,r),o=t.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return wd(o).set(n,e),o}},$E=(t,e)=>{switch(t[0]){case"Q":{let r=e||At;return[At.prefix,r.decode(`${At.prefix}${t}`)]}case At.prefix:{let r=e||At;return[At.prefix,r.decode(t)]}case ds.prefix:{let r=e||ds;return[ds.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)]}}},qE=(t,e,r)=>{let{prefix:n}=r;if(n!==At.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let o=r.encode(t).slice(1);return e.set(n,o),o}else return i},FE=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let o=r.encode(t);return e.set(n,o),o}else return i},hs=112,VE=18,$p=(t,e,r)=>{let n=ii(t),i=n+ii(e),o=new Uint8Array(i+r.byteLength);return ni(t,o,0),ni(e,o,n),o.set(r,i),o},HE=Symbol.for("@ipld/js-cid/CID");var qD=f(h(),1);var FD=f(h(),1);var pt=class t{static addPrefix(e){var r;let{code:n,data:i,name:o}=e;if(!(o?!n:n))throw new Error("Either 'name' or 'code' must be defined, but not both.");if(n=t.codeToName.has(n)?n:t.nameToCode.get(o),n===void 0)throw new Error(`Unsupported multicodec: ${(r=e.name)!==null&&r!==void 0?r:e.code}`);let s=Gr.encodingLength(n),c=new Uint8Array(s+i.byteLength);return c.set(i,s),Gr.encodeTo(n,c),c}static getCodeFromData(e){let{prefixedData:r}=e,[n,i]=Gr.decode(r);return n}static getCodeFromName(e){let{name:r}=e,n=t.nameToCode.get(r);if(n===void 0)throw new Error(`Unsupported multicodec: ${r}`);return n}static getNameFromCode(e){let{code:r}=e,n=t.codeToName.get(r);if(n===void 0)throw new Error(`Unsupported multicodec: ${r}`);return n}static registerCodec(e){t.codeToName.set(e.code,e.name),t.nameToCode.set(e.name,e.code)}static removePrefix(e){let{prefixedData:r}=e,[n,i]=Gr.decode(r),o=t.codeToName.get(n);if(o===void 0)throw new Error(`Unsupported multicodec: ${n}`);return{code:n,data:r.slice(i),name:o}}};pt.codeToName=new Map;pt.nameToCode=new Map;pt.registerCodec({code:237,name:"ed25519-pub"});pt.registerCodec({code:4864,name:"ed25519-priv"});pt.registerCodec({code:236,name:"x25519-pub"});pt.registerCodec({code:4866,name:"x25519-priv"});pt.registerCodec({code:231,name:"secp256k1-pub"});pt.registerCodec({code:4865,name:"secp256k1-priv"});var XD=f(h(),1);function xd(t){Object.keys(t).forEach(e=>{t[e]===void 0?delete t[e]:typeof t[e]=="object"&&xd(t[e])})}var sR=f(h(),1),X1=f(Zy(),1),bi=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{d(n.next(u))}catch(l){s(l)}}function a(u){try{d(n.throw(u))}catch(l){s(l)}}function d(u){u.done?o(u.value):i(u.value).then(c,a)}d((n=n.apply(t,e||[])).next())})};var ua=class{constructor(){this.store=new Map}clear(){return bi(this,void 0,void 0,function*(){this.store.clear()})}close(){return bi(this,void 0,void 0,function*(){})}delete(e){return bi(this,void 0,void 0,function*(){return this.store.delete(e)})}get(e){return bi(this,void 0,void 0,function*(){return this.store.get(e)})}has(e){return bi(this,void 0,void 0,function*(){return this.store.has(e)})}list(){return bi(this,void 0,void 0,function*(){return Array.from(this.store.values())})}set(e,r){return bi(this,void 0,void 0,function*(){this.store.set(e,r)})}};var uR=f(h(),1);var m5=f(h(),1),GT=f(Tf(),1);var JT=f(Tf(),1);var X5=f(h(),1);var j5=f(h(),1);var F5=f(h(),1);var M5=f(h(),1);var B5=f(h(),1);function Lg(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function YT(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function _f(t,...e){if(!YT(t))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function Mg(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Lg(t.outputLen),Lg(t.blockLen)}function Do(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Ng(t,e){_f(t);let r=e.outputLen;if(t.lengthnew DataView(t.buffer,t.byteOffset,t.byteLength),dr=(t,e)=>t<<32-e|t>>>e,XT=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!XT)throw new Error("Non little-endian hardware is not supported");function If(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function js(t){if(typeof t=="string"&&(t=If(t)),!$g(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function Fa(...t){let e=0;for(let n=0;nt().update(js(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function Ui(t=32){if(Ro&&typeof Ro.getRandomValues=="function")return Ro.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}function ZT(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),c=Number(r&o),a=n?4:0,d=n?0:4;t.setUint32(e+a,s,n),t.setUint32(e+d,c,n)}var Uo=class extends Oo{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=qa(this.buffer)}update(e){Do(this);let{view:r,buffer:n,blockLen:i}=this;e=js(e);let o=e.length;for(let s=0;si-s&&(this.process(n,0),s=0);for(let l=s;lu.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;lt&e^~t&r,e_=(t,e,r)=>t&e^t&r^e&r,t_=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Mn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Nn=new Uint32Array(64),Bf=class extends Uo{constructor(){super(64,32,8,!1),this.A=Mn[0]|0,this.B=Mn[1]|0,this.C=Mn[2]|0,this.D=Mn[3]|0,this.E=Mn[4]|0,this.F=Mn[5]|0,this.G=Mn[6]|0,this.H=Mn[7]|0}get(){let{A:e,B:r,C:n,D:i,E:o,F:s,G:c,H:a}=this;return[e,r,n,i,o,s,c,a]}set(e,r,n,i,o,s,c,a){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=c|0,this.H=a|0}process(e,r){for(let l=0;l<16;l++,r+=4)Nn[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){let y=Nn[l-15],g=Nn[l-2],p=dr(y,7)^dr(y,18)^y>>>3,w=dr(g,17)^dr(g,19)^g>>>10;Nn[l]=w+Nn[l-7]+p+Nn[l-16]|0}let{A:n,B:i,C:o,D:s,E:c,F:a,G:d,H:u}=this;for(let l=0;l<64;l++){let y=dr(c,6)^dr(c,11)^dr(c,25),g=u+y+QT(c,a,d)+t_[l]+Nn[l]|0,w=(dr(n,2)^dr(n,13)^dr(n,22))+e_(n,i,o)|0;u=d,d=a,a=c,c=s+g|0,s=o,o=i,i=n,n=g+w|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,c=c+this.E|0,a=a+this.F|0,d=d+this.G|0,u=u+this.H|0,this.set(n,i,o,s,c,a,d,u)}roundClean(){Nn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Xt=Va(()=>new Bf);var r_=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{d(n.next(u))}catch(l){s(l)}}function a(u){try{d(n.throw(u))}catch(l){s(l)}}function d(u){u.done?o(u.value):i(u.value).then(c,a)}d((n=n.apply(t,e||[])).next())})},Co=class{static digest({data:e}){return r_(this,void 0,void 0,function*(){return Xt(e)})}};var z5=f(h(),1),kr=class{};var n_=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{d(n.next(u))}catch(l){s(l)}}function a(u){try{d(n.throw(u))}catch(l){s(l)}}function d(u){u.done?o(u.value):i(u.value).then(c,a)}d((n=n.apply(t,e||[])).next())})},Ha=class extends kr{digest({algorithm:e,data:r}){return n_(this,void 0,void 0,function*(){switch(e){case"SHA-256":return yield Co.digest({data:r})}})}};var oU=f(h(),1);var qO=f(h(),1);var IO=f(h(),1);var eO=f(h(),1);var Wa={};Rc(Wa,{bitGet:()=>d_,bitLen:()=>u_,bitMask:()=>Ws,bitSet:()=>l_,bytesToHex:()=>dn,bytesToNumberBE:()=>ln,bytesToNumberLE:()=>fr,concatBytes:()=>hn,createHmacDrbg:()=>Of,ensureBytes:()=>De,equalBytes:()=>c_,hexToBytes:()=>Ci,hexToNumber:()=>Rf,isBytes:()=>lr,numberToBytesBE:()=>_t,numberToBytesLE:()=>fn,numberToHexUnpadded:()=>Hg,numberToVarBytesBE:()=>s_,utf8ToBytes:()=>a_,validateObject:()=>Zt});var Z5=f(h(),1);var Vg=BigInt(0),ja=BigInt(1),i_=BigInt(2);function lr(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var o_=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function dn(t){if(!lr(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r=un._0&&t<=un._9)return t-un._0;if(t>=un._A&&t<=un._F)return t-(un._A-10);if(t>=un._a&&t<=un._f)return t-(un._a-10)}function Ci(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);let e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let i=0,o=0;iVg;t>>=ja,e+=1);return e}function d_(t,e){return t>>BigInt(e)&ja}var l_=(t,e,r)=>t|(r?ja:Vg)<(i_<new Uint8Array(t),Fg=t=>Uint8Array.from(t);function Of(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=Df(t),i=Df(t),o=0,s=()=>{n.fill(1),i.fill(0),o=0},c=(...l)=>r(i,n,...l),a=(l=Df())=>{i=c(Fg([0]),l),n=c(),l.length!==0&&(i=c(Fg([1]),l),n=c())},d=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let l=0,y=[];for(;l{s(),a(l);let g;for(;!(g=y(d()));)a();return s(),g}}var f_={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||lr(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Zt(t,e,r={}){let n=(i,o,s)=>{let c=f_[o];if(typeof c!="function")throw new Error(`Invalid validator "${o}", expected function`);let a=t[i];if(!(s&&a===void 0)&&!c(a,t))throw new Error(`Invalid param ${String(i)}=${a} (${typeof a}), expected ${o}`)};for(let[i,o]of Object.entries(e))n(i,o,!1);for(let[i,o]of Object.entries(r))n(i,o,!0);return t}var Xe=BigInt(0),Ce=BigInt(1),Pi=BigInt(2),h_=BigInt(3),Uf=BigInt(4),jg=BigInt(5),Wg=BigInt(8),p_=BigInt(9),y_=BigInt(16);function Ee(t,e){let r=t%e;return r>=Xe?r:e+r}function Cf(t,e,r){if(r<=Xe||e 0");if(r===Ce)return Xe;let n=Ce;for(;e>Xe;)e&Ce&&(n=n*t%r),t=t*t%r,e>>=Ce;return n}function Re(t,e,r){let n=t;for(;e-- >Xe;)n*=n,n%=r;return n}function za(t,e){if(t===Xe||e<=Xe)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=Ee(t,e),n=e,i=Xe,o=Ce,s=Ce,c=Xe;for(;r!==Xe;){let d=n/r,u=n%r,l=i-s*d,y=o-c*d;n=r,r=u,i=s,o=c,s=l,c=y}if(n!==Ce)throw new Error("invert: does not exist");return Ee(i,e)}function m_(t){let e=(t-Ce)/Pi,r,n,i;for(r=t-Ce,n=0;r%Pi===Xe;r/=Pi,n++);for(i=Pi;i(Ee(t,e)&Ce)===Ce,w_=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Pf(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=w_.reduce((n,i)=>(n[i]="function",n),e);return Zt(t,r)}function b_(t,e,r){if(r 0");if(r===Xe)return t.ONE;if(r===Ce)return e;let n=t.ONE,i=e;for(;r>Xe;)r&Ce&&(n=t.mul(n,i)),i=t.sqr(i),r>>=Ce;return n}function x_(t,e){let r=new Array(e.length),n=e.reduce((o,s,c)=>t.is0(s)?o:(r[c]=o,t.mul(o,s)),t.ONE),i=t.inv(n);return e.reduceRight((o,s,c)=>t.is0(s)?o:(r[c]=t.mul(o,r[c]),t.mul(o,s)),i),r}function kf(t,e){let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function Po(t,e,r=!1,n={}){if(t<=Xe)throw new Error(`Expected Field ORDER > 0, got ${t}`);let{nBitLength:i,nByteLength:o}=kf(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");let s=g_(t),c=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:Ws(i),ZERO:Xe,ONE:Ce,create:a=>Ee(a,t),isValid:a=>{if(typeof a!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof a}`);return Xe<=a&&aa===Xe,isOdd:a=>(a&Ce)===Ce,neg:a=>Ee(-a,t),eql:(a,d)=>a===d,sqr:a=>Ee(a*a,t),add:(a,d)=>Ee(a+d,t),sub:(a,d)=>Ee(a-d,t),mul:(a,d)=>Ee(a*d,t),pow:(a,d)=>b_(c,a,d),div:(a,d)=>Ee(a*za(d,t),t),sqrN:a=>a*a,addN:(a,d)=>a+d,subN:(a,d)=>a-d,mulN:(a,d)=>a*d,inv:a=>za(a,t),sqrt:n.sqrt||(a=>s(c,a)),invertBatch:a=>x_(c,a),cmov:(a,d,u)=>u?d:a,toBytes:a=>r?fn(a,o):_t(a,o),fromBytes:a=>{if(a.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${a.length}`);return r?fr(a):ln(a)}});return Object.freeze(c)}function Gg(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");let r=t.sqrt(e);return t.isOdd(r)?t.neg(r):r}function Jg(t){if(typeof t!="bigint")throw new Error("field order must be bigint");let e=t.toString(2).length;return Math.ceil(e/8)}function Kf(t){let e=Jg(t);return e+Math.ceil(e/2)}function Yg(t,e,r=!1){let n=t.length,i=Jg(e),o=Kf(e);if(n<16||n1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);let s=r?ln(t):fr(t),c=Ee(s,e-Ce)+Ce;return r?fn(c,i):_t(c,i)}var lO=f(h(),1);var iO=f(h(),1);var v_=BigInt(0),Lf=BigInt(1);function Ga(t,e){let r=(i,o)=>{let s=o.negate();return i?s:o},n=i=>{let o=Math.ceil(e/i)+1,s=2**(i-1);return{windows:o,windowSize:s}};return{constTimeNegate:r,unsafeLadder(i,o){let s=t.ZERO,c=i;for(;o>v_;)o&Lf&&(s=s.add(c)),c=c.double(),o>>=Lf;return s},precomputeWindow(i,o){let{windows:s,windowSize:c}=n(o),a=[],d=i,u=d;for(let l=0;l>=g,x>a&&(x-=y,s+=Lf);let S=w,T=w+Math.abs(x)-1,E=p%2!==0,R=x<0;x===0?u=u.add(r(E,o[S])):d=d.add(r(R,o[T]))}return{p:d,f:u}},wNAFCached(i,o,s,c){let a=i._WINDOW_SIZE||1,d=o.get(i);return d||(d=this.precomputeWindow(i,a),a!==1&&o.set(i,c(d))),this.wNAF(a,d,s)}}}function zs(t){return Pf(t.Fp),Zt(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...kf(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}function S_(t){let e=zs(t);Zt(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}var{bytesToNumberBE:A_,hexToBytes:T_}=Wa,ki={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){let{Err:e}=ki;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");let r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:A_(n),l:t.subarray(r+2)}},toSig(t){let{Err:e}=ki,r=typeof t=="string"?T_(t):t;if(!lr(r))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");let{d:i,l:o}=ki._parseInt(r.subarray(2)),{d:s,l:c}=ki._parseInt(o);if(c.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){let e=d=>Number.parseInt(d[0],16)&8?"00"+d:d,r=d=>{let u=d.toString(16);return u.length&1?`0${u}`:u},n=e(r(t.s)),i=e(r(t.r)),o=n.length/2,s=i.length/2,c=r(o),a=r(s);return`30${r(s+o+4)}02${a}${i}02${c}${n}`}},pn=BigInt(0),Qt=BigInt(1),aO=BigInt(2),Xg=BigInt(3),uO=BigInt(4);function __(t){let e=S_(t),{Fp:r}=e,n=e.toBytes||((p,w,x)=>{let S=w.toAffine();return hn(Uint8Array.from([4]),r.toBytes(S.x),r.toBytes(S.y))}),i=e.fromBytes||(p=>{let w=p.subarray(1),x=r.fromBytes(w.subarray(0,r.BYTES)),S=r.fromBytes(w.subarray(r.BYTES,2*r.BYTES));return{x,y:S}});function o(p){let{a:w,b:x}=e,S=r.sqr(p),T=r.mul(S,p);return r.add(r.add(T,r.mul(p,w)),x)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(p){return typeof p=="bigint"&&pnr.eql(E,r.ZERO);return T(x)&&T(S)?l.ZERO:new l(x,S,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(w){let x=r.invertBatch(w.map(S=>S.pz));return w.map((S,T)=>S.toAffine(x[T])).map(l.fromAffine)}static fromHex(w){let x=l.fromAffine(i(De("pointHex",w)));return x.assertValidity(),x}static fromPrivateKey(w){return l.BASE.multiply(a(w))}_setWindowSize(w){this._WINDOW_SIZE=w,d.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:w,y:x}=this.toAffine();if(!r.isValid(w)||!r.isValid(x))throw new Error("bad point: x or y not FE");let S=r.sqr(x),T=o(w);if(!r.eql(S,T))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:w}=this.toAffine();if(r.isOdd)return!r.isOdd(w);throw new Error("Field doesn't support isOdd")}equals(w){u(w);let{px:x,py:S,pz:T}=this,{px:E,py:R,pz:D}=w,O=r.eql(r.mul(x,D),r.mul(E,T)),k=r.eql(r.mul(S,D),r.mul(R,T));return O&&k}negate(){return new l(this.px,r.neg(this.py),this.pz)}double(){let{a:w,b:x}=e,S=r.mul(x,Xg),{px:T,py:E,pz:R}=this,D=r.ZERO,O=r.ZERO,k=r.ZERO,P=r.mul(T,T),$=r.mul(E,E),N=r.mul(R,R),q=r.mul(T,E);return q=r.add(q,q),k=r.mul(T,R),k=r.add(k,k),D=r.mul(w,k),O=r.mul(S,N),O=r.add(D,O),D=r.sub($,O),O=r.add($,O),O=r.mul(D,O),D=r.mul(q,D),k=r.mul(S,k),N=r.mul(w,N),q=r.sub(P,N),q=r.mul(w,q),q=r.add(q,k),k=r.add(P,P),P=r.add(k,P),P=r.add(P,N),P=r.mul(P,q),O=r.add(O,P),N=r.mul(E,R),N=r.add(N,N),P=r.mul(N,q),D=r.sub(D,P),k=r.mul(N,$),k=r.add(k,k),k=r.add(k,k),new l(D,O,k)}add(w){u(w);let{px:x,py:S,pz:T}=this,{px:E,py:R,pz:D}=w,O=r.ZERO,k=r.ZERO,P=r.ZERO,$=e.a,N=r.mul(e.b,Xg),q=r.mul(x,E),V=r.mul(S,R),X=r.mul(T,D),ce=r.add(x,S),U=r.add(E,R);ce=r.mul(ce,U),U=r.add(q,V),ce=r.sub(ce,U),U=r.add(x,T);let L=r.add(E,D);return U=r.mul(U,L),L=r.add(q,X),U=r.sub(U,L),L=r.add(S,T),O=r.add(R,D),L=r.mul(L,O),O=r.add(V,X),L=r.sub(L,O),P=r.mul($,U),O=r.mul(N,X),P=r.add(O,P),O=r.sub(V,P),P=r.add(V,P),k=r.mul(O,P),V=r.add(q,q),V=r.add(V,q),X=r.mul($,X),U=r.mul(N,U),V=r.add(V,X),X=r.sub(q,X),X=r.mul($,X),U=r.add(U,X),q=r.mul(V,U),k=r.add(k,q),q=r.mul(L,U),O=r.mul(ce,O),O=r.sub(O,q),q=r.mul(ce,V),P=r.mul(L,P),P=r.add(P,q),new l(O,k,P)}subtract(w){return this.add(w.negate())}is0(){return this.equals(l.ZERO)}wNAF(w){return g.wNAFCached(this,d,w,x=>{let S=r.invertBatch(x.map(T=>T.pz));return x.map((T,E)=>T.toAffine(S[E])).map(l.fromAffine)})}multiplyUnsafe(w){let x=l.ZERO;if(w===pn)return x;if(c(w),w===Qt)return this;let{endo:S}=e;if(!S)return g.unsafeLadder(this,w);let{k1neg:T,k1:E,k2neg:R,k2:D}=S.splitScalar(w),O=x,k=x,P=this;for(;E>pn||D>pn;)E&Qt&&(O=O.add(P)),D&Qt&&(k=k.add(P)),P=P.double(),E>>=Qt,D>>=Qt;return T&&(O=O.negate()),R&&(k=k.negate()),k=new l(r.mul(k.px,S.beta),k.py,k.pz),O.add(k)}multiply(w){c(w);let x=w,S,T,{endo:E}=e;if(E){let{k1neg:R,k1:D,k2neg:O,k2:k}=E.splitScalar(x),{p:P,f:$}=this.wNAF(D),{p:N,f:q}=this.wNAF(k);P=g.constTimeNegate(R,P),N=g.constTimeNegate(O,N),N=new l(r.mul(N.px,E.beta),N.py,N.pz),S=P.add(N),T=$.add(q)}else{let{p:R,f:D}=this.wNAF(x);S=R,T=D}return l.normalizeZ([S,T])[0]}multiplyAndAddUnsafe(w,x,S){let T=l.BASE,E=(D,O)=>O===pn||O===Qt||!D.equals(T)?D.multiplyUnsafe(O):D.multiply(O),R=E(this,x).add(E(w,S));return R.is0()?void 0:R}toAffine(w){let{px:x,py:S,pz:T}=this,E=this.is0();w==null&&(w=E?r.ONE:r.inv(T));let R=r.mul(x,w),D=r.mul(S,w),O=r.mul(T,w);if(E)return{x:r.ZERO,y:r.ZERO};if(!r.eql(O,r.ONE))throw new Error("invZ was invalid");return{x:R,y:D}}isTorsionFree(){let{h:w,isTorsionFree:x}=e;if(w===Qt)return!0;if(x)return x(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:w,clearCofactor:x}=e;return w===Qt?this:x?x(l,this):this.multiplyUnsafe(e.h)}toRawBytes(w=!0){return this.assertValidity(),n(l,this,w)}toHex(w=!0){return dn(this.toRawBytes(w))}}l.BASE=new l(e.Gx,e.Gy,r.ONE),l.ZERO=new l(r.ZERO,r.ONE,r.ZERO);let y=e.nBitLength,g=Ga(l,e.endo?Math.ceil(y/2):y);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:a,weierstrassEquation:o,isWithinCurveOrder:s}}function I_(t){let e=zs(t);return Zt(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Zg(t){let e=I_(t),{Fp:r,n}=e,i=r.BYTES+1,o=2*r.BYTES+1;function s(U){return pndn(_t(U,e.nByteLength));function p(U){let L=n>>Qt;return U>L}function w(U){return p(U)?c(-U):U}let x=(U,L,H)=>ln(U.slice(L,H));class S{constructor(L,H,C){this.r=L,this.s=H,this.recovery=C,this.assertValidity()}static fromCompact(L){let H=e.nByteLength;return L=De("compactSignature",L,H*2),new S(x(L,0,H),x(L,H,2*H))}static fromDER(L){let{r:H,s:C}=ki.toSig(De("DER",L));return new S(H,C)}assertValidity(){if(!y(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!y(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(L){return new S(this.r,this.s,L)}recoverPublicKey(L){let{r:H,s:C,recovery:A}=this,K=k(De("msgHash",L));if(A==null||![0,1,2,3].includes(A))throw new Error("recovery id invalid");let M=A===2||A===3?H+e.n:H;if(M>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let F=A&1?"03":"02",te=d.fromHex(F+g(M)),re=a(M),ne=c(-K*re),Q=c(C*re),oe=d.BASE.multiplyAndAddUnsafe(te,ne,Q);if(!oe)throw new Error("point at infinify");return oe.assertValidity(),oe}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new S(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return Ci(this.toDERHex())}toDERHex(){return ki.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Ci(this.toCompactHex())}toCompactHex(){return g(this.r)+g(this.s)}}let T={isValidPrivateKey(U){try{return u(U),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{let U=Kf(e.n);return Yg(e.randomBytes(U),e.n)},precompute(U=8,L=d.BASE){return L._setWindowSize(U),L.multiply(BigInt(3)),L}};function E(U,L=!0){return d.fromPrivateKey(U).toRawBytes(L)}function R(U){let L=lr(U),H=typeof U=="string",C=(L||H)&&U.length;return L?C===i||C===o:H?C===2*i||C===2*o:U instanceof d}function D(U,L,H=!0){if(R(U))throw new Error("first arg must be private key");if(!R(L))throw new Error("second arg must be public key");return d.fromHex(L).multiply(u(U)).toRawBytes(H)}let O=e.bits2int||function(U){let L=ln(U),H=U.length*8-e.nBitLength;return H>0?L>>BigInt(H):L},k=e.bits2int_modN||function(U){return c(O(U))},P=Ws(e.nBitLength);function $(U){if(typeof U!="bigint")throw new Error("bigint expected");if(!(pn<=U&&Uge in H))throw new Error("sign() legacy options not supported");let{hash:C,randomBytes:A}=e,{lowS:K,prehash:M,extraEntropy:F}=H;K==null&&(K=!0),U=De("msgHash",U),M&&(U=De("prehashed msgHash",C(U)));let te=k(U),re=u(L),ne=[$(re),$(te)];if(F!=null){let ge=F===!0?A(r.BYTES):F;ne.push(De("extraEntropy",ge))}let Q=hn(...ne),oe=te;function xe(ge){let Ne=O(ge);if(!y(Ne))return;let He=a(Ne),$e=d.BASE.multiply(Ne).toAffine(),tt=c($e.x);if(tt===pn)return;let Ge=c(He*c(oe+tt*re));if(Ge===pn)return;let Vr=($e.x===tt?0:2)|Number($e.y&Qt),En=Ge;return K&&p(Ge)&&(En=w(Ge),Vr^=1),new S(tt,En,Vr)}return{seed:Q,k2sig:xe}}let q={lowS:e.lowS,prehash:!1},V={lowS:e.lowS,prehash:!1};function X(U,L,H=q){let{seed:C,k2sig:A}=N(U,L,H),K=e;return Of(K.hash.outputLen,K.nByteLength,K.hmac)(C,A)}d.BASE._setWindowSize(8);function ce(U,L,H,C=V){let A=U;if(L=De("msgHash",L),H=De("publicKey",H),"strict"in C)throw new Error("options.strict was renamed to lowS");let{lowS:K,prehash:M}=C,F,te;try{if(typeof A=="string"||lr(A))try{F=S.fromDER(A)}catch($e){if(!($e instanceof ki.Err))throw $e;F=S.fromCompact(A)}else if(typeof A=="object"&&typeof A.r=="bigint"&&typeof A.s=="bigint"){let{r:$e,s:tt}=A;F=new S($e,tt)}else throw new Error("PARSE");te=d.fromHex(H)}catch($e){if($e.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(K&&F.hasHighS())return!1;M&&(L=e.hash(L));let{r:re,s:ne}=F,Q=k(L),oe=a(ne),xe=c(Q*oe),ge=c(re*oe),Ne=d.BASE.multiplyAndAddUnsafe(te,xe,ge)?.toAffine();return Ne?c(Ne.x)===re:!1}return{CURVE:e,getPublicKey:E,getSharedSecret:D,sign:X,verify:ce,ProjectivePoint:d,Signature:S,utils:T}}var xO=f(h(),1);var yO=f(h(),1);var Ja=class extends Oo{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,Mg(e);let n=js(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,o=new Uint8Array(i);o.set(n.length>i?e.create().update(n).digest():n);for(let s=0;snew Ja(t,e).update(r).digest();Mf.create=(t,e)=>new Ja(t,e);function B_(t){return{hash:t,hmac:(e,...r)=>Mf(t,e,Fa(...r)),randomBytes:Ui}}function Ya(t,e){let r=n=>Zg({...t,...B_(n)});return Object.freeze({...r(e),create:r})}var tw=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Qg=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),D_=BigInt(1),Nf=BigInt(2),ew=(t,e)=>(t+e/Nf)/e;function R_(t){let e=tw,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),c=BigInt(44),a=BigInt(88),d=t*t*t%e,u=d*d*t%e,l=Re(u,r,e)*u%e,y=Re(l,r,e)*u%e,g=Re(y,Nf,e)*d%e,p=Re(g,i,e)*g%e,w=Re(p,o,e)*p%e,x=Re(w,c,e)*w%e,S=Re(x,a,e)*x%e,T=Re(S,c,e)*w%e,E=Re(T,r,e)*u%e,R=Re(E,s,e)*p%e,D=Re(R,n,e)*d%e,O=Re(D,Nf,e);if(!$f.eql($f.sqr(O),t))throw new Error("Cannot find square root");return O}var $f=Po(tw,void 0,void 0,{sqrt:R_}),It=Ya({a:BigInt(0),b:BigInt(7),Fp:$f,n:Qg,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=Qg,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-D_*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),c=ew(o*t,e),a=ew(-n*t,e),d=Ee(t-c*r-a*i,e),u=Ee(-c*n-a*o,e),l=d>s,y=u>s;if(l&&(d=e-d),y&&(u=e-u),d>s||u>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:d,k2neg:y,k2:u}}}},Xt),AO=BigInt(0);var TO=It.ProjectivePoint;var PO=f(h(),1);var DO=f(h(),1);function rw(t){let e=n=>{if(n!==null&&typeof n=="object"&&!Array.isArray(n)){let i=Object.keys(n).sort(),o={};for(let s of i)o[s]=e(n[s]);return o}return n},r=e(t);return JSON.stringify(r)}var O_=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{d(n.next(u))}catch(l){s(l)}}function a(u){try{d(n.throw(u))}catch(l){s(l)}}function d(u){u.done?o(u.value):i(u.value).then(c,a)}d((n=n.apply(t,e||[])).next())})},qf="urn:jwk:";function ae({jwk:t}){return O_(this,void 0,void 0,function*(){let e=t.kty,r;if(e==="EC")r={crv:t.crv,kty:t.kty,x:t.x,y:t.y};else if(e==="oct")r={k:t.k,kty:t.kty};else if(e==="OKP")r={crv:t.crv,kty:t.kty,x:t.x};else if(e==="RSA")r={e:t.e,kty:t.kty,n:t.n};else throw new Error(`Unsupported key type: ${e}`);xd(r);let n=rw(r),i=W.string(n).toUint8Array(),o=yield Co.digest({data:i});return W.uint8Array(o).toBase64Url()})}function Kr(t){return!(!t||typeof t!="object"||!("kty"in t&&"crv"in t&&"x"in t&&"d"in t)||t.kty!=="EC"||typeof t.d!="string"||typeof t.x!="string")}function ko(t){return!(!t||typeof t!="object"||!("kty"in t&&"crv"in t&&"x"in t)||"d"in t||t.kty!=="EC"||typeof t.x!="string")}function Lr(t){return!(!t||typeof t!="object"||!("kty"in t&&"crv"in t&&"x"in t&&"d"in t)||t.kty!=="OKP"||typeof t.d!="string"||typeof t.x!="string")}function Ko(t){return!(!t||typeof t!="object"||"d"in t||!("kty"in t&&"crv"in t&&"x"in t)||t.kty!=="OKP"||typeof t.x!="string")}function nw(t){if(!t||typeof t!="object")return!1;switch(t.kty){case"EC":case"OKP":case"RSA":return"d"in t;case"oct":return"k"in t;default:return!1}}var at=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{d(n.next(u))}catch(l){s(l)}}function a(u){try{d(n.throw(u))}catch(l){s(l)}}function d(u){u.done?o(u.value):i(u.value).then(c,a)}d((n=n.apply(t,e||[])).next())})},U_=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i>Ff&Xa)}:{h:Number(t>>Ff&Xa)|0,l:Number(t&Xa)|0}}function L_(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;iBigInt(t>>>0)<>>0),N_=(t,e,r)=>t>>>r,$_=(t,e,r)=>t<<32-r|e>>>r,q_=(t,e,r)=>t>>>r|e<<32-r,F_=(t,e,r)=>t<<32-r|e>>>r,V_=(t,e,r)=>t<<64-r|e>>>r-32,H_=(t,e,r)=>t>>>r-32|e<<64-r,j_=(t,e)=>e,W_=(t,e)=>t,z_=(t,e,r)=>t<>>32-r,G_=(t,e,r)=>e<>>32-r,J_=(t,e,r)=>e<>>64-r,Y_=(t,e,r)=>t<>>64-r;function X_(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var Z_=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),Q_=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,eI=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),tI=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,rI=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),nI=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0;var iI={fromBig:ow,split:L_,toBig:M_,shrSH:N_,shrSL:$_,rotrSH:q_,rotrSL:F_,rotrBH:V_,rotrBL:H_,rotr32H:j_,rotr32L:W_,rotlSH:z_,rotlSL:G_,rotlBH:J_,rotlBL:Y_,add:X_,add3L:Z_,add3H:Q_,add4L:eI,add4H:tI,add5H:nI,add5L:rI},de=iI;var[oI,sI]=de.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),$n=new Uint32Array(80),qn=new Uint32Array(80),Vf=class extends Uo{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:r,Bh:n,Bl:i,Ch:o,Cl:s,Dh:c,Dl:a,Eh:d,El:u,Fh:l,Fl:y,Gh:g,Gl:p,Hh:w,Hl:x}=this;return[e,r,n,i,o,s,c,a,d,u,l,y,g,p,w,x]}set(e,r,n,i,o,s,c,a,d,u,l,y,g,p,w,x){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=o|0,this.Cl=s|0,this.Dh=c|0,this.Dl=a|0,this.Eh=d|0,this.El=u|0,this.Fh=l|0,this.Fl=y|0,this.Gh=g|0,this.Gl=p|0,this.Hh=w|0,this.Hl=x|0}process(e,r){for(let E=0;E<16;E++,r+=4)$n[E]=e.getUint32(r),qn[E]=e.getUint32(r+=4);for(let E=16;E<80;E++){let R=$n[E-15]|0,D=qn[E-15]|0,O=de.rotrSH(R,D,1)^de.rotrSH(R,D,8)^de.shrSH(R,D,7),k=de.rotrSL(R,D,1)^de.rotrSL(R,D,8)^de.shrSL(R,D,7),P=$n[E-2]|0,$=qn[E-2]|0,N=de.rotrSH(P,$,19)^de.rotrBH(P,$,61)^de.shrSH(P,$,6),q=de.rotrSL(P,$,19)^de.rotrBL(P,$,61)^de.shrSL(P,$,6),V=de.add4L(k,q,qn[E-7],qn[E-16]),X=de.add4H(V,O,N,$n[E-7],$n[E-16]);$n[E]=X|0,qn[E]=V|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:c,Cl:a,Dh:d,Dl:u,Eh:l,El:y,Fh:g,Fl:p,Gh:w,Gl:x,Hh:S,Hl:T}=this;for(let E=0;E<80;E++){let R=de.rotrSH(l,y,14)^de.rotrSH(l,y,18)^de.rotrBH(l,y,41),D=de.rotrSL(l,y,14)^de.rotrSL(l,y,18)^de.rotrBL(l,y,41),O=l&g^~l&w,k=y&p^~y&x,P=de.add5L(T,D,k,sI[E],qn[E]),$=de.add5H(P,S,R,O,oI[E],$n[E]),N=P|0,q=de.rotrSH(n,i,28)^de.rotrBH(n,i,34)^de.rotrBH(n,i,39),V=de.rotrSL(n,i,28)^de.rotrBL(n,i,34)^de.rotrBL(n,i,39),X=n&o^n&c^o&c,ce=i&s^i&a^s&a;S=w|0,T=x|0,w=g|0,x=p|0,g=l|0,p=y|0,{h:l,l:y}=de.add(d|0,u|0,$|0,N|0),d=c|0,u=a|0,c=o|0,a=s|0,o=n|0,s=i|0;let U=de.add3L(N,V,ce);n=de.add3H(U,$,q,X),i=U|0}({h:n,l:i}=de.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=de.add(this.Bh|0,this.Bl|0,o|0,s|0),{h:c,l:a}=de.add(this.Ch|0,this.Cl|0,c|0,a|0),{h:d,l:u}=de.add(this.Dh|0,this.Dl|0,d|0,u|0),{h:l,l:y}=de.add(this.Eh|0,this.El|0,l|0,y|0),{h:g,l:p}=de.add(this.Fh|0,this.Fl|0,g|0,p|0),{h:w,l:x}=de.add(this.Gh|0,this.Gl|0,w|0,x|0),{h:S,l:T}=de.add(this.Hh|0,this.Hl|0,S|0,T|0),this.set(n,i,o,s,c,a,d,u,l,y,g,p,w,x,S,T)}roundClean(){$n.fill(0),qn.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var Hf=Va(()=>new Vf);var gU=f(h(),1);var hr=BigInt(0),Nt=BigInt(1),Za=BigInt(2),cI=BigInt(8),aI={zip215:!0};function uI(t){let e=zs(t);return Zt(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function Qa(t){let e=uI(t),{Fp:r,n,prehash:i,hash:o,randomBytes:s,nByteLength:c,h:a}=e,d=Za<{try{return{isValid:!0,value:r.sqrt(C*r.inv(A))}}catch{return{isValid:!1,value:hr}}}),y=e.adjustScalarBytes||(C=>C),g=e.domain||((C,A,K)=>{if(A.length||K)throw new Error("Contexts/pre-hash are not supported");return C}),p=C=>typeof C=="bigint"&&hrp(C)&&p(A)&&CC===hr||w(C,d);function S(C,A){if(w(C,A))return C;throw new Error(`Expected valid scalar < ${A}, got ${typeof C} ${C}`)}function T(C){return C===hr?C:S(C,n)}let E=new Map;function R(C){if(!(C instanceof D))throw new Error("ExtendedPoint expected")}class D{constructor(A,K,M,F){if(this.ex=A,this.ey=K,this.ez=M,this.et=F,!x(A))throw new Error("x required");if(!x(K))throw new Error("y required");if(!x(M))throw new Error("z required");if(!x(F))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(A){if(A instanceof D)throw new Error("extended point not allowed");let{x:K,y:M}=A||{};if(!x(K)||!x(M))throw new Error("invalid affine point");return new D(K,M,Nt,u(K*M))}static normalizeZ(A){let K=r.invertBatch(A.map(M=>M.ez));return A.map((M,F)=>M.toAffine(K[F])).map(D.fromAffine)}_setWindowSize(A){this._WINDOW_SIZE=A,E.delete(this)}assertValidity(){let{a:A,d:K}=e;if(this.is0())throw new Error("bad point: ZERO");let{ex:M,ey:F,ez:te,et:re}=this,ne=u(M*M),Q=u(F*F),oe=u(te*te),xe=u(oe*oe),ge=u(ne*A),Ne=u(oe*u(ge+Q)),He=u(xe+u(K*u(ne*Q)));if(Ne!==He)throw new Error("bad point: equation left != right (1)");let $e=u(M*F),tt=u(te*re);if($e!==tt)throw new Error("bad point: equation left != right (2)")}equals(A){R(A);let{ex:K,ey:M,ez:F}=this,{ex:te,ey:re,ez:ne}=A,Q=u(K*ne),oe=u(te*F),xe=u(M*ne),ge=u(re*F);return Q===oe&&xe===ge}is0(){return this.equals(D.ZERO)}negate(){return new D(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:A}=e,{ex:K,ey:M,ez:F}=this,te=u(K*K),re=u(M*M),ne=u(Za*u(F*F)),Q=u(A*te),oe=K+M,xe=u(u(oe*oe)-te-re),ge=Q+re,Ne=ge-ne,He=Q-re,$e=u(xe*Ne),tt=u(ge*He),Ge=u(xe*He),Vr=u(Ne*ge);return new D($e,tt,Vr,Ge)}add(A){R(A);let{a:K,d:M}=e,{ex:F,ey:te,ez:re,et:ne}=this,{ex:Q,ey:oe,ez:xe,et:ge}=A;if(K===BigInt(-1)){let ts=u((te-F)*(oe+Q)),vc=u((te+F)*(oe-Q)),rs=u(vc-ts);if(rs===hr)return this.double();let Sc=u(re*Za*ge),Ac=u(ne*Za*xe),Vt=Ac+Sc,Sn=vc+ts,ns=Ac-Sc,Tc=u(Vt*rs),Yn=u(Sn*ns),_c=u(Vt*ns),Wu=u(rs*Sn);return new D(Tc,Yn,Wu,_c)}let Ne=u(F*Q),He=u(te*oe),$e=u(ne*M*ge),tt=u(re*xe),Ge=u((F+te)*(Q+oe)-Ne-He),Vr=tt-$e,En=tt+$e,es=u(He-K*Ne),Ec=u(Ge*Vr),ju=u(En*es),vn=u(Ge*es),Ft=u(Vr*En);return new D(Ec,ju,Ft,vn)}subtract(A){return this.add(A.negate())}wNAF(A){return P.wNAFCached(this,E,A,D.normalizeZ)}multiply(A){let{p:K,f:M}=this.wNAF(S(A,n));return D.normalizeZ([K,M])[0]}multiplyUnsafe(A){let K=T(A);return K===hr?k:this.equals(k)||K===Nt?this:this.equals(O)?this.wNAF(K).p:P.unsafeLadder(this,K)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}isTorsionFree(){return P.unsafeLadder(this,n).is0()}toAffine(A){let{ex:K,ey:M,ez:F}=this,te=this.is0();A==null&&(A=te?cI:r.inv(F));let re=u(K*A),ne=u(M*A),Q=u(F*A);if(te)return{x:hr,y:Nt};if(Q!==Nt)throw new Error("invZ was invalid");return{x:re,y:ne}}clearCofactor(){let{h:A}=e;return A===Nt?this:this.multiplyUnsafe(A)}static fromHex(A,K=!1){let{d:M,a:F}=e,te=r.BYTES;A=De("pointHex",A,te);let re=A.slice(),ne=A[te-1];re[te-1]=ne&-129;let Q=fr(re);Q===hr||(K?S(Q,d):S(Q,r.ORDER));let oe=u(Q*Q),xe=u(oe-Nt),ge=u(M*oe-F),{isValid:Ne,value:He}=l(xe,ge);if(!Ne)throw new Error("Point.fromHex: invalid y coordinate");let $e=(He&Nt)===Nt,tt=(ne&128)!==0;if(!K&&He===hr&&tt)throw new Error("Point.fromHex: x=0 and x_0=1");return tt!==$e&&(He=u(-He)),D.fromAffine({x:He,y:Q})}static fromPrivateKey(A){return q(A).point}toRawBytes(){let{x:A,y:K}=this.toAffine(),M=fn(K,r.BYTES);return M[M.length-1]|=A&Nt?128:0,M}toHex(){return dn(this.toRawBytes())}}D.BASE=new D(e.Gx,e.Gy,Nt,u(e.Gx*e.Gy)),D.ZERO=new D(hr,Nt,Nt,hr);let{BASE:O,ZERO:k}=D,P=Ga(D,c*8);function $(C){return Ee(C,n)}function N(C){return $(fr(C))}function q(C){let A=c;C=De("private key",C,A);let K=De("hashed private key",o(C),2*A),M=y(K.slice(0,A)),F=K.slice(A,2*A),te=N(M),re=O.multiply(te),ne=re.toRawBytes();return{head:M,prefix:F,scalar:te,point:re,pointBytes:ne}}function V(C){return q(C).pointBytes}function X(C=new Uint8Array,...A){let K=hn(...A);return N(o(g(K,De("context",C),!!i)))}function ce(C,A,K={}){C=De("message",C),i&&(C=i(C));let{prefix:M,scalar:F,pointBytes:te}=q(A),re=X(K.context,M,C),ne=O.multiply(re).toRawBytes(),Q=X(K.context,ne,te,C),oe=$(re+Q*F);T(oe);let xe=hn(ne,fn(oe,r.BYTES));return De("result",xe,c*2)}let U=aI;function L(C,A,K,M=U){let{context:F,zip215:te}=M,re=r.BYTES;C=De("signature",C,2*re),A=De("message",A),i&&(A=i(A));let ne=fr(C.slice(re,2*re)),Q,oe,xe;try{Q=D.fromHex(K,te),oe=D.fromHex(C.slice(0,re),te),xe=O.multiplyUnsafe(ne)}catch{return!1}if(!te&&Q.isSmallOrder())return!1;let ge=X(F,oe.toRawBytes(),Q.toRawBytes(),A);return oe.add(Q.multiplyUnsafe(ge)).subtract(xe).clearCofactor().equals(D.ZERO)}return O._setWindowSize(8),{CURVE:e,getPublicKey:V,sign:ce,verify:L,ExtendedPoint:D,utils:{getExtendedPublicKey:q,randomPrivateKey:()=>s(r.BYTES),precompute(C=8,A=D.BASE){return A._setWindowSize(C),A.multiply(BigInt(3)),A}}}}var EU=f(h(),1);var Ys=BigInt(0),jf=BigInt(1);function dI(t){return Zt(t,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...t})}function sw(t){let e=dI(t),{P:r}=e,n=E=>Ee(E,r),i=e.montgomeryBits,o=Math.ceil(i/8),s=e.nByteLength,c=e.adjustScalarBytes||(E=>E),a=e.powPminus2||(E=>Cf(E,r-BigInt(2),r));function d(E,R,D){let O=n(E*(R-D));return R=n(R-O),D=n(D+O),[R,D]}function u(E){if(typeof E=="bigint"&&Ys<=E&&E=Ys;U--){let L=O>>U&jf;V^=L,X=d(V,P,N),P=X[0],N=X[1],X=d(V,$,q),$=X[0],q=X[1],V=L;let H=P+$,C=n(H*H),A=P-$,K=n(A*A),M=C-K,F=N+q,te=N-q,re=n(te*H),ne=n(F*A),Q=re+ne,oe=re-ne;N=n(Q*Q),q=n(k*n(oe*oe)),P=n(C*K),$=n(M*(C+n(l*M)))}X=d(V,P,N),P=X[0],N=X[1],X=d(V,$,q),$=X[0],q=X[1];let ce=a($);return n(P*ce)}function g(E){return fn(n(E),o)}function p(E){let R=De("u coordinate",E,o);return s===32&&(R[31]&=127),fr(R)}function w(E){let R=De("scalar",E),D=R.length;if(D!==o&&D!==s)throw new Error(`Expected ${o} or ${s} bytes, got ${D}`);return fr(c(R))}function x(E,R){let D=p(R),O=w(E),k=y(D,O);if(k===Ys)throw new Error("Invalid private or public key received");return g(k)}let S=g(e.Gu);function T(E){return x(E,S)}return{scalarMult:x,scalarMultBase:T,getSharedSecret:(E,R)=>x(E,R),getPublicKey:E=>T(E),utils:{randomPrivateKey:()=>e.randomBytes(e.nByteLength)},GuBytes:S}}var Xs=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),cw=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),IU=BigInt(0),lI=BigInt(1),Wf=BigInt(2),fI=BigInt(5),aw=BigInt(10),hI=BigInt(20),pI=BigInt(40),uw=BigInt(80);function dw(t){let e=Xs,n=t*t%e*t%e,i=Re(n,Wf,e)*n%e,o=Re(i,lI,e)*t%e,s=Re(o,fI,e)*o%e,c=Re(s,aw,e)*s%e,a=Re(c,hI,e)*c%e,d=Re(a,pI,e)*a%e,u=Re(d,uw,e)*d%e,l=Re(u,uw,e)*d%e,y=Re(l,aw,e)*s%e;return{pow_p_5_8:Re(y,Wf,e)*t%e,b2:n}}function lw(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function yI(t,e){let r=Xs,n=Ee(e*e*e,r),i=Ee(n*n*e,r),o=dw(t*i).pow_p_5_8,s=Ee(t*n*o,r),c=Ee(e*s*s,r),a=s,d=Ee(s*cw,r),u=c===t,l=c===Ee(-t,r),y=c===Ee(-t*cw,r);return u&&(s=a),(l||y)&&(s=d),zg(s,r)&&(s=Ee(-s,r)),{isValid:u||l,value:s}}var er=Po(Xs,void 0,!0),Zs={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:er,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Hf,randomBytes:Ui,adjustScalarBytes:lw,uvRatio:yI},Fn=Qa(Zs);function fw(t,e,r){if(e.length>255)throw new Error("Context is too big");return Fa(If("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,e.length]),e,t)}var BU=Qa({...Zs,domain:fw}),DU=Qa({...Zs,domain:fw,prehash:Hf}),Ki=sw({P:Xs,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:t=>{let e=Xs,{pow_p_5_8:r,b2:n}=dw(t);return Ee(Re(r,BigInt(3),e)*n,e)},adjustScalarBytes:lw,randomBytes:Ui});function hw(t){let{y:e}=Fn.ExtendedPoint.fromHex(t),r=BigInt(1);return er.toBytes(er.create((r+e)*er.inv(r-e)))}function pw(t){let e=Zs.hash(t.subarray(0,32));return Zs.adjustScalarBytes(e).subarray(0,32)}var mI=(er.ORDER+BigInt(3))/BigInt(8),RU=er.pow(Wf,mI),OU=er.sqrt(er.neg(er.ONE)),UU=(er.ORDER-BigInt(5))/BigInt(8),CU=BigInt(486662);var PU=Gg(er,er.neg(BigInt(486664)));var kU=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),KU=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),LU=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),MU=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");var NU=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var tr=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{d(n.next(u))}catch(l){s(l)}}function a(u){try{d(n.throw(u))}catch(l){s(l)}}function d(u){u.done?o(u.value):i(u.value).then(c,a)}d((n=n.apply(t,e||[])).next())})},gI=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);iwI,checkValidProperty:()=>bI,getJoseSignatureAlgorithmFromPublicKey:()=>xI,isWebCryptoSupported:()=>EI,randomBytes:()=>vI,randomUuid:()=>SI});var cC=f(h(),1);function wI(t){if(!t||t.property===void 0||t.inObject===void 0)throw new TypeError("One or more required parameters missing: 'property, properties'");let{property:e,inObject:r}=t;if(!(e in r))throw new TypeError(`Required parameter missing: '${e}'`)}function bI(t){if(!t||t.property===void 0||t.allowedProperties===void 0)throw new TypeError("One or more required parameters missing: 'property, allowedProperties'");let{property:e,allowedProperties:r}=t;if(Array.isArray(r)&&!r.includes(e)||r instanceof Set&&!r.has(e)||r instanceof Map&&!r.has(e)){let n=Array.from(r instanceof Map?r.keys():r).join(", ");throw new TypeError(`Out of range: '${e}'. Must be one of '${n}'`)}}function xI(t){let e={Ed25519:"EdDSA","P-256":"ES256","P-384":"ES384","P-521":"ES512",secp256k1:"ES256K"};if(t.alg&&Object.values(e).includes(t.alg))return t.alg;if(t.crv&&Object.keys(e).includes(t.crv))return e[t.crv];throw new Error(`Unable to determine algorithm based on provided input: alg=${t.alg}, crv=${t.crv}. Supported 'alg' values: ${Object.values(e).join(", ")}. Supported 'crv' values: ${Object.keys(e).join(", ")}.`)}function EI(){return!!(globalThis.crypto&&globalThis.crypto.subtle)}function vI(t){return Ui(t)}function SI(){return Ro.randomUUID()}var DC=f(h(),1);var AC=f(h(),1);var bC=f(h(),1);var uC=f(h(),1),AI=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var lC=f(h(),1);var mn=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4));function yw(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var mw=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),TI=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!TI)throw new Error("Non little-endian hardware is not supported");function ru(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function nu(t){if(typeof t=="string")t=ru(t);else if(yw(t))t=t.slice();else throw new Error(`expected Uint8Array, got ${typeof t}`);return t}var _I=t=>Object.prototype.toString.call(t)==="[object Object]"&&t.constructor===Object;function gw(t,e){if(e!==void 0&&(typeof e!="object"||!_I(e)))throw new Error("options must be object or undefined");return Object.assign(t,e)}function Li(t,e){if(!yw(t))throw new Error("Uint8Array expected");if(typeof e=="number"&&t.length!==e)throw new Error(`Uint8Array length ${e} expected`)}function ww(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n(Object.assign(e,t),e);function Jf(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),c=Number(r&o),a=n?4:0,d=n?0:4;t.setUint32(e+a,s,n),t.setUint32(e+d,c,n)}var hC=f(h(),1);function ec(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`wrong positive integer: ${t}`)}function Yf(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function II(t){return t!=null&&typeof t=="object"&&(t instanceof Uint8Array||t.constructor.name==="Uint8Array")}function Lo(t,...e){if(!II(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function Xf(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function bw(t,e){Lo(t);let r=e.outputLen;if(t.lengtht[e++]&255|(t[e++]&255)<<8,eh=class{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=nu(e),Li(e,32);let r=lt(e,0),n=lt(e,2),i=lt(e,4),o=lt(e,6),s=lt(e,8),c=lt(e,10),a=lt(e,12),d=lt(e,14);this.r[0]=r&8191,this.r[1]=(r>>>13|n<<3)&8191,this.r[2]=(n>>>10|i<<6)&7939,this.r[3]=(i>>>7|o<<9)&8191,this.r[4]=(o>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|c<<2)&8191,this.r[7]=(c>>>11|a<<5)&8065,this.r[8]=(a>>>8|d<<8)&8191,this.r[9]=d>>>5&127;for(let u=0;u<8;u++)this.pad[u]=lt(e,16+2*u)}process(e,r,n=!1){let i=n?0:2048,{h:o,r:s}=this,c=s[0],a=s[1],d=s[2],u=s[3],l=s[4],y=s[5],g=s[6],p=s[7],w=s[8],x=s[9],S=lt(e,r+0),T=lt(e,r+2),E=lt(e,r+4),R=lt(e,r+6),D=lt(e,r+8),O=lt(e,r+10),k=lt(e,r+12),P=lt(e,r+14),$=o[0]+(S&8191),N=o[1]+((S>>>13|T<<3)&8191),q=o[2]+((T>>>10|E<<6)&8191),V=o[3]+((E>>>7|R<<9)&8191),X=o[4]+((R>>>4|D<<12)&8191),ce=o[5]+(D>>>1&8191),U=o[6]+((D>>>14|O<<2)&8191),L=o[7]+((O>>>11|k<<5)&8191),H=o[8]+((k>>>8|P<<8)&8191),C=o[9]+(P>>>5|i),A=0,K=A+$*c+N*(5*x)+q*(5*w)+V*(5*p)+X*(5*g);A=K>>>13,K&=8191,K+=ce*(5*y)+U*(5*l)+L*(5*u)+H*(5*d)+C*(5*a),A+=K>>>13,K&=8191;let M=A+$*a+N*c+q*(5*x)+V*(5*w)+X*(5*p);A=M>>>13,M&=8191,M+=ce*(5*g)+U*(5*y)+L*(5*l)+H*(5*u)+C*(5*d),A+=M>>>13,M&=8191;let F=A+$*d+N*a+q*c+V*(5*x)+X*(5*w);A=F>>>13,F&=8191,F+=ce*(5*p)+U*(5*g)+L*(5*y)+H*(5*l)+C*(5*u),A+=F>>>13,F&=8191;let te=A+$*u+N*d+q*a+V*c+X*(5*x);A=te>>>13,te&=8191,te+=ce*(5*w)+U*(5*p)+L*(5*g)+H*(5*y)+C*(5*l),A+=te>>>13,te&=8191;let re=A+$*l+N*u+q*d+V*a+X*c;A=re>>>13,re&=8191,re+=ce*(5*x)+U*(5*w)+L*(5*p)+H*(5*g)+C*(5*y),A+=re>>>13,re&=8191;let ne=A+$*y+N*l+q*u+V*d+X*a;A=ne>>>13,ne&=8191,ne+=ce*c+U*(5*x)+L*(5*w)+H*(5*p)+C*(5*g),A+=ne>>>13,ne&=8191;let Q=A+$*g+N*y+q*l+V*u+X*d;A=Q>>>13,Q&=8191,Q+=ce*a+U*c+L*(5*x)+H*(5*w)+C*(5*p),A+=Q>>>13,Q&=8191;let oe=A+$*p+N*g+q*y+V*l+X*u;A=oe>>>13,oe&=8191,oe+=ce*d+U*a+L*c+H*(5*x)+C*(5*w),A+=oe>>>13,oe&=8191;let xe=A+$*w+N*p+q*g+V*y+X*l;A=xe>>>13,xe&=8191,xe+=ce*u+U*d+L*a+H*c+C*(5*x),A+=xe>>>13,xe&=8191;let ge=A+$*x+N*w+q*p+V*g+X*y;A=ge>>>13,ge&=8191,ge+=ce*l+U*u+L*d+H*a+C*c,A+=ge>>>13,ge&=8191,A=(A<<2)+A|0,A=A+K|0,K=A&8191,A=A>>>13,M+=A,o[0]=K,o[1]=M,o[2]=F,o[3]=te,o[4]=re,o[5]=ne,o[6]=Q,o[7]=oe,o[8]=xe,o[9]=ge}finalize(){let{h:e,pad:r}=this,n=new Uint16Array(10),i=e[1]>>>13;e[1]&=8191;for(let c=2;c<10;c++)e[c]+=i,i=e[c]>>>13,e[c]&=8191;e[0]+=i*5,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,n[0]=e[0]+5,i=n[0]>>>13,n[0]&=8191;for(let c=1;c<10;c++)n[c]=e[c]+i,i=n[c]>>>13,n[c]&=8191;n[9]-=8192;let o=(i^1)-1;for(let c=0;c<10;c++)n[c]&=o;o=~o;for(let c=0;c<10;c++)e[c]=e[c]&o|n[c];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let s=e[0]+r[0];e[0]=s&65535;for(let c=1;c<8;c++)s=(e[c]+r[c]|0)+(s>>>16)|0,e[c]=s&65535}update(e){Xf(this);let{buffer:r,blockLen:n}=this;e=nu(e);let i=e.length;for(let o=0;o>>0,e[o++]=n[s]>>>8;return e}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}};function DI(t){let e=(n,i)=>t(i).update(nu(n)).digest(),r=t(new Uint8Array(32));return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}var xw=DI(t=>new eh(t));var sP=f(h(),1);var RI=ru("expand 16-byte k"),OI=ru("expand 32-byte k"),UI=mn(RI),CI=mn(OI);function G(t,e){return t<>>32-e}function th(t){return t.byteOffset%4===0}var iu=64,PI=16,vw=2**32-1,Ew=new Uint32Array;function kI(t,e,r,n,i,o,s,c){let a=i.length,d=new Uint8Array(iu),u=mn(d),l=th(i)&&th(o),y=l?mn(i):Ew,g=l?mn(o):Ew;for(let p=0;p=vw)throw new Error("arx: counter overflow");let w=Math.min(iu,a-p);if(l&&w===iu){let x=p/4;if(p%4!==0)throw new Error("arx: invalid block position");for(let S=0,T;S{Lo(c),Lo(a),Lo(d);let y=d.length;if(u||(u=new Uint8Array(y)),Lo(u),ec(l),l<0||l>=vw)throw new Error("arx: counter overflow");if(u.length0;)g.pop().fill(0);return u}}function Tw(t,e,r,n,i,o=20){let s=t[0],c=t[1],a=t[2],d=t[3],u=e[0],l=e[1],y=e[2],g=e[3],p=e[4],w=e[5],x=e[6],S=e[7],T=i,E=r[0],R=r[1],D=r[2],O=s,k=c,P=a,$=d,N=u,q=l,V=y,X=g,ce=p,U=w,L=x,H=S,C=T,A=E,K=R,M=D;for(let te=0;te{t.update(e);let r=e.length%16;r&&t.update(MI.subarray(r))},NI=new Uint8Array(32);function Aw(t,e,r,n,i){let o=t(e,r,NI),s=xw.create(o);i&&Sw(s,i),Sw(s,n);let c=new Uint8Array(16),a=mw(c);Jf(a,0,BigInt(i?i.length:0),!0),Jf(a,8,BigInt(n.length),!0),s.update(c);let d=s.digest();return o.fill(0),d}var Iw=t=>(e,r,n)=>(Li(e,32),Li(r),{encrypt:(o,s)=>{let c=o.length,a=c+16;s?Li(s,a):s=new Uint8Array(a),t(e,r,o,s,1);let d=Aw(t,e,r,s.subarray(0,-16),n);return s.set(d,c),s},decrypt:(o,s)=>{let c=o.length,a=c-16;if(c<16)throw new Error("encrypted data must be at least 16 bytes");s?Li(s,a):s=new Uint8Array(a);let d=o.subarray(0,-16),u=o.subarray(-16),l=Aw(t,e,r,d,n);if(!ww(u,l))throw new Error("invalid tag");return t(e,r,d,s,1),s}}),dP=Gf({blockSize:64,nonceLength:12,tagLength:16},Iw(LI)),$I=Gf({blockSize:64,nonceLength:24,tagLength:16},Iw(_w));var AP=f(h(),1);var Dw={};Rc(Dw,{extractDidFragment:()=>Bt,getServices:()=>qI,getVerificationMethodByKey:()=>FI,getVerificationMethodTypes:()=>nh,getVerificationMethods:()=>tc,getVerificationRelationshipsById:()=>ih,isDidService:()=>Bw,isDidVerificationMethod:()=>ou,isDwnDidService:()=>VI,keyBytesToMultibaseId:()=>su,multibaseIdToKeyBytes:()=>cu});var nk=f(h(),1);function Bt(t){if(typeof t=="string"&&t.length!==0)return t.split("#").pop()}function qI({didDocument:t,id:e,type:r}){return t?.service?.filter(n=>!(e&&n.id!==e||r&&n.type!==r))??[]}async function FI({didDocument:t,publicKeyJwk:e,publicKeyMultibase:r}){let n=tc({didDocument:t});for(let i of n)if(e&&i.publicKeyJwk){if(await ae({jwk:e})===await ae({jwk:i.publicKeyJwk}))return i}else if(r&&i.publicKeyMultibase&&r===i.publicKeyMultibase)return i;return null}function tc({didDocument:t}){if(!t)throw new TypeError("Required parameter missing: 'didDocument'");let e=[];return e.push(...t.verificationMethod?.filter(ou)??[]),Object.keys(no).forEach(r=>{e.push(...t[r]?.filter(ou)??[])}),e}function nh({didDocument:t}){let r=tc({didDocument:t}).map(n=>n.type);return[...new Set(r)]}function ih({didDocument:t,methodId:e}){let r=[];return Object.keys(no).forEach(n=>{if(Array.isArray(t[n])){let i=t[n],o=Bt(e);i.some(c=>{let a=Bt(c)===o,d=ou(c)&&Bt(c.id)===o;return a||d})&&r.push(n)}}),r}function Bw(t){return!t||typeof t!="object"||t===null?!1:"id"in t&&"type"in t&&"serviceEndpoint"in t}function VI(t){if(!Bw(t)||t.type!=="DecentralizedWebNode"||!("enc"in t&&"sig"in t))return!1;let e=r=>typeof r=="string"||Array.isArray(r)&&r.every(n=>typeof n=="string");return e(t.enc)&&e(t.sig)}function ou(t){return!(!t||typeof t!="object"||t===null||!("id"in t&&"type"in t&&"controller"in t)||typeof t.id!="string"||typeof t.type!="string"||typeof t.controller!="string")}function su({keyBytes:t,multicodecCode:e,multicodecName:r}){let n=pt.addPrefix({code:e,data:t,name:r}),i=W.uint8Array(n).toBase58Btc();return W.base58Btc(i).toMultibase()}function cu({multibaseKeyId:t}){try{let e=W.multibase(t).toBase58Btc(),r=W.base58Btc(e).toUint8Array(),{code:n,data:i,name:o}=pt.removePrefix({prefixedData:r});return{keyBytes:i,multicodecCode:n,multicodecName:o}}catch{throw new Y("invalidDid",`Invalid multibase identifier: ${t}`)}}var Dt=class t{constructor({uri:e,document:r,metadata:n,keyManager:i}){this.uri=e,this.document=r,this.metadata=n,this.keyManager=i}async export(){if(!(Array.isArray(this.document.verificationMethod)&&this.document.verificationMethod.length>0))throw new Error(`DID document for '${this.uri}' is missing verification methods`);let e={uri:this.uri,document:this.document,metadata:this.metadata};if("exportKey"in this.keyManager&&typeof this.keyManager.exportKey=="function"){let r=[];for(let n of this.document.verificationMethod){if(!n.publicKeyJwk)throw new Error(`Verification method '${n.id}' does not contain a public key in JWK format`);let i=await this.keyManager.getKeyUri({key:n.publicKeyJwk}),o=await this.keyManager.exportKey({keyUri:i});r.push({...o})}e.privateKeys=r}return e}async getSigner(e){let r=this.document.verificationMethod?.find(c=>Bt(c.id)===(Bt(e?.methodId)??Bt(this.document.assertionMethod?.[0])));if(!(r&&r.publicKeyJwk))throw new Y("internalError","A verification method intended for signing could not be determined from the DID Document");let n=await this.keyManager.getKeyUri({key:r.publicKeyJwk}),i=await this.keyManager.getPublicKey({keyUri:n}),o=this.keyManager;return{algorithm:tu.getJoseSignatureAlgorithmFromPublicKey(i),keyId:r.id,async sign({data:c}){return await o.sign({data:c,keyUri:n})},async verify({data:c,signature:a}){return await o.verify({data:c,key:i,signature:a})}}}static async import({portableDid:e,keyManager:r=new mt}){let n=tc({didDocument:e.document});if(n.length===0)throw new Y("invalidDidDocument","At least one verification method is required but 0 were given");for(let o of e.privateKeys??[])await r.importKey({key:o});for(let o of n){if(!o.publicKeyJwk)throw new Error(`Verification method '${o.id}' does not contain a public key in JWK format`);let s=await r.getKeyUri({key:o.publicKeyJwk});await r.getPublicKey({keyUri:s})}return new t({uri:e.uri,document:e.document,metadata:e.metadata,keyManager:r})}};var l3=f(h(),1);var Nk=f(h(),1);var Ik=f(h(),1);var xk=f(h(),1);var dk=f(h(),1);var oh="0123456789abcdef",Ow=[],Rw=[];for(let t=0;t<256;t++)Ow[t]=oh[t>>4&15]+oh[t&15],t<16&&(t<10?Rw[48+t]=t:Rw[87+t]=t);var sh=t=>{let e=t.length,r="",n=0;for(;n{let r=t.length||0;if(!e){let s=r;for(;s--;)e+=t[s].length}let n=new Uint8Array(e),i=e,o=r;for(;o--;)i-=t[o].length,n.set(t[o],i);return n};var fk=f(h()),Cw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",HI=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(rc=0;rce?new TextDecoder(e).decode(t):jI.decode(t),WI=new TextEncoder,rr=t=>WI.encode(t);var Pw=typeof window<"u"?window:self,kw=Pw.crypto||Pw.msCrypto||{},wk=kw.subtle||kw.webkitSubtle;var Sk=f(h(),1);function No(t){let e=t<0?1:0;return t=Math.abs(Number(t||1)),Math.floor(Math.log10(t))+1+e}function au(t){return ArrayBuffer.isView(t)?"arraybufferview":Array.isArray(t)?"array":t instanceof Number?"number":t instanceof Boolean?"boolean":t instanceof Set?"set":t instanceof Map?"map":t instanceof String?"string":t instanceof ArrayBuffer?"arraybuffer":typeof t}function ve(t,e,r){let n=[],i=null;return ve._encode(n,t),i=Uw(n),ve.bytes=i.length,ArrayBuffer.isView(e)?(e.set(i,r),e):i}ve.bytes=-1;ve._floatConversionDetected=!1;ve._encode=function(t,e){if(e!=null)switch(au(e)){case"object":ve.dict(t,e);break;case"map":ve.dictMap(t,e);break;case"array":ve.list(t,e);break;case"set":ve.listSet(t,e);break;case"string":ve.string(t,e);break;case"number":ve.number(t,e);break;case"boolean":ve.number(t,e);break;case"arraybufferview":ve.buffer(t,new Uint8Array(e.buffer,e.byteOffset,e.byteLength));break;case"arraybuffer":ve.buffer(t,new Uint8Array(e));break}};var uu=new Uint8Array([101]),Kw=new Uint8Array([100]),Lw=new Uint8Array([108]);ve.buffer=function(t,e){t.push(rr(e.length+":"),e)};ve.string=function(t,e){t.push(rr(rr(e).byteLength+":"+e))};ve.number=function(t,e){if(Number.isInteger(e))return t.push(rr("i"+BigInt(e)+"e"));let r=2147483648,n=e/r<<0,i=e%r<<0,o=n*r+i;t.push(rr("i"+o+"e")),o!==e&&!ve._floatConversionDetected&&(ve._floatConversionDetected=!0,console.warn('WARNING: Possible data corruption detected with value "'+e+'":','Bencoding only defines support for integers, value was converted to "'+o+'"'),console.trace())};ve.dict=function(t,e){t.push(Kw);let r=0,n,i=Object.keys(e).sort(),o=i.length;for(;r=48){n=n*10+(s-48);continue}if(!(o===e&&s===43)){if(o===e&&s===45){i=-1;continue}if(s===46)break;throw new Error("not a number: buffer["+o+"] = "+s)}}return n*i}function se(t,e,r,n){return t==null||t.length===0?null:(typeof e!="number"&&n==null&&(n=e,e=void 0),typeof r!="number"&&n==null&&(n=r,r=void 0),se.position=0,se.encoding=n||null,se.data=ArrayBuffer.isView(t)?new Uint8Array(t.slice(e,r)):rr(t),se.bytes=se.data.length,se.next())}se.bytes=0;se.position=0;se.data=null;se.encoding=null;se.next=function(){switch(se.data[se.position]){case JI:return se.dictionary();case YI:return se.list();case zI:return se.integer();default:return se.buffer()}};se.find=function(t){let e=se.position,r=se.data.length,n=se.data;for(;enB.test(t),encode(t,e,r){r=~~r,e=e||new Uint8Array(r+4);let n=t.length,i=0;for(let o=0;ot.length>0&&iB.test(t),encode(t,e,r){r=~~r;let n=r+16,i=-1,o=0,s=0,c=!0,a=!1;e=e||new Uint8Array(r+16);for(let d=0;d>8),r=97?u-=87:u>=65?u-=55:(u-=48,s=s*10+u),o=(o<<4)+u)}if(c===!1)a===!0?(r>8),r=i+2;d--)e[d]=e[d-2];e[i]=0,e[i+1]=0,i=r}if(i!==r&&i!==-1)for(r>n-2&&(r=n-2);n>i;)e[--n]=ri?e[--r]:0;else for(;r=56320||(t.charCodeAt(o)&64512)!==56320?e+=3:(n=o,e+=4)}}return e}function qo(t,e,r){let n=t.length;r==null&&(r=0),e===void 0&&(e=new Uint8Array(ph(t)+r));let i=r;for(let o=0;o>6,e[i++]=128|s&63;else if((s&63488)!==55296)e[i++]=224|(s&61440)>>12,e[i++]=128|(s&4032)>>6,e[i++]=128|s&63;else{let c=o+1;if(c===n||s>=56320)e[i++]=239,e[i++]=191,e[i++]=189;else{let a=t.charCodeAt(c);(a&64512)!==56320?(e[i++]=239,e[i++]=191,e[i++]=189):(o=c,s=65536|(s&1023)<<10|a&1023,e[i++]=240|(s&1835008)>>18,e[i++]=128|(s&258048)>>12,e[i++]=128|(s&4032)>>6,e[i++]=128|s&63)}}}return qo.bytes=i-r,e}qo.bytes=0;function Fo(t,e,r){let n="";e==null&&(e=0),r==null&&(r=t.length);for(let i=e;i191&&o<224)s=(o&31)<<6|t[i++]&63;else if(o>239&&o<365){s=((o&7)<<18|(t[i++]&63)<<12|(t[i++]&63)<<6|t[i++]&63)-65536;let c=55296|s>>10&1023;n+=String.fromCharCode(c),s=56320|s&1023}else s=(o&15)<<12|(t[i++]&63)<<6|t[i++]&63;n+=String.fromCharCode(s)}return Fo.bytes=r-e,n}Fo.bytes=0;var Hn=t=>t instanceof Uint8Array;function wn(t){return typeof t=="string"?ph(t):t.byteLength}function lu(t){return t instanceof Uint8Array?t:Array.isArray(t)?new Uint8Array(t):qo(t)}function fu(t,e,r){if(typeof e!="string")throw new Error("unknown input type");return qo(e,t,r),qo.bytes}var ic={},Gw=new Array(255);for(let t=0;t<=15;t+=1){let e=t.toString(16),r=e.toUpperCase();for(let n=0;n<=15;n+=1){let i=n.toString(16),o=i.toUpperCase(),s=t<<4|n,c=`${e}${i}`;Gw[s]=c,ic[c]=s,ic[`${r}${i}`]=s,ic[`${e}${o}`]=s,ic[`${r}${o}`]=s}}function Jw(t,e,r){let n="";for(let i=e;i>>1}function Yw(t,e,r,n){let i=0;for(;rt[e]*fB+t[e+1]*hB+t[e+2]*pB+t[e+3],le=(t,e)=>t[e]<<8|t[e+1],Nr=(t,e,r)=>(e=+e,t[r+3]=e,e=e>>>8,t[r+2]=e,e=e>>>8,t[r+1]=e,e=e>>>8,t[r]=e,r+4),ee=(t,e,r)=>(t[r]=e>>8,t[r+1]=e&255,r+2);function Rt(t,e,r,n,i){return r<0&&(n-=r,r=0),n<0&&(n=0),i<0?new Uint8Array(0):r>=e.length||n>=i?0:yB(t,e,r,n,i)}function yB(t,e,r,n,i){i-n>e.length-r&&(i=n+e.length-r);let o=i-n,s=t.length-n;return o>s&&(o=s),(n!==0||it)}}var J=Be({encode(t,e,r){e||(e=new Uint8Array(J.encodingLength(t))),r||(r=0);let n=r,i=t.replace(/^\.|\.$/gm,"");if(i.length){let o=i.split(".");for(let s=0;s=t.length)throw new Error("Cannot decode name (buffer overflow)");let c=t[e++];if(o+=s?0:1,c===0)break;if(c&192)if((c&192)===192){if(e+1>t.length)throw new Error("Cannot decode name (buffer overflow)");let a=le(t,e-1)-49152;if(a>=n)throw new Error("Cannot decode name (bad pointer)");e=a,n=a,o+=s?0:1,s=!0}else throw new Error("Cannot decode name (bad label)");else{if(e+c>t.length)throw new Error("Cannot decode name (buffer overflow)");if(i+=c+1,i>254)throw new Error("Cannot decode name (name too long)");r.push(Fo(t,e,e+c)),e+=c,o+=s?0:c}}return J.decode.bytes=o,r.length===0?".":r.join(".")},encodingLength(t){return t==="."||t===".."?1:wn(t.replace(/^\.|\.$/gm,""))+2}}),Qe=Be({encode(t,e,r){e||(e=new Uint8Array(Qe.encodingLength(t))),r||(r=0);let n=fu(e,t,r+1);return e[r]=n,Qe.encode.bytes=n+1,e},decode(t,e){e||(e=0);let r=t[e],n=Fo(t,e+1,e+1+r);return Qe.decode.bytes=r+1,n},encodingLength(t){return wn(t)+1}}),Vo=Be({bytes:12,encode(t,e,r){e||(e=new Uint8Array(Vo.encodingLength(t))),r||(r=0);let n=(t.flags||0)&32767,i=t.type==="response"?Xw:gB;return ee(e,t.id||0,r),ee(e,n|i,r+2),ee(e,t.questions.length,r+4),ee(e,t.answers.length,r+6),ee(e,t.authorities.length,r+8),ee(e,t.additionals.length,r+10),e},decode(t,e){if(e||(e=0),t.length<12)throw new Error("Header must be 12 bytes");let r=le(t,e+2);return{id:le(t,e),type:r&Xw?"response":"query",flags:r&32767,flag_qr:(r>>15&1)===1,opcode:Ww(r>>11&15),flag_aa:(r>>10&1)===1,flag_tc:(r>>9&1)===1,flag_rd:(r>>8&1)===1,flag_ra:(r>>7&1)===1,flag_z:(r>>6&1)===1,flag_ad:(r>>5&1)===1,flag_cd:(r>>4&1)===1,rcode:jw(r&15),questions:new Array(le(t,e+4)),answers:new Array(le(t,e+6)),authorities:new Array(le(t,e+8)),additionals:new Array(le(t,e+10))}},encodingLength(){return 12}}),pu=Be({encode(t,e,r){e||(e=new Uint8Array(pu.encodingLength(t))),r||(r=0);let n=t.length;return ee(e,n,r),Rt(t,e,r+2,0,n),pu.encode.bytes=n+2,e},decode(t,e){e||(e=0);let r=le(t,e),n=t.slice(e+2,e+2+r);return pu.decode.bytes=r+2,n},encodingLength(t){return t.length+2}}),yu=Be({encode(t,e,r){return e||(e=new Uint8Array(yu.encodingLength(t))),r||(r=0),J.encode(t,e,r+2),ee(e,J.encode.bytes,r),yu.encode.bytes=J.encode.bytes+2,e},decode(t,e){e||(e=0);let r=le(t,e),n=J.decode(t,e+2);return yu.decode.bytes=r+2,n},encodingLength(t){return J.encodingLength(t)+2}}),mu=Be({encode(t,e,r){e||(e=new Uint8Array(mu.encodingLength(t))),r||(r=0);let n=r;return r+=2,J.encode(t.mname,e,r),r+=J.encode.bytes,J.encode(t.rname,e,r),r+=J.encode.bytes,Nr(e,t.serial||0,r),r+=4,Nr(e,t.refresh||0,r),r+=4,Nr(e,t.retry||0,r),r+=4,Nr(e,t.expire||0,r),r+=4,Nr(e,t.minimum||0,r),r+=4,ee(e,r-n-2,n),mu.encode.bytes=r-n,e},decode(t,e){e||(e=0);let r=e,n={};return e+=2,n.mname=J.decode(t,e),e+=J.decode.bytes,n.rname=J.decode(t,e),e+=J.decode.bytes,n.serial=Mr(t,e),e+=4,n.refresh=Mr(t,e),e+=4,n.retry=Mr(t,e),e+=4,n.expire=Mr(t,e),e+=4,n.minimum=Mr(t,e),e+=4,mu.decode.bytes=e-r,n},encodingLength(t){return 22+J.encodingLength(t.mname)+J.encodingLength(t.rname)}}),gu=Be({encode(t,e,r){Array.isArray(t)||(t=[t]);for(let i=0;i0;){let o=t[e++];if(--n,nnew Uint8Array(t),bn=Be({encode(t,e,r){e||(e=new Uint8Array(bn.encodingLength(t))),r||(r=0);let n=r,i=hh(t.code);if(ee(e,i,r),r+=2,t.data)ee(e,t.data.length,r),r+=2,Rt(t.data,e,r),r+=t.data.length;else switch(i){case 8:{let o=t.sourcePrefixLength||0,s=t.family||Fw(t.ip,Zw),c=Vw(t.ip,Zw),a=Math.ceil(o/8);ee(e,a+4,r),r+=2,ee(e,s,r),r+=2,e[r++]=o,e[r++]=t.scopePrefixLength||0,Rt(c,e,r,0,a),r+=a}break;case 11:t.timeout?(ee(e,2,r),r+=2,ee(e,t.timeout,r),r+=2):(ee(e,0,r),r+=2);break;case 12:{let o=t.length||0;ee(e,o,r),r+=2,e.fill(0,r,r+o),r+=o}break;case 14:{let o=t.tags.length*2;ee(e,o,r),r+=2;for(let s of t.tags)ee(e,s,r),r+=2}break;default:throw new Error(`Unknown roption code: ${t.code}`)}return bn.encode.bytes=r-n,e},decode(t,e){e||(e=0);let r={};r.code=le(t,e),r.type=zw(r.code),e+=2;let n=le(t,e);switch(e+=2,r.data=t.slice(e,e+n),r.code){case 8:r.family=le(t,e),e+=2,r.sourcePrefixLength=t[e++],r.scopePrefixLength=t[e++];{let i=new Uint8Array(r.family===1?4:16);Rt(t,i,0,e,e+n-4),r.ip=Hw(i)}break;case 11:n>0&&(r.timeout=le(t,e),e+=2);break;case 14:r.tags=[];for(let i=0;i0;)n[o++]=bn.decode(t,e),e+=bn.decode.bytes,i-=bn.decode.bytes;return Wn.decode.bytes=e-r,n},encodingLength(t){return 2+jo(t||[],bn)}}),$r=Be({encode(t,e,r){e||(e=new Uint8Array($r.encodingLength(t))),r||(r=0);let n=r,i=t.key;if(!Hn(i))throw new Error("Key must be a Buffer");return r+=2,ee(e,t.flags,r),r+=2,e[r]=$r.PROTOCOL_DNSSEC,r+=1,e[r]=t.algorithm,r+=1,Rt(i,e,r,0,i.length),r+=i.length,$r.encode.bytes=r-n,ee(e,$r.encode.bytes-2,n),e},decode(t,e){e||(e=0);let r=e,n={},i=le(t,e);if(e+=2,n.flags=le(t,e),e+=2,t[e]!==$r.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return e+=1,n.algorithm=t[e],e+=1,n.key=t.slice(e,r+i+2),e+=n.key.length,$r.decode.bytes=e-r,n},encodingLength(t){return 6+wn(t.key)}});$r.PROTOCOL_DNSSEC=3;$r.ZONE_KEY=128;$r.SECURE_ENTRYPOINT=32768;var oc=Be({encode(t,e,r){e||(e=new Uint8Array(oc.encodingLength(t))),r||(r=0);let n=r,i=t.signature;if(!Hn(i))throw new Error("Signature must be a Buffer");return r+=2,ee(e,$o(t.typeCovered),r),r+=2,e[r]=t.algorithm,r+=1,e[r]=t.labels,r+=1,Nr(e,t.originalTTL,r),r+=4,Nr(e,t.expiration,r),r+=4,Nr(e,t.inception,r),r+=4,ee(e,t.keyTag,r),r+=2,J.encode(t.signersName,e,r),r+=J.encode.bytes,Rt(i,e,r,0,i.length),r+=i.length,oc.encode.bytes=r-n,ee(e,oc.encode.bytes-2,n),e},decode(t,e){e||(e=0);let r=e,n={},i=le(t,e);return e+=2,n.typeCovered=nc(le(t,e)),e+=2,n.algorithm=t[e],e+=1,n.labels=t[e],e+=1,n.originalTTL=Mr(t,e),e+=4,n.expiration=Mr(t,e),e+=4,n.inception=Mr(t,e),e+=4,n.keyTag=le(t,e),e+=2,n.signersName=J.decode(t,e),e+=J.decode.bytes,n.signature=t.slice(e,r+i+2),e+=n.signature.length,oc.decode.bytes=e-r,n},encodingLength(t){return 20+J.encodingLength(t.signersName)+wn(t.signature)}}),sc=Be({encode(t,e,r){e||(e=new Uint8Array(sc.encodingLength(t))),r||(r=0);let n=r;return r+=2,J.encode(t.mbox||".",e,r),r+=J.encode.bytes,J.encode(t.txt||".",e,r),r+=J.encode.bytes,sc.encode.bytes=r-n,ee(e,sc.encode.bytes-2,n),e},decode(t,e){e||(e=0);let r=e,n={};return e+=2,n.mbox=J.decode(t,e)||".",e+=J.decode.bytes,n.txt=J.decode(t,e)||".",e+=J.decode.bytes,sc.decode.bytes=e-r,n},encodingLength(t){return 2+J.encodingLength(t.mbox||".")+J.encodingLength(t.txt||".")}}),$t=Be({encode(t,e,r){e||(e=new Uint8Array($t.encodingLength(t))),r||(r=0);let n=r,i=[];for(let o=0;o>8]===void 0&&(i[s>>8]=[]),i[s>>8][s>>3&31]|=1<<7-(s&7)}for(let o=0;o>8]=Math.max(e[i>>8]||0,i&255)}let r=0;for(let n=0;n>15&1)===1,r.options=Wn.decode(t,e+8),e+=8+Wn.decode.bytes;else{let i=le(t,e+2);r.ttl=Mr(t,e+4),r.class=lh(i&wB),r.flush=!!(i&gh);let o=mh(r.type);r.data=o.decode(t,e+8),e+=8+o.decode.bytes}return nr.decode.bytes=e-n,r},encodingLength(t){let e=t.data!==null&&t.data!==void 0?t.data:t.options;return J.encodingLength(t.name)+8+mh(t.type).encodingLength(e)}}),zo=Be({encode(t,e,r){e||(e=new Uint8Array(zo.encodingLength(t))),r||(r=0);let n=r;return J.encode(t.name,e,r),r+=J.encode.bytes,ee(e,$o(t.type),r),r+=2,ee(e,fh(t.class===void 0?"IN":t.class),r),r+=2,zo.encode.bytes=r-n,t},decode(t,e){e||(e=0);let r=e,n={};return n.name=J.decode(t,e),e+=J.decode.bytes,n.type=nc(le(t,e)),e+=2,n.class=lh(le(t,e)),e+=2,!!(n.class&Qw)&&(n.class&=bB),zo.decode.bytes=e-r,n},encodingLength(t){return J.encodingLength(t.name)+4}});var tb=1024;var ft={encode:function(t,e,r){let n=!e;n&&(e=new Uint8Array(xB(t))),r||(r=0);let i=r;return t.questions||(t.questions=[]),t.answers||(t.answers=[]),t.authorities||(t.authorities=[]),t.additionals||(t.additionals=[]),Vo.encode(t,e,r),r+=Vo.encode.bytes,r=dc(t.questions,zo,e,r),r=dc(t.answers,nr,e,r),r=dc(t.authorities,nr,e,r),r=dc(t.additionals,nr,e,r),ft.encode.bytes=r-i,n&&lc.bytes!==e.length?e.slice(0,lc.bytes):e},decode:function(t,e){e||(e=0);let r=e,n=Vo.decode(t,e);return e+=Vo.decode.bytes,e=hu(n.questions,zo,t,e),e=hu(n.answers,nr,t,e),e=hu(n.authorities,nr,t,e),e=hu(n.additionals,nr,t,e),ft.decode.bytes=e-r,n},encodingLength:function(t){return Vo.encodingLength(t)+jo(t.questions||[],zo)+jo(t.answers||[],nr)+jo(t.authorities||[],nr)+jo(t.additionals||[],nr)}};ft.encode.bytes=0;ft.decode.bytes=0;function Su(t,e){if(t.questions)throw new Error("Only one .question object expected instead of a .questions array!");let r=Object.assign({type:e},t);return r.question&&(r.questions=[r.question],delete r.question),r}var Au={encode:function(t,e,r){return e=ft.encode(Su(t,"query"),e,r),Au.encode.bytes=ft.encode.bytes,e},decode:function(t,e){let r=ft.decode(t,e);return Au.decode.bytes=ft.decode.bytes,r.questions&&(r.question=r.questions[0],delete r.questions),r},encodingLength:function(t){return ft.encodingLength(Su(t,"query"))}};Au.encode.bytes=0;Au.decode.bytes=0;var Tu={encode:function(t,e,r){return e=ft.encode(Su(t,"response"),e,r),Tu.encode.bytes=ft.encode.bytes,e},decode:function(t,e){let r=ft.decode(t,e);return Tu.decode.bytes=ft.decode.bytes,r.questions&&(r.question=r.questions[0],delete r.questions),r},encodingLength:function(t){return ft.encodingLength(Su(t,"response"))}};Tu.encode.bytes=0;Tu.decode.bytes=0;var lc=ft.encode,_u=ft.decode,xB=ft.encodingLength;function rb(t){let e=lc(t),r=new Uint8Array(2+e.byteLength);return ee(r,e.byteLength),Rt(e,r,2,0,e.length),rb.bytes=r.byteLength,r}rb.bytes=0;function nb(t){let e=le(t,0);if(t.byteLength(a[a.Discoverable=0]="Discoverable",a[a.Organization=1]="Organization",a[a.Government=2]="Government",a[a.Corporation=3]="Corporation",a[a.LocalBusiness=4]="LocalBusiness",a[a.SoftwarePackage=5]="SoftwarePackage",a[a.WebApp=6]="WebApp",a[a.FinancialInstitution=7]="FinancialInstitution",a))(sb||{}),bh=(i=>(i[i.Ed25519=0]="Ed25519",i[i.secp256k1=1]="secp256k1",i[i.secp256r1=2]="secp256r1",i[i.X25519=3]="X25519",i))(bh||{}),cb=(o=>(o.authentication="auth",o.assertionMethod="asm",o.capabilityDelegation="del",o.capabilityInvocation="inv",o.keyAgreement="agm",o))(cb||{}),ab={Ed25519:0,ES256K:1,ES256:2,"P-256":2,secp256k1:1,secp256r1:2,X25519:3},ob={0:"Ed25519",1:"ES256K",2:"ES256",3:"ECDH-ES+A256KW"},fc=class fc extends ir{static async create({keyManager:e=new mt,options:r={}}={}){if(r.verificationMethods?.some(u=>!(u.algorithm in ab)))throw new Error("One or more verification method algorithms are not supported");let n=r.verificationMethods?.filter(u=>"id"in u).map(u=>u.id);if(n&&n.length!==new Set(n).size)throw new Error("One or more verification method IDs are not unique");if(r.services?.some(u=>!u.id||!u.type||!u.serviceEndpoint))throw new Error("One or more services are missing required properties");let i=await e.generateKey({algorithm:"Ed25519"}),o=await e.getPublicKey({keyUri:i}),s=await it.identityKeyToIdentifier({identityKey:o}),c={id:s,...r.alsoKnownAs&&{alsoKnownAs:r.alsoKnownAs},...r.controllers&&{controller:r.controllers}},a=[...r.verificationMethods??[]];a?.some(u=>u.id?.split("#").pop()==="0")||a.unshift({algorithm:"Ed25519",id:"0",purposes:["authentication","assertionMethod","capabilityDelegation","capabilityInvocation"]});for(let u of a){let l=u.id&&u.id.split("#").pop()==="0"?i:await e.generateKey({algorithm:u.algorithm}),y=await e.getPublicKey({keyUri:l}),g=u.id??y.kid??await ae({jwk:y});g=`${s}#${Bt(g)}`,c.verificationMethod??=[],c.verificationMethod.push({id:g,type:"JsonWebKey",controller:u.controller??s,publicKeyJwk:y});for(let p of u.purposes??[])c[p]||(c[p]=[]),c[p].push(g)}r.services?.forEach(u=>{c.service??=[],u.id=`${s}#${u.id.split("#").pop()}`,c.service.push(u)});let d=new Dt({uri:s,document:c,metadata:{published:!1,...r.types&&{types:r.types}},keyManager:e});if(r.publish??!0){let u=await fc.publish({did:d,gatewayUri:r.gatewayUri});d.metadata=u.didDocumentMetadata}return d}static async import({portableDid:e,keyManager:r=new mt}){if(Le.parse(e.uri)?.method!==fc.methodName)throw new Y("methodNotSupported","Method not supported");let i=await Dt.import({portableDid:e,keyManager:r});if(!i.document.verificationMethod?.some(o=>o.id?.split("#").pop()==="0"))throw new Y("invalidDidDocument","DID document must contain an Identity Key");return i}static async getSigningMethod({didDocument:e,methodId:r="#0"}){let n=Le.parse(e.id);if(n&&n.method!==this.methodName)throw new Y("methodNotSupported",`Method not supported: ${n.method}`);let i=e.verificationMethod?.find(o=>Bt(o.id)===(Bt(r)??Bt(e.assertionMethod?.[0])));if(!(i&&i.publicKeyJwk))throw new Y("internalError","A verification method intended for signing could not be determined from the DID Document");return i}static async publish({did:e,gatewayUri:r=ib}){return await Du.put({did:e,gatewayUri:r})}static async resolve(e,r={}){let n=r?.gatewayUri??ib;try{await it.identifierToIdentityKey({didUri:e});let{didDocument:i,didDocumentMetadata:o}=await Du.get({didUri:e,gatewayUri:n});return{...Ke,didDocument:i,didDocumentMetadata:o}}catch(i){if(!(i instanceof Y))throw new Error(i);return{...Ke,didResolutionMetadata:{error:i.code,...i.message&&{errorMessage:i.message}}}}}};fc.methodName="dht";var Bu=fc,Du=class t{static async get({didUri:e,gatewayUri:r}){let n=it.identifierToIdentityKeyBytes({didUri:e}),i=await t.pkarrGet({gatewayUri:r,publicKeyBytes:n}),o=await it.parseBep44GetMessage({bep44Message:i}),s=await t.fromDnsPacket({didUri:e,dnsPacket:o});return s.didDocumentMetadata.versionId=i.seq.toString(),s}static async put({did:e,gatewayUri:r}){let n=await t.toDnsPacket({didDocument:e.document,didMetadata:e.metadata,authoritativeGatewayUris:[r]}),i=await it.createBep44PutMessage({dnsPacket:n,publicKeyBytes:it.identifierToIdentityKeyBytes({didUri:e.uri}),signer:await e.getSigner({methodId:"0"})}),o=await t.pkarrPut({gatewayUri:r,bep44Message:i});return{didDocument:e.document,didDocumentMetadata:{...e.metadata,published:o,versionId:i.seq.toString()},didRegistrationMetadata:{}}}static async pkarrGet({gatewayUri:e,publicKeyBytes:r}){let n=W.uint8Array(r).toBase32Z(),i=new URL(n,e).href,o;try{if(o=await fetch(i,{method:"GET"}),!o.ok)throw new Y("notFound",`Pkarr record not found for: ${n}`)}catch(a){throw a instanceof Y?a:new Y("internalError",`Failed to fetch Pkarr record: ${a.message}`)}let s=await o.arrayBuffer();if(!s)throw new Y("notFound",`Pkarr record not found for: ${n}`);if(s.byteLength<72)throw new Y("invalidDidDocumentLength",`Pkarr response must be at least 72 bytes but got: ${s.byteLength}`);if(s.byteLength>1072)throw new Y("invalidDidDocumentLength",`Pkarr response exceeds 1000 byte limit: ${s.byteLength}`);return{k:r,seq:Number(new DataView(s).getBigUint64(64)),sig:new Uint8Array(s,0,64),v:new Uint8Array(s,72)}}static async pkarrPut({gatewayUri:e,bep44Message:r}){let n=W.uint8Array(r.k).toBase32Z(),i=new URL(n,e).href,o=new Uint8Array(r.v.length+72);o.set(r.sig,0),new DataView(o.buffer).setBigUint64(r.sig.length,BigInt(r.seq)),o.set(r.v,r.sig.length+8);let s;try{s=await fetch(i,{method:"PUT",headers:{"Content-Type":"application/octet-stream"},body:o})}catch(c){throw new Y("internalError",`Failed to put Pkarr record for identifier ${n}: ${c.message}`)}return s.ok}static async fromDnsPacket({didUri:e,dnsPacket:r}){let n={id:e},i={published:!0},o=new Map;for(let s of r?.answers??[]){if(s.type!=="TXT")continue;let c=s.name.split(".")[0].substring(1);switch(!0){case c.startsWith("aka"):{let a=it.parseTxtDataToString(s.data);n.alsoKnownAs=a.split(xt);break}case c.startsWith("cnt"):{let a=it.parseTxtDataToString(s.data);n.controller=a.includes(xt)?a.split(xt):a;break}case c.startsWith("k"):{let{id:a,t:d,k:u,c:l,a:y}=it.parseTxtDataToObject(s.data),g=W.base64Url(u).toUint8Array(),p=bh[Number(d)],w=await it.keyConverter(p).bytesToPublicKey({publicKeyBytes:g});w.alg=y||ob[Number(d)];let x=c==="k0"?"0":a!==void 0?a:await ae({jwk:w});n.verificationMethod??=[];let S=`${e}#${x}`;n.verificationMethod.push({id:S,type:"JsonWebKey",controller:l??e,publicKeyJwk:w}),o.set(c,S);break}case c.startsWith("s"):{let{id:a,t:d,se:u,...l}=it.parseTxtDataToObject(s.data),y=u.includes(xt)?u.split(xt):[u],g=Object.fromEntries(Object.entries(l).map(([p,w])=>[p,w.includes(xt)?w.split(xt):w]));n.service??=[],n.service.push({...g,id:`${e}#${a}`,type:d,serviceEndpoint:y});break}case c.startsWith("typ"):{let{id:a}=it.parseTxtDataToObject(s.data);i.types=a.split(xt).map(d=>Number(d));break}case c.startsWith("did"):{let a=p=>p.split(xt).map(w=>o.get(w)).filter(w=>typeof w=="string"),{auth:d,asm:u,del:l,inv:y,agm:g}=it.parseTxtDataToObject(s.data);d&&(n.authentication=a(d)),u&&(n.assertionMethod=a(u)),l&&(n.capabilityDelegation=a(l)),y&&(n.capabilityInvocation=a(y)),g&&(n.keyAgreement=a(g));break}}}return{didDocument:n,didDocumentMetadata:i,didResolutionMetadata:{}}}static async toDnsPacket({didDocument:e,didMetadata:r,authoritativeGatewayUris:n,previousDidProof:i}){let o=[],s=[],c=new Map,a=[],d=[];if(i!==void 0){let{signature:y,previousDid:g}=i;await it.validatePreviousDidProof({newDid:e.id,previousDidProof:i}),o.push({type:"TXT",name:"_prv._did.",ttl:zn,data:`id=${g};s=${y}`})}if(e.alsoKnownAs&&o.push({type:"TXT",name:"_aka._did.",ttl:zn,data:e.alsoKnownAs.join(xt)}),e.controller){let y=Array.isArray(e.controller)?e.controller.join(xt):e.controller;o.push({type:"TXT",name:"_cnt._did.",ttl:zn,data:y})}for(let[y,g]of e.verificationMethod?.entries()??[]){let p=`k${y}`;d.push(p);let w=g.id.split("#").pop();c.set(w,p);let x=g.publicKeyJwk;if(!(x?.crv&&x.crv in ab))throw new Y("invalidPublicKeyType",`Verification method '${g.id}' contains an unsupported key type: ${x?.crv??"undefined"}`);let S=bh[x.crv],T=await it.keyConverter(x.crv).publicKeyToBytes({publicKey:x}),E=W.uint8Array(T).toBase64Url(),R=[`t=${S}`,`k=${E}`];w!=="0"&&await ae({jwk:x})!==w&&R.unshift(`id=${w}`),x.alg!==ob[S]&&R.push(`a=${x.alg}`),g.controller!==e.id&&R.push(`c=${g.controller}`),o.push({type:"TXT",name:`_${p}._did.`,ttl:zn,data:R.join(Iu)})}e.service?.forEach((y,g)=>{let p=`s${g}`;a.push(p);let{id:w,type:x,serviceEndpoint:S,...T}=y;w=Bt(w),S=Array.isArray(S)?S.join(","):S;let R=Object.entries({id:w,t:x,se:S,...T}).map(([O,k])=>`${O}=${k}`).join(Iu),D=it.chunkDataIfNeeded(R);o.push({type:"TXT",name:`_${p}._did.`,ttl:zn,data:D})});let u=[`v=${EB}`];if(d.length&&u.push(`vm=${d.join(xt)}`),Object.keys(no).forEach(y=>{let g=e[y]?.map(p=>c.get(p.split("#").pop()));if(g){let p=cb[y];u.push(`${p}=${g.join(xt)}`)}}),a.length&&u.push(`svc=${a.join(xt)}`),r.types?.length){let g=r.types.map(p=>typeof p=="string"?sb[p]:p);o.push({type:"TXT",name:"_typ._did.",ttl:zn,data:`id=${g.join(xt)}`})}o.push({type:"TXT",name:"_did."+t.getUniqueDidSuffix(e.id)+".",ttl:zn,data:u.join(Iu)});for(let y of n||[])s.push({type:"NS",name:"_did."+t.getUniqueDidSuffix(e.id)+".",ttl:zn,data:y+"."});return{id:0,type:"response",flags:tb,answers:[...o,...s]}}static getUniqueDidSuffix(e){return e.split(":")[2]}},it=class t{static async createBep44PutMessage({dnsPacket:e,publicKeyBytes:r,signer:n}){let i=Math.ceil(Date.now()/1e3),o=lc(e),s=dh.encode({seq:i,v:o}).subarray(1,-1);if(s.length>1e3)throw new Y("invalidDidDocumentLength",`DNS packet exceeds the 1000 byte maximum size: ${s.length} bytes`);let c=await n.sign({data:s});return{k:r,seq:i,sig:c,v:o}}static async identifierToIdentityKey({didUri:e}){let r=t.identifierToIdentityKeyBytes({didUri:e});return await Ze.bytesToPublicKey({publicKeyBytes:r})}static identifierToIdentityKeyBytes({didUri:e}){let r=Le.parse(e);if(!r)throw new Y("invalidDid",`Invalid DID URI: ${e}`);if(r.method!==Bu.methodName)throw new Y("methodNotSupported",`Method not supported: ${r.method}`);let n;try{n=W.base32Z(r.id).toUint8Array()}catch{throw new Y("invalidPublicKey","Failed to decode method-specific identifier")}if(n.length!==32)throw new Y("invalidPublicKeyLength",`Invalid public key length: ${n.length}`);return n}static async identityKeyToIdentifier({identityKey:e}){let r=await Ze.publicKeyToBytes({publicKey:e}),n=W.uint8Array(r).toBase32Z();return`did:${Bu.methodName}:${n}`}static keyConverter(e){let n={Ed25519:Ze,"P-256":{publicKeyToBytes:async({publicKey:i})=>{let o=await dt.publicKeyToBytes({publicKey:i});return await dt.compressPublicKey({publicKeyBytes:o})},bytesToPublicKey:dt.bytesToPublicKey,privateKeyToBytes:dt.privateKeyToBytes,bytesToPrivateKey:dt.bytesToPrivateKey},secp256k1:{publicKeyToBytes:async({publicKey:i})=>{let o=await nt.publicKeyToBytes({publicKey:i});return await nt.compressPublicKey({publicKeyBytes:o})},bytesToPublicKey:nt.bytesToPublicKey,privateKeyToBytes:nt.privateKeyToBytes,bytesToPrivateKey:nt.bytesToPrivateKey},X25519:Mo}[e];if(!n)throw new Y("invalidPublicKeyType",`Unsupported curve: ${e}`);return n}static async parseBep44GetMessage({bep44Message:e}){let r=await Ze.bytesToPublicKey({publicKeyBytes:e.k}),n=dh.encode({seq:e.seq,v:e.v}).subarray(1,-1);if(!await Ze.verify({key:r,signature:e.sig,data:n}))throw new Y("invalidSignature","Invalid signature for DHT BEP44 message");return _u(e.v)}static parseTxtDataToObject(e){return this.parseTxtDataToString(e).split(Iu).reduce((r,n)=>{let[i,o]=n.split("=");return r[i]=o,r},{})}static parseTxtDataToString(e){if(typeof e=="string")return e;if(e instanceof Uint8Array)return W.uint8Array(e).toString();if(Array.isArray(e))return e.map(r=>this.parseTxtDataToString(r)).join("");throw new Y("internalError","Pkarr returned DNS TXT record with invalid data type")}static async validatePreviousDidProof({newDid:e,previousDidProof:r}){let n=await t.identifierToIdentityKey({didUri:r.previousDid}),i=t.identifierToIdentityKeyBytes({didUri:e}),o=W.base64Url(r.signature).toUint8Array();if(!await Ze.verify({key:n,data:i,signature:o}))throw new Y("invalidPreviousDidProof","The previous DID proof is invalid.")}static chunkDataIfNeeded(e){if(e.length<=255)return e;let r=[];for(let n=0;n{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 E3=f(h(),1);var Eh=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")}},vh=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 ub(this,e)}},Sh=class{constructor(e){this.decoders=e}or(e){return ub(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`)}},ub=(t,e)=>new Sh({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),Ah=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Eh(e,r,n),this.decoder=new vh(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},vB=({name:t,prefix:e,encode:r,decode:n})=>new Ah(t,e,r,n);var SB=(t,e,r,n)=>{let i={};for(let u=0;u=8&&(c-=8,s[d++]=255&a>>c)}if(c>=r||255&a<<8-c)throw new SyntaxError("Unexpected end of data");return s},AB=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)s-=r,o+=e[i&c>>s];if(s&&(o+=e[i&c<vB({prefix:e,name:t,encode(i){return AB(i,n,r)},decode(i){return SB(i,n,r,t)}});var D3=hc({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),R3=hc({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),pc=hc({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),O3=hc({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ot=class t{static encode(e){return pc.baseEncode(e)}static decodeAsBytes(e,r){if(!t.isBase64UrlString(e))throw new _e(Oe.EncodedStringIncorrectEncoding,`Given ${r} must be base64url string.`);return pc.baseDecode(e)}static decodeAsString(e,r){let n=t.decodeAsBytes(e,r);return t.bytesToString(n)}static isBase64UrlString(e){return/^[A-Za-z0-9_-]+$/.test(e)}static stringToBytes(e){return new TextEncoder().encode(e)}static bytesToString(e){return new TextDecoder().decode(e)}};var LK=f(h(),1),xb=f(lb(),1);var z3=f(h(),1);var q3=f(h(),1),Th;(function(t){t.Public="public",t.Private="private"})(Th||(Th={}));var qt=Th;var et=class{static validateEs256kOperationKey(e,r){let n=new Set(["kty","crv","x","y"]);r===qt.Private&&n.add("d");for(let i in e)if(!n.has(i))throw new _e(Oe.PublicKeyJwkEs256kHasUnexpectedProperty,`SECP256K1 JWK key has unexpected property '${i}'.`);if(e.crv!=="secp256k1")throw new _e(Oe.JwkEs256kMissingOrInvalidCrv,`SECP256K1 JWK 'crv' property must be 'secp256k1' but got '${e.crv}.'`);if(e.kty!=="EC")throw new _e(Oe.JwkEs256kMissingOrInvalidKty,`SECP256K1 JWK 'kty' property must be 'EC' but got '${e.kty}.'`);if(e.x.length!==43)throw new _e(Oe.JwkEs256kHasIncorrectLengthOfX,"SECP256K1 JWK 'x' property must be 43 bytes.");if(e.y.length!==43)throw new _e(Oe.JwkEs256kHasIncorrectLengthOfY,"SECP256K1 JWK 'y' property must be 43 bytes.");if(r===qt.Private&&(e.d===void 0||e.d.length!==43))throw new _e(Oe.JwkEs256kHasIncorrectLengthOfD,"SECP256K1 JWK 'd' property must be 43 bytes.")}static validateId(e){if(e.length>50)throw new _e(Oe.IdTooLong,`Key ID length ${e.length} exceed max allowed length of 50.`);if(!Ot.isBase64UrlString(e))throw new _e(Oe.IdNotUsingBase64UrlCharacterSet,`Key ID '${e}' is not a Base64URL string.`)}static validatePublicKeyPurposes(e){if(e===void 0)return;let r=new Set;for(let n of e){if(r.has(n))throw new _e(Oe.PublicKeyPurposeDuplicated,`Public key purpose '${n}' already specified.`);r.add(n)}}};var J3=f(h(),1),yc=class{};yc.hashAlgorithmInMultihashCode=18;yc.maxCanonicalizedDeltaSizeInBytes=1e3;var Et=yc;var eK=f(h(),1),pb=f(hb(),1);var yr=class t{static canonicalizeAsBytes(e){let r=t.removeAllUndefinedProperties(e),n=pb.default(r);return Ot.stringToBytes(n)}static removeAllUndefinedProperties(e){for(let r in e)typeof e[r]=="object"?t.removeAllUndefinedProperties(e[r]):e[r]===void 0&&delete e[r];return e}};var vK=f(h(),1);var cK=f(h(),1);var iK=f(h(),1);var rK=f(h(),1),TB=gb,yb=128,_B=127,IB=~_B,BB=Math.pow(2,31);function gb(t,e,r){e=e||[],r=r||0;for(var n=r;t>=BB;)e[r++]=t&255|yb,t/=128;for(;t&IB;)e[r++]=t&255|yb,t>>>=7;return e[r]=t|0,gb.bytes=r-n+1,e}var DB=_h,RB=128,mb=127;function _h(t,n){var r=0,n=n||0,i=0,o=n,s,c=t.length;do{if(o>=c)throw _h.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&mb)<=RB);return _h.bytes=o-n,r}var OB=Math.pow(2,7),UB=Math.pow(2,14),CB=Math.pow(2,21),PB=Math.pow(2,28),kB=Math.pow(2,35),KB=Math.pow(2,42),LB=Math.pow(2,49),MB=Math.pow(2,56),NB=Math.pow(2,63),$B=function(t){return t[mc.decode(t,e),mc.decode.bytes],Bh=(t,e,r=0)=>(mc.encode(t,e,r),e),Dh=t=>mc.encodingLength(t);var Rh=(t,e)=>{let r=e.byteLength,n=Dh(t),i=n+Dh(r),o=new Uint8Array(i+r);return Bh(t,o,0),Bh(r,o,n),o.set(e,i),new Ou(t,r,e,o)},wb=t=>{let e=xh(t),[r,n]=Ih(e),[i,o]=Ih(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Ou(r,i,s,e)};var Ou=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var hK=f(h(),1);var uK=f(h(),1);var Uh=({name:t,code:e,encode:r})=>new Oh(t,e,r),Oh=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?Rh(this.code,r):r.then(n=>Rh(this.code,n))}else throw Error("Unknown type, must be binary type")}};var bb=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Uu=Uh({name:"sha2-256",code:18,encode:bb("SHA-256")}),lK=Uh({name:"sha2-512",code:19,encode:bb("SHA-512")});var gc=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{d(n.next(u))}catch(l){s(l)}}function a(u){try{d(n.throw(u))}catch(l){s(l)}}function d(u){u.done?o(u.value):i(u.value).then(c,a)}d((n=n.apply(t,e||[])).next())})},ot=class t{static hash(e,r){return gc(this,void 0,void 0,function*(){let n;switch(r){case 18:n=(yield Uu.digest(e)).bytes;break;default:throw new _e(Oe.MultihashUnsupportedHashAlgorithm,`Hash algorithm defined in multihash code ${r} is not supported.`)}return n})}static hashAsNonMultihashBytes(e,r){return gc(this,void 0,void 0,function*(){let n;switch(r){case 18:n=yield Uu.encode(e);break;default:throw new _e(Oe.MultihashUnsupportedHashAlgorithm,`Hash algorithm defined in multihash code ${r} is not supported.`)}return n})}static canonicalizeThenHashThenEncode(e,r){return gc(this,void 0,void 0,function*(){let n=yr.canonicalizeAsBytes(e);return yield t.hashThenEncode(n,r)})}static canonicalizeThenDoubleHashThenEncode(e,r){return gc(this,void 0,void 0,function*(){let n=yr.canonicalizeAsBytes(e),i=yield t.hashAsNonMultihashBytes(n,r);return yield t.hashThenEncode(i,r)})}static hashThenEncode(e,r){return gc(this,void 0,void 0,function*(){let n=yield t.hash(e,r);return Ot.encode(n)})}static validateEncodedHashComputedUsingSupportedHashAlgorithm(e,r){let n,i=Ot.decodeAsBytes(e,r);try{n=wb(i)}catch{throw new _e(Oe.MultihashStringNotAMultihash,`Given ${r} string '${e}' is not a multihash after decoding.`)}let o=Et.hashAlgorithmInMultihashCode;if(o!==n.code)throw new _e(Oe.MultihashUnsupportedHashAlgorithm,`Given ${r} uses unsupported multihash algorithm with code ${n.code}, should use ${o} or change IonSdkConfig to desired hashing algorithm.`)}};var AK=f(h(),1),Ch;(function(t){t.Create="create",t.Update="update",t.Deactivate="deactivate",t.Recover="recover"})(Ch||(Ch={}));var wc=Ch;var _K=f(h(),1),Ph;(function(t){t.Replace="replace",t.AddPublicKeys="add-public-keys",t.RemovePublicKeys="remove-public-keys",t.AddServices="add-services",t.RemoveServices="remove-services"})(Ph||(Ph={}));var Mi=Ph;var Cu=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{d(n.next(u))}catch(l){s(l)}}function a(u){try{d(n.throw(u))}catch(l){s(l)}}function d(u){u.done?o(u.value):i(u.value).then(c,a)}d((n=n.apply(t,e||[])).next())})},Gn=class t{static createCreateRequest(e){return Cu(this,void 0,void 0,function*(){let r=e.recoveryKey,n=e.updateKey,i=e.document.publicKeys,o=e.document.services;et.validateEs256kOperationKey(r,qt.Public),et.validateEs256kOperationKey(n,qt.Public),t.validateDidDocumentKeys(i),t.validateServices(o);let s=Et.hashAlgorithmInMultihashCode,c=[{action:Mi.Replace,document:e.document}],a={updateCommitment:yield ot.canonicalizeThenDoubleHashThenEncode(n,s),patches:c};t.validateDeltaSize(a);let u={deltaHash:yield ot.canonicalizeThenHashThenEncode(a,s),recoveryCommitment:yield ot.canonicalizeThenDoubleHashThenEncode(r,s)};return{type:wc.Create,suffixData:u,delta:a}})}static createDeactivateRequest(e){return Cu(this,void 0,void 0,function*(){t.validateDidSuffix(e.didSuffix),et.validateEs256kOperationKey(e.recoveryPublicKey,qt.Public);let r=Et.hashAlgorithmInMultihashCode,n=yield ot.canonicalizeThenHashThenEncode(e.recoveryPublicKey,r),i={didSuffix:e.didSuffix,recoveryKey:e.recoveryPublicKey},o=yield e.signer.sign({alg:"ES256K"},i);return{type:wc.Deactivate,didSuffix:e.didSuffix,revealValue:n,signedData:o}})}static createRecoverRequest(e){return Cu(this,void 0,void 0,function*(){t.validateDidSuffix(e.didSuffix),et.validateEs256kOperationKey(e.recoveryPublicKey,qt.Public),et.validateEs256kOperationKey(e.nextRecoveryPublicKey,qt.Public),et.validateEs256kOperationKey(e.nextUpdatePublicKey,qt.Public),t.validateDidDocumentKeys(e.document.publicKeys),t.validateServices(e.document.services);let r=Et.hashAlgorithmInMultihashCode,n=yield ot.canonicalizeThenHashThenEncode(e.recoveryPublicKey,r),i=[{action:Mi.Replace,document:e.document}],o=yield ot.canonicalizeThenDoubleHashThenEncode(e.nextUpdatePublicKey,r),s={patches:i,updateCommitment:o},c=yield ot.canonicalizeThenHashThenEncode(s,r),d={recoveryCommitment:yield ot.canonicalizeThenDoubleHashThenEncode(e.nextRecoveryPublicKey,r),recoveryKey:e.recoveryPublicKey,deltaHash:c},u=yield e.signer.sign({alg:"ES256K"},d);return{type:wc.Recover,didSuffix:e.didSuffix,revealValue:n,delta:s,signedData:u}})}static createUpdateRequest(e){return Cu(this,void 0,void 0,function*(){if(t.validateDidSuffix(e.didSuffix),et.validateEs256kOperationKey(e.updatePublicKey,qt.Public),et.validateEs256kOperationKey(e.nextUpdatePublicKey,qt.Public),t.validateServices(e.servicesToAdd),t.validateDidDocumentKeys(e.publicKeysToAdd),e.idsOfServicesToRemove!==void 0)for(let p of e.idsOfServicesToRemove)et.validateId(p);if(e.idsOfPublicKeysToRemove!==void 0)for(let p of e.idsOfPublicKeysToRemove)et.validateId(p);let r=[],n=e.servicesToAdd;if(n!==void 0&&n.length>0){let p={action:Mi.AddServices,services:n};r.push(p)}let i=e.idsOfServicesToRemove;if(i!==void 0&&i.length>0){let p={action:Mi.RemoveServices,ids:i};r.push(p)}let o=e.publicKeysToAdd;if(o!==void 0&&o.length>0){let p={action:Mi.AddPublicKeys,publicKeys:o};r.push(p)}let s=e.idsOfPublicKeysToRemove;if(s!==void 0&&s.length>0){let p={action:Mi.RemovePublicKeys,ids:s};r.push(p)}let c=Et.hashAlgorithmInMultihashCode,a=yield ot.canonicalizeThenHashThenEncode(e.updatePublicKey,c),d=yield ot.canonicalizeThenDoubleHashThenEncode(e.nextUpdatePublicKey,c),u={patches:r,updateCommitment:d},l=yield ot.canonicalizeThenHashThenEncode(u,c),y={updateKey:e.updatePublicKey,deltaHash:l},g=yield e.signer.sign({alg:"ES256K"},y);return{type:wc.Update,didSuffix:e.didSuffix,revealValue:a,delta:u,signedData:g}})}static validateDidSuffix(e){ot.validateEncodedHashComputedUsingSupportedHashAlgorithm(e,"didSuffix")}static validateDidDocumentKeys(e){if(e===void 0)return;let r=new Set;for(let n of e){if(Array.isArray(n.publicKeyJwk))throw new _e(Oe.DidDocumentPublicKeyMissingOrIncorrectType,"DID Document key 'publicKeyJwk' property is not a non-array object.");if(et.validateId(n.id),r.has(n.id))throw new _e(Oe.DidDocumentPublicKeyIdDuplicated,`DID Document key with ID '${n.id}' already exists.`);r.add(n.id),et.validatePublicKeyPurposes(n.purposes)}}static validateServices(e){if(e!==void 0&&e.length!==0){let r=new Set;for(let n of e){if(t.validateService(n),r.has(n.id))throw new _e(Oe.DidDocumentServiceIdDuplicated,"Service id has to be unique");r.add(n.id)}}}static validateService(e){et.validateId(e.id);let r=30;if(e.type.length>r){let n=`Service endpoint type length ${e.type.length} exceeds max allowed length of ${r}.`;throw new _e(Oe.ServiceTypeTooLong,n)}if(Array.isArray(e.serviceEndpoint)){let n="Service endpoint value cannot be an array.";throw new _e(Oe.ServiceEndpointCannotBeAnArray,n)}if(typeof e.serviceEndpoint=="string"&&xb.parse(e.serviceEndpoint).error!==void 0)throw new _e(Oe.ServiceEndpointStringNotValidUri,`Service endpoint string '${e.serviceEndpoint}' is not a URI.`)}static validateDeltaSize(e){let r=yr.canonicalizeAsBytes(e);if(r.length>Et.maxCanonicalizedDeltaSizeInBytes){let n=`Delta of ${r.length} bytes exceeded limit of ${Et.maxCanonicalizedDeltaSizeInBytes} bytes.`;throw new _e(Oe.DeltaExceedsMaximumSize,n)}}};var Eb=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{d(n.next(u))}catch(l){s(l)}}function a(u){try{d(n.throw(u))}catch(l){s(l)}}function d(u){u.done?o(u.value):i(u.value).then(c,a)}d((n=n.apply(t,e||[])).next())})},Go=class t{static createLongFormDid(e){return Eb(this,void 0,void 0,function*(){let r=yield Gn.createCreateRequest(e),n=yield t.computeDidUniqueSuffix(r.suffixData),i;Et.network===void 0||Et.network==="mainnet"?i=`did:ion:${n}`:i=`did:ion:${Et.network}:${n}`;let o={suffixData:r.suffixData,delta:r.delta},s=yr.canonicalizeAsBytes(o),c=Ot.encode(s);return`${i}:${c}`})}static computeDidUniqueSuffix(e){return Eb(this,void 0,void 0,function*(){let r=yr.canonicalizeAsBytes(e),n=yield ot.hash(r,Et.hashAlgorithmInMultihashCode);return Ot.encode(n)})}};var eL=f(h(),1);var jK=f(h(),1);var ht=2n**255n-19n,ku=2n**252n+27742317777372353535851937790883648493n,Kh=0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Lh=0x6666666666666666666666666666666666666666666666666666666666666658n,Pu={a:-1n,d:37095705934669439343138083508754565189542113879843219016388785533085940283555n,p:ht,n:ku,h:8,Gx:Kh,Gy:Lh},Ut=(t="")=>{throw new Error(t)},Ib=t=>typeof t=="string",Mh=(t,e)=>!(t instanceof Uint8Array)||typeof e=="number"&&e>0&&t.length!==e?Ut("Uint8Array expected"):t,Jo=t=>new Uint8Array(t),jB=(t,e)=>Mh(Ib(t)?$h(t):Jo(t),e),ie=(t,e=ht)=>{let r=t%e;return r>=0n?r:e+r},vb=t=>t instanceof Jn?t:Ut("Point expected"),Sb,Jn=class t{constructor(e,r,n,i){this.ex=e,this.ey=r,this.ez=n,this.et=i}static fromAffine(e){return new t(e.x,e.y,1n,ie(e.x*e.y))}static fromHex(e,r=!0){let{d:n}=Pu;e=jB(e,32);let i=e.slice();i[31]=e[31]&-129;let o=zB(i);o===0n||(r&&!(0n0n;o=o.double(),e>>=1n)e&1n?n=n.add(o):r&&(i=i.add(o));return n}multiply(e){return this.mul(e)}clearCofactor(){return this.mul(BigInt(Pu.h),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let e=this.mul(ku/2n,!1).double();return ku%2n&&(e=e.add(this)),e.is0()}toAffine(){let{ex:e,ey:r,ez:n}=this;if(this.is0())return{x:0n,y:0n};let i=Db(n);return ie(n*i)!==1n&&Ut("invalid inverse"),{x:ie(e*i),y:ie(r*i)}}toRawBytes(){let{x:e,y:r}=this.toAffine(),n=WB(r);return n[31]|=e&1n?128:0,n}toHex(){return Nh(this.toRawBytes())}};Jn.BASE=new Jn(Kh,Lh,1n,ie(Kh*Lh));Jn.ZERO=new Jn(0n,1n,1n,0n);var{BASE:Lu,ZERO:Ku}=Jn,Bb=(t,e)=>t.toString(16).padStart(e,"0"),Nh=t=>Array.from(t).map(e=>Bb(e,2)).join(""),$h=t=>{let e=t.length;(!Ib(t)||e%2)&&Ut("hex invalid 1");let r=Jo(e/2);for(let n=0;n$h(Bb(t,32*2)).reverse(),zB=t=>BigInt("0x"+Nh(Jo(Mh(t)).reverse())),Ab=(...t)=>{let e=Jo(t.reduce((n,i)=>n+Mh(i).length,0)),r=0;return t.forEach(n=>{e.set(n,r),r+=n.length}),e},Db=(t,e=ht)=>{(t===0n||e<=0n)&&Ut("no inverse n="+t+" mod="+e);let r=ie(t,e),n=e,i=0n,o=1n,s=1n,c=0n;for(;r!==0n;){let a=n/r,d=n%r,u=i-s*a,l=o-c*a;n=r,r=d,i=s,o=c,s=u,c=l}return n===1n?ie(i,e):Ut("no inverse")},qr=(t,e)=>{let r=t;for(;e-- >0n;)r*=r,r%=ht;return r},GB=t=>{let r=t*t%ht*t%ht,n=qr(r,2n)*r%ht,i=qr(n,1n)*t%ht,o=qr(i,5n)*i%ht,s=qr(o,10n)*o%ht,c=qr(s,20n)*s%ht,a=qr(c,40n)*c%ht,d=qr(a,80n)*a%ht,u=qr(d,80n)*a%ht,l=qr(u,10n)*o%ht;return{pow_p_5_8:qr(l,2n)*t%ht,b2:r}},Tb=19681161376707505956807079304988542015446066515923890162744021073123829784752n,JB=(t,e)=>{let r=ie(e*e*e),n=ie(r*r*e),i=GB(t*n).pow_p_5_8,o=ie(t*r*i),s=ie(e*o*o),c=o,a=ie(o*Tb),d=s===t,u=s===ie(-t),l=s===ie(-t*Tb);return d&&(o=c),(u||l)&&(o=a),(ie(o)&1n)===1n&&(o=ie(-o)),{isValid:d||u,value:o}};var kh;var _b=()=>typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,Rb={bytesToHex:Nh,hexToBytes:$h,concatBytes:Ab,mod:ie,invert:Db,randomBytes:t=>{let e=_b();return e||Ut("crypto.getRandomValues must be defined"),e.getRandomValues(Jo(t))},sha512Async:async(...t)=>{let e=_b();e||Ut("crypto.subtle or etc.sha512Async must be defined");let r=Ab(...t);return Jo(await e.subtle.digest("SHA-512",r.buffer))},sha512Sync:void 0};Object.defineProperties(Rb,{sha512Sync:{configurable:!1,get(){return kh},set(t){kh||(kh=t)}}});var Ni=8,YB=()=>{let t=[],e=256/Ni+1,r=Lu,n=r;for(let i=0;i{let e=Sb||(Sb=YB()),r=(u,l)=>{let y=l.negate();return u?y:l},n=Ku,i=Lu,o=1+256/Ni,s=2**(Ni-1),c=BigInt(2**Ni-1),a=2**Ni,d=BigInt(Ni);for(let u=0;u>=d,y>s&&(y-=a,t+=1n);let g=l,p=l+Math.abs(y)-1,w=u%2!==0,x=y<0;y===0?i=i.add(r(w,e[g])):n=n.add(r(x,e[p]))}return{p:n,f:i}};var WK=f(h(),1);var Fh=2n**256n,qi=Fh-0x1000003d1n,Vh=Fh-0x14551231950b75fc4402da1732fc9bebfn,Mb=0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n,Nb=0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n,$b={p:qi,n:Vh,a:0n,b:7n,Gx:Mb,Gy:Nb},Yo=32,Ob=t=>Z(Z(t*t)*t+$b.b),st=(t="")=>{throw new Error(t)},$u=t=>typeof t=="bigint",qb=t=>typeof t=="string",qh=t=>$u(t)&&0n$u(t)&&0n!(t instanceof Uint8Array)||typeof e=="number"&&e>0&&t.length!==e?st("Uint8Array expected"):t,xc=t=>new Uint8Array(t),Hh=(t,e)=>Vb(qb(t)?qu(t):xc(t),e),Z=(t,e=qi)=>{let r=t%e;return r>=0n?r:e+r},Ub=t=>t instanceof xn?t:st("Point expected"),Cb,xn=class t{constructor(e,r,n){this.px=e,this.py=r,this.pz=n}static fromAffine(e){return new t(e.x,e.y,1n)}static fromHex(e){e=Hh(e);let r,n=e[0],i=e.subarray(1),o=Pb(i,0,Yo),s=e.length;if(s===33&&[2,3].includes(n)){qh(o)||st("Point hex invalid: x not FE");let c=QB(Ob(o)),a=(c&1n)===1n;(n&1)===1!==a&&(c=Z(-c)),r=new t(o,c,1n)}return s===65&&n===4&&(r=new t(o,Pb(i,Yo,2*Yo),1n)),r?r.ok():st("Point is not on curve")}static fromPrivateKey(e){return bc.mul(e6(e))}get x(){return this.aff().x}get y(){return this.aff().y}equals(e){let{px:r,py:n,pz:i}=this,{px:o,py:s,pz:c}=Ub(e),a=Z(r*c),d=Z(o*i),u=Z(n*c),l=Z(s*i);return a===d&&u===l}negate(){return new t(this.px,Z(-this.py),this.pz)}double(){return this.add(this)}add(e){let{px:r,py:n,pz:i}=this,{px:o,py:s,pz:c}=Ub(e),{a,b:d}=$b,u=0n,l=0n,y=0n,g=Z(d*3n),p=Z(r*o),w=Z(n*s),x=Z(i*c),S=Z(r+n),T=Z(o+s);S=Z(S*T),T=Z(p+w),S=Z(S-T),T=Z(r+i);let E=Z(o+c);return T=Z(T*E),E=Z(p+x),T=Z(T-E),E=Z(n+i),u=Z(s+c),E=Z(E*u),u=Z(w+x),E=Z(E-u),y=Z(a*T),u=Z(g*x),y=Z(u+y),u=Z(w-y),y=Z(w+y),l=Z(u*y),w=Z(p+p),w=Z(w+p),x=Z(a*x),T=Z(g*T),w=Z(w+x),x=Z(p-x),x=Z(a*x),T=Z(T+x),p=Z(w*T),l=Z(l+p),p=Z(E*T),u=Z(S*u),u=Z(u-p),p=Z(S*w),y=Z(E*y),y=Z(y+p),new t(u,l,y)}mul(e,r=!0){if(!r&&e===0n)return Mu;if(Fb(e)||st("invalid scalar"),this.equals(bc))return n6(e).p;let n=Mu,i=bc;for(let o=this;e>0n;o=o.double(),e>>=1n)e&1n?n=n.add(o):r&&(i=i.add(o));return n}mulAddQUns(e,r,n){return this.mul(r,!1).add(e.mul(n,!1)).ok()}toAffine(){let{px:e,py:r,pz:n}=this;if(this.equals(Mu))return{x:0n,y:0n};if(n===1n)return{x:e,y:r};let i=jb(n);return Z(n*i)!==1n&&st("invalid inverse"),{x:Z(e*i),y:Z(r*i)}}assertValidity(){let{x:e,y:r}=this.aff();return(!qh(e)||!qh(r))&&st("Point invalid: x or y"),Z(r*r)===Ob(e)?this:st("Point invalid: not on curve")}multiply(e){return this.mul(e)}aff(){return this.toAffine()}ok(){return this.assertValidity()}toHex(e=!0){let{x:r,y:n}=this.aff();return(e?(n&1n)===0n?"02":"03":"04")+kb(r)+(e?"":kb(n))}toRawBytes(e=!0){return qu(this.toHex(e))}};xn.BASE=new xn(Mb,Nb,1n);xn.ZERO=new xn(0n,1n,0n);var{BASE:bc,ZERO:Mu}=xn,Hb=(t,e)=>t.toString(16).padStart(e,"0"),jh=t=>Array.from(t).map(e=>Hb(e,2)).join(""),qu=t=>{let e=t.length;(!qb(t)||e%2)&&st("hex invalid 1");let r=xc(e/2);for(let n=0;nBigInt("0x"+(jh(t)||"0")),Pb=(t,e,r)=>Fu(t.slice(e,r)),Wh=t=>$u(t)&&t>=0n&&tjh(Wh(t)),Kb=(...t)=>{let e=xc(t.reduce((n,i)=>n+Vb(i).length,0)),r=0;return t.forEach(n=>{e.set(n,r),r+=n.length}),e},jb=(t,e=qi)=>{(t===0n||e<=0n)&&st("no inverse n="+t+" mod="+e);let r=Z(t,e),n=e,i=0n,o=1n,s=1n,c=0n;for(;r!==0n;){let a=n/r,d=n%r,u=i-s*a,l=o-c*a;n=r,r=d,i=s,o=c,s=u,c=l}return n===1n?Z(i,e):st("no inverse")},QB=t=>{let e=1n;for(let r=t,n=(qi+1n)/4n;n>0n;n>>=1n)n&1n&&(e=e*r%qi),r=r*r%qi;return Z(e*e)===t?e:st("sqrt invalid")},e6=t=>($u(t)||(t=Fu(Hh(t,Yo))),Fb(t)?t:st("private key out of range"));var Lb=()=>typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,Nu;function t6(t){t=Hh(t);let e=Yo+8;(t.length1024)&&st("expected proper params");let r=Z(Fu(t),Vh-1n)+1n;return Wh(r)}var Wb={hexToBytes:qu,bytesToHex:jh,concatBytes:Kb,bytesToNumberBE:Fu,numberToBytesBE:Wh,mod:Z,invert:jb,hmacSha256Async:async(t,...e)=>{let r=Lb();if(!r)return st("etc.hmacSha256Async not set");let n=r.subtle,i=await n.importKey("raw",t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return xc(await n.sign("HMAC",i,Kb(...e)))},hmacSha256Sync:Nu,hashToPrivateKey:t6,randomBytes:t=>{let e=Lb();return e||st("crypto.getRandomValues must be defined"),e.getRandomValues(xc(t))}};Object.defineProperties(Wb,{hmacSha256Sync:{configurable:!1,get(){return Nu},set(t){Nu||(Nu=t)}}});var $i=8,r6=()=>{let t=[],e=256/$i+1,r=bc,n=r;for(let i=0;i{let e=Cb||(Cb=r6()),r=(u,l)=>{let y=l.negate();return u?y:l},n=Mu,i=bc,o=1+256/$i,s=2**($i-1),c=BigInt(2**$i-1),a=2**$i,d=BigInt($i);for(let u=0;u>=d,y>s&&(y-=a,t+=1n);let g=l,p=l+Math.abs(y)-1,w=u%2!==0,x=y<0;y===0?i=i.add(r(w,e[g])):n=n.add(r(x,e[p]))}return{p:n,f:i}};var rL=f(h(),1),Gb;(function(t){t.Mainnet="mainnet",t.Testnet="test"})(Gb||(Gb={}));var iL=f(h(),1),Jb;(function(t){t.Authentication="authentication",t.AssertionMethod="assertionMethod",t.CapabilityInvocation="capabilityInvocation",t.CapabilityDelegation="capabilityDelegation",t.KeyAgreement="keyAgreement"})(Jb||(Jb={}));var fL=f(h(),1);var i6=(i=>(i.Ed25519="Ed25519",i.secp256k1="secp256k1",i.secp256r1="secp256r1",i.X25519="X25519",i))(i6||{}),o6={Ed25519:"Ed25519",ES256K:"secp256k1",ES256:"secp256r1","P-256":"secp256r1",secp256k1:"secp256k1",secp256r1:"secp256r1"},Yb="https://ion.tbd.engineering",Vi=class Vi extends ir{static async create({keyManager:e=new mt,options:r={}}={}){if(r.verificationMethods?.some(p=>!(p.algorithm in o6)))throw new Error("One or more verification method algorithms are not supported");let n=r.verificationMethods?.filter(p=>"id"in p).map(p=>p.id);if(n&&n.length!==new Set(n).size)throw new Error("One or more verification method IDs are not unique");if(r.services?.some(p=>!p.id||!p.type||!p.serviceEndpoint))throw new Error("One or more services are missing required properties");let i={algorithm:"Ed25519",purposes:["authentication","assertionMethod","capabilityDelegation","capabilityInvocation"]},o=[];for(let p of r.verificationMethods??[i]){let w=await e.generateKey({algorithm:p.algorithm}),x=await e.getPublicKey({keyUri:w});o.push({id:p.id,publicKeyJwk:x,purposes:p.purposes??["authentication","assertionMethod","capabilityDelegation","capabilityInvocation"]})}let s=await e.generateKey({algorithm:"secp256k1"}),c=await e.getPublicKey({keyUri:s}),a=await e.generateKey({algorithm:"secp256k1"}),d=await e.getPublicKey({keyUri:a}),u=await Fi.computeLongFormDidUri({recoveryKey:c,updateKey:d,services:r.services??[],verificationMethods:o}),{didDocument:l,didResolutionMetadata:y}=await Vi.resolve(u,{gatewayUri:r.gatewayUri});if(l===null)throw new Error(`Unable to resolve DID during creation: ${y?.error}`);let g=new Dt({uri:u,document:l,metadata:{published:!1,canonicalId:u.split(":",3).join(":"),recoveryKey:c,updateKey:d},keyManager:e});if(r.publish??!0){let p=await Vi.publish({did:g,gatewayUri:r.gatewayUri});g.metadata=p.didDocumentMetadata}return g}static async getSigningMethod({didDocument:e,methodId:r}){let n=Le.parse(e.id);if(n&&n.method!==this.methodName)throw new Y("methodNotSupported",`Method not supported: ${n.method}`);let i=e.verificationMethod?.find(o=>o.id===(r??e.assertionMethod?.[0]));if(!(i&&i.publicKeyJwk))throw new Y("internalError","A verification method intended for signing could not be determined from the DID Document");return i}static async import({portableDid:e,keyManager:r=new mt}){if(Le.parse(e.uri)?.method!==Vi.methodName)throw new Y("methodNotSupported","Method not supported");return await Dt.import({portableDid:e,keyManager:r})}static async publish({did:e,gatewayUri:r=Yb}){let n=e.document.verificationMethod?.map(s=>({id:s.id,publicKeyJwk:s.publicKeyJwk,purposes:ih({didDocument:e.document,methodId:s.id})}))??[],i=await Fi.createIonDocument({services:e.document.service??[],verificationMethods:n}),o=await Fi.constructCreateRequest({ionDocument:i,recoveryKey:e.metadata.recoveryKey,updateKey:e.metadata.updateKey});try{let s=Fi.appendPathToUrl({baseUrl:r,path:"/operations"}),c=await fetch(s,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});return{didDocument:e.document,didDocumentMetadata:{...e.metadata,published:c.ok},didRegistrationMetadata:{}}}catch{return{didDocument:null,didDocumentMetadata:{published:!1},didRegistrationMetadata:{error:"internalError",errorMessage:`Failed to publish DID document for: ${e.uri}`}}}}static async resolve(e,r={}){let n=Le.parse(e);if(!n)return{...Ke,didResolutionMetadata:{error:"invalidDid"}};if(n.method!==Vi.methodName)return{...Ke,didResolutionMetadata:{error:"methodNotSupported"}};let i=r?.gatewayUri??Yb;try{let o=Fi.appendPathToUrl({baseUrl:i,path:`/identifiers/${e}`}),s=await fetch(o);if(!s.ok)throw new Y("notFound",`Unable to find DID document for: ${e}`);let{didDocument:c,didDocumentMetadata:a}=await s.json();return{...Ke,...c&&{didDocument:c},didDocumentMetadata:{published:a?.method?.published,...a}}}catch(o){if(!(o instanceof Y))throw new Error(o);return{...Ke,didResolutionMetadata:{error:o.code,...o.message&&{errorMessage:o.message}}}}}};Vi.methodName="ion";var Xb=Vi,Fi=class t{static appendPathToUrl({baseUrl:e,path:r}){let n=new URL(e);return n.pathname=n.pathname.endsWith("/")?n.pathname:n.pathname+"/",n.pathname+=r.startsWith("/")?r.substring(1):r,n.toString()}static async computeLongFormDidUri({recoveryKey:e,updateKey:r,services:n,verificationMethods:i}){let o=await t.createIonDocument({services:n,verificationMethods:i}),s=t.normalizeJwk(e),c=t.normalizeJwk(r);return await Go.createLongFormDid({document:o,recoveryKey:s,updateKey:c})}static async constructCreateRequest({ionDocument:e,recoveryKey:r,updateKey:n}){return await Gn.createCreateRequest({document:e,recoveryKey:t.normalizeJwk(r),updateKey:t.normalizeJwk(n)})}static async createIonDocument({services:e,verificationMethods:r}){let n=[];for(let s of r){let c=s.id??s.publicKeyJwk.kid??await ae({jwk:s.publicKeyJwk});c=`${c.split("#").pop()}`;let a={id:c,publicKeyJwk:t.normalizeJwk(s.publicKeyJwk),purposes:s.purposes,type:"JsonWebKey2020"};n.push(a)}let i=e.map(s=>({...s,id:`${s.id.split("#").pop()}`}));return{publicKeys:n,services:i}}static normalizeJwk(e){let r=e.kty,n;if(r==="EC")n={crv:e.crv,kty:e.kty,x:e.x,y:e.y};else if(r==="oct")n={k:e.k,kty:e.kty};else if(r==="OKP")n={crv:e.crv,kty:e.kty,x:e.x};else if(r==="RSA")n={e:e.e,kty:e.kty,n:e.n};else throw new Error(`Unsupported key type: ${r}`);return n}};var HL=f(h(),1);var Hi=class Hi extends ir{static async create({keyManager:e=new mt,options:r={}}={}){if(r.algorithm&&r.verificationMethods)throw new Error("The 'algorithm' and 'verificationMethods' options are mutually exclusive");if(r.verificationMethods&&r.verificationMethods.length!==1)throw new Error("The 'verificationMethods' option must contain exactly one entry");let n=r.algorithm??r.verificationMethods?.[0]?.algorithm??"Ed25519",i=await e.generateKey({algorithm:n}),o=await e.getPublicKey({keyUri:i}),s=W.object(o).toBase64Url(),c=`did:${Hi.methodName}:${s}`,d=(await Hi.resolve(c)).didDocument;return new Dt({uri:c,document:d,metadata:{},keyManager:e})}static async getSigningMethod({didDocument:e}){let r=Le.parse(e.id);if(r&&r.method!==this.methodName)throw new Y("methodNotSupported",`Method not supported: ${r.method}`);let[n]=e.verificationMethod??[];if(!(n&&n.publicKeyJwk))throw new Y("internalError","A verification method intended for signing could not be determined from the DID Document");return n}static async import({portableDid:e,keyManager:r=new mt}){if(Le.parse(e.uri)?.method!==Hi.methodName)throw new Y("methodNotSupported","Method not supported");let i=await Dt.import({portableDid:e,keyManager:r});if(i.document.verificationMethod.length!==1)throw new Y("invalidDidDocument","DID document must contain exactly one verification method");return i}static async resolve(e,r){let n=Le.parse(e),i;try{i=W.base64Url(n.id).toObject()}catch{}if(!n||!i)return{...Ke,didResolutionMetadata:{error:"invalidDid"}};if(n.method!==Hi.methodName)return{...Ke,didResolutionMetadata:{error:"methodNotSupported"}};let o={"@context":["https://www.w3.org/ns/did/v1"],id:n.uri},s=`${o.id}#0`;switch(o.verificationMethod=[{id:s,type:"JsonWebKey",controller:o.id,publicKeyJwk:i}],o.authentication=[s],o.assertionMethod=[s],o.capabilityInvocation=[s],o.capabilityDelegation=[s],o.keyAgreement=[s],i.use){case"sig":{delete o.keyAgreement;break}case"enc":{delete o.authentication,delete o.assertionMethod,delete o.capabilityInvocation,delete o.capabilityDelegation;break}}return{...Ke,didDocument:o}}};Hi.methodName="jwk";var Zb=Hi;var e4=f(h(),1);var s6=(i=>(i.Ed25519="Ed25519",i.secp256k1="secp256k1",i.secp256r1="secp256r1",i.X25519="X25519",i))(s6||{}),zh={Ed25519VerificationKey2020:"https://w3id.org/security/suites/ed25519-2020/v1",JsonWebKey2020:"https://w3id.org/security/suites/jws-2020/v1",X25519KeyAgreementKey2020:"https://w3id.org/security/suites/x25519-2020/v1"},c6={Ed25519:"Ed25519",ES256K:"secp256k1",ES256:"secp256r1","P-256":"secp256r1",secp256k1:"secp256k1",secp256r1:"secp256r1",X25519:"X25519"},gr=class gr extends ir{static async create({keyManager:e=new mt,options:r={}}={}){if(r.algorithm&&r.verificationMethods)throw new Error("The 'algorithm' and 'verificationMethods' options are mutually exclusive");if(r.verificationMethods&&r.verificationMethods.length!==1)throw new Error("The 'verificationMethods' option must contain exactly one entry");let n=r.algorithm??r.verificationMethods?.[0]?.algorithm??"Ed25519",i=await e.generateKey({algorithm:n}),o=await e.getPublicKey({keyUri:i}),s=await mr.publicKeyToMultibaseId({publicKey:o}),c=`did:${gr.methodName}:${s}`,d=(await gr.resolve(c,r)).didDocument;return new Dt({uri:c,document:d,metadata:{},keyManager:e})}static async getSigningMethod({didDocument:e}){let r=Le.parse(e.id);if(r&&r.method!==this.methodName)throw new Y("methodNotSupported",`Method not supported: ${r.method}`);let[n]=e.assertionMethod||[],i=e.verificationMethod?.find(o=>o.id===n);if(!(i&&i.publicKeyJwk))throw new Y("internalError","A verification method intended for signing could not be determined from the DID Document");return i}static async import({portableDid:e,keyManager:r=new mt}){if(Le.parse(e.uri)?.method!==gr.methodName)throw new Y("methodNotSupported","Method not supported");let i=await Dt.import({portableDid:e,keyManager:r});if(i.document.verificationMethod.length!==1)throw new Y("invalidDidDocument","DID document must contain exactly one verification method");return i}static async resolve(e,r){try{let n=await gr.createDocument({didUri:e,options:r});return{...Ke,didDocument:n}}catch(n){if(!(n instanceof Y))throw new Error(n);return{...Ke,didResolutionMetadata:{error:n.code,...n.message&&{errorMessage:n.message}}}}}static async createDocument({didUri:e,options:r={}}){let{defaultContext:n="https://www.w3.org/ns/did/v1",enableEncryptionKeyDerivation:i=!1,enableExperimentalPublicKeyTypes:o=!1,publicKeyFormat:s="JsonWebKey2020"}=r,c={id:""},a=Le.parse(e);if(!a)throw new Y("invalidDid",`Invalid DID URI: ${e}`);let d=a.id;if(a.method!==gr.methodName)throw new Y("methodNotSupported",`Method not supported: ${a.method}`);if(!gr.validateIdentifier(a))throw new Y("invalidDid",`Invalid DID URI: ${e}`);let u=await gr.createSignatureMethod({didUri:e,multibaseValue:d,options:{enableExperimentalPublicKeyTypes:o,publicKeyFormat:s}});if(c.id=a.uri,c.verificationMethod=[u],c.authentication=[u.id],c.assertionMethod=[u.id],c.capabilityInvocation=[u.id],c.capabilityDelegation=[u.id],i===!0){let g=s==="Ed25519VerificationKey2020"?"X25519KeyAgreementKey2020":"JsonWebKey2020",p=await this.createEncryptionMethod({didUri:e,multibaseValue:d,options:{enableExperimentalPublicKeyTypes:o,publicKeyFormat:g}});c.verificationMethod.push(p),c.keyAgreement=[p.id]}let l=[n];return nh({didDocument:c}).forEach(g=>{let p=zh[g];l.push(p)}),c["@context"]=l,c}static async createEncryptionMethod({didUri:e,multibaseValue:r,options:n}){let{enableExperimentalPublicKeyTypes:i,publicKeyFormat:o}=n,s={id:"",type:"",controller:""},{keyBytes:c,multicodecCode:a}=await gr.deriveEncryptionKey({multibaseValue:r}),d=c.byteLength,u=mr.MULTICODEC_PUBLIC_KEY_LENGTH[a];if(d!==u)throw new Y("invalidPublicKeyLength",`Expected ${d} bytes. Actual: ${u}`);let l=su({keyBytes:c,multicodecCode:a});s.id=`${e}#${l}`;try{new URL(s.id)}catch{throw new Y("invalidDidUrl","Verification Method ID is not a valid DID URL.")}if(!(o in zh))throw new Y("unsupportedPublicKeyType",`Unsupported format: ${o}`);if(i===!1&&!["Multikey","JsonWebKey2020","X25519KeyAgreementKey2020"].includes(o))throw new Y("invalidPublicKeyType",`Specified '${o}' without setting enableExperimentalPublicKeyTypes to true.`);if(s.type=o,s.controller=e,o==="X25519KeyAgreementKey2020"&&(s.publicKeyMultibase=l),o==="JsonWebKey2020"){let{crv:g}=await mr.multicodecToJwk({code:a});s.publicKeyJwk=await mr.keyConverter(g).bytesToPublicKey({publicKeyBytes:c})}return s}static async createSignatureMethod({didUri:e,multibaseValue:r,options:n}){let{enableExperimentalPublicKeyTypes:i,publicKeyFormat:o}=n,s={id:"",type:"",controller:""},{keyBytes:c,multicodecCode:a,multicodecName:d}=cu({multibaseKeyId:r}),u=c.byteLength,l=mr.MULTICODEC_PUBLIC_KEY_LENGTH[a];if(u!==l)throw new Y("invalidPublicKeyLength",`Expected ${u} bytes. Actual: ${l}`);let y=!1;switch(d){case"secp256k1-pub":y=await nt.validatePublicKey({publicKeyBytes:c});break;case"ed25519-pub":y=await Ze.validatePublicKey({publicKeyBytes:c});break;case"x25519-pub":y=!0;break}if(!y)throw new Y("invalidPublicKey","Invalid public key detected.");s.id=`${e}#${r}`;try{new URL(s.id)}catch{throw new Y("invalidDidUrl","Verification Method ID is not a valid DID URL.")}if(!(o in zh))throw new Y("unsupportedPublicKeyType",`Unsupported format: ${o}`);if(i===!1&&!["Multikey","JsonWebKey2020","Ed25519VerificationKey2020"].includes(o))throw new Y("invalidPublicKeyType",`Specified '${o}' without setting enableExperimentalPublicKeyTypes to true.`);if(s.type=o,s.controller=e,o==="Ed25519VerificationKey2020"&&(s.publicKeyMultibase=r),o==="JsonWebKey2020"){let{crv:p}=await mr.multicodecToJwk({code:a});s.publicKeyJwk=await mr.keyConverter(p).bytesToPublicKey({publicKeyBytes:c})}return s}static async deriveEncryptionKey({multibaseValue:e}){let r={keyBytes:new Uint8Array,multicodecCode:0},{keyBytes:n,multicodecCode:i}=cu({multibaseKeyId:e});if(i===237){let o=await mr.keyConverter("Ed25519").bytesToPublicKey({publicKeyBytes:n}),s=await Ze.convertPublicKeyToX25519({publicKey:o});r={keyBytes:await mr.keyConverter("Ed25519").publicKeyToBytes({publicKey:s}),multicodecCode:236}}return r}static validateIdentifier(e){let{method:r,id:n}=e,[i]=e.uri.split(":",1);return i==="did"&&r==="key"&&Number("1")>0&&oo(n)==="String"&&n.startsWith("z")}};gr.methodName="key";var Qb=gr,Fr=class Fr{static async jwkToMulticodec({jwk:e}){let r=[];e.crv&&(r.push(e.crv),e.d?r.push("private"):r.push("public"));let n=r.join(":"),i=Fr.JWK_TO_MULTICODEC[n];if(i===void 0)throw new Error(`Unsupported JWK to Multicodec conversion: '${n}'`);return{code:pt.getCodeFromName({name:i}),name:i}}static keyCompressor(e){let n={"P-256":dt.compressPublicKey,secp256k1:nt.compressPublicKey}[e];if(!n)throw new Y("invalidPublicKeyType",`Unsupported curve: ${e}`);return n}static keyConverter(e){let n={Ed25519:Ze,"P-256":dt,secp256k1:nt,X25519:Mo}[e];if(!n)throw new Y("invalidPublicKeyType",`Unsupported curve: ${e}`);return n}static async multicodecToJwk({code:e,name:r}){if(!(r?!e:e))throw new Error("Either 'name' or 'code' must be defined, but not both.");r=r===void 0?pt.getNameFromCode({code:e}):r;let n=r,i=Fr.MULTICODEC_TO_JWK[n];if(i===void 0)throw new Error("Unsupported Multicodec to JWK conversion");return{...i}}static async publicKeyToMultibaseId({publicKey:e}){if(!(e?.crv&&e.crv in c6))throw new Y("invalidPublicKeyType",`Public key contains an unsupported key type: ${e?.crv??"undefined"}`);let r=await Fr.keyConverter(e.crv).publicKeyToBytes({publicKey:e});/^(secp256k1|P-256|P-384|P-521)$/.test(e.crv)&&(r=await Fr.keyCompressor(e.crv)({publicKeyBytes:r}));let{name:n}=await Fr.jwkToMulticodec({jwk:e});return su({keyBytes:r,multicodecName:n})}};Fr.JWK_TO_MULTICODEC={"Ed25519:public":"ed25519-pub","Ed25519:private":"ed25519-priv","secp256k1:public":"secp256k1-pub","secp256k1:private":"secp256k1-priv","X25519:public":"x25519-pub","X25519:private":"x25519-priv"},Fr.MULTICODEC_PUBLIC_KEY_LENGTH={231:33,236:32,237:32},Fr.MULTICODEC_TO_JWK={"ed25519-pub":{crv:"Ed25519",kty:"OKP",x:""},"ed25519-priv":{crv:"Ed25519",kty:"OKP",x:"",d:""},"secp256k1-pub":{crv:"secp256k1",kty:"EC",x:"",y:""},"secp256k1-priv":{crv:"secp256k1",kty:"EC",x:"",y:"",d:""},"x25519-pub":{crv:"X25519",kty:"OKP",x:""},"x25519-priv":{crv:"X25519",kty:"OKP",x:"",d:""}};var mr=Fr;var o4=f(h(),1);var Vu=class Vu extends ir{static async resolve(e,r){let n=Le.parse(e);if(!n)return{...Ke,didResolutionMetadata:{error:"invalidDid"}};if(n.method!==Vu.methodName)return{...Ke,didResolutionMetadata:{error:"methodNotSupported"}};let i=`https://${n.id.replace(/:/g,"/")}`;i=decodeURIComponent(i);let o=n.id.includes(":")?`${i}/did.json`:`${i}/.well-known/did.json`;try{let s=await fetch(o);if(!s.ok)throw new Error("HTTP error status code returned");let c=await s.json();return{...Ke,didDocument:c}}catch{return{...Ke,didResolutionMetadata:{error:"notFound"}}}}};Vu.methodName="web";var ex=Vu;var l4=f(h(),1),sx=f(rx(),1),cx=f(ix(),1),ox=class{constructor({db:e,location:r="DATA/DID_RESOLVERCACHE",ttl:n="15m"}={}){this.cache=e??new cx.Level(r),this.ttl=(0,sx.default)(n)}async get(e){try{let r=await this.cache.get(e),n=JSON.parse(r);if(Date.now()>=n.ttlMillis){this.cache.nextTick(()=>this.cache.del(e));return}else return n.value}catch(r){if(r.notFound)return;throw r}}set(e,r){let n={ttlMillis:Date.now()+this.ttl,value:r},i=JSON.stringify(n);return this.cache.put(e,i)}delete(e){return this.cache.del(e)}clear(){return this.cache.clear()}close(){return this.cache.close()}};var h4=f(h(),1),ax={get:function(t){return null},set:function(t,e){return null},delete:function(t){return null},clear:function(){return null},close:function(){return null}};var b4=f(h(),1);var ux=class{constructor({cache:e,didResolvers:r}){this.didResolvers=new Map;this.cache=e||ax;for(let n of r)this.didResolvers.set(n.methodName,n)}async resolve(e,r){let n=Le.parse(e);if(!n)return{...Ke,didResolutionMetadata:{error:"invalidDid",errorMessage:`Invalid DID URI: ${e}`}};let i=this.didResolvers.get(n.method);if(!i)return{...Ke,didResolutionMetadata:{error:"methodNotSupported",errorMessage:`Method not supported: ${n.method}`}};let o=await this.cache.get(n.uri);if(o)return o;{let s=await i.resolve(n.uri,r);return s.didResolutionMetadata.error||await this.cache.set(n.uri,s),s}}async dereference(e,r){let n=Le.parse(e);if(!n)return{dereferencingMetadata:{error:"invalidDidUrl"},contentStream:null,contentMetadata:{}};let{didDocument:i,didResolutionMetadata:o,didDocumentMetadata:s}=await this.resolve(n.uri);if(!i)return{dereferencingMetadata:{error:o.error},contentStream:null,contentMetadata:{}};if(!n.fragment||n.query)return{dereferencingMetadata:{contentType:"application/did+json"},contentStream:i,contentMetadata:s};let{service:c=[],verificationMethod:a=[]}=i,d=new Set([e,n.fragment,`#${n.fragment}`]),u;for(let l of a)if(d.has(l.id)){u=l;break}for(let l of c)if(d.has(l.id)){u=l;break}return u?{dereferencingMetadata:{contentType:"application/did+json"},contentStream:u,contentMetadata:o}:{dereferencingMetadata:{error:"notFound"},contentStream:null,contentMetadata:{}}}};export{Dt as BearerDid,Le as Did,Bu as DidDht,Du as DidDhtDocument,sb as DidDhtRegisteredDidType,bh as DidDhtRegisteredKeyType,it as DidDhtUtils,cb as DidDhtVerificationRelationship,Y as DidError,Tn as DidErrorCode,Xb as DidIon,i6 as DidIonRegisteredKeyType,Fi as DidIonUtils,Zb as DidJwk,Qb as DidKey,s6 as DidKeyRegisteredKeyType,mr as DidKeyUtils,zh as DidKeyVerificationMethodType,ir as DidMethod,ox as DidResolverCacheLevel,ax as DidResolverCacheNoop,no as DidVerificationRelationship,ex as DidWeb,Ke as EMPTY_DID_RESOLUTION_RESULT,ux as UniversalResolver,Dw as utils}; /*! Bundled license information: ieee754/index.js: (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *) buffer/index.js: (*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT *) queue-microtask/index.js: (*! queue-microtask. MIT License. Feross Aboukhadijeh *) run-parallel-limit/index.js: (*! run-parallel-limit. MIT License. Feross Aboukhadijeh *) safe-buffer/index.js: (*! safe-buffer. MIT License. Feross Aboukhadijeh *) uri-js/dist/es5/uri.all.js: (** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js *) @noble/hashes/esm/utils.js: (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *) @noble/curves/esm/abstract/utils.js: (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) @noble/curves/esm/abstract/modular.js: (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) @noble/curves/esm/abstract/curve.js: (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) @noble/curves/esm/abstract/weierstrass.js: (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) @noble/curves/esm/_shortw_utils.js: (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) @noble/curves/esm/secp256k1.js: (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) @noble/curves/esm/p256.js: (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) @noble/curves/esm/abstract/edwards.js: (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) @noble/curves/esm/abstract/montgomery.js: (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) @noble/curves/esm/ed25519.js: (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) @noble/ciphers/esm/utils.js: (*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *) uint8-util/util.js: (* Common package for dealing with hex/string/uint8 conversions (and sha1 hashing) * * @author Jimmy Wärting (https://jimmy.warting.se/opensource) * @license MIT *) @noble/ed25519/index.js: (*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) *) @noble/secp256k1/index.js: (*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) *) */ //# sourceMappingURL=browser.mjs.map