edge-currency-accountbased 3.2.2 → 3.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/android/src/main/assets/edge-currency-accountbased/2784.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/533.chunk.js +1 -0
- package/android/src/main/assets/edge-currency-accountbased/5336.chunk.js +8 -8
- package/android/src/main/assets/edge-currency-accountbased/8193.chunk.js +3 -3
- package/android/src/main/assets/edge-currency-accountbased/edge-currency-accountbased.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/ethereum.chunk.js +4 -4
- package/android/src/main/assets/edge-currency-accountbased/fio.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/polkadot.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/solana.chunk.js +1 -1
- package/lib/ethereum/EthereumEngine.js +1 -26
- package/lib/ethereum/ethereumTypes.js +0 -6
- package/lib/fio/FioEngine.js +6 -2
- package/lib/fio/fioSchema.js +1 -1
- package/lib/polkadot/PolkadotEngine.js +16 -1
- package/lib/polkadot/PolkadotTools.js +1 -1
- package/lib/polkadot/info/liberlandInfo.js +1 -0
- package/lib/polkadot/info/liberlandTestnetInfo.js +1 -0
- package/lib/polkadot/info/polkadotInfo.js +1 -0
- package/lib/polkadot/polkadotTypes.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkedge_currency_accountbased=self.webpackChunkedge_currency_accountbased||[]).push([[533],{57010:function(kt,Et,ft){ft.d(Et,{K:function(){return T},M:function(){return lt}});var ot=ft(55525),A=ft(27499);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const z=BigInt(0),at=BigInt(1);function lt(C,v){const K=(E,N)=>{const p=N.negate();return E?p:N},dt=E=>{const N=Math.ceil(v/E)+1,p=2**(E-1);return{windows:N,windowSize:p}};return{constTimeNegate:K,unsafeLadder(E,N){let p=C.ZERO,h=E;for(;N>z;)N&at&&(p=p.add(h)),h=h.double(),N>>=at;return p},precomputeWindow(E,N){const{windows:p,windowSize:h}=dt(N),I=[];let _=E,P=_;for(let et=0;et<p;et++){P=_,I.push(P);for(let Y=1;Y<h;Y++)P=P.add(_),I.push(P);_=P.double()}return I},wNAF(E,N,p){const{windows:h,windowSize:I}=dt(E);let _=C.ZERO,P=C.BASE;const et=BigInt(2**E-1),Y=2**E,j=BigInt(E);for(let st=0;st<h;st++){const gt=st*I;let f=Number(p&et);p>>=j,f>I&&(f-=Y,p+=at);const S=gt,G=gt+Math.abs(f)-1,tt=st%2!==0,nt=f<0;f===0?P=P.add(K(tt,N[S])):_=_.add(K(nt,N[G]))}return{p:_,f:P}},wNAFCached(E,N,p,h){const I=E._WINDOW_SIZE||1;let _=N.get(E);return _||(_=this.precomputeWindow(E,I),I!==1&&N.set(E,h(_))),this.wNAF(I,_,p)}}}function T(C){return(0,ot.OP)(C.Fp),(0,A.validateObject)(C,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,ot.kK)(C.n,C.nBitLength),...C,p:C.Fp.ORDER})}},42017:function(kt,Et,ft){var ot=ft(55525),A=ft(27499);function z(h){if(h instanceof Uint8Array)return h;if(typeof h=="string")return utf8ToBytes(h);throw new Error("DST must be Uint8Array or string")}const at=null;function lt(h,I){if(h<0||h>=1<<8*I)throw new Error(`bad I2OSP call: value=${h} length=${I}`);const _=Array.from({length:I}).fill(0);for(let P=I-1;P>=0;P--)_[P]=h&255,h>>>=8;return new Uint8Array(_)}function T(h,I){const _=new Uint8Array(h.length);for(let P=0;P<h.length;P++)_[P]=h[P]^I[P];return _}function C(h){if(!(h instanceof Uint8Array))throw new Error("Uint8Array expected")}function v(h){if(!Number.isSafeInteger(h))throw new Error("number expected")}function K(h,I,_,P){C(h),C(I),v(_),I.length>255&&(I=P(concatBytes(utf8ToBytes("H2C-OVERSIZE-DST-"),I)));const{outputLen:et,blockLen:Y}=P,j=Math.ceil(_/et);if(j>255)throw new Error("Invalid xmd length");const st=concatBytes(I,lt(I.length,1)),gt=lt(0,Y),f=lt(_,2),S=new Array(j),G=P(concatBytes(gt,h,f,lt(0,1),st));S[0]=P(concatBytes(G,lt(1,1),st));for(let nt=1;nt<=j;nt++){const o=[T(G,S[nt-1]),lt(nt+1,1),st];S[nt]=P(concatBytes(...o))}return concatBytes(...S).slice(0,_)}function dt(h,I,_,P,et){if(C(h),C(I),v(_),I.length>255){const Y=Math.ceil(2*P/8);I=et.create({dkLen:Y}).update(utf8ToBytes("H2C-OVERSIZE-DST-")).update(I).digest()}if(_>65535||I.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return et.create({dkLen:_}).update(h).update(lt(_,2)).update(I).update(lt(I.length,1)).digest()}function E(h,I,_){validateObject(_,{DST:"string",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:P,k:et,m:Y,hash:j,expand:st,DST:gt}=_;C(h),v(I);const f=z(gt),S=P.toString(2).length,G=Math.ceil((S+et)/8),tt=I*Y*G;let nt;if(st==="xmd")nt=K(h,f,tt,j);else if(st==="xof")nt=dt(h,f,tt,et,j);else if(st==="_internal_pass")nt=h;else throw new Error('expand must be "xmd" or "xof"');const o=new Array(I);for(let r=0;r<I;r++){const c=new Array(Y);for(let s=0;s<Y;s++){const u=G*(s+r*Y),R=nt.subarray(u,u+G);c[s]=mod(at(R),P)}o[r]=c}return o}function N(h,I){const _=I.map(P=>Array.from(P).reverse());return(P,et)=>{const[Y,j,st,gt]=_.map(f=>f.reduce((S,G)=>h.add(h.mul(S,P),G)));return P=h.div(Y,j),et=h.mul(et,h.div(st,gt)),{x:P,y:et}}}function p(h,I,_){if(typeof I!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(P,et){const Y=E(P,2,{..._,DST:_.DST,...et}),j=h.fromAffine(I(Y[0])),st=h.fromAffine(I(Y[1])),gt=j.add(st).clearCofactor();return gt.assertValidity(),gt},encodeToCurve(P,et){const Y=E(P,1,{..._,DST:_.encodeDST,...et}),j=h.fromAffine(I(Y[0])).clearCofactor();return j.assertValidity(),j}}}},55525:function(kt,Et,ft){ft.d(Et,{DV:function(){return nt},OP:function(){return Y},Pu:function(){return o},Tu:function(){return P},U_:function(){return h},gN:function(){return G},kK:function(){return S},oA:function(){return p},wQ:function(){return E}});var ot=ft(27499);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const A=BigInt(0),z=BigInt(1),at=BigInt(2),lt=BigInt(3),T=BigInt(4),C=BigInt(5),v=BigInt(8),K=BigInt(9),dt=BigInt(16);function E(r,c){const s=r%c;return s>=A?s:c+s}function N(r,c,s){if(s<=A||c<A)throw new Error("Expected power/modulo > 0");if(s===z)return A;let u=z;for(;c>A;)c&z&&(u=u*r%s),r=r*r%s,c>>=z;return u}function p(r,c,s){let u=r;for(;c-- >A;)u*=u,u%=s;return u}function h(r,c){if(r===A||c<=A)throw new Error(`invert: expected positive integers, got n=${r} mod=${c}`);let s=E(r,c),u=c,R=A,Q=z,rt=z,k=A;for(;s!==A;){const X=u/s,bt=u%s,Bt=R-rt*X,pt=Q-k*X;u=s,s=bt,R=rt,Q=k,rt=Bt,k=pt}if(u!==z)throw new Error("invert: does not exist");return E(R,c)}function I(r){const c=(r-z)/at;let s,u,R;for(s=r-z,u=0;s%at===A;s/=at,u++);for(R=at;R<r&&N(R,c,r)!==r-z;R++);if(u===1){const rt=(r+z)/T;return function(b,X){const bt=b.pow(X,rt);if(!b.eql(b.sqr(bt),X))throw new Error("Cannot find square root");return bt}}const Q=(s+z)/at;return function(k,b){if(k.pow(b,c)===k.neg(k.ONE))throw new Error("Cannot find square root");let X=u,bt=k.pow(k.mul(k.ONE,R),s),Bt=k.pow(b,Q),pt=k.pow(b,s);for(;!k.eql(pt,k.ONE);){if(k.eql(pt,k.ZERO))return k.ZERO;let Ot=1;for(let Rt=k.sqr(pt);Ot<X&&!k.eql(Rt,k.ONE);Ot++)Rt=k.sqr(Rt);const qt=k.pow(bt,z<<BigInt(X-Ot-1));bt=k.sqr(qt),Bt=k.mul(Bt,qt),pt=k.mul(pt,bt),X=Ot}return Bt}}function _(r){if(r%T===lt){const c=(r+z)/T;return function(u,R){const Q=u.pow(R,c);if(!u.eql(u.sqr(Q),R))throw new Error("Cannot find square root");return Q}}if(r%v===C){const c=(r-C)/v;return function(u,R){const Q=u.mul(R,at),rt=u.pow(Q,c),k=u.mul(R,rt),b=u.mul(u.mul(k,at),rt),X=u.mul(k,u.sub(b,u.ONE));if(!u.eql(u.sqr(X),R))throw new Error("Cannot find square root");return X}}return r%dt,I(r)}const P=(r,c)=>(E(r,c)&z)===z,et=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Y(r){const c={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},s=et.reduce((u,R)=>(u[R]="function",u),c);return(0,ot.validateObject)(r,s)}function j(r,c,s){if(s<A)throw new Error("Expected power > 0");if(s===A)return r.ONE;if(s===z)return c;let u=r.ONE,R=c;for(;s>A;)s&z&&(u=r.mul(u,R)),R=r.sqr(R),s>>=z;return u}function st(r,c){const s=new Array(c.length),u=c.reduce((Q,rt,k)=>r.is0(rt)?Q:(s[k]=Q,r.mul(Q,rt)),r.ONE),R=r.inv(u);return c.reduceRight((Q,rt,k)=>r.is0(rt)?Q:(s[k]=r.mul(Q,s[k]),r.mul(Q,rt)),R),s}function gt(r,c,s){return r.mul(c,typeof s=="bigint"?h(s,r.ORDER):r.inv(s))}function f(r){const c=(r.ORDER-z)/at;return s=>{const u=r.pow(s,c);return r.eql(u,r.ZERO)||r.eql(u,r.ONE)}}function S(r,c){const s=c!==void 0?c:r.toString(2).length,u=Math.ceil(s/8);return{nBitLength:s,nByteLength:u}}function G(r,c,s=!1,u={}){if(r<=A)throw new Error(`Expected Fp ORDER > 0, got ${r}`);const{nBitLength:R,nByteLength:Q}=S(r,c);if(Q>2048)throw new Error("Field lengths over 2048 bytes are not supported");const rt=_(r),k=Object.freeze({ORDER:r,BITS:R,BYTES:Q,MASK:(0,ot.bitMask)(R),ZERO:A,ONE:z,create:b=>E(b,r),isValid:b=>{if(typeof b!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof b}`);return A<=b&&b<r},is0:b=>b===A,isOdd:b=>(b&z)===z,neg:b=>E(-b,r),eql:(b,X)=>b===X,sqr:b=>E(b*b,r),add:(b,X)=>E(b+X,r),sub:(b,X)=>E(b-X,r),mul:(b,X)=>E(b*X,r),pow:(b,X)=>j(k,b,X),div:(b,X)=>E(b*h(X,r),r),sqrN:b=>b*b,addN:(b,X)=>b+X,subN:(b,X)=>b-X,mulN:(b,X)=>b*X,inv:b=>h(b,r),sqrt:u.sqrt||(b=>rt(k,b)),invertBatch:b=>st(k,b),cmov:(b,X,bt)=>bt?X:b,toBytes:b=>s?(0,ot.numberToBytesLE)(b,Q):(0,ot.numberToBytesBE)(b,Q),fromBytes:b=>{if(b.length!==Q)throw new Error(`Fp.fromBytes: expected ${Q}, got ${b.length}`);return s?(0,ot.bytesToNumberLE)(b):(0,ot.bytesToNumberBE)(b)}});return Object.freeze(k)}function tt(r,c){if(!r.isOdd)throw new Error("Field doesn't have isOdd");const s=r.sqrt(c);return r.isOdd(s)?s:r.neg(s)}function nt(r,c){if(!r.isOdd)throw new Error("Field doesn't have isOdd");const s=r.sqrt(c);return r.isOdd(s)?r.neg(s):s}function o(r,c,s=!1){r=(0,ot.ensureBytes)("privateHash",r);const u=r.length,R=S(c).nByteLength+8;if(R<24||u<R||u>1024)throw new Error(`hashToPrivateScalar: expected ${R}-1024 bytes of input, got ${u}`);const Q=s?(0,ot.bytesToNumberLE)(r):(0,ot.bytesToNumberBE)(r);return E(Q,c-z)+z}},27499:function(kt,Et,ft){ft.r(Et),ft.d(Et,{bitGet:function(){return j},bitLen:function(){return Y},bitMask:function(){return gt},bitSet:function(){return st},bytesToHex:function(){return T},bytesToNumberBE:function(){return dt},bytesToNumberLE:function(){return E},concatBytes:function(){return _},createHmacDrbg:function(){return G},ensureBytes:function(){return I},equalBytes:function(){return P},hexToBytes:function(){return K},hexToNumber:function(){return v},numberToBytesBE:function(){return N},numberToBytesLE:function(){return p},numberToHexUnpadded:function(){return C},numberToVarBytesBE:function(){return h},utf8ToBytes:function(){return et},validateObject:function(){return nt}});/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ot=BigInt(0),A=BigInt(1),z=BigInt(2),at=o=>o instanceof Uint8Array,lt=Array.from({length:256},(o,r)=>r.toString(16).padStart(2,"0"));function T(o){if(!at(o))throw new Error("Uint8Array expected");let r="";for(let c=0;c<o.length;c++)r+=lt[o[c]];return r}function C(o){const r=o.toString(16);return r.length&1?`0${r}`:r}function v(o){if(typeof o!="string")throw new Error("hex string expected, got "+typeof o);return BigInt(o===""?"0":`0x${o}`)}function K(o){if(typeof o!="string")throw new Error("hex string expected, got "+typeof o);const r=o.length;if(r%2)throw new Error("padded hex string expected, got unpadded hex of length "+r);const c=new Uint8Array(r/2);for(let s=0;s<c.length;s++){const u=s*2,R=o.slice(u,u+2),Q=Number.parseInt(R,16);if(Number.isNaN(Q)||Q<0)throw new Error("Invalid byte sequence");c[s]=Q}return c}function dt(o){return v(T(o))}function E(o){if(!at(o))throw new Error("Uint8Array expected");return v(T(Uint8Array.from(o).reverse()))}function N(o,r){return K(o.toString(16).padStart(r*2,"0"))}function p(o,r){return N(o,r).reverse()}function h(o){return K(C(o))}function I(o,r,c){let s;if(typeof r=="string")try{s=K(r)}catch(R){throw new Error(`${o} must be valid hex string, got "${r}". Cause: ${R}`)}else if(at(r))s=Uint8Array.from(r);else throw new Error(`${o} must be hex string or Uint8Array`);const u=s.length;if(typeof c=="number"&&u!==c)throw new Error(`${o} expected ${c} bytes, got ${u}`);return s}function _(...o){const r=new Uint8Array(o.reduce((s,u)=>s+u.length,0));let c=0;return o.forEach(s=>{if(!at(s))throw new Error("Uint8Array expected");r.set(s,c),c+=s.length}),r}function P(o,r){if(o.length!==r.length)return!1;for(let c=0;c<o.length;c++)if(o[c]!==r[c])return!1;return!0}function et(o){if(typeof o!="string")throw new Error(`utf8ToBytes expected string, got ${typeof o}`);return new Uint8Array(new TextEncoder().encode(o))}function Y(o){let r;for(r=0;o>ot;o>>=A,r+=1);return r}function j(o,r){return o>>BigInt(r)&A}const st=(o,r,c)=>o|(c?A:ot)<<BigInt(r),gt=o=>(z<<BigInt(o-1))-A,f=o=>new Uint8Array(o),S=o=>Uint8Array.from(o);function G(o,r,c){if(typeof o!="number"||o<2)throw new Error("hashLen must be a number");if(typeof r!="number"||r<2)throw new Error("qByteLen must be a number");if(typeof c!="function")throw new Error("hmacFn must be a function");let s=f(o),u=f(o),R=0;const Q=()=>{s.fill(1),u.fill(0),R=0},rt=(...bt)=>c(u,s,...bt),k=(bt=f())=>{u=rt(S([0]),bt),s=rt(),bt.length!==0&&(u=rt(S([1]),bt),s=rt())},b=()=>{if(R++>=1e3)throw new Error("drbg: tried 1000 values");let bt=0;const Bt=[];for(;bt<r;){s=rt();const pt=s.slice();Bt.push(pt),bt+=s.length}return _(...Bt)};return(bt,Bt)=>{Q(),k(bt);let pt;for(;!(pt=Bt(b()));)k();return Q(),pt}}const tt={bigint:o=>typeof o=="bigint",function:o=>typeof o=="function",boolean:o=>typeof o=="boolean",string:o=>typeof o=="string",isSafeInteger:o=>Number.isSafeInteger(o),array:o=>Array.isArray(o),field:(o,r)=>r.Fp.isValid(o),hash:o=>typeof o=="function"&&Number.isSafeInteger(o.outputLen)};function nt(o,r,c={}){const s=(u,R,Q)=>{const rt=tt[R];if(typeof rt!="function")throw new Error(`Invalid validator "${R}", expected function`);const k=o[u];if(!(Q&&k===void 0)&&!rt(k,o))throw new Error(`Invalid param ${String(u)}=${k} (${typeof k}), expected ${R}`)};for(const[u,R]of Object.entries(r))s(u,R,!1);for(const[u,R]of Object.entries(c))s(u,R,!0);return o}},60533:function(kt,Et,ft){ft.d(Et,{kA:function(){return Ot}});var ot=ft(38235),A=ft(63321);const z=(n,e,t)=>n&e^~n&t,at=(n,e,t)=>n&e^n&t^e&t,lt=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]),T=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),C=new Uint32Array(64);class v extends ot.N{constructor(){super(64,32,8,!1),this.A=T[0]|0,this.B=T[1]|0,this.C=T[2]|0,this.D=T[3]|0,this.E=T[4]|0,this.F=T[5]|0,this.G=T[6]|0,this.H=T[7]|0}get(){const{A:e,B:t,C:l,D:O,E:g,F:U,G:x,H:F}=this;return[e,t,l,O,g,U,x,F]}set(e,t,l,O,g,U,x,F){this.A=e|0,this.B=t|0,this.C=l|0,this.D=O|0,this.E=g|0,this.F=U|0,this.G=x|0,this.H=F|0}process(e,t){for(let w=0;w<16;w++,t+=4)C[w]=e.getUint32(t,!1);for(let w=16;w<64;w++){const yt=C[w-15],it=C[w-2],Z=(0,A.np)(yt,7)^(0,A.np)(yt,18)^yt>>>3,i=(0,A.np)(it,17)^(0,A.np)(it,19)^it>>>10;C[w]=i+C[w-7]+Z+C[w-16]|0}let{A:l,B:O,C:g,D:U,E:x,F,G:q,H:D}=this;for(let w=0;w<64;w++){const yt=(0,A.np)(x,6)^(0,A.np)(x,11)^(0,A.np)(x,25),it=D+yt+z(x,F,q)+lt[w]+C[w]|0,i=((0,A.np)(l,2)^(0,A.np)(l,13)^(0,A.np)(l,22))+at(l,O,g)|0;D=q,q=F,F=x,x=U+it|0,U=g,g=O,O=l,l=it+i|0}l=l+this.A|0,O=O+this.B|0,g=g+this.C|0,U=U+this.D|0,x=x+this.E|0,F=F+this.F|0,q=q+this.G|0,D=D+this.H|0,this.set(l,O,g,U,x,F,q,D)}roundClean(){C.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class K extends v{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}}const dt=(0,A.hE)(()=>new v),E=(0,A.hE)(()=>new K);var N=ft(55525),p=ft(27499),h=ft(57010);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function I(n){const e=(0,h.K)(n);p.validateObject(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:l,a:O}=e;if(t){if(!l.eql(O,l.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:_,hexToBytes:P}=p,et={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(n){const{Err:e}=et;if(n.length<2||n[0]!==2)throw new e("Invalid signature integer tag");const t=n[1],l=n.subarray(2,t+2);if(!t||l.length!==t)throw new e("Invalid signature integer: wrong length");if(l[0]&128)throw new e("Invalid signature integer: negative");if(l[0]===0&&!(l[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:_(l),l:n.subarray(t+2)}},toSig(n){const{Err:e}=et,t=typeof n=="string"?P(n):n;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let l=t.length;if(l<2||t[0]!=48)throw new e("Invalid signature tag");if(t[1]!==l-2)throw new e("Invalid signature: incorrect length");const{d:O,l:g}=et._parseInt(t.subarray(2)),{d:U,l:x}=et._parseInt(g);if(x.length)throw new e("Invalid signature: left bytes after parsing");return{r:O,s:U}},hexFromSig(n){const e=q=>Number.parseInt(q[0],16)&8?"00"+q:q,t=q=>{const D=q.toString(16);return D.length&1?`0${D}`:D},l=e(t(n.s)),O=e(t(n.r)),g=l.length/2,U=O.length/2,x=t(g),F=t(U);return`30${t(U+g+4)}02${F}${O}02${x}${l}`}},Y=BigInt(0),j=BigInt(1),st=BigInt(2),gt=BigInt(3),f=BigInt(4);function S(n){const e=I(n),{Fp:t}=e,l=e.toBytes||((Z,i,y)=>{const d=i.toAffine();return p.concatBytes(Uint8Array.from([4]),t.toBytes(d.x),t.toBytes(d.y))}),O=e.fromBytes||(Z=>{const i=Z.subarray(1),y=t.fromBytes(i.subarray(0,t.BYTES)),d=t.fromBytes(i.subarray(t.BYTES,2*t.BYTES));return{x:y,y:d}});function g(Z){const{a:i,b:y}=e,d=t.sqr(Z),B=t.mul(d,Z);return t.add(t.add(B,t.mul(Z,i)),y)}if(!t.eql(t.sqr(e.Gy),g(e.Gx)))throw new Error("bad generator point: equation left != right");function U(Z){return typeof Z=="bigint"&&Y<Z&&Z<e.n}function x(Z){if(!U(Z))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function F(Z){const{allowedPrivateKeyLengths:i,nByteLength:y,wrapPrivateKey:d,n:B}=e;if(i&&typeof Z!="bigint"){if(Z instanceof Uint8Array&&(Z=p.bytesToHex(Z)),typeof Z!="string"||!i.includes(Z.length))throw new Error("Invalid key");Z=Z.padStart(y*2,"0")}let H;try{H=typeof Z=="bigint"?Z:p.bytesToNumberBE((0,p.ensureBytes)("private key",Z,y))}catch{throw new Error(`private key must be ${y} bytes, hex or bigint, not ${typeof Z}`)}return d&&(H=N.wQ(H,B)),x(H),H}const q=new Map;function D(Z){if(!(Z instanceof w))throw new Error("ProjectivePoint expected")}class w{constructor(i,y,d){if(this.px=i,this.py=y,this.pz=d,i==null||!t.isValid(i))throw new Error("x required");if(y==null||!t.isValid(y))throw new Error("y required");if(d==null||!t.isValid(d))throw new Error("z required")}static fromAffine(i){const{x:y,y:d}=i||{};if(!i||!t.isValid(y)||!t.isValid(d))throw new Error("invalid affine point");if(i instanceof w)throw new Error("projective point not allowed");const B=H=>t.eql(H,t.ZERO);return B(y)&&B(d)?w.ZERO:new w(y,d,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(i){const y=t.invertBatch(i.map(d=>d.pz));return i.map((d,B)=>d.toAffine(y[B])).map(w.fromAffine)}static fromHex(i){const y=w.fromAffine(O((0,p.ensureBytes)("pointHex",i)));return y.assertValidity(),y}static fromPrivateKey(i){return w.BASE.multiply(F(i))}_setWindowSize(i){this._WINDOW_SIZE=i,q.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint)return;throw new Error("bad point: ZERO")}const{x:i,y}=this.toAffine();if(!t.isValid(i)||!t.isValid(y))throw new Error("bad point: x or y not FE");const d=t.sqr(y),B=g(i);if(!t.eql(d,B))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:i}=this.toAffine();if(t.isOdd)return!t.isOdd(i);throw new Error("Field doesn't support isOdd")}equals(i){D(i);const{px:y,py:d,pz:B}=this,{px:H,py:$,pz:W}=i,L=t.eql(t.mul(y,W),t.mul(H,B)),V=t.eql(t.mul(d,W),t.mul($,B));return L&&V}negate(){return new w(this.px,t.neg(this.py),this.pz)}double(){const{a:i,b:y}=e,d=t.mul(y,gt),{px:B,py:H,pz:$}=this;let W=t.ZERO,L=t.ZERO,V=t.ZERO,M=t.mul(B,B),xt=t.mul(H,H),wt=t.mul($,$),ct=t.mul(B,H);return ct=t.add(ct,ct),V=t.mul(B,$),V=t.add(V,V),W=t.mul(i,V),L=t.mul(d,wt),L=t.add(W,L),W=t.sub(xt,L),L=t.add(xt,L),L=t.mul(W,L),W=t.mul(ct,W),V=t.mul(d,V),wt=t.mul(i,wt),ct=t.sub(M,wt),ct=t.mul(i,ct),ct=t.add(ct,V),V=t.add(M,M),M=t.add(V,M),M=t.add(M,wt),M=t.mul(M,ct),L=t.add(L,M),wt=t.mul(H,$),wt=t.add(wt,wt),M=t.mul(wt,ct),W=t.sub(W,M),V=t.mul(wt,xt),V=t.add(V,V),V=t.add(V,V),new w(W,L,V)}add(i){D(i);const{px:y,py:d,pz:B}=this,{px:H,py:$,pz:W}=i;let L=t.ZERO,V=t.ZERO,M=t.ZERO;const xt=e.a,wt=t.mul(e.b,gt);let ct=t.mul(y,H),vt=t.mul(d,$),_t=t.mul(B,W),Tt=t.add(y,d),a=t.add(H,$);Tt=t.mul(Tt,a),a=t.add(ct,vt),Tt=t.sub(Tt,a),a=t.add(y,B);let m=t.add(H,W);return a=t.mul(a,m),m=t.add(ct,_t),a=t.sub(a,m),m=t.add(d,B),L=t.add($,W),m=t.mul(m,L),L=t.add(vt,_t),m=t.sub(m,L),M=t.mul(xt,a),L=t.mul(wt,_t),M=t.add(L,M),L=t.sub(vt,M),M=t.add(vt,M),V=t.mul(L,M),vt=t.add(ct,ct),vt=t.add(vt,ct),_t=t.mul(xt,_t),a=t.mul(wt,a),vt=t.add(vt,_t),_t=t.sub(ct,_t),_t=t.mul(xt,_t),a=t.add(a,_t),ct=t.mul(vt,a),V=t.add(V,ct),ct=t.mul(m,a),L=t.mul(Tt,L),L=t.sub(L,ct),ct=t.mul(Tt,vt),M=t.mul(m,M),M=t.add(M,ct),new w(L,V,M)}subtract(i){return this.add(i.negate())}is0(){return this.equals(w.ZERO)}wNAF(i){return it.wNAFCached(this,q,i,y=>{const d=t.invertBatch(y.map(B=>B.pz));return y.map((B,H)=>B.toAffine(d[H])).map(w.fromAffine)})}multiplyUnsafe(i){const y=w.ZERO;if(i===Y)return y;if(x(i),i===j)return this;const{endo:d}=e;if(!d)return it.unsafeLadder(this,i);let{k1neg:B,k1:H,k2neg:$,k2:W}=d.splitScalar(i),L=y,V=y,M=this;for(;H>Y||W>Y;)H&j&&(L=L.add(M)),W&j&&(V=V.add(M)),M=M.double(),H>>=j,W>>=j;return B&&(L=L.negate()),$&&(V=V.negate()),V=new w(t.mul(V.px,d.beta),V.py,V.pz),L.add(V)}multiply(i){x(i);let y=i,d,B;const{endo:H}=e;if(H){const{k1neg:$,k1:W,k2neg:L,k2:V}=H.splitScalar(y);let{p:M,f:xt}=this.wNAF(W),{p:wt,f:ct}=this.wNAF(V);M=it.constTimeNegate($,M),wt=it.constTimeNegate(L,wt),wt=new w(t.mul(wt.px,H.beta),wt.py,wt.pz),d=M.add(wt),B=xt.add(ct)}else{const{p:$,f:W}=this.wNAF(y);d=$,B=W}return w.normalizeZ([d,B])[0]}multiplyAndAddUnsafe(i,y,d){const B=w.BASE,H=(W,L)=>L===Y||L===j||!W.equals(B)?W.multiplyUnsafe(L):W.multiply(L),$=H(this,y).add(H(i,d));return $.is0()?void 0:$}toAffine(i){const{px:y,py:d,pz:B}=this,H=this.is0();i==null&&(i=H?t.ONE:t.inv(B));const $=t.mul(y,i),W=t.mul(d,i),L=t.mul(B,i);if(H)return{x:t.ZERO,y:t.ZERO};if(!t.eql(L,t.ONE))throw new Error("invZ was invalid");return{x:$,y:W}}isTorsionFree(){const{h:i,isTorsionFree:y}=e;if(i===j)return!0;if(y)return y(w,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:i,clearCofactor:y}=e;return i===j?this:y?y(w,this):this.multiplyUnsafe(e.h)}toRawBytes(i=!0){return this.assertValidity(),l(w,this,i)}toHex(i=!0){return p.bytesToHex(this.toRawBytes(i))}}w.BASE=new w(e.Gx,e.Gy,t.ONE),w.ZERO=new w(t.ZERO,t.ONE,t.ZERO);const yt=e.nBitLength,it=(0,h.M)(w,e.endo?Math.ceil(yt/2):yt);return{CURVE:e,ProjectivePoint:w,normPrivateKeyToScalar:F,weierstrassEquation:g,isWithinCurveOrder:U}}function G(n){const e=(0,h.K)(n);return p.validateObject(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function tt(n){const e=G(n),{Fp:t,n:l}=e,O=t.BYTES+1,g=2*t.BYTES+1;function U(a){return Y<a&&a<t.ORDER}function x(a){return N.wQ(a,l)}function F(a){return N.U_(a,l)}const{ProjectivePoint:q,normPrivateKeyToScalar:D,weierstrassEquation:w,isWithinCurveOrder:yt}=S({...e,toBytes(a,m,J){const ht=m.toAffine(),ut=t.toBytes(ht.x),mt=p.concatBytes;return J?mt(Uint8Array.from([m.hasEvenY()?2:3]),ut):mt(Uint8Array.from([4]),ut,t.toBytes(ht.y))},fromBytes(a){const m=a.length,J=a[0],ht=a.subarray(1);if(m===O&&(J===2||J===3)){const ut=p.bytesToNumberBE(ht);if(!U(ut))throw new Error("Point is not on curve");const mt=w(ut);let At=t.sqrt(mt);const St=(At&j)===j;return(J&1)===1!==St&&(At=t.neg(At)),{x:ut,y:At}}else if(m===g&&J===4){const ut=t.fromBytes(ht.subarray(0,t.BYTES)),mt=t.fromBytes(ht.subarray(t.BYTES,2*t.BYTES));return{x:ut,y:mt}}else throw new Error(`Point of length ${m} was invalid. Expected ${O} compressed bytes or ${g} uncompressed bytes`)}}),it=a=>p.bytesToHex(p.numberToBytesBE(a,e.nByteLength));function Z(a){const m=l>>j;return a>m}function i(a){return Z(a)?x(-a):a}const y=(a,m,J)=>p.bytesToNumberBE(a.slice(m,J));class d{constructor(m,J,ht){this.r=m,this.s=J,this.recovery=ht,this.assertValidity()}static fromCompact(m){const J=e.nByteLength;return m=(0,p.ensureBytes)("compactSignature",m,J*2),new d(y(m,0,J),y(m,J,2*J))}static fromDER(m){const{r:J,s:ht}=et.toSig((0,p.ensureBytes)("DER",m));return new d(J,ht)}assertValidity(){if(!yt(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!yt(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(m){return new d(this.r,this.s,m)}recoverPublicKey(m){const{r:J,s:ht,recovery:ut}=this,mt=V((0,p.ensureBytes)("msgHash",m));if(ut==null||![0,1,2,3].includes(ut))throw new Error("recovery id invalid");const At=ut===2||ut===3?J+e.n:J;if(At>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const St=(ut&1)===0?"02":"03",Nt=q.fromHex(St+it(At)),Lt=F(At),Ct=x(-mt*Lt),jt=x(ht*Lt),Ut=q.BASE.multiplyAndAddUnsafe(Nt,Ct,jt);if(!Ut)throw new Error("point at infinify");return Ut.assertValidity(),Ut}hasHighS(){return Z(this.s)}normalizeS(){return this.hasHighS()?new d(this.r,x(-this.s),this.recovery):this}toDERRawBytes(){return p.hexToBytes(this.toDERHex())}toDERHex(){return et.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return p.hexToBytes(this.toCompactHex())}toCompactHex(){return it(this.r)+it(this.s)}}const B={isValidPrivateKey(a){try{return D(a),!0}catch{return!1}},normPrivateKeyToScalar:D,randomPrivateKey:()=>{const a=e.randomBytes(t.BYTES+8),m=N.Pu(a,l);return p.numberToBytesBE(m,e.nByteLength)},precompute(a=8,m=q.BASE){return m._setWindowSize(a),m.multiply(BigInt(3)),m}};function H(a,m=!0){return q.fromPrivateKey(a).toRawBytes(m)}function $(a){const m=a instanceof Uint8Array,J=typeof a=="string",ht=(m||J)&&a.length;return m?ht===O||ht===g:J?ht===2*O||ht===2*g:a instanceof q}function W(a,m,J=!0){if($(a))throw new Error("first arg must be private key");if(!$(m))throw new Error("second arg must be public key");return q.fromHex(m).multiply(D(a)).toRawBytes(J)}const L=e.bits2int||function(a){const m=p.bytesToNumberBE(a),J=a.length*8-e.nBitLength;return J>0?m>>BigInt(J):m},V=e.bits2int_modN||function(a){return x(L(a))},M=p.bitMask(e.nBitLength);function xt(a){if(typeof a!="bigint")throw new Error("bigint expected");if(!(Y<=a&&a<M))throw new Error(`bigint expected < 2^${e.nBitLength}`);return p.numberToBytesBE(a,e.nByteLength)}function wt(a,m,J=ct){if(["recovered","canonical"].some(Ht=>Ht in J))throw new Error("sign() legacy options not supported");const{hash:ht,randomBytes:ut}=e;let{lowS:mt,prehash:At,extraEntropy:St}=J;mt==null&&(mt=!0),a=(0,p.ensureBytes)("msgHash",a),At&&(a=(0,p.ensureBytes)("prehashed msgHash",ht(a)));const Nt=V(a),Lt=D(m),Ct=[xt(Lt),xt(Nt)];if(St!=null){const Ht=St===!0?ut(t.BYTES):St;Ct.push((0,p.ensureBytes)("extraEntropy",Ht,t.BYTES))}const jt=p.concatBytes(...Ct),Ut=Nt;function Gt(Ht){const Pt=L(Ht);if(!yt(Pt))return;const Jt=F(Pt),Zt=q.BASE.multiply(Pt).toAffine(),It=x(Zt.x);if(It===Y)return;const Vt=x(Jt*x(Ut+It*Lt));if(Vt===Y)return;let Ft=(Zt.x===It?0:2)|Number(Zt.y&j),te=Vt;return mt&&Z(Vt)&&(te=i(Vt),Ft^=1),new d(It,te,Ft)}return{seed:jt,k2sig:Gt}}const ct={lowS:e.lowS,prehash:!1},vt={lowS:e.lowS,prehash:!1};function _t(a,m,J=ct){const{seed:ht,k2sig:ut}=wt(a,m,J),mt=e;return p.createHmacDrbg(mt.hash.outputLen,mt.nByteLength,mt.hmac)(ht,ut)}q.BASE._setWindowSize(8);function Tt(a,m,J,ht=vt){var Zt;const ut=a;if(m=(0,p.ensureBytes)("msgHash",m),J=(0,p.ensureBytes)("publicKey",J),"strict"in ht)throw new Error("options.strict was renamed to lowS");const{lowS:mt,prehash:At}=ht;let St,Nt;try{if(typeof ut=="string"||ut instanceof Uint8Array)try{St=d.fromDER(ut)}catch(It){if(!(It instanceof et.Err))throw It;St=d.fromCompact(ut)}else if(typeof ut=="object"&&typeof ut.r=="bigint"&&typeof ut.s=="bigint"){const{r:It,s:Vt}=ut;St=new d(It,Vt)}else throw new Error("PARSE");Nt=q.fromHex(J)}catch(It){if(It.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(mt&&St.hasHighS())return!1;At&&(m=e.hash(m));const{r:Lt,s:Ct}=St,jt=V(m),Ut=F(Ct),Gt=x(jt*Ut),Ht=x(Lt*Ut),Pt=(Zt=q.BASE.multiplyAndAddUnsafe(Nt,Gt,Ht))==null?void 0:Zt.toAffine();return Pt?x(Pt.x)===Lt:!1}return{CURVE:e,getPublicKey:H,getSharedSecret:W,sign:_t,verify:Tt,ProjectivePoint:q,Signature:d,utils:B}}function nt(n,e){const t=n.ORDER;let l=Y;for(let Z=t-j;Z%st===Y;Z/=st)l+=j;const O=l,g=st<<O-j-j,U=g*st,x=(t-j)/U,F=(x-j)/st,q=U-j,D=g,w=n.pow(e,x),yt=n.pow(e,(x+j)/st);let it=(Z,i)=>{let y=w,d=n.pow(i,q),B=n.sqr(d);B=n.mul(B,i);let H=n.mul(Z,B);H=n.pow(H,F),H=n.mul(H,d),d=n.mul(H,i),B=n.mul(H,Z);let $=n.mul(B,d);H=n.pow($,D);let W=n.eql(H,n.ONE);d=n.mul(B,yt),H=n.mul($,y),B=n.cmov(d,B,W),$=n.cmov(H,$,W);for(let L=O;L>j;L--){let V=L-st;V=st<<V-j;let M=n.pow($,V);const xt=n.eql(M,n.ONE);d=n.mul(B,y),y=n.mul(y,y),M=n.mul($,y),B=n.cmov(d,B,xt),$=n.cmov(M,$,xt)}return{isValid:W,value:B}};if(n.ORDER%f===gt){const Z=(n.ORDER-gt)/f,i=n.sqrt(n.neg(e));it=(y,d)=>{let B=n.sqr(d);const H=n.mul(y,d);B=n.mul(B,H);let $=n.pow(B,Z);$=n.mul($,H);const W=n.mul($,i),L=n.mul(n.sqr($),d),V=n.eql(L,y);let M=n.cmov(W,$,V);return{isValid:V,value:M}}}return it}function o(n,e){if(mod.validateField(n),!n.isValid(e.A)||!n.isValid(e.B)||!n.isValid(e.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const t=nt(n,e.Z);if(!n.isOdd)throw new Error("Fp.isOdd is not implemented!");return l=>{let O,g,U,x,F,q,D,w;O=n.sqr(l),O=n.mul(O,e.Z),g=n.sqr(O),g=n.add(g,O),U=n.add(g,n.ONE),U=n.mul(U,e.B),x=n.cmov(e.Z,n.neg(g),!n.eql(g,n.ZERO)),x=n.mul(x,e.A),g=n.sqr(U),q=n.sqr(x),F=n.mul(q,e.A),g=n.add(g,F),g=n.mul(g,U),q=n.mul(q,x),F=n.mul(q,e.B),g=n.add(g,F),D=n.mul(O,U);const{isValid:yt,value:it}=t(g,q);w=n.mul(O,l),w=n.mul(w,it),D=n.cmov(D,U,yt),w=n.cmov(w,it,yt);const Z=n.isOdd(l)===n.isOdd(w);return w=n.cmov(n.neg(w),w,Z),D=n.div(D,x),{x:D,y:w}}}var r=ft(42017),c=ft(26032);class s extends A.kb{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,c.ZP.hash(e);const l=(0,A.O0)(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const O=this.blockLen,g=new Uint8Array(O);g.set(l.length>O?e.create().update(l).digest():l);for(let U=0;U<g.length;U++)g[U]^=54;this.iHash.update(g),this.oHash=e.create();for(let U=0;U<g.length;U++)g[U]^=106;this.oHash.update(g),g.fill(0)}update(e){return c.ZP.exists(this),this.iHash.update(e),this}digestInto(e){c.ZP.exists(this),c.ZP.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:l,finished:O,destroyed:g,blockLen:U,outputLen:x}=this;return e=e,e.finished=O,e.destroyed=g,e.blockLen=U,e.outputLen=x,e.oHash=t._cloneInto(e.oHash),e.iHash=l._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const u=(n,e,t)=>new s(n,e).update(t).digest();u.create=(n,e)=>new s(n,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function R(n){return{hash:n,hmac:(e,...t)=>u(n,e,(0,A.eV)(...t)),randomBytes:A.O6}}function Q(n,e){const t=l=>tt({...n,...R(l)});return Object.freeze({...t(e),create:t})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const rt=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),k=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),b=BigInt(1),X=BigInt(2),bt=(n,e)=>(n+e/X)/e;function Bt(n){const e=rt,t=BigInt(3),l=BigInt(6),O=BigInt(11),g=BigInt(22),U=BigInt(23),x=BigInt(44),F=BigInt(88),q=n*n*n%e,D=q*q*n%e,w=(0,N.oA)(D,t,e)*D%e,yt=(0,N.oA)(w,t,e)*D%e,it=(0,N.oA)(yt,X,e)*q%e,Z=(0,N.oA)(it,O,e)*it%e,i=(0,N.oA)(Z,g,e)*Z%e,y=(0,N.oA)(i,x,e)*i%e,d=(0,N.oA)(y,F,e)*y%e,B=(0,N.oA)(d,x,e)*i%e,H=(0,N.oA)(B,t,e)*D%e,$=(0,N.oA)(H,U,e)*Z%e,W=(0,N.oA)($,l,e)*q%e,L=(0,N.oA)(W,X,e);if(!pt.eql(pt.sqr(L),n))throw new Error("Cannot find square root");return L}const pt=(0,N.gN)(rt,void 0,void 0,{sqrt:Bt}),Ot=Q({a:BigInt(0),b:BigInt(7),Fp:pt,n:k,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{const e=k,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),l=-b*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),O=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),g=t,U=BigInt("0x100000000000000000000000000000000"),x=bt(g*n,e),F=bt(-l*n,e);let q=(0,N.wQ)(n-x*t-F*O,e),D=(0,N.wQ)(-x*l-F*g,e);const w=q>U,yt=D>U;if(w&&(q=e-q),yt&&(D=e-D),q>U||D>U)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:w,k1:q,k2neg:yt,k2:D}}}},dt),qt=BigInt(0),Rt=n=>typeof n=="bigint"&&qt<n&&n<rt,ee=n=>typeof n=="bigint"&&qt<n&&n<k,Yt={};function $t(n,...e){let t=Yt[n];if(t===void 0){const l=sha256(Uint8Array.from(n,O=>O.charCodeAt(0)));t=concatBytes(l,l),Yt[n]=t}return sha256(concatBytes(t,...e))}const Xt=n=>n.toRawBytes(!0).slice(1),Mt=n=>numberToBytesBE(n,32),Kt=n=>mod(n,rt),Dt=n=>mod(n,k),Wt=Ot.ProjectivePoint,ne=(n,e,t)=>Wt.BASE.multiplyAndAddUnsafe(n,e,t);function zt(n){let e=Ot.utils.normPrivateKeyToScalar(n),t=Wt.fromPrivateKey(e);return{scalar:t.hasEvenY()?e:Dt(-e),bytes:Xt(t)}}function re(n){if(!Rt(n))throw new Error("bad x: need 0 < x < p");const e=Kt(n*n),t=Kt(e*n+BigInt(7));let l=Bt(t);l%X!==qt&&(l=Kt(-l));const O=new Wt(n,l,b);return O.assertValidity(),O}function Qt(...n){return Dt(bytesToNumberBE($t("BIP0340/challenge",...n)))}function se(n){return zt(n).bytes}function ie(n,e,t=randomBytes(32)){const l=ensureBytes("message",n),{bytes:O,scalar:g}=zt(e),U=ensureBytes("auxRand",t,32),x=Mt(g^bytesToNumberBE($t("BIP0340/aux",U))),F=$t("BIP0340/nonce",x,O,l),q=Dt(bytesToNumberBE(F));if(q===qt)throw new Error("sign failed: k is zero");const{bytes:D,scalar:w}=zt(q),yt=Qt(D,O,l),it=new Uint8Array(64);if(it.set(D,0),it.set(Mt(Dt(w+yt*g)),32),!oe(it,l,O))throw new Error("sign: Invalid signature produced");return it}function oe(n,e,t){const l=ensureBytes("signature",n,64),O=ensureBytes("message",e),g=ensureBytes("publicKey",t,32);try{const U=re(bytesToNumberBE(g)),x=bytesToNumberBE(l.subarray(0,32));if(!Rt(x))return!1;const F=bytesToNumberBE(l.subarray(32,64));if(!ee(F))return!1;const q=Qt(Mt(x),Xt(U),O),D=ne(U,F,Dt(-q));return!(!D||!D.hasEvenY()||D.toAffine().x!==x)}catch{return!1}}const ce=null,fe=null,ue=null,ae=null,le=null,de=null},26032:function(kt,Et,ft){function ot(v){if(!Number.isSafeInteger(v)||v<0)throw new Error(`Wrong positive integer: ${v}`)}function A(v){if(typeof v!="boolean")throw new Error(`Expected boolean, not ${v}`)}function z(v,...K){if(!(v instanceof Uint8Array))throw new Error("Expected Uint8Array");if(K.length>0&&!K.includes(v.length))throw new Error(`Expected Uint8Array of length ${K}, not of length=${v.length}`)}function at(v){if(typeof v!="function"||typeof v.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ot(v.outputLen),ot(v.blockLen)}function lt(v,K=!0){if(v.destroyed)throw new Error("Hash instance has been destroyed");if(K&&v.finished)throw new Error("Hash#digest() has already been called")}function T(v,K){z(v);const dt=K.outputLen;if(v.length<dt)throw new Error(`digestInto() expects output buffer of length at least ${dt}`)}const C={number:ot,bool:A,bytes:z,hash:at,exists:lt,output:T};Et.ZP=C},38235:function(kt,Et,ft){ft.d(Et,{N:function(){return at}});var ot=ft(26032),A=ft(63321);function z(lt,T,C,v){if(typeof lt.setBigUint64=="function")return lt.setBigUint64(T,C,v);const K=BigInt(32),dt=BigInt(4294967295),E=Number(C>>K&dt),N=Number(C&dt),p=v?4:0,h=v?0:4;lt.setUint32(T+p,E,v),lt.setUint32(T+h,N,v)}class at extends A.kb{constructor(T,C,v,K){super(),this.blockLen=T,this.outputLen=C,this.padOffset=v,this.isLE=K,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(T),this.view=(0,A.GL)(this.buffer)}update(T){ot.ZP.exists(this);const{view:C,buffer:v,blockLen:K}=this;T=(0,A.O0)(T);const dt=T.length;for(let E=0;E<dt;){const N=Math.min(K-this.pos,dt-E);if(N===K){const p=(0,A.GL)(T);for(;K<=dt-E;E+=K)this.process(p,E);continue}v.set(T.subarray(E,E+N),this.pos),this.pos+=N,E+=N,this.pos===K&&(this.process(C,0),this.pos=0)}return this.length+=T.length,this.roundClean(),this}digestInto(T){ot.ZP.exists(this),ot.ZP.output(T,this),this.finished=!0;const{buffer:C,view:v,blockLen:K,isLE:dt}=this;let{pos:E}=this;C[E++]=128,this.buffer.subarray(E).fill(0),this.padOffset>K-E&&(this.process(v,0),E=0);for(let _=E;_<K;_++)C[_]=0;z(v,K-8,BigInt(this.length*8),dt),this.process(v,0);const N=(0,A.GL)(T),p=this.outputLen;if(p%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const h=p/4,I=this.get();if(h>I.length)throw new Error("_sha2: outputLen bigger than state");for(let _=0;_<h;_++)N.setUint32(4*_,I[_],dt)}digest(){const{buffer:T,outputLen:C}=this;this.digestInto(T);const v=T.slice(0,C);return this.destroy(),v}_cloneInto(T){T||(T=new this.constructor),T.set(...this.get());const{blockLen:C,buffer:v,length:K,finished:dt,destroyed:E,pos:N}=this;return T.length=K,T.pos=N,T.finished=dt,T.destroyed=E,K%C&&T.buffer.set(v),T}}},63321:function(kt,Et,ft){ft.d(Et,{kb:function(){return _},eV:function(){return I},GL:function(){return lt},O6:function(){return gt},np:function(){return T},O0:function(){return h},iY:function(){return p},hE:function(){return Y}});const ot=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const A=f=>f instanceof Uint8Array,z=f=>new Uint8Array(f.buffer,f.byteOffset,f.byteLength),at=f=>new Uint32Array(f.buffer,f.byteOffset,Math.floor(f.byteLength/4)),lt=f=>new DataView(f.buffer,f.byteOffset,f.byteLength),T=(f,S)=>f<<32-S|f>>>S;if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");const v=Array.from({length:256},(f,S)=>S.toString(16).padStart(2,"0"));function K(f){if(!A(f))throw new Error("Uint8Array expected");let S="";for(let G=0;G<f.length;G++)S+=v[f[G]];return S}function dt(f){if(typeof f!="string")throw new Error("hex string expected, got "+typeof f);const S=f.length;if(S%2)throw new Error("padded hex string expected, got unpadded hex of length "+S);const G=new Uint8Array(S/2);for(let tt=0;tt<G.length;tt++){const nt=tt*2,o=f.slice(nt,nt+2),r=Number.parseInt(o,16);if(Number.isNaN(r)||r<0)throw new Error("Invalid byte sequence");G[tt]=r}return G}const E=async()=>{};async function N(f,S,G){let tt=Date.now();for(let nt=0;nt<f;nt++){G(nt);const o=Date.now()-tt;o>=0&&o<S||(await E(),tt+=o)}}function p(f){if(typeof f!="string")throw new Error(`utf8ToBytes expected string, got ${typeof f}`);return new Uint8Array(new TextEncoder().encode(f))}function h(f){if(typeof f=="string"&&(f=p(f)),!A(f))throw new Error(`expected Uint8Array, got ${typeof f}`);return f}function I(...f){const S=new Uint8Array(f.reduce((tt,nt)=>tt+nt.length,0));let G=0;return f.forEach(tt=>{if(!A(tt))throw new Error("Uint8Array expected");S.set(tt,G),G+=tt.length}),S}class _{clone(){return this._cloneInto()}}const P=f=>Object.prototype.toString.call(f)==="[object Object]"&&f.constructor===Object;function et(f,S){if(S!==void 0&&(typeof S!="object"||!P(S)))throw new Error("Options should be object or undefined");return Object.assign(f,S)}function Y(f){const S=tt=>f().update(h(tt)).digest(),G=f();return S.outputLen=G.outputLen,S.blockLen=G.blockLen,S.create=()=>f(),S}function j(f){const S=(tt,nt)=>f(nt).update(h(tt)).digest(),G=f({});return S.outputLen=G.outputLen,S.blockLen=G.blockLen,S.create=tt=>f(tt),S}function st(f){const S=(tt,nt)=>f(nt).update(h(tt)).digest(),G=f({});return S.outputLen=G.outputLen,S.blockLen=G.blockLen,S.create=tt=>f(tt),S}function gt(f=32){if(ot&&typeof ot.getRandomValues=="function")return ot.getRandomValues(new Uint8Array(f));throw new Error("crypto.getRandomValues must be defined")}}}]);
|