@nexus-cross/crossx-sdk-core 1.4.2 → 1.4.3

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
@@ -1,6 +1,6 @@
1
1
  var Us = Object.defineProperty;
2
2
  var Hs = (r, e, s) => e in r ? Us(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
3
- var R = (r, e, s) => Hs(r, typeof e != "symbol" ? e + "" : e, s);
3
+ var k = (r, e, s) => Hs(r, typeof e != "symbol" ? e + "" : e, s);
4
4
  import { createRemoteJWKSet as Fs, jwtVerify as Gs, decodeJwt as Ws } from "jose";
5
5
  var h = /* @__PURE__ */ ((r) => (r.AUTH_NOT_INITIALIZED = "AUTH_NOT_INITIALIZED", r.AUTH_FAILED = "AUTH_FAILED", r.AUTH_TOKEN_INVALID = "AUTH_TOKEN_INVALID", r.AUTH_TOKEN_EXPIRED = "AUTH_TOKEN_EXPIRED", r.AUTH_NOT_AUTHENTICATED = "AUTH_NOT_AUTHENTICATED", r.ALREADY_AUTHENTICATED = "ALREADY_AUTHENTICATED", r.SESSION_EXPIRED = "SESSION_EXPIRED", r.OAUTH_POPUP_BLOCKED = "OAUTH_POPUP_BLOCKED", r.WALLET_NOT_FOUND = "WALLET_NOT_FOUND", r.WALLET_CREATION_FAILED = "WALLET_CREATION_FAILED", r.WALLET_ALREADY_EXISTS = "WALLET_ALREADY_EXISTS", r.SIGN_FAILED = "SIGN_FAILED", r.SIGN_REJECTED = "SIGN_REJECTED", r.TX_FAILED = "TX_FAILED", r.TX_REJECTED = "TX_REJECTED", r.BROADCAST_FAILED = "BROADCAST_FAILED", r.USER_REJECTED = "USER_REJECTED", r.TX_INVALID_PARAMS = "TX_INVALID_PARAMS", r.NETWORK_ERROR = "NETWORK_ERROR", r.NETWORK_NOT_CONFIGURED = "NETWORK_NOT_CONFIGURED", r.INVALID_CHAIN = "INVALID_CHAIN", r.CHAIN_NOT_SUPPORTED = "CHAIN_NOT_SUPPORTED", r.CHAIN_ADAPTER_NOT_FOUND = "CHAIN_ADAPTER_NOT_FOUND", r.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", r.SIGNATURE_FAILED = "SIGNATURE_FAILED", r.TRANSACTION_FAILED = "TRANSACTION_FAILED", r.PREPARE_FAILED = "PREPARE_FAILED", r.PREPARE_EXPIRED = "PREPARE_EXPIRED", r.PREPARE_MISMATCH = "PREPARE_MISMATCH", r.MIGRATION_FAILED = "MIGRATION_FAILED", r.MIGRATION_BACKUP_EXISTS = "MIGRATION_BACKUP_EXISTS", r.MIGRATION_PIN_LOCKED = "MIGRATION_PIN_LOCKED", r.GATEWAY_INTERNAL_ERROR = "GATEWAY_INTERNAL_ERROR", r.GATEWAY_LOCK_CONFLICT = "GATEWAY_LOCK_CONFLICT", r.WALLET_INCONSISTENT_STATE = "WALLET_INCONSISTENT_STATE", r.PROJECT_ID_MISSING = "PROJECT_ID_MISSING", r.ORIGIN_NOT_ALLOWED = "ORIGIN_NOT_ALLOWED", r.APP_IDENTIFIER_MISSING = "APP_IDENTIFIER_MISSING", r.INVALID_APP_TYPE = "INVALID_APP_TYPE", r.PROJECT_NOT_REGISTERED = "PROJECT_NOT_REGISTERED", r.SIGNATURE_SIGNER_MISMATCH = "SIGNATURE_SIGNER_MISMATCH", r.GAS_ESTIMATION_FAILED = "GAS_ESTIMATION_FAILED", r.TYPED_DATA_CHAIN_ID_MISMATCH = "TYPED_DATA_CHAIN_ID_MISMATCH", r.PIN_NOT_SET = "PIN_NOT_SET", r.PIN_WRONG = "PIN_WRONG", r.PIN_INVALID = "PIN_INVALID", r.PIN_REPEATED_PATTERN = "PIN_REPEATED_PATTERN", r.PIN_CANCELLED = "PIN_CANCELLED", r.EXTERNAL_WALLET_REQUESTED = "EXTERNAL_WALLET_REQUESTED", r.PIN_LOCKED = "PIN_LOCKED", r.HMAC_REQUIRED = "HMAC_REQUIRED", r.HMAC_VERIFICATION_FAILED = "HMAC_VERIFICATION_FAILED", r.WITHDRAW_FAILED = "WITHDRAW_FAILED", r.USER_NOT_FOUND = "USER_NOT_FOUND", r.INVALID_CONFIG = "INVALID_CONFIG", r.UNKNOWN_ERROR = "UNKNOWN_ERROR", r))(h || {});
6
6
  class g extends Error {
@@ -265,7 +265,7 @@ const d = {
265
265
  // ── PIN 잠금 안내 ─────────────────────────────────────────────
266
266
  pinLocked_message: "잠금이 해제된 후 다시 시도해 주세요.",
267
267
  pinLocked_availableFrom: "이용 가능 시간",
268
- pinLocked_failureWarning: "PIN이 올바르지 않습니다. 추가 실패 시 계정이 잠금됩니다.",
268
+ pinLocked_failureWarning: "추가 실패 시 계정이 잠금됩니다.",
269
269
  pinLocked_permanent: "너무 많은 시도 실패로 계정이 영구 잠금되었습니다.",
270
270
  alert_sessionExpired: "세션이 만료되었습니다. 다시 로그인해 주세요.",
271
271
  alert_accountWithdrawn: "계정이 탈퇴 처리되었거나 더 이상 사용할 수 없습니다. 다시 로그인해 주세요.",
@@ -345,7 +345,7 @@ const d = {
345
345
  // ── PIN lock message ─────────────────────────────────────────
346
346
  pinLocked_message: "Please try again after the lock expires.",
347
347
  pinLocked_availableFrom: "Available from",
348
- pinLocked_failureWarning: "Incorrect PIN. Your account will be locked after further failures.",
348
+ pinLocked_failureWarning: "Your account will be locked after further failures.",
349
349
  pinLocked_permanent: "Your account has been permanently locked due to too many failed attempts.",
350
350
  alert_sessionExpired: "Your session has expired. Please sign in again.",
351
351
  alert_accountWithdrawn: "This account is no longer available or has been withdrawn. Please sign in again.",
@@ -448,50 +448,50 @@ const Rt = "crossx_access_token", kt = "crossx_refresh_token", Ot = "crossx_user
448
448
  var i, o, a, c, l;
449
449
  let t, n = !1;
450
450
  try {
451
- const { authApiUrl: u } = this.config, { accessToken: p, refreshToken: _ } = await this.exchangeFirebaseToken(e, u);
452
- let f, w, S;
451
+ const { authApiUrl: u } = this.config, { accessToken: f, refreshToken: x } = await this.exchangeFirebaseToken(e, u);
452
+ let _, y, v;
453
453
  try {
454
- const I = this.crypto.decodeJWT(e);
455
- d.log("[CROSSx] Firebase JWT 필드:", Object.keys(I).join(", ")), w = (i = I.firebase) == null ? void 0 : i.sign_in_provider;
456
- const P = ((o = I.firebase) == null ? void 0 : o.identities) ?? {};
457
- S = I.email ?? ((a = P.email) == null ? void 0 : a[0]), w === "google.com" ? f = (c = P["google.com"]) == null ? void 0 : c[0] : w === "apple.com" && (f = (l = P["apple.com"]) == null ? void 0 : l[0]), d.log("[CROSSx] OAuth provider sub 추출 — provider:", w, "hasProviderSub:", !!f, "email:", S ?? "(없음)");
454
+ const A = this.crypto.decodeJWT(e);
455
+ d.log("[CROSSx] Firebase JWT 필드:", Object.keys(A).join(", ")), y = (i = A.firebase) == null ? void 0 : i.sign_in_provider;
456
+ const T = ((o = A.firebase) == null ? void 0 : o.identities) ?? {};
457
+ v = A.email ?? ((a = T.email) == null ? void 0 : a[0]), y === "google.com" ? _ = (c = T["google.com"]) == null ? void 0 : c[0] : y === "apple.com" && (_ = (l = T["apple.com"]) == null ? void 0 : l[0]), d.log("[CROSSx] OAuth provider sub 추출 — provider:", y, "hasProviderSub:", !!_, "email:", v ?? "(없음)");
458
458
  } catch {
459
459
  d.warn("[CROSSx] firebaseToken에서 providerSub 추출 실패");
460
460
  }
461
- if (p) {
462
- const I = this.crypto.decodeJWT(p);
463
- d.log("[CROSSx] access_token 디코딩 — sub:", I.sub, "exp:", I.exp, "필드:", Object.keys(I).join(", "));
464
- const P = await this.crypto.verifyJWT(p);
465
- if (n = P.signatureVerified ?? !1, !P.valid)
461
+ if (f) {
462
+ const A = this.crypto.decodeJWT(f);
463
+ d.log("[CROSSx] access_token 디코딩 — sub:", A.sub, "exp:", A.exp, "필드:", Object.keys(A).join(", "));
464
+ const T = await this.crypto.verifyJWT(f);
465
+ if (n = T.signatureVerified ?? !1, !T.valid)
466
466
  throw d.error("[CROSSx] access_token 검증 실패"), new Error("유효하지 않은 access token");
467
- const H = P.payload, D = H.email ?? S ?? s;
467
+ const H = T.payload, L = H.email ?? v ?? s;
468
468
  d.log(
469
469
  "[CROSSx] email 소스 — CROSSx JWT:",
470
470
  H.email ?? "(없음)",
471
471
  "/ Firebase JWT:",
472
- S ?? "(없음)",
472
+ v ?? "(없음)",
473
473
  "/ OAuth 콜백:",
474
474
  s ?? "(없음)",
475
475
  "→",
476
- D ?? "(없음)"
476
+ L ?? "(없음)"
477
477
  ), t = {
478
478
  id: H.sub,
479
- email: D,
480
- signInProvider: w,
481
- providerSub: f
482
- }, this.tokenStore.set(p), this.useCookieAuth || (await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, p), _ && this.config.secureStorageAvailable !== !1 ? await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, _) : _ && d.warn("[CROSSx] 안전한 스토리지 미사용 — refresh_token 영속 저장을 건너뜁니다"));
479
+ email: L,
480
+ signInProvider: y,
481
+ providerSub: _
482
+ }, this.tokenStore.set(f), this.useCookieAuth || (await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, f), x && this.config.secureStorageAvailable !== !1 ? await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, x) : x && d.warn("[CROSSx] 안전한 스토리지 미사용 — refresh_token 영속 저장을 건너뜁니다"));
483
483
  } else {
484
- const I = this.crypto.decodeJWT(e);
484
+ const A = this.crypto.decodeJWT(e);
485
485
  t = {
486
- id: I.sub,
487
- email: I.email ?? s,
488
- signInProvider: w,
489
- providerSub: f
486
+ id: A.sub,
487
+ email: A.email ?? s,
488
+ signInProvider: y,
489
+ providerSub: _
490
490
  }, d.log("[CROSSx] Cookie 모드 — Firebase 토큰에서 사용자 정보 추출 — id:", t.id);
491
491
  }
492
492
  d.log("[CROSSx] 사용자 정보 — id:", t.id, "email:", t.email ?? "(없음)");
493
- const y = this.useCookieAuth ? { id: t.id, email: t.email, signInProvider: t.signInProvider, providerSub: t.providerSub } : t;
494
- await this.storage.set(this.STORAGE_KEY_USER, y), d.log("[CROSSx] 사용자 정보 저장 완료 (authMode:", this.useCookieAuth ? "cookie" : "token", ")");
493
+ const S = this.useCookieAuth ? { id: t.id, email: t.email, signInProvider: t.signInProvider, providerSub: t.providerSub } : t;
494
+ await this.storage.set(this.STORAGE_KEY_USER, S), d.log("[CROSSx] 사용자 정보 저장 완료 (authMode:", this.useCookieAuth ? "cookie" : "token", ")");
495
495
  } catch (u) {
496
496
  return d.error("[CROSSx] SignIn 에러 (토큰 교환 단계):", u), {
497
497
  success: !1,
@@ -938,10 +938,10 @@ function De(r) {
938
938
  const s = r.substring(0, e), t = r.substring(e);
939
939
  return s.length <= 1 ? `${s}***${t}` : `${s[0]}***${t}`;
940
940
  }
941
- const te = class te extends Zs {
942
- constructor(e, s, t, n, i, o, a, c, l, u, p) {
943
- var _, f;
944
- super(), this.storage = t, this.crypto = n, this.transport = i, this.oauth = o, this.walletProvider = a, this.tokenStore = c, this.initialized = !1, this._initPromise = null, this.authenticated = !1, this.userId = null, this.address = null, this.activeWalletIndex = 0, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._verifyPinMutex = null, this._themeMediaCleanup = null, this._isRecoveringSession = !1, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = s, e.logger && Tt(e.logger), this.confirmation = l, this.pinStore = p ?? new is(), this.chainRegistry = u, this.jsonRpc = new Js(u, i), this.signInUseCase = new dt(
941
+ const ee = class ee extends Zs {
942
+ constructor(e, s, t, n, i, o, a, c, l, u, f) {
943
+ var x, _;
944
+ super(), this.storage = t, this.crypto = n, this.transport = i, this.oauth = o, this.walletProvider = a, this.tokenStore = c, this.initialized = !1, this._initPromise = null, this.authenticated = !1, this.userId = null, this.address = null, this.activeWalletIndex = 0, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._verifyPinMutex = null, this._themeMediaCleanup = null, this._isRecoveringSession = !1, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = s, e.logger && Tt(e.logger), this.confirmation = l, this.pinStore = f ?? new is(), this.chainRegistry = u, this.jsonRpc = new Js(u, i), this.signInUseCase = new dt(
945
945
  this.internalConfig,
946
946
  t,
947
947
  n,
@@ -949,7 +949,7 @@ const te = class te extends Zs {
949
949
  i,
950
950
  a,
951
951
  c
952
- ), this.signOutUseCase = new Ys(this.internalConfig, t, c), this.migrateWalletUseCase = new Xs(t, a), (_ = a.setOnUnauthorized) == null || _.call(a, () => this.forceLogout()), (f = a.setTokenRefresher) == null || f.call(
952
+ ), this.signOutUseCase = new Ys(this.internalConfig, t, c), this.migrateWalletUseCase = new Xs(t, a), (x = a.setOnUnauthorized) == null || x.call(a, () => this.forceLogout()), (_ = a.setTokenRefresher) == null || _.call(
953
953
  a,
954
954
  () => this.signInUseCase.refreshAccessToken()
955
955
  ), e.autoDetectTheme && this._setupAutoDetectTheme();
@@ -978,7 +978,7 @@ const te = class te extends Zs {
978
978
  }
979
979
  async _doInitialize(e) {
980
980
  var s, t;
981
- d.log("[CROSSx SDK] v1.4.2 초기화 중..."), this.confirmation.setMessages(fe(this._config.locale));
981
+ d.log("[CROSSx SDK] v1.4.3 초기화 중..."), this.confirmation.setMessages(fe(this._config.locale));
982
982
  try {
983
983
  const n = er();
984
984
  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`);
@@ -993,7 +993,7 @@ const te = class te extends Zs {
993
993
  d.log("[CROSSx] initialize: 비밀번호 입력 취소 — 지갑 미로드 상태로 계속");
994
994
  }
995
995
  }
996
- return this.initialized = !0, d.info("[CROSSx SDK] v1.4.2 초기화 완료"), this.emit("initialized", { restored: !!(i != null && i.success) }), i ?? null;
996
+ return this.initialized = !0, d.info("[CROSSx SDK] v1.4.3 초기화 완료"), this.emit("initialized", { restored: !!(i != null && i.success) }), i ?? null;
997
997
  } catch (n) {
998
998
  throw new g(h.AUTH_NOT_INITIALIZED, "SDK 초기화에 실패했습니다", n);
999
999
  }
@@ -1562,7 +1562,7 @@ const te = class te extends Zs {
1562
1562
  throw new g(h.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1563
1563
  if (!this.walletProvider.signTypedData)
1564
1564
  throw new g(h.NOT_IMPLEMENTED, "signTypedData가 구현되어 있지 않습니다");
1565
- te.validateTypedDataChainId(e, s);
1565
+ ee.validateTypedDataChainId(e, s);
1566
1566
  const n = await this.resolveAddress(t == null ? void 0 : t.index);
1567
1567
  if (!await this.confirmation.requestConfirmation({
1568
1568
  type: "sign-typed-data",
@@ -1585,7 +1585,7 @@ const te = class te extends Zs {
1585
1585
  n.address
1586
1586
  );
1587
1587
  });
1588
- return te.validateSignatureFormat(o.signature), {
1588
+ return ee.validateSignatureFormat(o.signature), {
1589
1589
  chainId: e,
1590
1590
  signature: o.signature,
1591
1591
  address: n.address
@@ -1614,7 +1614,7 @@ const te = class te extends Zs {
1614
1614
  * });
1615
1615
  */
1616
1616
  async signTypedDataOffchain(e, s) {
1617
- return this.signTypedData(te.OFFCHAIN_CHAIN_ID, e, s);
1617
+ return this.signTypedData(ee.OFFCHAIN_CHAIN_ID, e, s);
1618
1618
  }
1619
1619
  // ============================================================================
1620
1620
  // 트랜잭션
@@ -1662,7 +1662,7 @@ const te = class te extends Zs {
1662
1662
  c
1663
1663
  );
1664
1664
  });
1665
- return te.validateSignedTxFormat(a.signature), {
1665
+ return ee.validateSignedTxFormat(a.signature), {
1666
1666
  chainId: e,
1667
1667
  signedTx: a.signature,
1668
1668
  txHash: a.txHash ?? ""
@@ -1786,37 +1786,37 @@ const te = class te extends Zs {
1786
1786
  * logger.log(receipt.status); // '0x1' | '0x0'
1787
1787
  */
1788
1788
  async sendTransactionWithWaitForReceipt(e, s, t = {}) {
1789
- var S, y;
1790
- const { intervalMs: n, timeoutMs: i, ...o } = t, { txHash: a } = await this.sendTransaction(e, s, o), c = n ?? ((S = this._config.receiptPolling) == null ? void 0 : S.intervalMs) ?? tr, l = i ?? ((y = this._config.receiptPolling) == null ? void 0 : y.timeoutMs) ?? Pt, u = et(e), p = s.from ?? "";
1791
- let _, f;
1792
- const w = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((I) => {
1793
- _ = I;
1794
- const P = BigInt(I.gasUsed) * BigInt(I.effectiveGasPrice), H = s.value ? BigInt(s.value) : 0n, D = te.formatTxAmount(s.value, u.symbol, u.decimals), K = te.formatTxAmount("0x" + P.toString(16), u.symbol, u.decimals), G = te.formatTxAmount("0x" + (H + P).toString(16), u.symbol, u.decimals);
1789
+ var v, S;
1790
+ const { intervalMs: n, timeoutMs: i, ...o } = t, { txHash: a } = await this.sendTransaction(e, s, o), c = n ?? ((v = this._config.receiptPolling) == null ? void 0 : v.intervalMs) ?? tr, l = i ?? ((S = this._config.receiptPolling) == null ? void 0 : S.timeoutMs) ?? Pt, u = et(e), f = s.from ?? "";
1791
+ let x, _;
1792
+ const y = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((A) => {
1793
+ x = A;
1794
+ const T = BigInt(A.gasUsed) * BigInt(A.effectiveGasPrice), H = s.value ? BigInt(s.value) : 0n, L = ee.formatTxAmount(s.value, u.symbol, u.decimals), V = ee.formatTxAmount("0x" + T.toString(16), u.symbol, u.decimals), F = ee.formatTxAmount("0x" + (H + T).toString(16), u.symbol, u.decimals);
1795
1795
  return {
1796
1796
  chainId: e,
1797
1797
  txHash: a,
1798
- from: I.from,
1799
- to: I.to ?? s.to,
1800
- amount: D,
1801
- fees: K,
1802
- total: G,
1798
+ from: A.from,
1799
+ to: A.to ?? s.to,
1800
+ amount: L,
1801
+ fees: V,
1802
+ total: F,
1803
1803
  nativeSymbol: u.symbol,
1804
- status: I.status === "0x1" ? "success" : "reverted"
1804
+ status: A.status === "0x1" ? "success" : "reverted"
1805
1805
  };
1806
- }).catch((I) => (f = I instanceof Error ? I : new Error(String(I)), {
1806
+ }).catch((A) => (_ = A instanceof Error ? A : new Error(String(A)), {
1807
1807
  chainId: e,
1808
1808
  txHash: a,
1809
- from: p,
1809
+ from: f,
1810
1810
  to: s.to,
1811
- amount: te.formatTxAmount(s.value, u.symbol, u.decimals),
1811
+ amount: ee.formatTxAmount(s.value, u.symbol, u.decimals),
1812
1812
  nativeSymbol: u.symbol,
1813
1813
  status: "timeout"
1814
1814
  }));
1815
1815
  if (await this.confirmation.showTransactionProgress(
1816
- { chainId: e, txHash: a, from: p, to: s.to },
1817
- w
1818
- ), f) throw f;
1819
- return { chainId: e, txHash: a, receipt: _ };
1816
+ { chainId: e, txHash: a, from: f, to: s.to },
1817
+ y
1818
+ ), _) throw _;
1819
+ return { chainId: e, txHash: a, receipt: x };
1820
1820
  }
1821
1821
  // ============================================================================
1822
1822
  // PIN 관리 (공개 API)
@@ -1986,7 +1986,7 @@ const te = class te extends Zs {
1986
1986
  return { wei: "0x0", formatted: "0", chainId: e };
1987
1987
  try {
1988
1988
  const n = await this.jsonRpc.call("eth_getBalance", [s, "latest"], e) ?? "0x0";
1989
- return { wei: n, formatted: te.formatWei(n), chainId: e };
1989
+ return { wei: n, formatted: ee.formatWei(n), chainId: e };
1990
1990
  } catch (t) {
1991
1991
  if (t instanceof g) throw t;
1992
1992
  const n = t instanceof Error ? t.message : String(t);
@@ -2082,82 +2082,82 @@ const te = class te extends Zs {
2082
2082
  `[CROSSx][Migration Phase 4] PIN 입력 팝업 표시 (시도 #${i}/${o})`,
2083
2083
  n ? `— 이전 메시지: ${n}` : ""
2084
2084
  );
2085
- const p = await this.confirmation.showRecoveryPinInputPrompt({
2085
+ const f = await this.confirmation.showRecoveryPinInputPrompt({
2086
2086
  errorMessage: n,
2087
2087
  attemptCount: i > 1 ? i - 1 : void 0,
2088
2088
  maxAttempts: o
2089
2089
  });
2090
- if (p === null)
2090
+ if (f === null)
2091
2091
  return d.log("[CROSSx][Migration Phase 4] 사용자가 PIN 입력을 취소함 → 종료"), null;
2092
2092
  d.log("[CROSSx][Migration Phase 4] PIN 입력 완료 — verify-recovery-pin API 호출"), n = void 0;
2093
2093
  try {
2094
- const _ = await ((u = (l = this.walletProvider).verifyRecoveryPin) == null ? void 0 : u.call(l, p, e));
2095
- if (!_) {
2096
- d.log("[CROSSx][Migration Phase 4] verifyRecoveryPin 미지원 — PIN 검증 생략"), a = p;
2094
+ const x = await ((u = (l = this.walletProvider).verifyRecoveryPin) == null ? void 0 : u.call(l, f, e));
2095
+ if (!x) {
2096
+ d.log("[CROSSx][Migration Phase 4] verifyRecoveryPin 미지원 — PIN 검증 생략"), a = f;
2097
2097
  break;
2098
2098
  }
2099
- if (_.valid) {
2100
- d.log("[CROSSx][Migration Phase 4] PIN 검증 성공"), a = p;
2099
+ if (x.valid) {
2100
+ d.log("[CROSSx][Migration Phase 4] PIN 검증 성공"), a = f;
2101
2101
  break;
2102
2102
  }
2103
- const f = _.pinStatus;
2104
- if (o = f.maxAttempts, i = o - f.remainingAttempts, f.remainingAttempts === 0 && f.lockExpiresAt) {
2105
- const w = f.lockExpiresAt * 1e3, S = Math.max(1, Math.round((w - Date.now()) / 1e3)), y = S <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
2106
- d.warn(`[CROSSx][Migration Phase 4] verify-recovery-pin 잠금 — ${S}초, 메시지: ${y}`), await this.confirmation.showRecoveryPinLockedPrompt(S, y), i = 0, n = "Your account lock has been lifted. You may try again.";
2103
+ const _ = x.pinStatus;
2104
+ if (o = _.maxAttempts, i = o - _.remainingAttempts, _.remainingAttempts === 0 && _.lockExpiresAt) {
2105
+ const y = _.lockExpiresAt * 1e3, v = Math.max(1, Math.round((y - Date.now()) / 1e3)), S = v <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
2106
+ d.warn(`[CROSSx][Migration Phase 4] verify-recovery-pin 잠금 — ${v}초, 메시지: ${S}`), await this.confirmation.showRecoveryPinLockedPrompt(v, S), i = 0, n = "Your account lock has been lifted. You may try again.";
2107
2107
  } else
2108
2108
  d.warn(`[CROSSx][Migration Phase 4] PIN 불일치 (시도 ${i}/${o})`), n = "Incorrect PIN.";
2109
- } catch (_) {
2110
- if (!(_ instanceof g)) throw _;
2111
- if (_.code === h.SESSION_EXPIRED) {
2109
+ } catch (x) {
2110
+ if (!(x instanceof g)) throw x;
2111
+ if (x.code === h.SESSION_EXPIRED) {
2112
2112
  d.warn("[CROSSx][Migration Phase 4] 세션 만료 — 재로그인 후 PIN 입력 재시도");
2113
- const f = fe(this._config.locale ?? "en");
2113
+ const _ = fe(this._config.locale ?? "en");
2114
2114
  if (await this.confirmation.showSessionAlert({
2115
- title: f.sessionAlert_title,
2116
- message: f.alert_sessionExpired,
2115
+ title: _.sessionAlert_title,
2116
+ message: _.alert_sessionExpired,
2117
2117
  email: this.userEmail ? De(this.userEmail) : void 0
2118
2118
  }) === "signin-again" && (await this.signInAgain()).success) {
2119
2119
  d.log("[CROSSx][Migration Phase 4] 재로그인 성공 — PIN 입력 루프 계속"), i--;
2120
2120
  continue;
2121
2121
  }
2122
- throw this.clearAuthState(), _;
2122
+ throw this.clearAuthState(), x;
2123
2123
  }
2124
- if (_.code === h.MIGRATION_PIN_LOCKED) {
2125
- const f = _.details;
2126
- if (o = (f == null ? void 0 : f.maxAttempts) ?? 5, (f == null ? void 0 : f.permanent) === !0)
2124
+ if (x.code === h.MIGRATION_PIN_LOCKED) {
2125
+ const _ = x.details;
2126
+ if (o = (_ == null ? void 0 : _.maxAttempts) ?? 5, (_ == null ? void 0 : _.permanent) === !0)
2127
2127
  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;
2128
- const w = ((f == null ? void 0 : f.lockExpiresAt) ?? 0) * 1e3, S = Math.max(1, Math.round((w - Date.now()) / 1e3)), y = S <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
2129
- d.warn(`[CROSSx][Migration Phase 4] verify-recovery-pin 이미 잠금 — ${S}초`), await this.confirmation.showRecoveryPinLockedPrompt(S, y), i = 0, n = "Your account lock has been lifted. You may try again.";
2128
+ const y = ((_ == null ? void 0 : _.lockExpiresAt) ?? 0) * 1e3, v = Math.max(1, Math.round((y - Date.now()) / 1e3)), S = v <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
2129
+ d.warn(`[CROSSx][Migration Phase 4] verify-recovery-pin 이미 잠금 — ${v}초`), await this.confirmation.showRecoveryPinLockedPrompt(v, S), i = 0, n = "Your account lock has been lifted. You may try again.";
2130
2130
  } else
2131
- throw d.error("[CROSSx][Migration Phase 4] verify-recovery-pin 실패 (복구 불가):", _), _;
2131
+ throw d.error("[CROSSx][Migration Phase 4] verify-recovery-pin 실패 (복구 불가):", x), x;
2132
2132
  }
2133
2133
  }
2134
2134
  d.log("[CROSSx][Migration Phase 5] PIN 검증 완료 — 비밀번호 설정 및 마이그레이션 진행");
2135
2135
  try {
2136
2136
  await this.ensurePinSetup();
2137
- const p = await this.migrateWalletUseCase.execute(a, e);
2138
- return d.log("[CROSSx][Migration Phase 5] 마이그레이션 성공 — address:", p.address), p;
2139
- } catch (p) {
2140
- if (p instanceof g && p.code === h.MIGRATION_FAILED)
2137
+ const f = await this.migrateWalletUseCase.execute(a, e);
2138
+ return d.log("[CROSSx][Migration Phase 5] 마이그레이션 성공 — address:", f.address), f;
2139
+ } catch (f) {
2140
+ if (f instanceof g && f.code === h.MIGRATION_FAILED)
2141
2141
  return d.warn("[CROSSx][Migration Phase 5] migrate PIN 불일치 (경합) — 처음부터 재시도"), this.handleMigrationFlow(e);
2142
- if (p instanceof g && p.code === h.SESSION_EXPIRED) {
2142
+ if (f instanceof g && f.code === h.SESSION_EXPIRED) {
2143
2143
  d.warn("[CROSSx][Migration Phase 5] 세션 만료 — 재로그인 후 마이그레이션 재시도");
2144
- const _ = fe(this._config.locale ?? "en");
2144
+ const x = fe(this._config.locale ?? "en");
2145
2145
  if (await this.confirmation.showSessionAlert({
2146
- title: _.sessionAlert_title,
2147
- message: _.alert_sessionExpired,
2146
+ title: x.sessionAlert_title,
2147
+ message: x.alert_sessionExpired,
2148
2148
  email: this.userEmail ? De(this.userEmail) : void 0
2149
2149
  }) === "signin-again" && (await this.signInAgain()).success) {
2150
2150
  d.log("[CROSSx][Migration Phase 5] 재로그인 성공 — 마이그레이션 재시도 (검증된 PIN 유지)");
2151
2151
  try {
2152
- const S = await this.migrateWalletUseCase.execute(a, e);
2153
- return d.log("[CROSSx][Migration Phase 5] 마이그레이션 재시도 성공 — address:", S.address), S;
2154
- } catch (S) {
2155
- throw d.error("[CROSSx][Migration Phase 5] 마이그레이션 재시도 실패:", S), S;
2152
+ const v = await this.migrateWalletUseCase.execute(a, e);
2153
+ return d.log("[CROSSx][Migration Phase 5] 마이그레이션 재시도 성공 — address:", v.address), v;
2154
+ } catch (v) {
2155
+ throw d.error("[CROSSx][Migration Phase 5] 마이그레이션 재시도 실패:", v), v;
2156
2156
  }
2157
2157
  }
2158
- throw this.clearAuthState(), p;
2158
+ throw this.clearAuthState(), f;
2159
2159
  }
2160
- throw d.error("[CROSSx][Migration Phase 5] 마이그레이션 실패 (복구 불가):", p), p;
2160
+ throw d.error("[CROSSx][Migration Phase 5] 마이그레이션 실패 (복구 불가):", f), f;
2161
2161
  }
2162
2162
  }
2163
2163
  /**
@@ -2173,20 +2173,20 @@ const te = class te extends Zs {
2173
2173
  * jsonRpc 서비스를 통해 nonce 및 가스 파라미터를 자동 조회합니다.
2174
2174
  */
2175
2175
  async withResolvedGasAndFee(e, s) {
2176
- const t = (f) => !(f != null && f.trim()), n = e.nonce === void 0 || e.nonce === null, i = t(e.gasLimit), o = t(e.gasPrice) && t(e.maxFeePerGas), a = !t(e.maxFeePerGas) && t(e.maxPriorityFeePerGas);
2176
+ const t = (_) => !(_ != null && _.trim()), n = e.nonce === void 0 || e.nonce === null, i = t(e.gasLimit), o = t(e.gasPrice) && t(e.maxFeePerGas), a = !t(e.maxFeePerGas) && t(e.maxPriorityFeePerGas);
2177
2177
  if (!n && !i && !o && !a) return e;
2178
2178
  const c = { ...e }, l = n ? c.from ?? this.address : void 0;
2179
2179
  l && d.log("[CROSSx] nonce 비어있음 → eth_getTransactionCount 호출 (from:", l, ")"), i && d.log("[CROSSx] gasLimit 비어있음 → eth_estimateGas 호출"), o && d.log("[CROSSx] gasPrice & maxFeePerGas 비어있음 → baseFee 조회로 Dynamic/Legacy 판별");
2180
- const [u, p, _] = await Promise.all([
2180
+ const [u, f, x] = await Promise.all([
2181
2181
  l ? this.jsonRpc.call("eth_getTransactionCount", [l, "pending"], s) : null,
2182
2182
  i ? this.estimateGas(e, s) : null,
2183
2183
  o ? this.getBaseFeePerGas(s) : null
2184
2184
  ]);
2185
- if (l && (c.nonce = parseInt(u ?? "0x0", 16), d.log("[CROSSx] nonce 결과:", c.nonce)), i && (c.gasLimit = p, d.log("[CROSSx] estimateGas 결과:", c.gasLimit)), o) {
2186
- const f = _;
2187
- if (f) {
2188
- const w = Ct;
2189
- c.maxFeePerGas = "0x" + (BigInt(f) + BigInt(w)).toString(16), c.maxPriorityFeePerGas = w, d.log("[CROSSx] Dynamic 체인 감지 — baseFee:", f, "maxFeePerGas:", c.maxFeePerGas, "maxPriorityFeePerGas: 1 Gwei");
2185
+ if (l && (c.nonce = parseInt(u ?? "0x0", 16), d.log("[CROSSx] nonce 결과:", c.nonce)), i && (c.gasLimit = f, d.log("[CROSSx] estimateGas 결과:", c.gasLimit)), o) {
2186
+ const _ = x;
2187
+ if (_) {
2188
+ const y = Ct;
2189
+ c.maxFeePerGas = "0x" + (BigInt(_) + BigInt(y)).toString(16), c.maxPriorityFeePerGas = y, d.log("[CROSSx] Dynamic 체인 감지 — baseFee:", _, "maxFeePerGas:", c.maxFeePerGas, "maxPriorityFeePerGas: 1 Gwei");
2190
2190
  } else
2191
2191
  c.gasPrice = nr, d.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
2192
2192
  }
@@ -2199,7 +2199,7 @@ const te = class te extends Zs {
2199
2199
  * - chainId가 '0' → domain.chainId가 없거나 0이어야 함
2200
2200
  */
2201
2201
  static validateTypedDataChainId(e, s) {
2202
- const t = te.extractDomainChainId(s);
2202
+ const t = ee.extractDomainChainId(s);
2203
2203
  if (e === "0") {
2204
2204
  if (t !== void 0 && t !== 0)
2205
2205
  throw new g(
@@ -2278,7 +2278,7 @@ const te = class te extends Zs {
2278
2278
  /** AuthResult를 내부 상태에 반영합니다. */
2279
2279
  applyAuthResult(e) {
2280
2280
  var s, t, n, i;
2281
- this.authenticated = e.success, this.userId = ((s = e.user) == null ? void 0 : s.id) ?? null, this.address = e.address ?? null, this.activeWalletIndex = 0, this.userEmail = ((t = e.user) == null ? void 0 : t.email) ?? null, this.providerSub = ((n = e.user) == null ? void 0 : n.providerSub) ?? null, this.loginType = te.normalizeLoginType((i = e.user) == null ? void 0 : i.signInProvider), this.tokenSignatureVerified = e.tokenSignatureVerified ?? !1, this._isRecoveringSession || this.emit("authChanged", {
2281
+ this.authenticated = e.success, this.userId = ((s = e.user) == null ? void 0 : s.id) ?? null, this.address = e.address ?? null, this.activeWalletIndex = 0, this.userEmail = ((t = e.user) == null ? void 0 : t.email) ?? null, this.providerSub = ((n = e.user) == null ? void 0 : n.providerSub) ?? null, this.loginType = ee.normalizeLoginType((i = e.user) == null ? void 0 : i.signInProvider), this.tokenSignatureVerified = e.tokenSignatureVerified ?? !1, this._isRecoveringSession || this.emit("authChanged", {
2282
2282
  isAuthenticated: this.authenticated,
2283
2283
  address: this.address,
2284
2284
  userId: this.userId
@@ -2324,8 +2324,8 @@ const te = class te extends Zs {
2324
2324
  let a;
2325
2325
  try {
2326
2326
  a = await this.signInUseCase.execute(o);
2327
- } catch (p) {
2328
- throw this.clearAuthState(), p;
2327
+ } catch (f) {
2328
+ throw this.clearAuthState(), f;
2329
2329
  }
2330
2330
  if (!a.success)
2331
2331
  return this.clearAuthState(), a;
@@ -2333,10 +2333,10 @@ const te = class te extends Zs {
2333
2333
  if (!(e ? !!c && c === e : s ? !!l && s === l : !0)) {
2334
2334
  d.warn("[CROSSx] signInAgain: providerSub/userId 불일치 — 잘못된 계정으로 로그인됨"), await this.signOutUseCase.execute().catch(() => {
2335
2335
  });
2336
- const p = fe(this._config.locale ?? "en");
2336
+ const f = fe(this._config.locale ?? "en");
2337
2337
  return await this.confirmation.showSessionAlert({
2338
- title: p.sessionAlert_title,
2339
- message: p.alert_differentAccount,
2338
+ title: f.sessionAlert_title,
2339
+ message: f.alert_differentAccount,
2340
2340
  email: this.userEmail ? De(this.userEmail) : void 0
2341
2341
  }) === "signin-again" ? (this._isRecoveringSession = !1, this.signInAgain()) : (this.clearAuthState(), { success: !1, error: "Different account signed in" });
2342
2342
  }
@@ -2492,7 +2492,7 @@ const te = class te extends Zs {
2492
2492
  if (u.code === h.PIN_INVALID)
2493
2493
  return { ok: !1, error: u.message };
2494
2494
  if (u.code === h.PIN_LOCKED)
2495
- return te.buildPinLockedResult(u, a);
2495
+ return ee.buildPinLockedResult(u, a);
2496
2496
  }
2497
2497
  throw u;
2498
2498
  }
@@ -2531,7 +2531,7 @@ const te = class te extends Zs {
2531
2531
  const n = t.maxAttempts - t.remainingAttempts;
2532
2532
  return {
2533
2533
  ok: !1,
2534
- error: s.pinLocked_failureWarning,
2534
+ error: s.pinInput_error,
2535
2535
  attemptCount: n,
2536
2536
  maxAttempts: t.maxAttempts
2537
2537
  };
@@ -2586,7 +2586,7 @@ const te = class te extends Zs {
2586
2586
  return t = c.message, n = void 0, i = void 0, o = void 0, !0;
2587
2587
  if (c.code === h.PIN_LOCKED) {
2588
2588
  const l = c.details;
2589
- return l != null && l.permanent ? (t = s.pinLocked_permanent, n = void 0, i = void 0, o = void 0) : (l == null ? void 0 : l.remainingAttempts) != null && l.remainingAttempts > 0 && l.maxAttempts ? (t = s.pinLocked_failureWarning, n = void 0, i = l.maxAttempts - l.remainingAttempts, o = l.maxAttempts) : (t = "Too many failed attempts. Your account is temporarily locked.", n = l == null ? void 0 : l.lockExpiresAt, i = void 0, o = void 0), !0;
2589
+ return l != null && l.permanent ? (t = s.pinLocked_permanent, n = void 0, i = void 0, o = void 0) : (l == null ? void 0 : l.remainingAttempts) != null && l.remainingAttempts > 0 && l.maxAttempts ? (t = s.pinInput_error, n = void 0, i = l.maxAttempts - l.remainingAttempts, o = l.maxAttempts) : (t = "Too many failed attempts. Your account is temporarily locked.", n = l == null ? void 0 : l.lockExpiresAt, i = void 0, o = void 0), !0;
2590
2590
  }
2591
2591
  return !1;
2592
2592
  };
@@ -2662,8 +2662,8 @@ const te = class te extends Zs {
2662
2662
  };
2663
2663
  }
2664
2664
  };
2665
- te.OFFCHAIN_CHAIN_ID = "0";
2666
- let ut = te;
2665
+ ee.OFFCHAIN_CHAIN_ID = "0";
2666
+ let ut = ee;
2667
2667
  class ar {
2668
2668
  constructor() {
2669
2669
  this.prefix = "crossx_";
@@ -2857,7 +2857,7 @@ function we(r, e = "") {
2857
2857
  throw new Error(`${s}expected integer >= 0, got ${r}`);
2858
2858
  }
2859
2859
  }
2860
- function q(r, e, s = "") {
2860
+ function W(r, e, s = "") {
2861
2861
  const t = xt(r), n = r == null ? void 0 : r.length, i = e !== void 0;
2862
2862
  if (!t || i && n !== e) {
2863
2863
  const o = s && `"${s}" `, a = i ? ` of length ${e}` : "", c = t ? `length=${n}` : `type=${typeof r}`;
@@ -2877,7 +2877,7 @@ function Ce(r, e = !0) {
2877
2877
  throw new Error("Hash#digest() has already been called");
2878
2878
  }
2879
2879
  function as(r, e) {
2880
- q(r, void 0, "digestInto() output");
2880
+ W(r, void 0, "digestInto() output");
2881
2881
  const s = e.outputLen;
2882
2882
  if (r.length < s)
2883
2883
  throw new Error('"digestInto() output" expected to be of length >=' + s);
@@ -2906,7 +2906,7 @@ function pr(r) {
2906
2906
  }
2907
2907
  const Bt = ur ? (r) => r : pr, cs = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", fr = /* @__PURE__ */ Array.from({ length: 256 }, (r, e) => e.toString(16).padStart(2, "0"));
2908
2908
  function Ue(r) {
2909
- if (q(r), cs)
2909
+ if (W(r), cs)
2910
2910
  return r.toHex();
2911
2911
  let e = "";
2912
2912
  for (let s = 0; s < r.length; s++)
@@ -2945,7 +2945,7 @@ function ve(...r) {
2945
2945
  let e = 0;
2946
2946
  for (let t = 0; t < r.length; t++) {
2947
2947
  const n = r[t];
2948
- q(n), e += n.length;
2948
+ W(n), e += n.length;
2949
2949
  }
2950
2950
  const s = new Uint8Array(e);
2951
2951
  for (let t = 0, n = 0; t < r.length; t++) {
@@ -2975,21 +2975,21 @@ function gr(r, e, s) {
2975
2975
  }
2976
2976
  class mr {
2977
2977
  constructor(e, s, t, n) {
2978
- R(this, "blockLen");
2979
- R(this, "outputLen");
2980
- R(this, "padOffset");
2981
- R(this, "isLE");
2978
+ k(this, "blockLen");
2979
+ k(this, "outputLen");
2980
+ k(this, "padOffset");
2981
+ k(this, "isLE");
2982
2982
  // For partial updates less than block size
2983
- R(this, "buffer");
2984
- R(this, "view");
2985
- R(this, "finished", !1);
2986
- R(this, "length", 0);
2987
- R(this, "pos", 0);
2988
- R(this, "destroyed", !1);
2983
+ k(this, "buffer");
2984
+ k(this, "view");
2985
+ k(this, "finished", !1);
2986
+ k(this, "length", 0);
2987
+ k(this, "pos", 0);
2988
+ k(this, "destroyed", !1);
2989
2989
  this.blockLen = e, this.outputLen = s, this.padOffset = t, this.isLE = n, this.buffer = new Uint8Array(e), this.view = st(this.buffer);
2990
2990
  }
2991
2991
  update(e) {
2992
- Ce(this), q(e);
2992
+ Ce(this), W(e);
2993
2993
  const { view: s, buffer: t, blockLen: n } = this, i = e.length;
2994
2994
  for (let o = 0; o < i; ) {
2995
2995
  const a = Math.min(n - this.pos, i - o);
@@ -3008,8 +3008,8 @@ class mr {
3008
3008
  const { buffer: s, view: t, blockLen: n, isLE: i } = this;
3009
3009
  let { pos: o } = this;
3010
3010
  s[o++] = 128, Ne(this.buffer.subarray(o)), this.padOffset > n - o && (this.process(t, 0), o = 0);
3011
- for (let p = o; p < n; p++)
3012
- s[p] = 0;
3011
+ for (let f = o; f < n; f++)
3012
+ s[f] = 0;
3013
3013
  t.setBigUint64(n - 8, BigInt(this.length * 8), i), this.process(t, 0);
3014
3014
  const a = st(e), c = this.outputLen;
3015
3015
  if (c % 4)
@@ -3017,8 +3017,8 @@ class mr {
3017
3017
  const l = c / 4, u = this.get();
3018
3018
  if (l > u.length)
3019
3019
  throw new Error("_sha2: outputLen bigger than state");
3020
- for (let p = 0; p < l; p++)
3021
- a.setUint32(4 * p, u[p], i);
3020
+ for (let f = 0; f < l; f++)
3021
+ a.setUint32(4 * f, u[f], i);
3022
3022
  }
3023
3023
  digest() {
3024
3024
  const { buffer: e, outputLen: s } = this;
@@ -3136,16 +3136,16 @@ class Ar extends mr {
3136
3136
  this.A = e | 0, this.B = s | 0, this.C = t | 0, this.D = n | 0, this.E = i | 0, this.F = o | 0, this.G = a | 0, this.H = c | 0;
3137
3137
  }
3138
3138
  process(e, s) {
3139
- for (let p = 0; p < 16; p++, s += 4)
3140
- be[p] = e.getUint32(s, !1);
3141
- for (let p = 16; p < 64; p++) {
3142
- const _ = be[p - 15], f = be[p - 2], w = pe(_, 7) ^ pe(_, 18) ^ _ >>> 3, S = pe(f, 17) ^ pe(f, 19) ^ f >>> 10;
3143
- be[p] = S + be[p - 7] + w + be[p - 16] | 0;
3139
+ for (let f = 0; f < 16; f++, s += 4)
3140
+ be[f] = e.getUint32(s, !1);
3141
+ for (let f = 16; f < 64; f++) {
3142
+ const x = be[f - 15], _ = be[f - 2], y = pe(x, 7) ^ pe(x, 18) ^ x >>> 3, v = pe(_, 17) ^ pe(_, 19) ^ _ >>> 10;
3143
+ be[f] = v + be[f - 7] + y + be[f - 16] | 0;
3144
3144
  }
3145
3145
  let { A: t, B: n, C: i, D: o, E: a, F: c, G: l, H: u } = this;
3146
- for (let p = 0; p < 64; p++) {
3147
- const _ = pe(a, 6) ^ pe(a, 11) ^ pe(a, 25), f = u + _ + xr(a, c, l) + Ir[p] + be[p] | 0, S = (pe(t, 2) ^ pe(t, 13) ^ pe(t, 22)) + gr(t, n, i) | 0;
3148
- u = l, l = c, c = a, a = o + f | 0, o = i, i = n, n = t, t = f + S | 0;
3146
+ for (let f = 0; f < 64; f++) {
3147
+ const x = pe(a, 6) ^ pe(a, 11) ^ pe(a, 25), _ = u + x + xr(a, c, l) + Ir[f] + be[f] | 0, v = (pe(t, 2) ^ pe(t, 13) ^ pe(t, 22)) + gr(t, n, i) | 0;
3148
+ u = l, l = c, c = a, a = o + _ | 0, o = i, i = n, n = t, t = _ + v | 0;
3149
3149
  }
3150
3150
  t = t + this.A | 0, n = n + this.B | 0, i = i + this.C | 0, o = o + 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, i, o, a, c, l, u);
3151
3151
  }
@@ -3161,14 +3161,14 @@ class Tr extends Ar {
3161
3161
  super(32);
3162
3162
  // We cannot use array here since array allows indexing by variable
3163
3163
  // which means optimizer/compiler cannot use registers.
3164
- R(this, "A", ye[0] | 0);
3165
- R(this, "B", ye[1] | 0);
3166
- R(this, "C", ye[2] | 0);
3167
- R(this, "D", ye[3] | 0);
3168
- R(this, "E", ye[4] | 0);
3169
- R(this, "F", ye[5] | 0);
3170
- R(this, "G", ye[6] | 0);
3171
- R(this, "H", ye[7] | 0);
3164
+ k(this, "A", ye[0] | 0);
3165
+ k(this, "B", ye[1] | 0);
3166
+ k(this, "C", ye[2] | 0);
3167
+ k(this, "D", ye[3] | 0);
3168
+ k(this, "E", ye[4] | 0);
3169
+ k(this, "F", ye[5] | 0);
3170
+ k(this, "G", ye[6] | 0);
3171
+ k(this, "H", ye[7] | 0);
3172
3172
  }
3173
3173
  }
3174
3174
  const Rr = /* @__PURE__ */ ls(
@@ -3205,7 +3205,7 @@ function Je(r) {
3205
3205
  return hs(Ue(r));
3206
3206
  }
3207
3207
  function ps(r) {
3208
- return hs(Ue(kr(q(r)).reverse()));
3208
+ return hs(Ue(kr(W(r)).reverse()));
3209
3209
  }
3210
3210
  function mt(r, e) {
3211
3211
  we(e), r = us(r);
@@ -3238,30 +3238,30 @@ const wt = (r) => (ht << BigInt(r)) - ht;
3238
3238
  function Nr(r, e, s) {
3239
3239
  if (we(r, "hashLen"), we(e, "qByteLen"), typeof s != "function")
3240
3240
  throw new Error("hmacFn must be a function");
3241
- const t = (y) => new Uint8Array(y), n = Uint8Array.of(), i = Uint8Array.of(0), o = Uint8Array.of(1), a = 1e3;
3241
+ const t = (S) => new Uint8Array(S), n = Uint8Array.of(), i = Uint8Array.of(0), o = Uint8Array.of(1), a = 1e3;
3242
3242
  let c = t(r), l = t(r), u = 0;
3243
- const p = () => {
3243
+ const f = () => {
3244
3244
  c.fill(1), l.fill(0), u = 0;
3245
- }, _ = (...y) => s(l, ve(c, ...y)), f = (y = n) => {
3246
- l = _(i, y), c = _(), y.length !== 0 && (l = _(o, y), c = _());
3247
- }, w = () => {
3245
+ }, x = (...S) => s(l, ve(c, ...S)), _ = (S = n) => {
3246
+ l = x(i, S), c = x(), S.length !== 0 && (l = x(o, S), c = x());
3247
+ }, y = () => {
3248
3248
  if (u++ >= a)
3249
3249
  throw new Error("drbg: tried max amount of iterations");
3250
- let y = 0;
3251
- const I = [];
3252
- for (; y < e; ) {
3253
- c = _();
3254
- const P = c.slice();
3255
- I.push(P), y += c.length;
3256
- }
3257
- return ve(...I);
3250
+ let S = 0;
3251
+ const A = [];
3252
+ for (; S < e; ) {
3253
+ c = x();
3254
+ const T = c.slice();
3255
+ A.push(T), S += c.length;
3256
+ }
3257
+ return ve(...A);
3258
3258
  };
3259
- return (y, I) => {
3260
- p(), f(y);
3261
- let P;
3262
- for (; !(P = I(w())); )
3263
- f();
3264
- return p(), P;
3259
+ return (S, A) => {
3260
+ f(), _(S);
3261
+ let T;
3262
+ for (; !(T = A(y())); )
3263
+ _();
3264
+ return f(), T;
3265
3265
  };
3266
3266
  }
3267
3267
  function yt(r, e = {}, s = {}) {
@@ -3289,7 +3289,7 @@ function Ft(r) {
3289
3289
  };
3290
3290
  }
3291
3291
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3292
- const ne = /* @__PURE__ */ BigInt(0), se = /* @__PURE__ */ BigInt(1), Te = /* @__PURE__ */ BigInt(2), _s = /* @__PURE__ */ BigInt(3), xs = /* @__PURE__ */ BigInt(4), gs = /* @__PURE__ */ BigInt(5), Lr = /* @__PURE__ */ BigInt(7), ms = /* @__PURE__ */ BigInt(8), Dr = /* @__PURE__ */ BigInt(9), ws = /* @__PURE__ */ BigInt(16);
3292
+ const ne = /* @__PURE__ */ BigInt(0), te = /* @__PURE__ */ BigInt(1), Te = /* @__PURE__ */ BigInt(2), _s = /* @__PURE__ */ BigInt(3), xs = /* @__PURE__ */ BigInt(4), gs = /* @__PURE__ */ BigInt(5), Lr = /* @__PURE__ */ BigInt(7), ms = /* @__PURE__ */ BigInt(8), Dr = /* @__PURE__ */ BigInt(9), ws = /* @__PURE__ */ BigInt(16);
3293
3293
  function ue(r, e) {
3294
3294
  const s = r % e;
3295
3295
  return s >= ne ? s : e + s;
@@ -3305,12 +3305,12 @@ function Gt(r, e) {
3305
3305
  throw new Error("invert: expected non-zero number");
3306
3306
  if (e <= ne)
3307
3307
  throw new Error("invert: expected positive modulus, got " + e);
3308
- let s = ue(r, e), t = e, n = ne, i = se;
3308
+ let s = ue(r, e), t = e, n = ne, i = te;
3309
3309
  for (; s !== ne; ) {
3310
3310
  const a = t / s, c = t % s, l = n - i * a;
3311
3311
  t = s, s = c, n = i, i = l;
3312
3312
  }
3313
- if (t !== se)
3313
+ if (t !== te)
3314
3314
  throw new Error("invert: does not exist");
3315
3315
  return ue(n, e);
3316
3316
  }
@@ -3319,7 +3319,7 @@ function bt(r, e, s) {
3319
3319
  throw new Error("Cannot find square root");
3320
3320
  }
3321
3321
  function ys(r, e) {
3322
- const s = (r.ORDER + se) / xs, t = r.pow(e, s);
3322
+ const s = (r.ORDER + te) / xs, t = r.pow(e, s);
3323
3323
  return bt(r, t, e), t;
3324
3324
  }
3325
3325
  function Mr(r, e) {
@@ -3330,16 +3330,16 @@ function $r(r) {
3330
3330
  const e = Ze(r), s = bs(r), t = s(e, e.neg(e.ONE)), n = s(e, t), i = s(e, e.neg(t)), o = (r + Lr) / ws;
3331
3331
  return (a, c) => {
3332
3332
  let l = a.pow(c, o), u = a.mul(l, t);
3333
- const p = a.mul(l, n), _ = a.mul(l, i), f = a.eql(a.sqr(u), c), w = a.eql(a.sqr(p), c);
3334
- l = a.cmov(l, u, f), u = a.cmov(_, p, w);
3335
- const S = a.eql(a.sqr(u), c), y = a.cmov(l, u, S);
3336
- return bt(a, y, c), y;
3333
+ const f = a.mul(l, n), x = a.mul(l, i), _ = a.eql(a.sqr(u), c), y = a.eql(a.sqr(f), c);
3334
+ l = a.cmov(l, u, _), u = a.cmov(x, f, y);
3335
+ const v = a.eql(a.sqr(u), c), S = a.cmov(l, u, v);
3336
+ return bt(a, S, c), S;
3337
3337
  };
3338
3338
  }
3339
3339
  function bs(r) {
3340
3340
  if (r < _s)
3341
3341
  throw new Error("sqrt is not defined for small field");
3342
- let e = r - se, s = 0;
3342
+ let e = r - te, s = 0;
3343
3343
  for (; e % Te === ne; )
3344
3344
  e /= Te, s++;
3345
3345
  let t = Te;
@@ -3350,24 +3350,24 @@ function bs(r) {
3350
3350
  if (s === 1)
3351
3351
  return ys;
3352
3352
  let i = n.pow(t, e);
3353
- const o = (e + se) / Te;
3353
+ const o = (e + te) / Te;
3354
3354
  return function(c, l) {
3355
3355
  if (c.is0(l))
3356
3356
  return l;
3357
3357
  if (Wt(c, l) !== 1)
3358
3358
  throw new Error("Cannot find square root");
3359
- let u = s, p = c.mul(c.ONE, i), _ = c.pow(l, e), f = c.pow(l, o);
3360
- for (; !c.eql(_, c.ONE); ) {
3361
- if (c.is0(_))
3359
+ let u = s, f = c.mul(c.ONE, i), x = c.pow(l, e), _ = c.pow(l, o);
3360
+ for (; !c.eql(x, c.ONE); ) {
3361
+ if (c.is0(x))
3362
3362
  return c.ZERO;
3363
- let w = 1, S = c.sqr(_);
3364
- for (; !c.eql(S, c.ONE); )
3365
- if (w++, S = c.sqr(S), w === u)
3363
+ let y = 1, v = c.sqr(x);
3364
+ for (; !c.eql(v, c.ONE); )
3365
+ if (y++, v = c.sqr(v), y === u)
3366
3366
  throw new Error("Cannot find square root");
3367
- const y = se << BigInt(u - w - 1), I = c.pow(p, y);
3368
- u = w, p = c.sqr(I), _ = c.mul(_, p), f = c.mul(f, I);
3367
+ const S = te << BigInt(u - y - 1), A = c.pow(f, S);
3368
+ u = y, f = c.sqr(A), x = c.mul(x, f), _ = c.mul(_, A);
3369
3369
  }
3370
- return f;
3370
+ return _;
3371
3371
  };
3372
3372
  }
3373
3373
  function Br(r) {
@@ -3405,11 +3405,11 @@ function Fr(r, e, s) {
3405
3405
  throw new Error("invalid exponent, negatives unsupported");
3406
3406
  if (s === ne)
3407
3407
  return r.ONE;
3408
- if (s === se)
3408
+ if (s === te)
3409
3409
  return e;
3410
3410
  let t = r.ONE, n = e;
3411
3411
  for (; s > ne; )
3412
- s & se && (t = r.mul(t, n)), n = r.sqr(n), s >>= se;
3412
+ s & te && (t = r.mul(t, n)), n = r.sqr(n), s >>= te;
3413
3413
  return t;
3414
3414
  }
3415
3415
  function Ss(r, e, s = !1) {
@@ -3417,7 +3417,7 @@ function Ss(r, e, s = !1) {
3417
3417
  return e.reduceRight((o, a, c) => r.is0(a) ? o : (t[c] = r.mul(o, t[c]), r.mul(o, a)), i), t;
3418
3418
  }
3419
3419
  function Wt(r, e) {
3420
- const s = (r.ORDER - se) / Te, t = r.pow(e, s), n = r.eql(t, r.ONE), i = r.eql(t, r.ZERO), o = r.eql(t, r.neg(r.ONE));
3420
+ const s = (r.ORDER - te) / Te, t = r.pow(e, s), n = r.eql(t, r.ONE), i = r.eql(t, r.ZERO), o = r.eql(t, r.neg(r.ONE));
3421
3421
  if (!n && !i && !o)
3422
3422
  throw new Error("invalid Legendre symbol result");
3423
3423
  return n ? 1 : i ? 0 : -1;
@@ -3429,16 +3429,16 @@ function Gr(r, e) {
3429
3429
  }
3430
3430
  class Wr {
3431
3431
  constructor(e, s = {}) {
3432
- R(this, "ORDER");
3433
- R(this, "BITS");
3434
- R(this, "BYTES");
3435
- R(this, "isLE");
3436
- R(this, "ZERO", ne);
3437
- R(this, "ONE", se);
3438
- R(this, "_lengths");
3439
- R(this, "_sqrt");
3432
+ k(this, "ORDER");
3433
+ k(this, "BITS");
3434
+ k(this, "BYTES");
3435
+ k(this, "isLE");
3436
+ k(this, "ZERO", ne);
3437
+ k(this, "ONE", te);
3438
+ k(this, "_lengths");
3439
+ k(this, "_sqrt");
3440
3440
  // cached sqrt
3441
- R(this, "_mod");
3441
+ k(this, "_mod");
3442
3442
  var o;
3443
3443
  if (e <= ne)
3444
3444
  throw new Error("invalid field: expected ORDER > 0, got " + e);
@@ -3465,7 +3465,7 @@ class Wr {
3465
3465
  return !this.is0(e) && this.isValid(e);
3466
3466
  }
3467
3467
  isOdd(e) {
3468
- return (e & se) === se;
3468
+ return (e & te) === te;
3469
3469
  }
3470
3470
  neg(e) {
3471
3471
  return ue(-e, this.ORDER);
@@ -3514,7 +3514,7 @@ class Wr {
3514
3514
  return this.isLE ? fs(e, this.BYTES) : mt(e, this.BYTES);
3515
3515
  }
3516
3516
  fromBytes(e, s = !1) {
3517
- q(e);
3517
+ W(e);
3518
3518
  const { _lengths: t, BYTES: n, isLE: i, ORDER: o, _mod: a } = this;
3519
3519
  if (t) {
3520
3520
  if (!t.includes(e.length) || e.length > n)
@@ -3553,11 +3553,11 @@ function Es(r) {
3553
3553
  return e + Math.ceil(e / 2);
3554
3554
  }
3555
3555
  function qr(r, e, s = !1) {
3556
- q(r);
3556
+ W(r);
3557
3557
  const t = r.length, n = vs(e), i = Es(e);
3558
3558
  if (t < 16 || t < i || t > 1024)
3559
3559
  throw new Error("expected " + i + "-1024 bytes of input, got " + t);
3560
- const o = s ? ps(r) : Je(r), a = ue(o, e - se) + se;
3560
+ const o = s ? ps(r) : Je(r), a = ue(o, e - te) + te;
3561
3561
  return s ? fs(a, n) : mt(a, n);
3562
3562
  }
3563
3563
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
@@ -3583,8 +3583,8 @@ function Kt(r, e, s) {
3583
3583
  const { windowSize: t, mask: n, maxNumber: i, shiftBy: o } = s;
3584
3584
  let a = Number(r & n), c = r >> o;
3585
3585
  a > t && (a -= i, c += Re);
3586
- const l = e * t, u = l + Math.abs(a) - 1, p = a === 0, _ = a < 0, f = e % 2 !== 0;
3587
- return { nextN: c, offset: u, isZero: p, isNeg: _, isNegF: f, offsetF: l };
3586
+ const l = e * t, u = l + Math.abs(a) - 1, f = a === 0, x = a < 0, _ = e % 2 !== 0;
3587
+ return { nextN: c, offset: u, isZero: f, isNeg: x, isNegF: _, offsetF: l };
3588
3588
  }
3589
3589
  const nt = /* @__PURE__ */ new WeakMap(), As = /* @__PURE__ */ new WeakMap();
3590
3590
  function it(r) {
@@ -3597,10 +3597,10 @@ function Vt(r) {
3597
3597
  class Kr {
3598
3598
  // Parametrized with a given Point class (not individual point)
3599
3599
  constructor(e, s) {
3600
- R(this, "BASE");
3601
- R(this, "ZERO");
3602
- R(this, "Fn");
3603
- R(this, "bits");
3600
+ k(this, "BASE");
3601
+ k(this, "ZERO");
3602
+ k(this, "Fn");
3603
+ k(this, "bits");
3604
3604
  this.BASE = e.BASE, this.ZERO = e.ZERO, this.Fn = e.Fn, this.bits = s;
3605
3605
  }
3606
3606
  // non-const time multiplication ladder
@@ -3645,8 +3645,8 @@ class Kr {
3645
3645
  let n = this.ZERO, i = this.BASE;
3646
3646
  const o = rt(e, this.bits);
3647
3647
  for (let a = 0; a < o.windows; a++) {
3648
- const { nextN: c, offset: l, isZero: u, isNeg: p, isNegF: _, offsetF: f } = Kt(t, a, o);
3649
- t = c, u ? i = i.add(je(_, s[f])) : n = n.add(je(p, s[l]));
3648
+ const { nextN: c, offset: l, isZero: u, isNeg: f, isNegF: x, offsetF: _ } = Kt(t, a, o);
3649
+ t = c, u ? i = i.add(je(x, s[_])) : n = n.add(je(f, s[l]));
3650
3650
  }
3651
3651
  return Vt(t), { p: n, f: i };
3652
3652
  }
@@ -3660,8 +3660,8 @@ class Kr {
3660
3660
  for (let o = 0; o < i.windows && t !== Le; o++) {
3661
3661
  const { nextN: a, offset: c, isZero: l, isNeg: u } = Kt(t, o, i);
3662
3662
  if (t = a, !l) {
3663
- const p = s[c];
3664
- n = n.add(u ? p.negate() : p);
3663
+ const f = s[c];
3664
+ n = n.add(u ? f.negate() : f);
3665
3665
  }
3666
3666
  }
3667
3667
  return Vt(t), n;
@@ -3724,13 +3724,13 @@ function jr(r, e) {
3724
3724
  }
3725
3725
  class Ts {
3726
3726
  constructor(e, s) {
3727
- R(this, "oHash");
3728
- R(this, "iHash");
3729
- R(this, "blockLen");
3730
- R(this, "outputLen");
3731
- R(this, "finished", !1);
3732
- R(this, "destroyed", !1);
3733
- if (os(e), q(s, void 0, "key"), this.iHash = e.create(), typeof this.iHash.update != "function")
3727
+ k(this, "oHash");
3728
+ k(this, "iHash");
3729
+ k(this, "blockLen");
3730
+ k(this, "outputLen");
3731
+ k(this, "finished", !1);
3732
+ k(this, "destroyed", !1);
3733
+ if (os(e), W(s, void 0, "key"), this.iHash = e.create(), typeof this.iHash.update != "function")
3734
3734
  throw new Error("Expected instance of class which extends utils.Hash");
3735
3735
  this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
3736
3736
  const t = this.blockLen, n = new Uint8Array(t);
@@ -3746,7 +3746,7 @@ class Ts {
3746
3746
  return Ce(this), this.iHash.update(e), this;
3747
3747
  }
3748
3748
  digestInto(e) {
3749
- Ce(this), q(e, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
3749
+ Ce(this), W(e, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
3750
3750
  }
3751
3751
  digest() {
3752
3752
  const e = new Uint8Array(this.oHash.outputLen);
@@ -3771,12 +3771,12 @@ const jt = (r, e) => (r + (r >= 0 ? e : -e) / ks) / e;
3771
3771
  function Yr(r, e, s) {
3772
3772
  const [[t, n], [i, o]] = e, a = jt(o * r, s), c = jt(-n * r, s);
3773
3773
  let l = r - a * t - c * i, u = -a * n - c * o;
3774
- const p = l < ge, _ = u < ge;
3775
- p && (l = -l), _ && (u = -u);
3776
- const f = wt(Math.ceil(Cr(s) / 2)) + Pe;
3777
- if (l < ge || l >= f || u < ge || u >= f)
3774
+ const f = l < ge, x = u < ge;
3775
+ f && (l = -l), x && (u = -u);
3776
+ const _ = wt(Math.ceil(Cr(s) / 2)) + Pe;
3777
+ if (l < ge || l >= _ || u < ge || u >= _)
3778
3778
  throw new Error("splitScalar (endomorphism): failed, k=" + r);
3779
- return { k1neg: p, k1: l, k2neg: _, k2: u };
3779
+ return { k1neg: f, k1: l, k2neg: x, k2: u };
3780
3780
  }
3781
3781
  function pt(r) {
3782
3782
  if (!["compact", "recovered", "der"].includes(r))
@@ -3869,7 +3869,7 @@ const Se = {
3869
3869
  }
3870
3870
  },
3871
3871
  toSig(r) {
3872
- const { Err: e, _int: s, _tlv: t } = Se, n = q(r, void 0, "signature"), { v: i, l: o } = t.decode(48, n);
3872
+ const { Err: e, _int: s, _tlv: t } = Se, n = W(r, void 0, "signature"), { v: i, l: o } = t.decode(48, n);
3873
3873
  if (o.length)
3874
3874
  throw new e("invalid signature: left bytes after parsing");
3875
3875
  const { v: a, l: c } = t.decode(2, i), { v: l, l: u } = t.decode(2, c);
@@ -3902,125 +3902,125 @@ function Zr(r, e = {}) {
3902
3902
  if (!t.isOdd)
3903
3903
  throw new Error("compression is not supported: Field does not have .isOdd()");
3904
3904
  }
3905
- function p(T, x, m) {
3906
- const { x: b, y: A } = x.toAffine(), N = t.toBytes(b);
3907
- if (ze(m, "isCompressed"), m) {
3905
+ function f(D, w, p) {
3906
+ const { x: m, y: b } = w.toAffine(), I = t.toBytes(m);
3907
+ if (ze(p, "isCompressed"), p) {
3908
3908
  u();
3909
- const C = !t.isOdd(A);
3910
- return ve(Os(C), N);
3909
+ const R = !t.isOdd(b);
3910
+ return ve(Os(R), I);
3911
3911
  } else
3912
- return ve(Uint8Array.of(4), N, t.toBytes(A));
3913
- }
3914
- function _(T) {
3915
- q(T, void 0, "Point");
3916
- const { publicKey: x, publicKeyUncompressed: m } = l, b = T.length, A = T[0], N = T.subarray(1);
3917
- if (b === x && (A === 2 || A === 3)) {
3918
- const C = t.fromBytes(N);
3919
- if (!t.isValid(C))
3912
+ return ve(Uint8Array.of(4), I, t.toBytes(b));
3913
+ }
3914
+ function x(D) {
3915
+ W(D, void 0, "Point");
3916
+ const { publicKey: w, publicKeyUncompressed: p } = l, m = D.length, b = D[0], I = D.subarray(1);
3917
+ if (m === w && (b === 2 || b === 3)) {
3918
+ const R = t.fromBytes(I);
3919
+ if (!t.isValid(R))
3920
3920
  throw new Error("bad point: is not on curve, wrong x");
3921
- const M = S(C);
3922
- let O;
3921
+ const O = v(R);
3922
+ let E;
3923
3923
  try {
3924
- O = t.sqrt(M);
3925
- } catch (Y) {
3926
- const W = Y instanceof Error ? ": " + Y.message : "";
3927
- throw new Error("bad point: is not on curve, sqrt error" + W);
3924
+ E = t.sqrt(O);
3925
+ } catch (q) {
3926
+ const G = q instanceof Error ? ": " + q.message : "";
3927
+ throw new Error("bad point: is not on curve, sqrt error" + G);
3928
3928
  }
3929
3929
  u();
3930
- const $ = t.isOdd(O);
3931
- return (A & 1) === 1 !== $ && (O = t.neg(O)), { x: C, y: O };
3932
- } else if (b === m && A === 4) {
3933
- const C = t.BYTES, M = t.fromBytes(N.subarray(0, C)), O = t.fromBytes(N.subarray(C, C * 2));
3934
- if (!y(M, O))
3930
+ const C = t.isOdd(E);
3931
+ return (b & 1) === 1 !== C && (E = t.neg(E)), { x: R, y: E };
3932
+ } else if (m === p && b === 4) {
3933
+ const R = t.BYTES, O = t.fromBytes(I.subarray(0, R)), E = t.fromBytes(I.subarray(R, R * 2));
3934
+ if (!S(O, E))
3935
3935
  throw new Error("bad point: is not on curve");
3936
- return { x: M, y: O };
3936
+ return { x: O, y: E };
3937
3937
  } else
3938
- throw new Error(`bad point: got length ${b}, expected compressed=${x} or uncompressed=${m}`);
3938
+ throw new Error(`bad point: got length ${m}, expected compressed=${w} or uncompressed=${p}`);
3939
3939
  }
3940
- const f = e.toBytes || p, w = e.fromBytes || _;
3941
- function S(T) {
3942
- const x = t.sqr(T), m = t.mul(x, T);
3943
- return t.add(t.add(m, t.mul(T, i.a)), i.b);
3940
+ const _ = e.toBytes || f, y = e.fromBytes || x;
3941
+ function v(D) {
3942
+ const w = t.sqr(D), p = t.mul(w, D);
3943
+ return t.add(t.add(p, t.mul(D, i.a)), i.b);
3944
3944
  }
3945
- function y(T, x) {
3946
- const m = t.sqr(x), b = S(T);
3947
- return t.eql(m, b);
3945
+ function S(D, w) {
3946
+ const p = t.sqr(w), m = v(D);
3947
+ return t.eql(p, m);
3948
3948
  }
3949
- if (!y(i.Gx, i.Gy))
3949
+ if (!S(i.Gx, i.Gy))
3950
3950
  throw new Error("bad curve params: generator point");
3951
- const I = t.mul(t.pow(i.a, We), Jr), P = t.mul(t.sqr(i.b), BigInt(27));
3952
- if (t.is0(t.add(I, P)))
3951
+ const A = t.mul(t.pow(i.a, We), Jr), T = t.mul(t.sqr(i.b), BigInt(27));
3952
+ if (t.is0(t.add(A, T)))
3953
3953
  throw new Error("bad curve params: a or b");
3954
- function H(T, x, m = !1) {
3955
- if (!t.isValid(x) || m && t.is0(x))
3956
- throw new Error(`bad point coordinate ${T}`);
3957
- return x;
3954
+ function H(D, w, p = !1) {
3955
+ if (!t.isValid(w) || p && t.is0(w))
3956
+ throw new Error(`bad point coordinate ${D}`);
3957
+ return w;
3958
3958
  }
3959
- function D(T) {
3960
- if (!(T instanceof z))
3959
+ function L(D) {
3960
+ if (!(D instanceof j))
3961
3961
  throw new Error("Weierstrass Point expected");
3962
3962
  }
3963
- function K(T) {
3963
+ function V(D) {
3964
3964
  if (!c || !c.basises)
3965
3965
  throw new Error("no endo");
3966
- return Yr(T, c.basises, n.ORDER);
3967
- }
3968
- const G = Ft((T, x) => {
3969
- const { X: m, Y: b, Z: A } = T;
3970
- if (t.eql(A, t.ONE))
3971
- return { x: m, y: b };
3972
- const N = T.is0();
3973
- x == null && (x = N ? t.ONE : t.inv(A));
3974
- const C = t.mul(m, x), M = t.mul(b, x), O = t.mul(A, x);
3975
- if (N)
3966
+ return Yr(D, c.basises, n.ORDER);
3967
+ }
3968
+ const F = Ft((D, w) => {
3969
+ const { X: p, Y: m, Z: b } = D;
3970
+ if (t.eql(b, t.ONE))
3971
+ return { x: p, y: m };
3972
+ const I = D.is0();
3973
+ w == null && (w = I ? t.ONE : t.inv(b));
3974
+ const R = t.mul(p, w), O = t.mul(m, w), E = t.mul(b, w);
3975
+ if (I)
3976
3976
  return { x: t.ZERO, y: t.ZERO };
3977
- if (!t.eql(O, t.ONE))
3977
+ if (!t.eql(E, t.ONE))
3978
3978
  throw new Error("invZ was invalid");
3979
- return { x: C, y: M };
3980
- }), Z = Ft((T) => {
3981
- if (T.is0()) {
3982
- if (e.allowInfinityPoint && !t.is0(T.Y))
3979
+ return { x: R, y: O };
3980
+ }), re = Ft((D) => {
3981
+ if (D.is0()) {
3982
+ if (e.allowInfinityPoint && !t.is0(D.Y))
3983
3983
  return;
3984
3984
  throw new Error("bad point: ZERO");
3985
3985
  }
3986
- const { x, y: m } = T.toAffine();
3987
- if (!t.isValid(x) || !t.isValid(m))
3986
+ const { x: w, y: p } = D.toAffine();
3987
+ if (!t.isValid(w) || !t.isValid(p))
3988
3988
  throw new Error("bad point: x or y not field elements");
3989
- if (!y(x, m))
3989
+ if (!S(w, p))
3990
3990
  throw new Error("bad point: equation left != right");
3991
- if (!T.isTorsionFree())
3991
+ if (!D.isTorsionFree())
3992
3992
  throw new Error("bad point: not in prime-order subgroup");
3993
3993
  return !0;
3994
3994
  });
3995
- function U(T, x, m, b, A) {
3996
- return m = new z(t.mul(m.X, T), m.Y, m.Z), x = je(b, x), m = je(A, m), x.add(m);
3995
+ function U(D, w, p, m, b) {
3996
+ return p = new j(t.mul(p.X, D), p.Y, p.Z), w = je(m, w), p = je(b, p), w.add(p);
3997
3997
  }
3998
- const E = class E {
3998
+ const P = class P {
3999
3999
  /** Does NOT validate if the point is valid. Use `.assertValidity()`. */
4000
- constructor(x, m, b) {
4001
- R(this, "X");
4002
- R(this, "Y");
4003
- R(this, "Z");
4004
- this.X = H("x", x), this.Y = H("y", m, !0), this.Z = H("z", b), Object.freeze(this);
4000
+ constructor(w, p, m) {
4001
+ k(this, "X");
4002
+ k(this, "Y");
4003
+ k(this, "Z");
4004
+ this.X = H("x", w), this.Y = H("y", p, !0), this.Z = H("z", m), Object.freeze(this);
4005
4005
  }
4006
4006
  static CURVE() {
4007
4007
  return i;
4008
4008
  }
4009
4009
  /** Does NOT validate if the point is valid. Use `.assertValidity()`. */
4010
- static fromAffine(x) {
4011
- const { x: m, y: b } = x || {};
4012
- if (!x || !t.isValid(m) || !t.isValid(b))
4010
+ static fromAffine(w) {
4011
+ const { x: p, y: m } = w || {};
4012
+ if (!w || !t.isValid(p) || !t.isValid(m))
4013
4013
  throw new Error("invalid affine point");
4014
- if (x instanceof E)
4014
+ if (w instanceof P)
4015
4015
  throw new Error("projective point not allowed");
4016
- return t.is0(m) && t.is0(b) ? E.ZERO : new E(m, b, t.ONE);
4016
+ return t.is0(p) && t.is0(m) ? P.ZERO : new P(p, m, t.ONE);
4017
4017
  }
4018
- static fromBytes(x) {
4019
- const m = E.fromAffine(w(q(x, void 0, "point")));
4020
- return m.assertValidity(), m;
4018
+ static fromBytes(w) {
4019
+ const p = P.fromAffine(y(W(w, void 0, "point")));
4020
+ return p.assertValidity(), p;
4021
4021
  }
4022
- static fromHex(x) {
4023
- return E.fromBytes(Ve(x));
4022
+ static fromHex(w) {
4023
+ return P.fromBytes(Ve(w));
4024
4024
  }
4025
4025
  get x() {
4026
4026
  return this.toAffine().x;
@@ -4034,58 +4034,58 @@ function Zr(r, e = {}) {
4034
4034
  * @param isLazy true will defer table computation until the first multiplication
4035
4035
  * @returns
4036
4036
  */
4037
- precompute(x = 8, m = !0) {
4038
- return v.createCache(this, x), m || this.multiply(We), this;
4037
+ precompute(w = 8, p = !0) {
4038
+ return $.createCache(this, w), p || this.multiply(We), this;
4039
4039
  }
4040
4040
  // TODO: return `this`
4041
4041
  /** A point on curve is valid if it conforms to equation. */
4042
4042
  assertValidity() {
4043
- Z(this);
4043
+ re(this);
4044
4044
  }
4045
4045
  hasEvenY() {
4046
- const { y: x } = this.toAffine();
4046
+ const { y: w } = this.toAffine();
4047
4047
  if (!t.isOdd)
4048
4048
  throw new Error("Field doesn't support isOdd");
4049
- return !t.isOdd(x);
4049
+ return !t.isOdd(w);
4050
4050
  }
4051
4051
  /** Compare one point to another. */
4052
- equals(x) {
4053
- D(x);
4054
- const { X: m, Y: b, Z: A } = this, { X: N, Y: C, Z: M } = x, O = t.eql(t.mul(m, M), t.mul(N, A)), $ = t.eql(t.mul(b, M), t.mul(C, A));
4055
- return O && $;
4052
+ equals(w) {
4053
+ L(w);
4054
+ const { X: p, Y: m, Z: b } = this, { X: I, Y: R, Z: O } = w, E = t.eql(t.mul(p, O), t.mul(I, b)), C = t.eql(t.mul(m, O), t.mul(R, b));
4055
+ return E && C;
4056
4056
  }
4057
4057
  /** Flips point to one corresponding to (x, -y) in Affine coordinates. */
4058
4058
  negate() {
4059
- return new E(this.X, t.neg(this.Y), this.Z);
4059
+ return new P(this.X, t.neg(this.Y), this.Z);
4060
4060
  }
4061
4061
  // Renes-Costello-Batina exception-free doubling formula.
4062
4062
  // There is 30% faster Jacobian formula, but it is not complete.
4063
4063
  // https://eprint.iacr.org/2015/1060, algorithm 3
4064
4064
  // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
4065
4065
  double() {
4066
- const { a: x, b: m } = i, b = t.mul(m, We), { X: A, Y: N, Z: C } = this;
4067
- let M = t.ZERO, O = t.ZERO, $ = t.ZERO, F = t.mul(A, A), Y = t.mul(N, N), W = t.mul(C, C), B = t.mul(A, N);
4068
- return B = t.add(B, B), $ = t.mul(A, C), $ = t.add($, $), M = t.mul(x, $), O = t.mul(b, W), O = t.add(M, O), M = t.sub(Y, O), O = t.add(Y, O), O = t.mul(M, O), M = t.mul(B, M), $ = t.mul(b, $), W = t.mul(x, W), B = t.sub(F, W), B = t.mul(x, B), B = t.add(B, $), $ = t.add(F, F), F = t.add($, F), F = t.add(F, W), F = t.mul(F, B), O = t.add(O, F), W = t.mul(N, C), W = t.add(W, W), F = t.mul(W, B), M = t.sub(M, F), $ = t.mul(W, Y), $ = t.add($, $), $ = t.add($, $), new E(M, O, $);
4066
+ const { a: w, b: p } = i, m = t.mul(p, We), { X: b, Y: I, Z: R } = this;
4067
+ let O = t.ZERO, E = t.ZERO, C = t.ZERO, M = t.mul(b, b), q = t.mul(I, I), G = t.mul(R, R), B = t.mul(b, I);
4068
+ return B = t.add(B, B), C = t.mul(b, R), C = t.add(C, C), O = t.mul(w, C), E = t.mul(m, G), E = t.add(O, E), O = t.sub(q, E), E = t.add(q, E), E = t.mul(O, E), O = t.mul(B, O), C = t.mul(m, C), G = t.mul(w, G), B = t.sub(M, G), B = t.mul(w, B), B = t.add(B, C), C = t.add(M, M), M = t.add(C, M), M = t.add(M, G), M = t.mul(M, B), E = t.add(E, M), G = t.mul(I, R), G = t.add(G, G), M = t.mul(G, B), O = t.sub(O, M), C = t.mul(G, q), C = t.add(C, C), C = t.add(C, C), new P(O, E, C);
4069
4069
  }
4070
4070
  // Renes-Costello-Batina exception-free addition formula.
4071
4071
  // There is 30% faster Jacobian formula, but it is not complete.
4072
4072
  // https://eprint.iacr.org/2015/1060, algorithm 1
4073
4073
  // Cost: 12M + 0S + 3*a + 3*b3 + 23add.
4074
- add(x) {
4075
- D(x);
4076
- const { X: m, Y: b, Z: A } = this, { X: N, Y: C, Z: M } = x;
4077
- let O = t.ZERO, $ = t.ZERO, F = t.ZERO;
4078
- const Y = i.a, W = t.mul(i.b, We);
4079
- let B = t.mul(m, N), X = t.mul(b, C), Q = t.mul(A, M), oe = t.add(m, b), V = t.add(N, C);
4080
- oe = t.mul(oe, V), V = t.add(B, X), oe = t.sub(oe, V), V = t.add(m, A);
4081
- let ee = t.add(N, M);
4082
- return V = t.mul(V, ee), ee = t.add(B, Q), V = t.sub(V, ee), ee = t.add(b, A), O = t.add(C, M), ee = t.mul(ee, O), O = t.add(X, Q), ee = t.sub(ee, O), F = t.mul(Y, V), O = t.mul(W, Q), F = t.add(O, F), O = t.sub(X, F), F = t.add(X, F), $ = t.mul(O, F), X = t.add(B, B), X = t.add(X, B), Q = t.mul(Y, Q), V = t.mul(W, V), X = t.add(X, Q), Q = t.sub(B, Q), Q = t.mul(Y, Q), V = t.add(V, Q), B = t.mul(X, V), $ = t.add($, B), B = t.mul(ee, V), O = t.mul(oe, O), O = t.sub(O, B), B = t.mul(oe, X), F = t.mul(ee, F), F = t.add(F, B), new E(O, $, F);
4083
- }
4084
- subtract(x) {
4085
- return this.add(x.negate());
4074
+ add(w) {
4075
+ L(w);
4076
+ const { X: p, Y: m, Z: b } = this, { X: I, Y: R, Z: O } = w;
4077
+ let E = t.ZERO, C = t.ZERO, M = t.ZERO;
4078
+ const q = i.a, G = t.mul(i.b, We);
4079
+ let B = t.mul(p, I), X = t.mul(m, R), Z = t.mul(b, O), oe = t.add(p, m), K = t.add(I, R);
4080
+ oe = t.mul(oe, K), K = t.add(B, X), oe = t.sub(oe, K), K = t.add(p, b);
4081
+ let Q = t.add(I, O);
4082
+ return K = t.mul(K, Q), Q = t.add(B, Z), K = t.sub(K, Q), Q = t.add(m, b), E = t.add(R, O), Q = t.mul(Q, E), E = t.add(X, Z), Q = t.sub(Q, E), M = t.mul(q, K), E = t.mul(G, Z), M = t.add(E, M), E = t.sub(X, M), M = t.add(X, M), C = t.mul(E, M), X = t.add(B, B), X = t.add(X, B), Z = t.mul(q, Z), K = t.mul(G, K), X = t.add(X, Z), Z = t.sub(B, Z), Z = t.mul(q, Z), K = t.add(K, Z), B = t.mul(X, K), C = t.add(C, B), B = t.mul(Q, K), E = t.mul(oe, E), E = t.sub(E, B), B = t.mul(oe, X), M = t.mul(Q, M), M = t.add(M, B), new P(E, C, M);
4083
+ }
4084
+ subtract(w) {
4085
+ return this.add(w.negate());
4086
4086
  }
4087
4087
  is0() {
4088
- return this.equals(E.ZERO);
4088
+ return this.equals(P.ZERO);
4089
4089
  }
4090
4090
  /**
4091
4091
  * Constant time multiplication.
@@ -4096,83 +4096,83 @@ function Zr(r, e = {}) {
4096
4096
  * @param scalar by which the point would be multiplied
4097
4097
  * @returns New point
4098
4098
  */
4099
- multiply(x) {
4100
- const { endo: m } = e;
4101
- if (!n.isValidNot0(x))
4099
+ multiply(w) {
4100
+ const { endo: p } = e;
4101
+ if (!n.isValidNot0(w))
4102
4102
  throw new Error("invalid scalar: out of range");
4103
- let b, A;
4104
- const N = (C) => v.cached(this, C, (M) => qt(E, M));
4105
- if (m) {
4106
- const { k1neg: C, k1: M, k2neg: O, k2: $ } = K(x), { p: F, f: Y } = N(M), { p: W, f: B } = N($);
4107
- A = Y.add(B), b = U(m.beta, F, W, C, O);
4103
+ let m, b;
4104
+ const I = (R) => $.cached(this, R, (O) => qt(P, O));
4105
+ if (p) {
4106
+ const { k1neg: R, k1: O, k2neg: E, k2: C } = V(w), { p: M, f: q } = I(O), { p: G, f: B } = I(C);
4107
+ b = q.add(B), m = U(p.beta, M, G, R, E);
4108
4108
  } else {
4109
- const { p: C, f: M } = N(x);
4110
- b = C, A = M;
4109
+ const { p: R, f: O } = I(w);
4110
+ m = R, b = O;
4111
4111
  }
4112
- return qt(E, [b, A])[0];
4112
+ return qt(P, [m, b])[0];
4113
4113
  }
4114
4114
  /**
4115
4115
  * Non-constant-time multiplication. Uses double-and-add algorithm.
4116
4116
  * It's faster, but should only be used when you don't care about
4117
4117
  * an exposed secret key e.g. sig verification, which works over *public* keys.
4118
4118
  */
4119
- multiplyUnsafe(x) {
4120
- const { endo: m } = e, b = this;
4121
- if (!n.isValid(x))
4119
+ multiplyUnsafe(w) {
4120
+ const { endo: p } = e, m = this;
4121
+ if (!n.isValid(w))
4122
4122
  throw new Error("invalid scalar: out of range");
4123
- if (x === ge || b.is0())
4124
- return E.ZERO;
4125
- if (x === Pe)
4126
- return b;
4127
- if (v.hasCache(this))
4128
- return this.multiply(x);
4129
- if (m) {
4130
- const { k1neg: A, k1: N, k2neg: C, k2: M } = K(x), { p1: O, p2: $ } = Vr(E, b, N, M);
4131
- return U(m.beta, O, $, A, C);
4123
+ if (w === ge || m.is0())
4124
+ return P.ZERO;
4125
+ if (w === Pe)
4126
+ return m;
4127
+ if ($.hasCache(this))
4128
+ return this.multiply(w);
4129
+ if (p) {
4130
+ const { k1neg: b, k1: I, k2neg: R, k2: O } = V(w), { p1: E, p2: C } = Vr(P, m, I, O);
4131
+ return U(p.beta, E, C, b, R);
4132
4132
  } else
4133
- return v.unsafe(b, x);
4133
+ return $.unsafe(m, w);
4134
4134
  }
4135
4135
  /**
4136
4136
  * Converts Projective point to affine (x, y) coordinates.
4137
4137
  * @param invertedZ Z^-1 (inverted zero) - optional, precomputation is useful for invertBatch
4138
4138
  */
4139
- toAffine(x) {
4140
- return G(this, x);
4139
+ toAffine(w) {
4140
+ return F(this, w);
4141
4141
  }
4142
4142
  /**
4143
4143
  * Checks whether Point is free of torsion elements (is in prime subgroup).
4144
4144
  * Always torsion-free for cofactor=1 curves.
4145
4145
  */
4146
4146
  isTorsionFree() {
4147
- const { isTorsionFree: x } = e;
4148
- return o === Pe ? !0 : x ? x(E, this) : v.unsafe(this, a).is0();
4147
+ const { isTorsionFree: w } = e;
4148
+ return o === Pe ? !0 : w ? w(P, this) : $.unsafe(this, a).is0();
4149
4149
  }
4150
4150
  clearCofactor() {
4151
- const { clearCofactor: x } = e;
4152
- return o === Pe ? this : x ? x(E, this) : this.multiplyUnsafe(o);
4151
+ const { clearCofactor: w } = e;
4152
+ return o === Pe ? this : w ? w(P, this) : this.multiplyUnsafe(o);
4153
4153
  }
4154
4154
  isSmallOrder() {
4155
4155
  return this.multiplyUnsafe(o).is0();
4156
4156
  }
4157
- toBytes(x = !0) {
4158
- return ze(x, "isCompressed"), this.assertValidity(), f(E, this, x);
4157
+ toBytes(w = !0) {
4158
+ return ze(w, "isCompressed"), this.assertValidity(), _(P, this, w);
4159
4159
  }
4160
- toHex(x = !0) {
4161
- return Ue(this.toBytes(x));
4160
+ toHex(w = !0) {
4161
+ return Ue(this.toBytes(w));
4162
4162
  }
4163
4163
  toString() {
4164
4164
  return `<Point ${this.is0() ? "ZERO" : this.toHex()}>`;
4165
4165
  }
4166
4166
  };
4167
4167
  // base / generator point
4168
- R(E, "BASE", new E(i.Gx, i.Gy, t.ONE)), // zero / infinity / identity point
4169
- R(E, "ZERO", new E(t.ZERO, t.ONE, t.ZERO)), // 0, 1, 0
4168
+ k(P, "BASE", new P(i.Gx, i.Gy, t.ONE)), // zero / infinity / identity point
4169
+ k(P, "ZERO", new P(t.ZERO, t.ONE, t.ZERO)), // 0, 1, 0
4170
4170
  // math field
4171
- R(E, "Fp", t), // scalar field
4172
- R(E, "Fn", n);
4173
- let z = E;
4174
- const k = n.BITS, v = new Kr(z, e.endo ? Math.ceil(k / 2) : k);
4175
- return z.BASE.precompute(8), z;
4171
+ k(P, "Fp", t), // scalar field
4172
+ k(P, "Fn", n);
4173
+ let j = P;
4174
+ const Y = n.BITS, $ = new Kr(j, e.endo ? Math.ceil(Y / 2) : Y);
4175
+ return j.BASE.precompute(8), j;
4176
4176
  }
4177
4177
  function Os(r) {
4178
4178
  return Uint8Array.of(r ? 2 : 3);
@@ -4188,50 +4188,50 @@ function Ps(r, e) {
4188
4188
  }
4189
4189
  function Qr(r, e = {}) {
4190
4190
  const { Fn: s } = r, t = e.randomBytes || ds, n = Object.assign(Ps(r.Fp, s), { seed: Es(s.ORDER) });
4191
- function i(f) {
4191
+ function i(_) {
4192
4192
  try {
4193
- const w = s.fromBytes(f);
4194
- return s.isValidNot0(w);
4193
+ const y = s.fromBytes(_);
4194
+ return s.isValidNot0(y);
4195
4195
  } catch {
4196
4196
  return !1;
4197
4197
  }
4198
4198
  }
4199
- function o(f, w) {
4200
- const { publicKey: S, publicKeyUncompressed: y } = n;
4199
+ function o(_, y) {
4200
+ const { publicKey: v, publicKeyUncompressed: S } = n;
4201
4201
  try {
4202
- const I = f.length;
4203
- return w === !0 && I !== S || w === !1 && I !== y ? !1 : !!r.fromBytes(f);
4202
+ const A = _.length;
4203
+ return y === !0 && A !== v || y === !1 && A !== S ? !1 : !!r.fromBytes(_);
4204
4204
  } catch {
4205
4205
  return !1;
4206
4206
  }
4207
4207
  }
4208
- function a(f = t(n.seed)) {
4209
- return qr(q(f, n.seed, "seed"), s.ORDER);
4208
+ function a(_ = t(n.seed)) {
4209
+ return qr(W(_, n.seed, "seed"), s.ORDER);
4210
4210
  }
4211
- function c(f, w = !0) {
4212
- return r.BASE.multiply(s.fromBytes(f)).toBytes(w);
4211
+ function c(_, y = !0) {
4212
+ return r.BASE.multiply(s.fromBytes(_)).toBytes(y);
4213
4213
  }
4214
- function l(f) {
4215
- const { secretKey: w, publicKey: S, publicKeyUncompressed: y } = n;
4216
- if (!xt(f) || "_lengths" in s && s._lengths || w === S)
4214
+ function l(_) {
4215
+ const { secretKey: y, publicKey: v, publicKeyUncompressed: S } = n;
4216
+ if (!xt(_) || "_lengths" in s && s._lengths || y === v)
4217
4217
  return;
4218
- const I = q(f, void 0, "key").length;
4219
- return I === S || I === y;
4218
+ const A = W(_, void 0, "key").length;
4219
+ return A === v || A === S;
4220
4220
  }
4221
- function u(f, w, S = !0) {
4222
- if (l(f) === !0)
4221
+ function u(_, y, v = !0) {
4222
+ if (l(_) === !0)
4223
4223
  throw new Error("first arg must be private key");
4224
- if (l(w) === !1)
4224
+ if (l(y) === !1)
4225
4225
  throw new Error("second arg must be public key");
4226
- const y = s.fromBytes(f);
4227
- return r.fromBytes(w).multiply(y).toBytes(S);
4226
+ const S = s.fromBytes(_);
4227
+ return r.fromBytes(y).multiply(S).toBytes(v);
4228
4228
  }
4229
- const p = {
4229
+ const f = {
4230
4230
  isValidSecretKey: i,
4231
4231
  isValidPublicKey: o,
4232
4232
  randomSecretKey: a
4233
- }, _ = jr(a, c);
4234
- return Object.freeze({ getPublicKey: c, getSharedSecret: u, keygen: _, Point: r, utils: p, lengths: n });
4233
+ }, x = jr(a, c);
4234
+ return Object.freeze({ getPublicKey: c, getSharedSecret: u, keygen: x, Point: r, utils: f, lengths: n });
4235
4235
  }
4236
4236
  function en(r, e, s = {}) {
4237
4237
  os(e), yt(s, {}, {
@@ -4241,165 +4241,165 @@ function en(r, e, s = {}) {
4241
4241
  bits2int: "function",
4242
4242
  bits2int_modN: "function"
4243
4243
  }), s = Object.assign({}, s);
4244
- const t = s.randomBytes || ds, n = s.hmac || ((x, m) => Rs(e, x, m)), { Fp: i, Fn: o } = r, { ORDER: a, BITS: c } = o, { keygen: l, getPublicKey: u, getSharedSecret: p, utils: _, lengths: f } = Qr(r, s), w = {
4244
+ const t = s.randomBytes || ds, n = s.hmac || ((w, p) => Rs(e, w, p)), { Fp: i, Fn: o } = r, { ORDER: a, BITS: c } = o, { keygen: l, getPublicKey: u, getSharedSecret: f, utils: x, lengths: _ } = Qr(r, s), y = {
4245
4245
  prehash: !0,
4246
4246
  lowS: typeof s.lowS == "boolean" ? s.lowS : !0,
4247
4247
  format: "compact",
4248
4248
  extraEntropy: !1
4249
- }, S = a * ks < i.ORDER;
4250
- function y(x) {
4251
- const m = a >> Pe;
4252
- return x > m;
4253
- }
4254
- function I(x, m) {
4255
- if (!o.isValidNot0(m))
4256
- throw new Error(`invalid signature ${x}: out of range 1..Point.Fn.ORDER`);
4257
- return m;
4258
- }
4259
- function P() {
4260
- if (S)
4249
+ }, v = a * ks < i.ORDER;
4250
+ function S(w) {
4251
+ const p = a >> Pe;
4252
+ return w > p;
4253
+ }
4254
+ function A(w, p) {
4255
+ if (!o.isValidNot0(p))
4256
+ throw new Error(`invalid signature ${w}: out of range 1..Point.Fn.ORDER`);
4257
+ return p;
4258
+ }
4259
+ function T() {
4260
+ if (v)
4261
4261
  throw new Error('"recovered" sig type is not supported for cofactor >2 curves');
4262
4262
  }
4263
- function H(x, m) {
4264
- pt(m);
4265
- const b = f.signature, A = m === "compact" ? b : m === "recovered" ? b + 1 : void 0;
4266
- return q(x, A);
4267
- }
4268
- class D {
4269
- constructor(m, b, A) {
4270
- R(this, "r");
4271
- R(this, "s");
4272
- R(this, "recovery");
4273
- if (this.r = I("r", m), this.s = I("s", b), A != null) {
4274
- if (P(), ![0, 1, 2, 3].includes(A))
4263
+ function H(w, p) {
4264
+ pt(p);
4265
+ const m = _.signature, b = p === "compact" ? m : p === "recovered" ? m + 1 : void 0;
4266
+ return W(w, b);
4267
+ }
4268
+ class L {
4269
+ constructor(p, m, b) {
4270
+ k(this, "r");
4271
+ k(this, "s");
4272
+ k(this, "recovery");
4273
+ if (this.r = A("r", p), this.s = A("s", m), b != null) {
4274
+ if (T(), ![0, 1, 2, 3].includes(b))
4275
4275
  throw new Error("invalid recovery id");
4276
- this.recovery = A;
4276
+ this.recovery = b;
4277
4277
  }
4278
4278
  Object.freeze(this);
4279
4279
  }
4280
- static fromBytes(m, b = w.format) {
4281
- H(m, b);
4282
- let A;
4283
- if (b === "der") {
4284
- const { r: O, s: $ } = Se.toSig(q(m));
4285
- return new D(O, $);
4280
+ static fromBytes(p, m = y.format) {
4281
+ H(p, m);
4282
+ let b;
4283
+ if (m === "der") {
4284
+ const { r: E, s: C } = Se.toSig(W(p));
4285
+ return new L(E, C);
4286
4286
  }
4287
- b === "recovered" && (A = m[0], b = "compact", m = m.subarray(1));
4288
- const N = f.signature / 2, C = m.subarray(0, N), M = m.subarray(N, N * 2);
4289
- return new D(o.fromBytes(C), o.fromBytes(M), A);
4287
+ m === "recovered" && (b = p[0], m = "compact", p = p.subarray(1));
4288
+ const I = _.signature / 2, R = p.subarray(0, I), O = p.subarray(I, I * 2);
4289
+ return new L(o.fromBytes(R), o.fromBytes(O), b);
4290
4290
  }
4291
- static fromHex(m, b) {
4292
- return this.fromBytes(Ve(m), b);
4291
+ static fromHex(p, m) {
4292
+ return this.fromBytes(Ve(p), m);
4293
4293
  }
4294
4294
  assertRecovery() {
4295
- const { recovery: m } = this;
4296
- if (m == null)
4295
+ const { recovery: p } = this;
4296
+ if (p == null)
4297
4297
  throw new Error("invalid recovery id: must be present");
4298
- return m;
4298
+ return p;
4299
4299
  }
4300
- addRecoveryBit(m) {
4301
- return new D(this.r, this.s, m);
4300
+ addRecoveryBit(p) {
4301
+ return new L(this.r, this.s, p);
4302
4302
  }
4303
- recoverPublicKey(m) {
4304
- const { r: b, s: A } = this, N = this.assertRecovery(), C = N === 2 || N === 3 ? b + a : b;
4305
- if (!i.isValid(C))
4303
+ recoverPublicKey(p) {
4304
+ const { r: m, s: b } = this, I = this.assertRecovery(), R = I === 2 || I === 3 ? m + a : m;
4305
+ if (!i.isValid(R))
4306
4306
  throw new Error("invalid recovery id: sig.r+curve.n != R.x");
4307
- const M = i.toBytes(C), O = r.fromBytes(ve(Os((N & 1) === 0), M)), $ = o.inv(C), F = G(q(m, void 0, "msgHash")), Y = o.create(-F * $), W = o.create(A * $), B = r.BASE.multiplyUnsafe(Y).add(O.multiplyUnsafe(W));
4307
+ const O = i.toBytes(R), E = r.fromBytes(ve(Os((I & 1) === 0), O)), C = o.inv(R), M = F(W(p, void 0, "msgHash")), q = o.create(-M * C), G = o.create(b * C), B = r.BASE.multiplyUnsafe(q).add(E.multiplyUnsafe(G));
4308
4308
  if (B.is0())
4309
4309
  throw new Error("invalid recovery: point at infinify");
4310
4310
  return B.assertValidity(), B;
4311
4311
  }
4312
4312
  // Signatures should be low-s, to prevent malleability.
4313
4313
  hasHighS() {
4314
- return y(this.s);
4314
+ return S(this.s);
4315
4315
  }
4316
- toBytes(m = w.format) {
4317
- if (pt(m), m === "der")
4316
+ toBytes(p = y.format) {
4317
+ if (pt(p), p === "der")
4318
4318
  return Ve(Se.hexFromSig(this));
4319
- const { r: b, s: A } = this, N = o.toBytes(b), C = o.toBytes(A);
4320
- return m === "recovered" ? (P(), ve(Uint8Array.of(this.assertRecovery()), N, C)) : ve(N, C);
4319
+ const { r: m, s: b } = this, I = o.toBytes(m), R = o.toBytes(b);
4320
+ return p === "recovered" ? (T(), ve(Uint8Array.of(this.assertRecovery()), I, R)) : ve(I, R);
4321
4321
  }
4322
- toHex(m) {
4323
- return Ue(this.toBytes(m));
4322
+ toHex(p) {
4323
+ return Ue(this.toBytes(p));
4324
4324
  }
4325
4325
  }
4326
- const K = s.bits2int || function(m) {
4327
- if (m.length > 8192)
4326
+ const V = s.bits2int || function(p) {
4327
+ if (p.length > 8192)
4328
4328
  throw new Error("input is too large");
4329
- const b = Je(m), A = m.length * 8 - c;
4330
- return A > 0 ? b >> BigInt(A) : b;
4331
- }, G = s.bits2int_modN || function(m) {
4332
- return o.create(K(m));
4333
- }, Z = wt(c);
4334
- function U(x) {
4335
- return Pr("num < 2^" + c, x, ge, Z), o.toBytes(x);
4336
- }
4337
- function z(x, m) {
4338
- return q(x, void 0, "message"), m ? q(e(x), void 0, "prehashed message") : x;
4339
- }
4340
- function k(x, m, b) {
4341
- const { lowS: A, prehash: N, extraEntropy: C } = ot(b, w);
4342
- x = z(x, N);
4343
- const M = G(x), O = o.fromBytes(m);
4344
- if (!o.isValidNot0(O))
4329
+ const m = Je(p), b = p.length * 8 - c;
4330
+ return b > 0 ? m >> BigInt(b) : m;
4331
+ }, F = s.bits2int_modN || function(p) {
4332
+ return o.create(V(p));
4333
+ }, re = wt(c);
4334
+ function U(w) {
4335
+ return Pr("num < 2^" + c, w, ge, re), o.toBytes(w);
4336
+ }
4337
+ function j(w, p) {
4338
+ return W(w, void 0, "message"), p ? W(e(w), void 0, "prehashed message") : w;
4339
+ }
4340
+ function Y(w, p, m) {
4341
+ const { lowS: b, prehash: I, extraEntropy: R } = ot(m, y);
4342
+ w = j(w, I);
4343
+ const O = F(w), E = o.fromBytes(p);
4344
+ if (!o.isValidNot0(E))
4345
4345
  throw new Error("invalid private key");
4346
- const $ = [U(O), U(M)];
4347
- if (C != null && C !== !1) {
4348
- const B = C === !0 ? t(f.secretKey) : C;
4349
- $.push(q(B, void 0, "extraEntropy"));
4350
- }
4351
- const F = ve(...$), Y = M;
4352
- function W(B) {
4353
- const X = K(B);
4346
+ const C = [U(E), U(O)];
4347
+ if (R != null && R !== !1) {
4348
+ const B = R === !0 ? t(_.secretKey) : R;
4349
+ C.push(W(B, void 0, "extraEntropy"));
4350
+ }
4351
+ const M = ve(...C), q = O;
4352
+ function G(B) {
4353
+ const X = V(B);
4354
4354
  if (!o.isValidNot0(X))
4355
4355
  return;
4356
- const Q = o.inv(X), oe = r.BASE.multiply(X).toAffine(), V = o.create(oe.x);
4357
- if (V === ge)
4356
+ const Z = o.inv(X), oe = r.BASE.multiply(X).toAffine(), K = o.create(oe.x);
4357
+ if (K === ge)
4358
4358
  return;
4359
- const ee = o.create(Q * o.create(Y + V * O));
4360
- if (ee === ge)
4359
+ const Q = o.create(Z * o.create(q + K * E));
4360
+ if (Q === ge)
4361
4361
  return;
4362
- let It = (oe.x === V ? 0 : 2) | Number(oe.y & Pe), At = ee;
4363
- return A && y(ee) && (At = o.neg(ee), It ^= 1), new D(V, At, S ? void 0 : It);
4362
+ let It = (oe.x === K ? 0 : 2) | Number(oe.y & Pe), At = Q;
4363
+ return b && S(Q) && (At = o.neg(Q), It ^= 1), new L(K, At, v ? void 0 : It);
4364
4364
  }
4365
- return { seed: F, k2sig: W };
4365
+ return { seed: M, k2sig: G };
4366
4366
  }
4367
- function v(x, m, b = {}) {
4368
- const { seed: A, k2sig: N } = k(x, m, b);
4369
- return Nr(e.outputLen, o.BYTES, n)(A, N).toBytes(b.format);
4367
+ function $(w, p, m = {}) {
4368
+ const { seed: b, k2sig: I } = Y(w, p, m);
4369
+ return Nr(e.outputLen, o.BYTES, n)(b, I).toBytes(m.format);
4370
4370
  }
4371
- function E(x, m, b, A = {}) {
4372
- const { lowS: N, prehash: C, format: M } = ot(A, w);
4373
- if (b = q(b, void 0, "publicKey"), m = z(m, C), !xt(x)) {
4374
- const O = x instanceof D ? ", use sig.toBytes()" : "";
4375
- throw new Error("verify expects Uint8Array signature" + O);
4371
+ function P(w, p, m, b = {}) {
4372
+ const { lowS: I, prehash: R, format: O } = ot(b, y);
4373
+ if (m = W(m, void 0, "publicKey"), p = j(p, R), !xt(w)) {
4374
+ const E = w instanceof L ? ", use sig.toBytes()" : "";
4375
+ throw new Error("verify expects Uint8Array signature" + E);
4376
4376
  }
4377
- H(x, M);
4377
+ H(w, O);
4378
4378
  try {
4379
- const O = D.fromBytes(x, M), $ = r.fromBytes(b);
4380
- if (N && O.hasHighS())
4379
+ const E = L.fromBytes(w, O), C = r.fromBytes(m);
4380
+ if (I && E.hasHighS())
4381
4381
  return !1;
4382
- const { r: F, s: Y } = O, W = G(m), B = o.inv(Y), X = o.create(W * B), Q = o.create(F * B), oe = r.BASE.multiplyUnsafe(X).add($.multiplyUnsafe(Q));
4383
- return oe.is0() ? !1 : o.create(oe.x) === F;
4382
+ const { r: M, s: q } = E, G = F(p), B = o.inv(q), X = o.create(G * B), Z = o.create(M * B), oe = r.BASE.multiplyUnsafe(X).add(C.multiplyUnsafe(Z));
4383
+ return oe.is0() ? !1 : o.create(oe.x) === M;
4384
4384
  } catch {
4385
4385
  return !1;
4386
4386
  }
4387
4387
  }
4388
- function T(x, m, b = {}) {
4389
- const { prehash: A } = ot(b, w);
4390
- return m = z(m, A), D.fromBytes(x, "recovered").recoverPublicKey(m).toBytes();
4388
+ function D(w, p, m = {}) {
4389
+ const { prehash: b } = ot(m, y);
4390
+ return p = j(p, b), L.fromBytes(w, "recovered").recoverPublicKey(p).toBytes();
4391
4391
  }
4392
4392
  return Object.freeze({
4393
4393
  keygen: l,
4394
4394
  getPublicKey: u,
4395
- getSharedSecret: p,
4396
- utils: _,
4397
- lengths: f,
4395
+ getSharedSecret: f,
4396
+ utils: x,
4397
+ lengths: _,
4398
4398
  Point: r,
4399
- sign: v,
4400
- verify: E,
4401
- recoverPublicKey: T,
4402
- Signature: D,
4399
+ sign: $,
4400
+ verify: P,
4401
+ recoverPublicKey: D,
4402
+ Signature: L,
4403
4403
  hash: e
4404
4404
  });
4405
4405
  }
@@ -4420,10 +4420,10 @@ const St = {
4420
4420
  ]
4421
4421
  }, Yt = /* @__PURE__ */ BigInt(2);
4422
4422
  function sn(r) {
4423
- const e = St.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), i = BigInt(22), o = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, u = l * l * r % e, p = ce(u, s, e) * u % e, _ = ce(p, s, e) * u % e, f = ce(_, Yt, e) * l % e, w = ce(f, n, e) * f % e, S = ce(w, i, e) * w % e, y = ce(S, a, e) * S % e, I = ce(y, c, e) * y % e, P = ce(I, a, e) * S % e, H = ce(P, s, e) * u % e, D = ce(H, o, e) * w % e, K = ce(D, t, e) * l % e, G = ce(K, Yt, e);
4424
- if (!ft.eql(ft.sqr(G), r))
4423
+ const e = St.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), i = BigInt(22), o = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, u = l * l * r % e, f = ce(u, s, e) * u % e, x = ce(f, s, e) * u % e, _ = ce(x, Yt, e) * l % e, y = ce(_, n, e) * _ % e, v = ce(y, i, e) * y % e, S = ce(v, a, e) * v % e, A = ce(S, c, e) * S % e, T = ce(A, a, e) * v % e, H = ce(T, s, e) * u % e, L = ce(H, o, e) * y % e, V = ce(L, t, e) * l % e, F = ce(V, Yt, e);
4424
+ if (!ft.eql(ft.sqr(F), r))
4425
4425
  throw new Error("Cannot find square root");
4426
- return G;
4426
+ return F;
4427
4427
  }
4428
4428
  const ft = Ze(St.p, { sqrt: sn }), rn = /* @__PURE__ */ Zr(St, {
4429
4429
  Fp: ft,
@@ -4443,9 +4443,9 @@ function pn(r, e = 24) {
4443
4443
  for (let o = 0; o < 10; o++)
4444
4444
  s[o] = r[o] ^ r[o + 10] ^ r[o + 20] ^ r[o + 30] ^ r[o + 40];
4445
4445
  for (let o = 0; o < 10; o += 2) {
4446
- const a = (o + 8) % 10, c = (o + 2) % 10, l = s[c], u = s[c + 1], p = Xt(l, u, 1) ^ s[a], _ = Jt(l, u, 1) ^ s[a + 1];
4447
- for (let f = 0; f < 50; f += 10)
4448
- r[o + f] ^= p, r[o + f + 1] ^= _;
4446
+ const a = (o + 8) % 10, c = (o + 2) % 10, l = s[c], u = s[c + 1], f = Xt(l, u, 1) ^ s[a], x = Jt(l, u, 1) ^ s[a + 1];
4447
+ for (let _ = 0; _ < 50; _ += 10)
4448
+ r[o + _] ^= f, r[o + _ + 1] ^= x;
4449
4449
  }
4450
4450
  let n = r[2], i = r[3];
4451
4451
  for (let o = 0; o < 24; o++) {
@@ -4465,17 +4465,17 @@ function pn(r, e = 24) {
4465
4465
  class vt {
4466
4466
  // NOTE: we accept arguments in bytes instead of bits here.
4467
4467
  constructor(e, s, t, n = !1, i = 24) {
4468
- R(this, "state");
4469
- R(this, "pos", 0);
4470
- R(this, "posOut", 0);
4471
- R(this, "finished", !1);
4472
- R(this, "state32");
4473
- R(this, "destroyed", !1);
4474
- R(this, "blockLen");
4475
- R(this, "suffix");
4476
- R(this, "outputLen");
4477
- R(this, "enableXOF", !1);
4478
- R(this, "rounds");
4468
+ k(this, "state");
4469
+ k(this, "pos", 0);
4470
+ k(this, "posOut", 0);
4471
+ k(this, "finished", !1);
4472
+ k(this, "state32");
4473
+ k(this, "destroyed", !1);
4474
+ k(this, "blockLen");
4475
+ k(this, "suffix");
4476
+ k(this, "outputLen");
4477
+ k(this, "enableXOF", !1);
4478
+ k(this, "rounds");
4479
4479
  if (this.blockLen = e, this.suffix = s, this.outputLen = t, this.enableXOF = n, this.rounds = i, we(t, "outputLen"), !(0 < e && e < 200))
4480
4480
  throw new Error("only keccak-f1600 function is supported");
4481
4481
  this.state = new Uint8Array(200), this.state32 = dr(this.state);
@@ -4487,7 +4487,7 @@ class vt {
4487
4487
  Bt(this.state32), pn(this.state32, this.rounds), Bt(this.state32), this.posOut = 0, this.pos = 0;
4488
4488
  }
4489
4489
  update(e) {
4490
- Ce(this), q(e);
4490
+ Ce(this), W(e);
4491
4491
  const { blockLen: s, state: t } = this, n = e.length;
4492
4492
  for (let i = 0; i < n; ) {
4493
4493
  const o = Math.min(s - this.pos, n - i);
@@ -4505,7 +4505,7 @@ class vt {
4505
4505
  e[t] ^= s, s & 128 && t === n - 1 && this.keccak(), e[n - 1] ^= 128, this.keccak();
4506
4506
  }
4507
4507
  writeInto(e) {
4508
- Ce(this, !1), q(e), this.finish();
4508
+ Ce(this, !1), W(e), this.finish();
4509
4509
  const s = this.state, { blockLen: t } = this;
4510
4510
  for (let n = 0, i = e.length; n < i; ) {
4511
4511
  this.posOut >= t && this.keccak();
@@ -4606,11 +4606,11 @@ ${t.length}`
4606
4606
  const o = Zt(i), a = s.startsWith("0x") ? s.slice(2) : s;
4607
4607
  if (a.length !== 130)
4608
4608
  throw new Error(`서명 길이가 유효하지 않습니다: 130 hex 문자 예상, 현재 ${a.length}`);
4609
- const c = gn(a), l = c.slice(0, 32), u = c.slice(32, 64), p = c[64], _ = p >= 27 ? p - 27 : p, S = new nn.Signature(
4609
+ const c = gn(a), l = c.slice(0, 32), u = c.slice(32, 64), f = c[64], x = f >= 27 ? f - 27 : f, v = new nn.Signature(
4610
4610
  Qt(l),
4611
4611
  Qt(u)
4612
- ).addRecoveryBit(_).recoverPublicKey(o).toBytes(!1).slice(1), y = Zt(S);
4613
- return "0x" + Ue(y.slice(12));
4612
+ ).addRecoveryBit(x).recoverPublicKey(o).toBytes(!1).slice(1), S = Zt(v);
4613
+ return "0x" + Ue(S.slice(12));
4614
4614
  }
4615
4615
  }
4616
4616
  function gn(r) {
@@ -4739,85 +4739,85 @@ class Ie {
4739
4739
  }
4740
4740
  openAuth(e) {
4741
4741
  return new Promise((s, t) => {
4742
- const n = Math.max(e.width ?? 500, 500), i = Math.max(e.height ?? 700, 700), o = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - i) / 2, c = Ie.generateRandom16Hex(), l = Ie.generateRandom16Hex(), u = e.authUrl.includes("?") ? "&" : "?", p = `${e.authUrl}${u}state=${c}&nonce=${l}`;
4742
+ const n = Math.max(e.width ?? 500, 500), i = Math.max(e.height ?? 700, 700), o = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - i) / 2, c = Ie.generateRandom16Hex(), l = Ie.generateRandom16Hex(), u = e.authUrl.includes("?") ? "&" : "?", f = `${e.authUrl}${u}state=${c}&nonce=${l}`;
4743
4743
  d.log("[CROSSx] OAuth 팝업 열기 — state, nonce 생성 완료:", {
4744
4744
  stateLength: c.length,
4745
4745
  nonceLength: l.length,
4746
4746
  authUrlBase: e.authUrl
4747
4747
  });
4748
- const _ = window.open(
4749
- p,
4748
+ const x = window.open(
4749
+ f,
4750
4750
  "CROSSx OAuth",
4751
4751
  `width=${n},height=${i},left=${o},top=${a}`
4752
4752
  );
4753
- if (!_) {
4753
+ if (!x) {
4754
4754
  t(new Error("팝업 창을 열 수 없습니다. 팝업 차단을 해제해 주세요."));
4755
4755
  return;
4756
4756
  }
4757
- const f = setTimeout(() => {
4758
- d.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), D(), t(new Error("Authentication timeout"));
4759
- }, 5 * 60 * 1e3), w = 10, S = 30;
4760
- let y = 0, I = null;
4761
- const P = () => {
4762
- clearInterval(H), d.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + S + "초간 대기합니다"), I = setTimeout(() => {
4763
- D(), t(new Error(
4757
+ const _ = setTimeout(() => {
4758
+ d.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), L(), t(new Error("Authentication timeout"));
4759
+ }, 5 * 60 * 1e3), y = 10, v = 30;
4760
+ let S = 0, A = null;
4761
+ const T = () => {
4762
+ clearInterval(H), d.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + v + "초간 대기합니다"), A = setTimeout(() => {
4763
+ L(), t(new Error(
4764
4764
  "OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
4765
4765
  ));
4766
- }, S * 1e3);
4766
+ }, v * 1e3);
4767
4767
  }, H = setInterval(() => {
4768
- y++;
4768
+ S++;
4769
4769
  try {
4770
- _.closed && (y <= w ? P() : (D(), t(new Error("로그인이 취소되었습니다"))));
4770
+ x.closed && (S <= y ? T() : (L(), t(new Error("로그인이 취소되었습니다"))));
4771
4771
  } catch {
4772
- P();
4772
+ T();
4773
4773
  }
4774
- }, 1e3), D = () => {
4775
- clearTimeout(f), clearInterval(H), I && clearTimeout(I), window.removeEventListener("message", K);
4776
- }, K = (G) => {
4777
- if (G.origin !== e.expectedOrigin) return;
4778
- if (!bn.has(G.origin)) {
4779
- d.error("[CROSSx] postMessage origin이 허용 목록에 없음:", G.origin), D(), t(new Error("Unauthorized OAuth origin"));
4774
+ }, 1e3), L = () => {
4775
+ clearTimeout(_), clearInterval(H), A && clearTimeout(A), window.removeEventListener("message", V);
4776
+ }, V = (F) => {
4777
+ if (F.origin !== e.expectedOrigin) return;
4778
+ if (!bn.has(F.origin)) {
4779
+ d.error("[CROSSx] postMessage origin이 허용 목록에 없음:", F.origin), L(), t(new Error("Unauthorized OAuth origin"));
4780
4780
  return;
4781
4781
  }
4782
- D();
4783
- const Z = typeof G.data.status == "string", U = Z ? G.data.data ?? {} : G.data;
4782
+ L();
4783
+ const re = typeof F.data.status == "string", U = re ? F.data.data ?? {} : F.data;
4784
4784
  d.log("[CROSSx] OAuth postMessage 수신 —", {
4785
- format: Z ? "wrapped" : "flat",
4786
- status: Z ? G.data.status : "(flat)"
4785
+ format: re ? "wrapped" : "flat",
4786
+ status: re ? F.data.status : "(flat)"
4787
4787
  });
4788
- const z = (U == null ? void 0 : U.state) ?? G.data.state;
4789
- if (!z || z !== c) {
4788
+ const j = (U == null ? void 0 : U.state) ?? F.data.state;
4789
+ if (!j || j !== c) {
4790
4790
  t(new Error("OAuth state mismatch — possible CSRF attack"));
4791
4791
  return;
4792
4792
  }
4793
- if (Z && G.data.status !== "success") {
4793
+ if (re && F.data.status !== "success") {
4794
4794
  d.error("[CROSSx] OAuth 실패:", U == null ? void 0 : U.error), t(new Error((U == null ? void 0 : U.error) || "Authentication failed"));
4795
4795
  return;
4796
4796
  }
4797
- if (!Z && (U != null && U.error)) {
4797
+ if (!re && (U != null && U.error)) {
4798
4798
  d.error("[CROSSx] OAuth 실패:", U.error), t(new Error(U.error || "Authentication failed"));
4799
4799
  return;
4800
4800
  }
4801
- const k = U == null ? void 0 : U.idToken, v = U == null ? void 0 : U.accessToken, E = v ?? k, T = (U == null ? void 0 : U.email) || void 0;
4801
+ const Y = U == null ? void 0 : U.idToken, $ = U == null ? void 0 : U.accessToken, P = $ ?? Y, D = (U == null ? void 0 : U.email) || void 0;
4802
4802
  if (d.log("[CROSSx] OAuth 토큰 수신:", {
4803
- hasAccessToken: !!v,
4804
- hasIdToken: !!k,
4805
- hasEmail: !!T
4806
- }), !E) {
4807
- d.error("[CROSSx] 토큰을 찾을 수 없음:", G.data), t(new Error("Token not found in response"));
4803
+ hasAccessToken: !!$,
4804
+ hasIdToken: !!Y,
4805
+ hasEmail: !!D
4806
+ }), !P) {
4807
+ d.error("[CROSSx] 토큰을 찾을 수 없음:", F.data), t(new Error("Token not found in response"));
4808
4808
  return;
4809
4809
  }
4810
- const x = { token: E, email: T }, m = (b) => {
4811
- Ie.verifyIdTokenNonce(b, l).then(() => s(x)).catch((A) => {
4812
- d.error("[CROSSx] nonce 검증 실패:", A), t(A instanceof Error ? A : new Error("nonce verification failed"));
4810
+ const w = { token: P, email: D }, p = (m) => {
4811
+ Ie.verifyIdTokenNonce(m, l).then(() => s(w)).catch((b) => {
4812
+ d.error("[CROSSx] nonce 검증 실패:", b), t(b instanceof Error ? b : new Error("nonce verification failed"));
4813
4813
  });
4814
4814
  };
4815
- v ? v.split(".").length === 3 ? m(v) : k ? m(k) : (d.warn(
4815
+ $ ? $.split(".").length === 3 ? p($) : Y ? p(Y) : (d.warn(
4816
4816
  "[CROSSx] opaque accessToken만 수신 (idToken 없음) — nonce 검증 불가.",
4817
4817
  "서버 측 nonce 검증이 필요합니다."
4818
- ), s(x)) : k ? m(k) : t(new Error("Token not found in response"));
4818
+ ), s(w)) : Y ? p(Y) : t(new Error("Token not found in response"));
4819
4819
  };
4820
- window.addEventListener("message", K);
4820
+ window.addEventListener("message", V);
4821
4821
  });
4822
4822
  }
4823
4823
  }
@@ -5022,70 +5022,70 @@ class Ae {
5022
5022
  }), this._refreshPromise);
5023
5023
  }
5024
5024
  async request(e, s, t, n = !1) {
5025
- var c, l, u, p;
5025
+ var c, l, u, f;
5026
5026
  const i = await this.ensureValidToken(), o = `${this.baseUrl}${s}`, a = {
5027
5027
  Authorization: `Bearer ${i}`,
5028
5028
  "Content-Type": "application/json",
5029
5029
  "X-Project-Id": this.projectId
5030
5030
  };
5031
5031
  try {
5032
- const f = (await this.transport.request({
5032
+ const _ = (await this.transport.request({
5033
5033
  url: o,
5034
5034
  method: e,
5035
5035
  headers: a,
5036
5036
  body: t ?? void 0
5037
5037
  })).data;
5038
- if (f && typeof f.code == "number") {
5039
- if (f.code < 0 || f.code >= 400) {
5040
- const w = f.message || f.data || "API 요청에 실패했습니다";
5038
+ if (_ && typeof _.code == "number") {
5039
+ if (_.code < 0 || _.code >= 400) {
5040
+ const y = _.message || _.data || "API 요청에 실패했습니다";
5041
5041
  d.error("[CROSSx] Wallet Gateway API 에러 (HTTP 200):", {
5042
- code: f.code,
5043
- message: w,
5042
+ code: _.code,
5043
+ message: y,
5044
5044
  url: o,
5045
5045
  method: e
5046
5046
  });
5047
- const S = Ae.mapGatewayError(f.code, f.data);
5048
- if (S === h.AUTH_NOT_AUTHENTICATED && !n && this._onTokenRefresh) {
5047
+ const v = Ae.mapGatewayError(_.code, _.data);
5048
+ if (v === h.AUTH_NOT_AUTHENTICATED && !n && this._onTokenRefresh) {
5049
5049
  if (d.warn("[CROSSx] Gateway -10002 감지 — 토큰 갱신 후 재시도"), await this.deduplicatedRefresh())
5050
5050
  return this.request(e, s, t, !0);
5051
5051
  throw new g(h.SESSION_EXPIRED, "인증 세션이 만료되었습니다. 다시 로그인해 주세요.");
5052
5052
  }
5053
- if (S === h.USER_NOT_FOUND)
5053
+ if (v === h.USER_NOT_FOUND)
5054
5054
  throw d.warn("[CROSSx] Gateway -10033 감지 — 유저 미존재, 강제 로그아웃"), (c = this._onUnauthorized) == null || c.call(this), new g(
5055
5055
  h.USER_NOT_FOUND,
5056
- Ae.getGatewayErrorMessage(f.code, w)
5056
+ Ae.getGatewayErrorMessage(_.code, y)
5057
5057
  );
5058
- const y = S === h.AUTH_NOT_AUTHENTICATED ? h.SESSION_EXPIRED : S, I = y === h.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : Ae.getGatewayErrorMessage(f.code, w), P = f.data, H = S === h.PIN_LOCKED ? Ae.extractLockDetails(P) : P ?? void 0;
5059
- throw new g(y, I, H);
5058
+ const S = v === h.AUTH_NOT_AUTHENTICATED ? h.SESSION_EXPIRED : v, A = S === h.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : Ae.getGatewayErrorMessage(_.code, y), T = _.data, H = v === h.PIN_LOCKED ? Ae.extractLockDetails(T) : T ?? void 0;
5059
+ throw new g(S, A, H);
5060
5060
  }
5061
- return d.log("[CROSSx] Wallet Gateway API 성공:", { code: f.code, url: o, method: e }), f.data ?? f;
5061
+ return d.log("[CROSSx] Wallet Gateway API 성공:", { code: _.code, url: o, method: e }), _.data ?? _;
5062
5062
  }
5063
- return f;
5064
- } catch (_) {
5065
- if (_ instanceof g) throw _;
5066
- const f = ((l = _.response) == null ? void 0 : l.status) ?? _.status;
5067
- if ((f === 401 || f === 403) && !n && this._onTokenRefresh) {
5068
- if (d.warn(`[CROSSx] HTTP ${f} 감지 — 토큰 갱신 후 재시도`), await this.deduplicatedRefresh())
5063
+ return _;
5064
+ } catch (x) {
5065
+ if (x instanceof g) throw x;
5066
+ const _ = ((l = x.response) == null ? void 0 : l.status) ?? x.status;
5067
+ if ((_ === 401 || _ === 403) && !n && this._onTokenRefresh) {
5068
+ if (d.warn(`[CROSSx] HTTP ${_} 감지 — 토큰 갱신 후 재시도`), await this.deduplicatedRefresh())
5069
5069
  return this.request(e, s, t, !0);
5070
5070
  throw new g(
5071
5071
  h.SESSION_EXPIRED,
5072
5072
  "인증 세션이 만료되었습니다. 다시 로그인해 주세요."
5073
5073
  );
5074
5074
  }
5075
- if ((u = _.response) != null && u.data) {
5076
- const w = _.response.data, S = w.message || w.data || "API 요청에 실패했습니다", y = w.code || "UNKNOWN";
5075
+ if ((u = x.response) != null && u.data) {
5076
+ const y = x.response.data, v = y.message || y.data || "API 요청에 실패했습니다", S = y.code || "UNKNOWN";
5077
5077
  throw d.error("[CROSSx] Wallet Gateway API 에러 (HTTP 에러):", {
5078
- code: y,
5079
- message: S,
5078
+ code: S,
5079
+ message: v,
5080
5080
  url: o,
5081
5081
  method: e,
5082
- status: (p = _.response) == null ? void 0 : p.status
5082
+ status: (f = x.response) == null ? void 0 : f.status
5083
5083
  }), new g(
5084
5084
  h.UNKNOWN_ERROR,
5085
- `Wallet Gateway 오류 (${y}): ${S}`
5085
+ `Wallet Gateway 오류 (${S}): ${v}`
5086
5086
  );
5087
5087
  }
5088
- throw _;
5088
+ throw x;
5089
5089
  }
5090
5090
  }
5091
5091
  /**
@@ -5243,8 +5243,34 @@ class Ae {
5243
5243
  * Share-A를 KMS로 복호화해 PIN 유효성을 확인합니다 (캐시 없이 항상 Signer 호출).
5244
5244
  */
5245
5245
  async verifyPin(e) {
5246
- const s = { password: e };
5247
- return (await this.request("POST", "/mnemonic/verify-password", s)).valid;
5246
+ const s = { password: e }, t = await this.request("POST", "/mnemonic/verify-password", s);
5247
+ if (!t.valid && t.passwordStatus) {
5248
+ const n = t.passwordStatus;
5249
+ if (n.permanent)
5250
+ throw new g(h.PIN_LOCKED, "Incorrect PIN.", {
5251
+ permanent: !0,
5252
+ lockExpiresAt: n.lockExpiresAt,
5253
+ remainingAttempts: 0,
5254
+ maxAttempts: n.maxAttempts
5255
+ });
5256
+ if (n.remainingAttempts === 0 && n.lockExpiresAt) {
5257
+ const i = n.lockExpiresAt > 1e10 ? n.lockExpiresAt : n.lockExpiresAt * 1e3;
5258
+ throw new g(h.PIN_LOCKED, "Too many failed PIN attempts.", {
5259
+ permanent: !1,
5260
+ lockExpiresAt: i,
5261
+ remainingAttempts: 0,
5262
+ maxAttempts: n.maxAttempts
5263
+ });
5264
+ }
5265
+ if (n.remainingAttempts != null && n.remainingAttempts > 0)
5266
+ throw new g(h.PIN_LOCKED, "Incorrect PIN.", {
5267
+ permanent: !1,
5268
+ lockExpiresAt: 0,
5269
+ remainingAttempts: n.remainingAttempts,
5270
+ maxAttempts: n.maxAttempts
5271
+ });
5272
+ }
5273
+ return t.valid;
5248
5274
  }
5249
5275
  /**
5250
5276
  * POST /mnemonic/change-password — PIN 변경
@@ -7488,7 +7514,7 @@ function qe() {
7488
7514
  document.body.style.overflow = r;
7489
7515
  };
7490
7516
  }
7491
- function re(r) {
7517
+ function se(r) {
7492
7518
  return r ? r.length <= 13 ? r : `${r.slice(0, 6)}…${r.slice(-4)}` : "—";
7493
7519
  }
7494
7520
  function An(r, e = "CROSS", s = 18) {
@@ -7580,9 +7606,9 @@ function Rn(r) {
7580
7606
  }
7581
7607
  function $s(r) {
7582
7608
  const e = Rn(r);
7583
- if (!e) return j("Estimated fee", "<span>—</span>");
7584
- let s = j("Est. Tx Fee", `<span>${e.estTxFee}</span>`);
7585
- return e.isDynamic ? (e.maxPriorityFeeGwei !== void 0 && (s += j("Max Priority Fee", `<span>${e.maxPriorityFeeGwei} Gwei</span>`)), e.maxFeeGwei !== void 0 && (s += j("Max Gas Fee", `<span>${e.maxFeeGwei} Gwei</span>`))) : e.gasPriceGwei !== void 0 && (s += j("Gas Price", `<span>${e.gasPriceGwei} Gwei</span>`)), e.gasLimitFormatted && (s += j("Gas Limit", `<span>${e.gasLimitFormatted}</span>`)), s;
7609
+ if (!e) return z("Estimated fee", "<span>—</span>");
7610
+ let s = z("Est. Tx Fee", `<span>${e.estTxFee}</span>`);
7611
+ return e.isDynamic ? (e.maxPriorityFeeGwei !== void 0 && (s += z("Max Priority Fee", `<span>${e.maxPriorityFeeGwei} Gwei</span>`)), e.maxFeeGwei !== void 0 && (s += z("Max Gas Fee", `<span>${e.maxFeeGwei} Gwei</span>`))) : e.gasPriceGwei !== void 0 && (s += z("Gas Price", `<span>${e.gasPriceGwei} Gwei</span>`)), e.gasLimitFormatted && (s += z("Gas Limit", `<span>${e.gasLimitFormatted}</span>`)), s;
7586
7612
  }
7587
7613
  const me = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
7588
7614
  <rect x="9" y="9" width="13" height="13" rx="2"/>
@@ -7630,7 +7656,7 @@ function ae(r) {
7630
7656
  `--cx-on-primary:${r.onPrimary}`
7631
7657
  ].join(";");
7632
7658
  }
7633
- function j(r, e) {
7659
+ function z(r, e) {
7634
7660
  return `
7635
7661
  <div class="__crossx-row">
7636
7662
  <span class="__crossx-row-label">${r}</span>
@@ -7638,8 +7664,8 @@ function j(r, e) {
7638
7664
  </div>`;
7639
7665
  }
7640
7666
  function Cn(r, e) {
7641
- const s = e, t = Qe(r.dappName), n = r.to ? `<span class="__crossx-addr-text">${re(r.to)}</span>
7642
- <button class="__crossx-copy-btn" data-copy="${L(r.to)}" title="Copy address">${me}</button>` : "<span>—</span>", i = $s(r), o = r.data ?? "0x", a = document.createElement("div");
7667
+ const s = e, t = Qe(r.dappName), n = r.to ? `<span class="__crossx-addr-text">${se(r.to)}</span>
7668
+ <button class="__crossx-copy-btn" data-copy="${N(r.to)}" title="Copy address">${me}</button>` : "<span>—</span>", i = $s(r), o = r.data ?? "0x", a = document.createElement("div");
7643
7669
  return a.id = J, a.innerHTML = `
7644
7670
  <div class="__crossx-card __crossx-card--migration __crossx-card--sign-tx" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7645
7671
  <div class="__crossx-header">
@@ -7651,22 +7677,22 @@ function Cn(r, e) {
7651
7677
  <div class="__crossx-body-cols">
7652
7678
  <div class="__crossx-col-left">
7653
7679
  <p class="__crossx-sig-subtitle">
7654
- <span class="__crossx-sig-origin">${L(t)} </span>is requesting a Signature
7680
+ <span class="__crossx-sig-origin">${N(t)} </span>is requesting a Signature
7655
7681
  </p>
7656
7682
  <div class="__crossx-addr-pill">
7657
7683
  ${Et}
7658
- <span class="__crossx-addr-pill-text">${re(r.from)}</span>
7684
+ <span class="__crossx-addr-pill-text">${se(r.from)}</span>
7659
7685
  </div>
7660
7686
  <p class="__crossx-warning">After you sign, changes or cancellations are not possible.</p>
7661
7687
  </div>
7662
7688
  <hr class="__crossx-divider __crossx-divider--cols">
7663
7689
  <div class="__crossx-col-right-sign">
7664
7690
  <div class="__crossx-rows">
7665
- ${j("To", n)}
7666
- ${j("Network", `<span>${Ms(r.chainId)}</span>`)}
7691
+ ${z("To", n)}
7692
+ ${z("Network", `<span>${Ms(r.chainId)}</span>`)}
7667
7693
  ${i}
7668
7694
  </div>
7669
- <pre class="__crossx-raw-tx">${L(o)}</pre>
7695
+ <pre class="__crossx-raw-tx">${N(o)}</pre>
7670
7696
  </div>
7671
7697
  </div>
7672
7698
  <div class="__crossx-btn-row">
@@ -7678,8 +7704,8 @@ function Cn(r, e) {
7678
7704
  `, a;
7679
7705
  }
7680
7706
  function Nn(r, e) {
7681
- const s = e, t = r.nativeSymbol ?? "ETH", n = r.nativeDecimals ?? 18, i = Qe(r.dappName), o = r.to ? `<span class="__crossx-addr-text">${re(r.to)}</span>
7682
- <button class="__crossx-copy-btn" data-copy="${L(r.to)}" title="Copy address">${me}</button>` : "<span>—</span>", a = $s(r), l = An(r.value, t, n) ?? "—", u = document.createElement("div");
7707
+ const s = e, t = r.nativeSymbol ?? "ETH", n = r.nativeDecimals ?? 18, i = Qe(r.dappName), o = r.to ? `<span class="__crossx-addr-text">${se(r.to)}</span>
7708
+ <button class="__crossx-copy-btn" data-copy="${N(r.to)}" title="Copy address">${me}</button>` : "<span>—</span>", a = $s(r), l = An(r.value, t, n) ?? "—", u = document.createElement("div");
7683
7709
  return u.id = J, u.innerHTML = `
7684
7710
  <div class="__crossx-card __crossx-card--migration __crossx-card--send-tx" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7685
7711
  <div class="__crossx-header">
@@ -7689,16 +7715,16 @@ function Nn(r, e) {
7689
7715
  <hr class="__crossx-divider">
7690
7716
  <div class="__crossx-body">
7691
7717
  <p class="__crossx-tx-subtitle">
7692
- <span class="__crossx-sig-origin">${L(i)}</span> wants your permission to approve the following transaction.
7718
+ <span class="__crossx-sig-origin">${N(i)}</span> wants your permission to approve the following transaction.
7693
7719
  </p>
7694
7720
  <div class="__crossx-body-cols">
7695
7721
  <div class="__crossx-rows">
7696
- ${j("To", o)}
7697
- ${j("Network", `<span>${Ms(r.chainId)}</span>`)}
7722
+ ${z("To", o)}
7723
+ ${z("Network", `<span>${Ms(r.chainId)}</span>`)}
7698
7724
  ${a}
7699
7725
  </div>
7700
7726
  <div class="__crossx-pill">
7701
- <span class="__crossx-pill-from">${re(r.from)}</span>
7727
+ <span class="__crossx-pill-from">${se(r.from)}</span>
7702
7728
  <span class="__crossx-pill-amount">${l}</span>
7703
7729
  </div>
7704
7730
  </div>
@@ -7716,31 +7742,31 @@ function Qe(r) {
7716
7742
  return "This site";
7717
7743
  }
7718
7744
  }
7719
- function L(r) {
7745
+ function N(r) {
7720
7746
  return r.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
7721
7747
  }
7722
7748
  function Ln(r) {
7723
7749
  return typeof r == "string" && /^0x[0-9a-fA-F]{40}$/i.test(r);
7724
7750
  }
7725
7751
  function Dn(r) {
7726
- if (typeof r == "string") return L(r);
7752
+ if (typeof r == "string") return N(r);
7727
7753
  if (typeof r == "number" || typeof r == "bigint" || typeof r == "boolean") return String(r);
7728
7754
  try {
7729
- return L(JSON.stringify(r));
7755
+ return N(JSON.stringify(r));
7730
7756
  } catch {
7731
7757
  return String(r);
7732
7758
  }
7733
7759
  }
7734
7760
  function Mn(r, e) {
7735
- const s = j(
7761
+ const s = z(
7736
7762
  "From",
7737
- `<span class="__crossx-addr-text">${re(r.from)}</span>
7738
- <button class="__crossx-copy-btn" data-copy="${L(r.from)}" title="Copy address">${me}</button>`
7739
- ), t = r.to ? j("To", `<span class="__crossx-addr-text">${re(r.to)}</span>
7740
- <button class="__crossx-copy-btn" data-copy="${L(r.to)}" title="Copy address">${me}</button>`) : "", n = r.amount ? j("Transfer", `<span>${L(r.amount)}</span>`) : "", i = r.fees ? j("Tx Fee", `<span>${L(r.fees)}</span>`) : "", o = r.txHash ? j("Tx Hash", `<span class="__crossx-addr-text">${re(r.txHash)}</span>
7741
- <button class="__crossx-copy-btn" data-copy="${L(r.txHash)}" title="Copy hash">${me}</button>`) : "", a = r.total ? `<div class="__crossx-total-pill">
7763
+ `<span class="__crossx-addr-text">${se(r.from)}</span>
7764
+ <button class="__crossx-copy-btn" data-copy="${N(r.from)}" title="Copy address">${me}</button>`
7765
+ ), t = r.to ? z("To", `<span class="__crossx-addr-text">${se(r.to)}</span>
7766
+ <button class="__crossx-copy-btn" data-copy="${N(r.to)}" title="Copy address">${me}</button>`) : "", n = r.amount ? z("Transfer", `<span>${N(r.amount)}</span>`) : "", i = r.fees ? z("Tx Fee", `<span>${N(r.fees)}</span>`) : "", o = r.txHash ? z("Tx Hash", `<span class="__crossx-addr-text">${se(r.txHash)}</span>
7767
+ <button class="__crossx-copy-btn" data-copy="${N(r.txHash)}" title="Copy hash">${me}</button>`) : "", a = r.total ? `<div class="__crossx-total-pill">
7742
7768
  <span class="__crossx-total-label">Total<br>(including fees)</span>
7743
- <span class="__crossx-total-amount">${L(r.total)}</span>
7769
+ <span class="__crossx-total-amount">${N(r.total)}</span>
7744
7770
  </div>` : "", c = document.createElement("div");
7745
7771
  return c.id = J, c.innerHTML = `
7746
7772
  <div class="__crossx-card __crossx-card--migration" style="${ae(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -7783,44 +7809,44 @@ function $n(r, e) {
7783
7809
  function Bn(r, e, s) {
7784
7810
  const t = e.status !== "reverted" && e.status !== "timeout", n = e.status === "timeout", i = r.querySelector("#__crossx-ttl"), o = r.querySelector(".__crossx-header");
7785
7811
  if (i) {
7786
- const w = n ? Pn : t ? "" : On, S = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
7787
- w ? (i.style.display = "flex", i.style.alignItems = "center", i.style.gap = "8px", i.innerHTML = `${w}<span>${S}</span>`) : i.textContent = S;
7812
+ const y = n ? Pn : t ? "" : On, v = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
7813
+ y ? (i.style.display = "flex", i.style.alignItems = "center", i.style.gap = "8px", i.innerHTML = `${y}<span>${v}</span>`) : i.textContent = v;
7788
7814
  }
7789
7815
  if (o && !r.querySelector("#__crossx-close-btn")) {
7790
- const w = document.createElement("button");
7791
- w.className = "__crossx-close", w.id = "__crossx-close-btn", w.setAttribute("aria-label", "Close"), w.innerHTML = ie, o.appendChild(w);
7816
+ const y = document.createElement("button");
7817
+ y.className = "__crossx-close", y.id = "__crossx-close-btn", y.setAttribute("aria-label", "Close"), y.innerHTML = ie, o.appendChild(y);
7792
7818
  }
7793
7819
  const a = r.querySelector("#__crossx-progress-body");
7794
7820
  if (!a) return;
7795
- const c = e.from ? j("From", `<span class="__crossx-addr-text">${re(e.from)}</span>
7796
- <button class="__crossx-copy-btn" data-copy="${L(e.from)}" title="Copy address">${me}</button>`) : "", l = e.to ? j("To", `<span class="__crossx-addr-text">${re(e.to)}</span>
7797
- <button class="__crossx-copy-btn" data-copy="${L(e.to)}" title="Copy address">${me}</button>`) : "", u = e.amount ? j("Transfer", `<span>${L(e.amount)}</span>`) : "", p = e.fees ? j("Tx Fee", `<span>${L(e.fees)}</span>`) : "", _ = e.txHash ? j("Tx Hash", `<span class="__crossx-addr-text">${re(e.txHash)}</span>
7798
- <button class="__crossx-copy-btn" data-copy="${L(e.txHash)}" title="Copy hash">${me}</button>`) : "", f = e.total ? `<div class="__crossx-total-pill">
7821
+ const c = e.from ? z("From", `<span class="__crossx-addr-text">${se(e.from)}</span>
7822
+ <button class="__crossx-copy-btn" data-copy="${N(e.from)}" title="Copy address">${me}</button>`) : "", l = e.to ? z("To", `<span class="__crossx-addr-text">${se(e.to)}</span>
7823
+ <button class="__crossx-copy-btn" data-copy="${N(e.to)}" title="Copy address">${me}</button>`) : "", u = e.amount ? z("Transfer", `<span>${N(e.amount)}</span>`) : "", f = e.fees ? z("Tx Fee", `<span>${N(e.fees)}</span>`) : "", x = e.txHash ? z("Tx Hash", `<span class="__crossx-addr-text">${se(e.txHash)}</span>
7824
+ <button class="__crossx-copy-btn" data-copy="${N(e.txHash)}" title="Copy hash">${me}</button>`) : "", _ = e.total ? `<div class="__crossx-total-pill">
7799
7825
  <span class="__crossx-total-label">Total<br>(including fees)</span>
7800
- <span class="__crossx-total-amount">${L(e.total)}</span>
7826
+ <span class="__crossx-total-amount">${N(e.total)}</span>
7801
7827
  </div>` : "";
7802
7828
  a.innerHTML = `
7803
7829
  <div class="__crossx-rows">
7804
7830
  ${c}
7805
7831
  ${l}
7806
7832
  ${u}
7807
- ${p}
7808
- ${_}
7833
+ ${f}
7834
+ ${x}
7809
7835
  </div>
7810
- ${f}
7836
+ ${_}
7811
7837
  <button class="__crossx-approve-btn" id="__crossx-done-btn">${t ? "All Done" : "Done"}</button>
7812
- `, a.querySelectorAll(".__crossx-copy-btn").forEach((w) => {
7813
- w.addEventListener("click", (S) => {
7814
- var I;
7815
- S.stopPropagation();
7816
- const y = w.dataset.copy;
7817
- y && ((I = navigator.clipboard) == null || I.writeText(y).catch(() => {
7838
+ `, a.querySelectorAll(".__crossx-copy-btn").forEach((y) => {
7839
+ y.addEventListener("click", (v) => {
7840
+ var A;
7841
+ v.stopPropagation();
7842
+ const S = y.dataset.copy;
7843
+ S && ((A = navigator.clipboard) == null || A.writeText(S).catch(() => {
7818
7844
  }));
7819
7845
  });
7820
7846
  });
7821
7847
  }
7822
7848
  function Un(r, e) {
7823
- const s = e, t = Qe(r.dappName), n = L(r.message), i = document.createElement("div");
7849
+ const s = e, t = Qe(r.dappName), n = N(r.message), i = document.createElement("div");
7824
7850
  return i.id = J, i.innerHTML = `
7825
7851
  <div class="__crossx-card __crossx-card--migration __crossx-card--sign-msg" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7826
7852
  <div class="__crossx-header">
@@ -7832,11 +7858,11 @@ function Un(r, e) {
7832
7858
  <div class="__crossx-body-cols">
7833
7859
  <div class="__crossx-col-left">
7834
7860
  <p class="__crossx-sig-subtitle">
7835
- <span class="__crossx-sig-origin">${L(t)} </span>is requesting a Signature
7861
+ <span class="__crossx-sig-origin">${N(t)} </span>is requesting a Signature
7836
7862
  </p>
7837
7863
  <div class="__crossx-addr-pill">
7838
7864
  ${Et}
7839
- <span class="__crossx-addr-pill-text">${re(r.from)}</span>
7865
+ <span class="__crossx-addr-pill-text">${se(r.from)}</span>
7840
7866
  </div>
7841
7867
  <p class="__crossx-warning">After you sign, changes or cancellations are not possible.</p>
7842
7868
  </div>
@@ -7864,15 +7890,15 @@ function Hn(r, e) {
7864
7890
  let a = `
7865
7891
  <div class="__crossx-td-row">
7866
7892
  <span class="__crossx-td-label">Primary Type</span>
7867
- <span class="__crossx-td-value">${L(i)}</span>
7893
+ <span class="__crossx-td-value">${N(i)}</span>
7868
7894
  </div>`;
7869
7895
  for (const [l, u] of Object.entries(o)) {
7870
- const p = Dn(u), f = Ln(u) ? `<span class="__crossx-addr-text">${re(u)}</span>
7871
- <button class="__crossx-copy-btn" data-copy="${L(String(u))}" title="Copy">${me}</button>` : `<span>${p}</span>`;
7896
+ const f = Dn(u), _ = Ln(u) ? `<span class="__crossx-addr-text">${se(u)}</span>
7897
+ <button class="__crossx-copy-btn" data-copy="${N(String(u))}" title="Copy">${me}</button>` : `<span>${f}</span>`;
7872
7898
  a += `
7873
7899
  <div class="__crossx-td-row">
7874
- <span class="__crossx-td-label">${L(l)}</span>
7875
- <div class="__crossx-td-value">${f}</div>
7900
+ <span class="__crossx-td-label">${N(l)}</span>
7901
+ <div class="__crossx-td-value">${_}</div>
7876
7902
  </div>`;
7877
7903
  }
7878
7904
  const c = document.createElement("div");
@@ -7887,11 +7913,11 @@ function Hn(r, e) {
7887
7913
  <div class="__crossx-body-cols">
7888
7914
  <div class="__crossx-col-left">
7889
7915
  <p class="__crossx-sig-subtitle">
7890
- <span class="__crossx-sig-origin">${L(t)} </span>is requesting a Signature
7916
+ <span class="__crossx-sig-origin">${N(t)} </span>is requesting a Signature
7891
7917
  </p>
7892
7918
  <div class="__crossx-addr-pill">
7893
7919
  ${Et}
7894
- <span class="__crossx-addr-pill-text">${re(r.from)}</span>
7920
+ <span class="__crossx-addr-pill-text">${se(r.from)}</span>
7895
7921
  </div>
7896
7922
  <p class="__crossx-warning">After you sign, changes or cancellations are not possible.</p>
7897
7923
  </div>
@@ -7913,9 +7939,9 @@ const Fn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="
7913
7939
  function Gn(r, e, s) {
7914
7940
  const t = s == null ? void 0 : s.toLowerCase(), n = r.map((o) => {
7915
7941
  const a = t && o.address.toLowerCase() === t;
7916
- return `<button class="__crossx-wallet-item" data-wallet-index="${o.index}" data-wallet-address="${L(o.address)}">
7942
+ return `<button class="__crossx-wallet-item" data-wallet-index="${o.index}" data-wallet-address="${N(o.address)}">
7917
7943
  <span class="__crossx-wallet-idx">${o.index + 1}</span>
7918
- <span class="__crossx-wallet-addr">${re(o.address)}</span>${a ? '<span class="__crossx-wallet-selected">selected</span>' : ""}
7944
+ <span class="__crossx-wallet-addr">${se(o.address)}</span>${a ? '<span class="__crossx-wallet-selected">selected</span>' : ""}
7919
7945
  </button>`;
7920
7946
  }).join(""), i = document.createElement("div");
7921
7947
  return i.id = J, i.innerHTML = `
@@ -8002,26 +8028,26 @@ function Kn(r, e = !1) {
8002
8028
  function Vn(r, e) {
8003
8029
  const s = r, t = document.createElement("div");
8004
8030
  t.id = J;
8005
- const n = L(e.message).replace(/\n/g, "<br>"), i = e.email ? `<div class="__crossx-session-account-card">
8006
- <p class="__crossx-session-account-label">${L(e.accountLabel)}</p>
8007
- <p class="__crossx-session-account-email">${L(e.email)}</p>
8031
+ const n = N(e.message).replace(/\n/g, "<br>"), i = e.email ? `<div class="__crossx-session-account-card">
8032
+ <p class="__crossx-session-account-label">${N(e.accountLabel)}</p>
8033
+ <p class="__crossx-session-account-email">${N(e.email)}</p>
8008
8034
  </div>` : "";
8009
8035
  return t.innerHTML = `
8010
8036
  <div class="__crossx-card __crossx-card--migration" style="${ae(s)}" role="alertdialog" aria-modal="true" aria-labelledby="__crossx-session-header-title" aria-describedby="__crossx-session-msg">
8011
8037
  <div class="__crossx-header">
8012
- <p class="__crossx-title" id="__crossx-session-header-title">${L(e.title)}</p>
8038
+ <p class="__crossx-title" id="__crossx-session-header-title">${N(e.title)}</p>
8013
8039
  <button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ie}</button>
8014
8040
  </div>
8015
8041
  <hr class="__crossx-divider">
8016
8042
  <div class="__crossx-body" style="padding:20px 24px 24px;display:flex;flex-direction:column;gap:16px;">
8017
8043
  <div class="__crossx-session-hero">
8018
- <p class="__crossx-session-hero-title">${L(e.title)}</p>
8044
+ <p class="__crossx-session-hero-title">${N(e.title)}</p>
8019
8045
  <p class="__crossx-session-hero-message" id="__crossx-session-msg">${n}</p>
8020
8046
  </div>
8021
8047
  ${i}
8022
8048
  <div class="__crossx-btn-row">
8023
- <button class="__crossx-cancel-btn" id="__crossx-session-signout">${L(e.signOutLabel)}</button>
8024
- <button class="__crossx-confirm-btn" id="__crossx-session-signin">${L(e.signInAgainLabel)}</button>
8049
+ <button class="__crossx-cancel-btn" id="__crossx-session-signout">${N(e.signOutLabel)}</button>
8050
+ <button class="__crossx-confirm-btn" id="__crossx-session-signin">${N(e.signInAgainLabel)}</button>
8025
8051
  </div>
8026
8052
  </div>
8027
8053
  </div>
@@ -8052,8 +8078,8 @@ function zn(r, e = !0) {
8052
8078
  `, i;
8053
8079
  }
8054
8080
  function jn(r, e) {
8055
- const s = r, { errorMessage: t, attemptCount: n, maxAttempts: i = 5 } = e ?? {}, o = !!t, a = o ? " --error" : "", c = n != null && n > 0 ? `<p class="__crossx-pin-attempt">${n}/${i}</p>` : "", l = n != null && n >= 3 ? '<p class="__crossx-pin-warning">Your account will be locked after further failures.</p>' : "", u = o ? `<p class="__crossx-pin-error-text">${t}</p>` : "", p = document.createElement("div");
8056
- return p.id = J, p.innerHTML = `
8081
+ const s = r, { errorMessage: t, attemptCount: n, maxAttempts: i = 5 } = e ?? {}, o = !!t, a = o ? " --error" : "", c = n != null && n > 0 ? `<p class="__crossx-pin-attempt">${n}/${i}</p>` : "", l = n != null && n >= 3 ? '<p class="__crossx-pin-warning">Your account will be locked after further failures.</p>' : "", u = o ? `<p class="__crossx-pin-error-text">${t}</p>` : "", f = document.createElement("div");
8082
+ return f.id = J, f.innerHTML = `
8057
8083
  <div class="__crossx-card __crossx-card--migration" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
8058
8084
  <div class="__crossx-header">
8059
8085
  <p class="__crossx-title" id="__crossx-ttl">Import from Social Backup</p>
@@ -8073,7 +8099,7 @@ function jn(r, e) {
8073
8099
  ${u}
8074
8100
  </div>
8075
8101
  </div>
8076
- `, p;
8102
+ `, f;
8077
8103
  }
8078
8104
  function Yn(r) {
8079
8105
  const e = new Date(r), s = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], t = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], n = s[e.getDay()], i = t[e.getMonth()], o = e.getDate(), a = String(e.getHours()).padStart(2, "0"), c = String(e.getMinutes()).padStart(2, "0");
@@ -8104,23 +8130,23 @@ function Xn(r, e, s) {
8104
8130
  `, { overlay: a, startCountdown: (l) => {
8105
8131
  if (n || !i) return () => {
8106
8132
  };
8107
- const p = setInterval(() => {
8108
- Date.now() >= i && (clearInterval(p), l());
8133
+ const f = setInterval(() => {
8134
+ Date.now() >= i && (clearInterval(f), l());
8109
8135
  }, 1e3);
8110
- return () => clearInterval(p);
8136
+ return () => clearInterval(f);
8111
8137
  } };
8112
8138
  }
8113
8139
  function Jn(r) {
8114
8140
  const s = [r.check1, r.check2].map((t, n) => `
8115
8141
  <div class="__crossx-pw-notice-item" data-check-index="${n}" role="checkbox" aria-checked="false" tabindex="0">
8116
8142
  <div class="__crossx-pw-notice-check" id="__crossx-notice-check-${n}">${ei}</div>
8117
- <span class="__crossx-pw-notice-item-text">${L(t)}</span>
8143
+ <span class="__crossx-pw-notice-item-text">${N(t)}</span>
8118
8144
  </div>
8119
8145
  `).join("");
8120
8146
  return `
8121
8147
  <div class="__crossx-header">
8122
- <p class="__crossx-title" id="__crossx-ttl" style="padding-right:48px;">${L(r.title)}</p>
8123
- <p class="__crossx-pw-subtitle">${L(r.headerSubtitle)}</p>
8148
+ <p class="__crossx-title" id="__crossx-ttl" style="padding-right:48px;">${N(r.title)}</p>
8149
+ <p class="__crossx-pw-subtitle">${N(r.headerSubtitle)}</p>
8124
8150
  <button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ie}</button>
8125
8151
  </div>
8126
8152
  <hr class="__crossx-divider">
@@ -8129,34 +8155,34 @@ function Jn(r) {
8129
8155
  <div class="__crossx-pw-notice-header">
8130
8156
  <div class="__crossx-pw-notice-title-row">
8131
8157
  <span class="__crossx-pw-notice-icon">${ti}</span>
8132
- <p class="__crossx-pw-notice-title">${L(r.noticeTitle)}</p>
8158
+ <p class="__crossx-pw-notice-title">${N(r.noticeTitle)}</p>
8133
8159
  </div>
8134
- <p class="__crossx-pw-notice-desc">${L(r.noticeDesc)}</p>
8160
+ <p class="__crossx-pw-notice-desc">${N(r.noticeDesc)}</p>
8135
8161
  </div>
8136
8162
  <div class="__crossx-pw-notice-checks" id="__crossx-notice-checks">
8137
8163
  ${s}
8138
8164
  </div>
8139
8165
  </div>
8140
8166
  <button class="__crossx-pw-btn --disabled" id="__crossx-pin-notice-next"
8141
- data-next-label="${L(r.nextButton)}"
8142
- data-submit-label="${L(r.submitButton)}">
8143
- ${L(r.nextButton)}
8167
+ data-next-label="${N(r.nextButton)}"
8168
+ data-submit-label="${N(r.submitButton)}">
8169
+ ${N(r.nextButton)}
8144
8170
  </button>
8145
8171
  </div>
8146
8172
  <div class="__crossx-home-indicator"></div>
8147
8173
  `;
8148
8174
  }
8149
8175
  function ct(r) {
8150
- const e = !!r.lockExpiresAt && r.lockExpiresAt > Date.now(), s = r.lockExpiresAt ? ` data-lock-expires="${r.lockExpiresAt}"` : "", t = r.headerSubtitle ? `<p class="__crossx-pin6-header-sub">${L(r.headerSubtitle)}</p>` : "", n = r.subtitle ? `<p class="__crossx-pin6-subtitle">${L(r.subtitle)}</p>` : "", i = r.errorMessage ? `<p class="__crossx-pin6-error" id="__crossx-pin6-error">${L(r.errorMessage)}</p>` : '<p class="__crossx-pin6-error" id="__crossx-pin6-error"></p>', o = e ? `<p class="__crossx-pin6-lock-msg" id="__crossx-pin6-lock-msg">
8176
+ const e = !!r.lockExpiresAt && r.lockExpiresAt > Date.now(), s = r.lockExpiresAt ? ` data-lock-expires="${r.lockExpiresAt}"` : "", t = r.headerSubtitle ? `<p class="__crossx-pin6-header-sub">${N(r.headerSubtitle)}</p>` : "", n = r.subtitle ? `<p class="__crossx-pin6-subtitle">${N(r.subtitle)}</p>` : "", i = r.errorMessage ? `<p class="__crossx-pin6-error" id="__crossx-pin6-error">${N(r.errorMessage)}</p>` : '<p class="__crossx-pin6-error" id="__crossx-pin6-error"></p>', o = e ? `<p class="__crossx-pin6-lock-msg" id="__crossx-pin6-lock-msg">
8151
8177
  ${Bs}
8152
8178
  <span id="__crossx-pin6-lock-countdown"></span>
8153
- </p>` : "", a = r.attemptCount != null && r.attemptCount > 0 ? `<p class="__crossx-pin6-attempt" id="__crossx-pin6-attempt">${r.attemptCount}/${r.maxAttempts ?? "?"}</p>` : '<p class="__crossx-pin6-attempt" id="__crossx-pin6-attempt"></p>', c = e ? " --locked" : "", l = Array.from(
8179
+ </p>` : "", a = r.warningMessage && r.attemptCount != null && r.attemptCount > 0 ? `<p class="__crossx-pin6-warning" id="__crossx-pin6-warning">${N(r.warningMessage)}</p>` : '<p class="__crossx-pin6-warning" id="__crossx-pin6-warning"></p>', c = r.attemptCount != null && r.attemptCount > 0 ? `<p class="__crossx-pin6-attempt" id="__crossx-pin6-attempt">${r.attemptCount}/${r.maxAttempts ?? "?"}</p>` : '<p class="__crossx-pin6-attempt" id="__crossx-pin6-attempt"></p>', l = e ? " --locked" : "", u = Array.from(
8154
8180
  { length: 6 },
8155
- (u, p) => `<input class="__crossx-pin6-box${c}" type="password" maxlength="1" inputmode="numeric" pattern="[0-9]" autocomplete="off" aria-label="PIN digit ${p + 1}"${e ? " disabled" : ""}>`
8181
+ (f, x) => `<input class="__crossx-pin6-box${l}" type="password" maxlength="1" inputmode="numeric" pattern="[0-9]" autocomplete="off" aria-label="PIN digit ${x + 1}"${e ? " disabled" : ""}>`
8156
8182
  ).join("");
8157
8183
  return `
8158
8184
  <div class="__crossx-header">
8159
- <p class="__crossx-title" id="__crossx-ttl" style="padding-right:48px;">${L(r.title)}</p>
8185
+ <p class="__crossx-title" id="__crossx-ttl" style="padding-right:48px;">${N(r.title)}</p>
8160
8186
  ${t}
8161
8187
  <button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ie}</button>
8162
8188
  </div>
@@ -8164,10 +8190,11 @@ function ct(r) {
8164
8190
  <div class="__crossx-pin6-body"${s}>
8165
8191
  ${n}
8166
8192
  <div class="__crossx-pin6-boxes" id="__crossx-pin6-boxes">
8167
- ${l}
8193
+ ${u}
8168
8194
  </div>
8169
8195
  ${i}
8170
8196
  ${a}
8197
+ ${c}
8171
8198
  ${o}
8172
8199
  </div>
8173
8200
  <div class="__crossx-home-indicator"></div>
@@ -8192,124 +8219,136 @@ function Qn(r) {
8192
8219
  const e = Math.max(0, Math.ceil(r / 1e3)), s = Math.floor(e / 3600), t = Math.floor(e % 3600 / 60), n = e % 60;
8193
8220
  return s > 0 ? `${s}h ${String(t).padStart(2, "0")}m` : `${String(t).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
8194
8221
  }
8195
- function lt(r, e, s, t, n, i) {
8196
- var U, z;
8197
- let o = !!(i && i > Date.now()), a = !1;
8198
- const c = () => Array.from(r.querySelectorAll(".__crossx-pin6-box")), l = () => r.querySelector("#__crossx-pin6-boxes"), u = () => r.querySelector("#__crossx-pin6-error"), p = () => r.querySelector("#__crossx-pin6-lock-msg"), _ = () => r.querySelector("#__crossx-pin6-lock-countdown"), f = () => r.querySelector(".__crossx-pin6-body"), w = () => c().map((k) => k.value).join(""), S = (k) => {
8199
- o = k, c().forEach((v) => {
8200
- v.disabled = k, v.classList.toggle("--locked", k);
8222
+ function lt(r, e, s, t, n, i, o) {
8223
+ var D, w;
8224
+ let a = !!(i && i > Date.now()), c = !1;
8225
+ const l = () => Array.from(r.querySelectorAll(".__crossx-pin6-box")), u = () => r.querySelector("#__crossx-pin6-boxes"), f = () => r.querySelector("#__crossx-pin6-error"), x = () => r.querySelector("#__crossx-pin6-lock-msg"), _ = () => r.querySelector("#__crossx-pin6-lock-countdown"), y = () => r.querySelector(".__crossx-pin6-body"), v = () => l().map((p) => p.value).join(""), S = (p) => {
8226
+ a = p, l().forEach((m) => {
8227
+ m.disabled = p, m.classList.toggle("--locked", p);
8201
8228
  });
8202
- }, y = () => r.querySelector("#__crossx-pin6-attempt"), I = () => {
8203
- const k = u();
8204
- k && (k.textContent = "");
8205
- }, P = (k, v) => {
8206
- var T;
8207
- let E = y();
8208
- if (!E) {
8209
- E = document.createElement("p"), E.className = "__crossx-pin6-attempt", E.id = "__crossx-pin6-attempt";
8210
- const x = u();
8211
- x ? x.insertAdjacentElement("afterend", E) : (T = f()) == null || T.appendChild(E);
8212
- }
8213
- E.textContent = `${k}/${v}`;
8214
- }, H = () => {
8215
- const k = y();
8216
- k && (k.textContent = "");
8217
- }, D = (k) => {
8218
- const v = u();
8219
- v && (v.textContent = k);
8220
- const E = l();
8221
- E == null || E.classList.add("--shake"), setTimeout(() => E == null ? void 0 : E.classList.remove("--shake"), 500), c().forEach((T) => {
8222
- T.value = "";
8229
+ }, A = () => r.querySelector("#__crossx-pin6-attempt"), T = () => {
8230
+ const p = f();
8231
+ p && (p.textContent = "");
8232
+ }, H = () => o ?? "Your account will be locked after further failures.", L = () => r.querySelector("#__crossx-pin6-warning"), V = (p) => {
8233
+ var b;
8234
+ let m = L();
8235
+ if (!m) {
8236
+ m = document.createElement("p"), m.className = "__crossx-pin6-warning", m.id = "__crossx-pin6-warning";
8237
+ const I = f();
8238
+ I ? I.insertAdjacentElement("afterend", m) : (b = y()) == null || b.appendChild(m);
8239
+ }
8240
+ m.textContent = p;
8241
+ }, F = () => {
8242
+ const p = L();
8243
+ p && (p.textContent = "");
8244
+ }, re = (p, m) => {
8245
+ var I;
8246
+ let b = A();
8247
+ if (!b) {
8248
+ b = document.createElement("p"), b.className = "__crossx-pin6-attempt", b.id = "__crossx-pin6-attempt";
8249
+ const R = L() ?? f();
8250
+ R ? R.insertAdjacentElement("afterend", b) : (I = y()) == null || I.appendChild(b);
8251
+ }
8252
+ b.textContent = `${p}/${m}`;
8253
+ }, U = () => {
8254
+ const p = A();
8255
+ p && (p.textContent = "");
8256
+ }, j = (p) => {
8257
+ const m = f();
8258
+ m && (m.textContent = p);
8259
+ const b = u();
8260
+ b == null || b.classList.add("--shake"), setTimeout(() => b == null ? void 0 : b.classList.remove("--shake"), 500), l().forEach((I) => {
8261
+ I.value = "";
8223
8262
  }), setTimeout(() => {
8224
- var T;
8225
- return (T = c()[0]) == null ? void 0 : T.focus();
8263
+ var I;
8264
+ return (I = l()[0]) == null ? void 0 : I.focus();
8226
8265
  }, 50);
8227
- }, K = (k) => {
8228
- var m;
8229
- S(!0), c().forEach((b) => {
8230
- b.value = "";
8266
+ }, Y = (p) => {
8267
+ var O;
8268
+ S(!0), l().forEach((E) => {
8269
+ E.value = "";
8231
8270
  });
8232
- const v = u();
8233
- if (v && (v.textContent = "Too many failed attempts. Please wait."), !p()) {
8234
- const b = document.createElement("p");
8235
- b.className = "__crossx-pin6-lock-msg", b.id = "__crossx-pin6-lock-msg", b.innerHTML = `${Bs}<span id="__crossx-pin6-lock-countdown"></span>`;
8236
- const A = u();
8237
- A ? A.insertAdjacentElement("afterend", b) : (m = f()) == null || m.appendChild(b);
8238
- }
8239
- const E = () => {
8240
- var N;
8241
- const b = k - Date.now(), A = _();
8242
- b <= 0 ? (clearInterval(T), S(!1), (N = p()) == null || N.remove(), v && (v.textContent = ""), setTimeout(() => {
8243
- var C;
8244
- return (C = c()[0]) == null ? void 0 : C.focus();
8245
- }, 50)) : A && (A.textContent = ` ${Qn(b)}`);
8246
- }, T = setInterval(E, 1e3);
8247
- E();
8248
- const x = new MutationObserver(() => {
8249
- document.contains(r) || (clearInterval(T), x.disconnect());
8271
+ const m = f();
8272
+ if (m && (m.textContent = "Too many failed attempts. Please wait."), !x()) {
8273
+ const E = document.createElement("p");
8274
+ E.className = "__crossx-pin6-lock-msg", E.id = "__crossx-pin6-lock-msg", E.innerHTML = `${Bs}<span id="__crossx-pin6-lock-countdown"></span>`;
8275
+ const C = f();
8276
+ C ? C.insertAdjacentElement("afterend", E) : (O = y()) == null || O.appendChild(E);
8277
+ }
8278
+ const b = () => {
8279
+ var M;
8280
+ const E = p - Date.now(), C = _();
8281
+ E <= 0 ? (clearInterval(I), S(!1), (M = x()) == null || M.remove(), m && (m.textContent = ""), setTimeout(() => {
8282
+ var q;
8283
+ return (q = l()[0]) == null ? void 0 : q.focus();
8284
+ }, 50)) : C && (C.textContent = ` ${Qn(E)}`);
8285
+ }, I = setInterval(b, 1e3);
8286
+ b();
8287
+ const R = new MutationObserver(() => {
8288
+ document.contains(r) || (clearInterval(I), R.disconnect());
8250
8289
  });
8251
- x.observe(document.body, { childList: !0, subtree: !1 });
8252
- }, G = async () => {
8253
- if (o || a) return;
8254
- const k = w();
8255
- if (k.length === 6) {
8256
- a = !0, c().forEach((v) => {
8257
- v.disabled = !0;
8290
+ R.observe(document.body, { childList: !0, subtree: !1 });
8291
+ }, $ = async () => {
8292
+ if (a || c) return;
8293
+ const p = v();
8294
+ if (p.length === 6) {
8295
+ c = !0, l().forEach((m) => {
8296
+ m.disabled = !0;
8258
8297
  });
8259
8298
  try {
8260
8299
  if (n) {
8261
- const v = await n(k);
8262
- v.ok ? e(k) : v.lockExpiresAt ? (H(), K(v.lockExpiresAt)) : (D(v.error ?? "Incorrect PIN. Please try again."), v.attemptCount != null && v.maxAttempts != null ? P(v.attemptCount, v.maxAttempts) : H());
8300
+ const m = await n(p);
8301
+ m.ok ? e(p) : m.lockExpiresAt ? (U(), Y(m.lockExpiresAt)) : (j(m.error ?? "Incorrect PIN. Please try again."), m.attemptCount != null && m.maxAttempts != null ? (V(H()), re(m.attemptCount, m.maxAttempts)) : (F(), U()));
8263
8302
  } else
8264
- e(k);
8265
- } catch (v) {
8266
- t && t(v);
8303
+ e(p);
8304
+ } catch (m) {
8305
+ t && t(m);
8267
8306
  } finally {
8268
- a = !1, o || c().forEach((v) => {
8269
- v.disabled = !1;
8307
+ c = !1, a || l().forEach((m) => {
8308
+ m.disabled = !1;
8270
8309
  });
8271
8310
  }
8272
8311
  }
8273
8312
  };
8274
- i && i > Date.now() ? K(i) : setTimeout(() => {
8275
- var k;
8276
- return (k = c()[0]) == null ? void 0 : k.focus();
8313
+ i && i > Date.now() ? Y(i) : setTimeout(() => {
8314
+ var p;
8315
+ return (p = l()[0]) == null ? void 0 : p.focus();
8277
8316
  }, 100);
8278
- const Z = () => {
8279
- if (o || a) return;
8280
- const k = c(), v = k.find((E) => !E.value) ?? k[k.length - 1];
8281
- v == null || v.focus();
8317
+ const P = () => {
8318
+ if (a || c) return;
8319
+ const p = l(), m = p.find((b) => !b.value) ?? p[p.length - 1];
8320
+ m == null || m.focus();
8282
8321
  };
8283
- (U = l()) == null || U.addEventListener("click", (k) => {
8284
- k.target.classList.contains("__crossx-pin6-box") || Z();
8285
- }), (z = f()) == null || z.addEventListener("click", (k) => {
8286
- const v = k.target;
8287
- v.classList.contains("__crossx-pin6-box") || v.closest("button") || Z();
8288
- }), c().forEach((k, v) => {
8289
- k.addEventListener("input", () => {
8290
- var T;
8291
- const E = k.value.replace(/\D/g, "").slice(-1);
8292
- k.value = E, I(), E && v < 5 && ((T = c()[v + 1]) == null || T.focus()), w().length === 6 && setTimeout(G, 80);
8293
- }), k.addEventListener("keydown", (E) => {
8294
- var T, x;
8295
- if (E.key === "Backspace") {
8296
- if (E.preventDefault(), k.value)
8297
- k.value = "";
8298
- else if (v > 0) {
8299
- const m = c()[v - 1];
8300
- m.value = "", m.focus();
8322
+ (D = u()) == null || D.addEventListener("click", (p) => {
8323
+ p.target.classList.contains("__crossx-pin6-box") || P();
8324
+ }), (w = y()) == null || w.addEventListener("click", (p) => {
8325
+ const m = p.target;
8326
+ m.classList.contains("__crossx-pin6-box") || m.closest("button") || P();
8327
+ }), l().forEach((p, m) => {
8328
+ p.addEventListener("input", () => {
8329
+ var I;
8330
+ const b = p.value.replace(/\D/g, "").slice(-1);
8331
+ p.value = b, T(), b && m < 5 && ((I = l()[m + 1]) == null || I.focus()), v().length === 6 && setTimeout($, 80);
8332
+ }), p.addEventListener("keydown", (b) => {
8333
+ var I, R;
8334
+ if (b.key === "Backspace") {
8335
+ if (b.preventDefault(), p.value)
8336
+ p.value = "";
8337
+ else if (m > 0) {
8338
+ const O = l()[m - 1];
8339
+ O.value = "", O.focus();
8301
8340
  }
8302
- } else E.key === "ArrowLeft" && v > 0 ? (E.preventDefault(), (T = c()[v - 1]) == null || T.focus()) : E.key === "ArrowRight" && v < 5 ? (E.preventDefault(), (x = c()[v + 1]) == null || x.focus()) : E.key === "Escape" && s();
8303
- }), k.addEventListener("paste", (E) => {
8304
- var m, b;
8305
- E.preventDefault();
8306
- const T = (((m = E.clipboardData) == null ? void 0 : m.getData("text")) ?? "").replace(/\D/g, "").slice(0, 6);
8307
- if (!T) return;
8308
- const x = c();
8309
- T.split("").forEach((A, N) => {
8310
- x[N] && (x[N].value = A);
8311
- }), (b = x[Math.min(T.length - 1, 5)]) == null || b.focus(), I(), w().length === 6 && setTimeout(G, 80);
8312
- }), k.addEventListener("focus", () => k.select());
8341
+ } else b.key === "ArrowLeft" && m > 0 ? (b.preventDefault(), (I = l()[m - 1]) == null || I.focus()) : b.key === "ArrowRight" && m < 5 ? (b.preventDefault(), (R = l()[m + 1]) == null || R.focus()) : b.key === "Escape" && s();
8342
+ }), p.addEventListener("paste", (b) => {
8343
+ var O, E;
8344
+ b.preventDefault();
8345
+ const I = (((O = b.clipboardData) == null ? void 0 : O.getData("text")) ?? "").replace(/\D/g, "").slice(0, 6);
8346
+ if (!I) return;
8347
+ const R = l();
8348
+ I.split("").forEach((C, M) => {
8349
+ R[M] && (R[M].value = C);
8350
+ }), (E = R[Math.min(I.length - 1, 5)]) == null || E.focus(), T(), v().length === 6 && setTimeout($, 80);
8351
+ }), p.addEventListener("focus", () => p.select());
8313
8352
  });
8314
8353
  }
8315
8354
  const Bs = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -8333,12 +8372,12 @@ function si(r, e, s) {
8333
8372
  }), o.addEventListener("keypress", (c) => {
8334
8373
  /[0-9]/.test(c.key) || c.preventDefault();
8335
8374
  }), o.addEventListener("paste", (c) => {
8336
- var p;
8375
+ var f;
8337
8376
  c.preventDefault();
8338
- const l = (((p = c.clipboardData) == null ? void 0 : p.getData("text")) ?? "").replace(/\D/g, "").slice(0, 4);
8377
+ const l = (((f = c.clipboardData) == null ? void 0 : f.getData("text")) ?? "").replace(/\D/g, "").slice(0, 4);
8339
8378
  if (!l) return;
8340
- l.split("").forEach((_, f) => {
8341
- t[f] && (t[f].value = _);
8379
+ l.split("").forEach((x, _) => {
8380
+ t[_] && (t[_].value = x);
8342
8381
  });
8343
8382
  const u = Math.min(l.length, 3);
8344
8383
  t[u].focus(), l.length === 4 && setTimeout(() => e(l), 200);
@@ -8372,48 +8411,48 @@ class ri {
8372
8411
  */
8373
8412
  showWalletSelector(e, s, t) {
8374
8413
  return new Promise((n) => {
8375
- var S;
8414
+ var v;
8376
8415
  le();
8377
8416
  const i = [...e], o = Gn(i, this.tokens, t), a = qe();
8378
8417
  de(o);
8379
8418
  let c = !1;
8380
8419
  const l = () => {
8381
8420
  c || (c = !0, o.remove(), a());
8382
- }, u = (y) => {
8383
- l(), n(y);
8384
- }, p = () => {
8421
+ }, u = (S) => {
8422
+ l(), n(S);
8423
+ }, f = () => {
8385
8424
  l(), n(null);
8386
8425
  };
8387
8426
  (() => {
8388
- o.querySelectorAll(".__crossx-wallet-item").forEach((y) => {
8389
- y.addEventListener("click", () => {
8390
- const I = y.dataset.walletAddress ?? "", P = parseInt(y.dataset.walletIndex ?? "0", 10);
8391
- u({ address: I, index: P });
8427
+ o.querySelectorAll(".__crossx-wallet-item").forEach((S) => {
8428
+ S.addEventListener("click", () => {
8429
+ const A = S.dataset.walletAddress ?? "", T = parseInt(S.dataset.walletIndex ?? "0", 10);
8430
+ u({ address: A, index: T });
8392
8431
  });
8393
8432
  });
8394
8433
  })();
8395
- const f = o.querySelector("#__crossx-add-wallet-btn");
8396
- f && f.addEventListener("click", async () => {
8397
- f.disabled = !0;
8434
+ const _ = o.querySelector("#__crossx-add-wallet-btn");
8435
+ _ && _.addEventListener("click", async () => {
8436
+ _.disabled = !0;
8398
8437
  try {
8399
- const y = await s();
8400
- i.push(y);
8401
- const I = o.querySelector("#__crossx-wallet-list");
8402
- if (I) {
8403
- const P = document.createElement("button");
8404
- P.className = "__crossx-wallet-item", P.dataset.walletIndex = String(y.index), P.dataset.walletAddress = y.address, P.innerHTML = `<span class="__crossx-wallet-idx">${y.index + 1}</span><span class="__crossx-wallet-addr">${re(y.address)}</span>`, P.addEventListener("click", () => u(y)), I.appendChild(P), P.scrollIntoView({ behavior: "smooth", block: "nearest" });
8438
+ const S = await s();
8439
+ i.push(S);
8440
+ const A = o.querySelector("#__crossx-wallet-list");
8441
+ if (A) {
8442
+ const T = document.createElement("button");
8443
+ T.className = "__crossx-wallet-item", T.dataset.walletIndex = String(S.index), T.dataset.walletAddress = S.address, T.innerHTML = `<span class="__crossx-wallet-idx">${S.index + 1}</span><span class="__crossx-wallet-addr">${se(S.address)}</span>`, T.addEventListener("click", () => u(S)), A.appendChild(T), T.scrollIntoView({ behavior: "smooth", block: "nearest" });
8405
8444
  }
8406
8445
  } catch {
8407
8446
  } finally {
8408
- f.disabled = !1;
8447
+ _.disabled = !1;
8409
8448
  }
8410
- }), (S = o.querySelector("#__crossx-close-btn")) == null || S.addEventListener("click", p), o.addEventListener("click", (y) => {
8411
- y.target === o && p();
8449
+ }), (v = o.querySelector("#__crossx-close-btn")) == null || v.addEventListener("click", f), o.addEventListener("click", (S) => {
8450
+ S.target === o && f();
8412
8451
  });
8413
- const w = (y) => {
8414
- y.key === "Escape" && (document.removeEventListener("keydown", w), p());
8452
+ const y = (S) => {
8453
+ S.key === "Escape" && (document.removeEventListener("keydown", y), f());
8415
8454
  };
8416
- document.addEventListener("keydown", w);
8455
+ document.addEventListener("keydown", y);
8417
8456
  });
8418
8457
  }
8419
8458
  /**
@@ -8424,29 +8463,29 @@ class ri {
8424
8463
  */
8425
8464
  showLoginSelector(e) {
8426
8465
  return new Promise((s) => {
8427
- var c, l, u, p;
8466
+ var c, l, u, f;
8428
8467
  le();
8429
8468
  const t = Kn(this.tokens, e == null ? void 0 : e.showConnectOtherWallets);
8430
8469
  de(t);
8431
- const n = () => t.remove(), i = (_) => {
8432
- n(), s(_);
8470
+ const n = () => t.remove(), i = (x) => {
8471
+ n(), s(x);
8433
8472
  }, o = () => {
8434
8473
  n(), s(null);
8435
8474
  };
8436
- (c = t.querySelector("#__crossx-apple-btn")) == null || c.addEventListener("click", () => i("apple")), (l = t.querySelector("#__crossx-google-btn")) == null || l.addEventListener("click", () => i("google")), (u = t.querySelector("#__crossx-connect-btn")) == null || u.addEventListener("click", () => i("external")), (p = t.querySelector("#__crossx-close-btn")) == null || p.addEventListener("click", o), t.addEventListener("click", (_) => {
8437
- _.target === t && o();
8438
- }), t.querySelectorAll(".__crossx-login-terms-link").forEach((_) => {
8439
- _.addEventListener("click", (f) => f.stopPropagation());
8475
+ (c = t.querySelector("#__crossx-apple-btn")) == null || c.addEventListener("click", () => i("apple")), (l = t.querySelector("#__crossx-google-btn")) == null || l.addEventListener("click", () => i("google")), (u = t.querySelector("#__crossx-connect-btn")) == null || u.addEventListener("click", () => i("external")), (f = t.querySelector("#__crossx-close-btn")) == null || f.addEventListener("click", o), t.addEventListener("click", (x) => {
8476
+ x.target === t && o();
8477
+ }), t.querySelectorAll(".__crossx-login-terms-link").forEach((x) => {
8478
+ x.addEventListener("click", (_) => _.stopPropagation());
8440
8479
  });
8441
- const a = (_) => {
8442
- _.key === "Escape" && (document.removeEventListener("keydown", a), o());
8480
+ const a = (x) => {
8481
+ x.key === "Escape" && (document.removeEventListener("keydown", a), o());
8443
8482
  };
8444
8483
  document.addEventListener("keydown", a);
8445
8484
  });
8446
8485
  }
8447
8486
  showSessionAlert(e) {
8448
8487
  return new Promise((s) => {
8449
- var u, p, _;
8488
+ var u, f, x;
8450
8489
  le();
8451
8490
  const t = this.messages, n = Vn(this.tokens, {
8452
8491
  title: e.title,
@@ -8465,7 +8504,7 @@ class ri {
8465
8504
  }, l = () => {
8466
8505
  a(), s("signin-again");
8467
8506
  };
8468
- (u = n.querySelector("#__crossx-session-signout")) == null || u.addEventListener("click", c), (p = n.querySelector("#__crossx-session-signin")) == null || p.addEventListener("click", l), (_ = n.querySelector("#__crossx-close-btn")) == null || _.addEventListener("click", c);
8507
+ (u = n.querySelector("#__crossx-session-signout")) == null || u.addEventListener("click", c), (f = n.querySelector("#__crossx-session-signin")) == null || f.addEventListener("click", l), (x = n.querySelector("#__crossx-close-btn")) == null || x.addEventListener("click", c);
8469
8508
  });
8470
8509
  }
8471
8510
  /**
@@ -8487,13 +8526,13 @@ class ri {
8487
8526
  const u = () => {
8488
8527
  i(), t("skip");
8489
8528
  };
8490
- (c = n.querySelector("#__crossx-skip-btn")) == null || c.addEventListener("click", u), (l = n.querySelector("#__crossx-close-btn")) == null || l.addEventListener("click", u), n.addEventListener("click", (_) => {
8491
- _.target === n && u();
8529
+ (c = n.querySelector("#__crossx-skip-btn")) == null || c.addEventListener("click", u), (l = n.querySelector("#__crossx-close-btn")) == null || l.addEventListener("click", u), n.addEventListener("click", (x) => {
8530
+ x.target === n && u();
8492
8531
  });
8493
- const p = (_) => {
8494
- _.key === "Escape" && (document.removeEventListener("keydown", p), u());
8532
+ const f = (x) => {
8533
+ x.key === "Escape" && (document.removeEventListener("keydown", f), u());
8495
8534
  };
8496
- document.addEventListener("keydown", p);
8535
+ document.addEventListener("keydown", f);
8497
8536
  }
8498
8537
  });
8499
8538
  }
@@ -8529,76 +8568,76 @@ class ri {
8529
8568
  let l = !1;
8530
8569
  const u = () => {
8531
8570
  l || (l = !0, a.remove(), c());
8532
- }, p = (P) => {
8533
- u(), s(P);
8534
- }, _ = () => {
8571
+ }, f = (T) => {
8572
+ u(), s(T);
8573
+ }, x = () => {
8535
8574
  u(), s(null);
8536
- }, f = a.querySelector(".__crossx-card"), w = {
8575
+ }, _ = a.querySelector(".__crossx-card"), y = {
8537
8576
  tooShort: (t == null ? void 0 : t.pinValidation_tooShort) ?? "Please enter a 6-digit PIN.",
8538
8577
  numbersOnly: (t == null ? void 0 : t.pinValidation_numbersOnly) ?? "Only numbers (0-9) are allowed.",
8539
8578
  repeatingDigit: (t == null ? void 0 : t.pinValidation_repeatingDigit) ?? "Cannot use the same number 3+ times in a row.",
8540
8579
  sequential: (t == null ? void 0 : t.pinValidation_sequential) ?? "Sequential numbers (e.g., 123456) are not allowed.",
8541
8580
  alternatingPattern: (t == null ? void 0 : t.pinValidation_alternatingPattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
8542
- }, S = (P) => {
8581
+ }, v = (T) => {
8543
8582
  var H;
8544
- f.innerHTML = ct({
8583
+ _.innerHTML = ct({
8545
8584
  title: o.title,
8546
8585
  headerSubtitle: o.headerSubtitle
8547
- }), (H = f.querySelector("#__crossx-close-btn")) == null || H.addEventListener("click", _), lt(f, (D) => {
8548
- D === P ? p(P) : y(i.mismatchError);
8549
- }, _);
8550
- }, y = (P) => {
8586
+ }), (H = _.querySelector("#__crossx-close-btn")) == null || H.addEventListener("click", x), lt(_, (L) => {
8587
+ L === T ? f(T) : S(i.mismatchError);
8588
+ }, x);
8589
+ }, S = (T) => {
8551
8590
  var H;
8552
- f.innerHTML = ct({
8591
+ _.innerHTML = ct({
8553
8592
  title: i.title,
8554
8593
  headerSubtitle: i.headerSubtitle,
8555
8594
  subtitle: i.subtitle,
8556
- errorMessage: P
8557
- }), (H = f.querySelector("#__crossx-close-btn")) == null || H.addEventListener("click", _), lt(f, (D) => {
8558
- const K = Zn(D, w);
8559
- K ? y(K) : S(D);
8560
- }, _);
8595
+ errorMessage: T
8596
+ }), (H = _.querySelector("#__crossx-close-btn")) == null || H.addEventListener("click", x), lt(_, (L) => {
8597
+ const V = Zn(L, y);
8598
+ V ? S(V) : v(L);
8599
+ }, x);
8561
8600
  };
8562
8601
  (() => {
8563
- var k;
8564
- const P = Array.from(f.querySelectorAll(".__crossx-pw-notice-item")), H = f.querySelector("#__crossx-pin-notice-next"), D = /* @__PURE__ */ new Set();
8602
+ var Y;
8603
+ const T = Array.from(_.querySelectorAll(".__crossx-pw-notice-item")), H = _.querySelector("#__crossx-pin-notice-next"), L = /* @__PURE__ */ new Set();
8565
8604
  H.removeAttribute("disabled");
8566
- const K = H.dataset.nextLabel ?? "Next", G = H.dataset.submitLabel ?? "I Understand", Z = () => {
8567
- const v = D.size === P.length;
8568
- H.classList.toggle("--disabled", !v), H.textContent = v ? G : K;
8569
- }, U = (v, E) => {
8570
- if (D.has(E)) return;
8571
- const T = v.querySelector(`#__crossx-notice-check-${E}`);
8572
- D.add(E), T.classList.add("--checked"), v.setAttribute("aria-checked", "true"), Z();
8573
- }, z = (v, E) => {
8574
- if (!D.has(E)) return;
8575
- const T = v.querySelector(`#__crossx-notice-check-${E}`);
8576
- D.delete(E), T.classList.remove("--checked"), v.setAttribute("aria-checked", "false"), Z();
8605
+ const V = H.dataset.nextLabel ?? "Next", F = H.dataset.submitLabel ?? "I Understand", re = () => {
8606
+ const $ = L.size === T.length;
8607
+ H.classList.toggle("--disabled", !$), H.textContent = $ ? F : V;
8608
+ }, U = ($, P) => {
8609
+ if (L.has(P)) return;
8610
+ const D = $.querySelector(`#__crossx-notice-check-${P}`);
8611
+ L.add(P), D.classList.add("--checked"), $.setAttribute("aria-checked", "true"), re();
8612
+ }, j = ($, P) => {
8613
+ if (!L.has(P)) return;
8614
+ const D = $.querySelector(`#__crossx-notice-check-${P}`);
8615
+ L.delete(P), D.classList.remove("--checked"), $.setAttribute("aria-checked", "false"), re();
8577
8616
  };
8578
- P.forEach((v) => {
8579
- const E = parseInt(v.dataset.checkIndex ?? "0", 10);
8580
- v.addEventListener("click", () => {
8581
- D.has(E) ? z(v, E) : U(v, E);
8582
- }), v.addEventListener("keydown", (T) => {
8583
- (T.key === " " || T.key === "Enter") && (T.preventDefault(), D.has(E) ? z(v, E) : U(v, E));
8617
+ T.forEach(($) => {
8618
+ const P = parseInt($.dataset.checkIndex ?? "0", 10);
8619
+ $.addEventListener("click", () => {
8620
+ L.has(P) ? j($, P) : U($, P);
8621
+ }), $.addEventListener("keydown", (D) => {
8622
+ (D.key === " " || D.key === "Enter") && (D.preventDefault(), L.has(P) ? j($, P) : U($, P));
8584
8623
  });
8585
8624
  }), H.addEventListener("click", () => {
8586
- if (D.size === P.length) {
8587
- y(e == null ? void 0 : e.errorMessage);
8625
+ if (L.size === T.length) {
8626
+ S(e == null ? void 0 : e.errorMessage);
8588
8627
  return;
8589
8628
  }
8590
- const v = P.find((T) => {
8591
- const x = parseInt(T.dataset.checkIndex ?? "0", 10);
8592
- return !D.has(x);
8629
+ const $ = T.find((D) => {
8630
+ const w = parseInt(D.dataset.checkIndex ?? "0", 10);
8631
+ return !L.has(w);
8593
8632
  });
8594
- if (!v) return;
8595
- const E = parseInt(v.dataset.checkIndex ?? "0", 10);
8596
- v.scrollIntoView({ behavior: "smooth", block: "nearest" }), v.classList.add("--highlight"), setTimeout(() => {
8597
- v.classList.remove("--highlight"), U(v, E);
8633
+ if (!$) return;
8634
+ const P = parseInt($.dataset.checkIndex ?? "0", 10);
8635
+ $.scrollIntoView({ behavior: "smooth", block: "nearest" }), $.classList.add("--highlight"), setTimeout(() => {
8636
+ $.classList.remove("--highlight"), U($, P);
8598
8637
  }, 400);
8599
- }), (k = f.querySelector("#__crossx-close-btn")) == null || k.addEventListener("click", _);
8600
- })(), a.addEventListener("click", (P) => {
8601
- P.target === a && _();
8638
+ }), (Y = _.querySelector("#__crossx-close-btn")) == null || Y.addEventListener("click", x);
8639
+ })(), a.addEventListener("click", (T) => {
8640
+ T.target === a && x();
8602
8641
  });
8603
8642
  });
8604
8643
  }
@@ -8609,32 +8648,33 @@ class ri {
8609
8648
  */
8610
8649
  showPinInputPrompt(e) {
8611
8650
  return new Promise((s, t) => {
8612
- var y;
8651
+ var A;
8613
8652
  le();
8614
- const n = this.messages, i = (e == null ? void 0 : e.verifyMode) === !0, o = i ? (n == null ? void 0 : n.verifyPin_title) ?? "Verify Your PIN" : (n == null ? void 0 : n.pinInput_title) ?? "Enter PIN", a = i ? (n == null ? void 0 : n.verifyPin_subtitle) ?? "Enter your PIN to authorize this transaction." : (n == null ? void 0 : n.pinInput_subtitle) ?? "Enter your 6-digit PIN to continue.", c = rs(
8653
+ const n = this.messages, i = (e == null ? void 0 : e.verifyMode) === !0, o = i ? (n == null ? void 0 : n.verifyPin_title) ?? "Verify Your PIN" : (n == null ? void 0 : n.pinInput_title) ?? "Enter PIN", a = i ? (n == null ? void 0 : n.verifyPin_subtitle) ?? "Enter your PIN to authorize this transaction." : (n == null ? void 0 : n.pinInput_subtitle) ?? "Enter your 6-digit PIN to continue.", c = (n == null ? void 0 : n.pinLocked_failureWarning) ?? "Your account will be locked after further failures.", l = rs(
8615
8654
  this.tokens,
8616
8655
  ct({
8617
8656
  title: o,
8618
8657
  headerSubtitle: a,
8619
8658
  errorMessage: e == null ? void 0 : e.errorMessage,
8659
+ warningMessage: c,
8620
8660
  lockExpiresAt: e == null ? void 0 : e.lockExpiresAt,
8621
8661
  attemptCount: e == null ? void 0 : e.attemptCount,
8622
8662
  maxAttempts: e == null ? void 0 : e.maxAttempts
8623
8663
  })
8624
- ), l = qe();
8625
- de(c);
8626
- let u = !1;
8627
- const p = () => {
8628
- u || (u = !0, c.remove(), l());
8629
- }, _ = (I) => {
8630
- p(), s(I);
8631
- }, f = () => {
8632
- p(), s(null);
8633
- }, w = (I) => {
8634
- p(), t(I);
8635
- }, S = c.querySelector(".__crossx-card");
8636
- (y = S.querySelector("#__crossx-close-btn")) == null || y.addEventListener("click", f), lt(S, _, f, w, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt), c.addEventListener("click", (I) => {
8637
- I.target === c && f();
8664
+ ), u = qe();
8665
+ de(l);
8666
+ let f = !1;
8667
+ const x = () => {
8668
+ f || (f = !0, l.remove(), u());
8669
+ }, _ = (T) => {
8670
+ x(), s(T);
8671
+ }, y = () => {
8672
+ x(), s(null);
8673
+ }, v = (T) => {
8674
+ x(), t(T);
8675
+ }, S = l.querySelector(".__crossx-card");
8676
+ (A = S.querySelector("#__crossx-close-btn")) == null || A.addEventListener("click", y), lt(S, _, y, v, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt, c), l.addEventListener("click", (T) => {
8677
+ T.target === l && y();
8638
8678
  });
8639
8679
  });
8640
8680
  }
@@ -8698,10 +8738,10 @@ class ri {
8698
8738
  };
8699
8739
  (a = t.querySelector("#__crossx-done-btn")) == null || a.addEventListener("click", i), (c = t.querySelector("#__crossx-close-btn")) == null || c.addEventListener("click", i), t.querySelectorAll(".__crossx-copy-btn").forEach((l) => {
8700
8740
  l.addEventListener("click", (u) => {
8701
- var _;
8741
+ var x;
8702
8742
  u.stopPropagation();
8703
- const p = l.dataset.copy;
8704
- p && ((_ = navigator.clipboard) == null || _.writeText(p).catch(() => {
8743
+ const f = l.dataset.copy;
8744
+ f && ((x = navigator.clipboard) == null || x.writeText(f).catch(() => {
8705
8745
  }));
8706
8746
  });
8707
8747
  }), t.addEventListener("click", (l) => {
@@ -8727,12 +8767,12 @@ class ri {
8727
8767
  const a = () => {
8728
8768
  o || (o = !0, i(), t());
8729
8769
  }, c = () => {
8730
- var u, p;
8731
- (u = n.querySelector("#__crossx-done-btn")) == null || u.addEventListener("click", a), (p = n.querySelector("#__crossx-close-btn")) == null || p.addEventListener("click", a), n.addEventListener("click", (_) => {
8732
- _.target === n && a();
8770
+ var u, f;
8771
+ (u = n.querySelector("#__crossx-done-btn")) == null || u.addEventListener("click", a), (f = n.querySelector("#__crossx-close-btn")) == null || f.addEventListener("click", a), n.addEventListener("click", (x) => {
8772
+ x.target === n && a();
8733
8773
  });
8734
- const l = (_) => {
8735
- _.key === "Escape" && (document.removeEventListener("keydown", l), a());
8774
+ const l = (x) => {
8775
+ x.key === "Escape" && (document.removeEventListener("keydown", l), a());
8736
8776
  };
8737
8777
  document.addEventListener("keydown", l);
8738
8778
  };
@@ -8752,19 +8792,19 @@ class ri {
8752
8792
  }, o = () => {
8753
8793
  n(), s(!1);
8754
8794
  };
8755
- (c = t.querySelector("#__crossx-confirm-btn")) == null || c.addEventListener("click", i), (l = t.querySelector("#__crossx-cancel-btn")) == null || l.addEventListener("click", o), (u = t.querySelector("#__crossx-close-btn")) == null || u.addEventListener("click", o), t.querySelectorAll(".__crossx-copy-btn").forEach((p) => {
8756
- p.addEventListener("click", (_) => {
8757
- var w;
8758
- _.stopPropagation();
8759
- const f = p.dataset.copy;
8760
- f && ((w = navigator.clipboard) == null || w.writeText(f).catch(() => {
8795
+ (c = t.querySelector("#__crossx-confirm-btn")) == null || c.addEventListener("click", i), (l = t.querySelector("#__crossx-cancel-btn")) == null || l.addEventListener("click", o), (u = t.querySelector("#__crossx-close-btn")) == null || u.addEventListener("click", o), t.querySelectorAll(".__crossx-copy-btn").forEach((f) => {
8796
+ f.addEventListener("click", (x) => {
8797
+ var y;
8798
+ x.stopPropagation();
8799
+ const _ = f.dataset.copy;
8800
+ _ && ((y = navigator.clipboard) == null || y.writeText(_).catch(() => {
8761
8801
  }));
8762
8802
  });
8763
- }), t.addEventListener("click", (p) => {
8764
- p.target === t && o();
8803
+ }), t.addEventListener("click", (f) => {
8804
+ f.target === t && o();
8765
8805
  });
8766
- const a = (p) => {
8767
- p.key === "Escape" && (document.removeEventListener("keydown", a), o());
8806
+ const a = (f) => {
8807
+ f.key === "Escape" && (document.removeEventListener("keydown", a), o());
8768
8808
  };
8769
8809
  document.addEventListener("keydown", a);
8770
8810
  });
@@ -8818,29 +8858,29 @@ function hi(r, e) {
8818
8858
  "refresh_token이 평문 저장되지 않도록 세션 영속성이 제한됩니다.",
8819
8859
  "IndexedDB를 지원하는 브라우저 사용을 권장합니다."
8820
8860
  ), t.secureStorageAvailable = i;
8821
- const o = i ? new $t(r.projectId) : new ar(), a = new xn(), c = new yn(), l = new Ie(), u = new ni(), p = new is();
8822
- let _;
8823
- r.useMockWallet ? (d.log("[CROSSx] Mock Wallet Provider 사용"), _ = new Sn(o, p)) : (d.log("[CROSSx] Remote Wallet Provider 사용"), _ = new Ae(
8861
+ const o = i ? new $t(r.projectId) : new ar(), a = new xn(), c = new yn(), l = new Ie(), u = new ni(), f = new is();
8862
+ let x;
8863
+ r.useMockWallet ? (d.log("[CROSSx] Mock Wallet Provider 사용"), x = new Sn(o, f)) : (d.log("[CROSSx] Remote Wallet Provider 사용"), x = new Ae(
8824
8864
  n,
8825
8865
  o,
8826
8866
  c,
8827
8867
  u,
8828
- p
8868
+ f
8829
8869
  ));
8830
- const f = new Be(n, c), w = new ri(r.theme ?? "light", r.themeTokens), S = e != null && e.wrapConfirmation ? e.wrapConfirmation(w) : w, y = new ut(
8870
+ const _ = new Be(n, c), y = new ri(r.theme ?? "light", r.themeTokens), v = e != null && e.wrapConfirmation ? e.wrapConfirmation(y) : y, S = new ut(
8831
8871
  t,
8832
8872
  n,
8833
8873
  o,
8834
8874
  a,
8835
8875
  c,
8836
8876
  l,
8837
- _,
8877
+ x,
8838
8878
  u,
8839
- S,
8840
- f,
8841
- p
8879
+ v,
8880
+ _,
8881
+ f
8842
8882
  );
8843
- return typeof window < "u" && (window.__crossxSDK = y), y;
8883
+ return typeof window < "u" && (window.__crossxSDK = S), S;
8844
8884
  }
8845
8885
  function pi(r) {
8846
8886
  const e = ii(r), s = oi(e), t = JSON.parse(s);