"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[600],{35600:function(t,e,r){r.d(e,{secp256k1:function(){return ta}});var n={};r.r(n),r.d(n,{dQ:function(){return O},ci:function(){return w},bytesToNumberBE:function(){return B},ty:function(){return I},eV:function(){return S},n$:function(){return R},ql:function(){return A},hexToBytes:function(){return b},tL:function(){return x},S5:function(){return v},FF:function(){return U}});var i=r(95861),o=r(12403);class s extends o.kb{constructor(t,e,r,n){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,o.GL)(this.buffer)}update(t){(0,i.Gg)(this);let{view:e,buffer:r,blockLen:n}=this,s=(t=(0,o.O0)(t)).length;for(let i=0;in-f&&(this.process(r,0),f=0);for(let t=f;t>i&o),f=Number(r&o),l=n?4:0,u=n?0:4;t.setUint32(e+l,s,n),t.setUint32(e+u,f,n)}(r,n-8,BigInt(8*this.length),s),this.process(r,0);let l=(0,o.GL)(t),u=this.outputLen;if(u%4)throw Error("_sha2: outputLen should be aligned to 32bit");let a=u/4,h=this.get();if(a>h.length)throw Error("_sha2: outputLen bigger than state");for(let t=0;tt&e^~t&r,l=(t,e,r)=>t&e^t&r^e&r,u=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]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),h=new Uint32Array(64);class d extends s{constructor(){super(64,32,8,!1),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3],this.E=0|a[4],this.F=0|a[5],this.G=0|a[6],this.H=0|a[7]}get(){let{A:t,B:e,C:r,D:n,E:i,F:o,G:s,H:f}=this;return[t,e,r,n,i,o,s,f]}set(t,e,r,n,i,o,s,f){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|f}process(t,e){for(let r=0;r<16;r++,e+=4)h[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){let e=h[t-15],r=h[t-2],n=(0,o.np)(e,7)^(0,o.np)(e,18)^e>>>3,i=(0,o.np)(r,17)^(0,o.np)(r,19)^r>>>10;h[t]=i+h[t-7]+n+h[t-16]|0}let{A:r,B:n,C:i,D:s,E:a,F:d,G:c,H:p}=this;for(let t=0;t<64;t++){let e=p+((0,o.np)(a,6)^(0,o.np)(a,11)^(0,o.np)(a,25))+f(a,d,c)+u[t]+h[t]|0,g=((0,o.np)(r,2)^(0,o.np)(r,13)^(0,o.np)(r,22))+l(r,n,i)|0;p=c,c=d,d=a,a=s+e|0,s=i,i=n,n=r,r=e+g|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,s=s+this.D|0,a=a+this.E|0,d=d+this.F|0,c=c+this.G|0,p=p+this.H|0,this.set(r,n,i,s,a,d,c,p)}roundClean(){h.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}let c=(0,o.hE)(()=>new d);BigInt(0);let p=BigInt(1),g=BigInt(2),y=t=>t instanceof Uint8Array,m=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function w(t){if(!y(t))throw Error("Uint8Array expected");let e="";for(let r=0;rt+e.length,0)),r=0;return t.forEach(t=>{if(!y(t))throw Error("Uint8Array expected");e.set(t,r),r+=t.length}),e}let O=t=>(g<new Uint8Array(t),N=t=>Uint8Array.from(t);function R(t,e,r){if("number"!=typeof t||t<2)throw Error("hashLen must be a number");if("number"!=typeof e||e<2)throw Error("qByteLen must be a number");if("function"!=typeof r)throw Error("hmacFn must be a function");let n=q(t),i=q(t),o=0,s=()=>{n.fill(1),i.fill(0),o=0},f=(...t)=>r(i,n,...t),l=(t=q())=>{i=f(N([0]),t),n=f(),0!==t.length&&(i=f(N([1]),t),n=f())},u=()=>{if(o++>=1e3)throw Error("drbg: tried 1000 values");let t=0,r=[];for(;t{let r;for(s(),l(t);!(r=e(u()));)l();return s(),r}}let L={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function U(t,e,r={}){let n=(e,r,n)=>{let i=L[r];if("function"!=typeof i)throw Error(`Invalid validator "${r}", expected function`);let o=t[e];if((!n||void 0!==o)&&!i(o,t))throw Error(`Invalid param ${String(e)}=${o} (${typeof o}), expected ${r}`)};for(let[t,r]of Object.entries(e))n(t,r,!1);for(let[t,e]of Object.entries(r))n(t,e,!0);return t}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let H=BigInt(0),$=BigInt(1),z=BigInt(2),F=BigInt(3),P=BigInt(4),Z=BigInt(5),C=BigInt(8);function T(t,e){let r=t%e;return r>=H?r:e+r}function _(t,e,r){let n=t;for(;e-- >H;)n*=n,n%=r;return n}function V(t,e){if(t===H||e<=H)throw Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=T(t,e),n=e,i=H,o=$,s=$,f=H;for(;r!==H;){let t=n/r,e=n%r,l=i-s*t,u=o-f*t;n=r,r=e,i=s,o=f,s=l,f=u}if(n!==$)throw Error("invert: does not exist");return T(i,e)}BigInt(9),BigInt(16);let k=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function j(t,e){let r=void 0!==e?e:t.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function G(t){if("bigint"!=typeof t)throw Error("field order must be bigint");return Math.ceil(t.toString(2).length/8)}function D(t){let e=G(t);return e+Math.ceil(e/2)}class K extends o.kb{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,(0,i.vp)(t);let r=(0,o.O0)(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,s=new Uint8Array(n);s.set(r.length>n?t.create().update(r).digest():r);for(let t=0;tnew K(t,e).update(r).digest();Y.create=(t,e)=>new K(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let M=BigInt(0),W=BigInt(1);function J(t){return U(t.Fp,k.reduce((t,e)=>(t[e]="function",t),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),U(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...j(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}let{bytesToNumberBE:Q,hexToBytes:X}=n,tt={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(t){let{Err:e}=tt;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");let r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(128&n[0])throw new e("Invalid signature integer: negative");if(0===n[0]&&!(128&n[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:Q(n),l:t.subarray(r+2)}},toSig(t){let{Err:e}=tt,r="string"==typeof t?X(t):t;if(!(r instanceof Uint8Array))throw Error("ui8a expected");let n=r.length;if(n<2||48!=r[0])throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");let{d:i,l:o}=tt._parseInt(r.subarray(2)),{d:s,l:f}=tt._parseInt(o);if(f.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){let e=t=>8&Number.parseInt(t[0],16)?"00"+t:t,r=t=>{let e=t.toString(16);return 1&e.length?`0${e}`:e},n=e(r(t.s)),i=e(r(t.r)),o=n.length/2,s=i.length/2,f=r(o),l=r(s);return`30${r(s+o+4)}02${l}${i}02${f}${n}`}},te=BigInt(0),tr=BigInt(1),tn=(BigInt(2),BigInt(3));BigInt(4);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let ti=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),to=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),ts=BigInt(1),tf=BigInt(2),tl=(t,e)=>(t+e/tf)/e,tu=function(t,e,r=!1,n={}){if(t<=H)throw Error(`Expected Field ORDER > 0, got ${t}`);let{nBitLength:i,nByteLength:o}=j(t,e);if(o>2048)throw Error("Field lengths over 2048 bytes are not supported");let s=function(t){if(t%P===F){let e=(t+$)/P;return function(t,r){let n=t.pow(r,e);if(!t.eql(t.sqr(n),r))throw Error("Cannot find square root");return n}}if(t%C===Z){let e=(t-Z)/C;return function(t,r){let n=t.mul(r,z),i=t.pow(n,e),o=t.mul(r,i),s=t.mul(t.mul(o,z),i),f=t.mul(o,t.sub(s,t.ONE));if(!t.eql(t.sqr(f),r))throw Error("Cannot find square root");return f}}return function(t){let e,r,n;let i=(t-$)/z;for(e=t-$,r=0;e%z===H;e/=z,r++);for(n=z;n 0");if(r===$)return H;let n=$;for(;e>H;)e&$&&(n=n*t%r),t=t*t%r,e>>=$;return n}(n,i,t)!==t-$;n++);if(1===r){let e=(t+$)/P;return function(t,r){let n=t.pow(r,e);if(!t.eql(t.sqr(n),r))throw Error("Cannot find square root");return n}}let o=(e+$)/z;return function(t,s){if(t.pow(s,i)===t.neg(t.ONE))throw Error("Cannot find square root");let f=r,l=t.pow(t.mul(t.ONE,n),e),u=t.pow(s,o),a=t.pow(s,e);for(;!t.eql(a,t.ONE);){if(t.eql(a,t.ZERO))return t.ZERO;let e=1;for(let r=t.sqr(a);eT(e,t),isValid:e=>{if("bigint"!=typeof e)throw Error(`Invalid field element: expected bigint, got ${typeof e}`);return H<=e&&et===H,isOdd:t=>(t&$)===$,neg:e=>T(-e,t),eql:(t,e)=>t===e,sqr:e=>T(e*e,t),add:(e,r)=>T(e+r,t),sub:(e,r)=>T(e-r,t),mul:(e,r)=>T(e*r,t),pow:(t,e)=>(function(t,e,r){if(r 0");if(r===H)return t.ONE;if(r===$)return e;let n=t.ONE,i=e;for(;r>H;)r&$&&(n=t.mul(n,i)),i=t.sqr(i),r>>=$;return n})(f,t,e),div:(e,r)=>T(e*V(r,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>V(e,t),sqrt:n.sqrt||(t=>s(f,t)),invertBatch:t=>(function(t,e){let r=Array(e.length),n=e.reduce((e,n,i)=>t.is0(n)?e:(r[i]=e,t.mul(e,n)),t.ONE),i=t.inv(n);return e.reduceRight((e,n,i)=>t.is0(n)?e:(r[i]=t.mul(e,r[i]),t.mul(e,n)),i),r})(f,t),cmov:(t,e,r)=>r?e:t,toBytes:t=>r?v(t,o):x(t,o),fromBytes:t=>{if(t.length!==o)throw Error(`Fp.fromBytes: expected ${o}, got ${t.length}`);return r?I(t):B(t)}});return Object.freeze(f)}(ti,void 0,void 0,{sqrt:function(t){let e=BigInt(3),r=BigInt(6),n=BigInt(11),i=BigInt(22),o=BigInt(23),s=BigInt(44),f=BigInt(88),l=t*t*t%ti,u=l*l*t%ti,a=_(u,e,ti)*u%ti,h=_(a,e,ti)*u%ti,d=_(h,tf,ti)*l%ti,c=_(d,n,ti)*d%ti,p=_(c,i,ti)*c%ti,g=_(p,s,ti)*p%ti,y=_(g,f,ti)*g%ti,m=_(y,s,ti)*p%ti,w=_(m,e,ti)*u%ti,E=_(w,o,ti)*c%ti,b=_(E,r,ti)*l%ti,B=_(b,tf,ti);if(!tu.eql(tu.sqr(B),t))throw Error("Cannot find square root");return B}}),ta=function(t,e){let r=e=>(function(t){let e=function(t){let e=J(t);return U(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:r,n:n}=e,i=r.BYTES+1,o=2*r.BYTES+1;function s(t){return T(t,n)}let{ProjectivePoint:f,normPrivateKeyToScalar:l,weierstrassEquation:u,isWithinCurveOrder:a}=function(t){let e=/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function(t){let e=J(t);U(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw 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 Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:r}=e,n=e.toBytes||((t,e,n)=>{let i=e.toAffine();return S(Uint8Array.from([4]),r.toBytes(i.x),r.toBytes(i.y))}),i=e.fromBytes||(t=>{let e=t.subarray(1);return{x:r.fromBytes(e.subarray(0,r.BYTES)),y:r.fromBytes(e.subarray(r.BYTES,2*r.BYTES))}});function o(t){let{a:n,b:i}=e,o=r.sqr(t),s=r.mul(o,t);return r.add(r.add(s,r.mul(t,n)),i)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw Error("bad generator point: equation left != right");function s(t){return"bigint"==typeof t&&ter.eql(t,r.ZERO);return i(e)&&i(n)?h.ZERO:new h(e,n,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){let e=r.invertBatch(t.map(t=>t.pz));return t.map((t,r)=>t.toAffine(e[r])).map(h.fromAffine)}static fromHex(t){let e=h.fromAffine(i(A("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return h.BASE.multiply(l(t))}_setWindowSize(t){this._WINDOW_SIZE=t,u.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw Error("bad point: ZERO")}let{x:t,y:n}=this.toAffine();if(!r.isValid(t)||!r.isValid(n))throw Error("bad point: x or y not FE");let i=r.sqr(n),s=o(t);if(!r.eql(i,s))throw Error("bad point: equation left != right");if(!this.isTorsionFree())throw Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:t}=this.toAffine();if(r.isOdd)return!r.isOdd(t);throw Error("Field doesn't support isOdd")}equals(t){a(t);let{px:e,py:n,pz:i}=this,{px:o,py:s,pz:f}=t,l=r.eql(r.mul(e,f),r.mul(o,i)),u=r.eql(r.mul(n,f),r.mul(s,i));return l&&u}negate(){return new h(this.px,r.neg(this.py),this.pz)}double(){let{a:t,b:n}=e,i=r.mul(n,tn),{px:o,py:s,pz:f}=this,l=r.ZERO,u=r.ZERO,a=r.ZERO,d=r.mul(o,o),c=r.mul(s,s),p=r.mul(f,f),g=r.mul(o,s);return g=r.add(g,g),a=r.mul(o,f),a=r.add(a,a),l=r.mul(t,a),u=r.mul(i,p),u=r.add(l,u),l=r.sub(c,u),u=r.add(c,u),u=r.mul(l,u),l=r.mul(g,l),a=r.mul(i,a),p=r.mul(t,p),g=r.sub(d,p),g=r.mul(t,g),g=r.add(g,a),a=r.add(d,d),d=r.add(a,d),d=r.add(d,p),d=r.mul(d,g),u=r.add(u,d),p=r.mul(s,f),p=r.add(p,p),d=r.mul(p,g),l=r.sub(l,d),a=r.mul(p,c),a=r.add(a,a),new h(l,u,a=r.add(a,a))}add(t){a(t);let{px:n,py:i,pz:o}=this,{px:s,py:f,pz:l}=t,u=r.ZERO,d=r.ZERO,c=r.ZERO,p=e.a,g=r.mul(e.b,tn),y=r.mul(n,s),m=r.mul(i,f),w=r.mul(o,l),E=r.add(n,i),b=r.add(s,f);E=r.mul(E,b),b=r.add(y,m),E=r.sub(E,b),b=r.add(n,o);let B=r.add(s,l);return b=r.mul(b,B),B=r.add(y,w),b=r.sub(b,B),B=r.add(i,o),u=r.add(f,l),B=r.mul(B,u),u=r.add(m,w),B=r.sub(B,u),c=r.mul(p,b),u=r.mul(g,w),c=r.add(u,c),u=r.sub(m,c),c=r.add(m,c),d=r.mul(u,c),m=r.add(y,y),m=r.add(m,y),w=r.mul(p,w),b=r.mul(g,b),m=r.add(m,w),w=r.sub(y,w),w=r.mul(p,w),b=r.add(b,w),y=r.mul(m,b),d=r.add(d,y),y=r.mul(B,b),u=r.mul(E,u),u=r.sub(u,y),y=r.mul(E,m),c=r.mul(B,c),new h(u,d,c=r.add(c,y))}subtract(t){return this.add(t.negate())}is0(){return this.equals(h.ZERO)}wNAF(t){return c.wNAFCached(this,u,t,t=>{let e=r.invertBatch(t.map(t=>t.pz));return t.map((t,r)=>t.toAffine(e[r])).map(h.fromAffine)})}multiplyUnsafe(t){let n=h.ZERO;if(t===te)return n;if(f(t),t===tr)return this;let{endo:i}=e;if(!i)return c.unsafeLadder(this,t);let{k1neg:o,k1:s,k2neg:l,k2:u}=i.splitScalar(t),a=n,d=n,p=this;for(;s>te||u>te;)s&tr&&(a=a.add(p)),u&tr&&(d=d.add(p)),p=p.double(),s>>=tr,u>>=tr;return o&&(a=a.negate()),l&&(d=d.negate()),d=new h(r.mul(d.px,i.beta),d.py,d.pz),a.add(d)}multiply(t){let n,i;f(t);let{endo:o}=e;if(o){let{k1neg:e,k1:s,k2neg:f,k2:l}=o.splitScalar(t),{p:u,f:a}=this.wNAF(s),{p:d,f:p}=this.wNAF(l);u=c.constTimeNegate(e,u),d=c.constTimeNegate(f,d),d=new h(r.mul(d.px,o.beta),d.py,d.pz),n=u.add(d),i=a.add(p)}else{let{p:e,f:r}=this.wNAF(t);n=e,i=r}return h.normalizeZ([n,i])[0]}multiplyAndAddUnsafe(t,e,r){let n=h.BASE,i=(t,e)=>e!==te&&e!==tr&&t.equals(n)?t.multiply(e):t.multiplyUnsafe(e),o=i(this,e).add(i(t,r));return o.is0()?void 0:o}toAffine(t){let{px:e,py:n,pz:i}=this,o=this.is0();null==t&&(t=o?r.ONE:r.inv(i));let s=r.mul(e,t),f=r.mul(n,t),l=r.mul(i,t);if(o)return{x:r.ZERO,y:r.ZERO};if(!r.eql(l,r.ONE))throw Error("invZ was invalid");return{x:s,y:f}}isTorsionFree(){let{h:t,isTorsionFree:r}=e;if(t===tr)return!0;if(r)return r(h,this);throw Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:t,clearCofactor:r}=e;return t===tr?this:r?r(h,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return this.assertValidity(),n(h,this,t)}toHex(t=!0){return w(this.toRawBytes(t))}}h.BASE=new h(e.Gx,e.Gy,r.ONE),h.ZERO=new h(r.ZERO,r.ONE,r.ZERO);let d=e.nBitLength,c=function(t,e){let r=(t,e)=>{let r=e.negate();return t?r:e},n=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:r,unsafeLadder(e,r){let n=t.ZERO,i=e;for(;r>M;)r&W&&(n=n.add(i)),i=i.double(),r>>=W;return n},precomputeWindow(t,e){let{windows:r,windowSize:i}=n(e),o=[],s=t,f=s;for(let t=0;t>=d,n>f&&(n-=h,o+=W);let s=e+Math.abs(n)-1,c=t%2!=0,p=n<0;0===n?u=u.add(r(c,i[e])):l=l.add(r(p,i[s]))}return{p:l,f:u}},wNAFCached(t,e,r,n){let i=t._WINDOW_SIZE||1,o=e.get(t);return o||(o=this.precomputeWindow(t,i),1!==i&&e.set(t,n(o))),this.wNAF(i,o,r)}}}(h,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:h,normPrivateKeyToScalar:l,weierstrassEquation:o,isWithinCurveOrder:s}}({...e,toBytes(t,e,n){let i=e.toAffine(),o=r.toBytes(i.x),s=S;return n?s(Uint8Array.from([e.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,r.toBytes(i.y))},fromBytes(t){let e=t.length,n=t[0],s=t.subarray(1);if(e===i&&(2===n||3===n)){let t=B(s);if(!(tew(x(t,e.nByteLength)),d=(t,e,r)=>B(t.slice(e,r));class c{constructor(t,e,r){this.r=t,this.s=e,this.recovery=r,this.assertValidity()}static fromCompact(t){let r=e.nByteLength;return new c(d(t=A("compactSignature",t,2*r),0,r),d(t,r,2*r))}static fromDER(t){let{r:e,s:r}=tt.toSig(A("DER",t));return new c(e,r)}assertValidity(){if(!a(this.r))throw Error("r must be 0 < r < CURVE.n");if(!a(this.s))throw Error("s must be 0 < s < CURVE.n")}addRecoveryBit(t){return new c(this.r,this.s,t)}recoverPublicKey(t){let{r:i,s:o,recovery:l}=this,u=y(A("msgHash",t));if(null==l||![0,1,2,3].includes(l))throw Error("recovery id invalid");let a=2===l||3===l?i+e.n:i;if(a>=r.ORDER)throw Error("recovery id 2 or 3 invalid");let d=(1&l)==0?"02":"03",c=f.fromHex(d+h(a)),p=V(a,n),g=s(-u*p),m=s(o*p),w=f.BASE.multiplyAndAddUnsafe(c,g,m);if(!w)throw Error("point at infinify");return w.assertValidity(),w}hasHighS(){return this.s>n>>tr}normalizeS(){return this.hasHighS()?new c(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return b(this.toDERHex())}toDERHex(){return tt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return b(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}function p(t){let e=t instanceof Uint8Array,r="string"==typeof t,n=(e||r)&&t.length;return e?n===i||n===o:r?n===2*i||n===2*o:t instanceof f}let g=e.bits2int||function(t){let r=B(t),n=8*t.length-e.nBitLength;return n>0?r>>BigInt(n):r},y=e.bits2int_modN||function(t){return s(g(t))},m=O(e.nBitLength);function E(t){if("bigint"!=typeof t)throw Error("bigint expected");if(!(te<=t&&tt in o))throw Error("sign() legacy options not supported");let{hash:u,randomBytes:h}=e,{lowS:d,prehash:p,extraEntropy:m}=o;null==d&&(d=!0),t=A("msgHash",t),p&&(t=A("prehashed msgHash",u(t)));let w=y(t),b=l(i),B=[E(b),E(w)];if(null!=m){let t=!0===m?h(r.BYTES):m;B.push(A("extraEntropy",t))}return{seed:S(...B),k2sig:function(t){let e=g(t);if(!a(e))return;let r=V(e,n),i=f.BASE.multiply(e).toAffine(),o=s(i.x);if(o===te)return;let l=s(r*s(w+o*b));if(l===te)return;let u=(i.x===o?0:2)|Number(i.y&tr),h=l;if(d&&l>n>>tr)h=l>n>>tr?s(-l):l,u^=1;return new c(o,h,u)}}}(t,i,o);return R(e.hash.outputLen,e.nByteLength,e.hmac)(u,h)},verify:function(t,r,i,o=N){let l,u;if(r=A("msgHash",r),i=A("publicKey",i),"strict"in o)throw Error("options.strict was renamed to lowS");let{lowS:a,prehash:h}=o;try{if("string"==typeof t||t instanceof Uint8Array)try{u=c.fromDER(t)}catch(e){if(!(e instanceof tt.Err))throw e;u=c.fromCompact(t)}else if("object"==typeof t&&"bigint"==typeof t.r&&"bigint"==typeof t.s){let{r:e,s:r}=t;u=new c(e,r)}else throw Error("PARSE");l=f.fromHex(i)}catch(t){if("PARSE"===t.message)throw Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(a&&u.hasHighS())return!1;h&&(r=e.hash(r));let{r:d,s:p}=u,g=y(r),m=V(p,n),w=s(g*m),E=s(d*m),b=f.BASE.multiplyAndAddUnsafe(l,w,E)?.toAffine();return!!b&&s(b.x)===d},ProjectivePoint:f,Signature:c,utils:{isValidPrivateKey(t){try{return l(t),!0}catch(t){return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{let t=D(e.n);return function(t,e,r=!1){let n=t.length,i=G(e),o=D(e);if(n<16||n1024)throw Error(`expected ${o}-1024 bytes of input, got ${n}`);let s=T(r?B(t):I(t),e-$)+$;return r?v(s,i):x(s,i)}(e.randomBytes(t),e.n)},precompute:(t=8,e=f.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)}}})({...t,hash:e,hmac:(t,...r)=>Y(e,t,(0,o.eV)(...r)),randomBytes:o.O6});return Object.freeze({...r(e),create:r})}({a:BigInt(0),b:BigInt(7),Fp:tu,n:to,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-ts*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),n=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=BigInt("0x100000000000000000000000000000000"),o=tl(e*t,to),s=tl(-r*t,to),f=T(t-o*e-s*n,to),l=T(-o*r-s*e,to),u=f>i,a=l>i;if(u&&(f=to-f),a&&(l=to-l),f>i||l>i)throw Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:u,k1:f,k2neg:a,k2:l}}}},c);BigInt(0),ta.ProjectivePoint}}]);