@ninsei-labs/sdk 0.49.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +18 -0
- package/assets/vendors/atomic/atomic-browser.js +24 -0
- package/assets/vendors/monero/monero-js-browser.js +58 -0
- package/assets/vendors/monero-js/LICENSE +9 -0
- package/assets/vendors/sdk/sdk-browser.js +14 -0
- package/assets/vendors/walletconnect/wc-browser.js +6202 -0
- package/engine/atomic/order-worker.js +129 -0
- package/engine/core/config.js +3 -1
- package/engine/sdk/bridge.js +3 -3
- package/index.d.ts +74 -2
- package/package.json +4 -2
- package/src/actions.mjs +15 -0
- package/src/adapters/monero-wallet.mjs +26 -0
- package/src/config.mjs +9 -0
- package/src/index.mjs +2 -0
- package/src/public/networks.d.ts +2 -0
- package/src/public/recovery.d.ts +16 -0
- package/src/quotes.mjs +100 -3
- package/src/recovery-key.mjs +101 -13
- package/src/swaps.mjs +17 -4
- package/src/sweep-half.mjs +14 -0
- package/src/sweep-restore.mjs +4 -1
- package/src/sweep.mjs +85 -5
- package/src/version.mjs +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var tu=Object.create;var Fo=Object.defineProperty;var eu=Object.getOwnPropertyDescriptor;var ru=Object.getOwnPropertyNames;var nu=Object.getPrototypeOf,iu=Object.prototype.hasOwnProperty;var ou=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var nt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var su=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ru(t))!iu.call(e,i)&&i!==r&&Fo(e,i,{get:()=>t[i],enumerable:!(n=eu(t,i))||n.enumerable});return e};var ii=(e,t,r)=>(r=e!=null?tu(nu(e)):{},su(t||!e||!e.__esModule?Fo(r,"default",{value:e,enumerable:!0}):r,e));var Uo=nt(on=>{"use strict";F();on.byteLength=au;on.toByteArray=cu;on.fromByteArray=du;var ie=[],Jt=[],fu=typeof Uint8Array<"u"?Uint8Array:Array,oi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ge=0,No=oi.length;Ge<No;++Ge)ie[Ge]=oi[Ge],Jt[oi.charCodeAt(Ge)]=Ge;var Ge,No;Jt[45]=62;Jt[95]=63;function qo(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function au(e){var t=qo(e),r=t[0],n=t[1];return(r+n)*3/4-n}function uu(e,t,r){return(t+r)*3/4-r}function cu(e){var t,r=qo(e),n=r[0],i=r[1],f=new fu(uu(e,n,i)),a=0,m=i>0?n-4:n,d;for(d=0;d<m;d+=4)t=Jt[e.charCodeAt(d)]<<18|Jt[e.charCodeAt(d+1)]<<12|Jt[e.charCodeAt(d+2)]<<6|Jt[e.charCodeAt(d+3)],f[a++]=t>>16&255,f[a++]=t>>8&255,f[a++]=t&255;return i===2&&(t=Jt[e.charCodeAt(d)]<<2|Jt[e.charCodeAt(d+1)]>>4,f[a++]=t&255),i===1&&(t=Jt[e.charCodeAt(d)]<<10|Jt[e.charCodeAt(d+1)]<<4|Jt[e.charCodeAt(d+2)]>>2,f[a++]=t>>8&255,f[a++]=t&255),f}function lu(e){return ie[e>>18&63]+ie[e>>12&63]+ie[e>>6&63]+ie[e&63]}function hu(e,t,r){for(var n,i=[],f=t;f<r;f+=3)n=(e[f]<<16&16711680)+(e[f+1]<<8&65280)+(e[f+2]&255),i.push(lu(n));return i.join("")}function du(e){for(var t,r=e.length,n=r%3,i=[],f=16383,a=0,m=r-n;a<m;a+=f)i.push(hu(e,a,a+f>m?m:a+f));return n===1?(t=e[r-1],i.push(ie[t>>2]+ie[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(ie[t>>10]+ie[t>>4&63]+ie[t<<2&63]+"=")),i.join("")}});var Co=nt(si=>{F();si.read=function(e,t,r,n,i){var f,a,m=i*8-n-1,d=(1<<m)-1,x=d>>1,v=-7,_=r?i-1:0,M=r?-1:1,S=e[t+_];for(_+=M,f=S&(1<<-v)-1,S>>=-v,v+=m;v>0;f=f*256+e[t+_],_+=M,v-=8);for(a=f&(1<<-v)-1,f>>=-v,v+=n;v>0;a=a*256+e[t+_],_+=M,v-=8);if(f===0)f=1-x;else{if(f===d)return a?NaN:(S?-1:1)*(1/0);a=a+Math.pow(2,n),f=f-x}return(S?-1:1)*a*Math.pow(2,f-n)};si.write=function(e,t,r,n,i,f){var a,m,d,x=f*8-i-1,v=(1<<x)-1,_=v>>1,M=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,S=n?0:f-1,C=n?1:-1,N=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(m=isNaN(t)?1:0,a=v):(a=Math.floor(Math.log(t)/Math.LN2),t*(d=Math.pow(2,-a))<1&&(a--,d*=2),a+_>=1?t+=M/d:t+=M*Math.pow(2,1-_),t*d>=2&&(a++,d/=2),a+_>=v?(m=0,a=v):a+_>=1?(m=(t*d-1)*Math.pow(2,i),a=a+_):(m=t*Math.pow(2,_-1)*Math.pow(2,i),a=0));i>=8;e[r+S]=m&255,S+=C,m/=256,i-=8);for(a=a<<i|m,x+=i;x>0;e[r+S]=a&255,S+=C,a/=256,x-=8);e[r+S-C]|=N*128}});var we=nt(vr=>{"use strict";F();var fi=Uo(),br=Co(),Do=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;vr.Buffer=O;vr.SlowBuffer=bu;vr.INSPECT_MAX_BYTES=50;var sn=2147483647;vr.kMaxLength=sn;O.TYPED_ARRAY_SUPPORT=pu();!O.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 pu(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(O.prototype,"parent",{enumerable:!0,get:function(){if(O.isBuffer(this))return this.buffer}});Object.defineProperty(O.prototype,"offset",{enumerable:!0,get:function(){if(O.isBuffer(this))return this.byteOffset}});function ce(e){if(e>sn)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,O.prototype),t}function O(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return li(e)}return zo(e,t,r)}O.poolSize=8192;function zo(e,t,r){if(typeof e=="string")return mu(e,t);if(ArrayBuffer.isView(e))return yu(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(oe(e,ArrayBuffer)||e&&oe(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(oe(e,SharedArrayBuffer)||e&&oe(e.buffer,SharedArrayBuffer)))return ui(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return O.from(n,t,r);let i=wu(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return O.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}O.from=function(e,t,r){return zo(e,t,r)};Object.setPrototypeOf(O.prototype,Uint8Array.prototype);Object.setPrototypeOf(O,Uint8Array);function Zo(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function gu(e,t,r){return Zo(e),e<=0?ce(e):t!==void 0?typeof r=="string"?ce(e).fill(t,r):ce(e).fill(t):ce(e)}O.alloc=function(e,t,r){return gu(e,t,r)};function li(e){return Zo(e),ce(e<0?0:hi(e)|0)}O.allocUnsafe=function(e){return li(e)};O.allocUnsafeSlow=function(e){return li(e)};function mu(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!O.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=Wo(e,t)|0,n=ce(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}function ai(e){let t=e.length<0?0:hi(e.length)|0,r=ce(t);for(let n=0;n<t;n+=1)r[n]=e[n]&255;return r}function yu(e){if(oe(e,Uint8Array)){let t=new Uint8Array(e);return ui(t.buffer,t.byteOffset,t.byteLength)}return ai(e)}function ui(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return t===void 0&&r===void 0?n=new Uint8Array(e):r===void 0?n=new Uint8Array(e,t):n=new Uint8Array(e,t,r),Object.setPrototypeOf(n,O.prototype),n}function wu(e){if(O.isBuffer(e)){let t=hi(e.length)|0,r=ce(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||pi(e.length)?ce(0):ai(e);if(e.type==="Buffer"&&Array.isArray(e.data))return ai(e.data)}function hi(e){if(e>=sn)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+sn.toString(16)+" bytes");return e|0}function bu(e){return+e!=e&&(e=0),O.alloc(+e)}O.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==O.prototype};O.compare=function(t,r){if(oe(t,Uint8Array)&&(t=O.from(t,t.offset,t.byteLength)),oe(r,Uint8Array)&&(r=O.from(r,r.offset,r.byteLength)),!O.isBuffer(t)||!O.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let n=t.length,i=r.length;for(let f=0,a=Math.min(n,i);f<a;++f)if(t[f]!==r[f]){n=t[f],i=r[f];break}return n<i?-1:i<n?1:0};O.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};O.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return O.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<t.length;++n)r+=t[n].length;let i=O.allocUnsafe(r),f=0;for(n=0;n<t.length;++n){let a=t[n];if(oe(a,Uint8Array))f+a.length>i.length?(O.isBuffer(a)||(a=O.from(a)),a.copy(i,f)):Uint8Array.prototype.set.call(i,a,f);else if(O.isBuffer(a))a.copy(i,f);else throw new TypeError('"list" argument must be an Array of Buffers');f+=a.length}return i};function Wo(e,t){if(O.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||oe(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return ci(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return ts(e).length;default:if(i)return n?-1:ci(e).length;t=(""+t).toLowerCase(),i=!0}}O.byteLength=Wo;function xu(e,t,r){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return Ou(this,t,r);case"utf8":case"utf-8":return Xo(this,t,r);case"ascii":return Au(this,t,r);case"latin1":case"binary":return Tu(this,t,r);case"base64":return Mu(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Iu(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}O.prototype._isBuffer=!0;function $e(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}O.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<t;r+=2)$e(this,r,r+1);return this};O.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<t;r+=4)$e(this,r,r+3),$e(this,r+1,r+2);return this};O.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<t;r+=8)$e(this,r,r+7),$e(this,r+1,r+6),$e(this,r+2,r+5),$e(this,r+3,r+4);return this};O.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?Xo(this,0,t):xu.apply(this,arguments)};O.prototype.toLocaleString=O.prototype.toString;O.prototype.equals=function(t){if(!O.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:O.compare(this,t)===0};O.prototype.inspect=function(){let t="",r=vr.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};Do&&(O.prototype[Do]=O.prototype.inspect);O.prototype.compare=function(t,r,n,i,f){if(oe(t,Uint8Array)&&(t=O.from(t,t.offset,t.byteLength)),!O.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),f===void 0&&(f=this.length),r<0||n>t.length||i<0||f>this.length)throw new RangeError("out of range index");if(i>=f&&r>=n)return 0;if(i>=f)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,f>>>=0,this===t)return 0;let a=f-i,m=n-r,d=Math.min(a,m),x=this.slice(i,f),v=t.slice(r,n);for(let _=0;_<d;++_)if(x[_]!==v[_]){a=x[_],m=v[_];break}return a<m?-1:m<a?1:0};function Yo(e,t,r,n,i){if(e.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,pi(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof t=="string"&&(t=O.from(t,n)),O.isBuffer(t))return t.length===0?-1:Ho(e,t,r,n,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Ho(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Ho(e,t,r,n,i){let f=1,a=e.length,m=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||t.length<2)return-1;f=2,a/=2,m/=2,r/=2}function d(v,_){return f===1?v[_]:v.readUInt16BE(_*f)}let x;if(i){let v=-1;for(x=r;x<a;x++)if(d(e,x)===d(t,v===-1?0:x-v)){if(v===-1&&(v=x),x-v+1===m)return v*f}else v!==-1&&(x-=x-v),v=-1}else for(r+m>a&&(r=a-m),x=r;x>=0;x--){let v=!0;for(let _=0;_<m;_++)if(d(e,x+_)!==d(t,_)){v=!1;break}if(v)return x}return-1}O.prototype.includes=function(t,r,n){return this.indexOf(t,r,n)!==-1};O.prototype.indexOf=function(t,r,n){return Yo(this,t,r,n,!0)};O.prototype.lastIndexOf=function(t,r,n){return Yo(this,t,r,n,!1)};function vu(e,t,r,n){r=Number(r)||0;let i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;let f=t.length;n>f/2&&(n=f/2);let a;for(a=0;a<n;++a){let m=parseInt(t.substr(a*2,2),16);if(pi(m))return a;e[r+a]=m}return a}function Eu(e,t,r,n){return fn(ci(t,e.length-r),e,r,n)}function _u(e,t,r,n){return fn(Nu(t),e,r,n)}function Bu(e,t,r,n){return fn(ts(t),e,r,n)}function Su(e,t,r,n){return fn(qu(t,e.length-r),e,r,n)}O.prototype.write=function(t,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let f=this.length-r;if((n===void 0||n>f)&&(n=f),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let a=!1;for(;;)switch(i){case"hex":return vu(this,t,r,n);case"utf8":case"utf-8":return Eu(this,t,r,n);case"ascii":case"latin1":case"binary":return _u(this,t,r,n);case"base64":return Bu(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Su(this,t,r,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};O.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Mu(e,t,r){return t===0&&r===e.length?fi.fromByteArray(e):fi.fromByteArray(e.slice(t,r))}function Xo(e,t,r){r=Math.min(e.length,r);let n=[],i=t;for(;i<r;){let f=e[i],a=null,m=f>239?4:f>223?3:f>191?2:1;if(i+m<=r){let d,x,v,_;switch(m){case 1:f<128&&(a=f);break;case 2:d=e[i+1],(d&192)===128&&(_=(f&31)<<6|d&63,_>127&&(a=_));break;case 3:d=e[i+1],x=e[i+2],(d&192)===128&&(x&192)===128&&(_=(f&15)<<12|(d&63)<<6|x&63,_>2047&&(_<55296||_>57343)&&(a=_));break;case 4:d=e[i+1],x=e[i+2],v=e[i+3],(d&192)===128&&(x&192)===128&&(v&192)===128&&(_=(f&15)<<18|(d&63)<<12|(x&63)<<6|v&63,_>65535&&_<1114112&&(a=_))}}a===null?(a=65533,m=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=m}return Ru(n)}var Po=4096;function Ru(e){let t=e.length;if(t<=Po)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Po));return r}function Au(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]&127);return n}function Tu(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function Ou(e,t,r){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let f=t;f<r;++f)i+=Uu[e[f]];return i}function Iu(e,t,r){let n=e.slice(t,r),i="";for(let f=0;f<n.length-1;f+=2)i+=String.fromCharCode(n[f]+n[f+1]*256);return i}O.prototype.slice=function(t,r){let n=this.length;t=~~t,r=r===void 0?n:~~r,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<t&&(r=t);let i=this.subarray(t,r);return Object.setPrototypeOf(i,O.prototype),i};function Zt(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}O.prototype.readUintLE=O.prototype.readUIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||Zt(t,r,this.length);let i=this[t],f=1,a=0;for(;++a<r&&(f*=256);)i+=this[t+a]*f;return i};O.prototype.readUintBE=O.prototype.readUIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||Zt(t,r,this.length);let i=this[t+--r],f=1;for(;r>0&&(f*=256);)i+=this[t+--r]*f;return i};O.prototype.readUint8=O.prototype.readUInt8=function(t,r){return t=t>>>0,r||Zt(t,1,this.length),this[t]};O.prototype.readUint16LE=O.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||Zt(t,2,this.length),this[t]|this[t+1]<<8};O.prototype.readUint16BE=O.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||Zt(t,2,this.length),this[t]<<8|this[t+1]};O.prototype.readUint32LE=O.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||Zt(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};O.prototype.readUint32BE=O.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||Zt(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};O.prototype.readBigUInt64LE=ye(function(t){t=t>>>0,xr(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Cr(t,this.length-8);let i=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,f=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(i)+(BigInt(f)<<BigInt(32))});O.prototype.readBigUInt64BE=ye(function(t){t=t>>>0,xr(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Cr(t,this.length-8);let i=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],f=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(f)});O.prototype.readIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||Zt(t,r,this.length);let i=this[t],f=1,a=0;for(;++a<r&&(f*=256);)i+=this[t+a]*f;return f*=128,i>=f&&(i-=Math.pow(2,8*r)),i};O.prototype.readIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||Zt(t,r,this.length);let i=r,f=1,a=this[t+--i];for(;i>0&&(f*=256);)a+=this[t+--i]*f;return f*=128,a>=f&&(a-=Math.pow(2,8*r)),a};O.prototype.readInt8=function(t,r){return t=t>>>0,r||Zt(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};O.prototype.readInt16LE=function(t,r){t=t>>>0,r||Zt(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};O.prototype.readInt16BE=function(t,r){t=t>>>0,r||Zt(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};O.prototype.readInt32LE=function(t,r){return t=t>>>0,r||Zt(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};O.prototype.readInt32BE=function(t,r){return t=t>>>0,r||Zt(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};O.prototype.readBigInt64LE=ye(function(t){t=t>>>0,xr(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Cr(t,this.length-8);let i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});O.prototype.readBigInt64BE=ye(function(t){t=t>>>0,xr(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Cr(t,this.length-8);let i=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n)});O.prototype.readFloatLE=function(t,r){return t=t>>>0,r||Zt(t,4,this.length),br.read(this,t,!0,23,4)};O.prototype.readFloatBE=function(t,r){return t=t>>>0,r||Zt(t,4,this.length),br.read(this,t,!1,23,4)};O.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||Zt(t,8,this.length),br.read(this,t,!0,52,8)};O.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||Zt(t,8,this.length),br.read(this,t,!1,52,8)};function Gt(e,t,r,n,i,f){if(!O.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<f)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}O.prototype.writeUintLE=O.prototype.writeUIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){let m=Math.pow(2,8*n)-1;Gt(this,t,r,n,m,0)}let f=1,a=0;for(this[r]=t&255;++a<n&&(f*=256);)this[r+a]=t/f&255;return r+n};O.prototype.writeUintBE=O.prototype.writeUIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){let m=Math.pow(2,8*n)-1;Gt(this,t,r,n,m,0)}let f=n-1,a=1;for(this[r+f]=t&255;--f>=0&&(a*=256);)this[r+f]=t/a&255;return r+n};O.prototype.writeUint8=O.prototype.writeUInt8=function(t,r,n){return t=+t,r=r>>>0,n||Gt(this,t,r,1,255,0),this[r]=t&255,r+1};O.prototype.writeUint16LE=O.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||Gt(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};O.prototype.writeUint16BE=O.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||Gt(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};O.prototype.writeUint32LE=O.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||Gt(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4};O.prototype.writeUint32BE=O.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||Gt(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function Go(e,t,r,n,i){Jo(t,n,i,e,r,7);let f=Number(t&BigInt(4294967295));e[r++]=f,f=f>>8,e[r++]=f,f=f>>8,e[r++]=f,f=f>>8,e[r++]=f;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a=a>>8,e[r++]=a,a=a>>8,e[r++]=a,a=a>>8,e[r++]=a,r}function $o(e,t,r,n,i){Jo(t,n,i,e,r,7);let f=Number(t&BigInt(4294967295));e[r+7]=f,f=f>>8,e[r+6]=f,f=f>>8,e[r+5]=f,f=f>>8,e[r+4]=f;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a=a>>8,e[r+2]=a,a=a>>8,e[r+1]=a,a=a>>8,e[r]=a,r+8}O.prototype.writeBigUInt64LE=ye(function(t,r=0){return Go(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});O.prototype.writeBigUInt64BE=ye(function(t,r=0){return $o(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});O.prototype.writeIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){let d=Math.pow(2,8*n-1);Gt(this,t,r,n,d-1,-d)}let f=0,a=1,m=0;for(this[r]=t&255;++f<n&&(a*=256);)t<0&&m===0&&this[r+f-1]!==0&&(m=1),this[r+f]=(t/a>>0)-m&255;return r+n};O.prototype.writeIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){let d=Math.pow(2,8*n-1);Gt(this,t,r,n,d-1,-d)}let f=n-1,a=1,m=0;for(this[r+f]=t&255;--f>=0&&(a*=256);)t<0&&m===0&&this[r+f+1]!==0&&(m=1),this[r+f]=(t/a>>0)-m&255;return r+n};O.prototype.writeInt8=function(t,r,n){return t=+t,r=r>>>0,n||Gt(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};O.prototype.writeInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||Gt(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};O.prototype.writeInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||Gt(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};O.prototype.writeInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||Gt(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4};O.prototype.writeInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||Gt(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};O.prototype.writeBigInt64LE=ye(function(t,r=0){return Go(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});O.prototype.writeBigInt64BE=ye(function(t,r=0){return $o(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ko(e,t,r,n,i,f){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Vo(e,t,r,n,i){return t=+t,r=r>>>0,i||Ko(e,t,r,4,34028234663852886e22,-34028234663852886e22),br.write(e,t,r,n,23,4),r+4}O.prototype.writeFloatLE=function(t,r,n){return Vo(this,t,r,!0,n)};O.prototype.writeFloatBE=function(t,r,n){return Vo(this,t,r,!1,n)};function Qo(e,t,r,n,i){return t=+t,r=r>>>0,i||Ko(e,t,r,8,17976931348623157e292,-17976931348623157e292),br.write(e,t,r,n,52,8),r+8}O.prototype.writeDoubleLE=function(t,r,n){return Qo(this,t,r,!0,n)};O.prototype.writeDoubleBE=function(t,r,n){return Qo(this,t,r,!1,n)};O.prototype.copy=function(t,r,n,i){if(!O.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r<i-n&&(i=t.length-r+n);let f=i-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(t,this.subarray(n,i),r),f};O.prototype.fill=function(t,r,n,i){if(typeof t=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!O.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){let a=t.charCodeAt(0);(i==="utf8"&&a<128||i==="latin1")&&(t=a)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let f;if(typeof t=="number")for(f=r;f<n;++f)this[f]=t;else{let a=O.isBuffer(t)?t:O.from(t,i),m=a.length;if(m===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(f=0;f<n-r;++f)this[f+r]=a[f%m]}return this};var wr={};function di(e,t,r){wr[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}di("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);di("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);di("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=jo(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=jo(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function jo(e){let t="",r=e.length,n=e[0]==="-"?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function Lu(e,t,r){xr(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&Cr(t,e.length-(r+1))}function Jo(e,t,r,n,i,f){if(e>r||e<t){let a=typeof t=="bigint"?"n":"",m;throw f>3?t===0||t===BigInt(0)?m=`>= 0${a} and < 2${a} ** ${(f+1)*8}${a}`:m=`>= -(2${a} ** ${(f+1)*8-1}${a}) and < 2 ** ${(f+1)*8-1}${a}`:m=`>= ${t}${a} and <= ${r}${a}`,new wr.ERR_OUT_OF_RANGE("value",m,e)}Lu(n,i,f)}function xr(e,t){if(typeof e!="number")throw new wr.ERR_INVALID_ARG_TYPE(t,"number",e)}function Cr(e,t,r){throw Math.floor(e)!==e?(xr(e,r),new wr.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new wr.ERR_BUFFER_OUT_OF_BOUNDS:new wr.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var ku=/[^+/0-9A-Za-z-_]/g;function Fu(e){if(e=e.split("=")[0],e=e.trim().replace(ku,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function ci(e,t){t=t||1/0;let r,n=e.length,i=null,f=[];for(let a=0;a<n;++a){if(r=e.charCodeAt(a),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&f.push(239,191,189);continue}else if(a+1===n){(t-=3)>-1&&f.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&f.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&f.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;f.push(r)}else if(r<2048){if((t-=2)<0)break;f.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;f.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;f.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return f}function Nu(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function qu(e,t){let r,n,i,f=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)r=e.charCodeAt(a),n=r>>8,i=r%256,f.push(i),f.push(n);return f}function ts(e){return fi.toByteArray(Fu(e))}function fn(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function oe(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function pi(e){return e!==e}var Uu=(function(){let e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t})();function ye(e){return typeof BigInt>"u"?Cu:e}function Cu(){throw new Error("BigInt not supported")}});var z,F=ou(()=>{z=ii(we(),1)});var es=nt(()=>{F()});var ns=nt((rs,gi)=>{F();(function(e,t){"use strict";function r(w,o){if(!w)throw new Error(o||"Assertion failed")}function n(w,o){w.super_=o;var u=function(){};u.prototype=o.prototype,w.prototype=new u,w.prototype.constructor=w}function i(w,o,u){if(i.isBN(w))return w;this.negative=0,this.words=null,this.length=0,this.red=null,w!==null&&((o==="le"||o==="be")&&(u=o,o=10),this._init(w||0,o||10,u||"be"))}typeof e=="object"?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;var f;try{typeof window<"u"&&typeof window.Buffer<"u"?f=window.Buffer:f=es().Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,u){return o.cmp(u)>0?o:u},i.min=function(o,u){return o.cmp(u)<0?o:u},i.prototype._init=function(o,u,l){if(typeof o=="number")return this._initNumber(o,u,l);if(typeof o=="object")return this._initArray(o,u,l);u==="hex"&&(u=16),r(u===(u|0)&&u>=2&&u<=36),o=o.toString().replace(/\s+/g,"");var p=0;o[0]==="-"&&(p++,this.negative=1),p<o.length&&(u===16?this._parseHex(o,p,l):(this._parseBase(o,u,p),l==="le"&&this._initArray(this.toArray(),u,l)))},i.prototype._initNumber=function(o,u,l){o<0&&(this.negative=1,o=-o),o<67108864?(this.words=[o&67108863],this.length=1):o<4503599627370496?(this.words=[o&67108863,o/67108864&67108863],this.length=2):(r(o<9007199254740992),this.words=[o&67108863,o/67108864&67108863,1],this.length=3),l==="le"&&this._initArray(this.toArray(),u,l)},i.prototype._initArray=function(o,u,l){if(r(typeof o.length=="number"),o.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(o.length/3),this.words=new Array(this.length);for(var p=0;p<this.length;p++)this.words[p]=0;var y,b,g=0;if(l==="be")for(p=o.length-1,y=0;p>=0;p-=3)b=o[p]|o[p-1]<<8|o[p-2]<<16,this.words[y]|=b<<g&67108863,this.words[y+1]=b>>>26-g&67108863,g+=24,g>=26&&(g-=26,y++);else if(l==="le")for(p=0,y=0;p<o.length;p+=3)b=o[p]|o[p+1]<<8|o[p+2]<<16,this.words[y]|=b<<g&67108863,this.words[y+1]=b>>>26-g&67108863,g+=24,g>=26&&(g-=26,y++);return this._strip()};function a(w,o){var u=w.charCodeAt(o);if(u>=48&&u<=57)return u-48;if(u>=65&&u<=70)return u-55;if(u>=97&&u<=102)return u-87;r(!1,"Invalid character in "+w)}function m(w,o,u){var l=a(w,u);return u-1>=o&&(l|=a(w,u-1)<<4),l}i.prototype._parseHex=function(o,u,l){this.length=Math.ceil((o.length-u)/6),this.words=new Array(this.length);for(var p=0;p<this.length;p++)this.words[p]=0;var y=0,b=0,g;if(l==="be")for(p=o.length-1;p>=u;p-=2)g=m(o,u,p)<<y,this.words[b]|=g&67108863,y>=18?(y-=18,b+=1,this.words[b]|=g>>>26):y+=8;else{var c=o.length-u;for(p=c%2===0?u+1:u;p<o.length;p+=2)g=m(o,u,p)<<y,this.words[b]|=g&67108863,y>=18?(y-=18,b+=1,this.words[b]|=g>>>26):y+=8}this._strip()};function d(w,o,u,l){for(var p=0,y=0,b=Math.min(w.length,u),g=o;g<b;g++){var c=w.charCodeAt(g)-48;p*=l,c>=49?y=c-49+10:c>=17?y=c-17+10:y=c,r(c>=0&&y<l,"Invalid character"),p+=y}return p}i.prototype._parseBase=function(o,u,l){this.words=[0],this.length=1;for(var p=0,y=1;y<=67108863;y*=u)p++;p--,y=y/u|0;for(var b=o.length-l,g=b%p,c=Math.min(b,b-g)+l,s=0,h=l;h<c;h+=p)s=d(o,h,h+p,u),this.imuln(y),this.words[0]+s<67108864?this.words[0]+=s:this._iaddn(s);if(g!==0){var E=1;for(s=d(o,h,o.length,u),h=0;h<g;h++)E*=u;this.imuln(E),this.words[0]+s<67108864?this.words[0]+=s:this._iaddn(s)}this._strip()},i.prototype.copy=function(o){o.words=new Array(this.length);for(var u=0;u<this.length;u++)o.words[u]=this.words[u];o.length=this.length,o.negative=this.negative,o.red=this.red};function x(w,o){w.words=o.words,w.length=o.length,w.negative=o.negative,w.red=o.red}if(i.prototype._move=function(o){x(o,this)},i.prototype.clone=function(){var o=new i(null);return this.copy(o),o},i.prototype._expand=function(o){for(;this.length<o;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&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")]=v}catch{i.prototype.inspect=v}else i.prototype.inspect=v;function v(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var _=["","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],S=[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(o,u){o=o||10,u=u|0||1;var l;if(o===16||o==="hex"){l="";for(var p=0,y=0,b=0;b<this.length;b++){var g=this.words[b],c=((g<<p|y)&16777215).toString(16);y=g>>>24-p&16777215,p+=2,p>=26&&(p-=26,b--),y!==0||b!==this.length-1?l=_[6-c.length]+c+l:l=c+l}for(y!==0&&(l=y.toString(16)+l);l.length%u!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(o===(o|0)&&o>=2&&o<=36){var s=M[o],h=S[o];l="";var E=this.clone();for(E.negative=0;!E.isZero();){var B=E.modrn(h).toString(o);E=E.idivn(h),E.isZero()?l=B+l:l=_[s-B.length]+B+l}for(this.isZero()&&(l="0"+l);l.length%u!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16,2)},f&&(i.prototype.toBuffer=function(o,u){return this.toArrayLike(f,o,u)}),i.prototype.toArray=function(o,u){return this.toArrayLike(Array,o,u)};var C=function(o,u){return o.allocUnsafe?o.allocUnsafe(u):new o(u)};i.prototype.toArrayLike=function(o,u,l){this._strip();var p=this.byteLength(),y=l||Math.max(1,p);r(p<=y,"byte array longer than desired length"),r(y>0,"Requested array length <= 0");var b=C(o,y),g=u==="le"?"LE":"BE";return this["_toArrayLike"+g](b,p),b},i.prototype._toArrayLikeLE=function(o,u){for(var l=0,p=0,y=0,b=0;y<this.length;y++){var g=this.words[y]<<b|p;o[l++]=g&255,l<o.length&&(o[l++]=g>>8&255),l<o.length&&(o[l++]=g>>16&255),b===6?(l<o.length&&(o[l++]=g>>24&255),p=0,b=0):(p=g>>>24,b+=2)}if(l<o.length)for(o[l++]=p;l<o.length;)o[l++]=0},i.prototype._toArrayLikeBE=function(o,u){for(var l=o.length-1,p=0,y=0,b=0;y<this.length;y++){var g=this.words[y]<<b|p;o[l--]=g&255,l>=0&&(o[l--]=g>>8&255),l>=0&&(o[l--]=g>>16&255),b===6?(l>=0&&(o[l--]=g>>24&255),p=0,b=0):(p=g>>>24,b+=2)}if(l>=0)for(o[l--]=p;l>=0;)o[l--]=0},Math.clz32?i.prototype._countBits=function(o){return 32-Math.clz32(o)}:i.prototype._countBits=function(o){var u=o,l=0;return u>=4096&&(l+=13,u>>>=13),u>=64&&(l+=7,u>>>=7),u>=8&&(l+=4,u>>>=4),u>=2&&(l+=2,u>>>=2),l+u},i.prototype._zeroBits=function(o){if(o===0)return 26;var u=o,l=0;return(u&8191)===0&&(l+=13,u>>>=13),(u&127)===0&&(l+=7,u>>>=7),(u&15)===0&&(l+=4,u>>>=4),(u&3)===0&&(l+=2,u>>>=2),(u&1)===0&&l++,l},i.prototype.bitLength=function(){var o=this.words[this.length-1],u=this._countBits(o);return(this.length-1)*26+u};function N(w){for(var o=new Array(w.bitLength()),u=0;u<o.length;u++){var l=u/26|0,p=u%26;o[u]=w.words[l]>>>p&1}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,u=0;u<this.length;u++){var l=this._zeroBits(this.words[u]);if(o+=l,l!==26)break}return o},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(o){return this.negative!==0?this.abs().inotn(o).iaddn(1):this.clone()},i.prototype.fromTwos=function(o){return this.testn(o-1)?this.notn(o).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(o){for(;this.length<o.length;)this.words[this.length++]=0;for(var u=0;u<o.length;u++)this.words[u]=this.words[u]|o.words[u];return this._strip()},i.prototype.ior=function(o){return r((this.negative|o.negative)===0),this.iuor(o)},i.prototype.or=function(o){return this.length>o.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var u;this.length>o.length?u=o:u=this;for(var l=0;l<u.length;l++)this.words[l]=this.words[l]&o.words[l];return this.length=u.length,this._strip()},i.prototype.iand=function(o){return r((this.negative|o.negative)===0),this.iuand(o)},i.prototype.and=function(o){return this.length>o.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var u,l;this.length>o.length?(u=this,l=o):(u=o,l=this);for(var p=0;p<l.length;p++)this.words[p]=u.words[p]^l.words[p];if(this!==u)for(;p<u.length;p++)this.words[p]=u.words[p];return this.length=u.length,this._strip()},i.prototype.ixor=function(o){return r((this.negative|o.negative)===0),this.iuxor(o)},i.prototype.xor=function(o){return this.length>o.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){r(typeof o=="number"&&o>=0);var u=Math.ceil(o/26)|0,l=o%26;this._expand(u),l>0&&u--;for(var p=0;p<u;p++)this.words[p]=~this.words[p]&67108863;for(l>0&&(this.words[p]=~this.words[p]&67108863>>26-l,p++);p<this.length;p++)this.words[p]=0;return this._strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,u){r(typeof o=="number"&&o>=0);var l=o/26|0,p=o%26;return this._expand(l+1),u?this.words[l]=this.words[l]|1<<p:this.words[l]=this.words[l]&~(1<<p),this._strip()},i.prototype.iadd=function(o){var u;if(this.negative!==0&&o.negative===0)return this.negative=0,u=this.isub(o),this.negative^=1,this._normSign();if(this.negative===0&&o.negative!==0)return o.negative=0,u=this.isub(o),o.negative=1,u._normSign();var l,p;this.length>o.length?(l=this,p=o):(l=o,p=this);for(var y=0,b=0;b<p.length;b++)u=(l.words[b]|0)+(p.words[b]|0)+y,this.words[b]=u&67108863,y=u>>>26;for(;y!==0&&b<l.length;b++)u=(l.words[b]|0)+y,this.words[b]=u&67108863,y=u>>>26;if(this.length=l.length,y!==0)this.words[this.length]=y,this.length++;else if(l!==this)for(;b<l.length;b++)this.words[b]=l.words[b];return this},i.prototype.add=function(o){var u;return o.negative!==0&&this.negative===0?(o.negative=0,u=this.sub(o),o.negative^=1,u):o.negative===0&&this.negative!==0?(this.negative=0,u=o.sub(this),this.negative=1,u):this.length>o.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var u=this.iadd(o);return o.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var l=this.cmp(o);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,y;l>0?(p=this,y=o):(p=o,y=this);for(var b=0,g=0;g<y.length;g++)u=(p.words[g]|0)-(y.words[g]|0)+b,b=u>>26,this.words[g]=u&67108863;for(;b!==0&&g<p.length;g++)u=(p.words[g]|0)+b,b=u>>26,this.words[g]=u&67108863;if(b===0&&g<p.length&&p!==this)for(;g<p.length;g++)this.words[g]=p.words[g];return this.length=Math.max(this.length,g),p!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(o){return this.clone().isub(o)};function L(w,o,u){u.negative=o.negative^w.negative;var l=w.length+o.length|0;u.length=l,l=l-1|0;var p=w.words[0]|0,y=o.words[0]|0,b=p*y,g=b&67108863,c=b/67108864|0;u.words[0]=g;for(var s=1;s<l;s++){for(var h=c>>>26,E=c&67108863,B=Math.min(s,o.length-1),R=Math.max(0,s-w.length+1);R<=B;R++){var A=s-R|0;p=w.words[A]|0,y=o.words[R]|0,b=p*y+E,h+=b/67108864|0,E=b&67108863}u.words[s]=E|0,c=h|0}return c!==0?u.words[s]=c|0:u.length--,u._strip()}var I=function(o,u,l){var p=o.words,y=u.words,b=l.words,g=0,c,s,h,E=p[0]|0,B=E&8191,R=E>>>13,A=p[1]|0,q=A&8191,P=A>>>13,X=p[2]|0,j=X&8191,Z=X>>>13,ot=p[3]|0,Q=ot&8191,G=ot>>>13,st=p[4]|0,et=st&8191,rt=st>>>13,Wt=p[5]|0,at=Wt&8191,ft=Wt>>>13,Vt=p[6]|0,dt=Vt&8191,pt=Vt>>>13,ke=p[7]|0,gt=ke&8191,ht=ke>>>13,Qt=p[8]|0,mt=Qt&8191,yt=Qt>>>13,fr=p[9]|0,wt=fr&8191,bt=fr>>>13,ar=y[0]|0,xt=ar&8191,vt=ar>>>13,ur=y[1]|0,Et=ur&8191,_t=ur>>>13,cr=y[2]|0,Bt=cr&8191,St=cr>>>13,lr=y[3]|0,Mt=lr&8191,Rt=lr>>>13,hr=y[4]|0,At=hr&8191,Tt=hr>>>13,dr=y[5]|0,Ot=dr&8191,It=dr>>>13,pr=y[6]|0,Lt=pr&8191,kt=pr>>>13,gr=y[7]|0,Ft=gr&8191,Nt=gr>>>13,mr=y[8]|0,qt=mr&8191,Ut=mr>>>13,yr=y[9]|0,Ct=yr&8191,Dt=yr>>>13;l.negative=o.negative^u.negative,l.length=19,c=Math.imul(B,xt),s=Math.imul(B,vt),s=s+Math.imul(R,xt)|0,h=Math.imul(R,vt);var Fe=(g+c|0)+((s&8191)<<13)|0;g=(h+(s>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,c=Math.imul(q,xt),s=Math.imul(q,vt),s=s+Math.imul(P,xt)|0,h=Math.imul(P,vt),c=c+Math.imul(B,Et)|0,s=s+Math.imul(B,_t)|0,s=s+Math.imul(R,Et)|0,h=h+Math.imul(R,_t)|0;var Ne=(g+c|0)+((s&8191)<<13)|0;g=(h+(s>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c=Math.imul(j,xt),s=Math.imul(j,vt),s=s+Math.imul(Z,xt)|0,h=Math.imul(Z,vt),c=c+Math.imul(q,Et)|0,s=s+Math.imul(q,_t)|0,s=s+Math.imul(P,Et)|0,h=h+Math.imul(P,_t)|0,c=c+Math.imul(B,Bt)|0,s=s+Math.imul(B,St)|0,s=s+Math.imul(R,Bt)|0,h=h+Math.imul(R,St)|0;var qe=(g+c|0)+((s&8191)<<13)|0;g=(h+(s>>>13)|0)+(qe>>>26)|0,qe&=67108863,c=Math.imul(Q,xt),s=Math.imul(Q,vt),s=s+Math.imul(G,xt)|0,h=Math.imul(G,vt),c=c+Math.imul(j,Et)|0,s=s+Math.imul(j,_t)|0,s=s+Math.imul(Z,Et)|0,h=h+Math.imul(Z,_t)|0,c=c+Math.imul(q,Bt)|0,s=s+Math.imul(q,St)|0,s=s+Math.imul(P,Bt)|0,h=h+Math.imul(P,St)|0,c=c+Math.imul(B,Mt)|0,s=s+Math.imul(B,Rt)|0,s=s+Math.imul(R,Mt)|0,h=h+Math.imul(R,Rt)|0;var Ue=(g+c|0)+((s&8191)<<13)|0;g=(h+(s>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,c=Math.imul(et,xt),s=Math.imul(et,vt),s=s+Math.imul(rt,xt)|0,h=Math.imul(rt,vt),c=c+Math.imul(Q,Et)|0,s=s+Math.imul(Q,_t)|0,s=s+Math.imul(G,Et)|0,h=h+Math.imul(G,_t)|0,c=c+Math.imul(j,Bt)|0,s=s+Math.imul(j,St)|0,s=s+Math.imul(Z,Bt)|0,h=h+Math.imul(Z,St)|0,c=c+Math.imul(q,Mt)|0,s=s+Math.imul(q,Rt)|0,s=s+Math.imul(P,Mt)|0,h=h+Math.imul(P,Rt)|0,c=c+Math.imul(B,At)|0,s=s+Math.imul(B,Tt)|0,s=s+Math.imul(R,At)|0,h=h+Math.imul(R,Tt)|0;var Ce=(g+c|0)+((s&8191)<<13)|0;g=(h+(s>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,c=Math.imul(at,xt),s=Math.imul(at,vt),s=s+Math.imul(ft,xt)|0,h=Math.imul(ft,vt),c=c+Math.imul(et,Et)|0,s=s+Math.imul(et,_t)|0,s=s+Math.imul(rt,Et)|0,h=h+Math.imul(rt,_t)|0,c=c+Math.imul(Q,Bt)|0,s=s+Math.imul(Q,St)|0,s=s+Math.imul(G,Bt)|0,h=h+Math.imul(G,St)|0,c=c+Math.imul(j,Mt)|0,s=s+Math.imul(j,Rt)|0,s=s+Math.imul(Z,Mt)|0,h=h+Math.imul(Z,Rt)|0,c=c+Math.imul(q,At)|0,s=s+Math.imul(q,Tt)|0,s=s+Math.imul(P,At)|0,h=h+Math.imul(P,Tt)|0,c=c+Math.imul(B,Ot)|0,s=s+Math.imul(B,It)|0,s=s+Math.imul(R,Ot)|0,h=h+Math.imul(R,It)|0;var De=(g+c|0)+((s&8191)<<13)|0;g=(h+(s>>>13)|0)+(De>>>26)|0,De&=67108863,c=Math.imul(dt,xt),s=Math.imul(dt,vt),s=s+Math.imul(pt,xt)|0,h=Math.imul(pt,vt),c=c+Math.imul(at,Et)|0,s=s+Math.imul(at,_t)|0,s=s+Math.imul(ft,Et)|0,h=h+Math.imul(ft,_t)|0,c=c+Math.imul(et,Bt)|0,s=s+Math.imul(et,St)|0,s=s+Math.imul(rt,Bt)|0,h=h+Math.imul(rt,St)|0,c=c+Math.imul(Q,Mt)|0,s=s+Math.imul(Q,Rt)|0,s=s+Math.imul(G,Mt)|0,h=h+Math.imul(G,Rt)|0,c=c+Math.imul(j,At)|0,s=s+Math.imul(j,Tt)|0,s=s+Math.imul(Z,At)|0,h=h+Math.imul(Z,Tt)|0,c=c+Math.imul(q,Ot)|0,s=s+Math.imul(q,It)|0,s=s+Math.imul(P,Ot)|0,h=h+Math.imul(P,It)|0,c=c+Math.imul(B,Lt)|0,s=s+Math.imul(B,kt)|0,s=s+Math.imul(R,Lt)|0,h=h+Math.imul(R,kt)|0;var He=(g+c|0)+((s&8191)<<13)|0;g=(h+(s>>>13)|0)+(He>>>26)|0,He&=67108863,c=Math.imul(gt,xt),s=Math.imul(gt,vt),s=s+Math.imul(ht,xt)|0,h=Math.imul(ht,vt),c=c+Math.imul(dt,Et)|0,s=s+Math.imul(dt,_t)|0,s=s+Math.imul(pt,Et)|0,h=h+Math.imul(pt,_t)|0,c=c+Math.imul(at,Bt)|0,s=s+Math.imul(at,St)|0,s=s+Math.imul(ft,Bt)|0,h=h+Math.imul(ft,St)|0,c=c+Math.imul(et,Mt)|0,s=s+Math.imul(et,Rt)|0,s=s+Math.imul(rt,Mt)|0,h=h+Math.imul(rt,Rt)|0,c=c+Math.imul(Q,At)|0,s=s+Math.imul(Q,Tt)|0,s=s+Math.imul(G,At)|0,h=h+Math.imul(G,Tt)|0,c=c+Math.imul(j,Ot)|0,s=s+Math.imul(j,It)|0,s=s+Math.imul(Z,Ot)|0,h=h+Math.imul(Z,It)|0,c=c+Math.imul(q,Lt)|0,s=s+Math.imul(q,kt)|0,s=s+Math.imul(P,Lt)|0,h=h+Math.imul(P,kt)|0,c=c+Math.imul(B,Ft)|0,s=s+Math.imul(B,Nt)|0,s=s+Math.imul(R,Ft)|0,h=h+Math.imul(R,Nt)|0;var Pe=(g+c|0)+((s&8191)<<13)|0;g=(h+(s>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,c=Math.imul(mt,xt),s=Math.imul(mt,vt),s=s+Math.imul(yt,xt)|0,h=Math.imul(yt,vt),c=c+Math.imul(gt,Et)|0,s=s+Math.imul(gt,_t)|0,s=s+Math.imul(ht,Et)|0,h=h+Math.imul(ht,_t)|0,c=c+Math.imul(dt,Bt)|0,s=s+Math.imul(dt,St)|0,s=s+Math.imul(pt,Bt)|0,h=h+Math.imul(pt,St)|0,c=c+Math.imul(at,Mt)|0,s=s+Math.imul(at,Rt)|0,s=s+Math.imul(ft,Mt)|0,h=h+Math.imul(ft,Rt)|0,c=c+Math.imul(et,At)|0,s=s+Math.imul(et,Tt)|0,s=s+Math.imul(rt,At)|0,h=h+Math.imul(rt,Tt)|0,c=c+Math.imul(Q,Ot)|0,s=s+Math.imul(Q,It)|0,s=s+Math.imul(G,Ot)|0,h=h+Math.imul(G,It)|0,c=c+Math.imul(j,Lt)|0,s=s+Math.imul(j,kt)|0,s=s+Math.imul(Z,Lt)|0,h=h+Math.imul(Z,kt)|0,c=c+Math.imul(q,Ft)|0,s=s+Math.imul(q,Nt)|0,s=s+Math.imul(P,Ft)|0,h=h+Math.imul(P,Nt)|0,c=c+Math.imul(B,qt)|0,s=s+Math.imul(B,Ut)|0,s=s+Math.imul(R,qt)|0,h=h+Math.imul(R,Ut)|0;var je=(g+c|0)+((s&8191)<<13)|0;g=(h+(s>>>13)|0)+(je>>>26)|0,je&=67108863,c=Math.imul(wt,xt),s=Math.imul(wt,vt),s=s+Math.imul(bt,xt)|0,h=Math.imul(bt,vt),c=c+Math.imul(mt,Et)|0,s=s+Math.imul(mt,_t)|0,s=s+Math.imul(yt,Et)|0,h=h+Math.imul(yt,_t)|0,c=c+Math.imul(gt,Bt)|0,s=s+Math.imul(gt,St)|0,s=s+Math.imul(ht,Bt)|0,h=h+Math.imul(ht,St)|0,c=c+Math.imul(dt,Mt)|0,s=s+Math.imul(dt,Rt)|0,s=s+Math.imul(pt,Mt)|0,h=h+Math.imul(pt,Rt)|0,c=c+Math.imul(at,At)|0,s=s+Math.imul(at,Tt)|0,s=s+Math.imul(ft,At)|0,h=h+Math.imul(ft,Tt)|0,c=c+Math.imul(et,Ot)|0,s=s+Math.imul(et,It)|0,s=s+Math.imul(rt,Ot)|0,h=h+Math.imul(rt,It)|0,c=c+Math.imul(Q,Lt)|0,s=s+Math.imul(Q,kt)|0,s=s+Math.imul(G,Lt)|0,h=h+Math.imul(G,kt)|0,c=c+Math.imul(j,Ft)|0,s=s+Math.imul(j,Nt)|0,s=s+Math.imul(Z,Ft)|0,h=h+Math.imul(Z,Nt)|0,c=c+Math.imul(q,qt)|0,s=s+Math.imul(q,Ut)|0,s=s+Math.imul(P,qt)|0,h=h+Math.imul(P,Ut)|0,c=c+Math.imul(B,Ct)|0,s=s+Math.imul(B,Dt)|0,s=s+Math.imul(R,Ct)|0,h=h+Math.imul(R,Dt)|0;var ze=(g+c|0)+((s&8191)<<13)|0;g=(h+(s>>>13)|0)+(ze>>>26)|0,ze&=67108863,c=Math.imul(wt,Et),s=Math.imul(wt,_t),s=s+Math.imul(bt,Et)|0,h=Math.imul(bt,_t),c=c+Math.imul(mt,Bt)|0,s=s+Math.imul(mt,St)|0,s=s+Math.imul(yt,Bt)|0,h=h+Math.imul(yt,St)|0,c=c+Math.imul(gt,Mt)|0,s=s+Math.imul(gt,Rt)|0,s=s+Math.imul(ht,Mt)|0,h=h+Math.imul(ht,Rt)|0,c=c+Math.imul(dt,At)|0,s=s+Math.imul(dt,Tt)|0,s=s+Math.imul(pt,At)|0,h=h+Math.imul(pt,Tt)|0,c=c+Math.imul(at,Ot)|0,s=s+Math.imul(at,It)|0,s=s+Math.imul(ft,Ot)|0,h=h+Math.imul(ft,It)|0,c=c+Math.imul(et,Lt)|0,s=s+Math.imul(et,kt)|0,s=s+Math.imul(rt,Lt)|0,h=h+Math.imul(rt,kt)|0,c=c+Math.imul(Q,Ft)|0,s=s+Math.imul(Q,Nt)|0,s=s+Math.imul(G,Ft)|0,h=h+Math.imul(G,Nt)|0,c=c+Math.imul(j,qt)|0,s=s+Math.imul(j,Ut)|0,s=s+Math.imul(Z,qt)|0,h=h+Math.imul(Z,Ut)|0,c=c+Math.imul(q,Ct)|0,s=s+Math.imul(q,Dt)|0,s=s+Math.imul(P,Ct)|0,h=h+Math.imul(P,Dt)|0;var Ze=(g+c|0)+((s&8191)<<13)|0;g=(h+(s>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,c=Math.imul(wt,Bt),s=Math.imul(wt,St),s=s+Math.imul(bt,Bt)|0,h=Math.imul(bt,St),c=c+Math.imul(mt,Mt)|0,s=s+Math.imul(mt,Rt)|0,s=s+Math.imul(yt,Mt)|0,h=h+Math.imul(yt,Rt)|0,c=c+Math.imul(gt,At)|0,s=s+Math.imul(gt,Tt)|0,s=s+Math.imul(ht,At)|0,h=h+Math.imul(ht,Tt)|0,c=c+Math.imul(dt,Ot)|0,s=s+Math.imul(dt,It)|0,s=s+Math.imul(pt,Ot)|0,h=h+Math.imul(pt,It)|0,c=c+Math.imul(at,Lt)|0,s=s+Math.imul(at,kt)|0,s=s+Math.imul(ft,Lt)|0,h=h+Math.imul(ft,kt)|0,c=c+Math.imul(et,Ft)|0,s=s+Math.imul(et,Nt)|0,s=s+Math.imul(rt,Ft)|0,h=h+Math.imul(rt,Nt)|0,c=c+Math.imul(Q,qt)|0,s=s+Math.imul(Q,Ut)|0,s=s+Math.imul(G,qt)|0,h=h+Math.imul(G,Ut)|0,c=c+Math.imul(j,Ct)|0,s=s+Math.imul(j,Dt)|0,s=s+Math.imul(Z,Ct)|0,h=h+Math.imul(Z,Dt)|0;var We=(g+c|0)+((s&8191)<<13)|0;g=(h+(s>>>13)|0)+(We>>>26)|0,We&=67108863,c=Math.imul(wt,Mt),s=Math.imul(wt,Rt),s=s+Math.imul(bt,Mt)|0,h=Math.imul(bt,Rt),c=c+Math.imul(mt,At)|0,s=s+Math.imul(mt,Tt)|0,s=s+Math.imul(yt,At)|0,h=h+Math.imul(yt,Tt)|0,c=c+Math.imul(gt,Ot)|0,s=s+Math.imul(gt,It)|0,s=s+Math.imul(ht,Ot)|0,h=h+Math.imul(ht,It)|0,c=c+Math.imul(dt,Lt)|0,s=s+Math.imul(dt,kt)|0,s=s+Math.imul(pt,Lt)|0,h=h+Math.imul(pt,kt)|0,c=c+Math.imul(at,Ft)|0,s=s+Math.imul(at,Nt)|0,s=s+Math.imul(ft,Ft)|0,h=h+Math.imul(ft,Nt)|0,c=c+Math.imul(et,qt)|0,s=s+Math.imul(et,Ut)|0,s=s+Math.imul(rt,qt)|0,h=h+Math.imul(rt,Ut)|0,c=c+Math.imul(Q,Ct)|0,s=s+Math.imul(Q,Dt)|0,s=s+Math.imul(G,Ct)|0,h=h+Math.imul(G,Dt)|0;var Ye=(g+c|0)+((s&8191)<<13)|0;g=(h+(s>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,c=Math.imul(wt,At),s=Math.imul(wt,Tt),s=s+Math.imul(bt,At)|0,h=Math.imul(bt,Tt),c=c+Math.imul(mt,Ot)|0,s=s+Math.imul(mt,It)|0,s=s+Math.imul(yt,Ot)|0,h=h+Math.imul(yt,It)|0,c=c+Math.imul(gt,Lt)|0,s=s+Math.imul(gt,kt)|0,s=s+Math.imul(ht,Lt)|0,h=h+Math.imul(ht,kt)|0,c=c+Math.imul(dt,Ft)|0,s=s+Math.imul(dt,Nt)|0,s=s+Math.imul(pt,Ft)|0,h=h+Math.imul(pt,Nt)|0,c=c+Math.imul(at,qt)|0,s=s+Math.imul(at,Ut)|0,s=s+Math.imul(ft,qt)|0,h=h+Math.imul(ft,Ut)|0,c=c+Math.imul(et,Ct)|0,s=s+Math.imul(et,Dt)|0,s=s+Math.imul(rt,Ct)|0,h=h+Math.imul(rt,Dt)|0;var Xe=(g+c|0)+((s&8191)<<13)|0;g=(h+(s>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,c=Math.imul(wt,Ot),s=Math.imul(wt,It),s=s+Math.imul(bt,Ot)|0,h=Math.imul(bt,It),c=c+Math.imul(mt,Lt)|0,s=s+Math.imul(mt,kt)|0,s=s+Math.imul(yt,Lt)|0,h=h+Math.imul(yt,kt)|0,c=c+Math.imul(gt,Ft)|0,s=s+Math.imul(gt,Nt)|0,s=s+Math.imul(ht,Ft)|0,h=h+Math.imul(ht,Nt)|0,c=c+Math.imul(dt,qt)|0,s=s+Math.imul(dt,Ut)|0,s=s+Math.imul(pt,qt)|0,h=h+Math.imul(pt,Ut)|0,c=c+Math.imul(at,Ct)|0,s=s+Math.imul(at,Dt)|0,s=s+Math.imul(ft,Ct)|0,h=h+Math.imul(ft,Dt)|0;var Jn=(g+c|0)+((s&8191)<<13)|0;g=(h+(s>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,c=Math.imul(wt,Lt),s=Math.imul(wt,kt),s=s+Math.imul(bt,Lt)|0,h=Math.imul(bt,kt),c=c+Math.imul(mt,Ft)|0,s=s+Math.imul(mt,Nt)|0,s=s+Math.imul(yt,Ft)|0,h=h+Math.imul(yt,Nt)|0,c=c+Math.imul(gt,qt)|0,s=s+Math.imul(gt,Ut)|0,s=s+Math.imul(ht,qt)|0,h=h+Math.imul(ht,Ut)|0,c=c+Math.imul(dt,Ct)|0,s=s+Math.imul(dt,Dt)|0,s=s+Math.imul(pt,Ct)|0,h=h+Math.imul(pt,Dt)|0;var ti=(g+c|0)+((s&8191)<<13)|0;g=(h+(s>>>13)|0)+(ti>>>26)|0,ti&=67108863,c=Math.imul(wt,Ft),s=Math.imul(wt,Nt),s=s+Math.imul(bt,Ft)|0,h=Math.imul(bt,Nt),c=c+Math.imul(mt,qt)|0,s=s+Math.imul(mt,Ut)|0,s=s+Math.imul(yt,qt)|0,h=h+Math.imul(yt,Ut)|0,c=c+Math.imul(gt,Ct)|0,s=s+Math.imul(gt,Dt)|0,s=s+Math.imul(ht,Ct)|0,h=h+Math.imul(ht,Dt)|0;var ei=(g+c|0)+((s&8191)<<13)|0;g=(h+(s>>>13)|0)+(ei>>>26)|0,ei&=67108863,c=Math.imul(wt,qt),s=Math.imul(wt,Ut),s=s+Math.imul(bt,qt)|0,h=Math.imul(bt,Ut),c=c+Math.imul(mt,Ct)|0,s=s+Math.imul(mt,Dt)|0,s=s+Math.imul(yt,Ct)|0,h=h+Math.imul(yt,Dt)|0;var ri=(g+c|0)+((s&8191)<<13)|0;g=(h+(s>>>13)|0)+(ri>>>26)|0,ri&=67108863,c=Math.imul(wt,Ct),s=Math.imul(wt,Dt),s=s+Math.imul(bt,Ct)|0,h=Math.imul(bt,Dt);var ni=(g+c|0)+((s&8191)<<13)|0;return g=(h+(s>>>13)|0)+(ni>>>26)|0,ni&=67108863,b[0]=Fe,b[1]=Ne,b[2]=qe,b[3]=Ue,b[4]=Ce,b[5]=De,b[6]=He,b[7]=Pe,b[8]=je,b[9]=ze,b[10]=Ze,b[11]=We,b[12]=Ye,b[13]=Xe,b[14]=Jn,b[15]=ti,b[16]=ei,b[17]=ri,b[18]=ni,g!==0&&(b[19]=g,l.length++),l};Math.imul||(I=L);function U(w,o,u){u.negative=o.negative^w.negative,u.length=w.length+o.length;for(var l=0,p=0,y=0;y<u.length-1;y++){var b=p;p=0;for(var g=l&67108863,c=Math.min(y,o.length-1),s=Math.max(0,y-w.length+1);s<=c;s++){var h=y-s,E=w.words[h]|0,B=o.words[s]|0,R=E*B,A=R&67108863;b=b+(R/67108864|0)|0,A=A+g|0,g=A&67108863,b=b+(A>>>26)|0,p+=b>>>26,b&=67108863}u.words[y]=g,l=b,b=p}return l!==0?u.words[y]=l:u.length--,u._strip()}function T(w,o,u){return U(w,o,u)}i.prototype.mulTo=function(o,u){var l,p=this.length+o.length;return this.length===10&&o.length===10?l=I(this,o,u):p<63?l=L(this,o,u):p<1024?l=U(this,o,u):l=T(this,o,u),l};function k(w,o){this.x=w,this.y=o}k.prototype.makeRBT=function(o){for(var u=new Array(o),l=i.prototype._countBits(o)-1,p=0;p<o;p++)u[p]=this.revBin(p,l,o);return u},k.prototype.revBin=function(o,u,l){if(o===0||o===l-1)return o;for(var p=0,y=0;y<u;y++)p|=(o&1)<<u-y-1,o>>=1;return p},k.prototype.permute=function(o,u,l,p,y,b){for(var g=0;g<b;g++)p[g]=u[o[g]],y[g]=l[o[g]]},k.prototype.transform=function(o,u,l,p,y,b){this.permute(b,o,u,l,p,y);for(var g=1;g<y;g<<=1)for(var c=g<<1,s=Math.cos(2*Math.PI/c),h=Math.sin(2*Math.PI/c),E=0;E<y;E+=c)for(var B=s,R=h,A=0;A<g;A++){var q=l[E+A],P=p[E+A],X=l[E+A+g],j=p[E+A+g],Z=B*X-R*j;j=B*j+R*X,X=Z,l[E+A]=q+X,p[E+A]=P+j,l[E+A+g]=q-X,p[E+A+g]=P-j,A!==c&&(Z=s*B-h*R,R=s*R+h*B,B=Z)}},k.prototype.guessLen13b=function(o,u){var l=Math.max(u,o)|1,p=l&1,y=0;for(l=l/2|0;l;l=l>>>1)y++;return 1<<y+1+p},k.prototype.conjugate=function(o,u,l){if(!(l<=1))for(var p=0;p<l/2;p++){var y=o[p];o[p]=o[l-p-1],o[l-p-1]=y,y=u[p],u[p]=-u[l-p-1],u[l-p-1]=-y}},k.prototype.normalize13b=function(o,u){for(var l=0,p=0;p<u/2;p++){var y=Math.round(o[2*p+1]/u)*8192+Math.round(o[2*p]/u)+l;o[p]=y&67108863,y<67108864?l=0:l=y/67108864|0}return o},k.prototype.convert13b=function(o,u,l,p){for(var y=0,b=0;b<u;b++)y=y+(o[b]|0),l[2*b]=y&8191,y=y>>>13,l[2*b+1]=y&8191,y=y>>>13;for(b=2*u;b<p;++b)l[b]=0;r(y===0),r((y&-8192)===0)},k.prototype.stub=function(o){for(var u=new Array(o),l=0;l<o;l++)u[l]=0;return u},k.prototype.mulp=function(o,u,l){var p=2*this.guessLen13b(o.length,u.length),y=this.makeRBT(p),b=this.stub(p),g=new Array(p),c=new Array(p),s=new Array(p),h=new Array(p),E=new Array(p),B=new Array(p),R=l.words;R.length=p,this.convert13b(o.words,o.length,g,p),this.convert13b(u.words,u.length,h,p),this.transform(g,b,c,s,p,y),this.transform(h,b,E,B,p,y);for(var A=0;A<p;A++){var q=c[A]*E[A]-s[A]*B[A];s[A]=c[A]*B[A]+s[A]*E[A],c[A]=q}return this.conjugate(c,s,p),this.transform(c,s,R,b,p,y),this.conjugate(R,b,p),this.normalize13b(R,p),l.negative=o.negative^u.negative,l.length=o.length+u.length,l._strip()},i.prototype.mul=function(o){var u=new i(null);return u.words=new Array(this.length+o.length),this.mulTo(o,u)},i.prototype.mulf=function(o){var u=new i(null);return u.words=new Array(this.length+o.length),T(this,o,u)},i.prototype.imul=function(o){return this.clone().mulTo(o,this)},i.prototype.imuln=function(o){var u=o<0;u&&(o=-o),r(typeof o=="number"),r(o<67108864);for(var l=0,p=0;p<this.length;p++){var y=(this.words[p]|0)*o,b=(y&67108863)+(l&67108863);l>>=26,l+=y/67108864|0,l+=b>>>26,this.words[p]=b&67108863}return l!==0&&(this.words[p]=l,this.length++),o===0&&(this.length=1,this._normSign()),u?this.ineg():this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var u=N(o);if(u.length===0)return new i(1);for(var l=this,p=0;p<u.length&&u[p]===0;p++,l=l.sqr());if(++p<u.length)for(var y=l.sqr();p<u.length;p++,y=y.sqr())u[p]!==0&&(l=l.mul(y));return l},i.prototype.iushln=function(o){r(typeof o=="number"&&o>=0);var u=o%26,l=(o-u)/26,p=67108863>>>26-u<<26-u,y;if(u!==0){var b=0;for(y=0;y<this.length;y++){var g=this.words[y]&p,c=(this.words[y]|0)-g<<u;this.words[y]=c|b,b=g>>>26-u}b&&(this.words[y]=b,this.length++)}if(l!==0){for(y=this.length-1;y>=0;y--)this.words[y+l]=this.words[y];for(y=0;y<l;y++)this.words[y]=0;this.length+=l}return this._strip()},i.prototype.ishln=function(o){return r(this.negative===0),this.iushln(o)},i.prototype.iushrn=function(o,u,l){r(typeof o=="number"&&o>=0);var p;u?p=(u-u%26)/26:p=0;var y=o%26,b=Math.min((o-y)/26,this.length),g=67108863^67108863>>>y<<y,c=l;if(p-=b,p=Math.max(0,p),c){for(var s=0;s<b;s++)c.words[s]=this.words[s];c.length=b}if(b!==0)if(this.length>b)for(this.length-=b,s=0;s<this.length;s++)this.words[s]=this.words[s+b];else this.words[0]=0,this.length=1;var h=0;for(s=this.length-1;s>=0&&(h!==0||s>=p);s--){var E=this.words[s]|0;this.words[s]=h<<26-y|E>>>y,h=E&g}return c&&h!==0&&(c.words[c.length++]=h),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(o,u,l){return r(this.negative===0),this.iushrn(o,u,l)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){r(typeof o=="number"&&o>=0);var u=o%26,l=(o-u)/26,p=1<<u;if(this.length<=l)return!1;var y=this.words[l];return!!(y&p)},i.prototype.imaskn=function(o){r(typeof o=="number"&&o>=0);var u=o%26,l=(o-u)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(u!==0&&l++,this.length=Math.min(l,this.length),u!==0){var p=67108863^67108863>>>u<<u;this.words[this.length-1]&=p}return this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.maskn=function(o){return this.clone().imaskn(o)},i.prototype.iaddn=function(o){return r(typeof o=="number"),r(o<67108864),o<0?this.isubn(-o):this.negative!==0?this.length===1&&(this.words[0]|0)<=o?(this.words[0]=o-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(o),this.negative=1,this):this._iaddn(o)},i.prototype._iaddn=function(o){this.words[0]+=o;for(var u=0;u<this.length&&this.words[u]>=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},i.prototype.isubn=function(o){if(r(typeof o=="number"),r(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u<this.length&&this.words[u]<0;u++)this.words[u]+=67108864,this.words[u+1]-=1;return this._strip()},i.prototype.addn=function(o){return this.clone().iaddn(o)},i.prototype.subn=function(o){return this.clone().isubn(o)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(o,u,l){var p=o.length+l,y;this._expand(p);var b,g=0;for(y=0;y<o.length;y++){b=(this.words[y+l]|0)+g;var c=(o.words[y]|0)*u;b-=c&67108863,g=(b>>26)-(c/67108864|0),this.words[y+l]=b&67108863}for(;y<this.length-l;y++)b=(this.words[y+l]|0)+g,g=b>>26,this.words[y+l]=b&67108863;if(g===0)return this._strip();for(r(g===-1),g=0,y=0;y<this.length;y++)b=-(this.words[y]|0)+g,g=b>>26,this.words[y]=b&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(o,u){var l=this.length-o.length,p=this.clone(),y=o,b=y.words[y.length-1]|0,g=this._countBits(b);l=26-g,l!==0&&(y=y.ushln(l),p.iushln(l),b=y.words[y.length-1]|0);var c=p.length-y.length,s;if(u!=="mod"){s=new i(null),s.length=c+1,s.words=new Array(s.length);for(var h=0;h<s.length;h++)s.words[h]=0}var E=p.clone()._ishlnsubmul(y,1,c);E.negative===0&&(p=E,s&&(s.words[c]=1));for(var B=c-1;B>=0;B--){var R=(p.words[y.length+B]|0)*67108864+(p.words[y.length+B-1]|0);for(R=Math.min(R/b|0,67108863),p._ishlnsubmul(y,R,B);p.negative!==0;)R--,p.negative=0,p._ishlnsubmul(y,1,B),p.isZero()||(p.negative^=1);s&&(s.words[B]=R)}return s&&s._strip(),p._strip(),u!=="div"&&l!==0&&p.iushrn(l),{div:s||null,mod:p}},i.prototype.divmod=function(o,u,l){if(r(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var p,y,b;return this.negative!==0&&o.negative===0?(b=this.neg().divmod(o,u),u!=="mod"&&(p=b.div.neg()),u!=="div"&&(y=b.mod.neg(),l&&y.negative!==0&&y.iadd(o)),{div:p,mod:y}):this.negative===0&&o.negative!==0?(b=this.divmod(o.neg(),u),u!=="mod"&&(p=b.div.neg()),{div:p,mod:b.mod}):(this.negative&o.negative)!==0?(b=this.neg().divmod(o.neg(),u),u!=="div"&&(y=b.mod.neg(),l&&y.negative!==0&&y.isub(o)),{div:b.div,mod:y}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?u==="div"?{div:this.divn(o.words[0]),mod:null}:u==="mod"?{div:null,mod:new i(this.modrn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modrn(o.words[0]))}:this._wordDiv(o,u)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var u=this.divmod(o);if(u.mod.isZero())return u.div;var l=u.mod.abs(),p=o.abs().iushrn(1),y=o.words[0]&1,b=l.cmp(p);if(b<0||y===1&&b===0)return u.div;var g=new i(1);return g.negative=this.negative^o.negative,u.div.iadd(g)},i.prototype.modrn=function(o){var u=o<0;u&&(o=-o),r(o<=67108863);for(var l=(1<<26)%o,p=0,y=this.length-1;y>=0;y--)p=(l*p+(this.words[y]|0))%o;return u?-p:p},i.prototype.modn=function(o){return this.modrn(o)},i.prototype.idivn=function(o){var u=o<0;u&&(o=-o),r(o<=67108863);for(var l=0,p=this.length-1;p>=0;p--){var y=(this.words[p]|0)+l*67108864;this.words[p]=y/o|0,l=y%o}return this._strip(),u?this.ineg():this},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){r(o.negative===0),r(!o.isZero());var u=this,l=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var p=new i(1),y=new i(0),b=new i(0),g=new i(1),c=0;u.isEven()&&l.isEven();)u.iushrn(1),l.iushrn(1),++c;for(var s=l.clone(),h=u.clone();!u.isZero();){for(var E=0,B=1;(u.words[0]&B)===0&&E<26;++E,B<<=1);if(E>0)for(u.iushrn(E);E-- >0;)(p.isOdd()||y.isOdd())&&(p.iadd(s),y.isub(h)),p.iushrn(1),y.iushrn(1);for(var R=0,A=1;(l.words[0]&A)===0&&R<26;++R,A<<=1);if(R>0)for(l.iushrn(R);R-- >0;)(b.isOdd()||g.isOdd())&&(b.iadd(s),g.isub(h)),b.iushrn(1),g.iushrn(1);u.cmp(l)>=0?(u.isub(l),p.isub(b),y.isub(g)):(l.isub(u),b.isub(p),g.isub(y))}return{a:b,b:g,gcd:l.iushln(c)}},i.prototype._invmp=function(o){r(o.negative===0),r(!o.isZero());var u=this,l=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var p=new i(1),y=new i(0),b=l.clone();u.cmpn(1)>0&&l.cmpn(1)>0;){for(var g=0,c=1;(u.words[0]&c)===0&&g<26;++g,c<<=1);if(g>0)for(u.iushrn(g);g-- >0;)p.isOdd()&&p.iadd(b),p.iushrn(1);for(var s=0,h=1;(l.words[0]&h)===0&&s<26;++s,h<<=1);if(s>0)for(l.iushrn(s);s-- >0;)y.isOdd()&&y.iadd(b),y.iushrn(1);u.cmp(l)>=0?(u.isub(l),p.isub(y)):(l.isub(u),y.isub(p))}var E;return u.cmpn(1)===0?E=p:E=y,E.cmpn(0)<0&&E.iadd(o),E},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var u=this.clone(),l=o.clone();u.negative=0,l.negative=0;for(var p=0;u.isEven()&&l.isEven();p++)u.iushrn(1),l.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;l.isEven();)l.iushrn(1);var y=u.cmp(l);if(y<0){var b=u;u=l,l=b}else if(y===0||l.cmpn(1)===0)break;u.isub(l)}while(!0);return l.iushln(p)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){r(typeof o=="number");var u=o%26,l=(o-u)/26,p=1<<u;if(this.length<=l)return this._expand(l+1),this.words[l]|=p,this;for(var y=p,b=l;y!==0&&b<this.length;b++){var g=this.words[b]|0;g+=y,y=g>>>26,g&=67108863,this.words[b]=g}return y!==0&&(this.words[b]=y,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var u=o<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this._strip();var l;if(this.length>1)l=1;else{u&&(o=-o),r(o<=67108863,"Number is too big");var p=this.words[0]|0;l=p===o?0:p<o?-1:1}return this.negative!==0?-l|0:l},i.prototype.cmp=function(o){if(this.negative!==0&&o.negative===0)return-1;if(this.negative===0&&o.negative!==0)return 1;var u=this.ucmp(o);return this.negative!==0?-u|0:u},i.prototype.ucmp=function(o){if(this.length>o.length)return 1;if(this.length<o.length)return-1;for(var u=0,l=this.length-1;l>=0;l--){var p=this.words[l]|0,y=o.words[l]|0;if(p!==y){p<y?u=-1:p>y&&(u=1);break}}return u},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new K(o)},i.prototype.toRed=function(o){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return r(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},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(o){return r(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var H={k256:null,p224:null,p192:null,p25519:null};function D(w,o){this.name=w,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}D.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},D.prototype.ireduce=function(o){var u=o,l;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),l=u.bitLength();while(l>this.n);var p=l<this.n?-1:u.ucmp(this.p);return p===0?(u.words[0]=0,u.length=1):p>0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},D.prototype.split=function(o,u){o.iushrn(this.n,0,u)},D.prototype.imulK=function(o){return o.imul(this.k)};function W(){D.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(W,D),W.prototype.split=function(o,u){for(var l=4194303,p=Math.min(o.length,9),y=0;y<p;y++)u.words[y]=o.words[y];if(u.length=p,o.length<=9){o.words[0]=0,o.length=1;return}var b=o.words[9];for(u.words[u.length++]=b&l,y=10;y<o.length;y++){var g=o.words[y]|0;o.words[y-10]=(g&l)<<4|b>>>22,b=g}b>>>=22,o.words[y-10]=b,b===0&&o.length>10?o.length-=10:o.length-=9},W.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var u=0,l=0;l<o.length;l++){var p=o.words[l]|0;u+=p*977,o.words[l]=u&67108863,u=p*64+(u/67108864|0)}return o.words[o.length-1]===0&&(o.length--,o.words[o.length-1]===0&&o.length--),o};function $(){D.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n($,D);function Y(){D.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(Y,D);function V(){D.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(V,D),V.prototype.imulK=function(o){for(var u=0,l=0;l<o.length;l++){var p=(o.words[l]|0)*19+u,y=p&67108863;p>>>=26,o.words[l]=y,u=p}return u!==0&&(o.words[o.length++]=u),o},i._prime=function(o){if(H[o])return H[o];var u;if(o==="k256")u=new W;else if(o==="p224")u=new $;else if(o==="p192")u=new Y;else if(o==="p25519")u=new V;else throw new Error("Unknown prime "+o);return H[o]=u,u};function K(w){if(typeof w=="string"){var o=i._prime(w);this.m=o.p,this.prime=o}else r(w.gtn(1),"modulus must be greater than 1"),this.m=w,this.prime=null}K.prototype._verify1=function(o){r(o.negative===0,"red works only with positives"),r(o.red,"red works only with red numbers")},K.prototype._verify2=function(o,u){r((o.negative|u.negative)===0,"red works only with positives"),r(o.red&&o.red===u.red,"red works only with red numbers")},K.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):(x(o,o.umod(this.m)._forceRed(this)),o)},K.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},K.prototype.add=function(o,u){this._verify2(o,u);var l=o.add(u);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},K.prototype.iadd=function(o,u){this._verify2(o,u);var l=o.iadd(u);return l.cmp(this.m)>=0&&l.isub(this.m),l},K.prototype.sub=function(o,u){this._verify2(o,u);var l=o.sub(u);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},K.prototype.isub=function(o,u){this._verify2(o,u);var l=o.isub(u);return l.cmpn(0)<0&&l.iadd(this.m),l},K.prototype.shl=function(o,u){return this._verify1(o),this.imod(o.ushln(u))},K.prototype.imul=function(o,u){return this._verify2(o,u),this.imod(o.imul(u))},K.prototype.mul=function(o,u){return this._verify2(o,u),this.imod(o.mul(u))},K.prototype.isqr=function(o){return this.imul(o,o.clone())},K.prototype.sqr=function(o){return this.mul(o,o)},K.prototype.sqrt=function(o){if(o.isZero())return o.clone();var u=this.m.andln(3);if(r(u%2===1),u===3){var l=this.m.add(new i(1)).iushrn(2);return this.pow(o,l)}for(var p=this.m.subn(1),y=0;!p.isZero()&&p.andln(1)===0;)y++,p.iushrn(1);r(!p.isZero());var b=new i(1).toRed(this),g=b.redNeg(),c=this.m.subn(1).iushrn(1),s=this.m.bitLength();for(s=new i(2*s*s).toRed(this);this.pow(s,c).cmp(g)!==0;)s.redIAdd(g);for(var h=this.pow(s,p),E=this.pow(o,p.addn(1).iushrn(1)),B=this.pow(o,p),R=y;B.cmp(b)!==0;){for(var A=B,q=0;A.cmp(b)!==0;q++)A=A.redSqr();r(q<R);var P=this.pow(h,new i(1).iushln(R-q-1));E=E.redMul(P),h=P.redSqr(),B=B.redMul(h),R=q}return E},K.prototype.invm=function(o){var u=o._invmp(this.m);return u.negative!==0?(u.negative=0,this.imod(u).redNeg()):this.imod(u)},K.prototype.pow=function(o,u){if(u.isZero())return new i(1).toRed(this);if(u.cmpn(1)===0)return o.clone();var l=4,p=new Array(1<<l);p[0]=new i(1).toRed(this),p[1]=o;for(var y=2;y<p.length;y++)p[y]=this.mul(p[y-1],o);var b=p[0],g=0,c=0,s=u.bitLength()%26;for(s===0&&(s=26),y=u.length-1;y>=0;y--){for(var h=u.words[y],E=s-1;E>=0;E--){var B=h>>E&1;if(b!==p[0]&&(b=this.sqr(b)),B===0&&g===0){c=0;continue}g<<=1,g|=B,c++,!(c!==l&&(y!==0||E!==0))&&(b=this.mul(b,p[g]),c=0,g=0)}s=26}return b},K.prototype.convertTo=function(o){var u=o.umod(this.m);return u===o?u.clone():u},K.prototype.convertFrom=function(o){var u=o.clone();return u.red=null,u},i.mont=function(o){return new J(o)};function J(w){K.call(this,w),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(J,K),J.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},J.prototype.convertFrom=function(o){var u=this.imod(o.mul(this.rinv));return u.red=null,u},J.prototype.imul=function(o,u){if(o.isZero()||u.isZero())return o.words[0]=0,o.length=1,o;var l=o.imul(u),p=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=l.isub(p).iushrn(this.shift),b=y;return y.cmp(this.m)>=0?b=y.isub(this.m):y.cmpn(0)<0&&(b=y.iadd(this.m)),b._forceRed(this)},J.prototype.mul=function(o,u){if(o.isZero()||u.isZero())return new i(0)._forceRed(this);var l=o.mul(u),p=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=l.isub(p).iushrn(this.shift),b=y;return y.cmp(this.m)>=0?b=y.isub(this.m):y.cmpn(0)<0&&(b=y.iadd(this.m)),b._forceRed(this)},J.prototype.invm=function(o){var u=this.imod(o._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(typeof gi>"u"||gi,rs)});var yi=nt((Nh,mi)=>{"use strict";F();var Er=typeof Reflect=="object"?Reflect:null,is=Er&&typeof Er.apply=="function"?Er.apply:function(t,r,n){return Function.prototype.apply.call(t,r,n)},an;Er&&typeof Er.ownKeys=="function"?an=Er.ownKeys:Object.getOwnPropertySymbols?an=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:an=function(t){return Object.getOwnPropertyNames(t)};function Du(e){console&&console.warn&&console.warn(e)}var ss=Number.isNaN||function(t){return t!==t};function lt(){lt.init.call(this)}mi.exports=lt;mi.exports.once=zu;lt.EventEmitter=lt;lt.prototype._events=void 0;lt.prototype._eventsCount=0;lt.prototype._maxListeners=void 0;var os=10;function un(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(lt,"defaultMaxListeners",{enumerable:!0,get:function(){return os},set:function(e){if(typeof e!="number"||e<0||ss(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");os=e}});lt.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};lt.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||ss(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function fs(e){return e._maxListeners===void 0?lt.defaultMaxListeners:e._maxListeners}lt.prototype.getMaxListeners=function(){return fs(this)};lt.prototype.emit=function(t){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=t==="error",f=this._events;if(f!==void 0)i=i&&f.error===void 0;else if(!i)return!1;if(i){var a;if(r.length>0&&(a=r[0]),a instanceof Error)throw a;var m=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw m.context=a,m}var d=f[t];if(d===void 0)return!1;if(typeof d=="function")is(d,this,r);else for(var x=d.length,v=hs(d,x),n=0;n<x;++n)is(v[n],this,r);return!0};function as(e,t,r,n){var i,f,a;if(un(r),f=e._events,f===void 0?(f=e._events=Object.create(null),e._eventsCount=0):(f.newListener!==void 0&&(e.emit("newListener",t,r.listener?r.listener:r),f=e._events),a=f[t]),a===void 0)a=f[t]=r,++e._eventsCount;else if(typeof a=="function"?a=f[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),i=fs(e),i>0&&a.length>i&&!a.warned){a.warned=!0;var m=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");m.name="MaxListenersExceededWarning",m.emitter=e,m.type=t,m.count=a.length,Du(m)}return e}lt.prototype.addListener=function(t,r){return as(this,t,r,!1)};lt.prototype.on=lt.prototype.addListener;lt.prototype.prependListener=function(t,r){return as(this,t,r,!0)};function Hu(){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 us(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=Hu.bind(n);return i.listener=r,n.wrapFn=i,i}lt.prototype.once=function(t,r){return un(r),this.on(t,us(this,t,r)),this};lt.prototype.prependOnceListener=function(t,r){return un(r),this.prependListener(t,us(this,t,r)),this};lt.prototype.removeListener=function(t,r){var n,i,f,a,m;if(un(r),i=this._events,i===void 0)return this;if(n=i[t],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,n.listener||r));else if(typeof n!="function"){for(f=-1,a=n.length-1;a>=0;a--)if(n[a]===r||n[a].listener===r){m=n[a].listener,f=a;break}if(f<0)return this;f===0?n.shift():Pu(n,f),n.length===1&&(i[t]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",t,m||r)}return this};lt.prototype.off=lt.prototype.removeListener;lt.prototype.removeAllListeners=function(t){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[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var f=Object.keys(n),a;for(i=0;i<f.length;++i)a=f[i],a!=="removeListener"&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[t],typeof r=="function")this.removeListener(t,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(t,r[i]);return this};function cs(e,t,r){var n=e._events;if(n===void 0)return[];var i=n[t];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?ju(i):hs(i,i.length)}lt.prototype.listeners=function(t){return cs(this,t,!0)};lt.prototype.rawListeners=function(t){return cs(this,t,!1)};lt.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):ls.call(e,t)};lt.prototype.listenerCount=ls;function ls(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}lt.prototype.eventNames=function(){return this._eventsCount>0?an(this._events):[]};function hs(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function Pu(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function ju(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function zu(e,t){return new Promise(function(r,n){function i(a){e.removeListener(t,f),n(a)}function f(){typeof e.removeListener=="function"&&e.removeListener("error",i),r([].slice.call(arguments))}ds(e,t,f,{once:!0}),t!=="error"&&Zu(e,i,{once:!0})})}function Zu(e,t,r){typeof e.on=="function"&&ds(e,"error",t,r)}function ds(e,t,r,n){if(typeof e.on=="function")n.once?e.once(t,r):e.on(t,r);else if(typeof e.addEventListener=="function")e.addEventListener(t,function i(f){n.once&&e.removeEventListener(t,i),r(f)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}});var wi=nt((Uh,ps)=>{F();ps.exports=yi().EventEmitter});var bi=nt(()=>{F()});var xs=nt((jh,bs)=>{"use strict";F();function gs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ms(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gs(Object(r),!0).forEach(function(n){Wu(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gs(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Wu(e,t,r){return t=ws(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Yu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ys(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ws(n.key),n)}}function Xu(e,t,r){return t&&ys(e.prototype,t),r&&ys(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ws(e){var t=Gu(e,"string");return typeof t=="symbol"?t:String(t)}function Gu(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var $u=we(),cn=$u.Buffer,Ku=bi(),xi=Ku.inspect,Vu=xi&&xi.custom||"inspect";function Qu(e,t,r){cn.prototype.copy.call(e,t,r)}bs.exports=(function(){function e(){Yu(this,e),this.head=null,this.tail=null,this.length=0}return Xu(e,[{key:"push",value:function(r){var n={data:r,next:null};this.length>0?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 cn.alloc(0);for(var n=cn.allocUnsafe(r>>>0),i=this.head,f=0;i;)Qu(i.data,n,f),f+=i.data.length,i=i.next;return n}},{key:"consume",value:function(r,n){var i;return r<this.head.data.length?(i=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?i=this.shift():i=n?this._getString(r):this._getBuffer(r),i}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(r){var n=this.head,i=1,f=n.data;for(r-=f.length;n=n.next;){var a=n.data,m=r>a.length?a.length:r;if(m===a.length?f+=a:f+=a.slice(0,r),r-=m,r===0){m===a.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=a.slice(m));break}++i}return this.length-=i,f}},{key:"_getBuffer",value:function(r){var n=cn.allocUnsafe(r),i=this.head,f=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var a=i.data,m=r>a.length?a.length:r;if(a.copy(n,n.length-r,0,m),r-=m,r===0){m===a.length?(++f,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=a.slice(m));break}++f}return this.length-=f,n}},{key:Vu,value:function(r,n){return xi(this,ms(ms({},n),{},{depth:0,customInspect:!1}))}}]),e})()});var Ei=nt((Zh,Es)=>{"use strict";F();function Ju(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(vi,this,e)):process.nextTick(vi,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(f){!t&&f?r._writableState?r._writableState.errorEmitted?process.nextTick(ln,r):(r._writableState.errorEmitted=!0,process.nextTick(vs,r,f)):process.nextTick(vs,r,f):t?(process.nextTick(ln,r),t(f)):process.nextTick(ln,r)}),this)}function vs(e,t){vi(e,t),ln(e)}function ln(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function tc(){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 vi(e,t){e.emit("error",t)}function ec(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}Es.exports={destroy:Ju,undestroy:tc,errorOrDestroy:ec}});var Ke=nt((Yh,Ss)=>{"use strict";F();function rc(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var Bs={};function te(e,t,r){r||(r=Error);function n(f,a,m){return typeof t=="string"?t:t(f,a,m)}var i=(function(f){rc(a,f);function a(m,d,x){return f.call(this,n(m,d,x))||this}return a})(r);i.prototype.name=r.name,i.prototype.code=e,Bs[e]=i}function _s(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(n){return String(n)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:r===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function nc(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}function ic(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function oc(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}te("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);te("ERR_INVALID_ARG_TYPE",function(e,t,r){var n;typeof t=="string"&&nc(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";var i;if(ic(e," argument"))i="The ".concat(e," ").concat(n," ").concat(_s(t,"type"));else{var f=oc(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(f," ").concat(n," ").concat(_s(t,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);te("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");te("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});te("ERR_STREAM_PREMATURE_CLOSE","Premature close");te("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});te("ERR_MULTIPLE_CALLBACK","Callback called multiple times");te("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");te("ERR_STREAM_WRITE_AFTER_END","write after end");te("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);te("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);te("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");Ss.exports.codes=Bs});var _i=nt((Gh,Ms)=>{"use strict";F();var sc=Ke().codes.ERR_INVALID_OPT_VALUE;function fc(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function ac(e,t,r,n){var i=fc(t,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var f=n?r:"highWaterMark";throw new sc(f,i)}return Math.floor(i)}return e.objectMode?16:16*1024}Ms.exports={getHighWaterMark:ac}});var _r=nt((Kh,Bi)=>{F();typeof Object.create=="function"?Bi.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Bi.exports=function(t,r){if(r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}}});var As=nt((Qh,Rs)=>{F();Rs.exports=uc;function uc(e,t){if(Si("noDeprecation"))return e;var r=!1;function n(){if(!r){if(Si("throwDeprecation"))throw new Error(t);Si("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return n}function Si(e){try{if(!globalThis.localStorage)return!1}catch{return!1}var t=globalThis.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}});var Ai=nt((td,Fs)=>{"use strict";F();Fs.exports=jt;function Os(e){var t=this;this.next=null,this.entry=null,this.finish=function(){qc(t,e)}}var Br;jt.WritableState=Hr;var cc={deprecate:As()},Is=wi(),dn=we().Buffer,lc=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function hc(e){return dn.from(e)}function dc(e){return dn.isBuffer(e)||e instanceof lc}var Ri=Ei(),pc=_i(),gc=pc.getHighWaterMark,be=Ke().codes,mc=be.ERR_INVALID_ARG_TYPE,yc=be.ERR_METHOD_NOT_IMPLEMENTED,wc=be.ERR_MULTIPLE_CALLBACK,bc=be.ERR_STREAM_CANNOT_PIPE,xc=be.ERR_STREAM_DESTROYED,vc=be.ERR_STREAM_NULL_VALUES,Ec=be.ERR_STREAM_WRITE_AFTER_END,_c=be.ERR_UNKNOWN_ENCODING,Sr=Ri.errorOrDestroy;_r()(jt,Is);function Bc(){}function Hr(e,t,r){Br=Br||Ve(),e=e||{},typeof r!="boolean"&&(r=t instanceof Br),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=gc(this,e,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=e.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){Ic(t,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Os(this)}Hr.prototype.getBuffer=function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r};(function(){try{Object.defineProperty(Hr.prototype,"buffer",{get:cc.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var hn;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(hn=Function.prototype[Symbol.hasInstance],Object.defineProperty(jt,Symbol.hasInstance,{value:function(t){return hn.call(this,t)?!0:this!==jt?!1:t&&t._writableState instanceof Hr}})):hn=function(t){return t instanceof this};function jt(e){Br=Br||Ve();var t=this instanceof Br;if(!t&&!hn.call(jt,this))return new jt(e);this._writableState=new Hr(e,this,t),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),Is.call(this)}jt.prototype.pipe=function(){Sr(this,new bc)};function Sc(e,t){var r=new Ec;Sr(e,r),process.nextTick(t,r)}function Mc(e,t,r,n){var i;return r===null?i=new vc:typeof r!="string"&&!t.objectMode&&(i=new mc("chunk",["string","Buffer"],r)),i?(Sr(e,i),process.nextTick(n,i),!1):!0}jt.prototype.write=function(e,t,r){var n=this._writableState,i=!1,f=!n.objectMode&&dc(e);return f&&!dn.isBuffer(e)&&(e=hc(e)),typeof t=="function"&&(r=t,t=null),f?t="buffer":t||(t=n.defaultEncoding),typeof r!="function"&&(r=Bc),n.ending?Sc(this,r):(f||Mc(this,n,e,r))&&(n.pendingcb++,i=Ac(this,n,f,e,t,r)),i};jt.prototype.cork=function(){this._writableState.corked++};jt.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&Ls(this,e))};jt.prototype.setDefaultEncoding=function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new _c(t);return this._writableState.defaultEncoding=t,this};Object.defineProperty(jt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Rc(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=dn.from(t,r)),t}Object.defineProperty(jt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Ac(e,t,r,n,i,f){if(!r){var a=Rc(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var m=t.objectMode?1:n.length;t.length+=m;var d=t.length<t.highWaterMark;if(d||(t.needDrain=!0),t.writing||t.corked){var x=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:f,next:null},x?x.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else Mi(e,t,!1,m,n,i,f);return d}function Mi(e,t,r,n,i,f,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new xc("write")):r?e._writev(i,t.onwrite):e._write(i,f,t.onwrite),t.sync=!1}function Tc(e,t,r,n,i){--t.pendingcb,r?(process.nextTick(i,n),process.nextTick(Dr,e,t),e._writableState.errorEmitted=!0,Sr(e,n)):(i(n),e._writableState.errorEmitted=!0,Sr(e,n),Dr(e,t))}function Oc(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function Ic(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(typeof i!="function")throw new wc;if(Oc(r),t)Tc(e,r,n,t,i);else{var f=ks(r)||e.destroyed;!f&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&Ls(e,r),n?process.nextTick(Ts,e,r,f,i):Ts(e,r,f,i)}}function Ts(e,t,r,n){r||Lc(e,t),t.pendingcb--,n(),Dr(e,t)}function Lc(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function Ls(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),f=t.corkedRequestsFree;f.entry=r;for(var a=0,m=!0;r;)i[a]=r,r.isBuf||(m=!1),r=r.next,a+=1;i.allBuffers=m,Mi(e,t,!0,t.length,i,"",f.finish),t.pendingcb++,t.lastBufferedRequest=null,f.next?(t.corkedRequestsFree=f.next,f.next=null):t.corkedRequestsFree=new Os(t),t.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,x=r.encoding,v=r.callback,_=t.objectMode?1:d.length;if(Mi(e,t,!1,_,d,x,v),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}jt.prototype._write=function(e,t,r){r(new yc("_write()"))};jt.prototype._writev=null;jt.prototype.end=function(e,t,r){var n=this._writableState;return typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null),e!=null&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||Nc(this,n,r),this};Object.defineProperty(jt.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function ks(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function kc(e,t){e._final(function(r){t.pendingcb--,r&&Sr(e,r),t.prefinished=!0,e.emit("prefinish"),Dr(e,t)})}function Fc(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"&&!t.destroyed?(t.pendingcb++,t.finalCalled=!0,process.nextTick(kc,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function Dr(e,t){var r=ks(t);if(r&&(Fc(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}function Nc(e,t,r){t.ending=!0,Dr(e,t),r&&(t.finished?process.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function qc(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}Object.defineProperty(jt.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}});jt.prototype.destroy=Ri.destroy;jt.prototype._undestroy=Ri.undestroy;jt.prototype._destroy=function(e,t){t(e)}});var Ve=nt((rd,qs)=>{"use strict";F();var Uc=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};qs.exports=se;var Ns=Ii(),Oi=Ai();_r()(se,Ns);for(Ti=Uc(Oi.prototype),pn=0;pn<Ti.length;pn++)gn=Ti[pn],se.prototype[gn]||(se.prototype[gn]=Oi.prototype[gn]);var Ti,gn,pn;function se(e){if(!(this instanceof se))return new se(e);Ns.call(this,e),Oi.call(this,e),this.allowHalfOpen=!0,e&&(e.readable===!1&&(this.readable=!1),e.writable===!1&&(this.writable=!1),e.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",Cc)))}Object.defineProperty(se.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty(se.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(se.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Cc(){this._writableState.ended||process.nextTick(Dc,this)}function Dc(e){e.end()}Object.defineProperty(se.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(t){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=t,this._writableState.destroyed=t)}})});var Ds=nt((Li,Cs)=>{F();var mn=we(),le=mn.Buffer;function Us(e,t){for(var r in e)t[r]=e[r]}le.from&&le.alloc&&le.allocUnsafe&&le.allocUnsafeSlow?Cs.exports=mn:(Us(mn,Li),Li.Buffer=Mr);function Mr(e,t,r){return le(e,t,r)}Us(le,Mr);Mr.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return le(e,t,r)};Mr.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=le(e);return t!==void 0?typeof r=="string"?n.fill(t,r):n.fill(t):n.fill(0),n};Mr.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return le(e)};Mr.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return mn.SlowBuffer(e)}});var Ni=nt(Ps=>{"use strict";F();var Fi=Ds().Buffer,Hs=Fi.isEncoding||function(e){switch(e=""+e,e&&e.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 Hc(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function Pc(e){var t=Hc(e);if(typeof t!="string"&&(Fi.isEncoding===Hs||!Hs(e)))throw new Error("Unknown encoding: "+e);return t||e}Ps.StringDecoder=Pr;function Pr(e){this.encoding=Pc(e);var t;switch(this.encoding){case"utf16le":this.text=Xc,this.end=Gc,t=4;break;case"utf8":this.fillLast=Zc,t=4;break;case"base64":this.text=$c,this.end=Kc,t=3;break;default:this.write=Vc,this.end=Qc;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Fi.allocUnsafe(t)}Pr.prototype.write=function(e){if(e.length===0)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""};Pr.prototype.end=Yc;Pr.prototype.text=Wc;Pr.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function ki(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function jc(e,t,r){var n=t.length-1;if(n<r)return 0;var i=ki(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||i===-2?0:(i=ki(t[n]),i>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||i===-2?0:(i=ki(t[n]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function zc(e,t,r){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}function Zc(e){var t=this.lastTotal-this.lastNeed,r=zc(this,e,t);if(r!==void 0)return r;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function Wc(e,t){var r=jc(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}function Yc(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function Xc(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function Gc(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function $c(e,t){var r=(e.length-t)%3;return r===0?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function Kc(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function Vc(e){return e.toString(this.encoding)}function Qc(e){return e&&e.length?this.write(e):""}});var yn=nt((fd,Zs)=>{"use strict";F();var js=Ke().codes.ERR_STREAM_PREMATURE_CLOSE;function Jc(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}function tl(){}function el(e){return e.setHeader&&typeof e.abort=="function"}function zs(e,t,r){if(typeof t=="function")return zs(e,null,t);t||(t={}),r=Jc(r||tl);var n=t.readable||t.readable!==!1&&e.readable,i=t.writable||t.writable!==!1&&e.writable,f=function(){e.writable||m()},a=e._writableState&&e._writableState.finished,m=function(){i=!1,a=!0,n||r.call(e)},d=e._readableState&&e._readableState.endEmitted,x=function(){n=!1,d=!0,i||r.call(e)},v=function(C){r.call(e,C)},_=function(){var C;if(n&&!d)return(!e._readableState||!e._readableState.ended)&&(C=new js),r.call(e,C);if(i&&!a)return(!e._writableState||!e._writableState.ended)&&(C=new js),r.call(e,C)},M=function(){e.req.on("finish",m)};return el(e)?(e.on("complete",m),e.on("abort",_),e.req?M():e.on("request",M)):i&&!e._writableState&&(e.on("end",f),e.on("close",f)),e.on("end",x),e.on("finish",m),t.error!==!1&&e.on("error",v),e.on("close",_),function(){e.removeListener("complete",m),e.removeListener("abort",_),e.removeListener("request",M),e.req&&e.req.removeListener("finish",m),e.removeListener("end",f),e.removeListener("close",f),e.removeListener("finish",m),e.removeListener("end",x),e.removeListener("error",v),e.removeListener("close",_)}}Zs.exports=zs});var Ys=nt((ud,Ws)=>{"use strict";F();var wn;function xe(e,t,r){return t=rl(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rl(e){var t=nl(e,"string");return typeof t=="symbol"?t:String(t)}function nl(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var il=yn(),ve=Symbol("lastResolve"),Qe=Symbol("lastReject"),jr=Symbol("error"),bn=Symbol("ended"),Je=Symbol("lastPromise"),qi=Symbol("handlePromise"),tr=Symbol("stream");function Ee(e,t){return{value:e,done:t}}function ol(e){var t=e[ve];if(t!==null){var r=e[tr].read();r!==null&&(e[Je]=null,e[ve]=null,e[Qe]=null,t(Ee(r,!1)))}}function sl(e){process.nextTick(ol,e)}function fl(e,t){return function(r,n){e.then(function(){if(t[bn]){r(Ee(void 0,!0));return}t[qi](r,n)},n)}}var al=Object.getPrototypeOf(function(){}),ul=Object.setPrototypeOf((wn={get stream(){return this[tr]},next:function(){var t=this,r=this[jr];if(r!==null)return Promise.reject(r);if(this[bn])return Promise.resolve(Ee(void 0,!0));if(this[tr].destroyed)return new Promise(function(a,m){process.nextTick(function(){t[jr]?m(t[jr]):a(Ee(void 0,!0))})});var n=this[Je],i;if(n)i=new Promise(fl(n,this));else{var f=this[tr].read();if(f!==null)return Promise.resolve(Ee(f,!1));i=new Promise(this[qi])}return this[Je]=i,i}},xe(wn,Symbol.asyncIterator,function(){return this}),xe(wn,"return",function(){var t=this;return new Promise(function(r,n){t[tr].destroy(null,function(i){if(i){n(i);return}r(Ee(void 0,!0))})})}),wn),al),cl=function(t){var r,n=Object.create(ul,(r={},xe(r,tr,{value:t,writable:!0}),xe(r,ve,{value:null,writable:!0}),xe(r,Qe,{value:null,writable:!0}),xe(r,jr,{value:null,writable:!0}),xe(r,bn,{value:t._readableState.endEmitted,writable:!0}),xe(r,qi,{value:function(f,a){var m=n[tr].read();m?(n[Je]=null,n[ve]=null,n[Qe]=null,f(Ee(m,!1))):(n[ve]=f,n[Qe]=a)},writable:!0}),r));return n[Je]=null,il(t,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var f=n[Qe];f!==null&&(n[Je]=null,n[ve]=null,n[Qe]=null,f(i)),n[jr]=i;return}var a=n[ve];a!==null&&(n[Je]=null,n[ve]=null,n[Qe]=null,a(Ee(void 0,!0))),n[bn]=!0}),t.on("readable",sl.bind(null,n)),n};Ws.exports=cl});var Gs=nt((ld,Xs)=>{F();Xs.exports=function(){throw new Error("Readable.from is not available in the browser")}});var Ii=nt((pd,of)=>{"use strict";F();of.exports=it;var Rr;it.ReadableState=Qs;var dd=yi().EventEmitter,Vs=function(t,r){return t.listeners(r).length},Zr=wi(),xn=we().Buffer,ll=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function hl(e){return xn.from(e)}function dl(e){return xn.isBuffer(e)||e instanceof ll}var Ui=bi(),tt;Ui&&Ui.debuglog?tt=Ui.debuglog("stream"):tt=function(){};var pl=xs(),Zi=Ei(),gl=_i(),ml=gl.getHighWaterMark,vn=Ke().codes,yl=vn.ERR_INVALID_ARG_TYPE,wl=vn.ERR_STREAM_PUSH_AFTER_EOF,bl=vn.ERR_METHOD_NOT_IMPLEMENTED,xl=vn.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Ar,Ci,Di;_r()(it,Zr);var zr=Zi.errorOrDestroy,Hi=["error","close","destroy","pause","resume"];function vl(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}function Qs(e,t,r){Rr=Rr||Ve(),e=e||{},typeof r!="boolean"&&(r=t instanceof Rr),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=ml(this,e,"readableHighWaterMark",r),this.buffer=new pl,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=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(Ar||(Ar=Ni().StringDecoder),this.decoder=new Ar(e.encoding),this.encoding=e.encoding)}function it(e){if(Rr=Rr||Ve(),!(this instanceof it))return new it(e);var t=this instanceof Rr;this._readableState=new Qs(e,this,t),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),Zr.call(this)}Object.defineProperty(it.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}});it.prototype.destroy=Zi.destroy;it.prototype._undestroy=Zi.undestroy;it.prototype._destroy=function(e,t){t(e)};it.prototype.push=function(e,t){var r=this._readableState,n;return r.objectMode?n=!0:typeof e=="string"&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=xn.from(e,t),t=""),n=!0),Js(this,e,t,!1,n)};it.prototype.unshift=function(e){return Js(this,e,null,!0,!1)};function Js(e,t,r,n,i){tt("readableAddChunk",t);var f=e._readableState;if(t===null)f.reading=!1,Bl(e,f);else{var a;if(i||(a=El(f,t)),a)zr(e,a);else if(f.objectMode||t&&t.length>0)if(typeof t!="string"&&!f.objectMode&&Object.getPrototypeOf(t)!==xn.prototype&&(t=hl(t)),n)f.endEmitted?zr(e,new xl):Pi(e,f,t,!0);else if(f.ended)zr(e,new wl);else{if(f.destroyed)return!1;f.reading=!1,f.decoder&&!r?(t=f.decoder.write(t),f.objectMode||t.length!==0?Pi(e,f,t,!1):zi(e,f)):Pi(e,f,t,!1)}else n||(f.reading=!1,zi(e,f))}return!f.ended&&(f.length<f.highWaterMark||f.length===0)}function Pi(e,t,r,n){t.flowing&&t.length===0&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&En(e)),zi(e,t)}function El(e,t){var r;return!dl(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(r=new yl("chunk",["string","Buffer","Uint8Array"],t)),r}it.prototype.isPaused=function(){return this._readableState.flowing===!1};it.prototype.setEncoding=function(e){Ar||(Ar=Ni().StringDecoder);var t=new Ar(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";r!==null;)n+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),n!==""&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var $s=1073741824;function _l(e){return e>=$s?e=$s:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function Ks(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=_l(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}it.prototype.read=function(e){tt("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&((t.highWaterMark!==0?t.length>=t.highWaterMark:t.length>0)||t.ended))return tt("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?ji(this):En(this),null;if(e=Ks(e,t),e===0&&t.ended)return t.length===0&&ji(this),null;var n=t.needReadable;tt("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,tt("length less than watermark",n)),t.ended||t.reading?(n=!1,tt("reading or ended",n)):n&&(tt("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=Ks(r,t)));var i;return e>0?i=rf(e,t):i=null,i===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),t.length===0&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&ji(this)),i!==null&&this.emit("data",i),i};function Bl(e,t){if(tt("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?En(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,tf(e)))}}function En(e){var t=e._readableState;tt("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(tt("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(tf,e))}function tf(e){var t=e._readableState;tt("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,Wi(e)}function zi(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(Sl,e,t))}function Sl(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){var r=t.length;if(tt("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}it.prototype._read=function(e){zr(this,new bl("_read()"))};it.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e);break}n.pipesCount+=1,tt("pipe count=%d opts=%j",n.pipesCount,t);var i=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,f=i?m:N;n.endEmitted?process.nextTick(f):r.once("end",f),e.on("unpipe",a);function a(L,I){tt("onunpipe"),L===r&&I&&I.hasUnpiped===!1&&(I.hasUnpiped=!0,v())}function m(){tt("onend"),e.end()}var d=Ml(r);e.on("drain",d);var x=!1;function v(){tt("cleanup"),e.removeListener("close",S),e.removeListener("finish",C),e.removeListener("drain",d),e.removeListener("error",M),e.removeListener("unpipe",a),r.removeListener("end",m),r.removeListener("end",N),r.removeListener("data",_),x=!0,n.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&d()}r.on("data",_);function _(L){tt("ondata");var I=e.write(L);tt("dest.write",I),I===!1&&((n.pipesCount===1&&n.pipes===e||n.pipesCount>1&&nf(n.pipes,e)!==-1)&&!x&&(tt("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function M(L){tt("onerror",L),N(),e.removeListener("error",M),Vs(e,"error")===0&&zr(e,L)}vl(e,"error",M);function S(){e.removeListener("finish",C),N()}e.once("close",S);function C(){tt("onfinish"),e.removeListener("close",S),N()}e.once("finish",C);function N(){tt("unpipe"),r.unpipe(e)}return e.emit("pipe",r),n.flowing||(tt("pipe resume"),r.resume()),e};function Ml(e){return function(){var r=e._readableState;tt("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&Vs(e,"data")&&(r.flowing=!0,Wi(e))}}it.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var f=0;f<i;f++)n[f].emit("unpipe",this,{hasUnpiped:!1});return this}var a=nf(t.pipes,e);return a===-1?this:(t.pipes.splice(a,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)};it.prototype.on=function(e,t){var r=Zr.prototype.on.call(this,e,t),n=this._readableState;return e==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):e==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,tt("on readable",n.length,n.reading),n.length?En(this):n.reading||process.nextTick(Rl,this)),r};it.prototype.addListener=it.prototype.on;it.prototype.removeListener=function(e,t){var r=Zr.prototype.removeListener.call(this,e,t);return e==="readable"&&process.nextTick(ef,this),r};it.prototype.removeAllListeners=function(e){var t=Zr.prototype.removeAllListeners.apply(this,arguments);return(e==="readable"||e===void 0)&&process.nextTick(ef,this),t};function ef(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function Rl(e){tt("readable nexttick read 0"),e.read(0)}it.prototype.resume=function(){var e=this._readableState;return e.flowing||(tt("resume"),e.flowing=!e.readableListening,Al(this,e)),e.paused=!1,this};function Al(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(Tl,e,t))}function Tl(e,t){tt("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),Wi(e),t.flowing&&!t.reading&&e.read(0)}it.prototype.pause=function(){return tt("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(tt("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Wi(e){var t=e._readableState;for(tt("flow",t.flowing);t.flowing&&e.read()!==null;);}it.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;e.on("end",function(){if(tt("wrapped end"),r.decoder&&!r.ended){var a=r.decoder.end();a&&a.length&&t.push(a)}t.push(null)}),e.on("data",function(a){if(tt("wrapped data"),r.decoder&&(a=r.decoder.write(a)),!(r.objectMode&&a==null)&&!(!r.objectMode&&(!a||!a.length))){var m=t.push(a);m||(n=!0,e.pause())}});for(var i in e)this[i]===void 0&&typeof e[i]=="function"&&(this[i]=(function(m){return function(){return e[m].apply(e,arguments)}})(i));for(var f=0;f<Hi.length;f++)e.on(Hi[f],this.emit.bind(this,Hi[f]));return this._read=function(a){tt("wrapped _read",a),n&&(n=!1,e.resume())},this};typeof Symbol=="function"&&(it.prototype[Symbol.asyncIterator]=function(){return Ci===void 0&&(Ci=Ys()),Ci(this)});Object.defineProperty(it.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Object.defineProperty(it.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(it.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}});it._fromList=rf;Object.defineProperty(it.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function rf(e,t){if(t.length===0)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(t.decoder?r=t.buffer.join(""):t.buffer.length===1?r=t.buffer.first():r=t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}function ji(e){var t=e._readableState;tt("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(Ol,t,e))}function Ol(e,t){if(tt("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}typeof Symbol=="function"&&(it.from=function(e,t){return Di===void 0&&(Di=Gs()),Di(it,e,t)});function nf(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}});var Yi=nt((md,ff)=>{"use strict";F();ff.exports=he;var _n=Ke().codes,Il=_n.ERR_METHOD_NOT_IMPLEMENTED,Ll=_n.ERR_MULTIPLE_CALLBACK,kl=_n.ERR_TRANSFORM_ALREADY_TRANSFORMING,Fl=_n.ERR_TRANSFORM_WITH_LENGTH_0,Bn=Ve();_r()(he,Bn);function Nl(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new Ll);r.writechunk=null,r.writecb=null,t!=null&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function he(e){if(!(this instanceof he))return new he(e);Bn.call(this,e),this._transformState={afterTransform:Nl.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",ql)}function ql(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(t,r){sf(e,t,r)}):sf(this,null,null)}he.prototype.push=function(e,t){return this._transformState.needTransform=!1,Bn.prototype.push.call(this,e,t)};he.prototype._transform=function(e,t,r){r(new Il("_transform()"))};he.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};he.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};he.prototype._destroy=function(e,t){Bn.prototype._destroy.call(this,e,function(r){t(r)})};function sf(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new Fl;if(e._transformState.transforming)throw new kl;return e.push(null)}});var cf=nt((wd,uf)=>{"use strict";F();uf.exports=Wr;var af=Yi();_r()(Wr,af);function Wr(e){if(!(this instanceof Wr))return new Wr(e);af.call(this,e)}Wr.prototype._transform=function(e,t,r){r(null,e)}});var gf=nt((xd,pf)=>{"use strict";F();var Xi;function Ul(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var df=Ke().codes,Cl=df.ERR_MISSING_ARGS,Dl=df.ERR_STREAM_DESTROYED;function lf(e){if(e)throw e}function Hl(e){return e.setHeader&&typeof e.abort=="function"}function Pl(e,t,r,n){n=Ul(n);var i=!1;e.on("close",function(){i=!0}),Xi===void 0&&(Xi=yn()),Xi(e,{readable:t,writable:r},function(a){if(a)return n(a);i=!0,n()});var f=!1;return function(a){if(!i&&!f){if(f=!0,Hl(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();n(a||new Dl("pipe"))}}}function hf(e){e()}function jl(e,t){return e.pipe(t)}function zl(e){return!e.length||typeof e[e.length-1]!="function"?lf:e.pop()}function Zl(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=zl(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Cl("streams");var i,f=t.map(function(a,m){var d=m<t.length-1,x=m>0;return Pl(a,d,x,function(v){i||(i=v),v&&f.forEach(hf),!d&&(f.forEach(hf),n(i))})});return t.reduce(jl)}pf.exports=Zl});var Gi=nt((ee,mf)=>{F();ee=mf.exports=Ii();ee.Stream=ee;ee.Readable=ee;ee.Writable=Ai();ee.Duplex=Ve();ee.Transform=Yi();ee.PassThrough=cf();ee.finished=yn();ee.pipeline=gf()});var bf=nt((_d,wf)=>{F();var{Transform:Wl}=Gi();wf.exports=e=>class yf extends Wl{constructor(r,n,i,f,a){super(a),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=f,this._options=a,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let f=null;try{this.update(r,n)}catch(a){f=a}i(f)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!z.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return z.Buffer.isBuffer(r)||(r=z.Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new yf(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var Ef=nt((Sd,vf)=>{F();var{Transform:Yl}=Gi();vf.exports=e=>class xf extends Yl{constructor(r,n,i,f){super(f),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=f,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let f=null;try{this.update(r,n)}catch(a){f=a}i(f)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!z.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return z.Buffer.isBuffer(r)||(r=z.Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new xf(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var Bf=nt((Rd,_f)=>{F();var Xl=bf(),Gl=Ef();_f.exports=function(e){let t=Xl(e),r=Gl(e);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new t(1152,448,null,224,i);case"keccak256":return new t(1088,512,null,256,i);case"keccak384":return new t(832,768,null,384,i);case"keccak512":return new t(576,1024,null,512,i);case"sha3-224":return new t(1152,448,6,224,i);case"sha3-256":return new t(1088,512,6,256,i);case"sha3-384":return new t(832,768,6,384,i);case"sha3-512":return new t(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}}});var Rf=nt(Mf=>{F();var Sf=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];Mf.p1600=function(e){for(let t=0;t<24;++t){let r=e[0]^e[10]^e[20]^e[30]^e[40],n=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],f=e[3]^e[13]^e[23]^e[33]^e[43],a=e[4]^e[14]^e[24]^e[34]^e[44],m=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],x=e[7]^e[17]^e[27]^e[37]^e[47],v=e[8]^e[18]^e[28]^e[38]^e[48],_=e[9]^e[19]^e[29]^e[39]^e[49],M=v^(i<<1|f>>>31),S=_^(f<<1|i>>>31),C=e[0]^M,N=e[1]^S,L=e[10]^M,I=e[11]^S,U=e[20]^M,T=e[21]^S,k=e[30]^M,H=e[31]^S,D=e[40]^M,W=e[41]^S;M=r^(a<<1|m>>>31),S=n^(m<<1|a>>>31);let $=e[2]^M,Y=e[3]^S,V=e[12]^M,K=e[13]^S,J=e[22]^M,w=e[23]^S,o=e[32]^M,u=e[33]^S,l=e[42]^M,p=e[43]^S;M=i^(d<<1|x>>>31),S=f^(x<<1|d>>>31);let y=e[4]^M,b=e[5]^S,g=e[14]^M,c=e[15]^S,s=e[24]^M,h=e[25]^S,E=e[34]^M,B=e[35]^S,R=e[44]^M,A=e[45]^S;M=a^(v<<1|_>>>31),S=m^(_<<1|v>>>31);let q=e[6]^M,P=e[7]^S,X=e[16]^M,j=e[17]^S,Z=e[26]^M,ot=e[27]^S,Q=e[36]^M,G=e[37]^S,st=e[46]^M,et=e[47]^S;M=d^(r<<1|n>>>31),S=x^(n<<1|r>>>31);let rt=e[8]^M,Wt=e[9]^S,at=e[18]^M,ft=e[19]^S,Vt=e[28]^M,dt=e[29]^S,pt=e[38]^M,ke=e[39]^S,gt=e[48]^M,ht=e[49]^S,Qt=C,mt=N,yt=I<<4|L>>>28,fr=L<<4|I>>>28,wt=U<<3|T>>>29,bt=T<<3|U>>>29,ar=H<<9|k>>>23,xt=k<<9|H>>>23,vt=D<<18|W>>>14,ur=W<<18|D>>>14,Et=$<<1|Y>>>31,_t=Y<<1|$>>>31,cr=K<<12|V>>>20,Bt=V<<12|K>>>20,St=J<<10|w>>>22,lr=w<<10|J>>>22,Mt=u<<13|o>>>19,Rt=o<<13|u>>>19,hr=l<<2|p>>>30,At=p<<2|l>>>30,Tt=b<<30|y>>>2,dr=y<<30|b>>>2,Ot=g<<6|c>>>26,It=c<<6|g>>>26,pr=h<<11|s>>>21,Lt=s<<11|h>>>21,kt=E<<15|B>>>17,gr=B<<15|E>>>17,Ft=A<<29|R>>>3,Nt=R<<29|A>>>3,mr=q<<28|P>>>4,qt=P<<28|q>>>4,Ut=j<<23|X>>>9,yr=X<<23|j>>>9,Ct=Z<<25|ot>>>7,Dt=ot<<25|Z>>>7,Fe=Q<<21|G>>>11,Ne=G<<21|Q>>>11,qe=et<<24|st>>>8,Ue=st<<24|et>>>8,Ce=rt<<27|Wt>>>5,De=Wt<<27|rt>>>5,He=at<<20|ft>>>12,Pe=ft<<20|at>>>12,je=dt<<7|Vt>>>25,ze=Vt<<7|dt>>>25,Ze=pt<<8|ke>>>24,We=ke<<8|pt>>>24,Ye=gt<<14|ht>>>18,Xe=ht<<14|gt>>>18;e[0]=Qt^~cr&pr,e[1]=mt^~Bt&Lt,e[10]=mr^~He&wt,e[11]=qt^~Pe&bt,e[20]=Et^~Ot&Ct,e[21]=_t^~It&Dt,e[30]=Ce^~yt&St,e[31]=De^~fr&lr,e[40]=Tt^~Ut&je,e[41]=dr^~yr&ze,e[2]=cr^~pr&Fe,e[3]=Bt^~Lt&Ne,e[12]=He^~wt&Mt,e[13]=Pe^~bt&Rt,e[22]=Ot^~Ct&Ze,e[23]=It^~Dt&We,e[32]=yt^~St&kt,e[33]=fr^~lr&gr,e[42]=Ut^~je&ar,e[43]=yr^~ze&xt,e[4]=pr^~Fe&Ye,e[5]=Lt^~Ne&Xe,e[14]=wt^~Mt&Ft,e[15]=bt^~Rt&Nt,e[24]=Ct^~Ze&vt,e[25]=Dt^~We&ur,e[34]=St^~kt&qe,e[35]=lr^~gr&Ue,e[44]=je^~ar&hr,e[45]=ze^~xt&At,e[6]=Fe^~Ye&Qt,e[7]=Ne^~Xe&mt,e[16]=Mt^~Ft&mr,e[17]=Rt^~Nt&qt,e[26]=Ze^~vt&Et,e[27]=We^~ur&_t,e[36]=kt^~qe&Ce,e[37]=gr^~Ue&De,e[46]=ar^~hr&Tt,e[47]=xt^~At&dr,e[8]=Ye^~Qt&cr,e[9]=Xe^~mt&Bt,e[18]=Ft^~mr&He,e[19]=Nt^~qt&Pe,e[28]=vt^~Et&Ot,e[29]=ur^~_t&It,e[38]=qe^~Ce&yt,e[39]=Ue^~De&fr,e[48]=hr^~Tt&Ut,e[49]=At^~dr&yr,e[0]^=Sf[t*2],e[1]^=Sf[t*2+1]}}});var Tf=nt((Id,Af)=>{F();var Sn=Rf();function Tr(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}Tr.prototype.initialize=function(e,t){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1};Tr.prototype.absorb=function(e){for(let t=0;t<e.length;++t)this.state[~~(this.count/4)]^=e[t]<<8*(this.count%4),this.count+=1,this.count===this.blockSize&&(Sn.p1600(this.state),this.count=0)};Tr.prototype.absorbLastFewBits=function(e){this.state[~~(this.count/4)]^=e<<8*(this.count%4),(e&128)!==0&&this.count===this.blockSize-1&&Sn.p1600(this.state),this.state[~~((this.blockSize-1)/4)]^=128<<8*((this.blockSize-1)%4),Sn.p1600(this.state),this.count=0,this.squeezing=!0};Tr.prototype.squeeze=function(e){this.squeezing||this.absorbLastFewBits(1);let t=z.Buffer.alloc(e);for(let r=0;r<e;++r)t[r]=this.state[~~(this.count/4)]>>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(Sn.p1600(this.state),this.count=0);return t};Tr.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing};Af.exports=Tr});var If=nt((kd,Of)=>{F();Of.exports=Bf()(Tf())});var Nf=nt(($i,Ff)=>{"use strict";F();var Ki=$i&&$i.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},$l=Ki(ns()),Kl=Ki(we()),Vl=Ki(If()),_e=Kl.default.Buffer;function Lf(e){return e=Ql(e),(0,Vl.default)("keccak256").update(e).digest()}function Ql(e){if(!_e.isBuffer(e))if(Array.isArray(e))e=_e.from(e);else if(typeof e=="string")Jl(e)?e=_e.from(kf(t0(e)),"hex"):e=_e.from(e);else if(typeof e=="number")e=r0(e);else if(e==null)e=_e.allocUnsafe(0);else if($l.default.isBN(e))e=e.toArrayLike(_e);else if(e.toArray)e=_e.from(e.toArray());else throw new Error("invalid type");return e}function Jl(e,t){return!(typeof e!="string"||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}function kf(e){if(typeof e!="string")throw new Error(`while padding to even, value must be string, is currently ${typeof e}, while padToEven.`);return e.length%2&&(e=`0${e}`),e}function t0(e){return typeof e!="string"?e:e0(e)?e.slice(2):e}function e0(e){if(typeof e!="string")throw new Error("value must be type 'string', is currently type "+typeof e+", while checking isHexPrefixed.");return e.slice(0,2)==="0x"}function r0(e){let t=n0(e);return _e.from(kf(t.slice(2)),"hex")}function n0(e){return`0x${e.toString(16)}`}typeof window<"u"&&(window.keccak256=Lf);Ff.exports=Lf});F();var Lo=ii(Nf(),1),ko=ii(we(),1);F();F();F();F();var Mn=BigInt(4294967295),qf=BigInt(32);function i0(e,t=!1){return t?{h:Number(e&Mn),l:Number(e>>qf&Mn)}:{h:Number(e>>qf&Mn)|0,l:Number(e&Mn)|0}}function Rn(e,t=!1){let r=e.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let f=0;f<r;f++){let{h:a,l:m}=i0(e[f],t);[n[f],i[f]]=[a,m]}return[n,i]}var o0=e=>e/2**32|0,s0=e=>e>>>0;function Uf(e,t,r,n){let i=o0(r),f=s0(r);e.setUint32(t,n?f:i,n),e.setUint32(t+4,n?i:f,n)}var Vi=(e,t,r)=>e>>>r,Qi=(e,t,r)=>e<<32-r|t>>>r,er=(e,t,r)=>e>>>r|t<<32-r,rr=(e,t,r)=>e<<32-r|t>>>r,Yr=(e,t,r)=>e<<64-r|t>>>r-32,Xr=(e,t,r)=>e>>>r-32|t<<64-r;function fe(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}var Cf=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),Df=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,Hf=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),Pf=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,jf=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),zf=(e,t,r,n,i,f)=>t+r+n+i+f+(e/2**32|0)|0;F();function An(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}var Tn=e=>e?`"${e}" `:"";function Yt(e,t=""){if(typeof e!="number")throw new TypeError(Tn(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(Tn(t)+"expected integer >= 0, got "+e);return e}function Yf(e,t=""){if(typeof e!="boolean")throw new TypeError(Tn(t)+"expected boolean, got type="+typeof e);return e}function Xt(e,t,r=""){if(An(e)&&(t===void 0||e.length===t))return e;t!==void 0&&Yt(t,"length");let n=An(e),i=t!==void 0?` of length ${t}`:"",f=n?`length=${e.length}`:`type=${typeof e}`,a=Tn(r)+"expected Uint8Array"+i+", got "+f;throw n?new RangeError(a):new TypeError(a)}function On(e){if(typeof e!="function"||typeof e.create!="function")throw new TypeError("expected hash wrapped by utils.createHasher");if(Yt(e.outputLen),Yt(e.blockLen),e.outputLen<1||e.blockLen<1)throw new Error("hash blockLen / outputLen must be >= 1")}var a0=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError((t==="object"?"":`"${t}" `)+"expected object, got type="+typeof e)},Zf=(e,t)=>{a0(e,t);let r=Object.getPrototypeOf(e);if(r!==Object.prototype&&r!==null)throw new TypeError(`"${t}" expected plain object`);if(Object.hasOwn(e,"__proto__"))throw new TypeError(`"${t}.__proto__" is not allowed`)};function de(e,t=!0){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function Or(e,t){Xt(e,void 0,"output");let r=t.outputLen;if(!(e.length>=r))throw new RangeError('"output" expected length >= '+r)}function Ji(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ae(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function In(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ne(e,t){return e<<32-t|e>>>t}var u0=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function c0(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function l0(e){for(let t=0;t<e.length;t++)e[t]=c0(e[t]);return e}var to=u0?e=>e:l0,Xf=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",h0=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Ln(e){if(Xt(e),Xf)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=h0[e[r]];return t}function Wf(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:void 0}function kn(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);if(Xf)try{return Uint8Array.fromHex(e)}catch(i){throw i instanceof SyntaxError?new RangeError(i.message):i}let t=e.length,r=t/2;if(t%2)throw new RangeError("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let i=0,f=0;i<r;i++,f+=2){let a=Wf(e.charCodeAt(f)),m=Wf(e.charCodeAt(f+1));if(a===void 0||m===void 0){let d=e[f]+e[f+1];throw new RangeError('hex string expected, got non-hex character "'+d+'" at index '+f)}n[i]=a*16+m}return n}function eo(...e){let t=0;for(let n=0;n<e.length;n++){let i=e[n];Xt(i),t+=i.length}let r=new Uint8Array(t);for(let n=0,i=0;n<e.length;n++){let f=e[n];r.set(f,i),i+=f.length}return r}function Gf(e,t,r="opts"){return Zf(e,"defaults"),t!==void 0&&Zf(t,r),Object.assign(Object.create(null),e,t)}function Gr(e,t={}){if(typeof e!="function")throw new TypeError('"hashCons" expected function, got type='+typeof e);t=Gf({},t,"info");let r=(i,f)=>e(f).update(i).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=i=>e(i),Object.assign(r,t),Object.freeze(r)}function $f(e=32){Yt(e,"bytesLength");let t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(e>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${e}`);return t.getRandomValues(new Uint8Array(e))}var $r=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function Kf(e,t,r){return e&t^~e&r}function Vf(e,t,r){return e&t^e&r^t&r}var Kr=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,r,n,i){this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(t),this.view=In(this.buffer)}update(t){de(this),Xt(t);let{view:r,buffer:n,blockLen:i}=this,f=t.length,a=!1;for(let m=0;m<f;){let d=Math.min(i-this.pos,f-m);if(d===i){let x=In(t);for(;i<=f-m;m+=i)this.process(x,m);a=!0;continue}n.set(m===0&&d===f?t:t.subarray(m,m+d),this.pos),this.pos+=d,m+=d,this.pos===i&&(this.process(r,0),this.pos=0,a=!0)}return this.length+=t.length,a&&this.roundClean(),this}digestInto(t){de(this),Or(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:f}=this,{pos:a}=this;r[a++]=128,r.fill(0,a),this.padOffset>i-a&&(this.process(n,0),r.fill(0)),Uf(n,i-8,this.length*8,f),this.process(n,0),this.roundClean();let m=t===r?n:In(t),d=this.outputLen,x=d/4,v=this.get();if(d%4||x>v.length)throw new Error("invalid outputLen");for(let _=0;_<x;_++)m.setUint32(4*_,v[_],f)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneIntoMeta(t){let{buffer:r,length:n,finished:i,destroyed:f,pos:a}=this;return t.destroyed=f,t.finished=i,t.length=n,t.pos=a,a&&t.buffer.set(r),t}clone(){return this._cloneInto()}},Qf=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var Jf=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);var d0=Uint32Array.from([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]),Be=new Uint32Array(64),ro=class extends Kr{A=0;B=0;C=0;D=0;E=0;F=0;G=0;H=0;constructor(t,r){super(64,t,8,!1),this.A=r[0]|0,this.B=r[1]|0,this.C=r[2]|0,this.D=r[3]|0,this.E=r[4]|0,this.F=r[5]|0,this.G=r[6]|0,this.H=r[7]|0}get(){let{A:t,B:r,C:n,D:i,E:f,F:a,G:m,H:d}=this;return[t,r,n,i,f,a,m,d]}set(t,r,n,i,f,a,m,d){this.A=t|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=f|0,this.F=a|0,this.G=m|0,this.H=d|0}_cloneInto(t){return(t||=new this.constructor).set(...this.get()),this._cloneIntoMeta(t)}process(t,r){for(let _=0;_<16;_++,r+=4)Be[_]=t.getUint32(r,!1);for(let _=16;_<64;_++){let M=Be[_-15],S=Be[_-2],C=ne(M,7)^ne(M,18)^M>>>3,N=ne(S,17)^ne(S,19)^S>>>10;Be[_]=N+Be[_-7]+C+Be[_-16]|0}let{A:n,B:i,C:f,D:a,E:m,F:d,G:x,H:v}=this;for(let _=0;_<64;_++){let M=ne(m,6)^ne(m,11)^ne(m,25),S=v+M+Kf(m,d,x)+d0[_]+Be[_]|0,N=(ne(n,2)^ne(n,13)^ne(n,22))+Vf(n,i,f)|0;v=x,x=d,d=m,m=a+S|0,a=f,f=i,i=n,n=S+N|0}n=n+this.A|0,i=i+this.B|0,f=f+this.C|0,a=a+this.D|0,m=m+this.E|0,d=d+this.F|0,x=x+this.G|0,v=v+this.H|0,this.set(n,i,f,a,m,d,x,v)}roundClean(){ae(Be)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),ae(this.buffer)}},no=class extends ro{constructor(){super(32,Qf)}};var ta=Rn(["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(e=>BigInt(e))),p0=ta[0],g0=ta[1],Se=new Uint32Array(80),Me=new Uint32Array(80),io=class extends Kr{Ah=0;Al=0;Bh=0;Bl=0;Ch=0;Cl=0;Dh=0;Dl=0;Eh=0;El=0;Fh=0;Fl=0;Gh=0;Gl=0;Hh=0;Hl=0;constructor(t,r){super(128,t,16,!1),this.Ah=r[0]|0,this.Al=r[1]|0,this.Bh=r[2]|0,this.Bl=r[3]|0,this.Ch=r[4]|0,this.Cl=r[5]|0,this.Dh=r[6]|0,this.Dl=r[7]|0,this.Eh=r[8]|0,this.El=r[9]|0,this.Fh=r[10]|0,this.Fl=r[11]|0,this.Gh=r[12]|0,this.Gl=r[13]|0,this.Hh=r[14]|0,this.Hl=r[15]|0}get(){let{Ah:t,Al:r,Bh:n,Bl:i,Ch:f,Cl:a,Dh:m,Dl:d,Eh:x,El:v,Fh:_,Fl:M,Gh:S,Gl:C,Hh:N,Hl:L}=this;return[t,r,n,i,f,a,m,d,x,v,_,M,S,C,N,L]}set(t,r,n,i,f,a,m,d,x,v,_,M,S,C,N,L){this.Ah=t|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=f|0,this.Cl=a|0,this.Dh=m|0,this.Dl=d|0,this.Eh=x|0,this.El=v|0,this.Fh=_|0,this.Fl=M|0,this.Gh=S|0,this.Gl=C|0,this.Hh=N|0,this.Hl=L|0}_cloneInto(t){return(t||=new this.constructor).set(...this.get()),this._cloneIntoMeta(t)}process(t,r){for(let T=0;T<16;T++,r+=4)Se[T]=t.getUint32(r),Me[T]=t.getUint32(r+=4);for(let T=16;T<80;T++){let k=Se[T-15]|0,H=Me[T-15]|0,D=er(k,H,1)^er(k,H,8)^Vi(k,H,7),W=rr(k,H,1)^rr(k,H,8)^Qi(k,H,7),$=Se[T-2]|0,Y=Me[T-2]|0,V=er($,Y,19)^Yr($,Y,61)^Vi($,Y,6),K=rr($,Y,19)^Xr($,Y,61)^Qi($,Y,6),J=Hf(W,K,Me[T-7],Me[T-16]),w=Pf(J,D,V,Se[T-7],Se[T-16]);Se[T]=w|0,Me[T]=J|0}let{Ah:n,Al:i,Bh:f,Bl:a,Ch:m,Cl:d,Dh:x,Dl:v,Eh:_,El:M,Fh:S,Fl:C,Gh:N,Gl:L,Hh:I,Hl:U}=this;for(let T=0;T<80;T++){let k=er(_,M,14)^er(_,M,18)^Yr(_,M,41),H=rr(_,M,14)^rr(_,M,18)^Xr(_,M,41),D=_&S^~_&N,W=M&C^~M&L,$=jf(U,H,W,g0[T],Me[T]),Y=zf($,I,k,D,p0[T],Se[T]),V=$|0,K=er(n,i,28)^Yr(n,i,34)^Yr(n,i,39),J=rr(n,i,28)^Xr(n,i,34)^Xr(n,i,39),w=n&f^n&m^f&m,o=i&a^i&d^a&d;I=N|0,U=L|0,N=S|0,L=C|0,S=_|0,C=M|0,{h:_,l:M}=fe(x|0,v|0,Y|0,V|0),x=m|0,v=d|0,m=f|0,d=a|0,f=n|0,a=i|0;let u=Cf(V,J,o);n=Df(u,Y,K,w),i=u|0}({h:n,l:i}=fe(this.Ah|0,this.Al|0,n|0,i|0)),{h:f,l:a}=fe(this.Bh|0,this.Bl|0,f|0,a|0),{h:m,l:d}=fe(this.Ch|0,this.Cl|0,m|0,d|0),{h:x,l:v}=fe(this.Dh|0,this.Dl|0,x|0,v|0),{h:_,l:M}=fe(this.Eh|0,this.El|0,_|0,M|0),{h:S,l:C}=fe(this.Fh|0,this.Fl|0,S|0,C|0),{h:N,l:L}=fe(this.Gh|0,this.Gl|0,N|0,L|0),{h:I,l:U}=fe(this.Hh|0,this.Hl|0,I|0,U|0),this.set(n,i,f,a,m,d,x,v,_,M,S,C,N,L,I,U)}roundClean(){ae(Se,Me)}destroy(){this.destroyed=!0,ae(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},oo=class extends io{constructor(){super(64,Jf)}};var ea=Gr(()=>new no,$r(1));var so=Gr(()=>new oo,$r(3));F();F();function Nn(e,t,r=()=>{}){if(!Array.isArray(e))throw new TypeError(`"${t}" expected array, got type=${typeof e}`);for(let n=0;n<e.length;n++)r(e[n],`${t}[${n}]`);return e}var ut=(e,t,r)=>Xt(e,t,r),fo=Yt;function na(e,t=""){if(typeof e!="string"){let r=t&&`"${t}" `;throw new TypeError(r+"expected string, got type="+typeof e)}return e}function Re(e,t="object"){if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(t==="object"?"expected valid options object":`"${t}" expected object, got type=${typeof e}`);return e}function nr(e,t){if(typeof e!="function")throw new TypeError(`"${t}" is invalid: expected function, got ${typeof e}`);return e}var Vr=Ln,re=(...e)=>eo(...e),Ir=e=>kn(e),Te=An,ir=e=>$f(e),Fn=BigInt(0),ra=BigInt(1),m0=e=>e?`"${e}" `:"";function $t(e,t=""){if(typeof e!="boolean")throw new TypeError(m0(t)+"expected boolean, got type="+typeof e);return e}function qn(e){if(typeof e=="bigint"){if(!Ae(e))throw new RangeError("positive bigint expected, got "+e)}else fo(e);return e}function pe(e,t=""){if(typeof e!="number"){let r=t&&`"${t}" `;throw new TypeError(r+"expected number, got type="+typeof e)}if(!Number.isSafeInteger(e)){let r=t&&`"${t}" `;throw new RangeError(r+"expected safe integer, got "+e)}}function Qr(e){let t=qn(e).toString(16);return t.length&1?"0"+t:t}function ia(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);return e===""?Fn:BigInt("0x"+e)}function ue(e){return ia(Ln(e))}function or(e){return ia(Ln(Jr(Xt(e)).reverse()))}function Un(e,t){if(Yt(t),t===0)throw new Error("zero output length is invalid");e=qn(e);let r=t*2,n=e.toString(16);if(n.length>r)throw new RangeError("number is too large");return kn(n.padStart(r,"0"))}function ao(e,t){return Un(e,t).reverse()}function Jr(e){return Uint8Array.from(ut(e))}function Ae(e){return typeof e=="bigint"&&Fn<=e}function uo(e,t,r){return Ae(e)&&Ae(t)&&Ae(r)&&t<=e&&e<r}function Lr(e,t,r,n){if(!uo(t,r,n))throw new RangeError("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function kr(e){if(e<Fn)throw new Error("expected non-negative bigint, got "+e);return e===Fn?0:e.toString(2).length}var tn=e=>(pe(e,"n"),(ra<<BigInt(e))-ra);function oa(e,t,r){if(Yt(e,"hashLen"),Yt(t,"qByteLen"),typeof r!="function")throw new TypeError("hmacFn must be a function");let n=L=>new Uint8Array(L),i=Uint8Array.of(),f=Uint8Array.of(0),a=Uint8Array.of(1),m=1e3,d=n(e),x=n(e),v=0,_=()=>{d.fill(1),x.fill(0),v=0},M=(...L)=>r(x,re(d,...L)),S=(L=i)=>{x=M(f,L),d=M(),L.length!==0&&(x=M(a,L),d=M())},C=()=>{if(v++>=m)throw new Error("drbg: tried max amount of iterations");let L=0,I=[];for(;L<t;){d=M();let U=d.slice();I.push(U),L+=d.length}return re(...I)};return(L,I)=>{_(),S(L);let U;for(;(U=I(C()))===void 0;)S();return _(),U}}function Kt(e,t={},r={},n="object"){Re(e,n),Re(t,"fields"),Re(r,"optFields");function i(a,m,d){let x=n==="object"?`param "${String(a)}"`:`"${n}.${String(a)}"`,v=e[a];if(!Object.hasOwn(e,a)&&(d?v!==void 0:m!=="function"))throw new TypeError(`${x} is invalid: expected own property`);if(d&&v===void 0)return;let _=typeof v;if(_!==m||v===null)throw new TypeError(`${x} is invalid: expected ${m}, got ${_}`)}let f=(a,m)=>Object.entries(a).forEach(([d,x])=>i(d,x,m));f(t,!1),f(r,!0)}F();var zt=BigInt(0),ct=BigInt(1),Oe=BigInt(2),aa=BigInt(3),co=BigInt(4),ua=BigInt(5),y0=BigInt(7),ca=BigInt(8),w0=BigInt(9),b0=BigInt(15),la=BigInt(16),x0=BigInt("0x10000000000000000");function Pt(e,t){if(t<=zt)throw new Error("mod: expected positive modulus, got "+t);let r=e%t;return r>=zt?r:t+r}function ha(e,t,r){if(r<=ct)throw new Error("pow: expected modulus > 1, got "+r);if(typeof t!="bigint")throw new TypeError("invalid exponent: expected bigint, got "+typeof t);if(t<zt)throw new Error("invalid exponent, negatives unsupported");if(t===zt)return ct;if(t===ct)return e;let n=e%r;if(n<zt&&(n+=r),t<x0){let m=ct;for(;t>zt;)t&ct&&(m=m*n%r),n=n*n%r,t>>=ct;return m}let i=[];for(;t>zt;)i.push(Number(t&b0)),t>>=co;let f=new Array(16);f[0]=ct,f[1]=n;for(let m=2;m<16;m++)f[m]=f[m-1]*n%r;let a=f[i[i.length-1]];for(let m=i.length-2;m>=0;m--){a=a*a%r,a=a*a%r,a=a*a%r,a=a*a%r;let d=i[m];d!==0&&(a=a*f[d]%r)}return a}function Ht(e,t,r){if(r<=ct)throw new Error("pow2: expected modulus > 1, got "+r);if(t<zt)throw new Error("pow2: expected non-negative exponent, got "+t);let n=e;for(;t-- >zt;)n*=n,n%=r;return n}function sa(e,t){if(e===zt)throw new Error("invert: expected non-zero number");if(t<=ct)throw new Error("invert: expected modulus > 1, got "+t);let r=Pt(e,t),n=t,i=zt,f=ct;for(;r!==zt;){let m=n/r,d=n-r*m,x=i-f*m;n=r,r=d,i=f,f=x}if(n!==ct)throw new Error("invert: does not exist");return Pt(i,t)}function da(e,t){if(t<=ct)throw new Error("invertCt: expected prime modulus > 1, got "+t);let r=Pt(e,t);if(r===zt)throw new Error("invertCt: expected non-zero number");let n=ha(r,t-Oe,t);if(Pt(r*n,t)!==ct)throw new Error("invertCt: does not exist");return n}function lo(e,t,r){let n=e;if(!n.eql(n.sqr(t),r))throw new Error("Cannot find square root")}function ho(e,t){if((e&ct)===zt)throw new Error(t+": expected odd modulus, got "+e)}function pa(e,t){let r=e,n=(r.ORDER+ct)/co,i=r.pow(t,n);return lo(r,i,t),i}function v0(e,t){let r=e,n=(r.ORDER-ua)/ca,i=r.mul(t,Oe),f=r.pow(i,n),a=r.mul(t,f),m=r.mul(r.mul(a,Oe),f),d=r.mul(a,r.sub(m,r.ONE));return lo(r,d,t),d}function E0(e){let t=Nr(e),r=ga(e),n=r(t,t.neg(t.ONE)),i=r(t,n),f=r(t,t.neg(n)),a=(e+y0)/la;return((m,d)=>{let x=m,v=x.pow(d,a),_=x.mul(v,n),M=x.mul(v,i),S=x.mul(v,f),C=x.eql(x.sqr(_),d),N=x.eql(x.sqr(M),d);v=x.cmov(v,_,C),_=x.cmov(S,M,N);let L=x.eql(x.sqr(_),d),I=x.cmov(v,_,L);return lo(x,I,d),I})}function ga(e){if(e<aa)throw new Error("sqrt is not defined for small field");ho(e,"tonelliShanks");let t=e-ct,r=0;for(;t%Oe===zt;)t/=Oe,r++;let n=Oe,i=Nr(e);for(;en(i,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return pa;let f=i.pow(n,t),a=(t+ct)/Oe;return function(d,x){let v=d;if(v.is0(x))return x;if(en(v,x)!==1)throw new Error("Cannot find square root");let _=r,M=v.mul(v.ONE,f),S=v.pow(x,t),C=v.pow(x,a);for(;!v.eql(S,v.ONE);){if(v.is0(S))throw new Error("Cannot find square root: probably non-prime P");let N=1,L=v.sqr(S);for(;!v.eql(L,v.ONE);)if(N++,L=v.sqr(L),N===_)throw new Error("Cannot find square root");let I=ct<<BigInt(_-N-1),U=v.pow(M,I);_=N,M=v.sqr(U),S=v.mul(S,M),C=v.mul(C,U)}return C}}function _0(e){return ho(e,"Fp.sqrt"),e%co===aa?pa:e%ca===ua?v0:e%la===w0?E0(e):ga(e)}var ma=(e,t)=>(Pt(e,t)&ct)===ct,B0=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Fr(e){if(Re(e,"field"),typeof e.ORDER!="bigint")throw new TypeError('param "ORDER" is invalid: expected bigint, got '+typeof e.ORDER);pe(e.BYTES,"BYTES"),pe(e.BITS,"BITS");for(let t of B0)nr(e[t],"field."+t);if(e.BYTES<1||e.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(e.ORDER<=ct)throw new Error("invalid field: expected ORDER > 1, got "+e.ORDER);return e}function Dn(e,t,r=!1){Fr(e),Nn(t,"nums"),$t(r,"passZero");let n=e,i=new Array(t.length).fill(r?n.ZERO:void 0),f=t.reduce((m,d,x)=>n.is0(d)?m:(i[x]=m,n.mul(m,d)),n.ONE),a=n.inv(f);return t.reduceRight((m,d,x)=>n.is0(d)?m:(i[x]=n.mul(m,i[x]),n.mul(m,d)),a),i}function en(e,t){Fr(e);let r=e;ho(r.ORDER,"FpLegendre");let n=(r.ORDER-ct)/Oe,i=r.pow(t,n),f=r.eql(i,r.ONE),a=r.eql(i,r.ZERO),m=r.eql(i,r.neg(r.ONE));if(!f&&!a&&!m)throw new Error("invalid Legendre symbol result");return f?1:a?0:-1}function S0(e,t){if(t!==void 0&&fo(t),e<=zt)throw new Error("invalid n length: expected positive n, got "+e);if(t!==void 0&&t<1)throw new Error("invalid n length: expected positive bit length, got "+t);let r=kr(e);if(t!==void 0&&t<r)throw new Error(`invalid n length: expected nBitLength (${t}) >= bitLen(n) (${r})`);let n=t!==void 0?t:r,i=Math.ceil(n/8);return{nBitLength:n,nByteLength:i}}var fa=new WeakMap,Cn=class{ORDER;BITS;BYTES;isLE;ZERO=zt;ONE=ct;_lengths;_mod;constructor(t,r={}){if(t<=ct)throw new Error("invalid field: expected ORDER > 1, got "+t);let n;this.isLE=!1,r!=null&&typeof r=="object"&&(typeof r.BITS=="number"&&(n=r.BITS),typeof r.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:r.sqrt,enumerable:!0}),typeof r.isLE=="boolean"&&(this.isLE=r.isLE),r.allowedLengths&&(this._lengths=Object.freeze(r.allowedLengths.slice())),typeof r.modFromBytes=="boolean"&&(this._mod=r.modFromBytes));let{nBitLength:i,nByteLength:f}=S0(t,n);if(f>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=i,this.BYTES=f,Object.freeze(this)}create(t){return Pt(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof t);return zt<=t&&t<this.ORDER}is0(t){return t===zt}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&ct)===ct}neg(t){return Pt(-t,this.ORDER)}eql(t,r){return t===r}sqr(t){return Pt(t*t,this.ORDER)}add(t,r){return Pt(t+r,this.ORDER)}sub(t,r){return Pt(t-r,this.ORDER)}mul(t,r){return Pt(t*r,this.ORDER)}pow(t,r){return ha(t,r,this.ORDER)}div(t,r){return Pt(t*sa(r,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,r){return t+r}subN(t,r){return t-r}mulN(t,r){return t*r}inv(t){return sa(t,this.ORDER)}sqrt(t){let r=fa.get(this);return r||fa.set(this,r=_0(this.ORDER)),r(this,t)}toBytes(t){return this.isLE?ao(t,this.BYTES):Un(t,this.BYTES)}fromBytes(t,r=!1){ut(t);let{_lengths:n,BYTES:i,isLE:f,ORDER:a,_mod:m}=this;if(n){if(t.length<1||!n.includes(t.length)||t.length>i)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+t.length);let x=new Uint8Array(i);x.set(t,f?0:x.length-t.length),t=x}if(t.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);let d=f?or(t):ue(t);if(m&&(d=Pt(d,a)),!r&&!this.isValid(d))throw new Error("invalid field element: outside of range 0..ORDER");return d}invertBatch(t){return Dn(this,t,!0)}cmov(t,r,n){return $t(n,"condition"),n?r:t}};function Nr(e,t={}){return Object.freeze(Cn.prototype),new Cn(e,t)}function ya(e){if(typeof e!="bigint")throw new Error("field order must be bigint");if(e<=ct)throw new Error("field order must be greater than 1");let t=kr(e-ct);return Math.ceil(t/8)}function Hn(e){let t=ya(e);return t+Math.ceil(t/2)}function Pn(e,t,r=!1){ut(e);let n=e.length,i=ya(t),f=Math.max(Hn(t),16);if(n<f||n>1024)throw new Error("expected "+f+"-1024 bytes of input, got "+n);let a=r?or(e):ue(e),m=Pt(a,t-ct)+ct;return r?ao(m,i):Un(m,i)}var mo=BigInt(0),rn=BigInt(1),M0=BigInt(4),po=16,wa=128,R0=5,ba=2**31;function Ie(e){let t=e;if(typeof t!="function")throw new TypeError('"Point" expected constructor, got type='+typeof e);nr(t.fromAffine,"Point.fromAffine"),nr(t.fromBytes,"Point.fromBytes"),nr(t.fromHex,"Point.fromHex"),Re(t.BASE,"Point.BASE"),Re(t.ZERO,"Point.ZERO"),Fr(t.Fp),Fr(t.Fn)}function jn(e,t){Ie(e),va(t,e);let r=Dn(e.Fp,t.map(n=>n.Z));return t.map((n,i)=>e.fromAffine(n.toAffine(r[i])))}function A0(e,t,r=1){if(!Number.isSafeInteger(e)||e<r||e>t)throw new Error("invalid window size, expected ["+r+".."+t+"], got W="+e)}function T0(e,t){let r=e*(4*t+128);if(r>ba)throw new Error("invalid window size: table would need ~"+Math.ceil(r/2**20)+" MiB, max "+ba/2**20+" MiB")}function yo(e,t){if(e!==void 0){nr(e,"randomBytes");try{let r=e(t);if(!Te(r)||r.length!==t)return}catch{return}return e}}function va(e,t){Nn(e,"points"),e.forEach((r,n)=>{if(!(r instanceof t))throw new Error("invalid point at index "+n)})}function O0(e,t,r){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,i)=>{if(!(r===void 0?t.isValid(n):Ae(n)&&n<r))throw new Error("invalid scalar at index "+i)})}var Ea=new WeakMap;function go(e){return Ea.get(e)||1}function I0(e,t){let r=e.double(),n=[e];for(let i=1;i<t;i++)n.push(n[i-1].add(r));return n}function L0(e,t){let r=2**t,n=r/2,i=BigInt(r-1),f=[];for(;e>mo;){let a=0;e&rn&&(a=Number(e&i),a>=n&&(a-=r),e-=BigInt(a)),f.push(a),e>>=rn}return f}function k0(e,t,r){let n=2**t,i=n/2,f=BigInt(n-1),a=BigInt(t),m=[];for(let d=0;d<r;d++){let x=Number(e&f);e>>=a,x>i&&(x-=n,e+=rn),m.push(x)}if(e!==mo)throw new Error("invalid wnaf");return m}function F0(e,t,r){let n=0;for(let f of r)n=Math.max(n,f.length);let i=e;for(let f=n-1;f>=0;f--){f!==n-1&&(i=i.double());for(let a=0;a<r.length;a++){let m=r[a][f];if(m){let d=t[a][Math.abs(m)-1>>1];i=i.add(m<0?d.negate():d)}}}return i}var qr=class{Point;BASE;ZERO;randomBytes;wnafPrecomputes=new WeakMap;baseCanBeBlinded;bits;constructor(t,r){Ie(t),this.randomBytes=yo(r,po),this.Point=t,this.BASE=t.BASE,this.ZERO=t.ZERO,this.bits=t.Fn.BITS}buildWnafTable(t,r,n){let i=Math.ceil(n/r)+1,f=2**(r-1),a=[],m=t;for(let d=0;d<i;d++){let x=m;for(let v=0;v<f;v++)a.push(x),x=x.add(m);m=a[a.length-1].double()}return{W:r,bits:n,windows:i,comp:a}}wnafCachedCT(t,r){let{W:n,windows:i,comp:f}=t,a=2**(n-1),m=k0(r,n,i),d=this.ZERO,x=this.BASE;for(let v=0;v<i;v++){let _=m[v],M=v*a,S=Math.abs(_)-1,C=f[M];for(let L=1;L<a;L++)C=L===S?f[M+L]:C;let N=C.negate();_===0?x=x.add(f[M]):d=d.add(_<0?N:C)}return{p:d,f:x}}getWnafPrecomputes(t,r,n,i){let f=this.wnafPrecomputes.get(r),a=f?.find(m=>m.W===t&&m.bits===n);return a||(a=this.buildWnafTable(r,t,n),typeof i=="function"&&(a={...a,comp:i(a.comp)}),f||(f=[],this.wnafPrecomputes.set(r,f)),f.push(a)),a}assertPoint(t){if(!(t instanceof this.Point))throw new TypeError('"point" expected Point instance, got type='+typeof t)}validateMulInput(t,r){if(this.assertPoint(t),!uo(r,rn,this.Point.Fn.ORDER))throw new Error("invalid scalar")}runCT(t,r,n,i){let f=go(t);return f===1?this.fixedWindowCT(t,r,n):this.wnafCachedCT(this.getWnafPrecomputes(f,t,n,i),r)}mulCT(t,r,n){return this.validateMulInput(t,r),this.runCT(t,r,this.bits,n)}mulCTBlinded(t,r,n){if(this.validateMulInput(t,r),this.randomBytes===void 0)throw new Error("randomBytes is required for scalar blinding");let i=this.Point.Fn.BITS+wa,f=this.randomBytes(po);if(!Te(f)||f.length!==po)throw new Error("randomBytes returned invalid byte array");f[0]=f[0]&63|128;let a=r+ue(f)*this.Point.Fn.ORDER;return this.runCT(t,a,i,n)}fixedWindowCT(t,r,n){let i=R0,f=1<<i,a=tn(i),m=new Array(f);m[0]=this.ZERO;for(let v=1;v<f;v++)m[v]=m[v-1].add(t);let d=Math.ceil(n/i),x=this.ZERO;for(let v=d-1;v>=0;v--){if(v!==d-1)for(let S=0;S<i;S++)x=x.double();let _=Number(r>>BigInt(v*i)&a),M=m[0];for(let S=1;S<f;S++)M=S===_?m[S]:M;x=x.add(M)}return{p:x,f:x}}shouldBlind(t,r){return this.randomBytes===void 0?!1:r===rn?!0:t!==this.BASE?!1:(this.baseCanBeBlinded===void 0&&(this.baseCanBeBlinded=this.mulUnsafe(this.BASE,this.Point.Fn.ORDER).is0()),this.baseCanBeBlinded)}mulSecret(t,r,n,i){return this.shouldBlind(t,n)?this.mulCTBlinded(t,r,i):this.mulCT(t,r,i)}mulUnsafe(t,r,n){if(this.assertPoint(t),!Ae(r))throw new Error("invalid scalar");let i=go(t);if(i===1||r>=this.Point.Fn.ORDER)return zn(this.Point,[t],[r],!0);let f=this.getWnafPrecomputes(i,t,this.bits,n);return this.wnafCachedCT(f,r).p}setWindowSize(t,r){this.assertPoint(t),A0(r,this.bits);let n=Math.ceil((this.bits+wa)/r)+1;T0(n*2**(r-1),this.Point.Fp.BYTES),Ea.set(t,r),this.wnafPrecomputes.delete(t)}hasWindowSize(t){return go(t)!==1}};function zn(e,t,r,n=!1){if(Ie(e),va(t,e),$t(n,"allowOversized"),O0(r,e.Fn,n?e.Fn.ORDER**M0:void 0),t.length!==r.length)throw new Error("arrays of points and scalars must have equal length");let i=t.map(a=>I0(a,4)),f=r.map(a=>L0(a,4));return F0(e.ZERO,i,f)}function xa(e,t,r){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Fr(t),t}else return Nr(e,{isLE:r})}function Zn(e,t,r={},n){if(e!=="weierstrass"&&e!=="edwards")throw new Error('expected curve type "weierstrass" or "edwards"');if(n===void 0&&(n=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);Kt(r);for(let d of["p","n","h"]){let x=t[d];if(!(Ae(x)&&x!==mo))throw new Error(`CURVE.${d} must be positive bigint`)}let i=xa(t.p,r.Fp,n),f=xa(t.n,r.Fn,n),m=["Gx","Gy","a",e==="weierstrass"?"b":"d"];for(let d of m)if(!i.isValid(t[d]))throw new Error(`CURVE.${d} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:i,Fn:f}}function Wn(e,t){return function(n){let i=e(n);return{secretKey:i,publicKey:t(i)}}}F();var Yn=BigInt(0),Xn=BigInt(1),Gn=BigInt(2),N0=BigInt(4),_a=BigInt(8);function q0(e,t,r,n){let i=e.sqr(r),f=e.sqr(n),a=e.add(e.mul(t.a,i),f),m=e.add(e.ONE,e.mul(t.d,e.mul(i,f)));return e.eql(a,m)}function Ba(e,t={}){Kt(t,{},{},"extraOpts");let r=t,n=Zn("edwards",e,r,r.FpFnLE),{Fp:i,Fn:f}=n,a=n.CURVE,{h:m}=a;if(en(i,a.a)!==1)throw new Error("edwards: CURVE.a must be a square in Fp for complete addition formulas");if(en(i,a.d)!==-1)throw new Error("edwards: CURVE.d must be a non-square in Fp for complete addition formulas");Kt(r,{},{uvRatio:"function",randomBytes:"function"});let d=r.randomBytes===void 0?ir:r.randomBytes,x=Gn<<BigInt(i.BYTES*8)-Xn;function v(U){if(!i.isOdd)throw new Error("Field does not have .isOdd()");return i.isOdd(U)}let _=r.uvRatio===void 0?(U,T)=>{try{return{isValid:!0,value:i.sqrt(i.div(U,T))}}catch{return{isValid:!1,value:Yn}}}:r.uvRatio;if(!q0(i,a,a.Gx,a.Gy))throw new Error("bad curve params: generator point");let M=i.eql(a.a,i.neg(i.ONE))?U=>i.neg(U):i.eql(a.a,i.ONE)?U=>U:U=>i.mul(a.a,U);function S(U,T,k=!1){let H=k?Xn:Yn;return Lr("coordinate "+U,T,H,x),T}function C(U){if(!(U instanceof N))throw new Error("EdwardsPoint expected")}class N{static BASE=new N(a.Gx,a.Gy,i.ONE,i.mul(a.Gx,a.Gy));static ZERO=new N(i.ZERO,i.ONE,i.ONE,i.ZERO);static Fp=i;static Fn=f;X;Y;Z;T;constructor(T,k,H,D){this.X=S("x",T),this.Y=S("y",k),this.Z=S("z",H,!0),this.T=S("t",D),Object.freeze(this)}static CURVE(){return a}static fromAffine(T){if(T instanceof N)throw new Error("extended point not allowed");let{x:k,y:H}=T||{};return S("x",k),S("y",H),new N(k,H,i.ONE,i.mul(k,H))}static fromBytes(T,k=!1){let H=i.BYTES,{a:D,d:W}=a;T=Jr(ut(T,H,"point")),$t(k,"zip215");let $=Jr(T),Y=T[H-1];$[H-1]=Y&-129;let V=or($),K=k?x:i.ORDER;Lr("point.y",V,Yn,K);let J=i.sqr(V),w=i.sub(J,i.ONE),o=i.sub(i.mulN(W,J),D),{isValid:u,value:l}=_(w,o);if(!u)throw new Error("bad point: invalid y coordinate");let p=v(l),y=(Y&128)!==0;if(!k&&i.is0(l)&&y)throw new Error("bad point: x=0 and x_0=1");return y!==p&&(l=i.neg(l)),N.fromAffine({x:l,y:V})}static fromHex(T,k=!1){return N.fromBytes(Ir(T),k)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(T=6,k=!0){return I.setWindowSize(this,T),k||this.multiply(Gn),this}assertValidity(){let T=this,{a:k,d:H}=a;if(T.is0())throw new Error("bad point: ZERO");let{X:D,Y:W,Z:$,T:Y}=T,V=i.sqr(D),K=i.sqr(W),J=i.sqr($),w=i.sqr(J),o=i.mul(V,k),u=i.mul(i.add(o,K),J),l=i.add(w,i.mul(H,i.mul(V,K)));if(!i.eql(u,l))throw new Error("bad point: equation left != right (1)");let p=i.mul(D,W),y=i.mul($,Y);if(!i.eql(p,y))throw new Error("bad point: equation left != right (2)")}equals(T){C(T);let{X:k,Y:H,Z:D}=this,{X:W,Y:$,Z:Y}=T,V=i.mul(k,Y),K=i.mul(W,D),J=i.mul(H,Y),w=i.mul($,D);return i.eql(V,K)&&i.eql(J,w)}is0(){return this.equals(N.ZERO)}negate(){return new N(i.neg(this.X),this.Y,this.Z,i.neg(this.T))}double(){let{X:T,Y:k,Z:H}=this,D=i.sqr(T),W=i.sqr(k),$=i.mul(i.sqr(H),Gn),Y=M(D),V=i.addN(T,k),K=i.sub(i.subN(i.sqr(V),D),W),J=i.addN(Y,W),w=i.subN(J,$),o=i.subN(Y,W),u=i.mul(K,w),l=i.mul(J,o),p=i.mul(K,o),y=i.mul(w,J);return new N(u,l,y,p)}add(T){C(T);let{d:k}=a,{X:H,Y:D,Z:W,T:$}=this,{X:Y,Y:V,Z:K,T:J}=T,w=i.mul(H,Y),o=i.mul(D,V),u=i.mul(i.mulN($,k),J),l=i.mul(W,K),p=i.sub(i.subN(i.mulN(i.addN(H,D),i.addN(Y,V)),w),o),y=i.subN(l,u),b=i.addN(l,u),g=i.sub(o,M(w)),c=i.mul(p,y),s=i.mul(b,g),h=i.mul(p,g),E=i.mul(y,b);return new N(c,s,E,h)}subtract(T){return C(T),this.add(T.negate())}multiply(T){if(!f.isValidNot0(T))throw new RangeError("invalid scalar: expected 1 <= sc < curve.n");let{p:k,f:H}=I.mulSecret(this,T,m,L);return L([k,H])[0]}multiplyUnsafe(T){if(!f.isValid(T))throw new RangeError("invalid scalar: expected 0 <= sc < curve.n");return T===Yn?N.ZERO:this.is0()||T===Xn?this:I.mulUnsafe(this,T,L)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return I.mulUnsafe(this,a.n).is0()}toAffine(T){let k=this,H=T;if(H!=null&&typeof H!="bigint")throw new TypeError('"invertedZ" expected bigint, got type='+typeof H);let{X:D,Y:W,Z:$}=k,Y=k.is0();H==null&&(H=Y?i.create(_a):i.inv($));let V=i.mul(D,H),K=i.mul(W,H),J=i.mul($,H);if(Y)return{x:i.ZERO,y:i.ONE};if(!i.eql(J,i.ONE))throw new Error("invZ was invalid");return{x:V,y:K}}clearCofactor(){return m===Xn?this:m===Gn?this.double():m===N0?this.double().double():m===_a?this.double().double().double():this.multiplyUnsafe(m)}toBytes(){let{x:T,y:k}=this.toAffine(),H=i.toBytes(k);return H[H.length-1]|=v(T)?128:0,H}toHex(){return Vr(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let L=U=>jn(N,U),I=new qr(N,d);return I.bits>=6&&N.BASE.precompute(6),Object.freeze(N.prototype),Object.freeze(N),N}function Sa(e,t,r={}){if(Ie(e),typeof t!="function")throw new Error('"hash" function param is required');let n=t,i=r;Kt(i,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",zip215:"boolean",mapToCurve:"function",toMontgomery:"function",toMontgomerySecret:"function"});let{prehash:f}=i,{BASE:a,Fp:m,Fn:d}=e,x=n.outputLen,v=2*m.BYTES;if(x!==void 0&&(pe(x,"hash.outputLen"),x!==v))throw new Error(`hash.outputLen must be ${v}, got ${x}`);let _=i.randomBytes===void 0?ir:i.randomBytes,M=i.toMontgomery,S=i.toMontgomerySecret,C=i.adjustScalarBytes===void 0?o=>o:i.adjustScalarBytes,N=i.domain===void 0?(o,u,l)=>{if($t(l,"phflag"),u.length||l)throw new Error("Contexts/pre-hash are not supported");return o}:i.domain;function L(o){return d.create(or(o))}function I(o){let u=Y.secretKey;ut(o,Y.secretKey,"secretKey");let l=ut(n(o),2*u,"hashedSecretKey"),p=C(l.slice(0,u)),y=l.slice(u,2*u),b=L(p);return{head:p,prefix:y,scalar:b}}function U(o){let{head:u,prefix:l,scalar:p}=I(o),y=a.multiply(p),b=y.toBytes();return{head:u,prefix:l,scalar:p,point:y,pointBytes:b}}function T(o){return U(o).pointBytes}function k(o=Uint8Array.of(),...u){let l=re(...u);return L(n(N(l,ut(o,void 0,"context"),!!f)))}function H(o,u,l={}){Kt(l,{},{},"options"),o=Jr(ut(o,void 0,"message")),f&&(o=f(o));let{prefix:p,scalar:y,pointBytes:b}=U(u),g=k(l.context,p,o),c=a.multiply(g).toBytes(),s=k(l.context,c,b,o),h=d.create(g+s*y);if(!d.isValid(h))throw new Error("sign failed: invalid s");let E=re(c,d.toBytes(h));return ut(E,Y.signature,"result")}let D={zip215:i.zip215};function W(o,u,l,p=D){Kt(p);let{context:y}=p,b=p.zip215===void 0?!!D.zip215:p.zip215,g=Y.signature;o=ut(o,g,"signature"),u=ut(u,void 0,"message"),l=ut(l,Y.publicKey,"publicKey"),b!==void 0&&$t(b,"zip215"),f&&(u=f(u));let c=g/2,s=o.subarray(0,c),h=or(o.subarray(c,g)),E,B,R;try{E=e.fromBytes(l,b),B=e.fromBytes(s,b),R=a.multiplyUnsafe(h)}catch{return!1}if(!b&&E.isSmallOrder())return!1;let A=k(y,s,l,u);return B.add(E.multiplyUnsafe(A)).subtract(R).clearCofactor().is0()}let $=m.BYTES,Y={secretKey:$,publicKey:$,signature:2*$,seed:$};function V(o){return o=o===void 0?_(Y.seed):o,ut(o,Y.seed,"seed")}function K(o){return Te(o)&&o.length===Y.secretKey}function J(o,u){try{return!!e.fromBytes(o,u===void 0?D.zip215:u)}catch{return!1}}let w={getExtendedPublicKey:U,randomSecretKey:V,isValidSecretKey:K,isValidPublicKey:J,toMontgomery(o){if(M===void 0)throw new Error("Montgomery conversion is not supported for this curve");return M(e.fromBytes(o))},toMontgomerySecret(o){if(S===void 0)throw new Error("Montgomery conversion is not supported for this curve");return S(o)}};return Object.freeze(Y),Object.freeze(w),Object.freeze({keygen:Wn(V,T),getPublicKey:T,sign:H,verify:W,utils:w,Point:e,lengths:Y})}var wo=BigInt(1),Ma=BigInt(2);var U0=BigInt(5),C0=BigInt(8),bo=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),D0={p:bo,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:C0,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function H0(e){let t=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),f=bo,m=e*e%f*e%f,d=Ht(m,Ma,f)*m%f,x=Ht(d,wo,f)*e%f,v=Ht(x,U0,f)*x%f,_=Ht(v,t,f)*v%f,M=Ht(_,r,f)*_%f,S=Ht(M,n,f)*M%f,C=Ht(S,i,f)*S%f,N=Ht(C,i,f)*S%f,L=Ht(N,t,f)*v%f;return{pow_p_5_8:Ht(L,Ma,f)*e%f,b2:m}}function Ta(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}var Ra=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function P0(e,t){let r=bo,n=Pt(t*t*t,r),i=Pt(n*n*t,r),f=H0(e*i).pow_p_5_8,a=Pt(e*n*f,r),m=Pt(t*a*a,r),d=a,x=Pt(a*Ra,r),v=m===e,_=m===Pt(-e,r),M=m===Pt(-e*Ra,r);return v&&(a=d),(_||M)&&(a=x),ma(a,r)&&(a=Pt(-a,r)),{isValid:v||_,value:a}}var xo=Ba(D0,{uvRatio:P0}),Aa=xo.Fp;function j0(e){let{y:t}=e;return Aa.toBytes(Aa.div(wo+t,wo-t))}function z0(e){let t=xo.Fp.BYTES;return Xt(e,t),Ta(so(e.subarray(0,t))).subarray(0,t)}function Z0(e){return Sa(xo,so,Object.assign({adjustScalarBytes:Ta,toMontgomery:j0,toMontgomerySecret:z0,zip215:!0},e))}var W0=Z0({});F();F();F();var $n=class{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(t,r){if(On(t),Xt(r,void 0,"key"),this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("expected Hash instance");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?t.create().update(r).digest():r);for(let f=0;f<i.length;f++)i[f]^=54;this.iHash.update(i),this.oHash=t.create();for(let f=0;f<i.length;f++)i[f]^=106;this.oHash.update(i),ae(i)}update(t){return de(this),this.iHash.update(t),this}digestInto(t){de(this),Or(t,this),this.finished=!0;let r=t.subarray(0,this.outputLen);this.iHash.digestInto(r),this.oHash.update(r),this.oHash.digestInto(r),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});let{oHash:r,iHash:n,finished:i,destroyed:f,blockLen:a,outputLen:m,canXOF:d}=this;return t=t,t.finished=i,t.destroyed=f,t.blockLen=a,t.outputLen=m,t.canXOF=d,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Oa=(()=>{let e=((t,r,n)=>new $n(t,r).update(n).digest());return e.create=(t,r)=>new $n(t,r),e})();F();var Y0=BigInt(0),vo=class extends Error{constructor(t=""){super(t)}},ge={Err:vo,_tlv:{encode:(e,t)=>{let{Err:r}=ge;if(pe(e,"tag"),e<0||e>255)throw new r("tlv.encode: wrong tag");if(na(t,"data"),t.length&1)throw new r("tlv.encode: unpadded data");let n=t.length/2,i=Qr(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let f=n>127?Qr(i.length/2|128):"";return Qr(e)+f+i+t},decode(e,t){let{Err:r}=ge;t=ut(t,void 0,"DER data");let n=0;if(e<0||e>255)throw new r("tlv.decode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");let i=t[n++],f=!!(i&128),a=0;if(!f)a=i;else{let d=i&127;if(!d)throw new r("tlv.decode(long): indefinite length not supported");if(d>4)throw new r("tlv.decode(long): byte length is too big");let x=t.subarray(n,n+d);if(x.length!==d)throw new r("tlv.decode: length bytes not complete");if(x[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let v of x)a=a<<8|v;if(n+=d,a<128)throw new r("tlv.decode(long): not minimal encoding")}let m=t.subarray(n,n+a);if(m.length!==a)throw new r("tlv.decode: wrong value length");return{v:m,l:t.subarray(n+a)}}},_int:{encode(e){let{Err:t}=ge;if(qn(e),e<Y0)throw new t("integer: negative integers are not allowed");let r=Qr(e);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=ge;if(e.length<1)throw new t("invalid signature integer: empty");if(e[0]&128)throw new t("invalid signature integer: negative");if(e.length>1&&e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return ue(e)}},toSig(e,t){let{Err:r,_int:n,_tlv:i}=ge;if(t!==void 0&&(pe(t,"maxScalarBytes"),t<1))throw new r("invalid signature: maxScalarBytes must be positive");let f=ut(e,void 0,"signature"),{v:a,l:m}=i.decode(48,f);if(m.length)throw new r("invalid signature: left bytes after parsing");let{v:d,l:x}=i.decode(2,a),{v,l:_}=i.decode(2,x);if(_.length)throw new r("invalid signature: left bytes after parsing");if(t!==void 0&&(d.length>t||v.length>t))throw new r("invalid signature: integer too large");return{r:n.decode(d),s:n.decode(v)}},hexFromSig(e){let{_tlv:t,_int:r}=ge;Kt(e,{r:"bigint",s:"bigint"},{},"sig");let n=t.encode(2,r.encode(e.r)),i=t.encode(2,r.encode(e.s)),f=n+i;return t.encode(48,f)}},Kn=(Object.freeze(ge._tlv),Object.freeze(ge._int),Object.freeze(ge));var Ia=(e,t)=>(e+(e>=0?t:-t)/La)/t;function X0(e,t,r){Lr("scalar",e,me,r);let[[n,i],[f,a]]=t,m=Ia(a*e,r),d=Ia(-i*e,r),x=e-m*n-d*f,v=-m*i-d*a,_=x<me,M=v<me;_&&(x=-x),M&&(v=-v);let S=tn(Math.ceil(kr(r)/2))+sr;if(x<me||x>=S||v<me||v>=S)throw new Error("splitScalar (endomorphism): failed for k");return{k1neg:_,k1:x,k2neg:M,k2:v}}function Bo(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Eo(e,t){Kt(e);let r={};for(let n of Object.keys(t))r[n]=e[n]===void 0?t[n]:e[n];return $t(r.lowS,"lowS"),$t(r.prehash,"prehash"),r.format!==void 0&&Bo(r.format),r}var me=BigInt(0),sr=BigInt(1),La=BigInt(2),_o=BigInt(3),G0=BigInt(4);function ka(e,t={}){let r=Zn("weierstrass",e,t),n=r.Fp,i=r.Fn,f=r.CURVE,{h:a,n:m}=f;Kt(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",randomBytes:"function"});let{endo:d,allowInfinityPoint:x,clearCofactor:v,isTorsionFree:_,fromBytes:M,toBytes:S}=t,C=t.randomBytes===void 0?ir:t.randomBytes;if(d&&(!n.is0(f.a)||typeof d.beta!="bigint"||!Array.isArray(d.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let N=d?{beta:d.beta,basises:d.basises.map(g=>[...g])}:void 0,L=Na(n,i);function I(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function U(g,c,s){if(c.is0()){if(!x)throw new Error("bad point: ZERO");return Uint8Array.of(0)}let{x:h,y:E}=c.toAffine(),B=n.toBytes(h);if($t(s,"isCompressed"),s){I();let R=!n.isOdd(E);return re(Fa(R),B)}else return re(Uint8Array.of(4),B,n.toBytes(E))}function T(g){ut(g,void 0,"Point");let{publicKey:c,publicKeyUncompressed:s}=L,h=g.length,E=g[0],B=g.subarray(1);if(x&&h===1&&E===0)return{x:n.ZERO,y:n.ZERO};if(h===c&&(E===2||E===3)){let R=n.fromBytes(B);if(!n.isValid(R))throw new Error("bad point: is not on curve, wrong x");let A=$(R),q;try{q=n.sqrt(A)}catch(j){let Z=j instanceof Error?": "+j.message:"";throw new Error("bad point: is not on curve, sqrt error"+Z)}I();let P=n.isOdd(q);return(E&1)===1!==P&&(q=n.neg(q)),{x:R,y:q}}else if(h===s&&E===4){let R=n.BYTES,A=n.fromBytes(B.subarray(0,R)),q=n.fromBytes(B.subarray(R,R*2));if(!Y(A,q))throw new Error("bad point: is not on curve");return{x:A,y:q}}else throw new Error(`bad point: got length ${h}, expected compressed=${c} or uncompressed=${s}`)}let k=S===void 0?U:S,H=M===void 0?T:M,D=n.mul(f.b,_o),W=n.is0(f.a)?g=>n.ZERO:g=>n.mul(f.a,g);function $(g){let c=n.sqr(g),s=n.mul(c,g);return n.add(n.add(s,n.mul(g,f.a)),f.b)}function Y(g,c){let s=n.sqr(c),h=$(g);return n.eql(s,h)}if(!Y(f.Gx,f.Gy))throw new Error("bad curve params: generator point");let V=n.mul(n.pow(f.a,_o),G0),K=n.mul(n.sqr(f.b),BigInt(27));if(n.is0(n.add(V,K)))throw new Error("bad curve params: a or b");function J(g,c,s=!1){if(!n.isValid(c)||s&&n.is0(c))throw new Error(`bad point coordinate ${g}`);return typeof c=="object"&&c!==null?n.create(c):c}function w(g){if(!(g instanceof p))throw new Error("Weierstrass Point expected")}function o(g){if(!N||!N.basises)throw new Error("no endo");return X0(g,N.basises,i.ORDER)}function u(g,c,s,h){if(!i.isValid(h))throw new RangeError("invalid scalar: out of range");if(N){let{k1neg:E,k1:B,k2neg:R,k2:A}=o(h),q=new p(n.mul(s.X,N.beta),s.Y,s.Z);g.push(E?s.negate():s,R?q.negate():q),c.push(B,A)}else g.push(s),c.push(h)}let l=new WeakSet;class p{static BASE=new p(f.Gx,f.Gy,n.ONE);static ZERO=new p(n.ZERO,n.ONE,n.ZERO);static Fp=n;static Fn=i;X;Y;Z;constructor(c,s,h){this.X=J("x",c),this.Y=J("y",s,!0),this.Z=J("z",h),Object.freeze(this)}static CURVE(){return f}static fromAffine(c){let{x:s,y:h}=c||{};if(!c||!n.isValid(s)||!n.isValid(h))throw new Error("invalid affine point");if(c instanceof p)throw new Error("projective point not allowed");return n.is0(s)&&n.is0(h)?p.ZERO:new p(s,h,n.ONE)}static fromBytes(c){let s=p.fromAffine(H(ut(c,void 0,"point")));return s.assertValidity(),s}static fromHex(c){return p.fromBytes(Ir(c))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(c=6,s=!0){return b.setWindowSize(this,c),s||this.multiply(_o),this}assertValidity(){let c=this;if(c.is0()){if(x&&n.is0(c.X)&&n.eql(c.Y,n.ONE)&&n.is0(c.Z))return;throw new Error("bad point: ZERO")}if(l.has(c))return;let{x:s,y:h}=c.toAffine();if(!n.isValid(s)||!n.isValid(h))throw new Error("bad point: x or y not field elements");if(!Y(s,h))throw new Error("bad point: equation left != right");if(!c.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");l.add(c)}hasEvenY(){let{y:c}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(c)}equals(c){w(c);let{X:s,Y:h,Z:E}=this,{X:B,Y:R,Z:A}=c,q=n.eql(n.mul(s,A),n.mul(B,E)),P=n.eql(n.mul(h,A),n.mul(R,E));return q&&P}negate(){return new p(this.X,n.neg(this.Y),this.Z)}double(){let{X:c,Y:s,Z:h}=this,E=n.ZERO,B=n.ZERO,R=n.ZERO,A=n.mul(c,c),q=n.mul(s,s),P=n.mul(h,h),X=n.mul(c,s);return X=n.add(X,X),R=n.mul(c,h),R=n.add(R,R),E=W(R),B=n.mul(D,P),B=n.add(E,B),E=n.sub(q,B),B=n.add(q,B),B=n.mul(E,B),E=n.mul(X,E),R=n.mul(D,R),P=W(P),X=n.sub(A,P),X=W(X),X=n.add(X,R),R=n.add(A,A),A=n.add(R,A),A=n.add(A,P),A=n.mul(A,X),B=n.add(B,A),P=n.mul(s,h),P=n.add(P,P),A=n.mul(P,X),E=n.sub(E,A),R=n.mul(P,q),R=n.add(R,R),R=n.add(R,R),new p(E,B,R)}add(c){w(c);let{X:s,Y:h,Z:E}=this,{X:B,Y:R,Z:A}=c,q=n.ZERO,P=n.ZERO,X=n.ZERO,j=n.mul(s,B),Z=n.mul(h,R),ot=n.mul(E,A),Q=n.add(s,h),G=n.add(B,R);Q=n.mul(Q,G),G=n.add(j,Z),Q=n.sub(Q,G),G=n.add(s,E);let st=n.add(B,A);return G=n.mul(G,st),st=n.add(j,ot),G=n.sub(G,st),st=n.add(h,E),q=n.add(R,A),st=n.mul(st,q),q=n.add(Z,ot),st=n.sub(st,q),X=W(G),q=n.mul(D,ot),X=n.add(q,X),q=n.sub(Z,X),X=n.add(Z,X),P=n.mul(q,X),Z=n.add(j,j),Z=n.add(Z,j),ot=W(ot),G=n.mul(D,G),Z=n.add(Z,ot),ot=n.sub(j,ot),ot=W(ot),G=n.add(G,ot),j=n.mul(Z,G),P=n.add(P,j),j=n.mul(st,G),q=n.mul(Q,q),q=n.sub(q,j),j=n.mul(Q,Z),X=n.mul(st,X),X=n.add(X,j),new p(q,P,X)}subtract(c){return w(c),this.add(c.negate())}is0(){return this.equals(p.ZERO)}multiply(c){if(!i.isValidNot0(c))throw new RangeError("invalid scalar: out of range");let{p:s,f:h}=b.mulSecret(this,c,a,y);return y([s,h])[0]}multiplyUnsafe(c){let s=this,h=c;if(!i.isValid(h))throw new RangeError("invalid scalar: out of range");if(h===me||s.is0())return p.ZERO;if(h===sr)return s;if(b.hasWindowSize(this))return b.mulUnsafe(s,h,y);let E=[],B=[];return u(E,B,s,h),zn(p,E,B)}mulAddUnsafe(c,s,h){w(s);let E=[],B=[];return u(E,B,this,c),u(E,B,s,h),zn(p,E,B)}toAffine(c){let s=this,h=c;if(h!=null&&!n.isValid(h))throw new RangeError('"invertedZ" expected valid field element');let{X:E,Y:B,Z:R}=s;if(n.eql(R,n.ONE))return{x:E,y:B};let A=s.is0();h==null&&(h=A?n.ONE:n.inv(R));let q=n.mul(E,h),P=n.mul(B,h),X=n.mul(R,h);if(A)return{x:n.ZERO,y:n.ZERO};if(!n.eql(X,n.ONE))throw new Error("invZ was invalid");return{x:q,y:P}}isTorsionFree(){return a===sr?!0:_?_(p,this):b.mulUnsafe(this,m).is0()}clearCofactor(){return a===sr?this:v?v(p,this):this.multiplyUnsafe(a)}isSmallOrder(){return a===sr?this.is0():this.clearCofactor().is0()}toBytes(c=!0){return $t(c,"isCompressed"),this.assertValidity(),k(p,this,c)}toHex(c=!0){return Vr(this.toBytes(c))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let y=g=>jn(p,g),b=new qr(p,C);return b.bits>=6&&p.BASE.precompute(6),Object.freeze(p.prototype),Object.freeze(p),p}function Fa(e){return Uint8Array.of(e?2:3)}function Na(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function $0(e,t={}){Ie(e);let{Fn:r}=e,n=t.randomBytes===void 0?ir:t.randomBytes,i=Object.assign(Na(e.Fp,r),{seed:Math.max(Hn(r.ORDER),16)});function f(S){try{let C=r.fromBytes(S);return r.isValidNot0(C)}catch{return!1}}function a(S,C){let{publicKey:N,publicKeyUncompressed:L}=i;try{let I=S.length;return C===!0&&I!==N||C===!1&&I!==L?!1:!e.fromBytes(S).is0()}catch{return!1}}function m(S){return S=S===void 0?n(i.seed):S,Pn(ut(S,i.seed,"seed"),r.ORDER)}function d(S,C=!0){return e.BASE.multiply(r.fromBytes(S)).toBytes(C)}function x(S){let{secretKey:C,publicKey:N,publicKeyUncompressed:L}=i,I=r._lengths;if(!Te(S))return;let U=ut(S,void 0,"key").length,T=U===N||U===L,k=U===C||!!I?.includes(U);if(!(T&&k))return T}function v(S,C,N=!0){if(x(S)===!0)throw new Error("first arg must be private key");if(x(C)===!1)throw new Error("second arg must be public key");let L=r.fromBytes(S),I=e.fromBytes(C);if(I.is0())throw new Error("invalid public key: point at infinity");return I.multiply(L).toBytes(N)}let _={isValidSecretKey:f,isValidPublicKey:a,randomSecretKey:m},M=Wn(m,d);return Object.freeze(_),Object.freeze(i),Object.freeze({getPublicKey:d,getSharedSecret:v,keygen:M,Point:e,utils:_,lengths:i})}function qa(e,t,r={}){Ie(e);let n=t;On(n),Kt(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});let i=Object.assign({},r),f=i.randomBytes===void 0?ir:i.randomBytes,a=i.hmac===void 0?(g,c)=>Oa(n,g,c):i.hmac,{Fp:m,Fn:d}=e,{ORDER:x,BITS:v}=d,_=Hn(x),M=yo(f,_),{keygen:S,getPublicKey:C,getSharedSecret:N,utils:L,lengths:I}=$0(e,i),U={prehash:!0,lowS:typeof i.lowS=="boolean"?i.lowS:!0,format:"compact",extraEntropy:!1},T=x*La+sr<m.ORDER;function k(g){let c=x>>sr;return g>c}function H(g,c){if(!d.isValidNot0(c))throw new Error(`invalid signature ${g}: out of range 1..Point.Fn.ORDER`);return c}function D(){if(!m.isOdd)throw new Error("Field doesn't support isOdd")}function W(g,c,s){return D(),(g===s?0:2)|Number(m.isOdd(c))}function $(){if(T)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function Y(g,c){Bo(c);let s=I.signature,h=c==="compact"?s:c==="recovered"?s+1:void 0;return ut(g,h)}class V{r;s;recovery;constructor(c,s,h){if(this.r=H("r",c),this.s=H("s",s),h!=null){if($(),![0,1,2,3].includes(h))throw new Error("invalid recovery id");this.recovery=h}Object.freeze(this)}static fromBytes(c,s=U.format){Y(c,s);let h;if(s==="der"){if(c.length>2*d.BYTES+16)throw new Kn.Err("invalid signature: DER signature too long");let{r:A,s:q}=Kn.toSig(ut(c),d.BYTES+1);return new V(A,q)}s==="recovered"&&(h=c[0],s="compact",c=c.subarray(1));let E=I.signature/2,B=c.subarray(0,E),R=c.subarray(E,E*2);return new V(d.fromBytes(B),d.fromBytes(R),h)}static fromHex(c,s){return this.fromBytes(Ir(c),s)}assertRecovery(){let{recovery:c}=this;if(c==null)throw new Error("invalid recovery id: must be present");return c}addRecoveryBit(c){return new V(this.r,this.s,c)}recoverPublicKey(c){let{r:s,s:h}=this,E=this.assertRecovery(),B=E===2||E===3?s+x:s;if(!m.isValid(B))throw new Error("invalid recovery id: sig.r+curve.n != R.x");let R=m.toBytes(B),A=e.fromBytes(re(Fa((E&1)===0),R)),q=d.inv(B),P=J(ut(c,void 0,"msgHash")),X=d.create(-P*q),j=d.create(h*q),Z=e.BASE.mulAddUnsafe(X,A,j);if(Z.is0())throw new Error("invalid recovery: point at infinify");return Z.assertValidity(),Z}hasHighS(){return k(this.s)}toBytes(c=U.format){if(Bo(c),c==="der")return Ir(Kn.hexFromSig(this));let{r:s,s:h}=this,E=d.toBytes(s),B=d.toBytes(h);return c==="recovered"?($(),re(Uint8Array.of(this.assertRecovery()),E,B)):re(E,B)}toHex(c){return Vr(this.toBytes(c))}}Object.freeze(V.prototype),Object.freeze(V);let K=i.bits2int===void 0?function(c){if(c.length>8192)throw new Error("input is too large");let s=ue(c),h=c.length*8-v;return h>0?s>>BigInt(h):s}:i.bits2int,J=i.bits2int_modN===void 0?function(c){return d.create(K(c))}:i.bits2int_modN,w=tn(v);function o(g){return Lr("num < 2^"+v,g,me,w),d.toBytes(g)}function u(g,c){return ut(g,void 0,"message"),c?ut(n(g),void 0,"prehashed message"):g}function l(g,c,s){let{lowS:h,prehash:E,extraEntropy:B}=Eo(s,U);g=u(g,E);let R=J(g),A=d.fromBytes(c);if(!d.isValidNot0(A))throw new Error("invalid private key");let q=[o(A),o(R)];if(B!=null&&B!==!1){let Z=B===!0?f(I.secretKey):B;q.push(ut(Z,void 0,"extraEntropy"))}let P=re(...q),X=R;function j(Z){let ot=K(Z);if(!d.isValidNot0(ot))return;let Q=e.BASE.multiply(ot).toAffine(),G=d.create(Q.x);if(G===me)return;let st;if(M!==void 0){let Wt=ue(Pn(M(_),x)),at=d.inv(d.mul(Wt,ot)),ft=d.mul(Wt,X),Vt=d.mul(Wt,A);st=d.create(at*d.create(ft+Vt*G))}else{let Wt=da(ot,x);st=d.create(Wt*d.create(X+G*A))}if(st===me)return;let et=W(Q.x,Q.y,G),rt=st;return h&&k(st)&&(rt=d.neg(st),et^=1),new V(G,rt,T?void 0:et)}return{seed:P,k2sig:j}}function p(g,c,s={}){let{seed:h,k2sig:E}=l(g,c,s);return oa(n.outputLen,d.BYTES,a)(h,E).toBytes(s.format)}function y(g,c,s,h={}){let{lowS:E,prehash:B,format:R}=Eo(h,U);if(s=ut(s,void 0,"publicKey"),c=u(c,B),!Te(g)){let A=g instanceof V?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+A)}Y(g,R);try{let A=V.fromBytes(g,R),q=e.fromBytes(s);if(q.is0()||E&&A.hasHighS())return!1;let{r:P,s:X}=A,j=J(c),Z=d.inv(X),ot=d.create(j*Z),Q=d.create(P*Z),G=e.BASE.mulAddUnsafe(ot,q,Q);if(G.is0())return!1;let st=G.toAffine();return!(d.create(st.x)!==P||R==="recovered"&&A.recovery!==W(st.x,st.y,P))}catch{return!1}}function b(g,c,s={}){let{prehash:h}=Eo(s,U);return c=u(c,h),V.fromBytes(g,"recovered").recoverPublicKey(c).toBytes()}return Object.freeze({keygen:S,getPublicKey:C,getSharedSecret:N,utils:L,lengths:I,Point:e,sign:p,verify:y,recoverPublicKey:b,Signature:V,hash:n})}var Mo={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},K0={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]};var Ua=BigInt(2);function V0(e){let t=Mo.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),f=BigInt(22),a=BigInt(23),m=BigInt(44),d=BigInt(88),x=e*e*e%t,v=x*x*e%t,_=Ht(v,r,t)*v%t,M=Ht(_,r,t)*v%t,S=Ht(M,Ua,t)*x%t,C=Ht(S,i,t)*S%t,N=Ht(C,f,t)*C%t,L=Ht(N,m,t)*N%t,I=Ht(L,d,t)*L%t,U=Ht(I,m,t)*N%t,T=Ht(U,r,t)*v%t,k=Ht(T,a,t)*C%t,H=Ht(k,n,t)*x%t,D=Ht(H,Ua,t);if(!So.eql(So.sqr(D),e))throw new Error("Cannot find square root");return D}var So=Nr(Mo.p,{sqrt:V0}),Q0=ka(Mo,{Fp:So,endo:K0}),J0=qa(Q0,ea);F();var th=BigInt(0),nn=BigInt(1),eh=BigInt(2),rh=BigInt(7),nh=BigInt(256),ih=BigInt(113),Ha=[],Pa=[],ja=[];for(let e=0,t=nn,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],Ha.push(2*(5*n+r)),Pa.push((e+1)*(e+2)/2%64);let i=th;for(let f=0;f<7;f++)t=(t<<nn^(t>>rh)*ih)%nh,t&eh&&(i^=nn<<(nn<<BigInt(f))-nn);ja.push(i)}var za=Rn(ja,!0),oh=za[0],sh=za[1],fh=(e,t,r)=>e<<r|t>>>32-r,ah=(e,t,r)=>t<<r|e>>>32-r,uh=(e,t,r)=>t<<r-32|e>>>64-r,ch=(e,t,r)=>e<<r-32|t>>>64-r,Ca=(e,t,r)=>r>32?uh(e,t,r):fh(e,t,r),Da=(e,t,r)=>r>32?ch(e,t,r):ah(e,t,r),Ur=new Uint32Array(10);function lh(e,t=24){if(!(e instanceof Uint32Array))throw new TypeError('"s" expected Uint32Array(50), got type='+typeof e);if(e.length!==50)throw new RangeError('"s" expected Uint32Array(50), got length='+e.length);if(Yt(t,"rounds"),t<1||t>24)throw new Error('"rounds" expected integer 1..24');for(let r=24-t;r<24;r++){for(let f=0;f<10;f++)Ur[f]=e[f]^e[f+10]^e[f+20]^e[f+30]^e[f+40];for(let f=0;f<10;f+=2){let a=(f+8)%10,m=(f+2)%10,d=Ur[m],x=Ur[m+1],v=Ca(d,x,1)^Ur[a],_=Da(d,x,1)^Ur[a+1];for(let M=0;M<50;M+=10)e[f+M]^=v,e[f+M+1]^=_}let n=e[2],i=e[3];for(let f=0;f<24;f++){let a=Pa[f],m=Ca(n,i,a),d=Da(n,i,a),x=Ha[f];n=e[x],i=e[x+1],e[x]=m,e[x+1]=d}for(let f=0;f<50;f+=10){let a=e[f],m=e[f+1],d=e[f+2],x=e[f+3];e[f]^=~e[f+2]&e[f+4],e[f+1]^=~e[f+3]&e[f+5],e[f+2]^=~e[f+4]&e[f+6],e[f+3]^=~e[f+5]&e[f+7],e[f+4]^=~e[f+6]&e[f+8],e[f+5]^=~e[f+7]&e[f+9],e[f+6]^=~e[f+8]&a,e[f+7]^=~e[f+9]&m,e[f+8]^=~a&d,e[f+9]^=~m&x}e[0]^=oh[r],e[1]^=sh[r]}ae(Ur)}var Ro=class e{state;pos=0;posOut=0;finished=!1;state32;destroyed=!1;blockLen;suffix;outputLen;canXOF;enableXOF=!1;rounds;constructor(t,r,n,i=!1,f=24){if(Yt(t,"blockLen"),Yt(r,"suffix"),Yt(f,"rounds"),Yf(i,"enableXOF"),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.canXOF=i,this.rounds=f,Yt(n,"outputLen"),!(0<t&&t<200))throw new Error('"blockLen" must be 1..199');this.state=new Uint8Array(200),this.state32=Ji(this.state)}clone(){return this._cloneInto()}keccak(){to(this.state32),lh(this.state32,this.rounds),to(this.state32),this.posOut=0,this.pos=0}update(t){de(this),Xt(t);let{blockLen:r,state:n,state32:i}=this,f=t.length,a=r%4===0&&t.byteOffset%4===0,m=r/4,d=a&&f>=r?Ji(t):void 0;for(let x=0;x<f;){if(d!==void 0&&this.pos===0&&x%4===0&&f-x>=r){for(let _=0,M=x/4;_<m;_++)i[_]^=d[M+_];x+=r,this.pos=r,this.keccak();continue}let v=Math.min(r-this.pos,f-x);for(let _=0;_<v;_++)n[this.pos++]^=t[x++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:i}=this;t[n]^=r,(r&128)!==0&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){de(this,!1),Xt(t),this.finish();let r=this.state,{blockLen:n}=this;for(let i=0,f=t.length;i<f;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,f-i);t.set(r.subarray(this.posOut,this.posOut+a),i),this.posOut+=a,i+=a}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not enabled");return this.writeInto(t)}xof(t){return Yt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Or(t,this),this.finished)throw new Error("digest() was already called");this.writeInto(t.length===this.outputLen?t:t.subarray(0,this.outputLen)),this.destroy()}digest(){let t=new Uint8Array(this.outputLen);return this.digestInto(t),t}destroy(){this.destroyed=!0,ae(this.state)}_cloneInto(t){let{blockLen:r,suffix:n,outputLen:i,rounds:f,enableXOF:a}=this;return t||=new e(r,n,i,a,f),t.blockLen=r,t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=f,t.suffix=n,t.outputLen=i,t.enableXOF=a,t.canXOF=this.canXOF,t.destroyed=this.destroyed,t}},hh=(e,t,r,n={})=>Gr(()=>new Ro(t,e,r),n);var dh=hh(6,72,64,$r(10));F();function Ao({ed25519:e,secp256k1:t,keccak256:r,randomBytes:n}){for(let[I,U]of[["ed25519",e],["secp256k1",t],["keccak256",r],["randomBytes",n]])if(!U)throw new Error("createHalves: not passed "+I);let i=e.Point.Fn.ORDER,f=t.Point.Fn.ORDER,a=i<f?i:f;function m(){for(let I=0;I<256;I++){let U=n(32),T=0n;for(let k of U)T=T<<8n|BigInt(k);if(T>0n&&T<a)return T}throw new Error("newHalf: could not get a scalar in 256 attempts")}let d="ninsei-order-half-v1",x="ninsei-order-view-v1";function v(I,U,T=d){if(!I||I.length<16)throw new Error("halfFromSeed: secret shorter than 16 bytes");if(!U)throw new Error("halfFromSeed: order binding not set");let k=new TextEncoder().encode(T+"|"+String(U)+"|");for(let H=0;H<256;H++){let D=new Uint8Array(k.length+I.length+4);D.set(k,0),D.set(I,k.length),D[k.length+I.length]=H>>>24&255,D[k.length+I.length+1]=H>>>16&255,D[k.length+I.length+2]=H>>>8&255,D[k.length+I.length+3]=H&255;let W=r(D),$=0n;for(let Y of W)$=$<<8n|BigInt(Y);if($>0n&&$<a)return $}throw new Error("halfFromSeed: could not get a scalar in 256 attempts")}function _(I,U){return I.fromHex(U.startsWith("0x")?U.slice(2):U)}function M(I){if(typeof I=="bigint")return I;if(typeof I=="string"){let U=I.trim().replace(/^0x/,"");if(!/^[0-9a-fA-F]{1,64}$/.test(U))throw new Error("half does not look like a number: "+I.slice(0,12));return BigInt("0x"+U)}if(typeof I=="number")return BigInt(I);throw new Error("half of unknown type: "+typeof I)}function S(I){return I.toHex()}function C(I){return{ed:S(e.Point.BASE.multiply(M(I))),secp:S(t.Point.BASE.multiply(M(I)))}}function N(I,U){return(M(I)+M(U))%i}function L(I,U){return S(_(e.Point,I).add(_(e.Point,U)))}return{LIMIT:a,ED_ORDER:i,SECP_ORDER:f,HALF_DOMAIN:d,VIEW_HALF_DOMAIN:x,newHalf:m,halfFromSeed:v,publicHalves:C,combineHalves:N,combinePublic:L}}F();function To({ed25519:e,secp256k1:t,keccak256:r,sha3_512:n,randomBytes:i}){if(typeof n!="function")throw new Error("createDleq2: sha3_512 is required (SHA3-512 from @noble/hashes)");let f=e.Point.Fn.ORDER,a=t.Point.Fn.ORDER,m=Math.min(f.toString(2).length,a.toString(2).length),d={A:{name:"secp256k1",P:t.Point,order:a,G:t.Point.BASE,Galt:t.Point.fromHex("0250929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0")},B:{name:"ed25519",P:e.Point,order:f,G:e.Point.BASE,Galt:e.Point.fromHex("8b655970153799af2aeadc9ff1add0ea6c7251d54154cfa92c173a0dd39c1f94")}};d.A.Galt.precompute(8),d.B.Galt.precompute(8);let x=g=>{let c=String(g??""),s=[];for(let h=0;h<c.length;h++){let E=c.codePointAt(h);E>65535&&h++,E<128?s.push(E):E<2048?s.push(192|E>>6,128|E&63):E<65536?s.push(224|E>>12,128|E>>6&63,128|E&63):s.push(240|E>>18,128|E>>12&63,128|E>>6&63,128|E&63)}return new Uint8Array(s)},v=g=>typeof g=="string"?g:g.toHex?g.toHex():String(g);function _(g){let c=g.replace(/^0x/,""),s=new Uint8Array(c.length/2);for(let h=0;h<s.length;h++)s[h]=parseInt(c.substr(h*2,2),16);return s}let M=g=>g.toString(16).padStart(64,"0");function S(g){let c=0n;for(let s of g)c=c<<8n|BigInt(s);return c}function C(g){let c=0n;for(let s=g.length-1;s>=0;s--)c=c<<8n|BigInt(g[s]);return c}function N(g){let c=g.reduce((E,B)=>E+B.length,0),s=new Uint8Array(c),h=0;for(let E of g)s.set(E,h),h+=E.length;return s}function L(g,c){let s=n(N(c.map(h=>typeof h=="string"?_(h):h)));if(s.length!==64)throw new Error("challenge: sha3_512 returned "+s.length+" bytes instead of 64");return C(s)%g.order}function I(g){let c=C(i(64))%g.order;return c===0n?1n:c}function U(g,c){return g>>BigInt(c)&1n}function T(g,c,s){let E=((typeof s=="bigint"?s:BigInt(s))%g.order+g.order)%g.order;return E===0n?g.P.ZERO:c===g.Galt?c.multiply(E):c.multiplyUnsafe(E)}function k(g,c,s){return T(g,s||g.G,typeof c=="bigint"?c:BigInt(c))}let H=(g,c)=>g.add(c),D=(g,c)=>g.subtract(c),W=g=>_(g.toHex()),$=g=>_(M(g));function Y(g,c){let s=[],h=[],E=0n,B=1n;for(let R=0;R<m;R++){if(R===m-1){let q=V(B,g.order);s[R]=(g.order-E%g.order)*q%g.order}else s[R]=I(g),E=(E+s[R]*B)%g.order,B=B*2n%g.order;let A=U(c,R);h.push(H(k(g,A),k(g,s[R],g.Galt)))}return{rs:s,cs:h}}function V(g,c){let[s,h]=[g%c,c],[E,B]=[1n,0n];for(;h!==0n;){let R=s/h;[s,h]=[h,s-R*h],[E,B]=[B,E-R*B]}if(s!==1n)throw new Error("modInv: not invertible");return(E%c+c)%c}function K(g,c){let s=c[0];for(let h=1;h<c.length;h++)s=H(s,k(g,2n**BigInt(h)%g.order,c[h]));return s}function J(g,c,s,h,E,B,R){let A=I(d.A),q=I(d.B),P=(et,rt)=>[x(R),W(s),W(h),W(et),W(rt)],X=L(d.A,P(k(d.A,A,d.A.Galt),k(d.B,q,d.B.Galt)),R),j=L(d.B,P(k(d.A,A,d.A.Galt),k(d.B,q,d.B.Galt)),R);if((g===1n||g===1?1n:0n)===0n){let et=I(d.A),rt=I(d.B),Wt=D(s,d.A.G),at=D(h,d.B.G),ft=L(d.A,P(D(k(d.A,et,d.A.Galt),T(d.A,Wt,X)),D(k(d.B,rt,d.B.Galt),T(d.B,at,j))),R),Vt=L(d.B,P(D(k(d.A,et,d.A.Galt),T(d.A,Wt,X)),D(k(d.B,rt,d.B.Galt),T(d.B,at,j))),R);return{eA:ft,eB:Vt,a0:et,a1:(A+ft*E)%d.A.order,b0:rt,b1:(q+Vt*B)%d.B.order}}let ot=I(d.A),Q=I(d.B),G=L(d.A,P(D(k(d.A,ot,d.A.Galt),T(d.A,s,X)),D(k(d.B,Q,d.B.Galt),T(d.B,h,j))),R),st=L(d.B,P(D(k(d.A,ot,d.A.Galt),T(d.A,s,X)),D(k(d.B,Q,d.B.Galt),T(d.B,h,j))),R);return{eA:X,eB:j,a0:(A+G*E)%d.A.order,a1:ot,b0:(q+st*B)%d.B.order,b1:Q}}let w=g=>({eA:M(g.eA),eB:M(g.eB),a0:M(g.a0),a1:M(g.a1),b0:M(g.b0),b1:M(g.b1)});function o(g,c){let s=k(d.A,g),h=k(d.B,g),E=Y(d.A,g),B=Y(d.B,g),R=[];for(let A=0;A<m;A++)R.push({i:A,bit:U(g,A)===1n?1:0,cA:v(E.cs[A]),cB:v(B.cs[A]),rA:M(E.rs[A]),rB:M(B.rs[A])});return{XA:v(s),XB:v(h),context:String(c??""),bits:R}}function u(g,c){let s=J(g.bit===1?1n:0n,g.i,d.A.P.fromHex(String(g.cA).replace(/^0x/,"")),d.B.P.fromHex(String(g.cB).replace(/^0x/,"")),BigInt("0x"+String(g.rA).replace(/^0x/,"")),BigInt("0x"+String(g.rB).replace(/^0x/,"")),c);return{i:g.i,cA:g.cA,cB:g.cB,sig:w(s)}}function l(g,c){let s=new Map(c.map(E=>[E.i,E])),h=[];for(let E=0;E<m;E++){let B=s.get(E);if(!B)throw new Error("assembleProof: no part for bit "+E);h.push({cA:B.cA,cB:B.cB,sig:B.sig})}return{XA:g.XA,XB:g.XB,proofs:h}}function p(g,c,s){let h=o(g,c),E=[];for(let B=0;B<m;B++)s&&(B%16===0||B===m-1)&&s(B+1,m),E.push(u(h.bits[B],h.context));return l(h,E)}function y(g,c){if(g.name!=="ed25519")return!0;try{return c.isTorsionFree()===!0}catch{return!1}}function b(g,c){if(!g||typeof g!="object")return{ok:!1,reason:"proof: an object is expected"};if(typeof g.XA!="string"||typeof g.XB!="string")return{ok:!1,reason:"proof: no XA or XB"};if(!Array.isArray(g.proofs))return{ok:!1,reason:"proof: no parts list"};if(g.proofs.length!==m)return{ok:!1,reason:"proof: "+g.proofs.length+" parts, expected "+m};let s=(A,q)=>A.P.fromHex(String(q).replace(/^0x/,"")),h,E,B,R;try{if(h=s(d.A,g.XA),E=s(d.B,g.XB),!y(d.B,E))return{ok:!1,reason:"proof: XB is not in the prime-order subgroup"}}catch(A){return{ok:!1,reason:"proof: XA or XB is unparsable ("+String(A&&A.message||A)+")"}}try{B=g.proofs.map((A,q)=>{try{return s(d.A,A.cA)}catch(P){throw new Error("bit "+q+": "+String(P&&P.message||P))}}),R=g.proofs.map((A,q)=>{try{return s(d.B,A.cB)}catch(P){throw new Error("bit "+q+": "+String(P&&P.message||P))}})}catch(A){return{ok:!1,reason:"proof: "+String(A&&A.message||A)}}if(!K(d.A,B).equals(h))return{ok:!1,reason:"the commitment sum does not give X on secp256k1"};if(!K(d.B,R).equals(E))return{ok:!1,reason:"the commitment sum does not give X on ed25519"};for(let A=0;A<g.proofs.length;A++){let q=g.proofs[A];try{if(!y(d.B,R[A]))return{ok:!1,reason:"bit "+A+": the commitment is not in the prime-order subgroup"};let P=q.cA,X=q.cB,j=Object.fromEntries(Object.entries(q.sig).map(([ht,Qt])=>[ht,BigInt(String(Qt).startsWith("0x")?Qt:"0x"+Qt)])),Z=s(d.A,P),ot=s(d.B,X),Q=(ht,Qt)=>[x(c),W(Z),W(ot),W(ht),W(Qt)],G=k(d.A,j.a1,d.A.Galt),st=T(d.A,Z,j.eA),et=k(d.B,j.b1,d.B.Galt),rt=T(d.B,ot,j.eB),Wt=L(d.A,Q(D(G,st),D(et,rt)),c),at=L(d.B,Q(D(G,st),D(et,rt)),c),ft=k(d.A,j.a0,d.A.Galt),Vt=T(d.A,D(Z,d.A.G),Wt),dt=k(d.B,j.b0,d.B.Galt),pt=T(d.B,D(ot,d.B.G),at),ke=L(d.A,Q(D(ft,Vt),D(dt,pt)),c),gt=L(d.B,Q(D(ft,Vt),D(dt,pt)),c);if(ke!==j.eA||gt!==j.eB)return{ok:!1,reason:"bit "+A+": challenges did not match"}}catch(P){return{ok:!1,reason:"bit "+A+": fields are unparsable ("+String(P&&P.message||P)+")"}}}return{ok:!0}}return{BITS:m,curves:d,prove:p,verify:b,prepareProof:o,proveBit:u,assembleProof:l,torsionFree:y}}F();var Za="halfenc is locked: the sealed-half envelope is not part of the live flow (keccak commit/reveal replaced it). Set globalThis.ARRAKIS_ALLOW_HALFENC = true to work with it in a test or a spike.";function Wa(){return globalThis.ARRAKIS_ALLOW_HALFENC===!0}function Oo({secp256k1:e,ed25519:t,keccak256:r,randomBytes:n}){let i=t.Point.Fn.ORDER,f=e.Point.Fn.ORDER,a=i<f?i:f;function m(N){let L=0n;for(let I of N)L=L<<8n|BigInt(I);return L}function d(N){for(let L=0;L<256;L++){let I=m(n(32));if(I>0n&&I<N)return I}throw new Error("randScalar: failed in 256 attempts")}let x=N=>N.toString(16).padStart(64,"0");function v(){let N=d(f);return{priv:N,pub:e.Point.BASE.multiply(N).toHex()}}function _(N,L){let I=r(Uint8Array.from(z.Buffer.concat([z.Buffer.from(N.replace(/^0x/,""),"hex"),z.Buffer.from(L||"","utf8")])));return m(I)%a}function M(N,L,I){if(!Wa())throw new Error(Za);if(!(N>0n&&N<a))throw new Error("seal: half outside min(l, n)");let U=e.Point.fromHex(L.replace(/^0x/,"")),T=d(f),k=e.Point.BASE.multiply(T),H=U.multiply(T),D=_(H.toHex(),I),W=$=>"0x"+String($).replace(/^0x/i,"").toLowerCase();return{recipient:W(L),ephemeral:W(k.toHex()),masked:"0x"+x((N+D)%a),context:I||""}}function S(N,L,I){if(!Wa())return{ok:!1,reason:Za};if(!N||!N.ephemeral||!N.masked)return{ok:!1,reason:"incomplete envelope"};let T=e.Point.fromHex(N.ephemeral.replace(/^0x/,"")).multiply(L),k=_(T.toHex(),N.context),H=(BigInt(N.masked)-k+a)%a;if(H===0n)return{ok:!1,reason:"restored zero"};if(!I)return{ok:!0,x:H};let D=t.Point.BASE.multiply(H).toHex(),W=t.Point.fromHex(I.startsWith("0x")?I.slice(2):I).toHex();return D!==W?{ok:!1,reason:"the ciphertext holds a different half"}:{ok:!0,x:H}}function C(N){let L=r(Vn(N));return"0x"+Le(L)}return{LIMIT:a,recipientKeyPair:v,seal:M,open:S,packSealed:Qn,unpackSealed:Xa,sealedCommitmentOf:C}}var Ya=1;function Le(e){let t="";for(let r of e)t+=r.toString(16).padStart(2,"0");return t}function ph(e){let t=String(e??""),r=[];for(let n=0;n<t.length;n++){let i=t.charCodeAt(n);i<128?r.push(i):i<2048?r.push(192|i>>6,128|i&63):r.push(224|i>>12,128|i>>6&63,128|i&63)}return new Uint8Array(r)}function gh(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];n<128?t+=String.fromCharCode(n):n<224?t+=String.fromCharCode((n&31)<<6|e[++r]&63):t+=String.fromCharCode((n&15)<<12|(e[++r]&63)<<6|e[++r]&63)}return t}var Vn=e=>{let t=String(e||"").replace(/^0x/i,""),r=new Uint8Array(t.length/2);for(let n=0;n<r.length;n++)r[n]=parseInt(t.substr(n*2,2),16);return r};function Qn(e){if(!e||!e.recipient||!e.ephemeral||!e.masked)throw new Error("packSealed: incomplete envelope");let t=Vn(e.recipient),r=Vn(e.ephemeral);if(t.length!==33)throw new Error("packSealed: recipient key must be 33 bytes (compressed point)");if(r.length!==33)throw new Error("packSealed: ephemeral point must be 33 bytes (compressed)");let n=BigInt(e.masked).toString(16).padStart(64,"0"),i=ph(e.context);if(i.length>255)throw new Error("packSealed: context longer than 255 bytes");return"0x"+Le(Uint8Array.of(Ya))+Le(t)+Le(r)+n+i.length.toString(16).padStart(2,"0")+Le(i)}function Xa(e){let t=Vn(e);if(t.length<100)throw new Error("unpackSealed: envelope shorter than 100 bytes");if(t[0]!==Ya)throw new Error("unpackSealed: unknown format version: "+t[0]);let r=t[99];if(t.length!==100+r)throw new Error("unpackSealed: length does not match the one in the context");return{recipient:"0x"+Le(t.slice(1,34)),ephemeral:"0x"+Le(t.slice(34,67)),masked:"0x"+Le(t.slice(67,99)),context:gh(t.slice(100))}}F();F();function Ga(e,t,r){if(!t||!r)throw new Error("secp256k1 and keccak256 are required");let n=BigInt(e);if(n<=0n)throw new Error("the half must be a positive number");let f=t.Point.BASE.multiply(n).toBytes(!1).slice(1);return"0x"+Array.from(r(f),a=>a.toString(16).padStart(2,"0")).join("")}F();var $a={1:2,2:3,3:5,4:6,5:7,6:9,7:10,8:11};var mh={mainnet:{primary:18,integrated:19,subaddress:42},stagenet:{primary:24,integrated:25,subaddress:36},testnet:{primary:53,integrated:54,subaddress:63}};function yh(e,t="primary"){let r=mh[e];if(!r)throw new Error("Unknown network: "+e);let n=r[t];if(n===void 0)throw new Error("Unknown address kind: "+t);return n}var Va="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Kp=(()=>{let e=new Map;return[...Va].forEach((t,r)=>e.set(t,BigInt(r))),e})();function Ka(e){let t=0n;for(let n of e)t=t<<8n|BigInt(n);let r="";for(;t>0n;)r=Va[Number(t%58n)]+r,t/=58n;return r}function wh(e){let t=Array.from(e),r=t.length,n=r%8,i=n===0?8:n,f=r-i,a="";for(let d=0;d<f;d+=8){let x=Ka(t.slice(d,d+8));a+="1".repeat(Math.max(0,$a[8]-x.length))+x}let m=Ka(t.slice(f));return a+="1".repeat(Math.max(0,$a[i]-m.length))+m,a}function bh({network:e,kind:t="primary",spendPub:r,viewPub:n,paymentId:i}){let f=yh(e,t),a=Io(r,32,"public spend key"),m=Io(n,32,"public view key"),d=[f,...a,...m];if(t==="integrated"){let x=Io(i,8,"payment id");d.push(...x)}return Uint8Array.from(d)}function Io(e,t,r){let n=String(e||"").trim();if(!new RegExp("^[0-9a-fA-F]{"+t*2+"}$").test(n))throw new Error("Bad "+r+": expected "+t*2+" hex characters");let i=new Uint8Array(t);for(let f=0;f<t;f++)i[f]=parseInt(n.slice(f*2,f*2+2),16);return i}function Qa({network:e,kind:t="primary",spendPub:r,viewPub:n,paymentId:i},f){if(!f?.keccak256)throw new Error("addressFromKeys needs { keccak256 }");let a=bh({network:e,kind:t,spendPub:r,viewPub:n,paymentId:i}),m=Uint8Array.from(f.keccak256(f.Buffer?f.Buffer.from(a):a)),d=new Uint8Array(a.length+4);return d.set(a,0),d.set(m.slice(0,4),a.length),wh(d)}F();function Ja({halves:e,addressFromKeys:t,deps:r,ownSpendHalf:n,ownViewHalf:i,otherSpendPoint:f,otherViewPoint:a,network:m}){if(!e||!t)throw new Error("halves and addressFromKeys are required");for(let[S,C]of Object.entries({ownSpendHalf:n,ownViewHalf:i,otherSpendPoint:f,otherViewPoint:a}))if(C==null||C==="")throw new Error("not set: "+S);let d=e.publicHalves(n).ed,x=e.publicHalves(i).ed,v=e.combinePublic(d,f),_=e.combinePublic(x,a);return{address:t({network:m,kind:"primary",spendPub:v,viewPub:_},r),spendPub:v,viewPub:_,ownSpendPub:d,ownViewPub:x}}function xh({ed25519:e,secp256k1:t,keccak256:r,sha3_512:n,randomBytes:i}){let f=Ao({ed25519:e,secp256k1:t,keccak256:r,randomBytes:i}),a=To({ed25519:e,secp256k1:t,keccak256:r,sha3_512:n,randomBytes:i}),m=Oo({secp256k1:t,ed25519:e,keccak256:r,randomBytes:i});function d(L,I=!1,U){let T=f.newHalf(),k=f.publicHalves(T),H=f.newHalf(),D=f.publicHalves(H).ed,W=m.recipientKeyPair(),$=a.prove(T,L,U);return{half:T,pub:k,viewHalf:H,viewPub:D,enc:W,proof:$,standIn:I}}function x(L,I,U,T){let k=a.verify(L.proof,I);if(!k.ok)return{ok:!1,reason:"counterparty DLEQ failed: "+k.reason};if(L.pub&&L.pub.ed&&String(L.proof.XB).toLowerCase()!==String(L.pub.ed).toLowerCase())return{ok:!1,reason:"the proven ed25519 point does not match the declared one: "+L.proof.XB+" vs "+L.pub.ed};if(U&&T){let H=m.open(m.unpackSealed(U),T,L.pub.ed);if(!H.ok)return{ok:!1,reason:"the counterparty envelope does not confirm the half: "+H.reason}}return{ok:!0}}function v(L,I,U){let T=m.seal(I,L.enc.pub,U),k=Qn(T);return{sealed:T,bytes:k,commitment:m.sealedCommitmentOf(k)}}function _(L,I,U){return m.open(m.unpackSealed(L),I,U)}function M(L){return Ga(L,t,r)}function S(L,I){return f.combinePublic(L.pub.ed,I.pub.ed)}function C(L){return f.publicHalves(typeof L=="bigint"?L:BigInt(L)).ed}function N({ownSpendHalf:L,ownViewHalf:I,otherSpendPoint:U,otherViewPoint:T,network:k}){return Ja({halves:f,addressFromKeys:Qa,deps:{keccak256:r},ownSpendHalf:L,ownViewHalf:I,otherSpendPoint:U,otherViewPoint:T,network:k})}return{halves:f,dleq:a,enc:m,newSide:d,verifySide:x,sealFor:v,openFrom:_,jointAddressPoint:S,pointOf:C,jointAddress:N,halfCommitment:M}}var vh=Lo.default.keccak256||Lo.default,ug=e=>vh(ko.Buffer.isBuffer(e)?e:ko.Buffer.from(e)),cg=e=>{let t=new Uint8Array(e);return crypto.getRandomValues(t),t};var export_Buffer=ko.Buffer;export{export_Buffer as Buffer,To as createDleq2,Oo as createHalfEnc,Ao as createHalves,xh as createOrderBuilder,W0 as ed25519,ug as keccak256,Qn as packSealed,cg as randomBytes,J0 as secp256k1,dh as sha3_512,Xa as unpackSealed};
|
|
2
|
+
/*! Bundled license information:
|
|
3
|
+
|
|
4
|
+
ieee754/index.js:
|
|
5
|
+
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
6
|
+
|
|
7
|
+
buffer/index.js:
|
|
8
|
+
(*!
|
|
9
|
+
* The buffer module from node.js, for the browser.
|
|
10
|
+
*
|
|
11
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
12
|
+
* @license MIT
|
|
13
|
+
*)
|
|
14
|
+
|
|
15
|
+
@noble/curves/utils.js:
|
|
16
|
+
@noble/curves/abstract/modular.js:
|
|
17
|
+
@noble/curves/abstract/curve.js:
|
|
18
|
+
@noble/curves/abstract/edwards.js:
|
|
19
|
+
@noble/curves/ed25519.js:
|
|
20
|
+
@noble/curves/abstract/der.js:
|
|
21
|
+
@noble/curves/abstract/weierstrass.js:
|
|
22
|
+
@noble/curves/secp256k1.js:
|
|
23
|
+
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
24
|
+
*/
|