@nexus-cross/crossx-sdk-core 1.4.0 → 1.4.2-beta.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
  }
@@ -878,7 +894,7 @@ class Js {
878
894
  this.listeners.clear();
879
895
  }
880
896
  }
881
- const Ke = {
897
+ const Oe = {
882
898
  production: {
883
899
  oauthServiceUrl: "https://cross-wallet-oauth.crosstoken.io",
884
900
  authApiUrl: "https://cross-auth.crosstoken.io",
@@ -895,31 +911,37 @@ 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
- return e && e in Ke ? Ke[e] : null;
916
+ return e && e in Oe ? Oe[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
- return Ke.production;
926
+ try {
927
+ const r = process.env.NEXT_PUBLIC_CROSSX_ENVIRONMENT;
928
+ if (r && r in Oe)
929
+ return Oe[r];
930
+ } catch {
931
+ }
932
+ return Oe.production;
911
933
  }
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;
913
- function Le(r) {
934
+ 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;
935
+ function De(r) {
914
936
  const e = r.indexOf("@");
915
937
  if (e < 0) return "***";
916
938
  const s = r.substring(0, e), t = r.substring(e);
917
939
  return s.length <= 1 ? `${s}***${t}` : `${s[0]}***${t}`;
918
940
  }
919
- const te = class te extends Js {
941
+ const te = class te extends Zs {
920
942
  constructor(e, s, t, n, i, o, a, c, l, u, p) {
921
943
  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(
944
+ super(), this.storage = t, this.crypto = n, this.transport = i, this.oauth = o, this.walletProvider = a, this.tokenStore = c, this.initialized = !1, this._initPromise = null, this.authenticated = !1, this.userId = null, this.address = null, this.activeWalletIndex = 0, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._verifyPinMutex = null, this._themeMediaCleanup = null, this._isRecoveringSession = !1, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = s, e.logger && Tt(e.logger), this.confirmation = l, this.pinStore = p ?? new is(), this.chainRegistry = u, this.jsonRpc = new Js(u, i), this.signInUseCase = new dt(
923
945
  this.internalConfig,
924
946
  t,
925
947
  n,
@@ -927,7 +949,7 @@ const te = class te extends Js {
927
949
  i,
928
950
  a,
929
951
  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(
952
+ ), this.signOutUseCase = new Ys(this.internalConfig, t, c), this.migrateWalletUseCase = new Xs(t, a), (_ = a.setOnUnauthorized) == null || _.call(a, () => this.forceLogout()), (f = a.setTokenRefresher) == null || f.call(
931
953
  a,
932
954
  () => this.signInUseCase.refreshAccessToken()
933
955
  ), e.autoDetectTheme && this._setupAutoDetectTheme();
@@ -956,9 +978,9 @@ const te = class te extends Js {
956
978
  }
957
979
  async _doInitialize(e) {
958
980
  var s, t;
959
- d.log("[CROSSx SDK] v1.4.0 초기화 중..."), this.confirmation.setMessages(fe(this._config.locale));
981
+ d.log("[CROSSx SDK] v1.4.1 초기화 중..."), this.confirmation.setMessages(fe(this._config.locale));
960
982
  try {
961
- const n = Qs();
983
+ const n = er();
962
984
  this.internalConfig.oauthServiceUrl = n.oauthServiceUrl, this.internalConfig.authApiUrl = n.authApiUrl, this.internalConfig.walletGatewayUrl = n.walletGatewayUrl, this.adapterConfig.gatewayUrl = n.walletGatewayUrl, (t = (s = this.crypto).setJWKSEndpoint) == null || t.call(s, `${n.authApiUrl}/.well-known/jwks.json`);
963
985
  const i = await this.signInUseCase.restoreSession();
964
986
  if (i != null && i.success) {
@@ -971,7 +993,7 @@ const te = class te extends Js {
971
993
  d.log("[CROSSx] initialize: 비밀번호 입력 취소 — 지갑 미로드 상태로 계속");
972
994
  }
973
995
  }
974
- return this.initialized = !0, d.info("[CROSSx SDK] v1.4.0 초기화 완료"), this.emit("initialized", { restored: !!(i != null && i.success) }), i ?? null;
996
+ return this.initialized = !0, d.info("[CROSSx SDK] v1.4.1 초기화 완료"), this.emit("initialized", { restored: !!(i != null && i.success) }), i ?? null;
975
997
  } catch (n) {
976
998
  throw new g(h.AUTH_NOT_INITIALIZED, "SDK 초기화에 실패했습니다", n);
977
999
  }
@@ -1611,7 +1633,7 @@ const te = class te extends Js {
1611
1633
  throw new g(h.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1612
1634
  const n = await this.withResolvedGasAndFee(s, e);
1613
1635
  n.from || (n.from = (await this.resolveAddress(t == null ? void 0 : t.index)).address);
1614
- const i = Qe(e);
1636
+ const i = et(e);
1615
1637
  if (!await this.confirmation.requestConfirmation({
1616
1638
  type: "sign",
1617
1639
  chainId: e,
@@ -1669,7 +1691,7 @@ const te = class te extends Js {
1669
1691
  throw new g(h.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1670
1692
  const n = await this.withResolvedGasAndFee(s, e);
1671
1693
  n.from || (n.from = (await this.resolveAddress(t == null ? void 0 : t.index)).address);
1672
- const i = Qe(e);
1694
+ const i = et(e);
1673
1695
  if (!await this.confirmation.requestConfirmation({
1674
1696
  type: "send",
1675
1697
  chainId: e,
@@ -1736,7 +1758,7 @@ const te = class te extends Js {
1736
1758
  * @param opts.timeoutMs 최대 대기 시간 (기본 60000ms)
1737
1759
  */
1738
1760
  async waitForTxAndGetReceipt(e, s, t = {}) {
1739
- const n = t.intervalMs ?? tr, i = sr, o = t.timeoutMs ?? kt, a = Date.now() + o;
1761
+ const n = t.intervalMs ?? sr, i = rr, o = t.timeoutMs ?? Pt, a = Date.now() + o;
1740
1762
  let c = n;
1741
1763
  for (; Date.now() < a; ) {
1742
1764
  const l = await this.getTransactionReceipt(e, s);
@@ -1765,11 +1787,11 @@ const te = class te extends Js {
1765
1787
  */
1766
1788
  async sendTransactionWithWaitForReceipt(e, s, t = {}) {
1767
1789
  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 ?? "";
1790
+ const { intervalMs: n, timeoutMs: i, ...o } = t, { txHash: a } = await this.sendTransaction(e, s, o), c = n ?? ((S = this._config.receiptPolling) == null ? void 0 : S.intervalMs) ?? tr, l = i ?? ((y = this._config.receiptPolling) == null ? void 0 : y.timeoutMs) ?? Pt, u = et(e), p = s.from ?? "";
1769
1791
  let _, f;
1770
1792
  const w = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((I) => {
1771
1793
  _ = 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);
1794
+ const P = BigInt(I.gasUsed) * BigInt(I.effectiveGasPrice), H = s.value ? BigInt(s.value) : 0n, D = te.formatTxAmount(s.value, u.symbol, u.decimals), K = te.formatTxAmount("0x" + P.toString(16), u.symbol, u.decimals), G = te.formatTxAmount("0x" + (H + P).toString(16), u.symbol, u.decimals);
1773
1795
  return {
1774
1796
  chainId: e,
1775
1797
  txHash: a,
@@ -1777,7 +1799,7 @@ const te = class te extends Js {
1777
1799
  to: I.to ?? s.to,
1778
1800
  amount: D,
1779
1801
  fees: K,
1780
- total: W,
1802
+ total: G,
1781
1803
  nativeSymbol: u.symbol,
1782
1804
  status: I.status === "0x1" ? "success" : "reverted"
1783
1805
  };
@@ -1976,7 +1998,7 @@ const te = class te extends Js {
1976
1998
  try {
1977
1999
  const s = BigInt(e);
1978
2000
  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);
2001
+ const t = 10n ** BigInt(Dt), n = s / t, o = (s % t).toString().padStart(Dt, "0").replace(/0+$/, "").slice(0, Lt);
1980
2002
  return o ? `${n}.${o}` : `${n}`;
1981
2003
  } catch {
1982
2004
  return "?";
@@ -2001,7 +2023,7 @@ const te = class te extends Js {
2001
2023
  * const client = createWalletClient({ transport: custom(provider) });
2002
2024
  */
2003
2025
  getProvider(e) {
2004
- return this.ensureAuthenticated(), new qs(this, e);
2026
+ return this.ensureAuthenticated(), new Vs(this, e);
2005
2027
  }
2006
2028
  /**
2007
2029
  * 범용 JSON-RPC 요청 — 노드에 직접 연결.
@@ -2035,7 +2057,7 @@ const te = class te extends Js {
2035
2057
  try {
2036
2058
  const n = BigInt(e);
2037
2059
  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+$/, "");
2060
+ const i = 10n ** BigInt(t), o = n / i, c = (n % i).toString().padStart(t, "0").slice(0, Lt).replace(/0+$/, "");
2039
2061
  return `${c ? `${o}.${c}` : `${o}`} ${s}`;
2040
2062
  } catch {
2041
2063
  return;
@@ -2092,7 +2114,7 @@ const te = class te extends Js {
2092
2114
  if (await this.confirmation.showSessionAlert({
2093
2115
  title: f.sessionAlert_title,
2094
2116
  message: f.alert_sessionExpired,
2095
- email: this.userEmail ? Le(this.userEmail) : void 0
2117
+ email: this.userEmail ? De(this.userEmail) : void 0
2096
2118
  }) === "signin-again" && (await this.signInAgain()).success) {
2097
2119
  d.log("[CROSSx][Migration Phase 4] 재로그인 성공 — PIN 입력 루프 계속"), i--;
2098
2120
  continue;
@@ -2123,7 +2145,7 @@ const te = class te extends Js {
2123
2145
  if (await this.confirmation.showSessionAlert({
2124
2146
  title: _.sessionAlert_title,
2125
2147
  message: _.alert_sessionExpired,
2126
- email: this.userEmail ? Le(this.userEmail) : void 0
2148
+ email: this.userEmail ? De(this.userEmail) : void 0
2127
2149
  }) === "signin-again" && (await this.signInAgain()).success) {
2128
2150
  d.log("[CROSSx][Migration Phase 5] 재로그인 성공 — 마이그레이션 재시도 (검증된 PIN 유지)");
2129
2151
  try {
@@ -2163,12 +2185,12 @@ const te = class te extends Js {
2163
2185
  if (l && (c.nonce = parseInt(u ?? "0x0", 16), d.log("[CROSSx] nonce 결과:", c.nonce)), i && (c.gasLimit = p, d.log("[CROSSx] estimateGas 결과:", c.gasLimit)), o) {
2164
2186
  const f = _;
2165
2187
  if (f) {
2166
- const w = Ot;
2188
+ const w = Ct;
2167
2189
  c.maxFeePerGas = "0x" + (BigInt(f) + BigInt(w)).toString(16), c.maxPriorityFeePerGas = w, d.log("[CROSSx] Dynamic 체인 감지 — baseFee:", f, "maxFeePerGas:", c.maxFeePerGas, "maxPriorityFeePerGas: 1 Gwei");
2168
2190
  } else
2169
- c.gasPrice = rr, d.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
2191
+ c.gasPrice = nr, d.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
2170
2192
  }
2171
- return !o && a && (c.maxPriorityFeePerGas = Ot, d.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), c;
2193
+ return !o && a && (c.maxPriorityFeePerGas = Ct, d.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), c;
2172
2194
  }
2173
2195
  /**
2174
2196
  * EIP-712 signTypedData 호출 시 chainId와 typedData.domain.chainId 정합성 검증.
@@ -2215,10 +2237,10 @@ const te = class te extends Js {
2215
2237
  const s = e.startsWith("0x") ? e.slice(2) : e;
2216
2238
  if (!/^[0-9a-fA-F]+$/.test(s))
2217
2239
  throw new g(h.SIGNATURE_FAILED, "유효하지 않은 서명: 올바른 hex 문자열이 아닙니다");
2218
- if (s.length !== Pt)
2240
+ if (s.length !== Nt)
2219
2241
  throw new g(
2220
2242
  h.SIGNATURE_FAILED,
2221
- `서명 길이가 유효하지 않습니다: ${Pt} hex 문자(65 바이트) 예상, 현재 ${s.length}`
2243
+ `서명 길이가 유효하지 않습니다: ${Nt} hex 문자(65 바이트) 예상, 현재 ${s.length}`
2222
2244
  );
2223
2245
  }
2224
2246
  /** RLP-encoded signed transaction 형식 검증 */
@@ -2315,7 +2337,7 @@ const te = class te extends Js {
2315
2337
  return await this.confirmation.showSessionAlert({
2316
2338
  title: p.sessionAlert_title,
2317
2339
  message: p.alert_differentAccount,
2318
- email: this.userEmail ? Le(this.userEmail) : void 0
2340
+ email: this.userEmail ? De(this.userEmail) : void 0
2319
2341
  }) === "signin-again" ? (this._isRecoveringSession = !1, this.signInAgain()) : (this.clearAuthState(), { success: !1, error: "Different account signed in" });
2320
2342
  }
2321
2343
  this.applyAuthResult(a);
@@ -2339,7 +2361,7 @@ const te = class te extends Js {
2339
2361
  try {
2340
2362
  return await e();
2341
2363
  } catch (s) {
2342
- const t = fe(this._config.locale ?? "en"), n = this.userEmail ? Le(this.userEmail) : void 0;
2364
+ const t = fe(this._config.locale ?? "en"), n = this.userEmail ? De(this.userEmail) : void 0;
2343
2365
  if (s instanceof g && s.code === h.WITHDRAW_FAILED) {
2344
2366
  if (d.warn("[CROSSx] WITHDRAW_FAILED — 로컬 인증 초기화"), await this.confirmation.showSessionAlert({
2345
2367
  title: t.sessionAlert_title,
@@ -2485,7 +2507,7 @@ const te = class te extends Js {
2485
2507
  if (await this.confirmation.showSessionAlert({
2486
2508
  title: l.sessionAlert_title,
2487
2509
  message: l.alert_sessionExpired,
2488
- email: this.userEmail ? Le(this.userEmail) : void 0
2510
+ email: this.userEmail ? De(this.userEmail) : void 0
2489
2511
  }) === "signin-again" && (await this.signInAgain()).success)
2490
2512
  throw o(c), c;
2491
2513
  }
@@ -2620,7 +2642,7 @@ const te = class te extends Js {
2620
2642
  */
2621
2643
  dispose() {
2622
2644
  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);
2645
+ (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
2646
  }
2625
2647
  /**
2626
2648
  * @internal internal 패키지 전용 — 공개 문서에 기재하지 않음
@@ -2641,8 +2663,8 @@ const te = class te extends Js {
2641
2663
  }
2642
2664
  };
2643
2665
  te.OFFCHAIN_CHAIN_ID = "0";
2644
- let lt = te;
2645
- class or {
2666
+ let ut = te;
2667
+ class ar {
2646
2668
  constructor() {
2647
2669
  this.prefix = "crossx_";
2648
2670
  }
@@ -2679,8 +2701,8 @@ class or {
2679
2701
  }
2680
2702
  }
2681
2703
  }
2682
- const et = "crossx-sdk", ar = 1, he = "data", Ee = "keys", Ue = "aes-primary", cr = 12;
2683
- class Dt {
2704
+ const tt = "crossx-sdk", cr = 1, he = "data", Ee = "keys", He = "aes-primary", lr = 12;
2705
+ class $t {
2684
2706
  constructor(e) {
2685
2707
  this.db = null, this.cryptoKey = null, this.initPromise = null, this.dbName = `crossx-sdk-${e}`;
2686
2708
  }
@@ -2689,7 +2711,7 @@ class Dt {
2689
2711
  }
2690
2712
  openDB(e = this.dbName) {
2691
2713
  return new Promise((s, t) => {
2692
- const n = indexedDB.open(e, ar);
2714
+ const n = indexedDB.open(e, cr);
2693
2715
  n.onupgradeneeded = () => {
2694
2716
  const i = n.result;
2695
2717
  i.objectStoreNames.contains(he) || i.createObjectStore(he), i.objectStoreNames.contains(Ee) || i.createObjectStore(Ee);
@@ -2722,7 +2744,7 @@ class Dt {
2722
2744
  }
2723
2745
  async init() {
2724
2746
  this.db = await this.openDB();
2725
- const e = await this.idbGet(Ee, Ue);
2747
+ const e = await this.idbGet(Ee, He);
2726
2748
  if (e) {
2727
2749
  this.cryptoKey = e;
2728
2750
  return;
@@ -2736,16 +2758,16 @@ class Dt {
2736
2758
  { name: "AES-GCM", length: 256 },
2737
2759
  !1,
2738
2760
  ["encrypt", "decrypt"]
2739
- ), await this.idbPut(Ee, Ue, this.cryptoKey);
2761
+ ), await this.idbPut(Ee, He, this.cryptoKey);
2740
2762
  }
2741
2763
  /**
2742
2764
  * 레거시 DB('crossx-sdk')에서 projectId 스코프 DB로 암호키·데이터 마이그레이션.
2743
2765
  * 마이그레이션 성공 시 레거시 DB 삭제.
2744
2766
  */
2745
2767
  async migrateFromLegacyDB() {
2746
- if (this.dbName === et) return null;
2768
+ if (this.dbName === tt) return null;
2747
2769
  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) => {
2770
+ const e = await this.openDB(tt), s = e.transaction([Ee, he], "readonly"), t = s.objectStore(Ee).get(He), n = await new Promise((l, u) => {
2749
2771
  t.onsuccess = () => l(t.result), t.onerror = () => u(t.error);
2750
2772
  });
2751
2773
  if (!n)
@@ -2758,16 +2780,16 @@ class Dt {
2758
2780
  o.onsuccess = () => l(o.result), o.onerror = () => u(o.error);
2759
2781
  })
2760
2782
  ]);
2761
- e.close(), await this.idbPut(Ee, Ue, n);
2783
+ e.close(), await this.idbPut(Ee, He, n);
2762
2784
  for (let l = 0; l < c.length; l++)
2763
2785
  await this.idbPut(he, String(c[l]), a[l]);
2764
- return indexedDB.deleteDatabase(et), d.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), n;
2786
+ return indexedDB.deleteDatabase(tt), d.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), n;
2765
2787
  } catch (e) {
2766
2788
  return d.warn("[CROSSx] IndexedDB 레거시 DB 마이그레이션 실패:", e), null;
2767
2789
  }
2768
2790
  }
2769
2791
  async encrypt(e) {
2770
- const s = new Uint8Array(cr);
2792
+ const s = new Uint8Array(lr);
2771
2793
  crypto.getRandomValues(s);
2772
2794
  const t = new TextEncoder().encode(e), n = await crypto.subtle.encrypt(
2773
2795
  { name: "AES-GCM", iv: s },
@@ -2826,7 +2848,7 @@ class Dt {
2826
2848
  }
2827
2849
  }
2828
2850
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2829
- function ft(r) {
2851
+ function xt(r) {
2830
2852
  return r instanceof Uint8Array || ArrayBuffer.isView(r) && r.constructor.name === "Uint8Array";
2831
2853
  }
2832
2854
  function we(r, e = "") {
@@ -2836,63 +2858,63 @@ function we(r, e = "") {
2836
2858
  }
2837
2859
  }
2838
2860
  function q(r, e, s = "") {
2839
- const t = ft(r), n = r == null ? void 0 : r.length, i = e !== void 0;
2861
+ const t = xt(r), n = r == null ? void 0 : r.length, i = e !== void 0;
2840
2862
  if (!t || i && n !== e) {
2841
2863
  const o = s && `"${s}" `, a = i ? ` of length ${e}` : "", c = t ? `length=${n}` : `type=${typeof r}`;
2842
2864
  throw new Error(o + "expected Uint8Array" + a + ", got " + c);
2843
2865
  }
2844
2866
  return r;
2845
2867
  }
2846
- function ns(r) {
2868
+ function os(r) {
2847
2869
  if (typeof r != "function" || typeof r.create != "function")
2848
2870
  throw new Error("Hash must wrapped by utils.createHasher");
2849
2871
  we(r.outputLen), we(r.blockLen);
2850
2872
  }
2851
- function Pe(r, e = !0) {
2873
+ function Ce(r, e = !0) {
2852
2874
  if (r.destroyed)
2853
2875
  throw new Error("Hash instance has been destroyed");
2854
2876
  if (e && r.finished)
2855
2877
  throw new Error("Hash#digest() has already been called");
2856
2878
  }
2857
- function is(r, e) {
2879
+ function as(r, e) {
2858
2880
  q(r, void 0, "digestInto() output");
2859
2881
  const s = e.outputLen;
2860
2882
  if (r.length < s)
2861
2883
  throw new Error('"digestInto() output" expected to be of length >=' + s);
2862
2884
  }
2863
- function lr(r) {
2885
+ function dr(r) {
2864
2886
  return new Uint32Array(r.buffer, r.byteOffset, Math.floor(r.byteLength / 4));
2865
2887
  }
2866
- function Ce(...r) {
2888
+ function Ne(...r) {
2867
2889
  for (let e = 0; e < r.length; e++)
2868
2890
  r[e].fill(0);
2869
2891
  }
2870
- function tt(r) {
2892
+ function st(r) {
2871
2893
  return new DataView(r.buffer, r.byteOffset, r.byteLength);
2872
2894
  }
2873
2895
  function pe(r, e) {
2874
2896
  return r << 32 - e | r >>> e;
2875
2897
  }
2876
- const dr = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
2877
- function ur(r) {
2898
+ const ur = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
2899
+ function hr(r) {
2878
2900
  return r << 24 & 4278190080 | r << 8 & 16711680 | r >>> 8 & 65280 | r >>> 24 & 255;
2879
2901
  }
2880
- function hr(r) {
2902
+ function pr(r) {
2881
2903
  for (let e = 0; e < r.length; e++)
2882
- r[e] = ur(r[e]);
2904
+ r[e] = hr(r[e]);
2883
2905
  return r;
2884
2906
  }
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"));
2886
- function Be(r) {
2887
- if (q(r), os)
2907
+ const Bt = ur ? (r) => r : pr, cs = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", fr = /* @__PURE__ */ Array.from({ length: 256 }, (r, e) => e.toString(16).padStart(2, "0"));
2908
+ function Ue(r) {
2909
+ if (q(r), cs)
2888
2910
  return r.toHex();
2889
2911
  let e = "";
2890
2912
  for (let s = 0; s < r.length; s++)
2891
- e += pr[r[s]];
2913
+ e += fr[r[s]];
2892
2914
  return e;
2893
2915
  }
2894
2916
  const _e = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
2895
- function $t(r) {
2917
+ function Ut(r) {
2896
2918
  if (r >= _e._0 && r <= _e._9)
2897
2919
  return r - _e._0;
2898
2920
  if (r >= _e.A && r <= _e.F)
@@ -2903,14 +2925,14 @@ function $t(r) {
2903
2925
  function Ve(r) {
2904
2926
  if (typeof r != "string")
2905
2927
  throw new Error("hex string expected, got " + typeof r);
2906
- if (os)
2928
+ if (cs)
2907
2929
  return Uint8Array.fromHex(r);
2908
2930
  const e = r.length, s = e / 2;
2909
2931
  if (e % 2)
2910
2932
  throw new Error("hex string expected, got unpadded hex of length " + e);
2911
2933
  const t = new Uint8Array(s);
2912
2934
  for (let n = 0, i = 0; n < s; n++, i += 2) {
2913
- const o = $t(r.charCodeAt(i)), a = $t(r.charCodeAt(i + 1));
2935
+ const o = Ut(r.charCodeAt(i)), a = Ut(r.charCodeAt(i + 1));
2914
2936
  if (o === void 0 || a === void 0) {
2915
2937
  const c = r[i] + r[i + 1];
2916
2938
  throw new Error('hex string expected, got non-hex character "' + c + '" at index ' + i);
@@ -2932,26 +2954,26 @@ function ve(...r) {
2932
2954
  }
2933
2955
  return s;
2934
2956
  }
2935
- function as(r, e = {}) {
2957
+ function ls(r, e = {}) {
2936
2958
  const s = (n, i) => r(i).update(n).digest(), t = r(void 0);
2937
2959
  return s.outputLen = t.outputLen, s.blockLen = t.blockLen, s.create = (n) => r(n), Object.assign(s, e), Object.freeze(s);
2938
2960
  }
2939
- function cs(r = 32) {
2961
+ function ds(r = 32) {
2940
2962
  const e = typeof globalThis == "object" ? globalThis.crypto : null;
2941
2963
  if (typeof (e == null ? void 0 : e.getRandomValues) != "function")
2942
2964
  throw new Error("crypto.getRandomValues must be defined");
2943
2965
  return e.getRandomValues(new Uint8Array(r));
2944
2966
  }
2945
- const fr = (r) => ({
2967
+ const _r = (r) => ({
2946
2968
  oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, r])
2947
2969
  });
2948
- function _r(r, e, s) {
2970
+ function xr(r, e, s) {
2949
2971
  return r & e ^ ~r & s;
2950
2972
  }
2951
- function xr(r, e, s) {
2973
+ function gr(r, e, s) {
2952
2974
  return r & e ^ r & s ^ e & s;
2953
2975
  }
2954
- class gr {
2976
+ class mr {
2955
2977
  constructor(e, s, t, n) {
2956
2978
  R(this, "blockLen");
2957
2979
  R(this, "outputLen");
@@ -2964,15 +2986,15 @@ class gr {
2964
2986
  R(this, "length", 0);
2965
2987
  R(this, "pos", 0);
2966
2988
  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);
2989
+ this.blockLen = e, this.outputLen = s, this.padOffset = t, this.isLE = n, this.buffer = new Uint8Array(e), this.view = st(this.buffer);
2968
2990
  }
2969
2991
  update(e) {
2970
- Pe(this), q(e);
2992
+ Ce(this), q(e);
2971
2993
  const { view: s, buffer: t, blockLen: n } = this, i = e.length;
2972
2994
  for (let o = 0; o < i; ) {
2973
2995
  const a = Math.min(n - this.pos, i - o);
2974
2996
  if (a === n) {
2975
- const c = tt(e);
2997
+ const c = st(e);
2976
2998
  for (; n <= i - o; o += n)
2977
2999
  this.process(c, o);
2978
3000
  continue;
@@ -2982,14 +3004,14 @@ class gr {
2982
3004
  return this.length += e.length, this.roundClean(), this;
2983
3005
  }
2984
3006
  digestInto(e) {
2985
- Pe(this), is(e, this), this.finished = !0;
3007
+ Ce(this), as(e, this), this.finished = !0;
2986
3008
  const { buffer: s, view: t, blockLen: n, isLE: i } = this;
2987
3009
  let { pos: o } = this;
2988
- s[o++] = 128, Ce(this.buffer.subarray(o)), this.padOffset > n - o && (this.process(t, 0), o = 0);
3010
+ s[o++] = 128, Ne(this.buffer.subarray(o)), this.padOffset > n - o && (this.process(t, 0), o = 0);
2989
3011
  for (let p = o; p < n; p++)
2990
3012
  s[p] = 0;
2991
3013
  t.setBigUint64(n - 8, BigInt(this.length * 8), i), this.process(t, 0);
2992
- const a = tt(e), c = this.outputLen;
3014
+ const a = st(e), c = this.outputLen;
2993
3015
  if (c % 4)
2994
3016
  throw new Error("_sha2: outputLen must be aligned to 32bit");
2995
3017
  const l = c / 4, u = this.get();
@@ -3022,20 +3044,20 @@ const ye = /* @__PURE__ */ Uint32Array.from([
3022
3044
  2600822924,
3023
3045
  528734635,
3024
3046
  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
- }
3047
+ ]), Fe = /* @__PURE__ */ BigInt(2 ** 32 - 1), Ht = /* @__PURE__ */ BigInt(32);
3029
3048
  function wr(r, e = !1) {
3049
+ return e ? { h: Number(r & Fe), l: Number(r >> Ht & Fe) } : { h: Number(r >> Ht & Fe) | 0, l: Number(r & Fe) | 0 };
3050
+ }
3051
+ function yr(r, e = !1) {
3030
3052
  const s = r.length;
3031
3053
  let t = new Uint32Array(s), n = new Uint32Array(s);
3032
3054
  for (let i = 0; i < s; i++) {
3033
- const { h: o, l: a } = mr(r[i], e);
3055
+ const { h: o, l: a } = wr(r[i], e);
3034
3056
  [t[i], n[i]] = [o, a];
3035
3057
  }
3036
3058
  return [t, n];
3037
3059
  }
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([
3060
+ 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
3061
  1116352408,
3040
3062
  1899447441,
3041
3063
  3049323471,
@@ -3101,7 +3123,7 @@ const yr = (r, e, s) => r << s | e >>> 32 - s, br = (r, e, s) => e << s | r >>>
3101
3123
  3204031479,
3102
3124
  3329325298
3103
3125
  ]), be = /* @__PURE__ */ new Uint32Array(64);
3104
- class Ir extends gr {
3126
+ class Ar extends mr {
3105
3127
  constructor(e) {
3106
3128
  super(64, e, 8, !1);
3107
3129
  }
@@ -3122,19 +3144,19 @@ class Ir extends gr {
3122
3144
  }
3123
3145
  let { A: t, B: n, C: i, D: o, E: a, F: c, G: l, H: u } = this;
3124
3146
  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;
3147
+ const _ = pe(a, 6) ^ pe(a, 11) ^ pe(a, 25), f = u + _ + xr(a, c, l) + Ir[p] + be[p] | 0, S = (pe(t, 2) ^ pe(t, 13) ^ pe(t, 22)) + gr(t, n, i) | 0;
3126
3148
  u = l, l = c, c = a, a = o + f | 0, o = i, i = n, n = t, t = f + S | 0;
3127
3149
  }
3128
3150
  t = t + this.A | 0, n = n + this.B | 0, i = i + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, u = u + this.H | 0, this.set(t, n, i, o, a, c, l, u);
3129
3151
  }
3130
3152
  roundClean() {
3131
- Ce(be);
3153
+ Ne(be);
3132
3154
  }
3133
3155
  destroy() {
3134
- this.set(0, 0, 0, 0, 0, 0, 0, 0), Ce(this.buffer);
3156
+ this.set(0, 0, 0, 0, 0, 0, 0, 0), Ne(this.buffer);
3135
3157
  }
3136
3158
  }
3137
- class Ar extends Ir {
3159
+ class Tr extends Ar {
3138
3160
  constructor() {
3139
3161
  super(32);
3140
3162
  // We cannot use array here since array allows indexing by variable
@@ -3149,12 +3171,12 @@ class Ar extends Ir {
3149
3171
  R(this, "H", ye[7] | 0);
3150
3172
  }
3151
3173
  }
3152
- const Tr = /* @__PURE__ */ as(
3153
- () => new Ar(),
3154
- /* @__PURE__ */ fr(1)
3174
+ const Rr = /* @__PURE__ */ ls(
3175
+ () => new Tr(),
3176
+ /* @__PURE__ */ _r(1)
3155
3177
  );
3156
3178
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3157
- const _t = /* @__PURE__ */ BigInt(0), dt = /* @__PURE__ */ BigInt(1);
3179
+ const gt = /* @__PURE__ */ BigInt(0), ht = /* @__PURE__ */ BigInt(1);
3158
3180
  function ze(r, e = "") {
3159
3181
  if (typeof r != "boolean") {
3160
3182
  const s = e && `"${e}" `;
@@ -3162,58 +3184,58 @@ function ze(r, e = "") {
3162
3184
  }
3163
3185
  return r;
3164
3186
  }
3165
- function ls(r) {
3187
+ function us(r) {
3166
3188
  if (typeof r == "bigint") {
3167
- if (!qe(r))
3189
+ if (!Ke(r))
3168
3190
  throw new Error("positive bigint expected, got " + r);
3169
3191
  } else
3170
3192
  we(r);
3171
3193
  return r;
3172
3194
  }
3173
- function Fe(r) {
3174
- const e = ls(r).toString(16);
3195
+ function Ge(r) {
3196
+ const e = us(r).toString(16);
3175
3197
  return e.length & 1 ? "0" + e : e;
3176
3198
  }
3177
- function ds(r) {
3199
+ function hs(r) {
3178
3200
  if (typeof r != "string")
3179
3201
  throw new Error("hex string expected, got " + typeof r);
3180
- return r === "" ? _t : BigInt("0x" + r);
3202
+ return r === "" ? gt : BigInt("0x" + r);
3181
3203
  }
3182
- function Xe(r) {
3183
- return ds(Be(r));
3204
+ function Je(r) {
3205
+ return hs(Ue(r));
3184
3206
  }
3185
- function us(r) {
3186
- return ds(Be(Rr(q(r)).reverse()));
3207
+ function ps(r) {
3208
+ return hs(Ue(kr(q(r)).reverse()));
3187
3209
  }
3188
- function xt(r, e) {
3189
- we(e), r = ls(r);
3210
+ function mt(r, e) {
3211
+ we(e), r = us(r);
3190
3212
  const s = Ve(r.toString(16).padStart(e * 2, "0"));
3191
3213
  if (s.length !== e)
3192
3214
  throw new Error("number too large");
3193
3215
  return s;
3194
3216
  }
3195
- function hs(r, e) {
3196
- return xt(r, e).reverse();
3217
+ function fs(r, e) {
3218
+ return mt(r, e).reverse();
3197
3219
  }
3198
- function Rr(r) {
3220
+ function kr(r) {
3199
3221
  return Uint8Array.from(r);
3200
3222
  }
3201
- const qe = (r) => typeof r == "bigint" && _t <= r;
3202
- function kr(r, e, s) {
3203
- return qe(r) && qe(e) && qe(s) && e <= r && r < s;
3223
+ const Ke = (r) => typeof r == "bigint" && gt <= r;
3224
+ function Or(r, e, s) {
3225
+ return Ke(r) && Ke(e) && Ke(s) && e <= r && r < s;
3204
3226
  }
3205
- function Or(r, e, s, t) {
3206
- if (!kr(e, s, t))
3227
+ function Pr(r, e, s, t) {
3228
+ if (!Or(e, s, t))
3207
3229
  throw new Error("expected valid " + r + ": " + s + " <= n < " + t + ", got " + e);
3208
3230
  }
3209
- function Pr(r) {
3231
+ function Cr(r) {
3210
3232
  let e;
3211
- for (e = 0; r > _t; r >>= dt, e += 1)
3233
+ for (e = 0; r > gt; r >>= ht, e += 1)
3212
3234
  ;
3213
3235
  return e;
3214
3236
  }
3215
- const gt = (r) => (dt << BigInt(r)) - dt;
3216
- function Cr(r, e, s) {
3237
+ const wt = (r) => (ht << BigInt(r)) - ht;
3238
+ function Nr(r, e, s) {
3217
3239
  if (we(r, "hashLen"), we(e, "qByteLen"), typeof s != "function")
3218
3240
  throw new Error("hmacFn must be a function");
3219
3241
  const t = (y) => new Uint8Array(y), n = Uint8Array.of(), i = Uint8Array.of(0), o = Uint8Array.of(1), a = 1e3;
@@ -3242,7 +3264,7 @@ function Cr(r, e, s) {
3242
3264
  return p(), P;
3243
3265
  };
3244
3266
  }
3245
- function mt(r, e = {}, s = {}) {
3267
+ function yt(r, e = {}, s = {}) {
3246
3268
  if (!r || typeof r != "object")
3247
3269
  throw new Error("expected valid options object");
3248
3270
  function t(i, o, a) {
@@ -3256,7 +3278,7 @@ function mt(r, e = {}, s = {}) {
3256
3278
  const n = (i, o) => Object.entries(i).forEach(([a, c]) => t(a, c, o));
3257
3279
  n(e, !1), n(s, !0);
3258
3280
  }
3259
- function Ut(r) {
3281
+ function Ft(r) {
3260
3282
  const e = /* @__PURE__ */ new WeakMap();
3261
3283
  return (s, ...t) => {
3262
3284
  const n = e.get(s);
@@ -3267,7 +3289,7 @@ function Ut(r) {
3267
3289
  };
3268
3290
  }
3269
3291
  /*! 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);
3292
+ const ne = /* @__PURE__ */ BigInt(0), se = /* @__PURE__ */ BigInt(1), Te = /* @__PURE__ */ BigInt(2), _s = /* @__PURE__ */ BigInt(3), xs = /* @__PURE__ */ BigInt(4), gs = /* @__PURE__ */ BigInt(5), Lr = /* @__PURE__ */ BigInt(7), ms = /* @__PURE__ */ BigInt(8), Dr = /* @__PURE__ */ BigInt(9), ws = /* @__PURE__ */ BigInt(16);
3271
3293
  function ue(r, e) {
3272
3294
  const s = r % e;
3273
3295
  return s >= ne ? s : e + s;
@@ -3278,7 +3300,7 @@ function ce(r, e, s) {
3278
3300
  t *= t, t %= s;
3279
3301
  return t;
3280
3302
  }
3281
- function Ht(r, e) {
3303
+ function Gt(r, e) {
3282
3304
  if (r === ne)
3283
3305
  throw new Error("invert: expected non-zero number");
3284
3306
  if (e <= ne)
@@ -3292,47 +3314,47 @@ function Ht(r, e) {
3292
3314
  throw new Error("invert: does not exist");
3293
3315
  return ue(n, e);
3294
3316
  }
3295
- function wt(r, e, s) {
3317
+ function bt(r, e, s) {
3296
3318
  if (!r.eql(r.sqr(e), s))
3297
3319
  throw new Error("Cannot find square root");
3298
3320
  }
3299
- function ms(r, e) {
3300
- const s = (r.ORDER + se) / fs, t = r.pow(e, s);
3301
- return wt(r, t, e), t;
3321
+ function ys(r, e) {
3322
+ const s = (r.ORDER + se) / xs, t = r.pow(e, s);
3323
+ return bt(r, t, e), t;
3302
3324
  }
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;
3325
+ function Mr(r, e) {
3326
+ 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));
3327
+ return bt(r, a, e), a;
3306
3328
  }
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;
3329
+ function $r(r) {
3330
+ const e = Ze(r), s = bs(r), t = s(e, e.neg(e.ONE)), n = s(e, t), i = s(e, e.neg(t)), o = (r + Lr) / ws;
3309
3331
  return (a, c) => {
3310
3332
  let l = a.pow(c, o), u = a.mul(l, t);
3311
3333
  const p = a.mul(l, n), _ = a.mul(l, i), f = a.eql(a.sqr(u), c), w = a.eql(a.sqr(p), c);
3312
3334
  l = a.cmov(l, u, f), u = a.cmov(_, p, w);
3313
3335
  const S = a.eql(a.sqr(u), c), y = a.cmov(l, u, S);
3314
- return wt(a, y, c), y;
3336
+ return bt(a, y, c), y;
3315
3337
  };
3316
3338
  }
3317
- function ws(r) {
3318
- if (r < ps)
3339
+ function bs(r) {
3340
+ if (r < _s)
3319
3341
  throw new Error("sqrt is not defined for small field");
3320
3342
  let e = r - se, s = 0;
3321
3343
  for (; e % Te === ne; )
3322
3344
  e /= Te, s++;
3323
3345
  let t = Te;
3324
- const n = Je(r);
3325
- for (; Ft(n, t) === 1; )
3346
+ const n = Ze(r);
3347
+ for (; Wt(n, t) === 1; )
3326
3348
  if (t++ > 1e3)
3327
3349
  throw new Error("Cannot find square root: probably non-prime P");
3328
3350
  if (s === 1)
3329
- return ms;
3351
+ return ys;
3330
3352
  let i = n.pow(t, e);
3331
3353
  const o = (e + se) / Te;
3332
3354
  return function(c, l) {
3333
3355
  if (c.is0(l))
3334
3356
  return l;
3335
- if (Ft(c, l) !== 1)
3357
+ if (Wt(c, l) !== 1)
3336
3358
  throw new Error("Cannot find square root");
3337
3359
  let u = s, p = c.mul(c.ONE, i), _ = c.pow(l, e), f = c.pow(l, o);
3338
3360
  for (; !c.eql(_, c.ONE); ) {
@@ -3348,10 +3370,10 @@ function ws(r) {
3348
3370
  return f;
3349
3371
  };
3350
3372
  }
3351
- function $r(r) {
3352
- return r % fs === ps ? ms : r % xs === _s ? Dr : r % gs === Lr ? Mr(r) : ws(r);
3373
+ function Br(r) {
3374
+ return r % xs === _s ? ys : r % ms === gs ? Mr : r % ws === Dr ? $r(r) : bs(r);
3353
3375
  }
3354
- const Br = [
3376
+ const Ur = [
3355
3377
  "create",
3356
3378
  "isValid",
3357
3379
  "is0",
@@ -3370,15 +3392,15 @@ const Br = [
3370
3392
  "mulN",
3371
3393
  "sqrN"
3372
3394
  ];
3373
- function Ur(r) {
3395
+ function Hr(r) {
3374
3396
  const e = {
3375
3397
  ORDER: "bigint",
3376
3398
  BYTES: "number",
3377
3399
  BITS: "number"
3378
- }, s = Br.reduce((t, n) => (t[n] = "function", t), e);
3379
- return mt(r, s), r;
3400
+ }, s = Ur.reduce((t, n) => (t[n] = "function", t), e);
3401
+ return yt(r, s), r;
3380
3402
  }
3381
- function Hr(r, e, s) {
3403
+ function Fr(r, e, s) {
3382
3404
  if (s < ne)
3383
3405
  throw new Error("invalid exponent, negatives unsupported");
3384
3406
  if (s === ne)
@@ -3390,17 +3412,17 @@ function Hr(r, e, s) {
3390
3412
  s & se && (t = r.mul(t, n)), n = r.sqr(n), s >>= se;
3391
3413
  return t;
3392
3414
  }
3393
- function ys(r, e, s = !1) {
3415
+ function Ss(r, e, s = !1) {
3394
3416
  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
3417
  return e.reduceRight((o, a, c) => r.is0(a) ? o : (t[c] = r.mul(o, t[c]), r.mul(o, a)), i), t;
3396
3418
  }
3397
- function Ft(r, e) {
3419
+ function Wt(r, e) {
3398
3420
  const s = (r.ORDER - se) / Te, t = r.pow(e, s), n = r.eql(t, r.ONE), i = r.eql(t, r.ZERO), o = r.eql(t, r.neg(r.ONE));
3399
3421
  if (!n && !i && !o)
3400
3422
  throw new Error("invalid Legendre symbol result");
3401
3423
  return n ? 1 : i ? 0 : -1;
3402
3424
  }
3403
- function Fr(r, e) {
3425
+ function Gr(r, e) {
3404
3426
  e !== void 0 && we(e);
3405
3427
  const s = e !== void 0 ? e : r.toString(2).length, t = Math.ceil(s / 8);
3406
3428
  return { nBitLength: s, nByteLength: t };
@@ -3422,7 +3444,7 @@ class Wr {
3422
3444
  throw new Error("invalid field: expected ORDER > 0, got " + e);
3423
3445
  let t;
3424
3446
  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);
3447
+ const { nBitLength: n, nByteLength: i } = Gr(e, t);
3426
3448
  if (i > 2048)
3427
3449
  throw new Error("invalid field: expected ORDER of <= 2048 bytes");
3428
3450
  this.ORDER = e, this.BITS = n, this.BYTES = i, this._sqrt = void 0, Object.preventExtensions(this);
@@ -3464,10 +3486,10 @@ class Wr {
3464
3486
  return ue(e * s, this.ORDER);
3465
3487
  }
3466
3488
  pow(e, s) {
3467
- return Hr(this, e, s);
3489
+ return Fr(this, e, s);
3468
3490
  }
3469
3491
  div(e, s) {
3470
- return ue(e * Ht(s, this.ORDER), this.ORDER);
3492
+ return ue(e * Gt(s, this.ORDER), this.ORDER);
3471
3493
  }
3472
3494
  // Same as above, but doesn't normalize
3473
3495
  sqrN(e) {
@@ -3483,13 +3505,13 @@ class Wr {
3483
3505
  return e * s;
3484
3506
  }
3485
3507
  inv(e) {
3486
- return Ht(e, this.ORDER);
3508
+ return Gt(e, this.ORDER);
3487
3509
  }
3488
3510
  sqrt(e) {
3489
- return this._sqrt || (this._sqrt = $r(this.ORDER)), this._sqrt(this, e);
3511
+ return this._sqrt || (this._sqrt = Br(this.ORDER)), this._sqrt(this, e);
3490
3512
  }
3491
3513
  toBytes(e) {
3492
- return this.isLE ? hs(e, this.BYTES) : xt(e, this.BYTES);
3514
+ return this.isLE ? fs(e, this.BYTES) : mt(e, this.BYTES);
3493
3515
  }
3494
3516
  fromBytes(e, s = !1) {
3495
3517
  q(e);
@@ -3502,14 +3524,14 @@ class Wr {
3502
3524
  }
3503
3525
  if (e.length !== n)
3504
3526
  throw new Error("Field.fromBytes: expected " + n + " bytes, got " + e.length);
3505
- let c = i ? us(e) : Xe(e);
3527
+ let c = i ? ps(e) : Je(e);
3506
3528
  if (a && (c = ue(c, o)), !s && !this.isValid(c))
3507
3529
  throw new Error("invalid field element: outside of range 0..ORDER");
3508
3530
  return c;
3509
3531
  }
3510
3532
  // TODO: we don't need it here, move out to separate fn
3511
3533
  invertBatch(e) {
3512
- return ys(this, e);
3534
+ return Ss(this, e);
3513
3535
  }
3514
3536
  // We can't move this out because Fp6, Fp12 implement it
3515
3537
  // and it's unclear what to return in there.
@@ -3517,62 +3539,62 @@ class Wr {
3517
3539
  return t ? s : e;
3518
3540
  }
3519
3541
  }
3520
- function Je(r, e = {}) {
3542
+ function Ze(r, e = {}) {
3521
3543
  return new Wr(r, e);
3522
3544
  }
3523
- function bs(r) {
3545
+ function vs(r) {
3524
3546
  if (typeof r != "bigint")
3525
3547
  throw new Error("field order must be bigint");
3526
3548
  const e = r.toString(2).length;
3527
3549
  return Math.ceil(e / 8);
3528
3550
  }
3529
- function Ss(r) {
3530
- const e = bs(r);
3551
+ function Es(r) {
3552
+ const e = vs(r);
3531
3553
  return e + Math.ceil(e / 2);
3532
3554
  }
3533
- function Gr(r, e, s = !1) {
3555
+ function qr(r, e, s = !1) {
3534
3556
  q(r);
3535
- const t = r.length, n = bs(e), i = Ss(e);
3557
+ const t = r.length, n = vs(e), i = Es(e);
3536
3558
  if (t < 16 || t < i || t > 1024)
3537
3559
  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);
3560
+ const o = s ? ps(r) : Je(r), a = ue(o, e - se) + se;
3561
+ return s ? fs(a, n) : mt(a, n);
3540
3562
  }
3541
3563
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3542
- const Ne = /* @__PURE__ */ BigInt(0), Re = /* @__PURE__ */ BigInt(1);
3564
+ const Le = /* @__PURE__ */ BigInt(0), Re = /* @__PURE__ */ BigInt(1);
3543
3565
  function je(r, e) {
3544
3566
  const s = e.negate();
3545
3567
  return r ? s : e;
3546
3568
  }
3547
- function Wt(r, e) {
3548
- const s = ys(r.Fp, e.map((t) => t.Z));
3569
+ function qt(r, e) {
3570
+ const s = Ss(r.Fp, e.map((t) => t.Z));
3549
3571
  return e.map((t, n) => r.fromAffine(t.toAffine(s[n])));
3550
3572
  }
3551
- function vs(r, e) {
3573
+ function Is(r, e) {
3552
3574
  if (!Number.isSafeInteger(r) || r <= 0 || r > e)
3553
3575
  throw new Error("invalid window size, expected [1.." + e + "], got W=" + r);
3554
3576
  }
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);
3577
+ function rt(r, e) {
3578
+ Is(r, e);
3579
+ const s = Math.ceil(e / r) + 1, t = 2 ** (r - 1), n = 2 ** r, i = wt(r), o = BigInt(r);
3558
3580
  return { windows: s, windowSize: t, mask: i, maxNumber: n, shiftBy: o };
3559
3581
  }
3560
- function Gt(r, e, s) {
3582
+ function Kt(r, e, s) {
3561
3583
  const { windowSize: t, mask: n, maxNumber: i, shiftBy: o } = s;
3562
3584
  let a = Number(r & n), c = r >> o;
3563
3585
  a > t && (a -= i, c += Re);
3564
3586
  const l = e * t, u = l + Math.abs(a) - 1, p = a === 0, _ = a < 0, f = e % 2 !== 0;
3565
3587
  return { nextN: c, offset: u, isZero: p, isNeg: _, isNegF: f, offsetF: l };
3566
3588
  }
3567
- const rt = /* @__PURE__ */ new WeakMap(), Es = /* @__PURE__ */ new WeakMap();
3568
- function nt(r) {
3569
- return Es.get(r) || 1;
3589
+ const nt = /* @__PURE__ */ new WeakMap(), As = /* @__PURE__ */ new WeakMap();
3590
+ function it(r) {
3591
+ return As.get(r) || 1;
3570
3592
  }
3571
- function qt(r) {
3572
- if (r !== Ne)
3593
+ function Vt(r) {
3594
+ if (r !== Le)
3573
3595
  throw new Error("invalid wNAF");
3574
3596
  }
3575
- class qr {
3597
+ class Kr {
3576
3598
  // Parametrized with a given Point class (not individual point)
3577
3599
  constructor(e, s) {
3578
3600
  R(this, "BASE");
@@ -3584,7 +3606,7 @@ class qr {
3584
3606
  // non-const time multiplication ladder
3585
3607
  _unsafeLadder(e, s, t = this.ZERO) {
3586
3608
  let n = e;
3587
- for (; s > Ne; )
3609
+ for (; s > Le; )
3588
3610
  s & Re && (t = t.add(n)), n = n.double(), s >>= Re;
3589
3611
  return t;
3590
3612
  }
@@ -3601,7 +3623,7 @@ class qr {
3601
3623
  * @returns precomputed point tables flattened to a single array
3602
3624
  */
3603
3625
  precomputeWindow(e, s) {
3604
- const { windows: t, windowSize: n } = st(s, this.bits), i = [];
3626
+ const { windows: t, windowSize: n } = rt(s, this.bits), i = [];
3605
3627
  let o = e, a = o;
3606
3628
  for (let c = 0; c < t; c++) {
3607
3629
  a = o, i.push(a);
@@ -3621,12 +3643,12 @@ class qr {
3621
3643
  if (!this.Fn.isValid(t))
3622
3644
  throw new Error("invalid scalar");
3623
3645
  let n = this.ZERO, i = this.BASE;
3624
- const o = st(e, this.bits);
3646
+ const o = rt(e, this.bits);
3625
3647
  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);
3648
+ const { nextN: c, offset: l, isZero: u, isNeg: p, isNegF: _, offsetF: f } = Kt(t, a, o);
3627
3649
  t = c, u ? i = i.add(je(_, s[f])) : n = n.add(je(p, s[l]));
3628
3650
  }
3629
- return qt(t), { p: n, f: i };
3651
+ return Vt(t), { p: n, f: i };
3630
3652
  }
3631
3653
  /**
3632
3654
  * Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form.
@@ -3634,73 +3656,73 @@ class qr {
3634
3656
  * @returns point
3635
3657
  */
3636
3658
  wNAFUnsafe(e, s, t, n = this.ZERO) {
3637
- const i = st(e, this.bits);
3638
- for (let o = 0; o < i.windows && t !== Ne; o++) {
3639
- const { nextN: a, offset: c, isZero: l, isNeg: u } = Gt(t, o, i);
3659
+ const i = rt(e, this.bits);
3660
+ for (let o = 0; o < i.windows && t !== Le; o++) {
3661
+ const { nextN: a, offset: c, isZero: l, isNeg: u } = Kt(t, o, i);
3640
3662
  if (t = a, !l) {
3641
3663
  const p = s[c];
3642
3664
  n = n.add(u ? p.negate() : p);
3643
3665
  }
3644
3666
  }
3645
- return qt(t), n;
3667
+ return Vt(t), n;
3646
3668
  }
3647
3669
  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;
3670
+ let n = nt.get(s);
3671
+ return n || (n = this.precomputeWindow(s, e), e !== 1 && (typeof t == "function" && (n = t(n)), nt.set(s, n))), n;
3650
3672
  }
3651
3673
  cached(e, s, t) {
3652
- const n = nt(e);
3674
+ const n = it(e);
3653
3675
  return this.wNAF(n, this.getPrecomputes(n, e, t), s);
3654
3676
  }
3655
3677
  unsafe(e, s, t, n) {
3656
- const i = nt(e);
3678
+ const i = it(e);
3657
3679
  return i === 1 ? this._unsafeLadder(e, s, n) : this.wNAFUnsafe(i, this.getPrecomputes(i, e, t), s, n);
3658
3680
  }
3659
3681
  // We calculate precomputes for elliptic curve point multiplication
3660
3682
  // using windowed method. This specifies window size and
3661
3683
  // stores precomputed values. Usually only base point would be precomputed.
3662
3684
  createCache(e, s) {
3663
- vs(s, this.bits), Es.set(e, s), rt.delete(e);
3685
+ Is(s, this.bits), As.set(e, s), nt.delete(e);
3664
3686
  }
3665
3687
  hasCache(e) {
3666
- return nt(e) !== 1;
3688
+ return it(e) !== 1;
3667
3689
  }
3668
3690
  }
3669
- function Kr(r, e, s, t) {
3691
+ function Vr(r, e, s, t) {
3670
3692
  let n = e, i = r.ZERO, o = r.ZERO;
3671
- for (; s > Ne || t > Ne; )
3693
+ for (; s > Le || t > Le; )
3672
3694
  s & Re && (i = i.add(n)), t & Re && (o = o.add(n)), n = n.double(), s >>= Re, t >>= Re;
3673
3695
  return { p1: i, p2: o };
3674
3696
  }
3675
- function Kt(r, e, s) {
3697
+ function zt(r, e, s) {
3676
3698
  if (e) {
3677
3699
  if (e.ORDER !== r)
3678
3700
  throw new Error("Field.ORDER must match order: Fp == p, Fn == n");
3679
- return Ur(e), e;
3701
+ return Hr(e), e;
3680
3702
  } else
3681
- return Je(r, { isLE: s });
3703
+ return Ze(r, { isLE: s });
3682
3704
  }
3683
- function Vr(r, e, s = {}, t) {
3705
+ function zr(r, e, s = {}, t) {
3684
3706
  if (t === void 0 && (t = r === "edwards"), !e || typeof e != "object")
3685
3707
  throw new Error(`expected valid ${r} CURVE object`);
3686
3708
  for (const c of ["p", "n", "h"]) {
3687
3709
  const l = e[c];
3688
- if (!(typeof l == "bigint" && l > Ne))
3710
+ if (!(typeof l == "bigint" && l > Le))
3689
3711
  throw new Error(`CURVE.${c} must be positive bigint`);
3690
3712
  }
3691
- const n = Kt(e.p, s.Fp, t), i = Kt(e.n, s.Fn, t), a = ["Gx", "Gy", "a", "b"];
3713
+ const n = zt(e.p, s.Fp, t), i = zt(e.n, s.Fn, t), a = ["Gx", "Gy", "a", "b"];
3692
3714
  for (const c of a)
3693
3715
  if (!n.isValid(e[c]))
3694
3716
  throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);
3695
3717
  return e = Object.freeze(Object.assign({}, e)), { CURVE: e, Fp: n, Fn: i };
3696
3718
  }
3697
- function zr(r, e) {
3719
+ function jr(r, e) {
3698
3720
  return function(t) {
3699
3721
  const n = r(t);
3700
3722
  return { secretKey: n, publicKey: e(n) };
3701
3723
  };
3702
3724
  }
3703
- class Is {
3725
+ class Ts {
3704
3726
  constructor(e, s) {
3705
3727
  R(this, "oHash");
3706
3728
  R(this, "iHash");
@@ -3708,7 +3730,7 @@ class Is {
3708
3730
  R(this, "outputLen");
3709
3731
  R(this, "finished", !1);
3710
3732
  R(this, "destroyed", !1);
3711
- if (ns(e), q(s, void 0, "key"), this.iHash = e.create(), typeof this.iHash.update != "function")
3733
+ if (os(e), q(s, void 0, "key"), this.iHash = e.create(), typeof this.iHash.update != "function")
3712
3734
  throw new Error("Expected instance of class which extends utils.Hash");
3713
3735
  this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
3714
3736
  const t = this.blockLen, n = new Uint8Array(t);
@@ -3718,13 +3740,13 @@ class Is {
3718
3740
  this.iHash.update(n), this.oHash = e.create();
3719
3741
  for (let i = 0; i < n.length; i++)
3720
3742
  n[i] ^= 106;
3721
- this.oHash.update(n), Ce(n);
3743
+ this.oHash.update(n), Ne(n);
3722
3744
  }
3723
3745
  update(e) {
3724
- return Pe(this), this.iHash.update(e), this;
3746
+ return Ce(this), this.iHash.update(e), this;
3725
3747
  }
3726
3748
  digestInto(e) {
3727
- Pe(this), q(e, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
3749
+ Ce(this), q(e, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
3728
3750
  }
3729
3751
  digest() {
3730
3752
  const e = new Uint8Array(this.oHash.outputLen);
@@ -3742,39 +3764,39 @@ class Is {
3742
3764
  this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
3743
3765
  }
3744
3766
  }
3745
- const As = (r, e, s) => new Is(r, e).update(s).digest();
3746
- As.create = (r, e) => new Is(r, e);
3767
+ const Rs = (r, e, s) => new Ts(r, e).update(s).digest();
3768
+ Rs.create = (r, e) => new Ts(r, e);
3747
3769
  /*! 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);
3770
+ const jt = (r, e) => (r + (r >= 0 ? e : -e) / ks) / e;
3771
+ function Yr(r, e, s) {
3772
+ const [[t, n], [i, o]] = e, a = jt(o * r, s), c = jt(-n * r, s);
3751
3773
  let l = r - a * t - c * i, u = -a * n - c * o;
3752
3774
  const p = l < ge, _ = u < ge;
3753
3775
  p && (l = -l), _ && (u = -u);
3754
- const f = gt(Math.ceil(Pr(s) / 2)) + Oe;
3776
+ const f = wt(Math.ceil(Cr(s) / 2)) + Pe;
3755
3777
  if (l < ge || l >= f || u < ge || u >= f)
3756
3778
  throw new Error("splitScalar (endomorphism): failed, k=" + r);
3757
3779
  return { k1neg: p, k1: l, k2neg: _, k2: u };
3758
3780
  }
3759
- function ut(r) {
3781
+ function pt(r) {
3760
3782
  if (!["compact", "recovered", "der"].includes(r))
3761
3783
  throw new Error('Signature format must be "compact", "recovered", or "der"');
3762
3784
  return r;
3763
3785
  }
3764
- function it(r, e) {
3786
+ function ot(r, e) {
3765
3787
  const s = {};
3766
3788
  for (let t of Object.keys(e))
3767
3789
  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;
3790
+ return ze(s.lowS, "lowS"), ze(s.prehash, "prehash"), s.format !== void 0 && pt(s.format), s;
3769
3791
  }
3770
- class Yr extends Error {
3792
+ class Xr extends Error {
3771
3793
  constructor(e = "") {
3772
3794
  super(e);
3773
3795
  }
3774
3796
  }
3775
3797
  const Se = {
3776
3798
  // asn.1 DER encoding utils
3777
- Err: Yr,
3799
+ Err: Xr,
3778
3800
  // Basic building block is TLV (Tag-Length-Value)
3779
3801
  _tlv: {
3780
3802
  encode: (r, e) => {
@@ -3783,11 +3805,11 @@ const Se = {
3783
3805
  throw new s("tlv.encode: wrong tag");
3784
3806
  if (e.length & 1)
3785
3807
  throw new s("tlv.encode: unpadded data");
3786
- const t = e.length / 2, n = Fe(t);
3808
+ const t = e.length / 2, n = Ge(t);
3787
3809
  if (n.length / 2 & 128)
3788
3810
  throw new s("tlv.encode: long form length too big");
3789
- const i = t > 127 ? Fe(n.length / 2 | 128) : "";
3790
- return Fe(r) + i + n + e;
3811
+ const i = t > 127 ? Ge(n.length / 2 | 128) : "";
3812
+ return Ge(r) + i + n + e;
3791
3813
  },
3792
3814
  // v - value, l - left bytes (unparsed)
3793
3815
  decode(r, e) {
@@ -3832,7 +3854,7 @@ const Se = {
3832
3854
  const { Err: e } = Se;
3833
3855
  if (r < ge)
3834
3856
  throw new e("integer: negative integers are not allowed");
3835
- let s = Fe(r);
3857
+ let s = Ge(r);
3836
3858
  if (Number.parseInt(s[0], 16) & 8 && (s = "00" + s), s.length & 1)
3837
3859
  throw new e("unexpected DER parsing assertion: unpadded hex");
3838
3860
  return s;
@@ -3843,7 +3865,7 @@ const Se = {
3843
3865
  throw new e("invalid signature integer: negative");
3844
3866
  if (r[0] === 0 && !(r[1] & 128))
3845
3867
  throw new e("invalid signature integer: unnecessary leading zero");
3846
- return Xe(r);
3868
+ return Je(r);
3847
3869
  }
3848
3870
  },
3849
3871
  toSig(r) {
@@ -3859,12 +3881,12 @@ const Se = {
3859
3881
  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
3882
  return e.encode(48, i);
3861
3883
  }
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;
3884
+ }, ge = BigInt(0), Pe = BigInt(1), ks = BigInt(2), We = BigInt(3), Jr = BigInt(4);
3885
+ function Zr(r, e = {}) {
3886
+ const s = zr("weierstrass", r, e), { Fp: t, Fn: n } = s;
3865
3887
  let i = s.CURVE;
3866
3888
  const { h: o, n: a } = i;
3867
- mt(e, {}, {
3889
+ yt(e, {}, {
3868
3890
  allowInfinityPoint: "boolean",
3869
3891
  clearCofactor: "function",
3870
3892
  isTorsionFree: "function",
@@ -3875,7 +3897,7 @@ function Jr(r, e = {}) {
3875
3897
  const { endo: c } = e;
3876
3898
  if (c && (!t.is0(i.a) || typeof c.beta != "bigint" || !Array.isArray(c.basises)))
3877
3899
  throw new Error('invalid endo: expected "beta": bigint and "basises": array');
3878
- const l = ks(t, n);
3900
+ const l = Ps(t, n);
3879
3901
  function u() {
3880
3902
  if (!t.isOdd)
3881
3903
  throw new Error("compression is not supported: Field does not have .isOdd()");
@@ -3885,7 +3907,7 @@ function Jr(r, e = {}) {
3885
3907
  if (ze(m, "isCompressed"), m) {
3886
3908
  u();
3887
3909
  const C = !t.isOdd(A);
3888
- return ve(Rs(C), N);
3910
+ return ve(Os(C), N);
3889
3911
  } else
3890
3912
  return ve(Uint8Array.of(4), N, t.toBytes(A));
3891
3913
  }
@@ -3901,8 +3923,8 @@ function Jr(r, e = {}) {
3901
3923
  try {
3902
3924
  O = t.sqrt(M);
3903
3925
  } catch (Y) {
3904
- const G = Y instanceof Error ? ": " + Y.message : "";
3905
- throw new Error("bad point: is not on curve, sqrt error" + G);
3926
+ const W = Y instanceof Error ? ": " + Y.message : "";
3927
+ throw new Error("bad point: is not on curve, sqrt error" + W);
3906
3928
  }
3907
3929
  u();
3908
3930
  const $ = t.isOdd(O);
@@ -3926,7 +3948,7 @@ function Jr(r, e = {}) {
3926
3948
  }
3927
3949
  if (!y(i.Gx, i.Gy))
3928
3950
  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));
3951
+ const I = t.mul(t.pow(i.a, We), Jr), P = t.mul(t.sqr(i.b), BigInt(27));
3930
3952
  if (t.is0(t.add(I, P)))
3931
3953
  throw new Error("bad curve params: a or b");
3932
3954
  function H(T, x, m = !1) {
@@ -3941,9 +3963,9 @@ function Jr(r, e = {}) {
3941
3963
  function K(T) {
3942
3964
  if (!c || !c.basises)
3943
3965
  throw new Error("no endo");
3944
- return jr(T, c.basises, n.ORDER);
3966
+ return Yr(T, c.basises, n.ORDER);
3945
3967
  }
3946
- const W = Ut((T, x) => {
3968
+ const G = Ft((T, x) => {
3947
3969
  const { X: m, Y: b, Z: A } = T;
3948
3970
  if (t.eql(A, t.ONE))
3949
3971
  return { x: m, y: b };
@@ -3955,7 +3977,7 @@ function Jr(r, e = {}) {
3955
3977
  if (!t.eql(O, t.ONE))
3956
3978
  throw new Error("invZ was invalid");
3957
3979
  return { x: C, y: M };
3958
- }), Z = Ut((T) => {
3980
+ }), Z = Ft((T) => {
3959
3981
  if (T.is0()) {
3960
3982
  if (e.allowInfinityPoint && !t.is0(T.Y))
3961
3983
  return;
@@ -4042,8 +4064,8 @@ function Jr(r, e = {}) {
4042
4064
  // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
4043
4065
  double() {
4044
4066
  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, $);
4067
+ let M = t.ZERO, O = t.ZERO, $ = t.ZERO, F = t.mul(A, A), Y = t.mul(N, N), W = t.mul(C, C), B = t.mul(A, N);
4068
+ return B = t.add(B, B), $ = t.mul(A, C), $ = t.add($, $), M = t.mul(x, $), O = t.mul(b, W), O = t.add(M, O), M = t.sub(Y, O), O = t.add(Y, O), O = t.mul(M, O), M = t.mul(B, M), $ = t.mul(b, $), W = t.mul(x, W), B = t.sub(F, W), B = t.mul(x, B), B = t.add(B, $), $ = t.add(F, F), F = t.add($, F), F = t.add(F, W), F = t.mul(F, B), O = t.add(O, F), W = t.mul(N, C), W = t.add(W, W), F = t.mul(W, B), M = t.sub(M, F), $ = t.mul(W, Y), $ = t.add($, $), $ = t.add($, $), new E(M, O, $);
4047
4069
  }
4048
4070
  // Renes-Costello-Batina exception-free addition formula.
4049
4071
  // There is 30% faster Jacobian formula, but it is not complete.
@@ -4053,11 +4075,11 @@ function Jr(r, e = {}) {
4053
4075
  D(x);
4054
4076
  const { X: m, Y: b, Z: A } = this, { X: N, Y: C, Z: M } = x;
4055
4077
  let O = t.ZERO, $ = t.ZERO, F = t.ZERO;
4056
- const Y = i.a, G = t.mul(i.b, We);
4078
+ const Y = i.a, W = t.mul(i.b, We);
4057
4079
  let B = t.mul(m, N), X = t.mul(b, C), Q = t.mul(A, M), oe = t.add(m, b), V = t.add(N, C);
4058
4080
  oe = t.mul(oe, V), V = t.add(B, X), oe = t.sub(oe, V), V = t.add(m, A);
4059
4081
  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);
4082
+ return V = t.mul(V, ee), ee = t.add(B, Q), V = t.sub(V, ee), ee = t.add(b, A), O = t.add(C, M), ee = t.mul(ee, O), O = t.add(X, Q), ee = t.sub(ee, O), F = t.mul(Y, V), O = t.mul(W, Q), F = t.add(O, F), O = t.sub(X, F), F = t.add(X, F), $ = t.mul(O, F), X = t.add(B, B), X = t.add(X, B), Q = t.mul(Y, Q), V = t.mul(W, V), X = t.add(X, Q), Q = t.sub(B, Q), Q = t.mul(Y, Q), V = t.add(V, Q), B = t.mul(X, V), $ = t.add($, B), B = t.mul(ee, V), O = t.mul(oe, O), O = t.sub(O, B), B = t.mul(oe, X), F = t.mul(ee, F), F = t.add(F, B), new E(O, $, F);
4061
4083
  }
4062
4084
  subtract(x) {
4063
4085
  return this.add(x.negate());
@@ -4079,15 +4101,15 @@ function Jr(r, e = {}) {
4079
4101
  if (!n.isValidNot0(x))
4080
4102
  throw new Error("invalid scalar: out of range");
4081
4103
  let b, A;
4082
- const N = (C) => v.cached(this, C, (M) => Wt(E, M));
4104
+ const N = (C) => v.cached(this, C, (M) => qt(E, M));
4083
4105
  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);
4106
+ const { k1neg: C, k1: M, k2neg: O, k2: $ } = K(x), { p: F, f: Y } = N(M), { p: W, f: B } = N($);
4107
+ A = Y.add(B), b = U(m.beta, F, W, C, O);
4086
4108
  } else {
4087
4109
  const { p: C, f: M } = N(x);
4088
4110
  b = C, A = M;
4089
4111
  }
4090
- return Wt(E, [b, A])[0];
4112
+ return qt(E, [b, A])[0];
4091
4113
  }
4092
4114
  /**
4093
4115
  * Non-constant-time multiplication. Uses double-and-add algorithm.
@@ -4100,12 +4122,12 @@ function Jr(r, e = {}) {
4100
4122
  throw new Error("invalid scalar: out of range");
4101
4123
  if (x === ge || b.is0())
4102
4124
  return E.ZERO;
4103
- if (x === Oe)
4125
+ if (x === Pe)
4104
4126
  return b;
4105
4127
  if (v.hasCache(this))
4106
4128
  return this.multiply(x);
4107
4129
  if (m) {
4108
- const { k1neg: A, k1: N, k2neg: C, k2: M } = K(x), { p1: O, p2: $ } = Kr(E, b, N, M);
4130
+ const { k1neg: A, k1: N, k2neg: C, k2: M } = K(x), { p1: O, p2: $ } = Vr(E, b, N, M);
4109
4131
  return U(m.beta, O, $, A, C);
4110
4132
  } else
4111
4133
  return v.unsafe(b, x);
@@ -4115,7 +4137,7 @@ function Jr(r, e = {}) {
4115
4137
  * @param invertedZ Z^-1 (inverted zero) - optional, precomputation is useful for invertBatch
4116
4138
  */
4117
4139
  toAffine(x) {
4118
- return W(this, x);
4140
+ return G(this, x);
4119
4141
  }
4120
4142
  /**
4121
4143
  * Checks whether Point is free of torsion elements (is in prime subgroup).
@@ -4123,11 +4145,11 @@ function Jr(r, e = {}) {
4123
4145
  */
4124
4146
  isTorsionFree() {
4125
4147
  const { isTorsionFree: x } = e;
4126
- return o === Oe ? !0 : x ? x(E, this) : v.unsafe(this, a).is0();
4148
+ return o === Pe ? !0 : x ? x(E, this) : v.unsafe(this, a).is0();
4127
4149
  }
4128
4150
  clearCofactor() {
4129
4151
  const { clearCofactor: x } = e;
4130
- return o === Oe ? this : x ? x(E, this) : this.multiplyUnsafe(o);
4152
+ return o === Pe ? this : x ? x(E, this) : this.multiplyUnsafe(o);
4131
4153
  }
4132
4154
  isSmallOrder() {
4133
4155
  return this.multiplyUnsafe(o).is0();
@@ -4136,7 +4158,7 @@ function Jr(r, e = {}) {
4136
4158
  return ze(x, "isCompressed"), this.assertValidity(), f(E, this, x);
4137
4159
  }
4138
4160
  toHex(x = !0) {
4139
- return Be(this.toBytes(x));
4161
+ return Ue(this.toBytes(x));
4140
4162
  }
4141
4163
  toString() {
4142
4164
  return `<Point ${this.is0() ? "ZERO" : this.toHex()}>`;
@@ -4149,13 +4171,13 @@ function Jr(r, e = {}) {
4149
4171
  R(E, "Fp", t), // scalar field
4150
4172
  R(E, "Fn", n);
4151
4173
  let z = E;
4152
- const k = n.BITS, v = new qr(z, e.endo ? Math.ceil(k / 2) : k);
4174
+ const k = n.BITS, v = new Kr(z, e.endo ? Math.ceil(k / 2) : k);
4153
4175
  return z.BASE.precompute(8), z;
4154
4176
  }
4155
- function Rs(r) {
4177
+ function Os(r) {
4156
4178
  return Uint8Array.of(r ? 2 : 3);
4157
4179
  }
4158
- function ks(r, e) {
4180
+ function Ps(r, e) {
4159
4181
  return {
4160
4182
  secretKey: e.BYTES,
4161
4183
  publicKey: 1 + r.BYTES,
@@ -4164,8 +4186,8 @@ function ks(r, e) {
4164
4186
  signature: 2 * e.BYTES
4165
4187
  };
4166
4188
  }
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) });
4189
+ function Qr(r, e = {}) {
4190
+ const { Fn: s } = r, t = e.randomBytes || ds, n = Object.assign(Ps(r.Fp, s), { seed: Es(s.ORDER) });
4169
4191
  function i(f) {
4170
4192
  try {
4171
4193
  const w = s.fromBytes(f);
@@ -4184,14 +4206,14 @@ function Zr(r, e = {}) {
4184
4206
  }
4185
4207
  }
4186
4208
  function a(f = t(n.seed)) {
4187
- return Gr(q(f, n.seed, "seed"), s.ORDER);
4209
+ return qr(q(f, n.seed, "seed"), s.ORDER);
4188
4210
  }
4189
4211
  function c(f, w = !0) {
4190
4212
  return r.BASE.multiply(s.fromBytes(f)).toBytes(w);
4191
4213
  }
4192
4214
  function l(f) {
4193
4215
  const { secretKey: w, publicKey: S, publicKeyUncompressed: y } = n;
4194
- if (!ft(f) || "_lengths" in s && s._lengths || w === S)
4216
+ if (!xt(f) || "_lengths" in s && s._lengths || w === S)
4195
4217
  return;
4196
4218
  const I = q(f, void 0, "key").length;
4197
4219
  return I === S || I === y;
@@ -4208,25 +4230,25 @@ function Zr(r, e = {}) {
4208
4230
  isValidSecretKey: i,
4209
4231
  isValidPublicKey: o,
4210
4232
  randomSecretKey: a
4211
- }, _ = zr(a, c);
4233
+ }, _ = jr(a, c);
4212
4234
  return Object.freeze({ getPublicKey: c, getSharedSecret: u, keygen: _, Point: r, utils: p, lengths: n });
4213
4235
  }
4214
- function Qr(r, e, s = {}) {
4215
- ns(e), mt(s, {}, {
4236
+ function en(r, e, s = {}) {
4237
+ os(e), yt(s, {}, {
4216
4238
  hmac: "function",
4217
4239
  lowS: "boolean",
4218
4240
  randomBytes: "function",
4219
4241
  bits2int: "function",
4220
4242
  bits2int_modN: "function"
4221
4243
  }), 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 = {
4244
+ const t = s.randomBytes || ds, n = s.hmac || ((x, m) => Rs(e, x, m)), { Fp: i, Fn: o } = r, { ORDER: a, BITS: c } = o, { keygen: l, getPublicKey: u, getSharedSecret: p, utils: _, lengths: f } = Qr(r, s), w = {
4223
4245
  prehash: !0,
4224
4246
  lowS: typeof s.lowS == "boolean" ? s.lowS : !0,
4225
4247
  format: "compact",
4226
4248
  extraEntropy: !1
4227
- }, S = a * Ts < i.ORDER;
4249
+ }, S = a * ks < i.ORDER;
4228
4250
  function y(x) {
4229
- const m = a >> Oe;
4251
+ const m = a >> Pe;
4230
4252
  return x > m;
4231
4253
  }
4232
4254
  function I(x, m) {
@@ -4239,7 +4261,7 @@ function Qr(r, e, s = {}) {
4239
4261
  throw new Error('"recovered" sig type is not supported for cofactor >2 curves');
4240
4262
  }
4241
4263
  function H(x, m) {
4242
- ut(m);
4264
+ pt(m);
4243
4265
  const b = f.signature, A = m === "compact" ? b : m === "recovered" ? b + 1 : void 0;
4244
4266
  return q(x, A);
4245
4267
  }
@@ -4282,7 +4304,7 @@ function Qr(r, e, s = {}) {
4282
4304
  const { r: b, s: A } = this, N = this.assertRecovery(), C = N === 2 || N === 3 ? b + a : b;
4283
4305
  if (!i.isValid(C))
4284
4306
  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));
4307
+ const M = i.toBytes(C), O = r.fromBytes(ve(Os((N & 1) === 0), M)), $ = o.inv(C), F = G(q(m, void 0, "msgHash")), Y = o.create(-F * $), W = o.create(A * $), B = r.BASE.multiplyUnsafe(Y).add(O.multiplyUnsafe(W));
4286
4308
  if (B.is0())
4287
4309
  throw new Error("invalid recovery: point at infinify");
4288
4310
  return B.assertValidity(), B;
@@ -4292,33 +4314,33 @@ function Qr(r, e, s = {}) {
4292
4314
  return y(this.s);
4293
4315
  }
4294
4316
  toBytes(m = w.format) {
4295
- if (ut(m), m === "der")
4317
+ if (pt(m), m === "der")
4296
4318
  return Ve(Se.hexFromSig(this));
4297
4319
  const { r: b, s: A } = this, N = o.toBytes(b), C = o.toBytes(A);
4298
4320
  return m === "recovered" ? (P(), ve(Uint8Array.of(this.assertRecovery()), N, C)) : ve(N, C);
4299
4321
  }
4300
4322
  toHex(m) {
4301
- return Be(this.toBytes(m));
4323
+ return Ue(this.toBytes(m));
4302
4324
  }
4303
4325
  }
4304
4326
  const K = s.bits2int || function(m) {
4305
4327
  if (m.length > 8192)
4306
4328
  throw new Error("input is too large");
4307
- const b = Xe(m), A = m.length * 8 - c;
4329
+ const b = Je(m), A = m.length * 8 - c;
4308
4330
  return A > 0 ? b >> BigInt(A) : b;
4309
- }, W = s.bits2int_modN || function(m) {
4331
+ }, G = s.bits2int_modN || function(m) {
4310
4332
  return o.create(K(m));
4311
- }, Z = gt(c);
4333
+ }, Z = wt(c);
4312
4334
  function U(x) {
4313
- return Or("num < 2^" + c, x, ge, Z), o.toBytes(x);
4335
+ return Pr("num < 2^" + c, x, ge, Z), o.toBytes(x);
4314
4336
  }
4315
4337
  function z(x, m) {
4316
4338
  return q(x, void 0, "message"), m ? q(e(x), void 0, "prehashed message") : x;
4317
4339
  }
4318
4340
  function k(x, m, b) {
4319
- const { lowS: A, prehash: N, extraEntropy: C } = it(b, w);
4341
+ const { lowS: A, prehash: N, extraEntropy: C } = ot(b, w);
4320
4342
  x = z(x, N);
4321
- const M = W(x), O = o.fromBytes(m);
4343
+ const M = G(x), O = o.fromBytes(m);
4322
4344
  if (!o.isValidNot0(O))
4323
4345
  throw new Error("invalid private key");
4324
4346
  const $ = [U(O), U(M)];
@@ -4327,7 +4349,7 @@ function Qr(r, e, s = {}) {
4327
4349
  $.push(q(B, void 0, "extraEntropy"));
4328
4350
  }
4329
4351
  const F = ve(...$), Y = M;
4330
- function G(B) {
4352
+ function W(B) {
4331
4353
  const X = K(B);
4332
4354
  if (!o.isValidNot0(X))
4333
4355
  return;
@@ -4337,18 +4359,18 @@ function Qr(r, e, s = {}) {
4337
4359
  const ee = o.create(Q * o.create(Y + V * O));
4338
4360
  if (ee === ge)
4339
4361
  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);
4362
+ let It = (oe.x === V ? 0 : 2) | Number(oe.y & Pe), At = ee;
4363
+ return A && y(ee) && (At = o.neg(ee), It ^= 1), new D(V, At, S ? void 0 : It);
4342
4364
  }
4343
- return { seed: F, k2sig: G };
4365
+ return { seed: F, k2sig: W };
4344
4366
  }
4345
4367
  function v(x, m, b = {}) {
4346
4368
  const { seed: A, k2sig: N } = k(x, m, b);
4347
- return Cr(e.outputLen, o.BYTES, n)(A, N).toBytes(b.format);
4369
+ return Nr(e.outputLen, o.BYTES, n)(A, N).toBytes(b.format);
4348
4370
  }
4349
4371
  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)) {
4372
+ const { lowS: N, prehash: C, format: M } = ot(A, w);
4373
+ if (b = q(b, void 0, "publicKey"), m = z(m, C), !xt(x)) {
4352
4374
  const O = x instanceof D ? ", use sig.toBytes()" : "";
4353
4375
  throw new Error("verify expects Uint8Array signature" + O);
4354
4376
  }
@@ -4357,14 +4379,14 @@ function Qr(r, e, s = {}) {
4357
4379
  const O = D.fromBytes(x, M), $ = r.fromBytes(b);
4358
4380
  if (N && O.hasHighS())
4359
4381
  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));
4382
+ const { r: F, s: Y } = O, W = G(m), B = o.inv(Y), X = o.create(W * B), Q = o.create(F * B), oe = r.BASE.multiplyUnsafe(X).add($.multiplyUnsafe(Q));
4361
4383
  return oe.is0() ? !1 : o.create(oe.x) === F;
4362
4384
  } catch {
4363
4385
  return !1;
4364
4386
  }
4365
4387
  }
4366
4388
  function T(x, m, b = {}) {
4367
- const { prehash: A } = it(b, w);
4389
+ const { prehash: A } = ot(b, w);
4368
4390
  return m = z(m, A), D.fromBytes(x, "recovered").recoverPublicKey(m).toBytes();
4369
4391
  }
4370
4392
  return Object.freeze({
@@ -4382,7 +4404,7 @@ function Qr(r, e, s = {}) {
4382
4404
  });
4383
4405
  }
4384
4406
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
4385
- const yt = {
4407
+ const St = {
4386
4408
  p: BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),
4387
4409
  n: BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),
4388
4410
  h: BigInt(1),
@@ -4390,44 +4412,44 @@ const yt = {
4390
4412
  b: BigInt(7),
4391
4413
  Gx: BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
4392
4414
  Gy: BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")
4393
- }, en = {
4415
+ }, tn = {
4394
4416
  beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
4395
4417
  basises: [
4396
4418
  [BigInt("0x3086d221a7d46bcde86c90e49284eb15"), -BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],
4397
4419
  [BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), BigInt("0x3086d221a7d46bcde86c90e49284eb15")]
4398
4420
  ]
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))
4421
+ }, Yt = /* @__PURE__ */ BigInt(2);
4422
+ function sn(r) {
4423
+ const e = St.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), i = BigInt(22), o = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, u = l * l * r % e, p = ce(u, s, e) * u % e, _ = ce(p, s, e) * u % e, f = ce(_, Yt, e) * l % e, w = ce(f, n, e) * f % e, S = ce(w, i, e) * w % e, y = ce(S, a, e) * S % e, I = ce(y, c, e) * y % e, P = ce(I, a, e) * S % e, H = ce(P, s, e) * u % e, D = ce(H, o, e) * w % e, K = ce(D, t, e) * l % e, G = ce(K, Yt, e);
4424
+ if (!ft.eql(ft.sqr(G), r))
4403
4425
  throw new Error("Cannot find square root");
4404
- return W;
4405
- }
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 = [];
4410
- 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;
4426
+ return G;
4427
+ }
4428
+ const ft = Ze(St.p, { sqrt: sn }), rn = /* @__PURE__ */ Zr(St, {
4429
+ Fp: ft,
4430
+ endo: tn
4431
+ }), nn = /* @__PURE__ */ en(rn, Rr), on = BigInt(0), Me = BigInt(1), an = BigInt(2), cn = BigInt(7), ln = BigInt(256), dn = BigInt(113), Cs = [], Ns = [], Ls = [];
4432
+ for (let r = 0, e = Me, s = 1, t = 0; r < 24; r++) {
4433
+ [s, t] = [t, (2 * s + 3 * t) % 5], Cs.push(2 * (5 * t + s)), Ns.push((r + 1) * (r + 2) / 2 % 64);
4434
+ let n = on;
4413
4435
  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);
4436
+ e = (e << Me ^ (e >> cn) * dn) % ln, e & an && (n ^= Me << (Me << BigInt(i)) - Me);
4437
+ Ls.push(n);
4416
4438
  }
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) {
4439
+ 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);
4440
+ function pn(r, e = 24) {
4419
4441
  const s = new Uint32Array(10);
4420
4442
  for (let t = 24 - e; t < 24; t++) {
4421
4443
  for (let o = 0; o < 10; o++)
4422
4444
  s[o] = r[o] ^ r[o + 10] ^ r[o + 20] ^ r[o + 30] ^ r[o + 40];
4423
4445
  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];
4446
+ const a = (o + 8) % 10, c = (o + 2) % 10, l = s[c], u = s[c + 1], p = Xt(l, u, 1) ^ s[a], _ = Jt(l, u, 1) ^ s[a + 1];
4425
4447
  for (let f = 0; f < 50; f += 10)
4426
4448
  r[o + f] ^= p, r[o + f + 1] ^= _;
4427
4449
  }
4428
4450
  let n = r[2], i = r[3];
4429
4451
  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];
4452
+ const a = Ns[o], c = Xt(n, i, a), l = Jt(n, i, a), u = Cs[o];
4431
4453
  n = r[u], i = r[u + 1], r[u] = c, r[u + 1] = l;
4432
4454
  }
4433
4455
  for (let o = 0; o < 50; o += 10) {
@@ -4436,11 +4458,11 @@ function hn(r, e = 24) {
4436
4458
  for (let a = 0; a < 10; a++)
4437
4459
  r[o + a] ^= ~s[(a + 2) % 10] & s[(a + 4) % 10];
4438
4460
  }
4439
- r[0] ^= dn[t], r[1] ^= un[t];
4461
+ r[0] ^= un[t], r[1] ^= hn[t];
4440
4462
  }
4441
- Ce(s);
4463
+ Ne(s);
4442
4464
  }
4443
- class bt {
4465
+ class vt {
4444
4466
  // NOTE: we accept arguments in bytes instead of bits here.
4445
4467
  constructor(e, s, t, n = !1, i = 24) {
4446
4468
  R(this, "state");
@@ -4456,16 +4478,16 @@ class bt {
4456
4478
  R(this, "rounds");
4457
4479
  if (this.blockLen = e, this.suffix = s, this.outputLen = t, this.enableXOF = n, this.rounds = i, we(t, "outputLen"), !(0 < e && e < 200))
4458
4480
  throw new Error("only keccak-f1600 function is supported");
4459
- this.state = new Uint8Array(200), this.state32 = lr(this.state);
4481
+ this.state = new Uint8Array(200), this.state32 = dr(this.state);
4460
4482
  }
4461
4483
  clone() {
4462
4484
  return this._cloneInto();
4463
4485
  }
4464
4486
  keccak() {
4465
- Mt(this.state32), hn(this.state32, this.rounds), Mt(this.state32), this.posOut = 0, this.pos = 0;
4487
+ Bt(this.state32), pn(this.state32, this.rounds), Bt(this.state32), this.posOut = 0, this.pos = 0;
4466
4488
  }
4467
4489
  update(e) {
4468
- Pe(this), q(e);
4490
+ Ce(this), q(e);
4469
4491
  const { blockLen: s, state: t } = this, n = e.length;
4470
4492
  for (let i = 0; i < n; ) {
4471
4493
  const o = Math.min(s - this.pos, n - i);
@@ -4483,7 +4505,7 @@ class bt {
4483
4505
  e[t] ^= s, s & 128 && t === n - 1 && this.keccak(), e[n - 1] ^= 128, this.keccak();
4484
4506
  }
4485
4507
  writeInto(e) {
4486
- Pe(this, !1), q(e), this.finish();
4508
+ Ce(this, !1), q(e), this.finish();
4487
4509
  const s = this.state, { blockLen: t } = this;
4488
4510
  for (let n = 0, i = e.length; n < i; ) {
4489
4511
  this.posOut >= t && this.keccak();
@@ -4501,7 +4523,7 @@ class bt {
4501
4523
  return we(e), this.xofInto(new Uint8Array(e));
4502
4524
  }
4503
4525
  digestInto(e) {
4504
- if (is(e, this), this.finished)
4526
+ if (as(e, this), this.finished)
4505
4527
  throw new Error("digest() was already called");
4506
4528
  return this.writeInto(e), this.destroy(), e;
4507
4529
  }
@@ -4509,21 +4531,21 @@ class bt {
4509
4531
  return this.digestInto(new Uint8Array(this.outputLen));
4510
4532
  }
4511
4533
  destroy() {
4512
- this.destroyed = !0, Ce(this.state);
4534
+ this.destroyed = !0, Ne(this.state);
4513
4535
  }
4514
4536
  _cloneInto(e) {
4515
4537
  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;
4538
+ 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
4539
  }
4518
4540
  }
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 {
4541
+ const fn = (r, e, s, t = {}) => ls(() => new vt(e, r, s), t), Zt = /* @__PURE__ */ fn(1, 136, 32), _n = 60;
4542
+ class xn {
4521
4543
  constructor() {
4522
4544
  this.jwks = null;
4523
4545
  }
4524
4546
  setJWKSEndpoint(e) {
4525
4547
  try {
4526
- this.jwks = Us(new URL(e)), d.log("[CROSSx] JWKS 엔드포인트 설정:", e);
4548
+ this.jwks = Fs(new URL(e)), d.log("[CROSSx] JWKS 엔드포인트 설정:", e);
4527
4549
  } catch (s) {
4528
4550
  d.warn("[CROSSx] JWKS 엔드포인트 URL 파싱 실패:", s);
4529
4551
  }
@@ -4537,7 +4559,7 @@ class _n {
4537
4559
  iat: t.iat
4538
4560
  });
4539
4561
  const n = Math.floor(Date.now() / 1e3);
4540
- if (t.exp && t.exp + fn < n)
4562
+ if (t.exp && t.exp + _n < n)
4541
4563
  return d.warn("[CROSSx] 토큰 만료:", {
4542
4564
  exp: t.exp,
4543
4565
  now: n,
@@ -4547,7 +4569,7 @@ class _n {
4547
4569
  return d.warn("[CROSSx] JWT에 sub(사용자ID) 없음"), { payload: t, valid: !1, signatureVerified: !1 };
4548
4570
  if (this.jwks)
4549
4571
  try {
4550
- const { payload: i } = await Hs(e, this.jwks, {
4572
+ const { payload: i } = await Gs(e, this.jwks, {
4551
4573
  algorithms: ["RS256", "ES256"]
4552
4574
  });
4553
4575
  return d.log("[CROSSx] JWT 서명 검증 성공"), {
@@ -4566,7 +4588,7 @@ class _n {
4566
4588
  }
4567
4589
  }
4568
4590
  decodeJWT(e) {
4569
- return Fs(e);
4591
+ return Ws(e);
4570
4592
  }
4571
4593
  /**
4572
4594
  * EIP-191 personal_sign 서명에서 서명자 Ethereum 주소를 복원합니다.
@@ -4581,29 +4603,29 @@ class _n {
4581
4603
  ${t.length}`
4582
4604
  ), i = new Uint8Array(n.length + t.length);
4583
4605
  i.set(n, 0), i.set(t, n.length);
4584
- const o = Xt(i), a = s.startsWith("0x") ? s.slice(2) : s;
4606
+ const o = Zt(i), a = s.startsWith("0x") ? s.slice(2) : s;
4585
4607
  if (a.length !== 130)
4586
4608
  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);
4591
- return "0x" + Be(y.slice(12));
4609
+ const c = gn(a), l = c.slice(0, 32), u = c.slice(32, 64), p = c[64], _ = p >= 27 ? p - 27 : p, S = new nn.Signature(
4610
+ Qt(l),
4611
+ Qt(u)
4612
+ ).addRecoveryBit(_).recoverPublicKey(o).toBytes(!1).slice(1), y = Zt(S);
4613
+ return "0x" + Ue(y.slice(12));
4592
4614
  }
4593
4615
  }
4594
- function xn(r) {
4616
+ function gn(r) {
4595
4617
  const e = new Uint8Array(r.length / 2);
4596
4618
  for (let s = 0; s < e.length; s++)
4597
4619
  e[s] = parseInt(r.substring(s * 2, s * 2 + 2), 16);
4598
4620
  return e;
4599
4621
  }
4600
- function Jt(r) {
4622
+ function Qt(r) {
4601
4623
  let e = "0x";
4602
4624
  for (const s of r) e += s.toString(16).padStart(2, "0");
4603
4625
  return BigInt(e);
4604
4626
  }
4605
- const gn = 3e4, mn = 1e3;
4606
- class wn {
4627
+ const mn = 3e4, wn = 1e3;
4628
+ class yn {
4607
4629
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4608
4630
  async request(e) {
4609
4631
  const s = e.retries ?? 0;
@@ -4614,7 +4636,7 @@ class wn {
4614
4636
  } catch (n) {
4615
4637
  if (t === s) throw n;
4616
4638
  }
4617
- await new Promise((n) => setTimeout(n, mn * 2 ** t));
4639
+ await new Promise((n) => setTimeout(n, wn * 2 ** t));
4618
4640
  }
4619
4641
  throw new Error("Unexpected: retry loop exited without result");
4620
4642
  }
@@ -4622,7 +4644,7 @@ class wn {
4622
4644
  async _doRequest(e) {
4623
4645
  const s = new AbortController(), t = setTimeout(
4624
4646
  () => s.abort(),
4625
- e.timeoutMs ?? gn
4647
+ e.timeoutMs ?? mn
4626
4648
  );
4627
4649
  try {
4628
4650
  const n = await fetch(e.url, {
@@ -4649,7 +4671,7 @@ class wn {
4649
4671
  }
4650
4672
  }
4651
4673
  }
4652
- const yn = /* @__PURE__ */ new Set([
4674
+ const bn = /* @__PURE__ */ new Set([
4653
4675
  "https://cross-wallet-oauth.crosstoken.io",
4654
4676
  "https://stg-cross-wallet-oauth.crosstoken.io",
4655
4677
  "https://dev-cross-wallet-oauth.crosstoken.io"
@@ -4751,24 +4773,24 @@ class Ie {
4751
4773
  }
4752
4774
  }, 1e3), D = () => {
4753
4775
  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"));
4776
+ }, K = (G) => {
4777
+ if (G.origin !== e.expectedOrigin) return;
4778
+ if (!bn.has(G.origin)) {
4779
+ d.error("[CROSSx] postMessage origin이 허용 목록에 없음:", G.origin), D(), t(new Error("Unauthorized OAuth origin"));
4758
4780
  return;
4759
4781
  }
4760
4782
  D();
4761
- const Z = typeof W.data.status == "string", U = Z ? W.data.data ?? {} : W.data;
4783
+ const Z = typeof G.data.status == "string", U = Z ? G.data.data ?? {} : G.data;
4762
4784
  d.log("[CROSSx] OAuth postMessage 수신 —", {
4763
4785
  format: Z ? "wrapped" : "flat",
4764
- status: Z ? W.data.status : "(flat)"
4786
+ status: Z ? G.data.status : "(flat)"
4765
4787
  });
4766
- const z = (U == null ? void 0 : U.state) ?? W.data.state;
4788
+ const z = (U == null ? void 0 : U.state) ?? G.data.state;
4767
4789
  if (!z || z !== c) {
4768
4790
  t(new Error("OAuth state mismatch — possible CSRF attack"));
4769
4791
  return;
4770
4792
  }
4771
- if (Z && W.data.status !== "success") {
4793
+ if (Z && G.data.status !== "success") {
4772
4794
  d.error("[CROSSx] OAuth 실패:", U == null ? void 0 : U.error), t(new Error((U == null ? void 0 : U.error) || "Authentication failed"));
4773
4795
  return;
4774
4796
  }
@@ -4782,7 +4804,7 @@ class Ie {
4782
4804
  hasIdToken: !!k,
4783
4805
  hasEmail: !!T
4784
4806
  }), !E) {
4785
- d.error("[CROSSx] 토큰을 찾을 수 없음:", W.data), t(new Error("Token not found in response"));
4807
+ d.error("[CROSSx] 토큰을 찾을 수 없음:", G.data), t(new Error("Token not found in response"));
4786
4808
  return;
4787
4809
  }
4788
4810
  const x = { token: E, email: T }, m = (b) => {
@@ -4799,8 +4821,8 @@ class Ie {
4799
4821
  });
4800
4822
  }
4801
4823
  }
4802
- const Me = "crossx_wallet_data", ke = "crossx_mock_pin_hash";
4803
- class bn {
4824
+ const $e = "crossx_wallet_data", ke = "crossx_mock_pin_hash";
4825
+ class Sn {
4804
4826
  constructor(e, s) {
4805
4827
  this.storage = e, this.pinStore = s ?? null;
4806
4828
  }
@@ -4813,13 +4835,13 @@ class bn {
4813
4835
  async checkWallet() {
4814
4836
  if (this.migrateScenario !== void 0)
4815
4837
  return d.log("[Mock] checkWallet → migration_required"), "migration_required";
4816
- const s = await this.storage.get(Me) ? "exists" : "not_found";
4838
+ const s = await this.storage.get($e) ? "exists" : "not_found";
4817
4839
  return d.log(`[Mock] checkWallet → ${s}`), s;
4818
4840
  }
4819
4841
  async getOrCreateWallet(e) {
4820
4842
  var s;
4821
4843
  try {
4822
- const t = await this.storage.get(Me);
4844
+ const t = await this.storage.get($e);
4823
4845
  if (t) return t;
4824
4846
  const n = {
4825
4847
  id: e,
@@ -4827,7 +4849,7 @@ class bn {
4827
4849
  derivationPath: "m/44'/60'/0'/0/0",
4828
4850
  createdAt: Date.now()
4829
4851
  };
4830
- await this.storage.set(Me, n);
4852
+ await this.storage.set($e, n);
4831
4853
  const i = (s = this.pinStore) == null ? void 0 : s.get();
4832
4854
  return i && (await this.storage.set(ke, i), d.log("[Mock] 지갑 생성 — PIN 저장됨")), n;
4833
4855
  } catch (t) {
@@ -4836,7 +4858,7 @@ class bn {
4836
4858
  }
4837
4859
  /** GET /mnemonic/addresses 모킹 — PIN 불필요, 캐시된 주소 반환 */
4838
4860
  async getAddresses(e) {
4839
- const s = await this.storage.get(Me);
4861
+ const s = await this.storage.get($e);
4840
4862
  return s ? [{ address: s.address, index: 0 }] : [];
4841
4863
  }
4842
4864
  async getAddress(e, s) {
@@ -4916,7 +4938,7 @@ class bn {
4916
4938
  derivationPath: "m/44'/60'/0'/0/0",
4917
4939
  createdAt: Date.now()
4918
4940
  };
4919
- await this.storage.set(Me, t);
4941
+ await this.storage.set($e, t);
4920
4942
  const n = (i = this.pinStore) == null ? void 0 : i.get();
4921
4943
  return n && (await this.storage.set(ke, n), d.log("[Mock] 마이그레이션 — PIN 저장됨")), t;
4922
4944
  }
@@ -4972,9 +4994,9 @@ class Ae {
4972
4994
  */
4973
4995
  async ensureValidToken() {
4974
4996
  const e = this.tokenStore.get();
4975
- if (e && !this.tokenStore.isExpiringSoon(Lt))
4997
+ if (e && !this.tokenStore.isExpiringSoon(Mt))
4976
4998
  return e;
4977
- const s = !e || this.tokenStore.isExpiringSoon(Lt);
4999
+ const s = !e || this.tokenStore.isExpiringSoon(Mt);
4978
5000
  if (this._onTokenRefresh) {
4979
5001
  if (await this.deduplicatedRefresh()) {
4980
5002
  const n = this.tokenStore.get();
@@ -5402,7 +5424,7 @@ class Ae {
5402
5424
  }
5403
5425
  }
5404
5426
  }
5405
- class $e {
5427
+ class Be {
5406
5428
  constructor(e, s) {
5407
5429
  this.cache = /* @__PURE__ */ new Map(), this.loadedAt = 0, this.usingFallback = !1, this.adapterConfig = e, this.projectId = e.projectId, this.transport = s;
5408
5430
  }
@@ -5420,7 +5442,7 @@ class $e {
5420
5442
  const s = e.data.chains;
5421
5443
  return this.populateCache(s, !1), s;
5422
5444
  } catch {
5423
- const e = $e.fallbackChains();
5445
+ const e = Be.fallbackChains();
5424
5446
  return this.populateCache(e, !0), e;
5425
5447
  }
5426
5448
  }
@@ -5434,7 +5456,7 @@ class $e {
5434
5456
  }
5435
5457
  isCacheValid() {
5436
5458
  if (this.loadedAt === 0) return !1;
5437
- const e = this.usingFallback ? ir : nr;
5459
+ const e = this.usingFallback ? or : ir;
5438
5460
  return e === 0 ? !0 : Date.now() - this.loadedAt < e;
5439
5461
  }
5440
5462
  populateCache(e, s) {
@@ -5456,13 +5478,13 @@ class $e {
5456
5478
  if (e.code < 0) {
5457
5479
  const s = typeof e.data == "string" ? e.data : e.message ?? "체인 레지스트리 요청에 실패했습니다";
5458
5480
  throw new g(
5459
- $e.mapErrorCode(e.code),
5481
+ Be.mapErrorCode(e.code),
5460
5482
  s
5461
5483
  );
5462
5484
  }
5463
5485
  }
5464
5486
  fallbackOrThrow(e) {
5465
- const s = $e.fallbackChains().find(
5487
+ const s = Be.fallbackChains().find(
5466
5488
  (t) => t.chainId === e
5467
5489
  );
5468
5490
  if (s) return s;
@@ -5472,7 +5494,7 @@ class $e {
5472
5494
  );
5473
5495
  }
5474
5496
  static fallbackChains() {
5475
- return Object.values(Ye).map((e) => ({
5497
+ return Object.values(Xe).map((e) => ({
5476
5498
  chainId: e.caipId,
5477
5499
  rpcUrl: e.rpcUrl
5478
5500
  }));
@@ -5496,7 +5518,7 @@ class $e {
5496
5518
  }
5497
5519
  }
5498
5520
  }
5499
- const Zt = "__crossx-confirm-style", J = "__crossx-confirm-overlay", Sn = {
5521
+ const es = "__crossx-confirm-style", J = "__crossx-confirm-overlay", vn = {
5500
5522
  light: {
5501
5523
  bg: "#FFFFFF",
5502
5524
  border: "rgba(18,18,18,0.05)",
@@ -5552,8 +5574,8 @@ const Zt = "__crossx-confirm-style", J = "__crossx-confirm-overlay", Sn = {
5552
5574
  onPrimary: "#FFFFFF"
5553
5575
  }
5554
5576
  };
5555
- function Qt(r, e) {
5556
- const s = Sn[r], t = e == null ? void 0 : e[r];
5577
+ function ts(r, e) {
5578
+ const s = vn[r], t = e == null ? void 0 : e[r];
5557
5579
  return t ? {
5558
5580
  ...s,
5559
5581
  // ── Brand
@@ -5585,7 +5607,7 @@ function Qt(r, e) {
5585
5607
  ...t.error !== void 0 && { errorColor: t.error }
5586
5608
  } : s;
5587
5609
  }
5588
- const vn = `
5610
+ const En = `
5589
5611
  @import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600&display=swap');
5590
5612
 
5591
5613
  #${J} {
@@ -7416,8 +7438,8 @@ const vn = `
7416
7438
  }
7417
7439
  `;
7418
7440
  function le() {
7419
- let r = document.getElementById(Zt);
7420
- r || (r = document.createElement("style"), r.id = Zt, document.head.appendChild(r)), r.textContent = vn;
7441
+ let r = document.getElementById(es);
7442
+ r || (r = document.createElement("style"), r.id = es, document.head.appendChild(r)), r.textContent = En;
7421
7443
  }
7422
7444
  function de(r) {
7423
7445
  const e = (s) => s.stopPropagation();
@@ -7438,9 +7460,9 @@ function de(r) {
7438
7460
  s.preventDefault();
7439
7461
  }, { passive: !1 }), document.body.appendChild(r);
7440
7462
  }
7441
- const En = () => /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
7442
- function Ge() {
7443
- if (En()) {
7463
+ const In = () => /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
7464
+ function qe() {
7465
+ if (In()) {
7444
7466
  const e = window.scrollY;
7445
7467
  return document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.left = "0", document.body.style.right = "0", () => {
7446
7468
  document.body.style.position = "", document.body.style.top = "", document.body.style.left = "", document.body.style.right = "", window.scrollTo(0, e);
@@ -7454,18 +7476,18 @@ function Ge() {
7454
7476
  function re(r) {
7455
7477
  return r ? r.length <= 13 ? r : `${r.slice(0, 6)}…${r.slice(-4)}` : "—";
7456
7478
  }
7457
- function In(r, e = "CROSS", s = 18) {
7479
+ function An(r, e = "CROSS", s = 18) {
7458
7480
  if (!r || r === "0x" || r === "0x0") return null;
7459
7481
  try {
7460
7482
  const t = BigInt(r);
7461
7483
  if (t === 0n) return null;
7462
- const n = pt(t, s);
7484
+ const n = _t(t, s);
7463
7485
  return n === "0" ? null : `${n} ${e}`;
7464
7486
  } catch {
7465
7487
  return null;
7466
7488
  }
7467
7489
  }
7468
- const es = {
7490
+ const ss = {
7469
7491
  1: "Ethereum Mainnet",
7470
7492
  5: "Goerli Testnet",
7471
7493
  11155111: "Ethereum Sepolia",
@@ -7488,16 +7510,16 @@ const es = {
7488
7510
  612044: "CROSS Testnet",
7489
7511
  612055: "CROSS Mainnet"
7490
7512
  };
7491
- function Ls(r) {
7513
+ function Ms(r) {
7492
7514
  const e = parseInt(r.split(":")[1] ?? "", 10);
7493
- return !isNaN(e) && es[e] ? es[e] : r;
7515
+ return !isNaN(e) && ss[e] ? ss[e] : r;
7494
7516
  }
7495
- function pt(r, e) {
7517
+ function _t(r, e) {
7496
7518
  if (r === 0n) return "0";
7497
7519
  const s = 10n ** BigInt(e), t = r / s, o = (r % s).toString().padStart(e, "0").slice(0, 6).replace(/0+$/, "");
7498
7520
  return o ? `${t}.${o}` : `${t}`;
7499
7521
  }
7500
- function ot(r) {
7522
+ function at(r) {
7501
7523
  try {
7502
7524
  const e = BigInt(r), s = e / 1000000000n, n = (e % 1000000000n).toString().padStart(9, "0").slice(0, 2).replace(/0+$/, "");
7503
7525
  return n ? `${s}.${n}` : `${s}`;
@@ -7505,25 +7527,25 @@ function ot(r) {
7505
7527
  return r;
7506
7528
  }
7507
7529
  }
7508
- function An(r) {
7530
+ function Tn(r) {
7509
7531
  try {
7510
7532
  return BigInt(r).toLocaleString();
7511
7533
  } catch {
7512
7534
  return r;
7513
7535
  }
7514
7536
  }
7515
- function Tn(r) {
7537
+ function Rn(r) {
7516
7538
  const { gasLimit: e, gasPrice: s, maxFeePerGas: t, maxPriorityFeePerGas: n, nativeSymbol: i = "ETH", nativeDecimals: o = 18 } = r;
7517
7539
  if (!e) return null;
7518
7540
  try {
7519
- const a = BigInt(e), c = An(e);
7541
+ const a = BigInt(e), c = Tn(e);
7520
7542
  if (t) {
7521
7543
  const l = a * BigInt(t);
7522
7544
  return {
7523
7545
  isDynamic: !0,
7524
- estTxFee: `${pt(l, o)} ${i}`,
7525
- maxFeeGwei: ot(t),
7526
- maxPriorityFeeGwei: n ? ot(n) : void 0,
7546
+ estTxFee: `${_t(l, o)} ${i}`,
7547
+ maxFeeGwei: at(t),
7548
+ maxPriorityFeeGwei: n ? at(n) : void 0,
7527
7549
  gasLimitFormatted: c
7528
7550
  };
7529
7551
  }
@@ -7531,8 +7553,8 @@ function Tn(r) {
7531
7553
  const l = a * BigInt(s);
7532
7554
  return {
7533
7555
  isDynamic: !1,
7534
- estTxFee: `${pt(l, o)} ${i}`,
7535
- gasPriceGwei: ot(s),
7556
+ estTxFee: `${_t(l, o)} ${i}`,
7557
+ gasPriceGwei: at(s),
7536
7558
  gasLimitFormatted: c
7537
7559
  };
7538
7560
  }
@@ -7541,8 +7563,8 @@ function Tn(r) {
7541
7563
  return null;
7542
7564
  }
7543
7565
  }
7544
- function Ds(r) {
7545
- const e = Tn(r);
7566
+ function $s(r) {
7567
+ const e = Rn(r);
7546
7568
  if (!e) return j("Estimated fee", "<span>—</span>");
7547
7569
  let s = j("Est. Tx Fee", `<span>${e.estTxFee}</span>`);
7548
7570
  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 +7575,16 @@ const me = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="
7553
7575
  </svg>`, ie = `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
7554
7576
  <line x1="18" y1="6" x2="6" y2="18"/>
7555
7577
  <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">
7578
+ </svg>`, kn = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
7557
7579
  <circle cx="20" cy="20" r="20" fill="#00D5AA"/>
7558
7580
  <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">
7581
+ </svg>`, Et = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
7560
7582
  <rect x="2" y="5" width="16" height="12" rx="2" stroke="currentColor" stroke-width="1.5"/>
7561
7583
  <path d="M2 9h16" stroke="currentColor" stroke-width="1.5"/>
7562
7584
  <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
7585
  </svg>`, On = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
7586
+ <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)"/>
7587
+ </svg>`, Pn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
7566
7588
  <circle cx="12" cy="12" r="12" fill="var(--cx-error)"/>
7567
7589
  <circle cx="12" cy="12" r="5.5" stroke="white" stroke-width="1.5"/>
7568
7590
  <path d="M12 9.5v3l2 1.5" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
@@ -7600,9 +7622,9 @@ function j(r, e) {
7600
7622
  <div class="__crossx-row-value">${e}</div>
7601
7623
  </div>`;
7602
7624
  }
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");
7625
+ function Cn(r, e) {
7626
+ const s = e, t = Qe(r.dappName), n = r.to ? `<span class="__crossx-addr-text">${re(r.to)}</span>
7627
+ <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
7628
  return a.id = J, a.innerHTML = `
7607
7629
  <div class="__crossx-card __crossx-card--migration __crossx-card--sign-tx" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7608
7630
  <div class="__crossx-header">
@@ -7617,7 +7639,7 @@ function Pn(r, e) {
7617
7639
  <span class="__crossx-sig-origin">${L(t)} </span>is requesting a Signature
7618
7640
  </p>
7619
7641
  <div class="__crossx-addr-pill">
7620
- ${St}
7642
+ ${Et}
7621
7643
  <span class="__crossx-addr-pill-text">${re(r.from)}</span>
7622
7644
  </div>
7623
7645
  <p class="__crossx-warning">After you sign, changes or cancellations are not possible.</p>
@@ -7626,7 +7648,7 @@ function Pn(r, e) {
7626
7648
  <div class="__crossx-col-right-sign">
7627
7649
  <div class="__crossx-rows">
7628
7650
  ${j("To", n)}
7629
- ${j("Network", `<span>${Ls(r.chainId)}</span>`)}
7651
+ ${j("Network", `<span>${Ms(r.chainId)}</span>`)}
7630
7652
  ${i}
7631
7653
  </div>
7632
7654
  <pre class="__crossx-raw-tx">${L(o)}</pre>
@@ -7640,9 +7662,9 @@ function Pn(r, e) {
7640
7662
  </div>
7641
7663
  `, a;
7642
7664
  }
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");
7665
+ function Nn(r, e) {
7666
+ 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>
7667
+ <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
7668
  return u.id = J, u.innerHTML = `
7647
7669
  <div class="__crossx-card __crossx-card--migration __crossx-card--send-tx" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7648
7670
  <div class="__crossx-header">
@@ -7657,7 +7679,7 @@ function Cn(r, e) {
7657
7679
  <div class="__crossx-body-cols">
7658
7680
  <div class="__crossx-rows">
7659
7681
  ${j("To", o)}
7660
- ${j("Network", `<span>${Ls(r.chainId)}</span>`)}
7682
+ ${j("Network", `<span>${Ms(r.chainId)}</span>`)}
7661
7683
  ${a}
7662
7684
  </div>
7663
7685
  <div class="__crossx-pill">
@@ -7670,7 +7692,7 @@ function Cn(r, e) {
7670
7692
  </div>
7671
7693
  `, u;
7672
7694
  }
7673
- function Ze(r) {
7695
+ function Qe(r) {
7674
7696
  var e;
7675
7697
  if (r) return r;
7676
7698
  try {
@@ -7682,10 +7704,10 @@ function Ze(r) {
7682
7704
  function L(r) {
7683
7705
  return r.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
7684
7706
  }
7685
- function Nn(r) {
7707
+ function Ln(r) {
7686
7708
  return typeof r == "string" && /^0x[0-9a-fA-F]{40}$/i.test(r);
7687
7709
  }
7688
- function Ln(r) {
7710
+ function Dn(r) {
7689
7711
  if (typeof r == "string") return L(r);
7690
7712
  if (typeof r == "number" || typeof r == "bigint" || typeof r == "boolean") return String(r);
7691
7713
  try {
@@ -7694,7 +7716,7 @@ function Ln(r) {
7694
7716
  return String(r);
7695
7717
  }
7696
7718
  }
7697
- function Dn(r, e) {
7719
+ function Mn(r, e) {
7698
7720
  const s = j(
7699
7721
  "From",
7700
7722
  `<span class="__crossx-addr-text">${re(r.from)}</span>
@@ -7726,7 +7748,7 @@ function Dn(r, e) {
7726
7748
  </div>
7727
7749
  `, c;
7728
7750
  }
7729
- function Mn(r, e) {
7751
+ function $n(r, e) {
7730
7752
  const s = document.createElement("div");
7731
7753
  return s.id = J, s.innerHTML = `
7732
7754
  <div class="__crossx-card __crossx-card--migration" style="${ae(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -7743,10 +7765,10 @@ function Mn(r, e) {
7743
7765
  </div>
7744
7766
  `, s;
7745
7767
  }
7746
- function $n(r, e, s) {
7768
+ function Bn(r, e, s) {
7747
7769
  const t = e.status !== "reverted" && e.status !== "timeout", n = e.status === "timeout", i = r.querySelector("#__crossx-ttl"), o = r.querySelector(".__crossx-header");
7748
7770
  if (i) {
7749
- const w = n ? On : t ? "" : kn, S = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
7771
+ const w = n ? Pn : t ? "" : On, S = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
7750
7772
  w ? (i.style.display = "flex", i.style.alignItems = "center", i.style.gap = "8px", i.innerHTML = `${w}<span>${S}</span>`) : i.textContent = S;
7751
7773
  }
7752
7774
  if (o && !r.querySelector("#__crossx-close-btn")) {
@@ -7782,8 +7804,8 @@ function $n(r, e, s) {
7782
7804
  });
7783
7805
  });
7784
7806
  }
7785
- function Bn(r, e) {
7786
- const s = e, t = Ze(r.dappName), n = L(r.message), i = document.createElement("div");
7807
+ function Un(r, e) {
7808
+ const s = e, t = Qe(r.dappName), n = L(r.message), i = document.createElement("div");
7787
7809
  return i.id = J, i.innerHTML = `
7788
7810
  <div class="__crossx-card __crossx-card--migration __crossx-card--sign-msg" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7789
7811
  <div class="__crossx-header">
@@ -7798,7 +7820,7 @@ function Bn(r, e) {
7798
7820
  <span class="__crossx-sig-origin">${L(t)} </span>is requesting a Signature
7799
7821
  </p>
7800
7822
  <div class="__crossx-addr-pill">
7801
- ${St}
7823
+ ${Et}
7802
7824
  <span class="__crossx-addr-pill-text">${re(r.from)}</span>
7803
7825
  </div>
7804
7826
  <p class="__crossx-warning">After you sign, changes or cancellations are not possible.</p>
@@ -7814,8 +7836,8 @@ function Bn(r, e) {
7814
7836
  </div>
7815
7837
  `, i;
7816
7838
  }
7817
- function Un(r, e) {
7818
- const s = e, t = Ze(r.dappName);
7839
+ function Hn(r, e) {
7840
+ const s = e, t = Qe(r.dappName);
7819
7841
  let n = {};
7820
7842
  if (typeof r.typedData == "string")
7821
7843
  try {
@@ -7830,7 +7852,7 @@ function Un(r, e) {
7830
7852
  <span class="__crossx-td-value">${L(i)}</span>
7831
7853
  </div>`;
7832
7854
  for (const [l, u] of Object.entries(o)) {
7833
- const p = Ln(u), f = Nn(u) ? `<span class="__crossx-addr-text">${re(u)}</span>
7855
+ const p = Dn(u), f = Ln(u) ? `<span class="__crossx-addr-text">${re(u)}</span>
7834
7856
  <button class="__crossx-copy-btn" data-copy="${L(String(u))}" title="Copy">${me}</button>` : `<span>${p}</span>`;
7835
7857
  a += `
7836
7858
  <div class="__crossx-td-row">
@@ -7853,7 +7875,7 @@ function Un(r, e) {
7853
7875
  <span class="__crossx-sig-origin">${L(t)} </span>is requesting a Signature
7854
7876
  </p>
7855
7877
  <div class="__crossx-addr-pill">
7856
- ${St}
7878
+ ${Et}
7857
7879
  <span class="__crossx-addr-pill-text">${re(r.from)}</span>
7858
7880
  </div>
7859
7881
  <p class="__crossx-warning">After you sign, changes or cancellations are not possible.</p>
@@ -7869,11 +7891,11 @@ function Un(r, e) {
7869
7891
  </div>
7870
7892
  `, c;
7871
7893
  }
7872
- const Hn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
7894
+ const Fn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
7873
7895
  <line x1="12" y1="5" x2="12" y2="19"/>
7874
7896
  <line x1="5" y1="12" x2="19" y2="12"/>
7875
7897
  </svg>`;
7876
- function Fn(r, e, s) {
7898
+ function Gn(r, e, s) {
7877
7899
  const t = s == null ? void 0 : s.toLowerCase(), n = r.map((o) => {
7878
7900
  const a = t && o.address.toLowerCase() === t;
7879
7901
  return `<button class="__crossx-wallet-item" data-wallet-index="${o.index}" data-wallet-address="${L(o.address)}">
@@ -7904,7 +7926,7 @@ function Fn(r, e, s) {
7904
7926
  ${n}
7905
7927
  </div>
7906
7928
  <button class="__crossx-wallet-add" id="__crossx-add-wallet-btn" type="button">
7907
- <span class="__crossx-wallet-add-icon">${Hn}</span>
7929
+ <span class="__crossx-wallet-add-icon">${Fn}</span>
7908
7930
  <span class="__crossx-wallet-add-label">add a wallet</span>
7909
7931
  </button>
7910
7932
  </div>
@@ -7916,13 +7938,13 @@ function Fn(r, e, s) {
7916
7938
  const Wn = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
7917
7939
  <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
7940
  <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">
7941
+ </svg>`, qn = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
7920
7942
  <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
7943
  <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
7944
  <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
7945
  <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
7946
  </svg>`;
7925
- function qn(r, e = !1) {
7947
+ function Kn(r, e = !1) {
7926
7948
  const s = r, t = e ? `
7927
7949
  <div class="__crossx-login-or-divider">
7928
7950
  <hr><span>or</span><hr>
@@ -7950,7 +7972,7 @@ function qn(r, e = !1) {
7950
7972
  <span class="__crossx-login-btn-label">Sign in with&nbsp;&nbsp;Apple</span>
7951
7973
  </button>
7952
7974
  <button class="__crossx-login-btn" id="__crossx-google-btn" type="button">
7953
- <span class="__crossx-login-icon">${Gn}</span>
7975
+ <span class="__crossx-login-icon">${qn}</span>
7954
7976
  <span class="__crossx-login-btn-label">Sign in with&nbsp;&nbsp;Google</span>
7955
7977
  </button>
7956
7978
  </div>${t}
@@ -7961,7 +7983,7 @@ function qn(r, e = !1) {
7961
7983
  </div>
7962
7984
  `, n;
7963
7985
  }
7964
- function Kn(r, e) {
7986
+ function Vn(r, e) {
7965
7987
  const s = r, t = document.createElement("div");
7966
7988
  t.id = J;
7967
7989
  const n = L(e.message).replace(/\n/g, "<br>"), i = e.email ? `<div class="__crossx-session-account-card">
@@ -7989,7 +8011,7 @@ function Kn(r, e) {
7989
8011
  </div>
7990
8012
  `, t;
7991
8013
  }
7992
- function Vn(r, e = !0) {
8014
+ function zn(r, e = !0) {
7993
8015
  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
8016
  return i.id = J, i.innerHTML = `
7995
8017
  <div class="__crossx-card __crossx-card--migration" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -8005,7 +8027,7 @@ function Vn(r, e = !0) {
8005
8027
  <p class="__crossx-mig-info-desc">It safely restores and integrates all your previous assets. Simply verify your PIN to get started.</p>
8006
8028
  </div>
8007
8029
  <button class="__crossx-recover-btn" id="__crossx-recover-btn">
8008
- <span class="__crossx-recover-icon">${Rn}</span>
8030
+ <span class="__crossx-recover-icon">${kn}</span>
8009
8031
  <span class="__crossx-recover-label">Import from Social Backup</span>
8010
8032
  </button>
8011
8033
  ${n}
@@ -8013,7 +8035,7 @@ function Vn(r, e = !0) {
8013
8035
  </div>
8014
8036
  `, i;
8015
8037
  }
8016
- function zn(r, e) {
8038
+ function jn(r, e) {
8017
8039
  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
8040
  return p.id = J, p.innerHTML = `
8019
8041
  <div class="__crossx-card __crossx-card--migration" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -8037,12 +8059,12 @@ function zn(r, e) {
8037
8059
  </div>
8038
8060
  `, p;
8039
8061
  }
8040
- function jn(r) {
8062
+ function Yn(r) {
8041
8063
  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
8064
  return `${n}, ${i} ${o} ${a}:${c}`;
8043
8065
  }
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");
8066
+ function Xn(r, e, s) {
8067
+ const t = r, n = e <= 0, i = n ? null : Date.now() + e * 1e3, o = i ? Yn(i) : null, a = document.createElement("div");
8046
8068
  return a.id = J, a.innerHTML = `
8047
8069
  <div class="__crossx-card __crossx-card--migration" style="${ae(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
8048
8070
  <div class="__crossx-header">
@@ -8072,10 +8094,10 @@ function Yn(r, e, s) {
8072
8094
  return () => clearInterval(p);
8073
8095
  } };
8074
8096
  }
8075
- function Xn(r) {
8097
+ function Jn(r) {
8076
8098
  const s = [r.check1, r.check2].map((t, n) => `
8077
8099
  <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>
8100
+ <div class="__crossx-pw-notice-check" id="__crossx-notice-check-${n}">${ei}</div>
8079
8101
  <span class="__crossx-pw-notice-item-text">${L(t)}</span>
8080
8102
  </div>
8081
8103
  `).join("");
@@ -8090,7 +8112,7 @@ function Xn(r) {
8090
8112
  <div class="__crossx-pw-fields __crossx-pw-fields--notice">
8091
8113
  <div class="__crossx-pw-notice-header">
8092
8114
  <div class="__crossx-pw-notice-title-row">
8093
- <span class="__crossx-pw-notice-icon">${ei}</span>
8115
+ <span class="__crossx-pw-notice-icon">${ti}</span>
8094
8116
  <p class="__crossx-pw-notice-title">${L(r.noticeTitle)}</p>
8095
8117
  </div>
8096
8118
  <p class="__crossx-pw-notice-desc">${L(r.noticeDesc)}</p>
@@ -8108,9 +8130,9 @@ function Xn(r) {
8108
8130
  <div class="__crossx-home-indicator"></div>
8109
8131
  `;
8110
8132
  }
8111
- function at(r) {
8133
+ function ct(r) {
8112
8134
  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}
8135
+ ${Bs}
8114
8136
  <span id="__crossx-pin6-lock-countdown"></span>
8115
8137
  </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
8138
  { length: 6 },
@@ -8135,7 +8157,7 @@ function at(r) {
8135
8157
  <div class="__crossx-home-indicator"></div>
8136
8158
  `;
8137
8159
  }
8138
- function ts(r, e) {
8160
+ function rs(r, e) {
8139
8161
  const s = document.createElement("div");
8140
8162
  return s.id = J, s.innerHTML = `
8141
8163
  <div class="__crossx-card __crossx-card--pin6" style="${ae(r)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -8143,18 +8165,18 @@ function ts(r, e) {
8143
8165
  </div>
8144
8166
  `, s;
8145
8167
  }
8146
- function Jn(r, e) {
8168
+ function Zn(r, e) {
8147
8169
  if (r.length !== 6) return e.tooShort;
8148
8170
  if (!/^\d+$/.test(r)) return e.numbersOnly;
8149
8171
  if (/(.)\1{2}/.test(r)) return e.repeatingDigit;
8150
8172
  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
8173
  return t || n ? e.sequential : r[0] !== r[1] && r === r.slice(0, 2).repeat(3) ? e.alternatingPattern : null;
8152
8174
  }
8153
- function Zn(r) {
8175
+ function Qn(r) {
8154
8176
  const e = Math.max(0, Math.ceil(r / 1e3)), s = Math.floor(e / 3600), t = Math.floor(e % 3600 / 60), n = e % 60;
8155
8177
  return s > 0 ? `${s}h ${String(t).padStart(2, "0")}m` : `${String(t).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
8156
8178
  }
8157
- function ct(r, e, s, t, n, i) {
8179
+ function lt(r, e, s, t, n, i) {
8158
8180
  var U, z;
8159
8181
  let o = !!(i && i > Date.now()), a = !1;
8160
8182
  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 +8216,7 @@ function ct(r, e, s, t, n, i) {
8194
8216
  const v = u();
8195
8217
  if (v && (v.textContent = "Too many failed attempts. Please wait."), !p()) {
8196
8218
  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>`;
8219
+ b.className = "__crossx-pin6-lock-msg", b.id = "__crossx-pin6-lock-msg", b.innerHTML = `${Bs}<span id="__crossx-pin6-lock-countdown"></span>`;
8198
8220
  const A = u();
8199
8221
  A ? A.insertAdjacentElement("afterend", b) : (m = f()) == null || m.appendChild(b);
8200
8222
  }
@@ -8204,14 +8226,14 @@ function ct(r, e, s, t, n, i) {
8204
8226
  b <= 0 ? (clearInterval(T), S(!1), (N = p()) == null || N.remove(), v && (v.textContent = ""), setTimeout(() => {
8205
8227
  var C;
8206
8228
  return (C = c()[0]) == null ? void 0 : C.focus();
8207
- }, 50)) : A && (A.textContent = ` ${Zn(b)}`);
8229
+ }, 50)) : A && (A.textContent = ` ${Qn(b)}`);
8208
8230
  }, T = setInterval(E, 1e3);
8209
8231
  E();
8210
8232
  const x = new MutationObserver(() => {
8211
8233
  document.contains(r) || (clearInterval(T), x.disconnect());
8212
8234
  });
8213
8235
  x.observe(document.body, { childList: !0, subtree: !1 });
8214
- }, W = async () => {
8236
+ }, G = async () => {
8215
8237
  if (o || a) return;
8216
8238
  const k = w();
8217
8239
  if (k.length === 6) {
@@ -8251,7 +8273,7 @@ function ct(r, e, s, t, n, i) {
8251
8273
  k.addEventListener("input", () => {
8252
8274
  var T;
8253
8275
  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);
8276
+ k.value = E, I(), E && v < 5 && ((T = c()[v + 1]) == null || T.focus()), w().length === 6 && setTimeout(G, 80);
8255
8277
  }), k.addEventListener("keydown", (E) => {
8256
8278
  var T, x;
8257
8279
  if (E.key === "Backspace") {
@@ -8270,18 +8292,18 @@ function ct(r, e, s, t, n, i) {
8270
8292
  const x = c();
8271
8293
  T.split("").forEach((A, N) => {
8272
8294
  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);
8295
+ }), (b = x[Math.min(T.length - 1, 5)]) == null || b.focus(), I(), w().length === 6 && setTimeout(G, 80);
8274
8296
  }), k.addEventListener("focus", () => k.select());
8275
8297
  });
8276
8298
  }
8277
- const Ms = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
8299
+ const Bs = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
8278
8300
  <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">
8301
+ </svg>`, ei = `<svg width="11" height="9" viewBox="0 0 11 9" fill="none" xmlns="http://www.w3.org/2000/svg">
8280
8302
  <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">
8303
+ </svg>`, ti = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
8282
8304
  <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
8305
  </svg>`;
8284
- function ti(r, e, s) {
8306
+ function si(r, e, s) {
8285
8307
  var i;
8286
8308
  const t = r.querySelectorAll(".__crossx-pin-input");
8287
8309
  t.forEach((o, a) => {
@@ -8314,12 +8336,12 @@ function ti(r, e, s) {
8314
8336
  }
8315
8337
  }), (i = t[0]) == null || i.focus();
8316
8338
  }
8317
- class si {
8339
+ class ri {
8318
8340
  constructor(e = "light", s) {
8319
- this.theme = e, this.overrides = s, this.tokens = Qt(e, s);
8341
+ this.theme = e, this.overrides = s, this.tokens = ts(e, s);
8320
8342
  }
8321
8343
  setTheme(e, s) {
8322
- this.theme = e, s !== void 0 && (this.overrides = s), this.tokens = Qt(e, this.overrides);
8344
+ this.theme = e, s !== void 0 && (this.overrides = s), this.tokens = ts(e, this.overrides);
8323
8345
  }
8324
8346
  setMessages(e) {
8325
8347
  this.messages = e;
@@ -8336,7 +8358,7 @@ class si {
8336
8358
  return new Promise((n) => {
8337
8359
  var S;
8338
8360
  le();
8339
- const i = [...e], o = Fn(i, this.tokens, t), a = Ge();
8361
+ const i = [...e], o = Gn(i, this.tokens, t), a = qe();
8340
8362
  de(o);
8341
8363
  let c = !1;
8342
8364
  const l = () => {
@@ -8388,7 +8410,7 @@ class si {
8388
8410
  return new Promise((s) => {
8389
8411
  var c, l, u, p;
8390
8412
  le();
8391
- const t = qn(this.tokens, e == null ? void 0 : e.showConnectOtherWallets);
8413
+ const t = Kn(this.tokens, e == null ? void 0 : e.showConnectOtherWallets);
8392
8414
  de(t);
8393
8415
  const n = () => t.remove(), i = (_) => {
8394
8416
  n(), s(_);
@@ -8410,14 +8432,14 @@ class si {
8410
8432
  return new Promise((s) => {
8411
8433
  var u, p, _;
8412
8434
  le();
8413
- const t = this.messages, n = Kn(this.tokens, {
8435
+ const t = this.messages, n = Vn(this.tokens, {
8414
8436
  title: e.title,
8415
8437
  message: e.message,
8416
8438
  email: e.email,
8417
8439
  accountLabel: (t == null ? void 0 : t.sessionAlert_accountLabel) ?? "Account",
8418
8440
  signOutLabel: (t == null ? void 0 : t.sessionAlert_signOutButton) ?? "Sign out",
8419
8441
  signInAgainLabel: (t == null ? void 0 : t.sessionAlert_signInAgainButton) ?? "Sign in again"
8420
- }), i = Ge();
8442
+ }), i = qe();
8421
8443
  de(n);
8422
8444
  let o = !1;
8423
8445
  const a = () => {
@@ -8440,7 +8462,7 @@ class si {
8440
8462
  return new Promise((t) => {
8441
8463
  var a, c, l;
8442
8464
  le();
8443
- const n = Vn(this.tokens, s);
8465
+ const n = zn(this.tokens, s);
8444
8466
  de(n);
8445
8467
  const i = () => n.remove(), o = () => {
8446
8468
  i(), t("recover");
@@ -8486,7 +8508,7 @@ class si {
8486
8508
  }, o = {
8487
8509
  title: (t == null ? void 0 : t.pinSetup_confirmTitle) ?? "Confirm PIN",
8488
8510
  headerSubtitle: (t == null ? void 0 : t.pinSetup_confirmSubtitle) ?? "Enter your PIN again to confirm."
8489
- }, a = ts(this.tokens, Xn(n)), c = Ge();
8511
+ }, a = rs(this.tokens, Jn(n)), c = qe();
8490
8512
  de(a);
8491
8513
  let l = !1;
8492
8514
  const u = () => {
@@ -8503,21 +8525,21 @@ class si {
8503
8525
  alternatingPattern: (t == null ? void 0 : t.pinValidation_alternatingPattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
8504
8526
  }, S = (P) => {
8505
8527
  var H;
8506
- f.innerHTML = at({
8528
+ f.innerHTML = ct({
8507
8529
  title: o.title,
8508
8530
  headerSubtitle: o.headerSubtitle
8509
- }), (H = f.querySelector("#__crossx-close-btn")) == null || H.addEventListener("click", _), ct(f, (D) => {
8531
+ }), (H = f.querySelector("#__crossx-close-btn")) == null || H.addEventListener("click", _), lt(f, (D) => {
8510
8532
  D === P ? p(P) : y(i.mismatchError);
8511
8533
  }, _);
8512
8534
  }, y = (P) => {
8513
8535
  var H;
8514
- f.innerHTML = at({
8536
+ f.innerHTML = ct({
8515
8537
  title: i.title,
8516
8538
  headerSubtitle: i.headerSubtitle,
8517
8539
  subtitle: i.subtitle,
8518
8540
  errorMessage: P
8519
- }), (H = f.querySelector("#__crossx-close-btn")) == null || H.addEventListener("click", _), ct(f, (D) => {
8520
- const K = Jn(D, w);
8541
+ }), (H = f.querySelector("#__crossx-close-btn")) == null || H.addEventListener("click", _), lt(f, (D) => {
8542
+ const K = Zn(D, w);
8521
8543
  K ? y(K) : S(D);
8522
8544
  }, _);
8523
8545
  };
@@ -8525,9 +8547,9 @@ class si {
8525
8547
  var k;
8526
8548
  const P = Array.from(f.querySelectorAll(".__crossx-pw-notice-item")), H = f.querySelector("#__crossx-pin-notice-next"), D = /* @__PURE__ */ new Set();
8527
8549
  H.removeAttribute("disabled");
8528
- const K = H.dataset.nextLabel ?? "Next", W = H.dataset.submitLabel ?? "I Understand", Z = () => {
8550
+ const K = H.dataset.nextLabel ?? "Next", G = H.dataset.submitLabel ?? "I Understand", Z = () => {
8529
8551
  const v = D.size === P.length;
8530
- H.classList.toggle("--disabled", !v), H.textContent = v ? W : K;
8552
+ H.classList.toggle("--disabled", !v), H.textContent = v ? G : K;
8531
8553
  }, U = (v, E) => {
8532
8554
  if (D.has(E)) return;
8533
8555
  const T = v.querySelector(`#__crossx-notice-check-${E}`);
@@ -8573,9 +8595,9 @@ class si {
8573
8595
  return new Promise((s, t) => {
8574
8596
  var y;
8575
8597
  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(
8598
+ 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
8599
  this.tokens,
8578
- at({
8600
+ ct({
8579
8601
  title: o,
8580
8602
  headerSubtitle: a,
8581
8603
  errorMessage: e == null ? void 0 : e.errorMessage,
@@ -8583,7 +8605,7 @@ class si {
8583
8605
  attemptCount: e == null ? void 0 : e.attemptCount,
8584
8606
  maxAttempts: e == null ? void 0 : e.maxAttempts
8585
8607
  })
8586
- ), l = Ge();
8608
+ ), l = qe();
8587
8609
  de(c);
8588
8610
  let u = !1;
8589
8611
  const p = () => {
@@ -8595,7 +8617,7 @@ class si {
8595
8617
  }, w = (I) => {
8596
8618
  p(), t(I);
8597
8619
  }, 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) => {
8620
+ (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
8621
  I.target === c && f();
8600
8622
  });
8601
8623
  });
@@ -8611,14 +8633,14 @@ class si {
8611
8633
  return new Promise((s) => {
8612
8634
  var a;
8613
8635
  le();
8614
- const t = zn(this.tokens, e);
8636
+ const t = jn(this.tokens, e);
8615
8637
  de(t);
8616
8638
  const n = () => t.remove(), i = (c) => {
8617
8639
  n(), s(c);
8618
8640
  }, o = () => {
8619
8641
  n(), s(null);
8620
8642
  };
8621
- ti(t, i, o), (a = t.querySelector("#__crossx-close-btn")) == null || a.addEventListener("click", o), t.addEventListener("click", (c) => {
8643
+ si(t, i, o), (a = t.querySelector("#__crossx-close-btn")) == null || a.addEventListener("click", o), t.addEventListener("click", (c) => {
8622
8644
  c.target === t && o();
8623
8645
  });
8624
8646
  });
@@ -8633,7 +8655,7 @@ class si {
8633
8655
  return new Promise((t) => {
8634
8656
  var l;
8635
8657
  le();
8636
- const { overlay: n, startCountdown: i } = Yn(this.tokens, e, s);
8658
+ const { overlay: n, startCountdown: i } = Xn(this.tokens, e, s);
8637
8659
  de(n);
8638
8660
  const o = () => {
8639
8661
  c(), n.remove();
@@ -8653,7 +8675,7 @@ class si {
8653
8675
  return new Promise((s) => {
8654
8676
  var a, c;
8655
8677
  le();
8656
- const t = Dn(e, this.tokens);
8678
+ const t = Mn(e, this.tokens);
8657
8679
  de(t);
8658
8680
  const n = () => t.remove(), i = () => {
8659
8681
  n(), s();
@@ -8682,7 +8704,7 @@ class si {
8682
8704
  showTransactionProgress(e, s) {
8683
8705
  return new Promise((t) => {
8684
8706
  le();
8685
- const n = Mn(e, this.tokens);
8707
+ const n = $n(e, this.tokens);
8686
8708
  de(n);
8687
8709
  const i = () => n.remove();
8688
8710
  let o = !1;
@@ -8699,7 +8721,7 @@ class si {
8699
8721
  document.addEventListener("keydown", l);
8700
8722
  };
8701
8723
  s.then((l) => {
8702
- o || ($n(n, l, this.tokens), c());
8724
+ o || (Bn(n, l, this.tokens), c());
8703
8725
  });
8704
8726
  });
8705
8727
  }
@@ -8708,7 +8730,7 @@ class si {
8708
8730
  var c, l, u;
8709
8731
  le();
8710
8732
  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);
8733
+ 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
8734
  const n = () => t.remove(), i = () => {
8713
8735
  n(), s(!0);
8714
8736
  }, o = () => {
@@ -8732,7 +8754,7 @@ class si {
8732
8754
  });
8733
8755
  }
8734
8756
  }
8735
- class ri {
8757
+ class ni {
8736
8758
  constructor() {
8737
8759
  this._accessToken = null, this._expiresAt = 0;
8738
8760
  }
@@ -8764,9 +8786,9 @@ class ri {
8764
8786
  return !this._accessToken || this._expiresAt <= 0 ? !0 : Date.now() >= this._expiresAt - e;
8765
8787
  }
8766
8788
  }
8767
- function ui(r, e) {
8789
+ function hi(r, e) {
8768
8790
  r.debug;
8769
- const s = Ke.production, t = {
8791
+ const s = Oe.production, t = {
8770
8792
  ...r,
8771
8793
  oauthServiceUrl: s.oauthServiceUrl,
8772
8794
  authApiUrl: s.authApiUrl,
@@ -8774,22 +8796,22 @@ function ui(r, e) {
8774
8796
  }, n = {
8775
8797
  gatewayUrl: s.walletGatewayUrl,
8776
8798
  projectId: r.projectId
8777
- }, i = t.authMode !== "cookie" && Dt.isAvailable();
8799
+ }, i = t.authMode !== "cookie" && $t.isAvailable();
8778
8800
  !i && t.authMode !== "cookie" && d.warn(
8779
8801
  "[CROSSx] IndexedDB 사용 불가 — LocalStorage fallback 사용 중.",
8780
8802
  "refresh_token이 평문 저장되지 않도록 세션 영속성이 제한됩니다.",
8781
8803
  "IndexedDB를 지원하는 브라우저 사용을 권장합니다."
8782
8804
  ), 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();
8805
+ 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
8806
  let _;
8785
- r.useMockWallet ? (d.log("[CROSSx] Mock Wallet Provider 사용"), _ = new bn(o, p)) : (d.log("[CROSSx] Remote Wallet Provider 사용"), _ = new Ae(
8807
+ r.useMockWallet ? (d.log("[CROSSx] Mock Wallet Provider 사용"), _ = new Sn(o, p)) : (d.log("[CROSSx] Remote Wallet Provider 사용"), _ = new Ae(
8786
8808
  n,
8787
8809
  o,
8788
8810
  c,
8789
8811
  u,
8790
8812
  p
8791
8813
  ));
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(
8814
+ const f = new Be(n, c), w = new ri(r.theme ?? "light", r.themeTokens), S = e != null && e.wrapConfirmation ? e.wrapConfirmation(w) : w, y = new ut(
8793
8815
  t,
8794
8816
  n,
8795
8817
  o,
@@ -8804,9 +8826,9 @@ function ui(r, e) {
8804
8826
  );
8805
8827
  return typeof window < "u" && (window.__crossxSDK = y), y;
8806
8828
  }
8807
- function hi(r) {
8808
- const e = ni(r), s = ii(e), t = JSON.parse(s);
8809
- ai(t);
8829
+ function pi(r) {
8830
+ const e = ii(r), s = oi(e), t = JSON.parse(s);
8831
+ ci(t);
8810
8832
  const { data: n } = t;
8811
8833
  return {
8812
8834
  status: t.status,
@@ -8820,7 +8842,7 @@ function hi(r) {
8820
8842
  raw: t
8821
8843
  };
8822
8844
  }
8823
- function ni(r) {
8845
+ function ii(r) {
8824
8846
  if (r.includes("://") && r.includes("?")) {
8825
8847
  const e = new URL(r), s = e.searchParams.get("crossx_oauth_result");
8826
8848
  if (s) return s;
@@ -8830,22 +8852,22 @@ function ni(r) {
8830
8852
  }
8831
8853
  return r;
8832
8854
  }
8833
- function ii(r) {
8855
+ function oi(r) {
8834
8856
  if (r.startsWith("{"))
8835
8857
  return r;
8836
8858
  if (r.startsWith("%7B") || r.startsWith("%7b"))
8837
8859
  return decodeURIComponent(r);
8838
- const e = oi(r);
8860
+ const e = ai(r);
8839
8861
  return decodeURIComponent(e);
8840
8862
  }
8841
- function oi(r) {
8863
+ function ai(r) {
8842
8864
  if (typeof atob == "function")
8843
8865
  return atob(r);
8844
8866
  if (typeof Buffer < "u")
8845
8867
  return Buffer.from(r, "base64").toString("utf-8");
8846
8868
  throw new Error("Base64 디코딩을 지원하는 환경이 아닙니다");
8847
8869
  }
8848
- function ai(r) {
8870
+ function ci(r) {
8849
8871
  if (typeof r != "object" || r === null)
8850
8872
  throw new Error("Deeplink payload가 유효한 객체가 아닙니다");
8851
8873
  const e = r;
@@ -8863,12 +8885,12 @@ function ai(r) {
8863
8885
  }
8864
8886
  export {
8865
8887
  g as CROSSxError,
8866
- qs as CROSSxEthereumProvider,
8867
- lt as CROSSxSDK,
8868
- di as ChainId,
8888
+ Vs as CROSSxEthereumProvider,
8889
+ ut as CROSSxSDK,
8890
+ ui as ChainId,
8869
8891
  h as ErrorCode,
8870
- rs as PinMemoryStore,
8871
- ri as TokenMemoryStore,
8872
- ui as createCROSSxSDK,
8873
- hi as parseOAuthDeeplink
8892
+ is as PinMemoryStore,
8893
+ ni as TokenMemoryStore,
8894
+ hi as createCROSSxSDK,
8895
+ pi as parseOAuthDeeplink
8874
8896
  };