@nexus-cross/crossx-sdk-core 1.5.0 → 2.0.0

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
@@ -2,7 +2,7 @@ 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
3
  var P = (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
- 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 || {});
5
+ var p = /* @__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))(p || {});
6
6
  class x extends Error {
7
7
  constructor(e, s, t) {
8
8
  super(s), this.code = e, this.details = t, this.name = "CROSSxError", Object.setPrototypeOf(this, x.prototype);
@@ -108,7 +108,7 @@ class Vs {
108
108
  case "personal_sign":
109
109
  case "eth_sign":
110
110
  throw new x(
111
- h.NOT_IMPLEMENTED,
111
+ p.NOT_IMPLEMENTED,
112
112
  `${e}은(는) 아직 지원되지 않습니다. sdk.signMessage()를 직접 사용하세요.`
113
113
  );
114
114
  case "eth_signTypedData":
@@ -116,7 +116,7 @@ class Vs {
116
116
  case "eth_signTypedData_v3":
117
117
  case "eth_signTypedData_v4":
118
118
  throw new x(
119
- h.NOT_IMPLEMENTED,
119
+ p.NOT_IMPLEMENTED,
120
120
  `${e}은(는) 아직 지원되지 않습니다. sdk.signTypedData() 또는 sdk.signTypedDataOffchain()을 직접 사용하세요.`
121
121
  );
122
122
  default:
@@ -401,7 +401,7 @@ const kt = "crossx_access_token", Rt = "crossx_refresh_token", Ot = "crossx_user
401
401
  const t = this.extractResponseErrorCode(e);
402
402
  if (t)
403
403
  throw new x(
404
- h.AUTH_FAILED,
404
+ p.AUTH_FAILED,
405
405
  `${s} 실패 (코드 ${t.code}): ${t.message}`
406
406
  );
407
407
  }
@@ -422,9 +422,9 @@ const kt = "crossx_access_token", Rt = "crossx_refresh_token", Ot = "crossx_user
422
422
  d.error("[CROSSx] SignIn 에러 (OAuth 단계):", n);
423
423
  const o = n instanceof Error ? n.message : "Sign in failed";
424
424
  throw /팝업|popup/i.test(o) ? new x(
425
- h.OAUTH_POPUP_BLOCKED,
425
+ p.OAUTH_POPUP_BLOCKED,
426
426
  o
427
- ) : new x(h.AUTH_FAILED, o);
427
+ ) : new x(p.AUTH_FAILED, o);
428
428
  }
429
429
  return this.processFirebaseToken(s, t);
430
430
  }
@@ -451,12 +451,12 @@ const kt = "crossx_access_token", Rt = "crossx_refresh_token", Ot = "crossx_user
451
451
  let t, n = !1;
452
452
  try {
453
453
  const { authApiUrl: u } = this.config, { accessToken: f, refreshToken: _ } = await this.exchangeFirebaseToken(e, u);
454
- let p, b, E;
454
+ let h, b, E;
455
455
  try {
456
456
  const T = this.crypto.decodeJWT(e);
457
457
  d.log("[CROSSx] Firebase JWT 필드:", Object.keys(T).join(", ")), b = (o = T.firebase) == null ? void 0 : o.sign_in_provider;
458
458
  const R = ((i = T.firebase) == null ? void 0 : i.identities) ?? {};
459
- E = T.email ?? ((a = R.email) == null ? void 0 : a[0]), b === "google.com" ? p = (c = R["google.com"]) == null ? void 0 : c[0] : b === "apple.com" && (p = (l = R["apple.com"]) == null ? void 0 : l[0]), d.log("[CROSSx] OAuth provider sub 추출 — provider:", b, "hasProviderSub:", !!p, "email:", E ?? "(없음)");
459
+ E = T.email ?? ((a = R.email) == null ? void 0 : a[0]), b === "google.com" ? h = (c = R["google.com"]) == null ? void 0 : c[0] : b === "apple.com" && (h = (l = R["apple.com"]) == null ? void 0 : l[0]), d.log("[CROSSx] OAuth provider sub 추출 — provider:", b, "hasProviderSub:", !!h, "email:", E ?? "(없음)");
460
460
  } catch {
461
461
  d.warn("[CROSSx] firebaseToken에서 providerSub 추출 실패");
462
462
  }
@@ -480,7 +480,7 @@ const kt = "crossx_access_token", Rt = "crossx_refresh_token", Ot = "crossx_user
480
480
  id: F.sub,
481
481
  email: $,
482
482
  signInProvider: b,
483
- providerSub: p
483
+ providerSub: h
484
484
  }, this.tokenStore.set(f), this.useCookieAuth || (await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, f), _ && this.config.secureStorageAvailable !== !1 ? await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, _) : _ && d.warn("[CROSSx] 안전한 스토리지 미사용 — refresh_token 영속 저장을 건너뜁니다"));
485
485
  } else {
486
486
  const T = this.crypto.decodeJWT(e);
@@ -488,7 +488,7 @@ const kt = "crossx_access_token", Rt = "crossx_refresh_token", Ot = "crossx_user
488
488
  id: T.sub,
489
489
  email: T.email ?? s,
490
490
  signInProvider: b,
491
- providerSub: p
491
+ providerSub: h
492
492
  }, d.log("[CROSSx] Cookie 모드 — Firebase 토큰에서 사용자 정보 추출 — id:", t.id);
493
493
  }
494
494
  d.log("[CROSSx] 사용자 정보 — id:", t.id, "email:", t.email ?? "(없음)");
@@ -525,7 +525,7 @@ const kt = "crossx_access_token", Rt = "crossx_refresh_token", Ot = "crossx_user
525
525
  return d.log("[CROSSx] Cookie 모드 — 로그인 성공 (JWT는 HttpOnly 쿠키)"), {};
526
526
  if (!a)
527
527
  throw new x(
528
- h.AUTH_FAILED,
528
+ p.AUTH_FAILED,
529
529
  "토큰 교환 응답에서 access_token을 찾을 수 없습니다"
530
530
  );
531
531
  d.log("[CROSSx] access_token 교환 성공");
@@ -622,7 +622,7 @@ const kt = "crossx_access_token", Rt = "crossx_refresh_token", Ot = "crossx_user
622
622
  return d.warn("[CROSSx] restoreSession — 지갑 로드 실패 (세션은 유지):", t), { success: !0, user: s, tokenSignatureVerified: !1 };
623
623
  }
624
624
  } catch (e) {
625
- const s = e instanceof x && e.code === h.SESSION_EXPIRED;
625
+ const s = e instanceof x && e.code === p.SESSION_EXPIRED;
626
626
  return d.log("[CROSSx] restoreSession —", s ? "세션 만료 (재로그인 필요)" : "세션 복원 실패:", e), this.tokenStore.clear(), s && (this.useCookieAuth || await this.storage.remove(this.STORAGE_KEY_REFRESH_TOKEN), await this.storage.remove(this.STORAGE_KEY_USER)), null;
627
627
  }
628
628
  }
@@ -649,7 +649,7 @@ const kt = "crossx_access_token", Rt = "crossx_refresh_token", Ot = "crossx_user
649
649
  if (c) {
650
650
  const u = Ye.REFRESH_RELOGIN_CODES.has(c.code);
651
651
  throw new x(
652
- u ? h.SESSION_EXPIRED : h.AUTH_FAILED,
652
+ u ? p.SESSION_EXPIRED : p.AUTH_FAILED,
653
653
  `토큰 갱신 실패 (코드 ${c.code}): ${c.message}`
654
654
  );
655
655
  }
@@ -659,7 +659,7 @@ const kt = "crossx_access_token", Rt = "crossx_refresh_token", Ot = "crossx_user
659
659
  return;
660
660
  }
661
661
  if (!l)
662
- throw new x(h.AUTH_FAILED, "토큰 자동 갱신 실패: 응답에 토큰이 없습니다");
662
+ throw new x(p.AUTH_FAILED, "토큰 자동 갱신 실패: 응답에 토큰이 없습니다");
663
663
  if (this.tokenStore.set(l), !t) {
664
664
  await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, l);
665
665
  const u = this.extractRefreshToken(a);
@@ -682,7 +682,7 @@ const kt = "crossx_access_token", Rt = "crossx_refresh_token", Ot = "crossx_user
682
682
  const e = await this.storage.get(this.STORAGE_KEY_REFRESH_TOKEN);
683
683
  return e ? !!await this.silentRefresh(e) : (d.warn("[CROSSx] refreshAccessToken: refresh_token 없음 — 갱신 불가"), !1);
684
684
  } catch (e) {
685
- return e instanceof x && e.code === h.SESSION_EXPIRED ? (d.warn("[CROSSx] refreshAccessToken: 세션 만료 — 재로그인 필요"), this.tokenStore.clear(), this.useCookieAuth || await this.storage.remove(this.STORAGE_KEY_REFRESH_TOKEN)) : d.warn("[CROSSx] refreshAccessToken 실패:", e), !1;
685
+ return e instanceof x && e.code === p.SESSION_EXPIRED ? (d.warn("[CROSSx] refreshAccessToken: 세션 만료 — 재로그인 필요"), this.tokenStore.clear(), this.useCookieAuth || await this.storage.remove(this.STORAGE_KEY_REFRESH_TOKEN)) : d.warn("[CROSSx] refreshAccessToken 실패:", e), !1;
686
686
  }
687
687
  }
688
688
  /**
@@ -760,10 +760,10 @@ const kt = "crossx_access_token", Rt = "crossx_refresh_token", Ot = "crossx_user
760
760
  } else
761
761
  d.log("[CROSSx] getOrCreateWallet 직접 호출 (폴백)"), t = (await this.walletProvider.getOrCreateWallet(e.id)).address, d.log("[CROSSx] 지갑 로드 완료 — address:", t);
762
762
  } catch (o) {
763
- if (o instanceof x && o.code === h.MIGRATION_BACKUP_EXISTS)
763
+ if (o instanceof x && o.code === p.MIGRATION_BACKUP_EXISTS)
764
764
  d.log("[CROSSx] MIGRATION_BACKUP_EXISTS 감지 → needsMigration = true"), n = !0;
765
765
  else {
766
- if (o instanceof x && (o.code === h.PROJECT_NOT_REGISTERED || o.code === h.PROJECT_ID_MISSING || o.code === h.ORIGIN_NOT_ALLOWED))
766
+ if (o instanceof x && (o.code === p.PROJECT_NOT_REGISTERED || o.code === p.PROJECT_ID_MISSING || o.code === p.ORIGIN_NOT_ALLOWED))
767
767
  throw d.error("[CROSSx] 프로젝트 설정 에러:", o.message), o;
768
768
  d.warn("[CROSSx] 지갑 상태 확인 실패 (로그인은 유지):", o);
769
769
  }
@@ -790,7 +790,7 @@ class Xs {
790
790
  async execute(e, s) {
791
791
  if (!this.walletProvider.migrateWallet)
792
792
  throw new x(
793
- h.NOT_IMPLEMENTED,
793
+ p.NOT_IMPLEMENTED,
794
794
  "현재 환경에서는 마이그레이션이 지원되지 않습니다"
795
795
  );
796
796
  d.log("[CROSSx][Migration Phase 4] MigrateWalletUseCase.execute() — pin 길이:", e.length, "sub:", s);
@@ -867,7 +867,7 @@ class Js {
867
867
  })).data;
868
868
  if (a != null && a.error)
869
869
  throw new x(
870
- h.UNKNOWN_ERROR,
870
+ p.UNKNOWN_ERROR,
871
871
  `RPC 오류 [${e}] (${t}): ${a.error.message} (코드: ${a.error.code})`
872
872
  );
873
873
  return a == null ? void 0 : a.result;
@@ -896,7 +896,7 @@ class Zs {
896
896
  this.listeners.clear();
897
897
  }
898
898
  }
899
- const Oe = {
899
+ const Pe = {
900
900
  production: {
901
901
  oauthServiceUrl: "https://cross-wallet-oauth.crosstoken.io",
902
902
  authApiUrl: "https://cross-auth.crosstoken.io",
@@ -915,7 +915,7 @@ const Oe = {
915
915
  };
916
916
  function Qs(r) {
917
917
  const e = r.environment;
918
- return e && e in Oe ? Oe[e] : null;
918
+ return e && e in Pe ? Pe[e] : null;
919
919
  }
920
920
  function er() {
921
921
  try {
@@ -927,14 +927,14 @@ function er() {
927
927
  }
928
928
  try {
929
929
  const r = process.env.NEXT_PUBLIC_CROSSX_ENVIRONMENT;
930
- if (r && r in Oe)
931
- return Oe[r];
930
+ if (r && r in Pe)
931
+ return Pe[r];
932
932
  } catch {
933
933
  }
934
- return Oe.production;
934
+ return Pe.production;
935
935
  }
936
936
  const tr = 2e3, Pt = 6e4, sr = 1e3, rr = 1e4, nr = "0x77359400", Ct = "0x3B9ACA00", Nt = 130, Lt = 6, Dt = 18, Mt = 3e4, or = 5 * 60 * 1e3, ir = 30 * 1e3;
937
- function De(r, e = "Apple account") {
937
+ function Me(r, e = "Apple account") {
938
938
  if (r.endsWith("@privaterelay.appleid.com")) return e;
939
939
  const s = r.indexOf("@");
940
940
  if (s < 0) return "*".repeat(r.length || 3);
@@ -943,7 +943,7 @@ function De(r, e = "Apple account") {
943
943
  }
944
944
  const J = class J extends Zs {
945
945
  constructor(e, s, t, n, o, i, a, c, l, u, f) {
946
- var _, p;
946
+ var _, h;
947
947
  super(), this.storage = t, this.crypto = n, this.transport = o, this.oauth = i, 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 os(), this.chainRegistry = u, this.jsonRpc = new Js(u, o), this.signInUseCase = new dt(
948
948
  this.internalConfig,
949
949
  t,
@@ -952,7 +952,7 @@ const J = class J extends Zs {
952
952
  o,
953
953
  a,
954
954
  c
955
- ), this.signOutUseCase = new Ys(this.internalConfig, t, c), this.migrateWalletUseCase = new Xs(t, a), (_ = a.setOnUnauthorized) == null || _.call(a, () => this.forceLogout()), (p = a.setTokenRefresher) == null || p.call(
955
+ ), this.signOutUseCase = new Ys(this.internalConfig, t, c), this.migrateWalletUseCase = new Xs(t, a), (_ = a.setOnUnauthorized) == null || _.call(a, () => this.forceLogout()), (h = a.setTokenRefresher) == null || h.call(
956
956
  a,
957
957
  () => this.signInUseCase.refreshAccessToken()
958
958
  ), e.autoDetectTheme && this._setupAutoDetectTheme();
@@ -981,7 +981,7 @@ const J = class J extends Zs {
981
981
  }
982
982
  async _doInitialize(e) {
983
983
  var s, t;
984
- d.log("[CROSSx SDK] v1.5.0 초기화 중..."), this.confirmation.setMessages(fe(this._config.locale));
984
+ d.log("[CROSSx SDK] v2.0.0 초기화 중..."), this.confirmation.setMessages(fe(this._config.locale));
985
985
  try {
986
986
  const n = er();
987
987
  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`);
@@ -991,20 +991,20 @@ const J = class J extends Zs {
991
991
  try {
992
992
  await this.loadWalletAfterAuth(e == null ? void 0 : e.preferredWalletIndex);
993
993
  } catch (i) {
994
- if (!(i instanceof x && i.code === h.PIN_CANCELLED))
994
+ if (!(i instanceof x && i.code === p.PIN_CANCELLED))
995
995
  throw i;
996
996
  d.log("[CROSSx] initialize: 비밀번호 입력 취소 — 지갑 미로드 상태로 계속");
997
997
  }
998
998
  }
999
- return this.initialized = !0, d.info("[CROSSx SDK] v1.5.0 초기화 완료"), this.emit("initialized", { restored: !!(o != null && o.success) }), o ?? null;
999
+ return this.initialized = !0, d.info("[CROSSx SDK] v2.0.0 초기화 완료"), this.emit("initialized", { restored: !!(o != null && o.success) }), o ?? null;
1000
1000
  } catch (n) {
1001
- throw new x(h.AUTH_NOT_INITIALIZED, "SDK 초기화에 실패했습니다", n);
1001
+ throw new x(p.AUTH_NOT_INITIALIZED, "SDK 초기화에 실패했습니다", n);
1002
1002
  }
1003
1003
  }
1004
1004
  async signIn(e) {
1005
1005
  if (this.ensureInitialized(), this.authenticated)
1006
1006
  throw new x(
1007
- h.ALREADY_AUTHENTICATED,
1007
+ p.ALREADY_AUTHENTICATED,
1008
1008
  "이미 로그인된 상태입니다. signOut()을 먼저 호출하세요."
1009
1009
  );
1010
1010
  let s = e;
@@ -1014,7 +1014,7 @@ const J = class J extends Zs {
1014
1014
  });
1015
1015
  if (t === "external")
1016
1016
  throw this.emit("connectExternalWallet", {}), new x(
1017
- h.EXTERNAL_WALLET_REQUESTED,
1017
+ p.EXTERNAL_WALLET_REQUESTED,
1018
1018
  "User requested external wallet connection"
1019
1019
  );
1020
1020
  if (t === null)
@@ -1025,7 +1025,7 @@ const J = class J extends Zs {
1025
1025
  const t = await this.signInUseCase.execute(s);
1026
1026
  return t.success && this.applyAuthResult(t), t;
1027
1027
  } catch (t) {
1028
- throw t instanceof x ? t : new x(h.AUTH_FAILED, "로그인에 실패했습니다", t);
1028
+ throw t instanceof x ? t : new x(p.AUTH_FAILED, "로그인에 실패했습니다", t);
1029
1029
  }
1030
1030
  }
1031
1031
  /**
@@ -1056,7 +1056,7 @@ const J = class J extends Zs {
1056
1056
  const t = await this.getAddresses(), n = await this.selectWalletIfMultiple(t);
1057
1057
  return { ...s, address: (n == null ? void 0 : n.address) ?? s.address, addresses: t };
1058
1058
  } catch (t) {
1059
- throw t instanceof x && t.code === h.PIN_CANCELLED && (d.log("[CROSSx] signInWithCreate: 비밀번호 설정 취소 — 자동 로그아웃 진행"), await this.signOut().catch(
1059
+ throw t instanceof x && t.code === p.PIN_CANCELLED && (d.log("[CROSSx] signInWithCreate: 비밀번호 설정 취소 — 자동 로그아웃 진행"), await this.signOut().catch(
1060
1060
  (n) => d.warn("[CROSSx] signInWithCreate: 자동 로그아웃 실패", n)
1061
1061
  )), t;
1062
1062
  }
@@ -1081,14 +1081,14 @@ const J = class J extends Zs {
1081
1081
  async signInWithOAuthToken(e) {
1082
1082
  if (this.ensureInitialized(), this.authenticated)
1083
1083
  throw new x(
1084
- h.ALREADY_AUTHENTICATED,
1084
+ p.ALREADY_AUTHENTICATED,
1085
1085
  "이미 로그인된 상태입니다. signOut()을 먼저 호출하세요."
1086
1086
  );
1087
1087
  try {
1088
1088
  const s = await this.signInUseCase.executeWithOAuthToken(e);
1089
1089
  return s.success && this.applyAuthResult(s), s;
1090
1090
  } catch (s) {
1091
- throw new x(h.AUTH_FAILED, "OAuth 토큰 로그인에 실패했습니다", s);
1091
+ throw new x(p.AUTH_FAILED, "OAuth 토큰 로그인에 실패했습니다", s);
1092
1092
  }
1093
1093
  }
1094
1094
  /**
@@ -1109,14 +1109,14 @@ const J = class J extends Zs {
1109
1109
  async signInWithJWT(e, s) {
1110
1110
  if (this.ensureInitialized(), this.authenticated)
1111
1111
  throw new x(
1112
- h.ALREADY_AUTHENTICATED,
1112
+ p.ALREADY_AUTHENTICATED,
1113
1113
  "이미 로그인된 상태입니다. signOut()을 먼저 호출하세요."
1114
1114
  );
1115
1115
  try {
1116
1116
  const t = await this.signInUseCase.executeWithJWT(e, s);
1117
1117
  return t.success && this.applyAuthResult(t), t;
1118
1118
  } catch (t) {
1119
- throw new x(h.AUTH_FAILED, "JWT 로그인에 실패했습니다", t);
1119
+ throw new x(p.AUTH_FAILED, "JWT 로그인에 실패했습니다", t);
1120
1120
  }
1121
1121
  }
1122
1122
  async signOut() {
@@ -1124,7 +1124,7 @@ const J = class J extends Zs {
1124
1124
  try {
1125
1125
  await this.signOutUseCase.execute(), this.clearAuthState();
1126
1126
  } catch (e) {
1127
- throw new x(h.UNKNOWN_ERROR, "로그아웃에 실패했습니다", e);
1127
+ throw new x(p.UNKNOWN_ERROR, "로그아웃에 실패했습니다", e);
1128
1128
  }
1129
1129
  }
1130
1130
  isAuthenticated() {
@@ -1189,7 +1189,7 @@ const J = class J extends Zs {
1189
1189
  try {
1190
1190
  await this.loadWalletAfterAuth();
1191
1191
  } catch (s) {
1192
- s instanceof x && s.code === h.PIN_CANCELLED || d.warn("[CROSSx] ensureLoggedIn: loadWalletAfterAuth 실패:", s);
1192
+ s instanceof x && s.code === p.PIN_CANCELLED || d.warn("[CROSSx] ensureLoggedIn: loadWalletAfterAuth 실패:", s);
1193
1193
  }
1194
1194
  return !0;
1195
1195
  }
@@ -1229,13 +1229,13 @@ const J = class J extends Zs {
1229
1229
  */
1230
1230
  async migrateWallet(e) {
1231
1231
  if (this.ensureAuthenticated(), !this.userId)
1232
- throw new x(h.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1232
+ throw new x(p.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1233
1233
  try {
1234
1234
  const s = await this.migrateWalletUseCase.execute(e, this.userId);
1235
1235
  return this.address = s.address, this.activeWalletIndex = 0, this.emit("addressChanged", { address: s.address, index: 0 }), d.log("[CROSSx] migrateWallet 완료 — address:", s.address), s;
1236
1236
  } catch (s) {
1237
1237
  throw s instanceof x ? s : new x(
1238
- h.MIGRATION_FAILED,
1238
+ p.MIGRATION_FAILED,
1239
1239
  "지갑 마이그레이션에 실패했습니다",
1240
1240
  s
1241
1241
  );
@@ -1256,7 +1256,7 @@ const J = class J extends Zs {
1256
1256
  async getAddress(e) {
1257
1257
  if (e !== void 0) {
1258
1258
  if (this.ensureAuthenticated(), !this.userId)
1259
- throw new x(h.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1259
+ throw new x(p.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1260
1260
  return { address: (await this.walletProvider.getAddress(this.userId, e)).address, index: e };
1261
1261
  }
1262
1262
  return !this.authenticated || !this.address ? null : { address: this.address, index: this.activeWalletIndex };
@@ -1298,7 +1298,7 @@ const J = class J extends Zs {
1298
1298
  */
1299
1299
  async selectWallet(e) {
1300
1300
  if (this.ensureAuthenticated(), !this.userId)
1301
- throw new x(h.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1301
+ throw new x(p.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1302
1302
  let s = await this.withSessionRecovery(
1303
1303
  () => this.walletProvider.getAddresses(this.userId)
1304
1304
  );
@@ -1346,7 +1346,7 @@ const J = class J extends Zs {
1346
1346
  try {
1347
1347
  return await this.chainRegistry.getChains();
1348
1348
  } catch (e) {
1349
- throw e instanceof x ? e : new x(h.UNKNOWN_ERROR, "체인 목록 조회에 실패했습니다", e);
1349
+ throw e instanceof x ? e : new x(p.UNKNOWN_ERROR, "체인 목록 조회에 실패했습니다", e);
1350
1350
  }
1351
1351
  }
1352
1352
  /**
@@ -1365,7 +1365,7 @@ const J = class J extends Zs {
1365
1365
  try {
1366
1366
  return await this.chainRegistry.getChain(e);
1367
1367
  } catch (s) {
1368
- throw s instanceof x ? s : new x(h.CHAIN_NOT_SUPPORTED, `체인 조회에 실패했습니다: ${e}`, s);
1368
+ throw s instanceof x ? s : new x(p.CHAIN_NOT_SUPPORTED, `체인 조회에 실패했습니다: ${e}`, s);
1369
1369
  }
1370
1370
  }
1371
1371
  // ============================================================================
@@ -1423,7 +1423,7 @@ const J = class J extends Zs {
1423
1423
  }
1424
1424
  async _createWallet() {
1425
1425
  if (this.ensureAuthenticated(), !this.userId)
1426
- throw new x(h.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1426
+ throw new x(p.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1427
1427
  d.log("[CROSSx] createWallet 시작");
1428
1428
  const e = await this.fetchWalletStatus();
1429
1429
  if (d.log("[CROSSx] 지갑 상태:", e), e === "migration_required") {
@@ -1433,7 +1433,7 @@ const J = class J extends Zs {
1433
1433
  if (t)
1434
1434
  return this.address = t.address, this.activeWalletIndex = 0, this.emit("addressChanged", { address: t.address, index: 0 }), { address: t.address };
1435
1435
  throw new x(
1436
- h.MIGRATION_FAILED,
1436
+ p.MIGRATION_FAILED,
1437
1437
  "사용자가 마이그레이션을 건너뛰었습니다"
1438
1438
  );
1439
1439
  }
@@ -1445,14 +1445,14 @@ const J = class J extends Zs {
1445
1445
  );
1446
1446
  return this.address = s.address, this.activeWalletIndex = 0, this.emit("addressChanged", { address: s.address, index: 0 }), d.log("[CROSSx] 지갑 준비 완료:", s.address), { address: s.address };
1447
1447
  } catch (s) {
1448
- if (s instanceof x && s.code === h.MIGRATION_BACKUP_EXISTS) {
1448
+ if (s instanceof x && s.code === p.MIGRATION_BACKUP_EXISTS) {
1449
1449
  const t = this.providerSub ?? this.userId;
1450
1450
  d.log("[CROSSx] MIGRATION_BACKUP_EXISTS (폴백) → 마이그레이션 UI 시작");
1451
1451
  const n = await this.handleMigrationFlow(t);
1452
1452
  if (n)
1453
1453
  return this.address = n.address, this.activeWalletIndex = 0, this.emit("addressChanged", { address: n.address, index: 0 }), { address: n.address };
1454
1454
  throw new x(
1455
- h.MIGRATION_FAILED,
1455
+ p.MIGRATION_FAILED,
1456
1456
  "사용자가 마이그레이션을 건너뛰었습니다"
1457
1457
  );
1458
1458
  }
@@ -1464,14 +1464,14 @@ const J = class J extends Zs {
1464
1464
  const s = await this.walletProvider.getOrCreateWallet(this.userId);
1465
1465
  return this.address = s.address, this.activeWalletIndex = 0, this.emit("addressChanged", { address: s.address, index: 0 }), d.log("[CROSSx] 지갑 준비 완료:", s.address), { address: s.address };
1466
1466
  } catch (s) {
1467
- if (s instanceof x && s.code === h.MIGRATION_BACKUP_EXISTS) {
1467
+ if (s instanceof x && s.code === p.MIGRATION_BACKUP_EXISTS) {
1468
1468
  const t = this.providerSub ?? this.userId;
1469
1469
  d.log("[CROSSx] MIGRATION_BACKUP_EXISTS (폴백) → 마이그레이션 UI 시작");
1470
1470
  const n = await this.handleMigrationFlow(t);
1471
1471
  if (n)
1472
1472
  return this.address = n.address, this.activeWalletIndex = 0, this.emit("addressChanged", { address: n.address, index: 0 }), { address: n.address };
1473
1473
  throw new x(
1474
- h.MIGRATION_FAILED,
1474
+ p.MIGRATION_FAILED,
1475
1475
  "사용자가 마이그레이션을 건너뛰었습니다"
1476
1476
  );
1477
1477
  }
@@ -1503,7 +1503,7 @@ const J = class J extends Zs {
1503
1503
  }
1504
1504
  async _signMessage(e, s, t) {
1505
1505
  if (this.ensureAuthenticated(), !this.userId)
1506
- throw new x(h.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1506
+ throw new x(p.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1507
1507
  const n = await this.resolveAddress(t == null ? void 0 : t.index);
1508
1508
  if (!await this.confirmation.requestConfirmation({
1509
1509
  type: "sign-message",
@@ -1513,7 +1513,7 @@ const J = class J extends Zs {
1513
1513
  dappName: (t == null ? void 0 : t.dappName) ?? this._config.appName,
1514
1514
  accountName: t == null ? void 0 : t.accountName
1515
1515
  }))
1516
- throw new x(h.USER_REJECTED, "User rejected the message signing request");
1516
+ throw new x(p.USER_REJECTED, "User rejected the message signing request");
1517
1517
  try {
1518
1518
  const i = await this.withPinRetry(async () => {
1519
1519
  let a;
@@ -1533,7 +1533,7 @@ const J = class J extends Zs {
1533
1533
  address: n.address
1534
1534
  };
1535
1535
  } catch (i) {
1536
- throw i instanceof x ? i : new x(h.SIGNATURE_FAILED, `메시지 서명에 실패했습니다 (${e})`, i);
1536
+ throw i instanceof x ? i : new x(p.SIGNATURE_FAILED, `메시지 서명에 실패했습니다 (${e})`, i);
1537
1537
  }
1538
1538
  }
1539
1539
  /**
@@ -1562,9 +1562,9 @@ const J = class J extends Zs {
1562
1562
  }
1563
1563
  async _signTypedData(e, s, t) {
1564
1564
  if (this.ensureAuthenticated(), !this.userId)
1565
- throw new x(h.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1565
+ throw new x(p.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1566
1566
  if (!this.walletProvider.signTypedData)
1567
- throw new x(h.NOT_IMPLEMENTED, "signTypedData가 구현되어 있지 않습니다");
1567
+ throw new x(p.NOT_IMPLEMENTED, "signTypedData가 구현되어 있지 않습니다");
1568
1568
  J.validateTypedDataChainId(e, s);
1569
1569
  const n = await this.resolveAddress(t == null ? void 0 : t.index);
1570
1570
  if (!await this.confirmation.requestConfirmation({
@@ -1575,7 +1575,7 @@ const J = class J extends Zs {
1575
1575
  dappName: (t == null ? void 0 : t.dappName) ?? this._config.appName,
1576
1576
  accountName: t == null ? void 0 : t.accountName
1577
1577
  }))
1578
- throw new x(h.USER_REJECTED, "User rejected the typed data signing request");
1578
+ throw new x(p.USER_REJECTED, "User rejected the typed data signing request");
1579
1579
  try {
1580
1580
  const i = await this.withPinRetry(async () => {
1581
1581
  let a;
@@ -1594,7 +1594,7 @@ const J = class J extends Zs {
1594
1594
  address: n.address
1595
1595
  };
1596
1596
  } catch (i) {
1597
- throw i instanceof x ? i : new x(h.SIGNATURE_FAILED, `타입 데이터 서명에 실패했습니다 (${e})`, i);
1597
+ throw i instanceof x ? i : new x(p.SIGNATURE_FAILED, `타입 데이터 서명에 실패했습니다 (${e})`, i);
1598
1598
  }
1599
1599
  }
1600
1600
  /**
@@ -1633,7 +1633,7 @@ const J = class J extends Zs {
1633
1633
  }
1634
1634
  async _signTransaction(e, s, t) {
1635
1635
  if (this.ensureAuthenticated(), !this.userId)
1636
- throw new x(h.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1636
+ throw new x(p.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1637
1637
  const n = await this.withResolvedGasAndFee(s, e);
1638
1638
  n.from || (n.from = (await this.resolveAddress(t == null ? void 0 : t.index)).address);
1639
1639
  const o = et(e);
@@ -1653,7 +1653,7 @@ const J = class J extends Zs {
1653
1653
  dappName: (t == null ? void 0 : t.dappName) ?? this._config.appName,
1654
1654
  accountName: t == null ? void 0 : t.accountName
1655
1655
  }))
1656
- throw new x(h.USER_REJECTED, "User rejected the transaction signing request");
1656
+ throw new x(p.USER_REJECTED, "User rejected the transaction signing request");
1657
1657
  try {
1658
1658
  const a = await this.withPinRetry(async () => {
1659
1659
  let c;
@@ -1674,7 +1674,7 @@ const J = class J extends Zs {
1674
1674
  if (a instanceof x) throw a;
1675
1675
  const c = a instanceof Error ? a.message : String(a);
1676
1676
  throw new x(
1677
- h.SIGNATURE_FAILED,
1677
+ p.SIGNATURE_FAILED,
1678
1678
  `트랜잭션 서명에 실패했습니다 (${e}): ${c}`,
1679
1679
  a
1680
1680
  );
@@ -1691,7 +1691,7 @@ const J = class J extends Zs {
1691
1691
  }
1692
1692
  async _sendTransaction(e, s, t) {
1693
1693
  if (this.ensureAuthenticated(), !this.userId)
1694
- throw new x(h.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1694
+ throw new x(p.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1695
1695
  const n = await this.withResolvedGasAndFee(s, e);
1696
1696
  n.from || (n.from = (await this.resolveAddress(t == null ? void 0 : t.index)).address);
1697
1697
  const o = et(e);
@@ -1711,7 +1711,7 @@ const J = class J extends Zs {
1711
1711
  dappName: (t == null ? void 0 : t.dappName) ?? this._config.appName,
1712
1712
  accountName: t == null ? void 0 : t.accountName
1713
1713
  }))
1714
- throw new x(h.USER_REJECTED, "User rejected the transaction request");
1714
+ throw new x(p.USER_REJECTED, "User rejected the transaction request");
1715
1715
  try {
1716
1716
  const a = await this.withPinRetry(async () => {
1717
1717
  let c;
@@ -1736,7 +1736,7 @@ const J = class J extends Zs {
1736
1736
  if (a instanceof x) throw a;
1737
1737
  const c = a instanceof Error ? a.message : String(a);
1738
1738
  throw new x(
1739
- h.TRANSACTION_FAILED,
1739
+ p.TRANSACTION_FAILED,
1740
1740
  `트랜잭션 전송에 실패했습니다 (${e}): ${c}`,
1741
1741
  a
1742
1742
  );
@@ -1769,7 +1769,7 @@ const J = class J extends Zs {
1769
1769
  await new Promise((u) => setTimeout(u, c)), c = Math.min(c * 2, o);
1770
1770
  }
1771
1771
  throw new x(
1772
- h.UNKNOWN_ERROR,
1772
+ p.UNKNOWN_ERROR,
1773
1773
  `트랜잭션 영수증 조회 시간이 초과되었습니다 (${e})`
1774
1774
  );
1775
1775
  }
@@ -1791,7 +1791,7 @@ const J = class J extends Zs {
1791
1791
  async sendTransactionWithWaitForReceipt(e, s, t = {}) {
1792
1792
  var E, v;
1793
1793
  const { intervalMs: n, timeoutMs: o, ...i } = t, { txHash: a } = await this.sendTransaction(e, s, i), c = n ?? ((E = this._config.receiptPolling) == null ? void 0 : E.intervalMs) ?? tr, l = o ?? ((v = this._config.receiptPolling) == null ? void 0 : v.timeoutMs) ?? Pt, u = et(e), f = s.from ?? "";
1794
- let _, p;
1794
+ let _, h;
1795
1795
  const b = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((T) => {
1796
1796
  _ = T;
1797
1797
  const R = BigInt(T.gasUsed) * BigInt(T.effectiveGasPrice), F = s.value ? BigInt(s.value) : 0n, $ = J.formatTxAmount(s.value, u.symbol, u.decimals), K = J.formatTxAmount("0x" + R.toString(16), u.symbol, u.decimals), q = J.formatTxAmount("0x" + (F + R).toString(16), u.symbol, u.decimals);
@@ -1806,7 +1806,7 @@ const J = class J extends Zs {
1806
1806
  nativeSymbol: u.symbol,
1807
1807
  status: T.status === "0x1" ? "success" : "reverted"
1808
1808
  };
1809
- }).catch((T) => (p = T instanceof Error ? T : new Error(String(T)), {
1809
+ }).catch((T) => (h = T instanceof Error ? T : new Error(String(T)), {
1810
1810
  chainId: e,
1811
1811
  txHash: a,
1812
1812
  from: f,
@@ -1818,7 +1818,7 @@ const J = class J extends Zs {
1818
1818
  if (await this.confirmation.showTransactionProgress(
1819
1819
  { chainId: e, txHash: a, from: f, to: s.to },
1820
1820
  b
1821
- ), p) throw p;
1821
+ ), h) throw h;
1822
1822
  return { chainId: e, txHash: a, receipt: _ };
1823
1823
  }
1824
1824
  // ============================================================================
@@ -1867,12 +1867,12 @@ const J = class J extends Zs {
1867
1867
  this.ensureAuthenticated();
1868
1868
  const t = this.walletProvider;
1869
1869
  if (typeof t.changePin != "function")
1870
- throw new x(h.NOT_IMPLEMENTED, "changePin이 구현되어 있지 않습니다");
1870
+ throw new x(p.NOT_IMPLEMENTED, "changePin이 구현되어 있지 않습니다");
1871
1871
  this.pinStore.set(e);
1872
1872
  try {
1873
1873
  await t.changePin(e, s), this.pinStore.set(s), d.log("[CROSSx] PIN 변경 완료");
1874
1874
  } catch (n) {
1875
- throw n instanceof x ? n : new x(h.UNKNOWN_ERROR, "PIN 변경에 실패했습니다", n);
1875
+ throw n instanceof x ? n : new x(p.UNKNOWN_ERROR, "PIN 변경에 실패했습니다", n);
1876
1876
  }
1877
1877
  }
1878
1878
  // ============================================================================
@@ -1893,7 +1893,7 @@ const J = class J extends Zs {
1893
1893
  return await this.walletRpc("eth_gasPrice", [], e);
1894
1894
  } catch (s) {
1895
1895
  const t = s instanceof Error ? s.message : String(s);
1896
- throw new x(h.GAS_ESTIMATION_FAILED, `가스 가격 조회에 실패했습니다 (${e}): ${t}`, s);
1896
+ throw new x(p.GAS_ESTIMATION_FAILED, `가스 가격 조회에 실패했습니다 (${e}): ${t}`, s);
1897
1897
  }
1898
1898
  }
1899
1899
  /**
@@ -1914,7 +1914,7 @@ const J = class J extends Zs {
1914
1914
  return await this.walletRpc("eth_estimateGas", [t], s);
1915
1915
  } catch (n) {
1916
1916
  const o = n instanceof Error ? n.message : String(n);
1917
- throw new x(h.GAS_ESTIMATION_FAILED, `가스 추정에 실패했습니다 (${s}): ${o}`, n);
1917
+ throw new x(p.GAS_ESTIMATION_FAILED, `가스 추정에 실패했습니다 (${s}): ${o}`, n);
1918
1918
  }
1919
1919
  }
1920
1920
  /**
@@ -1935,7 +1935,7 @@ const J = class J extends Zs {
1935
1935
  return (s == null ? void 0 : s.baseFeePerGas) ?? null;
1936
1936
  } catch (s) {
1937
1937
  const t = s instanceof Error ? s.message : String(s);
1938
- throw new x(h.GAS_ESTIMATION_FAILED, `baseFeePerGas 조회에 실패했습니다 (${e}): ${t}`, s);
1938
+ throw new x(p.GAS_ESTIMATION_FAILED, `baseFeePerGas 조회에 실패했습니다 (${e}): ${t}`, s);
1939
1939
  }
1940
1940
  }
1941
1941
  /**
@@ -1954,7 +1954,7 @@ const J = class J extends Zs {
1954
1954
  return await this.walletRpc("eth_maxPriorityFeePerGas", [], e);
1955
1955
  } catch (s) {
1956
1956
  const t = s instanceof Error ? s.message : String(s);
1957
- throw new x(h.GAS_ESTIMATION_FAILED, `maxPriorityFeePerGas 조회에 실패했습니다 (${e}): ${t}`, s);
1957
+ throw new x(p.GAS_ESTIMATION_FAILED, `maxPriorityFeePerGas 조회에 실패했습니다 (${e}): ${t}`, s);
1958
1958
  }
1959
1959
  }
1960
1960
  // ============================================================================
@@ -1974,7 +1974,7 @@ const J = class J extends Zs {
1974
1974
  } catch (t) {
1975
1975
  if (t instanceof x) throw t;
1976
1976
  const n = t instanceof Error ? t.message : String(t);
1977
- throw new x(h.UNKNOWN_ERROR, `Nonce 조회에 실패했습니다: ${n}`, t);
1977
+ throw new x(p.UNKNOWN_ERROR, `Nonce 조회에 실패했습니다: ${n}`, t);
1978
1978
  }
1979
1979
  }
1980
1980
  /**
@@ -1993,7 +1993,7 @@ const J = class J extends Zs {
1993
1993
  } catch (t) {
1994
1994
  if (t instanceof x) throw t;
1995
1995
  const n = t instanceof Error ? t.message : String(t);
1996
- throw new x(h.UNKNOWN_ERROR, `잔액 조회에 실패했습니다 (${e}): ${n}`, t);
1996
+ throw new x(p.UNKNOWN_ERROR, `잔액 조회에 실패했습니다 (${e}): ${n}`, t);
1997
1997
  }
1998
1998
  }
1999
1999
  static formatWei(e) {
@@ -2045,7 +2045,7 @@ const J = class J extends Zs {
2045
2045
  } catch (n) {
2046
2046
  if (n instanceof x) throw n;
2047
2047
  const o = n instanceof Error ? n.message : String(n);
2048
- throw new x(h.UNKNOWN_ERROR, `walletRpc 호출에 실패했습니다 [${e}] (${t}): ${o}`, n);
2048
+ throw new x(p.UNKNOWN_ERROR, `walletRpc 호출에 실패했습니다 [${e}] (${t}): ${o}`, n);
2049
2049
  }
2050
2050
  }
2051
2051
  // ============================================================================
@@ -2103,32 +2103,32 @@ const J = class J extends Zs {
2103
2103
  d.log("[CROSSx][Migration Phase 4] PIN 검증 성공"), a = f;
2104
2104
  break;
2105
2105
  }
2106
- const p = _.pinStatus;
2107
- if (i = p.maxAttempts, o = i - p.remainingAttempts, p.remainingAttempts === 0 && p.lockExpiresAt) {
2108
- const b = p.lockExpiresAt * 1e3, E = Math.max(1, Math.round((b - Date.now()) / 1e3)), v = E <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
2106
+ const h = _.pinStatus;
2107
+ if (i = h.maxAttempts, o = i - h.remainingAttempts, h.remainingAttempts === 0 && h.lockExpiresAt) {
2108
+ const b = h.lockExpiresAt * 1e3, E = Math.max(1, Math.round((b - Date.now()) / 1e3)), v = E <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
2109
2109
  d.warn(`[CROSSx][Migration Phase 4] verify-recovery-pin 잠금 — ${E}초, 메시지: ${v}`), await this.confirmation.showRecoveryPinLockedPrompt(E, v), o = 0, n = "Your account lock has been lifted. You may try again.";
2110
2110
  } else
2111
2111
  d.warn(`[CROSSx][Migration Phase 4] PIN 불일치 (시도 ${o}/${i})`), n = "Incorrect PIN.";
2112
2112
  } catch (_) {
2113
2113
  if (!(_ instanceof x)) throw _;
2114
- if (_.code === h.SESSION_EXPIRED) {
2114
+ if (_.code === p.SESSION_EXPIRED) {
2115
2115
  d.warn("[CROSSx][Migration Phase 4] 세션 만료 — 재로그인 후 PIN 입력 재시도");
2116
- const p = fe(this._config.locale ?? "en");
2116
+ const h = fe(this._config.locale ?? "en");
2117
2117
  if (await this.confirmation.showSessionAlert({
2118
- title: p.sessionAlert_title,
2119
- message: p.alert_sessionExpired,
2120
- email: this.userEmail ? De(this.userEmail, p.sessionAlert_appleAccount) : void 0
2118
+ title: h.sessionAlert_title,
2119
+ message: h.alert_sessionExpired,
2120
+ email: this.userEmail ? Me(this.userEmail, h.sessionAlert_appleAccount) : void 0
2121
2121
  }) === "signin-again" && (await this.signInAgain()).success) {
2122
2122
  d.log("[CROSSx][Migration Phase 4] 재로그인 성공 — PIN 입력 루프 계속"), o--;
2123
2123
  continue;
2124
2124
  }
2125
2125
  throw this.clearAuthState(), _;
2126
2126
  }
2127
- if (_.code === h.MIGRATION_PIN_LOCKED) {
2128
- const p = _.details;
2129
- if (i = (p == null ? void 0 : p.maxAttempts) ?? 5, (p == null ? void 0 : p.permanent) === !0)
2127
+ if (_.code === p.MIGRATION_PIN_LOCKED) {
2128
+ const h = _.details;
2129
+ if (i = (h == null ? void 0 : h.maxAttempts) ?? 5, (h == null ? void 0 : h.permanent) === !0)
2130
2130
  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;
2131
- const b = ((p == null ? void 0 : p.lockExpiresAt) ?? 0) * 1e3, E = Math.max(1, Math.round((b - Date.now()) / 1e3)), v = E <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
2131
+ const b = ((h == null ? void 0 : h.lockExpiresAt) ?? 0) * 1e3, E = Math.max(1, Math.round((b - Date.now()) / 1e3)), v = E <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
2132
2132
  d.warn(`[CROSSx][Migration Phase 4] verify-recovery-pin 이미 잠금 — ${E}초`), await this.confirmation.showRecoveryPinLockedPrompt(E, v), o = 0, n = "Your account lock has been lifted. You may try again.";
2133
2133
  } else
2134
2134
  throw d.error("[CROSSx][Migration Phase 4] verify-recovery-pin 실패 (복구 불가):", _), _;
@@ -2140,15 +2140,15 @@ const J = class J extends Zs {
2140
2140
  const f = await this.migrateWalletUseCase.execute(a, e);
2141
2141
  return d.log("[CROSSx][Migration Phase 5] 마이그레이션 성공 — address:", f.address), f;
2142
2142
  } catch (f) {
2143
- if (f instanceof x && f.code === h.MIGRATION_FAILED)
2143
+ if (f instanceof x && f.code === p.MIGRATION_FAILED)
2144
2144
  return d.warn("[CROSSx][Migration Phase 5] migrate PIN 불일치 (경합) — 처음부터 재시도"), this.handleMigrationFlow(e);
2145
- if (f instanceof x && f.code === h.SESSION_EXPIRED) {
2145
+ if (f instanceof x && f.code === p.SESSION_EXPIRED) {
2146
2146
  d.warn("[CROSSx][Migration Phase 5] 세션 만료 — 재로그인 후 마이그레이션 재시도");
2147
2147
  const _ = fe(this._config.locale ?? "en");
2148
2148
  if (await this.confirmation.showSessionAlert({
2149
2149
  title: _.sessionAlert_title,
2150
2150
  message: _.alert_sessionExpired,
2151
- email: this.userEmail ? De(this.userEmail, _.sessionAlert_appleAccount) : void 0
2151
+ email: this.userEmail ? Me(this.userEmail, _.sessionAlert_appleAccount) : void 0
2152
2152
  }) === "signin-again" && (await this.signInAgain()).success) {
2153
2153
  d.log("[CROSSx][Migration Phase 5] 재로그인 성공 — 마이그레이션 재시도 (검증된 PIN 유지)");
2154
2154
  try {
@@ -2176,7 +2176,7 @@ const J = class J extends Zs {
2176
2176
  * jsonRpc 서비스를 통해 nonce 및 가스 파라미터를 자동 조회합니다.
2177
2177
  */
2178
2178
  async withResolvedGasAndFee(e, s) {
2179
- const t = (p) => !(p != null && p.trim()), n = e.nonce === void 0 || e.nonce === null, o = t(e.gasLimit), i = t(e.gasPrice) && t(e.maxFeePerGas), a = !t(e.maxFeePerGas) && t(e.maxPriorityFeePerGas);
2179
+ const t = (h) => !(h != null && h.trim()), n = e.nonce === void 0 || e.nonce === null, o = t(e.gasLimit), i = t(e.gasPrice) && t(e.maxFeePerGas), a = !t(e.maxFeePerGas) && t(e.maxPriorityFeePerGas);
2180
2180
  if (!n && !o && !i && !a) return e;
2181
2181
  const c = { ...e }, l = n ? c.from ?? this.address : void 0;
2182
2182
  l && d.log("[CROSSx] nonce 비어있음 → eth_getTransactionCount 호출 (from:", l, ")"), o && d.log("[CROSSx] gasLimit 비어있음 → eth_estimateGas 호출"), i && d.log("[CROSSx] gasPrice & maxFeePerGas 비어있음 → baseFee 조회로 Dynamic/Legacy 판별");
@@ -2186,10 +2186,10 @@ const J = class J extends Zs {
2186
2186
  i ? this.getBaseFeePerGas(s) : null
2187
2187
  ]);
2188
2188
  if (l && (c.nonce = parseInt(u ?? "0x0", 16), d.log("[CROSSx] nonce 결과:", c.nonce)), o && (c.gasLimit = f, d.log("[CROSSx] estimateGas 결과:", c.gasLimit)), i) {
2189
- const p = _;
2190
- if (p) {
2189
+ const h = _;
2190
+ if (h) {
2191
2191
  const b = Ct;
2192
- c.maxFeePerGas = "0x" + (BigInt(p) + BigInt(b)).toString(16), c.maxPriorityFeePerGas = b, d.log("[CROSSx] Dynamic 체인 감지 — baseFee:", p, "maxFeePerGas:", c.maxFeePerGas, "maxPriorityFeePerGas: 1 Gwei");
2192
+ c.maxFeePerGas = "0x" + (BigInt(h) + BigInt(b)).toString(16), c.maxPriorityFeePerGas = b, d.log("[CROSSx] Dynamic 체인 감지 — baseFee:", h, "maxFeePerGas:", c.maxFeePerGas, "maxPriorityFeePerGas: 1 Gwei");
2193
2193
  } else
2194
2194
  c.gasPrice = nr, d.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
2195
2195
  }
@@ -2206,7 +2206,7 @@ const J = class J extends Zs {
2206
2206
  if (e === "0") {
2207
2207
  if (t !== void 0 && t !== 0)
2208
2208
  throw new x(
2209
- h.TYPED_DATA_CHAIN_ID_MISMATCH,
2209
+ p.TYPED_DATA_CHAIN_ID_MISMATCH,
2210
2210
  `오프체인 서명(chainId=0)에서는 typedData.domain.chainId가 없거나 0이어야 합니다. 현재 값: ${t}`
2211
2211
  );
2212
2212
  return;
@@ -2216,12 +2216,12 @@ const J = class J extends Zs {
2216
2216
  const o = Number(n[1]);
2217
2217
  if (t === void 0)
2218
2218
  throw new x(
2219
- h.TYPED_DATA_CHAIN_ID_MISMATCH,
2219
+ p.TYPED_DATA_CHAIN_ID_MISMATCH,
2220
2220
  `온체인 서명(${e})에서는 typedData.domain.chainId가 반드시 있어야 합니다`
2221
2221
  );
2222
2222
  if (t !== o)
2223
2223
  throw new x(
2224
- h.TYPED_DATA_CHAIN_ID_MISMATCH,
2224
+ p.TYPED_DATA_CHAIN_ID_MISMATCH,
2225
2225
  `typedData.domain.chainId (${t})가 chainId (${e}, 예상값: ${o})와 일치하지 않습니다`
2226
2226
  );
2227
2227
  }
@@ -2239,10 +2239,10 @@ const J = class J extends Zs {
2239
2239
  static validateSignatureFormat(e) {
2240
2240
  const s = e.startsWith("0x") ? e.slice(2) : e;
2241
2241
  if (!/^[0-9a-fA-F]+$/.test(s))
2242
- throw new x(h.SIGNATURE_FAILED, "유효하지 않은 서명: 올바른 hex 문자열이 아닙니다");
2242
+ throw new x(p.SIGNATURE_FAILED, "유효하지 않은 서명: 올바른 hex 문자열이 아닙니다");
2243
2243
  if (s.length !== Nt)
2244
2244
  throw new x(
2245
- h.SIGNATURE_FAILED,
2245
+ p.SIGNATURE_FAILED,
2246
2246
  `서명 길이가 유효하지 않습니다: ${Nt} hex 문자(65 바이트) 예상, 현재 ${s.length}`
2247
2247
  );
2248
2248
  }
@@ -2250,9 +2250,9 @@ const J = class J extends Zs {
2250
2250
  static validateSignedTxFormat(e) {
2251
2251
  const s = e.startsWith("0x") ? e.slice(2) : e;
2252
2252
  if (!/^[0-9a-fA-F]+$/.test(s))
2253
- throw new x(h.SIGNATURE_FAILED, "유효하지 않은 서명된 트랜잭션: 올바른 hex 문자열이 아닙니다");
2253
+ throw new x(p.SIGNATURE_FAILED, "유효하지 않은 서명된 트랜잭션: 올바른 hex 문자열이 아닙니다");
2254
2254
  if (s.length < 2)
2255
- throw new x(h.SIGNATURE_FAILED, "유효하지 않은 서명된 트랜잭션: 너무 짧습니다");
2255
+ throw new x(p.SIGNATURE_FAILED, "유효하지 않은 서명된 트랜잭션: 너무 짧습니다");
2256
2256
  }
2257
2257
  /**
2258
2258
  * Gateway 서명 응답의 ecrecover 검증 (XF-036)
@@ -2269,7 +2269,7 @@ const J = class J extends Zs {
2269
2269
  expected: t,
2270
2270
  recovered: n
2271
2271
  }), new x(
2272
- h.SIGNATURE_SIGNER_MISMATCH,
2272
+ p.SIGNATURE_SIGNER_MISMATCH,
2273
2273
  `서명자 주소가 일치하지 않습니다: 예상 ${t}, 복원된 주소 ${n}`
2274
2274
  );
2275
2275
  d.log("[CROSSx] 서명 ecrecover 검증 성공");
@@ -2340,7 +2340,7 @@ const J = class J extends Zs {
2340
2340
  return await this.confirmation.showSessionAlert({
2341
2341
  title: f.sessionAlert_title,
2342
2342
  message: f.alert_differentAccount,
2343
- email: this.userEmail ? De(this.userEmail, f.sessionAlert_appleAccount) : void 0
2343
+ email: this.userEmail ? Me(this.userEmail, f.sessionAlert_appleAccount) : void 0
2344
2344
  }) === "signin-again" ? (this._isRecoveringSession = !1, this.signInAgain()) : (this.clearAuthState(), { success: !1, error: "Different account signed in" });
2345
2345
  }
2346
2346
  this.applyAuthResult(a);
@@ -2364,8 +2364,8 @@ const J = class J extends Zs {
2364
2364
  try {
2365
2365
  return await e();
2366
2366
  } catch (s) {
2367
- const t = fe(this._config.locale ?? "en"), n = this.userEmail ? De(this.userEmail, t.sessionAlert_appleAccount) : void 0;
2368
- if (s instanceof x && s.code === h.WITHDRAW_FAILED) {
2367
+ const t = fe(this._config.locale ?? "en"), n = this.userEmail ? Me(this.userEmail, t.sessionAlert_appleAccount) : void 0;
2368
+ if (s instanceof x && s.code === p.WITHDRAW_FAILED) {
2369
2369
  if (d.warn("[CROSSx] WITHDRAW_FAILED — 로컬 인증 초기화"), await this.confirmation.showSessionAlert({
2370
2370
  title: t.sessionAlert_title,
2371
2371
  message: t.alert_accountWithdrawn,
@@ -2374,7 +2374,7 @@ const J = class J extends Zs {
2374
2374
  return e();
2375
2375
  throw this.clearAuthState(), s;
2376
2376
  }
2377
- if (s instanceof x && s.code === h.WALLET_NOT_FOUND) {
2377
+ if (s instanceof x && s.code === p.WALLET_NOT_FOUND) {
2378
2378
  if (d.warn("[CROSSx] WALLET_NOT_FOUND — 로컬 인증 초기화"), await this.confirmation.showSessionAlert({
2379
2379
  title: t.sessionAlert_title,
2380
2380
  message: t.alert_walletNotFound,
@@ -2383,7 +2383,7 @@ const J = class J extends Zs {
2383
2383
  return e();
2384
2384
  throw this.clearAuthState(), s;
2385
2385
  }
2386
- if (!(s instanceof x) || s.code !== h.SESSION_EXPIRED)
2386
+ if (!(s instanceof x) || s.code !== p.SESSION_EXPIRED)
2387
2387
  throw s;
2388
2388
  if (d.warn("[CROSSx] SESSION_EXPIRED 감지 — 자동 재인증 시도"), await this.confirmation.showSessionAlert({
2389
2389
  title: t.sessionAlert_title,
@@ -2391,13 +2391,13 @@ const J = class J extends Zs {
2391
2391
  email: n
2392
2392
  }) === "signout")
2393
2393
  throw this.clearAuthState(), new x(
2394
- h.SESSION_EXPIRED,
2394
+ p.SESSION_EXPIRED,
2395
2395
  "세션이 만료되었습니다. 다시 로그인해 주세요."
2396
2396
  );
2397
2397
  const i = await this.signInAgain();
2398
2398
  if (!i.success)
2399
2399
  throw new x(
2400
- h.SESSION_EXPIRED,
2400
+ p.SESSION_EXPIRED,
2401
2401
  i.error ?? "세션이 만료되었습니다. 다시 로그인해 주세요."
2402
2402
  );
2403
2403
  return e();
@@ -2419,7 +2419,7 @@ const J = class J extends Zs {
2419
2419
  if (this.pinStore.has()) return;
2420
2420
  const e = await this.confirmation.showPinSetupPrompt();
2421
2421
  if (!e)
2422
- throw new x(h.PIN_CANCELLED, "사용자가 PIN 설정을 취소했습니다");
2422
+ throw new x(p.PIN_CANCELLED, "사용자가 PIN 설정을 취소했습니다");
2423
2423
  this.pinStore.set(e), d.log("[CROSSx] PIN 설정 완료 (메모리 캐시)");
2424
2424
  }
2425
2425
  /**
@@ -2433,7 +2433,7 @@ const J = class J extends Zs {
2433
2433
  e && this.pinStore.clear();
2434
2434
  const s = await this.confirmation.showPinInputPrompt({ errorMessage: e });
2435
2435
  if (!s)
2436
- throw new x(h.PIN_CANCELLED, "사용자가 PIN 입력을 취소했습니다");
2436
+ throw new x(p.PIN_CANCELLED, "사용자가 PIN 입력을 취소했습니다");
2437
2437
  this.pinStore.set(s), d.log("[CROSSx] PIN 입력 완료 (메모리 캐시)");
2438
2438
  }
2439
2439
  /**
@@ -2474,7 +2474,7 @@ const J = class J extends Zs {
2474
2474
  maxAttempts: n
2475
2475
  });
2476
2476
  if (!l)
2477
- throw new x(h.PIN_CANCELLED, "사용자가 PIN 입력을 취소했습니다");
2477
+ throw new x(p.PIN_CANCELLED, "사용자가 PIN 입력을 취소했습니다");
2478
2478
  this.pinStore.set(l), d.log("[CROSSx] PIN 캐시 완료 (verifyPin 미지원, 로컬 전용)"), o();
2479
2479
  return;
2480
2480
  }
@@ -2490,11 +2490,11 @@ const J = class J extends Zs {
2490
2490
  return await this.walletProvider.verifyPin(l) ? (d.log("[CROSSx] PIN 서버 검증 완료 (verify-password)"), { ok: !0 }) : (this.pinStore.clear(), { ok: !1, error: a.pinInput_error });
2491
2491
  } catch (u) {
2492
2492
  if (this.pinStore.clear(), u instanceof x) {
2493
- if (u.code === h.PIN_WRONG)
2493
+ if (u.code === p.PIN_WRONG)
2494
2494
  return { ok: !1, error: a.pinInput_error };
2495
- if (u.code === h.PIN_INVALID)
2495
+ if (u.code === p.PIN_INVALID)
2496
2496
  return { ok: !1, error: u.message };
2497
- if (u.code === h.PIN_LOCKED)
2497
+ if (u.code === p.PIN_LOCKED)
2498
2498
  return J.buildPinLockedResult(u, a);
2499
2499
  }
2500
2500
  throw u;
@@ -2502,15 +2502,15 @@ const J = class J extends Zs {
2502
2502
  }
2503
2503
  });
2504
2504
  if (!c)
2505
- throw new x(h.PIN_CANCELLED, "사용자가 PIN 입력을 취소했습니다");
2505
+ throw new x(p.PIN_CANCELLED, "사용자가 PIN 입력을 취소했습니다");
2506
2506
  this.pinStore.set(c), d.log("[CROSSx] PIN 갱신 완료 (verify 모달 닫힘)"), o();
2507
2507
  } catch (c) {
2508
- if (c instanceof x && (c.code === h.AUTH_NOT_AUTHENTICATED || c.code === h.AUTH_TOKEN_EXPIRED || c.code === h.SESSION_EXPIRED) && c.code !== h.SESSION_EXPIRED) {
2508
+ if (c instanceof x && (c.code === p.AUTH_NOT_AUTHENTICATED || c.code === p.AUTH_TOKEN_EXPIRED || c.code === p.SESSION_EXPIRED) && c.code !== p.SESSION_EXPIRED) {
2509
2509
  const l = fe(this._config.locale ?? "en");
2510
2510
  if (await this.confirmation.showSessionAlert({
2511
2511
  title: l.sessionAlert_title,
2512
2512
  message: l.alert_sessionExpired,
2513
- email: this.userEmail ? De(this.userEmail, l.sessionAlert_appleAccount) : void 0
2513
+ email: this.userEmail ? Me(this.userEmail, l.sessionAlert_appleAccount) : void 0
2514
2514
  }) === "signin-again" && (await this.signInAgain()).success)
2515
2515
  throw i(c), c;
2516
2516
  }
@@ -2531,11 +2531,11 @@ const J = class J extends Zs {
2531
2531
  * buildPinLockedResult(onSubmit)와 withPinRetry(모달 재오픈) 양쪽에서 사용합니다.
2532
2532
  */
2533
2533
  static parsePinError(e, s) {
2534
- if (e.code === h.PIN_WRONG)
2534
+ if (e.code === p.PIN_WRONG)
2535
2535
  return { errorMessage: s.pinInput_error };
2536
- if (e.code === h.PIN_INVALID)
2536
+ if (e.code === p.PIN_INVALID)
2537
2537
  return { errorMessage: e.message };
2538
- if (e.code === h.PIN_LOCKED) {
2538
+ if (e.code === p.PIN_LOCKED) {
2539
2539
  const t = e.details;
2540
2540
  return t != null && t.permanent ? { errorMessage: s.pinLocked_permanent } : (t == null ? void 0 : t.remainingAttempts) != null && t.remainingAttempts > 0 && t.maxAttempts ? {
2541
2541
  errorMessage: s.pinInput_error,
@@ -2624,7 +2624,7 @@ const J = class J extends Zs {
2624
2624
  async resolveAddress(e) {
2625
2625
  if (e === void 0 || e === this.activeWalletIndex) {
2626
2626
  if (!this.address)
2627
- throw new x(h.AUTH_NOT_AUTHENTICATED, "활성 지갑 주소를 찾을 수 없습니다");
2627
+ throw new x(p.AUTH_NOT_AUTHENTICATED, "활성 지갑 주소를 찾을 수 없습니다");
2628
2628
  return { address: this.address, index: this.activeWalletIndex };
2629
2629
  }
2630
2630
  return { address: (await this.withPinRetry(() => this.walletProvider.getAddress(this.userId, e))).address, index: e };
@@ -2632,14 +2632,14 @@ const J = class J extends Zs {
2632
2632
  ensureInitialized() {
2633
2633
  if (!this.initialized)
2634
2634
  throw new x(
2635
- h.AUTH_NOT_INITIALIZED,
2635
+ p.AUTH_NOT_INITIALIZED,
2636
2636
  "SDK가 초기화되지 않았습니다. initialize()를 먼저 호출하세요."
2637
2637
  );
2638
2638
  }
2639
2639
  ensureAuthenticated() {
2640
2640
  if (this.ensureInitialized(), !this.authenticated)
2641
2641
  throw new x(
2642
- h.AUTH_NOT_AUTHENTICATED,
2642
+ p.AUTH_NOT_AUTHENTICATED,
2643
2643
  "인증되지 않은 상태입니다. signIn()을 먼저 호출하세요."
2644
2644
  );
2645
2645
  }
@@ -2710,7 +2710,7 @@ class ar {
2710
2710
  }
2711
2711
  }
2712
2712
  }
2713
- const tt = "crossx-sdk", cr = 1, he = "data", Ee = "keys", He = "aes-primary", lr = 12;
2713
+ const tt = "crossx-sdk", cr = 1, he = "data", Ee = "keys", Fe = "aes-primary", lr = 12;
2714
2714
  class $t {
2715
2715
  constructor(e) {
2716
2716
  this.db = null, this.cryptoKey = null, this.initPromise = null, this.dbName = `crossx-sdk-${e}`;
@@ -2753,7 +2753,7 @@ class $t {
2753
2753
  }
2754
2754
  async init() {
2755
2755
  this.db = await this.openDB();
2756
- const e = await this.idbGet(Ee, He);
2756
+ const e = await this.idbGet(Ee, Fe);
2757
2757
  if (e) {
2758
2758
  this.cryptoKey = e;
2759
2759
  return;
@@ -2767,7 +2767,7 @@ class $t {
2767
2767
  { name: "AES-GCM", length: 256 },
2768
2768
  !1,
2769
2769
  ["encrypt", "decrypt"]
2770
- ), await this.idbPut(Ee, He, this.cryptoKey);
2770
+ ), await this.idbPut(Ee, Fe, this.cryptoKey);
2771
2771
  }
2772
2772
  /**
2773
2773
  * 레거시 DB('crossx-sdk')에서 projectId 스코프 DB로 암호키·데이터 마이그레이션.
@@ -2776,7 +2776,7 @@ class $t {
2776
2776
  async migrateFromLegacyDB() {
2777
2777
  if (this.dbName === tt) return null;
2778
2778
  try {
2779
- const e = await this.openDB(tt), s = e.transaction([Ee, he], "readonly"), t = s.objectStore(Ee).get(He), n = await new Promise((l, u) => {
2779
+ const e = await this.openDB(tt), s = e.transaction([Ee, he], "readonly"), t = s.objectStore(Ee).get(Fe), n = await new Promise((l, u) => {
2780
2780
  t.onsuccess = () => l(t.result), t.onerror = () => u(t.error);
2781
2781
  });
2782
2782
  if (!n)
@@ -2789,7 +2789,7 @@ class $t {
2789
2789
  i.onsuccess = () => l(i.result), i.onerror = () => u(i.error);
2790
2790
  })
2791
2791
  ]);
2792
- e.close(), await this.idbPut(Ee, He, n);
2792
+ e.close(), await this.idbPut(Ee, Fe, n);
2793
2793
  for (let l = 0; l < c.length; l++)
2794
2794
  await this.idbPut(he, String(c[l]), a[l]);
2795
2795
  return indexedDB.deleteDatabase(tt), d.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), n;
@@ -2879,7 +2879,7 @@ function is(r) {
2879
2879
  throw new Error("Hash must wrapped by utils.createHasher");
2880
2880
  we(r.outputLen), we(r.blockLen);
2881
2881
  }
2882
- function Ce(r, e = !0) {
2882
+ function Ne(r, e = !0) {
2883
2883
  if (r.destroyed)
2884
2884
  throw new Error("Hash instance has been destroyed");
2885
2885
  if (e && r.finished)
@@ -2894,7 +2894,7 @@ function as(r, e) {
2894
2894
  function dr(r) {
2895
2895
  return new Uint32Array(r.buffer, r.byteOffset, Math.floor(r.byteLength / 4));
2896
2896
  }
2897
- function Ne(...r) {
2897
+ function Le(...r) {
2898
2898
  for (let e = 0; e < r.length; e++)
2899
2899
  r[e].fill(0);
2900
2900
  }
@@ -2914,7 +2914,7 @@ function pr(r) {
2914
2914
  return r;
2915
2915
  }
2916
2916
  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"));
2917
- function Ue(r) {
2917
+ function He(r) {
2918
2918
  if (V(r), cs)
2919
2919
  return r.toHex();
2920
2920
  let e = "";
@@ -2998,7 +2998,7 @@ class mr {
2998
2998
  this.blockLen = e, this.outputLen = s, this.padOffset = t, this.isLE = n, this.buffer = new Uint8Array(e), this.view = st(this.buffer);
2999
2999
  }
3000
3000
  update(e) {
3001
- Ce(this), V(e);
3001
+ Ne(this), V(e);
3002
3002
  const { view: s, buffer: t, blockLen: n } = this, o = e.length;
3003
3003
  for (let i = 0; i < o; ) {
3004
3004
  const a = Math.min(n - this.pos, o - i);
@@ -3013,10 +3013,10 @@ class mr {
3013
3013
  return this.length += e.length, this.roundClean(), this;
3014
3014
  }
3015
3015
  digestInto(e) {
3016
- Ce(this), as(e, this), this.finished = !0;
3016
+ Ne(this), as(e, this), this.finished = !0;
3017
3017
  const { buffer: s, view: t, blockLen: n, isLE: o } = this;
3018
3018
  let { pos: i } = this;
3019
- s[i++] = 128, Ne(this.buffer.subarray(i)), this.padOffset > n - i && (this.process(t, 0), i = 0);
3019
+ s[i++] = 128, Le(this.buffer.subarray(i)), this.padOffset > n - i && (this.process(t, 0), i = 0);
3020
3020
  for (let f = i; f < n; f++)
3021
3021
  s[f] = 0;
3022
3022
  t.setBigUint64(n - 8, BigInt(this.length * 8), o), this.process(t, 0);
@@ -3053,9 +3053,9 @@ const ye = /* @__PURE__ */ Uint32Array.from([
3053
3053
  2600822924,
3054
3054
  528734635,
3055
3055
  1541459225
3056
- ]), Fe = /* @__PURE__ */ BigInt(2 ** 32 - 1), Ht = /* @__PURE__ */ BigInt(32);
3056
+ ]), Ge = /* @__PURE__ */ BigInt(2 ** 32 - 1), Ht = /* @__PURE__ */ BigInt(32);
3057
3057
  function wr(r, e = !1) {
3058
- return e ? { h: Number(r & Fe), l: Number(r >> Ht & Fe) } : { h: Number(r >> Ht & Fe) | 0, l: Number(r & Fe) | 0 };
3058
+ return e ? { h: Number(r & Ge), l: Number(r >> Ht & Ge) } : { h: Number(r >> Ht & Ge) | 0, l: Number(r & Ge) | 0 };
3059
3059
  }
3060
3060
  function yr(r, e = !1) {
3061
3061
  const s = r.length;
@@ -3148,21 +3148,21 @@ class Ar extends mr {
3148
3148
  for (let f = 0; f < 16; f++, s += 4)
3149
3149
  be[f] = e.getUint32(s, !1);
3150
3150
  for (let f = 16; f < 64; f++) {
3151
- const _ = be[f - 15], p = be[f - 2], b = pe(_, 7) ^ pe(_, 18) ^ _ >>> 3, E = pe(p, 17) ^ pe(p, 19) ^ p >>> 10;
3151
+ const _ = be[f - 15], h = be[f - 2], b = pe(_, 7) ^ pe(_, 18) ^ _ >>> 3, E = pe(h, 17) ^ pe(h, 19) ^ h >>> 10;
3152
3152
  be[f] = E + be[f - 7] + b + be[f - 16] | 0;
3153
3153
  }
3154
3154
  let { A: t, B: n, C: o, D: i, E: a, F: c, G: l, H: u } = this;
3155
3155
  for (let f = 0; f < 64; f++) {
3156
- const _ = pe(a, 6) ^ pe(a, 11) ^ pe(a, 25), p = u + _ + xr(a, c, l) + Ir[f] + be[f] | 0, E = (pe(t, 2) ^ pe(t, 13) ^ pe(t, 22)) + gr(t, n, o) | 0;
3157
- u = l, l = c, c = a, a = i + p | 0, i = o, o = n, n = t, t = p + E | 0;
3156
+ const _ = pe(a, 6) ^ pe(a, 11) ^ pe(a, 25), h = u + _ + xr(a, c, l) + Ir[f] + be[f] | 0, E = (pe(t, 2) ^ pe(t, 13) ^ pe(t, 22)) + gr(t, n, o) | 0;
3157
+ u = l, l = c, c = a, a = i + h | 0, i = o, o = n, n = t, t = h + E | 0;
3158
3158
  }
3159
3159
  t = t + this.A | 0, n = n + this.B | 0, o = o + this.C | 0, i = i + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, u = u + this.H | 0, this.set(t, n, o, i, a, c, l, u);
3160
3160
  }
3161
3161
  roundClean() {
3162
- Ne(be);
3162
+ Le(be);
3163
3163
  }
3164
3164
  destroy() {
3165
- this.set(0, 0, 0, 0, 0, 0, 0, 0), Ne(this.buffer);
3165
+ this.set(0, 0, 0, 0, 0, 0, 0, 0), Le(this.buffer);
3166
3166
  }
3167
3167
  }
3168
3168
  class Tr extends Ar {
@@ -3201,7 +3201,7 @@ function us(r) {
3201
3201
  we(r);
3202
3202
  return r;
3203
3203
  }
3204
- function Ge(r) {
3204
+ function We(r) {
3205
3205
  const e = us(r).toString(16);
3206
3206
  return e.length & 1 ? "0" + e : e;
3207
3207
  }
@@ -3211,10 +3211,10 @@ function hs(r) {
3211
3211
  return r === "" ? gt : BigInt("0x" + r);
3212
3212
  }
3213
3213
  function Je(r) {
3214
- return hs(Ue(r));
3214
+ return hs(He(r));
3215
3215
  }
3216
3216
  function ps(r) {
3217
- return hs(Ue(Rr(V(r)).reverse()));
3217
+ return hs(He(Rr(V(r)).reverse()));
3218
3218
  }
3219
3219
  function mt(r, e) {
3220
3220
  we(e), r = us(r);
@@ -3251,7 +3251,7 @@ function Nr(r, e, s) {
3251
3251
  let c = t(r), l = t(r), u = 0;
3252
3252
  const f = () => {
3253
3253
  c.fill(1), l.fill(0), u = 0;
3254
- }, _ = (...v) => s(l, ve(c, ...v)), p = (v = n) => {
3254
+ }, _ = (...v) => s(l, ve(c, ...v)), h = (v = n) => {
3255
3255
  l = _(o, v), c = _(), v.length !== 0 && (l = _(i, v), c = _());
3256
3256
  }, b = () => {
3257
3257
  if (u++ >= a)
@@ -3266,10 +3266,10 @@ function Nr(r, e, s) {
3266
3266
  return ve(...T);
3267
3267
  };
3268
3268
  return (v, T) => {
3269
- f(), p(v);
3269
+ f(), h(v);
3270
3270
  let R;
3271
3271
  for (; !(R = T(b())); )
3272
- p();
3272
+ h();
3273
3273
  return f(), R;
3274
3274
  };
3275
3275
  }
@@ -3339,8 +3339,8 @@ function $r(r) {
3339
3339
  const e = Ze(r), s = bs(r), t = s(e, e.neg(e.ONE)), n = s(e, t), o = s(e, e.neg(t)), i = (r + Lr) / ws;
3340
3340
  return (a, c) => {
3341
3341
  let l = a.pow(c, i), u = a.mul(l, t);
3342
- const f = a.mul(l, n), _ = a.mul(l, o), p = a.eql(a.sqr(u), c), b = a.eql(a.sqr(f), c);
3343
- l = a.cmov(l, u, p), u = a.cmov(_, f, b);
3342
+ const f = a.mul(l, n), _ = a.mul(l, o), h = a.eql(a.sqr(u), c), b = a.eql(a.sqr(f), c);
3343
+ l = a.cmov(l, u, h), u = a.cmov(_, f, b);
3344
3344
  const E = a.eql(a.sqr(u), c), v = a.cmov(l, u, E);
3345
3345
  return bt(a, v, c), v;
3346
3346
  };
@@ -3365,7 +3365,7 @@ function bs(r) {
3365
3365
  return l;
3366
3366
  if (Wt(c, l) !== 1)
3367
3367
  throw new Error("Cannot find square root");
3368
- let u = s, f = c.mul(c.ONE, o), _ = c.pow(l, e), p = c.pow(l, i);
3368
+ let u = s, f = c.mul(c.ONE, o), _ = c.pow(l, e), h = c.pow(l, i);
3369
3369
  for (; !c.eql(_, c.ONE); ) {
3370
3370
  if (c.is0(_))
3371
3371
  return c.ZERO;
@@ -3374,9 +3374,9 @@ function bs(r) {
3374
3374
  if (b++, E = c.sqr(E), b === u)
3375
3375
  throw new Error("Cannot find square root");
3376
3376
  const v = se << BigInt(u - b - 1), T = c.pow(f, v);
3377
- u = b, f = c.sqr(T), _ = c.mul(_, f), p = c.mul(p, T);
3377
+ u = b, f = c.sqr(T), _ = c.mul(_, f), h = c.mul(h, T);
3378
3378
  }
3379
- return p;
3379
+ return h;
3380
3380
  };
3381
3381
  }
3382
3382
  function Br(r) {
@@ -3570,7 +3570,7 @@ function qr(r, e, s = !1) {
3570
3570
  return s ? fs(a, n) : mt(a, n);
3571
3571
  }
3572
3572
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3573
- const Le = /* @__PURE__ */ BigInt(0), ke = /* @__PURE__ */ BigInt(1);
3573
+ const De = /* @__PURE__ */ BigInt(0), ke = /* @__PURE__ */ BigInt(1);
3574
3574
  function je(r, e) {
3575
3575
  const s = e.negate();
3576
3576
  return r ? s : e;
@@ -3592,15 +3592,15 @@ function Kt(r, e, s) {
3592
3592
  const { windowSize: t, mask: n, maxNumber: o, shiftBy: i } = s;
3593
3593
  let a = Number(r & n), c = r >> i;
3594
3594
  a > t && (a -= o, c += ke);
3595
- const l = e * t, u = l + Math.abs(a) - 1, f = a === 0, _ = a < 0, p = e % 2 !== 0;
3596
- return { nextN: c, offset: u, isZero: f, isNeg: _, isNegF: p, offsetF: l };
3595
+ const l = e * t, u = l + Math.abs(a) - 1, f = a === 0, _ = a < 0, h = e % 2 !== 0;
3596
+ return { nextN: c, offset: u, isZero: f, isNeg: _, isNegF: h, offsetF: l };
3597
3597
  }
3598
3598
  const nt = /* @__PURE__ */ new WeakMap(), As = /* @__PURE__ */ new WeakMap();
3599
3599
  function ot(r) {
3600
3600
  return As.get(r) || 1;
3601
3601
  }
3602
3602
  function Vt(r) {
3603
- if (r !== Le)
3603
+ if (r !== De)
3604
3604
  throw new Error("invalid wNAF");
3605
3605
  }
3606
3606
  class Kr {
@@ -3615,7 +3615,7 @@ class Kr {
3615
3615
  // non-const time multiplication ladder
3616
3616
  _unsafeLadder(e, s, t = this.ZERO) {
3617
3617
  let n = e;
3618
- for (; s > Le; )
3618
+ for (; s > De; )
3619
3619
  s & ke && (t = t.add(n)), n = n.double(), s >>= ke;
3620
3620
  return t;
3621
3621
  }
@@ -3654,8 +3654,8 @@ class Kr {
3654
3654
  let n = this.ZERO, o = this.BASE;
3655
3655
  const i = rt(e, this.bits);
3656
3656
  for (let a = 0; a < i.windows; a++) {
3657
- const { nextN: c, offset: l, isZero: u, isNeg: f, isNegF: _, offsetF: p } = Kt(t, a, i);
3658
- t = c, u ? o = o.add(je(_, s[p])) : n = n.add(je(f, s[l]));
3657
+ const { nextN: c, offset: l, isZero: u, isNeg: f, isNegF: _, offsetF: h } = Kt(t, a, i);
3658
+ t = c, u ? o = o.add(je(_, s[h])) : n = n.add(je(f, s[l]));
3659
3659
  }
3660
3660
  return Vt(t), { p: n, f: o };
3661
3661
  }
@@ -3666,7 +3666,7 @@ class Kr {
3666
3666
  */
3667
3667
  wNAFUnsafe(e, s, t, n = this.ZERO) {
3668
3668
  const o = rt(e, this.bits);
3669
- for (let i = 0; i < o.windows && t !== Le; i++) {
3669
+ for (let i = 0; i < o.windows && t !== De; i++) {
3670
3670
  const { nextN: a, offset: c, isZero: l, isNeg: u } = Kt(t, i, o);
3671
3671
  if (t = a, !l) {
3672
3672
  const f = s[c];
@@ -3699,7 +3699,7 @@ class Kr {
3699
3699
  }
3700
3700
  function Vr(r, e, s, t) {
3701
3701
  let n = e, o = r.ZERO, i = r.ZERO;
3702
- for (; s > Le || t > Le; )
3702
+ for (; s > De || t > De; )
3703
3703
  s & ke && (o = o.add(n)), t & ke && (i = i.add(n)), n = n.double(), s >>= ke, t >>= ke;
3704
3704
  return { p1: o, p2: i };
3705
3705
  }
@@ -3716,7 +3716,7 @@ function zr(r, e, s = {}, t) {
3716
3716
  throw new Error(`expected valid ${r} CURVE object`);
3717
3717
  for (const c of ["p", "n", "h"]) {
3718
3718
  const l = e[c];
3719
- if (!(typeof l == "bigint" && l > Le))
3719
+ if (!(typeof l == "bigint" && l > De))
3720
3720
  throw new Error(`CURVE.${c} must be positive bigint`);
3721
3721
  }
3722
3722
  const n = zt(e.p, s.Fp, t), o = zt(e.n, s.Fn, t), a = ["Gx", "Gy", "a", "b"];
@@ -3749,13 +3749,13 @@ class Ts {
3749
3749
  this.iHash.update(n), this.oHash = e.create();
3750
3750
  for (let o = 0; o < n.length; o++)
3751
3751
  n[o] ^= 106;
3752
- this.oHash.update(n), Ne(n);
3752
+ this.oHash.update(n), Le(n);
3753
3753
  }
3754
3754
  update(e) {
3755
- return Ce(this), this.iHash.update(e), this;
3755
+ return Ne(this), this.iHash.update(e), this;
3756
3756
  }
3757
3757
  digestInto(e) {
3758
- Ce(this), V(e, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
3758
+ Ne(this), V(e, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
3759
3759
  }
3760
3760
  digest() {
3761
3761
  const e = new Uint8Array(this.oHash.outputLen);
@@ -3782,8 +3782,8 @@ function Yr(r, e, s) {
3782
3782
  let l = r - a * t - c * o, u = -a * n - c * i;
3783
3783
  const f = l < ge, _ = u < ge;
3784
3784
  f && (l = -l), _ && (u = -u);
3785
- const p = wt(Math.ceil(Cr(s) / 2)) + Pe;
3786
- if (l < ge || l >= p || u < ge || u >= p)
3785
+ const h = wt(Math.ceil(Cr(s) / 2)) + Ce;
3786
+ if (l < ge || l >= h || u < ge || u >= h)
3787
3787
  throw new Error("splitScalar (endomorphism): failed, k=" + r);
3788
3788
  return { k1neg: f, k1: l, k2neg: _, k2: u };
3789
3789
  }
@@ -3814,11 +3814,11 @@ const Se = {
3814
3814
  throw new s("tlv.encode: wrong tag");
3815
3815
  if (e.length & 1)
3816
3816
  throw new s("tlv.encode: unpadded data");
3817
- const t = e.length / 2, n = Ge(t);
3817
+ const t = e.length / 2, n = We(t);
3818
3818
  if (n.length / 2 & 128)
3819
3819
  throw new s("tlv.encode: long form length too big");
3820
- const o = t > 127 ? Ge(n.length / 2 | 128) : "";
3821
- return Ge(r) + o + n + e;
3820
+ const o = t > 127 ? We(n.length / 2 | 128) : "";
3821
+ return We(r) + o + n + e;
3822
3822
  },
3823
3823
  // v - value, l - left bytes (unparsed)
3824
3824
  decode(r, e) {
@@ -3863,7 +3863,7 @@ const Se = {
3863
3863
  const { Err: e } = Se;
3864
3864
  if (r < ge)
3865
3865
  throw new e("integer: negative integers are not allowed");
3866
- let s = Ge(r);
3866
+ let s = We(r);
3867
3867
  if (Number.parseInt(s[0], 16) & 8 && (s = "00" + s), s.length & 1)
3868
3868
  throw new e("unexpected DER parsing assertion: unpadded hex");
3869
3869
  return s;
@@ -3890,7 +3890,7 @@ const Se = {
3890
3890
  const { _tlv: e, _int: s } = Se, t = e.encode(2, s.encode(r.r)), n = e.encode(2, s.encode(r.s)), o = t + n;
3891
3891
  return e.encode(48, o);
3892
3892
  }
3893
- }, ge = BigInt(0), Pe = BigInt(1), Rs = BigInt(2), We = BigInt(3), Jr = BigInt(4);
3893
+ }, ge = BigInt(0), Ce = BigInt(1), Rs = BigInt(2), qe = BigInt(3), Jr = BigInt(4);
3894
3894
  function Zr(r, e = {}) {
3895
3895
  const s = zr("weierstrass", r, e), { Fp: t, Fn: n } = s;
3896
3896
  let o = s.CURVE;
@@ -3946,7 +3946,7 @@ function Zr(r, e = {}) {
3946
3946
  } else
3947
3947
  throw new Error(`bad point: got length ${A}, expected compressed=${g} or uncompressed=${m}`);
3948
3948
  }
3949
- const p = e.toBytes || f, b = e.fromBytes || _;
3949
+ const h = e.toBytes || f, b = e.fromBytes || _;
3950
3950
  function E(M) {
3951
3951
  const g = t.sqr(M), m = t.mul(g, M);
3952
3952
  return t.add(t.add(m, t.mul(M, o.a)), o.b);
@@ -3957,7 +3957,7 @@ function Zr(r, e = {}) {
3957
3957
  }
3958
3958
  if (!v(o.Gx, o.Gy))
3959
3959
  throw new Error("bad curve params: generator point");
3960
- const T = t.mul(t.pow(o.a, We), Jr), R = t.mul(t.sqr(o.b), BigInt(27));
3960
+ const T = t.mul(t.pow(o.a, qe), Jr), R = t.mul(t.sqr(o.b), BigInt(27));
3961
3961
  if (t.is0(t.add(T, R)))
3962
3962
  throw new Error("bad curve params: a or b");
3963
3963
  function F(M, g, m = !1) {
@@ -3986,7 +3986,7 @@ function Zr(r, e = {}) {
3986
3986
  if (!t.eql(S, t.ONE))
3987
3987
  throw new Error("invZ was invalid");
3988
3988
  return { x: w, y };
3989
- }), Q = Ft((M) => {
3989
+ }), Z = Ft((M) => {
3990
3990
  if (M.is0()) {
3991
3991
  if (e.allowInfinityPoint && !t.is0(M.Y))
3992
3992
  return;
@@ -4044,12 +4044,12 @@ function Zr(r, e = {}) {
4044
4044
  * @returns
4045
4045
  */
4046
4046
  precompute(g = 8, m = !0) {
4047
- return U.createCache(this, g), m || this.multiply(We), this;
4047
+ return U.createCache(this, g), m || this.multiply(qe), this;
4048
4048
  }
4049
4049
  // TODO: return `this`
4050
4050
  /** A point on curve is valid if it conforms to equation. */
4051
4051
  assertValidity() {
4052
- Q(this);
4052
+ Z(this);
4053
4053
  }
4054
4054
  hasEvenY() {
4055
4055
  const { y: g } = this.toAffine();
@@ -4072,7 +4072,7 @@ function Zr(r, e = {}) {
4072
4072
  // https://eprint.iacr.org/2015/1060, algorithm 3
4073
4073
  // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
4074
4074
  double() {
4075
- const { a: g, b: m } = o, A = t.mul(m, We), { X: O, Y: L, Z: w } = this;
4075
+ const { a: g, b: m } = o, A = t.mul(m, qe), { X: O, Y: L, Z: w } = this;
4076
4076
  let y = t.ZERO, S = t.ZERO, I = t.ZERO, k = t.mul(O, O), H = t.mul(L, L), B = t.mul(w, w), N = t.mul(O, L);
4077
4077
  return N = t.add(N, N), I = t.mul(O, w), I = t.add(I, I), y = t.mul(g, I), S = t.mul(A, B), S = t.add(y, S), y = t.sub(H, S), S = t.add(H, S), S = t.mul(y, S), y = t.mul(N, y), I = t.mul(A, I), B = t.mul(g, B), N = t.sub(k, B), N = t.mul(g, N), N = t.add(N, I), I = t.add(k, k), k = t.add(I, k), k = t.add(k, B), k = t.mul(k, N), S = t.add(S, k), B = t.mul(L, w), B = t.add(B, B), k = t.mul(B, N), y = t.sub(y, k), I = t.mul(B, H), I = t.add(I, I), I = t.add(I, I), new C(y, S, I);
4078
4078
  }
@@ -4084,7 +4084,7 @@ function Zr(r, e = {}) {
4084
4084
  $(g);
4085
4085
  const { X: m, Y: A, Z: O } = this, { X: L, Y: w, Z: y } = g;
4086
4086
  let S = t.ZERO, I = t.ZERO, k = t.ZERO;
4087
- const H = o.a, B = t.mul(o.b, We);
4087
+ const H = o.a, B = t.mul(o.b, qe);
4088
4088
  let N = t.mul(m, L), W = t.mul(A, w), j = t.mul(O, y), ie = t.add(m, A), z = t.add(L, w);
4089
4089
  ie = t.mul(ie, z), z = t.add(N, W), ie = t.sub(ie, z), z = t.add(m, O);
4090
4090
  let te = t.add(L, y);
@@ -4131,7 +4131,7 @@ function Zr(r, e = {}) {
4131
4131
  throw new Error("invalid scalar: out of range");
4132
4132
  if (g === ge || A.is0())
4133
4133
  return C.ZERO;
4134
- if (g === Pe)
4134
+ if (g === Ce)
4135
4135
  return A;
4136
4136
  if (U.hasCache(this))
4137
4137
  return this.multiply(g);
@@ -4154,20 +4154,20 @@ function Zr(r, e = {}) {
4154
4154
  */
4155
4155
  isTorsionFree() {
4156
4156
  const { isTorsionFree: g } = e;
4157
- return i === Pe ? !0 : g ? g(C, this) : U.unsafe(this, a).is0();
4157
+ return i === Ce ? !0 : g ? g(C, this) : U.unsafe(this, a).is0();
4158
4158
  }
4159
4159
  clearCofactor() {
4160
4160
  const { clearCofactor: g } = e;
4161
- return i === Pe ? this : g ? g(C, this) : this.multiplyUnsafe(i);
4161
+ return i === Ce ? this : g ? g(C, this) : this.multiplyUnsafe(i);
4162
4162
  }
4163
4163
  isSmallOrder() {
4164
4164
  return this.multiplyUnsafe(i).is0();
4165
4165
  }
4166
4166
  toBytes(g = !0) {
4167
- return ze(g, "isCompressed"), this.assertValidity(), p(C, this, g);
4167
+ return ze(g, "isCompressed"), this.assertValidity(), h(C, this, g);
4168
4168
  }
4169
4169
  toHex(g = !0) {
4170
- return Ue(this.toBytes(g));
4170
+ return He(this.toBytes(g));
4171
4171
  }
4172
4172
  toString() {
4173
4173
  return `<Point ${this.is0() ? "ZERO" : this.toHex()}>`;
@@ -4180,7 +4180,7 @@ function Zr(r, e = {}) {
4180
4180
  P(C, "Fp", t), // scalar field
4181
4181
  P(C, "Fn", n);
4182
4182
  let X = C;
4183
- const ee = n.BITS, U = new Kr(X, e.endo ? Math.ceil(ee / 2) : ee);
4183
+ const Q = n.BITS, U = new Kr(X, e.endo ? Math.ceil(Q / 2) : Q);
4184
4184
  return X.BASE.precompute(8), X;
4185
4185
  }
4186
4186
  function Os(r) {
@@ -4197,42 +4197,42 @@ function Ps(r, e) {
4197
4197
  }
4198
4198
  function Qr(r, e = {}) {
4199
4199
  const { Fn: s } = r, t = e.randomBytes || ds, n = Object.assign(Ps(r.Fp, s), { seed: Es(s.ORDER) });
4200
- function o(p) {
4200
+ function o(h) {
4201
4201
  try {
4202
- const b = s.fromBytes(p);
4202
+ const b = s.fromBytes(h);
4203
4203
  return s.isValidNot0(b);
4204
4204
  } catch {
4205
4205
  return !1;
4206
4206
  }
4207
4207
  }
4208
- function i(p, b) {
4208
+ function i(h, b) {
4209
4209
  const { publicKey: E, publicKeyUncompressed: v } = n;
4210
4210
  try {
4211
- const T = p.length;
4212
- return b === !0 && T !== E || b === !1 && T !== v ? !1 : !!r.fromBytes(p);
4211
+ const T = h.length;
4212
+ return b === !0 && T !== E || b === !1 && T !== v ? !1 : !!r.fromBytes(h);
4213
4213
  } catch {
4214
4214
  return !1;
4215
4215
  }
4216
4216
  }
4217
- function a(p = t(n.seed)) {
4218
- return qr(V(p, n.seed, "seed"), s.ORDER);
4217
+ function a(h = t(n.seed)) {
4218
+ return qr(V(h, n.seed, "seed"), s.ORDER);
4219
4219
  }
4220
- function c(p, b = !0) {
4221
- return r.BASE.multiply(s.fromBytes(p)).toBytes(b);
4220
+ function c(h, b = !0) {
4221
+ return r.BASE.multiply(s.fromBytes(h)).toBytes(b);
4222
4222
  }
4223
- function l(p) {
4223
+ function l(h) {
4224
4224
  const { secretKey: b, publicKey: E, publicKeyUncompressed: v } = n;
4225
- if (!xt(p) || "_lengths" in s && s._lengths || b === E)
4225
+ if (!xt(h) || "_lengths" in s && s._lengths || b === E)
4226
4226
  return;
4227
- const T = V(p, void 0, "key").length;
4227
+ const T = V(h, void 0, "key").length;
4228
4228
  return T === E || T === v;
4229
4229
  }
4230
- function u(p, b, E = !0) {
4231
- if (l(p) === !0)
4230
+ function u(h, b, E = !0) {
4231
+ if (l(h) === !0)
4232
4232
  throw new Error("first arg must be private key");
4233
4233
  if (l(b) === !1)
4234
4234
  throw new Error("second arg must be public key");
4235
- const v = s.fromBytes(p);
4235
+ const v = s.fromBytes(h);
4236
4236
  return r.fromBytes(b).multiply(v).toBytes(E);
4237
4237
  }
4238
4238
  const f = {
@@ -4250,14 +4250,14 @@ function en(r, e, s = {}) {
4250
4250
  bits2int: "function",
4251
4251
  bits2int_modN: "function"
4252
4252
  }), s = Object.assign({}, s);
4253
- const t = s.randomBytes || ds, n = s.hmac || ((g, m) => ks(e, g, m)), { Fp: o, Fn: i } = r, { ORDER: a, BITS: c } = i, { keygen: l, getPublicKey: u, getSharedSecret: f, utils: _, lengths: p } = Qr(r, s), b = {
4253
+ const t = s.randomBytes || ds, n = s.hmac || ((g, m) => ks(e, g, m)), { Fp: o, Fn: i } = r, { ORDER: a, BITS: c } = i, { keygen: l, getPublicKey: u, getSharedSecret: f, utils: _, lengths: h } = Qr(r, s), b = {
4254
4254
  prehash: !0,
4255
4255
  lowS: typeof s.lowS == "boolean" ? s.lowS : !0,
4256
4256
  format: "compact",
4257
4257
  extraEntropy: !1
4258
4258
  }, E = a * Rs < o.ORDER;
4259
4259
  function v(g) {
4260
- const m = a >> Pe;
4260
+ const m = a >> Ce;
4261
4261
  return g > m;
4262
4262
  }
4263
4263
  function T(g, m) {
@@ -4271,7 +4271,7 @@ function en(r, e, s = {}) {
4271
4271
  }
4272
4272
  function F(g, m) {
4273
4273
  pt(m);
4274
- const A = p.signature, O = m === "compact" ? A : m === "recovered" ? A + 1 : void 0;
4274
+ const A = h.signature, O = m === "compact" ? A : m === "recovered" ? A + 1 : void 0;
4275
4275
  return V(g, O);
4276
4276
  }
4277
4277
  class $ {
@@ -4294,7 +4294,7 @@ function en(r, e, s = {}) {
4294
4294
  return new $(S, I);
4295
4295
  }
4296
4296
  A === "recovered" && (O = m[0], A = "compact", m = m.subarray(1));
4297
- const L = p.signature / 2, w = m.subarray(0, L), y = m.subarray(L, L * 2);
4297
+ const L = h.signature / 2, w = m.subarray(0, L), y = m.subarray(L, L * 2);
4298
4298
  return new $(i.fromBytes(w), i.fromBytes(y), O);
4299
4299
  }
4300
4300
  static fromHex(m, A) {
@@ -4329,7 +4329,7 @@ function en(r, e, s = {}) {
4329
4329
  return m === "recovered" ? (R(), ve(Uint8Array.of(this.assertRecovery()), L, w)) : ve(L, w);
4330
4330
  }
4331
4331
  toHex(m) {
4332
- return Ue(this.toBytes(m));
4332
+ return He(this.toBytes(m));
4333
4333
  }
4334
4334
  }
4335
4335
  const K = s.bits2int || function(m) {
@@ -4339,14 +4339,14 @@ function en(r, e, s = {}) {
4339
4339
  return O > 0 ? A >> BigInt(O) : A;
4340
4340
  }, q = s.bits2int_modN || function(m) {
4341
4341
  return i.create(K(m));
4342
- }, Q = wt(c);
4342
+ }, Z = wt(c);
4343
4343
  function G(g) {
4344
- return Pr("num < 2^" + c, g, ge, Q), i.toBytes(g);
4344
+ return Pr("num < 2^" + c, g, ge, Z), i.toBytes(g);
4345
4345
  }
4346
4346
  function X(g, m) {
4347
4347
  return V(g, void 0, "message"), m ? V(e(g), void 0, "prehashed message") : g;
4348
4348
  }
4349
- function ee(g, m, A) {
4349
+ function Q(g, m, A) {
4350
4350
  const { lowS: O, prehash: L, extraEntropy: w } = it(A, b);
4351
4351
  g = X(g, L);
4352
4352
  const y = q(g), S = i.fromBytes(m);
@@ -4354,7 +4354,7 @@ function en(r, e, s = {}) {
4354
4354
  throw new Error("invalid private key");
4355
4355
  const I = [G(S), G(y)];
4356
4356
  if (w != null && w !== !1) {
4357
- const N = w === !0 ? t(p.secretKey) : w;
4357
+ const N = w === !0 ? t(h.secretKey) : w;
4358
4358
  I.push(V(N, void 0, "extraEntropy"));
4359
4359
  }
4360
4360
  const k = ve(...I), H = y;
@@ -4368,13 +4368,13 @@ function en(r, e, s = {}) {
4368
4368
  const te = i.create(j * i.create(H + z * S));
4369
4369
  if (te === ge)
4370
4370
  return;
4371
- let It = (ie.x === z ? 0 : 2) | Number(ie.y & Pe), At = te;
4371
+ let It = (ie.x === z ? 0 : 2) | Number(ie.y & Ce), At = te;
4372
4372
  return O && v(te) && (At = i.neg(te), It ^= 1), new $(z, At, E ? void 0 : It);
4373
4373
  }
4374
4374
  return { seed: k, k2sig: B };
4375
4375
  }
4376
4376
  function U(g, m, A = {}) {
4377
- const { seed: O, k2sig: L } = ee(g, m, A);
4377
+ const { seed: O, k2sig: L } = Q(g, m, A);
4378
4378
  return Nr(e.outputLen, i.BYTES, n)(O, L).toBytes(A.format);
4379
4379
  }
4380
4380
  function C(g, m, A, O = {}) {
@@ -4403,7 +4403,7 @@ function en(r, e, s = {}) {
4403
4403
  getPublicKey: u,
4404
4404
  getSharedSecret: f,
4405
4405
  utils: _,
4406
- lengths: p,
4406
+ lengths: h,
4407
4407
  Point: r,
4408
4408
  sign: U,
4409
4409
  verify: C,
@@ -4429,7 +4429,7 @@ const St = {
4429
4429
  ]
4430
4430
  }, Yt = /* @__PURE__ */ BigInt(2);
4431
4431
  function sn(r) {
4432
- const e = St.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), o = BigInt(22), i = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, u = l * l * r % e, f = ce(u, s, e) * u % e, _ = ce(f, s, e) * u % e, p = ce(_, Yt, e) * l % e, b = ce(p, n, e) * p % e, E = ce(b, o, e) * b % e, v = ce(E, a, e) * E % e, T = ce(v, c, e) * v % e, R = ce(T, a, e) * E % e, F = ce(R, s, e) * u % e, $ = ce(F, i, e) * b % e, K = ce($, t, e) * l % e, q = ce(K, Yt, e);
4432
+ const e = St.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), o = BigInt(22), i = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, u = l * l * r % e, f = ce(u, s, e) * u % e, _ = ce(f, s, e) * u % e, h = ce(_, Yt, e) * l % e, b = ce(h, n, e) * h % e, E = ce(b, o, e) * b % e, v = ce(E, a, e) * E % e, T = ce(v, c, e) * v % e, R = ce(T, a, e) * E % e, F = ce(R, s, e) * u % e, $ = ce(F, i, e) * b % e, K = ce($, t, e) * l % e, q = ce(K, Yt, e);
4433
4433
  if (!ft.eql(ft.sqr(q), r))
4434
4434
  throw new Error("Cannot find square root");
4435
4435
  return q;
@@ -4437,12 +4437,12 @@ function sn(r) {
4437
4437
  const ft = Ze(St.p, { sqrt: sn }), rn = /* @__PURE__ */ Zr(St, {
4438
4438
  Fp: ft,
4439
4439
  endo: tn
4440
- }), nn = /* @__PURE__ */ en(rn, kr), on = BigInt(0), Me = BigInt(1), an = BigInt(2), cn = BigInt(7), ln = BigInt(256), dn = BigInt(113), Cs = [], Ns = [], Ls = [];
4441
- for (let r = 0, e = Me, s = 1, t = 0; r < 24; r++) {
4440
+ }), nn = /* @__PURE__ */ en(rn, kr), on = BigInt(0), $e = BigInt(1), an = BigInt(2), cn = BigInt(7), ln = BigInt(256), dn = BigInt(113), Cs = [], Ns = [], Ls = [];
4441
+ for (let r = 0, e = $e, s = 1, t = 0; r < 24; r++) {
4442
4442
  [s, t] = [t, (2 * s + 3 * t) % 5], Cs.push(2 * (5 * t + s)), Ns.push((r + 1) * (r + 2) / 2 % 64);
4443
4443
  let n = on;
4444
4444
  for (let o = 0; o < 7; o++)
4445
- e = (e << Me ^ (e >> cn) * dn) % ln, e & an && (n ^= Me << (Me << BigInt(o)) - Me);
4445
+ e = (e << $e ^ (e >> cn) * dn) % ln, e & an && (n ^= $e << ($e << BigInt(o)) - $e);
4446
4446
  Ls.push(n);
4447
4447
  }
4448
4448
  const Ds = yr(Ls, !0), un = Ds[0], hn = Ds[1], Xt = (r, e, s) => s > 32 ? vr(r, e, s) : br(r, e, s), Jt = (r, e, s) => s > 32 ? Er(r, e, s) : Sr(r, e, s);
@@ -4453,8 +4453,8 @@ function pn(r, e = 24) {
4453
4453
  s[i] = r[i] ^ r[i + 10] ^ r[i + 20] ^ r[i + 30] ^ r[i + 40];
4454
4454
  for (let i = 0; i < 10; i += 2) {
4455
4455
  const a = (i + 8) % 10, c = (i + 2) % 10, l = s[c], u = s[c + 1], f = Xt(l, u, 1) ^ s[a], _ = Jt(l, u, 1) ^ s[a + 1];
4456
- for (let p = 0; p < 50; p += 10)
4457
- r[i + p] ^= f, r[i + p + 1] ^= _;
4456
+ for (let h = 0; h < 50; h += 10)
4457
+ r[i + h] ^= f, r[i + h + 1] ^= _;
4458
4458
  }
4459
4459
  let n = r[2], o = r[3];
4460
4460
  for (let i = 0; i < 24; i++) {
@@ -4469,7 +4469,7 @@ function pn(r, e = 24) {
4469
4469
  }
4470
4470
  r[0] ^= un[t], r[1] ^= hn[t];
4471
4471
  }
4472
- Ne(s);
4472
+ Le(s);
4473
4473
  }
4474
4474
  class vt {
4475
4475
  // NOTE: we accept arguments in bytes instead of bits here.
@@ -4496,7 +4496,7 @@ class vt {
4496
4496
  Bt(this.state32), pn(this.state32, this.rounds), Bt(this.state32), this.posOut = 0, this.pos = 0;
4497
4497
  }
4498
4498
  update(e) {
4499
- Ce(this), V(e);
4499
+ Ne(this), V(e);
4500
4500
  const { blockLen: s, state: t } = this, n = e.length;
4501
4501
  for (let o = 0; o < n; ) {
4502
4502
  const i = Math.min(s - this.pos, n - o);
@@ -4514,7 +4514,7 @@ class vt {
4514
4514
  e[t] ^= s, s & 128 && t === n - 1 && this.keccak(), e[n - 1] ^= 128, this.keccak();
4515
4515
  }
4516
4516
  writeInto(e) {
4517
- Ce(this, !1), V(e), this.finish();
4517
+ Ne(this, !1), V(e), this.finish();
4518
4518
  const s = this.state, { blockLen: t } = this;
4519
4519
  for (let n = 0, o = e.length; n < o; ) {
4520
4520
  this.posOut >= t && this.keccak();
@@ -4540,7 +4540,7 @@ class vt {
4540
4540
  return this.digestInto(new Uint8Array(this.outputLen));
4541
4541
  }
4542
4542
  destroy() {
4543
- this.destroyed = !0, Ne(this.state);
4543
+ this.destroyed = !0, Le(this.state);
4544
4544
  }
4545
4545
  _cloneInto(e) {
4546
4546
  const { blockLen: s, suffix: t, outputLen: n, rounds: o, enableXOF: i } = this;
@@ -4619,7 +4619,7 @@ ${t.length}`
4619
4619
  Qt(l),
4620
4620
  Qt(u)
4621
4621
  ).addRecoveryBit(_).recoverPublicKey(i).toBytes(!1).slice(1), v = Zt(E);
4622
- return "0x" + Ue(v.slice(12));
4622
+ return "0x" + He(v.slice(12));
4623
4623
  }
4624
4624
  }
4625
4625
  function gn(r) {
@@ -4763,7 +4763,7 @@ class Ie {
4763
4763
  t(new Error("팝업 창을 열 수 없습니다. 팝업 차단을 해제해 주세요."));
4764
4764
  return;
4765
4765
  }
4766
- const p = setTimeout(() => {
4766
+ const h = setTimeout(() => {
4767
4767
  d.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), $(), t(new Error("Authentication timeout"));
4768
4768
  }, 5 * 60 * 1e3), b = 10, E = 30;
4769
4769
  let v = 0, T = null;
@@ -4781,7 +4781,7 @@ class Ie {
4781
4781
  R();
4782
4782
  }
4783
4783
  }, 1e3), $ = () => {
4784
- clearTimeout(p), clearInterval(F), T && clearTimeout(T), window.removeEventListener("message", K);
4784
+ clearTimeout(h), clearInterval(F), T && clearTimeout(T), window.removeEventListener("message", K);
4785
4785
  }, K = (q) => {
4786
4786
  if (q.origin !== e.expectedOrigin) return;
4787
4787
  if (!bn.has(q.origin)) {
@@ -4789,28 +4789,28 @@ class Ie {
4789
4789
  return;
4790
4790
  }
4791
4791
  $();
4792
- const Q = typeof q.data.status == "string", G = Q ? q.data.data ?? {} : q.data;
4792
+ const Z = typeof q.data.status == "string", G = Z ? q.data.data ?? {} : q.data;
4793
4793
  d.log("[CROSSx] OAuth postMessage 수신 —", {
4794
- format: Q ? "wrapped" : "flat",
4795
- status: Q ? q.data.status : "(flat)"
4794
+ format: Z ? "wrapped" : "flat",
4795
+ status: Z ? q.data.status : "(flat)"
4796
4796
  });
4797
4797
  const X = (G == null ? void 0 : G.state) ?? q.data.state;
4798
4798
  if (!X || X !== c) {
4799
4799
  t(new Error("OAuth state mismatch — possible CSRF attack"));
4800
4800
  return;
4801
4801
  }
4802
- if (Q && q.data.status !== "success") {
4802
+ if (Z && q.data.status !== "success") {
4803
4803
  d.error("[CROSSx] OAuth 실패:", G == null ? void 0 : G.error), t(new Error((G == null ? void 0 : G.error) || "Authentication failed"));
4804
4804
  return;
4805
4805
  }
4806
- if (!Q && (G != null && G.error)) {
4806
+ if (!Z && (G != null && G.error)) {
4807
4807
  d.error("[CROSSx] OAuth 실패:", G.error), t(new Error(G.error || "Authentication failed"));
4808
4808
  return;
4809
4809
  }
4810
- const ee = G == null ? void 0 : G.idToken, U = G == null ? void 0 : G.accessToken, C = U ?? ee, M = (G == null ? void 0 : G.email) || void 0;
4810
+ const Q = G == null ? void 0 : G.idToken, U = G == null ? void 0 : G.accessToken, C = U ?? Q, M = (G == null ? void 0 : G.email) || void 0;
4811
4811
  if (d.log("[CROSSx] OAuth 토큰 수신:", {
4812
4812
  hasAccessToken: !!U,
4813
- hasIdToken: !!ee,
4813
+ hasIdToken: !!Q,
4814
4814
  hasEmail: !!M
4815
4815
  }), !C) {
4816
4816
  d.error("[CROSSx] 토큰을 찾을 수 없음:", q.data), t(new Error("Token not found in response"));
@@ -4821,16 +4821,16 @@ class Ie {
4821
4821
  d.error("[CROSSx] nonce 검증 실패:", O), t(O instanceof Error ? O : new Error("nonce verification failed"));
4822
4822
  });
4823
4823
  };
4824
- U ? U.split(".").length === 3 ? m(U) : ee ? m(ee) : (d.warn(
4824
+ U ? U.split(".").length === 3 ? m(U) : Q ? m(Q) : (d.warn(
4825
4825
  "[CROSSx] opaque accessToken만 수신 (idToken 없음) — nonce 검증 불가.",
4826
4826
  "서버 측 nonce 검증이 필요합니다."
4827
- ), s(g)) : ee ? m(ee) : t(new Error("Token not found in response"));
4827
+ ), s(g)) : Q ? m(Q) : t(new Error("Token not found in response"));
4828
4828
  };
4829
4829
  window.addEventListener("message", K);
4830
4830
  });
4831
4831
  }
4832
4832
  }
4833
- const $e = "crossx_wallet_data", Re = "crossx_mock_pin_hash";
4833
+ const Be = "crossx_wallet_data", Re = "crossx_mock_pin_hash";
4834
4834
  class Sn {
4835
4835
  constructor(e, s) {
4836
4836
  this.storage = e, this.pinStore = s ?? null;
@@ -4844,13 +4844,13 @@ class Sn {
4844
4844
  async checkWallet() {
4845
4845
  if (this.migrateScenario !== void 0)
4846
4846
  return d.log("[Mock] checkWallet → migration_required"), "migration_required";
4847
- const s = await this.storage.get($e) ? "exists" : "not_found";
4847
+ const s = await this.storage.get(Be) ? "exists" : "not_found";
4848
4848
  return d.log(`[Mock] checkWallet → ${s}`), s;
4849
4849
  }
4850
4850
  async getOrCreateWallet(e) {
4851
4851
  var s;
4852
4852
  try {
4853
- const t = await this.storage.get($e);
4853
+ const t = await this.storage.get(Be);
4854
4854
  if (t) return t;
4855
4855
  const n = {
4856
4856
  id: e,
@@ -4858,16 +4858,16 @@ class Sn {
4858
4858
  derivationPath: "m/44'/60'/0'/0/0",
4859
4859
  createdAt: Date.now()
4860
4860
  };
4861
- await this.storage.set($e, n);
4861
+ await this.storage.set(Be, n);
4862
4862
  const o = (s = this.pinStore) == null ? void 0 : s.get();
4863
4863
  return o && (await this.storage.set(Re, o), d.log("[Mock] 지갑 생성 — PIN 저장됨")), n;
4864
4864
  } catch (t) {
4865
- throw new x(h.WALLET_CREATION_FAILED, "지갑 생성에 실패했습니다", t);
4865
+ throw new x(p.WALLET_CREATION_FAILED, "지갑 생성에 실패했습니다", t);
4866
4866
  }
4867
4867
  }
4868
4868
  /** GET /mnemonic/addresses 모킹 — PIN 불필요, 캐시된 주소 반환 */
4869
4869
  async getAddresses(e) {
4870
- const s = await this.storage.get($e);
4870
+ const s = await this.storage.get(Be);
4871
4871
  return s ? [{ address: s.address, index: 0 }] : [];
4872
4872
  }
4873
4873
  async getAddress(e, s) {
@@ -4912,16 +4912,16 @@ class Sn {
4912
4912
  async changePin(e, s) {
4913
4913
  var o;
4914
4914
  if (d.log("[Mock] changePin"), this.pinScenario === "wrong")
4915
- throw new x(h.PIN_WRONG, "Incorrect PIN.");
4915
+ throw new x(p.PIN_WRONG, "Incorrect PIN.");
4916
4916
  const t = (o = this.pinStore) == null ? void 0 : o.get(), n = await this.storage.get(Re);
4917
4917
  if (n && t && n !== t)
4918
- throw new x(h.PIN_WRONG, "Incorrect PIN.");
4918
+ throw new x(p.PIN_WRONG, "Incorrect PIN.");
4919
4919
  await this.storage.set(Re, s), d.log("[Mock] changePin 완료");
4920
4920
  }
4921
4921
  async migrateWallet(e, s) {
4922
4922
  var o;
4923
4923
  if (d.log(`[Mock] migrateWallet pin=${e} sub=${s}`), this.migrateScenario === "wrong_pin")
4924
- throw new x(h.MIGRATION_FAILED, "Incorrect PIN.", {
4924
+ throw new x(p.MIGRATION_FAILED, "Incorrect PIN.", {
4925
4925
  permanent: !1,
4926
4926
  lockExpiresAt: 0,
4927
4927
  remainingAttempts: 4,
@@ -4936,7 +4936,7 @@ class Sn {
4936
4936
  ...this.migrateScenario.locked
4937
4937
  };
4938
4938
  throw new x(
4939
- h.MIGRATION_PIN_LOCKED,
4939
+ p.MIGRATION_PIN_LOCKED,
4940
4940
  "Too many incorrect PIN attempts. Your account has been temporarily locked.",
4941
4941
  a
4942
4942
  );
@@ -4947,7 +4947,7 @@ class Sn {
4947
4947
  derivationPath: "m/44'/60'/0'/0/0",
4948
4948
  createdAt: Date.now()
4949
4949
  };
4950
- await this.storage.set($e, t);
4950
+ await this.storage.set(Be, t);
4951
4951
  const n = (o = this.pinStore) == null ? void 0 : o.get();
4952
4952
  return n && (await this.storage.set(Re, n), d.log("[Mock] 마이그레이션 — PIN 저장됨")), t;
4953
4953
  }
@@ -5013,14 +5013,14 @@ class Ae {
5013
5013
  }
5014
5014
  if (s)
5015
5015
  throw new x(
5016
- h.SESSION_EXPIRED,
5016
+ p.SESSION_EXPIRED,
5017
5017
  "인증 세션이 만료되었습니다. 다시 로그인해 주세요."
5018
5018
  );
5019
5019
  }
5020
5020
  if (e)
5021
5021
  return d.warn("[CROSSx] 토큰 갱신 실패 — 기존 토큰으로 요청 시도"), e;
5022
5022
  throw new x(
5023
- h.SESSION_EXPIRED,
5023
+ p.SESSION_EXPIRED,
5024
5024
  "인증 세션이 만료되었습니다. 다시 로그인해 주세요."
5025
5025
  );
5026
5026
  }
@@ -5038,46 +5038,46 @@ class Ae {
5038
5038
  "X-Project-Id": this.projectId
5039
5039
  };
5040
5040
  try {
5041
- const p = (await this.transport.request({
5041
+ const h = (await this.transport.request({
5042
5042
  url: i,
5043
5043
  method: e,
5044
5044
  headers: a,
5045
5045
  body: t ?? void 0
5046
5046
  })).data;
5047
- if (p && typeof p.code == "number") {
5048
- if (p.code < 0 || p.code >= 400) {
5049
- const b = p.message || p.data || "API 요청에 실패했습니다";
5047
+ if (h && typeof h.code == "number") {
5048
+ if (h.code < 0 || h.code >= 400) {
5049
+ const b = h.message || h.data || "API 요청에 실패했습니다";
5050
5050
  d.error("[CROSSx] Wallet Gateway API 에러 (HTTP 200):", {
5051
- code: p.code,
5051
+ code: h.code,
5052
5052
  message: b,
5053
5053
  url: i,
5054
5054
  method: e
5055
5055
  });
5056
- const E = Ae.mapGatewayError(p.code, p.data);
5057
- if (E === h.AUTH_NOT_AUTHENTICATED && !n && this._onTokenRefresh) {
5056
+ const E = Ae.mapGatewayError(h.code, h.data);
5057
+ if (E === p.AUTH_NOT_AUTHENTICATED && !n && this._onTokenRefresh) {
5058
5058
  if (d.warn("[CROSSx] Gateway -10002 감지 — 토큰 갱신 후 재시도"), await this.deduplicatedRefresh())
5059
5059
  return this.request(e, s, t, !0);
5060
- throw new x(h.SESSION_EXPIRED, "인증 세션이 만료되었습니다. 다시 로그인해 주세요.");
5060
+ throw new x(p.SESSION_EXPIRED, "인증 세션이 만료되었습니다. 다시 로그인해 주세요.");
5061
5061
  }
5062
- if (E === h.USER_NOT_FOUND)
5062
+ if (E === p.USER_NOT_FOUND)
5063
5063
  throw d.warn("[CROSSx] Gateway -10033 감지 — 유저 미존재, 강제 로그아웃"), (c = this._onUnauthorized) == null || c.call(this), new x(
5064
- h.USER_NOT_FOUND,
5065
- Ae.getGatewayErrorMessage(p.code, b)
5064
+ p.USER_NOT_FOUND,
5065
+ Ae.getGatewayErrorMessage(h.code, b)
5066
5066
  );
5067
- const v = E === h.AUTH_NOT_AUTHENTICATED ? h.SESSION_EXPIRED : E, T = v === h.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : Ae.getGatewayErrorMessage(p.code, b), R = p.data, F = E === h.PIN_LOCKED ? Ae.extractLockDetails(R) : R ?? void 0;
5067
+ const v = E === p.AUTH_NOT_AUTHENTICATED ? p.SESSION_EXPIRED : E, T = v === p.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : Ae.getGatewayErrorMessage(h.code, b), R = h.data, F = E === p.PIN_LOCKED ? Ae.extractLockDetails(R) : R ?? void 0;
5068
5068
  throw new x(v, T, F);
5069
5069
  }
5070
- return d.log("[CROSSx] Wallet Gateway API 성공:", { code: p.code, url: i, method: e }), p.data ?? p;
5070
+ return d.log("[CROSSx] Wallet Gateway API 성공:", { code: h.code, url: i, method: e }), h.data ?? h;
5071
5071
  }
5072
- return p;
5072
+ return h;
5073
5073
  } catch (_) {
5074
5074
  if (_ instanceof x) throw _;
5075
- const p = ((l = _.response) == null ? void 0 : l.status) ?? _.status;
5076
- if ((p === 401 || p === 403) && !n && this._onTokenRefresh) {
5077
- if (d.warn(`[CROSSx] HTTP ${p} 감지 — 토큰 갱신 후 재시도`), await this.deduplicatedRefresh())
5075
+ const h = ((l = _.response) == null ? void 0 : l.status) ?? _.status;
5076
+ if ((h === 401 || h === 403) && !n && this._onTokenRefresh) {
5077
+ if (d.warn(`[CROSSx] HTTP ${h} 감지 — 토큰 갱신 후 재시도`), await this.deduplicatedRefresh())
5078
5078
  return this.request(e, s, t, !0);
5079
5079
  throw new x(
5080
- h.SESSION_EXPIRED,
5080
+ p.SESSION_EXPIRED,
5081
5081
  "인증 세션이 만료되었습니다. 다시 로그인해 주세요."
5082
5082
  );
5083
5083
  }
@@ -5090,7 +5090,7 @@ class Ae {
5090
5090
  method: e,
5091
5091
  status: (f = _.response) == null ? void 0 : f.status
5092
5092
  }), new x(
5093
- h.UNKNOWN_ERROR,
5093
+ p.UNKNOWN_ERROR,
5094
5094
  `Wallet Gateway 오류 (${v}): ${E}`
5095
5095
  );
5096
5096
  }
@@ -5117,7 +5117,7 @@ class Ae {
5117
5117
  let s;
5118
5118
  if (this._walletStatusCache !== null ? (s = this._walletStatusCache, this._walletStatusCache = null, d.log("[CROSSx] getOrCreateWallet — 캐시된 상태 사용:", s)) : (d.log("[CROSSx] GET /mnemonic/check — 지갑 상태 확인"), s = await this.checkWallet(), this._walletStatusCache = null), s === "migration_required")
5119
5119
  throw d.log("[CROSSx] migration_required → MIGRATION_BACKUP_EXISTS throw"), new x(
5120
- h.MIGRATION_BACKUP_EXISTS,
5120
+ p.MIGRATION_BACKUP_EXISTS,
5121
5121
  "CROSSx 백업이 존재합니다. 마이그레이션을 진행해 주세요."
5122
5122
  );
5123
5123
  if (s === "exists") {
@@ -5159,15 +5159,15 @@ class Ae {
5159
5159
  switch (e) {
5160
5160
  case "sign":
5161
5161
  case "send":
5162
- if (!s.tx) throw new x(h.TX_INVALID_PARAMS, "prepare: tx가 필요합니다");
5162
+ if (!s.tx) throw new x(p.TX_INVALID_PARAMS, "prepare: tx가 필요합니다");
5163
5163
  t = { unsignedTx: this.buildUnsignedTx(s.tx) };
5164
5164
  break;
5165
5165
  case "sign-message":
5166
- if (!s.message) throw new x(h.TX_INVALID_PARAMS, "prepare: message가 필요합니다");
5166
+ if (!s.message) throw new x(p.TX_INVALID_PARAMS, "prepare: message가 필요합니다");
5167
5167
  t = { message: s.message }, s.from && (t.from = s.from);
5168
5168
  break;
5169
5169
  case "sign-typed-data":
5170
- if (!s.typedData) throw new x(h.TX_INVALID_PARAMS, "prepare: typedData가 필요합니다");
5170
+ if (!s.typedData) throw new x(p.TX_INVALID_PARAMS, "prepare: typedData가 필요합니다");
5171
5171
  t = { typedData: s.typedData }, s.from && (t.from = s.from);
5172
5172
  break;
5173
5173
  }
@@ -5256,7 +5256,7 @@ class Ae {
5256
5256
  if (!t.valid && t.passwordStatus) {
5257
5257
  const n = t.passwordStatus;
5258
5258
  if (n.permanent)
5259
- throw new x(h.PIN_LOCKED, "Incorrect PIN.", {
5259
+ throw new x(p.PIN_LOCKED, "Incorrect PIN.", {
5260
5260
  permanent: !0,
5261
5261
  lockExpiresAt: n.lockExpiresAt,
5262
5262
  remainingAttempts: 0,
@@ -5264,7 +5264,7 @@ class Ae {
5264
5264
  });
5265
5265
  if (n.remainingAttempts === 0 && n.lockExpiresAt) {
5266
5266
  const o = n.lockExpiresAt > 1e10 ? n.lockExpiresAt : n.lockExpiresAt * 1e3;
5267
- throw new x(h.PIN_LOCKED, "Too many failed PIN attempts.", {
5267
+ throw new x(p.PIN_LOCKED, "Too many failed PIN attempts.", {
5268
5268
  permanent: !1,
5269
5269
  lockExpiresAt: o,
5270
5270
  remainingAttempts: 0,
@@ -5272,7 +5272,7 @@ class Ae {
5272
5272
  });
5273
5273
  }
5274
5274
  if (n.remainingAttempts != null && n.remainingAttempts > 0)
5275
- throw new x(h.PIN_LOCKED, "Incorrect PIN.", {
5275
+ throw new x(p.PIN_LOCKED, "Incorrect PIN.", {
5276
5276
  permanent: !1,
5277
5277
  lockExpiresAt: 0,
5278
5278
  remainingAttempts: n.remainingAttempts,
@@ -5310,7 +5310,7 @@ class Ae {
5310
5310
  const e = this.getPin();
5311
5311
  if (!e)
5312
5312
  throw new x(
5313
- h.PIN_NOT_SET,
5313
+ p.PIN_NOT_SET,
5314
5314
  "PIN이 설정되지 않았습니다. PIN을 입력해 주세요."
5315
5315
  );
5316
5316
  return e;
@@ -5344,70 +5344,70 @@ class Ae {
5344
5344
  static mapGatewayError(e, s) {
5345
5345
  switch (e) {
5346
5346
  case -10002:
5347
- return h.AUTH_NOT_AUTHENTICATED;
5347
+ return p.AUTH_NOT_AUTHENTICATED;
5348
5348
  case -10001:
5349
- return h.UNKNOWN_ERROR;
5349
+ return p.UNKNOWN_ERROR;
5350
5350
  case -10006:
5351
- return h.GATEWAY_INTERNAL_ERROR;
5351
+ return p.GATEWAY_INTERNAL_ERROR;
5352
5352
  case -10007:
5353
- return h.BROADCAST_FAILED;
5353
+ return p.BROADCAST_FAILED;
5354
5354
  case -10008:
5355
- return h.GATEWAY_LOCK_CONFLICT;
5355
+ return p.GATEWAY_LOCK_CONFLICT;
5356
5356
  case -10004:
5357
- return h.WALLET_ALREADY_EXISTS;
5357
+ return p.WALLET_ALREADY_EXISTS;
5358
5358
  case -10005:
5359
- return h.WALLET_NOT_FOUND;
5359
+ return p.WALLET_NOT_FOUND;
5360
5360
  case -10011:
5361
- return h.WALLET_NOT_FOUND;
5361
+ return p.WALLET_NOT_FOUND;
5362
5362
  case -10030:
5363
- return h.WALLET_INCONSISTENT_STATE;
5363
+ return p.WALLET_INCONSISTENT_STATE;
5364
5364
  case -10010:
5365
- return h.MIGRATION_FAILED;
5365
+ return p.MIGRATION_FAILED;
5366
5366
  case -10012:
5367
- return h.MIGRATION_BACKUP_EXISTS;
5367
+ return p.MIGRATION_BACKUP_EXISTS;
5368
5368
  case -10013:
5369
- return h.WITHDRAW_FAILED;
5369
+ return p.WITHDRAW_FAILED;
5370
5370
  case -10033:
5371
- return h.USER_NOT_FOUND;
5371
+ return p.USER_NOT_FOUND;
5372
5372
  case -10027:
5373
- return h.MIGRATION_PIN_LOCKED;
5373
+ return p.MIGRATION_PIN_LOCKED;
5374
5374
  case -10022:
5375
- return h.PROJECT_NOT_REGISTERED;
5375
+ return p.PROJECT_NOT_REGISTERED;
5376
5376
  case -10023:
5377
- return h.PROJECT_ID_MISSING;
5377
+ return p.PROJECT_ID_MISSING;
5378
5378
  case -10024:
5379
- return h.ORIGIN_NOT_ALLOWED;
5379
+ return p.ORIGIN_NOT_ALLOWED;
5380
5380
  case -10025:
5381
- return h.INVALID_APP_TYPE;
5381
+ return p.INVALID_APP_TYPE;
5382
5382
  case -10028:
5383
- return Ae.hasLockInfo(s) ? h.PIN_LOCKED : h.PIN_WRONG;
5383
+ return Ae.hasLockInfo(s) ? p.PIN_LOCKED : p.PIN_WRONG;
5384
5384
  case -10029:
5385
- return h.PIN_INVALID;
5385
+ return p.PIN_INVALID;
5386
5386
  case -10031:
5387
- return h.PIN_LOCKED;
5387
+ return p.PIN_LOCKED;
5388
5388
  case -10032:
5389
- return h.PIN_REPEATED_PATTERN;
5389
+ return p.PIN_REPEATED_PATTERN;
5390
5390
  case -10026:
5391
- return h.TYPED_DATA_CHAIN_ID_MISMATCH;
5391
+ return p.TYPED_DATA_CHAIN_ID_MISMATCH;
5392
5392
  case -10014:
5393
5393
  case -10015:
5394
5394
  case -10019:
5395
- return h.PREPARE_FAILED;
5395
+ return p.PREPARE_FAILED;
5396
5396
  case -10016:
5397
- return h.PREPARE_EXPIRED;
5397
+ return p.PREPARE_EXPIRED;
5398
5398
  case -10017:
5399
5399
  case -10018:
5400
- return h.PREPARE_MISMATCH;
5400
+ return p.PREPARE_MISMATCH;
5401
5401
  case -10020:
5402
- return h.CHAIN_NOT_SUPPORTED;
5402
+ return p.CHAIN_NOT_SUPPORTED;
5403
5403
  case -10021:
5404
- return h.INVALID_CHAIN;
5404
+ return p.INVALID_CHAIN;
5405
5405
  case -10040:
5406
- return h.HMAC_REQUIRED;
5406
+ return p.HMAC_REQUIRED;
5407
5407
  case -10041:
5408
- return h.HMAC_VERIFICATION_FAILED;
5408
+ return p.HMAC_VERIFICATION_FAILED;
5409
5409
  default:
5410
- return h.UNKNOWN_ERROR;
5410
+ return p.UNKNOWN_ERROR;
5411
5411
  }
5412
5412
  }
5413
5413
  static getGatewayErrorMessage(e, s) {
@@ -5459,7 +5459,7 @@ class Ae {
5459
5459
  }
5460
5460
  }
5461
5461
  }
5462
- class Be {
5462
+ class Ue {
5463
5463
  constructor(e, s) {
5464
5464
  this.cache = /* @__PURE__ */ new Map(), this.loadedAt = 0, this.usingFallback = !1, this.adapterConfig = e, this.projectId = e.projectId, this.transport = s;
5465
5465
  }
@@ -5477,7 +5477,7 @@ class Be {
5477
5477
  const s = e.data.chains;
5478
5478
  return this.populateCache(s, !1), s;
5479
5479
  } catch {
5480
- const e = Be.fallbackChains();
5480
+ const e = Ue.fallbackChains();
5481
5481
  return this.populateCache(e, !0), e;
5482
5482
  }
5483
5483
  }
@@ -5513,18 +5513,18 @@ class Be {
5513
5513
  if (e.code < 0) {
5514
5514
  const s = typeof e.data == "string" ? e.data : e.message ?? "체인 레지스트리 요청에 실패했습니다";
5515
5515
  throw new x(
5516
- Be.mapErrorCode(e.code),
5516
+ Ue.mapErrorCode(e.code),
5517
5517
  s
5518
5518
  );
5519
5519
  }
5520
5520
  }
5521
5521
  fallbackOrThrow(e) {
5522
- const s = Be.fallbackChains().find(
5522
+ const s = Ue.fallbackChains().find(
5523
5523
  (t) => t.chainId === e
5524
5524
  );
5525
5525
  if (s) return s;
5526
5526
  throw new x(
5527
- h.CHAIN_NOT_SUPPORTED,
5527
+ p.CHAIN_NOT_SUPPORTED,
5528
5528
  `지원하지 않는 체인: ${e}`
5529
5529
  );
5530
5530
  }
@@ -5537,23 +5537,23 @@ class Be {
5537
5537
  static mapErrorCode(e) {
5538
5538
  switch (e) {
5539
5539
  case -10020:
5540
- return h.CHAIN_NOT_SUPPORTED;
5540
+ return p.CHAIN_NOT_SUPPORTED;
5541
5541
  case -10021:
5542
- return h.INVALID_CHAIN;
5542
+ return p.INVALID_CHAIN;
5543
5543
  case -10022:
5544
- return h.PROJECT_NOT_REGISTERED;
5544
+ return p.PROJECT_NOT_REGISTERED;
5545
5545
  case -10023:
5546
- return h.PROJECT_ID_MISSING;
5546
+ return p.PROJECT_ID_MISSING;
5547
5547
  case -10024:
5548
- return h.APP_IDENTIFIER_MISSING;
5548
+ return p.APP_IDENTIFIER_MISSING;
5549
5549
  case -10025:
5550
- return h.INVALID_APP_TYPE;
5550
+ return p.INVALID_APP_TYPE;
5551
5551
  default:
5552
- return h.UNKNOWN_ERROR;
5552
+ return p.UNKNOWN_ERROR;
5553
5553
  }
5554
5554
  }
5555
5555
  }
5556
- const es = "__crossx-confirm-style", Z = "__crossx-confirm-overlay", vn = {
5556
+ const es = "__crossx-confirm-style", ee = "__crossx-confirm-overlay", vn = {
5557
5557
  light: {
5558
5558
  bg: "#FFFFFF",
5559
5559
  border: "rgba(18,18,18,0.05)",
@@ -5645,7 +5645,7 @@ function ts(r, e) {
5645
5645
  const En = `
5646
5646
  @import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600&display=swap');
5647
5647
 
5648
- #${Z} {
5648
+ #${ee} {
5649
5649
  position: fixed;
5650
5650
  inset: 0;
5651
5651
  z-index: 2147483647;
@@ -6823,6 +6823,7 @@ const En = `
6823
6823
  .__crossx-wallet-item {
6824
6824
  display: flex;
6825
6825
  align-items: center;
6826
+ justify-content: space-between;
6826
6827
  gap: 8px;
6827
6828
  padding: 16px;
6828
6829
  background: var(--cx-pill-bg);
@@ -6835,6 +6836,7 @@ const En = `
6835
6836
  box-shadow: none;
6836
6837
  outline: none;
6837
6838
  width: 100%;
6839
+ text-align: left;
6838
6840
  font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
6839
6841
  }
6840
6842
  .__crossx-wallet-item:hover,
@@ -6847,28 +6849,28 @@ const En = `
6847
6849
  transform: none !important;
6848
6850
  background: var(--cx-pill-bg) !important;
6849
6851
  }
6850
- .__crossx-wallet-idx {
6851
- display: inline-flex;
6852
- align-items: center;
6853
- justify-content: center;
6854
- min-width: 24px;
6855
- height: 24px;
6856
- padding: 0 6px;
6857
- font-size: 12px;
6858
- font-weight: 700;
6859
- line-height: 1;
6860
- color: var(--cx-primary);
6861
- background: color-mix(in srgb, var(--cx-primary) 12%, transparent);
6862
- border-radius: 6px;
6863
- flex-shrink: 0;
6852
+ .__crossx-wallet-info {
6853
+ display: flex;
6854
+ flex-direction: column;
6855
+ align-items: flex-start;
6856
+ gap: 2px;
6857
+ min-width: 0;
6858
+ flex: 1;
6864
6859
  }
6865
- .__crossx-wallet-addr {
6860
+ .__crossx-wallet-idx {
6866
6861
  font-size: 16px;
6867
6862
  font-weight: 600;
6868
6863
  line-height: 1.3;
6869
6864
  color: var(--cx-value);
6870
6865
  white-space: nowrap;
6871
6866
  }
6867
+ .__crossx-wallet-addr {
6868
+ font-size: 13px;
6869
+ font-weight: 500;
6870
+ line-height: 1.3;
6871
+ color: var(--cx-label);
6872
+ white-space: nowrap;
6873
+ }
6872
6874
  .__crossx-wallet-selected {
6873
6875
  font-size: 14px;
6874
6876
  font-weight: 600;
@@ -6926,18 +6928,23 @@ const En = `
6926
6928
  color: var(--cx-subtitle);
6927
6929
  }
6928
6930
 
6931
+ /* ── Safe area fill (mobile only, created by JS in mountOverlay) ── */
6932
+ .__crossx-safe-area-fill {
6933
+ display: none;
6934
+ }
6929
6935
  /* ── Mobile bottom sheet ───────────────────────────────────── */
6930
6936
  @media (max-width: 480px) {
6931
- #${Z} { align-items: flex-end; }
6932
- #${Z}::before {
6933
- content: '';
6934
- position: absolute;
6937
+ #${ee} { align-items: flex-end; }
6938
+ .__crossx-safe-area-fill {
6939
+ display: block;
6940
+ position: fixed;
6935
6941
  bottom: 0;
6936
6942
  left: 0;
6937
6943
  right: 0;
6938
- height: 50px;
6939
- background: var(--cx-bg, transparent);
6944
+ height: calc(env(safe-area-inset-bottom, 0px) + 16px);
6945
+ min-height: 16px;
6940
6946
  pointer-events: none;
6947
+ z-index: 2147483646;
6941
6948
  }
6942
6949
  .__crossx-card {
6943
6950
  width: 100%;
@@ -6947,7 +6954,7 @@ const En = `
6947
6954
  box-sizing: border-box;
6948
6955
  max-height: 85vh;
6949
6956
  overflow-y: auto;
6950
- padding-bottom: 16px;
6957
+ padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
6951
6958
  animation: __crossx-slide-up-mobile 0.25s ease;
6952
6959
  }
6953
6960
  .__crossx-card--wallet-selector {
@@ -6986,15 +6993,30 @@ const En = `
6986
6993
  .__crossx-card--send-tx,
6987
6994
  .__crossx-card--sign-tx,
6988
6995
  .__crossx-card--sign-msg,
6989
- .__crossx-card--sign-typed { overflow: hidden; max-height: none; }
6996
+ .__crossx-card--sign-typed {
6997
+ overflow: hidden !important;
6998
+ display: flex !important;
6999
+ flex-direction: column !important;
7000
+ }
6990
7001
  .__crossx-card--send-tx .__crossx-body,
6991
7002
  .__crossx-card--sign-tx .__crossx-body,
6992
7003
  .__crossx-card--sign-msg .__crossx-body,
6993
- .__crossx-card--sign-typed .__crossx-body { flex: none; overflow: visible; }
6994
- .__crossx-card--send-tx .__crossx-body-cols,
6995
- .__crossx-card--sign-tx .__crossx-body-cols,
6996
- .__crossx-card--sign-msg .__crossx-body-cols,
6997
- .__crossx-card--sign-typed .__crossx-body-cols { flex: none; overflow-y: visible; }
7004
+ .__crossx-card--sign-typed .__crossx-body {
7005
+ flex: 1;
7006
+ min-height: 0;
7007
+ overflow-y: auto;
7008
+ -webkit-overflow-scrolling: touch;
7009
+ }
7010
+ .__crossx-card--send-tx .__crossx-btn-row,
7011
+ .__crossx-card--sign-tx .__crossx-btn-row,
7012
+ .__crossx-card--sign-msg .__crossx-btn-row,
7013
+ .__crossx-card--sign-typed .__crossx-btn-row,
7014
+ .__crossx-card--send-tx .__crossx-body > .__crossx-approve-btn,
7015
+ .__crossx-card--sign-tx .__crossx-body > .__crossx-approve-btn,
7016
+ .__crossx-card--sign-msg .__crossx-body > .__crossx-approve-btn,
7017
+ .__crossx-card--sign-typed .__crossx-body > .__crossx-approve-btn {
7018
+ flex-shrink: 0;
7019
+ }
6998
7020
  .__crossx-login-btn-row {
6999
7021
  flex-direction: column;
7000
7022
  }
@@ -7120,7 +7142,7 @@ const En = `
7120
7142
 
7121
7143
  /* ── Landscape for signing/transaction modals ──────────── */
7122
7144
  @media (orientation: landscape) and (max-height: 500px) {
7123
- #${Z} { align-items: center !important; overflow: hidden; }
7145
+ #${ee} { align-items: center !important; overflow: hidden; }
7124
7146
  .__crossx-card--send-tx,
7125
7147
  .__crossx-card--sign-tx,
7126
7148
  .__crossx-card--sign-msg,
@@ -7623,8 +7645,13 @@ function le() {
7623
7645
  function de(r) {
7624
7646
  const e = r.querySelector(".__crossx-card");
7625
7647
  if (e) {
7626
- const t = e.style.getPropertyValue("--cx-bg");
7627
- t && r.style.setProperty("--cx-bg", t);
7648
+ const n = (e.getAttribute("style") ?? "").match(/--cx-bg:\s*([^;]+)/);
7649
+ if (n) {
7650
+ const o = n[1].trim();
7651
+ r.style.setProperty("--cx-bg", o);
7652
+ const i = document.createElement("div");
7653
+ i.className = "__crossx-safe-area-fill", i.style.background = o, r.appendChild(i);
7654
+ }
7628
7655
  }
7629
7656
  const s = (t) => t.stopPropagation();
7630
7657
  for (const t of ["pointerdown", "pointerup", "mousedown", "mouseup", "click"])
@@ -7645,7 +7672,7 @@ function de(r) {
7645
7672
  }, { passive: !1 }), document.body.appendChild(r);
7646
7673
  }
7647
7674
  const In = () => /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
7648
- function qe() {
7675
+ function Oe() {
7649
7676
  if (In()) {
7650
7677
  const e = window.scrollY;
7651
7678
  return document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.left = "0", document.body.style.right = "0", () => {
@@ -7809,7 +7836,7 @@ function Y(r, e) {
7809
7836
  function Cn(r, e) {
7810
7837
  const s = e, t = Qe(r.dappName), n = r.to ? `<span class="__crossx-addr-text">${re(r.to)}</span>
7811
7838
  <button class="__crossx-copy-btn" data-copy="${D(r.to)}" title="Copy address">${me}</button>` : "<span>—</span>", o = $s(r), i = r.data ?? "0x", a = document.createElement("div");
7812
- return a.id = Z, a.innerHTML = `
7839
+ return a.id = ee, a.innerHTML = `
7813
7840
  <div class="__crossx-card __crossx-card--migration __crossx-card--sign-tx" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7814
7841
  <div class="__crossx-header">
7815
7842
  <p class="__crossx-title" id="__crossx-ttl">Signature Request</p>
@@ -7849,7 +7876,7 @@ function Cn(r, e) {
7849
7876
  function Nn(r, e) {
7850
7877
  const s = e, t = r.nativeSymbol ?? "ETH", n = r.nativeDecimals ?? 18, o = Qe(r.dappName), i = r.to ? `<span class="__crossx-addr-text">${re(r.to)}</span>
7851
7878
  <button class="__crossx-copy-btn" data-copy="${D(r.to)}" title="Copy address">${me}</button>` : "<span>—</span>", a = $s(r), l = An(r.value, t, n) ?? "—", u = document.createElement("div");
7852
- return u.id = Z, u.innerHTML = `
7879
+ return u.id = ee, u.innerHTML = `
7853
7880
  <div class="__crossx-card __crossx-card--migration __crossx-card--send-tx" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7854
7881
  <div class="__crossx-header">
7855
7882
  <p class="__crossx-title" id="__crossx-ttl">Approve transaction</p>
@@ -7911,7 +7938,7 @@ function Mn(r, e) {
7911
7938
  <span class="__crossx-total-label">Total<br>(including fees)</span>
7912
7939
  <span class="__crossx-total-amount">${D(r.total)}</span>
7913
7940
  </div>` : "", c = document.createElement("div");
7914
- return c.id = Z, c.innerHTML = `
7941
+ return c.id = ee, c.innerHTML = `
7915
7942
  <div class="__crossx-card __crossx-card--migration" style="${ae(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7916
7943
  <div class="__crossx-header">
7917
7944
  <p class="__crossx-title" id="__crossx-ttl">Transaction complete</p>
@@ -7934,7 +7961,7 @@ function Mn(r, e) {
7934
7961
  }
7935
7962
  function $n(r, e) {
7936
7963
  const s = document.createElement("div");
7937
- return s.id = Z, s.innerHTML = `
7964
+ return s.id = ee, s.innerHTML = `
7938
7965
  <div class="__crossx-card __crossx-card--migration" style="${ae(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7939
7966
  <div class="__crossx-header">
7940
7967
  <p class="__crossx-title" id="__crossx-ttl">Waiting for confirmation</p>
@@ -7964,7 +7991,7 @@ function Bn(r, e, s) {
7964
7991
  const c = e.from ? Y("From", `<span class="__crossx-addr-text">${re(e.from)}</span>
7965
7992
  <button class="__crossx-copy-btn" data-copy="${D(e.from)}" title="Copy address">${me}</button>`) : "", l = e.to ? Y("To", `<span class="__crossx-addr-text">${re(e.to)}</span>
7966
7993
  <button class="__crossx-copy-btn" data-copy="${D(e.to)}" title="Copy address">${me}</button>`) : "", u = e.amount ? Y("Transfer", `<span>${D(e.amount)}</span>`) : "", f = e.fees ? Y("Tx Fee", `<span>${D(e.fees)}</span>`) : "", _ = e.txHash ? Y("Tx Hash", `<span class="__crossx-addr-text">${re(e.txHash)}</span>
7967
- <button class="__crossx-copy-btn" data-copy="${D(e.txHash)}" title="Copy hash">${me}</button>`) : "", p = e.total ? `<div class="__crossx-total-pill">
7994
+ <button class="__crossx-copy-btn" data-copy="${D(e.txHash)}" title="Copy hash">${me}</button>`) : "", h = e.total ? `<div class="__crossx-total-pill">
7968
7995
  <span class="__crossx-total-label">Total<br>(including fees)</span>
7969
7996
  <span class="__crossx-total-amount">${D(e.total)}</span>
7970
7997
  </div>` : "";
@@ -7976,7 +8003,7 @@ function Bn(r, e, s) {
7976
8003
  ${f}
7977
8004
  ${_}
7978
8005
  </div>
7979
- ${p}
8006
+ ${h}
7980
8007
  <button class="__crossx-approve-btn" id="__crossx-done-btn">${t ? "All Done" : "Done"}</button>
7981
8008
  `, a.querySelectorAll(".__crossx-copy-btn").forEach((b) => {
7982
8009
  b.addEventListener("click", (E) => {
@@ -7990,7 +8017,7 @@ function Bn(r, e, s) {
7990
8017
  }
7991
8018
  function Un(r, e) {
7992
8019
  const s = e, t = Qe(r.dappName), n = D(r.message), o = document.createElement("div");
7993
- return o.id = Z, o.innerHTML = `
8020
+ return o.id = ee, o.innerHTML = `
7994
8021
  <div class="__crossx-card __crossx-card--migration __crossx-card--sign-msg" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7995
8022
  <div class="__crossx-header">
7996
8023
  <p class="__crossx-title" id="__crossx-ttl">Signature Request</p>
@@ -8036,16 +8063,16 @@ function Hn(r, e) {
8036
8063
  <span class="__crossx-td-value">${D(o)}</span>
8037
8064
  </div>`;
8038
8065
  for (const [l, u] of Object.entries(i)) {
8039
- const f = Dn(u), p = Ln(u) ? `<span class="__crossx-addr-text">${re(u)}</span>
8066
+ const f = Dn(u), h = Ln(u) ? `<span class="__crossx-addr-text">${re(u)}</span>
8040
8067
  <button class="__crossx-copy-btn" data-copy="${D(String(u))}" title="Copy">${me}</button>` : `<span>${f}</span>`;
8041
8068
  a += `
8042
8069
  <div class="__crossx-td-row">
8043
8070
  <span class="__crossx-td-label">${D(l)}</span>
8044
- <div class="__crossx-td-value">${p}</div>
8071
+ <div class="__crossx-td-value">${h}</div>
8045
8072
  </div>`;
8046
8073
  }
8047
8074
  const c = document.createElement("div");
8048
- return c.id = Z, c.innerHTML = `
8075
+ return c.id = ee, c.innerHTML = `
8049
8076
  <div class="__crossx-card __crossx-card--migration __crossx-card--sign-typed" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
8050
8077
  <div class="__crossx-header">
8051
8078
  <p class="__crossx-title" id="__crossx-ttl">Signature Request</p>
@@ -8083,11 +8110,10 @@ function Gn(r, e, s) {
8083
8110
  const t = s == null ? void 0 : s.toLowerCase(), n = r.map((i) => {
8084
8111
  const a = t && i.address.toLowerCase() === t;
8085
8112
  return `<button class="__crossx-wallet-item" data-wallet-index="${i.index}" data-wallet-address="${D(i.address)}">
8086
- <span class="__crossx-wallet-idx">${i.index + 1}</span>
8087
- <span class="__crossx-wallet-addr">${re(i.address)}</span>${a ? '<span class="__crossx-wallet-selected">selected</span>' : ""}
8113
+ <span class="__crossx-wallet-info"><span class="__crossx-wallet-idx">Account ${i.index + 1}</span><span class="__crossx-wallet-addr">${re(i.address)}</span></span>${a ? '<span class="__crossx-wallet-selected">selected</span>' : ""}
8088
8114
  </button>`;
8089
8115
  }).join(""), o = document.createElement("div");
8090
- return o.id = Z, o.innerHTML = `
8116
+ return o.id = ee, o.innerHTML = `
8091
8117
  <div class="__crossx-card __crossx-card--migration __crossx-card--wallet-selector" style="${ae(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
8092
8118
  <div class="__crossx-header">
8093
8119
  <div style="display:flex;flex-direction:column;gap:4px;padding-right:36px;">
@@ -8140,7 +8166,7 @@ function Kn(r, e = !1) {
8140
8166
  <span class="__crossx-connect-other-desc">Connect your existing Web3 wallet to manage your assets.</span>
8141
8167
  </div>
8142
8168
  </button>` : "", n = document.createElement("div");
8143
- return n.id = Z, n.innerHTML = `
8169
+ return n.id = ee, n.innerHTML = `
8144
8170
  <div class="__crossx-card __crossx-card--migration" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
8145
8171
  <div class="__crossx-header">
8146
8172
  <div style="display:flex;flex-direction:column;gap:4px;padding-right:36px;">
@@ -8170,7 +8196,7 @@ function Kn(r, e = !1) {
8170
8196
  }
8171
8197
  function Vn(r, e) {
8172
8198
  const s = r, t = document.createElement("div");
8173
- t.id = Z;
8199
+ t.id = ee;
8174
8200
  const n = D(e.message).replace(/\n/g, "<br>"), o = e.email ? `<div class="__crossx-session-account-card">
8175
8201
  <p class="__crossx-session-account-label">${D(e.accountLabel)}</p>
8176
8202
  <p class="__crossx-session-account-email">${D(e.email)}</p>
@@ -8198,7 +8224,7 @@ function Vn(r, e) {
8198
8224
  }
8199
8225
  function zn(r, e = !0) {
8200
8226
  const s = r, t = e ? `<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${oe}</button>` : "", n = e ? '<button class="__crossx-skip-btn" id="__crossx-skip-btn">Skip for Now</button>' : "", o = document.createElement("div");
8201
- return o.id = Z, o.innerHTML = `
8227
+ return o.id = ee, o.innerHTML = `
8202
8228
  <div class="__crossx-card __crossx-card--migration" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
8203
8229
  <div class="__crossx-header">
8204
8230
  <p class="__crossx-title" id="__crossx-ttl">Wallet Found on Social Account 🎉</p>
@@ -8222,7 +8248,7 @@ function zn(r, e = !0) {
8222
8248
  }
8223
8249
  function jn(r, e) {
8224
8250
  const s = r, { errorMessage: t, attemptCount: n, maxAttempts: o = 5 } = e ?? {}, i = !!t, a = i ? " --error" : "", c = n != null && n > 0 ? `<p class="__crossx-pin-attempt">${n}/${o}</p>` : "", l = n != null && n >= 3 ? '<p class="__crossx-pin-warning">Your account will be locked after further failures.</p>' : "", u = i ? `<p class="__crossx-pin-error-text">${t}</p>` : "", f = document.createElement("div");
8225
- return f.id = Z, f.innerHTML = `
8251
+ return f.id = ee, f.innerHTML = `
8226
8252
  <div class="__crossx-card __crossx-card--migration" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
8227
8253
  <div class="__crossx-header">
8228
8254
  <p class="__crossx-title" id="__crossx-ttl">Import from Social Backup</p>
@@ -8250,7 +8276,7 @@ function Yn(r) {
8250
8276
  }
8251
8277
  function Xn(r, e, s) {
8252
8278
  const t = r, n = e <= 0, o = n ? null : Date.now() + e * 1e3, i = o ? Yn(o) : null, a = document.createElement("div");
8253
- return a.id = Z, a.innerHTML = `
8279
+ return a.id = ee, a.innerHTML = `
8254
8280
  <div class="__crossx-card __crossx-card--migration" style="${ae(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
8255
8281
  <div class="__crossx-header">
8256
8282
  <p class="__crossx-title" id="__crossx-ttl">Import from Social Backup</p>
@@ -8325,27 +8351,27 @@ function ct(r) {
8325
8351
  ).join(""), f = e ? " --locked" : "", _ = Array.from(
8326
8352
  { length: 6 },
8327
8353
  (E, v) => `<div class="__crossx-pin6-dot${f}" data-dot-index="${v}" aria-label="PIN digit ${v + 1}"></div>`
8328
- ).join(""), p = e ? " --disabled" : "", b = `
8354
+ ).join(""), h = e ? " --disabled" : "", b = `
8329
8355
  <div class="__crossx-pin6-numpad" id="__crossx-pin6-numpad">
8330
8356
  <div class="__crossx-pin6-numpad-row">
8331
- <button type="button" class="__crossx-pin6-numpad-key${p}" data-key="1">1</button>
8332
- <button type="button" class="__crossx-pin6-numpad-key${p}" data-key="2">2</button>
8333
- <button type="button" class="__crossx-pin6-numpad-key${p}" data-key="3">3</button>
8357
+ <button type="button" class="__crossx-pin6-numpad-key${h}" data-key="1">1</button>
8358
+ <button type="button" class="__crossx-pin6-numpad-key${h}" data-key="2">2</button>
8359
+ <button type="button" class="__crossx-pin6-numpad-key${h}" data-key="3">3</button>
8334
8360
  </div>
8335
8361
  <div class="__crossx-pin6-numpad-row">
8336
- <button type="button" class="__crossx-pin6-numpad-key${p}" data-key="4">4</button>
8337
- <button type="button" class="__crossx-pin6-numpad-key${p}" data-key="5">5</button>
8338
- <button type="button" class="__crossx-pin6-numpad-key${p}" data-key="6">6</button>
8362
+ <button type="button" class="__crossx-pin6-numpad-key${h}" data-key="4">4</button>
8363
+ <button type="button" class="__crossx-pin6-numpad-key${h}" data-key="5">5</button>
8364
+ <button type="button" class="__crossx-pin6-numpad-key${h}" data-key="6">6</button>
8339
8365
  </div>
8340
8366
  <div class="__crossx-pin6-numpad-row">
8341
- <button type="button" class="__crossx-pin6-numpad-key${p}" data-key="7">7</button>
8342
- <button type="button" class="__crossx-pin6-numpad-key${p}" data-key="8">8</button>
8343
- <button type="button" class="__crossx-pin6-numpad-key${p}" data-key="9">9</button>
8367
+ <button type="button" class="__crossx-pin6-numpad-key${h}" data-key="7">7</button>
8368
+ <button type="button" class="__crossx-pin6-numpad-key${h}" data-key="8">8</button>
8369
+ <button type="button" class="__crossx-pin6-numpad-key${h}" data-key="9">9</button>
8344
8370
  </div>
8345
8371
  <div class="__crossx-pin6-numpad-row">
8346
8372
  <button type="button" class="__crossx-pin6-numpad-key --empty" aria-hidden="true"></button>
8347
- <button type="button" class="__crossx-pin6-numpad-key${p}" data-key="0">0</button>
8348
- <button type="button" class="__crossx-pin6-numpad-key --delete${p}" data-key="backspace" aria-label="Delete">${eo}</button>
8373
+ <button type="button" class="__crossx-pin6-numpad-key${h}" data-key="0">0</button>
8374
+ <button type="button" class="__crossx-pin6-numpad-key --delete${h}" data-key="backspace" aria-label="Delete">${eo}</button>
8349
8375
  </div>
8350
8376
  </div>`;
8351
8377
  return `
@@ -8373,7 +8399,7 @@ function ct(r) {
8373
8399
  }
8374
8400
  function rs(r, e) {
8375
8401
  const s = document.createElement("div");
8376
- return s.id = Z, s.innerHTML = `
8402
+ return s.id = ee, s.innerHTML = `
8377
8403
  <div class="__crossx-card __crossx-card--pin6" style="${ae(r)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
8378
8404
  ${e}
8379
8405
  </div>
@@ -8393,7 +8419,7 @@ function Qn(r) {
8393
8419
  function lt(r, e, s, t, n, o, i) {
8394
8420
  var O, L;
8395
8421
  let a = !!(o && o > Date.now()), c = !1;
8396
- const l = () => Array.from(r.querySelectorAll(".__crossx-pin6-box")), u = () => r.querySelector("#__crossx-pin6-boxes"), f = () => r.querySelector("#__crossx-pin6-error"), _ = () => r.querySelector("#__crossx-pin6-lock-msg"), p = () => r.querySelector("#__crossx-pin6-lock-countdown"), b = () => r.querySelector(".__crossx-pin6-body"), E = () => l().map((w) => w.value).join(""), v = () => Array.from(r.querySelectorAll(".__crossx-pin6-dot")), T = () => {
8422
+ const l = () => Array.from(r.querySelectorAll(".__crossx-pin6-box")), u = () => r.querySelector("#__crossx-pin6-boxes"), f = () => r.querySelector("#__crossx-pin6-error"), _ = () => r.querySelector("#__crossx-pin6-lock-msg"), h = () => r.querySelector("#__crossx-pin6-lock-countdown"), b = () => r.querySelector(".__crossx-pin6-body"), E = () => l().map((w) => w.value).join(""), v = () => Array.from(r.querySelectorAll(".__crossx-pin6-dot")), T = () => {
8397
8423
  var S;
8398
8424
  const w = l(), y = v();
8399
8425
  if (y.length && (y.forEach((I, k) => {
@@ -8412,9 +8438,9 @@ function lt(r, e, s, t, n, o, i) {
8412
8438
  }, $ = () => r.querySelector("#__crossx-pin6-attempt"), K = () => {
8413
8439
  const w = f();
8414
8440
  w && (w.textContent = "");
8415
- }, q = () => i ?? "Your account will be locked after further failures.", Q = () => r.querySelector("#__crossx-pin6-warning"), G = (w) => {
8441
+ }, q = () => i ?? "Your account will be locked after further failures.", Z = () => r.querySelector("#__crossx-pin6-warning"), G = (w) => {
8416
8442
  var S;
8417
- let y = Q();
8443
+ let y = Z();
8418
8444
  if (!y) {
8419
8445
  y = document.createElement("p"), y.className = "__crossx-pin6-warning", y.id = "__crossx-pin6-warning";
8420
8446
  const I = f();
@@ -8422,14 +8448,14 @@ function lt(r, e, s, t, n, o, i) {
8422
8448
  }
8423
8449
  y.textContent = w;
8424
8450
  }, X = () => {
8425
- const w = Q();
8451
+ const w = Z();
8426
8452
  w && (w.textContent = "");
8427
- }, ee = (w, y) => {
8453
+ }, Q = (w, y) => {
8428
8454
  var I;
8429
8455
  let S = $();
8430
8456
  if (!S) {
8431
8457
  S = document.createElement("p"), S.className = "__crossx-pin6-attempt", S.id = "__crossx-pin6-attempt";
8432
- const k = Q() ?? f();
8458
+ const k = Z() ?? f();
8433
8459
  k ? k.insertAdjacentElement("afterend", S) : (I = b()) == null || I.appendChild(S);
8434
8460
  }
8435
8461
  S.textContent = `${w}/${y}`;
@@ -8460,7 +8486,7 @@ function lt(r, e, s, t, n, o, i) {
8460
8486
  }
8461
8487
  const S = () => {
8462
8488
  var W;
8463
- const B = w - Date.now(), N = p();
8489
+ const B = w - Date.now(), N = h();
8464
8490
  B <= 0 ? (clearInterval(I), F(!1), (W = _()) == null || W.remove(), y && (y.textContent = ""), R(), setTimeout(() => {
8465
8491
  var j;
8466
8492
  return (j = l()[0]) == null ? void 0 : j.focus();
@@ -8481,7 +8507,7 @@ function lt(r, e, s, t, n, o, i) {
8481
8507
  try {
8482
8508
  if (n) {
8483
8509
  const y = await n(w);
8484
- y.ok ? e(w) : y.lockExpiresAt ? (U(), M(y.lockExpiresAt)) : (C(y.error ?? "Incorrect PIN. Please try again."), y.attemptCount != null && y.maxAttempts != null ? (G(q()), ee(y.attemptCount, y.maxAttempts)) : (X(), U()));
8510
+ y.ok ? e(w) : y.lockExpiresAt ? (U(), M(y.lockExpiresAt)) : (C(y.error ?? "Incorrect PIN. Please try again."), y.attemptCount != null && y.maxAttempts != null ? (G(q()), Q(y.attemptCount, y.maxAttempts)) : (X(), U()));
8485
8511
  } else
8486
8512
  e(w);
8487
8513
  } catch (y) {
@@ -8594,8 +8620,8 @@ function ro(r, e, s) {
8594
8620
  c.preventDefault();
8595
8621
  const l = (((f = c.clipboardData) == null ? void 0 : f.getData("text")) ?? "").replace(/\D/g, "").slice(0, 4);
8596
8622
  if (!l) return;
8597
- l.split("").forEach((_, p) => {
8598
- t[p] && (t[p].value = _);
8623
+ l.split("").forEach((_, h) => {
8624
+ t[h] && (t[h].value = _);
8599
8625
  });
8600
8626
  const u = Math.min(l.length, 3);
8601
8627
  t[u].focus(), l.length === 4 && setTimeout(() => e(l), 200);
@@ -8631,7 +8657,7 @@ class no {
8631
8657
  return new Promise((n) => {
8632
8658
  var E;
8633
8659
  le();
8634
- const o = [...e], i = Gn(o, this.tokens, t), a = qe();
8660
+ const o = [...e], i = Gn(o, this.tokens, t), a = Oe();
8635
8661
  de(i);
8636
8662
  let c = !1;
8637
8663
  const l = () => {
@@ -8649,20 +8675,20 @@ class no {
8649
8675
  });
8650
8676
  });
8651
8677
  })();
8652
- const p = i.querySelector("#__crossx-add-wallet-btn");
8653
- p && p.addEventListener("click", async () => {
8654
- p.disabled = !0;
8678
+ const h = i.querySelector("#__crossx-add-wallet-btn");
8679
+ h && h.addEventListener("click", async () => {
8680
+ h.disabled = !0;
8655
8681
  try {
8656
8682
  const v = await s();
8657
8683
  o.push(v);
8658
8684
  const T = i.querySelector("#__crossx-wallet-list");
8659
8685
  if (T) {
8660
8686
  const R = document.createElement("button");
8661
- R.className = "__crossx-wallet-item", R.dataset.walletIndex = String(v.index), R.dataset.walletAddress = v.address, R.innerHTML = `<span class="__crossx-wallet-idx">${v.index + 1}</span><span class="__crossx-wallet-addr">${re(v.address)}</span>`, R.addEventListener("click", () => u(v)), T.appendChild(R), R.scrollIntoView({ behavior: "smooth", block: "nearest" });
8687
+ R.className = "__crossx-wallet-item", R.dataset.walletIndex = String(v.index), R.dataset.walletAddress = v.address, R.innerHTML = `<span class="__crossx-wallet-info"><span class="__crossx-wallet-idx">Account ${v.index + 1}</span><span class="__crossx-wallet-addr">${re(v.address)}</span></span>`, R.addEventListener("click", () => u(v)), T.appendChild(R), R.scrollIntoView({ behavior: "smooth", block: "nearest" });
8662
8688
  }
8663
8689
  } catch {
8664
8690
  } finally {
8665
- p.disabled = !1;
8691
+ h.disabled = !1;
8666
8692
  }
8667
8693
  }), (E = i.querySelector("#__crossx-close-btn")) == null || E.addEventListener("click", f), i.addEventListener("click", (v) => {
8668
8694
  v.target === i && f();
@@ -8681,24 +8707,26 @@ class no {
8681
8707
  */
8682
8708
  showLoginSelector(e) {
8683
8709
  return new Promise((s) => {
8684
- var c, l, u, f;
8710
+ var l, u, f, _;
8685
8711
  le();
8686
- const t = Kn(this.tokens, e == null ? void 0 : e.showConnectOtherWallets);
8712
+ const t = Kn(this.tokens, e == null ? void 0 : e.showConnectOtherWallets), n = Oe();
8687
8713
  de(t);
8688
- const n = () => t.remove(), o = (_) => {
8689
- n(), s(_);
8690
- }, i = () => {
8691
- n(), s(null);
8714
+ const o = () => {
8715
+ t.remove(), n();
8716
+ }, i = (h) => {
8717
+ o(), s(h);
8718
+ }, a = () => {
8719
+ o(), s(null);
8692
8720
  };
8693
- (c = t.querySelector("#__crossx-apple-btn")) == null || c.addEventListener("click", () => o("apple")), (l = t.querySelector("#__crossx-google-btn")) == null || l.addEventListener("click", () => o("google")), (u = t.querySelector("#__crossx-connect-btn")) == null || u.addEventListener("click", () => o("external")), (f = t.querySelector("#__crossx-close-btn")) == null || f.addEventListener("click", i), t.addEventListener("click", (_) => {
8694
- _.target === t && i();
8695
- }), t.querySelectorAll(".__crossx-login-terms-link").forEach((_) => {
8696
- _.addEventListener("click", (p) => p.stopPropagation());
8721
+ (l = t.querySelector("#__crossx-apple-btn")) == null || l.addEventListener("click", () => i("apple")), (u = t.querySelector("#__crossx-google-btn")) == null || u.addEventListener("click", () => i("google")), (f = t.querySelector("#__crossx-connect-btn")) == null || f.addEventListener("click", () => i("external")), (_ = t.querySelector("#__crossx-close-btn")) == null || _.addEventListener("click", a), t.addEventListener("click", (h) => {
8722
+ h.target === t && a();
8723
+ }), t.querySelectorAll(".__crossx-login-terms-link").forEach((h) => {
8724
+ h.addEventListener("click", (b) => b.stopPropagation());
8697
8725
  });
8698
- const a = (_) => {
8699
- _.key === "Escape" && (document.removeEventListener("keydown", a), i());
8726
+ const c = (h) => {
8727
+ h.key === "Escape" && (document.removeEventListener("keydown", c), a());
8700
8728
  };
8701
- document.addEventListener("keydown", a);
8729
+ document.addEventListener("keydown", c);
8702
8730
  });
8703
8731
  }
8704
8732
  showSessionAlert(e) {
@@ -8712,7 +8740,7 @@ class no {
8712
8740
  accountLabel: (t == null ? void 0 : t.sessionAlert_accountLabel) ?? "Account",
8713
8741
  signOutLabel: (t == null ? void 0 : t.sessionAlert_signOutButton) ?? "Sign out",
8714
8742
  signInAgainLabel: (t == null ? void 0 : t.sessionAlert_signInAgainButton) ?? "Sign in again"
8715
- }), o = qe();
8743
+ }), o = Oe();
8716
8744
  de(n);
8717
8745
  let i = !1;
8718
8746
  const a = () => {
@@ -8781,7 +8809,7 @@ class no {
8781
8809
  }, i = {
8782
8810
  title: (t == null ? void 0 : t.pinSetup_confirmTitle) ?? "Confirm PIN",
8783
8811
  headerSubtitle: (t == null ? void 0 : t.pinSetup_confirmSubtitle) ?? "Enter your PIN again to confirm."
8784
- }, a = rs(this.tokens, Jn(n)), c = qe();
8812
+ }, a = rs(this.tokens, Jn(n)), c = Oe();
8785
8813
  de(a);
8786
8814
  let l = !1;
8787
8815
  const u = () => {
@@ -8790,7 +8818,7 @@ class no {
8790
8818
  u(), s(R);
8791
8819
  }, _ = () => {
8792
8820
  u(), s(null);
8793
- }, p = a.querySelector(".__crossx-card"), b = {
8821
+ }, h = a.querySelector(".__crossx-card"), b = {
8794
8822
  tooShort: (t == null ? void 0 : t.pinValidation_tooShort) ?? "Please enter a 6-digit PIN.",
8795
8823
  numbersOnly: (t == null ? void 0 : t.pinValidation_numbersOnly) ?? "Only numbers (0-9) are allowed.",
8796
8824
  repeatingDigit: (t == null ? void 0 : t.pinValidation_repeatingDigit) ?? "Cannot use the same number 3+ times in a row.",
@@ -8798,39 +8826,39 @@ class no {
8798
8826
  alternatingPattern: (t == null ? void 0 : t.pinValidation_alternatingPattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
8799
8827
  }, E = (R) => {
8800
8828
  var F;
8801
- p.innerHTML = ct({
8829
+ h.innerHTML = ct({
8802
8830
  title: i.title,
8803
8831
  headerSubtitle: i.headerSubtitle
8804
- }), (F = p.querySelector("#__crossx-close-btn")) == null || F.addEventListener("click", _), lt(p, ($) => {
8832
+ }), (F = h.querySelector("#__crossx-close-btn")) == null || F.addEventListener("click", _), lt(h, ($) => {
8805
8833
  $ === R ? f(R) : v(o.mismatchError);
8806
8834
  }, _);
8807
8835
  }, v = (R) => {
8808
8836
  var F;
8809
- p.innerHTML = ct({
8837
+ h.innerHTML = ct({
8810
8838
  title: o.title,
8811
8839
  headerSubtitle: o.headerSubtitle,
8812
8840
  subtitle: o.subtitle,
8813
8841
  errorMessage: R
8814
- }), (F = p.querySelector("#__crossx-close-btn")) == null || F.addEventListener("click", _), lt(p, ($) => {
8842
+ }), (F = h.querySelector("#__crossx-close-btn")) == null || F.addEventListener("click", _), lt(h, ($) => {
8815
8843
  const K = Zn($, b);
8816
8844
  K ? v(K) : E($);
8817
8845
  }, _);
8818
8846
  };
8819
8847
  (() => {
8820
- var ee;
8821
- const R = Array.from(p.querySelectorAll(".__crossx-pw-notice-item")), F = p.querySelector("#__crossx-pin-notice-next"), $ = /* @__PURE__ */ new Set();
8848
+ var Q;
8849
+ const R = Array.from(h.querySelectorAll(".__crossx-pw-notice-item")), F = h.querySelector("#__crossx-pin-notice-next"), $ = /* @__PURE__ */ new Set();
8822
8850
  F.removeAttribute("disabled");
8823
- const K = F.dataset.nextLabel ?? "Next", q = F.dataset.submitLabel ?? "I Understand", Q = () => {
8851
+ const K = F.dataset.nextLabel ?? "Next", q = F.dataset.submitLabel ?? "I Understand", Z = () => {
8824
8852
  const U = $.size === R.length;
8825
8853
  F.classList.toggle("--disabled", !U), F.textContent = U ? q : K;
8826
8854
  }, G = (U, C) => {
8827
8855
  if ($.has(C)) return;
8828
8856
  const M = U.querySelector(`#__crossx-notice-check-${C}`);
8829
- $.add(C), M.classList.add("--checked"), U.setAttribute("aria-checked", "true"), Q();
8857
+ $.add(C), M.classList.add("--checked"), U.setAttribute("aria-checked", "true"), Z();
8830
8858
  }, X = (U, C) => {
8831
8859
  if (!$.has(C)) return;
8832
8860
  const M = U.querySelector(`#__crossx-notice-check-${C}`);
8833
- $.delete(C), M.classList.remove("--checked"), U.setAttribute("aria-checked", "false"), Q();
8861
+ $.delete(C), M.classList.remove("--checked"), U.setAttribute("aria-checked", "false"), Z();
8834
8862
  };
8835
8863
  R.forEach((U) => {
8836
8864
  const C = parseInt(U.dataset.checkIndex ?? "0", 10);
@@ -8853,7 +8881,7 @@ class no {
8853
8881
  U.scrollIntoView({ behavior: "smooth", block: "nearest" }), U.classList.add("--highlight"), setTimeout(() => {
8854
8882
  U.classList.remove("--highlight"), G(U, C);
8855
8883
  }, 400);
8856
- }), (ee = p.querySelector("#__crossx-close-btn")) == null || ee.addEventListener("click", _);
8884
+ }), (Q = h.querySelector("#__crossx-close-btn")) == null || Q.addEventListener("click", _);
8857
8885
  })(), a.addEventListener("click", (R) => {
8858
8886
  R.target === a && _();
8859
8887
  });
@@ -8879,19 +8907,19 @@ class no {
8879
8907
  attemptCount: e == null ? void 0 : e.attemptCount,
8880
8908
  maxAttempts: e == null ? void 0 : e.maxAttempts
8881
8909
  })
8882
- ), u = qe();
8910
+ ), u = Oe();
8883
8911
  de(l);
8884
8912
  let f = !1;
8885
8913
  const _ = () => {
8886
8914
  f || (f = !0, l.remove(), u());
8887
- }, p = (R) => {
8915
+ }, h = (R) => {
8888
8916
  _(), s(R);
8889
8917
  }, b = () => {
8890
8918
  _(), s(null);
8891
8919
  }, E = (R) => {
8892
8920
  _(), t(R);
8893
8921
  }, v = l.querySelector(".__crossx-card");
8894
- (T = v.querySelector("#__crossx-close-btn")) == null || T.addEventListener("click", b), lt(v, p, b, E, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt, c), l.addEventListener("click", (R) => {
8922
+ (T = v.querySelector("#__crossx-close-btn")) == null || T.addEventListener("click", b), lt(v, h, b, E, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt, c), l.addEventListener("click", (R) => {
8895
8923
  R.target === l && b();
8896
8924
  });
8897
8925
  });
@@ -9001,30 +9029,34 @@ class no {
9001
9029
  }
9002
9030
  requestConfirmation(e) {
9003
9031
  return new Promise((s) => {
9004
- var c, l, u;
9032
+ var l, u, f;
9005
9033
  le();
9006
9034
  let t;
9007
- e.type === "sign-message" ? t = Un(e, this.tokens) : e.type === "sign-typed-data" ? t = Hn(e, this.tokens) : e.type === "sign" ? t = Cn(e, this.tokens) : t = Nn(e, this.tokens), de(t);
9008
- const n = () => t.remove(), o = () => {
9009
- n(), s(!0);
9035
+ e.type === "sign-message" ? t = Un(e, this.tokens) : e.type === "sign-typed-data" ? t = Hn(e, this.tokens) : e.type === "sign" ? t = Cn(e, this.tokens) : t = Nn(e, this.tokens);
9036
+ const n = Oe();
9037
+ de(t);
9038
+ const o = () => {
9039
+ t.remove(), n();
9010
9040
  }, i = () => {
9011
- n(), s(!1);
9041
+ o(), s(!0);
9042
+ }, a = () => {
9043
+ o(), s(!1);
9012
9044
  };
9013
- (c = t.querySelector("#__crossx-confirm-btn")) == null || c.addEventListener("click", o), (l = t.querySelector("#__crossx-cancel-btn")) == null || l.addEventListener("click", i), (u = t.querySelector("#__crossx-close-btn")) == null || u.addEventListener("click", i), t.querySelectorAll(".__crossx-copy-btn").forEach((f) => {
9014
- f.addEventListener("click", (_) => {
9015
- var b;
9016
- _.stopPropagation();
9017
- const p = f.dataset.copy;
9018
- p && ((b = navigator.clipboard) == null || b.writeText(p).catch(() => {
9045
+ (l = t.querySelector("#__crossx-confirm-btn")) == null || l.addEventListener("click", i), (u = t.querySelector("#__crossx-cancel-btn")) == null || u.addEventListener("click", a), (f = t.querySelector("#__crossx-close-btn")) == null || f.addEventListener("click", a), t.querySelectorAll(".__crossx-copy-btn").forEach((_) => {
9046
+ _.addEventListener("click", (h) => {
9047
+ var E;
9048
+ h.stopPropagation();
9049
+ const b = _.dataset.copy;
9050
+ b && ((E = navigator.clipboard) == null || E.writeText(b).catch(() => {
9019
9051
  }));
9020
9052
  });
9021
- }), t.addEventListener("click", (f) => {
9022
- f.target === t && i();
9053
+ }), t.addEventListener("click", (_) => {
9054
+ _.target === t && a();
9023
9055
  });
9024
- const a = (f) => {
9025
- f.key === "Escape" && (document.removeEventListener("keydown", a), i());
9056
+ const c = (_) => {
9057
+ _.key === "Escape" && (document.removeEventListener("keydown", c), a());
9026
9058
  };
9027
- document.addEventListener("keydown", a);
9059
+ document.addEventListener("keydown", c);
9028
9060
  });
9029
9061
  }
9030
9062
  }
@@ -9062,7 +9094,7 @@ class oo {
9062
9094
  }
9063
9095
  function fo(r, e) {
9064
9096
  r.debug;
9065
- const s = Oe.production, t = {
9097
+ const s = Pe.production, t = {
9066
9098
  ...r,
9067
9099
  oauthServiceUrl: s.oauthServiceUrl,
9068
9100
  authApiUrl: s.authApiUrl,
@@ -9085,7 +9117,7 @@ function fo(r, e) {
9085
9117
  u,
9086
9118
  f
9087
9119
  ));
9088
- const p = new Be(n, c), b = new no(r.theme ?? "light", r.themeTokens), E = e != null && e.wrapConfirmation ? e.wrapConfirmation(b) : b, v = new ut(
9120
+ const h = new Ue(n, c), b = new no(r.theme ?? "light", r.themeTokens), E = e != null && e.wrapConfirmation ? e.wrapConfirmation(b) : b, v = new ut(
9089
9121
  t,
9090
9122
  n,
9091
9123
  i,
@@ -9095,7 +9127,7 @@ function fo(r, e) {
9095
9127
  _,
9096
9128
  u,
9097
9129
  E,
9098
- p,
9130
+ h,
9099
9131
  f
9100
9132
  );
9101
9133
  return typeof window < "u" && (window.__crossxSDK = v), v;
@@ -9162,7 +9194,7 @@ export {
9162
9194
  Vs as CROSSxEthereumProvider,
9163
9195
  ut as CROSSxSDK,
9164
9196
  po as ChainId,
9165
- h as ErrorCode,
9197
+ p as ErrorCode,
9166
9198
  os as PinMemoryStore,
9167
9199
  oo as TokenMemoryStore,
9168
9200
  fo as createCROSSxSDK,