var Web5=(()=>{var Ybe=Object.create;var kS=Object.defineProperty;var Zbe=Object.getOwnPropertyDescriptor;var Xbe=Object.getOwnPropertyNames;var Qbe=Object.getPrototypeOf,ewe=Object.prototype.hasOwnProperty;var le=(t,e)=>()=>(t&&(e=t(t=0)),e);var V=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ur=(t,e)=>{for(var r in e)kS(t,r,{get:e[r],enumerable:!0})},SF=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Xbe(e))!ewe.call(t,i)&&i!==r&&kS(t,i,{get:()=>e[i],enumerable:!(n=Zbe(e,i))||n.enumerable});return t};var Kt=(t,e,r)=>(r=t!=null?Ybe(Qbe(t)):{},SF(e||!t||!t.__esModule?kS(r,"default",{value:t,enumerable:!0}):r,t)),twe=t=>SF(kS({},"__esModule",{value:!0}),t);var wR=V(RS=>{"use strict";h();RS.byteLength=nwe;RS.toByteArray=owe;RS.fromByteArray=cwe;var Xu=[],zc=[],rwe=typeof Uint8Array<"u"?Uint8Array:Array,bR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for($y=0,AF=bR.length;$y0)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 nwe(t){var e=TF(t),r=e[0],n=e[1];return(r+n)*3/4-n}function iwe(t,e,r){return(e+r)*3/4-r}function owe(t){var e,r=TF(t),n=r[0],i=r[1],o=new rwe(iwe(t,n,i)),s=0,a=i>0?n-4:n,d;for(d=0;d>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=zc[t.charCodeAt(d)]<<2|zc[t.charCodeAt(d+1)]>>4,o[s++]=e&255),i===1&&(e=zc[t.charCodeAt(d)]<<10|zc[t.charCodeAt(d+1)]<<4|zc[t.charCodeAt(d+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function swe(t){return Xu[t>>18&63]+Xu[t>>12&63]+Xu[t>>6&63]+Xu[t&63]}function awe(t,e,r){for(var n,i=[],o=e;oa?a:s+o));return n===1?(e=t[r-1],i.push(Xu[e>>2]+Xu[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Xu[e>>10]+Xu[e>>4&63]+Xu[e<<2&63]+"=")),i.join("")}});var xR=V(_R=>{h();_R.read=function(t,e,r,n,i){var o,s,a=i*8-n-1,d=(1<>1,c=-7,l=r?i-1:0,m=r?-1:1,p=t[e+l];for(l+=m,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=o*256+t[e+l],l+=m,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=s*256+t[e+l],l+=m,c-=8);if(o===0)o=1-u;else{if(o===d)return s?NaN:(p?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-u}return(p?-1:1)*s*Math.pow(2,o-n)};_R.write=function(t,e,r,n,i,o){var s,a,d,u=o*8-i-1,c=(1<>1,m=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,g=n?1:-1,v=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(d=Math.pow(2,-s))<1&&(s--,d*=2),s+l>=1?e+=m/d:e+=m*Math.pow(2,1-l),e*d>=2&&(s++,d/=2),s+l>=c?(a=0,s=c):s+l>=1?(a=(e*d-1)*Math.pow(2,i),s=s+l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=a&255,p+=g,a/=256,i-=8);for(s=s<0;t[r+p]=s&255,p+=g,s/=256,u-=8);t[r+p-g]|=v*128}});var UF=V(zv=>{"use strict";h();var ER=wR(),Fv=xR(),IF=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;zv.Buffer=ye;zv.SlowBuffer=pwe;zv.INSPECT_MAX_BYTES=50;var DS=2147483647;zv.kMaxLength=DS;ye.TYPED_ARRAY_SUPPORT=dwe();!ye.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 dwe(){try{var 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(ye.prototype,"parent",{enumerable:!0,get:function(){if(ye.isBuffer(this))return this.buffer}});Object.defineProperty(ye.prototype,"offset",{enumerable:!0,get:function(){if(ye.isBuffer(this))return this.byteOffset}});function bf(t){if(t>DS)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,ye.prototype),e}function ye(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 IR(t)}return RF(t,e,r)}ye.poolSize=8192;function RF(t,e,r){if(typeof t=="string")return lwe(t,e);if(ArrayBuffer.isView(t))return fwe(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(Qu(t,ArrayBuffer)||t&&Qu(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Qu(t,SharedArrayBuffer)||t&&Qu(t.buffer,SharedArrayBuffer)))return AR(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return ye.from(n,e,r);var i=hwe(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return ye.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)}ye.from=function(t,e,r){return RF(t,e,r)};Object.setPrototypeOf(ye.prototype,Uint8Array.prototype);Object.setPrototypeOf(ye,Uint8Array);function DF(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 uwe(t,e,r){return DF(t),t<=0?bf(t):e!==void 0?typeof r=="string"?bf(t).fill(e,r):bf(t).fill(e):bf(t)}ye.alloc=function(t,e,r){return uwe(t,e,r)};function IR(t){return DF(t),bf(t<0?0:PR(t)|0)}ye.allocUnsafe=function(t){return IR(t)};ye.allocUnsafeSlow=function(t){return IR(t)};function lwe(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!ye.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=BF(t,e)|0,n=bf(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function SR(t){for(var e=t.length<0?0:PR(t.length)|0,r=bf(e),n=0;n=DS)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+DS.toString(16)+" bytes");return t|0}function pwe(t){return+t!=t&&(t=0),ye.alloc(+t)}ye.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==ye.prototype};ye.compare=function(e,r){if(Qu(e,Uint8Array)&&(e=ye.from(e,e.offset,e.byteLength)),Qu(r,Uint8Array)&&(r=ye.from(r,r.offset,r.byteLength)),!ye.isBuffer(e)||!ye.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,o=0,s=Math.min(n,i);oi.length?ye.from(s).copy(i,o):Uint8Array.prototype.set.call(i,s,o);else if(ye.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function BF(t,e){if(ye.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Qu(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);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return TR(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return jF(t).length;default:if(i)return n?-1:TR(t).length;e=(""+e).toLowerCase(),i=!0}}ye.byteLength=BF;function mwe(t,e,r){var 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 Awe(this,e,r);case"utf8":case"utf-8":return CF(this,e,r);case"ascii":return Ewe(this,e,r);case"latin1":case"binary":return Swe(this,e,r);case"base64":return _we(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Twe(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}ye.prototype._isBuffer=!0;function Ny(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}ye.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;rr&&(e+=" ... "),""};IF&&(ye.prototype[IF]=ye.prototype.inspect);ye.prototype.compare=function(e,r,n,i,o){if(Qu(e,Uint8Array)&&(e=ye.from(e,e.offset,e.byteLength)),!ye.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;for(var s=o-i,a=n-r,d=Math.min(s,a),u=this.slice(i,o),c=e.slice(r,n),l=0;l2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,kR(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=ye.from(e,n)),ye.isBuffer(e))return e.length===0?-1:PF(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):PF(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function PF(t,e,r,n,i){var o=1,s=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,s/=2,a/=2,r/=2}function d(p,g){return o===1?p[g]:p.readUInt16BE(g*o)}var u;if(i){var c=-1;for(u=r;us&&(r=s-a),u=r;u>=0;u--){for(var l=!0,m=0;mi&&(n=i)):n=i;var o=e.length;n>o/2&&(n=o/2);for(var 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");var 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");for(var s=!1;;)switch(i){case"hex":return ywe(this,e,r,n);case"utf8":case"utf-8":return gwe(this,e,r,n);case"ascii":case"latin1":case"binary":return vwe(this,e,r,n);case"base64":return bwe(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wwe(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};ye.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function _we(t,e,r){return e===0&&r===t.length?ER.fromByteArray(t):ER.fromByteArray(t.slice(e,r))}function CF(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:o>223?3:o>191?2:1;if(i+a<=r){var d,u,c,l;switch(a){case 1:o<128&&(s=o);break;case 2:d=t[i+1],(d&192)===128&&(l=(o&31)<<6|d&63,l>127&&(s=l));break;case 3:d=t[i+1],u=t[i+2],(d&192)===128&&(u&192)===128&&(l=(o&15)<<12|(d&63)<<6|u&63,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:d=t[i+1],u=t[i+2],c=t[i+3],(d&192)===128&&(u&192)===128&&(c&192)===128&&(l=(o&15)<<18|(d&63)<<12|(u&63)<<6|c&63,l>65535&&l<1114112&&(s=l))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=a}return xwe(n)}var kF=4096;function xwe(t){var e=t.length;if(e<=kF)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",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")}ye.prototype.readUintLE=ye.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||lo(e,r,this.length);for(var i=this[e],o=1,s=0;++s>>0,r=r>>>0,n||lo(e,r,this.length);for(var i=this[e+--r],o=1;r>0&&(o*=256);)i+=this[e+--r]*o;return i};ye.prototype.readUint8=ye.prototype.readUInt8=function(e,r){return e=e>>>0,r||lo(e,1,this.length),this[e]};ye.prototype.readUint16LE=ye.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||lo(e,2,this.length),this[e]|this[e+1]<<8};ye.prototype.readUint16BE=ye.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||lo(e,2,this.length),this[e]<<8|this[e+1]};ye.prototype.readUint32LE=ye.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||lo(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};ye.prototype.readUint32BE=ye.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||lo(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};ye.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||lo(e,r,this.length);for(var i=this[e],o=1,s=0;++s=o&&(i-=Math.pow(2,8*r)),i};ye.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||lo(e,r,this.length);for(var i=r,o=1,s=this[e+--i];i>0&&(o*=256);)s+=this[e+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s};ye.prototype.readInt8=function(e,r){return e=e>>>0,r||lo(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};ye.prototype.readInt16LE=function(e,r){e=e>>>0,r||lo(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};ye.prototype.readInt16BE=function(e,r){e=e>>>0,r||lo(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};ye.prototype.readInt32LE=function(e,r){return e=e>>>0,r||lo(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};ye.prototype.readInt32BE=function(e,r){return e=e>>>0,r||lo(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};ye.prototype.readFloatLE=function(e,r){return e=e>>>0,r||lo(e,4,this.length),Fv.read(this,e,!0,23,4)};ye.prototype.readFloatBE=function(e,r){return e=e>>>0,r||lo(e,4,this.length),Fv.read(this,e,!1,23,4)};ye.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||lo(e,8,this.length),Fv.read(this,e,!0,52,8)};ye.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||lo(e,8,this.length),Fv.read(this,e,!1,52,8)};function xa(t,e,r,n,i,o){if(!ye.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}ye.prototype.writeUintLE=ye.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var o=Math.pow(2,8*n)-1;xa(this,e,r,n,o,0)}var s=1,a=0;for(this[r]=e&255;++a>>0,n=n>>>0,!i){var o=Math.pow(2,8*n)-1;xa(this,e,r,n,o,0)}var s=n-1,a=1;for(this[r+s]=e&255;--s>=0&&(a*=256);)this[r+s]=e/a&255;return r+n};ye.prototype.writeUint8=ye.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||xa(this,e,r,1,255,0),this[r]=e&255,r+1};ye.prototype.writeUint16LE=ye.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||xa(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};ye.prototype.writeUint16BE=ye.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||xa(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};ye.prototype.writeUint32LE=ye.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||xa(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};ye.prototype.writeUint32BE=ye.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||xa(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};ye.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var o=Math.pow(2,8*n-1);xa(this,e,r,n,o-1,-o)}var s=0,a=1,d=0;for(this[r]=e&255;++s>0)-d&255;return r+n};ye.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var o=Math.pow(2,8*n-1);xa(this,e,r,n,o-1,-o)}var s=n-1,a=1,d=0;for(this[r+s]=e&255;--s>=0&&(a*=256);)e<0&&d===0&&this[r+s+1]!==0&&(d=1),this[r+s]=(e/a>>0)-d&255;return r+n};ye.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||xa(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};ye.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||xa(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};ye.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||xa(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};ye.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||xa(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};ye.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||xa(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};function OF(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 $F(t,e,r,n,i){return e=+e,r=r>>>0,i||OF(t,e,r,4,34028234663852886e22,-34028234663852886e22),Fv.write(t,e,r,n,23,4),r+4}ye.prototype.writeFloatLE=function(e,r,n){return $F(this,e,r,!0,n)};ye.prototype.writeFloatBE=function(e,r,n){return $F(this,e,r,!1,n)};function NF(t,e,r,n,i){return e=+e,r=r>>>0,i||OF(t,e,r,8,17976931348623157e292,-17976931348623157e292),Fv.write(t,e,r,n,52,8),r+8}ye.prototype.writeDoubleLE=function(e,r,n){return NF(this,e,r,!0,n)};ye.prototype.writeDoubleBE=function(e,r,n){return NF(this,e,r,!1,n)};ye.prototype.copy=function(e,r,n,i){if(!ye.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);var s;if(typeof e=="number")for(s=r;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 kwe(t){for(var e=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function jF(t){return ER.toByteArray(Pwe(t))}function BS(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Qu(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function kR(t){return t!==t}var Dwe=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()});var ys=V((uet,FF)=>{h();var Ei=FF.exports={},el,tl;function RR(){throw new Error("setTimeout has not been defined")}function DR(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?el=setTimeout:el=RR}catch{el=RR}try{typeof clearTimeout=="function"?tl=clearTimeout:tl=DR}catch{tl=DR}})();function qF(t){if(el===setTimeout)return setTimeout(t,0);if((el===RR||!el)&&setTimeout)return el=setTimeout,setTimeout(t,0);try{return el(t,0)}catch{try{return el.call(null,t,0)}catch{return el.call(this,t,0)}}}function Bwe(t){if(tl===clearTimeout)return clearTimeout(t);if((tl===DR||!tl)&&clearTimeout)return tl=clearTimeout,clearTimeout(t);try{return tl(t)}catch{try{return tl.call(null,t)}catch{return tl.call(this,t)}}}var wf=[],Wv=!1,jy,MS=-1;function Mwe(){!Wv||!jy||(Wv=!1,jy.length?wf=jy.concat(wf):MS=-1,wf.length&&LF())}function LF(){if(!Wv){var t=qF(Mwe);Wv=!0;for(var e=wf.length;e;){for(jy=wf,wf=[];++MS1)for(var r=1;r{O=Kt(UF()),D=Kt(ys()),het=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object)});var WF=V((met,zF)=>{h();var Cwe=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis;zF.exports=Cwe});var HF=V((get,VF)=>{h();var Owe=WF(),$we=typeof self=="object"&&self&&self.Object===Object&&self,Nwe=Owe||$we||Function("return this")();VF.exports=Nwe});var BR=V((bet,GF)=>{h();var jwe=HF(),Uwe=jwe.Symbol;GF.exports=Uwe});var XF=V((_et,ZF)=>{h();var JF=BR(),YF=Object.prototype,qwe=YF.hasOwnProperty,Lwe=YF.toString,W2=JF?JF.toStringTag:void 0;function Kwe(t){var e=qwe.call(t,W2),r=t[W2];try{t[W2]=void 0;var n=!0}catch{}var i=Lwe.call(t);return n&&(e?t[W2]=r:delete t[W2]),i}ZF.exports=Kwe});var ez=V((Eet,QF)=>{h();var Fwe=Object.prototype,zwe=Fwe.toString;function Wwe(t){return zwe.call(t)}QF.exports=Wwe});var iz=V((Tet,nz)=>{h();var tz=BR(),Vwe=XF(),Hwe=ez(),Gwe="[object Null]",Jwe="[object Undefined]",rz=tz?tz.toStringTag:void 0;function Ywe(t){return t==null?t===void 0?Jwe:Gwe:rz&&rz in Object(t)?Vwe(t):Hwe(t)}nz.exports=Ywe});var sz=V((Pet,oz)=>{h();function Zwe(t,e){return function(r){return t(e(r))}}oz.exports=Zwe});var cz=V((Ret,az)=>{h();var Xwe=sz(),Qwe=Xwe(Object.getPrototypeOf,Object);az.exports=Qwe});var uz=V((Bet,dz)=>{h();function e1e(t){return t!=null&&typeof t=="object"}dz.exports=e1e});var hz=V((Cet,fz)=>{h();var t1e=iz(),r1e=cz(),n1e=uz(),i1e="[object Object]",o1e=Function.prototype,s1e=Object.prototype,lz=o1e.toString,a1e=s1e.hasOwnProperty,c1e=lz.call(Object);function d1e(t){if(!n1e(t)||t1e(t)!=i1e)return!1;var e=r1e(t);if(e===null)return!0;var r=a1e.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&lz.call(r)==c1e}fz.exports=d1e});function u1e(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,$=new Uint8Array(I);A!==P;){for(var N=g[A],K=0,F=I-1;(N!==0||K>>0,$[F]=N%a>>>0,N=N/a>>>0;if(N!==0)throw new Error("Non-zero carry");E=K,A++}for(var U=I-E;U!==I&&$[U]===0;)U++;for(var W=d.repeat(v);U>>0,I=new Uint8Array(P);g[v];){var $=r[g.charCodeAt(v)];if($===255)return;for(var N=0,K=P-1;($!==0||N>>0,I[K]=$%256>>>0,$=$/256>>>0;if($!==0)throw new Error("Non-zero carry");A=N,v++}if(g[v]!==" "){for(var F=P-A;F!==P&&I[F]===0;)F++;for(var U=new Uint8Array(E+(P-F)),W=E;F!==P;)U[W++]=I[F++];return U}}}function p(g){var v=m(g);if(v)return v;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:m,decode:p}}var l1e,f1e,pz,mz=le(()=>{h();l1e=u1e,f1e=l1e,pz=f1e});var jet,yz,Wd,Uy=le(()=>{h();jet=new Uint8Array(0),yz=(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 vz=le(()=>{h()});var MR,CR,OR,bz,$R,wz,NR,h1e,p1e,Hs,CS=le(()=>{h();mz();Uy();vz();MR=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")}},CR=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 bz(this,e)}},OR=class{constructor(e){this.decoders=e}or(e){return bz(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`)}},bz=(t,e)=>new OR({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),$R=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new MR(e,r,n),this.decoder=new CR(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},wz=({name:t,prefix:e,encode:r,decode:n})=>new $R(t,e,r,n),NR=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=pz(r,e);return wz({prefix:t,name:e,encode:n,decode:o=>Wd(i(o))})},h1e=(t,e,r,n)=>{let i={};for(let c=0;c=8&&(a-=8,s[u++]=255&d>>a)}if(a>=r||255&d<<8-a)throw new SyntaxError("Unexpected end of data");return s},p1e=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)s-=r,o+=e[i&a>>s];if(s&&(o+=e[i&a<wz({prefix:e,name:t,encode(i){return p1e(i,n,r)},decode(i){return h1e(i,n,r,t)}})});var Het,Get,Gs,Jet,jR=le(()=>{h();CS();Het=Hs({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Get=Hs({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Gs=Hs({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Jet=Hs({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});function Dz(t,e){return t?WR(e.hashable).then(e.finish):e.finish(kz(e.hashable))}var jo,Vv,qR,LR,OS,Js,Az,jS,Hv,Gv,yt,_z,xz,nl,up,$S,Tz,KR,FR,Iz,zR,H2,Pz,rl,y1e,Ez,g1e,NS,V2,WR,kz,Rz,VR,v1e,HR,b1e,Bz,w1e,Mz,Sz,US,GR,qy,_1e,x1e,JR=le(()=>{h();jo=2n**255n-19n,Vv=2n**252n+27742317777372353535851937790883648493n,qR=0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,LR=0x6666666666666666666666666666666666666666666666666666666666666658n,OS={a:-1n,d:37095705934669439343138083508754565189542113879843219016388785533085940283555n,p:jo,n:Vv,h:8,Gx:qR,Gy:LR},Js=(t="")=>{throw new Error(t)},Az=t=>typeof t=="string",jS=(t,e)=>!(t instanceof Uint8Array)||typeof e=="number"&&e>0&&t.length!==e?Js("Uint8Array expected"):t,Hv=t=>new Uint8Array(t),Gv=(t,e)=>jS(Az(t)?FR(t):Hv(t),e),yt=(t,e=jo)=>{let r=t%e;return r>=0n?r:e+r},_z=t=>t instanceof nl?t:Js("Point expected"),nl=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,yt(e.x*e.y))}static fromHex(e,r=!0){let{d:n}=OS;e=Gv(e,32);let i=e.slice();i[31]=e[31]&-129;let o=zR(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(OS.h),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let e=this.mul(Vv/2n,!1).double();return Vv%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=Pz(n);return yt(n*i)!==1n&&Js("invalid inverse"),{x:yt(e*i),y:yt(r*i)}}toRawBytes(){let{x:e,y:r}=this.toAffine(),n=Iz(r);return n[31]|=e&1n?128:0,n}toHex(){return KR(this.toRawBytes())}};nl.BASE=new nl(qR,LR,1n,yt(qR*LR));nl.ZERO=new nl(0n,1n,1n,0n);({BASE:up,ZERO:$S}=nl),Tz=(t,e)=>t.toString(16).padStart(e,"0"),KR=t=>Array.from(t).map(e=>Tz(e,2)).join(""),FR=t=>{let e=t.length;(!Az(t)||e%2)&&Js("hex invalid 1");let r=Hv(e/2);for(let n=0;nFR(Tz(t,32*2)).reverse(),zR=t=>BigInt("0x"+KR(Hv(jS(t)).reverse())),H2=(...t)=>{let e=Hv(t.reduce((n,i)=>n+jS(i).length,0)),r=0;return t.forEach(n=>{e.set(n,r),r+=n.length}),e},Pz=(t,e=jo)=>{(t===0n||e<=0n)&&Js("no inverse n="+t+" mod="+e);let r=yt(t,e),n=e,i=0n,o=1n,s=1n,a=0n;for(;r!==0n;){let d=n/r,u=n%r,c=i-s*d,l=o-a*d;n=r,r=u,i=s,o=a,s=c,a=l}return n===1n?yt(i,e):Js("no inverse")},rl=(t,e)=>{let r=t;for(;e-- >0n;)r*=r,r%=jo;return r},y1e=t=>{let r=t*t%jo*t%jo,n=rl(r,2n)*r%jo,i=rl(n,1n)*t%jo,o=rl(i,5n)*i%jo,s=rl(o,10n)*o%jo,a=rl(s,20n)*s%jo,d=rl(a,40n)*a%jo,u=rl(d,80n)*d%jo,c=rl(u,80n)*d%jo,l=rl(c,10n)*o%jo;return{pow_p_5_8:rl(l,2n)*t%jo,b2:r}},Ez=19681161376707505956807079304988542015446066515923890162744021073123829784752n,g1e=(t,e)=>{let r=yt(e*e*e),n=yt(r*r*e),i=y1e(t*n).pow_p_5_8,o=yt(t*r*i),s=yt(e*o*o),a=o,d=yt(o*Ez),u=s===t,c=s===yt(-t),l=s===yt(-t*Ez);return u&&(o=a),(c||l)&&(o=d),(yt(o)&1n)===1n&&(o=yt(-o)),{isValid:u||c,value:o}},NS=t=>yt(zR(t),Vv),WR=(...t)=>US.sha512Async(...t),kz=(...t)=>typeof V2=="function"?V2(...t):Js("etc.sha512Sync not set"),Rz=t=>{let e=t.slice(0,32);e[0]&=248,e[31]&=127,e[31]|=64;let r=t.slice(32,64),n=NS(e),i=up.mul(n),o=i.toRawBytes();return{head:e,prefix:r,scalar:n,point:i,pointBytes:o}},VR=t=>WR(Gv(t,32)).then(Rz),v1e=t=>Rz(kz(Gv(t,32))),HR=t=>VR(t).then(e=>e.pointBytes);b1e=(t,e,r)=>{let{pointBytes:n,scalar:i}=t,o=NS(e),s=up.mul(o).toRawBytes();return{hashable:H2(s,n,r),finish:u=>{let c=yt(o+NS(u)*i,Vv);return jS(H2(s,Iz(c)),64)}}},Bz=async(t,e)=>{let r=Gv(t),n=await VR(e),i=await WR(n.prefix,r);return Dz(!0,b1e(n,i,r))},w1e=(t,e,r)=>{e=Gv(e),t=Gv(t,64);let n=nl.fromHex(r,!1),i=nl.fromHex(t.slice(0,32),!1),o=zR(t.slice(32,64)),s=up.mul(o,!1);return{hashable:H2(i.toRawBytes(),n.toRawBytes(),e),finish:u=>{let c=NS(u);return i.add(n.mul(c,!1)).add(s.negate()).clearCofactor().is0()}}},Mz=async(t,e,r)=>Dz(!0,w1e(t,e,r)),Sz=()=>typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,US={bytesToHex:KR,hexToBytes:FR,concatBytes:H2,mod:yt,invert:Pz,randomBytes:t=>{let e=Sz();return e||Js("crypto.getRandomValues must be defined"),e.getRandomValues(Hv(t))},sha512Async:async(...t)=>{let e=Sz();e||Js("crypto.subtle or etc.sha512Async must be defined");let r=H2(...t);return Hv(await e.subtle.digest("SHA-512",r.buffer))},sha512Sync:void 0};Object.defineProperties(US,{sha512Sync:{configurable:!1,get(){return V2},set(t){V2||(V2=t)}}});GR={getExtendedPublicKeyAsync:VR,getExtendedPublicKey:v1e,randomPrivateKey:()=>US.randomBytes(32),precompute(t=8,e=up){return e.multiply(3n),e}},qy=8,_1e=()=>{let t=[],e=256/qy+1,r=up,n=r;for(let i=0;i{let e=xz||(xz=_1e()),r=(c,l)=>{let m=l.negate();return c?m:l},n=$S,i=up,o=1+256/qy,s=2**(qy-1),a=BigInt(2**qy-1),d=2**qy,u=BigInt(qy);for(let c=0;c>=u,m>s&&(m-=d,t+=1n);let p=l,g=l+Math.abs(m)-1,v=c%2!==0,E=m<0;m===0?i=i.add(r(v,e[p])):n=n.add(r(E,e[g]))}return{p:n,f:i}}});function t_(t,e=!0){return vs.fromPrivateKey(t).toRawBytes(e)}function A1e(t,e,r=Jz){["der","recovered","canonical"].some(l=>l in r)&&fn("sign() legacy options not supported");let{lowS:n}=r;n==null&&(n=!0);let i=r9(Ef(t)),o=qz(i),s=FS(e),a=[qz(s),o],d=r.extraEntropy;if(d){d===!0&&(d=fp.randomBytes(gs));let l=Ef(d);l.length!==gs&&fn(),a.push(l)}let u=i,c=l=>{let m=Gz(l);if(!Y2(m))return;let p=e_(m,zi),g=xf.mul(m).aff(),v=He(g.x,zi);if(v===0n)return;let E=He(p*He(u+He(s*v,zi),zi),zi);if(E===0n)return;let A=E,P=(g.x===v?0:2)|Number(g.y&1n);return n&&t9(E)&&(A=He(-E,zi),P^=1),new Z2(v,A,P)};return{seed:XR(...a),k2sig:c}}function T1e(t){let e=ec(gs),r=ec(gs),n=0,i=()=>{e.fill(1),r.fill(0),n=0},o="drbg: tried 1000 values";if(t){let s=(...u)=>fp.hmacSha256Async(r,e,...u),a=async(u=ec())=>{r=await s(ec([0]),u),e=await s(),u.length!==0&&(r=await s(ec([1]),u),e=await s())},d=async()=>(n++>=1e3&&fn(o),e=await s(),e);return async(u,c)=>{i(),await a(u);let l;for(;!(l=c(await d()));)await a();return i(),l}}else{let s=(...u)=>{let c=J2;return c||fn("etc.hmacSha256Sync not set"),c(r,e,...u)},a=(u=ec())=>{r=s(ec([0]),u),e=s(),u.length!==0&&(r=s(ec([1]),u),e=s())},d=()=>(n++>=1e3&&fn(o),e=s(),e);return(u,c)=>{i(),a(u);let l;for(;!(l=c(d()));)a();return i(),l}}}async function n9(t,e,r=Jz){let{seed:n,k2sig:i}=A1e(t,e,r);return T1e(!0)(n,i)}function Yz(t,e,r,n=S1e){let{lowS:i}=n;i==null&&(i=!0),"strict"in n&&fn("verify() legacy options not supported");let o,s,a,d=t&&typeof t=="object"&&"r"in t;!d&&Ef(t).length!==2*gs&&fn("signature must be 64 bytes");try{o=d?new Z2(t.r,t.s).assertValidity():Z2.fromCompact(t),s=r9(Ef(e,gs)),a=r instanceof vs?r.ok():vs.fromHex(r)}catch{return!1}if(!o)return!1;let{r:u,s:c}=o;if(i&&t9(c))return!1;let l;try{let p=e_(c,zi),g=He(s*p,zi),v=He(u*p,zi);l=xf.mulAddQUns(a,g,v).aff()}catch{return!1}return l?He(l.x,zi)===u:!1}function Zz(t){t=Ef(t);let e=gs+8;(t.length1024)&&fn("expected proper params");let r=He(Q2(t),zi-1n)+1n;return WS(r)}var QR,lp,zi,Kz,Fz,zz,gs,Nz,fn,zS,Wz,ZR,Y2,Vz,ec,Ef,He,jz,Uz,vs,xf,LS,Hz,e9,X2,Q2,KS,WS,G2,XR,e_,E1e,FS,t9,Z2,Gz,r9,qz,Lz,J2,Jz,S1e,fp,VS,Ly,I1e,P1e,HS=le(()=>{h();QR=2n**256n,lp=QR-0x1000003d1n,zi=QR-0x14551231950b75fc4402da1732fc9bebfn,Kz=0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n,Fz=0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n,zz={p:lp,n:zi,a:0n,b:7n,Gx:Kz,Gy:Fz},gs=32,Nz=t=>He(He(t*t)*t+zz.b),fn=(t="")=>{throw new Error(t)},zS=t=>typeof t=="bigint",Wz=t=>typeof t=="string",ZR=t=>zS(t)&&0nzS(t)&&0n!(t instanceof Uint8Array)||typeof e=="number"&&e>0&&t.length!==e?fn("Uint8Array expected"):t,ec=t=>new Uint8Array(t),Ef=(t,e)=>Vz(Wz(t)?X2(t):ec(t),e),He=(t,e=lp)=>{let r=t%e;return r>=0n?r:e+r},jz=t=>t instanceof vs?t:fn("Point expected"),vs=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=Ef(e);let r,n=e[0],i=e.subarray(1),o=KS(i,0,gs),s=e.length;if(s===33&&[2,3].includes(n)){ZR(o)||fn("Point hex invalid: x not FE");let a=E1e(Nz(o)),d=(a&1n)===1n;(n&1)===1!==d&&(a=He(-a)),r=new t(o,a,1n)}return s===65&&n===4&&(r=new t(o,KS(i,gs,2*gs),1n)),r?r.ok():fn("Point is not on curve")}static fromPrivateKey(e){return xf.mul(FS(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:a}=jz(e),d=He(r*a),u=He(o*i),c=He(n*a),l=He(s*i);return d===u&&c===l}negate(){return new t(this.px,He(-this.py),this.pz)}double(){return this.add(this)}add(e){let{px:r,py:n,pz:i}=this,{px:o,py:s,pz:a}=jz(e),{a:d,b:u}=zz,c=0n,l=0n,m=0n,p=He(u*3n),g=He(r*o),v=He(n*s),E=He(i*a),A=He(r+n),P=He(o+s);A=He(A*P),P=He(g+v),A=He(A-P),P=He(r+i);let I=He(o+a);return P=He(P*I),I=He(g+E),P=He(P-I),I=He(n+i),c=He(s+a),I=He(I*c),c=He(v+E),I=He(I-c),m=He(d*P),c=He(p*E),m=He(c+m),c=He(v-m),m=He(v+m),l=He(c*m),v=He(g+g),v=He(v+g),E=He(d*E),P=He(p*P),v=He(v+E),E=He(g-E),E=He(d*E),P=He(P+E),g=He(v*P),l=He(l+g),g=He(I*P),c=He(A*c),c=He(c-g),g=He(A*v),m=He(I*m),m=He(m+g),new t(c,l,m)}mul(e,r=!0){if(!r&&e===0n)return LS;if(Y2(e)||fn("invalid scalar"),this.equals(xf))return P1e(e).p;let n=LS,i=xf;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(LS))return{x:0n,y:0n};if(n===1n)return{x:e,y:r};let i=e_(n);return He(n*i)!==1n&&fn("invalid inverse"),{x:He(e*i),y:He(r*i)}}assertValidity(){let{x:e,y:r}=this.aff();return(!ZR(e)||!ZR(r))&&fn("Point invalid: x or y"),He(r*r)===Nz(e)?this:fn("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")+G2(r)+(e?"":G2(n))}toRawBytes(e=!0){return X2(this.toHex(e))}};vs.BASE=new vs(Kz,Fz,1n);vs.ZERO=new vs(0n,1n,0n);({BASE:xf,ZERO:LS}=vs),Hz=(t,e)=>t.toString(16).padStart(e,"0"),e9=t=>Array.from(t).map(e=>Hz(e,2)).join(""),X2=t=>{let e=t.length;(!Wz(t)||e%2)&&fn("hex invalid 1");let r=ec(e/2);for(let n=0;nBigInt("0x"+(e9(t)||"0")),KS=(t,e,r)=>Q2(t.slice(e,r)),WS=t=>zS(t)&&t>=0n&&te9(WS(t)),XR=(...t)=>{let e=ec(t.reduce((n,i)=>n+Vz(i).length,0)),r=0;return t.forEach(n=>{e.set(n,r),r+=n.length}),e},e_=(t,e=lp)=>{(t===0n||e<=0n)&&fn("no inverse n="+t+" mod="+e);let r=He(t,e),n=e,i=0n,o=1n,s=1n,a=0n;for(;r!==0n;){let d=n/r,u=n%r,c=i-s*d,l=o-a*d;n=r,r=u,i=s,o=a,s=c,a=l}return n===1n?He(i,e):fn("no inverse")},E1e=t=>{let e=1n;for(let r=t,n=(lp+1n)/4n;n>0n;n>>=1n)n&1n&&(e=e*r%lp),r=r*r%lp;return He(e*e)===t?e:fn("sqrt invalid")},FS=t=>(zS(t)||(t=Q2(Ef(t,gs))),Y2(t)?t:fn("private key out of range")),t9=t=>t>zi>>1n;Z2=class t{constructor(e,r,n){this.r=e,this.s=r,this.recovery=n,this.assertValidity()}static fromCompact(e){return e=Ef(e,64),new t(KS(e,0,gs),KS(e,gs,2*gs))}assertValidity(){return Y2(this.r)&&Y2(this.s)?this:fn()}addRecoveryBit(e){return new t(this.r,this.s,e)}hasHighS(){return t9(this.s)}recoverPublicKey(e){let{r,s:n,recovery:i}=this;[0,1,2,3].includes(i)||fn("recovery id invalid");let o=r9(Ef(e,32)),s=i===2||i===3?r+zi:r;s>=lp&&fn("q.x invalid");let a=i&1?"03":"02",d=vs.fromHex(a+G2(s)),u=e_(s,zi),c=He(-o*u,zi),l=He(n*u,zi);return xf.mulAddQUns(d,c,l)}toCompactRawBytes(){return X2(this.toCompactHex())}toCompactHex(){return G2(this.r)+G2(this.s)}},Gz=t=>{let e=t.length*8-256,r=Q2(t);return e>0?r>>BigInt(e):r},r9=t=>He(Gz(t),zi),qz=t=>WS(t),Lz=()=>typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,Jz={lowS:!0},S1e={lowS:!0};fp={hexToBytes:X2,bytesToHex:e9,concatBytes:XR,bytesToNumberBE:Q2,numberToBytesBE:WS,mod:He,invert:e_,hmacSha256Async:async(t,...e)=>{let r=Lz();if(!r)return fn("etc.hmacSha256Async not set");let n=r.subtle,i=await n.importKey("raw",t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return ec(await n.sign("HMAC",i,XR(...e)))},hmacSha256Sync:J2,hashToPrivateKey:Zz,randomBytes:t=>{let e=Lz();return e||fn("crypto.getRandomValues must be defined"),e.getRandomValues(ec(t))}},VS={normPrivateKeyToScalar:FS,isValidPrivateKey:t=>{try{return!!FS(t)}catch{return!1}},randomPrivateKey:()=>Zz(fp.randomBytes(gs+8)),precompute(t=8,e=xf){return e.multiply(3n),e}};Object.defineProperties(fp,{hmacSha256Sync:{configurable:!1,get(){return J2},set(t){J2||(J2=t)}}});Ly=8,I1e=()=>{let t=[],e=256/Ly+1,r=xf,n=r;for(let i=0;i{let e=Uz||(Uz=I1e()),r=(c,l)=>{let m=l.negate();return c?m:l},n=LS,i=xf,o=1+256/Ly,s=2**(Ly-1),a=BigInt(2**Ly-1),d=2**Ly,u=BigInt(Ly);for(let c=0;c>=u,m>s&&(m-=d,t+=1n);let p=l,g=l+Math.abs(m)-1,v=c%2!==0,E=m<0;m===0?i=i.add(r(v,e[p])):n=n.add(r(E,e[g]))}return{p:n,f:i}}});function eW(t,e,r){e=e||[],r=r||0;for(var n=r;t>=B1e;)e[r++]=t&255|Xz,t/=128;for(;t&D1e;)e[r++]=t&255|Xz,t>>>=7;return e[r]=t|0,eW.bytes=r-n+1,e}function o9(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw o9.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&Qz)<=C1e);return o9.bytes=o-n,r}var k1e,Xz,R1e,D1e,B1e,M1e,C1e,Qz,O1e,$1e,N1e,j1e,U1e,q1e,L1e,K1e,F1e,z1e,W1e,V1e,r_,tW=le(()=>{h();k1e=eW,Xz=128,R1e=127,D1e=~R1e,B1e=Math.pow(2,31);M1e=o9,C1e=128,Qz=127;O1e=Math.pow(2,7),$1e=Math.pow(2,14),N1e=Math.pow(2,21),j1e=Math.pow(2,28),U1e=Math.pow(2,35),q1e=Math.pow(2,42),L1e=Math.pow(2,49),K1e=Math.pow(2,56),F1e=Math.pow(2,63),z1e=function(t){return tJv,encodeTo:()=>Ky,encodingLength:()=>Fy});var Jv,Ky,Fy,GS=le(()=>{h();tW();Jv=(t,e=0)=>[r_.decode(t,e),r_.decode.bytes],Ky=(t,e,r=0)=>(r_.encode(t,e,r),e),Fy=t=>r_.encodingLength(t)});var zy,JS,rW,Yv,Zv=le(()=>{h();Uy();GS();zy=(t,e)=>{let r=e.byteLength,n=Fy(t),i=n+Fy(r),o=new Uint8Array(i+r);return Ky(t,o,0),Ky(r,o,n),o.set(e,i),new Yv(t,r,e,o)},JS=t=>{let e=Wd(t),[r,n]=Jv(e),[i,o]=Jv(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Yv(r,i,s,e)},rW=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&yz(t.bytes,r.bytes)}},Yv=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var a9,s9,c9=le(()=>{h();Zv();a9=({name:t,code:e,encode:r})=>new s9(t,e,r),s9=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?zy(this.code,r):r.then(n=>zy(this.code,n))}else throw Error("Unknown type, must be binary type")}}});function pp(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function J1e(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function Af(t,...e){if(!J1e(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 YS(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");pp(t.outputLen),pp(t.blockLen)}function Xv(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 iW(t,e){Af(t);let r=e.outputLen;if(t.length{h()});var eb,d9=le(()=>{h();eb=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});function u9(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function l9(t){if(!u9(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r=Tf._0&&t<=Tf._9)return t-Tf._0;if(t>=Tf._A&&t<=Tf._F)return t-(Tf._A-10);if(t>=Tf._a&&t<=Tf._f)return t-(Tf._a-10)}function sW(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;i=0&&ot().update(mp(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function Pf(t=32){if(eb&&typeof eb.getRandomValues=="function")return eb.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}var If,Vd,Y1e,Z1e,Tf,X1e,tb,Q1e,Wc=le(()=>{h();d9();If=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Vd=(t,e)=>t<<32-e|t>>>e,Y1e=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Y1e)throw new Error("Non little-endian hardware is not supported");Z1e=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));Tf={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};X1e=async()=>{};tb=class{clone(){return this._cloneInto()}},Q1e={}.toString});var ZS,yp,XS=le(()=>{h();Qv();Wc();ZS=class extends tb{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,YS(e);let n=mp(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 ZS(t,e).update(r).digest();yp.create=(t,e)=>new ZS(t,e)});var e5={};Ur(e5,{bitGet:()=>s2e,bitLen:()=>o2e,bitMask:()=>o_,bitSet:()=>a2e,bytesToHex:()=>Rf,bytesToNumberBE:()=>Df,bytesToNumberLE:()=>Gd,concatBytes:()=>Mf,createHmacDrbg:()=>p9,ensureBytes:()=>Cn,equalBytes:()=>n2e,hexToBytes:()=>Vy,hexToNumber:()=>h9,isBytes:()=>Hd,numberToBytesBE:()=>Ea,numberToBytesLE:()=>Bf,numberToHexUnpadded:()=>fW,numberToVarBytesBE:()=>r2e,utf8ToBytes:()=>i2e,validateObject:()=>Vc});function Hd(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function Rf(t){if(!Hd(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r=kf._0&&t<=kf._9)return t-kf._0;if(t>=kf._A&&t<=kf._F)return t-(kf._A-10);if(t>=kf._a&&t<=kf._f)return t-(kf._a-10)}function Vy(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;ilW;t>>=QS,e+=1);return e}function s2e(t,e){return t>>BigInt(e)&QS}function p9(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=f9(t),i=f9(t),o=0,s=()=>{n.fill(1),i.fill(0),o=0},a=(...l)=>r(i,n,...l),d=(l=f9())=>{i=a(uW([0]),l),n=a(),l.length!==0&&(i=a(uW([1]),l),n=a())},u=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let l=0,m=[];for(;l{s(),d(l);let p;for(;!(p=m(u()));)d();return s(),p}}function Vc(t,e,r={}){let n=(i,o,s)=>{let a=c2e[o];if(typeof a!="function")throw new Error(`Invalid validator "${o}", expected function`);let d=t[i];if(!(s&&d===void 0)&&!a(d,t))throw new Error(`Invalid param ${String(i)}=${d} (${typeof d}), 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 lW,QS,e2e,t2e,kf,a2e,o_,f9,uW,c2e,il=le(()=>{h();lW=BigInt(0),QS=BigInt(1),e2e=BigInt(2);t2e=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));kf={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};a2e=(t,e,r)=>t|(r?QS:lW)<(e2e<new Uint8Array(t),uW=t=>Uint8Array.from(t);c2e={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"||Hd(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 en(t,e){let r=t%e;return r>=Wi?r:e+r}function y9(t,e,r){if(r<=Wi||e 0");if(r===Un)return Wi;let n=Un;for(;e>Wi;)e&Un&&(n=n*t%r),t=t*t%r,e>>=Un;return n}function On(t,e,r){let n=t;for(;e-- >Wi;)n*=n,n%=r;return n}function t5(t,e){if(t===Wi||e<=Wi)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=en(t,e),n=e,i=Wi,o=Un,s=Un,a=Wi;for(;r!==Wi;){let u=n/r,c=n%r,l=i-s*u,m=o-a*u;n=r,r=c,i=s,o=a,s=l,a=m}if(n!==Un)throw new Error("invert: does not exist");return en(i,e)}function f2e(t){let e=(t-Un)/Hy,r,n,i;for(r=t-Un,n=0;r%Hy===Wi;r/=Hy,n++);for(i=Hy;i(n[i]="function",n),e);return Vc(t,r)}function m2e(t,e,r){if(r 0");if(r===Wi)return t.ONE;if(r===Un)return e;let n=t.ONE,i=e;for(;r>Wi;)r&Un&&(n=t.mul(n,i)),i=t.sqr(i),r>>=Un;return n}function y2e(t,e){let r=new Array(e.length),n=e.reduce((o,s,a)=>t.is0(s)?o:(r[a]=o,t.mul(o,s)),t.ONE),i=t.inv(n);return e.reduceRight((o,s,a)=>t.is0(s)?o:(r[a]=t.mul(o,r[a]),t.mul(o,s)),i),r}function v9(t,e){let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function nb(t,e,r=!1,n={}){if(t<=Wi)throw new Error(`Expected Field ORDER > 0, got ${t}`);let{nBitLength:i,nByteLength:o}=v9(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");let s=h2e(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:o_(i),ZERO:Wi,ONE:Un,create:d=>en(d,t),isValid:d=>{if(typeof d!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof d}`);return Wi<=d&&dd===Wi,isOdd:d=>(d&Un)===Un,neg:d=>en(-d,t),eql:(d,u)=>d===u,sqr:d=>en(d*d,t),add:(d,u)=>en(d+u,t),sub:(d,u)=>en(d-u,t),mul:(d,u)=>en(d*u,t),pow:(d,u)=>m2e(a,d,u),div:(d,u)=>en(d*t5(u,t),t),sqrN:d=>d*d,addN:(d,u)=>d+u,subN:(d,u)=>d-u,mulN:(d,u)=>d*u,inv:d=>t5(d,t),sqrt:n.sqrt||(d=>s(a,d)),invertBatch:d=>y2e(a,d),cmov:(d,u,c)=>c?u:d,toBytes:d=>r?Bf(d,o):Ea(d,o),fromBytes:d=>{if(d.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${d.length}`);return r?Gd(d):Df(d)}});return Object.freeze(a)}function yW(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 gW(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 b9(t){let e=gW(t);return e+Math.ceil(e/2)}function vW(t,e,r=!1){let n=t.length,i=gW(e),o=b9(e);if(n<16||n1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);let s=r?Df(t):Gd(t),a=en(s,e-Un)+Un;return r?Bf(a,i):Ea(a,i)}var Wi,Un,Hy,d2e,m9,hW,pW,u2e,l2e,mW,p2e,gp=le(()=>{h();il();Wi=BigInt(0),Un=BigInt(1),Hy=BigInt(2),d2e=BigInt(3),m9=BigInt(4),hW=BigInt(5),pW=BigInt(8),u2e=BigInt(9),l2e=BigInt(16);mW=(t,e)=>(en(t,e)&Un)===Un,p2e=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"]});function r5(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,a=i;for(;o>v2e;)o&w9&&(s=s.add(a)),a=a.double(),o>>=w9;return s},precomputeWindow(i,o){let{windows:s,windowSize:a}=n(o),d=[],u=i,c=u;for(let l=0;l>=p,E>d&&(E-=m,s+=w9);let A=v,P=v+Math.abs(E)-1,I=g%2!==0,$=E<0;E===0?c=c.add(r(I,o[A])):u=u.add(r($,o[P]))}return{p:u,f:c}},wNAFCached(i,o,s,a){let d=i._WINDOW_SIZE||1,u=o.get(i);return u||(u=this.precomputeWindow(i,d),d!==1&&o.set(i,a(u))),this.wNAF(d,u,s)}}}function s_(t){return g9(t.Fp),Vc(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...v9(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}var v2e,w9,_9=le(()=>{h();gp();il();v2e=BigInt(0),w9=BigInt(1)});function b2e(t){let e=s_(t);Vc(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})}function x2e(t){let e=b2e(t),{Fp:r}=e,n=e.toBytes||((g,v,E)=>{let A=v.toAffine();return Mf(Uint8Array.from([4]),r.toBytes(A.x),r.toBytes(A.y))}),i=e.fromBytes||(g=>{let v=g.subarray(1),E=r.fromBytes(v.subarray(0,r.BYTES)),A=r.fromBytes(v.subarray(r.BYTES,2*r.BYTES));return{x:E,y:A}});function o(g){let{a:v,b:E}=e,A=r.sqr(g),P=r.mul(A,g);return r.add(r.add(P,r.mul(g,v)),E)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(g){return typeof g=="bigint"&&Cfr.eql(I,r.ZERO);return P(E)&&P(A)?l.ZERO:new l(E,A,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(v){let E=r.invertBatch(v.map(A=>A.pz));return v.map((A,P)=>A.toAffine(E[P])).map(l.fromAffine)}static fromHex(v){let E=l.fromAffine(i(Cn("pointHex",v)));return E.assertValidity(),E}static fromPrivateKey(v){return l.BASE.multiply(d(v))}_setWindowSize(v){this._WINDOW_SIZE=v,u.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:v,y:E}=this.toAffine();if(!r.isValid(v)||!r.isValid(E))throw new Error("bad point: x or y not FE");let A=r.sqr(E),P=o(v);if(!r.eql(A,P))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:v}=this.toAffine();if(r.isOdd)return!r.isOdd(v);throw new Error("Field doesn't support isOdd")}equals(v){c(v);let{px:E,py:A,pz:P}=this,{px:I,py:$,pz:N}=v,K=r.eql(r.mul(E,N),r.mul(I,P)),F=r.eql(r.mul(A,N),r.mul($,P));return K&&F}negate(){return new l(this.px,r.neg(this.py),this.pz)}double(){let{a:v,b:E}=e,A=r.mul(E,bW),{px:P,py:I,pz:$}=this,N=r.ZERO,K=r.ZERO,F=r.ZERO,U=r.mul(P,P),W=r.mul(I,I),L=r.mul($,$),T=r.mul(P,I);return T=r.add(T,T),F=r.mul(P,$),F=r.add(F,F),N=r.mul(v,F),K=r.mul(A,L),K=r.add(N,K),N=r.sub(W,K),K=r.add(W,K),K=r.mul(N,K),N=r.mul(T,N),F=r.mul(A,F),L=r.mul(v,L),T=r.sub(U,L),T=r.mul(v,T),T=r.add(T,F),F=r.add(U,U),U=r.add(F,U),U=r.add(U,L),U=r.mul(U,T),K=r.add(K,U),L=r.mul(I,$),L=r.add(L,L),U=r.mul(L,T),N=r.sub(N,U),F=r.mul(L,W),F=r.add(F,F),F=r.add(F,F),new l(N,K,F)}add(v){c(v);let{px:E,py:A,pz:P}=this,{px:I,py:$,pz:N}=v,K=r.ZERO,F=r.ZERO,U=r.ZERO,W=e.a,L=r.mul(e.b,bW),T=r.mul(E,I),S=r.mul(A,$),k=r.mul(P,N),f=r.add(E,A),y=r.add(I,$);f=r.mul(f,y),y=r.add(T,S),f=r.sub(f,y),y=r.add(E,P);let w=r.add(I,N);return y=r.mul(y,w),w=r.add(T,k),y=r.sub(y,w),w=r.add(A,P),K=r.add($,N),w=r.mul(w,K),K=r.add(S,k),w=r.sub(w,K),U=r.mul(W,y),K=r.mul(L,k),U=r.add(K,U),K=r.sub(S,U),U=r.add(S,U),F=r.mul(K,U),S=r.add(T,T),S=r.add(S,T),k=r.mul(W,k),y=r.mul(L,y),S=r.add(S,k),k=r.sub(T,k),k=r.mul(W,k),y=r.add(y,k),T=r.mul(S,y),F=r.add(F,T),T=r.mul(w,y),K=r.mul(f,K),K=r.sub(K,T),T=r.mul(f,S),U=r.mul(w,U),U=r.add(U,T),new l(K,F,U)}subtract(v){return this.add(v.negate())}is0(){return this.equals(l.ZERO)}wNAF(v){return p.wNAFCached(this,u,v,E=>{let A=r.invertBatch(E.map(P=>P.pz));return E.map((P,I)=>P.toAffine(A[I])).map(l.fromAffine)})}multiplyUnsafe(v){let E=l.ZERO;if(v===Cf)return E;if(a(v),v===Hc)return this;let{endo:A}=e;if(!A)return p.unsafeLadder(this,v);let{k1neg:P,k1:I,k2neg:$,k2:N}=A.splitScalar(v),K=E,F=E,U=this;for(;I>Cf||N>Cf;)I&Hc&&(K=K.add(U)),N&Hc&&(F=F.add(U)),U=U.double(),I>>=Hc,N>>=Hc;return P&&(K=K.negate()),$&&(F=F.negate()),F=new l(r.mul(F.px,A.beta),F.py,F.pz),K.add(F)}multiply(v){a(v);let E=v,A,P,{endo:I}=e;if(I){let{k1neg:$,k1:N,k2neg:K,k2:F}=I.splitScalar(E),{p:U,f:W}=this.wNAF(N),{p:L,f:T}=this.wNAF(F);U=p.constTimeNegate($,U),L=p.constTimeNegate(K,L),L=new l(r.mul(L.px,I.beta),L.py,L.pz),A=U.add(L),P=W.add(T)}else{let{p:$,f:N}=this.wNAF(E);A=$,P=N}return l.normalizeZ([A,P])[0]}multiplyAndAddUnsafe(v,E,A){let P=l.BASE,I=(N,K)=>K===Cf||K===Hc||!N.equals(P)?N.multiplyUnsafe(K):N.multiply(K),$=I(this,E).add(I(v,A));return $.is0()?void 0:$}toAffine(v){let{px:E,py:A,pz:P}=this,I=this.is0();v==null&&(v=I?r.ONE:r.inv(P));let $=r.mul(E,v),N=r.mul(A,v),K=r.mul(P,v);if(I)return{x:r.ZERO,y:r.ZERO};if(!r.eql(K,r.ONE))throw new Error("invZ was invalid");return{x:$,y:N}}isTorsionFree(){let{h:v,isTorsionFree:E}=e;if(v===Hc)return!0;if(E)return E(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:v,clearCofactor:E}=e;return v===Hc?this:E?E(l,this):this.multiplyUnsafe(e.h)}toRawBytes(v=!0){return this.assertValidity(),n(l,this,v)}toHex(v=!0){return Rf(this.toRawBytes(v))}}l.BASE=new l(e.Gx,e.Gy,r.ONE),l.ZERO=new l(r.ZERO,r.ONE,r.ZERO);let m=e.nBitLength,p=r5(l,e.endo?Math.ceil(m/2):m);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:d,weierstrassEquation:o,isWithinCurveOrder:s}}function E2e(t){let e=s_(t);return Vc(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function wW(t){let e=E2e(t),{Fp:r,n}=e,i=r.BYTES+1,o=2*r.BYTES+1;function s(y){return CfRf(Ea(y,e.nByteLength));function g(y){let w=n>>Hc;return y>w}function v(y){return g(y)?a(-y):y}let E=(y,w,_)=>Df(y.slice(w,_));class A{constructor(w,_,x){this.r=w,this.s=_,this.recovery=x,this.assertValidity()}static fromCompact(w){let _=e.nByteLength;return w=Cn("compactSignature",w,_*2),new A(E(w,0,_),E(w,_,2*_))}static fromDER(w){let{r:_,s:x}=Gy.toSig(Cn("DER",w));return new A(_,x)}assertValidity(){if(!m(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!m(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(w){return new A(this.r,this.s,w)}recoverPublicKey(w){let{r:_,s:x,recovery:b}=this,B=F(Cn("msgHash",w));if(b==null||![0,1,2,3].includes(b))throw new Error("recovery id invalid");let q=b===2||b===3?_+e.n:_;if(q>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let M=b&1?"03":"02",j=u.fromHex(M+p(q)),J=d(q),Z=a(-B*J),G=a(x*J),H=u.BASE.multiplyAndAddUnsafe(j,Z,G);if(!H)throw new Error("point at infinify");return H.assertValidity(),H}hasHighS(){return g(this.s)}normalizeS(){return this.hasHighS()?new A(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Vy(this.toDERHex())}toDERHex(){return Gy.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Vy(this.toCompactHex())}toCompactHex(){return p(this.r)+p(this.s)}}let P={isValidPrivateKey(y){try{return c(y),!0}catch{return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{let y=b9(e.n);return vW(e.randomBytes(y),e.n)},precompute(y=8,w=u.BASE){return w._setWindowSize(y),w.multiply(BigInt(3)),w}};function I(y,w=!0){return u.fromPrivateKey(y).toRawBytes(w)}function $(y){let w=Hd(y),_=typeof y=="string",x=(w||_)&&y.length;return w?x===i||x===o:_?x===2*i||x===2*o:y instanceof u}function N(y,w,_=!0){if($(y))throw new Error("first arg must be private key");if(!$(w))throw new Error("second arg must be public key");return u.fromHex(w).multiply(c(y)).toRawBytes(_)}let K=e.bits2int||function(y){let w=Df(y),_=y.length*8-e.nBitLength;return _>0?w>>BigInt(_):w},F=e.bits2int_modN||function(y){return a(K(y))},U=o_(e.nBitLength);function W(y){if(typeof y!="bigint")throw new Error("bigint expected");if(!(Cf<=y&&yee in _))throw new Error("sign() legacy options not supported");let{hash:x,randomBytes:b}=e,{lowS:B,prehash:q,extraEntropy:M}=_;B==null&&(B=!0),y=Cn("msgHash",y),q&&(y=Cn("prehashed msgHash",x(y)));let j=F(y),J=c(w),Z=[W(J),W(j)];if(M!=null){let ee=M===!0?b(r.BYTES):M;Z.push(Cn("extraEntropy",ee))}let G=Mf(...Z),H=j;function X(ee){let ue=K(ee);if(!m(ue))return;let ae=d(ue),ce=u.BASE.multiply(ue).toAffine(),me=a(ce.x);if(me===Cf)return;let Ee=a(ae*a(H+me*J));if(Ee===Cf)return;let qe=(ce.x===me?0:2)|Number(ce.y&Hc),fe=Ee;return B&&g(Ee)&&(fe=v(Ee),qe^=1),new A(me,fe,qe)}return{seed:G,k2sig:X}}let T={lowS:e.lowS,prehash:!1},S={lowS:e.lowS,prehash:!1};function k(y,w,_=T){let{seed:x,k2sig:b}=L(y,w,_),B=e;return p9(B.hash.outputLen,B.nByteLength,B.hmac)(x,b)}u.BASE._setWindowSize(8);function f(y,w,_,x=S){let b=y;if(w=Cn("msgHash",w),_=Cn("publicKey",_),"strict"in x)throw new Error("options.strict was renamed to lowS");let{lowS:B,prehash:q}=x,M,j;try{if(typeof b=="string"||Hd(b))try{M=A.fromDER(b)}catch(ce){if(!(ce instanceof Gy.Err))throw ce;M=A.fromCompact(b)}else if(typeof b=="object"&&typeof b.r=="bigint"&&typeof b.s=="bigint"){let{r:ce,s:me}=b;M=new A(ce,me)}else throw new Error("PARSE");j=u.fromHex(_)}catch(ce){if(ce.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(B&&M.hasHighS())return!1;q&&(w=e.hash(w));let{r:J,s:Z}=M,G=F(w),H=d(Z),X=a(G*H),ee=a(J*H),ue=u.BASE.multiplyAndAddUnsafe(j,X,ee)?.toAffine();return ue?a(ue.x)===J:!1}return{CURVE:e,getPublicKey:I,getSharedSecret:N,sign:k,verify:f,ProjectivePoint:u,Signature:A,utils:P}}var w2e,_2e,Gy,Cf,Hc,Vtt,bW,Htt,_W=le(()=>{h();gp();il();il();_9();({bytesToNumberBE:w2e,hexToBytes:_2e}=e5),Gy={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){let{Err:e}=Gy;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:w2e(n),l:t.subarray(r+2)}},toSig(t){let{Err:e}=Gy,r=typeof t=="string"?_2e(t):t;if(!Hd(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}=Gy._parseInt(r.subarray(2)),{d:s,l:a}=Gy._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){let e=u=>Number.parseInt(u[0],16)&8?"00"+u:u,r=u=>{let c=u.toString(16);return c.length&1?`0${c}`:c},n=e(r(t.s)),i=e(r(t.r)),o=n.length/2,s=i.length/2,a=r(o),d=r(s);return`30${r(s+o+4)}02${d}${i}02${a}${n}`}},Cf=BigInt(0),Hc=BigInt(1),Vtt=BigInt(2),bW=BigInt(3),Htt=BigInt(4)});function S2e(t){return{hash:t,hmac:(e,...r)=>yp(t,e,Wy(...r)),randomBytes:Pf}}function n5(t,e){let r=n=>wW({...t,...S2e(n)});return Object.freeze({...r(e),create:r})}var x9=le(()=>{h();XS();Wc();_W();});function A2e(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),a=Number(r&o),d=n?4:0,u=n?0:4;t.setUint32(e+d,s,n),t.setUint32(e+u,a,n)}var vp,i5=le(()=>{h();Qv();Wc();vp=class extends tb{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=If(this.buffer)}update(e){Xv(this);let{view:r,buffer:n,blockLen:i}=this;e=mp(e);let o=e.length;for(let s=0;si-s&&(this.process(n,0),s=0);for(let l=s;lc.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l{h();i5();Wc();T2e=(t,e,r)=>t&e^~t&r,I2e=(t,e,r)=>t&e^t&r^e&r,P2e=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]),bp=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),wp=new Uint32Array(64),E9=class extends vp{constructor(){super(64,32,8,!1),this.A=bp[0]|0,this.B=bp[1]|0,this.C=bp[2]|0,this.D=bp[3]|0,this.E=bp[4]|0,this.F=bp[5]|0,this.G=bp[6]|0,this.H=bp[7]|0}get(){let{A:e,B:r,C:n,D:i,E:o,F:s,G:a,H:d}=this;return[e,r,n,i,o,s,a,d]}set(e,r,n,i,o,s,a,d){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=a|0,this.H=d|0}process(e,r){for(let l=0;l<16;l++,r+=4)wp[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){let m=wp[l-15],p=wp[l-2],g=Vd(m,7)^Vd(m,18)^m>>>3,v=Vd(p,17)^Vd(p,19)^p>>>10;wp[l]=v+wp[l-7]+g+wp[l-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:d,G:u,H:c}=this;for(let l=0;l<64;l++){let m=Vd(a,6)^Vd(a,11)^Vd(a,25),p=c+m+T2e(a,d,u)+P2e[l]+wp[l]|0,v=(Vd(n,2)^Vd(n,13)^Vd(n,22))+I2e(n,i,o)|0;c=u,u=d,d=a,a=s+p|0,s=o,o=i,i=n,n=p+v|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,d=d+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(n,i,o,s,a,d,u,c)}roundClean(){wp.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},ws=rb(()=>new E9)});var xW,k2e,R2e,Of,Ys,S9=le(()=>{h();x9();_p();gp();xW=nb(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),k2e=xW.create(BigInt("-3")),R2e=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Of=n5({a:k2e,b:R2e,Fp:xW,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},ws),Ys=Of});function D2e(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,$=new Uint8Array(I);A!==P;){for(var N=g[A],K=0,F=I-1;(N!==0||K>>0,$[F]=N%a>>>0,N=N/a>>>0;if(N!==0)throw new Error("Non-zero carry");E=K,A++}for(var U=I-E;U!==I&&$[U]===0;)U++;for(var W=d.repeat(v);U>>0,I=new Uint8Array(P);g[v];){var $=r[g.charCodeAt(v)];if($===255)return;for(var N=0,K=P-1;($!==0||N>>0,I[K]=$%256>>>0,$=$/256>>>0;if($!==0)throw new Error("Non-zero carry");A=N,v++}if(g[v]!==" "){for(var F=P-A;F!==P&&I[F]===0;)F++;for(var U=new Uint8Array(E+(P-F)),W=E;F!==P;)U[W++]=I[F++];return U}}}function p(g){var v=m(g);if(v)return v;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:m,decode:p}}var B2e,M2e,EW,SW=le(()=>{h();B2e=D2e,M2e=B2e,EW=M2e});var krt,AW,$f,TW,IW,xp=le(()=>{h();krt=new Uint8Array(0),AW=(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")},TW=t=>new TextEncoder().encode(t),IW=t=>new TextDecoder().decode(t)});var kW=le(()=>{h()});var A9,T9,I9,RW,P9,ob,Ep,C2e,O2e,ai,Jd=le(()=>{h();SW();xp();kW();A9=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")}},T9=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 RW(this,e)}},I9=class{constructor(e){this.decoders=e}or(e){return RW(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`)}},RW=(t,e)=>new I9({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),P9=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new A9(e,r,n),this.decoder=new T9(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},ob=({name:t,prefix:e,encode:r,decode:n})=>new P9(t,e,r,n),Ep=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=EW(r,e);return ob({prefix:t,name:e,encode:n,decode:o=>$f(i(o))})},C2e=(t,e,r,n)=>{let i={};for(let c=0;c=8&&(a-=8,s[u++]=255&d>>a)}if(a>=r||255&d<<8-a)throw new SyntaxError("Unexpected end of data");return s},O2e=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)s-=r,o+=e[i&a>>s];if(s&&(o+=e[i&a<ob({prefix:e,name:t,encode(i){return O2e(i,n,r)},decode(i){return C2e(i,n,r,t)}})});var $9={};Ur($9,{base64:()=>r_e,base64pad:()=>n_e,base64url:()=>ab,base64urlpad:()=>i_e});var r_e,n_e,ab,i_e,a_=le(()=>{h();Jd();r_e=ai({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),n_e=ai({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ab=ai({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),i_e=ai({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});function CW(t,e,r){e=e||[],r=r||0;for(var n=r;t>=f_e;)e[r++]=t&255|BW,t/=128;for(;t&l_e;)e[r++]=t&255|BW,t>>>=7;return e[r]=t|0,CW.bytes=r-n+1,e}function U9(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw U9.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&MW)<=p_e);return U9.bytes=o-n,r}var d_e,BW,u_e,l_e,f_e,h_e,p_e,MW,m_e,y_e,g_e,v_e,b_e,w_e,__e,x_e,E_e,S_e,A_e,T_e,c_,OW=le(()=>{h();d_e=CW,BW=128,u_e=127,l_e=~u_e,f_e=Math.pow(2,31);h_e=U9,p_e=128,MW=127;m_e=Math.pow(2,7),y_e=Math.pow(2,14),g_e=Math.pow(2,21),v_e=Math.pow(2,28),b_e=Math.pow(2,35),w_e=Math.pow(2,42),__e=Math.pow(2,49),x_e=Math.pow(2,56),E_e=Math.pow(2,63),S_e=function(t){return t{h();OW();d_=(t,e=0)=>[c_.decode(t,e),c_.decode.bytes],cb=(t,e,r=0)=>(c_.encode(t,e,r),e),db=t=>c_.encodingLength(t)});var Jy,c5,$W,ub,lb=le(()=>{h();xp();a5();Jy=(t,e)=>{let r=e.byteLength,n=db(t),i=n+db(r),o=new Uint8Array(i+r);return cb(t,o,0),cb(r,o,n),o.set(e,i),new ub(t,r,e,o)},c5=t=>{let e=$f(t),[r,n]=d_(e),[i,o]=d_(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new ub(r,i,s,e)},$W=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&AW(t.bytes,r.bytes)}},ub=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var K9,L9,F9=le(()=>{h();lb();K9=({name:t,code:e,encode:r})=>new L9(t,e,r),L9=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?Jy(this.code,r):r.then(n=>Jy(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var z9={};Ur(z9,{sha256:()=>l_,sha512:()=>R_e});var qW,l_,R_e,d5=le(()=>{h();F9();qW=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),l_=K9({name:"sha2-256",code:18,encode:qW("SHA-256")}),R_e=K9({name:"sha2-512",code:19,encode:qW("SHA-512")})});var Sa,hst,f7=le(()=>{h();CS();Sa=NR({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),hst=NR({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var A_,gst,vst,bst,wst,_st,xst,Est,h7,p7=le(()=>{h();CS();A_=Hs({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),gst=Hs({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),vst=Hs({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),bst=Hs({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),wst=Hs({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),_st=Hs({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),xst=Hs({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Est=Hs({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),h7=Hs({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var m7=le(()=>{h()});var bH,wH,y7,qr,lEe,fEe,hEe,T_,pEe,_H,mEe,Uf=le(()=>{h();GS();Zv();f7();p7();Uy();m7();m7();bH=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return fEe(r,y7(t),e||Sa.encoder);default:return hEe(r,y7(t),e||A_.encoder)}},wH=new WeakMap,y7=t=>{let e=wH.get(t);if(e==null){let r=new Map;return wH.set(t,r),r}return e},qr=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!==T_)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==pEe)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=zy(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&&rW(e.multihash,n.multihash)}toString(e){return bH(this,e)}toJSON(){return{"/":bH(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||_H(n,i,o.bytes))}else if(r[mEe]===!0){let{version:n,multihash:i,code:o}=r,s=JS(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!==T_)throw new Error(`Version 0 CID must use dag-pb (code: ${T_}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=_H(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,T_,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=Wd(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 Yv(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,m]=Jv(e.subarray(r));return r+=m,l},i=n(),o=T_;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),d=n(),u=r+d,c=u-s;return{version:i,codec:o,multihashCode:a,digestSize:d,multihashSize:c,size:u}}static parse(e,r){let[n,i]=lEe(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 y7(o).set(n,e),o}},lEe=(t,e)=>{switch(t[0]){case"Q":{let r=e||Sa;return[Sa.prefix,r.decode(`${Sa.prefix}${t}`)]}case Sa.prefix:{let r=e||Sa;return[Sa.prefix,r.decode(t)]}case A_.prefix:{let r=e||A_;return[A_.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)]}}},fEe=(t,e,r)=>{let{prefix:n}=r;if(n!==Sa.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},hEe=(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},T_=112,pEe=18,_H=(t,e,r)=>{let n=Fy(t),i=n+Fy(e),o=new Uint8Array(i+r.byteLength);return Ky(t,o,0),Ky(e,o,n),o.set(r,i),o},mEe=Symbol.for("@ipld/js-cid/CID")});var g7=le(()=>{h()});var I_=le(()=>{h();Uf();GS();Uy();c9();Zv();g7()});var sc=V((Kst,EH)=>{"use strict";h();function xH(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function yEe(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return xH(t,r)}catch{r.message=t.message,r.stack=t.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(t)),xH(new i,r)}}EH.exports=yEe});var PG=V((V_,j5)=>{h();(function(t,e){"use strict";var r={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function n(p){if(!Array.isArray(p)&&!ArrayBuffer.isView(p))return!1;for(var g=0;g255)return!1;return!0}function i(p,g){return(p&65535)*g+(((p>>>16)*g&65535)<<16)}function o(p,g){return p<>>32-g}function s(p){return p^=p>>>16,p=i(p,2246822507),p^=p>>>13,p=i(p,3266489909),p^=p>>>16,p}function a(p,g){p=[p[0]>>>16,p[0]&65535,p[1]>>>16,p[1]&65535],g=[g[0]>>>16,g[0]&65535,g[1]>>>16,g[1]&65535];var v=[0,0,0,0];return v[3]+=p[3]+g[3],v[2]+=v[3]>>>16,v[3]&=65535,v[2]+=p[2]+g[2],v[1]+=v[2]>>>16,v[2]&=65535,v[1]+=p[1]+g[1],v[0]+=v[1]>>>16,v[1]&=65535,v[0]+=p[0]+g[0],v[0]&=65535,[v[0]<<16|v[1],v[2]<<16|v[3]]}function d(p,g){p=[p[0]>>>16,p[0]&65535,p[1]>>>16,p[1]&65535],g=[g[0]>>>16,g[0]&65535,g[1]>>>16,g[1]&65535];var v=[0,0,0,0];return v[3]+=p[3]*g[3],v[2]+=v[3]>>>16,v[3]&=65535,v[2]+=p[2]*g[3],v[1]+=v[2]>>>16,v[2]&=65535,v[2]+=p[3]*g[2],v[1]+=v[2]>>>16,v[2]&=65535,v[1]+=p[1]*g[3],v[0]+=v[1]>>>16,v[1]&=65535,v[1]+=p[2]*g[2],v[0]+=v[1]>>>16,v[1]&=65535,v[1]+=p[3]*g[1],v[0]+=v[1]>>>16,v[1]&=65535,v[0]+=p[0]*g[3]+p[1]*g[2]+p[2]*g[1]+p[3]*g[0],v[0]&=65535,[v[0]<<16|v[1],v[2]<<16|v[3]]}function u(p,g){return g%=64,g===32?[p[1],p[0]]:g<32?[p[0]<>>32-g,p[1]<>>32-g]:(g-=32,[p[1]<>>32-g,p[0]<>>32-g])}function c(p,g){return g%=64,g===0?p:g<32?[p[0]<>>32-g,p[1]<>>1]),p=d(p,[4283543511,3981806797]),p=l(p,[0,p[0]>>>1]),p=d(p,[3301882366,444984403]),p=l(p,[0,p[0]>>>1]),p}r.x86.hash32=function(p,g){if(r.inputValidation&&!n(p))return e;g=g||0;for(var v=p.length%4,E=p.length-v,A=g,P=0,I=3432918353,$=461845907,N=0;N>>0},r.x86.hash128=function(p,g){if(r.inputValidation&&!n(p))return e;g=g||0;for(var v=p.length%16,E=p.length-v,A=g,P=g,I=g,$=g,N=0,K=0,F=0,U=0,W=597399067,L=2869860233,T=951274213,S=2716044179,k=0;k>>0).toString(16)).slice(-8)+("00000000"+(P>>>0).toString(16)).slice(-8)+("00000000"+(I>>>0).toString(16)).slice(-8)+("00000000"+($>>>0).toString(16)).slice(-8)},r.x64.hash128=function(p,g){if(r.inputValidation&&!n(p))return e;g=g||0;for(var v=p.length%16,E=p.length-v,A=[0,g],P=[0,g],I=[0,0],$=[0,0],N=[2277735313,289559509],K=[1291169091,658871167],F=0;F>>0).toString(16)).slice(-8)+("00000000"+(A[1]>>>0).toString(16)).slice(-8)+("00000000"+(P[0]>>>0).toString(16)).slice(-8)+("00000000"+(P[1]>>>0).toString(16)).slice(-8)},typeof V_<"u"?(typeof j5<"u"&&j5.exports&&(V_=j5.exports=r),V_.murmurHash3=r):typeof define=="function"&&define.amd?define([],function(){return r}):(r._murmurHash3=t.murmurHash3,r.noConflict=function(){return t.murmurHash3=r._murmurHash3,r._murmurHash3=e,r.noConflict=e,r},t.murmurHash3=r)})(V_)});var RG=V((nlt,kG)=>{h();kG.exports=PG()});var MG=V((flt,BG)=>{"use strict";h();BG.exports=class{constructor(){this._bitArrays=[],this._data=[],this._length=0,this._changedLength=!1,this._changedData=!1}set(e,r){let n=this._internalPositionFor(e,!1);if(r===void 0)n!==-1&&(this._unsetInternalPos(n),this._unsetBit(e),this._changedLength=!0,this._changedData=!0);else{let i=!1;n===-1?(n=this._data.length,this._setBit(e),this._changedData=!0):i=!0,this._setInternalPos(n,e,r,i),this._changedLength=!0}}unset(e){this.set(e,void 0)}get(e){this._sortData();let r=this._internalPositionFor(e,!0);if(r!==-1)return this._data[r][1]}push(e){return this.set(this.length,e),this.length}get length(){if(this._sortData(),this._changedLength){let e=this._data[this._data.length-1];this._length=e?e[0]+1:0,this._changedLength=!1}return this._length}forEach(e){let r=0;for(;r=this._bitArrays.length)return-1;let i=this._bitArrays[n],o=e-n*7;if(!((i&1<0))return-1;let a=this._bitArrays.slice(0,n).reduce(l3e,0),d=~(4294967295<=r)o.push(s);else if(o[0][0]<=r)o.unshift(s);else{let a=Math.round(o.length/2);this._data=o.slice(0,a).concat(s).concat(o.slice(a))}else this._data.push(s);this._changedData=!0,this._changedLength=!0}}_unsetInternalPos(e){this._data.splice(e,1)}_sortData(){this._changedData&&this._data.sort(f3e),this._changedData=!1}bitField(){let e=[],r=8,n=0,i=0,o,s=this._bitArrays.slice();for(;s.length||n;){n===0&&(o=s.shift(),n=7);let d=Math.min(n,r),u=~(255<>>d,n-=d,r-=d,(!r||!n&&!s.length)&&(e.push(i),i=0,r=8)}for(var a=e.length-1;a>0&&e[a]===0;a--)e.pop();return e}compactArray(){return this._sortData(),this._data.map(h3e)}};function l3e(t,e){return t+DG(e)}function DG(t){let e=t;return e=e-(e>>1&1431655765),e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}function f3e(t,e){return t[0]-e[0]}function h3e(t){return t[1]}});var Fn=V(Ob=>{"use strict";h();var uD=wR(),Mb=xR(),HG=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ob.Buffer=he;Ob.SlowBuffer=D3e;Ob.INSPECT_MAX_BYTES=50;var z5=2147483647;Ob.kMaxLength=z5;he.TYPED_ARRAY_SUPPORT=T3e();!he.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 T3e(){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(he.prototype,"parent",{enumerable:!0,get:function(){if(he.isBuffer(this))return this.buffer}});Object.defineProperty(he.prototype,"offset",{enumerable:!0,get:function(){if(he.isBuffer(this))return this.byteOffset}});function Kf(t){if(t>z5)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,he.prototype),e}function he(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 pD(t)}return ZG(t,e,r)}he.poolSize=8192;function ZG(t,e,r){if(typeof t=="string")return P3e(t,e);if(ArrayBuffer.isView(t))return k3e(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(hl(t,ArrayBuffer)||t&&hl(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(hl(t,SharedArrayBuffer)||t&&hl(t.buffer,SharedArrayBuffer)))return fD(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 he.from(n,e,r);let i=R3e(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return he.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)}he.from=function(t,e,r){return ZG(t,e,r)};Object.setPrototypeOf(he.prototype,Uint8Array.prototype);Object.setPrototypeOf(he,Uint8Array);function XG(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 I3e(t,e,r){return XG(t),t<=0?Kf(t):e!==void 0?typeof r=="string"?Kf(t).fill(e,r):Kf(t).fill(e):Kf(t)}he.alloc=function(t,e,r){return I3e(t,e,r)};function pD(t){return XG(t),Kf(t<0?0:mD(t)|0)}he.allocUnsafe=function(t){return pD(t)};he.allocUnsafeSlow=function(t){return pD(t)};function P3e(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!he.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=QG(t,e)|0,n=Kf(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function lD(t){let e=t.length<0?0:mD(t.length)|0,r=Kf(e);for(let n=0;n=z5)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+z5.toString(16)+" bytes");return t|0}function D3e(t){return+t!=t&&(t=0),he.alloc(+t)}he.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==he.prototype};he.compare=function(e,r){if(hl(e,Uint8Array)&&(e=he.from(e,e.offset,e.byteLength)),hl(r,Uint8Array)&&(r=he.from(r,r.offset,r.byteLength)),!he.isBuffer(e)||!he.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?(he.isBuffer(s)||(s=he.from(s)),s.copy(i,o)):Uint8Array.prototype.set.call(i,s,o);else if(he.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function QG(t,e){if(he.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||hl(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 hD(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return cJ(t).length;default:if(i)return n?-1:hD(t).length;e=(""+e).toLowerCase(),i=!0}}he.byteLength=QG;function B3e(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 K3e(this,e,r);case"utf8":case"utf-8":return tJ(this,e,r);case"ascii":return q3e(this,e,r);case"latin1":case"binary":return L3e(this,e,r);case"base64":return j3e(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F3e(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}he.prototype._isBuffer=!0;function f0(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}he.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+=" ... "),""};HG&&(he.prototype[HG]=he.prototype.inspect);he.prototype.compare=function(e,r,n,i,o){if(hl(e,Uint8Array)&&(e=he.from(e,e.offset,e.byteLength)),!he.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;let s=o-i,a=n-r,d=Math.min(s,a),u=this.slice(i,o),c=e.slice(r,n);for(let l=0;l2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,gD(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=he.from(e,n)),he.isBuffer(e))return e.length===0?-1:GG(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):GG(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function GG(t,e,r,n,i){let o=1,s=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,s/=2,a/=2,r/=2}function d(c,l){return o===1?c[l]:c.readUInt16BE(l*o)}let u;if(i){let c=-1;for(u=r;us&&(r=s-a),u=r;u>=0;u--){let c=!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 M3e(this,e,r,n);case"utf8":case"utf-8":return C3e(this,e,r,n);case"ascii":case"latin1":case"binary":return O3e(this,e,r,n);case"base64":return $3e(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N3e(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};he.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function j3e(t,e,r){return e===0&&r===t.length?uD.fromByteArray(t):uD.fromByteArray(t.slice(e,r))}function tJ(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+a<=r){let d,u,c,l;switch(a){case 1:o<128&&(s=o);break;case 2:d=t[i+1],(d&192)===128&&(l=(o&31)<<6|d&63,l>127&&(s=l));break;case 3:d=t[i+1],u=t[i+2],(d&192)===128&&(u&192)===128&&(l=(o&15)<<12|(d&63)<<6|u&63,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:d=t[i+1],u=t[i+2],c=t[i+3],(d&192)===128&&(u&192)===128&&(c&192)===128&&(l=(o&15)<<18|(d&63)<<12|(u&63)<<6|c&63,l>65535&&l<1114112&&(s=l))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=a}return U3e(n)}var JG=4096;function U3e(t){let e=t.length;if(e<=JG)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")}he.prototype.readUintLE=he.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||go(e,r,this.length);let i=this[e],o=1,s=0;for(;++s>>0,r=r>>>0,n||go(e,r,this.length);let i=this[e+--r],o=1;for(;r>0&&(o*=256);)i+=this[e+--r]*o;return i};he.prototype.readUint8=he.prototype.readUInt8=function(e,r){return e=e>>>0,r||go(e,1,this.length),this[e]};he.prototype.readUint16LE=he.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||go(e,2,this.length),this[e]|this[e+1]<<8};he.prototype.readUint16BE=he.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||go(e,2,this.length),this[e]<<8|this[e+1]};he.prototype.readUint32LE=he.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||go(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};he.prototype.readUint32BE=he.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||go(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};he.prototype.readBigUInt64LE=Op(function(e){e=e>>>0,Cb(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&G_(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,Cb(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&G_(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||go(e,r,this.length);let i=this[e],o=1,s=0;for(;++s=o&&(i-=Math.pow(2,8*r)),i};he.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||go(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};he.prototype.readInt8=function(e,r){return e=e>>>0,r||go(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};he.prototype.readInt16LE=function(e,r){e=e>>>0,r||go(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};he.prototype.readInt16BE=function(e,r){e=e>>>0,r||go(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};he.prototype.readInt32LE=function(e,r){return e=e>>>0,r||go(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};he.prototype.readInt32BE=function(e,r){return e=e>>>0,r||go(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};he.prototype.readBigInt64LE=Op(function(e){e=e>>>0,Cb(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&G_(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,Cb(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&G_(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||go(e,4,this.length),Mb.read(this,e,!0,23,4)};he.prototype.readFloatBE=function(e,r){return e=e>>>0,r||go(e,4,this.length),Mb.read(this,e,!1,23,4)};he.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||go(e,8,this.length),Mb.read(this,e,!0,52,8)};he.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||go(e,8,this.length),Mb.read(this,e,!1,52,8)};function Ta(t,e,r,n,i,o){if(!he.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}he.prototype.writeUintLE=he.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;Ta(this,e,r,n,a,0)}let o=1,s=0;for(this[r]=e&255;++s>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;Ta(this,e,r,n,a,0)}let o=n-1,s=1;for(this[r+o]=e&255;--o>=0&&(s*=256);)this[r+o]=e/s&255;return r+n};he.prototype.writeUint8=he.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Ta(this,e,r,1,255,0),this[r]=e&255,r+1};he.prototype.writeUint16LE=he.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Ta(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};he.prototype.writeUint16BE=he.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Ta(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};he.prototype.writeUint32LE=he.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Ta(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};he.prototype.writeUint32BE=he.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Ta(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 rJ(t,e,r,n,i){aJ(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 nJ(t,e,r,n,i){aJ(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}he.prototype.writeBigUInt64LE=Op(function(e,r=0){return rJ(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});he.prototype.writeBigUInt64BE=Op(function(e,r=0){return nJ(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});he.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let d=Math.pow(2,8*n-1);Ta(this,e,r,n,d-1,-d)}let o=0,s=1,a=0;for(this[r]=e&255;++o>0)-a&255;return r+n};he.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let d=Math.pow(2,8*n-1);Ta(this,e,r,n,d-1,-d)}let o=n-1,s=1,a=0;for(this[r+o]=e&255;--o>=0&&(s*=256);)e<0&&a===0&&this[r+o+1]!==0&&(a=1),this[r+o]=(e/s>>0)-a&255;return r+n};he.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Ta(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};he.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Ta(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};he.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Ta(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};he.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Ta(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};he.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Ta(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};he.prototype.writeBigInt64LE=Op(function(e,r=0){return rJ(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});he.prototype.writeBigInt64BE=Op(function(e,r=0){return nJ(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function iJ(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 oJ(t,e,r,n,i){return e=+e,r=r>>>0,i||iJ(t,e,r,4,34028234663852886e22,-34028234663852886e22),Mb.write(t,e,r,n,23,4),r+4}he.prototype.writeFloatLE=function(e,r,n){return oJ(this,e,r,!0,n)};he.prototype.writeFloatBE=function(e,r,n){return oJ(this,e,r,!1,n)};function sJ(t,e,r,n,i){return e=+e,r=r>>>0,i||iJ(t,e,r,8,17976931348623157e292,-17976931348623157e292),Mb.write(t,e,r,n,52,8),r+8}he.prototype.writeDoubleLE=function(e,r,n){return sJ(this,e,r,!0,n)};he.prototype.writeDoubleBE=function(e,r,n){return sJ(this,e,r,!1,n)};he.prototype.copy=function(e,r,n,i){if(!he.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=YG(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=YG(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function YG(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 z3e(t,e,r){Cb(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&G_(e,t.length-(r+1))}function aJ(t,e,r,n,i,o){if(t>r||t3?e===0||e===BigInt(0)?a=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:a=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:a=`>= ${e}${s} and <= ${r}${s}`,new Bb.ERR_OUT_OF_RANGE("value",a,t)}z3e(n,i,o)}function Cb(t,e){if(typeof t!="number")throw new Bb.ERR_INVALID_ARG_TYPE(e,"number",t)}function G_(t,e,r){throw Math.floor(t)!==t?(Cb(t,r),new Bb.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Bb.ERR_BUFFER_OUT_OF_BOUNDS:new Bb.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var W3e=/[^+/0-9A-Za-z-_]/g;function V3e(t){if(t=t.split("=")[0],t=t.trim().replace(W3e,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function hD(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 H3e(t){let e=[];for(let r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function cJ(t){return uD.toByteArray(V3e(t))}function W5(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function hl(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function gD(t){return t!==t}var J3e=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 Op(t){return typeof BigInt>"u"?Y3e:t}function Y3e(){throw new Error("BigInt not supported")}});var ur=V((vD,uJ)=>{h();var V5=Fn(),pl=V5.Buffer;function dJ(t,e){for(var r in t)e[r]=t[r]}pl.from&&pl.alloc&&pl.allocUnsafe&&pl.allocUnsafeSlow?uJ.exports=V5:(dJ(V5,vD),vD.Buffer=h0);function h0(t,e,r){return pl(t,e,r)}h0.prototype=Object.create(pl.prototype);dJ(pl,h0);h0.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return pl(t,e,r)};h0.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=pl(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};h0.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return pl(t)};h0.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return V5.SlowBuffer(t)}});var p0=V((mft,wD)=>{"use strict";h();var bD=65536,Z3e=4294967295;function X3e(){throw new Error(`Secure random number generation is not supported by this browser. Use Chrome, Firefox or Internet Explorer 11`)}var Q3e=ur().Buffer,H5=globalThis.crypto||globalThis.msCrypto;H5&&H5.getRandomValues?wD.exports=eSe:wD.exports=X3e;function eSe(t,e){if(t>Z3e)throw new RangeError("requested too many random bytes");var r=Q3e.allocUnsafe(t);if(t>0)if(t>bD)for(var n=0;n{h();typeof Object.create=="function"?_D.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:_D.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var lc=V((bft,xD)=>{"use strict";h();var $b=typeof Reflect=="object"?Reflect:null,lJ=$b&&typeof $b.apply=="function"?$b.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},G5;$b&&typeof $b.ownKeys=="function"?G5=$b.ownKeys:Object.getOwnPropertySymbols?G5=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:G5=function(e){return Object.getOwnPropertyNames(e)};function tSe(t){console&&console.warn&&console.warn(t)}var hJ=Number.isNaN||function(e){return e!==e};function pn(){pn.init.call(this)}xD.exports=pn;xD.exports.once=oSe;pn.EventEmitter=pn;pn.prototype._events=void 0;pn.prototype._eventsCount=0;pn.prototype._maxListeners=void 0;var fJ=10;function J5(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(pn,"defaultMaxListeners",{enumerable:!0,get:function(){return fJ},set:function(t){if(typeof t!="number"||t<0||hJ(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");fJ=t}});pn.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};pn.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||hJ(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 pJ(t){return t._maxListeners===void 0?pn.defaultMaxListeners:t._maxListeners}pn.prototype.getMaxListeners=function(){return pJ(this)};pn.prototype.emit=function(e){for(var r=[],n=1;n0&&(s=r[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var d=o[e];if(d===void 0)return!1;if(typeof d=="function")lJ(d,this,r);else for(var u=d.length,c=bJ(d,u),n=0;n0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,tSe(a)}return t}pn.prototype.addListener=function(e,r){return mJ(this,e,r,!1)};pn.prototype.on=pn.prototype.addListener;pn.prototype.prependListener=function(e,r){return mJ(this,e,r,!0)};function rSe(){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 yJ(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=rSe.bind(n);return i.listener=r,n.wrapFn=i,i}pn.prototype.once=function(e,r){return J5(r),this.on(e,yJ(this,e,r)),this};pn.prototype.prependOnceListener=function(e,r){return J5(r),this.prependListener(e,yJ(this,e,r)),this};pn.prototype.removeListener=function(e,r){var n,i,o,s,a;if(J5(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(o=-1,s=n.length-1;s>=0;s--)if(n[s]===r||n[s].listener===r){a=n[s].listener,o=s;break}if(o<0)return this;o===0?n.shift():nSe(n,o),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};pn.prototype.off=pn.prototype.removeListener;pn.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 gJ(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?iSe(i):bJ(i,i.length)}pn.prototype.listeners=function(e){return gJ(this,e,!0)};pn.prototype.rawListeners=function(e){return gJ(this,e,!1)};pn.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):vJ.call(t,e)};pn.prototype.listenerCount=vJ;function vJ(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}pn.prototype.eventNames=function(){return this._eventsCount>0?G5(this._events):[]};function bJ(t,e){for(var r=new Array(e),n=0;n{h();_J.exports=lc().EventEmitter});var SD=V(()=>{h()});var IJ=V((Tft,TJ)=>{"use strict";h();function xJ(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function EJ(t){for(var e=1;e0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"concat",value:function(r){if(this.length===0)return Y5.alloc(0);for(var n=Y5.allocUnsafe(r>>>0),i=this.head,o=0;i;)pSe(i.data,n,o),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(r,n){var i;return rs.length?s.length:r;if(a===s.length?o+=s:o+=s.slice(0,r),r-=a,r===0){a===s.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=s.slice(a));break}++i}return this.length-=i,o}},{key:"_getBuffer",value:function(r){var n=Y5.allocUnsafe(r),i=this.head,o=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var s=i.data,a=r>s.length?s.length:r;if(s.copy(n,n.length-r,0,a),r-=a,r===0){a===s.length?(++o,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=s.slice(a));break}++o}return this.length-=o,n}},{key:hSe,value:function(r,n){return AD(this,EJ(EJ({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var ID=V((Pft,kJ)=>{"use strict";h();function mSe(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,D.default.nextTick(TD,this,t)):D.default.nextTick(TD,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(o){!e&&o?r._writableState?r._writableState.errorEmitted?D.default.nextTick(Z5,r):(r._writableState.errorEmitted=!0,D.default.nextTick(PJ,r,o)):D.default.nextTick(PJ,r,o):e?(D.default.nextTick(Z5,r),e(o)):D.default.nextTick(Z5,r)}),this)}function PJ(t,e){TD(t,e),Z5(t)}function Z5(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function ySe(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function TD(t,e){t.emit("error",e)}function gSe(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}kJ.exports={destroy:mSe,undestroy:ySe,errorOrDestroy:gSe}});var m0=V((Rft,BJ)=>{"use strict";h();function vSe(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var DJ={};function Zc(t,e,r){r||(r=Error);function n(o,s,a){return typeof e=="string"?e:e(o,s,a)}var i=function(o){vSe(s,o);function s(a,d,u){return o.call(this,n(a,d,u))||this}return s}(r);i.prototype.name=r.name,i.prototype.code=t,DJ[t]=i}function RJ(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(n){return String(n)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function bSe(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function wSe(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function _Se(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Zc("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Zc("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&bSe(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(wSe(t," argument"))i="The ".concat(t," ").concat(n," ").concat(RJ(e,"type"));else{var o=_Se(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(o," ").concat(n," ").concat(RJ(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);Zc("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Zc("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Zc("ERR_STREAM_PREMATURE_CLOSE","Premature close");Zc("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Zc("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Zc("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Zc("ERR_STREAM_WRITE_AFTER_END","write after end");Zc("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Zc("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Zc("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");BJ.exports.codes=DJ});var PD=V((Bft,MJ)=>{"use strict";h();var xSe=m0().codes.ERR_INVALID_OPT_VALUE;function ESe(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function SSe(t,e,r,n){var i=ESe(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var o=n?r:"highWaterMark";throw new xSe(o,i)}return Math.floor(i)}return t.objectMode?16:16*1024}MJ.exports={getHighWaterMark:SSe}});var OJ=V((Cft,CJ)=>{h();CJ.exports=ASe;function ASe(t,e){if(kD("noDeprecation"))return t;var r=!1;function n(){if(!r){if(kD("throwDeprecation"))throw new Error(e);kD("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function kD(t){try{if(!globalThis.localStorage)return!1}catch{return!1}var e=globalThis.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var e8=V(($ft,LJ)=>{"use strict";h();LJ.exports=li;function NJ(t){var e=this;this.next=null,this.entry=null,this.finish=function(){XSe(e,t)}}var Nb;li.WritableState=Y_;var TSe={deprecate:OJ()},jJ=ED(),Q5=Fn().Buffer,ISe=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function PSe(t){return Q5.from(t)}function kSe(t){return Q5.isBuffer(t)||t instanceof ISe}var DD=ID(),RSe=PD(),DSe=RSe.getHighWaterMark,$p=m0().codes,BSe=$p.ERR_INVALID_ARG_TYPE,MSe=$p.ERR_METHOD_NOT_IMPLEMENTED,CSe=$p.ERR_MULTIPLE_CALLBACK,OSe=$p.ERR_STREAM_CANNOT_PIPE,$Se=$p.ERR_STREAM_DESTROYED,NSe=$p.ERR_STREAM_NULL_VALUES,jSe=$p.ERR_STREAM_WRITE_AFTER_END,USe=$p.ERR_UNKNOWN_ENCODING,jb=DD.errorOrDestroy;lr()(li,jJ);function qSe(){}function Y_(t,e,r){Nb=Nb||Np(),t=t||{},typeof r!="boolean"&&(r=e instanceof Nb),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=DSe(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=t.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){HSe(e,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new NJ(this)}Y_.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(Y_.prototype,"buffer",{get:TSe.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var X5;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(X5=Function.prototype[Symbol.hasInstance],Object.defineProperty(li,Symbol.hasInstance,{value:function(e){return X5.call(this,e)?!0:this!==li?!1:e&&e._writableState instanceof Y_}})):X5=function(e){return e instanceof this};function li(t){Nb=Nb||Np();var e=this instanceof Nb;if(!e&&!X5.call(li,this))return new li(t);this._writableState=new Y_(t,this,e),this.writable=!0,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)),jJ.call(this)}li.prototype.pipe=function(){jb(this,new OSe)};function LSe(t,e){var r=new jSe;jb(t,r),D.default.nextTick(e,r)}function KSe(t,e,r,n){var i;return r===null?i=new NSe:typeof r!="string"&&!e.objectMode&&(i=new BSe("chunk",["string","Buffer"],r)),i?(jb(t,i),D.default.nextTick(n,i),!1):!0}li.prototype.write=function(t,e,r){var n=this._writableState,i=!1,o=!n.objectMode&&kSe(t);return o&&!Q5.isBuffer(t)&&(t=PSe(t)),typeof e=="function"&&(r=e,e=null),o?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=qSe),n.ending?LSe(this,r):(o||KSe(this,n,t,r))&&(n.pendingcb++,i=zSe(this,n,o,t,e,r)),i};li.prototype.cork=function(){this._writableState.corked++};li.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&UJ(this,t))};li.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new USe(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(li.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function FSe(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=Q5.from(e,r)),e}Object.defineProperty(li.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function zSe(t,e,r,n,i,o){if(!r){var s=FSe(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var d=e.length{"use strict";h();var QSe=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};FJ.exports=ml;var KJ=n8(),MD=e8();lr()(ml,KJ);for(BD=QSe(MD.prototype),t8=0;t8{"use strict";h();var OD=ur().Buffer,zJ=OD.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 r5e(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 n5e(t){var e=r5e(t);if(typeof e!="string"&&(OD.isEncoding===zJ||!zJ(t)))throw new Error("Unknown encoding: "+t);return e||t}WJ.StringDecoder=Z_;function Z_(t){this.encoding=n5e(t);var e;switch(this.encoding){case"utf16le":this.text=d5e,this.end=u5e,e=4;break;case"utf8":this.fillLast=s5e,e=4;break;case"base64":this.text=l5e,this.end=f5e,e=3;break;default:this.write=h5e,this.end=p5e;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=OD.allocUnsafe(e)}Z_.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 i5e(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 o5e(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 s5e(t){var e=this.lastTotal-this.lastNeed,r=o5e(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 a5e(t,e){var r=i5e(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 c5e(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function d5e(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 u5e(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 l5e(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 f5e(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h5e(t){return t.toString(this.encoding)}function p5e(t){return t&&t.length?this.write(t):""}});var X_=V((Kft,GJ)=>{"use strict";h();var VJ=m0().codes.ERR_STREAM_PREMATURE_CLOSE;function m5e(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";h();var i8;function jp(t,e,r){return e=v5e(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function v5e(t){var e=b5e(t,"string");return typeof e=="symbol"?e:String(e)}function b5e(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var w5e=X_(),Up=Symbol("lastResolve"),y0=Symbol("lastReject"),Q_=Symbol("error"),o8=Symbol("ended"),g0=Symbol("lastPromise"),$D=Symbol("handlePromise"),v0=Symbol("stream");function qp(t,e){return{value:t,done:e}}function _5e(t){var e=t[Up];if(e!==null){var r=t[v0].read();r!==null&&(t[g0]=null,t[Up]=null,t[y0]=null,e(qp(r,!1)))}}function x5e(t){D.default.nextTick(_5e,t)}function E5e(t,e){return function(r,n){t.then(function(){if(e[o8]){r(qp(void 0,!0));return}e[$D](r,n)},n)}}var S5e=Object.getPrototypeOf(function(){}),A5e=Object.setPrototypeOf((i8={get stream(){return this[v0]},next:function(){var e=this,r=this[Q_];if(r!==null)return Promise.reject(r);if(this[o8])return Promise.resolve(qp(void 0,!0));if(this[v0].destroyed)return new Promise(function(s,a){D.default.nextTick(function(){e[Q_]?a(e[Q_]):s(qp(void 0,!0))})});var n=this[g0],i;if(n)i=new Promise(E5e(n,this));else{var o=this[v0].read();if(o!==null)return Promise.resolve(qp(o,!1));i=new Promise(this[$D])}return this[g0]=i,i}},jp(i8,Symbol.asyncIterator,function(){return this}),jp(i8,"return",function(){var e=this;return new Promise(function(r,n){e[v0].destroy(null,function(i){if(i){n(i);return}r(qp(void 0,!0))})})}),i8),S5e),T5e=function(e){var r,n=Object.create(A5e,(r={},jp(r,v0,{value:e,writable:!0}),jp(r,Up,{value:null,writable:!0}),jp(r,y0,{value:null,writable:!0}),jp(r,Q_,{value:null,writable:!0}),jp(r,o8,{value:e._readableState.endEmitted,writable:!0}),jp(r,$D,{value:function(o,s){var a=n[v0].read();a?(n[g0]=null,n[Up]=null,n[y0]=null,o(qp(a,!1))):(n[Up]=o,n[y0]=s)},writable:!0}),r));return n[g0]=null,w5e(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var o=n[y0];o!==null&&(n[g0]=null,n[Up]=null,n[y0]=null,o(i)),n[Q_]=i;return}var s=n[Up];s!==null&&(n[g0]=null,n[Up]=null,n[y0]=null,s(qp(void 0,!0))),n[o8]=!0}),e.on("readable",x5e.bind(null,n)),n};JJ.exports=T5e});var XJ=V((Vft,ZJ)=>{h();ZJ.exports=function(){throw new Error("Readable.from is not available in the browser")}});var n8=V((Jft,cY)=>{"use strict";h();cY.exports=Vr;var qb;Vr.ReadableState=rY;var Gft=lc().EventEmitter,tY=function(e,r){return e.listeners(r).length},tx=ED(),s8=Fn().Buffer,I5e=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function P5e(t){return s8.from(t)}function k5e(t){return s8.isBuffer(t)||t instanceof I5e}var ND=SD(),Er;ND&&ND.debuglog?Er=ND.debuglog("stream"):Er=function(){};var R5e=IJ(),zD=ID(),D5e=PD(),B5e=D5e.getHighWaterMark,a8=m0().codes,M5e=a8.ERR_INVALID_ARG_TYPE,C5e=a8.ERR_STREAM_PUSH_AFTER_EOF,O5e=a8.ERR_METHOD_NOT_IMPLEMENTED,$5e=a8.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Lb,jD,UD;lr()(Vr,tx);var ex=zD.errorOrDestroy,qD=["error","close","destroy","pause","resume"];function N5e(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function rY(t,e,r){qb=qb||Np(),t=t||{},typeof r!="boolean"&&(r=e instanceof qb),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=B5e(this,t,"readableHighWaterMark",r),this.buffer=new R5e,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(Lb||(Lb=Ub().StringDecoder),this.decoder=new Lb(t.encoding),this.encoding=t.encoding)}function Vr(t){if(qb=qb||Np(),!(this instanceof Vr))return new Vr(t);var e=this instanceof qb;this._readableState=new rY(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),tx.call(this)}Object.defineProperty(Vr.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Vr.prototype.destroy=zD.destroy;Vr.prototype._undestroy=zD.undestroy;Vr.prototype._destroy=function(t,e){e(t)};Vr.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=s8.from(t,e),e=""),n=!0),nY(this,t,e,!1,n)};Vr.prototype.unshift=function(t){return nY(this,t,null,!0,!1)};function nY(t,e,r,n,i){Er("readableAddChunk",e);var o=t._readableState;if(e===null)o.reading=!1,q5e(t,o);else{var s;if(i||(s=j5e(o,e)),s)ex(t,s);else if(o.objectMode||e&&e.length>0)if(typeof e!="string"&&!o.objectMode&&Object.getPrototypeOf(e)!==s8.prototype&&(e=P5e(e)),n)o.endEmitted?ex(t,new $5e):LD(t,o,e,!0);else if(o.ended)ex(t,new C5e);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?LD(t,o,e,!1):FD(t,o)):LD(t,o,e,!1)}else n||(o.reading=!1,FD(t,o))}return!o.ended&&(o.length=QJ?t=QJ:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function eY(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=U5e(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Vr.prototype.read=function(t){Er("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Er("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?KD(this):c8(this),null;if(t=eY(t,e),t===0&&e.ended)return e.length===0&&KD(this),null;var n=e.needReadable;Er("need readable",n),(e.length===0||e.length-t0?i=sY(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&KD(this)),i!==null&&this.emit("data",i),i};function q5e(t,e){if(Er("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?c8(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,iY(t)))}}function c8(t){var e=t._readableState;Er("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Er("emitReadable",e.flowing),e.emittedReadable=!0,D.default.nextTick(iY,t))}function iY(t){var e=t._readableState;Er("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,WD(t)}function FD(t,e){e.readingMore||(e.readingMore=!0,D.default.nextTick(L5e,t,e))}function L5e(t,e){for(;!e.reading&&!e.ended&&(e.length1&&aY(n.pipes,t)!==-1)&&!u&&(Er("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function m(E){Er("onerror",E),v(),t.removeListener("error",m),tY(t,"error")===0&&ex(t,E)}N5e(t,"error",m);function p(){t.removeListener("finish",g),v()}t.once("close",p);function g(){Er("onfinish"),t.removeListener("close",p),v()}t.once("finish",g);function v(){Er("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(Er("pipe resume"),r.resume()),t};function K5e(t){return function(){var r=t._readableState;Er("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&tY(t,"data")&&(r.flowing=!0,WD(t))}}Vr.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var 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,Er("on readable",n.length,n.reading),n.length?c8(this):n.reading||D.default.nextTick(F5e,this)),r};Vr.prototype.addListener=Vr.prototype.on;Vr.prototype.removeListener=function(t,e){var r=tx.prototype.removeListener.call(this,t,e);return t==="readable"&&D.default.nextTick(oY,this),r};Vr.prototype.removeAllListeners=function(t){var e=tx.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&D.default.nextTick(oY,this),e};function oY(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function F5e(t){Er("readable nexttick read 0"),t.read(0)}Vr.prototype.resume=function(){var t=this._readableState;return t.flowing||(Er("resume"),t.flowing=!t.readableListening,z5e(this,t)),t.paused=!1,this};function z5e(t,e){e.resumeScheduled||(e.resumeScheduled=!0,D.default.nextTick(W5e,t,e))}function W5e(t,e){Er("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),WD(t),e.flowing&&!e.reading&&t.read(0)}Vr.prototype.pause=function(){return Er("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Er("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function WD(t){var e=t._readableState;for(Er("flow",e.flowing);e.flowing&&t.read()!==null;);}Vr.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(Er("wrapped end"),r.decoder&&!r.ended){var s=r.decoder.end();s&&s.length&&e.push(s)}e.push(null)}),t.on("data",function(s){if(Er("wrapped data"),r.decoder&&(s=r.decoder.write(s)),!(r.objectMode&&s==null)&&!(!r.objectMode&&(!s||!s.length))){var a=e.push(s);a||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(a){return function(){return t[a].apply(t,arguments)}}(i));for(var o=0;o=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 KD(t){var e=t._readableState;Er("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,D.default.nextTick(V5e,e,t))}function V5e(t,e){if(Er("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Vr.from=function(t,e){return UD===void 0&&(UD=XJ()),UD(Vr,t,e)});function aY(t,e){for(var r=0,n=t.length;r{"use strict";h();uY.exports=Ff;var d8=m0().codes,H5e=d8.ERR_METHOD_NOT_IMPLEMENTED,G5e=d8.ERR_MULTIPLE_CALLBACK,J5e=d8.ERR_TRANSFORM_ALREADY_TRANSFORMING,Y5e=d8.ERR_TRANSFORM_WITH_LENGTH_0,u8=Np();lr()(Ff,u8);function Z5e(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new G5e);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";h();fY.exports=rx;var lY=l8();lr()(rx,lY);function rx(t){if(!(this instanceof rx))return new rx(t);lY.call(this,t)}rx.prototype._transform=function(t,e,r){r(null,t)}});var GD=V((tht,yY)=>{"use strict";h();var HD;function Q5e(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var mY=m0().codes,e8e=mY.ERR_MISSING_ARGS,t8e=mY.ERR_STREAM_DESTROYED;function hY(t){if(t)throw t}function r8e(t){return t.setHeader&&typeof t.abort=="function"}function n8e(t,e,r,n){n=Q5e(n);var i=!1;t.on("close",function(){i=!0}),HD===void 0&&(HD=X_()),HD(t,{readable:e,writable:r},function(s){if(s)return n(s);i=!0,n()});var o=!1;return function(s){if(!i&&!o){if(o=!0,r8e(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(s||new t8e("pipe"))}}}function pY(t){t()}function i8e(t,e){return t.pipe(e)}function o8e(t){return!t.length||typeof t[t.length-1]!="function"?hY:t.pop()}function s8e(){for(var t=arguments.length,e=new Array(t),r=0;r0;return n8e(s,d,u,function(c){i||(i=c),c&&o.forEach(pY),!d&&(o.forEach(pY),n(i))})});return e.reduce(i8e)}yY.exports=s8e});var f8=V((Xc,gY)=>{h();Xc=gY.exports=n8();Xc.Stream=Xc;Xc.Readable=Xc;Xc.Writable=e8();Xc.Duplex=Np();Xc.Transform=l8();Xc.PassThrough=VD();Xc.finished=X_();Xc.pipeline=GD()});var JD=V((iht,bY)=>{"use strict";h();var h8=ur().Buffer,vY=f8().Transform,a8e=lr();function c8e(t,e){if(!h8.isBuffer(t)&&typeof t!="string")throw new TypeError(e+" must be a string or a buffer")}function Lp(t){vY.call(this),this._block=h8.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}a8e(Lp,vY);Lp.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(i){n=i}r(n)};Lp.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(r){e=r}t(e)};Lp.prototype.update=function(t,e){if(c8e(t,"Data"),this._finalized)throw new Error("Digest already called");h8.isBuffer(t)||(t=h8.from(t,e));for(var r=this._block,n=0;this._blockOffset+t.length-n>=this._blockSize;){for(var i=this._blockOffset;i0;++o)this._length[o]+=s,s=this._length[o]/4294967296|0,s>0&&(this._length[o]-=4294967296*s);return this};Lp.prototype._update=function(){throw new Error("_update is not implemented")};Lp.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();t!==void 0&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e};Lp.prototype._digest=function(){throw new Error("_digest is not implemented")};bY.exports=Lp});var y8=V((sht,_Y)=>{"use strict";h();var d8e=lr(),wY=JD(),u8e=ur().Buffer,l8e=new Array(16);function p8(){wY.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}d8e(p8,wY);p8.prototype._update=function(){for(var t=l8e,e=0;e<16;++e)t[e]=this._block.readInt32LE(e*4);var r=this._a,n=this._b,i=this._c,o=this._d;r=Is(r,n,i,o,t[0],3614090360,7),o=Is(o,r,n,i,t[1],3905402710,12),i=Is(i,o,r,n,t[2],606105819,17),n=Is(n,i,o,r,t[3],3250441966,22),r=Is(r,n,i,o,t[4],4118548399,7),o=Is(o,r,n,i,t[5],1200080426,12),i=Is(i,o,r,n,t[6],2821735955,17),n=Is(n,i,o,r,t[7],4249261313,22),r=Is(r,n,i,o,t[8],1770035416,7),o=Is(o,r,n,i,t[9],2336552879,12),i=Is(i,o,r,n,t[10],4294925233,17),n=Is(n,i,o,r,t[11],2304563134,22),r=Is(r,n,i,o,t[12],1804603682,7),o=Is(o,r,n,i,t[13],4254626195,12),i=Is(i,o,r,n,t[14],2792965006,17),n=Is(n,i,o,r,t[15],1236535329,22),r=Ps(r,n,i,o,t[1],4129170786,5),o=Ps(o,r,n,i,t[6],3225465664,9),i=Ps(i,o,r,n,t[11],643717713,14),n=Ps(n,i,o,r,t[0],3921069994,20),r=Ps(r,n,i,o,t[5],3593408605,5),o=Ps(o,r,n,i,t[10],38016083,9),i=Ps(i,o,r,n,t[15],3634488961,14),n=Ps(n,i,o,r,t[4],3889429448,20),r=Ps(r,n,i,o,t[9],568446438,5),o=Ps(o,r,n,i,t[14],3275163606,9),i=Ps(i,o,r,n,t[3],4107603335,14),n=Ps(n,i,o,r,t[8],1163531501,20),r=Ps(r,n,i,o,t[13],2850285829,5),o=Ps(o,r,n,i,t[2],4243563512,9),i=Ps(i,o,r,n,t[7],1735328473,14),n=Ps(n,i,o,r,t[12],2368359562,20),r=ks(r,n,i,o,t[5],4294588738,4),o=ks(o,r,n,i,t[8],2272392833,11),i=ks(i,o,r,n,t[11],1839030562,16),n=ks(n,i,o,r,t[14],4259657740,23),r=ks(r,n,i,o,t[1],2763975236,4),o=ks(o,r,n,i,t[4],1272893353,11),i=ks(i,o,r,n,t[7],4139469664,16),n=ks(n,i,o,r,t[10],3200236656,23),r=ks(r,n,i,o,t[13],681279174,4),o=ks(o,r,n,i,t[0],3936430074,11),i=ks(i,o,r,n,t[3],3572445317,16),n=ks(n,i,o,r,t[6],76029189,23),r=ks(r,n,i,o,t[9],3654602809,4),o=ks(o,r,n,i,t[12],3873151461,11),i=ks(i,o,r,n,t[15],530742520,16),n=ks(n,i,o,r,t[2],3299628645,23),r=Rs(r,n,i,o,t[0],4096336452,6),o=Rs(o,r,n,i,t[7],1126891415,10),i=Rs(i,o,r,n,t[14],2878612391,15),n=Rs(n,i,o,r,t[5],4237533241,21),r=Rs(r,n,i,o,t[12],1700485571,6),o=Rs(o,r,n,i,t[3],2399980690,10),i=Rs(i,o,r,n,t[10],4293915773,15),n=Rs(n,i,o,r,t[1],2240044497,21),r=Rs(r,n,i,o,t[8],1873313359,6),o=Rs(o,r,n,i,t[15],4264355552,10),i=Rs(i,o,r,n,t[6],2734768916,15),n=Rs(n,i,o,r,t[13],1309151649,21),r=Rs(r,n,i,o,t[4],4149444226,6),o=Rs(o,r,n,i,t[11],3174756917,10),i=Rs(i,o,r,n,t[2],718787259,15),n=Rs(n,i,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0};p8.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=u8e.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t};function m8(t,e){return t<>>32-e}function Is(t,e,r,n,i,o,s){return m8(t+(e&r|~e&n)+i+o|0,s)+e|0}function Ps(t,e,r,n,i,o,s){return m8(t+(e&n|r&~n)+i+o|0,s)+e|0}function ks(t,e,r,n,i,o,s){return m8(t+(e^r^n)+i+o|0,s)+e|0}function Rs(t,e,r,n,i,o,s){return m8(t+(r^(e|~n))+i+o|0,s)+e|0}_Y.exports=p8});var v8=V((cht,PY)=>{"use strict";h();var YD=Fn().Buffer,f8e=lr(),IY=JD(),h8e=new Array(16),nx=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],ix=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],ox=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],sx=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],ax=[0,1518500249,1859775393,2400959708,2840853838],cx=[1352829926,1548603684,1836072691,2053994217,0];function g8(){IY.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}f8e(g8,IY);g8.prototype._update=function(){for(var t=h8e,e=0;e<16;++e)t[e]=this._block.readInt32LE(e*4);for(var r=this._a|0,n=this._b|0,i=this._c|0,o=this._d|0,s=this._e|0,a=this._a|0,d=this._b|0,u=this._c|0,c=this._d|0,l=this._e|0,m=0;m<80;m+=1){var p,g;m<16?(p=xY(r,n,i,o,s,t[nx[m]],ax[0],ox[m]),g=TY(a,d,u,c,l,t[ix[m]],cx[0],sx[m])):m<32?(p=EY(r,n,i,o,s,t[nx[m]],ax[1],ox[m]),g=AY(a,d,u,c,l,t[ix[m]],cx[1],sx[m])):m<48?(p=SY(r,n,i,o,s,t[nx[m]],ax[2],ox[m]),g=SY(a,d,u,c,l,t[ix[m]],cx[2],sx[m])):m<64?(p=AY(r,n,i,o,s,t[nx[m]],ax[3],ox[m]),g=EY(a,d,u,c,l,t[ix[m]],cx[3],sx[m])):(p=TY(r,n,i,o,s,t[nx[m]],ax[4],ox[m]),g=xY(a,d,u,c,l,t[ix[m]],cx[4],sx[m])),r=s,s=o,o=b0(i,10),i=n,n=p,a=l,l=c,c=b0(u,10),u=d,d=g}var v=this._b+i+c|0;this._b=this._c+o+l|0,this._c=this._d+s+a|0,this._d=this._e+r+d|0,this._e=this._a+n+u|0,this._a=v};g8.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=YD.alloc?YD.alloc(20):new YD(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t};function b0(t,e){return t<>>32-e}function xY(t,e,r,n,i,o,s,a){return b0(t+(e^r^n)+o+s|0,a)+i|0}function EY(t,e,r,n,i,o,s,a){return b0(t+(e&r|~e&n)+o+s|0,a)+i|0}function SY(t,e,r,n,i,o,s,a){return b0(t+((e|~r)^n)+o+s|0,a)+i|0}function AY(t,e,r,n,i,o,s,a){return b0(t+(e&n|r&~n)+o+s|0,a)+i|0}function TY(t,e,r,n,i,o,s,a){return b0(t+(e^(r|~n))+o+s|0,a)+i|0}PY.exports=g8});var w0=V((uht,RY)=>{h();var kY=ur().Buffer;function b8(t,e){this._block=kY.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}b8.prototype.update=function(t,e){typeof t=="string"&&(e=e||"utf8",t=kY.from(t,e));for(var r=this._block,n=this._blockSize,i=t.length,o=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o};b8.prototype._update=function(){throw new Error("_update must be implemented by subclass")};RY.exports=b8});var MY=V((fht,BY)=>{h();var p8e=lr(),DY=w0(),m8e=ur().Buffer,y8e=[1518500249,1859775393,-1894007588,-899497514],g8e=new Array(80);function dx(){this.init(),this._w=g8e,DY.call(this,64,56)}p8e(dx,DY);dx.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function v8e(t){return t<<5|t>>>27}function b8e(t){return t<<30|t>>>2}function w8e(t,e,r,n){return t===0?e&r|~e&n:t===2?e&r|e&n|r&n:e^r^n}dx.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,o=this._d|0,s=this._e|0,a=0;a<16;++a)e[a]=t.readInt32BE(a*4);for(;a<80;++a)e[a]=e[a-3]^e[a-8]^e[a-14]^e[a-16];for(var d=0;d<80;++d){var u=~~(d/20),c=v8e(r)+w8e(u,n,i,o)+s+e[d]+y8e[u]|0;s=o,o=i,i=b8e(n),n=r,r=c}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0};dx.prototype._hash=function(){var t=m8e.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};BY.exports=dx});var $Y=V((pht,OY)=>{h();var _8e=lr(),CY=w0(),x8e=ur().Buffer,E8e=[1518500249,1859775393,-1894007588,-899497514],S8e=new Array(80);function ux(){this.init(),this._w=S8e,CY.call(this,64,56)}_8e(ux,CY);ux.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function A8e(t){return t<<1|t>>>31}function T8e(t){return t<<5|t>>>27}function I8e(t){return t<<30|t>>>2}function P8e(t,e,r,n){return t===0?e&r|~e&n:t===2?e&r|e&n|r&n:e^r^n}ux.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,o=this._d|0,s=this._e|0,a=0;a<16;++a)e[a]=t.readInt32BE(a*4);for(;a<80;++a)e[a]=A8e(e[a-3]^e[a-8]^e[a-14]^e[a-16]);for(var d=0;d<80;++d){var u=~~(d/20),c=T8e(r)+P8e(u,n,i,o)+s+e[d]+E8e[u]|0;s=o,o=i,i=I8e(n),n=r,r=c}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0};ux.prototype._hash=function(){var t=x8e.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};OY.exports=ux});var ZD=V((yht,jY)=>{h();var k8e=lr(),NY=w0(),R8e=ur().Buffer,D8e=[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],B8e=new Array(64);function lx(){this.init(),this._w=B8e,NY.call(this,64,56)}k8e(lx,NY);lx.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function M8e(t,e,r){return r^t&(e^r)}function C8e(t,e,r){return t&e|r&(t|e)}function O8e(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function $8e(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function N8e(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function j8e(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}lx.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,o=this._d|0,s=this._e|0,a=this._f|0,d=this._g|0,u=this._h|0,c=0;c<16;++c)e[c]=t.readInt32BE(c*4);for(;c<64;++c)e[c]=j8e(e[c-2])+e[c-7]+N8e(e[c-15])+e[c-16]|0;for(var l=0;l<64;++l){var m=u+$8e(s)+M8e(s,a,d)+D8e[l]+e[l]|0,p=O8e(r)+C8e(r,n,i)|0;u=d,d=a,a=s,s=o+m|0,o=i,i=n,n=r,r=m+p|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0,this._f=a+this._f|0,this._g=d+this._g|0,this._h=u+this._h|0};lx.prototype._hash=function(){var t=R8e.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t};jY.exports=lx});var qY=V((vht,UY)=>{h();var U8e=lr(),q8e=ZD(),L8e=w0(),K8e=ur().Buffer,F8e=new Array(64);function w8(){this.init(),this._w=F8e,L8e.call(this,64,56)}U8e(w8,q8e);w8.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};w8.prototype._hash=function(){var t=K8e.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t};UY.exports=w8});var XD=V((wht,HY)=>{h();var z8e=lr(),VY=w0(),W8e=ur().Buffer,LY=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],V8e=new Array(160);function fx(){this.init(),this._w=V8e,VY.call(this,128,112)}z8e(fx,VY);fx.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function KY(t,e,r){return r^t&(e^r)}function FY(t,e,r){return t&e|r&(t|e)}function zY(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function WY(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function H8e(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function G8e(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function J8e(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function Y8e(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function vo(t,e){return t>>>0>>0?1:0}fx.prototype._update=function(t){for(var e=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,o=this._dh|0,s=this._eh|0,a=this._fh|0,d=this._gh|0,u=this._hh|0,c=this._al|0,l=this._bl|0,m=this._cl|0,p=this._dl|0,g=this._el|0,v=this._fl|0,E=this._gl|0,A=this._hl|0,P=0;P<32;P+=2)e[P]=t.readInt32BE(P*4),e[P+1]=t.readInt32BE(P*4+4);for(;P<160;P+=2){var I=e[P-30],$=e[P-15*2+1],N=H8e(I,$),K=G8e($,I);I=e[P-2*2],$=e[P-2*2+1];var F=J8e(I,$),U=Y8e($,I),W=e[P-7*2],L=e[P-7*2+1],T=e[P-16*2],S=e[P-16*2+1],k=K+L|0,f=N+W+vo(k,K)|0;k=k+U|0,f=f+F+vo(k,U)|0,k=k+S|0,f=f+T+vo(k,S)|0,e[P]=f,e[P+1]=k}for(var y=0;y<160;y+=2){f=e[y],k=e[y+1];var w=FY(r,n,i),_=FY(c,l,m),x=zY(r,c),b=zY(c,r),B=WY(s,g),q=WY(g,s),M=LY[y],j=LY[y+1],J=KY(s,a,d),Z=KY(g,v,E),G=A+q|0,H=u+B+vo(G,A)|0;G=G+Z|0,H=H+J+vo(G,Z)|0,G=G+j|0,H=H+M+vo(G,j)|0,G=G+k|0,H=H+f+vo(G,k)|0;var X=b+_|0,ee=x+w+vo(X,b)|0;u=d,A=E,d=a,E=v,a=s,v=g,g=p+G|0,s=o+H+vo(g,p)|0,o=i,p=m,i=n,m=l,n=r,l=c,c=G+X|0,r=H+ee+vo(c,G)|0}this._al=this._al+c|0,this._bl=this._bl+l|0,this._cl=this._cl+m|0,this._dl=this._dl+p|0,this._el=this._el+g|0,this._fl=this._fl+v|0,this._gl=this._gl+E|0,this._hl=this._hl+A|0,this._ah=this._ah+r+vo(this._al,c)|0,this._bh=this._bh+n+vo(this._bl,l)|0,this._ch=this._ch+i+vo(this._cl,m)|0,this._dh=this._dh+o+vo(this._dl,p)|0,this._eh=this._eh+s+vo(this._el,g)|0,this._fh=this._fh+a+vo(this._fl,v)|0,this._gh=this._gh+d+vo(this._gl,E)|0,this._hh=this._hh+u+vo(this._hl,A)|0};fx.prototype._hash=function(){var t=W8e.allocUnsafe(64);function e(r,n,i){t.writeInt32BE(r,i),t.writeInt32BE(n,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t};HY.exports=fx});var JY=V((xht,GY)=>{h();var Z8e=lr(),X8e=XD(),Q8e=w0(),e4e=ur().Buffer,t4e=new Array(160);function _8(){this.init(),this._w=t4e,Q8e.call(this,128,112)}Z8e(_8,X8e);_8.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};_8.prototype._hash=function(){var t=e4e.allocUnsafe(48);function e(r,n,i){t.writeInt32BE(r,i),t.writeInt32BE(n,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t};GY.exports=_8});var x8=V((zf,YY)=>{h();var zf=YY.exports=function(e){e=e.toLowerCase();var r=zf[e];if(!r)throw new Error(e+" is not supported (we accept pull requests)");return new r};zf.sha=MY();zf.sha1=$Y();zf.sha224=qY();zf.sha256=ZD();zf.sha384=JY();zf.sha512=XD()});var XY=V((Aht,ZY)=>{h();ZY.exports=Qc;var QD=lc().EventEmitter,r4e=lr();r4e(Qc,QD);Qc.Readable=n8();Qc.Writable=e8();Qc.Duplex=Np();Qc.Transform=l8();Qc.PassThrough=VD();Qc.finished=X_();Qc.pipeline=GD();Qc.Stream=Qc;function Qc(){QD.call(this)}Qc.prototype.pipe=function(t,e){var r=this;function n(c){t.writable&&t.write(c)===!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",a));var o=!1;function s(){o||(o=!0,t.end())}function a(){o||(o=!0,typeof t.destroy=="function"&&t.destroy())}function d(c){if(u(),QD.listenerCount(this,"error")===0)throw c}r.on("error",d),t.on("error",d);function u(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",d),t.removeListener("error",d),r.removeListener("end",u),r.removeListener("close",u),t.removeListener("close",u)}return r.on("end",u),r.on("close",u),t.on("close",u),t.emit("pipe",r),t}});var Wf=V((Iht,tZ)=>{h();var QY=ur().Buffer,eZ=XY().Transform,n4e=Ub().StringDecoder,i4e=lr();function nu(t){eZ.call(this),this.hashMode=typeof t=="string",this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}i4e(nu,eZ);nu.prototype.update=function(t,e,r){typeof t=="string"&&(t=QY.from(t,e));var n=this._update(t);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)};nu.prototype.setAutoPadding=function(){};nu.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};nu.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};nu.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};nu.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(i){n=i}finally{r(n)}};nu.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(r){e=r}t(e)};nu.prototype._finalOrDigest=function(t){var e=this.__final()||QY.alloc(0);return t&&(e=this._toString(e,t,!0)),e};nu.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new n4e(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n};tZ.exports=nu});var Kb=V((kht,nZ)=>{"use strict";h();var o4e=lr(),s4e=y8(),a4e=v8(),c4e=x8(),rZ=Wf();function E8(t){rZ.call(this,"digest"),this._hash=t}o4e(E8,rZ);E8.prototype._update=function(t){this._hash.update(t)};E8.prototype._final=function(){return this._hash.digest()};nZ.exports=function(e){return e=e.toLowerCase(),e==="md5"?new s4e:e==="rmd160"||e==="ripemd160"?new a4e:new E8(c4e(e))}});var sZ=V((Dht,oZ)=>{"use strict";h();var d4e=lr(),_0=ur().Buffer,iZ=Wf(),u4e=_0.alloc(128),Fb=64;function S8(t,e){iZ.call(this,"digest"),typeof e=="string"&&(e=_0.from(e)),this._alg=t,this._key=e,e.length>Fb?e=t(e):e.length{h();var l4e=y8();aZ.exports=function(t){return new l4e().update(t).digest()}});var nB=V((Oht,dZ)=>{"use strict";h();var f4e=lr(),h4e=sZ(),cZ=Wf(),hx=ur().Buffer,p4e=eB(),tB=v8(),rB=x8(),m4e=hx.alloc(128);function px(t,e){cZ.call(this,"digest"),typeof e=="string"&&(e=hx.from(e));var r=t==="sha512"||t==="sha384"?128:64;if(this._alg=t,this._key=e,e.length>r){var n=t==="rmd160"?new tB:rB(t);e=n.update(e).digest()}else e.length{y4e.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}});var lZ=V((jht,uZ)=>{"use strict";h();uZ.exports=iB()});var oB=V((qht,fZ)=>{h();var g4e=Math.pow(2,30)-1;fZ.exports=function(t,e){if(typeof t!="number")throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if(typeof e!="number")throw new TypeError("Key length not a number");if(e<0||e>g4e||e!==e)throw new TypeError("Bad key length")}});var sB=V((Kht,pZ)=>{h();var A8;globalThis.process&&globalThis.process.browser?A8="utf-8":globalThis.process&&globalThis.process.version?(hZ=parseInt(D.default.version.split(".")[0].slice(1),10),A8=hZ>=6?"utf-8":"binary"):A8="utf-8";var hZ;pZ.exports=A8});var cB=V((zht,mZ)=>{h();var aB=ur().Buffer;mZ.exports=function(t,e,r){if(aB.isBuffer(t))return t;if(typeof t=="string")return aB.from(t,e);if(ArrayBuffer.isView(t))return aB.from(t.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")}});var dB=V((Vht,bZ)=>{h();var v4e=eB(),b4e=v8(),w4e=x8(),x0=ur().Buffer,_4e=oB(),yZ=sB(),gZ=cB(),x4e=x0.alloc(128),T8={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function vZ(t,e,r){var n=E4e(t),i=t==="sha512"||t==="sha384"?128:64;e.length>i?e=n(e):e.length{h();var EZ=ur().Buffer,A4e=oB(),wZ=sB(),_Z=dB(),xZ=cB(),I8,mx=globalThis.crypto&&globalThis.crypto.subtle,T4e={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},uB=[];function I4e(t){if(globalThis.process&&!globalThis.process.browser||!mx||!mx.importKey||!mx.deriveBits)return Promise.resolve(!1);if(uB[t]!==void 0)return uB[t];I8=I8||EZ.alloc(8);var e=SZ(I8,I8,10,128,t).then(function(){return!0}).catch(function(){return!1});return uB[t]=e,e}var E0;function lB(){return E0||(globalThis.process&&globalThis.process.nextTick?E0=globalThis.process.nextTick:globalThis.queueMicrotask?E0=globalThis.queueMicrotask:globalThis.setImmediate?E0=globalThis.setImmediate:E0=globalThis.setTimeout,E0)}function SZ(t,e,r,n,i){return mx.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then(function(o){return mx.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:i}},o,n<<3)}).then(function(o){return EZ.from(o)})}function P4e(t,e){t.then(function(r){lB()(function(){e(null,r)})},function(r){lB()(function(){e(r)})})}AZ.exports=function(t,e,r,n,i,o){typeof i=="function"&&(o=i,i=void 0),i=i||"sha1";var s=T4e[i.toLowerCase()];if(!s||typeof globalThis.Promise!="function"){lB()(function(){var a;try{a=_Z(t,e,r,n,i)}catch(d){return o(d)}o(null,a)});return}if(A4e(r,n),t=xZ(t,wZ,"Password"),e=xZ(e,wZ,"Salt"),typeof o!="function")throw new Error("No callback provided to pbkdf2");P4e(I4e(s).then(function(a){return a?SZ(t,e,r,n,s):_Z(t,e,r,n,i)}),o)}});var hB=V(fB=>{h();fB.pbkdf2=TZ();fB.pbkdf2Sync=dB()});var pB=V(ed=>{"use strict";h();ed.readUInt32BE=function(e,r){var n=e[0+r]<<24|e[1+r]<<16|e[2+r]<<8|e[3+r];return n>>>0};ed.writeUInt32BE=function(e,r,n){e[0+n]=r>>>24,e[1+n]=r>>>16&255,e[2+n]=r>>>8&255,e[3+n]=r&255};ed.ip=function(e,r,n,i){for(var o=0,s=0,a=6;a>=0;a-=2){for(var d=0;d<=24;d+=8)o<<=1,o|=r>>>d+a&1;for(var d=0;d<=24;d+=8)o<<=1,o|=e>>>d+a&1}for(var a=6;a>=0;a-=2){for(var d=1;d<=25;d+=8)s<<=1,s|=r>>>d+a&1;for(var d=1;d<=25;d+=8)s<<=1,s|=e>>>d+a&1}n[i+0]=o>>>0,n[i+1]=s>>>0};ed.rip=function(e,r,n,i){for(var o=0,s=0,a=0;a<4;a++)for(var d=24;d>=0;d-=8)o<<=1,o|=r>>>d+a&1,o<<=1,o|=e>>>d+a&1;for(var a=4;a<8;a++)for(var d=24;d>=0;d-=8)s<<=1,s|=r>>>d+a&1,s<<=1,s|=e>>>d+a&1;n[i+0]=o>>>0,n[i+1]=s>>>0};ed.pc1=function(e,r,n,i){for(var o=0,s=0,a=7;a>=5;a--){for(var d=0;d<=24;d+=8)o<<=1,o|=r>>d+a&1;for(var d=0;d<=24;d+=8)o<<=1,o|=e>>d+a&1}for(var d=0;d<=24;d+=8)o<<=1,o|=r>>d+a&1;for(var a=1;a<=3;a++){for(var d=0;d<=24;d+=8)s<<=1,s|=r>>d+a&1;for(var d=0;d<=24;d+=8)s<<=1,s|=e>>d+a&1}for(var d=0;d<=24;d+=8)s<<=1,s|=e>>d+a&1;n[i+0]=o>>>0,n[i+1]=s>>>0};ed.r28shl=function(e,r){return e<>>28-r};var P8=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];ed.pc2=function(e,r,n,i){for(var o=0,s=0,a=P8.length>>>1,d=0;d>>P8[d]&1;for(var d=a;d>>P8[d]&1;n[i+0]=o>>>0,n[i+1]=s>>>0};ed.expand=function(e,r,n){var i=0,o=0;i=(e&1)<<5|e>>>27;for(var s=23;s>=15;s-=4)i<<=6,i|=e>>>s&63;for(var s=11;s>=3;s-=4)o|=e>>>s&63,o<<=6;o|=(e&31)<<1|e>>>31,r[n+0]=i>>>0,r[n+1]=o>>>0};var IZ=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];ed.substitute=function(e,r){for(var n=0,i=0;i<4;i++){var o=e>>>18-i*6&63,s=IZ[i*64+o];n<<=4,n|=s}for(var i=0;i<4;i++){var o=r>>>18-i*6&63,s=IZ[4*64+i*64+o];n<<=4,n|=s}return n>>>0};var PZ=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];ed.permute=function(e){for(var r=0,n=0;n>>PZ[n]&1;return r>>>0};ed.padSplit=function(e,r,n){for(var i=e.toString(2);i.length{h();RZ.exports=kZ;function kZ(t,e){if(!t)throw new Error(e||"Assertion failed")}kZ.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)}});var k8=V((rpt,DZ)=>{"use strict";h();var k4e=fc();function td(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=t.padding!==!1}DZ.exports=td;td.prototype._init=function(){};td.prototype.update=function(e){return e.length===0?[]:this.type==="decrypt"?this._updateDecrypt(e):this._updateEncrypt(e)};td.prototype._buffer=function(e,r){for(var n=Math.min(this.buffer.length-this.bufferOff,e.length-r),i=0;i0;i--)r+=this._buffer(e,r),n+=this._flushBuffer(o,n);return r+=this._buffer(e,r),o};td.prototype.final=function(e){var r;e&&(r=this.update(e));var n;return this.type==="encrypt"?n=this._finalEncrypt():n=this._finalDecrypt(),r?r.concat(n):n};td.prototype._pad=function(e,r){if(r===0)return!1;for(;r{"use strict";h();var BZ=fc(),R4e=lr(),Hi=pB(),MZ=k8();function D4e(){this.tmp=new Array(2),this.keys=null}function yl(t){MZ.call(this,t);var e=new D4e;this._desState=e,this.deriveKeys(e,t.key)}R4e(yl,MZ);CZ.exports=yl;yl.create=function(e){return new yl(e)};var B4e=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];yl.prototype.deriveKeys=function(e,r){e.keys=new Array(16*2),BZ.equal(r.length,this.blockSize,"Invalid key length");var n=Hi.readUInt32BE(r,0),i=Hi.readUInt32BE(r,4);Hi.pc1(n,i,e.tmp,0),n=e.tmp[0],i=e.tmp[1];for(var o=0;o>>1];n=Hi.r28shl(n,s),i=Hi.r28shl(i,s),Hi.pc2(n,i,e.keys,o)}};yl.prototype._update=function(e,r,n,i){var o=this._desState,s=Hi.readUInt32BE(e,r),a=Hi.readUInt32BE(e,r+4);Hi.ip(s,a,o.tmp,0),s=o.tmp[0],a=o.tmp[1],this.type==="encrypt"?this._encrypt(o,s,a,o.tmp,0):this._decrypt(o,s,a,o.tmp,0),s=o.tmp[0],a=o.tmp[1],Hi.writeUInt32BE(n,s,i),Hi.writeUInt32BE(n,a,i+4)};yl.prototype._pad=function(e,r){if(this.padding===!1)return!1;for(var n=e.length-r,i=r;i>>0,s=p}Hi.rip(a,s,i,o)};yl.prototype._decrypt=function(e,r,n,i,o){for(var s=n,a=r,d=e.keys.length-2;d>=0;d-=2){var u=e.keys[d],c=e.keys[d+1];Hi.expand(s,e.tmp,0),u^=e.tmp[0],c^=e.tmp[1];var l=Hi.substitute(u,c),m=Hi.permute(l),p=s;s=(a^m)>>>0,a=p}Hi.rip(s,a,i,o)}});var $Z=V(OZ=>{"use strict";h();var M4e=fc(),C4e=lr(),R8={};function O4e(t){M4e.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e{"use strict";h();var N4e=fc(),j4e=lr(),NZ=k8(),Kp=mB();function U4e(t,e){N4e.equal(e.length,24,"Invalid key length");var r=e.slice(0,8),n=e.slice(8,16),i=e.slice(16,24);t==="encrypt"?this.ciphers=[Kp.create({type:"encrypt",key:r}),Kp.create({type:"decrypt",key:n}),Kp.create({type:"encrypt",key:i})]:this.ciphers=[Kp.create({type:"decrypt",key:i}),Kp.create({type:"encrypt",key:n}),Kp.create({type:"decrypt",key:r})]}function S0(t){NZ.call(this,t);var e=new U4e(this.type,this.options.key);this._edeState=e}j4e(S0,NZ);jZ.exports=S0;S0.create=function(e){return new S0(e)};S0.prototype._update=function(e,r,n,i){var o=this._edeState;o.ciphers[0]._update(e,r,n,i),o.ciphers[1]._update(n,i,n,i),o.ciphers[2]._update(n,i,n,i)};S0.prototype._pad=Kp.prototype._pad;S0.prototype._unpad=Kp.prototype._unpad});var qZ=V(zb=>{"use strict";h();zb.utils=pB();zb.Cipher=k8();zb.DES=mB();zb.CBC=$Z();zb.EDE=UZ()});var FZ=V((fpt,KZ)=>{h();var LZ=Wf(),Vf=qZ(),q4e=lr(),A0=ur().Buffer,yx={"des-ede3-cbc":Vf.CBC.instantiate(Vf.EDE),"des-ede3":Vf.EDE,"des-ede-cbc":Vf.CBC.instantiate(Vf.EDE),"des-ede":Vf.EDE,"des-cbc":Vf.CBC.instantiate(Vf.DES),"des-ecb":Vf.DES};yx.des=yx["des-cbc"];yx.des3=yx["des-ede3-cbc"];KZ.exports=D8;q4e(D8,LZ);function D8(t){LZ.call(this);var e=t.mode.toLowerCase(),r=yx[e],n;t.decrypt?n="decrypt":n="encrypt";var i=t.key;A0.isBuffer(i)||(i=A0.from(i)),(e==="des-ede"||e==="des-ede-cbc")&&(i=A0.concat([i,i.slice(0,8)]));var o=t.iv;A0.isBuffer(o)||(o=A0.from(o)),this._des=r.create({key:i,iv:o,type:n})}D8.prototype._update=function(t){return A0.from(this._des.update(t))};D8.prototype._final=function(){return A0.from(this._des.final())}});var zZ=V(yB=>{h();yB.encrypt=function(t,e){return t._cipher.encryptBlock(e)};yB.decrypt=function(t,e){return t._cipher.decryptBlock(e)}});var Wb=V((ypt,WZ)=>{h();WZ.exports=function(e,r){for(var n=Math.min(e.length,r.length),i=new O.Buffer(n),o=0;o{h();var VZ=Wb();gB.encrypt=function(t,e){var r=VZ(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev};gB.decrypt=function(t,e){var r=t._prev;t._prev=e;var n=t._cipher.decryptBlock(e);return VZ(n,r)}});var YZ=V(JZ=>{h();var gx=ur().Buffer,L4e=Wb();function GZ(t,e,r){var n=e.length,i=L4e(e,t._cache);return t._cache=t._cache.slice(n),t._prev=gx.concat([t._prev,r?e:i]),i}JZ.encrypt=function(t,e,r){for(var n=gx.allocUnsafe(0),i;e.length;)if(t._cache.length===0&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=gx.allocUnsafe(0)),t._cache.length<=e.length)i=t._cache.length,n=gx.concat([n,GZ(t,e.slice(0,i),r)]),e=e.slice(i);else{n=gx.concat([n,GZ(t,e,r)]);break}return n}});var XZ=V(ZZ=>{h();var vB=ur().Buffer;function K4e(t,e,r){var n=t._cipher.encryptBlock(t._prev),i=n[0]^e;return t._prev=vB.concat([t._prev.slice(1),vB.from([r?e:i])]),i}ZZ.encrypt=function(t,e,r){for(var n=e.length,i=vB.allocUnsafe(n),o=-1;++o{h();var B8=ur().Buffer;function F4e(t,e,r){for(var n,i=-1,o=8,s=0,a,d;++i>i%8,t._prev=z4e(t._prev,r?a:d);return s}function z4e(t,e){var r=t.length,n=-1,i=B8.allocUnsafe(t.length);for(t=B8.concat([t,B8.from([e])]);++n>7;return i}QZ.encrypt=function(t,e,r){for(var n=e.length,i=B8.allocUnsafe(n),o=-1;++o{h();var W4e=Wb();function V4e(t){return t._prev=t._cipher.encryptBlock(t._prev),t._prev}tX.encrypt=function(t,e){for(;t._cache.length{h();function H4e(t){for(var e=t.length,r;e--;)if(r=t.readUInt8(e),r===255)t.writeUInt8(0,e);else{r++,t.writeUInt8(r,e);break}}nX.exports=H4e});var _B=V(oX=>{h();var G4e=Wb(),iX=ur().Buffer,J4e=bB();function Y4e(t){var e=t._cipher.encryptBlockRaw(t._prev);return J4e(t._prev),e}var wB=16;oX.encrypt=function(t,e){var r=Math.ceil(e.length/wB),n=t._cache.length;t._cache=iX.concat([t._cache,iX.allocUnsafe(r*wB)]);for(var i=0;i{Z4e.exports={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}}});var C8=V((Mpt,sX)=>{h();var X4e={ECB:zZ(),CBC:HZ(),CFB:YZ(),CFB8:XZ(),CFB1:eX(),OFB:rX(),CTR:_B(),GCM:_B()},M8=xB();for(EB in M8)M8[EB].module=X4e[M8[EB].mode];var EB;sX.exports=M8});var vx=V((Opt,cX)=>{h();var O8=ur().Buffer;function AB(t){O8.isBuffer(t)||(t=O8.from(t));for(var e=t.length/4|0,r=new Array(e),n=0;n>>24]^s[c>>>16&255]^a[l>>>8&255]^d[m&255]^e[A++],g=o[c>>>24]^s[l>>>16&255]^a[m>>>8&255]^d[u&255]^e[A++],v=o[l>>>24]^s[m>>>16&255]^a[u>>>8&255]^d[c&255]^e[A++],E=o[m>>>24]^s[u>>>16&255]^a[c>>>8&255]^d[l&255]^e[A++],u=p,c=g,l=v,m=E;return p=(n[u>>>24]<<24|n[c>>>16&255]<<16|n[l>>>8&255]<<8|n[m&255])^e[A++],g=(n[c>>>24]<<24|n[l>>>16&255]<<16|n[m>>>8&255]<<8|n[u&255])^e[A++],v=(n[l>>>24]<<24|n[m>>>16&255]<<16|n[u>>>8&255]<<8|n[c&255])^e[A++],E=(n[m>>>24]<<24|n[u>>>16&255]<<16|n[c>>>8&255]<<8|n[l&255])^e[A++],p=p>>>0,g=g>>>0,v=v>>>0,E=E>>>0,[p,g,v,E]}var Q4e=[0,1,2,4,8,16,32,64,128,27,54],Ui=function(){for(var t=new Array(256),e=0;e<256;e++)e<128?t[e]=e<<1:t[e]=e<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,d=0;d<256;++d){var u=a^a<<1^a<<2^a<<3^a<<4;u=u>>>8^u&255^99,r[s]=u,n[u]=s;var c=t[s],l=t[c],m=t[l],p=t[u]*257^u*16843008;i[0][s]=p<<24|p>>>8,i[1][s]=p<<16|p>>>16,i[2][s]=p<<8|p>>>24,i[3][s]=p,p=m*16843009^l*65537^c*257^s*16843008,o[0][u]=p<<24|p>>>8,o[1][u]=p<<16|p>>>16,o[2][u]=p<<8|p>>>24,o[3][u]=p,s===0?s=a=1:(s=c^t[t[t[m^c]]],a^=t[t[a]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function rd(t){this._key=AB(t),this._reset()}rd.blockSize=4*4;rd.keySize=256/8;rd.prototype.blockSize=rd.blockSize;rd.prototype.keySize=rd.keySize;rd.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,n=(r+1)*4,i=[],o=0;o>>24,s=Ui.SBOX[s>>>24]<<24|Ui.SBOX[s>>>16&255]<<16|Ui.SBOX[s>>>8&255]<<8|Ui.SBOX[s&255],s^=Q4e[o/e|0]<<24):e>6&&o%e===4&&(s=Ui.SBOX[s>>>24]<<24|Ui.SBOX[s>>>16&255]<<16|Ui.SBOX[s>>>8&255]<<8|Ui.SBOX[s&255]),i[o]=i[o-e]^s}for(var a=[],d=0;d>>24]]^Ui.INV_SUB_MIX[1][Ui.SBOX[c>>>16&255]]^Ui.INV_SUB_MIX[2][Ui.SBOX[c>>>8&255]]^Ui.INV_SUB_MIX[3][Ui.SBOX[c&255]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=a};rd.prototype.encryptBlockRaw=function(t){return t=AB(t),aX(t,this._keySchedule,Ui.SUB_MIX,Ui.SBOX,this._nRounds)};rd.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=O8.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r};rd.prototype.decryptBlock=function(t){t=AB(t);var e=t[1];t[1]=t[3],t[3]=e;var r=aX(t,this._invKeySchedule,Ui.INV_SUB_MIX,Ui.INV_SBOX,this._nRounds),n=O8.allocUnsafe(16);return n.writeUInt32BE(r[0],0),n.writeUInt32BE(r[3],4),n.writeUInt32BE(r[2],8),n.writeUInt32BE(r[1],12),n};rd.prototype.scrub=function(){SB(this._keySchedule),SB(this._invKeySchedule),SB(this._key)};cX.exports.AES=rd});var lX=V((Npt,uX)=>{h();var Vb=ur().Buffer,eAe=Vb.alloc(16,0);function tAe(t){return[t.readUInt32BE(0),t.readUInt32BE(4),t.readUInt32BE(8),t.readUInt32BE(12)]}function dX(t){var e=Vb.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function bx(t){this.h=t,this.state=Vb.alloc(16,0),this.cache=Vb.allocUnsafe(0)}bx.prototype.ghash=function(t){for(var e=-1;++e0;r--)t[r]=t[r]>>>1|(t[r-1]&1)<<31;t[0]=t[0]>>>1,i&&(t[0]=t[0]^225<<24)}this.state=dX(e)};bx.prototype.update=function(t){this.cache=Vb.concat([this.cache,t]);for(var e;this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)};bx.prototype.final=function(t,e){return this.cache.length&&this.ghash(Vb.concat([this.cache,eAe],16)),this.ghash(dX([0,t,0,e])),this.state};uX.exports=bx});var TB=V((Upt,pX)=>{h();var rAe=vx(),Ia=ur().Buffer,fX=Wf(),nAe=lr(),hX=lX(),iAe=Wb(),oAe=bB();function sAe(t,e){var r=0;t.length!==e.length&&r++;for(var n=Math.min(t.length,e.length),i=0;i{h();var cAe=vx(),IB=ur().Buffer,mX=Wf(),dAe=lr();function $8(t,e,r,n){mX.call(this),this._cipher=new cAe.AES(e),this._prev=IB.from(r),this._cache=IB.allocUnsafe(0),this._secCache=IB.allocUnsafe(0),this._decrypt=n,this._mode=t}dAe($8,mX);$8.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)};$8.prototype._final=function(){this._cipher.scrub()};yX.exports=$8});var wx=V((Fpt,gX)=>{h();var I0=ur().Buffer,uAe=y8();function lAe(t,e,r,n){if(I0.isBuffer(t)||(t=I0.from(t,"binary")),e&&(I0.isBuffer(e)||(e=I0.from(e,"binary")),e.length!==8))throw new RangeError("salt should be Buffer with 8 byte length");for(var i=r/8,o=I0.alloc(i),s=I0.alloc(n||0),a=I0.alloc(0);i>0||n>0;){var d=new uAe;d.update(a),d.update(t),e&&d.update(e),a=d.digest();var u=0;if(i>0){var c=o.length-i;u=Math.min(i,a.length),a.copy(o,c,0,u),i-=u}if(u0){var l=s.length-n,m=Math.min(n,a.length-u);a.copy(s,l,u,u+m),n-=m}}return a.fill(0),{key:o,iv:s}}gX.exports=lAe});var _X=V(kB=>{h();var vX=C8(),fAe=TB(),Hf=ur().Buffer,hAe=PB(),bX=Wf(),pAe=vx(),mAe=wx(),yAe=lr();function _x(t,e,r){bX.call(this),this._cache=new N8,this._cipher=new pAe.AES(e),this._prev=Hf.from(r),this._mode=t,this._autopadding=!0}yAe(_x,bX);_x.prototype._update=function(t){this._cache.add(t);for(var e,r,n=[];e=this._cache.get();)r=this._mode.encrypt(this,e),n.push(r);return Hf.concat(n)};var gAe=Hf.alloc(16,16);_x.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(gAe))throw this._cipher.scrub(),new Error("data not multiple of block length")};_x.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this};function N8(){this.cache=Hf.allocUnsafe(0)}N8.prototype.add=function(t){this.cache=Hf.concat([this.cache,t])};N8.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null};N8.prototype.flush=function(){for(var t=16-this.cache.length,e=Hf.allocUnsafe(t),r=-1;++r{h();var bAe=TB(),Hb=ur().Buffer,xX=C8(),wAe=PB(),EX=Wf(),_Ae=vx(),xAe=wx(),EAe=lr();function xx(t,e,r){EX.call(this),this._cache=new j8,this._last=void 0,this._cipher=new _Ae.AES(e),this._prev=Hb.from(r),this._mode=t,this._autopadding=!0}EAe(xx,EX);xx.prototype._update=function(t){this._cache.add(t);for(var e,r,n=[];e=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,e),n.push(r);return Hb.concat(n)};xx.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return SAe(this._mode.decrypt(this,t));if(t)throw new Error("data not multiple of block length")};xx.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this};function j8(){this.cache=Hb.allocUnsafe(0)}j8.prototype.add=function(t){this.cache=Hb.concat([this.cache,t])};j8.prototype.get=function(t){var e;if(t){if(this.cache.length>16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null};j8.prototype.flush=function(){if(this.cache.length)return this.cache};function SAe(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");for(var r=-1;++r{h();var TX=_X(),IX=AX(),TAe=xB();function IAe(){return Object.keys(TAe)}iu.createCipher=iu.Cipher=TX.createCipher;iu.createCipheriv=iu.Cipheriv=TX.createCipheriv;iu.createDecipher=iu.Decipher=IX.createDecipher;iu.createDecipheriv=iu.Decipheriv=IX.createDecipheriv;iu.listCiphers=iu.getCiphers=IAe});var PX=V(Gf=>{h();Gf["des-ecb"]={key:8,iv:0};Gf["des-cbc"]=Gf.des={key:8,iv:8};Gf["des-ede3-cbc"]=Gf.des3={key:24,iv:8};Gf["des-ede3"]={key:24,iv:0};Gf["des-ede-cbc"]={key:16,iv:8};Gf["des-ede"]={key:16,iv:0}});var MX=V(ou=>{h();var kX=FZ(),DB=U8(),Fp=C8(),Jf=PX(),RX=wx();function PAe(t,e){t=t.toLowerCase();var r,n;if(Fp[t])r=Fp[t].key,n=Fp[t].iv;else if(Jf[t])r=Jf[t].key*8,n=Jf[t].iv;else throw new TypeError("invalid suite type");var i=RX(e,!1,r,n);return DX(t,i.key,i.iv)}function kAe(t,e){t=t.toLowerCase();var r,n;if(Fp[t])r=Fp[t].key,n=Fp[t].iv;else if(Jf[t])r=Jf[t].key*8,n=Jf[t].iv;else throw new TypeError("invalid suite type");var i=RX(e,!1,r,n);return BX(t,i.key,i.iv)}function DX(t,e,r){if(t=t.toLowerCase(),Fp[t])return DB.createCipheriv(t,e,r);if(Jf[t])return new kX({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function BX(t,e,r){if(t=t.toLowerCase(),Fp[t])return DB.createDecipheriv(t,e,r);if(Jf[t])return new kX({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}function RAe(){return Object.keys(Jf).concat(DB.getCiphers())}ou.createCipher=ou.Cipher=PAe;ou.createCipheriv=ou.Cipheriv=DX;ou.createDecipher=ou.Decipher=kAe;ou.createDecipheriv=ou.Decipheriv=BX;ou.listCiphers=ou.getCiphers=RAe});var BB=V(()=>{h()});var Gi=V((CX,MB)=>{h();(function(t,e){"use strict";function r(L,T){if(!L)throw new Error(T||"Assertion failed")}function n(L,T){L.super_=T;var S=function(){};S.prototype=T.prototype,L.prototype=new S,L.prototype.constructor=L}function i(L,T,S){if(i.isBN(L))return L;this.negative=0,this.words=null,this.length=0,this.red=null,L!==null&&((T==="le"||T==="be")&&(S=T,T=10),this._init(L||0,T||10,S||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=BB().Buffer}catch{}i.isBN=function(T){return T instanceof i?!0:T!==null&&typeof T=="object"&&T.constructor.wordSize===i.wordSize&&Array.isArray(T.words)},i.max=function(T,S){return T.cmp(S)>0?T:S},i.min=function(T,S){return T.cmp(S)<0?T:S},i.prototype._init=function(T,S,k){if(typeof T=="number")return this._initNumber(T,S,k);if(typeof T=="object")return this._initArray(T,S,k);S==="hex"&&(S=16),r(S===(S|0)&&S>=2&&S<=36),T=T.toString().replace(/\s+/g,"");var f=0;T[0]==="-"&&(f++,this.negative=1),f=0;f-=3)w=T[f]|T[f-1]<<8|T[f-2]<<16,this.words[y]|=w<<_&67108863,this.words[y+1]=w>>>26-_&67108863,_+=24,_>=26&&(_-=26,y++);else if(k==="le")for(f=0,y=0;f>>26-_&67108863,_+=24,_>=26&&(_-=26,y++);return this.strip()};function s(L,T){var S=L.charCodeAt(T);return S>=65&&S<=70?S-55:S>=97&&S<=102?S-87:S-48&15}function a(L,T,S){var k=s(L,S);return S-1>=T&&(k|=s(L,S-1)<<4),k}i.prototype._parseHex=function(T,S,k){this.length=Math.ceil((T.length-S)/6),this.words=new Array(this.length);for(var f=0;f=S;f-=2)_=a(T,S,f)<=18?(y-=18,w+=1,this.words[w]|=_>>>26):y+=8;else{var x=T.length-S;for(f=x%2===0?S+1:S;f=18?(y-=18,w+=1,this.words[w]|=_>>>26):y+=8}this.strip()};function d(L,T,S,k){for(var f=0,y=Math.min(L.length,S),w=T;w=49?f+=_-49+10:_>=17?f+=_-17+10:f+=_}return f}i.prototype._parseBase=function(T,S,k){this.words=[0],this.length=1;for(var f=0,y=1;y<=67108863;y*=S)f++;f--,y=y/S|0;for(var w=T.length-k,_=w%f,x=Math.min(w,w-_)+k,b=0,B=k;B1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(T,S){T=T||10,S=S|0||1;var k;if(T===16||T==="hex"){k="";for(var f=0,y=0,w=0;w>>24-f&16777215,y!==0||w!==this.length-1?k=u[6-x.length]+x+k:k=x+k,f+=2,f>=26&&(f-=26,w--)}for(y!==0&&(k=y.toString(16)+k);k.length%S!==0;)k="0"+k;return this.negative!==0&&(k="-"+k),k}if(T===(T|0)&&T>=2&&T<=36){var b=c[T],B=l[T];k="";var q=this.clone();for(q.negative=0;!q.isZero();){var M=q.modn(B).toString(T);q=q.idivn(B),q.isZero()?k=M+k:k=u[b-M.length]+M+k}for(this.isZero()&&(k="0"+k);k.length%S!==0;)k="0"+k;return this.negative!==0&&(k="-"+k),k}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var T=this.words[0];return this.length===2?T+=this.words[1]*67108864:this.length===3&&this.words[2]===1?T+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-T:T},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(T,S){return r(typeof o<"u"),this.toArrayLike(o,T,S)},i.prototype.toArray=function(T,S){return this.toArrayLike(Array,T,S)},i.prototype.toArrayLike=function(T,S,k){var f=this.byteLength(),y=k||Math.max(1,f);r(f<=y,"byte array longer than desired length"),r(y>0,"Requested array length <= 0"),this.strip();var w=S==="le",_=new T(y),x,b,B=this.clone();if(w){for(b=0;!B.isZero();b++)x=B.andln(255),B.iushrn(8),_[b]=x;for(;b=4096&&(k+=13,S>>>=13),S>=64&&(k+=7,S>>>=7),S>=8&&(k+=4,S>>>=4),S>=2&&(k+=2,S>>>=2),k+S},i.prototype._zeroBits=function(T){if(T===0)return 26;var S=T,k=0;return S&8191||(k+=13,S>>>=13),S&127||(k+=7,S>>>=7),S&15||(k+=4,S>>>=4),S&3||(k+=2,S>>>=2),S&1||k++,k},i.prototype.bitLength=function(){var T=this.words[this.length-1],S=this._countBits(T);return(this.length-1)*26+S};function m(L){for(var T=new Array(L.bitLength()),S=0;S>>f}return T}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var T=0,S=0;ST.length?this.clone().ior(T):T.clone().ior(this)},i.prototype.uor=function(T){return this.length>T.length?this.clone().iuor(T):T.clone().iuor(this)},i.prototype.iuand=function(T){var S;this.length>T.length?S=T:S=this;for(var k=0;kT.length?this.clone().iand(T):T.clone().iand(this)},i.prototype.uand=function(T){return this.length>T.length?this.clone().iuand(T):T.clone().iuand(this)},i.prototype.iuxor=function(T){var S,k;this.length>T.length?(S=this,k=T):(S=T,k=this);for(var f=0;fT.length?this.clone().ixor(T):T.clone().ixor(this)},i.prototype.uxor=function(T){return this.length>T.length?this.clone().iuxor(T):T.clone().iuxor(this)},i.prototype.inotn=function(T){r(typeof T=="number"&&T>=0);var S=Math.ceil(T/26)|0,k=T%26;this._expand(S),k>0&&S--;for(var f=0;f0&&(this.words[f]=~this.words[f]&67108863>>26-k),this.strip()},i.prototype.notn=function(T){return this.clone().inotn(T)},i.prototype.setn=function(T,S){r(typeof T=="number"&&T>=0);var k=T/26|0,f=T%26;return this._expand(k+1),S?this.words[k]=this.words[k]|1<T.length?(k=this,f=T):(k=T,f=this);for(var y=0,w=0;w>>26;for(;y!==0&&w>>26;if(this.length=k.length,y!==0)this.words[this.length]=y,this.length++;else if(k!==this)for(;wT.length?this.clone().iadd(T):T.clone().iadd(this)},i.prototype.isub=function(T){if(T.negative!==0){T.negative=0;var S=this.iadd(T);return T.negative=1,S._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(T),this.negative=1,this._normSign();var k=this.cmp(T);if(k===0)return this.negative=0,this.length=1,this.words[0]=0,this;var f,y;k>0?(f=this,y=T):(f=T,y=this);for(var w=0,_=0;_>26,this.words[_]=S&67108863;for(;w!==0&&_>26,this.words[_]=S&67108863;if(w===0&&_>>26,q=x&67108863,M=Math.min(b,T.length-1),j=Math.max(0,b-L.length+1);j<=M;j++){var J=b-j|0;f=L.words[J]|0,y=T.words[j]|0,w=f*y+q,B+=w/67108864|0,q=w&67108863}S.words[b]=q|0,x=B|0}return x!==0?S.words[b]=x|0:S.length--,S.strip()}var g=function(T,S,k){var f=T.words,y=S.words,w=k.words,_=0,x,b,B,q=f[0]|0,M=q&8191,j=q>>>13,J=f[1]|0,Z=J&8191,G=J>>>13,H=f[2]|0,X=H&8191,ee=H>>>13,ue=f[3]|0,ae=ue&8191,ce=ue>>>13,me=f[4]|0,Ee=me&8191,qe=me>>>13,fe=f[5]|0,ve=fe&8191,we=fe>>>13,Ce=f[6]|0,Pe=Ce&8191,Ue=Ce>>>13,bt=f[7]|0,Te=bt&8191,De=bt>>>13,Dt=f[8]|0,_e=Dt&8191,Se=Dt>>>13,Wr=f[9]|0,ze=Wr&8191,Ge=Wr>>>13,zs=y[0]|0,pt=zs&8191,Mt=zs>>>13,wi=y[1]|0,Pt=wi&8191,Xe=wi>>>13,Kc=y[2]|0,kt=Kc&8191,Ut=Kc>>>13,By=y[3]|0,$t=By&8191,Jt=By>>>13,Fc=y[4]|0,Yt=Fc&8191,Wt=Fc>>>13,My=y[5]|0,qt=My&8191,Vt=My>>>13,Cy=y[6]|0,Ht=Cy&8191,Zt=Cy>>>13,ap=y[7]|0,Q=ap&8191,Y=ap>>>13,te=y[8]|0,re=te&8191,ie=te>>>13,Ne=y[9]|0,ke=Ne&8191,je=Ne>>>13;k.negative=T.negative^S.negative,k.length=19,x=Math.imul(M,pt),b=Math.imul(M,Mt),b=b+Math.imul(j,pt)|0,B=Math.imul(j,Mt);var kr=(_+x|0)+((b&8191)<<13)|0;_=(B+(b>>>13)|0)+(kr>>>26)|0,kr&=67108863,x=Math.imul(Z,pt),b=Math.imul(Z,Mt),b=b+Math.imul(G,pt)|0,B=Math.imul(G,Mt),x=x+Math.imul(M,Pt)|0,b=b+Math.imul(M,Xe)|0,b=b+Math.imul(j,Pt)|0,B=B+Math.imul(j,Xe)|0;var Lt=(_+x|0)+((b&8191)<<13)|0;_=(B+(b>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,x=Math.imul(X,pt),b=Math.imul(X,Mt),b=b+Math.imul(ee,pt)|0,B=Math.imul(ee,Mt),x=x+Math.imul(Z,Pt)|0,b=b+Math.imul(Z,Xe)|0,b=b+Math.imul(G,Pt)|0,B=B+Math.imul(G,Xe)|0,x=x+Math.imul(M,kt)|0,b=b+Math.imul(M,Ut)|0,b=b+Math.imul(j,kt)|0,B=B+Math.imul(j,Ut)|0;var lt=(_+x|0)+((b&8191)<<13)|0;_=(B+(b>>>13)|0)+(lt>>>26)|0,lt&=67108863,x=Math.imul(ae,pt),b=Math.imul(ae,Mt),b=b+Math.imul(ce,pt)|0,B=Math.imul(ce,Mt),x=x+Math.imul(X,Pt)|0,b=b+Math.imul(X,Xe)|0,b=b+Math.imul(ee,Pt)|0,B=B+Math.imul(ee,Xe)|0,x=x+Math.imul(Z,kt)|0,b=b+Math.imul(Z,Ut)|0,b=b+Math.imul(G,kt)|0,B=B+Math.imul(G,Ut)|0,x=x+Math.imul(M,$t)|0,b=b+Math.imul(M,Jt)|0,b=b+Math.imul(j,$t)|0,B=B+Math.imul(j,Jt)|0;var Xr=(_+x|0)+((b&8191)<<13)|0;_=(B+(b>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,x=Math.imul(Ee,pt),b=Math.imul(Ee,Mt),b=b+Math.imul(qe,pt)|0,B=Math.imul(qe,Mt),x=x+Math.imul(ae,Pt)|0,b=b+Math.imul(ae,Xe)|0,b=b+Math.imul(ce,Pt)|0,B=B+Math.imul(ce,Xe)|0,x=x+Math.imul(X,kt)|0,b=b+Math.imul(X,Ut)|0,b=b+Math.imul(ee,kt)|0,B=B+Math.imul(ee,Ut)|0,x=x+Math.imul(Z,$t)|0,b=b+Math.imul(Z,Jt)|0,b=b+Math.imul(G,$t)|0,B=B+Math.imul(G,Jt)|0,x=x+Math.imul(M,Yt)|0,b=b+Math.imul(M,Wt)|0,b=b+Math.imul(j,Yt)|0,B=B+Math.imul(j,Wt)|0;var ln=(_+x|0)+((b&8191)<<13)|0;_=(B+(b>>>13)|0)+(ln>>>26)|0,ln&=67108863,x=Math.imul(ve,pt),b=Math.imul(ve,Mt),b=b+Math.imul(we,pt)|0,B=Math.imul(we,Mt),x=x+Math.imul(Ee,Pt)|0,b=b+Math.imul(Ee,Xe)|0,b=b+Math.imul(qe,Pt)|0,B=B+Math.imul(qe,Xe)|0,x=x+Math.imul(ae,kt)|0,b=b+Math.imul(ae,Ut)|0,b=b+Math.imul(ce,kt)|0,B=B+Math.imul(ce,Ut)|0,x=x+Math.imul(X,$t)|0,b=b+Math.imul(X,Jt)|0,b=b+Math.imul(ee,$t)|0,B=B+Math.imul(ee,Jt)|0,x=x+Math.imul(Z,Yt)|0,b=b+Math.imul(Z,Wt)|0,b=b+Math.imul(G,Yt)|0,B=B+Math.imul(G,Wt)|0,x=x+Math.imul(M,qt)|0,b=b+Math.imul(M,Vt)|0,b=b+Math.imul(j,qt)|0,B=B+Math.imul(j,Vt)|0;var Jr=(_+x|0)+((b&8191)<<13)|0;_=(B+(b>>>13)|0)+(Jr>>>26)|0,Jr&=67108863,x=Math.imul(Pe,pt),b=Math.imul(Pe,Mt),b=b+Math.imul(Ue,pt)|0,B=Math.imul(Ue,Mt),x=x+Math.imul(ve,Pt)|0,b=b+Math.imul(ve,Xe)|0,b=b+Math.imul(we,Pt)|0,B=B+Math.imul(we,Xe)|0,x=x+Math.imul(Ee,kt)|0,b=b+Math.imul(Ee,Ut)|0,b=b+Math.imul(qe,kt)|0,B=B+Math.imul(qe,Ut)|0,x=x+Math.imul(ae,$t)|0,b=b+Math.imul(ae,Jt)|0,b=b+Math.imul(ce,$t)|0,B=B+Math.imul(ce,Jt)|0,x=x+Math.imul(X,Yt)|0,b=b+Math.imul(X,Wt)|0,b=b+Math.imul(ee,Yt)|0,B=B+Math.imul(ee,Wt)|0,x=x+Math.imul(Z,qt)|0,b=b+Math.imul(Z,Vt)|0,b=b+Math.imul(G,qt)|0,B=B+Math.imul(G,Vt)|0,x=x+Math.imul(M,Ht)|0,b=b+Math.imul(M,Zt)|0,b=b+Math.imul(j,Ht)|0,B=B+Math.imul(j,Zt)|0;var dr=(_+x|0)+((b&8191)<<13)|0;_=(B+(b>>>13)|0)+(dr>>>26)|0,dr&=67108863,x=Math.imul(Te,pt),b=Math.imul(Te,Mt),b=b+Math.imul(De,pt)|0,B=Math.imul(De,Mt),x=x+Math.imul(Pe,Pt)|0,b=b+Math.imul(Pe,Xe)|0,b=b+Math.imul(Ue,Pt)|0,B=B+Math.imul(Ue,Xe)|0,x=x+Math.imul(ve,kt)|0,b=b+Math.imul(ve,Ut)|0,b=b+Math.imul(we,kt)|0,B=B+Math.imul(we,Ut)|0,x=x+Math.imul(Ee,$t)|0,b=b+Math.imul(Ee,Jt)|0,b=b+Math.imul(qe,$t)|0,B=B+Math.imul(qe,Jt)|0,x=x+Math.imul(ae,Yt)|0,b=b+Math.imul(ae,Wt)|0,b=b+Math.imul(ce,Yt)|0,B=B+Math.imul(ce,Wt)|0,x=x+Math.imul(X,qt)|0,b=b+Math.imul(X,Vt)|0,b=b+Math.imul(ee,qt)|0,B=B+Math.imul(ee,Vt)|0,x=x+Math.imul(Z,Ht)|0,b=b+Math.imul(Z,Zt)|0,b=b+Math.imul(G,Ht)|0,B=B+Math.imul(G,Zt)|0,x=x+Math.imul(M,Q)|0,b=b+Math.imul(M,Y)|0,b=b+Math.imul(j,Q)|0,B=B+Math.imul(j,Y)|0;var Qr=(_+x|0)+((b&8191)<<13)|0;_=(B+(b>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,x=Math.imul(_e,pt),b=Math.imul(_e,Mt),b=b+Math.imul(Se,pt)|0,B=Math.imul(Se,Mt),x=x+Math.imul(Te,Pt)|0,b=b+Math.imul(Te,Xe)|0,b=b+Math.imul(De,Pt)|0,B=B+Math.imul(De,Xe)|0,x=x+Math.imul(Pe,kt)|0,b=b+Math.imul(Pe,Ut)|0,b=b+Math.imul(Ue,kt)|0,B=B+Math.imul(Ue,Ut)|0,x=x+Math.imul(ve,$t)|0,b=b+Math.imul(ve,Jt)|0,b=b+Math.imul(we,$t)|0,B=B+Math.imul(we,Jt)|0,x=x+Math.imul(Ee,Yt)|0,b=b+Math.imul(Ee,Wt)|0,b=b+Math.imul(qe,Yt)|0,B=B+Math.imul(qe,Wt)|0,x=x+Math.imul(ae,qt)|0,b=b+Math.imul(ae,Vt)|0,b=b+Math.imul(ce,qt)|0,B=B+Math.imul(ce,Vt)|0,x=x+Math.imul(X,Ht)|0,b=b+Math.imul(X,Zt)|0,b=b+Math.imul(ee,Ht)|0,B=B+Math.imul(ee,Zt)|0,x=x+Math.imul(Z,Q)|0,b=b+Math.imul(Z,Y)|0,b=b+Math.imul(G,Q)|0,B=B+Math.imul(G,Y)|0,x=x+Math.imul(M,re)|0,b=b+Math.imul(M,ie)|0,b=b+Math.imul(j,re)|0,B=B+Math.imul(j,ie)|0;var Cr=(_+x|0)+((b&8191)<<13)|0;_=(B+(b>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,x=Math.imul(ze,pt),b=Math.imul(ze,Mt),b=b+Math.imul(Ge,pt)|0,B=Math.imul(Ge,Mt),x=x+Math.imul(_e,Pt)|0,b=b+Math.imul(_e,Xe)|0,b=b+Math.imul(Se,Pt)|0,B=B+Math.imul(Se,Xe)|0,x=x+Math.imul(Te,kt)|0,b=b+Math.imul(Te,Ut)|0,b=b+Math.imul(De,kt)|0,B=B+Math.imul(De,Ut)|0,x=x+Math.imul(Pe,$t)|0,b=b+Math.imul(Pe,Jt)|0,b=b+Math.imul(Ue,$t)|0,B=B+Math.imul(Ue,Jt)|0,x=x+Math.imul(ve,Yt)|0,b=b+Math.imul(ve,Wt)|0,b=b+Math.imul(we,Yt)|0,B=B+Math.imul(we,Wt)|0,x=x+Math.imul(Ee,qt)|0,b=b+Math.imul(Ee,Vt)|0,b=b+Math.imul(qe,qt)|0,B=B+Math.imul(qe,Vt)|0,x=x+Math.imul(ae,Ht)|0,b=b+Math.imul(ae,Zt)|0,b=b+Math.imul(ce,Ht)|0,B=B+Math.imul(ce,Zt)|0,x=x+Math.imul(X,Q)|0,b=b+Math.imul(X,Y)|0,b=b+Math.imul(ee,Q)|0,B=B+Math.imul(ee,Y)|0,x=x+Math.imul(Z,re)|0,b=b+Math.imul(Z,ie)|0,b=b+Math.imul(G,re)|0,B=B+Math.imul(G,ie)|0,x=x+Math.imul(M,ke)|0,b=b+Math.imul(M,je)|0,b=b+Math.imul(j,ke)|0,B=B+Math.imul(j,je)|0;var Ws=(_+x|0)+((b&8191)<<13)|0;_=(B+(b>>>13)|0)+(Ws>>>26)|0,Ws&=67108863,x=Math.imul(ze,Pt),b=Math.imul(ze,Xe),b=b+Math.imul(Ge,Pt)|0,B=Math.imul(Ge,Xe),x=x+Math.imul(_e,kt)|0,b=b+Math.imul(_e,Ut)|0,b=b+Math.imul(Se,kt)|0,B=B+Math.imul(Se,Ut)|0,x=x+Math.imul(Te,$t)|0,b=b+Math.imul(Te,Jt)|0,b=b+Math.imul(De,$t)|0,B=B+Math.imul(De,Jt)|0,x=x+Math.imul(Pe,Yt)|0,b=b+Math.imul(Pe,Wt)|0,b=b+Math.imul(Ue,Yt)|0,B=B+Math.imul(Ue,Wt)|0,x=x+Math.imul(ve,qt)|0,b=b+Math.imul(ve,Vt)|0,b=b+Math.imul(we,qt)|0,B=B+Math.imul(we,Vt)|0,x=x+Math.imul(Ee,Ht)|0,b=b+Math.imul(Ee,Zt)|0,b=b+Math.imul(qe,Ht)|0,B=B+Math.imul(qe,Zt)|0,x=x+Math.imul(ae,Q)|0,b=b+Math.imul(ae,Y)|0,b=b+Math.imul(ce,Q)|0,B=B+Math.imul(ce,Y)|0,x=x+Math.imul(X,re)|0,b=b+Math.imul(X,ie)|0,b=b+Math.imul(ee,re)|0,B=B+Math.imul(ee,ie)|0,x=x+Math.imul(Z,ke)|0,b=b+Math.imul(Z,je)|0,b=b+Math.imul(G,ke)|0,B=B+Math.imul(G,je)|0;var _i=(_+x|0)+((b&8191)<<13)|0;_=(B+(b>>>13)|0)+(_i>>>26)|0,_i&=67108863,x=Math.imul(ze,kt),b=Math.imul(ze,Ut),b=b+Math.imul(Ge,kt)|0,B=Math.imul(Ge,Ut),x=x+Math.imul(_e,$t)|0,b=b+Math.imul(_e,Jt)|0,b=b+Math.imul(Se,$t)|0,B=B+Math.imul(Se,Jt)|0,x=x+Math.imul(Te,Yt)|0,b=b+Math.imul(Te,Wt)|0,b=b+Math.imul(De,Yt)|0,B=B+Math.imul(De,Wt)|0,x=x+Math.imul(Pe,qt)|0,b=b+Math.imul(Pe,Vt)|0,b=b+Math.imul(Ue,qt)|0,B=B+Math.imul(Ue,Vt)|0,x=x+Math.imul(ve,Ht)|0,b=b+Math.imul(ve,Zt)|0,b=b+Math.imul(we,Ht)|0,B=B+Math.imul(we,Zt)|0,x=x+Math.imul(Ee,Q)|0,b=b+Math.imul(Ee,Y)|0,b=b+Math.imul(qe,Q)|0,B=B+Math.imul(qe,Y)|0,x=x+Math.imul(ae,re)|0,b=b+Math.imul(ae,ie)|0,b=b+Math.imul(ce,re)|0,B=B+Math.imul(ce,ie)|0,x=x+Math.imul(X,ke)|0,b=b+Math.imul(X,je)|0,b=b+Math.imul(ee,ke)|0,B=B+Math.imul(ee,je)|0;var Oi=(_+x|0)+((b&8191)<<13)|0;_=(B+(b>>>13)|0)+(Oi>>>26)|0,Oi&=67108863,x=Math.imul(ze,$t),b=Math.imul(ze,Jt),b=b+Math.imul(Ge,$t)|0,B=Math.imul(Ge,Jt),x=x+Math.imul(_e,Yt)|0,b=b+Math.imul(_e,Wt)|0,b=b+Math.imul(Se,Yt)|0,B=B+Math.imul(Se,Wt)|0,x=x+Math.imul(Te,qt)|0,b=b+Math.imul(Te,Vt)|0,b=b+Math.imul(De,qt)|0,B=B+Math.imul(De,Vt)|0,x=x+Math.imul(Pe,Ht)|0,b=b+Math.imul(Pe,Zt)|0,b=b+Math.imul(Ue,Ht)|0,B=B+Math.imul(Ue,Zt)|0,x=x+Math.imul(ve,Q)|0,b=b+Math.imul(ve,Y)|0,b=b+Math.imul(we,Q)|0,B=B+Math.imul(we,Y)|0,x=x+Math.imul(Ee,re)|0,b=b+Math.imul(Ee,ie)|0,b=b+Math.imul(qe,re)|0,B=B+Math.imul(qe,ie)|0,x=x+Math.imul(ae,ke)|0,b=b+Math.imul(ae,je)|0,b=b+Math.imul(ce,ke)|0,B=B+Math.imul(ce,je)|0;var jr=(_+x|0)+((b&8191)<<13)|0;_=(B+(b>>>13)|0)+(jr>>>26)|0,jr&=67108863,x=Math.imul(ze,Yt),b=Math.imul(ze,Wt),b=b+Math.imul(Ge,Yt)|0,B=Math.imul(Ge,Wt),x=x+Math.imul(_e,qt)|0,b=b+Math.imul(_e,Vt)|0,b=b+Math.imul(Se,qt)|0,B=B+Math.imul(Se,Vt)|0,x=x+Math.imul(Te,Ht)|0,b=b+Math.imul(Te,Zt)|0,b=b+Math.imul(De,Ht)|0,B=B+Math.imul(De,Zt)|0,x=x+Math.imul(Pe,Q)|0,b=b+Math.imul(Pe,Y)|0,b=b+Math.imul(Ue,Q)|0,B=B+Math.imul(Ue,Y)|0,x=x+Math.imul(ve,re)|0,b=b+Math.imul(ve,ie)|0,b=b+Math.imul(we,re)|0,B=B+Math.imul(we,ie)|0,x=x+Math.imul(Ee,ke)|0,b=b+Math.imul(Ee,je)|0,b=b+Math.imul(qe,ke)|0,B=B+Math.imul(qe,je)|0;var xi=(_+x|0)+((b&8191)<<13)|0;_=(B+(b>>>13)|0)+(xi>>>26)|0,xi&=67108863,x=Math.imul(ze,qt),b=Math.imul(ze,Vt),b=b+Math.imul(Ge,qt)|0,B=Math.imul(Ge,Vt),x=x+Math.imul(_e,Ht)|0,b=b+Math.imul(_e,Zt)|0,b=b+Math.imul(Se,Ht)|0,B=B+Math.imul(Se,Zt)|0,x=x+Math.imul(Te,Q)|0,b=b+Math.imul(Te,Y)|0,b=b+Math.imul(De,Q)|0,B=B+Math.imul(De,Y)|0,x=x+Math.imul(Pe,re)|0,b=b+Math.imul(Pe,ie)|0,b=b+Math.imul(Ue,re)|0,B=B+Math.imul(Ue,ie)|0,x=x+Math.imul(ve,ke)|0,b=b+Math.imul(ve,je)|0,b=b+Math.imul(we,ke)|0,B=B+Math.imul(we,je)|0;var $i=(_+x|0)+((b&8191)<<13)|0;_=(B+(b>>>13)|0)+($i>>>26)|0,$i&=67108863,x=Math.imul(ze,Ht),b=Math.imul(ze,Zt),b=b+Math.imul(Ge,Ht)|0,B=Math.imul(Ge,Zt),x=x+Math.imul(_e,Q)|0,b=b+Math.imul(_e,Y)|0,b=b+Math.imul(Se,Q)|0,B=B+Math.imul(Se,Y)|0,x=x+Math.imul(Te,re)|0,b=b+Math.imul(Te,ie)|0,b=b+Math.imul(De,re)|0,B=B+Math.imul(De,ie)|0,x=x+Math.imul(Pe,ke)|0,b=b+Math.imul(Pe,je)|0,b=b+Math.imul(Ue,ke)|0,B=B+Math.imul(Ue,je)|0;var uo=(_+x|0)+((b&8191)<<13)|0;_=(B+(b>>>13)|0)+(uo>>>26)|0,uo&=67108863,x=Math.imul(ze,Q),b=Math.imul(ze,Y),b=b+Math.imul(Ge,Q)|0,B=Math.imul(Ge,Y),x=x+Math.imul(_e,re)|0,b=b+Math.imul(_e,ie)|0,b=b+Math.imul(Se,re)|0,B=B+Math.imul(Se,ie)|0,x=x+Math.imul(Te,ke)|0,b=b+Math.imul(Te,je)|0,b=b+Math.imul(De,ke)|0,B=B+Math.imul(De,je)|0;var Vs=(_+x|0)+((b&8191)<<13)|0;_=(B+(b>>>13)|0)+(Vs>>>26)|0,Vs&=67108863,x=Math.imul(ze,re),b=Math.imul(ze,ie),b=b+Math.imul(Ge,re)|0,B=Math.imul(Ge,ie),x=x+Math.imul(_e,ke)|0,b=b+Math.imul(_e,je)|0,b=b+Math.imul(Se,ke)|0,B=B+Math.imul(Se,je)|0;var No=(_+x|0)+((b&8191)<<13)|0;_=(B+(b>>>13)|0)+(No>>>26)|0,No&=67108863,x=Math.imul(ze,ke),b=Math.imul(ze,je),b=b+Math.imul(Ge,ke)|0,B=Math.imul(Ge,je);var Qa=(_+x|0)+((b&8191)<<13)|0;return _=(B+(b>>>13)|0)+(Qa>>>26)|0,Qa&=67108863,w[0]=kr,w[1]=Lt,w[2]=lt,w[3]=Xr,w[4]=ln,w[5]=Jr,w[6]=dr,w[7]=Qr,w[8]=Cr,w[9]=Ws,w[10]=_i,w[11]=Oi,w[12]=jr,w[13]=xi,w[14]=$i,w[15]=uo,w[16]=Vs,w[17]=No,w[18]=Qa,_!==0&&(w[19]=_,k.length++),k};Math.imul||(g=p);function v(L,T,S){S.negative=T.negative^L.negative,S.length=L.length+T.length;for(var k=0,f=0,y=0;y>>26)|0,f+=w>>>26,w&=67108863}S.words[y]=_,k=w,w=f}return k!==0?S.words[y]=k:S.length--,S.strip()}function E(L,T,S){var k=new A;return k.mulp(L,T,S)}i.prototype.mulTo=function(T,S){var k,f=this.length+T.length;return this.length===10&&T.length===10?k=g(this,T,S):f<63?k=p(this,T,S):f<1024?k=v(this,T,S):k=E(this,T,S),k};function A(L,T){this.x=L,this.y=T}A.prototype.makeRBT=function(T){for(var S=new Array(T),k=i.prototype._countBits(T)-1,f=0;f>=1;return f},A.prototype.permute=function(T,S,k,f,y,w){for(var _=0;_>>1)y++;return 1<>>13,k[2*w+1]=y&8191,y=y>>>13;for(w=2*S;w>=26,S+=f/67108864|0,S+=y>>>26,this.words[k]=y&67108863}return S!==0&&(this.words[k]=S,this.length++),this},i.prototype.muln=function(T){return this.clone().imuln(T)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(T){var S=m(T);if(S.length===0)return new i(1);for(var k=this,f=0;f=0);var S=T%26,k=(T-S)/26,f=67108863>>>26-S<<26-S,y;if(S!==0){var w=0;for(y=0;y>>26-S}w&&(this.words[y]=w,this.length++)}if(k!==0){for(y=this.length-1;y>=0;y--)this.words[y+k]=this.words[y];for(y=0;y=0);var f;S?f=(S-S%26)/26:f=0;var y=T%26,w=Math.min((T-y)/26,this.length),_=67108863^67108863>>>y<w)for(this.length-=w,b=0;b=0&&(B!==0||b>=f);b--){var q=this.words[b]|0;this.words[b]=B<<26-y|q>>>y,B=q&_}return x&&B!==0&&(x.words[x.length++]=B),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(T,S,k){return r(this.negative===0),this.iushrn(T,S,k)},i.prototype.shln=function(T){return this.clone().ishln(T)},i.prototype.ushln=function(T){return this.clone().iushln(T)},i.prototype.shrn=function(T){return this.clone().ishrn(T)},i.prototype.ushrn=function(T){return this.clone().iushrn(T)},i.prototype.testn=function(T){r(typeof T=="number"&&T>=0);var S=T%26,k=(T-S)/26,f=1<=0);var S=T%26,k=(T-S)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=k)return this;if(S!==0&&k++,this.length=Math.min(k,this.length),S!==0){var f=67108863^67108863>>>S<=67108864;S++)this.words[S]-=67108864,S===this.length-1?this.words[S+1]=1:this.words[S+1]++;return this.length=Math.max(this.length,S+1),this},i.prototype.isubn=function(T){if(r(typeof T=="number"),r(T<67108864),T<0)return this.iaddn(-T);if(this.negative!==0)return this.negative=0,this.iaddn(T),this.negative=1,this;if(this.words[0]-=T,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var S=0;S>26)-(x/67108864|0),this.words[y+k]=w&67108863}for(;y>26,this.words[y+k]=w&67108863;if(_===0)return this.strip();for(r(_===-1),_=0,y=0;y>26,this.words[y]=w&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(T,S){var k=this.length-T.length,f=this.clone(),y=T,w=y.words[y.length-1]|0,_=this._countBits(w);k=26-_,k!==0&&(y=y.ushln(k),f.iushln(k),w=y.words[y.length-1]|0);var x=f.length-y.length,b;if(S!=="mod"){b=new i(null),b.length=x+1,b.words=new Array(b.length);for(var B=0;B=0;M--){var j=(f.words[y.length+M]|0)*67108864+(f.words[y.length+M-1]|0);for(j=Math.min(j/w|0,67108863),f._ishlnsubmul(y,j,M);f.negative!==0;)j--,f.negative=0,f._ishlnsubmul(y,1,M),f.isZero()||(f.negative^=1);b&&(b.words[M]=j)}return b&&b.strip(),f.strip(),S!=="div"&&k!==0&&f.iushrn(k),{div:b||null,mod:f}},i.prototype.divmod=function(T,S,k){if(r(!T.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var f,y,w;return this.negative!==0&&T.negative===0?(w=this.neg().divmod(T,S),S!=="mod"&&(f=w.div.neg()),S!=="div"&&(y=w.mod.neg(),k&&y.negative!==0&&y.iadd(T)),{div:f,mod:y}):this.negative===0&&T.negative!==0?(w=this.divmod(T.neg(),S),S!=="mod"&&(f=w.div.neg()),{div:f,mod:w.mod}):this.negative&T.negative?(w=this.neg().divmod(T.neg(),S),S!=="div"&&(y=w.mod.neg(),k&&y.negative!==0&&y.isub(T)),{div:w.div,mod:y}):T.length>this.length||this.cmp(T)<0?{div:new i(0),mod:this}:T.length===1?S==="div"?{div:this.divn(T.words[0]),mod:null}:S==="mod"?{div:null,mod:new i(this.modn(T.words[0]))}:{div:this.divn(T.words[0]),mod:new i(this.modn(T.words[0]))}:this._wordDiv(T,S)},i.prototype.div=function(T){return this.divmod(T,"div",!1).div},i.prototype.mod=function(T){return this.divmod(T,"mod",!1).mod},i.prototype.umod=function(T){return this.divmod(T,"mod",!0).mod},i.prototype.divRound=function(T){var S=this.divmod(T);if(S.mod.isZero())return S.div;var k=S.div.negative!==0?S.mod.isub(T):S.mod,f=T.ushrn(1),y=T.andln(1),w=k.cmp(f);return w<0||y===1&&w===0?S.div:S.div.negative!==0?S.div.isubn(1):S.div.iaddn(1)},i.prototype.modn=function(T){r(T<=67108863);for(var S=(1<<26)%T,k=0,f=this.length-1;f>=0;f--)k=(S*k+(this.words[f]|0))%T;return k},i.prototype.idivn=function(T){r(T<=67108863);for(var S=0,k=this.length-1;k>=0;k--){var f=(this.words[k]|0)+S*67108864;this.words[k]=f/T|0,S=f%T}return this.strip()},i.prototype.divn=function(T){return this.clone().idivn(T)},i.prototype.egcd=function(T){r(T.negative===0),r(!T.isZero());var S=this,k=T.clone();S.negative!==0?S=S.umod(T):S=S.clone();for(var f=new i(1),y=new i(0),w=new i(0),_=new i(1),x=0;S.isEven()&&k.isEven();)S.iushrn(1),k.iushrn(1),++x;for(var b=k.clone(),B=S.clone();!S.isZero();){for(var q=0,M=1;!(S.words[0]&M)&&q<26;++q,M<<=1);if(q>0)for(S.iushrn(q);q-- >0;)(f.isOdd()||y.isOdd())&&(f.iadd(b),y.isub(B)),f.iushrn(1),y.iushrn(1);for(var j=0,J=1;!(k.words[0]&J)&&j<26;++j,J<<=1);if(j>0)for(k.iushrn(j);j-- >0;)(w.isOdd()||_.isOdd())&&(w.iadd(b),_.isub(B)),w.iushrn(1),_.iushrn(1);S.cmp(k)>=0?(S.isub(k),f.isub(w),y.isub(_)):(k.isub(S),w.isub(f),_.isub(y))}return{a:w,b:_,gcd:k.iushln(x)}},i.prototype._invmp=function(T){r(T.negative===0),r(!T.isZero());var S=this,k=T.clone();S.negative!==0?S=S.umod(T):S=S.clone();for(var f=new i(1),y=new i(0),w=k.clone();S.cmpn(1)>0&&k.cmpn(1)>0;){for(var _=0,x=1;!(S.words[0]&x)&&_<26;++_,x<<=1);if(_>0)for(S.iushrn(_);_-- >0;)f.isOdd()&&f.iadd(w),f.iushrn(1);for(var b=0,B=1;!(k.words[0]&B)&&b<26;++b,B<<=1);if(b>0)for(k.iushrn(b);b-- >0;)y.isOdd()&&y.iadd(w),y.iushrn(1);S.cmp(k)>=0?(S.isub(k),f.isub(y)):(k.isub(S),y.isub(f))}var q;return S.cmpn(1)===0?q=f:q=y,q.cmpn(0)<0&&q.iadd(T),q},i.prototype.gcd=function(T){if(this.isZero())return T.abs();if(T.isZero())return this.abs();var S=this.clone(),k=T.clone();S.negative=0,k.negative=0;for(var f=0;S.isEven()&&k.isEven();f++)S.iushrn(1),k.iushrn(1);do{for(;S.isEven();)S.iushrn(1);for(;k.isEven();)k.iushrn(1);var y=S.cmp(k);if(y<0){var w=S;S=k,k=w}else if(y===0||k.cmpn(1)===0)break;S.isub(k)}while(!0);return k.iushln(f)},i.prototype.invm=function(T){return this.egcd(T).a.umod(T)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(T){return this.words[0]&T},i.prototype.bincn=function(T){r(typeof T=="number");var S=T%26,k=(T-S)/26,f=1<>>26,_&=67108863,this.words[w]=_}return y!==0&&(this.words[w]=y,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(T){var S=T<0;if(this.negative!==0&&!S)return-1;if(this.negative===0&&S)return 1;this.strip();var k;if(this.length>1)k=1;else{S&&(T=-T),r(T<=67108863,"Number is too big");var f=this.words[0]|0;k=f===T?0:fT.length)return 1;if(this.length=0;k--){var f=this.words[k]|0,y=T.words[k]|0;if(f!==y){fy&&(S=1);break}}return S},i.prototype.gtn=function(T){return this.cmpn(T)===1},i.prototype.gt=function(T){return this.cmp(T)===1},i.prototype.gten=function(T){return this.cmpn(T)>=0},i.prototype.gte=function(T){return this.cmp(T)>=0},i.prototype.ltn=function(T){return this.cmpn(T)===-1},i.prototype.lt=function(T){return this.cmp(T)===-1},i.prototype.lten=function(T){return this.cmpn(T)<=0},i.prototype.lte=function(T){return this.cmp(T)<=0},i.prototype.eqn=function(T){return this.cmpn(T)===0},i.prototype.eq=function(T){return this.cmp(T)===0},i.red=function(T){return new U(T)},i.prototype.toRed=function(T){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),T.convertTo(this)._forceRed(T)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(T){return this.red=T,this},i.prototype.forceRed=function(T){return r(!this.red,"Already a number in reduction context"),this._forceRed(T)},i.prototype.redAdd=function(T){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,T)},i.prototype.redIAdd=function(T){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,T)},i.prototype.redSub=function(T){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,T)},i.prototype.redISub=function(T){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,T)},i.prototype.redShl=function(T){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,T)},i.prototype.redMul=function(T){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,T),this.red.mul(this,T)},i.prototype.redIMul=function(T){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,T),this.red.imul(this,T)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(T){return r(this.red&&!T.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,T)};var P={k256:null,p224:null,p192:null,p25519:null};function I(L,T){this.name=L,this.p=new i(T,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}I.prototype._tmp=function(){var T=new i(null);return T.words=new Array(Math.ceil(this.n/13)),T},I.prototype.ireduce=function(T){var S=T,k;do this.split(S,this.tmp),S=this.imulK(S),S=S.iadd(this.tmp),k=S.bitLength();while(k>this.n);var f=k0?S.isub(this.p):S.strip!==void 0?S.strip():S._strip(),S},I.prototype.split=function(T,S){T.iushrn(this.n,0,S)},I.prototype.imulK=function(T){return T.imul(this.k)};function $(){I.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n($,I),$.prototype.split=function(T,S){for(var k=4194303,f=Math.min(T.length,9),y=0;y>>22,w=_}w>>>=22,T.words[y-10]=w,w===0&&T.length>10?T.length-=10:T.length-=9},$.prototype.imulK=function(T){T.words[T.length]=0,T.words[T.length+1]=0,T.length+=2;for(var S=0,k=0;k>>=26,T.words[k]=y,S=f}return S!==0&&(T.words[T.length++]=S),T},i._prime=function(T){if(P[T])return P[T];var S;if(T==="k256")S=new $;else if(T==="p224")S=new N;else if(T==="p192")S=new K;else if(T==="p25519")S=new F;else throw new Error("Unknown prime "+T);return P[T]=S,S};function U(L){if(typeof L=="string"){var T=i._prime(L);this.m=T.p,this.prime=T}else r(L.gtn(1),"modulus must be greater than 1"),this.m=L,this.prime=null}U.prototype._verify1=function(T){r(T.negative===0,"red works only with positives"),r(T.red,"red works only with red numbers")},U.prototype._verify2=function(T,S){r((T.negative|S.negative)===0,"red works only with positives"),r(T.red&&T.red===S.red,"red works only with red numbers")},U.prototype.imod=function(T){return this.prime?this.prime.ireduce(T)._forceRed(this):T.umod(this.m)._forceRed(this)},U.prototype.neg=function(T){return T.isZero()?T.clone():this.m.sub(T)._forceRed(this)},U.prototype.add=function(T,S){this._verify2(T,S);var k=T.add(S);return k.cmp(this.m)>=0&&k.isub(this.m),k._forceRed(this)},U.prototype.iadd=function(T,S){this._verify2(T,S);var k=T.iadd(S);return k.cmp(this.m)>=0&&k.isub(this.m),k},U.prototype.sub=function(T,S){this._verify2(T,S);var k=T.sub(S);return k.cmpn(0)<0&&k.iadd(this.m),k._forceRed(this)},U.prototype.isub=function(T,S){this._verify2(T,S);var k=T.isub(S);return k.cmpn(0)<0&&k.iadd(this.m),k},U.prototype.shl=function(T,S){return this._verify1(T),this.imod(T.ushln(S))},U.prototype.imul=function(T,S){return this._verify2(T,S),this.imod(T.imul(S))},U.prototype.mul=function(T,S){return this._verify2(T,S),this.imod(T.mul(S))},U.prototype.isqr=function(T){return this.imul(T,T.clone())},U.prototype.sqr=function(T){return this.mul(T,T)},U.prototype.sqrt=function(T){if(T.isZero())return T.clone();var S=this.m.andln(3);if(r(S%2===1),S===3){var k=this.m.add(new i(1)).iushrn(2);return this.pow(T,k)}for(var f=this.m.subn(1),y=0;!f.isZero()&&f.andln(1)===0;)y++,f.iushrn(1);r(!f.isZero());var w=new i(1).toRed(this),_=w.redNeg(),x=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new i(2*b*b).toRed(this);this.pow(b,x).cmp(_)!==0;)b.redIAdd(_);for(var B=this.pow(b,f),q=this.pow(T,f.addn(1).iushrn(1)),M=this.pow(T,f),j=y;M.cmp(w)!==0;){for(var J=M,Z=0;J.cmp(w)!==0;Z++)J=J.redSqr();r(Z=0;y--){for(var B=S.words[y],q=b-1;q>=0;q--){var M=B>>q&1;if(w!==f[0]&&(w=this.sqr(w)),M===0&&_===0){x=0;continue}_<<=1,_|=M,x++,!(x!==k&&(y!==0||q!==0))&&(w=this.mul(w,f[_]),x=0,_=0)}b=26}return w},U.prototype.convertTo=function(T){var S=T.umod(this.m);return S===T?S.clone():S},U.prototype.convertFrom=function(T){var S=T.clone();return S.red=null,S},i.mont=function(T){return new W(T)};function W(L){U.call(this,L),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(W,U),W.prototype.convertTo=function(T){return this.imod(T.ushln(this.shift))},W.prototype.convertFrom=function(T){var S=this.imod(T.mul(this.rinv));return S.red=null,S},W.prototype.imul=function(T,S){if(T.isZero()||S.isZero())return T.words[0]=0,T.length=1,T;var k=T.imul(S),f=k.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=k.isub(f).iushrn(this.shift),w=y;return y.cmp(this.m)>=0?w=y.isub(this.m):y.cmpn(0)<0&&(w=y.iadd(this.m)),w._forceRed(this)},W.prototype.mul=function(T,S){if(T.isZero()||S.isZero())return new i(0)._forceRed(this);var k=T.mul(S),f=k.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=k.isub(f).iushrn(this.shift),w=y;return y.cmp(this.m)>=0?w=y.isub(this.m):y.cmpn(0)<0&&(w=y.iadd(this.m)),w._forceRed(this)},W.prototype.invm=function(T){var S=this.imod(T._invmp(this.m).mul(this.r2));return S._forceRed(this)}})(typeof MB>"u"||MB,CX)});var q8=V((omt,$B)=>{h();var CB;$B.exports=function(e){return CB||(CB=new zp(null)),CB.generate(e)};function zp(t){this.rand=t}$B.exports.Rand=zp;zp.prototype.generate=function(e){return this._rand(e)};zp.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n{h();var P0=Gi(),DAe=q8();function k0(t){this.rand=t||new DAe.Rand}OX.exports=k0;k0.create=function(e){return new k0(e)};k0.prototype._randbelow=function(e){var r=e.bitLength(),n=Math.ceil(r/8);do var i=new P0(this.rand.generate(n));while(i.cmp(e)>=0);return i};k0.prototype._randrange=function(e,r){var n=r.sub(e);return e.add(this._randbelow(n))};k0.prototype.test=function(e,r,n){var i=e.bitLength(),o=P0.mont(e),s=new P0(1).toRed(o);r||(r=Math.max(1,i/48|0));for(var a=e.subn(1),d=0;!a.testn(d);d++);for(var u=e.shrn(d),c=a.toRed(o),l=!0;r>0;r--){var m=this._randrange(new P0(2),a);n&&n(m);var p=m.toRed(o).redPow(u);if(!(p.cmp(s)===0||p.cmp(c)===0)){for(var g=1;g0;r--){var c=this._randrange(new P0(2),s),l=e.gcd(c);if(l.cmpn(1)!==0)return l;var m=c.toRed(i).redPow(d);if(!(m.cmp(o)===0||m.cmp(u)===0)){for(var p=1;p{h();var BAe=p0();jX.exports=KB;KB.simpleSieve=qB;KB.fermatTest=LB;var Lo=Gi(),MAe=new Lo(24),CAe=NB(),$X=new CAe,OAe=new Lo(1),UB=new Lo(2),$Ae=new Lo(5),dmt=new Lo(16),umt=new Lo(8),NAe=new Lo(10),jAe=new Lo(3),lmt=new Lo(7),UAe=new Lo(11),NX=new Lo(4),fmt=new Lo(12),jB=null;function qAe(){if(jB!==null)return jB;var t=1048576,e=[];e[0]=2;for(var r=1,n=3;nt;)r.ishrn(1);if(r.isEven()&&r.iadd(OAe),r.testn(1)||r.iadd(UB),e.cmp(UB)){if(!e.cmp($Ae))for(;r.mod(NAe).cmp(jAe);)r.iadd(NX)}else for(;r.mod(MAe).cmp(UAe);)r.iadd(NX);if(n=r.shrn(1),qB(n)&&qB(r)&&LB(n)&&LB(r)&&$X.test(n)&&$X.test(r))return r}}});var UX=V((mmt,LAe)=>{LAe.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}});var FX=V((ymt,KX)=>{h();var nd=Gi(),KAe=NB(),qX=new KAe,FAe=new nd(24),zAe=new nd(11),WAe=new nd(10),VAe=new nd(3),HAe=new nd(7),LX=FB(),GAe=p0();KX.exports=Yf;function JAe(t,e){return e=e||"utf8",O.Buffer.isBuffer(t)||(t=new O.Buffer(t,e)),this._pub=new nd(t),this}function YAe(t,e){return e=e||"utf8",O.Buffer.isBuffer(t)||(t=new O.Buffer(t,e)),this._priv=new nd(t),this}var K8={};function ZAe(t,e){var r=e.toString("hex"),n=[r,t.toString(16)].join("_");if(n in K8)return K8[n];var i=0;if(t.isEven()||!LX.simpleSieve||!LX.fermatTest(t)||!qX.test(t))return i+=1,r==="02"||r==="05"?i+=8:i+=4,K8[n]=i,i;qX.test(t.shrn(1))||(i+=2);var o;switch(r){case"02":t.mod(FAe).cmp(zAe)&&(i+=8);break;case"05":o=t.mod(WAe),o.cmp(VAe)&&o.cmp(HAe)&&(i+=8);break;default:i+=4}return K8[n]=i,i}function Yf(t,e,r){this.setGenerator(e),this.__prime=new nd(t),this._prime=nd.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=JAe,this.setPrivateKey=YAe):this._primeCode=8}Object.defineProperty(Yf.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=ZAe(this.__prime,this.__gen)),this._primeCode}});Yf.prototype.generateKeys=function(){return this._priv||(this._priv=new nd(GAe(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()};Yf.prototype.computeSecret=function(t){t=new nd(t),t=t.toRed(this._prime);var e=t.redPow(this._priv).fromRed(),r=new O.Buffer(e.toArray()),n=this.getPrime();if(r.length{h();var XAe=FB(),zX=UX(),zB=FX();function QAe(t){var e=new O.Buffer(zX[t].prime,"hex"),r=new O.Buffer(zX[t].gen,"hex");return new zB(e,r)}var eTe={binary:!0,hex:!0,base64:!0};function WX(t,e,r,n){return O.Buffer.isBuffer(e)||eTe[e]===void 0?WX(t,"binary",e,r):(e=e||"binary",n=n||"binary",r=r||new O.Buffer([2]),O.Buffer.isBuffer(r)||(r=new O.Buffer(r,n)),typeof t=="number"?new zB(XAe(t,r),r,!0):(O.Buffer.isBuffer(t)||(t=new O.Buffer(t,e)),new zB(t,r,!0)))}Gb.DiffieHellmanGroup=Gb.createDiffieHellmanGroup=Gb.getDiffieHellman=QAe;Gb.createDiffieHellman=Gb.DiffieHellman=WX});var z8=V((HX,WB)=>{h();(function(t,e){"use strict";function r(k,f){if(!k)throw new Error(f||"Assertion failed")}function n(k,f){k.super_=f;var y=function(){};y.prototype=f.prototype,k.prototype=new y,k.prototype.constructor=k}function i(k,f,y){if(i.isBN(k))return k;this.negative=0,this.words=null,this.length=0,this.red=null,k!==null&&((f==="le"||f==="be")&&(y=f,f=10),this._init(k||0,f||10,y||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=BB().Buffer}catch{}i.isBN=function(f){return f instanceof i?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===i.wordSize&&Array.isArray(f.words)},i.max=function(f,y){return f.cmp(y)>0?f:y},i.min=function(f,y){return f.cmp(y)<0?f:y},i.prototype._init=function(f,y,w){if(typeof f=="number")return this._initNumber(f,y,w);if(typeof f=="object")return this._initArray(f,y,w);y==="hex"&&(y=16),r(y===(y|0)&&y>=2&&y<=36),f=f.toString().replace(/\s+/g,"");var _=0;f[0]==="-"&&(_++,this.negative=1),_=0;_-=3)b=f[_]|f[_-1]<<8|f[_-2]<<16,this.words[x]|=b<>>26-B&67108863,B+=24,B>=26&&(B-=26,x++);else if(w==="le")for(_=0,x=0;_>>26-B&67108863,B+=24,B>=26&&(B-=26,x++);return this._strip()};function s(k,f){var y=k.charCodeAt(f);if(y>=48&&y<=57)return y-48;if(y>=65&&y<=70)return y-55;if(y>=97&&y<=102)return y-87;r(!1,"Invalid character in "+k)}function a(k,f,y){var w=s(k,y);return y-1>=f&&(w|=s(k,y-1)<<4),w}i.prototype._parseHex=function(f,y,w){this.length=Math.ceil((f.length-y)/6),this.words=new Array(this.length);for(var _=0;_=y;_-=2)B=a(f,y,_)<=18?(x-=18,b+=1,this.words[b]|=B>>>26):x+=8;else{var q=f.length-y;for(_=q%2===0?y+1:y;_=18?(x-=18,b+=1,this.words[b]|=B>>>26):x+=8}this._strip()};function d(k,f,y,w){for(var _=0,x=0,b=Math.min(k.length,y),B=f;B=49?x=q-49+10:q>=17?x=q-17+10:x=q,r(q>=0&&x1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch{i.prototype.inspect=c}else i.prototype.inspect=c;function c(){return(this.red?""}var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],m=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(f,y){f=f||10,y=y|0||1;var w;if(f===16||f==="hex"){w="";for(var _=0,x=0,b=0;b>>24-_&16777215,_+=2,_>=26&&(_-=26,b--),x!==0||b!==this.length-1?w=l[6-q.length]+q+w:w=q+w}for(x!==0&&(w=x.toString(16)+w);w.length%y!==0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}if(f===(f|0)&&f>=2&&f<=36){var M=m[f],j=p[f];w="";var J=this.clone();for(J.negative=0;!J.isZero();){var Z=J.modrn(j).toString(f);J=J.idivn(j),J.isZero()?w=Z+w:w=l[M-Z.length]+Z+w}for(this.isZero()&&(w="0"+w);w.length%y!==0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(f,y){return this.toArrayLike(o,f,y)}),i.prototype.toArray=function(f,y){return this.toArrayLike(Array,f,y)};var g=function(f,y){return f.allocUnsafe?f.allocUnsafe(y):new f(y)};i.prototype.toArrayLike=function(f,y,w){this._strip();var _=this.byteLength(),x=w||Math.max(1,_);r(_<=x,"byte array longer than desired length"),r(x>0,"Requested array length <= 0");var b=g(f,x),B=y==="le"?"LE":"BE";return this["_toArrayLike"+B](b,_),b},i.prototype._toArrayLikeLE=function(f,y){for(var w=0,_=0,x=0,b=0;x>8&255),w>16&255),b===6?(w>24&255),_=0,b=0):(_=B>>>24,b+=2)}if(w=0&&(f[w--]=B>>8&255),w>=0&&(f[w--]=B>>16&255),b===6?(w>=0&&(f[w--]=B>>24&255),_=0,b=0):(_=B>>>24,b+=2)}if(w>=0)for(f[w--]=_;w>=0;)f[w--]=0},Math.clz32?i.prototype._countBits=function(f){return 32-Math.clz32(f)}:i.prototype._countBits=function(f){var y=f,w=0;return y>=4096&&(w+=13,y>>>=13),y>=64&&(w+=7,y>>>=7),y>=8&&(w+=4,y>>>=4),y>=2&&(w+=2,y>>>=2),w+y},i.prototype._zeroBits=function(f){if(f===0)return 26;var y=f,w=0;return y&8191||(w+=13,y>>>=13),y&127||(w+=7,y>>>=7),y&15||(w+=4,y>>>=4),y&3||(w+=2,y>>>=2),y&1||w++,w},i.prototype.bitLength=function(){var f=this.words[this.length-1],y=this._countBits(f);return(this.length-1)*26+y};function v(k){for(var f=new Array(k.bitLength()),y=0;y>>_&1}return f}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,y=0;yf.length?this.clone().ior(f):f.clone().ior(this)},i.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},i.prototype.iuand=function(f){var y;this.length>f.length?y=f:y=this;for(var w=0;wf.length?this.clone().iand(f):f.clone().iand(this)},i.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},i.prototype.iuxor=function(f){var y,w;this.length>f.length?(y=this,w=f):(y=f,w=this);for(var _=0;_f.length?this.clone().ixor(f):f.clone().ixor(this)},i.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},i.prototype.inotn=function(f){r(typeof f=="number"&&f>=0);var y=Math.ceil(f/26)|0,w=f%26;this._expand(y),w>0&&y--;for(var _=0;_0&&(this.words[_]=~this.words[_]&67108863>>26-w),this._strip()},i.prototype.notn=function(f){return this.clone().inotn(f)},i.prototype.setn=function(f,y){r(typeof f=="number"&&f>=0);var w=f/26|0,_=f%26;return this._expand(w+1),y?this.words[w]=this.words[w]|1<<_:this.words[w]=this.words[w]&~(1<<_),this._strip()},i.prototype.iadd=function(f){var y;if(this.negative!==0&&f.negative===0)return this.negative=0,y=this.isub(f),this.negative^=1,this._normSign();if(this.negative===0&&f.negative!==0)return f.negative=0,y=this.isub(f),f.negative=1,y._normSign();var w,_;this.length>f.length?(w=this,_=f):(w=f,_=this);for(var x=0,b=0;b<_.length;b++)y=(w.words[b]|0)+(_.words[b]|0)+x,this.words[b]=y&67108863,x=y>>>26;for(;x!==0&&b>>26;if(this.length=w.length,x!==0)this.words[this.length]=x,this.length++;else if(w!==this)for(;bf.length?this.clone().iadd(f):f.clone().iadd(this)},i.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var y=this.iadd(f);return f.negative=1,y._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var w=this.cmp(f);if(w===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _,x;w>0?(_=this,x=f):(_=f,x=this);for(var b=0,B=0;B>26,this.words[B]=y&67108863;for(;b!==0&&B<_.length;B++)y=(_.words[B]|0)+b,b=y>>26,this.words[B]=y&67108863;if(b===0&&B<_.length&&_!==this)for(;B<_.length;B++)this.words[B]=_.words[B];return this.length=Math.max(this.length,B),_!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(f){return this.clone().isub(f)};function E(k,f,y){y.negative=f.negative^k.negative;var w=k.length+f.length|0;y.length=w,w=w-1|0;var _=k.words[0]|0,x=f.words[0]|0,b=_*x,B=b&67108863,q=b/67108864|0;y.words[0]=B;for(var M=1;M>>26,J=q&67108863,Z=Math.min(M,f.length-1),G=Math.max(0,M-k.length+1);G<=Z;G++){var H=M-G|0;_=k.words[H]|0,x=f.words[G]|0,b=_*x+J,j+=b/67108864|0,J=b&67108863}y.words[M]=J|0,q=j|0}return q!==0?y.words[M]=q|0:y.length--,y._strip()}var A=function(f,y,w){var _=f.words,x=y.words,b=w.words,B=0,q,M,j,J=_[0]|0,Z=J&8191,G=J>>>13,H=_[1]|0,X=H&8191,ee=H>>>13,ue=_[2]|0,ae=ue&8191,ce=ue>>>13,me=_[3]|0,Ee=me&8191,qe=me>>>13,fe=_[4]|0,ve=fe&8191,we=fe>>>13,Ce=_[5]|0,Pe=Ce&8191,Ue=Ce>>>13,bt=_[6]|0,Te=bt&8191,De=bt>>>13,Dt=_[7]|0,_e=Dt&8191,Se=Dt>>>13,Wr=_[8]|0,ze=Wr&8191,Ge=Wr>>>13,zs=_[9]|0,pt=zs&8191,Mt=zs>>>13,wi=x[0]|0,Pt=wi&8191,Xe=wi>>>13,Kc=x[1]|0,kt=Kc&8191,Ut=Kc>>>13,By=x[2]|0,$t=By&8191,Jt=By>>>13,Fc=x[3]|0,Yt=Fc&8191,Wt=Fc>>>13,My=x[4]|0,qt=My&8191,Vt=My>>>13,Cy=x[5]|0,Ht=Cy&8191,Zt=Cy>>>13,ap=x[6]|0,Q=ap&8191,Y=ap>>>13,te=x[7]|0,re=te&8191,ie=te>>>13,Ne=x[8]|0,ke=Ne&8191,je=Ne>>>13,kr=x[9]|0,Lt=kr&8191,lt=kr>>>13;w.negative=f.negative^y.negative,w.length=19,q=Math.imul(Z,Pt),M=Math.imul(Z,Xe),M=M+Math.imul(G,Pt)|0,j=Math.imul(G,Xe);var Xr=(B+q|0)+((M&8191)<<13)|0;B=(j+(M>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,q=Math.imul(X,Pt),M=Math.imul(X,Xe),M=M+Math.imul(ee,Pt)|0,j=Math.imul(ee,Xe),q=q+Math.imul(Z,kt)|0,M=M+Math.imul(Z,Ut)|0,M=M+Math.imul(G,kt)|0,j=j+Math.imul(G,Ut)|0;var ln=(B+q|0)+((M&8191)<<13)|0;B=(j+(M>>>13)|0)+(ln>>>26)|0,ln&=67108863,q=Math.imul(ae,Pt),M=Math.imul(ae,Xe),M=M+Math.imul(ce,Pt)|0,j=Math.imul(ce,Xe),q=q+Math.imul(X,kt)|0,M=M+Math.imul(X,Ut)|0,M=M+Math.imul(ee,kt)|0,j=j+Math.imul(ee,Ut)|0,q=q+Math.imul(Z,$t)|0,M=M+Math.imul(Z,Jt)|0,M=M+Math.imul(G,$t)|0,j=j+Math.imul(G,Jt)|0;var Jr=(B+q|0)+((M&8191)<<13)|0;B=(j+(M>>>13)|0)+(Jr>>>26)|0,Jr&=67108863,q=Math.imul(Ee,Pt),M=Math.imul(Ee,Xe),M=M+Math.imul(qe,Pt)|0,j=Math.imul(qe,Xe),q=q+Math.imul(ae,kt)|0,M=M+Math.imul(ae,Ut)|0,M=M+Math.imul(ce,kt)|0,j=j+Math.imul(ce,Ut)|0,q=q+Math.imul(X,$t)|0,M=M+Math.imul(X,Jt)|0,M=M+Math.imul(ee,$t)|0,j=j+Math.imul(ee,Jt)|0,q=q+Math.imul(Z,Yt)|0,M=M+Math.imul(Z,Wt)|0,M=M+Math.imul(G,Yt)|0,j=j+Math.imul(G,Wt)|0;var dr=(B+q|0)+((M&8191)<<13)|0;B=(j+(M>>>13)|0)+(dr>>>26)|0,dr&=67108863,q=Math.imul(ve,Pt),M=Math.imul(ve,Xe),M=M+Math.imul(we,Pt)|0,j=Math.imul(we,Xe),q=q+Math.imul(Ee,kt)|0,M=M+Math.imul(Ee,Ut)|0,M=M+Math.imul(qe,kt)|0,j=j+Math.imul(qe,Ut)|0,q=q+Math.imul(ae,$t)|0,M=M+Math.imul(ae,Jt)|0,M=M+Math.imul(ce,$t)|0,j=j+Math.imul(ce,Jt)|0,q=q+Math.imul(X,Yt)|0,M=M+Math.imul(X,Wt)|0,M=M+Math.imul(ee,Yt)|0,j=j+Math.imul(ee,Wt)|0,q=q+Math.imul(Z,qt)|0,M=M+Math.imul(Z,Vt)|0,M=M+Math.imul(G,qt)|0,j=j+Math.imul(G,Vt)|0;var Qr=(B+q|0)+((M&8191)<<13)|0;B=(j+(M>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,q=Math.imul(Pe,Pt),M=Math.imul(Pe,Xe),M=M+Math.imul(Ue,Pt)|0,j=Math.imul(Ue,Xe),q=q+Math.imul(ve,kt)|0,M=M+Math.imul(ve,Ut)|0,M=M+Math.imul(we,kt)|0,j=j+Math.imul(we,Ut)|0,q=q+Math.imul(Ee,$t)|0,M=M+Math.imul(Ee,Jt)|0,M=M+Math.imul(qe,$t)|0,j=j+Math.imul(qe,Jt)|0,q=q+Math.imul(ae,Yt)|0,M=M+Math.imul(ae,Wt)|0,M=M+Math.imul(ce,Yt)|0,j=j+Math.imul(ce,Wt)|0,q=q+Math.imul(X,qt)|0,M=M+Math.imul(X,Vt)|0,M=M+Math.imul(ee,qt)|0,j=j+Math.imul(ee,Vt)|0,q=q+Math.imul(Z,Ht)|0,M=M+Math.imul(Z,Zt)|0,M=M+Math.imul(G,Ht)|0,j=j+Math.imul(G,Zt)|0;var Cr=(B+q|0)+((M&8191)<<13)|0;B=(j+(M>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,q=Math.imul(Te,Pt),M=Math.imul(Te,Xe),M=M+Math.imul(De,Pt)|0,j=Math.imul(De,Xe),q=q+Math.imul(Pe,kt)|0,M=M+Math.imul(Pe,Ut)|0,M=M+Math.imul(Ue,kt)|0,j=j+Math.imul(Ue,Ut)|0,q=q+Math.imul(ve,$t)|0,M=M+Math.imul(ve,Jt)|0,M=M+Math.imul(we,$t)|0,j=j+Math.imul(we,Jt)|0,q=q+Math.imul(Ee,Yt)|0,M=M+Math.imul(Ee,Wt)|0,M=M+Math.imul(qe,Yt)|0,j=j+Math.imul(qe,Wt)|0,q=q+Math.imul(ae,qt)|0,M=M+Math.imul(ae,Vt)|0,M=M+Math.imul(ce,qt)|0,j=j+Math.imul(ce,Vt)|0,q=q+Math.imul(X,Ht)|0,M=M+Math.imul(X,Zt)|0,M=M+Math.imul(ee,Ht)|0,j=j+Math.imul(ee,Zt)|0,q=q+Math.imul(Z,Q)|0,M=M+Math.imul(Z,Y)|0,M=M+Math.imul(G,Q)|0,j=j+Math.imul(G,Y)|0;var Ws=(B+q|0)+((M&8191)<<13)|0;B=(j+(M>>>13)|0)+(Ws>>>26)|0,Ws&=67108863,q=Math.imul(_e,Pt),M=Math.imul(_e,Xe),M=M+Math.imul(Se,Pt)|0,j=Math.imul(Se,Xe),q=q+Math.imul(Te,kt)|0,M=M+Math.imul(Te,Ut)|0,M=M+Math.imul(De,kt)|0,j=j+Math.imul(De,Ut)|0,q=q+Math.imul(Pe,$t)|0,M=M+Math.imul(Pe,Jt)|0,M=M+Math.imul(Ue,$t)|0,j=j+Math.imul(Ue,Jt)|0,q=q+Math.imul(ve,Yt)|0,M=M+Math.imul(ve,Wt)|0,M=M+Math.imul(we,Yt)|0,j=j+Math.imul(we,Wt)|0,q=q+Math.imul(Ee,qt)|0,M=M+Math.imul(Ee,Vt)|0,M=M+Math.imul(qe,qt)|0,j=j+Math.imul(qe,Vt)|0,q=q+Math.imul(ae,Ht)|0,M=M+Math.imul(ae,Zt)|0,M=M+Math.imul(ce,Ht)|0,j=j+Math.imul(ce,Zt)|0,q=q+Math.imul(X,Q)|0,M=M+Math.imul(X,Y)|0,M=M+Math.imul(ee,Q)|0,j=j+Math.imul(ee,Y)|0,q=q+Math.imul(Z,re)|0,M=M+Math.imul(Z,ie)|0,M=M+Math.imul(G,re)|0,j=j+Math.imul(G,ie)|0;var _i=(B+q|0)+((M&8191)<<13)|0;B=(j+(M>>>13)|0)+(_i>>>26)|0,_i&=67108863,q=Math.imul(ze,Pt),M=Math.imul(ze,Xe),M=M+Math.imul(Ge,Pt)|0,j=Math.imul(Ge,Xe),q=q+Math.imul(_e,kt)|0,M=M+Math.imul(_e,Ut)|0,M=M+Math.imul(Se,kt)|0,j=j+Math.imul(Se,Ut)|0,q=q+Math.imul(Te,$t)|0,M=M+Math.imul(Te,Jt)|0,M=M+Math.imul(De,$t)|0,j=j+Math.imul(De,Jt)|0,q=q+Math.imul(Pe,Yt)|0,M=M+Math.imul(Pe,Wt)|0,M=M+Math.imul(Ue,Yt)|0,j=j+Math.imul(Ue,Wt)|0,q=q+Math.imul(ve,qt)|0,M=M+Math.imul(ve,Vt)|0,M=M+Math.imul(we,qt)|0,j=j+Math.imul(we,Vt)|0,q=q+Math.imul(Ee,Ht)|0,M=M+Math.imul(Ee,Zt)|0,M=M+Math.imul(qe,Ht)|0,j=j+Math.imul(qe,Zt)|0,q=q+Math.imul(ae,Q)|0,M=M+Math.imul(ae,Y)|0,M=M+Math.imul(ce,Q)|0,j=j+Math.imul(ce,Y)|0,q=q+Math.imul(X,re)|0,M=M+Math.imul(X,ie)|0,M=M+Math.imul(ee,re)|0,j=j+Math.imul(ee,ie)|0,q=q+Math.imul(Z,ke)|0,M=M+Math.imul(Z,je)|0,M=M+Math.imul(G,ke)|0,j=j+Math.imul(G,je)|0;var Oi=(B+q|0)+((M&8191)<<13)|0;B=(j+(M>>>13)|0)+(Oi>>>26)|0,Oi&=67108863,q=Math.imul(pt,Pt),M=Math.imul(pt,Xe),M=M+Math.imul(Mt,Pt)|0,j=Math.imul(Mt,Xe),q=q+Math.imul(ze,kt)|0,M=M+Math.imul(ze,Ut)|0,M=M+Math.imul(Ge,kt)|0,j=j+Math.imul(Ge,Ut)|0,q=q+Math.imul(_e,$t)|0,M=M+Math.imul(_e,Jt)|0,M=M+Math.imul(Se,$t)|0,j=j+Math.imul(Se,Jt)|0,q=q+Math.imul(Te,Yt)|0,M=M+Math.imul(Te,Wt)|0,M=M+Math.imul(De,Yt)|0,j=j+Math.imul(De,Wt)|0,q=q+Math.imul(Pe,qt)|0,M=M+Math.imul(Pe,Vt)|0,M=M+Math.imul(Ue,qt)|0,j=j+Math.imul(Ue,Vt)|0,q=q+Math.imul(ve,Ht)|0,M=M+Math.imul(ve,Zt)|0,M=M+Math.imul(we,Ht)|0,j=j+Math.imul(we,Zt)|0,q=q+Math.imul(Ee,Q)|0,M=M+Math.imul(Ee,Y)|0,M=M+Math.imul(qe,Q)|0,j=j+Math.imul(qe,Y)|0,q=q+Math.imul(ae,re)|0,M=M+Math.imul(ae,ie)|0,M=M+Math.imul(ce,re)|0,j=j+Math.imul(ce,ie)|0,q=q+Math.imul(X,ke)|0,M=M+Math.imul(X,je)|0,M=M+Math.imul(ee,ke)|0,j=j+Math.imul(ee,je)|0,q=q+Math.imul(Z,Lt)|0,M=M+Math.imul(Z,lt)|0,M=M+Math.imul(G,Lt)|0,j=j+Math.imul(G,lt)|0;var jr=(B+q|0)+((M&8191)<<13)|0;B=(j+(M>>>13)|0)+(jr>>>26)|0,jr&=67108863,q=Math.imul(pt,kt),M=Math.imul(pt,Ut),M=M+Math.imul(Mt,kt)|0,j=Math.imul(Mt,Ut),q=q+Math.imul(ze,$t)|0,M=M+Math.imul(ze,Jt)|0,M=M+Math.imul(Ge,$t)|0,j=j+Math.imul(Ge,Jt)|0,q=q+Math.imul(_e,Yt)|0,M=M+Math.imul(_e,Wt)|0,M=M+Math.imul(Se,Yt)|0,j=j+Math.imul(Se,Wt)|0,q=q+Math.imul(Te,qt)|0,M=M+Math.imul(Te,Vt)|0,M=M+Math.imul(De,qt)|0,j=j+Math.imul(De,Vt)|0,q=q+Math.imul(Pe,Ht)|0,M=M+Math.imul(Pe,Zt)|0,M=M+Math.imul(Ue,Ht)|0,j=j+Math.imul(Ue,Zt)|0,q=q+Math.imul(ve,Q)|0,M=M+Math.imul(ve,Y)|0,M=M+Math.imul(we,Q)|0,j=j+Math.imul(we,Y)|0,q=q+Math.imul(Ee,re)|0,M=M+Math.imul(Ee,ie)|0,M=M+Math.imul(qe,re)|0,j=j+Math.imul(qe,ie)|0,q=q+Math.imul(ae,ke)|0,M=M+Math.imul(ae,je)|0,M=M+Math.imul(ce,ke)|0,j=j+Math.imul(ce,je)|0,q=q+Math.imul(X,Lt)|0,M=M+Math.imul(X,lt)|0,M=M+Math.imul(ee,Lt)|0,j=j+Math.imul(ee,lt)|0;var xi=(B+q|0)+((M&8191)<<13)|0;B=(j+(M>>>13)|0)+(xi>>>26)|0,xi&=67108863,q=Math.imul(pt,$t),M=Math.imul(pt,Jt),M=M+Math.imul(Mt,$t)|0,j=Math.imul(Mt,Jt),q=q+Math.imul(ze,Yt)|0,M=M+Math.imul(ze,Wt)|0,M=M+Math.imul(Ge,Yt)|0,j=j+Math.imul(Ge,Wt)|0,q=q+Math.imul(_e,qt)|0,M=M+Math.imul(_e,Vt)|0,M=M+Math.imul(Se,qt)|0,j=j+Math.imul(Se,Vt)|0,q=q+Math.imul(Te,Ht)|0,M=M+Math.imul(Te,Zt)|0,M=M+Math.imul(De,Ht)|0,j=j+Math.imul(De,Zt)|0,q=q+Math.imul(Pe,Q)|0,M=M+Math.imul(Pe,Y)|0,M=M+Math.imul(Ue,Q)|0,j=j+Math.imul(Ue,Y)|0,q=q+Math.imul(ve,re)|0,M=M+Math.imul(ve,ie)|0,M=M+Math.imul(we,re)|0,j=j+Math.imul(we,ie)|0,q=q+Math.imul(Ee,ke)|0,M=M+Math.imul(Ee,je)|0,M=M+Math.imul(qe,ke)|0,j=j+Math.imul(qe,je)|0,q=q+Math.imul(ae,Lt)|0,M=M+Math.imul(ae,lt)|0,M=M+Math.imul(ce,Lt)|0,j=j+Math.imul(ce,lt)|0;var $i=(B+q|0)+((M&8191)<<13)|0;B=(j+(M>>>13)|0)+($i>>>26)|0,$i&=67108863,q=Math.imul(pt,Yt),M=Math.imul(pt,Wt),M=M+Math.imul(Mt,Yt)|0,j=Math.imul(Mt,Wt),q=q+Math.imul(ze,qt)|0,M=M+Math.imul(ze,Vt)|0,M=M+Math.imul(Ge,qt)|0,j=j+Math.imul(Ge,Vt)|0,q=q+Math.imul(_e,Ht)|0,M=M+Math.imul(_e,Zt)|0,M=M+Math.imul(Se,Ht)|0,j=j+Math.imul(Se,Zt)|0,q=q+Math.imul(Te,Q)|0,M=M+Math.imul(Te,Y)|0,M=M+Math.imul(De,Q)|0,j=j+Math.imul(De,Y)|0,q=q+Math.imul(Pe,re)|0,M=M+Math.imul(Pe,ie)|0,M=M+Math.imul(Ue,re)|0,j=j+Math.imul(Ue,ie)|0,q=q+Math.imul(ve,ke)|0,M=M+Math.imul(ve,je)|0,M=M+Math.imul(we,ke)|0,j=j+Math.imul(we,je)|0,q=q+Math.imul(Ee,Lt)|0,M=M+Math.imul(Ee,lt)|0,M=M+Math.imul(qe,Lt)|0,j=j+Math.imul(qe,lt)|0;var uo=(B+q|0)+((M&8191)<<13)|0;B=(j+(M>>>13)|0)+(uo>>>26)|0,uo&=67108863,q=Math.imul(pt,qt),M=Math.imul(pt,Vt),M=M+Math.imul(Mt,qt)|0,j=Math.imul(Mt,Vt),q=q+Math.imul(ze,Ht)|0,M=M+Math.imul(ze,Zt)|0,M=M+Math.imul(Ge,Ht)|0,j=j+Math.imul(Ge,Zt)|0,q=q+Math.imul(_e,Q)|0,M=M+Math.imul(_e,Y)|0,M=M+Math.imul(Se,Q)|0,j=j+Math.imul(Se,Y)|0,q=q+Math.imul(Te,re)|0,M=M+Math.imul(Te,ie)|0,M=M+Math.imul(De,re)|0,j=j+Math.imul(De,ie)|0,q=q+Math.imul(Pe,ke)|0,M=M+Math.imul(Pe,je)|0,M=M+Math.imul(Ue,ke)|0,j=j+Math.imul(Ue,je)|0,q=q+Math.imul(ve,Lt)|0,M=M+Math.imul(ve,lt)|0,M=M+Math.imul(we,Lt)|0,j=j+Math.imul(we,lt)|0;var Vs=(B+q|0)+((M&8191)<<13)|0;B=(j+(M>>>13)|0)+(Vs>>>26)|0,Vs&=67108863,q=Math.imul(pt,Ht),M=Math.imul(pt,Zt),M=M+Math.imul(Mt,Ht)|0,j=Math.imul(Mt,Zt),q=q+Math.imul(ze,Q)|0,M=M+Math.imul(ze,Y)|0,M=M+Math.imul(Ge,Q)|0,j=j+Math.imul(Ge,Y)|0,q=q+Math.imul(_e,re)|0,M=M+Math.imul(_e,ie)|0,M=M+Math.imul(Se,re)|0,j=j+Math.imul(Se,ie)|0,q=q+Math.imul(Te,ke)|0,M=M+Math.imul(Te,je)|0,M=M+Math.imul(De,ke)|0,j=j+Math.imul(De,je)|0,q=q+Math.imul(Pe,Lt)|0,M=M+Math.imul(Pe,lt)|0,M=M+Math.imul(Ue,Lt)|0,j=j+Math.imul(Ue,lt)|0;var No=(B+q|0)+((M&8191)<<13)|0;B=(j+(M>>>13)|0)+(No>>>26)|0,No&=67108863,q=Math.imul(pt,Q),M=Math.imul(pt,Y),M=M+Math.imul(Mt,Q)|0,j=Math.imul(Mt,Y),q=q+Math.imul(ze,re)|0,M=M+Math.imul(ze,ie)|0,M=M+Math.imul(Ge,re)|0,j=j+Math.imul(Ge,ie)|0,q=q+Math.imul(_e,ke)|0,M=M+Math.imul(_e,je)|0,M=M+Math.imul(Se,ke)|0,j=j+Math.imul(Se,je)|0,q=q+Math.imul(Te,Lt)|0,M=M+Math.imul(Te,lt)|0,M=M+Math.imul(De,Lt)|0,j=j+Math.imul(De,lt)|0;var Qa=(B+q|0)+((M&8191)<<13)|0;B=(j+(M>>>13)|0)+(Qa>>>26)|0,Qa&=67108863,q=Math.imul(pt,re),M=Math.imul(pt,ie),M=M+Math.imul(Mt,re)|0,j=Math.imul(Mt,ie),q=q+Math.imul(ze,ke)|0,M=M+Math.imul(ze,je)|0,M=M+Math.imul(Ge,ke)|0,j=j+Math.imul(Ge,je)|0,q=q+Math.imul(_e,Lt)|0,M=M+Math.imul(_e,lt)|0,M=M+Math.imul(Se,Lt)|0,j=j+Math.imul(Se,lt)|0;var cp=(B+q|0)+((M&8191)<<13)|0;B=(j+(M>>>13)|0)+(cp>>>26)|0,cp&=67108863,q=Math.imul(pt,ke),M=Math.imul(pt,je),M=M+Math.imul(Mt,ke)|0,j=Math.imul(Mt,je),q=q+Math.imul(ze,Lt)|0,M=M+Math.imul(ze,lt)|0,M=M+Math.imul(Ge,Lt)|0,j=j+Math.imul(Ge,lt)|0;var dp=(B+q|0)+((M&8191)<<13)|0;B=(j+(M>>>13)|0)+(dp>>>26)|0,dp&=67108863,q=Math.imul(pt,Lt),M=Math.imul(pt,lt),M=M+Math.imul(Mt,Lt)|0,j=Math.imul(Mt,lt);var Zu=(B+q|0)+((M&8191)<<13)|0;return B=(j+(M>>>13)|0)+(Zu>>>26)|0,Zu&=67108863,b[0]=Xr,b[1]=ln,b[2]=Jr,b[3]=dr,b[4]=Qr,b[5]=Cr,b[6]=Ws,b[7]=_i,b[8]=Oi,b[9]=jr,b[10]=xi,b[11]=$i,b[12]=uo,b[13]=Vs,b[14]=No,b[15]=Qa,b[16]=cp,b[17]=dp,b[18]=Zu,B!==0&&(b[19]=B,w.length++),w};Math.imul||(A=E);function P(k,f,y){y.negative=f.negative^k.negative,y.length=k.length+f.length;for(var w=0,_=0,x=0;x>>26)|0,_+=b>>>26,b&=67108863}y.words[x]=B,w=b,b=_}return w!==0?y.words[x]=w:y.length--,y._strip()}function I(k,f,y){return P(k,f,y)}i.prototype.mulTo=function(f,y){var w,_=this.length+f.length;return this.length===10&&f.length===10?w=A(this,f,y):_<63?w=E(this,f,y):_<1024?w=P(this,f,y):w=I(this,f,y),w};function $(k,f){this.x=k,this.y=f}$.prototype.makeRBT=function(f){for(var y=new Array(f),w=i.prototype._countBits(f)-1,_=0;_>=1;return _},$.prototype.permute=function(f,y,w,_,x,b){for(var B=0;B>>1)x++;return 1<>>13,w[2*b+1]=x&8191,x=x>>>13;for(b=2*y;b<_;++b)w[b]=0;r(x===0),r((x&-8192)===0)},$.prototype.stub=function(f){for(var y=new Array(f),w=0;w>=26,w+=x/67108864|0,w+=b>>>26,this.words[_]=b&67108863}return w!==0&&(this.words[_]=w,this.length++),y?this.ineg():this},i.prototype.muln=function(f){return this.clone().imuln(f)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(f){var y=v(f);if(y.length===0)return new i(1);for(var w=this,_=0;_=0);var y=f%26,w=(f-y)/26,_=67108863>>>26-y<<26-y,x;if(y!==0){var b=0;for(x=0;x>>26-y}b&&(this.words[x]=b,this.length++)}if(w!==0){for(x=this.length-1;x>=0;x--)this.words[x+w]=this.words[x];for(x=0;x=0);var _;y?_=(y-y%26)/26:_=0;var x=f%26,b=Math.min((f-x)/26,this.length),B=67108863^67108863>>>x<b)for(this.length-=b,M=0;M=0&&(j!==0||M>=_);M--){var J=this.words[M]|0;this.words[M]=j<<26-x|J>>>x,j=J&B}return q&&j!==0&&(q.words[q.length++]=j),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(f,y,w){return r(this.negative===0),this.iushrn(f,y,w)},i.prototype.shln=function(f){return this.clone().ishln(f)},i.prototype.ushln=function(f){return this.clone().iushln(f)},i.prototype.shrn=function(f){return this.clone().ishrn(f)},i.prototype.ushrn=function(f){return this.clone().iushrn(f)},i.prototype.testn=function(f){r(typeof f=="number"&&f>=0);var y=f%26,w=(f-y)/26,_=1<=0);var y=f%26,w=(f-y)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=w)return this;if(y!==0&&w++,this.length=Math.min(w,this.length),y!==0){var _=67108863^67108863>>>y<=67108864;y++)this.words[y]-=67108864,y===this.length-1?this.words[y+1]=1:this.words[y+1]++;return this.length=Math.max(this.length,y+1),this},i.prototype.isubn=function(f){if(r(typeof f=="number"),r(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var y=0;y>26)-(q/67108864|0),this.words[x+w]=b&67108863}for(;x>26,this.words[x+w]=b&67108863;if(B===0)return this._strip();for(r(B===-1),B=0,x=0;x>26,this.words[x]=b&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(f,y){var w=this.length-f.length,_=this.clone(),x=f,b=x.words[x.length-1]|0,B=this._countBits(b);w=26-B,w!==0&&(x=x.ushln(w),_.iushln(w),b=x.words[x.length-1]|0);var q=_.length-x.length,M;if(y!=="mod"){M=new i(null),M.length=q+1,M.words=new Array(M.length);for(var j=0;j=0;Z--){var G=(_.words[x.length+Z]|0)*67108864+(_.words[x.length+Z-1]|0);for(G=Math.min(G/b|0,67108863),_._ishlnsubmul(x,G,Z);_.negative!==0;)G--,_.negative=0,_._ishlnsubmul(x,1,Z),_.isZero()||(_.negative^=1);M&&(M.words[Z]=G)}return M&&M._strip(),_._strip(),y!=="div"&&w!==0&&_.iushrn(w),{div:M||null,mod:_}},i.prototype.divmod=function(f,y,w){if(r(!f.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var _,x,b;return this.negative!==0&&f.negative===0?(b=this.neg().divmod(f,y),y!=="mod"&&(_=b.div.neg()),y!=="div"&&(x=b.mod.neg(),w&&x.negative!==0&&x.iadd(f)),{div:_,mod:x}):this.negative===0&&f.negative!==0?(b=this.divmod(f.neg(),y),y!=="mod"&&(_=b.div.neg()),{div:_,mod:b.mod}):this.negative&f.negative?(b=this.neg().divmod(f.neg(),y),y!=="div"&&(x=b.mod.neg(),w&&x.negative!==0&&x.isub(f)),{div:b.div,mod:x}):f.length>this.length||this.cmp(f)<0?{div:new i(0),mod:this}:f.length===1?y==="div"?{div:this.divn(f.words[0]),mod:null}:y==="mod"?{div:null,mod:new i(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new i(this.modrn(f.words[0]))}:this._wordDiv(f,y)},i.prototype.div=function(f){return this.divmod(f,"div",!1).div},i.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},i.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},i.prototype.divRound=function(f){var y=this.divmod(f);if(y.mod.isZero())return y.div;var w=y.div.negative!==0?y.mod.isub(f):y.mod,_=f.ushrn(1),x=f.andln(1),b=w.cmp(_);return b<0||x===1&&b===0?y.div:y.div.negative!==0?y.div.isubn(1):y.div.iaddn(1)},i.prototype.modrn=function(f){var y=f<0;y&&(f=-f),r(f<=67108863);for(var w=(1<<26)%f,_=0,x=this.length-1;x>=0;x--)_=(w*_+(this.words[x]|0))%f;return y?-_:_},i.prototype.modn=function(f){return this.modrn(f)},i.prototype.idivn=function(f){var y=f<0;y&&(f=-f),r(f<=67108863);for(var w=0,_=this.length-1;_>=0;_--){var x=(this.words[_]|0)+w*67108864;this.words[_]=x/f|0,w=x%f}return this._strip(),y?this.ineg():this},i.prototype.divn=function(f){return this.clone().idivn(f)},i.prototype.egcd=function(f){r(f.negative===0),r(!f.isZero());var y=this,w=f.clone();y.negative!==0?y=y.umod(f):y=y.clone();for(var _=new i(1),x=new i(0),b=new i(0),B=new i(1),q=0;y.isEven()&&w.isEven();)y.iushrn(1),w.iushrn(1),++q;for(var M=w.clone(),j=y.clone();!y.isZero();){for(var J=0,Z=1;!(y.words[0]&Z)&&J<26;++J,Z<<=1);if(J>0)for(y.iushrn(J);J-- >0;)(_.isOdd()||x.isOdd())&&(_.iadd(M),x.isub(j)),_.iushrn(1),x.iushrn(1);for(var G=0,H=1;!(w.words[0]&H)&&G<26;++G,H<<=1);if(G>0)for(w.iushrn(G);G-- >0;)(b.isOdd()||B.isOdd())&&(b.iadd(M),B.isub(j)),b.iushrn(1),B.iushrn(1);y.cmp(w)>=0?(y.isub(w),_.isub(b),x.isub(B)):(w.isub(y),b.isub(_),B.isub(x))}return{a:b,b:B,gcd:w.iushln(q)}},i.prototype._invmp=function(f){r(f.negative===0),r(!f.isZero());var y=this,w=f.clone();y.negative!==0?y=y.umod(f):y=y.clone();for(var _=new i(1),x=new i(0),b=w.clone();y.cmpn(1)>0&&w.cmpn(1)>0;){for(var B=0,q=1;!(y.words[0]&q)&&B<26;++B,q<<=1);if(B>0)for(y.iushrn(B);B-- >0;)_.isOdd()&&_.iadd(b),_.iushrn(1);for(var M=0,j=1;!(w.words[0]&j)&&M<26;++M,j<<=1);if(M>0)for(w.iushrn(M);M-- >0;)x.isOdd()&&x.iadd(b),x.iushrn(1);y.cmp(w)>=0?(y.isub(w),_.isub(x)):(w.isub(y),x.isub(_))}var J;return y.cmpn(1)===0?J=_:J=x,J.cmpn(0)<0&&J.iadd(f),J},i.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var y=this.clone(),w=f.clone();y.negative=0,w.negative=0;for(var _=0;y.isEven()&&w.isEven();_++)y.iushrn(1),w.iushrn(1);do{for(;y.isEven();)y.iushrn(1);for(;w.isEven();)w.iushrn(1);var x=y.cmp(w);if(x<0){var b=y;y=w,w=b}else if(x===0||w.cmpn(1)===0)break;y.isub(w)}while(!0);return w.iushln(_)},i.prototype.invm=function(f){return this.egcd(f).a.umod(f)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(f){return this.words[0]&f},i.prototype.bincn=function(f){r(typeof f=="number");var y=f%26,w=(f-y)/26,_=1<>>26,B&=67108863,this.words[b]=B}return x!==0&&(this.words[b]=x,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(f){var y=f<0;if(this.negative!==0&&!y)return-1;if(this.negative===0&&y)return 1;this._strip();var w;if(this.length>1)w=1;else{y&&(f=-f),r(f<=67108863,"Number is too big");var _=this.words[0]|0;w=_===f?0:_f.length)return 1;if(this.length=0;w--){var _=this.words[w]|0,x=f.words[w]|0;if(_!==x){_x&&(y=1);break}}return y},i.prototype.gtn=function(f){return this.cmpn(f)===1},i.prototype.gt=function(f){return this.cmp(f)===1},i.prototype.gten=function(f){return this.cmpn(f)>=0},i.prototype.gte=function(f){return this.cmp(f)>=0},i.prototype.ltn=function(f){return this.cmpn(f)===-1},i.prototype.lt=function(f){return this.cmp(f)===-1},i.prototype.lten=function(f){return this.cmpn(f)<=0},i.prototype.lte=function(f){return this.cmp(f)<=0},i.prototype.eqn=function(f){return this.cmpn(f)===0},i.prototype.eq=function(f){return this.cmp(f)===0},i.red=function(f){return new T(f)},i.prototype.toRed=function(f){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(f){return this.red=f,this},i.prototype.forceRed=function(f){return r(!this.red,"Already a number in reduction context"),this._forceRed(f)},i.prototype.redAdd=function(f){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},i.prototype.redIAdd=function(f){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},i.prototype.redSub=function(f){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},i.prototype.redISub=function(f){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},i.prototype.redShl=function(f){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},i.prototype.redMul=function(f){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},i.prototype.redIMul=function(f){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(f){return r(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var N={k256:null,p224:null,p192:null,p25519:null};function K(k,f){this.name=k,this.p=new i(f,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}K.prototype._tmp=function(){var f=new i(null);return f.words=new Array(Math.ceil(this.n/13)),f},K.prototype.ireduce=function(f){var y=f,w;do this.split(y,this.tmp),y=this.imulK(y),y=y.iadd(this.tmp),w=y.bitLength();while(w>this.n);var _=w0?y.isub(this.p):y.strip!==void 0?y.strip():y._strip(),y},K.prototype.split=function(f,y){f.iushrn(this.n,0,y)},K.prototype.imulK=function(f){return f.imul(this.k)};function F(){K.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(F,K),F.prototype.split=function(f,y){for(var w=4194303,_=Math.min(f.length,9),x=0;x<_;x++)y.words[x]=f.words[x];if(y.length=_,f.length<=9){f.words[0]=0,f.length=1;return}var b=f.words[9];for(y.words[y.length++]=b&w,x=10;x>>22,b=B}b>>>=22,f.words[x-10]=b,b===0&&f.length>10?f.length-=10:f.length-=9},F.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var y=0,w=0;w>>=26,f.words[w]=x,y=_}return y!==0&&(f.words[f.length++]=y),f},i._prime=function(f){if(N[f])return N[f];var y;if(f==="k256")y=new F;else if(f==="p224")y=new U;else if(f==="p192")y=new W;else if(f==="p25519")y=new L;else throw new Error("Unknown prime "+f);return N[f]=y,y};function T(k){if(typeof k=="string"){var f=i._prime(k);this.m=f.p,this.prime=f}else r(k.gtn(1),"modulus must be greater than 1"),this.m=k,this.prime=null}T.prototype._verify1=function(f){r(f.negative===0,"red works only with positives"),r(f.red,"red works only with red numbers")},T.prototype._verify2=function(f,y){r((f.negative|y.negative)===0,"red works only with positives"),r(f.red&&f.red===y.red,"red works only with red numbers")},T.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(u(f,f.umod(this.m)._forceRed(this)),f)},T.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},T.prototype.add=function(f,y){this._verify2(f,y);var w=f.add(y);return w.cmp(this.m)>=0&&w.isub(this.m),w._forceRed(this)},T.prototype.iadd=function(f,y){this._verify2(f,y);var w=f.iadd(y);return w.cmp(this.m)>=0&&w.isub(this.m),w},T.prototype.sub=function(f,y){this._verify2(f,y);var w=f.sub(y);return w.cmpn(0)<0&&w.iadd(this.m),w._forceRed(this)},T.prototype.isub=function(f,y){this._verify2(f,y);var w=f.isub(y);return w.cmpn(0)<0&&w.iadd(this.m),w},T.prototype.shl=function(f,y){return this._verify1(f),this.imod(f.ushln(y))},T.prototype.imul=function(f,y){return this._verify2(f,y),this.imod(f.imul(y))},T.prototype.mul=function(f,y){return this._verify2(f,y),this.imod(f.mul(y))},T.prototype.isqr=function(f){return this.imul(f,f.clone())},T.prototype.sqr=function(f){return this.mul(f,f)},T.prototype.sqrt=function(f){if(f.isZero())return f.clone();var y=this.m.andln(3);if(r(y%2===1),y===3){var w=this.m.add(new i(1)).iushrn(2);return this.pow(f,w)}for(var _=this.m.subn(1),x=0;!_.isZero()&&_.andln(1)===0;)x++,_.iushrn(1);r(!_.isZero());var b=new i(1).toRed(this),B=b.redNeg(),q=this.m.subn(1).iushrn(1),M=this.m.bitLength();for(M=new i(2*M*M).toRed(this);this.pow(M,q).cmp(B)!==0;)M.redIAdd(B);for(var j=this.pow(M,_),J=this.pow(f,_.addn(1).iushrn(1)),Z=this.pow(f,_),G=x;Z.cmp(b)!==0;){for(var H=Z,X=0;H.cmp(b)!==0;X++)H=H.redSqr();r(X=0;x--){for(var j=y.words[x],J=M-1;J>=0;J--){var Z=j>>J&1;if(b!==_[0]&&(b=this.sqr(b)),Z===0&&B===0){q=0;continue}B<<=1,B|=Z,q++,!(q!==w&&(x!==0||J!==0))&&(b=this.mul(b,_[B]),q=0,B=0)}M=26}return b},T.prototype.convertTo=function(f){var y=f.umod(this.m);return y===f?y.clone():y},T.prototype.convertFrom=function(f){var y=f.clone();return y.red=null,y},i.mont=function(f){return new S(f)};function S(k){T.call(this,k),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(S,T),S.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},S.prototype.convertFrom=function(f){var y=this.imod(f.mul(this.rinv));return y.red=null,y},S.prototype.imul=function(f,y){if(f.isZero()||y.isZero())return f.words[0]=0,f.length=1,f;var w=f.imul(y),_=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=w.isub(_).iushrn(this.shift),b=x;return x.cmp(this.m)>=0?b=x.isub(this.m):x.cmpn(0)<0&&(b=x.iadd(this.m)),b._forceRed(this)},S.prototype.mul=function(f,y){if(f.isZero()||y.isZero())return new i(0)._forceRed(this);var w=f.mul(y),_=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=w.isub(_).iushrn(this.shift),b=x;return x.cmp(this.m)>=0?b=x.isub(this.m):x.cmpn(0)<0&&(b=x.iadd(this.m)),b._forceRed(this)},S.prototype.invm=function(f){var y=this.imod(f._invmp(this.m).mul(this.r2));return y._forceRed(this)}})(typeof WB>"u"||WB,HX)});var W8=V((_mt,YX)=>{h();var Jb=z8(),tTe=p0();function rTe(t){var e=GX(t),r=e.toRed(Jb.mont(t.modulus)).redPow(new Jb(t.publicExponent)).fromRed();return{blinder:r,unblinder:e.invm(t.modulus)}}function GX(t){var e=t.modulus.byteLength(),r;do r=new Jb(tTe(e));while(r.cmp(t.modulus)>=0||!r.umod(t.prime1)||!r.umod(t.prime2));return r}function JX(t,e){var r=rTe(e),n=e.modulus.byteLength(),i=new Jb(t).mul(r.blinder).umod(e.modulus),o=i.toRed(Jb.mont(e.prime1)),s=i.toRed(Jb.mont(e.prime2)),a=e.coefficient,d=e.prime1,u=e.prime2,c=o.redPow(e.exponent1).fromRed(),l=s.redPow(e.exponent2).fromRed(),m=c.isub(l).imul(a).umod(d).imul(u);return l.iadd(m).imul(r.unblinder).umod(e.modulus).toArrayLike(O.Buffer,"be",n)}JX.getr=GX;YX.exports=JX});var ZX=V((Emt,nTe)=>{nTe.exports={name:"elliptic",version:"6.5.4",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny ",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}});var VB=V(eQ=>{"use strict";h();var V8=eQ;function iTe(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t!="string"){for(var n=0;n>8,s=i&255;o?r.push(o,s):r.push(s)}return r}V8.toArray=iTe;function XX(t){return t.length===1?"0"+t:t}V8.zero2=XX;function QX(t){for(var e="",r=0;r{"use strict";h();var su=tQ,oTe=Gi(),sTe=fc(),H8=VB();su.assert=sTe;su.toArray=H8.toArray;su.zero2=H8.zero2;su.toHex=H8.toHex;su.encode=H8.encode;function aTe(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?a=(i>>1)-d:a=d,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n}su.getNAF=aTe;function cTe(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n=0,i=0,o;t.cmpn(-n)>0||e.cmpn(-i)>0;){var s=t.andln(3)+n&3,a=e.andln(3)+i&3;s===3&&(s=-1),a===3&&(a=-1);var d;s&1?(o=t.andln(7)+n&7,(o===3||o===5)&&a===2?d=-s:d=s):d=0,r[0].push(d);var u;a&1?(o=e.andln(7)+i&7,(o===3||o===5)&&s===2?u=-a:u=a):u=0,r[1].push(u),2*n===d+1&&(n=1-n),2*i===u+1&&(i=1-i),t.iushrn(1),e.iushrn(1)}return r}su.getJSF=cTe;function dTe(t,e,r){var n="_"+e;t.prototype[e]=function(){return this[n]!==void 0?this[n]:this[n]=r.call(this)}}su.cachedProperty=dTe;function uTe(t){return typeof t=="string"?su.toArray(t,"hex"):t}su.parseBytes=uTe;function lTe(t){return new oTe(t,"hex","le")}su.intFromLE=lTe});var Sx=V((Pmt,rQ)=>{"use strict";h();var R0=Gi(),Ex=hc(),G8=Ex.getNAF,fTe=Ex.getJSF,J8=Ex.assert;function Wp(t,e){this.type=t,this.p=new R0(e.p,16),this.red=e.prime?R0.red(e.prime):R0.mont(this.p),this.zero=new R0(0).toRed(this.red),this.one=new R0(1).toRed(this.red),this.two=new R0(2).toRed(this.red),this.n=e.n&&new R0(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}rQ.exports=Wp;Wp.prototype.point=function(){throw new Error("Not implemented")};Wp.prototype.validate=function(){throw new Error("Not implemented")};Wp.prototype._fixedNafMul=function(e,r){J8(e.precomputed);var n=e._getDoubles(),i=G8(r,1,this._bitLength),o=(1<=a;u--)d=(d<<1)+i[u];s.push(d)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),m=o;m>0;m--){for(a=0;a=0;d--){for(var u=0;d>=0&&s[d]===0;d--)u++;if(d>=0&&u++,a=a.dblp(u),d<0)break;var c=s[d];J8(c!==0),e.type==="affine"?c>0?a=a.mixedAdd(o[c-1>>1]):a=a.mixedAdd(o[-c-1>>1].neg()):c>0?a=a.add(o[c-1>>1]):a=a.add(o[-c-1>>1].neg())}return e.type==="affine"?a.toP():a};Wp.prototype._wnafMulAdd=function(e,r,n,i,o){var s=this._wnafT1,a=this._wnafT2,d=this._wnafT3,u=0,c,l,m;for(c=0;c=1;c-=2){var g=c-1,v=c;if(s[g]!==1||s[v]!==1){d[g]=G8(n[g],s[g],this._bitLength),d[v]=G8(n[v],s[v],this._bitLength),u=Math.max(d[g].length,u),u=Math.max(d[v].length,u);continue}var E=[r[g],null,null,r[v]];r[g].y.cmp(r[v].y)===0?(E[1]=r[g].add(r[v]),E[2]=r[g].toJ().mixedAdd(r[v].neg())):r[g].y.cmp(r[v].y.redNeg())===0?(E[1]=r[g].toJ().mixedAdd(r[v]),E[2]=r[g].add(r[v].neg())):(E[1]=r[g].toJ().mixedAdd(r[v]),E[2]=r[g].toJ().mixedAdd(r[v].neg()));var A=[-3,-1,-5,-7,0,7,5,1,3],P=fTe(n[g],n[v]);for(u=Math.max(P[0].length,u),d[g]=new Array(u),d[v]=new Array(u),l=0;l=0;c--){for(var F=0;c>=0;){var U=!0;for(l=0;l=0&&F++,N=N.dblp(F),c<0)break;for(l=0;l0?m=a[l][W-1>>1]:W<0&&(m=a[l][-W-1>>1].neg()),m.type==="affine"?N=N.mixedAdd(m):N=N.add(m))}}for(c=0;c=Math.ceil((e.bitLength()+1)/r.step):!1};id.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,o=0;o{"use strict";h();var hTe=hc(),fi=Gi(),HB=lr(),Yb=Sx(),pTe=hTe.assert;function od(t){Yb.call(this,"short",t),this.a=new fi(t.a,16).toRed(this.red),this.b=new fi(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}HB(od,Yb);nQ.exports=od;od.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,n;if(e.beta)r=new fi(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);r=i[0].cmp(i[1])<0?i[0]:i[1],r=r.toRed(this.red)}if(e.lambda)n=new fi(e.lambda,16);else{var o=this._getEndoRoots(this.n);this.g.mul(o[0]).x.cmp(this.g.x.redMul(r))===0?n=o[0]:(n=o[1],pTe(this.g.mul(n).x.cmp(this.g.x.redMul(r))===0))}var s;return e.basis?s=e.basis.map(function(a){return{a:new fi(a.a,16),b:new fi(a.b,16)}}):s=this._getEndoBasis(n),{beta:r,lambda:n,basis:s}}};od.prototype._getEndoRoots=function(e){var r=e===this.p?this.red:fi.mont(e),n=new fi(2).toRed(r).redInvm(),i=n.redNeg(),o=new fi(3).toRed(r).redNeg().redSqrt().redMul(n),s=i.redAdd(o).fromRed(),a=i.redSub(o).fromRed();return[s,a]};od.prototype._getEndoBasis=function(e){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,i=this.n.clone(),o=new fi(1),s=new fi(0),a=new fi(0),d=new fi(1),u,c,l,m,p,g,v,E=0,A,P;n.cmpn(0)!==0;){var I=i.div(n);A=i.sub(I.mul(n)),P=a.sub(I.mul(o));var $=d.sub(I.mul(s));if(!l&&A.cmp(r)<0)u=v.neg(),c=o,l=A.neg(),m=P;else if(l&&++E===2)break;v=A,i=n,n=A,a=o,o=P,d=s,s=$}p=A.neg(),g=P;var N=l.sqr().add(m.sqr()),K=p.sqr().add(g.sqr());return K.cmp(N)>=0&&(p=u,g=c),l.negative&&(l=l.neg(),m=m.neg()),p.negative&&(p=p.neg(),g=g.neg()),[{a:l,b:m},{a:p,b:g}]};od.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],o=i.b.mul(e).divRound(this.n),s=n.b.neg().mul(e).divRound(this.n),a=o.mul(n.a),d=s.mul(i.a),u=o.mul(n.b),c=s.mul(i.b),l=e.sub(a).sub(d),m=u.add(c).neg();return{k1:l,k2:m}};od.prototype.pointFromX=function(e,r){e=new fi(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var o=i.fromRed().isOdd();return(r&&!o||!r&&o)&&(i=i.redNeg()),this.point(e,i)};od.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(o).cmpn(0)===0};od.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,o=this._endoWnafT2,s=0;s":""};bo.prototype.isInfinity=function(){return this.inf};bo.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};bo.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),s=o.redSqr().redISub(this.x.redAdd(this.x)),a=o.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,a)};bo.prototype.getX=function(){return this.x.fromRed()};bo.prototype.getY=function(){return this.y.fromRed()};bo.prototype.mul=function(e){return e=new fi(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};bo.prototype.mulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)};bo.prototype.jmulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o,!0):this.curve._wnafMulAdd(1,i,o,2,!0)};bo.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};bo.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(o){return o.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};bo.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Ko(t,e,r,n){Yb.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new fi(0)):(this.x=new fi(e,16),this.y=new fi(r,16),this.z=new fi(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}HB(Ko,Yb.BasePoint);od.prototype.jpoint=function(e,r,n){return new Ko(this,e,r,n)};Ko.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};Ko.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Ko.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),o=e.x.redMul(n),s=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),d=i.redSub(o),u=s.redSub(a);if(d.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=d.redSqr(),l=c.redMul(d),m=i.redMul(c),p=u.redSqr().redIAdd(l).redISub(m).redISub(m),g=u.redMul(m.redISub(p)).redISub(s.redMul(l)),v=this.z.redMul(e.z).redMul(d);return this.curve.jpoint(p,g,v)};Ko.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),o=this.y,s=e.y.redMul(r).redMul(this.z),a=n.redSub(i),d=o.redSub(s);if(a.cmpn(0)===0)return d.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=n.redMul(u),m=d.redSqr().redIAdd(c).redISub(l).redISub(l),p=d.redMul(l.redISub(m)).redISub(o.redMul(c)),g=this.z.redMul(a);return this.curve.jpoint(m,p,g)};Ko.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(o),this.x.cmp(n)===0)return!0}};Ko.prototype.inspect=function(){return this.isInfinity()?"":""};Ko.prototype.isInfinity=function(){return this.z.cmpn(0)===0}});var aQ=V((Bmt,sQ)=>{"use strict";h();var Zb=Gi(),oQ=lr(),Y8=Sx(),mTe=hc();function Xb(t){Y8.call(this,"mont",t),this.a=new Zb(t.a,16).toRed(this.red),this.b=new Zb(t.b,16).toRed(this.red),this.i4=new Zb(4).toRed(this.red).redInvm(),this.two=new Zb(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}oQ(Xb,Y8);sQ.exports=Xb;Xb.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),o=i.redSqrt();return o.redSqr().cmp(i)===0};function wo(t,e,r){Y8.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Zb(e,16),this.z=new Zb(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}oQ(wo,Y8.BasePoint);Xb.prototype.decodePoint=function(e,r){return this.point(mTe.toArray(e,r),1)};Xb.prototype.point=function(e,r){return new wo(this,e,r)};Xb.prototype.pointFromJSON=function(e){return wo.fromJSON(this,e)};wo.prototype.precompute=function(){};wo.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};wo.fromJSON=function(e,r){return new wo(e,r[0],r[1]||e.one)};wo.prototype.inspect=function(){return this.isInfinity()?"":""};wo.prototype.isInfinity=function(){return this.z.cmpn(0)===0};wo.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),o=r.redSub(i),s=r.redMul(i),a=o.redMul(i.redAdd(this.curve.a24.redMul(o)));return this.curve.point(s,a)};wo.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};wo.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),o=e.x.redAdd(e.z),s=e.x.redSub(e.z),a=s.redMul(n),d=o.redMul(i),u=r.z.redMul(a.redAdd(d).redSqr()),c=r.x.redMul(a.redISub(d).redSqr());return this.curve.point(u,c)};wo.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),o=this,s=[];r.cmpn(0)!==0;r.iushrn(1))s.push(r.andln(1));for(var a=s.length-1;a>=0;a--)s[a]===0?(n=n.diffAdd(i,o),i=i.dbl()):(i=n.diffAdd(i,o),n=n.dbl());return i};wo.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};wo.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};wo.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};wo.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};wo.prototype.getX=function(){return this.normalize(),this.x.fromRed()}});var uQ=V((Cmt,dQ)=>{"use strict";h();var yTe=hc(),Zf=Gi(),cQ=lr(),Z8=Sx(),gTe=yTe.assert;function gl(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Z8.call(this,"edwards",t),this.a=new Zf(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Zf(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Zf(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),gTe(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}cQ(gl,Z8);dQ.exports=gl;gl.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};gl.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};gl.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)};gl.prototype.pointFromX=function(e,r){e=new Zf(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),o=this.one.redSub(this.c2.redMul(this.d).redMul(n)),s=i.redMul(o.redInvm()),a=s.redSqrt();if(a.redSqr().redSub(s).cmp(this.zero)!==0)throw new Error("invalid point");var d=a.fromRed().isOdd();return(r&&!d||!r&&d)&&(a=a.redNeg()),this.point(e,a)};gl.prototype.pointFromY=function(e,r){e=new Zf(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),o=n.redMul(this.d).redMul(this.c2).redSub(this.a),s=i.redMul(o.redInvm());if(s.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=s.redSqrt();if(a.redSqr().redSub(s).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)};gl.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),o=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(o)===0};function kn(t,e,r,n,i){Z8.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new Zf(e,16),this.y=new Zf(r,16),this.z=n?new Zf(n,16):this.curve.one,this.t=i&&new Zf(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}cQ(kn,Z8.BasePoint);gl.prototype.pointFromJSON=function(e){return kn.fromJSON(this,e)};gl.prototype.point=function(e,r,n,i){return new kn(this,e,r,n,i)};kn.fromJSON=function(e,r){return new kn(e,r[0],r[1],r[2])};kn.prototype.inspect=function(){return this.isInfinity()?"":""};kn.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};kn.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),o=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),s=i.redAdd(r),a=s.redSub(n),d=i.redSub(r),u=o.redMul(a),c=s.redMul(d),l=o.redMul(d),m=a.redMul(s);return this.curve.point(u,c,m,l)};kn.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,o,s,a,d,u;if(this.curve.twisted){a=this.curve._mulA(r);var c=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(c.redSub(this.curve.two)),o=c.redMul(a.redSub(n)),s=c.redSqr().redSub(c).redSub(c)):(d=this.z.redSqr(),u=c.redSub(d).redISub(d),i=e.redSub(r).redISub(n).redMul(u),o=c.redMul(a.redSub(n)),s=c.redMul(u))}else a=r.redAdd(n),d=this.curve._mulC(this.z).redSqr(),u=a.redSub(d).redSub(d),i=this.curve._mulC(e.redISub(a)).redMul(u),o=this.curve._mulC(a).redMul(r.redISub(n)),s=a.redMul(u);return this.curve.point(i,o,s)};kn.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};kn.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),o=this.z.redMul(e.z.redAdd(e.z)),s=n.redSub(r),a=o.redSub(i),d=o.redAdd(i),u=n.redAdd(r),c=s.redMul(a),l=d.redMul(u),m=s.redMul(u),p=a.redMul(d);return this.curve.point(c,l,p,m)};kn.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),o=this.y.redMul(e.y),s=this.curve.d.redMul(i).redMul(o),a=n.redSub(s),d=n.redAdd(s),u=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(o),c=r.redMul(a).redMul(u),l,m;return this.curve.twisted?(l=r.redMul(d).redMul(o.redSub(this.curve._mulA(i))),m=a.redMul(d)):(l=r.redMul(d).redMul(o.redSub(i)),m=this.curve._mulC(a).redMul(d)),this.curve.point(c,l,m)};kn.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};kn.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};kn.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)};kn.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)};kn.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this};kn.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};kn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};kn.prototype.getY=function(){return this.normalize(),this.y.fromRed()};kn.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};kn.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}};kn.prototype.toP=kn.prototype.normalize;kn.prototype.mixedAdd=kn.prototype.add});var GB=V(lQ=>{"use strict";h();var X8=lQ;X8.base=Sx();X8.short=iQ();X8.mont=aQ();X8.edwards=uQ()});var au=V(_n=>{"use strict";h();var vTe=fc(),bTe=lr();_n.inherits=bTe;function wTe(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function _Te(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=o&63|128):wTe(t,i)?(o=65536+((o&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=o&63|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=o&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}_n.htonl=fQ;function ETe(t,e){for(var r="",n=0;n>>0}return o}_n.join32=STe;function ATe(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=o&255):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=o&255)}return r}_n.split32=ATe;function TTe(t,e){return t>>>e|t<<32-e}_n.rotr32=TTe;function ITe(t,e){return t<>>32-e}_n.rotl32=ITe;function PTe(t,e){return t+e>>>0}_n.sum32=PTe;function kTe(t,e,r){return t+e+r>>>0}_n.sum32_3=kTe;function RTe(t,e,r,n){return t+e+r+n>>>0}_n.sum32_4=RTe;function DTe(t,e,r,n,i){return t+e+r+n+i>>>0}_n.sum32_5=DTe;function BTe(t,e,r,n){var i=t[e],o=t[e+1],s=n+o>>>0,a=(s>>0,t[e+1]=s}_n.sum64=BTe;function MTe(t,e,r,n){var i=e+n>>>0,o=(i>>0}_n.sum64_hi=MTe;function CTe(t,e,r,n){var i=e+n;return i>>>0}_n.sum64_lo=CTe;function OTe(t,e,r,n,i,o,s,a){var d=0,u=e;u=u+n>>>0,d+=u>>0,d+=u>>0,d+=u>>0}_n.sum64_4_hi=OTe;function $Te(t,e,r,n,i,o,s,a){var d=e+n+o+a;return d>>>0}_n.sum64_4_lo=$Te;function NTe(t,e,r,n,i,o,s,a,d,u){var c=0,l=e;l=l+n>>>0,c+=l>>0,c+=l>>0,c+=l>>0,c+=l>>0}_n.sum64_5_hi=NTe;function jTe(t,e,r,n,i,o,s,a,d,u){var c=e+n+o+a+u;return c>>>0}_n.sum64_5_lo=jTe;function UTe(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}_n.rotr64_hi=UTe;function qTe(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}_n.rotr64_lo=qTe;function LTe(t,e,r){return t>>>r}_n.shr64_hi=LTe;function KTe(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}_n.shr64_lo=KTe});var Qb=V(yQ=>{"use strict";h();var mQ=au(),FTe=fc();function Q8(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}yQ.BlockHash=Q8;Q8.prototype.update=function(e,r){if(e=mQ.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=mQ.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[o++]=e>>>16&255,i[o++]=e>>>8&255,i[o++]=e&255}else for(i[o++]=e&255,i[o++]=e>>>8&255,i[o++]=e>>>16&255,i[o++]=e>>>24&255,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,s=8;s{"use strict";h();var zTe=au(),vl=zTe.rotr32;function WTe(t,e,r,n){if(t===0)return gQ(e,r,n);if(t===1||t===3)return bQ(e,r,n);if(t===2)return vQ(e,r,n)}Xf.ft_1=WTe;function gQ(t,e,r){return t&e^~t&r}Xf.ch32=gQ;function vQ(t,e,r){return t&e^t&r^e&r}Xf.maj32=vQ;function bQ(t,e,r){return t^e^r}Xf.p32=bQ;function VTe(t){return vl(t,2)^vl(t,13)^vl(t,22)}Xf.s0_256=VTe;function HTe(t){return vl(t,6)^vl(t,11)^vl(t,25)}Xf.s1_256=HTe;function GTe(t){return vl(t,7)^vl(t,18)^t>>>3}Xf.g0_256=GTe;function JTe(t){return vl(t,17)^vl(t,19)^t>>>10}Xf.g1_256=JTe});var xQ=V((zmt,_Q)=>{"use strict";h();var ew=au(),YTe=Qb(),ZTe=JB(),YB=ew.rotl32,Ax=ew.sum32,XTe=ew.sum32_5,QTe=ZTe.ft_1,wQ=YTe.BlockHash,eIe=[1518500249,1859775393,2400959708,3395469782];function bl(){if(!(this instanceof bl))return new bl;wQ.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}ew.inherits(bl,wQ);_Q.exports=bl;bl.blockSize=512;bl.outSize=160;bl.hmacStrength=80;bl.padLength=64;bl.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;i{"use strict";h();var tw=au(),tIe=Qb(),rw=JB(),rIe=fc(),cu=tw.sum32,nIe=tw.sum32_4,iIe=tw.sum32_5,oIe=rw.ch32,sIe=rw.maj32,aIe=rw.s0_256,cIe=rw.s1_256,dIe=rw.g0_256,uIe=rw.g1_256,EQ=tIe.BlockHash,lIe=[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];function wl(){if(!(this instanceof wl))return new wl;EQ.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=lIe,this.W=new Array(64)}tw.inherits(wl,EQ);SQ.exports=wl;wl.blockSize=512;wl.outSize=256;wl.hmacStrength=192;wl.padLength=64;wl.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;i{"use strict";h();var XB=au(),AQ=ZB();function Qf(){if(!(this instanceof Qf))return new Qf;AQ.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}XB.inherits(Qf,AQ);TQ.exports=Qf;Qf.blockSize=512;Qf.outSize=224;Qf.hmacStrength=192;Qf.padLength=64;Qf.prototype._digest=function(e){return e==="hex"?XB.toHex32(this.h.slice(0,7),"big"):XB.split32(this.h.slice(0,7),"big")}});var tM=V((Ymt,DQ)=>{"use strict";h();var Pa=au(),fIe=Qb(),hIe=fc(),_l=Pa.rotr64_hi,xl=Pa.rotr64_lo,PQ=Pa.shr64_hi,kQ=Pa.shr64_lo,Vp=Pa.sum64,QB=Pa.sum64_hi,eM=Pa.sum64_lo,pIe=Pa.sum64_4_hi,mIe=Pa.sum64_4_lo,yIe=Pa.sum64_5_hi,gIe=Pa.sum64_5_lo,RQ=fIe.BlockHash,vIe=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function du(){if(!(this instanceof du))return new du;RQ.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=vIe,this.W=new Array(160)}Pa.inherits(du,RQ);DQ.exports=du;du.blockSize=1024;du.outSize=512;du.hmacStrength=192;du.padLength=128;du.prototype._prepareBlock=function(e,r){for(var n=this.W,i=0;i<32;i++)n[i]=e[r+i];for(;i{"use strict";h();var rM=au(),BQ=tM();function eh(){if(!(this instanceof eh))return new eh;BQ.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}rM.inherits(eh,BQ);MQ.exports=eh;eh.blockSize=1024;eh.outSize=384;eh.hmacStrength=192;eh.padLength=128;eh.prototype._digest=function(e){return e==="hex"?rM.toHex32(this.h.slice(0,12),"big"):rM.split32(this.h.slice(0,12),"big")}});var OQ=V(nw=>{"use strict";h();nw.sha1=xQ();nw.sha224=IQ();nw.sha256=ZB();nw.sha384=CQ();nw.sha512=tM()});var LQ=V(qQ=>{"use strict";h();var D0=au(),DIe=Qb(),e4=D0.rotl32,$Q=D0.sum32,Tx=D0.sum32_3,NQ=D0.sum32_4,UQ=DIe.BlockHash;function El(){if(!(this instanceof El))return new El;UQ.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}D0.inherits(El,UQ);qQ.ripemd160=El;El.blockSize=512;El.outSize=160;El.hmacStrength=192;El.padLength=64;El.prototype._update=function(e,r){for(var n=this.h[0],i=this.h[1],o=this.h[2],s=this.h[3],a=this.h[4],d=n,u=i,c=o,l=s,m=a,p=0;p<80;p++){var g=$Q(e4(NQ(n,jQ(p,i,o,s),e[CIe[p]+r],BIe(p)),$Ie[p]),a);n=a,a=s,s=e4(o,10),o=i,i=g,g=$Q(e4(NQ(d,jQ(79-p,u,c,l),e[OIe[p]+r],MIe(p)),NIe[p]),m),d=m,m=l,l=e4(c,10),c=u,u=g}g=Tx(this.h[1],o,l),this.h[1]=Tx(this.h[2],s,m),this.h[2]=Tx(this.h[3],a,d),this.h[3]=Tx(this.h[4],n,u),this.h[4]=Tx(this.h[0],i,c),this.h[0]=g};El.prototype._digest=function(e){return e==="hex"?D0.toHex32(this.h,"little"):D0.split32(this.h,"little")};function jQ(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function BIe(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function MIe(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}var CIe=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],OIe=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],$Ie=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],NIe=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]});var FQ=V((iyt,KQ)=>{"use strict";h();var jIe=au(),UIe=fc();function iw(t,e,r){if(!(this instanceof iw))return new iw(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(jIe.toArray(e,r))}KQ.exports=iw;iw.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),UIe(e.length<=this.blockSize);for(var r=e.length;r{h();var Fo=zQ;Fo.utils=au();Fo.common=Qb();Fo.sha=OQ();Fo.ripemd=LQ();Fo.hmac=FQ();Fo.sha1=Fo.sha.sha1;Fo.sha256=Fo.sha.sha256;Fo.sha224=Fo.sha.sha224;Fo.sha384=Fo.sha.sha384;Fo.sha512=Fo.sha.sha512;Fo.ripemd160=Fo.ripemd.ripemd160});var VQ=V((cyt,WQ)=>{h();WQ.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}});var r4=V(JQ=>{"use strict";h();var iM=JQ,Hp=t4(),nM=GB(),qIe=hc(),HQ=qIe.assert;function GQ(t){t.type==="short"?this.curve=new nM.short(t):t.type==="edwards"?this.curve=new nM.edwards(t):this.curve=new nM.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,HQ(this.g.validate(),"Invalid curve"),HQ(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}iM.PresetCurve=GQ;function Gp(t,e){Object.defineProperty(iM,t,{configurable:!0,enumerable:!0,get:function(){var r=new GQ(e);return Object.defineProperty(iM,t,{configurable:!0,enumerable:!0,value:r}),r}})}Gp("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Hp.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]});Gp("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Hp.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]});Gp("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Hp.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]});Gp("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Hp.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]});Gp("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Hp.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]});Gp("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Hp.sha256,gRed:!1,g:["9"]});Gp("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Hp.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var oM;try{oM=VQ()}catch{oM=void 0}Gp("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Hp.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",oM]})});var XQ=V((fyt,ZQ)=>{"use strict";h();var LIe=t4(),B0=VB(),YQ=fc();function Jp(t){if(!(this instanceof Jp))return new Jp(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=B0.toArray(t.entropy,t.entropyEnc||"hex"),r=B0.toArray(t.nonce,t.nonceEnc||"hex"),n=B0.toArray(t.pers,t.persEnc||"hex");YQ(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}ZQ.exports=Jp;Jp.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};Jp.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=B0.toArray(n,i||"hex"),this._update(n));for(var o=[];o.length{"use strict";h();var KIe=Gi(),FIe=hc(),sM=FIe.assert;function Ds(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}QQ.exports=Ds;Ds.fromPublic=function(e,r,n){return r instanceof Ds?r:new Ds(e,{pub:r,pubEnc:n})};Ds.fromPrivate=function(e,r,n){return r instanceof Ds?r:new Ds(e,{priv:r,privEnc:n})};Ds.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};Ds.prototype.getPublic=function(e,r){return typeof e=="string"&&(r=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,e):this.pub};Ds.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv};Ds.prototype._importPrivate=function(e,r){this.priv=new KIe(e,r||16),this.priv=this.priv.umod(this.ec.curve.n)};Ds.prototype._importPublic=function(e,r){if(e.x||e.y){this.ec.curve.type==="mont"?sM(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&sM(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,r)};Ds.prototype.derive=function(e){return e.validate()||sM(e.validate(),"public point not validated"),e.mul(this.priv).getX()};Ds.prototype.sign=function(e,r,n){return this.ec.sign(e,this,r,n)};Ds.prototype.verify=function(e,r){return this.ec.verify(e,r,this)};Ds.prototype.inspect=function(){return""}});var nee=V((yyt,ree)=>{"use strict";h();var n4=Gi(),dM=hc(),zIe=dM.assert;function i4(t,e){if(t instanceof i4)return t;this._importDER(t,e)||(zIe(t.r&&t.s,"Signature without r or s"),this.r=new n4(t.r,16),this.s=new n4(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}ree.exports=i4;function WIe(){this.place=0}function aM(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return i<=127?!1:(e.place=s,i)}function tee(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}i4.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=tee(r),n=tee(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];cM(i,r.length),i=i.concat(r),i.push(2),cM(i,n.length);var o=i.concat(n),s=[48];return cM(s,o.length),s=s.concat(o),dM.encode(s,e)}});var aee=V((vyt,see)=>{"use strict";h();var M0=Gi(),iee=XQ(),VIe=hc(),uM=r4(),HIe=q8(),oee=VIe.assert,lM=eee(),o4=nee();function sd(t){if(!(this instanceof sd))return new sd(t);typeof t=="string"&&(oee(Object.prototype.hasOwnProperty.call(uM,t),"Unknown curve "+t),t=uM[t]),t instanceof uM.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}see.exports=sd;sd.prototype.keyPair=function(e){return new lM(this,e)};sd.prototype.keyFromPrivate=function(e,r){return lM.fromPrivate(this,e,r)};sd.prototype.keyFromPublic=function(e,r){return lM.fromPublic(this,e,r)};sd.prototype.genKeyPair=function(e){e||(e={});for(var r=new iee({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||HIe(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new M0(2));;){var o=new M0(r.generate(n));if(!(o.cmp(i)>0))return o.iaddn(1),this.keyFromPrivate(o)}};sd.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};sd.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new M0(e,16));for(var o=this.n.byteLength(),s=r.getPrivate().toArray("be",o),a=e.toArray("be",o),d=new iee({hash:this.hash,entropy:s,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new M0(1)),c=0;;c++){var l=i.k?i.k(c):new M0(d.generate(this.n.byteLength()));if(l=this._truncateToN(l,!0),!(l.cmpn(1)<=0||l.cmp(u)>=0)){var m=this.g.mul(l);if(!m.isInfinity()){var p=m.getX(),g=p.umod(this.n);if(g.cmpn(0)!==0){var v=l.invm(this.n).mul(g.mul(r.getPrivate()).iadd(e));if(v=v.umod(this.n),v.cmpn(0)!==0){var E=(m.getY().isOdd()?1:0)|(p.cmp(g)!==0?2:0);return i.canonical&&v.cmp(this.nh)>0&&(v=this.n.sub(v),E^=1),new o4({r:g,s:v,recoveryParam:E})}}}}}};sd.prototype.verify=function(e,r,n,i){e=this._truncateToN(new M0(e,16)),n=this.keyFromPublic(n,i),r=new o4(r,"hex");var o=r.r,s=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a=s.invm(this.n),d=a.mul(e).umod(this.n),u=a.mul(o).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(d,n.getPublic(),u),c.isInfinity()?!1:c.eqXToP(o)):(c=this.g.mulAdd(d,n.getPublic(),u),c.isInfinity()?!1:c.getX().umod(this.n).cmp(o)===0)};sd.prototype.recoverPubKey=function(t,e,r,n){oee((3&r)===r,"The recovery param is more than two bits"),e=new o4(e,n);var i=this.n,o=new M0(t),s=e.r,a=e.s,d=r&1,u=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?s=this.curve.pointFromX(s.add(this.curve.n),d):s=this.curve.pointFromX(s,d);var c=e.r.invm(i),l=i.sub(o).mul(c).umod(i),m=a.mul(c).umod(i);return this.g.mulAdd(l,s,m)};sd.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new o4(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch{continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}});var lee=V((wyt,uee)=>{"use strict";h();var Ix=hc(),dee=Ix.assert,cee=Ix.parseBytes,ow=Ix.cachedProperty;function _o(t,e){this.eddsa=t,this._secret=cee(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=cee(e.pub)}_o.fromPublic=function(e,r){return r instanceof _o?r:new _o(e,{pub:r})};_o.fromSecret=function(e,r){return r instanceof _o?r:new _o(e,{secret:r})};_o.prototype.secret=function(){return this._secret};ow(_o,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});ow(_o,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});ow(_o,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i});ow(_o,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});ow(_o,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});ow(_o,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});_o.prototype.sign=function(e){return dee(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};_o.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)};_o.prototype.getSecret=function(e){return dee(this._secret,"KeyPair is public only"),Ix.encode(this.secret(),e)};_o.prototype.getPublic=function(e){return Ix.encode(this.pubBytes(),e)};uee.exports=_o});var hee=V((xyt,fee)=>{"use strict";h();var GIe=Gi(),s4=hc(),JIe=s4.assert,a4=s4.cachedProperty,YIe=s4.parseBytes;function C0(t,e){this.eddsa=t,typeof e!="object"&&(e=YIe(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),JIe(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof GIe&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}a4(C0,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});a4(C0,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});a4(C0,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});a4(C0,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});C0.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};C0.prototype.toHex=function(){return s4.encode(this.toBytes(),"hex").toUpperCase()};fee.exports=C0});var vee=V((Syt,gee)=>{"use strict";h();var ZIe=t4(),XIe=r4(),sw=hc(),QIe=sw.assert,mee=sw.parseBytes,yee=lee(),pee=hee();function ka(t){if(QIe(t==="ed25519","only tested with ed25519 so far"),!(this instanceof ka))return new ka(t);t=XIe[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=ZIe.sha512}gee.exports=ka;ka.prototype.sign=function(e,r){e=mee(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),o=this.g.mul(i),s=this.encodePoint(o),a=this.hashInt(s,n.pubBytes(),e).mul(n.priv()),d=i.add(a).umod(this.curve.n);return this.makeSignature({R:o,S:d,Rencoded:s})};ka.prototype.verify=function(e,r,n){e=mee(e),r=this.makeSignature(r);var i=this.keyFromPublic(n),o=this.hashInt(r.Rencoded(),i.pubBytes(),e),s=this.g.mul(r.S()),a=r.R().add(i.pub().mul(o));return a.eq(s)};ka.prototype.hashInt=function(){for(var e=this.hash(),r=0;r{"use strict";h();var O0=bee;O0.version=ZX().version;O0.utils=hc();O0.rand=q8();O0.curve=GB();O0.curves=r4();O0.ec=aee();O0.eddsa=vee()});var u4=V((Pyt,wee)=>{"use strict";h();var d4=Fn(),aw=d4.Buffer,ad={},cd;for(cd in d4)d4.hasOwnProperty(cd)&&(cd==="SlowBuffer"||cd==="Buffer"||(ad[cd]=d4[cd]));var cw=ad.Buffer={};for(cd in aw)aw.hasOwnProperty(cd)&&(cd==="allocUnsafe"||cd==="allocUnsafeSlow"||(cw[cd]=aw[cd]));ad.Buffer.prototype=aw.prototype;(!cw.from||cw.from===Uint8Array.from)&&(cw.from=function(t,e,r){if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type '+typeof t);if(t&&typeof t.length>"u")throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);return aw(t,e,r)});cw.alloc||(cw.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError('The "size" argument must be of type number. Received type '+typeof t);if(t<0||t>=2*(1<<30))throw new RangeError('The value "'+t+'" is invalid for option "size"');var n=aw(t);return!e||e.length===0?n.fill(0):typeof r=="string"?n.fill(e,r):n.fill(e),n});if(!ad.kStringMaxLength)try{ad.kStringMaxLength=D.default.binding("buffer").kStringMaxLength}catch{}ad.constants||(ad.constants={MAX_LENGTH:ad.kMaxLength},ad.kStringMaxLength&&(ad.constants.MAX_STRING_LENGTH=ad.kStringMaxLength));wee.exports=ad});var l4=V(_ee=>{"use strict";h();var ePe=lr();function dd(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}_ee.Reporter=dd;dd.prototype.isError=function(e){return e instanceof dw};dd.prototype.save=function(){let e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}};dd.prototype.restore=function(e){let r=this._reporterState;r.obj=e.obj,r.path=r.path.slice(0,e.pathLen)};dd.prototype.enterKey=function(e){return this._reporterState.path.push(e)};dd.prototype.exitKey=function(e){let r=this._reporterState;r.path=r.path.slice(0,e-1)};dd.prototype.leaveKey=function(e,r,n){let i=this._reporterState;this.exitKey(e),i.obj!==null&&(i.obj[r]=n)};dd.prototype.path=function(){return this._reporterState.path.join("/")};dd.prototype.enterObject=function(){let e=this._reporterState,r=e.obj;return e.obj={},r};dd.prototype.leaveObject=function(e){let r=this._reporterState,n=r.obj;return r.obj=e,n};dd.prototype.error=function(e){let r,n=this._reporterState,i=e instanceof dw;if(i?r=e:r=new dw(n.path.map(function(o){return"["+JSON.stringify(o)+"]"}).join(""),e.message||e,e.stack),!n.options.partial)throw r;return i||n.errors.push(r),r};dd.prototype.wrapResult=function(e){let r=this._reporterState;return r.options.partial?{result:this.isError(e)?null:e,errors:r.errors}:e};function dw(t,e){this.path=t,this.rethrow(e)}ePe(dw,Error);dw.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,dw),!this.stack)try{throw new Error(this.message)}catch(r){this.stack=r.stack}return this}});var fw=V(fM=>{"use strict";h();var tPe=lr(),f4=l4().Reporter,uw=u4().Buffer;function ud(t,e){if(f4.call(this,e),!uw.isBuffer(t)){this.error("Input not Buffer");return}this.base=t,this.offset=0,this.length=t.length}tPe(ud,f4);fM.DecoderBuffer=ud;ud.isDecoderBuffer=function(e){return e instanceof ud?!0:typeof e=="object"&&uw.isBuffer(e.base)&&e.constructor.name==="DecoderBuffer"&&typeof e.offset=="number"&&typeof e.length=="number"&&typeof e.save=="function"&&typeof e.restore=="function"&&typeof e.isEmpty=="function"&&typeof e.readUInt8=="function"&&typeof e.skip=="function"&&typeof e.raw=="function"};ud.prototype.save=function(){return{offset:this.offset,reporter:f4.prototype.save.call(this)}};ud.prototype.restore=function(e){let r=new ud(this.base);return r.offset=e.offset,r.length=this.offset,this.offset=e.offset,f4.prototype.restore.call(this,e.reporter),r};ud.prototype.isEmpty=function(){return this.offset===this.length};ud.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")};ud.prototype.skip=function(e,r){if(!(this.offset+e<=this.length))return this.error(r||"DecoderBuffer overrun");let n=new ud(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+e,this.offset+=e,n};ud.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)};function lw(t,e){if(Array.isArray(t))this.length=0,this.value=t.map(function(r){return lw.isEncoderBuffer(r)||(r=new lw(r,e)),this.length+=r.length,r},this);else if(typeof t=="number"){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if(typeof t=="string")this.value=t,this.length=uw.byteLength(t);else if(uw.isBuffer(t))this.value=t,this.length=t.length;else return e.error("Unsupported type: "+typeof t)}fM.EncoderBuffer=lw;lw.isEncoderBuffer=function(e){return e instanceof lw?!0:typeof e=="object"&&e.constructor.name==="EncoderBuffer"&&typeof e.length=="number"&&typeof e.join=="function"};lw.prototype.join=function(e,r){return e||(e=uw.alloc(this.length)),r||(r=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(n){n.join(e,r),r+=n.length}):(typeof this.value=="number"?e[r]=this.value:typeof this.value=="string"?e.write(this.value,r):uw.isBuffer(this.value)&&this.value.copy(e,r),r+=this.length)),e}});var h4=V((Cyt,Eee)=>{"use strict";h();var rPe=l4().Reporter,nPe=fw().EncoderBuffer,iPe=fw().DecoderBuffer,ta=fc(),xee=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],oPe=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(xee),sPe=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function mn(t,e,r){let n={};this._baseState=n,n.name=r,n.enc=t,n.parent=e||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}Eee.exports=mn;var aPe=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];mn.prototype.clone=function(){let e=this._baseState,r={};aPe.forEach(function(i){r[i]=e[i]});let n=new this.constructor(r.parent);return n._baseState=r,n};mn.prototype._wrap=function(){let e=this._baseState;oPe.forEach(function(r){this[r]=function(){let i=new this.constructor(this);return e.children.push(i),i[r].apply(i,arguments)}},this)};mn.prototype._init=function(e){let r=this._baseState;ta(r.parent===null),e.call(this),r.children=r.children.filter(function(n){return n._baseState.parent===this},this),ta.equal(r.children.length,1,"Root node can have only one child")};mn.prototype._useArgs=function(e){let r=this._baseState,n=e.filter(function(i){return i instanceof this.constructor},this);e=e.filter(function(i){return!(i instanceof this.constructor)},this),n.length!==0&&(ta(r.children===null),r.children=n,n.forEach(function(i){i._baseState.parent=this},this)),e.length!==0&&(ta(r.args===null),r.args=e,r.reverseArgs=e.map(function(i){if(typeof i!="object"||i.constructor!==Object)return i;let o={};return Object.keys(i).forEach(function(s){s==(s|0)&&(s|=0);let a=i[s];o[a]=s}),o}))};sPe.forEach(function(t){mn.prototype[t]=function(){let r=this._baseState;throw new Error(t+" not implemented for encoding: "+r.enc)}});xee.forEach(function(t){mn.prototype[t]=function(){let r=this._baseState,n=Array.prototype.slice.call(arguments);return ta(r.tag===null),r.tag=t,this._useArgs(n),this}});mn.prototype.use=function(e){ta(e);let r=this._baseState;return ta(r.use===null),r.use=e,this};mn.prototype.optional=function(){let e=this._baseState;return e.optional=!0,this};mn.prototype.def=function(e){let r=this._baseState;return ta(r.default===null),r.default=e,r.optional=!0,this};mn.prototype.explicit=function(e){let r=this._baseState;return ta(r.explicit===null&&r.implicit===null),r.explicit=e,this};mn.prototype.implicit=function(e){let r=this._baseState;return ta(r.explicit===null&&r.implicit===null),r.implicit=e,this};mn.prototype.obj=function(){let e=this._baseState,r=Array.prototype.slice.call(arguments);return e.obj=!0,r.length!==0&&this._useArgs(r),this};mn.prototype.key=function(e){let r=this._baseState;return ta(r.key===null),r.key=e,this};mn.prototype.any=function(){let e=this._baseState;return e.any=!0,this};mn.prototype.choice=function(e){let r=this._baseState;return ta(r.choice===null),r.choice=e,this._useArgs(Object.keys(e).map(function(n){return e[n]})),this};mn.prototype.contains=function(e){let r=this._baseState;return ta(r.use===null),r.contains=e,this};mn.prototype._decode=function(e,r){let n=this._baseState;if(n.parent===null)return e.wrapResult(n.children[0]._decode(e,r));let i=n.default,o=!0,s=null;if(n.key!==null&&(s=e.enterKey(n.key)),n.optional){let d=null;if(n.explicit!==null?d=n.explicit:n.implicit!==null?d=n.implicit:n.tag!==null&&(d=n.tag),d===null&&!n.any){let u=e.save();try{n.choice===null?this._decodeGeneric(n.tag,e,r):this._decodeChoice(e,r),o=!0}catch{o=!1}e.restore(u)}else if(o=this._peekTag(e,d,n.any),e.isError(o))return o}let a;if(n.obj&&o&&(a=e.enterObject()),o){if(n.explicit!==null){let u=this._decodeTag(e,n.explicit);if(e.isError(u))return u;e=u}let d=e.offset;if(n.use===null&&n.choice===null){let u;n.any&&(u=e.save());let c=this._decodeTag(e,n.implicit!==null?n.implicit:n.tag,n.any);if(e.isError(c))return c;n.any?i=e.raw(u):e=c}if(r&&r.track&&n.tag!==null&&r.track(e.path(),d,e.length,"tagged"),r&&r.track&&n.tag!==null&&r.track(e.path(),e.offset,e.length,"content"),n.any||(n.choice===null?i=this._decodeGeneric(n.tag,e,r):i=this._decodeChoice(e,r)),e.isError(i))return i;if(!n.any&&n.choice===null&&n.children!==null&&n.children.forEach(function(c){c._decode(e,r)}),n.contains&&(n.tag==="octstr"||n.tag==="bitstr")){let u=new iPe(i);i=this._getUse(n.contains,e._reporterState.obj)._decode(u,r)}}return n.obj&&o&&(i=e.leaveObject(a)),n.key!==null&&(i!==null||o===!0)?e.leaveKey(s,n.key,i):s!==null&&e.exitKey(s),i};mn.prototype._decodeGeneric=function(e,r,n){let i=this._baseState;return e==="seq"||e==="set"?null:e==="seqof"||e==="setof"?this._decodeList(r,e,i.args[0],n):/str$/.test(e)?this._decodeStr(r,e,n):e==="objid"&&i.args?this._decodeObjid(r,i.args[0],i.args[1],n):e==="objid"?this._decodeObjid(r,null,null,n):e==="gentime"||e==="utctime"?this._decodeTime(r,e,n):e==="null_"?this._decodeNull(r,n):e==="bool"?this._decodeBool(r,n):e==="objDesc"?this._decodeStr(r,e,n):e==="int"||e==="enum"?this._decodeInt(r,i.args&&i.args[0],n):i.use!==null?this._getUse(i.use,r._reporterState.obj)._decode(r,n):r.error("unknown tag: "+e)};mn.prototype._getUse=function(e,r){let n=this._baseState;return n.useDecoder=this._use(e,r),ta(n.useDecoder._baseState.parent===null),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder};mn.prototype._decodeChoice=function(e,r){let n=this._baseState,i=null,o=!1;return Object.keys(n.choice).some(function(s){let a=e.save(),d=n.choice[s];try{let u=d._decode(e,r);if(e.isError(u))return!1;i={type:s,value:u},o=!0}catch{return e.restore(a),!1}return!0},this),o?i:e.error("Choice not matched")};mn.prototype._createEncoderBuffer=function(e){return new nPe(e,this.reporter)};mn.prototype._encode=function(e,r,n){let i=this._baseState;if(i.default!==null&&i.default===e)return;let o=this._encodeValue(e,r,n);if(o!==void 0&&!this._skipDefault(o,r,n))return o};mn.prototype._encodeValue=function(e,r,n){let i=this._baseState;if(i.parent===null)return i.children[0]._encode(e,r||new rPe);let o=null;if(this.reporter=r,i.optional&&e===void 0)if(i.default!==null)e=i.default;else return;let s=null,a=!1;if(i.any)o=this._createEncoderBuffer(e);else if(i.choice)o=this._encodeChoice(e,r);else if(i.contains)s=this._getUse(i.contains,n)._encode(e,r),a=!0;else if(i.children)s=i.children.map(function(d){if(d._baseState.tag==="null_")return d._encode(null,r,e);if(d._baseState.key===null)return r.error("Child should have a key");let u=r.enterKey(d._baseState.key);if(typeof e!="object")return r.error("Child expected, but input is not object");let c=d._encode(e[d._baseState.key],r,e);return r.leaveKey(u),c},this).filter(function(d){return d}),s=this._createEncoderBuffer(s);else if(i.tag==="seqof"||i.tag==="setof"){if(!(i.args&&i.args.length===1))return r.error("Too many args for : "+i.tag);if(!Array.isArray(e))return r.error("seqof/setof, but data is not Array");let d=this.clone();d._baseState.implicit=null,s=this._createEncoderBuffer(e.map(function(u){let c=this._baseState;return this._getUse(c.args[0],e)._encode(u,r)},d))}else i.use!==null?o=this._getUse(i.use,n)._encode(e,r):(s=this._encodePrimitive(i.tag,e),a=!0);if(!i.any&&i.choice===null){let d=i.implicit!==null?i.implicit:i.tag,u=i.implicit===null?"universal":"context";d===null?i.use===null&&r.error("Tag could be omitted only for .use()"):i.use===null&&(o=this._encodeComposite(d,a,u,s))}return i.explicit!==null&&(o=this._encodeComposite(i.explicit,!1,"context",o)),o};mn.prototype._encodeChoice=function(e,r){let n=this._baseState,i=n.choice[e.type];return i||ta(!1,e.type+" not found in "+JSON.stringify(Object.keys(n.choice))),i._encode(e.value,r)};mn.prototype._encodePrimitive=function(e,r){let n=this._baseState;if(/str$/.test(e))return this._encodeStr(r,e);if(e==="objid"&&n.args)return this._encodeObjid(r,n.reverseArgs[0],n.args[1]);if(e==="objid")return this._encodeObjid(r,null,null);if(e==="gentime"||e==="utctime")return this._encodeTime(r,e);if(e==="null_")return this._encodeNull();if(e==="int"||e==="enum")return this._encodeInt(r,n.args&&n.reverseArgs[0]);if(e==="bool")return this._encodeBool(r);if(e==="objDesc")return this._encodeStr(r,e);throw new Error("Unsupported tag: "+e)};mn.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)};mn.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)}});var p4=V($0=>{"use strict";h();function See(t){let e={};return Object.keys(t).forEach(function(r){(r|0)==r&&(r=r|0);let n=t[r];e[n]=r}),e}$0.tagClass={0:"universal",1:"application",2:"context",3:"private"};$0.tagClassByName=See($0.tagClass);$0.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"};$0.tagByName=See($0.tag)});var pM=V((jyt,Iee)=>{"use strict";h();var cPe=lr(),th=u4().Buffer,Aee=h4(),hM=p4();function Tee(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new uu,this.tree._init(t.body)}Iee.exports=Tee;Tee.prototype.encode=function(e,r){return this.tree._encode(e,r).join()};function uu(t){Aee.call(this,"der",t)}cPe(uu,Aee);uu.prototype._encodeComposite=function(e,r,n,i){let o=dPe(e,r,n,this.reporter);if(i.length<128){let d=th.alloc(2);return d[0]=o,d[1]=i.length,this._createEncoderBuffer([d,i])}let s=1;for(let d=i.length;d>=256;d>>=8)s++;let a=th.alloc(2+s);a[0]=o,a[1]=128|s;for(let d=1+s,u=i.length;u>0;d--,u>>=8)a[d]=u&255;return this._createEncoderBuffer([a,i])};uu.prototype._encodeStr=function(e,r){if(r==="bitstr")return this._createEncoderBuffer([e.unused|0,e.data]);if(r==="bmpstr"){let n=th.alloc(e.length*2);for(let i=0;i=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,e[0]*40+e[1])}let i=0;for(let a=0;a=128;d>>=7)i++}let o=th.alloc(i),s=o.length-1;for(let a=e.length-1;a>=0;a--){let d=e[a];for(o[s--]=d&127;(d>>=7)>0;)o[s--]=128|d&127}return this._createEncoderBuffer(o)};function ld(t){return t<10?"0"+t:t}uu.prototype._encodeTime=function(e,r){let n,i=new Date(e);return r==="gentime"?n=[ld(i.getUTCFullYear()),ld(i.getUTCMonth()+1),ld(i.getUTCDate()),ld(i.getUTCHours()),ld(i.getUTCMinutes()),ld(i.getUTCSeconds()),"Z"].join(""):r==="utctime"?n=[ld(i.getUTCFullYear()%100),ld(i.getUTCMonth()+1),ld(i.getUTCDate()),ld(i.getUTCHours()),ld(i.getUTCMinutes()),ld(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+r+" time is not supported yet"),this._encodeStr(n,"octstr")};uu.prototype._encodeNull=function(){return this._createEncoderBuffer("")};uu.prototype._encodeInt=function(e,r){if(typeof e=="string"){if(!r)return this.reporter.error("String int or enum given, but no values map");if(!r.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=r[e]}if(typeof e!="number"&&!th.isBuffer(e)){let o=e.toArray();!e.sign&&o[0]&128&&o.unshift(0),e=th.from(o)}if(th.isBuffer(e)){let o=e.length;e.length===0&&o++;let s=th.alloc(o);return e.copy(s),e.length===0&&(s[0]=0),this._createEncoderBuffer(s)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let n=1;for(let o=e;o>=256;o>>=8)n++;let i=new Array(n);for(let o=i.length-1;o>=0;o--)i[o]=e&255,e>>=8;return i[0]&128&&i.unshift(0),this._createEncoderBuffer(th.from(i))};uu.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)};uu.prototype._use=function(e,r){return typeof e=="function"&&(e=e(r)),e._getEncoder("der").tree};uu.prototype._skipDefault=function(e,r,n){let i=this._baseState,o;if(i.default===null)return!1;let s=e.join();if(i.defaultBuffer===void 0&&(i.defaultBuffer=this._encodeValue(i.default,r,n).join()),s.length!==i.defaultBuffer.length)return!1;for(o=0;o=31?n.error("Multi-octet tag encoding unsupported"):(e||(i|=32),i|=hM.tagClassByName[r||"universal"]<<6,i)}});var kee=V((qyt,Pee)=>{"use strict";h();var uPe=lr(),mM=pM();function yM(t){mM.call(this,t),this.enc="pem"}uPe(yM,mM);Pee.exports=yM;yM.prototype.encode=function(e,r){let i=mM.prototype.encode.call(this,e).toString("base64"),o=["-----BEGIN "+r.label+"-----"];for(let s=0;s{"use strict";h();var Ree=Dee;Ree.der=pM();Ree.pem=kee()});var bM=V((zyt,Nee)=>{"use strict";h();var lPe=lr(),fPe=Gi(),Bee=fw().DecoderBuffer,Cee=h4(),Mee=p4();function Oee(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new pc,this.tree._init(t.body)}Nee.exports=Oee;Oee.prototype.decode=function(e,r){return Bee.isDecoderBuffer(e)||(e=new Bee(e,r)),this.tree._decode(e,r)};function pc(t){Cee.call(this,"der",t)}lPe(pc,Cee);pc.prototype._peekTag=function(e,r,n){if(e.isEmpty())return!1;let i=e.save(),o=vM(e,'Failed to peek tag: "'+r+'"');return e.isError(o)?o:(e.restore(i),o.tag===r||o.tagStr===r||o.tagStr+"of"===r||n)};pc.prototype._decodeTag=function(e,r,n){let i=vM(e,'Failed to decode tag of "'+r+'"');if(e.isError(i))return i;let o=$ee(e,i.primitive,'Failed to get length of "'+r+'"');if(e.isError(o))return o;if(!n&&i.tag!==r&&i.tagStr!==r&&i.tagStr+"of"!==r)return e.error('Failed to match tag: "'+r+'"');if(i.primitive||o!==null)return e.skip(o,'Failed to match body of: "'+r+'"');let s=e.save(),a=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(a)?a:(o=e.offset-s.offset,e.restore(s),e.skip(o,'Failed to match body of: "'+r+'"'))};pc.prototype._skipUntilEnd=function(e,r){for(;;){let n=vM(e,r);if(e.isError(n))return n;let i=$ee(e,n.primitive,r);if(e.isError(i))return i;let o;if(n.primitive||i!==null?o=e.skip(i):o=this._skipUntilEnd(e,r),e.isError(o))return o;if(n.tagStr==="end")break}};pc.prototype._decodeList=function(e,r,n,i){let o=[];for(;!e.isEmpty();){let s=this._peekTag(e,"end");if(e.isError(s))return s;let a=n.decode(e,"der",i);if(e.isError(a)&&s)break;o.push(a)}return o};pc.prototype._decodeStr=function(e,r){if(r==="bitstr"){let n=e.readUInt8();return e.isError(n)?n:{unused:n,data:e.raw()}}else if(r==="bmpstr"){let n=e.raw();if(n.length%2===1)return e.error("Decoding of string type: bmpstr length mismatch");let i="";for(let o=0;o>6],i=(r&32)===0;if((r&31)===31){let s=r;for(r=0;(s&128)===128;){if(s=t.readUInt8(e),t.isError(s))return s;r<<=7,r|=s&127}}else r&=31;let o=Mee.tag[r];return{cls:n,primitive:i,tag:r,tagStr:o}}function $ee(t,e,r){let n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&n===128)return null;if(!(n&128))return n;let i=n&127;if(i>4)return t.error("length octect is too long");n=0;for(let o=0;o{"use strict";h();var hPe=lr(),pPe=u4().Buffer,wM=bM();function _M(t){wM.call(this,t),this.enc="pem"}hPe(_M,wM);jee.exports=_M;_M.prototype.decode=function(e,r){let n=e.toString().split(/[\r\n]+/g),i=r.label.toUpperCase(),o=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,a=-1;for(let c=0;c{"use strict";h();var qee=Lee;qee.der=bM();qee.pem=Uee()});var Fee=V(Kee=>{"use strict";h();var mPe=gM(),yPe=xM(),gPe=lr(),vPe=Kee;vPe.define=function(e,r){return new hw(e,r)};function hw(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}hw.prototype._createNamed=function(e){let r=this.name;function n(i){this._initNamed(i,r)}return gPe(n,e),n.prototype._initNamed=function(o,s){e.call(this,o,s)},new n(this)};hw.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(yPe[e])),this.decoders[e]};hw.prototype.decode=function(e,r,n){return this._getDecoder(r).decode(e,n)};hw.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(mPe[e])),this.encoders[e]};hw.prototype.encode=function(e,r,n){return this._getEncoder(r).encode(e,n)}});var Wee=V(zee=>{"use strict";h();var m4=zee;m4.Reporter=l4().Reporter;m4.DecoderBuffer=fw().DecoderBuffer;m4.EncoderBuffer=fw().EncoderBuffer;m4.Node=h4()});var Gee=V(Hee=>{"use strict";h();var Vee=Hee;Vee._reverse=function(e){let r={};return Object.keys(e).forEach(function(n){(n|0)==n&&(n=n|0);let i=e[n];r[i]=n}),r};Vee.der=p4()});var EM=V(Jee=>{"use strict";h();var pw=Jee;pw.bignum=Gi();pw.define=Fee().define;pw.base=Wee();pw.constants=Gee();pw.decoders=xM();pw.encoders=gM()});var Qee=V((i0t,Xee)=>{"use strict";h();var lu=EM(),Yee=lu.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),bPe=lu.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),SM=lu.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),wPe=lu.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(SM),this.key("subjectPublicKey").bitstr())}),_Pe=lu.define("RelativeDistinguishedName",function(){this.setof(bPe)}),xPe=lu.define("RDNSequence",function(){this.seqof(_Pe)}),Zee=lu.define("Name",function(){this.choice({rdnSequence:this.use(xPe)})}),EPe=lu.define("Validity",function(){this.seq().obj(this.key("notBefore").use(Yee),this.key("notAfter").use(Yee))}),SPe=lu.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),APe=lu.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(SM),this.key("issuer").use(Zee),this.key("validity").use(EPe),this.key("subject").use(Zee),this.key("subjectPublicKeyInfo").use(wPe),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(SPe).optional())}),TPe=lu.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(APe),this.key("signatureAlgorithm").use(SM),this.key("signatureValue").bitstr())});Xee.exports=TPe});var tte=V(hu=>{"use strict";h();var fu=EM();hu.certificate=Qee();var IPe=fu.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});hu.RSAPrivateKey=IPe;var PPe=fu.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});hu.RSAPublicKey=PPe;var kPe=fu.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(ete),this.key("subjectPublicKey").bitstr())});hu.PublicKey=kPe;var ete=fu.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),RPe=fu.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(ete),this.key("subjectPrivateKey").octstr())});hu.PrivateKey=RPe;var DPe=fu.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});hu.EncryptedPrivateKey=DPe;var BPe=fu.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});hu.DSAPrivateKey=BPe;hu.DSAparam=fu.define("DSAparam",function(){this.int()});var MPe=fu.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(CPe),this.key("publicKey").optional().explicit(1).bitstr())});hu.ECPrivateKey=MPe;var CPe=fu.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});hu.signature=fu.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})});var rte=V((c0t,OPe)=>{OPe.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}});var ite=V((d0t,nte)=>{h();var $Pe=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,NPe=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,jPe=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,UPe=wx(),qPe=U8(),y4=ur().Buffer;nte.exports=function(t,e){var r=t.toString(),n=r.match($Pe),i;if(n){var s="aes"+n[1],a=y4.from(n[2],"hex"),d=y4.from(n[3].replace(/[\r\n]/g,""),"base64"),u=UPe(e,a.slice(0,8),parseInt(n[1],10)).key,c=[],l=qPe.createDecipheriv(s,u,a);c.push(l.update(d)),c.push(l.final()),i=y4.concat(c)}else{var o=r.match(jPe);i=y4.from(o[2].replace(/[\r\n]/g,""),"base64")}var m=r.match(NPe)[1];return{tag:m,data:i}}});var Px=V((l0t,ste)=>{h();var Ra=tte(),LPe=rte(),KPe=ite(),FPe=U8(),zPe=hB(),AM=ur().Buffer;ste.exports=ote;function ote(t){var e;typeof t=="object"&&!AM.isBuffer(t)&&(e=t.passphrase,t=t.key),typeof t=="string"&&(t=AM.from(t));var r=KPe(t,e),n=r.tag,i=r.data,o,s;switch(n){case"CERTIFICATE":s=Ra.certificate.decode(i,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(s||(s=Ra.PublicKey.decode(i,"der")),o=s.algorithm.algorithm.join("."),o){case"1.2.840.113549.1.1.1":return Ra.RSAPublicKey.decode(s.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return s.subjectPrivateKey=s.subjectPublicKey,{type:"ec",data:s};case"1.2.840.10040.4.1":return s.algorithm.params.pub_key=Ra.DSAparam.decode(s.subjectPublicKey.data,"der"),{type:"dsa",data:s.algorithm.params};default:throw new Error("unknown key id "+o)}case"ENCRYPTED PRIVATE KEY":i=Ra.EncryptedPrivateKey.decode(i,"der"),i=WPe(i,e);case"PRIVATE KEY":switch(s=Ra.PrivateKey.decode(i,"der"),o=s.algorithm.algorithm.join("."),o){case"1.2.840.113549.1.1.1":return Ra.RSAPrivateKey.decode(s.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:s.algorithm.curve,privateKey:Ra.ECPrivateKey.decode(s.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return s.algorithm.params.priv_key=Ra.DSAparam.decode(s.subjectPrivateKey,"der"),{type:"dsa",params:s.algorithm.params};default:throw new Error("unknown key id "+o)}case"RSA PUBLIC KEY":return Ra.RSAPublicKey.decode(i,"der");case"RSA PRIVATE KEY":return Ra.RSAPrivateKey.decode(i,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:Ra.DSAPrivateKey.decode(i,"der")};case"EC PRIVATE KEY":return i=Ra.ECPrivateKey.decode(i,"der"),{curve:i.parameters.value,privateKey:i.privateKey};default:throw new Error("unknown key type "+n)}}ote.signature=Ra.signature;function WPe(t,e){var r=t.algorithm.decrypt.kde.kdeparams.salt,n=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),i=LPe[t.algorithm.decrypt.cipher.algo.join(".")],o=t.algorithm.decrypt.cipher.iv,s=t.subjectPrivateKey,a=parseInt(i.split("-")[1],10)/8,d=zPe.pbkdf2Sync(e,r,n,a,"sha1"),u=FPe.createDecipheriv(i,d,o),c=[];return c.push(u.update(s)),c.push(u.final()),AM.concat(c)}});var TM=V((h0t,VPe)=>{VPe.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}});var dte=V((p0t,v4)=>{"use strict";h();var Bs=ur().Buffer,N0=nB(),HPe=W8(),GPe=c4().ec,g4=z8(),JPe=Px(),YPe=TM(),ZPe=1;function XPe(t,e,r,n,i){var o=JPe(e);if(o.curve){if(n!=="ecdsa"&&n!=="ecdsa/rsa")throw new Error("wrong private key type");return QPe(t,o)}else if(o.type==="dsa"){if(n!=="dsa")throw new Error("wrong private key type");return eke(t,o,r)}if(n!=="rsa"&&n!=="ecdsa/rsa")throw new Error("wrong private key type");if(e.padding!==void 0&&e.padding!==ZPe)throw new Error("illegal or unsupported padding mode");t=Bs.concat([i,t]);for(var s=o.modulus.byteLength(),a=[0,1];t.length+a.length+10&&r.ishrn(n),r}function rke(t,e){t=IM(t,e),t=t.mod(e);var r=Bs.from(t.toArray());if(r.length{"use strict";h();var PM=ur().Buffer,kx=z8(),ike=c4().ec,lte=Px(),oke=TM();function ske(t,e,r,n,i){var o=lte(r);if(o.type==="ec"){if(n!=="ecdsa"&&n!=="ecdsa/rsa")throw new Error("wrong public key type");return ake(t,e,o)}else if(o.type==="dsa"){if(n!=="dsa")throw new Error("wrong public key type");return cke(t,e,o)}if(n!=="rsa"&&n!=="ecdsa/rsa")throw new Error("wrong public key type");e=PM.concat([i,e]);for(var s=o.modulus.byteLength(),a=[1],d=0;e.length+a.length+2=0)throw new Error("invalid sig")}fte.exports=ske});var bte=V((v0t,vte)=>{"use strict";h();var b4=ur().Buffer,yte=Kb(),w4=f8(),gte=lr(),dke=dte(),uke=hte(),j0=iB();Object.keys(j0).forEach(function(t){j0[t].id=b4.from(j0[t].id,"hex"),j0[t.toLowerCase()]=j0[t]});function Rx(t){w4.Writable.call(this);var e=j0[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=yte(e.hash),this._tag=e.id,this._signType=e.sign}gte(Rx,w4.Writable);Rx.prototype._write=function(e,r,n){this._hash.update(e),n()};Rx.prototype.update=function(e,r){return this._hash.update(typeof e=="string"?b4.from(e,r):e),this};Rx.prototype.sign=function(e,r){this.end();var n=this._hash.digest(),i=dke(n,e,this._hashType,this._signType,this._tag);return r?i.toString(r):i};function Dx(t){w4.Writable.call(this);var e=j0[t];if(!e)throw new Error("Unknown message digest");this._hash=yte(e.hash),this._tag=e.id,this._signType=e.sign}gte(Dx,w4.Writable);Dx.prototype._write=function(e,r,n){this._hash.update(e),n()};Dx.prototype.update=function(e,r){return this._hash.update(typeof e=="string"?b4.from(e,r):e),this};Dx.prototype.verify=function(e,r,n){var i=typeof r=="string"?b4.from(r,n):r;this.end();var o=this._hash.digest();return uke(i,o,e,this._signType,this._tag)};function pte(t){return new Rx(t)}function mte(t){return new Dx(t)}vte.exports={Sign:pte,Verify:mte,createSign:pte,createVerify:mte}});var _te=V((w0t,wte)=>{h();var lke=c4(),fke=Gi();wte.exports=function(e){return new U0(e)};var mc={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};mc.p224=mc.secp224r1;mc.p256=mc.secp256r1=mc.prime256v1;mc.p192=mc.secp192r1=mc.prime192v1;mc.p384=mc.secp384r1;mc.p521=mc.secp521r1;function U0(t){this.curveType=mc[t],this.curveType||(this.curveType={name:t}),this.curve=new lke.ec(this.curveType.name),this.keys=void 0}U0.prototype.generateKeys=function(t,e){return this.keys=this.curve.genKeyPair(),this.getPublicKey(t,e)};U0.prototype.computeSecret=function(t,e,r){e=e||"utf8",O.Buffer.isBuffer(t)||(t=new O.Buffer(t,e));var n=this.curve.keyFromPublic(t).getPublic(),i=n.mul(this.keys.getPrivate()).getX();return kM(i,r,this.curveType.byteLength)};U0.prototype.getPublicKey=function(t,e){var r=this.keys.getPublic(e==="compressed",!0);return e==="hybrid"&&(r[r.length-1]%2?r[0]=7:r[0]=6),kM(r,t)};U0.prototype.getPrivateKey=function(t){return kM(this.keys.getPrivate(),t)};U0.prototype.setPublicKey=function(t,e){return e=e||"utf8",O.Buffer.isBuffer(t)||(t=new O.Buffer(t,e)),this.keys._importPublic(t),this};U0.prototype.setPrivateKey=function(t,e){e=e||"utf8",O.Buffer.isBuffer(t)||(t=new O.Buffer(t,e));var r=new fke(t);return r=r.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(r),this};function kM(t,e,r){Array.isArray(t)||(t=t.toArray());var n=new O.Buffer(t);if(r&&n.length{h();var hke=Kb(),RM=ur().Buffer;xte.exports=function(t,e){for(var r=RM.alloc(0),n=0,i;r.length{h();Ete.exports=function(e,r){for(var n=e.length,i=-1;++i{h();var Ste=Gi(),mke=ur().Buffer;function yke(t,e){return mke.from(t.toRed(Ste.mont(e.modulus)).redPow(new Ste(e.publicExponent)).fromRed().toArray())}Ate.exports=yke});var kte=V((P0t,Pte)=>{h();var gke=Px(),CM=p0(),vke=Kb(),Tte=DM(),Ite=BM(),OM=Gi(),bke=MM(),wke=W8(),pu=ur().Buffer;Pte.exports=function(e,r,n){var i;e.padding?i=e.padding:n?i=1:i=4;var o=gke(e),s;if(i===4)s=_ke(o,r);else if(i===1)s=xke(o,r,n);else if(i===3){if(s=new OM(r),s.cmp(o.modulus)>=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return n?wke(s,o):bke(s,o)};function _ke(t,e){var r=t.modulus.byteLength(),n=e.length,i=vke("sha1").update(pu.alloc(0)).digest(),o=i.length,s=2*o;if(n>r-s-2)throw new Error("message too long");var a=pu.alloc(r-n-s-2),d=r-o-1,u=CM(o),c=Ite(pu.concat([i,a,pu.alloc(1,1),e],d),Tte(u,d)),l=Ite(u,Tte(c,o));return new OM(pu.concat([pu.alloc(1),l,c],r))}function xke(t,e,r){var n=e.length,i=t.modulus.byteLength();if(n>i-11)throw new Error("message too long");var o;return r?o=pu.alloc(i-n-3,255):o=Eke(i-n-3),new OM(pu.concat([pu.from([0,r?1:2]),o,pu.alloc(1),e],i))}function Eke(t){for(var e=pu.allocUnsafe(t),r=0,n=CM(t*2),i=0,o;r{h();var Ske=Px(),Rte=DM(),Dte=BM(),Bte=Gi(),Ake=W8(),Tke=Kb(),Ike=MM(),Bx=ur().Buffer;Mte.exports=function(e,r,n){var i;e.padding?i=e.padding:n?i=1:i=4;var o=Ske(e),s=o.modulus.byteLength();if(r.length>s||new Bte(r).cmp(o.modulus)>=0)throw new Error("decryption error");var a;n?a=Ike(new Bte(r),o):a=Ake(r,o);var d=Bx.alloc(s-a.length);if(a=Bx.concat([d,a],s),i===4)return Pke(o,a);if(i===1)return kke(o,a,n);if(i===3)return a;throw new Error("unknown padding")};function Pke(t,e){var r=t.modulus.byteLength(),n=Tke("sha1").update(Bx.alloc(0)).digest(),i=n.length;if(e[0]!==0)throw new Error("decryption error");var o=e.slice(1,i+1),s=e.slice(i+1),a=Dte(o,Rte(s,i)),d=Dte(s,Rte(a,r-i-1));if(Rke(n,d.slice(0,i)))throw new Error("decryption error");for(var u=i;d[u]===0;)u++;if(d[u++]!==1)throw new Error("decryption error");return d.slice(u)}function kke(t,e,r){for(var n=e.slice(0,2),i=2,o=0;e[i++]!==0;)if(i>=e.length){o++;break}var s=e.slice(2,i-1);if((n.toString("hex")!=="0002"&&!r||n.toString("hex")!=="0001"&&r)&&o++,s.length<8&&o++,o)throw new Error("decryption error");return e.slice(i)}function Rke(t,e){t=Bx.from(t),e=Bx.from(e);var r=0,n=t.length;t.length!==e.length&&(r++,n=Math.min(t.length,e.length));for(var i=-1;++i{h();q0.publicEncrypt=kte();q0.privateDecrypt=Cte();q0.privateEncrypt=function(e,r){return q0.publicEncrypt(e,r,!0)};q0.publicDecrypt=function(e,r){return q0.privateDecrypt(e,r,!0)}});var Wte=V(Mx=>{"use strict";h();function $te(){throw new Error(`secure random number generation not supported by this browser use chrome, FireFox or Internet Explorer 11`)}var jte=ur(),Nte=p0(),Ute=jte.Buffer,qte=jte.kMaxLength,$M=globalThis.crypto||globalThis.msCrypto,Lte=Math.pow(2,32)-1;function Kte(t,e){if(typeof t!="number"||t!==t)throw new TypeError("offset must be a number");if(t>Lte||t<0)throw new TypeError("offset must be a uint32");if(t>qte||t>e)throw new RangeError("offset out of range")}function Fte(t,e,r){if(typeof t!="number"||t!==t)throw new TypeError("size must be a number");if(t>Lte||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>qte)throw new RangeError("buffer too small")}$M&&$M.getRandomValues||!D.default.browser?(Mx.randomFill=Dke,Mx.randomFillSync=Bke):(Mx.randomFill=$te,Mx.randomFillSync=$te);function Dke(t,e,r,n){if(!Ute.isBuffer(t)&&!(t instanceof globalThis.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof e=="function")n=e,e=0,r=t.length;else if(typeof r=="function")n=r,r=t.length-e;else if(typeof n!="function")throw new TypeError('"cb" argument must be a function');return Kte(e,t.length),Fte(r,e,t.length),zte(t,e,r,n)}function zte(t,e,r,n){if(D.default.browser){var i=t.buffer,o=new Uint8Array(i,e,r);if($M.getRandomValues(o),n){D.default.nextTick(function(){n(null,t)});return}return t}if(n){Nte(r,function(a,d){if(a)return n(a);d.copy(t,e),n(null,t)});return}var s=Nte(r);return s.copy(t,e),t}function Bke(t,e,r){if(typeof e>"u"&&(e=0),!Ute.isBuffer(t)&&!(t instanceof globalThis.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return Kte(e,t.length),r===void 0&&(r=t.length-e),Fte(r,e,t.length),zte(t,e,r)}});var L8=V(fr=>{"use strict";h();fr.randomBytes=fr.rng=fr.pseudoRandomBytes=fr.prng=p0();fr.createHash=fr.Hash=Kb();fr.createHmac=fr.Hmac=nB();var Mke=lZ(),Cke=Object.keys(Mke),Oke=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(Cke);fr.getHashes=function(){return Oke};var Vte=hB();fr.pbkdf2=Vte.pbkdf2;fr.pbkdf2Sync=Vte.pbkdf2Sync;var Sl=MX();fr.Cipher=Sl.Cipher;fr.createCipher=Sl.createCipher;fr.Cipheriv=Sl.Cipheriv;fr.createCipheriv=Sl.createCipheriv;fr.Decipher=Sl.Decipher;fr.createDecipher=Sl.createDecipher;fr.Decipheriv=Sl.Decipheriv;fr.createDecipheriv=Sl.createDecipheriv;fr.getCiphers=Sl.getCiphers;fr.listCiphers=Sl.listCiphers;var Cx=VX();fr.DiffieHellmanGroup=Cx.DiffieHellmanGroup;fr.createDiffieHellmanGroup=Cx.createDiffieHellmanGroup;fr.getDiffieHellman=Cx.getDiffieHellman;fr.createDiffieHellman=Cx.createDiffieHellman;fr.DiffieHellman=Cx.DiffieHellman;var _4=bte();fr.createSign=_4.createSign;fr.Sign=_4.Sign;fr.createVerify=_4.createVerify;fr.Verify=_4.Verify;fr.createECDH=_te();var x4=Ote();fr.publicEncrypt=x4.publicEncrypt;fr.privateEncrypt=x4.privateEncrypt;fr.publicDecrypt=x4.publicDecrypt;fr.privateDecrypt=x4.privateDecrypt;var Hte=Wte();fr.randomFill=Hte.randomFill;fr.randomFillSync=Hte.randomFillSync;fr.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join(` `))};fr.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}});var mu=V(hr=>{"use strict";h();Object.defineProperty(hr,"__esModule",{value:!0});hr.setBigUint64=hr.Hash=hr.equalBytes=hr.ensureBytes=hr.checkOpts=hr.concatBytes=hr.toBytes=hr.bytesToUtf8=hr.utf8ToBytes=hr.asyncLoop=hr.nextTick=hr.hexToBytes=hr.bytesToHex=hr.isLE=hr.createView=hr.u32=hr.u16=hr.u8=void 0;var jM=t=>t instanceof Uint8Array,$ke=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength);hr.u8=$ke;var Nke=t=>new Uint16Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/2));hr.u16=Nke;var jke=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4));hr.u32=jke;var Uke=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);hr.createView=Uke;hr.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!hr.isLE)throw new Error("Non little-endian hardware is not supported");var qke=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Lke(t){if(!jM(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r{};hr.nextTick=Fke;async function zke(t,e,r){let n=Date.now();for(let i=0;i=0&&on+i.length,0)),r=0;return t.forEach(n=>{if(!jM(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}hr.concatBytes=Hke;var Gke=t=>Object.prototype.toString.call(t)==="[object Object]"&&t.constructor===Object;function Jke(t,e){if(e!==void 0&&(typeof e!="object"||!Gke(e)))throw new Error("options must be object or undefined");return Object.assign(t,e)}hr.checkOpts=Jke;function Yke(t,e){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");if(typeof e=="number"&&t.length!==e)throw new Error(`Uint8Array length ${e} expected`)}hr.ensureBytes=Yke;function Zke(t,e){if(t.length!==e.length)throw new Error("equalBytes: Different size of Uint8Arrays");let r=!0;for(let n=0;n>i&o),a=Number(r&o),d=n?4:0,u=n?0:4;t.setUint32(e+d,s,n),t.setUint32(e+u,a,n)}hr.setBigUint64=Xke});var Ox=V(Ms=>{"use strict";h();Object.defineProperty(Ms,"__esModule",{value:!0});Ms.AEAD_TAG_LENGTH=Ms.XCHACHA20_NONCE_LENGTH=Ms.CURVE25519_PUBLIC_KEY_SIZE=Ms.ETH_PUBLIC_KEY_SIZE=Ms.UNCOMPRESSED_PUBLIC_KEY_SIZE=Ms.COMPRESSED_PUBLIC_KEY_SIZE=Ms.SECRET_KEY_LENGTH=void 0;Ms.SECRET_KEY_LENGTH=32;Ms.COMPRESSED_PUBLIC_KEY_SIZE=33;Ms.UNCOMPRESSED_PUBLIC_KEY_SIZE=65;Ms.ETH_PUBLIC_KEY_SIZE=64;Ms.CURVE25519_PUBLIC_KEY_SIZE=32;Ms.XCHACHA20_NONCE_LENGTH=24;Ms.AEAD_TAG_LENGTH=16});var L0=V(zn=>{"use strict";h();Object.defineProperty(zn,"__esModule",{value:!0});zn.ephemeralKeySize=zn.symmetricNonceLength=zn.symmetricAlgorithm=zn.isHkdfKeyCompressed=zn.isEphemeralKeyCompressed=zn.ellipticCurve=zn.ECIES_CONFIG=void 0;var E4=Ox(),Qke=function(){function t(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16}return t}();zn.ECIES_CONFIG=new Qke;var eRe=function(){return zn.ECIES_CONFIG.ellipticCurve};zn.ellipticCurve=eRe;var tRe=function(){return zn.ECIES_CONFIG.isEphemeralKeyCompressed};zn.isEphemeralKeyCompressed=tRe;var rRe=function(){return zn.ECIES_CONFIG.isHkdfKeyCompressed};zn.isHkdfKeyCompressed=rRe;var nRe=function(){return zn.ECIES_CONFIG.symmetricAlgorithm};zn.symmetricAlgorithm=nRe;var iRe=function(){return zn.ECIES_CONFIG.symmetricNonceLength};zn.symmetricNonceLength=iRe;var oRe=function(){var t={secp256k1:zn.ECIES_CONFIG.isEphemeralKeyCompressed?E4.COMPRESSED_PUBLIC_KEY_SIZE:E4.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:E4.CURVE25519_PUBLIC_KEY_SIZE,ed25519:E4.CURVE25519_PUBLIC_KEY_SIZE};if(zn.ECIES_CONFIG.ellipticCurve in t)return t[zn.ECIES_CONFIG.ellipticCurve];throw new Error("Not implemented")};zn.ephemeralKeySize=oRe});var Jte=V(S4=>{"use strict";h();Object.defineProperty(S4,"__esModule",{value:!0});S4.crypto=void 0;S4.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});var UM=V(mw=>{"use strict";h();Object.defineProperty(mw,"__esModule",{value:!0});mw.getWebcryptoSubtle=mw.randomBytes=void 0;var K0=Jte();function sRe(t=32){if(K0.crypto&&typeof K0.crypto.getRandomValues=="function")return K0.crypto.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}mw.randomBytes=sRe;function aRe(){if(K0.crypto&&typeof K0.crypto.subtle=="object"&&K0.crypto.subtle!=null)return K0.crypto.subtle;throw new Error("crypto.subtle must be defined")}mw.getWebcryptoSubtle=aRe});var LM=V(ra=>{"use strict";h();Object.defineProperty(ra,"__esModule",{value:!0});ra.output=ra.exists=ra.hash=ra.bytes=ra.bool=ra.number=void 0;function A4(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}ra.number=A4;function Yte(t){if(typeof t!="boolean")throw new Error(`Expected boolean, not ${t}`)}ra.bool=Yte;function cRe(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function qM(t,...e){if(!cRe(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}`)}ra.bytes=qM;function Zte(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");A4(t.outputLen),A4(t.blockLen)}ra.hash=Zte;function Xte(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")}ra.exists=Xte;function Qte(t,e){qM(t);let r=e.outputLen;if(t.length{"use strict";h();Object.defineProperty(T4,"__esModule",{value:!0});T4.crypto=void 0;T4.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});var Yp=V(pr=>{"use strict";h();Object.defineProperty(pr,"__esModule",{value:!0});pr.randomBytes=pr.wrapXOFConstructorWithOpts=pr.wrapConstructorWithOpts=pr.wrapConstructor=pr.checkOpts=pr.Hash=pr.concatBytes=pr.toBytes=pr.utf8ToBytes=pr.asyncLoop=pr.nextTick=pr.hexToBytes=pr.bytesToHex=pr.isLE=pr.rotr=pr.createView=pr.u32=pr.u8=void 0;var KM=ere(),uRe=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength);pr.u8=uRe;var lRe=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4));pr.u32=lRe;function zM(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var fRe=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);pr.createView=fRe;var hRe=(t,e)=>t<<32-e|t>>>e;pr.rotr=hRe;pr.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!pr.isLE)throw new Error("Non little-endian hardware is not supported");var pRe=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function mRe(t){if(!zM(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r=rh._0&&t<=rh._9)return t-rh._0;if(t>=rh._A&&t<=rh._F)return t-(rh._A-10);if(t>=rh._a&&t<=rh._f)return t-(rh._a-10)}function yRe(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;i{};pr.nextTick=gRe;async function vRe(t,e,r){let n=Date.now();for(let i=0;i=0&&ot().update(I4(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}pr.wrapConstructor=xRe;function ERe(t){let e=(n,i)=>t(i).update(I4(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}pr.wrapConstructorWithOpts=ERe;function SRe(t){let e=(n,i)=>t(i).update(I4(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}pr.wrapXOFConstructorWithOpts=SRe;function ARe(t=32){if(KM.crypto&&typeof KM.crypto.getRandomValues=="function")return KM.crypto.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}pr.randomBytes=ARe});var HM=V(P4=>{"use strict";h();Object.defineProperty(P4,"__esModule",{value:!0});P4.SHA2=void 0;var WM=LM(),$x=Yp();function TRe(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),a=Number(r&o),d=n?4:0,u=n?0:4;t.setUint32(e+d,s,n),t.setUint32(e+u,a,n)}var VM=class extends $x.Hash{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=(0,$x.createView)(this.buffer)}update(e){(0,WM.exists)(this);let{view:r,buffer:n,blockLen:i}=this;e=(0,$x.toBytes)(e);let o=e.length;for(let s=0;si-s&&(this.process(n,0),s=0);for(let l=s;lc.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l{"use strict";h();Object.defineProperty(Ct,"__esModule",{value:!0});Ct.add5L=Ct.add5H=Ct.add4H=Ct.add4L=Ct.add3H=Ct.add3L=Ct.add=Ct.rotlBL=Ct.rotlBH=Ct.rotlSL=Ct.rotlSH=Ct.rotr32L=Ct.rotr32H=Ct.rotrBL=Ct.rotrBH=Ct.rotrSL=Ct.rotrSH=Ct.shrSL=Ct.shrSH=Ct.toBig=Ct.split=Ct.fromBig=void 0;var k4=BigInt(2**32-1),GM=BigInt(32);function JM(t,e=!1){return e?{h:Number(t&k4),l:Number(t>>GM&k4)}:{h:Number(t>>GM&k4)|0,l:Number(t&k4)|0}}Ct.fromBig=JM;function nre(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;iBigInt(t>>>0)<>>0);Ct.toBig=ire;var ore=(t,e,r)=>t>>>r;Ct.shrSH=ore;var sre=(t,e,r)=>t<<32-r|e>>>r;Ct.shrSL=sre;var are=(t,e,r)=>t>>>r|e<<32-r;Ct.rotrSH=are;var cre=(t,e,r)=>t<<32-r|e>>>r;Ct.rotrSL=cre;var dre=(t,e,r)=>t<<64-r|e>>>r-32;Ct.rotrBH=dre;var ure=(t,e,r)=>t>>>r-32|e<<64-r;Ct.rotrBL=ure;var lre=(t,e)=>e;Ct.rotr32H=lre;var fre=(t,e)=>t;Ct.rotr32L=fre;var hre=(t,e,r)=>t<>>32-r;Ct.rotlSH=hre;var pre=(t,e,r)=>e<>>32-r;Ct.rotlSL=pre;var mre=(t,e,r)=>e<>>64-r;Ct.rotlBH=mre;var yre=(t,e,r)=>t<>>64-r;Ct.rotlBL=yre;function gre(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}Ct.add=gre;var vre=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0);Ct.add3L=vre;var bre=(t,e,r,n)=>e+r+n+(t/2**32|0)|0;Ct.add3H=bre;var wre=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0);Ct.add4L=wre;var _re=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0;Ct.add4H=_re;var xre=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0);Ct.add5L=xre;var Ere=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0;Ct.add5H=Ere;var IRe={fromBig:JM,split:nre,toBig:ire,shrSH:ore,shrSL:sre,rotrSH:are,rotrSL:cre,rotrBH:dre,rotrBL:ure,rotr32H:lre,rotr32L:fre,rotlSH:hre,rotlSL:pre,rotlBH:mre,rotlBL:yre,add:gre,add3L:vre,add3H:bre,add4L:wre,add4H:_re,add5H:Ere,add5L:xre};Ct.default=IRe});var Are=V(fd=>{"use strict";h();Object.defineProperty(fd,"__esModule",{value:!0});fd.sha384=fd.sha512_256=fd.sha512_224=fd.sha512=fd.SHA512=void 0;var PRe=HM(),mr=Sre(),R4=Yp(),[kRe,RRe]=mr.default.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))),Zp=new Uint32Array(80),Xp=new Uint32Array(80),F0=class extends PRe.SHA2{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:a,Dl:d,Eh:u,El:c,Fh:l,Fl:m,Gh:p,Gl:g,Hh:v,Hl:E}=this;return[e,r,n,i,o,s,a,d,u,c,l,m,p,g,v,E]}set(e,r,n,i,o,s,a,d,u,c,l,m,p,g,v,E){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=a|0,this.Dl=d|0,this.Eh=u|0,this.El=c|0,this.Fh=l|0,this.Fl=m|0,this.Gh=p|0,this.Gl=g|0,this.Hh=v|0,this.Hl=E|0}process(e,r){for(let I=0;I<16;I++,r+=4)Zp[I]=e.getUint32(r),Xp[I]=e.getUint32(r+=4);for(let I=16;I<80;I++){let $=Zp[I-15]|0,N=Xp[I-15]|0,K=mr.default.rotrSH($,N,1)^mr.default.rotrSH($,N,8)^mr.default.shrSH($,N,7),F=mr.default.rotrSL($,N,1)^mr.default.rotrSL($,N,8)^mr.default.shrSL($,N,7),U=Zp[I-2]|0,W=Xp[I-2]|0,L=mr.default.rotrSH(U,W,19)^mr.default.rotrBH(U,W,61)^mr.default.shrSH(U,W,6),T=mr.default.rotrSL(U,W,19)^mr.default.rotrBL(U,W,61)^mr.default.shrSL(U,W,6),S=mr.default.add4L(F,T,Xp[I-7],Xp[I-16]),k=mr.default.add4H(S,K,L,Zp[I-7],Zp[I-16]);Zp[I]=k|0,Xp[I]=S|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:d,Dh:u,Dl:c,Eh:l,El:m,Fh:p,Fl:g,Gh:v,Gl:E,Hh:A,Hl:P}=this;for(let I=0;I<80;I++){let $=mr.default.rotrSH(l,m,14)^mr.default.rotrSH(l,m,18)^mr.default.rotrBH(l,m,41),N=mr.default.rotrSL(l,m,14)^mr.default.rotrSL(l,m,18)^mr.default.rotrBL(l,m,41),K=l&p^~l&v,F=m&g^~m&E,U=mr.default.add5L(P,N,F,RRe[I],Xp[I]),W=mr.default.add5H(U,A,$,K,kRe[I],Zp[I]),L=U|0,T=mr.default.rotrSH(n,i,28)^mr.default.rotrBH(n,i,34)^mr.default.rotrBH(n,i,39),S=mr.default.rotrSL(n,i,28)^mr.default.rotrBL(n,i,34)^mr.default.rotrBL(n,i,39),k=n&o^n&a^o&a,f=i&s^i&d^s&d;A=v|0,P=E|0,v=p|0,E=g|0,p=l|0,g=m|0,{h:l,l:m}=mr.default.add(u|0,c|0,W|0,L|0),u=a|0,c=d|0,a=o|0,d=s|0,o=n|0,s=i|0;let y=mr.default.add3L(L,S,f);n=mr.default.add3H(y,W,T,k),i=y|0}({h:n,l:i}=mr.default.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=mr.default.add(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:d}=mr.default.add(this.Ch|0,this.Cl|0,a|0,d|0),{h:u,l:c}=mr.default.add(this.Dh|0,this.Dl|0,u|0,c|0),{h:l,l:m}=mr.default.add(this.Eh|0,this.El|0,l|0,m|0),{h:p,l:g}=mr.default.add(this.Fh|0,this.Fl|0,p|0,g|0),{h:v,l:E}=mr.default.add(this.Gh|0,this.Gl|0,v|0,E|0),{h:A,l:P}=mr.default.add(this.Hh|0,this.Hl|0,A|0,P|0),this.set(n,i,o,s,a,d,u,c,l,m,p,g,v,E,A,P)}roundClean(){Zp.fill(0),Xp.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)}};fd.SHA512=F0;var YM=class extends F0{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}},ZM=class extends F0{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}},XM=class extends F0{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}};fd.sha512=(0,R4.wrapConstructor)(()=>new F0);fd.sha512_224=(0,R4.wrapConstructor)(()=>new YM);fd.sha512_256=(0,R4.wrapConstructor)(()=>new ZM);fd.sha384=(0,R4.wrapConstructor)(()=>new XM)});var yu=V(Xt=>{"use strict";h();Object.defineProperty(Xt,"__esModule",{value:!0});Xt.validateObject=Xt.createHmacDrbg=Xt.bitMask=Xt.bitSet=Xt.bitGet=Xt.bitLen=Xt.utf8ToBytes=Xt.equalBytes=Xt.concatBytes=Xt.ensureBytes=Xt.numberToVarBytesBE=Xt.numberToBytesLE=Xt.numberToBytesBE=Xt.bytesToNumberLE=Xt.bytesToNumberBE=Xt.hexToBytes=Xt.hexToNumber=Xt.numberToHexUnpadded=Xt.bytesToHex=Xt.isBytes=void 0;var Pre=BigInt(0),D4=BigInt(1),DRe=BigInt(2);function yw(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}Xt.isBytes=yw;var BRe=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function eC(t){if(!yw(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r=nh._0&&t<=nh._9)return t-nh._0;if(t>=nh._A&&t<=nh._F)return t-(nh._A-10);if(t>=nh._a&&t<=nh._f)return t-(nh._a-10)}function B4(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;iPre;t>>=D4,e+=1);return e}Xt.bitLen=qRe;function LRe(t,e){return t>>BigInt(e)&D4}Xt.bitGet=LRe;var KRe=(t,e,r)=>t|(r?D4:Pre)<(DRe<new Uint8Array(t),Ire=t=>Uint8Array.from(t);function zRe(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=QM(t),i=QM(t),o=0,s=()=>{n.fill(1),i.fill(0),o=0},a=(...l)=>r(i,n,...l),d=(l=QM())=>{i=a(Ire([0]),l),n=a(),l.length!==0&&(i=a(Ire([1]),l),n=a())},u=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let l=0,m=[];for(;l{s(),d(l);let p;for(;!(p=m(u()));)d();return s(),p}}Xt.createHmacDrbg=zRe;var WRe={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"||yw(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 VRe(t,e,r={}){let n=(i,o,s)=>{let a=WRe[o];if(typeof a!="function")throw new Error(`Invalid validator "${o}", expected function`);let d=t[i];if(!(s&&d===void 0)&&!a(d,t))throw new Error(`Invalid param ${String(i)}=${d} (${typeof d}), 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}Xt.validateObject=VRe});var em=V(Qt=>{"use strict";h();Object.defineProperty(Qt,"__esModule",{value:!0});Qt.mapHashToField=Qt.getMinHashLength=Qt.getFieldBytesLength=Qt.hashToPrivateScalar=Qt.FpSqrtEven=Qt.FpSqrtOdd=Qt.Field=Qt.nLength=Qt.FpIsSquare=Qt.FpDiv=Qt.FpInvertBatch=Qt.FpPow=Qt.validateField=Qt.isNegativeLE=Qt.FpSqrt=Qt.tonelliShanks=Qt.invert=Qt.pow2=Qt.pow=Qt.mod=void 0;var gc=yu(),Ji=BigInt(0),xn=BigInt(1),Qp=BigInt(2),HRe=BigInt(3),rC=BigInt(4),Bre=BigInt(5),Mre=BigInt(8),GRe=BigInt(9),JRe=BigInt(16);function yc(t,e){let r=t%e;return r>=Ji?r:e+r}Qt.mod=yc;function Cre(t,e,r){if(r<=Ji||e 0");if(r===xn)return Ji;let n=xn;for(;e>Ji;)e&xn&&(n=n*t%r),t=t*t%r,e>>=xn;return n}Qt.pow=Cre;function YRe(t,e,r){let n=t;for(;e-- >Ji;)n*=n,n%=r;return n}Qt.pow2=YRe;function M4(t,e){if(t===Ji||e<=Ji)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=yc(t,e),n=e,i=Ji,o=xn,s=xn,a=Ji;for(;r!==Ji;){let u=n/r,c=n%r,l=i-s*u,m=o-a*u;n=r,r=c,i=s,o=a,s=l,a=m}if(n!==xn)throw new Error("invert: does not exist");return yc(i,e)}Qt.invert=M4;function Ore(t){let e=(t-xn)/Qp,r,n,i;for(r=t-xn,n=0;r%Qp===Ji;r/=Qp,n++);for(i=Qp;i(yc(t,e)&xn)===xn;Qt.isNegativeLE=ZRe;var XRe=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function QRe(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=XRe.reduce((n,i)=>(n[i]="function",n),e);return(0,gc.validateObject)(t,r)}Qt.validateField=QRe;function Nre(t,e,r){if(r 0");if(r===Ji)return t.ONE;if(r===xn)return e;let n=t.ONE,i=e;for(;r>Ji;)r&xn&&(n=t.mul(n,i)),i=t.sqr(i),r>>=xn;return n}Qt.FpPow=Nre;function jre(t,e){let r=new Array(e.length),n=e.reduce((o,s,a)=>t.is0(s)?o:(r[a]=o,t.mul(o,s)),t.ONE),i=t.inv(n);return e.reduceRight((o,s,a)=>t.is0(s)?o:(r[a]=t.mul(o,r[a]),t.mul(o,s)),i),r}Qt.FpInvertBatch=jre;function e9e(t,e,r){return t.mul(e,typeof r=="bigint"?M4(r,t.ORDER):t.inv(r))}Qt.FpDiv=e9e;function t9e(t){let e=(t.ORDER-xn)/Qp;return r=>{let n=t.pow(r,e);return t.eql(n,t.ZERO)||t.eql(n,t.ONE)}}Qt.FpIsSquare=t9e;function nC(t,e){let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}Qt.nLength=nC;function r9e(t,e,r=!1,n={}){if(t<=Ji)throw new Error(`Expected Field ORDER > 0, got ${t}`);let{nBitLength:i,nByteLength:o}=nC(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");let s=$re(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:(0,gc.bitMask)(i),ZERO:Ji,ONE:xn,create:d=>yc(d,t),isValid:d=>{if(typeof d!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof d}`);return Ji<=d&&dd===Ji,isOdd:d=>(d&xn)===xn,neg:d=>yc(-d,t),eql:(d,u)=>d===u,sqr:d=>yc(d*d,t),add:(d,u)=>yc(d+u,t),sub:(d,u)=>yc(d-u,t),mul:(d,u)=>yc(d*u,t),pow:(d,u)=>Nre(a,d,u),div:(d,u)=>yc(d*M4(u,t),t),sqrN:d=>d*d,addN:(d,u)=>d+u,subN:(d,u)=>d-u,mulN:(d,u)=>d*u,inv:d=>M4(d,t),sqrt:n.sqrt||(d=>s(a,d)),invertBatch:d=>jre(a,d),cmov:(d,u,c)=>c?u:d,toBytes:d=>r?(0,gc.numberToBytesLE)(d,o):(0,gc.numberToBytesBE)(d,o),fromBytes:d=>{if(d.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${d.length}`);return r?(0,gc.bytesToNumberLE)(d):(0,gc.bytesToNumberBE)(d)}});return Object.freeze(a)}Qt.Field=r9e;function n9e(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");let r=t.sqrt(e);return t.isOdd(r)?r:t.neg(r)}Qt.FpSqrtOdd=n9e;function i9e(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}Qt.FpSqrtEven=i9e;function o9e(t,e,r=!1){t=(0,gc.ensureBytes)("privateHash",t);let n=t.length,i=nC(e).nByteLength+8;if(i<24||n1024)throw new Error(`hashToPrivateScalar: expected ${i}-1024 bytes of input, got ${n}`);let o=r?(0,gc.bytesToNumberLE)(t):(0,gc.bytesToNumberBE)(t);return yc(o,e-xn)+xn}Qt.hashToPrivateScalar=o9e;function iC(t){if(typeof t!="bigint")throw new Error("field order must be bigint");let e=t.toString(2).length;return Math.ceil(e/8)}Qt.getFieldBytesLength=iC;function Ure(t){let e=iC(t);return e+Math.ceil(e/2)}Qt.getMinHashLength=Ure;function s9e(t,e,r=!1){let n=t.length,i=iC(e),o=Ure(e);if(n<16||n1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);let s=r?(0,gc.bytesToNumberBE)(t):(0,gc.bytesToNumberLE)(t),a=yc(s,e-xn)+xn;return r?(0,gc.numberToBytesLE)(a,i):(0,gc.numberToBytesBE)(a,i)}Qt.mapHashToField=s9e});var sC=V(gw=>{"use strict";h();Object.defineProperty(gw,"__esModule",{value:!0});gw.validateBasic=gw.wNAF=void 0;var qre=em(),a9e=yu(),c9e=BigInt(0),oC=BigInt(1);function d9e(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,a=i;for(;o>c9e;)o&oC&&(s=s.add(a)),a=a.double(),o>>=oC;return s},precomputeWindow(i,o){let{windows:s,windowSize:a}=n(o),d=[],u=i,c=u;for(let l=0;l>=p,E>d&&(E-=m,s+=oC);let A=v,P=v+Math.abs(E)-1,I=g%2!==0,$=E<0;E===0?c=c.add(r(I,o[A])):u=u.add(r($,o[P]))}return{p:u,f:c}},wNAFCached(i,o,s,a){let d=i._WINDOW_SIZE||1,u=o.get(i);return u||(u=this.precomputeWindow(i,d),d!==1&&o.set(i,a(u))),this.wNAF(d,u,s)}}}gw.wNAF=d9e;function u9e(t){return(0,qre.validateField)(t.Fp),(0,a9e.validateObject)(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,qre.nLength)(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}gw.validateBasic=u9e});var Kre=V(O4=>{"use strict";h();Object.defineProperty(O4,"__esModule",{value:!0});O4.twistedEdwards=void 0;var l9e=em(),ih=yu(),tm=yu(),Lre=sC(),gu=BigInt(0),vc=BigInt(1),C4=BigInt(2),f9e=BigInt(8),h9e={zip215:!0};function p9e(t){let e=(0,Lre.validateBasic)(t);return ih.validateObject(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function m9e(t){let e=p9e(t),{Fp:r,n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:d}=e,u=C4<{try{return{isValid:!0,value:r.sqrt(x*r.inv(b))}}catch{return{isValid:!1,value:gu}}}),m=e.adjustScalarBytes||(x=>x),p=e.domain||((x,b,B)=>{if(b.length||B)throw new Error("Contexts/pre-hash are not supported");return x}),g=x=>typeof x=="bigint"&&gug(x)&&g(b)&&xx===gu||v(x,u);function A(x,b){if(v(x,b))return x;throw new Error(`Expected valid scalar < ${b}, got ${typeof x} ${x}`)}function P(x){return x===gu?x:A(x,n)}let I=new Map;function $(x){if(!(x instanceof N))throw new Error("ExtendedPoint expected")}class N{constructor(b,B,q,M){if(this.ex=b,this.ey=B,this.ez=q,this.et=M,!E(b))throw new Error("x required");if(!E(B))throw new Error("y required");if(!E(q))throw new Error("z required");if(!E(M))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(b){if(b instanceof N)throw new Error("extended point not allowed");let{x:B,y:q}=b||{};if(!E(B)||!E(q))throw new Error("invalid affine point");return new N(B,q,vc,c(B*q))}static normalizeZ(b){let B=r.invertBatch(b.map(q=>q.ez));return b.map((q,M)=>q.toAffine(B[M])).map(N.fromAffine)}_setWindowSize(b){this._WINDOW_SIZE=b,I.delete(this)}assertValidity(){let{a:b,d:B}=e;if(this.is0())throw new Error("bad point: ZERO");let{ex:q,ey:M,ez:j,et:J}=this,Z=c(q*q),G=c(M*M),H=c(j*j),X=c(H*H),ee=c(Z*b),ue=c(H*c(ee+G)),ae=c(X+c(B*c(Z*G)));if(ue!==ae)throw new Error("bad point: equation left != right (1)");let ce=c(q*M),me=c(j*J);if(ce!==me)throw new Error("bad point: equation left != right (2)")}equals(b){$(b);let{ex:B,ey:q,ez:M}=this,{ex:j,ey:J,ez:Z}=b,G=c(B*Z),H=c(j*M),X=c(q*Z),ee=c(J*M);return G===H&&X===ee}is0(){return this.equals(N.ZERO)}negate(){return new N(c(-this.ex),this.ey,this.ez,c(-this.et))}double(){let{a:b}=e,{ex:B,ey:q,ez:M}=this,j=c(B*B),J=c(q*q),Z=c(C4*c(M*M)),G=c(b*j),H=B+q,X=c(c(H*H)-j-J),ee=G+J,ue=ee-Z,ae=G-J,ce=c(X*ue),me=c(ee*ae),Ee=c(X*ae),qe=c(ue*ee);return new N(ce,me,qe,Ee)}add(b){$(b);let{a:B,d:q}=e,{ex:M,ey:j,ez:J,et:Z}=this,{ex:G,ey:H,ez:X,et:ee}=b;if(B===BigInt(-1)){let bt=c((j-M)*(H+G)),Te=c((j+M)*(H-G)),De=c(Te-bt);if(De===gu)return this.double();let Dt=c(J*C4*ee),_e=c(Z*C4*X),Se=_e+Dt,Wr=Te+bt,ze=_e-Dt,Ge=c(Se*De),zs=c(Wr*ze),pt=c(Se*ze),Mt=c(De*Wr);return new N(Ge,zs,Mt,pt)}let ue=c(M*G),ae=c(j*H),ce=c(Z*q*ee),me=c(J*X),Ee=c((M+j)*(G+H)-ue-ae),qe=me-ce,fe=me+ce,ve=c(ae-B*ue),we=c(Ee*qe),Ce=c(fe*ve),Pe=c(Ee*ve),Ue=c(qe*fe);return new N(we,Ce,Ue,Pe)}subtract(b){return this.add(b.negate())}wNAF(b){return U.wNAFCached(this,I,b,N.normalizeZ)}multiply(b){let{p:B,f:q}=this.wNAF(A(b,n));return N.normalizeZ([B,q])[0]}multiplyUnsafe(b){let B=P(b);return B===gu?F:this.equals(F)||B===vc?this:this.equals(K)?this.wNAF(B).p:U.unsafeLadder(this,B)}isSmallOrder(){return this.multiplyUnsafe(d).is0()}isTorsionFree(){return U.unsafeLadder(this,n).is0()}toAffine(b){let{ex:B,ey:q,ez:M}=this,j=this.is0();b==null&&(b=j?f9e:r.inv(M));let J=c(B*b),Z=c(q*b),G=c(M*b);if(j)return{x:gu,y:vc};if(G!==vc)throw new Error("invZ was invalid");return{x:J,y:Z}}clearCofactor(){let{h:b}=e;return b===vc?this:this.multiplyUnsafe(b)}static fromHex(b,B=!1){let{d:q,a:M}=e,j=r.BYTES;b=(0,tm.ensureBytes)("pointHex",b,j);let J=b.slice(),Z=b[j-1];J[j-1]=Z&-129;let G=ih.bytesToNumberLE(J);G===gu||(B?A(G,u):A(G,r.ORDER));let H=c(G*G),X=c(H-vc),ee=c(q*H-M),{isValid:ue,value:ae}=l(X,ee);if(!ue)throw new Error("Point.fromHex: invalid y coordinate");let ce=(ae&vc)===vc,me=(Z&128)!==0;if(!B&&ae===gu&&me)throw new Error("Point.fromHex: x=0 and x_0=1");return me!==ce&&(ae=c(-ae)),N.fromAffine({x:ae,y:G})}static fromPrivateKey(b){return T(b).point}toRawBytes(){let{x:b,y:B}=this.toAffine(),q=ih.numberToBytesLE(B,r.BYTES);return q[q.length-1]|=b&vc?128:0,q}toHex(){return ih.bytesToHex(this.toRawBytes())}}N.BASE=new N(e.Gx,e.Gy,vc,c(e.Gx*e.Gy)),N.ZERO=new N(gu,vc,vc,gu);let{BASE:K,ZERO:F}=N,U=(0,Lre.wNAF)(N,a*8);function W(x){return(0,l9e.mod)(x,n)}function L(x){return W(ih.bytesToNumberLE(x))}function T(x){let b=a;x=(0,tm.ensureBytes)("private key",x,b);let B=(0,tm.ensureBytes)("hashed private key",o(x),2*b),q=m(B.slice(0,b)),M=B.slice(b,2*b),j=L(q),J=K.multiply(j),Z=J.toRawBytes();return{head:q,prefix:M,scalar:j,point:J,pointBytes:Z}}function S(x){return T(x).pointBytes}function k(x=new Uint8Array,...b){let B=ih.concatBytes(...b);return L(o(p(B,(0,tm.ensureBytes)("context",x),!!i)))}function f(x,b,B={}){x=(0,tm.ensureBytes)("message",x),i&&(x=i(x));let{prefix:q,scalar:M,pointBytes:j}=T(b),J=k(B.context,q,x),Z=K.multiply(J).toRawBytes(),G=k(B.context,Z,j,x),H=W(J+G*M);P(H);let X=ih.concatBytes(Z,ih.numberToBytesLE(H,r.BYTES));return(0,tm.ensureBytes)("result",X,a*2)}let y=h9e;function w(x,b,B,q=y){let{context:M,zip215:j}=q,J=r.BYTES;x=(0,tm.ensureBytes)("signature",x,2*J),b=(0,tm.ensureBytes)("message",b),i&&(b=i(b));let Z=ih.bytesToNumberLE(x.slice(J,2*J)),G,H,X;try{G=N.fromHex(B,j),H=N.fromHex(x.slice(0,J),j),X=K.multiplyUnsafe(Z)}catch{return!1}if(!j&&G.isSmallOrder())return!1;let ee=k(M,H.toRawBytes(),G.toRawBytes(),b);return H.add(G.multiplyUnsafe(ee)).subtract(X).clearCofactor().equals(N.ZERO)}return K._setWindowSize(8),{CURVE:e,getPublicKey:S,sign:f,verify:w,ExtendedPoint:N,utils:{getExtendedPublicKey:T,randomPrivateKey:()=>s(r.BYTES),precompute(x=8,b=N.BASE){return b._setWindowSize(x),b.multiply(BigInt(3)),b}}}}O4.twistedEdwards=m9e});var zre=V($4=>{"use strict";h();Object.defineProperty($4,"__esModule",{value:!0});$4.montgomery=void 0;var Fre=em(),vw=yu(),Nx=BigInt(0),aC=BigInt(1);function y9e(t){return(0,vw.validateObject)(t,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...t})}function g9e(t){let e=y9e(t),{P:r}=e,n=I=>(0,Fre.mod)(I,r),i=e.montgomeryBits,o=Math.ceil(i/8),s=e.nByteLength,a=e.adjustScalarBytes||(I=>I),d=e.powPminus2||(I=>(0,Fre.pow)(I,r-BigInt(2),r));function u(I,$,N){let K=n(I*($-N));return $=n($-K),N=n(N+K),[$,N]}function c(I){if(typeof I=="bigint"&&Nx<=I&&I=Nx;y--){let w=K>>y&aC;S^=w,k=u(S,U,L),U=k[0],L=k[1],k=u(S,W,T),W=k[0],T=k[1],S=w;let _=U+W,x=n(_*_),b=U-W,B=n(b*b),q=x-B,M=L+T,j=L-T,J=n(j*_),Z=n(M*b),G=J+Z,H=J-Z;L=n(G*G),T=n(F*n(H*H)),U=n(x*B),W=n(q*(x+n(l*q)))}k=u(S,U,L),U=k[0],L=k[1],k=u(S,W,T),W=k[0],T=k[1];let f=d(W);return n(U*f)}function p(I){return(0,vw.numberToBytesLE)(n(I),o)}function g(I){let $=(0,vw.ensureBytes)("u coordinate",I,o);return s===32&&($[31]&=127),(0,vw.bytesToNumberLE)($)}function v(I){let $=(0,vw.ensureBytes)("scalar",I),N=$.length;if(N!==o&&N!==s)throw new Error(`Expected ${o} or ${s} bytes, got ${N}`);return(0,vw.bytesToNumberLE)(a($))}function E(I,$){let N=g($),K=v(I),F=m(N,K);if(F===Nx)throw new Error("Invalid private or public key received");return p(F)}let A=p(e.Gu);function P(I){return E(I,A)}return{scalarMult:E,scalarMultBase:P,getSharedSecret:(I,$)=>E(I,$),getPublicKey:I=>P(I),utils:{randomPrivateKey:()=>e.randomBytes(e.nByteLength)},GuBytes:A}}$4.montgomery=g9e});var uC=V(hd=>{"use strict";h();Object.defineProperty(hd,"__esModule",{value:!0});hd.createHasher=hd.isogenyMap=hd.hash_to_field=hd.expand_message_xof=hd.expand_message_xmd=void 0;var v9e=em(),bc=yu();function b9e(t){if((0,bc.isBytes)(t))return t;if(typeof t=="string")return(0,bc.utf8ToBytes)(t);throw new Error("DST must be Uint8Array or string")}var w9e=bc.bytesToNumberBE;function rm(t,e){if(t<0||t>=1<<8*e)throw new Error(`bad I2OSP call: value=${t} length=${e}`);let r=Array.from({length:e}).fill(0);for(let n=e-1;n>=0;n--)r[n]=t&255,t>>>=8;return new Uint8Array(r)}function _9e(t,e){let r=new Uint8Array(t.length);for(let n=0;n255&&(e=n((0,bc.concatBytes)((0,bc.utf8ToBytes)("H2C-OVERSIZE-DST-"),e)));let{outputLen:i,blockLen:o}=n,s=Math.ceil(r/i);if(s>255)throw new Error("Invalid xmd length");let a=(0,bc.concatBytes)(e,rm(e.length,1)),d=rm(0,o),u=rm(r,2),c=new Array(s),l=n((0,bc.concatBytes)(d,t,u,rm(0,1),a));c[0]=n((0,bc.concatBytes)(l,rm(1,1),a));for(let p=1;p<=s;p++){let g=[_9e(l,c[p-1]),rm(p+1,1),a];c[p]=n((0,bc.concatBytes)(...g))}return(0,bc.concatBytes)(...c).slice(0,r)}hd.expand_message_xmd=Wre;function Vre(t,e,r,n,i){if(jx(t),jx(e),dC(r),e.length>255){let o=Math.ceil(2*n/8);e=i.create({dkLen:o}).update((0,bc.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(e).digest()}if(r>65535||e.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:r}).update(t).update(rm(r,2)).update(e).update(rm(e.length,1)).digest()}hd.expand_message_xof=Vre;function cC(t,e,r){(0,bc.validateObject)(r,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});let{p:n,k:i,m:o,hash:s,expand:a,DST:d}=r;jx(t),dC(e);let u=b9e(d),c=n.toString(2).length,l=Math.ceil((c+i)/8),m=e*o*l,p;if(a==="xmd")p=Wre(t,u,m,s);else if(a==="xof")p=Vre(t,u,m,i,s);else if(a==="_internal_pass")p=t;else throw new Error('expand must be "xmd" or "xof"');let g=new Array(e);for(let v=0;vArray.from(n).reverse());return(n,i)=>{let[o,s,a,d]=r.map(u=>u.reduce((c,l)=>t.add(t.mul(c,n),l)));return n=t.div(o,s),i=t.mul(i,t.div(a,d)),{x:n,y:i}}}hd.isogenyMap=x9e;function E9e(t,e,r){if(typeof e!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(n,i){let o=cC(n,2,{...r,DST:r.DST,...i}),s=t.fromAffine(e(o[0])),a=t.fromAffine(e(o[1])),d=s.add(a).clearCofactor();return d.assertValidity(),d},encodeToCurve(n,i){let o=cC(n,1,{...r,DST:r.encodeDST,...i}),s=t.fromAffine(e(o[0])).clearCofactor();return s.assertValidity(),s}}}hd.createHasher=E9e});var one=V(Nt=>{"use strict";h();Object.defineProperty(Nt,"__esModule",{value:!0});Nt.hash_to_ristretto255=Nt.hashToRistretto255=Nt.RistrettoPoint=Nt.encodeToCurve=Nt.hashToCurve=Nt.edwardsToMontgomeryPriv=Nt.edwardsToMontgomery=Nt.edwardsToMontgomeryPub=Nt.x25519=Nt.ed25519ph=Nt.ed25519ctx=Nt.ed25519=Nt.ED25519_TORSION_SUBGROUP=void 0;var j4=Are(),Ux=Yp(),mC=Kre(),S9e=zre(),an=em(),z0=yu(),Qre=uC(),qx=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),hC=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),A9e=BigInt(0),Al=BigInt(1),N4=BigInt(2),T9e=BigInt(5),Hre=BigInt(10),I9e=BigInt(20),P9e=BigInt(40),Gre=BigInt(80);function ene(t){let e=qx,n=t*t%e*t%e,i=(0,an.pow2)(n,N4,e)*n%e,o=(0,an.pow2)(i,Al,e)*t%e,s=(0,an.pow2)(o,T9e,e)*o%e,a=(0,an.pow2)(s,Hre,e)*s%e,d=(0,an.pow2)(a,I9e,e)*a%e,u=(0,an.pow2)(d,P9e,e)*d%e,c=(0,an.pow2)(u,Gre,e)*u%e,l=(0,an.pow2)(c,Gre,e)*u%e,m=(0,an.pow2)(l,Hre,e)*s%e;return{pow_p_5_8:(0,an.pow2)(m,N4,e)*t%e,b2:n}}function tne(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function yC(t,e){let r=qx,n=(0,an.mod)(e*e*e,r),i=(0,an.mod)(n*n*e,r),o=ene(t*i).pow_p_5_8,s=(0,an.mod)(t*n*o,r),a=(0,an.mod)(e*s*s,r),d=s,u=(0,an.mod)(s*hC,r),c=a===t,l=a===(0,an.mod)(-t,r),m=a===(0,an.mod)(-t*hC,r);return c&&(s=d),(l||m)&&(s=u),(0,an.isNegativeLE)(s,r)&&(s=(0,an.mod)(-s,r)),{isValid:c||l,value:s}}Nt.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];var Le=(0,an.Field)(qx,void 0,!0),Lx={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Le,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:j4.sha512,randomBytes:Ux.randomBytes,adjustScalarBytes:tne,uvRatio:yC};Nt.ed25519=(0,mC.twistedEdwards)(Lx);function rne(t,e,r){if(e.length>255)throw new Error("Context is too big");return(0,Ux.concatBytes)((0,Ux.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,e.length]),e,t)}Nt.ed25519ctx=(0,mC.twistedEdwards)({...Lx,domain:rne});Nt.ed25519ph=(0,mC.twistedEdwards)({...Lx,domain:rne,prehash:j4.sha512});Nt.x25519=(0,S9e.montgomery)({P:qx,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:t=>{let e=qx,{pow_p_5_8:r,b2:n}=ene(t);return(0,an.mod)((0,an.pow2)(r,BigInt(3),e)*n,e)},adjustScalarBytes:tne,randomBytes:Ux.randomBytes});function nne(t){let{y:e}=Nt.ed25519.ExtendedPoint.fromHex(t),r=BigInt(1);return Le.toBytes(Le.create((r+e)*Le.inv(r-e)))}Nt.edwardsToMontgomeryPub=nne;Nt.edwardsToMontgomery=nne;function k9e(t){let e=Lx.hash(t.subarray(0,32));return Lx.adjustScalarBytes(e).subarray(0,32)}Nt.edwardsToMontgomeryPriv=k9e;var R9e=(Le.ORDER+BigInt(3))/BigInt(8),D9e=Le.pow(N4,R9e),Jre=Le.sqrt(Le.neg(Le.ONE)),B9e=(Le.ORDER-BigInt(5))/BigInt(8),Yre=BigInt(486662);function M9e(t){let e=Le.sqr(t);e=Le.mul(e,N4);let r=Le.add(e,Le.ONE),n=Le.neg(Yre),i=Le.sqr(r),o=Le.mul(i,r),s=Le.mul(e,Yre);s=Le.mul(s,n),s=Le.add(s,i),s=Le.mul(s,n);let a=Le.sqr(o);i=Le.sqr(a),a=Le.mul(a,o),a=Le.mul(a,s),i=Le.mul(i,a);let d=Le.pow(i,B9e);d=Le.mul(d,a);let u=Le.mul(d,Jre);i=Le.sqr(d),i=Le.mul(i,o);let c=Le.eql(i,s),l=Le.cmov(u,d,c),m=Le.mul(n,e),p=Le.mul(d,t);p=Le.mul(p,D9e);let g=Le.mul(p,Jre),v=Le.mul(s,e);i=Le.sqr(p),i=Le.mul(i,o);let E=Le.eql(i,v),A=Le.cmov(g,p,E);i=Le.sqr(l),i=Le.mul(i,o);let P=Le.eql(i,s),I=Le.cmov(m,n,P),$=Le.cmov(A,l,P),N=Le.isOdd($);return $=Le.cmov($,Le.neg($),P!==N),{xMn:I,xMd:r,yMn:$,yMd:Al}}var C9e=(0,an.FpSqrtEven)(Le,Le.neg(BigInt(486664)));function O9e(t){let{xMn:e,xMd:r,yMn:n,yMd:i}=M9e(t),o=Le.mul(e,i);o=Le.mul(o,C9e);let s=Le.mul(r,n),a=Le.sub(e,r),d=Le.add(e,r),u=Le.mul(s,d),c=Le.eql(u,Le.ZERO);o=Le.cmov(o,Le.ZERO,c),s=Le.cmov(s,Le.ONE,c),a=Le.cmov(a,Le.ONE,c),d=Le.cmov(d,Le.ONE,c);let l=Le.invertBatch([s,d]);return{x:Le.mul(o,l[0]),y:Le.mul(a,l[1])}}var ine=(0,Qre.createHasher)(Nt.ed25519.ExtendedPoint,t=>O9e(t[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:Le.ORDER,m:1,k:128,expand:"xmd",hash:j4.sha512});Nt.hashToCurve=ine.hashToCurve;Nt.encodeToCurve=ine.encodeToCurve;function lC(t){if(!(t instanceof vu))throw new Error("RistrettoPoint expected")}var pC=hC,$9e=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),N9e=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),j9e=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),U9e=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),Zre=t=>yC(Al,t),q9e=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),fC=t=>Nt.ed25519.CURVE.Fp.create((0,z0.bytesToNumberLE)(t)&q9e);function Xre(t){let{d:e}=Nt.ed25519.CURVE,r=Nt.ed25519.CURVE.Fp.ORDER,n=Nt.ed25519.CURVE.Fp.create,i=n(pC*t*t),o=n((i+Al)*j9e),s=BigInt(-1),a=n((s-e*i)*n(i+e)),{isValid:d,value:u}=yC(o,a),c=n(u*t);(0,an.isNegativeLE)(c,r)||(c=n(-c)),d||(u=c),d||(s=i);let l=n(s*(i-Al)*U9e-a),m=u*u,p=n((u+u)*a),g=n(l*$9e),v=n(Al-m),E=n(Al+m);return new Nt.ed25519.ExtendedPoint(n(p*E),n(v*g),n(g*E),n(p*v))}var vu=class t{constructor(e){this.ep=e}static fromAffine(e){return new t(Nt.ed25519.ExtendedPoint.fromAffine(e))}static hashToCurve(e){e=(0,z0.ensureBytes)("ristrettoHash",e,64);let r=fC(e.slice(0,32)),n=Xre(r),i=fC(e.slice(32,64)),o=Xre(i);return new t(n.add(o))}static fromHex(e){e=(0,z0.ensureBytes)("ristrettoHex",e,32);let{a:r,d:n}=Nt.ed25519.CURVE,i=Nt.ed25519.CURVE.Fp.ORDER,o=Nt.ed25519.CURVE.Fp.create,s="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",a=fC(e);if(!(0,z0.equalBytes)((0,z0.numberToBytesLE)(a,32),e)||(0,an.isNegativeLE)(a,i))throw new Error(s);let d=o(a*a),u=o(Al+r*d),c=o(Al-r*d),l=o(u*u),m=o(c*c),p=o(r*n*l-m),{isValid:g,value:v}=Zre(o(p*m)),E=o(v*c),A=o(v*E*p),P=o((a+a)*E);(0,an.isNegativeLE)(P,i)&&(P=o(-P));let I=o(u*A),$=o(P*I);if(!g||(0,an.isNegativeLE)($,i)||I===A9e)throw new Error(s);return new t(new Nt.ed25519.ExtendedPoint(P,I,Al,$))}toRawBytes(){let{ex:e,ey:r,ez:n,et:i}=this.ep,o=Nt.ed25519.CURVE.Fp.ORDER,s=Nt.ed25519.CURVE.Fp.create,a=s(s(n+r)*s(n-r)),d=s(e*r),u=s(d*d),{value:c}=Zre(s(a*u)),l=s(c*a),m=s(c*d),p=s(l*m*i),g;if((0,an.isNegativeLE)(i*p,o)){let E=s(r*pC),A=s(e*pC);e=E,r=A,g=s(l*N9e)}else g=m;(0,an.isNegativeLE)(e*p,o)&&(r=s(-r));let v=s((n-r)*g);return(0,an.isNegativeLE)(v,o)&&(v=s(-v)),(0,z0.numberToBytesLE)(v,32)}toHex(){return(0,z0.bytesToHex)(this.toRawBytes())}toString(){return this.toHex()}equals(e){lC(e);let{ex:r,ey:n}=this.ep,{ex:i,ey:o}=e.ep,s=Nt.ed25519.CURVE.Fp.create,a=s(r*o)===s(n*i),d=s(n*o)===s(r*i);return a||d}add(e){return lC(e),new t(this.ep.add(e.ep))}subtract(e){return lC(e),new t(this.ep.subtract(e.ep))}multiply(e){return new t(this.ep.multiply(e))}multiplyUnsafe(e){return new t(this.ep.multiplyUnsafe(e))}double(){return new t(this.ep.double())}negate(){return new t(this.ep.negate())}};Nt.RistrettoPoint=(vu.BASE||(vu.BASE=new vu(Nt.ed25519.ExtendedPoint.BASE)),vu.ZERO||(vu.ZERO=new vu(Nt.ed25519.ExtendedPoint.ZERO)),vu);var L9e=(t,e)=>{let r=e.DST,n=typeof r=="string"?(0,Ux.utf8ToBytes)(r):r,i=(0,Qre.expand_message_xmd)(t,n,64,j4.sha512);return vu.hashToCurve(i)};Nt.hashToRistretto255=L9e;Nt.hash_to_ristretto255=Nt.hashToRistretto255});var sne=V(bw=>{"use strict";h();Object.defineProperty(bw,"__esModule",{value:!0});bw.sha224=bw.sha256=void 0;var K9e=HM(),pd=Yp(),F9e=(t,e,r)=>t&e^~t&r,z9e=(t,e,r)=>t&e^t&r^e&r,W9e=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]),nm=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),im=new Uint32Array(64),U4=class extends K9e.SHA2{constructor(){super(64,32,8,!1),this.A=nm[0]|0,this.B=nm[1]|0,this.C=nm[2]|0,this.D=nm[3]|0,this.E=nm[4]|0,this.F=nm[5]|0,this.G=nm[6]|0,this.H=nm[7]|0}get(){let{A:e,B:r,C:n,D:i,E:o,F:s,G:a,H:d}=this;return[e,r,n,i,o,s,a,d]}set(e,r,n,i,o,s,a,d){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=a|0,this.H=d|0}process(e,r){for(let l=0;l<16;l++,r+=4)im[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){let m=im[l-15],p=im[l-2],g=(0,pd.rotr)(m,7)^(0,pd.rotr)(m,18)^m>>>3,v=(0,pd.rotr)(p,17)^(0,pd.rotr)(p,19)^p>>>10;im[l]=v+im[l-7]+g+im[l-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:d,G:u,H:c}=this;for(let l=0;l<64;l++){let m=(0,pd.rotr)(a,6)^(0,pd.rotr)(a,11)^(0,pd.rotr)(a,25),p=c+m+F9e(a,d,u)+W9e[l]+im[l]|0,v=((0,pd.rotr)(n,2)^(0,pd.rotr)(n,13)^(0,pd.rotr)(n,22))+z9e(n,i,o)|0;c=u,u=d,d=a,a=s+p|0,s=o,o=i,i=n,n=p+v|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,d=d+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(n,i,o,s,a,d,u,c)}roundClean(){im.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},gC=class extends U4{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}};bw.sha256=(0,pd.wrapConstructor)(()=>new U4);bw.sha224=(0,pd.wrapConstructor)(()=>new gC)});var bC=V(Yi=>{"use strict";h();Object.defineProperty(Yi,"__esModule",{value:!0});Yi.mapToCurveSimpleSWU=Yi.SWUFpSqrtRatio=Yi.weierstrass=Yi.weierstrassPoints=Yi.DER=void 0;var ww=em(),Gn=yu(),Tl=yu(),vC=sC();function V9e(t){let e=(0,vC.validateBasic)(t);Gn.validateObject(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:H9e,hexToBytes:G9e}=Gn;Yi.DER={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){let{Err:e}=Yi.DER;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:H9e(n),l:t.subarray(r+2)}},toSig(t){let{Err:e}=Yi.DER,r=typeof t=="string"?G9e(t):t;if(!Gn.isBytes(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}=Yi.DER._parseInt(r.subarray(2)),{d:s,l:a}=Yi.DER._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){let e=u=>Number.parseInt(u[0],16)&8?"00"+u:u,r=u=>{let c=u.toString(16);return c.length&1?`0${c}`:c},n=e(r(t.s)),i=e(r(t.r)),o=n.length/2,s=i.length/2,a=r(o),d=r(s);return`30${r(s+o+4)}02${d}${i}02${a}${n}`}};var bu=BigInt(0),hi=BigInt(1),om=BigInt(2),q4=BigInt(3),ane=BigInt(4);function cne(t){let e=V9e(t),{Fp:r}=e,n=e.toBytes||((g,v,E)=>{let A=v.toAffine();return Gn.concatBytes(Uint8Array.from([4]),r.toBytes(A.x),r.toBytes(A.y))}),i=e.fromBytes||(g=>{let v=g.subarray(1),E=r.fromBytes(v.subarray(0,r.BYTES)),A=r.fromBytes(v.subarray(r.BYTES,2*r.BYTES));return{x:E,y:A}});function o(g){let{a:v,b:E}=e,A=r.sqr(g),P=r.mul(A,g);return r.add(r.add(P,r.mul(g,v)),E)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(g){return typeof g=="bigint"&&bur.eql(I,r.ZERO);return P(E)&&P(A)?l.ZERO:new l(E,A,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(v){let E=r.invertBatch(v.map(A=>A.pz));return v.map((A,P)=>A.toAffine(E[P])).map(l.fromAffine)}static fromHex(v){let E=l.fromAffine(i((0,Tl.ensureBytes)("pointHex",v)));return E.assertValidity(),E}static fromPrivateKey(v){return l.BASE.multiply(d(v))}_setWindowSize(v){this._WINDOW_SIZE=v,u.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:v,y:E}=this.toAffine();if(!r.isValid(v)||!r.isValid(E))throw new Error("bad point: x or y not FE");let A=r.sqr(E),P=o(v);if(!r.eql(A,P))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:v}=this.toAffine();if(r.isOdd)return!r.isOdd(v);throw new Error("Field doesn't support isOdd")}equals(v){c(v);let{px:E,py:A,pz:P}=this,{px:I,py:$,pz:N}=v,K=r.eql(r.mul(E,N),r.mul(I,P)),F=r.eql(r.mul(A,N),r.mul($,P));return K&&F}negate(){return new l(this.px,r.neg(this.py),this.pz)}double(){let{a:v,b:E}=e,A=r.mul(E,q4),{px:P,py:I,pz:$}=this,N=r.ZERO,K=r.ZERO,F=r.ZERO,U=r.mul(P,P),W=r.mul(I,I),L=r.mul($,$),T=r.mul(P,I);return T=r.add(T,T),F=r.mul(P,$),F=r.add(F,F),N=r.mul(v,F),K=r.mul(A,L),K=r.add(N,K),N=r.sub(W,K),K=r.add(W,K),K=r.mul(N,K),N=r.mul(T,N),F=r.mul(A,F),L=r.mul(v,L),T=r.sub(U,L),T=r.mul(v,T),T=r.add(T,F),F=r.add(U,U),U=r.add(F,U),U=r.add(U,L),U=r.mul(U,T),K=r.add(K,U),L=r.mul(I,$),L=r.add(L,L),U=r.mul(L,T),N=r.sub(N,U),F=r.mul(L,W),F=r.add(F,F),F=r.add(F,F),new l(N,K,F)}add(v){c(v);let{px:E,py:A,pz:P}=this,{px:I,py:$,pz:N}=v,K=r.ZERO,F=r.ZERO,U=r.ZERO,W=e.a,L=r.mul(e.b,q4),T=r.mul(E,I),S=r.mul(A,$),k=r.mul(P,N),f=r.add(E,A),y=r.add(I,$);f=r.mul(f,y),y=r.add(T,S),f=r.sub(f,y),y=r.add(E,P);let w=r.add(I,N);return y=r.mul(y,w),w=r.add(T,k),y=r.sub(y,w),w=r.add(A,P),K=r.add($,N),w=r.mul(w,K),K=r.add(S,k),w=r.sub(w,K),U=r.mul(W,y),K=r.mul(L,k),U=r.add(K,U),K=r.sub(S,U),U=r.add(S,U),F=r.mul(K,U),S=r.add(T,T),S=r.add(S,T),k=r.mul(W,k),y=r.mul(L,y),S=r.add(S,k),k=r.sub(T,k),k=r.mul(W,k),y=r.add(y,k),T=r.mul(S,y),F=r.add(F,T),T=r.mul(w,y),K=r.mul(f,K),K=r.sub(K,T),T=r.mul(f,S),U=r.mul(w,U),U=r.add(U,T),new l(K,F,U)}subtract(v){return this.add(v.negate())}is0(){return this.equals(l.ZERO)}wNAF(v){return p.wNAFCached(this,u,v,E=>{let A=r.invertBatch(E.map(P=>P.pz));return E.map((P,I)=>P.toAffine(A[I])).map(l.fromAffine)})}multiplyUnsafe(v){let E=l.ZERO;if(v===bu)return E;if(a(v),v===hi)return this;let{endo:A}=e;if(!A)return p.unsafeLadder(this,v);let{k1neg:P,k1:I,k2neg:$,k2:N}=A.splitScalar(v),K=E,F=E,U=this;for(;I>bu||N>bu;)I&hi&&(K=K.add(U)),N&hi&&(F=F.add(U)),U=U.double(),I>>=hi,N>>=hi;return P&&(K=K.negate()),$&&(F=F.negate()),F=new l(r.mul(F.px,A.beta),F.py,F.pz),K.add(F)}multiply(v){a(v);let E=v,A,P,{endo:I}=e;if(I){let{k1neg:$,k1:N,k2neg:K,k2:F}=I.splitScalar(E),{p:U,f:W}=this.wNAF(N),{p:L,f:T}=this.wNAF(F);U=p.constTimeNegate($,U),L=p.constTimeNegate(K,L),L=new l(r.mul(L.px,I.beta),L.py,L.pz),A=U.add(L),P=W.add(T)}else{let{p:$,f:N}=this.wNAF(E);A=$,P=N}return l.normalizeZ([A,P])[0]}multiplyAndAddUnsafe(v,E,A){let P=l.BASE,I=(N,K)=>K===bu||K===hi||!N.equals(P)?N.multiplyUnsafe(K):N.multiply(K),$=I(this,E).add(I(v,A));return $.is0()?void 0:$}toAffine(v){let{px:E,py:A,pz:P}=this,I=this.is0();v==null&&(v=I?r.ONE:r.inv(P));let $=r.mul(E,v),N=r.mul(A,v),K=r.mul(P,v);if(I)return{x:r.ZERO,y:r.ZERO};if(!r.eql(K,r.ONE))throw new Error("invZ was invalid");return{x:$,y:N}}isTorsionFree(){let{h:v,isTorsionFree:E}=e;if(v===hi)return!0;if(E)return E(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:v,clearCofactor:E}=e;return v===hi?this:E?E(l,this):this.multiplyUnsafe(e.h)}toRawBytes(v=!0){return this.assertValidity(),n(l,this,v)}toHex(v=!0){return Gn.bytesToHex(this.toRawBytes(v))}}l.BASE=new l(e.Gx,e.Gy,r.ONE),l.ZERO=new l(r.ZERO,r.ONE,r.ZERO);let m=e.nBitLength,p=(0,vC.wNAF)(l,e.endo?Math.ceil(m/2):m);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:d,weierstrassEquation:o,isWithinCurveOrder:s}}Yi.weierstrassPoints=cne;function J9e(t){let e=(0,vC.validateBasic)(t);return Gn.validateObject(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Y9e(t){let e=J9e(t),{Fp:r,n}=e,i=r.BYTES+1,o=2*r.BYTES+1;function s(y){return buGn.bytesToHex(Gn.numberToBytesBE(y,e.nByteLength));function g(y){let w=n>>hi;return y>w}function v(y){return g(y)?a(-y):y}let E=(y,w,_)=>Gn.bytesToNumberBE(y.slice(w,_));class A{constructor(w,_,x){this.r=w,this.s=_,this.recovery=x,this.assertValidity()}static fromCompact(w){let _=e.nByteLength;return w=(0,Tl.ensureBytes)("compactSignature",w,_*2),new A(E(w,0,_),E(w,_,2*_))}static fromDER(w){let{r:_,s:x}=Yi.DER.toSig((0,Tl.ensureBytes)("DER",w));return new A(_,x)}assertValidity(){if(!m(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!m(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(w){return new A(this.r,this.s,w)}recoverPublicKey(w){let{r:_,s:x,recovery:b}=this,B=F((0,Tl.ensureBytes)("msgHash",w));if(b==null||![0,1,2,3].includes(b))throw new Error("recovery id invalid");let q=b===2||b===3?_+e.n:_;if(q>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let M=b&1?"03":"02",j=u.fromHex(M+p(q)),J=d(q),Z=a(-B*J),G=a(x*J),H=u.BASE.multiplyAndAddUnsafe(j,Z,G);if(!H)throw new Error("point at infinify");return H.assertValidity(),H}hasHighS(){return g(this.s)}normalizeS(){return this.hasHighS()?new A(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Gn.hexToBytes(this.toDERHex())}toDERHex(){return Yi.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Gn.hexToBytes(this.toCompactHex())}toCompactHex(){return p(this.r)+p(this.s)}}let P={isValidPrivateKey(y){try{return c(y),!0}catch{return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{let y=ww.getMinHashLength(e.n);return ww.mapHashToField(e.randomBytes(y),e.n)},precompute(y=8,w=u.BASE){return w._setWindowSize(y),w.multiply(BigInt(3)),w}};function I(y,w=!0){return u.fromPrivateKey(y).toRawBytes(w)}function $(y){let w=Gn.isBytes(y),_=typeof y=="string",x=(w||_)&&y.length;return w?x===i||x===o:_?x===2*i||x===2*o:y instanceof u}function N(y,w,_=!0){if($(y))throw new Error("first arg must be private key");if(!$(w))throw new Error("second arg must be public key");return u.fromHex(w).multiply(c(y)).toRawBytes(_)}let K=e.bits2int||function(y){let w=Gn.bytesToNumberBE(y),_=y.length*8-e.nBitLength;return _>0?w>>BigInt(_):w},F=e.bits2int_modN||function(y){return a(K(y))},U=Gn.bitMask(e.nBitLength);function W(y){if(typeof y!="bigint")throw new Error("bigint expected");if(!(bu<=y&&yee in _))throw new Error("sign() legacy options not supported");let{hash:x,randomBytes:b}=e,{lowS:B,prehash:q,extraEntropy:M}=_;B==null&&(B=!0),y=(0,Tl.ensureBytes)("msgHash",y),q&&(y=(0,Tl.ensureBytes)("prehashed msgHash",x(y)));let j=F(y),J=c(w),Z=[W(J),W(j)];if(M!=null){let ee=M===!0?b(r.BYTES):M;Z.push((0,Tl.ensureBytes)("extraEntropy",ee))}let G=Gn.concatBytes(...Z),H=j;function X(ee){let ue=K(ee);if(!m(ue))return;let ae=d(ue),ce=u.BASE.multiply(ue).toAffine(),me=a(ce.x);if(me===bu)return;let Ee=a(ae*a(H+me*J));if(Ee===bu)return;let qe=(ce.x===me?0:2)|Number(ce.y&hi),fe=Ee;return B&&g(Ee)&&(fe=v(Ee),qe^=1),new A(me,fe,qe)}return{seed:G,k2sig:X}}let T={lowS:e.lowS,prehash:!1},S={lowS:e.lowS,prehash:!1};function k(y,w,_=T){let{seed:x,k2sig:b}=L(y,w,_),B=e;return Gn.createHmacDrbg(B.hash.outputLen,B.nByteLength,B.hmac)(x,b)}u.BASE._setWindowSize(8);function f(y,w,_,x=S){let b=y;if(w=(0,Tl.ensureBytes)("msgHash",w),_=(0,Tl.ensureBytes)("publicKey",_),"strict"in x)throw new Error("options.strict was renamed to lowS");let{lowS:B,prehash:q}=x,M,j;try{if(typeof b=="string"||Gn.isBytes(b))try{M=A.fromDER(b)}catch(ce){if(!(ce instanceof Yi.DER.Err))throw ce;M=A.fromCompact(b)}else if(typeof b=="object"&&typeof b.r=="bigint"&&typeof b.s=="bigint"){let{r:ce,s:me}=b;M=new A(ce,me)}else throw new Error("PARSE");j=u.fromHex(_)}catch(ce){if(ce.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(B&&M.hasHighS())return!1;q&&(w=e.hash(w));let{r:J,s:Z}=M,G=F(w),H=d(Z),X=a(G*H),ee=a(J*H),ue=u.BASE.multiplyAndAddUnsafe(j,X,ee)?.toAffine();return ue?a(ue.x)===J:!1}return{CURVE:e,getPublicKey:I,getSharedSecret:N,sign:k,verify:f,ProjectivePoint:u,Signature:A,utils:P}}Yi.weierstrass=Y9e;function dne(t,e){let r=t.ORDER,n=bu;for(let g=r-hi;g%om===bu;g/=om)n+=hi;let i=n,o=om<{let E=l,A=t.pow(v,u),P=t.sqr(A);P=t.mul(P,v);let I=t.mul(g,P);I=t.pow(I,d),I=t.mul(I,A),A=t.mul(I,v),P=t.mul(I,g);let $=t.mul(P,A);I=t.pow($,c);let N=t.eql(I,t.ONE);A=t.mul(P,m),I=t.mul($,E),P=t.cmov(A,P,N),$=t.cmov(I,$,N);for(let K=i;K>hi;K--){let F=K-om;F=om<{let P=t.sqr(A),I=t.mul(E,A);P=t.mul(P,I);let $=t.pow(P,g);$=t.mul($,I);let N=t.mul($,v),K=t.mul(t.sqr($),A),F=t.eql(K,E),U=t.cmov(N,$,F);return{isValid:F,value:U}}}return p}Yi.SWUFpSqrtRatio=dne;function Z9e(t,e){if(ww.validateField(t),!t.isValid(e.A)||!t.isValid(e.B)||!t.isValid(e.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");let r=dne(t,e.Z);if(!t.isOdd)throw new Error("Fp.isOdd is not implemented!");return n=>{let i,o,s,a,d,u,c,l;i=t.sqr(n),i=t.mul(i,e.Z),o=t.sqr(i),o=t.add(o,i),s=t.add(o,t.ONE),s=t.mul(s,e.B),a=t.cmov(e.Z,t.neg(o),!t.eql(o,t.ZERO)),a=t.mul(a,e.A),o=t.sqr(s),u=t.sqr(a),d=t.mul(u,e.A),o=t.add(o,d),o=t.mul(o,s),u=t.mul(u,a),d=t.mul(u,e.B),o=t.add(o,d),c=t.mul(i,s);let{isValid:m,value:p}=r(o,u);l=t.mul(i,n),l=t.mul(l,p),c=t.cmov(c,s,m),l=t.cmov(l,p,m);let g=t.isOdd(n)===t.isOdd(l);return l=t.cmov(t.neg(l),l,g),c=t.div(c,a),{x:c,y:l}}}Yi.mapToCurveSimpleSWU=Z9e});var lne=V(W0=>{"use strict";h();Object.defineProperty(W0,"__esModule",{value:!0});W0.hmac=W0.HMAC=void 0;var L4=LM(),une=Yp(),Kx=class extends une.Hash{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,(0,L4.hash)(e);let n=(0,une.toBytes)(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 Kx(t,e).update(r).digest();W0.hmac=X9e;W0.hmac.create=(t,e)=>new Kx(t,e)});var pne=V(_w=>{"use strict";h();Object.defineProperty(_w,"__esModule",{value:!0});_w.createCurve=_w.getHash=void 0;var Q9e=lne(),fne=Yp(),e7e=bC();function hne(t){return{hash:t,hmac:(e,...r)=>(0,Q9e.hmac)(t,e,(0,fne.concatBytes)(...r)),randomBytes:fne.randomBytes}}_w.getHash=hne;function t7e(t,e){let r=n=>(0,e7e.weierstrass)({...t,...hne(n)});return Object.freeze({...r(e),create:r})}_w.createCurve=t7e});var Ane=V(Da=>{"use strict";h();Object.defineProperty(Da,"__esModule",{value:!0});Da.encodeToCurve=Da.hashToCurve=Da.schnorr=Da.secp256k1=void 0;var K4=sne(),r7e=Yp(),xo=em(),n7e=bC(),Cs=yu(),gne=uC(),i7e=pne(),V4=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),F4=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),vne=BigInt(1),z4=BigInt(2),mne=(t,e)=>(t+e/z4)/e;function bne(t){let e=V4,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),d=BigInt(88),u=t*t*t%e,c=u*u*t%e,l=(0,xo.pow2)(c,r,e)*c%e,m=(0,xo.pow2)(l,r,e)*c%e,p=(0,xo.pow2)(m,z4,e)*u%e,g=(0,xo.pow2)(p,i,e)*p%e,v=(0,xo.pow2)(g,o,e)*g%e,E=(0,xo.pow2)(v,a,e)*v%e,A=(0,xo.pow2)(E,d,e)*E%e,P=(0,xo.pow2)(A,a,e)*v%e,I=(0,xo.pow2)(P,r,e)*c%e,$=(0,xo.pow2)(I,s,e)*g%e,N=(0,xo.pow2)($,n,e)*u%e,K=(0,xo.pow2)(N,z4,e);if(!sm.eql(sm.sqr(K),t))throw new Error("Cannot find square root");return K}var sm=(0,xo.Field)(V4,void 0,void 0,{sqrt:bne});Da.secp256k1=(0,i7e.createCurve)({a:BigInt(0),b:BigInt(7),Fp:sm,n:F4,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=F4,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-vne*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),a=mne(o*t,e),d=mne(-n*t,e),u=(0,xo.mod)(t-a*r-d*i,e),c=(0,xo.mod)(-a*n-d*o,e),l=u>s,m=c>s;if(l&&(u=e-u),m&&(c=e-c),u>s||c>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:u,k2neg:m,k2:c}}}},K4.sha256);var H4=BigInt(0),wne=t=>typeof t=="bigint"&&H4typeof t=="bigint"&&H4i.charCodeAt(0)));r=(0,Cs.concatBytes)(n,n),yne[t]=r}return(0,K4.sha256)((0,Cs.concatBytes)(r,...e))}var EC=t=>t.toRawBytes(!0).slice(1),_C=t=>(0,Cs.numberToBytesBE)(t,32),wC=t=>(0,xo.mod)(t,V4),Fx=t=>(0,xo.mod)(t,F4),SC=Da.secp256k1.ProjectivePoint,s7e=(t,e,r)=>SC.BASE.multiplyAndAddUnsafe(t,e,r);function xC(t){let e=Da.secp256k1.utils.normPrivateKeyToScalar(t),r=SC.fromPrivateKey(e);return{scalar:r.hasEvenY()?e:Fx(-e),bytes:EC(r)}}function _ne(t){if(!wne(t))throw new Error("bad x: need 0 < x < p");let e=wC(t*t),r=wC(e*t+BigInt(7)),n=bne(r);n%z4!==H4&&(n=wC(-n));let i=new SC(t,n,vne);return i.assertValidity(),i}function xne(...t){return Fx((0,Cs.bytesToNumberBE)(W4("BIP0340/challenge",...t)))}function a7e(t){return xC(t).bytes}function c7e(t,e,r=(0,r7e.randomBytes)(32)){let n=(0,Cs.ensureBytes)("message",t),{bytes:i,scalar:o}=xC(e),s=(0,Cs.ensureBytes)("auxRand",r,32),a=_C(o^(0,Cs.bytesToNumberBE)(W4("BIP0340/aux",s))),d=W4("BIP0340/nonce",a,i,n),u=Fx((0,Cs.bytesToNumberBE)(d));if(u===H4)throw new Error("sign failed: k is zero");let{bytes:c,scalar:l}=xC(u),m=xne(c,i,n),p=new Uint8Array(64);if(p.set(c,0),p.set(_C(Fx(l+m*o)),32),!Ene(p,n,i))throw new Error("sign: Invalid signature produced");return p}function Ene(t,e,r){let n=(0,Cs.ensureBytes)("signature",t,64),i=(0,Cs.ensureBytes)("message",e),o=(0,Cs.ensureBytes)("publicKey",r,32);try{let s=_ne((0,Cs.bytesToNumberBE)(o)),a=(0,Cs.bytesToNumberBE)(n.subarray(0,32));if(!wne(a))return!1;let d=(0,Cs.bytesToNumberBE)(n.subarray(32,64));if(!o7e(d))return!1;let u=xne(_C(a),EC(s),i),c=s7e(s,d,Fx(-u));return!(!c||!c.hasEvenY()||c.toAffine().x!==a)}catch{return!1}}Da.schnorr={getPublicKey:a7e,sign:c7e,verify:Ene,utils:{randomPrivateKey:Da.secp256k1.utils.randomPrivateKey,lift_x:_ne,pointToBytes:EC,numberToBytesBE:Cs.numberToBytesBE,bytesToNumberBE:Cs.bytesToNumberBE,taggedHash:W4,mod:xo.mod}};var d7e=(0,gne.isogenyMap)(sm,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(t=>t.map(e=>BigInt(e)))),u7e=(0,n7e.mapToCurveSimpleSWU)(sm,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:sm.create(BigInt("-11"))}),Sne=(0,gne.createHasher)(Da.secp256k1.ProjectivePoint,t=>{let{x:e,y:r}=u7e(sm.create(t[0]));return d7e(e,r)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:sm.ORDER,m:1,k:128,expand:"xmd",hash:K4.sha256});Da.hashToCurve=Sne.hashToCurve;Da.encodeToCurve=Sne.encodeToCurve});var AC=V(xw=>{"use strict";h();Object.defineProperty(xw,"__esModule",{value:!0});xw.decodeHex=xw.remove0x=void 0;var l7e=mu();function Tne(t){return t.startsWith("0x")||t.startsWith("0X")?t.slice(2):t}xw.remove0x=Tne;function f7e(t){return(0,l7e.hexToBytes)(Tne(t))}xw.decodeHex=f7e});var IC=V(na=>{"use strict";h();Object.defineProperty(na,"__esModule",{value:!0});na.output=na.exists=na.hash=na.bytes=na.bool=na.number=void 0;function G4(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}na.number=G4;function Ine(t){if(typeof t!="boolean")throw new Error(`Expected boolean, not ${t}`)}na.bool=Ine;function TC(t,...e){if(!(t instanceof Uint8Array))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}`)}na.bytes=TC;function Pne(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("hash must be wrapped by utils.wrapConstructor");G4(t.outputLen),G4(t.blockLen)}na.hash=Pne;function kne(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")}na.exists=kne;function Rne(t,e){TC(t);let r=e.outputLen;if(t.length{"use strict";h();Object.defineProperty(Ew,"__esModule",{value:!0});Ew.poly1305=Ew.wrapConstructorWithKey=void 0;var J4=mu(),PC=IC(),zo=(t,e)=>t[e++]&255|(t[e++]&255)<<8,kC=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=(0,J4.toBytes)(e),(0,J4.ensureBytes)(e,32);let r=zo(e,0),n=zo(e,2),i=zo(e,4),o=zo(e,6),s=zo(e,8),a=zo(e,10),d=zo(e,12),u=zo(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|a<<2)&8191,this.r[7]=(a>>>11|d<<5)&8065,this.r[8]=(d>>>8|u<<8)&8191,this.r[9]=u>>>5&127;for(let c=0;c<8;c++)this.pad[c]=zo(e,16+2*c)}process(e,r,n=!1){let i=n?0:2048,{h:o,r:s}=this,a=s[0],d=s[1],u=s[2],c=s[3],l=s[4],m=s[5],p=s[6],g=s[7],v=s[8],E=s[9],A=zo(e,r+0),P=zo(e,r+2),I=zo(e,r+4),$=zo(e,r+6),N=zo(e,r+8),K=zo(e,r+10),F=zo(e,r+12),U=zo(e,r+14),W=o[0]+(A&8191),L=o[1]+((A>>>13|P<<3)&8191),T=o[2]+((P>>>10|I<<6)&8191),S=o[3]+((I>>>7|$<<9)&8191),k=o[4]+(($>>>4|N<<12)&8191),f=o[5]+(N>>>1&8191),y=o[6]+((N>>>14|K<<2)&8191),w=o[7]+((K>>>11|F<<5)&8191),_=o[8]+((F>>>8|U<<8)&8191),x=o[9]+(U>>>5|i),b=0,B=b+W*a+L*(5*E)+T*(5*v)+S*(5*g)+k*(5*p);b=B>>>13,B&=8191,B+=f*(5*m)+y*(5*l)+w*(5*c)+_*(5*u)+x*(5*d),b+=B>>>13,B&=8191;let q=b+W*d+L*a+T*(5*E)+S*(5*v)+k*(5*g);b=q>>>13,q&=8191,q+=f*(5*p)+y*(5*m)+w*(5*l)+_*(5*c)+x*(5*u),b+=q>>>13,q&=8191;let M=b+W*u+L*d+T*a+S*(5*E)+k*(5*v);b=M>>>13,M&=8191,M+=f*(5*g)+y*(5*p)+w*(5*m)+_*(5*l)+x*(5*c),b+=M>>>13,M&=8191;let j=b+W*c+L*u+T*d+S*a+k*(5*E);b=j>>>13,j&=8191,j+=f*(5*v)+y*(5*g)+w*(5*p)+_*(5*m)+x*(5*l),b+=j>>>13,j&=8191;let J=b+W*l+L*c+T*u+S*d+k*a;b=J>>>13,J&=8191,J+=f*(5*E)+y*(5*v)+w*(5*g)+_*(5*p)+x*(5*m),b+=J>>>13,J&=8191;let Z=b+W*m+L*l+T*c+S*u+k*d;b=Z>>>13,Z&=8191,Z+=f*a+y*(5*E)+w*(5*v)+_*(5*g)+x*(5*p),b+=Z>>>13,Z&=8191;let G=b+W*p+L*m+T*l+S*c+k*u;b=G>>>13,G&=8191,G+=f*d+y*a+w*(5*E)+_*(5*v)+x*(5*g),b+=G>>>13,G&=8191;let H=b+W*g+L*p+T*m+S*l+k*c;b=H>>>13,H&=8191,H+=f*u+y*d+w*a+_*(5*E)+x*(5*v),b+=H>>>13,H&=8191;let X=b+W*v+L*g+T*p+S*m+k*l;b=X>>>13,X&=8191,X+=f*c+y*u+w*d+_*a+x*(5*E),b+=X>>>13,X&=8191;let ee=b+W*E+L*v+T*g+S*p+k*m;b=ee>>>13,ee&=8191,ee+=f*l+y*c+w*u+_*d+x*a,b+=ee>>>13,ee&=8191,b=(b<<2)+b|0,b=b+B|0,B=b&8191,b=b>>>13,q+=b,o[0]=B,o[1]=q,o[2]=M,o[3]=j,o[4]=J,o[5]=Z,o[6]=G,o[7]=H,o[8]=X,o[9]=ee}finalize(){let{h:e,pad:r}=this,n=new Uint16Array(10),i=e[1]>>>13;e[1]&=8191;for(let a=2;a<10;a++)e[a]+=i,i=e[a]>>>13,e[a]&=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 a=1;a<10;a++)n[a]=e[a]+i,i=n[a]>>>13,n[a]&=8191;n[9]-=8192;let o=(i^1)-1;for(let a=0;a<10;a++)n[a]&=o;o=~o;for(let a=0;a<10;a++)e[a]=e[a]&o|n[a];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 a=1;a<8;a++)s=(e[a]+r[a]|0)+(s>>>16)|0,e[a]=s&65535}update(e){PC.default.exists(this);let{buffer:r,blockLen:n}=this;e=(0,J4.toBytes)(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 Dne(t){let e=(n,i)=>t(i).update((0,J4.toBytes)(n)).digest(),r=t(new Uint8Array(32));return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}Ew.wrapConstructorWithKey=Dne;Ew.poly1305=Dne(t=>new kC(t))});var Mne=V(Z4=>{"use strict";h();Object.defineProperty(Z4,"__esModule",{value:!0});Z4.salsaBasic=void 0;var Il=IC(),Pl=mu(),p7e=(0,Pl.utf8ToBytes)("expand 16-byte k"),m7e=(0,Pl.utf8ToBytes)("expand 32-byte k"),y7e=(0,Pl.u32)(p7e),g7e=(0,Pl.u32)(m7e),Y4=t=>!(t.byteOffset%4),v7e=t=>{let{core:e,rounds:r,counterRight:n,counterLen:i,allow128bitKeys:o,extendNonceFn:s,blockLen:a}=(0,Pl.checkOpts)({rounds:20,counterRight:!1,counterLen:8,allow128bitKeys:!0,blockLen:64},t);Il.default.number(i),Il.default.number(r),Il.default.number(a),Il.default.bool(n),Il.default.bool(o);let d=a/4;if(a%4!==0)throw new Error("Salsa/ChaCha: blockLen must be aligned to 4 bytes");return(u,c,l,m,p=0)=>{if(Il.default.bytes(u),Il.default.bytes(c),Il.default.bytes(l),m||(m=new Uint8Array(l.length)),Il.default.bytes(m),Il.default.number(p),p<0||p>=2**32-1)throw new Error("Salsa/ChaCha: counter overflow");if(m.length=2**32-1)throw new Error("Salsa/ChaCha: counter overflow");let T=Math.min(a,U-W);if(T===a&&F&&K){let S=W/4;if(W%4!==0)throw new Error("Salsa/ChaCha: invalid block position");for(let k=0;k{"use strict";h();Object.defineProperty(Wn,"__esModule",{value:!0});Wn.xchacha20poly1305=Wn.chacha20poly1305=Wn._poly1305_aead=Wn.chacha12=Wn.chacha8=Wn.xchacha20=Wn.chacha20=Wn.chacha20orig=Wn.hchacha=void 0;var wu=mu(),b7e=Bne(),zx=Mne(),et=(t,e)=>t<>>32-e;function Wx(t,e,r,n,i,o=20){let s=t[0],a=t[1],d=t[2],u=t[3],c=e[0],l=e[1],m=e[2],p=e[3],g=e[4],v=e[5],E=e[6],A=e[7],P=i,I=r[0],$=r[1],N=r[2],K=s,F=a,U=d,W=u,L=c,T=l,S=m,k=p,f=g,y=v,w=E,_=A,x=P,b=I,B=$,q=N;for(let j=0;j{t.update(e);let r=e.length%16;r&&t.update(w7e.subarray(r))},One=(t,e,r,n,i)=>{let o=t(e,r,new Uint8Array(32)),s=b7e.poly1305.create(o);i&&Cne(s,i),Cne(s,n);let a=new Uint8Array(16),d=(0,wu.createView)(a);(0,wu.setBigUint64)(d,0,BigInt(i?i.length:0),!0),(0,wu.setBigUint64)(d,8,BigInt(n.length),!0),s.update(a);let u=s.digest();return o.fill(0),u},_7e=t=>(e,r,n)=>((0,wu.ensureBytes)(e,32),(0,wu.ensureBytes)(r),{tagLength:16,encrypt:(o,s)=>{let a=o.length,d=a+16;s?(0,wu.ensureBytes)(s,d):s=new Uint8Array(d),t(e,r,o,s,1);let u=One(t,e,r,s.subarray(0,-16),n);return s.set(u,a),s},decrypt:(o,s)=>{let a=o.length,d=a-16;if(a<16)throw new Error("encrypted data must be at least 16 bytes");s?(0,wu.ensureBytes)(s,d):s=new Uint8Array(d);let u=o.subarray(0,-16),c=o.subarray(-16),l=One(t,e,r,u,n);if(!(0,wu.equalBytes)(c,l))throw new Error("invalid tag");return t(e,r,u,s,1),s}});Wn._poly1305_aead=_7e;Wn.chacha20poly1305=(0,Wn._poly1305_aead)(Wn.chacha20);Wn.xchacha20poly1305=(0,Wn._poly1305_aead)(Wn.xchacha20)});var Vx=V(Wo=>{"use strict";h();Object.defineProperty(Wo,"__esModule",{value:!0});Wo.output=Wo.exists=Wo.hash=Wo.bytes=Wo.bool=Wo.number=Wo.isBytes=void 0;function X4(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}Wo.number=X4;function jne(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}Wo.bool=jne;function Une(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}Wo.isBytes=Une;function RC(t,...e){if(!Une(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}`)}Wo.bytes=RC;function qne(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");X4(t.outputLen),X4(t.blockLen)}Wo.hash=qne;function Lne(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")}Wo.exists=Lne;function Kne(t,e){RC(t);let r=e.outputLen;if(t.length{"use strict";h();Object.defineProperty(Q4,"__esModule",{value:!0});Q4.crypto=void 0;Q4.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});var Hx=V(vt=>{"use strict";h();Object.defineProperty(vt,"__esModule",{value:!0});vt.randomBytes=vt.wrapXOFConstructorWithOpts=vt.wrapConstructorWithOpts=vt.wrapConstructor=vt.checkOpts=vt.Hash=vt.concatBytes=vt.toBytes=vt.utf8ToBytes=vt.asyncLoop=vt.nextTick=vt.hexToBytes=vt.bytesToHex=vt.byteSwap32=vt.byteSwapIfBE=vt.byteSwap=vt.isLE=vt.rotl=vt.rotr=vt.createView=vt.u32=vt.u8=vt.isBytes=void 0;var DC=Fne(),MC=Vx();function E7e(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}vt.isBytes=E7e;var S7e=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength);vt.u8=S7e;var A7e=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4));vt.u32=A7e;var T7e=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);vt.createView=T7e;var I7e=(t,e)=>t<<32-e|t>>>e;vt.rotr=I7e;var P7e=(t,e)=>t<>>32-e>>>0;vt.rotl=P7e;vt.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;var k7e=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;vt.byteSwap=k7e;vt.byteSwapIfBE=vt.isLE?t=>t:t=>(0,vt.byteSwap)(t);function R7e(t){for(let e=0;ee.toString(16).padStart(2,"0"));function B7e(t){(0,MC.bytes)(t);let e="";for(let r=0;r=oh._0&&t<=oh._9)return t-oh._0;if(t>=oh._A&&t<=oh._F)return t-(oh._A-10);if(t>=oh._a&&t<=oh._f)return t-(oh._a-10)}function M7e(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;i{};vt.nextTick=C7e;async function O7e(t,e,r){let n=Date.now();for(let i=0;i=0&&ot().update(eA(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}vt.wrapConstructor=U7e;function q7e(t){let e=(n,i)=>t(i).update(eA(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}vt.wrapConstructorWithOpts=q7e;function L7e(t){let e=(n,i)=>t(i).update(eA(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}vt.wrapXOFConstructorWithOpts=L7e;function K7e(t=32){if(DC.crypto&&typeof DC.crypto.getRandomValues=="function")return DC.crypto.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}vt.randomBytes=K7e});var Hne=V(V0=>{"use strict";h();Object.defineProperty(V0,"__esModule",{value:!0});V0.hmac=V0.HMAC=void 0;var tA=Vx(),Vne=Hx(),Gx=class extends Vne.Hash{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,(0,tA.hash)(e);let n=(0,Vne.toBytes)(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 Gx(t,e).update(r).digest();V0.hmac=F7e;V0.hmac.create=(t,e)=>new Gx(t,e)});var Qne=V(am=>{"use strict";h();Object.defineProperty(am,"__esModule",{value:!0});am.hkdf=am.expand=am.extract=void 0;var OC=Vx(),Gne=Hx(),Yne=Hne();function Zne(t,e,r){return(0,OC.hash)(t),r===void 0&&(r=new Uint8Array(t.outputLen)),(0,Yne.hmac)(t,(0,Gne.toBytes)(r),(0,Gne.toBytes)(e))}am.extract=Zne;var CC=new Uint8Array([0]),Jne=new Uint8Array;function Xne(t,e,r,n=32){if((0,OC.hash)(t),(0,OC.number)(n),n>255*t.outputLen)throw new Error("Length should be <= 255*HashLen");let i=Math.ceil(n/t.outputLen);r===void 0&&(r=Jne);let o=new Uint8Array(i*t.outputLen),s=Yne.hmac.create(t,e),a=s._cloneInto(),d=new Uint8Array(s.outputLen);for(let u=0;uXne(t,Zne(t,e,r),n,i);am.hkdf=z7e});var eie=V(cm=>{"use strict";h();Object.defineProperty(cm,"__esModule",{value:!0});cm.HashMD=cm.Maj=cm.Chi=void 0;var $C=Vx(),Jx=Hx();function W7e(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),a=Number(r&o),d=n?4:0,u=n?0:4;t.setUint32(e+d,s,n),t.setUint32(e+u,a,n)}var V7e=(t,e,r)=>t&e^~t&r;cm.Chi=V7e;var H7e=(t,e,r)=>t&e^t&r^e&r;cm.Maj=H7e;var NC=class extends Jx.Hash{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=(0,Jx.createView)(this.buffer)}update(e){(0,$C.exists)(this);let{view:r,buffer:n,blockLen:i}=this;e=(0,Jx.toBytes)(e);let o=e.length;for(let s=0;si-s&&(this.process(n,0),s=0);for(let l=s;lc.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l{"use strict";h();Object.defineProperty(Sw,"__esModule",{value:!0});Sw.sha224=Sw.sha256=void 0;var jC=eie(),md=Hx(),G7e=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]),dm=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),um=new Uint32Array(64),rA=class extends jC.HashMD{constructor(){super(64,32,8,!1),this.A=dm[0]|0,this.B=dm[1]|0,this.C=dm[2]|0,this.D=dm[3]|0,this.E=dm[4]|0,this.F=dm[5]|0,this.G=dm[6]|0,this.H=dm[7]|0}get(){let{A:e,B:r,C:n,D:i,E:o,F:s,G:a,H:d}=this;return[e,r,n,i,o,s,a,d]}set(e,r,n,i,o,s,a,d){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=a|0,this.H=d|0}process(e,r){for(let l=0;l<16;l++,r+=4)um[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){let m=um[l-15],p=um[l-2],g=(0,md.rotr)(m,7)^(0,md.rotr)(m,18)^m>>>3,v=(0,md.rotr)(p,17)^(0,md.rotr)(p,19)^p>>>10;um[l]=v+um[l-7]+g+um[l-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:d,G:u,H:c}=this;for(let l=0;l<64;l++){let m=(0,md.rotr)(a,6)^(0,md.rotr)(a,11)^(0,md.rotr)(a,25),p=c+m+(0,jC.Chi)(a,d,u)+G7e[l]+um[l]|0,v=((0,md.rotr)(n,2)^(0,md.rotr)(n,13)^(0,md.rotr)(n,22))+(0,jC.Maj)(n,i,o)|0;c=u,u=d,d=a,a=s+p|0,s=o,o=i,i=n,n=p+v|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,d=d+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(n,i,o,s,a,d,u,c)}roundClean(){um.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},UC=class extends rA{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}};Sw.sha256=(0,md.wrapConstructor)(()=>new rA);Sw.sha224=(0,md.wrapConstructor)(()=>new UC)});var iie=V(nA=>{"use strict";h();Object.defineProperty(nA,"__esModule",{value:!0});nA.aes256gcm=void 0;var rie=mu(),nie=L8(),qC=Ox();function J7e(t,e,r){var n=function(o){var s=(0,nie.createCipheriv)("aes-256-gcm",t,e);r&&s.setAAD(r);var a=s.update(o),d=s.final();return(0,rie.concatBytes)(a,d,s.getAuthTag())},i=function(o){var s=o.subarray(0,o.length-qC.AEAD_TAG_LENGTH),a=o.subarray(-qC.AEAD_TAG_LENGTH),d=(0,nie.createDecipheriv)("aes-256-gcm",t,e);r&&d.setAAD(r),d.setAuthTag(a);var u=d.update(s),c=d.final();return(0,rie.concatBytes)(u,c)};return{tagLength:qC.AEAD_TAG_LENGTH,encrypt:n,decrypt:i}}nA.aes256gcm=J7e});var LC=V(lm=>{"use strict";h();Object.defineProperty(lm,"__esModule",{value:!0});lm.deriveKey=lm.aesDecrypt=lm.aesEncrypt=void 0;var Y7e=Nne(),sie=mu(),Z7e=UM(),X7e=Qne(),Q7e=tie(),oie=L0(),iA=Ox(),eDe=iie();function tDe(t,e){return aie(!0,t,e)}lm.aesEncrypt=tDe;function rDe(t,e){return aie(!1,t,e)}lm.aesDecrypt=rDe;function nDe(t){return(0,X7e.hkdf)(Q7e.sha256,t,void 0,void 0,32)}lm.deriveKey=nDe;function aie(t,e,r){var n=(0,oie.symmetricAlgorithm)(),i=t?iDe:oDe;if(n==="aes-256-gcm")return i(eDe.aes256gcm,e,r,(0,oie.symmetricNonceLength)());if(n==="xchacha20")return i(Y7e.xchacha20poly1305,e,r,iA.XCHACHA20_NONCE_LENGTH);throw new Error("Not implemented")}function iDe(t,e,r,n){var i=(0,Z7e.randomBytes)(n),o=t(e,i),s=o.encrypt(r),a=s.subarray(0,s.length-iA.AEAD_TAG_LENGTH),d=s.subarray(-iA.AEAD_TAG_LENGTH);return(0,sie.concatBytes)(i,d,a)}function oDe(t,e,r,n){var i=n+iA.AEAD_TAG_LENGTH,o=r.subarray(0,n),s=r.subarray(n,i),a=r.subarray(i),d=t(e,Uint8Array.from(o)),u=(0,sie.concatBytes)(a,s);return d.decrypt(u)}});var lie=V(Os=>{"use strict";h();Object.defineProperty(Os,"__esModule",{value:!0});Os.hexToPublicKey=Os.convertPublicKeyFormat=Os.getSharedPoint=Os.getSharedKey=Os.getPublicKey=Os.isValidPrivateKey=Os.getValidSecret=void 0;var sDe=mu(),aDe=UM(),cie=one(),cDe=Ane(),KC=L0(),die=Ox(),dDe=AC(),uDe=LC();function lDe(){var t;do t=(0,aDe.randomBytes)(die.SECRET_KEY_LENGTH);while(!uie(t));return t}Os.getValidSecret=lDe;function uie(t){return Yx(function(e){return e.utils.isValidPrivateKey(t)},function(){return!0},function(){return!0})}Os.isValidPrivateKey=uie;function fDe(t){return Yx(function(e){return e.getPublicKey(t)},function(e){return e.getPublicKey(t)},function(e){return e.getPublicKey(t)})}Os.getPublicKey=fDe;function hDe(t,e){return(0,uDe.deriveKey)((0,sDe.concatBytes)(t,e))}Os.getSharedKey=hDe;function pDe(t,e,r){return Yx(function(n){return n.getSharedSecret(t,e,r)},function(n){return n.getSharedSecret(t,e)},function(n){var i=n.utils.getExtendedPublicKey(t).scalar,o=n.ExtendedPoint.fromHex(e).multiply(i);return o.toRawBytes()})}Os.getSharedPoint=pDe;function mDe(t,e){return Yx(function(r){return r.getSharedSecret(BigInt(1),t,e)},function(){return t},function(){return t})}Os.convertPublicKeyFormat=mDe;function yDe(t){var e=(0,dDe.decodeHex)(t);return Yx(function(){if(e.length===die.ETH_PUBLIC_KEY_SIZE){var r=new Uint8Array(1+e.length);return r.set([4]),r.set(e,1),r}return e},function(){return e},function(){return e})}Os.hexToPublicKey=yDe;function Yx(t,e,r){if((0,KC.ellipticCurve)()==="secp256k1")return t(cDe.secp256k1);if((0,KC.ellipticCurve)()==="x25519")return e(cie.x25519);if((0,KC.ellipticCurve)()==="ed25519")return r(cie.ed25519);throw new Error("Not implemented")}});var oA=V(sh=>{"use strict";h();var gDe=sh&&sh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FC=sh&&sh.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&gDe(e,t,r)};Object.defineProperty(sh,"__esModule",{value:!0});FC(lie(),sh);FC(AC(),sh);FC(LC(),sh)});var WC=V(aA=>{"use strict";h();Object.defineProperty(aA,"__esModule",{value:!0});aA.PublicKey=void 0;var zC=mu(),vDe=L0(),sA=oA(),bDe=function(){function t(e){this.data=(0,sA.convertPublicKeyFormat)(e,!0)}return t.fromHex=function(e){return new t((0,sA.hexToPublicKey)(e))},Object.defineProperty(t.prototype,"uncompressed",{get:function(){return O.Buffer.from((0,sA.convertPublicKeyFormat)(this.data,!1))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"compressed",{get:function(){return O.Buffer.from(this.data)},enumerable:!1,configurable:!0}),t.prototype.toHex=function(e){return e===void 0&&(e=!0),e?(0,zC.bytesToHex)(this.data):(0,zC.bytesToHex)(this.uncompressed)},t.prototype.decapsulate=function(e){var r,n;return(0,vDe.isHkdfKeyCompressed)()?(r=this.data,n=e.multiply(this,!0)):(r=this.uncompressed,n=e.multiply(this,!1)),(0,sA.getSharedKey)(r,n)},t.prototype.equals=function(e){return(0,zC.equalBytes)(this.data,e.data)},t}();aA.PublicKey=bDe});var hie=V(cA=>{"use strict";h();Object.defineProperty(cA,"__esModule",{value:!0});cA.PrivateKey=void 0;var fie=mu(),wDe=L0(),Aw=oA(),_De=WC(),xDe=function(){function t(e){var r=e===void 0?(0,Aw.getValidSecret)():e;if(!(0,Aw.isValidPrivateKey)(r))throw new Error("Invalid private key");this.data=r,this.publicKey=new _De.PublicKey((0,Aw.getPublicKey)(r))}return t.fromHex=function(e){return new t((0,Aw.decodeHex)(e))},Object.defineProperty(t.prototype,"secret",{get:function(){return O.Buffer.from(this.data)},enumerable:!1,configurable:!0}),t.prototype.toHex=function(){return(0,fie.bytesToHex)(this.data)},t.prototype.encapsulate=function(e){var r,n;return(0,wDe.isHkdfKeyCompressed)()?(r=this.publicKey.compressed,n=this.multiply(e,!0)):(r=this.publicKey.uncompressed,n=this.multiply(e,!1)),(0,Aw.getSharedKey)(r,n)},t.prototype.multiply=function(e,r){return r===void 0&&(r=!1),(0,Aw.getSharedPoint)(this.data,e.compressed,r)},t.prototype.equals=function(e){return(0,fie.equalBytes)(this.data,e.data)},t}();cA.PrivateKey=xDe});var VC=V(Tw=>{"use strict";h();Object.defineProperty(Tw,"__esModule",{value:!0});Tw.PublicKey=Tw.PrivateKey=void 0;var EDe=hie();Object.defineProperty(Tw,"PrivateKey",{enumerable:!0,get:function(){return EDe.PrivateKey}});var SDe=WC();Object.defineProperty(Tw,"PublicKey",{enumerable:!0,get:function(){return SDe.PublicKey}})});var yie=V(Ba=>{"use strict";h();Object.defineProperty(Ba,"__esModule",{value:!0});Ba.utils=Ba.PublicKey=Ba.PrivateKey=Ba.ECIES_CONFIG=Ba.decrypt=Ba.encrypt=void 0;var ADe=mu(),pie=L0(),Iw=VC(),H0=oA();function TDe(t,e){var r=new Iw.PrivateKey,n=t instanceof Uint8Array?new Iw.PublicKey(t):Iw.PublicKey.fromHex(t),i=r.encapsulate(n),o=(0,H0.aesEncrypt)(i,e),s;return(0,pie.isEphemeralKeyCompressed)()?s=r.publicKey.compressed:s=r.publicKey.uncompressed,O.Buffer.from((0,ADe.concatBytes)(s,o))}Ba.encrypt=TDe;function IDe(t,e){var r=t instanceof Uint8Array?new Iw.PrivateKey(t):Iw.PrivateKey.fromHex(t),n=(0,pie.ephemeralKeySize)(),i=new Iw.PublicKey(e.subarray(0,n)),o=e.subarray(n),s=i.decapsulate(r);return O.Buffer.from((0,H0.aesDecrypt)(s,o))}Ba.decrypt=IDe;var PDe=L0();Object.defineProperty(Ba,"ECIES_CONFIG",{enumerable:!0,get:function(){return PDe.ECIES_CONFIG}});var mie=VC();Object.defineProperty(Ba,"PrivateKey",{enumerable:!0,get:function(){return mie.PrivateKey}});Object.defineProperty(Ba,"PublicKey",{enumerable:!0,get:function(){return mie.PublicKey}});Ba.utils={aesDecrypt:H0.aesDecrypt,aesEncrypt:H0.aesEncrypt,decodeHex:H0.decodeHex,getValidSecret:H0.getValidSecret,remove0x:H0.remove0x}});var Jn=V((gvt,gie)=>{"use strict";h();gie.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)},PromiseResolve(t){return Promise.resolve(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,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Boolean,Uint8Array}});var ah=V((bvt,dA)=>{"use strict";h();var{AbortController:vie,AbortSignal:kDe}=typeof self<"u"?self:typeof window<"u"?window:void 0;dA.exports=vie;dA.exports.AbortSignal=kDe;dA.exports.default=vie});var $s=V((_vt,GC)=>{"use strict";h();var RDe=Fn(),{kResistStopPropagation:DDe,SymbolDispose:BDe}=Jn(),MDe=globalThis.AbortSignal||ah().AbortSignal,CDe=globalThis.AbortController||ah().AbortController,ODe=Object.getPrototypeOf(async function(){}).constructor,bie=globalThis.Blob||RDe.Blob,$De=typeof bie<"u"?function(e){return e instanceof bie}:function(e){return!1},wie=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},NDe=(t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},HC=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 ODe},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:$De,deprecate(t,e){return t},addAbortListener:lc().addAbortListener||function(e,r){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);wie(e,"signal"),NDe(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[DDe]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[BDe](){var i;(i=n)===null||i===void 0||i()}}},AbortSignalAny:MDe.any||function(e){if(e.length===1)return e[0];let r=new CDe,n=()=>r.abort();return e.forEach(i=>{wie(i,"signals"),i.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(i=>i.removeEventListener("abort",n))},{once:!0}),r.signal}};GC.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var ia=V((Evt,Eie)=>{"use strict";h();var{format:jDe,inspect:uA,AggregateError:UDe}=$s(),qDe=globalThis.AggregateError||UDe,LDe=Symbol("kIsNodeError"),KDe=["string","function","number","object","Function","Object","boolean","bigint","symbol"],FDe=/^([A-Z][a-z0-9]*)+$/,zDe="__node_internal_",lA={};function G0(t,e){if(!t)throw new lA.ERR_INTERNAL_ASSERTION(e)}function _ie(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 WDe(t,e,r){if(typeof e=="function")return G0(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 G0(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:jDe(e,...r)}function Vo(t,e,r){r||(r=Error);class n extends r{constructor(...o){super(WDe(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[LDe]=!0,lA[t]=n}function xie(t){let e=zDe+t.name;return Object.defineProperty(t,"name",{value:e}),t}function VDe(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new qDe([e,t],e.message);return r.code=e.code,r}return t||e}var JC=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new lA.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};Vo("ERR_ASSERTION","%s",Error);Vo("ERR_INVALID_ARG_TYPE",(t,e,r)=>{G0(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 d of e)G0(typeof d=="string","All expected entries have to be of type string"),KDe.includes(d)?i.push(d.toLowerCase()):FDe.test(d)?o.push(d):(G0(d!=="object",'The value "object" should be written as "Object"'),s.push(d));if(o.length>0){let d=i.indexOf("object");d!==-1&&(i.splice(i,d,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 d=i.pop();n+=`one of type ${i.join(", ")}, or ${d}`}}(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 d=o.pop();n+=`an instance of ${o.join(", ")}, or ${d}`}}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 d=s.pop();n+=`one of ${s.join(", ")}, or ${d}`}}if(r==null)n+=`. Received ${r}`;else if(typeof r=="function"&&r.name)n+=`. Received function ${r.name}`;else if(typeof r=="object"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)n+=`. Received an instance of ${r.constructor.name}`;else{let d=uA(r,{depth:-1});n+=`. Received ${d}`}}else{let d=uA(r,{colors:!1});d.length>25&&(d=`${d.slice(0,25)}...`),n+=`. Received type ${typeof r} (${d})`}return n},TypeError);Vo("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=uA(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);Vo("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);Vo("ERR_MISSING_ARGS",(...t)=>{G0(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);Vo("ERR_OUT_OF_RANGE",(t,e,r)=>{G0(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=_ie(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=_ie(n)),n+="n"):n=uA(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);Vo("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Vo("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Vo("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Vo("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Vo("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Vo("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Vo("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Vo("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Vo("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Vo("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Vo("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Eie.exports={AbortError:JC,aggregateTwoErrors:xie(VDe),hideStackFrames:xie,codes:lA}});var kw=V((Avt,Mie)=>{"use strict";h();var{ArrayIsArray:ZC,ArrayPrototypeIncludes:Iie,ArrayPrototypeJoin:Pie,ArrayPrototypeMap:HDe,NumberIsInteger:XC,NumberIsNaN:GDe,NumberMAX_SAFE_INTEGER:JDe,NumberMIN_SAFE_INTEGER:YDe,NumberParseInt:ZDe,ObjectPrototypeHasOwnProperty:XDe,RegExpPrototypeExec:kie,String:QDe,StringPrototypeToUpperCase:eBe,StringPrototypeTrim:tBe}=Jn(),{hideStackFrames:yd,codes:{ERR_SOCKET_BAD_PORT:rBe,ERR_INVALID_ARG_TYPE:Ns,ERR_INVALID_ARG_VALUE:Pw,ERR_OUT_OF_RANGE:J0,ERR_UNKNOWN_SIGNAL:Sie}}=ia(),{normalizeEncoding:nBe}=$s(),{isAsyncFunction:iBe,isArrayBufferView:oBe}=$s().types,Aie={};function sBe(t){return t===(t|0)}function aBe(t){return t===t>>>0}var cBe=/^[0-7]+$/,dBe="must be a 32-bit unsigned integer or an octal string";function uBe(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(kie(cBe,t)===null)throw new Pw(e,t,dBe);t=ZDe(t,8)}return Rie(t,e),t}var lBe=yd((t,e,r=YDe,n=JDe)=>{if(typeof t!="number")throw new Ns(e,"number",t);if(!XC(t))throw new J0(e,"an integer",t);if(tn)throw new J0(e,`>= ${r} && <= ${n}`,t)}),fBe=yd((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new Ns(e,"number",t);if(!XC(t))throw new J0(e,"an integer",t);if(tn)throw new J0(e,`>= ${r} && <= ${n}`,t)}),Rie=yd((t,e,r=!1)=>{if(typeof t!="number")throw new Ns(e,"number",t);if(!XC(t))throw new J0(e,"an integer",t);let n=r?1:0,i=4294967295;if(ti)throw new J0(e,`>= ${n} && <= ${i}`,t)});function QC(t,e){if(typeof t!="string")throw new Ns(e,"string",t)}function hBe(t,e,r=void 0,n){if(typeof t!="number")throw new Ns(e,"number",t);if(r!=null&&tn||(r!=null||n!=null)&&GDe(t))throw new J0(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var pBe=yd((t,e,r)=>{if(!Iie(r,t)){let i="must be one of: "+Pie(HDe(r,o=>typeof o=="string"?`'${o}'`:QDe(o)),", ");throw new Pw(e,t,i)}});function Die(t,e){if(typeof t!="boolean")throw new Ns(e,"boolean",t)}function YC(t,e,r){return t==null||!XDe(t,e)?r:t[e]}var mBe=yd((t,e,r=null)=>{let n=YC(r,"allowArray",!1),i=YC(r,"allowFunction",!1);if(!YC(r,"nullable",!1)&&t===null||!n&&ZC(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new Ns(e,"Object",t)}),yBe=yd((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new Ns(e,"a dictionary",t)}),fA=yd((t,e,r=0)=>{if(!ZC(t))throw new Ns(e,"Array",t);if(t.length{if(!oBe(t))throw new Ns(e,["Buffer","TypedArray","DataView"],t)});function xBe(t,e){let r=nBe(e),n=t.length;if(r==="hex"&&n%2!==0)throw new Pw("encoding",e,`is invalid for data of length ${n}`)}function EBe(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&tBe(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new rBe(e,t,r);return t|0}var Bie=yd((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Ns(e,"AbortSignal",t)}),SBe=yd((t,e)=>{if(typeof t!="function")throw new Ns(e,"Function",t)}),ABe=yd((t,e)=>{if(typeof t!="function"||iBe(t))throw new Ns(e,"Function",t)}),TBe=yd((t,e)=>{if(t!==void 0)throw new Ns(e,"undefined",t)});function IBe(t,e,r){if(!Iie(r,t))throw new Ns(e,`('${Pie(r,"|")}')`,t)}var PBe=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Tie(t,e){if(typeof t>"u"||!kie(PBe,t))throw new Pw(e,t,'must be an array or string of format "; rel=preload; as=style"')}function kBe(t){if(typeof t=="string")return Tie(t,"hints"),t;if(ZC(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n; rel=preload; as=style"')}Mie.exports={isInt32:sBe,isUint32:aBe,parseFileMode:uBe,validateArray:fA,validateStringArray:gBe,validateBooleanArray:vBe,validateAbortSignalArray:bBe,validateBoolean:Die,validateBuffer:_Be,validateDictionary:yBe,validateEncoding:xBe,validateFunction:SBe,validateInt32:fBe,validateInteger:lBe,validateNumber:hBe,validateObject:mBe,validateOneOf:pBe,validatePlainFunction:ABe,validatePort:EBe,validateSignalName:wBe,validateString:QC,validateUint32:Rie,validateUndefined:TBe,validateUnion:IBe,validateAbortSignal:Bie,validateLinkHeaderValue:kBe}});var Rl=V((Ivt,Gie)=>{"use strict";h();var{SymbolAsyncIterator:Cie,SymbolIterator:Oie,SymbolFor:Y0}=Jn(),$ie=Y0("nodejs.stream.destroyed"),Nie=Y0("nodejs.stream.errored"),eO=Y0("nodejs.stream.readable"),tO=Y0("nodejs.stream.writable"),jie=Y0("nodejs.stream.disturbed"),RBe=Y0("nodejs.webstream.isClosedPromise"),DBe=Y0("nodejs.webstream.controllerErrorFunction");function hA(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 pA(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 BBe(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function kl(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Uie(t){return!!(t&&!kl(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function qie(t){return!!(t&&!kl(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Lie(t){return!!(t&&!kl(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function MBe(t){return Uie(t)||qie(t)||Lie(t)}function CBe(t,e){return t==null?!1:e===!0?typeof t[Cie]=="function":e===!1?typeof t[Oie]=="function":typeof t[Cie]=="function"||typeof t[Oie]=="function"}function mA(t){if(!kl(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[$ie]||n!=null&&n.destroyed)}function Kie(t){if(!pA(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 OBe(t,e){if(!pA(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 $Be(t){if(!hA(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 Fie(t,e){if(!hA(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 zie(t){return t&&t[eO]!=null?t[eO]:typeof t?.readable!="boolean"?null:mA(t)?!1:hA(t)&&t.readable&&!Fie(t)}function Wie(t){return t&&t[tO]!=null?t[tO]:typeof t?.writable!="boolean"?null:mA(t)?!1:pA(t)&&t.writable&&!Kie(t)}function NBe(t,e){return kl(t)?mA(t)?!0:!(e?.readable!==!1&&zie(t)||e?.writable!==!1&&Wie(t)):null}function jBe(t){var e,r;return kl(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 UBe(t){var e,r;return kl(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 qBe(t){if(!kl(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"&&Vie(t)?t._closed:null}function Vie(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Hie(t){return typeof t._sent100=="boolean"&&Vie(t)}function LBe(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 KBe(t){if(!kl(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&Hie(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function FBe(t){var e;return!!(t&&((e=t[jie])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function zBe(t){var e,r,n,i,o,s,a,d,u,c;return!!(t&&((e=(r=(n=(i=(o=(s=t[Nie])!==null&&s!==void 0?s:t.readableErrored)!==null&&o!==void 0?o:t.writableErrored)!==null&&i!==void 0?i:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&n!==void 0?n:(d=t._writableState)===null||d===void 0?void 0:d.errorEmitted)!==null&&r!==void 0?r:(u=t._readableState)===null||u===void 0?void 0:u.errored)!==null&&e!==void 0?e:!((c=t._writableState)===null||c===void 0)&&c.errored))}Gie.exports={isDestroyed:mA,kIsDestroyed:$ie,isDisturbed:FBe,kIsDisturbed:jie,isErrored:zBe,kIsErrored:Nie,isReadable:zie,kIsReadable:eO,kIsClosedPromise:RBe,kControllerErrorFunction:DBe,kIsWritable:tO,isClosed:qBe,isDuplexNodeStream:BBe,isFinished:NBe,isIterable:CBe,isReadableNodeStream:hA,isReadableStream:Uie,isReadableEnded:$Be,isReadableFinished:Fie,isReadableErrored:UBe,isNodeStream:kl,isWebStream:MBe,isWritable:Wie,isWritableNodeStream:pA,isWritableStream:qie,isWritableEnded:Kie,isWritableFinished:OBe,isWritableErrored:jBe,isServerRequest:LBe,isServerResponse:Hie,willEmitClose:KBe,isTransformStream:Lie}});var ch=V((kvt,sO)=>{h();var fm=ys(),{AbortError:noe,codes:WBe}=ia(),{ERR_INVALID_ARG_TYPE:VBe,ERR_STREAM_PREMATURE_CLOSE:Jie}=WBe,{kEmptyObject:nO,once:iO}=$s(),{validateAbortSignal:HBe,validateFunction:GBe,validateObject:JBe,validateBoolean:YBe}=kw(),{Promise:ZBe,PromisePrototypeThen:XBe,SymbolDispose:ioe}=Jn(),{isClosed:QBe,isReadable:Yie,isReadableNodeStream:rO,isReadableStream:eMe,isReadableFinished:Zie,isReadableErrored:Xie,isWritable:Qie,isWritableNodeStream:eoe,isWritableStream:tMe,isWritableFinished:toe,isWritableErrored:roe,isNodeStream:rMe,willEmitClose:nMe,kIsClosedPromise:iMe}=Rl(),Rw;function oMe(t){return t.setHeader&&typeof t.abort=="function"}var oO=()=>{};function ooe(t,e,r){var n,i;if(arguments.length===2?(r=e,e=nO):e==null?e=nO:JBe(e,"options"),GBe(r,"callback"),HBe(e.signal,"options.signal"),r=iO(r),eMe(t)||tMe(t))return sMe(t,e,r);if(!rMe(t))throw new VBe("stream",["ReadableStream","WritableStream","Stream"],t);let o=(n=e.readable)!==null&&n!==void 0?n:rO(t),s=(i=e.writable)!==null&&i!==void 0?i:eoe(t),a=t._writableState,d=t._readableState,u=()=>{t.writable||m()},c=nMe(t)&&rO(t)===o&&eoe(t)===s,l=toe(t,!1),m=()=>{l=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||o))&&(!o||p)&&r.call(t)},p=Zie(t,!1),g=()=>{p=!0,t.destroyed&&(c=!1),!(c&&(!t.writable||s))&&(!s||l)&&r.call(t)},v=N=>{r.call(t,N)},E=QBe(t),A=()=>{E=!0;let N=roe(t)||Xie(t);if(N&&typeof N!="boolean")return r.call(t,N);if(o&&!p&&rO(t,!0)&&!Zie(t,!1))return r.call(t,new Jie);if(s&&!l&&!toe(t,!1))return r.call(t,new Jie);r.call(t)},P=()=>{E=!0;let N=roe(t)||Xie(t);if(N&&typeof N!="boolean")return r.call(t,N);r.call(t)},I=()=>{t.req.on("finish",m)};oMe(t)?(t.on("complete",m),c||t.on("abort",A),t.req?I():t.on("request",I)):s&&!a&&(t.on("end",u),t.on("close",u)),!c&&typeof t.aborted=="boolean"&&t.on("aborted",A),t.on("end",g),t.on("finish",m),e.error!==!1&&t.on("error",v),t.on("close",A),E?fm.nextTick(A):a!=null&&a.errorEmitted||d!=null&&d.errorEmitted?c||fm.nextTick(P):(!o&&(!c||Yie(t))&&(l||Qie(t)===!1)||!s&&(!c||Qie(t))&&(p||Yie(t)===!1)||d&&t.req&&t.aborted)&&fm.nextTick(P);let $=()=>{r=oO,t.removeListener("aborted",A),t.removeListener("complete",m),t.removeListener("abort",A),t.removeListener("request",I),t.req&&t.req.removeListener("finish",m),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",m),t.removeListener("end",g),t.removeListener("error",v),t.removeListener("close",A)};if(e.signal&&!E){let N=()=>{let K=r;$(),K.call(t,new noe(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)fm.nextTick(N);else{Rw=Rw||$s().addAbortListener;let K=Rw(e.signal,N),F=r;r=iO((...U)=>{K[ioe](),F.apply(t,U)})}}return $}function sMe(t,e,r){let n=!1,i=oO;if(e.signal)if(i=()=>{n=!0,r.call(t,new noe(void 0,{cause:e.signal.reason}))},e.signal.aborted)fm.nextTick(i);else{Rw=Rw||$s().addAbortListener;let s=Rw(e.signal,i),a=r;r=iO((...d)=>{s[ioe](),a.apply(t,d)})}let o=(...s)=>{n||fm.nextTick(()=>r.apply(t,s))};return XBe(t[iMe].promise,o,o),oO}function aMe(t,e){var r;let n=!1;return e===null&&(e=nO),(r=e)!==null&&r!==void 0&&r.cleanup&&(YBe(e.cleanup,"cleanup"),n=e.cleanup),new ZBe((i,o)=>{let s=ooe(t,e,a=>{n&&s(),a?o(a):i()})})}sO.exports=ooe;sO.exports.finished=aMe});var Z0=V((Dvt,hoe)=>{"use strict";h();var Dl=ys(),{aggregateTwoErrors:cMe,codes:{ERR_MULTIPLE_CALLBACK:dMe},AbortError:uMe}=ia(),{Symbol:coe}=Jn(),{kIsDestroyed:lMe,isDestroyed:fMe,isFinished:hMe,isServerRequest:pMe}=Rl(),doe=coe("kDestroy"),aO=coe("kConstruct");function uoe(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function mMe(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):(uoe(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?soe(this,t,e):this.once(doe,function(o){soe(this,cMe(o,t),e)}),this)}function soe(t,e,r){let n=!1;function i(o){if(n)return;n=!0;let s=t._readableState,a=t._writableState;uoe(o,a,s),a&&(a.closed=!0),s&&(s.closed=!0),typeof r=="function"&&r(o),o?Dl.nextTick(yMe,t,o):Dl.nextTick(loe,t)}try{t._destroy(e||null,i)}catch(o){i(o)}}function yMe(t,e){cO(t,e),loe(t)}function loe(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 cO(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 gMe(){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 dO(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?Dl.nextTick(cO,t,e):cO(t,e))}function vMe(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(aO,e),!(t.listenerCount(aO)>1)&&Dl.nextTick(bMe,t)}function bMe(t){let e=!1;function r(n){if(e){dO(t,n??new dMe);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(doe,n):n?dO(t,n,!0):Dl.nextTick(wMe,t)}try{t._construct(n=>{Dl.nextTick(r,n)})}catch(n){Dl.nextTick(r,n)}}function wMe(t){t.emit(aO)}function aoe(t){return t?.setHeader&&typeof t.abort=="function"}function foe(t){t.emit("close")}function _Me(t,e){t.emit("error",e),Dl.nextTick(foe,t)}function xMe(t,e){!t||fMe(t)||(!e&&!hMe(t)&&(e=new uMe),pMe(t)?(t.socket=null,t.destroy(e)):aoe(t)?t.abort():aoe(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?Dl.nextTick(_Me,t,e):Dl.nextTick(foe,t),t.destroyed||(t[lMe]=!0))}hoe.exports={construct:vMe,destroyer:xMe,destroy:mMe,undestroy:gMe,errorOrDestroy:dO}});var vA=V((Mvt,moe)=>{"use strict";h();var{ArrayIsArray:EMe,ObjectSetPrototypeOf:poe}=Jn(),{EventEmitter:yA}=lc();function gA(t){yA.call(this,t)}poe(gA.prototype,yA.prototype);poe(gA,yA);gA.prototype.pipe=function(t,e){let r=this;function n(c){t.writable&&t.write(c)===!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",a));let o=!1;function s(){o||(o=!0,t.end())}function a(){o||(o=!0,typeof t.destroy=="function"&&t.destroy())}function d(c){u(),yA.listenerCount(this,"error")===0&&this.emit("error",c)}uO(r,"error",d),uO(t,"error",d);function u(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",d),t.removeListener("error",d),r.removeListener("end",u),r.removeListener("close",u),t.removeListener("close",u)}return r.on("end",u),r.on("close",u),t.on("close",u),t.emit("pipe",r),t};function uO(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):EMe(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}moe.exports={Stream:gA,prependListener:uO}});var Zx=V((Ovt,bA)=>{"use strict";h();var{SymbolDispose:SMe}=Jn(),{AbortError:yoe,codes:AMe}=ia(),{isNodeStream:goe,isWebStream:TMe,kControllerErrorFunction:IMe}=Rl(),PMe=ch(),{ERR_INVALID_ARG_TYPE:voe}=AMe,lO,kMe=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new voe(e,"AbortSignal",t)};bA.exports.addAbortSignal=function(e,r){if(kMe(e,"signal"),!goe(r)&&!TMe(r))throw new voe("stream",["ReadableStream","WritableStream","Stream"],r);return bA.exports.addAbortSignalNoValidate(e,r)};bA.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=goe(e)?()=>{e.destroy(new yoe(void 0,{cause:t.reason}))}:()=>{e[IMe](new yoe(void 0,{cause:t.reason}))};if(t.aborted)r();else{lO=lO||$s().addAbortListener;let n=lO(t,r);PMe(e,n[SMe])}return e}});var _oe=V((jvt,woe)=>{"use strict";h();var{StringPrototypeSlice:boe,SymbolIterator:RMe,TypedArrayPrototypeSet:wA,Uint8Array:DMe}=Jn(),{Buffer:fO}=Fn(),{inspect:BMe}=$s();woe.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 fO.alloc(0);let r=fO.allocUnsafe(e>>>0),n=this.head,i=0;for(;n;)wA(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+=boe(o,0,e),this.head=n,n.data=boe(o,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=fO.allocUnsafe(e),n=e,i=this.head,o=0;do{let s=i.data;if(e>s.length)wA(r,s,n-e),e-=s.length;else{e===s.length?(wA(r,s,n-e),++o,i.next?this.head=i.next:this.head=this.tail=null):(wA(r,new DMe(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 BMe(this,{...r,depth:0,customInspect:!1})}}});var Xx=V((qvt,Aoe)=>{"use strict";h();var{MathFloor:MMe,NumberIsInteger:CMe}=Jn(),{validateInteger:OMe}=kw(),{ERR_INVALID_ARG_VALUE:$Me}=ia().codes,xoe=16*1024,Eoe=16;function NMe(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Soe(t){return t?Eoe:xoe}function jMe(t,e){OMe(e,"value",0),t?Eoe=e:xoe=e}function UMe(t,e,r,n){let i=NMe(e,n,r);if(i!=null){if(!CMe(i)||i<0){let o=n?`options.${r}`:"options.highWaterMark";throw new $Me(o,i)}return MMe(i)}return Soe(t.objectMode)}Aoe.exports={getHighWaterMark:UMe,getDefaultHighWaterMark:Soe,setDefaultHighWaterMark:jMe}});var hO=V((Kvt,koe)=>{"use strict";h();var Toe=ys(),{PromisePrototypeThen:qMe,SymbolAsyncIterator:Ioe,SymbolIterator:Poe}=Jn(),{Buffer:LMe}=Fn(),{ERR_INVALID_ARG_TYPE:KMe,ERR_STREAM_NULL_VALUES:FMe}=ia().codes;function zMe(t,e,r){let n;if(typeof e=="string"||e instanceof LMe)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[Ioe])i=!0,n=e[Ioe]();else if(e&&e[Poe])i=!1,n=e[Poe]();else throw new KMe("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...r}),s=!1;o._read=function(){s||(s=!0,d())},o._destroy=function(u,c){qMe(a(u),()=>Toe.nextTick(c,u),l=>Toe.nextTick(c,l||u))};async function a(u){let c=u!=null,l=typeof n.throw=="function";if(c&&l){let{value:m,done:p}=await n.throw(u);if(await m,p)return}if(typeof n.return=="function"){let{value:m}=await n.return();await m}}async function d(){for(;;){try{let{value:u,done:c}=i?await n.next():n.next();if(c)o.push(null);else{let l=u&&typeof u.then=="function"?await u:u;if(l===null)throw s=!1,new FMe;if(o.push(l))continue;s=!1}}catch(u){o.destroy(u)}break}}return o}koe.exports=zMe});var eE=V((zvt,Hoe)=>{h();var _u=ys(),{ArrayPrototypeIndexOf:WMe,NumberIsInteger:VMe,NumberIsNaN:HMe,NumberParseInt:GMe,ObjectDefineProperties:_O,ObjectKeys:JMe,ObjectSetPrototypeOf:Boe,Promise:Moe,SafeSet:YMe,SymbolAsyncDispose:ZMe,SymbolAsyncIterator:XMe,Symbol:QMe}=Jn();Hoe.exports=yr;yr.ReadableState=SA;var{EventEmitter:eCe}=lc(),{Stream:hm,prependListener:tCe}=vA(),{Buffer:pO}=Fn(),{addAbortSignal:rCe}=Zx(),Coe=ch(),Or=$s().debuglog("stream",t=>{Or=t}),nCe=_oe(),Mw=Z0(),{getHighWaterMark:iCe,getDefaultHighWaterMark:oCe}=Xx(),{aggregateTwoErrors:Roe,codes:{ERR_INVALID_ARG_TYPE:sCe,ERR_METHOD_NOT_IMPLEMENTED:aCe,ERR_OUT_OF_RANGE:cCe,ERR_STREAM_PUSH_AFTER_EOF:dCe,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:uCe},AbortError:lCe}=ia(),{validateObject:fCe}=kw(),X0=QMe("kPaused"),{StringDecoder:Ooe}=Ub(),hCe=hO();Boe(yr.prototype,hm.prototype);Boe(yr,hm);var mO=()=>{},{errorOrDestroy:Dw}=Mw,Bw=1,pCe=2,$oe=4,Qx=8,Noe=16,_A=32,xA=64,joe=128,mCe=256,yCe=512,gCe=1024,bO=2048,wO=4096,vCe=8192,bCe=16384,wCe=32768,Uoe=65536,_Ce=1<<17,xCe=1<<18;function Zi(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}_O(SA.prototype,{objectMode:Zi(Bw),ended:Zi(pCe),endEmitted:Zi($oe),reading:Zi(Qx),constructed:Zi(Noe),sync:Zi(_A),needReadable:Zi(xA),emittedReadable:Zi(joe),readableListening:Zi(mCe),resumeScheduled:Zi(yCe),errorEmitted:Zi(gCe),emitClose:Zi(bO),autoDestroy:Zi(wO),destroyed:Zi(vCe),closed:Zi(bCe),closeEmitted:Zi(wCe),multiAwaitDrain:Zi(Uoe),readingMore:Zi(_Ce),dataEmitted:Zi(xCe)});function SA(t,e,r){typeof r!="boolean"&&(r=e instanceof Bl()),this.state=bO|wO|Noe|_A,t&&t.objectMode&&(this.state|=Bw),r&&t&&t.readableObjectMode&&(this.state|=Bw),this.highWaterMark=t?iCe(this,t,"readableHighWaterMark",r):oCe(!1),this.buffer=new nCe,this.length=0,this.pipes=[],this.flowing=null,this[X0]=null,t&&t.emitClose===!1&&(this.state&=~bO),t&&t.autoDestroy===!1&&(this.state&=~wO),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Ooe(t.encoding),this.encoding=t.encoding)}function yr(t){if(!(this instanceof yr))return new yr(t);let e=this instanceof Bl();this._readableState=new SA(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&&rCe(t.signal,this)),hm.call(this,t),Mw.construct(this,()=>{this._readableState.needReadable&&EA(this,this._readableState)})}yr.prototype.destroy=Mw.destroy;yr.prototype._undestroy=Mw.undestroy;yr.prototype._destroy=function(t,e){e(t)};yr.prototype[eCe.captureRejectionSymbol]=function(t){this.destroy(t)};yr.prototype[ZMe]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new lCe,this.destroy(t)),new Moe((e,r)=>Coe(this,n=>n&&n!==t?r(n):e(null)))};yr.prototype.push=function(t,e){return qoe(this,t,e,!1)};yr.prototype.unshift=function(t,e){return qoe(this,t,e,!0)};function qoe(t,e,r,n){Or("readableAddChunk",e);let i=t._readableState,o;if(i.state&Bw||(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=pO.from(e,r).toString(i.encoding):(e=pO.from(e,r),r=""))):e instanceof pO?r="":hm._isUint8Array(e)?(e=hm._uint8ArrayToBuffer(e),r=""):e!=null&&(o=new sCe("chunk",["string","Buffer","Uint8Array"],e))),o)Dw(t,o);else if(e===null)i.state&=~Qx,ACe(t,i);else if(i.state&Bw||e&&e.length>0)if(n)if(i.state&$oe)Dw(t,new uCe);else{if(i.destroyed||i.errored)return!1;yO(t,i,e,!0)}else if(i.ended)Dw(t,new dCe);else{if(i.destroyed||i.errored)return!1;i.state&=~Qx,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?yO(t,i,e,!1):EA(t,i)):yO(t,i,e,!1)}else n||(i.state&=~Qx,EA(t,i));return!i.ended&&(i.length0?(e.state&Uoe?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.state&xA&&AA(t)),EA(t,e)}yr.prototype.isPaused=function(){let t=this._readableState;return t[X0]===!0||t.flowing===!1};yr.prototype.setEncoding=function(t){let e=new Ooe(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 ECe=1073741824;function SCe(t){if(t>ECe)throw new cCe("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Doe(t,e){return t<=0||e.length===0&&e.ended?0:e.state&Bw?1:HMe(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}yr.prototype.read=function(t){Or("read",t),t===void 0?t=NaN:VMe(t)||(t=GMe(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=SCe(t)),t!==0&&(e.state&=~joe),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Or("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?gO(this):AA(this),null;if(t=Doe(t,e),t===0&&e.ended)return e.length===0&&gO(this),null;let n=(e.state&xA)!==0;if(Or("need readable",n),(e.length===0||e.length-t0?i=Woe(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&&gO(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function ACe(t,e){if(Or("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?AA(t):(e.needReadable=!1,e.emittedReadable=!0,Loe(t))}}function AA(t){let e=t._readableState;Or("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Or("emitReadable",e.flowing),e.emittedReadable=!0,_u.nextTick(Loe,t))}function Loe(t){let e=t._readableState;Or("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,Foe(t)}function EA(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,_u.nextTick(TCe,t,e))}function TCe(t,e){for(;!e.reading&&!e.ended&&(e.length1&&n.pipes.includes(t)&&(Or("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),d||(d=ICe(r,t),t.on("drain",d))}r.on("data",m);function m(A){Or("ondata");let P=t.write(A);Or("dest.write",P),P===!1&&l()}function p(A){if(Or("onerror",A),E(),t.removeListener("error",p),t.listenerCount("error")===0){let P=t._writableState||t._readableState;P&&!P.errorEmitted?Dw(t,A):t.emit("error",A)}}tCe(t,"error",p);function g(){t.removeListener("finish",v),E()}t.once("close",g);function v(){Or("onfinish"),t.removeListener("close",g),E()}t.once("finish",v);function E(){Or("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?l():n.flowing||(Or("pipe resume"),r.resume()),t};function ICe(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(Or("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(Or("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}yr.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,Or("on readable",n.length,n.reading),n.length?AA(this):n.reading||_u.nextTick(PCe,this)),r};yr.prototype.addListener=yr.prototype.on;yr.prototype.removeListener=function(t,e){let r=hm.prototype.removeListener.call(this,t,e);return t==="readable"&&_u.nextTick(Koe,this),r};yr.prototype.off=yr.prototype.removeListener;yr.prototype.removeAllListeners=function(t){let e=hm.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&_u.nextTick(Koe,this),e};function Koe(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[X0]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function PCe(t){Or("readable nexttick read 0"),t.read(0)}yr.prototype.resume=function(){let t=this._readableState;return t.flowing||(Or("resume"),t.flowing=!t.readableListening,kCe(this,t)),t[X0]=!1,this};function kCe(t,e){e.resumeScheduled||(e.resumeScheduled=!0,_u.nextTick(RCe,t,e))}function RCe(t,e){Or("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Foe(t),e.flowing&&!e.reading&&t.read(0)}yr.prototype.pause=function(){return Or("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Or("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[X0]=!0,this};function Foe(t){let e=t._readableState;for(Or("flow",e.flowing);e.flowing&&t.read()!==null;);}yr.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=>{Dw(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=JMe(t);for(let n=1;n{i=s?Roe(i,s):null,r(),r=mO});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 Moe(n)}}}catch(s){throw i=Roe(i,s),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?Mw.destroyer(t,null):(t.off("readable",n),o())}}_O(yr.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}}});_O(SA.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[X0]!==!1},set(t){this[X0]=!!t}}});yr._fromList=Woe;function Woe(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 gO(t){let e=t._readableState;Or("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,_u.nextTick(BCe,e,t))}function BCe(t,e){if(Or("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)_u.nextTick(MCe,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function MCe(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}yr.from=function(t,e){return hCe(yr,t,e)};var vO;function Voe(){return vO===void 0&&(vO={}),vO}yr.fromWeb=function(t,e){return Voe().newStreamReadableFromReadableStream(t,e)};yr.toWeb=function(t,e){return Voe().newReadableStreamFromStreamReadable(t,e)};yr.wrap=function(t,e){var r,n;return new yr({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(i,o){Mw.destroyer(t,i),o(i)}}).wrap(t)}});var RA=V((Vvt,ose)=>{h();var Q0=ys(),{ArrayPrototypeSlice:Yoe,Error:CCe,FunctionPrototypeSymbolHasInstance:Zoe,ObjectDefineProperty:Xoe,ObjectDefineProperties:OCe,ObjectSetPrototypeOf:Qoe,StringPrototypeToLowerCase:$Ce,Symbol:NCe,SymbolHasInstance:jCe}=Jn();ose.exports=Yn;Yn.WritableState=nE;var{EventEmitter:UCe}=lc(),tE=vA().Stream,{Buffer:TA}=Fn(),kA=Z0(),{addAbortSignal:qCe}=Zx(),{getHighWaterMark:LCe,getDefaultHighWaterMark:KCe}=Xx(),{ERR_INVALID_ARG_TYPE:FCe,ERR_METHOD_NOT_IMPLEMENTED:zCe,ERR_MULTIPLE_CALLBACK:ese,ERR_STREAM_CANNOT_PIPE:WCe,ERR_STREAM_DESTROYED:rE,ERR_STREAM_ALREADY_FINISHED:VCe,ERR_STREAM_NULL_VALUES:HCe,ERR_STREAM_WRITE_AFTER_END:GCe,ERR_UNKNOWN_ENCODING:tse}=ia().codes,{errorOrDestroy:Cw}=kA;Qoe(Yn.prototype,tE.prototype);Qoe(Yn,tE);function SO(){}var Ow=NCe("kOnFinished");function nE(t,e,r){typeof r!="boolean"&&(r=e instanceof Bl()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?LCe(this,t,"writableHighWaterMark",r):KCe(!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=YCe.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,PA(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[Ow]=[]}function PA(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}nE.prototype.getBuffer=function(){return Yoe(this.buffered,this.bufferedIndex)};Xoe(nE.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function Yn(t){let e=this instanceof Bl();if(!e&&!Zoe(Yn,this))return new Yn(t);this._writableState=new nE(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&&qCe(t.signal,this)),tE.call(this,t),kA.construct(this,()=>{let r=this._writableState;r.writing||TO(this,r),IO(this,r)})}Xoe(Yn,jCe,{__proto__:null,value:function(t){return Zoe(this,t)?!0:this!==Yn?!1:t&&t._writableState instanceof nE}});Yn.prototype.pipe=function(){Cw(this,new WCe)};function rse(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"&&!TA.isEncoding(r))throw new tse(r);typeof n!="function"&&(n=SO)}if(e===null)throw new HCe;if(!i.objectMode)if(typeof e=="string")i.decodeStrings!==!1&&(e=TA.from(e,r),r="buffer");else if(e instanceof TA)r="buffer";else if(tE._isUint8Array(e))e=tE._uint8ArrayToBuffer(e),r="buffer";else throw new FCe("chunk",["string","Buffer","Uint8Array"],e);let o;return i.ending?o=new GCe:i.destroyed&&(o=new rE("write")),o?(Q0.nextTick(n,o),Cw(t,o,!0),o):(i.pendingcb++,JCe(t,i,e,r,n))}Yn.prototype.write=function(t,e,r){return rse(this,t,e,r)===!0};Yn.prototype.cork=function(){this._writableState.corked++};Yn.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||TO(this,t))};Yn.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=$Ce(e)),!TA.isEncoding(e))throw new tse(e);return this._writableState.defaultEncoding=e,this};function JCe(t,e,r,n,i){let o=e.objectMode?1:r.length;e.length+=o;let s=e.lengthr.bufferedIndex&&TO(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},Q0.nextTick(ZCe,r.afterWriteTickInfo)):nse(t,r,1,i))}function ZCe({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,nse(t,e,r,n)}function nse(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&&AO(e),IO(t,e)}function AO(t){if(t.writing)return;for(let i=t.bufferedIndex;i1&&t._writev){e.pendingcb-=o-1;let a=e.allNoop?SO:u=>{for(let c=s;c256?(r.splice(0,s),e.bufferedIndex=0):e.bufferedIndex=s}e.bufferProcessing=!1}Yn.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new zCe("_write()")};Yn.prototype._writev=null;Yn.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=rse(this,t,e);o instanceof CCe&&(i=o)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,IO(this,n,!0),n.ended=!0):n.finished?i=new VCe("end"):n.destroyed&&(i=new rE("end"))),typeof r=="function"&&(i||n.finished?Q0.nextTick(r,i):n[Ow].push(r)),this};function IA(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 XCe(t,e){let r=!1;function n(i){if(r){Cw(t,i??ese());return}if(r=!0,e.pendingcb--,i){let o=e[Ow].splice(0);for(let s=0;s{IA(i)?EO(n,i):i.pendingcb--},t,e)):IA(e)&&(e.pendingcb++,EO(t,e))))}function EO(t,e){e.pendingcb--,e.finished=!0;let r=e[Ow].splice(0);for(let n=0;n{h();var PO=ys(),tOe=Fn(),{isReadable:rOe,isWritable:nOe,isIterable:sse,isNodeStream:iOe,isReadableNodeStream:ase,isWritableNodeStream:cse,isDuplexNodeStream:oOe,isReadableStream:dse,isWritableStream:use}=Rl(),lse=ch(),{AbortError:gse,codes:{ERR_INVALID_ARG_TYPE:sOe,ERR_INVALID_RETURN_VALUE:fse}}=ia(),{destroyer:Nw}=Z0(),aOe=Bl(),vse=eE(),cOe=RA(),{createDeferredPromise:hse}=$s(),pse=hO(),mse=globalThis.Blob||tOe.Blob,dOe=typeof mse<"u"?function(e){return e instanceof mse}:function(e){return!1},uOe=globalThis.AbortController||ah().AbortController,{FunctionPrototypeCall:yse}=Jn(),pm=class extends aOe{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)}};bse.exports=function t(e,r){if(oOe(e))return e;if(ase(e))return $w({readable:e});if(cse(e))return $w({writable:e});if(iOe(e))return $w({writable:!1,readable:!1});if(dse(e))return $w({readable:vse.fromWeb(e)});if(use(e))return $w({writable:cOe.fromWeb(e)});if(typeof e=="function"){let{value:i,write:o,final:s,destroy:a}=lOe(e);if(sse(i))return pse(pm,i,{objectMode:!0,write:o,final:s,destroy:a});let d=i?.then;if(typeof d=="function"){let u,c=yse(d,i,l=>{if(l!=null)throw new fse("nully","body",l)},l=>{Nw(u,l)});return u=new pm({objectMode:!0,readable:!1,write:o,final(l){s(async()=>{try{await c,PO.nextTick(l,null)}catch(m){PO.nextTick(l,m)}})},destroy:a})}throw new fse("Iterable, AsyncIterable or AsyncFunction",r,i)}if(dOe(e))return t(e.arrayBuffer());if(sse(e))return pse(pm,e,{objectMode:!0,writable:!1});if(dse(e?.readable)&&use(e?.writable))return pm.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?ase(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?cse(e?.writable)?e?.writable:t(e.writable):void 0;return $w({readable:i,writable:o})}let n=e?.then;if(typeof n=="function"){let i;return yse(n,e,o=>{o!=null&&i.push(o),i.push(null)},o=>{Nw(i,o)}),i=new pm({objectMode:!0,writable:!1,read(){}})}throw new sOe(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function lOe(t){let{promise:e,resolve:r}=hse(),n=new uOe,i=n.signal;return{value:t(async function*(){for(;;){let s=e;e=null;let{chunk:a,done:d,cb:u}=await s;if(PO.nextTick(u),d)return;if(i.aborted)throw new gse(void 0,{cause:i.reason});({promise:e,resolve:r}=hse()),yield a}}(),{signal:i}),write(s,a,d){let u=r;r=null,u({chunk:s,done:!1,cb:d})},final(s){let a=r;r=null,a({done:!0,cb:s})},destroy(s,a){n.abort(),a(s)}}}function $w(t){let e=t.readable&&typeof t.readable.read!="function"?vse.wrap(t.readable):t.readable,r=t.writable,n=!!rOe(e),i=!!nOe(r),o,s,a,d,u;function c(l){let m=d;d=null,m?m(l):l&&u.destroy(l)}return u=new pm({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:i}),i&&(lse(r,l=>{i=!1,l&&Nw(e,l),c(l)}),u._write=function(l,m,p){r.write(l,m)?p():o=p},u._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&&(lse(e,l=>{n=!1,l&&Nw(e,l),c(l)}),e.on("readable",function(){if(a){let l=a;a=null,l()}}),e.on("end",function(){u.push(null)}),u._read=function(){for(;;){let l=e.read();if(l===null){a=u._read;return}if(!u.push(l))return}}),u._destroy=function(l,m){!l&&d!==null&&(l=new gse),a=null,o=null,s=null,d===null?m(l):(d=m,Nw(r,l),Nw(e,l))},u}});var Bl=V((Yvt,Ese)=>{"use strict";h();var{ObjectDefineProperties:fOe,ObjectGetOwnPropertyDescriptor:dh,ObjectKeys:hOe,ObjectSetPrototypeOf:_se}=Jn();Ese.exports=xu;var DO=eE(),gd=RA();_se(xu.prototype,DO.prototype);_se(xu,DO);{let t=hOe(gd.prototype);for(let e=0;e{"use strict";h();var{ObjectSetPrototypeOf:Sse,Symbol:pOe}=Jn();Ase.exports=uh;var{ERR_METHOD_NOT_IMPLEMENTED:mOe}=ia().codes,MO=Bl(),{getHighWaterMark:yOe}=Xx();Sse(uh.prototype,MO.prototype);Sse(uh,MO);var iE=pOe("kCallback");function uh(t){if(!(this instanceof uh))return new uh(t);let e=t?yOe(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),MO.call(this,t),this._readableState.sync=!1,this[iE]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",gOe)}function BO(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 gOe(){this._final!==BO&&BO.call(this)}uh.prototype._final=BO;uh.prototype._transform=function(t,e,r){throw new mOe("_transform()")};uh.prototype._write=function(t,e,r){let n=this._readableState,i=this._writableState,o=n.length;this._transform(t,e,(s,a)=>{if(s){r(s);return}a!=null&&this.push(a),i.ended||o===n.length||n.length{"use strict";h();var{ObjectSetPrototypeOf:Tse}=Jn();Ise.exports=jw;var OO=CO();Tse(jw.prototype,OO.prototype);Tse(jw,OO);function jw(t){if(!(this instanceof jw))return new jw(t);OO.call(this,t)}jw.prototype._transform=function(t,e,r){r(null,t)}});var CA=V((rbt,Bse)=>{h();var oE=ys(),{ArrayIsArray:vOe,Promise:bOe,SymbolAsyncIterator:wOe,SymbolDispose:_Oe}=Jn(),MA=ch(),{once:xOe}=$s(),EOe=Z0(),Pse=Bl(),{aggregateTwoErrors:SOe,codes:{ERR_INVALID_ARG_TYPE:WO,ERR_INVALID_RETURN_VALUE:NO,ERR_MISSING_ARGS:AOe,ERR_STREAM_DESTROYED:TOe,ERR_STREAM_PREMATURE_CLOSE:IOe},AbortError:POe}=ia(),{validateFunction:kOe,validateAbortSignal:ROe}=kw(),{isIterable:eg,isReadable:jO,isReadableNodeStream:BA,isNodeStream:kse,isTransformStream:Uw,isWebStream:DOe,isReadableStream:UO,isReadableFinished:BOe}=Rl(),MOe=globalThis.AbortController||ah().AbortController,qO,LO,KO;function Rse(t,e,r){let n=!1;t.on("close",()=>{n=!0});let i=MA(t,{readable:e,writable:r},o=>{n=!o});return{destroy:o=>{n||(n=!0,EOe.destroyer(t,o||new TOe("pipe")))},cleanup:i}}function COe(t){return kOe(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function FO(t){if(eg(t))return t;if(BA(t))return OOe(t);throw new WO("val",["Readable","Iterable","AsyncIterable"],t)}async function*OOe(t){LO||(LO=eE()),yield*LO.prototype[wOe].call(t)}async function DA(t,e,r,{end:n}){let i,o=null,s=u=>{if(u&&(i=u),o){let c=o;o=null,c()}},a=()=>new bOe((u,c)=>{i?c(i):o=()=>{i?c(i):u()}});e.on("drain",s);let d=MA(e,{readable:!1},s);try{e.writableNeedDrain&&await a();for await(let u of t)e.write(u)||await a();n&&(e.end(),await a()),r()}catch(u){r(i!==u?SOe(i,u):u)}finally{d(),e.off("drain",s)}}async function zO(t,e,r,{end:n}){Uw(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 $Oe(...t){return Dse(t,xOe(COe(t)))}function Dse(t,e,r){if(t.length===1&&vOe(t[0])&&(t=t[0]),t.length<2)throw new AOe("streams");let n=new MOe,i=n.signal,o=r?.signal,s=[];ROe(o,"options.signal");function a(){g(new POe)}KO=KO||$s().addAbortListener;let d;o&&(d=KO(o,a));let u,c,l=[],m=0;function p(I){g(I,--m===0)}function g(I,$){var N;if(I&&(!u||u.code==="ERR_STREAM_PREMATURE_CLOSE")&&(u=I),!(!u&&!$)){for(;l.length;)l.shift()(u);(N=d)===null||N===void 0||N[_Oe](),n.abort(),$&&(u||s.forEach(K=>K()),oE.nextTick(e,u,c))}}let v;for(let I=0;I0,F=N||r?.end!==!1,U=I===t.length-1;if(kse($)){let W=function(L){L&&L.name!=="AbortError"&&L.code!=="ERR_STREAM_PREMATURE_CLOSE"&&p(L)};var P=W;if(F){let{destroy:L,cleanup:T}=Rse($,N,K);l.push(L),jO($)&&U&&s.push(T)}$.on("error",W),jO($)&&U&&s.push(()=>{$.removeListener("error",W)})}if(I===0)if(typeof $=="function"){if(v=$({signal:i}),!eg(v))throw new NO("Iterable, AsyncIterable or Stream","source",v)}else eg($)||BA($)||Uw($)?v=$:v=Pse.from($);else if(typeof $=="function"){if(Uw(v)){var E;v=FO((E=v)===null||E===void 0?void 0:E.readable)}else v=FO(v);if(v=$(v,{signal:i}),N){if(!eg(v,!0))throw new NO("AsyncIterable",`transform[${I-1}]`,v)}else{var A;qO||(qO=$O());let W=new qO({objectMode:!0}),L=(A=v)===null||A===void 0?void 0:A.then;if(typeof L=="function")m++,L.call(v,k=>{c=k,k!=null&&W.write(k),F&&W.end(),oE.nextTick(p)},k=>{W.destroy(k),oE.nextTick(p,k)});else if(eg(v,!0))m++,DA(v,W,p,{end:F});else if(UO(v)||Uw(v)){let k=v.readable||v;m++,DA(k,W,p,{end:F})}else throw new NO("AsyncIterable or Promise","destination",v);v=W;let{destroy:T,cleanup:S}=Rse(v,!1,!0);l.push(T),U&&s.push(S)}}else if(kse($)){if(BA(v)){m+=2;let W=NOe(v,$,p,{end:F});jO($)&&U&&s.push(W)}else if(Uw(v)||UO(v)){let W=v.readable||v;m++,DA(W,$,p,{end:F})}else if(eg(v))m++,DA(v,$,p,{end:F});else throw new WO("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],v);v=$}else if(DOe($)){if(BA(v))m++,zO(FO(v),$,p,{end:F});else if(UO(v)||eg(v))m++,zO(v,$,p,{end:F});else if(Uw(v))m++,zO(v.readable,$,p,{end:F});else throw new WO("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],v);v=$}else v=Pse.from($)}return(i!=null&&i.aborted||o!=null&&o.aborted)&&oE.nextTick(a),v}function NOe(t,e,r,{end:n}){let i=!1;if(e.on("close",()=>{i||r(new IOe)}),t.pipe(e,{end:!1}),n){let s=function(){i=!0,e.end()};var o=s;BOe(t)?oE.nextTick(s):t.once("end",s)}else r();return MA(t,{readable:!0,writable:!1},s=>{let a=t._readableState;s&&s.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted?t.once("end",r).once("error",r):r(s)}),MA(e,{readable:!1,writable:!0},r)}Bse.exports={pipelineImpl:Dse,pipeline:$Oe}});var HO=V((ibt,jse)=>{"use strict";h();var{pipeline:jOe}=CA(),OA=Bl(),{destroyer:UOe}=Z0(),{isNodeStream:$A,isReadable:Mse,isWritable:Cse,isWebStream:VO,isTransformStream:tg,isWritableStream:Ose,isReadableStream:$se}=Rl(),{AbortError:qOe,codes:{ERR_INVALID_ARG_VALUE:Nse,ERR_MISSING_ARGS:LOe}}=ia(),KOe=ch();jse.exports=function(...e){if(e.length===0)throw new LOe("streams");if(e.length===1)return OA.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=OA.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=OA.from(e[p])}for(let p=0;p0&&!(Cse(e[p])||Ose(e[p])||tg(e[p])))throw new Nse(`streams[${p}]`,r[p],"must be writable")}let n,i,o,s,a;function d(p){let g=s;s=null,g?g(p):p?a.destroy(p):!m&&!l&&a.destroy()}let u=e[0],c=jOe(e,d),l=!!(Cse(u)||Ose(u)||tg(u)),m=!!(Mse(c)||$se(c)||tg(c));if(a=new OA({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:l,readable:m}),l){if($A(u))a._write=function(g,v,E){u.write(g,v)?E():n=E},a._final=function(g){u.end(),i=g},u.on("drain",function(){if(n){let g=n;n=null,g()}});else if(VO(u)){let v=(tg(u)?u.writable:u).getWriter();a._write=async function(E,A,P){try{await v.ready,v.write(E).catch(()=>{}),P()}catch(I){P(I)}},a._final=async function(E){try{await v.ready,v.close().catch(()=>{}),i=E}catch(A){E(A)}}}let p=tg(c)?c.readable:c;KOe(p,()=>{if(i){let g=i;i=null,g()}})}if(m){if($A(c))c.on("readable",function(){if(o){let p=o;o=null,p()}}),c.on("end",function(){a.push(null)}),a._read=function(){for(;;){let p=c.read();if(p===null){o=a._read;return}if(!a.push(p))return}};else if(VO(c)){let g=(tg(c)?c.readable:c).getReader();a._read=async function(){for(;;)try{let{value:v,done:E}=await g.read();if(!a.push(v))return;if(E){a.push(null);return}}catch{return}}}}return a._destroy=function(p,g){!p&&s!==null&&(p=new qOe),o=null,n=null,i=null,s===null?g(p):(s=g,$A(c)&&UOe(c,p))},a}});var Gse=V((sbt,YO)=>{"use strict";h();var FOe=globalThis.AbortController||ah().AbortController,{codes:{ERR_INVALID_ARG_VALUE:zOe,ERR_INVALID_ARG_TYPE:sE,ERR_MISSING_ARGS:WOe,ERR_OUT_OF_RANGE:VOe},AbortError:Ml}=ia(),{validateAbortSignal:rg,validateInteger:Use,validateObject:ng}=kw(),HOe=Jn().Symbol("kWeak"),GOe=Jn().Symbol("kResistStopPropagation"),{finished:JOe}=ch(),YOe=HO(),{addAbortSignalNoValidate:ZOe}=Zx(),{isWritable:XOe,isNodeStream:QOe}=Rl(),{deprecate:e$e}=$s(),{ArrayPrototypePush:t$e,Boolean:r$e,MathFloor:qse,Number:n$e,NumberIsNaN:i$e,Promise:Lse,PromiseReject:Kse,PromiseResolve:o$e,PromisePrototypeThen:Fse,Symbol:Wse}=Jn(),NA=Wse("kEmpty"),zse=Wse("kEof");function s$e(t,e){if(e!=null&&ng(e,"options"),e?.signal!=null&&rg(e.signal,"options.signal"),QOe(t)&&!XOe(t))throw new zOe("stream",t,"must be writable");let r=YOe(this,t);return e!=null&&e.signal&&ZOe(e.signal,r),r}function jA(t,e){if(typeof t!="function")throw new sE("fn",["Function","AsyncFunction"],t);e!=null&&ng(e,"options"),e?.signal!=null&&rg(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=qse(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=qse(e.highWaterMark)),Use(r,"options.concurrency",1),Use(n,"options.highWaterMark",0),n+=r,(async function*(){let o=$s().AbortSignalAny([e?.signal].filter(r$e)),s=this,a=[],d={signal:o},u,c,l=!1,m=0;function p(){l=!0,g()}function g(){m-=1,v()}function v(){c&&!l&&m=n||m>=r)&&await new Lse(P=>{c=P})}a.push(zse)}catch(A){let P=Kse(A);Fse(P,g,p),a.push(P)}finally{l=!0,u&&(u(),u=null)}}E();try{for(;;){for(;a.length>0;){let A=await a[0];if(A===zse)return;if(o.aborted)throw new Ml;A!==NA&&(yield A),a.shift(),v()}await new Lse(A=>{u=A})}}finally{l=!0,c&&(c(),c=null)}}).call(this)}function a$e(t=void 0){return t!=null&&ng(t,"options"),t?.signal!=null&&rg(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 Ml({cause:t.signal.reason});yield[r++,i]}}).call(this)}async function Vse(t,e=void 0){for await(let r of JO.call(this,t,e))return!0;return!1}async function c$e(t,e=void 0){if(typeof t!="function")throw new sE("fn",["Function","AsyncFunction"],t);return!await Vse.call(this,async(...r)=>!await t(...r),e)}async function d$e(t,e){for await(let r of JO.call(this,t,e))return r}async function u$e(t,e){if(typeof t!="function")throw new sE("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),NA}for await(let n of jA.call(this,r,e));}function JO(t,e){if(typeof t!="function")throw new sE("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:NA}return jA.call(this,r,e)}var GO=class extends WOe{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function l$e(t,e,r){var n;if(typeof t!="function")throw new sE("reducer",["Function","AsyncFunction"],t);r!=null&&ng(r,"options"),r?.signal!=null&&rg(r.signal,"options.signal");let i=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let u=new Ml(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await JOe(this.destroy(u)),u}let o=new FOe,s=o.signal;if(r!=null&&r.signal){let u={once:!0,[HOe]:this,[GOe]:!0};r.signal.addEventListener("abort",()=>o.abort(),u)}let a=!1;try{for await(let u of this){var d;if(a=!0,r!=null&&(d=r.signal)!==null&&d!==void 0&&d.aborted)throw new Ml;i?e=await t(e,u,{signal:s}):(e=u,i=!0)}if(!a&&!i)throw new GO}finally{o.abort()}return e}async function f$e(t){t!=null&&ng(t,"options"),t?.signal!=null&&rg(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 Ml(void 0,{cause:t.signal.reason});t$e(e,n)}return e}function h$e(t,e){let r=jA.call(this,t,e);return(async function*(){for await(let i of r)yield*i}).call(this)}function Hse(t){if(t=n$e(t),i$e(t))return 0;if(t<0)throw new VOe("number",">= 0",t);return t}function p$e(t,e=void 0){return e!=null&&ng(e,"options"),e?.signal!=null&&rg(e.signal,"options.signal"),t=Hse(t),(async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ml;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Ml;t--<=0&&(yield o)}}).call(this)}function m$e(t,e=void 0){return e!=null&&ng(e,"options"),e?.signal!=null&&rg(e.signal,"options.signal"),t=Hse(t),(async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ml;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Ml;if(t-- >0&&(yield o),t<=0)return}}).call(this)}YO.exports.streamReturningOperators={asIndexedPairs:e$e(a$e,"readable.asIndexedPairs will be removed in a future version."),drop:p$e,filter:JO,flatMap:h$e,map:jA,take:m$e,compose:s$e};YO.exports.promiseReturningOperators={every:c$e,forEach:u$e,reduce:l$e,toArray:f$e,some:Vse,find:d$e}});var ZO=V((cbt,Jse)=>{"use strict";h();var{ArrayPrototypePop:y$e,Promise:g$e}=Jn(),{isIterable:v$e,isNodeStream:b$e,isWebStream:w$e}=Rl(),{pipelineImpl:_$e}=CA(),{finished:x$e}=ch();XO();function E$e(...t){return new g$e((e,r)=>{let n,i,o=t[t.length-1];if(o&&typeof o=="object"&&!b$e(o)&&!v$e(o)&&!w$e(o)){let s=y$e(t);n=s.signal,i=s.end}_$e(t,(s,a)=>{s?r(s):e(a)},{signal:n,end:i})})}Jse.exports={finished:x$e,pipeline:E$e}});var XO=V((ubt,iae)=>{h();var{Buffer:S$e}=Fn(),{ObjectDefineProperty:lh,ObjectKeys:Xse,ReflectApply:Qse}=Jn(),{promisify:{custom:eae}}=$s(),{streamReturningOperators:Yse,promiseReturningOperators:Zse}=Gse(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:tae}}=ia(),A$e=HO(),{setDefaultHighWaterMark:T$e,getDefaultHighWaterMark:I$e}=Xx(),{pipeline:rae}=CA(),{destroyer:P$e}=Z0(),nae=ch(),QO=ZO(),aE=Rl(),$n=iae.exports=vA().Stream;$n.isDestroyed=aE.isDestroyed;$n.isDisturbed=aE.isDisturbed;$n.isErrored=aE.isErrored;$n.isReadable=aE.isReadable;$n.isWritable=aE.isWritable;$n.Readable=eE();for(let t of Xse(Yse)){let r=function(...n){if(new.target)throw tae();return $n.Readable.from(Qse(e,this,n))};e$=r;let e=Yse[t];lh(r,"name",{__proto__:null,value:e.name}),lh(r,"length",{__proto__:null,value:e.length}),lh($n.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var e$;for(let t of Xse(Zse)){let r=function(...i){if(new.target)throw tae();return Qse(e,this,i)};e$=r;let e=Zse[t];lh(r,"name",{__proto__:null,value:e.name}),lh(r,"length",{__proto__:null,value:e.length}),lh($n.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var e$;$n.Writable=RA();$n.Duplex=Bl();$n.Transform=CO();$n.PassThrough=$O();$n.pipeline=rae;var{addAbortSignal:k$e}=Zx();$n.addAbortSignal=k$e;$n.finished=nae;$n.destroy=P$e;$n.compose=A$e;$n.setDefaultHighWaterMark=T$e;$n.getDefaultHighWaterMark=I$e;lh($n,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return QO}});lh(rae,eae,{__proto__:null,enumerable:!0,get(){return QO.pipeline}});lh(nae,eae,{__proto__:null,enumerable:!0,get(){return QO.finished}});$n.Stream=$n;$n._isUint8Array=function(e){return e instanceof Uint8Array};$n._uint8ArrayToBuffer=function(e){return S$e.from(e.buffer,e.byteOffset,e.byteLength)}});var UA=V((fbt,Ai)=>{"use strict";h();var Xi=XO(),R$e=ZO(),D$e=Xi.Readable.destroy;Ai.exports=Xi.Readable;Ai.exports._uint8ArrayToBuffer=Xi._uint8ArrayToBuffer;Ai.exports._isUint8Array=Xi._isUint8Array;Ai.exports.isDisturbed=Xi.isDisturbed;Ai.exports.isErrored=Xi.isErrored;Ai.exports.isReadable=Xi.isReadable;Ai.exports.Readable=Xi.Readable;Ai.exports.Writable=Xi.Writable;Ai.exports.Duplex=Xi.Duplex;Ai.exports.Transform=Xi.Transform;Ai.exports.PassThrough=Xi.PassThrough;Ai.exports.addAbortSignal=Xi.addAbortSignal;Ai.exports.finished=Xi.finished;Ai.exports.destroy=Xi.destroy;Ai.exports.destroy=D$e;Ai.exports.pipeline=Xi.pipeline;Ai.exports.compose=Xi.compose;Object.defineProperty(Xi,"promises",{configurable:!0,enumerable:!0,get(){return R$e}});Ai.exports.Stream=Xi.Stream;Ai.exports.default=Ai.exports});var cae=V((o$,s$)=>{h();(function(t,e){typeof o$=="object"&&typeof s$<"u"?s$.exports=e():typeof define=="function"&&define.amd?define(e):(t=t||self,t.JSBI=e())})(o$,function(){"use strict";var t=Math.imul,e=Math.clz32;function r(U){"@babel/helpers - typeof";return r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(W){return typeof W}:function(W){return W&&typeof Symbol=="function"&&W.constructor===Symbol&&W!==Symbol.prototype?"symbol":typeof W},r(U)}function n(U,W){if(!(U instanceof W))throw new TypeError("Cannot call a class as a function")}function i(U,W){for(var L,T=0;T"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function c(){return c=u()?Reflect.construct:function(U,W,L){var T=[null];T.push.apply(T,W);var S=Function.bind.apply(U,T),k=new S;return L&&d(k,L.prototype),k},c.apply(null,arguments)}function l(U){return Function.toString.call(U).indexOf("[native code]")!==-1}function m(U){var W=typeof Map=="function"?new Map:void 0;return m=function(L){function T(){return c(L,arguments,a(this).constructor)}if(L===null||!l(L))return L;if(typeof L!="function")throw new TypeError("Super expression must either be null or a function");if(typeof W<"u"){if(W.has(L))return W.get(L);W.set(L,T)}return T.prototype=Object.create(L.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}}),d(T,L)},m(U)}function p(U){if(U===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return U}function g(U,W){if(W&&(typeof W=="object"||typeof W=="function"))return W;if(W!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return p(U)}function v(U){var W=u();return function(){var L,T=a(U);if(W){var S=a(this).constructor;L=Reflect.construct(T,arguments,S)}else L=T.apply(this,arguments);return g(this,L)}}function E(U,W){return A(U)||P(U,W)||I(U,W)||N()}function A(U){if(Array.isArray(U))return U}function P(U,W){var L=U==null?null:typeof Symbol<"u"&&U[Symbol.iterator]||U["@@iterator"];if(L!=null){var T,S,k=[],f=!0,y=!1;try{for(L=L.call(U);!(f=(T=L.next()).done)&&(k.push(T.value),!(W&&k.length===W));f=!0);}catch(w){y=!0,S=w}finally{try{f||L.return==null||L.return()}finally{if(y)throw S}}return k}}function I(U,W){if(U){if(typeof U=="string")return $(U,W);var L=Object.prototype.toString.call(U).slice(8,-1);return L==="Object"&&U.constructor&&(L=U.constructor.name),L==="Map"||L==="Set"?Array.from(U):L==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(L)?$(U,W):void 0}}function $(U,W){(W==null||W>U.length)&&(W=U.length);for(var L=0,T=Array(W);L=U.length?{done:!0}:{done:!1,value:U[T++]}},e:function(w){throw w},f:S}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var k,f=!0,y=!1;return{s:function(){L=L.call(U)},n:function(){var w=L.next();return f=w.done,w},e:function(w){y=!0,k=w},f:function(){try{f||L.return==null||L.return()}finally{if(y)throw k}}}}var F=function(U){var W=Math.abs,L=Math.max,T=Math.floor;function S(f,y){var w;if(n(this,S),w=k.call(this,f),w.sign=y,Object.setPrototypeOf(p(w),S.prototype),f>S.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return w}s(S,U);var k=v(S);return o(S,[{key:"toDebugString",value:function(){var f,y=["BigInt["],w=K(this);try{for(w.s();!(f=w.n()).done;){var _=f.value;y.push((_&&(_>>>0).toString(16))+", ")}}catch(x){w.e(x)}finally{w.f()}return y.push("]"),y.join("")}},{key:"toString",value:function(){var f=0f||36this.length&&(w=this.length);for(var _=32767&f,x=f>>>15,b=0,B=y,q=0;q>>15,Z=S.__imul(j,_),G=S.__imul(j,x),H=S.__imul(J,_),X=S.__imul(J,x),ee=B+Z+b;b=ee>>>30,ee&=1073741823,ee+=((32767&G)<<15)+((32767&H)<<15),b+=ee>>>30,B=X+(G>>>15)+(H>>>15),this.__setDigit(q,1073741823&ee)}if(b!==0||B!==0)throw new Error("implementation bug")}},{key:"__inplaceAdd",value:function(f,y,w){for(var _,x=0,b=0;b>>15,this.__setHalfDigit(y+b,32767&_);return x}},{key:"__inplaceSub",value:function(f,y,w){var _=0;if(1&y){y>>=1;for(var x=this.__digit(y),b=32767&x,B=0;B>>1;B++){var q=f.__digit(B),M=(x>>>15)-(32767&q)-_;_=1&M>>>15,this.__setDigit(y+B,(32767&M)<<15|32767&b),x=this.__digit(y+B+1),b=(32767&x)-(q>>>15)-_,_=1&b>>>15}var j=f.__digit(B),J=(x>>>15)-(32767&j)-_;if(_=1&J>>>15,this.__setDigit(y+B,(32767&J)<<15|32767&b),y+B+1>=this.length)throw new RangeError("out of bounds");!(1&w)&&(x=this.__digit(y+B+1),b=(32767&x)-(j>>>15)-_,_=1&b>>>15,this.__setDigit(y+f.length,1073709056&x|32767&b))}else{y>>=1;for(var Z=0;Z>>15;var ee=(G>>>15)-(H>>>15)-_;_=1&ee>>>15,this.__setDigit(y+Z,(32767&ee)<<15|32767&X)}var ue=this.__digit(y+Z),ae=f.__digit(Z),ce=(32767&ue)-(32767&ae)-_;_=1&ce>>>15;var me=0;!(1&w)&&(me=(ue>>>15)-(ae>>>15)-_,_=1&me>>>15),this.__setDigit(y+Z,(32767&me)<<15|32767&ce)}return _}},{key:"__inplaceRightShift",value:function(f){if(f!==0){for(var y,w=this.__digit(0)>>>f,_=this.length-1,x=0;x<_;x++)y=this.__digit(x+1),this.__setDigit(x,1073741823&y<<30-f|w),w=y>>>f;this.__setDigit(_,w)}}},{key:"__digit",value:function(f){return this[f]}},{key:"__unsignedDigit",value:function(f){return this[f]>>>0}},{key:"__setDigit",value:function(f,y){this[f]=0|y}},{key:"__setDigitGrow",value:function(f,y){this[f]=0|y}},{key:"__halfDigitLength",value:function(){var f=this.length;return 32767>=this.__unsignedDigit(f-1)?2*f-1:2*f}},{key:"__halfDigit",value:function(f){return 32767&this[f>>>1]>>>15*(1&f)}},{key:"__setHalfDigit",value:function(f,y){var w=f>>>1,_=this.__digit(w),x=1&f?32767&_|y<<15:1073709056&_|32767&y;this.__setDigit(w,x)}}],[{key:"BigInt",value:function(f){var y=Number.isFinite;if(typeof f=="number"){if(f===0)return S.__zero();if(S.__isOneDigitInt(f))return 0>f?S.__oneDigit(-f,!0):S.__oneDigit(f,!1);if(!y(f)||T(f)!==f)throw new RangeError("The number "+f+" cannot be converted to BigInt because it is not an integer");return S.__fromDouble(f)}if(typeof f=="string"){var w=S.__fromString(f);if(w===null)throw new SyntaxError("Cannot convert "+f+" to a BigInt");return w}if(typeof f=="boolean")return f===!0?S.__oneDigit(1,!1):S.__zero();if(r(f)==="object"){if(f.constructor===S)return f;var _=S.__toPrimitive(f);return S.BigInt(_)}throw new TypeError("Cannot convert "+f+" to a BigInt")}},{key:"toNumber",value:function(f){var y=f.length;if(y===0)return 0;if(y===1){var w=f.__unsignedDigit(0);return f.sign?-w:w}var _=f.__digit(y-1),x=S.__clz30(_),b=30*y-x;if(1024>>=12;var Z=j-12,G=12<=j?0:q<<20+j,H=20+j;for(0>>30-Z,G=q<>>30-H,H-=30;var X=S.__decideRounding(f,H,M,q);if((X===1||X===0&&(1&G)==1)&&(G=G+1>>>0,G===0&&(J++,J>>>20!=0&&(J=0,B++,1023=S.__kMaxLengthBits)throw new RangeError("BigInt too big");if(f.length===1&&f.__digit(0)===2){var _=1+(0|w/30),x=f.sign&&(1&w)!=0,b=new S(_,x);b.__initializeDigits();var B=1<>=1;w!==0;w>>=1)M=S.multiply(M,M),1&w&&(q===null?q=M:q=S.multiply(q,M));return q}},{key:"multiply",value:function(f,y){if(f.length===0)return f;if(y.length===0)return y;var w=f.length+y.length;30<=f.__clzmsd()+y.__clzmsd()&&w--;var _=new S(w,f.sign!==y.sign);_.__initializeDigits();for(var x=0;xS.__absoluteCompare(f,y))return S.__zero();var w,_=f.sign!==y.sign,x=y.__unsignedDigit(0);if(y.length===1&&32767>=x){if(x===1)return _===f.sign?f:S.unaryMinus(f);w=S.__absoluteDivSmall(f,x,null)}else w=S.__absoluteDivLarge(f,y,!0,!1);return w.sign=_,w.__trim()}},{key:"remainder",value:function(y,w){if(w.length===0)throw new RangeError("Division by zero");if(0>S.__absoluteCompare(y,w))return y;var _=w.__unsignedDigit(0);if(w.length===1&&32767>=_){if(_===1)return S.__zero();var x=S.__absoluteModSmall(y,_);return x===0?S.__zero():S.__oneDigit(x,y.sign)}var b=S.__absoluteDivLarge(y,w,!1,!0);return b.sign=y.sign,b.__trim()}},{key:"add",value:function(f,y){var w=f.sign;return w===y.sign?S.__absoluteAdd(f,y,w):0<=S.__absoluteCompare(f,y)?S.__absoluteSub(f,y,w):S.__absoluteSub(y,f,!w)}},{key:"subtract",value:function(f,y){var w=f.sign;return w===y.sign?0<=S.__absoluteCompare(f,y)?S.__absoluteSub(f,y,w):S.__absoluteSub(y,f,!w):S.__absoluteAdd(f,y,w)}},{key:"leftShift",value:function(f,y){return y.length===0||f.length===0?f:y.sign?S.__rightShiftByAbsolute(f,y):S.__leftShiftByAbsolute(f,y)}},{key:"signedRightShift",value:function(f,y){return y.length===0||f.length===0?f:y.sign?S.__leftShiftByAbsolute(f,y):S.__rightShiftByAbsolute(f,y)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(f,y){return 0>S.__compareToBigInt(f,y)}},{key:"lessThanOrEqual",value:function(f,y){return 0>=S.__compareToBigInt(f,y)}},{key:"greaterThan",value:function(f,y){return 0f)throw new RangeError("Invalid value: not (convertible to) a safe integer");if(f===0)return S.__zero();if(f>=S.__kMaxLengthBits)return y;var w=0|(f+29)/30;if(y.lengthf)throw new RangeError("Invalid value: not (convertible to) a safe integer");if(f===0)return S.__zero();if(y.sign){if(f>S.__kMaxLengthBits)throw new RangeError("BigInt too big");return S.__truncateAndSubFromPowerOfTwo(f,y,!1)}if(f>=S.__kMaxLengthBits)return y;var w=0|(f+29)/30;if(y.length>>_))return y}return S.__truncateToNBits(f,y)}},{key:"ADD",value:function(f,y){if(f=S.__toPrimitive(f),y=S.__toPrimitive(y),typeof f=="string")return typeof y!="string"&&(y=y.toString()),f+y;if(typeof y=="string")return f.toString()+y;if(f=S.__toNumeric(f),y=S.__toNumeric(y),S.__isBigInt(f)&&S.__isBigInt(y))return S.add(f,y);if(typeof f=="number"&&typeof y=="number")return f+y;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(f,y){return S.__compare(f,y,0)}},{key:"LE",value:function(f,y){return S.__compare(f,y,1)}},{key:"GT",value:function(f,y){return S.__compare(f,y,2)}},{key:"GE",value:function(f,y){return S.__compare(f,y,3)}},{key:"EQ",value:function(f,y){for(;;){if(S.__isBigInt(f))return S.__isBigInt(y)?S.equal(f,y):S.EQ(y,f);if(typeof f=="number"){if(S.__isBigInt(y))return S.__equalToNumber(y,f);if(r(y)!=="object")return f==y;y=S.__toPrimitive(y)}else if(typeof f=="string"){if(S.__isBigInt(y))return f=S.__fromString(f),f!==null&&S.equal(f,y);if(r(y)!=="object")return f==y;y=S.__toPrimitive(y)}else if(typeof f=="boolean"){if(S.__isBigInt(y))return S.__equalToNumber(y,+f);if(r(y)!=="object")return f==y;y=S.__toPrimitive(y)}else if(r(f)==="symbol"){if(S.__isBigInt(y))return!1;if(r(y)!=="object")return f==y;y=S.__toPrimitive(y)}else if(r(f)==="object"){if(r(y)==="object"&&y.constructor!==S)return f==y;f=S.__toPrimitive(f)}else return f==y}}},{key:"NE",value:function(f,y){return!S.EQ(f,y)}},{key:"DataViewGetBigInt64",value:function(f,y){var w=2>>30),j.__setDigit(2,q>>>28),j.__trim()}},{key:"DataViewSetBigInt64",value:function(f,y,w){var _=3>>2,2y)x=-y-1;else{if(w===0)return-1;w--,_=f.__digit(w),x=29}var b=1<>>20,_=w-1023,x=(0|_/30)+1,b=new S(x,0>f),B=1048575&S.__kBitConversionInts[1]|1048576,q=S.__kBitConversionInts[0],M=20,j=_%30,J=0;if(j>>Z,B=B<<32-Z|q>>>Z,q<<=32-Z}else if(j===M)J=32,y=B,B=q,q=0;else{var G=j-M;J=32-G,y=B<>>32-G,B=q<>>2,B=B<<30|q>>>2,q<<=30):y=0,b.__setDigit(H,y);return b.__trim()}},{key:"__isWhitespace",value:function(f){return 13>=f&&9<=f||(159>=f?f==32:131071>=f?f==160||f==5760:196607>=f?(f&=131071,10>=f||f==40||f==41||f==47||f==95||f==4096):f==65279)}},{key:"__fromString",value:function(f){var y=11073741824/q)return null;var j=q*B+M>>>S.__kBitsPerCharTableShift,J=new S(0|(j+29)/30,!1),Z=10>y?y:10,G=10>>0>>0>>S.__kBitsPerCharTableShift)/30;J.__inplaceMultiplyAdd(ve,fe,Ce)}while(!me)}else{q>>=S.__kBitsPerCharTableShift;var H=[],X=[],ee=!1;do{for(var ue,ae=0,ce=0;;){if(ue=void 0,b-48>>>0>>0>>M-b)}if(x!==0){if(_>=f.length)throw new Error("implementation bug");f.__setDigit(_++,x)}for(;_>>1)+(85&_),_=(51&_>>>2)+(51&_),_=(15&_>>>4)+(15&_);var x=_,b=y-1,B=f.__digit(w-1),q=S.__clz30(B),M=0|(30*w-q+x-1)/x;if(f.sign&&M++,268435456>>ue,G=30-ue;G>=x;)j[J--]=S.__kConversionChars[Z&b],Z>>>=x,G-=x}var ae=(Z|B<>>x-G;Z!==0;)j[J--]=S.__kConversionChars[Z&b],Z>>>=x;if(f.sign&&(j[J--]="-"),J!==-1)throw new Error("implementation bug");return j.join("")}},{key:"__toStringGeneric",value:function(f,y,w){var _=f.length;if(_===0)return"";if(_===1){var x=f.__unsignedDigit(0).toString(y);return w===!1&&f.sign&&(x="-"+x),x}var b=30*_-S.__clz30(f.__digit(_-1)),B=S.__kMaxBitsPerChar[y],q=B-1,M=b*S.__kBitsPerCharTableMultiplier;M+=q-1,M=0|M/q;var j,J,Z=M+1>>1,G=S.exponentiate(S.__oneDigit(y,!1),S.__oneDigit(Z,!1)),H=G.__unsignedDigit(0);if(G.length===1&&32767>=H){j=new S(f.length,!1),j.__initializeDigits();for(var X,ee=0,ue=2*f.length-1;0<=ue;ue--)X=ee<<15|f.__halfDigit(ue),j.__setHalfDigit(ue,0|X/H),ee=0|X%H;J=ee.toString(y)}else{var ae=S.__absoluteDivLarge(f,G,!0,!0);j=ae.quotient;var ce=ae.remainder.__trim();J=S.__toStringGeneric(ce,y,!0)}j.__trim();for(var me=S.__toStringGeneric(j,y,!0);J.length_?S.__absoluteLess(w):0}},{key:"__compareToNumber",value:function(f,y){if(S.__isOneDigitInt(y)){var w=f.sign,_=0>y;if(w!==_)return S.__unequalSign(w);if(f.length===0){if(_)throw new Error("implementation bug");return y===0?0:-1}if(1x?S.__absoluteGreater(w):by)return S.__unequalSign(w);if(y===0)throw new Error("implementation bug: should be handled elsewhere");if(f.length===0)return-1;S.__kBitConversionDouble[0]=y;var _=2047&S.__kBitConversionInts[1]>>>20;if(_==2047)throw new Error("implementation bug: handled elsewhere");var x=_-1023;if(0>x)return S.__absoluteGreater(w);var b=f.length,B=f.__digit(b-1),q=S.__clz30(B),M=30*b-q,j=x+1;if(Mj)return S.__absoluteGreater(w);var J=1048576|1048575&S.__kBitConversionInts[1],Z=S.__kBitConversionInts[0],G=20,H=29-q;if(H!==(0|(M-1)%30))throw new Error("implementation bug");var X,ee=0;if(H>>ue,J=J<<32-ue|Z>>>ue,Z<<=32-ue}else if(H===G)ee=32,X=J,J=Z,Z=0;else{var ae=H-G;ee=32-ae,X=J<>>32-ae,J=Z<>>=0,X>>>=0,B>X)return S.__absoluteGreater(w);if(B>>2,J=J<<30|Z>>>2,Z<<=30):X=0;var me=f.__unsignedDigit(ce);if(me>X)return S.__absoluteGreater(w);if(mey&&f.__unsignedDigit(0)===W(y):S.__compareToDouble(f,y)===0}},{key:"__comparisonResultToBool",value:function(f,y){return y===0?0>f:y===1?0>=f:y===2?0y;case 3:return f>=y}if(S.__isBigInt(f)&&typeof y=="string")return y=S.__fromString(y),y!==null&&S.__comparisonResultToBool(S.__compareToBigInt(f,y),w);if(typeof f=="string"&&S.__isBigInt(y))return f=S.__fromString(f),f!==null&&S.__comparisonResultToBool(S.__compareToBigInt(f,y),w);if(f=S.__toNumeric(f),y=S.__toNumeric(y),S.__isBigInt(f)){if(S.__isBigInt(y))return S.__comparisonResultToBool(S.__compareToBigInt(f,y),w);if(typeof y!="number")throw new Error("implementation bug");return S.__comparisonResultToBool(S.__compareToNumber(f,y),w)}if(typeof f!="number")throw new Error("implementation bug");if(S.__isBigInt(y))return S.__comparisonResultToBool(S.__compareToNumber(y,f),2^w);if(typeof y!="number")throw new Error("implementation bug");return w===0?fy:w===3?f>=y:void 0}},{key:"__absoluteAdd",value:function(f,y,w){if(f.length>>30,b.__setDigit(q,1073741823&x);for(;q>>30,b.__setDigit(q,1073741823&M)}return q>>30,x.__setDigit(B,1073741823&_);for(;B>>30,x.__setDigit(B,1073741823&q)}return x.__trim()}},{key:"__absoluteAddOne",value:function(f,y){var w=2>>30,w.__setDigit(B,1073741823&x);return b!==0&&w.__setDigitGrow(_,1),w}},{key:"__absoluteSubOne",value:function(f,y){var w=f.length;y=y||w;for(var _,x=new S(y,!1),b=1,B=0;B>>30,x.__setDigit(B,1073741823&_);if(b!==0)throw new Error("implementation bug");for(var q=w;q_?0:f.__unsignedDigit(_)>y.__unsignedDigit(_)?1:-1}},{key:"__multiplyAccumulate",value:function(f,y,w,_){if(y!==0){for(var x=32767&y,b=y>>>15,B=0,q=0,M=0;M>>15,H=S.__imul(Z,x),X=S.__imul(Z,b),ee=S.__imul(G,x),ue=S.__imul(G,b);j+=q+H+B,B=j>>>30,j&=1073741823,j+=((32767&X)<<15)+((32767&ee)<<15),B+=j>>>30,q=ue+(X>>>15)+(ee>>>15),w.__setDigit(_,1073741823&j)}for(;B!==0||q!==0;_++){var ae=w.__digit(_);ae+=B+q,q=0,B=ae>>>30,w.__setDigit(_,1073741823&ae)}}}},{key:"__internalMultiplyAdd",value:function(f,y,w,_,x){for(var b=w,B=0,q=0;q<_;q++){var M=f.__digit(q),j=S.__imul(32767&M,y),J=S.__imul(M>>>15,y),Z=j+((32767&J)<<15)+B+b;b=Z>>>30,B=J>>>15,x.__setDigit(q,1073741823&Z)}if(x.length>_)for(x.__setDigit(_++,b+B);_>>0,B=0|b/y;_=0|b%y,b=(_<<15|f.__halfDigit(x-1))>>>0;var q=0|b/y;_=0|b%y,w.__setDigit(x>>>1,B<<15|q)}return w}},{key:"__absoluteModSmall",value:function(f,y){for(var w,_=0,x=2*f.length-1;0<=x;x--)w=(_<<15|f.__halfDigit(x))>>>0,_=0|w%y;return _}},{key:"__absoluteDivLarge",value:function(f,y,w,_){var x=y.__halfDigitLength(),b=y.length,B=f.__halfDigitLength()-x,q=null;w&&(q=new S(B+2>>>1,!1),q.__initializeDigits());var M=new S(x+2>>>1,!1);M.__initializeDigits();var j=S.__clz15(y.__halfDigit(x-1));0>>0;X=0|ue/Z;for(var ae=0|ue%Z,ce=y.__halfDigit(x-2),me=J.__halfDigit(H+x-2);S.__imul(X,ce)>>>0>(ae<<16|me)>>>0&&(X--,ae+=Z,!(32767>>1,G|X))}if(_)return J.__inplaceRightShift(j),w?{quotient:q,remainder:J}:J;if(w)return q;throw new Error("unreachable")}},{key:"__clz15",value:function(f){return S.__clz30(f)-15}},{key:"__specialLeftShift",value:function(f,y,w){var _=f.length,x=new S(_+w,!1);if(y===0){for(var b=0;b<_;b++)x.__setDigit(b,f.__digit(b));return 0>>30-y;return 0w)throw new RangeError("BigInt too big");var _=0|w/30,x=w%30,b=f.length,B=x!==0&&f.__digit(b-1)>>>30-x!=0,q=b+_+(B?1:0),M=new S(q,f.sign);if(x===0){for(var j=0;j<_;j++)M.__setDigit(j,0);for(;j>>30-x;if(B)M.__setDigit(b+_,J);else if(J!==0)throw new Error("implementation bug")}return M.__trim()}},{key:"__rightShiftByAbsolute",value:function(f,y){var w=f.length,_=f.sign,x=S.__toShiftAmount(y);if(0>x)return S.__rightShiftByMaximum(_);var b=0|x/30,B=x%30,q=w-b;if(0>=q)return S.__rightShiftByMaximum(_);var M=!1;if(_){if(f.__digit(b)&(1<>>B,ee=w-b-1,ue=0;ue>>B;Z.__setDigit(ee,X)}return M&&(Z=S.__absoluteAddOne(Z,!0,Z)),Z.__trim()}},{key:"__rightShiftByMaximum",value:function(f){return f?S.__oneDigit(1,!0):S.__zero()}},{key:"__toShiftAmount",value:function(f){if(1S.__kMaxLengthBits?-1:y}},{key:"__toPrimitive",value:function(f){var y=1>>q}return _.__setDigit(x,B),_.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(f,y,w){for(var _=Math.min,x,b=0|(f+29)/30,B=new S(b,w),q=0,M=b-1,j=0,J=_(M,y.length);q>>30,B.__setDigit(q,1073741823&x);for(;q>>X;var ee=1<<32-X;Z=ee-G-j,Z&=ee-1}return B.__setDigit(M,Z),B.__trim()}},{key:"__digitPow",value:function(f,y){for(var w=1;0>>=1,f*=f;return w}},{key:"__isOneDigitInt",value:function(f){return(1073741823&f)===f}}]),S}(m(Array));return F.__kMaxLength=33554432,F.__kMaxLengthBits=F.__kMaxLength<<5,F.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],F.__kBitsPerCharTableShift=5,F.__kBitsPerCharTableMultiplier=1<>>0)/W)},F.__imul=t||function(U,W){return 0|U*W},F})});var WE=V(Gr=>{"use strict";h();Object.defineProperty(Gr,"__esModule",{value:!0});Gr.regexpCode=Gr.getEsmExportName=Gr.getProperty=Gr.safeStringify=Gr.stringify=Gr.strConcat=Gr.addCodeArg=Gr.str=Gr._=Gr.nil=Gr._Code=Gr.Name=Gr.IDENTIFIER=Gr._CodeOrName=void 0;var FE=class{};Gr._CodeOrName=FE;Gr.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Eg=class extends FE{constructor(e){if(super(),!Gr.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Gr.Name=Eg;var _d=class extends FE{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Eg&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Gr._Code=_d;Gr.nil=new _d("");function rde(t,...e){let r=[t[0]],n=0;for(;n{"use strict";h();Object.defineProperty(ua,"__esModule",{value:!0});ua.ValueScope=ua.ValueScopeName=ua.Scope=ua.varKinds=ua.UsedValueState=void 0;var Na=WE(),gN=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},vN;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(vN=ua.UsedValueState||(ua.UsedValueState={}));ua.varKinds={const:new Na.Name("const"),let:new Na.Name("let"),var:new Na.Name("var")};var CT=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Na.Name?e:this.name(e)}name(e){return new Na.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};ua.Scope=CT;var OT=class extends Na.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Na._)`.${new Na.Name(r)}[${n}]`}};ua.ValueScopeName=OT;var jNe=(0,Na._)`\n`,bN=class extends CT{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?jNe:Na.nil}}get(){return this._scope}name(e){return new OT(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:o}=i,s=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[o];if(a){let c=a.get(s);if(c)return c}else a=this._values[o]=new Map;a.set(s,i);let d=this._scope[o]||(this._scope[o]=[]),u=d.length;return d[u]=r.ref,i.setValue(r,{property:o,itemIndex:u}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Na._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let o=Na.nil;for(let s in e){let a=e[s];if(!a)continue;let d=n[s]=n[s]||new Map;a.forEach(u=>{if(d.has(u))return;d.set(u,vN.Started);let c=r(u);if(c){let l=this.opts.es5?ua.varKinds.var:ua.varKinds.const;o=(0,Na._)`${o}${l} ${u} = ${c};${this.opts._n}`}else if(c=i?.(u))o=(0,Na._)`${o}${c}${this.opts._n}`;else throw new gN(u);d.set(u,vN.Completed)})}return o}};ua.ValueScope=bN});var rr=V(br=>{"use strict";h();Object.defineProperty(br,"__esModule",{value:!0});br.or=br.and=br.not=br.CodeGen=br.operators=br.varKinds=br.ValueScopeName=br.ValueScope=br.Scope=br.Name=br.regexpCode=br.stringify=br.getProperty=br.nil=br.strConcat=br.str=br._=void 0;var Kr=WE(),ku=wN(),Mm=WE();Object.defineProperty(br,"_",{enumerable:!0,get:function(){return Mm._}});Object.defineProperty(br,"str",{enumerable:!0,get:function(){return Mm.str}});Object.defineProperty(br,"strConcat",{enumerable:!0,get:function(){return Mm.strConcat}});Object.defineProperty(br,"nil",{enumerable:!0,get:function(){return Mm.nil}});Object.defineProperty(br,"getProperty",{enumerable:!0,get:function(){return Mm.getProperty}});Object.defineProperty(br,"stringify",{enumerable:!0,get:function(){return Mm.stringify}});Object.defineProperty(br,"regexpCode",{enumerable:!0,get:function(){return Mm.regexpCode}});Object.defineProperty(br,"Name",{enumerable:!0,get:function(){return Mm.Name}});var UT=wN();Object.defineProperty(br,"Scope",{enumerable:!0,get:function(){return UT.Scope}});Object.defineProperty(br,"ValueScope",{enumerable:!0,get:function(){return UT.ValueScope}});Object.defineProperty(br,"ValueScopeName",{enumerable:!0,get:function(){return UT.ValueScopeName}});Object.defineProperty(br,"varKinds",{enumerable:!0,get:function(){return UT.varKinds}});br.operators={GT:new Kr._Code(">"),GTE:new Kr._Code(">="),LT:new Kr._Code("<"),LTE:new Kr._Code("<="),EQ:new Kr._Code("==="),NEQ:new Kr._Code("!=="),NOT:new Kr._Code("!"),OR:new Kr._Code("||"),AND:new Kr._Code("&&"),ADD:new Kr._Code("+")};var Ah=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},_N=class extends Ah{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?ku.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=f1(this.rhs,e,r)),this}get names(){return this.rhs instanceof Kr._CodeOrName?this.rhs.names:{}}},$T=class extends Ah{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Kr.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=f1(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Kr.Name?{}:{...this.lhs.names};return jT(e,this.rhs)}},xN=class extends $T{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},EN=class extends Ah{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},SN=class extends Ah{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},AN=class extends Ah{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},TN=class extends Ah{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=f1(this.code,e,r),this}get names(){return this.code instanceof Kr._CodeOrName?this.code.names:{}}},VE=class extends Ah{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let o=n[i];o.optimizeNames(e,r)||(UNe(e,o.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Tg(e,r.names),{})}},Th=class extends VE{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},IN=class extends VE{},l1=class extends Th{};l1.kind="else";var Sg=class t extends Th{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new l1(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(ide(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=f1(this.condition,e,r),this}get names(){let e=super.names;return jT(e,this.condition),this.else&&Tg(e,this.else.names),e}};Sg.kind="if";var Ag=class extends Th{};Ag.kind="for";var PN=class extends Ag{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=f1(this.iteration,e,r),this}get names(){return Tg(super.names,this.iteration.names)}},kN=class extends Ag{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?ku.varKinds.var:this.varKind,{name:n,from:i,to:o}=this;return`for(${r} ${n}=${i}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=jT(super.names,this.from);return jT(e,this.to)}},NT=class extends Ag{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=f1(this.iterable,e,r),this}get names(){return Tg(super.names,this.iterable.names)}},HE=class extends Th{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};HE.kind="func";var GE=class extends VE{render(e){return"return "+super.render(e)}};GE.kind="return";var RN=class extends Th{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Tg(e,this.catch.names),this.finally&&Tg(e,this.finally.names),e}},JE=class extends Th{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};JE.kind="catch";var YE=class extends Th{render(e){return"finally"+super.render(e)}};YE.kind="finally";var DN=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?` `:""},this._extScope=e,this._scope=new ku.Scope({parent:e}),this._nodes=[new IN]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let o=this._scope.toName(r);return n!==void 0&&i&&(this._constants[o.str]=n),this._leafNode(new _N(e,o,n)),o}const(e,r,n){return this._def(ku.varKinds.const,e,r,n)}let(e,r,n){return this._def(ku.varKinds.let,e,r,n)}var(e,r,n){return this._def(ku.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new $T(e,r,n))}add(e,r){return this._leafNode(new xN(e,br.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Kr.nil&&this._leafNode(new TN(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,Kr.addCodeArg)(r,i));return r.push("}"),new Kr._Code(r)}if(e,r,n){if(this._blockNode(new Sg(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Sg(e))}else(){return this._elseNode(new l1)}endIf(){return this._endBlockNode(Sg,l1)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new PN(e),r)}forRange(e,r,n,i,o=this.opts.es5?ku.varKinds.var:ku.varKinds.let){let s=this._scope.toName(e);return this._for(new kN(o,s,r,n),()=>i(s))}forOf(e,r,n,i=ku.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=r instanceof Kr.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Kr._)`${s}.length`,a=>{this.var(o,(0,Kr._)`${s}[${a}]`),n(o)})}return this._for(new NT("of",i,o,r),()=>n(o))}forIn(e,r,n,i=this.opts.es5?ku.varKinds.var:ku.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Kr._)`Object.keys(${r})`,n);let o=this._scope.toName(e);return this._for(new NT("in",i,o,r),()=>n(o))}endFor(){return this._endBlockNode(Ag)}label(e){return this._leafNode(new EN(e))}break(e){return this._leafNode(new SN(e))}return(e){let r=new GE;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(GE)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new RN;if(this._blockNode(i),this.code(e),r){let o=this.name("e");this._currNode=i.catch=new JE(o),r(o)}return n&&(this._currNode=i.finally=new YE,this.code(n)),this._endBlockNode(JE,YE)}throw(e){return this._leafNode(new AN(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Kr.nil,n,i){return this._blockNode(new HE(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(HE)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof Sg))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};br.CodeGen=DN;function Tg(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function jT(t,e){return e instanceof Kr._CodeOrName?Tg(t,e.names):t}function f1(t,e,r){if(t instanceof Kr.Name)return n(t);if(!i(t))return t;return new Kr._Code(t._items.reduce((o,s)=>(s instanceof Kr.Name&&(s=n(s)),s instanceof Kr._Code?o.push(...s._items):o.push(s),o),[]));function n(o){let s=r[o.str];return s===void 0||e[o.str]!==1?o:(delete e[o.str],s)}function i(o){return o instanceof Kr._Code&&o._items.some(s=>s instanceof Kr.Name&&e[s.str]===1&&r[s.str]!==void 0)}}function UNe(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function ide(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Kr._)`!${BN(t)}`}br.not=ide;var qNe=ode(br.operators.AND);function LNe(...t){return t.reduce(qNe)}br.and=LNe;var KNe=ode(br.operators.OR);function FNe(...t){return t.reduce(KNe)}br.or=FNe;function ode(t){return(e,r)=>e===Kr.nil?r:r===Kr.nil?e:(0,Kr._)`${BN(e)} ${t} ${BN(r)}`}function BN(t){return t instanceof Kr.Name?t:(0,Kr._)`(${t})`}});var Br=V(wr=>{"use strict";h();Object.defineProperty(wr,"__esModule",{value:!0});wr.checkStrictMode=wr.getErrorPath=wr.Type=wr.useFunc=wr.setEvaluated=wr.evaluatedPropsToName=wr.mergeEvaluated=wr.eachItem=wr.unescapeJsonPointer=wr.escapeJsonPointer=wr.escapeFragment=wr.unescapeFragment=wr.schemaRefOrVal=wr.schemaHasRulesButRef=wr.schemaHasRules=wr.checkUnknownRules=wr.alwaysValidSchema=wr.toHash=void 0;var Tn=rr(),zNe=WE();function WNe(t){let e={};for(let r of t)e[r]=!0;return e}wr.toHash=WNe;function VNe(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(cde(t,e),!dde(e,t.self.RULES.all))}wr.alwaysValidSchema=VNe;function cde(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let o in e)i[o]||hde(t,`unknown keyword: "${o}"`)}wr.checkUnknownRules=cde;function dde(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}wr.schemaHasRules=dde;function HNe(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}wr.schemaHasRulesButRef=HNe;function GNe({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Tn._)`${r}`}return(0,Tn._)`${t}${e}${(0,Tn.getProperty)(n)}`}wr.schemaRefOrVal=GNe;function JNe(t){return ude(decodeURIComponent(t))}wr.unescapeFragment=JNe;function YNe(t){return encodeURIComponent(MN(t))}wr.escapeFragment=YNe;function MN(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}wr.escapeJsonPointer=MN;function ude(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}wr.unescapeJsonPointer=ude;function ZNe(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}wr.eachItem=ZNe;function sde({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,o,s,a)=>{let d=s===void 0?o:s instanceof Tn.Name?(o instanceof Tn.Name?t(i,o,s):e(i,o,s),s):o instanceof Tn.Name?(e(i,s,o),o):r(o,s);return a===Tn.Name&&!(d instanceof Tn.Name)?n(i,d):d}}wr.mergeEvaluated={props:sde({mergeNames:(t,e,r)=>t.if((0,Tn._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,Tn._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,Tn._)`${r} || {}`).code((0,Tn._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,Tn._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,Tn._)`${r} || {}`),CN(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:lde}),items:sde({mergeNames:(t,e,r)=>t.if((0,Tn._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,Tn._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,Tn._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,Tn._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function lde(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,Tn._)`{}`);return e!==void 0&&CN(t,r,e),r}wr.evaluatedPropsToName=lde;function CN(t,e,r){Object.keys(r).forEach(n=>t.assign((0,Tn._)`${e}${(0,Tn.getProperty)(n)}`,!0))}wr.setEvaluated=CN;var ade={};function XNe(t,e){return t.scopeValue("func",{ref:e,code:ade[e.code]||(ade[e.code]=new zNe._Code(e.code))})}wr.useFunc=XNe;var fde;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(fde=wr.Type||(wr.Type={}));function QNe(t,e,r){if(t instanceof Tn.Name){let n=e===fde.Num;return r?n?(0,Tn._)`"[" + ${t} + "]"`:(0,Tn._)`"['" + ${t} + "']"`:n?(0,Tn._)`"/" + ${t}`:(0,Tn._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Tn.getProperty)(t).toString():"/"+MN(t)}wr.getErrorPath=QNe;function hde(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}wr.checkStrictMode=hde});var xd=V(ON=>{"use strict";h();Object.defineProperty(ON,"__esModule",{value:!0});var Us=rr(),eje={data:new Us.Name("data"),valCxt:new Us.Name("valCxt"),instancePath:new Us.Name("instancePath"),parentData:new Us.Name("parentData"),parentDataProperty:new Us.Name("parentDataProperty"),rootData:new Us.Name("rootData"),dynamicAnchors:new Us.Name("dynamicAnchors"),vErrors:new Us.Name("vErrors"),errors:new Us.Name("errors"),this:new Us.Name("this"),self:new Us.Name("self"),scope:new Us.Name("scope"),json:new Us.Name("json"),jsonPos:new Us.Name("jsonPos"),jsonLen:new Us.Name("jsonLen"),jsonPart:new Us.Name("jsonPart")};ON.default=eje});var ZE=V(qs=>{"use strict";h();Object.defineProperty(qs,"__esModule",{value:!0});qs.extendErrors=qs.resetErrorsCount=qs.reportExtraError=qs.reportError=qs.keyword$DataError=qs.keywordError=void 0;var zr=rr(),qT=Br(),la=xd();qs.keywordError={message:({keyword:t})=>(0,zr.str)`must pass "${t}" keyword validation`};qs.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,zr.str)`"${t}" keyword must be ${e} ($data)`:(0,zr.str)`"${t}" keyword is invalid ($data)`};function tje(t,e=qs.keywordError,r,n){let{it:i}=t,{gen:o,compositeRule:s,allErrors:a}=i,d=yde(t,e,r);n??(s||a)?pde(o,d):mde(i,(0,zr._)`[${d}]`)}qs.reportError=tje;function rje(t,e=qs.keywordError,r){let{it:n}=t,{gen:i,compositeRule:o,allErrors:s}=n,a=yde(t,e,r);pde(i,a),o||s||mde(n,la.default.vErrors)}qs.reportExtraError=rje;function nje(t,e){t.assign(la.default.errors,e),t.if((0,zr._)`${la.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,zr._)`${la.default.vErrors}.length`,e),()=>t.assign(la.default.vErrors,null)))}qs.resetErrorsCount=nje;function ije({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:o}){if(i===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",i,la.default.errors,a=>{t.const(s,(0,zr._)`${la.default.vErrors}[${a}]`),t.if((0,zr._)`${s}.instancePath === undefined`,()=>t.assign((0,zr._)`${s}.instancePath`,(0,zr.strConcat)(la.default.instancePath,o.errorPath))),t.assign((0,zr._)`${s}.schemaPath`,(0,zr.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0,zr._)`${s}.schema`,r),t.assign((0,zr._)`${s}.data`,n))})}qs.extendErrors=ije;function pde(t,e){let r=t.const("err",e);t.if((0,zr._)`${la.default.vErrors} === null`,()=>t.assign(la.default.vErrors,(0,zr._)`[${r}]`),(0,zr._)`${la.default.vErrors}.push(${r})`),t.code((0,zr._)`${la.default.errors}++`)}function mde(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,zr._)`new ${t.ValidationError}(${e})`):(r.assign((0,zr._)`${n}.errors`,e),r.return(!1))}var Ig={keyword:new zr.Name("keyword"),schemaPath:new zr.Name("schemaPath"),params:new zr.Name("params"),propertyName:new zr.Name("propertyName"),message:new zr.Name("message"),schema:new zr.Name("schema"),parentSchema:new zr.Name("parentSchema")};function yde(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,zr._)`{}`:oje(t,e,r)}function oje(t,e,r={}){let{gen:n,it:i}=t,o=[sje(i,r),aje(t,r)];return cje(t,e,o),n.object(...o)}function sje({errorPath:t},{instancePath:e}){let r=e?(0,zr.str)`${t}${(0,qT.getErrorPath)(e,qT.Type.Str)}`:t;return[la.default.instancePath,(0,zr.strConcat)(la.default.instancePath,r)]}function aje({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,zr.str)`${e}/${t}`;return r&&(i=(0,zr.str)`${i}${(0,qT.getErrorPath)(r,qT.Type.Str)}`),[Ig.schemaPath,i]}function cje(t,{params:e,message:r},n){let{keyword:i,data:o,schemaValue:s,it:a}=t,{opts:d,propertyName:u,topSchemaRef:c,schemaPath:l}=a;n.push([Ig.keyword,i],[Ig.params,typeof e=="function"?e(t):e||(0,zr._)`{}`]),d.messages&&n.push([Ig.message,typeof r=="function"?r(t):r]),d.verbose&&n.push([Ig.schema,s],[Ig.parentSchema,(0,zr._)`${c}${l}`],[la.default.data,o]),u&&n.push([Ig.propertyName,u])}});var vde=V(h1=>{"use strict";h();Object.defineProperty(h1,"__esModule",{value:!0});h1.boolOrEmptySchema=h1.topBoolOrEmptySchema=void 0;var dje=ZE(),uje=rr(),lje=xd(),fje={message:"boolean schema is false"};function hje(t){let{gen:e,schema:r,validateName:n}=t;r===!1?gde(t,!1):typeof r=="object"&&r.$async===!0?e.return(lje.default.data):(e.assign((0,uje._)`${n}.errors`,null),e.return(!0))}h1.topBoolOrEmptySchema=hje;function pje(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),gde(t)):r.var(e,!0)}h1.boolOrEmptySchema=pje;function gde(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,dje.reportError)(i,fje,void 0,e)}});var $N=V(p1=>{"use strict";h();Object.defineProperty(p1,"__esModule",{value:!0});p1.getRules=p1.isJSONType=void 0;var mje=["string","number","integer","boolean","null","object","array"],yje=new Set(mje);function gje(t){return typeof t=="string"&&yje.has(t)}p1.isJSONType=gje;function vje(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}p1.getRules=vje});var NN=V(Cm=>{"use strict";h();Object.defineProperty(Cm,"__esModule",{value:!0});Cm.shouldUseRule=Cm.shouldUseGroup=Cm.schemaHasRulesForType=void 0;function bje({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&bde(t,n)}Cm.schemaHasRulesForType=bje;function bde(t,e){return e.rules.some(r=>wde(t,r))}Cm.shouldUseGroup=bde;function wde(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Cm.shouldUseRule=wde});var QE=V(os=>{"use strict";h();Object.defineProperty(os,"__esModule",{value:!0});os.reportTypeError=os.checkDataTypes=os.checkDataType=os.coerceAndCheckDataType=os.getJSONTypes=os.getSchemaTypes=os.DataType=void 0;var wje=$N(),_je=NN(),xje=ZE(),or=rr(),_de=Br(),XE;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(XE=os.DataType||(os.DataType={}));function Eje(t){let e=xde(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}os.getSchemaTypes=Eje;function xde(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(wje.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}os.getJSONTypes=xde;function Sje(t,e){let{gen:r,data:n,opts:i}=t,o=Aje(e,i.coerceTypes),s=e.length>0&&!(o.length===0&&e.length===1&&(0,_je.schemaHasRulesForType)(t,e[0]));if(s){let a=UN(e,n,i.strictNumbers,XE.Wrong);r.if(a,()=>{o.length?Tje(t,e,o):qN(t)})}return s}os.coerceAndCheckDataType=Sje;var Ede=new Set(["string","number","integer","boolean","null"]);function Aje(t,e){return e?t.filter(r=>Ede.has(r)||e==="array"&&r==="array"):[]}function Tje(t,e,r){let{gen:n,data:i,opts:o}=t,s=n.let("dataType",(0,or._)`typeof ${i}`),a=n.let("coerced",(0,or._)`undefined`);o.coerceTypes==="array"&&n.if((0,or._)`${s} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,or._)`${i}[0]`).assign(s,(0,or._)`typeof ${i}`).if(UN(e,i,o.strictNumbers),()=>n.assign(a,i))),n.if((0,or._)`${a} !== undefined`);for(let u of r)(Ede.has(u)||u==="array"&&o.coerceTypes==="array")&&d(u);n.else(),qN(t),n.endIf(),n.if((0,or._)`${a} !== undefined`,()=>{n.assign(i,a),Ije(t,a)});function d(u){switch(u){case"string":n.elseIf((0,or._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,or._)`"" + ${i}`).elseIf((0,or._)`${i} === null`).assign(a,(0,or._)`""`);return;case"number":n.elseIf((0,or._)`${s} == "boolean" || ${i} === null || (${s} == "string" && ${i} && ${i} == +${i})`).assign(a,(0,or._)`+${i}`);return;case"integer":n.elseIf((0,or._)`${s} === "boolean" || ${i} === null || (${s} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(a,(0,or._)`+${i}`);return;case"boolean":n.elseIf((0,or._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(a,!1).elseIf((0,or._)`${i} === "true" || ${i} === 1`).assign(a,!0);return;case"null":n.elseIf((0,or._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(a,null);return;case"array":n.elseIf((0,or._)`${s} === "string" || ${s} === "number" || ${s} === "boolean" || ${i} === null`).assign(a,(0,or._)`[${i}]`)}}}function Ije({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,or._)`${e} !== undefined`,()=>t.assign((0,or._)`${e}[${r}]`,n))}function jN(t,e,r,n=XE.Correct){let i=n===XE.Correct?or.operators.EQ:or.operators.NEQ,o;switch(t){case"null":return(0,or._)`${e} ${i} null`;case"array":o=(0,or._)`Array.isArray(${e})`;break;case"object":o=(0,or._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":o=s((0,or._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":o=s();break;default:return(0,or._)`typeof ${e} ${i} ${t}`}return n===XE.Correct?o:(0,or.not)(o);function s(a=or.nil){return(0,or.and)((0,or._)`typeof ${e} == "number"`,a,r?(0,or._)`isFinite(${e})`:or.nil)}}os.checkDataType=jN;function UN(t,e,r,n){if(t.length===1)return jN(t[0],e,r,n);let i,o=(0,_de.toHash)(t);if(o.array&&o.object){let s=(0,or._)`typeof ${e} != "object"`;i=o.null?s:(0,or._)`!${e} || ${s}`,delete o.null,delete o.array,delete o.object}else i=or.nil;o.number&&delete o.integer;for(let s in o)i=(0,or.and)(i,jN(s,e,r,n));return i}os.checkDataTypes=UN;var Pje={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,or._)`{type: ${t}}`:(0,or._)`{type: ${e}}`};function qN(t){let e=kje(t);(0,xje.reportError)(e,Pje)}os.reportTypeError=qN;function kje(t){let{gen:e,data:r,schema:n}=t,i=(0,_de.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var Ade=V(LT=>{"use strict";h();Object.defineProperty(LT,"__esModule",{value:!0});LT.assignDefaults=void 0;var m1=rr(),Rje=Br();function Dje(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)Sde(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,o)=>Sde(t,o,i.default))}LT.assignDefaults=Dje;function Sde(t,e,r){let{gen:n,compositeRule:i,data:o,opts:s}=t;if(r===void 0)return;let a=(0,m1._)`${o}${(0,m1.getProperty)(e)}`;if(i){(0,Rje.checkStrictMode)(t,`default is ignored for: ${a}`);return}let d=(0,m1._)`${a} === undefined`;s.useDefaults==="empty"&&(d=(0,m1._)`${d} || ${a} === null || ${a} === ""`),n.if(d,(0,m1._)`${a} = ${(0,m1.stringify)(r)}`)}});var Ed=V(bn=>{"use strict";h();Object.defineProperty(bn,"__esModule",{value:!0});bn.validateUnion=bn.validateArray=bn.usePattern=bn.callValidateCode=bn.schemaProperties=bn.allSchemaProperties=bn.noPropertyInData=bn.propertyInData=bn.isOwnProperty=bn.hasPropFunc=bn.reportMissingProp=bn.checkMissingProp=bn.checkReportMissingProp=void 0;var Nn=rr(),LN=Br(),Om=xd(),Bje=Br();function Mje(t,e){let{gen:r,data:n,it:i}=t;r.if(FN(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Nn._)`${e}`},!0),t.error()})}bn.checkReportMissingProp=Mje;function Cje({gen:t,data:e,it:{opts:r}},n,i){return(0,Nn.or)(...n.map(o=>(0,Nn.and)(FN(t,e,o,r.ownProperties),(0,Nn._)`${i} = ${o}`)))}bn.checkMissingProp=Cje;function Oje(t,e){t.setParams({missingProperty:e},!0),t.error()}bn.reportMissingProp=Oje;function Tde(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Nn._)`Object.prototype.hasOwnProperty`})}bn.hasPropFunc=Tde;function KN(t,e,r){return(0,Nn._)`${Tde(t)}.call(${e}, ${r})`}bn.isOwnProperty=KN;function $je(t,e,r,n){let i=(0,Nn._)`${e}${(0,Nn.getProperty)(r)} !== undefined`;return n?(0,Nn._)`${i} && ${KN(t,e,r)}`:i}bn.propertyInData=$je;function FN(t,e,r,n){let i=(0,Nn._)`${e}${(0,Nn.getProperty)(r)} === undefined`;return n?(0,Nn.or)(i,(0,Nn.not)(KN(t,e,r))):i}bn.noPropertyInData=FN;function Ide(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}bn.allSchemaProperties=Ide;function Nje(t,e){return Ide(e).filter(r=>!(0,LN.alwaysValidSchema)(t,e[r]))}bn.schemaProperties=Nje;function jje({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:o},it:s},a,d,u){let c=u?(0,Nn._)`${t}, ${e}, ${n}${i}`:e,l=[[Om.default.instancePath,(0,Nn.strConcat)(Om.default.instancePath,o)],[Om.default.parentData,s.parentData],[Om.default.parentDataProperty,s.parentDataProperty],[Om.default.rootData,Om.default.rootData]];s.opts.dynamicRef&&l.push([Om.default.dynamicAnchors,Om.default.dynamicAnchors]);let m=(0,Nn._)`${c}, ${r.object(...l)}`;return d!==Nn.nil?(0,Nn._)`${a}.call(${d}, ${m})`:(0,Nn._)`${a}(${m})`}bn.callValidateCode=jje;var Uje=(0,Nn._)`new RegExp`;function qje({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,o=i(r,n);return t.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,Nn._)`${i.code==="new RegExp"?Uje:(0,Bje.useFunc)(t,i)}(${r}, ${n})`})}bn.usePattern=qje;function Lje(t){let{gen:e,data:r,keyword:n,it:i}=t,o=e.name("valid");if(i.allErrors){let a=e.let("valid",!0);return s(()=>e.assign(a,!1)),a}return e.var(o,!0),s(()=>e.break()),o;function s(a){let d=e.const("len",(0,Nn._)`${r}.length`);e.forRange("i",0,d,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:LN.Type.Num},o),e.if((0,Nn.not)(o),a)})}}bn.validateArray=Lje;function Kje(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(d=>(0,LN.alwaysValidSchema)(i,d))&&!i.opts.unevaluated)return;let s=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((d,u)=>{let c=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);e.assign(s,(0,Nn._)`${s} || ${a}`),t.mergeValidEvaluated(c,a)||e.if((0,Nn.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}bn.validateUnion=Kje});var Rde=V(Gl=>{"use strict";h();Object.defineProperty(Gl,"__esModule",{value:!0});Gl.validateKeywordUsage=Gl.validSchemaType=Gl.funcKeywordCode=Gl.macroKeywordCode=void 0;var fa=rr(),Pg=xd(),Fje=Ed(),zje=ZE();function Wje(t,e){let{gen:r,keyword:n,schema:i,parentSchema:o,it:s}=t,a=e.macro.call(s.self,i,o,s),d=kde(r,n,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:fa.nil,errSchemaPath:`${s.errSchemaPath}/${n}`,topSchemaRef:d,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Gl.macroKeywordCode=Wje;function Vje(t,e){var r;let{gen:n,keyword:i,schema:o,parentSchema:s,$data:a,it:d}=t;Gje(d,e);let u=!a&&e.compile?e.compile.call(d.self,o,s,d):e.validate,c=kde(n,i,u),l=n.let("valid");t.block$data(l,m),t.ok((r=e.valid)!==null&&r!==void 0?r:l);function m(){if(e.errors===!1)v(),e.modifying&&Pde(t),E(()=>t.error());else{let A=e.async?p():g();e.modifying&&Pde(t),E(()=>Hje(t,A))}}function p(){let A=n.let("ruleErrs",null);return n.try(()=>v((0,fa._)`await `),P=>n.assign(l,!1).if((0,fa._)`${P} instanceof ${d.ValidationError}`,()=>n.assign(A,(0,fa._)`${P}.errors`),()=>n.throw(P))),A}function g(){let A=(0,fa._)`${c}.errors`;return n.assign(A,null),v(fa.nil),A}function v(A=e.async?(0,fa._)`await `:fa.nil){let P=d.opts.passContext?Pg.default.this:Pg.default.self,I=!("compile"in e&&!a||e.schema===!1);n.assign(l,(0,fa._)`${A}${(0,Fje.callValidateCode)(t,c,P,I)}`,e.modifying)}function E(A){var P;n.if((0,fa.not)((P=e.valid)!==null&&P!==void 0?P:l),A)}}Gl.funcKeywordCode=Vje;function Pde(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,fa._)`${n.parentData}[${n.parentDataProperty}]`))}function Hje(t,e){let{gen:r}=t;r.if((0,fa._)`Array.isArray(${e})`,()=>{r.assign(Pg.default.vErrors,(0,fa._)`${Pg.default.vErrors} === null ? ${e} : ${Pg.default.vErrors}.concat(${e})`).assign(Pg.default.errors,(0,fa._)`${Pg.default.vErrors}.length`),(0,zje.extendErrors)(t)},()=>t.error())}function Gje({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function kde(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,fa.stringify)(r)})}function Jje(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Gl.validSchemaType=Jje;function Yje({schema:t,opts:e,self:r,errSchemaPath:n},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw new Error("ajv implementation error");let s=i.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[o])){let d=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(d);else throw new Error(d)}}Gl.validateKeywordUsage=Yje});var Bde=V($m=>{"use strict";h();Object.defineProperty($m,"__esModule",{value:!0});$m.extendSubschemaMode=$m.extendSubschemaData=$m.getSubschema=void 0;var Jl=rr(),Dde=Br();function Zje(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:o,topSchemaRef:s}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Jl._)`${t.schemaPath}${(0,Jl.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Jl._)`${t.schemaPath}${(0,Jl.getProperty)(e)}${(0,Jl.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Dde.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||o===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}$m.getSubschema=Zje;function Xje(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:o,propertyName:s}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:c,opts:l}=e,m=a.let("data",(0,Jl._)`${e.data}${(0,Jl.getProperty)(r)}`,!0);d(m),t.errorPath=(0,Jl.str)`${u}${(0,Dde.getErrorPath)(r,n,l.jsPropertySyntax)}`,t.parentDataProperty=(0,Jl._)`${r}`,t.dataPathArr=[...c,t.parentDataProperty]}if(i!==void 0){let u=i instanceof Jl.Name?i:a.let("data",i,!0);d(u),s!==void 0&&(t.propertyName=s)}o&&(t.dataTypes=o);function d(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}$m.extendSubschemaData=Xje;function Qje(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:o}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),o!==void 0&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}$m.extendSubschemaMode=Qje});var zN=V((__t,Mde)=>{"use strict";h();Mde.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(o=Object.keys(e),n=o.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;i--!==0;){var s=o[i];if(!t(e[s],r[s]))return!1}return!0}return e!==e&&r!==r}});var Ode=V((E_t,Cde)=>{"use strict";h();var Nm=Cde.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};KT(e,n,i,t,"",t)};Nm.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Nm.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Nm.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Nm.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function KT(t,e,r,n,i,o,s,a,d,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,o,s,a,d,u);for(var c in n){var l=n[c];if(Array.isArray(l)){if(c in Nm.arrayKeywords)for(var m=0;m{"use strict";h();Object.defineProperty(ja,"__esModule",{value:!0});ja.getSchemaRefs=ja.resolveUrl=ja.normalizeId=ja._getFullPath=ja.getFullPath=ja.inlineRef=void 0;var tUe=Br(),rUe=zN(),nUe=Ode(),iUe=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function oUe(t,e=!0){return typeof t=="boolean"?!0:e===!0?!WN(t):e?$de(t)<=e:!1}ja.inlineRef=oUe;var sUe=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function WN(t){for(let e in t){if(sUe.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(WN)||typeof r=="object"&&WN(r))return!0}return!1}function $de(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!iUe.has(r)&&(typeof t[r]=="object"&&(0,tUe.eachItem)(t[r],n=>e+=$de(n)),e===1/0))return 1/0}return e}function Nde(t,e="",r){r!==!1&&(e=y1(e));let n=t.parse(e);return jde(t,n)}ja.getFullPath=Nde;function jde(t,e){return t.serialize(e).split("#")[0]+"#"}ja._getFullPath=jde;var aUe=/#\/?$/;function y1(t){return t?t.replace(aUe,""):""}ja.normalizeId=y1;function cUe(t,e,r){return r=y1(r),t.resolve(e,r)}ja.resolveUrl=cUe;var dUe=/^[a-z_][-a-z0-9._]*$/i;function uUe(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=y1(t[r]||e),o={"":i},s=Nde(n,i,!1),a={},d=new Set;return nUe(t,{allKeys:!0},(l,m,p,g)=>{if(g===void 0)return;let v=s+m,E=o[g];typeof l[r]=="string"&&(E=A.call(this,l[r])),P.call(this,l.$anchor),P.call(this,l.$dynamicAnchor),o[m]=E;function A(I){let $=this.opts.uriResolver.resolve;if(I=y1(E?$(E,I):I),d.has(I))throw c(I);d.add(I);let N=this.refs[I];return typeof N=="string"&&(N=this.refs[N]),typeof N=="object"?u(l,N.schema,I):I!==y1(v)&&(I[0]==="#"?(u(l,a[I],I),a[I]=l):this.refs[I]=v),I}function P(I){if(typeof I=="string"){if(!dUe.test(I))throw new Error(`invalid anchor "${I}"`);A.call(this,`#${I}`)}}}),a;function u(l,m,p){if(m!==void 0&&!rUe(l,m))throw c(p)}function c(l){return new Error(`reference "${l}" resolves to more than one schema`)}}ja.getSchemaRefs=uUe});var n6=V(jm=>{"use strict";h();Object.defineProperty(jm,"__esModule",{value:!0});jm.getData=jm.KeywordCxt=jm.validateFunctionCode=void 0;var Fde=vde(),Ude=QE(),HN=NN(),FT=QE(),lUe=Ade(),r6=Rde(),VN=Bde(),ht=rr(),jt=xd(),fUe=e6(),Ih=Br(),t6=ZE();function hUe(t){if(Vde(t)&&(Hde(t),Wde(t))){yUe(t);return}zde(t,()=>(0,Fde.topBoolOrEmptySchema)(t))}jm.validateFunctionCode=hUe;function zde({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},o){i.code.es5?t.func(e,(0,ht._)`${jt.default.data}, ${jt.default.valCxt}`,n.$async,()=>{t.code((0,ht._)`"use strict"; ${qde(r,i)}`),mUe(t,i),t.code(o)}):t.func(e,(0,ht._)`${jt.default.data}, ${pUe(i)}`,n.$async,()=>t.code(qde(r,i)).code(o))}function pUe(t){return(0,ht._)`{${jt.default.instancePath}="", ${jt.default.parentData}, ${jt.default.parentDataProperty}, ${jt.default.rootData}=${jt.default.data}${t.dynamicRef?(0,ht._)`, ${jt.default.dynamicAnchors}={}`:ht.nil}}={}`}function mUe(t,e){t.if(jt.default.valCxt,()=>{t.var(jt.default.instancePath,(0,ht._)`${jt.default.valCxt}.${jt.default.instancePath}`),t.var(jt.default.parentData,(0,ht._)`${jt.default.valCxt}.${jt.default.parentData}`),t.var(jt.default.parentDataProperty,(0,ht._)`${jt.default.valCxt}.${jt.default.parentDataProperty}`),t.var(jt.default.rootData,(0,ht._)`${jt.default.valCxt}.${jt.default.rootData}`),e.dynamicRef&&t.var(jt.default.dynamicAnchors,(0,ht._)`${jt.default.valCxt}.${jt.default.dynamicAnchors}`)},()=>{t.var(jt.default.instancePath,(0,ht._)`""`),t.var(jt.default.parentData,(0,ht._)`undefined`),t.var(jt.default.parentDataProperty,(0,ht._)`undefined`),t.var(jt.default.rootData,jt.default.data),e.dynamicRef&&t.var(jt.default.dynamicAnchors,(0,ht._)`{}`)})}function yUe(t){let{schema:e,opts:r,gen:n}=t;zde(t,()=>{r.$comment&&e.$comment&&Jde(t),_Ue(t),n.let(jt.default.vErrors,null),n.let(jt.default.errors,0),r.unevaluated&&gUe(t),Gde(t),SUe(t)})}function gUe(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,ht._)`${r}.evaluated`),e.if((0,ht._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,ht._)`${t.evaluated}.props`,(0,ht._)`undefined`)),e.if((0,ht._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,ht._)`${t.evaluated}.items`,(0,ht._)`undefined`))}function qde(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,ht._)`/*# sourceURL=${r} */`:ht.nil}function vUe(t,e){if(Vde(t)&&(Hde(t),Wde(t))){bUe(t,e);return}(0,Fde.boolOrEmptySchema)(t,e)}function Wde({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function Vde(t){return typeof t.schema!="boolean"}function bUe(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&Jde(t),xUe(t),EUe(t);let o=n.const("_errs",jt.default.errors);Gde(t,o),n.var(e,(0,ht._)`${o} === ${jt.default.errors}`)}function Hde(t){(0,Ih.checkUnknownRules)(t),wUe(t)}function Gde(t,e){if(t.opts.jtd)return Lde(t,[],!1,e);let r=(0,Ude.getSchemaTypes)(t.schema),n=(0,Ude.coerceAndCheckDataType)(t,r);Lde(t,r,!n,e)}function wUe(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Ih.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function _Ue(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Ih.checkStrictMode)(t,"default is ignored in the schema root")}function xUe(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,fUe.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function EUe(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Jde({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let o=r.$comment;if(i.$comment===!0)t.code((0,ht._)`${jt.default.self}.logger.log(${o})`);else if(typeof i.$comment=="function"){let s=(0,ht.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,ht._)`${jt.default.self}.opts.$comment(${o}, ${s}, ${a}.schema)`)}}function SUe(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:o}=t;r.$async?e.if((0,ht._)`${jt.default.errors} === 0`,()=>e.return(jt.default.data),()=>e.throw((0,ht._)`new ${i}(${jt.default.vErrors})`)):(e.assign((0,ht._)`${n}.errors`,jt.default.vErrors),o.unevaluated&&AUe(t),e.return((0,ht._)`${jt.default.errors} === 0`))}function AUe({gen:t,evaluated:e,props:r,items:n}){r instanceof ht.Name&&t.assign((0,ht._)`${e}.props`,r),n instanceof ht.Name&&t.assign((0,ht._)`${e}.items`,n)}function Lde(t,e,r,n){let{gen:i,schema:o,data:s,allErrors:a,opts:d,self:u}=t,{RULES:c}=u;if(o.$ref&&(d.ignoreKeywordsWithRef||!(0,Ih.schemaHasRulesButRef)(o,c))){i.block(()=>Zde(t,"$ref",c.all.$ref.definition));return}d.jtd||TUe(t,e),i.block(()=>{for(let m of c.rules)l(m);l(c.post)});function l(m){(0,HN.shouldUseGroup)(o,m)&&(m.type?(i.if((0,FT.checkDataType)(m.type,s,d.strictNumbers)),Kde(t,m),e.length===1&&e[0]===m.type&&r&&(i.else(),(0,FT.reportTypeError)(t)),i.endIf()):Kde(t,m),a||i.if((0,ht._)`${jt.default.errors} === ${n||0}`))}}function Kde(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,lUe.assignDefaults)(t,e.type),r.block(()=>{for(let o of e.rules)(0,HN.shouldUseRule)(n,o)&&Zde(t,o.keyword,o.definition,e.type)})}function TUe(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(IUe(t,e),t.opts.allowUnionTypes||PUe(t,e),kUe(t,t.dataTypes))}function IUe(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Yde(t.dataTypes,r)||GN(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),DUe(t,e)}}function PUe(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&GN(t,"use allowUnionTypes to allow union type keyword")}function kUe(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,HN.shouldUseRule)(t.schema,i)){let{type:o}=i.definition;o.length&&!o.some(s=>RUe(e,s))&&GN(t,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function RUe(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Yde(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function DUe(t,e){let r=[];for(let n of t.dataTypes)Yde(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function GN(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Ih.checkStrictMode)(t,e,t.opts.strictTypes)}var zT=class{constructor(e,r,n){if((0,r6.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ih.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",Xde(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,r6.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",jt.default.errors))}result(e,r,n){this.failResult((0,ht.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,ht.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,ht._)`${r} !== undefined && (${(0,ht.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?t6.reportExtraError:t6.reportError)(this,this.def.error,r)}$dataError(){(0,t6.reportError)(this,this.def.$dataError||t6.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,t6.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=ht.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=ht.nil,r=ht.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:o,def:s}=this;n.if((0,ht.or)((0,ht._)`${i} === undefined`,r)),e!==ht.nil&&n.assign(e,!0),(o.length||s.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==ht.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:o}=this;return(0,ht.or)(s(),a());function s(){if(n.length){if(!(r instanceof ht.Name))throw new Error("ajv implementation error");let d=Array.isArray(n)?n:[n];return(0,ht._)`${(0,FT.checkDataTypes)(d,r,o.opts.strictNumbers,FT.DataType.Wrong)}`}return ht.nil}function a(){if(i.validateSchema){let d=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,ht._)`!${d}(${r})`}return ht.nil}}subschema(e,r){let n=(0,VN.getSubschema)(this.it,e);(0,VN.extendSubschemaData)(n,this.it,e),(0,VN.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return vUe(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Ih.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Ih.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,ht.Name)),!0}};jm.KeywordCxt=zT;function Zde(t,e,r,n){let i=new zT(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,r6.funcKeywordCode)(i,r):"macro"in r?(0,r6.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,r6.funcKeywordCode)(i,r)}var BUe=/^\/(?:[^~]|~0|~1)*$/,MUe=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Xde(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,o;if(t==="")return jt.default.rootData;if(t[0]==="/"){if(!BUe.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,o=jt.default.rootData}else{let u=MUe.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let c=+u[1];if(i=u[2],i==="#"){if(c>=e)throw new Error(d("property/index",c));return n[e-c]}if(c>e)throw new Error(d("data",c));if(o=r[e-c],!i)return o}let s=o,a=i.split("/");for(let u of a)u&&(o=(0,ht._)`${o}${(0,ht.getProperty)((0,Ih.unescapeJsonPointer)(u))}`,s=(0,ht._)`${s} && ${o}`);return s;function d(u,c){return`Cannot access ${u} ${c} levels up, current level is ${e}`}}jm.getData=Xde});var WT=V(YN=>{"use strict";h();Object.defineProperty(YN,"__esModule",{value:!0});var JN=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};YN.default=JN});var VT=V(QN=>{"use strict";h();Object.defineProperty(QN,"__esModule",{value:!0});var ZN=e6(),XN=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,ZN.resolveUrl)(e,r,n),this.missingSchema=(0,ZN.normalizeId)((0,ZN.getFullPath)(e,this.missingRef))}};QN.default=XN});var i6=V(Sd=>{"use strict";h();Object.defineProperty(Sd,"__esModule",{value:!0});Sd.resolveSchema=Sd.getCompilingSchema=Sd.resolveRef=Sd.compileSchema=Sd.SchemaEnv=void 0;var Ru=rr(),CUe=WT(),kg=xd(),Du=e6(),Qde=Br(),OUe=n6(),g1=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Du.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Sd.SchemaEnv=g1;function tj(t){let e=eue.call(this,t);if(e)return e;let r=(0,Du.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:o}=this.opts,s=new Ru.CodeGen(this.scope,{es5:n,lines:i,ownProperties:o}),a;t.$async&&(a=s.scopeValue("Error",{ref:CUe.default,code:(0,Ru._)`require("ajv/dist/runtime/validation_error").default`}));let d=s.scopeName("validate");t.validateName=d;let u={gen:s,allErrors:this.opts.allErrors,data:kg.default.data,parentData:kg.default.parentData,parentDataProperty:kg.default.parentDataProperty,dataNames:[kg.default.data],dataPathArr:[Ru.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Ru.stringify)(t.schema)}:{ref:t.schema}),validateName:d,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Ru.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Ru._)`""`,opts:this.opts,self:this},c;try{this._compilations.add(t),(0,OUe.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);let l=s.toString();c=`${s.scopeRefs(kg.default.scope)}return ${l}`,this.opts.code.process&&(c=this.opts.code.process(c,t));let p=new Function(`${kg.default.self}`,`${kg.default.scope}`,c)(this,this.scope.get());if(this.scope.value(d,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:d,validateCode:l,scopeValues:s._values}),this.opts.unevaluated){let{props:g,items:v}=u;p.evaluated={props:g instanceof Ru.Name?void 0:g,items:v instanceof Ru.Name?void 0:v,dynamicProps:g instanceof Ru.Name,dynamicItems:v instanceof Ru.Name},p.source&&(p.source.evaluated=(0,Ru.stringify)(p.evaluated))}return t.validate=p,t}catch(l){throw delete t.validate,delete t.validateName,c&&this.logger.error("Error compiling schema, function code:",c),l}finally{this._compilations.delete(t)}}Sd.compileSchema=tj;function $Ue(t,e,r){var n;r=(0,Du.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let o=UUe.call(this,t,r);if(o===void 0){let s=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;s&&(o=new g1({schema:s,schemaId:a,root:t,baseId:e}))}if(o!==void 0)return t.refs[r]=NUe.call(this,o)}Sd.resolveRef=$Ue;function NUe(t){return(0,Du.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:tj.call(this,t)}function eue(t){for(let e of this._compilations)if(jUe(e,t))return e}Sd.getCompilingSchema=eue;function jUe(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function UUe(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||HT.call(this,t,e)}function HT(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Du._getFullPath)(this.opts.uriResolver,r),i=(0,Du.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return ej.call(this,r,t);let o=(0,Du.normalizeId)(n),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let a=HT.call(this,t,s);return typeof a?.schema!="object"?void 0:ej.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||tj.call(this,s),o===(0,Du.normalizeId)(e)){let{schema:a}=s,{schemaId:d}=this.opts,u=a[d];return u&&(i=(0,Du.resolveUrl)(this.opts.uriResolver,i,u)),new g1({schema:a,schemaId:d,root:t,baseId:i})}return ej.call(this,r,s)}}Sd.resolveSchema=HT;var qUe=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ej(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let d=r[(0,Qde.unescapeFragment)(a)];if(d===void 0)return;r=d;let u=typeof r=="object"&&r[this.opts.schemaId];!qUe.has(a)&&u&&(e=(0,Du.resolveUrl)(this.opts.uriResolver,e,u))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,Qde.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Du.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=HT.call(this,n,a)}let{schemaId:s}=this.opts;if(o=o||new g1({schema:r,schemaId:s,root:n,baseId:e}),o.schema!==o.root.schema)return o}});var tue=V((O_t,LUe)=>{LUe.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var rj=V((GT,rue)=>{h();(function(t,e){typeof GT=="object"&&typeof rue<"u"?e(GT):typeof define=="function"&&define.amd?define(["exports"],e):e(t.URI=t.URI||{})})(GT,function(t){"use strict";function e(){for(var Q=arguments.length,Y=Array(Q),te=0;te1){Y[0]=Y[0].slice(0,-1);for(var re=Y.length-1,ie=1;ie= 0x80 (not a basic code point)","invalid-input":"Invalid input"},W=p-g,L=Math.floor,T=String.fromCharCode;function S(Q){throw new RangeError(U[Q])}function k(Q,Y){for(var te=[],re=Q.length;re--;)te[re]=Y(Q[re]);return te}function f(Q,Y){var te=Q.split("@"),re="";te.length>1&&(re=te[0]+"@",Q=te[1]),Q=Q.replace(F,".");var ie=Q.split("."),Ne=k(ie,Y).join(".");return re+Ne}function y(Q){for(var Y=[],te=0,re=Q.length;te=55296&&ie<=56319&&te>1,Y+=L(Y/te);Y>W*v>>1;ie+=p)Y=L(Y/W);return L(ie+(W+1)*Y/(Y+E))},B=function(Y){var te=[],re=Y.length,ie=0,Ne=I,ke=P,je=Y.lastIndexOf($);je<0&&(je=0);for(var kr=0;kr=128&&S("not-basic"),te.push(Y.charCodeAt(kr));for(var Lt=je>0?je+1:0;Lt=re&&S("invalid-input");var Jr=_(Y.charCodeAt(Lt++));(Jr>=p||Jr>L((m-ie)/Xr))&&S("overflow"),ie+=Jr*Xr;var dr=ln<=ke?g:ln>=ke+v?v:ln-ke;if(JrL(m/Qr)&&S("overflow"),Xr*=Qr}var Cr=te.length+1;ke=b(ie-lt,Cr,lt==0),L(ie/Cr)>m-Ne&&S("overflow"),Ne+=L(ie/Cr),ie%=Cr,te.splice(ie++,0,Ne)}return String.fromCodePoint.apply(String,te)},q=function(Y){var te=[];Y=y(Y);var re=Y.length,ie=I,Ne=0,ke=P,je=!0,kr=!1,Lt=void 0;try{for(var lt=Y[Symbol.iterator](),Xr;!(je=(Xr=lt.next()).done);je=!0){var ln=Xr.value;ln<128&&te.push(T(ln))}}catch(Oy){kr=!0,Lt=Oy}finally{try{!je&<.return&<.return()}finally{if(kr)throw Lt}}var Jr=te.length,dr=Jr;for(Jr&&te.push($);dr=ie&&xiL((m-Ne)/$i)&&S("overflow"),Ne+=(Qr-ie)*$i,ie=Qr;var uo=!0,Vs=!1,No=void 0;try{for(var Qa=Y[Symbol.iterator](),cp;!(uo=(cp=Qa.next()).done);uo=!0){var dp=cp.value;if(dpm&&S("overflow"),dp==ie){for(var Zu=Ne,jv=p;;jv+=p){var gf=jv<=ke?g:jv>=ke+v?v:jv-ke;if(Zu>6|192).toString(16).toUpperCase()+"%"+(Y&63|128).toString(16).toUpperCase():te="%"+(Y>>12|224).toString(16).toUpperCase()+"%"+(Y>>6&63|128).toString(16).toUpperCase()+"%"+(Y&63|128).toString(16).toUpperCase(),te}function H(Q){for(var Y="",te=0,re=Q.length;te=194&&ie<224){if(re-te>=6){var Ne=parseInt(Q.substr(te+4,2),16);Y+=String.fromCharCode((ie&31)<<6|Ne&63)}else Y+=Q.substr(te,6);te+=6}else if(ie>=224){if(re-te>=9){var ke=parseInt(Q.substr(te+4,2),16),je=parseInt(Q.substr(te+7,2),16);Y+=String.fromCharCode((ie&15)<<12|(ke&63)<<6|je&63)}else Y+=Q.substr(te,9);te+=9}else Y+=Q.substr(te,3),te+=3}return Y}function X(Q,Y){function te(re){var ie=H(re);return ie.match(Y.UNRESERVED)?ie:re}return Q.scheme&&(Q.scheme=String(Q.scheme).replace(Y.PCT_ENCODED,te).toLowerCase().replace(Y.NOT_SCHEME,"")),Q.userinfo!==void 0&&(Q.userinfo=String(Q.userinfo).replace(Y.PCT_ENCODED,te).replace(Y.NOT_USERINFO,G).replace(Y.PCT_ENCODED,i)),Q.host!==void 0&&(Q.host=String(Q.host).replace(Y.PCT_ENCODED,te).toLowerCase().replace(Y.NOT_HOST,G).replace(Y.PCT_ENCODED,i)),Q.path!==void 0&&(Q.path=String(Q.path).replace(Y.PCT_ENCODED,te).replace(Q.scheme?Y.NOT_PATH:Y.NOT_PATH_NOSCHEME,G).replace(Y.PCT_ENCODED,i)),Q.query!==void 0&&(Q.query=String(Q.query).replace(Y.PCT_ENCODED,te).replace(Y.NOT_QUERY,G).replace(Y.PCT_ENCODED,i)),Q.fragment!==void 0&&(Q.fragment=String(Q.fragment).replace(Y.PCT_ENCODED,te).replace(Y.NOT_FRAGMENT,G).replace(Y.PCT_ENCODED,i)),Q}function ee(Q){return Q.replace(/^0*(.*)/,"$1")||"0"}function ue(Q,Y){var te=Q.match(Y.IPV4ADDRESS)||[],re=c(te,2),ie=re[1];return ie?ie.split(".").map(ee).join("."):Q}function ae(Q,Y){var te=Q.match(Y.IPV6ADDRESS)||[],re=c(te,3),ie=re[1],Ne=re[2];if(ie){for(var ke=ie.toLowerCase().split("::").reverse(),je=c(ke,2),kr=je[0],Lt=je[1],lt=Lt?Lt.split(":").map(ee):[],Xr=kr.split(":").map(ee),ln=Y.IPV4ADDRESS.test(Xr[Xr.length-1]),Jr=ln?7:8,dr=Xr.length-Jr,Qr=Array(Jr),Cr=0;Cr1){var jr=Qr.slice(0,_i.index),xi=Qr.slice(_i.index+_i.length);Oi=jr.join(":")+"::"+xi.join(":")}else Oi=Qr.join(":");return Ne&&(Oi+="%"+Ne),Oi}else return Q}var ce=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,me="".match(/(){0}/)[1]===void 0;function Ee(Q){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},te={},re=Y.iri!==!1?u:d;Y.reference==="suffix"&&(Q=(Y.scheme?Y.scheme+":":"")+"//"+Q);var ie=Q.match(ce);if(ie){me?(te.scheme=ie[1],te.userinfo=ie[3],te.host=ie[4],te.port=parseInt(ie[5],10),te.path=ie[6]||"",te.query=ie[7],te.fragment=ie[8],isNaN(te.port)&&(te.port=ie[5])):(te.scheme=ie[1]||void 0,te.userinfo=Q.indexOf("@")!==-1?ie[3]:void 0,te.host=Q.indexOf("//")!==-1?ie[4]:void 0,te.port=parseInt(ie[5],10),te.path=ie[6]||"",te.query=Q.indexOf("?")!==-1?ie[7]:void 0,te.fragment=Q.indexOf("#")!==-1?ie[8]:void 0,isNaN(te.port)&&(te.port=Q.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?ie[4]:void 0)),te.host&&(te.host=ae(ue(te.host,re),re)),te.scheme===void 0&&te.userinfo===void 0&&te.host===void 0&&te.port===void 0&&!te.path&&te.query===void 0?te.reference="same-document":te.scheme===void 0?te.reference="relative":te.fragment===void 0?te.reference="absolute":te.reference="uri",Y.reference&&Y.reference!=="suffix"&&Y.reference!==te.reference&&(te.error=te.error||"URI is not a "+Y.reference+" reference.");var Ne=Z[(Y.scheme||te.scheme||"").toLowerCase()];if(!Y.unicodeSupport&&(!Ne||!Ne.unicodeSupport)){if(te.host&&(Y.domainHost||Ne&&Ne.domainHost))try{te.host=J.toASCII(te.host.replace(re.PCT_ENCODED,H).toLowerCase())}catch(ke){te.error=te.error||"Host's domain name can not be converted to ASCII via punycode: "+ke}X(te,d)}else X(te,re);Ne&&Ne.parse&&Ne.parse(te,Y)}else te.error=te.error||"URI can not be parsed.";return te}function qe(Q,Y){var te=Y.iri!==!1?u:d,re=[];return Q.userinfo!==void 0&&(re.push(Q.userinfo),re.push("@")),Q.host!==void 0&&re.push(ae(ue(String(Q.host),te),te).replace(te.IPV6ADDRESS,function(ie,Ne,ke){return"["+Ne+(ke?"%25"+ke:"")+"]"})),(typeof Q.port=="number"||typeof Q.port=="string")&&(re.push(":"),re.push(String(Q.port))),re.length?re.join(""):void 0}var fe=/^\.\.?\//,ve=/^\/\.(\/|$)/,we=/^\/\.\.(\/|$)/,Ce=/^\/?(?:.|\n)*?(?=\/|$)/;function Pe(Q){for(var Y=[];Q.length;)if(Q.match(fe))Q=Q.replace(fe,"");else if(Q.match(ve))Q=Q.replace(ve,"/");else if(Q.match(we))Q=Q.replace(we,"/"),Y.pop();else if(Q==="."||Q==="..")Q="";else{var te=Q.match(Ce);if(te){var re=te[0];Q=Q.slice(re.length),Y.push(re)}else throw new Error("Unexpected dot segment condition")}return Y.join("")}function Ue(Q){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},te=Y.iri?u:d,re=[],ie=Z[(Y.scheme||Q.scheme||"").toLowerCase()];if(ie&&ie.serialize&&ie.serialize(Q,Y),Q.host&&!te.IPV6ADDRESS.test(Q.host)){if(Y.domainHost||ie&&ie.domainHost)try{Q.host=Y.iri?J.toUnicode(Q.host):J.toASCII(Q.host.replace(te.PCT_ENCODED,H).toLowerCase())}catch(je){Q.error=Q.error||"Host's domain name can not be converted to "+(Y.iri?"Unicode":"ASCII")+" via punycode: "+je}}X(Q,te),Y.reference!=="suffix"&&Q.scheme&&(re.push(Q.scheme),re.push(":"));var Ne=qe(Q,Y);if(Ne!==void 0&&(Y.reference!=="suffix"&&re.push("//"),re.push(Ne),Q.path&&Q.path.charAt(0)!=="/"&&re.push("/")),Q.path!==void 0){var ke=Q.path;!Y.absolutePath&&(!ie||!ie.absolutePath)&&(ke=Pe(ke)),Ne===void 0&&(ke=ke.replace(/^\/\//,"/%2F")),re.push(ke)}return Q.query!==void 0&&(re.push("?"),re.push(Q.query)),Q.fragment!==void 0&&(re.push("#"),re.push(Q.fragment)),re.join("")}function bt(Q,Y){var te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},re=arguments[3],ie={};return re||(Q=Ee(Ue(Q,te),te),Y=Ee(Ue(Y,te),te)),te=te||{},!te.tolerant&&Y.scheme?(ie.scheme=Y.scheme,ie.userinfo=Y.userinfo,ie.host=Y.host,ie.port=Y.port,ie.path=Pe(Y.path||""),ie.query=Y.query):(Y.userinfo!==void 0||Y.host!==void 0||Y.port!==void 0?(ie.userinfo=Y.userinfo,ie.host=Y.host,ie.port=Y.port,ie.path=Pe(Y.path||""),ie.query=Y.query):(Y.path?(Y.path.charAt(0)==="/"?ie.path=Pe(Y.path):((Q.userinfo!==void 0||Q.host!==void 0||Q.port!==void 0)&&!Q.path?ie.path="/"+Y.path:Q.path?ie.path=Q.path.slice(0,Q.path.lastIndexOf("/")+1)+Y.path:ie.path=Y.path,ie.path=Pe(ie.path)),ie.query=Y.query):(ie.path=Q.path,Y.query!==void 0?ie.query=Y.query:ie.query=Q.query),ie.userinfo=Q.userinfo,ie.host=Q.host,ie.port=Q.port),ie.scheme=Q.scheme),ie.fragment=Y.fragment,ie}function Te(Q,Y,te){var re=s({scheme:"null"},te);return Ue(bt(Ee(Q,re),Ee(Y,re),re,!0),re)}function De(Q,Y){return typeof Q=="string"?Q=Ue(Ee(Q,Y),Y):n(Q)==="object"&&(Q=Ee(Ue(Q,Y),Y)),Q}function Dt(Q,Y,te){return typeof Q=="string"?Q=Ue(Ee(Q,te),te):n(Q)==="object"&&(Q=Ue(Q,te)),typeof Y=="string"?Y=Ue(Ee(Y,te),te):n(Y)==="object"&&(Y=Ue(Y,te)),Q===Y}function _e(Q,Y){return Q&&Q.toString().replace(!Y||!Y.iri?d.ESCAPE:u.ESCAPE,G)}function Se(Q,Y){return Q&&Q.toString().replace(!Y||!Y.iri?d.PCT_ENCODED:u.PCT_ENCODED,H)}var Wr={scheme:"http",domainHost:!0,parse:function(Y,te){return Y.host||(Y.error=Y.error||"HTTP URIs must have a host."),Y},serialize:function(Y,te){var re=String(Y.scheme).toLowerCase()==="https";return(Y.port===(re?443:80)||Y.port==="")&&(Y.port=void 0),Y.path||(Y.path="/"),Y}},ze={scheme:"https",domainHost:Wr.domainHost,parse:Wr.parse,serialize:Wr.serialize};function Ge(Q){return typeof Q.secure=="boolean"?Q.secure:String(Q.scheme).toLowerCase()==="wss"}var zs={scheme:"ws",domainHost:!0,parse:function(Y,te){var re=Y;return re.secure=Ge(re),re.resourceName=(re.path||"/")+(re.query?"?"+re.query:""),re.path=void 0,re.query=void 0,re},serialize:function(Y,te){if((Y.port===(Ge(Y)?443:80)||Y.port==="")&&(Y.port=void 0),typeof Y.secure=="boolean"&&(Y.scheme=Y.secure?"wss":"ws",Y.secure=void 0),Y.resourceName){var re=Y.resourceName.split("?"),ie=c(re,2),Ne=ie[0],ke=ie[1];Y.path=Ne&&Ne!=="/"?Ne:void 0,Y.query=ke,Y.resourceName=void 0}return Y.fragment=void 0,Y}},pt={scheme:"wss",domainHost:zs.domainHost,parse:zs.parse,serialize:zs.serialize},Mt={},wi=!0,Pt="[A-Za-z0-9\\-\\.\\_\\~"+(wi?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",Xe="[0-9A-Fa-f]",Kc=r(r("%[EFef]"+Xe+"%"+Xe+Xe+"%"+Xe+Xe)+"|"+r("%[89A-Fa-f]"+Xe+"%"+Xe+Xe)+"|"+r("%"+Xe+Xe)),kt="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Ut="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",By=e(Ut,'[\\"\\\\]'),$t="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Jt=new RegExp(Pt,"g"),Fc=new RegExp(Kc,"g"),Yt=new RegExp(e("[^]",kt,"[\\.]",'[\\"]',By),"g"),Wt=new RegExp(e("[^]",Pt,$t),"g"),My=Wt;function qt(Q){var Y=H(Q);return Y.match(Jt)?Y:Q}var Vt={scheme:"mailto",parse:function(Y,te){var re=Y,ie=re.to=re.path?re.path.split(","):[];if(re.path=void 0,re.query){for(var Ne=!1,ke={},je=re.query.split("&"),kr=0,Lt=je.length;kr{"use strict";h();Object.defineProperty(nj,"__esModule",{value:!0});var nue=rj();nue.code='require("ajv/dist/runtime/uri").default';nj.default=nue});var fue=V(ss=>{"use strict";h();Object.defineProperty(ss,"__esModule",{value:!0});ss.CodeGen=ss.Name=ss.nil=ss.stringify=ss.str=ss._=ss.KeywordCxt=void 0;var KUe=n6();Object.defineProperty(ss,"KeywordCxt",{enumerable:!0,get:function(){return KUe.KeywordCxt}});var v1=rr();Object.defineProperty(ss,"_",{enumerable:!0,get:function(){return v1._}});Object.defineProperty(ss,"str",{enumerable:!0,get:function(){return v1.str}});Object.defineProperty(ss,"stringify",{enumerable:!0,get:function(){return v1.stringify}});Object.defineProperty(ss,"nil",{enumerable:!0,get:function(){return v1.nil}});Object.defineProperty(ss,"Name",{enumerable:!0,get:function(){return v1.Name}});Object.defineProperty(ss,"CodeGen",{enumerable:!0,get:function(){return v1.CodeGen}});var FUe=WT(),due=VT(),zUe=$N(),o6=i6(),WUe=rr(),s6=e6(),JT=QE(),oj=Br(),oue=tue(),VUe=iue(),uue=(t,e)=>new RegExp(t,e);uue.code="new RegExp";var HUe=["removeAdditional","useDefaults","coerceTypes"],GUe=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),JUe={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},YUe={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},sue=200;function ZUe(t){var e,r,n,i,o,s,a,d,u,c,l,m,p,g,v,E,A,P,I,$,N,K,F,U,W;let L=t.strict,T=(e=t.code)===null||e===void 0?void 0:e.optimize,S=T===!0||T===void 0?1:T||0,k=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:uue,f=(i=t.uriResolver)!==null&&i!==void 0?i:VUe.default;return{strictSchema:(s=(o=t.strictSchema)!==null&&o!==void 0?o:L)!==null&&s!==void 0?s:!0,strictNumbers:(d=(a=t.strictNumbers)!==null&&a!==void 0?a:L)!==null&&d!==void 0?d:!0,strictTypes:(c=(u=t.strictTypes)!==null&&u!==void 0?u:L)!==null&&c!==void 0?c:"log",strictTuples:(m=(l=t.strictTuples)!==null&&l!==void 0?l:L)!==null&&m!==void 0?m:"log",strictRequired:(g=(p=t.strictRequired)!==null&&p!==void 0?p:L)!==null&&g!==void 0?g:!1,code:t.code?{...t.code,optimize:S,regExp:k}:{optimize:S,regExp:k},loopRequired:(v=t.loopRequired)!==null&&v!==void 0?v:sue,loopEnum:(E=t.loopEnum)!==null&&E!==void 0?E:sue,meta:(A=t.meta)!==null&&A!==void 0?A:!0,messages:(P=t.messages)!==null&&P!==void 0?P:!0,inlineRefs:(I=t.inlineRefs)!==null&&I!==void 0?I:!0,schemaId:($=t.schemaId)!==null&&$!==void 0?$:"$id",addUsedSchema:(N=t.addUsedSchema)!==null&&N!==void 0?N:!0,validateSchema:(K=t.validateSchema)!==null&&K!==void 0?K:!0,validateFormats:(F=t.validateFormats)!==null&&F!==void 0?F:!0,unicodeRegExp:(U=t.unicodeRegExp)!==null&&U!==void 0?U:!0,int32range:(W=t.int32range)!==null&&W!==void 0?W:!0,uriResolver:f}}var a6=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...ZUe(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new WUe.ValueScope({scope:{},prefixes:GUe,es5:r,lines:n}),this.logger=nqe(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,zUe.getRules)(),aue.call(this,JUe,e,"NOT SUPPORTED"),aue.call(this,YUe,e,"DEPRECATED","warn"),this._metaOpts=tqe.call(this),e.formats&&QUe.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&eqe.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),XUe.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=oue;n==="id"&&(i={...oue},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(c,l){await o.call(this,c.$schema);let m=this._addSchema(c,l);return m.validate||s.call(this,m)}async function o(c){c&&!this.getSchema(c)&&await i.call(this,{$ref:c},!0)}async function s(c){try{return this._compileSchemaEnv(c)}catch(l){if(!(l instanceof due.default))throw l;return a.call(this,l),await d.call(this,l.missingSchema),s.call(this,c)}}function a({missingSchema:c,missingRef:l}){if(this.refs[c])throw new Error(`AnySchema ${c} is loaded but ${l} cannot be resolved`)}async function d(c){let l=await u.call(this,c);this.refs[c]||await o.call(this,l.$schema),this.refs[c]||this.addSchema(l,c,r)}async function u(c){let l=this._loading[c];if(l)return l;try{return await(this._loading[c]=n(c))}finally{delete this._loading[c]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,n,i);return this}let o;if(typeof e=="object"){let{schemaId:s}=this.opts;if(o=e[s],o!==void 0&&typeof o!="string")throw new Error(`schema ${s} must be string`)}return r=(0,s6.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return i}getSchema(e){let r;for(;typeof(r=cue.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new o6.SchemaEnv({schema:{},schemaId:n});if(r=o6.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=cue.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,s6.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(oqe.call(this,n,r),!r)return(0,oj.eachItem)(n,o=>ij.call(this,o)),this;aqe.call(this,r);let i={...r,type:(0,JT.getJSONTypes)(r.type),schemaType:(0,JT.getJSONTypes)(r.schemaType)};return(0,oj.eachItem)(n,i.type.length===0?o=>ij.call(this,o,i):o=>i.type.forEach(s=>ij.call(this,o,i,s))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(o=>o.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,o)=>i+r+o)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let o=i.split("/").slice(1),s=e;for(let a of o)s=s[a];for(let a in n){let d=n[a];if(typeof d!="object")continue;let{$data:u}=d.definition,c=s[a];u&&c&&(s[a]=lue(c))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof e=="object")s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let d=this._cache.get(e);if(d!==void 0)return d;n=(0,s6.normalizeId)(s||n);let u=s6.getSchemaRefs.call(this,e,n);return d=new o6.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(d.schema,d),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=d),i&&this.validateSchema(e,!0),d}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):o6.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{o6.compileSchema.call(this,e)}finally{this.opts=r}}};ss.default=a6;a6.ValidationError=FUe.default;a6.MissingRefError=due.default;function aue(t,e,r,n="error"){for(let i in t){let o=i;o in e&&this.logger[n](`${r}: option ${i}. ${t[o]}`)}}function cue(t){return t=(0,s6.normalizeId)(t),this.schemas[t]||this.refs[t]}function XUe(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function QUe(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function eqe(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function tqe(){let t={...this.opts};for(let e of HUe)delete t[e];return t}var rqe={log(){},warn(){},error(){}};function nqe(t){if(t===!1)return rqe;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var iqe=/^[a-z_$][a-z0-9_$:-]*$/i;function oqe(t,e){let{RULES:r}=this;if((0,oj.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!iqe.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function ij(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=i?o.post:o.rules.find(({type:d})=>d===r);if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,JT.getJSONTypes)(e.type),schemaType:(0,JT.getJSONTypes)(e.schemaType)}};e.before?sqe.call(this,s,a,e.before):s.rules.push(a),o.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(d=>this.addKeyword(d))}function sqe(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function aqe(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=lue(e)),t.validateSchema=this.compile(e,!0))}var cqe={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function lue(t){return{anyOf:[t,cqe]}}});var hue=V(sj=>{"use strict";h();Object.defineProperty(sj,"__esModule",{value:!0});var dqe={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};sj.default=dqe});var XT=V(Rg=>{"use strict";h();Object.defineProperty(Rg,"__esModule",{value:!0});Rg.callRef=Rg.getValidate=void 0;var uqe=VT(),pue=Ed(),Ua=rr(),b1=xd(),mue=i6(),YT=Br(),lqe={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:o,validateName:s,opts:a,self:d}=n,{root:u}=o;if((r==="#"||r==="#/")&&i===u.baseId)return l();let c=mue.resolveRef.call(d,u,i,r);if(c===void 0)throw new uqe.default(n.opts.uriResolver,i,r);if(c instanceof mue.SchemaEnv)return m(c);return p(c);function l(){if(o===u)return ZT(t,s,o,o.$async);let g=e.scopeValue("root",{ref:u});return ZT(t,(0,Ua._)`${g}.validate`,u,u.$async)}function m(g){let v=yue(t,g);ZT(t,v,g,g.$async)}function p(g){let v=e.scopeValue("schema",a.code.source===!0?{ref:g,code:(0,Ua.stringify)(g)}:{ref:g}),E=e.name("valid"),A=t.subschema({schema:g,dataTypes:[],schemaPath:Ua.nil,topSchemaRef:v,errSchemaPath:r},E);t.mergeEvaluated(A),t.ok(E)}}};function yue(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Ua._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Rg.getValidate=yue;function ZT(t,e,r,n){let{gen:i,it:o}=t,{allErrors:s,schemaEnv:a,opts:d}=o,u=d.passContext?b1.default.this:Ua.nil;n?c():l();function c(){if(!a.$async)throw new Error("async schema referenced by sync schema");let g=i.let("valid");i.try(()=>{i.code((0,Ua._)`await ${(0,pue.callValidateCode)(t,e,u)}`),p(e),s||i.assign(g,!0)},v=>{i.if((0,Ua._)`!(${v} instanceof ${o.ValidationError})`,()=>i.throw(v)),m(v),s||i.assign(g,!1)}),t.ok(g)}function l(){t.result((0,pue.callValidateCode)(t,e,u),()=>p(e),()=>m(e))}function m(g){let v=(0,Ua._)`${g}.errors`;i.assign(b1.default.vErrors,(0,Ua._)`${b1.default.vErrors} === null ? ${v} : ${b1.default.vErrors}.concat(${v})`),i.assign(b1.default.errors,(0,Ua._)`${b1.default.vErrors}.length`)}function p(g){var v;if(!o.opts.unevaluated)return;let E=(v=r?.validate)===null||v===void 0?void 0:v.evaluated;if(o.props!==!0)if(E&&!E.dynamicProps)E.props!==void 0&&(o.props=YT.mergeEvaluated.props(i,E.props,o.props));else{let A=i.var("props",(0,Ua._)`${g}.evaluated.props`);o.props=YT.mergeEvaluated.props(i,A,o.props,Ua.Name)}if(o.items!==!0)if(E&&!E.dynamicItems)E.items!==void 0&&(o.items=YT.mergeEvaluated.items(i,E.items,o.items));else{let A=i.var("items",(0,Ua._)`${g}.evaluated.items`);o.items=YT.mergeEvaluated.items(i,A,o.items,Ua.Name)}}}Rg.callRef=ZT;Rg.default=lqe});var gue=V(aj=>{"use strict";h();Object.defineProperty(aj,"__esModule",{value:!0});var fqe=hue(),hqe=XT(),pqe=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",fqe.default,hqe.default];aj.default=pqe});var vue=V(cj=>{"use strict";h();Object.defineProperty(cj,"__esModule",{value:!0});var QT=rr(),Um=QT.operators,eI={maximum:{okStr:"<=",ok:Um.LTE,fail:Um.GT},minimum:{okStr:">=",ok:Um.GTE,fail:Um.LT},exclusiveMaximum:{okStr:"<",ok:Um.LT,fail:Um.GTE},exclusiveMinimum:{okStr:">",ok:Um.GT,fail:Um.LTE}},mqe={message:({keyword:t,schemaCode:e})=>(0,QT.str)`must be ${eI[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,QT._)`{comparison: ${eI[t].okStr}, limit: ${e}}`},yqe={keyword:Object.keys(eI),type:"number",schemaType:"number",$data:!0,error:mqe,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,QT._)`${r} ${eI[e].fail} ${n} || isNaN(${r})`)}};cj.default=yqe});var bue=V(dj=>{"use strict";h();Object.defineProperty(dj,"__esModule",{value:!0});var c6=rr(),gqe={message:({schemaCode:t})=>(0,c6.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,c6._)`{multipleOf: ${t}}`},vqe={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:gqe,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,o=i.opts.multipleOfPrecision,s=e.let("res"),a=o?(0,c6._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,c6._)`${s} !== parseInt(${s})`;t.fail$data((0,c6._)`(${n} === 0 || (${s} = ${r}/${n}, ${a}))`)}};dj.default=vqe});var _ue=V(uj=>{"use strict";h();Object.defineProperty(uj,"__esModule",{value:!0});function wue(t){let e=t.length,r=0,n=0,i;for(;n=55296&&i<=56319&&n{"use strict";h();Object.defineProperty(lj,"__esModule",{value:!0});var Dg=rr(),bqe=Br(),wqe=_ue(),_qe={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Dg.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Dg._)`{limit: ${t}}`},xqe={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:_qe,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,o=e==="maxLength"?Dg.operators.GT:Dg.operators.LT,s=i.opts.unicode===!1?(0,Dg._)`${r}.length`:(0,Dg._)`${(0,bqe.useFunc)(t.gen,wqe.default)}(${r})`;t.fail$data((0,Dg._)`${s} ${o} ${n}`)}};lj.default=xqe});var Eue=V(fj=>{"use strict";h();Object.defineProperty(fj,"__esModule",{value:!0});var Eqe=Ed(),tI=rr(),Sqe={message:({schemaCode:t})=>(0,tI.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,tI._)`{pattern: ${t}}`},Aqe={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Sqe,code(t){let{data:e,$data:r,schema:n,schemaCode:i,it:o}=t,s=o.opts.unicodeRegExp?"u":"",a=r?(0,tI._)`(new RegExp(${i}, ${s}))`:(0,Eqe.usePattern)(t,n);t.fail$data((0,tI._)`!${a}.test(${e})`)}};fj.default=Aqe});var Sue=V(hj=>{"use strict";h();Object.defineProperty(hj,"__esModule",{value:!0});var d6=rr(),Tqe={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,d6.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,d6._)`{limit: ${t}}`},Iqe={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Tqe,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?d6.operators.GT:d6.operators.LT;t.fail$data((0,d6._)`Object.keys(${r}).length ${i} ${n}`)}};hj.default=Iqe});var Aue=V(pj=>{"use strict";h();Object.defineProperty(pj,"__esModule",{value:!0});var u6=Ed(),l6=rr(),Pqe=Br(),kqe={message:({params:{missingProperty:t}})=>(0,l6.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,l6._)`{missingProperty: ${t}}`},Rqe={keyword:"required",type:"object",schemaType:"array",$data:!0,error:kqe,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:o,it:s}=t,{opts:a}=s;if(!o&&r.length===0)return;let d=r.length>=a.loopRequired;if(s.allErrors?u():c(),a.strictRequired){let p=t.parentSchema.properties,{definedProperties:g}=t.it;for(let v of r)if(p?.[v]===void 0&&!g.has(v)){let E=s.schemaEnv.baseId+s.errSchemaPath,A=`required property "${v}" is not defined at "${E}" (strictRequired)`;(0,Pqe.checkStrictMode)(s,A,s.opts.strictRequired)}}function u(){if(d||o)t.block$data(l6.nil,l);else for(let p of r)(0,u6.checkReportMissingProp)(t,p)}function c(){let p=e.let("missing");if(d||o){let g=e.let("valid",!0);t.block$data(g,()=>m(p,g)),t.ok(g)}else e.if((0,u6.checkMissingProp)(t,r,p)),(0,u6.reportMissingProp)(t,p),e.else()}function l(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,u6.noPropertyInData)(e,i,p,a.ownProperties),()=>t.error())})}function m(p,g){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(g,(0,u6.propertyInData)(e,i,p,a.ownProperties)),e.if((0,l6.not)(g),()=>{t.error(),e.break()})},l6.nil)}}};pj.default=Rqe});var Tue=V(mj=>{"use strict";h();Object.defineProperty(mj,"__esModule",{value:!0});var f6=rr(),Dqe={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,f6.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,f6._)`{limit: ${t}}`},Bqe={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Dqe,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?f6.operators.GT:f6.operators.LT;t.fail$data((0,f6._)`${r}.length ${i} ${n}`)}};mj.default=Bqe});var rI=V(yj=>{"use strict";h();Object.defineProperty(yj,"__esModule",{value:!0});var Iue=zN();Iue.code='require("ajv/dist/runtime/equal").default';yj.default=Iue});var Pue=V(vj=>{"use strict";h();Object.defineProperty(vj,"__esModule",{value:!0});var gj=QE(),as=rr(),Mqe=Br(),Cqe=rI(),Oqe={message:({params:{i:t,j:e}})=>(0,as.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,as._)`{i: ${t}, j: ${e}}`},$qe={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Oqe,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:o,schemaCode:s,it:a}=t;if(!n&&!i)return;let d=e.let("valid"),u=o.items?(0,gj.getSchemaTypes)(o.items):[];t.block$data(d,c,(0,as._)`${s} === false`),t.ok(d);function c(){let g=e.let("i",(0,as._)`${r}.length`),v=e.let("j");t.setParams({i:g,j:v}),e.assign(d,!0),e.if((0,as._)`${g} > 1`,()=>(l()?m:p)(g,v))}function l(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function m(g,v){let E=e.name("item"),A=(0,gj.checkDataTypes)(u,E,a.opts.strictNumbers,gj.DataType.Wrong),P=e.const("indices",(0,as._)`{}`);e.for((0,as._)`;${g}--;`,()=>{e.let(E,(0,as._)`${r}[${g}]`),e.if(A,(0,as._)`continue`),u.length>1&&e.if((0,as._)`typeof ${E} == "string"`,(0,as._)`${E} += "_"`),e.if((0,as._)`typeof ${P}[${E}] == "number"`,()=>{e.assign(v,(0,as._)`${P}[${E}]`),t.error(),e.assign(d,!1).break()}).code((0,as._)`${P}[${E}] = ${g}`)})}function p(g,v){let E=(0,Mqe.useFunc)(e,Cqe.default),A=e.name("outer");e.label(A).for((0,as._)`;${g}--;`,()=>e.for((0,as._)`${v} = ${g}; ${v}--;`,()=>e.if((0,as._)`${E}(${r}[${g}], ${r}[${v}])`,()=>{t.error(),e.assign(d,!1).break(A)})))}}};vj.default=$qe});var kue=V(wj=>{"use strict";h();Object.defineProperty(wj,"__esModule",{value:!0});var bj=rr(),Nqe=Br(),jqe=rI(),Uqe={message:"must be equal to constant",params:({schemaCode:t})=>(0,bj._)`{allowedValue: ${t}}`},qqe={keyword:"const",$data:!0,error:Uqe,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:o}=t;n||o&&typeof o=="object"?t.fail$data((0,bj._)`!${(0,Nqe.useFunc)(e,jqe.default)}(${r}, ${i})`):t.fail((0,bj._)`${o} !== ${r}`)}};wj.default=qqe});var Rue=V(_j=>{"use strict";h();Object.defineProperty(_j,"__esModule",{value:!0});var h6=rr(),Lqe=Br(),Kqe=rI(),Fqe={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,h6._)`{allowedValues: ${t}}`},zqe={keyword:"enum",schemaType:"array",$data:!0,error:Fqe,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:o,it:s}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let a=i.length>=s.opts.loopEnum,d,u=()=>d??(d=(0,Lqe.useFunc)(e,Kqe.default)),c;if(a||n)c=e.let("valid"),t.block$data(c,l);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let p=e.const("vSchema",o);c=(0,h6.or)(...i.map((g,v)=>m(p,v)))}t.pass(c);function l(){e.assign(c,!1),e.forOf("v",o,p=>e.if((0,h6._)`${u()}(${r}, ${p})`,()=>e.assign(c,!0).break()))}function m(p,g){let v=i[g];return typeof v=="object"&&v!==null?(0,h6._)`${u()}(${r}, ${p}[${g}])`:(0,h6._)`${r} === ${v}`}}};_j.default=zqe});var Due=V(xj=>{"use strict";h();Object.defineProperty(xj,"__esModule",{value:!0});var Wqe=vue(),Vqe=bue(),Hqe=xue(),Gqe=Eue(),Jqe=Sue(),Yqe=Aue(),Zqe=Tue(),Xqe=Pue(),Qqe=kue(),eLe=Rue(),tLe=[Wqe.default,Vqe.default,Hqe.default,Gqe.default,Jqe.default,Yqe.default,Zqe.default,Xqe.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Qqe.default,eLe.default];xj.default=tLe});var Sj=V(p6=>{"use strict";h();Object.defineProperty(p6,"__esModule",{value:!0});p6.validateAdditionalItems=void 0;var Bg=rr(),Ej=Br(),rLe={message:({params:{len:t}})=>(0,Bg.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Bg._)`{limit: ${t}}`},nLe={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:rLe,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Ej.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Bue(t,n)}};function Bue(t,e){let{gen:r,schema:n,data:i,keyword:o,it:s}=t;s.items=!0;let a=r.const("len",(0,Bg._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Bg._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,Ej.alwaysValidSchema)(s,n)){let u=r.var("valid",(0,Bg._)`${a} <= ${e.length}`);r.if((0,Bg.not)(u),()=>d(u)),t.ok(u)}function d(u){r.forRange("i",e.length,a,c=>{t.subschema({keyword:o,dataProp:c,dataPropType:Ej.Type.Num},u),s.allErrors||r.if((0,Bg.not)(u),()=>r.break())})}}p6.validateAdditionalItems=Bue;p6.default=nLe});var Aj=V(m6=>{"use strict";h();Object.defineProperty(m6,"__esModule",{value:!0});m6.validateTuple=void 0;var Mue=rr(),nI=Br(),iLe=Ed(),oLe={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Cue(t,"additionalItems",e);r.items=!0,!(0,nI.alwaysValidSchema)(r,e)&&t.ok((0,iLe.validateArray)(t))}};function Cue(t,e,r=t.schema){let{gen:n,parentSchema:i,data:o,keyword:s,it:a}=t;c(i),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=nI.mergeEvaluated.items(n,r.length,a.items));let d=n.name("valid"),u=n.const("len",(0,Mue._)`${o}.length`);r.forEach((l,m)=>{(0,nI.alwaysValidSchema)(a,l)||(n.if((0,Mue._)`${u} > ${m}`,()=>t.subschema({keyword:s,schemaProp:m,dataProp:m},d)),t.ok(d))});function c(l){let{opts:m,errSchemaPath:p}=a,g=r.length,v=g===l.minItems&&(g===l.maxItems||l[e]===!1);if(m.strictTuples&&!v){let E=`"${s}" is ${g}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,nI.checkStrictMode)(a,E,m.strictTuples)}}}m6.validateTuple=Cue;m6.default=oLe});var Oue=V(Tj=>{"use strict";h();Object.defineProperty(Tj,"__esModule",{value:!0});var sLe=Aj(),aLe={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,sLe.validateTuple)(t,"items")};Tj.default=aLe});var Nue=V(Ij=>{"use strict";h();Object.defineProperty(Ij,"__esModule",{value:!0});var $ue=rr(),cLe=Br(),dLe=Ed(),uLe=Sj(),lLe={message:({params:{len:t}})=>(0,$ue.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,$ue._)`{limit: ${t}}`},fLe={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:lLe,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,cLe.alwaysValidSchema)(n,e)&&(i?(0,uLe.validateAdditionalItems)(t,i):t.ok((0,dLe.validateArray)(t)))}};Ij.default=fLe});var jue=V(Pj=>{"use strict";h();Object.defineProperty(Pj,"__esModule",{value:!0});var Ad=rr(),iI=Br(),hLe={message:({params:{min:t,max:e}})=>e===void 0?(0,Ad.str)`must contain at least ${t} valid item(s)`:(0,Ad.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Ad._)`{minContains: ${t}}`:(0,Ad._)`{minContains: ${t}, maxContains: ${e}}`},pLe={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:hLe,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:o}=t,s,a,{minContains:d,maxContains:u}=n;o.opts.next?(s=d===void 0?1:d,a=u):s=1;let c=e.const("len",(0,Ad._)`${i}.length`);if(t.setParams({min:s,max:a}),a===void 0&&s===0){(0,iI.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,iI.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,iI.alwaysValidSchema)(o,r)){let v=(0,Ad._)`${c} >= ${s}`;a!==void 0&&(v=(0,Ad._)`${v} && ${c} <= ${a}`),t.pass(v);return}o.items=!0;let l=e.name("valid");a===void 0&&s===1?p(l,()=>e.if(l,()=>e.break())):s===0?(e.let(l,!0),a!==void 0&&e.if((0,Ad._)`${i}.length > 0`,m)):(e.let(l,!1),m()),t.result(l,()=>t.reset());function m(){let v=e.name("_valid"),E=e.let("count",0);p(v,()=>e.if(v,()=>g(E)))}function p(v,E){e.forRange("i",0,c,A=>{t.subschema({keyword:"contains",dataProp:A,dataPropType:iI.Type.Num,compositeRule:!0},v),E()})}function g(v){e.code((0,Ad._)`${v}++`),a===void 0?e.if((0,Ad._)`${v} >= ${s}`,()=>e.assign(l,!0).break()):(e.if((0,Ad._)`${v} > ${a}`,()=>e.assign(l,!1).break()),s===1?e.assign(l,!0):e.if((0,Ad._)`${v} >= ${s}`,()=>e.assign(l,!0)))}}};Pj.default=pLe});var oI=V(Yl=>{"use strict";h();Object.defineProperty(Yl,"__esModule",{value:!0});Yl.validateSchemaDeps=Yl.validatePropertyDeps=Yl.error=void 0;var kj=rr(),mLe=Br(),y6=Ed();Yl.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,kj.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,kj._)`{property: ${t}, missingProperty: ${n}, depsCount: ${e}, deps: ${r}}`};var yLe={keyword:"dependencies",type:"object",schemaType:"object",error:Yl.error,code(t){let[e,r]=gLe(t);Uue(t,e),que(t,r)}};function gLe({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function Uue(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let o=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let d=(0,y6.propertyInData)(r,n,s,i.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),i.allErrors?r.if(d,()=>{for(let u of a)(0,y6.checkReportMissingProp)(t,u)}):(r.if((0,kj._)`${d} && (${(0,y6.checkMissingProp)(t,a,o)})`),(0,y6.reportMissingProp)(t,o),r.else())}}Yl.validatePropertyDeps=Uue;function que(t,e=t.schema){let{gen:r,data:n,keyword:i,it:o}=t,s=r.name("valid");for(let a in e)(0,mLe.alwaysValidSchema)(o,e[a])||(r.if((0,y6.propertyInData)(r,n,a,o.opts.ownProperties),()=>{let d=t.subschema({keyword:i,schemaProp:a},s);t.mergeValidEvaluated(d,s)},()=>r.var(s,!0)),t.ok(s))}Yl.validateSchemaDeps=que;Yl.default=yLe});var Kue=V(Rj=>{"use strict";h();Object.defineProperty(Rj,"__esModule",{value:!0});var Lue=rr(),vLe=Br(),bLe={message:"property name must be valid",params:({params:t})=>(0,Lue._)`{propertyName: ${t.propertyName}}`},wLe={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:bLe,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,vLe.alwaysValidSchema)(i,r))return;let o=e.name("valid");e.forIn("key",n,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),e.if((0,Lue.not)(o),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(o)}};Rj.default=wLe});var Bj=V(Dj=>{"use strict";h();Object.defineProperty(Dj,"__esModule",{value:!0});var sI=Ed(),Bu=rr(),_Le=xd(),aI=Br(),xLe={message:"must NOT have additional properties",params:({params:t})=>(0,Bu._)`{additionalProperty: ${t.additionalProperty}}`},ELe={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:xLe,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:o,it:s}=t;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:d}=s;if(s.props=!0,d.removeAdditional!=="all"&&(0,aI.alwaysValidSchema)(s,r))return;let u=(0,sI.allSchemaProperties)(n.properties),c=(0,sI.allSchemaProperties)(n.patternProperties);l(),t.ok((0,Bu._)`${o} === ${_Le.default.errors}`);function l(){e.forIn("key",i,E=>{!u.length&&!c.length?g(E):e.if(m(E),()=>g(E))})}function m(E){let A;if(u.length>8){let P=(0,aI.schemaRefOrVal)(s,n.properties,"properties");A=(0,sI.isOwnProperty)(e,P,E)}else u.length?A=(0,Bu.or)(...u.map(P=>(0,Bu._)`${E} === ${P}`)):A=Bu.nil;return c.length&&(A=(0,Bu.or)(A,...c.map(P=>(0,Bu._)`${(0,sI.usePattern)(t,P)}.test(${E})`))),(0,Bu.not)(A)}function p(E){e.code((0,Bu._)`delete ${i}[${E}]`)}function g(E){if(d.removeAdditional==="all"||d.removeAdditional&&r===!1){p(E);return}if(r===!1){t.setParams({additionalProperty:E}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,aI.alwaysValidSchema)(s,r)){let A=e.name("valid");d.removeAdditional==="failing"?(v(E,A,!1),e.if((0,Bu.not)(A),()=>{t.reset(),p(E)})):(v(E,A),a||e.if((0,Bu.not)(A),()=>e.break()))}}function v(E,A,P){let I={keyword:"additionalProperties",dataProp:E,dataPropType:aI.Type.Str};P===!1&&Object.assign(I,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(I,A)}}};Dj.default=ELe});var Wue=V(Cj=>{"use strict";h();Object.defineProperty(Cj,"__esModule",{value:!0});var SLe=n6(),Fue=Ed(),Mj=Br(),zue=Bj(),ALe={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:o}=t;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&zue.default.code(new SLe.KeywordCxt(o,zue.default,"additionalProperties"));let s=(0,Fue.allSchemaProperties)(r);for(let l of s)o.definedProperties.add(l);o.opts.unevaluated&&s.length&&o.props!==!0&&(o.props=Mj.mergeEvaluated.props(e,(0,Mj.toHash)(s),o.props));let a=s.filter(l=>!(0,Mj.alwaysValidSchema)(o,r[l]));if(a.length===0)return;let d=e.name("valid");for(let l of a)u(l)?c(l):(e.if((0,Fue.propertyInData)(e,i,l,o.opts.ownProperties)),c(l),o.allErrors||e.else().var(d,!0),e.endIf()),t.it.definedProperties.add(l),t.ok(d);function u(l){return o.opts.useDefaults&&!o.compositeRule&&r[l].default!==void 0}function c(l){t.subschema({keyword:"properties",schemaProp:l,dataProp:l},d)}}};Cj.default=ALe});var Jue=V(Oj=>{"use strict";h();Object.defineProperty(Oj,"__esModule",{value:!0});var Vue=Ed(),cI=rr(),Hue=Br(),Gue=Br(),TLe={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:o}=t,{opts:s}=o,a=(0,Vue.allSchemaProperties)(r),d=a.filter(v=>(0,Hue.alwaysValidSchema)(o,r[v]));if(a.length===0||d.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let u=s.strictSchema&&!s.allowMatchingProperties&&i.properties,c=e.name("valid");o.props!==!0&&!(o.props instanceof cI.Name)&&(o.props=(0,Gue.evaluatedPropsToName)(e,o.props));let{props:l}=o;m();function m(){for(let v of a)u&&p(v),o.allErrors?g(v):(e.var(c,!0),g(v),e.if(c))}function p(v){for(let E in u)new RegExp(v).test(E)&&(0,Hue.checkStrictMode)(o,`property ${E} matches pattern ${v} (use allowMatchingProperties)`)}function g(v){e.forIn("key",n,E=>{e.if((0,cI._)`${(0,Vue.usePattern)(t,v)}.test(${E})`,()=>{let A=d.includes(v);A||t.subschema({keyword:"patternProperties",schemaProp:v,dataProp:E,dataPropType:Gue.Type.Str},c),o.opts.unevaluated&&l!==!0?e.assign((0,cI._)`${l}[${E}]`,!0):!A&&!o.allErrors&&e.if((0,cI.not)(c),()=>e.break())})})}}};Oj.default=TLe});var Yue=V($j=>{"use strict";h();Object.defineProperty($j,"__esModule",{value:!0});var ILe=Br(),PLe={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,ILe.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};$j.default=PLe});var Zue=V(Nj=>{"use strict";h();Object.defineProperty(Nj,"__esModule",{value:!0});var kLe=Ed(),RLe={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:kLe.validateUnion,error:{message:"must match a schema in anyOf"}};Nj.default=RLe});var Xue=V(jj=>{"use strict";h();Object.defineProperty(jj,"__esModule",{value:!0});var dI=rr(),DLe=Br(),BLe={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,dI._)`{passingSchemas: ${t.passing}}`},MLe={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:BLe,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let o=r,s=e.let("valid",!1),a=e.let("passing",null),d=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(s,()=>t.reset(),()=>t.error(!0));function u(){o.forEach((c,l)=>{let m;(0,DLe.alwaysValidSchema)(i,c)?e.var(d,!0):m=t.subschema({keyword:"oneOf",schemaProp:l,compositeRule:!0},d),l>0&&e.if((0,dI._)`${d} && ${s}`).assign(s,!1).assign(a,(0,dI._)`[${a}, ${l}]`).else(),e.if(d,()=>{e.assign(s,!0),e.assign(a,l),m&&t.mergeEvaluated(m,dI.Name)})})}}};jj.default=MLe});var Que=V(Uj=>{"use strict";h();Object.defineProperty(Uj,"__esModule",{value:!0});var CLe=Br(),OLe={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((o,s)=>{if((0,CLe.alwaysValidSchema)(n,o))return;let a=t.subschema({keyword:"allOf",schemaProp:s},i);t.ok(i),t.mergeEvaluated(a)})}};Uj.default=OLe});var rle=V(qj=>{"use strict";h();Object.defineProperty(qj,"__esModule",{value:!0});var uI=rr(),tle=Br(),$Le={message:({params:t})=>(0,uI.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,uI._)`{failingKeyword: ${t.ifClause}}`},NLe={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:$Le,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,tle.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=ele(n,"then"),o=ele(n,"else");if(!i&&!o)return;let s=e.let("valid",!0),a=e.name("_valid");if(d(),t.reset(),i&&o){let c=e.let("ifClause");t.setParams({ifClause:c}),e.if(a,u("then",c),u("else",c))}else i?e.if(a,u("then")):e.if((0,uI.not)(a),u("else"));t.pass(s,()=>t.error(!0));function d(){let c=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(c)}function u(c,l){return()=>{let m=t.subschema({keyword:c},a);e.assign(s,a),t.mergeValidEvaluated(m,s),l?e.assign(l,(0,uI._)`${c}`):t.setParams({ifClause:c})}}}};function ele(t,e){let r=t.schema[e];return r!==void 0&&!(0,tle.alwaysValidSchema)(t,r)}qj.default=NLe});var nle=V(Lj=>{"use strict";h();Object.defineProperty(Lj,"__esModule",{value:!0});var jLe=Br(),ULe={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,jLe.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Lj.default=ULe});var ile=V(Kj=>{"use strict";h();Object.defineProperty(Kj,"__esModule",{value:!0});var qLe=Sj(),LLe=Oue(),KLe=Aj(),FLe=Nue(),zLe=jue(),WLe=oI(),VLe=Kue(),HLe=Bj(),GLe=Wue(),JLe=Jue(),YLe=Yue(),ZLe=Zue(),XLe=Xue(),QLe=Que(),eKe=rle(),tKe=nle();function rKe(t=!1){let e=[YLe.default,ZLe.default,XLe.default,QLe.default,eKe.default,tKe.default,VLe.default,HLe.default,WLe.default,GLe.default,JLe.default];return t?e.push(LLe.default,FLe.default):e.push(qLe.default,KLe.default),e.push(zLe.default),e}Kj.default=rKe});var zj=V(g6=>{"use strict";h();Object.defineProperty(g6,"__esModule",{value:!0});g6.dynamicAnchor=void 0;var Fj=rr(),nKe=xd(),ole=i6(),iKe=XT(),oKe={keyword:"$dynamicAnchor",schemaType:"string",code:t=>sle(t,t.schema)};function sle(t,e){let{gen:r,it:n}=t;n.schemaEnv.root.dynamicAnchors[e]=!0;let i=(0,Fj._)`${nKe.default.dynamicAnchors}${(0,Fj.getProperty)(e)}`,o=n.errSchemaPath==="#"?n.validateName:sKe(t);r.if((0,Fj._)`!${i}`,()=>r.assign(i,o))}g6.dynamicAnchor=sle;function sKe(t){let{schemaEnv:e,schema:r,self:n}=t.it,{root:i,baseId:o,localRefs:s,meta:a}=e.root,{schemaId:d}=n.opts,u=new ole.SchemaEnv({schema:r,schemaId:d,root:i,baseId:o,localRefs:s,meta:a});return ole.compileSchema.call(n,u),(0,iKe.getValidate)(t,u)}g6.default=oKe});var Wj=V(v6=>{"use strict";h();Object.defineProperty(v6,"__esModule",{value:!0});v6.dynamicRef=void 0;var ale=rr(),aKe=xd(),cle=XT(),cKe={keyword:"$dynamicRef",schemaType:"string",code:t=>dle(t,t.schema)};function dle(t,e){let{gen:r,keyword:n,it:i}=t;if(e[0]!=="#")throw new Error(`"${n}" only supports hash fragment reference`);let o=e.slice(1);if(i.allErrors)s();else{let d=r.let("valid",!1);s(d),t.ok(d)}function s(d){if(i.schemaEnv.root.dynamicAnchors[o]){let u=r.let("_v",(0,ale._)`${aKe.default.dynamicAnchors}${(0,ale.getProperty)(o)}`);r.if(u,a(u,d),a(i.validateName,d))}else a(i.validateName,d)()}function a(d,u){return u?()=>r.block(()=>{(0,cle.callRef)(t,d),r.let(u,!0)}):()=>(0,cle.callRef)(t,d)}}v6.dynamicRef=dle;v6.default=cKe});var ule=V(Vj=>{"use strict";h();Object.defineProperty(Vj,"__esModule",{value:!0});var dKe=zj(),uKe=Br(),lKe={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,dKe.dynamicAnchor)(t,""):(0,uKe.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}};Vj.default=lKe});var lle=V(Hj=>{"use strict";h();Object.defineProperty(Hj,"__esModule",{value:!0});var fKe=Wj(),hKe={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,fKe.dynamicRef)(t,t.schema)};Hj.default=hKe});var fle=V(Gj=>{"use strict";h();Object.defineProperty(Gj,"__esModule",{value:!0});var pKe=zj(),mKe=Wj(),yKe=ule(),gKe=lle(),vKe=[pKe.default,mKe.default,yKe.default,gKe.default];Gj.default=vKe});var ple=V(Jj=>{"use strict";h();Object.defineProperty(Jj,"__esModule",{value:!0});var hle=oI(),bKe={keyword:"dependentRequired",type:"object",schemaType:"object",error:hle.error,code:t=>(0,hle.validatePropertyDeps)(t)};Jj.default=bKe});var mle=V(Yj=>{"use strict";h();Object.defineProperty(Yj,"__esModule",{value:!0});var wKe=oI(),_Ke={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,wKe.validateSchemaDeps)(t)};Yj.default=_Ke});var yle=V(Zj=>{"use strict";h();Object.defineProperty(Zj,"__esModule",{value:!0});var xKe=Br(),EKe={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:e,it:r}){e.contains===void 0&&(0,xKe.checkStrictMode)(r,`"${t}" without "contains" is ignored`)}};Zj.default=EKe});var gle=V(Xj=>{"use strict";h();Object.defineProperty(Xj,"__esModule",{value:!0});var SKe=ple(),AKe=mle(),TKe=yle(),IKe=[SKe.default,AKe.default,TKe.default];Xj.default=IKe});var ble=V(Qj=>{"use strict";h();Object.defineProperty(Qj,"__esModule",{value:!0});var qm=rr(),vle=Br(),PKe=xd(),kKe={message:"must NOT have unevaluated properties",params:({params:t})=>(0,qm._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`},RKe={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:kKe,code(t){let{gen:e,schema:r,data:n,errsCount:i,it:o}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:s,props:a}=o;a instanceof qm.Name?e.if((0,qm._)`${a} !== true`,()=>e.forIn("key",n,l=>e.if(u(a,l),()=>d(l)))):a!==!0&&e.forIn("key",n,l=>a===void 0?d(l):e.if(c(a,l),()=>d(l))),o.props=!0,t.ok((0,qm._)`${i} === ${PKe.default.errors}`);function d(l){if(r===!1){t.setParams({unevaluatedProperty:l}),t.error(),s||e.break();return}if(!(0,vle.alwaysValidSchema)(o,r)){let m=e.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:l,dataPropType:vle.Type.Str},m),s||e.if((0,qm.not)(m),()=>e.break())}}function u(l,m){return(0,qm._)`!${l} || !${l}[${m}]`}function c(l,m){let p=[];for(let g in l)l[g]===!0&&p.push((0,qm._)`${m} !== ${g}`);return(0,qm.and)(...p)}}};Qj.default=RKe});var _le=V(eU=>{"use strict";h();Object.defineProperty(eU,"__esModule",{value:!0});var Mg=rr(),wle=Br(),DKe={message:({params:{len:t}})=>(0,Mg.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Mg._)`{limit: ${t}}`},BKe={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:DKe,code(t){let{gen:e,schema:r,data:n,it:i}=t,o=i.items||0;if(o===!0)return;let s=e.const("len",(0,Mg._)`${n}.length`);if(r===!1)t.setParams({len:o}),t.fail((0,Mg._)`${s} > ${o}`);else if(typeof r=="object"&&!(0,wle.alwaysValidSchema)(i,r)){let d=e.var("valid",(0,Mg._)`${s} <= ${o}`);e.if((0,Mg.not)(d),()=>a(d,o)),t.ok(d)}i.items=!0;function a(d,u){e.forRange("i",u,s,c=>{t.subschema({keyword:"unevaluatedItems",dataProp:c,dataPropType:wle.Type.Num},d),i.allErrors||e.if((0,Mg.not)(d),()=>e.break())})}}};eU.default=BKe});var xle=V(tU=>{"use strict";h();Object.defineProperty(tU,"__esModule",{value:!0});var MKe=ble(),CKe=_le(),OKe=[MKe.default,CKe.default];tU.default=OKe});var Ele=V(rU=>{"use strict";h();Object.defineProperty(rU,"__esModule",{value:!0});var Ri=rr(),$Ke={message:({schemaCode:t})=>(0,Ri.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Ri._)`{format: ${t}}`},NKe={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:$Ke,code(t,e){let{gen:r,data:n,$data:i,schema:o,schemaCode:s,it:a}=t,{opts:d,errSchemaPath:u,schemaEnv:c,self:l}=a;if(!d.validateFormats)return;i?m():p();function m(){let g=r.scopeValue("formats",{ref:l.formats,code:d.code.formats}),v=r.const("fDef",(0,Ri._)`${g}[${s}]`),E=r.let("fType"),A=r.let("format");r.if((0,Ri._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`,()=>r.assign(E,(0,Ri._)`${v}.type || "string"`).assign(A,(0,Ri._)`${v}.validate`),()=>r.assign(E,(0,Ri._)`"string"`).assign(A,v)),t.fail$data((0,Ri.or)(P(),I()));function P(){return d.strictSchema===!1?Ri.nil:(0,Ri._)`${s} && !${A}`}function I(){let $=c.$async?(0,Ri._)`(${v}.async ? await ${A}(${n}) : ${A}(${n}))`:(0,Ri._)`${A}(${n})`,N=(0,Ri._)`(typeof ${A} == "function" ? ${$} : ${A}.test(${n}))`;return(0,Ri._)`${A} && ${A} !== true && ${E} === ${e} && !${N}`}}function p(){let g=l.formats[o];if(!g){P();return}if(g===!0)return;let[v,E,A]=I(g);v===e&&t.pass($());function P(){if(d.strictSchema===!1){l.logger.warn(N());return}throw new Error(N());function N(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function I(N){let K=N instanceof RegExp?(0,Ri.regexpCode)(N):d.code.formats?(0,Ri._)`${d.code.formats}${(0,Ri.getProperty)(o)}`:void 0,F=r.scopeValue("formats",{key:o,ref:N,code:K});return typeof N=="object"&&!(N instanceof RegExp)?[N.type||"string",N.validate,(0,Ri._)`${F}.validate`]:["string",N,F]}function $(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!c.$async)throw new Error("async format in sync schema");return(0,Ri._)`await ${A}(${n})`}return typeof E=="function"?(0,Ri._)`${A}(${n})`:(0,Ri._)`${A}.test(${n})`}}}};rU.default=NKe});var Sle=V(nU=>{"use strict";h();Object.defineProperty(nU,"__esModule",{value:!0});var jKe=Ele(),UKe=[jKe.default];nU.default=UKe});var Ale=V(w1=>{"use strict";h();Object.defineProperty(w1,"__esModule",{value:!0});w1.contentVocabulary=w1.metadataVocabulary=void 0;w1.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];w1.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Ile=V(iU=>{"use strict";h();Object.defineProperty(iU,"__esModule",{value:!0});var qKe=gue(),LKe=Due(),KKe=ile(),FKe=fle(),zKe=gle(),WKe=xle(),VKe=Sle(),Tle=Ale(),HKe=[FKe.default,qKe.default,LKe.default,(0,KKe.default)(!0),VKe.default,Tle.metadataVocabulary,Tle.contentVocabulary,zKe.default,WKe.default];iU.default=HKe});var Ple=V(b6=>{"use strict";h();Object.defineProperty(b6,"__esModule",{value:!0});b6.DiscrError=void 0;var GKe;(function(t){t.Tag="tag",t.Mapping="mapping"})(GKe=b6.DiscrError||(b6.DiscrError={}))});var Rle=V(sU=>{"use strict";h();Object.defineProperty(sU,"__esModule",{value:!0});var _1=rr(),oU=Ple(),kle=i6(),JKe=Br(),YKe={message:({params:{discrError:t,tagName:e}})=>t===oU.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,_1._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},ZKe={keyword:"discriminator",type:"object",schemaType:"object",error:YKe,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:o}=t,{oneOf:s}=i;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let d=e.let("valid",!1),u=e.const("tag",(0,_1._)`${r}${(0,_1.getProperty)(a)}`);e.if((0,_1._)`typeof ${u} == "string"`,()=>c(),()=>t.error(!1,{discrError:oU.DiscrError.Tag,tag:u,tagName:a})),t.ok(d);function c(){let p=m();e.if(!1);for(let g in p)e.elseIf((0,_1._)`${u} === ${g}`),e.assign(d,l(p[g]));e.else(),t.error(!1,{discrError:oU.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function l(p){let g=e.name("valid"),v=t.subschema({keyword:"oneOf",schemaProp:p},g);return t.mergeEvaluated(v,_1.Name),g}function m(){var p;let g={},v=A(i),E=!0;for(let $=0;${XKe.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}});var Ble=V(($Et,QKe)=>{QKe.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}});var Mle=V((NEt,eFe)=>{eFe.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}});var Cle=V((jEt,tFe)=>{tFe.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}});var Ole=V((UEt,rFe)=>{rFe.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}});var $le=V((qEt,nFe)=>{nFe.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}});var Nle=V((LEt,iFe)=>{iFe.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}});var jle=V((KEt,oFe)=>{oFe.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}});var Ule=V(aU=>{"use strict";h();Object.defineProperty(aU,"__esModule",{value:!0});var sFe=Dle(),aFe=Ble(),cFe=Mle(),dFe=Cle(),uFe=Ole(),lFe=$le(),fFe=Nle(),hFe=jle(),pFe=["/properties"];function mFe(t){return[sFe,aFe,cFe,dFe,uFe,e(this,lFe),fFe,e(this,hFe)].forEach(r=>this.addMetaSchema(r,void 0,!1)),this;function e(r,n){return t?r.$dataMetaSchema(n,pFe):n}}aU.default=mFe});var dU=V((ti,qle)=>{"use strict";h();Object.defineProperty(ti,"__esModule",{value:!0});ti.MissingRefError=ti.ValidationError=ti.CodeGen=ti.Name=ti.nil=ti.stringify=ti.str=ti._=ti.KeywordCxt=void 0;var yFe=fue(),gFe=Ile(),vFe=Rle(),bFe=Ule(),cU="https://json-schema.org/draft/2020-12/schema",lI=class extends yFe.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),gFe.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(vFe.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:r}=this.opts;r&&(bFe.default.call(this,e),this.refs["http://json-schema.org/schema"]=cU)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(cU)?cU:void 0)}};qle.exports=ti=lI;Object.defineProperty(ti,"__esModule",{value:!0});ti.default=lI;var wFe=n6();Object.defineProperty(ti,"KeywordCxt",{enumerable:!0,get:function(){return wFe.KeywordCxt}});var x1=rr();Object.defineProperty(ti,"_",{enumerable:!0,get:function(){return x1._}});Object.defineProperty(ti,"str",{enumerable:!0,get:function(){return x1.str}});Object.defineProperty(ti,"stringify",{enumerable:!0,get:function(){return x1.stringify}});Object.defineProperty(ti,"nil",{enumerable:!0,get:function(){return x1.nil}});Object.defineProperty(ti,"Name",{enumerable:!0,get:function(){return x1.Name}});Object.defineProperty(ti,"CodeGen",{enumerable:!0,get:function(){return x1.CodeGen}});var _Fe=WT();Object.defineProperty(ti,"ValidationError",{enumerable:!0,get:function(){return _Fe.default}});var xFe=VT();Object.defineProperty(ti,"MissingRefError",{enumerable:!0,get:function(){return xFe.default}})});var Gle=V((r5t,Hle)=>{h();var IFe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,xI=()=>IFe.now(),PFe=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),pU=t=>t===1/0||PFe(t),mU=class t{constructor({max:e=1/0,ttl:r,updateAgeOnGet:n=!1,checkAgeOnGet:i=!1,noUpdateTTL:o=!1,dispose:s,noDisposeOnSet:a=!1}={}){if(this.expirations=Object.create(null),this.data=new Map,this.expirationMap=new Map,r!==void 0&&!pU(r))throw new TypeError("ttl must be positive integer or Infinity if set");if(!pU(e))throw new TypeError("max must be positive integer or Infinity");if(this.ttl=r,this.max=e,this.updateAgeOnGet=!!n,this.checkAgeOnGet=!!i,this.noUpdateTTL=!!o,this.noDisposeOnSet=!!a,s!==void 0){if(typeof s!="function")throw new TypeError("dispose must be function if set");this.dispose=s}this.timer=void 0,this.timerExpiration=void 0}setTimer(e,r){if(this.timerExpiration{this.timer=void 0,this.timerExpiration=void 0,this.purgeStale();for(let i in this.expirations){this.setTimer(i,i-xI());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 D.default.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(xI()+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(!pU(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-xI())):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(xI());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()}};Hle.exports=mU});var Wm,Jle=le(()=>{h();Wm=Kt(Gle(),1)});function Yle(t){return t.byteOffset!==0||t.byteLength!==t.buffer.byteLength}function Zle(t){return typeof t!="object"||t===null?!1:typeof t[Symbol.asyncIterator]=="function"}function Xl(t){let r=Object.prototype.toString.call(t).match(/\s([a-zA-Z0-9]+)/),[n,i]=r;return i}var yU=le(()=>{h()});var _6,Xle,EI,Ng,de,SI=le(()=>{h();p7();f7();jR();yU();_6=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Xle=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(a,d){s=t[o](s),i(a,d,s.done,s.value)})}}function i(o,s,a,d){Promise.resolve(d).then(function(u){o({value:u,done:a})},s)}},EI=new TextEncoder,Ng=new TextDecoder,de=class t{constructor(e,r){this.data=e,this.format=r}static arrayBuffer(e){return new t(e,"ArrayBuffer")}static asyncIterable(e){if(!Zle(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 Sa.baseDecode(this.data).buffer;case"Base64Url":return Gs.baseDecode(this.data).buffer;case"BufferSource":{if(Xl(this.data)==="ArrayBuffer")return this.data;if(ArrayBuffer.isView(this.data))return Yle(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 _6(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 h7.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 Sa.baseEncode(e)}case"Multibase":return this.data.substring(1);case"Uint8Array":return Sa.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 Gs.baseEncode(e)}case"BufferSource":{let e=this.toUint8Array();return Gs.baseEncode(e)}case"Object":{let e=JSON.stringify(this.data),r=EI.encode(e);return Gs.baseEncode(r)}case"String":{let e=EI.encode(this.data);return Gs.baseEncode(e)}case"Uint8Array":return Gs.baseEncode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Base64Url is not supported.`)}}toBlobAsync(){var e,r,n,i;return _6(this,void 0,void 0,function*(){switch(this.format){case"AsyncIterable":{let d=[];try{for(var o=!0,s=Xle(this.data),a;a=yield s.next(),e=a.done,!e;o=!0){i=a.value,o=!1;let c=i;d.push(c)}}catch(c){r={error:c}}finally{try{!o&&!e&&(n=s.return)&&(yield n.call(s))}finally{if(r)throw r.error}}return new Blob(d)}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;n{h();I_();bi=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=Sf.encodingLength(n),a=new Uint8Array(s+i.byteLength);return a.set(i,s),Sf.encodeTo(n,a),a}static getCodeFromData(e){let{prefixedData:r}=e,[n,i]=Sf.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]=Sf.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}}};bi.codeToName=new Map;bi.nameToCode=new Map;bi.registerCodec({code:237,name:"ed25519-pub"});bi.registerCodec({code:4864,name:"ed25519-priv"});bi.registerCodec({code:236,name:"x25519-pub"});bi.registerCodec({code:4866,name:"x25519-priv"});bi.registerCodec({code:231,name:"secp256k1-pub"});bi.registerCodec({code:4865,name:"secp256k1-priv"})});function AI(t){return typeof t!="object"||t===null||Object.getOwnPropertySymbols(t).length>0?!1:Object.keys(t).length===0}function S1(t){Object.keys(t).forEach(e=>{t[e]===void 0?delete t[e]:typeof t[e]=="object"&&S1(t[e])})}var efe=le(()=>{h()});var rfe=V(tfe=>{"use strict";h();tfe.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 Mu=V((x5t,nfe)=>{"use strict";h();nfe.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 vU=V((S5t,ife)=>{"use strict";h();var gU=null;ife.exports=function(){return gU===null&&(gU={textEncoder:new TextEncoder,textDecoder:new TextDecoder}),gU}});var _U=V(ofe=>{"use strict";h();var bU=Mu(),kFe=new Set(["buffer","view","utf8"]),wU=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"||!kFe.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 bU(`Encoding '${this.name}' cannot be transcoded to 'buffer'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createViewTranscoder(){throw new bU(`Encoding '${this.name}' cannot be transcoded to 'view'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createUTF8Transcoder(){throw new bU(`Encoding '${this.name}' cannot be transcoded to 'utf8'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}};ofe.Encoding=wU});var AU=V(TI=>{"use strict";h();var{Buffer:EU}=Fn()||{},{Encoding:SU}=_U(),RFe=vU(),x6=class extends SU{constructor(e){super({...e,format:"buffer"})}createViewTranscoder(){return new E6({encode:this.encode,decode:e=>this.decode(EU.from(e.buffer,e.byteOffset,e.byteLength)),name:`${this.name}+view`})}createBufferTranscoder(){return this}},E6=class extends SU{constructor(e){super({...e,format:"view"})}createBufferTranscoder(){return new x6({encode:e=>{let r=this.encode(e);return EU.from(r.buffer,r.byteOffset,r.byteLength)},decode:this.decode,name:`${this.name}+buffer`})}createViewTranscoder(){return this}},xU=class extends SU{constructor(e){super({...e,format:"utf8"})}createBufferTranscoder(){return new x6({encode:e=>EU.from(this.encode(e),"utf8"),decode:e=>this.decode(e.toString("utf8")),name:`${this.name}+buffer`})}createViewTranscoder(){let{textEncoder:e,textDecoder:r}=RFe();return new E6({encode:n=>e.encode(this.encode(n)),decode:n=>this.decode(r.decode(n)),name:`${this.name}+view`})}createUTF8Transcoder(){return this}};TI.BufferFormat=x6;TI.ViewFormat=E6;TI.UTF8Format=xU});var dfe=V(jg=>{"use strict";h();var{Buffer:Ls}=Fn()||{Buffer:{isBuffer:()=>!1}},{textEncoder:afe,textDecoder:sfe}=vU()(),{BufferFormat:S6,ViewFormat:TU,UTF8Format:cfe}=AU(),II=t=>t;jg.utf8=new cfe({encode:function(t){return Ls.isBuffer(t)?t.toString("utf8"):ArrayBuffer.isView(t)?sfe.decode(t):String(t)},decode:II,name:"utf8",createViewTranscoder(){return new TU({encode:function(t){return ArrayBuffer.isView(t)?t:afe.encode(t)},decode:function(t){return sfe.decode(t)},name:`${this.name}+view`})},createBufferTranscoder(){return new S6({encode:function(t){return Ls.isBuffer(t)?t:ArrayBuffer.isView(t)?Ls.from(t.buffer,t.byteOffset,t.byteLength):Ls.from(String(t),"utf8")},decode:function(t){return t.toString("utf8")},name:`${this.name}+buffer`})}});jg.json=new cfe({encode:JSON.stringify,decode:JSON.parse,name:"json"});jg.buffer=new S6({encode:function(t){return Ls.isBuffer(t)?t:ArrayBuffer.isView(t)?Ls.from(t.buffer,t.byteOffset,t.byteLength):Ls.from(String(t),"utf8")},decode:II,name:"buffer",createViewTranscoder(){return new TU({encode:function(t){return ArrayBuffer.isView(t)?t:Ls.from(String(t),"utf8")},decode:function(t){return Ls.from(t.buffer,t.byteOffset,t.byteLength)},name:`${this.name}+view`})}});jg.view=new TU({encode:function(t){return ArrayBuffer.isView(t)?t:afe.encode(t)},decode:II,name:"view",createBufferTranscoder(){return new S6({encode:function(t){return Ls.isBuffer(t)?t:ArrayBuffer.isView(t)?Ls.from(t.buffer,t.byteOffset,t.byteLength):Ls.from(String(t),"utf8")},decode:II,name:`${this.name}+buffer`})}});jg.hex=new S6({encode:function(t){return Ls.isBuffer(t)?t:Ls.from(String(t),"hex")},decode:function(t){return t.toString("hex")},name:"hex"});jg.base64=new S6({encode:function(t){return Ls.isBuffer(t)?t:Ls.from(String(t),"base64")},decode:function(t){return t.toString("base64")},name:"base64"})});var ffe=V(lfe=>{"use strict";h();var ufe=Mu(),kI=dfe(),{Encoding:DFe}=_U(),{BufferFormat:BFe,ViewFormat:MFe,UTF8Format:CFe}=AU(),A6=Symbol("formats"),PI=Symbol("encodings"),OFe=new Set(["buffer","view","utf8"]),IU=class{constructor(e){if(Array.isArray(e)){if(!e.every(r=>OFe.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[PI]=new Map,this[A6]=new Set(e);for(let r in kI)try{this.encoding(r)}catch(n){if(n.code!=="LEVEL_ENCODING_NOT_SUPPORTED")throw n}}encodings(){return Array.from(new Set(this[PI].values()))}encoding(e){let r=this[PI].get(e);if(r===void 0){if(typeof e=="string"&&e!==""){if(r=UFe[e],!r)throw new ufe(`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=$Fe(e)}let{name:n,format:i}=r;if(!this[A6].has(i))if(this[A6].has("view"))r=r.createViewTranscoder();else if(this[A6].has("buffer"))r=r.createBufferTranscoder();else if(this[A6].has("utf8"))r=r.createUTF8Transcoder();else throw new ufe(`Encoding '${n}' cannot be transcoded`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"});for(let o of[e,n,r.name,r.commonName])this[PI].set(o,r)}return r}};lfe.Transcoder=IU;function $Fe(t){if(t instanceof DFe)return t;let e="type"in t&&typeof t.type=="string"?t.type:void 0,r=t.name||e||`anonymous-${qFe++}`;switch(NFe(t)){case"view":return new MFe({...t,name:r});case"utf8":return new CFe({...t,name:r});case"buffer":return new BFe({...t,name:r});default:throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}}function NFe(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 jFe={binary:kI.buffer,"utf-8":kI.utf8},UFe={...kI,...jFe},qFe=0});var pfe=V((C5t,hfe)=>{h();hfe.exports=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(t)});var T6=V(PU=>{"use strict";h();var mfe=pfe();PU.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};PU.fromPromise=function(t,e){if(e===void 0)return t;t.then(function(r){mfe(()=>e(null,r))}).catch(function(r){mfe(()=>e(r))})}});var RI=V(kU=>{"use strict";h();kU.getCallback=function(t,e){return typeof t=="function"?t:e};kU.getOptions=function(t,e){return typeof t=="object"&&t!==null?t:e!==void 0?e:{}}});var Zm=V(CI=>{"use strict";h();var{fromCallback:RU}=T6(),Tc=Mu(),{getOptions:DU,getCallback:yfe}=RI(),Ug=Symbol("promise"),A1=Symbol("callback"),Ql=Symbol("working"),qg=Symbol("handleOne"),kh=Symbol("handleMany"),BU=Symbol("autoClose"),Jm=Symbol("finishWork"),ef=Symbol("returnMany"),Vm=Symbol("closing"),I6=Symbol("handleClose"),DI=Symbol("closed"),P6=Symbol("closeCallbacks"),Gm=Symbol("keyEncoding"),Lg=Symbol("valueEncoding"),MU=Symbol("abortOnClose"),BI=Symbol("legacy"),CU=Symbol("keys"),OU=Symbol("values"),Hm=Symbol("limit"),Td=Symbol("count"),MI=Object.freeze({}),LFe=()=>{},gfe=!1,k6=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[DI]=!1,this[P6]=[],this[Ql]=!1,this[Vm]=!1,this[BU]=!1,this[A1]=null,this[qg]=this[qg].bind(this),this[kh]=this[kh].bind(this),this[I6]=this[I6].bind(this),this[Gm]=r[Gm],this[Lg]=r[Lg],this[BI]=n,this[Hm]=Number.isInteger(r.limit)&&r.limit>=0?r.limit:1/0,this[Td]=0,this[MU]=!!r.abortOnClose,this.db=e,this.db.attachResource(this),this.nextTick=e.nextTick}get count(){return this[Td]}get limit(){return this[Hm]}next(e){let r;if(e===void 0)r=new Promise((n,i)=>{e=(o,s,a)=>{o?i(o):this[BI]?s===void 0&&a===void 0?n():n([s,a]):n(s)}});else if(typeof e!="function")throw new TypeError("Callback must be a function");return this[Vm]?this.nextTick(e,new Tc("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Ql]?this.nextTick(e,new Tc("Iterator is busy: cannot call next() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[Ql]=!0,this[A1]=e,this[Td]>=this[Hm]?this.nextTick(this[qg],null):this._next(this[qg])),r}_next(e){this.nextTick(e)}nextv(e,r,n){return n=yfe(r,n),n=RU(n,Ug),r=DU(r,MI),Number.isInteger(e)?(this[Vm]?this.nextTick(n,new Tc("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Ql]?this.nextTick(n,new Tc("Iterator is busy: cannot call nextv() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(e<1&&(e=1),this[Hm]<1/0&&(e=Math.min(e,this[Hm]-this[Td])),this[Ql]=!0,this[A1]=n,e<=0?this.nextTick(this[kh],null,[]):this._nextv(e,r,this[kh])),n[Ug]):(this.nextTick(n,new TypeError("The first argument 'size' must be an integer")),n[Ug])}_nextv(e,r,n){let i=[],o=(s,a,d)=>{if(s)return n(s);if(this[BI]?a===void 0&&d===void 0:a===void 0)return n(null,i);i.push(this[BI]?[a,d]:a),i.length===e?n(null,i):this._next(o)};this._next(o)}all(e,r){return r=yfe(e,r),r=RU(r,Ug),e=DU(e,MI),this[Vm]?this.nextTick(r,new Tc("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Ql]?this.nextTick(r,new Tc("Iterator is busy: cannot call all() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[Ql]=!0,this[A1]=r,this[BU]=!0,this[Td]>=this[Hm]?this.nextTick(this[kh],null,[]):this._all(e,this[kh])),r[Ug]}_all(e,r){let n=this[Td],i=[],o=()=>{let a=this[Hm]<1/0?Math.min(1e3,this[Hm]-n):1e3;a<=0?this.nextTick(r,null,i):this._nextv(a,MI,s)},s=(a,d)=>{a?r(a):d.length===0?r(null,i):(i.push.apply(i,d),n+=d.length,o())};o()}[Jm](){let e=this[A1];return this[MU]&&e===null?LFe:(this[Ql]=!1,this[A1]=null,this[Vm]&&this._close(this[I6]),e)}[ef](e,r,n){this[BU]?this.close(e.bind(null,r,n)):e(r,n)}seek(e,r){if(r=DU(r,MI),!this[Vm]){if(this[Ql])throw new Tc("Iterator is busy: cannot call seek() until next() has completed",{code:"LEVEL_ITERATOR_BUSY"});{let n=this.db.keyEncoding(r.keyEncoding||this[Gm]),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 Tc("Iterator does not support seek()",{code:"LEVEL_NOT_SUPPORTED"})}close(e){return e=RU(e,Ug),this[DI]?this.nextTick(e):this[Vm]?this[P6].push(e):(this[Vm]=!0,this[P6].push(e),this[Ql]?this[MU]&&this[Jm]()(new Tc("Aborted on iterator close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this._close(this[I6])),e[Ug]}_close(e){this.nextTick(e)}[I6](){this[DI]=!0,this.db.detachResource(this);let e=this[P6];this[P6]=[];for(let r of e)r()}async*[Symbol.asyncIterator](){try{let e;for(;(e=await this.next())!==void 0;)yield e}finally{this[DI]||await this.close()}}},T1=class extends k6{constructor(e,r){super(e,r,!0),this[CU]=r.keys!==!1,this[OU]=r.values!==!1}[qg](e,r,n){let i=this[Jm]();if(e)return i(e);try{r=this[CU]&&r!==void 0?this[Gm].decode(r):void 0,n=this[OU]&&n!==void 0?this[Lg].decode(n):void 0}catch(o){return i(new Ym("entry",o))}r===void 0&&n===void 0||this[Td]++,i(null,r,n)}[kh](e,r){let n=this[Jm]();if(e)return this[ef](n,e);try{for(let i of r){let o=i[0],s=i[1];i[0]=this[CU]&&o!==void 0?this[Gm].decode(o):void 0,i[1]=this[OU]&&s!==void 0?this[Lg].decode(s):void 0}}catch(i){return this[ef](n,new Ym("entries",i))}this[Td]+=r.length,this[ef](n,null,r)}end(e){return!gfe&&typeof console<"u"&&(gfe=!0,console.warn(new Tc("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)}},$U=class extends k6{constructor(e,r){super(e,r,!1)}[qg](e,r){let n=this[Jm]();if(e)return n(e);try{r=r!==void 0?this[Gm].decode(r):void 0}catch(i){return n(new Ym("key",i))}r!==void 0&&this[Td]++,n(null,r)}[kh](e,r){let n=this[Jm]();if(e)return this[ef](n,e);try{for(let i=0;i{"use strict";h();var{AbstractKeyIterator:KFe,AbstractValueIterator:FFe}=Zm(),Kg=Symbol("iterator"),R6=Symbol("callback"),I1=Symbol("handleOne"),Fg=Symbol("handleMany"),D6=class extends KFe{constructor(e,r){super(e,r),this[Kg]=e.iterator({...r,keys:!0,values:!1}),this[I1]=this[I1].bind(this),this[Fg]=this[Fg].bind(this)}},OI=class extends FFe{constructor(e,r){super(e,r),this[Kg]=e.iterator({...r,keys:!1,values:!0}),this[I1]=this[I1].bind(this),this[Fg]=this[Fg].bind(this)}};for(let t of[D6,OI]){let e=t===D6,r=e?n=>n[0]:n=>n[1];t.prototype._next=function(n){this[R6]=n,this[Kg].next(this[I1])},t.prototype[I1]=function(n,i,o){let s=this[R6];n?s(n):s(null,e?i:o)},t.prototype._nextv=function(n,i,o){this[R6]=o,this[Kg].nextv(n,i,this[Fg])},t.prototype._all=function(n,i){this[R6]=i,this[Kg].all(n,this[Fg])},t.prototype[Fg]=function(n,i){let o=this[R6];n?o(n):o(null,i.map(r))},t.prototype._seek=function(n,i){this[Kg].seek(n,i)},t.prototype._close=function(n){this[Kg].close(n)}}jU.DefaultKeyIterator=D6;jU.DefaultValueIterator=OI});var bfe=V(LI=>{"use strict";h();var{AbstractIterator:zFe,AbstractKeyIterator:WFe,AbstractValueIterator:VFe}=Zm(),UU=Mu(),La=Symbol("nut"),UI=Symbol("undefer"),qI=Symbol("factory"),$I=class extends zFe{constructor(e,r){super(e,r),this[La]=null,this[qI]=()=>e.iterator(r),this.db.defer(()=>this[UI]())}},NI=class extends WFe{constructor(e,r){super(e,r),this[La]=null,this[qI]=()=>e.keys(r),this.db.defer(()=>this[UI]())}},jI=class extends VFe{constructor(e,r){super(e,r),this[La]=null,this[qI]=()=>e.values(r),this.db.defer(()=>this[UI]())}};for(let t of[$I,NI,jI])t.prototype[UI]=function(){this.db.status==="open"&&(this[La]=this[qI]())},t.prototype._next=function(e){this[La]!==null?this[La].next(e):this.db.status==="opening"?this.db.defer(()=>this._next(e)):this.nextTick(e,new UU("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._nextv=function(e,r,n){this[La]!==null?this[La].nextv(e,r,n):this.db.status==="opening"?this.db.defer(()=>this._nextv(e,r,n)):this.nextTick(n,new UU("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._all=function(e,r){this[La]!==null?this[La].all(r):this.db.status==="opening"?this.db.defer(()=>this._all(e,r)):this.nextTick(r,new UU("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._seek=function(e,r){this[La]!==null?this[La]._seek(e,r):this.db.status==="opening"&&this.db.defer(()=>this._seek(e,r))},t.prototype._close=function(e){this[La]!==null?this[La].close(e):this.db.status==="opening"?this.db.defer(()=>this._close(e)):this.nextTick(e)};LI.DeferredIterator=$I;LI.DeferredKeyIterator=NI;LI.DeferredValueIterator=jI});var LU=V(_fe=>{"use strict";h();var{fromCallback:wfe}=T6(),KI=Mu(),{getCallback:HFe,getOptions:GFe}=RI(),FI=Symbol("promise"),Id=Symbol("status"),P1=Symbol("operations"),B6=Symbol("finishClose"),k1=Symbol("closeCallbacks"),qU=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[P1]=[],this[k1]=[],this[Id]="open",this[B6]=this[B6].bind(this),this.db=e,this.db.attachResource(this),this.nextTick=e.nextTick}get length(){return this[P1].length}put(e,r,n){if(this[Id]!=="open")throw new KI("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,a=o.keyEncoding(n&&n.keyEncoding),d=o.valueEncoding(n&&n.valueEncoding),u=a.format;n={...n,keyEncoding:u,valueEncoding:d.format},o!==this.db&&(n.sublevel=null);let c=o.prefixKey(a.encode(e),u),l=d.encode(r);return this._put(c,l,n),this[P1].push({...s,type:"put",key:e,value:r}),this}_put(e,r,n){}del(e,r){if(this[Id]!=="open")throw new KI("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),a=s.format;return r={...r,keyEncoding:a},i!==this.db&&(r.sublevel=null),this._del(i.prefixKey(s.encode(e),a),r),this[P1].push({...o,type:"del",key:e}),this}_del(e,r){}clear(){if(this[Id]!=="open")throw new KI("Batch is not open: cannot call clear() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});return this._clear(),this[P1]=[],this}_clear(){}write(e,r){return r=HFe(e,r),r=wfe(r,FI),e=GFe(e),this[Id]!=="open"?this.nextTick(r,new KI("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"})):this.length===0?this.close(r):(this[Id]="writing",this._write(e,n=>{this[Id]="closing",this[k1].push(()=>r(n)),n||this.db.emit("batch",this[P1]),this._close(this[B6])})),r[FI]}_write(e,r){}close(e){return e=wfe(e,FI),this[Id]==="closing"?this[k1].push(e):this[Id]==="closed"?this.nextTick(e):(this[k1].push(e),this[Id]!=="writing"&&(this[Id]="closing",this._close(this[B6]))),e[FI]}_close(e){this.nextTick(e)}[B6](){this[Id]="closed",this.db.detachResource(this);let e=this[k1];this[k1]=[];for(let r of e)r()}};_fe.AbstractChainedBatch=qU});var Efe=V(xfe=>{"use strict";h();var{AbstractChainedBatch:JFe}=LU(),YFe=Mu(),R1=Symbol("encoded"),KU=class extends JFe{constructor(e){super(e),this[R1]=[]}_put(e,r,n){this[R1].push({...n,type:"put",key:e,value:r})}_del(e,r){this[R1].push({...r,type:"del",key:e})}_clear(){this[R1]=[]}_write(e,r){this.db.status==="opening"?this.db.defer(()=>this._write(e,r)):this.db.status==="open"?this[R1].length===0?this.nextTick(r):this.db._batch(this[R1],e,r):this.nextTick(r,new YFe("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"}))}};xfe.DefaultChainedBatch=KU});var Tfe=V((Y5t,Afe)=>{"use strict";h();var Sfe=Mu(),ZFe=Object.prototype.hasOwnProperty,XFe=new Set(["lt","lte","gt","gte"]);Afe.exports=function(t,e){let r={};for(let n in t)if(ZFe.call(t,n)&&!(n==="keyEncoding"||n==="valueEncoding")){if(n==="start"||n==="end")throw new Sfe(`The legacy range option '${n}' has been removed`,{code:"LEVEL_LEGACY"});if(n==="encoding")throw new Sfe("The levelup-style 'encoding' alias has been removed, use 'valueEncoding' instead",{code:"LEVEL_LEGACY"});XFe.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 FU=V((X5t,Pfe)=>{h();var Ife;Pfe.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:globalThis):t=>(Ife||(Ife=Promise.resolve())).then(t).catch(e=>setTimeout(()=>{throw e},0))});var Dfe=V((e8t,Rfe)=>{"use strict";h();var kfe=FU();Rfe.exports=function(t,...e){e.length===0?kfe(t):kfe(()=>t(...e))}});var Bfe=V(zI=>{"use strict";h();var{AbstractIterator:QFe,AbstractKeyIterator:eze,AbstractValueIterator:tze}=Zm(),D1=Symbol("unfix"),Cu=Symbol("iterator"),zg=Symbol("handleOne"),Xm=Symbol("handleMany"),Rh=Symbol("callback"),M6=class extends QFe{constructor(e,r,n,i){super(e,r),this[Cu]=n,this[D1]=i,this[zg]=this[zg].bind(this),this[Xm]=this[Xm].bind(this),this[Rh]=null}[zg](e,r,n){let i=this[Rh];if(e)return i(e);r!==void 0&&(r=this[D1](r)),i(e,r,n)}[Xm](e,r){let n=this[Rh];if(e)return n(e);for(let i of r){let o=i[0];o!==void 0&&(i[0]=this[D1](o))}n(e,r)}},C6=class extends eze{constructor(e,r,n,i){super(e,r),this[Cu]=n,this[D1]=i,this[zg]=this[zg].bind(this),this[Xm]=this[Xm].bind(this),this[Rh]=null}[zg](e,r){let n=this[Rh];if(e)return n(e);r!==void 0&&(r=this[D1](r)),n(e,r)}[Xm](e,r){let n=this[Rh];if(e)return n(e);for(let i=0;i{"use strict";h();var zU=Mu(),{Buffer:HU}=Fn()||{},{AbstractSublevelIterator:rze,AbstractSublevelKeyIterator:nze,AbstractSublevelValueIterator:ize}=Bfe(),Dh=Symbol("prefix"),Mfe=Symbol("upperBound"),$6=Symbol("prefixRange"),Ic=Symbol("parent"),WU=Symbol("unfix"),Cfe=new TextEncoder,oze={separator:"!"};Ofe.exports=function({AbstractLevel:t}){class e extends t{static defaults(n){if(typeof n=="string")throw new zU("The subleveldown string shorthand for { separator } has been removed",{code:"LEVEL_LEGACY"});if(n&&n.open)throw new zU("The subleveldown open option has been removed",{code:"LEVEL_LEGACY"});return n==null?oze:n.separator?n:{...n,separator:"!"}}constructor(n,i,o){let{separator:s,manifest:a,...d}=e.defaults(o);i=aze(i,s);let u=s.charCodeAt(0)+1,c=n[Ic]||n;if(!Cfe.encode(i).every(p=>p>u&&p<127))throw new zU(`Prefix must use bytes > ${u} < 127`,{code:"LEVEL_INVALID_PREFIX"});super(sze(c,a),d);let l=(n.prefix||"")+s+i+s,m=l.slice(0,-1)+String.fromCharCode(u);this[Ic]=c,this[Dh]=new WI(l),this[Mfe]=new WI(m),this[WU]=new GU,this.nextTick=c.nextTick}prefixKey(n,i){if(i==="utf8")return this[Dh].utf8+n;if(n.byteLength===0)return this[Dh][i];if(i==="view"){let o=this[Dh].view,s=new Uint8Array(o.byteLength+n.byteLength);return s.set(o,0),s.set(n,o.byteLength),s}else{let o=this[Dh].buffer;return HU.concat([o,n],o.byteLength+n.byteLength)}}[$6](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[Dh][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[Mfe][i]}get prefix(){return this[Dh].utf8}get db(){return this[Ic]}_open(n,i){this[Ic].open({passive:!0},i)}_put(n,i,o,s){this[Ic].put(n,i,o,s)}_get(n,i,o){this[Ic].get(n,i,o)}_getMany(n,i,o){this[Ic].getMany(n,i,o)}_del(n,i,o){this[Ic].del(n,i,o)}_batch(n,i,o){this[Ic].batch(n,i,o)}_clear(n,i){this[$6](n,n.keyEncoding),this[Ic].clear(n,i)}_iterator(n){this[$6](n,n.keyEncoding);let i=this[Ic].iterator(n),o=this[WU].get(this[Dh].utf8.length,n.keyEncoding);return new rze(this,n,i,o)}_keys(n){this[$6](n,n.keyEncoding);let i=this[Ic].keys(n),o=this[WU].get(this[Dh].utf8.length,n.keyEncoding);return new nze(this,n,i,o)}_values(n){this[$6](n,n.keyEncoding);let i=this[Ic].values(n);return new ize(this,n,i)}}return{AbstractSublevel:e}};var sze=function(t,e){return{...t.supports,createIfMissing:!1,errorIfExists:!1,events:{},additionalMethods:{},...e,encodings:{utf8:VU(t,"utf8"),buffer:VU(t,"buffer"),view:VU(t,"view")}}},VU=function(t,e){return t.supports.encodings[e]?t.keyEncoding(e).name===e:!1},WI=class{constructor(e){this.utf8=e,this.view=Cfe.encode(e),this.buffer=HU?HU.from(this.view.buffer,0,this.view.byteLength):{}}},GU=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}},aze=function(t,e){let r=0,n=t.length;for(;rr&&t[n-1]===e;)n--;return t.slice(r,n)}});var QU=V(XU=>{"use strict";h();var{supports:cze}=rfe(),{Transcoder:dze}=ffe(),{EventEmitter:uze}=lc(),{fromCallback:Qm}=T6(),Ou=Mu(),{AbstractIterator:Wg}=Zm(),{DefaultKeyIterator:lze,DefaultValueIterator:fze}=vfe(),{DeferredIterator:hze,DeferredKeyIterator:pze,DeferredValueIterator:mze}=bfe(),{DefaultChainedBatch:Nfe}=Efe(),{getCallback:Vg,getOptions:ey}=RI(),VI=Tfe(),gr=Symbol("promise"),Bh=Symbol("landed"),Hg=Symbol("resources"),JU=Symbol("closeResources"),N6=Symbol("operations"),j6=Symbol("undefer"),HI=Symbol("deferOpen"),jfe=Symbol("options"),Mr=Symbol("status"),Gg=Symbol("defaultOptions"),B1=Symbol("transcoder"),GI=Symbol("keyEncoding"),YU=Symbol("valueEncoding"),yze=()=>{},U6=class extends uze{constructor(e,r){if(super(),typeof e!="object"||e===null)throw new TypeError("The first argument 'manifest' must be an object");r=ey(r);let{keyEncoding:n,valueEncoding:i,passive:o,...s}=r;this[Hg]=new Set,this[N6]=[],this[HI]=!0,this[jfe]=s,this[Mr]="opening",this.supports=cze(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[B1]=new dze(gze(this)),this[GI]=this[B1].encoding(n||"utf8"),this[YU]=this[B1].encoding(i||"utf8");for(let a of this[B1].encodings())this.supports.encodings[a.commonName]||(this.supports.encodings[a.commonName]=!0);this[Gg]={empty:Object.freeze({}),entry:Object.freeze({keyEncoding:this[GI].commonName,valueEncoding:this[YU].commonName}),key:Object.freeze({keyEncoding:this[GI].commonName})},this.nextTick(()=>{this[HI]&&this.open({passive:!1},yze)})}get status(){return this[Mr]}keyEncoding(e){return this[B1].encoding(e??this[GI])}valueEncoding(e){return this[B1].encoding(e??this[YU])}open(e,r){r=Vg(e,r),r=Qm(r,gr),e={...this[jfe],...ey(e)},e.createIfMissing=e.createIfMissing!==!1,e.errorIfExists=!!e.errorIfExists;let n=i=>{this[Mr]==="closing"||this[Mr]==="opening"?this.once(Bh,i?()=>n(i):n):this[Mr]!=="open"?r(new Ou("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN",cause:i})):r()};return e.passive?this[Mr]==="opening"?this.once(Bh,n):this.nextTick(n):this[Mr]==="closed"||this[HI]?(this[HI]=!1,this[Mr]="opening",this.emit("opening"),this._open(e,i=>{if(i){this[Mr]="closed",this[JU](()=>{this.emit(Bh),n(i)}),this[j6]();return}this[Mr]="open",this[j6](),this.emit(Bh),this[Mr]==="open"&&this.emit("open"),this[Mr]==="open"&&this.emit("ready"),n()})):this[Mr]==="open"?this.nextTick(n):this.once(Bh,()=>this.open(e,r)),r[gr]}_open(e,r){this.nextTick(r)}close(e){e=Qm(e,gr);let r=n=>{this[Mr]==="opening"||this[Mr]==="closing"?this.once(Bh,n?r(n):r):this[Mr]!=="closed"?e(new Ou("Database is not closed",{code:"LEVEL_DATABASE_NOT_CLOSED",cause:n})):e()};if(this[Mr]==="open"){this[Mr]="closing",this.emit("closing");let n=i=>{this[Mr]="open",this[j6](),this.emit(Bh),r(i)};this[JU](()=>{this._close(i=>{if(i)return n(i);this[Mr]="closed",this[j6](),this.emit(Bh),this[Mr]==="closed"&&this.emit("closed"),r()})})}else this[Mr]==="closed"?this.nextTick(r):this.once(Bh,()=>this.close(e));return e[gr]}[JU](e){if(this[Hg].size===0)return this.nextTick(e);let r=this[Hg].size,n=!0,i=()=>{--r===0&&(n?this.nextTick(e):e())};for(let o of this[Hg])o.close(i);n=!1,this[Hg].clear()}_close(e){this.nextTick(e)}get(e,r,n){if(n=Vg(r,n),n=Qm(n,gr),r=ey(r,this[Gg].entry),this[Mr]==="opening")return this.defer(()=>this.get(e,r,n)),n[gr];if(M1(this,n))return n[gr];let i=this._checkKey(e);if(i)return this.nextTick(n,i),n[gr];let o=this.keyEncoding(r.keyEncoding),s=this.valueEncoding(r.valueEncoding),a=o.format,d=s.format;return(r.keyEncoding!==a||r.valueEncoding!==d)&&(r=Object.assign({},r,{keyEncoding:a,valueEncoding:d})),this._get(this.prefixKey(o.encode(e),a),r,(u,c)=>{if(u)return(u.code==="LEVEL_NOT_FOUND"||u.notFound||/NotFound/i.test(u))&&(u.code||(u.code="LEVEL_NOT_FOUND"),u.notFound||(u.notFound=!0),u.status||(u.status=404)),n(u);try{c=s.decode(c)}catch(l){return n(new Ou("Could not decode value",{code:"LEVEL_DECODE_ERROR",cause:l}))}n(null,c)}),n[gr]}_get(e,r,n){this.nextTick(n,new Error("NotFound"))}getMany(e,r,n){if(n=Vg(r,n),n=Qm(n,gr),r=ey(r,this[Gg].entry),this[Mr]==="opening")return this.defer(()=>this.getMany(e,r,n)),n[gr];if(M1(this,n))return n[gr];if(!Array.isArray(e))return this.nextTick(n,new TypeError("The first argument 'keys' must be an array")),n[gr];if(e.length===0)return this.nextTick(n,null,[]),n[gr];let i=this.keyEncoding(r.keyEncoding),o=this.valueEncoding(r.valueEncoding),s=i.format,a=o.format;(r.keyEncoding!==s||r.valueEncoding!==a)&&(r=Object.assign({},r,{keyEncoding:s,valueEncoding:a}));let d=new Array(e.length);for(let u=0;u{if(u)return n(u);try{for(let l=0;lthis.put(e,r,n,i)),i[gr];if(M1(this,i))return i[gr];let o=this._checkKey(e)||this._checkValue(r);if(o)return this.nextTick(i,o),i[gr];let s=this.keyEncoding(n.keyEncoding),a=this.valueEncoding(n.valueEncoding),d=s.format,u=a.format;(n.keyEncoding!==d||n.valueEncoding!==u)&&(n=Object.assign({},n,{keyEncoding:d,valueEncoding:u}));let c=this.prefixKey(s.encode(e),d),l=a.encode(r);return this._put(c,l,n,m=>{if(m)return i(m);this.emit("put",e,r),i()}),i[gr]}_put(e,r,n,i){this.nextTick(i)}del(e,r,n){if(n=Vg(r,n),n=Qm(n,gr),r=ey(r,this[Gg].key),this[Mr]==="opening")return this.defer(()=>this.del(e,r,n)),n[gr];if(M1(this,n))return n[gr];let i=this._checkKey(e);if(i)return this.nextTick(n,i),n[gr];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,a=>{if(a)return n(a);this.emit("del",e),n()}),n[gr]}_del(e,r,n){this.nextTick(n)}batch(e,r,n){if(!arguments.length){if(this[Mr]==="opening")return new Nfe(this);if(this[Mr]!=="open")throw new Ou("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._chainedBatch()}if(typeof e=="function"?n=e:n=Vg(r,n),n=Qm(n,gr),r=ey(r,this[Gg].empty),this[Mr]==="opening")return this.defer(()=>this.batch(e,r,n)),n[gr];if(M1(this,n))return n[gr];if(!Array.isArray(e))return this.nextTick(n,new TypeError("The first argument 'operations' must be an array")),n[gr];if(e.length===0)return this.nextTick(n),n[gr];let i=new Array(e.length),{keyEncoding:o,valueEncoding:s,...a}=r;for(let d=0;d{if(d)return n(d);this.emit("batch",e),n()}),n[gr]}_batch(e,r,n){this.nextTick(n)}sublevel(e,r){return this._sublevel(e,ZU.defaults(r))}_sublevel(e,r){return new ZU(this,e,r)}prefixKey(e,r){return e}clear(e,r){if(r=Vg(e,r),r=Qm(r,gr),e=ey(e,this[Gg].empty),this[Mr]==="opening")return this.defer(()=>this.clear(e,r)),r[gr];if(M1(this,r))return r[gr];let n=e,i=this.keyEncoding(e.keyEncoding);return e=VI(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[gr]}_clear(e,r){this.nextTick(r)}iterator(e){let r=this.keyEncoding(e&&e.keyEncoding),n=this.valueEncoding(e&&e.valueEncoding);if(e=VI(e,r),e.keys=e.keys!==!1,e.values=e.values!==!1,e[Wg.keyEncoding]=r,e[Wg.valueEncoding]=n,e.keyEncoding=r.format,e.valueEncoding=n.format,this[Mr]==="opening")return new hze(this,e);if(this[Mr]!=="open")throw new Ou("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._iterator(e)}_iterator(e){return new Wg(this,e)}keys(e){let r=this.keyEncoding(e&&e.keyEncoding),n=this.valueEncoding(e&&e.valueEncoding);if(e=VI(e,r),e[Wg.keyEncoding]=r,e[Wg.valueEncoding]=n,e.keyEncoding=r.format,e.valueEncoding=n.format,this[Mr]==="opening")return new pze(this,e);if(this[Mr]!=="open")throw new Ou("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._keys(e)}_keys(e){return new lze(this,e)}values(e){let r=this.keyEncoding(e&&e.keyEncoding),n=this.valueEncoding(e&&e.valueEncoding);if(e=VI(e,r),e[Wg.keyEncoding]=r,e[Wg.valueEncoding]=n,e.keyEncoding=r.format,e.valueEncoding=n.format,this[Mr]==="opening")return new mze(this,e);if(this[Mr]!=="open")throw new Ou("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._values(e)}_values(e){return new fze(this,e)}defer(e){if(typeof e!="function")throw new TypeError("The first argument must be a function");this[N6].push(e)}[j6](){if(this[N6].length===0)return;let e=this[N6];this[N6]=[];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[Hg].add(e)}detachResource(e){this[Hg].delete(e)}_chainedBatch(){return new Nfe(this)}_checkKey(e){if(e==null)return new Ou("Key cannot be null or undefined",{code:"LEVEL_INVALID_KEY"})}_checkValue(e){if(e==null)return new Ou("Value cannot be null or undefined",{code:"LEVEL_INVALID_VALUE"})}};U6.prototype.nextTick=Dfe();var{AbstractSublevel:ZU}=$fe()({AbstractLevel:U6});XU.AbstractLevel=U6;XU.AbstractSublevel=ZU;var M1=function(t,e){return t[Mr]!=="open"?(t.nextTick(e,new Ou("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"})),!0):!1},gze=function(t){return Object.keys(t.supports.encodings).filter(e=>!!t.supports.encodings[e])}});var eq=V(Jg=>{"use strict";h();Jg.AbstractLevel=QU().AbstractLevel;Jg.AbstractSublevel=QU().AbstractSublevel;Jg.AbstractIterator=Zm().AbstractIterator;Jg.AbstractKeyIterator=Zm().AbstractKeyIterator;Jg.AbstractValueIterator=Zm().AbstractValueIterator;Jg.AbstractChainedBatch=LU().AbstractChainedBatch});var qfe=V((u8t,Ufe)=>{h();Ufe.exports=bze;var vze=FU();function bze(t,e,r){if(typeof e!="number")throw new Error("second argument must be a Number");let n,i,o,s,a,d=!0,u;Array.isArray(t)?(n=[],o=i=t.length):(s=Object.keys(t),n={},o=i=s.length);function c(m){function p(){r&&r(m,n),r=null}d?vze(p):p()}function l(m,p,g){if(n[m]=g,p&&(a=!0),--o===0||p)c(p);else if(!a&&u{"use strict";h();Lfe.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 rq=V((p8t,Kfe)=>{"use strict";h();var wze=new TextEncoder;Kfe.exports=function(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):wze.encode(t)}});var Hfe=V(Vfe=>{"use strict";h();var{AbstractIterator:_ze}=eq(),Ffe=tq(),JI=rq(),tf=Symbol("cache"),Mh=Symbol("finished"),Pc=Symbol("options"),Ch=Symbol("currentOptions"),Yg=Symbol("position"),nq=Symbol("location"),C1=Symbol("first"),zfe={},iq=class extends _ze{constructor(e,r,n){super(e,n),this[tf]=[],this[Mh]=this.limit===0,this[Pc]=n,this[Ch]={...n},this[Yg]=void 0,this[nq]=r,this[C1]=!0}_nextv(e,r,n){if(this[C1]=!1,this[Mh])return this.nextTick(n,null,[]);if(this[tf].length>0)return e=Math.min(e,this[tf].length),this.nextTick(n,null,this[tf].splice(0,e));this[Yg]!==void 0&&(this[Pc].reverse?(this[Ch].lt=this[Yg],this[Ch].lte=void 0):(this[Ch].gt=this[Yg],this[Ch].gte=void 0));let i;try{i=Ffe(this[Ch])}catch{return this[Mh]=!0,this.nextTick(n,null,[])}let o=this.db.db.transaction([this[nq]],"readonly"),s=o.objectStore(this[nq]),a=[];if(this[Pc].reverse){let d=!this[Pc].values&&s.openKeyCursor?"openKeyCursor":"openCursor";s[d](i,"prev").onsuccess=u=>{let c=u.target.result;if(c){let{key:l,value:m}=c;this[Yg]=l,a.push([this[Pc].keys&&l!==void 0?JI(l):void 0,this[Pc].values&&m!==void 0?JI(m):void 0]),a.length{if(d===void 0||u===void 0)return;let l=Math.max(d.length,u.length);l===0||e===1/0?this[Mh]=!0:this[Yg]=d[l-1],a.length=l;for(let m=0;m{d=l.target.result,c()}:(d=[],this.nextTick(c)),this[Pc].values?s.getAll(i,e<1/0?e:void 0).onsuccess=l=>{u=l.target.result,c()}:(u=[],this.nextTick(c))}o.onabort=()=>{n(o.error||new Error("aborted by user")),n=null},o.oncomplete=()=>{n(null,a),n=null}}_next(e){if(this[tf].length>0){let[r,n]=this[tf].shift();this.nextTick(e,null,r,n)}else if(this[Mh])this.nextTick(e);else{let r=Math.min(100,this.limit-this.count);this[C1]&&(this[C1]=!1,r=1),this._nextv(r,zfe,(n,i)=>{if(n)return e(n);this[tf]=i,this._next(e)})}}_all(e,r){this[C1]=!1;let n=this[tf].splice(0,this[tf].length),i=this.limit-this.count-n.length;if(i<=0)return this.nextTick(r,null,n);this._nextv(i,zfe,(o,s)=>{if(o)return r(o);n.length>0&&(s=n.concat(s)),r(null,s)})}_seek(e,r){this[C1]=!0,this[tf]=[],this[Mh]=!1,this[Yg]=void 0,this[Ch]={...this[Pc]};let n;try{n=Ffe(this[Pc])}catch{this[Mh]=!0;return}n!==null&&!n.includes(e)?this[Mh]=!0:this[Pc].reverse?this[Ch].lte=e:this[Ch].gte=e}};Vfe.Iterator=iq;function Wfe(t){typeof t.commit=="function"&&t.commit()}});var Jfe=V((v8t,Gfe)=>{"use strict";h();Gfe.exports=function(e,r,n,i,o){if(i.limit===0)return e.nextTick(o);let s=e.db.transaction([r],"readwrite"),a=s.objectStore(r),d=0;s.oncomplete=function(){o()},s.onabort=function(){o(s.error||new Error("aborted by user"))};let u=a.openKeyCursor?"openKeyCursor":"openCursor",c=i.reverse?"prev":"next";a[u](n,c).onsuccess=function(l){let m=l.target.result;m&&(a.delete(m.key).onsuccess=function(){(i.limit<=0||++d{"use strict";h();var{AbstractLevel:xze}=eq(),Yfe=Mu(),Eze=qfe(),{fromCallback:Sze}=T6(),{Iterator:Aze}=Hfe(),Zfe=rq(),Tze=Jfe(),Ize=tq(),Qfe="level-js-",q6=Symbol("idb"),oq=Symbol("namePrefix"),Oh=Symbol("location"),sq=Symbol("version"),Zg=Symbol("store"),L6=Symbol("onComplete"),Xfe=Symbol("promise"),YI=class extends xze{constructor(e,r,n){if(typeof r=="function"||typeof n=="function")throw new Yfe("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[Oh]=e,this[oq]=i??Qfe,this[sq]=parseInt(o||1,10),this[q6]=null}get location(){return this[Oh]}get namePrefix(){return this[oq]}get version(){return this[sq]}get db(){return this[q6]}get type(){return"browser-level"}_open(e,r){let n=indexedDB.open(this[oq]+this[Oh],this[sq]);n.onerror=function(){r(n.error||new Error("unknown error"))},n.onsuccess=()=>{this[q6]=n.result,r()},n.onupgradeneeded=i=>{let o=i.target.result;o.objectStoreNames.contains(this[Oh])||o.createObjectStore(this[Oh])}}[Zg](e){return this[q6].transaction([this[Oh]],e).objectStore(this[Oh])}[L6](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[Zg]("readonly"),o;try{o=i.get(e)}catch(s){return this.nextTick(n,s)}this[L6](o,function(s,a){if(s)return n(s);if(a===void 0)return n(new Yfe("Entry not found",{code:"LEVEL_NOT_FOUND"}));n(null,Zfe(a))})}_getMany(e,r,n){let i=this[Zg]("readonly"),o=e.map(s=>a=>{let d;try{d=i.get(s)}catch(u){return a(u)}d.onsuccess=()=>{let u=d.result;a(null,u===void 0?u:Zfe(u))},d.onerror=u=>{u.stopPropagation(),a(d.error)}});Eze(o,16,n)}_del(e,r,n){let i=this[Zg]("readwrite"),o;try{o=i.delete(e)}catch(s){return this.nextTick(n,s)}this[L6](o,n)}_put(e,r,n,i){let o=this[Zg]("readwrite"),s;try{s=o.put(r,e)}catch(a){return this.nextTick(i,a)}this[L6](s,i)}_iterator(e){return new Aze(this,this[Oh],e)}_batch(e,r,n){let i=this[Zg]("readwrite"),o=i.transaction,s=0,a;o.onabort=function(){n(a||o.error||new Error("aborted by user"))},o.oncomplete=function(){n()};function d(){let u=e[s++],c=u.key,l;try{l=u.type==="del"?i.delete(c):i.put(u.value,c)}catch(m){a=m,o.abort();return}s=0)return Tze(this,this[Oh],n,e,r);try{let o=this[Zg]("readwrite");i=n?o.delete(n):o.clear()}catch(o){return this.nextTick(r,o)}this[L6](i,r)}_close(e){this[q6].close(),this.nextTick(e)}};YI.destroy=function(t,e,r){typeof e=="function"&&(r=e,e=Qfe),r=Sze(r,Xfe);let n=indexedDB.deleteDatabase(e+t);return n.onsuccess=function(){r()},n.onerror=function(i){r(i)},r[Xfe]};ehe.BrowserLevel=YI});var K6=V(the=>{h();the.Level=aq().BrowserLevel});var rhe,Pd,F6,Xg,nhe=le(()=>{h();rhe=Kt(K6(),1),Pd=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},F6=class{constructor({db:e,location:r="DATASTORE"}={}){this.store=e??new rhe.Level(r)}clear(){return Pd(this,void 0,void 0,function*(){yield this.store.clear()})}close(){return Pd(this,void 0,void 0,function*(){yield this.store.close()})}delete(e){return Pd(this,void 0,void 0,function*(){yield this.store.del(e)})}get(e){return Pd(this,void 0,void 0,function*(){try{return yield this.store.get(e)}catch(r){if(r.notFound)return;throw r}})}set(e,r){return Pd(this,void 0,void 0,function*(){yield this.store.put(e,r)})}},Xg=class{constructor(){this.store=new Map}clear(){return Pd(this,void 0,void 0,function*(){this.store.clear()})}close(){return Pd(this,void 0,void 0,function*(){})}delete(e){return Pd(this,void 0,void 0,function*(){return this.store.delete(e)})}get(e){return Pd(this,void 0,void 0,function*(){return this.store.get(e)})}has(e){return Pd(this,void 0,void 0,function*(){return this.store.has(e)})}list(){return Pd(this,void 0,void 0,function*(){return Array.from(this.store.values())})}set(e,r){return Pd(this,void 0,void 0,function*(){this.store.set(e,r)})}}});var z6,W6,Pze,Qg,cq=le(()=>{h();SI();z6=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},W6=function(t){return this instanceof W6?(this.v=t,this):new W6(t)},Pze=function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(m){n[m]&&(i[m]=function(p){return new Promise(function(g,v){o.push([m,p,g,v])>1||a(m,p)})})}function a(m,p){try{d(n[m](p))}catch(g){l(o[0][3],g)}}function d(m){m.value instanceof W6?Promise.resolve(m.value.v).then(u,c):l(o[0][2],m)}function u(m){a("next",m)}function c(m){a("throw",m)}function l(m,p){m(p),o.shift(),o.length&&a(o[0][0],o[0][1])}},Qg=class t{static asAsyncIterator(e){return Pze(this,arguments,function*(){let n=e.getReader();try{for(;;){let{done:i,value:o}=yield W6(n.read());if(i)break;yield yield W6(o)}}finally{n.releaseLock()}})}static consumeToArrayBuffer({readableStream:e}){return z6(this,void 0,void 0,function*(){let r=t.asAsyncIterator(e);return yield de.asyncIterable(r).toArrayBufferAsync()})}static consumeToBlob({readableStream:e}){return z6(this,void 0,void 0,function*(){let r=t.asAsyncIterator(e);return yield de.asyncIterable(r).toBlobAsync()})}static consumeToBytes({readableStream:e}){return z6(this,void 0,void 0,function*(){let r=t.asAsyncIterator(e);return yield de.asyncIterable(r).toUint8ArrayAsync()})}static consumeToJson({readableStream:e}){return z6(this,void 0,void 0,function*(){let r=t.asAsyncIterator(e);return yield de.asyncIterable(r).toObjectAsync()})}static consumeToText({readableStream:e}){return z6(this,void 0,void 0,function*(){let r=t.asAsyncIterator(e);return yield de.asyncIterable(r).toStringAsync()})}static generateByteStream({streamLength:e,chunkLength:r,fillValue:n}){let i=e??1/0,o;function s(){let a=Math.min(i,r??1/0);i-=a;let d;if(typeof n=="number")d=new Uint8Array(a).fill(n);else if(Array.isArray(n)){d=new Uint8Array(a);let[u,c]=n,l=c-u+1;for(let m=0;m{"use strict";h();ihe.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 rf=V((D8t,uq)=>{"use strict";h();var kze=Fn(),Rze=Object.getPrototypeOf(async function(){}).constructor,ohe=globalThis.Blob||kze.Blob,Dze=typeof ohe<"u"?function(e){return e instanceof ohe}:function(e){return!1},dq=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 Rze},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Dze};uq.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var ha=V((M8t,che)=>{"use strict";h();var{format:Bze,inspect:ZI,AggregateError:Mze}=rf(),Cze=globalThis.AggregateError||Mze,Oze=Symbol("kIsNodeError"),$ze=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Nze=/^([A-Z][a-z0-9]*)+$/,jze="__node_internal_",XI={};function ev(t,e){if(!t)throw new XI.ERR_INTERNAL_ASSERTION(e)}function she(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 Uze(t,e,r){if(typeof e=="function")return ev(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 ev(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:Bze(e,...r)}function ds(t,e,r){r||(r=Error);class n extends r{constructor(...o){super(Uze(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[Oze]=!0,XI[t]=n}function ahe(t){let e=jze+t.name;return Object.defineProperty(t,"name",{value:e}),t}function qze(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new Cze([e,t],e.message);return r.code=e.code,r}return t||e}var lq=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new XI.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};ds("ERR_ASSERTION","%s",Error);ds("ERR_INVALID_ARG_TYPE",(t,e,r)=>{ev(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 d of e)ev(typeof d=="string","All expected entries have to be of type string"),$ze.includes(d)?i.push(d.toLowerCase()):Nze.test(d)?o.push(d):(ev(d!=="object",'The value "object" should be written as "Object"'),s.push(d));if(o.length>0){let d=i.indexOf("object");d!==-1&&(i.splice(i,d,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 d=i.pop();n+=`one of type ${i.join(", ")}, or ${d}`}}(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 d=o.pop();n+=`an instance of ${o.join(", ")}, or ${d}`}}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 d=s.pop();n+=`one of ${s.join(", ")}, or ${d}`}}if(r==null)n+=`. Received ${r}`;else if(typeof r=="function"&&r.name)n+=`. Received function ${r.name}`;else if(typeof r=="object"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)n+=`. Received an instance of ${r.constructor.name}`;else{let d=ZI(r,{depth:-1});n+=`. Received ${d}`}}else{let d=ZI(r,{colors:!1});d.length>25&&(d=`${d.slice(0,25)}...`),n+=`. Received type ${typeof r} (${d})`}return n},TypeError);ds("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=ZI(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);ds("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);ds("ERR_MISSING_ARGS",(...t)=>{ev(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);ds("ERR_OUT_OF_RANGE",(t,e,r)=>{ev(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=she(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=she(n)),n+="n"):n=ZI(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);ds("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);ds("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);ds("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);ds("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);ds("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);ds("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);ds("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);ds("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);ds("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);ds("ERR_STREAM_WRITE_AFTER_END","write after end",Error);ds("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);che.exports={AbortError:lq,aggregateTwoErrors:ahe(qze),hideStackFrames:ahe,codes:XI}});var V6=V((O8t,ghe)=>{"use strict";h();var{ArrayIsArray:hq,ArrayPrototypeIncludes:fhe,ArrayPrototypeJoin:hhe,ArrayPrototypeMap:Lze,NumberIsInteger:pq,NumberIsNaN:Kze,NumberMAX_SAFE_INTEGER:Fze,NumberMIN_SAFE_INTEGER:zze,NumberParseInt:Wze,ObjectPrototypeHasOwnProperty:Vze,RegExpPrototypeExec:phe,String:Hze,StringPrototypeToUpperCase:Gze,StringPrototypeTrim:Jze}=Ki(),{hideStackFrames:kd,codes:{ERR_SOCKET_BAD_PORT:Yze,ERR_INVALID_ARG_TYPE:pa,ERR_INVALID_ARG_VALUE:O1,ERR_OUT_OF_RANGE:tv,ERR_UNKNOWN_SIGNAL:dhe}}=ha(),{normalizeEncoding:Zze}=rf(),{isAsyncFunction:Xze,isArrayBufferView:Qze}=rf().types,uhe={};function eWe(t){return t===(t|0)}function tWe(t){return t===t>>>0}var rWe=/^[0-7]+$/,nWe="must be a 32-bit unsigned integer or an octal string";function iWe(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(phe(rWe,t)===null)throw new O1(e,t,nWe);t=Wze(t,8)}return mhe(t,e),t}var oWe=kd((t,e,r=zze,n=Fze)=>{if(typeof t!="number")throw new pa(e,"number",t);if(!pq(t))throw new tv(e,"an integer",t);if(tn)throw new tv(e,`>= ${r} && <= ${n}`,t)}),sWe=kd((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new pa(e,"number",t);if(!pq(t))throw new tv(e,"an integer",t);if(tn)throw new tv(e,`>= ${r} && <= ${n}`,t)}),mhe=kd((t,e,r=!1)=>{if(typeof t!="number")throw new pa(e,"number",t);if(!pq(t))throw new tv(e,"an integer",t);let n=r?1:0,i=4294967295;if(ti)throw new tv(e,`>= ${n} && <= ${i}`,t)});function mq(t,e){if(typeof t!="string")throw new pa(e,"string",t)}function aWe(t,e,r=void 0,n){if(typeof t!="number")throw new pa(e,"number",t);if(r!=null&&tn||(r!=null||n!=null)&&Kze(t))throw new tv(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var cWe=kd((t,e,r)=>{if(!fhe(r,t)){let i="must be one of: "+hhe(Lze(r,o=>typeof o=="string"?`'${o}'`:Hze(o)),", ");throw new O1(e,t,i)}});function yhe(t,e){if(typeof t!="boolean")throw new pa(e,"boolean",t)}function fq(t,e,r){return t==null||!Vze(t,e)?r:t[e]}var dWe=kd((t,e,r=null)=>{let n=fq(r,"allowArray",!1),i=fq(r,"allowFunction",!1);if(!fq(r,"nullable",!1)&&t===null||!n&&hq(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new pa(e,"Object",t)}),uWe=kd((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new pa(e,"a dictionary",t)}),yq=kd((t,e,r=0)=>{if(!hq(t))throw new pa(e,"Array",t);if(t.length{if(!Qze(t))throw new pa(e,["Buffer","TypedArray","DataView"],t)});function mWe(t,e){let r=Zze(e),n=t.length;if(r==="hex"&&n%2!==0)throw new O1("encoding",e,`is invalid for data of length ${n}`)}function yWe(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&Jze(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new Yze(e,t,r);return t|0}var gWe=kd((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new pa(e,"AbortSignal",t)}),vWe=kd((t,e)=>{if(typeof t!="function")throw new pa(e,"Function",t)}),bWe=kd((t,e)=>{if(typeof t!="function"||Xze(t))throw new pa(e,"Function",t)}),wWe=kd((t,e)=>{if(t!==void 0)throw new pa(e,"undefined",t)});function _We(t,e,r){if(!fhe(r,t))throw new pa(e,`('${hhe(r,"|")}')`,t)}var xWe=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function lhe(t,e){if(typeof t>"u"||!phe(xWe,t))throw new O1(e,t,'must be an array or string of format "; rel=preload; as=style"')}function EWe(t){if(typeof t=="string")return lhe(t,"hints"),t;if(hq(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n; rel=preload; as=style"')}ghe.exports={isInt32:eWe,isUint32:tWe,parseFileMode:iWe,validateArray:yq,validateStringArray:lWe,validateBooleanArray:fWe,validateBoolean:yhe,validateBuffer:pWe,validateDictionary:uWe,validateEncoding:mWe,validateFunction:vWe,validateInt32:sWe,validateInteger:oWe,validateNumber:aWe,validateObject:dWe,validateOneOf:cWe,validatePlainFunction:bWe,validatePort:yWe,validateSignalName:hWe,validateString:mq,validateUint32:mhe,validateUndefined:wWe,validateUnion:_We,validateAbortSignal:gWe,validateLinkHeaderValue:EWe}});var of=V((N8t,Mhe)=>{"use strict";h();var{Symbol:QI,SymbolAsyncIterator:vhe,SymbolIterator:bhe,SymbolFor:whe}=Ki(),_he=QI("kDestroyed"),xhe=QI("kIsErrored"),gq=QI("kIsReadable"),Ehe=QI("kIsDisturbed"),SWe=whe("nodejs.webstream.isClosedPromise"),AWe=whe("nodejs.webstream.controllerErrorFunction");function eP(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 tP(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 TWe(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function nf(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function She(t){return!!(t&&!nf(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Ahe(t){return!!(t&&!nf(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function The(t){return!!(t&&!nf(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function IWe(t){return She(t)||Ahe(t)||The(t)}function PWe(t,e){return t==null?!1:e===!0?typeof t[vhe]=="function":e===!1?typeof t[bhe]=="function":typeof t[vhe]=="function"||typeof t[bhe]=="function"}function rP(t){if(!nf(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[_he]||n!=null&&n.destroyed)}function Ihe(t){if(!tP(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 kWe(t,e){if(!tP(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 RWe(t){if(!eP(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 Phe(t,e){if(!eP(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 khe(t){return t&&t[gq]!=null?t[gq]:typeof t?.readable!="boolean"?null:rP(t)?!1:eP(t)&&t.readable&&!Phe(t)}function Rhe(t){return typeof t?.writable!="boolean"?null:rP(t)?!1:tP(t)&&t.writable&&!Ihe(t)}function DWe(t,e){return nf(t)?rP(t)?!0:!(e?.readable!==!1&&khe(t)||e?.writable!==!1&&Rhe(t)):null}function BWe(t){var e,r;return nf(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 MWe(t){var e,r;return nf(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 CWe(t){if(!nf(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"&&Dhe(t)?t._closed:null}function Dhe(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Bhe(t){return typeof t._sent100=="boolean"&&Dhe(t)}function OWe(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 $We(t){if(!nf(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&Bhe(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function NWe(t){var e;return!!(t&&((e=t[Ehe])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function jWe(t){var e,r,n,i,o,s,a,d,u,c;return!!(t&&((e=(r=(n=(i=(o=(s=t[xhe])!==null&&s!==void 0?s:t.readableErrored)!==null&&o!==void 0?o:t.writableErrored)!==null&&i!==void 0?i:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&n!==void 0?n:(d=t._writableState)===null||d===void 0?void 0:d.errorEmitted)!==null&&r!==void 0?r:(u=t._readableState)===null||u===void 0?void 0:u.errored)!==null&&e!==void 0?e:!((c=t._writableState)===null||c===void 0)&&c.errored))}Mhe.exports={kDestroyed:_he,isDisturbed:NWe,kIsDisturbed:Ehe,isErrored:jWe,kIsErrored:xhe,isReadable:khe,kIsReadable:gq,kIsClosedPromise:SWe,kControllerErrorFunction:AWe,isClosed:CWe,isDestroyed:rP,isDuplexNodeStream:TWe,isFinished:DWe,isIterable:PWe,isReadableNodeStream:eP,isReadableStream:She,isReadableEnded:RWe,isReadableFinished:Phe,isReadableErrored:MWe,isNodeStream:nf,isWebStream:IWe,isWritable:Rhe,isWritableNodeStream:tP,isWritableStream:Ahe,isWritableEnded:Ihe,isWritableFinished:kWe,isWritableErrored:BWe,isServerRequest:OWe,isServerResponse:Bhe,willEmitClose:$We,isTransformStream:The}});var $h=V((U8t,xq)=>{h();var ty=ys(),{AbortError:Khe,codes:UWe}=ha(),{ERR_INVALID_ARG_TYPE:qWe,ERR_STREAM_PREMATURE_CLOSE:Che}=UWe,{kEmptyObject:bq,once:wq}=rf(),{validateAbortSignal:LWe,validateFunction:KWe,validateObject:FWe,validateBoolean:zWe}=V6(),{Promise:WWe,PromisePrototypeThen:VWe}=Ki(),{isClosed:HWe,isReadable:Ohe,isReadableNodeStream:vq,isReadableStream:GWe,isReadableFinished:$he,isReadableErrored:Nhe,isWritable:jhe,isWritableNodeStream:Uhe,isWritableStream:JWe,isWritableFinished:qhe,isWritableErrored:Lhe,isNodeStream:YWe,willEmitClose:ZWe,kIsClosedPromise:XWe}=of();function QWe(t){return t.setHeader&&typeof t.abort=="function"}var _q=()=>{};function Fhe(t,e,r){var n,i;if(arguments.length===2?(r=e,e=bq):e==null?e=bq:FWe(e,"options"),KWe(r,"callback"),LWe(e.signal,"options.signal"),r=wq(r),GWe(t)||JWe(t))return eVe(t,e,r);if(!YWe(t))throw new qWe("stream",["ReadableStream","WritableStream","Stream"],t);let o=(n=e.readable)!==null&&n!==void 0?n:vq(t),s=(i=e.writable)!==null&&i!==void 0?i:Uhe(t),a=t._writableState,d=t._readableState,u=()=>{t.writable||m()},c=ZWe(t)&&vq(t)===o&&Uhe(t)===s,l=qhe(t,!1),m=()=>{l=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||o))&&(!o||p)&&r.call(t)},p=$he(t,!1),g=()=>{p=!0,t.destroyed&&(c=!1),!(c&&(!t.writable||s))&&(!s||l)&&r.call(t)},v=N=>{r.call(t,N)},E=HWe(t),A=()=>{E=!0;let N=Lhe(t)||Nhe(t);if(N&&typeof N!="boolean")return r.call(t,N);if(o&&!p&&vq(t,!0)&&!$he(t,!1))return r.call(t,new Che);if(s&&!l&&!qhe(t,!1))return r.call(t,new Che);r.call(t)},P=()=>{E=!0;let N=Lhe(t)||Nhe(t);if(N&&typeof N!="boolean")return r.call(t,N);r.call(t)},I=()=>{t.req.on("finish",m)};QWe(t)?(t.on("complete",m),c||t.on("abort",A),t.req?I():t.on("request",I)):s&&!a&&(t.on("end",u),t.on("close",u)),!c&&typeof t.aborted=="boolean"&&t.on("aborted",A),t.on("end",g),t.on("finish",m),e.error!==!1&&t.on("error",v),t.on("close",A),E?ty.nextTick(A):a!=null&&a.errorEmitted||d!=null&&d.errorEmitted?c||ty.nextTick(P):(!o&&(!c||Ohe(t))&&(l||jhe(t)===!1)||!s&&(!c||jhe(t))&&(p||Ohe(t)===!1)||d&&t.req&&t.aborted)&&ty.nextTick(P);let $=()=>{r=_q,t.removeListener("aborted",A),t.removeListener("complete",m),t.removeListener("abort",A),t.removeListener("request",I),t.req&&t.req.removeListener("finish",m),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",m),t.removeListener("end",g),t.removeListener("error",v),t.removeListener("close",A)};if(e.signal&&!E){let N=()=>{let K=r;$(),K.call(t,new Khe(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)ty.nextTick(N);else{let K=r;r=wq((...F)=>{e.signal.removeEventListener("abort",N),K.apply(t,F)}),e.signal.addEventListener("abort",N)}}return $}function eVe(t,e,r){let n=!1,i=_q;if(e.signal)if(i=()=>{n=!0,r.call(t,new Khe(void 0,{cause:e.signal.reason}))},e.signal.aborted)ty.nextTick(i);else{let s=r;r=wq((...a)=>{e.signal.removeEventListener("abort",i),s.apply(t,a)}),e.signal.addEventListener("abort",i)}let o=(...s)=>{n||ty.nextTick(()=>r.apply(t,s))};return VWe(t[XWe].promise,o,o),_q}function tVe(t,e){var r;let n=!1;return e===null&&(e=bq),(r=e)!==null&&r!==void 0&&r.cleanup&&(zWe(e.cleanup,"cleanup"),n=e.cleanup),new WWe((i,o)=>{let s=Fhe(t,e,a=>{n&&s(),a?o(a):i()})})}xq.exports=Fhe;xq.exports.finished=tVe});var rv=V((L8t,Zhe)=>{"use strict";h();var sf=ys(),{aggregateTwoErrors:rVe,codes:{ERR_MULTIPLE_CALLBACK:nVe},AbortError:iVe}=ha(),{Symbol:Vhe}=Ki(),{kDestroyed:oVe,isDestroyed:sVe,isFinished:aVe,isServerRequest:cVe}=of(),Hhe=Vhe("kDestroy"),Eq=Vhe("kConstruct");function Ghe(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function dVe(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):(Ghe(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?zhe(this,t,e):this.once(Hhe,function(o){zhe(this,rVe(o,t),e)}),this)}function zhe(t,e,r){let n=!1;function i(o){if(n)return;n=!0;let s=t._readableState,a=t._writableState;Ghe(o,a,s),a&&(a.closed=!0),s&&(s.closed=!0),typeof r=="function"&&r(o),o?sf.nextTick(uVe,t,o):sf.nextTick(Jhe,t)}try{t._destroy(e||null,i)}catch(o){i(o)}}function uVe(t,e){Sq(t,e),Jhe(t)}function Jhe(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 Sq(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 lVe(){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 Aq(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?sf.nextTick(Sq,t,e):Sq(t,e))}function fVe(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(Eq,e),!(t.listenerCount(Eq)>1)&&sf.nextTick(hVe,t)}function hVe(t){let e=!1;function r(n){if(e){Aq(t,n??new nVe);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(Hhe,n):n?Aq(t,n,!0):sf.nextTick(pVe,t)}try{t._construct(n=>{sf.nextTick(r,n)})}catch(n){sf.nextTick(r,n)}}function pVe(t){t.emit(Eq)}function Whe(t){return t?.setHeader&&typeof t.abort=="function"}function Yhe(t){t.emit("close")}function mVe(t,e){t.emit("error",e),sf.nextTick(Yhe,t)}function yVe(t,e){!t||sVe(t)||(!e&&!aVe(t)&&(e=new iVe),cVe(t)?(t.socket=null,t.destroy(e)):Whe(t)?t.abort():Whe(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?sf.nextTick(mVe,t,e):sf.nextTick(Yhe,t),t.destroyed||(t[oVe]=!0))}Zhe.exports={construct:fVe,destroyer:yVe,destroy:dVe,undestroy:lVe,errorOrDestroy:Aq}});var oP=V((F8t,Qhe)=>{"use strict";h();var{ArrayIsArray:gVe,ObjectSetPrototypeOf:Xhe}=Ki(),{EventEmitter:nP}=lc();function iP(t){nP.call(this,t)}Xhe(iP.prototype,nP.prototype);Xhe(iP,nP);iP.prototype.pipe=function(t,e){let r=this;function n(c){t.writable&&t.write(c)===!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",a));let o=!1;function s(){o||(o=!0,t.end())}function a(){o||(o=!0,typeof t.destroy=="function"&&t.destroy())}function d(c){u(),nP.listenerCount(this,"error")===0&&this.emit("error",c)}Tq(r,"error",d),Tq(t,"error",d);function u(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",d),t.removeListener("error",d),r.removeListener("end",u),r.removeListener("close",u),t.removeListener("close",u)}return r.on("end",u),r.on("close",u),t.on("close",u),t.emit("pipe",r),t};function Tq(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):gVe(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}Qhe.exports={Stream:iP,prependListener:Tq}});var H6=V((W8t,sP)=>{"use strict";h();var{AbortError:epe,codes:vVe}=ha(),{isNodeStream:tpe,isWebStream:bVe,kControllerErrorFunction:wVe}=of(),_Ve=$h(),{ERR_INVALID_ARG_TYPE:rpe}=vVe,xVe=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new rpe(e,"AbortSignal",t)};sP.exports.addAbortSignal=function(e,r){if(xVe(e,"signal"),!tpe(r)&&!bVe(r))throw new rpe("stream",["ReadableStream","WritableStream","Stream"],r);return sP.exports.addAbortSignalNoValidate(e,r)};sP.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=tpe(e)?()=>{e.destroy(new epe(void 0,{cause:t.reason}))}:()=>{e[wVe](new epe(void 0,{cause:t.reason}))};return t.aborted?r():(t.addEventListener("abort",r),_Ve(e,()=>t.removeEventListener("abort",r))),e}});var ope=V((G8t,ipe)=>{"use strict";h();var{StringPrototypeSlice:npe,SymbolIterator:EVe,TypedArrayPrototypeSet:aP,Uint8Array:SVe}=Ki(),{Buffer:Iq}=Fn(),{inspect:AVe}=rf();ipe.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 Iq.alloc(0);let r=Iq.allocUnsafe(e>>>0),n=this.head,i=0;for(;n;)aP(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+=npe(o,0,e),this.head=n,n.data=npe(o,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=Iq.allocUnsafe(e),n=e,i=this.head,o=0;do{let s=i.data;if(e>s.length)aP(r,s,n-e),e-=s.length;else{e===s.length?(aP(r,s,n-e),++o,i.next?this.head=i.next:this.head=this.tail=null):(aP(r,new SVe(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 AVe(this,{...r,depth:0,customInspect:!1})}}});var cP=V((Y8t,ape)=>{"use strict";h();var{MathFloor:TVe,NumberIsInteger:IVe}=Ki(),{ERR_INVALID_ARG_VALUE:PVe}=ha().codes;function kVe(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function spe(t){return t?16:16*1024}function RVe(t,e,r,n){let i=kVe(e,n,r);if(i!=null){if(!IVe(i)||i<0){let o=n?`options.${r}`:"options.highWaterMark";throw new PVe(o,i)}return TVe(i)}return spe(t.objectMode)}ape.exports={getHighWaterMark:RVe,getDefaultHighWaterMark:spe}});var Pq=V((X8t,lpe)=>{"use strict";h();var cpe=ys(),{PromisePrototypeThen:DVe,SymbolAsyncIterator:dpe,SymbolIterator:upe}=Ki(),{Buffer:BVe}=Fn(),{ERR_INVALID_ARG_TYPE:MVe,ERR_STREAM_NULL_VALUES:CVe}=ha().codes;function OVe(t,e,r){let n;if(typeof e=="string"||e instanceof BVe)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[dpe])i=!0,n=e[dpe]();else if(e&&e[upe])i=!1,n=e[upe]();else throw new MVe("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...r}),s=!1;o._read=function(){s||(s=!0,d())},o._destroy=function(u,c){DVe(a(u),()=>cpe.nextTick(c,u),l=>cpe.nextTick(c,l||u))};async function a(u){let c=u!=null,l=typeof n.throw=="function";if(c&&l){let{value:m,done:p}=await n.throw(u);if(await m,p)return}if(typeof n.return=="function"){let{value:m}=await n.return();await m}}async function d(){for(;;){try{let{value:u,done:c}=i?await n.next():n.next();if(c)o.push(null);else{let l=u&&typeof u.then=="function"?await u:u;if(l===null)throw s=!1,new CVe;if(o.push(l))continue;s=!1}}catch(u){o.destroy(u)}break}}return o}lpe.exports=OVe});var G6=V((e4t,Spe)=>{h();var $u=ys(),{ArrayPrototypeIndexOf:$Ve,NumberIsInteger:NVe,NumberIsNaN:jVe,NumberParseInt:UVe,ObjectDefineProperties:ppe,ObjectKeys:qVe,ObjectSetPrototypeOf:mpe,Promise:LVe,SafeSet:KVe,SymbolAsyncIterator:FVe,Symbol:zVe}=Ki();Spe.exports=xr;xr.ReadableState=Cq;var{EventEmitter:WVe}=lc(),{Stream:ry,prependListener:VVe}=oP(),{Buffer:kq}=Fn(),{addAbortSignal:HVe}=H6(),GVe=$h(),$r=rf().debuglog("stream",t=>{$r=t}),JVe=ope(),N1=rv(),{getHighWaterMark:YVe,getDefaultHighWaterMark:ZVe}=cP(),{aggregateTwoErrors:fpe,codes:{ERR_INVALID_ARG_TYPE:XVe,ERR_METHOD_NOT_IMPLEMENTED:QVe,ERR_OUT_OF_RANGE:eHe,ERR_STREAM_PUSH_AFTER_EOF:tHe,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:rHe}}=ha(),{validateObject:nHe}=V6(),nv=zVe("kPaused"),{StringDecoder:ype}=Ub(),iHe=Pq();mpe(xr.prototype,ry.prototype);mpe(xr,ry);var Rq=()=>{},{errorOrDestroy:$1}=N1;function Cq(t,e,r){typeof r!="boolean"&&(r=e instanceof af()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.readableObjectMode)),this.highWaterMark=t?YVe(this,t,"readableHighWaterMark",r):ZVe(!1),this.buffer=new JVe,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[nv]=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 ype(t.encoding),this.encoding=t.encoding)}function xr(t){if(!(this instanceof xr))return new xr(t);let e=this instanceof af();this._readableState=new Cq(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&&HVe(t.signal,this)),ry.call(this,t),N1.construct(this,()=>{this._readableState.needReadable&&dP(this,this._readableState)})}xr.prototype.destroy=N1.destroy;xr.prototype._undestroy=N1.undestroy;xr.prototype._destroy=function(t,e){e(t)};xr.prototype[WVe.captureRejectionSymbol]=function(t){this.destroy(t)};xr.prototype.push=function(t,e){return gpe(this,t,e,!1)};xr.prototype.unshift=function(t,e){return gpe(this,t,e,!0)};function gpe(t,e,r,n){$r("readableAddChunk",e);let i=t._readableState,o;if(i.objectMode||(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=kq.from(e,r).toString(i.encoding):(e=kq.from(e,r),r=""))):e instanceof kq?r="":ry._isUint8Array(e)?(e=ry._uint8ArrayToBuffer(e),r=""):e!=null&&(o=new XVe("chunk",["string","Buffer","Uint8Array"],e))),o)$1(t,o);else if(e===null)i.reading=!1,aHe(t,i);else if(i.objectMode||e&&e.length>0)if(n)if(i.endEmitted)$1(t,new rHe);else{if(i.destroyed||i.errored)return!1;Dq(t,i,e,!0)}else if(i.ended)$1(t,new tHe);else{if(i.destroyed||i.errored)return!1;i.reading=!1,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?Dq(t,i,e,!1):dP(t,i)):Dq(t,i,e,!1)}else n||(i.reading=!1,dP(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&&uP(t)),dP(t,e)}xr.prototype.isPaused=function(){let t=this._readableState;return t[nv]===!0||t.flowing===!1};xr.prototype.setEncoding=function(t){let e=new ype(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 oHe=1073741824;function sHe(t){if(t>oHe)throw new eHe("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function hpe(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:jVe(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}xr.prototype.read=function(t){$r("read",t),t===void 0?t=NaN:NVe(t)||(t=UVe(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=sHe(t)),t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return $r("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Bq(this):uP(this),null;if(t=hpe(t,e),t===0&&e.ended)return e.length===0&&Bq(this),null;let n=e.needReadable;if($r("need readable",n),(e.length===0||e.length-t0?i=xpe(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&&Bq(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function aHe(t,e){if($r("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?uP(t):(e.needReadable=!1,e.emittedReadable=!0,vpe(t))}}function uP(t){let e=t._readableState;$r("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||($r("emitReadable",e.flowing),e.emittedReadable=!0,$u.nextTick(vpe,t))}function vpe(t){let e=t._readableState;$r("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,wpe(t)}function dP(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,$u.nextTick(cHe,t,e))}function cHe(t,e){for(;!e.reading&&!e.ended&&(e.length1&&n.pipes.includes(t)&&($r("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),d||(d=dHe(r,t),t.on("drain",d))}r.on("data",m);function m(A){$r("ondata");let P=t.write(A);$r("dest.write",P),P===!1&&l()}function p(A){if($r("onerror",A),E(),t.removeListener("error",p),t.listenerCount("error")===0){let P=t._writableState||t._readableState;P&&!P.errorEmitted?$1(t,A):t.emit("error",A)}}VVe(t,"error",p);function g(){t.removeListener("finish",v),E()}t.once("close",g);function v(){$r("onfinish"),t.removeListener("close",g),E()}t.once("finish",v);function E(){$r("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?n.flowing&&l():n.flowing||($r("pipe resume"),r.resume()),t};function dHe(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?($r("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&($r("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}xr.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,$r("on readable",n.length,n.reading),n.length?uP(this):n.reading||$u.nextTick(uHe,this)),r};xr.prototype.addListener=xr.prototype.on;xr.prototype.removeListener=function(t,e){let r=ry.prototype.removeListener.call(this,t,e);return t==="readable"&&$u.nextTick(bpe,this),r};xr.prototype.off=xr.prototype.removeListener;xr.prototype.removeAllListeners=function(t){let e=ry.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&$u.nextTick(bpe,this),e};function bpe(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[nv]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function uHe(t){$r("readable nexttick read 0"),t.read(0)}xr.prototype.resume=function(){let t=this._readableState;return t.flowing||($r("resume"),t.flowing=!t.readableListening,lHe(this,t)),t[nv]=!1,this};function lHe(t,e){e.resumeScheduled||(e.resumeScheduled=!0,$u.nextTick(fHe,t,e))}function fHe(t,e){$r("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),wpe(t),e.flowing&&!e.reading&&t.read(0)}xr.prototype.pause=function(){return $r("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&($r("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[nv]=!0,this};function wpe(t){let e=t._readableState;for($r("flow",e.flowing);e.flowing&&t.read()!==null;);}xr.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=>{$1(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=qVe(t);for(let n=1;n{i=s?fpe(i,s):null,r(),r=Rq});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 LVe(n)}}}catch(s){throw i=fpe(i,s),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?N1.destroyer(t,null):(t.off("readable",n),o())}}ppe(xr.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}}});ppe(Cq.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[nv]!==!1},set(t){this[nv]=!!t}}});xr._fromList=xpe;function xpe(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 Bq(t){let e=t._readableState;$r("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,$u.nextTick(pHe,e,t))}function pHe(t,e){if($r("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)$u.nextTick(mHe,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function mHe(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}xr.from=function(t,e){return iHe(xr,t,e)};var Mq;function Epe(){return Mq===void 0&&(Mq={}),Mq}xr.fromWeb=function(t,e){return Epe().newStreamReadableFromReadableStream(t,e)};xr.toWeb=function(t,e){return Epe().newReadableStreamFromStreamReadable(t,e)};xr.wrap=function(t,e){var r,n;return new xr({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(i,o){N1.destroyer(t,i),o(i)}}).wrap(t)}});var Lq=V((r4t,$pe)=>{h();var iv=ys(),{ArrayPrototypeSlice:Ipe,Error:yHe,FunctionPrototypeSymbolHasInstance:Ppe,ObjectDefineProperty:kpe,ObjectDefineProperties:gHe,ObjectSetPrototypeOf:Rpe,StringPrototypeToLowerCase:vHe,Symbol:bHe,SymbolHasInstance:wHe}=Ki();$pe.exports=ni;ni.WritableState=Z6;var{EventEmitter:_He}=lc(),J6=oP().Stream,{Buffer:lP}=Fn(),pP=rv(),{addAbortSignal:xHe}=H6(),{getHighWaterMark:EHe,getDefaultHighWaterMark:SHe}=cP(),{ERR_INVALID_ARG_TYPE:AHe,ERR_METHOD_NOT_IMPLEMENTED:THe,ERR_MULTIPLE_CALLBACK:Dpe,ERR_STREAM_CANNOT_PIPE:IHe,ERR_STREAM_DESTROYED:Y6,ERR_STREAM_ALREADY_FINISHED:PHe,ERR_STREAM_NULL_VALUES:kHe,ERR_STREAM_WRITE_AFTER_END:RHe,ERR_UNKNOWN_ENCODING:Bpe}=ha().codes,{errorOrDestroy:j1}=pP;Rpe(ni.prototype,J6.prototype);Rpe(ni,J6);function Nq(){}var U1=bHe("kOnFinished");function Z6(t,e,r){typeof r!="boolean"&&(r=e instanceof af()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?EHe(this,t,"writableHighWaterMark",r):SHe(!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=BHe.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,hP(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[U1]=[]}function hP(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Z6.prototype.getBuffer=function(){return Ipe(this.buffered,this.bufferedIndex)};kpe(Z6.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function ni(t){let e=this instanceof af();if(!e&&!Ppe(ni,this))return new ni(t);this._writableState=new Z6(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&&xHe(t.signal,this)),J6.call(this,t),pP.construct(this,()=>{let r=this._writableState;r.writing||Uq(this,r),qq(this,r)})}kpe(ni,wHe,{__proto__:null,value:function(t){return Ppe(this,t)?!0:this!==ni?!1:t&&t._writableState instanceof Z6}});ni.prototype.pipe=function(){j1(this,new IHe)};function Mpe(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"&&!lP.isEncoding(r))throw new Bpe(r);typeof n!="function"&&(n=Nq)}if(e===null)throw new kHe;if(!i.objectMode)if(typeof e=="string")i.decodeStrings!==!1&&(e=lP.from(e,r),r="buffer");else if(e instanceof lP)r="buffer";else if(J6._isUint8Array(e))e=J6._uint8ArrayToBuffer(e),r="buffer";else throw new AHe("chunk",["string","Buffer","Uint8Array"],e);let o;return i.ending?o=new RHe:i.destroyed&&(o=new Y6("write")),o?(iv.nextTick(n,o),j1(t,o,!0),o):(i.pendingcb++,DHe(t,i,e,r,n))}ni.prototype.write=function(t,e,r){return Mpe(this,t,e,r)===!0};ni.prototype.cork=function(){this._writableState.corked++};ni.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Uq(this,t))};ni.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=vHe(e)),!lP.isEncoding(e))throw new Bpe(e);return this._writableState.defaultEncoding=e,this};function DHe(t,e,r,n,i){let o=e.objectMode?1:r.length;e.length+=o;let s=e.lengthr.bufferedIndex&&Uq(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},iv.nextTick(MHe,r.afterWriteTickInfo)):Cpe(t,r,1,i))}function MHe({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,Cpe(t,e,r,n)}function Cpe(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&&jq(e),qq(t,e)}function jq(t){if(t.writing)return;for(let i=t.bufferedIndex;i1&&t._writev){e.pendingcb-=o-1;let a=e.allNoop?Nq:u=>{for(let c=s;c256?(r.splice(0,s),e.bufferedIndex=0):e.bufferedIndex=s}e.bufferProcessing=!1}ni.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new THe("_write()")};ni.prototype._writev=null;ni.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=Mpe(this,t,e);o instanceof yHe&&(i=o)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,qq(this,n,!0),n.ended=!0):n.finished?i=new PHe("end"):n.destroyed&&(i=new Y6("end"))),typeof r=="function"&&(i||n.finished?iv.nextTick(r,i):n[U1].push(r)),this};function fP(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 CHe(t,e){let r=!1;function n(i){if(r){j1(t,i??Dpe());return}if(r=!0,e.pendingcb--,i){let o=e[U1].splice(0);for(let s=0;s{fP(i)?$q(n,i):i.pendingcb--},t,e)):fP(e)&&(e.pendingcb++,$q(t,e))))}function $q(t,e){e.pendingcb--,e.finished=!0;let r=e[U1].splice(0);for(let n=0;n{h();var Kq=ys(),NHe=Fn(),{isReadable:jHe,isWritable:UHe,isIterable:Npe,isNodeStream:qHe,isReadableNodeStream:jpe,isWritableNodeStream:Upe,isDuplexNodeStream:LHe}=of(),qpe=$h(),{AbortError:Vpe,codes:{ERR_INVALID_ARG_TYPE:KHe,ERR_INVALID_RETURN_VALUE:Lpe}}=ha(),{destroyer:q1}=rv(),FHe=af(),zHe=G6(),{createDeferredPromise:Kpe}=rf(),Fpe=Pq(),zpe=globalThis.Blob||NHe.Blob,WHe=typeof zpe<"u"?function(e){return e instanceof zpe}:function(e){return!1},VHe=globalThis.AbortController||ah().AbortController,{FunctionPrototypeCall:Wpe}=Ki(),ov=class extends FHe{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)}};Hpe.exports=function t(e,r){if(LHe(e))return e;if(jpe(e))return mP({readable:e});if(Upe(e))return mP({writable:e});if(qHe(e))return mP({writable:!1,readable:!1});if(typeof e=="function"){let{value:i,write:o,final:s,destroy:a}=HHe(e);if(Npe(i))return Fpe(ov,i,{objectMode:!0,write:o,final:s,destroy:a});let d=i?.then;if(typeof d=="function"){let u,c=Wpe(d,i,l=>{if(l!=null)throw new Lpe("nully","body",l)},l=>{q1(u,l)});return u=new ov({objectMode:!0,readable:!1,write:o,final(l){s(async()=>{try{await c,Kq.nextTick(l,null)}catch(m){Kq.nextTick(l,m)}})},destroy:a})}throw new Lpe("Iterable, AsyncIterable or AsyncFunction",r,i)}if(WHe(e))return t(e.arrayBuffer());if(Npe(e))return Fpe(ov,e,{objectMode:!0,writable:!1});if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?jpe(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?Upe(e?.writable)?e?.writable:t(e.writable):void 0;return mP({readable:i,writable:o})}let n=e?.then;if(typeof n=="function"){let i;return Wpe(n,e,o=>{o!=null&&i.push(o),i.push(null)},o=>{q1(i,o)}),i=new ov({objectMode:!0,writable:!1,read(){}})}throw new KHe(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function HHe(t){let{promise:e,resolve:r}=Kpe(),n=new VHe,i=n.signal;return{value:t(async function*(){for(;;){let s=e;e=null;let{chunk:a,done:d,cb:u}=await s;if(Kq.nextTick(u),d)return;if(i.aborted)throw new Vpe(void 0,{cause:i.reason});({promise:e,resolve:r}=Kpe()),yield a}}(),{signal:i}),write(s,a,d){let u=r;r=null,u({chunk:s,done:!1,cb:d})},final(s){let a=r;r=null,a({done:!0,cb:s})},destroy(s,a){n.abort(),a(s)}}}function mP(t){let e=t.readable&&typeof t.readable.read!="function"?zHe.wrap(t.readable):t.readable,r=t.writable,n=!!jHe(e),i=!!UHe(r),o,s,a,d,u;function c(l){let m=d;d=null,m?m(l):l&&u.destroy(l)}return u=new ov({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:i}),i&&(qpe(r,l=>{i=!1,l&&q1(e,l),c(l)}),u._write=function(l,m,p){r.write(l,m)?p():o=p},u._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&&(qpe(e,l=>{n=!1,l&&q1(e,l),c(l)}),e.on("readable",function(){if(a){let l=a;a=null,l()}}),e.on("end",function(){u.push(null)}),u._read=function(){for(;;){let l=e.read();if(l===null){a=u._read;return}if(!u.push(l))return}}),u._destroy=function(l,m){!l&&d!==null&&(l=new Vpe),a=null,o=null,s=null,d===null?m(l):(d=m,q1(r,l),q1(e,l))},u}});var af=V((s4t,Zpe)=>{"use strict";h();var{ObjectDefineProperties:GHe,ObjectGetOwnPropertyDescriptor:Nh,ObjectKeys:JHe,ObjectSetPrototypeOf:Jpe}=Ki();Zpe.exports=Nu;var Wq=G6(),Rd=Lq();Jpe(Nu.prototype,Wq.prototype);Jpe(Nu,Wq);{let t=JHe(Rd.prototype);for(let e=0;e{"use strict";h();var{ObjectSetPrototypeOf:Xpe,Symbol:YHe}=Ki();Qpe.exports=jh;var{ERR_METHOD_NOT_IMPLEMENTED:ZHe}=ha().codes,Hq=af(),{getHighWaterMark:XHe}=cP();Xpe(jh.prototype,Hq.prototype);Xpe(jh,Hq);var X6=YHe("kCallback");function jh(t){if(!(this instanceof jh))return new jh(t);let e=t?XHe(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),Hq.call(this,t),this._readableState.sync=!1,this[X6]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",QHe)}function Vq(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 QHe(){this._final!==Vq&&Vq.call(this)}jh.prototype._final=Vq;jh.prototype._transform=function(t,e,r){throw new ZHe("_transform()")};jh.prototype._write=function(t,e,r){let n=this._readableState,i=this._writableState,o=n.length;this._transform(t,e,(s,a)=>{if(s){r(s);return}a!=null&&this.push(a),i.ended||o===n.length||n.length{"use strict";h();var{ObjectSetPrototypeOf:eme}=Ki();tme.exports=L1;var Jq=Gq();eme(L1.prototype,Jq.prototype);eme(L1,Jq);function L1(t){if(!(this instanceof L1))return new L1(t);Jq.call(this,t)}L1.prototype._transform=function(t,e,r){r(null,t)}});var bP=V((f4t,sme)=>{h();var Q6=ys(),{ArrayIsArray:eGe,Promise:tGe,SymbolAsyncIterator:rGe}=Ki(),vP=$h(),{once:nGe}=rf(),iGe=rv(),rme=af(),{aggregateTwoErrors:oGe,codes:{ERR_INVALID_ARG_TYPE:iL,ERR_INVALID_RETURN_VALUE:Zq,ERR_MISSING_ARGS:sGe,ERR_STREAM_DESTROYED:aGe,ERR_STREAM_PREMATURE_CLOSE:cGe},AbortError:dGe}=ha(),{validateFunction:uGe,validateAbortSignal:lGe}=V6(),{isIterable:sv,isReadable:Xq,isReadableNodeStream:gP,isNodeStream:nme,isTransformStream:K1,isWebStream:fGe,isReadableStream:Qq,isReadableEnded:hGe}=of(),pGe=globalThis.AbortController||ah().AbortController,eL,tL;function ime(t,e,r){let n=!1;t.on("close",()=>{n=!0});let i=vP(t,{readable:e,writable:r},o=>{n=!o});return{destroy:o=>{n||(n=!0,iGe.destroyer(t,o||new aGe("pipe")))},cleanup:i}}function mGe(t){return uGe(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function rL(t){if(sv(t))return t;if(gP(t))return yGe(t);throw new iL("val",["Readable","Iterable","AsyncIterable"],t)}async function*yGe(t){tL||(tL=G6()),yield*tL.prototype[rGe].call(t)}async function yP(t,e,r,{end:n}){let i,o=null,s=u=>{if(u&&(i=u),o){let c=o;o=null,c()}},a=()=>new tGe((u,c)=>{i?c(i):o=()=>{i?c(i):u()}});e.on("drain",s);let d=vP(e,{readable:!1},s);try{e.writableNeedDrain&&await a();for await(let u of t)e.write(u)||await a();n&&e.end(),await a(),r()}catch(u){r(i!==u?oGe(i,u):u)}finally{d(),e.off("drain",s)}}async function nL(t,e,r,{end:n}){K1(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 gGe(...t){return ome(t,nGe(mGe(t)))}function ome(t,e,r){if(t.length===1&&eGe(t[0])&&(t=t[0]),t.length<2)throw new sGe("streams");let n=new pGe,i=n.signal,o=r?.signal,s=[];lGe(o,"options.signal");function a(){p(new dGe)}o?.addEventListener("abort",a);let d,u,c=[],l=0;function m(P){p(P,--l===0)}function p(P,I){if(P&&(!d||d.code==="ERR_STREAM_PREMATURE_CLOSE")&&(d=P),!(!d&&!I)){for(;c.length;)c.shift()(d);o?.removeEventListener("abort",a),n.abort(),I&&(d||s.forEach($=>$()),Q6.nextTick(e,d,u))}}let g;for(let P=0;P0,K=$||r?.end!==!1,F=P===t.length-1;if(nme(I)){let U=function(W){W&&W.name!=="AbortError"&&W.code!=="ERR_STREAM_PREMATURE_CLOSE"&&m(W)};var A=U;if(K){let{destroy:W,cleanup:L}=ime(I,$,N);c.push(W),Xq(I)&&F&&s.push(L)}I.on("error",U),Xq(I)&&F&&s.push(()=>{I.removeListener("error",U)})}if(P===0)if(typeof I=="function"){if(g=I({signal:i}),!sv(g))throw new Zq("Iterable, AsyncIterable or Stream","source",g)}else sv(I)||gP(I)||K1(I)?g=I:g=rme.from(I);else if(typeof I=="function"){if(K1(g)){var v;g=rL((v=g)===null||v===void 0?void 0:v.readable)}else g=rL(g);if(g=I(g,{signal:i}),$){if(!sv(g,!0))throw new Zq("AsyncIterable",`transform[${P-1}]`,g)}else{var E;eL||(eL=Yq());let U=new eL({objectMode:!0}),W=(E=g)===null||E===void 0?void 0:E.then;if(typeof W=="function")l++,W.call(g,S=>{u=S,S!=null&&U.write(S),K&&U.end(),Q6.nextTick(m)},S=>{U.destroy(S),Q6.nextTick(m,S)});else if(sv(g,!0))l++,yP(g,U,m,{end:K});else if(Qq(g)||K1(g)){let S=g.readable||g;l++,yP(S,U,m,{end:K})}else throw new Zq("AsyncIterable or Promise","destination",g);g=U;let{destroy:L,cleanup:T}=ime(g,!1,!0);c.push(L),F&&s.push(T)}}else if(nme(I)){if(gP(g)){l+=2;let U=vGe(g,I,m,{end:K});Xq(I)&&F&&s.push(U)}else if(K1(g)||Qq(g)){let U=g.readable||g;l++,yP(U,I,m,{end:K})}else if(sv(g))l++,yP(g,I,m,{end:K});else throw new iL("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],g);g=I}else if(fGe(I)){if(gP(g))l++,nL(rL(g),I,m,{end:K});else if(Qq(g)||sv(g))l++,nL(g,I,m,{end:K});else if(K1(g))l++,nL(g.readable,I,m,{end:K});else throw new iL("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],g);g=I}else g=rme.from(I)}return(i!=null&&i.aborted||o!=null&&o.aborted)&&Q6.nextTick(a),g}function vGe(t,e,r,{end:n}){let i=!1;if(e.on("close",()=>{i||r(new cGe)}),t.pipe(e,{end:!1}),n){let s=function(){i=!0,e.end()};var o=s;hGe(t)?Q6.nextTick(s):t.once("end",s)}else r();return vP(t,{readable:!0,writable:!1},s=>{let a=t._readableState;s&&s.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted?t.once("end",r).once("error",r):r(s)}),vP(e,{readable:!1,writable:!0},r)}sme.exports={pipelineImpl:ome,pipeline:gGe}});var sL=V((p4t,fme)=>{"use strict";h();var{pipeline:bGe}=bP(),wP=af(),{destroyer:wGe}=rv(),{isNodeStream:_P,isReadable:ame,isWritable:cme,isWebStream:oL,isTransformStream:av,isWritableStream:dme,isReadableStream:ume}=of(),{AbortError:_Ge,codes:{ERR_INVALID_ARG_VALUE:lme,ERR_MISSING_ARGS:xGe}}=ha(),EGe=$h();fme.exports=function(...e){if(e.length===0)throw new xGe("streams");if(e.length===1)return wP.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=wP.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=wP.from(e[p])}for(let p=0;p0&&!(cme(e[p])||dme(e[p])||av(e[p])))throw new lme(`streams[${p}]`,r[p],"must be writable")}let n,i,o,s,a;function d(p){let g=s;s=null,g?g(p):p?a.destroy(p):!m&&!l&&a.destroy()}let u=e[0],c=bGe(e,d),l=!!(cme(u)||dme(u)||av(u)),m=!!(ame(c)||ume(c)||av(c));if(a=new wP({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(c!=null&&c.writableObjectMode),writable:l,readable:m}),l){if(_P(u))a._write=function(g,v,E){u.write(g,v)?E():n=E},a._final=function(g){u.end(),i=g},u.on("drain",function(){if(n){let g=n;n=null,g()}});else if(oL(u)){let v=(av(u)?u.writable:u).getWriter();a._write=async function(E,A,P){try{await v.ready,v.write(E).catch(()=>{}),P()}catch(I){P(I)}},a._final=async function(E){try{await v.ready,v.close().catch(()=>{}),i=E}catch(A){E(A)}}}let p=av(c)?c.readable:c;EGe(p,()=>{if(i){let g=i;i=null,g()}})}if(m){if(_P(c))c.on("readable",function(){if(o){let p=o;o=null,p()}}),c.on("end",function(){a.push(null)}),a._read=function(){for(;;){let p=c.read();if(p===null){o=a._read;return}if(!a.push(p))return}};else if(oL(c)){let g=(av(c)?c.readable:c).getReader();a._read=async function(){for(;;)try{let{value:v,done:E}=await g.read();if(!a.push(v))return;if(E){a.push(null);return}}catch{return}}}}return a._destroy=function(p,g){!p&&s!==null&&(p=new _Ge),o=null,n=null,i=null,s===null?g(p):(s=g,_P(c)&&wGe(c,p))},a}});var wme=V((y4t,dL)=>{"use strict";h();var yme=globalThis.AbortController||ah().AbortController,{codes:{ERR_INVALID_ARG_VALUE:SGe,ERR_INVALID_ARG_TYPE:e3,ERR_MISSING_ARGS:AGe,ERR_OUT_OF_RANGE:TGe},AbortError:cf}=ha(),{validateAbortSignal:cv,validateInteger:IGe,validateObject:dv}=V6(),PGe=Ki().Symbol("kWeak"),{finished:kGe}=$h(),RGe=sL(),{addAbortSignalNoValidate:DGe}=H6(),{isWritable:BGe,isNodeStream:MGe}=of(),{ArrayPrototypePush:CGe,MathFloor:OGe,Number:$Ge,NumberIsNaN:NGe,Promise:hme,PromiseReject:pme,PromisePrototypeThen:jGe,Symbol:gme}=Ki(),xP=gme("kEmpty"),mme=gme("kEof");function UGe(t,e){if(e!=null&&dv(e,"options"),e?.signal!=null&&cv(e.signal,"options.signal"),MGe(t)&&!BGe(t))throw new SGe("stream",t,"must be writable");let r=RGe(this,t);return e!=null&&e.signal&&DGe(e.signal,r),r}function EP(t,e){if(typeof t!="function")throw new e3("fn",["Function","AsyncFunction"],t);e!=null&&dv(e,"options"),e?.signal!=null&&cv(e.signal,"options.signal");let r=1;return e?.concurrency!=null&&(r=OGe(e.concurrency)),IGe(r,"concurrency",1),(async function*(){var i,o;let s=new yme,a=this,d=[],u=s.signal,c={signal:u},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 m,p,g=!1;function v(){g=!0}async function E(){try{for await(let I of a){var A;if(g)return;if(u.aborted)throw new cf;try{I=t(I,c)}catch($){I=pme($)}I!==xP&&(typeof((A=I)===null||A===void 0?void 0:A.catch)=="function"&&I.catch(v),d.push(I),m&&(m(),m=null),!g&&d.length&&d.length>=r&&await new hme($=>{p=$}))}d.push(mme)}catch(I){let $=pme(I);jGe($,void 0,v),d.push($)}finally{var P;g=!0,m&&(m(),m=null),e==null||(P=e.signal)===null||P===void 0||P.removeEventListener("abort",l)}}E();try{for(;;){for(;d.length>0;){let A=await d[0];if(A===mme)return;if(u.aborted)throw new cf;A!==xP&&(yield A),d.shift(),p&&(p(),p=null)}await new hme(A=>{m=A})}}finally{s.abort(),g=!0,p&&(p(),p=null)}}).call(this)}function qGe(t=void 0){return t!=null&&dv(t,"options"),t?.signal!=null&&cv(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 cf({cause:t.signal.reason});yield[r++,i]}}).call(this)}async function vme(t,e=void 0){for await(let r of cL.call(this,t,e))return!0;return!1}async function LGe(t,e=void 0){if(typeof t!="function")throw new e3("fn",["Function","AsyncFunction"],t);return!await vme.call(this,async(...r)=>!await t(...r),e)}async function KGe(t,e){for await(let r of cL.call(this,t,e))return r}async function FGe(t,e){if(typeof t!="function")throw new e3("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),xP}for await(let n of EP.call(this,r,e));}function cL(t,e){if(typeof t!="function")throw new e3("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:xP}return EP.call(this,r,e)}var aL=class extends AGe{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function zGe(t,e,r){var n;if(typeof t!="function")throw new e3("reducer",["Function","AsyncFunction"],t);r!=null&&dv(r,"options"),r?.signal!=null&&cv(r.signal,"options.signal");let i=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let u=new cf(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await kGe(this.destroy(u)),u}let o=new yme,s=o.signal;if(r!=null&&r.signal){let u={once:!0,[PGe]:this};r.signal.addEventListener("abort",()=>o.abort(),u)}let a=!1;try{for await(let u of this){var d;if(a=!0,r!=null&&(d=r.signal)!==null&&d!==void 0&&d.aborted)throw new cf;i?e=await t(e,u,{signal:s}):(e=u,i=!0)}if(!a&&!i)throw new aL}finally{o.abort()}return e}async function WGe(t){t!=null&&dv(t,"options"),t?.signal!=null&&cv(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 cf(void 0,{cause:t.signal.reason});CGe(e,n)}return e}function VGe(t,e){let r=EP.call(this,t,e);return(async function*(){for await(let i of r)yield*i}).call(this)}function bme(t){if(t=$Ge(t),NGe(t))return 0;if(t<0)throw new TGe("number",">= 0",t);return t}function HGe(t,e=void 0){return e!=null&&dv(e,"options"),e?.signal!=null&&cv(e.signal,"options.signal"),t=bme(t),(async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new cf;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new cf;t--<=0&&(yield o)}}).call(this)}function GGe(t,e=void 0){return e!=null&&dv(e,"options"),e?.signal!=null&&cv(e.signal,"options.signal"),t=bme(t),(async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new cf;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new cf;if(t-- >0)yield o;else return}}).call(this)}dL.exports.streamReturningOperators={asIndexedPairs:qGe,drop:HGe,filter:cL,flatMap:VGe,map:EP,take:GGe,compose:UGe};dL.exports.promiseReturningOperators={every:LGe,forEach:FGe,reduce:zGe,toArray:WGe,some:vme,find:KGe}});var uL=V((v4t,_me)=>{"use strict";h();var{ArrayPrototypePop:JGe,Promise:YGe}=Ki(),{isIterable:ZGe,isNodeStream:XGe,isWebStream:QGe}=of(),{pipelineImpl:eJe}=bP(),{finished:tJe}=$h();lL();function rJe(...t){return new YGe((e,r)=>{let n,i,o=t[t.length-1];if(o&&typeof o=="object"&&!XGe(o)&&!ZGe(o)&&!QGe(o)){let s=JGe(t);n=s.signal,i=s.end}eJe(t,(s,a)=>{s?r(s):e(a)},{signal:n,end:i})})}_me.exports={finished:tJe,pipeline:rJe}});var lL=V((w4t,Rme)=>{h();var{Buffer:nJe}=Fn(),{ObjectDefineProperty:Uh,ObjectKeys:Sme,ReflectApply:Ame}=Ki(),{promisify:{custom:Tme}}=rf(),{streamReturningOperators:xme,promiseReturningOperators:Eme}=wme(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:Ime}}=ha(),iJe=sL(),{pipeline:Pme}=bP(),{destroyer:oJe}=rv(),kme=$h(),fL=uL(),hL=of(),Di=Rme.exports=oP().Stream;Di.isDisturbed=hL.isDisturbed;Di.isErrored=hL.isErrored;Di.isReadable=hL.isReadable;Di.Readable=G6();for(let t of Sme(xme)){let r=function(...n){if(new.target)throw Ime();return Di.Readable.from(Ame(e,this,n))};pL=r;let e=xme[t];Uh(r,"name",{__proto__:null,value:e.name}),Uh(r,"length",{__proto__:null,value:e.length}),Uh(Di.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var pL;for(let t of Sme(Eme)){let r=function(...i){if(new.target)throw Ime();return Ame(e,this,i)};pL=r;let e=Eme[t];Uh(r,"name",{__proto__:null,value:e.name}),Uh(r,"length",{__proto__:null,value:e.length}),Uh(Di.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var pL;Di.Writable=Lq();Di.Duplex=af();Di.Transform=Gq();Di.PassThrough=Yq();Di.pipeline=Pme;var{addAbortSignal:sJe}=H6();Di.addAbortSignal=sJe;Di.finished=kme;Di.destroy=oJe;Di.compose=iJe;Uh(Di,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return fL}});Uh(Pme,Tme,{__proto__:null,enumerable:!0,get(){return fL.pipeline}});Uh(kme,Tme,{__proto__:null,enumerable:!0,get(){return fL.finished}});Di.Stream=Di;Di._isUint8Array=function(e){return e instanceof Uint8Array};Di._uint8ArrayToBuffer=function(e){return nJe.from(e.buffer,e.byteOffset,e.byteLength)}});var mL=V((x4t,Bi)=>{"use strict";h();var io=lL(),aJe=uL(),cJe=io.Readable.destroy;Bi.exports=io.Readable;Bi.exports._uint8ArrayToBuffer=io._uint8ArrayToBuffer;Bi.exports._isUint8Array=io._isUint8Array;Bi.exports.isDisturbed=io.isDisturbed;Bi.exports.isErrored=io.isErrored;Bi.exports.isReadable=io.isReadable;Bi.exports.Readable=io.Readable;Bi.exports.Writable=io.Writable;Bi.exports.Duplex=io.Duplex;Bi.exports.Transform=io.Transform;Bi.exports.PassThrough=io.PassThrough;Bi.exports.addAbortSignal=io.addAbortSignal;Bi.exports.finished=io.finished;Bi.exports.destroy=io.destroy;Bi.exports.destroy=cJe;Bi.exports.pipeline=io.pipeline;Bi.exports.compose=io.compose;Object.defineProperty(io,"promises",{configurable:!0,enumerable:!0,get(){return aJe}});Bi.exports.Stream=io.Stream;Bi.exports.default=Bi.exports});var Dme,dJe,t3,ko,Bme=le(()=>{h();Dme=Kt(mL(),1);cq();SI();dJe=Kt(mL(),1),t3=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},ko=class t{static consumeToArrayBuffer({readable:e}){return t3(this,void 0,void 0,function*(){return yield de.asyncIterable(e).toArrayBufferAsync()})}static consumeToBlob({readable:e}){return t3(this,void 0,void 0,function*(){return yield de.asyncIterable(e).toBlobAsync()})}static consumeToBytes({readable:e}){return t3(this,void 0,void 0,function*(){return yield de.asyncIterable(e).toUint8ArrayAsync()})}static consumeToJson({readable:e}){return t3(this,void 0,void 0,function*(){return yield de.asyncIterable(e).toObjectAsync()})}static consumeToText({readable:e}){return t3(this,void 0,void 0,function*(){return yield de.asyncIterable(e).toStringAsync()})}static fromWebReadable({readableStream:e,readableOptions:r}){if(!Qg.isReadableStream(e))throw new TypeError("NodeStream.fromWebReadable: 'readableStream' is not a Web ReadableStream.");let n=e.getReader(),i=!1,o=new Dme.Readable(Object.assign(Object.assign({},r),{read:function(){n.read().then(({done:s,value:a})=>{if(s)this.push(null);else if(!this.push(a))return}).catch(s=>{this.destroy(s)})},destroy:function(s,a){function d(){a(s)}if(!i){n.cancel(s).then(d).catch(d);return}d()}}));return n.closed.then(()=>{i=!0}).catch(s=>{i=!0,o.destroy(s)}),o}static isDestroyed({stream:e}){if(!t.isStream(e))throw new TypeError("NodeStream.isDestroyed: 'stream' is not a Node stream.");let r="_writableState"in e?e._writableState:void 0,n=e._readableState,i=r||n;return!!(e.destroyed||i.destroyed)}static isReadable({readable:e}){return t.isReadableStream(e)?e.readable&&typeof e._readableState.ended=="boolean"&&!e._readableState.ended&&typeof e._readableState.endEmitted=="boolean"&&!e._readableState.endEmitted&&!e.destroyed&&!e.isPaused():!1}static isReadableStream(e){return typeof e=="object"&&e!==null&&"pipe"in e&&typeof e.pipe=="function"&&"on"in e&&typeof e.on=="function"&&!("_writableState"in e)&&"_readableState"in e}static isStream(e){return typeof e=="object"&&e!==null&&("_readableState"in e||"_writableState"in e)}static toWebReadable({readable:e}){if(!t.isReadableStream(e))throw new TypeError("NodeStream.toWebReadable: 'readable' is not a Node Readable stream.");if(t.isDestroyed({stream:e})){let r=new ReadableStream;return r.cancel(),r}return new ReadableStream({start(r){e.on("data",n=>{r.enqueue(n)}),e.on("end",()=>{r.close()}),e.on("error",n=>{r.error(n)})},cancel(){e.destroy()}})}}});var Tr=le(()=>{h();Jle();SI();Qle();efe();nhe();cq();Bme();yU()});var uJe,F1,SP=le(()=>{h();_p();uJe=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},F1=class{static digest({data:e}){return uJe(this,void 0,void 0,function*(){return ws(e)})}}});var ii,uv=le(()=>{h();ii=class{}});var lJe,ny,yL=le(()=>{h();SP();uv();lJe=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},ny=class extends ii{digest({algorithm:e,data:r}){return lJe(this,void 0,void 0,function*(){switch(e){case"SHA-256":return yield F1.digest({data:r})}})}}});function hJe(t){let e=Ome,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),d=BigInt(88),u=t*t*t%e,c=u*u*t%e,l=On(c,r,e)*c%e,m=On(l,r,e)*c%e,p=On(m,gL,e)*u%e,g=On(p,i,e)*p%e,v=On(g,o,e)*g%e,E=On(v,a,e)*v%e,A=On(E,d,e)*E%e,P=On(A,a,e)*v%e,I=On(P,r,e)*c%e,$=On(I,s,e)*g%e,N=On($,n,e)*u%e,K=On(N,gL,e);if(!vL.eql(vL.sqr(K),t))throw new Error("Cannot find square root");return K}var Ome,Mme,fJe,gL,Cme,vL,Ka,Y4t,Z4t,$me=le(()=>{h();_p();gp();x9();Ome=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Mme=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),fJe=BigInt(1),gL=BigInt(2),Cme=(t,e)=>(t+e/gL)/e;vL=nb(Ome,void 0,void 0,{sqrt:hJe}),Ka=n5({a:BigInt(0),b:BigInt(7),Fp:vL,n:Mme,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=Mme,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-fJe*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),a=Cme(o*t,e),d=Cme(-n*t,e),u=en(t-a*r-d*i,e),c=en(-a*n-d*o,e),l=u>s,m=c>s;if(l&&(u=e-u),m&&(c=e-c),u>s||c>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:u,k2neg:m,k2:c}}}},ws),Y4t=BigInt(0),Z4t=Ka.ProjectivePoint});function Nme(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 bL=le(()=>{h()});function it({jwk:t}){return pJe(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}`);S1(r);let n=Nme(r),i=de.string(n).toUint8Array(),o=yield F1.digest({data:i});return de.uint8Array(o).toBase64Url()})}function Fa(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 iy(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 fv(t){return!(!t||typeof t!="object"||!("kty"in t&&"k"in t)||t.kty!=="oct"||typeof t.k!="string")}function za(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 oy(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 z1(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 pJe,lv,kc=le(()=>{h();Tr();bL();SP();pJe=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},lv="urn:jwk:"});var us,mJe,Ir,wL=le(()=>{h();Tr();_p();$me();il();kc();us=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},mJe=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{h();Tr();_p();S9();il();kc();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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},yJe=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{h();wL();_L();uv();kc();r3=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},sy=class extends ii{computePublicKey({key:e}){return r3(this,void 0,void 0,function*(){if(!Fa(e))throw new TypeError("Invalid key provided. Must be an elliptic curve (EC) private key.");switch(e.crv){case"secp256k1":{let r=yield Ir.computePublicKey({key:e});return r.alg="ES256K",r}case"P-256":{let r=yield Nr.computePublicKey({key:e});return r.alg="ES256",r}default:throw new Error(`Unsupported curve: ${e.crv}`)}})}generateKey({algorithm:e}){return r3(this,void 0,void 0,function*(){switch(e){case"ES256K":case"secp256k1":{let r=yield Ir.generateKey();return r.alg="ES256K",r}case"ES256":case"secp256r1":{let r=yield Nr.generateKey();return r.alg="ES256",r}}})}getPublicKey({key:e}){return r3(this,void 0,void 0,function*(){if(!Fa(e))throw new TypeError("Invalid key provided. Must be an elliptic curve (EC) private key.");switch(e.crv){case"secp256k1":{let r=yield Ir.getPublicKey({key:e});return r.alg="ES256K",r}case"P-256":{let r=yield Nr.getPublicKey({key:e});return r.alg="ES256",r}default:throw new Error(`Unsupported curve: ${e.crv}`)}})}sign({key:e,data:r}){return r3(this,void 0,void 0,function*(){if(!Fa(e))throw new TypeError("Invalid key provided. Must be an elliptic curve (EC) private key.");switch(e.crv){case"secp256k1":return yield Ir.sign({key:e,data:r});case"P-256":return yield Nr.sign({key:e,data:r});default:throw new Error(`Unsupported curve: ${e.crv}`)}})}verify({key:e,signature:r,data:n}){return r3(this,void 0,void 0,function*(){if(!iy(e))throw new TypeError("Invalid key provided. Must be an elliptic curve (EC) public key.");switch(e.crv){case"secp256k1":return yield Ir.verify({key:e,signature:r,data:n});case"P-256":return yield Nr.verify({key:e,signature:r,data:n});default:throw new Error(`Unsupported curve: ${e.crv}`)}})}}});function jme(t,e=!1){return e?{h:Number(t&AP),l:Number(t>>EL&AP)}:{h:Number(t>>EL&AP)|0,l:Number(t&AP)|0}}function gJe(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var AP,EL,vJe,bJe,wJe,_Je,xJe,EJe,SJe,AJe,TJe,IJe,PJe,kJe,RJe,BJe,MJe,CJe,OJe,$Je,NJe,jJe,sr,Ume=le(()=>{h();AP=BigInt(4294967295),EL=BigInt(32);vJe=(t,e)=>BigInt(t>>>0)<>>0),bJe=(t,e,r)=>t>>>r,wJe=(t,e,r)=>t<<32-r|e>>>r,_Je=(t,e,r)=>t>>>r|e<<32-r,xJe=(t,e,r)=>t<<32-r|e>>>r,EJe=(t,e,r)=>t<<64-r|e>>>r-32,SJe=(t,e,r)=>t>>>r-32|e<<64-r,AJe=(t,e)=>e,TJe=(t,e)=>t,IJe=(t,e,r)=>t<>>32-r,PJe=(t,e,r)=>e<>>32-r,kJe=(t,e,r)=>e<>>64-r,RJe=(t,e,r)=>t<>>64-r;BJe=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),MJe=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,CJe=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),OJe=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,$Je=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),NJe=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0,jJe={fromBig:jme,split:gJe,toBig:vJe,shrSH:bJe,shrSL:wJe,rotrSH:_Je,rotrSL:xJe,rotrBH:EJe,rotrBL:SJe,rotr32H:AJe,rotr32L:TJe,rotlSH:IJe,rotlSL:PJe,rotlBH:kJe,rotlBL:RJe,add:DJe,add3L:BJe,add3H:MJe,add4L:CJe,add4H:OJe,add5H:NJe,add5L:$Je},sr=jJe});var UJe,qJe,ay,cy,SL,dy,TP=le(()=>{h();i5();Ume();Wc();[UJe,qJe]=sr.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))),ay=new Uint32Array(80),cy=new Uint32Array(80),SL=class extends vp{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:a,Dl:d,Eh:u,El:c,Fh:l,Fl:m,Gh:p,Gl:g,Hh:v,Hl:E}=this;return[e,r,n,i,o,s,a,d,u,c,l,m,p,g,v,E]}set(e,r,n,i,o,s,a,d,u,c,l,m,p,g,v,E){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=a|0,this.Dl=d|0,this.Eh=u|0,this.El=c|0,this.Fh=l|0,this.Fl=m|0,this.Gh=p|0,this.Gl=g|0,this.Hh=v|0,this.Hl=E|0}process(e,r){for(let I=0;I<16;I++,r+=4)ay[I]=e.getUint32(r),cy[I]=e.getUint32(r+=4);for(let I=16;I<80;I++){let $=ay[I-15]|0,N=cy[I-15]|0,K=sr.rotrSH($,N,1)^sr.rotrSH($,N,8)^sr.shrSH($,N,7),F=sr.rotrSL($,N,1)^sr.rotrSL($,N,8)^sr.shrSL($,N,7),U=ay[I-2]|0,W=cy[I-2]|0,L=sr.rotrSH(U,W,19)^sr.rotrBH(U,W,61)^sr.shrSH(U,W,6),T=sr.rotrSL(U,W,19)^sr.rotrBL(U,W,61)^sr.shrSL(U,W,6),S=sr.add4L(F,T,cy[I-7],cy[I-16]),k=sr.add4H(S,K,L,ay[I-7],ay[I-16]);ay[I]=k|0,cy[I]=S|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:d,Dh:u,Dl:c,Eh:l,El:m,Fh:p,Fl:g,Gh:v,Gl:E,Hh:A,Hl:P}=this;for(let I=0;I<80;I++){let $=sr.rotrSH(l,m,14)^sr.rotrSH(l,m,18)^sr.rotrBH(l,m,41),N=sr.rotrSL(l,m,14)^sr.rotrSL(l,m,18)^sr.rotrBL(l,m,41),K=l&p^~l&v,F=m&g^~m&E,U=sr.add5L(P,N,F,qJe[I],cy[I]),W=sr.add5H(U,A,$,K,UJe[I],ay[I]),L=U|0,T=sr.rotrSH(n,i,28)^sr.rotrBH(n,i,34)^sr.rotrBH(n,i,39),S=sr.rotrSL(n,i,28)^sr.rotrBL(n,i,34)^sr.rotrBL(n,i,39),k=n&o^n&a^o&a,f=i&s^i&d^s&d;A=v|0,P=E|0,v=p|0,E=g|0,p=l|0,g=m|0,{h:l,l:m}=sr.add(u|0,c|0,W|0,L|0),u=a|0,c=d|0,a=o|0,d=s|0,o=n|0,s=i|0;let y=sr.add3L(L,S,f);n=sr.add3H(y,W,T,k),i=y|0}({h:n,l:i}=sr.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=sr.add(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:d}=sr.add(this.Ch|0,this.Cl|0,a|0,d|0),{h:u,l:c}=sr.add(this.Dh|0,this.Dl|0,u|0,c|0),{h:l,l:m}=sr.add(this.Eh|0,this.El|0,l|0,m|0),{h:p,l:g}=sr.add(this.Fh|0,this.Fl|0,p|0,g|0),{h:v,l:E}=sr.add(this.Gh|0,this.Gl|0,v|0,E|0),{h:A,l:P}=sr.add(this.Hh|0,this.Hl|0,A|0,P|0),this.set(n,i,o,s,a,d,u,c,l,m,p,g,v,E,A,P)}roundClean(){ay.fill(0),cy.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)}},dy=rb(()=>new SL)});function FJe(t){let e=s_(t);return Vc(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function PP(t){let e=FJe(t),{Fp:r,n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:d}=e,u=IP<{try{return{isValid:!0,value:r.sqrt(x*r.inv(b))}}catch{return{isValid:!1,value:ju}}}),m=e.adjustScalarBytes||(x=>x),p=e.domain||((x,b,B)=>{if(b.length||B)throw new Error("Contexts/pre-hash are not supported");return x}),g=x=>typeof x=="bigint"&&jug(x)&&g(b)&&xx===ju||v(x,u);function A(x,b){if(v(x,b))return x;throw new Error(`Expected valid scalar < ${b}, got ${typeof x} ${x}`)}function P(x){return x===ju?x:A(x,n)}let I=new Map;function $(x){if(!(x instanceof N))throw new Error("ExtendedPoint expected")}class N{constructor(b,B,q,M){if(this.ex=b,this.ey=B,this.ez=q,this.et=M,!E(b))throw new Error("x required");if(!E(B))throw new Error("y required");if(!E(q))throw new Error("z required");if(!E(M))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(b){if(b instanceof N)throw new Error("extended point not allowed");let{x:B,y:q}=b||{};if(!E(B)||!E(q))throw new Error("invalid affine point");return new N(B,q,Rc,c(B*q))}static normalizeZ(b){let B=r.invertBatch(b.map(q=>q.ez));return b.map((q,M)=>q.toAffine(B[M])).map(N.fromAffine)}_setWindowSize(b){this._WINDOW_SIZE=b,I.delete(this)}assertValidity(){let{a:b,d:B}=e;if(this.is0())throw new Error("bad point: ZERO");let{ex:q,ey:M,ez:j,et:J}=this,Z=c(q*q),G=c(M*M),H=c(j*j),X=c(H*H),ee=c(Z*b),ue=c(H*c(ee+G)),ae=c(X+c(B*c(Z*G)));if(ue!==ae)throw new Error("bad point: equation left != right (1)");let ce=c(q*M),me=c(j*J);if(ce!==me)throw new Error("bad point: equation left != right (2)")}equals(b){$(b);let{ex:B,ey:q,ez:M}=this,{ex:j,ey:J,ez:Z}=b,G=c(B*Z),H=c(j*M),X=c(q*Z),ee=c(J*M);return G===H&&X===ee}is0(){return this.equals(N.ZERO)}negate(){return new N(c(-this.ex),this.ey,this.ez,c(-this.et))}double(){let{a:b}=e,{ex:B,ey:q,ez:M}=this,j=c(B*B),J=c(q*q),Z=c(IP*c(M*M)),G=c(b*j),H=B+q,X=c(c(H*H)-j-J),ee=G+J,ue=ee-Z,ae=G-J,ce=c(X*ue),me=c(ee*ae),Ee=c(X*ae),qe=c(ue*ee);return new N(ce,me,qe,Ee)}add(b){$(b);let{a:B,d:q}=e,{ex:M,ey:j,ez:J,et:Z}=this,{ex:G,ey:H,ez:X,et:ee}=b;if(B===BigInt(-1)){let bt=c((j-M)*(H+G)),Te=c((j+M)*(H-G)),De=c(Te-bt);if(De===ju)return this.double();let Dt=c(J*IP*ee),_e=c(Z*IP*X),Se=_e+Dt,Wr=Te+bt,ze=_e-Dt,Ge=c(Se*De),zs=c(Wr*ze),pt=c(Se*ze),Mt=c(De*Wr);return new N(Ge,zs,Mt,pt)}let ue=c(M*G),ae=c(j*H),ce=c(Z*q*ee),me=c(J*X),Ee=c((M+j)*(G+H)-ue-ae),qe=me-ce,fe=me+ce,ve=c(ae-B*ue),we=c(Ee*qe),Ce=c(fe*ve),Pe=c(Ee*ve),Ue=c(qe*fe);return new N(we,Ce,Ue,Pe)}subtract(b){return this.add(b.negate())}wNAF(b){return U.wNAFCached(this,I,b,N.normalizeZ)}multiply(b){let{p:B,f:q}=this.wNAF(A(b,n));return N.normalizeZ([B,q])[0]}multiplyUnsafe(b){let B=P(b);return B===ju?F:this.equals(F)||B===Rc?this:this.equals(K)?this.wNAF(B).p:U.unsafeLadder(this,B)}isSmallOrder(){return this.multiplyUnsafe(d).is0()}isTorsionFree(){return U.unsafeLadder(this,n).is0()}toAffine(b){let{ex:B,ey:q,ez:M}=this,j=this.is0();b==null&&(b=j?LJe:r.inv(M));let J=c(B*b),Z=c(q*b),G=c(M*b);if(j)return{x:ju,y:Rc};if(G!==Rc)throw new Error("invZ was invalid");return{x:J,y:Z}}clearCofactor(){let{h:b}=e;return b===Rc?this:this.multiplyUnsafe(b)}static fromHex(b,B=!1){let{d:q,a:M}=e,j=r.BYTES;b=Cn("pointHex",b,j);let J=b.slice(),Z=b[j-1];J[j-1]=Z&-129;let G=Gd(J);G===ju||(B?A(G,u):A(G,r.ORDER));let H=c(G*G),X=c(H-Rc),ee=c(q*H-M),{isValid:ue,value:ae}=l(X,ee);if(!ue)throw new Error("Point.fromHex: invalid y coordinate");let ce=(ae&Rc)===Rc,me=(Z&128)!==0;if(!B&&ae===ju&&me)throw new Error("Point.fromHex: x=0 and x_0=1");return me!==ce&&(ae=c(-ae)),N.fromAffine({x:ae,y:G})}static fromPrivateKey(b){return T(b).point}toRawBytes(){let{x:b,y:B}=this.toAffine(),q=Bf(B,r.BYTES);return q[q.length-1]|=b&Rc?128:0,q}toHex(){return Rf(this.toRawBytes())}}N.BASE=new N(e.Gx,e.Gy,Rc,c(e.Gx*e.Gy)),N.ZERO=new N(ju,Rc,Rc,ju);let{BASE:K,ZERO:F}=N,U=r5(N,a*8);function W(x){return en(x,n)}function L(x){return W(Gd(x))}function T(x){let b=a;x=Cn("private key",x,b);let B=Cn("hashed private key",o(x),2*b),q=m(B.slice(0,b)),M=B.slice(b,2*b),j=L(q),J=K.multiply(j),Z=J.toRawBytes();return{head:q,prefix:M,scalar:j,point:J,pointBytes:Z}}function S(x){return T(x).pointBytes}function k(x=new Uint8Array,...b){let B=Mf(...b);return L(o(p(B,Cn("context",x),!!i)))}function f(x,b,B={}){x=Cn("message",x),i&&(x=i(x));let{prefix:q,scalar:M,pointBytes:j}=T(b),J=k(B.context,q,x),Z=K.multiply(J).toRawBytes(),G=k(B.context,Z,j,x),H=W(J+G*M);P(H);let X=Mf(Z,Bf(H,r.BYTES));return Cn("result",X,a*2)}let y=KJe;function w(x,b,B,q=y){let{context:M,zip215:j}=q,J=r.BYTES;x=Cn("signature",x,2*J),b=Cn("message",b),i&&(b=i(b));let Z=Gd(x.slice(J,2*J)),G,H,X;try{G=N.fromHex(B,j),H=N.fromHex(x.slice(0,J),j),X=K.multiplyUnsafe(Z)}catch{return!1}if(!j&&G.isSmallOrder())return!1;let ee=k(M,H.toRawBytes(),G.toRawBytes(),b);return H.add(G.multiplyUnsafe(ee)).subtract(X).clearCofactor().equals(N.ZERO)}return K._setWindowSize(8),{CURVE:e,getPublicKey:S,sign:f,verify:w,ExtendedPoint:N,utils:{getExtendedPublicKey:T,randomPrivateKey:()=>s(r.BYTES),precompute(x=8,b=N.BASE){return b._setWindowSize(x),b.multiply(BigInt(3)),b}}}}var ju,Rc,IP,LJe,KJe,qme=le(()=>{h();gp();il();il();_9();ju=BigInt(0),Rc=BigInt(1),IP=BigInt(2),LJe=BigInt(8),KJe={zip215:!0}});function zJe(t){return Vc(t,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...t})}function Lme(t){let e=zJe(t),{P:r}=e,n=I=>en(I,r),i=e.montgomeryBits,o=Math.ceil(i/8),s=e.nByteLength,a=e.adjustScalarBytes||(I=>I),d=e.powPminus2||(I=>y9(I,r-BigInt(2),r));function u(I,$,N){let K=n(I*($-N));return $=n($-K),N=n(N+K),[$,N]}function c(I){if(typeof I=="bigint"&&n3<=I&&I=n3;y--){let w=K>>y&AL;S^=w,k=u(S,U,L),U=k[0],L=k[1],k=u(S,W,T),W=k[0],T=k[1],S=w;let _=U+W,x=n(_*_),b=U-W,B=n(b*b),q=x-B,M=L+T,j=L-T,J=n(j*_),Z=n(M*b),G=J+Z,H=J-Z;L=n(G*G),T=n(F*n(H*H)),U=n(x*B),W=n(q*(x+n(l*q)))}k=u(S,U,L),U=k[0],L=k[1],k=u(S,W,T),W=k[0],T=k[1];let f=d(W);return n(U*f)}function p(I){return Bf(n(I),o)}function g(I){let $=Cn("u coordinate",I,o);return s===32&&($[31]&=127),Gd($)}function v(I){let $=Cn("scalar",I),N=$.length;if(N!==o&&N!==s)throw new Error(`Expected ${o} or ${s} bytes, got ${N}`);return Gd(a($))}function E(I,$){let N=g($),K=v(I),F=m(N,K);if(F===n3)throw new Error("Invalid private or public key received");return p(F)}let A=p(e.Gu);function P(I){return E(I,A)}return{scalarMult:E,scalarMultBase:P,getSharedSecret:(I,$)=>E(I,$),getPublicKey:I=>P(I),utils:{randomPrivateKey:()=>e.randomBytes(e.nByteLength)},GuBytes:A}}var n3,AL,Kme=le(()=>{h();gp();il();n3=BigInt(0),AL=BigInt(1)});function Vme(t){let e=i3,n=t*t%e*t%e,i=On(n,TL,e)*n%e,o=On(i,WJe,e)*t%e,s=On(o,VJe,e)*o%e,a=On(s,zme,e)*s%e,d=On(a,HJe,e)*a%e,u=On(d,GJe,e)*d%e,c=On(u,Wme,e)*u%e,l=On(c,Wme,e)*u%e,m=On(l,zme,e)*s%e;return{pow_p_5_8:On(m,TL,e)*t%e,b2:n}}function Hme(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function JJe(t,e){let r=i3,n=en(e*e*e,r),i=en(n*n*e,r),o=Vme(t*i).pow_p_5_8,s=en(t*n*o,r),a=en(e*s*s,r),d=s,u=en(s*Fme,r),c=a===t,l=a===en(-t,r),m=a===en(-t*Fme,r);return c&&(s=d),(l||m)&&(s=u),mW(s,r)&&(s=en(-s,r)),{isValid:c||l,value:s}}function Gme(t,e,r){if(e.length>255)throw new Error("Context is too big");return Wy(i_("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,e.length]),e,t)}function Jme(t){let{y:e}=Bd.ExtendedPoint.fromHex(t),r=BigInt(1);return Dd.toBytes(Dd.create((r+e)*Dd.inv(r-e)))}function Yme(t){let e=o3.hash(t.subarray(0,32));return o3.adjustScalarBytes(e).subarray(0,32)}var i3,Fme,GAt,WJe,TL,VJe,zme,HJe,GJe,Wme,Dd,o3,Bd,JAt,YAt,hv,YJe,ZAt,XAt,QAt,eTt,tTt,rTt,nTt,iTt,oTt,sTt,kP=le(()=>{h();TP();Wc();qme();Kme();gp();i3=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Fme=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),GAt=BigInt(0),WJe=BigInt(1),TL=BigInt(2),VJe=BigInt(5),zme=BigInt(10),HJe=BigInt(20),GJe=BigInt(40),Wme=BigInt(80);Dd=nb(i3,void 0,!0),o3={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Dd,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:dy,randomBytes:Pf,adjustScalarBytes:Hme,uvRatio:JJe},Bd=PP(o3);JAt=PP({...o3,domain:Gme}),YAt=PP({...o3,domain:Gme,prehash:dy}),hv=Lme({P:i3,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:t=>{let e=i3,{pow_p_5_8:r,b2:n}=Vme(t);return en(On(r,BigInt(3),e)*n,e)},adjustScalarBytes:Hme,randomBytes:Pf});YJe=(Dd.ORDER+BigInt(3))/BigInt(8),ZAt=Dd.pow(TL,YJe),XAt=Dd.sqrt(Dd.neg(Dd.ONE)),QAt=(Dd.ORDER-BigInt(5))/BigInt(8),eTt=BigInt(486662),tTt=yW(Dd,Dd.neg(BigInt(486664))),rTt=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),nTt=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),iTt=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),oTt=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),sTt=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")});var Md,ZJe,nr,IL=le(()=>{h();Tr();kP();kc();Md=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},ZJe=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{h();IL();uv();kc();s3=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},W1=class extends ii{computePublicKey({key:e}){return s3(this,void 0,void 0,function*(){if(!za(e))throw new TypeError("Invalid key provided. Must be an octet key pair (OKP) private key.");switch(e.crv){case"Ed25519":{let r=yield nr.computePublicKey({key:e});return r.alg="EdDSA",r}default:throw new Error(`Unsupported curve: ${e.crv}`)}})}generateKey({algorithm:e}){return s3(this,void 0,void 0,function*(){switch(e){case"Ed25519":{let r=yield nr.generateKey();return r.alg="EdDSA",r}}})}getPublicKey({key:e}){return s3(this,void 0,void 0,function*(){if(!za(e))throw new TypeError("Invalid key provided. Must be an octet key pair (OKP) private key.");switch(e.crv){case"Ed25519":{let r=yield nr.getPublicKey({key:e});return r.alg="EdDSA",r}default:throw new Error(`Unsupported curve: ${e.crv}`)}})}sign({key:e,data:r}){return s3(this,void 0,void 0,function*(){if(!za(e))throw new TypeError("Invalid key provided. Must be an octet key pair (OKP) private key.");switch(e.crv){case"Ed25519":return yield nr.sign({key:e,data:r});default:throw new Error(`Unsupported curve: ${e.crv}`)}})}verify({key:e,signature:r,data:n}){return s3(this,void 0,void 0,function*(){if(!oy(e))throw new TypeError("Invalid key provided. Must be an octet key pair (OKP) public key.");switch(e.crv){case"Ed25519":return yield nr.verify({key:e,signature:r,data:n});default:throw new Error(`Unsupported curve: ${e.crv}`)}})}}});var qh,kL,Pr,Zme=le(()=>{h();Tr();yL();xL();PL();kc();qh=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},kL={Ed25519:{implementation:W1,names:["Ed25519"]},secp256k1:{implementation:sy,names:["ES256K","secp256k1"]},secp256r1:{implementation:sy,names:["ES256","secp256r1"]},"SHA-256":{implementation:ny,names:["SHA-256"]}},Pr=class{constructor(e){var r;this._algorithmInstances=new Map,this._keyStore=(r=e?.keyStore)!==null&&r!==void 0?r:new Xg}digest({algorithm:e,data:r}){return qh(this,void 0,void 0,function*(){return yield this.getAlgorithm({algorithm:e}).digest({algorithm:e,data:r})})}exportKey({keyUri:e}){return qh(this,void 0,void 0,function*(){return yield this.getPrivateKey({keyUri:e})})}generateKey({algorithm:e}){return qh(this,void 0,void 0,function*(){let n=yield this.getAlgorithm({algorithm:e}).generateKey({algorithm:e});if(n?.kid===void 0)throw new Error("Generated key is missing a required property: kid");let i=`${lv}${n.kid}`;return yield this._keyStore.set(i,n),i})}getKeyUri({key:e}){return qh(this,void 0,void 0,function*(){let r=yield it({jwk:e});return`${lv}${r}`})}getPublicKey({keyUri:e}){return qh(this,void 0,void 0,function*(){let r=yield this.getPrivateKey({keyUri:e}),n=this.getAlgorithmName({key:r});return yield this.getAlgorithm({algorithm:n}).getPublicKey({key:r})})}importKey({key:e}){var r;return qh(this,void 0,void 0,function*(){if(!z1(e))throw new TypeError("Invalid key provided. Must be a private key in JWK format.");let n=structuredClone(e);(r=n.kid)!==null&&r!==void 0||(n.kid=yield it({jwk:n}));let i=yield this.getKeyUri({key:n});return yield this._keyStore.set(i,n),i})}sign({keyUri:e,data:r}){return qh(this,void 0,void 0,function*(){let n=yield this.getPrivateKey({keyUri:e}),i=this.getAlgorithmName({key:n});return this.getAlgorithm({algorithm:i}).sign({data:r,key:n})})}verify({key:e,signature:r,data:n}){return qh(this,void 0,void 0,function*(){let i=this.getAlgorithmName({key:e});return this.getAlgorithm({algorithm:i}).verify({key:e,signature:r,data:n})})}getAlgorithm({algorithm:e}){var r;let n=(r=kL[e])===null||r===void 0?void 0:r.implementation;if(!n)throw new Error(`Algorithm not supported: ${e}`);return this._algorithmInstances.has(n)||this._algorithmInstances.set(n,new n),this._algorithmInstances.get(n)}getAlgorithmName({key:e}){let r=e.alg,n=e.crv;for(let i in kL){let o=kL[i];if(r&&o.names.includes(r))return i;if(n&&o.names.includes(n))return i}throw new Error(`Unable to determine algorithm based on provided input: alg=${r}, crv=${n}`)}getPrivateKey({keyUri:e}){return qh(this,void 0,void 0,function*(){let r=yield this._keyStore.get(e);if(!r)throw new Error(`Key not found: ${e}`);return r})}}});var Mi={};Ur(Mi,{checkRequiredProperty:()=>XJe,checkValidProperty:()=>QJe,getJoseSignatureAlgorithmFromPublicKey:()=>eYe,isWebCryptoSupported:()=>tYe,randomBytes:()=>rYe,randomUuid:()=>nYe});function XJe(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 QJe(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 eYe(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 tYe(){return!!(globalThis.crypto&&globalThis.crypto.subtle)}function rYe(t){return Pf(t)}function nYe(){return eb.randomUUID()}var Xme=le(()=>{h();d9();Wc()});var a3,Qme=le(()=>{h();a3=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});function eye(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function RP(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function DP(t){if(typeof t=="string")t=RP(t);else if(eye(t))t=t.slice();else throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function rye(t,e){if(e!==void 0&&(typeof e!="object"||!oYe(e)))throw new Error("options must be object or undefined");return Object.assign(t,e)}function pv(t,e){if(!eye(t))throw new Error("Uint8Array expected");if(typeof e=="number"&&t.length!==e)throw new Error(`Uint8Array length ${e} expected`)}function nye(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n>i&o),a=Number(r&o),d=n?4:0,u=n?0:4;t.setUint32(e+d,s,n),t.setUint32(e+u,a,n)}var Lh,tye,iYe,oYe,RL,c3=le(()=>{h();Lh=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4));tye=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),iYe=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!iYe)throw new Error("Non little-endian hardware is not supported");oYe=t=>Object.prototype.toString.call(t)==="[object Object]"&&t.constructor===Object;RL=(t,e)=>(Object.assign(e,t),e)});function d3(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`wrong positive integer: ${t}`)}function BL(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function sYe(t){return t!=null&&typeof t=="object"&&(t instanceof Uint8Array||t.constructor.name==="Uint8Array")}function V1(t,...e){if(!sYe(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 ML(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 iye(t,e){V1(t);let r=e.outputLen;if(t.length{h()});function ma(){if(a3&&typeof a3.subtle=="object"&&a3.subtle!=null)return a3.subtle;throw new Error("crypto.subtle must be defined")}var uy=le(()=>{h();Qme();c3();BP()});var CL=le(()=>{h();Tr();uy();kc()});var oye=le(()=>{h();CL();uv()});var u3,aYe,MP,sye,CP,Cd,OL=le(()=>{h();Tr();uy();kc();u3=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},aYe=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{h();uv();OL();$L=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},OP=class extends ii{decrypt(e){return $L(this,void 0,void 0,function*(){return Cd.decrypt(e)})}encrypt(e){return $L(this,void 0,void 0,function*(){return Cd.encrypt(e)})}generateKey({algorithm:e}){return $L(this,void 0,void 0,function*(){let r={A128GCM:128,A192GCM:192,A256GCM:256}[e],n=yield Cd.generateKey({length:r});return n.alg=e,n})}}});var cye=le(()=>{h()});var dye=le(()=>{h()});var uye=le(()=>{h()});var lye=le(()=>{h();Tr()});var fye=le(()=>{h()});var ly,cYe,df,hye=le(()=>{h();Tr();kP();kc();ly=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},cYe=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);it(i).update(DP(n)).digest(),r=t(new Uint8Array(32));return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}var fs,NL,pye,mye=le(()=>{h();BP();c3();fs=(t,e)=>t[e++]&255|(t[e++]&255)<<8,NL=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=DP(e),pv(e,32);let r=fs(e,0),n=fs(e,2),i=fs(e,4),o=fs(e,6),s=fs(e,8),a=fs(e,10),d=fs(e,12),u=fs(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|a<<2)&8191,this.r[7]=(a>>>11|d<<5)&8065,this.r[8]=(d>>>8|u<<8)&8191,this.r[9]=u>>>5&127;for(let c=0;c<8;c++)this.pad[c]=fs(e,16+2*c)}process(e,r,n=!1){let i=n?0:2048,{h:o,r:s}=this,a=s[0],d=s[1],u=s[2],c=s[3],l=s[4],m=s[5],p=s[6],g=s[7],v=s[8],E=s[9],A=fs(e,r+0),P=fs(e,r+2),I=fs(e,r+4),$=fs(e,r+6),N=fs(e,r+8),K=fs(e,r+10),F=fs(e,r+12),U=fs(e,r+14),W=o[0]+(A&8191),L=o[1]+((A>>>13|P<<3)&8191),T=o[2]+((P>>>10|I<<6)&8191),S=o[3]+((I>>>7|$<<9)&8191),k=o[4]+(($>>>4|N<<12)&8191),f=o[5]+(N>>>1&8191),y=o[6]+((N>>>14|K<<2)&8191),w=o[7]+((K>>>11|F<<5)&8191),_=o[8]+((F>>>8|U<<8)&8191),x=o[9]+(U>>>5|i),b=0,B=b+W*a+L*(5*E)+T*(5*v)+S*(5*g)+k*(5*p);b=B>>>13,B&=8191,B+=f*(5*m)+y*(5*l)+w*(5*c)+_*(5*u)+x*(5*d),b+=B>>>13,B&=8191;let q=b+W*d+L*a+T*(5*E)+S*(5*v)+k*(5*g);b=q>>>13,q&=8191,q+=f*(5*p)+y*(5*m)+w*(5*l)+_*(5*c)+x*(5*u),b+=q>>>13,q&=8191;let M=b+W*u+L*d+T*a+S*(5*E)+k*(5*v);b=M>>>13,M&=8191,M+=f*(5*g)+y*(5*p)+w*(5*m)+_*(5*l)+x*(5*c),b+=M>>>13,M&=8191;let j=b+W*c+L*u+T*d+S*a+k*(5*E);b=j>>>13,j&=8191,j+=f*(5*v)+y*(5*g)+w*(5*p)+_*(5*m)+x*(5*l),b+=j>>>13,j&=8191;let J=b+W*l+L*c+T*u+S*d+k*a;b=J>>>13,J&=8191,J+=f*(5*E)+y*(5*v)+w*(5*g)+_*(5*p)+x*(5*m),b+=J>>>13,J&=8191;let Z=b+W*m+L*l+T*c+S*u+k*d;b=Z>>>13,Z&=8191,Z+=f*a+y*(5*E)+w*(5*v)+_*(5*g)+x*(5*p),b+=Z>>>13,Z&=8191;let G=b+W*p+L*m+T*l+S*c+k*u;b=G>>>13,G&=8191,G+=f*d+y*a+w*(5*E)+_*(5*v)+x*(5*g),b+=G>>>13,G&=8191;let H=b+W*g+L*p+T*m+S*l+k*c;b=H>>>13,H&=8191,H+=f*u+y*d+w*a+_*(5*E)+x*(5*v),b+=H>>>13,H&=8191;let X=b+W*v+L*g+T*p+S*m+k*l;b=X>>>13,X&=8191,X+=f*c+y*u+w*d+_*a+x*(5*E),b+=X>>>13,X&=8191;let ee=b+W*E+L*v+T*g+S*p+k*m;b=ee>>>13,ee&=8191,ee+=f*l+y*c+w*u+_*d+x*a,b+=ee>>>13,ee&=8191,b=(b<<2)+b|0,b=b+B|0,B=b&8191,b=b>>>13,q+=b,o[0]=B,o[1]=q,o[2]=M,o[3]=j,o[4]=J,o[5]=Z,o[6]=G,o[7]=H,o[8]=X,o[9]=ee}finalize(){let{h:e,pad:r}=this,n=new Uint16Array(10),i=e[1]>>>13;e[1]&=8191;for(let a=2;a<10;a++)e[a]+=i,i=e[a]>>>13,e[a]&=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 a=1;a<10;a++)n[a]=e[a]+i,i=n[a]>>>13,n[a]&=8191;n[9]-=8192;let o=(i^1)-1;for(let a=0;a<10;a++)n[a]&=o;o=~o;for(let a=0;a<10;a++)e[a]=e[a]&o|n[a];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 a=1;a<8;a++)s=(e[a]+r[a]|0)+(s>>>16)|0,e[a]=s&65535}update(e){ML(this);let{buffer:r,blockLen:n}=this;e=DP(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}};pye=dYe(t=>new NL(t))});function Qe(t,e){return t<>>32-e}function jL(t){return t.byteOffset%4===0}function mYe(t,e,r,n,i,o,s,a){let d=i.length,u=new Uint8Array($P),c=Lh(u),l=jL(i)&&jL(o),m=l?Lh(i):yye,p=l?Lh(o):yye;for(let g=0;g=gye)throw new Error("arx: counter overflow");let v=Math.min($P,d-g);if(l&&v===$P){let E=g/4;if(g%4!==0)throw new Error("arx: invalid block position");for(let A=0,P;A{V1(a),V1(d),V1(u);let m=u.length;if(c||(c=new Uint8Array(m)),V1(c),d3(l),l<0||l>=gye)throw new Error("arx: counter overflow");if(c.length0;)p.pop().fill(0);return c}}var uYe,lYe,fYe,hYe,$P,pYe,gye,yye,vye=le(()=>{h();BP();c3();uYe=RP("expand 16-byte k"),lYe=RP("expand 32-byte k"),fYe=Lh(uYe),hYe=Lh(lYe);$P=64,pYe=16,gye=2**32-1,yye=new Uint32Array});function _ye(t,e,r,n,i,o=20){let s=t[0],a=t[1],d=t[2],u=t[3],c=e[0],l=e[1],m=e[2],p=e[3],g=e[4],v=e[5],E=e[6],A=e[7],P=i,I=r[0],$=r[1],N=r[2],K=s,F=a,U=d,W=u,L=c,T=l,S=m,k=p,f=g,y=v,w=E,_=A,x=P,b=I,B=$,q=N;for(let j=0;j{h();c3();mye();vye();gYe=UL(_ye,{counterRight:!1,counterLength:4,allowShortKeys:!1}),xye=UL(_ye,{counterRight:!1,counterLength:8,extendNonceFn:yYe,allowShortKeys:!1}),vYe=new Uint8Array(16),bye=(t,e)=>{t.update(e);let r=e.length%16;r&&t.update(vYe.subarray(r))},bYe=new Uint8Array(32);Eye=t=>(e,r,n)=>(pv(e,32),pv(r),{encrypt:(o,s)=>{let a=o.length,d=a+16;s?pv(s,d):s=new Uint8Array(d),t(e,r,o,s,1);let u=wye(t,e,r,s.subarray(0,-16),n);return s.set(u,a),s},decrypt:(o,s)=>{let a=o.length,d=a-16;if(a<16)throw new Error("encrypted data must be at least 16 bytes");s?pv(s,d):s=new Uint8Array(d);let u=o.subarray(0,-16),c=o.subarray(-16),l=wye(t,e,r,u,n);if(!nye(c,l))throw new Error("invalid tag");return t(e,r,u,s,1),s}}),RIt=RL({blockSize:64,nonceLength:12,tagLength:16},Eye(gYe)),wYe=RL({blockSize:64,nonceLength:24,tagLength:16},Eye(xye))});var Sye=le(()=>{h();Tr();qL();uy();kc()});var Aye=le(()=>{h();Tr();qL();uy();kc()});var tn=le(()=>{h();Zme();Xme();oye();aye();uv();xL();PL();yL();cye();kc();dye();uye();bL();CL();OL();lye();IL();_L();fye();wL();SP();hye();Sye();Aye()});var WL,kye,Pye,VL,Rye,HL=le(()=>{h();WL="0123456789abcdef",kye=[],Pye=[];for(let t=0;t<256;t++)kye[t]=WL[t>>4&15]+WL[t&15],t<16&&(t<10?Pye[48+t]=t:Pye[87+t]=t);VL=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 Dye,xYe,f3,Bye=le(()=>{h();Dye="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xYe=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(f3=0;f3{h();HL();Bye();HL();EYe=new TextDecoder,GL=(t,e)=>e?new TextDecoder(e).decode(t):EYe.decode(t),SYe=new TextEncoder,Od=t=>SYe.encode(t),Mye=typeof window<"u"?window:self,Cye=Mye.crypto||Mye.msCrypto||{},OPt=Cye.subtle||Cye.webkitSubtle});function H1(t){let e=t<0?1:0;return t=Math.abs(Number(t||1)),Math.floor(Math.log10(t))+1+e}function jP(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}var JL=le(()=>{h()});function rn(t,e,r){let n=[],i=null;return rn._encode(n,t),i=Rye(n),rn.bytes=i.length,ArrayBuffer.isView(e)?(e.set(i,r),e):i}var UP,Oye,$ye,Nye,jye=le(()=>{h();NP();JL();rn.bytes=-1;rn._floatConversionDetected=!1;rn._encode=function(t,e){if(e!=null)switch(jP(e)){case"object":rn.dict(t,e);break;case"map":rn.dictMap(t,e);break;case"array":rn.list(t,e);break;case"set":rn.listSet(t,e);break;case"string":rn.string(t,e);break;case"number":rn.number(t,e);break;case"boolean":rn.number(t,e);break;case"arraybufferview":rn.buffer(t,new Uint8Array(e.buffer,e.byteOffset,e.byteLength));break;case"arraybuffer":rn.buffer(t,new Uint8Array(e));break}};UP=new Uint8Array([101]),Oye=new Uint8Array([100]),$ye=new Uint8Array([108]);rn.buffer=function(t,e){t.push(Od(e.length+":"),e)};rn.string=function(t,e){t.push(Od(Od(e).byteLength+":"+e))};rn.number=function(t,e){if(Number.isInteger(e))return t.push(Od("i"+BigInt(e)+"e"));let r=2147483648,n=e/r<<0,i=e%r<<0,o=n*r+i;t.push(Od("i"+o+"e")),o!==e&&!rn._floatConversionDetected&&(rn._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())};rn.dict=function(t,e){t.push(Oye);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 Rt(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),Rt.position=0,Rt.encoding=n||null,Rt.data=ArrayBuffer.isView(t)?new Uint8Array(t.slice(e,r)):Od(t),Rt.bytes=Rt.data.length,Rt.next())}var AYe,TYe,IYe,PYe,YL,qye,Lye=le(()=>{h();NP();AYe=105,TYe=58,IYe=100,PYe=108,YL=101;Rt.bytes=0;Rt.position=0;Rt.data=null;Rt.encoding=null;Rt.next=function(){switch(Rt.data[Rt.position]){case IYe:return Rt.dictionary();case PYe:return Rt.list();case AYe:return Rt.integer();default:return Rt.buffer()}};Rt.find=function(t){let e=Rt.position,r=Rt.data.length,n=Rt.data;for(;e{h();NP();JL();ZL=qP});var CYe,G1,XL=le(()=>{h();jye();Lye();Kye();CYe=ZL,G1={encode:Nye,decode:qye,byteLength:ZL,encodingLength:CYe}});function Fye(t){if(Uu.isFormat(t))return Uu.size;if(Kh.isFormat(t))return Kh.size;throw Error(`Invalid ip address: ${t}`)}function zye(t){return Fye(t)===Uu.size?1:2}function Wye(t,e,r){r=~~r;let n=Fye(t);return typeof e=="function"&&(e=e(r+n)),n===Uu.size?Uu.encode(t,e,r):Kh.encode(t,e,r)}function Vye(t,e,r){if(e=~~e,r=r||t.length-e,r===Uu.size)return Uu.decode(t,e,r);if(r===Kh.size)return Kh.decode(t,e,r);throw Error(`Invalid buffer size needs to be ${Uu.size} for v4 or ${Kh.size} for v6.`)}var OYe,$Ye,Uu,Kh,Hye=le(()=>{h();OYe=/^(\d{1,3}\.){3,3}\d{1,3}$/,$Ye=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,Uu={name:"v4",size:4,isFormat:t=>OYe.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&&$Ye.test(t),encode(t,e,r){r=~~r;let n=r+16,i=-1,o=0,s=0,a=!0,d=!1;e=e||new Uint8Array(r+16);for(let u=0;u>8),r=97?c-=87:c>=65?c-=55:(c-=48,s=s*10+c),o=(o<<4)+c)}if(a===!1)d===!0?(r>8),r=i+2;u--)e[u]=e[u-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{h()});function Jye(t){switch(t){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+t}var Yye=le(()=>{h()});function Zye(t){switch(t){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+t}var Xye=le(()=>{h()});function QL(t){switch(t){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+t}function eK(t){switch(t.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}var Qye=le(()=>{h()});function e0e(t){switch(t){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return t<0?null:`OPTION_${t}`}function tK(t){if(typeof t=="number")return t;if(!t)return-1;switch(t.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}let e=t.match(/_(\d+)$/);return e?parseInt(e[1],10):-1}var t0e=le(()=>{h()});function rK(t){let e=0,r=t.length;for(let n=0;n=56320||(t.charCodeAt(o)&64512)!==56320?e+=3:(n=o,e+=4)}}return e}function Y1(t,e,r){let n=t.length;r==null&&(r=0),e===void 0&&(e=new Uint8Array(rK(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 a=o+1;if(a===n||s>=56320)e[i++]=239,e[i++]=191,e[i++]=189;else{let d=t.charCodeAt(a);(d&64512)!==56320?(e[i++]=239,e[i++]=191,e[i++]=189):(o=a,s=65536|(s&1023)<<10|d&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 Y1.bytes=i-r,e}function Z1(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 a=55296|s>>10&1023;n+=String.fromCharCode(a),s=56320|s&1023}else s=(o&15)<<12|(t[i++]&63)<<6|t[i++]&63;n+=String.fromCharCode(s)}return Z1.bytes=r-e,n}var nK=le(()=>{h();Y1.bytes=0;Z1.bytes=0});function Fh(t){return typeof t=="string"?rK(t):t.byteLength}function LP(t){return t instanceof Uint8Array?t:Array.isArray(t)?new Uint8Array(t):Y1(t)}function KP(t,e,r){if(typeof e!="string")throw new Error("unknown input type");return Y1(e,t,r),Y1.bytes}function n0e(t,e,r){let n="";for(let i=e;i>>1}function i0e(t,e,r,n){let i=0;for(;r=e.length||n>=i?0:HYe(t,e,r,n,i)}function HYe(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||i{h();nK();fy=t=>t instanceof Uint8Array;p3={},r0e=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,a=`${e}${i}`;r0e[s]=a,p3[a]=s,p3[`${r}${i}`]=s,p3[`${e}${o}`]=s,p3[`${r}${o}`]=s}}zYe=Math.pow(2,24),WYe=Math.pow(2,16),VYe=Math.pow(2,8),uf=(t,e)=>t[e]*zYe+t[e+1]*WYe+t[e+2]*VYe+t[e+3],ar=(t,e)=>t[e]<<8|t[e+1],lf=(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),gt=(t,e,r)=>(t[r]=e>>8,t[r+1]=e&255,r+2)});function In({bytes:t=0,encode:e,decode:r,encodingLength:n}){return e.bytes=t,r.bytes=t,{encode:e,decode:r,encodingLength:n||(()=>t)}}function aK(t){if(t===1)return 20;if(t===2)return 32;throw new Error(`Invalid hashType=${t}, supported=1,2`)}function oK(t){switch(t.toUpperCase()){case"A":return d0e;case"PTR":return t2;case"CNAME":return t2;case"DNAME":return t2;case"TXT":return HP;case"NULL":return GP;case"AAAA":return XP;case"SRV":return YP;case"HINFO":return JP;case"CAA":return hy;case"NS":return WP;case"SOA":return VP;case"MX":return ZP;case"OPT":return py;case"DNSKEY":return ff;case"RRSIG":return m3;case"RP":return y3;case"NSEC":return g3;case"NSEC3":return v3;case"SSHFP":return Q1;case"DS":return b3}return zP}function QP(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}function u0e(t){let e=mv(t),r=new Uint8Array(2+e.byteLength);return gt(r,e.byteLength),Va(e,r,2,0,e.length),u0e.bytes=r.byteLength,r}function l0e(t){let e=ar(t,0);if(t.byteLength{h();Hye();Gye();Yye();Xye();Qye();t0e();o0e();nK();JYe=0,s0e=32768,sK=32768,YYe=~sK,c0e=32768,ZYe=~c0e;ot=In({encode(t,e,r){e||(e=new Uint8Array(ot.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 a=t[e++];if(o+=s?0:1,a===0)break;if(a&192)if((a&192)===192){if(e+1>t.length)throw new Error("Cannot decode name (buffer overflow)");let d=ar(t,e-1)-49152;if(d>=n)throw new Error("Cannot decode name (bad pointer)");e=d,n=d,o+=s?0:1,s=!0}else throw new Error("Cannot decode name (bad label)");else{if(e+a>t.length)throw new Error("Cannot decode name (buffer overflow)");if(i+=a+1,i>254)throw new Error("Cannot decode name (name too long)");r.push(Z1(t,e,e+a)),e+=a,o+=s?0:a}}return ot.decode.bytes=o,r.length===0?".":r.join(".")},encodingLength(t){return t==="."||t===".."?1:Fh(t.replace(/^\.|\.$/gm,""))+2}}),oo=In({encode(t,e,r){e||(e=new Uint8Array(oo.encodingLength(t))),r||(r=0);let n=KP(e,t,r+1);return e[r]=n,oo.encode.bytes=n+1,e},decode(t,e){e||(e=0);let r=t[e],n=Z1(t,e+1,e+1+r);return oo.decode.bytes=r+1,n},encodingLength(t){return Fh(t)+1}}),X1=In({bytes:12,encode(t,e,r){e||(e=new Uint8Array(X1.encodingLength(t))),r||(r=0);let n=(t.flags||0)&32767,i=t.type==="response"?s0e:JYe;return gt(e,t.id||0,r),gt(e,n|i,r+2),gt(e,t.questions.length,r+4),gt(e,t.answers.length,r+6),gt(e,t.authorities.length,r+8),gt(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=ar(t,e+2);return{id:ar(t,e),type:r&s0e?"response":"query",flags:r&32767,flag_qr:(r>>15&1)===1,opcode:Zye(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:Jye(r&15),questions:new Array(ar(t,e+4)),answers:new Array(ar(t,e+6)),authorities:new Array(ar(t,e+8)),additionals:new Array(ar(t,e+10))}},encodingLength(){return 12}}),zP=In({encode(t,e,r){e||(e=new Uint8Array(zP.encodingLength(t))),r||(r=0);let n=t.length;return gt(e,n,r),Va(t,e,r+2,0,n),zP.encode.bytes=n+2,e},decode(t,e){e||(e=0);let r=ar(t,e),n=t.slice(e+2,e+2+r);return zP.decode.bytes=r+2,n},encodingLength(t){return t.length+2}}),WP=In({encode(t,e,r){return e||(e=new Uint8Array(WP.encodingLength(t))),r||(r=0),ot.encode(t,e,r+2),gt(e,ot.encode.bytes,r),WP.encode.bytes=ot.encode.bytes+2,e},decode(t,e){e||(e=0);let r=ar(t,e),n=ot.decode(t,e+2);return WP.decode.bytes=r+2,n},encodingLength(t){return ot.encodingLength(t)+2}}),VP=In({encode(t,e,r){e||(e=new Uint8Array(VP.encodingLength(t))),r||(r=0);let n=r;return r+=2,ot.encode(t.mname,e,r),r+=ot.encode.bytes,ot.encode(t.rname,e,r),r+=ot.encode.bytes,lf(e,t.serial||0,r),r+=4,lf(e,t.refresh||0,r),r+=4,lf(e,t.retry||0,r),r+=4,lf(e,t.expire||0,r),r+=4,lf(e,t.minimum||0,r),r+=4,gt(e,r-n-2,n),VP.encode.bytes=r-n,e},decode(t,e){e||(e=0);let r=e,n={};return e+=2,n.mname=ot.decode(t,e),e+=ot.decode.bytes,n.rname=ot.decode(t,e),e+=ot.decode.bytes,n.serial=uf(t,e),e+=4,n.refresh=uf(t,e),e+=4,n.retry=uf(t,e),e+=4,n.expire=uf(t,e),e+=4,n.minimum=uf(t,e),e+=4,VP.decode.bytes=e-r,n},encodingLength(t){return 22+ot.encodingLength(t.mname)+ot.encodingLength(t.rname)}}),HP=In({encode(t,e,r){Array.isArray(t)||(t=[t]);for(let i=0;i0;){let o=t[e++];if(--n,nnew Uint8Array(t),zh=In({encode(t,e,r){e||(e=new Uint8Array(zh.encodingLength(t))),r||(r=0);let n=r,i=tK(t.code);if(gt(e,i,r),r+=2,t.data)gt(e,t.data.length,r),r+=2,Va(t.data,e,r),r+=t.data.length;else switch(i){case 8:{let o=t.sourcePrefixLength||0,s=t.family||zye(t.ip,a0e),a=Wye(t.ip,a0e),d=Math.ceil(o/8);gt(e,d+4,r),r+=2,gt(e,s,r),r+=2,e[r++]=o,e[r++]=t.scopePrefixLength||0,Va(a,e,r,0,d),r+=d}break;case 11:t.timeout?(gt(e,2,r),r+=2,gt(e,t.timeout,r),r+=2):(gt(e,0,r),r+=2);break;case 12:{let o=t.length||0;gt(e,o,r),r+=2,e.fill(0,r,r+o),r+=o}break;case 14:{let o=t.tags.length*2;gt(e,o,r),r+=2;for(let s of t.tags)gt(e,s,r),r+=2}break;default:throw new Error(`Unknown roption code: ${t.code}`)}return zh.encode.bytes=r-n,e},decode(t,e){e||(e=0);let r={};r.code=ar(t,e),r.type=e0e(r.code),e+=2;let n=ar(t,e);switch(e+=2,r.data=t.slice(e,e+n),r.code){case 8:r.family=ar(t,e),e+=2,r.sourcePrefixLength=t[e++],r.scopePrefixLength=t[e++];{let i=new Uint8Array(r.family===1?4:16);Va(t,i,0,e,e+n-4),r.ip=Vye(i)}break;case 11:n>0&&(r.timeout=ar(t,e),e+=2);break;case 14:r.tags=[];for(let i=0;i0;)n[o++]=zh.decode(t,e),e+=zh.decode.bytes,i-=zh.decode.bytes;return py.decode.bytes=e-r,n},encodingLength(t){return 2+e2(t||[],zh)}}),ff=In({encode(t,e,r){e||(e=new Uint8Array(ff.encodingLength(t))),r||(r=0);let n=r,i=t.key;if(!fy(i))throw new Error("Key must be a Buffer");return r+=2,gt(e,t.flags,r),r+=2,e[r]=ff.PROTOCOL_DNSSEC,r+=1,e[r]=t.algorithm,r+=1,Va(i,e,r,0,i.length),r+=i.length,ff.encode.bytes=r-n,gt(e,ff.encode.bytes-2,n),e},decode(t,e){e||(e=0);let r=e,n={},i=ar(t,e);if(e+=2,n.flags=ar(t,e),e+=2,t[e]!==ff.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,ff.decode.bytes=e-r,n},encodingLength(t){return 6+Fh(t.key)}});ff.PROTOCOL_DNSSEC=3;ff.ZONE_KEY=128;ff.SECURE_ENTRYPOINT=32768;m3=In({encode(t,e,r){e||(e=new Uint8Array(m3.encodingLength(t))),r||(r=0);let n=r,i=t.signature;if(!fy(i))throw new Error("Signature must be a Buffer");return r+=2,gt(e,J1(t.typeCovered),r),r+=2,e[r]=t.algorithm,r+=1,e[r]=t.labels,r+=1,lf(e,t.originalTTL,r),r+=4,lf(e,t.expiration,r),r+=4,lf(e,t.inception,r),r+=4,gt(e,t.keyTag,r),r+=2,ot.encode(t.signersName,e,r),r+=ot.encode.bytes,Va(i,e,r,0,i.length),r+=i.length,m3.encode.bytes=r-n,gt(e,m3.encode.bytes-2,n),e},decode(t,e){e||(e=0);let r=e,n={},i=ar(t,e);return e+=2,n.typeCovered=h3(ar(t,e)),e+=2,n.algorithm=t[e],e+=1,n.labels=t[e],e+=1,n.originalTTL=uf(t,e),e+=4,n.expiration=uf(t,e),e+=4,n.inception=uf(t,e),e+=4,n.keyTag=ar(t,e),e+=2,n.signersName=ot.decode(t,e),e+=ot.decode.bytes,n.signature=t.slice(e,r+i+2),e+=n.signature.length,m3.decode.bytes=e-r,n},encodingLength(t){return 20+ot.encodingLength(t.signersName)+Fh(t.signature)}}),y3=In({encode(t,e,r){e||(e=new Uint8Array(y3.encodingLength(t))),r||(r=0);let n=r;return r+=2,ot.encode(t.mbox||".",e,r),r+=ot.encode.bytes,ot.encode(t.txt||".",e,r),r+=ot.encode.bytes,y3.encode.bytes=r-n,gt(e,y3.encode.bytes-2,n),e},decode(t,e){e||(e=0);let r=e,n={};return e+=2,n.mbox=ot.decode(t,e)||".",e+=ot.decode.bytes,n.txt=ot.decode(t,e)||".",e+=ot.decode.bytes,y3.decode.bytes=e-r,n},encodingLength(t){return 2+ot.encodingLength(t.mbox||".")+ot.encodingLength(t.txt||".")}}),Bc=In({encode(t,e,r){e||(e=new Uint8Array(Bc.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=py.decode(t,e+8),e+=8+py.decode.bytes;else{let i=ar(t,e+2);r.ttl=uf(t,e+4),r.class=QL(i&YYe),r.flush=!!(i&sK);let o=oK(r.type);r.data=o.decode(t,e+8),e+=8+o.decode.bytes}return $d.decode.bytes=e-n,r},encodingLength(t){let e=t.data!==null&&t.data!==void 0?t.data:t.options;return ot.encodingLength(t.name)+8+oK(t.type).encodingLength(e)}}),r2=In({encode(t,e,r){e||(e=new Uint8Array(r2.encodingLength(t))),r||(r=0);let n=r;return ot.encode(t.name,e,r),r+=ot.encode.bytes,gt(e,J1(t.type),r),r+=2,gt(e,eK(t.class===void 0?"IN":t.class),r),r+=2,r2.encode.bytes=r-n,t},decode(t,e){e||(e=0);let r=e,n={};return n.name=ot.decode(t,e),e+=ot.decode.bytes,n.type=h3(ar(t,e)),e+=2,n.class=QL(ar(t,e)),e+=2,!!(n.class&c0e)&&(n.class&=ZYe),r2.decode.bytes=e-r,n},encodingLength(t){return ot.encodingLength(t.name)+4}}),rk=1024,hs={encode:function(t,e,r){let n=!e;n&&(e=new Uint8Array(XYe(t))),r||(r=0);let i=r;return t.questions||(t.questions=[]),t.answers||(t.answers=[]),t.authorities||(t.authorities=[]),t.additionals||(t.additionals=[]),X1.encode(t,e,r),r+=X1.encode.bytes,r=w3(t.questions,r2,e,r),r=w3(t.answers,$d,e,r),r=w3(t.authorities,$d,e,r),r=w3(t.additionals,$d,e,r),hs.encode.bytes=r-i,n&&mv.bytes!==e.length?e.slice(0,mv.bytes):e},decode:function(t,e){e||(e=0);let r=e,n=X1.decode(t,e);return e+=X1.decode.bytes,e=FP(n.questions,r2,t,e),e=FP(n.answers,$d,t,e),e=FP(n.authorities,$d,t,e),e=FP(n.additionals,$d,t,e),hs.decode.bytes=e-r,n},encodingLength:function(t){return X1.encodingLength(t)+e2(t.questions||[],r2)+e2(t.answers||[],$d)+e2(t.authorities||[],$d)+e2(t.additionals||[],$d)}};hs.encode.bytes=0;hs.decode.bytes=0;ek={encode:function(t,e,r){return e=hs.encode(QP(t,"query"),e,r),ek.encode.bytes=hs.encode.bytes,e},decode:function(t,e){let r=hs.decode(t,e);return ek.decode.bytes=hs.decode.bytes,r.questions&&(r.question=r.questions[0],delete r.questions),r},encodingLength:function(t){return hs.encodingLength(QP(t,"query"))}};ek.encode.bytes=0;ek.decode.bytes=0;tk={encode:function(t,e,r){return e=hs.encode(QP(t,"response"),e,r),tk.encode.bytes=hs.encode.bytes,e},decode:function(t,e){let r=hs.decode(t,e);return tk.decode.bytes=hs.decode.bytes,r.questions&&(r.question=r.questions[0],delete r.questions),r},encodingLength:function(t){return hs.encodingLength(QP(t,"response"))}};tk.encode.bytes=0;tk.decode.bytes=0;mv=hs.encode,n2=hs.decode,XYe=hs.encodingLength;u0e.bytes=0;l0e.bytes=0});var jn,_3=le(()=>{h();jn={DeltaExceedsMaximumSize:"DeltaExceedsMaximumSize",DidDocumentPublicKeyIdDuplicated:"DidDocumentPublicKeyIdDuplicated",DidDocumentPublicKeyMissingOrIncorrectType:"DidDocumentPublicKeyMissingOrIncorrectType",DidDocumentServiceIdDuplicated:"DidDocumentServiceIdDuplicated",DidSuffixIncorrectLength:"DidSuffixIncorrectLength",EncodedStringIncorrectEncoding:"EncodedStringIncorrectEncoding",IdNotUsingBase64UrlCharacterSet:"IdNotUsingBase64UrlCharacterSet",IdTooLong:"IdTooLong",JwkEs256kMissingOrInvalidCrv:"JwkEs256kMissingOrInvalidCrv",JwkEs256kMissingOrInvalidKty:"JwkEs256kMissingOrInvalidKty",JwkEs256kHasIncorrectLengthOfX:"JwkEs256kHasIncorrectLengthOfX",JwkEs256kHasIncorrectLengthOfY:"JwkEs256kHasIncorrectLengthOfY",JwkEs256kHasIncorrectLengthOfD:"JwkEs256kHasIncorrectLengthOfD",MultihashStringNotAMultihash:"MultihashStringNotAMultihash",MultihashUnsupportedHashAlgorithm:"MultihashUnsupportedHashAlgorithm",PublicKeyJwkEs256kHasUnexpectedProperty:"PublicKeyJwkEs256kHasUnexpectedProperty",PublicKeyPurposeDuplicated:"PublicKeyPurposeDuplicated",ServiceEndpointCannotBeAnArray:"ServiceEndpointCannotBeAnArray",ServiceEndpointStringNotValidUri:"ServiceEndpointStringNotValidUri",ServiceTypeTooLong:"ServiceTypeTooLong"}});var wn,x3=le(()=>{h();wn=class extends Error{constructor(e,r){super(`${e}: ${r}`),this.code=e,Object.setPrototypeOf(this,new.target.prototype)}}});var Ha,i2=le(()=>{h();_3();x3();a_();Ha=class t{static encode(e){return ab.baseEncode(e)}static decodeAsBytes(e,r){if(!t.isBase64UrlString(e))throw new wn(jn.EncodedStringIncorrectEncoding,`Given ${r} must be base64url string.`);return ab.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,Mc,ok=le(()=>{h();(function(t){t.Public="public",t.Private="private"})(lK||(lK={}));Mc=lK});var so,sk=le(()=>{h();i2();_3();x3();ok();so=class{static validateEs256kOperationKey(e,r){let n=new Set(["kty","crv","x","y"]);r===Mc.Private&&n.add("d");for(let i in e)if(!n.has(i))throw new wn(jn.PublicKeyJwkEs256kHasUnexpectedProperty,`SECP256K1 JWK key has unexpected property '${i}'.`);if(e.crv!=="secp256k1")throw new wn(jn.JwkEs256kMissingOrInvalidCrv,`SECP256K1 JWK 'crv' property must be 'secp256k1' but got '${e.crv}.'`);if(e.kty!=="EC")throw new wn(jn.JwkEs256kMissingOrInvalidKty,`SECP256K1 JWK 'kty' property must be 'EC' but got '${e.kty}.'`);if(e.x.length!==43)throw new wn(jn.JwkEs256kHasIncorrectLengthOfX,"SECP256K1 JWK 'x' property must be 43 bytes.");if(e.y.length!==43)throw new wn(jn.JwkEs256kHasIncorrectLengthOfY,"SECP256K1 JWK 'y' property must be 43 bytes.");if(r===Mc.Private&&(e.d===void 0||e.d.length!==43))throw new wn(jn.JwkEs256kHasIncorrectLengthOfD,"SECP256K1 JWK 'd' property must be 43 bytes.")}static validateId(e){if(e.length>50)throw new wn(jn.IdTooLong,`Key ID length ${e.length} exceed max allowed length of 50.`);if(!Ha.isBase64UrlString(e))throw new wn(jn.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 wn(jn.PublicKeyPurposeDuplicated,`Public key purpose '${n}' already specified.`);r.add(n)}}}});var E3,va,S3=le(()=>{h();E3=class{};E3.hashAlgorithmInMultihashCode=18;E3.maxCanonicalizedDeltaSizeInBytes=1e3;va=E3});var v0e=V((Gkt,g0e)=>{"use strict";h();g0e.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 b0e,qu,ak=le(()=>{h();b0e=Kt(v0e(),1);i2();qu=class t{static canonicalizeAsBytes(e){let r=t.removeAllUndefinedProperties(e),n=b0e.default(r);return Ha.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 A3,Bo,fK=le(()=>{h();i2();_3();x3();S3();ak();lb();d5();A3=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Bo=class t{static hash(e,r){return A3(this,void 0,void 0,function*(){let n;switch(r){case 18:n=(yield l_.digest(e)).bytes;break;default:throw new wn(jn.MultihashUnsupportedHashAlgorithm,`Hash algorithm defined in multihash code ${r} is not supported.`)}return n})}static hashAsNonMultihashBytes(e,r){return A3(this,void 0,void 0,function*(){let n;switch(r){case 18:n=yield l_.encode(e);break;default:throw new wn(jn.MultihashUnsupportedHashAlgorithm,`Hash algorithm defined in multihash code ${r} is not supported.`)}return n})}static canonicalizeThenHashThenEncode(e,r){return A3(this,void 0,void 0,function*(){let n=qu.canonicalizeAsBytes(e);return yield t.hashThenEncode(n,r)})}static canonicalizeThenDoubleHashThenEncode(e,r){return A3(this,void 0,void 0,function*(){let n=qu.canonicalizeAsBytes(e),i=yield t.hashAsNonMultihashBytes(n,r);return yield t.hashThenEncode(i,r)})}static hashThenEncode(e,r){return A3(this,void 0,void 0,function*(){let n=yield t.hash(e,r);return Ha.encode(n)})}static validateEncodedHashComputedUsingSupportedHashAlgorithm(e,r){let n,i=Ha.decodeAsBytes(e,r);try{n=c5(i)}catch{throw new wn(jn.MultihashStringNotAMultihash,`Given ${r} string '${e}' is not a multihash after decoding.`)}let o=va.hashAlgorithmInMultihashCode;if(o!==n.code)throw new wn(jn.MultihashUnsupportedHashAlgorithm,`Given ${r} uses unsupported multihash algorithm with code ${n.code}, should use ${o} or change IonSdkConfig to desired hashing algorithm.`)}}});var hK,T3,w0e=le(()=>{h();(function(t){t.Create="create",t.Update="update",t.Deactivate="deactivate",t.Recover="recover"})(hK||(hK={}));T3=hK});var pK,gv,_0e=le(()=>{h();(function(t){t.Replace="replace",t.AddPublicKeys="add-public-keys",t.RemovePublicKeys="remove-public-keys",t.AddServices="add-services",t.RemoveServices="remove-services"})(pK||(pK={}));gv=pK});var x0e,ck,hf,mK=le(()=>{h();x0e=Kt(rj(),1);_3();sk();x3();S3();ak();fK();ok();w0e();_0e();ck=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},hf=class t{static createCreateRequest(e){return ck(this,void 0,void 0,function*(){let r=e.recoveryKey,n=e.updateKey,i=e.document.publicKeys,o=e.document.services;so.validateEs256kOperationKey(r,Mc.Public),so.validateEs256kOperationKey(n,Mc.Public),t.validateDidDocumentKeys(i),t.validateServices(o);let s=va.hashAlgorithmInMultihashCode,a=[{action:gv.Replace,document:e.document}],d={updateCommitment:yield Bo.canonicalizeThenDoubleHashThenEncode(n,s),patches:a};t.validateDeltaSize(d);let c={deltaHash:yield Bo.canonicalizeThenHashThenEncode(d,s),recoveryCommitment:yield Bo.canonicalizeThenDoubleHashThenEncode(r,s)};return{type:T3.Create,suffixData:c,delta:d}})}static createDeactivateRequest(e){return ck(this,void 0,void 0,function*(){t.validateDidSuffix(e.didSuffix),so.validateEs256kOperationKey(e.recoveryPublicKey,Mc.Public);let r=va.hashAlgorithmInMultihashCode,n=yield Bo.canonicalizeThenHashThenEncode(e.recoveryPublicKey,r),i={didSuffix:e.didSuffix,recoveryKey:e.recoveryPublicKey},o=yield e.signer.sign({alg:"ES256K"},i);return{type:T3.Deactivate,didSuffix:e.didSuffix,revealValue:n,signedData:o}})}static createRecoverRequest(e){return ck(this,void 0,void 0,function*(){t.validateDidSuffix(e.didSuffix),so.validateEs256kOperationKey(e.recoveryPublicKey,Mc.Public),so.validateEs256kOperationKey(e.nextRecoveryPublicKey,Mc.Public),so.validateEs256kOperationKey(e.nextUpdatePublicKey,Mc.Public),t.validateDidDocumentKeys(e.document.publicKeys),t.validateServices(e.document.services);let r=va.hashAlgorithmInMultihashCode,n=yield Bo.canonicalizeThenHashThenEncode(e.recoveryPublicKey,r),i=[{action:gv.Replace,document:e.document}],o=yield Bo.canonicalizeThenDoubleHashThenEncode(e.nextUpdatePublicKey,r),s={patches:i,updateCommitment:o},a=yield Bo.canonicalizeThenHashThenEncode(s,r),u={recoveryCommitment:yield Bo.canonicalizeThenDoubleHashThenEncode(e.nextRecoveryPublicKey,r),recoveryKey:e.recoveryPublicKey,deltaHash:a},c=yield e.signer.sign({alg:"ES256K"},u);return{type:T3.Recover,didSuffix:e.didSuffix,revealValue:n,delta:s,signedData:c}})}static createUpdateRequest(e){return ck(this,void 0,void 0,function*(){if(t.validateDidSuffix(e.didSuffix),so.validateEs256kOperationKey(e.updatePublicKey,Mc.Public),so.validateEs256kOperationKey(e.nextUpdatePublicKey,Mc.Public),t.validateServices(e.servicesToAdd),t.validateDidDocumentKeys(e.publicKeysToAdd),e.idsOfServicesToRemove!==void 0)for(let g of e.idsOfServicesToRemove)so.validateId(g);if(e.idsOfPublicKeysToRemove!==void 0)for(let g of e.idsOfPublicKeysToRemove)so.validateId(g);let r=[],n=e.servicesToAdd;if(n!==void 0&&n.length>0){let g={action:gv.AddServices,services:n};r.push(g)}let i=e.idsOfServicesToRemove;if(i!==void 0&&i.length>0){let g={action:gv.RemoveServices,ids:i};r.push(g)}let o=e.publicKeysToAdd;if(o!==void 0&&o.length>0){let g={action:gv.AddPublicKeys,publicKeys:o};r.push(g)}let s=e.idsOfPublicKeysToRemove;if(s!==void 0&&s.length>0){let g={action:gv.RemovePublicKeys,ids:s};r.push(g)}let a=va.hashAlgorithmInMultihashCode,d=yield Bo.canonicalizeThenHashThenEncode(e.updatePublicKey,a),u=yield Bo.canonicalizeThenDoubleHashThenEncode(e.nextUpdatePublicKey,a),c={patches:r,updateCommitment:u},l=yield Bo.canonicalizeThenHashThenEncode(c,a),m={updateKey:e.updatePublicKey,deltaHash:l},p=yield e.signer.sign({alg:"ES256K"},m);return{type:T3.Update,didSuffix:e.didSuffix,revealValue:d,delta:c,signedData:p}})}static validateDidSuffix(e){Bo.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 wn(jn.DidDocumentPublicKeyMissingOrIncorrectType,"DID Document key 'publicKeyJwk' property is not a non-array object.");if(so.validateId(n.id),r.has(n.id))throw new wn(jn.DidDocumentPublicKeyIdDuplicated,`DID Document key with ID '${n.id}' already exists.`);r.add(n.id),so.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 wn(jn.DidDocumentServiceIdDuplicated,"Service id has to be unique");r.add(n.id)}}}static validateService(e){so.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 wn(jn.ServiceTypeTooLong,n)}if(Array.isArray(e.serviceEndpoint)){let n="Service endpoint value cannot be an array.";throw new wn(jn.ServiceEndpointCannotBeAnArray,n)}if(typeof e.serviceEndpoint=="string"&&x0e.parse(e.serviceEndpoint).error!==void 0)throw new wn(jn.ServiceEndpointStringNotValidUri,`Service endpoint string '${e.serviceEndpoint}' is not a URI.`)}static validateDeltaSize(e){let r=qu.canonicalizeAsBytes(e);if(r.length>va.maxCanonicalizedDeltaSizeInBytes){let n=`Delta of ${r.length} bytes exceeded limit of ${va.maxCanonicalizedDeltaSizeInBytes} bytes.`;throw new wn(jn.DeltaExceedsMaximumSize,n)}}}});var E0e,yy,S0e=le(()=>{h();i2();mK();S3();ak();fK();E0e=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},yy=class t{static createLongFormDid(e){return E0e(this,void 0,void 0,function*(){let r=yield hf.createCreateRequest(e),n=yield t.computeDidUniqueSuffix(r.suffixData),i;va.network===void 0||va.network==="mainnet"?i=`did:ion:${n}`:i=`did:ion:${va.network}:${n}`;let o={suffixData:r.suffixData,delta:r.delta},s=qu.canonicalizeAsBytes(o),a=Ha.encode(s);return`${i}:${a}`})}static computeDidUniqueSuffix(e){return E0e(this,void 0,void 0,function*(){let r=qu.canonicalizeAsBytes(e),n=yield Bo.hash(r,va.hashAlgorithmInMultihashCode);return Ha.encode(n)})}}});var A0e=le(()=>{h();JR();HS();sk();a_()});var T0e,I0e=le(()=>{h();(function(t){t.Mainnet="mainnet",t.Testnet="test"})(T0e||(T0e={}))});var P0e,k0e=le(()=>{h();(function(t){t.Authentication="authentication",t.AssertionMethod="assertionMethod",t.CapabilityInvocation="capabilityInvocation",t.CapabilityDelegation="capabilityDelegation",t.KeyAgreement="keyAgreement"})(P0e||(P0e={}))});var R0e=le(()=>{h();HS();i2();sk();ok();a_();d5()});var yK=le(()=>{h();S0e();A0e();I0e();k0e();mK();S3();R0e()});var wv=V((j9t,B0e)=>{h();var s2=1e3,a2=s2*60,c2=a2*60,bv=c2*24,nZe=bv*7,iZe=bv*365.25;B0e.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return oZe(t);if(r==="number"&&isFinite(t))return e.long?aZe(t):sZe(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function oZe(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*iZe;case"weeks":case"week":case"w":return r*nZe;case"days":case"day":case"d":return r*bv;case"hours":case"hour":case"hrs":case"hr":case"h":return r*c2;case"minutes":case"minute":case"mins":case"min":case"m":return r*a2;case"seconds":case"second":case"secs":case"sec":case"s":return r*s2;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function sZe(t){var e=Math.abs(t);return e>=bv?Math.round(t/bv)+"d":e>=c2?Math.round(t/c2)+"h":e>=a2?Math.round(t/a2)+"m":e>=s2?Math.round(t/s2)+"s":t+"ms"}function aZe(t){var e=Math.abs(t);return e>=bv?uk(t,e,bv,"day"):e>=c2?uk(t,e,c2,"hour"):e>=a2?uk(t,e,a2,"minute"):e>=s2?uk(t,e,s2,"second"):t+" ms"}function uk(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var wK=V(M0e=>{h();M0e.Level=aq().BrowserLevel});var hve=V((bMt,BK)=>{"use strict";h();var mXe=Object.prototype.hasOwnProperty,ba="~";function O3(){}Object.create&&(O3.prototype=Object.create(null),new O3().__proto__||(ba=!1));function yXe(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function fve(t,e,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var o=new yXe(r,n||t,i),s=ba?ba+e:e;return t._events[s]?t._events[s].fn?t._events[s]=[t._events[s],o]:t._events[s].push(o):(t._events[s]=o,t._eventsCount++),t}function Rk(t,e){--t._eventsCount===0?t._events=new O3:delete t._events[e]}function Ks(){this._events=new O3,this._eventsCount=0}Ks.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)mXe.call(r,n)&&e.push(ba?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};Ks.prototype.listeners=function(e){var r=ba?ba+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,s=new Array(o);i{"use strict";h();(function(t){t.authentication="authentication",t.assertionMethod="assertionMethod",t.keyAgreement="keyAgreement",t.capabilityInvocation="capabilityInvocation",t.capabilityDelegation="capabilityDelegation"})(Dv||(Dv={}))});var si,Sy=le(()=>{"use strict";h();si={"@context":"https://w3id.org/did-resolution/v1",didResolutionMetadata:{},didDocument:null,didDocumentMetadata:{}}});var cr,Ay=le(()=>{"use strict";h();cr=class t{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=t.DID_URI_PATTERN.exec(e);if(!r||!r.groups)return null;let{method:n,id:i,path:o,query:s,fragment:a}=r.groups,d={uri:`did:${n}:${i}`,method:n,id:i};if(o&&(d.path=o),s&&(d.query=s.slice(1)),a&&(d.fragment=a.slice(1)),s){let u={},c=s.slice(1).split("&");for(let l of c){let[m,p]=l.split("=");u[m]=p}d.params=u}return d}};cr.METHOD_PATTERN="([a-z0-9]+)";cr.PCT_ENCODED_PATTERN="(?:%[0-9a-fA-F]{2})";cr.ID_CHAR_PATTERN=`(?:[a-zA-Z0-9._-]|${cr.PCT_ENCODED_PATTERN})`;cr.METHOD_ID_PATTERN=`((?:${cr.ID_CHAR_PATTERN}*:)*(${cr.ID_CHAR_PATTERN}+))`;cr.PATH_PATTERN="(/[^#?]*)?";cr.QUERY_PATTERN="([?][^#]*)?";cr.FRAGMENT_PATTERN="(#.*)?";cr.DID_URI_PATTERN=new RegExp(`^did:(?${cr.METHOD_PATTERN}):(?${cr.METHOD_ID_PATTERN})(?${cr.PATH_PATTERN})(?${cr.QUERY_PATTERN})(?${cr.FRAGMENT_PATTERN})$`)});var dt,nt,Qh=le(()=>{"use strict";h();dt=class t extends Error{constructor(e,r){super(`${e}: ${r}`),this.code=e,this.name="DidError",Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,t)}};(function(t){t.InvalidDid="invalidDid",t.MethodNotSupported="methodNotSupported",t.InternalError="internalError",t.InvalidDidDocument="invalidDidDocument",t.InvalidDidDocumentLength="invalidDidDocumentLength",t.InvalidDidUrl="invalidDidUrl",t.InvalidPreviousDidProof="invalidPreviousDidProof",t.InvalidPublicKey="invalidPublicKey",t.InvalidPublicKeyLength="invalidPublicKeyLength",t.InvalidPublicKeyType="invalidPublicKeyType",t.InvalidSignature="invalidSignature",t.NotFound="notFound",t.RepresentationNotSupported="representationNotSupported",t.UnsupportedPublicKeyType="unsupportedPublicKeyType"})(nt||(nt={}))});var P2={};Ur(P2,{extractDidFragment:()=>Ja,getServices:()=>YXe,getVerificationMethodByKey:()=>ZXe,getVerificationMethodTypes:()=>WK,getVerificationMethods:()=>Z3,getVerificationRelationshipsById:()=>VK,isDidService:()=>Fve,isDidVerificationMethod:()=>Yk,isDwnDidService:()=>XXe,keyBytesToMultibaseId:()=>Zk,multibaseIdToKeyBytes:()=>Xk});function Ja(t){if(typeof t=="string"&&t.length!==0)return t.split("#").pop()}function YXe({didDocument:t,id:e,type:r}){var n,i;return(i=(n=t?.service)===null||n===void 0?void 0:n.filter(o=>!(e&&o.id!==e||r&&o.type!==r)))!==null&&i!==void 0?i:[]}function ZXe(t){return JXe(this,arguments,void 0,function*({didDocument:e,publicKeyJwk:r,publicKeyMultibase:n}){let i=Z3({didDocument:e});for(let o of i)if(r&&o.publicKeyJwk){if((yield it({jwk:r}))===(yield it({jwk:o.publicKeyJwk})))return o}else if(n&&o.publicKeyMultibase&&n===o.publicKeyMultibase)return o;return null})}function Z3({didDocument:t}){var e,r;if(!t)throw new TypeError("Required parameter missing: 'didDocument'");let n=[];return n.push(...(r=(e=t.verificationMethod)===null||e===void 0?void 0:e.filter(Yk))!==null&&r!==void 0?r:[]),Object.keys(Dv).forEach(i=>{var o,s;n.push(...(s=(o=t[i])===null||o===void 0?void 0:o.filter(Yk))!==null&&s!==void 0?s:[])}),n}function WK({didDocument:t}){let r=Z3({didDocument:t}).map(n=>n.type);return[...new Set(r)]}function VK({didDocument:t,methodId:e}){let r=[];return Object.keys(Dv).forEach(n=>{if(Array.isArray(t[n])){let i=t[n],o=Ja(e);i.some(a=>{let d=Ja(a)===o,u=Yk(a)&&Ja(a.id)===o;return d||u})&&r.push(n)}}),r}function Fve(t){return!t||typeof t!="object"||t===null?!1:"id"in t&&"type"in t&&"serviceEndpoint"in t}function XXe(t){if(!Fve(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 Yk(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 Zk({keyBytes:t,multicodecCode:e,multicodecName:r}){let n=bi.addPrefix({code:e,data:t,name:r}),i=de.uint8Array(n).toBase58Btc();return de.base58Btc(i).toMultibase()}function Xk({multibaseKeyId:t}){try{let e=de.multibase(t).toBase58Btc(),r=de.base58Btc(e).toUint8Array(),{code:n,data:i,name:o}=bi.removePrefix({prefixedData:r});return{keyBytes:i,multicodecCode:n,multicodecName:o}}catch{throw new dt(nt.InvalidDid,`Invalid multibase identifier: ${t}`)}}var JXe,k2=le(()=>{"use strict";h();Tr();tn();Qh();Jk();JXe=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})}});var X3,co,R2=le(()=>{"use strict";h();tn();Qh();k2();X3=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},co=class t{constructor({uri:e,document:r,metadata:n,keyManager:i}){this.uri=e,this.document=r,this.metadata=n,this.keyManager=i}export(){return X3(this,void 0,void 0,function*(){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=yield this.keyManager.getKeyUri({key:n.publicKeyJwk}),o=yield this.keyManager.exportKey({keyUri:i});r.push(Object.assign({},o))}e.privateKeys=r}return e})}getSigner(e){return X3(this,void 0,void 0,function*(){var r;let n=(r=this.document.verificationMethod)===null||r===void 0?void 0:r.find(d=>{var u,c;return Ja(d.id)===((u=Ja(e?.methodId))!==null&&u!==void 0?u:Ja((c=this.document.assertionMethod)===null||c===void 0?void 0:c[0]))});if(!(n&&n.publicKeyJwk))throw new dt(nt.InternalError,"A verification method intended for signing could not be determined from the DID Document");let i=yield this.keyManager.getKeyUri({key:n.publicKeyJwk}),o=yield this.keyManager.getPublicKey({keyUri:i}),s=this.keyManager;return{algorithm:Mi.getJoseSignatureAlgorithmFromPublicKey(o),keyId:n.id,sign(d){return X3(this,arguments,void 0,function*({data:u}){return yield s.sign({data:u,keyUri:i})})},verify(d){return X3(this,arguments,void 0,function*({data:u,signature:c}){return yield s.verify({data:u,key:o,signature:c})})}}})}static import(e){return X3(this,arguments,void 0,function*({portableDid:r,keyManager:n=new Pr}){var i;let o=Z3({didDocument:r.document});if(o.length===0)throw new dt(nt.InvalidDidDocument,"At least one verification method is required but 0 were given");for(let a of(i=r.privateKeys)!==null&&i!==void 0?i:[])yield n.importKey({key:a});for(let a of o){if(!a.publicKeyJwk)throw new Error(`Verification method '${a.id}' does not contain a public key in JWK format`);let d=yield n.getKeyUri({key:a.publicKeyJwk});yield n.getPublicKey({keyUri:d})}return new t({uri:r.uri,document:r.document,metadata:r.metadata,keyManager:n})})}}});var zve,qd,Bv=le(()=>{"use strict";h();zve=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},qd=class{static getSigningMethod(e){return zve(this,void 0,void 0,function*(){throw new Error("Not implemented: Classes extending DidMethod must implement getSigningMethod()")})}static resolve(e,r){return zve(this,void 0,void 0,function*(){throw new Error("Not implemented: Classes extending DidMethod must implement resolve()")})}}});var $o,Wve,Vve,QXe,Ty,Qk,wa,HK,_a,GK,Gve,Hve,Ya,eR,Oo,Jve=le(()=>{"use strict";h();XL();Tr();tn();cK();Ay();Bv();R2();k2();Qh();Jk();Sy();$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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Wve=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!(N.algorithm in Gve)))throw new Error("One or more verification method algorithms are not supported");let g=(i=r.verificationMethods)===null||i===void 0?void 0:i.filter(N=>"id"in N).map(N=>N.id);if(g&&g.length!==new Set(g).size)throw new Error("One or more verification method IDs are not unique");if(!((o=r.services)===null||o===void 0)&&o.some(N=>!N.id||!N.type||!N.serviceEndpoint))throw new Error("One or more services are missing required properties");let v=yield e.generateKey({algorithm:"Ed25519"}),E=yield e.getPublicKey({keyUri:v}),A=yield Oo.identityKeyToIdentifier({identityKey:E}),P=Object.assign(Object.assign({id:A},r.alsoKnownAs&&{alsoKnownAs:r.alsoKnownAs}),r.controllers&&{controller:r.controllers}),I=[...(s=r.verificationMethods)!==null&&s!==void 0?s:[]];I?.some(N=>{var K;return((K=N.id)===null||K===void 0?void 0:K.split("#").pop())==="0"})||I.unshift({algorithm:"Ed25519",id:"0",purposes:["authentication","assertionMethod","capabilityDelegation","capabilityInvocation"]});for(let N of I){let K=N.id&&N.id.split("#").pop()==="0"?v:yield e.generateKey({algorithm:N.algorithm}),F=yield e.getPublicKey({keyUri:K}),U=(d=(a=N.id)!==null&&a!==void 0?a:F.kid)!==null&&d!==void 0?d:yield it({jwk:F});U=`${A}#${Ja(U)}`,(u=P.verificationMethod)!==null&&u!==void 0||(P.verificationMethod=[]),P.verificationMethod.push({id:U,type:"JsonWebKey",controller:(c=N.controller)!==null&&c!==void 0?c:A,publicKeyJwk:F});for(let W of(l=N.purposes)!==null&&l!==void 0?l:[])P[W]||(P[W]=[]),P[W].push(U)}(m=r.services)===null||m===void 0||m.forEach(N=>{var K;(K=P.service)!==null&&K!==void 0||(P.service=[]),N.id=`${A}#${N.id.split("#").pop()}`,P.service.push(N)});let $=new co({uri:A,document:P,metadata:Object.assign({published:!1},r.types&&{types:r.types}),keyManager:e});if(!((p=r.publish)!==null&&p!==void 0)||p){let N=yield t.publish({did:$,gatewayUri:r.gatewayUri});$.metadata=N.didDocumentMetadata}return $})}static import(e){return $o(this,arguments,void 0,function*({portableDid:r,keyManager:n=new Pr}){var i;let o=cr.parse(r.uri);if(o?.method!==t.methodName)throw new dt(nt.MethodNotSupported,"Method not supported");let s=yield co.import({portableDid:r,keyManager:n});if(!(!((i=s.document.verificationMethod)===null||i===void 0)&&i.some(a=>{var d;return((d=a.id)===null||d===void 0?void 0:d.split("#").pop())==="0"})))throw new dt(nt.InvalidDidDocument,"DID document must contain an Identity Key");return s})}static getSigningMethod(e){return $o(this,arguments,void 0,function*({didDocument:r,methodId:n="#0"}){var i;let o=cr.parse(r.id);if(o&&o.method!==this.methodName)throw new dt(nt.MethodNotSupported,`Method not supported: ${o.method}`);let s=(i=r.verificationMethod)===null||i===void 0?void 0:i.find(a=>{var d,u;return Ja(a.id)===((d=Ja(n))!==null&&d!==void 0?d:Ja((u=r.assertionMethod)===null||u===void 0?void 0:u[0]))});if(!(s&&s.publicKeyJwk))throw new dt(nt.InternalError,"A verification method intended for signing could not be determined from the DID Document");return s})}static publish(e){return $o(this,arguments,void 0,function*({did:r,gatewayUri:n=Vve}){return yield eR.put({did:r,gatewayUri:n})})}static resolve(e){return $o(this,arguments,void 0,function*(r,n={}){var i;let o=(i=n?.gatewayUri)!==null&&i!==void 0?i:Vve;try{yield Oo.identifierToIdentityKey({didUri:r});let{didDocument:s,didDocumentMetadata:a}=yield eR.get({didUri:r,gatewayUri:o});return Object.assign(Object.assign({},si),{didDocument:s,didDocumentMetadata:a})}catch(s){if(!(s instanceof dt))throw new Error(s);return Object.assign(Object.assign({},si),{didResolutionMetadata:Object.assign({error:s.code},s.message&&{errorMessage:s.message})})}})}};Ya.methodName="dht";eR=class t{static get(e){return $o(this,arguments,void 0,function*({didUri:r,gatewayUri:n}){let i=Oo.identifierToIdentityKeyBytes({didUri:r}),o=yield t.pkarrGet({gatewayUri:n,publicKeyBytes:i}),s=yield Oo.parseBep44GetMessage({bep44Message:o}),a=yield t.fromDnsPacket({didUri:r,dnsPacket:s});return a.didDocumentMetadata.versionId=o.seq.toString(),a})}static put(e){return $o(this,arguments,void 0,function*({did:r,gatewayUri:n}){let i=yield t.toDnsPacket({didDocument:r.document,didMetadata:r.metadata,authoritativeGatewayUris:[n]}),o=yield Oo.createBep44PutMessage({dnsPacket:i,publicKeyBytes:Oo.identifierToIdentityKeyBytes({didUri:r.uri}),signer:yield r.getSigner({methodId:"0"})}),s=yield t.pkarrPut({gatewayUri:n,bep44Message:o});return{didDocument:r.document,didDocumentMetadata:Object.assign(Object.assign({},r.metadata),{published:s,versionId:o.seq.toString()}),didRegistrationMetadata:{}}})}static pkarrGet(e){return $o(this,arguments,void 0,function*({gatewayUri:r,publicKeyBytes:n}){let i=de.uint8Array(n).toBase32Z(),o=new URL(i,r).href,s;try{if(s=yield fetch(o,{method:"GET"}),!s.ok)throw new dt(nt.NotFound,`Pkarr record not found for: ${i}`)}catch(u){throw u instanceof dt?u:new dt(nt.InternalError,`Failed to fetch Pkarr record: ${u.message}`)}let a=yield s.arrayBuffer();if(!a)throw new dt(nt.NotFound,`Pkarr record not found for: ${i}`);if(a.byteLength<72)throw new dt(nt.InvalidDidDocumentLength,`Pkarr response must be at least 72 bytes but got: ${a.byteLength}`);if(a.byteLength>1072)throw new dt(nt.InvalidDidDocumentLength,`Pkarr response exceeds 1000 byte limit: ${a.byteLength}`);return{k:n,seq:Number(new DataView(a).getBigUint64(64)),sig:new Uint8Array(a,0,64),v:new Uint8Array(a,72)}})}static pkarrPut(e){return $o(this,arguments,void 0,function*({gatewayUri:r,bep44Message:n}){let i=de.uint8Array(n.k).toBase32Z(),o=new URL(i,r).href,s=new Uint8Array(n.v.length+72);s.set(n.sig,0),new DataView(s.buffer).setBigUint64(n.sig.length,BigInt(n.seq)),s.set(n.v,n.sig.length+8);let a;try{a=yield fetch(o,{method:"PUT",headers:{"Content-Type":"application/octet-stream"},body:s})}catch(d){throw new dt(nt.InternalError,`Failed to put Pkarr record for identifier ${i}: ${d.message}`)}return a.ok})}static fromDnsPacket(e){return $o(this,arguments,void 0,function*({didUri:r,dnsPacket:n}){var i,o,s;let a={id:r},d={published:!0},u=new Map;for(let c of(i=n?.answers)!==null&&i!==void 0?i:[]){if(c.type!=="TXT")continue;let l=c.name.split(".")[0].substring(1);switch(!0){case l.startsWith("aka"):{let m=Oo.parseTxtDataToString(c.data);a.alsoKnownAs=m.split(wa);break}case l.startsWith("cnt"):{let m=Oo.parseTxtDataToString(c.data);a.controller=m.includes(wa)?m.split(wa):m;break}case l.startsWith("k"):{let{id:m,t:p,k:g,c:v,a:E}=Oo.parseTxtDataToObject(c.data),A=de.base64Url(g).toUint8Array(),P=_a[Number(p)],I=yield Oo.keyConverter(P).bytesToPublicKey({publicKeyBytes:A});I.alg=E||Hve[Number(p)];let $=l==="k0"?"0":m!==void 0?m:yield it({jwk:I});(o=a.verificationMethod)!==null&&o!==void 0||(a.verificationMethod=[]);let N=`${r}#${$}`;a.verificationMethod.push({id:N,type:"JsonWebKey",controller:v??r,publicKeyJwk:I}),u.set(l,N);break}case l.startsWith("s"):{let m=Oo.parseTxtDataToObject(c.data),{id:p,t:g,se:v}=m,E=Wve(m,["id","t","se"]),A=v.includes(wa)?v.split(wa):[v],P=Object.fromEntries(Object.entries(E).map(([I,$])=>[I,$.includes(wa)?$.split(wa):$]));(s=a.service)!==null&&s!==void 0||(a.service=[]),a.service.push(Object.assign(Object.assign({},P),{id:`${r}#${p}`,type:g,serviceEndpoint:A}));break}case l.startsWith("typ"):{let{id:m}=Oo.parseTxtDataToObject(c.data);d.types=m.split(wa).map(p=>Number(p));break}case l.startsWith("did"):{let m=P=>P.split(wa).map(I=>u.get(I)).filter(I=>typeof I=="string"),{auth:p,asm:g,del:v,inv:E,agm:A}=Oo.parseTxtDataToObject(c.data);p&&(a.authentication=m(p)),g&&(a.assertionMethod=m(g)),v&&(a.capabilityDelegation=m(v)),E&&(a.capabilityInvocation=m(E)),A&&(a.keyAgreement=m(A));break}}}return{didDocument:a,didDocumentMetadata:d,didResolutionMetadata:{}}})}static toDnsPacket(e){return $o(this,arguments,void 0,function*({didDocument:r,didMetadata:n,authoritativeGatewayUris:i,previousDidProof:o}){var s,a,d,u,c;let l=[],m=[],p=new Map,g=[],v=[];if(o!==void 0){let{signature:P,previousDid:I}=o;yield Oo.validatePreviousDidProof({newDid:r.id,previousDidProof:o}),l.push({type:"TXT",name:"_prv._did.",ttl:Ty,data:`id=${I};s=${P}`})}if(r.alsoKnownAs&&l.push({type:"TXT",name:"_aka._did.",ttl:Ty,data:r.alsoKnownAs.join(wa)}),r.controller){let P=Array.isArray(r.controller)?r.controller.join(wa):r.controller;l.push({type:"TXT",name:"_cnt._did.",ttl:Ty,data:P})}for(let[P,I]of(a=(s=r.verificationMethod)===null||s===void 0?void 0:s.entries())!==null&&a!==void 0?a:[]){let $=`k${P}`;v.push($);let N=I.id.split("#").pop();p.set(N,$);let K=I.publicKeyJwk;if(!(K?.crv&&K.crv in Gve))throw new dt(nt.InvalidPublicKeyType,`Verification method '${I.id}' contains an unsupported key type: ${(d=K?.crv)!==null&&d!==void 0?d:"undefined"}`);let F=_a[K.crv],U=yield Oo.keyConverter(K.crv).publicKeyToBytes({publicKey:K}),W=de.uint8Array(U).toBase64Url(),L=[`t=${F}`,`k=${W}`];N!=="0"&&(yield it({jwk:K}))!==N&&L.unshift(`id=${N}`),K.alg!==Hve[F]&&L.push(`a=${K.alg}`),I.controller!==r.id&&L.push(`c=${I.controller}`),l.push({type:"TXT",name:`_${$}._did.`,ttl:Ty,data:L.join(Qk)})}(u=r.service)===null||u===void 0||u.forEach((P,I)=>{let $=`s${I}`;g.push($);let{id:N,type:K,serviceEndpoint:F}=P,U=Wve(P,["id","type","serviceEndpoint"]);N=Ja(N),F=Array.isArray(F)?F.join(","):F;let L=Object.entries(Object.assign({id:N,t:K,se:F},U)).map(([S,k])=>`${S}=${k}`).join(Qk),T=Oo.chunkDataIfNeeded(L);l.push({type:"TXT",name:`_${$}._did.`,ttl:Ty,data:T})});let E=[`v=${QXe}`];if(v.length&&E.push(`vm=${v.join(wa)}`),Object.keys(Dv).forEach(P=>{var I;let $=(I=r[P])===null||I===void 0?void 0:I.map(N=>p.get(N.split("#").pop()));if($){let N=GK[P];E.push(`${N}=${$.join(wa)}`)}}),g.length&&E.push(`svc=${g.join(wa)}`),!((c=n.types)===null||c===void 0)&&c.length){let I=n.types.map($=>typeof $=="string"?HK[$]:$);l.push({type:"TXT",name:"_typ._did.",ttl:Ty,data:`id=${I.join(wa)}`})}l.push({type:"TXT",name:"_did."+t.getUniqueDidSuffix(r.id)+".",ttl:Ty,data:E.join(Qk)});for(let P of i||[])m.push({type:"NS",name:"_did."+t.getUniqueDidSuffix(r.id)+".",ttl:Ty,data:P+"."});return{id:0,type:"response",flags:rk,answers:[...l,...m]}})}static getUniqueDidSuffix(e){return e.split(":")[2]}},Oo=class t{static createBep44PutMessage(e){return $o(this,arguments,void 0,function*({dnsPacket:r,publicKeyBytes:n,signer:i}){let o=Math.ceil(Date.now()/1e3),s=mv(r),a=G1.encode({seq:o,v:s}).subarray(1,-1);if(a.length>1e3)throw new dt(nt.InvalidDidDocumentLength,`DNS packet exceeds the 1000 byte maximum size: ${a.length} bytes`);let d=yield i.sign({data:a});return{k:n,seq:o,sig:d,v:s}})}static identifierToIdentityKey(e){return $o(this,arguments,void 0,function*({didUri:r}){let n=t.identifierToIdentityKeyBytes({didUri:r});return yield nr.bytesToPublicKey({publicKeyBytes:n})})}static identifierToIdentityKeyBytes({didUri:e}){let r=cr.parse(e);if(!r)throw new dt(nt.InvalidDid,`Invalid DID URI: ${e}`);if(r.method!==Ya.methodName)throw new dt(nt.MethodNotSupported,`Method not supported: ${r.method}`);let n;try{n=de.base32Z(r.id).toUint8Array()}catch{throw new dt(nt.InvalidPublicKey,"Failed to decode method-specific identifier")}if(n.length!==32)throw new dt(nt.InvalidPublicKeyLength,`Invalid public key length: ${n.length}`);return n}static identityKeyToIdentifier(e){return $o(this,arguments,void 0,function*({identityKey:r}){let n=yield nr.publicKeyToBytes({publicKey:r}),i=de.uint8Array(n).toBase32Z();return`did:${Ya.methodName}:${i}`})}static keyConverter(e){let n={Ed25519:nr,"P-256":{publicKeyToBytes:i=>$o(this,[i],void 0,function*({publicKey:o}){let s=yield Nr.publicKeyToBytes({publicKey:o});return yield Nr.compressPublicKey({publicKeyBytes:s})}),bytesToPublicKey:Nr.bytesToPublicKey,privateKeyToBytes:Nr.privateKeyToBytes,bytesToPrivateKey:Nr.bytesToPrivateKey},secp256k1:{publicKeyToBytes:i=>$o(this,[i],void 0,function*({publicKey:o}){let s=yield Ir.publicKeyToBytes({publicKey:o});return yield Ir.compressPublicKey({publicKeyBytes:s})}),bytesToPublicKey:Ir.bytesToPublicKey,privateKeyToBytes:Ir.privateKeyToBytes,bytesToPrivateKey:Ir.bytesToPrivateKey},X25519:df}[e];if(!n)throw new dt(nt.InvalidPublicKeyType,`Unsupported curve: ${e}`);return n}static parseBep44GetMessage(e){return $o(this,arguments,void 0,function*({bep44Message:r}){let n=yield nr.bytesToPublicKey({publicKeyBytes:r.k}),i=G1.encode({seq:r.seq,v:r.v}).subarray(1,-1);if(!(yield nr.verify({key:n,signature:r.sig,data:i})))throw new dt(nt.InvalidSignature,"Invalid signature for DHT BEP44 message");return n2(r.v)})}static parseTxtDataToObject(e){return this.parseTxtDataToString(e).split(Qk).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 de.uint8Array(e).toString();if(Array.isArray(e))return e.map(r=>this.parseTxtDataToString(r)).join("");throw new dt(nt.InternalError,"Pkarr returned DNS TXT record with invalid data type")}static validatePreviousDidProof(e){return $o(this,arguments,void 0,function*({newDid:r,previousDidProof:n}){let i=yield t.identifierToIdentityKey({didUri:n.previousDid}),o=t.identifierToIdentityKeyBytes({didUri:r}),s=de.base64Url(n.signature).toUint8Array();if(!(yield nr.verify({key:i,data:o,signature:s})))throw new dt(nt.InvalidPreviousDidProof,"The previous DID proof is invalid.")})}static chunkDataIfNeeded(e){if(e.length<=255)return e;let r=[];for(let n=0;n{"use strict";h();yK();tn();Ay();R2();Bv();Qh();k2();Sy();Iy=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})};(function(t){t.Ed25519="Ed25519",t.secp256k1="secp256k1",t.secp256r1="secp256r1",t.X25519="X25519"})(mf||(mf={}));eQe={Ed25519:mf.Ed25519,ES256K:mf.secp256k1,ES256:mf.secp256r1,"P-256":mf.secp256r1,secp256k1:mf.secp256k1,secp256r1:mf.secp256r1},Yve="https://ion.tbd.engineering",JK=class t extends qd{static create(){return Iy(this,arguments,void 0,function*({keyManager:e=new Pr,options:r={}}={}){var n,i,o,s,a,d,u;if(!((n=r.verificationMethods)===null||n===void 0)&&n.some(N=>!(N.algorithm in eQe)))throw new Error("One or more verification method algorithms are not supported");let c=(i=r.verificationMethods)===null||i===void 0?void 0:i.filter(N=>"id"in N).map(N=>N.id);if(c&&c.length!==new Set(c).size)throw new Error("One or more verification method IDs are not unique");if(!((o=r.services)===null||o===void 0)&&o.some(N=>!N.id||!N.type||!N.serviceEndpoint))throw new Error("One or more services are missing required properties");let l={algorithm:"Ed25519",purposes:["authentication","assertionMethod","capabilityDelegation","capabilityInvocation"]},m=[];for(let N of(s=r.verificationMethods)!==null&&s!==void 0?s:[l]){let K=yield e.generateKey({algorithm:N.algorithm}),F=yield e.getPublicKey({keyUri:K});m.push({id:N.id,publicKeyJwk:F,purposes:(a=N.purposes)!==null&&a!==void 0?a:["authentication","assertionMethod","capabilityDelegation","capabilityInvocation"]})}let p=yield e.generateKey({algorithm:mf.secp256k1}),g=yield e.getPublicKey({keyUri:p}),v=yield e.generateKey({algorithm:mf.secp256k1}),E=yield e.getPublicKey({keyUri:v}),A=yield Mv.computeLongFormDidUri({recoveryKey:g,updateKey:E,services:(d=r.services)!==null&&d!==void 0?d:[],verificationMethods:m}),{didDocument:P,didResolutionMetadata:I}=yield t.resolve(A,{gatewayUri:r.gatewayUri});if(P===null)throw new Error(`Unable to resolve DID during creation: ${I?.error}`);let $=new co({uri:A,document:P,metadata:{published:!1,canonicalId:A.split(":",3).join(":"),recoveryKey:g,updateKey:E},keyManager:e});if(!((u=r.publish)!==null&&u!==void 0)||u){let N=yield t.publish({did:$,gatewayUri:r.gatewayUri});$.metadata=N.didDocumentMetadata}return $})}static getSigningMethod(e){return Iy(this,arguments,void 0,function*({didDocument:r,methodId:n}){var i;let o=cr.parse(r.id);if(o&&o.method!==this.methodName)throw new dt(nt.MethodNotSupported,`Method not supported: ${o.method}`);let s=(i=r.verificationMethod)===null||i===void 0?void 0:i.find(a=>{var d;return a.id===(n??((d=r.assertionMethod)===null||d===void 0?void 0:d[0]))});if(!(s&&s.publicKeyJwk))throw new dt(nt.InternalError,"A verification method intended for signing could not be determined from the DID Document");return s})}static import(e){return Iy(this,arguments,void 0,function*({portableDid:r,keyManager:n=new Pr}){let i=cr.parse(r.uri);if(i?.method!==t.methodName)throw new dt(nt.MethodNotSupported,"Method not supported");return yield co.import({portableDid:r,keyManager:n})})}static publish(e){return Iy(this,arguments,void 0,function*({did:r,gatewayUri:n=Yve}){var i,o,s;let a=(o=(i=r.document.verificationMethod)===null||i===void 0?void 0:i.map(c=>({id:c.id,publicKeyJwk:c.publicKeyJwk,purposes:VK({didDocument:r.document,methodId:c.id})})))!==null&&o!==void 0?o:[],d=yield Mv.createIonDocument({services:(s=r.document.service)!==null&&s!==void 0?s:[],verificationMethods:a}),u=yield Mv.constructCreateRequest({ionDocument:d,recoveryKey:r.metadata.recoveryKey,updateKey:r.metadata.updateKey});try{let c=Mv.appendPathToUrl({baseUrl:n,path:"/operations"}),l=yield fetch(c,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});return{didDocument:r.document,didDocumentMetadata:Object.assign(Object.assign({},r.metadata),{published:l.ok}),didRegistrationMetadata:{}}}catch{return{didDocument:null,didDocumentMetadata:{published:!1},didRegistrationMetadata:{error:nt.InternalError,errorMessage:`Failed to publish DID document for: ${r.uri}`}}}})}static resolve(e){return Iy(this,arguments,void 0,function*(r,n={}){var i,o;let s=cr.parse(r);if(!s)return Object.assign(Object.assign({},si),{didResolutionMetadata:{error:"invalidDid"}});if(s.method!==t.methodName)return Object.assign(Object.assign({},si),{didResolutionMetadata:{error:"methodNotSupported"}});let a=(i=n?.gatewayUri)!==null&&i!==void 0?i:Yve;try{let d=Mv.appendPathToUrl({baseUrl:a,path:`/identifiers/${r}`}),u=yield fetch(d);if(!u.ok)throw new dt(nt.NotFound,`Unable to find DID document for: ${r}`);let{didDocument:c,didDocumentMetadata:l}=yield u.json();return Object.assign(Object.assign(Object.assign({},si),c&&{didDocument:c}),{didDocumentMetadata:Object.assign({published:(o=l?.method)===null||o===void 0?void 0:o.published},l)})}catch(d){if(!(d instanceof dt))throw new Error(d);return Object.assign(Object.assign({},si),{didResolutionMetadata:Object.assign({error:d.code},d.message&&{errorMessage:d.message})})}})}};JK.methodName="ion";Mv=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 computeLongFormDidUri(e){return Iy(this,arguments,void 0,function*({recoveryKey:r,updateKey:n,services:i,verificationMethods:o}){let s=yield t.createIonDocument({services:i,verificationMethods:o}),a=t.normalizeJwk(r),d=t.normalizeJwk(n);return yield yy.createLongFormDid({document:s,recoveryKey:a,updateKey:d})})}static constructCreateRequest(e){return Iy(this,arguments,void 0,function*({ionDocument:r,recoveryKey:n,updateKey:i}){return yield hf.createCreateRequest({document:r,recoveryKey:t.normalizeJwk(n),updateKey:t.normalizeJwk(i)})})}static createIonDocument(e){return Iy(this,arguments,void 0,function*({services:r,verificationMethods:n}){var i,o;let s=[];for(let u of n){let c=(o=(i=u.id)!==null&&i!==void 0?i:u.publicKeyJwk.kid)!==null&&o!==void 0?o:yield it({jwk:u.publicKeyJwk});c=`${c.split("#").pop()}`;let l={id:c,publicKeyJwk:t.normalizeJwk(u.publicKeyJwk),purposes:u.purposes,type:"JsonWebKey2020"};s.push(l)}let a=r.map(u=>Object.assign(Object.assign({},u),{id:`${u.id.split("#").pop()}`}));return{publicKeys:s,services:a}})}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 tR,Py,Xve=le(()=>{"use strict";h();Tr();tn();Ay();Bv();R2();Qh();Sy();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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Py=class t extends qd{static create(){return tR(this,arguments,void 0,function*({keyManager:e=new Pr,options:r={}}={}){var n,i,o,s;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 a=(s=(n=r.algorithm)!==null&&n!==void 0?n:(o=(i=r.verificationMethods)===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.algorithm)!==null&&s!==void 0?s:"Ed25519",d=yield e.generateKey({algorithm:a}),u=yield e.getPublicKey({keyUri:d}),c=de.object(u).toBase64Url(),l=`did:${t.methodName}:${c}`,p=(yield t.resolve(l)).didDocument;return new co({uri:l,document:p,metadata:{},keyManager:e})})}static getSigningMethod(e){return tR(this,arguments,void 0,function*({didDocument:r}){var n;let i=cr.parse(r.id);if(i&&i.method!==this.methodName)throw new dt(nt.MethodNotSupported,`Method not supported: ${i.method}`);let[o]=(n=r.verificationMethod)!==null&&n!==void 0?n:[];if(!(o&&o.publicKeyJwk))throw new dt(nt.InternalError,"A verification method intended for signing could not be determined from the DID Document");return o})}static import(e){return tR(this,arguments,void 0,function*({portableDid:r,keyManager:n=new Pr}){let i=cr.parse(r.uri);if(i?.method!==t.methodName)throw new dt(nt.MethodNotSupported,"Method not supported");let o=yield co.import({portableDid:r,keyManager:n});if(o.document.verificationMethod.length!==1)throw new dt(nt.InvalidDidDocument,"DID document must contain exactly one verification method");return o})}static resolve(e,r){return tR(this,void 0,void 0,function*(){let n=cr.parse(e),i;try{i=de.base64Url(n.id).toObject()}catch{}if(!n||!i)return Object.assign(Object.assign({},si),{didResolutionMetadata:{error:"invalidDid"}});if(n.method!==t.methodName)return Object.assign(Object.assign({},si),{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 Object.assign(Object.assign({},si),{didDocument:o})})}};Py.methodName="jwk"});var Gu,ep,YK,tQe,ZK,Za,Qve=le(()=>{"use strict";h();Tr();tn();Ay();Bv();R2();Qh();Sy();k2();Gu=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})};(function(t){t.Ed25519="Ed25519",t.secp256k1="secp256k1",t.secp256r1="secp256r1",t.X25519="X25519"})(ep||(ep={}));YK={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"},tQe={Ed25519:ep.Ed25519,ES256K:ep.secp256k1,ES256:ep.secp256r1,"P-256":ep.secp256r1,secp256k1:ep.secp256k1,secp256r1:ep.secp256r1,X25519:ep.X25519},ZK=class t extends qd{static create(){return Gu(this,arguments,void 0,function*({keyManager:e=new Pr,options:r={}}={}){var n,i,o,s;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 a=(s=(n=r.algorithm)!==null&&n!==void 0?n:(o=(i=r.verificationMethods)===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.algorithm)!==null&&s!==void 0?s:"Ed25519",d=yield e.generateKey({algorithm:a}),u=yield e.getPublicKey({keyUri:d}),c=yield Za.publicKeyToMultibaseId({publicKey:u}),l=`did:${t.methodName}:${c}`,p=(yield t.resolve(l,r)).didDocument;return new co({uri:l,document:p,metadata:{},keyManager:e})})}static getSigningMethod(e){return Gu(this,arguments,void 0,function*({didDocument:r}){var n;let i=cr.parse(r.id);if(i&&i.method!==this.methodName)throw new dt(nt.MethodNotSupported,`Method not supported: ${i.method}`);let[o]=r.assertionMethod||[],s=(n=r.verificationMethod)===null||n===void 0?void 0:n.find(a=>a.id===o);if(!(s&&s.publicKeyJwk))throw new dt(nt.InternalError,"A verification method intended for signing could not be determined from the DID Document");return s})}static import(e){return Gu(this,arguments,void 0,function*({portableDid:r,keyManager:n=new Pr}){let i=cr.parse(r.uri);if(i?.method!==t.methodName)throw new dt(nt.MethodNotSupported,"Method not supported");let o=yield co.import({portableDid:r,keyManager:n});if(o.document.verificationMethod.length!==1)throw new dt(nt.InvalidDidDocument,"DID document must contain exactly one verification method");return o})}static resolve(e,r){return Gu(this,void 0,void 0,function*(){try{let n=yield t.createDocument({didUri:e,options:r});return Object.assign(Object.assign({},si),{didDocument:n})}catch(n){if(!(n instanceof dt))throw new Error(n);return Object.assign(Object.assign({},si),{didResolutionMetadata:Object.assign({error:n.code},n.message&&{errorMessage:n.message})})}})}static createDocument(e){return Gu(this,arguments,void 0,function*({didUri:r,options:n={}}){let{defaultContext:i="https://www.w3.org/ns/did/v1",enableEncryptionKeyDerivation:o=!1,enableExperimentalPublicKeyTypes:s=!1,publicKeyFormat:a="JsonWebKey2020"}=n,d={id:""},u=cr.parse(r);if(!u)throw new dt(nt.InvalidDid,`Invalid DID URI: ${r}`);let c=u.id;if(u.method!==t.methodName)throw new dt(nt.MethodNotSupported,`Method not supported: ${u.method}`);if(!t.validateIdentifier(u))throw new dt(nt.InvalidDid,`Invalid DID URI: ${r}`);let l=yield t.createSignatureMethod({didUri:r,multibaseValue:c,options:{enableExperimentalPublicKeyTypes:s,publicKeyFormat:a}});if(d.id=u.uri,d.verificationMethod=[l],d.authentication=[l.id],d.assertionMethod=[l.id],d.capabilityInvocation=[l.id],d.capabilityDelegation=[l.id],o===!0){let g=a==="Ed25519VerificationKey2020"?"X25519KeyAgreementKey2020":"JsonWebKey2020",v=yield this.createEncryptionMethod({didUri:r,multibaseValue:c,options:{enableExperimentalPublicKeyTypes:s,publicKeyFormat:g}});d.verificationMethod.push(v),d.keyAgreement=[v.id]}let m=[i];return WK({didDocument:d}).forEach(g=>{let v=YK[g];m.push(v)}),d["@context"]=m,d})}static createEncryptionMethod(e){return Gu(this,arguments,void 0,function*({didUri:r,multibaseValue:n,options:i}){let{enableExperimentalPublicKeyTypes:o,publicKeyFormat:s}=i,a={id:"",type:"",controller:""},{keyBytes:d,multicodecCode:u}=yield t.deriveEncryptionKey({multibaseValue:n}),c=d.byteLength,l=Za.MULTICODEC_PUBLIC_KEY_LENGTH[u];if(c!==l)throw new dt(nt.InvalidPublicKeyLength,`Expected ${c} bytes. Actual: ${l}`);let m=Zk({keyBytes:d,multicodecCode:u});a.id=`${r}#${m}`;try{new URL(a.id)}catch{throw new dt(nt.InvalidDidUrl,"Verification Method ID is not a valid DID URL.")}if(!(s in YK))throw new dt(nt.UnsupportedPublicKeyType,`Unsupported format: ${s}`);if(o===!1&&!["Multikey","JsonWebKey2020","X25519KeyAgreementKey2020"].includes(s))throw new dt(nt.InvalidPublicKeyType,`Specified '${s}' without setting enableExperimentalPublicKeyTypes to true.`);if(a.type=s,a.controller=r,s==="X25519KeyAgreementKey2020"&&(a.publicKeyMultibase=m),s==="JsonWebKey2020"){let{crv:g}=yield Za.multicodecToJwk({code:u});a.publicKeyJwk=yield Za.keyConverter(g).bytesToPublicKey({publicKeyBytes:d})}return a})}static createSignatureMethod(e){return Gu(this,arguments,void 0,function*({didUri:r,multibaseValue:n,options:i}){let{enableExperimentalPublicKeyTypes:o,publicKeyFormat:s}=i,a={id:"",type:"",controller:""},{keyBytes:d,multicodecCode:u,multicodecName:c}=Xk({multibaseKeyId:n}),l=d.byteLength,m=Za.MULTICODEC_PUBLIC_KEY_LENGTH[u];if(l!==m)throw new dt(nt.InvalidPublicKeyLength,`Expected ${l} bytes. Actual: ${m}`);let p=!1;switch(c){case"secp256k1-pub":p=yield Ir.validatePublicKey({publicKeyBytes:d});break;case"ed25519-pub":p=yield nr.validatePublicKey({publicKeyBytes:d});break;case"x25519-pub":p=!0;break}if(!p)throw new dt(nt.InvalidPublicKey,"Invalid public key detected.");a.id=`${r}#${n}`;try{new URL(a.id)}catch{throw new dt(nt.InvalidDidUrl,"Verification Method ID is not a valid DID URL.")}if(!(s in YK))throw new dt(nt.UnsupportedPublicKeyType,`Unsupported format: ${s}`);if(o===!1&&!["Multikey","JsonWebKey2020","Ed25519VerificationKey2020"].includes(s))throw new dt(nt.InvalidPublicKeyType,`Specified '${s}' without setting enableExperimentalPublicKeyTypes to true.`);if(a.type=s,a.controller=r,s==="Ed25519VerificationKey2020"&&(a.publicKeyMultibase=n),s==="JsonWebKey2020"){let{crv:v}=yield Za.multicodecToJwk({code:u});a.publicKeyJwk=yield Za.keyConverter(v).bytesToPublicKey({publicKeyBytes:d})}return a})}static deriveEncryptionKey(e){return Gu(this,arguments,void 0,function*({multibaseValue:r}){let n={keyBytes:new Uint8Array,multicodecCode:0},{keyBytes:i,multicodecCode:o}=Xk({multibaseKeyId:r});if(o===237){let s=yield Za.keyConverter("Ed25519").bytesToPublicKey({publicKeyBytes:i}),a=yield nr.convertPublicKeyToX25519({publicKey:s});n={keyBytes:yield Za.keyConverter("Ed25519").publicKeyToBytes({publicKey:a}),multicodecCode:236}}return n})}static validateIdentifier(e){let{method:r,id:n}=e,[i]=e.uri.split(":",1);return i==="did"&&r==="key"&&Number("1")>0&&Xl(n)==="String"&&n.startsWith("z")}};ZK.methodName="key";Za=class t{static jwkToMulticodec(e){return Gu(this,arguments,void 0,function*({jwk:r}){let n=[];r.crv&&(n.push(r.crv),r.d?n.push("private"):n.push("public"));let i=n.join(":"),o=t.JWK_TO_MULTICODEC[i];if(o===void 0)throw new Error(`Unsupported JWK to Multicodec conversion: '${i}'`);return{code:bi.getCodeFromName({name:o}),name:o}})}static keyCompressor(e){let n={"P-256":Nr.compressPublicKey,secp256k1:Ir.compressPublicKey}[e];if(!n)throw new dt(nt.InvalidPublicKeyType,`Unsupported curve: ${e}`);return n}static keyConverter(e){let n={Ed25519:nr,"P-256":Nr,secp256k1:Ir,X25519:df}[e];if(!n)throw new dt(nt.InvalidPublicKeyType,`Unsupported curve: ${e}`);return n}static multicodecToJwk(e){return Gu(this,arguments,void 0,function*({code:r,name:n}){if(!(n?!r:r))throw new Error("Either 'name' or 'code' must be defined, but not both.");n=n===void 0?bi.getNameFromCode({code:r}):n;let i=n,o=t.MULTICODEC_TO_JWK[i];if(o===void 0)throw new Error("Unsupported Multicodec to JWK conversion");return Object.assign({},o)})}static publicKeyToMultibaseId(e){return Gu(this,arguments,void 0,function*({publicKey:r}){var n;if(!(r?.crv&&r.crv in tQe))throw new dt(nt.InvalidPublicKeyType,`Public key contains an unsupported key type: ${(n=r?.crv)!==null&&n!==void 0?n:"undefined"}`);let i=yield t.keyConverter(r.crv).publicKeyToBytes({publicKey:r});/^(secp256k1|P-256|P-384|P-521)$/.test(r.crv)&&(i=yield t.keyCompressor(r.crv)({publicKeyBytes:i}));let{name:o}=yield t.jwkToMulticodec({jwk:r});return Zk({keyBytes:i,multicodecName:o})})}};Za.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"};Za.MULTICODEC_PUBLIC_KEY_LENGTH={231:33,236:32,237:32};Za.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 rQe,Q3,ebe=le(()=>{"use strict";h();Ay();Bv();Sy();rQe=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Q3=class t extends qd{static resolve(e,r){return rQe(this,void 0,void 0,function*(){let n=cr.parse(e);if(!n)return Object.assign(Object.assign({},si),{didResolutionMetadata:{error:"invalidDid"}});if(n.method!==t.methodName)return Object.assign(Object.assign({},si),{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=yield fetch(o);if(!s.ok)throw new Error("HTTP error status code returned");let a=yield s.json();return Object.assign(Object.assign({},si),{didDocument:a})}catch{return Object.assign(Object.assign({},si),{didResolutionMetadata:{error:"notFound"}})}})}};Q3.methodName="web"});var tbe,rbe,nQe,Cv,nbe=le(()=>{"use strict";h();tbe=Kt(wv(),1),rbe=Kt(wK(),1),nQe=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Cv=class{constructor({db:e,location:r="DATA/DID_RESOLVERCACHE",ttl:n="15m"}={}){this.cache=e??new rbe.Level(r),this.ttl=(0,tbe.default)(n)}get(e){return nQe(this,void 0,void 0,function*(){try{let r=yield 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 ibe,XK=le(()=>{"use strict";h();ibe={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 obe,ky,sbe=le(()=>{"use strict";h();Ay();Qh();XK();Sy();obe=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},ky=class{constructor({cache:e,didResolvers:r}){this.didResolvers=new Map,this.cache=e||ibe;for(let n of r)this.didResolvers.set(n.methodName,n)}resolve(e,r){return obe(this,void 0,void 0,function*(){let n=cr.parse(e);if(!n)return Object.assign(Object.assign({},si),{didResolutionMetadata:{error:nt.InvalidDid,errorMessage:`Invalid DID URI: ${e}`}});let i=this.didResolvers.get(n.method);if(!i)return Object.assign(Object.assign({},si),{didResolutionMetadata:{error:nt.MethodNotSupported,errorMessage:`Method not supported: ${n.method}`}});let o=yield this.cache.get(n.uri);if(o)return o;{let s=yield i.resolve(n.uri,r);return s.didResolutionMetadata.error||(yield this.cache.set(n.uri,s)),s}})}dereference(e,r){return obe(this,void 0,void 0,function*(){let n=cr.parse(e);if(!n)return{dereferencingMetadata:{error:nt.InvalidDidUrl},contentStream:null,contentMetadata:{}};let{didDocument:i,didResolutionMetadata:o,didDocumentMetadata:s}=yield 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:a=[],verificationMethod:d=[]}=i,u=new Set([e,n.fragment,`#${n.fragment}`]),c;for(let l of d)if(u.has(l.id)){c=l;break}for(let l of a)if(u.has(l.id)){c=l;break}return c?{dereferencingMetadata:{contentType:"application/did+json"},contentStream:c,contentMetadata:o}:{dereferencingMetadata:{error:nt.NotFound},contentStream:null,contentMetadata:{}}})}}});var tp=le(()=>{"use strict";h();Jk();Sy();Ay();Qh();R2();Jve();Zve();Xve();Qve();Bv();ebe();nbe();XK();sbe();k2()});var dbe=V(nR=>{"use strict";h();Object.defineProperty(nR,"__esModule",{value:!0});nR.ReadableWebToNodeStream=void 0;var oQe=f8(),eF=class extends oQe.Readable{constructor(e){super(),this.bytesRead=0,this.released=!1,this.reader=e.getReader()}async _read(){if(this.released){this.push(null);return}this.pendingRead=this.reader.read();let e=await this.pendingRead;delete this.pendingRead,e.done||this.released?this.push(null):(this.bytesRead+=e.value.length,this.push(e.value))}async waitForReadToComplete(){this.pendingRead&&await this.pendingRead}async close(){await this.syncAndRelease()}async syncAndRelease(){this.released=!0,await this.waitForReadToComplete(),await this.reader.releaseLock()}};nR.ReadableWebToNodeStream=eF});var VQe={};async function zQe(t,e,r){try{let n=await LQe.resolve(e);return await WQe(t,n.didDocument,r)}catch(n){return n instanceof Response?n:(console.log(`Error in DID URL fetch: ${n}`),new Response("DID URL fetch error",{status:500}))}}async function WQe(t,e,r){let n=e?.service?.find(i=>i.type==="DecentralizedWebNode")?.serviceEndpoint;if(n=(Array.isArray(n)?n:[n]).filter(i=>i.startsWith("http")),!n?.length)throw new Response("DWeb Node resolution failed: no valid endpoints found.",{status:530});for(let i of n)try{let o=await fetch(`${i.replace(Lbe,"")}/${r}`,{headers:t.request.headers});return o.ok?o:(console.log(`DWN endpoint error: ${o.status}`),new Response("DWeb Node request failed",{status:o.status}))}catch(o){return console.log(`DWN endpoint error: ${o}`),new Response("DWeb Node request failed: "+o,{status:500})}}var qQe,LQe,KQe,FQe,Lbe,Kbe=le(()=>{h();tp();qQe=self,LQe=new ky({didResolvers:[Ya,Q3]}),KQe=/^https?:\/\/dweb\/(([^/]+)\/.*)?$/,FQe=/^http:/,Lbe=/\/$/;qQe.addEventListener("fetch",t=>{let e=t.request.url.match(KQe);e&&t.respondWith((async()=>{let r=t.request.url.replace(FQe,"https:").replace(Lbe,"");return await caches.open("drl").then(i=>i.match(r))||zQe(t,e[2],e[1])})())})});var GQe={};Ur(GQe,{DidApi:()=>ES,DwnApi:()=>TS,Protocol:()=>q2,Record:()=>Nv,VcApi:()=>IS,Web5:()=>bF,getTechPreviewDwnEndpoints:()=>vF,installNetworkingFeatures:()=>HQe,utils:()=>gF});h();h();h();h();h();h();h();h();var VW=Kt(hz(),1);h();jR();var UR=new TextEncoder,m1e=new TextDecoder,Ze=class t{static base64UrlToBytes(e){return Gs.baseDecode(e)}static base64UrlToObject(e){let r=Gs.baseDecode(e);return t.bytesToObject(r)}static bytesToBase64Url(e){return Gs.baseEncode(e)}static bytesToString(e){return m1e.decode(e)}static bytesToObject(e){let r=t.bytesToString(e);return JSON.parse(r)}static objectToBytes(e){let r=JSON.stringify(e);return UR.encode(r)}static stringToBase64Url(e){let r=UR.encode(e);return Gs.baseEncode(r)}static stringToBytes(e){return UR.encode(e)}};h();h();h();JR();h();var se=class extends Error{constructor(e,r){super(`${e}: ${r}`),this.code=e,this.name="DwnError"}},ne;(function(t){t.AuthenticateJwsMissing="AuthenticateJwsMissing",t.AuthenticateDescriptorCidMismatch="AuthenticateDescriptorCidMismatch",t.AuthenticationMoreThanOneSignatureNotSupported="AuthenticationMoreThanOneSignatureNotSupported",t.AuthorizationAuthorNotOwner="AuthorizationAuthorNotOwner",t.AuthorizationNotGrantedToAuthor="AuthorizationNotGrantedToAuthor",t.ComputeCidCodecNotSupported="ComputeCidCodecNotSupported",t.ComputeCidMultihashNotSupported="ComputeCidMultihashNotSupported",t.DidMethodNotSupported="DidMethodNotSupported",t.DidNotString="DidNotString",t.DidNotValid="DidNotValid",t.DidResolutionFailed="DidResolutionFailed",t.Ed25519InvalidJwk="Ed25519InvalidJwk",t.EventEmitterStreamNotOpenError="EventEmitterStreamNotOpenError",t.EventsSubscribeEventStreamUnimplemented="EventsSubscribeEventStreamUnimplemented",t.GeneralJwsVerifierGetPublicKeyNotFound="GeneralJwsVerifierGetPublicKeyNotFound",t.GeneralJwsVerifierInvalidSignature="GeneralJwsVerifierInvalidSignature",t.GrantAuthorizationGrantExpired="GrantAuthorizationGrantExpired",t.GrantAuthorizationGrantMissing="GrantAuthorizationGrantMissing",t.GrantAuthorizationGrantRevoked="GrantAuthorizationGrantRevoked",t.GrantAuthorizationInterfaceMismatch="GrantAuthorizationInterfaceMismatch",t.GrantAuthorizationMethodMismatch="GrantAuthorizationMethodMismatch",t.GrantAuthorizationNotGrantedForTenant="GrantAuthorizationNotGrantedForTenant",t.GrantAuthorizationNotGrantedToAuthor="GrantAuthorizationNotGrantedToAuthor",t.GrantAuthorizationGrantNotYetActive="GrantAuthorizationGrantNotYetActive",t.HdKeyDerivationPathInvalid="HdKeyDerivationPathInvalid",t.JwsVerifySignatureUnsupportedCrv="JwsVerifySignatureUnsupportedCrv",t.IndexInvalidCursorValueType="IndexInvalidCursorValueType",t.IndexInvalidCursorSortProperty="IndexInvalidCursorSortProperty",t.IndexInvalidSortPropertyInMemory="IndexInvalidSortPropertyInMemory",t.IndexMissingIndexableProperty="IndexMissingIndexableProperty",t.JwsDecodePlainObjectPayloadInvalid="JwsDecodePlainObjectPayloadInvalid",t.MessageGetInvalidCid="MessageGetInvalidCid",t.ParseCidCodecNotSupported="ParseCidCodecNotSupported",t.ParseCidMultihashNotSupported="ParseCidMultihashNotSupported",t.PermissionsProtocolValidateSchemaUnexpectedRecord="PermissionsProtocolValidateSchemaUnexpectedRecord",t.PermissionsProtocolValidateScopeContextIdProhibitedProperties="PermissionsProtocolValidateScopeContextIdProhibitedProperties",t.PermissionsProtocolValidateScopeSchemaProhibitedProperties="PermissionsProtocolValidateScopeSchemaProhibitedProperties",t.PrivateKeySignerUnableToDeduceAlgorithm="PrivateKeySignerUnableToDeduceAlgorithm",t.PrivateKeySignerUnableToDeduceKeyId="PrivateKeySignerUnableToDeduceKeyId",t.PrivateKeySignerUnsupportedCurve="PrivateKeySignerUnsupportedCurve",t.ProtocolAuthorizationActionNotAllowed="ProtocolAuthorizationActionNotAllowed",t.ProtocolAuthorizationActionRulesNotFound="ProtocolAuthorizationActionRulesNotFound",t.ProtocolAuthorizationIncorrectDataFormat="ProtocolAuthorizationIncorrectDataFormat",t.ProtocolAuthorizationIncorrectContextId="ProtocolAuthorizationIncorrectContextId",t.ProtocolAuthorizationIncorrectProtocolPath="ProtocolAuthorizationIncorrectProtocolPath",t.ProtocolAuthorizationDuplicateRoleRecipient="ProtocolAuthorizationDuplicateRoleRecipient",t.ProtocolAuthorizationInvalidSchema="ProtocolAuthorizationInvalidSchema",t.ProtocolAuthorizationInvalidType="ProtocolAuthorizationInvalidType",t.ProtocolAuthorizationMatchingRoleRecordNotFound="ProtocolAuthorizationMatchingRoleRecordNotFound",t.ProtocolAuthorizationMaxSizeInvalid="ProtocolAuthorizationMaxSizeInvalid",t.ProtocolAuthorizationMinSizeInvalid="ProtocolAuthorizationMinSizeInvalid",t.ProtocolAuthorizationMissingContextId="ProtocolAuthorizationMissingContextId",t.ProtocolAuthorizationMissingRuleSet="ProtocolAuthorizationMissingRuleSet",t.ProtocolAuthorizationParentlessIncorrectProtocolPath="ProtocolAuthorizationParentlessIncorrectProtocolPath",t.ProtocolAuthorizationNotARole="ProtocolAuthorizationNotARole",t.ProtocolAuthorizationParentNotFoundConstructingRecordChain="ProtocolAuthorizationParentNotFoundConstructingRecordChain",t.ProtocolAuthorizationProtocolNotFound="ProtocolAuthorizationProtocolNotFound",t.ProtocolAuthorizationQueryWithoutRole="ProtocolAuthorizationQueryWithoutRole",t.ProtocolAuthorizationRoleMissingRecipient="ProtocolAuthorizationRoleMissingRecipient",t.ProtocolAuthorizationTagsInvalidSchema="ProtocolAuthorizationTagsInvalidSchema",t.ProtocolsConfigureDuplicateActorInRuleSet="ProtocolsConfigureDuplicateActorInRuleSet",t.ProtocolsConfigureDuplicateRoleInRuleSet="ProtocolsConfigureDuplicateRoleInRuleSet",t.ProtocolsConfigureInvalidSize="ProtocolsConfigureInvalidSize",t.ProtocolsConfigureInvalidActionMissingOf="ProtocolsConfigureInvalidActionMissingOf",t.ProtocolsConfigureInvalidActionOfNotAllowed="ProtocolsConfigureInvalidActionOfNotAllowed",t.ProtocolsConfigureInvalidActionDeleteWithoutCreate="ProtocolsConfigureInvalidActionDeleteWithoutCreate",t.ProtocolsConfigureInvalidActionUpdateWithoutCreate="ProtocolsConfigureInvalidActionUpdateWithoutCreate",t.ProtocolsConfigureInvalidRecipientOfAction="ProtocolsConfigureInvalidRecipientOfAction",t.ProtocolsConfigureInvalidRuleSetRecordType="ProtocolsConfigureInvalidRuleSetRecordType",t.ProtocolsConfigureInvalidTagSchema="ProtocolsConfigureInvalidTagSchema",t.ProtocolsConfigureQueryNotAllowed="ProtocolsConfigureQueryNotAllowed",t.ProtocolsConfigureRecordNestingDepthExceeded="ProtocolsConfigureRecordNestingDepthExceeded",t.ProtocolsConfigureRoleDoesNotExistAtGivenPath="ProtocolsConfigureRoleDoesNotExistAtGivenPath",t.ProtocolsConfigureUnauthorized="ProtocolsConfigureUnauthorized",t.ProtocolsQueryUnauthorized="ProtocolsQueryUnauthorized",t.RecordsAuthorDelegatedGrantAndIdExistenceMismatch="RecordsAuthorDelegatedGrantAndIdExistenceMismatch",t.RecordsAuthorDelegatedGrantCidMismatch="RecordsAuthorDelegatedGrantCidMismatch",t.RecordsAuthorDelegatedGrantGrantedToAndOwnerSignatureMismatch="RecordsAuthorDelegatedGrantGrantedToAndOwnerSignatureMismatch",t.RecordsAuthorDelegatedGrantNotADelegatedGrant="RecordsAuthorDelegatedGrantNotADelegatedGrant",t.RecordsDecryptNoMatchingKeyEncryptedFound="RecordsDecryptNoMatchingKeyEncryptedFound",t.RecordsDeleteAuthorizationFailed="RecordsDeleteAuthorizationFailed",t.RecordsQueryCreateFilterPublishedSortInvalid="RecordsQueryCreateFilterPublishedSortInvalid",t.RecordsQueryParseFilterPublishedSortInvalid="RecordsQueryParseFilterPublishedSortInvalid",t.RecordsGrantAuthorizationConditionPublicationProhibited="RecordsGrantAuthorizationConditionPublicationProhibited",t.RecordsGrantAuthorizationConditionPublicationRequired="RecordsGrantAuthorizationConditionPublicationRequired",t.RecordsGrantAuthorizationDeleteProtocolScopeMismatch="RecordsGrantAuthorizationDeleteProtocolScopeMismatch",t.RecordsGrantAuthorizationQueryOrSubscribeProtocolScopeMismatch="RecordsGrantAuthorizationQueryOrSubscribeProtocolScopeMismatch",t.RecordsGrantAuthorizationScopeContextIdMismatch="RecordsGrantAuthorizationScopeContextIdMismatch",t.RecordsGrantAuthorizationScopeMissingProtocol="RecordsGrantAuthorizationScopeMissingProtocol",t.RecordsGrantAuthorizationScopeNotRecords="RecordsGrantAuthorizationScopeNotRecords",t.RecordsGrantAuthorizationScopeProtocolMismatch="RecordsGrantAuthorizationScopeProtocolMismatch",t.RecordsGrantAuthorizationScopeProtocolPathMismatch="RecordsGrantAuthorizationScopeProtocolPathMismatch",t.RecordsGrantAuthorizationScopeSchema="RecordsGrantAuthorizationScopeSchema",t.RecordsDerivePrivateKeyUnSupportedCurve="RecordsDerivePrivateKeyUnSupportedCurve",t.RecordsInvalidAncestorKeyDerivationSegment="RecordsInvalidAncestorKeyDerivationSegment",t.RecordsOwnerDelegatedGrantAndIdExistenceMismatch="RecordsOwnerDelegatedGrantAndIdExistenceMismatch",t.RecordsOwnerDelegatedGrantCidMismatch="RecordsOwnerDelegatedGrantCidMismatch",t.RecordsOwnerDelegatedGrantGrantedToAndOwnerSignatureMismatch="RecordsOwnerDelegatedGrantGrantedToAndOwnerSignatureMismatch",t.RecordsOwnerDelegatedGrantNotADelegatedGrant="RecordsOwnerDelegatedGrantNotADelegatedGrant",t.RecordsProtocolContextDerivationSchemeMissingContextId="RecordsProtocolContextDerivationSchemeMissingContextId",t.RecordsProtocolPathDerivationSchemeMissingProtocol="RecordsProtocolPathDerivationSchemeMissingProtocol",t.RecordsQueryFilterMissingRequiredProperties="RecordsQueryFilterMissingRequiredProperties",t.RecordsReadReturnedMultiple="RecordsReadReturnedMultiple",t.RecordsReadAuthorizationFailed="RecordsReadAuthorizationFailed",t.RecordsSubscribeEventStreamUnimplemented="RecordsSubscribeEventStreamUnimplemented",t.RecordsSubscribeFilterMissingRequiredProperties="RecordsSubscribeFilterMissingRequiredProperties",t.RecordsSchemasDerivationSchemeMissingSchema="RecordsSchemasDerivationSchemeMissingSchema",t.RecordsWriteAttestationIntegrityMoreThanOneSignature="RecordsWriteAttestationIntegrityMoreThanOneSignature",t.RecordsWriteAttestationIntegrityDescriptorCidMismatch="RecordsWriteAttestationIntegrityDescriptorCidMismatch",t.RecordsWriteAttestationIntegrityInvalidPayloadProperty="RecordsWriteAttestationIntegrityInvalidPayloadProperty",t.RecordsWriteAuthorizationFailed="RecordsWriteAuthorizationFailed",t.RecordsWriteCreateMissingSigner="RecordsWriteCreateMissingSigner",t.RecordsWriteCreateDataAndDataCidMutuallyExclusive="RecordsWriteCreateDataAndDataCidMutuallyExclusive",t.RecordsWriteCreateDataCidAndDataSizeMutuallyInclusive="RecordsWriteCreateDataCidAndDataSizeMutuallyInclusive",t.RecordsWriteCreateProtocolAndProtocolPathMutuallyInclusive="RecordsWriteCreateProtocolAndProtocolPathMutuallyInclusive",t.RecordsWriteDataCidMismatch="RecordsWriteDataCidMismatch",t.RecordsWriteDataSizeMismatch="RecordsWriteDataSizeMismatch",t.RecordsWriteGetEntryIdUndefinedAuthor="RecordsWriteGetEntryIdUndefinedAuthor",t.RecordsWriteGetInitialWriteNotFound="RecordsWriteGetInitialWriteNotFound",t.RecordsWriteImmutablePropertyChanged="RecordsWriteImmutablePropertyChanged",t.RecordsWriteMissingSigner="RecordsWriteMissingSigner",t.RecordsWriteMissingDataInPrevious="RecordsWriteMissingDataInPrevious",t.RecordsWriteMissingEncodedDataInPrevious="RecordsWriteMissingEncodedDataInPrevious",t.RecordsWriteMissingDataStream="RecordsWriteMissingDataStream",t.RecordsWriteMissingProtocol="RecordsWriteMissingProtocol",t.RecordsWriteMissingSchema="RecordsWriteMissingSchema",t.RecordsWriteOwnerAndTenantMismatch="RecordsWriteOwnerAndTenantMismatch",t.RecordsWriteSignAsOwnerDelegateUnknownAuthor="RecordsWriteSignAsOwnerDelegateUnknownAuthor",t.RecordsWriteSignAsOwnerUnknownAuthor="RecordsWriteSignAsOwnerUnknownAuthor",t.RecordsWriteValidateIntegrityAttestationMismatch="RecordsWriteValidateIntegrityAttestationMismatch",t.RecordsWriteValidateIntegrityContextIdMismatch="RecordsWriteValidateIntegrityContextIdMismatch",t.RecordsWriteValidateIntegrityContextIdNotInSignerSignaturePayload="RecordsWriteValidateIntegrityContextIdNotInSignerSignaturePayload",t.RecordsWriteValidateIntegrityDateCreatedMismatch="RecordsWriteValidateIntegrityDateCreatedMismatch",t.RecordsWriteValidateIntegrityEncryptionCidMismatch="RecordsWriteValidateIntegrityEncryptionCidMismatch",t.RecordsWriteValidateIntegrityRecordIdUnauthorized="RecordsWriteValidateIntegrityRecordIdUnauthorized",t.SchemaValidatorAdditionalPropertyNotAllowed="SchemaValidatorAdditionalPropertyNotAllowed",t.SchemaValidatorFailure="SchemaValidatorFailure",t.SchemaValidatorSchemaNotFound="SchemaValidatorSchemaNotFound",t.SchemaValidatorUnevaluatedPropertyNotAllowed="SchemaValidatorUnevaluatedPropertyNotAllowed",t.Secp256k1KeyNotValid="Secp256k1KeyNotValid",t.Secp256r1KeyNotValid="Secp256r1KeyNotValid",t.TimestampInvalid="TimestampInvalid",t.UrlProtocolNotNormalized="UrlProtocolNotNormalized",t.UrlProtocolNotNormalizable="UrlProtocolNotNormalizable",t.UrlSchemaNotNormalized="UrlSchemaNotNormalized",t.UrlSchemaNotNormalizable="UrlSchemaNotNormalizable"})(ne||(ne={}));var qS=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})};function Oz(t){if(t.kty!=="OKP"||t.crv!=="Ed25519")throw new se(ne.Ed25519InvalidJwk,"invalid jwk. kty MUST be OKP. crv MUST be Ed25519")}function $z(t){return{alg:"EdDSA",kty:"OKP",crv:"Ed25519",x:Ze.bytesToBase64Url(t)}}var YR={sign:(t,e)=>qS(void 0,void 0,void 0,function*(){Oz(e);let r=Ze.base64UrlToBytes(e.d);return Bz(t,r)}),verify:(t,e,r)=>qS(void 0,void 0,void 0,function*(){Oz(r);let n=Ze.base64UrlToBytes(r.x);return Mz(e,t,n)}),generateKeyPair:()=>qS(void 0,void 0,void 0,function*(){let t=GR.randomPrivateKey(),e=yield HR(t),r=Ze.bytesToBase64Url(t),n=$z(e),i=Object.assign(Object.assign({},n),{d:r});return{publicJwk:n,privateJwk:i}}),publicKeyToJwk:t=>qS(void 0,void 0,void 0,function*(){return $z(t)})};h();HS();h();c9();var nW=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),bs=a9({name:"sha2-256",code:18,encode:nW("SHA-256")}),gtt=a9({name:"sha2-512",code:19,encode:nW("SHA-512")});var hp=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},G1e=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$2e});h();Jd();var $2e=Ep({prefix:"9",name:"base10",alphabet:"0123456789"});var R9={};Ur(R9,{base16:()=>N2e,base16upper:()=>j2e});h();Jd();var N2e=ai({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),j2e=ai({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var D9={};Ur(D9,{base2:()=>U2e});h();Jd();var U2e=ai({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var B9={};Ur(B9,{base256emoji:()=>z2e});h();Jd();var DW=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),q2e=DW.reduce((t,e,r)=>(t[r]=e,t),[]),L2e=DW.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function K2e(t){return t.reduce((e,r)=>(e+=q2e[r],e),"")}function F2e(t){let e=[];for(let r of t){let n=L2e[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var z2e=ob({prefix:"\u{1F680}",name:"base256emoji",encode:K2e,decode:F2e});var M9={};Ur(M9,{base32:()=>sb,base32hex:()=>G2e,base32hexpad:()=>Y2e,base32hexpadupper:()=>Z2e,base32hexupper:()=>J2e,base32pad:()=>V2e,base32padupper:()=>H2e,base32upper:()=>W2e,base32z:()=>X2e});h();Jd();var sb=ai({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),W2e=ai({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),V2e=ai({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),H2e=ai({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),G2e=ai({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),J2e=ai({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Y2e=ai({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Z2e=ai({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),X2e=ai({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var C9={};Ur(C9,{base36:()=>Q2e,base36upper:()=>e_e});h();Jd();var Q2e=Ep({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),e_e=Ep({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var O9={};Ur(O9,{base58btc:()=>ol,base58flickr:()=>t_e});h();Jd();var ol=Ep({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),t_e=Ep({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});a_();var N9={};Ur(N9,{base8:()=>o_e});h();Jd();var o_e=ai({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var j9={};Ur(j9,{identity:()=>s_e});h();xp();Jd();var s_e=ob({prefix:"\0",name:"identity",encode:t=>IW(t),decode:t=>TW(t)});h();var int=new TextEncoder,ont=new TextDecoder;h();xp();var q9={};Ur(q9,{identity:()=>k_e});h();xp();lb();var NW=0,I_e="identity",jW=$f,P_e=t=>Jy(NW,jW(t)),k_e={code:NW,name:I_e,encode:jW,digest:P_e};d5();h();xp();h();xp();lb();h();a5();var LW=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return B_e(r,W9(t),e||ol.encoder);default:return M_e(r,W9(t),e||sb.encoder)}};var KW=new WeakMap,W9=t=>{let e=KW.get(t);if(e==null){let r=new Map;return KW.set(t,r),r}return e},Yy=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!==f_)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==C_e)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=Jy(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&&$W(e.multihash,n.multihash)}toString(e){return LW(this,e)}toJSON(){return{"/":LW(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||FW(n,i,o.bytes))}else if(r[O_e]===!0){let{version:n,multihash:i,code:o}=r,s=c5(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!==f_)throw new Error(`Version 0 CID must use dag-pb (code: ${f_}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=FW(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,f_,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=$f(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 ub(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,m]=d_(e.subarray(r));return r+=m,l},i=n(),o=f_;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),d=n(),u=r+d,c=u-s;return{version:i,codec:o,multihashCode:a,digestSize:d,multihashSize:c,size:u}}static parse(e,r){let[n,i]=D_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 W9(o).set(n,e),o}},D_e=(t,e)=>{switch(t[0]){case"Q":{let r=e||ol;return[ol.prefix,r.decode(`${ol.prefix}${t}`)]}case ol.prefix:{let r=e||ol;return[ol.prefix,r.decode(t)]}case sb.prefix:{let r=e||sb;return[sb.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)]}}},B_e=(t,e,r)=>{let{prefix:n}=r;if(n!==ol.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},M_e=(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},f_=112,C_e=18,FW=(t,e,r)=>{let n=db(t),i=n+db(e),o=new Uint8Array(i+r.byteLength);return cb(t,o,0),cb(e,o,n),o.set(r,i),o},O_e=Symbol.for("@ipld/js-cid/CID");lb();F9();a5();h();var V9={...j9,...D9,...N9,...k9,...R9,...M9,...C9,...O9,...$9,...B9},Cnt={...z9,...q9};function WW(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var zW=WW("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),H9=WW("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=o5(t.length);for(let r=0;rt.createSigner(n))}static createSigner(e){let r=e.keyPair.privateJwk,n=e.keyId;return new hb({privateJwk:r,keyId:n})}};h();h();var p_=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,GW=new Set,J9=typeof D.default=="object"&&D.default?D.default:{},JW=(t,e,r,n)=>{typeof J9.emitWarning=="function"?J9.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`)},f5=globalThis.AbortController,HW=globalThis.AbortSignal;if(typeof f5>"u"){HW=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,i){this._onabort.push(i)}},f5=class{constructor(){e()}signal=new HW;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n)}}};let t=J9.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,JW("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var q_e=t=>!GW.has(t),Cit=Symbol("type"),Ap=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),YW=t=>Ap(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?pb:null:null,pb=class extends Array{constructor(e){super(e),this.fill(0)}},Y9=class t{heap;length;static#c=!1;static create(e){let r=YW(e);if(!r)return[];t.#c=!0;let n=new t(e,r);return t.#c=!1,n}constructor(e,r){if(!t.#c)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},h5=class t{#c;#l;#v;#p;#k;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#n;#m;#i;#r;#e;#d;#f;#a;#o;#y;#s;#x;#E;#g;#b;#A;#u;static unsafeExposeInternals(e){return{starts:e.#E,ttls:e.#g,sizes:e.#x,keyMap:e.#i,keyList:e.#r,valList:e.#e,next:e.#d,prev:e.#f,get head(){return e.#a},get tail(){return e.#o},free:e.#y,isBackgroundFetch:r=>e.#t(r),backgroundFetch:(r,n,i,o)=>e.#B(r,n,i,o),moveToTail:r=>e.#P(r),indexes:r=>e.#w(r),rindexes:r=>e.#_(r),isStale:r=>e.#h(r)}}get max(){return this.#c}get maxSize(){return this.#l}get calculatedSize(){return this.#m}get size(){return this.#n}get fetchMethod(){return this.#k}get dispose(){return this.#v}get disposeAfter(){return this.#p}constructor(e){let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:a,allowStale:d,dispose:u,disposeAfter:c,noDisposeOnSet:l,noUpdateTTL:m,maxSize:p=0,maxEntrySize:g=0,sizeCalculation:v,fetchMethod:E,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:P,allowStaleOnFetchRejection:I,allowStaleOnFetchAbort:$,ignoreFetchAbort:N}=e;if(r!==0&&!Ap(r))throw new TypeError("max option must be a nonnegative integer");let K=r?YW(r):Array;if(!K)throw new Error("invalid max value: "+r);if(this.#c=r,this.#l=p,this.maxEntrySize=g||this.#l,this.sizeCalculation=v,this.sizeCalculation){if(!this.#l&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(E!==void 0&&typeof E!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#k=E,this.#A=!!E,this.#i=new Map,this.#r=new Array(r).fill(void 0),this.#e=new Array(r).fill(void 0),this.#d=new K(r),this.#f=new K(r),this.#a=0,this.#o=0,this.#y=Y9.create(r),this.#n=0,this.#m=0,typeof u=="function"&&(this.#v=u),typeof c=="function"?(this.#p=c,this.#s=[]):(this.#p=void 0,this.#s=void 0),this.#b=!!this.#v,this.#u=!!this.#p,this.noDisposeOnSet=!!l,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!I,this.allowStaleOnFetchAbort=!!$,this.ignoreFetchAbort=!!N,this.maxEntrySize!==0){if(this.#l!==0&&!Ap(this.#l))throw new TypeError("maxSize must be a positive integer if specified");if(!Ap(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#j()}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!P,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!a,this.ttlResolution=Ap(i)||i===0?i:1,this.ttlAutopurge=!!o,this.ttl=n||0,this.ttl){if(!Ap(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#M()}if(this.#c===0&&this.ttl===0&&this.#l===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#c&&!this.#l){let F="LRU_CACHE_UNBOUNDED";q_e(F)&&(GW.add(F),JW("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",F,t))}}getRemainingTTL(e){return this.#i.has(e)?1/0:0}#M(){let e=new pb(this.#c),r=new pb(this.#c);this.#g=e,this.#E=r,this.#C=(o,s,a=p_.now())=>{if(r[o]=s!==0?a:0,e[o]=s,s!==0&&this.ttlAutopurge){let d=setTimeout(()=>{this.#h(o)&&this.delete(this.#r[o])},s+1);d.unref&&d.unref()}},this.#T=o=>{r[o]=e[o]!==0?p_.now():0},this.#S=(o,s)=>{if(e[s]){let a=e[s],d=r[s];o.ttl=a,o.start=d,o.now=n||i();let u=o.now-d;o.remainingTTL=a-u}};let n=0,i=()=>{let o=p_.now();if(this.ttlResolution>0){n=o;let s=setTimeout(()=>n=0,this.ttlResolution);s.unref&&s.unref()}return o};this.getRemainingTTL=o=>{let s=this.#i.get(o);if(s===void 0)return 0;let a=e[s],d=r[s];if(a===0||d===0)return 1/0;let u=(n||i())-d;return a-u},this.#h=o=>e[o]!==0&&r[o]!==0&&(n||i())-r[o]>e[o]}#T=()=>{};#S=()=>{};#C=()=>{};#h=()=>!1;#j(){let e=new pb(this.#c);this.#m=0,this.#x=e,this.#I=r=>{this.#m-=e[r],e[r]=0},this.#O=(r,n,i,o)=>{if(this.#t(n))return 0;if(!Ap(i))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(i=o(n,r),!Ap(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#R=(r,n,i)=>{if(e[r]=n,this.#l){let o=this.#l-e[r];for(;this.#m>o;)this.#D(!0)}this.#m+=e[r],i&&(i.entrySize=n,i.totalCalculatedSize=this.#m)}}#I=e=>{};#R=(e,r,n)=>{};#O=(e,r,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#w({allowStale:e=this.allowStale}={}){if(this.#n)for(let r=this.#o;!(!this.#$(r)||((e||!this.#h(r))&&(yield r),r===this.#a));)r=this.#f[r]}*#_({allowStale:e=this.allowStale}={}){if(this.#n)for(let r=this.#a;!(!this.#$(r)||((e||!this.#h(r))&&(yield r),r===this.#o));)r=this.#d[r]}#$(e){return e!==void 0&&this.#i.get(this.#r[e])===e}*entries(){for(let e of this.#w())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*rentries(){for(let e of this.#_())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*keys(){for(let e of this.#w()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r)}}*rkeys(){for(let e of this.#_()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r)}}*values(){for(let e of this.#w())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}*rvalues(){for(let e of this.#_())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}[Symbol.iterator](){return this.entries()}find(e,r={}){for(let n of this.#w()){let i=this.#e[n],o=this.#t(i)?i.__staleWhileFetching:i;if(o!==void 0&&e(o,this.#r[n],this))return this.get(this.#r[n],r)}}forEach(e,r=this){for(let n of this.#w()){let i=this.#e[n],o=this.#t(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(r,o,this.#r[n],this)}}rforEach(e,r=this){for(let n of this.#_()){let i=this.#e[n],o=this.#t(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(r,o,this.#r[n],this)}}purgeStale(){let e=!1;for(let r of this.#_({allowStale:!0}))this.#h(r)&&(this.delete(this.#r[r]),e=!0);return e}dump(){let e=[];for(let r of this.#w({allowStale:!0})){let n=this.#r[r],i=this.#e[r],o=this.#t(i)?i.__staleWhileFetching:i;if(o===void 0||n===void 0)continue;let s={value:o};if(this.#g&&this.#E){s.ttl=this.#g[r];let a=p_.now()-this.#E[r];s.start=Math.floor(Date.now()-a)}this.#x&&(s.size=this.#x[r]),e.unshift([n,s])}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let i=Date.now()-n.start;n.start=p_.now()-i}this.set(r,n.value,n)}}set(e,r,n={}){if(r===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:d}=n,{noUpdateTTL:u=this.noUpdateTTL}=n,c=this.#O(e,r,n.size||0,a);if(this.maxEntrySize&&c>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=!0),this.delete(e),this;let l=this.#n===0?void 0:this.#i.get(e);if(l===void 0)l=this.#n===0?this.#o:this.#y.length!==0?this.#y.pop():this.#n===this.#c?this.#D(!1):this.#n,this.#r[l]=e,this.#e[l]=r,this.#i.set(e,l),this.#d[this.#o]=l,this.#f[l]=this.#o,this.#o=l,this.#n++,this.#R(l,c,d),d&&(d.set="add"),u=!1;else{this.#P(l);let m=this.#e[l];if(r!==m){if(this.#A&&this.#t(m)?m.__abortController.abort(new Error("replaced")):s||(this.#b&&this.#v?.(m,e,"set"),this.#u&&this.#s?.push([m,e,"set"])),this.#I(l),this.#R(l,c,d),this.#e[l]=r,d){d.set="replace";let p=m&&this.#t(m)?m.__staleWhileFetching:m;p!==void 0&&(d.oldValue=p)}}else d&&(d.set="update")}if(i!==0&&!this.#g&&this.#M(),this.#g&&(u||this.#C(l,i,o),d&&this.#S(d,l)),!s&&this.#u&&this.#s){let m=this.#s,p;for(;p=m?.shift();)this.#p?.(...p)}return this}pop(){try{for(;this.#n;){let e=this.#e[this.#a];if(this.#D(!0),this.#t(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#u&&this.#s){let e=this.#s,r;for(;r=e?.shift();)this.#p?.(...r)}}}#D(e){let r=this.#a,n=this.#r[r],i=this.#e[r];return this.#A&&this.#t(i)?i.__abortController.abort(new Error("evicted")):(this.#b||this.#u)&&(this.#b&&this.#v?.(i,n,"evict"),this.#u&&this.#s?.push([i,n,"evict"])),this.#I(r),e&&(this.#r[r]=void 0,this.#e[r]=void 0,this.#y.push(r)),this.#n===1?(this.#a=this.#o=0,this.#y.length=0):this.#a=this.#d[r],this.#i.delete(n),this.#n--,r}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=r,o=this.#i.get(e);if(o!==void 0){let s=this.#e[o];if(this.#t(s)&&s.__staleWhileFetching===void 0)return!1;if(this.#h(o))i&&(i.has="stale",this.#S(i,o));else return n&&this.#T(o),i&&(i.has="hit",this.#S(i,o)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{allowStale:n=this.allowStale}=r,i=this.#i.get(e);if(i!==void 0&&(n||!this.#h(i))){let o=this.#e[i];return this.#t(o)?o.__staleWhileFetching:o}}#B(e,r,n,i){let o=r===void 0?void 0:this.#e[r];if(this.#t(o))return o;let s=new f5,{signal:a}=n;a?.addEventListener("abort",()=>s.abort(a.reason),{signal:s.signal});let d={signal:s.signal,options:n,context:i},u=(v,E=!1)=>{let{aborted:A}=s.signal,P=n.ignoreFetchAbort&&v!==void 0;if(n.status&&(A&&!E?(n.status.fetchAborted=!0,n.status.fetchError=s.signal.reason,P&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),A&&!P&&!E)return l(s.signal.reason);let I=p;return this.#e[r]===p&&(v===void 0?I.__staleWhileFetching?this.#e[r]=I.__staleWhileFetching:this.delete(e):(n.status&&(n.status.fetchUpdated=!0),this.set(e,v,d.options))),v},c=v=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=v),l(v)),l=v=>{let{aborted:E}=s.signal,A=E&&n.allowStaleOnFetchAbort,P=A||n.allowStaleOnFetchRejection,I=P||n.noDeleteOnFetchRejection,$=p;if(this.#e[r]===p&&(!I||$.__staleWhileFetching===void 0?this.delete(e):A||(this.#e[r]=$.__staleWhileFetching)),P)return n.status&&$.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),$.__staleWhileFetching;if($.__returned===$)throw v},m=(v,E)=>{let A=this.#k?.(e,o,d);A&&A instanceof Promise&&A.then(P=>v(P),E),s.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(v(),n.allowStaleOnFetchAbort&&(v=P=>u(P,!0)))})};n.status&&(n.status.fetchDispatched=!0);let p=new Promise(m).then(u,c),g=Object.assign(p,{__abortController:s,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(e,g,{...d.options,status:void 0}),r=this.#i.get(e)):this.#e[r]=g,g}#t(e){if(!this.#A)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof f5}async fetch(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:d=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:l=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:v,forceRefresh:E=!1,status:A,signal:P}=r;if(!this.#A)return A&&(A.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:o,status:A});let I={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:o,ttl:s,noDisposeOnSet:a,size:d,sizeCalculation:u,noUpdateTTL:c,noDeleteOnFetchRejection:l,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:g,ignoreFetchAbort:p,status:A,signal:P},$=this.#i.get(e);if($===void 0){A&&(A.fetch="miss");let N=this.#B(e,$,I,v);return N.__returned=N}else{let N=this.#e[$];if(this.#t(N)){let L=n&&N.__staleWhileFetching!==void 0;return A&&(A.fetch="inflight",L&&(A.returnedStale=!0)),L?N.__staleWhileFetching:N.__returned=N}let K=this.#h($);if(!E&&!K)return A&&(A.fetch="hit"),this.#P($),i&&this.#T($),A&&this.#S(A,$),N;let F=this.#B(e,$,I,v),W=F.__staleWhileFetching!==void 0&&n;return A&&(A.fetch=K?"stale":"refresh",W&&K&&(A.returnedStale=!0)),W?F.__staleWhileFetching:F.__returned=F}}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:s}=r,a=this.#i.get(e);if(a!==void 0){let d=this.#e[a],u=this.#t(d);return s&&this.#S(s,a),this.#h(a)?(s&&(s.get="stale"),u?(s&&n&&d.__staleWhileFetching!==void 0&&(s.returnedStale=!0),n?d.__staleWhileFetching:void 0):(o||this.delete(e),s&&n&&(s.returnedStale=!0),n?d:void 0)):(s&&(s.get="hit"),u?d.__staleWhileFetching:(this.#P(a),i&&this.#T(a),d))}else s&&(s.get="miss")}#N(e,r){this.#f[r]=e,this.#d[e]=r}#P(e){e!==this.#o&&(e===this.#a?this.#a=this.#d[e]:this.#N(this.#f[e],this.#d[e]),this.#N(this.#o,e),this.#o=e)}delete(e){let r=!1;if(this.#n!==0){let n=this.#i.get(e);if(n!==void 0)if(r=!0,this.#n===1)this.clear();else{this.#I(n);let i=this.#e[n];this.#t(i)?i.__abortController.abort(new Error("deleted")):(this.#b||this.#u)&&(this.#b&&this.#v?.(i,e,"delete"),this.#u&&this.#s?.push([i,e,"delete"])),this.#i.delete(e),this.#r[n]=void 0,this.#e[n]=void 0,n===this.#o?this.#o=this.#f[n]:n===this.#a?this.#a=this.#d[n]:(this.#d[this.#f[n]]=this.#d[n],this.#f[this.#d[n]]=this.#f[n]),this.#n--,this.#y.push(n)}}if(this.#u&&this.#s?.length){let n=this.#s,i;for(;i=n?.shift();)this.#p?.(...i)}return r}clear(){for(let e of this.#_({allowStale:!0})){let r=this.#e[e];if(this.#t(r))r.__abortController.abort(new Error("deleted"));else{let n=this.#r[e];this.#b&&this.#v?.(r,n,"delete"),this.#u&&this.#s?.push([r,n,"delete"])}}if(this.#i.clear(),this.#e.fill(void 0),this.#r.fill(void 0),this.#g&&this.#E&&(this.#g.fill(0),this.#E.fill(0)),this.#x&&this.#x.fill(0),this.#a=0,this.#o=0,this.#y.length=0,this.#m=0,this.#n=0,this.#u&&this.#s){let e=this.#s,r;for(;r=e?.shift();)this.#p?.(...r)}}};var ZW=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},p5=class{constructor(e){this.timeToLiveInSeconds=e,this.cache=new h5({max:1e5,ttl:e*1e3})}set(e,r){return ZW(this,void 0,void 0,function*(){try{this.cache.set(e,r)}catch{}})}get(e){return ZW(this,void 0,void 0,function*(){return this.cache.get(e)})}};h();var e7={};Ur(e7,{Authorization:()=>L_e,AuthorizationDelegatedGrant:()=>K_e,AuthorizationOwner:()=>W_e,Definitions:()=>rxe,EventsFilter:()=>X_e,EventsGet:()=>Q_e,EventsQuery:()=>exe,EventsSubscribe:()=>txe,GeneralJwk:()=>nxe,GeneralJws:()=>ixe,GenericSignaturePayload:()=>Sxe,JwkVerificationMethod:()=>oxe,MessagesGet:()=>axe,NumberRangeFilter:()=>cxe,PaginationCursor:()=>dxe,PermissionGrantData:()=>uxe,PermissionRequestData:()=>lxe,PermissionRevocationData:()=>fxe,PermissionsDefinitions:()=>hxe,PermissionsScopes:()=>pxe,ProtocolDefinition:()=>mxe,ProtocolRuleSet:()=>vxe,ProtocolsConfigure:()=>bxe,ProtocolsQuery:()=>wxe,PublicJwk:()=>Exe,RecordsDelete:()=>V_e,RecordsFilter:()=>xxe,RecordsQuery:()=>H_e,RecordsRead:()=>_xe,RecordsSubscribe:()=>G_e,RecordsWrite:()=>J_e,RecordsWriteDataEncoded:()=>Y_e,RecordsWriteSignaturePayload:()=>Axe,RecordsWriteUnidentified:()=>Z_e,StringRangeFilter:()=>Txe});h();var L_e=Kn;var Qy=new RegExp("^[A-Za-z0-9_-]+$","u");function sn(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=sn.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let m=a;for(let p in t)if(!(p==="payload"||p==="signatures")){return sn.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:p},message:"must NOT have additional properties"}],!1;break}if(m===a){if(t.payload!==void 0){let p=t.payload,g=a;if(a===a)if(typeof p=="string"){if(!Qy.test(p))return sn.errors=[{instancePath:e+"/payload",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z0-9_-]+$"},message:'must match pattern "^[A-Za-z0-9_-]+$"'}],!1}else return sn.errors=[{instancePath:e+"/payload",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var u=g===a}else var u=!0;if(u)if(t.signatures!==void 0){let p=t.signatures,g=a;if(a===g)if(Array.isArray(p)){if(p.length<1)return sn.errors=[{instancePath:e+"/signatures",schemaPath:"#/properties/signatures/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{var c=!0;let E=p.length;for(let A=0;A10)return Fe.errors=[{instancePath:e+"/descriptor/tags",schemaPath:"#/properties/descriptor/properties/tags/maxProperties",keyword:"maxProperties",params:{limit:10},message:"must NOT have more than 10 properties"}],!1;if(Object.keys(Ce).length<1)return Fe.errors=[{instancePath:e+"/descriptor/tags",schemaPath:"#/properties/descriptor/properties/tags/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;for(let bt in Ce){let Te=Ce[bt],De=a,Dt=a,_e=!1,Se=null,Wr=a;if(typeof Te!="string"){let Ge={instancePath:e+"/descriptor/tags/"+bt.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/descriptor/properties/tags/additionalProperties/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[Ge]:s.push(Ge),a++}var _=Wr===a;_&&(_e=!0,Se=0);let ze=a;if(!(typeof Te=="number"&&isFinite(Te))){let Ge={instancePath:e+"/descriptor/tags/"+bt.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/descriptor/properties/tags/additionalProperties/oneOf/1/type",keyword:"type",params:{type:"number"},message:"must be number"};s===null?s=[Ge]:s.push(Ge),a++}var _=ze===a;if(_&&_e)_e=!1,Se=[Se,1];else{_&&(_e=!0,Se=1);let Ge=a;if(typeof Te!="boolean"){let pt={instancePath:e+"/descriptor/tags/"+bt.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/descriptor/properties/tags/additionalProperties/oneOf/2/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"};s===null?s=[pt]:s.push(pt),a++}var _=Ge===a;if(_&&_e)_e=!1,Se=[Se,2];else{_&&(_e=!0,Se=2);let pt=a;if(a===pt)if(Array.isArray(Te))if(Te.length>10){let wi={instancePath:e+"/descriptor/tags/"+bt.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/descriptor/properties/tags/additionalProperties/oneOf/3/maxItems",keyword:"maxItems",params:{limit:10},message:"must NOT have more than 10 items"};s===null?s=[wi]:s.push(wi),a++}else if(Te.length<1){let wi={instancePath:e+"/descriptor/tags/"+bt.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/descriptor/properties/tags/additionalProperties/oneOf/3/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};s===null?s=[wi]:s.push(wi),a++}else{var x=!0;let wi=Te.length;for(let Pt=0;Pt10){let Xe={instancePath:e+"/descriptor/tags/"+bt.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/descriptor/properties/tags/additionalProperties/oneOf/4/maxItems",keyword:"maxItems",params:{limit:10},message:"must NOT have more than 10 items"};s===null?s=[Xe]:s.push(Xe),a++}else if(Te.length<1){let Xe={instancePath:e+"/descriptor/tags/"+bt.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/descriptor/properties/tags/additionalProperties/oneOf/4/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};s===null?s=[Xe]:s.push(Xe),a++}else{var B=!0;let Xe=Te.length;for(let Kc=0;Kc=",limit:1},message:"must be >= 1"}],!1}else return hn.errors=[{instancePath:e+"/descriptor/pagination/limit",schemaPath:"#/properties/descriptor/properties/pagination/properties/limit/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var l=W===a}else var l=!0;if(l)if($.cursor!==void 0){let U=$.cursor,W=a;if(a===a)if(U&&typeof U=="object"&&!Array.isArray(U)){if(Object.keys(U).length<1)return hn.errors=[{instancePath:e+"/descriptor/pagination/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let S;if(U.messageCid===void 0&&(S="messageCid")||U.value===void 0&&(S="value"))return hn.errors=[{instancePath:e+"/descriptor/pagination/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/required",keyword:"required",params:{missingProperty:S},message:"must have required property '"+S+"'"}],!1;{let k=a;for(let f in U)if(!(f==="messageCid"||f==="value")){return hn.errors=[{instancePath:e+"/descriptor/pagination/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:f},message:"must NOT have additional properties"}],!1;break}if(k===a){if(U.messageCid!==void 0){let f=a;if(typeof U.messageCid!="string")return hn.errors=[{instancePath:e+"/descriptor/pagination/cursor/messageCid",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/properties/messageCid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=f===a}else var m=!0;if(m)if(U.value!==void 0){let f=U.value,y=a;if(typeof f!="string"&&!(typeof f=="number"&&isFinite(f)))return hn.errors=[{instancePath:e+"/descriptor/pagination/cursor/value",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/properties/value/type",keyword:"type",params:{type:y5.properties.value.type},message:"must be string,number"}],!1;var m=y===a}else var m=!0}}}}else return hn.errors=[{instancePath:e+"/descriptor/pagination/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var l=W===a}else var l=!0}}else return hn.errors=[{instancePath:e+"/descriptor/pagination",schemaPath:"#/properties/descriptor/properties/pagination/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var c=N===a}else var c=!0;if(c)if(v.dateSort!==void 0){let $=v.dateSort,N=a;if(typeof $!="string")return hn.errors=[{instancePath:e+"/descriptor/dateSort",schemaPath:"#/properties/descriptor/properties/dateSort/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!($==="createdAscending"||$==="createdDescending"||$==="publishedAscending"||$==="publishedDescending"))return hn.errors=[{instancePath:e+"/descriptor/dateSort",schemaPath:"#/properties/descriptor/properties/dateSort/enum",keyword:"enum",params:{allowedValues:Z9.properties.descriptor.properties.dateSort.enum},message:"must be equal to one of the allowed values"}],!1;var c=N===a}else var c=!0}}}}}}}else return hn.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var u=E===a}else var u=!0}}}else return hn.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return hn.errors=s,a===0}hn.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var G_e=_s,eV={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://identity.foundation/dwn/json-schemas/records-subscribe.json",type:"object",additionalProperties:!1,required:["descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization-delegated-grant.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp","filter"],properties:{interface:{enum:["Records"],type:"string"},method:{enum:["Subscribe"],type:"string"},messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},filter:{$ref:"https://identity.foundation/dwn/json-schemas/records-filter.json"}}}}};function _s(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=_s.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let l;if(t.descriptor===void 0&&(l="descriptor"))return _s.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:l},message:"must have required property '"+l+"'"}],!1;{let m=a;for(let p in t)if(!(p==="authorization"||p==="descriptor")){return _s.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:p},message:"must NOT have additional properties"}],!1;break}if(m===a){if(t.authorization!==void 0){let p=a;ho(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i,dynamicAnchors:o})||(s=s===null?ho.errors:s.concat(ho.errors),a=s.length);var u=p===a}else var u=!0;if(u)if(t.descriptor!==void 0){let p=t.descriptor,g=a;if(a===g)if(p&&typeof p=="object"&&!Array.isArray(p)){let E;if(p.interface===void 0&&(E="interface")||p.method===void 0&&(E="method")||p.messageTimestamp===void 0&&(E="messageTimestamp")||p.filter===void 0&&(E="filter"))return _s.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:E},message:"must have required property '"+E+"'"}],!1;{let A=a;for(let P in p)if(!(P==="interface"||P==="method"||P==="messageTimestamp"||P==="filter")){return _s.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:P},message:"must NOT have additional properties"}],!1;break}if(A===a){if(p.interface!==void 0){let P=p.interface,I=a;if(typeof P!="string")return _s.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(P!=="Records")return _s.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:eV.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var c=I===a}else var c=!0;if(c){if(p.method!==void 0){let P=p.method,I=a;if(typeof P!="string")return _s.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(P!=="Subscribe")return _s.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:eV.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var c=I===a}else var c=!0;if(c){if(p.messageTimestamp!==void 0){let P=p.messageTimestamp,I=a;if(a===a)if(typeof P=="string"){if(!Ln.test(P))return _s.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return _s.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=I===a}else var c=!0;if(c)if(p.filter!==void 0){let P=a;Ye(p.filter,{instancePath:e+"/descriptor/filter",parentData:p,parentDataProperty:"filter",rootData:i,dynamicAnchors:o})||(s=s===null?Ye.errors:s.concat(Ye.errors),a=s.length);var c=P===a}else var c=!0}}}}}else return _s.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var u=g===a}else var u=!0}}}else return _s.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return _s.errors=s,a===0}_s.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var J_e=Zy;function Zy(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Zy.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),!Fe(t,{instancePath:e,parentData:r,parentDataProperty:n,rootData:i,dynamicAnchors:o}))s=s===null?Fe.errors:s.concat(Fe.errors),a=s.length;else var u=Fe.evaluated.props;if(a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let c;if(t.recordId===void 0&&(c="recordId")||t.authorization===void 0&&(c="authorization"))return Zy.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:c},message:"must have required property '"+c+"'"}],!1;if(u!==!0){for(let l in t)if(!u||!u[l]){return Zy.errors=[{instancePath:e,schemaPath:"#/unevaluatedProperties",keyword:"unevaluatedProperties",params:{unevaluatedProperty:l},message:"must NOT have unevaluated properties"}],!1;break}}}else return Zy.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Zy.errors=s,a===0}Zy.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var Y_e=Gc,Z_e=Fe,X_e=ft,m5={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://identity.foundation/dwn/json-schemas/events-filter.json",type:"object",additionalProperties:!1,minProperties:1,properties:{interface:{enum:["Permissions","Protocols","Records"],type:"string"},method:{enum:["Configure","Delete","Grant","Revoke","Write"],type:"string"},protocol:{type:"string"},protocolPath:{type:"string"},recipient:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did"},contextId:{type:"string"},schema:{type:"string"},recordId:{type:"string"},parentId:{type:"string"},dataFormat:{type:"string"},dataSize:{$ref:"https://identity.foundation/dwn/json-schemas/number-range-filter.json"},dateCreated:{type:"object",minProperties:1,additionalProperties:!1,properties:{from:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},to:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"}}},datePublished:{type:"object",minProperties:1,additionalProperties:!1,properties:{from:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},to:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"}}},dateUpdated:{type:"object",minProperties:1,additionalProperties:!1,properties:{from:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},to:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"}}}},dependencies:{datePublished:{oneOf:[{properties:{published:{enum:[!0]}},required:["published"]},{not:{required:["published"]}}]}}};function ft(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=ft.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){if(Object.keys(t).length<1)return ft.errors=[{instancePath:e,schemaPath:"#/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let F=a;for(let U in t)if(!Q9.call(m5.properties,U)){return ft.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:U},message:"must NOT have additional properties"}],!1;break}if(F===a){if(t.datePublished!==void 0){let U=a,W=a,L=!1,T=null,S=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let w;if(t.published===void 0&&(w="published")){let _={instancePath:e,schemaPath:"#/dependencies/datePublished/oneOf/0/required",keyword:"required",params:{missingProperty:w},message:"must have required property '"+w+"'"};s===null?s=[_]:s.push(_),a++}else if(t.published!==void 0&&t.published!==!0){let _={instancePath:e+"/published",schemaPath:"#/dependencies/datePublished/oneOf/0/properties/published/enum",keyword:"enum",params:{allowedValues:m5.dependencies.datePublished.oneOf[0].properties.published.enum},message:"must be equal to one of the allowed values"};s===null?s=[_]:s.push(_),a++}}var l=S===a;if(l){L=!0,T=0;var u={};u.published=!0}let k=a,f=a,y=a;if(t&&typeof t=="object"&&!Array.isArray(t)){let w;if(t.published===void 0&&(w="published")){let _={};s===null?s=[_]:s.push(_),a++}}var c=y===a;if(c){let w={instancePath:e,schemaPath:"#/dependencies/datePublished/oneOf/1/not",keyword:"not",params:{},message:"must NOT be valid"};s===null?s=[w]:s.push(w),a++}else a=f,s!==null&&(f?s.length=f:s=null);var l=k===a;if(l&&L?(L=!1,T=[T,1]):l&&(L=!0,T=1),L)a=W,s!==null&&(W?s.length=W:s=null);else{let w={instancePath:e,schemaPath:"#/dependencies/datePublished/oneOf",keyword:"oneOf",params:{passingSchemas:T},message:"must match exactly one schema in oneOf"};return s===null?s=[w]:s.push(w),a++,ft.errors=s,!1}var m=U===a}else var m=!0;if(m){if(t.interface!==void 0){let U=t.interface,W=a;if(typeof U!="string")return ft.errors=[{instancePath:e+"/interface",schemaPath:"#/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(U==="Permissions"||U==="Protocols"||U==="Records"))return ft.errors=[{instancePath:e+"/interface",schemaPath:"#/properties/interface/enum",keyword:"enum",params:{allowedValues:m5.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var p=W===a}else var p=!0;if(p){if(t.method!==void 0){let U=t.method,W=a;if(typeof U!="string")return ft.errors=[{instancePath:e+"/method",schemaPath:"#/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(U==="Configure"||U==="Delete"||U==="Grant"||U==="Revoke"||U==="Write"))return ft.errors=[{instancePath:e+"/method",schemaPath:"#/properties/method/enum",keyword:"enum",params:{allowedValues:m5.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var p=W===a}else var p=!0;if(p){if(t.protocol!==void 0){let U=a;if(typeof t.protocol!="string")return ft.errors=[{instancePath:e+"/protocol",schemaPath:"#/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=U===a}else var p=!0;if(p){if(t.protocolPath!==void 0){let U=a;if(typeof t.protocolPath!="string")return ft.errors=[{instancePath:e+"/protocolPath",schemaPath:"#/properties/protocolPath/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=U===a}else var p=!0;if(p){if(t.recipient!==void 0){let U=t.recipient,W=a;if(a===a)if(typeof U=="string"){if(!e0.test(U))return ft.errors=[{instancePath:e+"/recipient",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return ft.errors=[{instancePath:e+"/recipient",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/did/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=W===a}else var p=!0;if(p){if(t.contextId!==void 0){let U=a;if(typeof t.contextId!="string")return ft.errors=[{instancePath:e+"/contextId",schemaPath:"#/properties/contextId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=U===a}else var p=!0;if(p){if(t.schema!==void 0){let U=a;if(typeof t.schema!="string")return ft.errors=[{instancePath:e+"/schema",schemaPath:"#/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=U===a}else var p=!0;if(p){if(t.recordId!==void 0){let U=a;if(typeof t.recordId!="string")return ft.errors=[{instancePath:e+"/recordId",schemaPath:"#/properties/recordId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=U===a}else var p=!0;if(p){if(t.parentId!==void 0){let U=a;if(typeof t.parentId!="string")return ft.errors=[{instancePath:e+"/parentId",schemaPath:"#/properties/parentId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=U===a}else var p=!0;if(p){if(t.dataFormat!==void 0){let U=a;if(typeof t.dataFormat!="string")return ft.errors=[{instancePath:e+"/dataFormat",schemaPath:"#/properties/dataFormat/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var p=U===a}else var p=!0;if(p){if(t.dataSize!==void 0){let U=t.dataSize,W=a;if(a===a)if(U&&typeof U=="object"&&!Array.isArray(U)){if(Object.keys(U).length<1)return ft.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let S=a;for(let k in U)if(!(k==="gt"||k==="gte"||k==="lt"||k==="lte")){return ft.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:k},message:"must NOT have additional properties"}],!1;break}if(S===a){if(U.gt!==void 0){let k=a,f=a,y=a;if(U&&typeof U=="object"&&!Array.isArray(U)){let w;if(U.gte===void 0&&(w="gte")){let _={};s===null?s=[_]:s.push(_),a++}}var g=y===a;if(g)return ft.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/gt/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=f,s!==null&&(f?s.length=f:s=null);var v=k===a}else var v=!0;if(v){if(U.gte!==void 0){let k=a,f=a,y=a;if(U&&typeof U=="object"&&!Array.isArray(U)){let _;if(U.gt===void 0&&(_="gt")){let x={};s===null?s=[x]:s.push(x),a++}}var E=y===a;if(E)return ft.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/gte/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=f,s!==null&&(f?s.length=f:s=null);var v=k===a}else var v=!0;if(v){if(U.lt!==void 0){let k=a,f=a,y=a;if(U&&typeof U=="object"&&!Array.isArray(U)){let _;if(U.lte===void 0&&(_="lte")){let x={};s===null?s=[x]:s.push(x),a++}}var A=y===a;if(A)return ft.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/lt/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=f,s!==null&&(f?s.length=f:s=null);var v=k===a}else var v=!0;if(v){if(U.lte!==void 0){let k=a,f=a,y=a;if(U&&typeof U=="object"&&!Array.isArray(U)){let _;if(U.lt===void 0&&(_="lt")){let x={};s===null?s=[x]:s.push(x),a++}}var P=y===a;if(P)return ft.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/lte/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;a=f,s!==null&&(f?s.length=f:s=null);var v=k===a}else var v=!0;if(v){if(U.gt!==void 0){let k=U.gt,f=a;if(!(typeof k=="number"&&isFinite(k)))return ft.errors=[{instancePath:e+"/dataSize/gt",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/gt/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var I=f===a}else var I=!0;if(I){if(U.gte!==void 0){let k=U.gte,f=a;if(!(typeof k=="number"&&isFinite(k)))return ft.errors=[{instancePath:e+"/dataSize/gte",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/gte/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var I=f===a}else var I=!0;if(I){if(U.lt!==void 0){let k=U.lt,f=a;if(!(typeof k=="number"&&isFinite(k)))return ft.errors=[{instancePath:e+"/dataSize/lt",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/lt/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var I=f===a}else var I=!0;if(I)if(U.lte!==void 0){let k=U.lte,f=a;if(!(typeof k=="number"&&isFinite(k)))return ft.errors=[{instancePath:e+"/dataSize/lte",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/lte/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var I=f===a}else var I=!0}}}}}}}}}else return ft.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var p=W===a}else var p=!0;if(p){if(t.dateCreated!==void 0){let U=t.dateCreated,W=a;if(a===W)if(U&&typeof U=="object"&&!Array.isArray(U)){if(Object.keys(U).length<1)return ft.errors=[{instancePath:e+"/dateCreated",schemaPath:"#/properties/dateCreated/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let T=a;for(let S in U)if(!(S==="from"||S==="to")){return ft.errors=[{instancePath:e+"/dateCreated",schemaPath:"#/properties/dateCreated/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:S},message:"must NOT have additional properties"}],!1;break}if(T===a){if(U.from!==void 0){let S=U.from,k=a;if(a===a)if(typeof S=="string"){if(!Ln.test(S))return ft.errors=[{instancePath:e+"/dateCreated/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return ft.errors=[{instancePath:e+"/dateCreated/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var $=k===a}else var $=!0;if($)if(U.to!==void 0){let S=U.to,k=a;if(a===a)if(typeof S=="string"){if(!Ln.test(S))return ft.errors=[{instancePath:e+"/dateCreated/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return ft.errors=[{instancePath:e+"/dateCreated/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var $=k===a}else var $=!0}}}else return ft.errors=[{instancePath:e+"/dateCreated",schemaPath:"#/properties/dateCreated/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var p=W===a}else var p=!0;if(p){if(t.datePublished!==void 0){let U=t.datePublished,W=a;if(a===W)if(U&&typeof U=="object"&&!Array.isArray(U)){if(Object.keys(U).length<1)return ft.errors=[{instancePath:e+"/datePublished",schemaPath:"#/properties/datePublished/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let T=a;for(let S in U)if(!(S==="from"||S==="to")){return ft.errors=[{instancePath:e+"/datePublished",schemaPath:"#/properties/datePublished/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:S},message:"must NOT have additional properties"}],!1;break}if(T===a){if(U.from!==void 0){let S=U.from,k=a;if(a===a)if(typeof S=="string"){if(!Ln.test(S))return ft.errors=[{instancePath:e+"/datePublished/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return ft.errors=[{instancePath:e+"/datePublished/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var N=k===a}else var N=!0;if(N)if(U.to!==void 0){let S=U.to,k=a;if(a===a)if(typeof S=="string"){if(!Ln.test(S))return ft.errors=[{instancePath:e+"/datePublished/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return ft.errors=[{instancePath:e+"/datePublished/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var N=k===a}else var N=!0}}}else return ft.errors=[{instancePath:e+"/datePublished",schemaPath:"#/properties/datePublished/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var p=W===a}else var p=!0;if(p)if(t.dateUpdated!==void 0){let U=t.dateUpdated,W=a;if(a===W)if(U&&typeof U=="object"&&!Array.isArray(U)){if(Object.keys(U).length<1)return ft.errors=[{instancePath:e+"/dateUpdated",schemaPath:"#/properties/dateUpdated/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let T=a;for(let S in U)if(!(S==="from"||S==="to")){return ft.errors=[{instancePath:e+"/dateUpdated",schemaPath:"#/properties/dateUpdated/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:S},message:"must NOT have additional properties"}],!1;break}if(T===a){if(U.from!==void 0){let S=U.from,k=a;if(a===a)if(typeof S=="string"){if(!Ln.test(S))return ft.errors=[{instancePath:e+"/dateUpdated/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return ft.errors=[{instancePath:e+"/dateUpdated/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var K=k===a}else var K=!0;if(K)if(U.to!==void 0){let S=U.to,k=a;if(a===a)if(typeof S=="string"){if(!Ln.test(S))return ft.errors=[{instancePath:e+"/dateUpdated/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return ft.errors=[{instancePath:e+"/dateUpdated/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var K=k===a}else var K=!0}}}else return ft.errors=[{instancePath:e+"/dateUpdated",schemaPath:"#/properties/dateUpdated/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var p=W===a}else var p=!0}}}}}}}}}}}}}}}}else return ft.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return ft.errors=s,a===0}ft.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var Q_e=Si,tV={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://identity.foundation/dwn/json-schemas/events-get.json",type:"object",additionalProperties:!1,required:["authorization","descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp"],properties:{interface:{enum:["Events"],type:"string"},method:{enum:["Get"],type:"string"},messageTimestamp:{type:"string"},cursor:{$ref:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json"}}}}};function Si(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Si.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let m;if(t.authorization===void 0&&(m="authorization")||t.descriptor===void 0&&(m="descriptor"))return Si.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:m},message:"must have required property '"+m+"'"}],!1;{let p=a;for(let g in t)if(!(g==="authorization"||g==="descriptor")){return Si.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g},message:"must NOT have additional properties"}],!1;break}if(p===a){if(t.authorization!==void 0){let g=a;Kn(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i,dynamicAnchors:o})||(s=s===null?Kn.errors:s.concat(Kn.errors),a=s.length);var u=g===a}else var u=!0;if(u)if(t.descriptor!==void 0){let g=t.descriptor,v=a;if(a===v)if(g&&typeof g=="object"&&!Array.isArray(g)){let A;if(g.interface===void 0&&(A="interface")||g.method===void 0&&(A="method")||g.messageTimestamp===void 0&&(A="messageTimestamp"))return Si.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:A},message:"must have required property '"+A+"'"}],!1;{let P=a;for(let I in g)if(!(I==="interface"||I==="method"||I==="messageTimestamp"||I==="cursor")){return Si.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:I},message:"must NOT have additional properties"}],!1;break}if(P===a){if(g.interface!==void 0){let I=g.interface,$=a;if(typeof I!="string")return Si.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(I!=="Events")return Si.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:tV.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var c=$===a}else var c=!0;if(c){if(g.method!==void 0){let I=g.method,$=a;if(typeof I!="string")return Si.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(I!=="Get")return Si.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:tV.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var c=$===a}else var c=!0;if(c){if(g.messageTimestamp!==void 0){let I=a;if(typeof g.messageTimestamp!="string")return Si.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"#/properties/descriptor/properties/messageTimestamp/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=I===a}else var c=!0;if(c)if(g.cursor!==void 0){let I=g.cursor,$=a;if(a===a)if(I&&typeof I=="object"&&!Array.isArray(I)){if(Object.keys(I).length<1)return Si.errors=[{instancePath:e+"/descriptor/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let F;if(I.messageCid===void 0&&(F="messageCid")||I.value===void 0&&(F="value"))return Si.errors=[{instancePath:e+"/descriptor/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/required",keyword:"required",params:{missingProperty:F},message:"must have required property '"+F+"'"}],!1;{let U=a;for(let W in I)if(!(W==="messageCid"||W==="value")){return Si.errors=[{instancePath:e+"/descriptor/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:W},message:"must NOT have additional properties"}],!1;break}if(U===a){if(I.messageCid!==void 0){let W=a;if(typeof I.messageCid!="string")return Si.errors=[{instancePath:e+"/descriptor/cursor/messageCid",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/properties/messageCid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var l=W===a}else var l=!0;if(l)if(I.value!==void 0){let W=I.value,L=a;if(typeof W!="string"&&!(typeof W=="number"&&isFinite(W)))return Si.errors=[{instancePath:e+"/descriptor/cursor/value",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/properties/value/type",keyword:"type",params:{type:y5.properties.value.type},message:"must be string,number"}],!1;var l=L===a}else var l=!0}}}}else return Si.errors=[{instancePath:e+"/descriptor/cursor",schemaPath:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var c=$===a}else var c=!0}}}}}else return Si.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var u=v===a}else var u=!0}}}else return Si.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Si.errors=s,a===0}Si.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var exe=qn,rV={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://identity.foundation/dwn/json-schemas/events-query.json",type:"object",additionalProperties:!1,required:["authorization","descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp","filters"],properties:{interface:{enum:["Events"],type:"string"},method:{enum:["Query"],type:"string"},messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time"},filters:{type:"array",minItems:1,items:{$ref:"https://identity.foundation/dwn/json-schemas/events-filter.json"}},cursor:{$ref:"https://identity.foundation/dwn/json-schemas/pagination-cursor.json"}}}}};function qn(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=qn.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),a===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let p;if(t.authorization===void 0&&(p="authorization")||t.descriptor===void 0&&(p="descriptor"))return qn.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:p},message:"must have required property '"+p+"'"}],!1;{let g=a;for(let v in t)if(!(v==="authorization"||v==="descriptor")){return qn.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:v},message:"must NOT have additional properties"}],!1;break}if(g===a){if(t.authorization!==void 0){let v=a;Kn(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i,dynamicAnchors:o})||(s=s===null?Kn.errors:s.concat(Kn.errors),a=s.length);var u=v===a}else var u=!0;if(u)if(t.descriptor!==void 0){let v=t.descriptor,E=a;if(a===E)if(v&&typeof v=="object"&&!Array.isArray(v)){let P;if(v.interface===void 0&&(P="interface")||v.method===void 0&&(P="method")||v.messageTimestamp===void 0&&(P="messageTimestamp")||v.filters===void 0&&(P="filters"))return qn.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:P},message:"must have required property '"+P+"'"}],!1;{let I=a;for(let $ in v)if(!($==="interface"||$==="method"||$==="messageTimestamp"||$==="filters"||$==="cursor")){return qn.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:$},message:"must NOT have additional properties"}],!1;break}if(I===a){if(v.interface!==void 0){let $=v.interface,N=a;if(typeof $!="string")return qn.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if($!=="Events")return qn.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:rV.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var c=N===a}else var c=!0;if(c){if(v.method!==void 0){let $=v.method,N=a;if(typeof $!="string")return qn.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if($!=="Query")return qn.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:rV.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var c=N===a}else var c=!0;if(c){if(v.messageTimestamp!==void 0){let $=v.messageTimestamp,N=a;if(a===a)if(typeof $=="string"){if(!Ln.test($))return qn.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return qn.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/$defs/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=N===a}else var c=!0;if(c){if(v.filters!==void 0){let $=v.filters,N=a;if(a===N)if(Array.isArray($)){if($.length<1)return qn.errors=[{instancePath:e+"/descriptor/filters",schemaPath:"#/properties/descriptor/properties/filters/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{var l=!0;let F=$.length;for(let U=0;U=",limit:0},message:"must be >= 0"}],!1}else return Rr.errors=[{instancePath:e+"/$size/min",schemaPath:"#/properties/%24size/properties/min/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var P=x===a}else var P=!0;if(P)if(k.max!==void 0){let _=k.max,x=a;if(a===x)if(typeof _=="number"&&isFinite(_)){if(_<0||isNaN(_))return Rr.errors=[{instancePath:e+"/$size/max",schemaPath:"#/properties/%24size/properties/max/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1}else return Rr.errors=[{instancePath:e+"/$size/max",schemaPath:"#/properties/%24size/properties/max/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var P=x===a}else var P=!0}}else return Rr.errors=[{instancePath:e+"/$size",schemaPath:"#/properties/%24size/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var c=f===a}else var c=!0;if(c){if(t.$tags!==void 0){let k=t.$tags,f=a;if(a===f)if(k&&typeof k=="object"&&!Array.isArray(k)){if(Object.keys(k).length<1)return Rr.errors=[{instancePath:e+"/$tags",schemaPath:"#/properties/%24tags/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;if(k.$requiredTags!==void 0){let w=k.$requiredTags,_=a;if(a===_)if(Array.isArray(w)){var I=!0;let x=w.length;for(let b=0;bS_,decode:()=>uEe,encode:()=>dEe,name:()=>cEe});h();h();h();h();var Ixe=["string","number","bigint","symbol"],Pxe=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function hV(t){if(t===null)return"null";if(t===void 0)return"undefined";if(t===!0||t===!1)return"boolean";let e=typeof t;if(Ixe.includes(e))return e;if(e==="function")return"Function";if(Array.isArray(t))return"Array";if(kxe(t))return"Buffer";let r=Rxe(t);return r||"Object"}function kxe(t){return t&&t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer.call(null,t)}function Rxe(t){let e=Object.prototype.toString.call(t).slice(8,-1);if(Pxe.includes(e))return e}h();var pe=class{constructor(e,r,n){this.major=e,this.majorEncoded=e<<5,this.name=r,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.majore.major?1:0}};pe.uint=new pe(0,"uint",!0);pe.negint=new pe(1,"negint",!0);pe.bytes=new pe(2,"bytes",!0);pe.string=new pe(3,"string",!0);pe.array=new pe(4,"array",!1);pe.map=new pe(5,"map",!1);pe.tag=new pe(6,"tag",!1);pe.float=new pe(7,"float",!0);pe.false=new pe(7,"false",!0);pe.true=new pe(7,"true",!0);pe.null=new pe(7,"null",!0);pe.undefined=new pe(7,"undefined",!0);pe.break=new pe(7,"break",!0);var We=class{constructor(e,r,n){this.type=e,this.value=r,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};h();h();var gb=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Dxe=new TextDecoder,Bxe=new TextEncoder;function g5(t){return gb&&globalThis.Buffer.isBuffer(t)}function r7(t){return t instanceof Uint8Array?g5(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t:Uint8Array.from(t)}var gV=gb?(t,e,r)=>r-e>64?globalThis.Buffer.from(t.subarray(e,r)).toString("utf8"):mV(t,e,r):(t,e,r)=>r-e>64?Dxe.decode(t.subarray(e,r)):mV(t,e,r),vV=gb?t=>t.length>64?globalThis.Buffer.from(t):pV(t):t=>t.length>64?Bxe.encode(t):pV(t),cl=t=>Uint8Array.from(t),vb=gb?(t,e,r)=>g5(t)?new Uint8Array(t.subarray(e,r)):t.slice(e,r):(t,e,r)=>t.slice(e,r),bV=gb?(t,e)=>(t=t.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),r7(globalThis.Buffer.concat(t,e))):(t,e)=>{let r=new Uint8Array(e),n=0;for(let i of t)n+i.length>r.length&&(i=i.subarray(0,r.length-n)),r.set(i,n),n+=i.length;return r},wV=gb?t=>globalThis.Buffer.allocUnsafe(t):t=>new Uint8Array(t);function _V(t,e){if(g5(t)&&g5(e))return t.compare(e);for(let r=0;r55295&&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 mV(t,e,r){let n=[];for(;e239?4:i>223?3:i>191?2:1;if(e+s<=r){let a,d,u,c;switch(s){case 1:i<128&&(o=i);break;case 2:a=t[e+1],(a&192)===128&&(c=(i&31)<<6|a&63,c>127&&(o=c));break;case 3:a=t[e+1],d=t[e+2],(a&192)===128&&(d&192)===128&&(c=(i&15)<<12|(a&63)<<6|d&63,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:a=t[e+1],d=t[e+2],u=t[e+3],(a&192)===128&&(d&192)===128&&(u&192)===128&&(c=(i&15)<<18|(a&63)<<12|(d&63)<<6|u&63,c>65535&&c<1114112&&(o=c))}}o===null?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),e+=s}return Mxe(n)}var yV=4096;function Mxe(t){let e=t.length;if(e<=yV)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn.length/2?(r=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=vb(n,0,this.cursor)}else r=bV(this.chunks,this.cursor);return e&&this.reset(),r}};h();var Ft="CBOR decode error:",n7="CBOR encode error:",b_=[];b_[23]=1;b_[24]=2;b_[25]=3;b_[26]=5;b_[27]=9;function jf(t,e,r){if(t.length-e>>8,n&255])}else if(r>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=s&255,s=s>>8,i[3]=s&255,s=s>>8,i[2]=s&255,s=s>>8,i[1]=s&255,t.push(i)}else throw new Error(`${Ft} encountered BigInt larger than allowable range`)}}Jc.encodedSize=function(e){return qo.encodedSize(e.value)};qo.encodedSize=function(e){return er.value?1:0};h();function TV(t,e,r,n){return new We(pe.negint,-1-rc(t,e+1,n),2)}function IV(t,e,r,n){return new We(pe.negint,-1-nc(t,e+1,n),3)}function PV(t,e,r,n){return new We(pe.negint,-1-ic(t,e+1,n),5)}var i7=BigInt(-1),kV=BigInt(1);function RV(t,e,r,n){let i=oc(t,e+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new We(pe.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Ft} integers outside of the safe integer range are not supported`);return new We(pe.negint,i7-BigInt(i),9)}function v5(t,e){let r=e.value,n=typeof r=="bigint"?r*i7-kV:r*-1-1;qo(t,e.type.majorEncoded,n)}v5.encodedSize=function(e){let r=e.value,n=typeof r=="bigint"?r*i7-kV:r*-1-1;return nr.value?-1:0};h();function w_(t,e,r,n){jf(t,e,r+n);let i=vb(t,e+r,e+r+n);return new We(pe.bytes,i,r+n)}function DV(t,e,r,n){return w_(t,e,1,r)}function BV(t,e,r,n){return w_(t,e,2,rc(t,e+1,n))}function MV(t,e,r,n){return w_(t,e,3,nc(t,e+1,n))}function CV(t,e,r,n){return w_(t,e,5,ic(t,e+1,n))}function OV(t,e,r,n){let i=oc(t,e+1,n);if(typeof i=="bigint")throw new Error(`${Ft} 64-bit integer bytes lengths not supported`);return w_(t,e,9,i)}function b5(t){return t.encodedBytes===void 0&&(t.encodedBytes=t.type===pe.string?vV(t.value):t.value),t.encodedBytes}function bb(t,e){let r=b5(e);qo(t,e.type.majorEncoded,r.length),t.push(r)}bb.encodedSize=function(e){let r=b5(e);return qo.encodedSize(r.length)+r.length};bb.compareTokens=function(e,r){return $xe(b5(e),b5(r))};function $xe(t,e){return t.lengthe.length?1:_V(t,e)}h();function __(t,e,r,n,i){let o=r+n;jf(t,e,o);let s=new We(pe.string,gV(t,e+r,e+o),o);return i.retainStringBytes===!0&&(s.byteValue=vb(t,e+r,e+o)),s}function $V(t,e,r,n){return __(t,e,1,r,n)}function NV(t,e,r,n){return __(t,e,2,rc(t,e+1,n),n)}function jV(t,e,r,n){return __(t,e,3,nc(t,e+1,n),n)}function UV(t,e,r,n){return __(t,e,5,ic(t,e+1,n),n)}function qV(t,e,r,n){let i=oc(t,e+1,n);if(typeof i=="bigint")throw new Error(`${Ft} 64-bit integer string lengths not supported`);return __(t,e,9,i,n)}var LV=bb;h();function wb(t,e,r,n){return new We(pe.array,n,r)}function KV(t,e,r,n){return wb(t,e,1,r)}function FV(t,e,r,n){return wb(t,e,2,rc(t,e+1,n))}function zV(t,e,r,n){return wb(t,e,3,nc(t,e+1,n))}function WV(t,e,r,n){return wb(t,e,5,ic(t,e+1,n))}function VV(t,e,r,n){let i=oc(t,e+1,n);if(typeof i=="bigint")throw new Error(`${Ft} 64-bit integer array lengths not supported`);return wb(t,e,9,i)}function HV(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ft} indefinite length items not allowed`);return wb(t,e,1,1/0)}function w5(t,e){qo(t,pe.array.majorEncoded,e.value)}w5.compareTokens=Jc.compareTokens;w5.encodedSize=function(e){return qo.encodedSize(e.value)};h();function _b(t,e,r,n){return new We(pe.map,n,r)}function GV(t,e,r,n){return _b(t,e,1,r)}function JV(t,e,r,n){return _b(t,e,2,rc(t,e+1,n))}function YV(t,e,r,n){return _b(t,e,3,nc(t,e+1,n))}function ZV(t,e,r,n){return _b(t,e,5,ic(t,e+1,n))}function XV(t,e,r,n){let i=oc(t,e+1,n);if(typeof i=="bigint")throw new Error(`${Ft} 64-bit integer map lengths not supported`);return _b(t,e,9,i)}function QV(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ft} indefinite length items not allowed`);return _b(t,e,1,1/0)}function _5(t,e){qo(t,pe.map.majorEncoded,e.value)}_5.compareTokens=Jc.compareTokens;_5.encodedSize=function(e){return qo.encodedSize(e.value)};h();function eH(t,e,r,n){return new We(pe.tag,r,1)}function tH(t,e,r,n){return new We(pe.tag,rc(t,e+1,n),2)}function rH(t,e,r,n){return new We(pe.tag,nc(t,e+1,n),3)}function nH(t,e,r,n){return new We(pe.tag,ic(t,e+1,n),5)}function iH(t,e,r,n){return new We(pe.tag,oc(t,e+1,n),9)}function x5(t,e){qo(t,pe.tag.majorEncoded,e.value)}x5.compareTokens=Jc.compareTokens;x5.encodedSize=function(e){return qo.encodedSize(e.value)};h();var Kxe=20,Fxe=21,zxe=22,Wxe=23;function oH(t,e,r,n){if(n.allowUndefined===!1)throw new Error(`${Ft} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new We(pe.null,null,1):new We(pe.undefined,void 0,1)}function sH(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ft} indefinite length items not allowed`);return new We(pe.break,void 0,1)}function o7(t,e,r){if(r){if(r.allowNaN===!1&&Number.isNaN(t))throw new Error(`${Ft} NaN values are not supported`);if(r.allowInfinity===!1&&(t===1/0||t===-1/0))throw new Error(`${Ft} Infinity values are not supported`)}return new We(pe.float,t,e)}function aH(t,e,r,n){return o7(s7(t,e+1),3,n)}function cH(t,e,r,n){return o7(a7(t,e+1),5,n)}function dH(t,e,r,n){return o7(hH(t,e+1),9,n)}function E5(t,e,r){let n=e.value;if(n===!1)t.push([pe.float.majorEncoded|Kxe]);else if(n===!0)t.push([pe.float.majorEncoded|Fxe]);else if(n===null)t.push([pe.float.majorEncoded|zxe]);else if(n===void 0)t.push([pe.float.majorEncoded|Wxe]);else{let i,o=!1;(!r||r.float64!==!0)&&(lH(n),i=s7(Xd,1),n===i||Number.isNaN(n)?(Xd[0]=249,t.push(Xd.slice(0,3)),o=!0):(fH(n),i=a7(Xd,1),n===i&&(Xd[0]=250,t.push(Xd.slice(0,5)),o=!0))),o||(Vxe(n),i=hH(Xd,1),Xd[0]=251,t.push(Xd.slice(0,9)))}}E5.encodedSize=function(e,r){let n=e.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){lH(n);let i=s7(Xd,1);if(n===i||Number.isNaN(n))return 3;if(fH(n),i=a7(Xd,1),n===i)return 5}return 9};var uH=new ArrayBuffer(9),Yc=new DataView(uH,1),Xd=new Uint8Array(uH,0);function lH(t){if(t===1/0)Yc.setUint16(0,31744,!1);else if(t===-1/0)Yc.setUint16(0,64512,!1);else if(Number.isNaN(t))Yc.setUint16(0,32256,!1);else{Yc.setFloat32(0,t);let e=Yc.getUint32(0),r=(e&2139095040)>>23,n=e&8388607;if(r===255)Yc.setUint16(0,31744,!1);else if(r===0)Yc.setUint16(0,(t&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Yc.setUint16(0,0):i<-14?Yc.setUint16(0,(e&2147483648)>>16|1<<24+i,!1):Yc.setUint16(0,(e&2147483648)>>16|i+15<<10|n>>13,!1)}}}function s7(t,e){if(t.length-e<2)throw new Error(`${Ft} not enough data for float16`);let r=(t[e]<<8)+t[e+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function fH(t){Yc.setFloat32(0,t,!1)}function a7(t,e){if(t.length-e<4)throw new Error(`${Ft} not enough data for float32`);let r=(t.byteOffset||0)+e;return new DataView(t.buffer,r,4).getFloat32(0,!1)}function Vxe(t){Yc.setFloat64(0,t,!1)}function hH(t,e){if(t.length-e<8)throw new Error(`${Ft} not enough data for float64`);let r=(t.byteOffset||0)+e;return new DataView(t.buffer,r,8).getFloat64(0,!1)}E5.compareTokens=Jc.compareTokens;function Yr(t,e,r){throw new Error(`${Ft} encountered invalid minor (${r}) for major ${t[e]>>>5}`)}function S5(t){return()=>{throw new Error(`${Ft} ${t}`)}}var Be=[];for(let t=0;t<=23;t++)Be[t]=Yr;Be[24]=xV;Be[25]=EV;Be[26]=SV;Be[27]=AV;Be[28]=Yr;Be[29]=Yr;Be[30]=Yr;Be[31]=Yr;for(let t=32;t<=55;t++)Be[t]=Yr;Be[56]=TV;Be[57]=IV;Be[58]=PV;Be[59]=RV;Be[60]=Yr;Be[61]=Yr;Be[62]=Yr;Be[63]=Yr;for(let t=64;t<=87;t++)Be[t]=DV;Be[88]=BV;Be[89]=MV;Be[90]=CV;Be[91]=OV;Be[92]=Yr;Be[93]=Yr;Be[94]=Yr;Be[95]=S5("indefinite length bytes/strings are not supported");for(let t=96;t<=119;t++)Be[t]=$V;Be[120]=NV;Be[121]=jV;Be[122]=UV;Be[123]=qV;Be[124]=Yr;Be[125]=Yr;Be[126]=Yr;Be[127]=S5("indefinite length bytes/strings are not supported");for(let t=128;t<=151;t++)Be[t]=KV;Be[152]=FV;Be[153]=zV;Be[154]=WV;Be[155]=VV;Be[156]=Yr;Be[157]=Yr;Be[158]=Yr;Be[159]=HV;for(let t=160;t<=183;t++)Be[t]=GV;Be[184]=JV;Be[185]=YV;Be[186]=ZV;Be[187]=XV;Be[188]=Yr;Be[189]=Yr;Be[190]=Yr;Be[191]=QV;for(let t=192;t<=215;t++)Be[t]=eH;Be[216]=tH;Be[217]=rH;Be[218]=nH;Be[219]=iH;Be[220]=Yr;Be[221]=Yr;Be[222]=Yr;Be[223]=Yr;for(let t=224;t<=243;t++)Be[t]=S5("simple values are not supported");Be[244]=Yr;Be[245]=Yr;Be[246]=Yr;Be[247]=oH;Be[248]=S5("simple values are not supported");Be[249]=aH;Be[250]=cH;Be[251]=dH;Be[252]=Yr;Be[253]=Yr;Be[254]=Yr;Be[255]=sH;var Qd=[];for(let t=0;t<24;t++)Qd[t]=new We(pe.uint,t,1);for(let t=-1;t>=-24;t--)Qd[31-t]=new We(pe.negint,t,1);Qd[64]=new We(pe.bytes,new Uint8Array(0),1);Qd[96]=new We(pe.string,"",1);Qd[128]=new We(pe.array,0,1);Qd[160]=new We(pe.map,0,1);Qd[244]=new We(pe.false,!1,1);Qd[245]=new We(pe.true,!0,1);Qd[246]=new We(pe.null,null,1);function pH(t){switch(t.type){case pe.false:return cl([244]);case pe.true:return cl([245]);case pe.null:return cl([246]);case pe.bytes:return t.value.length?void 0:cl([64]);case pe.string:return t.value===""?cl([96]):void 0;case pe.array:return t.value===0?cl([128]):void 0;case pe.map:return t.value===0?cl([160]):void 0;case pe.uint:return t.value<24?cl([Number(t.value)]):void 0;case pe.negint:if(t.value>=-24)return cl([31-Number(t.value)])}}var Gxe={float64:!1,mapSorter:Zxe,quickEncodeToken:pH};function Jxe(){let t=[];return t[pe.uint.major]=Jc,t[pe.negint.major]=v5,t[pe.bytes.major]=bb,t[pe.string.major]=LV,t[pe.array.major]=w5,t[pe.map.major]=_5,t[pe.tag.major]=x5,t[pe.float.major]=E5,t}var mH=Jxe(),c7=new v_,T5=class t{constructor(e,r){this.obj=e,this.parent=r}includes(e){let r=this;do if(r.obj===e)return!0;while(r=r.parent);return!1}static createCheck(e,r){if(e&&e.includes(r))throw new Error(`${n7} object contains circular references`);return new t(r,e)}},Ip={null:new We(pe.null,null),undefined:new We(pe.undefined,void 0),true:new We(pe.true,!0),false:new We(pe.false,!1),emptyArray:new We(pe.array,0),emptyMap:new We(pe.map,0)},Pp={number(t,e,r,n){return!Number.isInteger(t)||!Number.isSafeInteger(t)?new We(pe.float,t):t>=0?new We(pe.uint,t):new We(pe.negint,t)},bigint(t,e,r,n){return t>=BigInt(0)?new We(pe.uint,t):new We(pe.negint,t)},Uint8Array(t,e,r,n){return new We(pe.bytes,t)},string(t,e,r,n){return new We(pe.string,t)},boolean(t,e,r,n){return t?Ip.true:Ip.false},null(t,e,r,n){return Ip.null},undefined(t,e,r,n){return Ip.undefined},ArrayBuffer(t,e,r,n){return new We(pe.bytes,new Uint8Array(t))},DataView(t,e,r,n){return new We(pe.bytes,new Uint8Array(t.buffer,t.byteOffset,t.byteLength))},Array(t,e,r,n){if(!t.length)return r.addBreakTokens===!0?[Ip.emptyArray,new We(pe.break)]:Ip.emptyArray;n=T5.createCheck(n,t);let i=[],o=0;for(let s of t)i[o++]=A5(s,r,n);return r.addBreakTokens?[new We(pe.array,t.length),i,new We(pe.break)]:[new We(pe.array,t.length),i]},Object(t,e,r,n){let i=e!=="Object",o=i?t.keys():Object.keys(t),s=i?t.size:o.length;if(!s)return r.addBreakTokens===!0?[Ip.emptyMap,new We(pe.break)]:Ip.emptyMap;n=T5.createCheck(n,t);let a=[],d=0;for(let u of o)a[d++]=[A5(u,r,n),A5(i?t.get(u):t[u],r,n)];return Yxe(a,r),r.addBreakTokens?[new We(pe.map,s),a,new We(pe.break)]:[new We(pe.map,s),a]}};Pp.Map=Pp.Object;Pp.Buffer=Pp.Uint8Array;for(let t of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Pp[`${t}Array`]=Pp.DataView;function A5(t,e={},r){let n=hV(t),i=e&&e.typeEncoders&&e.typeEncoders[n]||Pp[n];if(typeof i=="function"){let s=i(t,n,e,r);if(s!=null)return s}let o=Pp[n];if(!o)throw new Error(`${n7} unsupported type: ${n}`);return o(t,n,e,r)}function Yxe(t,e){e.mapSorter&&t.sort(e.mapSorter)}function Zxe(t,e){let r=Array.isArray(t[0])?t[0][0]:t[0],n=Array.isArray(e[0])?e[0][0]:e[0];if(r.type!==n.type)return r.type.compare(n.type);let i=r.type.major,o=mH[i].compareTokens(r,n);return o===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),o}function yH(t,e,r,n){if(Array.isArray(e))for(let i of e)yH(t,i,r,n);else r[e.type.major](t,e,n)}function Xxe(t,e,r){let n=A5(t,r);if(!Array.isArray(n)&&r.quickEncodeToken){let i=r.quickEncodeToken(n);if(i)return i;let o=e[n.type.major];if(o.encodedSize){let s=o.encodedSize(n,r),a=new v_(s);if(o(a,n,r),a.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return r7(a.chunks[0])}}return c7.reset(),yH(c7,n,e,r),c7.toBytes(!0)}function d7(t,e){return e=Object.assign({},Gxe,e),Xxe(t,mH,e)}h();var Qxe={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},u7=class{constructor(e,r={}){this.pos=0,this.data=e,this.options=r}done(){return this.pos>=this.data.length}next(){let e=this.data[this.pos],r=Qd[e];if(r===void 0){let n=Be[e];if(!n)throw new Error(`${Ft} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let i=e&31;r=n(this.data,this.pos,i,this.options)}return this.pos+=r.encodedLength,r}},x_=Symbol.for("DONE"),I5=Symbol.for("BREAK");function eEe(t,e,r){let n=[];for(let i=0;id7(t,sEe),uEe=t=>l7(t,vH);h();I_();var kp=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},P5=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(a,d){s=t[o](s),i(a,d,s.done,s.value)})}}function i(o,s,a,d){Promise.resolve(d).then(function(u){o({value:u,done:a})},s)}},mo=function(t){return this instanceof mo?(this.v=t,this):new mo(t)},k5=function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(m){n[m]&&(i[m]=function(p){return new Promise(function(g,v){o.push([m,p,g,v])>1||a(m,p)})})}function a(m,p){try{d(n[m](p))}catch(g){l(o[0][3],g)}}function d(m){m.value instanceof mo?Promise.resolve(m.value.v).then(u,c):l(o[0][2],m)}function u(m){a("next",m)}function c(m){a("throw",m)}function l(m,p){m(p),o.shift(),o.length&&a(o[0][0],o[0][1])}},P_=class{open(){return kp(this,void 0,void 0,function*(){})}close(){return kp(this,void 0,void 0,function*(){})}put(e,r,n){return kp(this,void 0,void 0,function*(){return e})}get(e,r){return kp(this,void 0,void 0,function*(){return new Uint8Array})}has(e,r){return kp(this,void 0,void 0,function*(){return!1})}delete(e,r){return kp(this,void 0,void 0,function*(){})}isEmpty(e){return kp(this,void 0,void 0,function*(){return!0})}putMany(e,r){return k5(this,arguments,function*(){var i,o,s,a;try{for(var d=!0,u=P5(e),c;c=yield mo(u.next()),i=c.done,!i;d=!0){a=c.value,d=!1;let l=a;yield mo(this.put(l.cid,l.block,r)),yield yield mo(l.cid)}}catch(l){o={error:l}}finally{try{!d&&!i&&(s=u.return)&&(yield mo(s.call(u)))}finally{if(o)throw o.error}}})}getMany(e,r){return k5(this,arguments,function*(){var i,o,s,a;try{for(var d=!0,u=P5(e),c;c=yield mo(u.next()),i=c.done,!i;d=!0){a=c.value,d=!1;let l=a;yield yield mo({cid:l,block:yield mo(this.get(l,r))})}}catch(l){o={error:l}}finally{try{!d&&!i&&(s=u.return)&&(yield mo(s.call(u)))}finally{if(o)throw o.error}}})}getAll(e){return k5(this,arguments,function*(){var n,i,o,s;let a=this.db.iterator({keys:!0,keyEncoding:"buffer"},e);try{for(var d=!0,u=P5(a),c;c=yield mo(u.next()),n=c.done,!n;d=!0){s=c.value,d=!1;let[l,m]=s;yield yield mo({cid:qr.decode(l),block:m})}}catch(l){i={error:l}}finally{try{!d&&!n&&(o=u.return)&&(yield mo(o.call(u)))}finally{if(i)throw i.error}}})}deleteMany(e,r){return k5(this,arguments,function*(){var i,o,s,a;try{for(var d=!0,u=P5(e),c;c=yield mo(u.next()),i=c.done,!i;d=!0){a=c.value,d=!1;let l=a;yield mo(this.delete(l,r)),yield yield mo(l)}}catch(l){o={error:l}}finally{try{!d&&!i&&(s=u.return)&&(yield mo(s.call(u)))}finally{if(o)throw o.error}}})}clear(){return kp(this,void 0,void 0,function*(){})}};Uf();h();var A3e=Kt(sc(),1);h();h();h();function gEe(t){return t[Symbol.asyncIterator]!=null}function vEe(t,e=1){return e=Number(e),gEe(t)?async function*(){let r=[];if(e<1&&(e=1),e!==Math.round(e))throw new Error("Batch size must be an integer");for await(let n of t)for(r.push(n);r.length>=e;)yield r.slice(0,e),r=r.slice(e);for(;r.length>0;)yield r.slice(0,e),r=r.slice(e)}():function*(){let r=[];if(e<1&&(e=1),e!==Math.round(e))throw new Error("Batch size must be an integer");for(let n of t)for(r.push(n);r.length>=e;)yield r.slice(0,e),r=r.slice(e);for(;r.length>0;)yield r.slice(0,e),r=r.slice(e)}()}var k_=vEe;async function*R_(t,e=1){for await(let r of k_(t,e)){let n=r.map(async i=>i().then(o=>({ok:!0,value:o}),o=>({ok:!1,err:o})));for(let i=0;ii+o.length,0));let r=ac(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Rp(r)}h();function SH(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let r=0;for(let n of e)if(n instanceof Uint8Array)r+=n.byteLength,this.bufs.push(n);else if(R5(n))r+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=r}prepend(...e){this.prependAll(e)}prependAll(e){let r=0;for(let n of e.reverse())if(n instanceof Uint8Array)r+=n.byteLength,this.bufs.unshift(n);else if(R5(n))r+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=r}get(e){let r=AH(this.bufs,e);return r.buf[r.index]}set(e,r){let n=AH(this.bufs,e);n.buf[n.index]=r}write(e,r=0){if(e instanceof Uint8Array)for(let n=0;n0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,r){let{bufs:n,length:i}=this._subList(e,r);return D_(n,i)}subarray(e,r){let{bufs:n,length:i}=this._subList(e,r);return n.length===1?n[0]:D_(n,i)}sublist(e,r){let{bufs:n,length:i}=this._subList(e,r),o=new t;return o.length=i,o.bufs=[...n],o}_subList(e,r){if(e=e??0,r=r??this.length,e<0&&(e=this.length+e),r<0&&(r=this.length+r),e<0||r>this.length)throw new RangeError("index is out of bounds");if(e===r)return{bufs:[],length:0};if(e===0&&r===this.length)return{bufs:this.bufs,length:this.length};let n=[],i=0;for(let o=0;o=d)continue;let u=e>=a&&ea&&r<=d;if(u&&c){if(e===a&&r===d){n.push(s);break}let l=e-a;n.push(s.subarray(l,l+(r-e)));break}if(u){if(e===0){n.push(s);continue}n.push(s.subarray(e-a));continue}if(c){if(r===d){n.push(s);break}n.push(s.subarray(0,r-a));break}n.push(s)}return{bufs:n,length:r-e}}indexOf(e,r=0){if(!R5(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(r=Number(r??0),isNaN(r)&&(r=0),r<0&&(r=this.length+r),r<0&&(r=0),e.length===0)return r>this.length?this.length:r;let i=n.byteLength;if(i===0)throw new TypeError("search must be at least 1 byte long");let o=256,s=new Int32Array(o);for(let l=0;l=0;m--){let p=this.get(l+m);if(n[m]!==p){c=Math.max(1,m-a[p]);break}}if(c===0)return l}return-1}getInt8(e){let r=this.subarray(e,e+1);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt8(0)}setInt8(e,r){let n=ac(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,r),this.write(n,e)}getInt16(e,r){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,r)}setInt16(e,r,n){let i=qf(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,r,n),this.write(i,e)}getInt32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,r)}setInt32(e,r,n){let i=qf(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,r,n),this.write(i,e)}getBigInt64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,r)}setBigInt64(e,r,n){let i=qf(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,r,n),this.write(i,e)}getUint8(e){let r=this.subarray(e,e+1);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint8(0)}setUint8(e,r){let n=ac(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,r),this.write(n,e)}getUint16(e,r){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,r)}setUint16(e,r,n){let i=qf(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,r,n),this.write(i,e)}getUint32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,r)}setUint32(e,r,n){let i=qf(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,r,n),this.write(i,e)}getBigUint64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,r)}setBigUint64(e,r,n){let i=qf(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,r,n),this.write(i,e)}getFloat32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,r)}setFloat32(e,r,n){let i=qf(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,r,n),this.write(i,e)}getFloat64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,r)}setFloat64(e,r,n){let i=qf(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,r,n),this.write(i,e)}equals(e){if(e==null||!(e instanceof t)||e.bufs.length!==this.bufs.length)return!1;for(let r=0;ri+o.byteLength,0)),n.length=r,n}};var bEe=262144,IH=(t={})=>{let e=t.chunkSize??bEe;return async function*(n){let i=new xb,o=0,s=!1;for await(let a of n)for(i.append(a),o+=a.length;o>=e;)if(yield i.slice(0,e),s=!0,e===i.length)i=new xb,o=0;else{let d=new xb;d.append(i.sublist(e)),i=d,o-=e}(!s||o>0)&&(yield i.subarray(0,o))}};h();var a0={};Ur(a0,{code:()=>N_,createLink:()=>GH,createNode:()=>HH,decode:()=>Lf,encode:()=>dc,name:()=>y6e,prepare:()=>cc,validate:()=>D7});h();h();var A7={};Ur(A7,{base32:()=>Ab,base32hex:()=>DEe,base32hexpad:()=>MEe,base32hexpadupper:()=>CEe,base32hexupper:()=>BEe,base32pad:()=>kEe,base32padupper:()=>REe,base32upper:()=>PEe,base32z:()=>OEe});h();h();var Eb={};Ur(Eb,{coerce:()=>dl,empty:()=>PH,equals:()=>v7,fromHex:()=>_Ee,fromString:()=>b7,isBinary:()=>xEe,toHex:()=>wEe,toString:()=>w7});h();var PH=new Uint8Array(0);function wEe(t){return t.reduce((e,r)=>e+r.toString(16).padStart(2,"0"),"")}function _Ee(t){let e=t.match(/../g);return e!=null?new Uint8Array(e.map(r=>parseInt(r,16))):PH}function v7(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,$=new Uint8Array(I);A!==P;){for(var N=g[A],K=0,F=I-1;(N!==0||K>>0,$[F]=N%a>>>0,N=N/a>>>0;if(N!==0)throw new Error("Non-zero carry");E=K,A++}for(var U=I-E;U!==I&&$[U]===0;)U++;for(var W=d.repeat(v);U>>0,I=new Uint8Array(P);g[v];){var $=r[g.charCodeAt(v)];if($===255)return;for(var N=0,K=P-1;($!==0||N>>0,I[K]=$%256>>>0,$=$/256>>>0;if($!==0)throw new Error("Non-zero carry");A=N,v++}if(g[v]!==" "){for(var F=P-A;F!==P&&I[F]===0;)F++;for(var U=new Uint8Array(E+(P-F)),W=E;F!==P;)U[W++]=I[F++];return U}}}function p(g){var v=m(g);if(v)return v;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:m,decode:p}}var SEe=EEe,AEe=SEe,kH=AEe;var _7=class{name;prefix;baseEncode;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")}},x7=class{name;prefix;baseDecode;prefixCodePoint;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 RH(this,e)}},E7=class{decoders;constructor(e){this.decoders=e}or(e){return RH(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function RH(t,e){return new E7({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var S7=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new _7(e,r,n),this.decoder=new x7(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Sb({name:t,prefix:e,encode:r,decode:n}){return new S7(t,e,r,n)}function Dp({name:t,prefix:e,alphabet:r}){let{encode:n,decode:i}=kH(r,t);return Sb({prefix:e,name:t,encode:n,decode:o=>dl(i(o))})}function TEe(t,e,r,n){let i={};for(let c=0;c=8&&(a-=8,s[u++]=255&d>>a)}if(a>=r||255&d<<8-a)throw new SyntaxError("Unexpected end of data");return s}function IEe(t,e,r){let n=e[e.length-1]==="=",i=(1<r;)s-=r,o+=e[i&a>>s];if(s!==0&&(o+=e[i&a<ul,base58flickr:()=>$Ee});h();var ul=Dp({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),$Ee=Dp({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});h();h();h();var NEe=MH,DH=128,jEe=127,UEe=~jEe,qEe=Math.pow(2,31);function MH(t,e,r){e=e||[],r=r||0;for(var n=r;t>=qEe;)e[r++]=t&255|DH,t/=128;for(;t&UEe;)e[r++]=t&255|DH,t>>>=7;return e[r]=t|0,MH.bytes=r-n+1,e}var LEe=I7,KEe=128,BH=127;function I7(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw I7.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&BH)<=KEe);return I7.bytes=o-n,r}var FEe=Math.pow(2,7),zEe=Math.pow(2,14),WEe=Math.pow(2,21),VEe=Math.pow(2,28),HEe=Math.pow(2,35),GEe=Math.pow(2,42),JEe=Math.pow(2,49),YEe=Math.pow(2,56),ZEe=Math.pow(2,63),XEe=function(t){return t{let[l,m]=M_(e.subarray(r));return r+=m,l},i=n(),o=O_;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),d=n(),u=r+d,c=u-s;return{version:i,codec:o,multihashCode:a,digestSize:d,multihashSize:c,size:u}}static parse(e,r){let[n,i]=t6e(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 P7(o).set(n,e),o}};function t6e(t,e){switch(t[0]){case"Q":{let r=e??ul;return[ul.prefix,r.decode(`${ul.prefix}${t}`)]}case ul.prefix:{let r=e??ul;return[ul.prefix,r.decode(t)]}case Ab.prefix:{let r=e??Ab;return[Ab.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)]}}}function r6e(t,e,r){let{prefix:n}=r;if(n!==ul.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}function n6e(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}var O_=112,i6e=18;function jH(t,e,r){let n=Ib(t),i=n+Ib(e),o=new Uint8Array(i+r.byteLength);return Tb(t,o,0),Tb(e,o,n),o.set(r,i),o}var o6e=Symbol.for("@ipld/js-cid/CID");h();var s6e=new TextDecoder;function k7(t,e){let r=0;for(let n=0;;n+=7){if(n>=64)throw new Error("protobuf: varint overflow");if(e>=t.length)throw new Error("protobuf: unexpected end of data");let i=t[e++];if(r+=n<28?(i&127)<t.length)throw new Error("protobuf: unexpected end of data");return[t.subarray(e,n),n]}function UH(t,e){let r;return[r,e]=k7(t,e),[r&7,r>>3,e]}function a6e(t){let e={},r=t.length,n=0;for(;nr)throw new Error("protobuf: (PBLink) unexpected end of data");return e}function qH(t){let e=t.length,r=0,n,i=!1,o;for(;re)throw new Error("protobuf: (PBNode) unexpected end of data");let s={};return o&&(s.Data=o),s.Links=n||[],s}h();var KH=new TextEncoder,LH=2**32,c6e=2**31;function d6e(t,e){let r=e.length;if(typeof t.Tsize=="number"){if(t.Tsize<0)throw new Error("Tsize cannot be negative");if(!Number.isSafeInteger(t.Tsize))throw new Error("Tsize too large for encoding");r=$_(e,r,t.Tsize)-1,e[r]=24}if(typeof t.Name=="string"){let n=KH.encode(t.Name);r-=n.length,e.set(n,r),r=$_(e,r,n.length)-1,e[r]=18}return t.Hash&&(r-=t.Hash.length,e.set(t.Hash,r),r=$_(e,r,t.Hash.length)-1,e[r]=10),e.length-r}function FH(t){let e=l6e(t),r=new Uint8Array(e),n=e;if(t.Data&&(n-=t.Data.length,r.set(t.Data,n),n=$_(r,n,t.Data.length)-1,r[n]=10),t.Links)for(let i=t.Links.length-1;i>=0;i--){let o=d6e(t.Links[i],r.subarray(0,n));n-=o,n=$_(r,n,o)-1,r[n]=18}return r}function u6e(t){let e=0;if(t.Hash){let r=t.Hash.length;e+=1+r+kb(r)}if(typeof t.Name=="string"){let r=KH.encode(t.Name).length;e+=1+r+kb(r)}return typeof t.Tsize=="number"&&(e+=1+kb(t.Tsize)),e}function l6e(t){let e=0;if(t.Data){let r=t.Data.length;e+=1+r+kb(r)}if(t.Links)for(let r of t.Links){let n=u6e(r);e+=1+n+kb(n)}return e}function $_(t,e,r){e-=kb(r);let n=e;for(;r>=c6e;)t[e++]=r&127|128,r/=128;for(;r>=128;)t[e++]=r&127|128,r>>>=7;return t[e]=r,n}function kb(t){return t%2===0&&t++,Math.floor((f6e(t)+6)/7)}function f6e(t){let e=0;return t>=LH&&(t=Math.floor(t/LH),e=32),t>=65536&&(t>>>=16,e+=16),t>=256&&(t>>>=8,e+=8),e+h6e[t]}var h6e=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8];h();var p6e=["Data","Links"],m6e=["Hash","Name","Tsize"],R7=new TextEncoder;function WH(t,e){if(t===e)return 0;let r=t.Name?R7.encode(t.Name):[],n=e.Name?R7.encode(e.Name):[],i=r.length,o=n.length;for(let s=0,a=Math.min(i,o);s!e.includes(r))}function VH(t){if(typeof t.asCID=="object"){let r=Aa.asCID(t);if(!r)throw new TypeError("Invalid DAG-PB form");return{Hash:r}}if(typeof t!="object"||Array.isArray(t))throw new TypeError("Invalid DAG-PB form");let e={};if(t.Hash){let r=Aa.asCID(t.Hash);try{r||(typeof t.Hash=="string"?r=Aa.parse(t.Hash):t.Hash instanceof Uint8Array&&(r=Aa.decode(t.Hash)))}catch(n){throw new TypeError(`Invalid DAG-PB form: ${n.message}`)}r&&(e.Hash=r)}if(!e.Hash)throw new TypeError("Invalid DAG-PB form");return typeof t.Name=="string"&&(e.Name=t.Name),typeof t.Tsize=="number"&&(e.Tsize=t.Tsize),e}function cc(t){if((t instanceof Uint8Array||typeof t=="string")&&(t={Data:t}),typeof t!="object"||Array.isArray(t))throw new TypeError("Invalid DAG-PB form");let e={};if(t.Data!==void 0)if(typeof t.Data=="string")e.Data=R7.encode(t.Data);else if(t.Data instanceof Uint8Array)e.Data=t.Data;else throw new TypeError("Invalid DAG-PB form");if(t.Links!==void 0)if(Array.isArray(t.Links))e.Links=t.Links.map(VH),e.Links.sort(WH);else throw new TypeError("Invalid DAG-PB form");else e.Links=[];return e}function D7(t){if(!t||typeof t!="object"||Array.isArray(t)||t instanceof Uint8Array||t["/"]&&t["/"]===t.bytes)throw new TypeError("Invalid DAG-PB form");if(!zH(t,p6e))throw new TypeError("Invalid DAG-PB form (extraneous properties)");if(t.Data!==void 0&&!(t.Data instanceof Uint8Array))throw new TypeError("Invalid DAG-PB form (Data must be bytes)");if(!Array.isArray(t.Links))throw new TypeError("Invalid DAG-PB form (Links must be a list)");for(let e=0;e0&&WH(r,t.Links[e-1])===-1)throw new TypeError("Invalid DAG-PB form (links must be sorted by Name bytes)")}}function HH(t,e=[]){return cc({Data:t,Links:e})}function GH(t,e,r){return VH({Hash:r,Name:t,Tsize:e})}function JH(t){return t instanceof ArrayBuffer?new Uint8Array(t,0,t.byteLength):t}var y6e="dag-pb",N_=112;function dc(t){D7(t);let e={};return t.Links&&(e.Links=t.Links.map(r=>{let n={};return r.Hash&&(n.Hash=r.Hash.bytes),r.Name!==void 0&&(n.Name=r.Name),r.Tsize!==void 0&&(n.Tsize=r.Tsize),n})),t.Data&&(e.Data=t.Data),FH(e)}function Lf(t){let e=JH(t),r=qH(e),n={};return r.Data&&(n.Data=r.Data),r.Links&&(n.Links=r.Links.map(i=>{let o={};try{o.Hash=Aa.decode(i.Hash)}catch{}if(!o.Hash)throw new Error("Invalid Hash field found in link, expected CID");return i.Name!==void 0&&(o.Name=i.Name),i.Tsize!==void 0&&(o.Tsize=i.Tsize),o})),n}h();var nD=Kt(sc(),1);h();h();h();h();h();var g6e=Math.pow(2,7),v6e=Math.pow(2,14),b6e=Math.pow(2,21),YH=Math.pow(2,28),ZH=Math.pow(2,35),XH=Math.pow(2,42),QH=Math.pow(2,49),ea=128,Bp=127;function j_(t){if(tNumber.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function eG(t,e,r=0){switch(j_(t)){case 8:e[r++]=t&255|ea,t/=128;case 7:e[r++]=t&255|ea,t/=128;case 6:e[r++]=t&255|ea,t/=128;case 5:e[r++]=t&255|ea,t/=128;case 4:e[r++]=t&255|ea,t>>>=7;case 3:e[r++]=t&255|ea,t>>>=7;case 2:e[r++]=t&255|ea,t>>>=7;case 1:{e[r++]=t&255,t>>>=7;break}default:throw new Error("unreachable")}return e}function tG(t,e){let r=t[e],n=0;if(n+=r&Bp,r>>31>0){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(BigInt(r)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}static fromBigInt(e){if(e===0n)return c0;if(e_6e)return this.fromNumber(Number(e));let r=e<0n;r&&(e=-e);let n=e>>32n,i=e-(n<<32n);return r&&(n=~n|0n,i=~i|0n,++i>sG&&(i=0n,++n>sG&&(n=0n))),new t(Number(i),Number(n))}static fromNumber(e){if(e===0)return c0;let r=e<0;r&&(e=-e);let n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new t(n,i)}static from(e){return typeof e=="number"?t.fromNumber(e):typeof e=="bigint"?t.fromBigInt(e):typeof e=="string"?t.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new t(e.low>>>0,e.high>>>0):c0}},c0=new uc(0,0);c0.toBigInt=function(){return 0n};c0.zzEncode=c0.zzDecode=function(){return this};c0.length=function(){return 1};var sG=4294967296n;h();function aG(t){let e=0,r=0;for(let n=0;n191&&a<224?o[s++]=(a&31)<<6|t[e++]&63:a>239&&a<365?(a=((a&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,o[s++]=55296+(a>>10),o[s++]=56320+(a&1023)):o[s++]=(a&15)<<12|(t[e++]&63)<<6|t[e++]&63,s>8191&&((i??(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i!=null?(s>0&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))}function C7(t,e,r){let n=r,i,o;for(let s=0;s>6|192,e[r++]=i&63|128):(i&64512)===55296&&((o=t.charCodeAt(s+1))&64512)===56320?(i=65536+((i&1023)<<10)+(o&1023),++s,e[r++]=i>>18|240,e[r++]=i>>12&63|128,e[r++]=i>>6&63|128,e[r++]=i&63|128):(e[r++]=i>>12|224,e[r++]=i>>6&63|128,e[r++]=i&63|128);return r-n}function eu(t,e){return RangeError(`index out of range: ${t.pos} + ${e??1} > ${t.len}`)}function M5(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}var O7=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,eu(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw eu(this,4);return M5(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw eu(this,4);return M5(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw eu(this,4);let e=nG(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw eu(this,4);let e=oG(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw eu(this,e);return this.pos+=e,r===n?new Uint8Array(0):this.buf.subarray(r,n)}string(){let e=this.bytes();return cG(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw eu(this,e);this.pos+=e}else do if(this.pos>=this.len)throw eu(this);while(this.buf[this.pos++]&128);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new uc(0,0),r=0;if(this.len-this.pos>4){for(;r<4;++r)if(e.lo=(e.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;r=0}else{for(;r<3;++r){if(this.pos>=this.len)throw eu(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<>>0,e}if(this.len-this.pos>4){for(;r<5;++r)if(e.hi=(e.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return e}else for(;r<5;++r){if(this.pos>=this.len)throw eu(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw eu(this,8);let e=M5(this.buf,this.pos+=4),r=M5(this.buf,this.pos+=4);return new uc(e,r)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let e=tG(this.buf,this.pos);return this.pos+=j_(e),e}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function $7(t){return new O7(t instanceof Uint8Array?t:t.subarray())}function U_(t,e,r){let n=$7(t);return e.decode(n,void 0,r)}h();h();h();h();h();var N7={};Ur(N7,{base10:()=>x6e});h();var x6e=Dp({prefix:"9",name:"base10",alphabet:"0123456789"});var j7={};Ur(j7,{base16:()=>E6e,base16upper:()=>S6e});h();var E6e=di({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),S6e=di({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var U7={};Ur(U7,{base2:()=>A6e});h();var A6e=di({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var q7={};Ur(q7,{base256emoji:()=>R6e});h();var uG=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),T6e=uG.reduce((t,e,r)=>(t[r]=e,t),[]),I6e=uG.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function P6e(t){return t.reduce((e,r)=>(e+=T6e[r],e),"")}function k6e(t){let e=[];for(let r of t){let n=I6e[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var R6e=Sb({prefix:"\u{1F680}",name:"base256emoji",encode:P6e,decode:k6e});var L7={};Ur(L7,{base36:()=>D6e,base36upper:()=>B6e});h();var D6e=Dp({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),B6e=Dp({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var K7={};Ur(K7,{base64:()=>M6e,base64pad:()=>C6e,base64url:()=>O6e,base64urlpad:()=>$6e});h();var M6e=di({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),C6e=di({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),O6e=di({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),$6e=di({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var F7={};Ur(F7,{base8:()=>N6e});h();var N6e=di({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var z7={};Ur(z7,{identity:()=>j6e});h();var j6e=Sb({prefix:"\0",name:"identity",encode:t=>w7(t),decode:t=>b7(t)});h();var Dct=new TextEncoder,Bct=new TextDecoder;h();var W7={};Ur(W7,{identity:()=>F6e});h();var lG=0,L6e="identity",fG=dl;function K6e(t){return s0(lG,fG(t))}var F6e={code:lG,name:L6e,encode:fG,digest:K6e};var H7={};Ur(H7,{sha256:()=>z6e,sha512:()=>W6e});h();h();function d0({name:t,code:e,encode:r}){return new V7(t,e,r)}var V7=class{name;code;encode;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?s0(this.code,r):r.then(n=>s0(this.code,n))}else throw Error("Unknown type, must be binary type")}};function pG(t){return async e=>new Uint8Array(await crypto.subtle.digest(t,e))}var z6e=d0({name:"sha2-256",code:18,encode:pG("SHA-256")}),W6e=d0({name:"sha2-512",code:19,encode:pG("SHA-512")});h();h();h();h();h();h();var G7={...z7,...U7,...F7,...N7,...j7,...A7,...L7,...T7,...K7,...q7},rdt={...H7,...W7};function yG(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var mG=yG("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),J7=yG("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=ac(t.length);for(let r=0;r>>1,n,i=e;return function(s){if(s<1||s>r)return ac(s);i+s>e&&(n=ac(e),i=0);let a=n.subarray(i,i+=s);return i&7&&(i=(i|7)+1),a}}var u0=class{fn;len;next;val;constructor(e,r,n){this.fn=e,this.len=r,this.next=void 0,this.val=n}};function Z7(){}var Q7=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},H6e=Y7();function G6e(t){return globalThis.Buffer!=null?ac(t):H6e(t)}var L_=class{len;head;tail;states;constructor(){this.len=0,this.head=new u0(Z7,0,0),this.tail=this.head,this.states=null}_push(e,r,n){return this.tail=this.tail.next=new u0(e,r,n),this.len+=r,this}uint32(e){return this.len+=(this.tail=this.tail.next=new eD((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(O5,10,uc.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let r=uc.fromBigInt(e);return this._push(O5,r.length(),r)}uint64Number(e){return this._push(eG,j_(e),e)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let r=uc.fromBigInt(e).zzEncode();return this._push(O5,r.length(),r)}sint64Number(e){let r=uc.fromNumber(e).zzEncode();return this._push(O5,r.length(),r)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(X7,1,e?1:0)}fixed32(e){return this._push(q_,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let r=uc.fromBigInt(e);return this._push(q_,4,r.lo)._push(q_,4,r.hi)}fixed64Number(e){let r=uc.fromNumber(e);return this._push(q_,4,r.lo)._push(q_,4,r.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(rG,4,e)}double(e){return this._push(iG,8,e)}bytes(e){let r=e.length>>>0;return r===0?this._push(X7,1,0):this.uint32(r)._push(Y6e,r,e)}string(e){let r=aG(e);return r!==0?this.uint32(r)._push(C7,r,e):this._push(X7,1,0)}fork(){return this.states=new Q7(this),this.head=this.tail=new u0(Z7,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new u0(Z7,0,0),this.len=0),this}ldelim(){let e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=e.next,this.tail=r,this.len+=n),this}finish(){let e=this.head.next,r=G6e(this.len),n=0;for(;e!=null;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r}};function X7(t,e,r){e[r]=t&255}function J6e(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}var eD=class extends u0{next;constructor(e,r){super(J6e,e,r),this.next=void 0}};function O5(t,e,r){for(;t.hi!==0;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}function q_(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function Y6e(t,e,r){e.set(t,r)}globalThis.Buffer!=null&&(L_.prototype.bytes=function(t){let e=t.length>>>0;return this.uint32(e),e>0&&this._push(Z6e,e,t),this},L_.prototype.string=function(t){let e=globalThis.Buffer.byteLength(t);return this.uint32(e),e>0&&this._push(X6e,e,t),this});function Z6e(t,e,r){e.set(t,r)}function X6e(t,e,r){t.length<40?C7(t,e,r):e.utf8Write!=null?e.utf8Write(t,r):e.set(C5(t),r)}function tD(){return new L_}function K_(t,e){let r=tD();return e.encode(t,r,{lengthDelimited:!1}),r.finish()}h();h();var Rb;(function(t){t[t.VARINT=0]="VARINT",t[t.BIT64=1]="BIT64",t[t.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",t[t.START_GROUP=3]="START_GROUP",t[t.END_GROUP=4]="END_GROUP",t[t.BIT32=5]="BIT32"})(Rb||(Rb={}));function $5(t,e,r,n){return{name:t,type:e,encode:r,decode:n}}function rD(t){function e(i){if(t[i.toString()]==null)throw new Error("Invalid enum value");return t[i]}let r=function(o,s){let a=e(o);s.int32(a)},n=function(o){let s=o.int32();return e(s)};return $5("enum",Rb.VARINT,r,n)}h();function F_(t,e){return $5("message",Rb.LENGTH_DELIMITED,t,e)}var tu;(function(t){let e;(function(i){i.Raw="Raw",i.Directory="Directory",i.File="File",i.Metadata="Metadata",i.Symlink="Symlink",i.HAMTShard="HAMTShard"})(e=t.DataType||(t.DataType={}));let r;(function(i){i[i.Raw=0]="Raw",i[i.Directory=1]="Directory",i[i.File=2]="File",i[i.Metadata=3]="Metadata",i[i.Symlink=4]="Symlink",i[i.HAMTShard=5]="HAMTShard"})(r||(r={})),function(i){i.codec=()=>rD(r)}(e=t.DataType||(t.DataType={}));let n;t.codec=()=>(n==null&&(n=F_((i,o,s={})=>{if(s.lengthDelimited!==!1&&o.fork(),i.Type!=null&&(o.uint32(8),t.DataType.codec().encode(i.Type,o)),i.Data!=null&&(o.uint32(18),o.bytes(i.Data)),i.filesize!=null&&(o.uint32(24),o.uint64(i.filesize)),i.blocksizes!=null)for(let a of i.blocksizes)o.uint32(32),o.uint64(a);i.hashType!=null&&(o.uint32(40),o.uint64(i.hashType)),i.fanout!=null&&(o.uint32(48),o.uint64(i.fanout)),i.mode!=null&&(o.uint32(56),o.uint32(i.mode)),i.mtime!=null&&(o.uint32(66),N5.codec().encode(i.mtime,o)),s.lengthDelimited!==!1&&o.ldelim()},(i,o)=>{let s={blocksizes:[]},a=o==null?i.len:i.pos+o;for(;i.pos>>3){case 1:s.Type=t.DataType.codec().decode(i);break;case 2:s.Data=i.bytes();break;case 3:s.filesize=i.uint64();break;case 4:s.blocksizes.push(i.uint64());break;case 5:s.hashType=i.uint64();break;case 6:s.fanout=i.uint64();break;case 7:s.mode=i.uint32();break;case 8:s.mtime=N5.codec().decode(i,i.uint32());break;default:i.skipType(d&7);break}}return s})),n),t.encode=i=>K_(i,t.codec()),t.decode=i=>U_(i,t.codec())})(tu||(tu={}));var N5;(function(t){let e;t.codec=()=>(e==null&&(e=F_((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Seconds!=null&&(n.uint32(8),n.int64(r.Seconds)),r.FractionalNanoseconds!=null&&(n.uint32(21),n.fixed32(r.FractionalNanoseconds)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},o=n==null?r.len:r.pos+n;for(;r.pos>>3){case 1:i.Seconds=r.int64();break;case 2:i.FractionalNanoseconds=r.fixed32();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>K_(r,t.codec()),t.decode=r=>U_(r,t.codec())})(N5||(N5={}));var vG;(function(t){let e;t.codec=()=>(e==null&&(e=F_((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.MimeType!=null&&(n.uint32(10),n.string(r.MimeType)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},o=n==null?r.len:r.pos+n;for(;r.pos>>3){case 1:i.MimeType=r.string();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>K_(r,t.codec()),t.decode=r=>U_(r,t.codec())})(vG||(vG={}));var bG={Raw:"raw",Directory:"directory",File:"file",Metadata:"metadata",Symlink:"symlink",HAMTShard:"hamt-sharded-directory"},Q6e=["directory","hamt-sharded-directory"],wG=parseInt("0644",8),_G=parseInt("0755",8),yo=class t{static unmarshal(e){let r=tu.decode(e),n=new t({type:bG[r.Type!=null?r.Type.toString():"File"],data:r.Data,blockSizes:r.blocksizes,mode:r.mode,mtime:r.mtime!=null?{secs:r.mtime.Seconds??0n,nsecs:r.mtime.FractionalNanoseconds}:void 0,fanout:r.fanout});return n._originalMode=r.mode??0,n}type;data;blockSizes;hashType;fanout;mtime;_mode;_originalMode;constructor(e={type:"file"}){let{type:r,data:n,blockSizes:i,hashType:o,fanout:s,mtime:a,mode:d}=e;if(r!=null&&!Object.values(bG).includes(r))throw(0,nD.default)(new Error("Type: "+r+" is not valid"),"ERR_INVALID_TYPE");this.type=r??"file",this.data=n,this.hashType=o,this.fanout=s,this.blockSizes=i??[],this._originalMode=0,this.mode=d,this.mtime=a}set mode(e){e==null?this._mode=this.isDirectory()?_G:wG:this._mode=e&4095}get mode(){return this._mode}isDirectory(){return Q6e.includes(this.type)}addBlockSize(e){this.blockSizes.push(e)}removeBlockSize(e){this.blockSizes.splice(e,1)}fileSize(){if(this.isDirectory())return 0n;let e=0n;return this.blockSizes.forEach(r=>{e+=r}),this.data!=null&&(e+=BigInt(this.data.length)),e}marshal(){let e;switch(this.type){case"raw":e=tu.DataType.Raw;break;case"directory":e=tu.DataType.Directory;break;case"file":e=tu.DataType.File;break;case"metadata":e=tu.DataType.Metadata;break;case"symlink":e=tu.DataType.Symlink;break;case"hamt-sharded-directory":e=tu.DataType.HAMTShard;break;default:throw(0,nD.default)(new Error(`Type: ${e} is not valid`),"ERR_INVALID_TYPE")}let r=this.data;(this.data==null||this.data.length===0)&&(r=void 0);let n;this.mode!=null&&(n=this._originalMode&4294963200|(this.mode??0),n===wG&&!this.isDirectory()&&(n=void 0),n===_G&&this.isDirectory()&&(n=void 0));let i;return this.mtime!=null&&(i={Seconds:this.mtime.secs,FractionalNanoseconds:this.mtime.nsecs}),tu.encode({Type:e,Data:r,filesize:this.isDirectory()?void 0:this.fileSize(),blocksizes:this.blockSizes,hashType:this.hashType,fanout:this.fanout,mode:n,mtime:i})}};var Db={};Ur(Db,{code:()=>Cp,decode:()=>r3e,encode:()=>t3e,name:()=>e3e});h();Uy();var e3e="raw",Cp=85,t3e=t=>Wd(t),r3e=t=>Wd(t);h();var ui=class extends Event{constructor(e,r){super(e),this.detail=r}};h();Uf();var ru=async(t,e,r)=>{r.codec==null&&(r.codec=a0);let n=await bs.digest(t),i=qr.create(r.cidVersion,r.codec.code,n);return await e.put(i,t,r),i};function xG(t){return async function*(r,n){let i=0n;for await(let o of r.content)yield async()=>{let s,a={codec:a0,cidVersion:t.cidVersion,onProgress:t.onProgress};t.rawLeaves?(a.codec=Db,a.cidVersion=1):(s=new yo({type:t.leafType,data:o}),o=dc({Data:s.marshal(),Links:[]}));let d=await ru(o,n,a);return i+=BigInt(o.byteLength),t.onProgress?.(new ui("unixfs:importer:progress:file:write",{bytesWritten:i,cid:d,path:r.path})),{cid:d,unixfs:s,size:BigInt(o.length),block:o}}}}h();var iD=Kt(sc(),1);h();var EG=async(t,e,r)=>{let n=new yo({type:"directory",mtime:t.mtime,mode:t.mode}),i=dc(cc({Data:n.marshal()})),o=await ru(i,e,r),s=t.path;return{cid:o,path:s,unixfs:n,size:BigInt(i.length),originalPath:t.originalPath,block:i}};h();async function*n3e(t,e,r){let n=-1,i;for await(let o of R_(r.bufferImporter(t,e),r.blockWriteConcurrency)){if(n++,n===0){i={...o,single:!0};continue}else n===1&&i!=null&&(yield{...i,block:void 0,single:void 0},i=void 0);yield{...o,block:void 0}}i!=null&&(yield i)}function SG(t){return t.single===!0}var i3e=(t,e,r)=>async function(i){if(i.length===1&&SG(i[0])&&r.reduceSingleLeafToSelf){let c=i[0],l=c.block;return SG(c)&&(t.mtime!==void 0||t.mode!==void 0)&&(c.unixfs=new yo({type:"file",mtime:t.mtime,mode:t.mode,data:c.block}),l={Data:c.unixfs.marshal(),Links:[]},c.block=dc(cc(l)),c.cid=await ru(c.block,e,{...r,cidVersion:r.cidVersion}),c.size=BigInt(c.block.length)),r.onProgress?.(new ui("unixfs:importer:progress:file:layout",{cid:c.cid,path:c.originalPath})),{cid:c.cid,path:t.path,unixfs:c.unixfs,size:c.size,originalPath:c.originalPath}}let o=new yo({type:"file",mtime:t.mtime,mode:t.mode}),s=i.filter(c=>c.cid.code===Cp&&c.size>0||c.unixfs!=null&&c.unixfs.data==null&&c.unixfs.fileSize()>0n?!0:!!c.unixfs?.data?.length).map(c=>c.cid.code===Cp?(o.addBlockSize(c.size),{Name:"",Tsize:Number(c.size),Hash:c.cid}):(c.unixfs==null||c.unixfs.data==null?o.addBlockSize(c.unixfs?.fileSize()??0n):o.addBlockSize(BigInt(c.unixfs.data.length)),{Name:"",Tsize:Number(c.size),Hash:c.cid})),a={Data:o.marshal(),Links:s},d=dc(cc(a)),u=await ru(d,e,r);return r.onProgress?.(new ui("unixfs:importer:progress:file:layout",{cid:u,path:t.originalPath})),{cid:u,path:t.path,unixfs:o,size:BigInt(d.length+a.Links.reduce((c,l)=>c+(l.Tsize??0),0)),originalPath:t.originalPath,block:d}},AG=async(t,e,r)=>r.layout(n3e(t,e,r),i3e(t,e,r));function o3e(t){return Symbol.iterator in t}function s3e(t){return Symbol.asyncIterator in t}function a3e(t){try{if(t instanceof Uint8Array)return async function*(){yield t}();if(o3e(t))return async function*(){yield*t}();if(s3e(t))return t}catch{throw(0,iD.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}throw(0,iD.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}function TG(t){return async function*(r,n){for await(let i of r){let o;if(i.path!=null&&(o=i.path,i.path=i.path.split("/").filter(s=>s!=null&&s!==".").join("/")),c3e(i)){let s={path:i.path,mtime:i.mtime,mode:i.mode,content:async function*(){let a=0n;for await(let d of t.chunker(t.chunkValidator(a3e(i.content)))){let u=BigInt(d.byteLength);a+=u,t.onProgress?.(new ui("unixfs:importer:progress:file:read",{bytesRead:a,chunkSize:u,path:i.path})),yield d}}(),originalPath:o};yield async()=>AG(s,n,t)}else if(i.path!=null){let s={path:i.path,mtime:i.mtime,mode:i.mode,originalPath:o};yield async()=>EG(s,n,t)}else throw new Error("Import candidate must have content or path or both")}}}function c3e(t){return t.content!=null}h();var oD=Kt(sc(),1);var IG=()=>async function*(e){for await(let r of e){if(r.length===void 0)throw(0,oD.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT");if(typeof r=="string"||r instanceof String)yield h_(r.toString());else if(Array.isArray(r))yield Uint8Array.from(r);else if(r instanceof Uint8Array)yield r;else throw(0,oD.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}};h();h();var d3e=174;function sD(t){let e=t?.maxChildrenPerNode??d3e;return async function r(n,i){let o=[];for await(let s of k_(n,e))o.push(await i(s));return o.length>1?r(o,i):o[0]}}h();h();h();h();h();h();Uf();var ll=class{options;root;dir;path;dirty;flat;parent;parentKey;unixfs;mode;mtime;cid;size;nodeSize;constructor(e,r){this.options=r??{},this.root=e.root,this.dir=e.dir,this.path=e.path,this.dirty=e.dirty,this.flat=e.flat,this.parent=e.parent,this.parentKey=e.parentKey,this.unixfs=e.unixfs,this.mode=e.mode,this.mtime=e.mtime}},z_=qr.parse("QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn"),W_=qr.parse("zdj7WbTaiJT1fgatdet9Ei9iDB5hdCxkbVyhyh8YTUnXMiwYi");var l0=class extends ll{_children;constructor(e,r){super(e,r),this._children=new Map}async put(e,r){this.cid=void 0,this.size=void 0,this.nodeSize=void 0,this._children.set(e,r)}async get(e){return Promise.resolve(this._children.get(e))}childCount(){return this._children.size}directChildrenCount(){return this.childCount()}onlyChild(){return this._children.values().next().value}async*eachChildSeries(){for(let[e,r]of this._children.entries())yield{key:e,child:r}}estimateNodeSize(){if(this.nodeSize!==void 0)return this.nodeSize;this.nodeSize=0;for(let[e,r]of this._children.entries())r.size!=null&&r.cid!=null&&(this.nodeSize+=e.length+(this.options.cidVersion===1?W_.bytes.byteLength:z_.bytes.byteLength));return this.nodeSize}async*flush(e){let r=[];for(let[d,u]of this._children.entries()){let c=u;if(u instanceof ll)for await(let l of u.flush(e))c=l,yield l;c.size!=null&&c.cid!=null&&r.push({Name:d,Tsize:Number(c.size),Hash:c.cid})}let n=new yo({type:"directory",mtime:this.mtime,mode:this.mode}),i={Data:n.marshal(),Links:r},o=dc(cc(i)),s=await ru(o,e,this.options),a=o.length+i.Links.reduce((d,u)=>d+(u.Tsize==null?0:u.Tsize),0);this.cid=s,this.size=a,yield{cid:s,unixfs:n,path:this.path,size:BigInt(a)}}};h();h();h();var U5=Kt(RG(),1);function u3e(t){let e=new Array(4);for(let r=0;r<4;r++)e[r]=t&255,t=t>>8;return new Uint8Array(e)}var alt=d0({name:"murmur3-32",code:35,encode:t=>u3e(U5.default.x86.hash32(t))}),q5=d0({name:"murmur3-128",code:34,encode:t=>Eb.fromHex(U5.default.x64.hash128(t))}),clt=d0({name:"murmur3-x64-64",code:34,encode:t=>Eb.fromHex(U5.default.x64.hash128(t)).subarray(0,8)});h();h();var CG=Kt(MG(),1);var fl=class t{_options;_popCount;_parent;_posAtParent;_children;key;constructor(e,r,n=0){this._options=e,this._popCount=0,this._parent=r,this._posAtParent=n,this._children=new CG.default,this.key=null}async put(e,r){let n=await this._findNewBucketAndPos(e);n.bucket._putAt(n,e,r)}async get(e){let r=await this._findChild(e);if(r!=null)return r.value}async del(e){let r=await this._findPlace(e),n=r.bucket._at(r.pos);n!=null&&n.key===e&&r.bucket._delAt(r.pos)}leafCount(){return this._children.compactArray().reduce((r,n)=>n instanceof t?r+n.leafCount():r+1,0)}childrenCount(){return this._children.length}onlyChild(){return this._children.get(0)}*eachLeafSeries(){let e=this._children.compactArray();for(let r of e)r instanceof t?yield*r.eachLeafSeries():yield r}serialize(e,r){let n=[];return r(this._children.reduce((i,o,s)=>(o!=null&&(o instanceof t?i.push(o.serialize(e,r)):i.push(e(o,s))),i),n))}async asyncTransform(e,r){return OG(this,e,r)}toJSON(){return this.serialize(m3e,y3e)}prettyPrint(){return JSON.stringify(this.toJSON(),null," ")}tableSize(){return Math.pow(2,this._options.bits)}async _findChild(e){let r=await this._findPlace(e),n=r.bucket._at(r.pos);if(!(n instanceof t)&&n!=null&&n.key===e)return n}async _findPlace(e){let r=this._options.hash(typeof e=="string"?C5(e):e),n=await r.take(this._options.bits),i=this._children.get(n);return i instanceof t?i._findPlace(r):{bucket:this,pos:n,hash:r,existingChild:i}}async _findNewBucketAndPos(e){let r=await this._findPlace(e);if(r.existingChild!=null&&r.existingChild.key!==e){let n=new t(this._options,r.bucket,r.pos);r.bucket._putObjectAt(r.pos,n);let i=await n._findPlace(r.existingChild.hash);return i.bucket._putAt(i,r.existingChild.key,r.existingChild.value),n._findNewBucketAndPos(r.hash)}return r}_putAt(e,r,n){this._putObjectAt(e.pos,{key:r,value:n,hash:e.hash})}_putObjectAt(e,r){this._children.get(e)==null&&this._popCount++,this._children.set(e,r)}_delAt(e){if(e===-1)throw new Error("Invalid position");this._children.get(e)!=null&&this._popCount--,this._children.unset(e),this._level()}_level(){if(this._parent!=null&&this._popCount<=1)if(this._popCount===1){let e=this._children.find(p3e);if(e!=null&&!(e instanceof t)){let r=e.hash;r.untake(this._options.bits);let n={pos:this._posAtParent,hash:r,bucket:this._parent};this._parent._putAt(n,e.key,e.value)}}else this._parent._delAt(this._posAtParent)}_at(e){return this._children.get(e)}};function p3e(t){return!!t}function m3e(t,e){return t.key}function y3e(t){return t}async function OG(t,e,r){let n=[];for(let i of t._children.compactArray())if(i instanceof fl)await OG(i,e,r);else{let o=await e(i);n.push({bitField:t._children.bitField(),children:o})}return r(n)}h();h();var g3e=[255,254,252,248,240,224,192,128],v3e=[1,3,7,15,31,63,127,255],L5=class{_value;_currentBytePos;_currentBitPos;constructor(e){this._value=e,this._currentBytePos=e.length-1,this._currentBitPos=7}availableBits(){return this._currentBitPos+1+this._currentBytePos*8}totalBits(){return this._value.length*8}take(e){let r=e,n=0;for(;r>0&&this._haveBits();){let i=this._value[this._currentBytePos],o=this._currentBitPos+1,s=Math.min(o,r),a=b3e(i,o-s,s);n=(n<7;)this._currentBitPos-=8,this._currentBytePos+=1}_haveBits(){return this._currentBytePos>=0}};function b3e(t,e,r){let n=w3e(e,r);return(t&n)>>>e}function w3e(t,e){return g3e[t]&v3e[Math.min(e+t-1,7)]}function $G(t){function e(r){return r instanceof K5?r:new K5(r,t)}return e}var K5=class{_value;_hashFn;_depth;_availableBits;_currentBufferIndex;_buffers;constructor(e,r){if(!(e instanceof Uint8Array))throw new Error("can only hash Uint8Arrays");this._value=e,this._hashFn=r,this._depth=-1,this._availableBits=0,this._currentBufferIndex=0,this._buffers=[]}async take(e){let r=e;for(;this._availableBits0;){let i=this._buffers[this._currentBufferIndex],o=Math.min(i.availableBits(),r),s=i.take(o);n=(n<0;){let n=this._buffers[this._currentBufferIndex],i=Math.min(n.totalBits()-n.availableBits(),r);n.untake(i),r-=i,this._availableBits+=i,this._currentBufferIndex>0&&n.totalBits()===n.availableBits()&&(this._depth--,this._currentBufferIndex--)}}async _produceMoreBits(){this._depth++;let e=this._depth>0?D_([this._value,Uint8Array.from([this._depth])]):this._value,r=await this._hashFn(e),n=new L5(r);this._buffers.push(n),this._availableBits+=n.availableBits()}};function F5(t){if(t==null||t.hashFn==null)throw new Error("please define an options.hashFn");let e={bits:t.bits??8,hash:$G(t.hashFn)};return new fl(e)}async function _3e(t){return(await q5.encode(t)).slice(0,8).reverse()}var NG=BigInt(34),aD=class extends ll{_bucket;constructor(e,r){super(e,r),this._bucket=F5({hashFn:_3e,bits:8})}async put(e,r){this.cid=void 0,this.size=void 0,this.nodeSize=void 0,await this._bucket.put(e,r)}async get(e){return this._bucket.get(e)}childCount(){return this._bucket.leafCount()}directChildrenCount(){return this._bucket.childrenCount()}onlyChild(){return this._bucket.onlyChild()}async*eachChildSeries(){for await(let{key:e,value:r}of this._bucket.eachLeafSeries())yield{key:e,child:r}}estimateNodeSize(){return this.nodeSize!==void 0?this.nodeSize:(this.nodeSize=qG(this._bucket,this,this.options),this.nodeSize)}async*flush(e){for await(let r of UG(this._bucket,e,this,this.options))yield{...r,path:this.path}}},jG=aD;async function*UG(t,e,r,n){let i=t._children,o=[],s=0n;for(let p=0;pr&&(i=await E3e(e,n));let o=i.parent;if(o!=null){if(i!==e){if(t!=null&&(t.parent=i),i.parentKey==null)throw new Error("No parent key found");await o.put(i.parentKey,i)}return cD(i,o,r,n)}return i}async function E3e(t,e){let r=new jG({root:t.root,dir:!0,parent:t.parent,parentKey:t.parentKey,path:t.path,dirty:t.dirty,flat:!1,mtime:t.mtime,mode:t.mode},e);for await(let{key:n,child:i}of t.eachChildSeries())await r.put(n,i);return r}h();var LG=(t="")=>(t.trim().match(/([^\\/]|\\\/)+/g)??[]).filter(Boolean);async function S3e(t,e,r){let n=LG(t.path??""),i=n.length-1,o=e,s="";for(let a=0;a1)yield*KG(i,n);else for await(let a of i.eachChildSeries())a!=null&&(yield*KG(a.child,n))}}async function*H_(t,e,r={}){let n;Symbol.asyncIterator in t||Symbol.iterator in t?n=t:n=[t];let i=r.wrapWithDirectory??!1,o=r.shardSplitThresholdBytes??262144,s=r.cidVersion??1,a=r.rawLeaves??!0,d=r.leafType??"file",u=r.fileImportConcurrency??50,c=r.blockWriteConcurrency??10,l=r.reduceSingleLeafToSelf??!0,m=r.chunker??IH(),p=r.chunkValidator??IG(),g=r.dagBuilder??TG({chunker:m,chunkValidator:p,wrapWithDirectory:i,layout:r.layout??sD(),bufferImporter:r.bufferImporter??xG({cidVersion:s,rawLeaves:a,leafType:d,onProgress:r.onProgress}),blockWriteConcurrency:c,reduceSingleLeafToSelf:l,cidVersion:s,onProgress:r.onProgress}),v=r.treeBuilder??FG({wrapWithDirectory:i,shardSplitThresholdBytes:o,cidVersion:s,onProgress:r.onProgress});for await(let E of v(R_(g(n,e),u),e))yield{cid:E.cid,path:E.path,unixfs:E.unixfs,size:E.size}}var dD=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},zG=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(a,d){s=t[o](s),i(a,d,s.done,s.value)})}}function i(o,s,a,d){Promise.resolve(d).then(function(u){o({value:u,done:a})},s)}},WG={[bs.code]:bs},VG={[S_]:o0},Pn=class{static computeCid(e,r=S_,n=bs.code){return dD(this,void 0,void 0,function*(){let i=VG[r];if(!i)throw new se(ne.ComputeCidCodecNotSupported,`codec [${r}] not supported`);let o=WG[n];if(!o)throw new se(ne.ComputeCidMultihashNotSupported,`multihash code [${n}] not supported`);let s=i.encode(e),a=yield o.digest(s);return(yield qr.createV1(i.code,a)).toString()})}static parseCid(e){let r=qr.parse(e).toV1();if(!VG[r.code])throw new se(ne.ParseCidCodecNotSupported,`codec [${r.code}] not supported`);if(!WG[r.multihash.code])throw new se(ne.ParseCidMultihashNotSupported,`multihash code [${r.multihash.code}] not supported`);return r}static computeDagPbCidFromBytes(e){var r,n,i,o;return dD(this,void 0,void 0,function*(){let s=H_([{content:e}],new P_,{cidVersion:1}),a;try{for(var d=!0,u=zG(s),c;c=yield u.next(),r=c.done,!r;d=!0)o=c.value,d=!1,a=o}catch(l){n={error:l}}finally{try{!d&&!r&&(i=u.return)&&(yield i.call(u))}finally{if(n)throw n.error}}return a?a.cid.toString():""})}static computeDagPbCidFromStream(e){var r,n,i,o;return dD(this,void 0,void 0,function*(){let s=H_([{content:e}],new P_,{cidVersion:1}),a;try{for(var d=!0,u=zG(s),c;c=yield u.next(),r=c.done,!r;d=!0)o=c.value,d=!1,a=o}catch(l){n={error:l}}finally{try{!d&&!r&&(i=u.return)&&(yield i.call(u))}finally{if(n)throw n.error}}return a?a.cid.toString():""})}};h();var LA=Kt(L8(),1),mm=Kt(yie(),1),t$=Kt(UA(),1),qA=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})};mm.ECIES_CONFIG.isEphemeralKeyCompressed=!0;var fh=class t{static aes256CtrEncrypt(e,r,n){return qA(this,void 0,void 0,function*(){let i=LA.createCipheriv("aes-256-ctr",e,r),o=new t$.Readable({read(){}});return n.on("data",s=>{let a=i.update(s);o.push(a)}),n.on("end",()=>{let s=i.final();o.push(s),o.push(null)}),n.on("error",s=>{o.emit("error",s)}),o})}static aes256CtrDecrypt(e,r,n){return qA(this,void 0,void 0,function*(){let i=LA.createDecipheriv("aes-256-ctr",e,r),o=new t$.Readable({read(){}});return n.on("data",s=>{let a=i.update(s);o.push(a)}),n.on("end",()=>{let s=i.final();o.push(s),o.push(null)}),n.on("error",s=>{o.emit("error",s)}),o})}static eciesSecp256k1Encrypt(e,r){return qA(this,void 0,void 0,function*(){let n=O.Buffer.from(e),i=O.Buffer.from(r),o=mm.encrypt(n,i),s=0,a=t.isEphemeralKeyCompressed?33:65,d=o.subarray(s,a);s=a,a+=mm.ECIES_CONFIG.symmetricNonceLength;let u=o.subarray(s,a);s=a,a+=16;let c=o.subarray(s,a);return{ciphertext:o.subarray(a),ephemeralPublicKey:d,initializationVector:u,messageAuthenticationCode:c}})}static eciesSecp256k1Decrypt(e){return qA(this,void 0,void 0,function*(){let r=O.Buffer.from(e.privateKey),n=O.Buffer.concat([e.ephemeralPublicKey,e.initializationVector,e.messageAuthenticationCode,e.ciphertext]);return mm.decrypt(r,n)})}static get isEphemeralKeyCompressed(){return mm.ECIES_CONFIG.isEphemeralKeyCompressed}},ig;(function(t){t.Aes256Ctr="A256CTR",t.EciesSecp256k1="ECIES-ES256K"})(ig||(ig={}));h();var oae=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},og=class t{constructor(e){this.jws=e}static create(e,r=[]){return oae(this,void 0,void 0,function*(){let n={payload:Ze.bytesToBase64Url(e),signatures:[]},i=new t(n);for(let o of r)yield i.addSignature(o);return i})}addSignature(e){return oae(this,void 0,void 0,function*(){let r={kid:e.keyId,alg:e.algorithm},n=JSON.stringify(r),i=Ze.stringToBase64Url(n),o=`${i}.${this.jws.payload}`,s=Ze.stringToBytes(o),a=yield e.sign(s),d=Ze.bytesToBase64Url(a);this.jws.signatures.push({protected:i,signature:d})})}getJws(){return this.jws}};h();h();h();var KA=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function cE(){if(KA&&typeof KA.subtle=="object"&&KA.subtle!=null)return KA.subtle;throw new Error("crypto.subtle must be defined")}h();function B$e(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function dE(t,...e){if(!B$e(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}`)}var sae={async encrypt(t,e,r,n){let i=cE(),o=await i.importKey("raw",t,e,!0,["encrypt"]),s=await i.encrypt(r,o,n);return new Uint8Array(s)},async decrypt(t,e,r,n){let i=cE(),o=await i.importKey("raw",t,e,!0,["decrypt"]),s=await i.decrypt(r,o,n);return new Uint8Array(s)}},Cl={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function M$e(t,e,r){if(t===Cl.CBC)return{name:Cl.CBC,iv:e};if(t===Cl.CTR)return{name:Cl.CTR,counter:e,length:64};if(t===Cl.GCM)return r?{name:Cl.GCM,iv:e,additionalData:r}:{name:Cl.GCM,iv:e};throw new Error("unknown aes block mode")}function r$(t){return(e,r,n)=>{dE(e),dE(r);let i={name:t,length:e.length*8},o=M$e(t,r,n);return{encrypt(s){return dE(s),sae.encrypt(e,i,o,s)},decrypt(s){return dE(s),sae.decrypt(e,i,o,s)}}}}var Ibt=r$(Cl.CBC),Pbt=r$(Cl.CTR),kbt=r$(Cl.GCM);var FA=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Qi;(function(t){t.DataFormats="dataFormats",t.ProtocolContext="protocolContext",t.ProtocolPath="protocolPath",t.Schemas="schemas"})(Qi||(Qi={}));var sg=class t{static derivePrivateKey(e,r){var n;return FA(this,void 0,void 0,function*(){let i=Ni.privateJwkToBytes(e.derivedPrivateKey),o=(n=e.derivationPath)!==null&&n!==void 0?n:[],s=yield t.derivePrivateKeyBytes(i,r),a=yield Ni.privateKeyToJwk(s);return{rootKeyId:e.rootKeyId,derivationScheme:e.derivationScheme,derivationPath:[...o,...r],derivedPrivateKey:a}})}static derivePublicKey(e,r){return FA(this,void 0,void 0,function*(){let n=yield t.derivePrivateKey(e,r);return yield Ni.getPublicJwk(n.derivedPrivateKey)})}static derivePrivateKeyBytes(e,r){return FA(this,void 0,void 0,function*(){t.validateKeyDerivationPath(r);let n=e;for(let i of r){let o=Ze.stringToBytes(i);n=yield t.deriveKeyUsingHkdf({hashAlgorithm:"SHA-256",initialKeyMaterial:n,info:o,keyLengthInBytes:32})}return n})}static deriveKeyUsingHkdf(e){return FA(this,void 0,void 0,function*(){let{hashAlgorithm:r,initialKeyMaterial:n,info:i,keyLengthInBytes:o}=e,a=yield cE().importKey("raw",n,{name:"HKDF"},!1,["deriveBits"]),d=yield crypto.subtle.deriveBits({name:"HKDF",hash:r,salt:new Uint8Array(0),info:i},a,o*8);return new Uint8Array(d)})}static validateKeyDerivationPath(e){if(e.includes(""))throw new se(ne.HdKeyDerivationPathInvalid,`Invalid key derivation path: ${e}`)}};h();h();function uE(t,e){return t>e?1:t{t[e]===void 0?delete t[e]:typeof t[e]=="object"&&En(t[e])})}var Ol=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},be=class t{static validateJsonSchema(e){let r=e.descriptor.interface,n=e.descriptor.method,i=r+n;Nf(i,e)}static getSigner(e){return e.authorization===void 0?void 0:nn.getSignerDid(e.authorization.signature.signatures[0])}static getCid(e){return Ol(this,void 0,void 0,function*(){let r=Object.assign({},e);return r.encodedData&&delete r.encodedData,yield Pn.computeCid(r)})}static compareCid(e,r){return Ol(this,void 0,void 0,function*(){let n=yield t.getCid(e),i=yield t.getCid(r);return uE(n,i)})}static createAuthorization(e){return Ol(this,void 0,void 0,function*(){let{descriptor:r,signer:n,delegatedGrant:i,permissionGrantId:o,protocolRole:s}=e,a;i!==void 0&&(a=yield t.getCid(i));let u={signature:yield t.createSignature(r,n,{delegatedGrantId:a,permissionGrantId:o,protocolRole:s})};return i!==void 0&&(u.authorDelegatedGrant=i),u})}static createSignature(e,r,n){return Ol(this,void 0,void 0,function*(){let i=yield Pn.computeCid(e),o=Object.assign({descriptorCid:i},n);En(o);let s=Ze.objectToBytes(o);return(yield og.create(s,[r])).getJws()})}static getNewestMessage(e){return Ol(this,void 0,void 0,function*(){let r;for(let n of e)(r===void 0||(yield t.isNewer(n,r)))&&(r=n);return r})}static getOldestMessage(e){return Ol(this,void 0,void 0,function*(){let r;for(let n of e)(r===void 0||(yield t.isOlder(n,r)))&&(r=n);return r})}static isNewer(e,r){return Ol(this,void 0,void 0,function*(){return(yield t.compareMessageTimestamp(e,r))>0})}static isOlder(e,r){return Ol(this,void 0,void 0,function*(){return(yield t.compareMessageTimestamp(e,r))<0})}static isSignedByAuthorDelegate(e){var r;return((r=e.authorization)===null||r===void 0?void 0:r.authorDelegatedGrant)!==void 0}static isSignedByOwnerDelegate(e){var r;return((r=e.authorization)===null||r===void 0?void 0:r.ownerDelegatedGrant)!==void 0}static compareMessageTimestamp(e,r){return Ol(this,void 0,void 0,function*(){return e.descriptor.messageTimestamp>r.descriptor.messageTimestamp?1:e.descriptor.messageTimestamp=e.lt||e.lte!==void 0&&r>e.lte||e.gt!==void 0&&r<=e.gt||e.gte!==void 0&&rv.rootKeyId===r.rootKeyId&&v.derivationScheme===r.derivationScheme);if(o===void 0)throw new se(ne.RecordsDecryptNoMatchingKeyEncryptedFound,`Unable to find a symmetric key encrypted using key with ID '${r.rootKeyId}' and '${r.derivationScheme}' derivation scheme.`);let s=t.constructKeyDerivationPath(o.derivationScheme,e),a=yield t.derivePrivateKey(r,s),d=Ze.base64UrlToBytes(o.encryptedKey),u=Ni.publicJwkToBytes(o.ephemeralPublicKey),c=Ze.base64UrlToBytes(o.initializationVector),l=Ze.base64UrlToBytes(o.messageAuthenticationCode),m=yield fh.eciesSecp256k1Decrypt({ciphertext:d,ephemeralPublicKey:u,initializationVector:c,messageAuthenticationCode:l,privateKey:a}),p=Ze.base64UrlToBytes(i.initializationVector);return yield fh.aes256CtrDecrypt(m,p,n)})}static constructKeyDerivationPath(e,r){let n=r.descriptor,i=r.contextId,o;return e===Qi.DataFormats?o=t.constructKeyDerivationPathUsingDataFormatsScheme(n.schema,n.dataFormat):e===Qi.ProtocolPath?o=t.constructKeyDerivationPathUsingProtocolPathScheme(n):e===Qi.ProtocolContext?o=t.constructKeyDerivationPathUsingProtocolContextScheme(i):o=t.constructKeyDerivationPathUsingSchemasScheme(n.schema),o}static constructKeyDerivationPathUsingDataFormatsScheme(e,r){return e!==void 0?[Qi.DataFormats,e,r]:[Qi.DataFormats,r]}static constructKeyDerivationPathUsingProtocolPathScheme(e){if(e.protocol===void 0)throw new se(ne.RecordsProtocolPathDerivationSchemeMissingProtocol,"Unable to construct key derivation path using `protocols` scheme because `protocol` is missing.");let r=e.protocolPath.split("/");return[Qi.ProtocolPath,e.protocol,...r]}static constructKeyDerivationPathUsingProtocolContextScheme(e){if(e===void 0)throw new se(ne.RecordsProtocolContextDerivationSchemeMissingContextId,"Unable to construct key derivation path using `protocolContext` scheme because `contextId` is missing.");let r=e.split("/")[0];return[Qi.ProtocolContext,r]}static constructKeyDerivationPathUsingSchemasScheme(e){if(e===void 0)throw new se(ne.RecordsSchemasDerivationSchemeMissingSchema,"Unable to construct key derivation path using `schemas` scheme because `schema` is missing.");return[Qi.Schemas,e]}static derivePrivateKey(e,r){var n;return n$(this,void 0,void 0,function*(){if(e.derivedPrivateKey.crv!=="secp256k1")throw new se(ne.RecordsDerivePrivateKeyUnSupportedCurve,`Curve ${e.derivedPrivateKey.crv} is not supported.`);let i=(n=e.derivationPath)!==null&&n!==void 0?n:[];t.validateAncestorKeyAndDescentKeyDerivationPathsMatch(i,r);let o=r.slice(i.length),s=Ni.privateJwkToBytes(e.derivedPrivateKey);return yield sg.derivePrivateKeyBytes(s,o)})}static validateAncestorKeyAndDescentKeyDerivationPathsMatch(e,r){for(let n=0;n=n.dateExpires)throw new se(ne.GrantAuthorizationGrantExpired,"The message has timestamp after the expiry of the associated permission grant");let o={parentId:n.id,protocolPath:"grant/revocation",isLatestBaseState:!0},{messages:s}=yield i.query(e,[o]),a=yield be.getOldestMessage(s);if(a!==void 0&&a.descriptor.messageTimestamp<=r)throw new se(ne.GrantAuthorizationGrantRevoked,`Permission grant with CID ${n.id} has been revoked`)})}static verifyGrantScopeInterfaceAndMethod(e,r,n){return i$(this,void 0,void 0,function*(){if(e!==n.scope.interface)throw new se(ne.GrantAuthorizationInterfaceMismatch,`DWN Interface of incoming message is outside the scope of permission grant with ID ${n.id}`);if(r!==n.scope.method)throw new se(ne.GrantAuthorizationMethodMismatch,`DWN Method of incoming message is outside the scope of permission grant with ID ${n.id}`)})}};h();var fE;(function(t){t.Required="Required",t.Prohibited="Prohibited"})(fE||(fE={}));var WA=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Ho=class t{static authorizeWrite(e){return WA(this,void 0,void 0,function*(){let{recordsWriteMessage:r,expectedGrantor:n,expectedGrantee:i,permissionGrant:o,messageStore:s}=e;yield ph.performBaseValidation({incomingMessage:r,expectedGrantor:n,expectedGrantee:i,permissionGrant:o,messageStore:s}),t.verifyScope(r,o.scope),t.verifyConditions(r,o.conditions)})}static authorizeRead(e){return WA(this,void 0,void 0,function*(){let{recordsReadMessage:r,recordsWriteMessageToBeRead:n,expectedGrantor:i,expectedGrantee:o,permissionGrant:s,messageStore:a}=e;yield ph.performBaseValidation({incomingMessage:r,expectedGrantor:i,expectedGrantee:o,permissionGrant:s,messageStore:a}),t.verifyScope(n,s.scope)})}static authorizeQueryOrSubscribe(e){return WA(this,void 0,void 0,function*(){let{incomingMessage:r,expectedGrantor:n,expectedGrantee:i,permissionGrant:o,messageStore:s}=e;yield ph.performBaseValidation({incomingMessage:r,expectedGrantor:n,expectedGrantee:i,permissionGrant:o,messageStore:s});let d=o.scope.protocol,u=r.descriptor.filter.protocol;if(d!==void 0&&u!==d)throw new se(ne.RecordsGrantAuthorizationQueryOrSubscribeProtocolScopeMismatch,`Grant protocol scope ${d} does not match protocol in message ${u}`)})}static authorizeDelete(e){return WA(this,void 0,void 0,function*(){let{recordsDeleteMessage:r,recordsWriteToDelete:n,expectedGrantor:i,expectedGrantee:o,permissionGrant:s,messageStore:a}=e;yield ph.performBaseValidation({incomingMessage:r,expectedGrantor:i,expectedGrantee:o,permissionGrant:s,messageStore:a});let u=s.scope.protocol,c=n.descriptor.protocol;if(u!==void 0&&c!==u)throw new se(ne.RecordsGrantAuthorizationDeleteProtocolScopeMismatch,`Grant protocol scope ${u} does not match protocol in record to delete ${c}`)})}static verifyScope(e,r){t.isUnrestrictedScope(r)||(e.descriptor.protocol!==void 0?t.verifyProtocolRecordScope(e,r):t.verifyFlatRecordScope(e,r))}static verifyProtocolRecordScope(e,r){if(r.protocol===void 0)throw new se(ne.RecordsGrantAuthorizationScopeMissingProtocol,"Grant for protocol record must specify protocol in its scope");if(r.protocol!==e.descriptor.protocol)throw new se(ne.RecordsGrantAuthorizationScopeProtocolMismatch,"Grant scope specifies different protocol than what appears in the record");if(r.contextId!==void 0&&(e.contextId===void 0||!e.contextId.startsWith(r.contextId)))throw new se(ne.RecordsGrantAuthorizationScopeContextIdMismatch,"Grant scope specifies different contextId than what appears in the record");if(r.protocolPath!==void 0&&r.protocolPath!==e.descriptor.protocolPath)throw new se(ne.RecordsGrantAuthorizationScopeProtocolPathMismatch,"Grant scope specifies different protocolPath than what appears in the record")}static verifyFlatRecordScope(e,r){if(r.schema!==void 0&&r.schema!==e.descriptor.schema)throw new se(ne.RecordsGrantAuthorizationScopeSchema,`Record does not have schema in permission grant scope with schema '${r.schema}'`)}static verifyConditions(e,r){if(r?.publication===fE.Required&&!e.descriptor.published)throw new se(ne.RecordsGrantAuthorizationConditionPublicationRequired,"Permission grant requires message to be published");if(r?.publication===fE.Prohibited&&e.descriptor.published)throw new se(ne.RecordsGrantAuthorizationConditionPublicationProhibited,"Permission grant prohibits message from being published")}static isUnrestrictedScope(e){return e.protocol===void 0&&e.schema===void 0}};h();h();var z=Kt(cae(),1),h$={};function zl(t,e){Object.defineProperty(t.prototype,Symbol.toStringTag,{value:e,writable:!1,enumerable:!1,configurable:!0});for(let r of Object.getOwnPropertyNames(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.configurable&&n.enumerable&&(n.enumerable=!1,Object.defineProperty(t,r,n))}for(let r of Object.getOwnPropertyNames(t.prototype)){let n=Object.getOwnPropertyDescriptor(t.prototype,r);n.configurable&&n.enumerable&&(n.enumerable=!1,Object.defineProperty(t.prototype,r,n))}An(e,t),An(`${e}.prototype`,t.prototype)}function An(t,e){let r=`%${t}%`;if(h$[r]!==void 0)throw new Error(`intrinsic ${t} already exists`);h$[r]=e}function xe(t){return h$[t]}var dae,uae,ut="slot-epochNanoSeconds",Nl="slot-timezone-identifier",Ie="slot-year",Re="slot-month",$e="slot-day",_t="slot-hour",xt="slot-minute",Et="slot-second",St="slot-millisecond",At="slot-microsecond",Tt="slot-nanosecond",oe="slot-calendar",Wae="slot-date-brand",Vae="slot-year-month-brand",Hae="slot-month-day-brand",To="slot-cached-instant",Lr="slot-time-zone",Go="slot-years",Li="slot-months",js="slot-weeks",Jo="slot-days",Yo="slot-hours",Zo="slot-minutes",Xo="slot-seconds",Qo="slot-milliseconds",es="slot-microseconds",ts="slot-nanoseconds",Sn="slot-calendar-identifier",Gae=new WeakMap,p$=Symbol.for("@@Temporal__GetSlots");(dae=globalThis)[p$]||(dae[p$]=function(e){return Gae.get(e)});var F$=globalThis[p$],m$=Symbol.for("@@Temporal__CreateSlots");(uae=globalThis)[m$]||(uae[m$]=function(e){Gae.set(e,Object.create(null))});var Wl=globalThis[m$];function Pi(t,...e){if(!t||typeof t!="object")return!1;let r=F$(t);return!!r&&e.every(n=>n in r)}function R(t,e){let r=F$(t)?.[e];if(r===void 0)throw new TypeError(`Missing internal slot ${e}`);return r}function Bt(t,e,r){let n=F$(t);if(n===void 0)throw new TypeError("Missing slots for the given container");if(n[e])throw new TypeError(`${e} already has set`);n[e]=r}var lae=/\.[-A-Za-z_]|\.\.[-A-Za-z._]{1,12}|\.[-A-Za-z_][-A-Za-z._]{0,12}|[A-Za-z_][-A-Za-z._]{0,13}/,RE=new RegExp("(?:"+[`(?:${lae.source})(?:\\/(?:${lae.source}))*`,"Etc/GMT(?:0|[-+]\\d{1,2})","GMT[-+]?0","EST5EDT","CST6CDT","MST7MDT","PST8PDT",/(?:[+\u2212-][0-2][0-9](?::?[0-5][0-9](?::?[0-5][0-9](?:[.,]\d{1,9})?)?)?)/.source].join("|")+")"),Jae=/(?:[+\u2212-]\d{6}|\d{4})/,ZA=/(?:0[1-9]|1[0-2])/,y$=/(?:0[1-9]|[12]\d|3[01])/,j$e=new RegExp(`(${Jae.source})(?:-(${ZA.source})-(${y$.source})|(${ZA.source})(${y$.source}))`),Yae=/(\d{2})(?::(\d{2})(?::(\d{2})(?:[.,](\d{1,9}))?)?|(\d{2})(?:(\d{2})(?:[.,](\d{1,9}))?)?)?/,Zae=/([+\u2212-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\d{1,9}))?)?)?/,Xae=new RegExp(`([zZ])|${Zae.source}?`),Am=/\[(!)?([a-z_][a-z0-9_-]*)=([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\]/g,U$e=new RegExp([`^${j$e.source}`,`(?:(?:T|\\s+)${Yae.source}(?:${Xae.source})?)?`,`(?:\\[!?(${RE.source})\\])?`,`((?:${Am.source})*)$`].join(""),"i"),q$e=new RegExp([`^T?${Yae.source}`,`(?:${Xae.source})?`,`(?:\\[!?${RE.source}\\])?`,`((?:${Am.source})*)$`].join(""),"i"),L$e=new RegExp(`^(${Jae.source})-?(${ZA.source})(?:\\[!?${RE.source}\\])?((?:${Am.source})*)$`),K$e=new RegExp(`^(?:--)?(${ZA.source})-?(${y$.source})(?:\\[!?${RE.source}\\])?((?:${Am.source})*)$`),a$=/(\d+)(?:[.,](\d{1,9}))?/,F$e=new RegExp(`(?:${a$.source}H)?(?:${a$.source}M)?(?:${a$.source}S)?`),z$e=new RegExp(`^([+\u2212-])?P${/(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/.source}(?:T(?!$)${F$e.source})?$`,"i"),W$e=Array.prototype.includes,Qae=Array.prototype.push,ece=globalThis.Intl.DateTimeFormat,V$e=Math.min,H$e=Math.max,dn=Math.abs,aa=Math.floor,Yw=Math.sign,dg=Math.trunc,hT=Number.isNaN,rs=Number.isFinite,G$e=Number,DE=String,J$e=Number.MAX_SAFE_INTEGER,Po=Object.create,Y$e=Object.getOwnPropertyDescriptor,pT=Reflect.apply,Z$e=Reflect.ownKeys,Mn=z.default.BigInt(0),o1=z.default.BigInt(1),jl=z.default.BigInt(60),tce=z.default.BigInt(24),Ar=z.default.BigInt(1e3),xc=z.default.BigInt(1e6),Ul=z.default.BigInt(1e9),X$e=z.default.BigInt(-1),rce=z.default.multiply(z.default.BigInt(3600),Ul),nce=z.default.multiply(jl,Ul),Ll=z.default.multiply(rce,tce),gE=z.default.multiply(z.default.BigInt(-86400),z.default.BigInt(1e17)),Zw=z.default.multiply(z.default.BigInt(86400),z.default.BigInt(1e17)),XA=-271821,QA=275760,Fw=z.default.multiply(z.default.BigInt(-388152),z.default.BigInt(1e13)),Q$e=z.default.multiply(Ll,z.default.BigInt(3660)),ice=z.default.multiply(Ll,z.default.BigInt(366)),oce=z.default.multiply(Ll,z.default.BigInt(14)),eNe=["iso8601","hebrew","islamic","islamic-umalqura","islamic-tbla","islamic-civil","islamic-rgsa","islamicc","persian","ethiopic","ethioaa","coptic","chinese","dangi","roc","indian","buddhist","japanese","gregory"];function _c(t){return z.default.equal(t,Mn)}function Dr(t,e){let r=t[e];if(r!==void 0)return r}function Je(t,e,r){let n=arguments.length>2?r:[];return pT(t,e,n)}function un(t){return typeof t=="object"&&t!==null||typeof t=="function"}function Xw(t){if(typeof t=="bigint")throw new TypeError("Cannot convert BigInt to number");return G$e(t)}function Xn(t){let e=Xw(t);if(hT(e)||e===0)return 0;if(!rs(e))return e;let r=aa(dn(e));return r===0?0:Yw(e)*r}function $a(t){if(typeof t!="number"||hT(t)||!rs(t))return!1;let e=dn(t);return aa(e)===e}function is(t){if(typeof t=="symbol")throw new TypeError("Cannot convert a Symbol value to a String");return DE(t)}function vr(t){let e=Xw(t);if(e===0)return 0;if(hT(e)||!rs(e))throw new RangeError("invalid number value");let r=dg(e);return r===0?0:r}function fae(t,e){let r=vr(t);if(r<=0)throw e!==void 0?new RangeError(`property '${e}' cannot be a a number less than one`):new RangeError("Cannot convert a number less than one to a positive integer");return r}function Ii(t){let e=Xw(t);if(!rs(e))throw new RangeError("infinity is out of range");if(!$a(e))throw new RangeError(`unsupported fractional value ${t}`);return e===0?0:e}function Vn(t,e){return{quotient:z.default.divide(t,e),remainder:z.default.remainder(t,e)}}function eT(t){return z.default.lessThan(t,Mn)}function hae(t){return _c(t)?0:eT(t)?-1:1}function Su(t){return z.default.lessThan(t,Mn)?z.default.multiply(t,X$e):t}var pae=new Map([["year",vr],["month",fae],["monthCode",is],["day",fae],["hour",vr],["minute",vr],["second",vr],["millisecond",vr],["microsecond",vr],["nanosecond",vr],["years",Ii],["months",Ii],["weeks",Ii],["days",Ii],["hours",Ii],["minutes",Ii],["seconds",Ii],["milliseconds",Ii],["microseconds",Ii],["nanoseconds",Ii],["era",is],["eraYear",Xn],["offset",is]]),tNe=new Map([["hour",0],["minute",0],["second",0],["millisecond",0],["microsecond",0],["nanosecond",0]]),BE=[["years","year","date"],["months","month","date"],["weeks","week","date"],["days","day","date"],["hours","hour","time"],["minutes","minute","time"],["seconds","second","time"],["milliseconds","millisecond","time"],["microseconds","microsecond","time"],["nanoseconds","nanosecond","time"]],tT=new Map(BE.map(t=>[t[0],t[1]])),rNe=new Map(BE.map(([t,e])=>[e,t])),mae=BE.map(([,t])=>t),yae=Array.from(tT.keys()).sort(),gae=new Map;function sce(t){let e=gae.get(t);return e===void 0&&(e=new ece("en-us",{timeZone:DE(t),hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),gae.set(t,e)),e}function vae(t){if(t==null)throw new TypeError(`Expected object not ${t}`);return Object(t)}function zw(t,e,r,n){if(e==null)return;let i=Z$e(e);for(let o of i)if(!r.some(s=>Object.is(s,o))&&Object.prototype.propertyIsEnumerable.call(e,o)){let s=e[o];if(n&&n.some(a=>Object.is(a,s)))continue;t[o]=s}}function mi(t){return Pi(t,ut)&&!Pi(t,Lr,oe)}function wc(t){return Pi(t,Nl)}function Rn(t){return Pi(t,Sn)}function Dn(t){return Pi(t,Go,Li,Jo,Yo,Zo,Xo,Qo,es,ts)}function Gt(t){return Pi(t,Wae)}function Bn(t){return Pi(t,_t,xt,Et,St,At,Tt)&&!Pi(t,Ie,Re,$e)}function wt(t){return Pi(t,Ie,Re,$e,_t,xt,Et,St,At,Tt)}function Sr(t){return Pi(t,Vae)}function Ti(t){return Pi(t,Hae)}function Ke(t){return Pi(t,ut,Lr,oe)}function s1(t){if(Pi(t,oe)||Pi(t,Lr))throw new TypeError("with() does not support a calendar or timeZone property");if(Bn(t))throw new TypeError("with() does not accept Temporal.PlainTime, use withPlainTime() instead");if(t.calendar!==void 0)throw new TypeError("with() does not support a calendar property");if(t.timeZone!==void 0)throw new TypeError("with() does not support a timeZone property")}function nNe(t){let{ianaName:e,offset:r,z:n}=function(o){if(new RegExp(`^${RE.source}$`,"i").test(o))return{ianaName:o};try{let s=Vl(o);if(s.z||s.offset||s.ianaName)return s}catch{}throw new RangeError(`Invalid time zone: ${o}`)}(t);return e?eN(e):n?"UTC":TT(bm(r))}function z$(t,e){return e==="never"?"":W$(no(t),e)}function W$(t,e){return e==="never"||e==="auto"&&t==="iso8601"?"":`[${e==="critical"?"!":""}u-ca=${t}]`}function Vl(t){let e=U$e.exec(t);if(!e)throw new RangeError(`invalid ISO 8601 string: ${t}`);let r=e[1];if(r[0]==="\u2212"&&(r=`-${r.slice(1)}`),r==="-000000")throw new RangeError(`invalid ISO 8601 string: ${t}`);let n=Xn(r),i=Xn(e[2]||e[4]),o=Xn(e[3]||e[5]),s=Xn(e[6]),a=e[6]!==void 0,d=Xn(e[7]||e[10]),u=Xn(e[8]||e[11]);u===60&&(u=59);let c=(e[9]||e[12])+"000000000",l=Xn(c.slice(0,3)),m=Xn(c.slice(3,6)),p=Xn(c.slice(6,9)),g,v=!1;if(e[13])g=void 0,v=!0;else if(e[14]&&e[15]){let I=e[14]==="-"||e[14]==="\u2212"?"-":"+",$=e[15]||"00",N=e[16]||"00",K=e[17]||"00",F=e[18]||"0";if(g=`${I}${$}:${N}`,+F){for(;F.endsWith("0");)F=F.slice(0,-1);g+=`:${K}.${F}`}else+K&&(g+=`:${K}`);g==="-00:00"&&(g="+00:00")}let E=e[19],A=e[20],P;for(let[,I,$,N]of A.matchAll(Am))if($==="u-ca")P===void 0&&(P=N);else if(I==="!")throw new RangeError(`Unrecognized annotation: !${$}=${N}`);return nN(n,i,o,s,d,u,l,m,p),{year:n,month:i,day:o,hasTime:a,hour:s,minute:d,second:u,millisecond:l,microsecond:m,nanosecond:p,ianaName:E,offset:g,z:v,calendar:P}}function V$(t){let e=L$e.exec(t),r,n,i,o;if(e){let s=e[1];if(s[0]==="\u2212"&&(s=`-${s.slice(1)}`),s==="-000000")throw new RangeError(`invalid ISO 8601 string: ${t}`);r=Xn(s),n=Xn(e[2]);let a=e[3];for(let[,d,u,c]of a.matchAll(Am))if(u==="u-ca")i===void 0&&(i=c);else if(d==="!")throw new RangeError(`Unrecognized annotation: !${u}=${c}`);if(i!==void 0&&i!=="iso8601")throw new RangeError("YYYY-MM format is only valid with iso8601 calendar")}else{let s;if({year:r,month:n,calendar:i,day:o,z:s}=Vl(t),s)throw new RangeError("Z designator not supported for PlainYearMonth")}return{year:r,month:n,calendar:i,referenceISODay:o}}function H$(t){let e=K$e.exec(t),r,n,i,o;if(e){r=Xn(e[1]),n=Xn(e[2]);let s=e[3];for(let[,a,d,u]of s.matchAll(Am))if(d==="u-ca")i===void 0&&(i=u);else if(a==="!")throw new RangeError(`Unrecognized annotation: !${d}=${u}`);if(i!==void 0&&i!=="iso8601")throw new RangeError("MM-DD format is only valid with iso8601 calendar")}else{let s;if({month:r,day:n,calendar:i,year:o,z:s}=Vl(t),s)throw new RangeError("Z designator not supported for PlainMonthDay")}return{month:r,day:n,calendar:i,referenceISOYear:o}}function iNe(t){let{year:e,month:r,day:n,hour:i,minute:o,second:s,millisecond:a,microsecond:d,nanosecond:u,offset:c,z:l}=function(v){let E=Vl(v);if(!E.z&&!E.offset)throw new RangeError("Temporal.Instant requires a time zone offset");return E}(t);if(!l&&!c)throw new RangeError("Temporal.Instant requires a time zone offset");let m=l?0:bm(c);({year:e,month:r,day:n,hour:i,minute:o,second:s,millisecond:a,microsecond:d,nanosecond:u}=tN(e,r,n,i,o,s,a,d,u-m));let p=wm(e,r,n,i,o,s,a,d,u);if(p===null)throw new RangeError("DateTime outside of supported range");return p}function rT(t,e,r,n){let i=t,o=e,s=r;switch(n){case"reject":Kl(i,o,s);break;case"constrain":({year:i,month:o,day:s}=Ece(i,o,s))}return{year:i,month:o,day:s}}function mT(t,e,r,n,i,o,s){let a=t,d=e,u=r,c=n,l=i,m=o;switch(s){case"reject":PT(a,d,u,c,l,m);break;case"constrain":({hour:a,minute:d,second:u,millisecond:c,microsecond:l,nanosecond:m}=function(g,v,E,A,P,I){let $=sa(g,0,23),N=sa(v,0,59),K=sa(E,0,59),F=sa(A,0,999),U=sa(P,0,999),W=sa(I,0,999);return{hour:$,minute:N,second:K,millisecond:F,microsecond:U,nanosecond:W}}(a,d,u,c,l,m))}return{hour:a,minute:d,second:u,millisecond:c,microsecond:l,nanosecond:m}}function wg(t){if(!un(t))return function(g){let v=z$e.exec(g);if(!v)throw new RangeError(`invalid duration: ${g}`);if(v.slice(2).every(_=>_===void 0))throw new RangeError(`invalid duration: ${g}`);let E=v[1]==="-"||v[1]==="\u2212"?-1:1,A=v[2]===void 0?0:vr(v[2])*E,P=v[3]===void 0?0:vr(v[3])*E,I=v[4]===void 0?0:vr(v[4])*E,$=v[5]===void 0?0:vr(v[5])*E,N=v[6]===void 0?0:vr(v[6])*E,K=v[7],F=v[8],U=v[9],W=v[10],L=v[11],T=0,S=0,k=0;if(K!==void 0){if(F??U??W??L)throw new RangeError("only the smallest unit can be fractional");k=3600*Xn((K+"000000000").slice(0,9))*E}else if(T=F===void 0?0:vr(F)*E,U!==void 0){if(W??L)throw new RangeError("only the smallest unit can be fractional");k=60*Xn((U+"000000000").slice(0,9))*E}else S=W===void 0?0:vr(W)*E,L!==void 0&&(k=Xn((L+"000000000").slice(0,9))*E);let f=k%1e3,y=dg(k/1e3)%1e3,w=dg(k/1e6)%1e3;return S+=dg(k/1e9)%60,T+=dg(k/6e10),cT(A,P,I,$,N,T,S,w,y,f),{years:A,months:P,weeks:I,days:$,hours:N,minutes:T,seconds:S,milliseconds:w,microseconds:y,nanoseconds:f}}(is(t));if(Dn(t))return{years:R(t,Go),months:R(t,Li),weeks:R(t,js),days:R(t,Jo),hours:R(t,Yo),minutes:R(t,Zo),seconds:R(t,Xo),milliseconds:R(t,Qo),microseconds:R(t,es),nanoseconds:R(t,ts)};let e={years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0},r=function(g){if(!un(g))throw new TypeError("invalid duration-like");let v={years:void 0,months:void 0,weeks:void 0,days:void 0,hours:void 0,minutes:void 0,seconds:void 0,milliseconds:void 0,microseconds:void 0,nanoseconds:void 0},E=!1;for(let A of yae){let P=g[A];P!==void 0&&(E=!0,v[A]=Ii(P))}if(!E)throw new TypeError("invalid duration-like");return v}(t);for(let p of yae){let g=r[p];g!==void 0&&(e[p]=g)}let{years:n,months:i,weeks:o,days:s,hours:a,minutes:d,seconds:u,milliseconds:c,microseconds:l,nanoseconds:m}=e;return cT(n,i,o,s,a,d,u,c,l,m),{years:n,months:i,weeks:o,days:s,hours:a,minutes:d,seconds:u,milliseconds:c,microseconds:l,nanoseconds:m}}function Hn(t){return t===void 0?"constrain":xm(t,"overflow",["constrain","reject"],"constrain")}function Qw(t){return t===void 0?"compatible":xm(t,"disambiguation",["compatible","earlier","later","reject"],"compatible")}function Tu(t,e){return xm(t,"roundingMode",["ceil","floor","expand","trunc","halfCeil","halfFloor","halfExpand","halfTrunc","halfEven"],e)}function nT(t,e){return t===void 0?e:xm(t,"offset",["prefer","use","ignore","reject"],e)}function ME(t){return xm(t,"calendarName",["auto","always","never","critical"],"auto")}function a1(t){let e=t.roundingIncrement;if(e===void 0)return 1;if(e=Xw(e),!rs(e))throw new RangeError("roundingIncrement must be finite");let r=dg(e);if(r<1||r>1e9)throw new RangeError(`roundingIncrement must be at least 1 and at most 1e9, not ${e}`);return r}function c1(t,e,r){let n=r?e:e-1;if(t>n)throw new RangeError(`roundingIncrement must be at least 1 and less than ${n}, not ${t}`);if(e%t!=0)throw new RangeError(`Rounding increment must divide evenly into ${e}`)}function CE(t){let e=t.fractionalSecondDigits;if(e===void 0)return"auto";if(typeof e!="number"){if(is(e)!=="auto")throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${e}`);return"auto"}let r=aa(e);if(!rs(r)||r<0||r>9)throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${e}`);return r}function OE(t,e){switch(t){case"minute":return{precision:"minute",unit:"minute",increment:1};case"second":return{precision:0,unit:"second",increment:1};case"millisecond":return{precision:3,unit:"millisecond",increment:1};case"microsecond":return{precision:6,unit:"microsecond",increment:1};case"nanosecond":return{precision:9,unit:"nanosecond",increment:1}}switch(e){case"auto":return{precision:e,unit:"nanosecond",increment:1};case 0:return{precision:e,unit:"second",increment:1};case 1:case 2:case 3:return{precision:e,unit:"millisecond",increment:10**(3-e)};case 4:case 5:case 6:return{precision:e,unit:"microsecond",increment:10**(6-e)};case 7:case 8:case 9:return{precision:e,unit:"nanosecond",increment:10**(9-e)};default:throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${e}`)}}var pg=Symbol("~required~");function ca(t,e,r,n,i=[]){let o=[];for(let[,u,c]of BE)r!=="datetime"&&r!==c||o.push(u);o.push(...i);let s=n;s===pg?s=void 0:s!==void 0&&o.push(s);let a=[...o];for(let u of o){let c=rNe.get(u);c!==void 0&&a.push(c)}let d=xm(t,e,a,s);if(d===void 0&&n===pg)throw new RangeError(`${e} is required`);return tT.has(d)?tT.get(d):d}function HA(t){let e=t.relativeTo;if(e===void 0)return e;let r,n,i,o,s,a,d,u,c,l,m,p,g="option",v=!1;if(un(e)){if(Ke(e)||Gt(e))return e;if(wt(e))return t1(e);l=UE(e);let E=Qn(l,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]);E.push("timeZone","offset");let A=Ot(e,E,[]),P=Po(null);P.overflow="constrain",{year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:d,microsecond:u,nanosecond:c}=$E(l,A,P),p=A.offset,p===void 0&&(g="wall"),m=A.timeZone,m!==void 0&&(m=Io(m))}else{let E,A;if({year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:d,microsecond:u,nanosecond:c,calendar:l,ianaName:E,offset:p,z:A}=Vl(is(e)),E)m=Io(E),A?g="exact":p||(g="wall"),v=!0;else if(A)throw new RangeError("Z designator not supported for PlainDate relativeTo; either remove the Z or add a bracketed time zone");if(l||(l="iso8601"),!xh(l))throw new RangeError(`invalid calendar identifier ${l}`);l=Fl(l)}return m===void 0?Sc(r,n,i,l):eo(oT(r,n,i,o,s,a,d,u,c,g,g==="option"?bm(p):0,m,"compatible","reject",v),m,l)}function g$(t,e,r,n,i,o,s,a,d,u){for(let[c,l]of[["years",t],["months",e],["weeks",r],["days",n],["hours",i],["minutes",o],["seconds",s],["milliseconds",a],["microseconds",d],["nanoseconds",u]])if(l!==0)return tT.get(c);return"nanosecond"}function mg(t,e){return mae.indexOf(t)>mae.indexOf(e)?e:t}function Ot(t,e,r,{emptySourceErrorMessage:n}={emptySourceErrorMessage:"no supported properties found"}){let i=Po(null),o=!1;e.sort();for(let s of e){let a=t[s];if(a!==void 0)o=!0,pae.has(s)&&(a=pae.get(s)(a)),i[s]=a;else if(r!=="partial"){if(W$e.call(r,s))throw new TypeError(`required property '${s}' missing or undefined`);a=tNe.get(s),i[s]=a}}if(r==="partial"&&!o)throw new TypeError(n);return i}function iT(t,e="complete"){let r=["hour","microsecond","millisecond","minute","nanosecond","second"],n=Ot(t,r,"partial",{emptySourceErrorMessage:"invalid time-like"}),i={};for(let o of r){let s=Y$e(n,o);s!==void 0?i[o]=s.value:e==="complete"&&(i[o]=0)}return i}function Fr(t,e){let r=t;if(un(r)){if(Gt(r))return r;if(Ke(r)&&(Hn(e),r=Oa(R(r,Lr),R(r,To),R(r,oe))),wt(r))return Hn(e),Sc(R(r,Ie),R(r,Re),R(r,$e),R(r,oe));let d=UE(r);return wh(d,Ot(r,Qn(d,["day","month","monthCode","year"]),[]),e)}Hn(e);let{year:n,month:i,day:o,calendar:s,z:a}=function(u){return Vl(u)}(is(r));if(a)throw new RangeError("Z designator not supported for PlainDate");if(s||(s="iso8601"),!xh(s))throw new RangeError(`invalid calendar identifier ${s}`);return s=Fl(s),Sc(n,i,o,s)}function $E(t,e,r){let{hour:n,minute:i,second:o,millisecond:s,microsecond:a,nanosecond:d}=iT(e),u=Hn(r),c=wh(t,e,r),l=R(c,Ie),m=R(c,Re),p=R(c,$e);return{hour:n,minute:i,second:o,millisecond:s,microsecond:a,nanosecond:d}=mT(n,i,o,s,a,d,u),{year:l,month:m,day:p,hour:n,minute:i,second:o,millisecond:s,microsecond:a,nanosecond:d}}function ug(t,e){let r,n,i,o,s,a,d,u,c,l;if(un(t)){if(wt(t))return t;if(Ke(t))return Hn(e),Oa(R(t,Lr),R(t,To),R(t,oe));if(Gt(t))return Hn(e),oa(R(t,Ie),R(t,Re),R(t,$e),0,0,0,0,0,0,R(t,oe));l=UE(t);let m=Ot(t,Qn(l,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]),[]);({year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:d,microsecond:u,nanosecond:c}=$E(l,m,e))}else{let m;if(Hn(e),{year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:d,microsecond:u,nanosecond:c,calendar:l,z:m}=function(g){return Vl(g)}(is(t)),m)throw new RangeError("Z designator not supported for PlainDateTime");if(nN(r,n,i,o,s,a,d,u,c),l||(l="iso8601"),!xh(l))throw new RangeError(`invalid calendar identifier ${l}`);l=Fl(l)}return oa(r,n,i,o,s,a,d,u,c,l)}function Ww(t){if(Dn(t))return t;let{years:e,months:r,weeks:n,days:i,hours:o,minutes:s,seconds:a,milliseconds:d,microseconds:u,nanoseconds:c}=wg(t);return new(xe("%Temporal.Duration%"))(e,r,n,i,o,s,a,d,u,c)}function Au(t){if(mi(t))return t;if(Ke(t))return new(xe("%Temporal.Instant%"))(R(t,ut));let e=iNe(is(t));return new(xe("%Temporal.Instant%"))(e)}function bae(t,e){let r=t;if(un(r)){if(Ti(r))return r;let a,d;if(Pi(r,oe))a=R(r,oe),d=!1;else{let c=r.calendar;d=c===void 0,c===void 0&&(c="iso8601"),a=da(c)}let u=Ot(r,Qn(a,["day","month","monthCode","year"]),[]);return d&&u.month!==void 0&&u.monthCode===void 0&&u.year===void 0&&(u.year=1972),e1(a,u,e)}Hn(e);let{month:n,day:i,referenceISOYear:o,calendar:s}=H$(is(r));if(s===void 0&&(s="iso8601"),!xh(s))throw new RangeError(`invalid calendar identifier ${s}`);return s=Fl(s),o===void 0?(Kl(1972,n,i),vE(n,i,s)):e1(s,vE(n,i,s,o))}function yh(t,e="constrain"){let r,n,i,o,s,a,d=t;if(un(d)){if(Bn(d))return d;if(Ke(d)&&(d=Oa(R(d,Lr),R(d,To),R(d,oe))),wt(d))return new(xe("%Temporal.PlainTime%"))(R(d,_t),R(d,xt),R(d,Et),R(d,St),R(d,At),R(d,Tt));({hour:r,minute:n,second:i,millisecond:o,microsecond:s,nanosecond:a}=iT(d)),{hour:r,minute:n,second:i,millisecond:o,microsecond:s,nanosecond:a}=mT(r,n,i,o,s,a,e)}else({hour:r,minute:n,second:i,millisecond:o,microsecond:s,nanosecond:a}=function(c){let l=q$e.exec(c),m,p,g,v,E,A,P;if(l){m=Xn(l[1]),p=Xn(l[2]||l[5]),g=Xn(l[3]||l[6]),g===60&&(g=59);let I=(l[4]||l[7])+"000000000";v=Xn(I.slice(0,3)),E=Xn(I.slice(3,6)),A=Xn(I.slice(6,9)),P=l[14];for(let[,$,N,K]of P.matchAll(Am))if(N!=="u-ca"&&$==="!")throw new RangeError(`Unrecognized annotation: !${N}=${K}`);if(l[8])throw new RangeError("Z designator not supported for PlainTime")}else{let I,$;if({hasTime:$,hour:m,minute:p,second:g,millisecond:v,microsecond:E,nanosecond:A,z:I}=Vl(c),!$)throw new RangeError(`time is missing in string: ${c}`);if(I)throw new RangeError("Z designator not supported for PlainTime")}if(/[tT ][0-9][0-9]/.test(c))return{hour:m,minute:p,second:g,millisecond:v,microsecond:E,nanosecond:A};try{let{month:I,day:$}=H$(c);Kl(1972,I,$)}catch{try{let{year:I,month:$}=V$(c);Kl(I,$,1)}catch{return{hour:m,minute:p,second:g,millisecond:v,microsecond:E,nanosecond:A}}}throw new RangeError(`invalid ISO 8601 time-only string ${c}; may need a T prefix`)}(is(d))),PT(r,n,i,o,s,a);return new(xe("%Temporal.PlainTime%"))(r,n,i,o,s,a)}function hE(t,e){if(un(t)){if(Sr(t))return t;let s=UE(t);return gg(s,Ot(t,Qn(s,["month","monthCode","year"]),[]),e)}Hn(e);let{year:r,month:n,referenceISODay:i,calendar:o}=V$(is(t));if(o===void 0&&(o="iso8601"),!xh(o))throw new RangeError(`invalid calendar identifier ${o}`);return o=Fl(o),i===void 0?(Kl(r,n,1),bE(r,n,o)):gg(o,bE(r,n,o,i))}function oT(t,e,r,n,i,o,s,a,d,u,c,l,m,p,g){let v=new(xe("%Temporal.PlainDateTime%"))(t,e,r,n,i,o,s,a,d);if(u==="wall"||p==="ignore")return R(ns(l,v,m),ut);if(u==="exact"||p==="use"){let A=wm(t,e,r,n,i,o,s,a,d);if(A===null)throw new RangeError("ZonedDateTime outside of supported range");return z.default.subtract(A,z.default.BigInt(c))}let E=sT(l,v);for(let A of E){let P=Iu(l,A),I=z.default.toNumber(Ca(z.default.BigInt(P),nce,"halfExpand"));if(P===c||g&&I===c)return R(A,ut)}if(p==="reject"){let A=TT(c),P=wc(l)?R(l,Nl):"time zone";throw new RangeError(`Offset ${A} is invalid for ${v.toString()} in ${P}`)}return R(mce(E,l,v,m),ut)}function pE(t,e){let r,n,i,o,s,a,d,u,c,l,m,p,g,v,E=!1,A="option";if(un(t)){if(Ke(t))return t;p=UE(t);let I=Qn(p,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]);I.push("timeZone","offset");let $=Ot(t,I,["timeZone"]);l=Io($.timeZone),m=$.offset,m===void 0&&(A="wall"),g=Qw(e),v=nT(e,"reject"),{year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:d,microsecond:u,nanosecond:c}=$E(p,$,e)}else{let I,$;if({year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:d,microsecond:u,nanosecond:c,ianaName:I,offset:m,z:$,calendar:p}=function(K){let F=Vl(K);if(!F.ianaName)throw new RangeError("Temporal.ZonedDateTime requires a time zone ID in brackets");return F}(is(t)),l=Io(I),$?A="exact":m||(A="wall"),p||(p="iso8601"),!xh(p))throw new RangeError(`invalid calendar identifier ${p}`);p=Fl(p),E=!0,g=Qw(e),v=nT(e,"reject"),Hn(e)}let P=0;return A==="option"&&(P=bm(m)),eo(oT(r,n,i,o,s,a,d,u,c,A,P,l,g,v,E),l,p)}function ace(t,e,r,n,i){Kl(e,r,n),Sce(e,r,n),Wl(t),Bt(t,Ie,e),Bt(t,Re,r),Bt(t,$e,n),Bt(t,oe,i),Bt(t,Wae,!0)}function Sc(t,e,r,n="iso8601"){let i=xe("%Temporal.PlainDate%"),o=Po(i.prototype);return ace(o,t,e,r,n),o}function cce(t,e,r,n,i,o,s,a,d,u,c){nN(e,r,n,i,o,s,a,d,u),Ace(e,r,n,i,o,s,a,d,u),Wl(t),Bt(t,Ie,e),Bt(t,Re,r),Bt(t,$e,n),Bt(t,_t,i),Bt(t,xt,o),Bt(t,Et,s),Bt(t,St,a),Bt(t,At,d),Bt(t,Tt,u),Bt(t,oe,c)}function oa(t,e,r,n,i,o,s,a,d,u="iso8601"){let c=xe("%Temporal.PlainDateTime%"),l=Po(c.prototype);return cce(l,t,e,r,n,i,o,s,a,d,u),l}function dce(t,e,r,n,i){Kl(i,e,r),Sce(i,e,r),Wl(t),Bt(t,Re,e),Bt(t,$e,r),Bt(t,Ie,i),Bt(t,oe,n),Bt(t,Hae,!0)}function vE(t,e,r="iso8601",n=1972){let i=xe("%Temporal.PlainMonthDay%"),o=Po(i.prototype);return dce(o,t,e,r,n),o}function uce(t,e,r,n,i){Kl(e,r,i),function(s,a){ro(s,XA,QA),s===XA?ro(a,4,12):s===QA&&ro(a,1,9)}(e,r),Wl(t),Bt(t,Ie,e),Bt(t,Re,r),Bt(t,$e,i),Bt(t,oe,n),Bt(t,Vae,!0)}function bE(t,e,r="iso8601",n=1){let i=xe("%Temporal.PlainYearMonth%"),o=Po(i.prototype);return uce(o,t,e,r,n),o}function lce(t,e,r,n){cg(e),Wl(t),Bt(t,ut,e),Bt(t,Lr,r),Bt(t,oe,n);let i=new(xe("%Temporal.Instant%"))(R(t,ut));Bt(t,To,i)}function eo(t,e,r="iso8601"){let n=xe("%Temporal.ZonedDateTime%"),i=Po(n.prototype);return lce(i,t,e,r),i}function Qn(t,e){if(typeof t=="string"){let i=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.fields%"),i,[e])}let r=Je(Dr(t,"fields"),t,[e]),n=[];for(let i of r){if(typeof i!="string")throw new TypeError("bad return from calendar.fields()");Qae.call(n,i)}return n}function yg(t,e,r){if(typeof t=="string"){let i=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.mergeFields%"),i,[e,r])}let n=Je(Dr(t,"mergeFields"),t,[e,r]);if(!un(n))throw new TypeError("bad return from calendar.mergeFields()");return n}function to(t,e,r,n,i){let o=i;if(typeof t=="string"){let a=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.dateAdd%"),a,[e,r,n])}o===void 0&&(o=Dr(t,"dateAdd"));let s=pT(o,t,[e,r,n]);if(!Gt(s))throw new TypeError("invalid result");return s}function vm(t,e,r,n,i){let o=i;if(typeof t=="string"){let a=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.dateUntil%"),a,[e,r,n])}o===void 0&&(o=Dr(t,"dateUntil"));let s=pT(o,t,[e,r,n]);if(!Dn(s))throw new TypeError("invalid result");return s}function yT(t,e){if(typeof t=="string"){let n=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.year%"),n,[e])}let r=Je(Dr(t,"year"),t,[e]);if(typeof r!="number")throw new TypeError("calendar year result must be an integer");if(!$a(r))throw new RangeError("calendar year result must be an integer");return r}function gT(t,e){if(typeof t=="string"){let n=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.month%"),n,[e])}let r=Je(Dr(t,"month"),t,[e]);if(typeof r!="number")throw new TypeError("calendar month result must be a positive integer");if(!$a(r)||r<1)throw new RangeError("calendar month result must be a positive integer");return r}function NE(t,e){if(typeof t=="string"){let n=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.monthCode%"),n,[e])}let r=Je(Dr(t,"monthCode"),t,[e]);if(typeof r!="string")throw new TypeError("calendar monthCode result must be a string");return r}function jE(t,e){if(typeof t=="string"){let n=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.day%"),n,[e])}let r=Je(Dr(t,"day"),t,[e]);if(typeof r!="number")throw new TypeError("calendar day result must be a positive integer");if(!$a(r)||r<1)throw new RangeError("calendar day result must be a positive integer");return r}function vT(t,e){if(typeof t=="string"){let n=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.era%"),n,[e])}let r=Je(Dr(t,"era"),t,[e]);if(r===void 0)return r;if(typeof r!="string")throw new TypeError("calendar era result must be a string or undefined");return r}function bT(t,e){if(typeof t=="string"){let n=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.eraYear%"),n,[e])}let r=Je(Dr(t,"eraYear"),t,[e]);if(r===void 0)return r;if(typeof r!="number")throw new TypeError("calendar eraYear result must be an integer or undefined");if(!$a(r))throw new RangeError("calendar eraYear result must be an integer or undefined");return r}function G$(t,e){if(typeof t=="string"){let n=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.dayOfWeek%"),n,[e])}let r=Je(Dr(t,"dayOfWeek"),t,[e]);if(typeof r!="number")throw new TypeError("calendar dayOfWeek result must be a positive integer");if(!$a(r)||r<1)throw new RangeError("calendar dayOfWeek result must be a positive integer");return r}function J$(t,e){if(typeof t=="string"){let n=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.dayOfYear%"),n,[e])}let r=Je(Dr(t,"dayOfYear"),t,[e]);if(typeof r!="number")throw new TypeError("calendar dayOfYear result must be a positive integer");if(!$a(r)||r<1)throw new RangeError("calendar dayOfYear result must be a positive integer");return r}function Y$(t,e){if(typeof t=="string"){let n=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.weekOfYear%"),n,[e])}let r=Je(Dr(t,"weekOfYear"),t,[e]);if(typeof r!="number")throw new TypeError("calendar weekOfYear result must be a positive integer");if(!$a(r)||r<1)throw new RangeError("calendar weekOfYear result must be a positive integer");return r}function Z$(t,e){if(typeof t=="string"){let n=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.yearOfWeek%"),n,[e])}let r=Je(Dr(t,"yearOfWeek"),t,[e]);if(typeof r!="number")throw new TypeError("calendar yearOfWeek result must be an integer");if(!$a(r))throw new RangeError("calendar yearOfWeek result must be an integer");return r}function X$(t,e){if(typeof t=="string"){let n=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.daysInWeek%"),n,[e])}let r=Je(Dr(t,"daysInWeek"),t,[e]);if(typeof r!="number")throw new TypeError("calendar daysInWeek result must be a positive integer");if(!$a(r)||r<1)throw new RangeError("calendar daysInWeek result must be a positive integer");return r}function wT(t,e){if(typeof t=="string"){let n=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.daysInMonth%"),n,[e])}let r=Je(Dr(t,"daysInMonth"),t,[e]);if(typeof r!="number")throw new TypeError("calendar daysInMonth result must be a positive integer");if(!$a(r)||r<1)throw new RangeError("calendar daysInMonth result must be a positive integer");return r}function _T(t,e){if(typeof t=="string"){let n=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.daysInYear%"),n,[e])}let r=Je(Dr(t,"daysInYear"),t,[e]);if(typeof r!="number")throw new TypeError("calendar daysInYear result must be a positive integer");if(!$a(r)||r<1)throw new RangeError("calendar daysInYear result must be a positive integer");return r}function xT(t,e){if(typeof t=="string"){let n=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.monthsInYear%"),n,[e])}let r=Je(Dr(t,"monthsInYear"),t,[e]);if(typeof r!="number")throw new TypeError("calendar monthsInYear result must be a positive integer");if(!$a(r)||r<1)throw new RangeError("calendar monthsInYear result must be a positive integer");return r}function ET(t,e){if(typeof t=="string"){let n=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.inLeapYear%"),n,[e])}let r=Je(Dr(t,"inLeapYear"),t,[e]);if(typeof r!="boolean")throw new TypeError("calendar inLeapYear result must be a boolean");return r}function da(t){if(un(t)){if(Pi(t,oe))return R(t,oe);if(!function(i){return!!Rn(i)||"dateAdd"in i&&"dateFromFields"in i&&"dateUntil"in i&&"day"in i&&"dayOfWeek"in i&&"dayOfYear"in i&&"daysInMonth"in i&&"daysInWeek"in i&&"daysInYear"in i&&"fields"in i&&"id"in i&&"inLeapYear"in i&&"mergeFields"in i&&"month"in i&&"monthCode"in i&&"monthDayFromFields"in i&&"monthsInYear"in i&&"weekOfYear"in i&&"year"in i&&"yearMonthFromFields"in i&&"yearOfWeek"in i}(t))throw new TypeError("expected a Temporal.Calendar or object implementing the Temporal.Calendar protocol");return t}let e=is(t);if(xh(e))return Fl(e);let r;try{({calendar:r}=Vl(e))}catch{try{({calendar:r}=V$(e))}catch{({calendar:r}=H$(e))}}if(r||(r="iso8601"),!xh(r))throw new RangeError(`invalid calendar identifier ${r}`);return Fl(r)}function UE(t){if(Pi(t,oe))return R(t,oe);let{calendar:e}=t;return e===void 0?"iso8601":da(e)}function no(t){if(typeof t=="string")return t;let e=t.id;if(typeof e!="string")throw new TypeError("calendar.id should be a string");return e}function d1(t){return un(t)?t:new(xe("%Temporal.Calendar%"))(t)}function qE(t,e){return t===e?!0:no(t)===no(e)}function ST(t,e,r){if(t===e)return;let n=no(t),i=no(e);if(n!==i)throw new RangeError(`cannot ${r} of ${n} and ${i} calendars`)}function fce(t,e){if(t===e)return e;let r=no(t),n=no(e);if(r===n||r==="iso8601")return e;if(n==="iso8601")return t;throw new RangeError("irreconcilable calendars")}function wh(t,e,r,n){if(typeof t=="string"){let o=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.dateFromFields%"),o,[e,r])}let i=Je(n??Dr(t,"dateFromFields"),t,[e,r]);if(!Gt(i))throw new TypeError("invalid result");return i}function gg(t,e,r){if(typeof t=="string"){let i=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.yearMonthFromFields%"),i,[e,r])}let n=Je(Dr(t,"yearMonthFromFields"),t,[e,r]);if(!Sr(n))throw new TypeError("invalid result");return n}function e1(t,e,r){if(typeof t=="string"){let i=new(xe("%Temporal.Calendar%"))(t);return Je(xe("%Temporal.Calendar.prototype.monthDayFromFields%"),i,[e,r])}let n=Je(Dr(t,"monthDayFromFields"),t,[e,r]);if(!Ti(n))throw new TypeError("invalid result");return n}function Io(t){if(un(t)){if(Ke(t))return R(t,Lr);if(!function(r){return!!wc(r)||"getOffsetNanosecondsFor"in r&&"getPossibleInstantsFor"in r&&"id"in r}(t))throw new TypeError("expected a Temporal.TimeZone or object implementing the Temporal.TimeZone protocol");return t}return nNe(is(t))}function wE(t){if(typeof t=="string")return t;let e=t.id;if(typeof e!="string")throw new TypeError("timeZone.id should be a string");return e}function hce(t){return un(t)?t:new(xe("%Temporal.TimeZone%"))(t)}function pce(t,e){return t===e?!0:wE(t)===wE(e)}function t1(t){return Sc(R(t,Ie),R(t,Re),R(t,$e),R(t,oe))}function Q$(t){return new(xe("%Temporal.PlainTime%"))(R(t,_t),R(t,xt),R(t,Et),R(t,St),R(t,At),R(t,Tt))}function Iu(t,e,r){if(typeof t=="string"){let i=new(xe("%Temporal.TimeZone%"))(t);return Je(xe("%Temporal.TimeZone.prototype.getOffsetNanosecondsFor%"),i,[e])}let n=Je(r??Dr(t,"getOffsetNanosecondsFor"),t,[e]);if(typeof n!="number")throw new TypeError("bad return from getOffsetNanosecondsFor");if(!$a(n)||dn(n)>=864e11)throw new RangeError("out-of-range return from getOffsetNanosecondsFor");return n}function v$(t,e){return TT(Iu(t,e))}function Oa(t,e,r){let n=R(e,ut),i=Iu(t,e),{year:o,month:s,day:a,hour:d,minute:u,second:c,millisecond:l,microsecond:m,nanosecond:p}=gce(n);return{year:o,month:s,day:a,hour:d,minute:u,second:c,millisecond:l,microsecond:m,nanosecond:p}=tN(o,s,a,d,u,c,l,m,p+i),oa(o,s,a,d,u,c,l,m,p,r)}function ns(t,e,r){return mce(sT(t,e),t,e,r)}function mce(t,e,r,n){let i=xe("%Temporal.Instant%"),o=t.length;if(o===1)return t[0];if(o)switch(n){case"compatible":case"earlier":return t[0];case"later":return t[o-1];case"reject":throw new RangeError("multiple instants found")}let s=R(r,Ie),a=R(r,Re),d=R(r,$e),u=R(r,_t),c=R(r,xt),l=R(r,Et),m=R(r,St),p=R(r,At),g=R(r,Tt),v=wm(s,a,d,u,c,l,m,p,g);if(v===null)throw new RangeError("DateTime outside of supported range");let E=new i(z.default.subtract(v,Ll)),A=new i(z.default.add(v,Ll)),P=Iu(e,E),I=Iu(e,A)-P;switch(n){case"earlier":{let $=R(r,oe),N=xe("%Temporal.PlainDateTime%"),K=x$(s,a,d,u,c,l,m,p,g,$,0,0,0,0,0,0,0,0,0,-I,void 0);return sT(e,new N(K.year,K.month,K.day,K.hour,K.minute,K.second,K.millisecond,K.microsecond,K.nanosecond,$))[0]}case"compatible":case"later":{let $=R(r,oe),N=xe("%Temporal.PlainDateTime%"),K=x$(s,a,d,u,c,l,m,p,g,$,0,0,0,0,0,0,0,0,0,I,void 0),F=sT(e,new N(K.year,K.month,K.day,K.hour,K.minute,K.second,K.millisecond,K.microsecond,K.nanosecond,$));return F[F.length-1]}case"reject":throw new RangeError("no such instant found")}}function sT(t,e,r){if(typeof t=="string"){let o=new(xe("%Temporal.TimeZone%"))(t);return Je(xe("%Temporal.TimeZone.prototype.getPossibleInstantsFor%"),o,[e])}let n=Je(r??Dr(t,"getPossibleInstantsFor"),t,[e]),i=[];for(let o of n){if(!mi(o))throw new TypeError("bad return from getPossibleInstantsFor");Qae.call(i,o)}return i}function _g(t){let e;return t<0||t>9999?e=(t<0?"-":"+")+`000000${dn(t)}`.slice(-6):e=`0000${t}`.slice(-4),e}function vn(t){return`00${t}`.slice(-2)}function AT(t,e,r,n,i){if(i==="minute")return"";let o=`:${vn(t)}`,s,a=1e6*e+1e3*r+n;if(i==="auto"){if(a===0)return o;for(s=`${a}`.padStart(9,"0");s[s.length-1]==="0";)s=s.slice(0,-1)}else{if(i===0)return o;s=`${a}`.padStart(9,"0").slice(0,i)}return`${o}.${s}`}function wae(t,e,r){let n=e;n===void 0&&(n="UTC");let i=Oa(n,t,"iso8601"),o=_g(R(i,Ie)),s=vn(R(i,Re)),a=vn(R(i,$e)),d=vn(R(i,_t)),u=vn(R(i,xt)),c=AT(R(i,Et),R(i,St),R(i,At),R(i,Tt),r),l="Z";return e!==void 0&&(l=yce(Iu(n,t))),`${o}-${s}-${a}T${d}:${u}${c}${l}`}function c$(t,e="auto",r){function n(W){return W<=J$e?W.toString(10):z.default.BigInt(W).toString(10)}let i=R(t,Go),o=R(t,Li),s=R(t,js),a=R(t,Jo),d=R(t,Yo),u=R(t,Zo),c=R(t,Xo),l=R(t,Qo),m=R(t,es),p=R(t,ts),g=ql(i,o,s,a,d,u,c,l,m,p);if(r){let{unit:W,increment:L,roundingMode:T}=r;({seconds:c,milliseconds:l,microseconds:m,nanoseconds:p}=_h(0,0,0,0,0,0,c,l,m,p,L,W,T))}let v=[];i&&v.push(`${n(dn(i))}Y`),o&&v.push(`${n(dn(o))}M`),s&&v.push(`${n(dn(s))}W`),a&&v.push(`${n(dn(a))}D`);let E=[];d&&E.push(`${n(dn(d))}H`),u&&E.push(`${n(dn(u))}M`);let A=[],P,I,$,N,K=r1(0,0,0,c,l,m,p,0);({quotient:K,remainder:P}=Vn(K,Ar)),{quotient:K,remainder:I}=Vn(K,Ar),{quotient:N,remainder:$}=Vn(K,Ar);let F=1e6*dn(z.default.toNumber($))+1e3*dn(z.default.toNumber(I))+dn(z.default.toNumber(P)),U;if(e==="auto"){if(F!==0)for(U=`${F}`.padStart(9,"0");U[U.length-1]==="0";)U=U.slice(0,-1)}else e!==0&&(U=`${F}`.padStart(9,"0").slice(0,e));return U&&A.unshift(".",U),z.default.equal(N,Mn)&&!A.length&&e==="auto"||A.unshift(Su(N).toString()),A.length&&E.push(`${A.join("")}S`),E.length&&E.unshift("T"),v.length||E.length?`${g<0?"-":""}P${v.join("")}${E.join("")}`:"PT0S"}function _ae(t,e="auto"){return`${_g(R(t,Ie))}-${vn(R(t,Re))}-${vn(R(t,$e))}${z$(R(t,oe),e)}`}function xae(t,e,r="auto",n){let i=R(t,Ie),o=R(t,Re),s=R(t,$e),a=R(t,_t),d=R(t,xt),u=R(t,Et),c=R(t,St),l=R(t,At),m=R(t,Tt);if(n){let{unit:p,increment:g,roundingMode:v}=n;({year:i,month:o,day:s,hour:a,minute:d,second:u,millisecond:c,microsecond:l,nanosecond:m}=aN(i,o,s,a,d,u,c,l,m,g,p,v))}return`${_g(i)}-${vn(o)}-${vn(s)}T${vn(a)}:${vn(d)}${AT(u,c,l,m,e)}${z$(R(t,oe),r)}`}function Eae(t,e="auto"){let r=`${vn(R(t,Re))}-${vn(R(t,$e))}`,n=no(R(t,oe));(e==="always"||e==="critical"||n!=="iso8601")&&(r=`${_g(R(t,Ie))}-${r}`);let i=W$(n,e);return i&&(r+=i),r}function Sae(t,e="auto"){let r=`${_g(R(t,Ie))}-${vn(R(t,Re))}`,n=no(R(t,oe));(e==="always"||e==="critical"||n!=="iso8601")&&(r+=`-${vn(R(t,$e))}`);let i=W$(n,e);return i&&(r+=i),r}function Aae(t,e,r="auto",n="auto",i="auto",o){let s=R(t,To);if(o){let{unit:c,increment:l,roundingMode:m}=o,p=dT(R(t,ut),l,c,m);s=new(xe("%Temporal.Instant%"))(p)}let a=R(t,Lr),d=Oa(a,s,"iso8601"),u=`${_g(R(d,Ie))}-${vn(R(d,Re))}-${vn(R(d,$e))}T${vn(R(d,_t))}:${vn(R(d,xt))}${AT(R(d,Et),R(d,St),R(d,At),R(d,Tt),e)}`;return i!=="never"&&(u+=yce(Iu(a,s))),n!=="never"&&(u+=`[${n==="critical"?"!":""}${wE(a)}]`),u+=z$(R(t,oe),r),u}function Kw(t){return Bce.test(DE(t))}function bm(t){let e=Bce.exec(DE(t));if(!e)throw new RangeError(`invalid time zone offset: ${t}`);return(e[1]==="-"||e[1]==="\u2212"?-1:1)*(1e9*(60*(60*+e[2]+ +(e[3]||0))+ +(e[4]||0))+ +((e[5]||0)+"000000000").slice(0,9))}function eN(t){return Kw(t)?TT(bm(t)):sce(DE(t)).resolvedOptions().timeZone}function gh(t,e){let{year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:d,microsecond:u,nanosecond:c}=vce(t,e),l=r%400,m=(r-l)/400,p=z.default.multiply(z.default.BigInt(146097),Ll),g=wm(l,n,i,o,s,a,d,u,c),v=z.default.add(g,z.default.multiply(p,z.default.BigInt(m)));return z.default.toNumber(z.default.subtract(v,e))}function TT(t){let e=t<0?"-":"+",r=dn(t),n=r%1e9,i=aa(r/1e9)%60,o=aa(r/6e10)%60,s=vn(aa(r/36e11)),a=vn(o),d=vn(i),u="";if(n){let c=`${n}`.padStart(9,"0");for(;c[c.length-1]==="0";)c=c.slice(0,-1);u=`:${d}.${c}`}else i&&(u=`:${d}`);return`${e}${s}:${a}${u}`}function yce(t){let e=z.default.toNumber(Ca(z.default.BigInt(t),nce,"halfExpand")),r=e<0?"-":"+";e=dn(e);let n=e/6e10%60;return`${r}${vn(aa(e/36e11))}:${vn(n)}`}function wm(t,e,r,n,i,o,s,a,d){let u=new Date;u.setUTCHours(n,i,o,s),u.setUTCFullYear(t,e-1,r);let c=u.getTime();if(hT(c))return null;let l=z.default.multiply(z.default.BigInt(c),xc);return l=z.default.add(l,z.default.multiply(z.default.BigInt(a),Ar)),l=z.default.add(l,z.default.BigInt(d)),z.default.lessThan(l,gE)||z.default.greaterThan(l,Zw)?null:l}function gce(t){let{quotient:e,remainder:r}=Vn(t,xc),n=z.default.toNumber(e),i=z.default.toNumber(r);i<0&&(i+=1e6,n-=1);let o=aa(i/1e3)%1e3,s=i%1e3,a=new Date(n);return{epochMilliseconds:n,year:a.getUTCFullYear(),month:a.getUTCMonth()+1,day:a.getUTCDate(),hour:a.getUTCHours(),minute:a.getUTCMinutes(),second:a.getUTCSeconds(),millisecond:a.getUTCMilliseconds(),microsecond:o,nanosecond:s}}function vce(t,e){let{epochMilliseconds:r,millisecond:n,microsecond:i,nanosecond:o}=gce(e),{year:s,month:a,day:d,hour:u,minute:c,second:l}=function(p,g){let v=sce(p).format(new Date(g));return function(A){let P=A.split(/[^\w]+/);if(P.length!==7)throw new RangeError(`expected 7 parts in "${A}`);let I=+P[0],$=+P[1],N=+P[2],K=P[3].toUpperCase();if(K==="B"||K==="BC")N=1-N;else if(K!=="A"&&K!=="AD")throw new RangeError(`Unknown era ${K} in "${A}`);let F=+P[4];F===24&&(F=0);let U=+P[5],W=+P[6];if(!(rs(N)&&rs(I)&&rs($)&&rs(F)&&rs(U)&&rs(W)))throw new RangeError(`Invalid number in "${A}`);return{year:N,month:I,day:$,hour:F,minute:U,second:W}}(v)}(t,r);return tN(s,a,d,u,c,l,n,i,o)}function Tae(t,e){return z.default.lessThan(t,e)?e:t}function bce(){return z.default.add(dN(),Q$e)}function wce(t,e){if(z.default.lessThan(e,Fw))return wce(t,Fw);let r=z.default.add(e,ice),n=Tae(bce(),r),i=Tae(Fw,e),o=gh(t,i),s=i,a=o;for(;o===a&&z.default.lessThan(z.default.BigInt(i),n);){if(s=z.default.add(i,oce),z.default.greaterThan(s,Zw))return null;a=gh(t,s),o===a&&(i=s)}return o===a?null:Mce(d=>gh(t,d),i,s,o,a)}function b$(t,e){let r=bce(),n=z.default.greaterThan(e,r),i=n?z.default.subtract(e,ice):Fw;if(t==="Africa/Casablanca"||t==="Africa/El_Aaiun"){let u=R(Au("2088-01-01T00Z"),ut);if(z.default.lessThan(u,e))return b$(t,u)}let o=z.default.subtract(e,o1);if(z.default.lessThan(o,Fw))return null;let s=gh(t,o),a=o,d=s;for(;s===d&&z.default.greaterThan(o,i);){if(a=z.default.subtract(o,oce),z.default.lessThan(a,Fw))return null;d=gh(t,a),s===d&&(o=a)}if(s===d){if(n){let u=z.default.subtract(r,Ll);return b$(t,u)}return null}return Mce(u=>gh(t,u),a,o,d,s)}function _m(t){return t===void 0?!1:t%4==0&&(t%100!=0||t%400==0)}function vh(t,e){return{standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]}[_m(t)?"leapyear":"standard"][e-1]}function w$(t,e,r){let n=e+(e<3?10:-2),i=t-(e<3?1:0),o=aa(i/100),s=i-100*o,a=(r+aa(2.6*n-.2)+(s+aa(s/4))+(aa(o/4)-2*o))%7;return a+(a<=0?7:0)}function aT(t,e,r){let n=r;for(let i=e-1;i>0;i--)n+=vh(t,i);return n}function Iae(t,e,r){let n=aT(t,e,r),i=w$(t,e,r)||7,o=w$(t,1,1),s=aa((n-i+10)/7);return s<1?o===5||o===6&&_m(t-1)?{week:53,year:t-1}:{week:52,year:t-1}:s===53&&(_m(t)?366:365)-n<4-i?{week:1,year:t+1}:{week:s,year:t}}function ql(t,e,r,n,i,o,s,a,d,u){for(let c of[t,e,r,n,i,o,s,a,d,u])if(c!==0)return c<0?-1:1;return 0}function GA(t,e){let r=t,n=e;if(!rs(r)||!rs(n))throw new RangeError("infinity is out of range");return n-=1,r+=aa(n/12),n%=12,n<0&&(n+=12),n+=1,{year:r,month:n}}function IT(t,e,r){let n=t,i=e,o=r;if(!rs(o))throw new RangeError("infinity is out of range");({year:n,month:i}=GA(n,i));let s=146097;if(dn(o)>s){let u=dg(o/s);n+=400*u,o-=u*s}let a=0,d=i>2?n:n-1;for(;a=_m(d)?366:365,o<-a;)n-=1,d-=1,o+=a;for(d+=1;a=_m(d)?366:365,o>a;)n+=1,d+=1,o-=a;for(;o<1;)({year:n,month:i}=GA(n,i-1)),o+=vh(n,i);for(;o>vh(n,i);)o-=vh(n,i),{year:n,month:i}=GA(n,i+1);return{year:n,month:i,day:o}}function tN(t,e,r,n,i,o,s,a,d){let{deltaDays:u,hour:c,minute:l,second:m,millisecond:p,microsecond:g,nanosecond:v}=mh(n,i,o,s,a,d),{year:E,month:A,day:P}=IT(t,e,r+u);return{year:E,month:A,day:P,hour:c,minute:l,second:m,millisecond:p,microsecond:g,nanosecond:v}}function mh(t,e,r,n,i,o){let s,a=z.default.BigInt(t),d=z.default.BigInt(e),u=z.default.BigInt(r),c=z.default.BigInt(n),l=z.default.BigInt(i),m=z.default.BigInt(o);return{quotient:s,remainder:m}=ag(m,Ar),l=z.default.add(l,s),{quotient:s,remainder:l}=ag(l,Ar),c=z.default.add(c,s),{quotient:s,remainder:c}=ag(c,Ar),u=z.default.add(u,s),{quotient:s,remainder:u}=ag(u,jl),d=z.default.add(d,s),{quotient:s,remainder:d}=ag(d,jl),a=z.default.add(a,s),{quotient:s,remainder:a}=ag(a,tce),{deltaDays:z.default.toNumber(s),hour:z.default.toNumber(a),minute:z.default.toNumber(d),second:z.default.toNumber(u),millisecond:z.default.toNumber(c),microsecond:z.default.toNumber(l),nanosecond:z.default.toNumber(m)}}function r1(t,e,r,n,i,o,s,a){let d=z.default.BigInt(t),u=z.default.BigInt(s);t!==0&&(u=z.default.subtract(z.default.BigInt(s),z.default.BigInt(a)));let c=z.default.add(z.default.BigInt(e),z.default.multiply(d,z.default.BigInt(24))),l=z.default.add(z.default.BigInt(r),z.default.multiply(c,jl)),m=z.default.add(z.default.BigInt(n),z.default.multiply(l,jl)),p=z.default.add(z.default.BigInt(i),z.default.multiply(m,Ar)),g=z.default.add(z.default.BigInt(o),z.default.multiply(p,Ar));return z.default.add(z.default.BigInt(u),z.default.multiply(g,Ar))}function rN(t,e){let r=xe("%Temporal.Instant%"),n=Yw(z.default.toNumber(t)),i=z.default.BigInt(t),o=864e11;if(n===0)return{days:0,nanoseconds:Mn,dayLengthNs:o};if(!Ke(e)){let I;return{quotient:I,remainder:i}=Vn(i,z.default.BigInt(o)),{days:z.default.toNumber(I),nanoseconds:i,dayLengthNs:o}}let s=R(e,ut),a=R(e,To),d=z.default.add(s,i),u=new r(d),c=R(e,Lr),l=R(e,oe),m=Oa(c,a,l),p=Oa(c,u,l),{days:g}=sN(R(m,Ie),R(m,Re),R(m,$e),R(m,_t),R(m,xt),R(m,Et),R(m,St),R(m,At),R(m,Tt),R(p,Ie),R(p,Re),R(p,$e),R(p,_t),R(p,xt),R(p,Et),R(p,St),R(p,At),R(p,Tt),l,"day",Po(null)),v=Ec(a,c,l,0,0,0,g,0,0,0,0,0,0),E=z.default.BigInt(g);if(n===1)for(;z.default.greaterThan(E,Mn)&&z.default.greaterThan(v,d);)E=z.default.subtract(E,o1),v=Ec(a,c,l,0,0,0,z.default.toNumber(E),0,0,0,0,0,0);i=z.default.subtract(d,v);let A=!1,P=new r(v);do{let I=Ec(P,c,l,0,0,0,n,0,0,0,0,0,0),$=R(P,ut);o=z.default.toNumber(z.default.subtract(I,$)),A=z.default.greaterThanOrEqual(z.default.multiply(z.default.subtract(i,z.default.BigInt(o)),z.default.BigInt(n)),Mn),A&&(i=z.default.subtract(i,z.default.BigInt(o)),P=new r(I),E=z.default.add(E,z.default.BigInt(n)))}while(A);if(!_c(E)&&hae(E)!==n)throw new RangeError("Time zone or calendar converted nanoseconds into a number of days with the opposite sign");if(!_c(i)&&hae(i)!==n)throw eT(i)&&n===1?new Error("assert not reached"):new RangeError("Time zone or calendar ended up with a remainder of nanoseconds with the opposite sign");if(z.default.greaterThanOrEqual(Su(i),Su(z.default.BigInt(o))))throw new Error("assert not reached");return{days:z.default.toNumber(E),nanoseconds:i,dayLengthNs:dn(o)}}function wd(t,e,r,n,i,o,s,a,d){let u=_ce(t,e,r,n,i,o,s,a,d);if(u==="positive overflow"||u==="negative overflow")throw new RangeError("Duration out of range");return u}function _ce(t,e,r,n,i,o,s,a,d){let u,c,l,m,p,g,v=t;if(Ke(d)){let F=Ec(R(d,To),R(d,Lr),R(d,oe),0,0,0,v,e,r,n,i,o,s),U=R(d,ut);u=z.default.subtract(F,U)}else u=r1(v,e,r,n,i,o,s,0);a==="year"||a==="month"||a==="week"||a==="day"?{days:v,nanoseconds:u}=rN(u,d):v=0;let E=z.default.lessThan(u,Mn)?-1:1;switch(u=Su(u),c=l=m=p=g=Mn,a){case"year":case"month":case"week":case"day":case"hour":({quotient:c,remainder:u}=Vn(u,Ar)),{quotient:l,remainder:c}=Vn(c,Ar),{quotient:m,remainder:l}=Vn(l,Ar),{quotient:p,remainder:m}=Vn(m,jl),{quotient:g,remainder:p}=Vn(p,jl);break;case"minute":({quotient:c,remainder:u}=Vn(u,Ar)),{quotient:l,remainder:c}=Vn(c,Ar),{quotient:m,remainder:l}=Vn(l,Ar),{quotient:p,remainder:m}=Vn(m,jl);break;case"second":({quotient:c,remainder:u}=Vn(u,Ar)),{quotient:l,remainder:c}=Vn(c,Ar),{quotient:m,remainder:l}=Vn(l,Ar);break;case"millisecond":({quotient:c,remainder:u}=Vn(u,Ar)),{quotient:l,remainder:c}=Vn(c,Ar);break;case"microsecond":({quotient:c,remainder:u}=Vn(u,Ar));break;case"nanosecond":break;default:throw new Error("assert not reached")}let A=z.default.toNumber(g)*E,P=z.default.toNumber(p)*E,I=z.default.toNumber(m)*E,$=z.default.toNumber(l)*E,N=z.default.toNumber(c)*E,K=z.default.toNumber(u)*E;for(let F of[v,A,P,I,$,N,K])if(!rs(F))return E===1?"positive overflow":"negative overflow";return{days:v,hours:A,minutes:P,seconds:I,milliseconds:$,microseconds:N,nanoseconds:K}}function VA(t,e,r,n,i,o){let s=xe("%Temporal.Duration%"),a=ql(t,e,r,n,0,0,0,0,0,0);if(a===0)return{years:t,months:e,weeks:r,days:n};let d=z.default.BigInt(a),u,c,l=z.default.BigInt(t),m=z.default.BigInt(e),p=z.default.BigInt(r),g=z.default.BigInt(n);o&&(c=Fr(o),u=R(c,oe));let v=new s(a),E=new s(0,a),A=new s(0,0,a);switch(i){case"year":break;case"month":{if(!u)throw new RangeError("a starting point is required for months balancing");let P,I;for(typeof u!="string"&&(P=Dr(u,"dateAdd"),I=Dr(u,"dateUntil"));!_c(l);){let $=to(u,c,v,void 0,P),N=Po(null);N.largestUnit="month";let K=vm(u,c,$,N,I),F=z.default.BigInt(R(K,Li));c=$,m=z.default.add(m,F),l=z.default.subtract(l,d)}}break;case"week":{if(!u)throw new RangeError("a starting point is required for weeks balancing");let P=typeof u!="string"?Dr(u,"dateAdd"):void 0;for(;!_c(l);){let I;({relativeTo:c,days:I}=Ao(u,c,v,P)),g=z.default.add(g,z.default.BigInt(I)),l=z.default.subtract(l,d)}for(;!_c(m);){let I;({relativeTo:c,days:I}=Ao(u,c,E,P)),g=z.default.add(g,z.default.BigInt(I)),m=z.default.subtract(m,d)}break}default:{if(_c(l)&&_c(m)&&_c(p))break;if(!u)throw new RangeError("a starting point is required for balancing calendar units");let P=typeof u!="string"?Dr(u,"dateAdd"):void 0;for(;!_c(l);){let I;({relativeTo:c,days:I}=Ao(u,c,v,P)),g=z.default.add(g,z.default.BigInt(I)),l=z.default.subtract(l,d)}for(;!_c(m);){let I;({relativeTo:c,days:I}=Ao(u,c,E,P)),g=z.default.add(g,z.default.BigInt(I)),m=z.default.subtract(m,d)}for(;!_c(p);){let I;({relativeTo:c,days:I}=Ao(u,c,A,P)),g=z.default.add(g,z.default.BigInt(I)),p=z.default.subtract(p,d)}break}}return{years:z.default.toNumber(l),months:z.default.toNumber(m),weeks:z.default.toNumber(p),days:z.default.toNumber(g)}}function Pae(t,e,r,n,i){if(Ke(t)){let o=R(t,To),s=R(t,Lr),a=R(t,oe),d=Iu(s,o),u=Ec(o,s,a,e,r,n,i,0,0,0,0,0,0);return Iu(s,new(xe("%Temporal.Instant%"))(u))-d}return 0}function xce(t){return new(xe("%Temporal.Duration%"))(-R(t,Go),-R(t,Li),-R(t,js),-R(t,Jo),-R(t,Yo),-R(t,Zo),-R(t,Xo),-R(t,Qo),-R(t,es),-R(t,ts))}function sa(t,e,r){return V$e(r,H$e(e,t))}function Ece(t,e,r){let n=sa(e,1,12);return{year:t,month:n,day:sa(r,1,vh(t,n))}}function ro(t,e,r){if(tr)throw new RangeError(`value out of range: ${e} <= ${t} <= ${r}`)}function Kl(t,e,r){ro(e,1,12),ro(r,1,vh(t,e))}function Sce(t,e,r){Ace(t,e,r,12,0,0,0,0,0)}function PT(t,e,r,n,i,o){ro(t,0,23),ro(e,0,59),ro(r,0,59),ro(n,0,999),ro(i,0,999),ro(o,0,999)}function nN(t,e,r,n,i,o,s,a,d){Kl(t,e,r),PT(n,i,o,s,a,d)}function Ace(t,e,r,n,i,o,s,a,d){if(ro(t,XA,QA),t===XA&&wm(t,e,r+1,n,i,o,s,a,d-1)==null||t===QA&&wm(t,e,r-1,n,i,o,s,a,d+1)==null)throw new RangeError("DateTime outside of supported range")}function cg(t){if(z.default.lessThan(t,gE)||z.default.greaterThan(t,Zw))throw new RangeError("Instant outside of supported range")}function cT(t,e,r,n,i,o,s,a,d,u){let c=ql(t,e,r,n,i,o,s,a,d,u);for(let l of[t,e,r,n,i,o,s,a,d,u]){if(!rs(l))throw new RangeError("infinite values not allowed as duration fields");let m=Yw(l);if(m!==0&&m!==c)throw new RangeError("mixed-sign values not allowed as duration fields")}}function iN(t,e,r,n,i,o,s){switch(s){case"year":case"month":{let a=-gm(t,e,r,n,i,o);if(a===0)return{years:0,months:0,weeks:0,days:0};let d={year:t,month:e,day:r},u={year:n,month:i,day:o},c=u.year-d.year,l=lg(t,e,r,c,0,0,0,"constrain"),m=-gm(l.year,l.month,l.day,n,i,o);if(m===0)return s==="year"?{years:c,months:0,weeks:0,days:0}:{years:0,months:12*c,weeks:0,days:0};let p=u.month-d.month;if(m!==a&&(c-=a,p+=12*a),l=lg(t,e,r,c,p,0,0,"constrain"),m=-gm(l.year,l.month,l.day,n,i,o),m===0)return s==="year"?{years:c,months:p,weeks:0,days:0}:{years:0,months:p+12*c,weeks:0,days:0};m!==a&&(p-=a,p===-a&&(c-=a,p=11*a),l=lg(t,e,r,c,p,0,0,"constrain"));let g=0;return g=l.month===u.month?u.day-l.day:a<0?-l.day-(vh(u.year,u.month)-u.day):u.day+(vh(l.year,l.month)-l.day),s==="month"&&(p+=12*c,c=0),{years:c,months:p,weeks:0,days:g}}case"week":case"day":{let a,d,u;gm(t,e,r,n,i,o)<0?(d={year:t,month:e,day:r},a={year:n,month:i,day:o},u=1):(d={year:n,month:i,day:o},a={year:t,month:e,day:r},u=-1);let c=aT(a.year,a.month,a.day)-aT(d.year,d.month,d.day);for(let m=d.year;m{let v=g[0],E=g[1],A=g[2];return r!=="datetime"&&A!==r||n.includes(E)||p.push(E,v),p},[]),a=ca(e,"largestUnit",r,"auto");if(n.includes(a))throw new RangeError(`largestUnit must be one of ${s.join(", ")}, not ${a}`);let d=a1(e),u=Tu(e,"trunc");t==="since"&&(u=function(g){switch(g){case"ceil":return"floor";case"floor":return"ceil";case"halfCeil":return"halfFloor";case"halfFloor":return"halfCeil";default:return g}}(u));let c=ca(e,"smallestUnit",r,i);if(n.includes(c))throw new RangeError(`smallestUnit must be one of ${s.join(", ")}, not ${c}`);let l=mg(o,c);if(a==="auto"&&(a=l),mg(a,c)!==a)throw new RangeError(`largestUnit ${a} cannot be smaller than smallestUnit ${c}`);let m={hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[c];return m!==void 0&&c1(d,m,!1),{largestUnit:a,roundingIncrement:d,roundingMode:u,smallestUnit:c}}function kae(t,e,r,n){let i=t==="since"?-1:1,o=Au(r),s=u1(t,Tm(n),"time",[],"nanosecond","second"),a=R(e,ut),d=R(o,ut),{hours:u,minutes:c,seconds:l,milliseconds:m,microseconds:p,nanoseconds:g}=oN(a,d,s.roundingIncrement,s.smallestUnit,s.largestUnit,s.roundingMode);return new(xe("%Temporal.Duration%"))(0,0,0,0,i*u,i*c,i*l,i*m,i*p,i*g)}function Rae(t,e,r,n){let i=t==="since"?-1:1,o=Fr(r),s=R(e,oe);ST(s,R(o,oe),"compute difference between dates");let a=Tm(n),d=u1(t,a,"date",[],"day","day");a.largestUnit=d.largestUnit;let{years:u,months:c,weeks:l,days:m}=vm(s,e,o,a);return d.smallestUnit==="day"&&d.roundingIncrement===1||({years:u,months:c,weeks:l,days:m}=_h(u,c,l,m,0,0,0,0,0,0,d.roundingIncrement,d.smallestUnit,d.roundingMode,e)),new(xe("%Temporal.Duration%"))(i*u,i*c,i*l,i*m,0,0,0,0,0,0)}function Dae(t,e,r,n){let i=t==="since"?-1:1,o=ug(r),s=R(e,oe);ST(s,R(o,oe),"compute difference between dates");let a=Tm(n),d=u1(t,a,"datetime",[],"nanosecond","day"),{years:u,months:c,weeks:l,days:m,hours:p,minutes:g,seconds:v,milliseconds:E,microseconds:A,nanoseconds:P}=sN(R(e,Ie),R(e,Re),R(e,$e),R(e,_t),R(e,xt),R(e,Et),R(e,St),R(e,At),R(e,Tt),R(o,Ie),R(o,Re),R(o,$e),R(o,_t),R(o,xt),R(o,Et),R(o,St),R(o,At),R(o,Tt),s,d.largestUnit,a),I=t1(e);return{years:u,months:c,weeks:l,days:m,hours:p,minutes:g,seconds:v,milliseconds:E,microseconds:A,nanoseconds:P}=_h(u,c,l,m,p,g,v,E,A,P,d.roundingIncrement,d.smallestUnit,d.roundingMode,I),{days:m,hours:p,minutes:g,seconds:v,milliseconds:E,microseconds:A,nanoseconds:P}=wd(m,p,g,v,E,A,P,d.largestUnit),new(xe("%Temporal.Duration%"))(i*u,i*c,i*l,i*m,i*p,i*g,i*v,i*E,i*A,i*P)}function Bae(t,e,r,n){let i=t==="since"?-1:1,o=yh(r),s=u1(t,Tm(n),"time",[],"nanosecond","hour"),{hours:a,minutes:d,seconds:u,milliseconds:c,microseconds:l,nanoseconds:m}=Tce(R(e,_t),R(e,xt),R(e,Et),R(e,St),R(e,At),R(e,Tt),R(o,_t),R(o,xt),R(o,Et),R(o,St),R(o,At),R(o,Tt));return{hours:a,minutes:d,seconds:u,milliseconds:c,microseconds:l,nanoseconds:m}=_h(0,0,0,0,a,d,u,c,l,m,s.roundingIncrement,s.smallestUnit,s.roundingMode),{hours:a,minutes:d,seconds:u,milliseconds:c,microseconds:l,nanoseconds:m}=wd(0,a,d,u,c,l,m,s.largestUnit),new(xe("%Temporal.Duration%"))(0,0,0,0,i*a,i*d,i*u,i*c,i*l,i*m)}function Mae(t,e,r,n){let i=t==="since"?-1:1,o=hE(r),s=R(e,oe);ST(s,R(o,oe),"compute difference between months");let a=Tm(n),d=u1(t,a,"date",["week","day"],"month","year");a.largestUnit=d.largestUnit;let u=Qn(s,["monthCode","year"]),c=Ot(e,u,[]);c.day=1;let l=wh(s,c),m=Ot(o,u,[]);m.day=1;let p=wh(s,m),{years:g,months:v}=vm(s,l,p,a);return d.smallestUnit==="month"&&d.roundingIncrement===1||({years:g,months:v}=_h(g,v,0,0,0,0,0,0,0,0,d.roundingIncrement,d.smallestUnit,d.roundingMode,l)),new(xe("%Temporal.Duration%"))(i*g,i*v,0,0,0,0,0,0,0,0)}function Cae(t,e,r,n){let i=t==="since"?-1:1,o=pE(r),s=R(e,oe);ST(s,R(o,oe),"compute difference between dates");let a=Tm(n),d=u1(t,a,"datetime",[],"nanosecond","hour");a.largestUnit=d.largestUnit;let u=R(e,ut),c=R(o,ut),l,m,p,g,v,E,A,P,I,$;if(d.largestUnit!=="year"&&d.largestUnit!=="month"&&d.largestUnit!=="week"&&d.largestUnit!=="day")l=0,m=0,p=0,g=0,{hours:v,minutes:E,seconds:A,milliseconds:P,microseconds:I,nanoseconds:$}=oN(u,c,d.roundingIncrement,d.smallestUnit,d.largestUnit,d.roundingMode);else{let N=R(e,Lr);if(!pce(N,R(o,Lr)))throw new RangeError("When calculating difference between time zones, largestUnit must be 'hours' or smaller because day lengths can vary between time zones due to DST or time zone offset changes.");({years:l,months:m,weeks:p,days:g,hours:v,minutes:E,seconds:A,milliseconds:P,microseconds:I,nanoseconds:$}=Ice(u,c,N,s,d.largestUnit,a)),{years:l,months:m,weeks:p,days:g,hours:v,minutes:E,seconds:A,milliseconds:P,microseconds:I,nanoseconds:$}=_h(l,m,p,g,v,E,A,P,I,$,d.roundingIncrement,d.smallestUnit,d.roundingMode,e),{years:l,months:m,weeks:p,days:g,hours:v,minutes:E,seconds:A,milliseconds:P,microseconds:I,nanoseconds:$}=Dce(l,m,p,g,v,E,A,P,I,$,d.roundingIncrement,d.smallestUnit,d.roundingMode,e)}return new(xe("%Temporal.Duration%"))(i*l,i*m,i*p,i*g,i*v,i*E,i*A,i*P,i*I,i*$)}function lg(t,e,r,n,i,o,s,a){let d=t,u=e,c=r,l=o,m=s;return d+=n,u+=i,{year:d,month:u}=GA(d,u),{year:d,month:u,day:c}=rT(d,u,c,a),m+=7*l,c+=m,{year:d,month:u,day:c}=IT(d,u,c),{year:d,month:u,day:c}}function Pce(t,e,r,n,i,o,s,a,d,u,c,l){let m=t,p=e,g=r,v=n,E=i,A=o;m+=s,p+=a,g+=d,v+=u,E+=c,A+=l;let P=0;return{deltaDays:P,hour:m,minute:p,second:g,millisecond:v,microsecond:E,nanosecond:A}=mh(m,p,g,v,E,A),{deltaDays:P,hour:m,minute:p,second:g,millisecond:v,microsecond:E,nanosecond:A}}function kce(t,e,r,n,i,o,s,a,d,u,c,l,m,p,g,v,E,A,P,I,$){let N=mg(g$(t,e,r,n,i,o,s,a,d,u),g$(c,l,m,p,g,v,E,A,P,I)),K,F,U,W,L,T,S,k,f,y;if($)if(Gt($)){let w=xe("%Temporal.Duration%"),_=R($,oe),x=new w(t,e,r,n,0,0,0,0,0,0),b=new w(c,l,m,p,0,0,0,0,0,0),B=typeof _!="string"?Dr(_,"dateAdd"):void 0,q=to(_,$,x,void 0,B),M=to(_,q,b,void 0,B),j=mg("day",N),J=Po(null);J.largestUnit=j,{years:K,months:F,weeks:U,days:W}=vm(_,$,M,J),{days:W,hours:L,minutes:T,seconds:S,milliseconds:k,microseconds:f,nanoseconds:y}=wd(W,z.default.add(z.default.BigInt(i),z.default.BigInt(g)),z.default.add(z.default.BigInt(o),z.default.BigInt(v)),z.default.add(z.default.BigInt(s),z.default.BigInt(E)),z.default.add(z.default.BigInt(a),z.default.BigInt(A)),z.default.add(z.default.BigInt(d),z.default.BigInt(P)),z.default.add(z.default.BigInt(u),z.default.BigInt(I)),N)}else{let w=xe("%Temporal.Instant%"),_=R($,Lr),x=R($,oe),b=Ec(R($,To),_,x,t,e,r,n,i,o,s,a,d,u),B=Ec(new w(b),_,x,c,l,m,p,g,v,E,A,P,I);N!=="year"&&N!=="month"&&N!=="week"&&N!=="day"?(K=0,F=0,U=0,W=0,{hours:L,minutes:T,seconds:S,milliseconds:k,microseconds:f,nanoseconds:y}=oN(R($,ut),B,1,"nanosecond",N,"halfExpand")):{years:K,months:F,weeks:U,days:W,hours:L,minutes:T,seconds:S,milliseconds:k,microseconds:f,nanoseconds:y}=Ice(R($,ut),B,_,x,N,Po(null))}else{if(N==="year"||N==="month"||N==="week")throw new RangeError("relativeTo is required for years, months, or weeks arithmetic");K=F=U=0,{days:W,hours:L,minutes:T,seconds:S,milliseconds:k,microseconds:f,nanoseconds:y}=wd(n+p,z.default.add(z.default.BigInt(i),z.default.BigInt(g)),z.default.add(z.default.BigInt(o),z.default.BigInt(v)),z.default.add(z.default.BigInt(s),z.default.BigInt(E)),z.default.add(z.default.BigInt(a),z.default.BigInt(A)),z.default.add(z.default.BigInt(d),z.default.BigInt(P)),z.default.add(z.default.BigInt(u),z.default.BigInt(I)),N)}return cT(K,F,U,W,L,T,S,k,f,y),{years:K,months:F,weeks:U,days:W,hours:L,minutes:T,seconds:S,milliseconds:k,microseconds:f,nanoseconds:y}}function _$(t,e,r,n,i,o,s){let a=Mn;a=z.default.add(a,z.default.BigInt(s)),a=z.default.add(a,z.default.multiply(z.default.BigInt(o),Ar)),a=z.default.add(a,z.default.multiply(z.default.BigInt(i),xc)),a=z.default.add(a,z.default.multiply(z.default.BigInt(n),Ul)),a=z.default.add(a,z.default.multiply(z.default.BigInt(r),z.default.BigInt(6e10))),a=z.default.add(a,z.default.multiply(z.default.BigInt(e),z.default.BigInt(36e11)));let d=z.default.add(t,a);return cg(d),d}function x$(t,e,r,n,i,o,s,a,d,u,c,l,m,p,g,v,E,A,P,I,$){let N=p,{deltaDays:K,hour:F,minute:U,second:W,millisecond:L,microsecond:T,nanosecond:S}=Pce(n,i,o,s,a,d,g,v,E,A,P,I);N+=K;let k=xe("%Temporal.Duration%"),f=to(u,Sc(t,e,r,u),new k(c,l,m,N,0,0,0,0,0,0),$);return{year:R(f,Ie),month:R(f,Re),day:R(f,$e),hour:F,minute:U,second:W,millisecond:L,microsecond:T,nanosecond:S}}function Ec(t,e,r,n,i,o,s,a,d,u,c,l,m,p){let g=xe("%Temporal.Duration%");if(ql(n,i,o,s,0,0,0,0,0,0)===0)return _$(R(t,ut),a,d,u,c,l,m);let v=Oa(e,t,r),E=to(r,Sc(R(v,Ie),R(v,Re),R(v,$e),r),new g(n,i,o,s,0,0,0,0,0,0),p),A=oa(R(E,Ie),R(E,Re),R(E,$e),R(v,_t),R(v,xt),R(v,Et),R(v,St),R(v,At),R(v,Tt),r);return _$(R(ns(e,A,"compatible"),ut),a,d,u,c,l,m)}function Oae(t,e,r,n){let i=t==="subtract"?-1:1,{years:o,months:s,weeks:a,days:d,hours:u,minutes:c,seconds:l,milliseconds:m,microseconds:p,nanoseconds:g}=wg(r),v=HA(er(n));return{years:o,months:s,weeks:a,days:d,hours:u,minutes:c,seconds:l,milliseconds:m,microseconds:p,nanoseconds:g}=kce(R(e,Go),R(e,Li),R(e,js),R(e,Jo),R(e,Yo),R(e,Zo),R(e,Xo),R(e,Qo),R(e,es),R(e,ts),i*o,i*s,i*a,i*d,i*u,i*c,i*l,i*m,i*p,i*g,v),new(xe("%Temporal.Duration%"))(o,s,a,d,u,c,l,m,p,g)}function $ae(t,e,r){let n=t==="subtract"?-1:1,{hours:i,minutes:o,seconds:s,milliseconds:a,microseconds:d,nanoseconds:u}=function(m,p){let g=wg(m);for(let v of p)if(g[v]!==0)throw new RangeError(`Duration field ${v} not supported by Temporal.Instant. Try Temporal.ZonedDateTime instead.`);return g}(r,["years","months","weeks","days"]),c=_$(R(e,ut),n*i,n*o,n*s,n*a,n*d,n*u);return new(xe("%Temporal.Instant%"))(c)}function Nae(t,e,r,n){let i=t==="subtract"?-1:1,{years:o,months:s,weeks:a,days:d,hours:u,minutes:c,seconds:l,milliseconds:m,microseconds:p,nanoseconds:g}=wg(r),v=er(n),E=R(e,oe),{year:A,month:P,day:I,hour:$,minute:N,second:K,millisecond:F,microsecond:U,nanosecond:W}=x$(R(e,Ie),R(e,Re),R(e,$e),R(e,_t),R(e,xt),R(e,Et),R(e,St),R(e,At),R(e,Tt),E,i*o,i*s,i*a,i*d,i*u,i*c,i*l,i*m,i*p,i*g,v);return oa(A,P,I,$,N,K,F,U,W,E)}function jae(t,e,r){let n=t==="subtract"?-1:1,{hours:i,minutes:o,seconds:s,milliseconds:a,microseconds:d,nanoseconds:u}=wg(r),{hour:c,minute:l,second:m,millisecond:p,microsecond:g,nanosecond:v}=Pce(R(e,_t),R(e,xt),R(e,Et),R(e,St),R(e,At),R(e,Tt),n*i,n*o,n*s,n*a,n*d,n*u);return{hour:c,minute:l,second:m,millisecond:p,microsecond:g,nanosecond:v}=mT(c,l,m,p,g,v,"reject"),new(xe("%Temporal.PlainTime%"))(c,l,m,p,g,v)}function Uae(t,e,r,n){let i=wg(r);t==="subtract"&&(i={years:-i.years,months:-i.months,weeks:-i.weeks,days:-i.days,hours:-i.hours,minutes:-i.minutes,seconds:-i.seconds,milliseconds:-i.milliseconds,microseconds:-i.microseconds,nanoseconds:-i.nanoseconds});let{years:o,months:s,weeks:a,days:d,hours:u,minutes:c,seconds:l,milliseconds:m,microseconds:p,nanoseconds:g}=i;({days:d}=wd(d,u,c,l,m,p,g,"day"));let v=er(n),E=R(e,oe),A=Qn(E,["monthCode","year"]),P=Ot(e,A,[]),I=Po(null);zw(I,P,[]),P.day=1;let $=wh(E,P),N=ql(o,s,a,d,0,0,0,0,0,0),K=Dr(E,"dateAdd"),F=xe("%Temporal.Duration%");if(N<0){let L=to(E,$,new F(0,1,0,0,0,0,0,0,0,0),void 0,K),T=to(E,L,new F(0,0,0,-1,0,0,0,0,0,0),void 0,K);I.day=jE(E,T),$=wh(E,I)}let U=new F(o,s,a,d,0,0,0,0,0,0),W=Tm(v);return gg(E,Ot(to(E,$,U,v,K),A,[]),W)}function qae(t,e,r,n){let i=t==="subtract"?-1:1,{years:o,months:s,weeks:a,days:d,hours:u,minutes:c,seconds:l,milliseconds:m,microseconds:p,nanoseconds:g}=wg(r),v=er(n),E=R(e,Lr),A=R(e,oe);return eo(Ec(R(e,To),E,A,i*o,i*s,i*a,i*d,i*u,i*c,i*l,i*m,i*p,i*g,v),E,A)}function Ca(t,e,r){if(z.default.equal(e,o1))return t;let{quotient:n,remainder:i}=Vn(t,e);if(z.default.equal(i,Mn))return t;let o=z.default.lessThan(i,Mn)?-1:1,s=Su(z.default.multiply(i,z.default.BigInt(2))),a=z.default.equal(s,e),d=z.default.greaterThan(s,e);switch(r){case"ceil":o>0&&(n=z.default.add(n,z.default.BigInt(o)));break;case"floor":o<0&&(n=z.default.add(n,z.default.BigInt(o)));break;case"expand":n=z.default.add(n,z.default.BigInt(o));break;case"trunc":break;case"halfCeil":(d||a&&o>0)&&(n=z.default.add(n,z.default.BigInt(o)));break;case"halfFloor":(d||a&&o<0)&&(n=z.default.add(n,z.default.BigInt(o)));break;case"halfExpand":(d||a)&&(n=z.default.add(n,z.default.BigInt(o)));break;case"halfTrunc":d&&(n=z.default.add(n,z.default.BigInt(o)));break;case"halfEven":(d||a&&z.default.toNumber(z.default.remainder(Su(n),z.default.BigInt(2)))===1)&&(n=z.default.add(n,z.default.BigInt(o)))}return z.default.multiply(n,e)}function dT(t,e,r,n){let{remainder:i}=ag(t,Ll),o=z.default.subtract(t,i),s=Ca(i,z.default.BigInt(Cce[r]*e),n);return z.default.add(o,s)}function aN(t,e,r,n,i,o,s,a,d,u,c,l,m=864e11){let{deltaDays:p,hour:g,minute:v,second:E,millisecond:A,microsecond:P,nanosecond:I}=cN(n,i,o,s,a,d,u,c,l,m),{year:$,month:N,day:K}=IT(t,e,r+p);return{year:$,month:N,day:K,hour:g,minute:v,second:E,millisecond:A,microsecond:P,nanosecond:I}}function cN(t,e,r,n,i,o,s,a,d,u=864e11){let c=Mn;switch(a){case"day":case"hour":c=z.default.BigInt(t);case"minute":c=z.default.add(z.default.multiply(c,jl),z.default.BigInt(e));case"second":c=z.default.add(z.default.multiply(c,jl),z.default.BigInt(r));case"millisecond":c=z.default.add(z.default.multiply(c,Ar),z.default.BigInt(n));case"microsecond":c=z.default.add(z.default.multiply(c,Ar),z.default.BigInt(i));case"nanosecond":c=z.default.add(z.default.multiply(c,Ar),z.default.BigInt(o))}let l=a==="day"?u:Cce[a],m=Ca(c,z.default.BigInt(l*s),d),p=z.default.toNumber(z.default.divide(m,z.default.BigInt(l)));switch(a){case"day":return{deltaDays:p,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0};case"hour":return mh(p,0,0,0,0,0);case"minute":return mh(t,p,0,0,0,0);case"second":return mh(t,e,p,0,0,0);case"millisecond":return mh(t,e,r,p,0,0);case"microsecond":return mh(t,e,r,n,p,0);case"nanosecond":return mh(t,e,r,n,i,p);default:throw new Error(`Invalid unit ${a}`)}}function JA(t,e){return iN(R(t,Ie),R(t,Re),R(t,$e),R(e,Ie),R(e,Re),R(e,$e),"day").days}function Ao(t,e,r,n){let i=to(t,e,r,void 0,n);return{relativeTo:i,days:JA(e,i)}}function Rce(t,e,r,n,i){let o=R(t,Lr),s=R(t,oe);return eo(Ec(R(t,To),o,s,e,r,n,i,0,0,0,0,0,0),o,s)}function Dce(t,e,r,n,i,o,s,a,d,u,c,l,m,p){let g=t,v=e,E=r,A=n,P=i,I=o,$=s,N=a,K=d,F=u;if(!Ke(p)||l==="year"||l==="month"||l==="week"||l==="day"||l==="nanosecond"&&c===1)return{years:g,months:v,weeks:E,days:A,hours:P,minutes:I,seconds:$,milliseconds:N,microseconds:K,nanoseconds:F};let U=r1(0,P,I,$,N,K,F,0),W=Yw(z.default.toNumber(U)),L=R(p,Lr),T=R(p,oe),S=Ec(R(p,To),L,T,g,v,E,A,0,0,0,0,0,0),k=Ec(new(xe("%Temporal.Instant%"))(S),L,T,0,0,0,W,0,0,0,0,0,0),f=z.default.subtract(k,S);return z.default.greaterThanOrEqual(z.default.multiply(z.default.subtract(U,f),z.default.BigInt(W)),Mn)&&({years:g,months:v,weeks:E,days:A}=kce(g,v,E,A,0,0,0,0,0,0,0,0,0,W,0,0,0,0,0,0,p),U=dT(z.default.subtract(U,f),c,l,m),{hours:P,minutes:I,seconds:$,milliseconds:N,microseconds:K,nanoseconds:F}=wd(0,0,0,0,0,0,z.default.toNumber(U),"hour")),{years:g,months:v,weeks:E,days:A,hours:P,minutes:I,seconds:$,milliseconds:N,microseconds:K,nanoseconds:F}}function _h(t,e,r,n,i,o,s,a,d,u,c,l,m,p){let g=t,v=e,E=r,A=n,P=i,I=o,$=s,N=a,K=d,F=z.default.BigInt(u),U=xe("%Temporal.Duration%"),W,L,T,S,k=p;if(k){if(Ke(k))L=k,k=Fr(k);else if(!Gt(k))throw new TypeError("starting point must be PlainDate or ZonedDateTime");W=R(k,oe)}if(l==="year"||l==="month"||l==="week"||l==="day"){let f,y,w;F=r1(0,P,I,$,N,K,u,0),L&&(f=Rce(L,g,v,E,A)),{days:y,nanoseconds:F,dayLengthNs:w}=rN(F,f),T=z.default.BigInt(w),A+=y,P=I=$=N=K=0}switch(l){case"year":{if(!W)throw new RangeError("A starting point is required for years rounding");let f=new U(g),y=typeof W!="string"?Dr(W,"dateAdd"):void 0,w=to(W,k,f,void 0,y),_=to(W,k,new U(g,v,E),void 0,y);k=w,A+=JA(w,_);let x=to(W,k,new U(0,0,0,A),void 0,y),b=Po(null);b.largestUnit="year";let B=vm(W,k,x,b).years;g+=B;let q=k;k=to(W,k,new U(B),void 0,y),A-=JA(q,k);let M=new U(A<0?-1:1),{days:j}=Ao(W,k,M,y);j=dn(j);let J=z.default.multiply(z.default.BigInt(j),T);F=z.default.add(z.default.add(z.default.multiply(J,z.default.BigInt(g)),z.default.multiply(z.default.BigInt(A),T)),F);let Z=Ca(F,z.default.multiply(J,z.default.BigInt(c)),m);S=$l(F,J),g=z.default.toNumber(z.default.divide(Z,J)),F=Mn,v=E=A=0;break}case"month":{if(!W)throw new RangeError("A starting point is required for months rounding");let f=new U(g,v),y=typeof W!="string"?Dr(W,"dateAdd"):void 0,w=to(W,k,f,void 0,y),_=to(W,k,new U(g,v,E),void 0,y);k=w,A+=JA(w,_);let x=Yw(A),b=new U(0,A<0?-1:1),B;for({relativeTo:k,days:B}=Ao(W,k,b,y);dn(A)>=dn(B);)v+=x,A-=B,{relativeTo:k,days:B}=Ao(W,k,b,y);B=dn(B);let q=z.default.multiply(z.default.BigInt(B),T);F=z.default.add(z.default.add(z.default.multiply(q,z.default.BigInt(v)),z.default.multiply(z.default.BigInt(A),T)),F);let M=Ca(F,z.default.multiply(q,z.default.BigInt(c)),m);S=$l(F,q),v=z.default.toNumber(z.default.divide(M,q)),F=Mn,E=A=0;break}case"week":{if(!W)throw new RangeError("A starting point is required for weeks rounding");let f=Yw(A),y=new U(0,0,A<0?-1:1),w=typeof W!="string"?Dr(W,"dateAdd"):void 0,_;for({relativeTo:k,days:_}=Ao(W,k,y,w);dn(A)>=dn(_);)E+=f,A-=_,{relativeTo:k,days:_}=Ao(W,k,y,w);_=dn(_);let x=z.default.multiply(z.default.BigInt(_),T);F=z.default.add(z.default.add(z.default.multiply(x,z.default.BigInt(E)),z.default.multiply(z.default.BigInt(A),T)),F);let b=Ca(F,z.default.multiply(x,z.default.BigInt(c)),m);S=$l(F,x),E=z.default.toNumber(z.default.divide(b,x)),F=Mn,A=0;break}case"day":{let f=T;F=z.default.add(z.default.multiply(f,z.default.BigInt(A)),F);let y=Ca(F,z.default.multiply(f,z.default.BigInt(c)),m);S=$l(F,f),A=z.default.toNumber(z.default.divide(y,f)),F=Mn;break}case"hour":{let y=z.default.multiply(z.default.BigInt(P),z.default.BigInt(36e11));y=z.default.add(y,z.default.multiply(z.default.BigInt(I),z.default.BigInt(6e10))),y=z.default.add(y,z.default.multiply(z.default.BigInt($),Ul)),y=z.default.add(y,z.default.multiply(z.default.BigInt(N),xc)),y=z.default.add(y,z.default.multiply(z.default.BigInt(K),Ar)),y=z.default.add(y,F),S=$l(y,z.default.BigInt(36e11));let w=Ca(y,z.default.BigInt(36e11*c),m);P=z.default.toNumber(z.default.divide(w,z.default.BigInt(36e11))),F=Mn,I=$=N=K=0;break}case"minute":{let y=z.default.multiply(z.default.BigInt(I),z.default.BigInt(6e10));y=z.default.add(y,z.default.multiply(z.default.BigInt($),Ul)),y=z.default.add(y,z.default.multiply(z.default.BigInt(N),xc)),y=z.default.add(y,z.default.multiply(z.default.BigInt(K),Ar)),y=z.default.add(y,F),S=$l(y,z.default.BigInt(6e10));let w=Ca(y,z.default.BigInt(6e10*c),m);I=z.default.toNumber(z.default.divide(w,z.default.BigInt(6e10))),F=Mn,$=N=K=0;break}case"second":{let y=z.default.multiply(z.default.BigInt($),Ul);y=z.default.add(y,z.default.multiply(z.default.BigInt(N),xc)),y=z.default.add(y,z.default.multiply(z.default.BigInt(K),Ar)),y=z.default.add(y,F),S=$l(y,z.default.BigInt(1e9));let w=Ca(y,z.default.BigInt(1e9*c),m);$=z.default.toNumber(z.default.divide(w,z.default.BigInt(1e9))),F=Mn,N=K=0;break}case"millisecond":{let y=z.default.multiply(z.default.BigInt(N),xc);y=z.default.add(y,z.default.multiply(z.default.BigInt(K),Ar)),y=z.default.add(y,F),S=$l(y,z.default.BigInt(1e6));let w=Ca(y,z.default.BigInt(1e6*c),m);N=z.default.toNumber(z.default.divide(w,z.default.BigInt(1e6))),F=Mn,K=0;break}case"microsecond":{let y=z.default.multiply(z.default.BigInt(K),Ar);y=z.default.add(y,F),S=$l(y,z.default.BigInt(1e3));let w=Ca(y,z.default.BigInt(1e3*c),m);K=z.default.toNumber(z.default.divide(w,z.default.BigInt(1e3))),F=Mn;break}case"nanosecond":S=z.default.toNumber(F),F=Ca(z.default.BigInt(F),z.default.BigInt(c),m)}return{years:g,months:v,weeks:E,days:A,hours:P,minutes:I,seconds:$,milliseconds:N,microseconds:K,nanoseconds:z.default.toNumber(F),total:S}}function gm(t,e,r,n,i,o){for(let[s,a]of[[t,n],[e,i],[r,o]])if(s!==a)return fg(s-a);return 0}function ag(t,e){let{quotient:r,remainder:n}=Vn(t,e);return z.default.lessThan(n,Mn)&&(r=z.default.subtract(r,o1),n=z.default.add(n,e)),{quotient:r,remainder:n}}function Vw(t,e){let{quotient:r,remainder:n}=Vn(t,e);return _c(n)||!eT(t)==!eT(e)?r:z.default.subtract(r,o1)}function $l(t,e){let{quotient:r,remainder:n}=Vn(t,e);return z.default.toNumber(r)+z.default.toNumber(n)/z.default.toNumber(e)}function uT(t){let e=mE(t);return globalThis.BigInt!==void 0?globalThis.BigInt(e.toString(10)):e}function mE(t){let e=t;if(typeof t=="object"){let r=t[Symbol.toPrimitive];r&&typeof r=="function"&&(e=pT(r,t,["number"]))}if(typeof e=="number")throw new TypeError("cannot convert number to bigint");return typeof e=="bigint"?z.default.BigInt(e.toString(10)):z.default.BigInt(e)}var dN=(()=>{let t=z.default.BigInt(Date.now()%1e6);return()=>{let e=z.default.BigInt(Date.now()),r=z.default.add(z.default.multiply(e,xc),t);return t=z.default.remainder(e,xc),z.default.greaterThan(r,Zw)?Zw:z.default.lessThan(r,gE)?gE:r}})();function ym(){return new ece().resolvedOptions().timeZone}function fg(t){return t<0?-1:t>0?1:t}function er(t){if(t===void 0)return Po(null);if(un(t)&&t!==null)return t;throw new TypeError("Options parameter must be an object, not "+(t===null?"null":typeof t))}function n1(t,e){let r=Po(null);return r[t]=e,r}function Tm(t){let e=Po(null);return zw(e,er(t),[]),e}function xm(t,e,r,n){let i=t[e];if(i!==void 0){if(i=is(i),!r.includes(i))throw new RangeError(`${e} must be one of ${r.join(", ")}, not ${i}`);return i}return n}function xh(t){return eNe.includes(Fl(t))}function Fl(t){return t.replace(/[A-Z]/g,e=>{let r=e.charCodeAt(0);return String.fromCharCode(r+32)})}var Bce=new RegExp(`^${Zae.source}$`);function Mce(t,e,r,n=t(e),i=t(r)){let o=z.default.BigInt(e),s=z.default.BigInt(r),a=n,d=i;for(;z.default.greaterThan(z.default.subtract(s,o),o1);){let u=z.default.divide(z.default.add(o,s),z.default.BigInt(2)),c=t(u);if(c===a)o=u,a=c;else{if(c!==d)throw new Error(`invalid state in bisection ${a} - ${c} - ${d}`);s=u,d=c}}return s}var Cce={hour:36e11,minute:6e10,second:1e9,millisecond:1e6,microsecond:1e3,nanosecond:1},Oce=Symbol("date"),$ce=Symbol("ym"),Nce=Symbol("md"),jce=Symbol("time"),Uce=Symbol("datetime"),qce=Symbol("instant"),Hw=Symbol("original"),Lw=Symbol("timezone"),bd=Symbol("calendar-id"),Lce=Symbol("locale"),E$=Symbol("options"),yE=t=>({value:t,enumerable:!0,writable:!1,configurable:!0}),Gw=globalThis.Intl.DateTimeFormat,Eh=Object.assign,oNe=Object.prototype.hasOwnProperty,sNe=Reflect.apply;function qw(t,e){let r=t[e];return typeof r=="function"&&(r=new Gw(t[Lce],r(t[E$])),t[e]=r),r}function vg(t,e={}){if(!(this instanceof vg))return new vg(t,e);let r=e!==void 0,n=r?Eh({},e):{},i=new Gw(t,n),o=i.resolvedOptions();if(r){let s=Eh({},o);for(let a in s)sNe(oNe,n,[a])||delete s[a];this[E$]=s}else this[E$]=n;this[Lce]=o.locale,this[Hw]=i,this[Lw]=o.timeZone,this[bd]=o.calendar,this[Oce]=uNe,this[$ce]=cNe,this[Nce]=dNe,this[jce]=aNe,this[Uce]=lNe,this[qce]=fNe}Object.defineProperty(vg,"name",{writable:!0,value:"DateTimeFormat"}),vg.supportedLocalesOf=function(t,e){return Gw.supportedLocalesOf(t,e)};var d$={resolvedOptions:yE(function(){return this[Hw].resolvedOptions()}),format:yE(function(e,...r){let{instant:n,formatter:i}=Jw(e,this);return n&&i?i.format(n.epochMilliseconds):this[Hw].format(e,...r)}),formatRange:yE(function(e,r){if(i1(e)||i1(r)){if(!Kce(e,r))throw new TypeError("Intl.DateTimeFormat.formatRange accepts two values of the same type");let{instant:n,formatter:i}=Jw(e,this),{instant:o,formatter:s}=Jw(r,this);if(n&&o&&i&&s&&i===s)return i.formatRange(n.epochMilliseconds,o.epochMilliseconds)}return this[Hw].formatRange(e,r)})};"formatToParts"in Gw.prototype&&(d$.formatToParts=yE(function(e,...r){let{instant:n,formatter:i}=Jw(e,this);return n&&i?i.formatToParts(n.epochMilliseconds):this[Hw].formatToParts(e,...r)})),"formatRangeToParts"in Gw.prototype&&(d$.formatRangeToParts=yE(function(e,r){if(i1(e)||i1(r)){if(!Kce(e,r))throw new TypeError("Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type");let{instant:n,formatter:i}=Jw(e,this),{instant:o,formatter:s}=Jw(r,this);if(n&&o&&i&&s&&i===s)return i.formatRangeToParts(n.epochMilliseconds,o.epochMilliseconds)}return this[Hw].formatRangeToParts(e,r)})),vg.prototype=Object.create(Gw.prototype,d$),Object.defineProperty(vg,"prototype",{writable:!1,enumerable:!1,configurable:!1});var Sh=vg;function LE(t={},e={}){let r=Eh({},t);for(let n of["year","month","day","hour","minute","second","weekday","dayPeriod","timeZoneName","dateStyle","timeStyle"])r[n]=n in e?e[n]:r[n],r[n]!==!1&&r[n]!==void 0||delete r[n];return r}function aNe(t){let e=LE(t,{year:!1,month:!1,day:!1,weekday:!1,timeZoneName:!1,dateStyle:!1});return lN(e)||(e=Eh({},e,{hour:"numeric",minute:"numeric",second:"numeric"})),e}function cNe(t){let e=LE(t,{day:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,dateStyle:!1,timeStyle:!1});return"year"in e||"month"in e||(e=Eh(e,{year:"numeric",month:"numeric"})),e}function dNe(t){let e=LE(t,{year:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,dateStyle:!1,timeStyle:!1});return"month"in e||"day"in e||(e=Eh({},e,{month:"numeric",day:"numeric"})),e}function uNe(t){let e=LE(t,{hour:!1,minute:!1,second:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});return uN(e)||(e=Eh({},e,{year:"numeric",month:"numeric",day:"numeric"})),e}function lNe(t){let e=LE(t,{timeZoneName:!1});return lN(e)||uN(e)||(e=Eh({},e,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),e}function fNe(t){let e=t;return lN(e)||uN(e)||(e=Eh({},e,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),e}function uN(t){return"year"in t||"month"in t||"day"in t||"weekday"in t||"dateStyle"in t}function lN(t){return"hour"in t||"minute"in t||"second"in t||"timeStyle"in t||"dayPeriod"in t}function i1(t){return Gt(t)||Bn(t)||wt(t)||Ke(t)||Sr(t)||Ti(t)||mi(t)}function Kce(t,e){return!(!i1(t)||!i1(e))&&!(Bn(t)&&!Bn(e))&&!(Gt(t)&&!Gt(e))&&!(wt(t)&&!wt(e))&&!(Ke(t)&&!Ke(e))&&!(Sr(t)&&!Sr(e))&&!(Ti(t)&&!Ti(e))&&!(mi(t)&&!mi(e))}function Jw(t,e){let r=xe("%Temporal.PlainDateTime%");if(Bn(t)){let n=new r(1970,1,1,R(t,_t),R(t,xt),R(t,Et),R(t,St),R(t,At),R(t,Tt),e[bd]);return{instant:ns(e[Lw],n,"compatible"),formatter:qw(e,jce)}}if(Sr(t)){let n=R(t,Ie),i=R(t,Re),o=R(t,$e),s=no(R(t,oe));if(s!==e[bd])throw new RangeError(`cannot format PlainYearMonth with calendar ${s} in locale with calendar ${e[bd]}`);let a=new r(n,i,o,12,0,0,0,0,0,s);return{instant:ns(e[Lw],a,"compatible"),formatter:qw(e,$ce)}}if(Ti(t)){let n=R(t,Ie),i=R(t,Re),o=R(t,$e),s=no(R(t,oe));if(s!==e[bd])throw new RangeError(`cannot format PlainMonthDay with calendar ${s} in locale with calendar ${e[bd]}`);let a=new r(n,i,o,12,0,0,0,0,0,s);return{instant:ns(e[Lw],a,"compatible"),formatter:qw(e,Nce)}}if(Gt(t)){let n=R(t,Ie),i=R(t,Re),o=R(t,$e),s=no(R(t,oe));if(s!=="iso8601"&&s!==e[bd])throw new RangeError(`cannot format PlainDate with calendar ${s} in locale with calendar ${e[bd]}`);let a=new r(n,i,o,12,0,0,0,0,0,e[bd]);return{instant:ns(e[Lw],a,"compatible"),formatter:qw(e,Oce)}}if(wt(t)){let n=R(t,Ie),i=R(t,Re),o=R(t,$e),s=R(t,_t),a=R(t,xt),d=R(t,Et),u=R(t,St),c=R(t,At),l=R(t,Tt),m=no(R(t,oe));if(m!=="iso8601"&&m!==e[bd])throw new RangeError(`cannot format PlainDateTime with calendar ${m} in locale with calendar ${e[bd]}`);let p=t;return m==="iso8601"&&(p=new r(n,i,o,s,a,d,u,c,l,e[bd])),{instant:ns(e[Lw],p,"compatible"),formatter:qw(e,Uce)}}if(Ke(t))throw new TypeError("Temporal.ZonedDateTime not supported in DateTimeFormat methods. Use toLocaleString() instead.");return mi(t)?{instant:t,formatter:qw(e,qce)}:{}}var jwt=Object.freeze({__proto__:null,DateTimeFormat:Sh}),_E=class t{constructor(e){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");let r=mE(e);cg(r),Wl(this),Bt(this,ut,r)}get epochSeconds(){if(!mi(this))throw new TypeError("invalid receiver");let e=R(this,ut);return z.default.toNumber(Vw(e,Ul))}get epochMilliseconds(){if(!mi(this))throw new TypeError("invalid receiver");let e=z.default.BigInt(R(this,ut));return z.default.toNumber(Vw(e,xc))}get epochMicroseconds(){if(!mi(this))throw new TypeError("invalid receiver");return uT(Vw(z.default.BigInt(R(this,ut)),Ar))}get epochNanoseconds(){if(!mi(this))throw new TypeError("invalid receiver");return uT(z.default.BigInt(R(this,ut)))}add(e){if(!mi(this))throw new TypeError("invalid receiver");return $ae("add",this,e)}subtract(e){if(!mi(this))throw new TypeError("invalid receiver");return $ae("subtract",this,e)}until(e,r){if(!mi(this))throw new TypeError("invalid receiver");return kae("until",this,e,r)}since(e,r){if(!mi(this))throw new TypeError("invalid receiver");return kae("since",this,e,r)}round(e){if(!mi(this))throw new TypeError("invalid receiver");if(e===void 0)throw new TypeError("options parameter is required");let r=typeof e=="string"?n1("smallestUnit",e):er(e),n=a1(r),i=Tu(r,"halfExpand"),o=ca(r,"smallestUnit","time",pg);c1(n,{hour:24,minute:1440,second:86400,millisecond:864e5,microsecond:864e8,nanosecond:864e11}[o],!0);let s=dT(R(this,ut),n,o,i);return new t(s)}equals(e){if(!mi(this))throw new TypeError("invalid receiver");let r=Au(e),n=R(this,ut),i=R(r,ut);return z.default.equal(z.default.BigInt(n),z.default.BigInt(i))}toString(e){if(!mi(this))throw new TypeError("invalid receiver");let r=er(e),n=CE(r),i=Tu(r,"trunc"),o=ca(r,"smallestUnit","time",void 0);if(o==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let s=r.timeZone;s!==void 0&&(s=Io(s));let{precision:a,unit:d,increment:u}=OE(o,n),c=dT(R(this,ut),u,d,i);return wae(new t(c),s,a)}toJSON(){if(!mi(this))throw new TypeError("invalid receiver");return wae(this,void 0,"auto")}toLocaleString(e,r){if(!mi(this))throw new TypeError("invalid receiver");return new Sh(e,r).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.Instant")}toZonedDateTime(e){if(!mi(this))throw new TypeError("invalid receiver");if(!un(e))throw new TypeError("invalid argument in toZonedDateTime");let r=e.calendar;if(r===void 0)throw new TypeError("missing calendar property in toZonedDateTime");let n=da(r),i=e.timeZone;if(i===void 0)throw new TypeError("missing timeZone property in toZonedDateTime");let o=Io(i);return eo(R(this,ut),o,n)}toZonedDateTimeISO(e){if(!mi(this))throw new TypeError("invalid receiver");let r=Io(e);return eo(R(this,ut),r,"iso8601")}static fromEpochSeconds(e){let r=Xw(e),n=z.default.multiply(z.default.BigInt(r),Ul);return cg(n),new t(n)}static fromEpochMilliseconds(e){let r=Xw(e),n=z.default.multiply(z.default.BigInt(r),xc);return cg(n),new t(n)}static fromEpochMicroseconds(e){let r=mE(e),n=z.default.multiply(r,Ar);return cg(n),new t(n)}static fromEpochNanoseconds(e){let r=mE(e);return cg(r),new t(r)}static from(e){return mi(e)?new t(R(e,ut)):Au(e)}static compare(e,r){let n=Au(e),i=Au(r),o=R(n,ut),s=R(i,ut);return z.default.lessThan(o,s)?-1:z.default.greaterThan(o,s)?1:0}};zl(_E,"Temporal.Instant");var Fce=Array.prototype.includes,hNe=Array.prototype.push,pNe=globalThis.Intl.DateTimeFormat,mNe=Array.prototype.sort,yNe=Math.abs,gNe=Math.floor,u$=Object.create,S$=Object.entries,zce=Set,Lae=Reflect.ownKeys,So=Set.prototype.add,Wce=Set.prototype.values,gn={},yn=class{constructor(e){if(arguments.length<1)throw new RangeError("missing argument: id is required");let r=is(e);if(!xh(r))throw new RangeError(`invalid calendar identifier ${r}`);Wl(this),Bt(this,Sn,Fl(r))}get id(){if(!Rn(this))throw new TypeError("invalid receiver");return R(this,Sn)}dateFromFields(e,r){if(!Rn(this))throw new TypeError("invalid receiver");if(!un(e))throw new TypeError("invalid fields");let n=er(r),i=R(this,Sn);return gn[i].dateFromFields(e,n,i)}yearMonthFromFields(e,r){if(!Rn(this))throw new TypeError("invalid receiver");if(!un(e))throw new TypeError("invalid fields");let n=er(r),i=R(this,Sn);return gn[i].yearMonthFromFields(e,n,i)}monthDayFromFields(e,r){if(!Rn(this))throw new TypeError("invalid receiver");if(!un(e))throw new TypeError("invalid fields");let n=er(r),i=R(this,Sn);return gn[i].monthDayFromFields(e,n,i)}fields(e){if(!Rn(this))throw new TypeError("invalid receiver");let r=[],n=new Set(["year","month","monthCode","day","hour","minute","second","millisecond","microsecond","nanosecond"]);for(let i of e){if(typeof i!="string")throw new TypeError("invalid fields");if(!n.has(i))throw new RangeError(`invalid field name ${i}`);n.delete(i),hNe.call(r,i)}return gn[R(this,Sn)].fields(r)}mergeFields(e,r){if(!Rn(this))throw new TypeError("invalid receiver");let n=vae(e),i=u$(null);zw(i,n,[],[void 0]);let o=vae(r),s=u$(null);zw(s,o,[],[void 0]);let a=Lae(s),d=gn[R(this,Sn)].fieldKeysToIgnore(a),u=u$(null),c=Lae(i);for(let l of c){let m;m=Je(Fce,d,[l])?s[l]:i[l],m!==void 0&&(u[l]=m)}return zw(u,s,[]),u}dateAdd(e,r,n){if(!Rn(this))throw new TypeError("invalid receiver");let i=Fr(e),o=Ww(r),s=Hn(er(n)),{days:a}=wd(R(o,Jo),R(o,Yo),R(o,Zo),R(o,Xo),R(o,Qo),R(o,es),R(o,ts),"day"),d=R(this,Sn);return gn[d].dateAdd(i,R(o,Go),R(o,Li),R(o,js),a,s,d)}dateUntil(e,r,n){if(!Rn(this))throw new TypeError("invalid receiver");let i=Fr(e),o=Fr(r),s=ca(er(n),"largestUnit","date","auto");s==="auto"&&(s="day");let{years:a,months:d,weeks:u,days:c}=gn[R(this,Sn)].dateUntil(i,o,s);return new(xe("%Temporal.Duration%"))(a,d,u,c,0,0,0,0,0,0)}year(e){let r=e;if(!Rn(this))throw new TypeError("invalid receiver");return Sr(r)||(r=Fr(r)),gn[R(this,Sn)].year(r)}month(e){let r=e;if(!Rn(this))throw new TypeError("invalid receiver");if(Ti(r))throw new TypeError("use monthCode on PlainMonthDay instead");return Sr(r)||(r=Fr(r)),gn[R(this,Sn)].month(r)}monthCode(e){let r=e;if(!Rn(this))throw new TypeError("invalid receiver");return Sr(r)||Ti(r)||(r=Fr(r)),gn[R(this,Sn)].monthCode(r)}day(e){let r=e;if(!Rn(this))throw new TypeError("invalid receiver");return Ti(r)||(r=Fr(r)),gn[R(this,Sn)].day(r)}era(e){let r=e;if(!Rn(this))throw new TypeError("invalid receiver");return Sr(r)||(r=Fr(r)),gn[R(this,Sn)].era(r)}eraYear(e){let r=e;if(!Rn(this))throw new TypeError("invalid receiver");return Sr(r)||(r=Fr(r)),gn[R(this,Sn)].eraYear(r)}dayOfWeek(e){if(!Rn(this))throw new TypeError("invalid receiver");let r=Fr(e);return gn[R(this,Sn)].dayOfWeek(r)}dayOfYear(e){if(!Rn(this))throw new TypeError("invalid receiver");let r=Fr(e);return gn[R(this,Sn)].dayOfYear(r)}weekOfYear(e){if(!Rn(this))throw new TypeError("invalid receiver");let r=Fr(e);return gn[R(this,Sn)].weekOfYear(r)}yearOfWeek(e){if(!Rn(this))throw new TypeError("invalid receiver");let r=Fr(e);return gn[R(this,Sn)].yearOfWeek(r)}daysInWeek(e){if(!Rn(this))throw new TypeError("invalid receiver");let r=Fr(e);return gn[R(this,Sn)].daysInWeek(r)}daysInMonth(e){let r=e;if(!Rn(this))throw new TypeError("invalid receiver");return Sr(r)||(r=Fr(r)),gn[R(this,Sn)].daysInMonth(r)}daysInYear(e){let r=e;if(!Rn(this))throw new TypeError("invalid receiver");return Sr(r)||(r=Fr(r)),gn[R(this,Sn)].daysInYear(r)}monthsInYear(e){let r=e;if(!Rn(this))throw new TypeError("invalid receiver");return Sr(r)||(r=Fr(r)),gn[R(this,Sn)].monthsInYear(r)}inLeapYear(e){let r=e;if(!Rn(this))throw new TypeError("invalid receiver");return Sr(r)||(r=Fr(r)),gn[R(this,Sn)].inLeapYear(r)}toString(){if(!Rn(this))throw new TypeError("invalid receiver");return R(this,Sn)}toJSON(){if(!Rn(this))throw new TypeError("invalid receiver");return R(this,Sn)}static from(e){return d1(da(e))}};function fN(t){if(!t.startsWith("M"))throw new RangeError(`Invalid month code: ${t}. Month codes must start with M.`);let e=+t.slice(1);if(isNaN(e))throw new RangeError(`Invalid month code: ${t}`);return e}function bh(t,e=!1){return`M${t.toString().padStart(2,"0")}${e?"L":""}`}function YA(t,e,r=12){let{month:n,monthCode:i}=t;if(i===void 0){if(n===void 0)throw new TypeError("Either month or monthCode are required");e==="reject"&&ro(n,1,r),e==="constrain"&&(n=sa(n,1,r)),i=bh(n)}else{let o=fN(i);if(n!==void 0&&n!==o)throw new RangeError(`monthCode ${i} and month ${n} must match if both are present`);if(i!==bh(o))throw new RangeError(`Invalid month code: ${i}`);if(n=o,n<1||n>r)throw new RangeError(`Invalid monthCode: ${i}`)}return{...t,month:n,monthCode:i}}zl(yn,"Temporal.Calendar"),An("Temporal.Calendar.from",yn.from),An("Temporal.Calendar.prototype.dateAdd",yn.prototype.dateAdd),An("Temporal.Calendar.prototype.dateFromFields",yn.prototype.dateFromFields),An("Temporal.Calendar.prototype.dateUntil",yn.prototype.dateUntil),An("Temporal.Calendar.prototype.day",yn.prototype.day),An("Temporal.Calendar.prototype.dayOfWeek",yn.prototype.dayOfWeek),An("Temporal.Calendar.prototype.dayOfYear",yn.prototype.dayOfYear),An("Temporal.Calendar.prototype.daysInMonth",yn.prototype.daysInMonth),An("Temporal.Calendar.prototype.daysInWeek",yn.prototype.daysInWeek),An("Temporal.Calendar.prototype.daysInYear",yn.prototype.daysInYear),An("Temporal.Calendar.prototype.era",yn.prototype.era),An("Temporal.Calendar.prototype.eraYear",yn.prototype.eraYear),An("Temporal.Calendar.prototype.fields",yn.prototype.fields),An("Temporal.Calendar.prototype.inLeapYear",yn.prototype.inLeapYear),An("Temporal.Calendar.prototype.mergeFields",yn.prototype.mergeFields),An("Temporal.Calendar.prototype.month",yn.prototype.month),An("Temporal.Calendar.prototype.monthCode",yn.prototype.monthCode),An("Temporal.Calendar.prototype.monthDayFromFields",yn.prototype.monthDayFromFields),An("Temporal.Calendar.prototype.monthsInYear",yn.prototype.monthsInYear),An("Temporal.Calendar.prototype.weekOfYear",yn.prototype.weekOfYear),An("Temporal.Calendar.prototype.year",yn.prototype.year),An("Temporal.Calendar.prototype.yearMonthFromFields",yn.prototype.yearMonthFromFields),An("Temporal.Calendar.prototype.yearOfWeek",yn.prototype.yearOfWeek),gn.iso8601={dateFromFields(t,e,r){let n=Ot(t,["day","month","monthCode","year"],["year","day"]),i=Hn(e);n=YA(n);let{year:o,month:s,day:a}=n;return{year:o,month:s,day:a}=rT(o,s,a,i),Sc(o,s,a,r)},yearMonthFromFields(t,e,r){let n=Ot(t,["month","monthCode","year"],["year"]),i=Hn(e);n=YA(n);let{year:o,month:s}=n;return{year:o,month:s}=function(d,u,c){let l=d,m=u;switch(c){case"reject":Kl(l,m,1);break;case"constrain":({year:l,month:m}=Ece(l,m))}return{year:l,month:m}}(o,s,i),bE(o,s,r,1)},monthDayFromFields(t,e,r){let n=Ot(t,["day","month","monthCode","year"],["day"]),i=Hn(e);if(n.month!==void 0&&n.year===void 0&&n.monthCode===void 0)throw new TypeError("either year or monthCode required with month");let o=n.monthCode===void 0;n=YA(n);let{month:s,day:a,year:d}=n;return{month:s,day:a}=rT(o?d:1972,s,a,i),vE(s,a,r,1972)},fields:t=>t,fieldKeysToIgnore(t){let e=new zce;for(let r=0;riN(R(t,Ie),R(t,Re),R(t,$e),R(e,Ie),R(e,Re),R(e,$e),r),year:t=>R(t,Ie),era(){},eraYear(){},month:t=>R(t,Re),monthCode:t=>bh(R(t,Re)),day:t=>R(t,$e),dayOfWeek:t=>w$(R(t,Ie),R(t,Re),R(t,$e)),dayOfYear:t=>aT(R(t,Ie),R(t,Re),R(t,$e)),weekOfYear:t=>Iae(R(t,Ie),R(t,Re),R(t,$e)).week,yearOfWeek:t=>Iae(R(t,Ie),R(t,Re),R(t,$e)).year,daysInWeek:()=>7,daysInMonth:t=>vh(R(t,Ie),R(t,Re)),daysInYear(t){let e=t;return Pi(e,Ie)||(e=Fr(e)),_m(R(e,Ie))?366:365},monthsInYear:()=>12,inLeapYear(t){let e=t;return Pi(e,Ie)||(e=Fr(e)),_m(R(e,Ie))}};var pi=class t{constructor(e){if(this.map=new Map,this.calls=0,this.hits=0,this.misses=0,this.now=globalThis.performance?globalThis.performance.now():Date.now(),e!==void 0){let r=0;for(let n of e.map.entries()){if(++r>t.MAX_CACHE_ENTRIES)break;this.map.set(...n)}}}get(e){let r=this.map.get(e);return r&&(this.hits++,this.report()),this.calls++,r}set(e,r){this.map.set(e,r),this.misses++,this.report()}report(){}setObject(e){if(t.objectMap.get(e))throw new RangeError("object already cached");t.objectMap.set(e,this),this.report()}static getCacheForObject(e){let r=t.objectMap.get(e);return r||(r=new t,t.objectMap.set(e,r)),r}};function Vce({isoYear:t,isoMonth:e,isoDay:r}){return`${_g(t)}-${vn(e)}-${vn(r)}T00:00Z`}function l$(t,e){return{years:t.year-e.year,months:t.month-e.month,days:t.day-e.day}}pi.objectMap=new WeakMap,pi.MAX_CACHE_ENTRIES=1e3;var Em=class{constructor(){this.eraLength="short",this.hasEra=!0,this.erasBeginMidYear=!1}getFormatter(){return this.formatter===void 0&&(this.formatter=new pNe(`en-US-u-ca-${this.id}`,{day:"numeric",month:"numeric",year:"numeric",era:this.eraLength,timeZone:"UTC"})),this.formatter}isoToCalendarDate(e,r){let{year:n,month:i,day:o}=e,s=JSON.stringify({func:"isoToCalendarDate",isoYear:n,isoMonth:i,isoDay:o,id:this.id}),a=r.get(s);if(a)return a;let d=this.getFormatter(),u,c;try{c=Vce({isoYear:n,isoMonth:i,isoDay:o}),u=d.formatToParts(new Date(c))}catch{throw new RangeError(`Invalid ISO date: ${JSON.stringify({isoYear:n,isoMonth:i,isoDay:o})}`)}let l={};for(let{type:p,value:g}of u){if(p==="year"&&(l.eraYear=+g),p==="relatedYear"&&(l.eraYear=+g),p==="month"){let v=/^([0-9]*)(.*?)$/.exec(g);if(!v||v.length!=3||!v[1]&&!v[2])throw new RangeError(`Unexpected month: ${g}`);if(l.month=v[1]?+v[1]:1,l.month<1)throw new RangeError(`Invalid month ${g} from ${c}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10527)`);if(l.month>13)throw new RangeError(`Invalid month ${g} from ${c}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10529)`);v[2]&&(l.monthExtra=v[2])}p==="day"&&(l.day=+g),this.hasEra&&p==="era"&&g!=null&&g!==""&&(g=g.split(" (")[0],l.era=g.normalize("NFD").replace(/[^-0-9 \p{L}]/gu,"").replace(" ","-").toLowerCase())}if(l.eraYear===void 0)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);if(this.reviseIntlEra){let{era:p,eraYear:g}=this.reviseIntlEra(l,e);l.era=p,l.eraYear=g}this.checkIcuBugs&&this.checkIcuBugs(e);let m=this.adjustCalendarDate(l,r,"constrain",!0);if(m.year===void 0)throw new RangeError(`Missing year converting ${JSON.stringify(e)}`);if(m.month===void 0)throw new RangeError(`Missing month converting ${JSON.stringify(e)}`);if(m.day===void 0)throw new RangeError(`Missing day converting ${JSON.stringify(e)}`);return r.set(s,m),["constrain","reject"].forEach(p=>{let g=JSON.stringify({func:"calendarToIsoDate",year:m.year,month:m.month,day:m.day,overflow:p,id:this.id});r.set(g,e)}),m}validateCalendarDate(e){let{era:r,month:n,year:i,day:o,eraYear:s,monthCode:a,monthExtra:d}=e;if(d!==void 0)throw new RangeError("Unexpected `monthExtra` value");if(i===void 0&&s===void 0)throw new TypeError("year or eraYear is required");if(n===void 0&&a===void 0)throw new TypeError("month or monthCode is required");if(o===void 0)throw new RangeError("Missing day");if(a!==void 0){if(typeof a!="string")throw new RangeError("monthCode must be a string, not "+typeof a);if(!/^M([01]?\d)(L?)$/.test(a))throw new RangeError(`Invalid monthCode: ${a}`)}if(this.constantEra){if(r!==void 0&&r!==this.constantEra)throw new RangeError(`era must be ${this.constantEra}, not ${r}`);if(s!==void 0&&i!==void 0&&s!==i)throw new RangeError(`eraYear ${s} does not match year ${i}`)}if(this.hasEra&&e.era===void 0!=(e.eraYear===void 0))throw new RangeError("properties 'era' and 'eraYear' must be provided together")}adjustCalendarDate(e,r,n="constrain",i=!1){if(this.calendarType==="lunisolar")throw new RangeError("Override required for lunisolar calendars");let o=e;if(this.validateCalendarDate(o),this.constantEra){let{year:u,eraYear:c}=o;o={...o,era:this.constantEra,year:u!==void 0?u:c,eraYear:c!==void 0?c:u}}let s=this.monthsInYear(o,r),{month:a,monthCode:d}=o;return{month:a,monthCode:d}=YA(o,n,s),{...o,month:a,monthCode:d}}regulateMonthDayNaive(e,r,n){let i=this.monthsInYear(e,n),{month:o,day:s}=e;return r==="reject"?(ro(o,1,i),ro(s,1,this.maximumMonthLength(e))):(o=sa(o,1,i),s=sa(s,1,this.maximumMonthLength({...e,month:o}))),{...e,month:o,day:s}}calendarToIsoDate(e,r="constrain",n){let i=e,o=this.adjustCalendarDate(e,n,r,!1);o=this.regulateMonthDayNaive(o,r,n);let{year:s,month:a,day:d}=o,u=JSON.stringify({func:"calendarToIsoDate",year:s,month:a,day:d,overflow:r,id:this.id}),c,l=n.get(u);if(l||i.year!==void 0&&i.month!==void 0&&i.day!==void 0&&(i.year!==o.year||i.month!==o.month||i.day!==o.day)&&(c=JSON.stringify({func:"calendarToIsoDate",year:i.year,month:i.month,day:i.day,overflow:r,id:this.id}),l=n.get(c),l))return l;let m=this.estimateIsoDate({year:s,month:a,day:d}),p=P=>{let I=this.addDaysIso(m,P);if(o.day>this.minimumMonthLength(o)){let $=this.isoToCalendarDate(I,n);for(;$.month!==a||$.year!==s;){if(r==="reject")throw new RangeError(`day ${d} does not exist in month ${a} of year ${s}`);I=this.addDaysIso(I,-1),$=this.isoToCalendarDate(I,n)}}return I},g=0,v=this.isoToCalendarDate(m,n),E=l$(o,v);if(E.years!==0||E.months!==0||E.days!==0){let P=365*E.years+30*E.months+E.days;m=this.addDaysIso(m,P),v=this.isoToCalendarDate(m,n),E=l$(o,v),E.years===0&&E.months===0?m=p(E.days):g=this.compareCalendarDates(o,v)}let A=8;for(;g;){m=this.addDaysIso(m,g*A);let P=v;v=this.isoToCalendarDate(m,n);let I=g;if(g=this.compareCalendarDates(o,v),g){if(E=l$(o,v),E.years===0&&E.months===0)m=p(E.days),g=0;else if(I&&g!==I)if(A>1)A/=2;else{if(r==="reject")throw new RangeError(`Can't find ISO date from calendar date: ${JSON.stringify({...i})}`);this.compareCalendarDates(v,P)>0&&(m=this.addDaysIso(m,-1)),g=0}}}if(n.set(u,m),c&&n.set(c,m),o.year===void 0||o.month===void 0||o.day===void 0||o.monthCode===void 0||this.hasEra&&(o.era===void 0||o.eraYear===void 0))throw new RangeError("Unexpected missing property");return m}temporalToCalendarDate(e,r){let n={year:R(e,Ie),month:R(e,Re),day:R(e,$e)};return this.isoToCalendarDate(n,r)}compareCalendarDates(e,r){let n=Ot(e,["day","month","year"],["day","month","year"]),i=Ot(r,["day","month","year"],["day","month","year"]);return n.year!==i.year?fg(n.year-i.year):n.month!==i.month?fg(n.month-i.month):n.day!==i.day?fg(n.day-i.day):0}regulateDate(e,r="constrain",n){let i=this.calendarToIsoDate(e,r,n);return this.isoToCalendarDate(i,n)}addDaysIso(e,r){return lg(e.year,e.month,e.day,0,0,0,r,"constrain")}addDaysCalendar(e,r,n){let i=this.calendarToIsoDate(e,"constrain",n),o=this.addDaysIso(i,r);return this.isoToCalendarDate(o,n)}addMonthsCalendar(e,r,n,i){let o=e,{day:s}=o;for(let a=0,d=yNe(r);a0){let g=this.monthsInYear(c,i);for(;o.month-1!=u%g;)p=this.addDaysIso(p,-1),o=this.isoToCalendarDate(p,i)}o.day!==s&&(o=this.regulateDate({...o,day:s},"constrain",i))}if(n==="reject"&&o.day!==s)throw new RangeError(`Day ${s} does not exist in resulting calendar month`);return o}addCalendar(e,{years:r=0,months:n=0,weeks:i=0,days:o=0},s,a){let{year:d,day:u,monthCode:c}=e,l=this.adjustCalendarDate({year:d+r,monthCode:c,day:u},a),m=this.addMonthsCalendar(l,n,s,a),p=o+7*i;return this.addDaysCalendar(m,p,a)}untilCalendar(e,r,n,i){let o=0,s=0,a=0,d=0;switch(n){case"day":o=this.calendarDaysUntil(e,r,i);break;case"week":{let u=this.calendarDaysUntil(e,r,i);o=u%7,s=(u-o)/7;break}case"month":case"year":{let u=this.compareCalendarDates(r,e);if(!u)return{years:0,months:0,weeks:0,days:0};let c=r.year-e.year,l=r.day-e.day;if(n==="year"&&c){let g=0;r.monthCode>e.monthCode&&(g=1),r.monthCode=0);a-=u,o=this.calendarDaysUntil(m,r,i);break}}return{years:d,months:a,weeks:s,days:o}}daysInMonth(e,r){let{day:n}=e,i=this.maximumMonthLength(e),o=this.minimumMonthLength(e);if(o===i)return o;let s=n<=i-o?i:o,a=this.calendarToIsoDate(e,"constrain",r),d=this.addDaysIso(a,s),u=this.isoToCalendarDate(d,r),c=this.addDaysIso(d,-u.day);return this.isoToCalendarDate(c,r).day}daysInPreviousMonth(e,r){let{day:n,month:i,year:o}=e,s={year:i>1?o:o-1,month:i,day:1},a=i>1?i-1:this.monthsInYear(s,r);s={...s,month:a};let d=this.minimumMonthLength(s),u=this.maximumMonthLength(s);if(d===u)return u;let c=this.calendarToIsoDate(e,"constrain",r),l=this.addDaysIso(c,-n);return this.isoToCalendarDate(l,r).day}startOfCalendarYear(e){return{year:e.year,month:1,monthCode:"M01",day:1}}startOfCalendarMonth(e){return{year:e.year,month:e.month,day:1}}calendarDaysUntil(e,r,n){let i=this.calendarToIsoDate(e,"constrain",n),o=this.calendarToIsoDate(r,"constrain",n);return this.isoDaysUntil(i,o)}isoDaysUntil(e,r){return iN(e.year,e.month,e.day,r.year,r.month,r.day,"day").days}monthDayFromFields(e,r,n){let i,o,s,a,d,{monthCode:u,day:c}=e;if(u===void 0){let{year:p,era:g,eraYear:v}=e;if(p===void 0&&(g===void 0||v===void 0))throw new TypeError("when `monthCode` is omitted, `year` (or `era` and `eraYear`) and `month` are required");({monthCode:u,day:c}=this.isoToCalendarDate(this.calendarToIsoDate(e,r,n),n))}let l=this.isoToCalendarDate({year:1972,month:12,day:31},n),m=l.monthCode>u||l.monthCode===u&&l.day>=c?l.year:l.year-1;for(let p=0;p<100;p++){let g=this.adjustCalendarDate({day:c,monthCode:u,year:m-p},n),v=this.calendarToIsoDate(g,"constrain",n),E=this.isoToCalendarDate(v,n);if({year:i,month:o,day:s}=v,E.monthCode===u&&E.day===c)return{month:o,day:s,year:i};r==="constrain"&&(a===void 0||E.monthCode===a.monthCode&&E.day>a.day)&&(a=E,d=v)}if(r==="constrain"&&d!==void 0)return d;throw new RangeError(`No recent ${this.id} year with monthCode ${u} and day ${c}`)}},A$=class extends Em{constructor(){super(...arguments),this.id="hebrew",this.calendarType="lunisolar",this.months={Tishri:{leap:1,regular:1,monthCode:"M01",days:30},Heshvan:{leap:2,regular:2,monthCode:"M02",days:{min:29,max:30}},Kislev:{leap:3,regular:3,monthCode:"M03",days:{min:29,max:30}},Tevet:{leap:4,regular:4,monthCode:"M04",days:29},Shevat:{leap:5,regular:5,monthCode:"M05",days:30},Adar:{leap:void 0,regular:6,monthCode:"M06",days:29},"Adar I":{leap:6,regular:void 0,monthCode:"M05L",days:30},"Adar II":{leap:7,regular:void 0,monthCode:"M06",days:29},Nisan:{leap:8,regular:7,monthCode:"M07",days:30},Iyar:{leap:9,regular:8,monthCode:"M08",days:29},Sivan:{leap:10,regular:9,monthCode:"M09",days:30},Tamuz:{leap:11,regular:10,monthCode:"M10",days:29},Av:{leap:12,regular:11,monthCode:"M11",days:30},Elul:{leap:13,regular:12,monthCode:"M12",days:29}},this.hasEra=!1}inLeapYear(e){let{year:r}=e;return(7*r+1)%19<7}monthsInYear(e){return this.inLeapYear(e)?13:12}minimumMonthLength(e){return this.minMaxMonthLength(e,"min")}maximumMonthLength(e){return this.minMaxMonthLength(e,"max")}minMaxMonthLength(e,r){let{month:n,year:i}=e,o=this.getMonthCode(i,n),s=S$(this.months).find(d=>d[1].monthCode===o);if(s===void 0)throw new RangeError(`unmatched Hebrew month: ${n}`);let a=s[1].days;return typeof a=="number"?a:a[r]}estimateIsoDate(e){let{year:r}=e;return{year:r-3760,month:1,day:1}}getMonthCode(e,r){return this.inLeapYear({year:e})?r===6?bh(5,!0):bh(r<6?r:r-1):bh(r)}adjustCalendarDate(e,r,n="constrain",i=!1){let{year:o,eraYear:s,month:a,monthCode:d,day:u,monthExtra:c}=e;if(o===void 0&&s!==void 0&&(o=s),s===void 0&&o!==void 0&&(s=o),i){if(c){let l=this.months[c];if(!l)throw new RangeError(`Unrecognized month from formatToParts: ${c}`);a=this.inLeapYear({year:o})?l.leap:l.regular}return d=this.getMonthCode(o,a),{year:o,month:a,day:u,era:void 0,eraYear:s,monthCode:d}}if(this.validateCalendarDate(e),a===void 0)if(d.endsWith("L")){if(d!=="M05L")throw new RangeError(`Hebrew leap month must have monthCode M05L, not ${d}`);if(a=6,!this.inLeapYear({year:o})){if(n==="reject")throw new RangeError(`Hebrew monthCode M05L is invalid in year ${o} which is not a leap year`);a=6,d="M06"}}else{a=fN(d),this.inLeapYear({year:o})&&a>=6&&a++;let l=this.monthsInYear({year:o});if(a<1||a>l)throw new RangeError(`Invalid monthCode: ${d}`)}else if(n==="reject"?(ro(a,1,this.monthsInYear({year:o})),ro(u,1,this.maximumMonthLength({year:o,month:a}))):(a=sa(a,1,this.monthsInYear({year:o})),u=sa(u,1,this.maximumMonthLength({year:o,month:a}))),d===void 0)d=this.getMonthCode(o,a);else if(this.getMonthCode(o,a)!==d)throw new RangeError(`monthCode ${d} doesn't correspond to month ${a} in Hebrew year ${o}`);return{...e,day:u,month:a,monthCode:d,year:o,eraYear:s}}},Sm=class extends Em{constructor(){super(...arguments),this.calendarType="lunar",this.DAYS_PER_ISLAMIC_YEAR=354+11/30,this.DAYS_PER_ISO_YEAR=365.2425,this.constantEra="ah"}inLeapYear(e,r){return this.daysInMonth({year:e.year,month:12,day:1},r)===30}monthsInYear(){return 12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}estimateIsoDate(e){let{year:r}=this.adjustCalendarDate(e);return{year:gNe(r*this.DAYS_PER_ISLAMIC_YEAR/this.DAYS_PER_ISO_YEAR)+622,month:1,day:1}}},lT=class extends Sm{constructor(){super(...arguments),this.id="islamic"}},T$=class extends Sm{constructor(){super(...arguments),this.id="islamic-umalqura"}},I$=class extends Sm{constructor(){super(...arguments),this.id="islamic-tbla"}},P$=class extends Sm{constructor(){super(...arguments),this.id="islamic-civil"}},k$=class extends Sm{constructor(){super(...arguments),this.id="islamic-rgsa"}},R$=class extends Sm{constructor(){super(...arguments),this.id="islamicc"}},D$=class extends Em{constructor(){super(...arguments),this.id="persian",this.calendarType="solar",this.constantEra="ap"}inLeapYear(e,r){return lT.prototype.inLeapYear.call(this,e,r)}monthsInYear(){return 12}minimumMonthLength(e){let{month:r}=e;return r===12?29:r<=6?31:30}maximumMonthLength(e){let{month:r}=e;return r===12?30:r<=6?31:30}estimateIsoDate(e){let{year:r}=this.adjustCalendarDate(e);return{year:r+621,month:1,day:1}}},B$=class extends Em{constructor(){super(...arguments),this.id="indian",this.calendarType="solar",this.constantEra="saka",this.months={1:{length:30,month:3,day:22,leap:{length:31,month:3,day:21}},2:{length:31,month:4,day:21},3:{length:31,month:5,day:22},4:{length:31,month:6,day:22},5:{length:31,month:7,day:23},6:{length:31,month:8,day:23},7:{length:30,month:9,day:23},8:{length:30,month:10,day:23},9:{length:30,month:11,day:22},10:{length:30,month:12,day:22},11:{length:30,month:1,nextYear:!0,day:21},12:{length:30,month:2,nextYear:!0,day:20}},this.vulnerableToBceBug=new Date("0000-01-01T00:00Z").toLocaleDateString("en-US-u-ca-indian",{timeZone:"UTC"})!=="10/11/-79 Saka"}inLeapYear(e){return Hce(e.year+78)}monthsInYear(){return 12}minimumMonthLength(e){return this.getMonthInfo(e).length}maximumMonthLength(e){return this.getMonthInfo(e).length}getMonthInfo(e){let{month:r}=e,n=this.months[r];if(n===void 0)throw new RangeError(`Invalid month: ${r}`);return this.inLeapYear(e)&&n.leap&&(n=n.leap),n}estimateIsoDate(e){let r=this.adjustCalendarDate(e),n=this.getMonthInfo(r);return lg(r.year+78+(n.nextYear?1:0),n.month,n.day,0,0,0,r.day-1,"constrain")}checkIcuBugs(e){if(this.vulnerableToBceBug&&e.year<1)throw new RangeError(`calendar '${this.id}' is broken for ISO dates before 0001-01-01 (see https://bugs.chromium.org/p/v8/issues/detail?id=10529)`)}};function Hce(t){return t%4==0&&(t%100!=0||t%400==0)}var bg=class extends Em{constructor(e,r){super(),this.calendarType="solar",this.v8IsVulnerableToJulianBug=new Date("+001001-01-01T00:00Z").toLocaleDateString("en-US-u-ca-japanese",{timeZone:"UTC"}).startsWith("12"),this.calendarIsVulnerableToJulianBug=!1,this.id=e;let{eras:n,anchorEra:i}=function(s){let a,d=s;if(d.length===0)throw new RangeError("Invalid era data: eras are required");if(d.length===1&&d[0].reverseOf)throw new RangeError("Invalid era data: anchor era cannot count years backwards");if(d.length===1&&!d[0].name)throw new RangeError("Invalid era data: at least one named era is required");if(d.filter(c=>c.reverseOf!=null).length>1)throw new RangeError("Invalid era data: only one era can count years backwards");d.forEach(c=>{if(c.isAnchor||!c.anchorEpoch&&!c.reverseOf){if(a)throw new RangeError("Invalid era data: cannot have multiple anchor eras");a=c,c.anchorEpoch={year:c.hasYearZero?0:1}}else if(!c.name)throw new RangeError("If era name is blank, it must be the anchor era")}),d=d.filter(c=>c.name),d.forEach(c=>{let{reverseOf:l}=c;if(l){let m=d.find(p=>p.name===l);if(m===void 0)throw new RangeError(`Invalid era data: unmatched reverseOf era: ${l}`);c.reverseOf=m,c.anchorEpoch=m.anchorEpoch,c.isoEpoch=m.isoEpoch}c.anchorEpoch.month===void 0&&(c.anchorEpoch.month=1),c.anchorEpoch.day===void 0&&(c.anchorEpoch.day=1)}),mNe.call(d,(c,l)=>{if(c.reverseOf)return 1;if(l.reverseOf)return-1;if(!c.isoEpoch||!l.isoEpoch)throw new RangeError("Invalid era data: missing ISO epoch");return l.isoEpoch.year-c.isoEpoch.year});let u=d[d.length-1].reverseOf;if(u&&u!==d[d.length-2])throw new RangeError("Invalid era data: invalid reverse-sign era");return d.forEach((c,l)=>{c.genericName="era"+(d.length-1-l)}),{eras:d,anchorEra:a||d[0]}}(r);this.anchorEra=i,this.eras=n}inLeapYear(e){let{year:r}=this.estimateIsoDate({month:1,day:1,year:e.year});return Hce(r)}monthsInYear(){return 12}minimumMonthLength(e){let{month:r}=e;return r===2?this.inLeapYear(e)?29:28:[4,6,9,11].indexOf(r)>=0?30:31}maximumMonthLength(e){return this.minimumMonthLength(e)}completeEraYear(e){let r=(a,d)=>{let u=e[a];if(u!=null&&u!=d)throw new RangeError(`Input ${a} ${u} doesn't match calculated value ${d}`)},n=a=>{let d,u={...e,year:a},c=this.eras.find((l,m)=>{if(m===this.eras.length-1){if(l.reverseOf){if(a>0)throw new RangeError(`Signed year ${a} is invalid for era ${l.name}`);return d=l.anchorEpoch.year-a,!0}return d=a-l.anchorEpoch.year+(l.hasYearZero?0:1),!0}return this.compareCalendarDates(u,l.anchorEpoch)>=0&&(d=a-l.anchorEpoch.year+(l.hasYearZero?0:1),!0)});if(!c)throw new RangeError(`Year ${a} was not matched by any era`);return{eraYear:d,era:c.name}},{year:i,eraYear:o,era:s}=e;if(i!=null)({eraYear:o,era:s}=n(i)),r("era",s),r("eraYear",o);else{if(o==null)throw new RangeError("Either `year` or `eraYear` and `era` are required");{let a=s===void 0?void 0:this.eras.find(d=>d.name===s||d.genericName===s);if(!a)throw new RangeError(`Era ${s} (ISO year ${o}) was not matched by any era`);if(o<1&&a.reverseOf)throw new RangeError(`Years in ${s} era must be positive, not ${i}`);i=a.reverseOf?a.anchorEpoch.year-o:o+a.anchorEpoch.year-(a.hasYearZero?0:1),r("year",i),{eraYear:o,era:s}=n(i)}}return{...e,year:i,eraYear:o,era:s}}adjustCalendarDate(e,r,n="constrain"){let i=e,{month:o,monthCode:s}=i;return o===void 0&&(i={...i,month:fN(s)}),this.validateCalendarDate(i),i=this.completeEraYear(i),super.adjustCalendarDate(i,r,n)}estimateIsoDate(e){let r=this.adjustCalendarDate(e),{year:n,month:i,day:o}=r,{anchorEra:s}=this;return rT(n+s.isoEpoch.year-(s.hasYearZero?0:1),i,o,"constrain")}checkIcuBugs(e){if(this.calendarIsVulnerableToJulianBug&&this.v8IsVulnerableToJulianBug&&gm(e.year,e.month,e.day,1582,10,15)<0)throw new RangeError(`calendar '${this.id}' is broken for ISO dates before 1582-10-15 (see https://bugs.chromium.org/p/chromium/issues/detail?id=1173158)`)}},xE=class extends bg{constructor(e,r){super(e,r)}inLeapYear(e){let{year:r}=e;return(r+1)%4==0}monthsInYear(){return 13}minimumMonthLength(e){let{month:r}=e;return r===13?this.inLeapYear(e)?6:5:30}maximumMonthLength(e){return this.minimumMonthLength(e)}},M$=class extends xE{constructor(){super("ethioaa",[{name:"era0",isoEpoch:{year:-5492,month:7,day:17}}])}},C$=class extends xE{constructor(){super("coptic",[{name:"era1",isoEpoch:{year:284,month:8,day:29}},{name:"era0",reverseOf:"era1"}])}},O$=class extends xE{constructor(){super("ethiopic",[{name:"era0",isoEpoch:{year:-5492,month:7,day:17}},{name:"era1",isoEpoch:{year:8,month:8,day:27},anchorEpoch:{year:5501}}])}},$$=class extends bg{constructor(){super("roc",[{name:"minguo",isoEpoch:{year:1912,month:1,day:1}},{name:"before-roc",reverseOf:"minguo"}]),this.calendarIsVulnerableToJulianBug=!0}},N$=class extends bg{constructor(){super("buddhist",[{name:"be",hasYearZero:!0,isoEpoch:{year:-543,month:1,day:1}}]),this.calendarIsVulnerableToJulianBug=!0}},j$=class extends bg{constructor(){super("gregory",[{name:"ce",isoEpoch:{year:1,month:1,day:1}},{name:"bce",reverseOf:"ce"}])}reviseIntlEra(e){let{era:r,eraYear:n}=e;return r!=="bc"&&r!=="b"||(r="bce"),r!=="ad"&&r!=="a"||(r="ce"),{era:r,eraYear:n}}},U$=class extends bg{constructor(){super("japanese",[{name:"reiwa",isoEpoch:{year:2019,month:5,day:1},anchorEpoch:{year:2019,month:5,day:1}},{name:"heisei",isoEpoch:{year:1989,month:1,day:8},anchorEpoch:{year:1989,month:1,day:8}},{name:"showa",isoEpoch:{year:1926,month:12,day:25},anchorEpoch:{year:1926,month:12,day:25}},{name:"taisho",isoEpoch:{year:1912,month:7,day:30},anchorEpoch:{year:1912,month:7,day:30}},{name:"meiji",isoEpoch:{year:1868,month:9,day:8},anchorEpoch:{year:1868,month:9,day:8}},{name:"ce",isoEpoch:{year:1,month:1,day:1}},{name:"bce",reverseOf:"ce"}]),this.calendarIsVulnerableToJulianBug=!0,this.eraLength="long",this.erasBeginMidYear=!0}reviseIntlEra(e,r){let{era:n,eraYear:i}=e,{year:o}=r;return this.eras.find(s=>s.name===n)?{era:n,eraYear:i}:o<1?{era:"bce",eraYear:1-o}:{era:"ce",eraYear:o}}},fT=class extends Em{constructor(){super(...arguments),this.calendarType="lunisolar",this.hasEra=!1}inLeapYear(e,r){let n=this.getMonthList(e.year,r);return S$(n).length===13}monthsInYear(e,r){return this.inLeapYear(e,r)?13:12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}getMonthList(e,r){if(e===void 0)throw new TypeError("Missing year");let n=JSON.stringify({func:"getMonthList",calendarYear:e,id:this.id}),i=r.get(n);if(i)return i;let o=this.getFormatter(),s=(E,A)=>{let P=Vce({isoYear:E,isoMonth:2,isoDay:1}),I=new Date(P);I.setUTCDate(A+1);let $=o.formatToParts(I),N=$.find(U=>U.type==="month").value,K=+$.find(U=>U.type==="day").value,F=$.find(U=>U.type==="relatedYear");if(F===void 0)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);return F=+F.value,{calendarMonthString:N,calendarDay:K,calendarYearToVerify:F}},a=17,{calendarMonthString:d,calendarDay:u,calendarYearToVerify:c}=s(e,a);d!=="1"&&(a+=29,{calendarMonthString:d,calendarDay:u}=s(e,a)),a-=u-5;let l={},m,p,g=1,v=!1;do({calendarMonthString:d,calendarDay:u,calendarYearToVerify:c}=s(e,a)),m&&(l[p].daysInMonth=m+30-u),c!==e?v=!0:(l[d]={monthIndex:g++},a+=30),m=u,p=d;while(!v);return l[p].daysInMonth=m+30-u,r.set(n,l),l}estimateIsoDate(e){let{year:r,month:n}=e;return{year:r,month:n>=12?12:n+1,day:1}}adjustCalendarDate(e,r,n="constrain",i=!1){let{year:o,month:s,monthExtra:a,day:d,monthCode:u,eraYear:c}=e;if(i){if(o=c,a&&a!=="bis")throw new RangeError(`Unexpected leap month suffix: ${a}`);let l=bh(s,a!==void 0),m=`${s}${a||""}`,p=this.getMonthList(o,r)[m];if(p===void 0)throw new RangeError(`Unmatched month ${m} in Chinese year ${o}`);return s=p.monthIndex,{year:o,month:s,day:d,era:void 0,eraYear:c,monthCode:l}}if(this.validateCalendarDate(e),o===void 0&&(o=c),c===void 0&&(c=o),s===void 0){let l=this.getMonthList(o,r),m=u.replace("L","bis").slice(1);m[0]==="0"&&(m=m.slice(1));let p=l[m];if(s=p&&p.monthIndex,s===void 0&&u.endsWith("L")&&u!="M13L"&&n==="constrain"){let g=u.slice(1,-1);g[0]==="0"&&(g=g.slice(1)),p=l[g],p&&(s=p.monthIndex,u=bh(g))}if(s===void 0)throw new RangeError(`Unmatched month ${u} in Chinese year ${o}`)}else if(u===void 0){let l=this.getMonthList(o,r),m=S$(l),p=m.length;n==="reject"?(ro(s,1,p),ro(d,1,this.maximumMonthLength())):(s=sa(s,1,p),d=sa(d,1,this.maximumMonthLength()));let g=m.find(([,v])=>v.monthIndex===s);if(g===void 0)throw new RangeError(`Invalid month ${s} in Chinese year ${o}`);u=bh(g[0].replace("bis",""),g[0].indexOf("bis")!==-1)}else{let l=this.getMonthList(o,r),m=u.replace("L","bis").slice(1);m[0]==="0"&&(m=m.slice(1));let p=l[m];if(!p)throw new RangeError(`Unmatched monthCode ${u} in Chinese year ${o}`);if(s!==p.monthIndex)throw new RangeError(`monthCode ${u} doesn't correspond to month ${s} in Chinese year ${o}`)}return{...e,year:o,eraYear:c,month:s,monthCode:u,day:d}}},q$=class extends fT{constructor(){super(...arguments),this.id="chinese"}},L$=class extends fT{constructor(){super(...arguments),this.id="dangi"}},K$=class{constructor(e){this.helper=e}dateFromFields(e,r,n){let i=new pi,o=Ot(e,this.fields(["day","month","monthCode","year"]),[]),s=Hn(r),{year:a,month:d,day:u}=this.helper.calendarToIsoDate(o,s,i),c=Sc(a,d,u,n);return i.setObject(c),c}yearMonthFromFields(e,r,n){let i=new pi,o=Ot(e,this.fields(["month","monthCode","year"]),[]),s=Hn(r),{year:a,month:d,day:u}=this.helper.calendarToIsoDate({...o,day:1},s,i),c=bE(a,d,n,u);return i.setObject(c),c}monthDayFromFields(e,r,n){let i=new pi,o=Ot(e,this.fields(["day","month","monthCode","year"]),[]),s=Hn(r),{year:a,month:d,day:u}=this.helper.monthDayFromFields(o,s,i),c=vE(d,u,n,a);return i.setObject(c),c}fields(e){let r=e;return Fce.call(r,"year")&&(r=[...r,"era","eraYear"]),r}fieldKeysToIgnore(e){let r=new zce;for(let n=0;nnew(xe("%Temporal.Instant%"))(dN()),Kae=(t,e=ym())=>{let r=Io(e),n=da(t);return Oa(r,hN(),n)},f$=(t=ym())=>Oa(Io(t),hN(),"iso8601"),Fae=(t,e=ym())=>{let r=Io(e),n=da(t);return eo(dN(),r,n)},Gce={instant:hN,plainDateTime:Kae,plainDateTimeISO:f$,plainDate:(t,e=ym())=>t1(Kae(t,e)),plainDateISO:(t=ym())=>t1(f$(t)),plainTimeISO:(t=ym())=>Q$(f$(t)),timeZoneId:()=>ym(),zonedDateTime:Fae,zonedDateTimeISO:(t=ym())=>Fae("iso8601",t),[Symbol.toStringTag]:"Temporal.Now"};Object.defineProperty(Gce,Symbol.toStringTag,{value:"Temporal.Now",writable:!1,enumerable:!1,configurable:!0});var bNe=Object.assign;function zae(t,e,r){let n=R(t,_t),i=R(t,xt),o=R(t,Et),s=R(t,St),a=R(t,At),d=R(t,Tt);if(r){let{unit:u,increment:c,roundingMode:l}=r;({hour:n,minute:i,second:o,millisecond:s,microsecond:a,nanosecond:d}=cN(n,i,o,s,a,d,c,u,l))}return`${vn(n)}:${vn(i)}${AT(o,s,a,d,e)}`}var IE=class t{constructor(e=0,r=0,n=0,i=0,o=0,s=0){let a=e===void 0?0:vr(e),d=r===void 0?0:vr(r),u=n===void 0?0:vr(n),c=i===void 0?0:vr(i),l=o===void 0?0:vr(o),m=s===void 0?0:vr(s);PT(a,d,u,c,l,m),Wl(this),Bt(this,_t,a),Bt(this,xt,d),Bt(this,Et,u),Bt(this,St,c),Bt(this,At,l),Bt(this,Tt,m)}get hour(){if(!Bn(this))throw new TypeError("invalid receiver");return R(this,_t)}get minute(){if(!Bn(this))throw new TypeError("invalid receiver");return R(this,xt)}get second(){if(!Bn(this))throw new TypeError("invalid receiver");return R(this,Et)}get millisecond(){if(!Bn(this))throw new TypeError("invalid receiver");return R(this,St)}get microsecond(){if(!Bn(this))throw new TypeError("invalid receiver");return R(this,At)}get nanosecond(){if(!Bn(this))throw new TypeError("invalid receiver");return R(this,Tt)}with(e,r){if(!Bn(this))throw new TypeError("invalid receiver");if(!un(e))throw new TypeError("invalid argument");s1(e);let n=Hn(er(r)),i=iT(e,"partial"),o=iT(this),{hour:s,minute:a,second:d,millisecond:u,microsecond:c,nanosecond:l}=bNe(o,i);return{hour:s,minute:a,second:d,millisecond:u,microsecond:c,nanosecond:l}=mT(s,a,d,u,c,l,n),new t(s,a,d,u,c,l)}add(e){if(!Bn(this))throw new TypeError("invalid receiver");return jae("add",this,e)}subtract(e){if(!Bn(this))throw new TypeError("invalid receiver");return jae("subtract",this,e)}until(e,r){if(!Bn(this))throw new TypeError("invalid receiver");return Bae("until",this,e,r)}since(e,r){if(!Bn(this))throw new TypeError("invalid receiver");return Bae("since",this,e,r)}round(e){if(!Bn(this))throw new TypeError("invalid receiver");if(e===void 0)throw new TypeError("options parameter is required");let r=typeof e=="string"?n1("smallestUnit",e):er(e),n=a1(r),i=Tu(r,"halfExpand"),o=ca(r,"smallestUnit","time",pg);c1(n,{hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[o],!1);let s=R(this,_t),a=R(this,xt),d=R(this,Et),u=R(this,St),c=R(this,At),l=R(this,Tt);return{hour:s,minute:a,second:d,millisecond:u,microsecond:c,nanosecond:l}=cN(s,a,d,u,c,l,n,o,i),new t(s,a,d,u,c,l)}equals(e){if(!Bn(this))throw new TypeError("invalid receiver");let r=yh(e);for(let n of[_t,xt,Et,St,At,Tt])if(R(this,n)!==R(r,n))return!1;return!0}toString(e){if(!Bn(this))throw new TypeError("invalid receiver");let r=er(e),n=CE(r),i=Tu(r,"trunc"),o=ca(r,"smallestUnit","time",void 0);if(o==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let{precision:s,unit:a,increment:d}=OE(o,n);return zae(this,s,{unit:a,increment:d,roundingMode:i})}toJSON(){if(!Bn(this))throw new TypeError("invalid receiver");return zae(this,"auto")}toLocaleString(e,r){if(!Bn(this))throw new TypeError("invalid receiver");return new Sh(e,r).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainTime")}toPlainDateTime(e){if(!Bn(this))throw new TypeError("invalid receiver");let r=Fr(e),n=R(r,Ie),i=R(r,Re),o=R(r,$e),s=R(r,oe);return oa(n,i,o,R(this,_t),R(this,xt),R(this,Et),R(this,St),R(this,At),R(this,Tt),s)}toZonedDateTime(e){if(!Bn(this))throw new TypeError("invalid receiver");if(!un(e))throw new TypeError("invalid argument");let r=e.plainDate;if(r===void 0)throw new TypeError("missing date property");let n=Fr(r),i=e.timeZone;if(i===void 0)throw new TypeError("missing timeZone property");let o=Io(i),s=R(n,Ie),a=R(n,Re),d=R(n,$e),u=R(n,oe),c=R(this,_t),l=R(this,xt),m=R(this,Et),p=R(this,St),g=R(this,At),v=R(this,Tt);return eo(R(ns(o,new(xe("%Temporal.PlainDateTime%"))(s,a,d,c,l,m,p,g,v,u),"compatible"),ut),o,u)}getISOFields(){if(!Bn(this))throw new TypeError("invalid receiver");return{isoHour:R(this,_t),isoMicrosecond:R(this,At),isoMillisecond:R(this,St),isoMinute:R(this,xt),isoNanosecond:R(this,Tt),isoSecond:R(this,Et)}}static from(e,r){let n=Hn(er(r));return Bn(e)?new t(R(e,_t),R(e,xt),R(e,Et),R(e,St),R(e,At),R(e,Tt)):yh(e,n)}static compare(e,r){let n=yh(e),i=yh(r);for(let o of[_t,xt,Et,St,At,Tt]){let s=R(n,o),a=R(i,o);if(s!==a)return fg(s-a)}return 0}};zl(IE,"Temporal.PlainTime");var hg=class{constructor(e){if(arguments.length<1)throw new RangeError("missing argument: identifier is required");let r=eN(e);Wl(this),Bt(this,Nl,r)}get id(){if(!wc(this))throw new TypeError("invalid receiver");return R(this,Nl)}getOffsetNanosecondsFor(e){if(!wc(this))throw new TypeError("invalid receiver");let r=Au(e),n=R(this,Nl);return Kw(n)?bm(n):gh(n,R(r,ut))}getOffsetStringFor(e){if(!wc(this))throw new TypeError("invalid receiver");return v$(this,Au(e))}getPlainDateTimeFor(e,r="iso8601"){if(!wc(this))throw new TypeError("invalid receiver");return Oa(this,Au(e),da(r))}getInstantFor(e,r){if(!wc(this))throw new TypeError("invalid receiver");return ns(this,ug(e),Qw(er(r)))}getPossibleInstantsFor(e){if(!wc(this))throw new TypeError("invalid receiver");let r=ug(e),n=xe("%Temporal.Instant%"),i=R(this,Nl);if(Kw(i)){let s=wm(R(r,Ie),R(r,Re),R(r,$e),R(r,_t),R(r,xt),R(r,Et),R(r,St),R(r,At),R(r,Tt));if(s===null)throw new RangeError("DateTime outside of supported range");let a=bm(i);return[new n(z.default.subtract(s,z.default.BigInt(a)))]}return function(a,d,u,c,l,m,p,g,v,E){let A=wm(d,u,c,l,m,p,g,v,E);if(A===null)throw new RangeError("DateTime outside of supported range");let P=z.default.subtract(A,Ll);z.default.lessThan(P,gE)&&(P=A);let I=z.default.add(A,Ll);z.default.greaterThan(I,Zw)&&(I=A);let $=gh(a,P),N=gh(a,I);return($===N?[$]:[$,N]).map(K=>{let F=z.default.subtract(A,z.default.BigInt(K)),U=vce(a,F);if(d===U.year&&u===U.month&&c===U.day&&l===U.hour&&m===U.minute&&p===U.second&&g===U.millisecond&&v===U.microsecond&&E===U.nanosecond)return F}).filter(K=>K!==void 0)}(i,R(r,Ie),R(r,Re),R(r,$e),R(r,_t),R(r,xt),R(r,Et),R(r,St),R(r,At),R(r,Tt)).map(s=>new n(s))}getNextTransition(e){if(!wc(this))throw new TypeError("invalid receiver");let r=Au(e),n=R(this,Nl);if(Kw(n)||n==="UTC")return null;let i=R(r,ut),o=xe("%Temporal.Instant%");return i=wce(n,i),i===null?null:new o(i)}getPreviousTransition(e){if(!wc(this))throw new TypeError("invalid receiver");let r=Au(e),n=R(this,Nl);if(Kw(n)||n==="UTC")return null;let i=R(r,ut),o=xe("%Temporal.Instant%");return i=b$(n,i),i===null?null:new o(i)}toString(){if(!wc(this))throw new TypeError("invalid receiver");return R(this,Nl)}toJSON(){if(!wc(this))throw new TypeError("invalid receiver");return R(this,Nl)}static from(e){return hce(Io(e))}};zl(hg,"Temporal.TimeZone"),An("Temporal.TimeZone.prototype.getOffsetNanosecondsFor",hg.prototype.getOffsetNanosecondsFor),An("Temporal.TimeZone.prototype.getPossibleInstantsFor",hg.prototype.getPossibleInstantsFor);var wNe=Object.create,PE=class{constructor(e,r,n="iso8601",i=1){uce(this,vr(e),vr(r),da(n),vr(i))}get year(){if(!Sr(this))throw new TypeError("invalid receiver");return yT(R(this,oe),this)}get month(){if(!Sr(this))throw new TypeError("invalid receiver");return gT(R(this,oe),this)}get monthCode(){if(!Sr(this))throw new TypeError("invalid receiver");return NE(R(this,oe),this)}get calendarId(){if(!Sr(this))throw new TypeError("invalid receiver");return no(R(this,oe))}get era(){if(!Sr(this))throw new TypeError("invalid receiver");return vT(R(this,oe),this)}get eraYear(){if(!Sr(this))throw new TypeError("invalid receiver");return bT(R(this,oe),this)}get daysInMonth(){if(!Sr(this))throw new TypeError("invalid receiver");return wT(R(this,oe),this)}get daysInYear(){if(!Sr(this))throw new TypeError("invalid receiver");return _T(R(this,oe),this)}get monthsInYear(){if(!Sr(this))throw new TypeError("invalid receiver");return xT(R(this,oe),this)}get inLeapYear(){if(!Sr(this))throw new TypeError("invalid receiver");return ET(R(this,oe),this)}with(e,r){if(!Sr(this))throw new TypeError("invalid receiver");if(!un(e))throw new TypeError("invalid argument");s1(e);let n=er(r),i=R(this,oe),o=Qn(i,["month","monthCode","year"]),s=Ot(this,o,[]);return s=yg(i,s,Ot(e,o,"partial")),s=Ot(s,o,[]),gg(i,s,n)}add(e,r){if(!Sr(this))throw new TypeError("invalid receiver");return Uae("add",this,e,r)}subtract(e,r){if(!Sr(this))throw new TypeError("invalid receiver");return Uae("subtract",this,e,r)}until(e,r){if(!Sr(this))throw new TypeError("invalid receiver");return Mae("until",this,e,r)}since(e,r){if(!Sr(this))throw new TypeError("invalid receiver");return Mae("since",this,e,r)}equals(e){if(!Sr(this))throw new TypeError("invalid receiver");let r=hE(e);for(let n of[Ie,Re,$e])if(R(this,n)!==R(r,n))return!1;return qE(R(this,oe),R(r,oe))}toString(e){if(!Sr(this))throw new TypeError("invalid receiver");return Sae(this,ME(er(e)))}toJSON(){if(!Sr(this))throw new TypeError("invalid receiver");return Sae(this)}toLocaleString(e,r){if(!Sr(this))throw new TypeError("invalid receiver");return new Sh(e,r).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainYearMonth")}toPlainDate(e){if(!Sr(this))throw new TypeError("invalid receiver");if(!un(e))throw new TypeError("argument should be an object");let r=R(this,oe),n=Qn(r,["monthCode","year"]),i=Ot(this,n,[]),o=Qn(r,["day"]),s=yg(r,i,Ot(e,o,[]));s=Ot(s,[...new Set([...n,...o])],[]);let a=wNe(null);return a.overflow="reject",wh(r,s,a)}getISOFields(){if(!Sr(this))throw new TypeError("invalid receiver");return{calendar:R(this,oe),isoDay:R(this,$e),isoMonth:R(this,Re),isoYear:R(this,Ie)}}getCalendar(){if(!Sr(this))throw new TypeError("invalid receiver");return d1(R(this,oe))}static from(e,r){let n=er(r);return Sr(e)?(Hn(n),bE(R(e,Ie),R(e,Re),R(e,oe),R(e,$e))):hE(e,n)}static compare(e,r){let n=hE(e),i=hE(r);return gm(R(n,Ie),R(n,Re),R(n,$e),R(i,Ie),R(i,Re),R(i,$e))}};zl(PE,"Temporal.PlainYearMonth");var _Ne=Sh.prototype.resolvedOptions,xNe=Object.create,kE=class{constructor(e,r,n="iso8601"){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");lce(this,mE(e),Io(r),da(n))}get calendarId(){if(!Ke(this))throw new TypeError("invalid receiver");return no(R(this,oe))}get timeZoneId(){if(!Ke(this))throw new TypeError("invalid receiver");return wE(R(this,Lr))}get year(){if(!Ke(this))throw new TypeError("invalid receiver");return yT(R(this,oe),cn(this))}get month(){if(!Ke(this))throw new TypeError("invalid receiver");return gT(R(this,oe),cn(this))}get monthCode(){if(!Ke(this))throw new TypeError("invalid receiver");return NE(R(this,oe),cn(this))}get day(){if(!Ke(this))throw new TypeError("invalid receiver");return jE(R(this,oe),cn(this))}get hour(){if(!Ke(this))throw new TypeError("invalid receiver");return R(cn(this),_t)}get minute(){if(!Ke(this))throw new TypeError("invalid receiver");return R(cn(this),xt)}get second(){if(!Ke(this))throw new TypeError("invalid receiver");return R(cn(this),Et)}get millisecond(){if(!Ke(this))throw new TypeError("invalid receiver");return R(cn(this),St)}get microsecond(){if(!Ke(this))throw new TypeError("invalid receiver");return R(cn(this),At)}get nanosecond(){if(!Ke(this))throw new TypeError("invalid receiver");return R(cn(this),Tt)}get era(){if(!Ke(this))throw new TypeError("invalid receiver");return vT(R(this,oe),cn(this))}get eraYear(){if(!Ke(this))throw new TypeError("invalid receiver");return bT(R(this,oe),cn(this))}get epochSeconds(){if(!Ke(this))throw new TypeError("invalid receiver");let e=R(this,ut);return z.default.toNumber(Vw(e,Ul))}get epochMilliseconds(){if(!Ke(this))throw new TypeError("invalid receiver");let e=R(this,ut);return z.default.toNumber(Vw(e,xc))}get epochMicroseconds(){if(!Ke(this))throw new TypeError("invalid receiver");return uT(Vw(R(this,ut),Ar))}get epochNanoseconds(){if(!Ke(this))throw new TypeError("invalid receiver");return uT(R(this,ut))}get dayOfWeek(){if(!Ke(this))throw new TypeError("invalid receiver");return G$(R(this,oe),cn(this))}get dayOfYear(){if(!Ke(this))throw new TypeError("invalid receiver");return J$(R(this,oe),cn(this))}get weekOfYear(){if(!Ke(this))throw new TypeError("invalid receiver");return Y$(R(this,oe),cn(this))}get yearOfWeek(){if(!Ke(this))throw new TypeError("invalid receiver");return Z$(R(this,oe),cn(this))}get hoursInDay(){if(!Ke(this))throw new TypeError("invalid receiver");let e=cn(this),r=xe("%Temporal.PlainDateTime%"),n=R(e,Ie),i=R(e,Re),o=R(e,$e),s=new r(n,i,o,0,0,0,0,0,0),a=lg(n,i,o,0,0,0,1,"reject"),d=new r(a.year,a.month,a.day,0,0,0,0,0,0),u=R(this,Lr),c=R(ns(u,s,"compatible"),ut),l=R(ns(u,d,"compatible"),ut);return $l(z.default.subtract(l,c),rce)}get daysInWeek(){if(!Ke(this))throw new TypeError("invalid receiver");return X$(R(this,oe),cn(this))}get daysInMonth(){if(!Ke(this))throw new TypeError("invalid receiver");return wT(R(this,oe),cn(this))}get daysInYear(){if(!Ke(this))throw new TypeError("invalid receiver");return _T(R(this,oe),cn(this))}get monthsInYear(){if(!Ke(this))throw new TypeError("invalid receiver");return xT(R(this,oe),cn(this))}get inLeapYear(){if(!Ke(this))throw new TypeError("invalid receiver");return ET(R(this,oe),cn(this))}get offset(){if(!Ke(this))throw new TypeError("invalid receiver");return v$(R(this,Lr),R(this,To))}get offsetNanoseconds(){if(!Ke(this))throw new TypeError("invalid receiver");return Iu(R(this,Lr),R(this,To))}with(e,r){if(!Ke(this))throw new TypeError("invalid receiver");if(!un(e))throw new TypeError("invalid zoned-date-time-like");s1(e);let n=er(r),i=R(this,oe),o=Qn(i,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]);o.push("offset");let s=Ot(this,o,["offset"]);s=yg(i,s,Ot(e,o,"partial")),s=Ot(s,o,["offset"]);let a=Qw(n),d=nT(n,"prefer"),{year:u,month:c,day:l,hour:m,minute:p,second:g,millisecond:v,microsecond:E,nanosecond:A}=$E(i,s,n),P=bm(s.offset),I=R(this,Lr);return eo(oT(u,c,l,m,p,g,v,E,A,"option",P,I,a,d,!1),I,i)}withPlainDate(e){if(!Ke(this))throw new TypeError("invalid receiver");let r=Fr(e),n=R(r,Ie),i=R(r,Re),o=R(r,$e),s=R(r,oe),a=cn(this),d=R(a,_t),u=R(a,xt),c=R(a,Et),l=R(a,St),m=R(a,At),p=R(a,Tt);s=fce(R(this,oe),s);let g=R(this,Lr);return eo(R(ns(g,new(xe("%Temporal.PlainDateTime%"))(n,i,o,d,u,c,l,m,p,s),"compatible"),ut),g,s)}withPlainTime(e){if(!Ke(this))throw new TypeError("invalid receiver");let r=xe("%Temporal.PlainTime%"),n=e===void 0?new r:yh(e),i=cn(this),o=R(i,Ie),s=R(i,Re),a=R(i,$e),d=R(this,oe),u=R(n,_t),c=R(n,xt),l=R(n,Et),m=R(n,St),p=R(n,At),g=R(n,Tt),v=R(this,Lr);return eo(R(ns(v,new(xe("%Temporal.PlainDateTime%"))(o,s,a,u,c,l,m,p,g,d),"compatible"),ut),v,d)}withTimeZone(e){if(!Ke(this))throw new TypeError("invalid receiver");let r=Io(e);return eo(R(this,ut),r,R(this,oe))}withCalendar(e){if(!Ke(this))throw new TypeError("invalid receiver");let r=da(e);return eo(R(this,ut),R(this,Lr),r)}add(e,r){if(!Ke(this))throw new TypeError("invalid receiver");return qae("add",this,e,r)}subtract(e,r){if(!Ke(this))throw new TypeError("invalid receiver");return qae("subtract",this,e,r)}until(e,r){if(!Ke(this))throw new TypeError("invalid receiver");return Cae("until",this,e,r)}since(e,r){if(!Ke(this))throw new TypeError("invalid receiver");return Cae("since",this,e,r)}round(e){if(!Ke(this))throw new TypeError("invalid receiver");if(e===void 0)throw new TypeError("options parameter is required");let r=typeof e=="string"?n1("smallestUnit",e):er(e),n=a1(r),i=Tu(r,"halfExpand"),o=ca(r,"smallestUnit","time",pg,["day"]),s={day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[o];c1(n,s,s===1);let a=cn(this),d=R(a,Ie),u=R(a,Re),c=R(a,$e),l=R(a,_t),m=R(a,xt),p=R(a,Et),g=R(a,St),v=R(a,At),E=R(a,Tt),A=xe("%Temporal.PlainDateTime%"),P=R(this,Lr),I=R(this,oe),$=ns(P,new A(R(a,Ie),R(a,Re),R(a,$e),0,0,0,0,0,0),"compatible"),N=Ec($,P,I,0,0,0,1,0,0,0,0,0,0),K=z.default.subtract(N,z.default.BigInt(R($,ut)));if(z.default.lessThanOrEqual(K,Mn))throw new RangeError("cannot round a ZonedDateTime in a calendar with zero or negative length days");return{year:d,month:u,day:c,hour:l,minute:m,second:p,millisecond:g,microsecond:v,nanosecond:E}=aN(d,u,c,l,m,p,g,v,E,n,o,i,z.default.toNumber(K)),eo(oT(d,u,c,l,m,p,g,v,E,"option",Iu(P,R(this,To)),P,"compatible","prefer",!1),P,R(this,oe))}equals(e){if(!Ke(this))throw new TypeError("invalid receiver");let r=pE(e),n=R(this,ut),i=R(r,ut);return!!z.default.equal(z.default.BigInt(n),z.default.BigInt(i))&&!!pce(R(this,Lr),R(r,Lr))&&qE(R(this,oe),R(r,oe))}toString(e){if(!Ke(this))throw new TypeError("invalid receiver");let r=er(e),n=ME(r),i=CE(r),o=function(p){return xm(p,"offset",["auto","never"],"auto")}(r),s=Tu(r,"trunc"),a=ca(r,"smallestUnit","time",void 0);if(a==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let d=function(p){return xm(p,"timeZoneName",["auto","never","critical"],"auto")}(r),{precision:u,unit:c,increment:l}=OE(a,i);return Aae(this,u,n,d,o,{unit:c,increment:l,roundingMode:s})}toLocaleString(e,r){if(!Ke(this))throw new TypeError("invalid receiver");let n=er(r),i=xNe(null);if(zw(i,n,["timeZone"]),n.timeZone!==void 0)throw new TypeError("ZonedDateTime toLocaleString does not accept a timeZone option");i.year===void 0&&i.month===void 0&&i.day===void 0&&i.weekday===void 0&&i.dateStyle===void 0&&i.hour===void 0&&i.minute===void 0&&i.second===void 0&&i.timeStyle===void 0&&i.dayPeriod===void 0&&i.timeZoneName===void 0&&(i.timeZoneName="short");let o=wE(R(this,Lr));if(Kw(o))throw new RangeError("toLocaleString does not support offset string time zones");o=eN(o),i.timeZone=o;let s=new Sh(e,i),a=Je(_Ne,s,[]).calendar,d=no(R(this,oe));if(d!=="iso8601"&&a!=="iso8601"&&a!==d)throw new RangeError(`cannot format ZonedDateTime with calendar ${d} in locale with calendar ${a}`);return s.format(R(this,To))}toJSON(){if(!Ke(this))throw new TypeError("invalid receiver");return Aae(this,"auto")}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.ZonedDateTime")}startOfDay(){if(!Ke(this))throw new TypeError("invalid receiver");let e=cn(this),r=xe("%Temporal.PlainDateTime%"),n=R(this,oe),i=new r(R(e,Ie),R(e,Re),R(e,$e),0,0,0,0,0,0,n),o=R(this,Lr);return eo(R(ns(o,i,"compatible"),ut),o,n)}toInstant(){if(!Ke(this))throw new TypeError("invalid receiver");return new(xe("%Temporal.Instant%"))(R(this,ut))}toPlainDate(){if(!Ke(this))throw new TypeError("invalid receiver");return t1(cn(this))}toPlainTime(){if(!Ke(this))throw new TypeError("invalid receiver");return Q$(cn(this))}toPlainDateTime(){if(!Ke(this))throw new TypeError("invalid receiver");return cn(this)}toPlainYearMonth(){if(!Ke(this))throw new TypeError("invalid receiver");let e=R(this,oe);return gg(e,Ot(this,Qn(e,["monthCode","year"]),[]))}toPlainMonthDay(){if(!Ke(this))throw new TypeError("invalid receiver");let e=R(this,oe);return e1(e,Ot(this,Qn(e,["day","monthCode"]),[]))}getISOFields(){if(!Ke(this))throw new TypeError("invalid receiver");let e=cn(this),r=R(this,Lr);return{calendar:R(this,oe),isoDay:R(e,$e),isoHour:R(e,_t),isoMicrosecond:R(e,At),isoMillisecond:R(e,St),isoMinute:R(e,xt),isoMonth:R(e,Re),isoNanosecond:R(e,Tt),isoSecond:R(e,Et),isoYear:R(e,Ie),offset:v$(r,R(this,To)),timeZone:r}}getCalendar(){if(!Ke(this))throw new TypeError("invalid receiver");return d1(R(this,oe))}getTimeZone(){if(!Ke(this))throw new TypeError("invalid receiver");return hce(R(this,Lr))}static from(e,r){let n=er(r);return Ke(e)?(Qw(n),nT(n,"reject"),Hn(n),eo(R(e,ut),R(e,Lr),R(e,oe))):pE(e,n)}static compare(e,r){let n=pE(e),i=pE(r),o=R(n,ut),s=R(i,ut);return z.default.lessThan(z.default.BigInt(o),z.default.BigInt(s))?-1:z.default.greaterThan(z.default.BigInt(o),z.default.BigInt(s))?1:0}};function cn(t){return Oa(R(t,Lr),R(t,To),R(t,oe))}zl(kE,"Temporal.ZonedDateTime");var xg=Object.freeze({__proto__:null,Calendar:yn,Duration:AE,Instant:_E,Now:Gce,PlainDate:EE,PlainDateTime:SE,PlainMonthDay:TE,PlainTime:IE,PlainYearMonth:PE,TimeZone:hg,ZonedDateTime:kE});var ENe=[_E,yn,EE,SE,AE,TE,IE,hg,PE,kE];for(let t of ENe){let e=Object.getOwnPropertyDescriptor(t,"prototype");(e.configurable||e.enumerable||e.writable)&&(e.configurable=!1,e.enumerable=!1,e.writable=!1,Object.defineProperty(t,"prototype",e))}var Jce=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},ir=class t{static sleep(e){return Jce(this,void 0,void 0,function*(){return new Promise(r=>setTimeout(r,e))})}static minimalSleep(){return Jce(this,void 0,void 0,function*(){yield t.sleep(2)})}static getCurrentTimestamp(){return xg.Now.instant().toString({smallestUnit:"microseconds"})}static createTimestamp(e){let{year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:d,microsecond:u}=e;return xg.ZonedDateTime.from({timeZone:"UTC",year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:d,microsecond:u}).toInstant().toString({smallestUnit:"microseconds"})}static createOffsetTimestamp(e,r){let n=r?xg.Instant.from(r):xg.Now.instant(),i=xg.Duration.from(e);return n.add(i).toString({smallestUnit:"microseconds"})}static validateTimestamp(e){try{xg.Instant.from(e)}catch{throw new se(ne.TimestampInvalid,`Invalid timestamp: ${e}`)}}};var ki=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},SNe=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);ir!=="").pop()}static createFrom(e){var r,n,i,o;return ki(this,void 0,void 0,function*(){let s=e.recordsWriteMessage,a=yield t.parse(s),d=ir.getCurrentTimestamp(),u=(r=e.published)!==null&&r!==void 0?r:e.datePublished?!0:s.descriptor.published,c;e.datePublished?c=e.datePublished:u&&(s.descriptor.published?c=s.descriptor.datePublished:c=d);let l={recipient:s.descriptor.recipient,recordId:s.recordId,dateCreated:s.descriptor.dateCreated,protocol:s.descriptor.protocol,protocolPath:s.descriptor.protocolPath,schema:s.descriptor.schema,parentContextId:mt.getParentContextFromOfContextId(s.contextId),messageTimestamp:(n=e.messageTimestamp)!==null&&n!==void 0?n:d,published:u,datePublished:c,tags:e.tags,data:e.data,dataCid:e.data?void 0:s.descriptor.dataCid,dataSize:e.data?void 0:s.descriptor.dataSize,dataFormat:(i=e.dataFormat)!==null&&i!==void 0?i:s.descriptor.dataFormat,protocolRole:(o=e.protocolRole)!==null&&o!==void 0?o:a.signaturePayload.protocolRole,delegatedGrant:e.delegatedGrant,signer:e.signer,attestationSigners:e.attestationSigners};return yield t.create(l)})}toJSON(){return this.message}encryptSymmetricEncryptionKey(e){return ki(this,void 0,void 0,function*(){this._message.encryption=yield t.createEncryptionProperty(this._message.descriptor,e),delete this._message.authorization,this._signaturePayload=void 0,this._author=void 0})}sign(e){var r;return ki(this,void 0,void 0,function*(){let{signer:n,delegatedGrant:i,permissionGrantId:o,protocolRole:s}=e,a,d;i!==void 0?(a=yield be.getCid(i),d=nn.getSignerDid(i.authorization.signature.signatures[0])):d=nn.extractDid(n.keyId);let u=this._message.descriptor,c=yield Pn.computeCid(u);this._message.recordId=(r=this._message.recordId)!==null&&r!==void 0?r:yield t.getEntryId(d,u),this._message.descriptor.protocol!==void 0&&(this.parentContextId===void 0||this.parentContextId===""?this._message.contextId=this._message.recordId:this._message.contextId=this.parentContextId+"/"+this._message.recordId);let l=yield t.createSignerSignature({recordId:this._message.recordId,contextId:this._message.contextId,descriptorCid:c,attestation:this._message.attestation,encryption:this._message.encryption,signer:n,delegatedGrantId:a,permissionGrantId:o,protocolRole:s});this._message.authorization={signature:l},i!==void 0&&(this._message.authorization.authorDelegatedGrant=i),this._signaturePayload=nn.decodePlainObjectPayload(l),this._author=d})}signAsOwner(e){return ki(this,void 0,void 0,function*(){if(this._author===void 0)throw new se(ne.RecordsWriteSignAsOwnerUnknownAuthor,"Unable to sign as owner without message signature because owner needs to sign over `recordId` which depends on author DID.");let r=this._message.descriptor,n=yield be.createSignature(r,e);this._message.authorization.ownerSignature=n,this._ownerSignaturePayload=nn.decodePlainObjectPayload(n),this._owner=nn.extractDid(e.keyId)})}signAsOwnerDelegate(e,r){return ki(this,void 0,void 0,function*(){if(this._author===void 0)throw new se(ne.RecordsWriteSignAsOwnerDelegateUnknownAuthor,"Unable to sign as owner delegate without message signature because owner delegate needs to sign over `recordId` which depends on author DID.");let n=yield be.getCid(r),i=this._message.descriptor,o=yield be.createSignature(i,e,{delegatedGrantId:n});this._message.authorization.ownerSignature=o,this._message.authorization.ownerDelegatedGrant=r,this._ownerSignaturePayload=nn.decodePlainObjectPayload(o),this._owner=nn.getSignerDid(r.authorization.signature.signatures[0])})}validateIntegrity(){return ki(this,void 0,void 0,function*(){if(yield this.isInitialWrite()){let n=this.message.descriptor.dateCreated,i=this.message.descriptor.messageTimestamp;if(i!==n)throw new se(ne.RecordsWriteValidateIntegrityDateCreatedMismatch,`messageTimestamp ${i} must match dateCreated ${n} for the initial write`);if(this.message.descriptor.protocol!==void 0&&this.message.descriptor.parentId===void 0){let o=yield this.getEntryId();if(this.message.contextId!==o)throw new se(ne.RecordsWriteValidateIntegrityContextIdMismatch,`contextId in message: ${this.message.contextId} does not match deterministic contextId: ${o}`)}}let r=this.signaturePayload;if(this.message.recordId!==r.recordId)throw new se(ne.RecordsWriteValidateIntegrityRecordIdUnauthorized,`recordId in message ${this.message.recordId} does not match recordId in authorization: ${r.recordId}`);if(this.message.contextId!==r.contextId)throw new se(ne.RecordsWriteValidateIntegrityContextIdNotInSignerSignaturePayload,`contextId in message ${this.message.contextId} does not match contextId in authorization: ${r.contextId}`);if(yield mt.validateDelegatedGrantReferentialIntegrity(this.message,r,this.ownerSignaturePayload),r.attestationCid!==void 0){let n=yield Pn.computeCid(this.message.attestation),i=r.attestationCid;if(i!==n)throw new se(ne.RecordsWriteValidateIntegrityAttestationMismatch,`CID ${n} of attestation property in message does not match attestationCid in authorization: ${i}`)}if(r.encryptionCid!==void 0){let n=yield Pn.computeCid(this.message.encryption),i=r.encryptionCid;if(i!==n)throw new se(ne.RecordsWriteValidateIntegrityEncryptionCidMismatch,`CID ${n} of encryption property in message does not match encryptionCid in authorization: ${i}`)}this.message.descriptor.protocol!==void 0&&Ma(this.message.descriptor.protocol),this.message.descriptor.schema!==void 0&&vd(this.message.descriptor.schema),ir.validateTimestamp(this.message.descriptor.messageTimestamp),ir.validateTimestamp(this.message.descriptor.dateCreated),this.message.descriptor.datePublished&&ir.validateTimestamp(this.message.descriptor.datePublished)})}static validateAttestationIntegrity(e){return ki(this,void 0,void 0,function*(){if(e.attestation===void 0)return;if(e.attestation.signatures.length!==1)throw new se(ne.RecordsWriteAttestationIntegrityMoreThanOneSignature,`Currently implementation only supports 1 attester, but got ${e.attestation.signatures.length}`);let r=nn.decodePlainObjectPayload(e.attestation),{descriptorCid:n}=r,i=yield Pn.computeCid(e.descriptor);if(n!==i)throw new se(ne.RecordsWriteAttestationIntegrityDescriptorCidMismatch,`descriptorCid ${n} does not match expected descriptorCid ${i}`);let o=Object.keys(r).length;if(o>1)throw new se(ne.RecordsWriteAttestationIntegrityInvalidPayloadProperty,`Only 'descriptorCid' is allowed in attestation payload, but got ${o} properties.`)})}getEntryId(){return ki(this,void 0,void 0,function*(){return yield t.getEntryId(this.author,this.message.descriptor)})}static getEntryId(e,r){return ki(this,void 0,void 0,function*(){if(e===void 0)throw new se(ne.RecordsWriteGetEntryIdUndefinedAuthor,"Property `author` is needed to compute entry ID.");let n=Object.assign({},r);return n.author=e,yield Pn.computeCid(n)})}isInitialWrite(){return ki(this,void 0,void 0,function*(){return(yield this.getEntryId())===this.message.recordId})}constructIndexes(e){return ki(this,void 0,void 0,function*(){let r=this.message,n=r.descriptor,{tags:i}=n,o=SNe(n,["tags"]);delete o.published;let s=Object.assign(Object.assign({},o),{isLatestBaseState:e,published:!!r.descriptor.published,author:this.author,recordId:r.recordId,entryId:yield t.getEntryId(this.author,this.message.descriptor)});if(i!==void 0&&e===!0){let a=mt.buildTagIndexes(Object.assign({},i));s=Object.assign(Object.assign({},s),a)}return this.attesters.length>0&&(s.attester=this.attesters[0]),r.contextId!==void 0&&(s.contextId=r.contextId),s})}authorizeAuthorDelegate(e){return ki(this,void 0,void 0,function*(){let r=yield Eo.parse(this.message.authorization.authorDelegatedGrant);yield Ho.authorizeWrite({recordsWriteMessage:this.message,expectedGrantor:this.author,expectedGrantee:this.signer,permissionGrant:r,messageStore:e})})}authorizeOwnerDelegate(e){return ki(this,void 0,void 0,function*(){let r=yield Eo.parse(this.message.authorization.ownerDelegatedGrant);yield Ho.authorizeWrite({recordsWriteMessage:this.message,expectedGrantor:this.owner,expectedGrantee:this.ownerSignatureSigner,permissionGrant:r,messageStore:e})})}static isInitialWrite(e){return ki(this,void 0,void 0,function*(){if(e.descriptor.interface!==Oe.Records||e.descriptor.method!==Ae.Write)return!1;let r=e,n=mt.getAuthor(r);return(yield t.getEntryId(n,r.descriptor))===r.recordId})}static createEncryptionProperty(e,r){var n,i;return ki(this,void 0,void 0,function*(){if(r===void 0)return;let o=[];for(let a of r.keyEncryptionInputs){if(a.derivationScheme===Qi.ProtocolPath&&e.protocol===void 0)throw new se(ne.RecordsWriteMissingProtocol,"`protocols` encryption scheme cannot be applied to record without the `protocol` property.");if(a.derivationScheme===Qi.Schemas&&e.schema===void 0)throw new se(ne.RecordsWriteMissingSchema,"`schemas` encryption scheme cannot be applied to record without the `schema` property.");let d=Ni.publicJwkToBytes(a.publicKey),u=yield fh.eciesSecp256k1Encrypt(d,r.key),c=Ze.bytesToBase64Url(u.ciphertext),l=yield Ni.publicKeyToJwk(u.ephemeralPublicKey),m=Ze.bytesToBase64Url(u.initializationVector),p=Ze.bytesToBase64Url(u.messageAuthenticationCode),g={rootKeyId:a.publicKeyId,algorithm:(n=a.algorithm)!==null&&n!==void 0?n:ig.EciesSecp256k1,derivationScheme:a.derivationScheme,ephemeralPublicKey:l,initializationVector:m,messageAuthenticationCode:p,encryptedKey:c};a.derivationScheme===Qi.ProtocolContext&&(g.derivedPublicKey=a.publicKey),o.push(g)}return{algorithm:(i=r.algorithm)!==null&&i!==void 0?i:ig.Aes256Ctr,initializationVector:Ze.bytesToBase64Url(r.initializationVector),keyEncryption:o}})}static createAttestation(e,r){return ki(this,void 0,void 0,function*(){if(r===void 0||r.length===0)return;let n={descriptorCid:e},i=Ze.objectToBytes(n);return(yield og.create(i,r)).getJws()})}static createSignerSignature(e){return ki(this,void 0,void 0,function*(){let{recordId:r,contextId:n,descriptorCid:i,attestation:o,encryption:s,signer:a,delegatedGrantId:d,permissionGrantId:u,protocolRole:c}=e,l=o?yield Pn.computeCid(o):void 0,m=s?yield Pn.computeCid(s):void 0,p={recordId:r,descriptorCid:i,contextId:n,attestationCid:l,encryptionCid:m,delegatedGrantId:d,permissionGrantId:u,protocolRole:c};En(p);let g=Ze.objectToBytes(p);return(yield og.create(g,[a])).getJws()})}static getInitialWrite(e){return ki(this,void 0,void 0,function*(){for(let r of e)if(yield t.isInitialWrite(r))return r;throw new se(ne.RecordsWriteGetInitialWriteNotFound,"Initial write is not found.")})}static verifyEqualityOfImmutableProperties(e,r){let n=["dataCid","dataSize","dataFormat","datePublished","published","messageTimestamp","tags"],i=[];i.push(...Object.keys(e.descriptor)),i.push(...Object.keys(r.descriptor)),i=[...new Set(i)];for(let o of i)if(n.indexOf(o)===-1){let s=e.descriptor[o],a=r.descriptor[o];if(a!==s)throw new se(ne.RecordsWriteImmutablePropertyChanged,`${o} is an immutable property: cannot change '${s}' to '${a}'`)}return!0}static getAttesters(e){var r,n;return((n=(r=e.attestation)===null||r===void 0?void 0:r.signatures)!==null&&n!==void 0?n:[]).map(s=>nn.getSignerDid(s))}static fetchInitialRecordsWrite(e,r,n){return ki(this,void 0,void 0,function*(){let i={entryId:n},{messages:o}=yield e.query(r,[i]);return o.length===0?void 0:yield t.parse(o[0])})}};var Yce=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})};function ei(t,e){return Yce(this,void 0,void 0,function*(){if(t===void 0)throw new se(ne.AuthenticateJwsMissing,"Missing JWS.");if(yield n0.verifySignatures(t.signature,e),t.ownerSignature!==void 0&&(yield n0.verifySignatures(t.ownerSignature,e)),t.authorDelegatedGrant!==void 0){let r=yield Hr.parse(t.authorDelegatedGrant);yield n0.verifySignatures(r.message.authorization.signature,e)}if(t.ownerDelegatedGrant!==void 0){let r=yield Hr.parse(t.ownerDelegatedGrant);yield n0.verifySignatures(r.message.authorization.signature,e)}})}function Hl(t,e){return Yce(this,void 0,void 0,function*(){if(e.author!==t)throw new se(ne.AuthorizationAuthorNotOwner,`Message authored by ${e.author}, not authored by expected owner ${t}.`)})}h();var ANe=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},KE=class{isActiveTenant(e){return ANe(this,void 0,void 0,function*(){return{isActiveTenant:!0}})}};h();h();var yi=class{get message(){return this._message}get signer(){return this._signer}get author(){return this._author}get signaturePayload(){return this._signaturePayload}constructor(e){this._message=e,e.authorization!==void 0&&(this._signer=be.getSigner(e),e.authorization.authorDelegatedGrant!==void 0?this._author=be.getSigner(e.authorization.authorDelegatedGrant):this._author=this._signer,this._signaturePayload=nn.decodePlainObjectPayload(e.authorization.signature))}toJSON(){return this.message}};var pN=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Im=class t extends yi{static parse(e){return pN(this,void 0,void 0,function*(){if(e.descriptor.filter.published===!1&&(e.descriptor.dateSort===qi.PublishedAscending||e.descriptor.dateSort===qi.PublishedDescending))throw new se(ne.RecordsQueryParseFilterPublishedSortInvalid,`queries must not filter for \`published:false\` and sort by ${e.descriptor.dateSort}`);let r;if(e.authorization!==void 0&&(r=yield be.validateSignatureStructure(e.authorization.signature,e.descriptor)),yield mt.validateDelegatedGrantReferentialIntegrity(e,r),r?.protocolRole!==void 0&&e.descriptor.filter.protocolPath===void 0)throw new se(ne.RecordsQueryFilterMissingRequiredProperties,"Role-authorized queries must include `protocolPath` in the filter");return e.descriptor.filter.protocol!==void 0&&Ma(e.descriptor.filter.protocol),e.descriptor.filter.schema!==void 0&&vd(e.descriptor.filter.schema),ir.validateTimestamp(e.descriptor.messageTimestamp),new t(e)})}static create(e){var r;return pN(this,void 0,void 0,function*(){let n={interface:Oe.Records,method:Ae.Query,messageTimestamp:(r=e.messageTimestamp)!==null&&r!==void 0?r:ir.getCurrentTimestamp(),filter:mt.normalizeFilter(e.filter),dateSort:e.dateSort,pagination:e.pagination};if(e.filter.published===!1&&(e.dateSort===qi.PublishedAscending||e.dateSort===qi.PublishedDescending))throw new se(ne.RecordsQueryCreateFilterPublishedSortInvalid,`queries must not filter for \`published:false\` and sort by ${e.dateSort}`);En(n);let i=e.signer,o;i&&(o=yield be.createAuthorization({descriptor:n,signer:i,protocolRole:e.protocolRole,delegatedGrant:e.delegatedGrant}));let s={descriptor:n,authorization:o};return be.validateJsonSchema(s),new t(s)})}authorizeDelegate(e){return pN(this,void 0,void 0,function*(){let r=yield Eo.parse(this.message.authorization.authorDelegatedGrant);yield Ho.authorizeQueryOrSubscribe({incomingMessage:this.message,expectedGrantee:this.signer,expectedGrantor:this.author,permissionGrant:r,messageStore:e})})}};h();var kT=Kt(UA(),1),Zce=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Pu=class t{static toBytes(e){return Zce(this,void 0,void 0,function*(){return new Promise((r,n)=>{let i=[];e.on("data",o=>{i.push(o)}),e.on("end",()=>{let o=t.concatenateArrayOfBytes(i);r(o)}),e.on("error",n)})})}static toObject(e){return Zce(this,void 0,void 0,function*(){let r=yield t.toBytes(e);return Ze.bytesToObject(r)})}static concatenateArrayOfBytes(e){let r=e.reduce((o,s)=>o+s.length,0),n=new Uint8Array(r),i=0;for(let o of e)n.set(o,i),i+=o.length;return n}static fromBytes(e){let n=0;return new kT.Readable({read(o){n+1e5>e.length?(this.push(e.subarray(n)),this.push(null)):(this.push(e.subarray(n,n+1e5)),n=n+1e5)}})}static fromObject(e){let r=Ze.objectToBytes(e);return t.fromBytes(r)}static duplicateDataStream(e,r){let n=[];for(let i=0;i{e===c&&Zn.matchAnyFilter(m,s)&&n(l)},u=yield this.eventStream.subscribe(e,a,d);return{status:{code:200,detail:"OK"},subscription:u}})}};h();h();var tde=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Bm=class t extends yi{static parse(e){return tde(this,void 0,void 0,function*(){return be.validateJsonSchema(e),this.validateMessageCids(e.descriptor.messageCids),yield be.validateSignatureStructure(e.authorization.signature,e.descriptor),ir.validateTimestamp(e.descriptor.messageTimestamp),new t(e)})}static create(e){var r;return tde(this,void 0,void 0,function*(){let n={interface:Oe.Messages,method:Ae.Get,messageCids:e.messageCids,messageTimestamp:(r=e?.messageTimestamp)!==null&&r!==void 0?r:ir.getCurrentTimestamp()},i=yield be.createAuthorization({descriptor:n,signer:e.signer}),o={descriptor:n,authorization:i};return be.validateJsonSchema(o),t.validateMessageCids(e.messageCids),new t(o)})}static validateMessageCids(e){for(let r of e)try{Pn.parseCid(r)}catch{throw new se(ne.MessageGetInvalidCid,`${r} is not a valid CID`)}}};var kNe=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},MT=class{constructor(e,r,n){this.didResolver=e,this.messageStore=r,this.dataStore=n}handle({tenant:e,message:r}){return kNe(this,void 0,void 0,function*(){let n;try{n=yield Bm.parse(r)}catch(a){return tr(a,400)}try{yield ei(r.authorization,this.didResolver),yield Hl(e,n)}catch(a){return tr(a,401)}let i=[],o=new Set(r.descriptor.messageCids);for(let a of o){let d=this.messageStore.get(e,a).then(u=>({messageCid:a,message:u})).catch(u=>({messageCid:a,message:void 0,error:`Failed to get message ${a}`}));i.push(d)}let s=yield Promise.all(i);for(let a of s){let{message:d}=a;if(!d)continue;let{interface:u,method:c}=d.descriptor;if(u!==Oe.Records||c!==Ae.Write)continue;let l=d;l.encodedData!==void 0&&(a.encodedData=l.encodedData,delete l.encodedData)}return{status:{code:200,detail:"OK"},entries:s}})}};h();h();var Kle=Kt(dU(),1);h();var Ph;(function(t){t.Anyone="anyone",t.Author="author",t.Recipient="recipient"})(Ph||(Ph={}));var gi;(function(t){t.CoDelete="co-delete",t.CoPrune="co-prune",t.CoUpdate="co-update",t.Create="create",t.Delete="delete",t.Prune="prune",t.Query="query",t.Read="read",t.Subscribe="subscribe",t.Update="update"})(gi||(gi={}));var Lle=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},EFe=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);i10)throw new se(ne.ProtocolsConfigureRecordNestingDepthExceeded,"Record nesting depth exceeded 10 levels.");for(let i in r){if(i.startsWith("$"))continue;let o=r[i],s;e===""?s=i:s=`${e}/${i}`,o.$role?n.push(s):t.fetchAllRolePathsRecursively(s,o,n)}return n}static validateRuleSetRecursively(e){var r;let{ruleSet:n,ruleSetProtocolPath:i,recordTypes:o,roles:s}=e;if(n.$size!==void 0){let{min:d=0,max:u}=n.$size;if(u!==void 0&&u![gi.CoUpdate,gi.CoDelete,gi.CoPrune].includes(l)))throw new se(ne.ProtocolsConfigureInvalidRecipientOfAction,"Rules for `recipient` without `of` property must have `can` containing only `co-update`, `co-delete`, and `co-prune`.");if(u.who===Ph.Author&&!u.of)throw new se(ne.ProtocolsConfigureInvalidActionMissingOf,"'of' is required when 'author' is specified as 'who'");if(u.can!==void 0){if(u.can.includes(gi.Update)&&!u.can.includes(gi.Create))throw new se(ne.ProtocolsConfigureInvalidActionUpdateWithoutCreate,`Action rule ${JSON.stringify(u)} contains 'update' action but missing the required 'create' action.`);if(u.can.includes(gi.Delete)&&!u.can.includes(gi.Create))throw new se(ne.ProtocolsConfigureInvalidActionDeleteWithoutCreate,`Action rule ${JSON.stringify(u)} contains 'delete' action but missing the required 'create' action.`)}for(let c=d+1;c0)throw new se(ne.ProtocolAuthorizationMissingContextId,"Could not verify role because contextId is missing.");if(l>0){let g=i.split("/").slice(0,l).join("/"),v=Zn.constructPrefixFilterAsRangeFilter(g);c.contextId=v}let{messages:m}=yield s.query(e,[c]);if(m.length===0)throw new se(ne.ProtocolAuthorizationMatchingRoleRecordNotFound,`No matching role record found for protocol path ${d}`)})}static getActionsSeekingARuleMatch(e,r,n){return qa(this,void 0,void 0,function*(){switch(r.message.descriptor.method){case Ae.Delete:let i=r,o=i.message.descriptor.recordId,s=yield Hr.fetchInitialRecordsWrite(n,e,o);if(s===void 0)return[];let a=[];return i.message.descriptor.prune?(a.push(gi.CoPrune),r.author===s.author&&a.push(gi.Prune)):(a.push(gi.CoDelete),r.author===s.author&&a.push(gi.Delete)),a;case Ae.Query:return[gi.Query];case Ae.Read:return[gi.Read];case Ae.Subscribe:return[gi.Subscribe];case Ae.Write:if(yield r.isInitialWrite())return[gi.Create];{let c=r.message.recordId,l=yield Hr.fetchInitialRecordsWrite(n,e,c);return l===void 0?[]:r.author===l.author?[gi.CoUpdate,gi.Update]:[gi.CoUpdate]}}return[]})}static authorizeAgainstAllowedActions(e,r,n,i,o){var s;return qa(this,void 0,void 0,function*(){let a=r.message.descriptor.method,d=yield t.getActionsSeekingARuleMatch(e,r,o),u=r.author,c=n.$actions;if(c===void 0)throw new se(ne.ProtocolAuthorizationActionRulesNotFound,`no action rule defined for Records${a}, ${u} is unauthorized`);let l=(s=r.signaturePayload)===null||s===void 0?void 0:s.protocolRole;for(let m of c){if(!m.can.some(v=>d.includes(v)))continue;if(m.who===Ph.Anyone)return;if(u===void 0)continue;if(l!==void 0){if(m.role===l)return;continue}if(m.who===Ph.Recipient&&m.of===void 0){let v;if(r.message.descriptor.method===Ae.Write?v=r.message:v=i[i.length-1],v.descriptor.recipient===u)return;continue}if(yield t.checkActor(u,m,i))return}throw new se(ne.ProtocolAuthorizationActionNotAllowed,`Inbound message action Records${a} by author ${r.author} not allowed.`)})}static verifySizeLimit(e,r){let{min:n=0,max:i}=r.$size||{},o=e.message.descriptor.dataSize;if(oi)throw new se(ne.ProtocolAuthorizationMaxSizeInvalid,`data size ${o} is more than allowed ${i}`)}static verifyTagsIfNeeded(e,r){if(r.$tags!==void 0){let{tags:n={},protocol:i,protocolPath:o}=e.message.descriptor,s=r.$tags,{$allowUndefinedTags:a,$requiredTags:d}=s,u=TFe(s,["$allowUndefinedTags","$requiredTags"]),c=a||!1,l=d||[],m=new zle.default.default,p=m.compile({type:"object",properties:u,required:l,additionalProperties:c});if(!p(n)){let v=m.errorsText(p.errors,{dataVar:`${i}/${o}/$tags`});throw new se(ne.ProtocolAuthorizationTagsInvalidSchema,`tags schema validation error: ${v}`)}}}static verifyAsRoleRecordIfNeeded(e,r,n,i){return qa(this,void 0,void 0,function*(){if(!n.$role)return;let o=r,s=o.message.descriptor.recipient;if(s===void 0)throw new se(ne.ProtocolAuthorizationRoleMissingRecipient,"Role records must have a recipient");let a=o.message.descriptor.protocolPath,d={interface:Oe.Records,method:Ae.Write,isLatestBaseState:!0,protocol:o.message.descriptor.protocol,protocolPath:a,recipient:s},u=mt.getParentContextFromOfContextId(o.message.contextId);if(u!==""){let p=Zn.constructPrefixFilterAsRangeFilter(u);d.contextId=p}let{messages:c}=yield i.query(e,[d]);if(c.filter(p=>p.recordId!==o.message.recordId).length>0)throw new se(ne.ProtocolAuthorizationDuplicateRoleRecipient,`DID '${s}' is already recipient of a role record at protocol path '${a} under the parent context ${u}.`)})}static getRuleSetAtProtocolPath(e,r){let n=e.split("/"),i=r.structure,o=0;for(;oo.descriptor.protocolPath===r.of);if(i===void 0)return!1;if(r.who===Ph.Recipient)return e===i.descriptor.recipient;{let o=(yield Hr.parse(i)).author;return e===o}})}static getTypeName(e){return e.split("/").slice(-1)[0]}};h();var lU=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Fm=class t extends yi{static parse(e){return lU(this,void 0,void 0,function*(){let r;return e.authorization!==void 0&&(r=yield be.validateSignatureStructure(e.authorization.signature,e.descriptor)),yield mt.validateDelegatedGrantReferentialIntegrity(e,r),ir.validateTimestamp(e.descriptor.messageTimestamp),new t(e)})}static create(e){var r,n;return lU(this,void 0,void 0,function*(){let i=e.recordId,o=ir.getCurrentTimestamp(),s={interface:Oe.Records,method:Ae.Delete,messageTimestamp:(r=e.messageTimestamp)!==null&&r!==void 0?r:o,recordId:i,prune:(n=e.prune)!==null&&n!==void 0?n:!1},a=yield be.createAuthorization({descriptor:s,signer:e.signer,protocolRole:e.protocolRole,delegatedGrant:e.delegatedGrant}),d={descriptor:s,authorization:a};return be.validateJsonSchema(d),new t(d)})}constructIndexes(e){let r=this.message,n=Object.assign({},r.descriptor),{protocol:i,protocolPath:o,recipient:s,schema:a,parentId:d,dateCreated:u}=e.descriptor,c=Object.assign({protocol:i,protocolPath:o,recipient:s,schema:a,parentId:d,dateCreated:u,contextId:e.contextId,author:this.author},n);return En(c),c}authorizeDelegate(e,r){return lU(this,void 0,void 0,function*(){let n=yield Eo.parse(this.message.authorization.authorDelegatedGrant);yield Ho.authorizeDelete({recordsDeleteMessage:this.message,recordsWriteToDelete:e,expectedGrantor:this.author,expectedGrantee:this.signer,permissionGrant:n,messageStore:r})})}};h();h();var Zl=class{};Zl.maxDataSizeAllowedToBeEncoded=3e4;var mI=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Cg=class t{static deleteFromDataStoreIfNeeded(e,r,n,i){return mI(this,void 0,void 0,function*(){if(n.descriptor.method!==Ae.Write)return;let o=n;o.descriptor.dataSize<=Zl.maxDataSizeAllowedToBeEncoded||o.descriptor.dataCid!==i.descriptor.dataCid&&(yield e.delete(r,o.recordId,o.descriptor.dataCid))})}static purgeRecordDescendants(e,r,n,i,o){return mI(this,void 0,void 0,function*(){let s={interface:Oe.Records,parentId:r},{messages:a}=yield n.query(e,[s]),d=new Map;for(let u of a){let c;mt.isRecordsWrite(u)?c=u.recordId:c=u.descriptor.recordId,d.has(c)||d.set(c,[]),d.get(c).push(u)}for(let u of d.keys())yield t.purgeRecordDescendants(e,u,n,i,o);for(let u of d.keys())yield t.purgeRecordMessages(e,d.get(u),n,i,o)})}static purgeRecordMessages(e,r,n,i,o){return mI(this,void 0,void 0,function*(){let s=r.filter(u=>u.descriptor.method===Ae.Write),a=yield be.getNewestMessage(s);yield i.delete(e,a.recordId,a.descriptor.dataCid);let d=yield Promise.all(r.map(u=>be.getCid(u)));yield o.deleteEventsByCid(e,d),yield Promise.all(d.map(u=>n.delete(e,u)))})}static deleteAllOlderMessagesButKeepInitialWrite(e,r,n,i,o,s){return mI(this,void 0,void 0,function*(){let a=[];for(let d of r){if(yield be.isOlder(d,n)){yield t.deleteFromDataStoreIfNeeded(o,e,d,n);let c=yield be.getCid(d);if(yield i.delete(e,c),yield Hr.isInitialWrite(d)){let m=yield Hr.parse(d),p=!1,g=yield m.constructIndexes(p),v=d;delete v.encodedData,yield i.put(e,v,g)}else{let m=yield be.getCid(d);a.push(m)}}yield s.deleteEventsByCid(e,a)}})}};var Wle=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},yI=class t{constructor(e,r,n,i,o){this.didResolver=e,this.messageStore=r,this.dataStore=n,this.eventLog=i,this.eventStream=o}handle({tenant:e,message:r}){return Wle(this,void 0,void 0,function*(){let n;try{n=yield Fm.parse(r)}catch(p){return tr(p,400)}try{yield ei(r.authorization,this.didResolver)}catch(p){return tr(p,401)}let i={interface:Oe.Records,recordId:r.descriptor.recordId},{messages:o}=yield this.messageStore.query(e,[i]),s=yield be.getNewestMessage(o),a=!1,d;if(s===void 0||(yield be.isNewer(r,s))?(a=!0,d=r):d=s,!a)return{status:{code:409,detail:"Conflict"}};if(s===void 0||s.descriptor.method===Ae.Delete)return{status:{code:404,detail:"Not Found"}};try{yield t.authorizeRecordsDelete(e,n,yield Hr.parse(s),this.messageStore)}catch(p){return tr(p,401)}let u=yield Hr.getInitialWrite(o),c=n.constructIndexes(u),l=yield be.getCid(r);return yield this.messageStore.put(e,r,c),yield this.eventLog.append(e,l,c),this.eventStream!==void 0&&this.eventStream.emit(e,{message:r,initialWrite:u},c),r.descriptor.prune&&(yield Cg.purgeRecordDescendants(e,r.descriptor.recordId,this.messageStore,this.dataStore,this.eventLog)),yield Cg.deleteAllOlderMessagesButKeepInitialWrite(e,o,d,this.messageStore,this.dataStore,this.eventLog),{status:{code:202,detail:"Accepted"}}})}static authorizeRecordsDelete(e,r,n,i){return Wle(this,void 0,void 0,function*(){if(be.isSignedByAuthorDelegate(r.message)&&(yield r.authorizeDelegate(n.message,i)),r.author!==e)if(n.message.descriptor.protocol!==void 0)yield Ac.authorizeDelete(e,r,n,i);else throw new se(ne.RecordsDeleteAuthorizationFailed,"RecordsDelete message failed authorization")})}};h();h();var cs;(function(t){t[t.Descending=-1]="Descending",t[t.Ascending=1]="Ascending"})(cs||(cs={}));var w6=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},gI=class t{constructor(e,r,n){this.didResolver=e,this.messageStore=r,this.dataStore=n}handle({tenant:e,message:r}){return w6(this,void 0,void 0,function*(){let n;try{n=yield Im.parse(r)}catch(s){return tr(s,400)}let i,o;if(mt.filterIncludesPublishedRecords(n.message.descriptor.filter)&&n.author===void 0){let s=yield this.fetchPublishedRecords(e,n);i=s.messages,o=s.cursor}else{try{yield ei(r.authorization,this.didResolver),yield t.authorizeRecordsQuery(e,n,this.messageStore)}catch(s){return tr(s,401)}if(n.author===e){let s=yield this.fetchRecordsAsOwner(e,n);i=s.messages,o=s.cursor}else{let s=yield this.fetchRecordsAsNonOwner(e,n);i=s.messages,o=s.cursor}}for(let s of i)if(!(yield Hr.isInitialWrite(s))){let d=(yield this.messageStore.query(e,[{recordId:s.recordId,isLatestBaseState:!1,method:Ae.Write}])).messages[0];delete d.encodedData,s.initialWrite=d}return{status:{code:200,detail:"OK"},entries:i,cursor:o}})}convertDateSort(e){switch(e){case qi.CreatedAscending:return{dateCreated:cs.Ascending};case qi.CreatedDescending:return{dateCreated:cs.Descending};case qi.PublishedAscending:return{datePublished:cs.Ascending};case qi.PublishedDescending:return{datePublished:cs.Descending};default:return{dateCreated:cs.Ascending}}}fetchRecordsAsOwner(e,r){return w6(this,void 0,void 0,function*(){let{dateSort:n,filter:i,pagination:o}=r.message.descriptor,s=Object.assign(Object.assign({},mt.convertFilter(i,n)),{interface:Oe.Records,method:Ae.Write,isLatestBaseState:!0}),a=this.convertDateSort(n);return this.messageStore.query(e,[s],a,o)})}fetchRecordsAsNonOwner(e,r){return w6(this,void 0,void 0,function*(){let{dateSort:n,pagination:i,filter:o}=r.message.descriptor,s=[];if(mt.filterIncludesPublishedRecords(o)&&s.push(t.buildPublishedRecordsFilter(r)),mt.filterIncludesUnpublishedRecords(o)){s.push(t.buildUnpublishedRecordsByQueryAuthorFilter(r));let d=r.message.descriptor.filter.recipient;(d===void 0||d===r.author)&&s.push(t.buildUnpublishedRecordsForQueryAuthorFilter(r)),mt.shouldProtocolAuthorize(r.signaturePayload)&&s.push(t.buildUnpublishedProtocolAuthorizedRecordsFilter(r))}let a=this.convertDateSort(n);return this.messageStore.query(e,s,a,i)})}fetchPublishedRecords(e,r){return w6(this,void 0,void 0,function*(){let{dateSort:n,pagination:i}=r.message.descriptor,o=t.buildPublishedRecordsFilter(r),s=this.convertDateSort(n);return this.messageStore.query(e,[o],s,i)})}static buildPublishedRecordsFilter(e){let{dateSort:r,filter:n}=e.message.descriptor;return Object.assign(Object.assign({},mt.convertFilter(n,r)),{interface:Oe.Records,method:Ae.Write,published:!0,isLatestBaseState:!0})}static buildUnpublishedRecordsForQueryAuthorFilter(e){let{dateSort:r,filter:n}=e.message.descriptor;return Object.assign(Object.assign({},mt.convertFilter(n,r)),{interface:Oe.Records,method:Ae.Write,recipient:e.author,isLatestBaseState:!0,published:!1})}static buildUnpublishedProtocolAuthorizedRecordsFilter(e){let{dateSort:r,filter:n}=e.message.descriptor;return Object.assign(Object.assign({},mt.convertFilter(n,r)),{interface:Oe.Records,method:Ae.Write,isLatestBaseState:!0,published:!1})}static buildUnpublishedRecordsByQueryAuthorFilter(e){let{dateSort:r,filter:n}=e.message.descriptor;return Object.assign(Object.assign({},mt.convertFilter(n,r)),{author:e.author,interface:Oe.Records,method:Ae.Write,isLatestBaseState:!0,published:!1})}static authorizeRecordsQuery(e,r,n){return w6(this,void 0,void 0,function*(){be.isSignedByAuthorDelegate(r.message)&&(yield r.authorizeDelegate(n)),mt.shouldProtocolAuthorize(r.signaturePayload)&&(yield Ac.authorizeQueryOrSubscribe(e,r,n))})}};h();h();var fU=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Og=class t extends yi{static parse(e){return fU(this,void 0,void 0,function*(){let r;return e.authorization!==void 0&&(r=yield be.validateSignatureStructure(e.authorization.signature,e.descriptor)),yield mt.validateDelegatedGrantReferentialIntegrity(e,r),ir.validateTimestamp(e.descriptor.messageTimestamp),new t(e)})}static create(e){var r;return fU(this,void 0,void 0,function*(){let{filter:n,signer:i,permissionGrantId:o,protocolRole:s}=e,a=ir.getCurrentTimestamp(),d={interface:Oe.Records,method:Ae.Read,filter:mt.normalizeFilter(n),messageTimestamp:(r=e.messageTimestamp)!==null&&r!==void 0?r:a};En(d);let u;i!==void 0&&(u=yield be.createAuthorization({descriptor:d,signer:i,permissionGrantId:o,protocolRole:s,delegatedGrant:e.delegatedGrant}));let c={descriptor:d,authorization:u};return be.validateJsonSchema(c),new t(c)})}authorizeDelegate(e,r){return fU(this,void 0,void 0,function*(){let n=yield Eo.parse(this.message.authorization.authorDelegatedGrant);yield Ho.authorizeRead({recordsReadMessage:this.message,recordsWriteMessageToBeRead:e,expectedGrantor:this.author,expectedGrantee:this.signer,permissionGrant:n,messageStore:r})})}};var Vle=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},vI=class t{constructor(e,r,n){this.didResolver=e,this.messageStore=r,this.dataStore=n}handle({tenant:e,message:r}){return Vle(this,void 0,void 0,function*(){let n;try{n=yield Og.parse(r)}catch(c){return tr(c,400)}try{n.author!==void 0&&(yield ei(r.authorization,this.didResolver))}catch(c){return tr(c,401)}let i=Object.assign({interface:Oe.Records,isLatestBaseState:!0},mt.convertFilter(r.descriptor.filter)),{messages:o}=yield this.messageStore.query(e,[i]);if(o.length===0)return{status:{code:404,detail:"Not Found"}};if(o.length>1)return tr(new se(ne.RecordsReadReturnedMultiple,"Multiple records exist for the RecordsRead filter"),400);let s=o[0];try{yield t.authorizeRecordsRead(e,n,yield Hr.parse(s),this.messageStore)}catch(c){return tr(c,401)}let a;if(s.encodedData!==void 0){let c=Ze.base64UrlToBytes(s.encodedData);a=Pu.fromBytes(c),delete s.encodedData}else{let c=yield this.dataStore.get(e,s.recordId,s.descriptor.dataCid);if(c?.dataStream===void 0)return{status:{code:404,detail:"Not Found"}};a=c.dataStream}let d=Object.assign(Object.assign({},s),{data:a});if(!(yield Hr.isInitialWrite(d))){let l=(yield this.messageStore.query(e,[{recordId:d.recordId,isLatestBaseState:!1,method:Ae.Write}])).messages[0];delete l.encodedData,d.initialWrite=l}return{status:{code:200,detail:"OK"},record:d}})}static authorizeRecordsRead(e,r,n,i){return Vle(this,void 0,void 0,function*(){be.isSignedByAuthorDelegate(r.message)&&(yield r.authorizeDelegate(n.message,i));let{descriptor:o}=n.message;if(r.author!==e){if(o.published===!0)return;if(r.author!==void 0&&r.author===o.recipient)return;if(r.author!==void 0&&r.signaturePayload.permissionGrantId!==void 0){let s=yield vi.fetchGrant(e,i,r.signaturePayload.permissionGrantId);yield Ho.authorizeRead({recordsReadMessage:r.message,recordsWriteMessageToBeRead:n.message,expectedGrantor:e,expectedGrantee:r.author,permissionGrant:s,messageStore:i})}else if(o.protocol!==void 0)yield Ac.authorizeRead(e,r,n,i);else throw new se(ne.RecordsReadAuthorizationFailed,"message failed authorization")}})}};h();h();var hU=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},zm=class t extends yi{static parse(e){return hU(this,void 0,void 0,function*(){let r;if(e.authorization!==void 0&&(r=yield be.validateSignatureStructure(e.authorization.signature,e.descriptor)),yield mt.validateDelegatedGrantReferentialIntegrity(e,r),r?.protocolRole!==void 0&&e.descriptor.filter.protocolPath===void 0)throw new se(ne.RecordsSubscribeFilterMissingRequiredProperties,"Role-authorized subscriptions must include `protocolPath` in the filter");return e.descriptor.filter.protocol!==void 0&&Ma(e.descriptor.filter.protocol),e.descriptor.filter.schema!==void 0&&vd(e.descriptor.filter.schema),ir.validateTimestamp(e.descriptor.messageTimestamp),new t(e)})}static create(e){var r;return hU(this,void 0,void 0,function*(){let n={interface:Oe.Records,method:Ae.Subscribe,messageTimestamp:(r=e.messageTimestamp)!==null&&r!==void 0?r:ir.getCurrentTimestamp(),filter:mt.normalizeFilter(e.filter)};En(n);let i=e.signer,o;i&&(o=yield be.createAuthorization({descriptor:n,signer:i,protocolRole:e.protocolRole,delegatedGrant:e.delegatedGrant}));let s={descriptor:n,authorization:o};return be.validateJsonSchema(s),new t(s)})}authorizeDelegate(e){return hU(this,void 0,void 0,function*(){let r=yield Eo.parse(this.message.authorization.authorDelegatedGrant);yield Ho.authorizeQueryOrSubscribe({incomingMessage:this.message,expectedGrantor:this.author,expectedGrantee:this.signer,permissionGrant:r,messageStore:e})})}};var 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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},wI=class t{constructor(e,r,n){this.didResolver=e,this.messageStore=r,this.eventStream=n}handle({tenant:e,message:r,subscriptionHandler:n}){return bI(this,void 0,void 0,function*(){if(this.eventStream===void 0)return tr(new se(ne.RecordsSubscribeEventStreamUnimplemented,"Subscriptions are not supported"),501);let i;try{i=yield zm.parse(r)}catch(u){return tr(u,400)}let o=[];if(mt.filterIncludesPublishedRecords(i.message.descriptor.filter)&&i.author===void 0)o=[t.buildPublishedRecordsFilter(i)],delete r.authorization;else{try{yield ei(r.authorization,this.didResolver),yield t.authorizeRecordsSubscribe(e,i,this.messageStore)}catch(u){return tr(u,401)}i.author===e?o=yield t.filterAsOwner(i):o=yield t.filterAsNonOwner(i)}let s=(u,c,l)=>{e===u&&Zn.matchAnyFilter(l,o)&&n(c)},a=yield be.getCid(r),d=yield this.eventStream.subscribe(e,a,s);return{status:{code:200,detail:"OK"},subscription:d}})}static filterAsOwner(e){return bI(this,void 0,void 0,function*(){let{filter:r}=e.message.descriptor;return[Object.assign(Object.assign({},mt.convertFilter(r)),{interface:Oe.Records,method:[Ae.Write,Ae.Delete]})]})}static filterAsNonOwner(e){return bI(this,void 0,void 0,function*(){let r=[],{filter:n}=e.message.descriptor;if(mt.filterIncludesPublishedRecords(n)&&r.push(t.buildPublishedRecordsFilter(e)),mt.filterIncludesUnpublishedRecords(n)){r.push(t.buildUnpublishedRecordsBySubscribeAuthorFilter(e));let i=e.message.descriptor.filter.recipient;(i===void 0||i===e.author)&&r.push(t.buildUnpublishedRecordsForSubscribeAuthorFilter(e)),mt.shouldProtocolAuthorize(e.signaturePayload)&&r.push(t.buildUnpublishedProtocolAuthorizedRecordsFilter(e))}return r})}static buildPublishedRecordsFilter(e){return Object.assign(Object.assign({},mt.convertFilter(e.message.descriptor.filter)),{interface:Oe.Records,method:[Ae.Write,Ae.Delete],published:!0})}static buildUnpublishedRecordsForSubscribeAuthorFilter(e){return Object.assign(Object.assign({},mt.convertFilter(e.message.descriptor.filter)),{interface:Oe.Records,method:[Ae.Write,Ae.Delete],recipient:e.author,published:!1})}static buildUnpublishedProtocolAuthorizedRecordsFilter(e){return Object.assign(Object.assign({},mt.convertFilter(e.message.descriptor.filter)),{interface:Oe.Records,method:[Ae.Write,Ae.Delete],published:!1})}static buildUnpublishedRecordsBySubscribeAuthorFilter(e){return Object.assign(Object.assign({},mt.convertFilter(e.message.descriptor.filter)),{author:e.author,interface:Oe.Records,method:[Ae.Write,Ae.Delete],published:!1})}static authorizeRecordsSubscribe(e,r,n){return bI(this,void 0,void 0,function*(){be.isSignedByAuthorDelegate(r.message)&&(yield r.authorizeDelegate(n)),mt.shouldProtocolAuthorize(r.signaturePayload)&&(yield Ac.authorizeQueryOrSubscribe(e,r,n))})}};h();var E1=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},_I=class t{constructor(e,r,n,i,o){this.didResolver=e,this.messageStore=r,this.dataStore=n,this.eventLog=i,this.eventStream=o}handle({tenant:e,message:r,dataStream:n}){return E1(this,void 0,void 0,function*(){let i;try{i=yield Hr.parse(r),r.descriptor.protocol!==void 0&&(yield Ac.validateReferentialIntegrity(e,i,this.messageStore))}catch(p){return tr(p,400)}try{yield ei(r.authorization,this.didResolver),yield t.authorizeRecordsWrite(e,i,this.messageStore)}catch(p){return tr(p,401)}let o={interface:Oe.Records,recordId:r.recordId},{messages:s}=yield this.messageStore.query(e,[o]),a=yield i.isInitialWrite(),d;if(!a)try{d=yield Hr.getInitialWrite(s),Hr.verifyEqualityOfImmutableProperties(d,r)}catch(p){return tr(p,400)}let u=yield be.getNewestMessage(s),c=!1,l;if(u===void 0||(yield be.isNewer(r,u))?(c=!0,l=r):l=u,!c)return{status:{code:409,detail:"Conflict"}};try{let p=!1,g=r;if(n!==void 0)g=yield this.processMessageWithDataStream(e,r,n),p=!0;else{if(u?.descriptor.method===Ae.Delete)throw new se(ne.RecordsWriteMissingDataStream,"No data stream was provided with the previous message being a delete");if(!a){let E=u;g=yield this.processMessageWithoutDataStream(e,r,E),p=!0}}let v=yield i.constructIndexes(p);yield this.messageStore.put(e,g,v),yield this.eventLog.append(e,yield be.getCid(r),v),this.eventStream!==void 0&&p&&this.eventStream.emit(e,{message:r,initialWrite:d},v)}catch(p){let g=p;if(g.code!==void 0&&(g.code===ne.RecordsWriteMissingEncodedDataInPrevious||g.code===ne.RecordsWriteMissingDataInPrevious||g.code===ne.RecordsWriteMissingDataStream||g.code===ne.RecordsWriteDataCidMismatch||g.code===ne.RecordsWriteDataSizeMismatch||g.code.startsWith("PermissionsProtocolValidate")||g.code.startsWith("SchemaValidator")))return tr(p,400);throw p}let m={status:{code:202,detail:"Accepted"}};return yield Cg.deleteAllOlderMessagesButKeepInitialWrite(e,s,l,this.messageStore,this.dataStore,this.eventLog),yield this.postProcessingForCoreRecordsWrite(e,i),m})}static validateSchemaForCoreRecordsWrite(e,r){e.descriptor.protocol===vi.uri&&vi.validateSchema(e,r)}postProcessingForCoreRecordsWrite(e,r){return E1(this,void 0,void 0,function*(){if(r.message.descriptor.protocol===vi.uri&&r.message.descriptor.protocolPath===vi.revocationPath){let i={permissionGrantId:r.message.descriptor.parentId,dateCreated:{gte:r.message.descriptor.messageTimestamp}},{messages:o}=yield this.messageStore.query(e,[i]),s=[];for(let a of o){let d=yield be.getCid(a);yield this.messageStore.delete(e,d)}this.eventLog.deleteEventsByCid(e,s)}})}cloneAndAddEncodedData(e,r){return E1(this,void 0,void 0,function*(){let n=Object.assign({},e);return n.encodedData=Ze.bytesToBase64Url(r),n})}processMessageWithDataStream(e,r,n){return E1(this,void 0,void 0,function*(){let i=r;if(r.descriptor.dataSize<=Zl.maxDataSizeAllowedToBeEncoded){let o=yield Pu.toBytes(n),s=yield Pn.computeDagPbCidFromBytes(o);t.validateDataIntegrity(r.descriptor.dataCid,r.descriptor.dataSize,s,o.length),t.validateSchemaForCoreRecordsWrite(r,o),i=yield this.cloneAndAddEncodedData(r,o)}else{let[o,s]=Pu.duplicateDataStream(n,2);try{let[a,d]=yield Promise.all([Pn.computeDagPbCidFromStream(o),this.dataStore.put(e,r.recordId,r.descriptor.dataCid,s)]);t.validateDataIntegrity(r.descriptor.dataCid,r.descriptor.dataSize,a,d.dataSize)}catch(a){throw yield this.dataStore.delete(e,r.recordId,r.descriptor.dataCid),a}}return i})}processMessageWithoutDataStream(e,r,n){return E1(this,void 0,void 0,function*(){let i=Object.assign({},r),{dataCid:o,dataSize:s}=r.descriptor;if(t.validateDataIntegrity(o,s,n.descriptor.dataCid,n.descriptor.dataSize),s<=Zl.maxDataSizeAllowedToBeEncoded)if(n.encodedData!==void 0)i.encodedData=n.encodedData;else throw new se(ne.RecordsWriteMissingEncodedDataInPrevious,"No dataStream was provided and unable to get data from previous message");else if((yield this.dataStore.get(e,n.recordId,r.descriptor.dataCid))===void 0)throw new se(ne.RecordsWriteMissingDataInPrevious,"No dataStream was provided and unable to get data from previous message");return i})}static validateDataIntegrity(e,r,n,i){if(e!==n)throw new se(ne.RecordsWriteDataCidMismatch,`actual data CID ${n} does not match dataCid in descriptor: ${e}`);if(r!==i)throw new se(ne.RecordsWriteDataSizeMismatch,`actual data size ${i} bytes does not match dataSize in descriptor: ${r}`)}static authorizeRecordsWrite(e,r,n){return E1(this,void 0,void 0,function*(){if(r.owner!==void 0&&r.owner!==e)throw new se(ne.RecordsWriteOwnerAndTenantMismatch,`Owner ${r.owner} must be the same as tenant ${e} when specified.`);if(r.isSignedByAuthorDelegate&&(yield r.authorizeAuthorDelegate(n)),r.isSignedByOwnerDelegate&&(yield r.authorizeOwnerDelegate(n)),r.owner===void 0){if(r.author===e)return;if(r.author!==void 0&&r.signaturePayload.permissionGrantId!==void 0){let i=yield vi.fetchGrant(e,n,r.signaturePayload.permissionGrantId);yield Ho.authorizeWrite({recordsWriteMessage:r.message,expectedGrantor:e,expectedGrantee:r.author,permissionGrant:i,messageStore:n})}else if(r.message.descriptor.protocol!==void 0)yield Ac.authorizeWrite(e,r,n);else throw new se(ne.RecordsWriteAuthorizationFailed,"message failed authorization")}})}};h();h();var $g;(function(t){t.authentication="authentication",t.assertionMethod="assertionMethod",t.keyAgreement="keyAgreement",t.capabilityInvocation="capabilityInvocation",t.capabilityDelegation="capabilityDelegation"})($g||($g={}));h();var ri={"@context":"https://w3id.org/did-resolution/v1",didResolutionMetadata:{},didDocument:null,didDocumentMetadata:{}};h();var _r=class t{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=t.DID_URI_PATTERN.exec(e);if(!r||!r.groups)return null;let{method:n,id:i,path:o,query:s,fragment:a}=r.groups,d={uri:`did:${n}:${i}`,method:n,id:i};if(o&&(d.path=o),s&&(d.query=s.slice(1)),a&&(d.fragment=a.slice(1)),s){let u={},c=s.slice(1).split("&");for(let l of c){let[m,p]=l.split("=");u[m]=p}d.params=u}return d}};_r.METHOD_PATTERN="([a-z0-9]+)";_r.PCT_ENCODED_PATTERN="(?:%[0-9a-fA-F]{2})";_r.ID_CHAR_PATTERN=`(?:[a-zA-Z0-9._-]|${_r.PCT_ENCODED_PATTERN})`;_r.METHOD_ID_PATTERN=`((?:${_r.ID_CHAR_PATTERN}*:)*(${_r.ID_CHAR_PATTERN}+))`;_r.PATH_PATTERN="(/[^#?]*)?";_r.QUERY_PATTERN="([?][^#]*)?";_r.FRAGMENT_PATTERN="(#.*)?";_r.DID_URI_PATTERN=new RegExp(`^did:(?${_r.METHOD_PATTERN}):(?${_r.METHOD_ID_PATTERN})(?${_r.PATH_PATTERN})(?${_r.QUERY_PATTERN})(?${_r.FRAGMENT_PATTERN})$`);h();var at=class t extends Error{constructor(e,r){super(`${e}: ${r}`),this.code=e,this.name="DidError",Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,t)}},tt;(function(t){t.InvalidDid="invalidDid",t.MethodNotSupported="methodNotSupported",t.InternalError="internalError",t.InvalidDidDocument="invalidDidDocument",t.InvalidDidDocumentLength="invalidDidDocumentLength",t.InvalidDidUrl="invalidDidUrl",t.InvalidPreviousDidProof="invalidPreviousDidProof",t.InvalidPublicKey="invalidPublicKey",t.InvalidPublicKeyLength="invalidPublicKeyLength",t.InvalidPublicKeyType="invalidPublicKeyType",t.InvalidSignature="invalidSignature",t.NotFound="notFound",t.RepresentationNotSupported="representationNotSupported",t.UnsupportedPublicKeyType="unsupportedPublicKeyType"})(tt||(tt={}));h();tn();h();Tr();tn();function Dc(t){if(typeof t=="string"&&t.length!==0)return t.split("#").pop()}function KL({didDocument:t}){var e,r;if(!t)throw new TypeError("Required parameter missing: 'didDocument'");let n=[];return n.push(...(r=(e=t.verificationMethod)===null||e===void 0?void 0:e.filter(LL))!==null&&r!==void 0?r:[]),Object.keys($g).forEach(i=>{var o,s;n.push(...(s=(o=t[i])===null||o===void 0?void 0:o.filter(LL))!==null&&s!==void 0?s:[])}),n}function Tye({didDocument:t}){let r=KL({didDocument:t}).map(n=>n.type);return[...new Set(r)]}function Iye({didDocument:t,methodId:e}){let r=[];return Object.keys($g).forEach(n=>{if(Array.isArray(t[n])){let i=t[n],o=Dc(e);i.some(a=>{let d=Dc(a)===o,u=LL(a)&&Dc(a.id)===o;return d||u})&&r.push(n)}}),r}function LL(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 FL({keyBytes:t,multicodecCode:e,multicodecName:r}){let n=bi.addPrefix({code:e,data:t,name:r}),i=de.uint8Array(n).toBase58Btc();return de.base58Btc(i).toMultibase()}function zL({multibaseKeyId:t}){try{let e=de.multibase(t).toBase58Btc(),r=de.base58Btc(e).toUint8Array(),{code:n,data:i,name:o}=bi.removePrefix({prefixedData:r});return{keyBytes:i,multicodecCode:n,multicodecName:o}}catch{throw new at(tt.InvalidDid,`Invalid multibase identifier: ${t}`)}}var l3=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Wa=class t{constructor({uri:e,document:r,metadata:n,keyManager:i}){this.uri=e,this.document=r,this.metadata=n,this.keyManager=i}export(){return l3(this,void 0,void 0,function*(){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=yield this.keyManager.getKeyUri({key:n.publicKeyJwk}),o=yield this.keyManager.exportKey({keyUri:i});r.push(Object.assign({},o))}e.privateKeys=r}return e})}getSigner(e){return l3(this,void 0,void 0,function*(){var r;let n=(r=this.document.verificationMethod)===null||r===void 0?void 0:r.find(d=>{var u,c;return Dc(d.id)===((u=Dc(e?.methodId))!==null&&u!==void 0?u:Dc((c=this.document.assertionMethod)===null||c===void 0?void 0:c[0]))});if(!(n&&n.publicKeyJwk))throw new at(tt.InternalError,"A verification method intended for signing could not be determined from the DID Document");let i=yield this.keyManager.getKeyUri({key:n.publicKeyJwk}),o=yield this.keyManager.getPublicKey({keyUri:i}),s=this.keyManager;return{algorithm:Mi.getJoseSignatureAlgorithmFromPublicKey(o),keyId:n.id,sign(d){return l3(this,arguments,void 0,function*({data:u}){return yield s.sign({data:u,keyUri:i})})},verify(d){return l3(this,arguments,void 0,function*({data:u,signature:c}){return yield s.verify({data:u,key:o,signature:c})})}}})}static import(e){return l3(this,arguments,void 0,function*({portableDid:r,keyManager:n=new Pr}){var i;let o=KL({didDocument:r.document});if(o.length===0)throw new at(tt.InvalidDidDocument,"At least one verification method is required but 0 were given");for(let a of(i=r.privateKeys)!==null&&i!==void 0?i:[])yield n.importKey({key:a});for(let a of o){if(!a.publicKeyJwk)throw new Error(`Verification method '${a.id}' does not contain a public key in JWK format`);let d=yield n.getKeyUri({key:a.publicKeyJwk});yield n.getPublicKey({keyUri:d})}return new t({uri:r.uri,document:r.document,metadata:r.metadata,keyManager:n})})}};h();XL();Tr();tn();cK();h();var f0e=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Nd=class{static getSigningMethod(e){return f0e(this,void 0,void 0,function*(){throw new Error("Not implemented: Classes extending DidMethod must implement getSigningMethod()")})}static resolve(e,r){return f0e(this,void 0,void 0,function*(){throw new Error("Not implemented: Classes extending DidMethod must implement resolve()")})}};var Do=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},h0e=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!(N.algorithm in y0e)))throw new Error("One or more verification method algorithms are not supported");let g=(i=r.verificationMethods)===null||i===void 0?void 0:i.filter(N=>"id"in N).map(N=>N.id);if(g&&g.length!==new Set(g).size)throw new Error("One or more verification method IDs are not unique");if(!((o=r.services)===null||o===void 0)&&o.some(N=>!N.id||!N.type||!N.serviceEndpoint))throw new Error("One or more services are missing required properties");let v=yield e.generateKey({algorithm:"Ed25519"}),E=yield e.getPublicKey({keyUri:v}),A=yield Ro.identityKeyToIdentifier({identityKey:E}),P=Object.assign(Object.assign({id:A},r.alsoKnownAs&&{alsoKnownAs:r.alsoKnownAs}),r.controllers&&{controller:r.controllers}),I=[...(s=r.verificationMethods)!==null&&s!==void 0?s:[]];I?.some(N=>{var K;return((K=N.id)===null||K===void 0?void 0:K.split("#").pop())==="0"})||I.unshift({algorithm:"Ed25519",id:"0",purposes:["authentication","assertionMethod","capabilityDelegation","capabilityInvocation"]});for(let N of I){let K=N.id&&N.id.split("#").pop()==="0"?v:yield e.generateKey({algorithm:N.algorithm}),F=yield e.getPublicKey({keyUri:K}),U=(d=(a=N.id)!==null&&a!==void 0?a:F.kid)!==null&&d!==void 0?d:yield it({jwk:F});U=`${A}#${Dc(U)}`,(u=P.verificationMethod)!==null&&u!==void 0||(P.verificationMethod=[]),P.verificationMethod.push({id:U,type:"JsonWebKey",controller:(c=N.controller)!==null&&c!==void 0?c:A,publicKeyJwk:F});for(let W of(l=N.purposes)!==null&&l!==void 0?l:[])P[W]||(P[W]=[]),P[W].push(U)}(m=r.services)===null||m===void 0||m.forEach(N=>{var K;(K=P.service)!==null&&K!==void 0||(P.service=[]),N.id=`${A}#${N.id.split("#").pop()}`,P.service.push(N)});let $=new Wa({uri:A,document:P,metadata:Object.assign({published:!1},r.types&&{types:r.types}),keyManager:e});if(!((p=r.publish)!==null&&p!==void 0)||p){let N=yield t.publish({did:$,gatewayUri:r.gatewayUri});$.metadata=N.didDocumentMetadata}return $})}static import(e){return Do(this,arguments,void 0,function*({portableDid:r,keyManager:n=new Pr}){var i;let o=_r.parse(r.uri);if(o?.method!==t.methodName)throw new at(tt.MethodNotSupported,"Method not supported");let s=yield Wa.import({portableDid:r,keyManager:n});if(!(!((i=s.document.verificationMethod)===null||i===void 0)&&i.some(a=>{var d;return((d=a.id)===null||d===void 0?void 0:d.split("#").pop())==="0"})))throw new at(tt.InvalidDidDocument,"DID document must contain an Identity Key");return s})}static getSigningMethod(e){return Do(this,arguments,void 0,function*({didDocument:r,methodId:n="#0"}){var i;let o=_r.parse(r.id);if(o&&o.method!==this.methodName)throw new at(tt.MethodNotSupported,`Method not supported: ${o.method}`);let s=(i=r.verificationMethod)===null||i===void 0?void 0:i.find(a=>{var d,u;return Dc(a.id)===((d=Dc(n))!==null&&d!==void 0?d:Dc((u=r.assertionMethod)===null||u===void 0?void 0:u[0]))});if(!(s&&s.publicKeyJwk))throw new at(tt.InternalError,"A verification method intended for signing could not be determined from the DID Document");return s})}static publish(e){return Do(this,arguments,void 0,function*({did:r,gatewayUri:n=p0e}){return yield ik.put({did:r,gatewayUri:n})})}static resolve(e){return Do(this,arguments,void 0,function*(r,n={}){var i;let o=(i=n?.gatewayUri)!==null&&i!==void 0?i:p0e;try{yield Ro.identifierToIdentityKey({didUri:r});let{didDocument:s,didDocumentMetadata:a}=yield ik.get({didUri:r,gatewayUri:o});return Object.assign(Object.assign({},ri),{didDocument:s,didDocumentMetadata:a})}catch(s){if(!(s instanceof at))throw new Error(s);return Object.assign(Object.assign({},ri),{didResolutionMetadata:Object.assign({error:s.code},s.message&&{errorMessage:s.message})})}})}};yv.methodName="dht";var ik=class t{static get(e){return Do(this,arguments,void 0,function*({didUri:r,gatewayUri:n}){let i=Ro.identifierToIdentityKeyBytes({didUri:r}),o=yield t.pkarrGet({gatewayUri:n,publicKeyBytes:i}),s=yield Ro.parseBep44GetMessage({bep44Message:o}),a=yield t.fromDnsPacket({didUri:r,dnsPacket:s});return a.didDocumentMetadata.versionId=o.seq.toString(),a})}static put(e){return Do(this,arguments,void 0,function*({did:r,gatewayUri:n}){let i=yield t.toDnsPacket({didDocument:r.document,didMetadata:r.metadata,authoritativeGatewayUris:[n]}),o=yield Ro.createBep44PutMessage({dnsPacket:i,publicKeyBytes:Ro.identifierToIdentityKeyBytes({didUri:r.uri}),signer:yield r.getSigner({methodId:"0"})}),s=yield t.pkarrPut({gatewayUri:n,bep44Message:o});return{didDocument:r.document,didDocumentMetadata:Object.assign(Object.assign({},r.metadata),{published:s,versionId:o.seq.toString()}),didRegistrationMetadata:{}}})}static pkarrGet(e){return Do(this,arguments,void 0,function*({gatewayUri:r,publicKeyBytes:n}){let i=de.uint8Array(n).toBase32Z(),o=new URL(i,r).href,s;try{if(s=yield fetch(o,{method:"GET"}),!s.ok)throw new at(tt.NotFound,`Pkarr record not found for: ${i}`)}catch(u){throw u instanceof at?u:new at(tt.InternalError,`Failed to fetch Pkarr record: ${u.message}`)}let a=yield s.arrayBuffer();if(!a)throw new at(tt.NotFound,`Pkarr record not found for: ${i}`);if(a.byteLength<72)throw new at(tt.InvalidDidDocumentLength,`Pkarr response must be at least 72 bytes but got: ${a.byteLength}`);if(a.byteLength>1072)throw new at(tt.InvalidDidDocumentLength,`Pkarr response exceeds 1000 byte limit: ${a.byteLength}`);return{k:n,seq:Number(new DataView(a).getBigUint64(64)),sig:new Uint8Array(a,0,64),v:new Uint8Array(a,72)}})}static pkarrPut(e){return Do(this,arguments,void 0,function*({gatewayUri:r,bep44Message:n}){let i=de.uint8Array(n.k).toBase32Z(),o=new URL(i,r).href,s=new Uint8Array(n.v.length+72);s.set(n.sig,0),new DataView(s.buffer).setBigUint64(n.sig.length,BigInt(n.seq)),s.set(n.v,n.sig.length+8);let a;try{a=yield fetch(o,{method:"PUT",headers:{"Content-Type":"application/octet-stream"},body:s})}catch(d){throw new at(tt.InternalError,`Failed to put Pkarr record for identifier ${i}: ${d.message}`)}return a.ok})}static fromDnsPacket(e){return Do(this,arguments,void 0,function*({didUri:r,dnsPacket:n}){var i,o,s;let a={id:r},d={published:!0},u=new Map;for(let c of(i=n?.answers)!==null&&i!==void 0?i:[]){if(c.type!=="TXT")continue;let l=c.name.split(".")[0].substring(1);switch(!0){case l.startsWith("aka"):{let m=Ro.parseTxtDataToString(c.data);a.alsoKnownAs=m.split(ya);break}case l.startsWith("cnt"):{let m=Ro.parseTxtDataToString(c.data);a.controller=m.includes(ya)?m.split(ya):m;break}case l.startsWith("k"):{let{id:m,t:p,k:g,c:v,a:E}=Ro.parseTxtDataToObject(c.data),A=de.base64Url(g).toUint8Array(),P=ga[Number(p)],I=yield Ro.keyConverter(P).bytesToPublicKey({publicKeyBytes:A});I.alg=E||m0e[Number(p)];let $=l==="k0"?"0":m!==void 0?m:yield it({jwk:I});(o=a.verificationMethod)!==null&&o!==void 0||(a.verificationMethod=[]);let N=`${r}#${$}`;a.verificationMethod.push({id:N,type:"JsonWebKey",controller:v??r,publicKeyJwk:I}),u.set(l,N);break}case l.startsWith("s"):{let m=Ro.parseTxtDataToObject(c.data),{id:p,t:g,se:v}=m,E=h0e(m,["id","t","se"]),A=v.includes(ya)?v.split(ya):[v],P=Object.fromEntries(Object.entries(E).map(([I,$])=>[I,$.includes(ya)?$.split(ya):$]));(s=a.service)!==null&&s!==void 0||(a.service=[]),a.service.push(Object.assign(Object.assign({},P),{id:`${r}#${p}`,type:g,serviceEndpoint:A}));break}case l.startsWith("typ"):{let{id:m}=Ro.parseTxtDataToObject(c.data);d.types=m.split(ya).map(p=>Number(p));break}case l.startsWith("did"):{let m=P=>P.split(ya).map(I=>u.get(I)).filter(I=>typeof I=="string"),{auth:p,asm:g,del:v,inv:E,agm:A}=Ro.parseTxtDataToObject(c.data);p&&(a.authentication=m(p)),g&&(a.assertionMethod=m(g)),v&&(a.capabilityDelegation=m(v)),E&&(a.capabilityInvocation=m(E)),A&&(a.keyAgreement=m(A));break}}}return{didDocument:a,didDocumentMetadata:d,didResolutionMetadata:{}}})}static toDnsPacket(e){return Do(this,arguments,void 0,function*({didDocument:r,didMetadata:n,authoritativeGatewayUris:i,previousDidProof:o}){var s,a,d,u,c;let l=[],m=[],p=new Map,g=[],v=[];if(o!==void 0){let{signature:P,previousDid:I}=o;yield Ro.validatePreviousDidProof({newDid:r.id,previousDidProof:o}),l.push({type:"TXT",name:"_prv._did.",ttl:my,data:`id=${I};s=${P}`})}if(r.alsoKnownAs&&l.push({type:"TXT",name:"_aka._did.",ttl:my,data:r.alsoKnownAs.join(ya)}),r.controller){let P=Array.isArray(r.controller)?r.controller.join(ya):r.controller;l.push({type:"TXT",name:"_cnt._did.",ttl:my,data:P})}for(let[P,I]of(a=(s=r.verificationMethod)===null||s===void 0?void 0:s.entries())!==null&&a!==void 0?a:[]){let $=`k${P}`;v.push($);let N=I.id.split("#").pop();p.set(N,$);let K=I.publicKeyJwk;if(!(K?.crv&&K.crv in y0e))throw new at(tt.InvalidPublicKeyType,`Verification method '${I.id}' contains an unsupported key type: ${(d=K?.crv)!==null&&d!==void 0?d:"undefined"}`);let F=ga[K.crv],U=yield Ro.keyConverter(K.crv).publicKeyToBytes({publicKey:K}),W=de.uint8Array(U).toBase64Url(),L=[`t=${F}`,`k=${W}`];N!=="0"&&(yield it({jwk:K}))!==N&&L.unshift(`id=${N}`),K.alg!==m0e[F]&&L.push(`a=${K.alg}`),I.controller!==r.id&&L.push(`c=${I.controller}`),l.push({type:"TXT",name:`_${$}._did.`,ttl:my,data:L.join(nk)})}(u=r.service)===null||u===void 0||u.forEach((P,I)=>{let $=`s${I}`;g.push($);let{id:N,type:K,serviceEndpoint:F}=P,U=h0e(P,["id","type","serviceEndpoint"]);N=Dc(N),F=Array.isArray(F)?F.join(","):F;let L=Object.entries(Object.assign({id:N,t:K,se:F},U)).map(([S,k])=>`${S}=${k}`).join(nk),T=Ro.chunkDataIfNeeded(L);l.push({type:"TXT",name:`_${$}._did.`,ttl:my,data:T})});let E=[`v=${QYe}`];if(v.length&&E.push(`vm=${v.join(ya)}`),Object.keys($g).forEach(P=>{var I;let $=(I=r[P])===null||I===void 0?void 0:I.map(N=>p.get(N.split("#").pop()));if($){let N=uK[P];E.push(`${N}=${$.join(ya)}`)}}),g.length&&E.push(`svc=${g.join(ya)}`),!((c=n.types)===null||c===void 0)&&c.length){let I=n.types.map($=>typeof $=="string"?dK[$]:$);l.push({type:"TXT",name:"_typ._did.",ttl:my,data:`id=${I.join(ya)}`})}l.push({type:"TXT",name:"_did."+t.getUniqueDidSuffix(r.id)+".",ttl:my,data:E.join(nk)});for(let P of i||[])m.push({type:"NS",name:"_did."+t.getUniqueDidSuffix(r.id)+".",ttl:my,data:P+"."});return{id:0,type:"response",flags:rk,answers:[...l,...m]}})}static getUniqueDidSuffix(e){return e.split(":")[2]}},Ro=class t{static createBep44PutMessage(e){return Do(this,arguments,void 0,function*({dnsPacket:r,publicKeyBytes:n,signer:i}){let o=Math.ceil(Date.now()/1e3),s=mv(r),a=G1.encode({seq:o,v:s}).subarray(1,-1);if(a.length>1e3)throw new at(tt.InvalidDidDocumentLength,`DNS packet exceeds the 1000 byte maximum size: ${a.length} bytes`);let d=yield i.sign({data:a});return{k:n,seq:o,sig:d,v:s}})}static identifierToIdentityKey(e){return Do(this,arguments,void 0,function*({didUri:r}){let n=t.identifierToIdentityKeyBytes({didUri:r});return yield nr.bytesToPublicKey({publicKeyBytes:n})})}static identifierToIdentityKeyBytes({didUri:e}){let r=_r.parse(e);if(!r)throw new at(tt.InvalidDid,`Invalid DID URI: ${e}`);if(r.method!==yv.methodName)throw new at(tt.MethodNotSupported,`Method not supported: ${r.method}`);let n;try{n=de.base32Z(r.id).toUint8Array()}catch{throw new at(tt.InvalidPublicKey,"Failed to decode method-specific identifier")}if(n.length!==32)throw new at(tt.InvalidPublicKeyLength,`Invalid public key length: ${n.length}`);return n}static identityKeyToIdentifier(e){return Do(this,arguments,void 0,function*({identityKey:r}){let n=yield nr.publicKeyToBytes({publicKey:r}),i=de.uint8Array(n).toBase32Z();return`did:${yv.methodName}:${i}`})}static keyConverter(e){let n={Ed25519:nr,"P-256":{publicKeyToBytes:i=>Do(this,[i],void 0,function*({publicKey:o}){let s=yield Nr.publicKeyToBytes({publicKey:o});return yield Nr.compressPublicKey({publicKeyBytes:s})}),bytesToPublicKey:Nr.bytesToPublicKey,privateKeyToBytes:Nr.privateKeyToBytes,bytesToPrivateKey:Nr.bytesToPrivateKey},secp256k1:{publicKeyToBytes:i=>Do(this,[i],void 0,function*({publicKey:o}){let s=yield Ir.publicKeyToBytes({publicKey:o});return yield Ir.compressPublicKey({publicKeyBytes:s})}),bytesToPublicKey:Ir.bytesToPublicKey,privateKeyToBytes:Ir.privateKeyToBytes,bytesToPrivateKey:Ir.bytesToPrivateKey},X25519:df}[e];if(!n)throw new at(tt.InvalidPublicKeyType,`Unsupported curve: ${e}`);return n}static parseBep44GetMessage(e){return Do(this,arguments,void 0,function*({bep44Message:r}){let n=yield nr.bytesToPublicKey({publicKeyBytes:r.k}),i=G1.encode({seq:r.seq,v:r.v}).subarray(1,-1);if(!(yield nr.verify({key:n,signature:r.sig,data:i})))throw new at(tt.InvalidSignature,"Invalid signature for DHT BEP44 message");return n2(r.v)})}static parseTxtDataToObject(e){return this.parseTxtDataToString(e).split(nk).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 de.uint8Array(e).toString();if(Array.isArray(e))return e.map(r=>this.parseTxtDataToString(r)).join("");throw new at(tt.InternalError,"Pkarr returned DNS TXT record with invalid data type")}static validatePreviousDidProof(e){return Do(this,arguments,void 0,function*({newDid:r,previousDidProof:n}){let i=yield t.identifierToIdentityKey({didUri:n.previousDid}),o=t.identifierToIdentityKeyBytes({didUri:r}),s=de.base64Url(n.signature).toUint8Array();if(!(yield nr.verify({key:i,data:o,signature:s})))throw new at(tt.InvalidPreviousDidProof,"The previous DID proof is invalid.")})}static chunkDataIfNeeded(e){if(e.length<=255)return e;let r=[];for(let n=0;n!(N.algorithm in eZe)))throw new Error("One or more verification method algorithms are not supported");let c=(i=r.verificationMethods)===null||i===void 0?void 0:i.filter(N=>"id"in N).map(N=>N.id);if(c&&c.length!==new Set(c).size)throw new Error("One or more verification method IDs are not unique");if(!((o=r.services)===null||o===void 0)&&o.some(N=>!N.id||!N.type||!N.serviceEndpoint))throw new Error("One or more services are missing required properties");let l={algorithm:"Ed25519",purposes:["authentication","assertionMethod","capabilityDelegation","capabilityInvocation"]},m=[];for(let N of(s=r.verificationMethods)!==null&&s!==void 0?s:[l]){let K=yield e.generateKey({algorithm:N.algorithm}),F=yield e.getPublicKey({keyUri:K});m.push({id:N.id,publicKeyJwk:F,purposes:(a=N.purposes)!==null&&a!==void 0?a:["authentication","assertionMethod","capabilityDelegation","capabilityInvocation"]})}let p=yield e.generateKey({algorithm:pf.secp256k1}),g=yield e.getPublicKey({keyUri:p}),v=yield e.generateKey({algorithm:pf.secp256k1}),E=yield e.getPublicKey({keyUri:v}),A=yield vv.computeLongFormDidUri({recoveryKey:g,updateKey:E,services:(d=r.services)!==null&&d!==void 0?d:[],verificationMethods:m}),{didDocument:P,didResolutionMetadata:I}=yield t.resolve(A,{gatewayUri:r.gatewayUri});if(P===null)throw new Error(`Unable to resolve DID during creation: ${I?.error}`);let $=new Wa({uri:A,document:P,metadata:{published:!1,canonicalId:A.split(":",3).join(":"),recoveryKey:g,updateKey:E},keyManager:e});if(!((u=r.publish)!==null&&u!==void 0)||u){let N=yield t.publish({did:$,gatewayUri:r.gatewayUri});$.metadata=N.didDocumentMetadata}return $})}static getSigningMethod(e){return gy(this,arguments,void 0,function*({didDocument:r,methodId:n}){var i;let o=_r.parse(r.id);if(o&&o.method!==this.methodName)throw new at(tt.MethodNotSupported,`Method not supported: ${o.method}`);let s=(i=r.verificationMethod)===null||i===void 0?void 0:i.find(a=>{var d;return a.id===(n??((d=r.assertionMethod)===null||d===void 0?void 0:d[0]))});if(!(s&&s.publicKeyJwk))throw new at(tt.InternalError,"A verification method intended for signing could not be determined from the DID Document");return s})}static import(e){return gy(this,arguments,void 0,function*({portableDid:r,keyManager:n=new Pr}){let i=_r.parse(r.uri);if(i?.method!==t.methodName)throw new at(tt.MethodNotSupported,"Method not supported");return yield Wa.import({portableDid:r,keyManager:n})})}static publish(e){return gy(this,arguments,void 0,function*({did:r,gatewayUri:n=D0e}){var i,o,s;let a=(o=(i=r.document.verificationMethod)===null||i===void 0?void 0:i.map(c=>({id:c.id,publicKeyJwk:c.publicKeyJwk,purposes:Iye({didDocument:r.document,methodId:c.id})})))!==null&&o!==void 0?o:[],d=yield vv.createIonDocument({services:(s=r.document.service)!==null&&s!==void 0?s:[],verificationMethods:a}),u=yield vv.constructCreateRequest({ionDocument:d,recoveryKey:r.metadata.recoveryKey,updateKey:r.metadata.updateKey});try{let c=vv.appendPathToUrl({baseUrl:n,path:"/operations"}),l=yield fetch(c,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});return{didDocument:r.document,didDocumentMetadata:Object.assign(Object.assign({},r.metadata),{published:l.ok}),didRegistrationMetadata:{}}}catch{return{didDocument:null,didDocumentMetadata:{published:!1},didRegistrationMetadata:{error:tt.InternalError,errorMessage:`Failed to publish DID document for: ${r.uri}`}}}})}static resolve(e){return gy(this,arguments,void 0,function*(r,n={}){var i,o;let s=_r.parse(r);if(!s)return Object.assign(Object.assign({},ri),{didResolutionMetadata:{error:"invalidDid"}});if(s.method!==t.methodName)return Object.assign(Object.assign({},ri),{didResolutionMetadata:{error:"methodNotSupported"}});let a=(i=n?.gatewayUri)!==null&&i!==void 0?i:D0e;try{let d=vv.appendPathToUrl({baseUrl:a,path:`/identifiers/${r}`}),u=yield fetch(d);if(!u.ok)throw new at(tt.NotFound,`Unable to find DID document for: ${r}`);let{didDocument:c,didDocumentMetadata:l}=yield u.json();return Object.assign(Object.assign(Object.assign({},ri),c&&{didDocument:c}),{didDocumentMetadata:Object.assign({published:(o=l?.method)===null||o===void 0?void 0:o.published},l)})}catch(d){if(!(d instanceof at))throw new Error(d);return Object.assign(Object.assign({},ri),{didResolutionMetadata:Object.assign({error:d.code},d.message&&{errorMessage:d.message})})}})}};I3.methodName="ion";var vv=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 computeLongFormDidUri(e){return gy(this,arguments,void 0,function*({recoveryKey:r,updateKey:n,services:i,verificationMethods:o}){let s=yield t.createIonDocument({services:i,verificationMethods:o}),a=t.normalizeJwk(r),d=t.normalizeJwk(n);return yield yy.createLongFormDid({document:s,recoveryKey:a,updateKey:d})})}static constructCreateRequest(e){return gy(this,arguments,void 0,function*({ionDocument:r,recoveryKey:n,updateKey:i}){return yield hf.createCreateRequest({document:r,recoveryKey:t.normalizeJwk(n),updateKey:t.normalizeJwk(i)})})}static createIonDocument(e){return gy(this,arguments,void 0,function*({services:r,verificationMethods:n}){var i,o;let s=[];for(let u of n){let c=(o=(i=u.id)!==null&&i!==void 0?i:u.publicKeyJwk.kid)!==null&&o!==void 0?o:yield it({jwk:u.publicKeyJwk});c=`${c.split("#").pop()}`;let l={id:c,publicKeyJwk:t.normalizeJwk(u.publicKeyJwk),purposes:u.purposes,type:"JsonWebKey2020"};s.push(l)}let a=r.map(u=>Object.assign(Object.assign({},u),{id:`${u.id.split("#").pop()}`}));return{publicKeys:s,services:a}})}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}};h();Tr();tn();var dk=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},gK=class t extends Nd{static create(){return dk(this,arguments,void 0,function*({keyManager:e=new Pr,options:r={}}={}){var n,i,o,s;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 a=(s=(n=r.algorithm)!==null&&n!==void 0?n:(o=(i=r.verificationMethods)===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.algorithm)!==null&&s!==void 0?s:"Ed25519",d=yield e.generateKey({algorithm:a}),u=yield e.getPublicKey({keyUri:d}),c=de.object(u).toBase64Url(),l=`did:${t.methodName}:${c}`,p=(yield t.resolve(l)).didDocument;return new Wa({uri:l,document:p,metadata:{},keyManager:e})})}static getSigningMethod(e){return dk(this,arguments,void 0,function*({didDocument:r}){var n;let i=_r.parse(r.id);if(i&&i.method!==this.methodName)throw new at(tt.MethodNotSupported,`Method not supported: ${i.method}`);let[o]=(n=r.verificationMethod)!==null&&n!==void 0?n:[];if(!(o&&o.publicKeyJwk))throw new at(tt.InternalError,"A verification method intended for signing could not be determined from the DID Document");return o})}static import(e){return dk(this,arguments,void 0,function*({portableDid:r,keyManager:n=new Pr}){let i=_r.parse(r.uri);if(i?.method!==t.methodName)throw new at(tt.MethodNotSupported,"Method not supported");let o=yield Wa.import({portableDid:r,keyManager:n});if(o.document.verificationMethod.length!==1)throw new at(tt.InvalidDidDocument,"DID document must contain exactly one verification method");return o})}static resolve(e,r){return dk(this,void 0,void 0,function*(){let n=_r.parse(e),i;try{i=de.base64Url(n.id).toObject()}catch{}if(!n||!i)return Object.assign(Object.assign({},ri),{didResolutionMetadata:{error:"invalidDid"}});if(n.method!==t.methodName)return Object.assign(Object.assign({},ri),{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 Object.assign(Object.assign({},ri),{didDocument:o})})}};gK.methodName="jwk";h();Tr();tn();var Lu=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Wh;(function(t){t.Ed25519="Ed25519",t.secp256k1="secp256k1",t.secp256r1="secp256r1",t.X25519="X25519"})(Wh||(Wh={}));var vK={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"},tZe={Ed25519:Wh.Ed25519,ES256K:Wh.secp256k1,ES256:Wh.secp256r1,"P-256":Wh.secp256r1,secp256k1:Wh.secp256k1,secp256r1:Wh.secp256r1,X25519:Wh.X25519},o2=class t extends Nd{static create(){return Lu(this,arguments,void 0,function*({keyManager:e=new Pr,options:r={}}={}){var n,i,o,s;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 a=(s=(n=r.algorithm)!==null&&n!==void 0?n:(o=(i=r.verificationMethods)===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.algorithm)!==null&&s!==void 0?s:"Ed25519",d=yield e.generateKey({algorithm:a}),u=yield e.getPublicKey({keyUri:d}),c=yield Ga.publicKeyToMultibaseId({publicKey:u}),l=`did:${t.methodName}:${c}`,p=(yield t.resolve(l,r)).didDocument;return new Wa({uri:l,document:p,metadata:{},keyManager:e})})}static getSigningMethod(e){return Lu(this,arguments,void 0,function*({didDocument:r}){var n;let i=_r.parse(r.id);if(i&&i.method!==this.methodName)throw new at(tt.MethodNotSupported,`Method not supported: ${i.method}`);let[o]=r.assertionMethod||[],s=(n=r.verificationMethod)===null||n===void 0?void 0:n.find(a=>a.id===o);if(!(s&&s.publicKeyJwk))throw new at(tt.InternalError,"A verification method intended for signing could not be determined from the DID Document");return s})}static import(e){return Lu(this,arguments,void 0,function*({portableDid:r,keyManager:n=new Pr}){let i=_r.parse(r.uri);if(i?.method!==t.methodName)throw new at(tt.MethodNotSupported,"Method not supported");let o=yield Wa.import({portableDid:r,keyManager:n});if(o.document.verificationMethod.length!==1)throw new at(tt.InvalidDidDocument,"DID document must contain exactly one verification method");return o})}static resolve(e,r){return Lu(this,void 0,void 0,function*(){try{let n=yield t.createDocument({didUri:e,options:r});return Object.assign(Object.assign({},ri),{didDocument:n})}catch(n){if(!(n instanceof at))throw new Error(n);return Object.assign(Object.assign({},ri),{didResolutionMetadata:Object.assign({error:n.code},n.message&&{errorMessage:n.message})})}})}static createDocument(e){return Lu(this,arguments,void 0,function*({didUri:r,options:n={}}){let{defaultContext:i="https://www.w3.org/ns/did/v1",enableEncryptionKeyDerivation:o=!1,enableExperimentalPublicKeyTypes:s=!1,publicKeyFormat:a="JsonWebKey2020"}=n,d={id:""},u=_r.parse(r);if(!u)throw new at(tt.InvalidDid,`Invalid DID URI: ${r}`);let c=u.id;if(u.method!==t.methodName)throw new at(tt.MethodNotSupported,`Method not supported: ${u.method}`);if(!t.validateIdentifier(u))throw new at(tt.InvalidDid,`Invalid DID URI: ${r}`);let l=yield t.createSignatureMethod({didUri:r,multibaseValue:c,options:{enableExperimentalPublicKeyTypes:s,publicKeyFormat:a}});if(d.id=u.uri,d.verificationMethod=[l],d.authentication=[l.id],d.assertionMethod=[l.id],d.capabilityInvocation=[l.id],d.capabilityDelegation=[l.id],o===!0){let g=a==="Ed25519VerificationKey2020"?"X25519KeyAgreementKey2020":"JsonWebKey2020",v=yield this.createEncryptionMethod({didUri:r,multibaseValue:c,options:{enableExperimentalPublicKeyTypes:s,publicKeyFormat:g}});d.verificationMethod.push(v),d.keyAgreement=[v.id]}let m=[i];return Tye({didDocument:d}).forEach(g=>{let v=vK[g];m.push(v)}),d["@context"]=m,d})}static createEncryptionMethod(e){return Lu(this,arguments,void 0,function*({didUri:r,multibaseValue:n,options:i}){let{enableExperimentalPublicKeyTypes:o,publicKeyFormat:s}=i,a={id:"",type:"",controller:""},{keyBytes:d,multicodecCode:u}=yield t.deriveEncryptionKey({multibaseValue:n}),c=d.byteLength,l=Ga.MULTICODEC_PUBLIC_KEY_LENGTH[u];if(c!==l)throw new at(tt.InvalidPublicKeyLength,`Expected ${c} bytes. Actual: ${l}`);let m=FL({keyBytes:d,multicodecCode:u});a.id=`${r}#${m}`;try{new URL(a.id)}catch{throw new at(tt.InvalidDidUrl,"Verification Method ID is not a valid DID URL.")}if(!(s in vK))throw new at(tt.UnsupportedPublicKeyType,`Unsupported format: ${s}`);if(o===!1&&!["Multikey","JsonWebKey2020","X25519KeyAgreementKey2020"].includes(s))throw new at(tt.InvalidPublicKeyType,`Specified '${s}' without setting enableExperimentalPublicKeyTypes to true.`);if(a.type=s,a.controller=r,s==="X25519KeyAgreementKey2020"&&(a.publicKeyMultibase=m),s==="JsonWebKey2020"){let{crv:g}=yield Ga.multicodecToJwk({code:u});a.publicKeyJwk=yield Ga.keyConverter(g).bytesToPublicKey({publicKeyBytes:d})}return a})}static createSignatureMethod(e){return Lu(this,arguments,void 0,function*({didUri:r,multibaseValue:n,options:i}){let{enableExperimentalPublicKeyTypes:o,publicKeyFormat:s}=i,a={id:"",type:"",controller:""},{keyBytes:d,multicodecCode:u,multicodecName:c}=zL({multibaseKeyId:n}),l=d.byteLength,m=Ga.MULTICODEC_PUBLIC_KEY_LENGTH[u];if(l!==m)throw new at(tt.InvalidPublicKeyLength,`Expected ${l} bytes. Actual: ${m}`);let p=!1;switch(c){case"secp256k1-pub":p=yield Ir.validatePublicKey({publicKeyBytes:d});break;case"ed25519-pub":p=yield nr.validatePublicKey({publicKeyBytes:d});break;case"x25519-pub":p=!0;break}if(!p)throw new at(tt.InvalidPublicKey,"Invalid public key detected.");a.id=`${r}#${n}`;try{new URL(a.id)}catch{throw new at(tt.InvalidDidUrl,"Verification Method ID is not a valid DID URL.")}if(!(s in vK))throw new at(tt.UnsupportedPublicKeyType,`Unsupported format: ${s}`);if(o===!1&&!["Multikey","JsonWebKey2020","Ed25519VerificationKey2020"].includes(s))throw new at(tt.InvalidPublicKeyType,`Specified '${s}' without setting enableExperimentalPublicKeyTypes to true.`);if(a.type=s,a.controller=r,s==="Ed25519VerificationKey2020"&&(a.publicKeyMultibase=n),s==="JsonWebKey2020"){let{crv:v}=yield Ga.multicodecToJwk({code:u});a.publicKeyJwk=yield Ga.keyConverter(v).bytesToPublicKey({publicKeyBytes:d})}return a})}static deriveEncryptionKey(e){return Lu(this,arguments,void 0,function*({multibaseValue:r}){let n={keyBytes:new Uint8Array,multicodecCode:0},{keyBytes:i,multicodecCode:o}=zL({multibaseKeyId:r});if(o===237){let s=yield Ga.keyConverter("Ed25519").bytesToPublicKey({publicKeyBytes:i}),a=yield nr.convertPublicKeyToX25519({publicKey:s});n={keyBytes:yield Ga.keyConverter("Ed25519").publicKeyToBytes({publicKey:a}),multicodecCode:236}}return n})}static validateIdentifier(e){let{method:r,id:n}=e,[i]=e.uri.split(":",1);return i==="did"&&r==="key"&&Number("1")>0&&Xl(n)==="String"&&n.startsWith("z")}};o2.methodName="key";var Ga=class t{static jwkToMulticodec(e){return Lu(this,arguments,void 0,function*({jwk:r}){let n=[];r.crv&&(n.push(r.crv),r.d?n.push("private"):n.push("public"));let i=n.join(":"),o=t.JWK_TO_MULTICODEC[i];if(o===void 0)throw new Error(`Unsupported JWK to Multicodec conversion: '${i}'`);return{code:bi.getCodeFromName({name:o}),name:o}})}static keyCompressor(e){let n={"P-256":Nr.compressPublicKey,secp256k1:Ir.compressPublicKey}[e];if(!n)throw new at(tt.InvalidPublicKeyType,`Unsupported curve: ${e}`);return n}static keyConverter(e){let n={Ed25519:nr,"P-256":Nr,secp256k1:Ir,X25519:df}[e];if(!n)throw new at(tt.InvalidPublicKeyType,`Unsupported curve: ${e}`);return n}static multicodecToJwk(e){return Lu(this,arguments,void 0,function*({code:r,name:n}){if(!(n?!r:r))throw new Error("Either 'name' or 'code' must be defined, but not both.");n=n===void 0?bi.getNameFromCode({code:r}):n;let i=n,o=t.MULTICODEC_TO_JWK[i];if(o===void 0)throw new Error("Unsupported Multicodec to JWK conversion");return Object.assign({},o)})}static publicKeyToMultibaseId(e){return Lu(this,arguments,void 0,function*({publicKey:r}){var n;if(!(r?.crv&&r.crv in tZe))throw new at(tt.InvalidPublicKeyType,`Public key contains an unsupported key type: ${(n=r?.crv)!==null&&n!==void 0?n:"undefined"}`);let i=yield t.keyConverter(r.crv).publicKeyToBytes({publicKey:r});/^(secp256k1|P-256|P-384|P-521)$/.test(r.crv)&&(i=yield t.keyCompressor(r.crv)({publicKeyBytes:i}));let{name:o}=yield t.jwkToMulticodec({jwk:r});return FL({keyBytes:i,multicodecName:o})})}};Ga.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"};Ga.MULTICODEC_PUBLIC_KEY_LENGTH={231:33,236:32,237:32};Ga.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:""}};h();var rZe=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},bK=class t extends Nd{static resolve(e,r){return rZe(this,void 0,void 0,function*(){let n=_r.parse(e);if(!n)return Object.assign(Object.assign({},ri),{didResolutionMetadata:{error:"invalidDid"}});if(n.method!==t.methodName)return Object.assign(Object.assign({},ri),{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=yield fetch(o);if(!s.ok)throw new Error("HTTP error status code returned");let a=yield s.json();return Object.assign(Object.assign({},ri),{didDocument:a})}catch{return Object.assign(Object.assign({},ri),{didResolutionMetadata:{error:"notFound"}})}})}};bK.methodName="web";h();var C0e=Kt(wv(),1),O0e=Kt(wK(),1),cZe=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},lk=class{constructor({db:e,location:r="DATA/DID_RESOLVERCACHE",ttl:n="15m"}={}){this.cache=e??new O0e.Level(r),this.ttl=(0,C0e.default)(n)}get(e){return cZe(this,void 0,void 0,function*(){try{let r=yield 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()}};h();var $0e={get:function(t){return null},set:function(t,e){return null},delete:function(t){return null},clear:function(){return null},close:function(){return null}};h();var N0e=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},fk=class{constructor({cache:e,didResolvers:r}){this.didResolvers=new Map,this.cache=e||$0e;for(let n of r)this.didResolvers.set(n.methodName,n)}resolve(e,r){return N0e(this,void 0,void 0,function*(){let n=_r.parse(e);if(!n)return Object.assign(Object.assign({},ri),{didResolutionMetadata:{error:tt.InvalidDid,errorMessage:`Invalid DID URI: ${e}`}});let i=this.didResolvers.get(n.method);if(!i)return Object.assign(Object.assign({},ri),{didResolutionMetadata:{error:tt.MethodNotSupported,errorMessage:`Method not supported: ${n.method}`}});let o=yield this.cache.get(n.uri);if(o)return o;{let s=yield i.resolve(n.uri,r);return s.didResolutionMetadata.error||(yield this.cache.set(n.uri,s)),s}})}dereference(e,r){return N0e(this,void 0,void 0,function*(){let n=_r.parse(e);if(!n)return{dereferencingMetadata:{error:tt.InvalidDidUrl},contentStream:null,contentMetadata:{}};let{didDocument:i,didResolutionMetadata:o,didDocumentMetadata:s}=yield 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:a=[],verificationMethod:d=[]}=i,u=new Set([e,n.fragment,`#${n.fragment}`]),c;for(let l of d)if(u.has(l.id)){c=l;break}for(let l of a)if(u.has(l.id)){c=l;break}return c?{dereferencingMetadata:{contentType:"application/did+json"},contentStream:c,contentMetadata:o}:{dereferencingMetadata:{error:tt.NotFound},contentStream:null,contentMetadata:{}}})}};var d2=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},P3=class t{constructor(e){this.didResolver=e.didResolver,this.tenantGate=e.tenantGate,this.eventStream=e.eventStream,this.messageStore=e.messageStore,this.dataStore=e.dataStore,this.eventLog=e.eventLog,this.eventStream=e.eventStream,this.methodHandlers={[Oe.Events+Ae.Get]:new RT(this.didResolver,this.eventLog),[Oe.Events+Ae.Query]:new DT(this.didResolver,this.eventLog),[Oe.Events+Ae.Subscribe]:new BT(this.didResolver,this.eventStream),[Oe.Messages+Ae.Get]:new MT(this.didResolver,this.messageStore,this.dataStore),[Oe.Protocols+Ae.Configure]:new fI(this.didResolver,this.messageStore,this.eventLog,this.eventStream),[Oe.Protocols+Ae.Query]:new pI(this.didResolver,this.messageStore,this.dataStore),[Oe.Records+Ae.Delete]:new yI(this.didResolver,this.messageStore,this.dataStore,this.eventLog,this.eventStream),[Oe.Records+Ae.Query]:new gI(this.didResolver,this.messageStore,this.dataStore),[Oe.Records+Ae.Read]:new vI(this.didResolver,this.messageStore,this.dataStore),[Oe.Records+Ae.Subscribe]:new wI(this.didResolver,this.messageStore,this.eventStream),[Oe.Records+Ae.Write]:new _I(this.didResolver,this.messageStore,this.dataStore,this.eventLog,this.eventStream)}}static create(e){var r,n;return d2(this,void 0,void 0,function*(){(r=e.didResolver)!==null&&r!==void 0||(e.didResolver=new fk({didResolvers:[yv,I3,o2],cache:new lk({location:"RESOLVERCACHE"})})),(n=e.tenantGate)!==null&&n!==void 0||(e.tenantGate=new KE);let i=new t(e);return yield i.open(),i})}open(){var e;return d2(this,void 0,void 0,function*(){yield this.messageStore.open(),yield this.dataStore.open(),yield this.eventLog.open(),yield(e=this.eventStream)===null||e===void 0?void 0:e.open()})}close(){var e;return d2(this,void 0,void 0,function*(){yield(e=this.eventStream)===null||e===void 0?void 0:e.close(),yield this.messageStore.close(),yield this.dataStore.close(),yield this.eventLog.close()})}processMessage(e,r,n={}){var i;return d2(this,void 0,void 0,function*(){let o=(i=yield this.validateTenant(e))!==null&&i!==void 0?i:yield this.validateMessageIntegrity(r);if(o!==void 0)return o;let{dataStream:s,subscriptionHandler:a}=n,d=r.descriptor.interface+r.descriptor.method;return yield this.methodHandlers[d].handle({tenant:e,message:r,dataStream:s,subscriptionHandler:a})})}validateTenant(e){var r;return d2(this,void 0,void 0,function*(){let n=yield this.tenantGate.isActiveTenant(e);if(!n.isActiveTenant)return{status:{code:401,detail:(r=n.detail)!==null&&r!==void 0?r:`DID ${e} is not an active tenant.`}}})}validateMessageIntegrity(e){var r,n;return d2(this,void 0,void 0,function*(){let i=(r=e?.descriptor)===null||r===void 0?void 0:r.interface,o=(n=e?.descriptor)===null||n===void 0?void 0:n.method;if(i===void 0||o===void 0)return{status:{code:400,detail:`Both interface and method must be present, interface: ${i}, method: ${o}`}};try{be.validateJsonSchema(e)}catch(s){return tr(s,400)}})}};h();var dZe=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})};function uZe(t){return new Promise((e,r)=>{if(t.aborted){r(t.reason);return}t.addEventListener("abort",()=>{r(t.reason)})})}function Fi(t,e){return dZe(this,void 0,void 0,function*(){return e?Promise.race([t,uZe(e)]):t})}h();h();h();I_();h();var U0e=Kt(K6(),1),Cc=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Ku=function(t){return this instanceof Ku?(this.v=t,this):new Ku(t)},_K=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(a,d){s=t[o](s),i(a,d,s.done,s.value)})}}function i(o,s,a,d){Promise.resolve(d).then(function(u){o({value:u,done:a})},s)}},j0e=function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(m){n[m]&&(i[m]=function(p){return new Promise(function(g,v){o.push([m,p,g,v])>1||a(m,p)})})}function a(m,p){try{d(n[m](p))}catch(g){l(o[0][3],g)}}function d(m){m.value instanceof Ku?Promise.resolve(m.value.v).then(u,c):l(o[0][2],m)}function u(m){a("next",m)}function c(m){a("throw",m)}function l(m,p){m(p),o.shift(),o.length&&a(o[0][0],o[0][1])}};function Fu(t,e){return Cc(this,void 0,void 0,function*(){return new U0e.Level(t,Object.assign(Object.assign({},e),{keyEncoding:"utf8"}))})}var u2=class t{constructor(e,r){this.config=Object.assign({createLevelDatabase:Fu},e),this.db=r}open(){return Cc(this,void 0,void 0,function*(){switch(yield this.createLevelDatabase(),this.db.status){case"open":return;case"opening":return new Promise(e=>{this.db.once("open",e)});case"closing":return new Promise((e,r)=>{let n=()=>{this.db.open().then(e).catch(r)};this.db.once("closed",n)});case"closed":return this.db.open()}})}close(){return Cc(this,void 0,void 0,function*(){if(this.db)switch(this.db.status){case"open":return this.db.close();case"opening":return new Promise((e,r)=>{let n=()=>{this.db.close().then(e).catch(r)};this.db.once("open",n)});case"closing":return new Promise(e=>{this.db.once("closed",e)});case"closed":return}})}partition(e){return Cc(this,void 0,void 0,function*(){return yield this.createLevelDatabase(),new t(this.config,this.db.sublevel(e,{keyEncoding:"utf8",valueEncoding:this.config.valueEncoding}))})}get(e,r){var n;return Cc(this,void 0,void 0,function*(){(n=r?.signal)===null||n===void 0||n.throwIfAborted(),yield Fi(this.createLevelDatabase(),r?.signal);try{return yield Fi(this.db.get(String(e)),r?.signal)}catch(i){if(i.code==="LEVEL_NOT_FOUND")return;throw i}})}has(e,r){return Cc(this,void 0,void 0,function*(){return!!(yield this.get(e,r))})}keys(e){var r,n;return j0e(this,arguments,function*(){var o,s,a,d;(r=e?.signal)===null||r===void 0||r.throwIfAborted(),yield Ku(Fi(this.createLevelDatabase(),e?.signal));try{for(var u=!0,c=_K(this.db.keys()),l;l=yield Ku(c.next()),o=l.done,!o;u=!0){d=l.value,u=!1;let m=d;(n=e?.signal)===null||n===void 0||n.throwIfAborted(),yield yield Ku(m)}}catch(m){s={error:m}}finally{try{!u&&!o&&(a=c.return)&&(yield Ku(a.call(c)))}finally{if(s)throw s.error}}})}iterator(e,r){var n,i;return j0e(this,arguments,function*(){var s,a,d,u;(n=r?.signal)===null||n===void 0||n.throwIfAborted(),yield Ku(Fi(this.createLevelDatabase(),r?.signal));try{for(var c=!0,l=_K(this.db.iterator(e)),m;m=yield Ku(l.next()),s=m.done,!s;c=!0){u=m.value,c=!1;let p=u;(i=r?.signal)===null||i===void 0||i.throwIfAborted(),yield yield Ku(p)}}catch(p){a={error:p}}finally{try{!c&&!s&&(d=l.return)&&(yield Ku(d.call(l)))}finally{if(a)throw a.error}}})}put(e,r,n){var i;return Cc(this,void 0,void 0,function*(){return(i=n?.signal)===null||i===void 0||i.throwIfAborted(),yield Fi(this.createLevelDatabase(),n?.signal),Fi(this.db.put(String(e),r),n?.signal)})}delete(e,r){var n;return Cc(this,void 0,void 0,function*(){return(n=r?.signal)===null||n===void 0||n.throwIfAborted(),yield Fi(this.createLevelDatabase(),r?.signal),Fi(this.db.del(String(e)),r?.signal)})}isEmpty(e){var r,n,i,o;return Cc(this,void 0,void 0,function*(){try{for(var s=!0,a=_K(this.keys(e)),d;d=yield a.next(),r=d.done,!r;s=!0){o=d.value,s=!1;let u=o;return!1}}catch(u){n={error:u}}finally{try{!s&&!r&&(i=a.return)&&(yield i.call(a))}finally{if(n)throw n.error}}return!0})}clear(){return Cc(this,void 0,void 0,function*(){yield this.createLevelDatabase(),yield this.db.clear(),yield this.compactUnderlyingStorage()})}batch(e,r){var n;return Cc(this,void 0,void 0,function*(){return(n=r?.signal)===null||n===void 0||n.throwIfAborted(),yield Fi(this.createLevelDatabase(),r?.signal),Fi(this.db.batch(e),r?.signal)})}createPartitionOperation(e,r){return Object.assign(Object.assign({},r),{sublevel:this.db.sublevel(e,{keyEncoding:"utf8",valueEncoding:this.config.valueEncoding})})}compactUnderlyingStorage(e){var r,n,i;return Cc(this,void 0,void 0,function*(){(r=e?.signal)===null||r===void 0||r.throwIfAborted(),yield Fi(this.createLevelDatabase(),e?.signal);let o=this.sublevelRange;if(!o)return;let s=this.root;if(s.db.supports.additionalMethods.compactRange)return Fi((i=(n=s.db).compactRange)===null||i===void 0?void 0:i.call(n,...o),e?.signal)})}get sublevelRange(){let e=this.db.prefix;if(!e)return;let r=e.slice(0,-1)+String.fromCharCode(e.charCodeAt(e.length-1)+1);return[e,r]}get root(){let e=this.db;for(let r=e.db;r&&r!==e;)e=r;return new t(this.config,e)}createLevelDatabase(){var e;return Cc(this,void 0,void 0,function*(){(e=this.db)!==null&&e!==void 0||(this.db=yield this.config.createLevelDatabase(this.config.location,{keyEncoding:"utf8",valueEncoding:this.config.valueEncoding}))})}};var Vh=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},hk=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(a,d){s=t[o](s),i(a,d,s.done,s.value)})}}function i(o,s,a,d){Promise.resolve(d).then(function(u){o({value:u,done:a})},s)}},Mo=function(t){return this instanceof Mo?(this.v=t,this):new Mo(t)},pk=function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(m){n[m]&&(i[m]=function(p){return new Promise(function(g,v){o.push([m,p,g,v])>1||a(m,p)})})}function a(m,p){try{d(n[m](p))}catch(g){l(o[0][3],g)}}function d(m){m.value instanceof Mo?Promise.resolve(m.value.v).then(u,c):l(o[0][2],m)}function u(m){a("next",m)}function c(m){a("throw",m)}function l(m,p){m(p),o.shift(),o.length&&a(o[0][0],o[0][1])}},l2=class t{constructor(e,r){this.config=Object.assign({createLevelDatabase:Fu},e),this.db=r??new u2(Object.assign(Object.assign({},this.config),{valueEncoding:"binary"}))}open(){return Vh(this,void 0,void 0,function*(){return this.db.open()})}close(){return Vh(this,void 0,void 0,function*(){return this.db.close()})}partition(e){return Vh(this,void 0,void 0,function*(){let r=yield this.db.partition(e);return new t(Object.assign(Object.assign({},this.config),{location:""}),r)})}put(e,r,n){return Vh(this,void 0,void 0,function*(){return yield this.db.put(String(e),r,n),qr.parse(e.toString())})}get(e,r){return Vh(this,void 0,void 0,function*(){return yield this.db.get(String(e),r)})}has(e,r){return Vh(this,void 0,void 0,function*(){return this.db.has(String(e),r)})}delete(e,r){return Vh(this,void 0,void 0,function*(){return this.db.delete(String(e),r)})}isEmpty(e){return Vh(this,void 0,void 0,function*(){return this.db.isEmpty(e)})}putMany(e,r){return pk(this,arguments,function*(){var i,o,s,a;try{for(var d=!0,u=hk(e),c;c=yield Mo(u.next()),i=c.done,!i;d=!0){a=c.value,d=!1;let l=a;yield Mo(this.put(l.cid,l.block,r)),yield yield Mo(l.cid)}}catch(l){o={error:l}}finally{try{!d&&!i&&(s=u.return)&&(yield Mo(s.call(u)))}finally{if(o)throw o.error}}})}getMany(e,r){return pk(this,arguments,function*(){var i,o,s,a;try{for(var d=!0,u=hk(e),c;c=yield Mo(u.next()),i=c.done,!i;d=!0){a=c.value,d=!1;let l=a;yield yield Mo({cid:l,block:yield Mo(this.get(l,r))})}}catch(l){o={error:l}}finally{try{!d&&!i&&(s=u.return)&&(yield Mo(s.call(u)))}finally{if(o)throw o.error}}})}getAll(e){return pk(this,arguments,function*(){var n,i,o,s;let a=this.db.iterator({keys:!0,keyEncoding:"buffer"},e);try{for(var d=!0,u=hk(a),c;c=yield Mo(u.next()),n=c.done,!n;d=!0){s=c.value,d=!1;let[l,m]=s;yield yield Mo({cid:qr.decode(l),block:m})}}catch(l){i={error:l}}finally{try{!d&&!n&&(o=u.return)&&(yield Mo(o.call(u)))}finally{if(i)throw i.error}}})}deleteMany(e,r){return pk(this,arguments,function*(){var i,o,s,a;try{for(var d=!0,u=hk(e),c;c=yield Mo(u.next()),i=c.done,!i;d=!0){a=c.value,d=!1;let l=a;yield Mo(this.delete(l,r)),yield yield Mo(l)}}catch(l){o={error:l}}finally{try{!d&&!i&&(s=u.return)&&(yield Mo(s.call(u)))}finally{if(o)throw o.error}}})}clear(){return Vh(this,void 0,void 0,function*(){return this.db.clear()})}};h();var Uk=Kt(sc(),1);h();function lZe(t){return t[Symbol.asyncIterator]!=null}function fZe(t){if(lZe(t))return(async()=>{let r;for await(let n of t)r=n;return r})();let e;for(let r of t)e=r;return e}var q0e=fZe;Uf();h();h();h();h();h();var hZe=["string","number","bigint","symbol"],pZe=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function L0e(t){if(t===null)return"null";if(t===void 0)return"undefined";if(t===!0||t===!1)return"boolean";let e=typeof t;if(hZe.includes(e))return e;if(e==="function")return"Function";if(Array.isArray(t))return"Array";if(mZe(t))return"Buffer";let r=yZe(t);return r||"Object"}function mZe(t){return t&&t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer.call(null,t)}function yZe(t){let e=Object.prototype.toString.call(t).slice(8,-1);if(pZe.includes(e))return e}h();var ge=class{constructor(e,r,n){this.major=e,this.majorEncoded=e<<5,this.name=r,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.majore.major?1:0}};ge.uint=new ge(0,"uint",!0);ge.negint=new ge(1,"negint",!0);ge.bytes=new ge(2,"bytes",!0);ge.string=new ge(3,"string",!0);ge.array=new ge(4,"array",!1);ge.map=new ge(5,"map",!1);ge.tag=new ge(6,"tag",!1);ge.float=new ge(7,"float",!0);ge.false=new ge(7,"false",!0);ge.true=new ge(7,"true",!0);ge.null=new ge(7,"null",!0);ge.undefined=new ge(7,"undefined",!0);ge.break=new ge(7,"break",!0);var Ve=class{constructor(e,r,n){this.type=e,this.value=r,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};h();h();var f2=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",gZe=new TextDecoder,vZe=new TextEncoder;function mk(t){return f2&&globalThis.Buffer.isBuffer(t)}function W0e(t){return t instanceof Uint8Array?mk(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t:Uint8Array.from(t)}var V0e=f2?(t,e,r)=>r-e>64?globalThis.Buffer.from(t.subarray(e,r)).toString("utf8"):F0e(t,e,r):(t,e,r)=>r-e>64?gZe.decode(t.subarray(e,r)):F0e(t,e,r),H0e=f2?t=>t.length>64?globalThis.Buffer.from(t):K0e(t):t=>t.length>64?vZe.encode(t):K0e(t);var h2=f2?(t,e,r)=>mk(t)?new Uint8Array(t.subarray(e,r)):t.slice(e,r):(t,e,r)=>t.slice(e,r),G0e=f2?(t,e)=>(t=t.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),W0e(globalThis.Buffer.concat(t,e))):(t,e)=>{let r=new Uint8Array(e),n=0;for(let i of t)n+i.length>r.length&&(i=i.subarray(0,r.length-n)),r.set(i,n),n+=i.length;return r},J0e=f2?t=>globalThis.Buffer.allocUnsafe(t):t=>new Uint8Array(t);function Y0e(t,e){if(mk(t)&&mk(e))return t.compare(e);for(let r=0;r>6|192,e[r++]=i&63|128):(i&64512)===55296&&n+1>18|240,e[r++]=i>>12&63|128,e[r++]=i>>6&63|128,e[r++]=i&63|128):(e[r++]=i>>12|224,e[r++]=i>>6&63|128,e[r++]=i&63|128)}return e}function F0e(t,e,r){let n=[];for(;e239?4:i>223?3:i>191?2:1;if(e+s<=r){let a,d,u,c;switch(s){case 1:i<128&&(o=i);break;case 2:a=t[e+1],(a&192)===128&&(c=(i&31)<<6|a&63,c>127&&(o=c));break;case 3:a=t[e+1],d=t[e+2],(a&192)===128&&(d&192)===128&&(c=(i&15)<<12|(a&63)<<6|d&63,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:a=t[e+1],d=t[e+2],u=t[e+3],(a&192)===128&&(d&192)===128&&(u&192)===128&&(c=(i&15)<<18|(a&63)<<12|(d&63)<<6|u&63,c>65535&&c<1114112&&(o=c))}}o===null?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),e+=s}return bZe(n)}var z0e=4096;function bZe(t){let e=t.length;if(e<=z0e)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn.length/2?(r=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=h2(n,0,this.cursor)}else r=G0e(this.chunks,this.cursor);return e&&this.reset(),r}};h();var zt="CBOR decode error:",xK="CBOR encode error:",k3=[];k3[23]=1;k3[24]=2;k3[25]=3;k3[26]=5;k3[27]=9;function Hh(t,e,r){if(t.length-e>>8,n&255])}else if(r>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=s&255,s=s>>8,i[3]=s&255,s=s>>8,i[2]=s&255,s=s>>8,i[1]=s&255,t.push(i)}else throw new Error(`${zt} encountered BigInt larger than allowable range`)}}jd.encodedSize=function(e){return ps.encodedSize(e.value)};ps.encodedSize=function(e){return er.value?1:0};h();function tge(t,e,r,n){return new Ve(ge.negint,-1-Oc(t,e+1,n),2)}function rge(t,e,r,n){return new Ve(ge.negint,-1-$c(t,e+1,n),3)}function nge(t,e,r,n){return new Ve(ge.negint,-1-Nc(t,e+1,n),5)}var EK=BigInt(-1),ige=BigInt(1);function oge(t,e,r,n){let i=jc(t,e+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new Ve(ge.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${zt} integers outside of the safe integer range are not supported`);return new Ve(ge.negint,EK-BigInt(i),9)}function gk(t,e){let r=e.value,n=typeof r=="bigint"?r*EK-ige:r*-1-1;ps(t,e.type.majorEncoded,n)}gk.encodedSize=function(e){let r=e.value,n=typeof r=="bigint"?r*EK-ige:r*-1-1;return nr.value?-1:0};h();function R3(t,e,r,n){Hh(t,e,r+n);let i=h2(t,e+r,e+r+n);return new Ve(ge.bytes,i,r+n)}function sge(t,e,r,n){return R3(t,e,1,r)}function age(t,e,r,n){return R3(t,e,2,Oc(t,e+1,n))}function cge(t,e,r,n){return R3(t,e,3,$c(t,e+1,n))}function dge(t,e,r,n){return R3(t,e,5,Nc(t,e+1,n))}function uge(t,e,r,n){let i=jc(t,e+1,n);if(typeof i=="bigint")throw new Error(`${zt} 64-bit integer bytes lengths not supported`);return R3(t,e,9,i)}function vk(t){return t.encodedBytes===void 0&&(t.encodedBytes=t.type===ge.string?H0e(t.value):t.value),t.encodedBytes}function p2(t,e){let r=vk(e);ps(t,e.type.majorEncoded,r.length),t.push(r)}p2.encodedSize=function(e){let r=vk(e);return ps.encodedSize(r.length)+r.length};p2.compareTokens=function(e,r){return xZe(vk(e),vk(r))};function xZe(t,e){return t.lengthe.length?1:Y0e(t,e)}h();function D3(t,e,r,n,i){let o=r+n;Hh(t,e,o);let s=new Ve(ge.string,V0e(t,e+r,e+o),o);return i.retainStringBytes===!0&&(s.byteValue=h2(t,e+r,e+o)),s}function lge(t,e,r,n){return D3(t,e,1,r,n)}function fge(t,e,r,n){return D3(t,e,2,Oc(t,e+1,n),n)}function hge(t,e,r,n){return D3(t,e,3,$c(t,e+1,n),n)}function pge(t,e,r,n){return D3(t,e,5,Nc(t,e+1,n),n)}function mge(t,e,r,n){let i=jc(t,e+1,n);if(typeof i=="bigint")throw new Error(`${zt} 64-bit integer string lengths not supported`);return D3(t,e,9,i,n)}var yge=p2;h();function m2(t,e,r,n){return new Ve(ge.array,n,r)}function gge(t,e,r,n){return m2(t,e,1,r)}function vge(t,e,r,n){return m2(t,e,2,Oc(t,e+1,n))}function bge(t,e,r,n){return m2(t,e,3,$c(t,e+1,n))}function wge(t,e,r,n){return m2(t,e,5,Nc(t,e+1,n))}function _ge(t,e,r,n){let i=jc(t,e+1,n);if(typeof i=="bigint")throw new Error(`${zt} 64-bit integer array lengths not supported`);return m2(t,e,9,i)}function xge(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${zt} indefinite length items not allowed`);return m2(t,e,1,1/0)}function bk(t,e){ps(t,ge.array.majorEncoded,e.value)}bk.compareTokens=jd.compareTokens;bk.encodedSize=function(e){return ps.encodedSize(e.value)};h();function y2(t,e,r,n){return new Ve(ge.map,n,r)}function Ege(t,e,r,n){return y2(t,e,1,r)}function Sge(t,e,r,n){return y2(t,e,2,Oc(t,e+1,n))}function Age(t,e,r,n){return y2(t,e,3,$c(t,e+1,n))}function Tge(t,e,r,n){return y2(t,e,5,Nc(t,e+1,n))}function Ige(t,e,r,n){let i=jc(t,e+1,n);if(typeof i=="bigint")throw new Error(`${zt} 64-bit integer map lengths not supported`);return y2(t,e,9,i)}function Pge(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${zt} indefinite length items not allowed`);return y2(t,e,1,1/0)}function wk(t,e){ps(t,ge.map.majorEncoded,e.value)}wk.compareTokens=jd.compareTokens;wk.encodedSize=function(e){return ps.encodedSize(e.value)};h();function kge(t,e,r,n){return new Ve(ge.tag,r,1)}function Rge(t,e,r,n){return new Ve(ge.tag,Oc(t,e+1,n),2)}function Dge(t,e,r,n){return new Ve(ge.tag,$c(t,e+1,n),3)}function Bge(t,e,r,n){return new Ve(ge.tag,Nc(t,e+1,n),5)}function Mge(t,e,r,n){return new Ve(ge.tag,jc(t,e+1,n),9)}function _k(t,e){ps(t,ge.tag.majorEncoded,e.value)}_k.compareTokens=jd.compareTokens;_k.encodedSize=function(e){return ps.encodedSize(e.value)};h();var PZe=20,kZe=21,RZe=22,DZe=23;function Cge(t,e,r,n){if(n.allowUndefined===!1)throw new Error(`${zt} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new Ve(ge.null,null,1):new Ve(ge.undefined,void 0,1)}function Oge(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${zt} indefinite length items not allowed`);return new Ve(ge.break,void 0,1)}function SK(t,e,r){if(r){if(r.allowNaN===!1&&Number.isNaN(t))throw new Error(`${zt} NaN values are not supported`);if(r.allowInfinity===!1&&(t===1/0||t===-1/0))throw new Error(`${zt} Infinity values are not supported`)}return new Ve(ge.float,t,e)}function $ge(t,e,r,n){return SK(AK(t,e+1),3,n)}function Nge(t,e,r,n){return SK(TK(t,e+1),5,n)}function jge(t,e,r,n){return SK(Kge(t,e+1),9,n)}function xk(t,e,r){let n=e.value;if(n===!1)t.push([ge.float.majorEncoded|PZe]);else if(n===!0)t.push([ge.float.majorEncoded|kZe]);else if(n===null)t.push([ge.float.majorEncoded|RZe]);else if(n===void 0)t.push([ge.float.majorEncoded|DZe]);else{let i,o=!1;(!r||r.float64!==!0)&&(qge(n),i=AK(zu,1),n===i||Number.isNaN(n)?(zu[0]=249,t.push(zu.slice(0,3)),o=!0):(Lge(n),i=TK(zu,1),n===i&&(zu[0]=250,t.push(zu.slice(0,5)),o=!0))),o||(BZe(n),i=Kge(zu,1),zu[0]=251,t.push(zu.slice(0,9)))}}xk.encodedSize=function(e,r){let n=e.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){qge(n);let i=AK(zu,1);if(n===i||Number.isNaN(n))return 3;if(Lge(n),i=TK(zu,1),n===i)return 5}return 9};var Uge=new ArrayBuffer(9),Ud=new DataView(Uge,1),zu=new Uint8Array(Uge,0);function qge(t){if(t===1/0)Ud.setUint16(0,31744,!1);else if(t===-1/0)Ud.setUint16(0,64512,!1);else if(Number.isNaN(t))Ud.setUint16(0,32256,!1);else{Ud.setFloat32(0,t);let e=Ud.getUint32(0),r=(e&2139095040)>>23,n=e&8388607;if(r===255)Ud.setUint16(0,31744,!1);else if(r===0)Ud.setUint16(0,(t&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Ud.setUint16(0,0):i<-14?Ud.setUint16(0,(e&2147483648)>>16|1<<24+i,!1):Ud.setUint16(0,(e&2147483648)>>16|i+15<<10|n>>13,!1)}}}function AK(t,e){if(t.length-e<2)throw new Error(`${zt} not enough data for float16`);let r=(t[e]<<8)+t[e+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function Lge(t){Ud.setFloat32(0,t,!1)}function TK(t,e){if(t.length-e<4)throw new Error(`${zt} not enough data for float32`);let r=(t.byteOffset||0)+e;return new DataView(t.buffer,r,4).getFloat32(0,!1)}function BZe(t){Ud.setFloat64(0,t,!1)}function Kge(t,e){if(t.length-e<8)throw new Error(`${zt} not enough data for float64`);let r=(t.byteOffset||0)+e;return new DataView(t.buffer,r,8).getFloat64(0,!1)}xk.compareTokens=jd.compareTokens;function Zr(t,e,r){throw new Error(`${zt} encountered invalid minor (${r}) for major ${t[e]>>>5}`)}function Ek(t){return()=>{throw new Error(`${zt} ${t}`)}}var Me=[];for(let t=0;t<=23;t++)Me[t]=Zr;Me[24]=Z0e;Me[25]=X0e;Me[26]=Q0e;Me[27]=ege;Me[28]=Zr;Me[29]=Zr;Me[30]=Zr;Me[31]=Zr;for(let t=32;t<=55;t++)Me[t]=Zr;Me[56]=tge;Me[57]=rge;Me[58]=nge;Me[59]=oge;Me[60]=Zr;Me[61]=Zr;Me[62]=Zr;Me[63]=Zr;for(let t=64;t<=87;t++)Me[t]=sge;Me[88]=age;Me[89]=cge;Me[90]=dge;Me[91]=uge;Me[92]=Zr;Me[93]=Zr;Me[94]=Zr;Me[95]=Ek("indefinite length bytes/strings are not supported");for(let t=96;t<=119;t++)Me[t]=lge;Me[120]=fge;Me[121]=hge;Me[122]=pge;Me[123]=mge;Me[124]=Zr;Me[125]=Zr;Me[126]=Zr;Me[127]=Ek("indefinite length bytes/strings are not supported");for(let t=128;t<=151;t++)Me[t]=gge;Me[152]=vge;Me[153]=bge;Me[154]=wge;Me[155]=_ge;Me[156]=Zr;Me[157]=Zr;Me[158]=Zr;Me[159]=xge;for(let t=160;t<=183;t++)Me[t]=Ege;Me[184]=Sge;Me[185]=Age;Me[186]=Tge;Me[187]=Ige;Me[188]=Zr;Me[189]=Zr;Me[190]=Zr;Me[191]=Pge;for(let t=192;t<=215;t++)Me[t]=kge;Me[216]=Rge;Me[217]=Dge;Me[218]=Bge;Me[219]=Mge;Me[220]=Zr;Me[221]=Zr;Me[222]=Zr;Me[223]=Zr;for(let t=224;t<=243;t++)Me[t]=Ek("simple values are not supported");Me[244]=Zr;Me[245]=Zr;Me[246]=Zr;Me[247]=Cge;Me[248]=Ek("simple values are not supported");Me[249]=$ge;Me[250]=Nge;Me[251]=jge;Me[252]=Zr;Me[253]=Zr;Me[254]=Zr;Me[255]=Oge;var Wu=[];for(let t=0;t<24;t++)Wu[t]=new Ve(ge.uint,t,1);for(let t=-1;t>=-24;t--)Wu[31-t]=new Ve(ge.negint,t,1);Wu[64]=new Ve(ge.bytes,new Uint8Array(0),1);Wu[96]=new Ve(ge.string,"",1);Wu[128]=new Ve(ge.array,0,1);Wu[160]=new Ve(ge.map,0,1);Wu[244]=new Ve(ge.false,!1,1);Wu[245]=new Ve(ge.true,!0,1);Wu[246]=new Ve(ge.null,null,1);function CZe(){let t=[];return t[ge.uint.major]=jd,t[ge.negint.major]=gk,t[ge.bytes.major]=p2,t[ge.string.major]=yge,t[ge.array.major]=bk,t[ge.map.major]=wk,t[ge.tag.major]=_k,t[ge.float.major]=xk,t}var XDt=CZe(),QDt=new yk,Sk=class t{constructor(e,r){this.obj=e,this.parent=r}includes(e){let r=this;do if(r.obj===e)return!0;while(r=r.parent);return!1}static createCheck(e,r){if(e&&e.includes(r))throw new Error(`${xK} object contains circular references`);return new t(r,e)}},vy={null:new Ve(ge.null,null),undefined:new Ve(ge.undefined,void 0),true:new Ve(ge.true,!0),false:new Ve(ge.false,!1),emptyArray:new Ve(ge.array,0),emptyMap:new Ve(ge.map,0)},by={number(t,e,r,n){return!Number.isInteger(t)||!Number.isSafeInteger(t)?new Ve(ge.float,t):t>=0?new Ve(ge.uint,t):new Ve(ge.negint,t)},bigint(t,e,r,n){return t>=BigInt(0)?new Ve(ge.uint,t):new Ve(ge.negint,t)},Uint8Array(t,e,r,n){return new Ve(ge.bytes,t)},string(t,e,r,n){return new Ve(ge.string,t)},boolean(t,e,r,n){return t?vy.true:vy.false},null(t,e,r,n){return vy.null},undefined(t,e,r,n){return vy.undefined},ArrayBuffer(t,e,r,n){return new Ve(ge.bytes,new Uint8Array(t))},DataView(t,e,r,n){return new Ve(ge.bytes,new Uint8Array(t.buffer,t.byteOffset,t.byteLength))},Array(t,e,r,n){if(!t.length)return r.addBreakTokens===!0?[vy.emptyArray,new Ve(ge.break)]:vy.emptyArray;n=Sk.createCheck(n,t);let i=[],o=0;for(let s of t)i[o++]=IK(s,r,n);return r.addBreakTokens?[new Ve(ge.array,t.length),i,new Ve(ge.break)]:[new Ve(ge.array,t.length),i]},Object(t,e,r,n){let i=e!=="Object",o=i?t.keys():Object.keys(t),s=i?t.size:o.length;if(!s)return r.addBreakTokens===!0?[vy.emptyMap,new Ve(ge.break)]:vy.emptyMap;n=Sk.createCheck(n,t);let a=[],d=0;for(let u of o)a[d++]=[IK(u,r,n),IK(i?t.get(u):t[u],r,n)];return OZe(a,r),r.addBreakTokens?[new Ve(ge.map,s),a,new Ve(ge.break)]:[new Ve(ge.map,s),a]}};by.Map=by.Object;by.Buffer=by.Uint8Array;for(let t of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))by[`${t}Array`]=by.DataView;function IK(t,e={},r){let n=L0e(t),i=e&&e.typeEncoders&&e.typeEncoders[n]||by[n];if(typeof i=="function"){let s=i(t,n,e,r);if(s!=null)return s}let o=by[n];if(!o)throw new Error(`${xK} unsupported type: ${n}`);return o(t,n,e,r)}function OZe(t,e){e.mapSorter&&t.sort(e.mapSorter)}h();var $Ze={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},PK=class{constructor(e,r={}){this._pos=0,this.data=e,this.options=r}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let e=this.data[this._pos],r=Wu[e];if(r===void 0){let n=Me[e];if(!n)throw new Error(`${zt} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let i=e&31;r=n(this.data,this._pos,i,this.options)}return this._pos+=r.encodedLength,r}},B3=Symbol.for("DONE"),Ak=Symbol.for("BREAK");function NZe(t,e,r){let n=[];for(let i=0;i0)throw new Error(`${zt} too many terminals, data makes no sense`);return r}var Wge=42;function LZe(t){return t instanceof ArrayBuffer?new Uint8Array(t,0,t.byteLength):t}function KZe(t){if(t.asCID!==t&&t["/"]!==t.bytes)return null;let e=Aa.asCID(t);if(!e)return null;let r=new Uint8Array(e.bytes.byteLength+1);return r.set(e.bytes,1),[new Ve(ge.tag,Wge),new Ve(ge.bytes,r)]}function FZe(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function zZe(t){if(Number.isNaN(t))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(t===1/0||t===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}var zge={float64:!0,typeEncoders:{Object:KZe,undefined:FZe,number:zZe}},fBt={...zge,typeEncoders:{...zge.typeEncoders}};function WZe(t){if(t[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Aa.decode(t.subarray(1))}var Tk={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Tk.tags[Wge]=WZe;var hBt={...Tk,tags:Tk.tags.slice()};var Vge=113;var Hge=t=>kK(LZe(t),Tk);var Pve=Kt(sc(),1);h();Uy();Zv();var Jge=0,VZe="identity",Yge=Wd,HZe=t=>zy(Jge,Yge(t)),Zge={code:Jge,name:VZe,encode:Yge,digest:HZe};h();var Xge=Kt(sc(),1);Uf();var GZe=async(t,e,r,n,i,o,s,a)=>{let d=await s.get(t,a),u=Hge(d),c=u,l=r;for(;n.length>0;){let m=n[0];if(m in c){n.shift(),l=`${l}/${m}`;let p=qr.asCID(c[m]);if(p!=null)return{entry:{type:"object",name:e,path:r,cid:t,node:d,depth:o,size:BigInt(d.length),content:async function*(){yield u}},next:{cid:p,name:m,path:l,toResolve:n}};c=c[m]}else throw(0,Xge.default)(new Error(`No property named ${m} found in cbor node ${t}`),"ERR_NO_PROP")}return{entry:{type:"object",name:e,path:r,cid:t,node:d,depth:o,size:BigInt(d.length),content:async function*(){yield u}}}},Qge=GZe;h();var eve=Kt(sc(),1);Zv();h();function JZe(t,e,r,n){let i=BigInt(t.length),o=BigInt(e+i);return r>=o||n=e&&n=e&&r{let n=BigInt(t),i=BigInt(e??0),o=BigInt(r);if(o!==n&&(o=i+o),o>n&&(o=n),i<0n)throw(0,C3.default)(new Error("Offset must be greater than or equal to 0"),"ERR_INVALID_PARAMS");if(i>n)throw(0,C3.default)(new Error("Offset must be less than the file size"),"ERR_INVALID_PARAMS");if(o<0n)throw(0,C3.default)(new Error("Length must be greater than or equal to 0"),"ERR_INVALID_PARAMS");if(o>n)throw(0,C3.default)(new Error("Length must be less than the file size"),"ERR_INVALID_PARAMS");return{start:i,end:o}},g2=YZe;var ZZe=t=>{async function*e(r={}){let{start:n,end:i}=g2(t.length,r.offset,r.length),o=xv(t,0n,n,i);r.onProgress?.(new ui("unixfs:exporter:progress:identity",{bytesRead:BigInt(o.byteLength),totalBytes:i-n,fileSize:BigInt(t.byteLength)})),yield o}return e},XZe=async(t,e,r,n,i,o,s,a)=>{if(n.length>0)throw(0,eve.default)(new Error(`No link named ${r} found in raw node ${t}`),"ERR_NOT_FOUND");let d=JS(t.multihash.bytes);return{entry:{type:"identity",name:e,path:r,cid:t,content:ZZe(d.digest),depth:o,size:BigInt(d.digest.length),node:d.digest}}},tve=XZe;h();var rve=Kt(sc(),1);var QZe=t=>{async function*e(r={}){let{start:n,end:i}=g2(t.length,r.offset,r.length),o=xv(t,0n,n,i);r.onProgress?.(new ui("unixfs:exporter:progress:raw",{bytesRead:BigInt(o.byteLength),totalBytes:i-n,fileSize:BigInt(t.byteLength)})),yield o}return e},eXe=async(t,e,r,n,i,o,s,a)=>{if(n.length>0)throw(0,rve.default)(new Error(`No link named ${r} found in raw node ${t}`),"ERR_NOT_FOUND");let d=await s.get(t,a);return{entry:{type:"raw",name:e,path:r,cid:t,content:QZe(d),depth:o,size:BigInt(d.length),node:d}}},nve=eXe;h();var K3=Kt(sc(),1);h();var tXe=async function(t){return(await q5.encode(t)).slice(0,8).reverse()},rXe=async(t,e,r)=>{await Promise.all(t.map(async n=>{if(n.Name==null)throw new Error("Unexpected Link without a Name");if(n.Name.length===2){let i=parseInt(n.Name,16);e._putObjectAt(i,new fl({hash:r._options.hash,bits:r._options.bits},e,i));return}await r.put(n.Name.substring(2),!0)}))},ive=t=>t.toString(16).toUpperCase().padStart(2,"0").substring(0,2),nXe=t=>{let e=t.bucket,r=[];for(;e._parent!=null;)r.push(e),e=e._parent;return r.push(e),r.reverse()},ove=async(t,e,r,n,i)=>{if(n==null){let c=F5({hashFn:tXe});n={rootBucket:c,hamtDepth:1,lastBucket:c}}await rXe(t.Links,n.lastBucket,n.rootBucket);let o=await n.rootBucket._findNewBucketAndPos(e),s=ive(o.pos),a=nXe(o);a.length>n.hamtDepth&&(n.lastBucket=a[n.hamtDepth],s=ive(n.lastBucket._posAtParent));let d=t.Links.find(c=>{if(c.Name==null)return!1;let l=c.Name.substring(0,2),m=c.Name.substring(2);return!(l!==s||m!==""&&m!==e)});if(d==null)return;if(d.Name!=null&&d.Name.substring(2)===e)return d.Hash;n.hamtDepth++;let u=await r.get(d.Hash,i);return t=Lf(u),ove(t,e,r,n,i)},sve=ove;h();h();h();function iXe(t){let[e,r]=t[Symbol.asyncIterator]!=null?[t[Symbol.asyncIterator](),Symbol.asyncIterator]:[t[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>e.next(),push:i=>{n.push(i)},next:()=>n.length>0?{done:!1,value:n.shift()}:e.next(),[r](){return this}}}var Ik=iXe;function oXe(t){return t[Symbol.asyncIterator]!=null}function sXe(t,e){if(oXe(t))return async function*(){for await(let a of t)await e(a)&&(yield a)}();let r=Ik(t),{value:n,done:i}=r.next();if(i===!0)return function*(){}();let o=e(n);if(typeof o.then=="function")return async function*(){await o&&(yield n);for await(let a of r)await e(a)&&(yield a)}();let s=e;return function*(){o===!0&&(yield n);for(let a of r)s(a)&&(yield a)}()}var ave=sXe;h();function aXe(t){return t[Symbol.asyncIterator]!=null}function cXe(t,e){if(aXe(t))return async function*(){for await(let a of t)yield e(a)}();let r=Ik(t),{value:n,done:i}=r.next();if(i===!0)return function*(){}();let o=e(n);if(typeof o.then=="function")return async function*(){yield await o;for await(let a of r)yield e(a)}();let s=e;return function*(){yield o;for(let a of r)yield s(a)}()}var v2=cXe;h();h();function Gh(){let t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}var Pk=globalThis.CustomEvent??Event;async function*Ev(t,e={}){let r=e.concurrency??1/0;r<1&&(r=1/0);let n=e.ordered==null?!1:e.ordered,i=new EventTarget,o=[],s=Gh(),a=Gh(),d=!1,u,c=!1;i.addEventListener("task-complete",()=>{a.resolve()}),Promise.resolve().then(async()=>{try{for await(let g of t){if(o.length===r&&(s=Gh(),await s.promise),c)break;let v={done:!1};o.push(v),g().then(E=>{v.done=!0,v.ok=!0,v.value=E,i.dispatchEvent(new Pk("task-complete"))},E=>{v.done=!0,v.err=E,i.dispatchEvent(new Pk("task-complete"))})}d=!0,i.dispatchEvent(new Pk("task-complete"))}catch(g){u=g,i.dispatchEvent(new Pk("task-complete"))}});function l(){return n?o[0]?.done:!!o.find(g=>g.done)}function*m(){for(;o.length>0&&o[0].done;){let g=o[0];if(o.shift(),g.ok)yield g.value;else throw c=!0,s.resolve(),g.err;s.resolve()}}function*p(){for(;l();)for(let g=0;g0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},b2=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new kk(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let r=this.head;this.head=r.next=new kk(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let r=this.tail.next;this.tail.next=null,this.tail=r,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};var RK=class extends Error{type;code;constructor(e,r){super(e??"The operation was aborted"),this.type="aborted",this.code=r??"ABORT_ERR"}};function w2(t={}){return dXe(r=>{let n=r.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},t)}function dXe(t,e){e=e??{};let r=e.onEnd,n=new b2,i,o,s,a=Gh(),d=async()=>{try{return n.isEmpty()?s?{done:!0}:await new Promise((E,A)=>{o=P=>{o=null,n.push(P);try{E(t(n))}catch(I){A(I)}return i}}):t(n)}finally{n.isEmpty()&&queueMicrotask(()=>{a.resolve(),a=Gh()})}},u=E=>o!=null?o(E):(n.push(E),i),c=E=>(n=new b2,o!=null?o({error:E}):(n.push({error:E}),i)),l=E=>{if(s)return i;if(e?.objectMode!==!0&&E?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return u({done:!1,value:E})},m=E=>s?i:(s=!0,E!=null?c(E):u({done:!0})),p=()=>(n=new b2,m(),{done:!0}),g=E=>(m(E),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:d,return:p,throw:g,push:l,end:m,get readableLength(){return n.size},onEmpty:async E=>{let A=E?.signal;if(A?.throwIfAborted(),n.isEmpty())return;let P,I;A!=null&&(P=new Promise(($,N)=>{I=()=>{N(new RK)},A.addEventListener("abort",I)}));try{await Promise.race([a.promise,P])}finally{I!=null&&A!=null&&A?.removeEventListener("abort",I)}}},r==null)return i;let v=i;return i={[Symbol.asyncIterator](){return this},next(){return v.next()},throw(E){return v.throw(E),r!=null&&(r(E),r=void 0),{done:!0}},return(){return v.return(),r!=null&&(r(),r=void 0),{done:!0}},push:l,end(E){return v.end(E),r!=null&&(r(E),r=void 0),i},get readableLength(){return v.readableLength},onEmpty:E=>v.onEmpty(E)},i}h();function uXe(t){return t[Symbol.asyncIterator]!=null}function lXe(...t){let e=[];for(let r of t)uXe(r)||e.push(r);return e.length===t.length?function*(){for(let r of e)yield*r}():async function*(){let r=w2({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(t.map(async n=>{for await(let i of n)r.push(i)})),r.end()}catch(n){r.end(n)}}),yield*r}()}var cve=lXe;function _2(t,...e){if(t==null)throw new Error("Empty pipeline");if(DK(t)){let n=t;t=()=>n.source}else if(uve(t)||dve(t)){let n=t;t=()=>n}let r=[t,...e];if(r.length>1&&DK(r[r.length-1])&&(r[r.length-1]=r[r.length-1].sink),r.length>2)for(let n=1;n{let e;for(;t.length>0;)e=t.shift()(e);return e},dve=t=>t?.[Symbol.asyncIterator]!=null,uve=t=>t?.[Symbol.iterator]!=null,DK=t=>t==null?!1:t.sink!=null&&t.source!=null,hXe=t=>e=>{let r=t.sink(e);if(r?.then!=null){let n=w2({objectMode:!0});r.then(()=>{n.end()},s=>{n.end(s)});let i,o=t.source;if(dve(o))i=async function*(){yield*o,n.end()};else if(uve(o))i=function*(){yield*o,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return cve(n,i())}return t.source};var pXe=(t,e,r,n,i,o,s)=>{async function*a(d={}){let u=d.offset??0,c=d.length??e.Links.length,l=e.Links.slice(u,c);d.onProgress?.(new ui("unixfs:exporter:walk:directory",{cid:t})),yield*_2(l,m=>v2(m,p=>async()=>{let g=p.Name??"",v=`${n}/${g}`;return(await i(p.Hash,g,v,[],o+1,s,d)).entry}),m=>Ev(m,{ordered:!0}),m=>ave(m,p=>p!=null))}return a},lve=pXe;h();var Av=Kt(sc(),1);h();h();var MK=Kt(hve(),1);h();var $3=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},CK=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},pve=t=>globalThis.DOMException===void 0?new CK(t):new DOMException(t),mve=t=>{let e=t.reason===void 0?pve("This operation was aborted."):t.reason;return e instanceof Error?e:pve(e)};function OK(t,e,r,n){let i,o=new Promise((s,a)=>{if(typeof e!="number"||Math.sign(e)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${e}\``);if(e===Number.POSITIVE_INFINITY){s(t);return}if(n={customTimers:{setTimeout,clearTimeout},...n},n.signal){let{signal:d}=n;d.aborted&&a(mve(d)),d.addEventListener("abort",()=>{a(mve(d))})}i=n.customTimers.setTimeout.call(void 0,()=>{if(typeof r=="function"){try{s(r())}catch(c){a(c)}return}let d=typeof r=="string"?r:`Promise timed out after ${e} milliseconds`,u=r instanceof Error?r:new $3(d);typeof t.cancel=="function"&&t.cancel(),a(u)},e),(async()=>{try{s(await t)}catch(d){a(d)}finally{n.customTimers.clearTimeout.call(void 0,i)}})()});return o.clear=()=>{clearTimeout(i),i=void 0},o}h();h();function $K(t,e,r){let n=0,i=t.length;for(;i>0;){let o=Math.trunc(i/2),s=n+o;r(t[s],e)<=0?(n=++s,i-=o+1):i=o}return n}var Sv=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Jh,NK=class{constructor(){Jh.set(this,[])}enqueue(e,r){r={priority:0,...r};let n={priority:r.priority,run:e};if(this.size&&Sv(this,Jh,"f")[this.size-1].priority>=r.priority){Sv(this,Jh,"f").push(n);return}let i=$K(Sv(this,Jh,"f"),n,(o,s)=>s.priority-o.priority);Sv(this,Jh,"f").splice(i,0,n)}dequeue(){let e=Sv(this,Jh,"f").shift();return e?.run}filter(e){return Sv(this,Jh,"f").filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return Sv(this,Jh,"f").length}};Jh=new WeakMap;var yve=NK;var oi=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},ct=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Ci,j3,U3,_y,$k,q3,Dk,Vu,N3,Uc,Bk,qc,L3,wy,Mk,gve,vve,_ve,bve,wve,Ck,jK,UK,Nk,xve,Ok,jk=class extends Error{},qK=class extends MK.default{constructor(e){var r,n,i,o;if(super(),Ci.add(this),j3.set(this,void 0),U3.set(this,void 0),_y.set(this,0),$k.set(this,void 0),q3.set(this,void 0),Dk.set(this,0),Vu.set(this,void 0),N3.set(this,void 0),Uc.set(this,void 0),Bk.set(this,void 0),qc.set(this,0),L3.set(this,void 0),wy.set(this,void 0),Mk.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:yve,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=e.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(o=(i=e.interval)===null||i===void 0?void 0:i.toString())!==null&&o!==void 0?o:""}\` (${typeof e.interval})`);oi(this,j3,e.carryoverConcurrencyCount,"f"),oi(this,U3,e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,"f"),oi(this,$k,e.intervalCap,"f"),oi(this,q3,e.interval,"f"),oi(this,Uc,new e.queueClass,"f"),oi(this,Bk,e.queueClass,"f"),this.concurrency=e.concurrency,this.timeout=e.timeout,oi(this,Mk,e.throwOnTimeout===!0,"f"),oi(this,wy,e.autoStart===!1,"f")}get concurrency(){return ct(this,L3,"f")}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);oi(this,L3,e,"f"),ct(this,Ci,"m",Nk).call(this)}async add(e,r={}){return r={timeout:this.timeout,throwOnTimeout:ct(this,Mk,"f"),...r},new Promise((n,i)=>{ct(this,Uc,"f").enqueue(async()=>{var o,s,a;oi(this,qc,(s=ct(this,qc,"f"),s++,s),"f"),oi(this,_y,(a=ct(this,_y,"f"),a++,a),"f");try{if(!((o=r.signal)===null||o===void 0)&&o.aborted)throw new jk("The task was aborted.");let d=e({signal:r.signal});r.timeout&&(d=OK(Promise.resolve(d),r.timeout)),r.signal&&(d=Promise.race([d,ct(this,Ci,"m",xve).call(this,r.signal)]));let u=await d;n(u),this.emit("completed",u)}catch(d){if(d instanceof $3&&!r.throwOnTimeout){n();return}i(d),this.emit("error",d)}finally{ct(this,Ci,"m",_ve).call(this)}},r),this.emit("add"),ct(this,Ci,"m",Ck).call(this)})}async addAll(e,r){return Promise.all(e.map(async n=>this.add(n,r)))}start(){return ct(this,wy,"f")?(oi(this,wy,!1,"f"),ct(this,Ci,"m",Nk).call(this),this):this}pause(){oi(this,wy,!0,"f")}clear(){oi(this,Uc,new(ct(this,Bk,"f")),"f")}async onEmpty(){ct(this,Uc,"f").size!==0&&await ct(this,Ci,"m",Ok).call(this,"empty")}async onSizeLessThan(e){ct(this,Uc,"f").sizect(this,Uc,"f").size{ct(this,Ci,"m",bve).call(this)},r),"f"),!0}return!1},Ck=function(){if(ct(this,Uc,"f").size===0)return ct(this,Vu,"f")&&clearInterval(ct(this,Vu,"f")),oi(this,Vu,void 0,"f"),this.emit("empty"),ct(this,qc,"f")===0&&this.emit("idle"),!1;if(!ct(this,wy,"f")){let e=!ct(this,Ci,"a",wve);if(ct(this,Ci,"a",gve)&&ct(this,Ci,"a",vve)){let r=ct(this,Uc,"f").dequeue();return r?(this.emit("active"),r(),e&&ct(this,Ci,"m",jK).call(this),!0):!1}}return!1},jK=function(){ct(this,U3,"f")||ct(this,Vu,"f")!==void 0||(oi(this,Vu,setInterval(()=>{ct(this,Ci,"m",UK).call(this)},ct(this,q3,"f")),"f"),oi(this,Dk,Date.now()+ct(this,q3,"f"),"f"))},UK=function(){ct(this,_y,"f")===0&&ct(this,qc,"f")===0&&ct(this,Vu,"f")&&(clearInterval(ct(this,Vu,"f")),oi(this,Vu,void 0,"f")),oi(this,_y,ct(this,j3,"f")?ct(this,qc,"f"):0,"f"),ct(this,Ci,"m",Nk).call(this)},Nk=function(){for(;ct(this,Ci,"m",Ck).call(this););},xve=async function(e){return new Promise((r,n)=>{e.addEventListener("abort",()=>{n(new jk("The task was aborted."))},{once:!0})})},Ok=async function(e,r){return new Promise(n=>{let i=()=>{r&&!r()||(this.off(e,i),n())};this.on(e,i)})};var Eve=qK;async function Sve(t,e,r,n,i,o,s){if(e instanceof Uint8Array){let u=xv(e,n,i,o);r.push(u);return}if(e.Data==null)throw(0,Av.default)(new Error("no data in PBNode"),"ERR_NOT_UNIXFS");let a;try{a=yo.unmarshal(e.Data)}catch(u){throw(0,Av.default)(u,"ERR_NOT_UNIXFS")}if(a.data!=null){let u=a.data,c=xv(u,n,i,o);r.push(c),n+=BigInt(c.byteLength)}let d=[];if(e.Links.length!==a.blockSizes.length)throw(0,Av.default)(new Error("Inconsistent block sizes and dag links"),"ERR_NOT_UNIXFS");for(let u=0;u=l&&i=l&&o<=m||im)&&d.push({link:c,blockStart:n}),n=m,n>o)break}await _2(d,u=>v2(u,c=>async()=>{let l=await t.get(c.link.Hash,s);return{...c,block:l}}),u=>Ev(u,{ordered:!0}),async u=>{for await(let{link:c,block:l,blockStart:m}of u){let p;switch(c.Hash.code){case N_:p=Lf(l);break;case Cp:p=l;break;default:r.end((0,Av.default)(new Error(`Unsupported codec: ${c.Hash.code}`),"ERR_NOT_UNIXFS"));return}let g=new Eve({concurrency:1});g.on("error",v=>{r.end(v)}),g.add(async()=>{s.onProgress?.(new ui("unixfs:exporter:walk:file",{cid:c.Hash})),await Sve(t,p,r,m,i,o,s)}),await g.onIdle()}}),n>=o&&r.end()}var gXe=(t,e,r,n,i,o,s)=>{async function*a(d={}){let u=r.fileSize();if(u===void 0)throw new Error("File was a directory");let{start:c,end:l}=g2(u,d.offset,d.length);if(l===0n)return;let m=0n,p=l-c,g=w2();d.onProgress?.(new ui("unixfs:exporter:walk:file",{cid:t})),Sve(s,e,g,0n,c,l,d).catch(v=>{g.end(v)});for await(let v of g)if(v!=null){if(m+=BigInt(v.byteLength),m>p)throw g.end(),(0,Av.default)(new Error("Read too many bytes - the file size reported by the UnixFS data in the root node may be incorrect"),"ERR_OVER_READ");m===p&&g.end(),d.onProgress?.(new ui("unixfs:exporter:progress:unixfs:file",{bytesRead:m,totalBytes:p,fileSize:u})),yield v}if(m{function a(d={}){return d.onProgress?.(new ui("unixfs:exporter:walk:hamt-sharded-directory",{cid:t})),Ave(e,n,i,o,s,d)}return a};async function*Ave(t,e,r,n,i,o){let s=t.Links,a=_2(s,d=>v2(d,u=>async()=>{let c=u.Name!=null?u.Name.substring(2):null;if(c!=null&&c!==""){let l=await r(u.Hash,c,`${e}/${c}`,[],n+1,i,o);return{entries:l.entry==null?[]:[l.entry]}}else{let l=await i.get(u.Hash,o);return t=Lf(l),o.onProgress?.(new ui("unixfs:exporter:walk:hamt-sharded-directory",{cid:u.Hash})),{entries:Ave(t,e,r,n,i,o)}}}),d=>Ev(d,{ordered:!0}));for await(let{entries:d}of a)yield*d}var Tve=vXe;var bXe=(t,e)=>t.Links.find(n=>n.Name===e)?.Hash,wXe={raw:LK,file:LK,directory:lve,"hamt-sharded-directory":Tve,metadata:(t,e,r,n,i,o,s)=>()=>[],symlink:(t,e,r,n,i,o,s)=>()=>[]},_Xe=async(t,e,r,n,i,o,s,a)=>{let d=await s.get(t,a),u=Lf(d),c,l;if(e==null&&(e=t.toString()),u.Data==null)throw(0,K3.default)(new Error("no data in PBNode"),"ERR_NOT_UNIXFS");try{c=yo.unmarshal(u.Data)}catch(p){throw(0,K3.default)(p,"ERR_NOT_UNIXFS")}if(r==null&&(r=e),n.length>0){let p;if(c?.type==="hamt-sharded-directory"?p=await sve(u,n[0],s):p=bXe(u,n[0]),p==null)throw(0,K3.default)(new Error("file does not exist"),"ERR_NOT_FOUND");let g=n.shift(),v=`${r}/${g}`;l={cid:p,toResolve:n,name:g??"",path:v}}let m=wXe[c.type](t,u,c,r,i,o,s);if(m==null)throw(0,K3.default)(new Error("could not find content exporter"),"ERR_NOT_FOUND");return c.isDirectory()?{entry:{type:"directory",name:e,path:r,cid:t,content:m,unixfs:c,depth:o,node:u,size:c.fileSize()},next:l}:{entry:{type:"file",name:e,path:r,cid:t,content:m,unixfs:c,depth:o,node:u,size:c.fileSize()},next:l}},Ive=_Xe;var xXe={[N_]:Ive,[Cp]:nve,[Vge]:Qge,[Zge.code]:tve},kve=async(t,e,r,n,i,o,s)=>{let a=xXe[t.code];if(a==null)throw(0,Pve.default)(new Error(`No resolver for code ${t.code}`),"ERR_NO_RESOLVER");return a(t,e,r,n,kve,i,o,s)},Rve=kve;var EXe=(t="")=>(t.trim().match(/([^\\^/]|\\\/)+/g)??[]).filter(Boolean),SXe=t=>{if(t instanceof Uint8Array)return{cid:qr.decode(t),toResolve:[]};let e=qr.asCID(t);if(e!=null)return{cid:e,toResolve:[]};if(typeof t=="string"){t.indexOf("/ipfs/")===0&&(t=t.substring(6));let r=EXe(t);return{cid:qr.parse(r[0]),toResolve:r.slice(1)}}throw(0,Uk.default)(new Error(`Unknown path type ${t}`),"ERR_BAD_PATH")};async function*AXe(t,e,r={}){let{cid:n,toResolve:i}=SXe(t),o=n.toString(),s=o,a=i.length;for(;;){let d=await Rve(n,o,s,i,a,e,r);if(d.entry==null&&d.next==null)throw(0,Uk.default)(new Error(`Could not resolve ${t}`),"ERR_NOT_FOUND");if(d.entry!=null&&(yield d.entry),d.next==null)return;i=d.next.toResolve,n=d.next.cid,o=d.next.name,s=d.next.path}}async function Dve(t,e,r={}){let n=await q0e(AXe(t,e,r));if(n==null)throw(0,Uk.default)(new Error(`Could not resolve ${t}`),"ERR_NOT_FOUND");return n}var Bve=Kt(UA(),1),xy=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},TXe=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(a,d){s=t[o](s),i(a,d,s.done,s.value)})}}function i(o,s,a,d){Promise.resolve(d).then(function(u){o({value:u,done:a})},s)}},x2=class{constructor(e={}){this.config=Object.assign({blockstoreLocation:"DATASTORE",createLevelDatabase:Fu},e),this.blockstore=new l2({location:this.config.blockstoreLocation,createLevelDatabase:this.config.createLevelDatabase})}open(){return xy(this,void 0,void 0,function*(){yield this.blockstore.open()})}close(){return xy(this,void 0,void 0,function*(){yield this.blockstore.close()})}put(e,r,n,i){var o,s,a,d,u,c;return xy(this,void 0,void 0,function*(){let l=yield this.getBlockstoreForStoringData(e,r,n),m=H_([{content:i}],l,{cidVersion:1}),p;try{for(var g=!0,v=TXe(m),E;E=yield v.next(),o=E.done,!o;g=!0)d=E.value,g=!1,p=d}catch(A){s={error:A}}finally{try{!g&&!o&&(a=v.return)&&(yield a.call(v))}finally{if(s)throw s.error}}return{dataSize:Number((c=(u=p.unixfs)===null||u===void 0?void 0:u.fileSize())!==null&&c!==void 0?c:p.size)}})}get(e,r,n){return xy(this,void 0,void 0,function*(){let i=yield this.getBlockstoreForStoringData(e,r,n);if(!(yield i.has(n)))return;let s=yield Dve(n,i),a=s.content(),d=new Bve.Readable({read(){return xy(this,void 0,void 0,function*(){let c=yield a.next();c.done?this.push(null):this.push(c.value)})}}),u=s.size;return(s.type==="file"||s.type==="directory")&&(u=s.unixfs.fileSize()),{dataSize:Number(u),dataStream:d}})}delete(e,r,n){return xy(this,void 0,void 0,function*(){yield(yield this.getBlockstoreForStoringData(e,r,n)).clear()})}clear(){return xy(this,void 0,void 0,function*(){yield this.blockstore.clear()})}getBlockstoreForStoringData(e,r,n){return xy(this,void 0,void 0,function*(){let i="data";return yield(yield(yield(yield this.blockstore.partition(i)).partition(e)).partition(r)).partition(n)})}};h();h();var ao=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},F3=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(a,d){s=t[o](s),i(a,d,s.done,s.value)})}}function i(o,s,a,d){Promise.resolve(d).then(function(u){o({value:u,done:a})},s)}},Tv=function(t){return this instanceof Tv?(this.v=t,this):new Tv(t)},IXe=function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(m){n[m]&&(i[m]=function(p){return new Promise(function(g,v){o.push([m,p,g,v])>1||a(m,p)})})}function a(m,p){try{d(n[m](p))}catch(g){l(o[0][3],g)}}function d(m){m.value instanceof Tv?Promise.resolve(m.value.v).then(u,c):l(o[0][2],m)}function u(m){a("next",m)}function c(m){a("throw",m)}function l(m,p){m(p),o.shift(),o.length&&a(o[0][0],o[0][1])}},Mve="index",Yh=class t{constructor(e){this.config=Object.assign({createLevelDatabase:Fu},e),this.db=new u2({location:this.config.location,createLevelDatabase:this.config.createLevelDatabase,keyEncoding:"utf8"})}open(){return ao(this,void 0,void 0,function*(){yield this.db.open()})}close(){return ao(this,void 0,void 0,function*(){yield this.db.close()})}clear(){return ao(this,void 0,void 0,function*(){yield this.db.clear()})}put(e,r,n,i){return ao(this,void 0,void 0,function*(){if(lE(n))throw new se(ne.IndexMissingIndexableProperty,"Index must include at least one valid indexable property");let o={messageCid:r,indexes:n},s=[];for(let c in n){let l=n[c];if(Array.isArray(l))for(let m of l){let p=this.createPutIndexedItemOperation(e,o,c,m);s.push(p)}else{let m=this.createPutIndexedItemOperation(e,o,c,l);s.push(m)}}let a=this.createOperationForIndexesLookupPartition(e,{type:"put",key:r,value:JSON.stringify(n)});s.push(a);let d=yield Promise.all(s);yield(yield this.db.partition(e)).batch(d,i)})}delete(e,r,n){return ao(this,void 0,void 0,function*(){let i=[],o=yield this.getIndexes(e,r);if(o===void 0)return;let s=this.createOperationForIndexesLookupPartition(e,{type:"del",key:r});i.push(s);for(let u in o){let c=o[u];if(Array.isArray(c))for(let l of c){let m=this.createDeleteIndexedItemOperation(e,r,u,l);i.push(m)}else{let l=this.createDeleteIndexedItemOperation(e,r,u,c);i.push(l)}}let a=yield Promise.all(i);yield(yield this.db.partition(e)).batch(a,n)})}createPutIndexedItemOperation(e,r,n,i){return ao(this,void 0,void 0,function*(){let{messageCid:o}=r,s=t.keySegmentJoin(t.encodeValue(i),o);return this.createOperationForIndexPartition(e,n,{type:"put",key:s,value:JSON.stringify(r)})})}createDeleteIndexedItemOperation(e,r,n,i){return ao(this,void 0,void 0,function*(){let o=t.keySegmentJoin(t.encodeValue(i),r);return this.createOperationForIndexPartition(e,n,{type:"del",key:o})})}createOperationForIndexPartition(e,r,n){return ao(this,void 0,void 0,function*(){let i=yield this.db.partition(e),o=t.getIndexPartitionName(r);return i.createPartitionOperation(o,n)})}createOperationForIndexesLookupPartition(e,r){return ao(this,void 0,void 0,function*(){return(yield this.db.partition(e)).createPartitionOperation(Mve,r)})}static getIndexPartitionName(e){return`__${e}__`}getIndexPartition(e,r){return ao(this,void 0,void 0,function*(){let n=t.getIndexPartitionName(r);return(yield this.db.partition(e)).partition(n)})}getIndexesLookupPartition(e){return ao(this,void 0,void 0,function*(){return(yield this.db.partition(e)).partition(Mve)})}query(e,r,n,i){return ao(this,void 0,void 0,function*(){return t.shouldQueryWithInMemoryPaging(r,n)?this.queryWithInMemoryPaging(e,r,n,i):this.queryWithIteratorPaging(e,r,n,i)})}queryWithIteratorPaging(e,r,n,i){var o,s,a,d;return ao(this,void 0,void 0,function*(){let{cursor:u,limit:c}=n,l=u?this.createStartingKeyFromCursor(u):"",m=[];try{for(var p=!0,g=F3(this.getIndexIterator(e,l,n,i)),v;v=yield g.next(),o=v.done,!o;p=!0){d=v.value,p=!1;let E=d;if(c!==void 0&&c===m.length)break;let{indexes:A}=E;Zn.matchAnyFilter(A,r)&&m.push(E)}}catch(E){s={error:E}}finally{try{!p&&!o&&(a=g.return)&&(yield a.call(g))}finally{if(s)throw s.error}}return m})}getIndexIterator(e,r,n,i){return IXe(this,arguments,function*(){var s,a,d,u;let{sortProperty:c,sortDirection:l=cs.Ascending,cursor:m}=n,p={gt:r};l===cs.Descending&&(p.reverse=!0,m!==void 0&&(p.lt=r,delete p.gt));let g=yield Tv(this.getIndexPartition(e,c));try{for(var v=!0,E=F3(g.iterator(p,i)),A;A=yield Tv(E.next()),s=A.done,!s;v=!0){u=A.value,v=!1;let[P,I]=u,{indexes:$,messageCid:N}=JSON.parse(I);yield yield Tv({indexes:$,messageCid:N})}}catch(P){a={error:P}}finally{try{!v&&!s&&(d=E.return)&&(yield Tv(d.call(E)))}finally{if(a)throw a.error}}})}createStartingKeyFromCursor(e){let{messageCid:r,value:n}=e;return t.keySegmentJoin(t.encodeValue(n),r)}static createCursorFromLastArrayItem(e,r){if(e.length>0)return this.createCursorFromItem(e.at(-1),r)}static createCursorFromItem(e,r){let{messageCid:n,indexes:i}=e,o=i[r];if(o===void 0)throw new se(ne.IndexInvalidCursorSortProperty,`the sort property '${r}' is not defined within the given item.`);if(typeof o=="boolean"||Array.isArray(o))throw new se(ne.IndexInvalidCursorValueType,`only string or number values are supported for cursors, a(n) ${typeof o} was given.`);return{messageCid:n,value:o}}queryWithInMemoryPaging(e,r,n,i){return ao(this,void 0,void 0,function*(){let{sortProperty:o,sortDirection:s=cs.Ascending,cursor:a,limit:d}=n,u=a?this.createStartingKeyFromCursor(a):void 0,c=new Map;r.length===0&&(r=[{}]);try{yield Promise.all(r.map(g=>this.executeSingleFilterQuery(e,g,o,c,i)))}catch(g){if(g.code===ne.IndexInvalidSortPropertyInMemory)return[]}let l=[...c.values()].sort((g,v)=>this.sortItems(g,v,o,s)),m=u!==void 0?this.findCursorStartingIndex(l,s,o,u):0;if(m<0)return[];let p=d!==void 0?m+d:void 0;return l.slice(m,p)})}executeSingleFilterQuery(e,r,n,i,o){return ao(this,void 0,void 0,function*(){let s=[];if(lE(r)){let d=this.getAllItems(e,n);s.push(d)}let a=zA.reduceFilter(r);for(let d in a){let u=a[d];if(Zn.isEqualFilter(u)){let c=this.filterExactMatches(e,d,u,o);s.push(c)}else if(Zn.isOneOfFilter(u))for(let c of new Set(u)){let l=this.filterExactMatches(e,d,c,o);s.push(l)}else if(Zn.isRangeFilter(u)){let c=this.filterRangeMatches(e,d,u,o);s.push(c)}}for(let d of s){let u=yield d;for(let c of u)if(!(i.has(c.messageCid)||!Zn.matchFilter(c.indexes,r))){if(c.indexes[n]===void 0)throw new se(ne.IndexInvalidSortPropertyInMemory,`invalid sort property ${n}`);i.set(c.messageCid,c)}}})}getAllItems(e,r){var n,i,o,s;return ao(this,void 0,void 0,function*(){let a=yield this.getIndexPartition(e,r),d=[];try{for(var u=!0,c=F3(a.iterator()),l;l=yield c.next(),n=l.done,!n;u=!0){s=l.value,u=!1;let[m,p]=s;d.push(JSON.parse(p))}}catch(m){i={error:m}}finally{try{!u&&!n&&(o=c.return)&&(yield o.call(c))}finally{if(i)throw i.error}}return d})}filterExactMatches(e,r,n,i){var o,s,a,d;return ao(this,void 0,void 0,function*(){let u=t.keySegmentJoin(t.encodeValue(n)),c={gt:u},l=yield this.getIndexPartition(e,r),m=[];try{for(var p=!0,g=F3(l.iterator(c,i)),v;v=yield g.next(),o=v.done,!o;p=!0){d=v.value,p=!1;let[E,A]=d;if(!E.startsWith(u))break;m.push(JSON.parse(A))}}catch(E){s={error:E}}finally{try{!p&&!o&&(a=g.return)&&(yield a.call(g))}finally{if(s)throw s.error}}return m})}filterRangeMatches(e,r,n,i){var o,s,a,d;return ao(this,void 0,void 0,function*(){let u={};for(let v in n){let E=v;u[E]=t.encodeValue(n[E])}u.gt===void 0&&u.gte===void 0&&(u.reverse=!0);let c=[],l=yield this.getIndexPartition(e,r);try{for(var m=!0,p=F3(l.iterator(u,i)),g;g=yield p.next(),o=g.done,!o;m=!0){d=g.value,m=!1;let[v,E]=d;"gt"in n&&this.extractIndexValueFromKey(v)===t.encodeValue(n.gt)||c.push(JSON.parse(E))}}catch(v){s={error:v}}finally{try{!m&&!o&&(a=p.return)&&(yield a.call(p))}finally{if(s)throw s.error}}if("lte"in n)for(let v of yield this.filterExactMatches(e,r,n.lte,i))c.push(v);return c})}sortItems(e,r,n,i){let o=e.indexes[n],s=r.indexes[n],a=t.encodeValue(o)+e.messageCid,d=t.encodeValue(s)+r.messageCid;return i===cs.Ascending?uE(a,d):uE(d,a)}findCursorStartingIndex(e,r,n,i){let o=s=>{let{messageCid:a,indexes:d}=s,u=d[n],c=t.keySegmentJoin(t.encodeValue(u),a);return r===cs.Ascending?c>i:c{let n=new Uint8Array(1);return r.getRandomValues(n),n[0]/255};if(typeof r?.randomBytes=="function")return()=>r.randomBytes(1).readUInt8()/255;throw new Hu({info:{code:"PRNG_DETECT",...Iv}},"Failed to find a reliable PRNG")}function DXe(){return CXe()?self:typeof window<"u"?window:typeof globalThis<"u"||typeof globalThis<"u"?globalThis:null}function BXe(t,e){let r="";for(;t>0;t--)r=OXe(e)+r;return r}function Nve(t,e){if(isNaN(t))throw new Hu({info:{code:"ENC_TIME_NAN",...Iv}},`Time must be a number: ${t}`);if(t>Ove)throw new Hu({info:{code:"ENC_TIME_SIZE_EXCEED",...Iv}},`Cannot encode a time larger than ${Ove}: ${t}`);if(t<0)throw new Hu({info:{code:"ENC_TIME_NEG",...Iv}},`Time must be positive: ${t}`);if(Number.isInteger(t)===!1)throw new Hu({info:{code:"ENC_TIME_TYPE",...Iv}},`Time must be an integer: ${t}`);let r,n="";for(let i=e;i>0;i--)r=t%S2,n=W3.charAt(r)+n,t=(t-r)/S2;return n}function MXe(t){let e,r=t.length,n,i,o=t,s=S2-1;for(;!e&&r-->=0;){if(n=o[r],i=W3.indexOf(n),i===-1)throw new Hu({info:{code:"B32_INC_ENC",...Iv}},"Incorrectly encoded string");if(i===s){o=jve(o,r,W3[0]);continue}e=jve(o,r,W3[i+1])}if(typeof e=="string")return e;throw new Hu({info:{code:"B32_INC_INVALID",...Iv}},"Failed incrementing string")}function CXe(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function qk(t){let e=t||RXe(),r=0,n;return function(o){let s=isNaN(o)?Date.now():o;if(s<=r){let d=n=MXe(n);return Nve(r,$ve)+d}r=s;let a=n=BXe(kXe,e);return Nve(s,$ve)+a}}function OXe(t){let e=Math.floor(t()*S2);return e===S2&&(e=S2-1),W3.charAt(e)}function jve(t,e,r){return e>t.length-1?t:t.substr(0,e)+r+t.substr(e+1)}var Pv=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},A2=class{constructor(e){this.index=new Yh(Object.assign({location:"EVENTLOG",createLevelDatabase:Fu},e)),this.ulidFactory=qk()}open(){return Pv(this,void 0,void 0,function*(){return this.index.open()})}close(){return Pv(this,void 0,void 0,function*(){return this.index.close()})}clear(){return Pv(this,void 0,void 0,function*(){return this.index.clear()})}append(e,r,n){return Pv(this,void 0,void 0,function*(){let i=this.ulidFactory();yield this.index.put(e,r,Object.assign(Object.assign({},n),{watermark:i}))})}queryEvents(e,r,n){return Pv(this,void 0,void 0,function*(){let i=yield this.index.query(e,r,{sortProperty:"watermark",cursor:n});return{events:i.map(({messageCid:o})=>o),cursor:Yh.createCursorFromLastArrayItem(i,"watermark")}})}getEvents(e,r){return Pv(this,void 0,void 0,function*(){return this.queryEvents(e,[],r)})}deleteEventsByCid(e,r){return Pv(this,void 0,void 0,function*(){let n=[];for(let i of r)n.push(this.index.delete(e,i));yield Promise.all(n)})}};h();h();I_();g7();function Lk({enumerable:t=!0,configurable:e=!1}={}){return{enumerable:t,configurable:e,writable:!1}}function*$Xe(t,e){if(e!=null&&typeof e=="object")if(Array.isArray(e))for(let[r,n]of e.entries()){let i=[...t,r],o=qr.asCID(n);o?yield[i.join("/"),o]:typeof n=="object"&&(yield*KK(n,i))}else{let r=qr.asCID(e);r?yield[t.join("/"),r]:yield*KK(e,t)}}function*KK(t,e){if(t==null||t instanceof Uint8Array)return;let r=qr.asCID(t);r&&(yield[e.join("/"),r]);for(let[n,i]of Object.entries(t)){let o=[...e,n];yield*$Xe(o,i)}}function*NXe(t,e){if(Array.isArray(e))for(let[r,n]of e.entries()){let i=[...t,r];yield i.join("/"),typeof n=="object"&&!qr.asCID(n)&&(yield*FK(n,i))}else yield*FK(e,t)}function*FK(t,e){if(!(t==null||typeof t!="object"))for(let[r,n]of Object.entries(t)){let i=[...e,r];yield i.join("/"),n!=null&&!(n instanceof Uint8Array)&&typeof n=="object"&&!qr.asCID(n)&&(yield*NXe(i,n))}}function jXe(t,e){let r=t;for(let[n,i]of e.entries()){if(r=r[i],r==null)throw new Error(`Object has no property at ${e.slice(0,n+1).map(s=>`[${JSON.stringify(s)}]`).join("")}`);let o=qr.asCID(r);if(o)return{value:o,remaining:e.slice(n+1).join("/")}}return{value:r}}var Kk=class{constructor({cid:e,bytes:r,value:n}){if(!e||!r||typeof n>"u")throw new Error("Missing required argument");this.cid=e,this.bytes=r,this.value=n,this.asBlock=this,Object.defineProperties(this,{cid:Lk(),bytes:Lk(),value:Lk(),asBlock:Lk()})}links(){return KK(this.value,[])}tree(){return FK(this.value,[])}get(e="/"){return jXe(this.value,e.split("/").filter(Boolean))}};async function Uve({value:t,codec:e,hasher:r}){if(typeof t>"u")throw new Error('Missing required argument "value"');if(!e||!r)throw new Error("Missing required argument: codec or hasher");let n=e.encode(t),i=await r.digest(n),o=qr.create(1,e.code,i);return new Kk({value:t,bytes:n,cid:o})}async function qve({bytes:t,codec:e,hasher:r}){if(!t)throw new Error('Missing required argument "bytes"');if(!e||!r)throw new Error("Missing required argument: codec or hasher");let n=e.decode(t),i=await r.digest(t),o=qr.create(1,e.code,i);return new Kk({value:n,bytes:t,cid:o})}Uf();var kv=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},T2=class t{constructor(e={}){this.config=Object.assign({blockstoreLocation:"MESSAGESTORE",indexLocation:"INDEX",createLevelDatabase:Fu},e),this.blockstore=new l2({location:this.config.blockstoreLocation,createLevelDatabase:this.config.createLevelDatabase}),this.index=new Yh({location:this.config.indexLocation,createLevelDatabase:this.config.createLevelDatabase})}open(){return kv(this,void 0,void 0,function*(){yield this.blockstore.open(),yield this.index.open()})}close(){return kv(this,void 0,void 0,function*(){yield this.blockstore.close(),yield this.index.close()})}get(e,r,n){var i;return kv(this,void 0,void 0,function*(){(i=n?.signal)===null||i===void 0||i.throwIfAborted();let o=yield Fi(this.blockstore.partition(e),n?.signal),s=qr.parse(r),a=yield o.get(s,n);return a?(yield Fi(qve({bytes:a,codec:o0,hasher:bs}),n?.signal)).value:void 0})}query(e,r,n,i,o){var s;return kv(this,void 0,void 0,function*(){(s=o?.signal)===null||s===void 0||s.throwIfAborted();let a=t.buildQueryOptions(n,i),d=yield this.index.query(e,r,a,o),u;i?.limit!==void 0&&i.limit0&&(n=n+1),{sortDirection:d,sortProperty:u,limit:n,cursor:i}}delete(e,r,n){var i;return kv(this,void 0,void 0,function*(){(i=n?.signal)===null||i===void 0||i.throwIfAborted();let o=yield Fi(this.blockstore.partition(e),n?.signal),s=qr.parse(r);yield o.delete(s,n),yield this.index.delete(e,r,n)})}put(e,r,n,i){var o;return kv(this,void 0,void 0,function*(){(o=i?.signal)===null||o===void 0||o.throwIfAborted();let s=yield Fi(this.blockstore.partition(e),i?.signal),a=yield Fi(Uve({value:r,codec:o0,hasher:bs}),i?.signal),d=Pn.parseCid(yield be.getCid(r));yield s.put(d,a.bytes,i);let u=d.toString();yield this.index.put(e,u,n,i)})}clear(){return kv(this,void 0,void 0,function*(){yield this.blockstore.clear(),yield this.index.clear()})}};h();var qXe=Kt(lc(),1);h();Uf();var It;(function(t){t.EventsGet="EventsGet",t.EventsQuery="EventsQuery",t.EventsSubscribe="EventsSubscribe",t.MessagesGet="MessagesGet",t.ProtocolsConfigure="ProtocolsConfigure",t.ProtocolsQuery="ProtocolsQuery",t.RecordsDelete="RecordsDelete",t.RecordsQuery="RecordsQuery",t.RecordsRead="RecordsRead",t.RecordsSubscribe="RecordsSubscribe",t.RecordsWrite="RecordsWrite"})(It||(It={}));var V3={[It.EventsGet]:Pm,[It.EventsQuery]:Rm,[It.EventsSubscribe]:Dm,[It.MessagesGet]:Bm,[It.ProtocolsConfigure]:Lm,[It.ProtocolsQuery]:Km,[It.RecordsDelete]:Fm,[It.RecordsQuery]:Im,[It.RecordsRead]:Og,[It.RecordsSubscribe]:zm,[It.RecordsWrite]:Hr};h();var KXe=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Rv=class{constructor({did:e,metadata:r}){this.did=e,this.metadata=r}export(){return KXe(this,void 0,void 0,function*(){return{portableDid:yield this.did.export(),metadata:this.metadata}})}};h();tn();h();tn();h();uy();Tr();var FXe=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Fk=class{static deriveKeyBytes({baseKeyBytes:e,length:r,hash:n,salt:i,info:o=new Uint8Array}){return FXe(this,void 0,void 0,function*(){let a=yield ma().importKey("raw",e,{name:"HKDF"},!1,["deriveBits"]);i=typeof i=="string"?de.string(i).toUint8Array():i,o=typeof o=="string"?de.string(o).toUint8Array():o;let d=yield crypto.subtle.deriveBits({name:"HKDF",hash:n,salt:i,info:o},a,r);return new Uint8Array(d)})}};var zXe=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},WXe=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);isuper.delete}});return np(this,void 0,void 0,function*(){return yield r.delete.call(this,e)})}get(e){let r=Object.create(null,{get:{get:()=>super.get}});return np(this,void 0,void 0,function*(){return yield r.get.call(this,e)})}list(e){let r=Object.create(null,{list:{get:()=>super.list}});return np(this,void 0,void 0,function*(){return yield r.list.call(this,e)})}set(e){let r=Object.create(null,{set:{get:()=>super.set}});return np(this,void 0,void 0,function*(){return yield r.set.call(this,e)})}getAllRecords({agent:e,tenantDid:r}){var n;return np(this,void 0,void 0,function*(){this._index.clear();let{reply:i}=yield e.dwn.processRequest({author:r,target:r,messageType:It.RecordsQuery,messageParams:{filter:Object.assign({},this._recordProperties)}}),o=[];for(let s of(n=i.entries)!==null&&n!==void 0?n:[]){if(!s.encodedData)throw new Error(`${this.name}: Expected 'encodedData' to be present in the DWN query result entry`);let a=de.base64Url(s.encodedData).toObject();if(eS(a)){let d=`${r}${ms}${a.uri}`;this._index.set(d,s.recordId),this._cache.set(s.recordId,a),o.push(a)}}return o})}},rS=class extends Dy{constructor(){super(...arguments),this.name="InMemoryDidStore"}delete(e){let r=Object.create(null,{delete:{get:()=>super.delete}});return np(this,void 0,void 0,function*(){return yield r.delete.call(this,e)})}get(e){let r=Object.create(null,{get:{get:()=>super.get}});return np(this,void 0,void 0,function*(){return yield r.get.call(this,e)})}list(e){let r=Object.create(null,{list:{get:()=>super.list}});return np(this,void 0,void 0,function*(){return yield r.list.call(this,e)})}set(e){let r=Object.create(null,{set:{get:()=>super.set}});return np(this,void 0,void 0,function*(){return yield r.set.call(this,e)})}};h();var abe=Kt(wv(),1);Tr();var nS=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},iS=class{constructor({ttl:e="15m"}={}){this.cache=new Wm.default({ttl:(0,abe.default)(e)})}get(e){return nS(this,void 0,void 0,function*(){if(!e)throw new Error("Key cannot be null or undefined");return this.cache.get(e)})}set(e,r){return nS(this,void 0,void 0,function*(){this.cache.set(e,r)})}delete(e){return nS(this,void 0,void 0,function*(){this.cache.delete(e)})}clear(){return nS(this,void 0,void 0,function*(){this.cache.clear()})}close(){return nS(this,void 0,void 0,function*(){})}};var B2=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})},Ov;(function(t){t.Create="Create",t.Resolve="Resolve"})(Ov||(Ov={}));function cbe(t,e){return t.messageType===e}var oS=class extends ky{constructor({agent:e,didMethods:r,resolverCache:n,store:i}){if(!r)throw new TypeError("AgentDidApi: Required parameter missing: 'didMethods'");super({didResolvers:r,cache:n??new iS}),this._didMethods=new Map,this._agent=e,this._store=i??new rS;for(let o of r)this._didMethods.set(o.methodName,o)}get agent(){if(this._agent===void 0)throw new Error("AgentDidApi: Unable to determine agent execution context.");return this._agent}set agent(e){this._agent=e}create({method:e,tenant:r,options:n,store:i}){return B2(this,void 0,void 0,function*(){let s=yield this.getMethod(e).create({keyManager:this.agent.keyManager,options:n});if(i??!0){let{uri:a,document:d,metadata:u}=s,c={uri:a,document:d,metadata:u};yield this._store.set({id:c.uri,data:c,agent:this.agent,tenant:r??c.uri,preventDuplicates:!1,useCache:!0})}return s})}export({didUri:e,tenant:r}){return B2(this,void 0,void 0,function*(){let n=yield this.get({didUri:e,tenant:r});if(!n)throw new Error(`AgentDidApi: Failed to export due to DID not found: ${e}`);return yield n.export()})}get({didUri:e,tenant:r}){return B2(this,void 0,void 0,function*(){let n=yield this._store.get({id:e,agent:this.agent,tenant:r,useCache:!0});return n?yield co.import({portableDid:n,keyManager:this.agent.keyManager}):void 0})}getSigningMethod({didUri:e,methodId:r}){return B2(this,void 0,void 0,function*(){let n=cr.parse(e);if(!n)throw new Error(`Invalid DID URI: ${e}`);let i=this.getMethod(n.method),{didDocument:o,didResolutionMetadata:s}=yield this.resolve(e);if(!o)throw new Error(`DID resolution failed for '${e}': ${JSON.stringify(s)}`);return yield i.getSigningMethod({didDocument:o,methodId:r})})}import({portableDid:e,tenant:r}){return B2(this,void 0,void 0,function*(){let n=yield co.import({keyManager:this.agent.keyManager,portableDid:e}),{uri:i,document:o,metadata:s}=n,a={uri:i,document:o,metadata:s};return yield this._store.set({id:a.uri,data:a,agent:this.agent,tenant:r??a.uri,preventDuplicates:!0,useCache:!0}),n})}processRequest(e){var r;return B2(this,void 0,void 0,function*(){if(cbe(e,Ov.Create))try{let n=yield this.create(Object.assign({},e.messageParams));return{result:{uri:n.uri,document:n.document,metadata:n.metadata},ok:!0,status:{code:201,message:"Created"}}}catch(n){return{ok:!1,status:{code:500,message:(r=n.message)!==null&&r!==void 0?r:"Unknown error occurred"}}}if(cbe(e,Ov.Resolve)){let{didUri:n,options:i}=e.messageParams;return{result:yield this.resolve(n,i),ok:!0,status:{code:200,message:"OK"}}}throw new Error(`AgentDidApi: Unsupported request type: ${e.messageType}`)})}getMethod(e){let r=this._didMethods.get(e);if(r===void 0)throw new Error(`DID Method not supported: ${e}`);return r}};h();Tr();tn();tp();h();tp();var lbe=Kt(dbe(),1);var ube=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})};function tF(t){return oR(t.stream())}function iR(t,e){return ube(this,void 0,void 0,function*(){let r=yield e.dereference(`${t}#dwn`);if(r.dereferencingMetadata.error)throw new Error(`Failed to dereference '${t}#dwn': ${r.dereferencingMetadata.error}`);if(P2.isDwnDidService(r.contentStream)){let{serviceEndpoint:n}=r.contentStream,i=typeof n=="string"?[n]:Array.isArray(n)&&n.every(o=>typeof o=="string")?n:[];if(i.length>0)return i}return[]})}function rF(t){return mt.getAuthor(t)}function M2(t){return!t||typeof t!="object"||t===null?!1:"message"in t&&typeof t.message=="object"&&t.message!==null&&"descriptor"in t.message&&typeof t.message.descriptor=="object"&&t.message.descriptor!==null&&"interface"in t.message.descriptor&&t.message.descriptor.interface===Oe.Records&&"method"in t.message.descriptor&&t.message.descriptor.method===Ae.Write}function sQe(t){return be.getCid(t)}function fbe(t,e){return ube(this,void 0,void 0,function*(){let r=e===qi.CreatedAscending||e===qi.CreatedDescending?t.descriptor.dateCreated:t.descriptor.datePublished;if(r===void 0)throw new Error("The dateCreated or datePublished property is missing from the record descriptor.");return{messageCid:yield sQe(t),value:r}})}function oR(t){return new lbe.ReadableWebToNodeStream(t)}var Yu=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 a(c){try{u(n.next(c))}catch(l){s(l)}}function d(c){try{u(n.throw(c))}catch(l){s(l)}}function u(c){c.done?o(c.value):i(c.value).then(a,d)}u((n=n.apply(t,e||[])).next())})};function aQe(t,e){return t.messageType===e}var C2=class{constructor({agent:e,dwn:r}){this._agent=e,this._dwn=r}get agent(){if(this._agent===void 0)throw new Error("AgentDwnApi: Unable to determine agent execution context.");return this._agent}set agent(e){this._agent=e}get node(){return this._dwn}static createDwn({dataPath:e,dataStore:r,didResolver:n,eventLog:i,eventStream:o,messageStore:s,tenantGate:a}){return Yu(this,void 0,void 0,function*(){return r??(r=new x2({blockstoreLocation:`${e}/DWN_DATASTORE`})),n??(n=new ky({didResolvers:[Ya,Py],cache:new Cv({location:`${e}/DID_RESOLVERCACHE`})})),i??(i=new A2({location:`${e}/DWN_EVENTLOG`})),s??(s=new T2({blockstoreLocation:`${e}/DWN_MESSAGESTORE`,indexLocation:`${e}/DWN_MESSAGEINDEX`})),yield P3.create({dataStore:r,didResolver:n,eventLog:i,eventStream:o,messageStore:s,tenantGate:a})})}processRequest(e){return Yu(this,void 0,void 0,function*(){let{message:r,dataStream:n}=yield this.constructDwnMessage({request:e}),{subscriptionHandler:i}=e;return{reply:e.store!==!1?yield this._dwn.processMessage(e.target,r,{dataStream:n,subscriptionHandler:i}):{status:{code:202,detail:"Accepted"}},message:r,messageCid:yield be.getCid(r)}})}sendRequest(e){return Yu(this,void 0,void 0,function*(){let r=yield iR(e.target,this.agent.did);if(r.length===0)throw new Error(`AgentDwnApi: DID Service is missing or malformed: ${e.target}#dwn`);let n,i,o,s;if("messageCid"in e)({message:i,data:o}=yield this.getDwnMessage({author:e.author,messageCid:e.messageCid,messageType:e.messageType})),n=e.messageCid;else{if({message:i}=yield this.constructDwnMessage({request:e}),e.dataStream&&!(e.dataStream instanceof Blob))throw new Error("AgentDwnApi: DataStream must be provided as a Blob");o=e.dataStream,s=e.subscriptionHandler}let a=yield this.sendDwnRpcRequest({targetDid:e.target,dwnEndpointUrls:r,message:i,data:o,subscriptionHandler:s});return n??(n=yield be.getCid(i)),{reply:a,message:i,messageCid:n}})}sendDwnRpcRequest({targetDid:e,dwnEndpointUrls:r,message:n,data:i,subscriptionHandler:o}){return Yu(this,void 0,void 0,function*(){let s=[];if(n.descriptor.method===Ae.Subscribe&&o===void 0)throw new Error("AgentDwnApi: Subscription handler is required for subscription requests.");for(let a of r)try{if(o!==void 0){if(!(yield this.agent.rpc.getServerInfo(a)).webSocketSupport){s.push({url:a,message:"WebSocket support is not enabled on the server."});continue}let c=new URL(a);c.protocol=c.protocol==="http:"?"ws:":"wss:",a=c.toString()}return yield this.agent.rpc.sendDwnRequest({dwnUrl:a,targetDid:e,message:n,data:i,subscriptionHandler:o})}catch(d){s.push({url:a,message:d instanceof Error?d.message:"Unknown error"})}throw new Error(`Failed to send DWN RPC request: ${JSON.stringify(s)}`)})}constructDwnMessage({request:e}){var r;return Yu(this,void 0,void 0,function*(){let n=e.rawMessage,i;if(aQe(e,It.RecordsWrite)){let d=e.messageParams;if(e.dataStream&&!d?.data){let{dataStream:u}=e,c;if(u instanceof Blob)c=tF(u),i=tF(u);else if(u instanceof ReadableStream){let[l,m]=u.tee();c=oR(l),i=oR(m)}n||(d.dataCid=yield Pn.computeDagPbCidFromStream(c),(r=d.dataSize)!==null&&r!==void 0||(d.dataSize=c.bytesRead))}}let o=yield this.getSigner(e.author),s=V3[e.messageType],a=n?yield s.parse(n):yield s.create(Object.assign(Object.assign({},e.messageParams),{signer:o}));return M2(a)&&e.signAsOwner&&(yield a.signAsOwner(o)),{message:a.message,dataStream:i}})}getSigner(e){return Yu(this,void 0,void 0,function*(){if(e===this.agent.agentDid.uri){let r=yield this.agent.agentDid.getSigner();return{algorithm:r.algorithm,keyId:r.keyId,sign:n=>Yu(this,void 0,void 0,function*(){return yield r.sign({data:n})})}}else try{let r=yield this.agent.did.getSigningMethod({didUri:e});if(!r.publicKeyJwk)throw new Error(`Verification method '${r.id}' does not contain a public key in JWK format`);let n=yield this.agent.keyManager.getKeyUri({key:r.publicKeyJwk}),i=yield this.agent.keyManager.getPublicKey({keyUri:n}),o=this.agent.keyManager;return{algorithm:Mi.getJoseSignatureAlgorithmFromPublicKey(i),keyId:r.id,sign:s=>Yu(this,void 0,void 0,function*(){return yield o.sign({data:s,keyUri:n})})}}catch(r){throw new Error(`AgentDwnApi: Unable to get signer for author '${e}': ${r.message}`)}})}getDwnMessage({author:e,messageCid:r}){return Yu(this,void 0,void 0,function*(){let n=yield this.getSigner(e),i=yield V3[It.MessagesGet].create({messageCids:[r],signer:n}),o=yield this._dwn.processMessage(e,i.message);if(!(o.entries&&o.entries.length===1))throw new Error("AgentDwnApi: Expected 1 message entry in the MessagesGet response but received none or more than one.");let[s]=o.entries,a=s.message;if(!a)throw new Error(`AgentDwnApi: Message not found with CID: ${r}`);let d={message:a};if(M2(s))if(s.encodedData){let u=de.base64Url(s.encodedData).toUint8Array();d.data=new Blob([u])}else{let u=yield V3[It.RecordsRead].create({filter:{recordId:s.message.recordId},signer:n}),c=yield this._dwn.processMessage(e,u.message);if(c.status.code>=400){let{status:{code:l,detail:m}}=c;throw new Error(`AgentDwnApi: (${l}) Failed to read data associated with record ${s.message.recordId}. ${m}}`)}else if(c.record){let l=yield ko.consumeToBytes({readable:c.record.data});d.data=new Blob([l])}}return d})}createMessage({author:e,messageParams:r,messageType:n}){return Yu(this,void 0,void 0,function*(){let i=yield this.getSigner(e);return yield V3[n].create(Object.assign(Object.assign({},r),{signer:i}))})}processMessage({dataStream:e,message:r,targetDid:n}){return Yu(this,void 0,void 0,function*(){return yield this._dwn.processMessage(n,r,{dataStream:e})})}};h();h();kP();XS();h();i5();Wc();var cQe=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),pbe=Uint8Array.from({length:16},(t,e)=>e),dQe=pbe.map(t=>(9*t+5)%16),iF=[pbe],oF=[dQe];for(let t=0;t<4;t++)for(let e of[iF,oF])e.push(e[t].map(r=>cQe[r]));var mbe=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(t=>new Uint8Array(t)),uQe=iF.map((t,e)=>t.map(r=>mbe[e][r])),lQe=oF.map((t,e)=>t.map(r=>mbe[e][r])),fQe=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),hQe=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),sR=(t,e)=>t<>>32-e;function hbe(t,e,r,n){return t===0?e^r^n:t===1?e&r|~e&n:t===2?(e|~r)^n:t===3?e&n|r&~n:e^(r|~n)}var aR=new Uint32Array(16),nF=class extends vp{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){let{h0:e,h1:r,h2:n,h3:i,h4:o}=this;return[e,r,n,i,o]}set(e,r,n,i,o){this.h0=e|0,this.h1=r|0,this.h2=n|0,this.h3=i|0,this.h4=o|0}process(e,r){for(let p=0;p<16;p++,r+=4)aR[p]=e.getUint32(r,!0);let n=this.h0|0,i=n,o=this.h1|0,s=o,a=this.h2|0,d=a,u=this.h3|0,c=u,l=this.h4|0,m=l;for(let p=0;p<5;p++){let g=4-p,v=fQe[p],E=hQe[p],A=iF[p],P=oF[p],I=uQe[p],$=lQe[p];for(let N=0;N<16;N++){let K=sR(n+hbe(p,o,a,u)+aR[A[N]]+v,I[N])+l|0;n=l,l=u,u=sR(a,10)|0,a=o,o=K}for(let N=0;N<16;N++){let K=sR(i+hbe(g,s,d,c)+aR[P[N]]+E,$[N])+m|0;i=m,m=c,c=sR(d,10)|0,d=s,s=K}}this.set(this.h1+a+c|0,this.h2+u+m|0,this.h3+l+i|0,this.h4+n+s|0,this.h0+o+d|0)}roundClean(){aR.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}},ybe=rb(()=>new nF);_p();TP();Wc();Qv();var pQe=i_("ed25519 seed"),sF=2147483648,gbe=new Uint8Array([0]);function vbe(t,...e){return typeof t=="string"&&(t=sW(t)),Af(t,...e),t}var mQe=t=>ybe(ws(t)),yQe=t=>If(t).getUint32(0,!1),aF=t=>{if(!Number.isSafeInteger(t)||t<0||t>2**32-1)throw new Error(`Invalid number=${t}. Should be from 0 to 2 ** 32 - 1`);let e=new Uint8Array(4);return If(e).setUint32(0,t,!1),e},cR=class t{get publicKeyRaw(){return Bd.getPublicKey(this.privateKey)}get publicKey(){return Wy(gbe,this.publicKeyRaw)}get pubHash(){return mQe(this.publicKey)}get fingerprint(){return yQe(this.pubHash)}get fingerprintHex(){return l9(aF(this.fingerprint))}get parentFingerprintHex(){return l9(aF(this.parentFingerprint))}static fromMasterSeed(e){if(e=vbe(e),8*e.length<128||8*e.length>512)throw new Error(`HDKey: wrong seed length=${e.length}. Should be between 128 and 512 bits; 256 bits is advised)`);let r=yp(dy,pQe,e);return new t({privateKey:r.slice(0,32),chainCode:r.slice(32)})}constructor(e){if(this.depth=0,this.index=0,this.parentFingerprint=0,!e||typeof e!="object")throw new Error("HDKey.constructor must not be called directly");if(Af(e.privateKey,32),Af(e.chainCode,32),this.depth=e.depth||0,this.index=e.index||0,this.parentFingerprint=e.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");this.chainCode=e.chainCode,this.privateKey=e.privateKey}derive(e,r=!1){if(!/^[mM]'?/.test(e))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(e))return this;let n=e.replace(/^[mM]'?\//,"").split("/"),i=this;for(let o of n){let s=/^(\d+)('?)$/.exec(o);if(!s||s.length!==3)throw new Error(`Invalid child index: ${o}`);let a=+s[1];if(!Number.isSafeInteger(a)||a>=sF)throw new Error("Invalid index");(r||s[2]==="'")&&(a+=sF),i=i.deriveChild(a)}return i}deriveChild(e){if(e