@argent/x-shared 1.74.1 → 1.74.2

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.
Files changed (22) hide show
  1. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.js +5 -5
  2. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.cjs +1 -1
  3. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.js +2 -2
  4. package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.cjs +1 -1
  5. package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.js +3 -3
  6. package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.cjs +1 -1
  7. package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.js +3 -3
  8. package/dist/node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.cjs +1 -1
  9. package/dist/node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.js +60 -60
  10. package/dist/node_modules/.pnpm/micro-starknet@0.2.3/node_modules/micro-starknet/lib/esm/index.js +6 -6
  11. package/dist/src/chains/starknet/address.js +1 -1
  12. package/dist/src/chains/starknet/services/deploymentData/findImplementationForAccount.js +1 -1
  13. package/dist/src/chains/starknet/services/deploymentData/getAccountClassHash.js +1 -1
  14. package/dist/src/features/simulation/activity/schema.cjs +1 -1
  15. package/dist/src/features/simulation/activity/schema.js +6 -6
  16. package/dist/src/features/simulation/transactionReview/schema.js +1 -1
  17. package/dist/src/nfts/BackendNftService.cjs +1 -1
  18. package/dist/src/nfts/BackendNftService.js +3 -3
  19. package/dist/src/tokens/service/types/backend.model.js +1 -1
  20. package/dist/src/utils/base58.js +5 -5
  21. package/dist/src/utils/number/abbreviateNumber.d.ts +2 -1
  22. package/package.json +21 -21
@@ -1,4 +1,4 @@
1
- import { validateObject as L, ensureBytes as T, bytesToNumberLE as y, bytesToNumberBE as m, numberToBytesBE as _, bitMask as $, numberToBytesLE as C } from "./utils.js";
1
+ import { numberToBytesLE as L, numberToBytesBE as T, bitMask as _, bytesToNumberLE as y, bytesToNumberBE as m, ensureBytes as $, validateObject as C } from "./utils.js";
2
2
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3
3
  const f = BigInt(0), u = BigInt(1), w = BigInt(2), M = BigInt(3), E = BigInt(4), b = BigInt(5), I = BigInt(8);
4
4
  BigInt(9);
@@ -109,7 +109,7 @@ function Q(e) {
109
109
  BYTES: "isSafeInteger",
110
110
  BITS: "isSafeInteger"
111
111
  }, n = A.reduce((r, s) => (r[s] = "function", r), o);
112
- return L(e, n);
112
+ return C(e, n);
113
113
  }
114
114
  function O(e, o, n) {
115
115
  if (n < f)
@@ -141,7 +141,7 @@ function V(e, o, n = !1, r = {}) {
141
141
  ORDER: e,
142
142
  BITS: s,
143
143
  BYTES: c,
144
- MASK: $(s),
144
+ MASK: _(s),
145
145
  ZERO: f,
146
146
  ONE: u,
147
147
  create: (t) => g(t, e),
@@ -171,7 +171,7 @@ function V(e, o, n = !1, r = {}) {
171
171
  // TODO: do we really need constant cmov?
172
172
  // We don't have const-time bigints anyway, so probably will be not very useful
173
173
  cmov: (t, l, a) => a ? l : t,
174
- toBytes: (t) => n ? C(t, c) : _(t, c),
174
+ toBytes: (t) => n ? L(t, c) : T(t, c),
175
175
  fromBytes: (t) => {
176
176
  if (t.length !== c)
177
177
  throw new Error(`Fp.fromBytes: expected ${c}, got ${t.length}`);
@@ -181,7 +181,7 @@ function V(e, o, n = !1, r = {}) {
181
181
  return Object.freeze(i);
182
182
  }
183
183
  function Y(e, o, n = !1) {
184
- e = T("privateHash", e);
184
+ e = $("privateHash", e);
185
185
  const r = e.length, s = x(o).nByteLength + 8;
186
186
  if (s < 24 || r < s || r > 1024)
187
187
  throw new Error(`hashToPrivateScalar: expected ${s}-1024 bytes of input, got ${r}`);
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./modular.cjs"),m=require("./utils.cjs"),et=require("./curve.cjs");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function at(v){const n=et.validateBasic(v);m.validateObject(n,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:x,a:O}=n;if(t){if(!x.eql(O,x.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({...n})}const{bytesToNumberBE:ct,hexToBytes:ut}=m,$={Err:class extends Error{constructor(n=""){super(n)}},_parseInt(v){const{Err:n}=$;if(v.length<2||v[0]!==2)throw new n("Invalid signature integer tag");const t=v[1],x=v.subarray(2,t+2);if(!t||x.length!==t)throw new n("Invalid signature integer: wrong length");if(x[0]&128)throw new n("Invalid signature integer: negative");if(x[0]===0&&!(x[1]&128))throw new n("Invalid signature integer: unnecessary leading zero");return{d:ct(x),l:v.subarray(t+2)}},toSig(v){const{Err:n}=$,t=typeof v=="string"?ut(v):v;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let x=t.length;if(x<2||t[0]!=48)throw new n("Invalid signature tag");if(t[1]!==x-2)throw new n("Invalid signature: incorrect length");const{d:O,l:T}=$._parseInt(t.subarray(2)),{d:F,l:R}=$._parseInt(T);if(R.length)throw new n("Invalid signature: left bytes after parsing");return{r:O,s:F}},hexFromSig(v){const n=S=>Number.parseInt(S[0],16)&8?"00"+S:S,t=S=>{const V=S.toString(16);return V.length&1?`0${V}`:V},x=n(t(v.s)),O=n(t(v.r)),T=x.length/2,F=O.length/2,R=t(T),L=t(F);return`30${t(F+T+4)}02${L}${O}02${R}${x}`}},P=BigInt(0),U=BigInt(1);BigInt(2);const ot=BigInt(3);BigInt(4);function it(v){const n=at(v),{Fp:t}=n,x=n.toBytes||((y,r,i)=>{const o=r.toAffine();return m.concatBytes(Uint8Array.from([4]),t.toBytes(o.x),t.toBytes(o.y))}),O=n.fromBytes||(y=>{const r=y.subarray(1),i=t.fromBytes(r.subarray(0,t.BYTES)),o=t.fromBytes(r.subarray(t.BYTES,2*t.BYTES));return{x:i,y:o}});function T(y){const{a:r,b:i}=n,o=t.sqr(y),u=t.mul(o,y);return t.add(t.add(u,t.mul(y,r)),i)}if(!t.eql(t.sqr(n.Gy),T(n.Gx)))throw new Error("bad generator point: equation left != right");function F(y){return typeof y=="bigint"&&P<y&&y<n.n}function R(y){if(!F(y))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function L(y){const{allowedPrivateKeyLengths:r,nByteLength:i,wrapPrivateKey:o,n:u}=n;if(r&&typeof y!="bigint"){if(y instanceof Uint8Array&&(y=m.bytesToHex(y)),typeof y!="string"||!r.includes(y.length))throw new Error("Invalid key");y=y.padStart(i*2,"0")}let f;try{f=typeof y=="bigint"?y:m.bytesToNumberBE(m.ensureBytes("private key",y,i))}catch{throw new Error(`private key must be ${i} bytes, hex or bigint, not ${typeof y}`)}return o&&(f=_.mod(f,u)),R(f),f}const S=new Map;function V(y){if(!(y instanceof w))throw new Error("ProjectivePoint expected")}class w{constructor(r,i,o){if(this.px=r,this.py=i,this.pz=o,r==null||!t.isValid(r))throw new Error("x required");if(i==null||!t.isValid(i))throw new Error("y required");if(o==null||!t.isValid(o))throw new Error("z required")}static fromAffine(r){const{x:i,y:o}=r||{};if(!r||!t.isValid(i)||!t.isValid(o))throw new Error("invalid affine point");if(r instanceof w)throw new Error("projective point not allowed");const u=f=>t.eql(f,t.ZERO);return u(i)&&u(o)?w.ZERO:new w(i,o,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(r){const i=t.invertBatch(r.map(o=>o.pz));return r.map((o,u)=>o.toAffine(i[u])).map(w.fromAffine)}static fromHex(r){const i=w.fromAffine(O(m.ensureBytes("pointHex",r)));return i.assertValidity(),i}static fromPrivateKey(r){return w.BASE.multiply(L(r))}_setWindowSize(r){this._WINDOW_SIZE=r,S.delete(this)}assertValidity(){if(this.is0()){if(n.allowInfinityPoint)return;throw new Error("bad point: ZERO")}const{x:r,y:i}=this.toAffine();if(!t.isValid(r)||!t.isValid(i))throw new Error("bad point: x or y not FE");const o=t.sqr(i),u=T(r);if(!t.eql(o,u))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:r}=this.toAffine();if(t.isOdd)return!t.isOdd(r);throw new Error("Field doesn't support isOdd")}equals(r){V(r);const{px:i,py:o,pz:u}=this,{px:f,py:g,pz:h}=r,a=t.eql(t.mul(i,h),t.mul(f,u)),c=t.eql(t.mul(o,h),t.mul(g,u));return a&&c}negate(){return new w(this.px,t.neg(this.py),this.pz)}double(){const{a:r,b:i}=n,o=t.mul(i,ot),{px:u,py:f,pz:g}=this;let h=t.ZERO,a=t.ZERO,c=t.ZERO,d=t.mul(u,u),q=t.mul(f,f),B=t.mul(g,g),p=t.mul(u,f);return p=t.add(p,p),c=t.mul(u,g),c=t.add(c,c),h=t.mul(r,c),a=t.mul(o,B),a=t.add(h,a),h=t.sub(q,a),a=t.add(q,a),a=t.mul(h,a),h=t.mul(p,h),c=t.mul(o,c),B=t.mul(r,B),p=t.sub(d,B),p=t.mul(r,p),p=t.add(p,c),c=t.add(d,d),d=t.add(c,d),d=t.add(d,B),d=t.mul(d,p),a=t.add(a,d),B=t.mul(f,g),B=t.add(B,B),d=t.mul(B,p),h=t.sub(h,d),c=t.mul(B,q),c=t.add(c,c),c=t.add(c,c),new w(h,a,c)}add(r){V(r);const{px:i,py:o,pz:u}=this,{px:f,py:g,pz:h}=r;let a=t.ZERO,c=t.ZERO,d=t.ZERO;const q=n.a,B=t.mul(n.b,ot);let p=t.mul(i,f),N=t.mul(o,g),Z=t.mul(u,h),H=t.add(i,o),e=t.add(f,g);H=t.mul(H,e),e=t.add(p,N),H=t.sub(H,e),e=t.add(i,u);let s=t.add(f,h);return e=t.mul(e,s),s=t.add(p,Z),e=t.sub(e,s),s=t.add(o,u),a=t.add(g,h),s=t.mul(s,a),a=t.add(N,Z),s=t.sub(s,a),d=t.mul(q,e),a=t.mul(B,Z),d=t.add(a,d),a=t.sub(N,d),d=t.add(N,d),c=t.mul(a,d),N=t.add(p,p),N=t.add(N,p),Z=t.mul(q,Z),e=t.mul(B,e),N=t.add(N,Z),Z=t.sub(p,Z),Z=t.mul(q,Z),e=t.add(e,Z),p=t.mul(N,e),c=t.add(c,p),p=t.mul(s,e),a=t.mul(H,a),a=t.sub(a,p),p=t.mul(H,N),d=t.mul(s,d),d=t.add(d,p),new w(a,c,d)}subtract(r){return this.add(r.negate())}is0(){return this.equals(w.ZERO)}wNAF(r){return C.wNAFCached(this,S,r,i=>{const o=t.invertBatch(i.map(u=>u.pz));return i.map((u,f)=>u.toAffine(o[f])).map(w.fromAffine)})}multiplyUnsafe(r){const i=w.ZERO;if(r===P)return i;if(R(r),r===U)return this;const{endo:o}=n;if(!o)return C.unsafeLadder(this,r);let{k1neg:u,k1:f,k2neg:g,k2:h}=o.splitScalar(r),a=i,c=i,d=this;for(;f>P||h>P;)f&U&&(a=a.add(d)),h&U&&(c=c.add(d)),d=d.double(),f>>=U,h>>=U;return u&&(a=a.negate()),g&&(c=c.negate()),c=new w(t.mul(c.px,o.beta),c.py,c.pz),a.add(c)}multiply(r){R(r);let i=r,o,u;const{endo:f}=n;if(f){const{k1neg:g,k1:h,k2neg:a,k2:c}=f.splitScalar(i);let{p:d,f:q}=this.wNAF(h),{p:B,f:p}=this.wNAF(c);d=C.constTimeNegate(g,d),B=C.constTimeNegate(a,B),B=new w(t.mul(B.px,f.beta),B.py,B.pz),o=d.add(B),u=q.add(p)}else{const{p:g,f:h}=this.wNAF(i);o=g,u=h}return w.normalizeZ([o,u])[0]}multiplyAndAddUnsafe(r,i,o){const u=w.BASE,f=(h,a)=>a===P||a===U||!h.equals(u)?h.multiplyUnsafe(a):h.multiply(a),g=f(this,i).add(f(r,o));return g.is0()?void 0:g}toAffine(r){const{px:i,py:o,pz:u}=this,f=this.is0();r==null&&(r=f?t.ONE:t.inv(u));const g=t.mul(i,r),h=t.mul(o,r),a=t.mul(u,r);if(f)return{x:t.ZERO,y:t.ZERO};if(!t.eql(a,t.ONE))throw new Error("invZ was invalid");return{x:g,y:h}}isTorsionFree(){const{h:r,isTorsionFree:i}=n;if(r===U)return!0;if(i)return i(w,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:r,clearCofactor:i}=n;return r===U?this:i?i(w,this):this.multiplyUnsafe(n.h)}toRawBytes(r=!0){return this.assertValidity(),x(w,this,r)}toHex(r=!0){return m.bytesToHex(this.toRawBytes(r))}}w.BASE=new w(n.Gx,n.Gy,t.ONE),w.ZERO=new w(t.ZERO,t.ONE,t.ZERO);const W=n.nBitLength,C=et.wNAF(w,n.endo?Math.ceil(W/2):W);return{CURVE:n,ProjectivePoint:w,normPrivateKeyToScalar:L,weierstrassEquation:T,isWithinCurveOrder:F}}function lt(v){const n=et.validateBasic(v);return m.validateObject(n,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...n})}function ft(v){const n=lt(v),{Fp:t,n:x}=n,O=t.BYTES+1,T=2*t.BYTES+1;function F(e){return P<e&&e<t.ORDER}function R(e){return _.mod(e,x)}function L(e){return _.invert(e,x)}const{ProjectivePoint:S,normPrivateKeyToScalar:V,weierstrassEquation:w,isWithinCurveOrder:W}=it({...n,toBytes(e,s,l){const b=s.toAffine(),E=t.toBytes(b.x),A=m.concatBytes;return l?A(Uint8Array.from([s.hasEvenY()?2:3]),E):A(Uint8Array.from([4]),E,t.toBytes(b.y))},fromBytes(e){const s=e.length,l=e[0],b=e.subarray(1);if(s===O&&(l===2||l===3)){const E=m.bytesToNumberBE(b);if(!F(E))throw new Error("Point is not on curve");const A=w(E);let z=t.sqrt(A);const I=(z&U)===U;return(l&1)===1!==I&&(z=t.neg(z)),{x:E,y:z}}else if(s===T&&l===4){const E=t.fromBytes(b.subarray(0,t.BYTES)),A=t.fromBytes(b.subarray(t.BYTES,2*t.BYTES));return{x:E,y:A}}else throw new Error(`Point of length ${s} was invalid. Expected ${O} compressed bytes or ${T} uncompressed bytes`)}}),C=e=>m.bytesToHex(m.numberToBytesBE(e,n.nByteLength));function y(e){const s=x>>U;return e>s}function r(e){return y(e)?R(-e):e}const i=(e,s,l)=>m.bytesToNumberBE(e.slice(s,l));class o{constructor(s,l,b){this.r=s,this.s=l,this.recovery=b,this.assertValidity()}static fromCompact(s){const l=n.nByteLength;return s=m.ensureBytes("compactSignature",s,l*2),new o(i(s,0,l),i(s,l,2*l))}static fromDER(s){const{r:l,s:b}=$.toSig(m.ensureBytes("DER",s));return new o(l,b)}assertValidity(){if(!W(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!W(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(s){return new o(this.r,this.s,s)}recoverPublicKey(s){const{r:l,s:b,recovery:E}=this,A=c(m.ensureBytes("msgHash",s));if(E==null||![0,1,2,3].includes(E))throw new Error("recovery id invalid");const z=E===2||E===3?l+n.n:l;if(z>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const I=E&1?"03":"02",D=S.fromHex(I+C(z)),j=L(z),X=R(-A*j),J=R(b*j),K=S.BASE.multiplyAndAddUnsafe(D,X,J);if(!K)throw new Error("point at infinify");return K.assertValidity(),K}hasHighS(){return y(this.s)}normalizeS(){return this.hasHighS()?new o(this.r,R(-this.s),this.recovery):this}toDERRawBytes(){return m.hexToBytes(this.toDERHex())}toDERHex(){return $.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return m.hexToBytes(this.toCompactHex())}toCompactHex(){return C(this.r)+C(this.s)}}const u={isValidPrivateKey(e){try{return V(e),!0}catch{return!1}},normPrivateKeyToScalar:V,randomPrivateKey:()=>{const e=n.randomBytes(t.BYTES+8),s=_.hashToPrivateScalar(e,x);return m.numberToBytesBE(s,n.nByteLength)},precompute(e=8,s=S.BASE){return s._setWindowSize(e),s.multiply(BigInt(3)),s}};function f(e,s=!0){return S.fromPrivateKey(e).toRawBytes(s)}function g(e){const s=e instanceof Uint8Array,l=typeof e=="string",b=(s||l)&&e.length;return s?b===O||b===T:l?b===2*O||b===2*T:e instanceof S}function h(e,s,l=!0){if(g(e))throw new Error("first arg must be private key");if(!g(s))throw new Error("second arg must be public key");return S.fromHex(s).multiply(V(e)).toRawBytes(l)}const a=n.bits2int||function(e){const s=m.bytesToNumberBE(e),l=e.length*8-n.nBitLength;return l>0?s>>BigInt(l):s},c=n.bits2int_modN||function(e){return R(a(e))},d=m.bitMask(n.nBitLength);function q(e){if(typeof e!="bigint")throw new Error("bigint expected");if(!(P<=e&&e<d))throw new Error(`bigint expected < 2^${n.nBitLength}`);return m.numberToBytesBE(e,n.nByteLength)}function B(e,s,l=p){if(["recovered","canonical"].some(k=>k in l))throw new Error("sign() legacy options not supported");const{hash:b,randomBytes:E}=n;let{lowS:A,prehash:z,extraEntropy:I}=l;A==null&&(A=!0),e=m.ensureBytes("msgHash",e),z&&(e=m.ensureBytes("prehashed msgHash",b(e)));const D=c(e),j=V(s),X=[q(j),q(D)];if(I!=null){const k=I===!0?E(t.BYTES):I;X.push(m.ensureBytes("extraEntropy",k,t.BYTES))}const J=m.concatBytes(...X),K=D;function tt(k){const G=a(k);if(!W(G))return;const rt=L(G),M=S.BASE.multiply(G).toAffine(),Y=R(M.x);if(Y===P)return;const Q=R(rt*R(K+Y*j));if(Q===P)return;let nt=(M.x===Y?0:2)|Number(M.y&U),st=Q;return A&&y(Q)&&(st=r(Q),nt^=1),new o(Y,st,nt)}return{seed:J,k2sig:tt}}const p={lowS:n.lowS,prehash:!1},N={lowS:n.lowS,prehash:!1};function Z(e,s,l=p){const{seed:b,k2sig:E}=B(e,s,l);return m.createHmacDrbg(n.hash.outputLen,n.nByteLength,n.hmac)(b,E)}S.BASE._setWindowSize(8);function H(e,s,l,b=N){var M;const E=e;if(s=m.ensureBytes("msgHash",s),l=m.ensureBytes("publicKey",l),"strict"in b)throw new Error("options.strict was renamed to lowS");const{lowS:A,prehash:z}=b;let I,D;try{if(typeof E=="string"||E instanceof Uint8Array)try{I=o.fromDER(E)}catch(Y){if(!(Y instanceof $.Err))throw Y;I=o.fromCompact(E)}else if(typeof E=="object"&&typeof E.r=="bigint"&&typeof E.s=="bigint"){const{r:Y,s:Q}=E;I=new o(Y,Q)}else throw new Error("PARSE");D=S.fromHex(l)}catch(Y){if(Y.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(A&&I.hasHighS())return!1;z&&(s=n.hash(s));const{r:j,s:X}=I,J=c(s),K=L(X),tt=R(J*K),k=R(j*K),G=(M=S.BASE.multiplyAndAddUnsafe(D,tt,k))==null?void 0:M.toAffine();return G?R(G.x)===j:!1}return{CURVE:n,getPublicKey:f,getSharedSecret:h,sign:Z,verify:H,ProjectivePoint:S,Signature:o,utils:u}}exports.DER=$;exports.weierstrass=ft;exports.weierstrassPoints=it;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./modular.cjs"),m=require("./utils.cjs"),et=require("./curve.cjs");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function at(v){const n=et.validateBasic(v);m.validateObject(n,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:x,a:O}=n;if(t){if(!x.eql(O,x.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({...n})}const{bytesToNumberBE:ct,hexToBytes:ut}=m,$={Err:class extends Error{constructor(n=""){super(n)}},_parseInt(v){const{Err:n}=$;if(v.length<2||v[0]!==2)throw new n("Invalid signature integer tag");const t=v[1],x=v.subarray(2,t+2);if(!t||x.length!==t)throw new n("Invalid signature integer: wrong length");if(x[0]&128)throw new n("Invalid signature integer: negative");if(x[0]===0&&!(x[1]&128))throw new n("Invalid signature integer: unnecessary leading zero");return{d:ct(x),l:v.subarray(t+2)}},toSig(v){const{Err:n}=$,t=typeof v=="string"?ut(v):v;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let x=t.length;if(x<2||t[0]!=48)throw new n("Invalid signature tag");if(t[1]!==x-2)throw new n("Invalid signature: incorrect length");const{d:O,l:T}=$._parseInt(t.subarray(2)),{d:F,l:R}=$._parseInt(T);if(R.length)throw new n("Invalid signature: left bytes after parsing");return{r:O,s:F}},hexFromSig(v){const n=S=>Number.parseInt(S[0],16)&8?"00"+S:S,t=S=>{const V=S.toString(16);return V.length&1?`0${V}`:V},x=n(t(v.s)),O=n(t(v.r)),T=x.length/2,F=O.length/2,R=t(T),L=t(F);return`30${t(F+T+4)}02${L}${O}02${R}${x}`}},P=BigInt(0),U=BigInt(1);BigInt(2);const ot=BigInt(3);BigInt(4);function it(v){const n=at(v),{Fp:t}=n,x=n.toBytes||((y,r,i)=>{const o=r.toAffine();return m.concatBytes(Uint8Array.from([4]),t.toBytes(o.x),t.toBytes(o.y))}),O=n.fromBytes||(y=>{const r=y.subarray(1),i=t.fromBytes(r.subarray(0,t.BYTES)),o=t.fromBytes(r.subarray(t.BYTES,2*t.BYTES));return{x:i,y:o}});function T(y){const{a:r,b:i}=n,o=t.sqr(y),u=t.mul(o,y);return t.add(t.add(u,t.mul(y,r)),i)}if(!t.eql(t.sqr(n.Gy),T(n.Gx)))throw new Error("bad generator point: equation left != right");function F(y){return typeof y=="bigint"&&P<y&&y<n.n}function R(y){if(!F(y))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function L(y){const{allowedPrivateKeyLengths:r,nByteLength:i,wrapPrivateKey:o,n:u}=n;if(r&&typeof y!="bigint"){if(y instanceof Uint8Array&&(y=m.bytesToHex(y)),typeof y!="string"||!r.includes(y.length))throw new Error("Invalid key");y=y.padStart(i*2,"0")}let f;try{f=typeof y=="bigint"?y:m.bytesToNumberBE(m.ensureBytes("private key",y,i))}catch{throw new Error(`private key must be ${i} bytes, hex or bigint, not ${typeof y}`)}return o&&(f=_.mod(f,u)),R(f),f}const S=new Map;function V(y){if(!(y instanceof w))throw new Error("ProjectivePoint expected")}class w{constructor(r,i,o){if(this.px=r,this.py=i,this.pz=o,r==null||!t.isValid(r))throw new Error("x required");if(i==null||!t.isValid(i))throw new Error("y required");if(o==null||!t.isValid(o))throw new Error("z required")}static fromAffine(r){const{x:i,y:o}=r||{};if(!r||!t.isValid(i)||!t.isValid(o))throw new Error("invalid affine point");if(r instanceof w)throw new Error("projective point not allowed");const u=f=>t.eql(f,t.ZERO);return u(i)&&u(o)?w.ZERO:new w(i,o,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(r){const i=t.invertBatch(r.map(o=>o.pz));return r.map((o,u)=>o.toAffine(i[u])).map(w.fromAffine)}static fromHex(r){const i=w.fromAffine(O(m.ensureBytes("pointHex",r)));return i.assertValidity(),i}static fromPrivateKey(r){return w.BASE.multiply(L(r))}_setWindowSize(r){this._WINDOW_SIZE=r,S.delete(this)}assertValidity(){if(this.is0()){if(n.allowInfinityPoint)return;throw new Error("bad point: ZERO")}const{x:r,y:i}=this.toAffine();if(!t.isValid(r)||!t.isValid(i))throw new Error("bad point: x or y not FE");const o=t.sqr(i),u=T(r);if(!t.eql(o,u))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:r}=this.toAffine();if(t.isOdd)return!t.isOdd(r);throw new Error("Field doesn't support isOdd")}equals(r){V(r);const{px:i,py:o,pz:u}=this,{px:f,py:g,pz:h}=r,a=t.eql(t.mul(i,h),t.mul(f,u)),c=t.eql(t.mul(o,h),t.mul(g,u));return a&&c}negate(){return new w(this.px,t.neg(this.py),this.pz)}double(){const{a:r,b:i}=n,o=t.mul(i,ot),{px:u,py:f,pz:g}=this;let h=t.ZERO,a=t.ZERO,c=t.ZERO,d=t.mul(u,u),q=t.mul(f,f),B=t.mul(g,g),p=t.mul(u,f);return p=t.add(p,p),c=t.mul(u,g),c=t.add(c,c),h=t.mul(r,c),a=t.mul(o,B),a=t.add(h,a),h=t.sub(q,a),a=t.add(q,a),a=t.mul(h,a),h=t.mul(p,h),c=t.mul(o,c),B=t.mul(r,B),p=t.sub(d,B),p=t.mul(r,p),p=t.add(p,c),c=t.add(d,d),d=t.add(c,d),d=t.add(d,B),d=t.mul(d,p),a=t.add(a,d),B=t.mul(f,g),B=t.add(B,B),d=t.mul(B,p),h=t.sub(h,d),c=t.mul(B,q),c=t.add(c,c),c=t.add(c,c),new w(h,a,c)}add(r){V(r);const{px:i,py:o,pz:u}=this,{px:f,py:g,pz:h}=r;let a=t.ZERO,c=t.ZERO,d=t.ZERO;const q=n.a,B=t.mul(n.b,ot);let p=t.mul(i,f),N=t.mul(o,g),Z=t.mul(u,h),H=t.add(i,o),e=t.add(f,g);H=t.mul(H,e),e=t.add(p,N),H=t.sub(H,e),e=t.add(i,u);let s=t.add(f,h);return e=t.mul(e,s),s=t.add(p,Z),e=t.sub(e,s),s=t.add(o,u),a=t.add(g,h),s=t.mul(s,a),a=t.add(N,Z),s=t.sub(s,a),d=t.mul(q,e),a=t.mul(B,Z),d=t.add(a,d),a=t.sub(N,d),d=t.add(N,d),c=t.mul(a,d),N=t.add(p,p),N=t.add(N,p),Z=t.mul(q,Z),e=t.mul(B,e),N=t.add(N,Z),Z=t.sub(p,Z),Z=t.mul(q,Z),e=t.add(e,Z),p=t.mul(N,e),c=t.add(c,p),p=t.mul(s,e),a=t.mul(H,a),a=t.sub(a,p),p=t.mul(H,N),d=t.mul(s,d),d=t.add(d,p),new w(a,c,d)}subtract(r){return this.add(r.negate())}is0(){return this.equals(w.ZERO)}wNAF(r){return C.wNAFCached(this,S,r,i=>{const o=t.invertBatch(i.map(u=>u.pz));return i.map((u,f)=>u.toAffine(o[f])).map(w.fromAffine)})}multiplyUnsafe(r){const i=w.ZERO;if(r===P)return i;if(R(r),r===U)return this;const{endo:o}=n;if(!o)return C.unsafeLadder(this,r);let{k1neg:u,k1:f,k2neg:g,k2:h}=o.splitScalar(r),a=i,c=i,d=this;for(;f>P||h>P;)f&U&&(a=a.add(d)),h&U&&(c=c.add(d)),d=d.double(),f>>=U,h>>=U;return u&&(a=a.negate()),g&&(c=c.negate()),c=new w(t.mul(c.px,o.beta),c.py,c.pz),a.add(c)}multiply(r){R(r);let i=r,o,u;const{endo:f}=n;if(f){const{k1neg:g,k1:h,k2neg:a,k2:c}=f.splitScalar(i);let{p:d,f:q}=this.wNAF(h),{p:B,f:p}=this.wNAF(c);d=C.constTimeNegate(g,d),B=C.constTimeNegate(a,B),B=new w(t.mul(B.px,f.beta),B.py,B.pz),o=d.add(B),u=q.add(p)}else{const{p:g,f:h}=this.wNAF(i);o=g,u=h}return w.normalizeZ([o,u])[0]}multiplyAndAddUnsafe(r,i,o){const u=w.BASE,f=(h,a)=>a===P||a===U||!h.equals(u)?h.multiplyUnsafe(a):h.multiply(a),g=f(this,i).add(f(r,o));return g.is0()?void 0:g}toAffine(r){const{px:i,py:o,pz:u}=this,f=this.is0();r==null&&(r=f?t.ONE:t.inv(u));const g=t.mul(i,r),h=t.mul(o,r),a=t.mul(u,r);if(f)return{x:t.ZERO,y:t.ZERO};if(!t.eql(a,t.ONE))throw new Error("invZ was invalid");return{x:g,y:h}}isTorsionFree(){const{h:r,isTorsionFree:i}=n;if(r===U)return!0;if(i)return i(w,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:r,clearCofactor:i}=n;return r===U?this:i?i(w,this):this.multiplyUnsafe(n.h)}toRawBytes(r=!0){return this.assertValidity(),x(w,this,r)}toHex(r=!0){return m.bytesToHex(this.toRawBytes(r))}}w.BASE=new w(n.Gx,n.Gy,t.ONE),w.ZERO=new w(t.ZERO,t.ONE,t.ZERO);const W=n.nBitLength,C=et.wNAF(w,n.endo?Math.ceil(W/2):W);return{CURVE:n,ProjectivePoint:w,normPrivateKeyToScalar:L,weierstrassEquation:T,isWithinCurveOrder:F}}function lt(v){const n=et.validateBasic(v);return m.validateObject(n,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...n})}function ft(v){const n=lt(v),{Fp:t,n:x}=n,O=t.BYTES+1,T=2*t.BYTES+1;function F(e){return P<e&&e<t.ORDER}function R(e){return _.mod(e,x)}function L(e){return _.invert(e,x)}const{ProjectivePoint:S,normPrivateKeyToScalar:V,weierstrassEquation:w,isWithinCurveOrder:W}=it({...n,toBytes(e,s,l){const b=s.toAffine(),E=t.toBytes(b.x),A=m.concatBytes;return l?A(Uint8Array.from([s.hasEvenY()?2:3]),E):A(Uint8Array.from([4]),E,t.toBytes(b.y))},fromBytes(e){const s=e.length,l=e[0],b=e.subarray(1);if(s===O&&(l===2||l===3)){const E=m.bytesToNumberBE(b);if(!F(E))throw new Error("Point is not on curve");const A=w(E);let z=t.sqrt(A);const I=(z&U)===U;return(l&1)===1!==I&&(z=t.neg(z)),{x:E,y:z}}else if(s===T&&l===4){const E=t.fromBytes(b.subarray(0,t.BYTES)),A=t.fromBytes(b.subarray(t.BYTES,2*t.BYTES));return{x:E,y:A}}else throw new Error(`Point of length ${s} was invalid. Expected ${O} compressed bytes or ${T} uncompressed bytes`)}}),C=e=>m.bytesToHex(m.numberToBytesBE(e,n.nByteLength));function y(e){const s=x>>U;return e>s}function r(e){return y(e)?R(-e):e}const i=(e,s,l)=>m.bytesToNumberBE(e.slice(s,l));class o{constructor(s,l,b){this.r=s,this.s=l,this.recovery=b,this.assertValidity()}static fromCompact(s){const l=n.nByteLength;return s=m.ensureBytes("compactSignature",s,l*2),new o(i(s,0,l),i(s,l,2*l))}static fromDER(s){const{r:l,s:b}=$.toSig(m.ensureBytes("DER",s));return new o(l,b)}assertValidity(){if(!W(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!W(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(s){return new o(this.r,this.s,s)}recoverPublicKey(s){const{r:l,s:b,recovery:E}=this,A=c(m.ensureBytes("msgHash",s));if(E==null||![0,1,2,3].includes(E))throw new Error("recovery id invalid");const z=E===2||E===3?l+n.n:l;if(z>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const I=(E&1)===0?"02":"03",D=S.fromHex(I+C(z)),j=L(z),X=R(-A*j),J=R(b*j),K=S.BASE.multiplyAndAddUnsafe(D,X,J);if(!K)throw new Error("point at infinify");return K.assertValidity(),K}hasHighS(){return y(this.s)}normalizeS(){return this.hasHighS()?new o(this.r,R(-this.s),this.recovery):this}toDERRawBytes(){return m.hexToBytes(this.toDERHex())}toDERHex(){return $.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return m.hexToBytes(this.toCompactHex())}toCompactHex(){return C(this.r)+C(this.s)}}const u={isValidPrivateKey(e){try{return V(e),!0}catch{return!1}},normPrivateKeyToScalar:V,randomPrivateKey:()=>{const e=n.randomBytes(t.BYTES+8),s=_.hashToPrivateScalar(e,x);return m.numberToBytesBE(s,n.nByteLength)},precompute(e=8,s=S.BASE){return s._setWindowSize(e),s.multiply(BigInt(3)),s}};function f(e,s=!0){return S.fromPrivateKey(e).toRawBytes(s)}function g(e){const s=e instanceof Uint8Array,l=typeof e=="string",b=(s||l)&&e.length;return s?b===O||b===T:l?b===2*O||b===2*T:e instanceof S}function h(e,s,l=!0){if(g(e))throw new Error("first arg must be private key");if(!g(s))throw new Error("second arg must be public key");return S.fromHex(s).multiply(V(e)).toRawBytes(l)}const a=n.bits2int||function(e){const s=m.bytesToNumberBE(e),l=e.length*8-n.nBitLength;return l>0?s>>BigInt(l):s},c=n.bits2int_modN||function(e){return R(a(e))},d=m.bitMask(n.nBitLength);function q(e){if(typeof e!="bigint")throw new Error("bigint expected");if(!(P<=e&&e<d))throw new Error(`bigint expected < 2^${n.nBitLength}`);return m.numberToBytesBE(e,n.nByteLength)}function B(e,s,l=p){if(["recovered","canonical"].some(k=>k in l))throw new Error("sign() legacy options not supported");const{hash:b,randomBytes:E}=n;let{lowS:A,prehash:z,extraEntropy:I}=l;A==null&&(A=!0),e=m.ensureBytes("msgHash",e),z&&(e=m.ensureBytes("prehashed msgHash",b(e)));const D=c(e),j=V(s),X=[q(j),q(D)];if(I!=null){const k=I===!0?E(t.BYTES):I;X.push(m.ensureBytes("extraEntropy",k,t.BYTES))}const J=m.concatBytes(...X),K=D;function tt(k){const G=a(k);if(!W(G))return;const rt=L(G),M=S.BASE.multiply(G).toAffine(),Y=R(M.x);if(Y===P)return;const Q=R(rt*R(K+Y*j));if(Q===P)return;let nt=(M.x===Y?0:2)|Number(M.y&U),st=Q;return A&&y(Q)&&(st=r(Q),nt^=1),new o(Y,st,nt)}return{seed:J,k2sig:tt}}const p={lowS:n.lowS,prehash:!1},N={lowS:n.lowS,prehash:!1};function Z(e,s,l=p){const{seed:b,k2sig:E}=B(e,s,l);return m.createHmacDrbg(n.hash.outputLen,n.nByteLength,n.hmac)(b,E)}S.BASE._setWindowSize(8);function H(e,s,l,b=N){var M;const E=e;if(s=m.ensureBytes("msgHash",s),l=m.ensureBytes("publicKey",l),"strict"in b)throw new Error("options.strict was renamed to lowS");const{lowS:A,prehash:z}=b;let I,D;try{if(typeof E=="string"||E instanceof Uint8Array)try{I=o.fromDER(E)}catch(Y){if(!(Y instanceof $.Err))throw Y;I=o.fromCompact(E)}else if(typeof E=="object"&&typeof E.r=="bigint"&&typeof E.s=="bigint"){const{r:Y,s:Q}=E;I=new o(Y,Q)}else throw new Error("PARSE");D=S.fromHex(l)}catch(Y){if(Y.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(A&&I.hasHighS())return!1;z&&(s=n.hash(s));const{r:j,s:X}=I,J=c(s),K=L(X),tt=R(J*K),k=R(j*K),G=(M=S.BASE.multiplyAndAddUnsafe(D,tt,k))==null?void 0:M.toAffine();return G?R(G.x)===j:!1}return{CURVE:n,getPublicKey:f,getSharedSecret:h,sign:Z,verify:H,ProjectivePoint:S,Signature:o,utils:u}}exports.DER=$;exports.weierstrass=ft;exports.weierstrassPoints=it;
@@ -1,6 +1,6 @@
1
1
  import { mod as ut, hashToPrivateScalar as dt, invert as ht } from "./modular.js";
2
2
  import * as mt from "./utils.js";
3
- import { validateObject as lt, concatBytes as et, ensureBytes as Y, bytesToHex as nt, bytesToNumberBE as _, bitMask as yt, numberToBytesBE as rt, hexToBytes as at, createHmacDrbg as pt } from "./utils.js";
3
+ import { bytesToNumberBE as _, bitMask as yt, validateObject as lt, concatBytes as et, numberToBytesBE as rt, ensureBytes as Y, bytesToHex as nt, hexToBytes as at, createHmacDrbg as pt } from "./utils.js";
4
4
  import { validateBasic as ft, wNAF as wt } from "./curve.js";
5
5
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
6
6
  function Et(B) {
@@ -414,7 +414,7 @@ function Ot(B) {
414
414
  const q = w === 2 || w === 3 ? l + n.n : l;
415
415
  if (q >= t.ORDER)
416
416
  throw new Error("recovery id 2 or 3 invalid");
417
- const I = w & 1 ? "03" : "02", D = x.fromHex(I + C(q)), K = P(q), X = S(-R * K), J = S(g * K), $ = x.BASE.multiplyAndAddUnsafe(D, X, J);
417
+ const I = (w & 1) === 0 ? "02" : "03", D = x.fromHex(I + C(q)), K = P(q), X = S(-R * K), J = S(g * K), $ = x.BASE.multiplyAndAddUnsafe(D, X, J);
418
418
  if (!$)
419
419
  throw new Error("point at infinify");
420
420
  return $.assertValidity(), $;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./_assert.cjs"),f=require("./_u64.cjs"),k=require("./utils.cjs"),[y,b,_]=[[],[],[]],B=BigInt(0),l=BigInt(1),A=BigInt(2),H=BigInt(7),S=BigInt(256),T=BigInt(113);for(let i=0,t=l,s=1,n=0;i<24;i++){[s,n]=[n,(2*s+3*n)%5],y.push(2*(5*n+s)),b.push((i+1)*(i+2)/2%64);let o=B;for(let r=0;r<7;r++)t=(t<<l^(t>>H)*T)%S,t&A&&(o^=l<<(l<<BigInt(r))-l);_.push(o)}const[m,F]=f.split(_,!0),I=(i,t,s)=>s>32?f.rotlBH(i,t,s):f.rotlSH(i,t,s),O=(i,t,s)=>s>32?f.rotlBL(i,t,s):f.rotlSL(i,t,s);function w(i,t=24){const s=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let e=0;e<10;e++)s[e]=i[e]^i[e+10]^i[e+20]^i[e+30]^i[e+40];for(let e=0;e<10;e+=2){const h=(e+8)%10,a=(e+2)%10,p=s[a],c=s[a+1],g=I(p,c,1)^s[h],L=O(p,c,1)^s[h+1];for(let d=0;d<50;d+=10)i[e+d]^=g,i[e+d+1]^=L}let o=i[2],r=i[3];for(let e=0;e<24;e++){const h=b[e],a=I(o,r,h),p=O(o,r,h),c=y[e];o=i[c],r=i[c+1],i[c]=a,i[c+1]=p}for(let e=0;e<50;e+=10){for(let h=0;h<10;h++)s[h]=i[e+h];for(let h=0;h<10;h++)i[e+h]^=~s[(h+2)%10]&s[(h+4)%10]}i[0]^=m[n],i[1]^=F[n]}s.fill(0)}class x extends k.Hash{constructor(t,s,n,o=!1,r=24){if(super(),this.blockLen=t,this.suffix=s,this.outputLen=n,this.enableXOF=o,this.rounds=r,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,u.number(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=k.u32(this.state)}keccak(){w(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){u.exists(this);const{blockLen:s,state:n}=this;t=k.toBytes(t);const o=t.length;for(let r=0;r<o;){const e=Math.min(s-this.pos,o-r);for(let h=0;h<e;h++)n[this.pos++]^=t[r++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:s,pos:n,blockLen:o}=this;t[n]^=s,s&128&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){u.exists(this,!1),u.bytes(t),this.finish();const s=this.state,{blockLen:n}=this;for(let o=0,r=t.length;o<r;){this.posOut>=n&&this.keccak();const e=Math.min(n-this.posOut,r-o);t.set(s.subarray(this.posOut,this.posOut+e),o),this.posOut+=e,o+=e}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return u.number(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(u.output(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:s,suffix:n,outputLen:o,rounds:r,enableXOF:e}=this;return t||(t=new x(s,n,o,e,r)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=n,t.outputLen=o,t.enableXOF=e,t.destroyed=this.destroyed,t}}const P=(i,t,s)=>k.wrapConstructor(()=>new x(t,i,s)),X=P(1,136,256/8);exports.Keccak=x;exports.keccakP=w;exports.keccak_256=X;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./_assert.cjs"),f=require("./_u64.cjs"),k=require("./utils.cjs"),[y,b,_]=[[],[],[]],B=BigInt(0),l=BigInt(1),A=BigInt(2),H=BigInt(7),S=BigInt(256),T=BigInt(113);for(let i=0,t=l,s=1,n=0;i<24;i++){[s,n]=[n,(2*s+3*n)%5],y.push(2*(5*n+s)),b.push((i+1)*(i+2)/2%64);let o=B;for(let r=0;r<7;r++)t=(t<<l^(t>>H)*T)%S,t&A&&(o^=l<<(l<<BigInt(r))-l);_.push(o)}const[m,F]=f.split(_,!0),I=(i,t,s)=>s>32?f.rotlBH(i,t,s):f.rotlSH(i,t,s),O=(i,t,s)=>s>32?f.rotlBL(i,t,s):f.rotlSL(i,t,s);function w(i,t=24){const s=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let e=0;e<10;e++)s[e]=i[e]^i[e+10]^i[e+20]^i[e+30]^i[e+40];for(let e=0;e<10;e+=2){const h=(e+8)%10,a=(e+2)%10,p=s[a],c=s[a+1],g=I(p,c,1)^s[h],L=O(p,c,1)^s[h+1];for(let d=0;d<50;d+=10)i[e+d]^=g,i[e+d+1]^=L}let o=i[2],r=i[3];for(let e=0;e<24;e++){const h=b[e],a=I(o,r,h),p=O(o,r,h),c=y[e];o=i[c],r=i[c+1],i[c]=a,i[c+1]=p}for(let e=0;e<50;e+=10){for(let h=0;h<10;h++)s[h]=i[e+h];for(let h=0;h<10;h++)i[e+h]^=~s[(h+2)%10]&s[(h+4)%10]}i[0]^=m[n],i[1]^=F[n]}s.fill(0)}class x extends k.Hash{constructor(t,s,n,o=!1,r=24){if(super(),this.blockLen=t,this.suffix=s,this.outputLen=n,this.enableXOF=o,this.rounds=r,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,u.number(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=k.u32(this.state)}keccak(){w(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){u.exists(this);const{blockLen:s,state:n}=this;t=k.toBytes(t);const o=t.length;for(let r=0;r<o;){const e=Math.min(s-this.pos,o-r);for(let h=0;h<e;h++)n[this.pos++]^=t[r++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:s,pos:n,blockLen:o}=this;t[n]^=s,(s&128)!==0&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){u.exists(this,!1),u.bytes(t),this.finish();const s=this.state,{blockLen:n}=this;for(let o=0,r=t.length;o<r;){this.posOut>=n&&this.keccak();const e=Math.min(n-this.posOut,r-o);t.set(s.subarray(this.posOut,this.posOut+e),o),this.posOut+=e,o+=e}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return u.number(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(u.output(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:s,suffix:n,outputLen:o,rounds:r,enableXOF:e}=this;return t||(t=new x(s,n,o,e,r)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=n,t.outputLen=o,t.enableXOF=e,t.destroyed=this.destroyed,t}}const P=(i,t,s)=>k.wrapConstructor(()=>new x(t,i,s)),X=P(1,136,256/8);exports.Keccak=x;exports.keccakP=w;exports.keccak_256=X;
@@ -1,5 +1,5 @@
1
1
  import { number as d, exists as k, bytes as _, output as g } from "./_assert.js";
2
- import { rotlBH as B, rotlSH as A, rotlBL as H, rotlSL as m, split as S } from "./_u64.js";
2
+ import { rotlSH as B, rotlSL as A, rotlBH as H, rotlBL as m, split as S } from "./_u64.js";
3
3
  import { wrapConstructor as T, Hash as F, u32 as X, toBytes as U } from "./utils.js";
4
4
  const [O, w, y] = [[], [], []], E = /* @__PURE__ */ BigInt(0), f = /* @__PURE__ */ BigInt(1), P = /* @__PURE__ */ BigInt(2), M = /* @__PURE__ */ BigInt(7), R = /* @__PURE__ */ BigInt(256), j = /* @__PURE__ */ BigInt(113);
5
5
  for (let i = 0, t = f, s = 1, n = 0; i < 24; i++) {
@@ -9,7 +9,7 @@ for (let i = 0, t = f, s = 1, n = 0; i < 24; i++) {
9
9
  t = (t << f ^ (t >> M) * j) % R, t & P && (o ^= f << (f << /* @__PURE__ */ BigInt(r)) - f);
10
10
  y.push(o);
11
11
  }
12
- const [C, q] = /* @__PURE__ */ S(y, !0), x = (i, t, s) => s > 32 ? B(i, t, s) : A(i, t, s), I = (i, t, s) => s > 32 ? H(i, t, s) : m(i, t, s);
12
+ const [C, q] = /* @__PURE__ */ S(y, !0), x = (i, t, s) => s > 32 ? H(i, t, s) : B(i, t, s), I = (i, t, s) => s > 32 ? m(i, t, s) : A(i, t, s);
13
13
  function v(i, t = 24) {
14
14
  const s = new Uint32Array(10);
15
15
  for (let n = 24 - t; n < 24; n++) {
@@ -63,7 +63,7 @@ class p extends F {
63
63
  return;
64
64
  this.finished = !0;
65
65
  const { state: t, suffix: s, pos: n, blockLen: o } = this;
66
- t[n] ^= s, s & 128 && n === o - 1 && this.keccak(), t[o - 1] ^= 128, this.keccak();
66
+ t[n] ^= s, (s & 128) !== 0 && n === o - 1 && this.keccak(), t[o - 1] ^= 128, this.keccak();
67
67
  }
68
68
  writeInto(t) {
69
69
  k(this, !1), _(t), this.finish();
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./_assert.cjs"),a=require("./_u64.cjs"),c=require("./utils.cjs"),I=[],O=[],w=[],B=BigInt(0),f=BigInt(1),A=BigInt(2),S=BigInt(7),H=BigInt(256),T=BigInt(113);for(let i=0,t=f,s=1,n=0;i<24;i++){[s,n]=[n,(2*s+3*n)%5],I.push(2*(5*n+s)),O.push((i+1)*(i+2)/2%64);let o=B;for(let r=0;r<7;r++)t=(t<<f^(t>>S)*T)%H,t&A&&(o^=f<<(f<<BigInt(r))-f);w.push(o)}const[m,E]=a.split(w,!0),y=(i,t,s)=>s>32?a.rotlBH(i,t,s):a.rotlSH(i,t,s),b=(i,t,s)=>s>32?a.rotlBL(i,t,s):a.rotlSL(i,t,s);function L(i,t=24){const s=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let e=0;e<10;e++)s[e]=i[e]^i[e+10]^i[e+20]^i[e+30]^i[e+40];for(let e=0;e<10;e+=2){const h=(e+8)%10,p=(e+2)%10,d=s[p],u=s[p+1],_=y(d,u,1)^s[h],g=b(d,u,1)^s[h+1];for(let k=0;k<50;k+=10)i[e+k]^=_,i[e+k+1]^=g}let o=i[2],r=i[3];for(let e=0;e<24;e++){const h=O[e],p=y(o,r,h),d=b(o,r,h),u=I[e];o=i[u],r=i[u+1],i[u]=p,i[u+1]=d}for(let e=0;e<50;e+=10){for(let h=0;h<10;h++)s[h]=i[e+h];for(let h=0;h<10;h++)i[e+h]^=~s[(h+2)%10]&s[(h+4)%10]}i[0]^=m[n],i[1]^=E[n]}s.fill(0)}class x extends c.Hash{constructor(t,s,n,o=!1,r=24){if(super(),this.blockLen=t,this.suffix=s,this.outputLen=n,this.enableXOF=o,this.rounds=r,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,l.number(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=c.u32(this.state)}keccak(){c.isLE||c.byteSwap32(this.state32),L(this.state32,this.rounds),c.isLE||c.byteSwap32(this.state32),this.posOut=0,this.pos=0}update(t){l.exists(this);const{blockLen:s,state:n}=this;t=c.toBytes(t);const o=t.length;for(let r=0;r<o;){const e=Math.min(s-this.pos,o-r);for(let h=0;h<e;h++)n[this.pos++]^=t[r++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:s,pos:n,blockLen:o}=this;t[n]^=s,s&128&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){l.exists(this,!1),l.bytes(t),this.finish();const s=this.state,{blockLen:n}=this;for(let o=0,r=t.length;o<r;){this.posOut>=n&&this.keccak();const e=Math.min(n-this.posOut,r-o);t.set(s.subarray(this.posOut,this.posOut+e),o),this.posOut+=e,o+=e}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return l.number(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(l.output(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:s,suffix:n,outputLen:o,rounds:r,enableXOF:e}=this;return t||(t=new x(s,n,o,e,r)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=n,t.outputLen=o,t.enableXOF=e,t.destroyed=this.destroyed,t}}const F=(i,t,s)=>c.wrapConstructor(()=>new x(t,i,s)),P=F(1,136,256/8);exports.Keccak=x;exports.keccakP=L;exports.keccak_256=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./_assert.cjs"),a=require("./_u64.cjs"),c=require("./utils.cjs"),I=[],O=[],w=[],B=BigInt(0),f=BigInt(1),A=BigInt(2),S=BigInt(7),H=BigInt(256),T=BigInt(113);for(let i=0,t=f,s=1,n=0;i<24;i++){[s,n]=[n,(2*s+3*n)%5],I.push(2*(5*n+s)),O.push((i+1)*(i+2)/2%64);let o=B;for(let r=0;r<7;r++)t=(t<<f^(t>>S)*T)%H,t&A&&(o^=f<<(f<<BigInt(r))-f);w.push(o)}const[m,E]=a.split(w,!0),y=(i,t,s)=>s>32?a.rotlBH(i,t,s):a.rotlSH(i,t,s),b=(i,t,s)=>s>32?a.rotlBL(i,t,s):a.rotlSL(i,t,s);function L(i,t=24){const s=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let e=0;e<10;e++)s[e]=i[e]^i[e+10]^i[e+20]^i[e+30]^i[e+40];for(let e=0;e<10;e+=2){const h=(e+8)%10,p=(e+2)%10,d=s[p],u=s[p+1],_=y(d,u,1)^s[h],g=b(d,u,1)^s[h+1];for(let k=0;k<50;k+=10)i[e+k]^=_,i[e+k+1]^=g}let o=i[2],r=i[3];for(let e=0;e<24;e++){const h=O[e],p=y(o,r,h),d=b(o,r,h),u=I[e];o=i[u],r=i[u+1],i[u]=p,i[u+1]=d}for(let e=0;e<50;e+=10){for(let h=0;h<10;h++)s[h]=i[e+h];for(let h=0;h<10;h++)i[e+h]^=~s[(h+2)%10]&s[(h+4)%10]}i[0]^=m[n],i[1]^=E[n]}s.fill(0)}class x extends c.Hash{constructor(t,s,n,o=!1,r=24){if(super(),this.blockLen=t,this.suffix=s,this.outputLen=n,this.enableXOF=o,this.rounds=r,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,l.number(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=c.u32(this.state)}keccak(){c.isLE||c.byteSwap32(this.state32),L(this.state32,this.rounds),c.isLE||c.byteSwap32(this.state32),this.posOut=0,this.pos=0}update(t){l.exists(this);const{blockLen:s,state:n}=this;t=c.toBytes(t);const o=t.length;for(let r=0;r<o;){const e=Math.min(s-this.pos,o-r);for(let h=0;h<e;h++)n[this.pos++]^=t[r++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:s,pos:n,blockLen:o}=this;t[n]^=s,(s&128)!==0&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){l.exists(this,!1),l.bytes(t),this.finish();const s=this.state,{blockLen:n}=this;for(let o=0,r=t.length;o<r;){this.posOut>=n&&this.keccak();const e=Math.min(n-this.posOut,r-o);t.set(s.subarray(this.posOut,this.posOut+e),o),this.posOut+=e,o+=e}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return l.number(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(l.output(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:s,suffix:n,outputLen:o,rounds:r,enableXOF:e}=this;return t||(t=new x(s,n,o,e,r)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=n,t.outputLen=o,t.enableXOF=e,t.destroyed=this.destroyed,t}}const F=(i,t,s)=>c.wrapConstructor(()=>new x(t,i,s)),P=F(1,136,256/8);exports.Keccak=x;exports.keccakP=L;exports.keccak_256=P;
@@ -1,5 +1,5 @@
1
1
  import { number as d, exists as k, bytes as B, output as A } from "./_assert.js";
2
- import { rotlBH as H, rotlSH as m, rotlBL as S, rotlSL as T, split as F } from "./_u64.js";
2
+ import { rotlSH as H, rotlSL as m, rotlBH as S, rotlBL as T, split as F } from "./_u64.js";
3
3
  import { wrapConstructor as X, Hash as E, u32 as U, isLE as x, byteSwap32 as I, toBytes as P } from "./utils.js";
4
4
  const y = [], L = [], b = [], M = /* @__PURE__ */ BigInt(0), f = /* @__PURE__ */ BigInt(1), R = /* @__PURE__ */ BigInt(2), j = /* @__PURE__ */ BigInt(7), C = /* @__PURE__ */ BigInt(256), q = /* @__PURE__ */ BigInt(113);
5
5
  for (let e = 0, t = f, s = 1, n = 0; e < 24; e++) {
@@ -9,7 +9,7 @@ for (let e = 0, t = f, s = 1, n = 0; e < 24; e++) {
9
9
  t = (t << f ^ (t >> j) * q) % C, t & R && (o ^= f << (f << /* @__PURE__ */ BigInt(r)) - f);
10
10
  b.push(o);
11
11
  }
12
- const [v, z] = /* @__PURE__ */ F(b, !0), O = (e, t, s) => s > 32 ? H(e, t, s) : m(e, t, s), w = (e, t, s) => s > 32 ? S(e, t, s) : T(e, t, s);
12
+ const [v, z] = /* @__PURE__ */ F(b, !0), O = (e, t, s) => s > 32 ? S(e, t, s) : H(e, t, s), w = (e, t, s) => s > 32 ? T(e, t, s) : m(e, t, s);
13
13
  function D(e, t = 24) {
14
14
  const s = new Uint32Array(10);
15
15
  for (let n = 24 - t; n < 24; n++) {
@@ -63,7 +63,7 @@ class p extends E {
63
63
  return;
64
64
  this.finished = !0;
65
65
  const { state: t, suffix: s, pos: n, blockLen: o } = this;
66
- t[n] ^= s, s & 128 && n === o - 1 && this.keccak(), t[o - 1] ^= 128, this.keccak();
66
+ t[n] ^= s, (s & 128) !== 0 && n === o - 1 && this.keccak(), t[o - 1] ^= 128, this.keccak();
67
67
  }
68
68
  writeInto(t) {
69
69
  k(this, !1), B(t), this.finish();
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var Ee=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ce=Math.ceil,y=Math.floor,U="[BigNumber Error] ",pe=U+"Number primitive has more than 15 significant digits: ",H=1e14,E=14,ae=9007199254740991,he=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],J=1e7,P=1e9;function we(O){var N,v,T,g=h.prototype={constructor:h,toString:null,valueOf:null},I=new h(1),_=20,S=4,C=-7,k=21,Q=-1e7,z=1e7,Z=!1,b=1,Y=0,te={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},K="0123456789abcdefghijklmnopqrstuvwxyz",fe=!0;function h(e,r){var i,s,t,l,c,n,f,u,o=this;if(!(o instanceof h))return new h(e,r);if(r==null){if(e&&e._isBigNumber===!0){o.s=e.s,!e.c||e.e>z?o.c=o.e=null:e.e<Q?o.c=[o.e=0]:(o.e=e.e,o.c=e.c.slice());return}if((n=typeof e=="number")&&e*0==0){if(o.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,c=e;c>=10;c/=10,l++);l>z?o.c=o.e=null:(o.e=l,o.c=[e]);return}u=String(e)}else{if(!Ee.test(u=String(e)))return T(o,u,n);o.s=u.charCodeAt(0)==45?(u=u.slice(1),-1):1}(l=u.indexOf("."))>-1&&(u=u.replace(".","")),(c=u.search(/e/i))>0?(l<0&&(l=c),l+=+u.slice(c+1),u=u.substring(0,c)):l<0&&(l=u.length)}else{if(x(r,2,K.length,"Base"),r==10&&fe)return o=new h(e),G(o,_+o.e+1,S);if(u=String(e),n=typeof e=="number"){if(e*0!=0)return T(o,u,n,r);if(o.s=1/e<0?(u=u.slice(1),-1):1,h.DEBUG&&u.replace(/^0\.0*|\./,"").length>15)throw Error(pe+e)}else o.s=u.charCodeAt(0)===45?(u=u.slice(1),-1):1;for(i=K.slice(0,r),l=c=0,f=u.length;c<f;c++)if(i.indexOf(s=u.charAt(c))<0){if(s=="."){if(c>l){l=f;continue}}else if(!t&&(u==u.toUpperCase()&&(u=u.toLowerCase())||u==u.toLowerCase()&&(u=u.toUpperCase()))){t=!0,c=-1,l=0;continue}return T(o,String(e),n,r)}n=!1,u=v(u,r,10,o.s),(l=u.indexOf("."))>-1?u=u.replace(".",""):l=u.length}for(c=0;u.charCodeAt(c)===48;c++);for(f=u.length;u.charCodeAt(--f)===48;);if(u=u.slice(c,++f)){if(f-=c,n&&h.DEBUG&&f>15&&(e>ae||e!==y(e)))throw Error(pe+o.s*e);if((l=l-c-1)>z)o.c=o.e=null;else if(l<Q)o.c=[o.e=0];else{if(o.e=l,o.c=[],c=(l+1)%E,l<0&&(c+=E),c<f){for(c&&o.c.push(+u.slice(0,c)),f-=E;c<f;)o.c.push(+u.slice(c,c+=E));c=E-(u=u.slice(c)).length}else c-=f;for(;c--;u+="0");o.c.push(+u)}}else o.c=[o.e=0]}h.clone=we,h.ROUND_UP=0,h.ROUND_DOWN=1,h.ROUND_CEIL=2,h.ROUND_FLOOR=3,h.ROUND_HALF_UP=4,h.ROUND_HALF_DOWN=5,h.ROUND_HALF_EVEN=6,h.ROUND_HALF_CEIL=7,h.ROUND_HALF_FLOOR=8,h.EUCLID=9,h.config=h.set=function(e){var r,i;if(e!=null)if(typeof e=="object"){if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(i=e[r],x(i,0,P,r),_=i),e.hasOwnProperty(r="ROUNDING_MODE")&&(i=e[r],x(i,0,8,r),S=i),e.hasOwnProperty(r="EXPONENTIAL_AT")&&(i=e[r],i&&i.pop?(x(i[0],-P,0,r),x(i[1],0,P,r),C=i[0],k=i[1]):(x(i,-P,P,r),C=-(k=i<0?-i:i))),e.hasOwnProperty(r="RANGE"))if(i=e[r],i&&i.pop)x(i[0],-P,-1,r),x(i[1],1,P,r),Q=i[0],z=i[1];else if(x(i,-P,P,r),i)Q=-(z=i<0?-i:i);else throw Error(U+r+" cannot be zero: "+i);if(e.hasOwnProperty(r="CRYPTO"))if(i=e[r],i===!!i)if(i)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))Z=i;else throw Z=!i,Error(U+"crypto unavailable");else Z=i;else throw Error(U+r+" not true or false: "+i);if(e.hasOwnProperty(r="MODULO_MODE")&&(i=e[r],x(i,0,9,r),b=i),e.hasOwnProperty(r="POW_PRECISION")&&(i=e[r],x(i,0,P,r),Y=i),e.hasOwnProperty(r="FORMAT"))if(i=e[r],typeof i=="object")te=i;else throw Error(U+r+" not an object: "+i);if(e.hasOwnProperty(r="ALPHABET"))if(i=e[r],typeof i=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(i))fe=i.slice(0,10)=="0123456789",K=i;else throw Error(U+r+" invalid: "+i)}else throw Error(U+"Object expected: "+e);return{DECIMAL_PLACES:_,ROUNDING_MODE:S,EXPONENTIAL_AT:[C,k],RANGE:[Q,z],CRYPTO:Z,MODULO_MODE:b,POW_PRECISION:Y,FORMAT:te,ALPHABET:K}},h.isBigNumber=function(e){if(!e||e._isBigNumber!==!0)return!1;if(!h.DEBUG)return!0;var r,i,s=e.c,t=e.e,l=e.s;e:if({}.toString.call(s)=="[object Array]"){if((l===1||l===-1)&&t>=-P&&t<=P&&t===y(t)){if(s[0]===0){if(t===0&&s.length===1)return!0;break e}if(r=(t+1)%E,r<1&&(r+=E),String(s[0]).length==r){for(r=0;r<s.length;r++)if(i=s[r],i<0||i>=H||i!==y(i))break e;if(i!==0)return!0}}}else if(s===null&&t===null&&(l===null||l===1||l===-1))return!0;throw Error(U+"Invalid BigNumber: "+e)},h.maximum=h.max=function(){return ge(arguments,-1)},h.minimum=h.min=function(){return ge(arguments,1)},h.random=function(){var e=9007199254740992,r=Math.random()*e&2097151?function(){return y(Math.random()*e)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(i){var s,t,l,c,n,f=0,u=[],o=new h(I);if(i==null?i=_:x(i,0,P),c=ce(i/E),Z)if(crypto.getRandomValues){for(s=crypto.getRandomValues(new Uint32Array(c*=2));f<c;)n=s[f]*131072+(s[f+1]>>>11),n>=9e15?(t=crypto.getRandomValues(new Uint32Array(2)),s[f]=t[0],s[f+1]=t[1]):(u.push(n%1e14),f+=2);f=c/2}else if(crypto.randomBytes){for(s=crypto.randomBytes(c*=7);f<c;)n=(s[f]&31)*281474976710656+s[f+1]*1099511627776+s[f+2]*4294967296+s[f+3]*16777216+(s[f+4]<<16)+(s[f+5]<<8)+s[f+6],n>=9e15?crypto.randomBytes(7).copy(s,f):(u.push(n%1e14),f+=7);f=c/7}else throw Z=!1,Error(U+"crypto unavailable");if(!Z)for(;f<c;)n=r(),n<9e15&&(u[f++]=n%1e14);for(c=u[--f],i%=E,c&&i&&(n=he[E-i],u[f]=y(c/n)*n);u[f]===0;u.pop(),f--);if(f<0)u=[l=0];else{for(l=-1;u[0]===0;u.splice(0,1),l-=E);for(f=1,n=u[0];n>=10;n/=10,f++);f<E&&(l-=E-f)}return o.e=l,o.c=u,o}}(),h.sum=function(){for(var e=1,r=arguments,i=new h(r[0]);e<r.length;)i=i.plus(r[e++]);return i},v=function(){var e="0123456789";function r(i,s,t,l){for(var c,n=[0],f,u=0,o=i.length;u<o;){for(f=n.length;f--;n[f]*=s);for(n[0]+=l.indexOf(i.charAt(u++)),c=0;c<n.length;c++)n[c]>t-1&&(n[c+1]==null&&(n[c+1]=0),n[c+1]+=n[c]/t|0,n[c]%=t)}return n.reverse()}return function(i,s,t,l,c){var n,f,u,o,a,p,w,d,B=i.indexOf("."),R=_,m=S;for(B>=0&&(o=Y,Y=0,i=i.replace(".",""),d=new h(s),p=d.pow(i.length-B),Y=o,d.c=r(W(q(p.c),p.e,"0"),10,t,e),d.e=d.c.length),w=r(i,s,t,c?(n=K,e):(n=e,K)),u=o=w.length;w[--o]==0;w.pop());if(!w[0])return n.charAt(0);if(B<0?--u:(p.c=w,p.e=u,p.s=l,p=N(p,d,R,m,t),w=p.c,a=p.r,u=p.e),f=u+R+1,B=w[f],o=t/2,a=a||f<0||w[f+1]!=null,a=m<4?(B!=null||a)&&(m==0||m==(p.s<0?3:2)):B>o||B==o&&(m==4||a||m==6&&w[f-1]&1||m==(p.s<0?8:7)),f<1||!w[0])i=a?W(n.charAt(1),-R,n.charAt(0)):n.charAt(0);else{if(w.length=f,a)for(--t;++w[--f]>t;)w[f]=0,f||(++u,w=[1].concat(w));for(o=w.length;!w[--o];);for(B=0,i="";B<=o;i+=n.charAt(w[B++]));i=W(i,u,n.charAt(0))}return i}}(),N=function(){function e(s,t,l){var c,n,f,u,o=0,a=s.length,p=t%J,w=t/J|0;for(s=s.slice();a--;)f=s[a]%J,u=s[a]/J|0,c=w*f+u*p,n=p*f+c%J*J+o,o=(n/l|0)+(c/J|0)+w*u,s[a]=n%l;return o&&(s=[o].concat(s)),s}function r(s,t,l,c){var n,f;if(l!=c)f=l>c?1:-1;else for(n=f=0;n<l;n++)if(s[n]!=t[n]){f=s[n]>t[n]?1:-1;break}return f}function i(s,t,l,c){for(var n=0;l--;)s[l]-=n,n=s[l]<t[l]?1:0,s[l]=n*c+s[l]-t[l];for(;!s[0]&&s.length>1;s.splice(0,1));}return function(s,t,l,c,n){var f,u,o,a,p,w,d,B,R,m,A,D,re,se,ue,X,ee,F=s.s==t.s?1:-1,L=s.c,M=t.c;if(!L||!L[0]||!M||!M[0])return new h(!s.s||!t.s||(L?M&&L[0]==M[0]:!M)?NaN:L&&L[0]==0||!M?F*0:F/0);for(B=new h(F),R=B.c=[],u=s.e-t.e,F=l+u+1,n||(n=H,u=$(s.e/E)-$(t.e/E),F=F/E|0),o=0;M[o]==(L[o]||0);o++);if(M[o]>(L[o]||0)&&u--,F<0)R.push(1),a=!0;else{for(se=L.length,X=M.length,o=0,F+=2,p=y(n/(M[0]+1)),p>1&&(M=e(M,p,n),L=e(L,p,n),X=M.length,se=L.length),re=X,m=L.slice(0,X),A=m.length;A<X;m[A++]=0);ee=M.slice(),ee=[0].concat(ee),ue=M[0],M[1]>=n/2&&ue++;do{if(p=0,f=r(M,m,X,A),f<0){if(D=m[0],X!=A&&(D=D*n+(m[1]||0)),p=y(D/ue),p>1)for(p>=n&&(p=n-1),w=e(M,p,n),d=w.length,A=m.length;r(w,m,d,A)==1;)p--,i(w,X<d?ee:M,d,n),d=w.length,f=1;else p==0&&(f=p=1),w=M.slice(),d=w.length;if(d<A&&(w=[0].concat(w)),i(m,w,A,n),A=m.length,f==-1)for(;r(M,m,X,A)<1;)p++,i(m,X<A?ee:M,A,n),A=m.length}else f===0&&(p++,m=[0]);R[o++]=p,m[0]?m[A++]=L[re]||0:(m=[L[re]],A=1)}while((re++<se||m[0]!=null)&&F--);a=m[0]!=null,R[0]||R.splice(0,1)}if(n==H){for(o=1,F=R[0];F>=10;F/=10,o++);G(B,l+(B.e=o+u*E-1)+1,c,a)}else B.e=u,B.r=+a;return B}}();function le(e,r,i,s){var t,l,c,n,f;if(i==null?i=S:x(i,0,8),!e.c)return e.toString();if(t=e.c[0],c=e.e,r==null)f=q(e.c),f=s==1||s==2&&(c<=C||c>=k)?ne(f,c):W(f,c,"0");else if(e=G(new h(e),r,i),l=e.e,f=q(e.c),n=f.length,s==1||s==2&&(r<=l||l<=C)){for(;n<r;f+="0",n++);f=ne(f,l)}else if(r-=c,f=W(f,l,"0"),l+1>n){if(--r>0)for(f+=".";r--;f+="0");}else if(r+=l-n,r>0)for(l+1==n&&(f+=".");r--;f+="0");return e.s<0&&t?"-"+f:f}function ge(e,r){for(var i,s,t=1,l=new h(e[0]);t<e.length;t++)s=new h(e[t]),(!s.s||(i=j(l,s))===r||i===0&&l.s===r)&&(l=s);return l}function oe(e,r,i){for(var s=1,t=r.length;!r[--t];r.pop());for(t=r[0];t>=10;t/=10,s++);return(i=s+i*E-1)>z?e.c=e.e=null:i<Q?e.c=[e.e=0]:(e.e=i,e.c=r),e}T=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,r=/^([^.]+)\.$/,i=/^\.([^.]+)$/,s=/^-?(Infinity|NaN)$/,t=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(l,c,n,f){var u,o=n?c:c.replace(t,"");if(s.test(o))l.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(e,function(a,p,w){return u=(w=w.toLowerCase())=="x"?16:w=="b"?2:8,!f||f==u?p:a}),f&&(u=f,o=o.replace(r,"$1").replace(i,"0.$1")),c!=o))return new h(o,u);if(h.DEBUG)throw Error(U+"Not a"+(f?" base "+f:"")+" number: "+c);l.s=null}l.c=l.e=null}}();function G(e,r,i,s){var t,l,c,n,f,u,o,a=e.c,p=he;if(a){e:{for(t=1,n=a[0];n>=10;n/=10,t++);if(l=r-t,l<0)l+=E,c=r,f=a[u=0],o=y(f/p[t-c-1]%10);else if(u=ce((l+1)/E),u>=a.length)if(s){for(;a.length<=u;a.push(0));f=o=0,t=1,l%=E,c=l-E+1}else break e;else{for(f=n=a[u],t=1;n>=10;n/=10,t++);l%=E,c=l-E+t,o=c<0?0:y(f/p[t-c-1]%10)}if(s=s||r<0||a[u+1]!=null||(c<0?f:f%p[t-c-1]),s=i<4?(o||s)&&(i==0||i==(e.s<0?3:2)):o>5||o==5&&(i==4||s||i==6&&(l>0?c>0?f/p[t-c]:0:a[u-1])%10&1||i==(e.s<0?8:7)),r<1||!a[0])return a.length=0,s?(r-=e.e+1,a[0]=p[(E-r%E)%E],e.e=-r||0):a[0]=e.e=0,e;if(l==0?(a.length=u,n=1,u--):(a.length=u+1,n=p[E-l],a[u]=c>0?y(f/p[t-c]%p[c])*n:0),s)for(;;)if(u==0){for(l=1,c=a[0];c>=10;c/=10,l++);for(c=a[0]+=n,n=1;c>=10;c/=10,n++);l!=n&&(e.e++,a[0]==H&&(a[0]=1));break}else{if(a[u]+=n,a[u]!=H)break;a[u--]=0,n=1}for(l=a.length;a[--l]===0;a.pop());}e.e>z?e.c=e.e=null:e.e<Q&&(e.c=[e.e=0])}return e}function V(e){var r,i=e.e;return i===null?e.toString():(r=q(e.c),r=i<=C||i>=k?ne(r,i):W(r,i,"0"),e.s<0?"-"+r:r)}return g.absoluteValue=g.abs=function(){var e=new h(this);return e.s<0&&(e.s=1),e},g.comparedTo=function(e,r){return j(this,new h(e,r))},g.decimalPlaces=g.dp=function(e,r){var i,s,t,l=this;if(e!=null)return x(e,0,P),r==null?r=S:x(r,0,8),G(new h(l),e+l.e+1,r);if(!(i=l.c))return null;if(s=((t=i.length-1)-$(this.e/E))*E,t=i[t])for(;t%10==0;t/=10,s--);return s<0&&(s=0),s},g.dividedBy=g.div=function(e,r){return N(this,new h(e,r),_,S)},g.dividedToIntegerBy=g.idiv=function(e,r){return N(this,new h(e,r),0,1)},g.exponentiatedBy=g.pow=function(e,r){var i,s,t,l,c,n,f,u,o,a=this;if(e=new h(e),e.c&&!e.isInteger())throw Error(U+"Exponent not an integer: "+V(e));if(r!=null&&(r=new h(r)),n=e.e>14,!a.c||!a.c[0]||a.c[0]==1&&!a.e&&a.c.length==1||!e.c||!e.c[0])return o=new h(Math.pow(+V(a),n?e.s*(2-ie(e)):+V(e))),r?o.mod(r):o;if(f=e.s<0,r){if(r.c?!r.c[0]:!r.s)return new h(NaN);s=!f&&a.isInteger()&&r.isInteger(),s&&(a=a.mod(r))}else{if(e.e>9&&(a.e>0||a.e<-1||(a.e==0?a.c[0]>1||n&&a.c[1]>=24e7:a.c[0]<8e13||n&&a.c[0]<=9999975e7)))return l=a.s<0&&ie(e)?-0:0,a.e>-1&&(l=1/l),new h(f?1/l:l);Y&&(l=ce(Y/E+2))}for(n?(i=new h(.5),f&&(e.s=1),u=ie(e)):(t=Math.abs(+V(e)),u=t%2),o=new h(I);;){if(u){if(o=o.times(a),!o.c)break;l?o.c.length>l&&(o.c.length=l):s&&(o=o.mod(r))}if(t){if(t=y(t/2),t===0)break;u=t%2}else if(e=e.times(i),G(e,e.e+1,1),e.e>14)u=ie(e);else{if(t=+V(e),t===0)break;u=t%2}a=a.times(a),l?a.c&&a.c.length>l&&(a.c.length=l):s&&(a=a.mod(r))}return s?o:(f&&(o=I.div(o)),r?o.mod(r):l?G(o,Y,S,c):o)},g.integerValue=function(e){var r=new h(this);return e==null?e=S:x(e,0,8),G(r,r.e+1,e)},g.isEqualTo=g.eq=function(e,r){return j(this,new h(e,r))===0},g.isFinite=function(){return!!this.c},g.isGreaterThan=g.gt=function(e,r){return j(this,new h(e,r))>0},g.isGreaterThanOrEqualTo=g.gte=function(e,r){return(r=j(this,new h(e,r)))===1||r===0},g.isInteger=function(){return!!this.c&&$(this.e/E)>this.c.length-2},g.isLessThan=g.lt=function(e,r){return j(this,new h(e,r))<0},g.isLessThanOrEqualTo=g.lte=function(e,r){return(r=j(this,new h(e,r)))===-1||r===0},g.isNaN=function(){return!this.s},g.isNegative=function(){return this.s<0},g.isPositive=function(){return this.s>0},g.isZero=function(){return!!this.c&&this.c[0]==0},g.minus=function(e,r){var i,s,t,l,c=this,n=c.s;if(e=new h(e,r),r=e.s,!n||!r)return new h(NaN);if(n!=r)return e.s=-r,c.plus(e);var f=c.e/E,u=e.e/E,o=c.c,a=e.c;if(!f||!u){if(!o||!a)return o?(e.s=-r,e):new h(a?c:NaN);if(!o[0]||!a[0])return a[0]?(e.s=-r,e):new h(o[0]?c:S==3?-0:0)}if(f=$(f),u=$(u),o=o.slice(),n=f-u){for((l=n<0)?(n=-n,t=o):(u=f,t=a),t.reverse(),r=n;r--;t.push(0));t.reverse()}else for(s=(l=(n=o.length)<(r=a.length))?n:r,n=r=0;r<s;r++)if(o[r]!=a[r]){l=o[r]<a[r];break}if(l&&(t=o,o=a,a=t,e.s=-e.s),r=(s=a.length)-(i=o.length),r>0)for(;r--;o[i++]=0);for(r=H-1;s>n;){if(o[--s]<a[s]){for(i=s;i&&!o[--i];o[i]=r);--o[i],o[s]+=H}o[s]-=a[s]}for(;o[0]==0;o.splice(0,1),--u);return o[0]?oe(e,o,u):(e.s=S==3?-1:1,e.c=[e.e=0],e)},g.modulo=g.mod=function(e,r){var i,s,t=this;return e=new h(e,r),!t.c||!e.s||e.c&&!e.c[0]?new h(NaN):!e.c||t.c&&!t.c[0]?new h(t):(b==9?(s=e.s,e.s=1,i=N(t,e,0,3),e.s=s,i.s*=s):i=N(t,e,0,b),e=t.minus(i.times(e)),!e.c[0]&&b==1&&(e.s=t.s),e)},g.multipliedBy=g.times=function(e,r){var i,s,t,l,c,n,f,u,o,a,p,w,d,B,R,m=this,A=m.c,D=(e=new h(e,r)).c;if(!A||!D||!A[0]||!D[0])return!m.s||!e.s||A&&!A[0]&&!D||D&&!D[0]&&!A?e.c=e.e=e.s=null:(e.s*=m.s,!A||!D?e.c=e.e=null:(e.c=[0],e.e=0)),e;for(s=$(m.e/E)+$(e.e/E),e.s*=m.s,f=A.length,a=D.length,f<a&&(d=A,A=D,D=d,t=f,f=a,a=t),t=f+a,d=[];t--;d.push(0));for(B=H,R=J,t=a;--t>=0;){for(i=0,p=D[t]%R,w=D[t]/R|0,c=f,l=t+c;l>t;)u=A[--c]%R,o=A[c]/R|0,n=w*u+o*p,u=p*u+n%R*R+d[l]+i,i=(u/B|0)+(n/R|0)+w*o,d[l--]=u%B;d[l]=i}return i?++s:d.splice(0,1),oe(e,d,s)},g.negated=function(){var e=new h(this);return e.s=-e.s||null,e},g.plus=function(e,r){var i,s=this,t=s.s;if(e=new h(e,r),r=e.s,!t||!r)return new h(NaN);if(t!=r)return e.s=-r,s.minus(e);var l=s.e/E,c=e.e/E,n=s.c,f=e.c;if(!l||!c){if(!n||!f)return new h(t/0);if(!n[0]||!f[0])return f[0]?e:new h(n[0]?s:t*0)}if(l=$(l),c=$(c),n=n.slice(),t=l-c){for(t>0?(c=l,i=f):(t=-t,i=n),i.reverse();t--;i.push(0));i.reverse()}for(t=n.length,r=f.length,t-r<0&&(i=f,f=n,n=i,r=t),t=0;r;)t=(n[--r]=n[r]+f[r]+t)/H|0,n[r]=H===n[r]?0:n[r]%H;return t&&(n=[t].concat(n),++c),oe(e,n,c)},g.precision=g.sd=function(e,r){var i,s,t,l=this;if(e!=null&&e!==!!e)return x(e,1,P),r==null?r=S:x(r,0,8),G(new h(l),e,r);if(!(i=l.c))return null;if(t=i.length-1,s=t*E+1,t=i[t]){for(;t%10==0;t/=10,s--);for(t=i[0];t>=10;t/=10,s++);}return e&&l.e+1>s&&(s=l.e+1),s},g.shiftedBy=function(e){return x(e,-ae,ae),this.times("1e"+e)},g.squareRoot=g.sqrt=function(){var e,r,i,s,t,l=this,c=l.c,n=l.s,f=l.e,u=_+4,o=new h("0.5");if(n!==1||!c||!c[0])return new h(!n||n<0&&(!c||c[0])?NaN:c?l:1/0);if(n=Math.sqrt(+V(l)),n==0||n==1/0?(r=q(c),(r.length+f)%2==0&&(r+="0"),n=Math.sqrt(+r),f=$((f+1)/2)-(f<0||f%2),n==1/0?r="5e"+f:(r=n.toExponential(),r=r.slice(0,r.indexOf("e")+1)+f),i=new h(r)):i=new h(n+""),i.c[0]){for(f=i.e,n=f+u,n<3&&(n=0);;)if(t=i,i=o.times(t.plus(N(l,t,u,1))),q(t.c).slice(0,n)===(r=q(i.c)).slice(0,n))if(i.e<f&&--n,r=r.slice(n-3,n+1),r=="9999"||!s&&r=="4999"){if(!s&&(G(t,t.e+_+2,0),t.times(t).eq(l))){i=t;break}u+=4,n+=4,s=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(G(i,i.e+_+2,1),e=!i.times(i).eq(l));break}}return G(i,i.e+_+1,S,e)},g.toExponential=function(e,r){return e!=null&&(x(e,0,P),e++),le(this,e,r,1)},g.toFixed=function(e,r){return e!=null&&(x(e,0,P),e=e+this.e+1),le(this,e,r)},g.toFormat=function(e,r,i){var s,t=this;if(i==null)e!=null&&r&&typeof r=="object"?(i=r,r=null):e&&typeof e=="object"?(i=e,e=r=null):i=te;else if(typeof i!="object")throw Error(U+"Argument not an object: "+i);if(s=t.toFixed(e,r),t.c){var l,c=s.split("."),n=+i.groupSize,f=+i.secondaryGroupSize,u=i.groupSeparator||"",o=c[0],a=c[1],p=t.s<0,w=p?o.slice(1):o,d=w.length;if(f&&(l=n,n=f,f=l,d-=l),n>0&&d>0){for(l=d%n||n,o=w.substr(0,l);l<d;l+=n)o+=u+w.substr(l,n);f>0&&(o+=u+w.slice(l)),p&&(o="-"+o)}s=a?o+(i.decimalSeparator||"")+((f=+i.fractionGroupSize)?a.replace(new RegExp("\\d{"+f+"}\\B","g"),"$&"+(i.fractionGroupSeparator||"")):a):o}return(i.prefix||"")+s+(i.suffix||"")},g.toFraction=function(e){var r,i,s,t,l,c,n,f,u,o,a,p,w=this,d=w.c;if(e!=null&&(n=new h(e),!n.isInteger()&&(n.c||n.s!==1)||n.lt(I)))throw Error(U+"Argument "+(n.isInteger()?"out of range: ":"not an integer: ")+V(n));if(!d)return new h(w);for(r=new h(I),u=i=new h(I),s=f=new h(I),p=q(d),l=r.e=p.length-w.e-1,r.c[0]=he[(c=l%E)<0?E+c:c],e=!e||n.comparedTo(r)>0?l>0?r:u:n,c=z,z=1/0,n=new h(p),f.c[0]=0;o=N(n,r,0,1),t=i.plus(o.times(s)),t.comparedTo(e)!=1;)i=s,s=t,u=f.plus(o.times(t=u)),f=t,r=n.minus(o.times(t=r)),n=t;return t=N(e.minus(i),s,0,1),f=f.plus(t.times(u)),i=i.plus(t.times(s)),f.s=u.s=w.s,l=l*2,a=N(u,s,l,S).minus(w).abs().comparedTo(N(f,i,l,S).minus(w).abs())<1?[u,s]:[f,i],z=c,a},g.toNumber=function(){return+V(this)},g.toPrecision=function(e,r){return e!=null&&x(e,1,P),le(this,e,r,2)},g.toString=function(e){var r,i=this,s=i.s,t=i.e;return t===null?s?(r="Infinity",s<0&&(r="-"+r)):r="NaN":(e==null?r=t<=C||t>=k?ne(q(i.c),t):W(q(i.c),t,"0"):e===10&&fe?(i=G(new h(i),_+t+1,S),r=W(q(i.c),i.e,"0")):(x(e,2,K.length,"Base"),r=v(W(q(i.c),t,"0"),10,e,s,!0)),s<0&&i.c[0]&&(r="-"+r)),r},g.valueOf=g.toJSON=function(){return V(this)},g._isBigNumber=!0,g[Symbol.toStringTag]="BigNumber",g[Symbol.for("nodejs.util.inspect.custom")]=g.valueOf,O!=null&&h.set(O),h}function $(O){var N=O|0;return O>0||O===N?N:N-1}function q(O){for(var N,v,T=1,g=O.length,I=O[0]+"";T<g;){for(N=O[T++]+"",v=E-N.length;v--;N="0"+N);I+=N}for(g=I.length;I.charCodeAt(--g)===48;);return I.slice(0,g+1||1)}function j(O,N){var v,T,g=O.c,I=N.c,_=O.s,S=N.s,C=O.e,k=N.e;if(!_||!S)return null;if(v=g&&!g[0],T=I&&!I[0],v||T)return v?T?0:-S:_;if(_!=S)return _;if(v=_<0,T=C==k,!g||!I)return T?0:!g^v?1:-1;if(!T)return C>k^v?1:-1;for(S=(C=g.length)<(k=I.length)?C:k,_=0;_<S;_++)if(g[_]!=I[_])return g[_]>I[_]^v?1:-1;return C==k?0:C>k^v?1:-1}function x(O,N,v,T){if(O<N||O>v||O!==y(O))throw Error(U+(T||"Argument")+(typeof O=="number"?O<N||O>v?" out of range: ":" not an integer: ":" not a primitive number: ")+String(O))}function ie(O){var N=O.c.length-1;return $(O.e/E)==N&&O.c[N]%2!=0}function ne(O,N){return(O.length>1?O.charAt(0)+"."+O.slice(1):O)+(N<0?"e":"e+")+N}function W(O,N,v){var T,g;if(N<0){for(g=v+".";++N;g+=v);O=g+O}else if(T=O.length,++N>T){for(g=v,N-=T;--N;g+=v);O+=g}else N<T&&(O=O.slice(0,N)+"."+O.slice(N));return O}var Ne=we();exports.BigNumber=Ne;exports.default=Ne;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var Ee=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ce=Math.ceil,y=Math.floor,C="[BigNumber Error] ",ge=C+"Number primitive has more than 15 significant digits: ",H=1e14,E=14,pe=9007199254740991,ae=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],J=1e7,k=1e9;function we(O){var N,v,T,g=h.prototype={constructor:h,toString:null,valueOf:null},I=new h(1),_=20,S=4,L=-7,U=21,Q=-1e7,z=1e7,Z=!1,b=1,Y=0,te={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},K="0123456789abcdefghijklmnopqrstuvwxyz",fe=!0;function h(e,r){var i,s,t,l,c,n,f,u,o=this;if(!(o instanceof h))return new h(e,r);if(r==null){if(e&&e._isBigNumber===!0){o.s=e.s,!e.c||e.e>z?o.c=o.e=null:e.e<Q?o.c=[o.e=0]:(o.e=e.e,o.c=e.c.slice());return}if((n=typeof e=="number")&&e*0==0){if(o.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,c=e;c>=10;c/=10,l++);l>z?o.c=o.e=null:(o.e=l,o.c=[e]);return}u=String(e)}else{if(!Ee.test(u=String(e)))return T(o,u,n);o.s=u.charCodeAt(0)==45?(u=u.slice(1),-1):1}(l=u.indexOf("."))>-1&&(u=u.replace(".","")),(c=u.search(/e/i))>0?(l<0&&(l=c),l+=+u.slice(c+1),u=u.substring(0,c)):l<0&&(l=u.length)}else{if(x(r,2,K.length,"Base"),r==10&&fe)return o=new h(e),G(o,_+o.e+1,S);if(u=String(e),n=typeof e=="number"){if(e*0!=0)return T(o,u,n,r);if(o.s=1/e<0?(u=u.slice(1),-1):1,h.DEBUG&&u.replace(/^0\.0*|\./,"").length>15)throw Error(ge+e)}else o.s=u.charCodeAt(0)===45?(u=u.slice(1),-1):1;for(i=K.slice(0,r),l=c=0,f=u.length;c<f;c++)if(i.indexOf(s=u.charAt(c))<0){if(s=="."){if(c>l){l=f;continue}}else if(!t&&(u==u.toUpperCase()&&(u=u.toLowerCase())||u==u.toLowerCase()&&(u=u.toUpperCase()))){t=!0,c=-1,l=0;continue}return T(o,String(e),n,r)}n=!1,u=v(u,r,10,o.s),(l=u.indexOf("."))>-1?u=u.replace(".",""):l=u.length}for(c=0;u.charCodeAt(c)===48;c++);for(f=u.length;u.charCodeAt(--f)===48;);if(u=u.slice(c,++f)){if(f-=c,n&&h.DEBUG&&f>15&&(e>pe||e!==y(e)))throw Error(ge+o.s*e);if((l=l-c-1)>z)o.c=o.e=null;else if(l<Q)o.c=[o.e=0];else{if(o.e=l,o.c=[],c=(l+1)%E,l<0&&(c+=E),c<f){for(c&&o.c.push(+u.slice(0,c)),f-=E;c<f;)o.c.push(+u.slice(c,c+=E));c=E-(u=u.slice(c)).length}else c-=f;for(;c--;u+="0");o.c.push(+u)}}else o.c=[o.e=0]}h.clone=we,h.ROUND_UP=0,h.ROUND_DOWN=1,h.ROUND_CEIL=2,h.ROUND_FLOOR=3,h.ROUND_HALF_UP=4,h.ROUND_HALF_DOWN=5,h.ROUND_HALF_EVEN=6,h.ROUND_HALF_CEIL=7,h.ROUND_HALF_FLOOR=8,h.EUCLID=9,h.config=h.set=function(e){var r,i;if(e!=null)if(typeof e=="object"){if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(i=e[r],x(i,0,k,r),_=i),e.hasOwnProperty(r="ROUNDING_MODE")&&(i=e[r],x(i,0,8,r),S=i),e.hasOwnProperty(r="EXPONENTIAL_AT")&&(i=e[r],i&&i.pop?(x(i[0],-1e9,0,r),x(i[1],0,k,r),L=i[0],U=i[1]):(x(i,-1e9,k,r),L=-(U=i<0?-i:i))),e.hasOwnProperty(r="RANGE"))if(i=e[r],i&&i.pop)x(i[0],-1e9,-1,r),x(i[1],1,k,r),Q=i[0],z=i[1];else if(x(i,-1e9,k,r),i)Q=-(z=i<0?-i:i);else throw Error(C+r+" cannot be zero: "+i);if(e.hasOwnProperty(r="CRYPTO"))if(i=e[r],i===!!i)if(i)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))Z=i;else throw Z=!i,Error(C+"crypto unavailable");else Z=i;else throw Error(C+r+" not true or false: "+i);if(e.hasOwnProperty(r="MODULO_MODE")&&(i=e[r],x(i,0,9,r),b=i),e.hasOwnProperty(r="POW_PRECISION")&&(i=e[r],x(i,0,k,r),Y=i),e.hasOwnProperty(r="FORMAT"))if(i=e[r],typeof i=="object")te=i;else throw Error(C+r+" not an object: "+i);if(e.hasOwnProperty(r="ALPHABET"))if(i=e[r],typeof i=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(i))fe=i.slice(0,10)=="0123456789",K=i;else throw Error(C+r+" invalid: "+i)}else throw Error(C+"Object expected: "+e);return{DECIMAL_PLACES:_,ROUNDING_MODE:S,EXPONENTIAL_AT:[L,U],RANGE:[Q,z],CRYPTO:Z,MODULO_MODE:b,POW_PRECISION:Y,FORMAT:te,ALPHABET:K}},h.isBigNumber=function(e){if(!e||e._isBigNumber!==!0)return!1;if(!h.DEBUG)return!0;var r,i,s=e.c,t=e.e,l=e.s;e:if({}.toString.call(s)=="[object Array]"){if((l===1||l===-1)&&t>=-1e9&&t<=k&&t===y(t)){if(s[0]===0){if(t===0&&s.length===1)return!0;break e}if(r=(t+1)%E,r<1&&(r+=E),String(s[0]).length==r){for(r=0;r<s.length;r++)if(i=s[r],i<0||i>=H||i!==y(i))break e;if(i!==0)return!0}}}else if(s===null&&t===null&&(l===null||l===1||l===-1))return!0;throw Error(C+"Invalid BigNumber: "+e)},h.maximum=h.max=function(){return he(arguments,-1)},h.minimum=h.min=function(){return he(arguments,1)},h.random=function(){var e=9007199254740992,r=Math.random()*e&2097151?function(){return y(Math.random()*e)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(i){var s,t,l,c,n,f=0,u=[],o=new h(I);if(i==null?i=_:x(i,0,k),c=ce(i/E),Z)if(crypto.getRandomValues){for(s=crypto.getRandomValues(new Uint32Array(c*=2));f<c;)n=s[f]*131072+(s[f+1]>>>11),n>=9e15?(t=crypto.getRandomValues(new Uint32Array(2)),s[f]=t[0],s[f+1]=t[1]):(u.push(n%1e14),f+=2);f=c/2}else if(crypto.randomBytes){for(s=crypto.randomBytes(c*=7);f<c;)n=(s[f]&31)*281474976710656+s[f+1]*1099511627776+s[f+2]*4294967296+s[f+3]*16777216+(s[f+4]<<16)+(s[f+5]<<8)+s[f+6],n>=9e15?crypto.randomBytes(7).copy(s,f):(u.push(n%1e14),f+=7);f=c/7}else throw Z=!1,Error(C+"crypto unavailable");if(!Z)for(;f<c;)n=r(),n<9e15&&(u[f++]=n%1e14);for(c=u[--f],i%=E,c&&i&&(n=ae[E-i],u[f]=y(c/n)*n);u[f]===0;u.pop(),f--);if(f<0)u=[l=0];else{for(l=-1;u[0]===0;u.splice(0,1),l-=E);for(f=1,n=u[0];n>=10;n/=10,f++);f<E&&(l-=E-f)}return o.e=l,o.c=u,o}}(),h.sum=function(){for(var e=1,r=arguments,i=new h(r[0]);e<r.length;)i=i.plus(r[e++]);return i},v=function(){var e="0123456789";function r(i,s,t,l){for(var c,n=[0],f,u=0,o=i.length;u<o;){for(f=n.length;f--;n[f]*=s);for(n[0]+=l.indexOf(i.charAt(u++)),c=0;c<n.length;c++)n[c]>t-1&&(n[c+1]==null&&(n[c+1]=0),n[c+1]+=n[c]/t|0,n[c]%=t)}return n.reverse()}return function(i,s,t,l,c){var n,f,u,o,a,p,w,d,B=i.indexOf("."),R=_,m=S;for(B>=0&&(o=Y,Y=0,i=i.replace(".",""),d=new h(s),p=d.pow(i.length-B),Y=o,d.c=r(W(q(p.c),p.e,"0"),10,t,e),d.e=d.c.length),w=r(i,s,t,c?(n=K,e):(n=e,K)),u=o=w.length;w[--o]==0;w.pop());if(!w[0])return n.charAt(0);if(B<0?--u:(p.c=w,p.e=u,p.s=l,p=N(p,d,R,m,t),w=p.c,a=p.r,u=p.e),f=u+R+1,B=w[f],o=t/2,a=a||f<0||w[f+1]!=null,a=m<4?(B!=null||a)&&(m==0||m==(p.s<0?3:2)):B>o||B==o&&(m==4||a||m==6&&w[f-1]&1||m==(p.s<0?8:7)),f<1||!w[0])i=a?W(n.charAt(1),-R,n.charAt(0)):n.charAt(0);else{if(w.length=f,a)for(--t;++w[--f]>t;)w[f]=0,f||(++u,w=[1].concat(w));for(o=w.length;!w[--o];);for(B=0,i="";B<=o;i+=n.charAt(w[B++]));i=W(i,u,n.charAt(0))}return i}}(),N=function(){function e(s,t,l){var c,n,f,u,o=0,a=s.length,p=t%J,w=t/J|0;for(s=s.slice();a--;)f=s[a]%J,u=s[a]/J|0,c=w*f+u*p,n=p*f+c%J*J+o,o=(n/l|0)+(c/J|0)+w*u,s[a]=n%l;return o&&(s=[o].concat(s)),s}function r(s,t,l,c){var n,f;if(l!=c)f=l>c?1:-1;else for(n=f=0;n<l;n++)if(s[n]!=t[n]){f=s[n]>t[n]?1:-1;break}return f}function i(s,t,l,c){for(var n=0;l--;)s[l]-=n,n=s[l]<t[l]?1:0,s[l]=n*c+s[l]-t[l];for(;!s[0]&&s.length>1;s.splice(0,1));}return function(s,t,l,c,n){var f,u,o,a,p,w,d,B,R,m,A,P,re,se,ue,X,ee,F=s.s==t.s?1:-1,D=s.c,M=t.c;if(!D||!D[0]||!M||!M[0])return new h(!s.s||!t.s||(D?M&&D[0]==M[0]:!M)?NaN:D&&D[0]==0||!M?F*0:F/0);for(B=new h(F),R=B.c=[],u=s.e-t.e,F=l+u+1,n||(n=H,u=$(s.e/E)-$(t.e/E),F=F/E|0),o=0;M[o]==(D[o]||0);o++);if(M[o]>(D[o]||0)&&u--,F<0)R.push(1),a=!0;else{for(se=D.length,X=M.length,o=0,F+=2,p=y(n/(M[0]+1)),p>1&&(M=e(M,p,n),D=e(D,p,n),X=M.length,se=D.length),re=X,m=D.slice(0,X),A=m.length;A<X;m[A++]=0);ee=M.slice(),ee=[0].concat(ee),ue=M[0],M[1]>=n/2&&ue++;do{if(p=0,f=r(M,m,X,A),f<0){if(P=m[0],X!=A&&(P=P*n+(m[1]||0)),p=y(P/ue),p>1)for(p>=n&&(p=n-1),w=e(M,p,n),d=w.length,A=m.length;r(w,m,d,A)==1;)p--,i(w,X<d?ee:M,d,n),d=w.length,f=1;else p==0&&(f=p=1),w=M.slice(),d=w.length;if(d<A&&(w=[0].concat(w)),i(m,w,A,n),A=m.length,f==-1)for(;r(M,m,X,A)<1;)p++,i(m,X<A?ee:M,A,n),A=m.length}else f===0&&(p++,m=[0]);R[o++]=p,m[0]?m[A++]=D[re]||0:(m=[D[re]],A=1)}while((re++<se||m[0]!=null)&&F--);a=m[0]!=null,R[0]||R.splice(0,1)}if(n==H){for(o=1,F=R[0];F>=10;F/=10,o++);G(B,l+(B.e=o+u*E-1)+1,c,a)}else B.e=u,B.r=+a;return B}}();function le(e,r,i,s){var t,l,c,n,f;if(i==null?i=S:x(i,0,8),!e.c)return e.toString();if(t=e.c[0],c=e.e,r==null)f=q(e.c),f=s==1||s==2&&(c<=L||c>=U)?ne(f,c):W(f,c,"0");else if(e=G(new h(e),r,i),l=e.e,f=q(e.c),n=f.length,s==1||s==2&&(r<=l||l<=L)){for(;n<r;f+="0",n++);f=ne(f,l)}else if(r-=c,f=W(f,l,"0"),l+1>n){if(--r>0)for(f+=".";r--;f+="0");}else if(r+=l-n,r>0)for(l+1==n&&(f+=".");r--;f+="0");return e.s<0&&t?"-"+f:f}function he(e,r){for(var i,s,t=1,l=new h(e[0]);t<e.length;t++)s=new h(e[t]),(!s.s||(i=j(l,s))===r||i===0&&l.s===r)&&(l=s);return l}function oe(e,r,i){for(var s=1,t=r.length;!r[--t];r.pop());for(t=r[0];t>=10;t/=10,s++);return(i=s+i*E-1)>z?e.c=e.e=null:i<Q?e.c=[e.e=0]:(e.e=i,e.c=r),e}T=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,r=/^([^.]+)\.$/,i=/^\.([^.]+)$/,s=/^-?(Infinity|NaN)$/,t=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(l,c,n,f){var u,o=n?c:c.replace(t,"");if(s.test(o))l.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(e,function(a,p,w){return u=(w=w.toLowerCase())=="x"?16:w=="b"?2:8,!f||f==u?p:a}),f&&(u=f,o=o.replace(r,"$1").replace(i,"0.$1")),c!=o))return new h(o,u);if(h.DEBUG)throw Error(C+"Not a"+(f?" base "+f:"")+" number: "+c);l.s=null}l.c=l.e=null}}();function G(e,r,i,s){var t,l,c,n,f,u,o,a=e.c,p=ae;if(a){e:{for(t=1,n=a[0];n>=10;n/=10,t++);if(l=r-t,l<0)l+=E,c=r,f=a[u=0],o=y(f/p[t-c-1]%10);else if(u=ce((l+1)/E),u>=a.length)if(s){for(;a.length<=u;a.push(0));f=o=0,t=1,l%=E,c=l-E+1}else break e;else{for(f=n=a[u],t=1;n>=10;n/=10,t++);l%=E,c=l-E+t,o=c<0?0:y(f/p[t-c-1]%10)}if(s=s||r<0||a[u+1]!=null||(c<0?f:f%p[t-c-1]),s=i<4?(o||s)&&(i==0||i==(e.s<0?3:2)):o>5||o==5&&(i==4||s||i==6&&(l>0?c>0?f/p[t-c]:0:a[u-1])%10&1||i==(e.s<0?8:7)),r<1||!a[0])return a.length=0,s?(r-=e.e+1,a[0]=p[(E-r%E)%E],e.e=-r||0):a[0]=e.e=0,e;if(l==0?(a.length=u,n=1,u--):(a.length=u+1,n=p[E-l],a[u]=c>0?y(f/p[t-c]%p[c])*n:0),s)for(;;)if(u==0){for(l=1,c=a[0];c>=10;c/=10,l++);for(c=a[0]+=n,n=1;c>=10;c/=10,n++);l!=n&&(e.e++,a[0]==H&&(a[0]=1));break}else{if(a[u]+=n,a[u]!=H)break;a[u--]=0,n=1}for(l=a.length;a[--l]===0;a.pop());}e.e>z?e.c=e.e=null:e.e<Q&&(e.c=[e.e=0])}return e}function V(e){var r,i=e.e;return i===null?e.toString():(r=q(e.c),r=i<=L||i>=U?ne(r,i):W(r,i,"0"),e.s<0?"-"+r:r)}return g.absoluteValue=g.abs=function(){var e=new h(this);return e.s<0&&(e.s=1),e},g.comparedTo=function(e,r){return j(this,new h(e,r))},g.decimalPlaces=g.dp=function(e,r){var i,s,t,l=this;if(e!=null)return x(e,0,k),r==null?r=S:x(r,0,8),G(new h(l),e+l.e+1,r);if(!(i=l.c))return null;if(s=((t=i.length-1)-$(this.e/E))*E,t=i[t])for(;t%10==0;t/=10,s--);return s<0&&(s=0),s},g.dividedBy=g.div=function(e,r){return N(this,new h(e,r),_,S)},g.dividedToIntegerBy=g.idiv=function(e,r){return N(this,new h(e,r),0,1)},g.exponentiatedBy=g.pow=function(e,r){var i,s,t,l,c,n,f,u,o,a=this;if(e=new h(e),e.c&&!e.isInteger())throw Error(C+"Exponent not an integer: "+V(e));if(r!=null&&(r=new h(r)),n=e.e>14,!a.c||!a.c[0]||a.c[0]==1&&!a.e&&a.c.length==1||!e.c||!e.c[0])return o=new h(Math.pow(+V(a),n?e.s*(2-ie(e)):+V(e))),r?o.mod(r):o;if(f=e.s<0,r){if(r.c?!r.c[0]:!r.s)return new h(NaN);s=!f&&a.isInteger()&&r.isInteger(),s&&(a=a.mod(r))}else{if(e.e>9&&(a.e>0||a.e<-1||(a.e==0?a.c[0]>1||n&&a.c[1]>=24e7:a.c[0]<8e13||n&&a.c[0]<=9999975e7)))return l=a.s<0&&ie(e)?-0:0,a.e>-1&&(l=1/l),new h(f?1/l:l);Y&&(l=ce(Y/E+2))}for(n?(i=new h(.5),f&&(e.s=1),u=ie(e)):(t=Math.abs(+V(e)),u=t%2),o=new h(I);;){if(u){if(o=o.times(a),!o.c)break;l?o.c.length>l&&(o.c.length=l):s&&(o=o.mod(r))}if(t){if(t=y(t/2),t===0)break;u=t%2}else if(e=e.times(i),G(e,e.e+1,1),e.e>14)u=ie(e);else{if(t=+V(e),t===0)break;u=t%2}a=a.times(a),l?a.c&&a.c.length>l&&(a.c.length=l):s&&(a=a.mod(r))}return s?o:(f&&(o=I.div(o)),r?o.mod(r):l?G(o,Y,S,c):o)},g.integerValue=function(e){var r=new h(this);return e==null?e=S:x(e,0,8),G(r,r.e+1,e)},g.isEqualTo=g.eq=function(e,r){return j(this,new h(e,r))===0},g.isFinite=function(){return!!this.c},g.isGreaterThan=g.gt=function(e,r){return j(this,new h(e,r))>0},g.isGreaterThanOrEqualTo=g.gte=function(e,r){return(r=j(this,new h(e,r)))===1||r===0},g.isInteger=function(){return!!this.c&&$(this.e/E)>this.c.length-2},g.isLessThan=g.lt=function(e,r){return j(this,new h(e,r))<0},g.isLessThanOrEqualTo=g.lte=function(e,r){return(r=j(this,new h(e,r)))===-1||r===0},g.isNaN=function(){return!this.s},g.isNegative=function(){return this.s<0},g.isPositive=function(){return this.s>0},g.isZero=function(){return!!this.c&&this.c[0]==0},g.minus=function(e,r){var i,s,t,l,c=this,n=c.s;if(e=new h(e,r),r=e.s,!n||!r)return new h(NaN);if(n!=r)return e.s=-r,c.plus(e);var f=c.e/E,u=e.e/E,o=c.c,a=e.c;if(!f||!u){if(!o||!a)return o?(e.s=-r,e):new h(a?c:NaN);if(!o[0]||!a[0])return a[0]?(e.s=-r,e):new h(o[0]?c:S==3?-0:0)}if(f=$(f),u=$(u),o=o.slice(),n=f-u){for((l=n<0)?(n=-n,t=o):(u=f,t=a),t.reverse(),r=n;r--;t.push(0));t.reverse()}else for(s=(l=(n=o.length)<(r=a.length))?n:r,n=r=0;r<s;r++)if(o[r]!=a[r]){l=o[r]<a[r];break}if(l&&(t=o,o=a,a=t,e.s=-e.s),r=(s=a.length)-(i=o.length),r>0)for(;r--;o[i++]=0);for(r=H-1;s>n;){if(o[--s]<a[s]){for(i=s;i&&!o[--i];o[i]=r);--o[i],o[s]+=H}o[s]-=a[s]}for(;o[0]==0;o.splice(0,1),--u);return o[0]?oe(e,o,u):(e.s=S==3?-1:1,e.c=[e.e=0],e)},g.modulo=g.mod=function(e,r){var i,s,t=this;return e=new h(e,r),!t.c||!e.s||e.c&&!e.c[0]?new h(NaN):!e.c||t.c&&!t.c[0]?new h(t):(b==9?(s=e.s,e.s=1,i=N(t,e,0,3),e.s=s,i.s*=s):i=N(t,e,0,b),e=t.minus(i.times(e)),!e.c[0]&&b==1&&(e.s=t.s),e)},g.multipliedBy=g.times=function(e,r){var i,s,t,l,c,n,f,u,o,a,p,w,d,B,R,m=this,A=m.c,P=(e=new h(e,r)).c;if(!A||!P||!A[0]||!P[0])return!m.s||!e.s||A&&!A[0]&&!P||P&&!P[0]&&!A?e.c=e.e=e.s=null:(e.s*=m.s,!A||!P?e.c=e.e=null:(e.c=[0],e.e=0)),e;for(s=$(m.e/E)+$(e.e/E),e.s*=m.s,f=A.length,a=P.length,f<a&&(d=A,A=P,P=d,t=f,f=a,a=t),t=f+a,d=[];t--;d.push(0));for(B=H,R=J,t=a;--t>=0;){for(i=0,p=P[t]%R,w=P[t]/R|0,c=f,l=t+c;l>t;)u=A[--c]%R,o=A[c]/R|0,n=w*u+o*p,u=p*u+n%R*R+d[l]+i,i=(u/B|0)+(n/R|0)+w*o,d[l--]=u%B;d[l]=i}return i?++s:d.splice(0,1),oe(e,d,s)},g.negated=function(){var e=new h(this);return e.s=-e.s||null,e},g.plus=function(e,r){var i,s=this,t=s.s;if(e=new h(e,r),r=e.s,!t||!r)return new h(NaN);if(t!=r)return e.s=-r,s.minus(e);var l=s.e/E,c=e.e/E,n=s.c,f=e.c;if(!l||!c){if(!n||!f)return new h(t/0);if(!n[0]||!f[0])return f[0]?e:new h(n[0]?s:t*0)}if(l=$(l),c=$(c),n=n.slice(),t=l-c){for(t>0?(c=l,i=f):(t=-t,i=n),i.reverse();t--;i.push(0));i.reverse()}for(t=n.length,r=f.length,t-r<0&&(i=f,f=n,n=i,r=t),t=0;r;)t=(n[--r]=n[r]+f[r]+t)/H|0,n[r]=H===n[r]?0:n[r]%H;return t&&(n=[t].concat(n),++c),oe(e,n,c)},g.precision=g.sd=function(e,r){var i,s,t,l=this;if(e!=null&&e!==!!e)return x(e,1,k),r==null?r=S:x(r,0,8),G(new h(l),e,r);if(!(i=l.c))return null;if(t=i.length-1,s=t*E+1,t=i[t]){for(;t%10==0;t/=10,s--);for(t=i[0];t>=10;t/=10,s++);}return e&&l.e+1>s&&(s=l.e+1),s},g.shiftedBy=function(e){return x(e,-9007199254740991,pe),this.times("1e"+e)},g.squareRoot=g.sqrt=function(){var e,r,i,s,t,l=this,c=l.c,n=l.s,f=l.e,u=_+4,o=new h("0.5");if(n!==1||!c||!c[0])return new h(!n||n<0&&(!c||c[0])?NaN:c?l:1/0);if(n=Math.sqrt(+V(l)),n==0||n==1/0?(r=q(c),(r.length+f)%2==0&&(r+="0"),n=Math.sqrt(+r),f=$((f+1)/2)-(f<0||f%2),n==1/0?r="5e"+f:(r=n.toExponential(),r=r.slice(0,r.indexOf("e")+1)+f),i=new h(r)):i=new h(n+""),i.c[0]){for(f=i.e,n=f+u,n<3&&(n=0);;)if(t=i,i=o.times(t.plus(N(l,t,u,1))),q(t.c).slice(0,n)===(r=q(i.c)).slice(0,n))if(i.e<f&&--n,r=r.slice(n-3,n+1),r=="9999"||!s&&r=="4999"){if(!s&&(G(t,t.e+_+2,0),t.times(t).eq(l))){i=t;break}u+=4,n+=4,s=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(G(i,i.e+_+2,1),e=!i.times(i).eq(l));break}}return G(i,i.e+_+1,S,e)},g.toExponential=function(e,r){return e!=null&&(x(e,0,k),e++),le(this,e,r,1)},g.toFixed=function(e,r){return e!=null&&(x(e,0,k),e=e+this.e+1),le(this,e,r)},g.toFormat=function(e,r,i){var s,t=this;if(i==null)e!=null&&r&&typeof r=="object"?(i=r,r=null):e&&typeof e=="object"?(i=e,e=r=null):i=te;else if(typeof i!="object")throw Error(C+"Argument not an object: "+i);if(s=t.toFixed(e,r),t.c){var l,c=s.split("."),n=+i.groupSize,f=+i.secondaryGroupSize,u=i.groupSeparator||"",o=c[0],a=c[1],p=t.s<0,w=p?o.slice(1):o,d=w.length;if(f&&(l=n,n=f,f=l,d-=l),n>0&&d>0){for(l=d%n||n,o=w.substr(0,l);l<d;l+=n)o+=u+w.substr(l,n);f>0&&(o+=u+w.slice(l)),p&&(o="-"+o)}s=a?o+(i.decimalSeparator||"")+((f=+i.fractionGroupSize)?a.replace(new RegExp("\\d{"+f+"}\\B","g"),"$&"+(i.fractionGroupSeparator||"")):a):o}return(i.prefix||"")+s+(i.suffix||"")},g.toFraction=function(e){var r,i,s,t,l,c,n,f,u,o,a,p,w=this,d=w.c;if(e!=null&&(n=new h(e),!n.isInteger()&&(n.c||n.s!==1)||n.lt(I)))throw Error(C+"Argument "+(n.isInteger()?"out of range: ":"not an integer: ")+V(n));if(!d)return new h(w);for(r=new h(I),u=i=new h(I),s=f=new h(I),p=q(d),l=r.e=p.length-w.e-1,r.c[0]=ae[(c=l%E)<0?E+c:c],e=!e||n.comparedTo(r)>0?l>0?r:u:n,c=z,z=1/0,n=new h(p),f.c[0]=0;o=N(n,r,0,1),t=i.plus(o.times(s)),t.comparedTo(e)!=1;)i=s,s=t,u=f.plus(o.times(t=u)),f=t,r=n.minus(o.times(t=r)),n=t;return t=N(e.minus(i),s,0,1),f=f.plus(t.times(u)),i=i.plus(t.times(s)),f.s=u.s=w.s,l=l*2,a=N(u,s,l,S).minus(w).abs().comparedTo(N(f,i,l,S).minus(w).abs())<1?[u,s]:[f,i],z=c,a},g.toNumber=function(){return+V(this)},g.toPrecision=function(e,r){return e!=null&&x(e,1,k),le(this,e,r,2)},g.toString=function(e){var r,i=this,s=i.s,t=i.e;return t===null?s?(r="Infinity",s<0&&(r="-"+r)):r="NaN":(e==null?r=t<=L||t>=U?ne(q(i.c),t):W(q(i.c),t,"0"):e===10&&fe?(i=G(new h(i),_+t+1,S),r=W(q(i.c),i.e,"0")):(x(e,2,K.length,"Base"),r=v(W(q(i.c),t,"0"),10,e,s,!0)),s<0&&i.c[0]&&(r="-"+r)),r},g.valueOf=g.toJSON=function(){return V(this)},g._isBigNumber=!0,g[Symbol.toStringTag]="BigNumber",g[Symbol.for("nodejs.util.inspect.custom")]=g.valueOf,O!=null&&h.set(O),h}function $(O){var N=O|0;return O>0||O===N?N:N-1}function q(O){for(var N,v,T=1,g=O.length,I=O[0]+"";T<g;){for(N=O[T++]+"",v=E-N.length;v--;N="0"+N);I+=N}for(g=I.length;I.charCodeAt(--g)===48;);return I.slice(0,g+1||1)}function j(O,N){var v,T,g=O.c,I=N.c,_=O.s,S=N.s,L=O.e,U=N.e;if(!_||!S)return null;if(v=g&&!g[0],T=I&&!I[0],v||T)return v?T?0:-S:_;if(_!=S)return _;if(v=_<0,T=L==U,!g||!I)return T?0:!g^v?1:-1;if(!T)return L>U^v?1:-1;for(S=(L=g.length)<(U=I.length)?L:U,_=0;_<S;_++)if(g[_]!=I[_])return g[_]>I[_]^v?1:-1;return L==U?0:L>U^v?1:-1}function x(O,N,v,T){if(O<N||O>v||O!==y(O))throw Error(C+(T||"Argument")+(typeof O=="number"?O<N||O>v?" out of range: ":" not an integer: ":" not a primitive number: ")+String(O))}function ie(O){var N=O.c.length-1;return $(O.e/E)==N&&O.c[N]%2!=0}function ne(O,N){return(O.length>1?O.charAt(0)+"."+O.slice(1):O)+(N<0?"e":"e+")+N}function W(O,N,v){var T,g;if(N<0){for(g=v+".";++N;g+=v);O=g+O}else if(T=O.length,++N>T){for(g=v,N-=T;--N;g+=v);O+=g}else N<T&&(O=O.slice(0,N)+"."+O.slice(N));return O}var Ne=we();exports.BigNumber=Ne;exports.default=Ne;
@@ -1,6 +1,6 @@
1
- var Ee = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, ce = Math.ceil, y = Math.floor, U = "[BigNumber Error] ", pe = U + "Number primitive has more than 15 significant digits: ", H = 1e14, N = 14, ae = 9007199254740991, he = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], J = 1e7, D = 1e9;
1
+ var Ee = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, ce = Math.ceil, y = Math.floor, C = "[BigNumber Error] ", ge = C + "Number primitive has more than 15 significant digits: ", H = 1e14, N = 14, pe = 9007199254740991, ae = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], J = 1e7, k = 1e9;
2
2
  function we(O) {
3
- var E, _, R, g = h.prototype = { constructor: h, toString: null, valueOf: null }, T = new h(1), x = 20, S = 4, C = -7, k = 21, Q = -1e7, z = 1e7, Z = !1, b = 1, Y = 0, te = {
3
+ var E, _, R, g = h.prototype = { constructor: h, toString: null, valueOf: null }, T = new h(1), x = 20, S = 4, L = -7, U = 21, Q = -1e7, z = 1e7, Z = !1, b = 1, Y = 0, te = {
4
4
  prefix: "",
5
5
  groupSize: 3,
6
6
  secondaryGroupSize: 0,
@@ -37,7 +37,7 @@ function we(O) {
37
37
  if (u = String(e), n = typeof e == "number") {
38
38
  if (e * 0 != 0) return R(o, u, n, r);
39
39
  if (o.s = 1 / e < 0 ? (u = u.slice(1), -1) : 1, h.DEBUG && u.replace(/^0\.0*|\./, "").length > 15)
40
- throw Error(pe + e);
40
+ throw Error(ge + e);
41
41
  } else
42
42
  o.s = u.charCodeAt(0) === 45 ? (u = u.slice(1), -1) : 1;
43
43
  for (i = K.slice(0, r), l = c = 0, f = u.length; c < f; c++)
@@ -58,8 +58,8 @@ function we(O) {
58
58
  for (c = 0; u.charCodeAt(c) === 48; c++) ;
59
59
  for (f = u.length; u.charCodeAt(--f) === 48; ) ;
60
60
  if (u = u.slice(c, ++f)) {
61
- if (f -= c, n && h.DEBUG && f > 15 && (e > ae || e !== y(e)))
62
- throw Error(pe + o.s * e);
61
+ if (f -= c, n && h.DEBUG && f > 15 && (e > pe || e !== y(e)))
62
+ throw Error(ge + o.s * e);
63
63
  if ((l = l - c - 1) > z)
64
64
  o.c = o.e = null;
65
65
  else if (l < Q)
@@ -81,38 +81,38 @@ function we(O) {
81
81
  var r, i;
82
82
  if (e != null)
83
83
  if (typeof e == "object") {
84
- if (e.hasOwnProperty(r = "DECIMAL_PLACES") && (i = e[r], v(i, 0, D, r), x = i), e.hasOwnProperty(r = "ROUNDING_MODE") && (i = e[r], v(i, 0, 8, r), S = i), e.hasOwnProperty(r = "EXPONENTIAL_AT") && (i = e[r], i && i.pop ? (v(i[0], -D, 0, r), v(i[1], 0, D, r), C = i[0], k = i[1]) : (v(i, -D, D, r), C = -(k = i < 0 ? -i : i))), e.hasOwnProperty(r = "RANGE"))
84
+ if (e.hasOwnProperty(r = "DECIMAL_PLACES") && (i = e[r], v(i, 0, k, r), x = i), e.hasOwnProperty(r = "ROUNDING_MODE") && (i = e[r], v(i, 0, 8, r), S = i), e.hasOwnProperty(r = "EXPONENTIAL_AT") && (i = e[r], i && i.pop ? (v(i[0], -1e9, 0, r), v(i[1], 0, k, r), L = i[0], U = i[1]) : (v(i, -1e9, k, r), L = -(U = i < 0 ? -i : i))), e.hasOwnProperty(r = "RANGE"))
85
85
  if (i = e[r], i && i.pop)
86
- v(i[0], -D, -1, r), v(i[1], 1, D, r), Q = i[0], z = i[1];
87
- else if (v(i, -D, D, r), i)
86
+ v(i[0], -1e9, -1, r), v(i[1], 1, k, r), Q = i[0], z = i[1];
87
+ else if (v(i, -1e9, k, r), i)
88
88
  Q = -(z = i < 0 ? -i : i);
89
89
  else
90
- throw Error(U + r + " cannot be zero: " + i);
90
+ throw Error(C + r + " cannot be zero: " + i);
91
91
  if (e.hasOwnProperty(r = "CRYPTO"))
92
92
  if (i = e[r], i === !!i)
93
93
  if (i)
94
94
  if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
95
95
  Z = i;
96
96
  else
97
- throw Z = !i, Error(U + "crypto unavailable");
97
+ throw Z = !i, Error(C + "crypto unavailable");
98
98
  else
99
99
  Z = i;
100
100
  else
101
- throw Error(U + r + " not true or false: " + i);
102
- if (e.hasOwnProperty(r = "MODULO_MODE") && (i = e[r], v(i, 0, 9, r), b = i), e.hasOwnProperty(r = "POW_PRECISION") && (i = e[r], v(i, 0, D, r), Y = i), e.hasOwnProperty(r = "FORMAT"))
101
+ throw Error(C + r + " not true or false: " + i);
102
+ if (e.hasOwnProperty(r = "MODULO_MODE") && (i = e[r], v(i, 0, 9, r), b = i), e.hasOwnProperty(r = "POW_PRECISION") && (i = e[r], v(i, 0, k, r), Y = i), e.hasOwnProperty(r = "FORMAT"))
103
103
  if (i = e[r], typeof i == "object") te = i;
104
- else throw Error(U + r + " not an object: " + i);
104
+ else throw Error(C + r + " not an object: " + i);
105
105
  if (e.hasOwnProperty(r = "ALPHABET"))
106
106
  if (i = e[r], typeof i == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(i))
107
107
  fe = i.slice(0, 10) == "0123456789", K = i;
108
108
  else
109
- throw Error(U + r + " invalid: " + i);
109
+ throw Error(C + r + " invalid: " + i);
110
110
  } else
111
- throw Error(U + "Object expected: " + e);
111
+ throw Error(C + "Object expected: " + e);
112
112
  return {
113
113
  DECIMAL_PLACES: x,
114
114
  ROUNDING_MODE: S,
115
- EXPONENTIAL_AT: [C, k],
115
+ EXPONENTIAL_AT: [L, U],
116
116
  RANGE: [Q, z],
117
117
  CRYPTO: Z,
118
118
  MODULO_MODE: b,
@@ -125,7 +125,7 @@ function we(O) {
125
125
  if (!h.DEBUG) return !0;
126
126
  var r, i, s = e.c, t = e.e, l = e.s;
127
127
  e: if ({}.toString.call(s) == "[object Array]") {
128
- if ((l === 1 || l === -1) && t >= -D && t <= D && t === y(t)) {
128
+ if ((l === 1 || l === -1) && t >= -1e9 && t <= k && t === y(t)) {
129
129
  if (s[0] === 0) {
130
130
  if (t === 0 && s.length === 1) return !0;
131
131
  break e;
@@ -138,11 +138,11 @@ function we(O) {
138
138
  }
139
139
  } else if (s === null && t === null && (l === null || l === 1 || l === -1))
140
140
  return !0;
141
- throw Error(U + "Invalid BigNumber: " + e);
141
+ throw Error(C + "Invalid BigNumber: " + e);
142
142
  }, h.maximum = h.max = function() {
143
- return ge(arguments, -1);
143
+ return he(arguments, -1);
144
144
  }, h.minimum = h.min = function() {
145
- return ge(arguments, 1);
145
+ return he(arguments, 1);
146
146
  }, h.random = function() {
147
147
  var e = 9007199254740992, r = Math.random() * e & 2097151 ? function() {
148
148
  return y(Math.random() * e);
@@ -151,7 +151,7 @@ function we(O) {
151
151
  };
152
152
  return function(i) {
153
153
  var s, t, l, c, n, f = 0, u = [], o = new h(T);
154
- if (i == null ? i = x : v(i, 0, D), c = ce(i / N), Z)
154
+ if (i == null ? i = x : v(i, 0, k), c = ce(i / N), Z)
155
155
  if (crypto.getRandomValues) {
156
156
  for (s = crypto.getRandomValues(new Uint32Array(c *= 2)); f < c; )
157
157
  n = s[f] * 131072 + (s[f + 1] >>> 11), n >= 9e15 ? (t = crypto.getRandomValues(new Uint32Array(2)), s[f] = t[0], s[f + 1] = t[1]) : (u.push(n % 1e14), f += 2);
@@ -161,11 +161,11 @@ function we(O) {
161
161
  n = (s[f] & 31) * 281474976710656 + s[f + 1] * 1099511627776 + s[f + 2] * 4294967296 + s[f + 3] * 16777216 + (s[f + 4] << 16) + (s[f + 5] << 8) + s[f + 6], n >= 9e15 ? crypto.randomBytes(7).copy(s, f) : (u.push(n % 1e14), f += 7);
162
162
  f = c / 7;
163
163
  } else
164
- throw Z = !1, Error(U + "crypto unavailable");
164
+ throw Z = !1, Error(C + "crypto unavailable");
165
165
  if (!Z)
166
166
  for (; f < c; )
167
167
  n = r(), n < 9e15 && (u[f++] = n % 1e14);
168
- for (c = u[--f], i %= N, c && i && (n = he[N - i], u[f] = y(c / n) * n); u[f] === 0; u.pop(), f--) ;
168
+ for (c = u[--f], i %= N, c && i && (n = ae[N - i], u[f] = y(c / n) * n); u[f] === 0; u.pop(), f--) ;
169
169
  if (f < 0)
170
170
  u = [l = 0];
171
171
  else {
@@ -234,24 +234,24 @@ function we(O) {
234
234
  for (; !s[0] && s.length > 1; s.splice(0, 1)) ;
235
235
  }
236
236
  return function(s, t, l, c, n) {
237
- var f, u, o, a, p, w, A, B, M, m, d, P, re, se, ue, X, ee, F = s.s == t.s ? 1 : -1, L = s.c, I = t.c;
238
- if (!L || !L[0] || !I || !I[0])
237
+ var f, u, o, a, p, w, A, B, M, m, d, D, re, se, ue, X, ee, F = s.s == t.s ? 1 : -1, P = s.c, I = t.c;
238
+ if (!P || !P[0] || !I || !I[0])
239
239
  return new h(
240
240
  // Return NaN if either NaN, or both Infinity or 0.
241
- !s.s || !t.s || (L ? I && L[0] == I[0] : !I) ? NaN : (
241
+ !s.s || !t.s || (P ? I && P[0] == I[0] : !I) ? NaN : (
242
242
  // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
243
- L && L[0] == 0 || !I ? F * 0 : F / 0
243
+ P && P[0] == 0 || !I ? F * 0 : F / 0
244
244
  )
245
245
  );
246
- for (B = new h(F), M = B.c = [], u = s.e - t.e, F = l + u + 1, n || (n = H, u = $(s.e / N) - $(t.e / N), F = F / N | 0), o = 0; I[o] == (L[o] || 0); o++) ;
247
- if (I[o] > (L[o] || 0) && u--, F < 0)
246
+ for (B = new h(F), M = B.c = [], u = s.e - t.e, F = l + u + 1, n || (n = H, u = $(s.e / N) - $(t.e / N), F = F / N | 0), o = 0; I[o] == (P[o] || 0); o++) ;
247
+ if (I[o] > (P[o] || 0) && u--, F < 0)
248
248
  M.push(1), a = !0;
249
249
  else {
250
- for (se = L.length, X = I.length, o = 0, F += 2, p = y(n / (I[0] + 1)), p > 1 && (I = e(I, p, n), L = e(L, p, n), X = I.length, se = L.length), re = X, m = L.slice(0, X), d = m.length; d < X; m[d++] = 0) ;
250
+ for (se = P.length, X = I.length, o = 0, F += 2, p = y(n / (I[0] + 1)), p > 1 && (I = e(I, p, n), P = e(P, p, n), X = I.length, se = P.length), re = X, m = P.slice(0, X), d = m.length; d < X; m[d++] = 0) ;
251
251
  ee = I.slice(), ee = [0].concat(ee), ue = I[0], I[1] >= n / 2 && ue++;
252
252
  do {
253
253
  if (p = 0, f = r(I, m, X, d), f < 0) {
254
- if (P = m[0], X != d && (P = P * n + (m[1] || 0)), p = y(P / ue), p > 1)
254
+ if (D = m[0], X != d && (D = D * n + (m[1] || 0)), p = y(D / ue), p > 1)
255
255
  for (p >= n && (p = n - 1), w = e(I, p, n), A = w.length, d = m.length; r(w, m, A, d) == 1; )
256
256
  p--, i(w, X < A ? ee : I, A, n), A = w.length, f = 1;
257
257
  else
@@ -260,7 +260,7 @@ function we(O) {
260
260
  for (; r(I, m, X, d) < 1; )
261
261
  p++, i(m, X < d ? ee : I, d, n), d = m.length;
262
262
  } else f === 0 && (p++, m = [0]);
263
- M[o++] = p, m[0] ? m[d++] = L[re] || 0 : (m = [L[re]], d = 1);
263
+ M[o++] = p, m[0] ? m[d++] = P[re] || 0 : (m = [P[re]], d = 1);
264
264
  } while ((re++ < se || m[0] != null) && F--);
265
265
  a = m[0] != null, M[0] || M.splice(0, 1);
266
266
  }
@@ -276,8 +276,8 @@ function we(O) {
276
276
  var t, l, c, n, f;
277
277
  if (i == null ? i = S : v(i, 0, 8), !e.c) return e.toString();
278
278
  if (t = e.c[0], c = e.e, r == null)
279
- f = q(e.c), f = s == 1 || s == 2 && (c <= C || c >= k) ? ne(f, c) : W(f, c, "0");
280
- else if (e = G(new h(e), r, i), l = e.e, f = q(e.c), n = f.length, s == 1 || s == 2 && (r <= l || l <= C)) {
279
+ f = q(e.c), f = s == 1 || s == 2 && (c <= L || c >= U) ? ne(f, c) : W(f, c, "0");
280
+ else if (e = G(new h(e), r, i), l = e.e, f = q(e.c), n = f.length, s == 1 || s == 2 && (r <= l || l <= L)) {
281
281
  for (; n < r; f += "0", n++) ;
282
282
  f = ne(f, l);
283
283
  } else if (r -= c, f = W(f, l, "0"), l + 1 > n) {
@@ -286,7 +286,7 @@ function we(O) {
286
286
  for (l + 1 == n && (f += "."); r--; f += "0") ;
287
287
  return e.s < 0 && t ? "-" + f : f;
288
288
  }
289
- function ge(e, r) {
289
+ function he(e, r) {
290
290
  for (var i, s, t = 1, l = new h(e[0]); t < e.length; t++)
291
291
  s = new h(e[t]), (!s.s || (i = j(l, s)) === r || i === 0 && l.s === r) && (l = s);
292
292
  return l;
@@ -308,14 +308,14 @@ function we(O) {
308
308
  }), f && (u = f, o = o.replace(r, "$1").replace(i, "0.$1")), c != o))
309
309
  return new h(o, u);
310
310
  if (h.DEBUG)
311
- throw Error(U + "Not a" + (f ? " base " + f : "") + " number: " + c);
311
+ throw Error(C + "Not a" + (f ? " base " + f : "") + " number: " + c);
312
312
  l.s = null;
313
313
  }
314
314
  l.c = l.e = null;
315
315
  };
316
316
  }();
317
317
  function G(e, r, i, s) {
318
- var t, l, c, n, f, u, o, a = e.c, p = he;
318
+ var t, l, c, n, f, u, o, a = e.c, p = ae;
319
319
  if (a) {
320
320
  e: {
321
321
  for (t = 1, n = a[0]; n >= 10; n /= 10, t++) ;
@@ -356,7 +356,7 @@ function we(O) {
356
356
  }
357
357
  function V(e) {
358
358
  var r, i = e.e;
359
- return i === null ? e.toString() : (r = q(e.c), r = i <= C || i >= k ? ne(r, i) : W(r, i, "0"), e.s < 0 ? "-" + r : r);
359
+ return i === null ? e.toString() : (r = q(e.c), r = i <= L || i >= U ? ne(r, i) : W(r, i, "0"), e.s < 0 ? "-" + r : r);
360
360
  }
361
361
  return g.absoluteValue = g.abs = function() {
362
362
  var e = new h(this);
@@ -366,7 +366,7 @@ function we(O) {
366
366
  }, g.decimalPlaces = g.dp = function(e, r) {
367
367
  var i, s, t, l = this;
368
368
  if (e != null)
369
- return v(e, 0, D), r == null ? r = S : v(r, 0, 8), G(new h(l), e + l.e + 1, r);
369
+ return v(e, 0, k), r == null ? r = S : v(r, 0, 8), G(new h(l), e + l.e + 1, r);
370
370
  if (!(i = l.c)) return null;
371
371
  if (s = ((t = i.length - 1) - $(this.e / N)) * N, t = i[t]) for (; t % 10 == 0; t /= 10, s--) ;
372
372
  return s < 0 && (s = 0), s;
@@ -377,7 +377,7 @@ function we(O) {
377
377
  }, g.exponentiatedBy = g.pow = function(e, r) {
378
378
  var i, s, t, l, c, n, f, u, o, a = this;
379
379
  if (e = new h(e), e.c && !e.isInteger())
380
- throw Error(U + "Exponent not an integer: " + V(e));
380
+ throw Error(C + "Exponent not an integer: " + V(e));
381
381
  if (r != null && (r = new h(r)), n = e.e > 14, !a.c || !a.c[0] || a.c[0] == 1 && !a.e && a.c.length == 1 || !e.c || !e.c[0])
382
382
  return o = new h(Math.pow(+V(a), n ? e.s * (2 - ie(e)) : +V(e))), r ? o.mod(r) : o;
383
383
  if (f = e.s < 0, r) {
@@ -467,12 +467,12 @@ function we(O) {
467
467
  var i, s, t = this;
468
468
  return e = new h(e, r), !t.c || !e.s || e.c && !e.c[0] ? new h(NaN) : !e.c || t.c && !t.c[0] ? new h(t) : (b == 9 ? (s = e.s, e.s = 1, i = E(t, e, 0, 3), e.s = s, i.s *= s) : i = E(t, e, 0, b), e = t.minus(i.times(e)), !e.c[0] && b == 1 && (e.s = t.s), e);
469
469
  }, g.multipliedBy = g.times = function(e, r) {
470
- var i, s, t, l, c, n, f, u, o, a, p, w, A, B, M, m = this, d = m.c, P = (e = new h(e, r)).c;
471
- if (!d || !P || !d[0] || !P[0])
472
- return !m.s || !e.s || d && !d[0] && !P || P && !P[0] && !d ? e.c = e.e = e.s = null : (e.s *= m.s, !d || !P ? e.c = e.e = null : (e.c = [0], e.e = 0)), e;
473
- for (s = $(m.e / N) + $(e.e / N), e.s *= m.s, f = d.length, a = P.length, f < a && (A = d, d = P, P = A, t = f, f = a, a = t), t = f + a, A = []; t--; A.push(0)) ;
470
+ var i, s, t, l, c, n, f, u, o, a, p, w, A, B, M, m = this, d = m.c, D = (e = new h(e, r)).c;
471
+ if (!d || !D || !d[0] || !D[0])
472
+ return !m.s || !e.s || d && !d[0] && !D || D && !D[0] && !d ? e.c = e.e = e.s = null : (e.s *= m.s, !d || !D ? e.c = e.e = null : (e.c = [0], e.e = 0)), e;
473
+ for (s = $(m.e / N) + $(e.e / N), e.s *= m.s, f = d.length, a = D.length, f < a && (A = d, d = D, D = A, t = f, f = a, a = t), t = f + a, A = []; t--; A.push(0)) ;
474
474
  for (B = H, M = J, t = a; --t >= 0; ) {
475
- for (i = 0, p = P[t] % M, w = P[t] / M | 0, c = f, l = t + c; l > t; )
475
+ for (i = 0, p = D[t] % M, w = D[t] / M | 0, c = f, l = t + c; l > t; )
476
476
  u = d[--c] % M, o = d[c] / M | 0, n = w * u + o * p, u = p * u + n % M * M + A[l] + i, i = (u / B | 0) + (n / M | 0) + w * o, A[l--] = u % B;
477
477
  A[l] = i;
478
478
  }
@@ -500,7 +500,7 @@ function we(O) {
500
500
  }, g.precision = g.sd = function(e, r) {
501
501
  var i, s, t, l = this;
502
502
  if (e != null && e !== !!e)
503
- return v(e, 1, D), r == null ? r = S : v(r, 0, 8), G(new h(l), e, r);
503
+ return v(e, 1, k), r == null ? r = S : v(r, 0, 8), G(new h(l), e, r);
504
504
  if (!(i = l.c)) return null;
505
505
  if (t = i.length - 1, s = t * N + 1, t = i[t]) {
506
506
  for (; t % 10 == 0; t /= 10, s--) ;
@@ -508,7 +508,7 @@ function we(O) {
508
508
  }
509
509
  return e && l.e + 1 > s && (s = l.e + 1), s;
510
510
  }, g.shiftedBy = function(e) {
511
- return v(e, -ae, ae), this.times("1e" + e);
511
+ return v(e, -9007199254740991, pe), this.times("1e" + e);
512
512
  }, g.squareRoot = g.sqrt = function() {
513
513
  var e, r, i, s, t, l = this, c = l.c, n = l.s, f = l.e, u = x + 4, o = new h("0.5");
514
514
  if (n !== 1 || !c || !c[0])
@@ -529,15 +529,15 @@ function we(O) {
529
529
  }
530
530
  return G(i, i.e + x + 1, S, e);
531
531
  }, g.toExponential = function(e, r) {
532
- return e != null && (v(e, 0, D), e++), le(this, e, r, 1);
532
+ return e != null && (v(e, 0, k), e++), le(this, e, r, 1);
533
533
  }, g.toFixed = function(e, r) {
534
- return e != null && (v(e, 0, D), e = e + this.e + 1), le(this, e, r);
534
+ return e != null && (v(e, 0, k), e = e + this.e + 1), le(this, e, r);
535
535
  }, g.toFormat = function(e, r, i) {
536
536
  var s, t = this;
537
537
  if (i == null)
538
538
  e != null && r && typeof r == "object" ? (i = r, r = null) : e && typeof e == "object" ? (i = e, e = r = null) : i = te;
539
539
  else if (typeof i != "object")
540
- throw Error(U + "Argument not an object: " + i);
540
+ throw Error(C + "Argument not an object: " + i);
541
541
  if (s = t.toFixed(e, r), t.c) {
542
542
  var l, c = s.split("."), n = +i.groupSize, f = +i.secondaryGroupSize, u = i.groupSeparator || "", o = c[0], a = c[1], p = t.s < 0, w = p ? o.slice(1) : o, A = w.length;
543
543
  if (f && (l = n, n = f, f = l, A -= l), n > 0 && A > 0) {
@@ -553,9 +553,9 @@ function we(O) {
553
553
  }, g.toFraction = function(e) {
554
554
  var r, i, s, t, l, c, n, f, u, o, a, p, w = this, A = w.c;
555
555
  if (e != null && (n = new h(e), !n.isInteger() && (n.c || n.s !== 1) || n.lt(T)))
556
- throw Error(U + "Argument " + (n.isInteger() ? "out of range: " : "not an integer: ") + V(n));
556
+ throw Error(C + "Argument " + (n.isInteger() ? "out of range: " : "not an integer: ") + V(n));
557
557
  if (!A) return new h(w);
558
- for (r = new h(T), u = i = new h(T), s = f = new h(T), p = q(A), l = r.e = p.length - w.e - 1, r.c[0] = he[(c = l % N) < 0 ? N + c : c], e = !e || n.comparedTo(r) > 0 ? l > 0 ? r : u : n, c = z, z = 1 / 0, n = new h(p), f.c[0] = 0; o = E(n, r, 0, 1), t = i.plus(o.times(s)), t.comparedTo(e) != 1; )
558
+ for (r = new h(T), u = i = new h(T), s = f = new h(T), p = q(A), l = r.e = p.length - w.e - 1, r.c[0] = ae[(c = l % N) < 0 ? N + c : c], e = !e || n.comparedTo(r) > 0 ? l > 0 ? r : u : n, c = z, z = 1 / 0, n = new h(p), f.c[0] = 0; o = E(n, r, 0, 1), t = i.plus(o.times(s)), t.comparedTo(e) != 1; )
559
559
  i = s, s = t, u = f.plus(o.times(t = u)), f = t, r = n.minus(o.times(t = r)), n = t;
560
560
  return t = E(e.minus(i), s, 0, 1), f = f.plus(t.times(u)), i = i.plus(t.times(s)), f.s = u.s = w.s, l = l * 2, a = E(u, s, l, S).minus(w).abs().comparedTo(
561
561
  E(f, i, l, S).minus(w).abs()
@@ -563,10 +563,10 @@ function we(O) {
563
563
  }, g.toNumber = function() {
564
564
  return +V(this);
565
565
  }, g.toPrecision = function(e, r) {
566
- return e != null && v(e, 1, D), le(this, e, r, 2);
566
+ return e != null && v(e, 1, k), le(this, e, r, 2);
567
567
  }, g.toString = function(e) {
568
568
  var r, i = this, s = i.s, t = i.e;
569
- return t === null ? s ? (r = "Infinity", s < 0 && (r = "-" + r)) : r = "NaN" : (e == null ? r = t <= C || t >= k ? ne(q(i.c), t) : W(q(i.c), t, "0") : e === 10 && fe ? (i = G(new h(i), x + t + 1, S), r = W(q(i.c), i.e, "0")) : (v(e, 2, K.length, "Base"), r = _(W(q(i.c), t, "0"), 10, e, s, !0)), s < 0 && i.c[0] && (r = "-" + r)), r;
569
+ return t === null ? s ? (r = "Infinity", s < 0 && (r = "-" + r)) : r = "NaN" : (e == null ? r = t <= L || t >= U ? ne(q(i.c), t) : W(q(i.c), t, "0") : e === 10 && fe ? (i = G(new h(i), x + t + 1, S), r = W(q(i.c), i.e, "0")) : (v(e, 2, K.length, "Base"), r = _(W(q(i.c), t, "0"), 10, e, s, !0)), s < 0 && i.c[0] && (r = "-" + r)), r;
570
570
  }, g.valueOf = g.toJSON = function() {
571
571
  return V(this);
572
572
  }, g._isBigNumber = !0, g[Symbol.toStringTag] = "BigNumber", g[Symbol.for("nodejs.util.inspect.custom")] = g.valueOf, O != null && h.set(O), h;
@@ -584,18 +584,18 @@ function q(O) {
584
584
  return T.slice(0, g + 1 || 1);
585
585
  }
586
586
  function j(O, E) {
587
- var _, R, g = O.c, T = E.c, x = O.s, S = E.s, C = O.e, k = E.e;
587
+ var _, R, g = O.c, T = E.c, x = O.s, S = E.s, L = O.e, U = E.e;
588
588
  if (!x || !S) return null;
589
589
  if (_ = g && !g[0], R = T && !T[0], _ || R) return _ ? R ? 0 : -S : x;
590
590
  if (x != S) return x;
591
- if (_ = x < 0, R = C == k, !g || !T) return R ? 0 : !g ^ _ ? 1 : -1;
592
- if (!R) return C > k ^ _ ? 1 : -1;
593
- for (S = (C = g.length) < (k = T.length) ? C : k, x = 0; x < S; x++) if (g[x] != T[x]) return g[x] > T[x] ^ _ ? 1 : -1;
594
- return C == k ? 0 : C > k ^ _ ? 1 : -1;
591
+ if (_ = x < 0, R = L == U, !g || !T) return R ? 0 : !g ^ _ ? 1 : -1;
592
+ if (!R) return L > U ^ _ ? 1 : -1;
593
+ for (S = (L = g.length) < (U = T.length) ? L : U, x = 0; x < S; x++) if (g[x] != T[x]) return g[x] > T[x] ^ _ ? 1 : -1;
594
+ return L == U ? 0 : L > U ^ _ ? 1 : -1;
595
595
  }
596
596
  function v(O, E, _, R) {
597
597
  if (O < E || O > _ || O !== y(O))
598
- throw Error(U + (R || "Argument") + (typeof O == "number" ? O < E || O > _ ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(O));
598
+ throw Error(C + (R || "Argument") + (typeof O == "number" ? O < E || O > _ ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(O));
599
599
  }
600
600
  function ie(O) {
601
601
  var E = O.c.length - 1;
@@ -1,10 +1,10 @@
1
1
  import { keccak_256 as P } from "../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.js";
2
2
  import { sha256 as B } from "../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha256.js";
3
3
  import { utf8ToBytes as S } from "../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/utils.js";
4
- import { mod as h, Field as l, validateField as b } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.js";
4
+ import { Field as l, mod as h, validateField as b } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.js";
5
5
  import { poseidon as R } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/poseidon.js";
6
6
  import { weierstrass as N } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.js";
7
- import { bytesToNumberBE as c, ensureBytes as x, hexToBytes as F, bytesToHex as v, bitMask as T } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/utils.js";
7
+ import { bytesToNumberBE as c, bytesToHex as x, bitMask as F, ensureBytes as v, hexToBytes as T } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/utils.js";
8
8
  import { getHash as _ } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/_shortw_utils.js";
9
9
  const d = BigInt("3618502788666131213697322783095070105526743751716087489154079457884512865583"), w = 252;
10
10
  function m(n) {
@@ -14,7 +14,7 @@ function m(n) {
14
14
  return e > 0 ? t >> BigInt(e) : t;
15
15
  }
16
16
  function I(n) {
17
- return typeof n == "string" && (n = k(n), n.length & 1 && (n = "0" + n)), F(n);
17
+ return typeof n == "string" && (n = k(n), n.length & 1 && (n = "0" + n)), T(n);
18
18
  }
19
19
  const E = N({
20
20
  a: BigInt(1),
@@ -34,11 +34,11 @@ const E = N({
34
34
  }
35
35
  });
36
36
  function $(n) {
37
- return x("", typeof n == "string" ? I(n) : n);
37
+ return v("", typeof n == "string" ? I(n) : n);
38
38
  }
39
39
  const { ProjectivePoint: s } = E;
40
40
  function D(n) {
41
- return `0x${v(n.subarray(1)).replace(/^0+/gm, "")}`;
41
+ return `0x${x(n.subarray(1)).replace(/^0+/gm, "")}`;
42
42
  }
43
43
  function k(n) {
44
44
  return n.replace(/^0x/i, "");
@@ -89,7 +89,7 @@ function Q(n, e) {
89
89
  let t = u[0];
90
90
  return t = g(t, n, A), t = g(t, e, C), D(t.toRawBytes(!0));
91
91
  }
92
- const M = T(250), Y = (n) => c(P(n)) & M;
92
+ const M = F(250), Y = (n) => c(P(n)) & M;
93
93
  l(BigInt("14474011154664525231415395255581126252639794253786371766033694892385558855681"));
94
94
  const j = l(BigInt("3618502788666131213697322783095070105623107215331596699973092056135872020481"));
95
95
  function H(n, e, t) {
@@ -1,5 +1,5 @@
1
1
  import { memoize as m } from "lodash-es";
2
- import { validateChecksumAddress as h, validateAndParseAddress as l, getChecksumAddress as x, num as L, constants as w } from "starknet";
2
+ import { getChecksumAddress as x, validateChecksumAddress as h, validateAndParseAddress as l, num as L, constants as w } from "starknet";
3
3
  import { z as a } from "zod";
4
4
  import { decodeBase58 as $ } from "../../utils/base58.js";
5
5
  const C = a.string().refine((e) => {
@@ -1,5 +1,5 @@
1
1
  import g from "../../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/uniqWith.js";
2
- import { CairoOption as p, CairoOptionVariant as u, CallData as f, hash as h } from "starknet";
2
+ import { CallData as f, CairoOption as p, CairoOptionVariant as u, hash as h } from "starknet";
3
3
  import { z as H } from "zod";
4
4
  import { getSignerForMultiSigner as d, MultiSigner as A } from "../../../../signer/multisigner.js";
5
5
  import { AccountError as D } from "../../../../errors/account.js";
@@ -1,6 +1,6 @@
1
1
  import s from "../../../../../_virtual/semver.js";
2
2
  import { isEqualAddress as i } from "../../address.js";
3
- import { ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES as n, ARGENT_MULTISIG_CONTRACT_CLASS_HASHES as c, C0_PROXY_CONTRACT_CLASS_HASHES as a } from "./constants.js";
3
+ import { C0_PROXY_CONTRACT_CLASS_HASHES as a, ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES as n, ARGENT_MULTISIG_CONTRACT_CLASS_HASHES as c } from "./constants.js";
4
4
  function A(t) {
5
5
  if (i(t, a[0]))
6
6
  return "0.2.4";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("zod"),s=require("../../../staking/schema.cjs"),u=require("../transactionReview/schema.cjs"),e=require("../../../chains/starknet/address.cjs"),d=t.z.object({network:t.z.string(),hash:t.z.string(),status:t.z.string(),blockNumber:t.z.number().optional(),transactionIndex:t.z.number()}),n=t.z.object({type:t.z.enum(["token","nft"]),tokenAddress:e.addressSchemaArgentBackend,amount:t.z.string().optional(),fiatAmount:t.z.object({currency:t.z.string(),currencyAmount:t.z.number()}).optional().nullable()}),i=t.z.enum(["ethereum","starknet","zksync","zksync2"]),m=t.z.object({type:t.z.enum(["payment","gasFee"]),leg:t.z.enum(["credit","debit"]),asset:n,counterParty:e.addressSchemaArgentBackend.optional(),counterPartyNetwork:i.optional()}),f=t.z.object({address:e.addressSchemaArgentBackend,network:i,type:t.z.enum(["wallet","token"])}),N=t.z.object({chainId:t.z.enum(["TESTNET","MAINNET","SEPOLIA"]),ethereumNetwork:t.z.enum(["mainnet","sepolia"])}),w=t.z.enum(["approval","changePubKey","dappInteraction","deploy","gift","multicall","payment","security","trade","staking"]),p=t.z.enum(["triggerEscapeGuardian","triggerEscapeSigner","escapeGuardian","escapeSigner","guardianChanged","guardianBackupChanged","signerChanged","cancelEscape","accountUpgraded","multisigConfigurationUpdated"]),B=t.z.object({name:t.z.string(),parameters:t.z.array(t.z.unknown()).optional()}),I=t.z.object({guid:t.z.string().optional(),signerType:t.z.string().optional(),signer:t.z.object({publicKey:t.z.string().optional()}).optional()}),T=t.z.object({activeAt:t.z.string().optional(),newGuardian:t.z.string().optional(),newImplementation:t.z.string().optional(),newVersion:t.z.string().optional(),signerGuid:t.z.string().optional(),signers:t.z.array(I).optional()}),D=t.z.object({isLootboxReward:t.z.boolean().optional()}),l=t.z.discriminatedUnion("type",[t.z.object({type:t.z.literal("deploy"),deployer:e.addressSchemaArgentBackend,contractAddress:e.addressSchemaArgentBackend}),t.z.object({type:t.z.literal("approval"),spender:e.addressSchemaArgentBackend,asset:n,approvalType:t.z.string()}),t.z.object({type:t.z.literal("payment"),counterparty:e.addressSchemaArgentBackend,leg:t.z.string(),asset:n,counterpartyNetwork:i.optional(),context:D.optional()}),t.z.object({type:t.z.literal("trade"),srcAsset:n,destAsset:n}),t.z.object({type:t.z.literal("security"),action:p,context:T.optional()}),t.z.object({type:t.z.literal("dappInteraction"),dappAddress:e.addressSchemaArgentBackend,function:B.optional().nullable()}),t.z.object({type:t.z.literal("staking"),stakingAction:s.stakingActionSchema,counterparty:e.addressSchemaArgentBackend,asset:n,stakerInfo:s.stakerInfoSchema}),t.z.object({type:t.z.literal("gift"),counterparty:e.addressSchemaArgentBackend.optional(),leg:t.z.string(),asset:n,counterpartyNetwork:i.optional()})]),z=t.z.union([l,t.z.object({type:t.z.literal("multicall"),calls:t.z.array(t.z.object({details:l}))})]),y=t.z.object({dappId:t.z.string(),name:t.z.string().optional().nullable()}),c=t.z.object({sent:t.z.boolean(),asset:t.z.discriminatedUnion("type",[t.z.object({type:t.z.literal("nft"),tokenAddress:e.addressSchemaArgentBackend,tokenId:t.z.coerce.number().optional(),amount:t.z.string().optional(),collectionName:t.z.string().optional(),collectionPreviewImage:t.z.string().optional().nullable(),nftName:t.z.string().optional().nullable(),nftPreviewImage:t.z.string().optional().nullable()}),t.z.object({type:t.z.literal("token"),tokenAddress:e.addressSchemaArgentBackend,amount:t.z.string().optional(),fiatAmount:t.z.object({currency:t.z.string(),currencyAmount:t.z.coerce.string()}).optional().nullable()})])}),g=t.z.object({type:t.z.string(),to:e.addressSchemaArgentBackend,actualFee:t.z.object({type:t.z.string(),tokenAddress:e.addressSchemaArgentBackend,amount:t.z.string().optional(),fiatAmount:t.z.object({currency:t.z.string(),currencyAmount:t.z.number()}).optional().nullable()})}),S=t.z.enum(["pending","success","failure"]),o=t.z.object({compositeId:t.z.string(),id:t.z.string().uuid(),status:S,wallet:e.addressSchemaArgentBackend,txSender:e.addressSchemaArgentBackend,source:t.z.string(),type:w,group:t.z.enum(["finance","security"]),submitted:t.z.number(),lastModified:t.z.number(),transaction:d,transfers:t.z.array(m),fees:t.z.array(g).optional(),relatedAddresses:t.z.array(f).nullable(),network:t.z.string(),networkDetails:N.optional(),details:z,transferSummary:t.z.array(c).optional(),dapp:y.optional(),actions:t.z.array(u.actionSchema).optional(),title:t.z.string().optional(),multisigDetails:t.z.object({signers:t.z.array(e.addressSchemaArgentBackend)}).optional()}),h=t.z.object({title:t.z.string().optional(),shortTitle:t.z.string().optional(),subtitle:t.z.string().optional(),icon:t.z.string().optional(),investment:s.investmentMetaSchema.optional(),isExecuteFromOutside:t.z.boolean().optional()}),b="native",A="rejected",v="cancelled",k="queued",x=o.pick({status:!0,actions:!0,submitted:!0,lastModified:!0,transferSummary:!0,fees:!0,multisigDetails:!0}).extend({status:t.z.union([S,t.z.enum([A,v,k])]),type:t.z.literal(b),transaction:d.pick({hash:!0}),dapp:u.targetedDappSchema.optional(),meta:h.optional()}),j=t.z.array(o),E=t.z.object({activities:j,page:t.z.number(),pageSize:t.z.number(),totalElements:t.z.number(),totalPages:t.z.number()});function P(a){return p.safeParse(a).success}const r=a=>c.safeParse(a).success,C=a=>r(a)&&a.asset.type==="token",M=a=>r(a)&&a.asset.type==="nft";exports.NativeActivityStatusCancelled=v;exports.NativeActivityStatusQueued=k;exports.NativeActivityStatusRejected=A;exports.NativeActivityTypeNative=b;exports.activitiesSchema=j;exports.activityDappSchema=y;exports.activityDetailsSchema=z;exports.activityResponseSchema=E;exports.activitySchema=o;exports.activitySummarySchema=c;exports.activityTransferSchema=m;exports.feeSchema=g;exports.isActivityDetailsAction=P;exports.isActivitySummary=r;exports.isNftActivitySummary=M;exports.isTokenActivitySummary=C;exports.nativeActivityMetaSchema=h;exports.nativeActivitySchema=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("zod"),u=require("../transactionReview/schema.cjs"),s=require("../../../staking/schema.cjs"),e=require("../../../chains/starknet/address.cjs"),d=t.z.object({network:t.z.string(),hash:t.z.string(),status:t.z.string(),blockNumber:t.z.number().optional(),transactionIndex:t.z.number()}),n=t.z.object({type:t.z.enum(["token","nft"]),tokenAddress:e.addressSchemaArgentBackend,amount:t.z.string().optional(),fiatAmount:t.z.object({currency:t.z.string(),currencyAmount:t.z.number()}).optional().nullable()}),i=t.z.enum(["ethereum","starknet","zksync","zksync2"]),m=t.z.object({type:t.z.enum(["payment","gasFee"]),leg:t.z.enum(["credit","debit"]),asset:n,counterParty:e.addressSchemaArgentBackend.optional(),counterPartyNetwork:i.optional()}),f=t.z.object({address:e.addressSchemaArgentBackend,network:i,type:t.z.enum(["wallet","token"])}),N=t.z.object({chainId:t.z.enum(["TESTNET","MAINNET","SEPOLIA"]),ethereumNetwork:t.z.enum(["mainnet","sepolia"])}),w=t.z.enum(["approval","changePubKey","dappInteraction","deploy","gift","multicall","payment","security","trade","staking"]),p=t.z.enum(["triggerEscapeGuardian","triggerEscapeSigner","escapeGuardian","escapeSigner","guardianChanged","guardianBackupChanged","signerChanged","cancelEscape","accountUpgraded","multisigConfigurationUpdated"]),B=t.z.object({name:t.z.string(),parameters:t.z.array(t.z.unknown()).optional()}),I=t.z.object({guid:t.z.string().optional(),signerType:t.z.string().optional(),signer:t.z.object({publicKey:t.z.string().optional()}).optional()}),T=t.z.object({activeAt:t.z.string().optional(),newGuardian:t.z.string().optional(),newImplementation:t.z.string().optional(),newVersion:t.z.string().optional(),signerGuid:t.z.string().optional(),signers:t.z.array(I).optional()}),D=t.z.object({isLootboxReward:t.z.boolean().optional()}),l=t.z.discriminatedUnion("type",[t.z.object({type:t.z.literal("deploy"),deployer:e.addressSchemaArgentBackend,contractAddress:e.addressSchemaArgentBackend}),t.z.object({type:t.z.literal("approval"),spender:e.addressSchemaArgentBackend,asset:n,approvalType:t.z.string()}),t.z.object({type:t.z.literal("payment"),counterparty:e.addressSchemaArgentBackend,leg:t.z.string(),asset:n,counterpartyNetwork:i.optional(),context:D.optional()}),t.z.object({type:t.z.literal("trade"),srcAsset:n,destAsset:n}),t.z.object({type:t.z.literal("security"),action:p,context:T.optional()}),t.z.object({type:t.z.literal("dappInteraction"),dappAddress:e.addressSchemaArgentBackend,function:B.optional().nullable()}),t.z.object({type:t.z.literal("staking"),stakingAction:s.stakingActionSchema,counterparty:e.addressSchemaArgentBackend,asset:n,stakerInfo:s.stakerInfoSchema}),t.z.object({type:t.z.literal("gift"),counterparty:e.addressSchemaArgentBackend.optional(),leg:t.z.string(),asset:n,counterpartyNetwork:i.optional()})]),z=t.z.union([l,t.z.object({type:t.z.literal("multicall"),calls:t.z.array(t.z.object({details:l}))})]),y=t.z.object({dappId:t.z.string(),name:t.z.string().optional().nullable()}),c=t.z.object({sent:t.z.boolean(),asset:t.z.discriminatedUnion("type",[t.z.object({type:t.z.literal("nft"),tokenAddress:e.addressSchemaArgentBackend,tokenId:t.z.coerce.number().optional(),amount:t.z.string().optional(),collectionName:t.z.string().optional(),collectionPreviewImage:t.z.string().optional().nullable(),nftName:t.z.string().optional().nullable(),nftPreviewImage:t.z.string().optional().nullable()}),t.z.object({type:t.z.literal("token"),tokenAddress:e.addressSchemaArgentBackend,amount:t.z.string().optional(),fiatAmount:t.z.object({currency:t.z.string(),currencyAmount:t.z.coerce.string()}).optional().nullable()})])}),g=t.z.object({type:t.z.string(),to:e.addressSchemaArgentBackend,actualFee:t.z.object({type:t.z.string(),tokenAddress:e.addressSchemaArgentBackend,amount:t.z.string().optional(),fiatAmount:t.z.object({currency:t.z.string(),currencyAmount:t.z.number()}).optional().nullable()})}),S=t.z.enum(["pending","success","failure"]),o=t.z.object({compositeId:t.z.string(),id:t.z.string().uuid(),status:S,wallet:e.addressSchemaArgentBackend,txSender:e.addressSchemaArgentBackend,source:t.z.string(),type:w,group:t.z.enum(["finance","security"]),submitted:t.z.number(),lastModified:t.z.number(),transaction:d,transfers:t.z.array(m),fees:t.z.array(g).optional(),relatedAddresses:t.z.array(f).nullable(),network:t.z.string(),networkDetails:N.optional(),details:z,transferSummary:t.z.array(c).optional(),dapp:y.optional(),actions:t.z.array(u.actionSchema).optional(),title:t.z.string().optional(),multisigDetails:t.z.object({signers:t.z.array(e.addressSchemaArgentBackend)}).optional()}),h=t.z.object({title:t.z.string().optional(),shortTitle:t.z.string().optional(),subtitle:t.z.string().optional(),icon:t.z.string().optional(),investment:s.investmentMetaSchema.optional(),isExecuteFromOutside:t.z.boolean().optional()}),b="native",A="rejected",v="cancelled",k="queued",x=o.pick({status:!0,actions:!0,submitted:!0,lastModified:!0,transferSummary:!0,fees:!0,multisigDetails:!0}).extend({status:t.z.union([S,t.z.enum([A,v,k])]),type:t.z.literal(b),transaction:d.pick({hash:!0}),dapp:u.targetedDappSchema.optional(),meta:h.optional()}),j=t.z.array(o),E=t.z.object({activities:j,page:t.z.number(),pageSize:t.z.number(),totalElements:t.z.number(),totalPages:t.z.number()});function P(a){return p.safeParse(a).success}const r=a=>c.safeParse(a).success,C=a=>r(a)&&a.asset.type==="token",M=a=>r(a)&&a.asset.type==="nft";exports.NativeActivityStatusCancelled=v;exports.NativeActivityStatusQueued=k;exports.NativeActivityStatusRejected=A;exports.NativeActivityTypeNative=b;exports.activitiesSchema=j;exports.activityDappSchema=y;exports.activityDetailsSchema=z;exports.activityResponseSchema=E;exports.activitySchema=o;exports.activitySummarySchema=c;exports.activityTransferSchema=m;exports.feeSchema=g;exports.isActivityDetailsAction=P;exports.isActivitySummary=r;exports.isNftActivitySummary=M;exports.isTokenActivitySummary=C;exports.nativeActivityMetaSchema=h;exports.nativeActivitySchema=x;
@@ -1,6 +1,6 @@
1
1
  import { z as t } from "zod";
2
- import { stakerInfoSchema as m, stakingActionSchema as d, investmentMetaSchema as g } from "../../../staking/schema.js";
3
- import { actionSchema as y, targetedDappSchema as b } from "../transactionReview/schema.js";
2
+ import { actionSchema as m, targetedDappSchema as d } from "../transactionReview/schema.js";
3
+ import { investmentMetaSchema as g, stakerInfoSchema as y, stakingActionSchema as b } from "../../../staking/schema.js";
4
4
  import { addressSchemaArgentBackend as e } from "../../../chains/starknet/address.js";
5
5
  const r = t.object({
6
6
  network: t.string(),
@@ -108,10 +108,10 @@ const r = t.object({
108
108
  }),
109
109
  t.object({
110
110
  type: t.literal("staking"),
111
- stakingAction: d,
111
+ stakingAction: b,
112
112
  counterparty: e,
113
113
  asset: a,
114
- stakerInfo: m
114
+ stakerInfo: y
115
115
  }),
116
116
  t.object({
117
117
  type: t.literal("gift"),
@@ -188,7 +188,7 @@ const r = t.object({
188
188
  details: N,
189
189
  transferSummary: t.array(c).optional(),
190
190
  dapp: I.optional(),
191
- actions: t.array(y).optional(),
191
+ actions: t.array(m).optional(),
192
192
  title: t.string().optional(),
193
193
  multisigDetails: t.object({
194
194
  signers: t.array(e)
@@ -222,7 +222,7 @@ const r = t.object({
222
222
  transaction: r.pick({
223
223
  hash: !0
224
224
  }),
225
- dapp: b.optional(),
225
+ dapp: d.optional(),
226
226
  meta: E.optional()
227
227
  }), M = t.array(p), B = t.object({
228
228
  activities: M,
@@ -1,7 +1,7 @@
1
1
  import { z as t } from "zod";
2
2
  import { severitySchema as y, reasonsSchema as j } from "../warning/schema.js";
3
3
  import { estimatedFeesSchema as f } from "../fees/schema.js";
4
- import { addressSchemaArgentBackend as o, addressSchema as k } from "../../../chains/starknet/address.js";
4
+ import { addressSchema as k, addressSchemaArgentBackend as o } from "../../../chains/starknet/address.js";
5
5
  const v = t.object({
6
6
  name: t.string(),
7
7
  url: t.string(),
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("url-join"),f=require("./BackendPaginationError.cjs"),A=require("../chains/starknet/address.cjs"),P=require("../utils/address.cjs"),u=32;class S{constructor(e,t){this.apiBase=e,this.httpService=t}async getNfts(e,t,r,s=1){const a=this.normalizeAddress(r),c=o(this.apiBase,"pandora",e,t),m=this.pageToPageIndex(s),l=`${o(c,"profile",a,"nfts")}?page=${m}&size=${u}`,i=await this.httpService.get(l),n=i.content.map(p=>this.mapItem(p,r));return{totalPages:i.totalPages,page:i.number+1,count:n.length,nfts:n}}async getCollection(e,t,r){const s=this.normalizeAddress(r),a=o(this.apiBase,"pandora",e,t),c=o(a,"collection",s),m=`${a}/collection/${s}`,[g,l]=await Promise.all([this.httpService.get(c),this.httpService.get(m)]),i=h(g),n=l.content.map(p=>this.mapItem(p));return{...i,nfts:{totalPages:l.totalPages,page:l.number,count:n.length,data:n}}}async getNft(e,t,r,s){const a=this.normalizeAddress(r),c=o(this.apiBase,"pandora",e,t),m=o(c,"nft",a,s),g=await this.httpService.get(m);return this.mapItem(g)}async getProfileCollections(e,t,r,s=1,a=!1){const c=this.pageToPageIndex(s),m=this.normalizeAddress(r),g=o(this.apiBase,"pandora",e,t),l=o(g,"profile",m,"collections",`?page=${c}&size=${u}`),i=await this.httpService.get(l),n=[];for(const p of i.content)if(a){const b=await this.getCollectionMetrics(e,t,p.contractAddress);n.push(h(p,b))}else n.push(h(p));return{totalPages:i.totalPages,page:i.number+1,count:n.length,collections:n}}async getCollectionMetrics(e,t,r){const s=this.normalizeAddress(r),a=o(this.apiBase,"pandora",e,t),c=o(a,"collection",s,"metrics");return this.httpService.get(c)}normalizeAddress(e){return A.addressSchemaArgentBackend.parse(e)}pageToPageIndex(e){if(!Number.isInteger(e))throw new f.BackendPaginationError("notANumber");const t=e-1;if(t<0)throw new f.BackendPaginationError("tooLow");return t}mapItem(e,t){var s;const r=e.name??e.tokenId;return{token_id:e.tokenId,contract_address:e.contractAddress,name:r,spec:"spec"in e?v(e.spec):void 0,description:"",best_bid_order:{payment_amount:"bestListPrice"in e?BigInt(e.bestListPrice):void 0},properties:"properties"in e&&e.properties.map(a=>({key:a.key,value:a.value}))||[],image_uri:e.imageUrls.preview,image_url_copy:e.imageUrls.full,owner:{account_address:((s=e.owner)==null?void 0:s.address)||t},contract_name:P.formatAddress(e.contractAddress)}}}function v(d){switch(d){case"erc721":case"starknetErc721":return"ERC721";case"erc1155":case"starknetErc1155":return"ERC1155"}}function h(d,e){return{contractAddress:A.addressSchema.parse(d.contractAddress),name:d.name||P.formatAddress(d.contractAddress),description:d.description??"",imageUri:d.imageUrls.preview,...e&&{owners:{total:e.numberOfItems,unique:e.uniqueOwners},...e.floorPrice&&{floorPrice:BigInt(e.floorPrice)}}}}exports.BackendNftService=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("url-join"),f=require("./BackendPaginationError.cjs"),A=require("../utils/address.cjs"),P=require("../chains/starknet/address.cjs"),u=32;class S{constructor(e,t){this.apiBase=e,this.httpService=t}async getNfts(e,t,r,s=1){const a=this.normalizeAddress(r),c=o(this.apiBase,"pandora",e,t),m=this.pageToPageIndex(s),l=`${o(c,"profile",a,"nfts")}?page=${m}&size=${u}`,i=await this.httpService.get(l),n=i.content.map(p=>this.mapItem(p,r));return{totalPages:i.totalPages,page:i.number+1,count:n.length,nfts:n}}async getCollection(e,t,r){const s=this.normalizeAddress(r),a=o(this.apiBase,"pandora",e,t),c=o(a,"collection",s),m=`${a}/collection/${s}`,[g,l]=await Promise.all([this.httpService.get(c),this.httpService.get(m)]),i=h(g),n=l.content.map(p=>this.mapItem(p));return{...i,nfts:{totalPages:l.totalPages,page:l.number,count:n.length,data:n}}}async getNft(e,t,r,s){const a=this.normalizeAddress(r),c=o(this.apiBase,"pandora",e,t),m=o(c,"nft",a,s),g=await this.httpService.get(m);return this.mapItem(g)}async getProfileCollections(e,t,r,s=1,a=!1){const c=this.pageToPageIndex(s),m=this.normalizeAddress(r),g=o(this.apiBase,"pandora",e,t),l=o(g,"profile",m,"collections",`?page=${c}&size=${u}`),i=await this.httpService.get(l),n=[];for(const p of i.content)if(a){const b=await this.getCollectionMetrics(e,t,p.contractAddress);n.push(h(p,b))}else n.push(h(p));return{totalPages:i.totalPages,page:i.number+1,count:n.length,collections:n}}async getCollectionMetrics(e,t,r){const s=this.normalizeAddress(r),a=o(this.apiBase,"pandora",e,t),c=o(a,"collection",s,"metrics");return this.httpService.get(c)}normalizeAddress(e){return P.addressSchemaArgentBackend.parse(e)}pageToPageIndex(e){if(!Number.isInteger(e))throw new f.BackendPaginationError("notANumber");const t=e-1;if(t<0)throw new f.BackendPaginationError("tooLow");return t}mapItem(e,t){var s;const r=e.name??e.tokenId;return{token_id:e.tokenId,contract_address:e.contractAddress,name:r,spec:"spec"in e?v(e.spec):void 0,description:"",best_bid_order:{payment_amount:"bestListPrice"in e?BigInt(e.bestListPrice):void 0},properties:"properties"in e&&e.properties.map(a=>({key:a.key,value:a.value}))||[],image_uri:e.imageUrls.preview,image_url_copy:e.imageUrls.full,owner:{account_address:((s=e.owner)==null?void 0:s.address)||t},contract_name:A.formatAddress(e.contractAddress)}}}function v(d){switch(d){case"erc721":case"starknetErc721":return"ERC721";case"erc1155":case"starknetErc1155":return"ERC1155"}}function h(d,e){return{contractAddress:P.addressSchema.parse(d.contractAddress),name:d.name||A.formatAddress(d.contractAddress),description:d.description??"",imageUri:d.imageUrls.preview,...e&&{owners:{total:e.numberOfItems,unique:e.uniqueOwners},...e.floorPrice&&{floorPrice:BigInt(e.floorPrice)}}}}exports.BackendNftService=S;
@@ -1,7 +1,7 @@
1
1
  import n from "url-join";
2
2
  import { BackendPaginationError as f } from "./BackendPaginationError.js";
3
- import { addressSchema as P, addressSchemaArgentBackend as S } from "../chains/starknet/address.js";
4
3
  import { formatAddress as b } from "../utils/address.js";
4
+ import { addressSchemaArgentBackend as P, addressSchema as S } from "../chains/starknet/address.js";
5
5
  const A = 32;
6
6
  class k {
7
7
  constructor(e, t) {
@@ -55,7 +55,7 @@ class k {
55
55
  return this.httpService.get(c);
56
56
  }
57
57
  normalizeAddress(e) {
58
- return S.parse(e);
58
+ return P.parse(e);
59
59
  }
60
60
  pageToPageIndex(e) {
61
61
  if (!Number.isInteger(e))
@@ -99,7 +99,7 @@ function w(d) {
99
99
  }
100
100
  function h(d, e) {
101
101
  return {
102
- contractAddress: P.parse(d.contractAddress),
102
+ contractAddress: S.parse(d.contractAddress),
103
103
  name: d.name || b(d.contractAddress),
104
104
  description: d.description ?? "",
105
105
  imageUri: d.imageUrls.preview,
@@ -1,5 +1,5 @@
1
1
  import { z as t } from "zod";
2
- import { addressSchema as a, addressSchemaArgentBackend as o } from "../../../chains/starknet/address.js";
2
+ import { addressSchemaArgentBackend as o, addressSchema as a } from "../../../chains/starknet/address.js";
3
3
  import { defiPositionTypeSchema as d } from "./defiPositionType.model.js";
4
4
  import { createSchemaWithWarnings as g } from "../../../utils/schemas.js";
5
5
  const P = t.object({
@@ -1,11 +1,11 @@
1
- import { base58 as r, hex as c } from "@scure/base";
1
+ import { hex as r, base58 as c } from "@scure/base";
2
2
  import { encode as n, num as s } from "starknet";
3
3
  const a = (e) => {
4
- const o = n.removeHexPrefix(n.sanitizeHex(s.toHex(e))), t = c.decode(o);
5
- return r.encode(t);
4
+ const o = n.removeHexPrefix(n.sanitizeHex(s.toHex(e))), t = r.decode(o);
5
+ return c.encode(t);
6
6
  }, m = (e) => e.map(a), d = (e) => {
7
- const o = r.decode(e);
8
- return n.sanitizeHex(c.encode(o));
7
+ const o = c.decode(e);
8
+ return n.sanitizeHex(r.encode(o));
9
9
  }, i = (e) => e.map(d);
10
10
  export {
11
11
  d as decodeBase58,
@@ -10,4 +10,5 @@ import { BigNumberish } from 'starknet';
10
10
  * abbreviateNumber("1,234,567") // "1.23M"
11
11
  * abbreviateNumber(1234567890) // "1.23B"
12
12
  */
13
- export declare const abbreviateNumber: (value?: BigNumberish, groupSeparator?: string, digitsAfterDecimal?: number) => string | undefined;
13
+ export declare const abbreviateNumber: (value?: BigNumberish, groupSeparator?: string, // for string input, default is ","
14
+ digitsAfterDecimal?: number) => string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@argent/x-shared",
3
- "version": "1.74.1",
3
+ "version": "1.74.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/argentlabs/x-shared.git"
@@ -55,34 +55,34 @@
55
55
  "i18n:upload": "node --loader ts-node/esm --experimental-specifier-resolution=node --no-warnings src/scripts/upload-translation.ts"
56
56
  },
57
57
  "devDependencies": {
58
- "@amplitude/analytics-types": "2.8.4",
59
- "@commitlint/cli": "19.7.1",
60
- "@commitlint/config-conventional": "19.7.1",
58
+ "@amplitude/analytics-types": "2.9.1",
59
+ "@commitlint/cli": "19.8.0",
60
+ "@commitlint/config-conventional": "19.8.0",
61
61
  "@rollup/plugin-typescript": "12.1.2",
62
62
  "@semantic-release/git": "10.0.1",
63
63
  "@types/async-retry": "1.4.9",
64
64
  "@types/lodash-es": "4.17.12",
65
65
  "@types/numeral": "2.0.5",
66
66
  "@types/ua-parser-js": "0.7.39",
67
- "@typescript-eslint/eslint-plugin": "8.23.0",
68
- "@typescript-eslint/parser": "8.23.0",
69
- "esbuild": "^0.20.0",
70
- "esbuild-register": "^3.5.0",
67
+ "@typescript-eslint/eslint-plugin": "8.29.0",
68
+ "@typescript-eslint/parser": "8.29.0",
69
+ "esbuild": "0.25.2",
70
+ "esbuild-register": "3.6.0",
71
71
  "eslint": "8.57.1",
72
- "eslint-config-prettier": "10.0.1",
72
+ "eslint-config-prettier": "10.1.1",
73
73
  "eslint-plugin-import": "2.31.0",
74
74
  "husky": "9.1.7",
75
- "lint-staged": "15.4.3",
76
- "msw": "2.7.0",
77
- "prettier": "3.4.2",
78
- "semantic-release": "24.2.1",
79
- "ts-node": "^10.9.2",
75
+ "lint-staged": "15.5.0",
76
+ "msw": "2.7.3",
77
+ "prettier": "3.5.3",
78
+ "semantic-release": "24.2.3",
79
+ "ts-node": "10.9.2",
80
80
  "ts-to-zod": "3.15.0",
81
- "tsx": "^4.7.0",
82
- "typescript": "5.7.3",
83
- "vite": "6.0.11",
84
- "vite-plugin-dts": "4.5.0",
85
- "vitest": "3.0.5"
81
+ "tsx": "4.19.3",
82
+ "typescript": "5.8.3",
83
+ "vite": "6.2.5",
84
+ "vite-plugin-dts": "4.5.3",
85
+ "vitest": "3.1.1"
86
86
  },
87
87
  "dependencies": {
88
88
  "@argent/x-multicall": "^7.1.0",
@@ -93,9 +93,9 @@
93
93
  "@starknet-io/types-js": "^0.7.7",
94
94
  "@types/fs-extra": "^11.0.4",
95
95
  "big-decimal-number": "npm:bignumber.js@^9.1.2",
96
- "dotenv": "^16.4.7",
96
+ "dotenv": "^17.0.0",
97
97
  "fs-extra": "^11.3.0",
98
- "i18next": "^24.2.3",
98
+ "i18next": "^25.0.0",
99
99
  "micro-starknet": "^0.2.3",
100
100
  "numeral": "2.0.6",
101
101
  "react-i18next": "^15.4.1",