@nexus-cross/crossx-sdk-core 1.3.2 → 1.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -371,15 +371,15 @@ class qs {
371
371
  c === "google" ? l = "/google" : c === "apple" && (l = "/apple");
372
372
  const { oauthServiceUrl: u, authApiUrl: h } = this.config, g = `${u}${l}`;
373
373
  d.log(`[CROSSx] OAuth 팝업 열기 (${c || "일반"} 로그인)`);
374
- const _ = await this.oauth.openAuth({
374
+ const f = await this.oauth.openAuth({
375
375
  authUrl: g,
376
376
  expectedOrigin: new URL(u).origin
377
377
  });
378
- d.log("[CROSSx] OAuth Firebase 토큰 받음 (length:", _.length, ")");
379
- const { accessToken: w, refreshToken: v } = await this.exchangeFirebaseToken(_, h);
378
+ d.log("[CROSSx] OAuth Firebase 토큰 받음 (length:", f.length, ")");
379
+ const { accessToken: w, refreshToken: v } = await this.exchangeFirebaseToken(f, h);
380
380
  let y, S;
381
381
  try {
382
- const U = this.crypto.decodeJWT(_);
382
+ const U = this.crypto.decodeJWT(f);
383
383
  S = (n = U.firebase) == null ? void 0 : n.sign_in_provider;
384
384
  const N = ((o = U.firebase) == null ? void 0 : o.identities) ?? {};
385
385
  S === "google.com" ? y = (i = N["google.com"]) == null ? void 0 : i[0] : S === "apple.com" && (y = (a = N["apple.com"]) == null ? void 0 : a[0]), d.log("[CROSSx] OAuth provider sub 추출 — provider:", S, "hasProviderSub:", !!y);
@@ -400,7 +400,7 @@ class qs {
400
400
  providerSub: y
401
401
  }, this.tokenStore.set(w), this.useCookieAuth || (await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, w), v && this.config.secureStorageAvailable !== !1 ? await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, v) : v && d.warn("[CROSSx] 안전한 스토리지 미사용 — refresh_token 영속 저장을 건너뜁니다"));
402
402
  } else {
403
- const U = this.crypto.decodeJWT(_);
403
+ const U = this.crypto.decodeJWT(f);
404
404
  s = {
405
405
  id: U.sub,
406
406
  email: U.email,
@@ -860,7 +860,7 @@ const Xs = 2e3, Tt = 6e4, Zs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
860
860
  }
861
861
  async _doInitialize(e) {
862
862
  var s, t;
863
- d.log("[CROSSx SDK] v1.3.2 초기화 중..."), this.confirmation.setMessages(St(this._config.locale));
863
+ d.log("[CROSSx SDK] v1.3.4 초기화 중..."), this.confirmation.setMessages(St(this._config.locale));
864
864
  try {
865
865
  const n = Js();
866
866
  this.internalConfig.oauthServiceUrl = n.oauthServiceUrl, this.internalConfig.authApiUrl = n.authApiUrl, this.internalConfig.walletGatewayUrl = n.walletGatewayUrl, this.adapterConfig.gatewayUrl = n.walletGatewayUrl, (t = (s = this.crypto).setJWKSEndpoint) == null || t.call(s, `${n.authApiUrl}/.well-known/jwks.json`);
@@ -1605,7 +1605,7 @@ const Xs = 2e3, Tt = 6e4, Zs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1605
1605
  async sendTransactionWithWaitForReceipt(e, s, t = {}) {
1606
1606
  var v, y;
1607
1607
  const { intervalMs: n, timeoutMs: o, ...i } = t, { txHash: a } = await this.sendTransaction(e, s, i), c = n ?? ((v = this._config.receiptPolling) == null ? void 0 : v.intervalMs) ?? Xs, l = o ?? ((y = this._config.receiptPolling) == null ? void 0 : y.timeoutMs) ?? Tt, u = Je(e), h = s.from ?? "";
1608
- let g, _;
1608
+ let g, f;
1609
1609
  const w = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((S) => {
1610
1610
  g = S;
1611
1611
  const C = BigInt(S.gasUsed) * BigInt(S.effectiveGasPrice), U = s.value ? BigInt(s.value) : 0n, N = re.formatTxAmount(s.value, u.symbol, u.decimals), V = re.formatTxAmount("0x" + C.toString(16), u.symbol, u.decimals), W = re.formatTxAmount("0x" + (U + C).toString(16), u.symbol, u.decimals);
@@ -1620,7 +1620,7 @@ const Xs = 2e3, Tt = 6e4, Zs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1620
1620
  nativeSymbol: u.symbol,
1621
1621
  status: S.status === "0x1" ? "success" : "reverted"
1622
1622
  };
1623
- }).catch((S) => (_ = S instanceof Error ? S : new Error(String(S)), {
1623
+ }).catch((S) => (f = S instanceof Error ? S : new Error(String(S)), {
1624
1624
  chainId: e,
1625
1625
  txHash: a,
1626
1626
  from: h,
@@ -1632,7 +1632,7 @@ const Xs = 2e3, Tt = 6e4, Zs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1632
1632
  if (await this.confirmation.showTransactionProgress(
1633
1633
  { chainId: e, txHash: a, from: h, to: s.to },
1634
1634
  w
1635
- ), _) throw _;
1635
+ ), f) throw f;
1636
1636
  return { chainId: e, txHash: a, receipt: g };
1637
1637
  }
1638
1638
  // ============================================================================
@@ -1917,19 +1917,19 @@ const Xs = 2e3, Tt = 6e4, Zs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1917
1917
  d.log("[CROSSx][Migration Phase 4] PIN 검증 성공"), a = h;
1918
1918
  break;
1919
1919
  }
1920
- const _ = g.pinStatus;
1921
- if (i = _.maxAttempts, o = i - _.remainingAttempts, _.remainingAttempts === 0 && _.lockExpiresAt) {
1922
- const w = _.lockExpiresAt * 1e3, v = Math.max(1, Math.round((w - Date.now()) / 1e3)), y = v <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
1920
+ const f = g.pinStatus;
1921
+ if (i = f.maxAttempts, o = i - f.remainingAttempts, f.remainingAttempts === 0 && f.lockExpiresAt) {
1922
+ const w = f.lockExpiresAt * 1e3, v = Math.max(1, Math.round((w - Date.now()) / 1e3)), y = v <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
1923
1923
  d.warn(`[CROSSx][Migration Phase 4] verify-recovery-pin 잠금 — ${v}초, 메시지: ${y}`), await this.confirmation.showRecoveryPinLockedPrompt(v, y), o = 0, n = "Your account lock has been lifted. You may try again.";
1924
1924
  } else
1925
1925
  d.warn(`[CROSSx][Migration Phase 4] PIN 불일치 (시도 ${o}/${i})`), n = "Incorrect PIN.";
1926
1926
  } catch (g) {
1927
1927
  if (!(g instanceof m)) throw g;
1928
1928
  if (g.code === p.MIGRATION_PIN_LOCKED) {
1929
- const _ = g.details;
1930
- if (i = (_ == null ? void 0 : _.maxAttempts) ?? 5, (_ == null ? void 0 : _.permanent) === !0)
1929
+ const f = g.details;
1930
+ if (i = (f == null ? void 0 : f.maxAttempts) ?? 5, (f == null ? void 0 : f.permanent) === !0)
1931
1931
  return d.warn("[CROSSx][Migration Phase 4] PIN 영구 잠금 (verify-recovery-pin)"), await this.confirmation.showRecoveryPinLockedPrompt(0, "Your account has been permanently locked due to too many failed attempts."), null;
1932
- const w = ((_ == null ? void 0 : _.lockExpiresAt) ?? 0) * 1e3, v = Math.max(1, Math.round((w - Date.now()) / 1e3)), y = v <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
1932
+ const w = ((f == null ? void 0 : f.lockExpiresAt) ?? 0) * 1e3, v = Math.max(1, Math.round((w - Date.now()) / 1e3)), y = v <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
1933
1933
  d.warn(`[CROSSx][Migration Phase 4] verify-recovery-pin 이미 잠금 — ${v}초`), await this.confirmation.showRecoveryPinLockedPrompt(v, y), o = 0, n = "Your account lock has been lifted. You may try again.";
1934
1934
  } else
1935
1935
  throw d.error("[CROSSx][Migration Phase 4] verify-recovery-pin 실패 (복구 불가):", g), g;
@@ -1959,23 +1959,20 @@ const Xs = 2e3, Tt = 6e4, Zs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1959
1959
  * jsonRpc 서비스를 통해 nonce 및 가스 파라미터를 자동 조회합니다.
1960
1960
  */
1961
1961
  async withResolvedGasAndFee(e, s) {
1962
- const t = (l) => !(l != null && l.trim()), n = e.nonce === void 0 || e.nonce === null, o = t(e.gasLimit), i = t(e.gasPrice) && t(e.maxFeePerGas), a = !t(e.maxFeePerGas) && t(e.maxPriorityFeePerGas);
1962
+ const t = (f) => !(f != null && f.trim()), n = e.nonce === void 0 || e.nonce === null, o = t(e.gasLimit), i = t(e.gasPrice) && t(e.maxFeePerGas), a = !t(e.maxFeePerGas) && t(e.maxPriorityFeePerGas);
1963
1963
  if (!n && !o && !i && !a) return e;
1964
- const c = { ...e };
1965
- if (n) {
1966
- const l = c.from ?? this.address;
1967
- if (l) {
1968
- d.log("[CROSSx] nonce 비어있음 → eth_getTransactionCount 호출 (from:", l, ")");
1969
- const u = await this.jsonRpc.call("eth_getTransactionCount", [l, "pending"], s);
1970
- c.nonce = parseInt(u ?? "0x0", 16), d.log("[CROSSx] nonce 결과:", c.nonce);
1971
- }
1972
- }
1973
- if (o && (d.log("[CROSSx] gasLimit 비어있음 → eth_estimateGas 호출"), c.gasLimit = await this.estimateGas(e, s), d.log("[CROSSx] estimateGas 결과:", c.gasLimit)), i) {
1974
- d.log("[CROSSx] gasPrice & maxFeePerGas 비어있음 → baseFee 조회로 Dynamic/Legacy 판별");
1975
- const l = await this.getBaseFeePerGas(s);
1976
- if (l) {
1977
- const u = Rt;
1978
- c.maxFeePerGas = "0x" + (BigInt(l) + BigInt(u)).toString(16), c.maxPriorityFeePerGas = u, d.log("[CROSSx] Dynamic 체인 감지 — baseFee:", l, "maxFeePerGas:", c.maxFeePerGas, "maxPriorityFeePerGas: 1 Gwei");
1964
+ const c = { ...e }, l = n ? c.from ?? this.address : void 0;
1965
+ l && d.log("[CROSSx] nonce 비어있음 → eth_getTransactionCount 호출 (from:", l, ")"), o && d.log("[CROSSx] gasLimit 비어있음 → eth_estimateGas 호출"), i && d.log("[CROSSx] gasPrice & maxFeePerGas 비어있음 → baseFee 조회로 Dynamic/Legacy 판별");
1966
+ const [u, h, g] = await Promise.all([
1967
+ l ? this.jsonRpc.call("eth_getTransactionCount", [l, "pending"], s) : null,
1968
+ o ? this.estimateGas(e, s) : null,
1969
+ i ? this.getBaseFeePerGas(s) : null
1970
+ ]);
1971
+ if (l && (c.nonce = parseInt(u ?? "0x0", 16), d.log("[CROSSx] nonce 결과:", c.nonce)), o && (c.gasLimit = h, d.log("[CROSSx] estimateGas 결과:", c.gasLimit)), i) {
1972
+ const f = g;
1973
+ if (f) {
1974
+ const w = Rt;
1975
+ c.maxFeePerGas = "0x" + (BigInt(f) + BigInt(w)).toString(16), c.maxPriorityFeePerGas = w, d.log("[CROSSx] Dynamic 체인 감지 — baseFee:", f, "maxFeePerGas:", c.maxFeePerGas, "maxPriorityFeePerGas: 1 Gwei");
1979
1976
  } else
1980
1977
  c.gasPrice = er, d.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
1981
1978
  }
@@ -2798,13 +2795,13 @@ class vr extends fr {
2798
2795
  for (let h = 0; h < 16; h++, s += 4)
2799
2796
  we[h] = e.getUint32(s, !1);
2800
2797
  for (let h = 16; h < 64; h++) {
2801
- const g = we[h - 15], _ = we[h - 2], w = ue(g, 7) ^ ue(g, 18) ^ g >>> 3, v = ue(_, 17) ^ ue(_, 19) ^ _ >>> 10;
2798
+ const g = we[h - 15], f = we[h - 2], w = ue(g, 7) ^ ue(g, 18) ^ g >>> 3, v = ue(f, 17) ^ ue(f, 19) ^ f >>> 10;
2802
2799
  we[h] = v + we[h - 7] + w + we[h - 16] | 0;
2803
2800
  }
2804
2801
  let { A: t, B: n, C: o, D: i, E: a, F: c, G: l, H: u } = this;
2805
2802
  for (let h = 0; h < 64; h++) {
2806
- const g = ue(a, 6) ^ ue(a, 11) ^ ue(a, 25), _ = u + g + hr(a, c, l) + br[h] + we[h] | 0, v = (ue(t, 2) ^ ue(t, 13) ^ ue(t, 22)) + pr(t, n, o) | 0;
2807
- u = l, l = c, c = a, a = i + _ | 0, i = o, o = n, n = t, t = _ + v | 0;
2803
+ const g = ue(a, 6) ^ ue(a, 11) ^ ue(a, 25), f = u + g + hr(a, c, l) + br[h] + we[h] | 0, v = (ue(t, 2) ^ ue(t, 13) ^ ue(t, 22)) + pr(t, n, o) | 0;
2804
+ u = l, l = c, c = a, a = i + f | 0, i = o, o = n, n = t, t = f + v | 0;
2808
2805
  }
2809
2806
  t = t + this.A | 0, n = n + this.B | 0, o = o + this.C | 0, i = i + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, u = u + this.H | 0, this.set(t, n, o, i, a, c, l, u);
2810
2807
  }
@@ -2901,7 +2898,7 @@ function kr(r, e, s) {
2901
2898
  let c = t(r), l = t(r), u = 0;
2902
2899
  const h = () => {
2903
2900
  c.fill(1), l.fill(0), u = 0;
2904
- }, g = (...y) => s(l, ve(c, ...y)), _ = (y = n) => {
2901
+ }, g = (...y) => s(l, ve(c, ...y)), f = (y = n) => {
2905
2902
  l = g(o, y), c = g(), y.length !== 0 && (l = g(i, y), c = g());
2906
2903
  }, w = () => {
2907
2904
  if (u++ >= a)
@@ -2916,10 +2913,10 @@ function kr(r, e, s) {
2916
2913
  return ve(...S);
2917
2914
  };
2918
2915
  return (y, S) => {
2919
- h(), _(y);
2916
+ h(), f(y);
2920
2917
  let C;
2921
2918
  for (; !(C = S(w())); )
2922
- _();
2919
+ f();
2923
2920
  return h(), C;
2924
2921
  };
2925
2922
  }
@@ -2989,8 +2986,8 @@ function Cr(r) {
2989
2986
  const e = je(r), s = xs(r), t = s(e, e.neg(e.ONE)), n = s(e, t), o = s(e, e.neg(t)), i = (r + Pr) / fs;
2990
2987
  return (a, c) => {
2991
2988
  let l = a.pow(c, i), u = a.mul(l, t);
2992
- const h = a.mul(l, n), g = a.mul(l, o), _ = a.eql(a.sqr(u), c), w = a.eql(a.sqr(h), c);
2993
- l = a.cmov(l, u, _), u = a.cmov(g, h, w);
2989
+ const h = a.mul(l, n), g = a.mul(l, o), f = a.eql(a.sqr(u), c), w = a.eql(a.sqr(h), c);
2990
+ l = a.cmov(l, u, f), u = a.cmov(g, h, w);
2994
2991
  const v = a.eql(a.sqr(u), c), y = a.cmov(l, u, v);
2995
2992
  return xt(a, y, c), y;
2996
2993
  };
@@ -3015,7 +3012,7 @@ function xs(r) {
3015
3012
  return l;
3016
3013
  if (Bt(c, l) !== 1)
3017
3014
  throw new Error("Cannot find square root");
3018
- let u = s, h = c.mul(c.ONE, o), g = c.pow(l, e), _ = c.pow(l, i);
3015
+ let u = s, h = c.mul(c.ONE, o), g = c.pow(l, e), f = c.pow(l, i);
3019
3016
  for (; !c.eql(g, c.ONE); ) {
3020
3017
  if (c.is0(g))
3021
3018
  return c.ZERO;
@@ -3024,9 +3021,9 @@ function xs(r) {
3024
3021
  if (w++, v = c.sqr(v), w === u)
3025
3022
  throw new Error("Cannot find square root");
3026
3023
  const y = ee << BigInt(u - w - 1), S = c.pow(h, y);
3027
- u = w, h = c.sqr(S), g = c.mul(g, h), _ = c.mul(_, S);
3024
+ u = w, h = c.sqr(S), g = c.mul(g, h), f = c.mul(f, S);
3028
3025
  }
3029
- return _;
3026
+ return f;
3030
3027
  };
3031
3028
  }
3032
3029
  function Lr(r) {
@@ -3242,8 +3239,8 @@ function Ht(r, e, s) {
3242
3239
  const { windowSize: t, mask: n, maxNumber: o, shiftBy: i } = s;
3243
3240
  let a = Number(r & n), c = r >> i;
3244
3241
  a > t && (a -= o, c += Ae);
3245
- const l = e * t, u = l + Math.abs(a) - 1, h = a === 0, g = a < 0, _ = e % 2 !== 0;
3246
- return { nextN: c, offset: u, isZero: h, isNeg: g, isNegF: _, offsetF: l };
3242
+ const l = e * t, u = l + Math.abs(a) - 1, h = a === 0, g = a < 0, f = e % 2 !== 0;
3243
+ return { nextN: c, offset: u, isZero: h, isNeg: g, isNegF: f, offsetF: l };
3247
3244
  }
3248
3245
  const et = /* @__PURE__ */ new WeakMap(), bs = /* @__PURE__ */ new WeakMap();
3249
3246
  function tt(r) {
@@ -3304,8 +3301,8 @@ class Fr {
3304
3301
  let n = this.ZERO, o = this.BASE;
3305
3302
  const i = Qe(e, this.bits);
3306
3303
  for (let a = 0; a < i.windows; a++) {
3307
- const { nextN: c, offset: l, isZero: u, isNeg: h, isNegF: g, offsetF: _ } = Ht(t, a, i);
3308
- t = c, u ? o = o.add(Ke(g, s[_])) : n = n.add(Ke(h, s[l]));
3304
+ const { nextN: c, offset: l, isZero: u, isNeg: h, isNegF: g, offsetF: f } = Ht(t, a, i);
3305
+ t = c, u ? o = o.add(Ke(g, s[f])) : n = n.add(Ke(h, s[l]));
3309
3306
  }
3310
3307
  return Ft(t), { p: n, f: o };
3311
3308
  }
@@ -3432,8 +3429,8 @@ function Kr(r, e, s) {
3432
3429
  let l = r - a * t - c * o, u = -a * n - c * i;
3433
3430
  const h = l < _e, g = u < _e;
3434
3431
  h && (l = -l), g && (u = -u);
3435
- const _ = ft(Math.ceil(Rr(s) / 2)) + Re;
3436
- if (l < _e || l >= _ || u < _e || u >= _)
3432
+ const f = ft(Math.ceil(Rr(s) / 2)) + Re;
3433
+ if (l < _e || l >= f || u < _e || u >= f)
3437
3434
  throw new Error("splitScalar (endomorphism): failed, k=" + r);
3438
3435
  return { k1neg: h, k1: l, k2neg: g, k2: u };
3439
3436
  }
@@ -3561,8 +3558,8 @@ function jr(r, e = {}) {
3561
3558
  if (!t.isOdd)
3562
3559
  throw new Error("compression is not supported: Field does not have .isOdd()");
3563
3560
  }
3564
- function h(A, f, x) {
3565
- const { x: b, y: E } = f.toAffine(), M = t.toBytes(b);
3561
+ function h(A, _, x) {
3562
+ const { x: b, y: E } = _.toAffine(), M = t.toBytes(b);
3566
3563
  if (qe(x, "isCompressed"), x) {
3567
3564
  u();
3568
3565
  const O = !t.isOdd(E);
@@ -3572,8 +3569,8 @@ function jr(r, e = {}) {
3572
3569
  }
3573
3570
  function g(A) {
3574
3571
  z(A, void 0, "Point");
3575
- const { publicKey: f, publicKeyUncompressed: x } = l, b = A.length, E = A[0], M = A.subarray(1);
3576
- if (b === f && (E === 2 || E === 3)) {
3572
+ const { publicKey: _, publicKeyUncompressed: x } = l, b = A.length, E = A[0], M = A.subarray(1);
3573
+ if (b === _ && (E === 2 || E === 3)) {
3577
3574
  const O = t.fromBytes(M);
3578
3575
  if (!t.isValid(O))
3579
3576
  throw new Error("bad point: is not on curve, wrong x");
@@ -3594,15 +3591,15 @@ function jr(r, e = {}) {
3594
3591
  throw new Error("bad point: is not on curve");
3595
3592
  return { x: $, y: T };
3596
3593
  } else
3597
- throw new Error(`bad point: got length ${b}, expected compressed=${f} or uncompressed=${x}`);
3594
+ throw new Error(`bad point: got length ${b}, expected compressed=${_} or uncompressed=${x}`);
3598
3595
  }
3599
- const _ = e.toBytes || h, w = e.fromBytes || g;
3596
+ const f = e.toBytes || h, w = e.fromBytes || g;
3600
3597
  function v(A) {
3601
- const f = t.sqr(A), x = t.mul(f, A);
3598
+ const _ = t.sqr(A), x = t.mul(_, A);
3602
3599
  return t.add(t.add(x, t.mul(A, o.a)), o.b);
3603
3600
  }
3604
- function y(A, f) {
3605
- const x = t.sqr(f), b = v(A);
3601
+ function y(A, _) {
3602
+ const x = t.sqr(_), b = v(A);
3606
3603
  return t.eql(x, b);
3607
3604
  }
3608
3605
  if (!y(o.Gx, o.Gy))
@@ -3610,10 +3607,10 @@ function jr(r, e = {}) {
3610
3607
  const S = t.mul(t.pow(o.a, He), zr), C = t.mul(t.sqr(o.b), BigInt(27));
3611
3608
  if (t.is0(t.add(S, C)))
3612
3609
  throw new Error("bad curve params: a or b");
3613
- function U(A, f, x = !1) {
3614
- if (!t.isValid(f) || x && t.is0(f))
3610
+ function U(A, _, x = !1) {
3611
+ if (!t.isValid(_) || x && t.is0(_))
3615
3612
  throw new Error(`bad point coordinate ${A}`);
3616
- return f;
3613
+ return _;
3617
3614
  }
3618
3615
  function N(A) {
3619
3616
  if (!(A instanceof D))
@@ -3624,13 +3621,13 @@ function jr(r, e = {}) {
3624
3621
  throw new Error("no endo");
3625
3622
  return Kr(A, c.basises, n.ORDER);
3626
3623
  }
3627
- const W = Mt((A, f) => {
3624
+ const W = Mt((A, _) => {
3628
3625
  const { X: x, Y: b, Z: E } = A;
3629
3626
  if (t.eql(E, t.ONE))
3630
3627
  return { x, y: b };
3631
3628
  const M = A.is0();
3632
- f == null && (f = M ? t.ONE : t.inv(E));
3633
- const O = t.mul(x, f), $ = t.mul(b, f), T = t.mul(E, f);
3629
+ _ == null && (_ = M ? t.ONE : t.inv(E));
3630
+ const O = t.mul(x, _), $ = t.mul(b, _), T = t.mul(E, _);
3634
3631
  if (M)
3635
3632
  return { x: t.ZERO, y: t.ZERO };
3636
3633
  if (!t.eql(T, t.ONE))
@@ -3642,44 +3639,44 @@ function jr(r, e = {}) {
3642
3639
  return;
3643
3640
  throw new Error("bad point: ZERO");
3644
3641
  }
3645
- const { x: f, y: x } = A.toAffine();
3646
- if (!t.isValid(f) || !t.isValid(x))
3642
+ const { x: _, y: x } = A.toAffine();
3643
+ if (!t.isValid(_) || !t.isValid(x))
3647
3644
  throw new Error("bad point: x or y not field elements");
3648
- if (!y(f, x))
3645
+ if (!y(_, x))
3649
3646
  throw new Error("bad point: equation left != right");
3650
3647
  if (!A.isTorsionFree())
3651
3648
  throw new Error("bad point: not in prime-order subgroup");
3652
3649
  return !0;
3653
3650
  });
3654
- function k(A, f, x, b, E) {
3655
- return x = new D(t.mul(x.X, A), x.Y, x.Z), f = Ke(b, f), x = Ke(E, x), f.add(x);
3651
+ function k(A, _, x, b, E) {
3652
+ return x = new D(t.mul(x.X, A), x.Y, x.Z), _ = Ke(b, _), x = Ke(E, x), _.add(x);
3656
3653
  }
3657
3654
  const R = class R {
3658
3655
  /** Does NOT validate if the point is valid. Use `.assertValidity()`. */
3659
- constructor(f, x, b) {
3656
+ constructor(_, x, b) {
3660
3657
  I(this, "X");
3661
3658
  I(this, "Y");
3662
3659
  I(this, "Z");
3663
- this.X = U("x", f), this.Y = U("y", x, !0), this.Z = U("z", b), Object.freeze(this);
3660
+ this.X = U("x", _), this.Y = U("y", x, !0), this.Z = U("z", b), Object.freeze(this);
3664
3661
  }
3665
3662
  static CURVE() {
3666
3663
  return o;
3667
3664
  }
3668
3665
  /** Does NOT validate if the point is valid. Use `.assertValidity()`. */
3669
- static fromAffine(f) {
3670
- const { x, y: b } = f || {};
3671
- if (!f || !t.isValid(x) || !t.isValid(b))
3666
+ static fromAffine(_) {
3667
+ const { x, y: b } = _ || {};
3668
+ if (!_ || !t.isValid(x) || !t.isValid(b))
3672
3669
  throw new Error("invalid affine point");
3673
- if (f instanceof R)
3670
+ if (_ instanceof R)
3674
3671
  throw new Error("projective point not allowed");
3675
3672
  return t.is0(x) && t.is0(b) ? R.ZERO : new R(x, b, t.ONE);
3676
3673
  }
3677
- static fromBytes(f) {
3678
- const x = R.fromAffine(w(z(f, void 0, "point")));
3674
+ static fromBytes(_) {
3675
+ const x = R.fromAffine(w(z(_, void 0, "point")));
3679
3676
  return x.assertValidity(), x;
3680
3677
  }
3681
- static fromHex(f) {
3682
- return R.fromBytes(We(f));
3678
+ static fromHex(_) {
3679
+ return R.fromBytes(We(_));
3683
3680
  }
3684
3681
  get x() {
3685
3682
  return this.toAffine().x;
@@ -3693,8 +3690,8 @@ function jr(r, e = {}) {
3693
3690
  * @param isLazy true will defer table computation until the first multiplication
3694
3691
  * @returns
3695
3692
  */
3696
- precompute(f = 8, x = !0) {
3697
- return L.createCache(this, f), x || this.multiply(He), this;
3693
+ precompute(_ = 8, x = !0) {
3694
+ return L.createCache(this, _), x || this.multiply(He), this;
3698
3695
  }
3699
3696
  // TODO: return `this`
3700
3697
  /** A point on curve is valid if it conforms to equation. */
@@ -3702,15 +3699,15 @@ function jr(r, e = {}) {
3702
3699
  P(this);
3703
3700
  }
3704
3701
  hasEvenY() {
3705
- const { y: f } = this.toAffine();
3702
+ const { y: _ } = this.toAffine();
3706
3703
  if (!t.isOdd)
3707
3704
  throw new Error("Field doesn't support isOdd");
3708
- return !t.isOdd(f);
3705
+ return !t.isOdd(_);
3709
3706
  }
3710
3707
  /** Compare one point to another. */
3711
- equals(f) {
3712
- N(f);
3713
- const { X: x, Y: b, Z: E } = this, { X: M, Y: O, Z: $ } = f, T = t.eql(t.mul(x, $), t.mul(M, E)), B = t.eql(t.mul(b, $), t.mul(O, E));
3708
+ equals(_) {
3709
+ N(_);
3710
+ const { X: x, Y: b, Z: E } = this, { X: M, Y: O, Z: $ } = _, T = t.eql(t.mul(x, $), t.mul(M, E)), B = t.eql(t.mul(b, $), t.mul(O, E));
3714
3711
  return T && B;
3715
3712
  }
3716
3713
  /** Flips point to one corresponding to (x, -y) in Affine coordinates. */
@@ -3722,17 +3719,17 @@ function jr(r, e = {}) {
3722
3719
  // https://eprint.iacr.org/2015/1060, algorithm 3
3723
3720
  // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
3724
3721
  double() {
3725
- const { a: f, b: x } = o, b = t.mul(x, He), { X: E, Y: M, Z: O } = this;
3722
+ const { a: _, b: x } = o, b = t.mul(x, He), { X: E, Y: M, Z: O } = this;
3726
3723
  let $ = t.ZERO, T = t.ZERO, B = t.ZERO, G = t.mul(E, E), J = t.mul(M, M), K = t.mul(O, O), F = t.mul(E, M);
3727
- return F = t.add(F, F), B = t.mul(E, O), B = t.add(B, B), $ = t.mul(f, B), T = t.mul(b, K), T = t.add($, T), $ = t.sub(J, T), T = t.add(J, T), T = t.mul($, T), $ = t.mul(F, $), B = t.mul(b, B), K = t.mul(f, K), F = t.sub(G, K), F = t.mul(f, F), F = t.add(F, B), B = t.add(G, G), G = t.add(B, G), G = t.add(G, K), G = t.mul(G, F), T = t.add(T, G), K = t.mul(M, O), K = t.add(K, K), G = t.mul(K, F), $ = t.sub($, G), B = t.mul(K, J), B = t.add(B, B), B = t.add(B, B), new R($, T, B);
3724
+ return F = t.add(F, F), B = t.mul(E, O), B = t.add(B, B), $ = t.mul(_, B), T = t.mul(b, K), T = t.add($, T), $ = t.sub(J, T), T = t.add(J, T), T = t.mul($, T), $ = t.mul(F, $), B = t.mul(b, B), K = t.mul(_, K), F = t.sub(G, K), F = t.mul(_, F), F = t.add(F, B), B = t.add(G, G), G = t.add(B, G), G = t.add(G, K), G = t.mul(G, F), T = t.add(T, G), K = t.mul(M, O), K = t.add(K, K), G = t.mul(K, F), $ = t.sub($, G), B = t.mul(K, J), B = t.add(B, B), B = t.add(B, B), new R($, T, B);
3728
3725
  }
3729
3726
  // Renes-Costello-Batina exception-free addition formula.
3730
3727
  // There is 30% faster Jacobian formula, but it is not complete.
3731
3728
  // https://eprint.iacr.org/2015/1060, algorithm 1
3732
3729
  // Cost: 12M + 0S + 3*a + 3*b3 + 23add.
3733
- add(f) {
3734
- N(f);
3735
- const { X: x, Y: b, Z: E } = this, { X: M, Y: O, Z: $ } = f;
3730
+ add(_) {
3731
+ N(_);
3732
+ const { X: x, Y: b, Z: E } = this, { X: M, Y: O, Z: $ } = _;
3736
3733
  let T = t.ZERO, B = t.ZERO, G = t.ZERO;
3737
3734
  const J = o.a, K = t.mul(o.b, He);
3738
3735
  let F = t.mul(x, M), X = t.mul(b, O), Z = t.mul(E, $), oe = t.add(x, b), j = t.add(M, O);
@@ -3740,8 +3737,8 @@ function jr(r, e = {}) {
3740
3737
  let Q = t.add(M, $);
3741
3738
  return j = t.mul(j, Q), Q = t.add(F, Z), j = t.sub(j, Q), Q = t.add(b, E), T = t.add(O, $), Q = t.mul(Q, T), T = t.add(X, Z), Q = t.sub(Q, T), G = t.mul(J, j), T = t.mul(K, Z), G = t.add(T, G), T = t.sub(X, G), G = t.add(X, G), B = t.mul(T, G), X = t.add(F, F), X = t.add(X, F), Z = t.mul(J, Z), j = t.mul(K, j), X = t.add(X, Z), Z = t.sub(F, Z), Z = t.mul(J, Z), j = t.add(j, Z), F = t.mul(X, j), B = t.add(B, F), F = t.mul(Q, j), T = t.mul(oe, T), T = t.sub(T, F), F = t.mul(oe, X), G = t.mul(Q, G), G = t.add(G, F), new R(T, B, G);
3742
3739
  }
3743
- subtract(f) {
3744
- return this.add(f.negate());
3740
+ subtract(_) {
3741
+ return this.add(_.negate());
3745
3742
  }
3746
3743
  is0() {
3747
3744
  return this.equals(R.ZERO);
@@ -3755,17 +3752,17 @@ function jr(r, e = {}) {
3755
3752
  * @param scalar by which the point would be multiplied
3756
3753
  * @returns New point
3757
3754
  */
3758
- multiply(f) {
3755
+ multiply(_) {
3759
3756
  const { endo: x } = e;
3760
- if (!n.isValidNot0(f))
3757
+ if (!n.isValidNot0(_))
3761
3758
  throw new Error("invalid scalar: out of range");
3762
3759
  let b, E;
3763
3760
  const M = (O) => L.cached(this, O, ($) => Ut(R, $));
3764
3761
  if (x) {
3765
- const { k1neg: O, k1: $, k2neg: T, k2: B } = V(f), { p: G, f: J } = M($), { p: K, f: F } = M(B);
3762
+ const { k1neg: O, k1: $, k2neg: T, k2: B } = V(_), { p: G, f: J } = M($), { p: K, f: F } = M(B);
3766
3763
  E = J.add(F), b = k(x.beta, G, K, O, T);
3767
3764
  } else {
3768
- const { p: O, f: $ } = M(f);
3765
+ const { p: O, f: $ } = M(_);
3769
3766
  b = O, E = $;
3770
3767
  }
3771
3768
  return Ut(R, [b, E])[0];
@@ -3775,49 +3772,49 @@ function jr(r, e = {}) {
3775
3772
  * It's faster, but should only be used when you don't care about
3776
3773
  * an exposed secret key e.g. sig verification, which works over *public* keys.
3777
3774
  */
3778
- multiplyUnsafe(f) {
3775
+ multiplyUnsafe(_) {
3779
3776
  const { endo: x } = e, b = this;
3780
- if (!n.isValid(f))
3777
+ if (!n.isValid(_))
3781
3778
  throw new Error("invalid scalar: out of range");
3782
- if (f === _e || b.is0())
3779
+ if (_ === _e || b.is0())
3783
3780
  return R.ZERO;
3784
- if (f === Re)
3781
+ if (_ === Re)
3785
3782
  return b;
3786
3783
  if (L.hasCache(this))
3787
- return this.multiply(f);
3784
+ return this.multiply(_);
3788
3785
  if (x) {
3789
- const { k1neg: E, k1: M, k2neg: O, k2: $ } = V(f), { p1: T, p2: B } = Gr(R, b, M, $);
3786
+ const { k1neg: E, k1: M, k2neg: O, k2: $ } = V(_), { p1: T, p2: B } = Gr(R, b, M, $);
3790
3787
  return k(x.beta, T, B, E, O);
3791
3788
  } else
3792
- return L.unsafe(b, f);
3789
+ return L.unsafe(b, _);
3793
3790
  }
3794
3791
  /**
3795
3792
  * Converts Projective point to affine (x, y) coordinates.
3796
3793
  * @param invertedZ Z^-1 (inverted zero) - optional, precomputation is useful for invertBatch
3797
3794
  */
3798
- toAffine(f) {
3799
- return W(this, f);
3795
+ toAffine(_) {
3796
+ return W(this, _);
3800
3797
  }
3801
3798
  /**
3802
3799
  * Checks whether Point is free of torsion elements (is in prime subgroup).
3803
3800
  * Always torsion-free for cofactor=1 curves.
3804
3801
  */
3805
3802
  isTorsionFree() {
3806
- const { isTorsionFree: f } = e;
3807
- return i === Re ? !0 : f ? f(R, this) : L.unsafe(this, a).is0();
3803
+ const { isTorsionFree: _ } = e;
3804
+ return i === Re ? !0 : _ ? _(R, this) : L.unsafe(this, a).is0();
3808
3805
  }
3809
3806
  clearCofactor() {
3810
- const { clearCofactor: f } = e;
3811
- return i === Re ? this : f ? f(R, this) : this.multiplyUnsafe(i);
3807
+ const { clearCofactor: _ } = e;
3808
+ return i === Re ? this : _ ? _(R, this) : this.multiplyUnsafe(i);
3812
3809
  }
3813
3810
  isSmallOrder() {
3814
3811
  return this.multiplyUnsafe(i).is0();
3815
3812
  }
3816
- toBytes(f = !0) {
3817
- return qe(f, "isCompressed"), this.assertValidity(), _(R, this, f);
3813
+ toBytes(_ = !0) {
3814
+ return qe(_, "isCompressed"), this.assertValidity(), f(R, this, _);
3818
3815
  }
3819
- toHex(f = !0) {
3820
- return Me(this.toBytes(f));
3816
+ toHex(_ = !0) {
3817
+ return Me(this.toBytes(_));
3821
3818
  }
3822
3819
  toString() {
3823
3820
  return `<Point ${this.is0() ? "ZERO" : this.toHex()}>`;
@@ -3847,42 +3844,42 @@ function As(r, e) {
3847
3844
  }
3848
3845
  function Yr(r, e = {}) {
3849
3846
  const { Fn: s } = r, t = e.randomBytes || os, n = Object.assign(As(r.Fp, s), { seed: ws(s.ORDER) });
3850
- function o(_) {
3847
+ function o(f) {
3851
3848
  try {
3852
- const w = s.fromBytes(_);
3849
+ const w = s.fromBytes(f);
3853
3850
  return s.isValidNot0(w);
3854
3851
  } catch {
3855
3852
  return !1;
3856
3853
  }
3857
3854
  }
3858
- function i(_, w) {
3855
+ function i(f, w) {
3859
3856
  const { publicKey: v, publicKeyUncompressed: y } = n;
3860
3857
  try {
3861
- const S = _.length;
3862
- return w === !0 && S !== v || w === !1 && S !== y ? !1 : !!r.fromBytes(_);
3858
+ const S = f.length;
3859
+ return w === !0 && S !== v || w === !1 && S !== y ? !1 : !!r.fromBytes(f);
3863
3860
  } catch {
3864
3861
  return !1;
3865
3862
  }
3866
3863
  }
3867
- function a(_ = t(n.seed)) {
3868
- return Hr(z(_, n.seed, "seed"), s.ORDER);
3864
+ function a(f = t(n.seed)) {
3865
+ return Hr(z(f, n.seed, "seed"), s.ORDER);
3869
3866
  }
3870
- function c(_, w = !0) {
3871
- return r.BASE.multiply(s.fromBytes(_)).toBytes(w);
3867
+ function c(f, w = !0) {
3868
+ return r.BASE.multiply(s.fromBytes(f)).toBytes(w);
3872
3869
  }
3873
- function l(_) {
3870
+ function l(f) {
3874
3871
  const { secretKey: w, publicKey: v, publicKeyUncompressed: y } = n;
3875
- if (!ut(_) || "_lengths" in s && s._lengths || w === v)
3872
+ if (!ut(f) || "_lengths" in s && s._lengths || w === v)
3876
3873
  return;
3877
- const S = z(_, void 0, "key").length;
3874
+ const S = z(f, void 0, "key").length;
3878
3875
  return S === v || S === y;
3879
3876
  }
3880
- function u(_, w, v = !0) {
3881
- if (l(_) === !0)
3877
+ function u(f, w, v = !0) {
3878
+ if (l(f) === !0)
3882
3879
  throw new Error("first arg must be private key");
3883
3880
  if (l(w) === !1)
3884
3881
  throw new Error("second arg must be public key");
3885
- const y = s.fromBytes(_);
3882
+ const y = s.fromBytes(f);
3886
3883
  return r.fromBytes(w).multiply(y).toBytes(v);
3887
3884
  }
3888
3885
  const h = {
@@ -3900,29 +3897,29 @@ function Jr(r, e, s = {}) {
3900
3897
  bits2int: "function",
3901
3898
  bits2int_modN: "function"
3902
3899
  }), s = Object.assign({}, s);
3903
- const t = s.randomBytes || os, n = s.hmac || ((f, x) => Ss(e, f, x)), { Fp: o, Fn: i } = r, { ORDER: a, BITS: c } = i, { keygen: l, getPublicKey: u, getSharedSecret: h, utils: g, lengths: _ } = Yr(r, s), w = {
3900
+ const t = s.randomBytes || os, n = s.hmac || ((_, x) => Ss(e, _, x)), { Fp: o, Fn: i } = r, { ORDER: a, BITS: c } = i, { keygen: l, getPublicKey: u, getSharedSecret: h, utils: g, lengths: f } = Yr(r, s), w = {
3904
3901
  prehash: !0,
3905
3902
  lowS: typeof s.lowS == "boolean" ? s.lowS : !0,
3906
3903
  format: "compact",
3907
3904
  extraEntropy: !1
3908
3905
  }, v = a * Es < o.ORDER;
3909
- function y(f) {
3906
+ function y(_) {
3910
3907
  const x = a >> Re;
3911
- return f > x;
3908
+ return _ > x;
3912
3909
  }
3913
- function S(f, x) {
3910
+ function S(_, x) {
3914
3911
  if (!i.isValidNot0(x))
3915
- throw new Error(`invalid signature ${f}: out of range 1..Point.Fn.ORDER`);
3912
+ throw new Error(`invalid signature ${_}: out of range 1..Point.Fn.ORDER`);
3916
3913
  return x;
3917
3914
  }
3918
3915
  function C() {
3919
3916
  if (v)
3920
3917
  throw new Error('"recovered" sig type is not supported for cofactor >2 curves');
3921
3918
  }
3922
- function U(f, x) {
3919
+ function U(_, x) {
3923
3920
  ct(x);
3924
- const b = _.signature, E = x === "compact" ? b : x === "recovered" ? b + 1 : void 0;
3925
- return z(f, E);
3921
+ const b = f.signature, E = x === "compact" ? b : x === "recovered" ? b + 1 : void 0;
3922
+ return z(_, E);
3926
3923
  }
3927
3924
  class N {
3928
3925
  constructor(x, b, E) {
@@ -3944,7 +3941,7 @@ function Jr(r, e, s = {}) {
3944
3941
  return new N(T, B);
3945
3942
  }
3946
3943
  b === "recovered" && (E = x[0], b = "compact", x = x.subarray(1));
3947
- const M = _.signature / 2, O = x.subarray(0, M), $ = x.subarray(M, M * 2);
3944
+ const M = f.signature / 2, O = x.subarray(0, M), $ = x.subarray(M, M * 2);
3948
3945
  return new N(i.fromBytes(O), i.fromBytes($), E);
3949
3946
  }
3950
3947
  static fromHex(x, b) {
@@ -3990,21 +3987,21 @@ function Jr(r, e, s = {}) {
3990
3987
  }, W = s.bits2int_modN || function(x) {
3991
3988
  return i.create(V(x));
3992
3989
  }, P = ft(c);
3993
- function k(f) {
3994
- return Tr("num < 2^" + c, f, _e, P), i.toBytes(f);
3990
+ function k(_) {
3991
+ return Tr("num < 2^" + c, _, _e, P), i.toBytes(_);
3995
3992
  }
3996
- function D(f, x) {
3997
- return z(f, void 0, "message"), x ? z(e(f), void 0, "prehashed message") : f;
3993
+ function D(_, x) {
3994
+ return z(_, void 0, "message"), x ? z(e(_), void 0, "prehashed message") : _;
3998
3995
  }
3999
- function q(f, x, b) {
3996
+ function q(_, x, b) {
4000
3997
  const { lowS: E, prehash: M, extraEntropy: O } = st(b, w);
4001
- f = D(f, M);
4002
- const $ = W(f), T = i.fromBytes(x);
3998
+ _ = D(_, M);
3999
+ const $ = W(_), T = i.fromBytes(x);
4003
4000
  if (!i.isValidNot0(T))
4004
4001
  throw new Error("invalid private key");
4005
4002
  const B = [k(T), k($)];
4006
4003
  if (O != null && O !== !1) {
4007
- const F = O === !0 ? t(_.secretKey) : O;
4004
+ const F = O === !0 ? t(f.secretKey) : O;
4008
4005
  B.push(z(F, void 0, "extraEntropy"));
4009
4006
  }
4010
4007
  const G = ve(...B), J = $;
@@ -4023,19 +4020,19 @@ function Jr(r, e, s = {}) {
4023
4020
  }
4024
4021
  return { seed: G, k2sig: K };
4025
4022
  }
4026
- function L(f, x, b = {}) {
4027
- const { seed: E, k2sig: M } = q(f, x, b);
4023
+ function L(_, x, b = {}) {
4024
+ const { seed: E, k2sig: M } = q(_, x, b);
4028
4025
  return kr(e.outputLen, i.BYTES, n)(E, M).toBytes(b.format);
4029
4026
  }
4030
- function R(f, x, b, E = {}) {
4027
+ function R(_, x, b, E = {}) {
4031
4028
  const { lowS: M, prehash: O, format: $ } = st(E, w);
4032
- if (b = z(b, void 0, "publicKey"), x = D(x, O), !ut(f)) {
4033
- const T = f instanceof N ? ", use sig.toBytes()" : "";
4029
+ if (b = z(b, void 0, "publicKey"), x = D(x, O), !ut(_)) {
4030
+ const T = _ instanceof N ? ", use sig.toBytes()" : "";
4034
4031
  throw new Error("verify expects Uint8Array signature" + T);
4035
4032
  }
4036
- U(f, $);
4033
+ U(_, $);
4037
4034
  try {
4038
- const T = N.fromBytes(f, $), B = r.fromBytes(b);
4035
+ const T = N.fromBytes(_, $), B = r.fromBytes(b);
4039
4036
  if (M && T.hasHighS())
4040
4037
  return !1;
4041
4038
  const { r: G, s: J } = T, K = W(x), F = i.inv(J), X = i.create(K * F), Z = i.create(G * F), oe = r.BASE.multiplyUnsafe(X).add(B.multiplyUnsafe(Z));
@@ -4044,16 +4041,16 @@ function Jr(r, e, s = {}) {
4044
4041
  return !1;
4045
4042
  }
4046
4043
  }
4047
- function A(f, x, b = {}) {
4044
+ function A(_, x, b = {}) {
4048
4045
  const { prehash: E } = st(b, w);
4049
- return x = D(x, E), N.fromBytes(f, "recovered").recoverPublicKey(x).toBytes();
4046
+ return x = D(x, E), N.fromBytes(_, "recovered").recoverPublicKey(x).toBytes();
4050
4047
  }
4051
4048
  return Object.freeze({
4052
4049
  keygen: l,
4053
4050
  getPublicKey: u,
4054
4051
  getSharedSecret: h,
4055
4052
  utils: g,
4056
- lengths: _,
4053
+ lengths: f,
4057
4054
  Point: r,
4058
4055
  sign: L,
4059
4056
  verify: R,
@@ -4079,7 +4076,7 @@ const gt = {
4079
4076
  ]
4080
4077
  }, qt = /* @__PURE__ */ BigInt(2);
4081
4078
  function Zr(r) {
4082
- const e = gt.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), o = BigInt(22), i = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, u = l * l * r % e, h = ae(u, s, e) * u % e, g = ae(h, s, e) * u % e, _ = ae(g, qt, e) * l % e, w = ae(_, n, e) * _ % e, v = ae(w, o, e) * w % e, y = ae(v, a, e) * v % e, S = ae(y, c, e) * y % e, C = ae(S, a, e) * v % e, U = ae(C, s, e) * u % e, N = ae(U, i, e) * w % e, V = ae(N, t, e) * l % e, W = ae(V, qt, e);
4079
+ const e = gt.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), o = BigInt(22), i = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, u = l * l * r % e, h = ae(u, s, e) * u % e, g = ae(h, s, e) * u % e, f = ae(g, qt, e) * l % e, w = ae(f, n, e) * f % e, v = ae(w, o, e) * w % e, y = ae(v, a, e) * v % e, S = ae(y, c, e) * y % e, C = ae(S, a, e) * v % e, U = ae(C, s, e) * u % e, N = ae(U, i, e) * w % e, V = ae(N, t, e) * l % e, W = ae(V, qt, e);
4083
4080
  if (!lt.eql(lt.sqr(W), r))
4084
4081
  throw new Error("Cannot find square root");
4085
4082
  return W;
@@ -4103,8 +4100,8 @@ function ln(r, e = 24) {
4103
4100
  s[i] = r[i] ^ r[i + 10] ^ r[i + 20] ^ r[i + 30] ^ r[i + 40];
4104
4101
  for (let i = 0; i < 10; i += 2) {
4105
4102
  const a = (i + 8) % 10, c = (i + 2) % 10, l = s[c], u = s[c + 1], h = Kt(l, u, 1) ^ s[a], g = Vt(l, u, 1) ^ s[a + 1];
4106
- for (let _ = 0; _ < 50; _ += 10)
4107
- r[i + _] ^= h, r[i + _ + 1] ^= g;
4103
+ for (let f = 0; f < 50; f += 10)
4104
+ r[i + f] ^= h, r[i + f + 1] ^= g;
4108
4105
  }
4109
4106
  let n = r[2], o = r[3];
4110
4107
  for (let i = 0; i < 24; i++) {
@@ -4413,7 +4410,7 @@ class be {
4413
4410
  t(new Error("팝업 창을 열 수 없습니다. 팝업 차단을 해제해 주세요."));
4414
4411
  return;
4415
4412
  }
4416
- const _ = setTimeout(() => {
4413
+ const f = setTimeout(() => {
4417
4414
  d.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), N(), t(new Error("Authentication timeout"));
4418
4415
  }, 5 * 60 * 1e3), w = 10, v = 30;
4419
4416
  let y = 0, S = null;
@@ -4431,7 +4428,7 @@ class be {
4431
4428
  C();
4432
4429
  }
4433
4430
  }, 1e3), N = () => {
4434
- clearTimeout(_), clearInterval(U), S && clearTimeout(S), window.removeEventListener("message", V);
4431
+ clearTimeout(f), clearInterval(U), S && clearTimeout(S), window.removeEventListener("message", V);
4435
4432
  }, V = (W) => {
4436
4433
  var k, D, q, L, R;
4437
4434
  if (W.origin !== e.expectedOrigin) return;
@@ -4446,9 +4443,9 @@ class be {
4446
4443
  return;
4447
4444
  }
4448
4445
  if (W.data.status === "success") {
4449
- const A = (D = W.data.data) == null ? void 0 : D.idToken, f = (q = W.data.data) == null ? void 0 : q.accessToken, x = f ?? A;
4446
+ const A = (D = W.data.data) == null ? void 0 : D.idToken, _ = (q = W.data.data) == null ? void 0 : q.accessToken, x = _ ?? A;
4450
4447
  if (d.log("[CROSSx] OAuth 토큰 수신:", {
4451
- hasAccessToken: !!f,
4448
+ hasAccessToken: !!_,
4452
4449
  hasIdToken: !!A
4453
4450
  }), !x) {
4454
4451
  d.error("[CROSSx] 토큰을 찾을 수 없음:", W.data), t(new Error("Token not found in response"));
@@ -4456,7 +4453,7 @@ class be {
4456
4453
  }
4457
4454
  A ? be.verifyIdTokenNonce(A, l).then(() => s(x)).catch((b) => {
4458
4455
  d.error("[CROSSx] nonce 검증 실패:", b), t(b instanceof Error ? b : new Error("nonce verification failed"));
4459
- }) : f ? f.split(".").length === 3 ? be.verifyIdTokenNonce(f, l).then(() => s(x)).catch((E) => {
4456
+ }) : _ ? _.split(".").length === 3 ? be.verifyIdTokenNonce(_, l).then(() => s(x)).catch((E) => {
4460
4457
  d.error("[CROSSx] accessToken nonce 검증 실패:", E), t(E instanceof Error ? E : new Error("nonce verification failed"));
4461
4458
  }) : (d.warn(
4462
4459
  "[CROSSx] opaque accessToken만 수신 (idToken 없음) — nonce 검증 불가.",
@@ -4661,7 +4658,7 @@ class Le {
4661
4658
  url: o,
4662
4659
  method: e
4663
4660
  });
4664
- const g = Le.mapGatewayError(u.code, u.data), _ = Le.getGatewayErrorMessage(u.code, h), w = u.data, v = g === p.PIN_LOCKED ? Le.extractLockDetails(w) : w ?? void 0, y = new m(g, _, v);
4661
+ const g = Le.mapGatewayError(u.code, u.data), f = Le.getGatewayErrorMessage(u.code, h), w = u.data, v = g === p.PIN_LOCKED ? Le.extractLockDetails(w) : w ?? void 0, y = new m(g, f, v);
4665
4662
  throw g === p.AUTH_NOT_AUTHENTICATED && this._onUnauthorized && (d.warn("[CROSSx] Gateway -10002 감지 — 강제 로그아웃 실행"), this._onUnauthorized()), y;
4666
4663
  }
4667
4664
  return d.log("[CROSSx] Wallet Gateway API 성공:", { code: u.code, url: o, method: e }), u.data ?? u;
@@ -7228,7 +7225,7 @@ function Cn(r, e, s) {
7228
7225
  const c = e.from ? Y("From", `<span class="__crossx-addr-text">${se(e.from)}</span>
7229
7226
  <button class="__crossx-copy-btn" data-copy="${H(e.from)}" title="Copy address">${xe}</button>`) : "", l = e.to ? Y("To", `<span class="__crossx-addr-text">${se(e.to)}</span>
7230
7227
  <button class="__crossx-copy-btn" data-copy="${H(e.to)}" title="Copy address">${xe}</button>`) : "", u = e.amount ? Y("Transfer", `<span>${H(e.amount)}</span>`) : "", h = e.fees ? Y("Tx Fee", `<span>${H(e.fees)}</span>`) : "", g = e.txHash ? Y("Tx Hash", `<span class="__crossx-addr-text">${se(e.txHash)}</span>
7231
- <button class="__crossx-copy-btn" data-copy="${H(e.txHash)}" title="Copy hash">${xe}</button>`) : "", _ = e.total ? `<div class="__crossx-total-pill">
7228
+ <button class="__crossx-copy-btn" data-copy="${H(e.txHash)}" title="Copy hash">${xe}</button>`) : "", f = e.total ? `<div class="__crossx-total-pill">
7232
7229
  <span class="__crossx-total-label">Total<br>(including fees)</span>
7233
7230
  <span class="__crossx-total-amount">${H(e.total)}</span>
7234
7231
  </div>` : "";
@@ -7240,7 +7237,7 @@ function Cn(r, e, s) {
7240
7237
  ${h}
7241
7238
  ${g}
7242
7239
  </div>
7243
- ${_}
7240
+ ${f}
7244
7241
  <button class="__crossx-approve-btn" id="__crossx-done-btn">${t ? "All Done" : "Done"}</button>
7245
7242
  `, a.querySelectorAll(".__crossx-copy-btn").forEach((w) => {
7246
7243
  w.addEventListener("click", (v) => {
@@ -7300,12 +7297,12 @@ function Dn(r, e) {
7300
7297
  <span class="__crossx-td-value">${H(o)}</span>
7301
7298
  </div>`;
7302
7299
  for (const [l, u] of Object.entries(i)) {
7303
- const h = Pn(u), _ = kn(u) ? `<span class="__crossx-addr-text">${se(u)}</span>
7300
+ const h = Pn(u), f = kn(u) ? `<span class="__crossx-addr-text">${se(u)}</span>
7304
7301
  <button class="__crossx-copy-btn" data-copy="${H(String(u))}" title="Copy">${xe}</button>` : `<span>${h}</span>`;
7305
7302
  a += `
7306
7303
  <div class="__crossx-td-row">
7307
7304
  <span class="__crossx-td-label">${H(l)}</span>
7308
- <div class="__crossx-td-value">${_}</div>
7305
+ <div class="__crossx-td-value">${f}</div>
7309
7306
  </div>`;
7310
7307
  }
7311
7308
  const c = document.createElement("div");
@@ -7598,7 +7595,7 @@ function zn(r) {
7598
7595
  function ot(r, e, s, t, n, o) {
7599
7596
  var V, W;
7600
7597
  let i = !!(o && o > Date.now()), a = !1;
7601
- const c = () => Array.from(r.querySelectorAll(".__crossx-pin6-box")), l = () => r.querySelector("#__crossx-pin6-boxes"), u = () => r.querySelector("#__crossx-pin6-error"), h = () => r.querySelector("#__crossx-pin6-lock-msg"), g = () => r.querySelector("#__crossx-pin6-lock-countdown"), _ = () => r.querySelector(".__crossx-pin6-body"), w = () => c().map((P) => P.value).join(""), v = (P) => {
7598
+ const c = () => Array.from(r.querySelectorAll(".__crossx-pin6-box")), l = () => r.querySelector("#__crossx-pin6-boxes"), u = () => r.querySelector("#__crossx-pin6-error"), h = () => r.querySelector("#__crossx-pin6-lock-msg"), g = () => r.querySelector("#__crossx-pin6-lock-countdown"), f = () => r.querySelector(".__crossx-pin6-body"), w = () => c().map((P) => P.value).join(""), v = (P) => {
7602
7599
  i = P, c().forEach((k) => {
7603
7600
  k.disabled = P, k.classList.toggle("--locked", P);
7604
7601
  });
@@ -7624,16 +7621,16 @@ function ot(r, e, s, t, n, o) {
7624
7621
  if (k && (k.textContent = "Too many failed attempts. Please wait."), !h()) {
7625
7622
  const A = document.createElement("p");
7626
7623
  A.className = "__crossx-pin6-lock-msg", A.id = "__crossx-pin6-lock-msg", A.innerHTML = `${Cs}<span id="__crossx-pin6-lock-countdown"></span>`;
7627
- const f = u();
7628
- f ? f.insertAdjacentElement("afterend", A) : (R = _()) == null || R.appendChild(A);
7624
+ const _ = u();
7625
+ _ ? _.insertAdjacentElement("afterend", A) : (R = f()) == null || R.appendChild(A);
7629
7626
  }
7630
7627
  const D = () => {
7631
7628
  var x;
7632
- const A = P - Date.now(), f = g();
7629
+ const A = P - Date.now(), _ = g();
7633
7630
  A <= 0 ? (clearInterval(q), v(!1), (x = h()) == null || x.remove(), k && (k.textContent = ""), setTimeout(() => {
7634
7631
  var b;
7635
7632
  return (b = c()[0]) == null ? void 0 : b.focus();
7636
- }, 50)) : f && (f.textContent = ` ${zn(A)}`);
7633
+ }, 50)) : _ && (_.textContent = ` ${zn(A)}`);
7637
7634
  }, q = setInterval(D, 1e3);
7638
7635
  D();
7639
7636
  const L = new MutationObserver(() => {
@@ -7673,7 +7670,7 @@ function ot(r, e, s, t, n, o) {
7673
7670
  };
7674
7671
  (V = l()) == null || V.addEventListener("click", (P) => {
7675
7672
  P.target.classList.contains("__crossx-pin6-box") || N();
7676
- }), (W = _()) == null || W.addEventListener("click", (P) => {
7673
+ }), (W = f()) == null || W.addEventListener("click", (P) => {
7677
7674
  const k = P.target;
7678
7675
  k.classList.contains("__crossx-pin6-box") || k.closest("button") || N();
7679
7676
  }), c().forEach((P, k) => {
@@ -7697,8 +7694,8 @@ function ot(r, e, s, t, n, o) {
7697
7694
  const q = (((R = D.clipboardData) == null ? void 0 : R.getData("text")) ?? "").replace(/\D/g, "").slice(0, 6);
7698
7695
  if (!q) return;
7699
7696
  const L = c();
7700
- q.split("").forEach((f, x) => {
7701
- L[x] && (L[x].value = f);
7697
+ q.split("").forEach((_, x) => {
7698
+ L[x] && (L[x].value = _);
7702
7699
  }), (A = L[Math.min(q.length - 1, 5)]) == null || A.focus(), y(), w().length === 6 && setTimeout(U, 80);
7703
7700
  }), P.addEventListener("focus", () => P.select());
7704
7701
  });
@@ -7728,8 +7725,8 @@ function Jn(r, e, s) {
7728
7725
  c.preventDefault();
7729
7726
  const l = (((h = c.clipboardData) == null ? void 0 : h.getData("text")) ?? "").replace(/\D/g, "").slice(0, 4);
7730
7727
  if (!l) return;
7731
- l.split("").forEach((g, _) => {
7732
- t[_] && (t[_].value = g);
7728
+ l.split("").forEach((g, f) => {
7729
+ t[f] && (t[f].value = g);
7733
7730
  });
7734
7731
  const u = Math.min(l.length, 3);
7735
7732
  t[u].focus(), l.length === 4 && setTimeout(() => e(l), 200);
@@ -7783,9 +7780,9 @@ class Xn {
7783
7780
  });
7784
7781
  });
7785
7782
  })();
7786
- const _ = i.querySelector("#__crossx-add-wallet-btn");
7787
- _ && _.addEventListener("click", async () => {
7788
- _.disabled = !0;
7783
+ const f = i.querySelector("#__crossx-add-wallet-btn");
7784
+ f && f.addEventListener("click", async () => {
7785
+ f.disabled = !0;
7789
7786
  try {
7790
7787
  const y = await s();
7791
7788
  o.push(y);
@@ -7796,7 +7793,7 @@ class Xn {
7796
7793
  }
7797
7794
  } catch {
7798
7795
  } finally {
7799
- _.disabled = !1;
7796
+ f.disabled = !1;
7800
7797
  }
7801
7798
  }), (v = i.querySelector("#__crossx-close-btn")) == null || v.addEventListener("click", h), i.addEventListener("click", (y) => {
7802
7799
  y.target === i && h();
@@ -7827,7 +7824,7 @@ class Xn {
7827
7824
  (c = t.querySelector("#__crossx-apple-btn")) == null || c.addEventListener("click", () => o("apple")), (l = t.querySelector("#__crossx-google-btn")) == null || l.addEventListener("click", () => o("google")), (u = t.querySelector("#__crossx-connect-btn")) == null || u.addEventListener("click", () => o("external")), (h = t.querySelector("#__crossx-close-btn")) == null || h.addEventListener("click", i), t.addEventListener("click", (g) => {
7828
7825
  g.target === t && i();
7829
7826
  }), t.querySelectorAll(".__crossx-login-terms-link").forEach((g) => {
7830
- g.addEventListener("click", (_) => _.stopPropagation());
7827
+ g.addEventListener("click", (f) => f.stopPropagation());
7831
7828
  });
7832
7829
  const a = (g) => {
7833
7830
  g.key === "Escape" && (document.removeEventListener("keydown", a), i());
@@ -7900,7 +7897,7 @@ class Xn {
7900
7897
  u(), s(C);
7901
7898
  }, g = () => {
7902
7899
  u(), s(null);
7903
- }, _ = a.querySelector(".__crossx-card"), w = {
7900
+ }, f = a.querySelector(".__crossx-card"), w = {
7904
7901
  tooShort: (t == null ? void 0 : t.pinValidation_tooShort) ?? "Please enter a 6-digit PIN.",
7905
7902
  numbersOnly: (t == null ? void 0 : t.pinValidation_numbersOnly) ?? "Only numbers (0-9) are allowed.",
7906
7903
  repeatingDigit: (t == null ? void 0 : t.pinValidation_repeatingDigit) ?? "Cannot use the same number 3+ times in a row.",
@@ -7908,27 +7905,27 @@ class Xn {
7908
7905
  alternatingPattern: (t == null ? void 0 : t.pinValidation_alternatingPattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
7909
7906
  }, v = (C) => {
7910
7907
  var U;
7911
- _.innerHTML = nt({
7908
+ f.innerHTML = nt({
7912
7909
  title: i.title,
7913
7910
  headerSubtitle: i.headerSubtitle
7914
- }), (U = _.querySelector("#__crossx-close-btn")) == null || U.addEventListener("click", g), ot(_, (N) => {
7911
+ }), (U = f.querySelector("#__crossx-close-btn")) == null || U.addEventListener("click", g), ot(f, (N) => {
7915
7912
  N === C ? h(C) : y(o.mismatchError);
7916
7913
  }, g);
7917
7914
  }, y = (C) => {
7918
7915
  var U;
7919
- _.innerHTML = nt({
7916
+ f.innerHTML = nt({
7920
7917
  title: o.title,
7921
7918
  headerSubtitle: o.headerSubtitle,
7922
7919
  subtitle: o.subtitle,
7923
7920
  errorMessage: C
7924
- }), (U = _.querySelector("#__crossx-close-btn")) == null || U.addEventListener("click", g), ot(_, (N) => {
7921
+ }), (U = f.querySelector("#__crossx-close-btn")) == null || U.addEventListener("click", g), ot(f, (N) => {
7925
7922
  const V = Vn(N, w);
7926
7923
  V ? y(V) : v(N);
7927
7924
  }, g);
7928
7925
  };
7929
7926
  (() => {
7930
7927
  var q;
7931
- const C = Array.from(_.querySelectorAll(".__crossx-pw-notice-item")), U = _.querySelector("#__crossx-pin-notice-next"), N = /* @__PURE__ */ new Set();
7928
+ const C = Array.from(f.querySelectorAll(".__crossx-pw-notice-item")), U = f.querySelector("#__crossx-pin-notice-next"), N = /* @__PURE__ */ new Set();
7932
7929
  U.removeAttribute("disabled");
7933
7930
  const V = U.dataset.nextLabel ?? "Next", W = U.dataset.submitLabel ?? "I Understand", P = () => {
7934
7931
  const L = N.size === C.length;
@@ -7955,15 +7952,15 @@ class Xn {
7955
7952
  return;
7956
7953
  }
7957
7954
  const L = C.find((A) => {
7958
- const f = parseInt(A.dataset.checkIndex ?? "0", 10);
7959
- return !N.has(f);
7955
+ const _ = parseInt(A.dataset.checkIndex ?? "0", 10);
7956
+ return !N.has(_);
7960
7957
  });
7961
7958
  if (!L) return;
7962
7959
  const R = parseInt(L.dataset.checkIndex ?? "0", 10);
7963
7960
  L.scrollIntoView({ behavior: "smooth", block: "nearest" }), L.classList.add("--highlight"), setTimeout(() => {
7964
7961
  L.classList.remove("--highlight"), k(L, R);
7965
7962
  }, 400);
7966
- }), (q = _.querySelector("#__crossx-close-btn")) == null || q.addEventListener("click", g);
7963
+ }), (q = f.querySelector("#__crossx-close-btn")) == null || q.addEventListener("click", g);
7967
7964
  })(), a.addEventListener("click", (C) => {
7968
7965
  C.target === a && g();
7969
7966
  });
@@ -7993,13 +7990,13 @@ class Xn {
7993
7990
  u || (u = !0, c.remove(), document.body.style.overflow = l);
7994
7991
  }, g = (S) => {
7995
7992
  h(), s(S);
7996
- }, _ = () => {
7993
+ }, f = () => {
7997
7994
  h(), s(null);
7998
7995
  }, w = (S) => {
7999
7996
  h(), t(S);
8000
7997
  }, v = c.querySelector(".__crossx-card");
8001
- (y = v.querySelector("#__crossx-close-btn")) == null || y.addEventListener("click", _), ot(v, g, _, w, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt), c.addEventListener("click", (S) => {
8002
- S.target === c && _();
7998
+ (y = v.querySelector("#__crossx-close-btn")) == null || y.addEventListener("click", f), ot(v, g, f, w, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt), c.addEventListener("click", (S) => {
7999
+ S.target === c && f();
8003
8000
  });
8004
8001
  });
8005
8002
  }
@@ -8121,8 +8118,8 @@ class Xn {
8121
8118
  h.addEventListener("click", (g) => {
8122
8119
  var w;
8123
8120
  g.stopPropagation();
8124
- const _ = h.dataset.copy;
8125
- _ && ((w = navigator.clipboard) == null || w.writeText(_).catch(() => {
8121
+ const f = h.dataset.copy;
8122
+ f && ((w = navigator.clipboard) == null || w.writeText(f).catch(() => {
8126
8123
  }));
8127
8124
  });
8128
8125
  }), t.addEventListener("click", (h) => {
@@ -8183,7 +8180,7 @@ function so(r, e) {
8183
8180
  u,
8184
8181
  h
8185
8182
  ));
8186
- const _ = new De(n, c), w = new Xn(r.theme ?? "light", r.themeTokens), v = e != null && e.wrapConfirmation ? e.wrapConfirmation(w) : w;
8183
+ const f = new De(n, c), w = new Xn(r.theme ?? "light", r.themeTokens), v = e != null && e.wrapConfirmation ? e.wrapConfirmation(w) : w;
8187
8184
  return new it(
8188
8185
  t,
8189
8186
  n,
@@ -8194,7 +8191,7 @@ function so(r, e) {
8194
8191
  g,
8195
8192
  u,
8196
8193
  v,
8197
- _,
8194
+ f,
8198
8195
  h
8199
8196
  );
8200
8197
  }