@nexus-cross/crossx-sdk-core 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- var $s = Object.defineProperty;
2
- var Bs = (r, e, s) => e in r ? $s(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
3
- var R = (r, e, s) => Bs(r, typeof e != "symbol" ? e + "" : e, s);
4
- import { createRemoteJWKSet as Us, jwtVerify as Hs, decodeJwt as Fs } from "jose";
1
+ var Us = Object.defineProperty;
2
+ var Hs = (r, e, s) => e in r ? Us(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
3
+ var R = (r, e, s) => Hs(r, typeof e != "symbol" ? e + "" : e, s);
4
+ import { createRemoteJWKSet as Fs, jwtVerify as Gs, decodeJwt as Ws } from "jose";
5
5
  var h = /* @__PURE__ */ ((r) => (r.AUTH_NOT_INITIALIZED = "AUTH_NOT_INITIALIZED", r.AUTH_FAILED = "AUTH_FAILED", r.AUTH_TOKEN_INVALID = "AUTH_TOKEN_INVALID", r.AUTH_TOKEN_EXPIRED = "AUTH_TOKEN_EXPIRED", r.AUTH_NOT_AUTHENTICATED = "AUTH_NOT_AUTHENTICATED", r.ALREADY_AUTHENTICATED = "ALREADY_AUTHENTICATED", r.SESSION_EXPIRED = "SESSION_EXPIRED", r.OAUTH_POPUP_BLOCKED = "OAUTH_POPUP_BLOCKED", r.WALLET_NOT_FOUND = "WALLET_NOT_FOUND", r.WALLET_CREATION_FAILED = "WALLET_CREATION_FAILED", r.WALLET_ALREADY_EXISTS = "WALLET_ALREADY_EXISTS", r.SIGN_FAILED = "SIGN_FAILED", r.SIGN_REJECTED = "SIGN_REJECTED", r.TX_FAILED = "TX_FAILED", r.TX_REJECTED = "TX_REJECTED", r.BROADCAST_FAILED = "BROADCAST_FAILED", r.USER_REJECTED = "USER_REJECTED", r.TX_INVALID_PARAMS = "TX_INVALID_PARAMS", r.NETWORK_ERROR = "NETWORK_ERROR", r.NETWORK_NOT_CONFIGURED = "NETWORK_NOT_CONFIGURED", r.INVALID_CHAIN = "INVALID_CHAIN", r.CHAIN_NOT_SUPPORTED = "CHAIN_NOT_SUPPORTED", r.CHAIN_ADAPTER_NOT_FOUND = "CHAIN_ADAPTER_NOT_FOUND", r.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", r.SIGNATURE_FAILED = "SIGNATURE_FAILED", r.TRANSACTION_FAILED = "TRANSACTION_FAILED", r.PREPARE_FAILED = "PREPARE_FAILED", r.PREPARE_EXPIRED = "PREPARE_EXPIRED", r.PREPARE_MISMATCH = "PREPARE_MISMATCH", r.MIGRATION_FAILED = "MIGRATION_FAILED", r.MIGRATION_BACKUP_EXISTS = "MIGRATION_BACKUP_EXISTS", r.MIGRATION_PIN_LOCKED = "MIGRATION_PIN_LOCKED", r.GATEWAY_INTERNAL_ERROR = "GATEWAY_INTERNAL_ERROR", r.GATEWAY_LOCK_CONFLICT = "GATEWAY_LOCK_CONFLICT", r.WALLET_INCONSISTENT_STATE = "WALLET_INCONSISTENT_STATE", r.PROJECT_ID_MISSING = "PROJECT_ID_MISSING", r.ORIGIN_NOT_ALLOWED = "ORIGIN_NOT_ALLOWED", r.APP_IDENTIFIER_MISSING = "APP_IDENTIFIER_MISSING", r.INVALID_APP_TYPE = "INVALID_APP_TYPE", r.PROJECT_NOT_REGISTERED = "PROJECT_NOT_REGISTERED", r.SIGNATURE_SIGNER_MISMATCH = "SIGNATURE_SIGNER_MISMATCH", r.GAS_ESTIMATION_FAILED = "GAS_ESTIMATION_FAILED", r.TYPED_DATA_CHAIN_ID_MISMATCH = "TYPED_DATA_CHAIN_ID_MISMATCH", r.PIN_NOT_SET = "PIN_NOT_SET", r.PIN_WRONG = "PIN_WRONG", r.PIN_INVALID = "PIN_INVALID", r.PIN_REPEATED_PATTERN = "PIN_REPEATED_PATTERN", r.PIN_CANCELLED = "PIN_CANCELLED", r.EXTERNAL_WALLET_REQUESTED = "EXTERNAL_WALLET_REQUESTED", r.PIN_LOCKED = "PIN_LOCKED", r.HMAC_REQUIRED = "HMAC_REQUIRED", r.HMAC_VERIFICATION_FAILED = "HMAC_VERIFICATION_FAILED", r.WITHDRAW_FAILED = "WITHDRAW_FAILED", r.USER_NOT_FOUND = "USER_NOT_FOUND", r.INVALID_CONFIG = "INVALID_CONFIG", r.UNKNOWN_ERROR = "UNKNOWN_ERROR", r))(h || {});
6
6
  class g extends Error {
7
7
  constructor(e, s, t) {
@@ -16,7 +16,7 @@ class g extends Error {
16
16
  };
17
17
  }
18
18
  }
19
- const Ye = {
19
+ const Xe = {
20
20
  // ─── CROSS ────────────────────────────────────────────
21
21
  CROSS_MAINNET: {
22
22
  caipId: "eip155:612055",
@@ -65,20 +65,20 @@ const Ye = {
65
65
  rpcUrl: "https://saigon-testnet.roninchain.com/rpc",
66
66
  testnet: !0
67
67
  }
68
- }, di = Object.fromEntries(
69
- Object.entries(Ye).map(([r, e]) => [r, e.caipId])
70
- ), Ws = new Map(
71
- Object.values(Ye).map((r) => [r.caipId, r])
68
+ }, ui = Object.fromEntries(
69
+ Object.entries(Xe).map(([r, e]) => [r, e.caipId])
70
+ ), qs = new Map(
71
+ Object.values(Xe).map((r) => [r.caipId, r])
72
72
  );
73
73
  new Map(
74
- Object.values(Ye).map((r) => [r.chainId, r])
74
+ Object.values(Xe).map((r) => [r.chainId, r])
75
75
  );
76
- const Gs = { symbol: "", decimals: 18 };
77
- function Qe(r) {
76
+ const Ks = { symbol: "", decimals: 18 };
77
+ function et(r) {
78
78
  var e;
79
- return ((e = Ws.get(r)) == null ? void 0 : e.nativeCurrency) ?? Gs;
79
+ return ((e = qs.get(r)) == null ? void 0 : e.nativeCurrency) ?? Ks;
80
80
  }
81
- class qs {
81
+ class Vs {
82
82
  constructor(e, s) {
83
83
  this.sdk = e, this.chainId = s, this._listeners = /* @__PURE__ */ new Map();
84
84
  }
@@ -168,7 +168,7 @@ class qs {
168
168
  }
169
169
  }
170
170
  let xe = null;
171
- function It(r) {
171
+ function Tt(r) {
172
172
  xe = r;
173
173
  }
174
174
  const d = {
@@ -198,7 +198,7 @@ const d = {
198
198
  return;
199
199
  }
200
200
  }
201
- }, Ks = {
201
+ }, zs = {
202
202
  // ── 공통 버튼 ────────────────────────────────────────────────
203
203
  confirm: "확인",
204
204
  cancel: "취소",
@@ -278,7 +278,7 @@ const d = {
278
278
  sessionAlert_accountLabel: "계정",
279
279
  sessionAlert_signOutButton: "로그아웃",
280
280
  sessionAlert_signInAgainButton: "다시 로그인"
281
- }, ss = {
281
+ }, ns = {
282
282
  // ── Common buttons ───────────────────────────────────────────
283
283
  confirm: "Confirm",
284
284
  cancel: "Cancel",
@@ -358,15 +358,14 @@ For security, you must continue with the same account.`,
358
358
  sessionAlert_accountLabel: "Account",
359
359
  sessionAlert_signOutButton: "Sign out",
360
360
  sessionAlert_signInAgainButton: "Sign in again"
361
- }, Vs = {
362
- ko: Ks,
363
- en: ss
361
+ }, js = {
362
+ ko: zs,
363
+ en: ns
364
364
  };
365
365
  function fe(r = "en", e) {
366
- return Vs[r] ?? ss;
366
+ return js[r] ?? ns;
367
367
  }
368
- const At = "crossx_access_token", Tt = "crossx_refresh_token", Rt = "crossx_user_info";
369
- class zs {
368
+ const Rt = "crossx_access_token", kt = "crossx_refresh_token", Ot = "crossx_user_info", Ye = class Ye {
370
369
  constructor(e, s, t, n, i, o, a) {
371
370
  this.config = e, this.storage = s, this.crypto = t, this.oauth = n, this.transport = i, this.walletProvider = o, this.tokenStore = a, this._refreshPromise = null, this._migrated = !1;
372
371
  const c = e.projectId;
@@ -376,25 +375,33 @@ class zs {
376
375
  return this.config.authMode === "cookie";
377
376
  }
378
377
  /**
379
- * 서버 응답의 에러 코드 확인.
378
+ * 서버 응답에서 에러 코드를 추출합니다.
380
379
  * 이중 래핑 구조: { code: 200, data: { code: 1001, message: "..." } }
381
380
  * 외부 code와 내부 data.code 모두 확인.
381
+ * 정상 응답(200)이면 null 반환.
382
382
  */
383
- checkResponseError(e, s) {
383
+ extractResponseErrorCode(e) {
384
384
  if (e != null && e.code && e.code !== 200 && e.code > 0)
385
+ return { code: e.code, message: e.message ?? "" };
386
+ const s = e == null ? void 0 : e.data;
387
+ if (typeof s == "object" && s !== null && "code" in s) {
388
+ const t = s;
389
+ if (t.code && t.code !== 200 && t.code > 0)
390
+ return { code: t.code, message: t.message ?? "" };
391
+ }
392
+ return null;
393
+ }
394
+ /**
395
+ * 서버 응답의 에러 코드 확인 (범용).
396
+ * 에러 코드가 있으면 AUTH_FAILED를 throw합니다.
397
+ */
398
+ checkResponseError(e, s) {
399
+ const t = this.extractResponseErrorCode(e);
400
+ if (t)
385
401
  throw new g(
386
402
  h.AUTH_FAILED,
387
- `${s} 실패 (코드 ${e.code}): ${e.message}`
403
+ `${s} 실패 (코드 ${t.code}): ${t.message}`
388
404
  );
389
- const t = e == null ? void 0 : e.data;
390
- if (typeof t == "object" && t !== null && "code" in t) {
391
- const n = t;
392
- if (n.code && n.code !== 200 && n.code > 0)
393
- throw new g(
394
- h.AUTH_FAILED,
395
- `${s} 실패 (코드 ${n.code}): ${n.message}`
396
- );
397
- }
398
405
  }
399
406
  async execute(e) {
400
407
  let s, t;
@@ -613,7 +620,8 @@ class zs {
613
620
  return d.warn("[CROSSx] restoreSession — 지갑 로드 실패 (세션은 유지):", t), { success: !0, user: s, tokenSignatureVerified: !1 };
614
621
  }
615
622
  } catch (e) {
616
- return d.log("[CROSSx] restoreSession 세션 복원 실패, 스토리지 정리:", e), this.tokenStore.clear(), this.useCookieAuth || await this.storage.remove(this.STORAGE_KEY_REFRESH_TOKEN), await this.storage.remove(this.STORAGE_KEY_USER), null;
623
+ const s = e instanceof g && e.code === h.SESSION_EXPIRED;
624
+ 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;
617
625
  }
618
626
  }
619
627
  silentRefresh(e) {
@@ -624,8 +632,8 @@ class zs {
624
632
  async _doSilentRefresh(e) {
625
633
  const { authApiUrl: s } = this.config, t = this.useCookieAuth, n = `${s}/cross-auth/social/refresh/simple`, i = {};
626
634
  if (!t) {
627
- const l = this.tokenStore.get() ?? "";
628
- l && (i.access_token = l), e && (i.refresh_token = e);
635
+ const u = this.tokenStore.get() ?? "";
636
+ u && (i.access_token = u), e && (i.refresh_token = e);
629
637
  }
630
638
  const o = await this.transport.request({
631
639
  url: n,
@@ -635,21 +643,27 @@ class zs {
635
643
  ...t ? { credentials: "include" } : {}
636
644
  });
637
645
  d.log("[CROSSx] silentRefresh 응답 — status:", o.status);
638
- const a = o.data;
639
- this.checkResponseError(a, "Silent refresh");
640
- const c = this.extractAccessToken(a);
641
- if (t && !c) {
646
+ const a = o.data, c = this.extractResponseErrorCode(a);
647
+ if (c) {
648
+ const u = Ye.REFRESH_RELOGIN_CODES.has(c.code);
649
+ throw new g(
650
+ u ? h.SESSION_EXPIRED : h.AUTH_FAILED,
651
+ `토큰 갱신 실패 (코드 ${c.code}): ${c.message}`
652
+ );
653
+ }
654
+ const l = this.extractAccessToken(a);
655
+ if (t && !l) {
642
656
  d.log("[CROSSx] silentRefresh 성공 (cookie 갱신)");
643
657
  return;
644
658
  }
645
- if (!c)
659
+ if (!l)
646
660
  throw new g(h.AUTH_FAILED, "토큰 자동 갱신 실패: 응답에 토큰이 없습니다");
647
- if (this.tokenStore.set(c), !t) {
648
- await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, c);
649
- const l = this.extractRefreshToken(a);
650
- l && this.config.secureStorageAvailable !== !1 && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, l);
661
+ if (this.tokenStore.set(l), !t) {
662
+ await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, l);
663
+ const u = this.extractRefreshToken(a);
664
+ u && this.config.secureStorageAvailable !== !1 && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, u);
651
665
  }
652
- return d.log("[CROSSx] silentRefresh 성공"), c;
666
+ return d.log("[CROSSx] silentRefresh 성공"), l;
653
667
  }
654
668
  /**
655
669
  * access_token을 자동 갱신합니다.
@@ -666,7 +680,7 @@ class zs {
666
680
  const e = await this.storage.get(this.STORAGE_KEY_REFRESH_TOKEN);
667
681
  return e ? !!await this.silentRefresh(e) : (d.warn("[CROSSx] refreshAccessToken: refresh_token 없음 — 갱신 불가"), !1);
668
682
  } catch (e) {
669
- return d.warn("[CROSSx] refreshAccessToken 실패:", e), !1;
683
+ return e instanceof g && 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;
670
684
  }
671
685
  }
672
686
  /**
@@ -714,13 +728,13 @@ class zs {
714
728
  if (!this._migrated) {
715
729
  this._migrated = !0;
716
730
  try {
717
- const e = await this.storage.get(Rt);
731
+ const e = await this.storage.get(Ot);
718
732
  if (!e || await this.storage.get(this.STORAGE_KEY_USER)) return;
719
733
  await this.storage.set(this.STORAGE_KEY_USER, e);
720
- const t = await this.storage.get(At);
734
+ const t = await this.storage.get(Rt);
721
735
  t && await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, t);
722
- const n = await this.storage.get(Tt);
723
- n && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, n), await this.storage.remove(Rt), await this.storage.remove(At), await this.storage.remove(Tt), d.log("[CROSSx] 스토리지 키 마이그레이션 완료 (projectId 스코프)");
736
+ const n = await this.storage.get(kt);
737
+ n && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, n), await this.storage.remove(Ot), await this.storage.remove(Rt), await this.storage.remove(kt), d.log("[CROSSx] 스토리지 키 마이그레이션 완료 (projectId 스코프)");
724
738
  } catch (e) {
725
739
  d.warn("[CROSSx] 스토리지 키 마이그레이션 실패:", e);
726
740
  }
@@ -754,8 +768,10 @@ class zs {
754
768
  }
755
769
  return d.log("[CROSSx] loadWallet 결과 — address:", t, "needsMigration:", n), { success: !0, address: t, user: e, needsMigration: n, tokenSignatureVerified: s };
756
770
  }
757
- }
758
- class js {
771
+ };
772
+ Ye.REFRESH_RELOGIN_CODES = /* @__PURE__ */ new Set([1007, 1008]);
773
+ let dt = Ye;
774
+ class Ys {
759
775
  constructor(e, s, t) {
760
776
  this.config = e, this.storage = s, this.tokenStore = t;
761
777
  const n = e.projectId;
@@ -765,7 +781,7 @@ class js {
765
781
  this.tokenStore.clear(), this.config.authMode !== "cookie" && (await this.storage.remove(this.STORAGE_KEY_ACCESS_TOKEN), await this.storage.remove(this.STORAGE_KEY_REFRESH_TOKEN)), await this.storage.remove(this.STORAGE_KEY_USER), await this.storage.clear();
766
782
  }
767
783
  }
768
- class Ys {
784
+ class Xs {
769
785
  constructor(e, s) {
770
786
  this.storage = e, this.walletProvider = s;
771
787
  }
@@ -782,7 +798,7 @@ class Ys {
782
798
  };
783
799
  }
784
800
  }
785
- class rs {
801
+ class is {
786
802
  constructor() {
787
803
  this.encryptedBytes = null, this.xorKey = null;
788
804
  }
@@ -823,7 +839,7 @@ class rs {
823
839
  return this.encryptedBytes !== null;
824
840
  }
825
841
  }
826
- class Xs {
842
+ class Js {
827
843
  constructor(e, s) {
828
844
  this.chainRegistry = e, this.transport = s, this._nextId = 1;
829
845
  }
@@ -855,7 +871,7 @@ class Xs {
855
871
  return a == null ? void 0 : a.result;
856
872
  }
857
873
  }
858
- class Js {
874
+ class Zs {
859
875
  constructor() {
860
876
  this.listeners = /* @__PURE__ */ new Map();
861
877
  }
@@ -880,9 +896,9 @@ class Js {
880
896
  }
881
897
  const Ke = {
882
898
  production: {
883
- oauthServiceUrl: "https://cross-wallet-oauth.crosstoken.io",
884
- authApiUrl: "https://cross-auth.crosstoken.io",
885
- walletGatewayUrl: "https://embedded-wallet-gateway.crosstoken.io/api/v1"
899
+ oauthServiceUrl: "https://stg-cross-wallet-oauth.crosstoken.io",
900
+ authApiUrl: "https://stg-cross-auth.crosstoken.io",
901
+ walletGatewayUrl: "https://stg-embedded-wallet-gateway.crosstoken.io/api/v1"
886
902
  },
887
903
  staging: {
888
904
  oauthServiceUrl: "https://stg-cross-wallet-oauth.crosstoken.io",
@@ -895,31 +911,31 @@ const Ke = {
895
911
  walletGatewayUrl: "https://dev-embedded-wallet-gateway.crosstoken.io/api/v1"
896
912
  }
897
913
  };
898
- function Zs(r) {
914
+ function Qs(r) {
899
915
  const e = r.environment;
900
916
  return e && e in Ke ? Ke[e] : null;
901
917
  }
902
- function Qs() {
918
+ function er() {
903
919
  try {
904
920
  if (typeof __CROSSX_CONFIG__ < "u") {
905
- const r = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e = Zs(r);
921
+ const r = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e = Qs(r);
906
922
  if (e) return e;
907
923
  }
908
924
  } catch {
909
925
  }
910
926
  return Ke.production;
911
927
  }
912
- const er = 2e3, kt = 6e4, tr = 1e3, sr = 1e4, rr = "0x77359400", Ot = "0x3B9ACA00", Pt = 130, Ct = 6, Nt = 18, Lt = 3e4, nr = 5 * 60 * 1e3, ir = 30 * 1e3;
928
+ const tr = 2e3, Pt = 6e4, sr = 1e3, rr = 1e4, nr = "0x77359400", Ct = "0x3B9ACA00", Nt = 130, Lt = 6, Dt = 18, Mt = 3e4, ir = 5 * 60 * 1e3, or = 30 * 1e3;
913
929
  function Le(r) {
914
930
  const e = r.indexOf("@");
915
931
  if (e < 0) return "***";
916
932
  const s = r.substring(0, e), t = r.substring(e);
917
933
  return s.length <= 1 ? `${s}***${t}` : `${s[0]}***${t}`;
918
934
  }
919
- const te = class te extends Js {
935
+ const te = class te extends Zs {
920
936
  constructor(e, s, t, n, i, o, a, c, l, u, p) {
921
937
  var _, f;
922
- super(), this.storage = t, this.crypto = n, this.transport = i, this.oauth = o, this.walletProvider = a, this.tokenStore = c, this.initialized = !1, this._initPromise = null, this.authenticated = !1, this.userId = null, this.address = null, this.activeWalletIndex = 0, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._verifyPinMutex = null, this._themeMediaCleanup = null, this._isRecoveringSession = !1, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = s, e.logger && It(e.logger), this.confirmation = l, this.pinStore = p ?? new rs(), this.chainRegistry = u, this.jsonRpc = new Xs(u, i), this.signInUseCase = new zs(
938
+ super(), this.storage = t, this.crypto = n, this.transport = i, this.oauth = o, this.walletProvider = a, this.tokenStore = c, this.initialized = !1, this._initPromise = null, this.authenticated = !1, this.userId = null, this.address = null, this.activeWalletIndex = 0, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._verifyPinMutex = null, this._themeMediaCleanup = null, this._isRecoveringSession = !1, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = s, e.logger && Tt(e.logger), this.confirmation = l, this.pinStore = p ?? new is(), this.chainRegistry = u, this.jsonRpc = new Js(u, i), this.signInUseCase = new dt(
923
939
  this.internalConfig,
924
940
  t,
925
941
  n,
@@ -927,7 +943,7 @@ const te = class te extends Js {
927
943
  i,
928
944
  a,
929
945
  c
930
- ), this.signOutUseCase = new js(this.internalConfig, t, c), this.migrateWalletUseCase = new Ys(t, a), (_ = a.setOnUnauthorized) == null || _.call(a, () => this.forceLogout()), (f = a.setTokenRefresher) == null || f.call(
946
+ ), this.signOutUseCase = new Ys(this.internalConfig, t, c), this.migrateWalletUseCase = new Xs(t, a), (_ = a.setOnUnauthorized) == null || _.call(a, () => this.forceLogout()), (f = a.setTokenRefresher) == null || f.call(
931
947
  a,
932
948
  () => this.signInUseCase.refreshAccessToken()
933
949
  ), e.autoDetectTheme && this._setupAutoDetectTheme();
@@ -956,9 +972,9 @@ const te = class te extends Js {
956
972
  }
957
973
  async _doInitialize(e) {
958
974
  var s, t;
959
- d.log("[CROSSx SDK] v1.4.0 초기화 중..."), this.confirmation.setMessages(fe(this._config.locale));
975
+ d.log("[CROSSx SDK] v1.4.1 초기화 중..."), this.confirmation.setMessages(fe(this._config.locale));
960
976
  try {
961
- const n = Qs();
977
+ const n = er();
962
978
  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`);
963
979
  const i = await this.signInUseCase.restoreSession();
964
980
  if (i != null && i.success) {
@@ -971,7 +987,7 @@ const te = class te extends Js {
971
987
  d.log("[CROSSx] initialize: 비밀번호 입력 취소 — 지갑 미로드 상태로 계속");
972
988
  }
973
989
  }
974
- return this.initialized = !0, d.info("[CROSSx SDK] v1.4.0 초기화 완료"), this.emit("initialized", { restored: !!(i != null && i.success) }), i ?? null;
990
+ return this.initialized = !0, d.info("[CROSSx SDK] v1.4.1 초기화 완료"), this.emit("initialized", { restored: !!(i != null && i.success) }), i ?? null;
975
991
  } catch (n) {
976
992
  throw new g(h.AUTH_NOT_INITIALIZED, "SDK 초기화에 실패했습니다", n);
977
993
  }
@@ -1611,7 +1627,7 @@ const te = class te extends Js {
1611
1627
  throw new g(h.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1612
1628
  const n = await this.withResolvedGasAndFee(s, e);
1613
1629
  n.from || (n.from = (await this.resolveAddress(t == null ? void 0 : t.index)).address);
1614
- const i = Qe(e);
1630
+ const i = et(e);
1615
1631
  if (!await this.confirmation.requestConfirmation({
1616
1632
  type: "sign",
1617
1633
  chainId: e,
@@ -1669,7 +1685,7 @@ const te = class te extends Js {
1669
1685
  throw new g(h.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1670
1686
  const n = await this.withResolvedGasAndFee(s, e);
1671
1687
  n.from || (n.from = (await this.resolveAddress(t == null ? void 0 : t.index)).address);
1672
- const i = Qe(e);
1688
+ const i = et(e);
1673
1689
  if (!await this.confirmation.requestConfirmation({
1674
1690
  type: "send",
1675
1691
  chainId: e,
@@ -1736,7 +1752,7 @@ const te = class te extends Js {
1736
1752
  * @param opts.timeoutMs 최대 대기 시간 (기본 60000ms)
1737
1753
  */
1738
1754
  async waitForTxAndGetReceipt(e, s, t = {}) {
1739
- const n = t.intervalMs ?? tr, i = sr, o = t.timeoutMs ?? kt, a = Date.now() + o;
1755
+ const n = t.intervalMs ?? sr, i = rr, o = t.timeoutMs ?? Pt, a = Date.now() + o;
1740
1756
  let c = n;
1741
1757
  for (; Date.now() < a; ) {
1742
1758
  const l = await this.getTransactionReceipt(e, s);
@@ -1765,11 +1781,11 @@ const te = class te extends Js {
1765
1781
  */
1766
1782
  async sendTransactionWithWaitForReceipt(e, s, t = {}) {
1767
1783
  var S, y;
1768
- const { intervalMs: n, timeoutMs: i, ...o } = t, { txHash: a } = await this.sendTransaction(e, s, o), c = n ?? ((S = this._config.receiptPolling) == null ? void 0 : S.intervalMs) ?? er, l = i ?? ((y = this._config.receiptPolling) == null ? void 0 : y.timeoutMs) ?? kt, u = Qe(e), p = s.from ?? "";
1784
+ const { intervalMs: n, timeoutMs: i, ...o } = t, { txHash: a } = await this.sendTransaction(e, s, o), c = n ?? ((S = this._config.receiptPolling) == null ? void 0 : S.intervalMs) ?? tr, l = i ?? ((y = this._config.receiptPolling) == null ? void 0 : y.timeoutMs) ?? Pt, u = et(e), p = s.from ?? "";
1769
1785
  let _, f;
1770
1786
  const w = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((I) => {
1771
1787
  _ = I;
1772
- const P = BigInt(I.gasUsed) * BigInt(I.effectiveGasPrice), H = s.value ? BigInt(s.value) : 0n, D = te.formatTxAmount(s.value, u.symbol, u.decimals), K = te.formatTxAmount("0x" + P.toString(16), u.symbol, u.decimals), W = te.formatTxAmount("0x" + (H + P).toString(16), u.symbol, u.decimals);
1788
+ const P = BigInt(I.gasUsed) * BigInt(I.effectiveGasPrice), H = s.value ? BigInt(s.value) : 0n, D = te.formatTxAmount(s.value, u.symbol, u.decimals), K = te.formatTxAmount("0x" + P.toString(16), u.symbol, u.decimals), G = te.formatTxAmount("0x" + (H + P).toString(16), u.symbol, u.decimals);
1773
1789
  return {
1774
1790
  chainId: e,
1775
1791
  txHash: a,
@@ -1777,7 +1793,7 @@ const te = class te extends Js {
1777
1793
  to: I.to ?? s.to,
1778
1794
  amount: D,
1779
1795
  fees: K,
1780
- total: W,
1796
+ total: G,
1781
1797
  nativeSymbol: u.symbol,
1782
1798
  status: I.status === "0x1" ? "success" : "reverted"
1783
1799
  };
@@ -1976,7 +1992,7 @@ const te = class te extends Js {
1976
1992
  try {
1977
1993
  const s = BigInt(e);
1978
1994
  if (s === 0n) return "0";
1979
- const t = 10n ** BigInt(Nt), n = s / t, o = (s % t).toString().padStart(Nt, "0").replace(/0+$/, "").slice(0, Ct);
1995
+ const t = 10n ** BigInt(Dt), n = s / t, o = (s % t).toString().padStart(Dt, "0").replace(/0+$/, "").slice(0, Lt);
1980
1996
  return o ? `${n}.${o}` : `${n}`;
1981
1997
  } catch {
1982
1998
  return "?";
@@ -2001,7 +2017,7 @@ const te = class te extends Js {
2001
2017
  * const client = createWalletClient({ transport: custom(provider) });
2002
2018
  */
2003
2019
  getProvider(e) {
2004
- return this.ensureAuthenticated(), new qs(this, e);
2020
+ return this.ensureAuthenticated(), new Vs(this, e);
2005
2021
  }
2006
2022
  /**
2007
2023
  * 범용 JSON-RPC 요청 — 노드에 직접 연결.
@@ -2035,7 +2051,7 @@ const te = class te extends Js {
2035
2051
  try {
2036
2052
  const n = BigInt(e);
2037
2053
  if (n === 0n) return;
2038
- const i = 10n ** BigInt(t), o = n / i, c = (n % i).toString().padStart(t, "0").slice(0, Ct).replace(/0+$/, "");
2054
+ const i = 10n ** BigInt(t), o = n / i, c = (n % i).toString().padStart(t, "0").slice(0, Lt).replace(/0+$/, "");
2039
2055
  return `${c ? `${o}.${c}` : `${o}`} ${s}`;
2040
2056
  } catch {
2041
2057
  return;
@@ -2163,12 +2179,12 @@ const te = class te extends Js {
2163
2179
  if (l && (c.nonce = parseInt(u ?? "0x0", 16), d.log("[CROSSx] nonce 결과:", c.nonce)), i && (c.gasLimit = p, d.log("[CROSSx] estimateGas 결과:", c.gasLimit)), o) {
2164
2180
  const f = _;
2165
2181
  if (f) {
2166
- const w = Ot;
2182
+ const w = Ct;
2167
2183
  c.maxFeePerGas = "0x" + (BigInt(f) + BigInt(w)).toString(16), c.maxPriorityFeePerGas = w, d.log("[CROSSx] Dynamic 체인 감지 — baseFee:", f, "maxFeePerGas:", c.maxFeePerGas, "maxPriorityFeePerGas: 1 Gwei");
2168
2184
  } else
2169
- c.gasPrice = rr, d.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
2185
+ c.gasPrice = nr, d.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
2170
2186
  }
2171
- return !o && a && (c.maxPriorityFeePerGas = Ot, d.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), c;
2187
+ return !o && a && (c.maxPriorityFeePerGas = Ct, d.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), c;
2172
2188
  }
2173
2189
  /**
2174
2190
  * EIP-712 signTypedData 호출 시 chainId와 typedData.domain.chainId 정합성 검증.
@@ -2215,10 +2231,10 @@ const te = class te extends Js {
2215
2231
  const s = e.startsWith("0x") ? e.slice(2) : e;
2216
2232
  if (!/^[0-9a-fA-F]+$/.test(s))
2217
2233
  throw new g(h.SIGNATURE_FAILED, "유효하지 않은 서명: 올바른 hex 문자열이 아닙니다");
2218
- if (s.length !== Pt)
2234
+ if (s.length !== Nt)
2219
2235
  throw new g(
2220
2236
  h.SIGNATURE_FAILED,
2221
- `서명 길이가 유효하지 않습니다: ${Pt} hex 문자(65 바이트) 예상, 현재 ${s.length}`
2237
+ `서명 길이가 유효하지 않습니다: ${Nt} hex 문자(65 바이트) 예상, 현재 ${s.length}`
2222
2238
  );
2223
2239
  }
2224
2240
  /** RLP-encoded signed transaction 형식 검증 */
@@ -2620,7 +2636,7 @@ const te = class te extends Js {
2620
2636
  */
2621
2637
  dispose() {
2622
2638
  var e;
2623
- (e = this._themeMediaCleanup) == null || e.call(this), this._themeMediaCleanup = null, this.clearAuthState(), this.tokenStore.clear(), this.pinStore.clear(), this.initialized = !1, this.removeAllListeners(), It(null);
2639
+ (e = this._themeMediaCleanup) == null || e.call(this), this._themeMediaCleanup = null, this.clearAuthState(), this.tokenStore.clear(), this.pinStore.clear(), this.initialized = !1, this.removeAllListeners(), Tt(null);
2624
2640
  }
2625
2641
  /**
2626
2642
  * @internal internal 패키지 전용 — 공개 문서에 기재하지 않음
@@ -2641,8 +2657,8 @@ const te = class te extends Js {
2641
2657
  }
2642
2658
  };
2643
2659
  te.OFFCHAIN_CHAIN_ID = "0";
2644
- let lt = te;
2645
- class or {
2660
+ let ut = te;
2661
+ class ar {
2646
2662
  constructor() {
2647
2663
  this.prefix = "crossx_";
2648
2664
  }
@@ -2679,8 +2695,8 @@ class or {
2679
2695
  }
2680
2696
  }
2681
2697
  }
2682
- const et = "crossx-sdk", ar = 1, he = "data", Ee = "keys", Ue = "aes-primary", cr = 12;
2683
- class Dt {
2698
+ const tt = "crossx-sdk", cr = 1, he = "data", Ee = "keys", Ue = "aes-primary", lr = 12;
2699
+ class $t {
2684
2700
  constructor(e) {
2685
2701
  this.db = null, this.cryptoKey = null, this.initPromise = null, this.dbName = `crossx-sdk-${e}`;
2686
2702
  }
@@ -2689,7 +2705,7 @@ class Dt {
2689
2705
  }
2690
2706
  openDB(e = this.dbName) {
2691
2707
  return new Promise((s, t) => {
2692
- const n = indexedDB.open(e, ar);
2708
+ const n = indexedDB.open(e, cr);
2693
2709
  n.onupgradeneeded = () => {
2694
2710
  const i = n.result;
2695
2711
  i.objectStoreNames.contains(he) || i.createObjectStore(he), i.objectStoreNames.contains(Ee) || i.createObjectStore(Ee);
@@ -2743,9 +2759,9 @@ class Dt {
2743
2759
  * 마이그레이션 성공 시 레거시 DB 삭제.
2744
2760
  */
2745
2761
  async migrateFromLegacyDB() {
2746
- if (this.dbName === et) return null;
2762
+ if (this.dbName === tt) return null;
2747
2763
  try {
2748
- const e = await this.openDB(et), s = e.transaction([Ee, he], "readonly"), t = s.objectStore(Ee).get(Ue), n = await new Promise((l, u) => {
2764
+ const e = await this.openDB(tt), s = e.transaction([Ee, he], "readonly"), t = s.objectStore(Ee).get(Ue), n = await new Promise((l, u) => {
2749
2765
  t.onsuccess = () => l(t.result), t.onerror = () => u(t.error);
2750
2766
  });
2751
2767
  if (!n)
@@ -2761,13 +2777,13 @@ class Dt {
2761
2777
  e.close(), await this.idbPut(Ee, Ue, n);
2762
2778
  for (let l = 0; l < c.length; l++)
2763
2779
  await this.idbPut(he, String(c[l]), a[l]);
2764
- return indexedDB.deleteDatabase(et), d.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), n;
2780
+ return indexedDB.deleteDatabase(tt), d.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), n;
2765
2781
  } catch (e) {
2766
2782
  return d.warn("[CROSSx] IndexedDB 레거시 DB 마이그레이션 실패:", e), null;
2767
2783
  }
2768
2784
  }
2769
2785
  async encrypt(e) {
2770
- const s = new Uint8Array(cr);
2786
+ const s = new Uint8Array(lr);
2771
2787
  crypto.getRandomValues(s);
2772
2788
  const t = new TextEncoder().encode(e), n = await crypto.subtle.encrypt(
2773
2789
  { name: "AES-GCM", iv: s },
@@ -2826,7 +2842,7 @@ class Dt {
2826
2842
  }
2827
2843
  }
2828
2844
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2829
- function ft(r) {
2845
+ function xt(r) {
2830
2846
  return r instanceof Uint8Array || ArrayBuffer.isView(r) && r.constructor.name === "Uint8Array";
2831
2847
  }
2832
2848
  function we(r, e = "") {
@@ -2836,14 +2852,14 @@ function we(r, e = "") {
2836
2852
  }
2837
2853
  }
2838
2854
  function q(r, e, s = "") {
2839
- const t = ft(r), n = r == null ? void 0 : r.length, i = e !== void 0;
2855
+ const t = xt(r), n = r == null ? void 0 : r.length, i = e !== void 0;
2840
2856
  if (!t || i && n !== e) {
2841
2857
  const o = s && `"${s}" `, a = i ? ` of length ${e}` : "", c = t ? `length=${n}` : `type=${typeof r}`;
2842
2858
  throw new Error(o + "expected Uint8Array" + a + ", got " + c);
2843
2859
  }
2844
2860
  return r;
2845
2861
  }
2846
- function ns(r) {
2862
+ function os(r) {
2847
2863
  if (typeof r != "function" || typeof r.create != "function")
2848
2864
  throw new Error("Hash must wrapped by utils.createHasher");
2849
2865
  we(r.outputLen), we(r.blockLen);
@@ -2854,45 +2870,45 @@ function Pe(r, e = !0) {
2854
2870
  if (e && r.finished)
2855
2871
  throw new Error("Hash#digest() has already been called");
2856
2872
  }
2857
- function is(r, e) {
2873
+ function as(r, e) {
2858
2874
  q(r, void 0, "digestInto() output");
2859
2875
  const s = e.outputLen;
2860
2876
  if (r.length < s)
2861
2877
  throw new Error('"digestInto() output" expected to be of length >=' + s);
2862
2878
  }
2863
- function lr(r) {
2879
+ function dr(r) {
2864
2880
  return new Uint32Array(r.buffer, r.byteOffset, Math.floor(r.byteLength / 4));
2865
2881
  }
2866
2882
  function Ce(...r) {
2867
2883
  for (let e = 0; e < r.length; e++)
2868
2884
  r[e].fill(0);
2869
2885
  }
2870
- function tt(r) {
2886
+ function st(r) {
2871
2887
  return new DataView(r.buffer, r.byteOffset, r.byteLength);
2872
2888
  }
2873
2889
  function pe(r, e) {
2874
2890
  return r << 32 - e | r >>> e;
2875
2891
  }
2876
- const dr = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
2877
- function ur(r) {
2892
+ const ur = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
2893
+ function hr(r) {
2878
2894
  return r << 24 & 4278190080 | r << 8 & 16711680 | r >>> 8 & 65280 | r >>> 24 & 255;
2879
2895
  }
2880
- function hr(r) {
2896
+ function pr(r) {
2881
2897
  for (let e = 0; e < r.length; e++)
2882
- r[e] = ur(r[e]);
2898
+ r[e] = hr(r[e]);
2883
2899
  return r;
2884
2900
  }
2885
- const Mt = dr ? (r) => r : hr, os = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", pr = /* @__PURE__ */ Array.from({ length: 256 }, (r, e) => e.toString(16).padStart(2, "0"));
2901
+ 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"));
2886
2902
  function Be(r) {
2887
- if (q(r), os)
2903
+ if (q(r), cs)
2888
2904
  return r.toHex();
2889
2905
  let e = "";
2890
2906
  for (let s = 0; s < r.length; s++)
2891
- e += pr[r[s]];
2907
+ e += fr[r[s]];
2892
2908
  return e;
2893
2909
  }
2894
2910
  const _e = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
2895
- function $t(r) {
2911
+ function Ut(r) {
2896
2912
  if (r >= _e._0 && r <= _e._9)
2897
2913
  return r - _e._0;
2898
2914
  if (r >= _e.A && r <= _e.F)
@@ -2903,14 +2919,14 @@ function $t(r) {
2903
2919
  function Ve(r) {
2904
2920
  if (typeof r != "string")
2905
2921
  throw new Error("hex string expected, got " + typeof r);
2906
- if (os)
2922
+ if (cs)
2907
2923
  return Uint8Array.fromHex(r);
2908
2924
  const e = r.length, s = e / 2;
2909
2925
  if (e % 2)
2910
2926
  throw new Error("hex string expected, got unpadded hex of length " + e);
2911
2927
  const t = new Uint8Array(s);
2912
2928
  for (let n = 0, i = 0; n < s; n++, i += 2) {
2913
- const o = $t(r.charCodeAt(i)), a = $t(r.charCodeAt(i + 1));
2929
+ const o = Ut(r.charCodeAt(i)), a = Ut(r.charCodeAt(i + 1));
2914
2930
  if (o === void 0 || a === void 0) {
2915
2931
  const c = r[i] + r[i + 1];
2916
2932
  throw new Error('hex string expected, got non-hex character "' + c + '" at index ' + i);
@@ -2932,26 +2948,26 @@ function ve(...r) {
2932
2948
  }
2933
2949
  return s;
2934
2950
  }
2935
- function as(r, e = {}) {
2951
+ function ls(r, e = {}) {
2936
2952
  const s = (n, i) => r(i).update(n).digest(), t = r(void 0);
2937
2953
  return s.outputLen = t.outputLen, s.blockLen = t.blockLen, s.create = (n) => r(n), Object.assign(s, e), Object.freeze(s);
2938
2954
  }
2939
- function cs(r = 32) {
2955
+ function ds(r = 32) {
2940
2956
  const e = typeof globalThis == "object" ? globalThis.crypto : null;
2941
2957
  if (typeof (e == null ? void 0 : e.getRandomValues) != "function")
2942
2958
  throw new Error("crypto.getRandomValues must be defined");
2943
2959
  return e.getRandomValues(new Uint8Array(r));
2944
2960
  }
2945
- const fr = (r) => ({
2961
+ const _r = (r) => ({
2946
2962
  oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, r])
2947
2963
  });
2948
- function _r(r, e, s) {
2964
+ function xr(r, e, s) {
2949
2965
  return r & e ^ ~r & s;
2950
2966
  }
2951
- function xr(r, e, s) {
2967
+ function gr(r, e, s) {
2952
2968
  return r & e ^ r & s ^ e & s;
2953
2969
  }
2954
- class gr {
2970
+ class mr {
2955
2971
  constructor(e, s, t, n) {
2956
2972
  R(this, "blockLen");
2957
2973
  R(this, "outputLen");
@@ -2964,7 +2980,7 @@ class gr {
2964
2980
  R(this, "length", 0);
2965
2981
  R(this, "pos", 0);
2966
2982
  R(this, "destroyed", !1);
2967
- this.blockLen = e, this.outputLen = s, this.padOffset = t, this.isLE = n, this.buffer = new Uint8Array(e), this.view = tt(this.buffer);
2983
+ this.blockLen = e, this.outputLen = s, this.padOffset = t, this.isLE = n, this.buffer = new Uint8Array(e), this.view = st(this.buffer);
2968
2984
  }
2969
2985
  update(e) {
2970
2986
  Pe(this), q(e);
@@ -2972,7 +2988,7 @@ class gr {
2972
2988
  for (let o = 0; o < i; ) {
2973
2989
  const a = Math.min(n - this.pos, i - o);
2974
2990
  if (a === n) {
2975
- const c = tt(e);
2991
+ const c = st(e);
2976
2992
  for (; n <= i - o; o += n)
2977
2993
  this.process(c, o);
2978
2994
  continue;
@@ -2982,14 +2998,14 @@ class gr {
2982
2998
  return this.length += e.length, this.roundClean(), this;
2983
2999
  }
2984
3000
  digestInto(e) {
2985
- Pe(this), is(e, this), this.finished = !0;
3001
+ Pe(this), as(e, this), this.finished = !0;
2986
3002
  const { buffer: s, view: t, blockLen: n, isLE: i } = this;
2987
3003
  let { pos: o } = this;
2988
3004
  s[o++] = 128, Ce(this.buffer.subarray(o)), this.padOffset > n - o && (this.process(t, 0), o = 0);
2989
3005
  for (let p = o; p < n; p++)
2990
3006
  s[p] = 0;
2991
3007
  t.setBigUint64(n - 8, BigInt(this.length * 8), i), this.process(t, 0);
2992
- const a = tt(e), c = this.outputLen;
3008
+ const a = st(e), c = this.outputLen;
2993
3009
  if (c % 4)
2994
3010
  throw new Error("_sha2: outputLen must be aligned to 32bit");
2995
3011
  const l = c / 4, u = this.get();
@@ -3022,20 +3038,20 @@ const ye = /* @__PURE__ */ Uint32Array.from([
3022
3038
  2600822924,
3023
3039
  528734635,
3024
3040
  1541459225
3025
- ]), He = /* @__PURE__ */ BigInt(2 ** 32 - 1), Bt = /* @__PURE__ */ BigInt(32);
3026
- function mr(r, e = !1) {
3027
- return e ? { h: Number(r & He), l: Number(r >> Bt & He) } : { h: Number(r >> Bt & He) | 0, l: Number(r & He) | 0 };
3028
- }
3041
+ ]), He = /* @__PURE__ */ BigInt(2 ** 32 - 1), Ht = /* @__PURE__ */ BigInt(32);
3029
3042
  function wr(r, e = !1) {
3043
+ return e ? { h: Number(r & He), l: Number(r >> Ht & He) } : { h: Number(r >> Ht & He) | 0, l: Number(r & He) | 0 };
3044
+ }
3045
+ function yr(r, e = !1) {
3030
3046
  const s = r.length;
3031
3047
  let t = new Uint32Array(s), n = new Uint32Array(s);
3032
3048
  for (let i = 0; i < s; i++) {
3033
- const { h: o, l: a } = mr(r[i], e);
3049
+ const { h: o, l: a } = wr(r[i], e);
3034
3050
  [t[i], n[i]] = [o, a];
3035
3051
  }
3036
3052
  return [t, n];
3037
3053
  }
3038
- const yr = (r, e, s) => r << s | e >>> 32 - s, br = (r, e, s) => e << s | r >>> 32 - s, Sr = (r, e, s) => e << s - 32 | r >>> 64 - s, vr = (r, e, s) => r << s - 32 | e >>> 64 - s, Er = /* @__PURE__ */ Uint32Array.from([
3054
+ const br = (r, e, s) => r << s | e >>> 32 - s, Sr = (r, e, s) => e << s | r >>> 32 - s, vr = (r, e, s) => e << s - 32 | r >>> 64 - s, Er = (r, e, s) => r << s - 32 | e >>> 64 - s, Ir = /* @__PURE__ */ Uint32Array.from([
3039
3055
  1116352408,
3040
3056
  1899447441,
3041
3057
  3049323471,
@@ -3101,7 +3117,7 @@ const yr = (r, e, s) => r << s | e >>> 32 - s, br = (r, e, s) => e << s | r >>>
3101
3117
  3204031479,
3102
3118
  3329325298
3103
3119
  ]), be = /* @__PURE__ */ new Uint32Array(64);
3104
- class Ir extends gr {
3120
+ class Ar extends mr {
3105
3121
  constructor(e) {
3106
3122
  super(64, e, 8, !1);
3107
3123
  }
@@ -3122,7 +3138,7 @@ class Ir extends gr {
3122
3138
  }
3123
3139
  let { A: t, B: n, C: i, D: o, E: a, F: c, G: l, H: u } = this;
3124
3140
  for (let p = 0; p < 64; p++) {
3125
- const _ = pe(a, 6) ^ pe(a, 11) ^ pe(a, 25), f = u + _ + _r(a, c, l) + Er[p] + be[p] | 0, S = (pe(t, 2) ^ pe(t, 13) ^ pe(t, 22)) + xr(t, n, i) | 0;
3141
+ const _ = pe(a, 6) ^ pe(a, 11) ^ pe(a, 25), f = u + _ + xr(a, c, l) + Ir[p] + be[p] | 0, S = (pe(t, 2) ^ pe(t, 13) ^ pe(t, 22)) + gr(t, n, i) | 0;
3126
3142
  u = l, l = c, c = a, a = o + f | 0, o = i, i = n, n = t, t = f + S | 0;
3127
3143
  }
3128
3144
  t = t + this.A | 0, n = n + this.B | 0, i = i + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, u = u + this.H | 0, this.set(t, n, i, o, a, c, l, u);
@@ -3134,7 +3150,7 @@ class Ir extends gr {
3134
3150
  this.set(0, 0, 0, 0, 0, 0, 0, 0), Ce(this.buffer);
3135
3151
  }
3136
3152
  }
3137
- class Ar extends Ir {
3153
+ class Tr extends Ar {
3138
3154
  constructor() {
3139
3155
  super(32);
3140
3156
  // We cannot use array here since array allows indexing by variable
@@ -3149,12 +3165,12 @@ class Ar extends Ir {
3149
3165
  R(this, "H", ye[7] | 0);
3150
3166
  }
3151
3167
  }
3152
- const Tr = /* @__PURE__ */ as(
3153
- () => new Ar(),
3154
- /* @__PURE__ */ fr(1)
3168
+ const Rr = /* @__PURE__ */ ls(
3169
+ () => new Tr(),
3170
+ /* @__PURE__ */ _r(1)
3155
3171
  );
3156
3172
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3157
- const _t = /* @__PURE__ */ BigInt(0), dt = /* @__PURE__ */ BigInt(1);
3173
+ const gt = /* @__PURE__ */ BigInt(0), ht = /* @__PURE__ */ BigInt(1);
3158
3174
  function ze(r, e = "") {
3159
3175
  if (typeof r != "boolean") {
3160
3176
  const s = e && `"${e}" `;
@@ -3162,7 +3178,7 @@ function ze(r, e = "") {
3162
3178
  }
3163
3179
  return r;
3164
3180
  }
3165
- function ls(r) {
3181
+ function us(r) {
3166
3182
  if (typeof r == "bigint") {
3167
3183
  if (!qe(r))
3168
3184
  throw new Error("positive bigint expected, got " + r);
@@ -3171,49 +3187,49 @@ function ls(r) {
3171
3187
  return r;
3172
3188
  }
3173
3189
  function Fe(r) {
3174
- const e = ls(r).toString(16);
3190
+ const e = us(r).toString(16);
3175
3191
  return e.length & 1 ? "0" + e : e;
3176
3192
  }
3177
- function ds(r) {
3193
+ function hs(r) {
3178
3194
  if (typeof r != "string")
3179
3195
  throw new Error("hex string expected, got " + typeof r);
3180
- return r === "" ? _t : BigInt("0x" + r);
3196
+ return r === "" ? gt : BigInt("0x" + r);
3181
3197
  }
3182
- function Xe(r) {
3183
- return ds(Be(r));
3198
+ function Je(r) {
3199
+ return hs(Be(r));
3184
3200
  }
3185
- function us(r) {
3186
- return ds(Be(Rr(q(r)).reverse()));
3201
+ function ps(r) {
3202
+ return hs(Be(kr(q(r)).reverse()));
3187
3203
  }
3188
- function xt(r, e) {
3189
- we(e), r = ls(r);
3204
+ function mt(r, e) {
3205
+ we(e), r = us(r);
3190
3206
  const s = Ve(r.toString(16).padStart(e * 2, "0"));
3191
3207
  if (s.length !== e)
3192
3208
  throw new Error("number too large");
3193
3209
  return s;
3194
3210
  }
3195
- function hs(r, e) {
3196
- return xt(r, e).reverse();
3211
+ function fs(r, e) {
3212
+ return mt(r, e).reverse();
3197
3213
  }
3198
- function Rr(r) {
3214
+ function kr(r) {
3199
3215
  return Uint8Array.from(r);
3200
3216
  }
3201
- const qe = (r) => typeof r == "bigint" && _t <= r;
3202
- function kr(r, e, s) {
3217
+ const qe = (r) => typeof r == "bigint" && gt <= r;
3218
+ function Or(r, e, s) {
3203
3219
  return qe(r) && qe(e) && qe(s) && e <= r && r < s;
3204
3220
  }
3205
- function Or(r, e, s, t) {
3206
- if (!kr(e, s, t))
3221
+ function Pr(r, e, s, t) {
3222
+ if (!Or(e, s, t))
3207
3223
  throw new Error("expected valid " + r + ": " + s + " <= n < " + t + ", got " + e);
3208
3224
  }
3209
- function Pr(r) {
3225
+ function Cr(r) {
3210
3226
  let e;
3211
- for (e = 0; r > _t; r >>= dt, e += 1)
3227
+ for (e = 0; r > gt; r >>= ht, e += 1)
3212
3228
  ;
3213
3229
  return e;
3214
3230
  }
3215
- const gt = (r) => (dt << BigInt(r)) - dt;
3216
- function Cr(r, e, s) {
3231
+ const wt = (r) => (ht << BigInt(r)) - ht;
3232
+ function Nr(r, e, s) {
3217
3233
  if (we(r, "hashLen"), we(e, "qByteLen"), typeof s != "function")
3218
3234
  throw new Error("hmacFn must be a function");
3219
3235
  const t = (y) => new Uint8Array(y), n = Uint8Array.of(), i = Uint8Array.of(0), o = Uint8Array.of(1), a = 1e3;
@@ -3242,7 +3258,7 @@ function Cr(r, e, s) {
3242
3258
  return p(), P;
3243
3259
  };
3244
3260
  }
3245
- function mt(r, e = {}, s = {}) {
3261
+ function yt(r, e = {}, s = {}) {
3246
3262
  if (!r || typeof r != "object")
3247
3263
  throw new Error("expected valid options object");
3248
3264
  function t(i, o, a) {
@@ -3256,7 +3272,7 @@ function mt(r, e = {}, s = {}) {
3256
3272
  const n = (i, o) => Object.entries(i).forEach(([a, c]) => t(a, c, o));
3257
3273
  n(e, !1), n(s, !0);
3258
3274
  }
3259
- function Ut(r) {
3275
+ function Ft(r) {
3260
3276
  const e = /* @__PURE__ */ new WeakMap();
3261
3277
  return (s, ...t) => {
3262
3278
  const n = e.get(s);
@@ -3267,7 +3283,7 @@ function Ut(r) {
3267
3283
  };
3268
3284
  }
3269
3285
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3270
- const ne = /* @__PURE__ */ BigInt(0), se = /* @__PURE__ */ BigInt(1), Te = /* @__PURE__ */ BigInt(2), ps = /* @__PURE__ */ BigInt(3), fs = /* @__PURE__ */ BigInt(4), _s = /* @__PURE__ */ BigInt(5), Nr = /* @__PURE__ */ BigInt(7), xs = /* @__PURE__ */ BigInt(8), Lr = /* @__PURE__ */ BigInt(9), gs = /* @__PURE__ */ BigInt(16);
3286
+ const ne = /* @__PURE__ */ BigInt(0), se = /* @__PURE__ */ BigInt(1), Te = /* @__PURE__ */ BigInt(2), _s = /* @__PURE__ */ BigInt(3), xs = /* @__PURE__ */ BigInt(4), gs = /* @__PURE__ */ BigInt(5), Lr = /* @__PURE__ */ BigInt(7), ms = /* @__PURE__ */ BigInt(8), Dr = /* @__PURE__ */ BigInt(9), ws = /* @__PURE__ */ BigInt(16);
3271
3287
  function ue(r, e) {
3272
3288
  const s = r % e;
3273
3289
  return s >= ne ? s : e + s;
@@ -3278,7 +3294,7 @@ function ce(r, e, s) {
3278
3294
  t *= t, t %= s;
3279
3295
  return t;
3280
3296
  }
3281
- function Ht(r, e) {
3297
+ function Gt(r, e) {
3282
3298
  if (r === ne)
3283
3299
  throw new Error("invert: expected non-zero number");
3284
3300
  if (e <= ne)
@@ -3292,47 +3308,47 @@ function Ht(r, e) {
3292
3308
  throw new Error("invert: does not exist");
3293
3309
  return ue(n, e);
3294
3310
  }
3295
- function wt(r, e, s) {
3311
+ function bt(r, e, s) {
3296
3312
  if (!r.eql(r.sqr(e), s))
3297
3313
  throw new Error("Cannot find square root");
3298
3314
  }
3299
- function ms(r, e) {
3300
- const s = (r.ORDER + se) / fs, t = r.pow(e, s);
3301
- return wt(r, t, e), t;
3315
+ function ys(r, e) {
3316
+ const s = (r.ORDER + se) / xs, t = r.pow(e, s);
3317
+ return bt(r, t, e), t;
3302
3318
  }
3303
- function Dr(r, e) {
3304
- const s = (r.ORDER - _s) / xs, t = r.mul(e, Te), n = r.pow(t, s), i = r.mul(e, n), o = r.mul(r.mul(i, Te), n), a = r.mul(i, r.sub(o, r.ONE));
3305
- return wt(r, a, e), a;
3319
+ function Mr(r, e) {
3320
+ const s = (r.ORDER - gs) / ms, t = r.mul(e, Te), n = r.pow(t, s), i = r.mul(e, n), o = r.mul(r.mul(i, Te), n), a = r.mul(i, r.sub(o, r.ONE));
3321
+ return bt(r, a, e), a;
3306
3322
  }
3307
- function Mr(r) {
3308
- const e = Je(r), s = ws(r), t = s(e, e.neg(e.ONE)), n = s(e, t), i = s(e, e.neg(t)), o = (r + Nr) / gs;
3323
+ function $r(r) {
3324
+ const e = Ze(r), s = bs(r), t = s(e, e.neg(e.ONE)), n = s(e, t), i = s(e, e.neg(t)), o = (r + Lr) / ws;
3309
3325
  return (a, c) => {
3310
3326
  let l = a.pow(c, o), u = a.mul(l, t);
3311
3327
  const p = a.mul(l, n), _ = a.mul(l, i), f = a.eql(a.sqr(u), c), w = a.eql(a.sqr(p), c);
3312
3328
  l = a.cmov(l, u, f), u = a.cmov(_, p, w);
3313
3329
  const S = a.eql(a.sqr(u), c), y = a.cmov(l, u, S);
3314
- return wt(a, y, c), y;
3330
+ return bt(a, y, c), y;
3315
3331
  };
3316
3332
  }
3317
- function ws(r) {
3318
- if (r < ps)
3333
+ function bs(r) {
3334
+ if (r < _s)
3319
3335
  throw new Error("sqrt is not defined for small field");
3320
3336
  let e = r - se, s = 0;
3321
3337
  for (; e % Te === ne; )
3322
3338
  e /= Te, s++;
3323
3339
  let t = Te;
3324
- const n = Je(r);
3325
- for (; Ft(n, t) === 1; )
3340
+ const n = Ze(r);
3341
+ for (; Wt(n, t) === 1; )
3326
3342
  if (t++ > 1e3)
3327
3343
  throw new Error("Cannot find square root: probably non-prime P");
3328
3344
  if (s === 1)
3329
- return ms;
3345
+ return ys;
3330
3346
  let i = n.pow(t, e);
3331
3347
  const o = (e + se) / Te;
3332
3348
  return function(c, l) {
3333
3349
  if (c.is0(l))
3334
3350
  return l;
3335
- if (Ft(c, l) !== 1)
3351
+ if (Wt(c, l) !== 1)
3336
3352
  throw new Error("Cannot find square root");
3337
3353
  let u = s, p = c.mul(c.ONE, i), _ = c.pow(l, e), f = c.pow(l, o);
3338
3354
  for (; !c.eql(_, c.ONE); ) {
@@ -3348,10 +3364,10 @@ function ws(r) {
3348
3364
  return f;
3349
3365
  };
3350
3366
  }
3351
- function $r(r) {
3352
- return r % fs === ps ? ms : r % xs === _s ? Dr : r % gs === Lr ? Mr(r) : ws(r);
3367
+ function Br(r) {
3368
+ return r % xs === _s ? ys : r % ms === gs ? Mr : r % ws === Dr ? $r(r) : bs(r);
3353
3369
  }
3354
- const Br = [
3370
+ const Ur = [
3355
3371
  "create",
3356
3372
  "isValid",
3357
3373
  "is0",
@@ -3370,15 +3386,15 @@ const Br = [
3370
3386
  "mulN",
3371
3387
  "sqrN"
3372
3388
  ];
3373
- function Ur(r) {
3389
+ function Hr(r) {
3374
3390
  const e = {
3375
3391
  ORDER: "bigint",
3376
3392
  BYTES: "number",
3377
3393
  BITS: "number"
3378
- }, s = Br.reduce((t, n) => (t[n] = "function", t), e);
3379
- return mt(r, s), r;
3394
+ }, s = Ur.reduce((t, n) => (t[n] = "function", t), e);
3395
+ return yt(r, s), r;
3380
3396
  }
3381
- function Hr(r, e, s) {
3397
+ function Fr(r, e, s) {
3382
3398
  if (s < ne)
3383
3399
  throw new Error("invalid exponent, negatives unsupported");
3384
3400
  if (s === ne)
@@ -3390,17 +3406,17 @@ function Hr(r, e, s) {
3390
3406
  s & se && (t = r.mul(t, n)), n = r.sqr(n), s >>= se;
3391
3407
  return t;
3392
3408
  }
3393
- function ys(r, e, s = !1) {
3409
+ function Ss(r, e, s = !1) {
3394
3410
  const t = new Array(e.length).fill(s ? r.ZERO : void 0), n = e.reduce((o, a, c) => r.is0(a) ? o : (t[c] = o, r.mul(o, a)), r.ONE), i = r.inv(n);
3395
3411
  return e.reduceRight((o, a, c) => r.is0(a) ? o : (t[c] = r.mul(o, t[c]), r.mul(o, a)), i), t;
3396
3412
  }
3397
- function Ft(r, e) {
3413
+ function Wt(r, e) {
3398
3414
  const s = (r.ORDER - se) / Te, t = r.pow(e, s), n = r.eql(t, r.ONE), i = r.eql(t, r.ZERO), o = r.eql(t, r.neg(r.ONE));
3399
3415
  if (!n && !i && !o)
3400
3416
  throw new Error("invalid Legendre symbol result");
3401
3417
  return n ? 1 : i ? 0 : -1;
3402
3418
  }
3403
- function Fr(r, e) {
3419
+ function Gr(r, e) {
3404
3420
  e !== void 0 && we(e);
3405
3421
  const s = e !== void 0 ? e : r.toString(2).length, t = Math.ceil(s / 8);
3406
3422
  return { nBitLength: s, nByteLength: t };
@@ -3422,7 +3438,7 @@ class Wr {
3422
3438
  throw new Error("invalid field: expected ORDER > 0, got " + e);
3423
3439
  let t;
3424
3440
  this.isLE = !1, s != null && typeof s == "object" && (typeof s.BITS == "number" && (t = s.BITS), typeof s.sqrt == "function" && (this.sqrt = s.sqrt), typeof s.isLE == "boolean" && (this.isLE = s.isLE), s.allowedLengths && (this._lengths = (o = s.allowedLengths) == null ? void 0 : o.slice()), typeof s.modFromBytes == "boolean" && (this._mod = s.modFromBytes));
3425
- const { nBitLength: n, nByteLength: i } = Fr(e, t);
3441
+ const { nBitLength: n, nByteLength: i } = Gr(e, t);
3426
3442
  if (i > 2048)
3427
3443
  throw new Error("invalid field: expected ORDER of <= 2048 bytes");
3428
3444
  this.ORDER = e, this.BITS = n, this.BYTES = i, this._sqrt = void 0, Object.preventExtensions(this);
@@ -3464,10 +3480,10 @@ class Wr {
3464
3480
  return ue(e * s, this.ORDER);
3465
3481
  }
3466
3482
  pow(e, s) {
3467
- return Hr(this, e, s);
3483
+ return Fr(this, e, s);
3468
3484
  }
3469
3485
  div(e, s) {
3470
- return ue(e * Ht(s, this.ORDER), this.ORDER);
3486
+ return ue(e * Gt(s, this.ORDER), this.ORDER);
3471
3487
  }
3472
3488
  // Same as above, but doesn't normalize
3473
3489
  sqrN(e) {
@@ -3483,13 +3499,13 @@ class Wr {
3483
3499
  return e * s;
3484
3500
  }
3485
3501
  inv(e) {
3486
- return Ht(e, this.ORDER);
3502
+ return Gt(e, this.ORDER);
3487
3503
  }
3488
3504
  sqrt(e) {
3489
- return this._sqrt || (this._sqrt = $r(this.ORDER)), this._sqrt(this, e);
3505
+ return this._sqrt || (this._sqrt = Br(this.ORDER)), this._sqrt(this, e);
3490
3506
  }
3491
3507
  toBytes(e) {
3492
- return this.isLE ? hs(e, this.BYTES) : xt(e, this.BYTES);
3508
+ return this.isLE ? fs(e, this.BYTES) : mt(e, this.BYTES);
3493
3509
  }
3494
3510
  fromBytes(e, s = !1) {
3495
3511
  q(e);
@@ -3502,14 +3518,14 @@ class Wr {
3502
3518
  }
3503
3519
  if (e.length !== n)
3504
3520
  throw new Error("Field.fromBytes: expected " + n + " bytes, got " + e.length);
3505
- let c = i ? us(e) : Xe(e);
3521
+ let c = i ? ps(e) : Je(e);
3506
3522
  if (a && (c = ue(c, o)), !s && !this.isValid(c))
3507
3523
  throw new Error("invalid field element: outside of range 0..ORDER");
3508
3524
  return c;
3509
3525
  }
3510
3526
  // TODO: we don't need it here, move out to separate fn
3511
3527
  invertBatch(e) {
3512
- return ys(this, e);
3528
+ return Ss(this, e);
3513
3529
  }
3514
3530
  // We can't move this out because Fp6, Fp12 implement it
3515
3531
  // and it's unclear what to return in there.
@@ -3517,26 +3533,26 @@ class Wr {
3517
3533
  return t ? s : e;
3518
3534
  }
3519
3535
  }
3520
- function Je(r, e = {}) {
3536
+ function Ze(r, e = {}) {
3521
3537
  return new Wr(r, e);
3522
3538
  }
3523
- function bs(r) {
3539
+ function vs(r) {
3524
3540
  if (typeof r != "bigint")
3525
3541
  throw new Error("field order must be bigint");
3526
3542
  const e = r.toString(2).length;
3527
3543
  return Math.ceil(e / 8);
3528
3544
  }
3529
- function Ss(r) {
3530
- const e = bs(r);
3545
+ function Es(r) {
3546
+ const e = vs(r);
3531
3547
  return e + Math.ceil(e / 2);
3532
3548
  }
3533
- function Gr(r, e, s = !1) {
3549
+ function qr(r, e, s = !1) {
3534
3550
  q(r);
3535
- const t = r.length, n = bs(e), i = Ss(e);
3551
+ const t = r.length, n = vs(e), i = Es(e);
3536
3552
  if (t < 16 || t < i || t > 1024)
3537
3553
  throw new Error("expected " + i + "-1024 bytes of input, got " + t);
3538
- const o = s ? us(r) : Xe(r), a = ue(o, e - se) + se;
3539
- return s ? hs(a, n) : xt(a, n);
3554
+ const o = s ? ps(r) : Je(r), a = ue(o, e - se) + se;
3555
+ return s ? fs(a, n) : mt(a, n);
3540
3556
  }
3541
3557
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3542
3558
  const Ne = /* @__PURE__ */ BigInt(0), Re = /* @__PURE__ */ BigInt(1);
@@ -3544,35 +3560,35 @@ function je(r, e) {
3544
3560
  const s = e.negate();
3545
3561
  return r ? s : e;
3546
3562
  }
3547
- function Wt(r, e) {
3548
- const s = ys(r.Fp, e.map((t) => t.Z));
3563
+ function qt(r, e) {
3564
+ const s = Ss(r.Fp, e.map((t) => t.Z));
3549
3565
  return e.map((t, n) => r.fromAffine(t.toAffine(s[n])));
3550
3566
  }
3551
- function vs(r, e) {
3567
+ function Is(r, e) {
3552
3568
  if (!Number.isSafeInteger(r) || r <= 0 || r > e)
3553
3569
  throw new Error("invalid window size, expected [1.." + e + "], got W=" + r);
3554
3570
  }
3555
- function st(r, e) {
3556
- vs(r, e);
3557
- const s = Math.ceil(e / r) + 1, t = 2 ** (r - 1), n = 2 ** r, i = gt(r), o = BigInt(r);
3571
+ function rt(r, e) {
3572
+ Is(r, e);
3573
+ const s = Math.ceil(e / r) + 1, t = 2 ** (r - 1), n = 2 ** r, i = wt(r), o = BigInt(r);
3558
3574
  return { windows: s, windowSize: t, mask: i, maxNumber: n, shiftBy: o };
3559
3575
  }
3560
- function Gt(r, e, s) {
3576
+ function Kt(r, e, s) {
3561
3577
  const { windowSize: t, mask: n, maxNumber: i, shiftBy: o } = s;
3562
3578
  let a = Number(r & n), c = r >> o;
3563
3579
  a > t && (a -= i, c += Re);
3564
3580
  const l = e * t, u = l + Math.abs(a) - 1, p = a === 0, _ = a < 0, f = e % 2 !== 0;
3565
3581
  return { nextN: c, offset: u, isZero: p, isNeg: _, isNegF: f, offsetF: l };
3566
3582
  }
3567
- const rt = /* @__PURE__ */ new WeakMap(), Es = /* @__PURE__ */ new WeakMap();
3568
- function nt(r) {
3569
- return Es.get(r) || 1;
3583
+ const nt = /* @__PURE__ */ new WeakMap(), As = /* @__PURE__ */ new WeakMap();
3584
+ function it(r) {
3585
+ return As.get(r) || 1;
3570
3586
  }
3571
- function qt(r) {
3587
+ function Vt(r) {
3572
3588
  if (r !== Ne)
3573
3589
  throw new Error("invalid wNAF");
3574
3590
  }
3575
- class qr {
3591
+ class Kr {
3576
3592
  // Parametrized with a given Point class (not individual point)
3577
3593
  constructor(e, s) {
3578
3594
  R(this, "BASE");
@@ -3601,7 +3617,7 @@ class qr {
3601
3617
  * @returns precomputed point tables flattened to a single array
3602
3618
  */
3603
3619
  precomputeWindow(e, s) {
3604
- const { windows: t, windowSize: n } = st(s, this.bits), i = [];
3620
+ const { windows: t, windowSize: n } = rt(s, this.bits), i = [];
3605
3621
  let o = e, a = o;
3606
3622
  for (let c = 0; c < t; c++) {
3607
3623
  a = o, i.push(a);
@@ -3621,12 +3637,12 @@ class qr {
3621
3637
  if (!this.Fn.isValid(t))
3622
3638
  throw new Error("invalid scalar");
3623
3639
  let n = this.ZERO, i = this.BASE;
3624
- const o = st(e, this.bits);
3640
+ const o = rt(e, this.bits);
3625
3641
  for (let a = 0; a < o.windows; a++) {
3626
- const { nextN: c, offset: l, isZero: u, isNeg: p, isNegF: _, offsetF: f } = Gt(t, a, o);
3642
+ const { nextN: c, offset: l, isZero: u, isNeg: p, isNegF: _, offsetF: f } = Kt(t, a, o);
3627
3643
  t = c, u ? i = i.add(je(_, s[f])) : n = n.add(je(p, s[l]));
3628
3644
  }
3629
- return qt(t), { p: n, f: i };
3645
+ return Vt(t), { p: n, f: i };
3630
3646
  }
3631
3647
  /**
3632
3648
  * Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form.
@@ -3634,53 +3650,53 @@ class qr {
3634
3650
  * @returns point
3635
3651
  */
3636
3652
  wNAFUnsafe(e, s, t, n = this.ZERO) {
3637
- const i = st(e, this.bits);
3653
+ const i = rt(e, this.bits);
3638
3654
  for (let o = 0; o < i.windows && t !== Ne; o++) {
3639
- const { nextN: a, offset: c, isZero: l, isNeg: u } = Gt(t, o, i);
3655
+ const { nextN: a, offset: c, isZero: l, isNeg: u } = Kt(t, o, i);
3640
3656
  if (t = a, !l) {
3641
3657
  const p = s[c];
3642
3658
  n = n.add(u ? p.negate() : p);
3643
3659
  }
3644
3660
  }
3645
- return qt(t), n;
3661
+ return Vt(t), n;
3646
3662
  }
3647
3663
  getPrecomputes(e, s, t) {
3648
- let n = rt.get(s);
3649
- return n || (n = this.precomputeWindow(s, e), e !== 1 && (typeof t == "function" && (n = t(n)), rt.set(s, n))), n;
3664
+ let n = nt.get(s);
3665
+ return n || (n = this.precomputeWindow(s, e), e !== 1 && (typeof t == "function" && (n = t(n)), nt.set(s, n))), n;
3650
3666
  }
3651
3667
  cached(e, s, t) {
3652
- const n = nt(e);
3668
+ const n = it(e);
3653
3669
  return this.wNAF(n, this.getPrecomputes(n, e, t), s);
3654
3670
  }
3655
3671
  unsafe(e, s, t, n) {
3656
- const i = nt(e);
3672
+ const i = it(e);
3657
3673
  return i === 1 ? this._unsafeLadder(e, s, n) : this.wNAFUnsafe(i, this.getPrecomputes(i, e, t), s, n);
3658
3674
  }
3659
3675
  // We calculate precomputes for elliptic curve point multiplication
3660
3676
  // using windowed method. This specifies window size and
3661
3677
  // stores precomputed values. Usually only base point would be precomputed.
3662
3678
  createCache(e, s) {
3663
- vs(s, this.bits), Es.set(e, s), rt.delete(e);
3679
+ Is(s, this.bits), As.set(e, s), nt.delete(e);
3664
3680
  }
3665
3681
  hasCache(e) {
3666
- return nt(e) !== 1;
3682
+ return it(e) !== 1;
3667
3683
  }
3668
3684
  }
3669
- function Kr(r, e, s, t) {
3685
+ function Vr(r, e, s, t) {
3670
3686
  let n = e, i = r.ZERO, o = r.ZERO;
3671
3687
  for (; s > Ne || t > Ne; )
3672
3688
  s & Re && (i = i.add(n)), t & Re && (o = o.add(n)), n = n.double(), s >>= Re, t >>= Re;
3673
3689
  return { p1: i, p2: o };
3674
3690
  }
3675
- function Kt(r, e, s) {
3691
+ function zt(r, e, s) {
3676
3692
  if (e) {
3677
3693
  if (e.ORDER !== r)
3678
3694
  throw new Error("Field.ORDER must match order: Fp == p, Fn == n");
3679
- return Ur(e), e;
3695
+ return Hr(e), e;
3680
3696
  } else
3681
- return Je(r, { isLE: s });
3697
+ return Ze(r, { isLE: s });
3682
3698
  }
3683
- function Vr(r, e, s = {}, t) {
3699
+ function zr(r, e, s = {}, t) {
3684
3700
  if (t === void 0 && (t = r === "edwards"), !e || typeof e != "object")
3685
3701
  throw new Error(`expected valid ${r} CURVE object`);
3686
3702
  for (const c of ["p", "n", "h"]) {
@@ -3688,19 +3704,19 @@ function Vr(r, e, s = {}, t) {
3688
3704
  if (!(typeof l == "bigint" && l > Ne))
3689
3705
  throw new Error(`CURVE.${c} must be positive bigint`);
3690
3706
  }
3691
- const n = Kt(e.p, s.Fp, t), i = Kt(e.n, s.Fn, t), a = ["Gx", "Gy", "a", "b"];
3707
+ const n = zt(e.p, s.Fp, t), i = zt(e.n, s.Fn, t), a = ["Gx", "Gy", "a", "b"];
3692
3708
  for (const c of a)
3693
3709
  if (!n.isValid(e[c]))
3694
3710
  throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);
3695
3711
  return e = Object.freeze(Object.assign({}, e)), { CURVE: e, Fp: n, Fn: i };
3696
3712
  }
3697
- function zr(r, e) {
3713
+ function jr(r, e) {
3698
3714
  return function(t) {
3699
3715
  const n = r(t);
3700
3716
  return { secretKey: n, publicKey: e(n) };
3701
3717
  };
3702
3718
  }
3703
- class Is {
3719
+ class Ts {
3704
3720
  constructor(e, s) {
3705
3721
  R(this, "oHash");
3706
3722
  R(this, "iHash");
@@ -3708,7 +3724,7 @@ class Is {
3708
3724
  R(this, "outputLen");
3709
3725
  R(this, "finished", !1);
3710
3726
  R(this, "destroyed", !1);
3711
- if (ns(e), q(s, void 0, "key"), this.iHash = e.create(), typeof this.iHash.update != "function")
3727
+ if (os(e), q(s, void 0, "key"), this.iHash = e.create(), typeof this.iHash.update != "function")
3712
3728
  throw new Error("Expected instance of class which extends utils.Hash");
3713
3729
  this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
3714
3730
  const t = this.blockLen, n = new Uint8Array(t);
@@ -3742,39 +3758,39 @@ class Is {
3742
3758
  this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
3743
3759
  }
3744
3760
  }
3745
- const As = (r, e, s) => new Is(r, e).update(s).digest();
3746
- As.create = (r, e) => new Is(r, e);
3761
+ const Rs = (r, e, s) => new Ts(r, e).update(s).digest();
3762
+ Rs.create = (r, e) => new Ts(r, e);
3747
3763
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3748
- const Vt = (r, e) => (r + (r >= 0 ? e : -e) / Ts) / e;
3749
- function jr(r, e, s) {
3750
- const [[t, n], [i, o]] = e, a = Vt(o * r, s), c = Vt(-n * r, s);
3764
+ const jt = (r, e) => (r + (r >= 0 ? e : -e) / ks) / e;
3765
+ function Yr(r, e, s) {
3766
+ const [[t, n], [i, o]] = e, a = jt(o * r, s), c = jt(-n * r, s);
3751
3767
  let l = r - a * t - c * i, u = -a * n - c * o;
3752
3768
  const p = l < ge, _ = u < ge;
3753
3769
  p && (l = -l), _ && (u = -u);
3754
- const f = gt(Math.ceil(Pr(s) / 2)) + Oe;
3770
+ const f = wt(Math.ceil(Cr(s) / 2)) + Oe;
3755
3771
  if (l < ge || l >= f || u < ge || u >= f)
3756
3772
  throw new Error("splitScalar (endomorphism): failed, k=" + r);
3757
3773
  return { k1neg: p, k1: l, k2neg: _, k2: u };
3758
3774
  }
3759
- function ut(r) {
3775
+ function pt(r) {
3760
3776
  if (!["compact", "recovered", "der"].includes(r))
3761
3777
  throw new Error('Signature format must be "compact", "recovered", or "der"');
3762
3778
  return r;
3763
3779
  }
3764
- function it(r, e) {
3780
+ function ot(r, e) {
3765
3781
  const s = {};
3766
3782
  for (let t of Object.keys(e))
3767
3783
  s[t] = r[t] === void 0 ? e[t] : r[t];
3768
- return ze(s.lowS, "lowS"), ze(s.prehash, "prehash"), s.format !== void 0 && ut(s.format), s;
3784
+ return ze(s.lowS, "lowS"), ze(s.prehash, "prehash"), s.format !== void 0 && pt(s.format), s;
3769
3785
  }
3770
- class Yr extends Error {
3786
+ class Xr extends Error {
3771
3787
  constructor(e = "") {
3772
3788
  super(e);
3773
3789
  }
3774
3790
  }
3775
3791
  const Se = {
3776
3792
  // asn.1 DER encoding utils
3777
- Err: Yr,
3793
+ Err: Xr,
3778
3794
  // Basic building block is TLV (Tag-Length-Value)
3779
3795
  _tlv: {
3780
3796
  encode: (r, e) => {
@@ -3843,7 +3859,7 @@ const Se = {
3843
3859
  throw new e("invalid signature integer: negative");
3844
3860
  if (r[0] === 0 && !(r[1] & 128))
3845
3861
  throw new e("invalid signature integer: unnecessary leading zero");
3846
- return Xe(r);
3862
+ return Je(r);
3847
3863
  }
3848
3864
  },
3849
3865
  toSig(r) {
@@ -3859,12 +3875,12 @@ const Se = {
3859
3875
  const { _tlv: e, _int: s } = Se, t = e.encode(2, s.encode(r.r)), n = e.encode(2, s.encode(r.s)), i = t + n;
3860
3876
  return e.encode(48, i);
3861
3877
  }
3862
- }, ge = BigInt(0), Oe = BigInt(1), Ts = BigInt(2), We = BigInt(3), Xr = BigInt(4);
3863
- function Jr(r, e = {}) {
3864
- const s = Vr("weierstrass", r, e), { Fp: t, Fn: n } = s;
3878
+ }, ge = BigInt(0), Oe = BigInt(1), ks = BigInt(2), Ge = BigInt(3), Jr = BigInt(4);
3879
+ function Zr(r, e = {}) {
3880
+ const s = zr("weierstrass", r, e), { Fp: t, Fn: n } = s;
3865
3881
  let i = s.CURVE;
3866
3882
  const { h: o, n: a } = i;
3867
- mt(e, {}, {
3883
+ yt(e, {}, {
3868
3884
  allowInfinityPoint: "boolean",
3869
3885
  clearCofactor: "function",
3870
3886
  isTorsionFree: "function",
@@ -3875,7 +3891,7 @@ function Jr(r, e = {}) {
3875
3891
  const { endo: c } = e;
3876
3892
  if (c && (!t.is0(i.a) || typeof c.beta != "bigint" || !Array.isArray(c.basises)))
3877
3893
  throw new Error('invalid endo: expected "beta": bigint and "basises": array');
3878
- const l = ks(t, n);
3894
+ const l = Ps(t, n);
3879
3895
  function u() {
3880
3896
  if (!t.isOdd)
3881
3897
  throw new Error("compression is not supported: Field does not have .isOdd()");
@@ -3885,7 +3901,7 @@ function Jr(r, e = {}) {
3885
3901
  if (ze(m, "isCompressed"), m) {
3886
3902
  u();
3887
3903
  const C = !t.isOdd(A);
3888
- return ve(Rs(C), N);
3904
+ return ve(Os(C), N);
3889
3905
  } else
3890
3906
  return ve(Uint8Array.of(4), N, t.toBytes(A));
3891
3907
  }
@@ -3901,8 +3917,8 @@ function Jr(r, e = {}) {
3901
3917
  try {
3902
3918
  O = t.sqrt(M);
3903
3919
  } catch (Y) {
3904
- const G = Y instanceof Error ? ": " + Y.message : "";
3905
- throw new Error("bad point: is not on curve, sqrt error" + G);
3920
+ const W = Y instanceof Error ? ": " + Y.message : "";
3921
+ throw new Error("bad point: is not on curve, sqrt error" + W);
3906
3922
  }
3907
3923
  u();
3908
3924
  const $ = t.isOdd(O);
@@ -3926,7 +3942,7 @@ function Jr(r, e = {}) {
3926
3942
  }
3927
3943
  if (!y(i.Gx, i.Gy))
3928
3944
  throw new Error("bad curve params: generator point");
3929
- const I = t.mul(t.pow(i.a, We), Xr), P = t.mul(t.sqr(i.b), BigInt(27));
3945
+ const I = t.mul(t.pow(i.a, Ge), Jr), P = t.mul(t.sqr(i.b), BigInt(27));
3930
3946
  if (t.is0(t.add(I, P)))
3931
3947
  throw new Error("bad curve params: a or b");
3932
3948
  function H(T, x, m = !1) {
@@ -3941,9 +3957,9 @@ function Jr(r, e = {}) {
3941
3957
  function K(T) {
3942
3958
  if (!c || !c.basises)
3943
3959
  throw new Error("no endo");
3944
- return jr(T, c.basises, n.ORDER);
3960
+ return Yr(T, c.basises, n.ORDER);
3945
3961
  }
3946
- const W = Ut((T, x) => {
3962
+ const G = Ft((T, x) => {
3947
3963
  const { X: m, Y: b, Z: A } = T;
3948
3964
  if (t.eql(A, t.ONE))
3949
3965
  return { x: m, y: b };
@@ -3955,7 +3971,7 @@ function Jr(r, e = {}) {
3955
3971
  if (!t.eql(O, t.ONE))
3956
3972
  throw new Error("invZ was invalid");
3957
3973
  return { x: C, y: M };
3958
- }), Z = Ut((T) => {
3974
+ }), Z = Ft((T) => {
3959
3975
  if (T.is0()) {
3960
3976
  if (e.allowInfinityPoint && !t.is0(T.Y))
3961
3977
  return;
@@ -4013,7 +4029,7 @@ function Jr(r, e = {}) {
4013
4029
  * @returns
4014
4030
  */
4015
4031
  precompute(x = 8, m = !0) {
4016
- return v.createCache(this, x), m || this.multiply(We), this;
4032
+ return v.createCache(this, x), m || this.multiply(Ge), this;
4017
4033
  }
4018
4034
  // TODO: return `this`
4019
4035
  /** A point on curve is valid if it conforms to equation. */
@@ -4041,9 +4057,9 @@ function Jr(r, e = {}) {
4041
4057
  // https://eprint.iacr.org/2015/1060, algorithm 3
4042
4058
  // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
4043
4059
  double() {
4044
- const { a: x, b: m } = i, b = t.mul(m, We), { X: A, Y: N, Z: C } = this;
4045
- let M = t.ZERO, O = t.ZERO, $ = t.ZERO, F = t.mul(A, A), Y = t.mul(N, N), G = t.mul(C, C), B = t.mul(A, N);
4046
- return B = t.add(B, B), $ = t.mul(A, C), $ = t.add($, $), M = t.mul(x, $), O = t.mul(b, G), O = t.add(M, O), M = t.sub(Y, O), O = t.add(Y, O), O = t.mul(M, O), M = t.mul(B, M), $ = t.mul(b, $), G = t.mul(x, G), B = t.sub(F, G), B = t.mul(x, B), B = t.add(B, $), $ = t.add(F, F), F = t.add($, F), F = t.add(F, G), F = t.mul(F, B), O = t.add(O, F), G = t.mul(N, C), G = t.add(G, G), F = t.mul(G, B), M = t.sub(M, F), $ = t.mul(G, Y), $ = t.add($, $), $ = t.add($, $), new E(M, O, $);
4060
+ const { a: x, b: m } = i, b = t.mul(m, Ge), { X: A, Y: N, Z: C } = this;
4061
+ let M = t.ZERO, O = t.ZERO, $ = t.ZERO, F = t.mul(A, A), Y = t.mul(N, N), W = t.mul(C, C), B = t.mul(A, N);
4062
+ return B = t.add(B, B), $ = t.mul(A, C), $ = t.add($, $), M = t.mul(x, $), O = t.mul(b, W), O = t.add(M, O), M = t.sub(Y, O), O = t.add(Y, O), O = t.mul(M, O), M = t.mul(B, M), $ = t.mul(b, $), W = t.mul(x, W), B = t.sub(F, W), B = t.mul(x, B), B = t.add(B, $), $ = t.add(F, F), F = t.add($, F), F = t.add(F, W), F = t.mul(F, B), O = t.add(O, F), W = t.mul(N, C), W = t.add(W, W), F = t.mul(W, B), M = t.sub(M, F), $ = t.mul(W, Y), $ = t.add($, $), $ = t.add($, $), new E(M, O, $);
4047
4063
  }
4048
4064
  // Renes-Costello-Batina exception-free addition formula.
4049
4065
  // There is 30% faster Jacobian formula, but it is not complete.
@@ -4053,11 +4069,11 @@ function Jr(r, e = {}) {
4053
4069
  D(x);
4054
4070
  const { X: m, Y: b, Z: A } = this, { X: N, Y: C, Z: M } = x;
4055
4071
  let O = t.ZERO, $ = t.ZERO, F = t.ZERO;
4056
- const Y = i.a, G = t.mul(i.b, We);
4072
+ const Y = i.a, W = t.mul(i.b, Ge);
4057
4073
  let B = t.mul(m, N), X = t.mul(b, C), Q = t.mul(A, M), oe = t.add(m, b), V = t.add(N, C);
4058
4074
  oe = t.mul(oe, V), V = t.add(B, X), oe = t.sub(oe, V), V = t.add(m, A);
4059
4075
  let ee = t.add(N, M);
4060
- return V = t.mul(V, ee), ee = t.add(B, Q), V = t.sub(V, ee), ee = t.add(b, A), O = t.add(C, M), ee = t.mul(ee, O), O = t.add(X, Q), ee = t.sub(ee, O), F = t.mul(Y, V), O = t.mul(G, Q), F = t.add(O, F), O = t.sub(X, F), F = t.add(X, F), $ = t.mul(O, F), X = t.add(B, B), X = t.add(X, B), Q = t.mul(Y, Q), V = t.mul(G, V), X = t.add(X, Q), Q = t.sub(B, Q), Q = t.mul(Y, Q), V = t.add(V, Q), B = t.mul(X, V), $ = t.add($, B), B = t.mul(ee, V), O = t.mul(oe, O), O = t.sub(O, B), B = t.mul(oe, X), F = t.mul(ee, F), F = t.add(F, B), new E(O, $, F);
4076
+ return V = t.mul(V, ee), ee = t.add(B, Q), V = t.sub(V, ee), ee = t.add(b, A), O = t.add(C, M), ee = t.mul(ee, O), O = t.add(X, Q), ee = t.sub(ee, O), F = t.mul(Y, V), O = t.mul(W, Q), F = t.add(O, F), O = t.sub(X, F), F = t.add(X, F), $ = t.mul(O, F), X = t.add(B, B), X = t.add(X, B), Q = t.mul(Y, Q), V = t.mul(W, V), X = t.add(X, Q), Q = t.sub(B, Q), Q = t.mul(Y, Q), V = t.add(V, Q), B = t.mul(X, V), $ = t.add($, B), B = t.mul(ee, V), O = t.mul(oe, O), O = t.sub(O, B), B = t.mul(oe, X), F = t.mul(ee, F), F = t.add(F, B), new E(O, $, F);
4061
4077
  }
4062
4078
  subtract(x) {
4063
4079
  return this.add(x.negate());
@@ -4079,15 +4095,15 @@ function Jr(r, e = {}) {
4079
4095
  if (!n.isValidNot0(x))
4080
4096
  throw new Error("invalid scalar: out of range");
4081
4097
  let b, A;
4082
- const N = (C) => v.cached(this, C, (M) => Wt(E, M));
4098
+ const N = (C) => v.cached(this, C, (M) => qt(E, M));
4083
4099
  if (m) {
4084
- const { k1neg: C, k1: M, k2neg: O, k2: $ } = K(x), { p: F, f: Y } = N(M), { p: G, f: B } = N($);
4085
- A = Y.add(B), b = U(m.beta, F, G, C, O);
4100
+ const { k1neg: C, k1: M, k2neg: O, k2: $ } = K(x), { p: F, f: Y } = N(M), { p: W, f: B } = N($);
4101
+ A = Y.add(B), b = U(m.beta, F, W, C, O);
4086
4102
  } else {
4087
4103
  const { p: C, f: M } = N(x);
4088
4104
  b = C, A = M;
4089
4105
  }
4090
- return Wt(E, [b, A])[0];
4106
+ return qt(E, [b, A])[0];
4091
4107
  }
4092
4108
  /**
4093
4109
  * Non-constant-time multiplication. Uses double-and-add algorithm.
@@ -4105,7 +4121,7 @@ function Jr(r, e = {}) {
4105
4121
  if (v.hasCache(this))
4106
4122
  return this.multiply(x);
4107
4123
  if (m) {
4108
- const { k1neg: A, k1: N, k2neg: C, k2: M } = K(x), { p1: O, p2: $ } = Kr(E, b, N, M);
4124
+ const { k1neg: A, k1: N, k2neg: C, k2: M } = K(x), { p1: O, p2: $ } = Vr(E, b, N, M);
4109
4125
  return U(m.beta, O, $, A, C);
4110
4126
  } else
4111
4127
  return v.unsafe(b, x);
@@ -4115,7 +4131,7 @@ function Jr(r, e = {}) {
4115
4131
  * @param invertedZ Z^-1 (inverted zero) - optional, precomputation is useful for invertBatch
4116
4132
  */
4117
4133
  toAffine(x) {
4118
- return W(this, x);
4134
+ return G(this, x);
4119
4135
  }
4120
4136
  /**
4121
4137
  * Checks whether Point is free of torsion elements (is in prime subgroup).
@@ -4149,13 +4165,13 @@ function Jr(r, e = {}) {
4149
4165
  R(E, "Fp", t), // scalar field
4150
4166
  R(E, "Fn", n);
4151
4167
  let z = E;
4152
- const k = n.BITS, v = new qr(z, e.endo ? Math.ceil(k / 2) : k);
4168
+ const k = n.BITS, v = new Kr(z, e.endo ? Math.ceil(k / 2) : k);
4153
4169
  return z.BASE.precompute(8), z;
4154
4170
  }
4155
- function Rs(r) {
4171
+ function Os(r) {
4156
4172
  return Uint8Array.of(r ? 2 : 3);
4157
4173
  }
4158
- function ks(r, e) {
4174
+ function Ps(r, e) {
4159
4175
  return {
4160
4176
  secretKey: e.BYTES,
4161
4177
  publicKey: 1 + r.BYTES,
@@ -4164,8 +4180,8 @@ function ks(r, e) {
4164
4180
  signature: 2 * e.BYTES
4165
4181
  };
4166
4182
  }
4167
- function Zr(r, e = {}) {
4168
- const { Fn: s } = r, t = e.randomBytes || cs, n = Object.assign(ks(r.Fp, s), { seed: Ss(s.ORDER) });
4183
+ function Qr(r, e = {}) {
4184
+ const { Fn: s } = r, t = e.randomBytes || ds, n = Object.assign(Ps(r.Fp, s), { seed: Es(s.ORDER) });
4169
4185
  function i(f) {
4170
4186
  try {
4171
4187
  const w = s.fromBytes(f);
@@ -4184,14 +4200,14 @@ function Zr(r, e = {}) {
4184
4200
  }
4185
4201
  }
4186
4202
  function a(f = t(n.seed)) {
4187
- return Gr(q(f, n.seed, "seed"), s.ORDER);
4203
+ return qr(q(f, n.seed, "seed"), s.ORDER);
4188
4204
  }
4189
4205
  function c(f, w = !0) {
4190
4206
  return r.BASE.multiply(s.fromBytes(f)).toBytes(w);
4191
4207
  }
4192
4208
  function l(f) {
4193
4209
  const { secretKey: w, publicKey: S, publicKeyUncompressed: y } = n;
4194
- if (!ft(f) || "_lengths" in s && s._lengths || w === S)
4210
+ if (!xt(f) || "_lengths" in s && s._lengths || w === S)
4195
4211
  return;
4196
4212
  const I = q(f, void 0, "key").length;
4197
4213
  return I === S || I === y;
@@ -4208,23 +4224,23 @@ function Zr(r, e = {}) {
4208
4224
  isValidSecretKey: i,
4209
4225
  isValidPublicKey: o,
4210
4226
  randomSecretKey: a
4211
- }, _ = zr(a, c);
4227
+ }, _ = jr(a, c);
4212
4228
  return Object.freeze({ getPublicKey: c, getSharedSecret: u, keygen: _, Point: r, utils: p, lengths: n });
4213
4229
  }
4214
- function Qr(r, e, s = {}) {
4215
- ns(e), mt(s, {}, {
4230
+ function en(r, e, s = {}) {
4231
+ os(e), yt(s, {}, {
4216
4232
  hmac: "function",
4217
4233
  lowS: "boolean",
4218
4234
  randomBytes: "function",
4219
4235
  bits2int: "function",
4220
4236
  bits2int_modN: "function"
4221
4237
  }), s = Object.assign({}, s);
4222
- const t = s.randomBytes || cs, n = s.hmac || ((x, m) => As(e, x, m)), { Fp: i, Fn: o } = r, { ORDER: a, BITS: c } = o, { keygen: l, getPublicKey: u, getSharedSecret: p, utils: _, lengths: f } = Zr(r, s), w = {
4238
+ const t = s.randomBytes || ds, n = s.hmac || ((x, m) => Rs(e, x, m)), { Fp: i, Fn: o } = r, { ORDER: a, BITS: c } = o, { keygen: l, getPublicKey: u, getSharedSecret: p, utils: _, lengths: f } = Qr(r, s), w = {
4223
4239
  prehash: !0,
4224
4240
  lowS: typeof s.lowS == "boolean" ? s.lowS : !0,
4225
4241
  format: "compact",
4226
4242
  extraEntropy: !1
4227
- }, S = a * Ts < i.ORDER;
4243
+ }, S = a * ks < i.ORDER;
4228
4244
  function y(x) {
4229
4245
  const m = a >> Oe;
4230
4246
  return x > m;
@@ -4239,7 +4255,7 @@ function Qr(r, e, s = {}) {
4239
4255
  throw new Error('"recovered" sig type is not supported for cofactor >2 curves');
4240
4256
  }
4241
4257
  function H(x, m) {
4242
- ut(m);
4258
+ pt(m);
4243
4259
  const b = f.signature, A = m === "compact" ? b : m === "recovered" ? b + 1 : void 0;
4244
4260
  return q(x, A);
4245
4261
  }
@@ -4282,7 +4298,7 @@ function Qr(r, e, s = {}) {
4282
4298
  const { r: b, s: A } = this, N = this.assertRecovery(), C = N === 2 || N === 3 ? b + a : b;
4283
4299
  if (!i.isValid(C))
4284
4300
  throw new Error("invalid recovery id: sig.r+curve.n != R.x");
4285
- const M = i.toBytes(C), O = r.fromBytes(ve(Rs((N & 1) === 0), M)), $ = o.inv(C), F = W(q(m, void 0, "msgHash")), Y = o.create(-F * $), G = o.create(A * $), B = r.BASE.multiplyUnsafe(Y).add(O.multiplyUnsafe(G));
4301
+ const M = i.toBytes(C), O = r.fromBytes(ve(Os((N & 1) === 0), M)), $ = o.inv(C), F = G(q(m, void 0, "msgHash")), Y = o.create(-F * $), W = o.create(A * $), B = r.BASE.multiplyUnsafe(Y).add(O.multiplyUnsafe(W));
4286
4302
  if (B.is0())
4287
4303
  throw new Error("invalid recovery: point at infinify");
4288
4304
  return B.assertValidity(), B;
@@ -4292,7 +4308,7 @@ function Qr(r, e, s = {}) {
4292
4308
  return y(this.s);
4293
4309
  }
4294
4310
  toBytes(m = w.format) {
4295
- if (ut(m), m === "der")
4311
+ if (pt(m), m === "der")
4296
4312
  return Ve(Se.hexFromSig(this));
4297
4313
  const { r: b, s: A } = this, N = o.toBytes(b), C = o.toBytes(A);
4298
4314
  return m === "recovered" ? (P(), ve(Uint8Array.of(this.assertRecovery()), N, C)) : ve(N, C);
@@ -4304,21 +4320,21 @@ function Qr(r, e, s = {}) {
4304
4320
  const K = s.bits2int || function(m) {
4305
4321
  if (m.length > 8192)
4306
4322
  throw new Error("input is too large");
4307
- const b = Xe(m), A = m.length * 8 - c;
4323
+ const b = Je(m), A = m.length * 8 - c;
4308
4324
  return A > 0 ? b >> BigInt(A) : b;
4309
- }, W = s.bits2int_modN || function(m) {
4325
+ }, G = s.bits2int_modN || function(m) {
4310
4326
  return o.create(K(m));
4311
- }, Z = gt(c);
4327
+ }, Z = wt(c);
4312
4328
  function U(x) {
4313
- return Or("num < 2^" + c, x, ge, Z), o.toBytes(x);
4329
+ return Pr("num < 2^" + c, x, ge, Z), o.toBytes(x);
4314
4330
  }
4315
4331
  function z(x, m) {
4316
4332
  return q(x, void 0, "message"), m ? q(e(x), void 0, "prehashed message") : x;
4317
4333
  }
4318
4334
  function k(x, m, b) {
4319
- const { lowS: A, prehash: N, extraEntropy: C } = it(b, w);
4335
+ const { lowS: A, prehash: N, extraEntropy: C } = ot(b, w);
4320
4336
  x = z(x, N);
4321
- const M = W(x), O = o.fromBytes(m);
4337
+ const M = G(x), O = o.fromBytes(m);
4322
4338
  if (!o.isValidNot0(O))
4323
4339
  throw new Error("invalid private key");
4324
4340
  const $ = [U(O), U(M)];
@@ -4327,7 +4343,7 @@ function Qr(r, e, s = {}) {
4327
4343
  $.push(q(B, void 0, "extraEntropy"));
4328
4344
  }
4329
4345
  const F = ve(...$), Y = M;
4330
- function G(B) {
4346
+ function W(B) {
4331
4347
  const X = K(B);
4332
4348
  if (!o.isValidNot0(X))
4333
4349
  return;
@@ -4337,18 +4353,18 @@ function Qr(r, e, s = {}) {
4337
4353
  const ee = o.create(Q * o.create(Y + V * O));
4338
4354
  if (ee === ge)
4339
4355
  return;
4340
- let vt = (oe.x === V ? 0 : 2) | Number(oe.y & Oe), Et = ee;
4341
- return A && y(ee) && (Et = o.neg(ee), vt ^= 1), new D(V, Et, S ? void 0 : vt);
4356
+ let It = (oe.x === V ? 0 : 2) | Number(oe.y & Oe), At = ee;
4357
+ return A && y(ee) && (At = o.neg(ee), It ^= 1), new D(V, At, S ? void 0 : It);
4342
4358
  }
4343
- return { seed: F, k2sig: G };
4359
+ return { seed: F, k2sig: W };
4344
4360
  }
4345
4361
  function v(x, m, b = {}) {
4346
4362
  const { seed: A, k2sig: N } = k(x, m, b);
4347
- return Cr(e.outputLen, o.BYTES, n)(A, N).toBytes(b.format);
4363
+ return Nr(e.outputLen, o.BYTES, n)(A, N).toBytes(b.format);
4348
4364
  }
4349
4365
  function E(x, m, b, A = {}) {
4350
- const { lowS: N, prehash: C, format: M } = it(A, w);
4351
- if (b = q(b, void 0, "publicKey"), m = z(m, C), !ft(x)) {
4366
+ const { lowS: N, prehash: C, format: M } = ot(A, w);
4367
+ if (b = q(b, void 0, "publicKey"), m = z(m, C), !xt(x)) {
4352
4368
  const O = x instanceof D ? ", use sig.toBytes()" : "";
4353
4369
  throw new Error("verify expects Uint8Array signature" + O);
4354
4370
  }
@@ -4357,14 +4373,14 @@ function Qr(r, e, s = {}) {
4357
4373
  const O = D.fromBytes(x, M), $ = r.fromBytes(b);
4358
4374
  if (N && O.hasHighS())
4359
4375
  return !1;
4360
- const { r: F, s: Y } = O, G = W(m), B = o.inv(Y), X = o.create(G * B), Q = o.create(F * B), oe = r.BASE.multiplyUnsafe(X).add($.multiplyUnsafe(Q));
4376
+ const { r: F, s: Y } = O, W = G(m), B = o.inv(Y), X = o.create(W * B), Q = o.create(F * B), oe = r.BASE.multiplyUnsafe(X).add($.multiplyUnsafe(Q));
4361
4377
  return oe.is0() ? !1 : o.create(oe.x) === F;
4362
4378
  } catch {
4363
4379
  return !1;
4364
4380
  }
4365
4381
  }
4366
4382
  function T(x, m, b = {}) {
4367
- const { prehash: A } = it(b, w);
4383
+ const { prehash: A } = ot(b, w);
4368
4384
  return m = z(m, A), D.fromBytes(x, "recovered").recoverPublicKey(m).toBytes();
4369
4385
  }
4370
4386
  return Object.freeze({
@@ -4382,7 +4398,7 @@ function Qr(r, e, s = {}) {
4382
4398
  });
4383
4399
  }
4384
4400
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
4385
- const yt = {
4401
+ const St = {
4386
4402
  p: BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),
4387
4403
  n: BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),
4388
4404
  h: BigInt(1),
@@ -4390,44 +4406,44 @@ const yt = {
4390
4406
  b: BigInt(7),
4391
4407
  Gx: BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
4392
4408
  Gy: BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")
4393
- }, en = {
4409
+ }, tn = {
4394
4410
  beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
4395
4411
  basises: [
4396
4412
  [BigInt("0x3086d221a7d46bcde86c90e49284eb15"), -BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],
4397
4413
  [BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), BigInt("0x3086d221a7d46bcde86c90e49284eb15")]
4398
4414
  ]
4399
- }, zt = /* @__PURE__ */ BigInt(2);
4400
- function tn(r) {
4401
- const e = yt.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), i = BigInt(22), o = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, u = l * l * r % e, p = ce(u, s, e) * u % e, _ = ce(p, s, e) * u % e, f = ce(_, zt, e) * l % e, w = ce(f, n, e) * f % e, S = ce(w, i, e) * w % e, y = ce(S, a, e) * S % e, I = ce(y, c, e) * y % e, P = ce(I, a, e) * S % e, H = ce(P, s, e) * u % e, D = ce(H, o, e) * w % e, K = ce(D, t, e) * l % e, W = ce(K, zt, e);
4402
- if (!ht.eql(ht.sqr(W), r))
4415
+ }, Yt = /* @__PURE__ */ BigInt(2);
4416
+ function sn(r) {
4417
+ const e = St.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), i = BigInt(22), o = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, u = l * l * r % e, p = ce(u, s, e) * u % e, _ = ce(p, s, e) * u % e, f = ce(_, Yt, e) * l % e, w = ce(f, n, e) * f % e, S = ce(w, i, e) * w % e, y = ce(S, a, e) * S % e, I = ce(y, c, e) * y % e, P = ce(I, a, e) * S % e, H = ce(P, s, e) * u % e, D = ce(H, o, e) * w % e, K = ce(D, t, e) * l % e, G = ce(K, Yt, e);
4418
+ if (!ft.eql(ft.sqr(G), r))
4403
4419
  throw new Error("Cannot find square root");
4404
- return W;
4420
+ return G;
4405
4421
  }
4406
- const ht = Je(yt.p, { sqrt: tn }), sn = /* @__PURE__ */ Jr(yt, {
4407
- Fp: ht,
4408
- endo: en
4409
- }), rn = /* @__PURE__ */ Qr(sn, Tr), nn = BigInt(0), De = BigInt(1), on = BigInt(2), an = BigInt(7), cn = BigInt(256), ln = BigInt(113), Os = [], Ps = [], Cs = [];
4422
+ const ft = Ze(St.p, { sqrt: sn }), rn = /* @__PURE__ */ Zr(St, {
4423
+ Fp: ft,
4424
+ endo: tn
4425
+ }), nn = /* @__PURE__ */ en(rn, Rr), on = BigInt(0), De = BigInt(1), an = BigInt(2), cn = BigInt(7), ln = BigInt(256), dn = BigInt(113), Cs = [], Ns = [], Ls = [];
4410
4426
  for (let r = 0, e = De, s = 1, t = 0; r < 24; r++) {
4411
- [s, t] = [t, (2 * s + 3 * t) % 5], Os.push(2 * (5 * t + s)), Ps.push((r + 1) * (r + 2) / 2 % 64);
4412
- let n = nn;
4427
+ [s, t] = [t, (2 * s + 3 * t) % 5], Cs.push(2 * (5 * t + s)), Ns.push((r + 1) * (r + 2) / 2 % 64);
4428
+ let n = on;
4413
4429
  for (let i = 0; i < 7; i++)
4414
- e = (e << De ^ (e >> an) * ln) % cn, e & on && (n ^= De << (De << BigInt(i)) - De);
4415
- Cs.push(n);
4430
+ e = (e << De ^ (e >> cn) * dn) % ln, e & an && (n ^= De << (De << BigInt(i)) - De);
4431
+ Ls.push(n);
4416
4432
  }
4417
- const Ns = wr(Cs, !0), dn = Ns[0], un = Ns[1], jt = (r, e, s) => s > 32 ? Sr(r, e, s) : yr(r, e, s), Yt = (r, e, s) => s > 32 ? vr(r, e, s) : br(r, e, s);
4418
- function hn(r, e = 24) {
4433
+ 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);
4434
+ function pn(r, e = 24) {
4419
4435
  const s = new Uint32Array(10);
4420
4436
  for (let t = 24 - e; t < 24; t++) {
4421
4437
  for (let o = 0; o < 10; o++)
4422
4438
  s[o] = r[o] ^ r[o + 10] ^ r[o + 20] ^ r[o + 30] ^ r[o + 40];
4423
4439
  for (let o = 0; o < 10; o += 2) {
4424
- const a = (o + 8) % 10, c = (o + 2) % 10, l = s[c], u = s[c + 1], p = jt(l, u, 1) ^ s[a], _ = Yt(l, u, 1) ^ s[a + 1];
4440
+ const a = (o + 8) % 10, c = (o + 2) % 10, l = s[c], u = s[c + 1], p = Xt(l, u, 1) ^ s[a], _ = Jt(l, u, 1) ^ s[a + 1];
4425
4441
  for (let f = 0; f < 50; f += 10)
4426
4442
  r[o + f] ^= p, r[o + f + 1] ^= _;
4427
4443
  }
4428
4444
  let n = r[2], i = r[3];
4429
4445
  for (let o = 0; o < 24; o++) {
4430
- const a = Ps[o], c = jt(n, i, a), l = Yt(n, i, a), u = Os[o];
4446
+ const a = Ns[o], c = Xt(n, i, a), l = Jt(n, i, a), u = Cs[o];
4431
4447
  n = r[u], i = r[u + 1], r[u] = c, r[u + 1] = l;
4432
4448
  }
4433
4449
  for (let o = 0; o < 50; o += 10) {
@@ -4436,11 +4452,11 @@ function hn(r, e = 24) {
4436
4452
  for (let a = 0; a < 10; a++)
4437
4453
  r[o + a] ^= ~s[(a + 2) % 10] & s[(a + 4) % 10];
4438
4454
  }
4439
- r[0] ^= dn[t], r[1] ^= un[t];
4455
+ r[0] ^= un[t], r[1] ^= hn[t];
4440
4456
  }
4441
4457
  Ce(s);
4442
4458
  }
4443
- class bt {
4459
+ class vt {
4444
4460
  // NOTE: we accept arguments in bytes instead of bits here.
4445
4461
  constructor(e, s, t, n = !1, i = 24) {
4446
4462
  R(this, "state");
@@ -4456,13 +4472,13 @@ class bt {
4456
4472
  R(this, "rounds");
4457
4473
  if (this.blockLen = e, this.suffix = s, this.outputLen = t, this.enableXOF = n, this.rounds = i, we(t, "outputLen"), !(0 < e && e < 200))
4458
4474
  throw new Error("only keccak-f1600 function is supported");
4459
- this.state = new Uint8Array(200), this.state32 = lr(this.state);
4475
+ this.state = new Uint8Array(200), this.state32 = dr(this.state);
4460
4476
  }
4461
4477
  clone() {
4462
4478
  return this._cloneInto();
4463
4479
  }
4464
4480
  keccak() {
4465
- Mt(this.state32), hn(this.state32, this.rounds), Mt(this.state32), this.posOut = 0, this.pos = 0;
4481
+ Bt(this.state32), pn(this.state32, this.rounds), Bt(this.state32), this.posOut = 0, this.pos = 0;
4466
4482
  }
4467
4483
  update(e) {
4468
4484
  Pe(this), q(e);
@@ -4501,7 +4517,7 @@ class bt {
4501
4517
  return we(e), this.xofInto(new Uint8Array(e));
4502
4518
  }
4503
4519
  digestInto(e) {
4504
- if (is(e, this), this.finished)
4520
+ if (as(e, this), this.finished)
4505
4521
  throw new Error("digest() was already called");
4506
4522
  return this.writeInto(e), this.destroy(), e;
4507
4523
  }
@@ -4513,17 +4529,17 @@ class bt {
4513
4529
  }
4514
4530
  _cloneInto(e) {
4515
4531
  const { blockLen: s, suffix: t, outputLen: n, rounds: i, enableXOF: o } = this;
4516
- return e || (e = new bt(s, t, n, o, i)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = i, e.suffix = t, e.outputLen = n, e.enableXOF = o, e.destroyed = this.destroyed, e;
4532
+ return e || (e = new vt(s, t, n, o, i)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = i, e.suffix = t, e.outputLen = n, e.enableXOF = o, e.destroyed = this.destroyed, e;
4517
4533
  }
4518
4534
  }
4519
- const pn = (r, e, s, t = {}) => as(() => new bt(e, r, s), t), Xt = /* @__PURE__ */ pn(1, 136, 32), fn = 60;
4520
- class _n {
4535
+ const fn = (r, e, s, t = {}) => ls(() => new vt(e, r, s), t), Zt = /* @__PURE__ */ fn(1, 136, 32), _n = 60;
4536
+ class xn {
4521
4537
  constructor() {
4522
4538
  this.jwks = null;
4523
4539
  }
4524
4540
  setJWKSEndpoint(e) {
4525
4541
  try {
4526
- this.jwks = Us(new URL(e)), d.log("[CROSSx] JWKS 엔드포인트 설정:", e);
4542
+ this.jwks = Fs(new URL(e)), d.log("[CROSSx] JWKS 엔드포인트 설정:", e);
4527
4543
  } catch (s) {
4528
4544
  d.warn("[CROSSx] JWKS 엔드포인트 URL 파싱 실패:", s);
4529
4545
  }
@@ -4537,7 +4553,7 @@ class _n {
4537
4553
  iat: t.iat
4538
4554
  });
4539
4555
  const n = Math.floor(Date.now() / 1e3);
4540
- if (t.exp && t.exp + fn < n)
4556
+ if (t.exp && t.exp + _n < n)
4541
4557
  return d.warn("[CROSSx] 토큰 만료:", {
4542
4558
  exp: t.exp,
4543
4559
  now: n,
@@ -4547,7 +4563,7 @@ class _n {
4547
4563
  return d.warn("[CROSSx] JWT에 sub(사용자ID) 없음"), { payload: t, valid: !1, signatureVerified: !1 };
4548
4564
  if (this.jwks)
4549
4565
  try {
4550
- const { payload: i } = await Hs(e, this.jwks, {
4566
+ const { payload: i } = await Gs(e, this.jwks, {
4551
4567
  algorithms: ["RS256", "ES256"]
4552
4568
  });
4553
4569
  return d.log("[CROSSx] JWT 서명 검증 성공"), {
@@ -4566,7 +4582,7 @@ class _n {
4566
4582
  }
4567
4583
  }
4568
4584
  decodeJWT(e) {
4569
- return Fs(e);
4585
+ return Ws(e);
4570
4586
  }
4571
4587
  /**
4572
4588
  * EIP-191 personal_sign 서명에서 서명자 Ethereum 주소를 복원합니다.
@@ -4581,29 +4597,29 @@ class _n {
4581
4597
  ${t.length}`
4582
4598
  ), i = new Uint8Array(n.length + t.length);
4583
4599
  i.set(n, 0), i.set(t, n.length);
4584
- const o = Xt(i), a = s.startsWith("0x") ? s.slice(2) : s;
4600
+ const o = Zt(i), a = s.startsWith("0x") ? s.slice(2) : s;
4585
4601
  if (a.length !== 130)
4586
4602
  throw new Error(`서명 길이가 유효하지 않습니다: 130 hex 문자 예상, 현재 ${a.length}`);
4587
- const c = xn(a), l = c.slice(0, 32), u = c.slice(32, 64), p = c[64], _ = p >= 27 ? p - 27 : p, S = new rn.Signature(
4588
- Jt(l),
4589
- Jt(u)
4590
- ).addRecoveryBit(_).recoverPublicKey(o).toBytes(!1).slice(1), y = Xt(S);
4603
+ const c = gn(a), l = c.slice(0, 32), u = c.slice(32, 64), p = c[64], _ = p >= 27 ? p - 27 : p, S = new nn.Signature(
4604
+ Qt(l),
4605
+ Qt(u)
4606
+ ).addRecoveryBit(_).recoverPublicKey(o).toBytes(!1).slice(1), y = Zt(S);
4591
4607
  return "0x" + Be(y.slice(12));
4592
4608
  }
4593
4609
  }
4594
- function xn(r) {
4610
+ function gn(r) {
4595
4611
  const e = new Uint8Array(r.length / 2);
4596
4612
  for (let s = 0; s < e.length; s++)
4597
4613
  e[s] = parseInt(r.substring(s * 2, s * 2 + 2), 16);
4598
4614
  return e;
4599
4615
  }
4600
- function Jt(r) {
4616
+ function Qt(r) {
4601
4617
  let e = "0x";
4602
4618
  for (const s of r) e += s.toString(16).padStart(2, "0");
4603
4619
  return BigInt(e);
4604
4620
  }
4605
- const gn = 3e4, mn = 1e3;
4606
- class wn {
4621
+ const mn = 3e4, wn = 1e3;
4622
+ class yn {
4607
4623
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4608
4624
  async request(e) {
4609
4625
  const s = e.retries ?? 0;
@@ -4614,7 +4630,7 @@ class wn {
4614
4630
  } catch (n) {
4615
4631
  if (t === s) throw n;
4616
4632
  }
4617
- await new Promise((n) => setTimeout(n, mn * 2 ** t));
4633
+ await new Promise((n) => setTimeout(n, wn * 2 ** t));
4618
4634
  }
4619
4635
  throw new Error("Unexpected: retry loop exited without result");
4620
4636
  }
@@ -4622,7 +4638,7 @@ class wn {
4622
4638
  async _doRequest(e) {
4623
4639
  const s = new AbortController(), t = setTimeout(
4624
4640
  () => s.abort(),
4625
- e.timeoutMs ?? gn
4641
+ e.timeoutMs ?? mn
4626
4642
  );
4627
4643
  try {
4628
4644
  const n = await fetch(e.url, {
@@ -4649,7 +4665,7 @@ class wn {
4649
4665
  }
4650
4666
  }
4651
4667
  }
4652
- const yn = /* @__PURE__ */ new Set([
4668
+ const bn = /* @__PURE__ */ new Set([
4653
4669
  "https://cross-wallet-oauth.crosstoken.io",
4654
4670
  "https://stg-cross-wallet-oauth.crosstoken.io",
4655
4671
  "https://dev-cross-wallet-oauth.crosstoken.io"
@@ -4751,24 +4767,24 @@ class Ie {
4751
4767
  }
4752
4768
  }, 1e3), D = () => {
4753
4769
  clearTimeout(f), clearInterval(H), I && clearTimeout(I), window.removeEventListener("message", K);
4754
- }, K = (W) => {
4755
- if (W.origin !== e.expectedOrigin) return;
4756
- if (!yn.has(W.origin)) {
4757
- d.error("[CROSSx] postMessage origin이 허용 목록에 없음:", W.origin), D(), t(new Error("Unauthorized OAuth origin"));
4770
+ }, K = (G) => {
4771
+ if (G.origin !== e.expectedOrigin) return;
4772
+ if (!bn.has(G.origin)) {
4773
+ d.error("[CROSSx] postMessage origin이 허용 목록에 없음:", G.origin), D(), t(new Error("Unauthorized OAuth origin"));
4758
4774
  return;
4759
4775
  }
4760
4776
  D();
4761
- const Z = typeof W.data.status == "string", U = Z ? W.data.data ?? {} : W.data;
4777
+ const Z = typeof G.data.status == "string", U = Z ? G.data.data ?? {} : G.data;
4762
4778
  d.log("[CROSSx] OAuth postMessage 수신 —", {
4763
4779
  format: Z ? "wrapped" : "flat",
4764
- status: Z ? W.data.status : "(flat)"
4780
+ status: Z ? G.data.status : "(flat)"
4765
4781
  });
4766
- const z = (U == null ? void 0 : U.state) ?? W.data.state;
4782
+ const z = (U == null ? void 0 : U.state) ?? G.data.state;
4767
4783
  if (!z || z !== c) {
4768
4784
  t(new Error("OAuth state mismatch — possible CSRF attack"));
4769
4785
  return;
4770
4786
  }
4771
- if (Z && W.data.status !== "success") {
4787
+ if (Z && G.data.status !== "success") {
4772
4788
  d.error("[CROSSx] OAuth 실패:", U == null ? void 0 : U.error), t(new Error((U == null ? void 0 : U.error) || "Authentication failed"));
4773
4789
  return;
4774
4790
  }
@@ -4782,7 +4798,7 @@ class Ie {
4782
4798
  hasIdToken: !!k,
4783
4799
  hasEmail: !!T
4784
4800
  }), !E) {
4785
- d.error("[CROSSx] 토큰을 찾을 수 없음:", W.data), t(new Error("Token not found in response"));
4801
+ d.error("[CROSSx] 토큰을 찾을 수 없음:", G.data), t(new Error("Token not found in response"));
4786
4802
  return;
4787
4803
  }
4788
4804
  const x = { token: E, email: T }, m = (b) => {
@@ -4800,7 +4816,7 @@ class Ie {
4800
4816
  }
4801
4817
  }
4802
4818
  const Me = "crossx_wallet_data", ke = "crossx_mock_pin_hash";
4803
- class bn {
4819
+ class Sn {
4804
4820
  constructor(e, s) {
4805
4821
  this.storage = e, this.pinStore = s ?? null;
4806
4822
  }
@@ -4972,9 +4988,9 @@ class Ae {
4972
4988
  */
4973
4989
  async ensureValidToken() {
4974
4990
  const e = this.tokenStore.get();
4975
- if (e && !this.tokenStore.isExpiringSoon(Lt))
4991
+ if (e && !this.tokenStore.isExpiringSoon(Mt))
4976
4992
  return e;
4977
- const s = !e || this.tokenStore.isExpiringSoon(Lt);
4993
+ const s = !e || this.tokenStore.isExpiringSoon(Mt);
4978
4994
  if (this._onTokenRefresh) {
4979
4995
  if (await this.deduplicatedRefresh()) {
4980
4996
  const n = this.tokenStore.get();
@@ -5434,7 +5450,7 @@ class $e {
5434
5450
  }
5435
5451
  isCacheValid() {
5436
5452
  if (this.loadedAt === 0) return !1;
5437
- const e = this.usingFallback ? ir : nr;
5453
+ const e = this.usingFallback ? or : ir;
5438
5454
  return e === 0 ? !0 : Date.now() - this.loadedAt < e;
5439
5455
  }
5440
5456
  populateCache(e, s) {
@@ -5472,7 +5488,7 @@ class $e {
5472
5488
  );
5473
5489
  }
5474
5490
  static fallbackChains() {
5475
- return Object.values(Ye).map((e) => ({
5491
+ return Object.values(Xe).map((e) => ({
5476
5492
  chainId: e.caipId,
5477
5493
  rpcUrl: e.rpcUrl
5478
5494
  }));
@@ -5496,7 +5512,7 @@ class $e {
5496
5512
  }
5497
5513
  }
5498
5514
  }
5499
- const Zt = "__crossx-confirm-style", J = "__crossx-confirm-overlay", Sn = {
5515
+ const es = "__crossx-confirm-style", J = "__crossx-confirm-overlay", vn = {
5500
5516
  light: {
5501
5517
  bg: "#FFFFFF",
5502
5518
  border: "rgba(18,18,18,0.05)",
@@ -5552,8 +5568,8 @@ const Zt = "__crossx-confirm-style", J = "__crossx-confirm-overlay", Sn = {
5552
5568
  onPrimary: "#FFFFFF"
5553
5569
  }
5554
5570
  };
5555
- function Qt(r, e) {
5556
- const s = Sn[r], t = e == null ? void 0 : e[r];
5571
+ function ts(r, e) {
5572
+ const s = vn[r], t = e == null ? void 0 : e[r];
5557
5573
  return t ? {
5558
5574
  ...s,
5559
5575
  // ── Brand
@@ -5585,7 +5601,7 @@ function Qt(r, e) {
5585
5601
  ...t.error !== void 0 && { errorColor: t.error }
5586
5602
  } : s;
5587
5603
  }
5588
- const vn = `
5604
+ const En = `
5589
5605
  @import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600&display=swap');
5590
5606
 
5591
5607
  #${J} {
@@ -7416,8 +7432,8 @@ const vn = `
7416
7432
  }
7417
7433
  `;
7418
7434
  function le() {
7419
- let r = document.getElementById(Zt);
7420
- r || (r = document.createElement("style"), r.id = Zt, document.head.appendChild(r)), r.textContent = vn;
7435
+ let r = document.getElementById(es);
7436
+ r || (r = document.createElement("style"), r.id = es, document.head.appendChild(r)), r.textContent = En;
7421
7437
  }
7422
7438
  function de(r) {
7423
7439
  const e = (s) => s.stopPropagation();
@@ -7438,9 +7454,9 @@ function de(r) {
7438
7454
  s.preventDefault();
7439
7455
  }, { passive: !1 }), document.body.appendChild(r);
7440
7456
  }
7441
- const En = () => /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
7442
- function Ge() {
7443
- if (En()) {
7457
+ const In = () => /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
7458
+ function We() {
7459
+ if (In()) {
7444
7460
  const e = window.scrollY;
7445
7461
  return document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.left = "0", document.body.style.right = "0", () => {
7446
7462
  document.body.style.position = "", document.body.style.top = "", document.body.style.left = "", document.body.style.right = "", window.scrollTo(0, e);
@@ -7454,18 +7470,18 @@ function Ge() {
7454
7470
  function re(r) {
7455
7471
  return r ? r.length <= 13 ? r : `${r.slice(0, 6)}…${r.slice(-4)}` : "—";
7456
7472
  }
7457
- function In(r, e = "CROSS", s = 18) {
7473
+ function An(r, e = "CROSS", s = 18) {
7458
7474
  if (!r || r === "0x" || r === "0x0") return null;
7459
7475
  try {
7460
7476
  const t = BigInt(r);
7461
7477
  if (t === 0n) return null;
7462
- const n = pt(t, s);
7478
+ const n = _t(t, s);
7463
7479
  return n === "0" ? null : `${n} ${e}`;
7464
7480
  } catch {
7465
7481
  return null;
7466
7482
  }
7467
7483
  }
7468
- const es = {
7484
+ const ss = {
7469
7485
  1: "Ethereum Mainnet",
7470
7486
  5: "Goerli Testnet",
7471
7487
  11155111: "Ethereum Sepolia",
@@ -7488,16 +7504,16 @@ const es = {
7488
7504
  612044: "CROSS Testnet",
7489
7505
  612055: "CROSS Mainnet"
7490
7506
  };
7491
- function Ls(r) {
7507
+ function Ms(r) {
7492
7508
  const e = parseInt(r.split(":")[1] ?? "", 10);
7493
- return !isNaN(e) && es[e] ? es[e] : r;
7509
+ return !isNaN(e) && ss[e] ? ss[e] : r;
7494
7510
  }
7495
- function pt(r, e) {
7511
+ function _t(r, e) {
7496
7512
  if (r === 0n) return "0";
7497
7513
  const s = 10n ** BigInt(e), t = r / s, o = (r % s).toString().padStart(e, "0").slice(0, 6).replace(/0+$/, "");
7498
7514
  return o ? `${t}.${o}` : `${t}`;
7499
7515
  }
7500
- function ot(r) {
7516
+ function at(r) {
7501
7517
  try {
7502
7518
  const e = BigInt(r), s = e / 1000000000n, n = (e % 1000000000n).toString().padStart(9, "0").slice(0, 2).replace(/0+$/, "");
7503
7519
  return n ? `${s}.${n}` : `${s}`;
@@ -7505,25 +7521,25 @@ function ot(r) {
7505
7521
  return r;
7506
7522
  }
7507
7523
  }
7508
- function An(r) {
7524
+ function Tn(r) {
7509
7525
  try {
7510
7526
  return BigInt(r).toLocaleString();
7511
7527
  } catch {
7512
7528
  return r;
7513
7529
  }
7514
7530
  }
7515
- function Tn(r) {
7531
+ function Rn(r) {
7516
7532
  const { gasLimit: e, gasPrice: s, maxFeePerGas: t, maxPriorityFeePerGas: n, nativeSymbol: i = "ETH", nativeDecimals: o = 18 } = r;
7517
7533
  if (!e) return null;
7518
7534
  try {
7519
- const a = BigInt(e), c = An(e);
7535
+ const a = BigInt(e), c = Tn(e);
7520
7536
  if (t) {
7521
7537
  const l = a * BigInt(t);
7522
7538
  return {
7523
7539
  isDynamic: !0,
7524
- estTxFee: `${pt(l, o)} ${i}`,
7525
- maxFeeGwei: ot(t),
7526
- maxPriorityFeeGwei: n ? ot(n) : void 0,
7540
+ estTxFee: `${_t(l, o)} ${i}`,
7541
+ maxFeeGwei: at(t),
7542
+ maxPriorityFeeGwei: n ? at(n) : void 0,
7527
7543
  gasLimitFormatted: c
7528
7544
  };
7529
7545
  }
@@ -7531,8 +7547,8 @@ function Tn(r) {
7531
7547
  const l = a * BigInt(s);
7532
7548
  return {
7533
7549
  isDynamic: !1,
7534
- estTxFee: `${pt(l, o)} ${i}`,
7535
- gasPriceGwei: ot(s),
7550
+ estTxFee: `${_t(l, o)} ${i}`,
7551
+ gasPriceGwei: at(s),
7536
7552
  gasLimitFormatted: c
7537
7553
  };
7538
7554
  }
@@ -7541,8 +7557,8 @@ function Tn(r) {
7541
7557
  return null;
7542
7558
  }
7543
7559
  }
7544
- function Ds(r) {
7545
- const e = Tn(r);
7560
+ function $s(r) {
7561
+ const e = Rn(r);
7546
7562
  if (!e) return j("Estimated fee", "<span>—</span>");
7547
7563
  let s = j("Est. Tx Fee", `<span>${e.estTxFee}</span>`);
7548
7564
  return e.isDynamic ? (e.maxPriorityFeeGwei !== void 0 && (s += j("Max Priority Fee", `<span>${e.maxPriorityFeeGwei} Gwei</span>`)), e.maxFeeGwei !== void 0 && (s += j("Max Gas Fee", `<span>${e.maxFeeGwei} Gwei</span>`))) : e.gasPriceGwei !== void 0 && (s += j("Gas Price", `<span>${e.gasPriceGwei} Gwei</span>`)), e.gasLimitFormatted && (s += j("Gas Limit", `<span>${e.gasLimitFormatted}</span>`)), s;
@@ -7553,16 +7569,16 @@ const me = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="
7553
7569
  </svg>`, ie = `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
7554
7570
  <line x1="18" y1="6" x2="6" y2="18"/>
7555
7571
  <line x1="6" y1="6" x2="18" y2="18"/>
7556
- </svg>`, Rn = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
7572
+ </svg>`, kn = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
7557
7573
  <circle cx="20" cy="20" r="20" fill="#00D5AA"/>
7558
7574
  <path fill-rule="evenodd" clip-rule="evenodd" d="M20.3225 2.85742L23.7249 6.25982V11.8301L28.1175 7.43757L32.9292 12.2493L28.5806 16.5979H20.3225C18.4435 16.5979 16.9201 18.1212 16.9201 20.0003C16.9201 21.8794 18.4434 23.4027 20.3225 23.4027H28.5372L32.9293 27.7948L28.1176 32.6066L23.7249 28.2139V33.7407L20.3225 37.1431L16.9201 33.7407V28.2584L12.5719 32.6066L7.76022 27.7948L12.1524 23.4027H6.58209L3.17969 20.0003L6.58209 16.5979H12.1089L7.76035 12.2493L12.5721 7.43757L16.9201 11.7857V6.25982L20.3225 2.85742Z" fill="#121212"/>
7559
- </svg>`, St = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
7575
+ </svg>`, Et = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
7560
7576
  <rect x="2" y="5" width="16" height="12" rx="2" stroke="currentColor" stroke-width="1.5"/>
7561
7577
  <path d="M2 9h16" stroke="currentColor" stroke-width="1.5"/>
7562
7578
  <rect x="12.5" y="11.5" width="3.5" height="2.5" rx="0.75" fill="currentColor"/>
7563
- </svg>`, kn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
7564
- <path d="M12 0C18.6274 0 24 5.37258 24 12C23.9999 18.6273 18.6274 24 12 24C5.37264 24 9.89594e-05 18.6273 0 12C0 5.37258 5.37258 0 12 0ZM10.875 15.127V17.377H13.125V15.127H10.875ZM10.875 6.62207V13.627H13.125V6.62207H10.875Z" fill="var(--cx-error)"/>
7565
7579
  </svg>`, On = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
7580
+ <path d="M12 0C18.6274 0 24 5.37258 24 12C23.9999 18.6273 18.6274 24 12 24C5.37264 24 9.89594e-05 18.6273 0 12C0 5.37258 5.37258 0 12 0ZM10.875 15.127V17.377H13.125V15.127H10.875ZM10.875 6.62207V13.627H13.125V6.62207H10.875Z" fill="var(--cx-error)"/>
7581
+ </svg>`, Pn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
7566
7582
  <circle cx="12" cy="12" r="12" fill="var(--cx-error)"/>
7567
7583
  <circle cx="12" cy="12" r="5.5" stroke="white" stroke-width="1.5"/>
7568
7584
  <path d="M12 9.5v3l2 1.5" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
@@ -7600,9 +7616,9 @@ function j(r, e) {
7600
7616
  <div class="__crossx-row-value">${e}</div>
7601
7617
  </div>`;
7602
7618
  }
7603
- function Pn(r, e) {
7604
- const s = e, t = Ze(r.dappName), n = r.to ? `<span class="__crossx-addr-text">${re(r.to)}</span>
7605
- <button class="__crossx-copy-btn" data-copy="${L(r.to)}" title="Copy address">${me}</button>` : "<span>—</span>", i = Ds(r), o = r.data ?? "0x", a = document.createElement("div");
7619
+ function Cn(r, e) {
7620
+ const s = e, t = Qe(r.dappName), n = r.to ? `<span class="__crossx-addr-text">${re(r.to)}</span>
7621
+ <button class="__crossx-copy-btn" data-copy="${L(r.to)}" title="Copy address">${me}</button>` : "<span>—</span>", i = $s(r), o = r.data ?? "0x", a = document.createElement("div");
7606
7622
  return a.id = J, a.innerHTML = `
7607
7623
  <div class="__crossx-card __crossx-card--migration __crossx-card--sign-tx" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7608
7624
  <div class="__crossx-header">
@@ -7617,7 +7633,7 @@ function Pn(r, e) {
7617
7633
  <span class="__crossx-sig-origin">${L(t)} </span>is requesting a Signature
7618
7634
  </p>
7619
7635
  <div class="__crossx-addr-pill">
7620
- ${St}
7636
+ ${Et}
7621
7637
  <span class="__crossx-addr-pill-text">${re(r.from)}</span>
7622
7638
  </div>
7623
7639
  <p class="__crossx-warning">After you sign, changes or cancellations are not possible.</p>
@@ -7626,7 +7642,7 @@ function Pn(r, e) {
7626
7642
  <div class="__crossx-col-right-sign">
7627
7643
  <div class="__crossx-rows">
7628
7644
  ${j("To", n)}
7629
- ${j("Network", `<span>${Ls(r.chainId)}</span>`)}
7645
+ ${j("Network", `<span>${Ms(r.chainId)}</span>`)}
7630
7646
  ${i}
7631
7647
  </div>
7632
7648
  <pre class="__crossx-raw-tx">${L(o)}</pre>
@@ -7640,9 +7656,9 @@ function Pn(r, e) {
7640
7656
  </div>
7641
7657
  `, a;
7642
7658
  }
7643
- function Cn(r, e) {
7644
- const s = e, t = r.nativeSymbol ?? "ETH", n = r.nativeDecimals ?? 18, i = Ze(r.dappName), o = r.to ? `<span class="__crossx-addr-text">${re(r.to)}</span>
7645
- <button class="__crossx-copy-btn" data-copy="${L(r.to)}" title="Copy address">${me}</button>` : "<span>—</span>", a = Ds(r), l = In(r.value, t, n) ?? "—", u = document.createElement("div");
7659
+ function Nn(r, e) {
7660
+ const s = e, t = r.nativeSymbol ?? "ETH", n = r.nativeDecimals ?? 18, i = Qe(r.dappName), o = r.to ? `<span class="__crossx-addr-text">${re(r.to)}</span>
7661
+ <button class="__crossx-copy-btn" data-copy="${L(r.to)}" title="Copy address">${me}</button>` : "<span>—</span>", a = $s(r), l = An(r.value, t, n) ?? "—", u = document.createElement("div");
7646
7662
  return u.id = J, u.innerHTML = `
7647
7663
  <div class="__crossx-card __crossx-card--migration __crossx-card--send-tx" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7648
7664
  <div class="__crossx-header">
@@ -7657,7 +7673,7 @@ function Cn(r, e) {
7657
7673
  <div class="__crossx-body-cols">
7658
7674
  <div class="__crossx-rows">
7659
7675
  ${j("To", o)}
7660
- ${j("Network", `<span>${Ls(r.chainId)}</span>`)}
7676
+ ${j("Network", `<span>${Ms(r.chainId)}</span>`)}
7661
7677
  ${a}
7662
7678
  </div>
7663
7679
  <div class="__crossx-pill">
@@ -7670,7 +7686,7 @@ function Cn(r, e) {
7670
7686
  </div>
7671
7687
  `, u;
7672
7688
  }
7673
- function Ze(r) {
7689
+ function Qe(r) {
7674
7690
  var e;
7675
7691
  if (r) return r;
7676
7692
  try {
@@ -7682,10 +7698,10 @@ function Ze(r) {
7682
7698
  function L(r) {
7683
7699
  return r.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
7684
7700
  }
7685
- function Nn(r) {
7701
+ function Ln(r) {
7686
7702
  return typeof r == "string" && /^0x[0-9a-fA-F]{40}$/i.test(r);
7687
7703
  }
7688
- function Ln(r) {
7704
+ function Dn(r) {
7689
7705
  if (typeof r == "string") return L(r);
7690
7706
  if (typeof r == "number" || typeof r == "bigint" || typeof r == "boolean") return String(r);
7691
7707
  try {
@@ -7694,7 +7710,7 @@ function Ln(r) {
7694
7710
  return String(r);
7695
7711
  }
7696
7712
  }
7697
- function Dn(r, e) {
7713
+ function Mn(r, e) {
7698
7714
  const s = j(
7699
7715
  "From",
7700
7716
  `<span class="__crossx-addr-text">${re(r.from)}</span>
@@ -7726,7 +7742,7 @@ function Dn(r, e) {
7726
7742
  </div>
7727
7743
  `, c;
7728
7744
  }
7729
- function Mn(r, e) {
7745
+ function $n(r, e) {
7730
7746
  const s = document.createElement("div");
7731
7747
  return s.id = J, s.innerHTML = `
7732
7748
  <div class="__crossx-card __crossx-card--migration" style="${ae(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -7743,10 +7759,10 @@ function Mn(r, e) {
7743
7759
  </div>
7744
7760
  `, s;
7745
7761
  }
7746
- function $n(r, e, s) {
7762
+ function Bn(r, e, s) {
7747
7763
  const t = e.status !== "reverted" && e.status !== "timeout", n = e.status === "timeout", i = r.querySelector("#__crossx-ttl"), o = r.querySelector(".__crossx-header");
7748
7764
  if (i) {
7749
- const w = n ? On : t ? "" : kn, S = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
7765
+ const w = n ? Pn : t ? "" : On, S = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
7750
7766
  w ? (i.style.display = "flex", i.style.alignItems = "center", i.style.gap = "8px", i.innerHTML = `${w}<span>${S}</span>`) : i.textContent = S;
7751
7767
  }
7752
7768
  if (o && !r.querySelector("#__crossx-close-btn")) {
@@ -7782,8 +7798,8 @@ function $n(r, e, s) {
7782
7798
  });
7783
7799
  });
7784
7800
  }
7785
- function Bn(r, e) {
7786
- const s = e, t = Ze(r.dappName), n = L(r.message), i = document.createElement("div");
7801
+ function Un(r, e) {
7802
+ const s = e, t = Qe(r.dappName), n = L(r.message), i = document.createElement("div");
7787
7803
  return i.id = J, i.innerHTML = `
7788
7804
  <div class="__crossx-card __crossx-card--migration __crossx-card--sign-msg" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7789
7805
  <div class="__crossx-header">
@@ -7798,7 +7814,7 @@ function Bn(r, e) {
7798
7814
  <span class="__crossx-sig-origin">${L(t)} </span>is requesting a Signature
7799
7815
  </p>
7800
7816
  <div class="__crossx-addr-pill">
7801
- ${St}
7817
+ ${Et}
7802
7818
  <span class="__crossx-addr-pill-text">${re(r.from)}</span>
7803
7819
  </div>
7804
7820
  <p class="__crossx-warning">After you sign, changes or cancellations are not possible.</p>
@@ -7814,8 +7830,8 @@ function Bn(r, e) {
7814
7830
  </div>
7815
7831
  `, i;
7816
7832
  }
7817
- function Un(r, e) {
7818
- const s = e, t = Ze(r.dappName);
7833
+ function Hn(r, e) {
7834
+ const s = e, t = Qe(r.dappName);
7819
7835
  let n = {};
7820
7836
  if (typeof r.typedData == "string")
7821
7837
  try {
@@ -7830,7 +7846,7 @@ function Un(r, e) {
7830
7846
  <span class="__crossx-td-value">${L(i)}</span>
7831
7847
  </div>`;
7832
7848
  for (const [l, u] of Object.entries(o)) {
7833
- const p = Ln(u), f = Nn(u) ? `<span class="__crossx-addr-text">${re(u)}</span>
7849
+ const p = Dn(u), f = Ln(u) ? `<span class="__crossx-addr-text">${re(u)}</span>
7834
7850
  <button class="__crossx-copy-btn" data-copy="${L(String(u))}" title="Copy">${me}</button>` : `<span>${p}</span>`;
7835
7851
  a += `
7836
7852
  <div class="__crossx-td-row">
@@ -7853,7 +7869,7 @@ function Un(r, e) {
7853
7869
  <span class="__crossx-sig-origin">${L(t)} </span>is requesting a Signature
7854
7870
  </p>
7855
7871
  <div class="__crossx-addr-pill">
7856
- ${St}
7872
+ ${Et}
7857
7873
  <span class="__crossx-addr-pill-text">${re(r.from)}</span>
7858
7874
  </div>
7859
7875
  <p class="__crossx-warning">After you sign, changes or cancellations are not possible.</p>
@@ -7869,11 +7885,11 @@ function Un(r, e) {
7869
7885
  </div>
7870
7886
  `, c;
7871
7887
  }
7872
- const Hn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
7888
+ const Fn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
7873
7889
  <line x1="12" y1="5" x2="12" y2="19"/>
7874
7890
  <line x1="5" y1="12" x2="19" y2="12"/>
7875
7891
  </svg>`;
7876
- function Fn(r, e, s) {
7892
+ function Gn(r, e, s) {
7877
7893
  const t = s == null ? void 0 : s.toLowerCase(), n = r.map((o) => {
7878
7894
  const a = t && o.address.toLowerCase() === t;
7879
7895
  return `<button class="__crossx-wallet-item" data-wallet-index="${o.index}" data-wallet-address="${L(o.address)}">
@@ -7904,7 +7920,7 @@ function Fn(r, e, s) {
7904
7920
  ${n}
7905
7921
  </div>
7906
7922
  <button class="__crossx-wallet-add" id="__crossx-add-wallet-btn" type="button">
7907
- <span class="__crossx-wallet-add-icon">${Hn}</span>
7923
+ <span class="__crossx-wallet-add-icon">${Fn}</span>
7908
7924
  <span class="__crossx-wallet-add-label">add a wallet</span>
7909
7925
  </button>
7910
7926
  </div>
@@ -7916,13 +7932,13 @@ function Fn(r, e, s) {
7916
7932
  const Wn = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
7917
7933
  <path d="M26.693 21.193c-.028-3.168 2.587-4.712 2.706-4.786-1.477-2.16-3.77-2.454-4.58-2.484-1.944-.197-3.804 1.148-4.793 1.148-.992 0-2.52-1.12-4.147-1.09-2.13.032-4.1 1.239-5.198 3.133-2.222 3.855-.569 9.562 1.593 12.69 1.061 1.535 2.318 3.258 3.975 3.196 1.6-.064 2.2-1.03 4.133-1.03 1.928 0 2.48 1.03 4.172.997 1.72-.03 2.806-1.56 3.862-3.1 1.211-1.779 1.713-3.495 1.74-3.583-.037-.017-3.427-1.316-3.463-5.09z" fill="currentColor"/>
7918
7934
  <path d="M23.527 11.876c.877-1.065 1.471-2.545 1.31-4.024-1.266.053-2.807.845-3.718 1.907-.813.946-1.53 2.468-1.34 3.915 1.41.107 2.852-.716 3.748-1.798z" fill="currentColor"/>
7919
- </svg>`, Gn = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
7935
+ </svg>`, qn = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
7920
7936
  <path d="M38.06 20.44c0-1.34-.12-2.63-.34-3.87H20.5v7.32h9.84c-.42 2.28-1.71 4.21-3.65 5.51v4.57h5.91c3.46-3.19 5.46-7.88 5.46-13.53z" fill="#4285F4"/>
7921
7937
  <path d="M20.5 38.5c4.94 0 9.09-1.64 12.12-4.44l-5.91-4.57c-1.64 1.1-3.73 1.75-6.21 1.75-4.77 0-8.82-3.22-10.26-7.55H4.16v4.72A18.49 18.49 0 0 0 20.5 38.5z" fill="#34A853"/>
7922
7938
  <path d="M10.24 23.69A11.16 11.16 0 0 1 9.66 20c0-1.28.22-2.52.58-3.69v-4.72H4.16A18.49 18.49 0 0 0 2 20c0 2.97.71 5.78 1.97 8.28l6.27-4.59z" fill="#FBBC05"/>
7923
7939
  <path d="M20.5 8.76c2.69 0 5.1.92 7 2.73l5.24-5.24C29.58 3.36 25.43 1.5 20.5 1.5A18.49 18.49 0 0 0 4.16 11.59l6.08 4.72C11.68 11.98 15.73 8.76 20.5 8.76z" fill="#EA4335"/>
7924
7940
  </svg>`;
7925
- function qn(r, e = !1) {
7941
+ function Kn(r, e = !1) {
7926
7942
  const s = r, t = e ? `
7927
7943
  <div class="__crossx-login-or-divider">
7928
7944
  <hr><span>or</span><hr>
@@ -7950,7 +7966,7 @@ function qn(r, e = !1) {
7950
7966
  <span class="__crossx-login-btn-label">Sign in with&nbsp;&nbsp;Apple</span>
7951
7967
  </button>
7952
7968
  <button class="__crossx-login-btn" id="__crossx-google-btn" type="button">
7953
- <span class="__crossx-login-icon">${Gn}</span>
7969
+ <span class="__crossx-login-icon">${qn}</span>
7954
7970
  <span class="__crossx-login-btn-label">Sign in with&nbsp;&nbsp;Google</span>
7955
7971
  </button>
7956
7972
  </div>${t}
@@ -7961,7 +7977,7 @@ function qn(r, e = !1) {
7961
7977
  </div>
7962
7978
  `, n;
7963
7979
  }
7964
- function Kn(r, e) {
7980
+ function Vn(r, e) {
7965
7981
  const s = r, t = document.createElement("div");
7966
7982
  t.id = J;
7967
7983
  const n = L(e.message).replace(/\n/g, "<br>"), i = e.email ? `<div class="__crossx-session-account-card">
@@ -7989,7 +8005,7 @@ function Kn(r, e) {
7989
8005
  </div>
7990
8006
  `, t;
7991
8007
  }
7992
- function Vn(r, e = !0) {
8008
+ function zn(r, e = !0) {
7993
8009
  const s = r, t = e ? `<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ie}</button>` : "", n = e ? '<button class="__crossx-skip-btn" id="__crossx-skip-btn">Skip for Now</button>' : "", i = document.createElement("div");
7994
8010
  return i.id = J, i.innerHTML = `
7995
8011
  <div class="__crossx-card __crossx-card--migration" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -8005,7 +8021,7 @@ function Vn(r, e = !0) {
8005
8021
  <p class="__crossx-mig-info-desc">It safely restores and integrates all your previous assets. Simply verify your PIN to get started.</p>
8006
8022
  </div>
8007
8023
  <button class="__crossx-recover-btn" id="__crossx-recover-btn">
8008
- <span class="__crossx-recover-icon">${Rn}</span>
8024
+ <span class="__crossx-recover-icon">${kn}</span>
8009
8025
  <span class="__crossx-recover-label">Import from Social Backup</span>
8010
8026
  </button>
8011
8027
  ${n}
@@ -8013,7 +8029,7 @@ function Vn(r, e = !0) {
8013
8029
  </div>
8014
8030
  `, i;
8015
8031
  }
8016
- function zn(r, e) {
8032
+ function jn(r, e) {
8017
8033
  const s = r, { errorMessage: t, attemptCount: n, maxAttempts: i = 5 } = e ?? {}, o = !!t, a = o ? " --error" : "", c = n != null && n > 0 ? `<p class="__crossx-pin-attempt">${n}/${i}</p>` : "", l = n != null && n >= 3 ? '<p class="__crossx-pin-warning">Your account will be locked after further failures.</p>' : "", u = o ? `<p class="__crossx-pin-error-text">${t}</p>` : "", p = document.createElement("div");
8018
8034
  return p.id = J, p.innerHTML = `
8019
8035
  <div class="__crossx-card __crossx-card--migration" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -8037,12 +8053,12 @@ function zn(r, e) {
8037
8053
  </div>
8038
8054
  `, p;
8039
8055
  }
8040
- function jn(r) {
8056
+ function Yn(r) {
8041
8057
  const e = new Date(r), s = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], t = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], n = s[e.getDay()], i = t[e.getMonth()], o = e.getDate(), a = String(e.getHours()).padStart(2, "0"), c = String(e.getMinutes()).padStart(2, "0");
8042
8058
  return `${n}, ${i} ${o} ${a}:${c}`;
8043
8059
  }
8044
- function Yn(r, e, s) {
8045
- const t = r, n = e <= 0, i = n ? null : Date.now() + e * 1e3, o = i ? jn(i) : null, a = document.createElement("div");
8060
+ function Xn(r, e, s) {
8061
+ const t = r, n = e <= 0, i = n ? null : Date.now() + e * 1e3, o = i ? Yn(i) : null, a = document.createElement("div");
8046
8062
  return a.id = J, a.innerHTML = `
8047
8063
  <div class="__crossx-card __crossx-card--migration" style="${ae(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
8048
8064
  <div class="__crossx-header">
@@ -8072,10 +8088,10 @@ function Yn(r, e, s) {
8072
8088
  return () => clearInterval(p);
8073
8089
  } };
8074
8090
  }
8075
- function Xn(r) {
8091
+ function Jn(r) {
8076
8092
  const s = [r.check1, r.check2].map((t, n) => `
8077
8093
  <div class="__crossx-pw-notice-item" data-check-index="${n}" role="checkbox" aria-checked="false" tabindex="0">
8078
- <div class="__crossx-pw-notice-check" id="__crossx-notice-check-${n}">${Qn}</div>
8094
+ <div class="__crossx-pw-notice-check" id="__crossx-notice-check-${n}">${ei}</div>
8079
8095
  <span class="__crossx-pw-notice-item-text">${L(t)}</span>
8080
8096
  </div>
8081
8097
  `).join("");
@@ -8090,7 +8106,7 @@ function Xn(r) {
8090
8106
  <div class="__crossx-pw-fields __crossx-pw-fields--notice">
8091
8107
  <div class="__crossx-pw-notice-header">
8092
8108
  <div class="__crossx-pw-notice-title-row">
8093
- <span class="__crossx-pw-notice-icon">${ei}</span>
8109
+ <span class="__crossx-pw-notice-icon">${ti}</span>
8094
8110
  <p class="__crossx-pw-notice-title">${L(r.noticeTitle)}</p>
8095
8111
  </div>
8096
8112
  <p class="__crossx-pw-notice-desc">${L(r.noticeDesc)}</p>
@@ -8108,9 +8124,9 @@ function Xn(r) {
8108
8124
  <div class="__crossx-home-indicator"></div>
8109
8125
  `;
8110
8126
  }
8111
- function at(r) {
8127
+ function ct(r) {
8112
8128
  const e = !!r.lockExpiresAt && r.lockExpiresAt > Date.now(), s = r.lockExpiresAt ? ` data-lock-expires="${r.lockExpiresAt}"` : "", t = r.headerSubtitle ? `<p class="__crossx-pin6-header-sub">${L(r.headerSubtitle)}</p>` : "", n = r.subtitle ? `<p class="__crossx-pin6-subtitle">${L(r.subtitle)}</p>` : "", i = r.errorMessage ? `<p class="__crossx-pin6-error" id="__crossx-pin6-error">${L(r.errorMessage)}</p>` : '<p class="__crossx-pin6-error" id="__crossx-pin6-error"></p>', o = e ? `<p class="__crossx-pin6-lock-msg" id="__crossx-pin6-lock-msg">
8113
- ${Ms}
8129
+ ${Bs}
8114
8130
  <span id="__crossx-pin6-lock-countdown"></span>
8115
8131
  </p>` : "", a = r.attemptCount != null && r.attemptCount > 0 ? `<p class="__crossx-pin6-attempt" id="__crossx-pin6-attempt">${r.attemptCount}/${r.maxAttempts ?? "?"}</p>` : '<p class="__crossx-pin6-attempt" id="__crossx-pin6-attempt"></p>', c = e ? " --locked" : "", l = Array.from(
8116
8132
  { length: 6 },
@@ -8135,7 +8151,7 @@ function at(r) {
8135
8151
  <div class="__crossx-home-indicator"></div>
8136
8152
  `;
8137
8153
  }
8138
- function ts(r, e) {
8154
+ function rs(r, e) {
8139
8155
  const s = document.createElement("div");
8140
8156
  return s.id = J, s.innerHTML = `
8141
8157
  <div class="__crossx-card __crossx-card--pin6" style="${ae(r)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -8143,18 +8159,18 @@ function ts(r, e) {
8143
8159
  </div>
8144
8160
  `, s;
8145
8161
  }
8146
- function Jn(r, e) {
8162
+ function Zn(r, e) {
8147
8163
  if (r.length !== 6) return e.tooShort;
8148
8164
  if (!/^\d+$/.test(r)) return e.numbersOnly;
8149
8165
  if (/(.)\1{2}/.test(r)) return e.repeatingDigit;
8150
8166
  const s = r.split("").map(Number), t = s.every((i, o) => o === 0 || i === (s[o - 1] + 1) % 10), n = s.every((i, o) => o === 0 || i === (s[o - 1] + 9) % 10);
8151
8167
  return t || n ? e.sequential : r[0] !== r[1] && r === r.slice(0, 2).repeat(3) ? e.alternatingPattern : null;
8152
8168
  }
8153
- function Zn(r) {
8169
+ function Qn(r) {
8154
8170
  const e = Math.max(0, Math.ceil(r / 1e3)), s = Math.floor(e / 3600), t = Math.floor(e % 3600 / 60), n = e % 60;
8155
8171
  return s > 0 ? `${s}h ${String(t).padStart(2, "0")}m` : `${String(t).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
8156
8172
  }
8157
- function ct(r, e, s, t, n, i) {
8173
+ function lt(r, e, s, t, n, i) {
8158
8174
  var U, z;
8159
8175
  let o = !!(i && i > Date.now()), a = !1;
8160
8176
  const c = () => Array.from(r.querySelectorAll(".__crossx-pin6-box")), l = () => r.querySelector("#__crossx-pin6-boxes"), u = () => r.querySelector("#__crossx-pin6-error"), p = () => r.querySelector("#__crossx-pin6-lock-msg"), _ = () => r.querySelector("#__crossx-pin6-lock-countdown"), f = () => r.querySelector(".__crossx-pin6-body"), w = () => c().map((k) => k.value).join(""), S = (k) => {
@@ -8194,7 +8210,7 @@ function ct(r, e, s, t, n, i) {
8194
8210
  const v = u();
8195
8211
  if (v && (v.textContent = "Too many failed attempts. Please wait."), !p()) {
8196
8212
  const b = document.createElement("p");
8197
- b.className = "__crossx-pin6-lock-msg", b.id = "__crossx-pin6-lock-msg", b.innerHTML = `${Ms}<span id="__crossx-pin6-lock-countdown"></span>`;
8213
+ b.className = "__crossx-pin6-lock-msg", b.id = "__crossx-pin6-lock-msg", b.innerHTML = `${Bs}<span id="__crossx-pin6-lock-countdown"></span>`;
8198
8214
  const A = u();
8199
8215
  A ? A.insertAdjacentElement("afterend", b) : (m = f()) == null || m.appendChild(b);
8200
8216
  }
@@ -8204,14 +8220,14 @@ function ct(r, e, s, t, n, i) {
8204
8220
  b <= 0 ? (clearInterval(T), S(!1), (N = p()) == null || N.remove(), v && (v.textContent = ""), setTimeout(() => {
8205
8221
  var C;
8206
8222
  return (C = c()[0]) == null ? void 0 : C.focus();
8207
- }, 50)) : A && (A.textContent = ` ${Zn(b)}`);
8223
+ }, 50)) : A && (A.textContent = ` ${Qn(b)}`);
8208
8224
  }, T = setInterval(E, 1e3);
8209
8225
  E();
8210
8226
  const x = new MutationObserver(() => {
8211
8227
  document.contains(r) || (clearInterval(T), x.disconnect());
8212
8228
  });
8213
8229
  x.observe(document.body, { childList: !0, subtree: !1 });
8214
- }, W = async () => {
8230
+ }, G = async () => {
8215
8231
  if (o || a) return;
8216
8232
  const k = w();
8217
8233
  if (k.length === 6) {
@@ -8251,7 +8267,7 @@ function ct(r, e, s, t, n, i) {
8251
8267
  k.addEventListener("input", () => {
8252
8268
  var T;
8253
8269
  const E = k.value.replace(/\D/g, "").slice(-1);
8254
- k.value = E, I(), E && v < 5 && ((T = c()[v + 1]) == null || T.focus()), w().length === 6 && setTimeout(W, 80);
8270
+ k.value = E, I(), E && v < 5 && ((T = c()[v + 1]) == null || T.focus()), w().length === 6 && setTimeout(G, 80);
8255
8271
  }), k.addEventListener("keydown", (E) => {
8256
8272
  var T, x;
8257
8273
  if (E.key === "Backspace") {
@@ -8270,18 +8286,18 @@ function ct(r, e, s, t, n, i) {
8270
8286
  const x = c();
8271
8287
  T.split("").forEach((A, N) => {
8272
8288
  x[N] && (x[N].value = A);
8273
- }), (b = x[Math.min(T.length - 1, 5)]) == null || b.focus(), I(), w().length === 6 && setTimeout(W, 80);
8289
+ }), (b = x[Math.min(T.length - 1, 5)]) == null || b.focus(), I(), w().length === 6 && setTimeout(G, 80);
8274
8290
  }), k.addEventListener("focus", () => k.select());
8275
8291
  });
8276
8292
  }
8277
- const Ms = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
8293
+ const Bs = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
8278
8294
  <path d="M14.5 8.5H14V6.5C14 4.015 11.985 2 9.5 2C7.015 2 5 4.015 5 6.5V8.5H4.5C3.672 8.5 3 9.172 3 10V16.5C3 17.328 3.672 18 4.5 18H14.5C15.328 18 16 17.328 16 16.5V10C16 9.172 15.328 8.5 14.5 8.5ZM10.5 13.415V15C10.5 15.276 10.276 15.5 10 15.5H9C8.724 15.5 8.5 15.276 8.5 15V13.415C8.187 13.196 8 12.847 8 12.5C8 11.672 8.672 11 9.5 11C10.328 11 11 11.672 11 12.5C11 12.847 10.813 13.196 10.5 13.415ZM12.5 8.5H6.5V6.5C6.5 4.843 7.843 3.5 9.5 3.5C11.157 3.5 12.5 4.843 12.5 6.5V8.5Z" fill="currentColor"/>
8279
- </svg>`, Qn = `<svg width="11" height="9" viewBox="0 0 11 9" fill="none" xmlns="http://www.w3.org/2000/svg">
8295
+ </svg>`, ei = `<svg width="11" height="9" viewBox="0 0 11 9" fill="none" xmlns="http://www.w3.org/2000/svg">
8280
8296
  <path d="M1 4.5L4 7.5L10 1" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
8281
- </svg>`, ei = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
8297
+ </svg>`, ti = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
8282
8298
  <path d="M12 0C18.6274 0 24 5.37258 24 12C23.9999 18.6273 18.6274 24 12 24C5.37264 24 9.89594e-05 18.6273 0 12C0 5.37258 5.37258 0 12 0ZM10.875 15.127V17.377H13.125V15.127H10.875ZM10.875 6.62207V13.627H13.125V6.62207H10.875Z" fill="currentColor"/>
8283
8299
  </svg>`;
8284
- function ti(r, e, s) {
8300
+ function si(r, e, s) {
8285
8301
  var i;
8286
8302
  const t = r.querySelectorAll(".__crossx-pin-input");
8287
8303
  t.forEach((o, a) => {
@@ -8314,12 +8330,12 @@ function ti(r, e, s) {
8314
8330
  }
8315
8331
  }), (i = t[0]) == null || i.focus();
8316
8332
  }
8317
- class si {
8333
+ class ri {
8318
8334
  constructor(e = "light", s) {
8319
- this.theme = e, this.overrides = s, this.tokens = Qt(e, s);
8335
+ this.theme = e, this.overrides = s, this.tokens = ts(e, s);
8320
8336
  }
8321
8337
  setTheme(e, s) {
8322
- this.theme = e, s !== void 0 && (this.overrides = s), this.tokens = Qt(e, this.overrides);
8338
+ this.theme = e, s !== void 0 && (this.overrides = s), this.tokens = ts(e, this.overrides);
8323
8339
  }
8324
8340
  setMessages(e) {
8325
8341
  this.messages = e;
@@ -8336,7 +8352,7 @@ class si {
8336
8352
  return new Promise((n) => {
8337
8353
  var S;
8338
8354
  le();
8339
- const i = [...e], o = Fn(i, this.tokens, t), a = Ge();
8355
+ const i = [...e], o = Gn(i, this.tokens, t), a = We();
8340
8356
  de(o);
8341
8357
  let c = !1;
8342
8358
  const l = () => {
@@ -8388,7 +8404,7 @@ class si {
8388
8404
  return new Promise((s) => {
8389
8405
  var c, l, u, p;
8390
8406
  le();
8391
- const t = qn(this.tokens, e == null ? void 0 : e.showConnectOtherWallets);
8407
+ const t = Kn(this.tokens, e == null ? void 0 : e.showConnectOtherWallets);
8392
8408
  de(t);
8393
8409
  const n = () => t.remove(), i = (_) => {
8394
8410
  n(), s(_);
@@ -8410,14 +8426,14 @@ class si {
8410
8426
  return new Promise((s) => {
8411
8427
  var u, p, _;
8412
8428
  le();
8413
- const t = this.messages, n = Kn(this.tokens, {
8429
+ const t = this.messages, n = Vn(this.tokens, {
8414
8430
  title: e.title,
8415
8431
  message: e.message,
8416
8432
  email: e.email,
8417
8433
  accountLabel: (t == null ? void 0 : t.sessionAlert_accountLabel) ?? "Account",
8418
8434
  signOutLabel: (t == null ? void 0 : t.sessionAlert_signOutButton) ?? "Sign out",
8419
8435
  signInAgainLabel: (t == null ? void 0 : t.sessionAlert_signInAgainButton) ?? "Sign in again"
8420
- }), i = Ge();
8436
+ }), i = We();
8421
8437
  de(n);
8422
8438
  let o = !1;
8423
8439
  const a = () => {
@@ -8440,7 +8456,7 @@ class si {
8440
8456
  return new Promise((t) => {
8441
8457
  var a, c, l;
8442
8458
  le();
8443
- const n = Vn(this.tokens, s);
8459
+ const n = zn(this.tokens, s);
8444
8460
  de(n);
8445
8461
  const i = () => n.remove(), o = () => {
8446
8462
  i(), t("recover");
@@ -8486,7 +8502,7 @@ class si {
8486
8502
  }, o = {
8487
8503
  title: (t == null ? void 0 : t.pinSetup_confirmTitle) ?? "Confirm PIN",
8488
8504
  headerSubtitle: (t == null ? void 0 : t.pinSetup_confirmSubtitle) ?? "Enter your PIN again to confirm."
8489
- }, a = ts(this.tokens, Xn(n)), c = Ge();
8505
+ }, a = rs(this.tokens, Jn(n)), c = We();
8490
8506
  de(a);
8491
8507
  let l = !1;
8492
8508
  const u = () => {
@@ -8503,21 +8519,21 @@ class si {
8503
8519
  alternatingPattern: (t == null ? void 0 : t.pinValidation_alternatingPattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
8504
8520
  }, S = (P) => {
8505
8521
  var H;
8506
- f.innerHTML = at({
8522
+ f.innerHTML = ct({
8507
8523
  title: o.title,
8508
8524
  headerSubtitle: o.headerSubtitle
8509
- }), (H = f.querySelector("#__crossx-close-btn")) == null || H.addEventListener("click", _), ct(f, (D) => {
8525
+ }), (H = f.querySelector("#__crossx-close-btn")) == null || H.addEventListener("click", _), lt(f, (D) => {
8510
8526
  D === P ? p(P) : y(i.mismatchError);
8511
8527
  }, _);
8512
8528
  }, y = (P) => {
8513
8529
  var H;
8514
- f.innerHTML = at({
8530
+ f.innerHTML = ct({
8515
8531
  title: i.title,
8516
8532
  headerSubtitle: i.headerSubtitle,
8517
8533
  subtitle: i.subtitle,
8518
8534
  errorMessage: P
8519
- }), (H = f.querySelector("#__crossx-close-btn")) == null || H.addEventListener("click", _), ct(f, (D) => {
8520
- const K = Jn(D, w);
8535
+ }), (H = f.querySelector("#__crossx-close-btn")) == null || H.addEventListener("click", _), lt(f, (D) => {
8536
+ const K = Zn(D, w);
8521
8537
  K ? y(K) : S(D);
8522
8538
  }, _);
8523
8539
  };
@@ -8525,9 +8541,9 @@ class si {
8525
8541
  var k;
8526
8542
  const P = Array.from(f.querySelectorAll(".__crossx-pw-notice-item")), H = f.querySelector("#__crossx-pin-notice-next"), D = /* @__PURE__ */ new Set();
8527
8543
  H.removeAttribute("disabled");
8528
- const K = H.dataset.nextLabel ?? "Next", W = H.dataset.submitLabel ?? "I Understand", Z = () => {
8544
+ const K = H.dataset.nextLabel ?? "Next", G = H.dataset.submitLabel ?? "I Understand", Z = () => {
8529
8545
  const v = D.size === P.length;
8530
- H.classList.toggle("--disabled", !v), H.textContent = v ? W : K;
8546
+ H.classList.toggle("--disabled", !v), H.textContent = v ? G : K;
8531
8547
  }, U = (v, E) => {
8532
8548
  if (D.has(E)) return;
8533
8549
  const T = v.querySelector(`#__crossx-notice-check-${E}`);
@@ -8573,9 +8589,9 @@ class si {
8573
8589
  return new Promise((s, t) => {
8574
8590
  var y;
8575
8591
  le();
8576
- const n = this.messages, i = (e == null ? void 0 : e.verifyMode) === !0, o = i ? (n == null ? void 0 : n.verifyPin_title) ?? "Verify Your PIN" : (n == null ? void 0 : n.pinInput_title) ?? "Enter PIN", a = i ? (n == null ? void 0 : n.verifyPin_subtitle) ?? "Enter your PIN to authorize this transaction." : (n == null ? void 0 : n.pinInput_subtitle) ?? "Enter your 6-digit PIN to continue.", c = ts(
8592
+ const n = this.messages, i = (e == null ? void 0 : e.verifyMode) === !0, o = i ? (n == null ? void 0 : n.verifyPin_title) ?? "Verify Your PIN" : (n == null ? void 0 : n.pinInput_title) ?? "Enter PIN", a = i ? (n == null ? void 0 : n.verifyPin_subtitle) ?? "Enter your PIN to authorize this transaction." : (n == null ? void 0 : n.pinInput_subtitle) ?? "Enter your 6-digit PIN to continue.", c = rs(
8577
8593
  this.tokens,
8578
- at({
8594
+ ct({
8579
8595
  title: o,
8580
8596
  headerSubtitle: a,
8581
8597
  errorMessage: e == null ? void 0 : e.errorMessage,
@@ -8583,7 +8599,7 @@ class si {
8583
8599
  attemptCount: e == null ? void 0 : e.attemptCount,
8584
8600
  maxAttempts: e == null ? void 0 : e.maxAttempts
8585
8601
  })
8586
- ), l = Ge();
8602
+ ), l = We();
8587
8603
  de(c);
8588
8604
  let u = !1;
8589
8605
  const p = () => {
@@ -8595,7 +8611,7 @@ class si {
8595
8611
  }, w = (I) => {
8596
8612
  p(), t(I);
8597
8613
  }, S = c.querySelector(".__crossx-card");
8598
- (y = S.querySelector("#__crossx-close-btn")) == null || y.addEventListener("click", f), ct(S, _, f, w, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt), c.addEventListener("click", (I) => {
8614
+ (y = S.querySelector("#__crossx-close-btn")) == null || y.addEventListener("click", f), lt(S, _, f, w, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt), c.addEventListener("click", (I) => {
8599
8615
  I.target === c && f();
8600
8616
  });
8601
8617
  });
@@ -8611,14 +8627,14 @@ class si {
8611
8627
  return new Promise((s) => {
8612
8628
  var a;
8613
8629
  le();
8614
- const t = zn(this.tokens, e);
8630
+ const t = jn(this.tokens, e);
8615
8631
  de(t);
8616
8632
  const n = () => t.remove(), i = (c) => {
8617
8633
  n(), s(c);
8618
8634
  }, o = () => {
8619
8635
  n(), s(null);
8620
8636
  };
8621
- ti(t, i, o), (a = t.querySelector("#__crossx-close-btn")) == null || a.addEventListener("click", o), t.addEventListener("click", (c) => {
8637
+ si(t, i, o), (a = t.querySelector("#__crossx-close-btn")) == null || a.addEventListener("click", o), t.addEventListener("click", (c) => {
8622
8638
  c.target === t && o();
8623
8639
  });
8624
8640
  });
@@ -8633,7 +8649,7 @@ class si {
8633
8649
  return new Promise((t) => {
8634
8650
  var l;
8635
8651
  le();
8636
- const { overlay: n, startCountdown: i } = Yn(this.tokens, e, s);
8652
+ const { overlay: n, startCountdown: i } = Xn(this.tokens, e, s);
8637
8653
  de(n);
8638
8654
  const o = () => {
8639
8655
  c(), n.remove();
@@ -8653,7 +8669,7 @@ class si {
8653
8669
  return new Promise((s) => {
8654
8670
  var a, c;
8655
8671
  le();
8656
- const t = Dn(e, this.tokens);
8672
+ const t = Mn(e, this.tokens);
8657
8673
  de(t);
8658
8674
  const n = () => t.remove(), i = () => {
8659
8675
  n(), s();
@@ -8682,7 +8698,7 @@ class si {
8682
8698
  showTransactionProgress(e, s) {
8683
8699
  return new Promise((t) => {
8684
8700
  le();
8685
- const n = Mn(e, this.tokens);
8701
+ const n = $n(e, this.tokens);
8686
8702
  de(n);
8687
8703
  const i = () => n.remove();
8688
8704
  let o = !1;
@@ -8699,7 +8715,7 @@ class si {
8699
8715
  document.addEventListener("keydown", l);
8700
8716
  };
8701
8717
  s.then((l) => {
8702
- o || ($n(n, l, this.tokens), c());
8718
+ o || (Bn(n, l, this.tokens), c());
8703
8719
  });
8704
8720
  });
8705
8721
  }
@@ -8708,7 +8724,7 @@ class si {
8708
8724
  var c, l, u;
8709
8725
  le();
8710
8726
  let t;
8711
- e.type === "sign-message" ? t = Bn(e, this.tokens) : e.type === "sign-typed-data" ? t = Un(e, this.tokens) : e.type === "sign" ? t = Pn(e, this.tokens) : t = Cn(e, this.tokens), de(t);
8727
+ 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);
8712
8728
  const n = () => t.remove(), i = () => {
8713
8729
  n(), s(!0);
8714
8730
  }, o = () => {
@@ -8732,7 +8748,7 @@ class si {
8732
8748
  });
8733
8749
  }
8734
8750
  }
8735
- class ri {
8751
+ class ni {
8736
8752
  constructor() {
8737
8753
  this._accessToken = null, this._expiresAt = 0;
8738
8754
  }
@@ -8764,7 +8780,7 @@ class ri {
8764
8780
  return !this._accessToken || this._expiresAt <= 0 ? !0 : Date.now() >= this._expiresAt - e;
8765
8781
  }
8766
8782
  }
8767
- function ui(r, e) {
8783
+ function hi(r, e) {
8768
8784
  r.debug;
8769
8785
  const s = Ke.production, t = {
8770
8786
  ...r,
@@ -8774,22 +8790,22 @@ function ui(r, e) {
8774
8790
  }, n = {
8775
8791
  gatewayUrl: s.walletGatewayUrl,
8776
8792
  projectId: r.projectId
8777
- }, i = t.authMode !== "cookie" && Dt.isAvailable();
8793
+ }, i = t.authMode !== "cookie" && $t.isAvailable();
8778
8794
  !i && t.authMode !== "cookie" && d.warn(
8779
8795
  "[CROSSx] IndexedDB 사용 불가 — LocalStorage fallback 사용 중.",
8780
8796
  "refresh_token이 평문 저장되지 않도록 세션 영속성이 제한됩니다.",
8781
8797
  "IndexedDB를 지원하는 브라우저 사용을 권장합니다."
8782
8798
  ), t.secureStorageAvailable = i;
8783
- const o = i ? new Dt(r.projectId) : new or(), a = new _n(), c = new wn(), l = new Ie(), u = new ri(), p = new rs();
8799
+ const o = i ? new $t(r.projectId) : new ar(), a = new xn(), c = new yn(), l = new Ie(), u = new ni(), p = new is();
8784
8800
  let _;
8785
- r.useMockWallet ? (d.log("[CROSSx] Mock Wallet Provider 사용"), _ = new bn(o, p)) : (d.log("[CROSSx] Remote Wallet Provider 사용"), _ = new Ae(
8801
+ r.useMockWallet ? (d.log("[CROSSx] Mock Wallet Provider 사용"), _ = new Sn(o, p)) : (d.log("[CROSSx] Remote Wallet Provider 사용"), _ = new Ae(
8786
8802
  n,
8787
8803
  o,
8788
8804
  c,
8789
8805
  u,
8790
8806
  p
8791
8807
  ));
8792
- const f = new $e(n, c), w = new si(r.theme ?? "light", r.themeTokens), S = e != null && e.wrapConfirmation ? e.wrapConfirmation(w) : w, y = new lt(
8808
+ const f = new $e(n, c), w = new ri(r.theme ?? "light", r.themeTokens), S = e != null && e.wrapConfirmation ? e.wrapConfirmation(w) : w, y = new ut(
8793
8809
  t,
8794
8810
  n,
8795
8811
  o,
@@ -8804,9 +8820,9 @@ function ui(r, e) {
8804
8820
  );
8805
8821
  return typeof window < "u" && (window.__crossxSDK = y), y;
8806
8822
  }
8807
- function hi(r) {
8808
- const e = ni(r), s = ii(e), t = JSON.parse(s);
8809
- ai(t);
8823
+ function pi(r) {
8824
+ const e = ii(r), s = oi(e), t = JSON.parse(s);
8825
+ ci(t);
8810
8826
  const { data: n } = t;
8811
8827
  return {
8812
8828
  status: t.status,
@@ -8820,7 +8836,7 @@ function hi(r) {
8820
8836
  raw: t
8821
8837
  };
8822
8838
  }
8823
- function ni(r) {
8839
+ function ii(r) {
8824
8840
  if (r.includes("://") && r.includes("?")) {
8825
8841
  const e = new URL(r), s = e.searchParams.get("crossx_oauth_result");
8826
8842
  if (s) return s;
@@ -8830,22 +8846,22 @@ function ni(r) {
8830
8846
  }
8831
8847
  return r;
8832
8848
  }
8833
- function ii(r) {
8849
+ function oi(r) {
8834
8850
  if (r.startsWith("{"))
8835
8851
  return r;
8836
8852
  if (r.startsWith("%7B") || r.startsWith("%7b"))
8837
8853
  return decodeURIComponent(r);
8838
- const e = oi(r);
8854
+ const e = ai(r);
8839
8855
  return decodeURIComponent(e);
8840
8856
  }
8841
- function oi(r) {
8857
+ function ai(r) {
8842
8858
  if (typeof atob == "function")
8843
8859
  return atob(r);
8844
8860
  if (typeof Buffer < "u")
8845
8861
  return Buffer.from(r, "base64").toString("utf-8");
8846
8862
  throw new Error("Base64 디코딩을 지원하는 환경이 아닙니다");
8847
8863
  }
8848
- function ai(r) {
8864
+ function ci(r) {
8849
8865
  if (typeof r != "object" || r === null)
8850
8866
  throw new Error("Deeplink payload가 유효한 객체가 아닙니다");
8851
8867
  const e = r;
@@ -8863,12 +8879,12 @@ function ai(r) {
8863
8879
  }
8864
8880
  export {
8865
8881
  g as CROSSxError,
8866
- qs as CROSSxEthereumProvider,
8867
- lt as CROSSxSDK,
8868
- di as ChainId,
8882
+ Vs as CROSSxEthereumProvider,
8883
+ ut as CROSSxSDK,
8884
+ ui as ChainId,
8869
8885
  h as ErrorCode,
8870
- rs as PinMemoryStore,
8871
- ri as TokenMemoryStore,
8872
- ui as createCROSSxSDK,
8873
- hi as parseOAuthDeeplink
8886
+ is as PinMemoryStore,
8887
+ ni as TokenMemoryStore,
8888
+ hi as createCROSSxSDK,
8889
+ pi as parseOAuthDeeplink
8874
8890
  };