PHP WebShell

Текущая директория: /opt/BitGoJS/node_modules/@xrplf/secret-numbers/build

Просмотр файла: xrplf-secret-numbers-latest.min.js

/*! For license information please see xrplf-secret-numbers-latest.min.js.LICENSE.txt */
var xrplf_secret_numbers;(()=>{"use strict";var e={569:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createCurve=t.getHash=void 0;const n=r(220),o=r(26),i=r(86);function s(e){return{hash:e,hmac:(t,...r)=>(0,n.hmac)(e,t,(0,o.concatBytes)(...r)),randomBytes:o.randomBytes}}t.getHash=s,t.createCurve=function(e,t){const r=t=>(0,i.weierstrass)({...e,...s(t)});return Object.freeze({...r(t),create:r})}},16:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateBasic=t.wNAF=void 0;const n=r(625),o=r(242),i=BigInt(0),s=BigInt(1);t.wNAF=function(e,t){const r=(e,t)=>{const r=t.negate();return e?r:t},n=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:r,unsafeLadder(t,r){let n=e.ZERO,o=t;for(;r>i;)r&s&&(n=n.add(o)),o=o.double(),r>>=s;return n},precomputeWindow(e,t){const{windows:r,windowSize:o}=n(t),i=[];let s=e,c=s;for(let e=0;e<r;e++){c=s,i.push(c);for(let e=1;e<o;e++)c=c.add(s),i.push(c);s=c.double()}return i},wNAF(t,o,i){const{windows:c,windowSize:a}=n(t);let d=e.ZERO,u=e.BASE;const f=BigInt(2**t-1),l=2**t,h=BigInt(t);for(let e=0;e<c;e++){const t=e*a;let n=Number(i&f);i>>=h,n>a&&(n-=l,i+=s);const c=t,y=t+Math.abs(n)-1,p=e%2!=0,b=n<0;0===n?u=u.add(r(p,o[c])):d=d.add(r(b,o[y]))}return{p:d,f:u}},wNAFCached(e,t,r,n){const o=e._WINDOW_SIZE||1;let i=t.get(e);return i||(i=this.precomputeWindow(e,o),1!==o&&t.set(e,n(i))),this.wNAF(o,i,r)}}},t.validateBasic=function(e){return(0,n.validateField)(e.Fp),(0,o.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,n.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}},265:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.twistedEdwards=void 0;const n=r(625),o=r(242),i=r(242),s=r(16),c=BigInt(0),a=BigInt(1),d=BigInt(2),u=BigInt(8),f={zip215:!0};t.twistedEdwards=function(e){const t=function(e){const t=(0,s.validateBasic)(e);return o.validateObject(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:r,n:l,prehash:h,hash:y,randomBytes:p,nByteLength:b,h:g}=t,w=d<<BigInt(8*b)-a,m=r.create,E=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:r.sqrt(e*r.inv(t))}}catch(e){return{isValid:!1,value:c}}}),B=t.adjustScalarBytes||(e=>e),x=t.domain||((e,t,r)=>{if(t.length||r)throw new Error("Contexts/pre-hash are not supported");return e}),v=e=>"bigint"==typeof e&&c<e,A=(e,t)=>v(e)&&v(t)&&e<t,S=e=>e===c||A(e,w);function _(e,t){if(A(e,t))return e;throw new Error(`Expected valid scalar < ${t}, got ${typeof e} ${e}`)}function T(e){return e===c?e:_(e,l)}const O=new Map;function I(e){if(!(e instanceof P))throw new Error("ExtendedPoint expected")}class P{constructor(e,t,r,n){if(this.ex=e,this.ey=t,this.ez=r,this.et=n,!S(e))throw new Error("x required");if(!S(t))throw new Error("y required");if(!S(r))throw new Error("z required");if(!S(n))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof P)throw new Error("extended point not allowed");const{x:t,y:r}=e||{};if(!S(t)||!S(r))throw new Error("invalid affine point");return new P(t,r,a,m(t*r))}static normalizeZ(e){const t=r.invertBatch(e.map((e=>e.ez)));return e.map(((e,r)=>e.toAffine(t[r]))).map(P.fromAffine)}_setWindowSize(e){this._WINDOW_SIZE=e,O.delete(this)}assertValidity(){const{a:e,d:r}=t;if(this.is0())throw new Error("bad point: ZERO");const{ex:n,ey:o,ez:i,et:s}=this,c=m(n*n),a=m(o*o),d=m(i*i),u=m(d*d),f=m(c*e);if(m(d*m(f+a))!==m(u+m(r*m(c*a))))throw new Error("bad point: equation left != right (1)");if(m(n*o)!==m(i*s))throw new Error("bad point: equation left != right (2)")}equals(e){I(e);const{ex:t,ey:r,ez:n}=this,{ex:o,ey:i,ez:s}=e,c=m(t*s),a=m(o*n),d=m(r*s),u=m(i*n);return c===a&&d===u}is0(){return this.equals(P.ZERO)}negate(){return new P(m(-this.ex),this.ey,this.ez,m(-this.et))}double(){const{a:e}=t,{ex:r,ey:n,ez:o}=this,i=m(r*r),s=m(n*n),c=m(d*m(o*o)),a=m(e*i),u=r+n,f=m(m(u*u)-i-s),l=a+s,h=l-c,y=a-s,p=m(f*h),b=m(l*y),g=m(f*y),w=m(h*l);return new P(p,b,w,g)}add(e){I(e);const{a:r,d:n}=t,{ex:o,ey:i,ez:s,et:a}=this,{ex:u,ey:f,ez:l,et:h}=e;if(r===BigInt(-1)){const e=m((i-o)*(f+u)),t=m((i+o)*(f-u)),r=m(t-e);if(r===c)return this.double();const n=m(s*d*h),y=m(a*d*l),p=y+n,b=t+e,g=y-n,w=m(p*r),E=m(b*g),B=m(p*g),x=m(r*b);return new P(w,E,x,B)}const y=m(o*u),p=m(i*f),b=m(a*n*h),g=m(s*l),w=m((o+i)*(u+f)-y-p),E=g-b,B=g+b,x=m(p-r*y),v=m(w*E),A=m(B*x),S=m(w*x),_=m(E*B);return new P(v,A,_,S)}subtract(e){return this.add(e.negate())}wNAF(e){return R.wNAFCached(this,O,e,P.normalizeZ)}multiply(e){const{p:t,f:r}=this.wNAF(_(e,l));return P.normalizeZ([t,r])[0]}multiplyUnsafe(e){let t=T(e);return t===c?H:this.equals(H)||t===a?this:this.equals(L)?this.wNAF(t).p:R.unsafeLadder(this,t)}isSmallOrder(){return this.multiplyUnsafe(g).is0()}isTorsionFree(){return R.unsafeLadder(this,l).is0()}toAffine(e){const{ex:t,ey:n,ez:o}=this,i=this.is0();null==e&&(e=i?u:r.inv(o));const s=m(t*e),d=m(n*e),f=m(o*e);if(i)return{x:c,y:a};if(f!==a)throw new Error("invZ was invalid");return{x:s,y:d}}clearCofactor(){const{h:e}=t;return e===a?this:this.multiplyUnsafe(e)}static fromHex(e,n=!1){const{d:s,a:d}=t,u=r.BYTES,f=(e=(0,i.ensureBytes)("pointHex",e,u)).slice(),l=e[u-1];f[u-1]=-129&l;const h=o.bytesToNumberLE(f);h===c||_(h,n?w:r.ORDER);const y=m(h*h),p=m(y-a),b=m(s*y-d);let{isValid:g,value:B}=E(p,b);if(!g)throw new Error("Point.fromHex: invalid y coordinate");const x=(B&a)===a,v=0!=(128&l);if(!n&&B===c&&v)throw new Error("Point.fromHex: x=0 and x_0=1");return v!==x&&(B=m(-B)),P.fromAffine({x:B,y:h})}static fromPrivateKey(e){return C(e).point}toRawBytes(){const{x:e,y:t}=this.toAffine(),n=o.numberToBytesLE(t,r.BYTES);return n[n.length-1]|=e&a?128:0,n}toHex(){return o.bytesToHex(this.toRawBytes())}}P.BASE=new P(t.Gx,t.Gy,a,m(t.Gx*t.Gy)),P.ZERO=new P(c,a,a,c);const{BASE:L,ZERO:H}=P,R=(0,s.wNAF)(P,8*b);function U(e){return(0,n.mod)(e,l)}function N(e){return U(o.bytesToNumberLE(e))}function C(e){const t=b;e=(0,i.ensureBytes)("private key",e,t);const r=(0,i.ensureBytes)("hashed private key",y(e),2*t),n=B(r.slice(0,t)),o=r.slice(t,2*t),s=N(n),c=L.multiply(s),a=c.toRawBytes();return{head:n,prefix:o,scalar:s,point:c,pointBytes:a}}function D(e=new Uint8Array,...t){const r=o.concatBytes(...t);return N(y(x(r,(0,i.ensureBytes)("context",e),!!h)))}const k=f;return L._setWindowSize(8),{CURVE:t,getPublicKey:function(e){return C(e).pointBytes},sign:function(e,t,n={}){e=(0,i.ensureBytes)("message",e),h&&(e=h(e));const{prefix:s,scalar:c,pointBytes:a}=C(t),d=D(n.context,s,e),u=L.multiply(d).toRawBytes(),f=U(d+D(n.context,u,a,e)*c);T(f);const l=o.concatBytes(u,o.numberToBytesLE(f,r.BYTES));return(0,i.ensureBytes)("result",l,2*b)},verify:function(e,t,n,s=k){const{context:c,zip215:a}=s,d=r.BYTES;e=(0,i.ensureBytes)("signature",e,2*d),t=(0,i.ensureBytes)("message",t),h&&(t=h(t));const u=o.bytesToNumberLE(e.slice(d,2*d));let f,l,y;try{f=P.fromHex(n,a),l=P.fromHex(e.slice(0,d),a),y=L.multiplyUnsafe(u)}catch(e){return!1}if(!a&&f.isSmallOrder())return!1;const p=D(c,l.toRawBytes(),f.toRawBytes(),t);return l.add(f.multiplyUnsafe(p)).subtract(y).clearCofactor().equals(P.ZERO)},ExtendedPoint:P,utils:{getExtendedPublicKey:C,randomPrivateKey:()=>p(r.BYTES),precompute:(e=8,t=P.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}}},211:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createHasher=t.isogenyMap=t.hash_to_field=t.expand_message_xof=t.expand_message_xmd=void 0;const n=r(625),o=r(242),i=o.bytesToNumberBE;function s(e,t){if(e<0||e>=1<<8*t)throw new Error(`bad I2OSP call: value=${e} length=${t}`);const r=Array.from({length:t}).fill(0);for(let n=t-1;n>=0;n--)r[n]=255&e,e>>>=8;return new Uint8Array(r)}function c(e,t){const r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e[n]^t[n];return r}function a(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected")}function d(e){if(!Number.isSafeInteger(e))throw new Error("number expected")}function u(e,t,r,n){a(e),a(t),d(r),t.length>255&&(t=n((0,o.concatBytes)((0,o.utf8ToBytes)("H2C-OVERSIZE-DST-"),t)));const{outputLen:i,blockLen:u}=n,f=Math.ceil(r/i);if(f>255)throw new Error("Invalid xmd length");const l=(0,o.concatBytes)(t,s(t.length,1)),h=s(0,u),y=s(r,2),p=new Array(f),b=n((0,o.concatBytes)(h,e,y,s(0,1),l));p[0]=n((0,o.concatBytes)(b,s(1,1),l));for(let e=1;e<=f;e++){const t=[c(b,p[e-1]),s(e+1,1),l];p[e]=n((0,o.concatBytes)(...t))}return(0,o.concatBytes)(...p).slice(0,r)}function f(e,t,r,n,i){if(a(e),a(t),d(r),t.length>255){const e=Math.ceil(2*n/8);t=i.create({dkLen:e}).update((0,o.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(t).digest()}if(r>65535||t.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:r}).update(e).update(s(r,2)).update(t).update(s(t.length,1)).digest()}function l(e,t,r){(0,o.validateObject)(r,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:s,k:c,m:l,hash:h,expand:y,DST:p}=r;a(e),d(t);const b=function(e){if(e instanceof Uint8Array)return e;if("string"==typeof e)return(0,o.utf8ToBytes)(e);throw new Error("DST must be Uint8Array or string")}(p),g=s.toString(2).length,w=Math.ceil((g+c)/8),m=t*l*w;let E;if("xmd"===y)E=u(e,b,m,h);else if("xof"===y)E=f(e,b,m,c,h);else{if("_internal_pass"!==y)throw new Error('expand must be "xmd" or "xof"');E=e}const B=new Array(t);for(let e=0;e<t;e++){const t=new Array(l);for(let r=0;r<l;r++){const o=w*(r+e*l),c=E.subarray(o,o+w);t[r]=(0,n.mod)(i(c),s)}B[e]=t}return B}t.expand_message_xmd=u,t.expand_message_xof=f,t.hash_to_field=l,t.isogenyMap=function(e,t){const r=t.map((e=>Array.from(e).reverse()));return(t,n)=>{const[o,i,s,c]=r.map((r=>r.reduce(((r,n)=>e.add(e.mul(r,t),n)))));return t=e.div(o,i),n=e.mul(n,e.div(s,c)),{x:t,y:n}}},t.createHasher=function(e,t,r){if("function"!=typeof t)throw new Error("mapToCurve() must be defined");return{hashToCurve(n,o){const i=l(n,2,{...r,DST:r.DST,...o}),s=e.fromAffine(t(i[0])),c=e.fromAffine(t(i[1])),a=s.add(c).clearCofactor();return a.assertValidity(),a},encodeToCurve(n,o){const i=l(n,1,{...r,DST:r.encodeDST,...o}),s=e.fromAffine(t(i[0])).clearCofactor();return s.assertValidity(),s}}}},625:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mapHashToField=t.getMinHashLength=t.getFieldBytesLength=t.hashToPrivateScalar=t.FpSqrtEven=t.FpSqrtOdd=t.Field=t.nLength=t.FpIsSquare=t.FpDiv=t.FpInvertBatch=t.FpPow=t.validateField=t.isNegativeLE=t.FpSqrt=t.tonelliShanks=t.invert=t.pow2=t.pow=t.mod=void 0;const n=r(242),o=BigInt(0),i=BigInt(1),s=BigInt(2),c=BigInt(3),a=BigInt(4),d=BigInt(5),u=BigInt(8);function f(e,t){const r=e%t;return r>=o?r:t+r}function l(e,t,r){if(r<=o||t<o)throw new Error("Expected power/modulo > 0");if(r===i)return o;let n=i;for(;t>o;)t&i&&(n=n*e%r),e=e*e%r,t>>=i;return n}function h(e,t){if(e===o||t<=o)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=f(e,t),n=t,s=o,c=i,a=i,d=o;for(;r!==o;){const e=n/r,t=n%r,o=s-a*e,i=c-d*e;n=r,r=t,s=a,c=d,a=o,d=i}if(n!==i)throw new Error("invert: does not exist");return f(s,t)}function y(e){const t=(e-i)/s;let r,n,c;for(r=e-i,n=0;r%s===o;r/=s,n++);for(c=s;c<e&&l(c,t,e)!==e-i;c++);if(1===n){const t=(e+i)/a;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}const d=(r+i)/s;return function(e,o){if(e.pow(o,t)===e.neg(e.ONE))throw new Error("Cannot find square root");let s=n,a=e.pow(e.mul(e.ONE,c),r),u=e.pow(o,d),f=e.pow(o,r);for(;!e.eql(f,e.ONE);){if(e.eql(f,e.ZERO))return e.ZERO;let t=1;for(let r=e.sqr(f);t<s&&!e.eql(r,e.ONE);t++)r=e.sqr(r);const r=e.pow(a,i<<BigInt(s-t-1));a=e.sqr(r),u=e.mul(u,r),f=e.mul(f,a),s=t}return u}}function p(e){if(e%a===c){const t=(e+i)/a;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}if(e%u===d){const t=(e-d)/u;return function(e,r){const n=e.mul(r,s),o=e.pow(n,t),i=e.mul(r,o),c=e.mul(e.mul(i,s),o),a=e.mul(i,e.sub(c,e.ONE));if(!e.eql(e.sqr(a),r))throw new Error("Cannot find square root");return a}}return y(e)}BigInt(9),BigInt(16),t.mod=f,t.pow=l,t.pow2=function(e,t,r){let n=e;for(;t-- >o;)n*=n,n%=r;return n},t.invert=h,t.tonelliShanks=y,t.FpSqrt=p,t.isNegativeLE=(e,t)=>(f(e,t)&i)===i;const b=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function g(e,t,r){if(r<o)throw new Error("Expected power > 0");if(r===o)return e.ONE;if(r===i)return t;let n=e.ONE,s=t;for(;r>o;)r&i&&(n=e.mul(n,s)),s=e.sqr(s),r>>=i;return n}function w(e,t){const r=new Array(t.length),n=t.reduce(((t,n,o)=>e.is0(n)?t:(r[o]=t,e.mul(t,n))),e.ONE),o=e.inv(n);return t.reduceRight(((t,n,o)=>e.is0(n)?t:(r[o]=e.mul(t,r[o]),e.mul(t,n))),o),r}function m(e,t){const r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function E(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function B(e){const t=E(e);return t+Math.ceil(t/2)}t.validateField=function(e){const t=b.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,n.validateObject)(e,t)},t.FpPow=g,t.FpInvertBatch=w,t.FpDiv=function(e,t,r){return e.mul(t,"bigint"==typeof r?h(r,e.ORDER):e.inv(r))},t.FpIsSquare=function(e){const t=(e.ORDER-i)/s;return r=>{const n=e.pow(r,t);return e.eql(n,e.ZERO)||e.eql(n,e.ONE)}},t.nLength=m,t.Field=function(e,t,r=!1,s={}){if(e<=o)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:c,nByteLength:a}=m(e,t);if(a>2048)throw new Error("Field lengths over 2048 bytes are not supported");const d=p(e),u=Object.freeze({ORDER:e,BITS:c,BYTES:a,MASK:(0,n.bitMask)(c),ZERO:o,ONE:i,create:t=>f(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return o<=t&&t<e},is0:e=>e===o,isOdd:e=>(e&i)===i,neg:t=>f(-t,e),eql:(e,t)=>e===t,sqr:t=>f(t*t,e),add:(t,r)=>f(t+r,e),sub:(t,r)=>f(t-r,e),mul:(t,r)=>f(t*r,e),pow:(e,t)=>g(u,e,t),div:(t,r)=>f(t*h(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>h(t,e),sqrt:s.sqrt||(e=>d(u,e)),invertBatch:e=>w(u,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?(0,n.numberToBytesLE)(e,a):(0,n.numberToBytesBE)(e,a),fromBytes:e=>{if(e.length!==a)throw new Error(`Fp.fromBytes: expected ${a}, got ${e.length}`);return r?(0,n.bytesToNumberLE)(e):(0,n.bytesToNumberBE)(e)}});return Object.freeze(u)},t.FpSqrtOdd=function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const r=e.sqrt(t);return e.isOdd(r)?r:e.neg(r)},t.FpSqrtEven=function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const r=e.sqrt(t);return e.isOdd(r)?e.neg(r):r},t.hashToPrivateScalar=function(e,t,r=!1){const o=(e=(0,n.ensureBytes)("privateHash",e)).length,s=m(t).nByteLength+8;if(s<24||o<s||o>1024)throw new Error(`hashToPrivateScalar: expected ${s}-1024 bytes of input, got ${o}`);return f(r?(0,n.bytesToNumberLE)(e):(0,n.bytesToNumberBE)(e),t-i)+i},t.getFieldBytesLength=E,t.getMinHashLength=B,t.mapHashToField=function(e,t,r=!1){const o=e.length,s=E(t),c=B(t);if(o<16||o<c||o>1024)throw new Error(`expected ${c}-1024 bytes of input, got ${o}`);const a=f(r?(0,n.bytesToNumberBE)(e):(0,n.bytesToNumberLE)(e),t-i)+i;return r?(0,n.numberToBytesLE)(a,s):(0,n.numberToBytesBE)(a,s)}},607:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.montgomery=void 0;const n=r(625),o=r(242),i=BigInt(0),s=BigInt(1);t.montgomery=function(e){const t=(r=e,(0,o.validateObject)(r,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...r}));var r;const{P:c}=t,a=e=>(0,n.mod)(e,c),d=t.montgomeryBits,u=Math.ceil(d/8),f=t.nByteLength,l=t.adjustScalarBytes||(e=>e),h=t.powPminus2||(e=>(0,n.pow)(e,c-BigInt(2),c));function y(e,t,r){const n=a(e*(t-r));return[t=a(t-n),r=a(r+n)]}function p(e){if("bigint"==typeof e&&i<=e&&e<c)return e;throw new Error("Expected valid scalar 0 < scalar < CURVE.P")}const b=(t.a-BigInt(2))/BigInt(4);function g(e){return(0,o.numberToBytesLE)(a(e),u)}function w(e,t){const r=function(e){const t=(0,o.ensureBytes)("u coordinate",e,u);return f===u&&(t[f-1]&=127),(0,o.bytesToNumberLE)(t)}(t),n=function(e,t){const r=p(e),n=p(t),o=r;let c,u=s,f=i,l=r,g=s,w=i;for(let e=BigInt(d-1);e>=i;e--){const t=n>>e&s;w^=t,c=y(w,u,l),u=c[0],l=c[1],c=y(w,f,g),f=c[0],g=c[1],w=t;const r=u+f,i=a(r*r),d=u-f,h=a(d*d),p=i-h,m=l+g,E=a((l-g)*r),B=a(m*d),x=E+B,v=E-B;l=a(x*x),g=a(o*a(v*v)),u=a(i*h),f=a(p*(i+a(b*p)))}c=y(w,u,l),u=c[0],l=c[1],c=y(w,f,g),f=c[0],g=c[1];const m=h(f);return a(u*m)}(r,function(e){const t=(0,o.ensureBytes)("scalar",e);if(t.length!==u&&t.length!==f)throw new Error(`Expected ${u} or ${f} bytes, got ${t.length}`);return(0,o.bytesToNumberLE)(l(t))}(e));if(n===i)throw new Error("Invalid private or public key received");return g(n)}const m=g(t.Gu);function E(e){return w(e,m)}return{scalarMult:w,scalarMultBase:E,getSharedSecret:(e,t)=>w(e,t),getPublicKey:e=>E(e),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:m}}},242:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateObject=t.createHmacDrbg=t.bitMask=t.bitSet=t.bitGet=t.bitLen=t.utf8ToBytes=t.equalBytes=t.concatBytes=t.ensureBytes=t.numberToVarBytesBE=t.numberToBytesLE=t.numberToBytesBE=t.bytesToNumberLE=t.bytesToNumberBE=t.hexToBytes=t.hexToNumber=t.numberToHexUnpadded=t.bytesToHex=void 0;const r=BigInt(0),n=BigInt(1),o=BigInt(2),i=e=>e instanceof Uint8Array,s=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function c(e){if(!i(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=s[e[r]];return t}function a(e){const t=e.toString(16);return 1&t.length?`0${t}`:t}function d(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}function u(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(t/2);for(let t=0;t<r.length;t++){const n=2*t,o=e.slice(n,n+2),i=Number.parseInt(o,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");r[t]=i}return r}function f(e,t){return u(e.toString(16).padStart(2*t,"0"))}function l(...e){const t=new Uint8Array(e.reduce(((e,t)=>e+t.length),0));let r=0;return e.forEach((e=>{if(!i(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length})),t}t.bytesToHex=c,t.numberToHexUnpadded=a,t.hexToNumber=d,t.hexToBytes=u,t.bytesToNumberBE=function(e){return d(c(e))},t.bytesToNumberLE=function(e){if(!i(e))throw new Error("Uint8Array expected");return d(c(Uint8Array.from(e).reverse()))},t.numberToBytesBE=f,t.numberToBytesLE=function(e,t){return f(e,t).reverse()},t.numberToVarBytesBE=function(e){return u(a(e))},t.ensureBytes=function(e,t,r){let n;if("string"==typeof t)try{n=u(t)}catch(r){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${r}`)}else{if(!i(t))throw new Error(`${e} must be hex string or Uint8Array`);n=Uint8Array.from(t)}const o=n.length;if("number"==typeof r&&o!==r)throw new Error(`${e} expected ${r} bytes, got ${o}`);return n},t.concatBytes=l,t.equalBytes=function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},t.utf8ToBytes=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))},t.bitLen=function(e){let t;for(t=0;e>r;e>>=n,t+=1);return t},t.bitGet=function(e,t){return e>>BigInt(t)&n},t.bitSet=(e,t,o)=>e|(o?n:r)<<BigInt(t),t.bitMask=e=>(o<<BigInt(e-1))-n;const h=e=>new Uint8Array(e),y=e=>Uint8Array.from(e);t.createHmacDrbg=function(e,t,r){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");let n=h(e),o=h(e),i=0;const s=()=>{n.fill(1),o.fill(0),i=0},c=(...e)=>r(o,n,...e),a=(e=h())=>{o=c(y([0]),e),n=c(),0!==e.length&&(o=c(y([1]),e),n=c())},d=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e<t;){n=c();const t=n.slice();r.push(t),e+=n.length}return l(...r)};return(e,t)=>{let r;for(s(),a(e);!(r=t(d()));)a();return s(),r}};const p={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};t.validateObject=function(e,t,r={}){const n=(t,r,n)=>{const o=p[r];if("function"!=typeof o)throw new Error(`Invalid validator "${r}", expected function`);const i=e[t];if(!(n&&void 0===i||o(i,e)))throw new Error(`Invalid param ${String(t)}=${i} (${typeof i}), expected ${r}`)};for(const[e,r]of Object.entries(t))n(e,r,!1);for(const[e,t]of Object.entries(r))n(e,t,!0);return e}},86:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mapToCurveSimpleSWU=t.SWUFpSqrtRatio=t.weierstrass=t.weierstrassPoints=t.DER=void 0;const n=r(625),o=r(242),i=r(242),s=r(16),{bytesToNumberBE:c,hexToBytes:a}=o;t.DER={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:r}=t.DER;if(e.length<2||2!==e[0])throw new r("Invalid signature integer tag");const n=e[1],o=e.subarray(2,n+2);if(!n||o.length!==n)throw new r("Invalid signature integer: wrong length");if(128&o[0])throw new r("Invalid signature integer: negative");if(0===o[0]&&!(128&o[1]))throw new r("Invalid signature integer: unnecessary leading zero");return{d:c(o),l:e.subarray(n+2)}},toSig(e){const{Err:r}=t.DER,n="string"==typeof e?a(e):e;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let o=n.length;if(o<2||48!=n[0])throw new r("Invalid signature tag");if(n[1]!==o-2)throw new r("Invalid signature: incorrect length");const{d:i,l:s}=t.DER._parseInt(n.subarray(2)),{d:c,l:d}=t.DER._parseInt(s);if(d.length)throw new r("Invalid signature: left bytes after parsing");return{r:i,s:c}},hexFromSig(e){const t=e=>8&Number.parseInt(e[0],16)?"00"+e:e,r=e=>{const t=e.toString(16);return 1&t.length?`0${t}`:t},n=t(r(e.s)),o=t(r(e.r)),i=n.length/2,s=o.length/2,c=r(i),a=r(s);return`30${r(s+i+4)}02${a}${o}02${c}${n}`}};const d=BigInt(0),u=BigInt(1),f=BigInt(2),l=BigInt(3),h=BigInt(4);function y(e){const t=function(e){const t=(0,s.validateBasic)(e);o.validateObject(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:i}=t;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:r}=t,c=t.toBytes||((e,t,n)=>{const i=t.toAffine();return o.concatBytes(Uint8Array.from([4]),r.toBytes(i.x),r.toBytes(i.y))}),a=t.fromBytes||(e=>{const t=e.subarray(1);return{x:r.fromBytes(t.subarray(0,r.BYTES)),y:r.fromBytes(t.subarray(r.BYTES,2*r.BYTES))}});function f(e){const{a:n,b:o}=t,i=r.sqr(e),s=r.mul(i,e);return r.add(r.add(s,r.mul(e,n)),o)}if(!r.eql(r.sqr(t.Gy),f(t.Gx)))throw new Error("bad generator point: equation left != right");function h(e){return"bigint"==typeof e&&d<e&&e<t.n}function y(e){if(!h(e))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function p(e){const{allowedPrivateKeyLengths:r,nByteLength:s,wrapPrivateKey:c,n:a}=t;if(r&&"bigint"!=typeof e){if(e instanceof Uint8Array&&(e=o.bytesToHex(e)),"string"!=typeof e||!r.includes(e.length))throw new Error("Invalid key");e=e.padStart(2*s,"0")}let d;try{d="bigint"==typeof e?e:o.bytesToNumberBE((0,i.ensureBytes)("private key",e,s))}catch(t){throw new Error(`private key must be ${s} bytes, hex or bigint, not ${typeof e}`)}return c&&(d=n.mod(d,a)),y(d),d}const b=new Map;function g(e){if(!(e instanceof w))throw new Error("ProjectivePoint expected")}class w{constructor(e,t,n){if(this.px=e,this.py=t,this.pz=n,null==e||!r.isValid(e))throw new Error("x required");if(null==t||!r.isValid(t))throw new Error("y required");if(null==n||!r.isValid(n))throw new Error("z required")}static fromAffine(e){const{x:t,y:n}=e||{};if(!e||!r.isValid(t)||!r.isValid(n))throw new Error("invalid affine point");if(e instanceof w)throw new Error("projective point not allowed");const o=e=>r.eql(e,r.ZERO);return o(t)&&o(n)?w.ZERO:new w(t,n,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=r.invertBatch(e.map((e=>e.pz)));return e.map(((e,r)=>e.toAffine(t[r]))).map(w.fromAffine)}static fromHex(e){const t=w.fromAffine(a((0,i.ensureBytes)("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return w.BASE.multiply(p(e))}_setWindowSize(e){this._WINDOW_SIZE=e,b.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:e,y:n}=this.toAffine();if(!r.isValid(e)||!r.isValid(n))throw new Error("bad point: x or y not FE");const o=r.sqr(n),i=f(e);if(!r.eql(o,i))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:e}=this.toAffine();if(r.isOdd)return!r.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){g(e);const{px:t,py:n,pz:o}=this,{px:i,py:s,pz:c}=e,a=r.eql(r.mul(t,c),r.mul(i,o)),d=r.eql(r.mul(n,c),r.mul(s,o));return a&&d}negate(){return new w(this.px,r.neg(this.py),this.pz)}double(){const{a:e,b:n}=t,o=r.mul(n,l),{px:i,py:s,pz:c}=this;let a=r.ZERO,d=r.ZERO,u=r.ZERO,f=r.mul(i,i),h=r.mul(s,s),y=r.mul(c,c),p=r.mul(i,s);return p=r.add(p,p),u=r.mul(i,c),u=r.add(u,u),a=r.mul(e,u),d=r.mul(o,y),d=r.add(a,d),a=r.sub(h,d),d=r.add(h,d),d=r.mul(a,d),a=r.mul(p,a),u=r.mul(o,u),y=r.mul(e,y),p=r.sub(f,y),p=r.mul(e,p),p=r.add(p,u),u=r.add(f,f),f=r.add(u,f),f=r.add(f,y),f=r.mul(f,p),d=r.add(d,f),y=r.mul(s,c),y=r.add(y,y),f=r.mul(y,p),a=r.sub(a,f),u=r.mul(y,h),u=r.add(u,u),u=r.add(u,u),new w(a,d,u)}add(e){g(e);const{px:n,py:o,pz:i}=this,{px:s,py:c,pz:a}=e;let d=r.ZERO,u=r.ZERO,f=r.ZERO;const h=t.a,y=r.mul(t.b,l);let p=r.mul(n,s),b=r.mul(o,c),m=r.mul(i,a),E=r.add(n,o),B=r.add(s,c);E=r.mul(E,B),B=r.add(p,b),E=r.sub(E,B),B=r.add(n,i);let x=r.add(s,a);return B=r.mul(B,x),x=r.add(p,m),B=r.sub(B,x),x=r.add(o,i),d=r.add(c,a),x=r.mul(x,d),d=r.add(b,m),x=r.sub(x,d),f=r.mul(h,B),d=r.mul(y,m),f=r.add(d,f),d=r.sub(b,f),f=r.add(b,f),u=r.mul(d,f),b=r.add(p,p),b=r.add(b,p),m=r.mul(h,m),B=r.mul(y,B),b=r.add(b,m),m=r.sub(p,m),m=r.mul(h,m),B=r.add(B,m),p=r.mul(b,B),u=r.add(u,p),p=r.mul(x,B),d=r.mul(E,d),d=r.sub(d,p),p=r.mul(E,b),f=r.mul(x,f),f=r.add(f,p),new w(d,u,f)}subtract(e){return this.add(e.negate())}is0(){return this.equals(w.ZERO)}wNAF(e){return E.wNAFCached(this,b,e,(e=>{const t=r.invertBatch(e.map((e=>e.pz)));return e.map(((e,r)=>e.toAffine(t[r]))).map(w.fromAffine)}))}multiplyUnsafe(e){const n=w.ZERO;if(e===d)return n;if(y(e),e===u)return this;const{endo:o}=t;if(!o)return E.unsafeLadder(this,e);let{k1neg:i,k1:s,k2neg:c,k2:a}=o.splitScalar(e),f=n,l=n,h=this;for(;s>d||a>d;)s&u&&(f=f.add(h)),a&u&&(l=l.add(h)),h=h.double(),s>>=u,a>>=u;return i&&(f=f.negate()),c&&(l=l.negate()),l=new w(r.mul(l.px,o.beta),l.py,l.pz),f.add(l)}multiply(e){y(e);let n,o,i=e;const{endo:s}=t;if(s){const{k1neg:e,k1:t,k2neg:c,k2:a}=s.splitScalar(i);let{p:d,f:u}=this.wNAF(t),{p:f,f:l}=this.wNAF(a);d=E.constTimeNegate(e,d),f=E.constTimeNegate(c,f),f=new w(r.mul(f.px,s.beta),f.py,f.pz),n=d.add(f),o=u.add(l)}else{const{p:e,f:t}=this.wNAF(i);n=e,o=t}return w.normalizeZ([n,o])[0]}multiplyAndAddUnsafe(e,t,r){const n=w.BASE,o=(e,t)=>t!==d&&t!==u&&e.equals(n)?e.multiply(t):e.multiplyUnsafe(t),i=o(this,t).add(o(e,r));return i.is0()?void 0:i}toAffine(e){const{px:t,py:n,pz:o}=this,i=this.is0();null==e&&(e=i?r.ONE:r.inv(o));const s=r.mul(t,e),c=r.mul(n,e),a=r.mul(o,e);if(i)return{x:r.ZERO,y:r.ZERO};if(!r.eql(a,r.ONE))throw new Error("invZ was invalid");return{x:s,y:c}}isTorsionFree(){const{h:e,isTorsionFree:r}=t;if(e===u)return!0;if(r)return r(w,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:r}=t;return e===u?this:r?r(w,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return this.assertValidity(),c(w,this,e)}toHex(e=!0){return o.bytesToHex(this.toRawBytes(e))}}w.BASE=new w(t.Gx,t.Gy,r.ONE),w.ZERO=new w(r.ZERO,r.ONE,r.ZERO);const m=t.nBitLength,E=(0,s.wNAF)(w,t.endo?Math.ceil(m/2):m);return{CURVE:t,ProjectivePoint:w,normPrivateKeyToScalar:p,weierstrassEquation:f,isWithinCurveOrder:h}}function p(e,t){const r=e.ORDER;let n=d;for(let e=r-u;e%f===d;e/=f)n+=u;const o=n,i=f<<o-u-u,s=i*f,c=(r-u)/s,a=(c-u)/f,y=s-u,p=i,b=e.pow(t,c),g=e.pow(t,(c+u)/f);let w=(t,r)=>{let n=b,i=e.pow(r,y),s=e.sqr(i);s=e.mul(s,r);let c=e.mul(t,s);c=e.pow(c,a),c=e.mul(c,i),i=e.mul(c,r),s=e.mul(c,t);let d=e.mul(s,i);c=e.pow(d,p);let l=e.eql(c,e.ONE);i=e.mul(s,g),c=e.mul(d,n),s=e.cmov(i,s,l),d=e.cmov(c,d,l);for(let t=o;t>u;t--){let r=t-f;r=f<<r-u;let o=e.pow(d,r);const c=e.eql(o,e.ONE);i=e.mul(s,n),n=e.mul(n,n),o=e.mul(d,n),s=e.cmov(i,s,c),d=e.cmov(o,d,c)}return{isValid:l,value:s}};if(e.ORDER%h===l){const r=(e.ORDER-l)/h,n=e.sqrt(e.neg(t));w=(t,o)=>{let i=e.sqr(o);const s=e.mul(t,o);i=e.mul(i,s);let c=e.pow(i,r);c=e.mul(c,s);const a=e.mul(c,n),d=e.mul(e.sqr(c),o),u=e.eql(d,t);return{isValid:u,value:e.cmov(a,c,u)}}}return w}t.weierstrassPoints=y,t.weierstrass=function(e){const r=function(e){const t=(0,s.validateBasic)(e);return o.validateObject(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:c,n:a}=r,f=c.BYTES+1,l=2*c.BYTES+1;function h(e){return n.mod(e,a)}function p(e){return n.invert(e,a)}const{ProjectivePoint:b,normPrivateKeyToScalar:g,weierstrassEquation:w,isWithinCurveOrder:m}=y({...r,toBytes(e,t,r){const n=t.toAffine(),i=c.toBytes(n.x),s=o.concatBytes;return r?s(Uint8Array.from([t.hasEvenY()?2:3]),i):s(Uint8Array.from([4]),i,c.toBytes(n.y))},fromBytes(e){const t=e.length,r=e[0],n=e.subarray(1);if(t!==f||2!==r&&3!==r){if(t===l&&4===r)return{x:c.fromBytes(n.subarray(0,c.BYTES)),y:c.fromBytes(n.subarray(c.BYTES,2*c.BYTES))};throw new Error(`Point of length ${t} was invalid. Expected ${f} compressed bytes or ${l} uncompressed bytes`)}{const e=o.bytesToNumberBE(n);if(!(d<(i=e)&&i<c.ORDER))throw new Error("Point is not on curve");const t=w(e);let s=c.sqrt(t);return 1==(1&r)!=((s&u)===u)&&(s=c.neg(s)),{x:e,y:s}}var i}}),E=e=>o.bytesToHex(o.numberToBytesBE(e,r.nByteLength));function B(e){return e>a>>u}const x=(e,t,r)=>o.bytesToNumberBE(e.slice(t,r));class v{constructor(e,t,r){this.r=e,this.s=t,this.recovery=r,this.assertValidity()}static fromCompact(e){const t=r.nByteLength;return e=(0,i.ensureBytes)("compactSignature",e,2*t),new v(x(e,0,t),x(e,t,2*t))}static fromDER(e){const{r,s:n}=t.DER.toSig((0,i.ensureBytes)("DER",e));return new v(r,n)}assertValidity(){if(!m(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!m(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(e){return new v(this.r,this.s,e)}recoverPublicKey(e){const{r:t,s:n,recovery:o}=this,s=T((0,i.ensureBytes)("msgHash",e));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const a=2===o||3===o?t+r.n:t;if(a>=c.ORDER)throw new Error("recovery id 2 or 3 invalid");const d=0==(1&o)?"02":"03",u=b.fromHex(d+E(a)),f=p(a),l=h(-s*f),y=h(n*f),g=b.BASE.multiplyAndAddUnsafe(u,l,y);if(!g)throw new Error("point at infinify");return g.assertValidity(),g}hasHighS(){return B(this.s)}normalizeS(){return this.hasHighS()?new v(this.r,h(-this.s),this.recovery):this}toDERRawBytes(){return o.hexToBytes(this.toDERHex())}toDERHex(){return t.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return o.hexToBytes(this.toCompactHex())}toCompactHex(){return E(this.r)+E(this.s)}}const A={isValidPrivateKey(e){try{return g(e),!0}catch(e){return!1}},normPrivateKeyToScalar:g,randomPrivateKey:()=>{const e=n.getMinHashLength(r.n);return n.mapHashToField(r.randomBytes(e),r.n)},precompute:(e=8,t=b.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function S(e){const t=e instanceof Uint8Array,r="string"==typeof e,n=(t||r)&&e.length;return t?n===f||n===l:r?n===2*f||n===2*l:e instanceof b}const _=r.bits2int||function(e){const t=o.bytesToNumberBE(e),n=8*e.length-r.nBitLength;return n>0?t>>BigInt(n):t},T=r.bits2int_modN||function(e){return h(_(e))},O=o.bitMask(r.nBitLength);function I(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(d<=e&&e<O))throw new Error(`bigint expected < 2^${r.nBitLength}`);return o.numberToBytesBE(e,r.nByteLength)}const P={lowS:r.lowS,prehash:!1},L={lowS:r.lowS,prehash:!1};return b.BASE._setWindowSize(8),{CURVE:r,getPublicKey:function(e,t=!0){return b.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,r=!0){if(S(e))throw new Error("first arg must be private key");if(!S(t))throw new Error("second arg must be public key");return b.fromHex(t).multiply(g(e)).toRawBytes(r)},sign:function(e,t,n=P){const{seed:s,k2sig:a}=function(e,t,n=P){if(["recovered","canonical"].some((e=>e in n)))throw new Error("sign() legacy options not supported");const{hash:s,randomBytes:a}=r;let{lowS:f,prehash:l,extraEntropy:y}=n;null==f&&(f=!0),e=(0,i.ensureBytes)("msgHash",e),l&&(e=(0,i.ensureBytes)("prehashed msgHash",s(e)));const w=T(e),E=g(t),x=[I(E),I(w)];if(null!=y){const e=!0===y?a(c.BYTES):y;x.push((0,i.ensureBytes)("extraEntropy",e))}const A=o.concatBytes(...x),S=w;return{seed:A,k2sig:function(e){const t=_(e);if(!m(t))return;const r=p(t),n=b.BASE.multiply(t).toAffine(),o=h(n.x);if(o===d)return;const i=h(r*h(S+o*E));if(i===d)return;let s=(n.x===o?0:2)|Number(n.y&u),c=i;return f&&B(i)&&(c=function(e){return B(e)?h(-e):e}(i),s^=1),new v(o,c,s)}}}(e,t,n),f=r;return o.createHmacDrbg(f.hash.outputLen,f.nByteLength,f.hmac)(s,a)},verify:function(e,n,o,s=L){const c=e;if(n=(0,i.ensureBytes)("msgHash",n),o=(0,i.ensureBytes)("publicKey",o),"strict"in s)throw new Error("options.strict was renamed to lowS");const{lowS:a,prehash:d}=s;let u,f;try{if("string"==typeof c||c instanceof Uint8Array)try{u=v.fromDER(c)}catch(e){if(!(e instanceof t.DER.Err))throw e;u=v.fromCompact(c)}else{if("object"!=typeof c||"bigint"!=typeof c.r||"bigint"!=typeof c.s)throw new Error("PARSE");{const{r:e,s:t}=c;u=new v(e,t)}}f=b.fromHex(o)}catch(e){if("PARSE"===e.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(a&&u.hasHighS())return!1;d&&(n=r.hash(n));const{r:l,s:y}=u,g=T(n),w=p(y),m=h(g*w),E=h(l*w),B=b.BASE.multiplyAndAddUnsafe(f,m,E)?.toAffine();return!!B&&h(B.x)===l},ProjectivePoint:b,Signature:v,utils:A}},t.SWUFpSqrtRatio=p,t.mapToCurveSimpleSWU=function(e,t){if(n.validateField(e),!e.isValid(t.A)||!e.isValid(t.B)||!e.isValid(t.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const r=p(e,t.Z);if(!e.isOdd)throw new Error("Fp.isOdd is not implemented!");return n=>{let o,i,s,c,a,d,u,f;o=e.sqr(n),o=e.mul(o,t.Z),i=e.sqr(o),i=e.add(i,o),s=e.add(i,e.ONE),s=e.mul(s,t.B),c=e.cmov(t.Z,e.neg(i),!e.eql(i,e.ZERO)),c=e.mul(c,t.A),i=e.sqr(s),d=e.sqr(c),a=e.mul(d,t.A),i=e.add(i,a),i=e.mul(i,s),d=e.mul(d,c),a=e.mul(d,t.B),i=e.add(i,a),u=e.mul(o,s);const{isValid:l,value:h}=r(i,d);f=e.mul(o,n),f=e.mul(f,h),u=e.cmov(u,s,l),f=e.cmov(f,h,l);const y=e.isOdd(n)===e.isOdd(f);return f=e.cmov(e.neg(f),f,y),u=e.div(u,c),{x:u,y:f}}}},228:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.hash_to_ristretto255=t.hashToRistretto255=t.RistrettoPoint=t.encodeToCurve=t.hashToCurve=t.edwardsToMontgomeryPriv=t.edwardsToMontgomery=t.edwardsToMontgomeryPub=t.x25519=t.ed25519ph=t.ed25519ctx=t.ed25519=t.ED25519_TORSION_SUBGROUP=void 0;const n=r(724),o=r(26),i=r(265),s=r(607),c=r(625),a=r(242),d=r(211),u=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),f=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),l=BigInt(0),h=BigInt(1),y=BigInt(2),p=BigInt(5),b=BigInt(10),g=BigInt(20),w=BigInt(40),m=BigInt(80);function E(e){const t=u,r=e*e%t*e%t,n=(0,c.pow2)(r,y,t)*r%t,o=(0,c.pow2)(n,h,t)*e%t,i=(0,c.pow2)(o,p,t)*o%t,s=(0,c.pow2)(i,b,t)*i%t,a=(0,c.pow2)(s,g,t)*s%t,d=(0,c.pow2)(a,w,t)*a%t,f=(0,c.pow2)(d,m,t)*d%t,l=(0,c.pow2)(f,m,t)*d%t,E=(0,c.pow2)(l,b,t)*i%t;return{pow_p_5_8:(0,c.pow2)(E,y,t)*e%t,b2:r}}function B(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function x(e,t){const r=u,n=(0,c.mod)(t*t*t,r),o=E(e*(0,c.mod)(n*n*t,r)).pow_p_5_8;let i=(0,c.mod)(e*n*o,r);const s=(0,c.mod)(t*i*i,r),a=i,d=(0,c.mod)(i*f,r),l=s===e,h=s===(0,c.mod)(-e,r),y=s===(0,c.mod)(-e*f,r);return l&&(i=a),(h||y)&&(i=d),(0,c.isNegativeLE)(i,r)&&(i=(0,c.mod)(-i,r)),{isValid:l||h,value:i}}t.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];const v=(0,c.Field)(u,void 0,!0),A={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:v,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:n.sha512,randomBytes:o.randomBytes,adjustScalarBytes:B,uvRatio:x};function S(e,t,r){if(t.length>255)throw new Error("Context is too big");return(0,o.concatBytes)((0,o.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,t.length]),t,e)}function _(e){const{y:r}=t.ed25519.ExtendedPoint.fromHex(e),n=BigInt(1);return v.toBytes(v.create((n+r)*v.inv(n-r)))}t.ed25519=(0,i.twistedEdwards)(A),t.ed25519ctx=(0,i.twistedEdwards)({...A,domain:S}),t.ed25519ph=(0,i.twistedEdwards)({...A,domain:S,prehash:n.sha512}),t.x25519=(0,s.montgomery)({P:u,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{const t=u,{pow_p_5_8:r,b2:n}=E(e);return(0,c.mod)((0,c.pow2)(r,BigInt(3),t)*n,t)},adjustScalarBytes:B,randomBytes:o.randomBytes}),t.edwardsToMontgomeryPub=_,t.edwardsToMontgomery=_,t.edwardsToMontgomeryPriv=function(e){const t=A.hash(e.subarray(0,32));return A.adjustScalarBytes(t).subarray(0,32)};const T=(v.ORDER+BigInt(3))/BigInt(8),O=v.pow(y,T),I=v.sqrt(v.neg(v.ONE)),P=(v.ORDER-BigInt(5))/BigInt(8),L=BigInt(486662),H=(0,c.FpSqrtEven)(v,v.neg(BigInt(486664)));const R=(()=>(0,d.createHasher)(t.ed25519.ExtendedPoint,(e=>function(e){const{xMn:t,xMd:r,yMn:n,yMd:o}=function(e){let t=v.sqr(e);t=v.mul(t,y);let r=v.add(t,v.ONE),n=v.neg(L),o=v.sqr(r),i=v.mul(o,r),s=v.mul(t,L);s=v.mul(s,n),s=v.add(s,o),s=v.mul(s,n);let c=v.sqr(i);o=v.sqr(c),c=v.mul(c,i),c=v.mul(c,s),o=v.mul(o,c);let a=v.pow(o,P);a=v.mul(a,c);let d=v.mul(a,I);o=v.sqr(a),o=v.mul(o,i);let u=v.eql(o,s),f=v.cmov(d,a,u),l=v.mul(n,t),p=v.mul(a,e);p=v.mul(p,O);let b=v.mul(p,I),g=v.mul(s,t);o=v.sqr(p),o=v.mul(o,i);let w=v.eql(o,g),m=v.cmov(b,p,w);o=v.sqr(f),o=v.mul(o,i);let E=v.eql(o,s),B=v.cmov(l,n,E),x=v.cmov(m,f,E),A=v.isOdd(x);return x=v.cmov(x,v.neg(x),E!==A),{xMn:B,xMd:r,yMn:x,yMd:h}}(e);let i=v.mul(t,o);i=v.mul(i,H);let s=v.mul(r,n),c=v.sub(t,r),a=v.add(t,r),d=v.mul(s,a),u=v.eql(d,v.ZERO);i=v.cmov(i,v.ZERO,u),s=v.cmov(s,v.ONE,u),c=v.cmov(c,v.ONE,u),a=v.cmov(a,v.ONE,u);const f=v.invertBatch([s,a]);return{x:v.mul(i,f[0]),y:v.mul(c,f[1])}}(e[0])),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:v.ORDER,m:1,k:128,expand:"xmd",hash:n.sha512}))();function U(e){if(!(e instanceof V))throw new Error("RistrettoPoint expected")}t.hashToCurve=R.hashToCurve,t.encodeToCurve=R.encodeToCurve;const N=f,C=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),D=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),k=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),q=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),F=e=>x(h,e),j=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),M=e=>t.ed25519.CURVE.Fp.create((0,a.bytesToNumberLE)(e)&j);function $(e){const{d:r}=t.ed25519.CURVE,n=t.ed25519.CURVE.Fp.ORDER,o=t.ed25519.CURVE.Fp.create,i=o(N*e*e),s=o((i+h)*k);let a=BigInt(-1);const d=o((a-r*i)*o(i+r));let{isValid:u,value:f}=x(s,d),l=o(f*e);(0,c.isNegativeLE)(l,n)||(l=o(-l)),u||(f=l),u||(a=i);const y=o(a*(i-h)*q-d),p=f*f,b=o((f+f)*d),g=o(y*C),w=o(h-p),m=o(h+p);return new t.ed25519.ExtendedPoint(o(b*m),o(w*g),o(g*m),o(b*w))}class V{constructor(e){this.ep=e}static fromAffine(e){return new V(t.ed25519.ExtendedPoint.fromAffine(e))}static hashToCurve(e){e=(0,a.ensureBytes)("ristrettoHash",e,64);const t=$(M(e.slice(0,32))),r=$(M(e.slice(32,64)));return new V(t.add(r))}static fromHex(e){e=(0,a.ensureBytes)("ristrettoHex",e,32);const{a:r,d:n}=t.ed25519.CURVE,o=t.ed25519.CURVE.Fp.ORDER,i=t.ed25519.CURVE.Fp.create,s="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",d=M(e);if(!(0,a.equalBytes)((0,a.numberToBytesLE)(d,32),e)||(0,c.isNegativeLE)(d,o))throw new Error(s);const u=i(d*d),f=i(h+r*u),y=i(h-r*u),p=i(f*f),b=i(y*y),g=i(r*n*p-b),{isValid:w,value:m}=F(i(g*b)),E=i(m*y),B=i(m*E*g);let x=i((d+d)*E);(0,c.isNegativeLE)(x,o)&&(x=i(-x));const v=i(f*B),A=i(x*v);if(!w||(0,c.isNegativeLE)(A,o)||v===l)throw new Error(s);return new V(new t.ed25519.ExtendedPoint(x,v,h,A))}toRawBytes(){let{ex:e,ey:r,ez:n,et:o}=this.ep;const i=t.ed25519.CURVE.Fp.ORDER,s=t.ed25519.CURVE.Fp.create,d=s(s(n+r)*s(n-r)),u=s(e*r),f=s(u*u),{value:l}=F(s(d*f)),h=s(l*d),y=s(l*u),p=s(h*y*o);let b;if((0,c.isNegativeLE)(o*p,i)){let t=s(r*N),n=s(e*N);e=t,r=n,b=s(h*D)}else b=y;(0,c.isNegativeLE)(e*p,i)&&(r=s(-r));let g=s((n-r)*b);return(0,c.isNegativeLE)(g,i)&&(g=s(-g)),(0,a.numberToBytesLE)(g,32)}toHex(){return(0,a.bytesToHex)(this.toRawBytes())}toString(){return this.toHex()}equals(e){U(e);const{ex:r,ey:n}=this.ep,{ex:o,ey:i}=e.ep,s=t.ed25519.CURVE.Fp.create,c=s(r*i)===s(n*o),a=s(n*i)===s(r*o);return c||a}add(e){return U(e),new V(this.ep.add(e.ep))}subtract(e){return U(e),new V(this.ep.subtract(e.ep))}multiply(e){return new V(this.ep.multiply(e))}multiplyUnsafe(e){return new V(this.ep.multiplyUnsafe(e))}}t.RistrettoPoint=(V.BASE||(V.BASE=new V(t.ed25519.ExtendedPoint.BASE)),V.ZERO||(V.ZERO=new V(t.ed25519.ExtendedPoint.ZERO)),V),t.hashToRistretto255=(e,t)=>{const r=t.DST,i="string"==typeof r?(0,o.utf8ToBytes)(r):r,s=(0,d.expand_message_xmd)(e,i,64,n.sha512);return V.hashToCurve(s)},t.hash_to_ristretto255=t.hashToRistretto255},852:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.encodeToCurve=t.hashToCurve=t.schnorr=t.secp256k1=void 0;const n=r(837),o=r(26),i=r(625),s=r(86),c=r(242),a=r(211),d=r(569),u=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),f=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),l=BigInt(1),h=BigInt(2),y=(e,t)=>(e+t/h)/t;function p(e){const t=u,r=BigInt(3),n=BigInt(6),o=BigInt(11),s=BigInt(22),c=BigInt(23),a=BigInt(44),d=BigInt(88),f=e*e*e%t,l=f*f*e%t,y=(0,i.pow2)(l,r,t)*l%t,p=(0,i.pow2)(y,r,t)*l%t,g=(0,i.pow2)(p,h,t)*f%t,w=(0,i.pow2)(g,o,t)*g%t,m=(0,i.pow2)(w,s,t)*w%t,E=(0,i.pow2)(m,a,t)*m%t,B=(0,i.pow2)(E,d,t)*E%t,x=(0,i.pow2)(B,a,t)*m%t,v=(0,i.pow2)(x,r,t)*l%t,A=(0,i.pow2)(v,c,t)*w%t,S=(0,i.pow2)(A,n,t)*f%t,_=(0,i.pow2)(S,h,t);if(!b.eql(b.sqr(_),e))throw new Error("Cannot find square root");return _}const b=(0,i.Field)(u,void 0,void 0,{sqrt:p});t.secp256k1=(0,d.createCurve)({a:BigInt(0),b:BigInt(7),Fp:b,n:f,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=f,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-l*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,c=BigInt("0x100000000000000000000000000000000"),a=y(s*e,t),d=y(-n*e,t);let u=(0,i.mod)(e-a*r-d*o,t),h=(0,i.mod)(-a*n-d*s,t);const p=u>c,b=h>c;if(p&&(u=t-u),b&&(h=t-h),u>c||h>c)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:p,k1:u,k2neg:b,k2:h}}}},n.sha256);const g=BigInt(0),w=e=>"bigint"==typeof e&&g<e&&e<u,m=e=>"bigint"==typeof e&&g<e&&e<f,E={};function B(e,...t){let r=E[e];if(void 0===r){const t=(0,n.sha256)(Uint8Array.from(e,(e=>e.charCodeAt(0))));r=(0,c.concatBytes)(t,t),E[e]=r}return(0,n.sha256)((0,c.concatBytes)(r,...t))}const x=e=>e.toRawBytes(!0).slice(1),v=e=>(0,c.numberToBytesBE)(e,32),A=e=>(0,i.mod)(e,u),S=e=>(0,i.mod)(e,f),_=t.secp256k1.ProjectivePoint,T=(e,t,r)=>_.BASE.multiplyAndAddUnsafe(e,t,r);function O(e){let r=t.secp256k1.utils.normPrivateKeyToScalar(e),n=_.fromPrivateKey(r);return{scalar:n.hasEvenY()?r:S(-r),bytes:x(n)}}function I(e){if(!w(e))throw new Error("bad x: need 0 < x < p");const t=A(e*e);let r=p(A(t*e+BigInt(7)));r%h!==g&&(r=A(-r));const n=new _(e,r,l);return n.assertValidity(),n}function P(...e){return S((0,c.bytesToNumberBE)(B("BIP0340/challenge",...e)))}function L(e,t,r){const n=(0,c.ensureBytes)("signature",e,64),o=(0,c.ensureBytes)("message",t),i=(0,c.ensureBytes)("publicKey",r,32);try{const e=I((0,c.bytesToNumberBE)(i)),t=(0,c.bytesToNumberBE)(n.subarray(0,32));if(!w(t))return!1;const r=(0,c.bytesToNumberBE)(n.subarray(32,64));if(!m(r))return!1;const s=P(v(t),x(e),o),a=T(e,r,S(-s));return!(!a||!a.hasEvenY()||a.toAffine().x!==t)}catch(e){return!1}}t.schnorr={getPublicKey:function(e){return O(e).bytes},sign:function(e,t,r=(0,o.randomBytes)(32)){const n=(0,c.ensureBytes)("message",e),{bytes:i,scalar:s}=O(t),a=(0,c.ensureBytes)("auxRand",r,32),d=v(s^(0,c.bytesToNumberBE)(B("BIP0340/aux",a))),u=B("BIP0340/nonce",d,i,n),f=S((0,c.bytesToNumberBE)(u));if(f===g)throw new Error("sign failed: k is zero");const{bytes:l,scalar:h}=O(f),y=P(l,i,n),p=new Uint8Array(64);if(p.set(l,0),p.set(v(S(h+y*s)),32),!L(p,n,i))throw new Error("sign: Invalid signature produced");return p},verify:L,utils:{randomPrivateKey:t.secp256k1.utils.randomPrivateKey,lift_x:I,pointToBytes:x,numberToBytesBE:c.numberToBytesBE,bytesToNumberBE:c.bytesToNumberBE,taggedHash:B,mod:i.mod}};const H=(()=>(0,a.isogenyMap)(b,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map((e=>e.map((e=>BigInt(e)))))))(),R=(()=>(0,s.mapToCurveSimpleSWU)(b,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:b.create(BigInt("-11"))}))(),U=(()=>(0,a.createHasher)(t.secp256k1.ProjectivePoint,(e=>{const{x:t,y:r}=R(b.create(e[0]));return H(t,r)}),{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:b.ORDER,m:1,k:128,expand:"xmd",hash:n.sha256}))();t.hashToCurve=U.hashToCurve,t.encodeToCurve=U.encodeToCurve},630:(e,t)=>{function r(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function n(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)}function o(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function i(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(e.outputLen),r(e.blockLen)}function s(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function c(e,t){o(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}Object.defineProperty(t,"__esModule",{value:!0}),t.output=t.exists=t.hash=t.bytes=t.bool=t.number=void 0,t.number=r,t.bool=n,t.bytes=o,t.hash=i,t.exists=s,t.output=c;const a={number:r,bool:n,bytes:o,hash:i,exists:s,output:c};t.default=a},746:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SHA2=void 0;const n=r(630),o=r(26);class i extends o.Hash{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,o.createView)(this.buffer)}update(e){(0,n.exists)(this);const{view:t,buffer:r,blockLen:i}=this,s=(e=(0,o.toBytes)(e)).length;for(let n=0;n<s;){const c=Math.min(i-this.pos,s-n);if(c!==i)r.set(e.subarray(n,n+c),this.pos),this.pos+=c,n+=c,this.pos===i&&(this.process(t,0),this.pos=0);else{const t=(0,o.createView)(e);for(;i<=s-n;n+=i)this.process(t,n)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,n.exists)(this),(0,n.output)(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:i,isLE:s}=this;let{pos:c}=this;t[c++]=128,this.buffer.subarray(c).fill(0),this.padOffset>i-c&&(this.process(r,0),c=0);for(let e=c;e<i;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const o=BigInt(32),i=BigInt(4294967295),s=Number(r>>o&i),c=Number(r&i),a=n?4:0,d=n?0:4;e.setUint32(t+a,s,n),e.setUint32(t+d,c,n)}(r,i-8,BigInt(8*this.length),s),this.process(r,0);const a=(0,o.createView)(e),d=this.outputLen;if(d%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=d/4,f=this.get();if(u>f.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)a.setUint32(4*e,f[e],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:o,destroyed:i,pos:s}=this;return e.length=n,e.pos=s,e.finished=o,e.destroyed=i,n%t&&e.buffer.set(r),e}}t.SHA2=i},934:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.add5L=t.add5H=t.add4H=t.add4L=t.add3H=t.add3L=t.add=t.rotlBL=t.rotlBH=t.rotlSL=t.rotlSH=t.rotr32L=t.rotr32H=t.rotrBL=t.rotrBH=t.rotrSL=t.rotrSH=t.shrSL=t.shrSH=t.toBig=t.split=t.fromBig=void 0;const r=BigInt(2**32-1),n=BigInt(32);function o(e,t=!1){return t?{h:Number(e&r),l:Number(e>>n&r)}:{h:0|Number(e>>n&r),l:0|Number(e&r)}}function i(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:s,l:c}=o(e[i],t);[r[i],n[i]]=[s,c]}return[r,n]}t.fromBig=o,t.split=i;const s=(e,t)=>BigInt(e>>>0)<<n|BigInt(t>>>0);t.toBig=s;const c=(e,t,r)=>e>>>r;t.shrSH=c;const a=(e,t,r)=>e<<32-r|t>>>r;t.shrSL=a;const d=(e,t,r)=>e>>>r|t<<32-r;t.rotrSH=d;const u=(e,t,r)=>e<<32-r|t>>>r;t.rotrSL=u;const f=(e,t,r)=>e<<64-r|t>>>r-32;t.rotrBH=f;const l=(e,t,r)=>e>>>r-32|t<<64-r;t.rotrBL=l;const h=(e,t)=>t;t.rotr32H=h;const y=(e,t)=>e;t.rotr32L=y;const p=(e,t,r)=>e<<r|t>>>32-r;t.rotlSH=p;const b=(e,t,r)=>t<<r|e>>>32-r;t.rotlSL=b;const g=(e,t,r)=>t<<r-32|e>>>64-r;t.rotlBH=g;const w=(e,t,r)=>e<<r-32|t>>>64-r;function m(e,t,r,n){const o=(t>>>0)+(n>>>0);return{h:e+r+(o/2**32|0)|0,l:0|o}}t.rotlBL=w,t.add=m;const E=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);t.add3L=E;const B=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;t.add3H=B;const x=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);t.add4L=x;const v=(e,t,r,n,o)=>t+r+n+o+(e/2**32|0)|0;t.add4H=v;const A=(e,t,r,n,o)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(o>>>0);t.add5L=A;const S=(e,t,r,n,o,i)=>t+r+n+o+i+(e/2**32|0)|0;t.add5H=S;const _={fromBig:o,split:i,toBig:s,shrSH:c,shrSL:a,rotrSH:d,rotrSL:u,rotrBH:f,rotrBL:l,rotr32H:h,rotr32L:y,rotlSH:p,rotlSL:b,rotlBH:g,rotlBL:w,add:m,add3L:E,add3H:B,add4L:x,add4H:v,add5H:S,add5L:A};t.default=_},531:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},220:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.hmac=t.HMAC=void 0;const n=r(630),o=r(26);class i extends o.Hash{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,(0,n.hash)(e);const r=(0,o.toBytes)(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(r.length>i?e.create().update(r).digest():r);for(let e=0;e<s.length;e++)s[e]^=54;this.iHash.update(s),this.oHash=e.create();for(let e=0;e<s.length;e++)s[e]^=106;this.oHash.update(s),s.fill(0)}update(e){return(0,n.exists)(this),this.iHash.update(e),this}digestInto(e){(0,n.exists)(this),(0,n.bytes)(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:n,destroyed:o,blockLen:i,outputLen:s}=this;return e.finished=n,e.destroyed=o,e.blockLen=i,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}t.HMAC=i,t.hmac=(e,t,r)=>new i(e,t).update(r).digest(),t.hmac.create=(e,t)=>new i(e,t)},479:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ripemd160=t.RIPEMD160=void 0;const n=r(746),o=r(26),i=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),s=Uint8Array.from({length:16},((e,t)=>t));let c=[s],a=[s.map((e=>(9*e+5)%16))];for(let e=0;e<4;e++)for(let t of[c,a])t.push(t[e].map((e=>i[e])));const d=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map((e=>new Uint8Array(e))),u=c.map(((e,t)=>e.map((e=>d[t][e])))),f=a.map(((e,t)=>e.map((e=>d[t][e])))),l=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),h=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),y=(e,t)=>e<<t|e>>>32-t;function p(e,t,r,n){return 0===e?t^r^n:1===e?t&r|~t&n:2===e?(t|~r)^n:3===e?t&n|r&~n:t^(r|~n)}const b=new Uint32Array(16);class g extends n.SHA2{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:r,h3:n,h4:o}=this;return[e,t,r,n,o]}set(e,t,r,n,o){this.h0=0|e,this.h1=0|t,this.h2=0|r,this.h3=0|n,this.h4=0|o}process(e,t){for(let r=0;r<16;r++,t+=4)b[r]=e.getUint32(t,!0);let r=0|this.h0,n=r,o=0|this.h1,i=o,s=0|this.h2,d=s,g=0|this.h3,w=g,m=0|this.h4,E=m;for(let e=0;e<5;e++){const t=4-e,B=l[e],x=h[e],v=c[e],A=a[e],S=u[e],_=f[e];for(let t=0;t<16;t++){const n=y(r+p(e,o,s,g)+b[v[t]]+B,S[t])+m|0;r=m,m=g,g=0|y(s,10),s=o,o=n}for(let e=0;e<16;e++){const r=y(n+p(t,i,d,w)+b[A[e]]+x,_[e])+E|0;n=E,E=w,w=0|y(d,10),d=i,i=r}}this.set(this.h1+s+w|0,this.h2+g+E|0,this.h3+m+n|0,this.h4+r+i|0,this.h0+o+d|0)}roundClean(){b.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}t.RIPEMD160=g,t.ripemd160=(0,o.wrapConstructor)((()=>new g))},837:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sha224=t.sha256=void 0;const n=r(746),o=r(26),i=(e,t,r)=>e&t^e&r^t&r,s=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),c=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64);class d extends n.SHA2{constructor(){super(64,32,8,!1),this.A=0|c[0],this.B=0|c[1],this.C=0|c[2],this.D=0|c[3],this.E=0|c[4],this.F=0|c[5],this.G=0|c[6],this.H=0|c[7]}get(){const{A:e,B:t,C:r,D:n,E:o,F:i,G:s,H:c}=this;return[e,t,r,n,o,i,s,c]}set(e,t,r,n,o,i,s,c){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|c}process(e,t){for(let r=0;r<16;r++,t+=4)a[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=a[e-15],r=a[e-2],n=(0,o.rotr)(t,7)^(0,o.rotr)(t,18)^t>>>3,i=(0,o.rotr)(r,17)^(0,o.rotr)(r,19)^r>>>10;a[e]=i+a[e-7]+n+a[e-16]|0}let{A:r,B:n,C:c,D:d,E:u,F:f,G:l,H:h}=this;for(let e=0;e<64;e++){const t=h+((0,o.rotr)(u,6)^(0,o.rotr)(u,11)^(0,o.rotr)(u,25))+((y=u)&f^~y&l)+s[e]+a[e]|0,p=((0,o.rotr)(r,2)^(0,o.rotr)(r,13)^(0,o.rotr)(r,22))+i(r,n,c)|0;h=l,l=f,f=u,u=d+t|0,d=c,c=n,n=r,r=t+p|0}var y;r=r+this.A|0,n=n+this.B|0,c=c+this.C|0,d=d+this.D|0,u=u+this.E|0,f=f+this.F|0,l=l+this.G|0,h=h+this.H|0,this.set(r,n,c,d,u,f,l,h)}roundClean(){a.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class u extends d{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}t.sha256=(0,o.wrapConstructor)((()=>new d)),t.sha224=(0,o.wrapConstructor)((()=>new u))},724:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sha384=t.sha512_256=t.sha512_224=t.sha512=t.SHA512=void 0;const n=r(746),o=r(934),i=r(26),[s,c]=(()=>o.default.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e=>BigInt(e)))))(),a=new Uint32Array(80),d=new Uint32Array(80);class u extends n.SHA2{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:o,Cl:i,Dh:s,Dl:c,Eh:a,El:d,Fh:u,Fl:f,Gh:l,Gl:h,Hh:y,Hl:p}=this;return[e,t,r,n,o,i,s,c,a,d,u,f,l,h,y,p]}set(e,t,r,n,o,i,s,c,a,d,u,f,l,h,y,p){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|o,this.Cl=0|i,this.Dh=0|s,this.Dl=0|c,this.Eh=0|a,this.El=0|d,this.Fh=0|u,this.Fl=0|f,this.Gh=0|l,this.Gl=0|h,this.Hh=0|y,this.Hl=0|p}process(e,t){for(let r=0;r<16;r++,t+=4)a[r]=e.getUint32(t),d[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|a[e-15],r=0|d[e-15],n=o.default.rotrSH(t,r,1)^o.default.rotrSH(t,r,8)^o.default.shrSH(t,r,7),i=o.default.rotrSL(t,r,1)^o.default.rotrSL(t,r,8)^o.default.shrSL(t,r,7),s=0|a[e-2],c=0|d[e-2],u=o.default.rotrSH(s,c,19)^o.default.rotrBH(s,c,61)^o.default.shrSH(s,c,6),f=o.default.rotrSL(s,c,19)^o.default.rotrBL(s,c,61)^o.default.shrSL(s,c,6),l=o.default.add4L(i,f,d[e-7],d[e-16]),h=o.default.add4H(l,n,u,a[e-7],a[e-16]);a[e]=0|h,d[e]=0|l}let{Ah:r,Al:n,Bh:i,Bl:u,Ch:f,Cl:l,Dh:h,Dl:y,Eh:p,El:b,Fh:g,Fl:w,Gh:m,Gl:E,Hh:B,Hl:x}=this;for(let e=0;e<80;e++){const t=o.default.rotrSH(p,b,14)^o.default.rotrSH(p,b,18)^o.default.rotrBH(p,b,41),v=o.default.rotrSL(p,b,14)^o.default.rotrSL(p,b,18)^o.default.rotrBL(p,b,41),A=p&g^~p&m,S=b&w^~b&E,_=o.default.add5L(x,v,S,c[e],d[e]),T=o.default.add5H(_,B,t,A,s[e],a[e]),O=0|_,I=o.default.rotrSH(r,n,28)^o.default.rotrBH(r,n,34)^o.default.rotrBH(r,n,39),P=o.default.rotrSL(r,n,28)^o.default.rotrBL(r,n,34)^o.default.rotrBL(r,n,39),L=r&i^r&f^i&f,H=n&u^n&l^u&l;B=0|m,x=0|E,m=0|g,E=0|w,g=0|p,w=0|b,({h:p,l:b}=o.default.add(0|h,0|y,0|T,0|O)),h=0|f,y=0|l,f=0|i,l=0|u,i=0|r,u=0|n;const R=o.default.add3L(O,P,H);r=o.default.add3H(R,T,I,L),n=0|R}({h:r,l:n}=o.default.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:u}=o.default.add(0|this.Bh,0|this.Bl,0|i,0|u)),({h:f,l}=o.default.add(0|this.Ch,0|this.Cl,0|f,0|l)),({h,l:y}=o.default.add(0|this.Dh,0|this.Dl,0|h,0|y)),({h:p,l:b}=o.default.add(0|this.Eh,0|this.El,0|p,0|b)),({h:g,l:w}=o.default.add(0|this.Fh,0|this.Fl,0|g,0|w)),({h:m,l:E}=o.default.add(0|this.Gh,0|this.Gl,0|m,0|E)),({h:B,l:x}=o.default.add(0|this.Hh,0|this.Hl,0|B,0|x)),this.set(r,n,i,u,f,l,h,y,p,b,g,w,m,E,B,x)}roundClean(){a.fill(0),d.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}t.SHA512=u;class f extends u{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}class l extends u{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class h extends u{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}t.sha512=(0,i.wrapConstructor)((()=>new u)),t.sha512_224=(0,i.wrapConstructor)((()=>new f)),t.sha512_256=(0,i.wrapConstructor)((()=>new l)),t.sha384=(0,i.wrapConstructor)((()=>new h))},26:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.checkOpts=t.Hash=t.concatBytes=t.toBytes=t.utf8ToBytes=t.asyncLoop=t.nextTick=t.hexToBytes=t.bytesToHex=t.isLE=t.rotr=t.createView=t.u32=t.u8=void 0;const n=r(531),o=e=>e instanceof Uint8Array;if(t.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),t.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),t.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),t.rotr=(e,t)=>e<<32-t|e>>>t,t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!t.isLE)throw new Error("Non little-endian hardware is not supported");const i=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function s(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function c(e){if("string"==typeof e&&(e=s(e)),!o(e))throw new Error("expected Uint8Array, got "+typeof e);return e}t.bytesToHex=function(e){if(!o(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=i[e[r]];return t},t.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(t/2);for(let t=0;t<r.length;t++){const n=2*t,o=e.slice(n,n+2),i=Number.parseInt(o,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");r[t]=i}return r},t.nextTick=async()=>{},t.asyncLoop=async function(e,r,n){let o=Date.now();for(let i=0;i<e;i++){n(i);const e=Date.now()-o;e>=0&&e<r||(await(0,t.nextTick)(),o+=e)}},t.utf8ToBytes=s,t.toBytes=c,t.concatBytes=function(...e){const t=new Uint8Array(e.reduce(((e,t)=>e+t.length),0));let r=0;return e.forEach((e=>{if(!o(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length})),t},t.Hash=class{clone(){return this._cloneInto()}};const a={}.toString;t.checkOpts=function(e,t){if(void 0!==t&&"[object Object]"!==a.call(t))throw new Error("Options should be object or undefined");return Object.assign(e,t)},t.wrapConstructor=function(e){const t=t=>e().update(c(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t},t.wrapConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(c(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.wrapXOFConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(c(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.randomBytes=function(e=32){if(n.crypto&&"function"==typeof n.crypto.getRandomValues)return n.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}},773:(e,t)=>{function r(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function n(...e){const t=(e,t)=>r=>e(t(r));return{encode:Array.from(e).reverse().reduce(((e,r)=>e?t(e,r.encode):r.encode),void 0),decode:e.reduce(((e,r)=>e?t(e,r.decode):r.decode),void 0)}}function o(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map((t=>{if(r(t),t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]}))},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map((t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const r=e.indexOf(t);if(-1===r)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return r}))}}}function i(e=""){if("string"!=typeof e)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(e)}}}function s(e,t="="){if(r(e),"string"!=typeof t)throw new Error("padding chr should be string");return{encode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let e of r)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;r.length*e%8;)r.push(t);return r},decode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let e of r)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);let n=r.length;if(n*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&r[n-1]===t;n--)if(!((n-1)*e%8))throw new Error("Invalid padding: string has too much padding");return r.slice(0,n)}}}function c(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}function a(e,t,n){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let o=0;const i=[],s=Array.from(e);for(s.forEach((e=>{if(r(e),e<0||e>=t)throw new Error(`Wrong integer: ${e}`)}));;){let e=0,r=!0;for(let i=o;i<s.length;i++){const c=s[i],a=t*e+c;if(!Number.isSafeInteger(a)||t*e/t!==e||a-c!=t*e)throw new Error("convertRadix: carry overflow");e=a%n;const d=Math.floor(a/n);if(s[i]=d,!Number.isSafeInteger(d)||d*n+e!==a)throw new Error("convertRadix: carry overflow");r&&(d?r=!1:o=i)}if(i.push(e),r)break}for(let t=0;t<e.length-1&&0===e[t];t++)i.push(0);return i.reverse()}Object.defineProperty(t,"__esModule",{value:!0}),t.bytes=t.stringToBytes=t.str=t.bytesToString=t.hex=t.utf8=t.bech32m=t.bech32=t.base58check=t.base58xmr=t.base58xrp=t.base58flickr=t.base58=t.base64urlnopad=t.base64url=t.base64=t.base32crockford=t.base32hex=t.base32=t.base16=t.utils=t.assertNumber=void 0,t.assertNumber=r;const d=(e,t)=>t?d(t,e%t):e,u=(e,t)=>e+(t-d(e,t));function f(e,t,n,o){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(u(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${u(t,n)}`);let i=0,s=0;const c=2**n-1,a=[];for(const o of e){if(r(o),o>=2**t)throw new Error(`convertRadix2: invalid data word=${o} from=${t}`);if(i=i<<t|o,s+t>32)throw new Error(`convertRadix2: carry overflow pos=${s} from=${t}`);for(s+=t;s>=n;s-=n)a.push((i>>s-n&c)>>>0);i&=2**s-1}if(i=i<<n-s&c,!o&&s>=t)throw new Error("Excess padding");if(!o&&i)throw new Error(`Non-zero padding: ${i}`);return o&&s>0&&a.push(i>>>0),a}function l(e){return r(e),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return a(Array.from(t),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix.decode input should be array of strings");return Uint8Array.from(a(t,e,256))}}}function h(e,t=!1){if(r(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(u(8,e)>32||u(e,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!(r instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return f(Array.from(r),8,e,!t)},decode:r=>{if(!Array.isArray(r)||r.length&&"number"!=typeof r[0])throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(f(r,e,8,t))}}}function y(e){if("function"!=typeof e)throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch(e){}}}function p(e,t){if(r(e),"function"!=typeof t)throw new Error("checksum fn should be function");return{encode(r){if(!(r instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");const n=t(r).slice(0,e),o=new Uint8Array(r.length+e);return o.set(r),o.set(n,r.length),o},decode(r){if(!(r instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");const n=r.slice(0,-e),o=t(n).slice(0,e),i=r.slice(-e);for(let t=0;t<e;t++)if(o[t]!==i[t])throw new Error("Invalid checksum");return n}}}t.utils={alphabet:o,chain:n,checksum:p,radix:l,radix2:h,join:i,padding:s},t.base16=n(h(4),o("0123456789ABCDEF"),i("")),t.base32=n(h(5),o("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),s(5),i("")),t.base32hex=n(h(5),o("0123456789ABCDEFGHIJKLMNOPQRSTUV"),s(5),i("")),t.base32crockford=n(h(5),o("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),i(""),c((e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")))),t.base64=n(h(6),o("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),s(6),i("")),t.base64url=n(h(6),o("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),s(6),i("")),t.base64urlnopad=n(h(6),o("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),i(""));const b=e=>n(l(58),o(e),i(""));t.base58=b("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),t.base58flickr=b("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),t.base58xrp=b("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const g=[0,2,3,5,6,7,9,10,11];t.base58xmr={encode(e){let r="";for(let n=0;n<e.length;n+=8){const o=e.subarray(n,n+8);r+=t.base58.encode(o).padStart(g[o.length],"1")}return r},decode(e){let r=[];for(let n=0;n<e.length;n+=11){const o=e.slice(n,n+11),i=g.indexOf(o.length),s=t.base58.decode(o);for(let e=0;e<s.length-i;e++)if(0!==s[e])throw new Error("base58xmr: wrong padding");r=r.concat(Array.from(s.slice(s.length-i)))}return Uint8Array.from(r)}},t.base58check=e=>n(p(4,(t=>e(e(t)))),t.base58);const w=n(o("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),i("")),m=[996825010,642813549,513874426,1027748829,705979059];function E(e){const t=e>>25;let r=(33554431&e)<<5;for(let e=0;e<m.length;e++)1==(t>>e&1)&&(r^=m[e]);return r}function B(e,t,r=1){const n=e.length;let o=1;for(let t=0;t<n;t++){const r=e.charCodeAt(t);if(r<33||r>126)throw new Error(`Invalid prefix (${e})`);o=E(o)^r>>5}o=E(o);for(let t=0;t<n;t++)o=E(o)^31&e.charCodeAt(t);for(let e of t)o=E(o)^e;for(let e=0;e<6;e++)o=E(o);return o^=r,w.encode(f([o%2**30],30,5,!1))}function x(e){const t="bech32"===e?1:734539939,r=h(5),n=r.decode,o=r.encode,i=y(n);function s(e,r=90){if("string"!=typeof e)throw new Error("bech32.decode input should be string, not "+typeof e);if(e.length<8||!1!==r&&e.length>r)throw new TypeError(`Wrong string length: ${e.length} (${e}). Expected (8..${r})`);const n=e.toLowerCase();if(e!==n&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const o=(e=n).lastIndexOf("1");if(0===o||-1===o)throw new Error('Letter "1" must be present between prefix and data only');const i=e.slice(0,o),s=e.slice(o+1);if(s.length<6)throw new Error("Data must be at least 6 characters long");const c=w.decode(s).slice(0,-6),a=B(i,c,t);if(!s.endsWith(a))throw new Error(`Invalid checksum in ${e}: expected "${a}"`);return{prefix:i,words:c}}return{encode:function(e,r,n=90){if("string"!=typeof e)throw new Error("bech32.encode prefix should be string, not "+typeof e);if(!Array.isArray(r)||r.length&&"number"!=typeof r[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof r);const o=e.length+7+r.length;if(!1!==n&&o>n)throw new TypeError(`Length ${o} exceeds limit ${n}`);const i=e.toLowerCase(),s=B(i,r,t);return`${i}1${w.encode(r)}${s}`},decode:s,decodeToBytes:function(e){const{prefix:t,words:r}=s(e,!1);return{prefix:t,words:r,bytes:n(r)}},decodeUnsafe:y(s),fromWords:n,fromWordsUnsafe:i,toWords:o}}t.bech32=x("bech32"),t.bech32m=x("bech32m"),t.utf8={encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)},t.hex=n(h(4),o("0123456789abcdef"),i(""),c((e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})));const v={utf8:t.utf8,hex:t.hex,base16:t.base16,base32:t.base32,base64:t.base64,base64url:t.base64url,base58:t.base58,base58xmr:t.base58xmr},A="Invalid encoding type. Available types: utf8, hex, base16, base32, base64, base64url, base58, base58xmr";t.bytesToString=(e,t)=>{if("string"!=typeof e||!v.hasOwnProperty(e))throw new TypeError(A);if(!(t instanceof Uint8Array))throw new TypeError("bytesToString() expects Uint8Array");return v[e].encode(t)},t.str=t.bytesToString,t.stringToBytes=(e,t)=>{if(!v.hasOwnProperty(e))throw new TypeError(A);if("string"!=typeof t)throw new TypeError("stringToBytes() expects string");return v[e].decode(t)},t.bytes=t.stringToBytes},774:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return Array.isArray(e)?new Uint8Array(e):e}},191:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=n(r(774));t.default=function(e){function t(t){return e((0,o.default)(t))}return t.create=()=>{const t=e.create();return{update(e){return t.update((0,o.default)(e)),this},digest:()=>t.digest()}},t}},792:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ripemd160=void 0;const o=r(479),i=n(r(191));t.ripemd160=(0,i.default)(o.ripemd160)},110:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sha256=void 0;const o=r(837),i=n(r(191));t.sha256=(0,i.default)(o.sha256)},729:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sha512=void 0;const o=r(724),i=n(r(191));t.sha512=(0,i.default)(o.sha512)},938:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.stringToHex=t.hexToString=t.hexToBytes=t.bytesToHex=void 0;const i=r(26);t.bytesToHex=e=>(0,i.bytesToHex)(e instanceof Uint8Array?e:Uint8Array.from(e)).toUpperCase(),t.hexToBytes=e=>{const t=e.length,r=new Uint8Array(t/2);for(let t=0;t<r.length;t++){const n=2*t,o=e.slice(n,n+2),i=Number.parseInt(o,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");r[t]=i}return r},t.hexToString=(e,r="utf8")=>new TextDecoder(r).decode((0,t.hexToBytes)(e)),t.stringToHex=e=>(0,t.bytesToHex)((new TextEncoder).encode(e)),t.randomBytes=i.randomBytes,o(r(450),t)},450:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.equal=t.concat=void 0;const n=r(26);t.concat=function(e){return(0,n.concatBytes)(...e)},t.equal=function(e,t){if(e.byteLength!==t.byteLength)return!1;const r=new Int8Array(e),n=new Int8Array(t);for(let t=0;t!==e.byteLength;t++)if(r[t]!==n[t])return!1;return!0}},90:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isValidXAddress=t.decodeXAddress=t.xAddressToClassicAddress=t.encodeXAddress=t.classicAddressToXAddress=t.isValidClassicAddress=t.decodeAccountPublic=t.encodeAccountPublic=t.decodeNodePublic=t.encodeNodePublic=t.decodeAccountID=t.encodeAccountID=t.decodeSeed=t.encodeSeed=t.codec=void 0;const n=r(938),o=r(698);Object.defineProperty(t,"codec",{enumerable:!0,get:function(){return o.codec}}),Object.defineProperty(t,"encodeSeed",{enumerable:!0,get:function(){return o.encodeSeed}}),Object.defineProperty(t,"decodeSeed",{enumerable:!0,get:function(){return o.decodeSeed}}),Object.defineProperty(t,"encodeAccountID",{enumerable:!0,get:function(){return o.encodeAccountID}}),Object.defineProperty(t,"decodeAccountID",{enumerable:!0,get:function(){return o.decodeAccountID}}),Object.defineProperty(t,"encodeNodePublic",{enumerable:!0,get:function(){return o.encodeNodePublic}}),Object.defineProperty(t,"decodeNodePublic",{enumerable:!0,get:function(){return o.decodeNodePublic}}),Object.defineProperty(t,"encodeAccountPublic",{enumerable:!0,get:function(){return o.encodeAccountPublic}}),Object.defineProperty(t,"decodeAccountPublic",{enumerable:!0,get:function(){return o.decodeAccountPublic}}),Object.defineProperty(t,"isValidClassicAddress",{enumerable:!0,get:function(){return o.isValidClassicAddress}});const i={main:Uint8Array.from([5,68]),test:Uint8Array.from([4,147])};function s(e,t,r){if(20!==e.length)throw new Error("Account ID must be 20 bytes");if(!1!==t&&t>4294967295)throw new Error("Invalid tag");const s=t||0,c=!1===t||null==t?0:1,a=(0,n.concat)([r?i.test:i.main,e,Uint8Array.from([c,255&s,s>>8&255,s>>16&255,s>>24&255,0,0,0,0])]);return o.codec.encodeChecked(a)}function c(e){const t=o.codec.decodeChecked(e),r=function(e){const t=e.slice(0,2);if((0,n.equal)(i.main,t))return!1;if((0,n.equal)(i.test,t))return!0;throw new Error("Invalid X-address: bad prefix")}(t);return{accountId:t.slice(2,22),tag:function(e){const t=e[22];if(t>=2)throw new Error("Unsupported X-address");if(1===t)return e[23]+256*e[24]+65536*e[25]+16777216*e[26];if(0!==t)throw new Error("flag must be zero to indicate no tag");if(!(0,n.equal)((0,n.hexToBytes)("0000000000000000"),e.slice(23,31)))throw new Error("remaining bytes must be zero");return!1}(t),test:r}}t.classicAddressToXAddress=function(e,t,r){return s((0,o.decodeAccountID)(e),t,r)},t.encodeXAddress=s,t.xAddressToClassicAddress=function(e){const{accountId:t,tag:r,test:n}=c(e);return{classicAddress:(0,o.encodeAccountID)(t),tag:r,test:n}},t.decodeXAddress=c,t.isValidXAddress=function(e){try{c(e)}catch(e){return!1}return!0}},494:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.concatArgs=t.arrayEqual=void 0,t.arrayEqual=function(e,t){return e.length===t.length&&e.every(((e,r)=>e===t[r]))},t.concatArgs=function(...e){return e.flatMap((e=>"number"==typeof e?[e]:Array.from(e)))}},698:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isValidClassicAddress=t.decodeAccountPublic=t.encodeAccountPublic=t.encodeNodePublic=t.decodeNodePublic=t.decodeAddress=t.decodeAccountID=t.encodeAddress=t.encodeAccountID=t.decodeSeed=t.encodeSeed=t.codec=void 0;const n=r(773),o=r(110),i=r(494),s=[1,225,75],c={sha256:o.sha256},a=new class{constructor(e){this._sha256=e.sha256,this._codec=n.base58xrp}encode(e,t){const r=t.versions;return this._encodeVersioned(e,r,t.expectedLength)}decode(e,t){var r;const n=t.versions,o=t.versionTypes,s=this.decodeChecked(e);if(n.length>1&&!t.expectedLength)throw new Error("expectedLength is required because there are >= 2 possible versions");const c="number"==typeof n[0]?1:n[0].length,a=null!==(r=t.expectedLength)&&void 0!==r?r:s.length-c,d=s.slice(0,-a),u=s.slice(-a);for(let e=0;e<n.length;e++){const t=Array.isArray(n[e])?n[e]:[n[e]];if((0,i.arrayEqual)(d,t))return{version:t,bytes:u,type:o?o[e]:null}}throw new Error("version_invalid: version bytes do not match any of the provided version(s)")}encodeChecked(e){const t=this._sha256(this._sha256(e)).slice(0,4);return this._encodeRaw(Uint8Array.from((0,i.concatArgs)(e,t)))}decodeChecked(e){const t=this._decodeRaw(e);if(t.byteLength<5)throw new Error("invalid_input_size: decoded data must have length >= 5");if(!this._verifyCheckSum(t))throw new Error("checksum_invalid");return t.slice(0,-4)}_encodeVersioned(e,t,r){if(!f(e,r))throw new Error("unexpected_payload_length: bytes.length does not match expectedLength. Ensure that the bytes are a Uint8Array.");return this.encodeChecked((0,i.concatArgs)(t,e))}_encodeRaw(e){return this._codec.encode(Uint8Array.from(e))}_decodeRaw(e){return this._codec.decode(e)}_verifyCheckSum(e){const t=this._sha256(this._sha256(e.slice(0,-4))).slice(0,4),r=e.slice(-4);return(0,i.arrayEqual)(t,r)}}(c);function d(e){const t={versions:[0],expectedLength:20};return a.encode(e,t)}function u(e){const t={versions:[0],expectedLength:20};return a.decode(e,t).bytes}function f(e,t){return"byteLength"in e?e.byteLength===t:e.length===t}t.codec=a,t.encodeSeed=function(e,t){if(!f(e,16))throw new Error("entropy must have length 16");const r={expectedLength:16,versions:"ed25519"===t?s:[33]};return a.encode(e,r)},t.decodeSeed=function(e,t={versionTypes:["ed25519","secp256k1"],versions:[s,33],expectedLength:16}){return a.decode(e,t)},t.encodeAccountID=d,t.encodeAddress=d,t.decodeAccountID=u,t.decodeAddress=u,t.decodeNodePublic=function(e){return a.decode(e,{versions:[28],expectedLength:33}).bytes},t.encodeNodePublic=function(e){return a.encode(e,{versions:[28],expectedLength:33})},t.encodeAccountPublic=function(e){return a.encode(e,{versions:[35],expectedLength:33})},t.decodeAccountPublic=function(e){return a.decode(e,{versions:[35],expectedLength:33}).bytes},t.isValidClassicAddress=function(e){try{u(e)}catch(e){return!1}return!0}},860:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.decodeSeed=t.deriveNodeAddress=t.deriveAddress=t.verify=t.sign=t.deriveKeypair=t.generateSeed=void 0;const o=r(90);Object.defineProperty(t,"decodeSeed",{enumerable:!0,get:function(){return o.decodeSeed}});const i=r(792),s=r(110),c=r(938),a=r(613),d=n(r(523)),u=n(r(71)),f=r(213),l=n(r(460)),h=n(r(892));function y(e){return{"ecdsa-secp256k1":l.default,ed25519:h.default}[e]}function p(e){return(0,o.encodeAccountID)(function(e){return(0,i.ripemd160)((0,s.sha256)(e))}(e))}t.generateSeed=function(e={}){u.default.ok(!e.entropy||e.entropy.length>=16,"entropy too short");const t=e.entropy?e.entropy.slice(0,16):(0,c.randomBytes)(16),r="ed25519"===e.algorithm?"ed25519":"secp256k1";return(0,o.encodeSeed)(t,r)},t.deriveKeypair=function(e,t){var r;const n=(0,o.decodeSeed)(e),i=y("ed25519"===(null!==(r=null==t?void 0:t.algorithm)&&void 0!==r?r:n.type)?"ed25519":"ecdsa-secp256k1"),s=i.deriveKeypair(n.bytes,t),c=d.default.half("This test message should verify."),a=i.sign(c,s.privateKey);if(!i.verify(c,a,s.publicKey))throw new Error("derived keypair did not generate verifiable signature");return s},t.sign=function(e,t){return y((0,f.getAlgorithmFromPrivateKey)(t)).sign((0,c.hexToBytes)(e),t)},t.verify=function(e,t,r){return y((0,f.getAlgorithmFromPublicKey)(r)).verify((0,c.hexToBytes)(e),t,r)},t.deriveAddress=function(e){return p((0,c.hexToBytes)(e))},t.deriveNodeAddress=function(e){const t=(0,o.decodeNodePublic)(e);return p((0,a.accountPublicFromPublicGenerator)(t))}},892:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=r(228),i=r(938),s=n(r(71)),c=n(r(523)),a={deriveKeypair(e){const t=c.default.half(e);return{privateKey:"ED"+(0,i.bytesToHex)(t),publicKey:"ED"+(0,i.bytesToHex)(o.ed25519.getPublicKey(t))}},sign:(e,t)=>(s.default.ok(e instanceof Uint8Array,"message must be array of octets"),s.default.ok(66===t.length,"private key must be 33 bytes including prefix"),(0,i.bytesToHex)(o.ed25519.sign(e,t.slice(2)))),verify:(e,t,r)=>(s.default.ok(66===r.length,"public key must be 33 bytes including prefix"),o.ed25519.verify(t,e,r.slice(2),{zip215:!1}))};t.default=a},460:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=r(242),i=r(852),s=r(938),c=r(613),a=n(r(71)),d=n(r(523)),u={deriveKeypair(e,t){const r=(0,c.derivePrivateKey)(e,t);return{privateKey:"00"+(0,s.bytesToHex)((0,o.numberToBytesBE)(r,32)),publicKey:(0,s.bytesToHex)(i.secp256k1.getPublicKey(r,!0))}},sign(e,t){a.default.ok(66===t.length&&t.startsWith("00")||64===t.length);const r=66===t.length?t.slice(2):t;return i.secp256k1.sign(d.default.half(e),r,{lowS:!0,extraEntropy:void 0}).toDERHex(!0).toUpperCase()},verify(e,t,r){const n=i.secp256k1.Signature.fromDER(t);return i.secp256k1.verify(n,d.default.half(e),r)}};t.default=u},613:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.accountPublicFromPublicGenerator=t.derivePrivateKey=void 0;const o=r(852),i=n(r(523)),s=BigInt(0);function c(e,t){const r=o.secp256k1.CURVE.n;for(let n=0;n<=4294967295;n++){const o=(new i.default).add(e);void 0!==t&&o.addU32(t),o.addU32(n);const c=o.first256BigInt();if(c>s&&c<r)return c}throw new Error("impossible unicorn ;)")}t.derivePrivateKey=function(e,t={}){const r=t.validator,n=o.secp256k1.CURVE.n,i=c(e);return r?i:(c(o.secp256k1.ProjectivePoint.BASE.multiply(i).toRawBytes(!0),t.accountIndex||0)+i)%n},t.accountPublicFromPublicGenerator=function(e){const t=o.secp256k1.ProjectivePoint.fromHex(e),r=c(e,0),n=o.secp256k1.ProjectivePoint.BASE.multiply(r);return t.add(n).toRawBytes(!0)}},523:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(729),o=r(242);class i{constructor(){this.hash=n.sha512.create()}static half(e){return(new i).add(e).first256()}add(e){return this.hash.update(e),this}addU32(e){const t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e),this.add(t)}finish(){return this.hash.digest()}first256(){return this.finish().slice(0,32)}first256BigInt(){return(0,o.bytesToNumberBE)(this.first256())}}t.default=i},71:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});const r={ok(e,t){if(!e)throw new Error(t)}};t.default=r},213:(e,t)=>{var r;Object.defineProperty(t,"__esModule",{value:!0}),t.getAlgorithmFromPrivateKey=t.getAlgorithmFromPublicKey=t.getAlgorithmFromKey=void 0,function(e){e[e.NONE=-1]="NONE",e[e.ED25519=237]="ED25519",e[e.SECP256K1_PUB_X=2]="SECP256K1_PUB_X",e[e.SECP256K1_PUB_X_ODD_Y=3]="SECP256K1_PUB_X_ODD_Y",e[e.SECP256K1_PUB_XY=4]="SECP256K1_PUB_XY",e[e.SECP256K1_PRIVATE=0]="SECP256K1_PRIVATE"}(r||(r={}));const n={[`private_${r.NONE}_32`]:"ecdsa-secp256k1",[`private_${r.SECP256K1_PRIVATE}_33`]:"ecdsa-secp256k1",[`private_${r.ED25519}_33`]:"ed25519",[`public_${r.ED25519}_33`]:"ed25519",[`public_${r.SECP256K1_PUB_X}_33`]:"ecdsa-secp256k1",[`public_${r.SECP256K1_PUB_X_ODD_Y}_33`]:"ecdsa-secp256k1",[`public_${r.SECP256K1_PUB_XY}_65`]:"ecdsa-secp256k1"};function o(e){return e===r.NONE?"None":`0x${e.toString(16).padStart(2,"0")}`}function i(e,t){const{prefix:i,len:s}=function(e){return{prefix:e.length<2?r.NONE:parseInt(e.slice(0,2),16),len:e.length/2}}(e),c="private"===t&&32===s?r.NONE:i,a=n[`${t}_${c}_${s}`];if(!a)throw new Error(function({key:e,type:t,prefix:r,len:i}){const s=function(e){const t=17,r=6;return Object.entries(n).filter((([t])=>t.startsWith(e))).map((([e,n])=>{const[,i,s]=e.split("_");return`${n.padEnd(t)} - Prefix: ${o(Number(i)).padEnd(r)} Length: ${s} bytes`})).join("\n")}(t);return`invalid_key:\n\nType: ${t}\nKey: ${e}\nPrefix: ${o(r)} \nLength: ${i} bytes\n\nAcceptable ${t} formats are:\n${s}\n`}({key:e,type:t,len:s,prefix:c}));return a}t.getAlgorithmFromKey=i,t.getAlgorithmFromPublicKey=function(e){return i(e,"public")},t.getAlgorithmFromPrivateKey=function(e){return i(e,"private")}},628:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(814),t),o(r(326),t)},814:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Account=void 0;const n=r(860),o=r(326);t.Account=class{constructor(e){this._account={familySeed:"",address:"",keypair:{publicKey:"",privateKey:""}},"string"==typeof e?this._secret=(0,o.parseSecretString)(e):Array.isArray(e)?this._secret=e:e instanceof Uint8Array?this._secret=(0,o.entropyToSecret)(e):this._secret=(0,o.randomSecret)(),function(e){if(8!==e.length)throw new Error("Secret must have 8 numbers");e.forEach((e=>{if(6!==e.length)throw new Error("Each secret number must be 6 digits")}))}(this._secret),this.derive()}getSecret(){return this._secret}getSecretString(){return this._secret.join(" ")}getAddress(){return this._account.address}getFamilySeed(){return this._account.familySeed}getKeypair(){return this._account.keypair}toString(){return this.getSecretString()}derive(){try{const e=(0,o.secretToEntropy)(this._secret);this._account.familySeed=(0,n.generateSeed)({entropy:e}),this._account.keypair=(0,n.deriveKeypair)(this._account.familySeed),this._account.address=(0,n.deriveAddress)(this._account.keypair.publicKey)}catch(e){let t="Unknown Error";throw e instanceof Error&&(t=e.message),new Error(t)}}}},326:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseSecretString=t.checkChecksum=t.calculateChecksum=t.secretToEntropy=t.entropyToSecret=t.randomSecret=t.randomEntropy=void 0;const n=r(938);function o(){return(0,n.randomBytes)(16)}function i(e,t){return t*(2*e+1)%9}function s(e,t,r){let n,o;if("string"==typeof t){if(6!==t.length)throw new Error("value must have a length of 6");n=parseInt(t.slice(5),10),o=parseInt(t.slice(0,5),10)}else{if("number"!=typeof r)throw new Error("checksum must be a number when value is a number");n=r,o=t}return o*(2*e+1)%9===n}function c(e){const t=new Array(Math.ceil(e.length/2)),r=Array.from(t,((t,r)=>{const o=e.slice(2*r,2*(r+1)),s=parseInt((0,n.bytesToHex)(o),16);return"0".repeat(5-String(s).length)+String(s)+String(i(r,s))}));if(8!==r.length)throw new Error("Chucks must have 8 digits");return r}t.randomEntropy=o,t.calculateChecksum=i,t.checkChecksum=s,t.entropyToSecret=c,t.randomSecret=function(){return c(o())},t.secretToEntropy=function(e){return(0,n.concat)(e.map(((e,t)=>{const r=Number(e.slice(0,5)),o=Number(e.slice(5));if(6!==e.length)throw new Error("Invalid secret: number invalid");if(!s(t,r,o))throw new Error("Invalid secret part: checksum invalid");const i=`0000${r.toString(16)}`.slice(-4);return(0,n.hexToBytes)(i)})))},t.parseSecretString=function(e){const t=e.replace(/[^0-9]/gu,"");if(48!==t.length)throw new Error("Invalid secret string (should contain 8 blocks of 6 digits");return Array.from(new Array(8),((e,r)=>t.slice(6*r,6*(r+1))))}}},t={},r=function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}(628);xrplf_secret_numbers=r})();
//# sourceMappingURL=xrplf-secret-numbers-latest.min.js.map

Выполнить команду


Для локальной разработки. Не используйте в интернете!